89d2e8a12a065cce807ad515731d08ee8784b182
[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 "util/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 #include "util/u_memory.h"
77
78 #define USE_BITMAP_ATLAS 1
79
80
81
82 /**
83 * Other parts of Mesa (such as the VBO module) can plug into the display
84 * list system. This structure describes new display list instructions.
85 */
86 struct gl_list_instruction
87 {
88 GLuint Size;
89 void (*Execute)( struct gl_context *ctx, void *data );
90 void (*Destroy)( struct gl_context *ctx, void *data );
91 void (*Print)( struct gl_context *ctx, void *data, FILE *f );
92 };
93
94
95 #define MAX_DLIST_EXT_OPCODES 16
96
97 /**
98 * Used by device drivers to hook new commands into display lists.
99 */
100 struct gl_list_extensions
101 {
102 struct gl_list_instruction Opcode[MAX_DLIST_EXT_OPCODES];
103 GLuint NumOpcodes;
104 };
105
106
107
108 /**
109 * Flush vertices.
110 *
111 * \param ctx GL context.
112 *
113 * Checks if dd_function_table::SaveNeedFlush is marked to flush
114 * stored (save) vertices, and calls vbo_save_SaveFlushVertices if so.
115 */
116 #define SAVE_FLUSH_VERTICES(ctx) \
117 do { \
118 if (ctx->Driver.SaveNeedFlush) \
119 vbo_save_SaveFlushVertices(ctx); \
120 } while (0)
121
122
123 /**
124 * Macro to assert that the API call was made outside the
125 * glBegin()/glEnd() pair, with return value.
126 *
127 * \param ctx GL context.
128 * \param retval value to return value in case the assertion fails.
129 */
130 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval) \
131 do { \
132 if (ctx->Driver.CurrentSavePrimitive <= PRIM_MAX) { \
133 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glBegin/End" ); \
134 return retval; \
135 } \
136 } while (0)
137
138 /**
139 * Macro to assert that the API call was made outside the
140 * glBegin()/glEnd() pair.
141 *
142 * \param ctx GL context.
143 */
144 #define ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx) \
145 do { \
146 if (ctx->Driver.CurrentSavePrimitive <= PRIM_MAX) { \
147 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glBegin/End" ); \
148 return; \
149 } \
150 } while (0)
151
152 /**
153 * Macro to assert that the API call was made outside the
154 * glBegin()/glEnd() pair and flush the vertices.
155 *
156 * \param ctx GL context.
157 */
158 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx) \
159 do { \
160 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx); \
161 SAVE_FLUSH_VERTICES(ctx); \
162 } while (0)
163
164 /**
165 * Macro to assert that the API call was made outside the
166 * glBegin()/glEnd() pair and flush the vertices, with return value.
167 *
168 * \param ctx GL context.
169 * \param retval value to return value in case the assertion fails.
170 */
171 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval) \
172 do { \
173 ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval); \
174 SAVE_FLUSH_VERTICES(ctx); \
175 } while (0)
176
177
178 /**
179 * Display list opcodes.
180 *
181 * The fact that these identifiers are assigned consecutive
182 * integer values starting at 0 is very important, see InstSize array usage)
183 */
184 typedef enum
185 {
186 OPCODE_INVALID = -1, /* Force signed enum */
187 OPCODE_ACCUM,
188 OPCODE_ALPHA_FUNC,
189 OPCODE_BIND_TEXTURE,
190 OPCODE_BITMAP,
191 OPCODE_BLEND_COLOR,
192 OPCODE_BLEND_EQUATION,
193 OPCODE_BLEND_EQUATION_SEPARATE,
194 OPCODE_BLEND_FUNC_SEPARATE,
195
196 OPCODE_BLEND_EQUATION_I,
197 OPCODE_BLEND_EQUATION_SEPARATE_I,
198 OPCODE_BLEND_FUNC_I,
199 OPCODE_BLEND_FUNC_SEPARATE_I,
200
201 OPCODE_CALL_LIST,
202 OPCODE_CALL_LISTS,
203 OPCODE_CLEAR,
204 OPCODE_CLEAR_ACCUM,
205 OPCODE_CLEAR_COLOR,
206 OPCODE_CLEAR_DEPTH,
207 OPCODE_CLEAR_INDEX,
208 OPCODE_CLEAR_STENCIL,
209 OPCODE_CLEAR_BUFFER_IV,
210 OPCODE_CLEAR_BUFFER_UIV,
211 OPCODE_CLEAR_BUFFER_FV,
212 OPCODE_CLEAR_BUFFER_FI,
213 OPCODE_CLIP_PLANE,
214 OPCODE_COLOR_MASK,
215 OPCODE_COLOR_MASK_INDEXED,
216 OPCODE_COLOR_MATERIAL,
217 OPCODE_COPY_PIXELS,
218 OPCODE_COPY_TEX_IMAGE1D,
219 OPCODE_COPY_TEX_IMAGE2D,
220 OPCODE_COPY_TEX_SUB_IMAGE1D,
221 OPCODE_COPY_TEX_SUB_IMAGE2D,
222 OPCODE_COPY_TEX_SUB_IMAGE3D,
223 OPCODE_CULL_FACE,
224 OPCODE_DEPTH_FUNC,
225 OPCODE_DEPTH_MASK,
226 OPCODE_DEPTH_RANGE,
227 OPCODE_DISABLE,
228 OPCODE_DISABLE_INDEXED,
229 OPCODE_DRAW_BUFFER,
230 OPCODE_DRAW_PIXELS,
231 OPCODE_ENABLE,
232 OPCODE_ENABLE_INDEXED,
233 OPCODE_EVALMESH1,
234 OPCODE_EVALMESH2,
235 OPCODE_FOG,
236 OPCODE_FRONT_FACE,
237 OPCODE_FRUSTUM,
238 OPCODE_HINT,
239 OPCODE_INDEX_MASK,
240 OPCODE_INIT_NAMES,
241 OPCODE_LIGHT,
242 OPCODE_LIGHT_MODEL,
243 OPCODE_LINE_STIPPLE,
244 OPCODE_LINE_WIDTH,
245 OPCODE_LIST_BASE,
246 OPCODE_LOAD_IDENTITY,
247 OPCODE_LOAD_MATRIX,
248 OPCODE_LOAD_NAME,
249 OPCODE_LOGIC_OP,
250 OPCODE_MAP1,
251 OPCODE_MAP2,
252 OPCODE_MAPGRID1,
253 OPCODE_MAPGRID2,
254 OPCODE_MATRIX_MODE,
255 OPCODE_MULT_MATRIX,
256 OPCODE_ORTHO,
257 OPCODE_PASSTHROUGH,
258 OPCODE_PIXEL_MAP,
259 OPCODE_PIXEL_TRANSFER,
260 OPCODE_PIXEL_ZOOM,
261 OPCODE_POINT_SIZE,
262 OPCODE_POINT_PARAMETERS,
263 OPCODE_POLYGON_MODE,
264 OPCODE_POLYGON_STIPPLE,
265 OPCODE_POLYGON_OFFSET,
266 OPCODE_POP_ATTRIB,
267 OPCODE_POP_MATRIX,
268 OPCODE_POP_NAME,
269 OPCODE_PRIORITIZE_TEXTURE,
270 OPCODE_PUSH_ATTRIB,
271 OPCODE_PUSH_MATRIX,
272 OPCODE_PUSH_NAME,
273 OPCODE_RASTER_POS,
274 OPCODE_READ_BUFFER,
275 OPCODE_ROTATE,
276 OPCODE_SCALE,
277 OPCODE_SCISSOR,
278 OPCODE_SELECT_TEXTURE_SGIS,
279 OPCODE_SELECT_TEXTURE_COORD_SET,
280 OPCODE_SHADE_MODEL,
281 OPCODE_STENCIL_FUNC,
282 OPCODE_STENCIL_MASK,
283 OPCODE_STENCIL_OP,
284 OPCODE_TEXENV,
285 OPCODE_TEXGEN,
286 OPCODE_TEXPARAMETER,
287 OPCODE_TEX_IMAGE1D,
288 OPCODE_TEX_IMAGE2D,
289 OPCODE_TEX_IMAGE3D,
290 OPCODE_TEX_SUB_IMAGE1D,
291 OPCODE_TEX_SUB_IMAGE2D,
292 OPCODE_TEX_SUB_IMAGE3D,
293 OPCODE_TRANSLATE,
294 OPCODE_VIEWPORT,
295 OPCODE_WINDOW_POS,
296 /* ARB_viewport_array */
297 OPCODE_VIEWPORT_ARRAY_V,
298 OPCODE_VIEWPORT_INDEXED_F,
299 OPCODE_VIEWPORT_INDEXED_FV,
300 OPCODE_SCISSOR_ARRAY_V,
301 OPCODE_SCISSOR_INDEXED,
302 OPCODE_SCISSOR_INDEXED_V,
303 OPCODE_DEPTH_ARRAY_V,
304 OPCODE_DEPTH_INDEXED,
305 /* GL_ARB_multitexture */
306 OPCODE_ACTIVE_TEXTURE,
307 /* GL_ARB_texture_compression */
308 OPCODE_COMPRESSED_TEX_IMAGE_1D,
309 OPCODE_COMPRESSED_TEX_IMAGE_2D,
310 OPCODE_COMPRESSED_TEX_IMAGE_3D,
311 OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D,
312 OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D,
313 OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D,
314 /* GL_ARB_multisample */
315 OPCODE_SAMPLE_COVERAGE,
316 /* GL_ARB_window_pos */
317 OPCODE_WINDOW_POS_ARB,
318 /* GL_ARB_vertex_program */
319 OPCODE_BIND_PROGRAM_ARB,
320 OPCODE_PROGRAM_LOCAL_PARAMETER_ARB,
321 /* GL_EXT_stencil_two_side */
322 OPCODE_ACTIVE_STENCIL_FACE_EXT,
323 /* GL_EXT_depth_bounds_test */
324 OPCODE_DEPTH_BOUNDS_EXT,
325 /* GL_ARB_vertex/fragment_program */
326 OPCODE_PROGRAM_STRING_ARB,
327 OPCODE_PROGRAM_ENV_PARAMETER_ARB,
328 /* GL_ARB_occlusion_query */
329 OPCODE_BEGIN_QUERY_ARB,
330 OPCODE_END_QUERY_ARB,
331 /* GL_ARB_draw_buffers */
332 OPCODE_DRAW_BUFFERS_ARB,
333 /* GL_ATI_fragment_shader */
334 OPCODE_BIND_FRAGMENT_SHADER_ATI,
335 OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI,
336 /* OpenGL 2.0 */
337 OPCODE_STENCIL_FUNC_SEPARATE,
338 OPCODE_STENCIL_OP_SEPARATE,
339 OPCODE_STENCIL_MASK_SEPARATE,
340 /* GL_NV_primitive_restart */
341 OPCODE_PRIMITIVE_RESTART_NV,
342 /* GL_ARB_shader_objects */
343 OPCODE_USE_PROGRAM,
344 OPCODE_UNIFORM_1F,
345 OPCODE_UNIFORM_2F,
346 OPCODE_UNIFORM_3F,
347 OPCODE_UNIFORM_4F,
348 OPCODE_UNIFORM_1FV,
349 OPCODE_UNIFORM_2FV,
350 OPCODE_UNIFORM_3FV,
351 OPCODE_UNIFORM_4FV,
352 OPCODE_UNIFORM_1I,
353 OPCODE_UNIFORM_2I,
354 OPCODE_UNIFORM_3I,
355 OPCODE_UNIFORM_4I,
356 OPCODE_UNIFORM_1IV,
357 OPCODE_UNIFORM_2IV,
358 OPCODE_UNIFORM_3IV,
359 OPCODE_UNIFORM_4IV,
360 OPCODE_UNIFORM_MATRIX22,
361 OPCODE_UNIFORM_MATRIX33,
362 OPCODE_UNIFORM_MATRIX44,
363 OPCODE_UNIFORM_MATRIX23,
364 OPCODE_UNIFORM_MATRIX32,
365 OPCODE_UNIFORM_MATRIX24,
366 OPCODE_UNIFORM_MATRIX42,
367 OPCODE_UNIFORM_MATRIX34,
368 OPCODE_UNIFORM_MATRIX43,
369
370 /* OpenGL 3.0 */
371 OPCODE_UNIFORM_1UI,
372 OPCODE_UNIFORM_2UI,
373 OPCODE_UNIFORM_3UI,
374 OPCODE_UNIFORM_4UI,
375 OPCODE_UNIFORM_1UIV,
376 OPCODE_UNIFORM_2UIV,
377 OPCODE_UNIFORM_3UIV,
378 OPCODE_UNIFORM_4UIV,
379
380 /* GL_ARB_gpu_shader_fp64 */
381 OPCODE_UNIFORM_1D,
382 OPCODE_UNIFORM_2D,
383 OPCODE_UNIFORM_3D,
384 OPCODE_UNIFORM_4D,
385 OPCODE_UNIFORM_1DV,
386 OPCODE_UNIFORM_2DV,
387 OPCODE_UNIFORM_3DV,
388 OPCODE_UNIFORM_4DV,
389 OPCODE_UNIFORM_MATRIX22D,
390 OPCODE_UNIFORM_MATRIX33D,
391 OPCODE_UNIFORM_MATRIX44D,
392 OPCODE_UNIFORM_MATRIX23D,
393 OPCODE_UNIFORM_MATRIX32D,
394 OPCODE_UNIFORM_MATRIX24D,
395 OPCODE_UNIFORM_MATRIX42D,
396 OPCODE_UNIFORM_MATRIX34D,
397 OPCODE_UNIFORM_MATRIX43D,
398
399 /* GL_ARB_gpu_shader_int64 */
400 OPCODE_UNIFORM_1I64,
401 OPCODE_UNIFORM_2I64,
402 OPCODE_UNIFORM_3I64,
403 OPCODE_UNIFORM_4I64,
404 OPCODE_UNIFORM_1I64V,
405 OPCODE_UNIFORM_2I64V,
406 OPCODE_UNIFORM_3I64V,
407 OPCODE_UNIFORM_4I64V,
408 OPCODE_UNIFORM_1UI64,
409 OPCODE_UNIFORM_2UI64,
410 OPCODE_UNIFORM_3UI64,
411 OPCODE_UNIFORM_4UI64,
412 OPCODE_UNIFORM_1UI64V,
413 OPCODE_UNIFORM_2UI64V,
414 OPCODE_UNIFORM_3UI64V,
415 OPCODE_UNIFORM_4UI64V,
416 OPCODE_PROGRAM_UNIFORM_1I64,
417 OPCODE_PROGRAM_UNIFORM_2I64,
418 OPCODE_PROGRAM_UNIFORM_3I64,
419 OPCODE_PROGRAM_UNIFORM_4I64,
420 OPCODE_PROGRAM_UNIFORM_1I64V,
421 OPCODE_PROGRAM_UNIFORM_2I64V,
422 OPCODE_PROGRAM_UNIFORM_3I64V,
423 OPCODE_PROGRAM_UNIFORM_4I64V,
424 OPCODE_PROGRAM_UNIFORM_1UI64,
425 OPCODE_PROGRAM_UNIFORM_2UI64,
426 OPCODE_PROGRAM_UNIFORM_3UI64,
427 OPCODE_PROGRAM_UNIFORM_4UI64,
428 OPCODE_PROGRAM_UNIFORM_1UI64V,
429 OPCODE_PROGRAM_UNIFORM_2UI64V,
430 OPCODE_PROGRAM_UNIFORM_3UI64V,
431 OPCODE_PROGRAM_UNIFORM_4UI64V,
432
433 /* OpenGL 4.0 / GL_ARB_tessellation_shader */
434 OPCODE_PATCH_PARAMETER_I,
435 OPCODE_PATCH_PARAMETER_FV_INNER,
436 OPCODE_PATCH_PARAMETER_FV_OUTER,
437
438 /* OpenGL 4.2 / GL_ARB_separate_shader_objects */
439 OPCODE_USE_PROGRAM_STAGES,
440 OPCODE_PROGRAM_UNIFORM_1F,
441 OPCODE_PROGRAM_UNIFORM_2F,
442 OPCODE_PROGRAM_UNIFORM_3F,
443 OPCODE_PROGRAM_UNIFORM_4F,
444 OPCODE_PROGRAM_UNIFORM_1FV,
445 OPCODE_PROGRAM_UNIFORM_2FV,
446 OPCODE_PROGRAM_UNIFORM_3FV,
447 OPCODE_PROGRAM_UNIFORM_4FV,
448 OPCODE_PROGRAM_UNIFORM_1D,
449 OPCODE_PROGRAM_UNIFORM_2D,
450 OPCODE_PROGRAM_UNIFORM_3D,
451 OPCODE_PROGRAM_UNIFORM_4D,
452 OPCODE_PROGRAM_UNIFORM_1DV,
453 OPCODE_PROGRAM_UNIFORM_2DV,
454 OPCODE_PROGRAM_UNIFORM_3DV,
455 OPCODE_PROGRAM_UNIFORM_4DV,
456 OPCODE_PROGRAM_UNIFORM_1I,
457 OPCODE_PROGRAM_UNIFORM_2I,
458 OPCODE_PROGRAM_UNIFORM_3I,
459 OPCODE_PROGRAM_UNIFORM_4I,
460 OPCODE_PROGRAM_UNIFORM_1IV,
461 OPCODE_PROGRAM_UNIFORM_2IV,
462 OPCODE_PROGRAM_UNIFORM_3IV,
463 OPCODE_PROGRAM_UNIFORM_4IV,
464 OPCODE_PROGRAM_UNIFORM_1UI,
465 OPCODE_PROGRAM_UNIFORM_2UI,
466 OPCODE_PROGRAM_UNIFORM_3UI,
467 OPCODE_PROGRAM_UNIFORM_4UI,
468 OPCODE_PROGRAM_UNIFORM_1UIV,
469 OPCODE_PROGRAM_UNIFORM_2UIV,
470 OPCODE_PROGRAM_UNIFORM_3UIV,
471 OPCODE_PROGRAM_UNIFORM_4UIV,
472 OPCODE_PROGRAM_UNIFORM_MATRIX22F,
473 OPCODE_PROGRAM_UNIFORM_MATRIX33F,
474 OPCODE_PROGRAM_UNIFORM_MATRIX44F,
475 OPCODE_PROGRAM_UNIFORM_MATRIX23F,
476 OPCODE_PROGRAM_UNIFORM_MATRIX32F,
477 OPCODE_PROGRAM_UNIFORM_MATRIX24F,
478 OPCODE_PROGRAM_UNIFORM_MATRIX42F,
479 OPCODE_PROGRAM_UNIFORM_MATRIX34F,
480 OPCODE_PROGRAM_UNIFORM_MATRIX43F,
481 OPCODE_PROGRAM_UNIFORM_MATRIX22D,
482 OPCODE_PROGRAM_UNIFORM_MATRIX33D,
483 OPCODE_PROGRAM_UNIFORM_MATRIX44D,
484 OPCODE_PROGRAM_UNIFORM_MATRIX23D,
485 OPCODE_PROGRAM_UNIFORM_MATRIX32D,
486 OPCODE_PROGRAM_UNIFORM_MATRIX24D,
487 OPCODE_PROGRAM_UNIFORM_MATRIX42D,
488 OPCODE_PROGRAM_UNIFORM_MATRIX34D,
489 OPCODE_PROGRAM_UNIFORM_MATRIX43D,
490
491 /* GL_ARB_clip_control */
492 OPCODE_CLIP_CONTROL,
493
494 /* GL_ARB_color_buffer_float */
495 OPCODE_CLAMP_COLOR,
496
497 /* GL_EXT_framebuffer_blit */
498 OPCODE_BLIT_FRAMEBUFFER,
499
500 /* Vertex attributes -- fallback for when optimized display
501 * list build isn't active.
502 */
503 OPCODE_ATTR_1F_NV,
504 OPCODE_ATTR_2F_NV,
505 OPCODE_ATTR_3F_NV,
506 OPCODE_ATTR_4F_NV,
507 OPCODE_ATTR_1F_ARB,
508 OPCODE_ATTR_2F_ARB,
509 OPCODE_ATTR_3F_ARB,
510 OPCODE_ATTR_4F_ARB,
511 OPCODE_ATTR_1I,
512 OPCODE_ATTR_2I,
513 OPCODE_ATTR_3I,
514 OPCODE_ATTR_4I,
515 OPCODE_ATTR_1D,
516 OPCODE_ATTR_2D,
517 OPCODE_ATTR_3D,
518 OPCODE_ATTR_4D,
519 OPCODE_ATTR_1UI64,
520 OPCODE_MATERIAL,
521 OPCODE_BEGIN,
522 OPCODE_END,
523 OPCODE_RECTF,
524 OPCODE_EVAL_C1,
525 OPCODE_EVAL_C2,
526 OPCODE_EVAL_P1,
527 OPCODE_EVAL_P2,
528
529 /* GL_EXT_provoking_vertex */
530 OPCODE_PROVOKING_VERTEX,
531
532 /* GL_EXT_transform_feedback */
533 OPCODE_BEGIN_TRANSFORM_FEEDBACK,
534 OPCODE_END_TRANSFORM_FEEDBACK,
535 OPCODE_BIND_TRANSFORM_FEEDBACK,
536 OPCODE_PAUSE_TRANSFORM_FEEDBACK,
537 OPCODE_RESUME_TRANSFORM_FEEDBACK,
538 OPCODE_DRAW_TRANSFORM_FEEDBACK,
539
540 /* GL_EXT_texture_integer */
541 OPCODE_CLEARCOLOR_I,
542 OPCODE_CLEARCOLOR_UI,
543 OPCODE_TEXPARAMETER_I,
544 OPCODE_TEXPARAMETER_UI,
545
546 /* GL_ARB_instanced_arrays */
547 OPCODE_VERTEX_ATTRIB_DIVISOR,
548
549 /* GL_NV_texture_barrier */
550 OPCODE_TEXTURE_BARRIER_NV,
551
552 /* GL_ARB_sampler_object */
553 OPCODE_BIND_SAMPLER,
554 OPCODE_SAMPLER_PARAMETERIV,
555 OPCODE_SAMPLER_PARAMETERFV,
556 OPCODE_SAMPLER_PARAMETERIIV,
557 OPCODE_SAMPLER_PARAMETERUIV,
558
559 /* ARB_compute_shader */
560 OPCODE_DISPATCH_COMPUTE,
561
562 /* GL_ARB_sync */
563 OPCODE_WAIT_SYNC,
564
565 /* GL_NV_conditional_render */
566 OPCODE_BEGIN_CONDITIONAL_RENDER,
567 OPCODE_END_CONDITIONAL_RENDER,
568
569 /* ARB_timer_query */
570 OPCODE_QUERY_COUNTER,
571
572 /* ARB_transform_feedback3 */
573 OPCODE_BEGIN_QUERY_INDEXED,
574 OPCODE_END_QUERY_INDEXED,
575 OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM,
576
577 /* ARB_transform_feedback_instanced */
578 OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED,
579 OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED,
580
581 /* ARB_uniform_buffer_object */
582 OPCODE_UNIFORM_BLOCK_BINDING,
583
584 /* ARB_shader_subroutines */
585 OPCODE_UNIFORM_SUBROUTINES,
586
587 /* EXT_polygon_offset_clamp */
588 OPCODE_POLYGON_OFFSET_CLAMP,
589
590 /* EXT_window_rectangles */
591 OPCODE_WINDOW_RECTANGLES,
592
593 /* NV_conservative_raster */
594 OPCODE_SUBPIXEL_PRECISION_BIAS,
595
596 /* NV_conservative_raster_dilate */
597 OPCODE_CONSERVATIVE_RASTER_PARAMETER_F,
598
599 /* NV_conservative_raster_pre_snap_triangles */
600 OPCODE_CONSERVATIVE_RASTER_PARAMETER_I,
601
602 /* EXT_direct_state_access */
603 OPCODE_MATRIX_LOAD,
604 OPCODE_MATRIX_MULT,
605 OPCODE_MATRIX_ROTATE,
606 OPCODE_MATRIX_SCALE,
607 OPCODE_MATRIX_TRANSLATE,
608 OPCODE_MATRIX_LOAD_IDENTITY,
609 OPCODE_MATRIX_ORTHO,
610 OPCODE_MATRIX_FRUSTUM,
611 OPCODE_MATRIX_PUSH,
612 OPCODE_MATRIX_POP,
613 OPCODE_TEXTUREPARAMETER_F,
614 OPCODE_TEXTUREPARAMETER_I,
615 OPCODE_TEXTUREPARAMETER_II,
616 OPCODE_TEXTUREPARAMETER_IUI,
617 OPCODE_TEXTURE_IMAGE1D,
618 OPCODE_TEXTURE_IMAGE2D,
619 OPCODE_TEXTURE_IMAGE3D,
620 OPCODE_TEXTURE_SUB_IMAGE1D,
621 OPCODE_TEXTURE_SUB_IMAGE2D,
622 OPCODE_TEXTURE_SUB_IMAGE3D,
623 OPCODE_COPY_TEXTURE_IMAGE1D,
624 OPCODE_COPY_TEXTURE_IMAGE2D,
625 OPCODE_COPY_TEXTURE_SUB_IMAGE1D,
626 OPCODE_COPY_TEXTURE_SUB_IMAGE2D,
627 OPCODE_COPY_TEXTURE_SUB_IMAGE3D,
628 OPCODE_BIND_MULTITEXTURE,
629 OPCODE_MULTITEXPARAMETER_F,
630 OPCODE_MULTITEXPARAMETER_I,
631 OPCODE_MULTITEXPARAMETER_II,
632 OPCODE_MULTITEXPARAMETER_IUI,
633 OPCODE_MULTITEX_IMAGE1D,
634 OPCODE_MULTITEX_IMAGE2D,
635 OPCODE_MULTITEX_IMAGE3D,
636 OPCODE_MULTITEX_SUB_IMAGE1D,
637 OPCODE_MULTITEX_SUB_IMAGE2D,
638 OPCODE_MULTITEX_SUB_IMAGE3D,
639 OPCODE_COPY_MULTITEX_IMAGE1D,
640 OPCODE_COPY_MULTITEX_IMAGE2D,
641 OPCODE_COPY_MULTITEX_SUB_IMAGE1D,
642 OPCODE_COPY_MULTITEX_SUB_IMAGE2D,
643 OPCODE_COPY_MULTITEX_SUB_IMAGE3D,
644 OPCODE_MULTITEXENV,
645 OPCODE_COMPRESSED_TEXTURE_IMAGE_1D,
646 OPCODE_COMPRESSED_TEXTURE_IMAGE_2D,
647 OPCODE_COMPRESSED_TEXTURE_IMAGE_3D,
648 OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_1D,
649 OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_2D,
650 OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_3D,
651 OPCODE_COMPRESSED_MULTITEX_IMAGE_1D,
652 OPCODE_COMPRESSED_MULTITEX_IMAGE_2D,
653 OPCODE_COMPRESSED_MULTITEX_IMAGE_3D,
654 OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_1D,
655 OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_2D,
656 OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_3D,
657 OPCODE_NAMED_PROGRAM_STRING,
658 OPCODE_NAMED_PROGRAM_LOCAL_PARAMETER,
659
660 /* The following three are meta instructions */
661 OPCODE_ERROR, /* raise compiled-in error */
662 OPCODE_CONTINUE,
663 OPCODE_NOP, /* No-op (used for 8-byte alignment */
664 OPCODE_END_OF_LIST,
665 OPCODE_EXT_0
666 } OpCode;
667
668
669
670 /**
671 * Display list node.
672 *
673 * Display list instructions are stored as sequences of "nodes". Nodes
674 * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
675 * are linked together with a pointer.
676 *
677 * Each instruction in the display list is stored as a sequence of
678 * contiguous nodes in memory.
679 * Each node is the union of a variety of data types.
680 *
681 * Note, all of these members should be 4 bytes in size or less for the
682 * sake of compact display lists. We store 8-byte pointers in a pair of
683 * these nodes using the save/get_pointer() functions below.
684 */
685 union gl_dlist_node
686 {
687 OpCode opcode;
688 GLboolean b;
689 GLbitfield bf;
690 GLubyte ub;
691 GLshort s;
692 GLushort us;
693 GLint i;
694 GLuint ui;
695 GLenum e;
696 GLfloat f;
697 GLsizei si;
698 };
699
700
701 typedef union gl_dlist_node Node;
702
703
704 /** How many 4-byte dwords to store a pointer */
705 #define POINTER_DWORDS (sizeof(void *) / 4)
706
707 /* We want to keep sizeof(union gl_dlist_node) == 4 to minimize
708 * space for display lists. The following types and functions are
709 * used to help store 4- and 8-byte pointers in 1 or 2 dlist_nodes.
710 */
711 union pointer
712 {
713 void *ptr;
714 GLuint dwords[POINTER_DWORDS];
715 };
716
717
718 /**
719 * Save a 4 or 8-byte pointer at dest (and dest+1).
720 */
721 static inline void
722 save_pointer(Node *dest, void *src)
723 {
724 union pointer p;
725 unsigned i;
726
727 STATIC_ASSERT(POINTER_DWORDS == 1 || POINTER_DWORDS == 2);
728 STATIC_ASSERT(sizeof(Node) == 4);
729
730 p.ptr = src;
731
732 for (i = 0; i < POINTER_DWORDS; i++)
733 dest[i].ui = p.dwords[i];
734 }
735
736
737 /**
738 * Retrieve a 4 or 8-byte pointer from node (node+1).
739 */
740 static inline void *
741 get_pointer(const Node *node)
742 {
743 union pointer p;
744 unsigned i;
745
746 for (i = 0; i < POINTER_DWORDS; i++)
747 p.dwords[i] = node[i].ui;
748
749 return p.ptr;
750 }
751
752
753 /**
754 * Used to store a 64-bit uint in a pair of "Nodes" for the sake of 32-bit
755 * environment.
756 */
757 union uint64_pair
758 {
759 GLuint64 uint64;
760 GLuint uint32[2];
761 };
762
763
764 union float64_pair
765 {
766 GLdouble d;
767 GLuint uint32[2];
768 };
769
770 union int64_pair
771 {
772 GLint64 int64;
773 GLint int32[2];
774 };
775
776 #define ASSIGN_DOUBLE_TO_NODES(n, idx, value) \
777 do { \
778 union float64_pair tmp; \
779 tmp.d = value; \
780 n[idx].ui = tmp.uint32[0]; \
781 n[idx+1].ui = tmp.uint32[1]; \
782 } while (0)
783
784 #define ASSIGN_UINT64_TO_NODES(n, idx, value) \
785 do { \
786 union uint64_pair tmp; \
787 tmp.uint64 = value; \
788 n[idx].ui = tmp.uint32[0]; \
789 n[idx+1].ui = tmp.uint32[1]; \
790 } while (0)
791
792 #define ASSIGN_INT64_TO_NODES(n, idx, value) \
793 do { \
794 union int64_pair tmp; \
795 tmp.int64 = value; \
796 n[idx].i = tmp.int32[0]; \
797 n[idx+1].i = tmp.int32[1]; \
798 } while (0)
799
800 /**
801 * How many nodes to allocate at a time. Note that bulk vertex data
802 * from glBegin/glVertex/glEnd primitives will typically wind up in
803 * a VBO, and not directly in the display list itself.
804 */
805 #define BLOCK_SIZE 256
806
807
808
809 /**
810 * Number of nodes of storage needed for each instruction.
811 * Sizes for dynamically allocated opcodes are stored in the context struct.
812 */
813 static GLuint InstSize[OPCODE_END_OF_LIST + 1];
814
815
816 void mesa_print_display_list(GLuint list);
817
818
819 /**
820 * Does the given display list only contain a single glBitmap call?
821 */
822 static bool
823 is_bitmap_list(const struct gl_display_list *dlist)
824 {
825 const Node *n = dlist->Head;
826 if (n[0].opcode == OPCODE_BITMAP) {
827 n += InstSize[OPCODE_BITMAP];
828 if (n[0].opcode == OPCODE_END_OF_LIST)
829 return true;
830 }
831 return false;
832 }
833
834
835 /**
836 * Is the given display list an empty list?
837 */
838 static bool
839 is_empty_list(const struct gl_display_list *dlist)
840 {
841 const Node *n = dlist->Head;
842 return n[0].opcode == OPCODE_END_OF_LIST;
843 }
844
845
846 /**
847 * Delete/free a gl_bitmap_atlas. Called during context tear-down.
848 */
849 void
850 _mesa_delete_bitmap_atlas(struct gl_context *ctx, struct gl_bitmap_atlas *atlas)
851 {
852 if (atlas->texObj) {
853 ctx->Driver.DeleteTexture(ctx, atlas->texObj);
854 }
855 free(atlas->glyphs);
856 free(atlas);
857 }
858
859
860 /**
861 * Lookup a gl_bitmap_atlas by listBase ID.
862 */
863 static struct gl_bitmap_atlas *
864 lookup_bitmap_atlas(struct gl_context *ctx, GLuint listBase)
865 {
866 struct gl_bitmap_atlas *atlas;
867
868 assert(listBase > 0);
869 atlas = _mesa_HashLookup(ctx->Shared->BitmapAtlas, listBase);
870 return atlas;
871 }
872
873
874 /**
875 * Create new bitmap atlas and insert into hash table.
876 */
877 static struct gl_bitmap_atlas *
878 alloc_bitmap_atlas(struct gl_context *ctx, GLuint listBase)
879 {
880 struct gl_bitmap_atlas *atlas;
881
882 assert(listBase > 0);
883 assert(_mesa_HashLookup(ctx->Shared->BitmapAtlas, listBase) == NULL);
884
885 atlas = calloc(1, sizeof(*atlas));
886 if (atlas) {
887 _mesa_HashInsert(ctx->Shared->BitmapAtlas, listBase, atlas);
888 }
889
890 return atlas;
891 }
892
893
894 /**
895 * Try to build a bitmap atlas. This involves examining a sequence of
896 * display lists which contain glBitmap commands and putting the bitmap
897 * images into a texture map (the atlas).
898 * If we succeed, gl_bitmap_atlas::complete will be set to true.
899 * If we fail, gl_bitmap_atlas::incomplete will be set to true.
900 */
901 static void
902 build_bitmap_atlas(struct gl_context *ctx, struct gl_bitmap_atlas *atlas,
903 GLuint listBase)
904 {
905 unsigned i, row_height = 0, xpos = 0, ypos = 0;
906 GLubyte *map;
907 GLint map_stride;
908
909 assert(atlas);
910 assert(!atlas->complete);
911 assert(atlas->numBitmaps > 0);
912
913 /* We use a rectangle texture (non-normalized coords) for the atlas */
914 assert(ctx->Extensions.NV_texture_rectangle);
915 assert(ctx->Const.MaxTextureRectSize >= 1024);
916
917 atlas->texWidth = 1024;
918 atlas->texHeight = 0; /* determined below */
919
920 atlas->glyphs = malloc(atlas->numBitmaps * sizeof(atlas->glyphs[0]));
921 if (!atlas->glyphs) {
922 /* give up */
923 atlas->incomplete = true;
924 return;
925 }
926
927 /* Loop over the display lists. They should all contain a single glBitmap
928 * call. If not, bail out. Also, compute the position and sizes of each
929 * bitmap in the atlas to determine the texture atlas size.
930 */
931 for (i = 0; i < atlas->numBitmaps; i++) {
932 const struct gl_display_list *list = _mesa_lookup_list(ctx, listBase + i);
933 const Node *n;
934 struct gl_bitmap_glyph *g = &atlas->glyphs[i];
935 unsigned bitmap_width, bitmap_height;
936 float bitmap_xmove, bitmap_ymove, bitmap_xorig, bitmap_yorig;
937
938 if (!list || is_empty_list(list)) {
939 /* stop here */
940 atlas->numBitmaps = i;
941 break;
942 }
943
944 if (!is_bitmap_list(list)) {
945 /* This list does not contain exactly one glBitmap command. Give up. */
946 atlas->incomplete = true;
947 return;
948 }
949
950 /* get bitmap info from the display list command */
951 n = list->Head;
952 assert(n[0].opcode == OPCODE_BITMAP);
953 bitmap_width = n[1].i;
954 bitmap_height = n[2].i;
955 bitmap_xorig = n[3].f;
956 bitmap_yorig = n[4].f;
957 bitmap_xmove = n[5].f;
958 bitmap_ymove = n[6].f;
959
960 if (xpos + bitmap_width > atlas->texWidth) {
961 /* advance to the next row of the texture */
962 xpos = 0;
963 ypos += row_height;
964 row_height = 0;
965 }
966
967 /* save the bitmap's position in the atlas */
968 g->x = xpos;
969 g->y = ypos;
970 g->w = bitmap_width;
971 g->h = bitmap_height;
972 g->xorig = bitmap_xorig;
973 g->yorig = bitmap_yorig;
974 g->xmove = bitmap_xmove;
975 g->ymove = bitmap_ymove;
976
977 xpos += bitmap_width;
978
979 /* keep track of tallest bitmap in the row */
980 row_height = MAX2(row_height, bitmap_height);
981 }
982
983 /* Now we know the texture height */
984 atlas->texHeight = ypos + row_height;
985
986 if (atlas->texHeight == 0) {
987 /* no glyphs found, give up */
988 goto fail;
989 }
990 else if (atlas->texHeight > ctx->Const.MaxTextureRectSize) {
991 /* too large, give up */
992 goto fail;
993 }
994
995 /* Create atlas texture (texture ID is irrelevant) */
996 atlas->texObj = ctx->Driver.NewTextureObject(ctx, 999, GL_TEXTURE_RECTANGLE);
997 if (!atlas->texObj) {
998 goto out_of_memory;
999 }
1000
1001 atlas->texObj->Sampler.MinFilter = GL_NEAREST;
1002 atlas->texObj->Sampler.MagFilter = GL_NEAREST;
1003 atlas->texObj->MaxLevel = 0;
1004 atlas->texObj->Immutable = GL_TRUE;
1005
1006 atlas->texImage = _mesa_get_tex_image(ctx, atlas->texObj,
1007 GL_TEXTURE_RECTANGLE, 0);
1008 if (!atlas->texImage) {
1009 goto out_of_memory;
1010 }
1011
1012 if (ctx->Const.BitmapUsesRed)
1013 _mesa_init_teximage_fields(ctx, atlas->texImage,
1014 atlas->texWidth, atlas->texHeight, 1, 0,
1015 GL_RED, MESA_FORMAT_R_UNORM8);
1016 else
1017 _mesa_init_teximage_fields(ctx, atlas->texImage,
1018 atlas->texWidth, atlas->texHeight, 1, 0,
1019 GL_ALPHA, MESA_FORMAT_A_UNORM8);
1020
1021 /* alloc image storage */
1022 if (!ctx->Driver.AllocTextureImageBuffer(ctx, atlas->texImage)) {
1023 goto out_of_memory;
1024 }
1025
1026 /* map teximage, load with bitmap glyphs */
1027 ctx->Driver.MapTextureImage(ctx, atlas->texImage, 0,
1028 0, 0, atlas->texWidth, atlas->texHeight,
1029 GL_MAP_WRITE_BIT, &map, &map_stride);
1030 if (!map) {
1031 goto out_of_memory;
1032 }
1033
1034 /* Background/clear pixels are 0xff, foreground/set pixels are 0x0 */
1035 memset(map, 0xff, map_stride * atlas->texHeight);
1036
1037 for (i = 0; i < atlas->numBitmaps; i++) {
1038 const struct gl_display_list *list = _mesa_lookup_list(ctx, listBase + i);
1039 const Node *n = list->Head;
1040
1041 assert(n[0].opcode == OPCODE_BITMAP ||
1042 n[0].opcode == OPCODE_END_OF_LIST);
1043
1044 if (n[0].opcode == OPCODE_BITMAP) {
1045 unsigned bitmap_width = n[1].i;
1046 unsigned bitmap_height = n[2].i;
1047 unsigned xpos = atlas->glyphs[i].x;
1048 unsigned ypos = atlas->glyphs[i].y;
1049 const void *bitmap_image = get_pointer(&n[7]);
1050
1051 assert(atlas->glyphs[i].w == bitmap_width);
1052 assert(atlas->glyphs[i].h == bitmap_height);
1053
1054 /* put the bitmap image into the texture image */
1055 _mesa_expand_bitmap(bitmap_width, bitmap_height,
1056 &ctx->DefaultPacking, bitmap_image,
1057 map + map_stride * ypos + xpos, /* dest addr */
1058 map_stride, 0x0);
1059 }
1060 }
1061
1062 ctx->Driver.UnmapTextureImage(ctx, atlas->texImage, 0);
1063
1064 atlas->complete = true;
1065
1066 return;
1067
1068 out_of_memory:
1069 _mesa_error(ctx, GL_OUT_OF_MEMORY, "Display list bitmap atlas");
1070 fail:
1071 if (atlas->texObj) {
1072 ctx->Driver.DeleteTexture(ctx, atlas->texObj);
1073 }
1074 free(atlas->glyphs);
1075 atlas->glyphs = NULL;
1076 atlas->incomplete = true;
1077 }
1078
1079
1080 /**
1081 * Allocate a gl_display_list object with an initial block of storage.
1082 * \param count how many display list nodes/tokens to allocate
1083 */
1084 static struct gl_display_list *
1085 make_list(GLuint name, GLuint count)
1086 {
1087 struct gl_display_list *dlist = CALLOC_STRUCT(gl_display_list);
1088 dlist->Name = name;
1089 dlist->Head = malloc(sizeof(Node) * count);
1090 dlist->Head[0].opcode = OPCODE_END_OF_LIST;
1091 /* All InstSize[] entries must be non-zero */
1092 InstSize[OPCODE_END_OF_LIST] = 1;
1093 return dlist;
1094 }
1095
1096
1097 /**
1098 * Lookup function to just encapsulate casting.
1099 */
1100 struct gl_display_list *
1101 _mesa_lookup_list(struct gl_context *ctx, GLuint list)
1102 {
1103 return (struct gl_display_list *)
1104 _mesa_HashLookup(ctx->Shared->DisplayList, list);
1105 }
1106
1107
1108 /** Is the given opcode an extension code? */
1109 static inline GLboolean
1110 is_ext_opcode(OpCode opcode)
1111 {
1112 return (opcode >= OPCODE_EXT_0);
1113 }
1114
1115
1116 /** Destroy an extended opcode instruction */
1117 static GLint
1118 ext_opcode_destroy(struct gl_context *ctx, Node *node)
1119 {
1120 const GLint i = node[0].opcode - OPCODE_EXT_0;
1121 GLint step;
1122 ctx->ListExt->Opcode[i].Destroy(ctx, &node[1]);
1123 step = ctx->ListExt->Opcode[i].Size;
1124 return step;
1125 }
1126
1127
1128 /** Execute an extended opcode instruction */
1129 static GLint
1130 ext_opcode_execute(struct gl_context *ctx, Node *node)
1131 {
1132 const GLint i = node[0].opcode - OPCODE_EXT_0;
1133 GLint step;
1134 ctx->ListExt->Opcode[i].Execute(ctx, &node[1]);
1135 step = ctx->ListExt->Opcode[i].Size;
1136 return step;
1137 }
1138
1139
1140 /** Print an extended opcode instruction */
1141 static GLint
1142 ext_opcode_print(struct gl_context *ctx, Node *node, FILE *f)
1143 {
1144 const GLint i = node[0].opcode - OPCODE_EXT_0;
1145 GLint step;
1146 ctx->ListExt->Opcode[i].Print(ctx, &node[1], f);
1147 step = ctx->ListExt->Opcode[i].Size;
1148 return step;
1149 }
1150
1151
1152 /**
1153 * Delete the named display list, but don't remove from hash table.
1154 * \param dlist - display list pointer
1155 */
1156 void
1157 _mesa_delete_list(struct gl_context *ctx, struct gl_display_list *dlist)
1158 {
1159 Node *n, *block;
1160 GLboolean done;
1161
1162 n = block = dlist->Head;
1163
1164 done = block ? GL_FALSE : GL_TRUE;
1165 while (!done) {
1166 const OpCode opcode = n[0].opcode;
1167
1168 /* check for extension opcodes first */
1169 if (is_ext_opcode(opcode)) {
1170 n += ext_opcode_destroy(ctx, n);
1171 }
1172 else {
1173 switch (opcode) {
1174 /* for some commands, we need to free malloc'd memory */
1175 case OPCODE_MAP1:
1176 free(get_pointer(&n[6]));
1177 break;
1178 case OPCODE_MAP2:
1179 free(get_pointer(&n[10]));
1180 break;
1181 case OPCODE_CALL_LISTS:
1182 free(get_pointer(&n[3]));
1183 break;
1184 case OPCODE_DRAW_PIXELS:
1185 free(get_pointer(&n[5]));
1186 break;
1187 case OPCODE_BITMAP:
1188 free(get_pointer(&n[7]));
1189 break;
1190 case OPCODE_POLYGON_STIPPLE:
1191 free(get_pointer(&n[1]));
1192 break;
1193 case OPCODE_TEX_IMAGE1D:
1194 free(get_pointer(&n[8]));
1195 break;
1196 case OPCODE_TEX_IMAGE2D:
1197 free(get_pointer(&n[9]));
1198 break;
1199 case OPCODE_TEX_IMAGE3D:
1200 free(get_pointer(&n[10]));
1201 break;
1202 case OPCODE_TEX_SUB_IMAGE1D:
1203 free(get_pointer(&n[7]));
1204 break;
1205 case OPCODE_TEX_SUB_IMAGE2D:
1206 free(get_pointer(&n[9]));
1207 break;
1208 case OPCODE_TEX_SUB_IMAGE3D:
1209 free(get_pointer(&n[11]));
1210 break;
1211 case OPCODE_COMPRESSED_TEX_IMAGE_1D:
1212 free(get_pointer(&n[7]));
1213 break;
1214 case OPCODE_COMPRESSED_TEX_IMAGE_2D:
1215 free(get_pointer(&n[8]));
1216 break;
1217 case OPCODE_COMPRESSED_TEX_IMAGE_3D:
1218 free(get_pointer(&n[9]));
1219 break;
1220 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D:
1221 free(get_pointer(&n[7]));
1222 break;
1223 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D:
1224 free(get_pointer(&n[9]));
1225 break;
1226 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D:
1227 free(get_pointer(&n[11]));
1228 break;
1229 case OPCODE_PROGRAM_STRING_ARB:
1230 free(get_pointer(&n[4])); /* program string */
1231 break;
1232 case OPCODE_UNIFORM_1FV:
1233 case OPCODE_UNIFORM_2FV:
1234 case OPCODE_UNIFORM_3FV:
1235 case OPCODE_UNIFORM_4FV:
1236 case OPCODE_UNIFORM_1DV:
1237 case OPCODE_UNIFORM_2DV:
1238 case OPCODE_UNIFORM_3DV:
1239 case OPCODE_UNIFORM_4DV:
1240 case OPCODE_UNIFORM_1IV:
1241 case OPCODE_UNIFORM_2IV:
1242 case OPCODE_UNIFORM_3IV:
1243 case OPCODE_UNIFORM_4IV:
1244 case OPCODE_UNIFORM_1UIV:
1245 case OPCODE_UNIFORM_2UIV:
1246 case OPCODE_UNIFORM_3UIV:
1247 case OPCODE_UNIFORM_4UIV:
1248 case OPCODE_UNIFORM_1I64V:
1249 case OPCODE_UNIFORM_2I64V:
1250 case OPCODE_UNIFORM_3I64V:
1251 case OPCODE_UNIFORM_4I64V:
1252 case OPCODE_UNIFORM_1UI64V:
1253 case OPCODE_UNIFORM_2UI64V:
1254 case OPCODE_UNIFORM_3UI64V:
1255 case OPCODE_UNIFORM_4UI64V:
1256 free(get_pointer(&n[3]));
1257 break;
1258 case OPCODE_UNIFORM_MATRIX22:
1259 case OPCODE_UNIFORM_MATRIX33:
1260 case OPCODE_UNIFORM_MATRIX44:
1261 case OPCODE_UNIFORM_MATRIX24:
1262 case OPCODE_UNIFORM_MATRIX42:
1263 case OPCODE_UNIFORM_MATRIX23:
1264 case OPCODE_UNIFORM_MATRIX32:
1265 case OPCODE_UNIFORM_MATRIX34:
1266 case OPCODE_UNIFORM_MATRIX43:
1267 case OPCODE_UNIFORM_MATRIX22D:
1268 case OPCODE_UNIFORM_MATRIX33D:
1269 case OPCODE_UNIFORM_MATRIX44D:
1270 case OPCODE_UNIFORM_MATRIX24D:
1271 case OPCODE_UNIFORM_MATRIX42D:
1272 case OPCODE_UNIFORM_MATRIX23D:
1273 case OPCODE_UNIFORM_MATRIX32D:
1274 case OPCODE_UNIFORM_MATRIX34D:
1275 case OPCODE_UNIFORM_MATRIX43D:
1276 free(get_pointer(&n[4]));
1277 break;
1278 case OPCODE_PROGRAM_UNIFORM_1FV:
1279 case OPCODE_PROGRAM_UNIFORM_2FV:
1280 case OPCODE_PROGRAM_UNIFORM_3FV:
1281 case OPCODE_PROGRAM_UNIFORM_4FV:
1282 case OPCODE_PROGRAM_UNIFORM_1DV:
1283 case OPCODE_PROGRAM_UNIFORM_2DV:
1284 case OPCODE_PROGRAM_UNIFORM_3DV:
1285 case OPCODE_PROGRAM_UNIFORM_4DV:
1286 case OPCODE_PROGRAM_UNIFORM_1IV:
1287 case OPCODE_PROGRAM_UNIFORM_2IV:
1288 case OPCODE_PROGRAM_UNIFORM_3IV:
1289 case OPCODE_PROGRAM_UNIFORM_4IV:
1290 case OPCODE_PROGRAM_UNIFORM_1UIV:
1291 case OPCODE_PROGRAM_UNIFORM_2UIV:
1292 case OPCODE_PROGRAM_UNIFORM_3UIV:
1293 case OPCODE_PROGRAM_UNIFORM_4UIV:
1294 case OPCODE_PROGRAM_UNIFORM_1I64V:
1295 case OPCODE_PROGRAM_UNIFORM_2I64V:
1296 case OPCODE_PROGRAM_UNIFORM_3I64V:
1297 case OPCODE_PROGRAM_UNIFORM_4I64V:
1298 case OPCODE_PROGRAM_UNIFORM_1UI64V:
1299 case OPCODE_PROGRAM_UNIFORM_2UI64V:
1300 case OPCODE_PROGRAM_UNIFORM_3UI64V:
1301 case OPCODE_PROGRAM_UNIFORM_4UI64V:
1302 free(get_pointer(&n[4]));
1303 break;
1304 case OPCODE_PROGRAM_UNIFORM_MATRIX22F:
1305 case OPCODE_PROGRAM_UNIFORM_MATRIX33F:
1306 case OPCODE_PROGRAM_UNIFORM_MATRIX44F:
1307 case OPCODE_PROGRAM_UNIFORM_MATRIX24F:
1308 case OPCODE_PROGRAM_UNIFORM_MATRIX42F:
1309 case OPCODE_PROGRAM_UNIFORM_MATRIX23F:
1310 case OPCODE_PROGRAM_UNIFORM_MATRIX32F:
1311 case OPCODE_PROGRAM_UNIFORM_MATRIX34F:
1312 case OPCODE_PROGRAM_UNIFORM_MATRIX43F:
1313 case OPCODE_PROGRAM_UNIFORM_MATRIX22D:
1314 case OPCODE_PROGRAM_UNIFORM_MATRIX33D:
1315 case OPCODE_PROGRAM_UNIFORM_MATRIX44D:
1316 case OPCODE_PROGRAM_UNIFORM_MATRIX24D:
1317 case OPCODE_PROGRAM_UNIFORM_MATRIX42D:
1318 case OPCODE_PROGRAM_UNIFORM_MATRIX23D:
1319 case OPCODE_PROGRAM_UNIFORM_MATRIX32D:
1320 case OPCODE_PROGRAM_UNIFORM_MATRIX34D:
1321 case OPCODE_PROGRAM_UNIFORM_MATRIX43D:
1322 free(get_pointer(&n[5]));
1323 break;
1324 case OPCODE_PIXEL_MAP:
1325 free(get_pointer(&n[3]));
1326 break;
1327 case OPCODE_VIEWPORT_ARRAY_V:
1328 case OPCODE_SCISSOR_ARRAY_V:
1329 case OPCODE_DEPTH_ARRAY_V:
1330 case OPCODE_UNIFORM_SUBROUTINES:
1331 case OPCODE_WINDOW_RECTANGLES:
1332 free(get_pointer(&n[3]));
1333 break;
1334 case OPCODE_TEXTURE_IMAGE1D:
1335 case OPCODE_MULTITEX_IMAGE1D:
1336 free(get_pointer(&n[9]));
1337 break;
1338 case OPCODE_TEXTURE_IMAGE2D:
1339 case OPCODE_MULTITEX_IMAGE2D:
1340 free(get_pointer(&n[10]));
1341 break;
1342 case OPCODE_TEXTURE_IMAGE3D:
1343 case OPCODE_MULTITEX_IMAGE3D:
1344 free(get_pointer(&n[11]));
1345 break;
1346 case OPCODE_TEXTURE_SUB_IMAGE1D:
1347 case OPCODE_MULTITEX_SUB_IMAGE1D:
1348 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_1D:
1349 case OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_1D:
1350 free(get_pointer(&n[8]));
1351 break;
1352 case OPCODE_TEXTURE_SUB_IMAGE2D:
1353 case OPCODE_MULTITEX_SUB_IMAGE2D:
1354 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_2D:
1355 case OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_2D:
1356 free(get_pointer(&n[10]));
1357 break;
1358 case OPCODE_TEXTURE_SUB_IMAGE3D:
1359 case OPCODE_MULTITEX_SUB_IMAGE3D:
1360 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_3D:
1361 case OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_3D:
1362 free(get_pointer(&n[12]));
1363 break;
1364 case OPCODE_COMPRESSED_TEXTURE_IMAGE_1D:
1365 case OPCODE_COMPRESSED_MULTITEX_IMAGE_1D:
1366 free(get_pointer(&n[8]));
1367 break;
1368 case OPCODE_COMPRESSED_TEXTURE_IMAGE_2D:
1369 case OPCODE_COMPRESSED_MULTITEX_IMAGE_2D:
1370 free(get_pointer(&n[9]));
1371 break;
1372 case OPCODE_COMPRESSED_TEXTURE_IMAGE_3D:
1373 case OPCODE_COMPRESSED_MULTITEX_IMAGE_3D:
1374 free(get_pointer(&n[10]));
1375 break;
1376 case OPCODE_NAMED_PROGRAM_STRING:
1377 free(get_pointer(&n[5]));
1378 break;
1379 case OPCODE_CONTINUE:
1380 n = (Node *) get_pointer(&n[1]);
1381 free(block);
1382 block = n;
1383 break;
1384 case OPCODE_END_OF_LIST:
1385 free(block);
1386 done = GL_TRUE;
1387 break;
1388 default:
1389 /* just increment 'n' pointer, below */
1390 ;
1391 }
1392
1393 if (opcode != OPCODE_CONTINUE) {
1394 assert(InstSize[opcode] > 0);
1395 n += InstSize[opcode];
1396 }
1397 }
1398 }
1399
1400 free(dlist->Label);
1401 free(dlist);
1402 }
1403
1404
1405 /**
1406 * Called by _mesa_HashWalk() to check if a display list which is being
1407 * deleted belongs to a bitmap texture atlas.
1408 */
1409 static void
1410 check_atlas_for_deleted_list(GLuint atlas_id, void *data, void *userData)
1411 {
1412 struct gl_bitmap_atlas *atlas = (struct gl_bitmap_atlas *) data;
1413 GLuint list_id = *((GLuint *) userData); /* the list being deleted */
1414
1415 /* See if the list_id falls in the range contained in this texture atlas */
1416 if (atlas->complete &&
1417 list_id >= atlas_id &&
1418 list_id < atlas_id + atlas->numBitmaps) {
1419 /* Mark the atlas as incomplete so it doesn't get used. But don't
1420 * delete it yet since we don't want to try to recreate it in the next
1421 * glCallLists.
1422 */
1423 atlas->complete = false;
1424 atlas->incomplete = true;
1425 }
1426 }
1427
1428
1429 /**
1430 * Destroy a display list and remove from hash table.
1431 * \param list - display list number
1432 */
1433 static void
1434 destroy_list(struct gl_context *ctx, GLuint list)
1435 {
1436 struct gl_display_list *dlist;
1437
1438 if (list == 0)
1439 return;
1440
1441 dlist = _mesa_lookup_list(ctx, list);
1442 if (!dlist)
1443 return;
1444
1445 if (is_bitmap_list(dlist)) {
1446 /* If we're destroying a simple glBitmap display list, there's a
1447 * chance that we're destroying a bitmap image that's in a texture
1448 * atlas. Examine all atlases to see if that's the case. There's
1449 * usually few (if any) atlases so this isn't expensive.
1450 */
1451 _mesa_HashWalk(ctx->Shared->BitmapAtlas,
1452 check_atlas_for_deleted_list, &list);
1453 }
1454
1455 _mesa_delete_list(ctx, dlist);
1456 _mesa_HashRemove(ctx->Shared->DisplayList, list);
1457 }
1458
1459
1460 /*
1461 * Translate the nth element of list from <type> to GLint.
1462 */
1463 static GLint
1464 translate_id(GLsizei n, GLenum type, const GLvoid * list)
1465 {
1466 GLbyte *bptr;
1467 GLubyte *ubptr;
1468 GLshort *sptr;
1469 GLushort *usptr;
1470 GLint *iptr;
1471 GLuint *uiptr;
1472 GLfloat *fptr;
1473
1474 switch (type) {
1475 case GL_BYTE:
1476 bptr = (GLbyte *) list;
1477 return (GLint) bptr[n];
1478 case GL_UNSIGNED_BYTE:
1479 ubptr = (GLubyte *) list;
1480 return (GLint) ubptr[n];
1481 case GL_SHORT:
1482 sptr = (GLshort *) list;
1483 return (GLint) sptr[n];
1484 case GL_UNSIGNED_SHORT:
1485 usptr = (GLushort *) list;
1486 return (GLint) usptr[n];
1487 case GL_INT:
1488 iptr = (GLint *) list;
1489 return iptr[n];
1490 case GL_UNSIGNED_INT:
1491 uiptr = (GLuint *) list;
1492 return (GLint) uiptr[n];
1493 case GL_FLOAT:
1494 fptr = (GLfloat *) list;
1495 return (GLint) floorf(fptr[n]);
1496 case GL_2_BYTES:
1497 ubptr = ((GLubyte *) list) + 2 * n;
1498 return (GLint) ubptr[0] * 256
1499 + (GLint) ubptr[1];
1500 case GL_3_BYTES:
1501 ubptr = ((GLubyte *) list) + 3 * n;
1502 return (GLint) ubptr[0] * 65536
1503 + (GLint) ubptr[1] * 256
1504 + (GLint) ubptr[2];
1505 case GL_4_BYTES:
1506 ubptr = ((GLubyte *) list) + 4 * n;
1507 return (GLint) ubptr[0] * 16777216
1508 + (GLint) ubptr[1] * 65536
1509 + (GLint) ubptr[2] * 256
1510 + (GLint) ubptr[3];
1511 default:
1512 return 0;
1513 }
1514 }
1515
1516
1517 /**
1518 * Wrapper for _mesa_unpack_image/bitmap() that handles pixel buffer objects.
1519 * If width < 0 or height < 0 or format or type are invalid we'll just
1520 * return NULL. We will not generate an error since OpenGL command
1521 * arguments aren't error-checked until the command is actually executed
1522 * (not when they're compiled).
1523 * But if we run out of memory, GL_OUT_OF_MEMORY will be recorded.
1524 */
1525 static GLvoid *
1526 unpack_image(struct gl_context *ctx, GLuint dimensions,
1527 GLsizei width, GLsizei height, GLsizei depth,
1528 GLenum format, GLenum type, const GLvoid * pixels,
1529 const struct gl_pixelstore_attrib *unpack)
1530 {
1531 if (width <= 0 || height <= 0) {
1532 return NULL;
1533 }
1534
1535 if (_mesa_bytes_per_pixel(format, type) < 0) {
1536 /* bad format and/or type */
1537 return NULL;
1538 }
1539
1540 if (!unpack->BufferObj) {
1541 /* no PBO */
1542 GLvoid *image;
1543
1544 image = _mesa_unpack_image(dimensions, width, height, depth,
1545 format, type, pixels, unpack);
1546 if (pixels && !image) {
1547 _mesa_error(ctx, GL_OUT_OF_MEMORY, "display list construction");
1548 }
1549 return image;
1550 }
1551 else if (_mesa_validate_pbo_access(dimensions, unpack, width, height,
1552 depth, format, type, INT_MAX, pixels)) {
1553 const GLubyte *map, *src;
1554 GLvoid *image;
1555
1556 map = (GLubyte *)
1557 ctx->Driver.MapBufferRange(ctx, 0, unpack->BufferObj->Size,
1558 GL_MAP_READ_BIT, unpack->BufferObj,
1559 MAP_INTERNAL);
1560 if (!map) {
1561 /* unable to map src buffer! */
1562 _mesa_error(ctx, GL_INVALID_OPERATION, "unable to map PBO");
1563 return NULL;
1564 }
1565
1566 src = ADD_POINTERS(map, pixels);
1567 image = _mesa_unpack_image(dimensions, width, height, depth,
1568 format, type, src, unpack);
1569
1570 ctx->Driver.UnmapBuffer(ctx, unpack->BufferObj, MAP_INTERNAL);
1571
1572 if (!image) {
1573 _mesa_error(ctx, GL_OUT_OF_MEMORY, "display list construction");
1574 }
1575 return image;
1576 }
1577
1578 /* bad access! */
1579 _mesa_error(ctx, GL_INVALID_OPERATION, "invalid PBO access");
1580 return NULL;
1581 }
1582
1583
1584 /** Return copy of memory */
1585 static void *
1586 memdup(const void *src, GLsizei bytes)
1587 {
1588 void *b = bytes >= 0 ? malloc(bytes) : NULL;
1589 if (b)
1590 memcpy(b, src, bytes);
1591 return b;
1592 }
1593
1594
1595 /**
1596 * Allocate space for a display list instruction (opcode + payload space).
1597 * \param opcode the instruction opcode (OPCODE_* value)
1598 * \param bytes instruction payload size (not counting opcode)
1599 * \param align8 does the payload need to be 8-byte aligned?
1600 * This is only relevant in 64-bit environments.
1601 * \return pointer to allocated memory (the payload will be at pointer+1)
1602 */
1603 static Node *
1604 dlist_alloc(struct gl_context *ctx, OpCode opcode, GLuint bytes, bool align8)
1605 {
1606 const GLuint numNodes = 1 + (bytes + sizeof(Node) - 1) / sizeof(Node);
1607 const GLuint contNodes = 1 + POINTER_DWORDS; /* size of continue info */
1608 GLuint nopNode;
1609 Node *n;
1610
1611 assert(bytes <= BLOCK_SIZE * sizeof(Node));
1612
1613 if (opcode < OPCODE_EXT_0) {
1614 if (InstSize[opcode] == 0) {
1615 /* save instruction size now */
1616 InstSize[opcode] = numNodes;
1617 }
1618 else {
1619 /* make sure instruction size agrees */
1620 assert(numNodes == InstSize[opcode]);
1621 }
1622 }
1623
1624 if (sizeof(void *) > sizeof(Node) && align8
1625 && ctx->ListState.CurrentPos % 2 == 0) {
1626 /* The opcode would get placed at node[0] and the payload would start
1627 * at node[1]. But the payload needs to be at an even offset (8-byte
1628 * multiple).
1629 */
1630 nopNode = 1;
1631 }
1632 else {
1633 nopNode = 0;
1634 }
1635
1636 if (ctx->ListState.CurrentPos + nopNode + numNodes + contNodes
1637 > BLOCK_SIZE) {
1638 /* This block is full. Allocate a new block and chain to it */
1639 Node *newblock;
1640 n = ctx->ListState.CurrentBlock + ctx->ListState.CurrentPos;
1641 n[0].opcode = OPCODE_CONTINUE;
1642 newblock = malloc(sizeof(Node) * BLOCK_SIZE);
1643 if (!newblock) {
1644 _mesa_error(ctx, GL_OUT_OF_MEMORY, "Building display list");
1645 return NULL;
1646 }
1647
1648 /* a fresh block should be 8-byte aligned on 64-bit systems */
1649 assert(((GLintptr) newblock) % sizeof(void *) == 0);
1650
1651 save_pointer(&n[1], newblock);
1652 ctx->ListState.CurrentBlock = newblock;
1653 ctx->ListState.CurrentPos = 0;
1654
1655 /* Display list nodes are always 4 bytes. If we need 8-byte alignment
1656 * we have to insert a NOP so that the payload of the real opcode lands
1657 * on an even location:
1658 * node[0] = OPCODE_NOP
1659 * node[1] = OPCODE_x;
1660 * node[2] = start of payload
1661 */
1662 nopNode = sizeof(void *) > sizeof(Node) && align8;
1663 }
1664
1665 n = ctx->ListState.CurrentBlock + ctx->ListState.CurrentPos;
1666 if (nopNode) {
1667 assert(ctx->ListState.CurrentPos % 2 == 0); /* even value */
1668 n[0].opcode = OPCODE_NOP;
1669 n++;
1670 /* The "real" opcode will now be at an odd location and the payload
1671 * will be at an even location.
1672 */
1673 }
1674 ctx->ListState.CurrentPos += nopNode + numNodes;
1675
1676 n[0].opcode = opcode;
1677
1678 return n;
1679 }
1680
1681
1682
1683 /**
1684 * Allocate space for a display list instruction. Used by callers outside
1685 * this file for things like VBO vertex data.
1686 *
1687 * \param opcode the instruction opcode (OPCODE_* value)
1688 * \param bytes instruction size in bytes, not counting opcode.
1689 * \return pointer to the usable data area (not including the internal
1690 * opcode).
1691 */
1692 void *
1693 _mesa_dlist_alloc(struct gl_context *ctx, GLuint opcode, GLuint bytes)
1694 {
1695 Node *n = dlist_alloc(ctx, (OpCode) opcode, bytes, false);
1696 if (n)
1697 return n + 1; /* return pointer to payload area, after opcode */
1698 else
1699 return NULL;
1700 }
1701
1702
1703 /**
1704 * Same as _mesa_dlist_alloc(), but return a pointer which is 8-byte
1705 * aligned in 64-bit environments, 4-byte aligned otherwise.
1706 */
1707 void *
1708 _mesa_dlist_alloc_aligned(struct gl_context *ctx, GLuint opcode, GLuint bytes)
1709 {
1710 Node *n = dlist_alloc(ctx, (OpCode) opcode, bytes, true);
1711 if (n)
1712 return n + 1; /* return pointer to payload area, after opcode */
1713 else
1714 return NULL;
1715 }
1716
1717
1718 /**
1719 * This function allows modules and drivers to get their own opcodes
1720 * for extending display list functionality.
1721 * \param ctx the rendering context
1722 * \param size number of bytes for storing the new display list command
1723 * \param execute function to execute the new display list command
1724 * \param destroy function to destroy the new display list command
1725 * \param print function to print the new display list command
1726 * \return the new opcode number or -1 if error
1727 */
1728 GLint
1729 _mesa_dlist_alloc_opcode(struct gl_context *ctx,
1730 GLuint size,
1731 void (*execute) (struct gl_context *, void *),
1732 void (*destroy) (struct gl_context *, void *),
1733 void (*print) (struct gl_context *, void *, FILE *))
1734 {
1735 if (ctx->ListExt->NumOpcodes < MAX_DLIST_EXT_OPCODES) {
1736 const GLuint i = ctx->ListExt->NumOpcodes++;
1737 ctx->ListExt->Opcode[i].Size =
1738 1 + (size + sizeof(Node) - 1) / sizeof(Node);
1739 ctx->ListExt->Opcode[i].Execute = execute;
1740 ctx->ListExt->Opcode[i].Destroy = destroy;
1741 ctx->ListExt->Opcode[i].Print = print;
1742 return i + OPCODE_EXT_0;
1743 }
1744 return -1;
1745 }
1746
1747
1748 /**
1749 * Allocate space for a display list instruction. The space is basically
1750 * an array of Nodes where node[0] holds the opcode, node[1] is the first
1751 * function parameter, node[2] is the second parameter, etc.
1752 *
1753 * \param opcode one of OPCODE_x
1754 * \param nparams number of function parameters
1755 * \return pointer to start of instruction space
1756 */
1757 static inline Node *
1758 alloc_instruction(struct gl_context *ctx, OpCode opcode, GLuint nparams)
1759 {
1760 return dlist_alloc(ctx, opcode, nparams * sizeof(Node), false);
1761 }
1762
1763
1764 /**
1765 * Called by EndList to try to reduce memory used for the list.
1766 */
1767 static void
1768 trim_list(struct gl_context *ctx)
1769 {
1770 /* If the list we're ending only has one allocated block of nodes/tokens
1771 * and its size isn't a full block size, realloc the block to use less
1772 * memory. This is important for apps that create many small display
1773 * lists and apps that use glXUseXFont (many lists each containing one
1774 * glBitmap call).
1775 * Note: we currently only trim display lists that allocated one block
1776 * of tokens. That hits the short list case which is what we're mainly
1777 * concerned with. Trimming longer lists would involve traversing the
1778 * linked list of blocks.
1779 */
1780 struct gl_dlist_state *list = &ctx->ListState;
1781
1782 if ((list->CurrentList->Head == list->CurrentBlock) &&
1783 (list->CurrentPos < BLOCK_SIZE)) {
1784 /* There's only one block and it's not full, so realloc */
1785 GLuint newSize = list->CurrentPos * sizeof(Node);
1786 list->CurrentList->Head =
1787 list->CurrentBlock = realloc(list->CurrentBlock, newSize);
1788 if (!list->CurrentBlock) {
1789 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glEndList");
1790 }
1791 }
1792 }
1793
1794
1795
1796 /*
1797 * Display List compilation functions
1798 */
1799 static void GLAPIENTRY
1800 save_Accum(GLenum op, GLfloat value)
1801 {
1802 GET_CURRENT_CONTEXT(ctx);
1803 Node *n;
1804 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1805 n = alloc_instruction(ctx, OPCODE_ACCUM, 2);
1806 if (n) {
1807 n[1].e = op;
1808 n[2].f = value;
1809 }
1810 if (ctx->ExecuteFlag) {
1811 CALL_Accum(ctx->Exec, (op, value));
1812 }
1813 }
1814
1815
1816 static void GLAPIENTRY
1817 save_AlphaFunc(GLenum func, GLclampf ref)
1818 {
1819 GET_CURRENT_CONTEXT(ctx);
1820 Node *n;
1821 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1822 n = alloc_instruction(ctx, OPCODE_ALPHA_FUNC, 2);
1823 if (n) {
1824 n[1].e = func;
1825 n[2].f = (GLfloat) ref;
1826 }
1827 if (ctx->ExecuteFlag) {
1828 CALL_AlphaFunc(ctx->Exec, (func, ref));
1829 }
1830 }
1831
1832
1833 static void GLAPIENTRY
1834 save_BindTexture(GLenum target, GLuint texture)
1835 {
1836 GET_CURRENT_CONTEXT(ctx);
1837 Node *n;
1838 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1839 n = alloc_instruction(ctx, OPCODE_BIND_TEXTURE, 2);
1840 if (n) {
1841 n[1].e = target;
1842 n[2].ui = texture;
1843 }
1844 if (ctx->ExecuteFlag) {
1845 CALL_BindTexture(ctx->Exec, (target, texture));
1846 }
1847 }
1848
1849
1850 static void GLAPIENTRY
1851 save_Bitmap(GLsizei width, GLsizei height,
1852 GLfloat xorig, GLfloat yorig,
1853 GLfloat xmove, GLfloat ymove, const GLubyte * pixels)
1854 {
1855 GET_CURRENT_CONTEXT(ctx);
1856 Node *n;
1857 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1858 n = alloc_instruction(ctx, OPCODE_BITMAP, 6 + POINTER_DWORDS);
1859 if (n) {
1860 n[1].i = (GLint) width;
1861 n[2].i = (GLint) height;
1862 n[3].f = xorig;
1863 n[4].f = yorig;
1864 n[5].f = xmove;
1865 n[6].f = ymove;
1866 save_pointer(&n[7],
1867 unpack_image(ctx, 2, width, height, 1, GL_COLOR_INDEX,
1868 GL_BITMAP, pixels, &ctx->Unpack));
1869 }
1870 if (ctx->ExecuteFlag) {
1871 CALL_Bitmap(ctx->Exec, (width, height,
1872 xorig, yorig, xmove, ymove, pixels));
1873 }
1874 }
1875
1876
1877 static void GLAPIENTRY
1878 save_BlendEquation(GLenum mode)
1879 {
1880 GET_CURRENT_CONTEXT(ctx);
1881 Node *n;
1882 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1883 n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION, 1);
1884 if (n) {
1885 n[1].e = mode;
1886 }
1887 if (ctx->ExecuteFlag) {
1888 CALL_BlendEquation(ctx->Exec, (mode));
1889 }
1890 }
1891
1892
1893 static void GLAPIENTRY
1894 save_BlendEquationSeparateEXT(GLenum modeRGB, GLenum modeA)
1895 {
1896 GET_CURRENT_CONTEXT(ctx);
1897 Node *n;
1898 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1899 n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION_SEPARATE, 2);
1900 if (n) {
1901 n[1].e = modeRGB;
1902 n[2].e = modeA;
1903 }
1904 if (ctx->ExecuteFlag) {
1905 CALL_BlendEquationSeparate(ctx->Exec, (modeRGB, modeA));
1906 }
1907 }
1908
1909
1910 static void GLAPIENTRY
1911 save_BlendFuncSeparateEXT(GLenum sfactorRGB, GLenum dfactorRGB,
1912 GLenum sfactorA, GLenum dfactorA)
1913 {
1914 GET_CURRENT_CONTEXT(ctx);
1915 Node *n;
1916 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1917 n = alloc_instruction(ctx, OPCODE_BLEND_FUNC_SEPARATE, 4);
1918 if (n) {
1919 n[1].e = sfactorRGB;
1920 n[2].e = dfactorRGB;
1921 n[3].e = sfactorA;
1922 n[4].e = dfactorA;
1923 }
1924 if (ctx->ExecuteFlag) {
1925 CALL_BlendFuncSeparate(ctx->Exec,
1926 (sfactorRGB, dfactorRGB, sfactorA, dfactorA));
1927 }
1928 }
1929
1930
1931 static void GLAPIENTRY
1932 save_BlendFunc(GLenum srcfactor, GLenum dstfactor)
1933 {
1934 save_BlendFuncSeparateEXT(srcfactor, dstfactor, srcfactor, dstfactor);
1935 }
1936
1937
1938 static void GLAPIENTRY
1939 save_BlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
1940 {
1941 GET_CURRENT_CONTEXT(ctx);
1942 Node *n;
1943 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1944 n = alloc_instruction(ctx, OPCODE_BLEND_COLOR, 4);
1945 if (n) {
1946 n[1].f = red;
1947 n[2].f = green;
1948 n[3].f = blue;
1949 n[4].f = alpha;
1950 }
1951 if (ctx->ExecuteFlag) {
1952 CALL_BlendColor(ctx->Exec, (red, green, blue, alpha));
1953 }
1954 }
1955
1956 /* GL_ARB_draw_buffers_blend */
1957 static void GLAPIENTRY
1958 save_BlendFuncSeparatei(GLuint buf, GLenum sfactorRGB, GLenum dfactorRGB,
1959 GLenum sfactorA, GLenum dfactorA)
1960 {
1961 GET_CURRENT_CONTEXT(ctx);
1962 Node *n;
1963 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1964 n = alloc_instruction(ctx, OPCODE_BLEND_FUNC_SEPARATE_I, 5);
1965 if (n) {
1966 n[1].ui = buf;
1967 n[2].e = sfactorRGB;
1968 n[3].e = dfactorRGB;
1969 n[4].e = sfactorA;
1970 n[5].e = dfactorA;
1971 }
1972 if (ctx->ExecuteFlag) {
1973 CALL_BlendFuncSeparateiARB(ctx->Exec, (buf, sfactorRGB, dfactorRGB,
1974 sfactorA, dfactorA));
1975 }
1976 }
1977
1978 /* GL_ARB_draw_buffers_blend */
1979 static void GLAPIENTRY
1980 save_BlendFunci(GLuint buf, GLenum sfactor, GLenum dfactor)
1981 {
1982 GET_CURRENT_CONTEXT(ctx);
1983 Node *n;
1984 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1985 n = alloc_instruction(ctx, OPCODE_BLEND_FUNC_I, 3);
1986 if (n) {
1987 n[1].ui = buf;
1988 n[2].e = sfactor;
1989 n[3].e = dfactor;
1990 }
1991 if (ctx->ExecuteFlag) {
1992 CALL_BlendFunciARB(ctx->Exec, (buf, sfactor, dfactor));
1993 }
1994 }
1995
1996 /* GL_ARB_draw_buffers_blend */
1997 static void GLAPIENTRY
1998 save_BlendEquationi(GLuint buf, GLenum mode)
1999 {
2000 GET_CURRENT_CONTEXT(ctx);
2001 Node *n;
2002 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2003 n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION_I, 2);
2004 if (n) {
2005 n[1].ui = buf;
2006 n[2].e = mode;
2007 }
2008 if (ctx->ExecuteFlag) {
2009 CALL_BlendEquationiARB(ctx->Exec, (buf, mode));
2010 }
2011 }
2012
2013 /* GL_ARB_draw_buffers_blend */
2014 static void GLAPIENTRY
2015 save_BlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeA)
2016 {
2017 GET_CURRENT_CONTEXT(ctx);
2018 Node *n;
2019 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2020 n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION_SEPARATE_I, 3);
2021 if (n) {
2022 n[1].ui = buf;
2023 n[2].e = modeRGB;
2024 n[3].e = modeA;
2025 }
2026 if (ctx->ExecuteFlag) {
2027 CALL_BlendEquationSeparateiARB(ctx->Exec, (buf, modeRGB, modeA));
2028 }
2029 }
2030
2031
2032 /* GL_ARB_draw_instanced. */
2033 static void GLAPIENTRY
2034 save_DrawArraysInstancedARB(UNUSED GLenum mode,
2035 UNUSED GLint first,
2036 UNUSED GLsizei count,
2037 UNUSED GLsizei primcount)
2038 {
2039 GET_CURRENT_CONTEXT(ctx);
2040 _mesa_error(ctx, GL_INVALID_OPERATION,
2041 "glDrawArraysInstanced() during display list compile");
2042 }
2043
2044 static void GLAPIENTRY
2045 save_DrawElementsInstancedARB(UNUSED GLenum mode,
2046 UNUSED GLsizei count,
2047 UNUSED GLenum type,
2048 UNUSED const GLvoid *indices,
2049 UNUSED GLsizei primcount)
2050 {
2051 GET_CURRENT_CONTEXT(ctx);
2052 _mesa_error(ctx, GL_INVALID_OPERATION,
2053 "glDrawElementsInstanced() during display list compile");
2054 }
2055
2056 static void GLAPIENTRY
2057 save_DrawElementsInstancedBaseVertexARB(UNUSED GLenum mode,
2058 UNUSED GLsizei count,
2059 UNUSED GLenum type,
2060 UNUSED const GLvoid *indices,
2061 UNUSED GLsizei primcount,
2062 UNUSED GLint basevertex)
2063 {
2064 GET_CURRENT_CONTEXT(ctx);
2065 _mesa_error(ctx, GL_INVALID_OPERATION,
2066 "glDrawElementsInstancedBaseVertex() during display list compile");
2067 }
2068
2069 /* GL_ARB_base_instance. */
2070 static void GLAPIENTRY
2071 save_DrawArraysInstancedBaseInstance(UNUSED GLenum mode,
2072 UNUSED GLint first,
2073 UNUSED GLsizei count,
2074 UNUSED GLsizei primcount,
2075 UNUSED GLuint baseinstance)
2076 {
2077 GET_CURRENT_CONTEXT(ctx);
2078 _mesa_error(ctx, GL_INVALID_OPERATION,
2079 "glDrawArraysInstancedBaseInstance() during display list compile");
2080 }
2081
2082 static void APIENTRY
2083 save_DrawElementsInstancedBaseInstance(UNUSED GLenum mode,
2084 UNUSED GLsizei count,
2085 UNUSED GLenum type,
2086 UNUSED const void *indices,
2087 UNUSED GLsizei primcount,
2088 UNUSED GLuint baseinstance)
2089 {
2090 GET_CURRENT_CONTEXT(ctx);
2091 _mesa_error(ctx, GL_INVALID_OPERATION,
2092 "glDrawElementsInstancedBaseInstance() during display list compile");
2093 }
2094
2095 static void APIENTRY
2096 save_DrawElementsInstancedBaseVertexBaseInstance(UNUSED GLenum mode,
2097 UNUSED GLsizei count,
2098 UNUSED GLenum type,
2099 UNUSED const void *indices,
2100 UNUSED GLsizei primcount,
2101 UNUSED GLint basevertex,
2102 UNUSED GLuint baseinstance)
2103 {
2104 GET_CURRENT_CONTEXT(ctx);
2105 _mesa_error(ctx, GL_INVALID_OPERATION,
2106 "glDrawElementsInstancedBaseVertexBaseInstance() during display list compile");
2107 }
2108
2109 static void APIENTRY
2110 save_DrawArraysIndirect(UNUSED GLenum mode,
2111 UNUSED const void *indirect)
2112 {
2113 GET_CURRENT_CONTEXT(ctx);
2114 _mesa_error(ctx, GL_INVALID_OPERATION,
2115 "glDrawArraysIndirect() during display list compile");
2116 }
2117
2118 static void APIENTRY
2119 save_DrawElementsIndirect(UNUSED GLenum mode,
2120 UNUSED GLenum type,
2121 UNUSED const void *indirect)
2122 {
2123 GET_CURRENT_CONTEXT(ctx);
2124 _mesa_error(ctx, GL_INVALID_OPERATION,
2125 "glDrawElementsIndirect() during display list compile");
2126 }
2127
2128 static void APIENTRY
2129 save_MultiDrawArraysIndirect(UNUSED GLenum mode,
2130 UNUSED const void *indirect,
2131 UNUSED GLsizei primcount,
2132 UNUSED GLsizei stride)
2133 {
2134 GET_CURRENT_CONTEXT(ctx);
2135 _mesa_error(ctx, GL_INVALID_OPERATION,
2136 "glMultiDrawArraysIndirect() during display list compile");
2137 }
2138
2139 static void APIENTRY
2140 save_MultiDrawElementsIndirect(UNUSED GLenum mode,
2141 UNUSED GLenum type,
2142 UNUSED const void *indirect,
2143 UNUSED GLsizei primcount,
2144 UNUSED GLsizei stride)
2145 {
2146 GET_CURRENT_CONTEXT(ctx);
2147 _mesa_error(ctx, GL_INVALID_OPERATION,
2148 "glMultiDrawElementsIndirect() during display list compile");
2149 }
2150
2151 /**
2152 * While building a display list we cache some OpenGL state.
2153 * Under some circumstances we need to invalidate that state (immediately
2154 * when we start compiling a list, or after glCallList(s)).
2155 */
2156 static void
2157 invalidate_saved_current_state(struct gl_context *ctx)
2158 {
2159 GLint i;
2160
2161 for (i = 0; i < VERT_ATTRIB_MAX; i++)
2162 ctx->ListState.ActiveAttribSize[i] = 0;
2163
2164 for (i = 0; i < MAT_ATTRIB_MAX; i++)
2165 ctx->ListState.ActiveMaterialSize[i] = 0;
2166
2167 memset(&ctx->ListState.Current, 0, sizeof ctx->ListState.Current);
2168
2169 ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN;
2170 }
2171
2172
2173 static void GLAPIENTRY
2174 save_CallList(GLuint list)
2175 {
2176 GET_CURRENT_CONTEXT(ctx);
2177 Node *n;
2178 SAVE_FLUSH_VERTICES(ctx);
2179
2180 n = alloc_instruction(ctx, OPCODE_CALL_LIST, 1);
2181 if (n) {
2182 n[1].ui = list;
2183 }
2184
2185 /* After this, we don't know what state we're in. Invalidate all
2186 * cached information previously gathered:
2187 */
2188 invalidate_saved_current_state( ctx );
2189
2190 if (ctx->ExecuteFlag) {
2191 _mesa_CallList(list);
2192 }
2193 }
2194
2195
2196 static void GLAPIENTRY
2197 save_CallLists(GLsizei num, GLenum type, const GLvoid * lists)
2198 {
2199 GET_CURRENT_CONTEXT(ctx);
2200 unsigned type_size;
2201 Node *n;
2202 void *lists_copy;
2203
2204 SAVE_FLUSH_VERTICES(ctx);
2205
2206 switch (type) {
2207 case GL_BYTE:
2208 case GL_UNSIGNED_BYTE:
2209 type_size = 1;
2210 break;
2211 case GL_SHORT:
2212 case GL_UNSIGNED_SHORT:
2213 case GL_2_BYTES:
2214 type_size = 2;
2215 break;
2216 case GL_3_BYTES:
2217 type_size = 3;
2218 break;
2219 case GL_INT:
2220 case GL_UNSIGNED_INT:
2221 case GL_FLOAT:
2222 case GL_4_BYTES:
2223 type_size = 4;
2224 break;
2225 default:
2226 type_size = 0;
2227 }
2228
2229 if (num > 0 && type_size > 0) {
2230 /* create a copy of the array of list IDs to save in the display list */
2231 lists_copy = memdup(lists, num * type_size);
2232 } else {
2233 lists_copy = NULL;
2234 }
2235
2236 n = alloc_instruction(ctx, OPCODE_CALL_LISTS, 2 + POINTER_DWORDS);
2237 if (n) {
2238 n[1].i = num;
2239 n[2].e = type;
2240 save_pointer(&n[3], lists_copy);
2241 }
2242
2243 /* After this, we don't know what state we're in. Invalidate all
2244 * cached information previously gathered:
2245 */
2246 invalidate_saved_current_state( ctx );
2247
2248 if (ctx->ExecuteFlag) {
2249 CALL_CallLists(ctx->Exec, (num, type, lists));
2250 }
2251 }
2252
2253
2254 static void GLAPIENTRY
2255 save_Clear(GLbitfield mask)
2256 {
2257 GET_CURRENT_CONTEXT(ctx);
2258 Node *n;
2259 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2260 n = alloc_instruction(ctx, OPCODE_CLEAR, 1);
2261 if (n) {
2262 n[1].bf = mask;
2263 }
2264 if (ctx->ExecuteFlag) {
2265 CALL_Clear(ctx->Exec, (mask));
2266 }
2267 }
2268
2269
2270 static void GLAPIENTRY
2271 save_ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value)
2272 {
2273 GET_CURRENT_CONTEXT(ctx);
2274 Node *n;
2275 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2276 n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_IV, 6);
2277 if (n) {
2278 n[1].e = buffer;
2279 n[2].i = drawbuffer;
2280 n[3].i = value[0];
2281 if (buffer == GL_COLOR) {
2282 n[4].i = value[1];
2283 n[5].i = value[2];
2284 n[6].i = value[3];
2285 }
2286 else {
2287 n[4].i = 0;
2288 n[5].i = 0;
2289 n[6].i = 0;
2290 }
2291 }
2292 if (ctx->ExecuteFlag) {
2293 CALL_ClearBufferiv(ctx->Exec, (buffer, drawbuffer, value));
2294 }
2295 }
2296
2297
2298 static void GLAPIENTRY
2299 save_ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value)
2300 {
2301 GET_CURRENT_CONTEXT(ctx);
2302 Node *n;
2303 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2304 n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_UIV, 6);
2305 if (n) {
2306 n[1].e = buffer;
2307 n[2].i = drawbuffer;
2308 n[3].ui = value[0];
2309 if (buffer == GL_COLOR) {
2310 n[4].ui = value[1];
2311 n[5].ui = value[2];
2312 n[6].ui = value[3];
2313 }
2314 else {
2315 n[4].ui = 0;
2316 n[5].ui = 0;
2317 n[6].ui = 0;
2318 }
2319 }
2320 if (ctx->ExecuteFlag) {
2321 CALL_ClearBufferuiv(ctx->Exec, (buffer, drawbuffer, value));
2322 }
2323 }
2324
2325
2326 static void GLAPIENTRY
2327 save_ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
2328 {
2329 GET_CURRENT_CONTEXT(ctx);
2330 Node *n;
2331 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2332 n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_FV, 6);
2333 if (n) {
2334 n[1].e = buffer;
2335 n[2].i = drawbuffer;
2336 n[3].f = value[0];
2337 if (buffer == GL_COLOR) {
2338 n[4].f = value[1];
2339 n[5].f = value[2];
2340 n[6].f = value[3];
2341 }
2342 else {
2343 n[4].f = 0.0F;
2344 n[5].f = 0.0F;
2345 n[6].f = 0.0F;
2346 }
2347 }
2348 if (ctx->ExecuteFlag) {
2349 CALL_ClearBufferfv(ctx->Exec, (buffer, drawbuffer, value));
2350 }
2351 }
2352
2353
2354 static void GLAPIENTRY
2355 save_ClearBufferfi(GLenum buffer, GLint drawbuffer,
2356 GLfloat depth, GLint stencil)
2357 {
2358 GET_CURRENT_CONTEXT(ctx);
2359 Node *n;
2360 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2361 n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_FI, 4);
2362 if (n) {
2363 n[1].e = buffer;
2364 n[2].i = drawbuffer;
2365 n[3].f = depth;
2366 n[4].i = stencil;
2367 }
2368 if (ctx->ExecuteFlag) {
2369 CALL_ClearBufferfi(ctx->Exec, (buffer, drawbuffer, depth, stencil));
2370 }
2371 }
2372
2373
2374 static void GLAPIENTRY
2375 save_ClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
2376 {
2377 GET_CURRENT_CONTEXT(ctx);
2378 Node *n;
2379 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2380 n = alloc_instruction(ctx, OPCODE_CLEAR_ACCUM, 4);
2381 if (n) {
2382 n[1].f = red;
2383 n[2].f = green;
2384 n[3].f = blue;
2385 n[4].f = alpha;
2386 }
2387 if (ctx->ExecuteFlag) {
2388 CALL_ClearAccum(ctx->Exec, (red, green, blue, alpha));
2389 }
2390 }
2391
2392
2393 static void GLAPIENTRY
2394 save_ClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
2395 {
2396 GET_CURRENT_CONTEXT(ctx);
2397 Node *n;
2398 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2399 n = alloc_instruction(ctx, OPCODE_CLEAR_COLOR, 4);
2400 if (n) {
2401 n[1].f = red;
2402 n[2].f = green;
2403 n[3].f = blue;
2404 n[4].f = alpha;
2405 }
2406 if (ctx->ExecuteFlag) {
2407 CALL_ClearColor(ctx->Exec, (red, green, blue, alpha));
2408 }
2409 }
2410
2411
2412 static void GLAPIENTRY
2413 save_ClearDepth(GLclampd depth)
2414 {
2415 GET_CURRENT_CONTEXT(ctx);
2416 Node *n;
2417 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2418 n = alloc_instruction(ctx, OPCODE_CLEAR_DEPTH, 1);
2419 if (n) {
2420 n[1].f = (GLfloat) depth;
2421 }
2422 if (ctx->ExecuteFlag) {
2423 CALL_ClearDepth(ctx->Exec, (depth));
2424 }
2425 }
2426
2427
2428 static void GLAPIENTRY
2429 save_ClearIndex(GLfloat c)
2430 {
2431 GET_CURRENT_CONTEXT(ctx);
2432 Node *n;
2433 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2434 n = alloc_instruction(ctx, OPCODE_CLEAR_INDEX, 1);
2435 if (n) {
2436 n[1].f = c;
2437 }
2438 if (ctx->ExecuteFlag) {
2439 CALL_ClearIndex(ctx->Exec, (c));
2440 }
2441 }
2442
2443
2444 static void GLAPIENTRY
2445 save_ClearStencil(GLint s)
2446 {
2447 GET_CURRENT_CONTEXT(ctx);
2448 Node *n;
2449 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2450 n = alloc_instruction(ctx, OPCODE_CLEAR_STENCIL, 1);
2451 if (n) {
2452 n[1].i = s;
2453 }
2454 if (ctx->ExecuteFlag) {
2455 CALL_ClearStencil(ctx->Exec, (s));
2456 }
2457 }
2458
2459
2460 static void GLAPIENTRY
2461 save_ClipPlane(GLenum plane, const GLdouble * equ)
2462 {
2463 GET_CURRENT_CONTEXT(ctx);
2464 Node *n;
2465 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2466 n = alloc_instruction(ctx, OPCODE_CLIP_PLANE, 5);
2467 if (n) {
2468 n[1].e = plane;
2469 n[2].f = (GLfloat) equ[0];
2470 n[3].f = (GLfloat) equ[1];
2471 n[4].f = (GLfloat) equ[2];
2472 n[5].f = (GLfloat) equ[3];
2473 }
2474 if (ctx->ExecuteFlag) {
2475 CALL_ClipPlane(ctx->Exec, (plane, equ));
2476 }
2477 }
2478
2479
2480
2481 static void GLAPIENTRY
2482 save_ColorMask(GLboolean red, GLboolean green,
2483 GLboolean blue, GLboolean alpha)
2484 {
2485 GET_CURRENT_CONTEXT(ctx);
2486 Node *n;
2487 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2488 n = alloc_instruction(ctx, OPCODE_COLOR_MASK, 4);
2489 if (n) {
2490 n[1].b = red;
2491 n[2].b = green;
2492 n[3].b = blue;
2493 n[4].b = alpha;
2494 }
2495 if (ctx->ExecuteFlag) {
2496 CALL_ColorMask(ctx->Exec, (red, green, blue, alpha));
2497 }
2498 }
2499
2500
2501 static void GLAPIENTRY
2502 save_ColorMaskIndexed(GLuint buf, GLboolean red, GLboolean green,
2503 GLboolean blue, GLboolean alpha)
2504 {
2505 GET_CURRENT_CONTEXT(ctx);
2506 Node *n;
2507 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2508 n = alloc_instruction(ctx, OPCODE_COLOR_MASK_INDEXED, 5);
2509 if (n) {
2510 n[1].ui = buf;
2511 n[2].b = red;
2512 n[3].b = green;
2513 n[4].b = blue;
2514 n[5].b = alpha;
2515 }
2516 if (ctx->ExecuteFlag) {
2517 /*CALL_ColorMaski(ctx->Exec, (buf, red, green, blue, alpha));*/
2518 }
2519 }
2520
2521
2522 static void GLAPIENTRY
2523 save_ColorMaterial(GLenum face, GLenum mode)
2524 {
2525 GET_CURRENT_CONTEXT(ctx);
2526 Node *n;
2527 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2528
2529 n = alloc_instruction(ctx, OPCODE_COLOR_MATERIAL, 2);
2530 if (n) {
2531 n[1].e = face;
2532 n[2].e = mode;
2533 }
2534 if (ctx->ExecuteFlag) {
2535 CALL_ColorMaterial(ctx->Exec, (face, mode));
2536 }
2537 }
2538
2539
2540 static void GLAPIENTRY
2541 save_CopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type)
2542 {
2543 GET_CURRENT_CONTEXT(ctx);
2544 Node *n;
2545 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2546 n = alloc_instruction(ctx, OPCODE_COPY_PIXELS, 5);
2547 if (n) {
2548 n[1].i = x;
2549 n[2].i = y;
2550 n[3].i = (GLint) width;
2551 n[4].i = (GLint) height;
2552 n[5].e = type;
2553 }
2554 if (ctx->ExecuteFlag) {
2555 CALL_CopyPixels(ctx->Exec, (x, y, width, height, type));
2556 }
2557 }
2558
2559
2560
2561 static void GLAPIENTRY
2562 save_CopyTexImage1D(GLenum target, GLint level, GLenum internalformat,
2563 GLint x, GLint y, GLsizei width, GLint border)
2564 {
2565 GET_CURRENT_CONTEXT(ctx);
2566 Node *n;
2567 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2568 n = alloc_instruction(ctx, OPCODE_COPY_TEX_IMAGE1D, 7);
2569 if (n) {
2570 n[1].e = target;
2571 n[2].i = level;
2572 n[3].e = internalformat;
2573 n[4].i = x;
2574 n[5].i = y;
2575 n[6].i = width;
2576 n[7].i = border;
2577 }
2578 if (ctx->ExecuteFlag) {
2579 CALL_CopyTexImage1D(ctx->Exec, (target, level, internalformat,
2580 x, y, width, border));
2581 }
2582 }
2583
2584
2585 static void GLAPIENTRY
2586 save_CopyTexImage2D(GLenum target, GLint level,
2587 GLenum internalformat,
2588 GLint x, GLint y, GLsizei width,
2589 GLsizei height, GLint border)
2590 {
2591 GET_CURRENT_CONTEXT(ctx);
2592 Node *n;
2593 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2594 n = alloc_instruction(ctx, OPCODE_COPY_TEX_IMAGE2D, 8);
2595 if (n) {
2596 n[1].e = target;
2597 n[2].i = level;
2598 n[3].e = internalformat;
2599 n[4].i = x;
2600 n[5].i = y;
2601 n[6].i = width;
2602 n[7].i = height;
2603 n[8].i = border;
2604 }
2605 if (ctx->ExecuteFlag) {
2606 CALL_CopyTexImage2D(ctx->Exec, (target, level, internalformat,
2607 x, y, width, height, border));
2608 }
2609 }
2610
2611
2612
2613 static void GLAPIENTRY
2614 save_CopyTexSubImage1D(GLenum target, GLint level,
2615 GLint xoffset, GLint x, GLint y, GLsizei width)
2616 {
2617 GET_CURRENT_CONTEXT(ctx);
2618 Node *n;
2619 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2620 n = alloc_instruction(ctx, OPCODE_COPY_TEX_SUB_IMAGE1D, 6);
2621 if (n) {
2622 n[1].e = target;
2623 n[2].i = level;
2624 n[3].i = xoffset;
2625 n[4].i = x;
2626 n[5].i = y;
2627 n[6].i = width;
2628 }
2629 if (ctx->ExecuteFlag) {
2630 CALL_CopyTexSubImage1D(ctx->Exec,
2631 (target, level, xoffset, x, y, width));
2632 }
2633 }
2634
2635
2636 static void GLAPIENTRY
2637 save_CopyTexSubImage2D(GLenum target, GLint level,
2638 GLint xoffset, GLint yoffset,
2639 GLint x, GLint y, GLsizei width, GLint height)
2640 {
2641 GET_CURRENT_CONTEXT(ctx);
2642 Node *n;
2643 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2644 n = alloc_instruction(ctx, OPCODE_COPY_TEX_SUB_IMAGE2D, 8);
2645 if (n) {
2646 n[1].e = target;
2647 n[2].i = level;
2648 n[3].i = xoffset;
2649 n[4].i = yoffset;
2650 n[5].i = x;
2651 n[6].i = y;
2652 n[7].i = width;
2653 n[8].i = height;
2654 }
2655 if (ctx->ExecuteFlag) {
2656 CALL_CopyTexSubImage2D(ctx->Exec, (target, level, xoffset, yoffset,
2657 x, y, width, height));
2658 }
2659 }
2660
2661
2662 static void GLAPIENTRY
2663 save_CopyTexSubImage3D(GLenum target, GLint level,
2664 GLint xoffset, GLint yoffset, GLint zoffset,
2665 GLint x, GLint y, GLsizei width, GLint height)
2666 {
2667 GET_CURRENT_CONTEXT(ctx);
2668 Node *n;
2669 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2670 n = alloc_instruction(ctx, OPCODE_COPY_TEX_SUB_IMAGE3D, 9);
2671 if (n) {
2672 n[1].e = target;
2673 n[2].i = level;
2674 n[3].i = xoffset;
2675 n[4].i = yoffset;
2676 n[5].i = zoffset;
2677 n[6].i = x;
2678 n[7].i = y;
2679 n[8].i = width;
2680 n[9].i = height;
2681 }
2682 if (ctx->ExecuteFlag) {
2683 CALL_CopyTexSubImage3D(ctx->Exec, (target, level,
2684 xoffset, yoffset, zoffset,
2685 x, y, width, height));
2686 }
2687 }
2688
2689
2690 static void GLAPIENTRY
2691 save_CullFace(GLenum mode)
2692 {
2693 GET_CURRENT_CONTEXT(ctx);
2694 Node *n;
2695 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2696 n = alloc_instruction(ctx, OPCODE_CULL_FACE, 1);
2697 if (n) {
2698 n[1].e = mode;
2699 }
2700 if (ctx->ExecuteFlag) {
2701 CALL_CullFace(ctx->Exec, (mode));
2702 }
2703 }
2704
2705
2706 static void GLAPIENTRY
2707 save_DepthFunc(GLenum func)
2708 {
2709 GET_CURRENT_CONTEXT(ctx);
2710 Node *n;
2711 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2712 n = alloc_instruction(ctx, OPCODE_DEPTH_FUNC, 1);
2713 if (n) {
2714 n[1].e = func;
2715 }
2716 if (ctx->ExecuteFlag) {
2717 CALL_DepthFunc(ctx->Exec, (func));
2718 }
2719 }
2720
2721
2722 static void GLAPIENTRY
2723 save_DepthMask(GLboolean mask)
2724 {
2725 GET_CURRENT_CONTEXT(ctx);
2726 Node *n;
2727 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2728 n = alloc_instruction(ctx, OPCODE_DEPTH_MASK, 1);
2729 if (n) {
2730 n[1].b = mask;
2731 }
2732 if (ctx->ExecuteFlag) {
2733 CALL_DepthMask(ctx->Exec, (mask));
2734 }
2735 }
2736
2737
2738 static void GLAPIENTRY
2739 save_DepthRange(GLclampd nearval, GLclampd farval)
2740 {
2741 GET_CURRENT_CONTEXT(ctx);
2742 Node *n;
2743 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2744 n = alloc_instruction(ctx, OPCODE_DEPTH_RANGE, 2);
2745 if (n) {
2746 n[1].f = (GLfloat) nearval;
2747 n[2].f = (GLfloat) farval;
2748 }
2749 if (ctx->ExecuteFlag) {
2750 CALL_DepthRange(ctx->Exec, (nearval, farval));
2751 }
2752 }
2753
2754
2755 static void GLAPIENTRY
2756 save_Disable(GLenum cap)
2757 {
2758 GET_CURRENT_CONTEXT(ctx);
2759 Node *n;
2760 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2761 n = alloc_instruction(ctx, OPCODE_DISABLE, 1);
2762 if (n) {
2763 n[1].e = cap;
2764 }
2765 if (ctx->ExecuteFlag) {
2766 CALL_Disable(ctx->Exec, (cap));
2767 }
2768 }
2769
2770
2771 static void GLAPIENTRY
2772 save_DisableIndexed(GLuint index, GLenum cap)
2773 {
2774 GET_CURRENT_CONTEXT(ctx);
2775 Node *n;
2776 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2777 n = alloc_instruction(ctx, OPCODE_DISABLE_INDEXED, 2);
2778 if (n) {
2779 n[1].ui = index;
2780 n[2].e = cap;
2781 }
2782 if (ctx->ExecuteFlag) {
2783 CALL_Disablei(ctx->Exec, (index, cap));
2784 }
2785 }
2786
2787
2788 static void GLAPIENTRY
2789 save_DrawBuffer(GLenum mode)
2790 {
2791 GET_CURRENT_CONTEXT(ctx);
2792 Node *n;
2793 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2794 n = alloc_instruction(ctx, OPCODE_DRAW_BUFFER, 1);
2795 if (n) {
2796 n[1].e = mode;
2797 }
2798 if (ctx->ExecuteFlag) {
2799 CALL_DrawBuffer(ctx->Exec, (mode));
2800 }
2801 }
2802
2803
2804 static void GLAPIENTRY
2805 save_DrawPixels(GLsizei width, GLsizei height,
2806 GLenum format, GLenum type, const GLvoid * pixels)
2807 {
2808 GET_CURRENT_CONTEXT(ctx);
2809 Node *n;
2810
2811 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2812
2813 n = alloc_instruction(ctx, OPCODE_DRAW_PIXELS, 4 + POINTER_DWORDS);
2814 if (n) {
2815 n[1].i = width;
2816 n[2].i = height;
2817 n[3].e = format;
2818 n[4].e = type;
2819 save_pointer(&n[5],
2820 unpack_image(ctx, 2, width, height, 1, format, type,
2821 pixels, &ctx->Unpack));
2822 }
2823 if (ctx->ExecuteFlag) {
2824 CALL_DrawPixels(ctx->Exec, (width, height, format, type, pixels));
2825 }
2826 }
2827
2828
2829
2830 static void GLAPIENTRY
2831 save_Enable(GLenum cap)
2832 {
2833 GET_CURRENT_CONTEXT(ctx);
2834 Node *n;
2835 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2836 n = alloc_instruction(ctx, OPCODE_ENABLE, 1);
2837 if (n) {
2838 n[1].e = cap;
2839 }
2840 if (ctx->ExecuteFlag) {
2841 CALL_Enable(ctx->Exec, (cap));
2842 }
2843 }
2844
2845
2846
2847 static void GLAPIENTRY
2848 save_EnableIndexed(GLuint index, GLenum cap)
2849 {
2850 GET_CURRENT_CONTEXT(ctx);
2851 Node *n;
2852 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2853 n = alloc_instruction(ctx, OPCODE_ENABLE_INDEXED, 2);
2854 if (n) {
2855 n[1].ui = index;
2856 n[2].e = cap;
2857 }
2858 if (ctx->ExecuteFlag) {
2859 CALL_Enablei(ctx->Exec, (index, cap));
2860 }
2861 }
2862
2863
2864
2865 static void GLAPIENTRY
2866 save_EvalMesh1(GLenum mode, GLint i1, GLint i2)
2867 {
2868 GET_CURRENT_CONTEXT(ctx);
2869 Node *n;
2870 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2871 n = alloc_instruction(ctx, OPCODE_EVALMESH1, 3);
2872 if (n) {
2873 n[1].e = mode;
2874 n[2].i = i1;
2875 n[3].i = i2;
2876 }
2877 if (ctx->ExecuteFlag) {
2878 CALL_EvalMesh1(ctx->Exec, (mode, i1, i2));
2879 }
2880 }
2881
2882
2883 static void GLAPIENTRY
2884 save_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)
2885 {
2886 GET_CURRENT_CONTEXT(ctx);
2887 Node *n;
2888 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2889 n = alloc_instruction(ctx, OPCODE_EVALMESH2, 5);
2890 if (n) {
2891 n[1].e = mode;
2892 n[2].i = i1;
2893 n[3].i = i2;
2894 n[4].i = j1;
2895 n[5].i = j2;
2896 }
2897 if (ctx->ExecuteFlag) {
2898 CALL_EvalMesh2(ctx->Exec, (mode, i1, i2, j1, j2));
2899 }
2900 }
2901
2902
2903
2904
2905 static void GLAPIENTRY
2906 save_Fogfv(GLenum pname, const GLfloat *params)
2907 {
2908 GET_CURRENT_CONTEXT(ctx);
2909 Node *n;
2910 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2911 n = alloc_instruction(ctx, OPCODE_FOG, 5);
2912 if (n) {
2913 n[1].e = pname;
2914 n[2].f = params[0];
2915 n[3].f = params[1];
2916 n[4].f = params[2];
2917 n[5].f = params[3];
2918 }
2919 if (ctx->ExecuteFlag) {
2920 CALL_Fogfv(ctx->Exec, (pname, params));
2921 }
2922 }
2923
2924
2925 static void GLAPIENTRY
2926 save_Fogf(GLenum pname, GLfloat param)
2927 {
2928 GLfloat parray[4];
2929 parray[0] = param;
2930 parray[1] = parray[2] = parray[3] = 0.0F;
2931 save_Fogfv(pname, parray);
2932 }
2933
2934
2935 static void GLAPIENTRY
2936 save_Fogiv(GLenum pname, const GLint *params)
2937 {
2938 GLfloat p[4];
2939 switch (pname) {
2940 case GL_FOG_MODE:
2941 case GL_FOG_DENSITY:
2942 case GL_FOG_START:
2943 case GL_FOG_END:
2944 case GL_FOG_INDEX:
2945 case GL_FOG_COORDINATE_SOURCE:
2946 p[0] = (GLfloat) *params;
2947 p[1] = 0.0f;
2948 p[2] = 0.0f;
2949 p[3] = 0.0f;
2950 break;
2951 case GL_FOG_COLOR:
2952 p[0] = INT_TO_FLOAT(params[0]);
2953 p[1] = INT_TO_FLOAT(params[1]);
2954 p[2] = INT_TO_FLOAT(params[2]);
2955 p[3] = INT_TO_FLOAT(params[3]);
2956 break;
2957 default:
2958 /* Error will be caught later in gl_Fogfv */
2959 ASSIGN_4V(p, 0.0F, 0.0F, 0.0F, 0.0F);
2960 }
2961 save_Fogfv(pname, p);
2962 }
2963
2964
2965 static void GLAPIENTRY
2966 save_Fogi(GLenum pname, GLint param)
2967 {
2968 GLint parray[4];
2969 parray[0] = param;
2970 parray[1] = parray[2] = parray[3] = 0;
2971 save_Fogiv(pname, parray);
2972 }
2973
2974
2975 static void GLAPIENTRY
2976 save_FrontFace(GLenum mode)
2977 {
2978 GET_CURRENT_CONTEXT(ctx);
2979 Node *n;
2980 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2981 n = alloc_instruction(ctx, OPCODE_FRONT_FACE, 1);
2982 if (n) {
2983 n[1].e = mode;
2984 }
2985 if (ctx->ExecuteFlag) {
2986 CALL_FrontFace(ctx->Exec, (mode));
2987 }
2988 }
2989
2990
2991 static void GLAPIENTRY
2992 save_Frustum(GLdouble left, GLdouble right,
2993 GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval)
2994 {
2995 GET_CURRENT_CONTEXT(ctx);
2996 Node *n;
2997 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2998 n = alloc_instruction(ctx, OPCODE_FRUSTUM, 6);
2999 if (n) {
3000 n[1].f = (GLfloat) left;
3001 n[2].f = (GLfloat) right;
3002 n[3].f = (GLfloat) bottom;
3003 n[4].f = (GLfloat) top;
3004 n[5].f = (GLfloat) nearval;
3005 n[6].f = (GLfloat) farval;
3006 }
3007 if (ctx->ExecuteFlag) {
3008 CALL_Frustum(ctx->Exec, (left, right, bottom, top, nearval, farval));
3009 }
3010 }
3011
3012
3013 static void GLAPIENTRY
3014 save_Hint(GLenum target, GLenum mode)
3015 {
3016 GET_CURRENT_CONTEXT(ctx);
3017 Node *n;
3018 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3019 n = alloc_instruction(ctx, OPCODE_HINT, 2);
3020 if (n) {
3021 n[1].e = target;
3022 n[2].e = mode;
3023 }
3024 if (ctx->ExecuteFlag) {
3025 CALL_Hint(ctx->Exec, (target, mode));
3026 }
3027 }
3028
3029
3030 static void GLAPIENTRY
3031 save_IndexMask(GLuint mask)
3032 {
3033 GET_CURRENT_CONTEXT(ctx);
3034 Node *n;
3035 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3036 n = alloc_instruction(ctx, OPCODE_INDEX_MASK, 1);
3037 if (n) {
3038 n[1].ui = mask;
3039 }
3040 if (ctx->ExecuteFlag) {
3041 CALL_IndexMask(ctx->Exec, (mask));
3042 }
3043 }
3044
3045
3046 static void GLAPIENTRY
3047 save_InitNames(void)
3048 {
3049 GET_CURRENT_CONTEXT(ctx);
3050 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3051 (void) alloc_instruction(ctx, OPCODE_INIT_NAMES, 0);
3052 if (ctx->ExecuteFlag) {
3053 CALL_InitNames(ctx->Exec, ());
3054 }
3055 }
3056
3057
3058 static void GLAPIENTRY
3059 save_Lightfv(GLenum light, GLenum pname, const GLfloat *params)
3060 {
3061 GET_CURRENT_CONTEXT(ctx);
3062 Node *n;
3063 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3064 n = alloc_instruction(ctx, OPCODE_LIGHT, 6);
3065 if (n) {
3066 GLint i, nParams;
3067 n[1].e = light;
3068 n[2].e = pname;
3069 switch (pname) {
3070 case GL_AMBIENT:
3071 nParams = 4;
3072 break;
3073 case GL_DIFFUSE:
3074 nParams = 4;
3075 break;
3076 case GL_SPECULAR:
3077 nParams = 4;
3078 break;
3079 case GL_POSITION:
3080 nParams = 4;
3081 break;
3082 case GL_SPOT_DIRECTION:
3083 nParams = 3;
3084 break;
3085 case GL_SPOT_EXPONENT:
3086 nParams = 1;
3087 break;
3088 case GL_SPOT_CUTOFF:
3089 nParams = 1;
3090 break;
3091 case GL_CONSTANT_ATTENUATION:
3092 nParams = 1;
3093 break;
3094 case GL_LINEAR_ATTENUATION:
3095 nParams = 1;
3096 break;
3097 case GL_QUADRATIC_ATTENUATION:
3098 nParams = 1;
3099 break;
3100 default:
3101 nParams = 0;
3102 }
3103 for (i = 0; i < nParams; i++) {
3104 n[3 + i].f = params[i];
3105 }
3106 }
3107 if (ctx->ExecuteFlag) {
3108 CALL_Lightfv(ctx->Exec, (light, pname, params));
3109 }
3110 }
3111
3112
3113 static void GLAPIENTRY
3114 save_Lightf(GLenum light, GLenum pname, GLfloat param)
3115 {
3116 GLfloat parray[4];
3117 parray[0] = param;
3118 parray[1] = parray[2] = parray[3] = 0.0F;
3119 save_Lightfv(light, pname, parray);
3120 }
3121
3122
3123 static void GLAPIENTRY
3124 save_Lightiv(GLenum light, GLenum pname, const GLint *params)
3125 {
3126 GLfloat fparam[4];
3127 switch (pname) {
3128 case GL_AMBIENT:
3129 case GL_DIFFUSE:
3130 case GL_SPECULAR:
3131 fparam[0] = INT_TO_FLOAT(params[0]);
3132 fparam[1] = INT_TO_FLOAT(params[1]);
3133 fparam[2] = INT_TO_FLOAT(params[2]);
3134 fparam[3] = INT_TO_FLOAT(params[3]);
3135 break;
3136 case GL_POSITION:
3137 fparam[0] = (GLfloat) params[0];
3138 fparam[1] = (GLfloat) params[1];
3139 fparam[2] = (GLfloat) params[2];
3140 fparam[3] = (GLfloat) params[3];
3141 break;
3142 case GL_SPOT_DIRECTION:
3143 fparam[0] = (GLfloat) params[0];
3144 fparam[1] = (GLfloat) params[1];
3145 fparam[2] = (GLfloat) params[2];
3146 break;
3147 case GL_SPOT_EXPONENT:
3148 case GL_SPOT_CUTOFF:
3149 case GL_CONSTANT_ATTENUATION:
3150 case GL_LINEAR_ATTENUATION:
3151 case GL_QUADRATIC_ATTENUATION:
3152 fparam[0] = (GLfloat) params[0];
3153 break;
3154 default:
3155 /* error will be caught later in gl_Lightfv */
3156 ;
3157 }
3158 save_Lightfv(light, pname, fparam);
3159 }
3160
3161
3162 static void GLAPIENTRY
3163 save_Lighti(GLenum light, GLenum pname, GLint param)
3164 {
3165 GLint parray[4];
3166 parray[0] = param;
3167 parray[1] = parray[2] = parray[3] = 0;
3168 save_Lightiv(light, pname, parray);
3169 }
3170
3171
3172 static void GLAPIENTRY
3173 save_LightModelfv(GLenum pname, const GLfloat *params)
3174 {
3175 GET_CURRENT_CONTEXT(ctx);
3176 Node *n;
3177 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3178 n = alloc_instruction(ctx, OPCODE_LIGHT_MODEL, 5);
3179 if (n) {
3180 n[1].e = pname;
3181 n[2].f = params[0];
3182 n[3].f = params[1];
3183 n[4].f = params[2];
3184 n[5].f = params[3];
3185 }
3186 if (ctx->ExecuteFlag) {
3187 CALL_LightModelfv(ctx->Exec, (pname, params));
3188 }
3189 }
3190
3191
3192 static void GLAPIENTRY
3193 save_LightModelf(GLenum pname, GLfloat param)
3194 {
3195 GLfloat parray[4];
3196 parray[0] = param;
3197 parray[1] = parray[2] = parray[3] = 0.0F;
3198 save_LightModelfv(pname, parray);
3199 }
3200
3201
3202 static void GLAPIENTRY
3203 save_LightModeliv(GLenum pname, const GLint *params)
3204 {
3205 GLfloat fparam[4];
3206 switch (pname) {
3207 case GL_LIGHT_MODEL_AMBIENT:
3208 fparam[0] = INT_TO_FLOAT(params[0]);
3209 fparam[1] = INT_TO_FLOAT(params[1]);
3210 fparam[2] = INT_TO_FLOAT(params[2]);
3211 fparam[3] = INT_TO_FLOAT(params[3]);
3212 break;
3213 case GL_LIGHT_MODEL_LOCAL_VIEWER:
3214 case GL_LIGHT_MODEL_TWO_SIDE:
3215 case GL_LIGHT_MODEL_COLOR_CONTROL:
3216 fparam[0] = (GLfloat) params[0];
3217 fparam[1] = 0.0F;
3218 fparam[2] = 0.0F;
3219 fparam[3] = 0.0F;
3220 break;
3221 default:
3222 /* Error will be caught later in gl_LightModelfv */
3223 ASSIGN_4V(fparam, 0.0F, 0.0F, 0.0F, 0.0F);
3224 }
3225 save_LightModelfv(pname, fparam);
3226 }
3227
3228
3229 static void GLAPIENTRY
3230 save_LightModeli(GLenum pname, GLint param)
3231 {
3232 GLint parray[4];
3233 parray[0] = param;
3234 parray[1] = parray[2] = parray[3] = 0;
3235 save_LightModeliv(pname, parray);
3236 }
3237
3238
3239 static void GLAPIENTRY
3240 save_LineStipple(GLint factor, GLushort pattern)
3241 {
3242 GET_CURRENT_CONTEXT(ctx);
3243 Node *n;
3244 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3245 n = alloc_instruction(ctx, OPCODE_LINE_STIPPLE, 2);
3246 if (n) {
3247 n[1].i = factor;
3248 n[2].us = pattern;
3249 }
3250 if (ctx->ExecuteFlag) {
3251 CALL_LineStipple(ctx->Exec, (factor, pattern));
3252 }
3253 }
3254
3255
3256 static void GLAPIENTRY
3257 save_LineWidth(GLfloat width)
3258 {
3259 GET_CURRENT_CONTEXT(ctx);
3260 Node *n;
3261 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3262 n = alloc_instruction(ctx, OPCODE_LINE_WIDTH, 1);
3263 if (n) {
3264 n[1].f = width;
3265 }
3266 if (ctx->ExecuteFlag) {
3267 CALL_LineWidth(ctx->Exec, (width));
3268 }
3269 }
3270
3271
3272 static void GLAPIENTRY
3273 save_ListBase(GLuint base)
3274 {
3275 GET_CURRENT_CONTEXT(ctx);
3276 Node *n;
3277 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3278 n = alloc_instruction(ctx, OPCODE_LIST_BASE, 1);
3279 if (n) {
3280 n[1].ui = base;
3281 }
3282 if (ctx->ExecuteFlag) {
3283 CALL_ListBase(ctx->Exec, (base));
3284 }
3285 }
3286
3287
3288 static void GLAPIENTRY
3289 save_LoadIdentity(void)
3290 {
3291 GET_CURRENT_CONTEXT(ctx);
3292 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3293 (void) alloc_instruction(ctx, OPCODE_LOAD_IDENTITY, 0);
3294 if (ctx->ExecuteFlag) {
3295 CALL_LoadIdentity(ctx->Exec, ());
3296 }
3297 }
3298
3299
3300 static void GLAPIENTRY
3301 save_LoadMatrixf(const GLfloat * m)
3302 {
3303 GET_CURRENT_CONTEXT(ctx);
3304 Node *n;
3305 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3306 n = alloc_instruction(ctx, OPCODE_LOAD_MATRIX, 16);
3307 if (n) {
3308 GLuint i;
3309 for (i = 0; i < 16; i++) {
3310 n[1 + i].f = m[i];
3311 }
3312 }
3313 if (ctx->ExecuteFlag) {
3314 CALL_LoadMatrixf(ctx->Exec, (m));
3315 }
3316 }
3317
3318
3319 static void GLAPIENTRY
3320 save_LoadMatrixd(const GLdouble * m)
3321 {
3322 GLfloat f[16];
3323 GLint i;
3324 for (i = 0; i < 16; i++) {
3325 f[i] = (GLfloat) m[i];
3326 }
3327 save_LoadMatrixf(f);
3328 }
3329
3330
3331 static void GLAPIENTRY
3332 save_LoadName(GLuint name)
3333 {
3334 GET_CURRENT_CONTEXT(ctx);
3335 Node *n;
3336 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3337 n = alloc_instruction(ctx, OPCODE_LOAD_NAME, 1);
3338 if (n) {
3339 n[1].ui = name;
3340 }
3341 if (ctx->ExecuteFlag) {
3342 CALL_LoadName(ctx->Exec, (name));
3343 }
3344 }
3345
3346
3347 static void GLAPIENTRY
3348 save_LogicOp(GLenum opcode)
3349 {
3350 GET_CURRENT_CONTEXT(ctx);
3351 Node *n;
3352 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3353 n = alloc_instruction(ctx, OPCODE_LOGIC_OP, 1);
3354 if (n) {
3355 n[1].e = opcode;
3356 }
3357 if (ctx->ExecuteFlag) {
3358 CALL_LogicOp(ctx->Exec, (opcode));
3359 }
3360 }
3361
3362
3363 static void GLAPIENTRY
3364 save_Map1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride,
3365 GLint order, const GLdouble * points)
3366 {
3367 GET_CURRENT_CONTEXT(ctx);
3368 Node *n;
3369 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3370 n = alloc_instruction(ctx, OPCODE_MAP1, 5 + POINTER_DWORDS);
3371 if (n) {
3372 GLfloat *pnts = _mesa_copy_map_points1d(target, stride, order, points);
3373 n[1].e = target;
3374 n[2].f = (GLfloat) u1;
3375 n[3].f = (GLfloat) u2;
3376 n[4].i = _mesa_evaluator_components(target); /* stride */
3377 n[5].i = order;
3378 save_pointer(&n[6], pnts);
3379 }
3380 if (ctx->ExecuteFlag) {
3381 CALL_Map1d(ctx->Exec, (target, u1, u2, stride, order, points));
3382 }
3383 }
3384
3385 static void GLAPIENTRY
3386 save_Map1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride,
3387 GLint order, const GLfloat * points)
3388 {
3389 GET_CURRENT_CONTEXT(ctx);
3390 Node *n;
3391 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3392 n = alloc_instruction(ctx, OPCODE_MAP1, 5 + POINTER_DWORDS);
3393 if (n) {
3394 GLfloat *pnts = _mesa_copy_map_points1f(target, stride, order, points);
3395 n[1].e = target;
3396 n[2].f = u1;
3397 n[3].f = u2;
3398 n[4].i = _mesa_evaluator_components(target); /* stride */
3399 n[5].i = order;
3400 save_pointer(&n[6], pnts);
3401 }
3402 if (ctx->ExecuteFlag) {
3403 CALL_Map1f(ctx->Exec, (target, u1, u2, stride, order, points));
3404 }
3405 }
3406
3407
3408 static void GLAPIENTRY
3409 save_Map2d(GLenum target,
3410 GLdouble u1, GLdouble u2, GLint ustride, GLint uorder,
3411 GLdouble v1, GLdouble v2, GLint vstride, GLint vorder,
3412 const GLdouble * points)
3413 {
3414 GET_CURRENT_CONTEXT(ctx);
3415 Node *n;
3416 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3417 n = alloc_instruction(ctx, OPCODE_MAP2, 9 + POINTER_DWORDS);
3418 if (n) {
3419 GLfloat *pnts = _mesa_copy_map_points2d(target, ustride, uorder,
3420 vstride, vorder, points);
3421 n[1].e = target;
3422 n[2].f = (GLfloat) u1;
3423 n[3].f = (GLfloat) u2;
3424 n[4].f = (GLfloat) v1;
3425 n[5].f = (GLfloat) v2;
3426 /* XXX verify these strides are correct */
3427 n[6].i = _mesa_evaluator_components(target) * vorder; /*ustride */
3428 n[7].i = _mesa_evaluator_components(target); /*vstride */
3429 n[8].i = uorder;
3430 n[9].i = vorder;
3431 save_pointer(&n[10], pnts);
3432 }
3433 if (ctx->ExecuteFlag) {
3434 CALL_Map2d(ctx->Exec, (target,
3435 u1, u2, ustride, uorder,
3436 v1, v2, vstride, vorder, points));
3437 }
3438 }
3439
3440
3441 static void GLAPIENTRY
3442 save_Map2f(GLenum target,
3443 GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
3444 GLfloat v1, GLfloat v2, GLint vstride, GLint vorder,
3445 const GLfloat * points)
3446 {
3447 GET_CURRENT_CONTEXT(ctx);
3448 Node *n;
3449 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3450 n = alloc_instruction(ctx, OPCODE_MAP2, 9 + POINTER_DWORDS);
3451 if (n) {
3452 GLfloat *pnts = _mesa_copy_map_points2f(target, ustride, uorder,
3453 vstride, vorder, points);
3454 n[1].e = target;
3455 n[2].f = u1;
3456 n[3].f = u2;
3457 n[4].f = v1;
3458 n[5].f = v2;
3459 /* XXX verify these strides are correct */
3460 n[6].i = _mesa_evaluator_components(target) * vorder; /*ustride */
3461 n[7].i = _mesa_evaluator_components(target); /*vstride */
3462 n[8].i = uorder;
3463 n[9].i = vorder;
3464 save_pointer(&n[10], pnts);
3465 }
3466 if (ctx->ExecuteFlag) {
3467 CALL_Map2f(ctx->Exec, (target, u1, u2, ustride, uorder,
3468 v1, v2, vstride, vorder, points));
3469 }
3470 }
3471
3472
3473 static void GLAPIENTRY
3474 save_MapGrid1f(GLint un, GLfloat u1, GLfloat u2)
3475 {
3476 GET_CURRENT_CONTEXT(ctx);
3477 Node *n;
3478 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3479 n = alloc_instruction(ctx, OPCODE_MAPGRID1, 3);
3480 if (n) {
3481 n[1].i = un;
3482 n[2].f = u1;
3483 n[3].f = u2;
3484 }
3485 if (ctx->ExecuteFlag) {
3486 CALL_MapGrid1f(ctx->Exec, (un, u1, u2));
3487 }
3488 }
3489
3490
3491 static void GLAPIENTRY
3492 save_MapGrid1d(GLint un, GLdouble u1, GLdouble u2)
3493 {
3494 save_MapGrid1f(un, (GLfloat) u1, (GLfloat) u2);
3495 }
3496
3497
3498 static void GLAPIENTRY
3499 save_MapGrid2f(GLint un, GLfloat u1, GLfloat u2,
3500 GLint vn, GLfloat v1, GLfloat v2)
3501 {
3502 GET_CURRENT_CONTEXT(ctx);
3503 Node *n;
3504 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3505 n = alloc_instruction(ctx, OPCODE_MAPGRID2, 6);
3506 if (n) {
3507 n[1].i = un;
3508 n[2].f = u1;
3509 n[3].f = u2;
3510 n[4].i = vn;
3511 n[5].f = v1;
3512 n[6].f = v2;
3513 }
3514 if (ctx->ExecuteFlag) {
3515 CALL_MapGrid2f(ctx->Exec, (un, u1, u2, vn, v1, v2));
3516 }
3517 }
3518
3519
3520
3521 static void GLAPIENTRY
3522 save_MapGrid2d(GLint un, GLdouble u1, GLdouble u2,
3523 GLint vn, GLdouble v1, GLdouble v2)
3524 {
3525 save_MapGrid2f(un, (GLfloat) u1, (GLfloat) u2,
3526 vn, (GLfloat) v1, (GLfloat) v2);
3527 }
3528
3529
3530 static void GLAPIENTRY
3531 save_MatrixMode(GLenum mode)
3532 {
3533 GET_CURRENT_CONTEXT(ctx);
3534 Node *n;
3535 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3536 n = alloc_instruction(ctx, OPCODE_MATRIX_MODE, 1);
3537 if (n) {
3538 n[1].e = mode;
3539 }
3540 if (ctx->ExecuteFlag) {
3541 CALL_MatrixMode(ctx->Exec, (mode));
3542 }
3543 }
3544
3545
3546 static void GLAPIENTRY
3547 save_MultMatrixf(const GLfloat * m)
3548 {
3549 GET_CURRENT_CONTEXT(ctx);
3550 Node *n;
3551 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3552 n = alloc_instruction(ctx, OPCODE_MULT_MATRIX, 16);
3553 if (n) {
3554 GLuint i;
3555 for (i = 0; i < 16; i++) {
3556 n[1 + i].f = m[i];
3557 }
3558 }
3559 if (ctx->ExecuteFlag) {
3560 CALL_MultMatrixf(ctx->Exec, (m));
3561 }
3562 }
3563
3564
3565 static void GLAPIENTRY
3566 save_MultMatrixd(const GLdouble * m)
3567 {
3568 GLfloat f[16];
3569 GLint i;
3570 for (i = 0; i < 16; i++) {
3571 f[i] = (GLfloat) m[i];
3572 }
3573 save_MultMatrixf(f);
3574 }
3575
3576
3577 static void GLAPIENTRY
3578 save_NewList(GLuint name, GLenum mode)
3579 {
3580 GET_CURRENT_CONTEXT(ctx);
3581 /* It's an error to call this function while building a display list */
3582 _mesa_error(ctx, GL_INVALID_OPERATION, "glNewList");
3583 (void) name;
3584 (void) mode;
3585 }
3586
3587
3588
3589 static void GLAPIENTRY
3590 save_Ortho(GLdouble left, GLdouble right,
3591 GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval)
3592 {
3593 GET_CURRENT_CONTEXT(ctx);
3594 Node *n;
3595 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3596 n = alloc_instruction(ctx, OPCODE_ORTHO, 6);
3597 if (n) {
3598 n[1].f = (GLfloat) left;
3599 n[2].f = (GLfloat) right;
3600 n[3].f = (GLfloat) bottom;
3601 n[4].f = (GLfloat) top;
3602 n[5].f = (GLfloat) nearval;
3603 n[6].f = (GLfloat) farval;
3604 }
3605 if (ctx->ExecuteFlag) {
3606 CALL_Ortho(ctx->Exec, (left, right, bottom, top, nearval, farval));
3607 }
3608 }
3609
3610
3611 static void GLAPIENTRY
3612 save_PatchParameteri(GLenum pname, const GLint value)
3613 {
3614 GET_CURRENT_CONTEXT(ctx);
3615 Node *n;
3616 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3617 n = alloc_instruction(ctx, OPCODE_PATCH_PARAMETER_I, 2);
3618 if (n) {
3619 n[1].e = pname;
3620 n[2].i = value;
3621 }
3622 if (ctx->ExecuteFlag) {
3623 CALL_PatchParameteri(ctx->Exec, (pname, value));
3624 }
3625 }
3626
3627
3628 static void GLAPIENTRY
3629 save_PatchParameterfv(GLenum pname, const GLfloat *params)
3630 {
3631 GET_CURRENT_CONTEXT(ctx);
3632 Node *n;
3633 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3634
3635 if (pname == GL_PATCH_DEFAULT_OUTER_LEVEL) {
3636 n = alloc_instruction(ctx, OPCODE_PATCH_PARAMETER_FV_OUTER, 5);
3637 } else {
3638 assert(pname == GL_PATCH_DEFAULT_INNER_LEVEL);
3639 n = alloc_instruction(ctx, OPCODE_PATCH_PARAMETER_FV_INNER, 3);
3640 }
3641 if (n) {
3642 n[1].e = pname;
3643 if (pname == GL_PATCH_DEFAULT_OUTER_LEVEL) {
3644 n[2].f = params[0];
3645 n[3].f = params[1];
3646 n[4].f = params[2];
3647 n[5].f = params[3];
3648 } else {
3649 n[2].f = params[0];
3650 n[3].f = params[1];
3651 }
3652 }
3653 if (ctx->ExecuteFlag) {
3654 CALL_PatchParameterfv(ctx->Exec, (pname, params));
3655 }
3656 }
3657
3658
3659 static void GLAPIENTRY
3660 save_PixelMapfv(GLenum map, GLint mapsize, const GLfloat *values)
3661 {
3662 GET_CURRENT_CONTEXT(ctx);
3663 Node *n;
3664 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3665 n = alloc_instruction(ctx, OPCODE_PIXEL_MAP, 2 + POINTER_DWORDS);
3666 if (n) {
3667 n[1].e = map;
3668 n[2].i = mapsize;
3669 save_pointer(&n[3], memdup(values, mapsize * sizeof(GLfloat)));
3670 }
3671 if (ctx->ExecuteFlag) {
3672 CALL_PixelMapfv(ctx->Exec, (map, mapsize, values));
3673 }
3674 }
3675
3676
3677 static void GLAPIENTRY
3678 save_PixelMapuiv(GLenum map, GLint mapsize, const GLuint *values)
3679 {
3680 GLfloat fvalues[MAX_PIXEL_MAP_TABLE];
3681 GLint i;
3682 if (map == GL_PIXEL_MAP_I_TO_I || map == GL_PIXEL_MAP_S_TO_S) {
3683 for (i = 0; i < mapsize; i++) {
3684 fvalues[i] = (GLfloat) values[i];
3685 }
3686 }
3687 else {
3688 for (i = 0; i < mapsize; i++) {
3689 fvalues[i] = UINT_TO_FLOAT(values[i]);
3690 }
3691 }
3692 save_PixelMapfv(map, mapsize, fvalues);
3693 }
3694
3695
3696 static void GLAPIENTRY
3697 save_PixelMapusv(GLenum map, GLint mapsize, const GLushort *values)
3698 {
3699 GLfloat fvalues[MAX_PIXEL_MAP_TABLE];
3700 GLint i;
3701 if (map == GL_PIXEL_MAP_I_TO_I || map == GL_PIXEL_MAP_S_TO_S) {
3702 for (i = 0; i < mapsize; i++) {
3703 fvalues[i] = (GLfloat) values[i];
3704 }
3705 }
3706 else {
3707 for (i = 0; i < mapsize; i++) {
3708 fvalues[i] = USHORT_TO_FLOAT(values[i]);
3709 }
3710 }
3711 save_PixelMapfv(map, mapsize, fvalues);
3712 }
3713
3714
3715 static void GLAPIENTRY
3716 save_PixelTransferf(GLenum pname, GLfloat param)
3717 {
3718 GET_CURRENT_CONTEXT(ctx);
3719 Node *n;
3720 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3721 n = alloc_instruction(ctx, OPCODE_PIXEL_TRANSFER, 2);
3722 if (n) {
3723 n[1].e = pname;
3724 n[2].f = param;
3725 }
3726 if (ctx->ExecuteFlag) {
3727 CALL_PixelTransferf(ctx->Exec, (pname, param));
3728 }
3729 }
3730
3731
3732 static void GLAPIENTRY
3733 save_PixelTransferi(GLenum pname, GLint param)
3734 {
3735 save_PixelTransferf(pname, (GLfloat) param);
3736 }
3737
3738
3739 static void GLAPIENTRY
3740 save_PixelZoom(GLfloat xfactor, GLfloat yfactor)
3741 {
3742 GET_CURRENT_CONTEXT(ctx);
3743 Node *n;
3744 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3745 n = alloc_instruction(ctx, OPCODE_PIXEL_ZOOM, 2);
3746 if (n) {
3747 n[1].f = xfactor;
3748 n[2].f = yfactor;
3749 }
3750 if (ctx->ExecuteFlag) {
3751 CALL_PixelZoom(ctx->Exec, (xfactor, yfactor));
3752 }
3753 }
3754
3755
3756 static void GLAPIENTRY
3757 save_PointParameterfvEXT(GLenum pname, const GLfloat *params)
3758 {
3759 GET_CURRENT_CONTEXT(ctx);
3760 Node *n;
3761 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3762 n = alloc_instruction(ctx, OPCODE_POINT_PARAMETERS, 4);
3763 if (n) {
3764 n[1].e = pname;
3765 n[2].f = params[0];
3766 n[3].f = params[1];
3767 n[4].f = params[2];
3768 }
3769 if (ctx->ExecuteFlag) {
3770 CALL_PointParameterfv(ctx->Exec, (pname, params));
3771 }
3772 }
3773
3774
3775 static void GLAPIENTRY
3776 save_PointParameterfEXT(GLenum pname, GLfloat param)
3777 {
3778 GLfloat parray[3];
3779 parray[0] = param;
3780 parray[1] = parray[2] = 0.0F;
3781 save_PointParameterfvEXT(pname, parray);
3782 }
3783
3784 static void GLAPIENTRY
3785 save_PointParameteriNV(GLenum pname, GLint param)
3786 {
3787 GLfloat parray[3];
3788 parray[0] = (GLfloat) param;
3789 parray[1] = parray[2] = 0.0F;
3790 save_PointParameterfvEXT(pname, parray);
3791 }
3792
3793 static void GLAPIENTRY
3794 save_PointParameterivNV(GLenum pname, const GLint * param)
3795 {
3796 GLfloat parray[3];
3797 parray[0] = (GLfloat) param[0];
3798 parray[1] = parray[2] = 0.0F;
3799 save_PointParameterfvEXT(pname, parray);
3800 }
3801
3802
3803 static void GLAPIENTRY
3804 save_PointSize(GLfloat size)
3805 {
3806 GET_CURRENT_CONTEXT(ctx);
3807 Node *n;
3808 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3809 n = alloc_instruction(ctx, OPCODE_POINT_SIZE, 1);
3810 if (n) {
3811 n[1].f = size;
3812 }
3813 if (ctx->ExecuteFlag) {
3814 CALL_PointSize(ctx->Exec, (size));
3815 }
3816 }
3817
3818
3819 static void GLAPIENTRY
3820 save_PolygonMode(GLenum face, GLenum mode)
3821 {
3822 GET_CURRENT_CONTEXT(ctx);
3823 Node *n;
3824 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3825 n = alloc_instruction(ctx, OPCODE_POLYGON_MODE, 2);
3826 if (n) {
3827 n[1].e = face;
3828 n[2].e = mode;
3829 }
3830 if (ctx->ExecuteFlag) {
3831 CALL_PolygonMode(ctx->Exec, (face, mode));
3832 }
3833 }
3834
3835
3836 static void GLAPIENTRY
3837 save_PolygonStipple(const GLubyte * pattern)
3838 {
3839 GET_CURRENT_CONTEXT(ctx);
3840 Node *n;
3841
3842 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3843
3844 n = alloc_instruction(ctx, OPCODE_POLYGON_STIPPLE, POINTER_DWORDS);
3845 if (n) {
3846 save_pointer(&n[1],
3847 unpack_image(ctx, 2, 32, 32, 1, GL_COLOR_INDEX, GL_BITMAP,
3848 pattern, &ctx->Unpack));
3849 }
3850 if (ctx->ExecuteFlag) {
3851 CALL_PolygonStipple(ctx->Exec, ((GLubyte *) pattern));
3852 }
3853 }
3854
3855
3856 static void GLAPIENTRY
3857 save_PolygonOffset(GLfloat factor, GLfloat units)
3858 {
3859 GET_CURRENT_CONTEXT(ctx);
3860 Node *n;
3861 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3862 n = alloc_instruction(ctx, OPCODE_POLYGON_OFFSET, 2);
3863 if (n) {
3864 n[1].f = factor;
3865 n[2].f = units;
3866 }
3867 if (ctx->ExecuteFlag) {
3868 CALL_PolygonOffset(ctx->Exec, (factor, units));
3869 }
3870 }
3871
3872
3873 static void GLAPIENTRY
3874 save_PolygonOffsetClampEXT(GLfloat factor, GLfloat units, GLfloat clamp)
3875 {
3876 GET_CURRENT_CONTEXT(ctx);
3877 Node *n;
3878 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3879 n = alloc_instruction(ctx, OPCODE_POLYGON_OFFSET_CLAMP, 3);
3880 if (n) {
3881 n[1].f = factor;
3882 n[2].f = units;
3883 n[3].f = clamp;
3884 }
3885 if (ctx->ExecuteFlag) {
3886 CALL_PolygonOffsetClampEXT(ctx->Exec, (factor, units, clamp));
3887 }
3888 }
3889
3890 static void GLAPIENTRY
3891 save_PopAttrib(void)
3892 {
3893 GET_CURRENT_CONTEXT(ctx);
3894 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3895 (void) alloc_instruction(ctx, OPCODE_POP_ATTRIB, 0);
3896 if (ctx->ExecuteFlag) {
3897 CALL_PopAttrib(ctx->Exec, ());
3898 }
3899 }
3900
3901
3902 static void GLAPIENTRY
3903 save_PopMatrix(void)
3904 {
3905 GET_CURRENT_CONTEXT(ctx);
3906 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3907 (void) alloc_instruction(ctx, OPCODE_POP_MATRIX, 0);
3908 if (ctx->ExecuteFlag) {
3909 CALL_PopMatrix(ctx->Exec, ());
3910 }
3911 }
3912
3913
3914 static void GLAPIENTRY
3915 save_PopName(void)
3916 {
3917 GET_CURRENT_CONTEXT(ctx);
3918 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3919 (void) alloc_instruction(ctx, OPCODE_POP_NAME, 0);
3920 if (ctx->ExecuteFlag) {
3921 CALL_PopName(ctx->Exec, ());
3922 }
3923 }
3924
3925
3926 static void GLAPIENTRY
3927 save_PrioritizeTextures(GLsizei num, const GLuint * textures,
3928 const GLclampf * priorities)
3929 {
3930 GET_CURRENT_CONTEXT(ctx);
3931 GLint i;
3932 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3933
3934 for (i = 0; i < num; i++) {
3935 Node *n;
3936 n = alloc_instruction(ctx, OPCODE_PRIORITIZE_TEXTURE, 2);
3937 if (n) {
3938 n[1].ui = textures[i];
3939 n[2].f = priorities[i];
3940 }
3941 }
3942 if (ctx->ExecuteFlag) {
3943 CALL_PrioritizeTextures(ctx->Exec, (num, textures, priorities));
3944 }
3945 }
3946
3947
3948 static void GLAPIENTRY
3949 save_PushAttrib(GLbitfield mask)
3950 {
3951 GET_CURRENT_CONTEXT(ctx);
3952 Node *n;
3953 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3954 n = alloc_instruction(ctx, OPCODE_PUSH_ATTRIB, 1);
3955 if (n) {
3956 n[1].bf = mask;
3957 }
3958 if (ctx->ExecuteFlag) {
3959 CALL_PushAttrib(ctx->Exec, (mask));
3960 }
3961 }
3962
3963
3964 static void GLAPIENTRY
3965 save_PushMatrix(void)
3966 {
3967 GET_CURRENT_CONTEXT(ctx);
3968 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3969 (void) alloc_instruction(ctx, OPCODE_PUSH_MATRIX, 0);
3970 if (ctx->ExecuteFlag) {
3971 CALL_PushMatrix(ctx->Exec, ());
3972 }
3973 }
3974
3975
3976 static void GLAPIENTRY
3977 save_PushName(GLuint name)
3978 {
3979 GET_CURRENT_CONTEXT(ctx);
3980 Node *n;
3981 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3982 n = alloc_instruction(ctx, OPCODE_PUSH_NAME, 1);
3983 if (n) {
3984 n[1].ui = name;
3985 }
3986 if (ctx->ExecuteFlag) {
3987 CALL_PushName(ctx->Exec, (name));
3988 }
3989 }
3990
3991
3992 static void GLAPIENTRY
3993 save_RasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
3994 {
3995 GET_CURRENT_CONTEXT(ctx);
3996 Node *n;
3997 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3998 n = alloc_instruction(ctx, OPCODE_RASTER_POS, 4);
3999 if (n) {
4000 n[1].f = x;
4001 n[2].f = y;
4002 n[3].f = z;
4003 n[4].f = w;
4004 }
4005 if (ctx->ExecuteFlag) {
4006 CALL_RasterPos4f(ctx->Exec, (x, y, z, w));
4007 }
4008 }
4009
4010 static void GLAPIENTRY
4011 save_RasterPos2d(GLdouble x, GLdouble y)
4012 {
4013 save_RasterPos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
4014 }
4015
4016 static void GLAPIENTRY
4017 save_RasterPos2f(GLfloat x, GLfloat y)
4018 {
4019 save_RasterPos4f(x, y, 0.0F, 1.0F);
4020 }
4021
4022 static void GLAPIENTRY
4023 save_RasterPos2i(GLint x, GLint y)
4024 {
4025 save_RasterPos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
4026 }
4027
4028 static void GLAPIENTRY
4029 save_RasterPos2s(GLshort x, GLshort y)
4030 {
4031 save_RasterPos4f(x, y, 0.0F, 1.0F);
4032 }
4033
4034 static void GLAPIENTRY
4035 save_RasterPos3d(GLdouble x, GLdouble y, GLdouble z)
4036 {
4037 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
4038 }
4039
4040 static void GLAPIENTRY
4041 save_RasterPos3f(GLfloat x, GLfloat y, GLfloat z)
4042 {
4043 save_RasterPos4f(x, y, z, 1.0F);
4044 }
4045
4046 static void GLAPIENTRY
4047 save_RasterPos3i(GLint x, GLint y, GLint z)
4048 {
4049 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
4050 }
4051
4052 static void GLAPIENTRY
4053 save_RasterPos3s(GLshort x, GLshort y, GLshort z)
4054 {
4055 save_RasterPos4f(x, y, z, 1.0F);
4056 }
4057
4058 static void GLAPIENTRY
4059 save_RasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
4060 {
4061 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
4062 }
4063
4064 static void GLAPIENTRY
4065 save_RasterPos4i(GLint x, GLint y, GLint z, GLint w)
4066 {
4067 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
4068 }
4069
4070 static void GLAPIENTRY
4071 save_RasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w)
4072 {
4073 save_RasterPos4f(x, y, z, w);
4074 }
4075
4076 static void GLAPIENTRY
4077 save_RasterPos2dv(const GLdouble * v)
4078 {
4079 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
4080 }
4081
4082 static void GLAPIENTRY
4083 save_RasterPos2fv(const GLfloat * v)
4084 {
4085 save_RasterPos4f(v[0], v[1], 0.0F, 1.0F);
4086 }
4087
4088 static void GLAPIENTRY
4089 save_RasterPos2iv(const GLint * v)
4090 {
4091 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
4092 }
4093
4094 static void GLAPIENTRY
4095 save_RasterPos2sv(const GLshort * v)
4096 {
4097 save_RasterPos4f(v[0], v[1], 0.0F, 1.0F);
4098 }
4099
4100 static void GLAPIENTRY
4101 save_RasterPos3dv(const GLdouble * v)
4102 {
4103 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
4104 }
4105
4106 static void GLAPIENTRY
4107 save_RasterPos3fv(const GLfloat * v)
4108 {
4109 save_RasterPos4f(v[0], v[1], v[2], 1.0F);
4110 }
4111
4112 static void GLAPIENTRY
4113 save_RasterPos3iv(const GLint * v)
4114 {
4115 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
4116 }
4117
4118 static void GLAPIENTRY
4119 save_RasterPos3sv(const GLshort * v)
4120 {
4121 save_RasterPos4f(v[0], v[1], v[2], 1.0F);
4122 }
4123
4124 static void GLAPIENTRY
4125 save_RasterPos4dv(const GLdouble * v)
4126 {
4127 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1],
4128 (GLfloat) v[2], (GLfloat) v[3]);
4129 }
4130
4131 static void GLAPIENTRY
4132 save_RasterPos4fv(const GLfloat * v)
4133 {
4134 save_RasterPos4f(v[0], v[1], v[2], v[3]);
4135 }
4136
4137 static void GLAPIENTRY
4138 save_RasterPos4iv(const GLint * v)
4139 {
4140 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1],
4141 (GLfloat) v[2], (GLfloat) v[3]);
4142 }
4143
4144 static void GLAPIENTRY
4145 save_RasterPos4sv(const GLshort * v)
4146 {
4147 save_RasterPos4f(v[0], v[1], v[2], v[3]);
4148 }
4149
4150
4151 static void GLAPIENTRY
4152 save_PassThrough(GLfloat token)
4153 {
4154 GET_CURRENT_CONTEXT(ctx);
4155 Node *n;
4156 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4157 n = alloc_instruction(ctx, OPCODE_PASSTHROUGH, 1);
4158 if (n) {
4159 n[1].f = token;
4160 }
4161 if (ctx->ExecuteFlag) {
4162 CALL_PassThrough(ctx->Exec, (token));
4163 }
4164 }
4165
4166
4167 static void GLAPIENTRY
4168 save_ReadBuffer(GLenum mode)
4169 {
4170 GET_CURRENT_CONTEXT(ctx);
4171 Node *n;
4172 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4173 n = alloc_instruction(ctx, OPCODE_READ_BUFFER, 1);
4174 if (n) {
4175 n[1].e = mode;
4176 }
4177 if (ctx->ExecuteFlag) {
4178 CALL_ReadBuffer(ctx->Exec, (mode));
4179 }
4180 }
4181
4182
4183 static void GLAPIENTRY
4184 save_Rotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
4185 {
4186 GET_CURRENT_CONTEXT(ctx);
4187 Node *n;
4188 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4189 n = alloc_instruction(ctx, OPCODE_ROTATE, 4);
4190 if (n) {
4191 n[1].f = angle;
4192 n[2].f = x;
4193 n[3].f = y;
4194 n[4].f = z;
4195 }
4196 if (ctx->ExecuteFlag) {
4197 CALL_Rotatef(ctx->Exec, (angle, x, y, z));
4198 }
4199 }
4200
4201
4202 static void GLAPIENTRY
4203 save_Rotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
4204 {
4205 save_Rotatef((GLfloat) angle, (GLfloat) x, (GLfloat) y, (GLfloat) z);
4206 }
4207
4208
4209 static void GLAPIENTRY
4210 save_Scalef(GLfloat x, GLfloat y, GLfloat z)
4211 {
4212 GET_CURRENT_CONTEXT(ctx);
4213 Node *n;
4214 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4215 n = alloc_instruction(ctx, OPCODE_SCALE, 3);
4216 if (n) {
4217 n[1].f = x;
4218 n[2].f = y;
4219 n[3].f = z;
4220 }
4221 if (ctx->ExecuteFlag) {
4222 CALL_Scalef(ctx->Exec, (x, y, z));
4223 }
4224 }
4225
4226
4227 static void GLAPIENTRY
4228 save_Scaled(GLdouble x, GLdouble y, GLdouble z)
4229 {
4230 save_Scalef((GLfloat) x, (GLfloat) y, (GLfloat) z);
4231 }
4232
4233
4234 static void GLAPIENTRY
4235 save_Scissor(GLint x, GLint y, GLsizei width, GLsizei height)
4236 {
4237 GET_CURRENT_CONTEXT(ctx);
4238 Node *n;
4239 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4240 n = alloc_instruction(ctx, OPCODE_SCISSOR, 4);
4241 if (n) {
4242 n[1].i = x;
4243 n[2].i = y;
4244 n[3].i = width;
4245 n[4].i = height;
4246 }
4247 if (ctx->ExecuteFlag) {
4248 CALL_Scissor(ctx->Exec, (x, y, width, height));
4249 }
4250 }
4251
4252
4253 static void GLAPIENTRY
4254 save_ShadeModel(GLenum mode)
4255 {
4256 GET_CURRENT_CONTEXT(ctx);
4257 Node *n;
4258 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx);
4259
4260 if (ctx->ExecuteFlag) {
4261 CALL_ShadeModel(ctx->Exec, (mode));
4262 }
4263
4264 /* Don't compile this call if it's a no-op.
4265 * By avoiding this state change we have a better chance of
4266 * coalescing subsequent drawing commands into one batch.
4267 */
4268 if (ctx->ListState.Current.ShadeModel == mode)
4269 return;
4270
4271 SAVE_FLUSH_VERTICES(ctx);
4272
4273 ctx->ListState.Current.ShadeModel = mode;
4274
4275 n = alloc_instruction(ctx, OPCODE_SHADE_MODEL, 1);
4276 if (n) {
4277 n[1].e = mode;
4278 }
4279 }
4280
4281
4282 static void GLAPIENTRY
4283 save_StencilFunc(GLenum func, GLint ref, GLuint mask)
4284 {
4285 GET_CURRENT_CONTEXT(ctx);
4286 Node *n;
4287 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4288 n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC, 3);
4289 if (n) {
4290 n[1].e = func;
4291 n[2].i = ref;
4292 n[3].ui = mask;
4293 }
4294 if (ctx->ExecuteFlag) {
4295 CALL_StencilFunc(ctx->Exec, (func, ref, mask));
4296 }
4297 }
4298
4299
4300 static void GLAPIENTRY
4301 save_StencilMask(GLuint mask)
4302 {
4303 GET_CURRENT_CONTEXT(ctx);
4304 Node *n;
4305 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4306 n = alloc_instruction(ctx, OPCODE_STENCIL_MASK, 1);
4307 if (n) {
4308 n[1].ui = mask;
4309 }
4310 if (ctx->ExecuteFlag) {
4311 CALL_StencilMask(ctx->Exec, (mask));
4312 }
4313 }
4314
4315
4316 static void GLAPIENTRY
4317 save_StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
4318 {
4319 GET_CURRENT_CONTEXT(ctx);
4320 Node *n;
4321 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4322 n = alloc_instruction(ctx, OPCODE_STENCIL_OP, 3);
4323 if (n) {
4324 n[1].e = fail;
4325 n[2].e = zfail;
4326 n[3].e = zpass;
4327 }
4328 if (ctx->ExecuteFlag) {
4329 CALL_StencilOp(ctx->Exec, (fail, zfail, zpass));
4330 }
4331 }
4332
4333
4334 static void GLAPIENTRY
4335 save_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
4336 {
4337 GET_CURRENT_CONTEXT(ctx);
4338 Node *n;
4339 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4340 n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4);
4341 if (n) {
4342 n[1].e = face;
4343 n[2].e = func;
4344 n[3].i = ref;
4345 n[4].ui = mask;
4346 }
4347 if (ctx->ExecuteFlag) {
4348 CALL_StencilFuncSeparate(ctx->Exec, (face, func, ref, mask));
4349 }
4350 }
4351
4352
4353 static void GLAPIENTRY
4354 save_StencilFuncSeparateATI(GLenum frontfunc, GLenum backfunc, GLint ref,
4355 GLuint mask)
4356 {
4357 GET_CURRENT_CONTEXT(ctx);
4358 Node *n;
4359 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4360 /* GL_FRONT */
4361 n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4);
4362 if (n) {
4363 n[1].e = GL_FRONT;
4364 n[2].e = frontfunc;
4365 n[3].i = ref;
4366 n[4].ui = mask;
4367 }
4368 /* GL_BACK */
4369 n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4);
4370 if (n) {
4371 n[1].e = GL_BACK;
4372 n[2].e = backfunc;
4373 n[3].i = ref;
4374 n[4].ui = mask;
4375 }
4376 if (ctx->ExecuteFlag) {
4377 CALL_StencilFuncSeparate(ctx->Exec, (GL_FRONT, frontfunc, ref, mask));
4378 CALL_StencilFuncSeparate(ctx->Exec, (GL_BACK, backfunc, ref, mask));
4379 }
4380 }
4381
4382
4383 static void GLAPIENTRY
4384 save_StencilMaskSeparate(GLenum face, GLuint mask)
4385 {
4386 GET_CURRENT_CONTEXT(ctx);
4387 Node *n;
4388 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4389 n = alloc_instruction(ctx, OPCODE_STENCIL_MASK_SEPARATE, 2);
4390 if (n) {
4391 n[1].e = face;
4392 n[2].ui = mask;
4393 }
4394 if (ctx->ExecuteFlag) {
4395 CALL_StencilMaskSeparate(ctx->Exec, (face, mask));
4396 }
4397 }
4398
4399
4400 static void GLAPIENTRY
4401 save_StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
4402 {
4403 GET_CURRENT_CONTEXT(ctx);
4404 Node *n;
4405 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4406 n = alloc_instruction(ctx, OPCODE_STENCIL_OP_SEPARATE, 4);
4407 if (n) {
4408 n[1].e = face;
4409 n[2].e = fail;
4410 n[3].e = zfail;
4411 n[4].e = zpass;
4412 }
4413 if (ctx->ExecuteFlag) {
4414 CALL_StencilOpSeparate(ctx->Exec, (face, fail, zfail, zpass));
4415 }
4416 }
4417
4418
4419 static void GLAPIENTRY
4420 save_TexEnvfv(GLenum target, GLenum pname, const GLfloat *params)
4421 {
4422 GET_CURRENT_CONTEXT(ctx);
4423 Node *n;
4424 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4425 n = alloc_instruction(ctx, OPCODE_TEXENV, 6);
4426 if (n) {
4427 n[1].e = target;
4428 n[2].e = pname;
4429 if (pname == GL_TEXTURE_ENV_COLOR) {
4430 n[3].f = params[0];
4431 n[4].f = params[1];
4432 n[5].f = params[2];
4433 n[6].f = params[3];
4434 }
4435 else {
4436 n[3].f = params[0];
4437 n[4].f = n[5].f = n[6].f = 0.0F;
4438 }
4439 }
4440 if (ctx->ExecuteFlag) {
4441 CALL_TexEnvfv(ctx->Exec, (target, pname, params));
4442 }
4443 }
4444
4445
4446 static void GLAPIENTRY
4447 save_TexEnvf(GLenum target, GLenum pname, GLfloat param)
4448 {
4449 GLfloat parray[4];
4450 parray[0] = (GLfloat) param;
4451 parray[1] = parray[2] = parray[3] = 0.0F;
4452 save_TexEnvfv(target, pname, parray);
4453 }
4454
4455
4456 static void GLAPIENTRY
4457 save_TexEnvi(GLenum target, GLenum pname, GLint param)
4458 {
4459 GLfloat p[4];
4460 p[0] = (GLfloat) param;
4461 p[1] = p[2] = p[3] = 0.0F;
4462 save_TexEnvfv(target, pname, p);
4463 }
4464
4465
4466 static void GLAPIENTRY
4467 save_TexEnviv(GLenum target, GLenum pname, const GLint * param)
4468 {
4469 GLfloat p[4];
4470 if (pname == GL_TEXTURE_ENV_COLOR) {
4471 p[0] = INT_TO_FLOAT(param[0]);
4472 p[1] = INT_TO_FLOAT(param[1]);
4473 p[2] = INT_TO_FLOAT(param[2]);
4474 p[3] = INT_TO_FLOAT(param[3]);
4475 }
4476 else {
4477 p[0] = (GLfloat) param[0];
4478 p[1] = p[2] = p[3] = 0.0F;
4479 }
4480 save_TexEnvfv(target, pname, p);
4481 }
4482
4483
4484 static void GLAPIENTRY
4485 save_TexGenfv(GLenum coord, GLenum pname, const GLfloat *params)
4486 {
4487 GET_CURRENT_CONTEXT(ctx);
4488 Node *n;
4489 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4490 n = alloc_instruction(ctx, OPCODE_TEXGEN, 6);
4491 if (n) {
4492 n[1].e = coord;
4493 n[2].e = pname;
4494 n[3].f = params[0];
4495 n[4].f = params[1];
4496 n[5].f = params[2];
4497 n[6].f = params[3];
4498 }
4499 if (ctx->ExecuteFlag) {
4500 CALL_TexGenfv(ctx->Exec, (coord, pname, params));
4501 }
4502 }
4503
4504
4505 static void GLAPIENTRY
4506 save_TexGeniv(GLenum coord, GLenum pname, const GLint *params)
4507 {
4508 GLfloat p[4];
4509 p[0] = (GLfloat) params[0];
4510 p[1] = (GLfloat) params[1];
4511 p[2] = (GLfloat) params[2];
4512 p[3] = (GLfloat) params[3];
4513 save_TexGenfv(coord, pname, p);
4514 }
4515
4516
4517 static void GLAPIENTRY
4518 save_TexGend(GLenum coord, GLenum pname, GLdouble param)
4519 {
4520 GLfloat parray[4];
4521 parray[0] = (GLfloat) param;
4522 parray[1] = parray[2] = parray[3] = 0.0F;
4523 save_TexGenfv(coord, pname, parray);
4524 }
4525
4526
4527 static void GLAPIENTRY
4528 save_TexGendv(GLenum coord, GLenum pname, const GLdouble *params)
4529 {
4530 GLfloat p[4];
4531 p[0] = (GLfloat) params[0];
4532 p[1] = (GLfloat) params[1];
4533 p[2] = (GLfloat) params[2];
4534 p[3] = (GLfloat) params[3];
4535 save_TexGenfv(coord, pname, p);
4536 }
4537
4538
4539 static void GLAPIENTRY
4540 save_TexGenf(GLenum coord, GLenum pname, GLfloat param)
4541 {
4542 GLfloat parray[4];
4543 parray[0] = param;
4544 parray[1] = parray[2] = parray[3] = 0.0F;
4545 save_TexGenfv(coord, pname, parray);
4546 }
4547
4548
4549 static void GLAPIENTRY
4550 save_TexGeni(GLenum coord, GLenum pname, GLint param)
4551 {
4552 GLint parray[4];
4553 parray[0] = param;
4554 parray[1] = parray[2] = parray[3] = 0;
4555 save_TexGeniv(coord, pname, parray);
4556 }
4557
4558
4559 static void GLAPIENTRY
4560 save_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
4561 {
4562 GET_CURRENT_CONTEXT(ctx);
4563 Node *n;
4564 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4565 n = alloc_instruction(ctx, OPCODE_TEXPARAMETER, 6);
4566 if (n) {
4567 n[1].e = target;
4568 n[2].e = pname;
4569 n[3].f = params[0];
4570 n[4].f = params[1];
4571 n[5].f = params[2];
4572 n[6].f = params[3];
4573 }
4574 if (ctx->ExecuteFlag) {
4575 CALL_TexParameterfv(ctx->Exec, (target, pname, params));
4576 }
4577 }
4578
4579
4580 static void GLAPIENTRY
4581 save_TexParameterf(GLenum target, GLenum pname, GLfloat param)
4582 {
4583 GLfloat parray[4];
4584 parray[0] = param;
4585 parray[1] = parray[2] = parray[3] = 0.0F;
4586 save_TexParameterfv(target, pname, parray);
4587 }
4588
4589
4590 static void GLAPIENTRY
4591 save_TexParameteri(GLenum target, GLenum pname, GLint param)
4592 {
4593 GLfloat fparam[4];
4594 fparam[0] = (GLfloat) param;
4595 fparam[1] = fparam[2] = fparam[3] = 0.0F;
4596 save_TexParameterfv(target, pname, fparam);
4597 }
4598
4599
4600 static void GLAPIENTRY
4601 save_TexParameteriv(GLenum target, GLenum pname, const GLint *params)
4602 {
4603 GLfloat fparam[4];
4604 fparam[0] = (GLfloat) params[0];
4605 fparam[1] = fparam[2] = fparam[3] = 0.0F;
4606 save_TexParameterfv(target, pname, fparam);
4607 }
4608
4609
4610 static void GLAPIENTRY
4611 save_TexImage1D(GLenum target,
4612 GLint level, GLint components,
4613 GLsizei width, GLint border,
4614 GLenum format, GLenum type, const GLvoid * pixels)
4615 {
4616 GET_CURRENT_CONTEXT(ctx);
4617 if (target == GL_PROXY_TEXTURE_1D) {
4618 /* don't compile, execute immediately */
4619 CALL_TexImage1D(ctx->Exec, (target, level, components, width,
4620 border, format, type, pixels));
4621 }
4622 else {
4623 Node *n;
4624 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4625 n = alloc_instruction(ctx, OPCODE_TEX_IMAGE1D, 7 + POINTER_DWORDS);
4626 if (n) {
4627 n[1].e = target;
4628 n[2].i = level;
4629 n[3].i = components;
4630 n[4].i = (GLint) width;
4631 n[5].i = border;
4632 n[6].e = format;
4633 n[7].e = type;
4634 save_pointer(&n[8],
4635 unpack_image(ctx, 1, width, 1, 1, format, type,
4636 pixels, &ctx->Unpack));
4637 }
4638 if (ctx->ExecuteFlag) {
4639 CALL_TexImage1D(ctx->Exec, (target, level, components, width,
4640 border, format, type, pixels));
4641 }
4642 }
4643 }
4644
4645
4646 static void GLAPIENTRY
4647 save_TexImage2D(GLenum target,
4648 GLint level, GLint components,
4649 GLsizei width, GLsizei height, GLint border,
4650 GLenum format, GLenum type, const GLvoid * pixels)
4651 {
4652 GET_CURRENT_CONTEXT(ctx);
4653 if (target == GL_PROXY_TEXTURE_2D) {
4654 /* don't compile, execute immediately */
4655 CALL_TexImage2D(ctx->Exec, (target, level, components, width,
4656 height, border, format, type, pixels));
4657 }
4658 else {
4659 Node *n;
4660 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4661 n = alloc_instruction(ctx, OPCODE_TEX_IMAGE2D, 8 + POINTER_DWORDS);
4662 if (n) {
4663 n[1].e = target;
4664 n[2].i = level;
4665 n[3].i = components;
4666 n[4].i = (GLint) width;
4667 n[5].i = (GLint) height;
4668 n[6].i = border;
4669 n[7].e = format;
4670 n[8].e = type;
4671 save_pointer(&n[9],
4672 unpack_image(ctx, 2, width, height, 1, format, type,
4673 pixels, &ctx->Unpack));
4674 }
4675 if (ctx->ExecuteFlag) {
4676 CALL_TexImage2D(ctx->Exec, (target, level, components, width,
4677 height, border, format, type, pixels));
4678 }
4679 }
4680 }
4681
4682
4683 static void GLAPIENTRY
4684 save_TexImage3D(GLenum target,
4685 GLint level, GLint internalFormat,
4686 GLsizei width, GLsizei height, GLsizei depth,
4687 GLint border,
4688 GLenum format, GLenum type, const GLvoid * pixels)
4689 {
4690 GET_CURRENT_CONTEXT(ctx);
4691 if (target == GL_PROXY_TEXTURE_3D) {
4692 /* don't compile, execute immediately */
4693 CALL_TexImage3D(ctx->Exec, (target, level, internalFormat, width,
4694 height, depth, border, format, type,
4695 pixels));
4696 }
4697 else {
4698 Node *n;
4699 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4700 n = alloc_instruction(ctx, OPCODE_TEX_IMAGE3D, 9 + POINTER_DWORDS);
4701 if (n) {
4702 n[1].e = target;
4703 n[2].i = level;
4704 n[3].i = (GLint) internalFormat;
4705 n[4].i = (GLint) width;
4706 n[5].i = (GLint) height;
4707 n[6].i = (GLint) depth;
4708 n[7].i = border;
4709 n[8].e = format;
4710 n[9].e = type;
4711 save_pointer(&n[10],
4712 unpack_image(ctx, 3, width, height, depth, format, type,
4713 pixels, &ctx->Unpack));
4714 }
4715 if (ctx->ExecuteFlag) {
4716 CALL_TexImage3D(ctx->Exec, (target, level, internalFormat, width,
4717 height, depth, border, format, type,
4718 pixels));
4719 }
4720 }
4721 }
4722
4723
4724 static void GLAPIENTRY
4725 save_TexSubImage1D(GLenum target, GLint level, GLint xoffset,
4726 GLsizei width, GLenum format, GLenum type,
4727 const GLvoid * pixels)
4728 {
4729 GET_CURRENT_CONTEXT(ctx);
4730 Node *n;
4731
4732 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4733
4734 n = alloc_instruction(ctx, OPCODE_TEX_SUB_IMAGE1D, 6 + POINTER_DWORDS);
4735 if (n) {
4736 n[1].e = target;
4737 n[2].i = level;
4738 n[3].i = xoffset;
4739 n[4].i = (GLint) width;
4740 n[5].e = format;
4741 n[6].e = type;
4742 save_pointer(&n[7],
4743 unpack_image(ctx, 1, width, 1, 1, format, type,
4744 pixels, &ctx->Unpack));
4745 }
4746 if (ctx->ExecuteFlag) {
4747 CALL_TexSubImage1D(ctx->Exec, (target, level, xoffset, width,
4748 format, type, pixels));
4749 }
4750 }
4751
4752
4753 static void GLAPIENTRY
4754 save_TexSubImage2D(GLenum target, GLint level,
4755 GLint xoffset, GLint yoffset,
4756 GLsizei width, GLsizei height,
4757 GLenum format, GLenum type, const GLvoid * pixels)
4758 {
4759 GET_CURRENT_CONTEXT(ctx);
4760 Node *n;
4761
4762 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4763
4764 n = alloc_instruction(ctx, OPCODE_TEX_SUB_IMAGE2D, 8 + POINTER_DWORDS);
4765 if (n) {
4766 n[1].e = target;
4767 n[2].i = level;
4768 n[3].i = xoffset;
4769 n[4].i = yoffset;
4770 n[5].i = (GLint) width;
4771 n[6].i = (GLint) height;
4772 n[7].e = format;
4773 n[8].e = type;
4774 save_pointer(&n[9],
4775 unpack_image(ctx, 2, width, height, 1, format, type,
4776 pixels, &ctx->Unpack));
4777 }
4778 if (ctx->ExecuteFlag) {
4779 CALL_TexSubImage2D(ctx->Exec, (target, level, xoffset, yoffset,
4780 width, height, format, type, pixels));
4781 }
4782 }
4783
4784
4785 static void GLAPIENTRY
4786 save_TexSubImage3D(GLenum target, GLint level,
4787 GLint xoffset, GLint yoffset, GLint zoffset,
4788 GLsizei width, GLsizei height, GLsizei depth,
4789 GLenum format, GLenum type, const GLvoid * pixels)
4790 {
4791 GET_CURRENT_CONTEXT(ctx);
4792 Node *n;
4793
4794 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4795
4796 n = alloc_instruction(ctx, OPCODE_TEX_SUB_IMAGE3D, 10 + POINTER_DWORDS);
4797 if (n) {
4798 n[1].e = target;
4799 n[2].i = level;
4800 n[3].i = xoffset;
4801 n[4].i = yoffset;
4802 n[5].i = zoffset;
4803 n[6].i = (GLint) width;
4804 n[7].i = (GLint) height;
4805 n[8].i = (GLint) depth;
4806 n[9].e = format;
4807 n[10].e = type;
4808 save_pointer(&n[11],
4809 unpack_image(ctx, 3, width, height, depth, format, type,
4810 pixels, &ctx->Unpack));
4811 }
4812 if (ctx->ExecuteFlag) {
4813 CALL_TexSubImage3D(ctx->Exec, (target, level,
4814 xoffset, yoffset, zoffset,
4815 width, height, depth, format, type,
4816 pixels));
4817 }
4818 }
4819
4820
4821 static void GLAPIENTRY
4822 save_Translatef(GLfloat x, GLfloat y, GLfloat z)
4823 {
4824 GET_CURRENT_CONTEXT(ctx);
4825 Node *n;
4826 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4827 n = alloc_instruction(ctx, OPCODE_TRANSLATE, 3);
4828 if (n) {
4829 n[1].f = x;
4830 n[2].f = y;
4831 n[3].f = z;
4832 }
4833 if (ctx->ExecuteFlag) {
4834 CALL_Translatef(ctx->Exec, (x, y, z));
4835 }
4836 }
4837
4838
4839 static void GLAPIENTRY
4840 save_Translated(GLdouble x, GLdouble y, GLdouble z)
4841 {
4842 save_Translatef((GLfloat) x, (GLfloat) y, (GLfloat) z);
4843 }
4844
4845
4846
4847 static void GLAPIENTRY
4848 save_Viewport(GLint x, GLint y, GLsizei width, GLsizei height)
4849 {
4850 GET_CURRENT_CONTEXT(ctx);
4851 Node *n;
4852 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4853 n = alloc_instruction(ctx, OPCODE_VIEWPORT, 4);
4854 if (n) {
4855 n[1].i = x;
4856 n[2].i = y;
4857 n[3].i = (GLint) width;
4858 n[4].i = (GLint) height;
4859 }
4860 if (ctx->ExecuteFlag) {
4861 CALL_Viewport(ctx->Exec, (x, y, width, height));
4862 }
4863 }
4864
4865 static void GLAPIENTRY
4866 save_ViewportIndexedf(GLuint index, GLfloat x, GLfloat y, GLfloat width,
4867 GLfloat height)
4868 {
4869 GET_CURRENT_CONTEXT(ctx);
4870 Node *n;
4871 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4872 n = alloc_instruction(ctx, OPCODE_VIEWPORT_INDEXED_F, 5);
4873 if (n) {
4874 n[1].ui = index;
4875 n[2].f = x;
4876 n[3].f = y;
4877 n[4].f = width;
4878 n[5].f = height;
4879 }
4880 if (ctx->ExecuteFlag) {
4881 CALL_ViewportIndexedf(ctx->Exec, (index, x, y, width, height));
4882 }
4883 }
4884
4885 static void GLAPIENTRY
4886 save_ViewportIndexedfv(GLuint index, const GLfloat *v)
4887 {
4888 GET_CURRENT_CONTEXT(ctx);
4889 Node *n;
4890 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4891 n = alloc_instruction(ctx, OPCODE_VIEWPORT_INDEXED_FV, 5);
4892 if (n) {
4893 n[1].ui = index;
4894 n[2].f = v[0];
4895 n[3].f = v[1];
4896 n[4].f = v[2];
4897 n[5].f = v[3];
4898 }
4899 if (ctx->ExecuteFlag) {
4900 CALL_ViewportIndexedfv(ctx->Exec, (index, v));
4901 }
4902 }
4903
4904 static void GLAPIENTRY
4905 save_ViewportArrayv(GLuint first, GLsizei count, const GLfloat *v)
4906 {
4907 GET_CURRENT_CONTEXT(ctx);
4908 Node *n;
4909 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4910 n = alloc_instruction(ctx, OPCODE_VIEWPORT_ARRAY_V, 2 + POINTER_DWORDS);
4911 if (n) {
4912 n[1].ui = first;
4913 n[2].si = count;
4914 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLfloat)));
4915 }
4916 if (ctx->ExecuteFlag) {
4917 CALL_ViewportArrayv(ctx->Exec, (first, count, v));
4918 }
4919 }
4920
4921 static void GLAPIENTRY
4922 save_ScissorIndexed(GLuint index, GLint left, GLint bottom, GLsizei width,
4923 GLsizei height)
4924 {
4925 GET_CURRENT_CONTEXT(ctx);
4926 Node *n;
4927 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4928 n = alloc_instruction(ctx, OPCODE_SCISSOR_INDEXED, 5);
4929 if (n) {
4930 n[1].ui = index;
4931 n[2].i = left;
4932 n[3].i = bottom;
4933 n[4].si = width;
4934 n[5].si = height;
4935 }
4936 if (ctx->ExecuteFlag) {
4937 CALL_ScissorIndexed(ctx->Exec, (index, left, bottom, width, height));
4938 }
4939 }
4940
4941 static void GLAPIENTRY
4942 save_ScissorIndexedv(GLuint index, const GLint *v)
4943 {
4944 GET_CURRENT_CONTEXT(ctx);
4945 Node *n;
4946 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4947 n = alloc_instruction(ctx, OPCODE_SCISSOR_INDEXED_V, 5);
4948 if (n) {
4949 n[1].ui = index;
4950 n[2].i = v[0];
4951 n[3].i = v[1];
4952 n[4].si = v[2];
4953 n[5].si = v[3];
4954 }
4955 if (ctx->ExecuteFlag) {
4956 CALL_ScissorIndexedv(ctx->Exec, (index, v));
4957 }
4958 }
4959
4960 static void GLAPIENTRY
4961 save_ScissorArrayv(GLuint first, GLsizei count, const GLint *v)
4962 {
4963 GET_CURRENT_CONTEXT(ctx);
4964 Node *n;
4965 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4966 n = alloc_instruction(ctx, OPCODE_SCISSOR_ARRAY_V, 2 + POINTER_DWORDS);
4967 if (n) {
4968 n[1].ui = first;
4969 n[2].si = count;
4970 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLint)));
4971 }
4972 if (ctx->ExecuteFlag) {
4973 CALL_ScissorArrayv(ctx->Exec, (first, count, v));
4974 }
4975 }
4976
4977 static void GLAPIENTRY
4978 save_DepthRangeIndexed(GLuint index, GLclampd n, GLclampd f)
4979 {
4980 GET_CURRENT_CONTEXT(ctx);
4981 Node *node;
4982 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4983 node = alloc_instruction(ctx, OPCODE_DEPTH_INDEXED, 3);
4984 if (node) {
4985 node[1].ui = index;
4986 /* Mesa stores these as floats internally so we deliberately convert
4987 * them to a float here.
4988 */
4989 node[2].f = n;
4990 node[3].f = f;
4991 }
4992 if (ctx->ExecuteFlag) {
4993 CALL_DepthRangeIndexed(ctx->Exec, (index, n, f));
4994 }
4995 }
4996
4997 static void GLAPIENTRY
4998 save_DepthRangeArrayv(GLuint first, GLsizei count, const GLclampd *v)
4999 {
5000 GET_CURRENT_CONTEXT(ctx);
5001 Node *n;
5002 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5003 n = alloc_instruction(ctx, OPCODE_DEPTH_ARRAY_V, 2 + POINTER_DWORDS);
5004 if (n) {
5005 n[1].ui = first;
5006 n[2].si = count;
5007 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLclampd)));
5008 }
5009 if (ctx->ExecuteFlag) {
5010 CALL_DepthRangeArrayv(ctx->Exec, (first, count, v));
5011 }
5012 }
5013
5014 static void GLAPIENTRY
5015 save_WindowPos4fMESA(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
5016 {
5017 GET_CURRENT_CONTEXT(ctx);
5018 Node *n;
5019 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5020 n = alloc_instruction(ctx, OPCODE_WINDOW_POS, 4);
5021 if (n) {
5022 n[1].f = x;
5023 n[2].f = y;
5024 n[3].f = z;
5025 n[4].f = w;
5026 }
5027 if (ctx->ExecuteFlag) {
5028 CALL_WindowPos4fMESA(ctx->Exec, (x, y, z, w));
5029 }
5030 }
5031
5032 static void GLAPIENTRY
5033 save_WindowPos2dMESA(GLdouble x, GLdouble y)
5034 {
5035 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
5036 }
5037
5038 static void GLAPIENTRY
5039 save_WindowPos2fMESA(GLfloat x, GLfloat y)
5040 {
5041 save_WindowPos4fMESA(x, y, 0.0F, 1.0F);
5042 }
5043
5044 static void GLAPIENTRY
5045 save_WindowPos2iMESA(GLint x, GLint y)
5046 {
5047 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
5048 }
5049
5050 static void GLAPIENTRY
5051 save_WindowPos2sMESA(GLshort x, GLshort y)
5052 {
5053 save_WindowPos4fMESA(x, y, 0.0F, 1.0F);
5054 }
5055
5056 static void GLAPIENTRY
5057 save_WindowPos3dMESA(GLdouble x, GLdouble y, GLdouble z)
5058 {
5059 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
5060 }
5061
5062 static void GLAPIENTRY
5063 save_WindowPos3fMESA(GLfloat x, GLfloat y, GLfloat z)
5064 {
5065 save_WindowPos4fMESA(x, y, z, 1.0F);
5066 }
5067
5068 static void GLAPIENTRY
5069 save_WindowPos3iMESA(GLint x, GLint y, GLint z)
5070 {
5071 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
5072 }
5073
5074 static void GLAPIENTRY
5075 save_WindowPos3sMESA(GLshort x, GLshort y, GLshort z)
5076 {
5077 save_WindowPos4fMESA(x, y, z, 1.0F);
5078 }
5079
5080 static void GLAPIENTRY
5081 save_WindowPos4dMESA(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
5082 {
5083 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
5084 }
5085
5086 static void GLAPIENTRY
5087 save_WindowPos4iMESA(GLint x, GLint y, GLint z, GLint w)
5088 {
5089 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
5090 }
5091
5092 static void GLAPIENTRY
5093 save_WindowPos4sMESA(GLshort x, GLshort y, GLshort z, GLshort w)
5094 {
5095 save_WindowPos4fMESA(x, y, z, w);
5096 }
5097
5098 static void GLAPIENTRY
5099 save_WindowPos2dvMESA(const GLdouble * v)
5100 {
5101 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
5102 }
5103
5104 static void GLAPIENTRY
5105 save_WindowPos2fvMESA(const GLfloat * v)
5106 {
5107 save_WindowPos4fMESA(v[0], v[1], 0.0F, 1.0F);
5108 }
5109
5110 static void GLAPIENTRY
5111 save_WindowPos2ivMESA(const GLint * v)
5112 {
5113 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
5114 }
5115
5116 static void GLAPIENTRY
5117 save_WindowPos2svMESA(const GLshort * v)
5118 {
5119 save_WindowPos4fMESA(v[0], v[1], 0.0F, 1.0F);
5120 }
5121
5122 static void GLAPIENTRY
5123 save_WindowPos3dvMESA(const GLdouble * v)
5124 {
5125 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
5126 }
5127
5128 static void GLAPIENTRY
5129 save_WindowPos3fvMESA(const GLfloat * v)
5130 {
5131 save_WindowPos4fMESA(v[0], v[1], v[2], 1.0F);
5132 }
5133
5134 static void GLAPIENTRY
5135 save_WindowPos3ivMESA(const GLint * v)
5136 {
5137 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
5138 }
5139
5140 static void GLAPIENTRY
5141 save_WindowPos3svMESA(const GLshort * v)
5142 {
5143 save_WindowPos4fMESA(v[0], v[1], v[2], 1.0F);
5144 }
5145
5146 static void GLAPIENTRY
5147 save_WindowPos4dvMESA(const GLdouble * v)
5148 {
5149 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1],
5150 (GLfloat) v[2], (GLfloat) v[3]);
5151 }
5152
5153 static void GLAPIENTRY
5154 save_WindowPos4fvMESA(const GLfloat * v)
5155 {
5156 save_WindowPos4fMESA(v[0], v[1], v[2], v[3]);
5157 }
5158
5159 static void GLAPIENTRY
5160 save_WindowPos4ivMESA(const GLint * v)
5161 {
5162 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1],
5163 (GLfloat) v[2], (GLfloat) v[3]);
5164 }
5165
5166 static void GLAPIENTRY
5167 save_WindowPos4svMESA(const GLshort * v)
5168 {
5169 save_WindowPos4fMESA(v[0], v[1], v[2], v[3]);
5170 }
5171
5172
5173
5174 /* GL_ARB_multitexture */
5175 static void GLAPIENTRY
5176 save_ActiveTextureARB(GLenum target)
5177 {
5178 GET_CURRENT_CONTEXT(ctx);
5179 Node *n;
5180 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5181 n = alloc_instruction(ctx, OPCODE_ACTIVE_TEXTURE, 1);
5182 if (n) {
5183 n[1].e = target;
5184 }
5185 if (ctx->ExecuteFlag) {
5186 CALL_ActiveTexture(ctx->Exec, (target));
5187 }
5188 }
5189
5190
5191 /* GL_ARB_transpose_matrix */
5192
5193 static void GLAPIENTRY
5194 save_LoadTransposeMatrixdARB(const GLdouble m[16])
5195 {
5196 GLfloat tm[16];
5197 _math_transposefd(tm, m);
5198 save_LoadMatrixf(tm);
5199 }
5200
5201
5202 static void GLAPIENTRY
5203 save_LoadTransposeMatrixfARB(const GLfloat m[16])
5204 {
5205 GLfloat tm[16];
5206 _math_transposef(tm, m);
5207 save_LoadMatrixf(tm);
5208 }
5209
5210
5211 static void GLAPIENTRY
5212 save_MultTransposeMatrixdARB(const GLdouble m[16])
5213 {
5214 GLfloat tm[16];
5215 _math_transposefd(tm, m);
5216 save_MultMatrixf(tm);
5217 }
5218
5219
5220 static void GLAPIENTRY
5221 save_MultTransposeMatrixfARB(const GLfloat m[16])
5222 {
5223 GLfloat tm[16];
5224 _math_transposef(tm, m);
5225 save_MultMatrixf(tm);
5226 }
5227
5228 static GLvoid *copy_data(const GLvoid *data, GLsizei size, const char *func)
5229 {
5230 GET_CURRENT_CONTEXT(ctx);
5231 GLvoid *image;
5232
5233 if (!data)
5234 return NULL;
5235
5236 image = malloc(size);
5237 if (!image) {
5238 _mesa_error(ctx, GL_OUT_OF_MEMORY, "%s", func);
5239 return NULL;
5240 }
5241 memcpy(image, data, size);
5242
5243 return image;
5244 }
5245
5246
5247 /* GL_ARB_texture_compression */
5248 static void GLAPIENTRY
5249 save_CompressedTexImage1DARB(GLenum target, GLint level,
5250 GLenum internalFormat, GLsizei width,
5251 GLint border, GLsizei imageSize,
5252 const GLvoid * data)
5253 {
5254 GET_CURRENT_CONTEXT(ctx);
5255 if (target == GL_PROXY_TEXTURE_1D) {
5256 /* don't compile, execute immediately */
5257 CALL_CompressedTexImage1D(ctx->Exec, (target, level, internalFormat,
5258 width, border, imageSize,
5259 data));
5260 }
5261 else {
5262 Node *n;
5263 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5264
5265 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_1D,
5266 6 + POINTER_DWORDS);
5267 if (n) {
5268 n[1].e = target;
5269 n[2].i = level;
5270 n[3].e = internalFormat;
5271 n[4].i = (GLint) width;
5272 n[5].i = border;
5273 n[6].i = imageSize;
5274 save_pointer(&n[7],
5275 copy_data(data, imageSize, "glCompressedTexImage1DARB"));
5276 }
5277 if (ctx->ExecuteFlag) {
5278 CALL_CompressedTexImage1D(ctx->Exec,
5279 (target, level, internalFormat, width,
5280 border, imageSize, data));
5281 }
5282 }
5283 }
5284
5285
5286 static void GLAPIENTRY
5287 save_CompressedTexImage2DARB(GLenum target, GLint level,
5288 GLenum internalFormat, GLsizei width,
5289 GLsizei height, GLint border, GLsizei imageSize,
5290 const GLvoid * data)
5291 {
5292 GET_CURRENT_CONTEXT(ctx);
5293 if (target == GL_PROXY_TEXTURE_2D) {
5294 /* don't compile, execute immediately */
5295 CALL_CompressedTexImage2D(ctx->Exec, (target, level, internalFormat,
5296 width, height, border,
5297 imageSize, data));
5298 }
5299 else {
5300 Node *n;
5301 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5302
5303 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_2D,
5304 7 + POINTER_DWORDS);
5305 if (n) {
5306 n[1].e = target;
5307 n[2].i = level;
5308 n[3].e = internalFormat;
5309 n[4].i = (GLint) width;
5310 n[5].i = (GLint) height;
5311 n[6].i = border;
5312 n[7].i = imageSize;
5313 save_pointer(&n[8],
5314 copy_data(data, imageSize, "glCompressedTexImage2DARB"));
5315 }
5316 if (ctx->ExecuteFlag) {
5317 CALL_CompressedTexImage2D(ctx->Exec,
5318 (target, level, internalFormat, width,
5319 height, border, imageSize, data));
5320 }
5321 }
5322 }
5323
5324
5325 static void GLAPIENTRY
5326 save_CompressedTexImage3DARB(GLenum target, GLint level,
5327 GLenum internalFormat, GLsizei width,
5328 GLsizei height, GLsizei depth, GLint border,
5329 GLsizei imageSize, const GLvoid * data)
5330 {
5331 GET_CURRENT_CONTEXT(ctx);
5332 if (target == GL_PROXY_TEXTURE_3D) {
5333 /* don't compile, execute immediately */
5334 CALL_CompressedTexImage3D(ctx->Exec, (target, level, internalFormat,
5335 width, height, depth, border,
5336 imageSize, data));
5337 }
5338 else {
5339 Node *n;
5340 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5341
5342 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_3D,
5343 8 + POINTER_DWORDS);
5344 if (n) {
5345 n[1].e = target;
5346 n[2].i = level;
5347 n[3].e = internalFormat;
5348 n[4].i = (GLint) width;
5349 n[5].i = (GLint) height;
5350 n[6].i = (GLint) depth;
5351 n[7].i = border;
5352 n[8].i = imageSize;
5353 save_pointer(&n[9],
5354 copy_data(data, imageSize, "glCompressedTexImage3DARB"));
5355 }
5356 if (ctx->ExecuteFlag) {
5357 CALL_CompressedTexImage3D(ctx->Exec,
5358 (target, level, internalFormat, width,
5359 height, depth, border, imageSize,
5360 data));
5361 }
5362 }
5363 }
5364
5365
5366 static void GLAPIENTRY
5367 save_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset,
5368 GLsizei width, GLenum format,
5369 GLsizei imageSize, const GLvoid * data)
5370 {
5371 Node *n;
5372 GET_CURRENT_CONTEXT(ctx);
5373 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5374
5375 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D,
5376 6 + POINTER_DWORDS);
5377 if (n) {
5378 n[1].e = target;
5379 n[2].i = level;
5380 n[3].i = xoffset;
5381 n[4].i = (GLint) width;
5382 n[5].e = format;
5383 n[6].i = imageSize;
5384 save_pointer(&n[7],
5385 copy_data(data, imageSize, "glCompressedTexSubImage1DARB"));
5386 }
5387 if (ctx->ExecuteFlag) {
5388 CALL_CompressedTexSubImage1D(ctx->Exec, (target, level, xoffset,
5389 width, format, imageSize,
5390 data));
5391 }
5392 }
5393
5394
5395 static void GLAPIENTRY
5396 save_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset,
5397 GLint yoffset, GLsizei width, GLsizei height,
5398 GLenum format, GLsizei imageSize,
5399 const GLvoid * data)
5400 {
5401 Node *n;
5402 GET_CURRENT_CONTEXT(ctx);
5403 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5404
5405 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D,
5406 8 + POINTER_DWORDS);
5407 if (n) {
5408 n[1].e = target;
5409 n[2].i = level;
5410 n[3].i = xoffset;
5411 n[4].i = yoffset;
5412 n[5].i = (GLint) width;
5413 n[6].i = (GLint) height;
5414 n[7].e = format;
5415 n[8].i = imageSize;
5416 save_pointer(&n[9],
5417 copy_data(data, imageSize, "glCompressedTexSubImage2DARB"));
5418 }
5419 if (ctx->ExecuteFlag) {
5420 CALL_CompressedTexSubImage2D(ctx->Exec,
5421 (target, level, xoffset, yoffset, width,
5422 height, format, imageSize, data));
5423 }
5424 }
5425
5426
5427 static void GLAPIENTRY
5428 save_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset,
5429 GLint yoffset, GLint zoffset, GLsizei width,
5430 GLsizei height, GLsizei depth, GLenum format,
5431 GLsizei imageSize, const GLvoid * data)
5432 {
5433 Node *n;
5434 GET_CURRENT_CONTEXT(ctx);
5435 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5436
5437 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D,
5438 10 + POINTER_DWORDS);
5439 if (n) {
5440 n[1].e = target;
5441 n[2].i = level;
5442 n[3].i = xoffset;
5443 n[4].i = yoffset;
5444 n[5].i = zoffset;
5445 n[6].i = (GLint) width;
5446 n[7].i = (GLint) height;
5447 n[8].i = (GLint) depth;
5448 n[9].e = format;
5449 n[10].i = imageSize;
5450 save_pointer(&n[11],
5451 copy_data(data, imageSize, "glCompressedTexSubImage3DARB"));
5452 }
5453 if (ctx->ExecuteFlag) {
5454 CALL_CompressedTexSubImage3D(ctx->Exec,
5455 (target, level, xoffset, yoffset,
5456 zoffset, width, height, depth, format,
5457 imageSize, data));
5458 }
5459 }
5460
5461
5462 /* GL_ARB_multisample */
5463 static void GLAPIENTRY
5464 save_SampleCoverageARB(GLclampf value, GLboolean invert)
5465 {
5466 GET_CURRENT_CONTEXT(ctx);
5467 Node *n;
5468 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5469 n = alloc_instruction(ctx, OPCODE_SAMPLE_COVERAGE, 2);
5470 if (n) {
5471 n[1].f = value;
5472 n[2].b = invert;
5473 }
5474 if (ctx->ExecuteFlag) {
5475 CALL_SampleCoverage(ctx->Exec, (value, invert));
5476 }
5477 }
5478
5479
5480 /*
5481 * GL_ARB_vertex_program
5482 */
5483 static void GLAPIENTRY
5484 save_BindProgramARB(GLenum target, GLuint id)
5485 {
5486 GET_CURRENT_CONTEXT(ctx);
5487 Node *n;
5488 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5489 n = alloc_instruction(ctx, OPCODE_BIND_PROGRAM_ARB, 2);
5490 if (n) {
5491 n[1].e = target;
5492 n[2].ui = id;
5493 }
5494 if (ctx->ExecuteFlag) {
5495 CALL_BindProgramARB(ctx->Exec, (target, id));
5496 }
5497 }
5498
5499 static void GLAPIENTRY
5500 save_ProgramEnvParameter4fARB(GLenum target, GLuint index,
5501 GLfloat x, GLfloat y, GLfloat z, GLfloat w)
5502 {
5503 GET_CURRENT_CONTEXT(ctx);
5504 Node *n;
5505 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5506 n = alloc_instruction(ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6);
5507 if (n) {
5508 n[1].e = target;
5509 n[2].ui = index;
5510 n[3].f = x;
5511 n[4].f = y;
5512 n[5].f = z;
5513 n[6].f = w;
5514 }
5515 if (ctx->ExecuteFlag) {
5516 CALL_ProgramEnvParameter4fARB(ctx->Exec, (target, index, x, y, z, w));
5517 }
5518 }
5519
5520
5521 static void GLAPIENTRY
5522 save_ProgramEnvParameter4fvARB(GLenum target, GLuint index,
5523 const GLfloat *params)
5524 {
5525 save_ProgramEnvParameter4fARB(target, index, params[0], params[1],
5526 params[2], params[3]);
5527 }
5528
5529
5530 static void GLAPIENTRY
5531 save_ProgramEnvParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
5532 const GLfloat * params)
5533 {
5534 GET_CURRENT_CONTEXT(ctx);
5535 Node *n;
5536 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5537
5538 if (count > 0) {
5539 GLint i;
5540 const GLfloat * p = params;
5541
5542 for (i = 0 ; i < count ; i++) {
5543 n = alloc_instruction(ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6);
5544 if (n) {
5545 n[1].e = target;
5546 n[2].ui = index;
5547 n[3].f = p[0];
5548 n[4].f = p[1];
5549 n[5].f = p[2];
5550 n[6].f = p[3];
5551 p += 4;
5552 }
5553 }
5554 }
5555
5556 if (ctx->ExecuteFlag) {
5557 CALL_ProgramEnvParameters4fvEXT(ctx->Exec, (target, index, count, params));
5558 }
5559 }
5560
5561
5562 static void GLAPIENTRY
5563 save_ProgramEnvParameter4dARB(GLenum target, GLuint index,
5564 GLdouble x, GLdouble y, GLdouble z, GLdouble w)
5565 {
5566 save_ProgramEnvParameter4fARB(target, index,
5567 (GLfloat) x,
5568 (GLfloat) y, (GLfloat) z, (GLfloat) w);
5569 }
5570
5571
5572 static void GLAPIENTRY
5573 save_ProgramEnvParameter4dvARB(GLenum target, GLuint index,
5574 const GLdouble *params)
5575 {
5576 save_ProgramEnvParameter4fARB(target, index,
5577 (GLfloat) params[0],
5578 (GLfloat) params[1],
5579 (GLfloat) params[2], (GLfloat) params[3]);
5580 }
5581
5582
5583 static void GLAPIENTRY
5584 save_ProgramLocalParameter4fARB(GLenum target, GLuint index,
5585 GLfloat x, GLfloat y, GLfloat z, GLfloat w)
5586 {
5587 GET_CURRENT_CONTEXT(ctx);
5588 Node *n;
5589 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5590 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5591 if (n) {
5592 n[1].e = target;
5593 n[2].ui = index;
5594 n[3].f = x;
5595 n[4].f = y;
5596 n[5].f = z;
5597 n[6].f = w;
5598 }
5599 if (ctx->ExecuteFlag) {
5600 CALL_ProgramLocalParameter4fARB(ctx->Exec, (target, index, x, y, z, w));
5601 }
5602 }
5603
5604
5605 static void GLAPIENTRY
5606 save_ProgramLocalParameter4fvARB(GLenum target, GLuint index,
5607 const GLfloat *params)
5608 {
5609 GET_CURRENT_CONTEXT(ctx);
5610 Node *n;
5611 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5612 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5613 if (n) {
5614 n[1].e = target;
5615 n[2].ui = index;
5616 n[3].f = params[0];
5617 n[4].f = params[1];
5618 n[5].f = params[2];
5619 n[6].f = params[3];
5620 }
5621 if (ctx->ExecuteFlag) {
5622 CALL_ProgramLocalParameter4fvARB(ctx->Exec, (target, index, params));
5623 }
5624 }
5625
5626
5627 static void GLAPIENTRY
5628 save_ProgramLocalParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
5629 const GLfloat *params)
5630 {
5631 GET_CURRENT_CONTEXT(ctx);
5632 Node *n;
5633 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5634
5635 if (count > 0) {
5636 GLint i;
5637 const GLfloat * p = params;
5638
5639 for (i = 0 ; i < count ; i++) {
5640 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5641 if (n) {
5642 n[1].e = target;
5643 n[2].ui = index;
5644 n[3].f = p[0];
5645 n[4].f = p[1];
5646 n[5].f = p[2];
5647 n[6].f = p[3];
5648 p += 4;
5649 }
5650 }
5651 }
5652
5653 if (ctx->ExecuteFlag) {
5654 CALL_ProgramLocalParameters4fvEXT(ctx->Exec, (target, index, count, params));
5655 }
5656 }
5657
5658
5659 static void GLAPIENTRY
5660 save_ProgramLocalParameter4dARB(GLenum target, GLuint index,
5661 GLdouble x, GLdouble y,
5662 GLdouble z, GLdouble w)
5663 {
5664 GET_CURRENT_CONTEXT(ctx);
5665 Node *n;
5666 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5667 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5668 if (n) {
5669 n[1].e = target;
5670 n[2].ui = index;
5671 n[3].f = (GLfloat) x;
5672 n[4].f = (GLfloat) y;
5673 n[5].f = (GLfloat) z;
5674 n[6].f = (GLfloat) w;
5675 }
5676 if (ctx->ExecuteFlag) {
5677 CALL_ProgramLocalParameter4dARB(ctx->Exec, (target, index, x, y, z, w));
5678 }
5679 }
5680
5681
5682 static void GLAPIENTRY
5683 save_ProgramLocalParameter4dvARB(GLenum target, GLuint index,
5684 const GLdouble *params)
5685 {
5686 GET_CURRENT_CONTEXT(ctx);
5687 Node *n;
5688 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5689 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5690 if (n) {
5691 n[1].e = target;
5692 n[2].ui = index;
5693 n[3].f = (GLfloat) params[0];
5694 n[4].f = (GLfloat) params[1];
5695 n[5].f = (GLfloat) params[2];
5696 n[6].f = (GLfloat) params[3];
5697 }
5698 if (ctx->ExecuteFlag) {
5699 CALL_ProgramLocalParameter4dvARB(ctx->Exec, (target, index, params));
5700 }
5701 }
5702
5703
5704 /* GL_EXT_stencil_two_side */
5705 static void GLAPIENTRY
5706 save_ActiveStencilFaceEXT(GLenum face)
5707 {
5708 GET_CURRENT_CONTEXT(ctx);
5709 Node *n;
5710 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5711 n = alloc_instruction(ctx, OPCODE_ACTIVE_STENCIL_FACE_EXT, 1);
5712 if (n) {
5713 n[1].e = face;
5714 }
5715 if (ctx->ExecuteFlag) {
5716 CALL_ActiveStencilFaceEXT(ctx->Exec, (face));
5717 }
5718 }
5719
5720
5721 /* GL_EXT_depth_bounds_test */
5722 static void GLAPIENTRY
5723 save_DepthBoundsEXT(GLclampd zmin, GLclampd zmax)
5724 {
5725 GET_CURRENT_CONTEXT(ctx);
5726 Node *n;
5727 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5728 n = alloc_instruction(ctx, OPCODE_DEPTH_BOUNDS_EXT, 2);
5729 if (n) {
5730 n[1].f = (GLfloat) zmin;
5731 n[2].f = (GLfloat) zmax;
5732 }
5733 if (ctx->ExecuteFlag) {
5734 CALL_DepthBoundsEXT(ctx->Exec, (zmin, zmax));
5735 }
5736 }
5737
5738
5739
5740 static void GLAPIENTRY
5741 save_ProgramStringARB(GLenum target, GLenum format, GLsizei len,
5742 const GLvoid * string)
5743 {
5744 GET_CURRENT_CONTEXT(ctx);
5745 Node *n;
5746
5747 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5748
5749 n = alloc_instruction(ctx, OPCODE_PROGRAM_STRING_ARB, 3 + POINTER_DWORDS);
5750 if (n) {
5751 GLubyte *programCopy = malloc(len);
5752 if (!programCopy) {
5753 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramStringARB");
5754 return;
5755 }
5756 memcpy(programCopy, string, len);
5757 n[1].e = target;
5758 n[2].e = format;
5759 n[3].i = len;
5760 save_pointer(&n[4], programCopy);
5761 }
5762 if (ctx->ExecuteFlag) {
5763 CALL_ProgramStringARB(ctx->Exec, (target, format, len, string));
5764 }
5765 }
5766
5767
5768 static void GLAPIENTRY
5769 save_BeginQueryARB(GLenum target, GLuint id)
5770 {
5771 GET_CURRENT_CONTEXT(ctx);
5772 Node *n;
5773 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5774 n = alloc_instruction(ctx, OPCODE_BEGIN_QUERY_ARB, 2);
5775 if (n) {
5776 n[1].e = target;
5777 n[2].ui = id;
5778 }
5779 if (ctx->ExecuteFlag) {
5780 CALL_BeginQuery(ctx->Exec, (target, id));
5781 }
5782 }
5783
5784 static void GLAPIENTRY
5785 save_EndQueryARB(GLenum target)
5786 {
5787 GET_CURRENT_CONTEXT(ctx);
5788 Node *n;
5789 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5790 n = alloc_instruction(ctx, OPCODE_END_QUERY_ARB, 1);
5791 if (n) {
5792 n[1].e = target;
5793 }
5794 if (ctx->ExecuteFlag) {
5795 CALL_EndQuery(ctx->Exec, (target));
5796 }
5797 }
5798
5799 static void GLAPIENTRY
5800 save_QueryCounter(GLuint id, GLenum target)
5801 {
5802 GET_CURRENT_CONTEXT(ctx);
5803 Node *n;
5804 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5805 n = alloc_instruction(ctx, OPCODE_QUERY_COUNTER, 2);
5806 if (n) {
5807 n[1].ui = id;
5808 n[2].e = target;
5809 }
5810 if (ctx->ExecuteFlag) {
5811 CALL_QueryCounter(ctx->Exec, (id, target));
5812 }
5813 }
5814
5815 static void GLAPIENTRY
5816 save_BeginQueryIndexed(GLenum target, GLuint index, GLuint id)
5817 {
5818 GET_CURRENT_CONTEXT(ctx);
5819 Node *n;
5820 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5821 n = alloc_instruction(ctx, OPCODE_BEGIN_QUERY_INDEXED, 3);
5822 if (n) {
5823 n[1].e = target;
5824 n[2].ui = index;
5825 n[3].ui = id;
5826 }
5827 if (ctx->ExecuteFlag) {
5828 CALL_BeginQueryIndexed(ctx->Exec, (target, index, id));
5829 }
5830 }
5831
5832 static void GLAPIENTRY
5833 save_EndQueryIndexed(GLenum target, GLuint index)
5834 {
5835 GET_CURRENT_CONTEXT(ctx);
5836 Node *n;
5837 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5838 n = alloc_instruction(ctx, OPCODE_END_QUERY_INDEXED, 2);
5839 if (n) {
5840 n[1].e = target;
5841 n[2].ui = index;
5842 }
5843 if (ctx->ExecuteFlag) {
5844 CALL_EndQueryIndexed(ctx->Exec, (target, index));
5845 }
5846 }
5847
5848
5849 static void GLAPIENTRY
5850 save_DrawBuffersARB(GLsizei count, const GLenum * buffers)
5851 {
5852 GET_CURRENT_CONTEXT(ctx);
5853 Node *n;
5854 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5855 n = alloc_instruction(ctx, OPCODE_DRAW_BUFFERS_ARB, 1 + MAX_DRAW_BUFFERS);
5856 if (n) {
5857 GLint i;
5858 n[1].i = count;
5859 if (count > MAX_DRAW_BUFFERS)
5860 count = MAX_DRAW_BUFFERS;
5861 for (i = 0; i < count; i++) {
5862 n[2 + i].e = buffers[i];
5863 }
5864 }
5865 if (ctx->ExecuteFlag) {
5866 CALL_DrawBuffers(ctx->Exec, (count, buffers));
5867 }
5868 }
5869
5870 static void GLAPIENTRY
5871 save_BindFragmentShaderATI(GLuint id)
5872 {
5873 GET_CURRENT_CONTEXT(ctx);
5874 Node *n;
5875
5876 n = alloc_instruction(ctx, OPCODE_BIND_FRAGMENT_SHADER_ATI, 1);
5877 if (n) {
5878 n[1].ui = id;
5879 }
5880 if (ctx->ExecuteFlag) {
5881 CALL_BindFragmentShaderATI(ctx->Exec, (id));
5882 }
5883 }
5884
5885 static void GLAPIENTRY
5886 save_SetFragmentShaderConstantATI(GLuint dst, const GLfloat *value)
5887 {
5888 GET_CURRENT_CONTEXT(ctx);
5889 Node *n;
5890
5891 n = alloc_instruction(ctx, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI, 5);
5892 if (n) {
5893 n[1].ui = dst;
5894 n[2].f = value[0];
5895 n[3].f = value[1];
5896 n[4].f = value[2];
5897 n[5].f = value[3];
5898 }
5899 if (ctx->ExecuteFlag) {
5900 CALL_SetFragmentShaderConstantATI(ctx->Exec, (dst, value));
5901 }
5902 }
5903
5904 static void GLAPIENTRY
5905 save_EvalCoord1f(GLfloat x)
5906 {
5907 GET_CURRENT_CONTEXT(ctx);
5908 Node *n;
5909 SAVE_FLUSH_VERTICES(ctx);
5910 n = alloc_instruction(ctx, OPCODE_EVAL_C1, 1);
5911 if (n) {
5912 n[1].f = x;
5913 }
5914 if (ctx->ExecuteFlag) {
5915 CALL_EvalCoord1f(ctx->Exec, (x));
5916 }
5917 }
5918
5919 static void GLAPIENTRY
5920 save_EvalCoord1fv(const GLfloat * v)
5921 {
5922 save_EvalCoord1f(v[0]);
5923 }
5924
5925 static void GLAPIENTRY
5926 save_EvalCoord2f(GLfloat x, GLfloat y)
5927 {
5928 GET_CURRENT_CONTEXT(ctx);
5929 Node *n;
5930 SAVE_FLUSH_VERTICES(ctx);
5931 n = alloc_instruction(ctx, OPCODE_EVAL_C2, 2);
5932 if (n) {
5933 n[1].f = x;
5934 n[2].f = y;
5935 }
5936 if (ctx->ExecuteFlag) {
5937 CALL_EvalCoord2f(ctx->Exec, (x, y));
5938 }
5939 }
5940
5941 static void GLAPIENTRY
5942 save_EvalCoord2fv(const GLfloat * v)
5943 {
5944 save_EvalCoord2f(v[0], v[1]);
5945 }
5946
5947
5948 static void GLAPIENTRY
5949 save_EvalPoint1(GLint x)
5950 {
5951 GET_CURRENT_CONTEXT(ctx);
5952 Node *n;
5953 SAVE_FLUSH_VERTICES(ctx);
5954 n = alloc_instruction(ctx, OPCODE_EVAL_P1, 1);
5955 if (n) {
5956 n[1].i = x;
5957 }
5958 if (ctx->ExecuteFlag) {
5959 CALL_EvalPoint1(ctx->Exec, (x));
5960 }
5961 }
5962
5963 static void GLAPIENTRY
5964 save_EvalPoint2(GLint x, GLint y)
5965 {
5966 GET_CURRENT_CONTEXT(ctx);
5967 Node *n;
5968 SAVE_FLUSH_VERTICES(ctx);
5969 n = alloc_instruction(ctx, OPCODE_EVAL_P2, 2);
5970 if (n) {
5971 n[1].i = x;
5972 n[2].i = y;
5973 }
5974 if (ctx->ExecuteFlag) {
5975 CALL_EvalPoint2(ctx->Exec, (x, y));
5976 }
5977 }
5978
5979
5980 /**
5981 * Compare 'count' elements of vectors 'a' and 'b'.
5982 * \return GL_TRUE if equal, GL_FALSE if different.
5983 */
5984 static inline GLboolean
5985 compare_vec(const GLfloat *a, const GLfloat *b, GLuint count)
5986 {
5987 return memcmp( a, b, count * sizeof(GLfloat) ) == 0;
5988 }
5989
5990
5991 /**
5992 * This glMaterial function is used for glMaterial calls that are outside
5993 * a glBegin/End pair. For glMaterial inside glBegin/End, see the VBO code.
5994 */
5995 static void GLAPIENTRY
5996 save_Materialfv(GLenum face, GLenum pname, const GLfloat * param)
5997 {
5998 GET_CURRENT_CONTEXT(ctx);
5999 Node *n;
6000 int args, i;
6001 GLuint bitmask;
6002
6003 switch (face) {
6004 case GL_BACK:
6005 case GL_FRONT:
6006 case GL_FRONT_AND_BACK:
6007 break;
6008 default:
6009 _mesa_compile_error(ctx, GL_INVALID_ENUM, "glMaterial(face)");
6010 return;
6011 }
6012
6013 switch (pname) {
6014 case GL_EMISSION:
6015 case GL_AMBIENT:
6016 case GL_DIFFUSE:
6017 case GL_SPECULAR:
6018 case GL_AMBIENT_AND_DIFFUSE:
6019 args = 4;
6020 break;
6021 case GL_SHININESS:
6022 args = 1;
6023 break;
6024 case GL_COLOR_INDEXES:
6025 args = 3;
6026 break;
6027 default:
6028 _mesa_compile_error(ctx, GL_INVALID_ENUM, "glMaterial(pname)");
6029 return;
6030 }
6031
6032 if (ctx->ExecuteFlag) {
6033 CALL_Materialfv(ctx->Exec, (face, pname, param));
6034 }
6035
6036 bitmask = _mesa_material_bitmask(ctx, face, pname, ~0, NULL);
6037
6038 /* Try to eliminate redundant statechanges. Because it is legal to
6039 * call glMaterial even inside begin/end calls, don't need to worry
6040 * about ctx->Driver.CurrentSavePrimitive here.
6041 */
6042 for (i = 0; i < MAT_ATTRIB_MAX; i++) {
6043 if (bitmask & (1 << i)) {
6044 if (ctx->ListState.ActiveMaterialSize[i] == args &&
6045 compare_vec(ctx->ListState.CurrentMaterial[i], param, args)) {
6046 /* no change in material value */
6047 bitmask &= ~(1 << i);
6048 }
6049 else {
6050 ctx->ListState.ActiveMaterialSize[i] = args;
6051 COPY_SZ_4V(ctx->ListState.CurrentMaterial[i], args, param);
6052 }
6053 }
6054 }
6055
6056 /* If this call has no effect, return early */
6057 if (bitmask == 0)
6058 return;
6059
6060 SAVE_FLUSH_VERTICES(ctx);
6061
6062 n = alloc_instruction(ctx, OPCODE_MATERIAL, 6);
6063 if (n) {
6064 n[1].e = face;
6065 n[2].e = pname;
6066 for (i = 0; i < args; i++)
6067 n[3 + i].f = param[i];
6068 }
6069 }
6070
6071 static void GLAPIENTRY
6072 save_Begin(GLenum mode)
6073 {
6074 GET_CURRENT_CONTEXT(ctx);
6075
6076 if (!_mesa_is_valid_prim_mode(ctx, mode)) {
6077 /* compile this error into the display list */
6078 _mesa_compile_error(ctx, GL_INVALID_ENUM, "glBegin(mode)");
6079 }
6080 else if (_mesa_inside_dlist_begin_end(ctx)) {
6081 /* compile this error into the display list */
6082 _mesa_compile_error(ctx, GL_INVALID_OPERATION, "recursive glBegin");
6083 }
6084 else {
6085 ctx->Driver.CurrentSavePrimitive = mode;
6086
6087 vbo_save_NotifyBegin(ctx, mode, false);
6088 }
6089 }
6090
6091 static void GLAPIENTRY
6092 save_End(void)
6093 {
6094 GET_CURRENT_CONTEXT(ctx);
6095 SAVE_FLUSH_VERTICES(ctx);
6096 (void) alloc_instruction(ctx, OPCODE_END, 0);
6097 ctx->Driver.CurrentSavePrimitive = PRIM_OUTSIDE_BEGIN_END;
6098 if (ctx->ExecuteFlag) {
6099 CALL_End(ctx->Exec, ());
6100 }
6101 }
6102
6103 static void GLAPIENTRY
6104 save_Rectf(GLfloat a, GLfloat b, GLfloat c, GLfloat d)
6105 {
6106 GET_CURRENT_CONTEXT(ctx);
6107 Node *n;
6108 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6109 n = alloc_instruction(ctx, OPCODE_RECTF, 4);
6110 if (n) {
6111 n[1].f = a;
6112 n[2].f = b;
6113 n[3].f = c;
6114 n[4].f = d;
6115 }
6116 if (ctx->ExecuteFlag) {
6117 CALL_Rectf(ctx->Exec, (a, b, c, d));
6118 }
6119 }
6120
6121 static void GLAPIENTRY
6122 save_PrimitiveRestartNV(void)
6123 {
6124 /* Note: this is used when outside a glBegin/End pair in a display list */
6125 GET_CURRENT_CONTEXT(ctx);
6126 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6127 (void) alloc_instruction(ctx, OPCODE_PRIMITIVE_RESTART_NV, 0);
6128 if (ctx->ExecuteFlag) {
6129 CALL_PrimitiveRestartNV(ctx->Exec, ());
6130 }
6131 }
6132
6133
6134 static void GLAPIENTRY
6135 save_BlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
6136 GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
6137 GLbitfield mask, GLenum filter)
6138 {
6139 GET_CURRENT_CONTEXT(ctx);
6140 Node *n;
6141 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6142 n = alloc_instruction(ctx, OPCODE_BLIT_FRAMEBUFFER, 10);
6143 if (n) {
6144 n[1].i = srcX0;
6145 n[2].i = srcY0;
6146 n[3].i = srcX1;
6147 n[4].i = srcY1;
6148 n[5].i = dstX0;
6149 n[6].i = dstY0;
6150 n[7].i = dstX1;
6151 n[8].i = dstY1;
6152 n[9].i = mask;
6153 n[10].e = filter;
6154 }
6155 if (ctx->ExecuteFlag) {
6156 CALL_BlitFramebuffer(ctx->Exec, (srcX0, srcY0, srcX1, srcY1,
6157 dstX0, dstY0, dstX1, dstY1,
6158 mask, filter));
6159 }
6160 }
6161
6162
6163 /** GL_EXT_provoking_vertex */
6164 static void GLAPIENTRY
6165 save_ProvokingVertexEXT(GLenum mode)
6166 {
6167 GET_CURRENT_CONTEXT(ctx);
6168 Node *n;
6169 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6170 n = alloc_instruction(ctx, OPCODE_PROVOKING_VERTEX, 1);
6171 if (n) {
6172 n[1].e = mode;
6173 }
6174 if (ctx->ExecuteFlag) {
6175 /*CALL_ProvokingVertex(ctx->Exec, (mode));*/
6176 _mesa_ProvokingVertex(mode);
6177 }
6178 }
6179
6180
6181 /** GL_EXT_transform_feedback */
6182 static void GLAPIENTRY
6183 save_BeginTransformFeedback(GLenum mode)
6184 {
6185 GET_CURRENT_CONTEXT(ctx);
6186 Node *n;
6187 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6188 n = alloc_instruction(ctx, OPCODE_BEGIN_TRANSFORM_FEEDBACK, 1);
6189 if (n) {
6190 n[1].e = mode;
6191 }
6192 if (ctx->ExecuteFlag) {
6193 CALL_BeginTransformFeedback(ctx->Exec, (mode));
6194 }
6195 }
6196
6197
6198 /** GL_EXT_transform_feedback */
6199 static void GLAPIENTRY
6200 save_EndTransformFeedback(void)
6201 {
6202 GET_CURRENT_CONTEXT(ctx);
6203 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6204 (void) alloc_instruction(ctx, OPCODE_END_TRANSFORM_FEEDBACK, 0);
6205 if (ctx->ExecuteFlag) {
6206 CALL_EndTransformFeedback(ctx->Exec, ());
6207 }
6208 }
6209
6210 static void GLAPIENTRY
6211 save_BindTransformFeedback(GLenum target, GLuint name)
6212 {
6213 GET_CURRENT_CONTEXT(ctx);
6214 Node *n;
6215 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6216 n = alloc_instruction(ctx, OPCODE_BIND_TRANSFORM_FEEDBACK, 2);
6217 if (n) {
6218 n[1].e = target;
6219 n[2].ui = name;
6220 }
6221 if (ctx->ExecuteFlag) {
6222 CALL_BindTransformFeedback(ctx->Exec, (target, name));
6223 }
6224 }
6225
6226 static void GLAPIENTRY
6227 save_PauseTransformFeedback(void)
6228 {
6229 GET_CURRENT_CONTEXT(ctx);
6230 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6231 (void) alloc_instruction(ctx, OPCODE_PAUSE_TRANSFORM_FEEDBACK, 0);
6232 if (ctx->ExecuteFlag) {
6233 CALL_PauseTransformFeedback(ctx->Exec, ());
6234 }
6235 }
6236
6237 static void GLAPIENTRY
6238 save_ResumeTransformFeedback(void)
6239 {
6240 GET_CURRENT_CONTEXT(ctx);
6241 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6242 (void) alloc_instruction(ctx, OPCODE_RESUME_TRANSFORM_FEEDBACK, 0);
6243 if (ctx->ExecuteFlag) {
6244 CALL_ResumeTransformFeedback(ctx->Exec, ());
6245 }
6246 }
6247
6248 static void GLAPIENTRY
6249 save_DrawTransformFeedback(GLenum mode, GLuint name)
6250 {
6251 GET_CURRENT_CONTEXT(ctx);
6252 Node *n;
6253 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6254 n = alloc_instruction(ctx, OPCODE_DRAW_TRANSFORM_FEEDBACK, 2);
6255 if (n) {
6256 n[1].e = mode;
6257 n[2].ui = name;
6258 }
6259 if (ctx->ExecuteFlag) {
6260 CALL_DrawTransformFeedback(ctx->Exec, (mode, name));
6261 }
6262 }
6263
6264 static void GLAPIENTRY
6265 save_DrawTransformFeedbackStream(GLenum mode, GLuint name, GLuint stream)
6266 {
6267 GET_CURRENT_CONTEXT(ctx);
6268 Node *n;
6269 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6270 n = alloc_instruction(ctx, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM, 3);
6271 if (n) {
6272 n[1].e = mode;
6273 n[2].ui = name;
6274 n[3].ui = stream;
6275 }
6276 if (ctx->ExecuteFlag) {
6277 CALL_DrawTransformFeedbackStream(ctx->Exec, (mode, name, stream));
6278 }
6279 }
6280
6281 static void GLAPIENTRY
6282 save_DrawTransformFeedbackInstanced(GLenum mode, GLuint name,
6283 GLsizei primcount)
6284 {
6285 GET_CURRENT_CONTEXT(ctx);
6286 Node *n;
6287 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6288 n = alloc_instruction(ctx, OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED, 3);
6289 if (n) {
6290 n[1].e = mode;
6291 n[2].ui = name;
6292 n[3].si = primcount;
6293 }
6294 if (ctx->ExecuteFlag) {
6295 CALL_DrawTransformFeedbackInstanced(ctx->Exec, (mode, name, primcount));
6296 }
6297 }
6298
6299 static void GLAPIENTRY
6300 save_DrawTransformFeedbackStreamInstanced(GLenum mode, GLuint name,
6301 GLuint stream, GLsizei primcount)
6302 {
6303 GET_CURRENT_CONTEXT(ctx);
6304 Node *n;
6305 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6306 n = alloc_instruction(ctx, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED, 4);
6307 if (n) {
6308 n[1].e = mode;
6309 n[2].ui = name;
6310 n[3].ui = stream;
6311 n[4].si = primcount;
6312 }
6313 if (ctx->ExecuteFlag) {
6314 CALL_DrawTransformFeedbackStreamInstanced(ctx->Exec, (mode, name, stream,
6315 primcount));
6316 }
6317 }
6318
6319 static void GLAPIENTRY
6320 save_DispatchCompute(GLuint num_groups_x, GLuint num_groups_y,
6321 GLuint num_groups_z)
6322 {
6323 GET_CURRENT_CONTEXT(ctx);
6324 Node *n;
6325 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6326 n = alloc_instruction(ctx, OPCODE_DISPATCH_COMPUTE, 3);
6327 if (n) {
6328 n[1].ui = num_groups_x;
6329 n[2].ui = num_groups_y;
6330 n[3].ui = num_groups_z;
6331 }
6332 if (ctx->ExecuteFlag) {
6333 CALL_DispatchCompute(ctx->Exec, (num_groups_x, num_groups_y,
6334 num_groups_z));
6335 }
6336 }
6337
6338 static void GLAPIENTRY
6339 save_DispatchComputeIndirect(GLintptr indirect)
6340 {
6341 GET_CURRENT_CONTEXT(ctx);
6342 _mesa_error(ctx, GL_INVALID_OPERATION,
6343 "glDispatchComputeIndirect() during display list compile");
6344 }
6345
6346 static void ALWAYS_INLINE
6347 save_Attr32bit(struct gl_context *ctx, unsigned attr, unsigned size,
6348 GLenum type, uint32_t x, uint32_t y, uint32_t z, uint32_t w)
6349 {
6350 Node *n;
6351 SAVE_FLUSH_VERTICES(ctx);
6352 unsigned base_op;
6353 unsigned index = attr;
6354
6355 /* We don't care about GL_INT vs GL_UNSIGNED_INT. The idea is to get W=1
6356 * right for 3 or lower number of components, so only distinguish between
6357 * FLOAT and INT.
6358 */
6359 if (type == GL_FLOAT) {
6360 if (attr >= VERT_ATTRIB_GENERIC0) {
6361 base_op = OPCODE_ATTR_1F_ARB;
6362 attr -= VERT_ATTRIB_GENERIC0;
6363 } else {
6364 base_op = OPCODE_ATTR_1F_NV;
6365 }
6366 } else {
6367 base_op = OPCODE_ATTR_1I;
6368 attr -= VERT_ATTRIB_GENERIC0;
6369 }
6370
6371 n = alloc_instruction(ctx, base_op + size - 1, 1 + size);
6372 if (n) {
6373 n[1].ui = attr;
6374 n[2].ui = x;
6375 if (size >= 2) n[3].ui = y;
6376 if (size >= 3) n[4].ui = z;
6377 if (size >= 4) n[5].ui = w;
6378 }
6379
6380 ctx->ListState.ActiveAttribSize[index] = size;
6381 ASSIGN_4V(ctx->ListState.CurrentAttrib[index], x, y, z, w);
6382
6383 if (ctx->ExecuteFlag) {
6384 if (type == GL_FLOAT) {
6385 if (base_op == OPCODE_ATTR_1F_NV) {
6386 if (size == 4)
6387 CALL_VertexAttrib4fNV(ctx->Exec, (attr, uif(x), uif(y), uif(z), uif(w)));
6388 else if (size == 3)
6389 CALL_VertexAttrib3fNV(ctx->Exec, (attr, uif(x), uif(y), uif(z)));
6390 else if (size == 2)
6391 CALL_VertexAttrib2fNV(ctx->Exec, (attr, uif(x), uif(y)));
6392 else
6393 CALL_VertexAttrib1fNV(ctx->Exec, (attr, uif(x)));
6394 } else {
6395 if (size == 4)
6396 CALL_VertexAttrib4fARB(ctx->Exec, (attr, uif(x), uif(y), uif(z), uif(w)));
6397 else if (size == 3)
6398 CALL_VertexAttrib3fARB(ctx->Exec, (attr, uif(x), uif(y), uif(z)));
6399 else if (size == 2)
6400 CALL_VertexAttrib2fARB(ctx->Exec, (attr, uif(x), uif(y)));
6401 else
6402 CALL_VertexAttrib1fARB(ctx->Exec, (attr, uif(x)));
6403 }
6404 } else {
6405 if (size == 4)
6406 CALL_VertexAttribI4iEXT(ctx->Exec, (attr, x, y, z, w));
6407 else if (size == 3)
6408 CALL_VertexAttribI3iEXT(ctx->Exec, (attr, x, y, z));
6409 else if (size == 2)
6410 CALL_VertexAttribI2iEXT(ctx->Exec, (attr, x, y));
6411 else
6412 CALL_VertexAttribI1iEXT(ctx->Exec, (attr, x));
6413 }
6414 }
6415 }
6416
6417 static void ALWAYS_INLINE
6418 save_Attr64bit(struct gl_context *ctx, unsigned attr, unsigned size,
6419 GLenum type, uint64_t x, uint64_t y, uint64_t z, uint64_t w)
6420 {
6421 Node *n;
6422 SAVE_FLUSH_VERTICES(ctx);
6423 unsigned base_op;
6424 unsigned index = attr;
6425
6426 if (type == GL_DOUBLE) {
6427 base_op = OPCODE_ATTR_1D;
6428 } else {
6429 base_op = OPCODE_ATTR_1UI64;
6430 assert(size == 1);
6431 }
6432
6433 attr -= VERT_ATTRIB_GENERIC0;
6434 n = alloc_instruction(ctx, base_op + size - 1, 1 + size * 2);
6435 if (n) {
6436 n[1].ui = attr;
6437 ASSIGN_UINT64_TO_NODES(n, 2, x);
6438 if (size >= 2) ASSIGN_UINT64_TO_NODES(n, 4, y);
6439 if (size >= 3) ASSIGN_UINT64_TO_NODES(n, 6, z);
6440 if (size >= 4) ASSIGN_UINT64_TO_NODES(n, 8, w);
6441 }
6442
6443 ctx->ListState.ActiveAttribSize[index] = size;
6444 memcpy(ctx->ListState.CurrentAttrib[index], &n[2], size * sizeof(uint64_t));
6445
6446 if (ctx->ExecuteFlag) {
6447 uint64_t v[] = {x, y, z, w};
6448 if (type == GL_DOUBLE) {
6449 if (size == 4)
6450 CALL_VertexAttribL4dv(ctx->Exec, (attr, (GLdouble*)v));
6451 else if (size == 3)
6452 CALL_VertexAttribL3dv(ctx->Exec, (attr, (GLdouble*)v));
6453 else if (size == 2)
6454 CALL_VertexAttribL2dv(ctx->Exec, (attr, (GLdouble*)v));
6455 else
6456 CALL_VertexAttribL1d(ctx->Exec, (attr, UINT64_AS_DOUBLE(x)));
6457 } else {
6458 CALL_VertexAttribL1ui64ARB(ctx->Exec, (attr, x));
6459 }
6460 }
6461 }
6462
6463 /**
6464 * If index=0, does glVertexAttrib*() alias glVertex() to emit a vertex?
6465 * It depends on a few things, including whether we're inside or outside
6466 * of glBegin/glEnd.
6467 */
6468 static inline bool
6469 is_vertex_position(const struct gl_context *ctx, GLuint index)
6470 {
6471 return (index == 0 &&
6472 _mesa_attr_zero_aliases_vertex(ctx) &&
6473 _mesa_inside_dlist_begin_end(ctx));
6474 }
6475
6476 /**
6477 * This macro is used to implement all the glVertex, glColor, glTexCoord,
6478 * glVertexAttrib, etc functions.
6479 * \param A VBO_ATTRIB_x attribute index
6480 * \param N attribute size (1..4)
6481 * \param T type (GL_FLOAT, GL_DOUBLE, GL_INT, GL_UNSIGNED_INT)
6482 * \param C cast type (uint32_t or uint64_t)
6483 * \param V0, V1, v2, V3 attribute value
6484 */
6485 #define ATTR_UNION(A, N, T, C, V0, V1, V2, V3) \
6486 do { \
6487 if (sizeof(C) == 4) { \
6488 save_Attr32bit(ctx, A, N, T, V0, V1, V2, V3); \
6489 } else { \
6490 save_Attr64bit(ctx, A, N, T, V0, V1, V2, V3); \
6491 } \
6492 } while (0)
6493
6494 #undef ERROR
6495 #define ERROR(err) _mesa_error(ctx, err, __func__)
6496 #define TAG(x) save_##x
6497
6498 #define VBO_ATTRIB_POS VERT_ATTRIB_POS
6499 #define VBO_ATTRIB_NORMAL VERT_ATTRIB_NORMAL
6500 #define VBO_ATTRIB_COLOR0 VERT_ATTRIB_COLOR0
6501 #define VBO_ATTRIB_COLOR1 VERT_ATTRIB_COLOR1
6502 #define VBO_ATTRIB_FOG VERT_ATTRIB_FOG
6503 #define VBO_ATTRIB_COLOR_INDEX VERT_ATTRIB_COLOR_INDEX
6504 #define VBO_ATTRIB_EDGEFLAG VERT_ATTRIB_EDGEFLAG
6505 #define VBO_ATTRIB_TEX0 VERT_ATTRIB_TEX0
6506 #define VBO_ATTRIB_GENERIC0 VERT_ATTRIB_GENERIC0
6507 #define VBO_ATTRIB_MAX VERT_ATTRIB_MAX
6508
6509 #include "vbo/vbo_attrib_tmp.h"
6510
6511 static void GLAPIENTRY
6512 save_UseProgram(GLuint program)
6513 {
6514 GET_CURRENT_CONTEXT(ctx);
6515 Node *n;
6516 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6517 n = alloc_instruction(ctx, OPCODE_USE_PROGRAM, 1);
6518 if (n) {
6519 n[1].ui = program;
6520 }
6521 if (ctx->ExecuteFlag) {
6522 CALL_UseProgram(ctx->Exec, (program));
6523 }
6524 }
6525
6526
6527 static void GLAPIENTRY
6528 save_Uniform1fARB(GLint location, GLfloat x)
6529 {
6530 GET_CURRENT_CONTEXT(ctx);
6531 Node *n;
6532 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6533 n = alloc_instruction(ctx, OPCODE_UNIFORM_1F, 2);
6534 if (n) {
6535 n[1].i = location;
6536 n[2].f = x;
6537 }
6538 if (ctx->ExecuteFlag) {
6539 CALL_Uniform1f(ctx->Exec, (location, x));
6540 }
6541 }
6542
6543
6544 static void GLAPIENTRY
6545 save_Uniform2fARB(GLint location, GLfloat x, GLfloat y)
6546 {
6547 GET_CURRENT_CONTEXT(ctx);
6548 Node *n;
6549 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6550 n = alloc_instruction(ctx, OPCODE_UNIFORM_2F, 3);
6551 if (n) {
6552 n[1].i = location;
6553 n[2].f = x;
6554 n[3].f = y;
6555 }
6556 if (ctx->ExecuteFlag) {
6557 CALL_Uniform2f(ctx->Exec, (location, x, y));
6558 }
6559 }
6560
6561
6562 static void GLAPIENTRY
6563 save_Uniform3fARB(GLint location, GLfloat x, GLfloat y, GLfloat z)
6564 {
6565 GET_CURRENT_CONTEXT(ctx);
6566 Node *n;
6567 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6568 n = alloc_instruction(ctx, OPCODE_UNIFORM_3F, 4);
6569 if (n) {
6570 n[1].i = location;
6571 n[2].f = x;
6572 n[3].f = y;
6573 n[4].f = z;
6574 }
6575 if (ctx->ExecuteFlag) {
6576 CALL_Uniform3f(ctx->Exec, (location, x, y, z));
6577 }
6578 }
6579
6580
6581 static void GLAPIENTRY
6582 save_Uniform4fARB(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
6583 {
6584 GET_CURRENT_CONTEXT(ctx);
6585 Node *n;
6586 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6587 n = alloc_instruction(ctx, OPCODE_UNIFORM_4F, 5);
6588 if (n) {
6589 n[1].i = location;
6590 n[2].f = x;
6591 n[3].f = y;
6592 n[4].f = z;
6593 n[5].f = w;
6594 }
6595 if (ctx->ExecuteFlag) {
6596 CALL_Uniform4f(ctx->Exec, (location, x, y, z, w));
6597 }
6598 }
6599
6600
6601 static void GLAPIENTRY
6602 save_Uniform1fvARB(GLint location, GLsizei count, const GLfloat *v)
6603 {
6604 GET_CURRENT_CONTEXT(ctx);
6605 Node *n;
6606 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6607 n = alloc_instruction(ctx, OPCODE_UNIFORM_1FV, 2 + POINTER_DWORDS);
6608 if (n) {
6609 n[1].i = location;
6610 n[2].i = count;
6611 save_pointer(&n[3], memdup(v, count * 1 * sizeof(GLfloat)));
6612 }
6613 if (ctx->ExecuteFlag) {
6614 CALL_Uniform1fv(ctx->Exec, (location, count, v));
6615 }
6616 }
6617
6618 static void GLAPIENTRY
6619 save_Uniform2fvARB(GLint location, GLsizei count, const GLfloat *v)
6620 {
6621 GET_CURRENT_CONTEXT(ctx);
6622 Node *n;
6623 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6624 n = alloc_instruction(ctx, OPCODE_UNIFORM_2FV, 2 + POINTER_DWORDS);
6625 if (n) {
6626 n[1].i = location;
6627 n[2].i = count;
6628 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLfloat)));
6629 }
6630 if (ctx->ExecuteFlag) {
6631 CALL_Uniform2fv(ctx->Exec, (location, count, v));
6632 }
6633 }
6634
6635 static void GLAPIENTRY
6636 save_Uniform3fvARB(GLint location, GLsizei count, const GLfloat *v)
6637 {
6638 GET_CURRENT_CONTEXT(ctx);
6639 Node *n;
6640 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6641 n = alloc_instruction(ctx, OPCODE_UNIFORM_3FV, 2 + POINTER_DWORDS);
6642 if (n) {
6643 n[1].i = location;
6644 n[2].i = count;
6645 save_pointer(&n[3], memdup(v, count * 3 * sizeof(GLfloat)));
6646 }
6647 if (ctx->ExecuteFlag) {
6648 CALL_Uniform3fv(ctx->Exec, (location, count, v));
6649 }
6650 }
6651
6652 static void GLAPIENTRY
6653 save_Uniform4fvARB(GLint location, GLsizei count, const GLfloat *v)
6654 {
6655 GET_CURRENT_CONTEXT(ctx);
6656 Node *n;
6657 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6658 n = alloc_instruction(ctx, OPCODE_UNIFORM_4FV, 2 + POINTER_DWORDS);
6659 if (n) {
6660 n[1].i = location;
6661 n[2].i = count;
6662 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLfloat)));
6663 }
6664 if (ctx->ExecuteFlag) {
6665 CALL_Uniform4fv(ctx->Exec, (location, count, v));
6666 }
6667 }
6668
6669
6670 static void GLAPIENTRY
6671 save_Uniform1d(GLint location, GLdouble x)
6672 {
6673 GET_CURRENT_CONTEXT(ctx);
6674 Node *n;
6675 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6676 n = alloc_instruction(ctx, OPCODE_UNIFORM_1D, 3);
6677 if (n) {
6678 n[1].i = location;
6679 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
6680 }
6681 if (ctx->ExecuteFlag) {
6682 CALL_Uniform1d(ctx->Exec, (location, x));
6683 }
6684 }
6685
6686
6687 static void GLAPIENTRY
6688 save_Uniform2d(GLint location, GLdouble x, GLdouble y)
6689 {
6690 GET_CURRENT_CONTEXT(ctx);
6691 Node *n;
6692 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6693 n = alloc_instruction(ctx, OPCODE_UNIFORM_2D, 5);
6694 if (n) {
6695 n[1].i = location;
6696 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
6697 ASSIGN_DOUBLE_TO_NODES(n, 4, y);
6698 }
6699 if (ctx->ExecuteFlag) {
6700 CALL_Uniform2d(ctx->Exec, (location, x, y));
6701 }
6702 }
6703
6704
6705 static void GLAPIENTRY
6706 save_Uniform3d(GLint location, GLdouble x, GLdouble y, GLdouble z)
6707 {
6708 GET_CURRENT_CONTEXT(ctx);
6709 Node *n;
6710 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6711 n = alloc_instruction(ctx, OPCODE_UNIFORM_3D, 7);
6712 if (n) {
6713 n[1].i = location;
6714 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
6715 ASSIGN_DOUBLE_TO_NODES(n, 4, y);
6716 ASSIGN_DOUBLE_TO_NODES(n, 6, z);
6717 }
6718 if (ctx->ExecuteFlag) {
6719 CALL_Uniform3d(ctx->Exec, (location, x, y, z));
6720 }
6721 }
6722
6723
6724 static void GLAPIENTRY
6725 save_Uniform4d(GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
6726 {
6727 GET_CURRENT_CONTEXT(ctx);
6728 Node *n;
6729 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6730 n = alloc_instruction(ctx, OPCODE_UNIFORM_4D, 9);
6731 if (n) {
6732 n[1].i = location;
6733 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
6734 ASSIGN_DOUBLE_TO_NODES(n, 4, y);
6735 ASSIGN_DOUBLE_TO_NODES(n, 6, z);
6736 ASSIGN_DOUBLE_TO_NODES(n, 8, w);
6737 }
6738 if (ctx->ExecuteFlag) {
6739 CALL_Uniform4d(ctx->Exec, (location, x, y, z, w));
6740 }
6741 }
6742
6743
6744 static void GLAPIENTRY
6745 save_Uniform1dv(GLint location, GLsizei count, const GLdouble *v)
6746 {
6747 GET_CURRENT_CONTEXT(ctx);
6748 Node *n;
6749 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6750 n = alloc_instruction(ctx, OPCODE_UNIFORM_1DV, 2 + POINTER_DWORDS);
6751 if (n) {
6752 n[1].i = location;
6753 n[2].i = count;
6754 save_pointer(&n[3], memdup(v, count * 1 * sizeof(GLdouble)));
6755 }
6756 if (ctx->ExecuteFlag) {
6757 CALL_Uniform1dv(ctx->Exec, (location, count, v));
6758 }
6759 }
6760
6761
6762 static void GLAPIENTRY
6763 save_Uniform2dv(GLint location, GLsizei count, const GLdouble *v)
6764 {
6765 GET_CURRENT_CONTEXT(ctx);
6766 Node *n;
6767 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6768 n = alloc_instruction(ctx, OPCODE_UNIFORM_2DV, 2 + POINTER_DWORDS);
6769 if (n) {
6770 n[1].i = location;
6771 n[2].i = count;
6772 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLdouble)));
6773 }
6774 if (ctx->ExecuteFlag) {
6775 CALL_Uniform2dv(ctx->Exec, (location, count, v));
6776 }
6777 }
6778
6779
6780 static void GLAPIENTRY
6781 save_Uniform3dv(GLint location, GLsizei count, const GLdouble *v)
6782 {
6783 GET_CURRENT_CONTEXT(ctx);
6784 Node *n;
6785 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6786 n = alloc_instruction(ctx, OPCODE_UNIFORM_3DV, 2 + POINTER_DWORDS);
6787 if (n) {
6788 n[1].i = location;
6789 n[2].i = count;
6790 save_pointer(&n[3], memdup(v, count * 3 * sizeof(GLdouble)));
6791 }
6792 if (ctx->ExecuteFlag) {
6793 CALL_Uniform3dv(ctx->Exec, (location, count, v));
6794 }
6795 }
6796
6797
6798 static void GLAPIENTRY
6799 save_Uniform4dv(GLint location, GLsizei count, const GLdouble *v)
6800 {
6801 GET_CURRENT_CONTEXT(ctx);
6802 Node *n;
6803 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6804 n = alloc_instruction(ctx, OPCODE_UNIFORM_4DV, 2 + POINTER_DWORDS);
6805 if (n) {
6806 n[1].i = location;
6807 n[2].i = count;
6808 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLdouble)));
6809 }
6810 if (ctx->ExecuteFlag) {
6811 CALL_Uniform4dv(ctx->Exec, (location, count, v));
6812 }
6813 }
6814
6815
6816 static void GLAPIENTRY
6817 save_Uniform1iARB(GLint location, GLint x)
6818 {
6819 GET_CURRENT_CONTEXT(ctx);
6820 Node *n;
6821 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6822 n = alloc_instruction(ctx, OPCODE_UNIFORM_1I, 2);
6823 if (n) {
6824 n[1].i = location;
6825 n[2].i = x;
6826 }
6827 if (ctx->ExecuteFlag) {
6828 CALL_Uniform1i(ctx->Exec, (location, x));
6829 }
6830 }
6831
6832 static void GLAPIENTRY
6833 save_Uniform2iARB(GLint location, GLint x, GLint y)
6834 {
6835 GET_CURRENT_CONTEXT(ctx);
6836 Node *n;
6837 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6838 n = alloc_instruction(ctx, OPCODE_UNIFORM_2I, 3);
6839 if (n) {
6840 n[1].i = location;
6841 n[2].i = x;
6842 n[3].i = y;
6843 }
6844 if (ctx->ExecuteFlag) {
6845 CALL_Uniform2i(ctx->Exec, (location, x, y));
6846 }
6847 }
6848
6849 static void GLAPIENTRY
6850 save_Uniform3iARB(GLint location, GLint x, GLint y, GLint z)
6851 {
6852 GET_CURRENT_CONTEXT(ctx);
6853 Node *n;
6854 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6855 n = alloc_instruction(ctx, OPCODE_UNIFORM_3I, 4);
6856 if (n) {
6857 n[1].i = location;
6858 n[2].i = x;
6859 n[3].i = y;
6860 n[4].i = z;
6861 }
6862 if (ctx->ExecuteFlag) {
6863 CALL_Uniform3i(ctx->Exec, (location, x, y, z));
6864 }
6865 }
6866
6867 static void GLAPIENTRY
6868 save_Uniform4iARB(GLint location, GLint x, GLint y, GLint z, GLint w)
6869 {
6870 GET_CURRENT_CONTEXT(ctx);
6871 Node *n;
6872 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6873 n = alloc_instruction(ctx, OPCODE_UNIFORM_4I, 5);
6874 if (n) {
6875 n[1].i = location;
6876 n[2].i = x;
6877 n[3].i = y;
6878 n[4].i = z;
6879 n[5].i = w;
6880 }
6881 if (ctx->ExecuteFlag) {
6882 CALL_Uniform4i(ctx->Exec, (location, x, y, z, w));
6883 }
6884 }
6885
6886
6887
6888 static void GLAPIENTRY
6889 save_Uniform1ivARB(GLint location, GLsizei count, const GLint *v)
6890 {
6891 GET_CURRENT_CONTEXT(ctx);
6892 Node *n;
6893 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6894 n = alloc_instruction(ctx, OPCODE_UNIFORM_1IV, 2 + POINTER_DWORDS);
6895 if (n) {
6896 n[1].i = location;
6897 n[2].i = count;
6898 save_pointer(&n[3], memdup(v, count * 1 * sizeof(GLint)));
6899 }
6900 if (ctx->ExecuteFlag) {
6901 CALL_Uniform1iv(ctx->Exec, (location, count, v));
6902 }
6903 }
6904
6905 static void GLAPIENTRY
6906 save_Uniform2ivARB(GLint location, GLsizei count, const GLint *v)
6907 {
6908 GET_CURRENT_CONTEXT(ctx);
6909 Node *n;
6910 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6911 n = alloc_instruction(ctx, OPCODE_UNIFORM_2IV, 2 + POINTER_DWORDS);
6912 if (n) {
6913 n[1].i = location;
6914 n[2].i = count;
6915 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLint)));
6916 }
6917 if (ctx->ExecuteFlag) {
6918 CALL_Uniform2iv(ctx->Exec, (location, count, v));
6919 }
6920 }
6921
6922 static void GLAPIENTRY
6923 save_Uniform3ivARB(GLint location, GLsizei count, const GLint *v)
6924 {
6925 GET_CURRENT_CONTEXT(ctx);
6926 Node *n;
6927 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6928 n = alloc_instruction(ctx, OPCODE_UNIFORM_3IV, 2 + POINTER_DWORDS);
6929 if (n) {
6930 n[1].i = location;
6931 n[2].i = count;
6932 save_pointer(&n[3], memdup(v, count * 3 * sizeof(GLint)));
6933 }
6934 if (ctx->ExecuteFlag) {
6935 CALL_Uniform3iv(ctx->Exec, (location, count, v));
6936 }
6937 }
6938
6939 static void GLAPIENTRY
6940 save_Uniform4ivARB(GLint location, GLsizei count, const GLint *v)
6941 {
6942 GET_CURRENT_CONTEXT(ctx);
6943 Node *n;
6944 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6945 n = alloc_instruction(ctx, OPCODE_UNIFORM_4IV, 2 + POINTER_DWORDS);
6946 if (n) {
6947 n[1].i = location;
6948 n[2].i = count;
6949 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLfloat)));
6950 }
6951 if (ctx->ExecuteFlag) {
6952 CALL_Uniform4iv(ctx->Exec, (location, count, v));
6953 }
6954 }
6955
6956
6957
6958 static void GLAPIENTRY
6959 save_Uniform1ui(GLint location, GLuint x)
6960 {
6961 GET_CURRENT_CONTEXT(ctx);
6962 Node *n;
6963 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6964 n = alloc_instruction(ctx, OPCODE_UNIFORM_1UI, 2);
6965 if (n) {
6966 n[1].i = location;
6967 n[2].i = x;
6968 }
6969 if (ctx->ExecuteFlag) {
6970 CALL_Uniform1ui(ctx->Exec, (location, x));
6971 }
6972 }
6973
6974 static void GLAPIENTRY
6975 save_Uniform2ui(GLint location, GLuint x, GLuint y)
6976 {
6977 GET_CURRENT_CONTEXT(ctx);
6978 Node *n;
6979 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6980 n = alloc_instruction(ctx, OPCODE_UNIFORM_2UI, 3);
6981 if (n) {
6982 n[1].i = location;
6983 n[2].i = x;
6984 n[3].i = y;
6985 }
6986 if (ctx->ExecuteFlag) {
6987 CALL_Uniform2ui(ctx->Exec, (location, x, y));
6988 }
6989 }
6990
6991 static void GLAPIENTRY
6992 save_Uniform3ui(GLint location, GLuint x, GLuint y, GLuint z)
6993 {
6994 GET_CURRENT_CONTEXT(ctx);
6995 Node *n;
6996 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6997 n = alloc_instruction(ctx, OPCODE_UNIFORM_3UI, 4);
6998 if (n) {
6999 n[1].i = location;
7000 n[2].i = x;
7001 n[3].i = y;
7002 n[4].i = z;
7003 }
7004 if (ctx->ExecuteFlag) {
7005 CALL_Uniform3ui(ctx->Exec, (location, x, y, z));
7006 }
7007 }
7008
7009 static void GLAPIENTRY
7010 save_Uniform4ui(GLint location, GLuint x, GLuint y, GLuint z, GLuint w)
7011 {
7012 GET_CURRENT_CONTEXT(ctx);
7013 Node *n;
7014 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7015 n = alloc_instruction(ctx, OPCODE_UNIFORM_4UI, 5);
7016 if (n) {
7017 n[1].i = location;
7018 n[2].i = x;
7019 n[3].i = y;
7020 n[4].i = z;
7021 n[5].i = w;
7022 }
7023 if (ctx->ExecuteFlag) {
7024 CALL_Uniform4ui(ctx->Exec, (location, x, y, z, w));
7025 }
7026 }
7027
7028
7029
7030 static void GLAPIENTRY
7031 save_Uniform1uiv(GLint location, GLsizei count, const GLuint *v)
7032 {
7033 GET_CURRENT_CONTEXT(ctx);
7034 Node *n;
7035 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7036 n = alloc_instruction(ctx, OPCODE_UNIFORM_1UIV, 2 + POINTER_DWORDS);
7037 if (n) {
7038 n[1].i = location;
7039 n[2].i = count;
7040 save_pointer(&n[3], memdup(v, count * 1 * sizeof(*v)));
7041 }
7042 if (ctx->ExecuteFlag) {
7043 CALL_Uniform1uiv(ctx->Exec, (location, count, v));
7044 }
7045 }
7046
7047 static void GLAPIENTRY
7048 save_Uniform2uiv(GLint location, GLsizei count, const GLuint *v)
7049 {
7050 GET_CURRENT_CONTEXT(ctx);
7051 Node *n;
7052 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7053 n = alloc_instruction(ctx, OPCODE_UNIFORM_2UIV, 2 + POINTER_DWORDS);
7054 if (n) {
7055 n[1].i = location;
7056 n[2].i = count;
7057 save_pointer(&n[3], memdup(v, count * 2 * sizeof(*v)));
7058 }
7059 if (ctx->ExecuteFlag) {
7060 CALL_Uniform2uiv(ctx->Exec, (location, count, v));
7061 }
7062 }
7063
7064 static void GLAPIENTRY
7065 save_Uniform3uiv(GLint location, GLsizei count, const GLuint *v)
7066 {
7067 GET_CURRENT_CONTEXT(ctx);
7068 Node *n;
7069 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7070 n = alloc_instruction(ctx, OPCODE_UNIFORM_3UIV, 2 + POINTER_DWORDS);
7071 if (n) {
7072 n[1].i = location;
7073 n[2].i = count;
7074 save_pointer(&n[3], memdup(v, count * 3 * sizeof(*v)));
7075 }
7076 if (ctx->ExecuteFlag) {
7077 CALL_Uniform3uiv(ctx->Exec, (location, count, v));
7078 }
7079 }
7080
7081 static void GLAPIENTRY
7082 save_Uniform4uiv(GLint location, GLsizei count, const GLuint *v)
7083 {
7084 GET_CURRENT_CONTEXT(ctx);
7085 Node *n;
7086 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7087 n = alloc_instruction(ctx, OPCODE_UNIFORM_4UIV, 2 + POINTER_DWORDS);
7088 if (n) {
7089 n[1].i = location;
7090 n[2].i = count;
7091 save_pointer(&n[3], memdup(v, count * 4 * sizeof(*v)));
7092 }
7093 if (ctx->ExecuteFlag) {
7094 CALL_Uniform4uiv(ctx->Exec, (location, count, v));
7095 }
7096 }
7097
7098
7099
7100 static void GLAPIENTRY
7101 save_UniformMatrix2fvARB(GLint location, GLsizei count, GLboolean transpose,
7102 const GLfloat *m)
7103 {
7104 GET_CURRENT_CONTEXT(ctx);
7105 Node *n;
7106 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7107 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX22, 3 + POINTER_DWORDS);
7108 if (n) {
7109 n[1].i = location;
7110 n[2].i = count;
7111 n[3].b = transpose;
7112 save_pointer(&n[4], memdup(m, count * 2 * 2 * sizeof(GLfloat)));
7113 }
7114 if (ctx->ExecuteFlag) {
7115 CALL_UniformMatrix2fv(ctx->Exec, (location, count, transpose, m));
7116 }
7117 }
7118
7119 static void GLAPIENTRY
7120 save_UniformMatrix3fvARB(GLint location, GLsizei count, GLboolean transpose,
7121 const GLfloat *m)
7122 {
7123 GET_CURRENT_CONTEXT(ctx);
7124 Node *n;
7125 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7126 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX33, 3 + POINTER_DWORDS);
7127 if (n) {
7128 n[1].i = location;
7129 n[2].i = count;
7130 n[3].b = transpose;
7131 save_pointer(&n[4], memdup(m, count * 3 * 3 * sizeof(GLfloat)));
7132 }
7133 if (ctx->ExecuteFlag) {
7134 CALL_UniformMatrix3fv(ctx->Exec, (location, count, transpose, m));
7135 }
7136 }
7137
7138 static void GLAPIENTRY
7139 save_UniformMatrix4fvARB(GLint location, GLsizei count, GLboolean transpose,
7140 const GLfloat *m)
7141 {
7142 GET_CURRENT_CONTEXT(ctx);
7143 Node *n;
7144 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7145 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX44, 3 + POINTER_DWORDS);
7146 if (n) {
7147 n[1].i = location;
7148 n[2].i = count;
7149 n[3].b = transpose;
7150 save_pointer(&n[4], memdup(m, count * 4 * 4 * sizeof(GLfloat)));
7151 }
7152 if (ctx->ExecuteFlag) {
7153 CALL_UniformMatrix4fv(ctx->Exec, (location, count, transpose, m));
7154 }
7155 }
7156
7157
7158 static void GLAPIENTRY
7159 save_UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose,
7160 const GLfloat *m)
7161 {
7162 GET_CURRENT_CONTEXT(ctx);
7163 Node *n;
7164 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7165 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX23, 3 + POINTER_DWORDS);
7166 if (n) {
7167 n[1].i = location;
7168 n[2].i = count;
7169 n[3].b = transpose;
7170 save_pointer(&n[4], memdup(m, count * 2 * 3 * sizeof(GLfloat)));
7171 }
7172 if (ctx->ExecuteFlag) {
7173 CALL_UniformMatrix2x3fv(ctx->Exec, (location, count, transpose, m));
7174 }
7175 }
7176
7177 static void GLAPIENTRY
7178 save_UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose,
7179 const GLfloat *m)
7180 {
7181 GET_CURRENT_CONTEXT(ctx);
7182 Node *n;
7183 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7184 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX32, 3 + POINTER_DWORDS);
7185 if (n) {
7186 n[1].i = location;
7187 n[2].i = count;
7188 n[3].b = transpose;
7189 save_pointer(&n[4], memdup(m, count * 3 * 2 * sizeof(GLfloat)));
7190 }
7191 if (ctx->ExecuteFlag) {
7192 CALL_UniformMatrix3x2fv(ctx->Exec, (location, count, transpose, m));
7193 }
7194 }
7195
7196
7197 static void GLAPIENTRY
7198 save_UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose,
7199 const GLfloat *m)
7200 {
7201 GET_CURRENT_CONTEXT(ctx);
7202 Node *n;
7203 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7204 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX24, 3 + POINTER_DWORDS);
7205 if (n) {
7206 n[1].i = location;
7207 n[2].i = count;
7208 n[3].b = transpose;
7209 save_pointer(&n[4], memdup(m, count * 2 * 4 * sizeof(GLfloat)));
7210 }
7211 if (ctx->ExecuteFlag) {
7212 CALL_UniformMatrix2x4fv(ctx->Exec, (location, count, transpose, m));
7213 }
7214 }
7215
7216 static void GLAPIENTRY
7217 save_UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose,
7218 const GLfloat *m)
7219 {
7220 GET_CURRENT_CONTEXT(ctx);
7221 Node *n;
7222 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7223 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX42, 3 + POINTER_DWORDS);
7224 if (n) {
7225 n[1].i = location;
7226 n[2].i = count;
7227 n[3].b = transpose;
7228 save_pointer(&n[4], memdup(m, count * 4 * 2 * sizeof(GLfloat)));
7229 }
7230 if (ctx->ExecuteFlag) {
7231 CALL_UniformMatrix4x2fv(ctx->Exec, (location, count, transpose, m));
7232 }
7233 }
7234
7235
7236 static void GLAPIENTRY
7237 save_UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose,
7238 const GLfloat *m)
7239 {
7240 GET_CURRENT_CONTEXT(ctx);
7241 Node *n;
7242 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7243 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX34, 3 + POINTER_DWORDS);
7244 if (n) {
7245 n[1].i = location;
7246 n[2].i = count;
7247 n[3].b = transpose;
7248 save_pointer(&n[4], memdup(m, count * 3 * 4 * sizeof(GLfloat)));
7249 }
7250 if (ctx->ExecuteFlag) {
7251 CALL_UniformMatrix3x4fv(ctx->Exec, (location, count, transpose, m));
7252 }
7253 }
7254
7255 static void GLAPIENTRY
7256 save_UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose,
7257 const GLfloat *m)
7258 {
7259 GET_CURRENT_CONTEXT(ctx);
7260 Node *n;
7261 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7262 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX43, 3 + POINTER_DWORDS);
7263 if (n) {
7264 n[1].i = location;
7265 n[2].i = count;
7266 n[3].b = transpose;
7267 save_pointer(&n[4], memdup(m, count * 4 * 3 * sizeof(GLfloat)));
7268 }
7269 if (ctx->ExecuteFlag) {
7270 CALL_UniformMatrix4x3fv(ctx->Exec, (location, count, transpose, m));
7271 }
7272 }
7273
7274
7275 static void GLAPIENTRY
7276 save_UniformMatrix2dv(GLint location, GLsizei count, GLboolean transpose,
7277 const GLdouble *m)
7278 {
7279 GET_CURRENT_CONTEXT(ctx);
7280 Node *n;
7281 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7282 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX22D, 3 + POINTER_DWORDS);
7283 if (n) {
7284 n[1].i = location;
7285 n[2].i = count;
7286 n[3].b = transpose;
7287 save_pointer(&n[4], memdup(m, count * 2 * 2 * sizeof(GLdouble)));
7288 }
7289 if (ctx->ExecuteFlag) {
7290 CALL_UniformMatrix2dv(ctx->Exec, (location, count, transpose, m));
7291 }
7292 }
7293
7294 static void GLAPIENTRY
7295 save_UniformMatrix3dv(GLint location, GLsizei count, GLboolean transpose,
7296 const GLdouble *m)
7297 {
7298 GET_CURRENT_CONTEXT(ctx);
7299 Node *n;
7300 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7301 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX33D, 3 + POINTER_DWORDS);
7302 if (n) {
7303 n[1].i = location;
7304 n[2].i = count;
7305 n[3].b = transpose;
7306 save_pointer(&n[4], memdup(m, count * 3 * 3 * sizeof(GLdouble)));
7307 }
7308 if (ctx->ExecuteFlag) {
7309 CALL_UniformMatrix3dv(ctx->Exec, (location, count, transpose, m));
7310 }
7311 }
7312
7313 static void GLAPIENTRY
7314 save_UniformMatrix4dv(GLint location, GLsizei count, GLboolean transpose,
7315 const GLdouble *m)
7316 {
7317 GET_CURRENT_CONTEXT(ctx);
7318 Node *n;
7319 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7320 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX44D, 3 + POINTER_DWORDS);
7321 if (n) {
7322 n[1].i = location;
7323 n[2].i = count;
7324 n[3].b = transpose;
7325 save_pointer(&n[4], memdup(m, count * 4 * 4 * sizeof(GLdouble)));
7326 }
7327 if (ctx->ExecuteFlag) {
7328 CALL_UniformMatrix4dv(ctx->Exec, (location, count, transpose, m));
7329 }
7330 }
7331
7332
7333 static void GLAPIENTRY
7334 save_UniformMatrix2x3dv(GLint location, GLsizei count, GLboolean transpose,
7335 const GLdouble *m)
7336 {
7337 GET_CURRENT_CONTEXT(ctx);
7338 Node *n;
7339 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7340 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX23D, 3 + POINTER_DWORDS);
7341 if (n) {
7342 n[1].i = location;
7343 n[2].i = count;
7344 n[3].b = transpose;
7345 save_pointer(&n[4], memdup(m, count * 2 * 3 * sizeof(GLdouble)));
7346 }
7347 if (ctx->ExecuteFlag) {
7348 CALL_UniformMatrix2x3dv(ctx->Exec, (location, count, transpose, m));
7349 }
7350 }
7351
7352
7353 static void GLAPIENTRY
7354 save_UniformMatrix3x2dv(GLint location, GLsizei count, GLboolean transpose,
7355 const GLdouble *m)
7356 {
7357 GET_CURRENT_CONTEXT(ctx);
7358 Node *n;
7359 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7360 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX32D, 3 + POINTER_DWORDS);
7361 if (n) {
7362 n[1].i = location;
7363 n[2].i = count;
7364 n[3].b = transpose;
7365 save_pointer(&n[4], memdup(m, count * 3 * 2 * sizeof(GLdouble)));
7366 }
7367 if (ctx->ExecuteFlag) {
7368 CALL_UniformMatrix3x2dv(ctx->Exec, (location, count, transpose, m));
7369 }
7370 }
7371
7372
7373 static void GLAPIENTRY
7374 save_UniformMatrix2x4dv(GLint location, GLsizei count, GLboolean transpose,
7375 const GLdouble *m)
7376 {
7377 GET_CURRENT_CONTEXT(ctx);
7378 Node *n;
7379 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7380 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX24D, 3 + POINTER_DWORDS);
7381 if (n) {
7382 n[1].i = location;
7383 n[2].i = count;
7384 n[3].b = transpose;
7385 save_pointer(&n[4], memdup(m, count * 2 * 4 * sizeof(GLdouble)));
7386 }
7387 if (ctx->ExecuteFlag) {
7388 CALL_UniformMatrix2x4dv(ctx->Exec, (location, count, transpose, m));
7389 }
7390 }
7391
7392 static void GLAPIENTRY
7393 save_UniformMatrix4x2dv(GLint location, GLsizei count, GLboolean transpose,
7394 const GLdouble *m)
7395 {
7396 GET_CURRENT_CONTEXT(ctx);
7397 Node *n;
7398 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7399 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX42D, 3 + POINTER_DWORDS);
7400 if (n) {
7401 n[1].i = location;
7402 n[2].i = count;
7403 n[3].b = transpose;
7404 save_pointer(&n[4], memdup(m, count * 4 * 2 * sizeof(GLdouble)));
7405 }
7406 if (ctx->ExecuteFlag) {
7407 CALL_UniformMatrix4x2dv(ctx->Exec, (location, count, transpose, m));
7408 }
7409 }
7410
7411
7412 static void GLAPIENTRY
7413 save_UniformMatrix3x4dv(GLint location, GLsizei count, GLboolean transpose,
7414 const GLdouble *m)
7415 {
7416 GET_CURRENT_CONTEXT(ctx);
7417 Node *n;
7418 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7419 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX34D, 3 + POINTER_DWORDS);
7420 if (n) {
7421 n[1].i = location;
7422 n[2].i = count;
7423 n[3].b = transpose;
7424 save_pointer(&n[4], memdup(m, count * 3 * 4 * sizeof(GLdouble)));
7425 }
7426 if (ctx->ExecuteFlag) {
7427 CALL_UniformMatrix3x4dv(ctx->Exec, (location, count, transpose, m));
7428 }
7429 }
7430
7431
7432 static void GLAPIENTRY
7433 save_UniformMatrix4x3dv(GLint location, GLsizei count, GLboolean transpose,
7434 const GLdouble *m)
7435 {
7436 GET_CURRENT_CONTEXT(ctx);
7437 Node *n;
7438 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7439 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX43D, 3 + POINTER_DWORDS);
7440 if (n) {
7441 n[1].i = location;
7442 n[2].i = count;
7443 n[3].b = transpose;
7444 save_pointer(&n[4], memdup(m, count * 4 * 3 * sizeof(GLdouble)));
7445 }
7446 if (ctx->ExecuteFlag) {
7447 CALL_UniformMatrix4x3dv(ctx->Exec, (location, count, transpose, m));
7448 }
7449 }
7450
7451 static void GLAPIENTRY
7452 save_Uniform1i64ARB(GLint location, GLint64 x)
7453 {
7454 GET_CURRENT_CONTEXT(ctx);
7455 Node *n;
7456 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7457 n = alloc_instruction(ctx, OPCODE_UNIFORM_1I64, 3);
7458 if (n) {
7459 n[1].i = location;
7460 ASSIGN_INT64_TO_NODES(n, 2, x);
7461 }
7462 if (ctx->ExecuteFlag) {
7463 CALL_Uniform1i64ARB(ctx->Exec, (location, x));
7464 }
7465 }
7466
7467 static void GLAPIENTRY
7468 save_Uniform2i64ARB(GLint location, GLint64 x, GLint64 y)
7469 {
7470 GET_CURRENT_CONTEXT(ctx);
7471 Node *n;
7472 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7473 n = alloc_instruction(ctx, OPCODE_UNIFORM_2I64, 5);
7474 if (n) {
7475 n[1].i = location;
7476 ASSIGN_INT64_TO_NODES(n, 2, x);
7477 ASSIGN_INT64_TO_NODES(n, 4, y);
7478 }
7479 if (ctx->ExecuteFlag) {
7480 CALL_Uniform2i64ARB(ctx->Exec, (location, x, y));
7481 }
7482 }
7483
7484 static void GLAPIENTRY
7485 save_Uniform3i64ARB(GLint location, GLint64 x, GLint64 y, GLint64 z)
7486 {
7487 GET_CURRENT_CONTEXT(ctx);
7488 Node *n;
7489 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7490 n = alloc_instruction(ctx, OPCODE_UNIFORM_3I64, 7);
7491 if (n) {
7492 n[1].i = location;
7493 ASSIGN_INT64_TO_NODES(n, 2, x);
7494 ASSIGN_INT64_TO_NODES(n, 4, y);
7495 ASSIGN_INT64_TO_NODES(n, 6, z);
7496 }
7497 if (ctx->ExecuteFlag) {
7498 CALL_Uniform3i64ARB(ctx->Exec, (location, x, y, z));
7499 }
7500 }
7501
7502 static void GLAPIENTRY
7503 save_Uniform4i64ARB(GLint location, GLint64 x, GLint64 y, GLint64 z, GLint64 w)
7504 {
7505 GET_CURRENT_CONTEXT(ctx);
7506 Node *n;
7507 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7508 n = alloc_instruction(ctx, OPCODE_UNIFORM_4I64, 9);
7509 if (n) {
7510 n[1].i = location;
7511 ASSIGN_INT64_TO_NODES(n, 2, x);
7512 ASSIGN_INT64_TO_NODES(n, 4, y);
7513 ASSIGN_INT64_TO_NODES(n, 6, z);
7514 ASSIGN_INT64_TO_NODES(n, 8, w);
7515 }
7516 if (ctx->ExecuteFlag) {
7517 CALL_Uniform4i64ARB(ctx->Exec, (location, x, y, z, w));
7518 }
7519 }
7520
7521 static void GLAPIENTRY
7522 save_Uniform1i64vARB(GLint location, GLsizei count, const GLint64 *v)
7523 {
7524 GET_CURRENT_CONTEXT(ctx);
7525 Node *n;
7526 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7527 n = alloc_instruction(ctx, OPCODE_UNIFORM_1I64V, 2 + POINTER_DWORDS);
7528 if (n) {
7529 n[1].i = location;
7530 n[2].i = count;
7531 save_pointer(&n[3], memdup(v, count * 1 * sizeof(GLint64)));
7532 }
7533 if (ctx->ExecuteFlag) {
7534 CALL_Uniform1i64vARB(ctx->Exec, (location, count, v));
7535 }
7536 }
7537
7538 static void GLAPIENTRY
7539 save_Uniform2i64vARB(GLint location, GLsizei count, const GLint64 *v)
7540 {
7541 GET_CURRENT_CONTEXT(ctx);
7542 Node *n;
7543 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7544 n = alloc_instruction(ctx, OPCODE_UNIFORM_2I64V, 2 + POINTER_DWORDS);
7545 if (n) {
7546 n[1].i = location;
7547 n[2].i = count;
7548 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLint64)));
7549 }
7550 if (ctx->ExecuteFlag) {
7551 CALL_Uniform2i64vARB(ctx->Exec, (location, count, v));
7552 }
7553 }
7554
7555 static void GLAPIENTRY
7556 save_Uniform3i64vARB(GLint location, GLsizei count, const GLint64 *v)
7557 {
7558 GET_CURRENT_CONTEXT(ctx);
7559 Node *n;
7560 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7561 n = alloc_instruction(ctx, OPCODE_UNIFORM_3I64V, 2 + POINTER_DWORDS);
7562 if (n) {
7563 n[1].i = location;
7564 n[2].i = count;
7565 save_pointer(&n[3], memdup(v, count * 3 * sizeof(GLint64)));
7566 }
7567 if (ctx->ExecuteFlag) {
7568 CALL_Uniform3i64vARB(ctx->Exec, (location, count, v));
7569 }
7570 }
7571
7572 static void GLAPIENTRY
7573 save_Uniform4i64vARB(GLint location, GLsizei count, const GLint64 *v)
7574 {
7575 GET_CURRENT_CONTEXT(ctx);
7576 Node *n;
7577 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7578 n = alloc_instruction(ctx, OPCODE_UNIFORM_4I64V, 2 + POINTER_DWORDS);
7579 if (n) {
7580 n[1].i = location;
7581 n[2].i = count;
7582 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLint64)));
7583 }
7584 if (ctx->ExecuteFlag) {
7585 CALL_Uniform4i64vARB(ctx->Exec, (location, count, v));
7586 }
7587 }
7588
7589 static void GLAPIENTRY
7590 save_Uniform1ui64ARB(GLint location, GLuint64 x)
7591 {
7592 GET_CURRENT_CONTEXT(ctx);
7593 Node *n;
7594 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7595 n = alloc_instruction(ctx, OPCODE_UNIFORM_1UI64, 3);
7596 if (n) {
7597 n[1].i = location;
7598 ASSIGN_UINT64_TO_NODES(n, 2, x);
7599 }
7600 if (ctx->ExecuteFlag) {
7601 CALL_Uniform1ui64ARB(ctx->Exec, (location, x));
7602 }
7603 }
7604
7605 static void GLAPIENTRY
7606 save_Uniform2ui64ARB(GLint location, GLuint64 x, GLuint64 y)
7607 {
7608 GET_CURRENT_CONTEXT(ctx);
7609 Node *n;
7610 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7611 n = alloc_instruction(ctx, OPCODE_UNIFORM_2UI64, 5);
7612 if (n) {
7613 n[1].i = location;
7614 ASSIGN_UINT64_TO_NODES(n, 2, x);
7615 ASSIGN_UINT64_TO_NODES(n, 4, y);
7616 }
7617 if (ctx->ExecuteFlag) {
7618 CALL_Uniform2ui64ARB(ctx->Exec, (location, x, y));
7619 }
7620 }
7621
7622 static void GLAPIENTRY
7623 save_Uniform3ui64ARB(GLint location, GLuint64 x, GLuint64 y, GLuint64 z)
7624 {
7625 GET_CURRENT_CONTEXT(ctx);
7626 Node *n;
7627 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7628 n = alloc_instruction(ctx, OPCODE_UNIFORM_3UI64, 7);
7629 if (n) {
7630 n[1].i = location;
7631 ASSIGN_UINT64_TO_NODES(n, 2, x);
7632 ASSIGN_UINT64_TO_NODES(n, 4, y);
7633 ASSIGN_UINT64_TO_NODES(n, 6, z);
7634 }
7635 if (ctx->ExecuteFlag) {
7636 CALL_Uniform3ui64ARB(ctx->Exec, (location, x, y, z));
7637 }
7638 }
7639
7640 static void GLAPIENTRY
7641 save_Uniform4ui64ARB(GLint location, GLuint64 x, GLuint64 y, GLuint64 z, GLuint64 w)
7642 {
7643 GET_CURRENT_CONTEXT(ctx);
7644 Node *n;
7645 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7646 n = alloc_instruction(ctx, OPCODE_UNIFORM_4UI64, 9);
7647 if (n) {
7648 n[1].i = location;
7649 ASSIGN_UINT64_TO_NODES(n, 2, x);
7650 ASSIGN_UINT64_TO_NODES(n, 4, y);
7651 ASSIGN_UINT64_TO_NODES(n, 6, z);
7652 ASSIGN_UINT64_TO_NODES(n, 8, w);
7653 }
7654 if (ctx->ExecuteFlag) {
7655 CALL_Uniform4ui64ARB(ctx->Exec, (location, x, y, z, w));
7656 }
7657 }
7658
7659 static void GLAPIENTRY
7660 save_Uniform1ui64vARB(GLint location, GLsizei count, const GLuint64 *v)
7661 {
7662 GET_CURRENT_CONTEXT(ctx);
7663 Node *n;
7664 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7665 n = alloc_instruction(ctx, OPCODE_UNIFORM_1UI64V, 2 + POINTER_DWORDS);
7666 if (n) {
7667 n[1].i = location;
7668 n[2].i = count;
7669 save_pointer(&n[3], memdup(v, count * 1 * sizeof(GLuint64)));
7670 }
7671 if (ctx->ExecuteFlag) {
7672 CALL_Uniform1ui64vARB(ctx->Exec, (location, count, v));
7673 }
7674 }
7675
7676 static void GLAPIENTRY
7677 save_Uniform2ui64vARB(GLint location, GLsizei count, const GLuint64 *v)
7678 {
7679 GET_CURRENT_CONTEXT(ctx);
7680 Node *n;
7681 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7682 n = alloc_instruction(ctx, OPCODE_UNIFORM_2UI64V, 2 + POINTER_DWORDS);
7683 if (n) {
7684 n[1].i = location;
7685 n[2].i = count;
7686 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLuint64)));
7687 }
7688 if (ctx->ExecuteFlag) {
7689 CALL_Uniform2ui64vARB(ctx->Exec, (location, count, v));
7690 }
7691 }
7692
7693 static void GLAPIENTRY
7694 save_Uniform3ui64vARB(GLint location, GLsizei count, const GLuint64 *v)
7695 {
7696 GET_CURRENT_CONTEXT(ctx);
7697 Node *n;
7698 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7699 n = alloc_instruction(ctx, OPCODE_UNIFORM_3UI64V, 2 + POINTER_DWORDS);
7700 if (n) {
7701 n[1].i = location;
7702 n[2].i = count;
7703 save_pointer(&n[3], memdup(v, count * 3 * sizeof(GLuint64)));
7704 }
7705 if (ctx->ExecuteFlag) {
7706 CALL_Uniform3ui64vARB(ctx->Exec, (location, count, v));
7707 }
7708 }
7709
7710 static void GLAPIENTRY
7711 save_Uniform4ui64vARB(GLint location, GLsizei count, const GLuint64 *v)
7712 {
7713 GET_CURRENT_CONTEXT(ctx);
7714 Node *n;
7715 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7716 n = alloc_instruction(ctx, OPCODE_UNIFORM_4UI64V, 2 + POINTER_DWORDS);
7717 if (n) {
7718 n[1].i = location;
7719 n[2].i = count;
7720 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLuint64)));
7721 }
7722 if (ctx->ExecuteFlag) {
7723 CALL_Uniform4ui64vARB(ctx->Exec, (location, count, v));
7724 }
7725 }
7726
7727 static void GLAPIENTRY
7728 save_ProgramUniform1i64ARB(GLuint program, GLint location, GLint64 x)
7729 {
7730 GET_CURRENT_CONTEXT(ctx);
7731 Node *n;
7732 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7733 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1I64, 4);
7734 if (n) {
7735 n[1].ui = program;
7736 n[2].i = location;
7737 ASSIGN_INT64_TO_NODES(n, 3, x);
7738 }
7739 if (ctx->ExecuteFlag) {
7740 CALL_ProgramUniform1i64ARB(ctx->Exec, (program, location, x));
7741 }
7742 }
7743
7744 static void GLAPIENTRY
7745 save_ProgramUniform2i64ARB(GLuint program, GLint location, GLint64 x,
7746 GLint64 y)
7747 {
7748 GET_CURRENT_CONTEXT(ctx);
7749 Node *n;
7750 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7751 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2I64, 6);
7752 if (n) {
7753 n[1].ui = program;
7754 n[2].i = location;
7755 ASSIGN_INT64_TO_NODES(n, 3, x);
7756 ASSIGN_INT64_TO_NODES(n, 5, y);
7757 }
7758 if (ctx->ExecuteFlag) {
7759 CALL_ProgramUniform2i64ARB(ctx->Exec, (program, location, x, y));
7760 }
7761 }
7762
7763 static void GLAPIENTRY
7764 save_ProgramUniform3i64ARB(GLuint program, GLint location, GLint64 x,
7765 GLint64 y, GLint64 z)
7766 {
7767 GET_CURRENT_CONTEXT(ctx);
7768 Node *n;
7769 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7770 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3I64, 8);
7771 if (n) {
7772 n[1].ui = program;
7773 n[2].i = location;
7774 ASSIGN_INT64_TO_NODES(n, 3, x);
7775 ASSIGN_INT64_TO_NODES(n, 5, y);
7776 ASSIGN_INT64_TO_NODES(n, 7, z);
7777 }
7778 if (ctx->ExecuteFlag) {
7779 CALL_ProgramUniform3i64ARB(ctx->Exec, (program, location, x, y, z));
7780 }
7781 }
7782
7783 static void GLAPIENTRY
7784 save_ProgramUniform4i64ARB(GLuint program, GLint location, GLint64 x,
7785 GLint64 y, GLint64 z, GLint64 w)
7786 {
7787 GET_CURRENT_CONTEXT(ctx);
7788 Node *n;
7789 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7790 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4I64, 10);
7791 if (n) {
7792 n[1].ui = program;
7793 n[2].i = location;
7794 ASSIGN_INT64_TO_NODES(n, 3, x);
7795 ASSIGN_INT64_TO_NODES(n, 5, y);
7796 ASSIGN_INT64_TO_NODES(n, 7, z);
7797 ASSIGN_INT64_TO_NODES(n, 9, w);
7798 }
7799 if (ctx->ExecuteFlag) {
7800 CALL_ProgramUniform4i64ARB(ctx->Exec, (program, location, x, y, z, w));
7801 }
7802 }
7803
7804 static void GLAPIENTRY
7805 save_ProgramUniform1i64vARB(GLuint program, GLint location, GLsizei count,
7806 const GLint64 *v)
7807 {
7808 GET_CURRENT_CONTEXT(ctx);
7809 Node *n;
7810 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7811 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1I64V, 3 + POINTER_DWORDS);
7812 if (n) {
7813 n[1].ui = program;
7814 n[2].i = location;
7815 n[3].i = count;
7816 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLint64)));
7817 }
7818 if (ctx->ExecuteFlag) {
7819 CALL_ProgramUniform1i64vARB(ctx->Exec, (program, location, count, v));
7820 }
7821 }
7822
7823 static void GLAPIENTRY
7824 save_ProgramUniform2i64vARB(GLuint program, GLint location, GLsizei count,
7825 const GLint64 *v)
7826 {
7827 GET_CURRENT_CONTEXT(ctx);
7828 Node *n;
7829 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7830 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2I64V, 3 + POINTER_DWORDS);
7831 if (n) {
7832 n[1].ui = program;
7833 n[2].i = location;
7834 n[3].i = count;
7835 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLint64)));
7836 }
7837 if (ctx->ExecuteFlag) {
7838 CALL_ProgramUniform2i64vARB(ctx->Exec, (program, location, count, v));
7839 }
7840 }
7841
7842 static void GLAPIENTRY
7843 save_ProgramUniform3i64vARB(GLuint program, GLint location, GLsizei count,
7844 const GLint64 *v)
7845 {
7846 GET_CURRENT_CONTEXT(ctx);
7847 Node *n;
7848 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7849 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3I64V, 3 + POINTER_DWORDS);
7850 if (n) {
7851 n[1].ui = program;
7852 n[2].i = location;
7853 n[3].i = count;
7854 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLint64)));
7855 }
7856 if (ctx->ExecuteFlag) {
7857 CALL_ProgramUniform3i64vARB(ctx->Exec, (program, location, count, v));
7858 }
7859 }
7860
7861 static void GLAPIENTRY
7862 save_ProgramUniform4i64vARB(GLuint program, GLint location, GLsizei count,
7863 const GLint64 *v)
7864 {
7865 GET_CURRENT_CONTEXT(ctx);
7866 Node *n;
7867 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7868 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4I64V, 3 + POINTER_DWORDS);
7869 if (n) {
7870 n[1].ui = program;
7871 n[2].i = location;
7872 n[3].i = count;
7873 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLint64)));
7874 }
7875 if (ctx->ExecuteFlag) {
7876 CALL_ProgramUniform4i64vARB(ctx->Exec, (program, location, count, v));
7877 }
7878 }
7879
7880 static void GLAPIENTRY
7881 save_ProgramUniform1ui64ARB(GLuint program, GLint location, GLuint64 x)
7882 {
7883 GET_CURRENT_CONTEXT(ctx);
7884 Node *n;
7885 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7886 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1UI64, 4);
7887 if (n) {
7888 n[1].ui = program;
7889 n[2].i = location;
7890 ASSIGN_UINT64_TO_NODES(n, 3, x);
7891 }
7892 if (ctx->ExecuteFlag) {
7893 CALL_ProgramUniform1ui64ARB(ctx->Exec, (program, location, x));
7894 }
7895 }
7896
7897 static void GLAPIENTRY
7898 save_ProgramUniform2ui64ARB(GLuint program, GLint location, GLuint64 x,
7899 GLuint64 y)
7900 {
7901 GET_CURRENT_CONTEXT(ctx);
7902 Node *n;
7903 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7904 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2UI64, 6);
7905 if (n) {
7906 n[1].ui = program;
7907 n[2].i = location;
7908 ASSIGN_UINT64_TO_NODES(n, 3, x);
7909 ASSIGN_UINT64_TO_NODES(n, 5, y);
7910 }
7911 if (ctx->ExecuteFlag) {
7912 CALL_ProgramUniform2ui64ARB(ctx->Exec, (program, location, x, y));
7913 }
7914 }
7915
7916 static void GLAPIENTRY
7917 save_ProgramUniform3ui64ARB(GLuint program, GLint location, GLuint64 x,
7918 GLuint64 y, GLuint64 z)
7919 {
7920 GET_CURRENT_CONTEXT(ctx);
7921 Node *n;
7922 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7923 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3UI64, 8);
7924 if (n) {
7925 n[1].ui = program;
7926 n[2].i = location;
7927 ASSIGN_UINT64_TO_NODES(n, 3, x);
7928 ASSIGN_UINT64_TO_NODES(n, 5, y);
7929 ASSIGN_UINT64_TO_NODES(n, 7, z);
7930 }
7931 if (ctx->ExecuteFlag) {
7932 CALL_ProgramUniform3ui64ARB(ctx->Exec, (program, location, x, y, z));
7933 }
7934 }
7935
7936 static void GLAPIENTRY
7937 save_ProgramUniform4ui64ARB(GLuint program, GLint location, GLuint64 x,
7938 GLuint64 y, GLuint64 z, GLuint64 w)
7939 {
7940 GET_CURRENT_CONTEXT(ctx);
7941 Node *n;
7942 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7943 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4UI64, 10);
7944 if (n) {
7945 n[1].ui = program;
7946 n[2].i = location;
7947 ASSIGN_UINT64_TO_NODES(n, 3, x);
7948 ASSIGN_UINT64_TO_NODES(n, 5, y);
7949 ASSIGN_UINT64_TO_NODES(n, 7, z);
7950 ASSIGN_UINT64_TO_NODES(n, 9, w);
7951 }
7952 if (ctx->ExecuteFlag) {
7953 CALL_ProgramUniform4i64ARB(ctx->Exec, (program, location, x, y, z, w));
7954 }
7955 }
7956
7957 static void GLAPIENTRY
7958 save_ProgramUniform1ui64vARB(GLuint program, GLint location, GLsizei count,
7959 const GLuint64 *v)
7960 {
7961 GET_CURRENT_CONTEXT(ctx);
7962 Node *n;
7963 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7964 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1UI64V,
7965 3 + POINTER_DWORDS);
7966 if (n) {
7967 n[1].ui = program;
7968 n[2].i = location;
7969 n[3].i = count;
7970 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLuint64)));
7971 }
7972 if (ctx->ExecuteFlag) {
7973 CALL_ProgramUniform1ui64vARB(ctx->Exec, (program, location, count, v));
7974 }
7975 }
7976
7977 static void GLAPIENTRY
7978 save_ProgramUniform2ui64vARB(GLuint program, GLint location, GLsizei count,
7979 const GLuint64 *v)
7980 {
7981 GET_CURRENT_CONTEXT(ctx);
7982 Node *n;
7983 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7984 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2UI64V,
7985 3 + POINTER_DWORDS);
7986 if (n) {
7987 n[1].ui = program;
7988 n[2].i = location;
7989 n[3].i = count;
7990 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLuint64)));
7991 }
7992 if (ctx->ExecuteFlag) {
7993 CALL_ProgramUniform2ui64vARB(ctx->Exec, (program, location, count, v));
7994 }
7995 }
7996
7997 static void GLAPIENTRY
7998 save_ProgramUniform3ui64vARB(GLuint program, GLint location, GLsizei count,
7999 const GLuint64 *v)
8000 {
8001 GET_CURRENT_CONTEXT(ctx);
8002 Node *n;
8003 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8004 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3UI64V,
8005 3 + POINTER_DWORDS);
8006 if (n) {
8007 n[1].ui = program;
8008 n[2].i = location;
8009 n[3].i = count;
8010 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLuint64)));
8011 }
8012 if (ctx->ExecuteFlag) {
8013 CALL_ProgramUniform3ui64vARB(ctx->Exec, (program, location, count, v));
8014 }
8015 }
8016
8017 static void GLAPIENTRY
8018 save_ProgramUniform4ui64vARB(GLuint program, GLint location, GLsizei count,
8019 const GLuint64 *v)
8020 {
8021 GET_CURRENT_CONTEXT(ctx);
8022 Node *n;
8023 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8024 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4UI64V,
8025 3 + POINTER_DWORDS);
8026 if (n) {
8027 n[1].ui = program;
8028 n[2].i = location;
8029 n[3].i = count;
8030 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLuint64)));
8031 }
8032 if (ctx->ExecuteFlag) {
8033 CALL_ProgramUniform4ui64vARB(ctx->Exec, (program, location, count, v));
8034 }
8035 }
8036
8037
8038 static void GLAPIENTRY
8039 save_UseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program)
8040 {
8041 GET_CURRENT_CONTEXT(ctx);
8042 Node *n;
8043 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8044 n = alloc_instruction(ctx, OPCODE_USE_PROGRAM_STAGES, 3);
8045 if (n) {
8046 n[1].ui = pipeline;
8047 n[2].ui = stages;
8048 n[3].ui = program;
8049 }
8050 if (ctx->ExecuteFlag) {
8051 CALL_UseProgramStages(ctx->Exec, (pipeline, stages, program));
8052 }
8053 }
8054
8055 static void GLAPIENTRY
8056 save_ProgramUniform1f(GLuint program, GLint location, GLfloat x)
8057 {
8058 GET_CURRENT_CONTEXT(ctx);
8059 Node *n;
8060 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8061 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1F, 3);
8062 if (n) {
8063 n[1].ui = program;
8064 n[2].i = location;
8065 n[3].f = x;
8066 }
8067 if (ctx->ExecuteFlag) {
8068 CALL_ProgramUniform1f(ctx->Exec, (program, location, x));
8069 }
8070 }
8071
8072 static void GLAPIENTRY
8073 save_ProgramUniform2f(GLuint program, GLint location, GLfloat x, GLfloat y)
8074 {
8075 GET_CURRENT_CONTEXT(ctx);
8076 Node *n;
8077 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8078 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2F, 4);
8079 if (n) {
8080 n[1].ui = program;
8081 n[2].i = location;
8082 n[3].f = x;
8083 n[4].f = y;
8084 }
8085 if (ctx->ExecuteFlag) {
8086 CALL_ProgramUniform2f(ctx->Exec, (program, location, x, y));
8087 }
8088 }
8089
8090 static void GLAPIENTRY
8091 save_ProgramUniform3f(GLuint program, GLint location,
8092 GLfloat x, GLfloat y, GLfloat z)
8093 {
8094 GET_CURRENT_CONTEXT(ctx);
8095 Node *n;
8096 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8097 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3F, 5);
8098 if (n) {
8099 n[1].ui = program;
8100 n[2].i = location;
8101 n[3].f = x;
8102 n[4].f = y;
8103 n[5].f = z;
8104 }
8105 if (ctx->ExecuteFlag) {
8106 CALL_ProgramUniform3f(ctx->Exec, (program, location, x, y, z));
8107 }
8108 }
8109
8110 static void GLAPIENTRY
8111 save_ProgramUniform4f(GLuint program, GLint location,
8112 GLfloat x, GLfloat y, GLfloat z, GLfloat w)
8113 {
8114 GET_CURRENT_CONTEXT(ctx);
8115 Node *n;
8116 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8117 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4F, 6);
8118 if (n) {
8119 n[1].ui = program;
8120 n[2].i = location;
8121 n[3].f = x;
8122 n[4].f = y;
8123 n[5].f = z;
8124 n[6].f = w;
8125 }
8126 if (ctx->ExecuteFlag) {
8127 CALL_ProgramUniform4f(ctx->Exec, (program, location, x, y, z, w));
8128 }
8129 }
8130
8131 static void GLAPIENTRY
8132 save_ProgramUniform1fv(GLuint program, GLint location, GLsizei count,
8133 const GLfloat *v)
8134 {
8135 GET_CURRENT_CONTEXT(ctx);
8136 Node *n;
8137 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8138 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1FV, 3 + POINTER_DWORDS);
8139 if (n) {
8140 n[1].ui = program;
8141 n[2].i = location;
8142 n[3].i = count;
8143 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLfloat)));
8144 }
8145 if (ctx->ExecuteFlag) {
8146 CALL_ProgramUniform1fv(ctx->Exec, (program, location, count, v));
8147 }
8148 }
8149
8150 static void GLAPIENTRY
8151 save_ProgramUniform2fv(GLuint program, GLint location, GLsizei count,
8152 const GLfloat *v)
8153 {
8154 GET_CURRENT_CONTEXT(ctx);
8155 Node *n;
8156 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8157 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2FV, 3 + POINTER_DWORDS);
8158 if (n) {
8159 n[1].ui = program;
8160 n[2].i = location;
8161 n[3].i = count;
8162 save_pointer(&n[4], memdup(v, count * 2 * sizeof(GLfloat)));
8163 }
8164 if (ctx->ExecuteFlag) {
8165 CALL_ProgramUniform2fv(ctx->Exec, (program, location, count, v));
8166 }
8167 }
8168
8169 static void GLAPIENTRY
8170 save_ProgramUniform3fv(GLuint program, GLint location, GLsizei count,
8171 const GLfloat *v)
8172 {
8173 GET_CURRENT_CONTEXT(ctx);
8174 Node *n;
8175 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8176 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3FV, 3 + POINTER_DWORDS);
8177 if (n) {
8178 n[1].ui = program;
8179 n[2].i = location;
8180 n[3].i = count;
8181 save_pointer(&n[4], memdup(v, count * 3 * sizeof(GLfloat)));
8182 }
8183 if (ctx->ExecuteFlag) {
8184 CALL_ProgramUniform3fv(ctx->Exec, (program, location, count, v));
8185 }
8186 }
8187
8188 static void GLAPIENTRY
8189 save_ProgramUniform4fv(GLuint program, GLint location, GLsizei count,
8190 const GLfloat *v)
8191 {
8192 GET_CURRENT_CONTEXT(ctx);
8193 Node *n;
8194 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8195 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4FV, 3 + POINTER_DWORDS);
8196 if (n) {
8197 n[1].ui = program;
8198 n[2].i = location;
8199 n[3].i = count;
8200 save_pointer(&n[4], memdup(v, count * 4 * sizeof(GLfloat)));
8201 }
8202 if (ctx->ExecuteFlag) {
8203 CALL_ProgramUniform4fv(ctx->Exec, (program, location, count, v));
8204 }
8205 }
8206
8207 static void GLAPIENTRY
8208 save_ProgramUniform1d(GLuint program, GLint location, GLdouble x)
8209 {
8210 GET_CURRENT_CONTEXT(ctx);
8211 Node *n;
8212 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8213 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1D, 4);
8214 if (n) {
8215 n[1].ui = program;
8216 n[2].i = location;
8217 ASSIGN_DOUBLE_TO_NODES(n, 3, x);
8218 }
8219 if (ctx->ExecuteFlag) {
8220 CALL_ProgramUniform1d(ctx->Exec, (program, location, x));
8221 }
8222 }
8223
8224 static void GLAPIENTRY
8225 save_ProgramUniform2d(GLuint program, GLint location, GLdouble x, GLdouble y)
8226 {
8227 GET_CURRENT_CONTEXT(ctx);
8228 Node *n;
8229 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8230 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2D, 6);
8231 if (n) {
8232 n[1].ui = program;
8233 n[2].i = location;
8234 ASSIGN_DOUBLE_TO_NODES(n, 3, x);
8235 ASSIGN_DOUBLE_TO_NODES(n, 5, y);
8236 }
8237 if (ctx->ExecuteFlag) {
8238 CALL_ProgramUniform2d(ctx->Exec, (program, location, x, y));
8239 }
8240 }
8241
8242 static void GLAPIENTRY
8243 save_ProgramUniform3d(GLuint program, GLint location,
8244 GLdouble x, GLdouble y, GLdouble z)
8245 {
8246 GET_CURRENT_CONTEXT(ctx);
8247 Node *n;
8248 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8249 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3D, 8);
8250 if (n) {
8251 n[1].ui = program;
8252 n[2].i = location;
8253 ASSIGN_DOUBLE_TO_NODES(n, 3, x);
8254 ASSIGN_DOUBLE_TO_NODES(n, 5, y);
8255 ASSIGN_DOUBLE_TO_NODES(n, 7, z);
8256 }
8257 if (ctx->ExecuteFlag) {
8258 CALL_ProgramUniform3d(ctx->Exec, (program, location, x, y, z));
8259 }
8260 }
8261
8262 static void GLAPIENTRY
8263 save_ProgramUniform4d(GLuint program, GLint location,
8264 GLdouble x, GLdouble y, GLdouble z, GLdouble w)
8265 {
8266 GET_CURRENT_CONTEXT(ctx);
8267 Node *n;
8268 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8269 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4D, 10);
8270 if (n) {
8271 n[1].ui = program;
8272 n[2].i = location;
8273 ASSIGN_DOUBLE_TO_NODES(n, 3, x);
8274 ASSIGN_DOUBLE_TO_NODES(n, 5, y);
8275 ASSIGN_DOUBLE_TO_NODES(n, 7, z);
8276 ASSIGN_DOUBLE_TO_NODES(n, 9, w);
8277 }
8278 if (ctx->ExecuteFlag) {
8279 CALL_ProgramUniform4d(ctx->Exec, (program, location, x, y, z, w));
8280 }
8281 }
8282
8283 static void GLAPIENTRY
8284 save_ProgramUniform1dv(GLuint program, GLint location, GLsizei count,
8285 const GLdouble *v)
8286 {
8287 GET_CURRENT_CONTEXT(ctx);
8288 Node *n;
8289 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8290 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1DV, 3 + POINTER_DWORDS);
8291 if (n) {
8292 n[1].ui = program;
8293 n[2].i = location;
8294 n[3].i = count;
8295 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLdouble)));
8296 }
8297 if (ctx->ExecuteFlag) {
8298 CALL_ProgramUniform1dv(ctx->Exec, (program, location, count, v));
8299 }
8300 }
8301
8302 static void GLAPIENTRY
8303 save_ProgramUniform2dv(GLuint program, GLint location, GLsizei count,
8304 const GLdouble *v)
8305 {
8306 GET_CURRENT_CONTEXT(ctx);
8307 Node *n;
8308 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8309 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2DV, 3 + POINTER_DWORDS);
8310 if (n) {
8311 n[1].ui = program;
8312 n[2].i = location;
8313 n[3].i = count;
8314 save_pointer(&n[4], memdup(v, count * 2 * sizeof(GLdouble)));
8315 }
8316 if (ctx->ExecuteFlag) {
8317 CALL_ProgramUniform2dv(ctx->Exec, (program, location, count, v));
8318 }
8319 }
8320
8321 static void GLAPIENTRY
8322 save_ProgramUniform3dv(GLuint program, GLint location, GLsizei count,
8323 const GLdouble *v)
8324 {
8325 GET_CURRENT_CONTEXT(ctx);
8326 Node *n;
8327 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8328 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3DV, 3 + POINTER_DWORDS);
8329 if (n) {
8330 n[1].ui = program;
8331 n[2].i = location;
8332 n[3].i = count;
8333 save_pointer(&n[4], memdup(v, count * 3 * sizeof(GLdouble)));
8334 }
8335 if (ctx->ExecuteFlag) {
8336 CALL_ProgramUniform3dv(ctx->Exec, (program, location, count, v));
8337 }
8338 }
8339
8340 static void GLAPIENTRY
8341 save_ProgramUniform4dv(GLuint program, GLint location, GLsizei count,
8342 const GLdouble *v)
8343 {
8344 GET_CURRENT_CONTEXT(ctx);
8345 Node *n;
8346 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8347 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4DV, 3 + POINTER_DWORDS);
8348 if (n) {
8349 n[1].ui = program;
8350 n[2].i = location;
8351 n[3].i = count;
8352 save_pointer(&n[4], memdup(v, count * 4 * sizeof(GLdouble)));
8353 }
8354 if (ctx->ExecuteFlag) {
8355 CALL_ProgramUniform4dv(ctx->Exec, (program, location, count, v));
8356 }
8357 }
8358
8359 static void GLAPIENTRY
8360 save_ProgramUniform1i(GLuint program, GLint location, GLint x)
8361 {
8362 GET_CURRENT_CONTEXT(ctx);
8363 Node *n;
8364 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8365 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1I, 3);
8366 if (n) {
8367 n[1].ui = program;
8368 n[2].i = location;
8369 n[3].i = x;
8370 }
8371 if (ctx->ExecuteFlag) {
8372 CALL_ProgramUniform1i(ctx->Exec, (program, location, x));
8373 }
8374 }
8375
8376 static void GLAPIENTRY
8377 save_ProgramUniform2i(GLuint program, GLint location, GLint x, GLint y)
8378 {
8379 GET_CURRENT_CONTEXT(ctx);
8380 Node *n;
8381 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8382 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2I, 4);
8383 if (n) {
8384 n[1].ui = program;
8385 n[2].i = location;
8386 n[3].i = x;
8387 n[4].i = y;
8388 }
8389 if (ctx->ExecuteFlag) {
8390 CALL_ProgramUniform2i(ctx->Exec, (program, location, x, y));
8391 }
8392 }
8393
8394 static void GLAPIENTRY
8395 save_ProgramUniform3i(GLuint program, GLint location,
8396 GLint x, GLint y, GLint z)
8397 {
8398 GET_CURRENT_CONTEXT(ctx);
8399 Node *n;
8400 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8401 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3I, 5);
8402 if (n) {
8403 n[1].ui = program;
8404 n[2].i = location;
8405 n[3].i = x;
8406 n[4].i = y;
8407 n[5].i = z;
8408 }
8409 if (ctx->ExecuteFlag) {
8410 CALL_ProgramUniform3i(ctx->Exec, (program, location, x, y, z));
8411 }
8412 }
8413
8414 static void GLAPIENTRY
8415 save_ProgramUniform4i(GLuint program, GLint location,
8416 GLint x, GLint y, GLint z, GLint w)
8417 {
8418 GET_CURRENT_CONTEXT(ctx);
8419 Node *n;
8420 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8421 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4I, 6);
8422 if (n) {
8423 n[1].ui = program;
8424 n[2].i = location;
8425 n[3].i = x;
8426 n[4].i = y;
8427 n[5].i = z;
8428 n[6].i = w;
8429 }
8430 if (ctx->ExecuteFlag) {
8431 CALL_ProgramUniform4i(ctx->Exec, (program, location, x, y, z, w));
8432 }
8433 }
8434
8435 static void GLAPIENTRY
8436 save_ProgramUniform1iv(GLuint program, GLint location, GLsizei count,
8437 const GLint *v)
8438 {
8439 GET_CURRENT_CONTEXT(ctx);
8440 Node *n;
8441 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8442 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1IV, 3 + POINTER_DWORDS);
8443 if (n) {
8444 n[1].ui = program;
8445 n[2].i = location;
8446 n[3].i = count;
8447 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLint)));
8448 }
8449 if (ctx->ExecuteFlag) {
8450 CALL_ProgramUniform1iv(ctx->Exec, (program, location, count, v));
8451 }
8452 }
8453
8454 static void GLAPIENTRY
8455 save_ProgramUniform2iv(GLuint program, GLint location, GLsizei count,
8456 const GLint *v)
8457 {
8458 GET_CURRENT_CONTEXT(ctx);
8459 Node *n;
8460 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8461 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2IV, 3 + POINTER_DWORDS);
8462 if (n) {
8463 n[1].ui = program;
8464 n[2].i = location;
8465 n[3].i = count;
8466 save_pointer(&n[4], memdup(v, count * 2 * sizeof(GLint)));
8467 }
8468 if (ctx->ExecuteFlag) {
8469 CALL_ProgramUniform2iv(ctx->Exec, (program, location, count, v));
8470 }
8471 }
8472
8473 static void GLAPIENTRY
8474 save_ProgramUniform3iv(GLuint program, GLint location, GLsizei count,
8475 const GLint *v)
8476 {
8477 GET_CURRENT_CONTEXT(ctx);
8478 Node *n;
8479 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8480 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3IV, 3 + POINTER_DWORDS);
8481 if (n) {
8482 n[1].ui = program;
8483 n[2].i = location;
8484 n[3].i = count;
8485 save_pointer(&n[4], memdup(v, count * 3 * sizeof(GLint)));
8486 }
8487 if (ctx->ExecuteFlag) {
8488 CALL_ProgramUniform3iv(ctx->Exec, (program, location, count, v));
8489 }
8490 }
8491
8492 static void GLAPIENTRY
8493 save_ProgramUniform4iv(GLuint program, GLint location, GLsizei count,
8494 const GLint *v)
8495 {
8496 GET_CURRENT_CONTEXT(ctx);
8497 Node *n;
8498 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8499 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4IV, 3 + POINTER_DWORDS);
8500 if (n) {
8501 n[1].ui = program;
8502 n[2].i = location;
8503 n[3].i = count;
8504 save_pointer(&n[4], memdup(v, count * 4 * sizeof(GLint)));
8505 }
8506 if (ctx->ExecuteFlag) {
8507 CALL_ProgramUniform4iv(ctx->Exec, (program, location, count, v));
8508 }
8509 }
8510
8511 static void GLAPIENTRY
8512 save_ProgramUniform1ui(GLuint program, GLint location, GLuint x)
8513 {
8514 GET_CURRENT_CONTEXT(ctx);
8515 Node *n;
8516 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8517 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1UI, 3);
8518 if (n) {
8519 n[1].ui = program;
8520 n[2].i = location;
8521 n[3].ui = x;
8522 }
8523 if (ctx->ExecuteFlag) {
8524 CALL_ProgramUniform1ui(ctx->Exec, (program, location, x));
8525 }
8526 }
8527
8528 static void GLAPIENTRY
8529 save_ProgramUniform2ui(GLuint program, GLint location, GLuint x, GLuint y)
8530 {
8531 GET_CURRENT_CONTEXT(ctx);
8532 Node *n;
8533 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8534 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2UI, 4);
8535 if (n) {
8536 n[1].ui = program;
8537 n[2].i = location;
8538 n[3].ui = x;
8539 n[4].ui = y;
8540 }
8541 if (ctx->ExecuteFlag) {
8542 CALL_ProgramUniform2ui(ctx->Exec, (program, location, x, y));
8543 }
8544 }
8545
8546 static void GLAPIENTRY
8547 save_ProgramUniform3ui(GLuint program, GLint location,
8548 GLuint x, GLuint y, GLuint z)
8549 {
8550 GET_CURRENT_CONTEXT(ctx);
8551 Node *n;
8552 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8553 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3UI, 5);
8554 if (n) {
8555 n[1].ui = program;
8556 n[2].i = location;
8557 n[3].ui = x;
8558 n[4].ui = y;
8559 n[5].ui = z;
8560 }
8561 if (ctx->ExecuteFlag) {
8562 CALL_ProgramUniform3ui(ctx->Exec, (program, location, x, y, z));
8563 }
8564 }
8565
8566 static void GLAPIENTRY
8567 save_ProgramUniform4ui(GLuint program, GLint location,
8568 GLuint x, GLuint y, GLuint z, GLuint w)
8569 {
8570 GET_CURRENT_CONTEXT(ctx);
8571 Node *n;
8572 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8573 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4UI, 6);
8574 if (n) {
8575 n[1].ui = program;
8576 n[2].i = location;
8577 n[3].ui = x;
8578 n[4].ui = y;
8579 n[5].ui = z;
8580 n[6].ui = w;
8581 }
8582 if (ctx->ExecuteFlag) {
8583 CALL_ProgramUniform4ui(ctx->Exec, (program, location, x, y, z, w));
8584 }
8585 }
8586
8587 static void GLAPIENTRY
8588 save_ProgramUniform1uiv(GLuint program, GLint location, GLsizei count,
8589 const GLuint *v)
8590 {
8591 GET_CURRENT_CONTEXT(ctx);
8592 Node *n;
8593 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8594 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1UIV, 3 + POINTER_DWORDS);
8595 if (n) {
8596 n[1].ui = program;
8597 n[2].i = location;
8598 n[3].i = count;
8599 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLuint)));
8600 }
8601 if (ctx->ExecuteFlag) {
8602 CALL_ProgramUniform1uiv(ctx->Exec, (program, location, count, v));
8603 }
8604 }
8605
8606 static void GLAPIENTRY
8607 save_ProgramUniform2uiv(GLuint program, GLint location, GLsizei count,
8608 const GLuint *v)
8609 {
8610 GET_CURRENT_CONTEXT(ctx);
8611 Node *n;
8612 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8613 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2UIV, 3 + POINTER_DWORDS);
8614 if (n) {
8615 n[1].ui = program;
8616 n[2].i = location;
8617 n[3].i = count;
8618 save_pointer(&n[4], memdup(v, count * 2 * sizeof(GLuint)));
8619 }
8620 if (ctx->ExecuteFlag) {
8621 CALL_ProgramUniform2uiv(ctx->Exec, (program, location, count, v));
8622 }
8623 }
8624
8625 static void GLAPIENTRY
8626 save_ProgramUniform3uiv(GLuint program, GLint location, GLsizei count,
8627 const GLuint *v)
8628 {
8629 GET_CURRENT_CONTEXT(ctx);
8630 Node *n;
8631 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8632 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3UIV, 3 + POINTER_DWORDS);
8633 if (n) {
8634 n[1].ui = program;
8635 n[2].i = location;
8636 n[3].i = count;
8637 save_pointer(&n[4], memdup(v, count * 3 * sizeof(GLuint)));
8638 }
8639 if (ctx->ExecuteFlag) {
8640 CALL_ProgramUniform3uiv(ctx->Exec, (program, location, count, v));
8641 }
8642 }
8643
8644 static void GLAPIENTRY
8645 save_ProgramUniform4uiv(GLuint program, GLint location, GLsizei count,
8646 const GLuint *v)
8647 {
8648 GET_CURRENT_CONTEXT(ctx);
8649 Node *n;
8650 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8651 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4UIV, 3 + POINTER_DWORDS);
8652 if (n) {
8653 n[1].ui = program;
8654 n[2].i = location;
8655 n[3].i = count;
8656 save_pointer(&n[4], memdup(v, count * 4 * sizeof(GLuint)));
8657 }
8658 if (ctx->ExecuteFlag) {
8659 CALL_ProgramUniform4uiv(ctx->Exec, (program, location, count, v));
8660 }
8661 }
8662
8663 static void GLAPIENTRY
8664 save_ProgramUniformMatrix2fv(GLuint program, GLint location, GLsizei count,
8665 GLboolean transpose, const GLfloat *v)
8666 {
8667 GET_CURRENT_CONTEXT(ctx);
8668 Node *n;
8669 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8670 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX22F,
8671 4 + POINTER_DWORDS);
8672 if (n) {
8673 n[1].ui = program;
8674 n[2].i = location;
8675 n[3].i = count;
8676 n[4].b = transpose;
8677 save_pointer(&n[5], memdup(v, count * 2 * 2 * sizeof(GLfloat)));
8678 }
8679 if (ctx->ExecuteFlag) {
8680 CALL_ProgramUniformMatrix2fv(ctx->Exec,
8681 (program, location, count, transpose, v));
8682 }
8683 }
8684
8685 static void GLAPIENTRY
8686 save_ProgramUniformMatrix2x3fv(GLuint program, GLint location, GLsizei count,
8687 GLboolean transpose, const GLfloat *v)
8688 {
8689 GET_CURRENT_CONTEXT(ctx);
8690 Node *n;
8691 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8692 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX23F,
8693 4 + POINTER_DWORDS);
8694 if (n) {
8695 n[1].ui = program;
8696 n[2].i = location;
8697 n[3].i = count;
8698 n[4].b = transpose;
8699 save_pointer(&n[5], memdup(v, count * 2 * 3 * sizeof(GLfloat)));
8700 }
8701 if (ctx->ExecuteFlag) {
8702 CALL_ProgramUniformMatrix2x3fv(ctx->Exec,
8703 (program, location, count, transpose, v));
8704 }
8705 }
8706
8707 static void GLAPIENTRY
8708 save_ProgramUniformMatrix2x4fv(GLuint program, GLint location, GLsizei count,
8709 GLboolean transpose, const GLfloat *v)
8710 {
8711 GET_CURRENT_CONTEXT(ctx);
8712 Node *n;
8713 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8714 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX24F,
8715 4 + POINTER_DWORDS);
8716 if (n) {
8717 n[1].ui = program;
8718 n[2].i = location;
8719 n[3].i = count;
8720 n[4].b = transpose;
8721 save_pointer(&n[5], memdup(v, count * 2 * 4 * sizeof(GLfloat)));
8722 }
8723 if (ctx->ExecuteFlag) {
8724 CALL_ProgramUniformMatrix2x4fv(ctx->Exec,
8725 (program, location, count, transpose, v));
8726 }
8727 }
8728
8729 static void GLAPIENTRY
8730 save_ProgramUniformMatrix3x2fv(GLuint program, GLint location, GLsizei count,
8731 GLboolean transpose, const GLfloat *v)
8732 {
8733 GET_CURRENT_CONTEXT(ctx);
8734 Node *n;
8735 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8736 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX32F,
8737 4 + POINTER_DWORDS);
8738 if (n) {
8739 n[1].ui = program;
8740 n[2].i = location;
8741 n[3].i = count;
8742 n[4].b = transpose;
8743 save_pointer(&n[5], memdup(v, count * 3 * 2 * sizeof(GLfloat)));
8744 }
8745 if (ctx->ExecuteFlag) {
8746 CALL_ProgramUniformMatrix3x2fv(ctx->Exec,
8747 (program, location, count, transpose, v));
8748 }
8749 }
8750
8751 static void GLAPIENTRY
8752 save_ProgramUniformMatrix3fv(GLuint program, GLint location, GLsizei count,
8753 GLboolean transpose, const GLfloat *v)
8754 {
8755 GET_CURRENT_CONTEXT(ctx);
8756 Node *n;
8757 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8758 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX33F,
8759 4 + POINTER_DWORDS);
8760 if (n) {
8761 n[1].ui = program;
8762 n[2].i = location;
8763 n[3].i = count;
8764 n[4].b = transpose;
8765 save_pointer(&n[5], memdup(v, count * 3 * 3 * sizeof(GLfloat)));
8766 }
8767 if (ctx->ExecuteFlag) {
8768 CALL_ProgramUniformMatrix3fv(ctx->Exec,
8769 (program, location, count, transpose, v));
8770 }
8771 }
8772
8773 static void GLAPIENTRY
8774 save_ProgramUniformMatrix3x4fv(GLuint program, GLint location, GLsizei count,
8775 GLboolean transpose, const GLfloat *v)
8776 {
8777 GET_CURRENT_CONTEXT(ctx);
8778 Node *n;
8779 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8780 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX34F,
8781 4 + POINTER_DWORDS);
8782 if (n) {
8783 n[1].ui = program;
8784 n[2].i = location;
8785 n[3].i = count;
8786 n[4].b = transpose;
8787 save_pointer(&n[5], memdup(v, count * 3 * 4 * sizeof(GLfloat)));
8788 }
8789 if (ctx->ExecuteFlag) {
8790 CALL_ProgramUniformMatrix3x4fv(ctx->Exec,
8791 (program, location, count, transpose, v));
8792 }
8793 }
8794
8795 static void GLAPIENTRY
8796 save_ProgramUniformMatrix4x2fv(GLuint program, GLint location, GLsizei count,
8797 GLboolean transpose, const GLfloat *v)
8798 {
8799 GET_CURRENT_CONTEXT(ctx);
8800 Node *n;
8801 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8802 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX42F,
8803 4 + POINTER_DWORDS);
8804 if (n) {
8805 n[1].ui = program;
8806 n[2].i = location;
8807 n[3].i = count;
8808 n[4].b = transpose;
8809 save_pointer(&n[5], memdup(v, count * 4 * 2 * sizeof(GLfloat)));
8810 }
8811 if (ctx->ExecuteFlag) {
8812 CALL_ProgramUniformMatrix4x2fv(ctx->Exec,
8813 (program, location, count, transpose, v));
8814 }
8815 }
8816
8817 static void GLAPIENTRY
8818 save_ProgramUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count,
8819 GLboolean transpose, const GLfloat *v)
8820 {
8821 GET_CURRENT_CONTEXT(ctx);
8822 Node *n;
8823 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8824 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX43F,
8825 4 + POINTER_DWORDS);
8826 if (n) {
8827 n[1].ui = program;
8828 n[2].i = location;
8829 n[3].i = count;
8830 n[4].b = transpose;
8831 save_pointer(&n[5], memdup(v, count * 4 * 3 * sizeof(GLfloat)));
8832 }
8833 if (ctx->ExecuteFlag) {
8834 CALL_ProgramUniformMatrix4x3fv(ctx->Exec,
8835 (program, location, count, transpose, v));
8836 }
8837 }
8838
8839 static void GLAPIENTRY
8840 save_ProgramUniformMatrix4fv(GLuint program, GLint location, GLsizei count,
8841 GLboolean transpose, const GLfloat *v)
8842 {
8843 GET_CURRENT_CONTEXT(ctx);
8844 Node *n;
8845 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8846 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX44F,
8847 4 + POINTER_DWORDS);
8848 if (n) {
8849 n[1].ui = program;
8850 n[2].i = location;
8851 n[3].i = count;
8852 n[4].b = transpose;
8853 save_pointer(&n[5], memdup(v, count * 4 * 4 * sizeof(GLfloat)));
8854 }
8855 if (ctx->ExecuteFlag) {
8856 CALL_ProgramUniformMatrix4fv(ctx->Exec,
8857 (program, location, count, transpose, v));
8858 }
8859 }
8860
8861 static void GLAPIENTRY
8862 save_ProgramUniformMatrix2dv(GLuint program, GLint location, GLsizei count,
8863 GLboolean transpose, const GLdouble *v)
8864 {
8865 GET_CURRENT_CONTEXT(ctx);
8866 Node *n;
8867 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8868 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX22D,
8869 4 + POINTER_DWORDS);
8870 if (n) {
8871 n[1].ui = program;
8872 n[2].i = location;
8873 n[3].i = count;
8874 n[4].b = transpose;
8875 save_pointer(&n[5], memdup(v, count * 2 * 2 * sizeof(GLdouble)));
8876 }
8877 if (ctx->ExecuteFlag) {
8878 CALL_ProgramUniformMatrix2dv(ctx->Exec,
8879 (program, location, count, transpose, v));
8880 }
8881 }
8882
8883 static void GLAPIENTRY
8884 save_ProgramUniformMatrix2x3dv(GLuint program, GLint location, GLsizei count,
8885 GLboolean transpose, const GLdouble *v)
8886 {
8887 GET_CURRENT_CONTEXT(ctx);
8888 Node *n;
8889 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8890 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX23D,
8891 4 + POINTER_DWORDS);
8892 if (n) {
8893 n[1].ui = program;
8894 n[2].i = location;
8895 n[3].i = count;
8896 n[4].b = transpose;
8897 save_pointer(&n[5], memdup(v, count * 2 * 3 * sizeof(GLdouble)));
8898 }
8899 if (ctx->ExecuteFlag) {
8900 CALL_ProgramUniformMatrix2x3dv(ctx->Exec,
8901 (program, location, count, transpose, v));
8902 }
8903 }
8904
8905 static void GLAPIENTRY
8906 save_ProgramUniformMatrix2x4dv(GLuint program, GLint location, GLsizei count,
8907 GLboolean transpose, const GLdouble *v)
8908 {
8909 GET_CURRENT_CONTEXT(ctx);
8910 Node *n;
8911 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8912 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX24D,
8913 4 + POINTER_DWORDS);
8914 if (n) {
8915 n[1].ui = program;
8916 n[2].i = location;
8917 n[3].i = count;
8918 n[4].b = transpose;
8919 save_pointer(&n[5], memdup(v, count * 2 * 4 * sizeof(GLdouble)));
8920 }
8921 if (ctx->ExecuteFlag) {
8922 CALL_ProgramUniformMatrix2x4dv(ctx->Exec,
8923 (program, location, count, transpose, v));
8924 }
8925 }
8926
8927 static void GLAPIENTRY
8928 save_ProgramUniformMatrix3x2dv(GLuint program, GLint location, GLsizei count,
8929 GLboolean transpose, const GLdouble *v)
8930 {
8931 GET_CURRENT_CONTEXT(ctx);
8932 Node *n;
8933 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8934 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX32D,
8935 4 + POINTER_DWORDS);
8936 if (n) {
8937 n[1].ui = program;
8938 n[2].i = location;
8939 n[3].i = count;
8940 n[4].b = transpose;
8941 save_pointer(&n[5], memdup(v, count * 3 * 2 * sizeof(GLdouble)));
8942 }
8943 if (ctx->ExecuteFlag) {
8944 CALL_ProgramUniformMatrix3x2dv(ctx->Exec,
8945 (program, location, count, transpose, v));
8946 }
8947 }
8948
8949 static void GLAPIENTRY
8950 save_ProgramUniformMatrix3dv(GLuint program, GLint location, GLsizei count,
8951 GLboolean transpose, const GLdouble *v)
8952 {
8953 GET_CURRENT_CONTEXT(ctx);
8954 Node *n;
8955 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8956 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX33D,
8957 4 + POINTER_DWORDS);
8958 if (n) {
8959 n[1].ui = program;
8960 n[2].i = location;
8961 n[3].i = count;
8962 n[4].b = transpose;
8963 save_pointer(&n[5], memdup(v, count * 3 * 3 * sizeof(GLdouble)));
8964 }
8965 if (ctx->ExecuteFlag) {
8966 CALL_ProgramUniformMatrix3dv(ctx->Exec,
8967 (program, location, count, transpose, v));
8968 }
8969 }
8970
8971 static void GLAPIENTRY
8972 save_ProgramUniformMatrix3x4dv(GLuint program, GLint location, GLsizei count,
8973 GLboolean transpose, const GLdouble *v)
8974 {
8975 GET_CURRENT_CONTEXT(ctx);
8976 Node *n;
8977 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8978 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX34D,
8979 4 + POINTER_DWORDS);
8980 if (n) {
8981 n[1].ui = program;
8982 n[2].i = location;
8983 n[3].i = count;
8984 n[4].b = transpose;
8985 save_pointer(&n[5], memdup(v, count * 3 * 4 * sizeof(GLdouble)));
8986 }
8987 if (ctx->ExecuteFlag) {
8988 CALL_ProgramUniformMatrix3x4dv(ctx->Exec,
8989 (program, location, count, transpose, v));
8990 }
8991 }
8992
8993 static void GLAPIENTRY
8994 save_ProgramUniformMatrix4x2dv(GLuint program, GLint location, GLsizei count,
8995 GLboolean transpose, const GLdouble *v)
8996 {
8997 GET_CURRENT_CONTEXT(ctx);
8998 Node *n;
8999 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9000 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX42D,
9001 4 + POINTER_DWORDS);
9002 if (n) {
9003 n[1].ui = program;
9004 n[2].i = location;
9005 n[3].i = count;
9006 n[4].b = transpose;
9007 save_pointer(&n[5], memdup(v, count * 4 * 2 * sizeof(GLdouble)));
9008 }
9009 if (ctx->ExecuteFlag) {
9010 CALL_ProgramUniformMatrix4x2dv(ctx->Exec,
9011 (program, location, count, transpose, v));
9012 }
9013 }
9014
9015 static void GLAPIENTRY
9016 save_ProgramUniformMatrix4x3dv(GLuint program, GLint location, GLsizei count,
9017 GLboolean transpose, const GLdouble *v)
9018 {
9019 GET_CURRENT_CONTEXT(ctx);
9020 Node *n;
9021 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9022 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX43D,
9023 4 + POINTER_DWORDS);
9024 if (n) {
9025 n[1].ui = program;
9026 n[2].i = location;
9027 n[3].i = count;
9028 n[4].b = transpose;
9029 save_pointer(&n[5], memdup(v, count * 4 * 3 * sizeof(GLdouble)));
9030 }
9031 if (ctx->ExecuteFlag) {
9032 CALL_ProgramUniformMatrix4x3dv(ctx->Exec,
9033 (program, location, count, transpose, v));
9034 }
9035 }
9036
9037 static void GLAPIENTRY
9038 save_ProgramUniformMatrix4dv(GLuint program, GLint location, GLsizei count,
9039 GLboolean transpose, const GLdouble *v)
9040 {
9041 GET_CURRENT_CONTEXT(ctx);
9042 Node *n;
9043 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9044 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX44D,
9045 4 + POINTER_DWORDS);
9046 if (n) {
9047 n[1].ui = program;
9048 n[2].i = location;
9049 n[3].i = count;
9050 n[4].b = transpose;
9051 save_pointer(&n[5], memdup(v, count * 4 * 4 * sizeof(GLdouble)));
9052 }
9053 if (ctx->ExecuteFlag) {
9054 CALL_ProgramUniformMatrix4dv(ctx->Exec,
9055 (program, location, count, transpose, v));
9056 }
9057 }
9058
9059 static void GLAPIENTRY
9060 save_ClipControl(GLenum origin, GLenum depth)
9061 {
9062 GET_CURRENT_CONTEXT(ctx);
9063 Node *n;
9064 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9065 n = alloc_instruction(ctx, OPCODE_CLIP_CONTROL, 2);
9066 if (n) {
9067 n[1].e = origin;
9068 n[2].e = depth;
9069 }
9070 if (ctx->ExecuteFlag) {
9071 CALL_ClipControl(ctx->Exec, (origin, depth));
9072 }
9073 }
9074
9075 static void GLAPIENTRY
9076 save_ClampColorARB(GLenum target, GLenum clamp)
9077 {
9078 GET_CURRENT_CONTEXT(ctx);
9079 Node *n;
9080 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9081 n = alloc_instruction(ctx, OPCODE_CLAMP_COLOR, 2);
9082 if (n) {
9083 n[1].e = target;
9084 n[2].e = clamp;
9085 }
9086 if (ctx->ExecuteFlag) {
9087 CALL_ClampColor(ctx->Exec, (target, clamp));
9088 }
9089 }
9090
9091 /** GL_EXT_texture_integer */
9092 static void GLAPIENTRY
9093 save_ClearColorIi(GLint red, GLint green, GLint blue, GLint alpha)
9094 {
9095 GET_CURRENT_CONTEXT(ctx);
9096 Node *n;
9097 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9098 n = alloc_instruction(ctx, OPCODE_CLEARCOLOR_I, 4);
9099 if (n) {
9100 n[1].i = red;
9101 n[2].i = green;
9102 n[3].i = blue;
9103 n[4].i = alpha;
9104 }
9105 if (ctx->ExecuteFlag) {
9106 CALL_ClearColorIiEXT(ctx->Exec, (red, green, blue, alpha));
9107 }
9108 }
9109
9110 /** GL_EXT_texture_integer */
9111 static void GLAPIENTRY
9112 save_ClearColorIui(GLuint red, GLuint green, GLuint blue, GLuint alpha)
9113 {
9114 GET_CURRENT_CONTEXT(ctx);
9115 Node *n;
9116 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9117 n = alloc_instruction(ctx, OPCODE_CLEARCOLOR_UI, 4);
9118 if (n) {
9119 n[1].ui = red;
9120 n[2].ui = green;
9121 n[3].ui = blue;
9122 n[4].ui = alpha;
9123 }
9124 if (ctx->ExecuteFlag) {
9125 CALL_ClearColorIuiEXT(ctx->Exec, (red, green, blue, alpha));
9126 }
9127 }
9128
9129 /** GL_EXT_texture_integer */
9130 static void GLAPIENTRY
9131 save_TexParameterIiv(GLenum target, GLenum pname, const GLint *params)
9132 {
9133 GET_CURRENT_CONTEXT(ctx);
9134 Node *n;
9135 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9136 n = alloc_instruction(ctx, OPCODE_TEXPARAMETER_I, 6);
9137 if (n) {
9138 n[1].e = target;
9139 n[2].e = pname;
9140 n[3].i = params[0];
9141 n[4].i = params[1];
9142 n[5].i = params[2];
9143 n[6].i = params[3];
9144 }
9145 if (ctx->ExecuteFlag) {
9146 CALL_TexParameterIiv(ctx->Exec, (target, pname, params));
9147 }
9148 }
9149
9150 /** GL_EXT_texture_integer */
9151 static void GLAPIENTRY
9152 save_TexParameterIuiv(GLenum target, GLenum pname, const GLuint *params)
9153 {
9154 GET_CURRENT_CONTEXT(ctx);
9155 Node *n;
9156 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9157 n = alloc_instruction(ctx, OPCODE_TEXPARAMETER_UI, 6);
9158 if (n) {
9159 n[1].e = target;
9160 n[2].e = pname;
9161 n[3].ui = params[0];
9162 n[4].ui = params[1];
9163 n[5].ui = params[2];
9164 n[6].ui = params[3];
9165 }
9166 if (ctx->ExecuteFlag) {
9167 CALL_TexParameterIuiv(ctx->Exec, (target, pname, params));
9168 }
9169 }
9170
9171 /* GL_ARB_instanced_arrays */
9172 static void GLAPIENTRY
9173 save_VertexAttribDivisor(GLuint index, GLuint divisor)
9174 {
9175 GET_CURRENT_CONTEXT(ctx);
9176 Node *n;
9177 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9178 n = alloc_instruction(ctx, OPCODE_VERTEX_ATTRIB_DIVISOR, 2);
9179 if (n) {
9180 n[1].ui = index;
9181 n[2].ui = divisor;
9182 }
9183 if (ctx->ExecuteFlag) {
9184 CALL_VertexAttribDivisor(ctx->Exec, (index, divisor));
9185 }
9186 }
9187
9188
9189 /* GL_NV_texture_barrier */
9190 static void GLAPIENTRY
9191 save_TextureBarrierNV(void)
9192 {
9193 GET_CURRENT_CONTEXT(ctx);
9194 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9195 alloc_instruction(ctx, OPCODE_TEXTURE_BARRIER_NV, 0);
9196 if (ctx->ExecuteFlag) {
9197 CALL_TextureBarrierNV(ctx->Exec, ());
9198 }
9199 }
9200
9201
9202 /* GL_ARB_sampler_objects */
9203 static void GLAPIENTRY
9204 save_BindSampler(GLuint unit, GLuint sampler)
9205 {
9206 Node *n;
9207 GET_CURRENT_CONTEXT(ctx);
9208 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9209 n = alloc_instruction(ctx, OPCODE_BIND_SAMPLER, 2);
9210 if (n) {
9211 n[1].ui = unit;
9212 n[2].ui = sampler;
9213 }
9214 if (ctx->ExecuteFlag) {
9215 CALL_BindSampler(ctx->Exec, (unit, sampler));
9216 }
9217 }
9218
9219 static void GLAPIENTRY
9220 save_SamplerParameteriv(GLuint sampler, GLenum pname, const GLint *params)
9221 {
9222 Node *n;
9223 GET_CURRENT_CONTEXT(ctx);
9224 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9225 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERIV, 6);
9226 if (n) {
9227 n[1].ui = sampler;
9228 n[2].e = pname;
9229 n[3].i = params[0];
9230 if (pname == GL_TEXTURE_BORDER_COLOR) {
9231 n[4].i = params[1];
9232 n[5].i = params[2];
9233 n[6].i = params[3];
9234 }
9235 else {
9236 n[4].i = n[5].i = n[6].i = 0;
9237 }
9238 }
9239 if (ctx->ExecuteFlag) {
9240 CALL_SamplerParameteriv(ctx->Exec, (sampler, pname, params));
9241 }
9242 }
9243
9244 static void GLAPIENTRY
9245 save_SamplerParameteri(GLuint sampler, GLenum pname, GLint param)
9246 {
9247 GLint parray[4];
9248 parray[0] = param;
9249 parray[1] = parray[2] = parray[3] = 0;
9250 save_SamplerParameteriv(sampler, pname, parray);
9251 }
9252
9253 static void GLAPIENTRY
9254 save_SamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *params)
9255 {
9256 Node *n;
9257 GET_CURRENT_CONTEXT(ctx);
9258 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9259 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERFV, 6);
9260 if (n) {
9261 n[1].ui = sampler;
9262 n[2].e = pname;
9263 n[3].f = params[0];
9264 if (pname == GL_TEXTURE_BORDER_COLOR) {
9265 n[4].f = params[1];
9266 n[5].f = params[2];
9267 n[6].f = params[3];
9268 }
9269 else {
9270 n[4].f = n[5].f = n[6].f = 0.0F;
9271 }
9272 }
9273 if (ctx->ExecuteFlag) {
9274 CALL_SamplerParameterfv(ctx->Exec, (sampler, pname, params));
9275 }
9276 }
9277
9278 static void GLAPIENTRY
9279 save_SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
9280 {
9281 GLfloat parray[4];
9282 parray[0] = param;
9283 parray[1] = parray[2] = parray[3] = 0.0F;
9284 save_SamplerParameterfv(sampler, pname, parray);
9285 }
9286
9287 static void GLAPIENTRY
9288 save_SamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *params)
9289 {
9290 Node *n;
9291 GET_CURRENT_CONTEXT(ctx);
9292 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9293 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERIIV, 6);
9294 if (n) {
9295 n[1].ui = sampler;
9296 n[2].e = pname;
9297 n[3].i = params[0];
9298 if (pname == GL_TEXTURE_BORDER_COLOR) {
9299 n[4].i = params[1];
9300 n[5].i = params[2];
9301 n[6].i = params[3];
9302 }
9303 else {
9304 n[4].i = n[5].i = n[6].i = 0;
9305 }
9306 }
9307 if (ctx->ExecuteFlag) {
9308 CALL_SamplerParameterIiv(ctx->Exec, (sampler, pname, params));
9309 }
9310 }
9311
9312 static void GLAPIENTRY
9313 save_SamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *params)
9314 {
9315 Node *n;
9316 GET_CURRENT_CONTEXT(ctx);
9317 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9318 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERUIV, 6);
9319 if (n) {
9320 n[1].ui = sampler;
9321 n[2].e = pname;
9322 n[3].ui = params[0];
9323 if (pname == GL_TEXTURE_BORDER_COLOR) {
9324 n[4].ui = params[1];
9325 n[5].ui = params[2];
9326 n[6].ui = params[3];
9327 }
9328 else {
9329 n[4].ui = n[5].ui = n[6].ui = 0;
9330 }
9331 }
9332 if (ctx->ExecuteFlag) {
9333 CALL_SamplerParameterIuiv(ctx->Exec, (sampler, pname, params));
9334 }
9335 }
9336
9337 static void GLAPIENTRY
9338 save_WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
9339 {
9340 Node *n;
9341 GET_CURRENT_CONTEXT(ctx);
9342 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9343 n = alloc_instruction(ctx, OPCODE_WAIT_SYNC, 4);
9344 if (n) {
9345 union uint64_pair p;
9346 p.uint64 = timeout;
9347 n[1].bf = flags;
9348 n[2].ui = p.uint32[0];
9349 n[3].ui = p.uint32[1];
9350 save_pointer(&n[4], sync);
9351 }
9352 if (ctx->ExecuteFlag) {
9353 CALL_WaitSync(ctx->Exec, (sync, flags, timeout));
9354 }
9355 }
9356
9357
9358 /** GL_NV_conditional_render */
9359 static void GLAPIENTRY
9360 save_BeginConditionalRender(GLuint queryId, GLenum mode)
9361 {
9362 GET_CURRENT_CONTEXT(ctx);
9363 Node *n;
9364 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9365 n = alloc_instruction(ctx, OPCODE_BEGIN_CONDITIONAL_RENDER, 2);
9366 if (n) {
9367 n[1].i = queryId;
9368 n[2].e = mode;
9369 }
9370 if (ctx->ExecuteFlag) {
9371 CALL_BeginConditionalRender(ctx->Exec, (queryId, mode));
9372 }
9373 }
9374
9375 static void GLAPIENTRY
9376 save_EndConditionalRender(void)
9377 {
9378 GET_CURRENT_CONTEXT(ctx);
9379 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9380 alloc_instruction(ctx, OPCODE_END_CONDITIONAL_RENDER, 0);
9381 if (ctx->ExecuteFlag) {
9382 CALL_EndConditionalRender(ctx->Exec, ());
9383 }
9384 }
9385
9386 static void GLAPIENTRY
9387 save_UniformBlockBinding(GLuint prog, GLuint index, GLuint binding)
9388 {
9389 GET_CURRENT_CONTEXT(ctx);
9390 Node *n;
9391 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9392 n = alloc_instruction(ctx, OPCODE_UNIFORM_BLOCK_BINDING, 3);
9393 if (n) {
9394 n[1].ui = prog;
9395 n[2].ui = index;
9396 n[3].ui = binding;
9397 }
9398 if (ctx->ExecuteFlag) {
9399 CALL_UniformBlockBinding(ctx->Exec, (prog, index, binding));
9400 }
9401 }
9402
9403 static void GLAPIENTRY
9404 save_UniformSubroutinesuiv(GLenum shadertype, GLsizei count,
9405 const GLuint *indices)
9406 {
9407 GET_CURRENT_CONTEXT(ctx);
9408 Node *n;
9409 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9410 n = alloc_instruction(ctx, OPCODE_UNIFORM_SUBROUTINES, 2 + POINTER_DWORDS);
9411 if (n) {
9412 GLint *indices_copy = NULL;
9413
9414 if (count > 0)
9415 indices_copy = memdup(indices, sizeof(GLuint) * 4 * count);
9416 n[1].e = shadertype;
9417 n[2].si = count;
9418 save_pointer(&n[3], indices_copy);
9419 }
9420 if (ctx->ExecuteFlag) {
9421 CALL_UniformSubroutinesuiv(ctx->Exec, (shadertype, count, indices));
9422 }
9423 }
9424
9425 /** GL_EXT_window_rectangles */
9426 static void GLAPIENTRY
9427 save_WindowRectanglesEXT(GLenum mode, GLsizei count, const GLint *box)
9428 {
9429 GET_CURRENT_CONTEXT(ctx);
9430 Node *n;
9431 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9432 n = alloc_instruction(ctx, OPCODE_WINDOW_RECTANGLES, 2 + POINTER_DWORDS);
9433 if (n) {
9434 GLint *box_copy = NULL;
9435
9436 if (count > 0)
9437 box_copy = memdup(box, sizeof(GLint) * 4 * count);
9438 n[1].e = mode;
9439 n[2].si = count;
9440 save_pointer(&n[3], box_copy);
9441 }
9442 if (ctx->ExecuteFlag) {
9443 CALL_WindowRectanglesEXT(ctx->Exec, (mode, count, box));
9444 }
9445 }
9446
9447
9448 /** GL_NV_conservative_raster */
9449 static void GLAPIENTRY
9450 save_SubpixelPrecisionBiasNV(GLuint xbits, GLuint ybits)
9451 {
9452 GET_CURRENT_CONTEXT(ctx);
9453 Node *n;
9454 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9455 n = alloc_instruction(ctx, OPCODE_SUBPIXEL_PRECISION_BIAS, 2);
9456 if (n) {
9457 n[1].ui = xbits;
9458 n[2].ui = ybits;
9459 }
9460 if (ctx->ExecuteFlag) {
9461 CALL_SubpixelPrecisionBiasNV(ctx->Exec, (xbits, ybits));
9462 }
9463 }
9464
9465 /** GL_NV_conservative_raster_dilate */
9466 static void GLAPIENTRY
9467 save_ConservativeRasterParameterfNV(GLenum pname, GLfloat param)
9468 {
9469 GET_CURRENT_CONTEXT(ctx);
9470 Node *n;
9471 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9472 n = alloc_instruction(ctx, OPCODE_CONSERVATIVE_RASTER_PARAMETER_F, 2);
9473 if (n) {
9474 n[1].e = pname;
9475 n[2].f = param;
9476 }
9477 if (ctx->ExecuteFlag) {
9478 CALL_ConservativeRasterParameterfNV(ctx->Exec, (pname, param));
9479 }
9480 }
9481
9482 /** GL_NV_conservative_raster_pre_snap_triangles */
9483 static void GLAPIENTRY
9484 save_ConservativeRasterParameteriNV(GLenum pname, GLint param)
9485 {
9486 GET_CURRENT_CONTEXT(ctx);
9487 Node *n;
9488 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9489 n = alloc_instruction(ctx, OPCODE_CONSERVATIVE_RASTER_PARAMETER_I, 2);
9490 if (n) {
9491 n[1].e = pname;
9492 n[2].i = param;
9493 }
9494 if (ctx->ExecuteFlag) {
9495 CALL_ConservativeRasterParameteriNV(ctx->Exec, (pname, param));
9496 }
9497 }
9498
9499 /** GL_EXT_direct_state_access */
9500
9501 static void GLAPIENTRY
9502 save_MatrixLoadfEXT(GLenum matrixMode, const GLfloat *m)
9503 {
9504 GET_CURRENT_CONTEXT(ctx);
9505 Node *n;
9506 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9507 n = alloc_instruction(ctx, OPCODE_MATRIX_LOAD, 17);
9508 if (n) {
9509 n[1].e = matrixMode;
9510 for (unsigned i = 0; i < 16; i++) {
9511 n[2 + i].f = m[i];
9512 }
9513 }
9514 if (ctx->ExecuteFlag) {
9515 CALL_MatrixLoadfEXT(ctx->Exec, (matrixMode, m));
9516 }
9517 }
9518
9519 static void GLAPIENTRY
9520 save_MatrixLoaddEXT(GLenum matrixMode, const GLdouble *m)
9521 {
9522 GLfloat f[16];
9523 for (unsigned i = 0; i < 16; i++) {
9524 f[i] = (GLfloat) m[i];
9525 }
9526 save_MatrixLoadfEXT(matrixMode, f);
9527 }
9528
9529 static void GLAPIENTRY
9530 save_MatrixMultfEXT(GLenum matrixMode, const GLfloat * m)
9531 {
9532 GET_CURRENT_CONTEXT(ctx);
9533 Node *n;
9534 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9535 n = alloc_instruction(ctx, OPCODE_MATRIX_MULT, 17);
9536 if (n) {
9537 n[1].e = matrixMode;
9538 for (unsigned i = 0; i < 16; i++) {
9539 n[2 + i].f = m[i];
9540 }
9541 }
9542 if (ctx->ExecuteFlag) {
9543 CALL_MatrixMultfEXT(ctx->Exec, (matrixMode, m));
9544 }
9545 }
9546
9547 static void GLAPIENTRY
9548 save_MatrixMultdEXT(GLenum matrixMode, const GLdouble * m)
9549 {
9550 GLfloat f[16];
9551 for (unsigned i = 0; i < 16; i++) {
9552 f[i] = (GLfloat) m[i];
9553 }
9554 save_MatrixMultfEXT(matrixMode, f);
9555 }
9556
9557 static void GLAPIENTRY
9558 save_MatrixRotatefEXT(GLenum matrixMode, GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
9559 {
9560 GET_CURRENT_CONTEXT(ctx);
9561 Node *n;
9562 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9563 n = alloc_instruction(ctx, OPCODE_MATRIX_ROTATE, 5);
9564 if (n) {
9565 n[1].e = matrixMode;
9566 n[2].f = angle;
9567 n[3].f = x;
9568 n[4].f = y;
9569 n[5].f = z;
9570 }
9571 if (ctx->ExecuteFlag) {
9572 CALL_MatrixRotatefEXT(ctx->Exec, (matrixMode, angle, x, y, z));
9573 }
9574 }
9575
9576 static void GLAPIENTRY
9577 save_MatrixRotatedEXT(GLenum matrixMode, GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
9578 {
9579 save_MatrixRotatefEXT(matrixMode, (GLfloat) angle, (GLfloat) x, (GLfloat) y, (GLfloat) z);
9580 }
9581
9582 static void GLAPIENTRY
9583 save_MatrixScalefEXT(GLenum matrixMode, GLfloat x, GLfloat y, GLfloat z)
9584 {
9585 GET_CURRENT_CONTEXT(ctx);
9586 Node *n;
9587 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9588 n = alloc_instruction(ctx, OPCODE_MATRIX_SCALE, 4);
9589 if (n) {
9590 n[1].e = matrixMode;
9591 n[2].f = x;
9592 n[3].f = y;
9593 n[4].f = z;
9594 }
9595 if (ctx->ExecuteFlag) {
9596 CALL_MatrixScalefEXT(ctx->Exec, (matrixMode, x, y, z));
9597 }
9598 }
9599
9600 static void GLAPIENTRY
9601 save_MatrixScaledEXT(GLenum matrixMode, GLdouble x, GLdouble y, GLdouble z)
9602 {
9603 save_MatrixScalefEXT(matrixMode, (GLfloat) x, (GLfloat) y, (GLfloat) z);
9604 }
9605
9606 static void GLAPIENTRY
9607 save_MatrixTranslatefEXT(GLenum matrixMode, GLfloat x, GLfloat y, GLfloat z)
9608 {
9609 GET_CURRENT_CONTEXT(ctx);
9610 Node *n;
9611 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9612 n = alloc_instruction(ctx, OPCODE_MATRIX_TRANSLATE, 4);
9613 if (n) {
9614 n[1].e = matrixMode;
9615 n[2].f = x;
9616 n[3].f = y;
9617 n[4].f = z;
9618 }
9619 if (ctx->ExecuteFlag) {
9620 CALL_MatrixTranslatefEXT(ctx->Exec, (matrixMode, x, y, z));
9621 }
9622 }
9623
9624 static void GLAPIENTRY
9625 save_MatrixTranslatedEXT(GLenum matrixMode, GLdouble x, GLdouble y, GLdouble z)
9626 {
9627 save_MatrixTranslatefEXT(matrixMode, (GLfloat) x, (GLfloat) y, (GLfloat) z);
9628 }
9629
9630 static void GLAPIENTRY
9631 save_MatrixLoadIdentityEXT(GLenum matrixMode)
9632 {
9633 GET_CURRENT_CONTEXT(ctx);
9634 Node *n;
9635 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9636 n = alloc_instruction(ctx, OPCODE_MATRIX_LOAD_IDENTITY, 1);
9637 if (n) {
9638 n[1].e = matrixMode;
9639 }
9640 if (ctx->ExecuteFlag) {
9641 CALL_MatrixLoadIdentityEXT(ctx->Exec, (matrixMode));
9642 }
9643 }
9644
9645 static void GLAPIENTRY
9646 save_MatrixOrthoEXT(GLenum matrixMode, GLdouble left, GLdouble right,
9647 GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval)
9648 {
9649 GET_CURRENT_CONTEXT(ctx);
9650 Node *n;
9651 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9652 n = alloc_instruction(ctx, OPCODE_MATRIX_ORTHO, 7);
9653 if (n) {
9654 n[1].e = matrixMode;
9655 n[2].f = (GLfloat) left;
9656 n[3].f = (GLfloat) right;
9657 n[4].f = (GLfloat) bottom;
9658 n[5].f = (GLfloat) top;
9659 n[6].f = (GLfloat) nearval;
9660 n[7].f = (GLfloat) farval;
9661 }
9662 if (ctx->ExecuteFlag) {
9663 CALL_MatrixOrthoEXT(ctx->Exec, (matrixMode, left, right, bottom, top, nearval, farval));
9664 }
9665 }
9666
9667
9668 static void GLAPIENTRY
9669 save_MatrixFrustumEXT(GLenum matrixMode, GLdouble left, GLdouble right,
9670 GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval)
9671 {
9672 GET_CURRENT_CONTEXT(ctx);
9673 Node *n;
9674 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9675 n = alloc_instruction(ctx, OPCODE_MATRIX_FRUSTUM, 7);
9676 if (n) {
9677 n[1].e = matrixMode;
9678 n[2].f = (GLfloat) left;
9679 n[3].f = (GLfloat) right;
9680 n[4].f = (GLfloat) bottom;
9681 n[5].f = (GLfloat) top;
9682 n[6].f = (GLfloat) nearval;
9683 n[7].f = (GLfloat) farval;
9684 }
9685 if (ctx->ExecuteFlag) {
9686 CALL_MatrixFrustumEXT(ctx->Exec, (matrixMode, left, right, bottom, top, nearval, farval));
9687 }
9688 }
9689
9690 static void GLAPIENTRY
9691 save_MatrixPushEXT(GLenum matrixMode)
9692 {
9693 GET_CURRENT_CONTEXT(ctx);
9694 Node* n;
9695 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9696 n = alloc_instruction(ctx, OPCODE_MATRIX_PUSH, 1);
9697 if (n) {
9698 n[1].e = matrixMode;
9699 }
9700 if (ctx->ExecuteFlag) {
9701 CALL_MatrixPushEXT(ctx->Exec, (matrixMode));
9702 }
9703 }
9704
9705 static void GLAPIENTRY
9706 save_MatrixPopEXT(GLenum matrixMode)
9707 {
9708 GET_CURRENT_CONTEXT(ctx);
9709 Node* n;
9710 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9711 n = alloc_instruction(ctx, OPCODE_MATRIX_POP, 1);
9712 if (n) {
9713 n[1].e = matrixMode;
9714 }
9715 if (ctx->ExecuteFlag) {
9716 CALL_MatrixPopEXT(ctx->Exec, (matrixMode));
9717 }
9718 }
9719
9720 static void GLAPIENTRY
9721 save_MatrixLoadTransposefEXT(GLenum matrixMode, const GLfloat m[16])
9722 {
9723 GLfloat tm[16];
9724 _math_transposef(tm, m);
9725 save_MatrixLoadfEXT(matrixMode, tm);
9726 }
9727
9728 static void GLAPIENTRY
9729 save_MatrixLoadTransposedEXT(GLenum matrixMode, const GLdouble m[16])
9730 {
9731 GLfloat tm[16];
9732 _math_transposefd(tm, m);
9733 save_MatrixLoadfEXT(matrixMode, tm);
9734 }
9735
9736 static void GLAPIENTRY
9737 save_MatrixMultTransposefEXT(GLenum matrixMode, const GLfloat m[16])
9738 {
9739 GLfloat tm[16];
9740 _math_transposef(tm, m);
9741 save_MatrixMultfEXT(matrixMode, tm);
9742 }
9743
9744 static void GLAPIENTRY
9745 save_MatrixMultTransposedEXT(GLenum matrixMode, const GLdouble m[16])
9746 {
9747 GLfloat tm[16];
9748 _math_transposefd(tm, m);
9749 save_MatrixMultfEXT(matrixMode, tm);
9750 }
9751
9752 static void GLAPIENTRY
9753 save_TextureParameterfvEXT(GLuint texture, GLenum target, GLenum pname,
9754 const GLfloat *params)
9755 {
9756 GET_CURRENT_CONTEXT(ctx);
9757 Node *n;
9758 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9759 n = alloc_instruction(ctx, OPCODE_TEXTUREPARAMETER_F, 7);
9760 if (n) {
9761 n[1].ui = texture;
9762 n[2].e = target;
9763 n[3].e = pname;
9764 n[4].f = params[0];
9765 n[5].f = params[1];
9766 n[6].f = params[2];
9767 n[7].f = params[3];
9768 }
9769 if (ctx->ExecuteFlag) {
9770 CALL_TextureParameterfvEXT(ctx->Exec, (texture, target, pname, params));
9771 }
9772 }
9773
9774
9775 static void GLAPIENTRY
9776 save_TextureParameterfEXT(GLuint texture, GLenum target, GLenum pname, GLfloat param)
9777 {
9778 GLfloat parray[4];
9779 parray[0] = param;
9780 parray[1] = parray[2] = parray[3] = 0.0F;
9781 save_TextureParameterfvEXT(texture, target, pname, parray);
9782 }
9783
9784 static void GLAPIENTRY
9785 save_TextureParameterivEXT(GLuint texture, GLenum target, GLenum pname, const GLint *params)
9786 {
9787 GET_CURRENT_CONTEXT(ctx);
9788 Node *n;
9789 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9790 n = alloc_instruction(ctx, OPCODE_TEXTUREPARAMETER_I, 7);
9791 if (n) {
9792 n[1].ui = texture;
9793 n[2].e = target;
9794 n[3].e = pname;
9795 n[4].i = params[0];
9796 n[5].i = params[1];
9797 n[6].i = params[2];
9798 n[7].i = params[3];
9799 }
9800 if (ctx->ExecuteFlag) {
9801 CALL_TextureParameterivEXT(ctx->Exec, (texture, target, pname, params));
9802 }
9803 }
9804
9805 static void GLAPIENTRY
9806 save_TextureParameteriEXT(GLuint texture, GLenum target, GLenum pname, GLint param)
9807 {
9808 GLint fparam[4];
9809 fparam[0] = param;
9810 fparam[1] = fparam[2] = fparam[3] = 0;
9811 save_TextureParameterivEXT(texture, target, pname, fparam);
9812 }
9813
9814 static void GLAPIENTRY
9815 save_TextureParameterIivEXT(GLuint texture, GLenum target, GLenum pname, const GLint* params)
9816 {
9817 GET_CURRENT_CONTEXT(ctx);
9818 Node *n;
9819 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9820 n = alloc_instruction(ctx, OPCODE_TEXTUREPARAMETER_II, 7);
9821 if (n) {
9822 n[1].ui = texture;
9823 n[2].e = target;
9824 n[3].e = pname;
9825 n[4].i = params[0];
9826 n[5].i = params[1];
9827 n[6].i = params[2];
9828 n[7].i = params[3];
9829 }
9830 if (ctx->ExecuteFlag) {
9831 CALL_TextureParameterIivEXT(ctx->Exec, (texture, target, pname, params));
9832 }
9833 }
9834
9835 static void GLAPIENTRY
9836 save_TextureParameterIuivEXT(GLuint texture, GLenum target, GLenum pname, const GLuint* params)
9837 {
9838 GET_CURRENT_CONTEXT(ctx);
9839 Node *n;
9840 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9841 n = alloc_instruction(ctx, OPCODE_TEXTUREPARAMETER_IUI, 7);
9842 if (n) {
9843 n[1].ui = texture;
9844 n[2].e = target;
9845 n[3].e = pname;
9846 n[4].ui = params[0];
9847 n[5].ui = params[1];
9848 n[6].ui = params[2];
9849 n[7].ui = params[3];
9850 }
9851 if (ctx->ExecuteFlag) {
9852 CALL_TextureParameterIuivEXT(ctx->Exec, (texture, target, pname, params));
9853 }
9854 }
9855
9856
9857 static void GLAPIENTRY
9858 save_TextureImage1DEXT(GLuint texture, GLenum target,
9859 GLint level, GLint components,
9860 GLsizei width, GLint border,
9861 GLenum format, GLenum type, const GLvoid * pixels)
9862 {
9863 GET_CURRENT_CONTEXT(ctx);
9864 if (target == GL_PROXY_TEXTURE_1D) {
9865 /* don't compile, execute immediately */
9866 CALL_TextureImage1DEXT(ctx->Exec, (texture, target, level, components, width,
9867 border, format, type, pixels));
9868 }
9869 else {
9870 Node *n;
9871 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9872 n = alloc_instruction(ctx, OPCODE_TEXTURE_IMAGE1D, 8 + POINTER_DWORDS);
9873 if (n) {
9874 n[1].ui = texture;
9875 n[2].e = target;
9876 n[3].i = level;
9877 n[4].i = components;
9878 n[5].i = (GLint) width;
9879 n[6].i = border;
9880 n[7].e = format;
9881 n[8].e = type;
9882 save_pointer(&n[9],
9883 unpack_image(ctx, 1, width, 1, 1, format, type,
9884 pixels, &ctx->Unpack));
9885 }
9886 if (ctx->ExecuteFlag) {
9887 CALL_TextureImage1DEXT(ctx->Exec, (texture, target, level, components, width,
9888 border, format, type, pixels));
9889 }
9890 }
9891 }
9892
9893
9894 static void GLAPIENTRY
9895 save_TextureImage2DEXT(GLuint texture, GLenum target,
9896 GLint level, GLint components,
9897 GLsizei width, GLsizei height, GLint border,
9898 GLenum format, GLenum type, const GLvoid * pixels)
9899 {
9900 GET_CURRENT_CONTEXT(ctx);
9901 if (target == GL_PROXY_TEXTURE_2D) {
9902 /* don't compile, execute immediately */
9903 CALL_TextureImage2DEXT(ctx->Exec, (texture, target, level, components, width,
9904 height, border, format, type, pixels));
9905 }
9906 else {
9907 Node *n;
9908 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9909 n = alloc_instruction(ctx, OPCODE_TEXTURE_IMAGE2D, 9 + POINTER_DWORDS);
9910 if (n) {
9911 n[1].ui = texture;
9912 n[2].e = target;
9913 n[3].i = level;
9914 n[4].i = components;
9915 n[5].i = (GLint) width;
9916 n[6].i = (GLint) height;
9917 n[7].i = border;
9918 n[8].e = format;
9919 n[9].e = type;
9920 save_pointer(&n[10],
9921 unpack_image(ctx, 2, width, height, 1, format, type,
9922 pixels, &ctx->Unpack));
9923 }
9924 if (ctx->ExecuteFlag) {
9925 CALL_TextureImage2DEXT(ctx->Exec, (texture, target, level, components, width,
9926 height, border, format, type, pixels));
9927 }
9928 }
9929 }
9930
9931
9932 static void GLAPIENTRY
9933 save_TextureImage3DEXT(GLuint texture, GLenum target,
9934 GLint level, GLint internalFormat,
9935 GLsizei width, GLsizei height, GLsizei depth,
9936 GLint border,
9937 GLenum format, GLenum type, const GLvoid * pixels)
9938 {
9939 GET_CURRENT_CONTEXT(ctx);
9940 if (target == GL_PROXY_TEXTURE_3D) {
9941 /* don't compile, execute immediately */
9942 CALL_TextureImage3DEXT(ctx->Exec, (texture, target, level, internalFormat, width,
9943 height, depth, border, format, type,
9944 pixels));
9945 }
9946 else {
9947 Node *n;
9948 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9949 n = alloc_instruction(ctx, OPCODE_TEXTURE_IMAGE3D, 10 + POINTER_DWORDS);
9950 if (n) {
9951 n[1].ui = texture;
9952 n[2].e = target;
9953 n[3].i = level;
9954 n[4].i = (GLint) internalFormat;
9955 n[5].i = (GLint) width;
9956 n[6].i = (GLint) height;
9957 n[7].i = (GLint) depth;
9958 n[8].i = border;
9959 n[9].e = format;
9960 n[10].e = type;
9961 save_pointer(&n[11],
9962 unpack_image(ctx, 3, width, height, depth, format, type,
9963 pixels, &ctx->Unpack));
9964 }
9965 if (ctx->ExecuteFlag) {
9966 CALL_TextureImage3DEXT(ctx->Exec, (texture, target, level, internalFormat,
9967 width, height, depth, border, format,
9968 type, pixels));
9969 }
9970 }
9971 }
9972
9973
9974 static void GLAPIENTRY
9975 save_TextureSubImage1DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset,
9976 GLsizei width, GLenum format, GLenum type,
9977 const GLvoid * pixels)
9978 {
9979 GET_CURRENT_CONTEXT(ctx);
9980 Node *n;
9981
9982 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9983
9984 n = alloc_instruction(ctx, OPCODE_TEXTURE_SUB_IMAGE1D, 7 + POINTER_DWORDS);
9985 if (n) {
9986 n[1].ui = texture;
9987 n[2].e = target;
9988 n[3].i = level;
9989 n[4].i = xoffset;
9990 n[5].i = (GLint) width;
9991 n[6].e = format;
9992 n[7].e = type;
9993 save_pointer(&n[8],
9994 unpack_image(ctx, 1, width, 1, 1, format, type,
9995 pixels, &ctx->Unpack));
9996 }
9997 if (ctx->ExecuteFlag) {
9998 CALL_TextureSubImage1DEXT(ctx->Exec, (texture, target, level, xoffset, width,
9999 format, type, pixels));
10000 }
10001 }
10002
10003
10004 static void GLAPIENTRY
10005 save_TextureSubImage2DEXT(GLuint texture, GLenum target, GLint level,
10006 GLint xoffset, GLint yoffset,
10007 GLsizei width, GLsizei height,
10008 GLenum format, GLenum type, const GLvoid * pixels)
10009 {
10010 GET_CURRENT_CONTEXT(ctx);
10011 Node *n;
10012
10013 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10014
10015 n = alloc_instruction(ctx, OPCODE_TEXTURE_SUB_IMAGE2D, 9 + POINTER_DWORDS);
10016 if (n) {
10017 n[1].ui = texture;
10018 n[2].e = target;
10019 n[3].i = level;
10020 n[4].i = xoffset;
10021 n[5].i = yoffset;
10022 n[6].i = (GLint) width;
10023 n[7].i = (GLint) height;
10024 n[8].e = format;
10025 n[9].e = type;
10026 save_pointer(&n[10],
10027 unpack_image(ctx, 2, width, height, 1, format, type,
10028 pixels, &ctx->Unpack));
10029 }
10030 if (ctx->ExecuteFlag) {
10031 CALL_TextureSubImage2DEXT(ctx->Exec, (texture, target, level, xoffset, yoffset,
10032 width, height, format, type, pixels));
10033 }
10034 }
10035
10036
10037 static void GLAPIENTRY
10038 save_TextureSubImage3DEXT(GLuint texture, GLenum target, GLint level,
10039 GLint xoffset, GLint yoffset, GLint zoffset,
10040 GLsizei width, GLsizei height, GLsizei depth,
10041 GLenum format, GLenum type, const GLvoid * pixels)
10042 {
10043 GET_CURRENT_CONTEXT(ctx);
10044 Node *n;
10045
10046 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10047
10048 n = alloc_instruction(ctx, OPCODE_TEXTURE_SUB_IMAGE3D, 11 + POINTER_DWORDS);
10049 if (n) {
10050 n[1].ui = texture;
10051 n[2].e = target;
10052 n[3].i = level;
10053 n[4].i = xoffset;
10054 n[5].i = yoffset;
10055 n[6].i = zoffset;
10056 n[7].i = (GLint) width;
10057 n[8].i = (GLint) height;
10058 n[9].i = (GLint) depth;
10059 n[10].e = format;
10060 n[11].e = type;
10061 save_pointer(&n[12],
10062 unpack_image(ctx, 3, width, height, depth, format, type,
10063 pixels, &ctx->Unpack));
10064 }
10065 if (ctx->ExecuteFlag) {
10066 CALL_TextureSubImage3DEXT(ctx->Exec, (texture, target, level,
10067 xoffset, yoffset, zoffset,
10068 width, height, depth, format, type,
10069 pixels));
10070 }
10071 }
10072
10073 static void GLAPIENTRY
10074 save_CopyTextureImage1DEXT(GLuint texture, GLenum target, GLint level,
10075 GLenum internalformat, GLint x, GLint y,
10076 GLsizei width, GLint border)
10077 {
10078 GET_CURRENT_CONTEXT(ctx);
10079 Node *n;
10080 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10081 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_IMAGE1D, 8);
10082 if (n) {
10083 n[1].ui = texture;
10084 n[2].e = target;
10085 n[3].i = level;
10086 n[4].e = internalformat;
10087 n[5].i = x;
10088 n[6].i = y;
10089 n[7].i = width;
10090 n[8].i = border;
10091 }
10092 if (ctx->ExecuteFlag) {
10093 CALL_CopyTextureImage1DEXT(ctx->Exec, (texture, target, level,
10094 internalformat, x, y,
10095 width, border));
10096 }
10097 }
10098
10099 static void GLAPIENTRY
10100 save_CopyTextureImage2DEXT(GLuint texture, GLenum target, GLint level,
10101 GLenum internalformat,
10102 GLint x, GLint y, GLsizei width,
10103 GLsizei height, GLint border)
10104 {
10105 GET_CURRENT_CONTEXT(ctx);
10106 Node *n;
10107 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10108 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_IMAGE2D, 9);
10109 if (n) {
10110 n[1].ui = texture;
10111 n[2].e = target;
10112 n[3].i = level;
10113 n[4].e = internalformat;
10114 n[5].i = x;
10115 n[6].i = y;
10116 n[7].i = width;
10117 n[8].i = height;
10118 n[9].i = border;
10119 }
10120 if (ctx->ExecuteFlag) {
10121 CALL_CopyTextureImage2DEXT(ctx->Exec, (texture, target, level,
10122 internalformat, x, y,
10123 width, height, border));
10124 }
10125 }
10126
10127 static void GLAPIENTRY
10128 save_CopyTextureSubImage1DEXT(GLuint texture, GLenum target, GLint level,
10129 GLint xoffset, GLint x, GLint y, GLsizei width)
10130 {
10131 GET_CURRENT_CONTEXT(ctx);
10132 Node *n;
10133 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10134 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_SUB_IMAGE1D, 7);
10135 if (n) {
10136 n[1].ui = texture;
10137 n[2].e = target;
10138 n[3].i = level;
10139 n[4].i = xoffset;
10140 n[5].i = x;
10141 n[6].i = y;
10142 n[7].i = width;
10143 }
10144 if (ctx->ExecuteFlag) {
10145 CALL_CopyTextureSubImage1DEXT(ctx->Exec,
10146 (texture, target, level, xoffset, x, y, width));
10147 }
10148 }
10149
10150 static void GLAPIENTRY
10151 save_CopyTextureSubImage2DEXT(GLuint texture, GLenum target, GLint level,
10152 GLint xoffset, GLint yoffset,
10153 GLint x, GLint y, GLsizei width, GLint height)
10154 {
10155 GET_CURRENT_CONTEXT(ctx);
10156 Node *n;
10157 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10158 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_SUB_IMAGE2D, 9);
10159 if (n) {
10160 n[1].ui = texture;
10161 n[2].e = target;
10162 n[3].i = level;
10163 n[4].i = xoffset;
10164 n[5].i = yoffset;
10165 n[6].i = x;
10166 n[7].i = y;
10167 n[8].i = width;
10168 n[9].i = height;
10169 }
10170 if (ctx->ExecuteFlag) {
10171 CALL_CopyTextureSubImage2DEXT(ctx->Exec, (texture, target, level,
10172 xoffset, yoffset,
10173 x, y, width, height));
10174 }
10175 }
10176
10177
10178 static void GLAPIENTRY
10179 save_CopyTextureSubImage3DEXT(GLuint texture, GLenum target, GLint level,
10180 GLint xoffset, GLint yoffset, GLint zoffset,
10181 GLint x, GLint y, GLsizei width, GLint height)
10182 {
10183 GET_CURRENT_CONTEXT(ctx);
10184 Node *n;
10185 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10186 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_SUB_IMAGE3D, 10);
10187 if (n) {
10188 n[1].ui = texture;
10189 n[2].e = target;
10190 n[3].i = level;
10191 n[4].i = xoffset;
10192 n[5].i = yoffset;
10193 n[6].i = zoffset;
10194 n[7].i = x;
10195 n[8].i = y;
10196 n[9].i = width;
10197 n[10].i = height;
10198 }
10199 if (ctx->ExecuteFlag) {
10200 CALL_CopyTextureSubImage3DEXT(ctx->Exec, (texture, target, level,
10201 xoffset, yoffset, zoffset,
10202 x, y, width, height));
10203 }
10204 }
10205
10206
10207 static void GLAPIENTRY
10208 save_BindMultiTextureEXT(GLenum texunit, GLenum target, GLuint texture)
10209 {
10210 GET_CURRENT_CONTEXT(ctx);
10211 Node *n;
10212 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10213 n = alloc_instruction(ctx, OPCODE_BIND_MULTITEXTURE, 3);
10214 if (n) {
10215 n[1].e = texunit;
10216 n[2].e = target;
10217 n[3].ui = texture;
10218 }
10219 if (ctx->ExecuteFlag) {
10220 CALL_BindMultiTextureEXT(ctx->Exec, (texunit, target, texture));
10221 }
10222 }
10223
10224
10225 static void GLAPIENTRY
10226 save_MultiTexParameterfvEXT(GLenum texunit, GLenum target, GLenum pname,
10227 const GLfloat *params)
10228 {
10229 GET_CURRENT_CONTEXT(ctx);
10230 Node *n;
10231 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10232 n = alloc_instruction(ctx, OPCODE_MULTITEXPARAMETER_F, 7);
10233 if (n) {
10234 n[1].e = texunit;
10235 n[2].e = target;
10236 n[3].e = pname;
10237 n[4].f = params[0];
10238 n[5].f = params[1];
10239 n[6].f = params[2];
10240 n[7].f = params[3];
10241 }
10242 if (ctx->ExecuteFlag) {
10243 CALL_MultiTexParameterfvEXT(ctx->Exec, (texunit, target, pname, params));
10244 }
10245 }
10246
10247
10248 static void GLAPIENTRY
10249 save_MultiTexParameterfEXT(GLenum texunit, GLenum target, GLenum pname, GLfloat param)
10250 {
10251 GLfloat parray[4];
10252 parray[0] = param;
10253 parray[1] = parray[2] = parray[3] = 0.0F;
10254 save_MultiTexParameterfvEXT(texunit, target, pname, parray);
10255 }
10256
10257 static void GLAPIENTRY
10258 save_MultiTexParameterivEXT(GLenum texunit, GLenum target, GLenum pname, const GLint *params)
10259 {
10260 GET_CURRENT_CONTEXT(ctx);
10261 Node *n;
10262 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10263 n = alloc_instruction(ctx, OPCODE_MULTITEXPARAMETER_I, 7);
10264 if (n) {
10265 n[1].e = texunit;
10266 n[2].e = target;
10267 n[3].e = pname;
10268 n[4].i = params[0];
10269 n[5].i = params[1];
10270 n[6].i = params[2];
10271 n[7].i = params[3];
10272 }
10273 if (ctx->ExecuteFlag) {
10274 CALL_MultiTexParameterivEXT(ctx->Exec, (texunit, target, pname, params));
10275 }
10276 }
10277
10278 static void GLAPIENTRY
10279 save_MultiTexParameterIivEXT(GLenum texunit, GLenum target, GLenum pname, const GLint *params)
10280 {
10281 GET_CURRENT_CONTEXT(ctx);
10282 Node *n;
10283 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10284 n = alloc_instruction(ctx, OPCODE_MULTITEXPARAMETER_II, 7);
10285 if (n) {
10286 n[1].e = texunit;
10287 n[2].e = target;
10288 n[3].e = pname;
10289 n[4].i = params[0];
10290 n[5].i = params[1];
10291 n[6].i = params[2];
10292 n[7].i = params[3];
10293 }
10294 if (ctx->ExecuteFlag) {
10295 CALL_MultiTexParameterIivEXT(ctx->Exec, (texunit, target, pname, params));
10296 }
10297 }
10298
10299 static void GLAPIENTRY
10300 save_MultiTexParameterIuivEXT(GLenum texunit, GLenum target, GLenum pname, const GLuint *params)
10301 {
10302 GET_CURRENT_CONTEXT(ctx);
10303 Node *n;
10304 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10305 n = alloc_instruction(ctx, OPCODE_MULTITEXPARAMETER_IUI, 7);
10306 if (n) {
10307 n[1].e = texunit;
10308 n[2].e = target;
10309 n[3].e = pname;
10310 n[4].ui = params[0];
10311 n[5].ui = params[1];
10312 n[6].ui = params[2];
10313 n[7].ui = params[3];
10314 }
10315 if (ctx->ExecuteFlag) {
10316 CALL_MultiTexParameterIuivEXT(ctx->Exec, (texunit, target, pname, params));
10317 }
10318 }
10319
10320 static void GLAPIENTRY
10321 save_MultiTexParameteriEXT(GLenum texunit, GLenum target, GLenum pname, GLint param)
10322 {
10323 GLint fparam[4];
10324 fparam[0] = param;
10325 fparam[1] = fparam[2] = fparam[3] = 0;
10326 save_MultiTexParameterivEXT(texunit, target, pname, fparam);
10327 }
10328
10329
10330 static void GLAPIENTRY
10331 save_MultiTexImage1DEXT(GLenum texunit, GLenum target,
10332 GLint level, GLint components,
10333 GLsizei width, GLint border,
10334 GLenum format, GLenum type, const GLvoid * pixels)
10335 {
10336 GET_CURRENT_CONTEXT(ctx);
10337 if (target == GL_PROXY_TEXTURE_1D) {
10338 /* don't compile, execute immediately */
10339 CALL_MultiTexImage1DEXT(ctx->Exec, (texunit, target, level, components, width,
10340 border, format, type, pixels));
10341 }
10342 else {
10343 Node *n;
10344 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10345 n = alloc_instruction(ctx, OPCODE_MULTITEX_IMAGE1D, 8 + POINTER_DWORDS);
10346 if (n) {
10347 n[1].e = texunit;
10348 n[2].e = target;
10349 n[3].i = level;
10350 n[4].i = components;
10351 n[5].i = (GLint) width;
10352 n[6].i = border;
10353 n[7].e = format;
10354 n[8].e = type;
10355 save_pointer(&n[9],
10356 unpack_image(ctx, 1, width, 1, 1, format, type,
10357 pixels, &ctx->Unpack));
10358 }
10359 if (ctx->ExecuteFlag) {
10360 CALL_MultiTexImage1DEXT(ctx->Exec, (texunit, target, level, components, width,
10361 border, format, type, pixels));
10362 }
10363 }
10364 }
10365
10366
10367 static void GLAPIENTRY
10368 save_MultiTexImage2DEXT(GLenum texunit, GLenum target,
10369 GLint level, GLint components,
10370 GLsizei width, GLsizei height, GLint border,
10371 GLenum format, GLenum type, const GLvoid * pixels)
10372 {
10373 GET_CURRENT_CONTEXT(ctx);
10374 if (target == GL_PROXY_TEXTURE_2D) {
10375 /* don't compile, execute immediately */
10376 CALL_MultiTexImage2DEXT(ctx->Exec, (texunit, target, level, components, width,
10377 height, border, format, type, pixels));
10378 }
10379 else {
10380 Node *n;
10381 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10382 n = alloc_instruction(ctx, OPCODE_MULTITEX_IMAGE2D, 9 + POINTER_DWORDS);
10383 if (n) {
10384 n[1].e = texunit;
10385 n[2].e = target;
10386 n[3].i = level;
10387 n[4].i = components;
10388 n[5].i = (GLint) width;
10389 n[6].i = (GLint) height;
10390 n[7].i = border;
10391 n[8].e = format;
10392 n[9].e = type;
10393 save_pointer(&n[10],
10394 unpack_image(ctx, 2, width, height, 1, format, type,
10395 pixels, &ctx->Unpack));
10396 }
10397 if (ctx->ExecuteFlag) {
10398 CALL_MultiTexImage2DEXT(ctx->Exec, (texunit, target, level, components, width,
10399 height, border, format, type, pixels));
10400 }
10401 }
10402 }
10403
10404
10405 static void GLAPIENTRY
10406 save_MultiTexImage3DEXT(GLenum texunit, GLenum target,
10407 GLint level, GLint internalFormat,
10408 GLsizei width, GLsizei height, GLsizei depth,
10409 GLint border,
10410 GLenum format, GLenum type, const GLvoid * pixels)
10411 {
10412 GET_CURRENT_CONTEXT(ctx);
10413 if (target == GL_PROXY_TEXTURE_3D) {
10414 /* don't compile, execute immediately */
10415 CALL_MultiTexImage3DEXT(ctx->Exec, (texunit, target, level, internalFormat, width,
10416 height, depth, border, format, type,
10417 pixels));
10418 }
10419 else {
10420 Node *n;
10421 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10422 n = alloc_instruction(ctx, OPCODE_MULTITEX_IMAGE3D, 10 + POINTER_DWORDS);
10423 if (n) {
10424 n[1].e = texunit;
10425 n[2].e = target;
10426 n[3].i = level;
10427 n[4].i = (GLint) internalFormat;
10428 n[5].i = (GLint) width;
10429 n[6].i = (GLint) height;
10430 n[7].i = (GLint) depth;
10431 n[8].i = border;
10432 n[9].e = format;
10433 n[10].e = type;
10434 save_pointer(&n[11],
10435 unpack_image(ctx, 3, width, height, depth, format, type,
10436 pixels, &ctx->Unpack));
10437 }
10438 if (ctx->ExecuteFlag) {
10439 CALL_MultiTexImage3DEXT(ctx->Exec, (texunit, target, level, internalFormat,
10440 width, height, depth, border, format,
10441 type, pixels));
10442 }
10443 }
10444 }
10445
10446
10447 static void GLAPIENTRY
10448 save_MultiTexSubImage1DEXT(GLenum texunit, GLenum target, GLint level, GLint xoffset,
10449 GLsizei width, GLenum format, GLenum type,
10450 const GLvoid * pixels)
10451 {
10452 GET_CURRENT_CONTEXT(ctx);
10453 Node *n;
10454
10455 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10456
10457 n = alloc_instruction(ctx, OPCODE_MULTITEX_SUB_IMAGE1D, 7 + POINTER_DWORDS);
10458 if (n) {
10459 n[1].e = texunit;
10460 n[2].e = target;
10461 n[3].i = level;
10462 n[4].i = xoffset;
10463 n[5].i = (GLint) width;
10464 n[6].e = format;
10465 n[7].e = type;
10466 save_pointer(&n[8],
10467 unpack_image(ctx, 1, width, 1, 1, format, type,
10468 pixels, &ctx->Unpack));
10469 }
10470 if (ctx->ExecuteFlag) {
10471 CALL_MultiTexSubImage1DEXT(ctx->Exec, (texunit, target, level, xoffset, width,
10472 format, type, pixels));
10473 }
10474 }
10475
10476
10477 static void GLAPIENTRY
10478 save_MultiTexSubImage2DEXT(GLenum texunit, GLenum target, GLint level,
10479 GLint xoffset, GLint yoffset,
10480 GLsizei width, GLsizei height,
10481 GLenum format, GLenum type, const GLvoid * pixels)
10482 {
10483 GET_CURRENT_CONTEXT(ctx);
10484 Node *n;
10485
10486 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10487
10488 n = alloc_instruction(ctx, OPCODE_MULTITEX_SUB_IMAGE2D, 9 + POINTER_DWORDS);
10489 if (n) {
10490 n[1].e = texunit;
10491 n[2].e = target;
10492 n[3].i = level;
10493 n[4].i = xoffset;
10494 n[5].i = yoffset;
10495 n[6].i = (GLint) width;
10496 n[7].i = (GLint) height;
10497 n[8].e = format;
10498 n[9].e = type;
10499 save_pointer(&n[10],
10500 unpack_image(ctx, 2, width, height, 1, format, type,
10501 pixels, &ctx->Unpack));
10502 }
10503 if (ctx->ExecuteFlag) {
10504 CALL_MultiTexSubImage2DEXT(ctx->Exec, (texunit, target, level, xoffset, yoffset,
10505 width, height, format, type, pixels));
10506 }
10507 }
10508
10509
10510 static void GLAPIENTRY
10511 save_MultiTexSubImage3DEXT(GLenum texunit, GLenum target, GLint level,
10512 GLint xoffset, GLint yoffset, GLint zoffset,
10513 GLsizei width, GLsizei height, GLsizei depth,
10514 GLenum format, GLenum type, const GLvoid * pixels)
10515 {
10516 GET_CURRENT_CONTEXT(ctx);
10517 Node *n;
10518
10519 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10520
10521 n = alloc_instruction(ctx, OPCODE_MULTITEX_SUB_IMAGE3D, 11 + POINTER_DWORDS);
10522 if (n) {
10523 n[1].e = texunit;
10524 n[2].e = target;
10525 n[3].i = level;
10526 n[4].i = xoffset;
10527 n[5].i = yoffset;
10528 n[6].i = zoffset;
10529 n[7].i = (GLint) width;
10530 n[8].i = (GLint) height;
10531 n[9].i = (GLint) depth;
10532 n[10].e = format;
10533 n[11].e = type;
10534 save_pointer(&n[12],
10535 unpack_image(ctx, 3, width, height, depth, format, type,
10536 pixels, &ctx->Unpack));
10537 }
10538 if (ctx->ExecuteFlag) {
10539 CALL_MultiTexSubImage3DEXT(ctx->Exec, (texunit, target, level,
10540 xoffset, yoffset, zoffset,
10541 width, height, depth, format, type,
10542 pixels));
10543 }
10544 }
10545
10546
10547 static void GLAPIENTRY
10548 save_CopyMultiTexImage1DEXT(GLenum texunit, GLenum target, GLint level,
10549 GLenum internalformat, GLint x, GLint y,
10550 GLsizei width, GLint border)
10551 {
10552 GET_CURRENT_CONTEXT(ctx);
10553 Node *n;
10554 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10555 n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_IMAGE1D, 8);
10556 if (n) {
10557 n[1].e = texunit;
10558 n[2].e = target;
10559 n[3].i = level;
10560 n[4].e = internalformat;
10561 n[5].i = x;
10562 n[6].i = y;
10563 n[7].i = width;
10564 n[8].i = border;
10565 }
10566 if (ctx->ExecuteFlag) {
10567 CALL_CopyMultiTexImage1DEXT(ctx->Exec, (texunit, target, level,
10568 internalformat, x, y,
10569 width, border));
10570 }
10571 }
10572
10573
10574 static void GLAPIENTRY
10575 save_CopyMultiTexImage2DEXT(GLenum texunit, GLenum target, GLint level,
10576 GLenum internalformat,
10577 GLint x, GLint y, GLsizei width,
10578 GLsizei height, GLint border)
10579 {
10580 GET_CURRENT_CONTEXT(ctx);
10581 Node *n;
10582 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10583 n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_IMAGE2D, 9);
10584 if (n) {
10585 n[1].e = texunit;
10586 n[2].e = target;
10587 n[3].i = level;
10588 n[4].e = internalformat;
10589 n[5].i = x;
10590 n[6].i = y;
10591 n[7].i = width;
10592 n[8].i = height;
10593 n[9].i = border;
10594 }
10595 if (ctx->ExecuteFlag) {
10596 CALL_CopyMultiTexImage2DEXT(ctx->Exec, (texunit, target, level,
10597 internalformat, x, y,
10598 width, height, border));
10599 }
10600 }
10601
10602
10603 static void GLAPIENTRY
10604 save_CopyMultiTexSubImage1DEXT(GLenum texunit, GLenum target, GLint level,
10605 GLint xoffset, GLint x, GLint y, GLsizei width)
10606 {
10607 GET_CURRENT_CONTEXT(ctx);
10608 Node *n;
10609 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10610 n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_SUB_IMAGE1D, 7);
10611 if (n) {
10612 n[1].e = texunit;
10613 n[2].e = target;
10614 n[3].i = level;
10615 n[4].i = xoffset;
10616 n[5].i = x;
10617 n[6].i = y;
10618 n[7].i = width;
10619 }
10620 if (ctx->ExecuteFlag) {
10621 CALL_CopyMultiTexSubImage1DEXT(ctx->Exec,
10622 (texunit, target, level, xoffset, x, y, width));
10623 }
10624 }
10625
10626
10627 static void GLAPIENTRY
10628 save_CopyMultiTexSubImage2DEXT(GLenum texunit, GLenum target, GLint level,
10629 GLint xoffset, GLint yoffset,
10630 GLint x, GLint y, GLsizei width, GLint height)
10631 {
10632 GET_CURRENT_CONTEXT(ctx);
10633 Node *n;
10634 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10635 n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_SUB_IMAGE2D, 9);
10636 if (n) {
10637 n[1].e = texunit;
10638 n[2].e = target;
10639 n[3].i = level;
10640 n[4].i = xoffset;
10641 n[5].i = yoffset;
10642 n[6].i = x;
10643 n[7].i = y;
10644 n[8].i = width;
10645 n[9].i = height;
10646 }
10647 if (ctx->ExecuteFlag) {
10648 CALL_CopyMultiTexSubImage2DEXT(ctx->Exec, (texunit, target, level,
10649 xoffset, yoffset,
10650 x, y, width, height));
10651 }
10652 }
10653
10654
10655 static void GLAPIENTRY
10656 save_CopyMultiTexSubImage3DEXT(GLenum texunit, GLenum target, GLint level,
10657 GLint xoffset, GLint yoffset, GLint zoffset,
10658 GLint x, GLint y, GLsizei width, GLint height)
10659 {
10660 GET_CURRENT_CONTEXT(ctx);
10661 Node *n;
10662 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10663 n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_SUB_IMAGE3D, 10);
10664 if (n) {
10665 n[1].e = texunit;
10666 n[2].e = target;
10667 n[3].i = level;
10668 n[4].i = xoffset;
10669 n[5].i = yoffset;
10670 n[6].i = zoffset;
10671 n[7].i = x;
10672 n[8].i = y;
10673 n[9].i = width;
10674 n[10].i = height;
10675 }
10676 if (ctx->ExecuteFlag) {
10677 CALL_CopyMultiTexSubImage3DEXT(ctx->Exec, (texunit, target, level,
10678 xoffset, yoffset, zoffset,
10679 x, y, width, height));
10680 }
10681 }
10682
10683
10684 static void GLAPIENTRY
10685 save_MultiTexEnvfvEXT(GLenum texunit, GLenum target, GLenum pname, const GLfloat *params)
10686 {
10687 GET_CURRENT_CONTEXT(ctx);
10688 Node *n;
10689 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10690 n = alloc_instruction(ctx, OPCODE_MULTITEXENV, 7);
10691 if (n) {
10692 n[1].e = texunit;
10693 n[2].e = target;
10694 n[3].e = pname;
10695 if (pname == GL_TEXTURE_ENV_COLOR) {
10696 n[4].f = params[0];
10697 n[5].f = params[1];
10698 n[6].f = params[2];
10699 n[7].f = params[3];
10700 }
10701 else {
10702 n[4].f = params[0];
10703 n[5].f = n[6].f = n[7].f = 0.0F;
10704 }
10705 }
10706 if (ctx->ExecuteFlag) {
10707 CALL_MultiTexEnvfvEXT(ctx->Exec, (texunit, target, pname, params));
10708 }
10709 }
10710
10711
10712 static void GLAPIENTRY
10713 save_MultiTexEnvfEXT(GLenum texunit, GLenum target, GLenum pname, GLfloat param)
10714 {
10715 GLfloat parray[4];
10716 parray[0] = (GLfloat) param;
10717 parray[1] = parray[2] = parray[3] = 0.0F;
10718 save_MultiTexEnvfvEXT(texunit, target, pname, parray);
10719 }
10720
10721
10722 static void GLAPIENTRY
10723 save_MultiTexEnviEXT(GLenum texunit, GLenum target, GLenum pname, GLint param)
10724 {
10725 GLfloat p[4];
10726 p[0] = (GLfloat) param;
10727 p[1] = p[2] = p[3] = 0.0F;
10728 save_MultiTexEnvfvEXT(texunit, target, pname, p);
10729 }
10730
10731
10732 static void GLAPIENTRY
10733 save_MultiTexEnvivEXT(GLenum texunit, GLenum target, GLenum pname, const GLint * param)
10734 {
10735 GLfloat p[4];
10736 if (pname == GL_TEXTURE_ENV_COLOR) {
10737 p[0] = INT_TO_FLOAT(param[0]);
10738 p[1] = INT_TO_FLOAT(param[1]);
10739 p[2] = INT_TO_FLOAT(param[2]);
10740 p[3] = INT_TO_FLOAT(param[3]);
10741 }
10742 else {
10743 p[0] = (GLfloat) param[0];
10744 p[1] = p[2] = p[3] = 0.0F;
10745 }
10746 save_MultiTexEnvfvEXT(texunit, target, pname, p);
10747 }
10748
10749
10750 static void GLAPIENTRY
10751 save_CompressedTextureImage1DEXT(GLuint texture, GLenum target, GLint level,
10752 GLenum internalFormat, GLsizei width,
10753 GLint border, GLsizei imageSize,
10754 const GLvoid * data)
10755 {
10756 GET_CURRENT_CONTEXT(ctx);
10757 if (target == GL_PROXY_TEXTURE_1D) {
10758 /* don't compile, execute immediately */
10759 CALL_CompressedTextureImage1DEXT(ctx->Exec, (texture, target, level,
10760 internalFormat, width,
10761 border, imageSize,
10762 data));
10763 }
10764 else {
10765 Node *n;
10766 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10767
10768 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_IMAGE_1D,
10769 7 + POINTER_DWORDS);
10770 if (n) {
10771 n[1].ui = texture;
10772 n[2].e = target;
10773 n[3].i = level;
10774 n[4].e = internalFormat;
10775 n[5].i = (GLint) width;
10776 n[6].i = border;
10777 n[7].i = imageSize;
10778 save_pointer(&n[8],
10779 copy_data(data, imageSize, "glCompressedTextureImage1DEXT"));
10780 }
10781 if (ctx->ExecuteFlag) {
10782 CALL_CompressedTextureImage1DEXT(ctx->Exec,
10783 (texture, target, level, internalFormat,
10784 width, border, imageSize, data));
10785 }
10786 }
10787 }
10788
10789
10790 static void GLAPIENTRY
10791 save_CompressedTextureImage2DEXT(GLuint texture, GLenum target, GLint level,
10792 GLenum internalFormat, GLsizei width,
10793 GLsizei height, GLint border, GLsizei imageSize,
10794 const GLvoid * data)
10795 {
10796 GET_CURRENT_CONTEXT(ctx);
10797 if (target == GL_PROXY_TEXTURE_2D) {
10798 /* don't compile, execute immediately */
10799 CALL_CompressedTextureImage2DEXT(ctx->Exec, (texture, target, level,
10800 internalFormat, width, height,
10801 border, imageSize, data));
10802 }
10803 else {
10804 Node *n;
10805 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10806
10807 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_IMAGE_2D,
10808 8 + POINTER_DWORDS);
10809 if (n) {
10810 n[1].ui = texture;
10811 n[2].e = target;
10812 n[3].i = level;
10813 n[4].e = internalFormat;
10814 n[5].i = (GLint) width;
10815 n[6].i = (GLint) height;
10816 n[7].i = border;
10817 n[8].i = imageSize;
10818 save_pointer(&n[9],
10819 copy_data(data, imageSize, "glCompressedTextureImage2DEXT"));
10820 }
10821 if (ctx->ExecuteFlag) {
10822 CALL_CompressedTextureImage2DEXT(ctx->Exec,
10823 (texture, target, level, internalFormat,
10824 width, height, border, imageSize, data));
10825 }
10826 }
10827 }
10828
10829
10830 static void GLAPIENTRY
10831 save_CompressedTextureImage3DEXT(GLuint texture, GLenum target, GLint level,
10832 GLenum internalFormat, GLsizei width,
10833 GLsizei height, GLsizei depth, GLint border,
10834 GLsizei imageSize, const GLvoid * data)
10835 {
10836 GET_CURRENT_CONTEXT(ctx);
10837 if (target == GL_PROXY_TEXTURE_3D) {
10838 /* don't compile, execute immediately */
10839 CALL_CompressedTextureImage3DEXT(ctx->Exec, (texture, target, level,
10840 internalFormat, width,
10841 height, depth, border,
10842 imageSize, data));
10843 }
10844 else {
10845 Node *n;
10846 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10847
10848 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_IMAGE_3D,
10849 9 + POINTER_DWORDS);
10850 if (n) {
10851 n[1].ui = texture;
10852 n[2].e = target;
10853 n[3].i = level;
10854 n[4].e = internalFormat;
10855 n[5].i = (GLint) width;
10856 n[6].i = (GLint) height;
10857 n[7].i = (GLint) depth;
10858 n[8].i = border;
10859 n[9].i = imageSize;
10860 save_pointer(&n[10],
10861 copy_data(data, imageSize, "glCompressedTextureImage3DEXT"));
10862 }
10863 if (ctx->ExecuteFlag) {
10864 CALL_CompressedTextureImage3DEXT(ctx->Exec,
10865 (texture, target, level, internalFormat,
10866 width, height, depth, border, imageSize,
10867 data));
10868 }
10869 }
10870 }
10871
10872
10873 static void GLAPIENTRY
10874 save_CompressedTextureSubImage1DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset,
10875 GLsizei width, GLenum format,
10876 GLsizei imageSize, const GLvoid * data)
10877 {
10878 Node *n;
10879 GET_CURRENT_CONTEXT(ctx);
10880 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10881
10882 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_1D,
10883 7 + POINTER_DWORDS);
10884 if (n) {
10885 n[1].ui = texture;
10886 n[2].e = target;
10887 n[3].i = level;
10888 n[4].i = xoffset;
10889 n[5].i = (GLint) width;
10890 n[6].e = format;
10891 n[7].i = imageSize;
10892 save_pointer(&n[8],
10893 copy_data(data, imageSize, "glCompressedTextureSubImage1DEXT"));
10894 }
10895 if (ctx->ExecuteFlag) {
10896 CALL_CompressedTextureSubImage1DEXT(ctx->Exec, (texture, target, level, xoffset,
10897 width, format, imageSize, data));
10898 }
10899 }
10900
10901
10902 static void GLAPIENTRY
10903 save_CompressedTextureSubImage2DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset,
10904 GLint yoffset, GLsizei width, GLsizei height,
10905 GLenum format, GLsizei imageSize,
10906 const GLvoid * data)
10907 {
10908 Node *n;
10909 GET_CURRENT_CONTEXT(ctx);
10910 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10911
10912 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_2D,
10913 9 + POINTER_DWORDS);
10914 if (n) {
10915 n[1].ui = texture;
10916 n[2].e = target;
10917 n[3].i = level;
10918 n[4].i = xoffset;
10919 n[5].i = yoffset;
10920 n[6].i = (GLint) width;
10921 n[7].i = (GLint) height;
10922 n[8].e = format;
10923 n[9].i = imageSize;
10924 save_pointer(&n[10],
10925 copy_data(data, imageSize, "glCompressedTextureSubImage2DEXT"));
10926 }
10927 if (ctx->ExecuteFlag) {
10928 CALL_CompressedTextureSubImage2DEXT(ctx->Exec,
10929 (texture, target, level, xoffset, yoffset,
10930 width, height, format, imageSize, data));
10931 }
10932 }
10933
10934
10935 static void GLAPIENTRY
10936 save_CompressedTextureSubImage3DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset,
10937 GLint yoffset, GLint zoffset, GLsizei width,
10938 GLsizei height, GLsizei depth, GLenum format,
10939 GLsizei imageSize, const GLvoid * data)
10940 {
10941 Node *n;
10942 GET_CURRENT_CONTEXT(ctx);
10943 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10944
10945 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_3D,
10946 11 + POINTER_DWORDS);
10947 if (n) {
10948 n[1].ui = texture;
10949 n[2].e = target;
10950 n[3].i = level;
10951 n[4].i = xoffset;
10952 n[5].i = yoffset;
10953 n[6].i = zoffset;
10954 n[7].i = (GLint) width;
10955 n[8].i = (GLint) height;
10956 n[9].i = (GLint) depth;
10957 n[10].e = format;
10958 n[11].i = imageSize;
10959 save_pointer(&n[12],
10960 copy_data(data, imageSize, "glCompressedTextureSubImage3DEXT"));
10961 }
10962 if (ctx->ExecuteFlag) {
10963 CALL_CompressedTextureSubImage3DEXT(ctx->Exec,
10964 (texture, target, level, xoffset, yoffset,
10965 zoffset, width, height, depth, format,
10966 imageSize, data));
10967 }
10968 }
10969
10970
10971 static void GLAPIENTRY
10972 save_CompressedMultiTexImage1DEXT(GLenum texunit, GLenum target, GLint level,
10973 GLenum internalFormat, GLsizei width,
10974 GLint border, GLsizei imageSize,
10975 const GLvoid * data)
10976 {
10977 GET_CURRENT_CONTEXT(ctx);
10978 if (target == GL_PROXY_TEXTURE_1D) {
10979 /* don't compile, execute immediately */
10980 CALL_CompressedMultiTexImage1DEXT(ctx->Exec, (texunit, target, level,
10981 internalFormat, width,
10982 border, imageSize,
10983 data));
10984 }
10985 else {
10986 Node *n;
10987 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10988
10989 n = alloc_instruction(ctx, OPCODE_COMPRESSED_MULTITEX_IMAGE_1D,
10990 7 + POINTER_DWORDS);
10991 if (n) {
10992 n[1].e = texunit;
10993 n[2].e = target;
10994 n[3].i = level;
10995 n[4].e = internalFormat;
10996 n[5].i = (GLint) width;
10997 n[6].i = border;
10998 n[7].i = imageSize;
10999 save_pointer(&n[8],
11000 copy_data(data, imageSize, "glCompressedMultiTexImage1DEXT"));
11001 }
11002 if (ctx->ExecuteFlag) {
11003 CALL_CompressedMultiTexImage1DEXT(ctx->Exec,
11004 (texunit, target, level, internalFormat,
11005 width, border, imageSize, data));
11006 }
11007 }
11008 }
11009
11010
11011 static void GLAPIENTRY
11012 save_CompressedMultiTexImage2DEXT(GLenum texunit, GLenum target, GLint level,
11013 GLenum internalFormat, GLsizei width,
11014 GLsizei height, GLint border, GLsizei imageSize,
11015 const GLvoid * data)
11016 {
11017 GET_CURRENT_CONTEXT(ctx);
11018 if (target == GL_PROXY_TEXTURE_2D) {
11019 /* don't compile, execute immediately */
11020 CALL_CompressedMultiTexImage2DEXT(ctx->Exec, (texunit, target, level,
11021 internalFormat, width, height,
11022 border, imageSize, data));
11023 }
11024 else {
11025 Node *n;
11026 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
11027
11028 n = alloc_instruction(ctx, OPCODE_COMPRESSED_MULTITEX_IMAGE_2D,
11029 8 + POINTER_DWORDS);
11030 if (n) {
11031 n[1].e = texunit;
11032 n[2].e = target;
11033 n[3].i = level;
11034 n[4].e = internalFormat;
11035 n[5].i = (GLint) width;
11036 n[6].i = (GLint) height;
11037 n[7].i = border;
11038 n[8].i = imageSize;
11039 save_pointer(&n[9],
11040 copy_data(data, imageSize, "glCompressedMultiTexImage2DEXT"));
11041 }
11042 if (ctx->ExecuteFlag) {
11043 CALL_CompressedMultiTexImage2DEXT(ctx->Exec,
11044 (texunit, target, level, internalFormat,
11045 width, height, border, imageSize, data));
11046 }
11047 }
11048 }
11049
11050
11051 static void GLAPIENTRY
11052 save_CompressedMultiTexImage3DEXT(GLenum texunit, GLenum target, GLint level,
11053 GLenum internalFormat, GLsizei width,
11054 GLsizei height, GLsizei depth, GLint border,
11055 GLsizei imageSize, const GLvoid * data)
11056 {
11057 GET_CURRENT_CONTEXT(ctx);
11058 if (target == GL_PROXY_TEXTURE_3D) {
11059 /* don't compile, execute immediately */
11060 CALL_CompressedMultiTexImage3DEXT(ctx->Exec, (texunit, target, level,
11061 internalFormat, width,
11062 height, depth, border,
11063 imageSize, data));
11064 }
11065 else {
11066 Node *n;
11067 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
11068
11069 n = alloc_instruction(ctx, OPCODE_COMPRESSED_MULTITEX_IMAGE_3D,
11070 9 + POINTER_DWORDS);
11071 if (n) {
11072 n[1].e = texunit;
11073 n[2].e = target;
11074 n[3].i = level;
11075 n[4].e = internalFormat;
11076 n[5].i = (GLint) width;
11077 n[6].i = (GLint) height;
11078 n[7].i = (GLint) depth;
11079 n[8].i = border;
11080 n[9].i = imageSize;
11081 save_pointer(&n[10],
11082 copy_data(data, imageSize, "glCompressedMultiTexImage3DEXT"));
11083 }
11084 if (ctx->ExecuteFlag) {
11085 CALL_CompressedMultiTexImage3DEXT(ctx->Exec,
11086 (texunit, target, level, internalFormat,
11087 width, height, depth, border, imageSize,
11088 data));
11089 }
11090 }
11091 }
11092
11093
11094 static void GLAPIENTRY
11095 save_CompressedMultiTexSubImage1DEXT(GLenum texunit, GLenum target, GLint level, GLint xoffset,
11096 GLsizei width, GLenum format,
11097 GLsizei imageSize, const GLvoid * data)
11098 {
11099 Node *n;
11100 GET_CURRENT_CONTEXT(ctx);
11101 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
11102
11103 n = alloc_instruction(ctx, OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_1D,
11104 7 + POINTER_DWORDS);
11105 if (n) {
11106 n[1].e = texunit;
11107 n[2].e = target;
11108 n[3].i = level;
11109 n[4].i = xoffset;
11110 n[5].i = (GLint) width;
11111 n[6].e = format;
11112 n[7].i = imageSize;
11113 save_pointer(&n[8],
11114 copy_data(data, imageSize, "glCompressedMultiTexSubImage1DEXT"));
11115 }
11116 if (ctx->ExecuteFlag) {
11117 CALL_CompressedMultiTexSubImage1DEXT(ctx->Exec, (texunit, target, level, xoffset,
11118 width, format, imageSize, data));
11119 }
11120 }
11121
11122
11123 static void GLAPIENTRY
11124 save_CompressedMultiTexSubImage2DEXT(GLenum texunit, GLenum target, GLint level, GLint xoffset,
11125 GLint yoffset, GLsizei width, GLsizei height,
11126 GLenum format, GLsizei imageSize,
11127 const GLvoid * data)
11128 {
11129 Node *n;
11130 GET_CURRENT_CONTEXT(ctx);
11131 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
11132
11133 n = alloc_instruction(ctx, OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_2D,
11134 9 + POINTER_DWORDS);
11135 if (n) {
11136 n[1].e = texunit;
11137 n[2].e = target;
11138 n[3].i = level;
11139 n[4].i = xoffset;
11140 n[5].i = yoffset;
11141 n[6].i = (GLint) width;
11142 n[7].i = (GLint) height;
11143 n[8].e = format;
11144 n[9].i = imageSize;
11145 save_pointer(&n[10],
11146 copy_data(data, imageSize, "glCompressedMultiTexSubImage2DEXT"));
11147 }
11148 if (ctx->ExecuteFlag) {
11149 CALL_CompressedMultiTexSubImage2DEXT(ctx->Exec,
11150 (texunit, target, level, xoffset, yoffset,
11151 width, height, format, imageSize, data));
11152 }
11153 }
11154
11155
11156 static void GLAPIENTRY
11157 save_CompressedMultiTexSubImage3DEXT(GLenum texunit, GLenum target, GLint level, GLint xoffset,
11158 GLint yoffset, GLint zoffset, GLsizei width,
11159 GLsizei height, GLsizei depth, GLenum format,
11160 GLsizei imageSize, const GLvoid * data)
11161 {
11162 Node *n;
11163 GET_CURRENT_CONTEXT(ctx);
11164 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
11165
11166 n = alloc_instruction(ctx, OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_3D,
11167 11 + POINTER_DWORDS);
11168 if (n) {
11169 n[1].e = texunit;
11170 n[2].e = target;
11171 n[3].i = level;
11172 n[4].i = xoffset;
11173 n[5].i = yoffset;
11174 n[6].i = zoffset;
11175 n[7].i = (GLint) width;
11176 n[8].i = (GLint) height;
11177 n[9].i = (GLint) depth;
11178 n[10].e = format;
11179 n[11].i = imageSize;
11180 save_pointer(&n[12],
11181 copy_data(data, imageSize, "glCompressedMultiTexSubImage3DEXT"));
11182 }
11183 if (ctx->ExecuteFlag) {
11184 CALL_CompressedMultiTexSubImage3DEXT(ctx->Exec,
11185 (texunit, target, level, xoffset, yoffset,
11186 zoffset, width, height, depth, format,
11187 imageSize, data));
11188 }
11189 }
11190
11191
11192 static void GLAPIENTRY
11193 save_NamedProgramStringEXT(GLuint program, GLenum target, GLenum format, GLsizei len,
11194 const GLvoid * string)
11195 {
11196 GET_CURRENT_CONTEXT(ctx);
11197 Node *n;
11198
11199 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
11200
11201 n = alloc_instruction(ctx, OPCODE_NAMED_PROGRAM_STRING, 4 + POINTER_DWORDS);
11202 if (n) {
11203 GLubyte *programCopy = malloc(len);
11204 if (!programCopy) {
11205 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glNamedProgramStringEXT");
11206 return;
11207 }
11208 memcpy(programCopy, string, len);
11209 n[1].ui = program;
11210 n[2].e = target;
11211 n[3].e = format;
11212 n[4].i = len;
11213 save_pointer(&n[5], programCopy);
11214 }
11215 if (ctx->ExecuteFlag) {
11216 CALL_NamedProgramStringEXT(ctx->Exec, (program, target, format, len, string));
11217 }
11218 }
11219
11220
11221 static void GLAPIENTRY
11222 save_NamedProgramLocalParameter4fEXT(GLuint program, GLenum target, GLuint index,
11223 GLfloat x, GLfloat y, GLfloat z, GLfloat w)
11224 {
11225 GET_CURRENT_CONTEXT(ctx);
11226 Node *n;
11227 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
11228 n = alloc_instruction(ctx, OPCODE_NAMED_PROGRAM_LOCAL_PARAMETER, 7);
11229 if (n) {
11230 n[1].ui = program;
11231 n[2].e = target;
11232 n[3].ui = index;
11233 n[4].f = x;
11234 n[5].f = y;
11235 n[6].f = z;
11236 n[7].f = w;
11237 }
11238 if (ctx->ExecuteFlag) {
11239 CALL_NamedProgramLocalParameter4fEXT(ctx->Exec, (program, target, index, x, y, z, w));
11240 }
11241 }
11242
11243
11244 static void GLAPIENTRY
11245 save_NamedProgramLocalParameter4fvEXT(GLuint program, GLenum target, GLuint index,
11246 const GLfloat *params)
11247 {
11248 save_NamedProgramLocalParameter4fEXT(program, target, index, params[0],
11249 params[1], params[2], params[3]);
11250 }
11251
11252
11253 static void GLAPIENTRY
11254 save_NamedProgramLocalParameter4dEXT(GLuint program, GLenum target, GLuint index,
11255 GLdouble x, GLdouble y,
11256 GLdouble z, GLdouble w)
11257 {
11258 save_NamedProgramLocalParameter4fEXT(program, target, index, (GLfloat) x,
11259 (GLfloat) y, (GLfloat) z, (GLfloat) w);
11260 }
11261
11262
11263 static void GLAPIENTRY
11264 save_NamedProgramLocalParameter4dvEXT(GLuint program, GLenum target, GLuint index,
11265 const GLdouble *params)
11266 {
11267 save_NamedProgramLocalParameter4fEXT(program, target, index, (GLfloat) params[0],
11268 (GLfloat) params[1], (GLfloat) params[2],
11269 (GLfloat) params[3]);
11270 }
11271
11272
11273 /**
11274 * Save an error-generating command into display list.
11275 *
11276 * KW: Will appear in the list before the vertex buffer containing the
11277 * command that provoked the error. I don't see this as a problem.
11278 */
11279 static void
11280 save_error(struct gl_context *ctx, GLenum error, const char *s)
11281 {
11282 Node *n;
11283 n = alloc_instruction(ctx, OPCODE_ERROR, 1 + POINTER_DWORDS);
11284 if (n) {
11285 n[1].e = error;
11286 save_pointer(&n[2], (void *) s);
11287 /* note: the data/string here doesn't have to be freed in
11288 * _mesa_delete_list() since the string is never dynamically
11289 * allocated.
11290 */
11291 }
11292 }
11293
11294
11295 /**
11296 * Compile an error into current display list.
11297 */
11298 void
11299 _mesa_compile_error(struct gl_context *ctx, GLenum error, const char *s)
11300 {
11301 if (ctx->CompileFlag)
11302 save_error(ctx, error, s);
11303 if (ctx->ExecuteFlag)
11304 _mesa_error(ctx, error, "%s", s);
11305 }
11306
11307
11308 /**
11309 * Test if ID names a display list.
11310 */
11311 static GLboolean
11312 islist(struct gl_context *ctx, GLuint list)
11313 {
11314 if (list > 0 && _mesa_lookup_list(ctx, list)) {
11315 return GL_TRUE;
11316 }
11317 else {
11318 return GL_FALSE;
11319 }
11320 }
11321
11322
11323
11324 /**********************************************************************/
11325 /* Display list execution */
11326 /**********************************************************************/
11327
11328
11329 /*
11330 * Execute a display list. Note that the ListBase offset must have already
11331 * been added before calling this function. I.e. the list argument is
11332 * the absolute list number, not relative to ListBase.
11333 * \param list - display list number
11334 */
11335 static void
11336 execute_list(struct gl_context *ctx, GLuint list)
11337 {
11338 struct gl_display_list *dlist;
11339 Node *n;
11340 GLboolean done;
11341
11342 if (list == 0 || !islist(ctx, list))
11343 return;
11344
11345 if (ctx->ListState.CallDepth == MAX_LIST_NESTING) {
11346 /* raise an error? */
11347 return;
11348 }
11349
11350 dlist = _mesa_lookup_list(ctx, list);
11351 if (!dlist)
11352 return;
11353
11354 ctx->ListState.CallDepth++;
11355
11356 vbo_save_BeginCallList(ctx, dlist);
11357
11358 n = dlist->Head;
11359
11360 done = GL_FALSE;
11361 while (!done) {
11362 const OpCode opcode = n[0].opcode;
11363
11364 if (is_ext_opcode(opcode)) {
11365 n += ext_opcode_execute(ctx, n);
11366 }
11367 else {
11368 switch (opcode) {
11369 case OPCODE_ERROR:
11370 _mesa_error(ctx, n[1].e, "%s", (const char *) get_pointer(&n[2]));
11371 break;
11372 case OPCODE_ACCUM:
11373 CALL_Accum(ctx->Exec, (n[1].e, n[2].f));
11374 break;
11375 case OPCODE_ALPHA_FUNC:
11376 CALL_AlphaFunc(ctx->Exec, (n[1].e, n[2].f));
11377 break;
11378 case OPCODE_BIND_TEXTURE:
11379 CALL_BindTexture(ctx->Exec, (n[1].e, n[2].ui));
11380 break;
11381 case OPCODE_BITMAP:
11382 {
11383 const struct gl_pixelstore_attrib save = ctx->Unpack;
11384 ctx->Unpack = ctx->DefaultPacking;
11385 CALL_Bitmap(ctx->Exec, ((GLsizei) n[1].i, (GLsizei) n[2].i,
11386 n[3].f, n[4].f, n[5].f, n[6].f,
11387 get_pointer(&n[7])));
11388 ctx->Unpack = save; /* restore */
11389 }
11390 break;
11391 case OPCODE_BLEND_COLOR:
11392 CALL_BlendColor(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
11393 break;
11394 case OPCODE_BLEND_EQUATION:
11395 CALL_BlendEquation(ctx->Exec, (n[1].e));
11396 break;
11397 case OPCODE_BLEND_EQUATION_SEPARATE:
11398 CALL_BlendEquationSeparate(ctx->Exec, (n[1].e, n[2].e));
11399 break;
11400 case OPCODE_BLEND_FUNC_SEPARATE:
11401 CALL_BlendFuncSeparate(ctx->Exec,
11402 (n[1].e, n[2].e, n[3].e, n[4].e));
11403 break;
11404
11405 case OPCODE_BLEND_FUNC_I:
11406 /* GL_ARB_draw_buffers_blend */
11407 CALL_BlendFunciARB(ctx->Exec, (n[1].ui, n[2].e, n[3].e));
11408 break;
11409 case OPCODE_BLEND_FUNC_SEPARATE_I:
11410 /* GL_ARB_draw_buffers_blend */
11411 CALL_BlendFuncSeparateiARB(ctx->Exec, (n[1].ui, n[2].e, n[3].e,
11412 n[4].e, n[5].e));
11413 break;
11414 case OPCODE_BLEND_EQUATION_I:
11415 /* GL_ARB_draw_buffers_blend */
11416 CALL_BlendEquationiARB(ctx->Exec, (n[1].ui, n[2].e));
11417 break;
11418 case OPCODE_BLEND_EQUATION_SEPARATE_I:
11419 /* GL_ARB_draw_buffers_blend */
11420 CALL_BlendEquationSeparateiARB(ctx->Exec,
11421 (n[1].ui, n[2].e, n[3].e));
11422 break;
11423
11424 case OPCODE_CALL_LIST:
11425 /* Generated by glCallList(), don't add ListBase */
11426 if (ctx->ListState.CallDepth < MAX_LIST_NESTING) {
11427 execute_list(ctx, n[1].ui);
11428 }
11429 break;
11430 case OPCODE_CALL_LISTS:
11431 if (ctx->ListState.CallDepth < MAX_LIST_NESTING) {
11432 CALL_CallLists(ctx->Exec, (n[1].i, n[2].e, get_pointer(&n[3])));
11433 }
11434 break;
11435 case OPCODE_CLEAR:
11436 CALL_Clear(ctx->Exec, (n[1].bf));
11437 break;
11438 case OPCODE_CLEAR_BUFFER_IV:
11439 {
11440 GLint value[4];
11441 value[0] = n[3].i;
11442 value[1] = n[4].i;
11443 value[2] = n[5].i;
11444 value[3] = n[6].i;
11445 CALL_ClearBufferiv(ctx->Exec, (n[1].e, n[2].i, value));
11446 }
11447 break;
11448 case OPCODE_CLEAR_BUFFER_UIV:
11449 {
11450 GLuint value[4];
11451 value[0] = n[3].ui;
11452 value[1] = n[4].ui;
11453 value[2] = n[5].ui;
11454 value[3] = n[6].ui;
11455 CALL_ClearBufferuiv(ctx->Exec, (n[1].e, n[2].i, value));
11456 }
11457 break;
11458 case OPCODE_CLEAR_BUFFER_FV:
11459 {
11460 GLfloat value[4];
11461 value[0] = n[3].f;
11462 value[1] = n[4].f;
11463 value[2] = n[5].f;
11464 value[3] = n[6].f;
11465 CALL_ClearBufferfv(ctx->Exec, (n[1].e, n[2].i, value));
11466 }
11467 break;
11468 case OPCODE_CLEAR_BUFFER_FI:
11469 CALL_ClearBufferfi(ctx->Exec, (n[1].e, n[2].i, n[3].f, n[4].i));
11470 break;
11471 case OPCODE_CLEAR_COLOR:
11472 CALL_ClearColor(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
11473 break;
11474 case OPCODE_CLEAR_ACCUM:
11475 CALL_ClearAccum(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
11476 break;
11477 case OPCODE_CLEAR_DEPTH:
11478 CALL_ClearDepth(ctx->Exec, ((GLclampd) n[1].f));
11479 break;
11480 case OPCODE_CLEAR_INDEX:
11481 CALL_ClearIndex(ctx->Exec, ((GLfloat) n[1].ui));
11482 break;
11483 case OPCODE_CLEAR_STENCIL:
11484 CALL_ClearStencil(ctx->Exec, (n[1].i));
11485 break;
11486 case OPCODE_CLIP_PLANE:
11487 {
11488 GLdouble eq[4];
11489 eq[0] = n[2].f;
11490 eq[1] = n[3].f;
11491 eq[2] = n[4].f;
11492 eq[3] = n[5].f;
11493 CALL_ClipPlane(ctx->Exec, (n[1].e, eq));
11494 }
11495 break;
11496 case OPCODE_COLOR_MASK:
11497 CALL_ColorMask(ctx->Exec, (n[1].b, n[2].b, n[3].b, n[4].b));
11498 break;
11499 case OPCODE_COLOR_MASK_INDEXED:
11500 CALL_ColorMaski(ctx->Exec, (n[1].ui, n[2].b, n[3].b,
11501 n[4].b, n[5].b));
11502 break;
11503 case OPCODE_COLOR_MATERIAL:
11504 CALL_ColorMaterial(ctx->Exec, (n[1].e, n[2].e));
11505 break;
11506 case OPCODE_COPY_PIXELS:
11507 CALL_CopyPixels(ctx->Exec, (n[1].i, n[2].i,
11508 (GLsizei) n[3].i, (GLsizei) n[4].i,
11509 n[5].e));
11510 break;
11511 case OPCODE_COPY_TEX_IMAGE1D:
11512 CALL_CopyTexImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].e, n[4].i,
11513 n[5].i, n[6].i, n[7].i));
11514 break;
11515 case OPCODE_COPY_TEX_IMAGE2D:
11516 CALL_CopyTexImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].e, n[4].i,
11517 n[5].i, n[6].i, n[7].i, n[8].i));
11518 break;
11519 case OPCODE_COPY_TEX_SUB_IMAGE1D:
11520 CALL_CopyTexSubImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
11521 n[4].i, n[5].i, n[6].i));
11522 break;
11523 case OPCODE_COPY_TEX_SUB_IMAGE2D:
11524 CALL_CopyTexSubImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
11525 n[4].i, n[5].i, n[6].i, n[7].i,
11526 n[8].i));
11527 break;
11528 case OPCODE_COPY_TEX_SUB_IMAGE3D:
11529 CALL_CopyTexSubImage3D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
11530 n[4].i, n[5].i, n[6].i, n[7].i,
11531 n[8].i, n[9].i));
11532 break;
11533 case OPCODE_CULL_FACE:
11534 CALL_CullFace(ctx->Exec, (n[1].e));
11535 break;
11536 case OPCODE_DEPTH_FUNC:
11537 CALL_DepthFunc(ctx->Exec, (n[1].e));
11538 break;
11539 case OPCODE_DEPTH_MASK:
11540 CALL_DepthMask(ctx->Exec, (n[1].b));
11541 break;
11542 case OPCODE_DEPTH_RANGE:
11543 CALL_DepthRange(ctx->Exec,
11544 ((GLclampd) n[1].f, (GLclampd) n[2].f));
11545 break;
11546 case OPCODE_DISABLE:
11547 CALL_Disable(ctx->Exec, (n[1].e));
11548 break;
11549 case OPCODE_DISABLE_INDEXED:
11550 CALL_Disablei(ctx->Exec, (n[1].ui, n[2].e));
11551 break;
11552 case OPCODE_DRAW_BUFFER:
11553 CALL_DrawBuffer(ctx->Exec, (n[1].e));
11554 break;
11555 case OPCODE_DRAW_PIXELS:
11556 {
11557 const struct gl_pixelstore_attrib save = ctx->Unpack;
11558 ctx->Unpack = ctx->DefaultPacking;
11559 CALL_DrawPixels(ctx->Exec, (n[1].i, n[2].i, n[3].e, n[4].e,
11560 get_pointer(&n[5])));
11561 ctx->Unpack = save; /* restore */
11562 }
11563 break;
11564 case OPCODE_ENABLE:
11565 CALL_Enable(ctx->Exec, (n[1].e));
11566 break;
11567 case OPCODE_ENABLE_INDEXED:
11568 CALL_Enablei(ctx->Exec, (n[1].ui, n[2].e));
11569 break;
11570 case OPCODE_EVALMESH1:
11571 CALL_EvalMesh1(ctx->Exec, (n[1].e, n[2].i, n[3].i));
11572 break;
11573 case OPCODE_EVALMESH2:
11574 CALL_EvalMesh2(ctx->Exec,
11575 (n[1].e, n[2].i, n[3].i, n[4].i, n[5].i));
11576 break;
11577 case OPCODE_FOG:
11578 {
11579 GLfloat p[4];
11580 p[0] = n[2].f;
11581 p[1] = n[3].f;
11582 p[2] = n[4].f;
11583 p[3] = n[5].f;
11584 CALL_Fogfv(ctx->Exec, (n[1].e, p));
11585 }
11586 break;
11587 case OPCODE_FRONT_FACE:
11588 CALL_FrontFace(ctx->Exec, (n[1].e));
11589 break;
11590 case OPCODE_FRUSTUM:
11591 CALL_Frustum(ctx->Exec,
11592 (n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f));
11593 break;
11594 case OPCODE_HINT:
11595 CALL_Hint(ctx->Exec, (n[1].e, n[2].e));
11596 break;
11597 case OPCODE_INDEX_MASK:
11598 CALL_IndexMask(ctx->Exec, (n[1].ui));
11599 break;
11600 case OPCODE_INIT_NAMES:
11601 CALL_InitNames(ctx->Exec, ());
11602 break;
11603 case OPCODE_LIGHT:
11604 {
11605 GLfloat p[4];
11606 p[0] = n[3].f;
11607 p[1] = n[4].f;
11608 p[2] = n[5].f;
11609 p[3] = n[6].f;
11610 CALL_Lightfv(ctx->Exec, (n[1].e, n[2].e, p));
11611 }
11612 break;
11613 case OPCODE_LIGHT_MODEL:
11614 {
11615 GLfloat p[4];
11616 p[0] = n[2].f;
11617 p[1] = n[3].f;
11618 p[2] = n[4].f;
11619 p[3] = n[5].f;
11620 CALL_LightModelfv(ctx->Exec, (n[1].e, p));
11621 }
11622 break;
11623 case OPCODE_LINE_STIPPLE:
11624 CALL_LineStipple(ctx->Exec, (n[1].i, n[2].us));
11625 break;
11626 case OPCODE_LINE_WIDTH:
11627 CALL_LineWidth(ctx->Exec, (n[1].f));
11628 break;
11629 case OPCODE_LIST_BASE:
11630 CALL_ListBase(ctx->Exec, (n[1].ui));
11631 break;
11632 case OPCODE_LOAD_IDENTITY:
11633 CALL_LoadIdentity(ctx->Exec, ());
11634 break;
11635 case OPCODE_LOAD_MATRIX:
11636 STATIC_ASSERT(sizeof(Node) == sizeof(GLfloat));
11637 CALL_LoadMatrixf(ctx->Exec, (&n[1].f));
11638 break;
11639 case OPCODE_LOAD_NAME:
11640 CALL_LoadName(ctx->Exec, (n[1].ui));
11641 break;
11642 case OPCODE_LOGIC_OP:
11643 CALL_LogicOp(ctx->Exec, (n[1].e));
11644 break;
11645 case OPCODE_MAP1:
11646 {
11647 GLenum target = n[1].e;
11648 GLint ustride = _mesa_evaluator_components(target);
11649 GLint uorder = n[5].i;
11650 GLfloat u1 = n[2].f;
11651 GLfloat u2 = n[3].f;
11652 CALL_Map1f(ctx->Exec, (target, u1, u2, ustride, uorder,
11653 (GLfloat *) get_pointer(&n[6])));
11654 }
11655 break;
11656 case OPCODE_MAP2:
11657 {
11658 GLenum target = n[1].e;
11659 GLfloat u1 = n[2].f;
11660 GLfloat u2 = n[3].f;
11661 GLfloat v1 = n[4].f;
11662 GLfloat v2 = n[5].f;
11663 GLint ustride = n[6].i;
11664 GLint vstride = n[7].i;
11665 GLint uorder = n[8].i;
11666 GLint vorder = n[9].i;
11667 CALL_Map2f(ctx->Exec, (target, u1, u2, ustride, uorder,
11668 v1, v2, vstride, vorder,
11669 (GLfloat *) get_pointer(&n[10])));
11670 }
11671 break;
11672 case OPCODE_MAPGRID1:
11673 CALL_MapGrid1f(ctx->Exec, (n[1].i, n[2].f, n[3].f));
11674 break;
11675 case OPCODE_MAPGRID2:
11676 CALL_MapGrid2f(ctx->Exec,
11677 (n[1].i, n[2].f, n[3].f, n[4].i, n[5].f, n[6].f));
11678 break;
11679 case OPCODE_MATRIX_MODE:
11680 CALL_MatrixMode(ctx->Exec, (n[1].e));
11681 break;
11682 case OPCODE_MULT_MATRIX:
11683 CALL_MultMatrixf(ctx->Exec, (&n[1].f));
11684 break;
11685 case OPCODE_ORTHO:
11686 CALL_Ortho(ctx->Exec,
11687 (n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f));
11688 break;
11689 case OPCODE_PASSTHROUGH:
11690 CALL_PassThrough(ctx->Exec, (n[1].f));
11691 break;
11692 case OPCODE_PATCH_PARAMETER_I:
11693 CALL_PatchParameteri(ctx->Exec, (n[1].e, n[2].i));
11694 break;
11695 case OPCODE_PATCH_PARAMETER_FV_INNER:
11696 {
11697 GLfloat params[2];
11698 params[0] = n[2].f;
11699 params[1] = n[3].f;
11700 CALL_PatchParameterfv(ctx->Exec, (n[1].e, params));
11701 }
11702 break;
11703 case OPCODE_PATCH_PARAMETER_FV_OUTER:
11704 {
11705 GLfloat params[4];
11706 params[0] = n[2].f;
11707 params[1] = n[3].f;
11708 params[2] = n[4].f;
11709 params[3] = n[5].f;
11710 CALL_PatchParameterfv(ctx->Exec, (n[1].e, params));
11711 }
11712 break;
11713 case OPCODE_PIXEL_MAP:
11714 CALL_PixelMapfv(ctx->Exec,
11715 (n[1].e, n[2].i, get_pointer(&n[3])));
11716 break;
11717 case OPCODE_PIXEL_TRANSFER:
11718 CALL_PixelTransferf(ctx->Exec, (n[1].e, n[2].f));
11719 break;
11720 case OPCODE_PIXEL_ZOOM:
11721 CALL_PixelZoom(ctx->Exec, (n[1].f, n[2].f));
11722 break;
11723 case OPCODE_POINT_SIZE:
11724 CALL_PointSize(ctx->Exec, (n[1].f));
11725 break;
11726 case OPCODE_POINT_PARAMETERS:
11727 {
11728 GLfloat params[3];
11729 params[0] = n[2].f;
11730 params[1] = n[3].f;
11731 params[2] = n[4].f;
11732 CALL_PointParameterfv(ctx->Exec, (n[1].e, params));
11733 }
11734 break;
11735 case OPCODE_POLYGON_MODE:
11736 CALL_PolygonMode(ctx->Exec, (n[1].e, n[2].e));
11737 break;
11738 case OPCODE_POLYGON_STIPPLE:
11739 {
11740 const struct gl_pixelstore_attrib save = ctx->Unpack;
11741 ctx->Unpack = ctx->DefaultPacking;
11742 CALL_PolygonStipple(ctx->Exec, (get_pointer(&n[1])));
11743 ctx->Unpack = save; /* restore */
11744 }
11745 break;
11746 case OPCODE_POLYGON_OFFSET:
11747 CALL_PolygonOffset(ctx->Exec, (n[1].f, n[2].f));
11748 break;
11749 case OPCODE_POLYGON_OFFSET_CLAMP:
11750 CALL_PolygonOffsetClampEXT(ctx->Exec, (n[1].f, n[2].f, n[3].f));
11751 break;
11752 case OPCODE_POP_ATTRIB:
11753 CALL_PopAttrib(ctx->Exec, ());
11754 break;
11755 case OPCODE_POP_MATRIX:
11756 CALL_PopMatrix(ctx->Exec, ());
11757 break;
11758 case OPCODE_POP_NAME:
11759 CALL_PopName(ctx->Exec, ());
11760 break;
11761 case OPCODE_PRIORITIZE_TEXTURE:
11762 CALL_PrioritizeTextures(ctx->Exec, (1, &n[1].ui, &n[2].f));
11763 break;
11764 case OPCODE_PUSH_ATTRIB:
11765 CALL_PushAttrib(ctx->Exec, (n[1].bf));
11766 break;
11767 case OPCODE_PUSH_MATRIX:
11768 CALL_PushMatrix(ctx->Exec, ());
11769 break;
11770 case OPCODE_PUSH_NAME:
11771 CALL_PushName(ctx->Exec, (n[1].ui));
11772 break;
11773 case OPCODE_RASTER_POS:
11774 CALL_RasterPos4f(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
11775 break;
11776 case OPCODE_READ_BUFFER:
11777 CALL_ReadBuffer(ctx->Exec, (n[1].e));
11778 break;
11779 case OPCODE_ROTATE:
11780 CALL_Rotatef(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
11781 break;
11782 case OPCODE_SCALE:
11783 CALL_Scalef(ctx->Exec, (n[1].f, n[2].f, n[3].f));
11784 break;
11785 case OPCODE_SCISSOR:
11786 CALL_Scissor(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
11787 break;
11788 case OPCODE_SHADE_MODEL:
11789 CALL_ShadeModel(ctx->Exec, (n[1].e));
11790 break;
11791 case OPCODE_PROVOKING_VERTEX:
11792 CALL_ProvokingVertex(ctx->Exec, (n[1].e));
11793 break;
11794 case OPCODE_STENCIL_FUNC:
11795 CALL_StencilFunc(ctx->Exec, (n[1].e, n[2].i, n[3].ui));
11796 break;
11797 case OPCODE_STENCIL_MASK:
11798 CALL_StencilMask(ctx->Exec, (n[1].ui));
11799 break;
11800 case OPCODE_STENCIL_OP:
11801 CALL_StencilOp(ctx->Exec, (n[1].e, n[2].e, n[3].e));
11802 break;
11803 case OPCODE_STENCIL_FUNC_SEPARATE:
11804 CALL_StencilFuncSeparate(ctx->Exec,
11805 (n[1].e, n[2].e, n[3].i, n[4].ui));
11806 break;
11807 case OPCODE_STENCIL_MASK_SEPARATE:
11808 CALL_StencilMaskSeparate(ctx->Exec, (n[1].e, n[2].ui));
11809 break;
11810 case OPCODE_STENCIL_OP_SEPARATE:
11811 CALL_StencilOpSeparate(ctx->Exec,
11812 (n[1].e, n[2].e, n[3].e, n[4].e));
11813 break;
11814 case OPCODE_TEXENV:
11815 {
11816 GLfloat params[4];
11817 params[0] = n[3].f;
11818 params[1] = n[4].f;
11819 params[2] = n[5].f;
11820 params[3] = n[6].f;
11821 CALL_TexEnvfv(ctx->Exec, (n[1].e, n[2].e, params));
11822 }
11823 break;
11824 case OPCODE_TEXGEN:
11825 {
11826 GLfloat params[4];
11827 params[0] = n[3].f;
11828 params[1] = n[4].f;
11829 params[2] = n[5].f;
11830 params[3] = n[6].f;
11831 CALL_TexGenfv(ctx->Exec, (n[1].e, n[2].e, params));
11832 }
11833 break;
11834 case OPCODE_TEXPARAMETER:
11835 {
11836 GLfloat params[4];
11837 params[0] = n[3].f;
11838 params[1] = n[4].f;
11839 params[2] = n[5].f;
11840 params[3] = n[6].f;
11841 CALL_TexParameterfv(ctx->Exec, (n[1].e, n[2].e, params));
11842 }
11843 break;
11844 case OPCODE_TEX_IMAGE1D:
11845 {
11846 const struct gl_pixelstore_attrib save = ctx->Unpack;
11847 ctx->Unpack = ctx->DefaultPacking;
11848 CALL_TexImage1D(ctx->Exec, (n[1].e, /* target */
11849 n[2].i, /* level */
11850 n[3].i, /* components */
11851 n[4].i, /* width */
11852 n[5].e, /* border */
11853 n[6].e, /* format */
11854 n[7].e, /* type */
11855 get_pointer(&n[8])));
11856 ctx->Unpack = save; /* restore */
11857 }
11858 break;
11859 case OPCODE_TEX_IMAGE2D:
11860 {
11861 const struct gl_pixelstore_attrib save = ctx->Unpack;
11862 ctx->Unpack = ctx->DefaultPacking;
11863 CALL_TexImage2D(ctx->Exec, (n[1].e, /* target */
11864 n[2].i, /* level */
11865 n[3].i, /* components */
11866 n[4].i, /* width */
11867 n[5].i, /* height */
11868 n[6].e, /* border */
11869 n[7].e, /* format */
11870 n[8].e, /* type */
11871 get_pointer(&n[9])));
11872 ctx->Unpack = save; /* restore */
11873 }
11874 break;
11875 case OPCODE_TEX_IMAGE3D:
11876 {
11877 const struct gl_pixelstore_attrib save = ctx->Unpack;
11878 ctx->Unpack = ctx->DefaultPacking;
11879 CALL_TexImage3D(ctx->Exec, (n[1].e, /* target */
11880 n[2].i, /* level */
11881 n[3].i, /* components */
11882 n[4].i, /* width */
11883 n[5].i, /* height */
11884 n[6].i, /* depth */
11885 n[7].e, /* border */
11886 n[8].e, /* format */
11887 n[9].e, /* type */
11888 get_pointer(&n[10])));
11889 ctx->Unpack = save; /* restore */
11890 }
11891 break;
11892 case OPCODE_TEX_SUB_IMAGE1D:
11893 {
11894 const struct gl_pixelstore_attrib save = ctx->Unpack;
11895 ctx->Unpack = ctx->DefaultPacking;
11896 CALL_TexSubImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
11897 n[4].i, n[5].e,
11898 n[6].e, get_pointer(&n[7])));
11899 ctx->Unpack = save; /* restore */
11900 }
11901 break;
11902 case OPCODE_TEX_SUB_IMAGE2D:
11903 {
11904 const struct gl_pixelstore_attrib save = ctx->Unpack;
11905 ctx->Unpack = ctx->DefaultPacking;
11906 CALL_TexSubImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
11907 n[4].i, n[5].e,
11908 n[6].i, n[7].e, n[8].e,
11909 get_pointer(&n[9])));
11910 ctx->Unpack = save; /* restore */
11911 }
11912 break;
11913 case OPCODE_TEX_SUB_IMAGE3D:
11914 {
11915 const struct gl_pixelstore_attrib save = ctx->Unpack;
11916 ctx->Unpack = ctx->DefaultPacking;
11917 CALL_TexSubImage3D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
11918 n[4].i, n[5].i, n[6].i, n[7].i,
11919 n[8].i, n[9].e, n[10].e,
11920 get_pointer(&n[11])));
11921 ctx->Unpack = save; /* restore */
11922 }
11923 break;
11924 case OPCODE_TRANSLATE:
11925 CALL_Translatef(ctx->Exec, (n[1].f, n[2].f, n[3].f));
11926 break;
11927 case OPCODE_VIEWPORT:
11928 CALL_Viewport(ctx->Exec, (n[1].i, n[2].i,
11929 (GLsizei) n[3].i, (GLsizei) n[4].i));
11930 break;
11931 case OPCODE_WINDOW_POS:
11932 CALL_WindowPos4fMESA(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
11933 break;
11934 case OPCODE_VIEWPORT_ARRAY_V:
11935 CALL_ViewportArrayv(ctx->Exec, (n[1].ui, n[2].si,
11936 get_pointer(&n[3])));
11937 break;
11938 case OPCODE_VIEWPORT_INDEXED_F:
11939 CALL_ViewportIndexedf(ctx->Exec, (n[1].ui, n[2].f, n[3].f, n[4].f,
11940 n[5].f));
11941 break;
11942 case OPCODE_VIEWPORT_INDEXED_FV: {
11943 GLfloat v[4];
11944 v[0] = n[2].f;
11945 v[1] = n[3].f;
11946 v[2] = n[4].f;
11947 v[3] = n[5].f;
11948 CALL_ViewportIndexedfv(ctx->Exec, (n[1].ui, v));
11949 break;
11950 }
11951 case OPCODE_SCISSOR_ARRAY_V:
11952 CALL_ScissorArrayv(ctx->Exec, (n[1].ui, n[2].si,
11953 get_pointer(&n[3])));
11954 break;
11955 case OPCODE_SCISSOR_INDEXED:
11956 CALL_ScissorIndexed(ctx->Exec, (n[1].ui, n[2].i, n[3].i, n[4].si,
11957 n[5].si));
11958 break;
11959 case OPCODE_SCISSOR_INDEXED_V: {
11960 GLint v[4];
11961 v[0] = n[2].i;
11962 v[1] = n[3].i;
11963 v[2] = n[4].si;
11964 v[3] = n[5].si;
11965 CALL_ScissorIndexedv(ctx->Exec, (n[1].ui, v));
11966 break;
11967 }
11968 case OPCODE_DEPTH_ARRAY_V:
11969 CALL_DepthRangeArrayv(ctx->Exec, (n[1].ui, n[2].si,
11970 get_pointer(&n[3])));
11971 break;
11972 case OPCODE_DEPTH_INDEXED:
11973 CALL_DepthRangeIndexed(ctx->Exec, (n[1].ui, n[2].f, n[3].f));
11974 break;
11975 case OPCODE_ACTIVE_TEXTURE: /* GL_ARB_multitexture */
11976 CALL_ActiveTexture(ctx->Exec, (n[1].e));
11977 break;
11978 case OPCODE_COMPRESSED_TEX_IMAGE_1D: /* GL_ARB_texture_compression */
11979 CALL_CompressedTexImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].e,
11980 n[4].i, n[5].i, n[6].i,
11981 get_pointer(&n[7])));
11982 break;
11983 case OPCODE_COMPRESSED_TEX_IMAGE_2D: /* GL_ARB_texture_compression */
11984 CALL_CompressedTexImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].e,
11985 n[4].i, n[5].i, n[6].i,
11986 n[7].i, get_pointer(&n[8])));
11987 break;
11988 case OPCODE_COMPRESSED_TEX_IMAGE_3D: /* GL_ARB_texture_compression */
11989 CALL_CompressedTexImage3D(ctx->Exec, (n[1].e, n[2].i, n[3].e,
11990 n[4].i, n[5].i, n[6].i,
11991 n[7].i, n[8].i,
11992 get_pointer(&n[9])));
11993 break;
11994 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D: /* GL_ARB_texture_compress */
11995 CALL_CompressedTexSubImage1D(ctx->Exec,
11996 (n[1].e, n[2].i, n[3].i, n[4].i,
11997 n[5].e, n[6].i,
11998 get_pointer(&n[7])));
11999 break;
12000 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D: /* GL_ARB_texture_compress */
12001 CALL_CompressedTexSubImage2D(ctx->Exec,
12002 (n[1].e, n[2].i, n[3].i, n[4].i,
12003 n[5].i, n[6].i, n[7].e, n[8].i,
12004 get_pointer(&n[9])));
12005 break;
12006 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D: /* GL_ARB_texture_compress */
12007 CALL_CompressedTexSubImage3D(ctx->Exec,
12008 (n[1].e, n[2].i, n[3].i, n[4].i,
12009 n[5].i, n[6].i, n[7].i, n[8].i,
12010 n[9].e, n[10].i,
12011 get_pointer(&n[11])));
12012 break;
12013 case OPCODE_SAMPLE_COVERAGE: /* GL_ARB_multisample */
12014 CALL_SampleCoverage(ctx->Exec, (n[1].f, n[2].b));
12015 break;
12016 case OPCODE_WINDOW_POS_ARB: /* GL_ARB_window_pos */
12017 CALL_WindowPos3f(ctx->Exec, (n[1].f, n[2].f, n[3].f));
12018 break;
12019 case OPCODE_BIND_PROGRAM_ARB: /* GL_ARB_vertex_program */
12020 CALL_BindProgramARB(ctx->Exec, (n[1].e, n[2].ui));
12021 break;
12022 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB:
12023 CALL_ProgramLocalParameter4fARB(ctx->Exec,
12024 (n[1].e, n[2].ui, n[3].f, n[4].f,
12025 n[5].f, n[6].f));
12026 break;
12027 case OPCODE_ACTIVE_STENCIL_FACE_EXT:
12028 CALL_ActiveStencilFaceEXT(ctx->Exec, (n[1].e));
12029 break;
12030 case OPCODE_DEPTH_BOUNDS_EXT:
12031 CALL_DepthBoundsEXT(ctx->Exec, (n[1].f, n[2].f));
12032 break;
12033 case OPCODE_PROGRAM_STRING_ARB:
12034 CALL_ProgramStringARB(ctx->Exec,
12035 (n[1].e, n[2].e, n[3].i,
12036 get_pointer(&n[4])));
12037 break;
12038 case OPCODE_PROGRAM_ENV_PARAMETER_ARB:
12039 CALL_ProgramEnvParameter4fARB(ctx->Exec, (n[1].e, n[2].ui, n[3].f,
12040 n[4].f, n[5].f,
12041 n[6].f));
12042 break;
12043 case OPCODE_BEGIN_QUERY_ARB:
12044 CALL_BeginQuery(ctx->Exec, (n[1].e, n[2].ui));
12045 break;
12046 case OPCODE_END_QUERY_ARB:
12047 CALL_EndQuery(ctx->Exec, (n[1].e));
12048 break;
12049 case OPCODE_QUERY_COUNTER:
12050 CALL_QueryCounter(ctx->Exec, (n[1].ui, n[2].e));
12051 break;
12052 case OPCODE_BEGIN_QUERY_INDEXED:
12053 CALL_BeginQueryIndexed(ctx->Exec, (n[1].e, n[2].ui, n[3].ui));
12054 break;
12055 case OPCODE_END_QUERY_INDEXED:
12056 CALL_EndQueryIndexed(ctx->Exec, (n[1].e, n[2].ui));
12057 break;
12058 case OPCODE_DRAW_BUFFERS_ARB:
12059 {
12060 GLenum buffers[MAX_DRAW_BUFFERS];
12061 GLint i, count = MIN2(n[1].i, MAX_DRAW_BUFFERS);
12062 for (i = 0; i < count; i++)
12063 buffers[i] = n[2 + i].e;
12064 CALL_DrawBuffers(ctx->Exec, (n[1].i, buffers));
12065 }
12066 break;
12067 case OPCODE_BLIT_FRAMEBUFFER:
12068 CALL_BlitFramebuffer(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i,
12069 n[5].i, n[6].i, n[7].i, n[8].i,
12070 n[9].i, n[10].e));
12071 break;
12072 case OPCODE_PRIMITIVE_RESTART_NV:
12073 CALL_PrimitiveRestartNV(ctx->Exec, ());
12074 break;
12075
12076 case OPCODE_USE_PROGRAM:
12077 CALL_UseProgram(ctx->Exec, (n[1].ui));
12078 break;
12079 case OPCODE_UNIFORM_1F:
12080 CALL_Uniform1f(ctx->Exec, (n[1].i, n[2].f));
12081 break;
12082 case OPCODE_UNIFORM_2F:
12083 CALL_Uniform2f(ctx->Exec, (n[1].i, n[2].f, n[3].f));
12084 break;
12085 case OPCODE_UNIFORM_3F:
12086 CALL_Uniform3f(ctx->Exec, (n[1].i, n[2].f, n[3].f, n[4].f));
12087 break;
12088 case OPCODE_UNIFORM_4F:
12089 CALL_Uniform4f(ctx->Exec,
12090 (n[1].i, n[2].f, n[3].f, n[4].f, n[5].f));
12091 break;
12092 case OPCODE_UNIFORM_1FV:
12093 CALL_Uniform1fv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12094 break;
12095 case OPCODE_UNIFORM_2FV:
12096 CALL_Uniform2fv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12097 break;
12098 case OPCODE_UNIFORM_3FV:
12099 CALL_Uniform3fv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12100 break;
12101 case OPCODE_UNIFORM_4FV:
12102 CALL_Uniform4fv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12103 break;
12104 case OPCODE_UNIFORM_1D: {
12105 union float64_pair x;
12106
12107 x.uint32[0] = n[2].ui;
12108 x.uint32[1] = n[3].ui;
12109
12110 CALL_Uniform1d(ctx->Exec, (n[1].i, x.d));
12111 break;
12112 }
12113 case OPCODE_UNIFORM_2D: {
12114 union float64_pair x;
12115 union float64_pair y;
12116
12117 x.uint32[0] = n[2].ui;
12118 x.uint32[1] = n[3].ui;
12119 y.uint32[0] = n[4].ui;
12120 y.uint32[1] = n[5].ui;
12121
12122 CALL_Uniform2d(ctx->Exec, (n[1].i, x.d, y.d));
12123 break;
12124 }
12125 case OPCODE_UNIFORM_3D: {
12126 union float64_pair x;
12127 union float64_pair y;
12128 union float64_pair z;
12129
12130 x.uint32[0] = n[2].ui;
12131 x.uint32[1] = n[3].ui;
12132 y.uint32[0] = n[4].ui;
12133 y.uint32[1] = n[5].ui;
12134 z.uint32[0] = n[6].ui;
12135 z.uint32[1] = n[7].ui;
12136
12137 CALL_Uniform3d(ctx->Exec, (n[1].i, x.d, y.d, z.d));
12138 break;
12139 }
12140 case OPCODE_UNIFORM_4D: {
12141 union float64_pair x;
12142 union float64_pair y;
12143 union float64_pair z;
12144 union float64_pair w;
12145
12146 x.uint32[0] = n[2].ui;
12147 x.uint32[1] = n[3].ui;
12148 y.uint32[0] = n[4].ui;
12149 y.uint32[1] = n[5].ui;
12150 z.uint32[0] = n[6].ui;
12151 z.uint32[1] = n[7].ui;
12152 w.uint32[0] = n[8].ui;
12153 w.uint32[1] = n[9].ui;
12154
12155 CALL_Uniform4d(ctx->Exec, (n[1].i, x.d, y.d, z.d, w.d));
12156 break;
12157 }
12158 case OPCODE_UNIFORM_1DV:
12159 CALL_Uniform1dv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12160 break;
12161 case OPCODE_UNIFORM_2DV:
12162 CALL_Uniform2dv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12163 break;
12164 case OPCODE_UNIFORM_3DV:
12165 CALL_Uniform3dv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12166 break;
12167 case OPCODE_UNIFORM_4DV:
12168 CALL_Uniform4dv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12169 break;
12170 case OPCODE_UNIFORM_1I:
12171 CALL_Uniform1i(ctx->Exec, (n[1].i, n[2].i));
12172 break;
12173 case OPCODE_UNIFORM_2I:
12174 CALL_Uniform2i(ctx->Exec, (n[1].i, n[2].i, n[3].i));
12175 break;
12176 case OPCODE_UNIFORM_3I:
12177 CALL_Uniform3i(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
12178 break;
12179 case OPCODE_UNIFORM_4I:
12180 CALL_Uniform4i(ctx->Exec,
12181 (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
12182 break;
12183 case OPCODE_UNIFORM_1IV:
12184 CALL_Uniform1iv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12185 break;
12186 case OPCODE_UNIFORM_2IV:
12187 CALL_Uniform2iv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12188 break;
12189 case OPCODE_UNIFORM_3IV:
12190 CALL_Uniform3iv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12191 break;
12192 case OPCODE_UNIFORM_4IV:
12193 CALL_Uniform4iv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12194 break;
12195 case OPCODE_UNIFORM_1UI:
12196 CALL_Uniform1ui(ctx->Exec, (n[1].i, n[2].i));
12197 break;
12198 case OPCODE_UNIFORM_2UI:
12199 CALL_Uniform2ui(ctx->Exec, (n[1].i, n[2].i, n[3].i));
12200 break;
12201 case OPCODE_UNIFORM_3UI:
12202 CALL_Uniform3ui(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
12203 break;
12204 case OPCODE_UNIFORM_4UI:
12205 CALL_Uniform4ui(ctx->Exec,
12206 (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
12207 break;
12208 case OPCODE_UNIFORM_1UIV:
12209 CALL_Uniform1uiv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12210 break;
12211 case OPCODE_UNIFORM_2UIV:
12212 CALL_Uniform2uiv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12213 break;
12214 case OPCODE_UNIFORM_3UIV:
12215 CALL_Uniform3uiv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12216 break;
12217 case OPCODE_UNIFORM_4UIV:
12218 CALL_Uniform4uiv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12219 break;
12220 case OPCODE_UNIFORM_MATRIX22:
12221 CALL_UniformMatrix2fv(ctx->Exec,
12222 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12223 break;
12224 case OPCODE_UNIFORM_MATRIX33:
12225 CALL_UniformMatrix3fv(ctx->Exec,
12226 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12227 break;
12228 case OPCODE_UNIFORM_MATRIX44:
12229 CALL_UniformMatrix4fv(ctx->Exec,
12230 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12231 break;
12232 case OPCODE_UNIFORM_MATRIX23:
12233 CALL_UniformMatrix2x3fv(ctx->Exec,
12234 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12235 break;
12236 case OPCODE_UNIFORM_MATRIX32:
12237 CALL_UniformMatrix3x2fv(ctx->Exec,
12238 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12239 break;
12240 case OPCODE_UNIFORM_MATRIX24:
12241 CALL_UniformMatrix2x4fv(ctx->Exec,
12242 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12243 break;
12244 case OPCODE_UNIFORM_MATRIX42:
12245 CALL_UniformMatrix4x2fv(ctx->Exec,
12246 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12247 break;
12248 case OPCODE_UNIFORM_MATRIX34:
12249 CALL_UniformMatrix3x4fv(ctx->Exec,
12250 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12251 break;
12252 case OPCODE_UNIFORM_MATRIX43:
12253 CALL_UniformMatrix4x3fv(ctx->Exec,
12254 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12255 break;
12256 case OPCODE_UNIFORM_MATRIX22D:
12257 CALL_UniformMatrix2dv(ctx->Exec,
12258 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12259 break;
12260 case OPCODE_UNIFORM_MATRIX33D:
12261 CALL_UniformMatrix3dv(ctx->Exec,
12262 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12263 break;
12264 case OPCODE_UNIFORM_MATRIX44D:
12265 CALL_UniformMatrix4dv(ctx->Exec,
12266 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12267 break;
12268 case OPCODE_UNIFORM_MATRIX23D:
12269 CALL_UniformMatrix2x3dv(ctx->Exec,
12270 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12271 break;
12272 case OPCODE_UNIFORM_MATRIX32D:
12273 CALL_UniformMatrix3x2dv(ctx->Exec,
12274 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12275 break;
12276 case OPCODE_UNIFORM_MATRIX24D:
12277 CALL_UniformMatrix2x4dv(ctx->Exec,
12278 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12279 break;
12280 case OPCODE_UNIFORM_MATRIX42D:
12281 CALL_UniformMatrix4x2dv(ctx->Exec,
12282 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12283 break;
12284 case OPCODE_UNIFORM_MATRIX34D:
12285 CALL_UniformMatrix3x4dv(ctx->Exec,
12286 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12287 break;
12288 case OPCODE_UNIFORM_MATRIX43D:
12289 CALL_UniformMatrix4x3dv(ctx->Exec,
12290 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12291 break;
12292
12293 case OPCODE_UNIFORM_1I64: {
12294 union int64_pair x;
12295
12296 x.int32[0] = n[2].i;
12297 x.int32[1] = n[3].i;
12298
12299 CALL_Uniform1i64ARB(ctx->Exec, (n[1].i, x.int64));
12300 break;
12301 }
12302 case OPCODE_UNIFORM_2I64: {
12303 union int64_pair x;
12304 union int64_pair y;
12305
12306 x.int32[0] = n[2].i;
12307 x.int32[1] = n[3].i;
12308 y.int32[0] = n[4].i;
12309 y.int32[1] = n[5].i;
12310
12311 CALL_Uniform2i64ARB(ctx->Exec, (n[1].i, x.int64, y.int64));
12312 break;
12313 }
12314 case OPCODE_UNIFORM_3I64: {
12315 union int64_pair x;
12316 union int64_pair y;
12317 union int64_pair z;
12318
12319 x.int32[0] = n[2].i;
12320 x.int32[1] = n[3].i;
12321 y.int32[0] = n[4].i;
12322 y.int32[1] = n[5].i;
12323 z.int32[0] = n[6].i;
12324 z.int32[1] = n[7].i;
12325
12326
12327 CALL_Uniform3i64ARB(ctx->Exec, (n[1].i, x.int64, y.int64, z.int64));
12328 break;
12329 }
12330 case OPCODE_UNIFORM_4I64: {
12331 union int64_pair x;
12332 union int64_pair y;
12333 union int64_pair z;
12334 union int64_pair w;
12335
12336 x.int32[0] = n[2].i;
12337 x.int32[1] = n[3].i;
12338 y.int32[0] = n[4].i;
12339 y.int32[1] = n[5].i;
12340 z.int32[0] = n[6].i;
12341 z.int32[1] = n[7].i;
12342 w.int32[0] = n[8].i;
12343 w.int32[1] = n[9].i;
12344
12345 CALL_Uniform4i64ARB(ctx->Exec, (n[1].i, x.int64, y.int64, z.int64, w.int64));
12346 break;
12347 }
12348 case OPCODE_UNIFORM_1I64V:
12349 CALL_Uniform1i64vARB(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12350 break;
12351 case OPCODE_UNIFORM_2I64V:
12352 CALL_Uniform2i64vARB(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12353 break;
12354 case OPCODE_UNIFORM_3I64V:
12355 CALL_Uniform3i64vARB(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12356 break;
12357 case OPCODE_UNIFORM_4I64V:
12358 CALL_Uniform4i64vARB(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12359 break;
12360 case OPCODE_UNIFORM_1UI64: {
12361 union uint64_pair x;
12362
12363 x.uint32[0] = n[2].ui;
12364 x.uint32[1] = n[3].ui;
12365
12366 CALL_Uniform1ui64ARB(ctx->Exec, (n[1].i, x.uint64));
12367 break;
12368 }
12369 case OPCODE_UNIFORM_2UI64: {
12370 union uint64_pair x;
12371 union uint64_pair y;
12372
12373 x.uint32[0] = n[2].ui;
12374 x.uint32[1] = n[3].ui;
12375 y.uint32[0] = n[4].ui;
12376 y.uint32[1] = n[5].ui;
12377
12378 CALL_Uniform2ui64ARB(ctx->Exec, (n[1].i, x.uint64, y.uint64));
12379 break;
12380 }
12381 case OPCODE_UNIFORM_3UI64: {
12382 union uint64_pair x;
12383 union uint64_pair y;
12384 union uint64_pair z;
12385
12386 x.uint32[0] = n[2].ui;
12387 x.uint32[1] = n[3].ui;
12388 y.uint32[0] = n[4].ui;
12389 y.uint32[1] = n[5].ui;
12390 z.uint32[0] = n[6].ui;
12391 z.uint32[1] = n[7].ui;
12392
12393
12394 CALL_Uniform3ui64ARB(ctx->Exec, (n[1].i, x.uint64, y.uint64,
12395 z.uint64));
12396 break;
12397 }
12398 case OPCODE_UNIFORM_4UI64: {
12399 union uint64_pair x;
12400 union uint64_pair y;
12401 union uint64_pair z;
12402 union uint64_pair w;
12403
12404 x.uint32[0] = n[2].ui;
12405 x.uint32[1] = n[3].ui;
12406 y.uint32[0] = n[4].ui;
12407 y.uint32[1] = n[5].ui;
12408 z.uint32[0] = n[6].ui;
12409 z.uint32[1] = n[7].ui;
12410 w.uint32[0] = n[8].ui;
12411 w.uint32[1] = n[9].ui;
12412
12413 CALL_Uniform4ui64ARB(ctx->Exec, (n[1].i, x.uint64, y.uint64,
12414 z.uint64, w.uint64));
12415 break;
12416 }
12417 case OPCODE_UNIFORM_1UI64V:
12418 CALL_Uniform1ui64vARB(ctx->Exec, (n[1].i, n[2].i,
12419 get_pointer(&n[3])));
12420 break;
12421 case OPCODE_UNIFORM_2UI64V:
12422 CALL_Uniform2ui64vARB(ctx->Exec, (n[1].i, n[2].i,
12423 get_pointer(&n[3])));
12424 break;
12425 case OPCODE_UNIFORM_3UI64V:
12426 CALL_Uniform3ui64vARB(ctx->Exec, (n[1].i, n[2].i,
12427 get_pointer(&n[3])));
12428 break;
12429 case OPCODE_UNIFORM_4UI64V:
12430 CALL_Uniform4ui64vARB(ctx->Exec, (n[1].i, n[2].i,
12431 get_pointer(&n[3])));
12432 break;
12433
12434 case OPCODE_PROGRAM_UNIFORM_1I64: {
12435 union int64_pair x;
12436
12437 x.int32[0] = n[3].i;
12438 x.int32[1] = n[4].i;
12439
12440 CALL_ProgramUniform1i64ARB(ctx->Exec, (n[1].ui, n[2].i, x.int64));
12441 break;
12442 }
12443 case OPCODE_PROGRAM_UNIFORM_2I64: {
12444 union int64_pair x;
12445 union int64_pair y;
12446
12447 x.int32[0] = n[3].i;
12448 x.int32[1] = n[4].i;
12449 y.int32[0] = n[5].i;
12450 y.int32[1] = n[6].i;
12451
12452 CALL_ProgramUniform2i64ARB(ctx->Exec, (n[1].ui, n[2].i, x.int64,
12453 y.int64));
12454 break;
12455 }
12456 case OPCODE_PROGRAM_UNIFORM_3I64: {
12457 union int64_pair x;
12458 union int64_pair y;
12459 union int64_pair z;
12460
12461 x.int32[0] = n[3].i;
12462 x.int32[1] = n[4].i;
12463 y.int32[0] = n[5].i;
12464 y.int32[1] = n[6].i;
12465 z.int32[0] = n[7].i;
12466 z.int32[1] = n[8].i;
12467
12468 CALL_ProgramUniform3i64ARB(ctx->Exec, (n[1].ui, n[2].i, x.int64,
12469 y.int64, z.int64));
12470 break;
12471 }
12472 case OPCODE_PROGRAM_UNIFORM_4I64: {
12473 union int64_pair x;
12474 union int64_pair y;
12475 union int64_pair z;
12476 union int64_pair w;
12477
12478 x.int32[0] = n[3].i;
12479 x.int32[1] = n[4].i;
12480 y.int32[0] = n[5].i;
12481 y.int32[1] = n[6].i;
12482 z.int32[0] = n[7].i;
12483 z.int32[1] = n[8].i;
12484 w.int32[0] = n[9].i;
12485 w.int32[1] = n[10].i;
12486
12487 CALL_ProgramUniform4i64ARB(ctx->Exec, (n[1].ui, n[2].i, x.int64,
12488 y.int64, z.int64, w.int64));
12489 break;
12490 }
12491 case OPCODE_PROGRAM_UNIFORM_1I64V:
12492 CALL_ProgramUniform1i64vARB(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12493 get_pointer(&n[4])));
12494 break;
12495 case OPCODE_PROGRAM_UNIFORM_2I64V:
12496 CALL_ProgramUniform2i64vARB(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12497 get_pointer(&n[4])));
12498 break;
12499 case OPCODE_PROGRAM_UNIFORM_3I64V:
12500 CALL_ProgramUniform3i64vARB(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12501 get_pointer(&n[4])));
12502 break;
12503 case OPCODE_PROGRAM_UNIFORM_4I64V:
12504 CALL_ProgramUniform4i64vARB(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12505 get_pointer(&n[4])));
12506 break;
12507 case OPCODE_PROGRAM_UNIFORM_1UI64: {
12508 union uint64_pair x;
12509
12510 x.uint32[0] = n[3].ui;
12511 x.uint32[1] = n[4].ui;
12512
12513 CALL_ProgramUniform1i64ARB(ctx->Exec, (n[1].ui, n[2].i, x.uint64));
12514 break;
12515 }
12516 case OPCODE_PROGRAM_UNIFORM_2UI64: {
12517 union uint64_pair x;
12518 union uint64_pair y;
12519
12520 x.uint32[0] = n[3].ui;
12521 x.uint32[1] = n[4].ui;
12522 y.uint32[0] = n[5].ui;
12523 y.uint32[1] = n[6].ui;
12524
12525 CALL_ProgramUniform2ui64ARB(ctx->Exec, (n[1].ui, n[2].i, x.uint64,
12526 y.uint64));
12527 break;
12528 }
12529 case OPCODE_PROGRAM_UNIFORM_3UI64: {
12530 union uint64_pair x;
12531 union uint64_pair y;
12532 union uint64_pair z;
12533
12534 x.uint32[0] = n[3].ui;
12535 x.uint32[1] = n[4].ui;
12536 y.uint32[0] = n[5].ui;
12537 y.uint32[1] = n[6].ui;
12538 z.uint32[0] = n[7].ui;
12539 z.uint32[1] = n[8].ui;
12540
12541 CALL_ProgramUniform3ui64ARB(ctx->Exec, (n[1].ui, n[2].i, x.uint64,
12542 y.uint64, z.uint64));
12543 break;
12544 }
12545 case OPCODE_PROGRAM_UNIFORM_4UI64: {
12546 union uint64_pair x;
12547 union uint64_pair y;
12548 union uint64_pair z;
12549 union uint64_pair w;
12550
12551 x.uint32[0] = n[3].ui;
12552 x.uint32[1] = n[4].ui;
12553 y.uint32[0] = n[5].ui;
12554 y.uint32[1] = n[6].ui;
12555 z.uint32[0] = n[7].ui;
12556 z.uint32[1] = n[8].ui;
12557 w.uint32[0] = n[9].ui;
12558 w.uint32[1] = n[10].ui;
12559
12560 CALL_ProgramUniform4ui64ARB(ctx->Exec, (n[1].ui, n[2].i, x.uint64,
12561 y.uint64, z.uint64, w.uint64));
12562 break;
12563 }
12564 case OPCODE_PROGRAM_UNIFORM_1UI64V:
12565 CALL_ProgramUniform1ui64vARB(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12566 get_pointer(&n[4])));
12567 break;
12568 case OPCODE_PROGRAM_UNIFORM_2UI64V:
12569 CALL_ProgramUniform2ui64vARB(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12570 get_pointer(&n[4])));
12571 break;
12572 case OPCODE_PROGRAM_UNIFORM_3UI64V:
12573 CALL_ProgramUniform3ui64vARB(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12574 get_pointer(&n[4])));
12575 break;
12576 case OPCODE_PROGRAM_UNIFORM_4UI64V:
12577 CALL_ProgramUniform4ui64vARB(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12578 get_pointer(&n[4])));
12579 break;
12580
12581 case OPCODE_USE_PROGRAM_STAGES:
12582 CALL_UseProgramStages(ctx->Exec, (n[1].ui, n[2].ui, n[3].ui));
12583 break;
12584 case OPCODE_PROGRAM_UNIFORM_1F:
12585 CALL_ProgramUniform1f(ctx->Exec, (n[1].ui, n[2].i, n[3].f));
12586 break;
12587 case OPCODE_PROGRAM_UNIFORM_2F:
12588 CALL_ProgramUniform2f(ctx->Exec, (n[1].ui, n[2].i, n[3].f, n[4].f));
12589 break;
12590 case OPCODE_PROGRAM_UNIFORM_3F:
12591 CALL_ProgramUniform3f(ctx->Exec, (n[1].ui, n[2].i,
12592 n[3].f, n[4].f, n[5].f));
12593 break;
12594 case OPCODE_PROGRAM_UNIFORM_4F:
12595 CALL_ProgramUniform4f(ctx->Exec, (n[1].ui, n[2].i,
12596 n[3].f, n[4].f, n[5].f, n[6].f));
12597 break;
12598 case OPCODE_PROGRAM_UNIFORM_1FV:
12599 CALL_ProgramUniform1fv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12600 get_pointer(&n[4])));
12601 break;
12602 case OPCODE_PROGRAM_UNIFORM_2FV:
12603 CALL_ProgramUniform2fv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12604 get_pointer(&n[4])));
12605 break;
12606 case OPCODE_PROGRAM_UNIFORM_3FV:
12607 CALL_ProgramUniform3fv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12608 get_pointer(&n[4])));
12609 break;
12610 case OPCODE_PROGRAM_UNIFORM_4FV:
12611 CALL_ProgramUniform4fv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12612 get_pointer(&n[4])));
12613 break;
12614 case OPCODE_PROGRAM_UNIFORM_1D: {
12615 union float64_pair x;
12616
12617 x.uint32[0] = n[3].ui;
12618 x.uint32[1] = n[4].ui;
12619
12620 CALL_ProgramUniform1d(ctx->Exec, (n[1].ui, n[2].i, x.d));
12621 break;
12622 }
12623 case OPCODE_PROGRAM_UNIFORM_2D: {
12624 union float64_pair x;
12625 union float64_pair y;
12626
12627 x.uint32[0] = n[3].ui;
12628 x.uint32[1] = n[4].ui;
12629 y.uint32[0] = n[5].ui;
12630 y.uint32[1] = n[6].ui;
12631
12632 CALL_ProgramUniform2d(ctx->Exec, (n[1].ui, n[2].i, x.d, y.d));
12633 break;
12634 }
12635 case OPCODE_PROGRAM_UNIFORM_3D: {
12636 union float64_pair x;
12637 union float64_pair y;
12638 union float64_pair z;
12639
12640 x.uint32[0] = n[3].ui;
12641 x.uint32[1] = n[4].ui;
12642 y.uint32[0] = n[5].ui;
12643 y.uint32[1] = n[6].ui;
12644 z.uint32[0] = n[7].ui;
12645 z.uint32[1] = n[8].ui;
12646
12647 CALL_ProgramUniform3d(ctx->Exec, (n[1].ui, n[2].i,
12648 x.d, y.d, z.d));
12649 break;
12650 }
12651 case OPCODE_PROGRAM_UNIFORM_4D: {
12652 union float64_pair x;
12653 union float64_pair y;
12654 union float64_pair z;
12655 union float64_pair w;
12656
12657 x.uint32[0] = n[3].ui;
12658 x.uint32[1] = n[4].ui;
12659 y.uint32[0] = n[5].ui;
12660 y.uint32[1] = n[6].ui;
12661 z.uint32[0] = n[7].ui;
12662 z.uint32[1] = n[8].ui;
12663 w.uint32[0] = n[9].ui;
12664 w.uint32[1] = n[10].ui;
12665
12666 CALL_ProgramUniform4d(ctx->Exec, (n[1].ui, n[2].i,
12667 x.d, y.d, z.d, w.d));
12668 break;
12669 }
12670 case OPCODE_PROGRAM_UNIFORM_1DV:
12671 CALL_ProgramUniform1dv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12672 get_pointer(&n[4])));
12673 break;
12674 case OPCODE_PROGRAM_UNIFORM_2DV:
12675 CALL_ProgramUniform2dv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12676 get_pointer(&n[4])));
12677 break;
12678 case OPCODE_PROGRAM_UNIFORM_3DV:
12679 CALL_ProgramUniform3dv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12680 get_pointer(&n[4])));
12681 break;
12682 case OPCODE_PROGRAM_UNIFORM_4DV:
12683 CALL_ProgramUniform4dv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12684 get_pointer(&n[4])));
12685 break;
12686 case OPCODE_PROGRAM_UNIFORM_1I:
12687 CALL_ProgramUniform1i(ctx->Exec, (n[1].ui, n[2].i, n[3].i));
12688 break;
12689 case OPCODE_PROGRAM_UNIFORM_2I:
12690 CALL_ProgramUniform2i(ctx->Exec, (n[1].ui, n[2].i, n[3].i, n[4].i));
12691 break;
12692 case OPCODE_PROGRAM_UNIFORM_3I:
12693 CALL_ProgramUniform3i(ctx->Exec, (n[1].ui, n[2].i,
12694 n[3].i, n[4].i, n[5].i));
12695 break;
12696 case OPCODE_PROGRAM_UNIFORM_4I:
12697 CALL_ProgramUniform4i(ctx->Exec, (n[1].ui, n[2].i,
12698 n[3].i, n[4].i, n[5].i, n[6].i));
12699 break;
12700 case OPCODE_PROGRAM_UNIFORM_1IV:
12701 CALL_ProgramUniform1iv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12702 get_pointer(&n[4])));
12703 break;
12704 case OPCODE_PROGRAM_UNIFORM_2IV:
12705 CALL_ProgramUniform2iv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12706 get_pointer(&n[4])));
12707 break;
12708 case OPCODE_PROGRAM_UNIFORM_3IV:
12709 CALL_ProgramUniform3iv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12710 get_pointer(&n[4])));
12711 break;
12712 case OPCODE_PROGRAM_UNIFORM_4IV:
12713 CALL_ProgramUniform4iv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12714 get_pointer(&n[4])));
12715 break;
12716 case OPCODE_PROGRAM_UNIFORM_1UI:
12717 CALL_ProgramUniform1ui(ctx->Exec, (n[1].ui, n[2].i, n[3].ui));
12718 break;
12719 case OPCODE_PROGRAM_UNIFORM_2UI:
12720 CALL_ProgramUniform2ui(ctx->Exec, (n[1].ui, n[2].i,
12721 n[3].ui, n[4].ui));
12722 break;
12723 case OPCODE_PROGRAM_UNIFORM_3UI:
12724 CALL_ProgramUniform3ui(ctx->Exec, (n[1].ui, n[2].i,
12725 n[3].ui, n[4].ui, n[5].ui));
12726 break;
12727 case OPCODE_PROGRAM_UNIFORM_4UI:
12728 CALL_ProgramUniform4ui(ctx->Exec, (n[1].ui, n[2].i,
12729 n[3].ui,
12730 n[4].ui, n[5].ui, n[6].ui));
12731 break;
12732 case OPCODE_PROGRAM_UNIFORM_1UIV:
12733 CALL_ProgramUniform1uiv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12734 get_pointer(&n[4])));
12735 break;
12736 case OPCODE_PROGRAM_UNIFORM_2UIV:
12737 CALL_ProgramUniform2uiv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12738 get_pointer(&n[4])));
12739 break;
12740 case OPCODE_PROGRAM_UNIFORM_3UIV:
12741 CALL_ProgramUniform3uiv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12742 get_pointer(&n[4])));
12743 break;
12744 case OPCODE_PROGRAM_UNIFORM_4UIV:
12745 CALL_ProgramUniform4uiv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12746 get_pointer(&n[4])));
12747 break;
12748 case OPCODE_PROGRAM_UNIFORM_MATRIX22F:
12749 CALL_ProgramUniformMatrix2fv(ctx->Exec,
12750 (n[1].ui, n[2].i, n[3].i, n[4].b,
12751 get_pointer(&n[5])));
12752 break;
12753 case OPCODE_PROGRAM_UNIFORM_MATRIX23F:
12754 CALL_ProgramUniformMatrix2x3fv(ctx->Exec,
12755 (n[1].ui, n[2].i, n[3].i, n[4].b,
12756 get_pointer(&n[5])));
12757 break;
12758 case OPCODE_PROGRAM_UNIFORM_MATRIX24F:
12759 CALL_ProgramUniformMatrix2x4fv(ctx->Exec,
12760 (n[1].ui, n[2].i, n[3].i, n[4].b,
12761 get_pointer(&n[5])));
12762 break;
12763 case OPCODE_PROGRAM_UNIFORM_MATRIX32F:
12764 CALL_ProgramUniformMatrix3x2fv(ctx->Exec,
12765 (n[1].ui, n[2].i, n[3].i, n[4].b,
12766 get_pointer(&n[5])));
12767 break;
12768 case OPCODE_PROGRAM_UNIFORM_MATRIX33F:
12769 CALL_ProgramUniformMatrix3fv(ctx->Exec,
12770 (n[1].ui, n[2].i, n[3].i, n[4].b,
12771 get_pointer(&n[5])));
12772 break;
12773 case OPCODE_PROGRAM_UNIFORM_MATRIX34F:
12774 CALL_ProgramUniformMatrix3x4fv(ctx->Exec,
12775 (n[1].ui, n[2].i, n[3].i, n[4].b,
12776 get_pointer(&n[5])));
12777 break;
12778 case OPCODE_PROGRAM_UNIFORM_MATRIX42F:
12779 CALL_ProgramUniformMatrix4x2fv(ctx->Exec,
12780 (n[1].ui, n[2].i, n[3].i, n[4].b,
12781 get_pointer(&n[5])));
12782 break;
12783 case OPCODE_PROGRAM_UNIFORM_MATRIX43F:
12784 CALL_ProgramUniformMatrix4x3fv(ctx->Exec,
12785 (n[1].ui, n[2].i, n[3].i, n[4].b,
12786 get_pointer(&n[5])));
12787 break;
12788 case OPCODE_PROGRAM_UNIFORM_MATRIX44F:
12789 CALL_ProgramUniformMatrix4fv(ctx->Exec,
12790 (n[1].ui, n[2].i, n[3].i, n[4].b,
12791 get_pointer(&n[5])));
12792 break;
12793 case OPCODE_PROGRAM_UNIFORM_MATRIX22D:
12794 CALL_ProgramUniformMatrix2dv(ctx->Exec,
12795 (n[1].ui, n[2].i, n[3].i, n[4].b,
12796 get_pointer(&n[5])));
12797 break;
12798 case OPCODE_PROGRAM_UNIFORM_MATRIX23D:
12799 CALL_ProgramUniformMatrix2x3dv(ctx->Exec,
12800 (n[1].ui, n[2].i, n[3].i, n[4].b,
12801 get_pointer(&n[5])));
12802 break;
12803 case OPCODE_PROGRAM_UNIFORM_MATRIX24D:
12804 CALL_ProgramUniformMatrix2x4dv(ctx->Exec,
12805 (n[1].ui, n[2].i, n[3].i, n[4].b,
12806 get_pointer(&n[5])));
12807 break;
12808 case OPCODE_PROGRAM_UNIFORM_MATRIX32D:
12809 CALL_ProgramUniformMatrix3x2dv(ctx->Exec,
12810 (n[1].ui, n[2].i, n[3].i, n[4].b,
12811 get_pointer(&n[5])));
12812 break;
12813 case OPCODE_PROGRAM_UNIFORM_MATRIX33D:
12814 CALL_ProgramUniformMatrix3dv(ctx->Exec,
12815 (n[1].ui, n[2].i, n[3].i, n[4].b,
12816 get_pointer(&n[5])));
12817 break;
12818 case OPCODE_PROGRAM_UNIFORM_MATRIX34D:
12819 CALL_ProgramUniformMatrix3x4dv(ctx->Exec,
12820 (n[1].ui, n[2].i, n[3].i, n[4].b,
12821 get_pointer(&n[5])));
12822 break;
12823 case OPCODE_PROGRAM_UNIFORM_MATRIX42D:
12824 CALL_ProgramUniformMatrix4x2dv(ctx->Exec,
12825 (n[1].ui, n[2].i, n[3].i, n[4].b,
12826 get_pointer(&n[5])));
12827 break;
12828 case OPCODE_PROGRAM_UNIFORM_MATRIX43D:
12829 CALL_ProgramUniformMatrix4x3dv(ctx->Exec,
12830 (n[1].ui, n[2].i, n[3].i, n[4].b,
12831 get_pointer(&n[5])));
12832 break;
12833 case OPCODE_PROGRAM_UNIFORM_MATRIX44D:
12834 CALL_ProgramUniformMatrix4dv(ctx->Exec,
12835 (n[1].ui, n[2].i, n[3].i, n[4].b,
12836 get_pointer(&n[5])));
12837 break;
12838
12839 case OPCODE_CLIP_CONTROL:
12840 CALL_ClipControl(ctx->Exec, (n[1].e, n[2].e));
12841 break;
12842
12843 case OPCODE_CLAMP_COLOR:
12844 CALL_ClampColor(ctx->Exec, (n[1].e, n[2].e));
12845 break;
12846
12847 case OPCODE_BIND_FRAGMENT_SHADER_ATI:
12848 CALL_BindFragmentShaderATI(ctx->Exec, (n[1].i));
12849 break;
12850 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI:
12851 CALL_SetFragmentShaderConstantATI(ctx->Exec, (n[1].ui, &n[2].f));
12852 break;
12853 case OPCODE_ATTR_1F_NV:
12854 CALL_VertexAttrib1fNV(ctx->Exec, (n[1].e, n[2].f));
12855 break;
12856 case OPCODE_ATTR_2F_NV:
12857 CALL_VertexAttrib2fvNV(ctx->Exec, (n[1].e, &n[2].f));
12858 break;
12859 case OPCODE_ATTR_3F_NV:
12860 CALL_VertexAttrib3fvNV(ctx->Exec, (n[1].e, &n[2].f));
12861 break;
12862 case OPCODE_ATTR_4F_NV:
12863 CALL_VertexAttrib4fvNV(ctx->Exec, (n[1].e, &n[2].f));
12864 break;
12865 case OPCODE_ATTR_1F_ARB:
12866 CALL_VertexAttrib1fARB(ctx->Exec, (n[1].e, n[2].f));
12867 break;
12868 case OPCODE_ATTR_2F_ARB:
12869 CALL_VertexAttrib2fvARB(ctx->Exec, (n[1].e, &n[2].f));
12870 break;
12871 case OPCODE_ATTR_3F_ARB:
12872 CALL_VertexAttrib3fvARB(ctx->Exec, (n[1].e, &n[2].f));
12873 break;
12874 case OPCODE_ATTR_4F_ARB:
12875 CALL_VertexAttrib4fvARB(ctx->Exec, (n[1].e, &n[2].f));
12876 break;
12877 case OPCODE_ATTR_1I:
12878 CALL_VertexAttribI1iEXT(ctx->Exec, (n[1].e, n[2].i));
12879 break;
12880 case OPCODE_ATTR_2I:
12881 CALL_VertexAttribI2ivEXT(ctx->Exec, (n[1].e, &n[2].i));
12882 break;
12883 case OPCODE_ATTR_3I:
12884 CALL_VertexAttribI3ivEXT(ctx->Exec, (n[1].e, &n[2].i));
12885 break;
12886 case OPCODE_ATTR_4I:
12887 CALL_VertexAttribI4ivEXT(ctx->Exec, (n[1].e, &n[2].i));
12888 break;
12889 case OPCODE_ATTR_1D: {
12890 GLdouble *d = (GLdouble *) &n[2];
12891 CALL_VertexAttribL1d(ctx->Exec, (n[1].ui, *d));
12892 break;
12893 }
12894 case OPCODE_ATTR_2D: {
12895 GLdouble *d = (GLdouble *) &n[2];
12896 CALL_VertexAttribL2dv(ctx->Exec, (n[1].ui, d));
12897 break;
12898 }
12899 case OPCODE_ATTR_3D: {
12900 GLdouble *d = (GLdouble *) &n[2];
12901 CALL_VertexAttribL3dv(ctx->Exec, (n[1].ui, d));
12902 break;
12903 }
12904 case OPCODE_ATTR_4D: {
12905 GLdouble *d = (GLdouble *) &n[2];
12906 CALL_VertexAttribL4dv(ctx->Exec, (n[1].ui, d));
12907 break;
12908 }
12909 case OPCODE_ATTR_1UI64: {
12910 uint64_t *ui64 = (uint64_t *) &n[2];
12911 CALL_VertexAttribL1ui64ARB(ctx->Exec, (n[1].ui, *ui64));
12912 break;
12913 }
12914 case OPCODE_MATERIAL:
12915 CALL_Materialfv(ctx->Exec, (n[1].e, n[2].e, &n[3].f));
12916 break;
12917 case OPCODE_BEGIN:
12918 CALL_Begin(ctx->Exec, (n[1].e));
12919 break;
12920 case OPCODE_END:
12921 CALL_End(ctx->Exec, ());
12922 break;
12923 case OPCODE_RECTF:
12924 CALL_Rectf(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
12925 break;
12926 case OPCODE_EVAL_C1:
12927 CALL_EvalCoord1f(ctx->Exec, (n[1].f));
12928 break;
12929 case OPCODE_EVAL_C2:
12930 CALL_EvalCoord2f(ctx->Exec, (n[1].f, n[2].f));
12931 break;
12932 case OPCODE_EVAL_P1:
12933 CALL_EvalPoint1(ctx->Exec, (n[1].i));
12934 break;
12935 case OPCODE_EVAL_P2:
12936 CALL_EvalPoint2(ctx->Exec, (n[1].i, n[2].i));
12937 break;
12938
12939 /* GL_EXT_texture_integer */
12940 case OPCODE_CLEARCOLOR_I:
12941 CALL_ClearColorIiEXT(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
12942 break;
12943 case OPCODE_CLEARCOLOR_UI:
12944 CALL_ClearColorIuiEXT(ctx->Exec,
12945 (n[1].ui, n[2].ui, n[3].ui, n[4].ui));
12946 break;
12947 case OPCODE_TEXPARAMETER_I:
12948 {
12949 GLint params[4];
12950 params[0] = n[3].i;
12951 params[1] = n[4].i;
12952 params[2] = n[5].i;
12953 params[3] = n[6].i;
12954 CALL_TexParameterIiv(ctx->Exec, (n[1].e, n[2].e, params));
12955 }
12956 break;
12957 case OPCODE_TEXPARAMETER_UI:
12958 {
12959 GLuint params[4];
12960 params[0] = n[3].ui;
12961 params[1] = n[4].ui;
12962 params[2] = n[5].ui;
12963 params[3] = n[6].ui;
12964 CALL_TexParameterIuiv(ctx->Exec, (n[1].e, n[2].e, params));
12965 }
12966 break;
12967
12968 case OPCODE_VERTEX_ATTRIB_DIVISOR:
12969 /* GL_ARB_instanced_arrays */
12970 CALL_VertexAttribDivisor(ctx->Exec, (n[1].ui, n[2].ui));
12971 break;
12972
12973 case OPCODE_TEXTURE_BARRIER_NV:
12974 CALL_TextureBarrierNV(ctx->Exec, ());
12975 break;
12976
12977 /* GL_EXT/ARB_transform_feedback */
12978 case OPCODE_BEGIN_TRANSFORM_FEEDBACK:
12979 CALL_BeginTransformFeedback(ctx->Exec, (n[1].e));
12980 break;
12981 case OPCODE_END_TRANSFORM_FEEDBACK:
12982 CALL_EndTransformFeedback(ctx->Exec, ());
12983 break;
12984 case OPCODE_BIND_TRANSFORM_FEEDBACK:
12985 CALL_BindTransformFeedback(ctx->Exec, (n[1].e, n[2].ui));
12986 break;
12987 case OPCODE_PAUSE_TRANSFORM_FEEDBACK:
12988 CALL_PauseTransformFeedback(ctx->Exec, ());
12989 break;
12990 case OPCODE_RESUME_TRANSFORM_FEEDBACK:
12991 CALL_ResumeTransformFeedback(ctx->Exec, ());
12992 break;
12993 case OPCODE_DRAW_TRANSFORM_FEEDBACK:
12994 CALL_DrawTransformFeedback(ctx->Exec, (n[1].e, n[2].ui));
12995 break;
12996 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM:
12997 CALL_DrawTransformFeedbackStream(ctx->Exec,
12998 (n[1].e, n[2].ui, n[3].ui));
12999 break;
13000 case OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED:
13001 CALL_DrawTransformFeedbackInstanced(ctx->Exec,
13002 (n[1].e, n[2].ui, n[3].si));
13003 break;
13004 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED:
13005 CALL_DrawTransformFeedbackStreamInstanced(ctx->Exec,
13006 (n[1].e, n[2].ui, n[3].ui, n[4].si));
13007 break;
13008
13009
13010 case OPCODE_BIND_SAMPLER:
13011 CALL_BindSampler(ctx->Exec, (n[1].ui, n[2].ui));
13012 break;
13013 case OPCODE_SAMPLER_PARAMETERIV:
13014 {
13015 GLint params[4];
13016 params[0] = n[3].i;
13017 params[1] = n[4].i;
13018 params[2] = n[5].i;
13019 params[3] = n[6].i;
13020 CALL_SamplerParameteriv(ctx->Exec, (n[1].ui, n[2].e, params));
13021 }
13022 break;
13023 case OPCODE_SAMPLER_PARAMETERFV:
13024 {
13025 GLfloat params[4];
13026 params[0] = n[3].f;
13027 params[1] = n[4].f;
13028 params[2] = n[5].f;
13029 params[3] = n[6].f;
13030 CALL_SamplerParameterfv(ctx->Exec, (n[1].ui, n[2].e, params));
13031 }
13032 break;
13033 case OPCODE_SAMPLER_PARAMETERIIV:
13034 {
13035 GLint params[4];
13036 params[0] = n[3].i;
13037 params[1] = n[4].i;
13038 params[2] = n[5].i;
13039 params[3] = n[6].i;
13040 CALL_SamplerParameterIiv(ctx->Exec, (n[1].ui, n[2].e, params));
13041 }
13042 break;
13043 case OPCODE_SAMPLER_PARAMETERUIV:
13044 {
13045 GLuint params[4];
13046 params[0] = n[3].ui;
13047 params[1] = n[4].ui;
13048 params[2] = n[5].ui;
13049 params[3] = n[6].ui;
13050 CALL_SamplerParameterIuiv(ctx->Exec, (n[1].ui, n[2].e, params));
13051 }
13052 break;
13053
13054 /* ARB_compute_shader */
13055 case OPCODE_DISPATCH_COMPUTE:
13056 CALL_DispatchCompute(ctx->Exec, (n[1].ui, n[2].ui, n[3].ui));
13057 break;
13058
13059 /* GL_ARB_sync */
13060 case OPCODE_WAIT_SYNC:
13061 {
13062 union uint64_pair p;
13063 p.uint32[0] = n[2].ui;
13064 p.uint32[1] = n[3].ui;
13065 CALL_WaitSync(ctx->Exec,
13066 (get_pointer(&n[4]), n[1].bf, p.uint64));
13067 }
13068 break;
13069
13070 /* GL_NV_conditional_render */
13071 case OPCODE_BEGIN_CONDITIONAL_RENDER:
13072 CALL_BeginConditionalRender(ctx->Exec, (n[1].i, n[2].e));
13073 break;
13074 case OPCODE_END_CONDITIONAL_RENDER:
13075 CALL_EndConditionalRender(ctx->Exec, ());
13076 break;
13077
13078 case OPCODE_UNIFORM_BLOCK_BINDING:
13079 CALL_UniformBlockBinding(ctx->Exec, (n[1].ui, n[2].ui, n[3].ui));
13080 break;
13081
13082 case OPCODE_UNIFORM_SUBROUTINES:
13083 CALL_UniformSubroutinesuiv(ctx->Exec, (n[1].e, n[2].si,
13084 get_pointer(&n[3])));
13085 break;
13086
13087 /* GL_EXT_window_rectangles */
13088 case OPCODE_WINDOW_RECTANGLES:
13089 CALL_WindowRectanglesEXT(
13090 ctx->Exec, (n[1].e, n[2].si, get_pointer(&n[3])));
13091 break;
13092
13093 /* GL_NV_conservative_raster */
13094 case OPCODE_SUBPIXEL_PRECISION_BIAS:
13095 CALL_SubpixelPrecisionBiasNV(ctx->Exec, (n[1].ui, n[2].ui));
13096 break;
13097
13098 /* GL_NV_conservative_raster_dilate */
13099 case OPCODE_CONSERVATIVE_RASTER_PARAMETER_F:
13100 CALL_ConservativeRasterParameterfNV(ctx->Exec, (n[1].e, n[2].f));
13101 break;
13102
13103 /* GL_NV_conservative_raster_pre_snap_triangles */
13104 case OPCODE_CONSERVATIVE_RASTER_PARAMETER_I:
13105 CALL_ConservativeRasterParameteriNV(ctx->Exec, (n[1].e, n[2].i));
13106 break;
13107
13108 /* GL_EXT_direct_state_access */
13109 case OPCODE_MATRIX_LOAD:
13110 CALL_MatrixLoadfEXT(ctx->Exec, (n[1].e, &n[2].f));
13111 break;
13112 case OPCODE_MATRIX_MULT:
13113 CALL_MatrixMultfEXT(ctx->Exec, (n[1].e, &n[2].f));
13114 break;
13115 case OPCODE_MATRIX_ROTATE:
13116 CALL_MatrixRotatefEXT(ctx->Exec, (n[1].e, n[2].f, n[3].f, n[4].f, n[5].f));
13117 break;
13118 case OPCODE_MATRIX_SCALE:
13119 CALL_MatrixScalefEXT(ctx->Exec, (n[1].e, n[2].f, n[3].f, n[4].f));
13120 break;
13121 case OPCODE_MATRIX_TRANSLATE:
13122 CALL_MatrixTranslatefEXT(ctx->Exec, (n[1].e, n[2].f, n[3].f, n[4].f));
13123 break;
13124 case OPCODE_MATRIX_LOAD_IDENTITY:
13125 CALL_MatrixLoadIdentityEXT(ctx->Exec, (n[1].e));
13126 break;
13127 case OPCODE_MATRIX_ORTHO:
13128 CALL_MatrixOrthoEXT(ctx->Exec, (n[1].e,
13129 n[2].f, n[3].f, n[4].f,
13130 n[5].f, n[6].f, n[7].f));
13131 break;
13132 case OPCODE_MATRIX_FRUSTUM:
13133 CALL_MatrixFrustumEXT(ctx->Exec, (n[1].e,
13134 n[2].f, n[3].f, n[4].f,
13135 n[5].f, n[6].f, n[7].f));
13136 break;
13137 case OPCODE_MATRIX_PUSH:
13138 CALL_MatrixPushEXT(ctx->Exec, (n[1].e));
13139 break;
13140 case OPCODE_MATRIX_POP:
13141 CALL_MatrixPopEXT(ctx->Exec, (n[1].e));
13142 break;
13143 case OPCODE_TEXTUREPARAMETER_F:
13144 {
13145 GLfloat params[4];
13146 params[0] = n[4].f;
13147 params[1] = n[5].f;
13148 params[2] = n[6].f;
13149 params[3] = n[7].f;
13150 CALL_TextureParameterfvEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].e, params));
13151 }
13152 break;
13153 case OPCODE_TEXTUREPARAMETER_I:
13154 {
13155 GLint params[4];
13156 params[0] = n[4].i;
13157 params[1] = n[5].i;
13158 params[2] = n[6].i;
13159 params[3] = n[7].i;
13160 CALL_TextureParameterivEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].e, params));
13161 }
13162 break;
13163 case OPCODE_TEXTUREPARAMETER_II:
13164 {
13165 GLint params[4];
13166 params[0] = n[4].i;
13167 params[1] = n[5].i;
13168 params[2] = n[6].i;
13169 params[3] = n[7].i;
13170 CALL_TextureParameterIivEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].e, params));
13171 }
13172 break;
13173 case OPCODE_TEXTUREPARAMETER_IUI:
13174 {
13175 GLuint params[4];
13176 params[0] = n[4].ui;
13177 params[1] = n[5].ui;
13178 params[2] = n[6].ui;
13179 params[3] = n[7].ui;
13180 CALL_TextureParameterIuivEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].e, params));
13181 }
13182 break;
13183 case OPCODE_TEXTURE_IMAGE1D:
13184 {
13185 const struct gl_pixelstore_attrib save = ctx->Unpack;
13186 ctx->Unpack = ctx->DefaultPacking;
13187 CALL_TextureImage1DEXT(ctx->Exec, (n[1].ui, /* texture */
13188 n[2].e, /* target */
13189 n[3].i, /* level */
13190 n[4].i, /* components */
13191 n[5].i, /* width */
13192 n[6].e, /* border */
13193 n[7].e, /* format */
13194 n[8].e, /* type */
13195 get_pointer(&n[9])));
13196 ctx->Unpack = save; /* restore */
13197 }
13198 break;
13199 case OPCODE_TEXTURE_IMAGE2D:
13200 {
13201 const struct gl_pixelstore_attrib save = ctx->Unpack;
13202 ctx->Unpack = ctx->DefaultPacking;
13203 CALL_TextureImage2DEXT(ctx->Exec, (n[1].ui, /* texture */
13204 n[2].e, /* target */
13205 n[3].i, /* level */
13206 n[4].i, /* components */
13207 n[5].i, /* width */
13208 n[6].i, /* height */
13209 n[7].e, /* border */
13210 n[8].e, /* format */
13211 n[9].e, /* type */
13212 get_pointer(&n[10])));
13213 ctx->Unpack = save; /* restore */
13214 }
13215 break;
13216 case OPCODE_TEXTURE_IMAGE3D:
13217 {
13218 const struct gl_pixelstore_attrib save = ctx->Unpack;
13219 ctx->Unpack = ctx->DefaultPacking;
13220 CALL_TextureImage3DEXT(ctx->Exec, (n[1].ui, /* texture */
13221 n[2].e, /* target */
13222 n[3].i, /* level */
13223 n[4].i, /* components */
13224 n[5].i, /* width */
13225 n[6].i, /* height */
13226 n[7].i, /* depth */
13227 n[8].e, /* border */
13228 n[9].e, /* format */
13229 n[10].e, /* type */
13230 get_pointer(&n[11])));
13231 ctx->Unpack = save; /* restore */
13232 }
13233 break;
13234 case OPCODE_TEXTURE_SUB_IMAGE1D:
13235 {
13236 const struct gl_pixelstore_attrib save = ctx->Unpack;
13237 ctx->Unpack = ctx->DefaultPacking;
13238 CALL_TextureSubImage1DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13239 n[4].i, n[5].i, n[6].e,
13240 n[7].e, get_pointer(&n[8])));
13241 ctx->Unpack = save; /* restore */
13242 }
13243 break;
13244 case OPCODE_TEXTURE_SUB_IMAGE2D:
13245 {
13246 const struct gl_pixelstore_attrib save = ctx->Unpack;
13247 ctx->Unpack = ctx->DefaultPacking;
13248 CALL_TextureSubImage2DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13249 n[4].i, n[5].i, n[6].e,
13250 n[7].i, n[8].e, n[9].e,
13251 get_pointer(&n[10])));
13252 ctx->Unpack = save;
13253 }
13254 break;
13255 case OPCODE_TEXTURE_SUB_IMAGE3D:
13256 {
13257 const struct gl_pixelstore_attrib save = ctx->Unpack;
13258 ctx->Unpack = ctx->DefaultPacking;
13259 CALL_TextureSubImage3DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13260 n[4].i, n[5].i, n[6].i,
13261 n[7].i, n[8].i, n[9].i,
13262 n[10].e, n[11].e,
13263 get_pointer(&n[12])));
13264 ctx->Unpack = save; /* restore */
13265 }
13266 break;
13267 case OPCODE_COPY_TEXTURE_IMAGE1D:
13268 CALL_CopyTextureImage1DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13269 n[4].e, n[5].i, n[6].i,
13270 n[7].i, n[8].i));
13271 break;
13272 case OPCODE_COPY_TEXTURE_IMAGE2D:
13273 CALL_CopyTextureImage2DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13274 n[4].e, n[5].i, n[6].i,
13275 n[7].i, n[8].i, n[9].i));
13276 break;
13277 case OPCODE_COPY_TEXTURE_SUB_IMAGE1D:
13278 CALL_CopyTextureSubImage1DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13279 n[4].i, n[5].i, n[6].i,
13280 n[7].i));
13281 break;
13282 case OPCODE_COPY_TEXTURE_SUB_IMAGE2D:
13283 CALL_CopyTextureSubImage2DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13284 n[4].i, n[5].i, n[6].i,
13285 n[7].i, n[8].i, n[9].i));
13286 break;
13287 case OPCODE_COPY_TEXTURE_SUB_IMAGE3D:
13288 CALL_CopyTextureSubImage3DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13289 n[4].i, n[5].i, n[6].i,
13290 n[7].i, n[8].i, n[9].i,
13291 n[10].i));
13292 break;
13293 case OPCODE_BIND_MULTITEXTURE:
13294 CALL_BindMultiTextureEXT(ctx->Exec, (n[1].e, n[2].e, n[3].ui));
13295 break;
13296 case OPCODE_MULTITEXPARAMETER_F:
13297 {
13298 GLfloat params[4];
13299 params[0] = n[4].f;
13300 params[1] = n[5].f;
13301 params[2] = n[6].f;
13302 params[3] = n[7].f;
13303 CALL_MultiTexParameterfvEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, params));
13304 }
13305 break;
13306 case OPCODE_MULTITEXPARAMETER_I:
13307 {
13308 GLint params[4];
13309 params[0] = n[4].i;
13310 params[1] = n[5].i;
13311 params[2] = n[6].i;
13312 params[3] = n[7].i;
13313 CALL_MultiTexParameterivEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, params));
13314 }
13315 break;
13316 case OPCODE_MULTITEXPARAMETER_II:
13317 {
13318 GLint params[4];
13319 params[0] = n[4].i;
13320 params[1] = n[5].i;
13321 params[2] = n[6].i;
13322 params[3] = n[7].i;
13323 CALL_MultiTexParameterIivEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, params));
13324 }
13325 break;
13326 case OPCODE_MULTITEXPARAMETER_IUI:
13327 {
13328 GLuint params[4];
13329 params[0] = n[4].ui;
13330 params[1] = n[5].ui;
13331 params[2] = n[6].ui;
13332 params[3] = n[7].ui;
13333 CALL_MultiTexParameterIuivEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, params));
13334 }
13335 break;
13336 case OPCODE_MULTITEX_IMAGE1D:
13337 {
13338 const struct gl_pixelstore_attrib save = ctx->Unpack;
13339 ctx->Unpack = ctx->DefaultPacking;
13340 CALL_MultiTexImage1DEXT(ctx->Exec, (n[1].e, /* texture */
13341 n[2].e, /* target */
13342 n[3].i, /* level */
13343 n[4].i, /* components */
13344 n[5].i, /* width */
13345 n[6].e, /* border */
13346 n[7].e, /* format */
13347 n[8].e, /* type */
13348 get_pointer(&n[9])));
13349 ctx->Unpack = save; /* restore */
13350 }
13351 break;
13352 case OPCODE_MULTITEX_IMAGE2D:
13353 {
13354 const struct gl_pixelstore_attrib save = ctx->Unpack;
13355 ctx->Unpack = ctx->DefaultPacking;
13356 CALL_MultiTexImage2DEXT(ctx->Exec, (n[1].e, /* texture */
13357 n[2].e, /* target */
13358 n[3].i, /* level */
13359 n[4].i, /* components */
13360 n[5].i, /* width */
13361 n[6].i, /* height */
13362 n[7].e, /* border */
13363 n[8].e, /* format */
13364 n[9].e, /* type */
13365 get_pointer(&n[10])));
13366 ctx->Unpack = save; /* restore */
13367 }
13368 break;
13369 case OPCODE_MULTITEX_IMAGE3D:
13370 {
13371 const struct gl_pixelstore_attrib save = ctx->Unpack;
13372 ctx->Unpack = ctx->DefaultPacking;
13373 CALL_MultiTexImage3DEXT(ctx->Exec, (n[1].e, /* texture */
13374 n[2].e, /* target */
13375 n[3].i, /* level */
13376 n[4].i, /* components */
13377 n[5].i, /* width */
13378 n[6].i, /* height */
13379 n[7].i, /* depth */
13380 n[8].e, /* border */
13381 n[9].e, /* format */
13382 n[10].e, /* type */
13383 get_pointer(&n[11])));
13384 ctx->Unpack = save; /* restore */
13385 }
13386 break;
13387 case OPCODE_MULTITEX_SUB_IMAGE1D:
13388 {
13389 const struct gl_pixelstore_attrib save = ctx->Unpack;
13390 ctx->Unpack = ctx->DefaultPacking;
13391 CALL_MultiTexSubImage1DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13392 n[4].i, n[5].i, n[6].e,
13393 n[7].e, get_pointer(&n[8])));
13394 ctx->Unpack = save; /* restore */
13395 }
13396 break;
13397 case OPCODE_MULTITEX_SUB_IMAGE2D:
13398 {
13399 const struct gl_pixelstore_attrib save = ctx->Unpack;
13400 ctx->Unpack = ctx->DefaultPacking;
13401 CALL_MultiTexSubImage2DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13402 n[4].i, n[5].i, n[6].e,
13403 n[7].i, n[8].e, n[9].e,
13404 get_pointer(&n[10])));
13405 ctx->Unpack = save; /* restore */
13406 }
13407 break;
13408 case OPCODE_MULTITEX_SUB_IMAGE3D:
13409 {
13410 const struct gl_pixelstore_attrib save = ctx->Unpack;
13411 ctx->Unpack = ctx->DefaultPacking;
13412 CALL_MultiTexSubImage3DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13413 n[4].i, n[5].i, n[6].i,
13414 n[7].i, n[8].i, n[9].i,
13415 n[10].e, n[11].e,
13416 get_pointer(&n[12])));
13417 ctx->Unpack = save; /* restore */
13418 }
13419 break;
13420 case OPCODE_COPY_MULTITEX_IMAGE1D:
13421 CALL_CopyMultiTexImage1DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13422 n[4].e, n[5].i, n[6].i,
13423 n[7].i, n[8].i));
13424 break;
13425 case OPCODE_COPY_MULTITEX_IMAGE2D:
13426 CALL_CopyMultiTexImage2DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13427 n[4].e, n[5].i, n[6].i,
13428 n[7].i, n[8].i, n[9].i));
13429 break;
13430 case OPCODE_COPY_MULTITEX_SUB_IMAGE1D:
13431 CALL_CopyMultiTexSubImage1DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13432 n[4].i, n[5].i, n[6].i,
13433 n[7].i));
13434 break;
13435 case OPCODE_COPY_MULTITEX_SUB_IMAGE2D:
13436 CALL_CopyMultiTexSubImage2DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13437 n[4].i, n[5].i, n[6].i,
13438 n[7].i, n[8].i, n[9].i));
13439 break;
13440 case OPCODE_COPY_MULTITEX_SUB_IMAGE3D:
13441 CALL_CopyMultiTexSubImage3DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13442 n[4].i, n[5].i, n[6].i,
13443 n[7].i, n[8].i, n[9].i,
13444 n[10].i));
13445 break;
13446 case OPCODE_MULTITEXENV:
13447 {
13448 GLfloat params[4];
13449 params[0] = n[4].f;
13450 params[1] = n[5].f;
13451 params[2] = n[6].f;
13452 params[3] = n[7].f;
13453 CALL_MultiTexEnvfvEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, params));
13454 }
13455 break;
13456 case OPCODE_COMPRESSED_TEXTURE_IMAGE_1D:
13457 CALL_CompressedTextureImage1DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13458 n[4].e, n[5].i, n[6].i,
13459 n[7].i, get_pointer(&n[8])));
13460 break;
13461 case OPCODE_COMPRESSED_TEXTURE_IMAGE_2D:
13462 CALL_CompressedTextureImage2DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13463 n[4].e, n[5].i, n[6].i,
13464 n[7].i, n[8].i,
13465 get_pointer(&n[9])));
13466 break;
13467 case OPCODE_COMPRESSED_TEXTURE_IMAGE_3D:
13468 CALL_CompressedTextureImage3DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13469 n[4].e, n[5].i, n[6].i,
13470 n[7].i, n[8].i, n[9].i,
13471 get_pointer(&n[10])));
13472 break;
13473 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_1D:
13474 CALL_CompressedTextureSubImage1DEXT(ctx->Exec,
13475 (n[1].ui, n[2].e, n[3].i, n[4].i,
13476 n[5].i, n[6].e, n[7].i,
13477 get_pointer(&n[8])));
13478 break;
13479 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_2D:
13480 CALL_CompressedTextureSubImage2DEXT(ctx->Exec,
13481 (n[1].ui, n[2].e, n[3].i, n[4].i,
13482 n[5].i, n[6].i, n[7].i, n[8].e,
13483 n[9].i, get_pointer(&n[10])));
13484 break;
13485 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_3D:
13486 CALL_CompressedTextureSubImage3DEXT(ctx->Exec,
13487 (n[1].ui, n[2].e, n[3].i, n[4].i,
13488 n[5].i, n[6].i, n[7].i, n[8].i,
13489 n[9].i, n[10].e, n[11].i,
13490 get_pointer(&n[12])));
13491 break;
13492 case OPCODE_COMPRESSED_MULTITEX_IMAGE_1D:
13493 CALL_CompressedMultiTexImage1DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13494 n[4].e, n[5].i, n[6].i,
13495 n[7].i, get_pointer(&n[8])));
13496 break;
13497 case OPCODE_COMPRESSED_MULTITEX_IMAGE_2D:
13498 CALL_CompressedMultiTexImage2DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13499 n[4].e, n[5].i, n[6].i,
13500 n[7].i, n[8].i,
13501 get_pointer(&n[9])));
13502 break;
13503 case OPCODE_COMPRESSED_MULTITEX_IMAGE_3D:
13504 CALL_CompressedMultiTexImage3DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13505 n[4].e, n[5].i, n[6].i,
13506 n[7].i, n[8].i, n[9].i,
13507 get_pointer(&n[10])));
13508 break;
13509 case OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_1D:
13510 CALL_CompressedMultiTexSubImage1DEXT(ctx->Exec,
13511 (n[1].e, n[2].e, n[3].i, n[4].i,
13512 n[5].i, n[6].e, n[7].i,
13513 get_pointer(&n[8])));
13514 break;
13515 case OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_2D:
13516 CALL_CompressedMultiTexSubImage2DEXT(ctx->Exec,
13517 (n[1].e, n[2].e, n[3].i, n[4].i,
13518 n[5].i, n[6].i, n[7].i, n[8].e,
13519 n[9].i, get_pointer(&n[10])));
13520 break;
13521 case OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_3D:
13522 CALL_CompressedMultiTexSubImage3DEXT(ctx->Exec,
13523 (n[1].e, n[2].e, n[3].i, n[4].i,
13524 n[5].i, n[6].i, n[7].i, n[8].i,
13525 n[9].i, n[10].e, n[11].i,
13526 get_pointer(&n[12])));
13527 break;
13528 case OPCODE_NAMED_PROGRAM_STRING:
13529 CALL_NamedProgramStringEXT(ctx->Exec,
13530 (n[1].ui, n[2].e, n[3].e, n[4].i,
13531 get_pointer(&n[5])));
13532 break;
13533 case OPCODE_NAMED_PROGRAM_LOCAL_PARAMETER:
13534 CALL_NamedProgramLocalParameter4fEXT(ctx->Exec,
13535 (n[1].ui, n[2].e, n[3].ui, n[4].f,
13536 n[5].f, n[6].f, n[7].f));
13537 break;
13538
13539 case OPCODE_CONTINUE:
13540 n = (Node *) get_pointer(&n[1]);
13541 break;
13542 case OPCODE_NOP:
13543 /* no-op */
13544 break;
13545 case OPCODE_END_OF_LIST:
13546 done = GL_TRUE;
13547 break;
13548 default:
13549 {
13550 char msg[1000];
13551 _mesa_snprintf(msg, sizeof(msg), "Error in execute_list: opcode=%d",
13552 (int) opcode);
13553 _mesa_problem(ctx, "%s", msg);
13554 }
13555 done = GL_TRUE;
13556 }
13557
13558 /* increment n to point to next compiled command */
13559 if (opcode != OPCODE_CONTINUE) {
13560 assert(InstSize[opcode] > 0);
13561 n += InstSize[opcode];
13562 }
13563 }
13564 }
13565
13566 vbo_save_EndCallList(ctx);
13567
13568 ctx->ListState.CallDepth--;
13569 }
13570
13571
13572
13573 /**********************************************************************/
13574 /* GL functions */
13575 /**********************************************************************/
13576
13577 /**
13578 * Test if a display list number is valid.
13579 */
13580 GLboolean GLAPIENTRY
13581 _mesa_IsList(GLuint list)
13582 {
13583 GET_CURRENT_CONTEXT(ctx);
13584 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
13585 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
13586 return islist(ctx, list);
13587 }
13588
13589
13590 /**
13591 * Delete a sequence of consecutive display lists.
13592 */
13593 void GLAPIENTRY
13594 _mesa_DeleteLists(GLuint list, GLsizei range)
13595 {
13596 GET_CURRENT_CONTEXT(ctx);
13597 GLuint i;
13598 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
13599 ASSERT_OUTSIDE_BEGIN_END(ctx);
13600
13601 if (range < 0) {
13602 _mesa_error(ctx, GL_INVALID_VALUE, "glDeleteLists");
13603 return;
13604 }
13605
13606 if (range > 1) {
13607 /* We may be deleting a set of bitmap lists. See if there's a
13608 * bitmap atlas to free.
13609 */
13610 struct gl_bitmap_atlas *atlas = lookup_bitmap_atlas(ctx, list);
13611 if (atlas) {
13612 _mesa_delete_bitmap_atlas(ctx, atlas);
13613 _mesa_HashRemove(ctx->Shared->BitmapAtlas, list);
13614 }
13615 }
13616
13617 for (i = list; i < list + range; i++) {
13618 destroy_list(ctx, i);
13619 }
13620 }
13621
13622
13623 /**
13624 * Return a display list number, n, such that lists n through n+range-1
13625 * are free.
13626 */
13627 GLuint GLAPIENTRY
13628 _mesa_GenLists(GLsizei range)
13629 {
13630 GET_CURRENT_CONTEXT(ctx);
13631 GLuint base;
13632 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
13633 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
13634
13635 if (range < 0) {
13636 _mesa_error(ctx, GL_INVALID_VALUE, "glGenLists");
13637 return 0;
13638 }
13639 if (range == 0) {
13640 return 0;
13641 }
13642
13643 /*
13644 * Make this an atomic operation
13645 */
13646 _mesa_HashLockMutex(ctx->Shared->DisplayList);
13647
13648 base = _mesa_HashFindFreeKeyBlock(ctx->Shared->DisplayList, range);
13649 if (base) {
13650 /* reserve the list IDs by with empty/dummy lists */
13651 GLint i;
13652 for (i = 0; i < range; i++) {
13653 _mesa_HashInsertLocked(ctx->Shared->DisplayList, base + i,
13654 make_list(base + i, 1));
13655 }
13656 }
13657
13658 if (USE_BITMAP_ATLAS &&
13659 range > 16 &&
13660 ctx->Driver.DrawAtlasBitmaps) {
13661 /* "range > 16" is a rough heuristic to guess when glGenLists might be
13662 * used to allocate display lists for glXUseXFont or wglUseFontBitmaps.
13663 * Create the empty atlas now.
13664 */
13665 struct gl_bitmap_atlas *atlas = lookup_bitmap_atlas(ctx, base);
13666 if (!atlas) {
13667 atlas = alloc_bitmap_atlas(ctx, base);
13668 }
13669 if (atlas) {
13670 /* Atlas _should_ be new/empty now, but clobbering is OK */
13671 assert(atlas->numBitmaps == 0);
13672 atlas->numBitmaps = range;
13673 }
13674 }
13675
13676 _mesa_HashUnlockMutex(ctx->Shared->DisplayList);
13677
13678 return base;
13679 }
13680
13681
13682 /**
13683 * Begin a new display list.
13684 */
13685 void GLAPIENTRY
13686 _mesa_NewList(GLuint name, GLenum mode)
13687 {
13688 GET_CURRENT_CONTEXT(ctx);
13689
13690 FLUSH_CURRENT(ctx, 0); /* must be called before assert */
13691 ASSERT_OUTSIDE_BEGIN_END(ctx);
13692
13693 if (MESA_VERBOSE & VERBOSE_API)
13694 _mesa_debug(ctx, "glNewList %u %s\n", name,
13695 _mesa_enum_to_string(mode));
13696
13697 if (name == 0) {
13698 _mesa_error(ctx, GL_INVALID_VALUE, "glNewList");
13699 return;
13700 }
13701
13702 if (mode != GL_COMPILE && mode != GL_COMPILE_AND_EXECUTE) {
13703 _mesa_error(ctx, GL_INVALID_ENUM, "glNewList");
13704 return;
13705 }
13706
13707 if (ctx->ListState.CurrentList) {
13708 /* already compiling a display list */
13709 _mesa_error(ctx, GL_INVALID_OPERATION, "glNewList");
13710 return;
13711 }
13712
13713 ctx->CompileFlag = GL_TRUE;
13714 ctx->ExecuteFlag = (mode == GL_COMPILE_AND_EXECUTE);
13715
13716 /* Reset accumulated list state */
13717 invalidate_saved_current_state( ctx );
13718
13719 /* Allocate new display list */
13720 ctx->ListState.CurrentList = make_list(name, BLOCK_SIZE);
13721 ctx->ListState.CurrentBlock = ctx->ListState.CurrentList->Head;
13722 ctx->ListState.CurrentPos = 0;
13723
13724 vbo_save_NewList(ctx, name, mode);
13725
13726 ctx->CurrentServerDispatch = ctx->Save;
13727 _glapi_set_dispatch(ctx->CurrentServerDispatch);
13728 if (ctx->MarshalExec == NULL) {
13729 ctx->CurrentClientDispatch = ctx->CurrentServerDispatch;
13730 }
13731 }
13732
13733
13734 /**
13735 * End definition of current display list.
13736 */
13737 void GLAPIENTRY
13738 _mesa_EndList(void)
13739 {
13740 GET_CURRENT_CONTEXT(ctx);
13741 SAVE_FLUSH_VERTICES(ctx);
13742 FLUSH_VERTICES(ctx, 0);
13743
13744 if (MESA_VERBOSE & VERBOSE_API)
13745 _mesa_debug(ctx, "glEndList\n");
13746
13747 if (ctx->ExecuteFlag && _mesa_inside_dlist_begin_end(ctx)) {
13748 _mesa_error(ctx, GL_INVALID_OPERATION,
13749 "glEndList() called inside glBegin/End");
13750 }
13751
13752 /* Check that a list is under construction */
13753 if (!ctx->ListState.CurrentList) {
13754 _mesa_error(ctx, GL_INVALID_OPERATION, "glEndList");
13755 return;
13756 }
13757
13758 /* Call before emitting END_OF_LIST, in case the driver wants to
13759 * emit opcodes itself.
13760 */
13761 vbo_save_EndList(ctx);
13762
13763 (void) alloc_instruction(ctx, OPCODE_END_OF_LIST, 0);
13764
13765 trim_list(ctx);
13766
13767 /* Destroy old list, if any */
13768 destroy_list(ctx, ctx->ListState.CurrentList->Name);
13769
13770 /* Install the new list */
13771 _mesa_HashInsert(ctx->Shared->DisplayList,
13772 ctx->ListState.CurrentList->Name,
13773 ctx->ListState.CurrentList);
13774
13775
13776 if (MESA_VERBOSE & VERBOSE_DISPLAY_LIST)
13777 mesa_print_display_list(ctx->ListState.CurrentList->Name);
13778
13779 ctx->ListState.CurrentList = NULL;
13780 ctx->ListState.CurrentBlock = NULL;
13781 ctx->ListState.CurrentPos = 0;
13782 ctx->ExecuteFlag = GL_TRUE;
13783 ctx->CompileFlag = GL_FALSE;
13784
13785 ctx->CurrentServerDispatch = ctx->Exec;
13786 _glapi_set_dispatch(ctx->CurrentServerDispatch);
13787 if (ctx->MarshalExec == NULL) {
13788 ctx->CurrentClientDispatch = ctx->CurrentServerDispatch;
13789 }
13790 }
13791
13792
13793 void GLAPIENTRY
13794 _mesa_CallList(GLuint list)
13795 {
13796 GLboolean save_compile_flag;
13797 GET_CURRENT_CONTEXT(ctx);
13798 FLUSH_CURRENT(ctx, 0);
13799
13800 if (MESA_VERBOSE & VERBOSE_API)
13801 _mesa_debug(ctx, "glCallList %d\n", list);
13802
13803 if (list == 0) {
13804 _mesa_error(ctx, GL_INVALID_VALUE, "glCallList(list==0)");
13805 return;
13806 }
13807
13808 if (0)
13809 mesa_print_display_list( list );
13810
13811 /* VERY IMPORTANT: Save the CompileFlag status, turn it off,
13812 * execute the display list, and restore the CompileFlag.
13813 */
13814 save_compile_flag = ctx->CompileFlag;
13815 if (save_compile_flag) {
13816 ctx->CompileFlag = GL_FALSE;
13817 }
13818
13819 execute_list(ctx, list);
13820 ctx->CompileFlag = save_compile_flag;
13821
13822 /* also restore API function pointers to point to "save" versions */
13823 if (save_compile_flag) {
13824 ctx->CurrentServerDispatch = ctx->Save;
13825 _glapi_set_dispatch(ctx->CurrentServerDispatch);
13826 if (ctx->MarshalExec == NULL) {
13827 ctx->CurrentClientDispatch = ctx->CurrentServerDispatch;
13828 }
13829 }
13830 }
13831
13832
13833 /**
13834 * Try to execute a glCallLists() command where the display lists contain
13835 * glBitmap commands with a texture atlas.
13836 * \return true for success, false otherwise
13837 */
13838 static bool
13839 render_bitmap_atlas(struct gl_context *ctx, GLsizei n, GLenum type,
13840 const void *lists)
13841 {
13842 struct gl_bitmap_atlas *atlas;
13843 int i;
13844
13845 if (!USE_BITMAP_ATLAS ||
13846 !ctx->Current.RasterPosValid ||
13847 ctx->List.ListBase == 0 ||
13848 type != GL_UNSIGNED_BYTE ||
13849 !ctx->Driver.DrawAtlasBitmaps) {
13850 /* unsupported */
13851 return false;
13852 }
13853
13854 atlas = lookup_bitmap_atlas(ctx, ctx->List.ListBase);
13855
13856 if (!atlas) {
13857 /* Even if glGenLists wasn't called, we can still try to create
13858 * the atlas now.
13859 */
13860 atlas = alloc_bitmap_atlas(ctx, ctx->List.ListBase);
13861 }
13862
13863 if (atlas && !atlas->complete && !atlas->incomplete) {
13864 /* Try to build the bitmap atlas now.
13865 * If the atlas was created in glGenLists, we'll have recorded the
13866 * number of lists (bitmaps). Otherwise, take a guess at 256.
13867 */
13868 if (atlas->numBitmaps == 0)
13869 atlas->numBitmaps = 256;
13870 build_bitmap_atlas(ctx, atlas, ctx->List.ListBase);
13871 }
13872
13873 if (!atlas || !atlas->complete) {
13874 return false;
13875 }
13876
13877 /* check that all display list IDs are in the atlas */
13878 for (i = 0; i < n; i++) {
13879 const GLubyte *ids = (const GLubyte *) lists;
13880
13881 if (ids[i] >= atlas->numBitmaps) {
13882 return false;
13883 }
13884 }
13885
13886 ctx->Driver.DrawAtlasBitmaps(ctx, atlas, n, (const GLubyte *) lists);
13887
13888 return true;
13889 }
13890
13891
13892 /**
13893 * Execute glCallLists: call multiple display lists.
13894 */
13895 void GLAPIENTRY
13896 _mesa_CallLists(GLsizei n, GLenum type, const GLvoid * lists)
13897 {
13898 GET_CURRENT_CONTEXT(ctx);
13899 GLint i;
13900 GLboolean save_compile_flag;
13901
13902 if (MESA_VERBOSE & VERBOSE_API)
13903 _mesa_debug(ctx, "glCallLists %d\n", n);
13904
13905 switch (type) {
13906 case GL_BYTE:
13907 case GL_UNSIGNED_BYTE:
13908 case GL_SHORT:
13909 case GL_UNSIGNED_SHORT:
13910 case GL_INT:
13911 case GL_UNSIGNED_INT:
13912 case GL_FLOAT:
13913 case GL_2_BYTES:
13914 case GL_3_BYTES:
13915 case GL_4_BYTES:
13916 /* OK */
13917 break;
13918 default:
13919 _mesa_error(ctx, GL_INVALID_ENUM, "glCallLists(type)");
13920 return;
13921 }
13922
13923 if (n < 0) {
13924 _mesa_error(ctx, GL_INVALID_VALUE, "glCallLists(n < 0)");
13925 return;
13926 } else if (n == 0 || lists == NULL) {
13927 /* nothing to do */
13928 return;
13929 }
13930
13931 if (render_bitmap_atlas(ctx, n, type, lists)) {
13932 return;
13933 }
13934
13935 /* Save the CompileFlag status, turn it off, execute display list,
13936 * and restore the CompileFlag.
13937 */
13938 save_compile_flag = ctx->CompileFlag;
13939 ctx->CompileFlag = GL_FALSE;
13940
13941 for (i = 0; i < n; i++) {
13942 GLuint list = (GLuint) (ctx->List.ListBase + translate_id(i, type, lists));
13943 execute_list(ctx, list);
13944 }
13945
13946 ctx->CompileFlag = save_compile_flag;
13947
13948 /* also restore API function pointers to point to "save" versions */
13949 if (save_compile_flag) {
13950 ctx->CurrentServerDispatch = ctx->Save;
13951 _glapi_set_dispatch(ctx->CurrentServerDispatch);
13952 if (ctx->MarshalExec == NULL) {
13953 ctx->CurrentClientDispatch = ctx->CurrentServerDispatch;
13954 }
13955 }
13956 }
13957
13958
13959 /**
13960 * Set the offset added to list numbers in glCallLists.
13961 */
13962 void GLAPIENTRY
13963 _mesa_ListBase(GLuint base)
13964 {
13965 GET_CURRENT_CONTEXT(ctx);
13966 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
13967 ASSERT_OUTSIDE_BEGIN_END(ctx);
13968 ctx->List.ListBase = base;
13969 }
13970
13971 /**
13972 * Setup the given dispatch table to point to Mesa's display list
13973 * building functions.
13974 *
13975 * This does not include any of the tnl functions - they are
13976 * initialized from _mesa_init_api_defaults and from the active vtxfmt
13977 * struct.
13978 */
13979 void
13980 _mesa_initialize_save_table(const struct gl_context *ctx)
13981 {
13982 struct _glapi_table *table = ctx->Save;
13983 int numEntries = MAX2(_gloffset_COUNT, _glapi_get_dispatch_table_size());
13984
13985 /* Initially populate the dispatch table with the contents of the
13986 * normal-execution dispatch table. This lets us skip populating functions
13987 * that should be called directly instead of compiled into display lists.
13988 */
13989 memcpy(table, ctx->Exec, numEntries * sizeof(_glapi_proc));
13990
13991 _mesa_loopback_init_api_table(ctx, table);
13992
13993 /* VBO functions */
13994 vbo_initialize_save_dispatch(ctx, table);
13995
13996 /* GL 1.0 */
13997 SET_Accum(table, save_Accum);
13998 SET_AlphaFunc(table, save_AlphaFunc);
13999 SET_Bitmap(table, save_Bitmap);
14000 SET_BlendFunc(table, save_BlendFunc);
14001 SET_CallList(table, save_CallList);
14002 SET_CallLists(table, save_CallLists);
14003 SET_Clear(table, save_Clear);
14004 SET_ClearAccum(table, save_ClearAccum);
14005 SET_ClearColor(table, save_ClearColor);
14006 SET_ClearDepth(table, save_ClearDepth);
14007 SET_ClearIndex(table, save_ClearIndex);
14008 SET_ClearStencil(table, save_ClearStencil);
14009 SET_ClipPlane(table, save_ClipPlane);
14010 SET_ColorMask(table, save_ColorMask);
14011 SET_ColorMaski(table, save_ColorMaskIndexed);
14012 SET_ColorMaterial(table, save_ColorMaterial);
14013 SET_CopyPixels(table, save_CopyPixels);
14014 SET_CullFace(table, save_CullFace);
14015 SET_DepthFunc(table, save_DepthFunc);
14016 SET_DepthMask(table, save_DepthMask);
14017 SET_DepthRange(table, save_DepthRange);
14018 SET_Disable(table, save_Disable);
14019 SET_Disablei(table, save_DisableIndexed);
14020 SET_DrawBuffer(table, save_DrawBuffer);
14021 SET_DrawPixels(table, save_DrawPixels);
14022 SET_Enable(table, save_Enable);
14023 SET_Enablei(table, save_EnableIndexed);
14024 SET_EvalMesh1(table, save_EvalMesh1);
14025 SET_EvalMesh2(table, save_EvalMesh2);
14026 SET_Fogf(table, save_Fogf);
14027 SET_Fogfv(table, save_Fogfv);
14028 SET_Fogi(table, save_Fogi);
14029 SET_Fogiv(table, save_Fogiv);
14030 SET_FrontFace(table, save_FrontFace);
14031 SET_Frustum(table, save_Frustum);
14032 SET_Hint(table, save_Hint);
14033 SET_IndexMask(table, save_IndexMask);
14034 SET_InitNames(table, save_InitNames);
14035 SET_LightModelf(table, save_LightModelf);
14036 SET_LightModelfv(table, save_LightModelfv);
14037 SET_LightModeli(table, save_LightModeli);
14038 SET_LightModeliv(table, save_LightModeliv);
14039 SET_Lightf(table, save_Lightf);
14040 SET_Lightfv(table, save_Lightfv);
14041 SET_Lighti(table, save_Lighti);
14042 SET_Lightiv(table, save_Lightiv);
14043 SET_LineStipple(table, save_LineStipple);
14044 SET_LineWidth(table, save_LineWidth);
14045 SET_ListBase(table, save_ListBase);
14046 SET_LoadIdentity(table, save_LoadIdentity);
14047 SET_LoadMatrixd(table, save_LoadMatrixd);
14048 SET_LoadMatrixf(table, save_LoadMatrixf);
14049 SET_LoadName(table, save_LoadName);
14050 SET_LogicOp(table, save_LogicOp);
14051 SET_Map1d(table, save_Map1d);
14052 SET_Map1f(table, save_Map1f);
14053 SET_Map2d(table, save_Map2d);
14054 SET_Map2f(table, save_Map2f);
14055 SET_MapGrid1d(table, save_MapGrid1d);
14056 SET_MapGrid1f(table, save_MapGrid1f);
14057 SET_MapGrid2d(table, save_MapGrid2d);
14058 SET_MapGrid2f(table, save_MapGrid2f);
14059 SET_MatrixMode(table, save_MatrixMode);
14060 SET_MultMatrixd(table, save_MultMatrixd);
14061 SET_MultMatrixf(table, save_MultMatrixf);
14062 SET_NewList(table, save_NewList);
14063 SET_Ortho(table, save_Ortho);
14064 SET_PassThrough(table, save_PassThrough);
14065 SET_PixelMapfv(table, save_PixelMapfv);
14066 SET_PixelMapuiv(table, save_PixelMapuiv);
14067 SET_PixelMapusv(table, save_PixelMapusv);
14068 SET_PixelTransferf(table, save_PixelTransferf);
14069 SET_PixelTransferi(table, save_PixelTransferi);
14070 SET_PixelZoom(table, save_PixelZoom);
14071 SET_PointSize(table, save_PointSize);
14072 SET_PolygonMode(table, save_PolygonMode);
14073 SET_PolygonOffset(table, save_PolygonOffset);
14074 SET_PolygonStipple(table, save_PolygonStipple);
14075 SET_PopAttrib(table, save_PopAttrib);
14076 SET_PopMatrix(table, save_PopMatrix);
14077 SET_PopName(table, save_PopName);
14078 SET_PushAttrib(table, save_PushAttrib);
14079 SET_PushMatrix(table, save_PushMatrix);
14080 SET_PushName(table, save_PushName);
14081 SET_RasterPos2d(table, save_RasterPos2d);
14082 SET_RasterPos2dv(table, save_RasterPos2dv);
14083 SET_RasterPos2f(table, save_RasterPos2f);
14084 SET_RasterPos2fv(table, save_RasterPos2fv);
14085 SET_RasterPos2i(table, save_RasterPos2i);
14086 SET_RasterPos2iv(table, save_RasterPos2iv);
14087 SET_RasterPos2s(table, save_RasterPos2s);
14088 SET_RasterPos2sv(table, save_RasterPos2sv);
14089 SET_RasterPos3d(table, save_RasterPos3d);
14090 SET_RasterPos3dv(table, save_RasterPos3dv);
14091 SET_RasterPos3f(table, save_RasterPos3f);
14092 SET_RasterPos3fv(table, save_RasterPos3fv);
14093 SET_RasterPos3i(table, save_RasterPos3i);
14094 SET_RasterPos3iv(table, save_RasterPos3iv);
14095 SET_RasterPos3s(table, save_RasterPos3s);
14096 SET_RasterPos3sv(table, save_RasterPos3sv);
14097 SET_RasterPos4d(table, save_RasterPos4d);
14098 SET_RasterPos4dv(table, save_RasterPos4dv);
14099 SET_RasterPos4f(table, save_RasterPos4f);
14100 SET_RasterPos4fv(table, save_RasterPos4fv);
14101 SET_RasterPos4i(table, save_RasterPos4i);
14102 SET_RasterPos4iv(table, save_RasterPos4iv);
14103 SET_RasterPos4s(table, save_RasterPos4s);
14104 SET_RasterPos4sv(table, save_RasterPos4sv);
14105 SET_ReadBuffer(table, save_ReadBuffer);
14106 SET_Rectf(table, save_Rectf);
14107 SET_Rotated(table, save_Rotated);
14108 SET_Rotatef(table, save_Rotatef);
14109 SET_Scaled(table, save_Scaled);
14110 SET_Scalef(table, save_Scalef);
14111 SET_Scissor(table, save_Scissor);
14112 SET_ShadeModel(table, save_ShadeModel);
14113 SET_StencilFunc(table, save_StencilFunc);
14114 SET_StencilMask(table, save_StencilMask);
14115 SET_StencilOp(table, save_StencilOp);
14116 SET_TexEnvf(table, save_TexEnvf);
14117 SET_TexEnvfv(table, save_TexEnvfv);
14118 SET_TexEnvi(table, save_TexEnvi);
14119 SET_TexEnviv(table, save_TexEnviv);
14120 SET_TexGend(table, save_TexGend);
14121 SET_TexGendv(table, save_TexGendv);
14122 SET_TexGenf(table, save_TexGenf);
14123 SET_TexGenfv(table, save_TexGenfv);
14124 SET_TexGeni(table, save_TexGeni);
14125 SET_TexGeniv(table, save_TexGeniv);
14126 SET_TexImage1D(table, save_TexImage1D);
14127 SET_TexImage2D(table, save_TexImage2D);
14128 SET_TexParameterf(table, save_TexParameterf);
14129 SET_TexParameterfv(table, save_TexParameterfv);
14130 SET_TexParameteri(table, save_TexParameteri);
14131 SET_TexParameteriv(table, save_TexParameteriv);
14132 SET_Translated(table, save_Translated);
14133 SET_Translatef(table, save_Translatef);
14134 SET_Viewport(table, save_Viewport);
14135
14136 /* GL 1.1 */
14137 SET_BindTexture(table, save_BindTexture);
14138 SET_CopyTexImage1D(table, save_CopyTexImage1D);
14139 SET_CopyTexImage2D(table, save_CopyTexImage2D);
14140 SET_CopyTexSubImage1D(table, save_CopyTexSubImage1D);
14141 SET_CopyTexSubImage2D(table, save_CopyTexSubImage2D);
14142 SET_PrioritizeTextures(table, save_PrioritizeTextures);
14143 SET_TexSubImage1D(table, save_TexSubImage1D);
14144 SET_TexSubImage2D(table, save_TexSubImage2D);
14145
14146 /* GL 1.2 */
14147 SET_CopyTexSubImage3D(table, save_CopyTexSubImage3D);
14148 SET_TexImage3D(table, save_TexImage3D);
14149 SET_TexSubImage3D(table, save_TexSubImage3D);
14150
14151 /* GL 2.0 */
14152 SET_StencilFuncSeparate(table, save_StencilFuncSeparate);
14153 SET_StencilMaskSeparate(table, save_StencilMaskSeparate);
14154 SET_StencilOpSeparate(table, save_StencilOpSeparate);
14155
14156 /* ATI_separate_stencil */
14157 SET_StencilFuncSeparateATI(table, save_StencilFuncSeparateATI);
14158
14159 /* GL_ARB_imaging */
14160 /* Not all are supported */
14161 SET_BlendColor(table, save_BlendColor);
14162 SET_BlendEquation(table, save_BlendEquation);
14163
14164 /* 2. GL_EXT_blend_color */
14165 #if 0
14166 SET_BlendColorEXT(table, save_BlendColorEXT);
14167 #endif
14168
14169 /* 6. GL_EXT_texture3d */
14170 #if 0
14171 SET_CopyTexSubImage3DEXT(table, save_CopyTexSubImage3D);
14172 SET_TexImage3DEXT(table, save_TexImage3DEXT);
14173 SET_TexSubImage3DEXT(table, save_TexSubImage3D);
14174 #endif
14175
14176 /* 37. GL_EXT_blend_minmax */
14177 #if 0
14178 SET_BlendEquationEXT(table, save_BlendEquationEXT);
14179 #endif
14180
14181 /* 54. GL_EXT_point_parameters */
14182 SET_PointParameterf(table, save_PointParameterfEXT);
14183 SET_PointParameterfv(table, save_PointParameterfvEXT);
14184
14185 /* 91. GL_ARB_tessellation_shader */
14186 SET_PatchParameteri(table, save_PatchParameteri);
14187 SET_PatchParameterfv(table, save_PatchParameterfv);
14188
14189 /* 100. ARB_viewport_array */
14190 SET_ViewportArrayv(table, save_ViewportArrayv);
14191 SET_ViewportIndexedf(table, save_ViewportIndexedf);
14192 SET_ViewportIndexedfv(table, save_ViewportIndexedfv);
14193 SET_ScissorArrayv(table, save_ScissorArrayv);
14194 SET_ScissorIndexed(table, save_ScissorIndexed);
14195 SET_ScissorIndexedv(table, save_ScissorIndexedv);
14196 SET_DepthRangeArrayv(table, save_DepthRangeArrayv);
14197 SET_DepthRangeIndexed(table, save_DepthRangeIndexed);
14198
14199 /* 122. ARB_compute_shader */
14200 SET_DispatchCompute(table, save_DispatchCompute);
14201 SET_DispatchComputeIndirect(table, save_DispatchComputeIndirect);
14202
14203 /* 173. GL_EXT_blend_func_separate */
14204 SET_BlendFuncSeparate(table, save_BlendFuncSeparateEXT);
14205
14206 /* 197. GL_MESA_window_pos */
14207 SET_WindowPos2d(table, save_WindowPos2dMESA);
14208 SET_WindowPos2dv(table, save_WindowPos2dvMESA);
14209 SET_WindowPos2f(table, save_WindowPos2fMESA);
14210 SET_WindowPos2fv(table, save_WindowPos2fvMESA);
14211 SET_WindowPos2i(table, save_WindowPos2iMESA);
14212 SET_WindowPos2iv(table, save_WindowPos2ivMESA);
14213 SET_WindowPos2s(table, save_WindowPos2sMESA);
14214 SET_WindowPos2sv(table, save_WindowPos2svMESA);
14215 SET_WindowPos3d(table, save_WindowPos3dMESA);
14216 SET_WindowPos3dv(table, save_WindowPos3dvMESA);
14217 SET_WindowPos3f(table, save_WindowPos3fMESA);
14218 SET_WindowPos3fv(table, save_WindowPos3fvMESA);
14219 SET_WindowPos3i(table, save_WindowPos3iMESA);
14220 SET_WindowPos3iv(table, save_WindowPos3ivMESA);
14221 SET_WindowPos3s(table, save_WindowPos3sMESA);
14222 SET_WindowPos3sv(table, save_WindowPos3svMESA);
14223 SET_WindowPos4dMESA(table, save_WindowPos4dMESA);
14224 SET_WindowPos4dvMESA(table, save_WindowPos4dvMESA);
14225 SET_WindowPos4fMESA(table, save_WindowPos4fMESA);
14226 SET_WindowPos4fvMESA(table, save_WindowPos4fvMESA);
14227 SET_WindowPos4iMESA(table, save_WindowPos4iMESA);
14228 SET_WindowPos4ivMESA(table, save_WindowPos4ivMESA);
14229 SET_WindowPos4sMESA(table, save_WindowPos4sMESA);
14230 SET_WindowPos4svMESA(table, save_WindowPos4svMESA);
14231
14232 /* 245. GL_ATI_fragment_shader */
14233 SET_BindFragmentShaderATI(table, save_BindFragmentShaderATI);
14234 SET_SetFragmentShaderConstantATI(table, save_SetFragmentShaderConstantATI);
14235
14236 /* 262. GL_NV_point_sprite */
14237 SET_PointParameteri(table, save_PointParameteriNV);
14238 SET_PointParameteriv(table, save_PointParameterivNV);
14239
14240 /* 268. GL_EXT_stencil_two_side */
14241 SET_ActiveStencilFaceEXT(table, save_ActiveStencilFaceEXT);
14242
14243 /* ???. GL_EXT_depth_bounds_test */
14244 SET_DepthBoundsEXT(table, save_DepthBoundsEXT);
14245
14246 /* ARB 1. GL_ARB_multitexture */
14247 SET_ActiveTexture(table, save_ActiveTextureARB);
14248
14249 /* ARB 3. GL_ARB_transpose_matrix */
14250 SET_LoadTransposeMatrixd(table, save_LoadTransposeMatrixdARB);
14251 SET_LoadTransposeMatrixf(table, save_LoadTransposeMatrixfARB);
14252 SET_MultTransposeMatrixd(table, save_MultTransposeMatrixdARB);
14253 SET_MultTransposeMatrixf(table, save_MultTransposeMatrixfARB);
14254
14255 /* ARB 5. GL_ARB_multisample */
14256 SET_SampleCoverage(table, save_SampleCoverageARB);
14257
14258 /* ARB 12. GL_ARB_texture_compression */
14259 SET_CompressedTexImage3D(table, save_CompressedTexImage3DARB);
14260 SET_CompressedTexImage2D(table, save_CompressedTexImage2DARB);
14261 SET_CompressedTexImage1D(table, save_CompressedTexImage1DARB);
14262 SET_CompressedTexSubImage3D(table, save_CompressedTexSubImage3DARB);
14263 SET_CompressedTexSubImage2D(table, save_CompressedTexSubImage2DARB);
14264 SET_CompressedTexSubImage1D(table, save_CompressedTexSubImage1DARB);
14265
14266 /* ARB 14. GL_ARB_point_parameters */
14267 /* aliased with EXT_point_parameters functions */
14268
14269 /* ARB 25. GL_ARB_window_pos */
14270 /* aliased with MESA_window_pos functions */
14271
14272 /* ARB 26. GL_ARB_vertex_program */
14273 /* ARB 27. GL_ARB_fragment_program */
14274 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
14275 SET_ProgramStringARB(table, save_ProgramStringARB);
14276 SET_BindProgramARB(table, save_BindProgramARB);
14277 SET_ProgramEnvParameter4dARB(table, save_ProgramEnvParameter4dARB);
14278 SET_ProgramEnvParameter4dvARB(table, save_ProgramEnvParameter4dvARB);
14279 SET_ProgramEnvParameter4fARB(table, save_ProgramEnvParameter4fARB);
14280 SET_ProgramEnvParameter4fvARB(table, save_ProgramEnvParameter4fvARB);
14281 SET_ProgramLocalParameter4dARB(table, save_ProgramLocalParameter4dARB);
14282 SET_ProgramLocalParameter4dvARB(table, save_ProgramLocalParameter4dvARB);
14283 SET_ProgramLocalParameter4fARB(table, save_ProgramLocalParameter4fARB);
14284 SET_ProgramLocalParameter4fvARB(table, save_ProgramLocalParameter4fvARB);
14285
14286 SET_BeginQuery(table, save_BeginQueryARB);
14287 SET_EndQuery(table, save_EndQueryARB);
14288 SET_QueryCounter(table, save_QueryCounter);
14289
14290 SET_DrawBuffers(table, save_DrawBuffersARB);
14291
14292 SET_BlitFramebuffer(table, save_BlitFramebufferEXT);
14293
14294 SET_UseProgram(table, save_UseProgram);
14295 SET_Uniform1f(table, save_Uniform1fARB);
14296 SET_Uniform2f(table, save_Uniform2fARB);
14297 SET_Uniform3f(table, save_Uniform3fARB);
14298 SET_Uniform4f(table, save_Uniform4fARB);
14299 SET_Uniform1fv(table, save_Uniform1fvARB);
14300 SET_Uniform2fv(table, save_Uniform2fvARB);
14301 SET_Uniform3fv(table, save_Uniform3fvARB);
14302 SET_Uniform4fv(table, save_Uniform4fvARB);
14303 SET_Uniform1i(table, save_Uniform1iARB);
14304 SET_Uniform2i(table, save_Uniform2iARB);
14305 SET_Uniform3i(table, save_Uniform3iARB);
14306 SET_Uniform4i(table, save_Uniform4iARB);
14307 SET_Uniform1iv(table, save_Uniform1ivARB);
14308 SET_Uniform2iv(table, save_Uniform2ivARB);
14309 SET_Uniform3iv(table, save_Uniform3ivARB);
14310 SET_Uniform4iv(table, save_Uniform4ivARB);
14311 SET_UniformMatrix2fv(table, save_UniformMatrix2fvARB);
14312 SET_UniformMatrix3fv(table, save_UniformMatrix3fvARB);
14313 SET_UniformMatrix4fv(table, save_UniformMatrix4fvARB);
14314 SET_UniformMatrix2x3fv(table, save_UniformMatrix2x3fv);
14315 SET_UniformMatrix3x2fv(table, save_UniformMatrix3x2fv);
14316 SET_UniformMatrix2x4fv(table, save_UniformMatrix2x4fv);
14317 SET_UniformMatrix4x2fv(table, save_UniformMatrix4x2fv);
14318 SET_UniformMatrix3x4fv(table, save_UniformMatrix3x4fv);
14319 SET_UniformMatrix4x3fv(table, save_UniformMatrix4x3fv);
14320
14321 /* 299. GL_EXT_blend_equation_separate */
14322 SET_BlendEquationSeparate(table, save_BlendEquationSeparateEXT);
14323
14324 /* GL_EXT_gpu_program_parameters */
14325 SET_ProgramEnvParameters4fvEXT(table, save_ProgramEnvParameters4fvEXT);
14326 SET_ProgramLocalParameters4fvEXT(table, save_ProgramLocalParameters4fvEXT);
14327
14328 /* 364. GL_EXT_provoking_vertex */
14329 SET_ProvokingVertex(table, save_ProvokingVertexEXT);
14330
14331 /* GL_EXT_texture_integer */
14332 SET_ClearColorIiEXT(table, save_ClearColorIi);
14333 SET_ClearColorIuiEXT(table, save_ClearColorIui);
14334 SET_TexParameterIiv(table, save_TexParameterIiv);
14335 SET_TexParameterIuiv(table, save_TexParameterIuiv);
14336
14337 /* GL_ARB_clip_control */
14338 SET_ClipControl(table, save_ClipControl);
14339
14340 /* GL_ARB_color_buffer_float */
14341 SET_ClampColor(table, save_ClampColorARB);
14342
14343 /* GL 3.0 */
14344 SET_ClearBufferiv(table, save_ClearBufferiv);
14345 SET_ClearBufferuiv(table, save_ClearBufferuiv);
14346 SET_ClearBufferfv(table, save_ClearBufferfv);
14347 SET_ClearBufferfi(table, save_ClearBufferfi);
14348 SET_Uniform1ui(table, save_Uniform1ui);
14349 SET_Uniform2ui(table, save_Uniform2ui);
14350 SET_Uniform3ui(table, save_Uniform3ui);
14351 SET_Uniform4ui(table, save_Uniform4ui);
14352 SET_Uniform1uiv(table, save_Uniform1uiv);
14353 SET_Uniform2uiv(table, save_Uniform2uiv);
14354 SET_Uniform3uiv(table, save_Uniform3uiv);
14355 SET_Uniform4uiv(table, save_Uniform4uiv);
14356
14357 /* GL_ARB_gpu_shader_fp64 */
14358 SET_Uniform1d(table, save_Uniform1d);
14359 SET_Uniform2d(table, save_Uniform2d);
14360 SET_Uniform3d(table, save_Uniform3d);
14361 SET_Uniform4d(table, save_Uniform4d);
14362 SET_Uniform1dv(table, save_Uniform1dv);
14363 SET_Uniform2dv(table, save_Uniform2dv);
14364 SET_Uniform3dv(table, save_Uniform3dv);
14365 SET_Uniform4dv(table, save_Uniform4dv);
14366 SET_UniformMatrix2dv(table, save_UniformMatrix2dv);
14367 SET_UniformMatrix3dv(table, save_UniformMatrix3dv);
14368 SET_UniformMatrix4dv(table, save_UniformMatrix4dv);
14369 SET_UniformMatrix2x3dv(table, save_UniformMatrix2x3dv);
14370 SET_UniformMatrix3x2dv(table, save_UniformMatrix3x2dv);
14371 SET_UniformMatrix2x4dv(table, save_UniformMatrix2x4dv);
14372 SET_UniformMatrix4x2dv(table, save_UniformMatrix4x2dv);
14373 SET_UniformMatrix3x4dv(table, save_UniformMatrix3x4dv);
14374 SET_UniformMatrix4x3dv(table, save_UniformMatrix4x3dv);
14375
14376 /* GL_ARB_gpu_shader_int64 */
14377 SET_Uniform1i64ARB(table, save_Uniform1i64ARB);
14378 SET_Uniform2i64ARB(table, save_Uniform2i64ARB);
14379 SET_Uniform3i64ARB(table, save_Uniform3i64ARB);
14380 SET_Uniform4i64ARB(table, save_Uniform4i64ARB);
14381 SET_Uniform1i64vARB(table, save_Uniform1i64vARB);
14382 SET_Uniform2i64vARB(table, save_Uniform2i64vARB);
14383 SET_Uniform3i64vARB(table, save_Uniform3i64vARB);
14384 SET_Uniform4i64vARB(table, save_Uniform4i64vARB);
14385 SET_Uniform1ui64ARB(table, save_Uniform1ui64ARB);
14386 SET_Uniform2ui64ARB(table, save_Uniform2ui64ARB);
14387 SET_Uniform3ui64ARB(table, save_Uniform3ui64ARB);
14388 SET_Uniform4ui64ARB(table, save_Uniform4ui64ARB);
14389 SET_Uniform1ui64vARB(table, save_Uniform1ui64vARB);
14390 SET_Uniform2ui64vARB(table, save_Uniform2ui64vARB);
14391 SET_Uniform3ui64vARB(table, save_Uniform3ui64vARB);
14392 SET_Uniform4ui64vARB(table, save_Uniform4ui64vARB);
14393
14394 SET_ProgramUniform1i64ARB(table, save_ProgramUniform1i64ARB);
14395 SET_ProgramUniform2i64ARB(table, save_ProgramUniform2i64ARB);
14396 SET_ProgramUniform3i64ARB(table, save_ProgramUniform3i64ARB);
14397 SET_ProgramUniform4i64ARB(table, save_ProgramUniform4i64ARB);
14398 SET_ProgramUniform1i64vARB(table, save_ProgramUniform1i64vARB);
14399 SET_ProgramUniform2i64vARB(table, save_ProgramUniform2i64vARB);
14400 SET_ProgramUniform3i64vARB(table, save_ProgramUniform3i64vARB);
14401 SET_ProgramUniform4i64vARB(table, save_ProgramUniform4i64vARB);
14402 SET_ProgramUniform1ui64ARB(table, save_ProgramUniform1ui64ARB);
14403 SET_ProgramUniform2ui64ARB(table, save_ProgramUniform2ui64ARB);
14404 SET_ProgramUniform3ui64ARB(table, save_ProgramUniform3ui64ARB);
14405 SET_ProgramUniform4ui64ARB(table, save_ProgramUniform4ui64ARB);
14406 SET_ProgramUniform1ui64vARB(table, save_ProgramUniform1ui64vARB);
14407 SET_ProgramUniform2ui64vARB(table, save_ProgramUniform2ui64vARB);
14408 SET_ProgramUniform3ui64vARB(table, save_ProgramUniform3ui64vARB);
14409 SET_ProgramUniform4ui64vARB(table, save_ProgramUniform4ui64vARB);
14410
14411 /* These are: */
14412 SET_BeginTransformFeedback(table, save_BeginTransformFeedback);
14413 SET_EndTransformFeedback(table, save_EndTransformFeedback);
14414 SET_BindTransformFeedback(table, save_BindTransformFeedback);
14415 SET_PauseTransformFeedback(table, save_PauseTransformFeedback);
14416 SET_ResumeTransformFeedback(table, save_ResumeTransformFeedback);
14417 SET_DrawTransformFeedback(table, save_DrawTransformFeedback);
14418 SET_DrawTransformFeedbackStream(table, save_DrawTransformFeedbackStream);
14419 SET_DrawTransformFeedbackInstanced(table,
14420 save_DrawTransformFeedbackInstanced);
14421 SET_DrawTransformFeedbackStreamInstanced(table,
14422 save_DrawTransformFeedbackStreamInstanced);
14423 SET_BeginQueryIndexed(table, save_BeginQueryIndexed);
14424 SET_EndQueryIndexed(table, save_EndQueryIndexed);
14425
14426 /* GL_ARB_instanced_arrays */
14427 SET_VertexAttribDivisor(table, save_VertexAttribDivisor);
14428
14429 /* GL_NV_texture_barrier */
14430 SET_TextureBarrierNV(table, save_TextureBarrierNV);
14431
14432 SET_BindSampler(table, save_BindSampler);
14433 SET_SamplerParameteri(table, save_SamplerParameteri);
14434 SET_SamplerParameterf(table, save_SamplerParameterf);
14435 SET_SamplerParameteriv(table, save_SamplerParameteriv);
14436 SET_SamplerParameterfv(table, save_SamplerParameterfv);
14437 SET_SamplerParameterIiv(table, save_SamplerParameterIiv);
14438 SET_SamplerParameterIuiv(table, save_SamplerParameterIuiv);
14439
14440 /* GL_ARB_draw_buffer_blend */
14441 SET_BlendFunciARB(table, save_BlendFunci);
14442 SET_BlendFuncSeparateiARB(table, save_BlendFuncSeparatei);
14443 SET_BlendEquationiARB(table, save_BlendEquationi);
14444 SET_BlendEquationSeparateiARB(table, save_BlendEquationSeparatei);
14445
14446 /* GL_NV_conditional_render */
14447 SET_BeginConditionalRender(table, save_BeginConditionalRender);
14448 SET_EndConditionalRender(table, save_EndConditionalRender);
14449
14450 /* GL_ARB_sync */
14451 SET_WaitSync(table, save_WaitSync);
14452
14453 /* GL_ARB_uniform_buffer_object */
14454 SET_UniformBlockBinding(table, save_UniformBlockBinding);
14455
14456 /* GL_ARB_shader_subroutines */
14457 SET_UniformSubroutinesuiv(table, save_UniformSubroutinesuiv);
14458
14459 /* GL_ARB_draw_instanced */
14460 SET_DrawArraysInstancedARB(table, save_DrawArraysInstancedARB);
14461 SET_DrawElementsInstancedARB(table, save_DrawElementsInstancedARB);
14462
14463 /* GL_ARB_draw_elements_base_vertex */
14464 SET_DrawElementsInstancedBaseVertex(table, save_DrawElementsInstancedBaseVertexARB);
14465
14466 /* GL_ARB_base_instance */
14467 SET_DrawArraysInstancedBaseInstance(table, save_DrawArraysInstancedBaseInstance);
14468 SET_DrawElementsInstancedBaseInstance(table, save_DrawElementsInstancedBaseInstance);
14469 SET_DrawElementsInstancedBaseVertexBaseInstance(table, save_DrawElementsInstancedBaseVertexBaseInstance);
14470
14471 /* GL_ARB_draw_indirect / GL_ARB_multi_draw_indirect */
14472 SET_DrawArraysIndirect(table, save_DrawArraysIndirect);
14473 SET_DrawElementsIndirect(table, save_DrawElementsIndirect);
14474 SET_MultiDrawArraysIndirect(table, save_MultiDrawArraysIndirect);
14475 SET_MultiDrawElementsIndirect(table, save_MultiDrawElementsIndirect);
14476
14477 /* OpenGL 4.2 / GL_ARB_separate_shader_objects */
14478 SET_UseProgramStages(table, save_UseProgramStages);
14479 SET_ProgramUniform1f(table, save_ProgramUniform1f);
14480 SET_ProgramUniform2f(table, save_ProgramUniform2f);
14481 SET_ProgramUniform3f(table, save_ProgramUniform3f);
14482 SET_ProgramUniform4f(table, save_ProgramUniform4f);
14483 SET_ProgramUniform1fv(table, save_ProgramUniform1fv);
14484 SET_ProgramUniform2fv(table, save_ProgramUniform2fv);
14485 SET_ProgramUniform3fv(table, save_ProgramUniform3fv);
14486 SET_ProgramUniform4fv(table, save_ProgramUniform4fv);
14487 SET_ProgramUniform1d(table, save_ProgramUniform1d);
14488 SET_ProgramUniform2d(table, save_ProgramUniform2d);
14489 SET_ProgramUniform3d(table, save_ProgramUniform3d);
14490 SET_ProgramUniform4d(table, save_ProgramUniform4d);
14491 SET_ProgramUniform1dv(table, save_ProgramUniform1dv);
14492 SET_ProgramUniform2dv(table, save_ProgramUniform2dv);
14493 SET_ProgramUniform3dv(table, save_ProgramUniform3dv);
14494 SET_ProgramUniform4dv(table, save_ProgramUniform4dv);
14495 SET_ProgramUniform1i(table, save_ProgramUniform1i);
14496 SET_ProgramUniform2i(table, save_ProgramUniform2i);
14497 SET_ProgramUniform3i(table, save_ProgramUniform3i);
14498 SET_ProgramUniform4i(table, save_ProgramUniform4i);
14499 SET_ProgramUniform1iv(table, save_ProgramUniform1iv);
14500 SET_ProgramUniform2iv(table, save_ProgramUniform2iv);
14501 SET_ProgramUniform3iv(table, save_ProgramUniform3iv);
14502 SET_ProgramUniform4iv(table, save_ProgramUniform4iv);
14503 SET_ProgramUniform1ui(table, save_ProgramUniform1ui);
14504 SET_ProgramUniform2ui(table, save_ProgramUniform2ui);
14505 SET_ProgramUniform3ui(table, save_ProgramUniform3ui);
14506 SET_ProgramUniform4ui(table, save_ProgramUniform4ui);
14507 SET_ProgramUniform1uiv(table, save_ProgramUniform1uiv);
14508 SET_ProgramUniform2uiv(table, save_ProgramUniform2uiv);
14509 SET_ProgramUniform3uiv(table, save_ProgramUniform3uiv);
14510 SET_ProgramUniform4uiv(table, save_ProgramUniform4uiv);
14511 SET_ProgramUniformMatrix2fv(table, save_ProgramUniformMatrix2fv);
14512 SET_ProgramUniformMatrix3fv(table, save_ProgramUniformMatrix3fv);
14513 SET_ProgramUniformMatrix4fv(table, save_ProgramUniformMatrix4fv);
14514 SET_ProgramUniformMatrix2x3fv(table, save_ProgramUniformMatrix2x3fv);
14515 SET_ProgramUniformMatrix3x2fv(table, save_ProgramUniformMatrix3x2fv);
14516 SET_ProgramUniformMatrix2x4fv(table, save_ProgramUniformMatrix2x4fv);
14517 SET_ProgramUniformMatrix4x2fv(table, save_ProgramUniformMatrix4x2fv);
14518 SET_ProgramUniformMatrix3x4fv(table, save_ProgramUniformMatrix3x4fv);
14519 SET_ProgramUniformMatrix4x3fv(table, save_ProgramUniformMatrix4x3fv);
14520 SET_ProgramUniformMatrix2dv(table, save_ProgramUniformMatrix2dv);
14521 SET_ProgramUniformMatrix3dv(table, save_ProgramUniformMatrix3dv);
14522 SET_ProgramUniformMatrix4dv(table, save_ProgramUniformMatrix4dv);
14523 SET_ProgramUniformMatrix2x3dv(table, save_ProgramUniformMatrix2x3dv);
14524 SET_ProgramUniformMatrix3x2dv(table, save_ProgramUniformMatrix3x2dv);
14525 SET_ProgramUniformMatrix2x4dv(table, save_ProgramUniformMatrix2x4dv);
14526 SET_ProgramUniformMatrix4x2dv(table, save_ProgramUniformMatrix4x2dv);
14527 SET_ProgramUniformMatrix3x4dv(table, save_ProgramUniformMatrix3x4dv);
14528 SET_ProgramUniformMatrix4x3dv(table, save_ProgramUniformMatrix4x3dv);
14529
14530 /* GL_{ARB,EXT}_polygon_offset_clamp */
14531 SET_PolygonOffsetClampEXT(table, save_PolygonOffsetClampEXT);
14532
14533 /* GL_EXT_window_rectangles */
14534 SET_WindowRectanglesEXT(table, save_WindowRectanglesEXT);
14535
14536 /* GL_NV_conservative_raster */
14537 SET_SubpixelPrecisionBiasNV(table, save_SubpixelPrecisionBiasNV);
14538
14539 /* GL_NV_conservative_raster_dilate */
14540 SET_ConservativeRasterParameterfNV(table, save_ConservativeRasterParameterfNV);
14541
14542 /* GL_NV_conservative_raster_pre_snap_triangles */
14543 SET_ConservativeRasterParameteriNV(table, save_ConservativeRasterParameteriNV);
14544
14545 /* GL_EXT_direct_state_access */
14546 SET_MatrixLoadfEXT(table, save_MatrixLoadfEXT);
14547 SET_MatrixLoaddEXT(table, save_MatrixLoaddEXT);
14548 SET_MatrixMultfEXT(table, save_MatrixMultfEXT);
14549 SET_MatrixMultdEXT(table, save_MatrixMultdEXT);
14550 SET_MatrixRotatefEXT(table, save_MatrixRotatefEXT);
14551 SET_MatrixRotatedEXT(table, save_MatrixRotatedEXT);
14552 SET_MatrixScalefEXT(table, save_MatrixScalefEXT);
14553 SET_MatrixScaledEXT(table, save_MatrixScaledEXT);
14554 SET_MatrixTranslatefEXT(table, save_MatrixTranslatefEXT);
14555 SET_MatrixTranslatedEXT(table, save_MatrixTranslatedEXT);
14556 SET_MatrixLoadIdentityEXT(table, save_MatrixLoadIdentityEXT);
14557 SET_MatrixOrthoEXT(table, save_MatrixOrthoEXT);
14558 SET_MatrixFrustumEXT(table, save_MatrixFrustumEXT);
14559 SET_MatrixPushEXT(table, save_MatrixPushEXT);
14560 SET_MatrixPopEXT(table, save_MatrixPopEXT);
14561 SET_MatrixLoadTransposefEXT(table, save_MatrixLoadTransposefEXT);
14562 SET_MatrixLoadTransposedEXT(table, save_MatrixLoadTransposedEXT);
14563 SET_MatrixMultTransposefEXT(table, save_MatrixMultTransposefEXT);
14564 SET_MatrixMultTransposedEXT(table, save_MatrixMultTransposedEXT);
14565 SET_TextureParameteriEXT(table, save_TextureParameteriEXT);
14566 SET_TextureParameterivEXT(table, save_TextureParameterivEXT);
14567 SET_TextureParameterfEXT(table, save_TextureParameterfEXT);
14568 SET_TextureParameterfvEXT(table, save_TextureParameterfvEXT);
14569 SET_TextureParameterIivEXT(table, save_TextureParameterIivEXT);
14570 SET_TextureParameterIuivEXT(table, save_TextureParameterIuivEXT);
14571 SET_TextureImage1DEXT(table, save_TextureImage1DEXT);
14572 SET_TextureImage2DEXT(table, save_TextureImage2DEXT);
14573 SET_TextureImage3DEXT(table, save_TextureImage3DEXT);
14574 SET_TextureSubImage1DEXT(table, save_TextureSubImage1DEXT);
14575 SET_TextureSubImage2DEXT(table, save_TextureSubImage2DEXT);
14576 SET_TextureSubImage3DEXT(table, save_TextureSubImage3DEXT);
14577 SET_CopyTextureImage1DEXT(table, save_CopyTextureImage1DEXT);
14578 SET_CopyTextureImage2DEXT(table, save_CopyTextureImage2DEXT);
14579 SET_CopyTextureSubImage1DEXT(table, save_CopyTextureSubImage1DEXT);
14580 SET_CopyTextureSubImage2DEXT(table, save_CopyTextureSubImage2DEXT);
14581 SET_CopyTextureSubImage3DEXT(table, save_CopyTextureSubImage3DEXT);
14582 SET_BindMultiTextureEXT(table, save_BindMultiTextureEXT);
14583 SET_MultiTexParameteriEXT(table, save_MultiTexParameteriEXT);
14584 SET_MultiTexParameterivEXT(table, save_MultiTexParameterivEXT);
14585 SET_MultiTexParameterIivEXT(table, save_MultiTexParameterIivEXT);
14586 SET_MultiTexParameterIuivEXT(table, save_MultiTexParameterIuivEXT);
14587 SET_MultiTexParameterfEXT(table, save_MultiTexParameterfEXT);
14588 SET_MultiTexParameterfvEXT(table, save_MultiTexParameterfvEXT);
14589 SET_MultiTexImage1DEXT(table, save_MultiTexImage1DEXT);
14590 SET_MultiTexImage2DEXT(table, save_MultiTexImage2DEXT);
14591 SET_MultiTexImage3DEXT(table, save_MultiTexImage3DEXT);
14592 SET_MultiTexSubImage1DEXT(table, save_MultiTexSubImage1DEXT);
14593 SET_MultiTexSubImage2DEXT(table, save_MultiTexSubImage2DEXT);
14594 SET_MultiTexSubImage3DEXT(table, save_MultiTexSubImage3DEXT);
14595 SET_CopyMultiTexImage1DEXT(table, save_CopyMultiTexImage1DEXT);
14596 SET_CopyMultiTexImage2DEXT(table, save_CopyMultiTexImage2DEXT);
14597 SET_CopyMultiTexSubImage1DEXT(table, save_CopyMultiTexSubImage1DEXT);
14598 SET_CopyMultiTexSubImage2DEXT(table, save_CopyMultiTexSubImage2DEXT);
14599 SET_CopyMultiTexSubImage3DEXT(table, save_CopyMultiTexSubImage3DEXT);
14600 SET_MultiTexEnvfEXT(table, save_MultiTexEnvfEXT);
14601 SET_MultiTexEnvfvEXT(table, save_MultiTexEnvfvEXT);
14602 SET_MultiTexEnviEXT(table, save_MultiTexEnviEXT);
14603 SET_MultiTexEnvivEXT(table, save_MultiTexEnvivEXT);
14604 SET_CompressedTextureImage1DEXT(table, save_CompressedTextureImage1DEXT);
14605 SET_CompressedTextureImage2DEXT(table, save_CompressedTextureImage2DEXT);
14606 SET_CompressedTextureImage3DEXT(table, save_CompressedTextureImage3DEXT);
14607 SET_CompressedTextureSubImage1DEXT(table, save_CompressedTextureSubImage1DEXT);
14608 SET_CompressedTextureSubImage2DEXT(table, save_CompressedTextureSubImage2DEXT);
14609 SET_CompressedTextureSubImage3DEXT(table, save_CompressedTextureSubImage3DEXT);
14610 SET_CompressedMultiTexImage1DEXT(table, save_CompressedMultiTexImage1DEXT);
14611 SET_CompressedMultiTexImage2DEXT(table, save_CompressedMultiTexImage2DEXT);
14612 SET_CompressedMultiTexImage3DEXT(table, save_CompressedMultiTexImage3DEXT);
14613 SET_CompressedMultiTexSubImage1DEXT(table, save_CompressedMultiTexSubImage1DEXT);
14614 SET_CompressedMultiTexSubImage2DEXT(table, save_CompressedMultiTexSubImage2DEXT);
14615 SET_CompressedMultiTexSubImage3DEXT(table, save_CompressedMultiTexSubImage3DEXT);
14616 SET_NamedProgramStringEXT(table, save_NamedProgramStringEXT);
14617 SET_NamedProgramLocalParameter4dEXT(table, save_NamedProgramLocalParameter4dEXT);
14618 SET_NamedProgramLocalParameter4dvEXT(table, save_NamedProgramLocalParameter4dvEXT);
14619 SET_NamedProgramLocalParameter4fEXT(table, save_NamedProgramLocalParameter4fEXT);
14620 SET_NamedProgramLocalParameter4fvEXT(table, save_NamedProgramLocalParameter4fvEXT);
14621 }
14622
14623
14624
14625 static const char *
14626 enum_string(GLenum k)
14627 {
14628 return _mesa_enum_to_string(k);
14629 }
14630
14631
14632 /**
14633 * Print the commands in a display list. For debugging only.
14634 * TODO: many commands aren't handled yet.
14635 * \param fname filename to write display list to. If null, use stdout.
14636 */
14637 static void GLAPIENTRY
14638 print_list(struct gl_context *ctx, GLuint list, const char *fname)
14639 {
14640 struct gl_display_list *dlist;
14641 Node *n;
14642 GLboolean done;
14643 FILE *f = stdout;
14644
14645 if (fname) {
14646 f = fopen(fname, "w");
14647 if (!f)
14648 return;
14649 }
14650
14651 if (!islist(ctx, list)) {
14652 fprintf(f, "%u is not a display list ID\n", list);
14653 goto out;
14654 }
14655
14656 dlist = _mesa_lookup_list(ctx, list);
14657 if (!dlist) {
14658 goto out;
14659 }
14660
14661 n = dlist->Head;
14662
14663 fprintf(f, "START-LIST %u, address %p\n", list, (void *) n);
14664
14665 done = n ? GL_FALSE : GL_TRUE;
14666 while (!done) {
14667 const OpCode opcode = n[0].opcode;
14668
14669 if (is_ext_opcode(opcode)) {
14670 n += ext_opcode_print(ctx, n, f);
14671 }
14672 else {
14673 switch (opcode) {
14674 case OPCODE_ACCUM:
14675 fprintf(f, "Accum %s %g\n", enum_string(n[1].e), n[2].f);
14676 break;
14677 case OPCODE_ACTIVE_TEXTURE:
14678 fprintf(f, "ActiveTexture(%s)\n", enum_string(n[1].e));
14679 break;
14680 case OPCODE_BITMAP:
14681 fprintf(f, "Bitmap %d %d %g %g %g %g %p\n", n[1].i, n[2].i,
14682 n[3].f, n[4].f, n[5].f, n[6].f,
14683 get_pointer(&n[7]));
14684 break;
14685 case OPCODE_BLEND_COLOR:
14686 fprintf(f, "BlendColor %f, %f, %f, %f\n",
14687 n[1].f, n[2].f, n[3].f, n[4].f);
14688 break;
14689 case OPCODE_BLEND_EQUATION:
14690 fprintf(f, "BlendEquation %s\n",
14691 enum_string(n[1].e));
14692 break;
14693 case OPCODE_BLEND_EQUATION_SEPARATE:
14694 fprintf(f, "BlendEquationSeparate %s, %s\n",
14695 enum_string(n[1].e),
14696 enum_string(n[2].e));
14697 break;
14698 case OPCODE_BLEND_FUNC_SEPARATE:
14699 fprintf(f, "BlendFuncSeparate %s, %s, %s, %s\n",
14700 enum_string(n[1].e),
14701 enum_string(n[2].e),
14702 enum_string(n[3].e),
14703 enum_string(n[4].e));
14704 break;
14705 case OPCODE_BLEND_EQUATION_I:
14706 fprintf(f, "BlendEquationi %u, %s\n",
14707 n[1].ui, enum_string(n[2].e));
14708 break;
14709 case OPCODE_BLEND_EQUATION_SEPARATE_I:
14710 fprintf(f, "BlendEquationSeparatei %u, %s, %s\n",
14711 n[1].ui, enum_string(n[2].e), enum_string(n[3].e));
14712 break;
14713 case OPCODE_BLEND_FUNC_I:
14714 fprintf(f, "BlendFunci %u, %s, %s\n",
14715 n[1].ui, enum_string(n[2].e), enum_string(n[3].e));
14716 break;
14717 case OPCODE_BLEND_FUNC_SEPARATE_I:
14718 fprintf(f, "BlendFuncSeparatei %u, %s, %s, %s, %s\n",
14719 n[1].ui,
14720 enum_string(n[2].e),
14721 enum_string(n[3].e),
14722 enum_string(n[4].e),
14723 enum_string(n[5].e));
14724 break;
14725 case OPCODE_CALL_LIST:
14726 fprintf(f, "CallList %d\n", (int) n[1].ui);
14727 break;
14728 case OPCODE_CALL_LISTS:
14729 fprintf(f, "CallLists %d, %s\n", n[1].i, enum_string(n[1].e));
14730 break;
14731 case OPCODE_DISABLE:
14732 fprintf(f, "Disable %s\n", enum_string(n[1].e));
14733 break;
14734 case OPCODE_ENABLE:
14735 fprintf(f, "Enable %s\n", enum_string(n[1].e));
14736 break;
14737 case OPCODE_FRUSTUM:
14738 fprintf(f, "Frustum %g %g %g %g %g %g\n",
14739 n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f);
14740 break;
14741 case OPCODE_LINE_STIPPLE:
14742 fprintf(f, "LineStipple %d %x\n", n[1].i, (int) n[2].us);
14743 break;
14744 case OPCODE_LINE_WIDTH:
14745 fprintf(f, "LineWidth %f\n", n[1].f);
14746 break;
14747 case OPCODE_LOAD_IDENTITY:
14748 fprintf(f, "LoadIdentity\n");
14749 break;
14750 case OPCODE_LOAD_MATRIX:
14751 fprintf(f, "LoadMatrix\n");
14752 fprintf(f, " %8f %8f %8f %8f\n",
14753 n[1].f, n[5].f, n[9].f, n[13].f);
14754 fprintf(f, " %8f %8f %8f %8f\n",
14755 n[2].f, n[6].f, n[10].f, n[14].f);
14756 fprintf(f, " %8f %8f %8f %8f\n",
14757 n[3].f, n[7].f, n[11].f, n[15].f);
14758 fprintf(f, " %8f %8f %8f %8f\n",
14759 n[4].f, n[8].f, n[12].f, n[16].f);
14760 break;
14761 case OPCODE_MULT_MATRIX:
14762 fprintf(f, "MultMatrix (or Rotate)\n");
14763 fprintf(f, " %8f %8f %8f %8f\n",
14764 n[1].f, n[5].f, n[9].f, n[13].f);
14765 fprintf(f, " %8f %8f %8f %8f\n",
14766 n[2].f, n[6].f, n[10].f, n[14].f);
14767 fprintf(f, " %8f %8f %8f %8f\n",
14768 n[3].f, n[7].f, n[11].f, n[15].f);
14769 fprintf(f, " %8f %8f %8f %8f\n",
14770 n[4].f, n[8].f, n[12].f, n[16].f);
14771 break;
14772 case OPCODE_ORTHO:
14773 fprintf(f, "Ortho %g %g %g %g %g %g\n",
14774 n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f);
14775 break;
14776 case OPCODE_POINT_SIZE:
14777 fprintf(f, "PointSize %f\n", n[1].f);
14778 break;
14779 case OPCODE_POP_ATTRIB:
14780 fprintf(f, "PopAttrib\n");
14781 break;
14782 case OPCODE_POP_MATRIX:
14783 fprintf(f, "PopMatrix\n");
14784 break;
14785 case OPCODE_POP_NAME:
14786 fprintf(f, "PopName\n");
14787 break;
14788 case OPCODE_PUSH_ATTRIB:
14789 fprintf(f, "PushAttrib %x\n", n[1].bf);
14790 break;
14791 case OPCODE_PUSH_MATRIX:
14792 fprintf(f, "PushMatrix\n");
14793 break;
14794 case OPCODE_PUSH_NAME:
14795 fprintf(f, "PushName %d\n", (int) n[1].ui);
14796 break;
14797 case OPCODE_RASTER_POS:
14798 fprintf(f, "RasterPos %g %g %g %g\n",
14799 n[1].f, n[2].f, n[3].f, n[4].f);
14800 break;
14801 case OPCODE_ROTATE:
14802 fprintf(f, "Rotate %g %g %g %g\n",
14803 n[1].f, n[2].f, n[3].f, n[4].f);
14804 break;
14805 case OPCODE_SCALE:
14806 fprintf(f, "Scale %g %g %g\n", n[1].f, n[2].f, n[3].f);
14807 break;
14808 case OPCODE_TRANSLATE:
14809 fprintf(f, "Translate %g %g %g\n", n[1].f, n[2].f, n[3].f);
14810 break;
14811 case OPCODE_BIND_TEXTURE:
14812 fprintf(f, "BindTexture %s %d\n",
14813 _mesa_enum_to_string(n[1].ui), n[2].ui);
14814 break;
14815 case OPCODE_SHADE_MODEL:
14816 fprintf(f, "ShadeModel %s\n", _mesa_enum_to_string(n[1].ui));
14817 break;
14818 case OPCODE_MAP1:
14819 fprintf(f, "Map1 %s %.3f %.3f %d %d\n",
14820 _mesa_enum_to_string(n[1].ui),
14821 n[2].f, n[3].f, n[4].i, n[5].i);
14822 break;
14823 case OPCODE_MAP2:
14824 fprintf(f, "Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
14825 _mesa_enum_to_string(n[1].ui),
14826 n[2].f, n[3].f, n[4].f, n[5].f,
14827 n[6].i, n[7].i, n[8].i, n[9].i);
14828 break;
14829 case OPCODE_MAPGRID1:
14830 fprintf(f, "MapGrid1 %d %.3f %.3f\n", n[1].i, n[2].f, n[3].f);
14831 break;
14832 case OPCODE_MAPGRID2:
14833 fprintf(f, "MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
14834 n[1].i, n[2].f, n[3].f, n[4].i, n[5].f, n[6].f);
14835 break;
14836 case OPCODE_EVALMESH1:
14837 fprintf(f, "EvalMesh1 %d %d\n", n[1].i, n[2].i);
14838 break;
14839 case OPCODE_EVALMESH2:
14840 fprintf(f, "EvalMesh2 %d %d %d %d\n",
14841 n[1].i, n[2].i, n[3].i, n[4].i);
14842 break;
14843
14844 case OPCODE_ATTR_1F_NV:
14845 fprintf(f, "ATTR_1F_NV attr %d: %f\n", n[1].i, n[2].f);
14846 break;
14847 case OPCODE_ATTR_2F_NV:
14848 fprintf(f, "ATTR_2F_NV attr %d: %f %f\n",
14849 n[1].i, n[2].f, n[3].f);
14850 break;
14851 case OPCODE_ATTR_3F_NV:
14852 fprintf(f, "ATTR_3F_NV attr %d: %f %f %f\n",
14853 n[1].i, n[2].f, n[3].f, n[4].f);
14854 break;
14855 case OPCODE_ATTR_4F_NV:
14856 fprintf(f, "ATTR_4F_NV attr %d: %f %f %f %f\n",
14857 n[1].i, n[2].f, n[3].f, n[4].f, n[5].f);
14858 break;
14859 case OPCODE_ATTR_1F_ARB:
14860 fprintf(f, "ATTR_1F_ARB attr %d: %f\n", n[1].i, n[2].f);
14861 break;
14862 case OPCODE_ATTR_2F_ARB:
14863 fprintf(f, "ATTR_2F_ARB attr %d: %f %f\n",
14864 n[1].i, n[2].f, n[3].f);
14865 break;
14866 case OPCODE_ATTR_3F_ARB:
14867 fprintf(f, "ATTR_3F_ARB attr %d: %f %f %f\n",
14868 n[1].i, n[2].f, n[3].f, n[4].f);
14869 break;
14870 case OPCODE_ATTR_4F_ARB:
14871 fprintf(f, "ATTR_4F_ARB attr %d: %f %f %f %f\n",
14872 n[1].i, n[2].f, n[3].f, n[4].f, n[5].f);
14873 break;
14874
14875 case OPCODE_MATERIAL:
14876 fprintf(f, "MATERIAL %x %x: %f %f %f %f\n",
14877 n[1].i, n[2].i, n[3].f, n[4].f, n[5].f, n[6].f);
14878 break;
14879 case OPCODE_BEGIN:
14880 fprintf(f, "BEGIN %x\n", n[1].i);
14881 break;
14882 case OPCODE_END:
14883 fprintf(f, "END\n");
14884 break;
14885 case OPCODE_RECTF:
14886 fprintf(f, "RECTF %f %f %f %f\n", n[1].f, n[2].f, n[3].f,
14887 n[4].f);
14888 break;
14889 case OPCODE_EVAL_C1:
14890 fprintf(f, "EVAL_C1 %f\n", n[1].f);
14891 break;
14892 case OPCODE_EVAL_C2:
14893 fprintf(f, "EVAL_C2 %f %f\n", n[1].f, n[2].f);
14894 break;
14895 case OPCODE_EVAL_P1:
14896 fprintf(f, "EVAL_P1 %d\n", n[1].i);
14897 break;
14898 case OPCODE_EVAL_P2:
14899 fprintf(f, "EVAL_P2 %d %d\n", n[1].i, n[2].i);
14900 break;
14901
14902 case OPCODE_PROVOKING_VERTEX:
14903 fprintf(f, "ProvokingVertex %s\n",
14904 _mesa_enum_to_string(n[1].ui));
14905 break;
14906
14907 /*
14908 * meta opcodes/commands
14909 */
14910 case OPCODE_ERROR:
14911 fprintf(f, "Error: %s %s\n", enum_string(n[1].e),
14912 (const char *) get_pointer(&n[2]));
14913 break;
14914 case OPCODE_CONTINUE:
14915 fprintf(f, "DISPLAY-LIST-CONTINUE\n");
14916 n = (Node *) get_pointer(&n[1]);
14917 break;
14918 case OPCODE_NOP:
14919 fprintf(f, "NOP\n");
14920 break;
14921 case OPCODE_END_OF_LIST:
14922 fprintf(f, "END-LIST %u\n", list);
14923 done = GL_TRUE;
14924 break;
14925 default:
14926 if (opcode < 0 || opcode > OPCODE_END_OF_LIST) {
14927 printf
14928 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
14929 opcode, (void *) n);
14930 goto out;
14931 }
14932 else {
14933 fprintf(f, "command %d, %u operands\n", opcode,
14934 InstSize[opcode]);
14935 }
14936 }
14937 /* increment n to point to next compiled command */
14938 if (opcode != OPCODE_CONTINUE) {
14939 assert(InstSize[opcode] > 0);
14940 n += InstSize[opcode];
14941 }
14942 }
14943 }
14944
14945 out:
14946 fflush(f);
14947 if (fname)
14948 fclose(f);
14949 }
14950
14951
14952
14953 /**
14954 * Clients may call this function to help debug display list problems.
14955 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
14956 * changed, or break in the future without notice.
14957 */
14958 void
14959 mesa_print_display_list(GLuint list)
14960 {
14961 GET_CURRENT_CONTEXT(ctx);
14962 print_list(ctx, list, NULL);
14963 }
14964
14965
14966 /**********************************************************************/
14967 /***** Initialization *****/
14968 /**********************************************************************/
14969
14970 void
14971 _mesa_install_dlist_vtxfmt(struct _glapi_table *disp,
14972 const GLvertexformat *vfmt)
14973 {
14974 SET_CallList(disp, vfmt->CallList);
14975 SET_CallLists(disp, vfmt->CallLists);
14976 }
14977
14978
14979 /**
14980 * Initialize display list state for given context.
14981 */
14982 void
14983 _mesa_init_display_list(struct gl_context *ctx)
14984 {
14985 static GLboolean tableInitialized = GL_FALSE;
14986 GLvertexformat *vfmt = &ctx->ListState.ListVtxfmt;
14987
14988 /* zero-out the instruction size table, just once */
14989 if (!tableInitialized) {
14990 memset(InstSize, 0, sizeof(InstSize));
14991 tableInitialized = GL_TRUE;
14992 }
14993
14994 /* extension info */
14995 ctx->ListExt = CALLOC_STRUCT(gl_list_extensions);
14996
14997 /* Display list */
14998 ctx->ListState.CallDepth = 0;
14999 ctx->ExecuteFlag = GL_TRUE;
15000 ctx->CompileFlag = GL_FALSE;
15001 ctx->ListState.CurrentBlock = NULL;
15002 ctx->ListState.CurrentPos = 0;
15003
15004 /* Display List group */
15005 ctx->List.ListBase = 0;
15006
15007 InstSize[OPCODE_NOP] = 1;
15008
15009 #define NAME_AE(x) _ae_##x
15010 #define NAME_CALLLIST(x) save_##x
15011 #define NAME(x) save_##x
15012 #define NAME_ES(x) save_##x##ARB
15013
15014 #include "vbo/vbo_init_tmp.h"
15015 }
15016
15017
15018 void
15019 _mesa_free_display_list_data(struct gl_context *ctx)
15020 {
15021 free(ctx->ListExt);
15022 ctx->ListExt = NULL;
15023 }