mesa: add ARB_texture_buffer_range glTextureBufferRangeEXT function
[mesa.git] / src / mesa / main / dlist.c
1 /*
2 * Mesa 3-D graphics library
3 *
4 * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
5 * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 * OTHER DEALINGS IN THE SOFTWARE.
24 */
25
26
27 /**
28 * \file dlist.c
29 * Display lists management functions.
30 */
31
32 #include "c99_math.h"
33 #include "glheader.h"
34 #include "imports.h"
35 #include "api_arrayelt.h"
36 #include "api_exec.h"
37 #include "api_loopback.h"
38 #include "draw_validate.h"
39 #include "atifragshader.h"
40 #include "config.h"
41 #include "bufferobj.h"
42 #include "arrayobj.h"
43 #include "context.h"
44 #include "dlist.h"
45 #include "enums.h"
46 #include "eval.h"
47 #include "fbobject.h"
48 #include "framebuffer.h"
49 #include "glapi/glapi.h"
50 #include "glformats.h"
51 #include "hash.h"
52 #include "image.h"
53 #include "light.h"
54 #include "macros.h"
55 #include "pack.h"
56 #include "pbo.h"
57 #include "queryobj.h"
58 #include "samplerobj.h"
59 #include "shaderapi.h"
60 #include "syncobj.h"
61 #include "teximage.h"
62 #include "texstorage.h"
63 #include "mtypes.h"
64 #include "varray.h"
65 #include "arbprogram.h"
66 #include "transformfeedback.h"
67
68 #include "math/m_matrix.h"
69
70 #include "main/dispatch.h"
71
72 #include "vbo/vbo.h"
73
74
75 #define USE_BITMAP_ATLAS 1
76
77
78
79 /**
80 * Other parts of Mesa (such as the VBO module) can plug into the display
81 * list system. This structure describes new display list instructions.
82 */
83 struct gl_list_instruction
84 {
85 GLuint Size;
86 void (*Execute)( struct gl_context *ctx, void *data );
87 void (*Destroy)( struct gl_context *ctx, void *data );
88 void (*Print)( struct gl_context *ctx, void *data, FILE *f );
89 };
90
91
92 #define MAX_DLIST_EXT_OPCODES 16
93
94 /**
95 * Used by device drivers to hook new commands into display lists.
96 */
97 struct gl_list_extensions
98 {
99 struct gl_list_instruction Opcode[MAX_DLIST_EXT_OPCODES];
100 GLuint NumOpcodes;
101 };
102
103
104
105 /**
106 * Flush vertices.
107 *
108 * \param ctx GL context.
109 *
110 * Checks if dd_function_table::SaveNeedFlush is marked to flush
111 * stored (save) vertices, and calls vbo_save_SaveFlushVertices if so.
112 */
113 #define SAVE_FLUSH_VERTICES(ctx) \
114 do { \
115 if (ctx->Driver.SaveNeedFlush) \
116 vbo_save_SaveFlushVertices(ctx); \
117 } while (0)
118
119
120 /**
121 * Macro to assert that the API call was made outside the
122 * glBegin()/glEnd() pair, with return value.
123 *
124 * \param ctx GL context.
125 * \param retval value to return value in case the assertion fails.
126 */
127 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval) \
128 do { \
129 if (ctx->Driver.CurrentSavePrimitive <= PRIM_MAX) { \
130 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glBegin/End" ); \
131 return retval; \
132 } \
133 } while (0)
134
135 /**
136 * Macro to assert that the API call was made outside the
137 * glBegin()/glEnd() pair.
138 *
139 * \param ctx GL context.
140 */
141 #define ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx) \
142 do { \
143 if (ctx->Driver.CurrentSavePrimitive <= PRIM_MAX) { \
144 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glBegin/End" ); \
145 return; \
146 } \
147 } while (0)
148
149 /**
150 * Macro to assert that the API call was made outside the
151 * glBegin()/glEnd() pair and flush the vertices.
152 *
153 * \param ctx GL context.
154 */
155 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx) \
156 do { \
157 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx); \
158 SAVE_FLUSH_VERTICES(ctx); \
159 } while (0)
160
161 /**
162 * Macro to assert that the API call was made outside the
163 * glBegin()/glEnd() pair and flush the vertices, with return value.
164 *
165 * \param ctx GL context.
166 * \param retval value to return value in case the assertion fails.
167 */
168 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval) \
169 do { \
170 ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval); \
171 SAVE_FLUSH_VERTICES(ctx); \
172 } while (0)
173
174
175 /**
176 * Display list opcodes.
177 *
178 * The fact that these identifiers are assigned consecutive
179 * integer values starting at 0 is very important, see InstSize array usage)
180 */
181 typedef enum
182 {
183 OPCODE_INVALID = -1, /* Force signed enum */
184 OPCODE_ACCUM,
185 OPCODE_ALPHA_FUNC,
186 OPCODE_BIND_TEXTURE,
187 OPCODE_BITMAP,
188 OPCODE_BLEND_COLOR,
189 OPCODE_BLEND_EQUATION,
190 OPCODE_BLEND_EQUATION_SEPARATE,
191 OPCODE_BLEND_FUNC_SEPARATE,
192
193 OPCODE_BLEND_EQUATION_I,
194 OPCODE_BLEND_EQUATION_SEPARATE_I,
195 OPCODE_BLEND_FUNC_I,
196 OPCODE_BLEND_FUNC_SEPARATE_I,
197
198 OPCODE_CALL_LIST,
199 OPCODE_CALL_LISTS,
200 OPCODE_CLEAR,
201 OPCODE_CLEAR_ACCUM,
202 OPCODE_CLEAR_COLOR,
203 OPCODE_CLEAR_DEPTH,
204 OPCODE_CLEAR_INDEX,
205 OPCODE_CLEAR_STENCIL,
206 OPCODE_CLEAR_BUFFER_IV,
207 OPCODE_CLEAR_BUFFER_UIV,
208 OPCODE_CLEAR_BUFFER_FV,
209 OPCODE_CLEAR_BUFFER_FI,
210 OPCODE_CLIP_PLANE,
211 OPCODE_COLOR_MASK,
212 OPCODE_COLOR_MASK_INDEXED,
213 OPCODE_COLOR_MATERIAL,
214 OPCODE_COPY_PIXELS,
215 OPCODE_COPY_TEX_IMAGE1D,
216 OPCODE_COPY_TEX_IMAGE2D,
217 OPCODE_COPY_TEX_SUB_IMAGE1D,
218 OPCODE_COPY_TEX_SUB_IMAGE2D,
219 OPCODE_COPY_TEX_SUB_IMAGE3D,
220 OPCODE_CULL_FACE,
221 OPCODE_DEPTH_FUNC,
222 OPCODE_DEPTH_MASK,
223 OPCODE_DEPTH_RANGE,
224 OPCODE_DISABLE,
225 OPCODE_DISABLE_INDEXED,
226 OPCODE_DRAW_BUFFER,
227 OPCODE_DRAW_PIXELS,
228 OPCODE_ENABLE,
229 OPCODE_ENABLE_INDEXED,
230 OPCODE_EVALMESH1,
231 OPCODE_EVALMESH2,
232 OPCODE_FOG,
233 OPCODE_FRONT_FACE,
234 OPCODE_FRUSTUM,
235 OPCODE_HINT,
236 OPCODE_INDEX_MASK,
237 OPCODE_INIT_NAMES,
238 OPCODE_LIGHT,
239 OPCODE_LIGHT_MODEL,
240 OPCODE_LINE_STIPPLE,
241 OPCODE_LINE_WIDTH,
242 OPCODE_LIST_BASE,
243 OPCODE_LOAD_IDENTITY,
244 OPCODE_LOAD_MATRIX,
245 OPCODE_LOAD_NAME,
246 OPCODE_LOGIC_OP,
247 OPCODE_MAP1,
248 OPCODE_MAP2,
249 OPCODE_MAPGRID1,
250 OPCODE_MAPGRID2,
251 OPCODE_MATRIX_MODE,
252 OPCODE_MULT_MATRIX,
253 OPCODE_ORTHO,
254 OPCODE_PASSTHROUGH,
255 OPCODE_PIXEL_MAP,
256 OPCODE_PIXEL_TRANSFER,
257 OPCODE_PIXEL_ZOOM,
258 OPCODE_POINT_SIZE,
259 OPCODE_POINT_PARAMETERS,
260 OPCODE_POLYGON_MODE,
261 OPCODE_POLYGON_STIPPLE,
262 OPCODE_POLYGON_OFFSET,
263 OPCODE_POP_ATTRIB,
264 OPCODE_POP_MATRIX,
265 OPCODE_POP_NAME,
266 OPCODE_PRIORITIZE_TEXTURE,
267 OPCODE_PUSH_ATTRIB,
268 OPCODE_PUSH_MATRIX,
269 OPCODE_PUSH_NAME,
270 OPCODE_RASTER_POS,
271 OPCODE_READ_BUFFER,
272 OPCODE_ROTATE,
273 OPCODE_SCALE,
274 OPCODE_SCISSOR,
275 OPCODE_SELECT_TEXTURE_SGIS,
276 OPCODE_SELECT_TEXTURE_COORD_SET,
277 OPCODE_SHADE_MODEL,
278 OPCODE_STENCIL_FUNC,
279 OPCODE_STENCIL_MASK,
280 OPCODE_STENCIL_OP,
281 OPCODE_TEXENV,
282 OPCODE_TEXGEN,
283 OPCODE_TEXPARAMETER,
284 OPCODE_TEX_IMAGE1D,
285 OPCODE_TEX_IMAGE2D,
286 OPCODE_TEX_IMAGE3D,
287 OPCODE_TEX_SUB_IMAGE1D,
288 OPCODE_TEX_SUB_IMAGE2D,
289 OPCODE_TEX_SUB_IMAGE3D,
290 OPCODE_TRANSLATE,
291 OPCODE_VIEWPORT,
292 OPCODE_WINDOW_POS,
293 /* ARB_viewport_array */
294 OPCODE_VIEWPORT_ARRAY_V,
295 OPCODE_VIEWPORT_INDEXED_F,
296 OPCODE_VIEWPORT_INDEXED_FV,
297 OPCODE_SCISSOR_ARRAY_V,
298 OPCODE_SCISSOR_INDEXED,
299 OPCODE_SCISSOR_INDEXED_V,
300 OPCODE_DEPTH_ARRAY_V,
301 OPCODE_DEPTH_INDEXED,
302 /* GL_ARB_multitexture */
303 OPCODE_ACTIVE_TEXTURE,
304 /* GL_ARB_texture_compression */
305 OPCODE_COMPRESSED_TEX_IMAGE_1D,
306 OPCODE_COMPRESSED_TEX_IMAGE_2D,
307 OPCODE_COMPRESSED_TEX_IMAGE_3D,
308 OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D,
309 OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D,
310 OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D,
311 /* GL_ARB_multisample */
312 OPCODE_SAMPLE_COVERAGE,
313 /* GL_ARB_window_pos */
314 OPCODE_WINDOW_POS_ARB,
315 /* GL_ARB_vertex_program */
316 OPCODE_BIND_PROGRAM_ARB,
317 OPCODE_PROGRAM_LOCAL_PARAMETER_ARB,
318 /* GL_EXT_stencil_two_side */
319 OPCODE_ACTIVE_STENCIL_FACE_EXT,
320 /* GL_EXT_depth_bounds_test */
321 OPCODE_DEPTH_BOUNDS_EXT,
322 /* GL_ARB_vertex/fragment_program */
323 OPCODE_PROGRAM_STRING_ARB,
324 OPCODE_PROGRAM_ENV_PARAMETER_ARB,
325 /* GL_ARB_occlusion_query */
326 OPCODE_BEGIN_QUERY_ARB,
327 OPCODE_END_QUERY_ARB,
328 /* GL_ARB_draw_buffers */
329 OPCODE_DRAW_BUFFERS_ARB,
330 /* GL_ATI_fragment_shader */
331 OPCODE_BIND_FRAGMENT_SHADER_ATI,
332 OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI,
333 /* OpenGL 2.0 */
334 OPCODE_STENCIL_FUNC_SEPARATE,
335 OPCODE_STENCIL_OP_SEPARATE,
336 OPCODE_STENCIL_MASK_SEPARATE,
337 /* GL_NV_primitive_restart */
338 OPCODE_PRIMITIVE_RESTART_NV,
339 /* GL_ARB_shader_objects */
340 OPCODE_USE_PROGRAM,
341 OPCODE_UNIFORM_1F,
342 OPCODE_UNIFORM_2F,
343 OPCODE_UNIFORM_3F,
344 OPCODE_UNIFORM_4F,
345 OPCODE_UNIFORM_1FV,
346 OPCODE_UNIFORM_2FV,
347 OPCODE_UNIFORM_3FV,
348 OPCODE_UNIFORM_4FV,
349 OPCODE_UNIFORM_1I,
350 OPCODE_UNIFORM_2I,
351 OPCODE_UNIFORM_3I,
352 OPCODE_UNIFORM_4I,
353 OPCODE_UNIFORM_1IV,
354 OPCODE_UNIFORM_2IV,
355 OPCODE_UNIFORM_3IV,
356 OPCODE_UNIFORM_4IV,
357 OPCODE_UNIFORM_MATRIX22,
358 OPCODE_UNIFORM_MATRIX33,
359 OPCODE_UNIFORM_MATRIX44,
360 OPCODE_UNIFORM_MATRIX23,
361 OPCODE_UNIFORM_MATRIX32,
362 OPCODE_UNIFORM_MATRIX24,
363 OPCODE_UNIFORM_MATRIX42,
364 OPCODE_UNIFORM_MATRIX34,
365 OPCODE_UNIFORM_MATRIX43,
366
367 /* OpenGL 3.0 */
368 OPCODE_UNIFORM_1UI,
369 OPCODE_UNIFORM_2UI,
370 OPCODE_UNIFORM_3UI,
371 OPCODE_UNIFORM_4UI,
372 OPCODE_UNIFORM_1UIV,
373 OPCODE_UNIFORM_2UIV,
374 OPCODE_UNIFORM_3UIV,
375 OPCODE_UNIFORM_4UIV,
376
377 /* GL_ARB_gpu_shader_fp64 */
378 OPCODE_UNIFORM_1D,
379 OPCODE_UNIFORM_2D,
380 OPCODE_UNIFORM_3D,
381 OPCODE_UNIFORM_4D,
382 OPCODE_UNIFORM_1DV,
383 OPCODE_UNIFORM_2DV,
384 OPCODE_UNIFORM_3DV,
385 OPCODE_UNIFORM_4DV,
386 OPCODE_UNIFORM_MATRIX22D,
387 OPCODE_UNIFORM_MATRIX33D,
388 OPCODE_UNIFORM_MATRIX44D,
389 OPCODE_UNIFORM_MATRIX23D,
390 OPCODE_UNIFORM_MATRIX32D,
391 OPCODE_UNIFORM_MATRIX24D,
392 OPCODE_UNIFORM_MATRIX42D,
393 OPCODE_UNIFORM_MATRIX34D,
394 OPCODE_UNIFORM_MATRIX43D,
395
396 /* GL_ARB_gpu_shader_int64 */
397 OPCODE_UNIFORM_1I64,
398 OPCODE_UNIFORM_2I64,
399 OPCODE_UNIFORM_3I64,
400 OPCODE_UNIFORM_4I64,
401 OPCODE_UNIFORM_1I64V,
402 OPCODE_UNIFORM_2I64V,
403 OPCODE_UNIFORM_3I64V,
404 OPCODE_UNIFORM_4I64V,
405 OPCODE_UNIFORM_1UI64,
406 OPCODE_UNIFORM_2UI64,
407 OPCODE_UNIFORM_3UI64,
408 OPCODE_UNIFORM_4UI64,
409 OPCODE_UNIFORM_1UI64V,
410 OPCODE_UNIFORM_2UI64V,
411 OPCODE_UNIFORM_3UI64V,
412 OPCODE_UNIFORM_4UI64V,
413 OPCODE_PROGRAM_UNIFORM_1I64,
414 OPCODE_PROGRAM_UNIFORM_2I64,
415 OPCODE_PROGRAM_UNIFORM_3I64,
416 OPCODE_PROGRAM_UNIFORM_4I64,
417 OPCODE_PROGRAM_UNIFORM_1I64V,
418 OPCODE_PROGRAM_UNIFORM_2I64V,
419 OPCODE_PROGRAM_UNIFORM_3I64V,
420 OPCODE_PROGRAM_UNIFORM_4I64V,
421 OPCODE_PROGRAM_UNIFORM_1UI64,
422 OPCODE_PROGRAM_UNIFORM_2UI64,
423 OPCODE_PROGRAM_UNIFORM_3UI64,
424 OPCODE_PROGRAM_UNIFORM_4UI64,
425 OPCODE_PROGRAM_UNIFORM_1UI64V,
426 OPCODE_PROGRAM_UNIFORM_2UI64V,
427 OPCODE_PROGRAM_UNIFORM_3UI64V,
428 OPCODE_PROGRAM_UNIFORM_4UI64V,
429
430 /* OpenGL 4.0 / GL_ARB_tessellation_shader */
431 OPCODE_PATCH_PARAMETER_I,
432 OPCODE_PATCH_PARAMETER_FV_INNER,
433 OPCODE_PATCH_PARAMETER_FV_OUTER,
434
435 /* OpenGL 4.2 / GL_ARB_separate_shader_objects */
436 OPCODE_USE_PROGRAM_STAGES,
437 OPCODE_PROGRAM_UNIFORM_1F,
438 OPCODE_PROGRAM_UNIFORM_2F,
439 OPCODE_PROGRAM_UNIFORM_3F,
440 OPCODE_PROGRAM_UNIFORM_4F,
441 OPCODE_PROGRAM_UNIFORM_1FV,
442 OPCODE_PROGRAM_UNIFORM_2FV,
443 OPCODE_PROGRAM_UNIFORM_3FV,
444 OPCODE_PROGRAM_UNIFORM_4FV,
445 OPCODE_PROGRAM_UNIFORM_1D,
446 OPCODE_PROGRAM_UNIFORM_2D,
447 OPCODE_PROGRAM_UNIFORM_3D,
448 OPCODE_PROGRAM_UNIFORM_4D,
449 OPCODE_PROGRAM_UNIFORM_1DV,
450 OPCODE_PROGRAM_UNIFORM_2DV,
451 OPCODE_PROGRAM_UNIFORM_3DV,
452 OPCODE_PROGRAM_UNIFORM_4DV,
453 OPCODE_PROGRAM_UNIFORM_1I,
454 OPCODE_PROGRAM_UNIFORM_2I,
455 OPCODE_PROGRAM_UNIFORM_3I,
456 OPCODE_PROGRAM_UNIFORM_4I,
457 OPCODE_PROGRAM_UNIFORM_1IV,
458 OPCODE_PROGRAM_UNIFORM_2IV,
459 OPCODE_PROGRAM_UNIFORM_3IV,
460 OPCODE_PROGRAM_UNIFORM_4IV,
461 OPCODE_PROGRAM_UNIFORM_1UI,
462 OPCODE_PROGRAM_UNIFORM_2UI,
463 OPCODE_PROGRAM_UNIFORM_3UI,
464 OPCODE_PROGRAM_UNIFORM_4UI,
465 OPCODE_PROGRAM_UNIFORM_1UIV,
466 OPCODE_PROGRAM_UNIFORM_2UIV,
467 OPCODE_PROGRAM_UNIFORM_3UIV,
468 OPCODE_PROGRAM_UNIFORM_4UIV,
469 OPCODE_PROGRAM_UNIFORM_MATRIX22F,
470 OPCODE_PROGRAM_UNIFORM_MATRIX33F,
471 OPCODE_PROGRAM_UNIFORM_MATRIX44F,
472 OPCODE_PROGRAM_UNIFORM_MATRIX23F,
473 OPCODE_PROGRAM_UNIFORM_MATRIX32F,
474 OPCODE_PROGRAM_UNIFORM_MATRIX24F,
475 OPCODE_PROGRAM_UNIFORM_MATRIX42F,
476 OPCODE_PROGRAM_UNIFORM_MATRIX34F,
477 OPCODE_PROGRAM_UNIFORM_MATRIX43F,
478 OPCODE_PROGRAM_UNIFORM_MATRIX22D,
479 OPCODE_PROGRAM_UNIFORM_MATRIX33D,
480 OPCODE_PROGRAM_UNIFORM_MATRIX44D,
481 OPCODE_PROGRAM_UNIFORM_MATRIX23D,
482 OPCODE_PROGRAM_UNIFORM_MATRIX32D,
483 OPCODE_PROGRAM_UNIFORM_MATRIX24D,
484 OPCODE_PROGRAM_UNIFORM_MATRIX42D,
485 OPCODE_PROGRAM_UNIFORM_MATRIX34D,
486 OPCODE_PROGRAM_UNIFORM_MATRIX43D,
487
488 /* GL_ARB_clip_control */
489 OPCODE_CLIP_CONTROL,
490
491 /* GL_ARB_color_buffer_float */
492 OPCODE_CLAMP_COLOR,
493
494 /* GL_EXT_framebuffer_blit */
495 OPCODE_BLIT_FRAMEBUFFER,
496
497 /* Vertex attributes -- fallback for when optimized display
498 * list build isn't active.
499 */
500 OPCODE_ATTR_1F_NV,
501 OPCODE_ATTR_2F_NV,
502 OPCODE_ATTR_3F_NV,
503 OPCODE_ATTR_4F_NV,
504 OPCODE_ATTR_1F_ARB,
505 OPCODE_ATTR_2F_ARB,
506 OPCODE_ATTR_3F_ARB,
507 OPCODE_ATTR_4F_ARB,
508 OPCODE_ATTR_1D,
509 OPCODE_ATTR_2D,
510 OPCODE_ATTR_3D,
511 OPCODE_ATTR_4D,
512 OPCODE_MATERIAL,
513 OPCODE_BEGIN,
514 OPCODE_END,
515 OPCODE_RECTF,
516 OPCODE_EVAL_C1,
517 OPCODE_EVAL_C2,
518 OPCODE_EVAL_P1,
519 OPCODE_EVAL_P2,
520
521 /* GL_EXT_provoking_vertex */
522 OPCODE_PROVOKING_VERTEX,
523
524 /* GL_EXT_transform_feedback */
525 OPCODE_BEGIN_TRANSFORM_FEEDBACK,
526 OPCODE_END_TRANSFORM_FEEDBACK,
527 OPCODE_BIND_TRANSFORM_FEEDBACK,
528 OPCODE_PAUSE_TRANSFORM_FEEDBACK,
529 OPCODE_RESUME_TRANSFORM_FEEDBACK,
530 OPCODE_DRAW_TRANSFORM_FEEDBACK,
531
532 /* GL_EXT_texture_integer */
533 OPCODE_CLEARCOLOR_I,
534 OPCODE_CLEARCOLOR_UI,
535 OPCODE_TEXPARAMETER_I,
536 OPCODE_TEXPARAMETER_UI,
537
538 /* GL_ARB_instanced_arrays */
539 OPCODE_VERTEX_ATTRIB_DIVISOR,
540
541 /* GL_NV_texture_barrier */
542 OPCODE_TEXTURE_BARRIER_NV,
543
544 /* GL_ARB_sampler_object */
545 OPCODE_BIND_SAMPLER,
546 OPCODE_SAMPLER_PARAMETERIV,
547 OPCODE_SAMPLER_PARAMETERFV,
548 OPCODE_SAMPLER_PARAMETERIIV,
549 OPCODE_SAMPLER_PARAMETERUIV,
550
551 /* ARB_compute_shader */
552 OPCODE_DISPATCH_COMPUTE,
553
554 /* GL_ARB_sync */
555 OPCODE_WAIT_SYNC,
556
557 /* GL_NV_conditional_render */
558 OPCODE_BEGIN_CONDITIONAL_RENDER,
559 OPCODE_END_CONDITIONAL_RENDER,
560
561 /* ARB_timer_query */
562 OPCODE_QUERY_COUNTER,
563
564 /* ARB_transform_feedback3 */
565 OPCODE_BEGIN_QUERY_INDEXED,
566 OPCODE_END_QUERY_INDEXED,
567 OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM,
568
569 /* ARB_transform_feedback_instanced */
570 OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED,
571 OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED,
572
573 /* ARB_uniform_buffer_object */
574 OPCODE_UNIFORM_BLOCK_BINDING,
575
576 /* ARB_shader_subroutines */
577 OPCODE_UNIFORM_SUBROUTINES,
578
579 /* EXT_polygon_offset_clamp */
580 OPCODE_POLYGON_OFFSET_CLAMP,
581
582 /* EXT_window_rectangles */
583 OPCODE_WINDOW_RECTANGLES,
584
585 /* NV_conservative_raster */
586 OPCODE_SUBPIXEL_PRECISION_BIAS,
587
588 /* NV_conservative_raster_dilate */
589 OPCODE_CONSERVATIVE_RASTER_PARAMETER_F,
590
591 /* NV_conservative_raster_pre_snap_triangles */
592 OPCODE_CONSERVATIVE_RASTER_PARAMETER_I,
593
594 /* EXT_direct_state_access */
595 OPCODE_MATRIX_LOAD,
596 OPCODE_MATRIX_MULT,
597 OPCODE_MATRIX_ROTATE,
598 OPCODE_MATRIX_SCALE,
599 OPCODE_MATRIX_TRANSLATE,
600 OPCODE_MATRIX_LOAD_IDENTITY,
601 OPCODE_MATRIX_ORTHO,
602 OPCODE_MATRIX_FRUSTUM,
603 OPCODE_MATRIX_PUSH,
604 OPCODE_MATRIX_POP,
605 OPCODE_TEXTUREPARAMETER_F,
606 OPCODE_TEXTUREPARAMETER_I,
607 OPCODE_TEXTUREPARAMETER_II,
608 OPCODE_TEXTUREPARAMETER_IUI,
609 OPCODE_TEXTURE_IMAGE1D,
610 OPCODE_TEXTURE_IMAGE2D,
611 OPCODE_TEXTURE_IMAGE3D,
612 OPCODE_TEXTURE_SUB_IMAGE1D,
613 OPCODE_TEXTURE_SUB_IMAGE2D,
614 OPCODE_TEXTURE_SUB_IMAGE3D,
615 OPCODE_COPY_TEXTURE_IMAGE1D,
616 OPCODE_COPY_TEXTURE_IMAGE2D,
617 OPCODE_COPY_TEXTURE_SUB_IMAGE1D,
618 OPCODE_COPY_TEXTURE_SUB_IMAGE2D,
619 OPCODE_COPY_TEXTURE_SUB_IMAGE3D,
620 OPCODE_BIND_MULTITEXTURE,
621 OPCODE_MULTITEXPARAMETER_F,
622 OPCODE_MULTITEXPARAMETER_I,
623 OPCODE_MULTITEXPARAMETER_II,
624 OPCODE_MULTITEXPARAMETER_IUI,
625 OPCODE_MULTITEX_IMAGE1D,
626 OPCODE_MULTITEX_IMAGE2D,
627 OPCODE_MULTITEX_IMAGE3D,
628 OPCODE_MULTITEX_SUB_IMAGE1D,
629 OPCODE_MULTITEX_SUB_IMAGE2D,
630 OPCODE_MULTITEX_SUB_IMAGE3D,
631 OPCODE_COPY_MULTITEX_IMAGE1D,
632 OPCODE_COPY_MULTITEX_IMAGE2D,
633 OPCODE_COPY_MULTITEX_SUB_IMAGE1D,
634 OPCODE_COPY_MULTITEX_SUB_IMAGE2D,
635 OPCODE_COPY_MULTITEX_SUB_IMAGE3D,
636 OPCODE_MULTITEXENV,
637 OPCODE_COMPRESSED_TEXTURE_IMAGE_1D,
638 OPCODE_COMPRESSED_TEXTURE_IMAGE_2D,
639 OPCODE_COMPRESSED_TEXTURE_IMAGE_3D,
640 OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_1D,
641 OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_2D,
642 OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_3D,
643 OPCODE_COMPRESSED_MULTITEX_IMAGE_1D,
644 OPCODE_COMPRESSED_MULTITEX_IMAGE_2D,
645 OPCODE_COMPRESSED_MULTITEX_IMAGE_3D,
646 OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_1D,
647 OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_2D,
648 OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_3D,
649 OPCODE_NAMED_PROGRAM_STRING,
650 OPCODE_NAMED_PROGRAM_LOCAL_PARAMETER,
651
652 /* The following three are meta instructions */
653 OPCODE_ERROR, /* raise compiled-in error */
654 OPCODE_CONTINUE,
655 OPCODE_NOP, /* No-op (used for 8-byte alignment */
656 OPCODE_END_OF_LIST,
657 OPCODE_EXT_0
658 } OpCode;
659
660
661
662 /**
663 * Display list node.
664 *
665 * Display list instructions are stored as sequences of "nodes". Nodes
666 * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
667 * are linked together with a pointer.
668 *
669 * Each instruction in the display list is stored as a sequence of
670 * contiguous nodes in memory.
671 * Each node is the union of a variety of data types.
672 *
673 * Note, all of these members should be 4 bytes in size or less for the
674 * sake of compact display lists. We store 8-byte pointers in a pair of
675 * these nodes using the save/get_pointer() functions below.
676 */
677 union gl_dlist_node
678 {
679 OpCode opcode;
680 GLboolean b;
681 GLbitfield bf;
682 GLubyte ub;
683 GLshort s;
684 GLushort us;
685 GLint i;
686 GLuint ui;
687 GLenum e;
688 GLfloat f;
689 GLsizei si;
690 };
691
692
693 typedef union gl_dlist_node Node;
694
695
696 /** How many 4-byte dwords to store a pointer */
697 #define POINTER_DWORDS (sizeof(void *) / 4)
698
699 /* We want to keep sizeof(union gl_dlist_node) == 4 to minimize
700 * space for display lists. The following types and functions are
701 * used to help store 4- and 8-byte pointers in 1 or 2 dlist_nodes.
702 */
703 union pointer
704 {
705 void *ptr;
706 GLuint dwords[POINTER_DWORDS];
707 };
708
709
710 /**
711 * Save a 4 or 8-byte pointer at dest (and dest+1).
712 */
713 static inline void
714 save_pointer(Node *dest, void *src)
715 {
716 union pointer p;
717 unsigned i;
718
719 STATIC_ASSERT(POINTER_DWORDS == 1 || POINTER_DWORDS == 2);
720 STATIC_ASSERT(sizeof(Node) == 4);
721
722 p.ptr = src;
723
724 for (i = 0; i < POINTER_DWORDS; i++)
725 dest[i].ui = p.dwords[i];
726 }
727
728
729 /**
730 * Retrieve a 4 or 8-byte pointer from node (node+1).
731 */
732 static inline void *
733 get_pointer(const Node *node)
734 {
735 union pointer p;
736 unsigned i;
737
738 for (i = 0; i < POINTER_DWORDS; i++)
739 p.dwords[i] = node[i].ui;
740
741 return p.ptr;
742 }
743
744
745 /**
746 * Used to store a 64-bit uint in a pair of "Nodes" for the sake of 32-bit
747 * environment.
748 */
749 union uint64_pair
750 {
751 GLuint64 uint64;
752 GLuint uint32[2];
753 };
754
755
756 union float64_pair
757 {
758 GLdouble d;
759 GLuint uint32[2];
760 };
761
762 union int64_pair
763 {
764 GLint64 int64;
765 GLint int32[2];
766 };
767
768 #define ASSIGN_DOUBLE_TO_NODES(n, idx, value) \
769 do { \
770 union float64_pair tmp; \
771 tmp.d = value; \
772 n[idx].ui = tmp.uint32[0]; \
773 n[idx+1].ui = tmp.uint32[1]; \
774 } while (0)
775
776 #define ASSIGN_UINT64_TO_NODES(n, idx, value) \
777 do { \
778 union uint64_pair tmp; \
779 tmp.uint64 = value; \
780 n[idx].ui = tmp.uint32[0]; \
781 n[idx+1].ui = tmp.uint32[1]; \
782 } while (0)
783
784 #define ASSIGN_INT64_TO_NODES(n, idx, value) \
785 do { \
786 union int64_pair tmp; \
787 tmp.int64 = value; \
788 n[idx].i = tmp.int32[0]; \
789 n[idx+1].i = tmp.int32[1]; \
790 } while (0)
791
792 /**
793 * How many nodes to allocate at a time. Note that bulk vertex data
794 * from glBegin/glVertex/glEnd primitives will typically wind up in
795 * a VBO, and not directly in the display list itself.
796 */
797 #define BLOCK_SIZE 256
798
799
800
801 /**
802 * Number of nodes of storage needed for each instruction.
803 * Sizes for dynamically allocated opcodes are stored in the context struct.
804 */
805 static GLuint InstSize[OPCODE_END_OF_LIST + 1];
806
807
808 void mesa_print_display_list(GLuint list);
809
810
811 /**
812 * Does the given display list only contain a single glBitmap call?
813 */
814 static bool
815 is_bitmap_list(const struct gl_display_list *dlist)
816 {
817 const Node *n = dlist->Head;
818 if (n[0].opcode == OPCODE_BITMAP) {
819 n += InstSize[OPCODE_BITMAP];
820 if (n[0].opcode == OPCODE_END_OF_LIST)
821 return true;
822 }
823 return false;
824 }
825
826
827 /**
828 * Is the given display list an empty list?
829 */
830 static bool
831 is_empty_list(const struct gl_display_list *dlist)
832 {
833 const Node *n = dlist->Head;
834 return n[0].opcode == OPCODE_END_OF_LIST;
835 }
836
837
838 /**
839 * Delete/free a gl_bitmap_atlas. Called during context tear-down.
840 */
841 void
842 _mesa_delete_bitmap_atlas(struct gl_context *ctx, struct gl_bitmap_atlas *atlas)
843 {
844 if (atlas->texObj) {
845 ctx->Driver.DeleteTexture(ctx, atlas->texObj);
846 }
847 free(atlas->glyphs);
848 free(atlas);
849 }
850
851
852 /**
853 * Lookup a gl_bitmap_atlas by listBase ID.
854 */
855 static struct gl_bitmap_atlas *
856 lookup_bitmap_atlas(struct gl_context *ctx, GLuint listBase)
857 {
858 struct gl_bitmap_atlas *atlas;
859
860 assert(listBase > 0);
861 atlas = _mesa_HashLookup(ctx->Shared->BitmapAtlas, listBase);
862 return atlas;
863 }
864
865
866 /**
867 * Create new bitmap atlas and insert into hash table.
868 */
869 static struct gl_bitmap_atlas *
870 alloc_bitmap_atlas(struct gl_context *ctx, GLuint listBase)
871 {
872 struct gl_bitmap_atlas *atlas;
873
874 assert(listBase > 0);
875 assert(_mesa_HashLookup(ctx->Shared->BitmapAtlas, listBase) == NULL);
876
877 atlas = calloc(1, sizeof(*atlas));
878 if (atlas) {
879 _mesa_HashInsert(ctx->Shared->BitmapAtlas, listBase, atlas);
880 }
881
882 return atlas;
883 }
884
885
886 /**
887 * Try to build a bitmap atlas. This involves examining a sequence of
888 * display lists which contain glBitmap commands and putting the bitmap
889 * images into a texture map (the atlas).
890 * If we succeed, gl_bitmap_atlas::complete will be set to true.
891 * If we fail, gl_bitmap_atlas::incomplete will be set to true.
892 */
893 static void
894 build_bitmap_atlas(struct gl_context *ctx, struct gl_bitmap_atlas *atlas,
895 GLuint listBase)
896 {
897 unsigned i, row_height = 0, xpos = 0, ypos = 0;
898 GLubyte *map;
899 GLint map_stride;
900
901 assert(atlas);
902 assert(!atlas->complete);
903 assert(atlas->numBitmaps > 0);
904
905 /* We use a rectangle texture (non-normalized coords) for the atlas */
906 assert(ctx->Extensions.NV_texture_rectangle);
907 assert(ctx->Const.MaxTextureRectSize >= 1024);
908
909 atlas->texWidth = 1024;
910 atlas->texHeight = 0; /* determined below */
911
912 atlas->glyphs = malloc(atlas->numBitmaps * sizeof(atlas->glyphs[0]));
913 if (!atlas->glyphs) {
914 /* give up */
915 atlas->incomplete = true;
916 return;
917 }
918
919 /* Loop over the display lists. They should all contain a single glBitmap
920 * call. If not, bail out. Also, compute the position and sizes of each
921 * bitmap in the atlas to determine the texture atlas size.
922 */
923 for (i = 0; i < atlas->numBitmaps; i++) {
924 const struct gl_display_list *list = _mesa_lookup_list(ctx, listBase + i);
925 const Node *n;
926 struct gl_bitmap_glyph *g = &atlas->glyphs[i];
927 unsigned bitmap_width, bitmap_height;
928 float bitmap_xmove, bitmap_ymove, bitmap_xorig, bitmap_yorig;
929
930 if (!list || is_empty_list(list)) {
931 /* stop here */
932 atlas->numBitmaps = i;
933 break;
934 }
935
936 if (!is_bitmap_list(list)) {
937 /* This list does not contain exactly one glBitmap command. Give up. */
938 atlas->incomplete = true;
939 return;
940 }
941
942 /* get bitmap info from the display list command */
943 n = list->Head;
944 assert(n[0].opcode == OPCODE_BITMAP);
945 bitmap_width = n[1].i;
946 bitmap_height = n[2].i;
947 bitmap_xorig = n[3].f;
948 bitmap_yorig = n[4].f;
949 bitmap_xmove = n[5].f;
950 bitmap_ymove = n[6].f;
951
952 if (xpos + bitmap_width > atlas->texWidth) {
953 /* advance to the next row of the texture */
954 xpos = 0;
955 ypos += row_height;
956 row_height = 0;
957 }
958
959 /* save the bitmap's position in the atlas */
960 g->x = xpos;
961 g->y = ypos;
962 g->w = bitmap_width;
963 g->h = bitmap_height;
964 g->xorig = bitmap_xorig;
965 g->yorig = bitmap_yorig;
966 g->xmove = bitmap_xmove;
967 g->ymove = bitmap_ymove;
968
969 xpos += bitmap_width;
970
971 /* keep track of tallest bitmap in the row */
972 row_height = MAX2(row_height, bitmap_height);
973 }
974
975 /* Now we know the texture height */
976 atlas->texHeight = ypos + row_height;
977
978 if (atlas->texHeight == 0) {
979 /* no glyphs found, give up */
980 goto fail;
981 }
982 else if (atlas->texHeight > ctx->Const.MaxTextureRectSize) {
983 /* too large, give up */
984 goto fail;
985 }
986
987 /* Create atlas texture (texture ID is irrelevant) */
988 atlas->texObj = ctx->Driver.NewTextureObject(ctx, 999, GL_TEXTURE_RECTANGLE);
989 if (!atlas->texObj) {
990 goto out_of_memory;
991 }
992
993 atlas->texObj->Sampler.MinFilter = GL_NEAREST;
994 atlas->texObj->Sampler.MagFilter = GL_NEAREST;
995 atlas->texObj->MaxLevel = 0;
996 atlas->texObj->Immutable = GL_TRUE;
997
998 atlas->texImage = _mesa_get_tex_image(ctx, atlas->texObj,
999 GL_TEXTURE_RECTANGLE, 0);
1000 if (!atlas->texImage) {
1001 goto out_of_memory;
1002 }
1003
1004 if (ctx->Const.BitmapUsesRed)
1005 _mesa_init_teximage_fields(ctx, atlas->texImage,
1006 atlas->texWidth, atlas->texHeight, 1, 0,
1007 GL_RED, MESA_FORMAT_R_UNORM8);
1008 else
1009 _mesa_init_teximage_fields(ctx, atlas->texImage,
1010 atlas->texWidth, atlas->texHeight, 1, 0,
1011 GL_ALPHA, MESA_FORMAT_A_UNORM8);
1012
1013 /* alloc image storage */
1014 if (!ctx->Driver.AllocTextureImageBuffer(ctx, atlas->texImage)) {
1015 goto out_of_memory;
1016 }
1017
1018 /* map teximage, load with bitmap glyphs */
1019 ctx->Driver.MapTextureImage(ctx, atlas->texImage, 0,
1020 0, 0, atlas->texWidth, atlas->texHeight,
1021 GL_MAP_WRITE_BIT, &map, &map_stride);
1022 if (!map) {
1023 goto out_of_memory;
1024 }
1025
1026 /* Background/clear pixels are 0xff, foreground/set pixels are 0x0 */
1027 memset(map, 0xff, map_stride * atlas->texHeight);
1028
1029 for (i = 0; i < atlas->numBitmaps; i++) {
1030 const struct gl_display_list *list = _mesa_lookup_list(ctx, listBase + i);
1031 const Node *n = list->Head;
1032
1033 assert(n[0].opcode == OPCODE_BITMAP ||
1034 n[0].opcode == OPCODE_END_OF_LIST);
1035
1036 if (n[0].opcode == OPCODE_BITMAP) {
1037 unsigned bitmap_width = n[1].i;
1038 unsigned bitmap_height = n[2].i;
1039 unsigned xpos = atlas->glyphs[i].x;
1040 unsigned ypos = atlas->glyphs[i].y;
1041 const void *bitmap_image = get_pointer(&n[7]);
1042
1043 assert(atlas->glyphs[i].w == bitmap_width);
1044 assert(atlas->glyphs[i].h == bitmap_height);
1045
1046 /* put the bitmap image into the texture image */
1047 _mesa_expand_bitmap(bitmap_width, bitmap_height,
1048 &ctx->DefaultPacking, bitmap_image,
1049 map + map_stride * ypos + xpos, /* dest addr */
1050 map_stride, 0x0);
1051 }
1052 }
1053
1054 ctx->Driver.UnmapTextureImage(ctx, atlas->texImage, 0);
1055
1056 atlas->complete = true;
1057
1058 return;
1059
1060 out_of_memory:
1061 _mesa_error(ctx, GL_OUT_OF_MEMORY, "Display list bitmap atlas");
1062 fail:
1063 if (atlas->texObj) {
1064 ctx->Driver.DeleteTexture(ctx, atlas->texObj);
1065 }
1066 free(atlas->glyphs);
1067 atlas->glyphs = NULL;
1068 atlas->incomplete = true;
1069 }
1070
1071
1072 /**
1073 * Allocate a gl_display_list object with an initial block of storage.
1074 * \param count how many display list nodes/tokens to allocate
1075 */
1076 static struct gl_display_list *
1077 make_list(GLuint name, GLuint count)
1078 {
1079 struct gl_display_list *dlist = CALLOC_STRUCT(gl_display_list);
1080 dlist->Name = name;
1081 dlist->Head = malloc(sizeof(Node) * count);
1082 dlist->Head[0].opcode = OPCODE_END_OF_LIST;
1083 /* All InstSize[] entries must be non-zero */
1084 InstSize[OPCODE_END_OF_LIST] = 1;
1085 return dlist;
1086 }
1087
1088
1089 /**
1090 * Lookup function to just encapsulate casting.
1091 */
1092 struct gl_display_list *
1093 _mesa_lookup_list(struct gl_context *ctx, GLuint list)
1094 {
1095 return (struct gl_display_list *)
1096 _mesa_HashLookup(ctx->Shared->DisplayList, list);
1097 }
1098
1099
1100 /** Is the given opcode an extension code? */
1101 static inline GLboolean
1102 is_ext_opcode(OpCode opcode)
1103 {
1104 return (opcode >= OPCODE_EXT_0);
1105 }
1106
1107
1108 /** Destroy an extended opcode instruction */
1109 static GLint
1110 ext_opcode_destroy(struct gl_context *ctx, Node *node)
1111 {
1112 const GLint i = node[0].opcode - OPCODE_EXT_0;
1113 GLint step;
1114 ctx->ListExt->Opcode[i].Destroy(ctx, &node[1]);
1115 step = ctx->ListExt->Opcode[i].Size;
1116 return step;
1117 }
1118
1119
1120 /** Execute an extended opcode instruction */
1121 static GLint
1122 ext_opcode_execute(struct gl_context *ctx, Node *node)
1123 {
1124 const GLint i = node[0].opcode - OPCODE_EXT_0;
1125 GLint step;
1126 ctx->ListExt->Opcode[i].Execute(ctx, &node[1]);
1127 step = ctx->ListExt->Opcode[i].Size;
1128 return step;
1129 }
1130
1131
1132 /** Print an extended opcode instruction */
1133 static GLint
1134 ext_opcode_print(struct gl_context *ctx, Node *node, FILE *f)
1135 {
1136 const GLint i = node[0].opcode - OPCODE_EXT_0;
1137 GLint step;
1138 ctx->ListExt->Opcode[i].Print(ctx, &node[1], f);
1139 step = ctx->ListExt->Opcode[i].Size;
1140 return step;
1141 }
1142
1143
1144 /**
1145 * Delete the named display list, but don't remove from hash table.
1146 * \param dlist - display list pointer
1147 */
1148 void
1149 _mesa_delete_list(struct gl_context *ctx, struct gl_display_list *dlist)
1150 {
1151 Node *n, *block;
1152 GLboolean done;
1153
1154 n = block = dlist->Head;
1155
1156 done = block ? GL_FALSE : GL_TRUE;
1157 while (!done) {
1158 const OpCode opcode = n[0].opcode;
1159
1160 /* check for extension opcodes first */
1161 if (is_ext_opcode(opcode)) {
1162 n += ext_opcode_destroy(ctx, n);
1163 }
1164 else {
1165 switch (opcode) {
1166 /* for some commands, we need to free malloc'd memory */
1167 case OPCODE_MAP1:
1168 free(get_pointer(&n[6]));
1169 break;
1170 case OPCODE_MAP2:
1171 free(get_pointer(&n[10]));
1172 break;
1173 case OPCODE_CALL_LISTS:
1174 free(get_pointer(&n[3]));
1175 break;
1176 case OPCODE_DRAW_PIXELS:
1177 free(get_pointer(&n[5]));
1178 break;
1179 case OPCODE_BITMAP:
1180 free(get_pointer(&n[7]));
1181 break;
1182 case OPCODE_POLYGON_STIPPLE:
1183 free(get_pointer(&n[1]));
1184 break;
1185 case OPCODE_TEX_IMAGE1D:
1186 free(get_pointer(&n[8]));
1187 break;
1188 case OPCODE_TEX_IMAGE2D:
1189 free(get_pointer(&n[9]));
1190 break;
1191 case OPCODE_TEX_IMAGE3D:
1192 free(get_pointer(&n[10]));
1193 break;
1194 case OPCODE_TEX_SUB_IMAGE1D:
1195 free(get_pointer(&n[7]));
1196 break;
1197 case OPCODE_TEX_SUB_IMAGE2D:
1198 free(get_pointer(&n[9]));
1199 break;
1200 case OPCODE_TEX_SUB_IMAGE3D:
1201 free(get_pointer(&n[11]));
1202 break;
1203 case OPCODE_COMPRESSED_TEX_IMAGE_1D:
1204 free(get_pointer(&n[7]));
1205 break;
1206 case OPCODE_COMPRESSED_TEX_IMAGE_2D:
1207 free(get_pointer(&n[8]));
1208 break;
1209 case OPCODE_COMPRESSED_TEX_IMAGE_3D:
1210 free(get_pointer(&n[9]));
1211 break;
1212 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D:
1213 free(get_pointer(&n[7]));
1214 break;
1215 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D:
1216 free(get_pointer(&n[9]));
1217 break;
1218 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D:
1219 free(get_pointer(&n[11]));
1220 break;
1221 case OPCODE_PROGRAM_STRING_ARB:
1222 free(get_pointer(&n[4])); /* program string */
1223 break;
1224 case OPCODE_UNIFORM_1FV:
1225 case OPCODE_UNIFORM_2FV:
1226 case OPCODE_UNIFORM_3FV:
1227 case OPCODE_UNIFORM_4FV:
1228 case OPCODE_UNIFORM_1DV:
1229 case OPCODE_UNIFORM_2DV:
1230 case OPCODE_UNIFORM_3DV:
1231 case OPCODE_UNIFORM_4DV:
1232 case OPCODE_UNIFORM_1IV:
1233 case OPCODE_UNIFORM_2IV:
1234 case OPCODE_UNIFORM_3IV:
1235 case OPCODE_UNIFORM_4IV:
1236 case OPCODE_UNIFORM_1UIV:
1237 case OPCODE_UNIFORM_2UIV:
1238 case OPCODE_UNIFORM_3UIV:
1239 case OPCODE_UNIFORM_4UIV:
1240 case OPCODE_UNIFORM_1I64V:
1241 case OPCODE_UNIFORM_2I64V:
1242 case OPCODE_UNIFORM_3I64V:
1243 case OPCODE_UNIFORM_4I64V:
1244 case OPCODE_UNIFORM_1UI64V:
1245 case OPCODE_UNIFORM_2UI64V:
1246 case OPCODE_UNIFORM_3UI64V:
1247 case OPCODE_UNIFORM_4UI64V:
1248 free(get_pointer(&n[3]));
1249 break;
1250 case OPCODE_UNIFORM_MATRIX22:
1251 case OPCODE_UNIFORM_MATRIX33:
1252 case OPCODE_UNIFORM_MATRIX44:
1253 case OPCODE_UNIFORM_MATRIX24:
1254 case OPCODE_UNIFORM_MATRIX42:
1255 case OPCODE_UNIFORM_MATRIX23:
1256 case OPCODE_UNIFORM_MATRIX32:
1257 case OPCODE_UNIFORM_MATRIX34:
1258 case OPCODE_UNIFORM_MATRIX43:
1259 case OPCODE_UNIFORM_MATRIX22D:
1260 case OPCODE_UNIFORM_MATRIX33D:
1261 case OPCODE_UNIFORM_MATRIX44D:
1262 case OPCODE_UNIFORM_MATRIX24D:
1263 case OPCODE_UNIFORM_MATRIX42D:
1264 case OPCODE_UNIFORM_MATRIX23D:
1265 case OPCODE_UNIFORM_MATRIX32D:
1266 case OPCODE_UNIFORM_MATRIX34D:
1267 case OPCODE_UNIFORM_MATRIX43D:
1268 free(get_pointer(&n[4]));
1269 break;
1270 case OPCODE_PROGRAM_UNIFORM_1FV:
1271 case OPCODE_PROGRAM_UNIFORM_2FV:
1272 case OPCODE_PROGRAM_UNIFORM_3FV:
1273 case OPCODE_PROGRAM_UNIFORM_4FV:
1274 case OPCODE_PROGRAM_UNIFORM_1DV:
1275 case OPCODE_PROGRAM_UNIFORM_2DV:
1276 case OPCODE_PROGRAM_UNIFORM_3DV:
1277 case OPCODE_PROGRAM_UNIFORM_4DV:
1278 case OPCODE_PROGRAM_UNIFORM_1IV:
1279 case OPCODE_PROGRAM_UNIFORM_2IV:
1280 case OPCODE_PROGRAM_UNIFORM_3IV:
1281 case OPCODE_PROGRAM_UNIFORM_4IV:
1282 case OPCODE_PROGRAM_UNIFORM_1UIV:
1283 case OPCODE_PROGRAM_UNIFORM_2UIV:
1284 case OPCODE_PROGRAM_UNIFORM_3UIV:
1285 case OPCODE_PROGRAM_UNIFORM_4UIV:
1286 case OPCODE_PROGRAM_UNIFORM_1I64V:
1287 case OPCODE_PROGRAM_UNIFORM_2I64V:
1288 case OPCODE_PROGRAM_UNIFORM_3I64V:
1289 case OPCODE_PROGRAM_UNIFORM_4I64V:
1290 case OPCODE_PROGRAM_UNIFORM_1UI64V:
1291 case OPCODE_PROGRAM_UNIFORM_2UI64V:
1292 case OPCODE_PROGRAM_UNIFORM_3UI64V:
1293 case OPCODE_PROGRAM_UNIFORM_4UI64V:
1294 free(get_pointer(&n[4]));
1295 break;
1296 case OPCODE_PROGRAM_UNIFORM_MATRIX22F:
1297 case OPCODE_PROGRAM_UNIFORM_MATRIX33F:
1298 case OPCODE_PROGRAM_UNIFORM_MATRIX44F:
1299 case OPCODE_PROGRAM_UNIFORM_MATRIX24F:
1300 case OPCODE_PROGRAM_UNIFORM_MATRIX42F:
1301 case OPCODE_PROGRAM_UNIFORM_MATRIX23F:
1302 case OPCODE_PROGRAM_UNIFORM_MATRIX32F:
1303 case OPCODE_PROGRAM_UNIFORM_MATRIX34F:
1304 case OPCODE_PROGRAM_UNIFORM_MATRIX43F:
1305 case OPCODE_PROGRAM_UNIFORM_MATRIX22D:
1306 case OPCODE_PROGRAM_UNIFORM_MATRIX33D:
1307 case OPCODE_PROGRAM_UNIFORM_MATRIX44D:
1308 case OPCODE_PROGRAM_UNIFORM_MATRIX24D:
1309 case OPCODE_PROGRAM_UNIFORM_MATRIX42D:
1310 case OPCODE_PROGRAM_UNIFORM_MATRIX23D:
1311 case OPCODE_PROGRAM_UNIFORM_MATRIX32D:
1312 case OPCODE_PROGRAM_UNIFORM_MATRIX34D:
1313 case OPCODE_PROGRAM_UNIFORM_MATRIX43D:
1314 free(get_pointer(&n[5]));
1315 break;
1316 case OPCODE_PIXEL_MAP:
1317 free(get_pointer(&n[3]));
1318 break;
1319 case OPCODE_VIEWPORT_ARRAY_V:
1320 case OPCODE_SCISSOR_ARRAY_V:
1321 case OPCODE_DEPTH_ARRAY_V:
1322 case OPCODE_UNIFORM_SUBROUTINES:
1323 case OPCODE_WINDOW_RECTANGLES:
1324 free(get_pointer(&n[3]));
1325 break;
1326 case OPCODE_TEXTURE_IMAGE1D:
1327 case OPCODE_MULTITEX_IMAGE1D:
1328 free(get_pointer(&n[9]));
1329 break;
1330 case OPCODE_TEXTURE_IMAGE2D:
1331 case OPCODE_MULTITEX_IMAGE2D:
1332 free(get_pointer(&n[10]));
1333 break;
1334 case OPCODE_TEXTURE_IMAGE3D:
1335 case OPCODE_MULTITEX_IMAGE3D:
1336 free(get_pointer(&n[11]));
1337 break;
1338 case OPCODE_TEXTURE_SUB_IMAGE1D:
1339 case OPCODE_MULTITEX_SUB_IMAGE1D:
1340 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_1D:
1341 case OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_1D:
1342 free(get_pointer(&n[8]));
1343 break;
1344 case OPCODE_TEXTURE_SUB_IMAGE2D:
1345 case OPCODE_MULTITEX_SUB_IMAGE2D:
1346 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_2D:
1347 case OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_2D:
1348 free(get_pointer(&n[10]));
1349 break;
1350 case OPCODE_TEXTURE_SUB_IMAGE3D:
1351 case OPCODE_MULTITEX_SUB_IMAGE3D:
1352 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_3D:
1353 case OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_3D:
1354 free(get_pointer(&n[12]));
1355 break;
1356 case OPCODE_COMPRESSED_TEXTURE_IMAGE_1D:
1357 case OPCODE_COMPRESSED_MULTITEX_IMAGE_1D:
1358 free(get_pointer(&n[8]));
1359 break;
1360 case OPCODE_COMPRESSED_TEXTURE_IMAGE_2D:
1361 case OPCODE_COMPRESSED_MULTITEX_IMAGE_2D:
1362 free(get_pointer(&n[9]));
1363 break;
1364 case OPCODE_COMPRESSED_TEXTURE_IMAGE_3D:
1365 case OPCODE_COMPRESSED_MULTITEX_IMAGE_3D:
1366 free(get_pointer(&n[10]));
1367 break;
1368 case OPCODE_NAMED_PROGRAM_STRING:
1369 free(get_pointer(&n[5]));
1370 break;
1371 case OPCODE_CONTINUE:
1372 n = (Node *) get_pointer(&n[1]);
1373 free(block);
1374 block = n;
1375 break;
1376 case OPCODE_END_OF_LIST:
1377 free(block);
1378 done = GL_TRUE;
1379 break;
1380 default:
1381 /* just increment 'n' pointer, below */
1382 ;
1383 }
1384
1385 if (opcode != OPCODE_CONTINUE) {
1386 assert(InstSize[opcode] > 0);
1387 n += InstSize[opcode];
1388 }
1389 }
1390 }
1391
1392 free(dlist->Label);
1393 free(dlist);
1394 }
1395
1396
1397 /**
1398 * Called by _mesa_HashWalk() to check if a display list which is being
1399 * deleted belongs to a bitmap texture atlas.
1400 */
1401 static void
1402 check_atlas_for_deleted_list(GLuint atlas_id, void *data, void *userData)
1403 {
1404 struct gl_bitmap_atlas *atlas = (struct gl_bitmap_atlas *) data;
1405 GLuint list_id = *((GLuint *) userData); /* the list being deleted */
1406
1407 /* See if the list_id falls in the range contained in this texture atlas */
1408 if (atlas->complete &&
1409 list_id >= atlas_id &&
1410 list_id < atlas_id + atlas->numBitmaps) {
1411 /* Mark the atlas as incomplete so it doesn't get used. But don't
1412 * delete it yet since we don't want to try to recreate it in the next
1413 * glCallLists.
1414 */
1415 atlas->complete = false;
1416 atlas->incomplete = true;
1417 }
1418 }
1419
1420
1421 /**
1422 * Destroy a display list and remove from hash table.
1423 * \param list - display list number
1424 */
1425 static void
1426 destroy_list(struct gl_context *ctx, GLuint list)
1427 {
1428 struct gl_display_list *dlist;
1429
1430 if (list == 0)
1431 return;
1432
1433 dlist = _mesa_lookup_list(ctx, list);
1434 if (!dlist)
1435 return;
1436
1437 if (is_bitmap_list(dlist)) {
1438 /* If we're destroying a simple glBitmap display list, there's a
1439 * chance that we're destroying a bitmap image that's in a texture
1440 * atlas. Examine all atlases to see if that's the case. There's
1441 * usually few (if any) atlases so this isn't expensive.
1442 */
1443 _mesa_HashWalk(ctx->Shared->BitmapAtlas,
1444 check_atlas_for_deleted_list, &list);
1445 }
1446
1447 _mesa_delete_list(ctx, dlist);
1448 _mesa_HashRemove(ctx->Shared->DisplayList, list);
1449 }
1450
1451
1452 /*
1453 * Translate the nth element of list from <type> to GLint.
1454 */
1455 static GLint
1456 translate_id(GLsizei n, GLenum type, const GLvoid * list)
1457 {
1458 GLbyte *bptr;
1459 GLubyte *ubptr;
1460 GLshort *sptr;
1461 GLushort *usptr;
1462 GLint *iptr;
1463 GLuint *uiptr;
1464 GLfloat *fptr;
1465
1466 switch (type) {
1467 case GL_BYTE:
1468 bptr = (GLbyte *) list;
1469 return (GLint) bptr[n];
1470 case GL_UNSIGNED_BYTE:
1471 ubptr = (GLubyte *) list;
1472 return (GLint) ubptr[n];
1473 case GL_SHORT:
1474 sptr = (GLshort *) list;
1475 return (GLint) sptr[n];
1476 case GL_UNSIGNED_SHORT:
1477 usptr = (GLushort *) list;
1478 return (GLint) usptr[n];
1479 case GL_INT:
1480 iptr = (GLint *) list;
1481 return iptr[n];
1482 case GL_UNSIGNED_INT:
1483 uiptr = (GLuint *) list;
1484 return (GLint) uiptr[n];
1485 case GL_FLOAT:
1486 fptr = (GLfloat *) list;
1487 return (GLint) floorf(fptr[n]);
1488 case GL_2_BYTES:
1489 ubptr = ((GLubyte *) list) + 2 * n;
1490 return (GLint) ubptr[0] * 256
1491 + (GLint) ubptr[1];
1492 case GL_3_BYTES:
1493 ubptr = ((GLubyte *) list) + 3 * n;
1494 return (GLint) ubptr[0] * 65536
1495 + (GLint) ubptr[1] * 256
1496 + (GLint) ubptr[2];
1497 case GL_4_BYTES:
1498 ubptr = ((GLubyte *) list) + 4 * n;
1499 return (GLint) ubptr[0] * 16777216
1500 + (GLint) ubptr[1] * 65536
1501 + (GLint) ubptr[2] * 256
1502 + (GLint) ubptr[3];
1503 default:
1504 return 0;
1505 }
1506 }
1507
1508
1509 /**
1510 * Wrapper for _mesa_unpack_image/bitmap() that handles pixel buffer objects.
1511 * If width < 0 or height < 0 or format or type are invalid we'll just
1512 * return NULL. We will not generate an error since OpenGL command
1513 * arguments aren't error-checked until the command is actually executed
1514 * (not when they're compiled).
1515 * But if we run out of memory, GL_OUT_OF_MEMORY will be recorded.
1516 */
1517 static GLvoid *
1518 unpack_image(struct gl_context *ctx, GLuint dimensions,
1519 GLsizei width, GLsizei height, GLsizei depth,
1520 GLenum format, GLenum type, const GLvoid * pixels,
1521 const struct gl_pixelstore_attrib *unpack)
1522 {
1523 if (width <= 0 || height <= 0) {
1524 return NULL;
1525 }
1526
1527 if (_mesa_bytes_per_pixel(format, type) < 0) {
1528 /* bad format and/or type */
1529 return NULL;
1530 }
1531
1532 if (!_mesa_is_bufferobj(unpack->BufferObj)) {
1533 /* no PBO */
1534 GLvoid *image;
1535
1536 image = _mesa_unpack_image(dimensions, width, height, depth,
1537 format, type, pixels, unpack);
1538 if (pixels && !image) {
1539 _mesa_error(ctx, GL_OUT_OF_MEMORY, "display list construction");
1540 }
1541 return image;
1542 }
1543 else if (_mesa_validate_pbo_access(dimensions, unpack, width, height,
1544 depth, format, type, INT_MAX, pixels)) {
1545 const GLubyte *map, *src;
1546 GLvoid *image;
1547
1548 map = (GLubyte *)
1549 ctx->Driver.MapBufferRange(ctx, 0, unpack->BufferObj->Size,
1550 GL_MAP_READ_BIT, unpack->BufferObj,
1551 MAP_INTERNAL);
1552 if (!map) {
1553 /* unable to map src buffer! */
1554 _mesa_error(ctx, GL_INVALID_OPERATION, "unable to map PBO");
1555 return NULL;
1556 }
1557
1558 src = ADD_POINTERS(map, pixels);
1559 image = _mesa_unpack_image(dimensions, width, height, depth,
1560 format, type, src, unpack);
1561
1562 ctx->Driver.UnmapBuffer(ctx, unpack->BufferObj, MAP_INTERNAL);
1563
1564 if (!image) {
1565 _mesa_error(ctx, GL_OUT_OF_MEMORY, "display list construction");
1566 }
1567 return image;
1568 }
1569
1570 /* bad access! */
1571 _mesa_error(ctx, GL_INVALID_OPERATION, "invalid PBO access");
1572 return NULL;
1573 }
1574
1575
1576 /** Return copy of memory */
1577 static void *
1578 memdup(const void *src, GLsizei bytes)
1579 {
1580 void *b = bytes >= 0 ? malloc(bytes) : NULL;
1581 if (b)
1582 memcpy(b, src, bytes);
1583 return b;
1584 }
1585
1586
1587 /**
1588 * Allocate space for a display list instruction (opcode + payload space).
1589 * \param opcode the instruction opcode (OPCODE_* value)
1590 * \param bytes instruction payload size (not counting opcode)
1591 * \param align8 does the payload need to be 8-byte aligned?
1592 * This is only relevant in 64-bit environments.
1593 * \return pointer to allocated memory (the payload will be at pointer+1)
1594 */
1595 static Node *
1596 dlist_alloc(struct gl_context *ctx, OpCode opcode, GLuint bytes, bool align8)
1597 {
1598 const GLuint numNodes = 1 + (bytes + sizeof(Node) - 1) / sizeof(Node);
1599 const GLuint contNodes = 1 + POINTER_DWORDS; /* size of continue info */
1600 GLuint nopNode;
1601 Node *n;
1602
1603 assert(bytes <= BLOCK_SIZE * sizeof(Node));
1604
1605 if (opcode < OPCODE_EXT_0) {
1606 if (InstSize[opcode] == 0) {
1607 /* save instruction size now */
1608 InstSize[opcode] = numNodes;
1609 }
1610 else {
1611 /* make sure instruction size agrees */
1612 assert(numNodes == InstSize[opcode]);
1613 }
1614 }
1615
1616 if (sizeof(void *) > sizeof(Node) && align8
1617 && ctx->ListState.CurrentPos % 2 == 0) {
1618 /* The opcode would get placed at node[0] and the payload would start
1619 * at node[1]. But the payload needs to be at an even offset (8-byte
1620 * multiple).
1621 */
1622 nopNode = 1;
1623 }
1624 else {
1625 nopNode = 0;
1626 }
1627
1628 if (ctx->ListState.CurrentPos + nopNode + numNodes + contNodes
1629 > BLOCK_SIZE) {
1630 /* This block is full. Allocate a new block and chain to it */
1631 Node *newblock;
1632 n = ctx->ListState.CurrentBlock + ctx->ListState.CurrentPos;
1633 n[0].opcode = OPCODE_CONTINUE;
1634 newblock = malloc(sizeof(Node) * BLOCK_SIZE);
1635 if (!newblock) {
1636 _mesa_error(ctx, GL_OUT_OF_MEMORY, "Building display list");
1637 return NULL;
1638 }
1639
1640 /* a fresh block should be 8-byte aligned on 64-bit systems */
1641 assert(((GLintptr) newblock) % sizeof(void *) == 0);
1642
1643 save_pointer(&n[1], newblock);
1644 ctx->ListState.CurrentBlock = newblock;
1645 ctx->ListState.CurrentPos = 0;
1646
1647 /* Display list nodes are always 4 bytes. If we need 8-byte alignment
1648 * we have to insert a NOP so that the payload of the real opcode lands
1649 * on an even location:
1650 * node[0] = OPCODE_NOP
1651 * node[1] = OPCODE_x;
1652 * node[2] = start of payload
1653 */
1654 nopNode = sizeof(void *) > sizeof(Node) && align8;
1655 }
1656
1657 n = ctx->ListState.CurrentBlock + ctx->ListState.CurrentPos;
1658 if (nopNode) {
1659 assert(ctx->ListState.CurrentPos % 2 == 0); /* even value */
1660 n[0].opcode = OPCODE_NOP;
1661 n++;
1662 /* The "real" opcode will now be at an odd location and the payload
1663 * will be at an even location.
1664 */
1665 }
1666 ctx->ListState.CurrentPos += nopNode + numNodes;
1667
1668 n[0].opcode = opcode;
1669
1670 return n;
1671 }
1672
1673
1674
1675 /**
1676 * Allocate space for a display list instruction. Used by callers outside
1677 * this file for things like VBO vertex data.
1678 *
1679 * \param opcode the instruction opcode (OPCODE_* value)
1680 * \param bytes instruction size in bytes, not counting opcode.
1681 * \return pointer to the usable data area (not including the internal
1682 * opcode).
1683 */
1684 void *
1685 _mesa_dlist_alloc(struct gl_context *ctx, GLuint opcode, GLuint bytes)
1686 {
1687 Node *n = dlist_alloc(ctx, (OpCode) opcode, bytes, false);
1688 if (n)
1689 return n + 1; /* return pointer to payload area, after opcode */
1690 else
1691 return NULL;
1692 }
1693
1694
1695 /**
1696 * Same as _mesa_dlist_alloc(), but return a pointer which is 8-byte
1697 * aligned in 64-bit environments, 4-byte aligned otherwise.
1698 */
1699 void *
1700 _mesa_dlist_alloc_aligned(struct gl_context *ctx, GLuint opcode, GLuint bytes)
1701 {
1702 Node *n = dlist_alloc(ctx, (OpCode) opcode, bytes, true);
1703 if (n)
1704 return n + 1; /* return pointer to payload area, after opcode */
1705 else
1706 return NULL;
1707 }
1708
1709
1710 /**
1711 * This function allows modules and drivers to get their own opcodes
1712 * for extending display list functionality.
1713 * \param ctx the rendering context
1714 * \param size number of bytes for storing the new display list command
1715 * \param execute function to execute the new display list command
1716 * \param destroy function to destroy the new display list command
1717 * \param print function to print the new display list command
1718 * \return the new opcode number or -1 if error
1719 */
1720 GLint
1721 _mesa_dlist_alloc_opcode(struct gl_context *ctx,
1722 GLuint size,
1723 void (*execute) (struct gl_context *, void *),
1724 void (*destroy) (struct gl_context *, void *),
1725 void (*print) (struct gl_context *, void *, FILE *))
1726 {
1727 if (ctx->ListExt->NumOpcodes < MAX_DLIST_EXT_OPCODES) {
1728 const GLuint i = ctx->ListExt->NumOpcodes++;
1729 ctx->ListExt->Opcode[i].Size =
1730 1 + (size + sizeof(Node) - 1) / sizeof(Node);
1731 ctx->ListExt->Opcode[i].Execute = execute;
1732 ctx->ListExt->Opcode[i].Destroy = destroy;
1733 ctx->ListExt->Opcode[i].Print = print;
1734 return i + OPCODE_EXT_0;
1735 }
1736 return -1;
1737 }
1738
1739
1740 /**
1741 * Allocate space for a display list instruction. The space is basically
1742 * an array of Nodes where node[0] holds the opcode, node[1] is the first
1743 * function parameter, node[2] is the second parameter, etc.
1744 *
1745 * \param opcode one of OPCODE_x
1746 * \param nparams number of function parameters
1747 * \return pointer to start of instruction space
1748 */
1749 static inline Node *
1750 alloc_instruction(struct gl_context *ctx, OpCode opcode, GLuint nparams)
1751 {
1752 return dlist_alloc(ctx, opcode, nparams * sizeof(Node), false);
1753 }
1754
1755
1756 /**
1757 * Called by EndList to try to reduce memory used for the list.
1758 */
1759 static void
1760 trim_list(struct gl_context *ctx)
1761 {
1762 /* If the list we're ending only has one allocated block of nodes/tokens
1763 * and its size isn't a full block size, realloc the block to use less
1764 * memory. This is important for apps that create many small display
1765 * lists and apps that use glXUseXFont (many lists each containing one
1766 * glBitmap call).
1767 * Note: we currently only trim display lists that allocated one block
1768 * of tokens. That hits the short list case which is what we're mainly
1769 * concerned with. Trimming longer lists would involve traversing the
1770 * linked list of blocks.
1771 */
1772 struct gl_dlist_state *list = &ctx->ListState;
1773
1774 if ((list->CurrentList->Head == list->CurrentBlock) &&
1775 (list->CurrentPos < BLOCK_SIZE)) {
1776 /* There's only one block and it's not full, so realloc */
1777 GLuint newSize = list->CurrentPos * sizeof(Node);
1778 list->CurrentList->Head =
1779 list->CurrentBlock = realloc(list->CurrentBlock, newSize);
1780 if (!list->CurrentBlock) {
1781 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glEndList");
1782 }
1783 }
1784 }
1785
1786
1787
1788 /*
1789 * Display List compilation functions
1790 */
1791 static void GLAPIENTRY
1792 save_Accum(GLenum op, GLfloat value)
1793 {
1794 GET_CURRENT_CONTEXT(ctx);
1795 Node *n;
1796 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1797 n = alloc_instruction(ctx, OPCODE_ACCUM, 2);
1798 if (n) {
1799 n[1].e = op;
1800 n[2].f = value;
1801 }
1802 if (ctx->ExecuteFlag) {
1803 CALL_Accum(ctx->Exec, (op, value));
1804 }
1805 }
1806
1807
1808 static void GLAPIENTRY
1809 save_AlphaFunc(GLenum func, GLclampf ref)
1810 {
1811 GET_CURRENT_CONTEXT(ctx);
1812 Node *n;
1813 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1814 n = alloc_instruction(ctx, OPCODE_ALPHA_FUNC, 2);
1815 if (n) {
1816 n[1].e = func;
1817 n[2].f = (GLfloat) ref;
1818 }
1819 if (ctx->ExecuteFlag) {
1820 CALL_AlphaFunc(ctx->Exec, (func, ref));
1821 }
1822 }
1823
1824
1825 static void GLAPIENTRY
1826 save_BindTexture(GLenum target, GLuint texture)
1827 {
1828 GET_CURRENT_CONTEXT(ctx);
1829 Node *n;
1830 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1831 n = alloc_instruction(ctx, OPCODE_BIND_TEXTURE, 2);
1832 if (n) {
1833 n[1].e = target;
1834 n[2].ui = texture;
1835 }
1836 if (ctx->ExecuteFlag) {
1837 CALL_BindTexture(ctx->Exec, (target, texture));
1838 }
1839 }
1840
1841
1842 static void GLAPIENTRY
1843 save_Bitmap(GLsizei width, GLsizei height,
1844 GLfloat xorig, GLfloat yorig,
1845 GLfloat xmove, GLfloat ymove, const GLubyte * pixels)
1846 {
1847 GET_CURRENT_CONTEXT(ctx);
1848 Node *n;
1849 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1850 n = alloc_instruction(ctx, OPCODE_BITMAP, 6 + POINTER_DWORDS);
1851 if (n) {
1852 n[1].i = (GLint) width;
1853 n[2].i = (GLint) height;
1854 n[3].f = xorig;
1855 n[4].f = yorig;
1856 n[5].f = xmove;
1857 n[6].f = ymove;
1858 save_pointer(&n[7],
1859 unpack_image(ctx, 2, width, height, 1, GL_COLOR_INDEX,
1860 GL_BITMAP, pixels, &ctx->Unpack));
1861 }
1862 if (ctx->ExecuteFlag) {
1863 CALL_Bitmap(ctx->Exec, (width, height,
1864 xorig, yorig, xmove, ymove, pixels));
1865 }
1866 }
1867
1868
1869 static void GLAPIENTRY
1870 save_BlendEquation(GLenum mode)
1871 {
1872 GET_CURRENT_CONTEXT(ctx);
1873 Node *n;
1874 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1875 n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION, 1);
1876 if (n) {
1877 n[1].e = mode;
1878 }
1879 if (ctx->ExecuteFlag) {
1880 CALL_BlendEquation(ctx->Exec, (mode));
1881 }
1882 }
1883
1884
1885 static void GLAPIENTRY
1886 save_BlendEquationSeparateEXT(GLenum modeRGB, GLenum modeA)
1887 {
1888 GET_CURRENT_CONTEXT(ctx);
1889 Node *n;
1890 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1891 n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION_SEPARATE, 2);
1892 if (n) {
1893 n[1].e = modeRGB;
1894 n[2].e = modeA;
1895 }
1896 if (ctx->ExecuteFlag) {
1897 CALL_BlendEquationSeparate(ctx->Exec, (modeRGB, modeA));
1898 }
1899 }
1900
1901
1902 static void GLAPIENTRY
1903 save_BlendFuncSeparateEXT(GLenum sfactorRGB, GLenum dfactorRGB,
1904 GLenum sfactorA, GLenum dfactorA)
1905 {
1906 GET_CURRENT_CONTEXT(ctx);
1907 Node *n;
1908 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1909 n = alloc_instruction(ctx, OPCODE_BLEND_FUNC_SEPARATE, 4);
1910 if (n) {
1911 n[1].e = sfactorRGB;
1912 n[2].e = dfactorRGB;
1913 n[3].e = sfactorA;
1914 n[4].e = dfactorA;
1915 }
1916 if (ctx->ExecuteFlag) {
1917 CALL_BlendFuncSeparate(ctx->Exec,
1918 (sfactorRGB, dfactorRGB, sfactorA, dfactorA));
1919 }
1920 }
1921
1922
1923 static void GLAPIENTRY
1924 save_BlendFunc(GLenum srcfactor, GLenum dstfactor)
1925 {
1926 save_BlendFuncSeparateEXT(srcfactor, dstfactor, srcfactor, dstfactor);
1927 }
1928
1929
1930 static void GLAPIENTRY
1931 save_BlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
1932 {
1933 GET_CURRENT_CONTEXT(ctx);
1934 Node *n;
1935 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1936 n = alloc_instruction(ctx, OPCODE_BLEND_COLOR, 4);
1937 if (n) {
1938 n[1].f = red;
1939 n[2].f = green;
1940 n[3].f = blue;
1941 n[4].f = alpha;
1942 }
1943 if (ctx->ExecuteFlag) {
1944 CALL_BlendColor(ctx->Exec, (red, green, blue, alpha));
1945 }
1946 }
1947
1948 /* GL_ARB_draw_buffers_blend */
1949 static void GLAPIENTRY
1950 save_BlendFuncSeparatei(GLuint buf, GLenum sfactorRGB, GLenum dfactorRGB,
1951 GLenum sfactorA, GLenum dfactorA)
1952 {
1953 GET_CURRENT_CONTEXT(ctx);
1954 Node *n;
1955 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1956 n = alloc_instruction(ctx, OPCODE_BLEND_FUNC_SEPARATE_I, 5);
1957 if (n) {
1958 n[1].ui = buf;
1959 n[2].e = sfactorRGB;
1960 n[3].e = dfactorRGB;
1961 n[4].e = sfactorA;
1962 n[5].e = dfactorA;
1963 }
1964 if (ctx->ExecuteFlag) {
1965 CALL_BlendFuncSeparateiARB(ctx->Exec, (buf, sfactorRGB, dfactorRGB,
1966 sfactorA, dfactorA));
1967 }
1968 }
1969
1970 /* GL_ARB_draw_buffers_blend */
1971 static void GLAPIENTRY
1972 save_BlendFunci(GLuint buf, GLenum sfactor, GLenum dfactor)
1973 {
1974 GET_CURRENT_CONTEXT(ctx);
1975 Node *n;
1976 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1977 n = alloc_instruction(ctx, OPCODE_BLEND_FUNC_I, 3);
1978 if (n) {
1979 n[1].ui = buf;
1980 n[2].e = sfactor;
1981 n[3].e = dfactor;
1982 }
1983 if (ctx->ExecuteFlag) {
1984 CALL_BlendFunciARB(ctx->Exec, (buf, sfactor, dfactor));
1985 }
1986 }
1987
1988 /* GL_ARB_draw_buffers_blend */
1989 static void GLAPIENTRY
1990 save_BlendEquationi(GLuint buf, GLenum mode)
1991 {
1992 GET_CURRENT_CONTEXT(ctx);
1993 Node *n;
1994 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1995 n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION_I, 2);
1996 if (n) {
1997 n[1].ui = buf;
1998 n[2].e = mode;
1999 }
2000 if (ctx->ExecuteFlag) {
2001 CALL_BlendEquationiARB(ctx->Exec, (buf, mode));
2002 }
2003 }
2004
2005 /* GL_ARB_draw_buffers_blend */
2006 static void GLAPIENTRY
2007 save_BlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeA)
2008 {
2009 GET_CURRENT_CONTEXT(ctx);
2010 Node *n;
2011 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2012 n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION_SEPARATE_I, 3);
2013 if (n) {
2014 n[1].ui = buf;
2015 n[2].e = modeRGB;
2016 n[3].e = modeA;
2017 }
2018 if (ctx->ExecuteFlag) {
2019 CALL_BlendEquationSeparateiARB(ctx->Exec, (buf, modeRGB, modeA));
2020 }
2021 }
2022
2023
2024 /* GL_ARB_draw_instanced. */
2025 static void GLAPIENTRY
2026 save_DrawArraysInstancedARB(UNUSED GLenum mode,
2027 UNUSED GLint first,
2028 UNUSED GLsizei count,
2029 UNUSED GLsizei primcount)
2030 {
2031 GET_CURRENT_CONTEXT(ctx);
2032 _mesa_error(ctx, GL_INVALID_OPERATION,
2033 "glDrawArraysInstanced() during display list compile");
2034 }
2035
2036 static void GLAPIENTRY
2037 save_DrawElementsInstancedARB(UNUSED GLenum mode,
2038 UNUSED GLsizei count,
2039 UNUSED GLenum type,
2040 UNUSED const GLvoid *indices,
2041 UNUSED GLsizei primcount)
2042 {
2043 GET_CURRENT_CONTEXT(ctx);
2044 _mesa_error(ctx, GL_INVALID_OPERATION,
2045 "glDrawElementsInstanced() during display list compile");
2046 }
2047
2048 static void GLAPIENTRY
2049 save_DrawElementsInstancedBaseVertexARB(UNUSED GLenum mode,
2050 UNUSED GLsizei count,
2051 UNUSED GLenum type,
2052 UNUSED const GLvoid *indices,
2053 UNUSED GLsizei primcount,
2054 UNUSED GLint basevertex)
2055 {
2056 GET_CURRENT_CONTEXT(ctx);
2057 _mesa_error(ctx, GL_INVALID_OPERATION,
2058 "glDrawElementsInstancedBaseVertex() during display list compile");
2059 }
2060
2061 /* GL_ARB_base_instance. */
2062 static void GLAPIENTRY
2063 save_DrawArraysInstancedBaseInstance(UNUSED GLenum mode,
2064 UNUSED GLint first,
2065 UNUSED GLsizei count,
2066 UNUSED GLsizei primcount,
2067 UNUSED GLuint baseinstance)
2068 {
2069 GET_CURRENT_CONTEXT(ctx);
2070 _mesa_error(ctx, GL_INVALID_OPERATION,
2071 "glDrawArraysInstancedBaseInstance() during display list compile");
2072 }
2073
2074 static void APIENTRY
2075 save_DrawElementsInstancedBaseInstance(UNUSED GLenum mode,
2076 UNUSED GLsizei count,
2077 UNUSED GLenum type,
2078 UNUSED const void *indices,
2079 UNUSED GLsizei primcount,
2080 UNUSED GLuint baseinstance)
2081 {
2082 GET_CURRENT_CONTEXT(ctx);
2083 _mesa_error(ctx, GL_INVALID_OPERATION,
2084 "glDrawElementsInstancedBaseInstance() during display list compile");
2085 }
2086
2087 static void APIENTRY
2088 save_DrawElementsInstancedBaseVertexBaseInstance(UNUSED GLenum mode,
2089 UNUSED GLsizei count,
2090 UNUSED GLenum type,
2091 UNUSED const void *indices,
2092 UNUSED GLsizei primcount,
2093 UNUSED GLint basevertex,
2094 UNUSED GLuint baseinstance)
2095 {
2096 GET_CURRENT_CONTEXT(ctx);
2097 _mesa_error(ctx, GL_INVALID_OPERATION,
2098 "glDrawElementsInstancedBaseVertexBaseInstance() during display list compile");
2099 }
2100
2101 static void APIENTRY
2102 save_DrawArraysIndirect(UNUSED GLenum mode,
2103 UNUSED const void *indirect)
2104 {
2105 GET_CURRENT_CONTEXT(ctx);
2106 _mesa_error(ctx, GL_INVALID_OPERATION,
2107 "glDrawArraysIndirect() during display list compile");
2108 }
2109
2110 static void APIENTRY
2111 save_DrawElementsIndirect(UNUSED GLenum mode,
2112 UNUSED GLenum type,
2113 UNUSED const void *indirect)
2114 {
2115 GET_CURRENT_CONTEXT(ctx);
2116 _mesa_error(ctx, GL_INVALID_OPERATION,
2117 "glDrawElementsIndirect() during display list compile");
2118 }
2119
2120 static void APIENTRY
2121 save_MultiDrawArraysIndirect(UNUSED GLenum mode,
2122 UNUSED const void *indirect,
2123 UNUSED GLsizei primcount,
2124 UNUSED GLsizei stride)
2125 {
2126 GET_CURRENT_CONTEXT(ctx);
2127 _mesa_error(ctx, GL_INVALID_OPERATION,
2128 "glMultiDrawArraysIndirect() during display list compile");
2129 }
2130
2131 static void APIENTRY
2132 save_MultiDrawElementsIndirect(UNUSED GLenum mode,
2133 UNUSED GLenum type,
2134 UNUSED const void *indirect,
2135 UNUSED GLsizei primcount,
2136 UNUSED GLsizei stride)
2137 {
2138 GET_CURRENT_CONTEXT(ctx);
2139 _mesa_error(ctx, GL_INVALID_OPERATION,
2140 "glMultiDrawElementsIndirect() during display list compile");
2141 }
2142
2143 /**
2144 * While building a display list we cache some OpenGL state.
2145 * Under some circumstances we need to invalidate that state (immediately
2146 * when we start compiling a list, or after glCallList(s)).
2147 */
2148 static void
2149 invalidate_saved_current_state(struct gl_context *ctx)
2150 {
2151 GLint i;
2152
2153 for (i = 0; i < VERT_ATTRIB_MAX; i++)
2154 ctx->ListState.ActiveAttribSize[i] = 0;
2155
2156 for (i = 0; i < MAT_ATTRIB_MAX; i++)
2157 ctx->ListState.ActiveMaterialSize[i] = 0;
2158
2159 memset(&ctx->ListState.Current, 0, sizeof ctx->ListState.Current);
2160
2161 ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN;
2162 }
2163
2164
2165 static void GLAPIENTRY
2166 save_CallList(GLuint list)
2167 {
2168 GET_CURRENT_CONTEXT(ctx);
2169 Node *n;
2170 SAVE_FLUSH_VERTICES(ctx);
2171
2172 n = alloc_instruction(ctx, OPCODE_CALL_LIST, 1);
2173 if (n) {
2174 n[1].ui = list;
2175 }
2176
2177 /* After this, we don't know what state we're in. Invalidate all
2178 * cached information previously gathered:
2179 */
2180 invalidate_saved_current_state( ctx );
2181
2182 if (ctx->ExecuteFlag) {
2183 _mesa_CallList(list);
2184 }
2185 }
2186
2187
2188 static void GLAPIENTRY
2189 save_CallLists(GLsizei num, GLenum type, const GLvoid * lists)
2190 {
2191 GET_CURRENT_CONTEXT(ctx);
2192 unsigned type_size;
2193 Node *n;
2194 void *lists_copy;
2195
2196 SAVE_FLUSH_VERTICES(ctx);
2197
2198 switch (type) {
2199 case GL_BYTE:
2200 case GL_UNSIGNED_BYTE:
2201 type_size = 1;
2202 break;
2203 case GL_SHORT:
2204 case GL_UNSIGNED_SHORT:
2205 case GL_2_BYTES:
2206 type_size = 2;
2207 break;
2208 case GL_3_BYTES:
2209 type_size = 3;
2210 break;
2211 case GL_INT:
2212 case GL_UNSIGNED_INT:
2213 case GL_FLOAT:
2214 case GL_4_BYTES:
2215 type_size = 4;
2216 break;
2217 default:
2218 type_size = 0;
2219 }
2220
2221 if (num > 0 && type_size > 0) {
2222 /* create a copy of the array of list IDs to save in the display list */
2223 lists_copy = memdup(lists, num * type_size);
2224 } else {
2225 lists_copy = NULL;
2226 }
2227
2228 n = alloc_instruction(ctx, OPCODE_CALL_LISTS, 2 + POINTER_DWORDS);
2229 if (n) {
2230 n[1].i = num;
2231 n[2].e = type;
2232 save_pointer(&n[3], lists_copy);
2233 }
2234
2235 /* After this, we don't know what state we're in. Invalidate all
2236 * cached information previously gathered:
2237 */
2238 invalidate_saved_current_state( ctx );
2239
2240 if (ctx->ExecuteFlag) {
2241 CALL_CallLists(ctx->Exec, (num, type, lists));
2242 }
2243 }
2244
2245
2246 static void GLAPIENTRY
2247 save_Clear(GLbitfield mask)
2248 {
2249 GET_CURRENT_CONTEXT(ctx);
2250 Node *n;
2251 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2252 n = alloc_instruction(ctx, OPCODE_CLEAR, 1);
2253 if (n) {
2254 n[1].bf = mask;
2255 }
2256 if (ctx->ExecuteFlag) {
2257 CALL_Clear(ctx->Exec, (mask));
2258 }
2259 }
2260
2261
2262 static void GLAPIENTRY
2263 save_ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value)
2264 {
2265 GET_CURRENT_CONTEXT(ctx);
2266 Node *n;
2267 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2268 n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_IV, 6);
2269 if (n) {
2270 n[1].e = buffer;
2271 n[2].i = drawbuffer;
2272 n[3].i = value[0];
2273 if (buffer == GL_COLOR) {
2274 n[4].i = value[1];
2275 n[5].i = value[2];
2276 n[6].i = value[3];
2277 }
2278 else {
2279 n[4].i = 0;
2280 n[5].i = 0;
2281 n[6].i = 0;
2282 }
2283 }
2284 if (ctx->ExecuteFlag) {
2285 CALL_ClearBufferiv(ctx->Exec, (buffer, drawbuffer, value));
2286 }
2287 }
2288
2289
2290 static void GLAPIENTRY
2291 save_ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value)
2292 {
2293 GET_CURRENT_CONTEXT(ctx);
2294 Node *n;
2295 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2296 n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_UIV, 6);
2297 if (n) {
2298 n[1].e = buffer;
2299 n[2].i = drawbuffer;
2300 n[3].ui = value[0];
2301 if (buffer == GL_COLOR) {
2302 n[4].ui = value[1];
2303 n[5].ui = value[2];
2304 n[6].ui = value[3];
2305 }
2306 else {
2307 n[4].ui = 0;
2308 n[5].ui = 0;
2309 n[6].ui = 0;
2310 }
2311 }
2312 if (ctx->ExecuteFlag) {
2313 CALL_ClearBufferuiv(ctx->Exec, (buffer, drawbuffer, value));
2314 }
2315 }
2316
2317
2318 static void GLAPIENTRY
2319 save_ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
2320 {
2321 GET_CURRENT_CONTEXT(ctx);
2322 Node *n;
2323 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2324 n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_FV, 6);
2325 if (n) {
2326 n[1].e = buffer;
2327 n[2].i = drawbuffer;
2328 n[3].f = value[0];
2329 if (buffer == GL_COLOR) {
2330 n[4].f = value[1];
2331 n[5].f = value[2];
2332 n[6].f = value[3];
2333 }
2334 else {
2335 n[4].f = 0.0F;
2336 n[5].f = 0.0F;
2337 n[6].f = 0.0F;
2338 }
2339 }
2340 if (ctx->ExecuteFlag) {
2341 CALL_ClearBufferfv(ctx->Exec, (buffer, drawbuffer, value));
2342 }
2343 }
2344
2345
2346 static void GLAPIENTRY
2347 save_ClearBufferfi(GLenum buffer, GLint drawbuffer,
2348 GLfloat depth, GLint stencil)
2349 {
2350 GET_CURRENT_CONTEXT(ctx);
2351 Node *n;
2352 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2353 n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_FI, 4);
2354 if (n) {
2355 n[1].e = buffer;
2356 n[2].i = drawbuffer;
2357 n[3].f = depth;
2358 n[4].i = stencil;
2359 }
2360 if (ctx->ExecuteFlag) {
2361 CALL_ClearBufferfi(ctx->Exec, (buffer, drawbuffer, depth, stencil));
2362 }
2363 }
2364
2365
2366 static void GLAPIENTRY
2367 save_ClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
2368 {
2369 GET_CURRENT_CONTEXT(ctx);
2370 Node *n;
2371 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2372 n = alloc_instruction(ctx, OPCODE_CLEAR_ACCUM, 4);
2373 if (n) {
2374 n[1].f = red;
2375 n[2].f = green;
2376 n[3].f = blue;
2377 n[4].f = alpha;
2378 }
2379 if (ctx->ExecuteFlag) {
2380 CALL_ClearAccum(ctx->Exec, (red, green, blue, alpha));
2381 }
2382 }
2383
2384
2385 static void GLAPIENTRY
2386 save_ClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
2387 {
2388 GET_CURRENT_CONTEXT(ctx);
2389 Node *n;
2390 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2391 n = alloc_instruction(ctx, OPCODE_CLEAR_COLOR, 4);
2392 if (n) {
2393 n[1].f = red;
2394 n[2].f = green;
2395 n[3].f = blue;
2396 n[4].f = alpha;
2397 }
2398 if (ctx->ExecuteFlag) {
2399 CALL_ClearColor(ctx->Exec, (red, green, blue, alpha));
2400 }
2401 }
2402
2403
2404 static void GLAPIENTRY
2405 save_ClearDepth(GLclampd depth)
2406 {
2407 GET_CURRENT_CONTEXT(ctx);
2408 Node *n;
2409 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2410 n = alloc_instruction(ctx, OPCODE_CLEAR_DEPTH, 1);
2411 if (n) {
2412 n[1].f = (GLfloat) depth;
2413 }
2414 if (ctx->ExecuteFlag) {
2415 CALL_ClearDepth(ctx->Exec, (depth));
2416 }
2417 }
2418
2419
2420 static void GLAPIENTRY
2421 save_ClearIndex(GLfloat c)
2422 {
2423 GET_CURRENT_CONTEXT(ctx);
2424 Node *n;
2425 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2426 n = alloc_instruction(ctx, OPCODE_CLEAR_INDEX, 1);
2427 if (n) {
2428 n[1].f = c;
2429 }
2430 if (ctx->ExecuteFlag) {
2431 CALL_ClearIndex(ctx->Exec, (c));
2432 }
2433 }
2434
2435
2436 static void GLAPIENTRY
2437 save_ClearStencil(GLint s)
2438 {
2439 GET_CURRENT_CONTEXT(ctx);
2440 Node *n;
2441 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2442 n = alloc_instruction(ctx, OPCODE_CLEAR_STENCIL, 1);
2443 if (n) {
2444 n[1].i = s;
2445 }
2446 if (ctx->ExecuteFlag) {
2447 CALL_ClearStencil(ctx->Exec, (s));
2448 }
2449 }
2450
2451
2452 static void GLAPIENTRY
2453 save_ClipPlane(GLenum plane, const GLdouble * equ)
2454 {
2455 GET_CURRENT_CONTEXT(ctx);
2456 Node *n;
2457 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2458 n = alloc_instruction(ctx, OPCODE_CLIP_PLANE, 5);
2459 if (n) {
2460 n[1].e = plane;
2461 n[2].f = (GLfloat) equ[0];
2462 n[3].f = (GLfloat) equ[1];
2463 n[4].f = (GLfloat) equ[2];
2464 n[5].f = (GLfloat) equ[3];
2465 }
2466 if (ctx->ExecuteFlag) {
2467 CALL_ClipPlane(ctx->Exec, (plane, equ));
2468 }
2469 }
2470
2471
2472
2473 static void GLAPIENTRY
2474 save_ColorMask(GLboolean red, GLboolean green,
2475 GLboolean blue, GLboolean alpha)
2476 {
2477 GET_CURRENT_CONTEXT(ctx);
2478 Node *n;
2479 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2480 n = alloc_instruction(ctx, OPCODE_COLOR_MASK, 4);
2481 if (n) {
2482 n[1].b = red;
2483 n[2].b = green;
2484 n[3].b = blue;
2485 n[4].b = alpha;
2486 }
2487 if (ctx->ExecuteFlag) {
2488 CALL_ColorMask(ctx->Exec, (red, green, blue, alpha));
2489 }
2490 }
2491
2492
2493 static void GLAPIENTRY
2494 save_ColorMaskIndexed(GLuint buf, GLboolean red, GLboolean green,
2495 GLboolean blue, GLboolean alpha)
2496 {
2497 GET_CURRENT_CONTEXT(ctx);
2498 Node *n;
2499 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2500 n = alloc_instruction(ctx, OPCODE_COLOR_MASK_INDEXED, 5);
2501 if (n) {
2502 n[1].ui = buf;
2503 n[2].b = red;
2504 n[3].b = green;
2505 n[4].b = blue;
2506 n[5].b = alpha;
2507 }
2508 if (ctx->ExecuteFlag) {
2509 /*CALL_ColorMaski(ctx->Exec, (buf, red, green, blue, alpha));*/
2510 }
2511 }
2512
2513
2514 static void GLAPIENTRY
2515 save_ColorMaterial(GLenum face, GLenum mode)
2516 {
2517 GET_CURRENT_CONTEXT(ctx);
2518 Node *n;
2519 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2520
2521 n = alloc_instruction(ctx, OPCODE_COLOR_MATERIAL, 2);
2522 if (n) {
2523 n[1].e = face;
2524 n[2].e = mode;
2525 }
2526 if (ctx->ExecuteFlag) {
2527 CALL_ColorMaterial(ctx->Exec, (face, mode));
2528 }
2529 }
2530
2531
2532 static void GLAPIENTRY
2533 save_CopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type)
2534 {
2535 GET_CURRENT_CONTEXT(ctx);
2536 Node *n;
2537 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2538 n = alloc_instruction(ctx, OPCODE_COPY_PIXELS, 5);
2539 if (n) {
2540 n[1].i = x;
2541 n[2].i = y;
2542 n[3].i = (GLint) width;
2543 n[4].i = (GLint) height;
2544 n[5].e = type;
2545 }
2546 if (ctx->ExecuteFlag) {
2547 CALL_CopyPixels(ctx->Exec, (x, y, width, height, type));
2548 }
2549 }
2550
2551
2552
2553 static void GLAPIENTRY
2554 save_CopyTexImage1D(GLenum target, GLint level, GLenum internalformat,
2555 GLint x, GLint y, GLsizei width, GLint border)
2556 {
2557 GET_CURRENT_CONTEXT(ctx);
2558 Node *n;
2559 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2560 n = alloc_instruction(ctx, OPCODE_COPY_TEX_IMAGE1D, 7);
2561 if (n) {
2562 n[1].e = target;
2563 n[2].i = level;
2564 n[3].e = internalformat;
2565 n[4].i = x;
2566 n[5].i = y;
2567 n[6].i = width;
2568 n[7].i = border;
2569 }
2570 if (ctx->ExecuteFlag) {
2571 CALL_CopyTexImage1D(ctx->Exec, (target, level, internalformat,
2572 x, y, width, border));
2573 }
2574 }
2575
2576
2577 static void GLAPIENTRY
2578 save_CopyTexImage2D(GLenum target, GLint level,
2579 GLenum internalformat,
2580 GLint x, GLint y, GLsizei width,
2581 GLsizei height, GLint border)
2582 {
2583 GET_CURRENT_CONTEXT(ctx);
2584 Node *n;
2585 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2586 n = alloc_instruction(ctx, OPCODE_COPY_TEX_IMAGE2D, 8);
2587 if (n) {
2588 n[1].e = target;
2589 n[2].i = level;
2590 n[3].e = internalformat;
2591 n[4].i = x;
2592 n[5].i = y;
2593 n[6].i = width;
2594 n[7].i = height;
2595 n[8].i = border;
2596 }
2597 if (ctx->ExecuteFlag) {
2598 CALL_CopyTexImage2D(ctx->Exec, (target, level, internalformat,
2599 x, y, width, height, border));
2600 }
2601 }
2602
2603
2604
2605 static void GLAPIENTRY
2606 save_CopyTexSubImage1D(GLenum target, GLint level,
2607 GLint xoffset, GLint x, GLint y, GLsizei width)
2608 {
2609 GET_CURRENT_CONTEXT(ctx);
2610 Node *n;
2611 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2612 n = alloc_instruction(ctx, OPCODE_COPY_TEX_SUB_IMAGE1D, 6);
2613 if (n) {
2614 n[1].e = target;
2615 n[2].i = level;
2616 n[3].i = xoffset;
2617 n[4].i = x;
2618 n[5].i = y;
2619 n[6].i = width;
2620 }
2621 if (ctx->ExecuteFlag) {
2622 CALL_CopyTexSubImage1D(ctx->Exec,
2623 (target, level, xoffset, x, y, width));
2624 }
2625 }
2626
2627
2628 static void GLAPIENTRY
2629 save_CopyTexSubImage2D(GLenum target, GLint level,
2630 GLint xoffset, GLint yoffset,
2631 GLint x, GLint y, GLsizei width, GLint height)
2632 {
2633 GET_CURRENT_CONTEXT(ctx);
2634 Node *n;
2635 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2636 n = alloc_instruction(ctx, OPCODE_COPY_TEX_SUB_IMAGE2D, 8);
2637 if (n) {
2638 n[1].e = target;
2639 n[2].i = level;
2640 n[3].i = xoffset;
2641 n[4].i = yoffset;
2642 n[5].i = x;
2643 n[6].i = y;
2644 n[7].i = width;
2645 n[8].i = height;
2646 }
2647 if (ctx->ExecuteFlag) {
2648 CALL_CopyTexSubImage2D(ctx->Exec, (target, level, xoffset, yoffset,
2649 x, y, width, height));
2650 }
2651 }
2652
2653
2654 static void GLAPIENTRY
2655 save_CopyTexSubImage3D(GLenum target, GLint level,
2656 GLint xoffset, GLint yoffset, GLint zoffset,
2657 GLint x, GLint y, GLsizei width, GLint height)
2658 {
2659 GET_CURRENT_CONTEXT(ctx);
2660 Node *n;
2661 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2662 n = alloc_instruction(ctx, OPCODE_COPY_TEX_SUB_IMAGE3D, 9);
2663 if (n) {
2664 n[1].e = target;
2665 n[2].i = level;
2666 n[3].i = xoffset;
2667 n[4].i = yoffset;
2668 n[5].i = zoffset;
2669 n[6].i = x;
2670 n[7].i = y;
2671 n[8].i = width;
2672 n[9].i = height;
2673 }
2674 if (ctx->ExecuteFlag) {
2675 CALL_CopyTexSubImage3D(ctx->Exec, (target, level,
2676 xoffset, yoffset, zoffset,
2677 x, y, width, height));
2678 }
2679 }
2680
2681
2682 static void GLAPIENTRY
2683 save_CullFace(GLenum mode)
2684 {
2685 GET_CURRENT_CONTEXT(ctx);
2686 Node *n;
2687 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2688 n = alloc_instruction(ctx, OPCODE_CULL_FACE, 1);
2689 if (n) {
2690 n[1].e = mode;
2691 }
2692 if (ctx->ExecuteFlag) {
2693 CALL_CullFace(ctx->Exec, (mode));
2694 }
2695 }
2696
2697
2698 static void GLAPIENTRY
2699 save_DepthFunc(GLenum func)
2700 {
2701 GET_CURRENT_CONTEXT(ctx);
2702 Node *n;
2703 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2704 n = alloc_instruction(ctx, OPCODE_DEPTH_FUNC, 1);
2705 if (n) {
2706 n[1].e = func;
2707 }
2708 if (ctx->ExecuteFlag) {
2709 CALL_DepthFunc(ctx->Exec, (func));
2710 }
2711 }
2712
2713
2714 static void GLAPIENTRY
2715 save_DepthMask(GLboolean mask)
2716 {
2717 GET_CURRENT_CONTEXT(ctx);
2718 Node *n;
2719 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2720 n = alloc_instruction(ctx, OPCODE_DEPTH_MASK, 1);
2721 if (n) {
2722 n[1].b = mask;
2723 }
2724 if (ctx->ExecuteFlag) {
2725 CALL_DepthMask(ctx->Exec, (mask));
2726 }
2727 }
2728
2729
2730 static void GLAPIENTRY
2731 save_DepthRange(GLclampd nearval, GLclampd farval)
2732 {
2733 GET_CURRENT_CONTEXT(ctx);
2734 Node *n;
2735 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2736 n = alloc_instruction(ctx, OPCODE_DEPTH_RANGE, 2);
2737 if (n) {
2738 n[1].f = (GLfloat) nearval;
2739 n[2].f = (GLfloat) farval;
2740 }
2741 if (ctx->ExecuteFlag) {
2742 CALL_DepthRange(ctx->Exec, (nearval, farval));
2743 }
2744 }
2745
2746
2747 static void GLAPIENTRY
2748 save_Disable(GLenum cap)
2749 {
2750 GET_CURRENT_CONTEXT(ctx);
2751 Node *n;
2752 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2753 n = alloc_instruction(ctx, OPCODE_DISABLE, 1);
2754 if (n) {
2755 n[1].e = cap;
2756 }
2757 if (ctx->ExecuteFlag) {
2758 CALL_Disable(ctx->Exec, (cap));
2759 }
2760 }
2761
2762
2763 static void GLAPIENTRY
2764 save_DisableIndexed(GLuint index, GLenum cap)
2765 {
2766 GET_CURRENT_CONTEXT(ctx);
2767 Node *n;
2768 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2769 n = alloc_instruction(ctx, OPCODE_DISABLE_INDEXED, 2);
2770 if (n) {
2771 n[1].ui = index;
2772 n[2].e = cap;
2773 }
2774 if (ctx->ExecuteFlag) {
2775 CALL_Disablei(ctx->Exec, (index, cap));
2776 }
2777 }
2778
2779
2780 static void GLAPIENTRY
2781 save_DrawBuffer(GLenum mode)
2782 {
2783 GET_CURRENT_CONTEXT(ctx);
2784 Node *n;
2785 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2786 n = alloc_instruction(ctx, OPCODE_DRAW_BUFFER, 1);
2787 if (n) {
2788 n[1].e = mode;
2789 }
2790 if (ctx->ExecuteFlag) {
2791 CALL_DrawBuffer(ctx->Exec, (mode));
2792 }
2793 }
2794
2795
2796 static void GLAPIENTRY
2797 save_DrawPixels(GLsizei width, GLsizei height,
2798 GLenum format, GLenum type, const GLvoid * pixels)
2799 {
2800 GET_CURRENT_CONTEXT(ctx);
2801 Node *n;
2802
2803 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2804
2805 n = alloc_instruction(ctx, OPCODE_DRAW_PIXELS, 4 + POINTER_DWORDS);
2806 if (n) {
2807 n[1].i = width;
2808 n[2].i = height;
2809 n[3].e = format;
2810 n[4].e = type;
2811 save_pointer(&n[5],
2812 unpack_image(ctx, 2, width, height, 1, format, type,
2813 pixels, &ctx->Unpack));
2814 }
2815 if (ctx->ExecuteFlag) {
2816 CALL_DrawPixels(ctx->Exec, (width, height, format, type, pixels));
2817 }
2818 }
2819
2820
2821
2822 static void GLAPIENTRY
2823 save_Enable(GLenum cap)
2824 {
2825 GET_CURRENT_CONTEXT(ctx);
2826 Node *n;
2827 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2828 n = alloc_instruction(ctx, OPCODE_ENABLE, 1);
2829 if (n) {
2830 n[1].e = cap;
2831 }
2832 if (ctx->ExecuteFlag) {
2833 CALL_Enable(ctx->Exec, (cap));
2834 }
2835 }
2836
2837
2838
2839 static void GLAPIENTRY
2840 save_EnableIndexed(GLuint index, GLenum cap)
2841 {
2842 GET_CURRENT_CONTEXT(ctx);
2843 Node *n;
2844 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2845 n = alloc_instruction(ctx, OPCODE_ENABLE_INDEXED, 2);
2846 if (n) {
2847 n[1].ui = index;
2848 n[2].e = cap;
2849 }
2850 if (ctx->ExecuteFlag) {
2851 CALL_Enablei(ctx->Exec, (index, cap));
2852 }
2853 }
2854
2855
2856
2857 static void GLAPIENTRY
2858 save_EvalMesh1(GLenum mode, GLint i1, GLint i2)
2859 {
2860 GET_CURRENT_CONTEXT(ctx);
2861 Node *n;
2862 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2863 n = alloc_instruction(ctx, OPCODE_EVALMESH1, 3);
2864 if (n) {
2865 n[1].e = mode;
2866 n[2].i = i1;
2867 n[3].i = i2;
2868 }
2869 if (ctx->ExecuteFlag) {
2870 CALL_EvalMesh1(ctx->Exec, (mode, i1, i2));
2871 }
2872 }
2873
2874
2875 static void GLAPIENTRY
2876 save_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)
2877 {
2878 GET_CURRENT_CONTEXT(ctx);
2879 Node *n;
2880 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2881 n = alloc_instruction(ctx, OPCODE_EVALMESH2, 5);
2882 if (n) {
2883 n[1].e = mode;
2884 n[2].i = i1;
2885 n[3].i = i2;
2886 n[4].i = j1;
2887 n[5].i = j2;
2888 }
2889 if (ctx->ExecuteFlag) {
2890 CALL_EvalMesh2(ctx->Exec, (mode, i1, i2, j1, j2));
2891 }
2892 }
2893
2894
2895
2896
2897 static void GLAPIENTRY
2898 save_Fogfv(GLenum pname, const GLfloat *params)
2899 {
2900 GET_CURRENT_CONTEXT(ctx);
2901 Node *n;
2902 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2903 n = alloc_instruction(ctx, OPCODE_FOG, 5);
2904 if (n) {
2905 n[1].e = pname;
2906 n[2].f = params[0];
2907 n[3].f = params[1];
2908 n[4].f = params[2];
2909 n[5].f = params[3];
2910 }
2911 if (ctx->ExecuteFlag) {
2912 CALL_Fogfv(ctx->Exec, (pname, params));
2913 }
2914 }
2915
2916
2917 static void GLAPIENTRY
2918 save_Fogf(GLenum pname, GLfloat param)
2919 {
2920 GLfloat parray[4];
2921 parray[0] = param;
2922 parray[1] = parray[2] = parray[3] = 0.0F;
2923 save_Fogfv(pname, parray);
2924 }
2925
2926
2927 static void GLAPIENTRY
2928 save_Fogiv(GLenum pname, const GLint *params)
2929 {
2930 GLfloat p[4];
2931 switch (pname) {
2932 case GL_FOG_MODE:
2933 case GL_FOG_DENSITY:
2934 case GL_FOG_START:
2935 case GL_FOG_END:
2936 case GL_FOG_INDEX:
2937 case GL_FOG_COORDINATE_SOURCE:
2938 p[0] = (GLfloat) *params;
2939 p[1] = 0.0f;
2940 p[2] = 0.0f;
2941 p[3] = 0.0f;
2942 break;
2943 case GL_FOG_COLOR:
2944 p[0] = INT_TO_FLOAT(params[0]);
2945 p[1] = INT_TO_FLOAT(params[1]);
2946 p[2] = INT_TO_FLOAT(params[2]);
2947 p[3] = INT_TO_FLOAT(params[3]);
2948 break;
2949 default:
2950 /* Error will be caught later in gl_Fogfv */
2951 ASSIGN_4V(p, 0.0F, 0.0F, 0.0F, 0.0F);
2952 }
2953 save_Fogfv(pname, p);
2954 }
2955
2956
2957 static void GLAPIENTRY
2958 save_Fogi(GLenum pname, GLint param)
2959 {
2960 GLint parray[4];
2961 parray[0] = param;
2962 parray[1] = parray[2] = parray[3] = 0;
2963 save_Fogiv(pname, parray);
2964 }
2965
2966
2967 static void GLAPIENTRY
2968 save_FrontFace(GLenum mode)
2969 {
2970 GET_CURRENT_CONTEXT(ctx);
2971 Node *n;
2972 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2973 n = alloc_instruction(ctx, OPCODE_FRONT_FACE, 1);
2974 if (n) {
2975 n[1].e = mode;
2976 }
2977 if (ctx->ExecuteFlag) {
2978 CALL_FrontFace(ctx->Exec, (mode));
2979 }
2980 }
2981
2982
2983 static void GLAPIENTRY
2984 save_Frustum(GLdouble left, GLdouble right,
2985 GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval)
2986 {
2987 GET_CURRENT_CONTEXT(ctx);
2988 Node *n;
2989 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2990 n = alloc_instruction(ctx, OPCODE_FRUSTUM, 6);
2991 if (n) {
2992 n[1].f = (GLfloat) left;
2993 n[2].f = (GLfloat) right;
2994 n[3].f = (GLfloat) bottom;
2995 n[4].f = (GLfloat) top;
2996 n[5].f = (GLfloat) nearval;
2997 n[6].f = (GLfloat) farval;
2998 }
2999 if (ctx->ExecuteFlag) {
3000 CALL_Frustum(ctx->Exec, (left, right, bottom, top, nearval, farval));
3001 }
3002 }
3003
3004
3005 static void GLAPIENTRY
3006 save_Hint(GLenum target, GLenum mode)
3007 {
3008 GET_CURRENT_CONTEXT(ctx);
3009 Node *n;
3010 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3011 n = alloc_instruction(ctx, OPCODE_HINT, 2);
3012 if (n) {
3013 n[1].e = target;
3014 n[2].e = mode;
3015 }
3016 if (ctx->ExecuteFlag) {
3017 CALL_Hint(ctx->Exec, (target, mode));
3018 }
3019 }
3020
3021
3022 static void GLAPIENTRY
3023 save_IndexMask(GLuint mask)
3024 {
3025 GET_CURRENT_CONTEXT(ctx);
3026 Node *n;
3027 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3028 n = alloc_instruction(ctx, OPCODE_INDEX_MASK, 1);
3029 if (n) {
3030 n[1].ui = mask;
3031 }
3032 if (ctx->ExecuteFlag) {
3033 CALL_IndexMask(ctx->Exec, (mask));
3034 }
3035 }
3036
3037
3038 static void GLAPIENTRY
3039 save_InitNames(void)
3040 {
3041 GET_CURRENT_CONTEXT(ctx);
3042 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3043 (void) alloc_instruction(ctx, OPCODE_INIT_NAMES, 0);
3044 if (ctx->ExecuteFlag) {
3045 CALL_InitNames(ctx->Exec, ());
3046 }
3047 }
3048
3049
3050 static void GLAPIENTRY
3051 save_Lightfv(GLenum light, GLenum pname, const GLfloat *params)
3052 {
3053 GET_CURRENT_CONTEXT(ctx);
3054 Node *n;
3055 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3056 n = alloc_instruction(ctx, OPCODE_LIGHT, 6);
3057 if (n) {
3058 GLint i, nParams;
3059 n[1].e = light;
3060 n[2].e = pname;
3061 switch (pname) {
3062 case GL_AMBIENT:
3063 nParams = 4;
3064 break;
3065 case GL_DIFFUSE:
3066 nParams = 4;
3067 break;
3068 case GL_SPECULAR:
3069 nParams = 4;
3070 break;
3071 case GL_POSITION:
3072 nParams = 4;
3073 break;
3074 case GL_SPOT_DIRECTION:
3075 nParams = 3;
3076 break;
3077 case GL_SPOT_EXPONENT:
3078 nParams = 1;
3079 break;
3080 case GL_SPOT_CUTOFF:
3081 nParams = 1;
3082 break;
3083 case GL_CONSTANT_ATTENUATION:
3084 nParams = 1;
3085 break;
3086 case GL_LINEAR_ATTENUATION:
3087 nParams = 1;
3088 break;
3089 case GL_QUADRATIC_ATTENUATION:
3090 nParams = 1;
3091 break;
3092 default:
3093 nParams = 0;
3094 }
3095 for (i = 0; i < nParams; i++) {
3096 n[3 + i].f = params[i];
3097 }
3098 }
3099 if (ctx->ExecuteFlag) {
3100 CALL_Lightfv(ctx->Exec, (light, pname, params));
3101 }
3102 }
3103
3104
3105 static void GLAPIENTRY
3106 save_Lightf(GLenum light, GLenum pname, GLfloat param)
3107 {
3108 GLfloat parray[4];
3109 parray[0] = param;
3110 parray[1] = parray[2] = parray[3] = 0.0F;
3111 save_Lightfv(light, pname, parray);
3112 }
3113
3114
3115 static void GLAPIENTRY
3116 save_Lightiv(GLenum light, GLenum pname, const GLint *params)
3117 {
3118 GLfloat fparam[4];
3119 switch (pname) {
3120 case GL_AMBIENT:
3121 case GL_DIFFUSE:
3122 case GL_SPECULAR:
3123 fparam[0] = INT_TO_FLOAT(params[0]);
3124 fparam[1] = INT_TO_FLOAT(params[1]);
3125 fparam[2] = INT_TO_FLOAT(params[2]);
3126 fparam[3] = INT_TO_FLOAT(params[3]);
3127 break;
3128 case GL_POSITION:
3129 fparam[0] = (GLfloat) params[0];
3130 fparam[1] = (GLfloat) params[1];
3131 fparam[2] = (GLfloat) params[2];
3132 fparam[3] = (GLfloat) params[3];
3133 break;
3134 case GL_SPOT_DIRECTION:
3135 fparam[0] = (GLfloat) params[0];
3136 fparam[1] = (GLfloat) params[1];
3137 fparam[2] = (GLfloat) params[2];
3138 break;
3139 case GL_SPOT_EXPONENT:
3140 case GL_SPOT_CUTOFF:
3141 case GL_CONSTANT_ATTENUATION:
3142 case GL_LINEAR_ATTENUATION:
3143 case GL_QUADRATIC_ATTENUATION:
3144 fparam[0] = (GLfloat) params[0];
3145 break;
3146 default:
3147 /* error will be caught later in gl_Lightfv */
3148 ;
3149 }
3150 save_Lightfv(light, pname, fparam);
3151 }
3152
3153
3154 static void GLAPIENTRY
3155 save_Lighti(GLenum light, GLenum pname, GLint param)
3156 {
3157 GLint parray[4];
3158 parray[0] = param;
3159 parray[1] = parray[2] = parray[3] = 0;
3160 save_Lightiv(light, pname, parray);
3161 }
3162
3163
3164 static void GLAPIENTRY
3165 save_LightModelfv(GLenum pname, const GLfloat *params)
3166 {
3167 GET_CURRENT_CONTEXT(ctx);
3168 Node *n;
3169 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3170 n = alloc_instruction(ctx, OPCODE_LIGHT_MODEL, 5);
3171 if (n) {
3172 n[1].e = pname;
3173 n[2].f = params[0];
3174 n[3].f = params[1];
3175 n[4].f = params[2];
3176 n[5].f = params[3];
3177 }
3178 if (ctx->ExecuteFlag) {
3179 CALL_LightModelfv(ctx->Exec, (pname, params));
3180 }
3181 }
3182
3183
3184 static void GLAPIENTRY
3185 save_LightModelf(GLenum pname, GLfloat param)
3186 {
3187 GLfloat parray[4];
3188 parray[0] = param;
3189 parray[1] = parray[2] = parray[3] = 0.0F;
3190 save_LightModelfv(pname, parray);
3191 }
3192
3193
3194 static void GLAPIENTRY
3195 save_LightModeliv(GLenum pname, const GLint *params)
3196 {
3197 GLfloat fparam[4];
3198 switch (pname) {
3199 case GL_LIGHT_MODEL_AMBIENT:
3200 fparam[0] = INT_TO_FLOAT(params[0]);
3201 fparam[1] = INT_TO_FLOAT(params[1]);
3202 fparam[2] = INT_TO_FLOAT(params[2]);
3203 fparam[3] = INT_TO_FLOAT(params[3]);
3204 break;
3205 case GL_LIGHT_MODEL_LOCAL_VIEWER:
3206 case GL_LIGHT_MODEL_TWO_SIDE:
3207 case GL_LIGHT_MODEL_COLOR_CONTROL:
3208 fparam[0] = (GLfloat) params[0];
3209 fparam[1] = 0.0F;
3210 fparam[2] = 0.0F;
3211 fparam[3] = 0.0F;
3212 break;
3213 default:
3214 /* Error will be caught later in gl_LightModelfv */
3215 ASSIGN_4V(fparam, 0.0F, 0.0F, 0.0F, 0.0F);
3216 }
3217 save_LightModelfv(pname, fparam);
3218 }
3219
3220
3221 static void GLAPIENTRY
3222 save_LightModeli(GLenum pname, GLint param)
3223 {
3224 GLint parray[4];
3225 parray[0] = param;
3226 parray[1] = parray[2] = parray[3] = 0;
3227 save_LightModeliv(pname, parray);
3228 }
3229
3230
3231 static void GLAPIENTRY
3232 save_LineStipple(GLint factor, GLushort pattern)
3233 {
3234 GET_CURRENT_CONTEXT(ctx);
3235 Node *n;
3236 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3237 n = alloc_instruction(ctx, OPCODE_LINE_STIPPLE, 2);
3238 if (n) {
3239 n[1].i = factor;
3240 n[2].us = pattern;
3241 }
3242 if (ctx->ExecuteFlag) {
3243 CALL_LineStipple(ctx->Exec, (factor, pattern));
3244 }
3245 }
3246
3247
3248 static void GLAPIENTRY
3249 save_LineWidth(GLfloat width)
3250 {
3251 GET_CURRENT_CONTEXT(ctx);
3252 Node *n;
3253 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3254 n = alloc_instruction(ctx, OPCODE_LINE_WIDTH, 1);
3255 if (n) {
3256 n[1].f = width;
3257 }
3258 if (ctx->ExecuteFlag) {
3259 CALL_LineWidth(ctx->Exec, (width));
3260 }
3261 }
3262
3263
3264 static void GLAPIENTRY
3265 save_ListBase(GLuint base)
3266 {
3267 GET_CURRENT_CONTEXT(ctx);
3268 Node *n;
3269 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3270 n = alloc_instruction(ctx, OPCODE_LIST_BASE, 1);
3271 if (n) {
3272 n[1].ui = base;
3273 }
3274 if (ctx->ExecuteFlag) {
3275 CALL_ListBase(ctx->Exec, (base));
3276 }
3277 }
3278
3279
3280 static void GLAPIENTRY
3281 save_LoadIdentity(void)
3282 {
3283 GET_CURRENT_CONTEXT(ctx);
3284 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3285 (void) alloc_instruction(ctx, OPCODE_LOAD_IDENTITY, 0);
3286 if (ctx->ExecuteFlag) {
3287 CALL_LoadIdentity(ctx->Exec, ());
3288 }
3289 }
3290
3291
3292 static void GLAPIENTRY
3293 save_LoadMatrixf(const GLfloat * m)
3294 {
3295 GET_CURRENT_CONTEXT(ctx);
3296 Node *n;
3297 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3298 n = alloc_instruction(ctx, OPCODE_LOAD_MATRIX, 16);
3299 if (n) {
3300 GLuint i;
3301 for (i = 0; i < 16; i++) {
3302 n[1 + i].f = m[i];
3303 }
3304 }
3305 if (ctx->ExecuteFlag) {
3306 CALL_LoadMatrixf(ctx->Exec, (m));
3307 }
3308 }
3309
3310
3311 static void GLAPIENTRY
3312 save_LoadMatrixd(const GLdouble * m)
3313 {
3314 GLfloat f[16];
3315 GLint i;
3316 for (i = 0; i < 16; i++) {
3317 f[i] = (GLfloat) m[i];
3318 }
3319 save_LoadMatrixf(f);
3320 }
3321
3322
3323 static void GLAPIENTRY
3324 save_LoadName(GLuint name)
3325 {
3326 GET_CURRENT_CONTEXT(ctx);
3327 Node *n;
3328 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3329 n = alloc_instruction(ctx, OPCODE_LOAD_NAME, 1);
3330 if (n) {
3331 n[1].ui = name;
3332 }
3333 if (ctx->ExecuteFlag) {
3334 CALL_LoadName(ctx->Exec, (name));
3335 }
3336 }
3337
3338
3339 static void GLAPIENTRY
3340 save_LogicOp(GLenum opcode)
3341 {
3342 GET_CURRENT_CONTEXT(ctx);
3343 Node *n;
3344 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3345 n = alloc_instruction(ctx, OPCODE_LOGIC_OP, 1);
3346 if (n) {
3347 n[1].e = opcode;
3348 }
3349 if (ctx->ExecuteFlag) {
3350 CALL_LogicOp(ctx->Exec, (opcode));
3351 }
3352 }
3353
3354
3355 static void GLAPIENTRY
3356 save_Map1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride,
3357 GLint order, const GLdouble * points)
3358 {
3359 GET_CURRENT_CONTEXT(ctx);
3360 Node *n;
3361 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3362 n = alloc_instruction(ctx, OPCODE_MAP1, 5 + POINTER_DWORDS);
3363 if (n) {
3364 GLfloat *pnts = _mesa_copy_map_points1d(target, stride, order, points);
3365 n[1].e = target;
3366 n[2].f = (GLfloat) u1;
3367 n[3].f = (GLfloat) u2;
3368 n[4].i = _mesa_evaluator_components(target); /* stride */
3369 n[5].i = order;
3370 save_pointer(&n[6], pnts);
3371 }
3372 if (ctx->ExecuteFlag) {
3373 CALL_Map1d(ctx->Exec, (target, u1, u2, stride, order, points));
3374 }
3375 }
3376
3377 static void GLAPIENTRY
3378 save_Map1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride,
3379 GLint order, const GLfloat * points)
3380 {
3381 GET_CURRENT_CONTEXT(ctx);
3382 Node *n;
3383 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3384 n = alloc_instruction(ctx, OPCODE_MAP1, 5 + POINTER_DWORDS);
3385 if (n) {
3386 GLfloat *pnts = _mesa_copy_map_points1f(target, stride, order, points);
3387 n[1].e = target;
3388 n[2].f = u1;
3389 n[3].f = u2;
3390 n[4].i = _mesa_evaluator_components(target); /* stride */
3391 n[5].i = order;
3392 save_pointer(&n[6], pnts);
3393 }
3394 if (ctx->ExecuteFlag) {
3395 CALL_Map1f(ctx->Exec, (target, u1, u2, stride, order, points));
3396 }
3397 }
3398
3399
3400 static void GLAPIENTRY
3401 save_Map2d(GLenum target,
3402 GLdouble u1, GLdouble u2, GLint ustride, GLint uorder,
3403 GLdouble v1, GLdouble v2, GLint vstride, GLint vorder,
3404 const GLdouble * points)
3405 {
3406 GET_CURRENT_CONTEXT(ctx);
3407 Node *n;
3408 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3409 n = alloc_instruction(ctx, OPCODE_MAP2, 9 + POINTER_DWORDS);
3410 if (n) {
3411 GLfloat *pnts = _mesa_copy_map_points2d(target, ustride, uorder,
3412 vstride, vorder, points);
3413 n[1].e = target;
3414 n[2].f = (GLfloat) u1;
3415 n[3].f = (GLfloat) u2;
3416 n[4].f = (GLfloat) v1;
3417 n[5].f = (GLfloat) v2;
3418 /* XXX verify these strides are correct */
3419 n[6].i = _mesa_evaluator_components(target) * vorder; /*ustride */
3420 n[7].i = _mesa_evaluator_components(target); /*vstride */
3421 n[8].i = uorder;
3422 n[9].i = vorder;
3423 save_pointer(&n[10], pnts);
3424 }
3425 if (ctx->ExecuteFlag) {
3426 CALL_Map2d(ctx->Exec, (target,
3427 u1, u2, ustride, uorder,
3428 v1, v2, vstride, vorder, points));
3429 }
3430 }
3431
3432
3433 static void GLAPIENTRY
3434 save_Map2f(GLenum target,
3435 GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
3436 GLfloat v1, GLfloat v2, GLint vstride, GLint vorder,
3437 const GLfloat * points)
3438 {
3439 GET_CURRENT_CONTEXT(ctx);
3440 Node *n;
3441 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3442 n = alloc_instruction(ctx, OPCODE_MAP2, 9 + POINTER_DWORDS);
3443 if (n) {
3444 GLfloat *pnts = _mesa_copy_map_points2f(target, ustride, uorder,
3445 vstride, vorder, points);
3446 n[1].e = target;
3447 n[2].f = u1;
3448 n[3].f = u2;
3449 n[4].f = v1;
3450 n[5].f = v2;
3451 /* XXX verify these strides are correct */
3452 n[6].i = _mesa_evaluator_components(target) * vorder; /*ustride */
3453 n[7].i = _mesa_evaluator_components(target); /*vstride */
3454 n[8].i = uorder;
3455 n[9].i = vorder;
3456 save_pointer(&n[10], pnts);
3457 }
3458 if (ctx->ExecuteFlag) {
3459 CALL_Map2f(ctx->Exec, (target, u1, u2, ustride, uorder,
3460 v1, v2, vstride, vorder, points));
3461 }
3462 }
3463
3464
3465 static void GLAPIENTRY
3466 save_MapGrid1f(GLint un, GLfloat u1, GLfloat u2)
3467 {
3468 GET_CURRENT_CONTEXT(ctx);
3469 Node *n;
3470 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3471 n = alloc_instruction(ctx, OPCODE_MAPGRID1, 3);
3472 if (n) {
3473 n[1].i = un;
3474 n[2].f = u1;
3475 n[3].f = u2;
3476 }
3477 if (ctx->ExecuteFlag) {
3478 CALL_MapGrid1f(ctx->Exec, (un, u1, u2));
3479 }
3480 }
3481
3482
3483 static void GLAPIENTRY
3484 save_MapGrid1d(GLint un, GLdouble u1, GLdouble u2)
3485 {
3486 save_MapGrid1f(un, (GLfloat) u1, (GLfloat) u2);
3487 }
3488
3489
3490 static void GLAPIENTRY
3491 save_MapGrid2f(GLint un, GLfloat u1, GLfloat u2,
3492 GLint vn, GLfloat v1, GLfloat v2)
3493 {
3494 GET_CURRENT_CONTEXT(ctx);
3495 Node *n;
3496 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3497 n = alloc_instruction(ctx, OPCODE_MAPGRID2, 6);
3498 if (n) {
3499 n[1].i = un;
3500 n[2].f = u1;
3501 n[3].f = u2;
3502 n[4].i = vn;
3503 n[5].f = v1;
3504 n[6].f = v2;
3505 }
3506 if (ctx->ExecuteFlag) {
3507 CALL_MapGrid2f(ctx->Exec, (un, u1, u2, vn, v1, v2));
3508 }
3509 }
3510
3511
3512
3513 static void GLAPIENTRY
3514 save_MapGrid2d(GLint un, GLdouble u1, GLdouble u2,
3515 GLint vn, GLdouble v1, GLdouble v2)
3516 {
3517 save_MapGrid2f(un, (GLfloat) u1, (GLfloat) u2,
3518 vn, (GLfloat) v1, (GLfloat) v2);
3519 }
3520
3521
3522 static void GLAPIENTRY
3523 save_MatrixMode(GLenum mode)
3524 {
3525 GET_CURRENT_CONTEXT(ctx);
3526 Node *n;
3527 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3528 n = alloc_instruction(ctx, OPCODE_MATRIX_MODE, 1);
3529 if (n) {
3530 n[1].e = mode;
3531 }
3532 if (ctx->ExecuteFlag) {
3533 CALL_MatrixMode(ctx->Exec, (mode));
3534 }
3535 }
3536
3537
3538 static void GLAPIENTRY
3539 save_MultMatrixf(const GLfloat * m)
3540 {
3541 GET_CURRENT_CONTEXT(ctx);
3542 Node *n;
3543 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3544 n = alloc_instruction(ctx, OPCODE_MULT_MATRIX, 16);
3545 if (n) {
3546 GLuint i;
3547 for (i = 0; i < 16; i++) {
3548 n[1 + i].f = m[i];
3549 }
3550 }
3551 if (ctx->ExecuteFlag) {
3552 CALL_MultMatrixf(ctx->Exec, (m));
3553 }
3554 }
3555
3556
3557 static void GLAPIENTRY
3558 save_MultMatrixd(const GLdouble * m)
3559 {
3560 GLfloat f[16];
3561 GLint i;
3562 for (i = 0; i < 16; i++) {
3563 f[i] = (GLfloat) m[i];
3564 }
3565 save_MultMatrixf(f);
3566 }
3567
3568
3569 static void GLAPIENTRY
3570 save_NewList(GLuint name, GLenum mode)
3571 {
3572 GET_CURRENT_CONTEXT(ctx);
3573 /* It's an error to call this function while building a display list */
3574 _mesa_error(ctx, GL_INVALID_OPERATION, "glNewList");
3575 (void) name;
3576 (void) mode;
3577 }
3578
3579
3580
3581 static void GLAPIENTRY
3582 save_Ortho(GLdouble left, GLdouble right,
3583 GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval)
3584 {
3585 GET_CURRENT_CONTEXT(ctx);
3586 Node *n;
3587 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3588 n = alloc_instruction(ctx, OPCODE_ORTHO, 6);
3589 if (n) {
3590 n[1].f = (GLfloat) left;
3591 n[2].f = (GLfloat) right;
3592 n[3].f = (GLfloat) bottom;
3593 n[4].f = (GLfloat) top;
3594 n[5].f = (GLfloat) nearval;
3595 n[6].f = (GLfloat) farval;
3596 }
3597 if (ctx->ExecuteFlag) {
3598 CALL_Ortho(ctx->Exec, (left, right, bottom, top, nearval, farval));
3599 }
3600 }
3601
3602
3603 static void GLAPIENTRY
3604 save_PatchParameteri(GLenum pname, const GLint value)
3605 {
3606 GET_CURRENT_CONTEXT(ctx);
3607 Node *n;
3608 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3609 n = alloc_instruction(ctx, OPCODE_PATCH_PARAMETER_I, 2);
3610 if (n) {
3611 n[1].e = pname;
3612 n[2].i = value;
3613 }
3614 if (ctx->ExecuteFlag) {
3615 CALL_PatchParameteri(ctx->Exec, (pname, value));
3616 }
3617 }
3618
3619
3620 static void GLAPIENTRY
3621 save_PatchParameterfv(GLenum pname, const GLfloat *params)
3622 {
3623 GET_CURRENT_CONTEXT(ctx);
3624 Node *n;
3625 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3626
3627 if (pname == GL_PATCH_DEFAULT_OUTER_LEVEL) {
3628 n = alloc_instruction(ctx, OPCODE_PATCH_PARAMETER_FV_OUTER, 5);
3629 } else {
3630 assert(pname == GL_PATCH_DEFAULT_INNER_LEVEL);
3631 n = alloc_instruction(ctx, OPCODE_PATCH_PARAMETER_FV_INNER, 3);
3632 }
3633 if (n) {
3634 n[1].e = pname;
3635 if (pname == GL_PATCH_DEFAULT_OUTER_LEVEL) {
3636 n[2].f = params[0];
3637 n[3].f = params[1];
3638 n[4].f = params[2];
3639 n[5].f = params[3];
3640 } else {
3641 n[2].f = params[0];
3642 n[3].f = params[1];
3643 }
3644 }
3645 if (ctx->ExecuteFlag) {
3646 CALL_PatchParameterfv(ctx->Exec, (pname, params));
3647 }
3648 }
3649
3650
3651 static void GLAPIENTRY
3652 save_PixelMapfv(GLenum map, GLint mapsize, const GLfloat *values)
3653 {
3654 GET_CURRENT_CONTEXT(ctx);
3655 Node *n;
3656 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3657 n = alloc_instruction(ctx, OPCODE_PIXEL_MAP, 2 + POINTER_DWORDS);
3658 if (n) {
3659 n[1].e = map;
3660 n[2].i = mapsize;
3661 save_pointer(&n[3], memdup(values, mapsize * sizeof(GLfloat)));
3662 }
3663 if (ctx->ExecuteFlag) {
3664 CALL_PixelMapfv(ctx->Exec, (map, mapsize, values));
3665 }
3666 }
3667
3668
3669 static void GLAPIENTRY
3670 save_PixelMapuiv(GLenum map, GLint mapsize, const GLuint *values)
3671 {
3672 GLfloat fvalues[MAX_PIXEL_MAP_TABLE];
3673 GLint i;
3674 if (map == GL_PIXEL_MAP_I_TO_I || map == GL_PIXEL_MAP_S_TO_S) {
3675 for (i = 0; i < mapsize; i++) {
3676 fvalues[i] = (GLfloat) values[i];
3677 }
3678 }
3679 else {
3680 for (i = 0; i < mapsize; i++) {
3681 fvalues[i] = UINT_TO_FLOAT(values[i]);
3682 }
3683 }
3684 save_PixelMapfv(map, mapsize, fvalues);
3685 }
3686
3687
3688 static void GLAPIENTRY
3689 save_PixelMapusv(GLenum map, GLint mapsize, const GLushort *values)
3690 {
3691 GLfloat fvalues[MAX_PIXEL_MAP_TABLE];
3692 GLint i;
3693 if (map == GL_PIXEL_MAP_I_TO_I || map == GL_PIXEL_MAP_S_TO_S) {
3694 for (i = 0; i < mapsize; i++) {
3695 fvalues[i] = (GLfloat) values[i];
3696 }
3697 }
3698 else {
3699 for (i = 0; i < mapsize; i++) {
3700 fvalues[i] = USHORT_TO_FLOAT(values[i]);
3701 }
3702 }
3703 save_PixelMapfv(map, mapsize, fvalues);
3704 }
3705
3706
3707 static void GLAPIENTRY
3708 save_PixelTransferf(GLenum pname, GLfloat param)
3709 {
3710 GET_CURRENT_CONTEXT(ctx);
3711 Node *n;
3712 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3713 n = alloc_instruction(ctx, OPCODE_PIXEL_TRANSFER, 2);
3714 if (n) {
3715 n[1].e = pname;
3716 n[2].f = param;
3717 }
3718 if (ctx->ExecuteFlag) {
3719 CALL_PixelTransferf(ctx->Exec, (pname, param));
3720 }
3721 }
3722
3723
3724 static void GLAPIENTRY
3725 save_PixelTransferi(GLenum pname, GLint param)
3726 {
3727 save_PixelTransferf(pname, (GLfloat) param);
3728 }
3729
3730
3731 static void GLAPIENTRY
3732 save_PixelZoom(GLfloat xfactor, GLfloat yfactor)
3733 {
3734 GET_CURRENT_CONTEXT(ctx);
3735 Node *n;
3736 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3737 n = alloc_instruction(ctx, OPCODE_PIXEL_ZOOM, 2);
3738 if (n) {
3739 n[1].f = xfactor;
3740 n[2].f = yfactor;
3741 }
3742 if (ctx->ExecuteFlag) {
3743 CALL_PixelZoom(ctx->Exec, (xfactor, yfactor));
3744 }
3745 }
3746
3747
3748 static void GLAPIENTRY
3749 save_PointParameterfvEXT(GLenum pname, const GLfloat *params)
3750 {
3751 GET_CURRENT_CONTEXT(ctx);
3752 Node *n;
3753 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3754 n = alloc_instruction(ctx, OPCODE_POINT_PARAMETERS, 4);
3755 if (n) {
3756 n[1].e = pname;
3757 n[2].f = params[0];
3758 n[3].f = params[1];
3759 n[4].f = params[2];
3760 }
3761 if (ctx->ExecuteFlag) {
3762 CALL_PointParameterfv(ctx->Exec, (pname, params));
3763 }
3764 }
3765
3766
3767 static void GLAPIENTRY
3768 save_PointParameterfEXT(GLenum pname, GLfloat param)
3769 {
3770 GLfloat parray[3];
3771 parray[0] = param;
3772 parray[1] = parray[2] = 0.0F;
3773 save_PointParameterfvEXT(pname, parray);
3774 }
3775
3776 static void GLAPIENTRY
3777 save_PointParameteriNV(GLenum pname, GLint param)
3778 {
3779 GLfloat parray[3];
3780 parray[0] = (GLfloat) param;
3781 parray[1] = parray[2] = 0.0F;
3782 save_PointParameterfvEXT(pname, parray);
3783 }
3784
3785 static void GLAPIENTRY
3786 save_PointParameterivNV(GLenum pname, const GLint * param)
3787 {
3788 GLfloat parray[3];
3789 parray[0] = (GLfloat) param[0];
3790 parray[1] = parray[2] = 0.0F;
3791 save_PointParameterfvEXT(pname, parray);
3792 }
3793
3794
3795 static void GLAPIENTRY
3796 save_PointSize(GLfloat size)
3797 {
3798 GET_CURRENT_CONTEXT(ctx);
3799 Node *n;
3800 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3801 n = alloc_instruction(ctx, OPCODE_POINT_SIZE, 1);
3802 if (n) {
3803 n[1].f = size;
3804 }
3805 if (ctx->ExecuteFlag) {
3806 CALL_PointSize(ctx->Exec, (size));
3807 }
3808 }
3809
3810
3811 static void GLAPIENTRY
3812 save_PolygonMode(GLenum face, GLenum mode)
3813 {
3814 GET_CURRENT_CONTEXT(ctx);
3815 Node *n;
3816 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3817 n = alloc_instruction(ctx, OPCODE_POLYGON_MODE, 2);
3818 if (n) {
3819 n[1].e = face;
3820 n[2].e = mode;
3821 }
3822 if (ctx->ExecuteFlag) {
3823 CALL_PolygonMode(ctx->Exec, (face, mode));
3824 }
3825 }
3826
3827
3828 static void GLAPIENTRY
3829 save_PolygonStipple(const GLubyte * pattern)
3830 {
3831 GET_CURRENT_CONTEXT(ctx);
3832 Node *n;
3833
3834 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3835
3836 n = alloc_instruction(ctx, OPCODE_POLYGON_STIPPLE, POINTER_DWORDS);
3837 if (n) {
3838 save_pointer(&n[1],
3839 unpack_image(ctx, 2, 32, 32, 1, GL_COLOR_INDEX, GL_BITMAP,
3840 pattern, &ctx->Unpack));
3841 }
3842 if (ctx->ExecuteFlag) {
3843 CALL_PolygonStipple(ctx->Exec, ((GLubyte *) pattern));
3844 }
3845 }
3846
3847
3848 static void GLAPIENTRY
3849 save_PolygonOffset(GLfloat factor, GLfloat units)
3850 {
3851 GET_CURRENT_CONTEXT(ctx);
3852 Node *n;
3853 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3854 n = alloc_instruction(ctx, OPCODE_POLYGON_OFFSET, 2);
3855 if (n) {
3856 n[1].f = factor;
3857 n[2].f = units;
3858 }
3859 if (ctx->ExecuteFlag) {
3860 CALL_PolygonOffset(ctx->Exec, (factor, units));
3861 }
3862 }
3863
3864
3865 static void GLAPIENTRY
3866 save_PolygonOffsetClampEXT(GLfloat factor, GLfloat units, GLfloat clamp)
3867 {
3868 GET_CURRENT_CONTEXT(ctx);
3869 Node *n;
3870 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3871 n = alloc_instruction(ctx, OPCODE_POLYGON_OFFSET_CLAMP, 3);
3872 if (n) {
3873 n[1].f = factor;
3874 n[2].f = units;
3875 n[3].f = clamp;
3876 }
3877 if (ctx->ExecuteFlag) {
3878 CALL_PolygonOffsetClampEXT(ctx->Exec, (factor, units, clamp));
3879 }
3880 }
3881
3882 static void GLAPIENTRY
3883 save_PopAttrib(void)
3884 {
3885 GET_CURRENT_CONTEXT(ctx);
3886 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3887 (void) alloc_instruction(ctx, OPCODE_POP_ATTRIB, 0);
3888 if (ctx->ExecuteFlag) {
3889 CALL_PopAttrib(ctx->Exec, ());
3890 }
3891 }
3892
3893
3894 static void GLAPIENTRY
3895 save_PopMatrix(void)
3896 {
3897 GET_CURRENT_CONTEXT(ctx);
3898 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3899 (void) alloc_instruction(ctx, OPCODE_POP_MATRIX, 0);
3900 if (ctx->ExecuteFlag) {
3901 CALL_PopMatrix(ctx->Exec, ());
3902 }
3903 }
3904
3905
3906 static void GLAPIENTRY
3907 save_PopName(void)
3908 {
3909 GET_CURRENT_CONTEXT(ctx);
3910 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3911 (void) alloc_instruction(ctx, OPCODE_POP_NAME, 0);
3912 if (ctx->ExecuteFlag) {
3913 CALL_PopName(ctx->Exec, ());
3914 }
3915 }
3916
3917
3918 static void GLAPIENTRY
3919 save_PrioritizeTextures(GLsizei num, const GLuint * textures,
3920 const GLclampf * priorities)
3921 {
3922 GET_CURRENT_CONTEXT(ctx);
3923 GLint i;
3924 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3925
3926 for (i = 0; i < num; i++) {
3927 Node *n;
3928 n = alloc_instruction(ctx, OPCODE_PRIORITIZE_TEXTURE, 2);
3929 if (n) {
3930 n[1].ui = textures[i];
3931 n[2].f = priorities[i];
3932 }
3933 }
3934 if (ctx->ExecuteFlag) {
3935 CALL_PrioritizeTextures(ctx->Exec, (num, textures, priorities));
3936 }
3937 }
3938
3939
3940 static void GLAPIENTRY
3941 save_PushAttrib(GLbitfield mask)
3942 {
3943 GET_CURRENT_CONTEXT(ctx);
3944 Node *n;
3945 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3946 n = alloc_instruction(ctx, OPCODE_PUSH_ATTRIB, 1);
3947 if (n) {
3948 n[1].bf = mask;
3949 }
3950 if (ctx->ExecuteFlag) {
3951 CALL_PushAttrib(ctx->Exec, (mask));
3952 }
3953 }
3954
3955
3956 static void GLAPIENTRY
3957 save_PushMatrix(void)
3958 {
3959 GET_CURRENT_CONTEXT(ctx);
3960 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3961 (void) alloc_instruction(ctx, OPCODE_PUSH_MATRIX, 0);
3962 if (ctx->ExecuteFlag) {
3963 CALL_PushMatrix(ctx->Exec, ());
3964 }
3965 }
3966
3967
3968 static void GLAPIENTRY
3969 save_PushName(GLuint name)
3970 {
3971 GET_CURRENT_CONTEXT(ctx);
3972 Node *n;
3973 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3974 n = alloc_instruction(ctx, OPCODE_PUSH_NAME, 1);
3975 if (n) {
3976 n[1].ui = name;
3977 }
3978 if (ctx->ExecuteFlag) {
3979 CALL_PushName(ctx->Exec, (name));
3980 }
3981 }
3982
3983
3984 static void GLAPIENTRY
3985 save_RasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
3986 {
3987 GET_CURRENT_CONTEXT(ctx);
3988 Node *n;
3989 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3990 n = alloc_instruction(ctx, OPCODE_RASTER_POS, 4);
3991 if (n) {
3992 n[1].f = x;
3993 n[2].f = y;
3994 n[3].f = z;
3995 n[4].f = w;
3996 }
3997 if (ctx->ExecuteFlag) {
3998 CALL_RasterPos4f(ctx->Exec, (x, y, z, w));
3999 }
4000 }
4001
4002 static void GLAPIENTRY
4003 save_RasterPos2d(GLdouble x, GLdouble y)
4004 {
4005 save_RasterPos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
4006 }
4007
4008 static void GLAPIENTRY
4009 save_RasterPos2f(GLfloat x, GLfloat y)
4010 {
4011 save_RasterPos4f(x, y, 0.0F, 1.0F);
4012 }
4013
4014 static void GLAPIENTRY
4015 save_RasterPos2i(GLint x, GLint y)
4016 {
4017 save_RasterPos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
4018 }
4019
4020 static void GLAPIENTRY
4021 save_RasterPos2s(GLshort x, GLshort y)
4022 {
4023 save_RasterPos4f(x, y, 0.0F, 1.0F);
4024 }
4025
4026 static void GLAPIENTRY
4027 save_RasterPos3d(GLdouble x, GLdouble y, GLdouble z)
4028 {
4029 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
4030 }
4031
4032 static void GLAPIENTRY
4033 save_RasterPos3f(GLfloat x, GLfloat y, GLfloat z)
4034 {
4035 save_RasterPos4f(x, y, z, 1.0F);
4036 }
4037
4038 static void GLAPIENTRY
4039 save_RasterPos3i(GLint x, GLint y, GLint z)
4040 {
4041 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
4042 }
4043
4044 static void GLAPIENTRY
4045 save_RasterPos3s(GLshort x, GLshort y, GLshort z)
4046 {
4047 save_RasterPos4f(x, y, z, 1.0F);
4048 }
4049
4050 static void GLAPIENTRY
4051 save_RasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
4052 {
4053 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
4054 }
4055
4056 static void GLAPIENTRY
4057 save_RasterPos4i(GLint x, GLint y, GLint z, GLint w)
4058 {
4059 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
4060 }
4061
4062 static void GLAPIENTRY
4063 save_RasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w)
4064 {
4065 save_RasterPos4f(x, y, z, w);
4066 }
4067
4068 static void GLAPIENTRY
4069 save_RasterPos2dv(const GLdouble * v)
4070 {
4071 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
4072 }
4073
4074 static void GLAPIENTRY
4075 save_RasterPos2fv(const GLfloat * v)
4076 {
4077 save_RasterPos4f(v[0], v[1], 0.0F, 1.0F);
4078 }
4079
4080 static void GLAPIENTRY
4081 save_RasterPos2iv(const GLint * v)
4082 {
4083 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
4084 }
4085
4086 static void GLAPIENTRY
4087 save_RasterPos2sv(const GLshort * v)
4088 {
4089 save_RasterPos4f(v[0], v[1], 0.0F, 1.0F);
4090 }
4091
4092 static void GLAPIENTRY
4093 save_RasterPos3dv(const GLdouble * v)
4094 {
4095 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
4096 }
4097
4098 static void GLAPIENTRY
4099 save_RasterPos3fv(const GLfloat * v)
4100 {
4101 save_RasterPos4f(v[0], v[1], v[2], 1.0F);
4102 }
4103
4104 static void GLAPIENTRY
4105 save_RasterPos3iv(const GLint * v)
4106 {
4107 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
4108 }
4109
4110 static void GLAPIENTRY
4111 save_RasterPos3sv(const GLshort * v)
4112 {
4113 save_RasterPos4f(v[0], v[1], v[2], 1.0F);
4114 }
4115
4116 static void GLAPIENTRY
4117 save_RasterPos4dv(const GLdouble * v)
4118 {
4119 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1],
4120 (GLfloat) v[2], (GLfloat) v[3]);
4121 }
4122
4123 static void GLAPIENTRY
4124 save_RasterPos4fv(const GLfloat * v)
4125 {
4126 save_RasterPos4f(v[0], v[1], v[2], v[3]);
4127 }
4128
4129 static void GLAPIENTRY
4130 save_RasterPos4iv(const GLint * v)
4131 {
4132 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1],
4133 (GLfloat) v[2], (GLfloat) v[3]);
4134 }
4135
4136 static void GLAPIENTRY
4137 save_RasterPos4sv(const GLshort * v)
4138 {
4139 save_RasterPos4f(v[0], v[1], v[2], v[3]);
4140 }
4141
4142
4143 static void GLAPIENTRY
4144 save_PassThrough(GLfloat token)
4145 {
4146 GET_CURRENT_CONTEXT(ctx);
4147 Node *n;
4148 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4149 n = alloc_instruction(ctx, OPCODE_PASSTHROUGH, 1);
4150 if (n) {
4151 n[1].f = token;
4152 }
4153 if (ctx->ExecuteFlag) {
4154 CALL_PassThrough(ctx->Exec, (token));
4155 }
4156 }
4157
4158
4159 static void GLAPIENTRY
4160 save_ReadBuffer(GLenum mode)
4161 {
4162 GET_CURRENT_CONTEXT(ctx);
4163 Node *n;
4164 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4165 n = alloc_instruction(ctx, OPCODE_READ_BUFFER, 1);
4166 if (n) {
4167 n[1].e = mode;
4168 }
4169 if (ctx->ExecuteFlag) {
4170 CALL_ReadBuffer(ctx->Exec, (mode));
4171 }
4172 }
4173
4174
4175 static void GLAPIENTRY
4176 save_Rotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
4177 {
4178 GET_CURRENT_CONTEXT(ctx);
4179 Node *n;
4180 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4181 n = alloc_instruction(ctx, OPCODE_ROTATE, 4);
4182 if (n) {
4183 n[1].f = angle;
4184 n[2].f = x;
4185 n[3].f = y;
4186 n[4].f = z;
4187 }
4188 if (ctx->ExecuteFlag) {
4189 CALL_Rotatef(ctx->Exec, (angle, x, y, z));
4190 }
4191 }
4192
4193
4194 static void GLAPIENTRY
4195 save_Rotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
4196 {
4197 save_Rotatef((GLfloat) angle, (GLfloat) x, (GLfloat) y, (GLfloat) z);
4198 }
4199
4200
4201 static void GLAPIENTRY
4202 save_Scalef(GLfloat x, GLfloat y, GLfloat z)
4203 {
4204 GET_CURRENT_CONTEXT(ctx);
4205 Node *n;
4206 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4207 n = alloc_instruction(ctx, OPCODE_SCALE, 3);
4208 if (n) {
4209 n[1].f = x;
4210 n[2].f = y;
4211 n[3].f = z;
4212 }
4213 if (ctx->ExecuteFlag) {
4214 CALL_Scalef(ctx->Exec, (x, y, z));
4215 }
4216 }
4217
4218
4219 static void GLAPIENTRY
4220 save_Scaled(GLdouble x, GLdouble y, GLdouble z)
4221 {
4222 save_Scalef((GLfloat) x, (GLfloat) y, (GLfloat) z);
4223 }
4224
4225
4226 static void GLAPIENTRY
4227 save_Scissor(GLint x, GLint y, GLsizei width, GLsizei height)
4228 {
4229 GET_CURRENT_CONTEXT(ctx);
4230 Node *n;
4231 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4232 n = alloc_instruction(ctx, OPCODE_SCISSOR, 4);
4233 if (n) {
4234 n[1].i = x;
4235 n[2].i = y;
4236 n[3].i = width;
4237 n[4].i = height;
4238 }
4239 if (ctx->ExecuteFlag) {
4240 CALL_Scissor(ctx->Exec, (x, y, width, height));
4241 }
4242 }
4243
4244
4245 static void GLAPIENTRY
4246 save_ShadeModel(GLenum mode)
4247 {
4248 GET_CURRENT_CONTEXT(ctx);
4249 Node *n;
4250 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx);
4251
4252 if (ctx->ExecuteFlag) {
4253 CALL_ShadeModel(ctx->Exec, (mode));
4254 }
4255
4256 /* Don't compile this call if it's a no-op.
4257 * By avoiding this state change we have a better chance of
4258 * coalescing subsequent drawing commands into one batch.
4259 */
4260 if (ctx->ListState.Current.ShadeModel == mode)
4261 return;
4262
4263 SAVE_FLUSH_VERTICES(ctx);
4264
4265 ctx->ListState.Current.ShadeModel = mode;
4266
4267 n = alloc_instruction(ctx, OPCODE_SHADE_MODEL, 1);
4268 if (n) {
4269 n[1].e = mode;
4270 }
4271 }
4272
4273
4274 static void GLAPIENTRY
4275 save_StencilFunc(GLenum func, GLint ref, GLuint mask)
4276 {
4277 GET_CURRENT_CONTEXT(ctx);
4278 Node *n;
4279 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4280 n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC, 3);
4281 if (n) {
4282 n[1].e = func;
4283 n[2].i = ref;
4284 n[3].ui = mask;
4285 }
4286 if (ctx->ExecuteFlag) {
4287 CALL_StencilFunc(ctx->Exec, (func, ref, mask));
4288 }
4289 }
4290
4291
4292 static void GLAPIENTRY
4293 save_StencilMask(GLuint mask)
4294 {
4295 GET_CURRENT_CONTEXT(ctx);
4296 Node *n;
4297 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4298 n = alloc_instruction(ctx, OPCODE_STENCIL_MASK, 1);
4299 if (n) {
4300 n[1].ui = mask;
4301 }
4302 if (ctx->ExecuteFlag) {
4303 CALL_StencilMask(ctx->Exec, (mask));
4304 }
4305 }
4306
4307
4308 static void GLAPIENTRY
4309 save_StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
4310 {
4311 GET_CURRENT_CONTEXT(ctx);
4312 Node *n;
4313 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4314 n = alloc_instruction(ctx, OPCODE_STENCIL_OP, 3);
4315 if (n) {
4316 n[1].e = fail;
4317 n[2].e = zfail;
4318 n[3].e = zpass;
4319 }
4320 if (ctx->ExecuteFlag) {
4321 CALL_StencilOp(ctx->Exec, (fail, zfail, zpass));
4322 }
4323 }
4324
4325
4326 static void GLAPIENTRY
4327 save_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
4328 {
4329 GET_CURRENT_CONTEXT(ctx);
4330 Node *n;
4331 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4332 n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4);
4333 if (n) {
4334 n[1].e = face;
4335 n[2].e = func;
4336 n[3].i = ref;
4337 n[4].ui = mask;
4338 }
4339 if (ctx->ExecuteFlag) {
4340 CALL_StencilFuncSeparate(ctx->Exec, (face, func, ref, mask));
4341 }
4342 }
4343
4344
4345 static void GLAPIENTRY
4346 save_StencilFuncSeparateATI(GLenum frontfunc, GLenum backfunc, GLint ref,
4347 GLuint mask)
4348 {
4349 GET_CURRENT_CONTEXT(ctx);
4350 Node *n;
4351 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4352 /* GL_FRONT */
4353 n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4);
4354 if (n) {
4355 n[1].e = GL_FRONT;
4356 n[2].e = frontfunc;
4357 n[3].i = ref;
4358 n[4].ui = mask;
4359 }
4360 /* GL_BACK */
4361 n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4);
4362 if (n) {
4363 n[1].e = GL_BACK;
4364 n[2].e = backfunc;
4365 n[3].i = ref;
4366 n[4].ui = mask;
4367 }
4368 if (ctx->ExecuteFlag) {
4369 CALL_StencilFuncSeparate(ctx->Exec, (GL_FRONT, frontfunc, ref, mask));
4370 CALL_StencilFuncSeparate(ctx->Exec, (GL_BACK, backfunc, ref, mask));
4371 }
4372 }
4373
4374
4375 static void GLAPIENTRY
4376 save_StencilMaskSeparate(GLenum face, GLuint mask)
4377 {
4378 GET_CURRENT_CONTEXT(ctx);
4379 Node *n;
4380 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4381 n = alloc_instruction(ctx, OPCODE_STENCIL_MASK_SEPARATE, 2);
4382 if (n) {
4383 n[1].e = face;
4384 n[2].ui = mask;
4385 }
4386 if (ctx->ExecuteFlag) {
4387 CALL_StencilMaskSeparate(ctx->Exec, (face, mask));
4388 }
4389 }
4390
4391
4392 static void GLAPIENTRY
4393 save_StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
4394 {
4395 GET_CURRENT_CONTEXT(ctx);
4396 Node *n;
4397 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4398 n = alloc_instruction(ctx, OPCODE_STENCIL_OP_SEPARATE, 4);
4399 if (n) {
4400 n[1].e = face;
4401 n[2].e = fail;
4402 n[3].e = zfail;
4403 n[4].e = zpass;
4404 }
4405 if (ctx->ExecuteFlag) {
4406 CALL_StencilOpSeparate(ctx->Exec, (face, fail, zfail, zpass));
4407 }
4408 }
4409
4410
4411 static void GLAPIENTRY
4412 save_TexEnvfv(GLenum target, GLenum pname, const GLfloat *params)
4413 {
4414 GET_CURRENT_CONTEXT(ctx);
4415 Node *n;
4416 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4417 n = alloc_instruction(ctx, OPCODE_TEXENV, 6);
4418 if (n) {
4419 n[1].e = target;
4420 n[2].e = pname;
4421 if (pname == GL_TEXTURE_ENV_COLOR) {
4422 n[3].f = params[0];
4423 n[4].f = params[1];
4424 n[5].f = params[2];
4425 n[6].f = params[3];
4426 }
4427 else {
4428 n[3].f = params[0];
4429 n[4].f = n[5].f = n[6].f = 0.0F;
4430 }
4431 }
4432 if (ctx->ExecuteFlag) {
4433 CALL_TexEnvfv(ctx->Exec, (target, pname, params));
4434 }
4435 }
4436
4437
4438 static void GLAPIENTRY
4439 save_TexEnvf(GLenum target, GLenum pname, GLfloat param)
4440 {
4441 GLfloat parray[4];
4442 parray[0] = (GLfloat) param;
4443 parray[1] = parray[2] = parray[3] = 0.0F;
4444 save_TexEnvfv(target, pname, parray);
4445 }
4446
4447
4448 static void GLAPIENTRY
4449 save_TexEnvi(GLenum target, GLenum pname, GLint param)
4450 {
4451 GLfloat p[4];
4452 p[0] = (GLfloat) param;
4453 p[1] = p[2] = p[3] = 0.0F;
4454 save_TexEnvfv(target, pname, p);
4455 }
4456
4457
4458 static void GLAPIENTRY
4459 save_TexEnviv(GLenum target, GLenum pname, const GLint * param)
4460 {
4461 GLfloat p[4];
4462 if (pname == GL_TEXTURE_ENV_COLOR) {
4463 p[0] = INT_TO_FLOAT(param[0]);
4464 p[1] = INT_TO_FLOAT(param[1]);
4465 p[2] = INT_TO_FLOAT(param[2]);
4466 p[3] = INT_TO_FLOAT(param[3]);
4467 }
4468 else {
4469 p[0] = (GLfloat) param[0];
4470 p[1] = p[2] = p[3] = 0.0F;
4471 }
4472 save_TexEnvfv(target, pname, p);
4473 }
4474
4475
4476 static void GLAPIENTRY
4477 save_TexGenfv(GLenum coord, GLenum pname, const GLfloat *params)
4478 {
4479 GET_CURRENT_CONTEXT(ctx);
4480 Node *n;
4481 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4482 n = alloc_instruction(ctx, OPCODE_TEXGEN, 6);
4483 if (n) {
4484 n[1].e = coord;
4485 n[2].e = pname;
4486 n[3].f = params[0];
4487 n[4].f = params[1];
4488 n[5].f = params[2];
4489 n[6].f = params[3];
4490 }
4491 if (ctx->ExecuteFlag) {
4492 CALL_TexGenfv(ctx->Exec, (coord, pname, params));
4493 }
4494 }
4495
4496
4497 static void GLAPIENTRY
4498 save_TexGeniv(GLenum coord, GLenum pname, const GLint *params)
4499 {
4500 GLfloat p[4];
4501 p[0] = (GLfloat) params[0];
4502 p[1] = (GLfloat) params[1];
4503 p[2] = (GLfloat) params[2];
4504 p[3] = (GLfloat) params[3];
4505 save_TexGenfv(coord, pname, p);
4506 }
4507
4508
4509 static void GLAPIENTRY
4510 save_TexGend(GLenum coord, GLenum pname, GLdouble param)
4511 {
4512 GLfloat parray[4];
4513 parray[0] = (GLfloat) param;
4514 parray[1] = parray[2] = parray[3] = 0.0F;
4515 save_TexGenfv(coord, pname, parray);
4516 }
4517
4518
4519 static void GLAPIENTRY
4520 save_TexGendv(GLenum coord, GLenum pname, const GLdouble *params)
4521 {
4522 GLfloat p[4];
4523 p[0] = (GLfloat) params[0];
4524 p[1] = (GLfloat) params[1];
4525 p[2] = (GLfloat) params[2];
4526 p[3] = (GLfloat) params[3];
4527 save_TexGenfv(coord, pname, p);
4528 }
4529
4530
4531 static void GLAPIENTRY
4532 save_TexGenf(GLenum coord, GLenum pname, GLfloat param)
4533 {
4534 GLfloat parray[4];
4535 parray[0] = param;
4536 parray[1] = parray[2] = parray[3] = 0.0F;
4537 save_TexGenfv(coord, pname, parray);
4538 }
4539
4540
4541 static void GLAPIENTRY
4542 save_TexGeni(GLenum coord, GLenum pname, GLint param)
4543 {
4544 GLint parray[4];
4545 parray[0] = param;
4546 parray[1] = parray[2] = parray[3] = 0;
4547 save_TexGeniv(coord, pname, parray);
4548 }
4549
4550
4551 static void GLAPIENTRY
4552 save_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
4553 {
4554 GET_CURRENT_CONTEXT(ctx);
4555 Node *n;
4556 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4557 n = alloc_instruction(ctx, OPCODE_TEXPARAMETER, 6);
4558 if (n) {
4559 n[1].e = target;
4560 n[2].e = pname;
4561 n[3].f = params[0];
4562 n[4].f = params[1];
4563 n[5].f = params[2];
4564 n[6].f = params[3];
4565 }
4566 if (ctx->ExecuteFlag) {
4567 CALL_TexParameterfv(ctx->Exec, (target, pname, params));
4568 }
4569 }
4570
4571
4572 static void GLAPIENTRY
4573 save_TexParameterf(GLenum target, GLenum pname, GLfloat param)
4574 {
4575 GLfloat parray[4];
4576 parray[0] = param;
4577 parray[1] = parray[2] = parray[3] = 0.0F;
4578 save_TexParameterfv(target, pname, parray);
4579 }
4580
4581
4582 static void GLAPIENTRY
4583 save_TexParameteri(GLenum target, GLenum pname, GLint param)
4584 {
4585 GLfloat fparam[4];
4586 fparam[0] = (GLfloat) param;
4587 fparam[1] = fparam[2] = fparam[3] = 0.0F;
4588 save_TexParameterfv(target, pname, fparam);
4589 }
4590
4591
4592 static void GLAPIENTRY
4593 save_TexParameteriv(GLenum target, GLenum pname, const GLint *params)
4594 {
4595 GLfloat fparam[4];
4596 fparam[0] = (GLfloat) params[0];
4597 fparam[1] = fparam[2] = fparam[3] = 0.0F;
4598 save_TexParameterfv(target, pname, fparam);
4599 }
4600
4601
4602 static void GLAPIENTRY
4603 save_TexImage1D(GLenum target,
4604 GLint level, GLint components,
4605 GLsizei width, GLint border,
4606 GLenum format, GLenum type, const GLvoid * pixels)
4607 {
4608 GET_CURRENT_CONTEXT(ctx);
4609 if (target == GL_PROXY_TEXTURE_1D) {
4610 /* don't compile, execute immediately */
4611 CALL_TexImage1D(ctx->Exec, (target, level, components, width,
4612 border, format, type, pixels));
4613 }
4614 else {
4615 Node *n;
4616 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4617 n = alloc_instruction(ctx, OPCODE_TEX_IMAGE1D, 7 + POINTER_DWORDS);
4618 if (n) {
4619 n[1].e = target;
4620 n[2].i = level;
4621 n[3].i = components;
4622 n[4].i = (GLint) width;
4623 n[5].i = border;
4624 n[6].e = format;
4625 n[7].e = type;
4626 save_pointer(&n[8],
4627 unpack_image(ctx, 1, width, 1, 1, format, type,
4628 pixels, &ctx->Unpack));
4629 }
4630 if (ctx->ExecuteFlag) {
4631 CALL_TexImage1D(ctx->Exec, (target, level, components, width,
4632 border, format, type, pixels));
4633 }
4634 }
4635 }
4636
4637
4638 static void GLAPIENTRY
4639 save_TexImage2D(GLenum target,
4640 GLint level, GLint components,
4641 GLsizei width, GLsizei height, GLint border,
4642 GLenum format, GLenum type, const GLvoid * pixels)
4643 {
4644 GET_CURRENT_CONTEXT(ctx);
4645 if (target == GL_PROXY_TEXTURE_2D) {
4646 /* don't compile, execute immediately */
4647 CALL_TexImage2D(ctx->Exec, (target, level, components, width,
4648 height, border, format, type, pixels));
4649 }
4650 else {
4651 Node *n;
4652 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4653 n = alloc_instruction(ctx, OPCODE_TEX_IMAGE2D, 8 + POINTER_DWORDS);
4654 if (n) {
4655 n[1].e = target;
4656 n[2].i = level;
4657 n[3].i = components;
4658 n[4].i = (GLint) width;
4659 n[5].i = (GLint) height;
4660 n[6].i = border;
4661 n[7].e = format;
4662 n[8].e = type;
4663 save_pointer(&n[9],
4664 unpack_image(ctx, 2, width, height, 1, format, type,
4665 pixels, &ctx->Unpack));
4666 }
4667 if (ctx->ExecuteFlag) {
4668 CALL_TexImage2D(ctx->Exec, (target, level, components, width,
4669 height, border, format, type, pixels));
4670 }
4671 }
4672 }
4673
4674
4675 static void GLAPIENTRY
4676 save_TexImage3D(GLenum target,
4677 GLint level, GLint internalFormat,
4678 GLsizei width, GLsizei height, GLsizei depth,
4679 GLint border,
4680 GLenum format, GLenum type, const GLvoid * pixels)
4681 {
4682 GET_CURRENT_CONTEXT(ctx);
4683 if (target == GL_PROXY_TEXTURE_3D) {
4684 /* don't compile, execute immediately */
4685 CALL_TexImage3D(ctx->Exec, (target, level, internalFormat, width,
4686 height, depth, border, format, type,
4687 pixels));
4688 }
4689 else {
4690 Node *n;
4691 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4692 n = alloc_instruction(ctx, OPCODE_TEX_IMAGE3D, 9 + POINTER_DWORDS);
4693 if (n) {
4694 n[1].e = target;
4695 n[2].i = level;
4696 n[3].i = (GLint) internalFormat;
4697 n[4].i = (GLint) width;
4698 n[5].i = (GLint) height;
4699 n[6].i = (GLint) depth;
4700 n[7].i = border;
4701 n[8].e = format;
4702 n[9].e = type;
4703 save_pointer(&n[10],
4704 unpack_image(ctx, 3, width, height, depth, format, type,
4705 pixels, &ctx->Unpack));
4706 }
4707 if (ctx->ExecuteFlag) {
4708 CALL_TexImage3D(ctx->Exec, (target, level, internalFormat, width,
4709 height, depth, border, format, type,
4710 pixels));
4711 }
4712 }
4713 }
4714
4715
4716 static void GLAPIENTRY
4717 save_TexSubImage1D(GLenum target, GLint level, GLint xoffset,
4718 GLsizei width, GLenum format, GLenum type,
4719 const GLvoid * pixels)
4720 {
4721 GET_CURRENT_CONTEXT(ctx);
4722 Node *n;
4723
4724 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4725
4726 n = alloc_instruction(ctx, OPCODE_TEX_SUB_IMAGE1D, 6 + POINTER_DWORDS);
4727 if (n) {
4728 n[1].e = target;
4729 n[2].i = level;
4730 n[3].i = xoffset;
4731 n[4].i = (GLint) width;
4732 n[5].e = format;
4733 n[6].e = type;
4734 save_pointer(&n[7],
4735 unpack_image(ctx, 1, width, 1, 1, format, type,
4736 pixels, &ctx->Unpack));
4737 }
4738 if (ctx->ExecuteFlag) {
4739 CALL_TexSubImage1D(ctx->Exec, (target, level, xoffset, width,
4740 format, type, pixels));
4741 }
4742 }
4743
4744
4745 static void GLAPIENTRY
4746 save_TexSubImage2D(GLenum target, GLint level,
4747 GLint xoffset, GLint yoffset,
4748 GLsizei width, GLsizei height,
4749 GLenum format, GLenum type, const GLvoid * pixels)
4750 {
4751 GET_CURRENT_CONTEXT(ctx);
4752 Node *n;
4753
4754 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4755
4756 n = alloc_instruction(ctx, OPCODE_TEX_SUB_IMAGE2D, 8 + POINTER_DWORDS);
4757 if (n) {
4758 n[1].e = target;
4759 n[2].i = level;
4760 n[3].i = xoffset;
4761 n[4].i = yoffset;
4762 n[5].i = (GLint) width;
4763 n[6].i = (GLint) height;
4764 n[7].e = format;
4765 n[8].e = type;
4766 save_pointer(&n[9],
4767 unpack_image(ctx, 2, width, height, 1, format, type,
4768 pixels, &ctx->Unpack));
4769 }
4770 if (ctx->ExecuteFlag) {
4771 CALL_TexSubImage2D(ctx->Exec, (target, level, xoffset, yoffset,
4772 width, height, format, type, pixels));
4773 }
4774 }
4775
4776
4777 static void GLAPIENTRY
4778 save_TexSubImage3D(GLenum target, GLint level,
4779 GLint xoffset, GLint yoffset, GLint zoffset,
4780 GLsizei width, GLsizei height, GLsizei depth,
4781 GLenum format, GLenum type, const GLvoid * pixels)
4782 {
4783 GET_CURRENT_CONTEXT(ctx);
4784 Node *n;
4785
4786 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4787
4788 n = alloc_instruction(ctx, OPCODE_TEX_SUB_IMAGE3D, 10 + POINTER_DWORDS);
4789 if (n) {
4790 n[1].e = target;
4791 n[2].i = level;
4792 n[3].i = xoffset;
4793 n[4].i = yoffset;
4794 n[5].i = zoffset;
4795 n[6].i = (GLint) width;
4796 n[7].i = (GLint) height;
4797 n[8].i = (GLint) depth;
4798 n[9].e = format;
4799 n[10].e = type;
4800 save_pointer(&n[11],
4801 unpack_image(ctx, 3, width, height, depth, format, type,
4802 pixels, &ctx->Unpack));
4803 }
4804 if (ctx->ExecuteFlag) {
4805 CALL_TexSubImage3D(ctx->Exec, (target, level,
4806 xoffset, yoffset, zoffset,
4807 width, height, depth, format, type,
4808 pixels));
4809 }
4810 }
4811
4812
4813 static void GLAPIENTRY
4814 save_Translatef(GLfloat x, GLfloat y, GLfloat z)
4815 {
4816 GET_CURRENT_CONTEXT(ctx);
4817 Node *n;
4818 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4819 n = alloc_instruction(ctx, OPCODE_TRANSLATE, 3);
4820 if (n) {
4821 n[1].f = x;
4822 n[2].f = y;
4823 n[3].f = z;
4824 }
4825 if (ctx->ExecuteFlag) {
4826 CALL_Translatef(ctx->Exec, (x, y, z));
4827 }
4828 }
4829
4830
4831 static void GLAPIENTRY
4832 save_Translated(GLdouble x, GLdouble y, GLdouble z)
4833 {
4834 save_Translatef((GLfloat) x, (GLfloat) y, (GLfloat) z);
4835 }
4836
4837
4838
4839 static void GLAPIENTRY
4840 save_Viewport(GLint x, GLint y, GLsizei width, GLsizei height)
4841 {
4842 GET_CURRENT_CONTEXT(ctx);
4843 Node *n;
4844 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4845 n = alloc_instruction(ctx, OPCODE_VIEWPORT, 4);
4846 if (n) {
4847 n[1].i = x;
4848 n[2].i = y;
4849 n[3].i = (GLint) width;
4850 n[4].i = (GLint) height;
4851 }
4852 if (ctx->ExecuteFlag) {
4853 CALL_Viewport(ctx->Exec, (x, y, width, height));
4854 }
4855 }
4856
4857 static void GLAPIENTRY
4858 save_ViewportIndexedf(GLuint index, GLfloat x, GLfloat y, GLfloat width,
4859 GLfloat height)
4860 {
4861 GET_CURRENT_CONTEXT(ctx);
4862 Node *n;
4863 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4864 n = alloc_instruction(ctx, OPCODE_VIEWPORT_INDEXED_F, 5);
4865 if (n) {
4866 n[1].ui = index;
4867 n[2].f = x;
4868 n[3].f = y;
4869 n[4].f = width;
4870 n[5].f = height;
4871 }
4872 if (ctx->ExecuteFlag) {
4873 CALL_ViewportIndexedf(ctx->Exec, (index, x, y, width, height));
4874 }
4875 }
4876
4877 static void GLAPIENTRY
4878 save_ViewportIndexedfv(GLuint index, const GLfloat *v)
4879 {
4880 GET_CURRENT_CONTEXT(ctx);
4881 Node *n;
4882 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4883 n = alloc_instruction(ctx, OPCODE_VIEWPORT_INDEXED_FV, 5);
4884 if (n) {
4885 n[1].ui = index;
4886 n[2].f = v[0];
4887 n[3].f = v[1];
4888 n[4].f = v[2];
4889 n[5].f = v[3];
4890 }
4891 if (ctx->ExecuteFlag) {
4892 CALL_ViewportIndexedfv(ctx->Exec, (index, v));
4893 }
4894 }
4895
4896 static void GLAPIENTRY
4897 save_ViewportArrayv(GLuint first, GLsizei count, const GLfloat *v)
4898 {
4899 GET_CURRENT_CONTEXT(ctx);
4900 Node *n;
4901 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4902 n = alloc_instruction(ctx, OPCODE_VIEWPORT_ARRAY_V, 2 + POINTER_DWORDS);
4903 if (n) {
4904 n[1].ui = first;
4905 n[2].si = count;
4906 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLfloat)));
4907 }
4908 if (ctx->ExecuteFlag) {
4909 CALL_ViewportArrayv(ctx->Exec, (first, count, v));
4910 }
4911 }
4912
4913 static void GLAPIENTRY
4914 save_ScissorIndexed(GLuint index, GLint left, GLint bottom, GLsizei width,
4915 GLsizei height)
4916 {
4917 GET_CURRENT_CONTEXT(ctx);
4918 Node *n;
4919 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4920 n = alloc_instruction(ctx, OPCODE_SCISSOR_INDEXED, 5);
4921 if (n) {
4922 n[1].ui = index;
4923 n[2].i = left;
4924 n[3].i = bottom;
4925 n[4].si = width;
4926 n[5].si = height;
4927 }
4928 if (ctx->ExecuteFlag) {
4929 CALL_ScissorIndexed(ctx->Exec, (index, left, bottom, width, height));
4930 }
4931 }
4932
4933 static void GLAPIENTRY
4934 save_ScissorIndexedv(GLuint index, const GLint *v)
4935 {
4936 GET_CURRENT_CONTEXT(ctx);
4937 Node *n;
4938 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4939 n = alloc_instruction(ctx, OPCODE_SCISSOR_INDEXED_V, 5);
4940 if (n) {
4941 n[1].ui = index;
4942 n[2].i = v[0];
4943 n[3].i = v[1];
4944 n[4].si = v[2];
4945 n[5].si = v[3];
4946 }
4947 if (ctx->ExecuteFlag) {
4948 CALL_ScissorIndexedv(ctx->Exec, (index, v));
4949 }
4950 }
4951
4952 static void GLAPIENTRY
4953 save_ScissorArrayv(GLuint first, GLsizei count, const GLint *v)
4954 {
4955 GET_CURRENT_CONTEXT(ctx);
4956 Node *n;
4957 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4958 n = alloc_instruction(ctx, OPCODE_SCISSOR_ARRAY_V, 2 + POINTER_DWORDS);
4959 if (n) {
4960 n[1].ui = first;
4961 n[2].si = count;
4962 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLint)));
4963 }
4964 if (ctx->ExecuteFlag) {
4965 CALL_ScissorArrayv(ctx->Exec, (first, count, v));
4966 }
4967 }
4968
4969 static void GLAPIENTRY
4970 save_DepthRangeIndexed(GLuint index, GLclampd n, GLclampd f)
4971 {
4972 GET_CURRENT_CONTEXT(ctx);
4973 Node *node;
4974 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4975 node = alloc_instruction(ctx, OPCODE_DEPTH_INDEXED, 3);
4976 if (node) {
4977 node[1].ui = index;
4978 /* Mesa stores these as floats internally so we deliberately convert
4979 * them to a float here.
4980 */
4981 node[2].f = n;
4982 node[3].f = f;
4983 }
4984 if (ctx->ExecuteFlag) {
4985 CALL_DepthRangeIndexed(ctx->Exec, (index, n, f));
4986 }
4987 }
4988
4989 static void GLAPIENTRY
4990 save_DepthRangeArrayv(GLuint first, GLsizei count, const GLclampd *v)
4991 {
4992 GET_CURRENT_CONTEXT(ctx);
4993 Node *n;
4994 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4995 n = alloc_instruction(ctx, OPCODE_DEPTH_ARRAY_V, 2 + POINTER_DWORDS);
4996 if (n) {
4997 n[1].ui = first;
4998 n[2].si = count;
4999 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLclampd)));
5000 }
5001 if (ctx->ExecuteFlag) {
5002 CALL_DepthRangeArrayv(ctx->Exec, (first, count, v));
5003 }
5004 }
5005
5006 static void GLAPIENTRY
5007 save_WindowPos4fMESA(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
5008 {
5009 GET_CURRENT_CONTEXT(ctx);
5010 Node *n;
5011 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5012 n = alloc_instruction(ctx, OPCODE_WINDOW_POS, 4);
5013 if (n) {
5014 n[1].f = x;
5015 n[2].f = y;
5016 n[3].f = z;
5017 n[4].f = w;
5018 }
5019 if (ctx->ExecuteFlag) {
5020 CALL_WindowPos4fMESA(ctx->Exec, (x, y, z, w));
5021 }
5022 }
5023
5024 static void GLAPIENTRY
5025 save_WindowPos2dMESA(GLdouble x, GLdouble y)
5026 {
5027 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
5028 }
5029
5030 static void GLAPIENTRY
5031 save_WindowPos2fMESA(GLfloat x, GLfloat y)
5032 {
5033 save_WindowPos4fMESA(x, y, 0.0F, 1.0F);
5034 }
5035
5036 static void GLAPIENTRY
5037 save_WindowPos2iMESA(GLint x, GLint y)
5038 {
5039 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
5040 }
5041
5042 static void GLAPIENTRY
5043 save_WindowPos2sMESA(GLshort x, GLshort y)
5044 {
5045 save_WindowPos4fMESA(x, y, 0.0F, 1.0F);
5046 }
5047
5048 static void GLAPIENTRY
5049 save_WindowPos3dMESA(GLdouble x, GLdouble y, GLdouble z)
5050 {
5051 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
5052 }
5053
5054 static void GLAPIENTRY
5055 save_WindowPos3fMESA(GLfloat x, GLfloat y, GLfloat z)
5056 {
5057 save_WindowPos4fMESA(x, y, z, 1.0F);
5058 }
5059
5060 static void GLAPIENTRY
5061 save_WindowPos3iMESA(GLint x, GLint y, GLint z)
5062 {
5063 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
5064 }
5065
5066 static void GLAPIENTRY
5067 save_WindowPos3sMESA(GLshort x, GLshort y, GLshort z)
5068 {
5069 save_WindowPos4fMESA(x, y, z, 1.0F);
5070 }
5071
5072 static void GLAPIENTRY
5073 save_WindowPos4dMESA(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
5074 {
5075 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
5076 }
5077
5078 static void GLAPIENTRY
5079 save_WindowPos4iMESA(GLint x, GLint y, GLint z, GLint w)
5080 {
5081 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
5082 }
5083
5084 static void GLAPIENTRY
5085 save_WindowPos4sMESA(GLshort x, GLshort y, GLshort z, GLshort w)
5086 {
5087 save_WindowPos4fMESA(x, y, z, w);
5088 }
5089
5090 static void GLAPIENTRY
5091 save_WindowPos2dvMESA(const GLdouble * v)
5092 {
5093 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
5094 }
5095
5096 static void GLAPIENTRY
5097 save_WindowPos2fvMESA(const GLfloat * v)
5098 {
5099 save_WindowPos4fMESA(v[0], v[1], 0.0F, 1.0F);
5100 }
5101
5102 static void GLAPIENTRY
5103 save_WindowPos2ivMESA(const GLint * v)
5104 {
5105 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
5106 }
5107
5108 static void GLAPIENTRY
5109 save_WindowPos2svMESA(const GLshort * v)
5110 {
5111 save_WindowPos4fMESA(v[0], v[1], 0.0F, 1.0F);
5112 }
5113
5114 static void GLAPIENTRY
5115 save_WindowPos3dvMESA(const GLdouble * v)
5116 {
5117 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
5118 }
5119
5120 static void GLAPIENTRY
5121 save_WindowPos3fvMESA(const GLfloat * v)
5122 {
5123 save_WindowPos4fMESA(v[0], v[1], v[2], 1.0F);
5124 }
5125
5126 static void GLAPIENTRY
5127 save_WindowPos3ivMESA(const GLint * v)
5128 {
5129 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
5130 }
5131
5132 static void GLAPIENTRY
5133 save_WindowPos3svMESA(const GLshort * v)
5134 {
5135 save_WindowPos4fMESA(v[0], v[1], v[2], 1.0F);
5136 }
5137
5138 static void GLAPIENTRY
5139 save_WindowPos4dvMESA(const GLdouble * v)
5140 {
5141 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1],
5142 (GLfloat) v[2], (GLfloat) v[3]);
5143 }
5144
5145 static void GLAPIENTRY
5146 save_WindowPos4fvMESA(const GLfloat * v)
5147 {
5148 save_WindowPos4fMESA(v[0], v[1], v[2], v[3]);
5149 }
5150
5151 static void GLAPIENTRY
5152 save_WindowPos4ivMESA(const GLint * v)
5153 {
5154 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1],
5155 (GLfloat) v[2], (GLfloat) v[3]);
5156 }
5157
5158 static void GLAPIENTRY
5159 save_WindowPos4svMESA(const GLshort * v)
5160 {
5161 save_WindowPos4fMESA(v[0], v[1], v[2], v[3]);
5162 }
5163
5164
5165
5166 /* GL_ARB_multitexture */
5167 static void GLAPIENTRY
5168 save_ActiveTextureARB(GLenum target)
5169 {
5170 GET_CURRENT_CONTEXT(ctx);
5171 Node *n;
5172 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5173 n = alloc_instruction(ctx, OPCODE_ACTIVE_TEXTURE, 1);
5174 if (n) {
5175 n[1].e = target;
5176 }
5177 if (ctx->ExecuteFlag) {
5178 CALL_ActiveTexture(ctx->Exec, (target));
5179 }
5180 }
5181
5182
5183 /* GL_ARB_transpose_matrix */
5184
5185 static void GLAPIENTRY
5186 save_LoadTransposeMatrixdARB(const GLdouble m[16])
5187 {
5188 GLfloat tm[16];
5189 _math_transposefd(tm, m);
5190 save_LoadMatrixf(tm);
5191 }
5192
5193
5194 static void GLAPIENTRY
5195 save_LoadTransposeMatrixfARB(const GLfloat m[16])
5196 {
5197 GLfloat tm[16];
5198 _math_transposef(tm, m);
5199 save_LoadMatrixf(tm);
5200 }
5201
5202
5203 static void GLAPIENTRY
5204 save_MultTransposeMatrixdARB(const GLdouble m[16])
5205 {
5206 GLfloat tm[16];
5207 _math_transposefd(tm, m);
5208 save_MultMatrixf(tm);
5209 }
5210
5211
5212 static void GLAPIENTRY
5213 save_MultTransposeMatrixfARB(const GLfloat m[16])
5214 {
5215 GLfloat tm[16];
5216 _math_transposef(tm, m);
5217 save_MultMatrixf(tm);
5218 }
5219
5220 static GLvoid *copy_data(const GLvoid *data, GLsizei size, const char *func)
5221 {
5222 GET_CURRENT_CONTEXT(ctx);
5223 GLvoid *image;
5224
5225 if (!data)
5226 return NULL;
5227
5228 image = malloc(size);
5229 if (!image) {
5230 _mesa_error(ctx, GL_OUT_OF_MEMORY, "%s", func);
5231 return NULL;
5232 }
5233 memcpy(image, data, size);
5234
5235 return image;
5236 }
5237
5238
5239 /* GL_ARB_texture_compression */
5240 static void GLAPIENTRY
5241 save_CompressedTexImage1DARB(GLenum target, GLint level,
5242 GLenum internalFormat, GLsizei width,
5243 GLint border, GLsizei imageSize,
5244 const GLvoid * data)
5245 {
5246 GET_CURRENT_CONTEXT(ctx);
5247 if (target == GL_PROXY_TEXTURE_1D) {
5248 /* don't compile, execute immediately */
5249 CALL_CompressedTexImage1D(ctx->Exec, (target, level, internalFormat,
5250 width, border, imageSize,
5251 data));
5252 }
5253 else {
5254 Node *n;
5255 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5256
5257 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_1D,
5258 6 + POINTER_DWORDS);
5259 if (n) {
5260 n[1].e = target;
5261 n[2].i = level;
5262 n[3].e = internalFormat;
5263 n[4].i = (GLint) width;
5264 n[5].i = border;
5265 n[6].i = imageSize;
5266 save_pointer(&n[7],
5267 copy_data(data, imageSize, "glCompressedTexImage1DARB"));
5268 }
5269 if (ctx->ExecuteFlag) {
5270 CALL_CompressedTexImage1D(ctx->Exec,
5271 (target, level, internalFormat, width,
5272 border, imageSize, data));
5273 }
5274 }
5275 }
5276
5277
5278 static void GLAPIENTRY
5279 save_CompressedTexImage2DARB(GLenum target, GLint level,
5280 GLenum internalFormat, GLsizei width,
5281 GLsizei height, GLint border, GLsizei imageSize,
5282 const GLvoid * data)
5283 {
5284 GET_CURRENT_CONTEXT(ctx);
5285 if (target == GL_PROXY_TEXTURE_2D) {
5286 /* don't compile, execute immediately */
5287 CALL_CompressedTexImage2D(ctx->Exec, (target, level, internalFormat,
5288 width, height, border,
5289 imageSize, data));
5290 }
5291 else {
5292 Node *n;
5293 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5294
5295 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_2D,
5296 7 + POINTER_DWORDS);
5297 if (n) {
5298 n[1].e = target;
5299 n[2].i = level;
5300 n[3].e = internalFormat;
5301 n[4].i = (GLint) width;
5302 n[5].i = (GLint) height;
5303 n[6].i = border;
5304 n[7].i = imageSize;
5305 save_pointer(&n[8],
5306 copy_data(data, imageSize, "glCompressedTexImage2DARB"));
5307 }
5308 if (ctx->ExecuteFlag) {
5309 CALL_CompressedTexImage2D(ctx->Exec,
5310 (target, level, internalFormat, width,
5311 height, border, imageSize, data));
5312 }
5313 }
5314 }
5315
5316
5317 static void GLAPIENTRY
5318 save_CompressedTexImage3DARB(GLenum target, GLint level,
5319 GLenum internalFormat, GLsizei width,
5320 GLsizei height, GLsizei depth, GLint border,
5321 GLsizei imageSize, const GLvoid * data)
5322 {
5323 GET_CURRENT_CONTEXT(ctx);
5324 if (target == GL_PROXY_TEXTURE_3D) {
5325 /* don't compile, execute immediately */
5326 CALL_CompressedTexImage3D(ctx->Exec, (target, level, internalFormat,
5327 width, height, depth, border,
5328 imageSize, data));
5329 }
5330 else {
5331 Node *n;
5332 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5333
5334 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_3D,
5335 8 + POINTER_DWORDS);
5336 if (n) {
5337 n[1].e = target;
5338 n[2].i = level;
5339 n[3].e = internalFormat;
5340 n[4].i = (GLint) width;
5341 n[5].i = (GLint) height;
5342 n[6].i = (GLint) depth;
5343 n[7].i = border;
5344 n[8].i = imageSize;
5345 save_pointer(&n[9],
5346 copy_data(data, imageSize, "glCompressedTexImage3DARB"));
5347 }
5348 if (ctx->ExecuteFlag) {
5349 CALL_CompressedTexImage3D(ctx->Exec,
5350 (target, level, internalFormat, width,
5351 height, depth, border, imageSize,
5352 data));
5353 }
5354 }
5355 }
5356
5357
5358 static void GLAPIENTRY
5359 save_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset,
5360 GLsizei width, GLenum format,
5361 GLsizei imageSize, const GLvoid * data)
5362 {
5363 Node *n;
5364 GET_CURRENT_CONTEXT(ctx);
5365 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5366
5367 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D,
5368 6 + POINTER_DWORDS);
5369 if (n) {
5370 n[1].e = target;
5371 n[2].i = level;
5372 n[3].i = xoffset;
5373 n[4].i = (GLint) width;
5374 n[5].e = format;
5375 n[6].i = imageSize;
5376 save_pointer(&n[7],
5377 copy_data(data, imageSize, "glCompressedTexSubImage1DARB"));
5378 }
5379 if (ctx->ExecuteFlag) {
5380 CALL_CompressedTexSubImage1D(ctx->Exec, (target, level, xoffset,
5381 width, format, imageSize,
5382 data));
5383 }
5384 }
5385
5386
5387 static void GLAPIENTRY
5388 save_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset,
5389 GLint yoffset, GLsizei width, GLsizei height,
5390 GLenum format, GLsizei imageSize,
5391 const GLvoid * data)
5392 {
5393 Node *n;
5394 GET_CURRENT_CONTEXT(ctx);
5395 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5396
5397 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D,
5398 8 + POINTER_DWORDS);
5399 if (n) {
5400 n[1].e = target;
5401 n[2].i = level;
5402 n[3].i = xoffset;
5403 n[4].i = yoffset;
5404 n[5].i = (GLint) width;
5405 n[6].i = (GLint) height;
5406 n[7].e = format;
5407 n[8].i = imageSize;
5408 save_pointer(&n[9],
5409 copy_data(data, imageSize, "glCompressedTexSubImage2DARB"));
5410 }
5411 if (ctx->ExecuteFlag) {
5412 CALL_CompressedTexSubImage2D(ctx->Exec,
5413 (target, level, xoffset, yoffset, width,
5414 height, format, imageSize, data));
5415 }
5416 }
5417
5418
5419 static void GLAPIENTRY
5420 save_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset,
5421 GLint yoffset, GLint zoffset, GLsizei width,
5422 GLsizei height, GLsizei depth, GLenum format,
5423 GLsizei imageSize, const GLvoid * data)
5424 {
5425 Node *n;
5426 GET_CURRENT_CONTEXT(ctx);
5427 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5428
5429 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D,
5430 10 + POINTER_DWORDS);
5431 if (n) {
5432 n[1].e = target;
5433 n[2].i = level;
5434 n[3].i = xoffset;
5435 n[4].i = yoffset;
5436 n[5].i = zoffset;
5437 n[6].i = (GLint) width;
5438 n[7].i = (GLint) height;
5439 n[8].i = (GLint) depth;
5440 n[9].e = format;
5441 n[10].i = imageSize;
5442 save_pointer(&n[11],
5443 copy_data(data, imageSize, "glCompressedTexSubImage3DARB"));
5444 }
5445 if (ctx->ExecuteFlag) {
5446 CALL_CompressedTexSubImage3D(ctx->Exec,
5447 (target, level, xoffset, yoffset,
5448 zoffset, width, height, depth, format,
5449 imageSize, data));
5450 }
5451 }
5452
5453
5454 /* GL_ARB_multisample */
5455 static void GLAPIENTRY
5456 save_SampleCoverageARB(GLclampf value, GLboolean invert)
5457 {
5458 GET_CURRENT_CONTEXT(ctx);
5459 Node *n;
5460 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5461 n = alloc_instruction(ctx, OPCODE_SAMPLE_COVERAGE, 2);
5462 if (n) {
5463 n[1].f = value;
5464 n[2].b = invert;
5465 }
5466 if (ctx->ExecuteFlag) {
5467 CALL_SampleCoverage(ctx->Exec, (value, invert));
5468 }
5469 }
5470
5471
5472 /*
5473 * GL_ARB_vertex_program
5474 */
5475 static void GLAPIENTRY
5476 save_BindProgramARB(GLenum target, GLuint id)
5477 {
5478 GET_CURRENT_CONTEXT(ctx);
5479 Node *n;
5480 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5481 n = alloc_instruction(ctx, OPCODE_BIND_PROGRAM_ARB, 2);
5482 if (n) {
5483 n[1].e = target;
5484 n[2].ui = id;
5485 }
5486 if (ctx->ExecuteFlag) {
5487 CALL_BindProgramARB(ctx->Exec, (target, id));
5488 }
5489 }
5490
5491 static void GLAPIENTRY
5492 save_ProgramEnvParameter4fARB(GLenum target, GLuint index,
5493 GLfloat x, GLfloat y, GLfloat z, GLfloat w)
5494 {
5495 GET_CURRENT_CONTEXT(ctx);
5496 Node *n;
5497 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5498 n = alloc_instruction(ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6);
5499 if (n) {
5500 n[1].e = target;
5501 n[2].ui = index;
5502 n[3].f = x;
5503 n[4].f = y;
5504 n[5].f = z;
5505 n[6].f = w;
5506 }
5507 if (ctx->ExecuteFlag) {
5508 CALL_ProgramEnvParameter4fARB(ctx->Exec, (target, index, x, y, z, w));
5509 }
5510 }
5511
5512
5513 static void GLAPIENTRY
5514 save_ProgramEnvParameter4fvARB(GLenum target, GLuint index,
5515 const GLfloat *params)
5516 {
5517 save_ProgramEnvParameter4fARB(target, index, params[0], params[1],
5518 params[2], params[3]);
5519 }
5520
5521
5522 static void GLAPIENTRY
5523 save_ProgramEnvParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
5524 const GLfloat * params)
5525 {
5526 GET_CURRENT_CONTEXT(ctx);
5527 Node *n;
5528 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5529
5530 if (count > 0) {
5531 GLint i;
5532 const GLfloat * p = params;
5533
5534 for (i = 0 ; i < count ; i++) {
5535 n = alloc_instruction(ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6);
5536 if (n) {
5537 n[1].e = target;
5538 n[2].ui = index;
5539 n[3].f = p[0];
5540 n[4].f = p[1];
5541 n[5].f = p[2];
5542 n[6].f = p[3];
5543 p += 4;
5544 }
5545 }
5546 }
5547
5548 if (ctx->ExecuteFlag) {
5549 CALL_ProgramEnvParameters4fvEXT(ctx->Exec, (target, index, count, params));
5550 }
5551 }
5552
5553
5554 static void GLAPIENTRY
5555 save_ProgramEnvParameter4dARB(GLenum target, GLuint index,
5556 GLdouble x, GLdouble y, GLdouble z, GLdouble w)
5557 {
5558 save_ProgramEnvParameter4fARB(target, index,
5559 (GLfloat) x,
5560 (GLfloat) y, (GLfloat) z, (GLfloat) w);
5561 }
5562
5563
5564 static void GLAPIENTRY
5565 save_ProgramEnvParameter4dvARB(GLenum target, GLuint index,
5566 const GLdouble *params)
5567 {
5568 save_ProgramEnvParameter4fARB(target, index,
5569 (GLfloat) params[0],
5570 (GLfloat) params[1],
5571 (GLfloat) params[2], (GLfloat) params[3]);
5572 }
5573
5574
5575 static void GLAPIENTRY
5576 save_ProgramLocalParameter4fARB(GLenum target, GLuint index,
5577 GLfloat x, GLfloat y, GLfloat z, GLfloat w)
5578 {
5579 GET_CURRENT_CONTEXT(ctx);
5580 Node *n;
5581 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5582 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5583 if (n) {
5584 n[1].e = target;
5585 n[2].ui = index;
5586 n[3].f = x;
5587 n[4].f = y;
5588 n[5].f = z;
5589 n[6].f = w;
5590 }
5591 if (ctx->ExecuteFlag) {
5592 CALL_ProgramLocalParameter4fARB(ctx->Exec, (target, index, x, y, z, w));
5593 }
5594 }
5595
5596
5597 static void GLAPIENTRY
5598 save_ProgramLocalParameter4fvARB(GLenum target, GLuint index,
5599 const GLfloat *params)
5600 {
5601 GET_CURRENT_CONTEXT(ctx);
5602 Node *n;
5603 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5604 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5605 if (n) {
5606 n[1].e = target;
5607 n[2].ui = index;
5608 n[3].f = params[0];
5609 n[4].f = params[1];
5610 n[5].f = params[2];
5611 n[6].f = params[3];
5612 }
5613 if (ctx->ExecuteFlag) {
5614 CALL_ProgramLocalParameter4fvARB(ctx->Exec, (target, index, params));
5615 }
5616 }
5617
5618
5619 static void GLAPIENTRY
5620 save_ProgramLocalParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
5621 const GLfloat *params)
5622 {
5623 GET_CURRENT_CONTEXT(ctx);
5624 Node *n;
5625 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5626
5627 if (count > 0) {
5628 GLint i;
5629 const GLfloat * p = params;
5630
5631 for (i = 0 ; i < count ; i++) {
5632 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5633 if (n) {
5634 n[1].e = target;
5635 n[2].ui = index;
5636 n[3].f = p[0];
5637 n[4].f = p[1];
5638 n[5].f = p[2];
5639 n[6].f = p[3];
5640 p += 4;
5641 }
5642 }
5643 }
5644
5645 if (ctx->ExecuteFlag) {
5646 CALL_ProgramLocalParameters4fvEXT(ctx->Exec, (target, index, count, params));
5647 }
5648 }
5649
5650
5651 static void GLAPIENTRY
5652 save_ProgramLocalParameter4dARB(GLenum target, GLuint index,
5653 GLdouble x, GLdouble y,
5654 GLdouble z, GLdouble w)
5655 {
5656 GET_CURRENT_CONTEXT(ctx);
5657 Node *n;
5658 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5659 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5660 if (n) {
5661 n[1].e = target;
5662 n[2].ui = index;
5663 n[3].f = (GLfloat) x;
5664 n[4].f = (GLfloat) y;
5665 n[5].f = (GLfloat) z;
5666 n[6].f = (GLfloat) w;
5667 }
5668 if (ctx->ExecuteFlag) {
5669 CALL_ProgramLocalParameter4dARB(ctx->Exec, (target, index, x, y, z, w));
5670 }
5671 }
5672
5673
5674 static void GLAPIENTRY
5675 save_ProgramLocalParameter4dvARB(GLenum target, GLuint index,
5676 const GLdouble *params)
5677 {
5678 GET_CURRENT_CONTEXT(ctx);
5679 Node *n;
5680 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5681 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5682 if (n) {
5683 n[1].e = target;
5684 n[2].ui = index;
5685 n[3].f = (GLfloat) params[0];
5686 n[4].f = (GLfloat) params[1];
5687 n[5].f = (GLfloat) params[2];
5688 n[6].f = (GLfloat) params[3];
5689 }
5690 if (ctx->ExecuteFlag) {
5691 CALL_ProgramLocalParameter4dvARB(ctx->Exec, (target, index, params));
5692 }
5693 }
5694
5695
5696 /* GL_EXT_stencil_two_side */
5697 static void GLAPIENTRY
5698 save_ActiveStencilFaceEXT(GLenum face)
5699 {
5700 GET_CURRENT_CONTEXT(ctx);
5701 Node *n;
5702 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5703 n = alloc_instruction(ctx, OPCODE_ACTIVE_STENCIL_FACE_EXT, 1);
5704 if (n) {
5705 n[1].e = face;
5706 }
5707 if (ctx->ExecuteFlag) {
5708 CALL_ActiveStencilFaceEXT(ctx->Exec, (face));
5709 }
5710 }
5711
5712
5713 /* GL_EXT_depth_bounds_test */
5714 static void GLAPIENTRY
5715 save_DepthBoundsEXT(GLclampd zmin, GLclampd zmax)
5716 {
5717 GET_CURRENT_CONTEXT(ctx);
5718 Node *n;
5719 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5720 n = alloc_instruction(ctx, OPCODE_DEPTH_BOUNDS_EXT, 2);
5721 if (n) {
5722 n[1].f = (GLfloat) zmin;
5723 n[2].f = (GLfloat) zmax;
5724 }
5725 if (ctx->ExecuteFlag) {
5726 CALL_DepthBoundsEXT(ctx->Exec, (zmin, zmax));
5727 }
5728 }
5729
5730
5731
5732 static void GLAPIENTRY
5733 save_ProgramStringARB(GLenum target, GLenum format, GLsizei len,
5734 const GLvoid * string)
5735 {
5736 GET_CURRENT_CONTEXT(ctx);
5737 Node *n;
5738
5739 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5740
5741 n = alloc_instruction(ctx, OPCODE_PROGRAM_STRING_ARB, 3 + POINTER_DWORDS);
5742 if (n) {
5743 GLubyte *programCopy = malloc(len);
5744 if (!programCopy) {
5745 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramStringARB");
5746 return;
5747 }
5748 memcpy(programCopy, string, len);
5749 n[1].e = target;
5750 n[2].e = format;
5751 n[3].i = len;
5752 save_pointer(&n[4], programCopy);
5753 }
5754 if (ctx->ExecuteFlag) {
5755 CALL_ProgramStringARB(ctx->Exec, (target, format, len, string));
5756 }
5757 }
5758
5759
5760 static void GLAPIENTRY
5761 save_BeginQueryARB(GLenum target, GLuint id)
5762 {
5763 GET_CURRENT_CONTEXT(ctx);
5764 Node *n;
5765 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5766 n = alloc_instruction(ctx, OPCODE_BEGIN_QUERY_ARB, 2);
5767 if (n) {
5768 n[1].e = target;
5769 n[2].ui = id;
5770 }
5771 if (ctx->ExecuteFlag) {
5772 CALL_BeginQuery(ctx->Exec, (target, id));
5773 }
5774 }
5775
5776 static void GLAPIENTRY
5777 save_EndQueryARB(GLenum target)
5778 {
5779 GET_CURRENT_CONTEXT(ctx);
5780 Node *n;
5781 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5782 n = alloc_instruction(ctx, OPCODE_END_QUERY_ARB, 1);
5783 if (n) {
5784 n[1].e = target;
5785 }
5786 if (ctx->ExecuteFlag) {
5787 CALL_EndQuery(ctx->Exec, (target));
5788 }
5789 }
5790
5791 static void GLAPIENTRY
5792 save_QueryCounter(GLuint id, GLenum target)
5793 {
5794 GET_CURRENT_CONTEXT(ctx);
5795 Node *n;
5796 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5797 n = alloc_instruction(ctx, OPCODE_QUERY_COUNTER, 2);
5798 if (n) {
5799 n[1].ui = id;
5800 n[2].e = target;
5801 }
5802 if (ctx->ExecuteFlag) {
5803 CALL_QueryCounter(ctx->Exec, (id, target));
5804 }
5805 }
5806
5807 static void GLAPIENTRY
5808 save_BeginQueryIndexed(GLenum target, GLuint index, GLuint id)
5809 {
5810 GET_CURRENT_CONTEXT(ctx);
5811 Node *n;
5812 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5813 n = alloc_instruction(ctx, OPCODE_BEGIN_QUERY_INDEXED, 3);
5814 if (n) {
5815 n[1].e = target;
5816 n[2].ui = index;
5817 n[3].ui = id;
5818 }
5819 if (ctx->ExecuteFlag) {
5820 CALL_BeginQueryIndexed(ctx->Exec, (target, index, id));
5821 }
5822 }
5823
5824 static void GLAPIENTRY
5825 save_EndQueryIndexed(GLenum target, GLuint index)
5826 {
5827 GET_CURRENT_CONTEXT(ctx);
5828 Node *n;
5829 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5830 n = alloc_instruction(ctx, OPCODE_END_QUERY_INDEXED, 2);
5831 if (n) {
5832 n[1].e = target;
5833 n[2].ui = index;
5834 }
5835 if (ctx->ExecuteFlag) {
5836 CALL_EndQueryIndexed(ctx->Exec, (target, index));
5837 }
5838 }
5839
5840
5841 static void GLAPIENTRY
5842 save_DrawBuffersARB(GLsizei count, const GLenum * buffers)
5843 {
5844 GET_CURRENT_CONTEXT(ctx);
5845 Node *n;
5846 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5847 n = alloc_instruction(ctx, OPCODE_DRAW_BUFFERS_ARB, 1 + MAX_DRAW_BUFFERS);
5848 if (n) {
5849 GLint i;
5850 n[1].i = count;
5851 if (count > MAX_DRAW_BUFFERS)
5852 count = MAX_DRAW_BUFFERS;
5853 for (i = 0; i < count; i++) {
5854 n[2 + i].e = buffers[i];
5855 }
5856 }
5857 if (ctx->ExecuteFlag) {
5858 CALL_DrawBuffers(ctx->Exec, (count, buffers));
5859 }
5860 }
5861
5862 static void GLAPIENTRY
5863 save_BindFragmentShaderATI(GLuint id)
5864 {
5865 GET_CURRENT_CONTEXT(ctx);
5866 Node *n;
5867
5868 n = alloc_instruction(ctx, OPCODE_BIND_FRAGMENT_SHADER_ATI, 1);
5869 if (n) {
5870 n[1].ui = id;
5871 }
5872 if (ctx->ExecuteFlag) {
5873 CALL_BindFragmentShaderATI(ctx->Exec, (id));
5874 }
5875 }
5876
5877 static void GLAPIENTRY
5878 save_SetFragmentShaderConstantATI(GLuint dst, const GLfloat *value)
5879 {
5880 GET_CURRENT_CONTEXT(ctx);
5881 Node *n;
5882
5883 n = alloc_instruction(ctx, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI, 5);
5884 if (n) {
5885 n[1].ui = dst;
5886 n[2].f = value[0];
5887 n[3].f = value[1];
5888 n[4].f = value[2];
5889 n[5].f = value[3];
5890 }
5891 if (ctx->ExecuteFlag) {
5892 CALL_SetFragmentShaderConstantATI(ctx->Exec, (dst, value));
5893 }
5894 }
5895
5896 static void GLAPIENTRY
5897 save_Attr1fNV(GLenum attr, GLfloat x)
5898 {
5899 GET_CURRENT_CONTEXT(ctx);
5900 Node *n;
5901 SAVE_FLUSH_VERTICES(ctx);
5902 n = alloc_instruction(ctx, OPCODE_ATTR_1F_NV, 2);
5903 if (n) {
5904 n[1].e = attr;
5905 n[2].f = x;
5906 }
5907
5908 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5909 ctx->ListState.ActiveAttribSize[attr] = 1;
5910 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, 0, 0, 1);
5911
5912 if (ctx->ExecuteFlag) {
5913 CALL_VertexAttrib1fNV(ctx->Exec, (attr, x));
5914 }
5915 }
5916
5917 static void GLAPIENTRY
5918 save_Attr2fNV(GLenum attr, GLfloat x, GLfloat y)
5919 {
5920 GET_CURRENT_CONTEXT(ctx);
5921 Node *n;
5922 SAVE_FLUSH_VERTICES(ctx);
5923 n = alloc_instruction(ctx, OPCODE_ATTR_2F_NV, 3);
5924 if (n) {
5925 n[1].e = attr;
5926 n[2].f = x;
5927 n[3].f = y;
5928 }
5929
5930 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5931 ctx->ListState.ActiveAttribSize[attr] = 2;
5932 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, 0, 1);
5933
5934 if (ctx->ExecuteFlag) {
5935 CALL_VertexAttrib2fNV(ctx->Exec, (attr, x, y));
5936 }
5937 }
5938
5939 static void GLAPIENTRY
5940 save_Attr3fNV(GLenum attr, GLfloat x, GLfloat y, GLfloat z)
5941 {
5942 GET_CURRENT_CONTEXT(ctx);
5943 Node *n;
5944 SAVE_FLUSH_VERTICES(ctx);
5945 n = alloc_instruction(ctx, OPCODE_ATTR_3F_NV, 4);
5946 if (n) {
5947 n[1].e = attr;
5948 n[2].f = x;
5949 n[3].f = y;
5950 n[4].f = z;
5951 }
5952
5953 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5954 ctx->ListState.ActiveAttribSize[attr] = 3;
5955 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, 1);
5956
5957 if (ctx->ExecuteFlag) {
5958 CALL_VertexAttrib3fNV(ctx->Exec, (attr, x, y, z));
5959 }
5960 }
5961
5962 static void GLAPIENTRY
5963 save_Attr4fNV(GLenum attr, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
5964 {
5965 GET_CURRENT_CONTEXT(ctx);
5966 Node *n;
5967 SAVE_FLUSH_VERTICES(ctx);
5968 n = alloc_instruction(ctx, OPCODE_ATTR_4F_NV, 5);
5969 if (n) {
5970 n[1].e = attr;
5971 n[2].f = x;
5972 n[3].f = y;
5973 n[4].f = z;
5974 n[5].f = w;
5975 }
5976
5977 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5978 ctx->ListState.ActiveAttribSize[attr] = 4;
5979 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, w);
5980
5981 if (ctx->ExecuteFlag) {
5982 CALL_VertexAttrib4fNV(ctx->Exec, (attr, x, y, z, w));
5983 }
5984 }
5985
5986
5987 static void GLAPIENTRY
5988 save_Attr1fARB(GLenum attr, GLfloat x)
5989 {
5990 GET_CURRENT_CONTEXT(ctx);
5991 Node *n;
5992 SAVE_FLUSH_VERTICES(ctx);
5993 n = alloc_instruction(ctx, OPCODE_ATTR_1F_ARB, 2);
5994 if (n) {
5995 n[1].e = attr;
5996 n[2].f = x;
5997 }
5998
5999 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
6000 ctx->ListState.ActiveAttribSize[attr] = 1;
6001 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, 0, 0, 1);
6002
6003 if (ctx->ExecuteFlag) {
6004 CALL_VertexAttrib1fARB(ctx->Exec, (attr, x));
6005 }
6006 }
6007
6008 static void GLAPIENTRY
6009 save_Attr2fARB(GLenum attr, GLfloat x, GLfloat y)
6010 {
6011 GET_CURRENT_CONTEXT(ctx);
6012 Node *n;
6013 SAVE_FLUSH_VERTICES(ctx);
6014 n = alloc_instruction(ctx, OPCODE_ATTR_2F_ARB, 3);
6015 if (n) {
6016 n[1].e = attr;
6017 n[2].f = x;
6018 n[3].f = y;
6019 }
6020
6021 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
6022 ctx->ListState.ActiveAttribSize[attr] = 2;
6023 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, 0, 1);
6024
6025 if (ctx->ExecuteFlag) {
6026 CALL_VertexAttrib2fARB(ctx->Exec, (attr, x, y));
6027 }
6028 }
6029
6030 static void GLAPIENTRY
6031 save_Attr3fARB(GLenum attr, GLfloat x, GLfloat y, GLfloat z)
6032 {
6033 GET_CURRENT_CONTEXT(ctx);
6034 Node *n;
6035 SAVE_FLUSH_VERTICES(ctx);
6036 n = alloc_instruction(ctx, OPCODE_ATTR_3F_ARB, 4);
6037 if (n) {
6038 n[1].e = attr;
6039 n[2].f = x;
6040 n[3].f = y;
6041 n[4].f = z;
6042 }
6043
6044 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
6045 ctx->ListState.ActiveAttribSize[attr] = 3;
6046 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, 1);
6047
6048 if (ctx->ExecuteFlag) {
6049 CALL_VertexAttrib3fARB(ctx->Exec, (attr, x, y, z));
6050 }
6051 }
6052
6053 static void GLAPIENTRY
6054 save_Attr4fARB(GLenum attr, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
6055 {
6056 GET_CURRENT_CONTEXT(ctx);
6057 Node *n;
6058 SAVE_FLUSH_VERTICES(ctx);
6059 n = alloc_instruction(ctx, OPCODE_ATTR_4F_ARB, 5);
6060 if (n) {
6061 n[1].e = attr;
6062 n[2].f = x;
6063 n[3].f = y;
6064 n[4].f = z;
6065 n[5].f = w;
6066 }
6067
6068 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
6069 ctx->ListState.ActiveAttribSize[attr] = 4;
6070 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, w);
6071
6072 if (ctx->ExecuteFlag) {
6073 CALL_VertexAttrib4fARB(ctx->Exec, (attr, x, y, z, w));
6074 }
6075 }
6076
6077
6078 static void GLAPIENTRY
6079 save_EvalCoord1f(GLfloat x)
6080 {
6081 GET_CURRENT_CONTEXT(ctx);
6082 Node *n;
6083 SAVE_FLUSH_VERTICES(ctx);
6084 n = alloc_instruction(ctx, OPCODE_EVAL_C1, 1);
6085 if (n) {
6086 n[1].f = x;
6087 }
6088 if (ctx->ExecuteFlag) {
6089 CALL_EvalCoord1f(ctx->Exec, (x));
6090 }
6091 }
6092
6093 static void GLAPIENTRY
6094 save_EvalCoord1fv(const GLfloat * v)
6095 {
6096 save_EvalCoord1f(v[0]);
6097 }
6098
6099 static void GLAPIENTRY
6100 save_EvalCoord2f(GLfloat x, GLfloat y)
6101 {
6102 GET_CURRENT_CONTEXT(ctx);
6103 Node *n;
6104 SAVE_FLUSH_VERTICES(ctx);
6105 n = alloc_instruction(ctx, OPCODE_EVAL_C2, 2);
6106 if (n) {
6107 n[1].f = x;
6108 n[2].f = y;
6109 }
6110 if (ctx->ExecuteFlag) {
6111 CALL_EvalCoord2f(ctx->Exec, (x, y));
6112 }
6113 }
6114
6115 static void GLAPIENTRY
6116 save_EvalCoord2fv(const GLfloat * v)
6117 {
6118 save_EvalCoord2f(v[0], v[1]);
6119 }
6120
6121
6122 static void GLAPIENTRY
6123 save_EvalPoint1(GLint x)
6124 {
6125 GET_CURRENT_CONTEXT(ctx);
6126 Node *n;
6127 SAVE_FLUSH_VERTICES(ctx);
6128 n = alloc_instruction(ctx, OPCODE_EVAL_P1, 1);
6129 if (n) {
6130 n[1].i = x;
6131 }
6132 if (ctx->ExecuteFlag) {
6133 CALL_EvalPoint1(ctx->Exec, (x));
6134 }
6135 }
6136
6137 static void GLAPIENTRY
6138 save_EvalPoint2(GLint x, GLint y)
6139 {
6140 GET_CURRENT_CONTEXT(ctx);
6141 Node *n;
6142 SAVE_FLUSH_VERTICES(ctx);
6143 n = alloc_instruction(ctx, OPCODE_EVAL_P2, 2);
6144 if (n) {
6145 n[1].i = x;
6146 n[2].i = y;
6147 }
6148 if (ctx->ExecuteFlag) {
6149 CALL_EvalPoint2(ctx->Exec, (x, y));
6150 }
6151 }
6152
6153 static void GLAPIENTRY
6154 save_Indexf(GLfloat x)
6155 {
6156 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX, x);
6157 }
6158
6159 static void GLAPIENTRY
6160 save_Indexfv(const GLfloat * v)
6161 {
6162 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX, v[0]);
6163 }
6164
6165 static void GLAPIENTRY
6166 save_EdgeFlag(GLboolean x)
6167 {
6168 save_Attr1fNV(VERT_ATTRIB_EDGEFLAG, x ? 1.0f : 0.0f);
6169 }
6170
6171
6172 /**
6173 * Compare 'count' elements of vectors 'a' and 'b'.
6174 * \return GL_TRUE if equal, GL_FALSE if different.
6175 */
6176 static inline GLboolean
6177 compare_vec(const GLfloat *a, const GLfloat *b, GLuint count)
6178 {
6179 return memcmp( a, b, count * sizeof(GLfloat) ) == 0;
6180 }
6181
6182
6183 /**
6184 * This glMaterial function is used for glMaterial calls that are outside
6185 * a glBegin/End pair. For glMaterial inside glBegin/End, see the VBO code.
6186 */
6187 static void GLAPIENTRY
6188 save_Materialfv(GLenum face, GLenum pname, const GLfloat * param)
6189 {
6190 GET_CURRENT_CONTEXT(ctx);
6191 Node *n;
6192 int args, i;
6193 GLuint bitmask;
6194
6195 switch (face) {
6196 case GL_BACK:
6197 case GL_FRONT:
6198 case GL_FRONT_AND_BACK:
6199 break;
6200 default:
6201 _mesa_compile_error(ctx, GL_INVALID_ENUM, "glMaterial(face)");
6202 return;
6203 }
6204
6205 switch (pname) {
6206 case GL_EMISSION:
6207 case GL_AMBIENT:
6208 case GL_DIFFUSE:
6209 case GL_SPECULAR:
6210 case GL_AMBIENT_AND_DIFFUSE:
6211 args = 4;
6212 break;
6213 case GL_SHININESS:
6214 args = 1;
6215 break;
6216 case GL_COLOR_INDEXES:
6217 args = 3;
6218 break;
6219 default:
6220 _mesa_compile_error(ctx, GL_INVALID_ENUM, "glMaterial(pname)");
6221 return;
6222 }
6223
6224 if (ctx->ExecuteFlag) {
6225 CALL_Materialfv(ctx->Exec, (face, pname, param));
6226 }
6227
6228 bitmask = _mesa_material_bitmask(ctx, face, pname, ~0, NULL);
6229
6230 /* Try to eliminate redundant statechanges. Because it is legal to
6231 * call glMaterial even inside begin/end calls, don't need to worry
6232 * about ctx->Driver.CurrentSavePrimitive here.
6233 */
6234 for (i = 0; i < MAT_ATTRIB_MAX; i++) {
6235 if (bitmask & (1 << i)) {
6236 if (ctx->ListState.ActiveMaterialSize[i] == args &&
6237 compare_vec(ctx->ListState.CurrentMaterial[i], param, args)) {
6238 /* no change in material value */
6239 bitmask &= ~(1 << i);
6240 }
6241 else {
6242 ctx->ListState.ActiveMaterialSize[i] = args;
6243 COPY_SZ_4V(ctx->ListState.CurrentMaterial[i], args, param);
6244 }
6245 }
6246 }
6247
6248 /* If this call has no effect, return early */
6249 if (bitmask == 0)
6250 return;
6251
6252 SAVE_FLUSH_VERTICES(ctx);
6253
6254 n = alloc_instruction(ctx, OPCODE_MATERIAL, 6);
6255 if (n) {
6256 n[1].e = face;
6257 n[2].e = pname;
6258 for (i = 0; i < args; i++)
6259 n[3 + i].f = param[i];
6260 }
6261 }
6262
6263 static void GLAPIENTRY
6264 save_Begin(GLenum mode)
6265 {
6266 GET_CURRENT_CONTEXT(ctx);
6267
6268 if (!_mesa_is_valid_prim_mode(ctx, mode)) {
6269 /* compile this error into the display list */
6270 _mesa_compile_error(ctx, GL_INVALID_ENUM, "glBegin(mode)");
6271 }
6272 else if (_mesa_inside_dlist_begin_end(ctx)) {
6273 /* compile this error into the display list */
6274 _mesa_compile_error(ctx, GL_INVALID_OPERATION, "recursive glBegin");
6275 }
6276 else {
6277 ctx->Driver.CurrentSavePrimitive = mode;
6278
6279 vbo_save_NotifyBegin(ctx, mode, false);
6280 }
6281 }
6282
6283 static void GLAPIENTRY
6284 save_End(void)
6285 {
6286 GET_CURRENT_CONTEXT(ctx);
6287 SAVE_FLUSH_VERTICES(ctx);
6288 (void) alloc_instruction(ctx, OPCODE_END, 0);
6289 ctx->Driver.CurrentSavePrimitive = PRIM_OUTSIDE_BEGIN_END;
6290 if (ctx->ExecuteFlag) {
6291 CALL_End(ctx->Exec, ());
6292 }
6293 }
6294
6295 static void GLAPIENTRY
6296 save_Rectf(GLfloat a, GLfloat b, GLfloat c, GLfloat d)
6297 {
6298 GET_CURRENT_CONTEXT(ctx);
6299 Node *n;
6300 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6301 n = alloc_instruction(ctx, OPCODE_RECTF, 4);
6302 if (n) {
6303 n[1].f = a;
6304 n[2].f = b;
6305 n[3].f = c;
6306 n[4].f = d;
6307 }
6308 if (ctx->ExecuteFlag) {
6309 CALL_Rectf(ctx->Exec, (a, b, c, d));
6310 }
6311 }
6312
6313
6314 static void GLAPIENTRY
6315 save_Vertex2f(GLfloat x, GLfloat y)
6316 {
6317 save_Attr2fNV(VERT_ATTRIB_POS, x, y);
6318 }
6319
6320 static void GLAPIENTRY
6321 save_Vertex2fv(const GLfloat * v)
6322 {
6323 save_Attr2fNV(VERT_ATTRIB_POS, v[0], v[1]);
6324 }
6325
6326 static void GLAPIENTRY
6327 save_Vertex3f(GLfloat x, GLfloat y, GLfloat z)
6328 {
6329 save_Attr3fNV(VERT_ATTRIB_POS, x, y, z);
6330 }
6331
6332 static void GLAPIENTRY
6333 save_Vertex3fv(const GLfloat * v)
6334 {
6335 save_Attr3fNV(VERT_ATTRIB_POS, v[0], v[1], v[2]);
6336 }
6337
6338 static void GLAPIENTRY
6339 save_Vertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
6340 {
6341 save_Attr4fNV(VERT_ATTRIB_POS, x, y, z, w);
6342 }
6343
6344 static void GLAPIENTRY
6345 save_Vertex4fv(const GLfloat * v)
6346 {
6347 save_Attr4fNV(VERT_ATTRIB_POS, v[0], v[1], v[2], v[3]);
6348 }
6349
6350 static void GLAPIENTRY
6351 save_TexCoord1f(GLfloat x)
6352 {
6353 save_Attr1fNV(VERT_ATTRIB_TEX0, x);
6354 }
6355
6356 static void GLAPIENTRY
6357 save_TexCoord1fv(const GLfloat * v)
6358 {
6359 save_Attr1fNV(VERT_ATTRIB_TEX0, v[0]);
6360 }
6361
6362 static void GLAPIENTRY
6363 save_TexCoord2f(GLfloat x, GLfloat y)
6364 {
6365 save_Attr2fNV(VERT_ATTRIB_TEX0, x, y);
6366 }
6367
6368 static void GLAPIENTRY
6369 save_TexCoord2fv(const GLfloat * v)
6370 {
6371 save_Attr2fNV(VERT_ATTRIB_TEX0, v[0], v[1]);
6372 }
6373
6374 static void GLAPIENTRY
6375 save_TexCoord3f(GLfloat x, GLfloat y, GLfloat z)
6376 {
6377 save_Attr3fNV(VERT_ATTRIB_TEX0, x, y, z);
6378 }
6379
6380 static void GLAPIENTRY
6381 save_TexCoord3fv(const GLfloat * v)
6382 {
6383 save_Attr3fNV(VERT_ATTRIB_TEX0, v[0], v[1], v[2]);
6384 }
6385
6386 static void GLAPIENTRY
6387 save_TexCoord4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
6388 {
6389 save_Attr4fNV(VERT_ATTRIB_TEX0, x, y, z, w);
6390 }
6391
6392 static void GLAPIENTRY
6393 save_TexCoord4fv(const GLfloat * v)
6394 {
6395 save_Attr4fNV(VERT_ATTRIB_TEX0, v[0], v[1], v[2], v[3]);
6396 }
6397
6398 static void GLAPIENTRY
6399 save_Normal3f(GLfloat x, GLfloat y, GLfloat z)
6400 {
6401 save_Attr3fNV(VERT_ATTRIB_NORMAL, x, y, z);
6402 }
6403
6404 static void GLAPIENTRY
6405 save_Normal3fv(const GLfloat * v)
6406 {
6407 save_Attr3fNV(VERT_ATTRIB_NORMAL, v[0], v[1], v[2]);
6408 }
6409
6410 static void GLAPIENTRY
6411 save_FogCoordfEXT(GLfloat x)
6412 {
6413 save_Attr1fNV(VERT_ATTRIB_FOG, x);
6414 }
6415
6416 static void GLAPIENTRY
6417 save_FogCoordfvEXT(const GLfloat * v)
6418 {
6419 save_Attr1fNV(VERT_ATTRIB_FOG, v[0]);
6420 }
6421
6422 static void GLAPIENTRY
6423 save_Color3f(GLfloat x, GLfloat y, GLfloat z)
6424 {
6425 save_Attr3fNV(VERT_ATTRIB_COLOR0, x, y, z);
6426 }
6427
6428 static void GLAPIENTRY
6429 save_Color3fv(const GLfloat * v)
6430 {
6431 save_Attr3fNV(VERT_ATTRIB_COLOR0, v[0], v[1], v[2]);
6432 }
6433
6434 static void GLAPIENTRY
6435 save_Color4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
6436 {
6437 save_Attr4fNV(VERT_ATTRIB_COLOR0, x, y, z, w);
6438 }
6439
6440 static void GLAPIENTRY
6441 save_Color4fv(const GLfloat * v)
6442 {
6443 save_Attr4fNV(VERT_ATTRIB_COLOR0, v[0], v[1], v[2], v[3]);
6444 }
6445
6446 static void GLAPIENTRY
6447 save_SecondaryColor3fEXT(GLfloat x, GLfloat y, GLfloat z)
6448 {
6449 save_Attr3fNV(VERT_ATTRIB_COLOR1, x, y, z);
6450 }
6451
6452 static void GLAPIENTRY
6453 save_SecondaryColor3fvEXT(const GLfloat * v)
6454 {
6455 save_Attr3fNV(VERT_ATTRIB_COLOR1, v[0], v[1], v[2]);
6456 }
6457
6458
6459 /* Just call the respective ATTR for texcoord
6460 */
6461 static void GLAPIENTRY
6462 save_MultiTexCoord1f(GLenum target, GLfloat x)
6463 {
6464 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6465 save_Attr1fNV(attr, x);
6466 }
6467
6468 static void GLAPIENTRY
6469 save_MultiTexCoord1fv(GLenum target, const GLfloat * v)
6470 {
6471 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6472 save_Attr1fNV(attr, v[0]);
6473 }
6474
6475 static void GLAPIENTRY
6476 save_MultiTexCoord2f(GLenum target, GLfloat x, GLfloat y)
6477 {
6478 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6479 save_Attr2fNV(attr, x, y);
6480 }
6481
6482 static void GLAPIENTRY
6483 save_MultiTexCoord2fv(GLenum target, const GLfloat * v)
6484 {
6485 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6486 save_Attr2fNV(attr, v[0], v[1]);
6487 }
6488
6489 static void GLAPIENTRY
6490 save_MultiTexCoord3f(GLenum target, GLfloat x, GLfloat y, GLfloat z)
6491 {
6492 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6493 save_Attr3fNV(attr, x, y, z);
6494 }
6495
6496 static void GLAPIENTRY
6497 save_MultiTexCoord3fv(GLenum target, const GLfloat * v)
6498 {
6499 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6500 save_Attr3fNV(attr, v[0], v[1], v[2]);
6501 }
6502
6503 static void GLAPIENTRY
6504 save_MultiTexCoord4f(GLenum target, GLfloat x, GLfloat y,
6505 GLfloat z, GLfloat w)
6506 {
6507 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6508 save_Attr4fNV(attr, x, y, z, w);
6509 }
6510
6511 static void GLAPIENTRY
6512 save_MultiTexCoord4fv(GLenum target, const GLfloat * v)
6513 {
6514 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6515 save_Attr4fNV(attr, v[0], v[1], v[2], v[3]);
6516 }
6517
6518
6519 /**
6520 * Record a GL_INVALID_VALUE error when an invalid vertex attribute
6521 * index is found.
6522 */
6523 static void
6524 index_error(void)
6525 {
6526 GET_CURRENT_CONTEXT(ctx);
6527 _mesa_error(ctx, GL_INVALID_VALUE, "VertexAttribf(index)");
6528 }
6529
6530
6531
6532 static void GLAPIENTRY
6533 save_VertexAttrib1fARB(GLuint index, GLfloat x)
6534 {
6535 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6536 save_Attr1fARB(index, x);
6537 else
6538 index_error();
6539 }
6540
6541 static void GLAPIENTRY
6542 save_VertexAttrib1fvARB(GLuint index, const GLfloat * v)
6543 {
6544 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6545 save_Attr1fARB(index, v[0]);
6546 else
6547 index_error();
6548 }
6549
6550 static void GLAPIENTRY
6551 save_VertexAttrib2fARB(GLuint index, GLfloat x, GLfloat y)
6552 {
6553 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6554 save_Attr2fARB(index, x, y);
6555 else
6556 index_error();
6557 }
6558
6559 static void GLAPIENTRY
6560 save_VertexAttrib2fvARB(GLuint index, const GLfloat * v)
6561 {
6562 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6563 save_Attr2fARB(index, v[0], v[1]);
6564 else
6565 index_error();
6566 }
6567
6568 static void GLAPIENTRY
6569 save_VertexAttrib3fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z)
6570 {
6571 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6572 save_Attr3fARB(index, x, y, z);
6573 else
6574 index_error();
6575 }
6576
6577 static void GLAPIENTRY
6578 save_VertexAttrib3fvARB(GLuint index, const GLfloat * v)
6579 {
6580 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6581 save_Attr3fARB(index, v[0], v[1], v[2]);
6582 else
6583 index_error();
6584 }
6585
6586 static void GLAPIENTRY
6587 save_VertexAttrib4fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z,
6588 GLfloat w)
6589 {
6590 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6591 save_Attr4fARB(index, x, y, z, w);
6592 else
6593 index_error();
6594 }
6595
6596 static void GLAPIENTRY
6597 save_VertexAttrib4fvARB(GLuint index, const GLfloat * v)
6598 {
6599 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6600 save_Attr4fARB(index, v[0], v[1], v[2], v[3]);
6601 else
6602 index_error();
6603 }
6604
6605 static void GLAPIENTRY
6606 save_VertexAttribL1d(GLuint index, GLdouble x)
6607 {
6608 GET_CURRENT_CONTEXT(ctx);
6609
6610 if (index < MAX_VERTEX_GENERIC_ATTRIBS) {
6611 Node *n;
6612 SAVE_FLUSH_VERTICES(ctx);
6613 n = alloc_instruction(ctx, OPCODE_ATTR_1D, 3);
6614 if (n) {
6615 n[1].ui = index;
6616 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
6617 }
6618
6619 ctx->ListState.ActiveAttribSize[index] = 1;
6620 memcpy(ctx->ListState.CurrentAttrib[index], &n[2], sizeof(GLdouble));
6621
6622 if (ctx->ExecuteFlag) {
6623 CALL_VertexAttribL1d(ctx->Exec, (index, x));
6624 }
6625 } else {
6626 index_error();
6627 }
6628 }
6629
6630 static void GLAPIENTRY
6631 save_VertexAttribL1dv(GLuint index, const GLdouble *v)
6632 {
6633 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6634 save_VertexAttribL1d(index, v[0]);
6635 else
6636 index_error();
6637 }
6638
6639 static void GLAPIENTRY
6640 save_VertexAttribL2d(GLuint index, GLdouble x, GLdouble y)
6641 {
6642 GET_CURRENT_CONTEXT(ctx);
6643
6644 if (index < MAX_VERTEX_GENERIC_ATTRIBS) {
6645 Node *n;
6646 SAVE_FLUSH_VERTICES(ctx);
6647 n = alloc_instruction(ctx, OPCODE_ATTR_2D, 5);
6648 if (n) {
6649 n[1].ui = index;
6650 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
6651 ASSIGN_DOUBLE_TO_NODES(n, 4, y);
6652 }
6653
6654 ctx->ListState.ActiveAttribSize[index] = 2;
6655 memcpy(ctx->ListState.CurrentAttrib[index], &n[2],
6656 2 * sizeof(GLdouble));
6657
6658 if (ctx->ExecuteFlag) {
6659 CALL_VertexAttribL2d(ctx->Exec, (index, x, y));
6660 }
6661 } else {
6662 index_error();
6663 }
6664 }
6665
6666 static void GLAPIENTRY
6667 save_VertexAttribL2dv(GLuint index, const GLdouble *v)
6668 {
6669 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6670 save_VertexAttribL2d(index, v[0], v[1]);
6671 else
6672 index_error();
6673 }
6674
6675 static void GLAPIENTRY
6676 save_VertexAttribL3d(GLuint index, GLdouble x, GLdouble y, GLdouble z)
6677 {
6678 GET_CURRENT_CONTEXT(ctx);
6679
6680 if (index < MAX_VERTEX_GENERIC_ATTRIBS) {
6681 Node *n;
6682 SAVE_FLUSH_VERTICES(ctx);
6683 n = alloc_instruction(ctx, OPCODE_ATTR_3D, 7);
6684 if (n) {
6685 n[1].ui = index;
6686 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
6687 ASSIGN_DOUBLE_TO_NODES(n, 4, y);
6688 ASSIGN_DOUBLE_TO_NODES(n, 6, z);
6689 }
6690
6691 ctx->ListState.ActiveAttribSize[index] = 3;
6692 memcpy(ctx->ListState.CurrentAttrib[index], &n[2],
6693 3 * sizeof(GLdouble));
6694
6695 if (ctx->ExecuteFlag) {
6696 CALL_VertexAttribL3d(ctx->Exec, (index, x, y, z));
6697 }
6698 } else {
6699 index_error();
6700 }
6701 }
6702
6703 static void GLAPIENTRY
6704 save_VertexAttribL3dv(GLuint index, const GLdouble *v)
6705 {
6706 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6707 save_VertexAttribL3d(index, v[0], v[1], v[2]);
6708 else
6709 index_error();
6710 }
6711
6712 static void GLAPIENTRY
6713 save_VertexAttribL4d(GLuint index, GLdouble x, GLdouble y, GLdouble z,
6714 GLdouble w)
6715 {
6716 GET_CURRENT_CONTEXT(ctx);
6717
6718 if (index < MAX_VERTEX_GENERIC_ATTRIBS) {
6719 Node *n;
6720 SAVE_FLUSH_VERTICES(ctx);
6721 n = alloc_instruction(ctx, OPCODE_ATTR_4D, 9);
6722 if (n) {
6723 n[1].ui = index;
6724 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
6725 ASSIGN_DOUBLE_TO_NODES(n, 4, y);
6726 ASSIGN_DOUBLE_TO_NODES(n, 6, z);
6727 ASSIGN_DOUBLE_TO_NODES(n, 8, w);
6728 }
6729
6730 ctx->ListState.ActiveAttribSize[index] = 4;
6731 memcpy(ctx->ListState.CurrentAttrib[index], &n[2],
6732 4 * sizeof(GLdouble));
6733
6734 if (ctx->ExecuteFlag) {
6735 CALL_VertexAttribL4d(ctx->Exec, (index, x, y, z, w));
6736 }
6737 } else {
6738 index_error();
6739 }
6740 }
6741
6742 static void GLAPIENTRY
6743 save_VertexAttribL4dv(GLuint index, const GLdouble *v)
6744 {
6745 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6746 save_VertexAttribL4d(index, v[0], v[1], v[2], v[3]);
6747 else
6748 index_error();
6749 }
6750
6751 static void GLAPIENTRY
6752 save_PrimitiveRestartNV(void)
6753 {
6754 /* Note: this is used when outside a glBegin/End pair in a display list */
6755 GET_CURRENT_CONTEXT(ctx);
6756 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6757 (void) alloc_instruction(ctx, OPCODE_PRIMITIVE_RESTART_NV, 0);
6758 if (ctx->ExecuteFlag) {
6759 CALL_PrimitiveRestartNV(ctx->Exec, ());
6760 }
6761 }
6762
6763
6764 static void GLAPIENTRY
6765 save_BlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
6766 GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
6767 GLbitfield mask, GLenum filter)
6768 {
6769 GET_CURRENT_CONTEXT(ctx);
6770 Node *n;
6771 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6772 n = alloc_instruction(ctx, OPCODE_BLIT_FRAMEBUFFER, 10);
6773 if (n) {
6774 n[1].i = srcX0;
6775 n[2].i = srcY0;
6776 n[3].i = srcX1;
6777 n[4].i = srcY1;
6778 n[5].i = dstX0;
6779 n[6].i = dstY0;
6780 n[7].i = dstX1;
6781 n[8].i = dstY1;
6782 n[9].i = mask;
6783 n[10].e = filter;
6784 }
6785 if (ctx->ExecuteFlag) {
6786 CALL_BlitFramebuffer(ctx->Exec, (srcX0, srcY0, srcX1, srcY1,
6787 dstX0, dstY0, dstX1, dstY1,
6788 mask, filter));
6789 }
6790 }
6791
6792
6793 /** GL_EXT_provoking_vertex */
6794 static void GLAPIENTRY
6795 save_ProvokingVertexEXT(GLenum mode)
6796 {
6797 GET_CURRENT_CONTEXT(ctx);
6798 Node *n;
6799 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6800 n = alloc_instruction(ctx, OPCODE_PROVOKING_VERTEX, 1);
6801 if (n) {
6802 n[1].e = mode;
6803 }
6804 if (ctx->ExecuteFlag) {
6805 /*CALL_ProvokingVertex(ctx->Exec, (mode));*/
6806 _mesa_ProvokingVertex(mode);
6807 }
6808 }
6809
6810
6811 /** GL_EXT_transform_feedback */
6812 static void GLAPIENTRY
6813 save_BeginTransformFeedback(GLenum mode)
6814 {
6815 GET_CURRENT_CONTEXT(ctx);
6816 Node *n;
6817 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6818 n = alloc_instruction(ctx, OPCODE_BEGIN_TRANSFORM_FEEDBACK, 1);
6819 if (n) {
6820 n[1].e = mode;
6821 }
6822 if (ctx->ExecuteFlag) {
6823 CALL_BeginTransformFeedback(ctx->Exec, (mode));
6824 }
6825 }
6826
6827
6828 /** GL_EXT_transform_feedback */
6829 static void GLAPIENTRY
6830 save_EndTransformFeedback(void)
6831 {
6832 GET_CURRENT_CONTEXT(ctx);
6833 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6834 (void) alloc_instruction(ctx, OPCODE_END_TRANSFORM_FEEDBACK, 0);
6835 if (ctx->ExecuteFlag) {
6836 CALL_EndTransformFeedback(ctx->Exec, ());
6837 }
6838 }
6839
6840 static void GLAPIENTRY
6841 save_BindTransformFeedback(GLenum target, GLuint name)
6842 {
6843 GET_CURRENT_CONTEXT(ctx);
6844 Node *n;
6845 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6846 n = alloc_instruction(ctx, OPCODE_BIND_TRANSFORM_FEEDBACK, 2);
6847 if (n) {
6848 n[1].e = target;
6849 n[2].ui = name;
6850 }
6851 if (ctx->ExecuteFlag) {
6852 CALL_BindTransformFeedback(ctx->Exec, (target, name));
6853 }
6854 }
6855
6856 static void GLAPIENTRY
6857 save_PauseTransformFeedback(void)
6858 {
6859 GET_CURRENT_CONTEXT(ctx);
6860 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6861 (void) alloc_instruction(ctx, OPCODE_PAUSE_TRANSFORM_FEEDBACK, 0);
6862 if (ctx->ExecuteFlag) {
6863 CALL_PauseTransformFeedback(ctx->Exec, ());
6864 }
6865 }
6866
6867 static void GLAPIENTRY
6868 save_ResumeTransformFeedback(void)
6869 {
6870 GET_CURRENT_CONTEXT(ctx);
6871 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6872 (void) alloc_instruction(ctx, OPCODE_RESUME_TRANSFORM_FEEDBACK, 0);
6873 if (ctx->ExecuteFlag) {
6874 CALL_ResumeTransformFeedback(ctx->Exec, ());
6875 }
6876 }
6877
6878 static void GLAPIENTRY
6879 save_DrawTransformFeedback(GLenum mode, GLuint name)
6880 {
6881 GET_CURRENT_CONTEXT(ctx);
6882 Node *n;
6883 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6884 n = alloc_instruction(ctx, OPCODE_DRAW_TRANSFORM_FEEDBACK, 2);
6885 if (n) {
6886 n[1].e = mode;
6887 n[2].ui = name;
6888 }
6889 if (ctx->ExecuteFlag) {
6890 CALL_DrawTransformFeedback(ctx->Exec, (mode, name));
6891 }
6892 }
6893
6894 static void GLAPIENTRY
6895 save_DrawTransformFeedbackStream(GLenum mode, GLuint name, GLuint stream)
6896 {
6897 GET_CURRENT_CONTEXT(ctx);
6898 Node *n;
6899 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6900 n = alloc_instruction(ctx, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM, 3);
6901 if (n) {
6902 n[1].e = mode;
6903 n[2].ui = name;
6904 n[3].ui = stream;
6905 }
6906 if (ctx->ExecuteFlag) {
6907 CALL_DrawTransformFeedbackStream(ctx->Exec, (mode, name, stream));
6908 }
6909 }
6910
6911 static void GLAPIENTRY
6912 save_DrawTransformFeedbackInstanced(GLenum mode, GLuint name,
6913 GLsizei primcount)
6914 {
6915 GET_CURRENT_CONTEXT(ctx);
6916 Node *n;
6917 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6918 n = alloc_instruction(ctx, OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED, 3);
6919 if (n) {
6920 n[1].e = mode;
6921 n[2].ui = name;
6922 n[3].si = primcount;
6923 }
6924 if (ctx->ExecuteFlag) {
6925 CALL_DrawTransformFeedbackInstanced(ctx->Exec, (mode, name, primcount));
6926 }
6927 }
6928
6929 static void GLAPIENTRY
6930 save_DrawTransformFeedbackStreamInstanced(GLenum mode, GLuint name,
6931 GLuint stream, GLsizei primcount)
6932 {
6933 GET_CURRENT_CONTEXT(ctx);
6934 Node *n;
6935 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6936 n = alloc_instruction(ctx, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED, 4);
6937 if (n) {
6938 n[1].e = mode;
6939 n[2].ui = name;
6940 n[3].ui = stream;
6941 n[4].si = primcount;
6942 }
6943 if (ctx->ExecuteFlag) {
6944 CALL_DrawTransformFeedbackStreamInstanced(ctx->Exec, (mode, name, stream,
6945 primcount));
6946 }
6947 }
6948
6949 static void GLAPIENTRY
6950 save_DispatchCompute(GLuint num_groups_x, GLuint num_groups_y,
6951 GLuint num_groups_z)
6952 {
6953 GET_CURRENT_CONTEXT(ctx);
6954 Node *n;
6955 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6956 n = alloc_instruction(ctx, OPCODE_DISPATCH_COMPUTE, 3);
6957 if (n) {
6958 n[1].ui = num_groups_x;
6959 n[2].ui = num_groups_y;
6960 n[3].ui = num_groups_z;
6961 }
6962 if (ctx->ExecuteFlag) {
6963 CALL_DispatchCompute(ctx->Exec, (num_groups_x, num_groups_y,
6964 num_groups_z));
6965 }
6966 }
6967
6968 static void GLAPIENTRY
6969 save_DispatchComputeIndirect(GLintptr indirect)
6970 {
6971 GET_CURRENT_CONTEXT(ctx);
6972 _mesa_error(ctx, GL_INVALID_OPERATION,
6973 "glDispatchComputeIndirect() during display list compile");
6974 }
6975
6976 static void GLAPIENTRY
6977 save_UseProgram(GLuint program)
6978 {
6979 GET_CURRENT_CONTEXT(ctx);
6980 Node *n;
6981 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6982 n = alloc_instruction(ctx, OPCODE_USE_PROGRAM, 1);
6983 if (n) {
6984 n[1].ui = program;
6985 }
6986 if (ctx->ExecuteFlag) {
6987 CALL_UseProgram(ctx->Exec, (program));
6988 }
6989 }
6990
6991
6992 static void GLAPIENTRY
6993 save_Uniform1fARB(GLint location, GLfloat x)
6994 {
6995 GET_CURRENT_CONTEXT(ctx);
6996 Node *n;
6997 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6998 n = alloc_instruction(ctx, OPCODE_UNIFORM_1F, 2);
6999 if (n) {
7000 n[1].i = location;
7001 n[2].f = x;
7002 }
7003 if (ctx->ExecuteFlag) {
7004 CALL_Uniform1f(ctx->Exec, (location, x));
7005 }
7006 }
7007
7008
7009 static void GLAPIENTRY
7010 save_Uniform2fARB(GLint location, GLfloat x, GLfloat y)
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_2F, 3);
7016 if (n) {
7017 n[1].i = location;
7018 n[2].f = x;
7019 n[3].f = y;
7020 }
7021 if (ctx->ExecuteFlag) {
7022 CALL_Uniform2f(ctx->Exec, (location, x, y));
7023 }
7024 }
7025
7026
7027 static void GLAPIENTRY
7028 save_Uniform3fARB(GLint location, GLfloat x, GLfloat y, GLfloat z)
7029 {
7030 GET_CURRENT_CONTEXT(ctx);
7031 Node *n;
7032 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7033 n = alloc_instruction(ctx, OPCODE_UNIFORM_3F, 4);
7034 if (n) {
7035 n[1].i = location;
7036 n[2].f = x;
7037 n[3].f = y;
7038 n[4].f = z;
7039 }
7040 if (ctx->ExecuteFlag) {
7041 CALL_Uniform3f(ctx->Exec, (location, x, y, z));
7042 }
7043 }
7044
7045
7046 static void GLAPIENTRY
7047 save_Uniform4fARB(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
7048 {
7049 GET_CURRENT_CONTEXT(ctx);
7050 Node *n;
7051 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7052 n = alloc_instruction(ctx, OPCODE_UNIFORM_4F, 5);
7053 if (n) {
7054 n[1].i = location;
7055 n[2].f = x;
7056 n[3].f = y;
7057 n[4].f = z;
7058 n[5].f = w;
7059 }
7060 if (ctx->ExecuteFlag) {
7061 CALL_Uniform4f(ctx->Exec, (location, x, y, z, w));
7062 }
7063 }
7064
7065
7066 static void GLAPIENTRY
7067 save_Uniform1fvARB(GLint location, GLsizei count, const GLfloat *v)
7068 {
7069 GET_CURRENT_CONTEXT(ctx);
7070 Node *n;
7071 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7072 n = alloc_instruction(ctx, OPCODE_UNIFORM_1FV, 2 + POINTER_DWORDS);
7073 if (n) {
7074 n[1].i = location;
7075 n[2].i = count;
7076 save_pointer(&n[3], memdup(v, count * 1 * sizeof(GLfloat)));
7077 }
7078 if (ctx->ExecuteFlag) {
7079 CALL_Uniform1fv(ctx->Exec, (location, count, v));
7080 }
7081 }
7082
7083 static void GLAPIENTRY
7084 save_Uniform2fvARB(GLint location, GLsizei count, const GLfloat *v)
7085 {
7086 GET_CURRENT_CONTEXT(ctx);
7087 Node *n;
7088 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7089 n = alloc_instruction(ctx, OPCODE_UNIFORM_2FV, 2 + POINTER_DWORDS);
7090 if (n) {
7091 n[1].i = location;
7092 n[2].i = count;
7093 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLfloat)));
7094 }
7095 if (ctx->ExecuteFlag) {
7096 CALL_Uniform2fv(ctx->Exec, (location, count, v));
7097 }
7098 }
7099
7100 static void GLAPIENTRY
7101 save_Uniform3fvARB(GLint location, GLsizei count, const GLfloat *v)
7102 {
7103 GET_CURRENT_CONTEXT(ctx);
7104 Node *n;
7105 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7106 n = alloc_instruction(ctx, OPCODE_UNIFORM_3FV, 2 + POINTER_DWORDS);
7107 if (n) {
7108 n[1].i = location;
7109 n[2].i = count;
7110 save_pointer(&n[3], memdup(v, count * 3 * sizeof(GLfloat)));
7111 }
7112 if (ctx->ExecuteFlag) {
7113 CALL_Uniform3fv(ctx->Exec, (location, count, v));
7114 }
7115 }
7116
7117 static void GLAPIENTRY
7118 save_Uniform4fvARB(GLint location, GLsizei count, const GLfloat *v)
7119 {
7120 GET_CURRENT_CONTEXT(ctx);
7121 Node *n;
7122 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7123 n = alloc_instruction(ctx, OPCODE_UNIFORM_4FV, 2 + POINTER_DWORDS);
7124 if (n) {
7125 n[1].i = location;
7126 n[2].i = count;
7127 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLfloat)));
7128 }
7129 if (ctx->ExecuteFlag) {
7130 CALL_Uniform4fv(ctx->Exec, (location, count, v));
7131 }
7132 }
7133
7134
7135 static void GLAPIENTRY
7136 save_Uniform1d(GLint location, GLdouble x)
7137 {
7138 GET_CURRENT_CONTEXT(ctx);
7139 Node *n;
7140 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7141 n = alloc_instruction(ctx, OPCODE_UNIFORM_1D, 3);
7142 if (n) {
7143 n[1].i = location;
7144 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
7145 }
7146 if (ctx->ExecuteFlag) {
7147 CALL_Uniform1d(ctx->Exec, (location, x));
7148 }
7149 }
7150
7151
7152 static void GLAPIENTRY
7153 save_Uniform2d(GLint location, GLdouble x, GLdouble y)
7154 {
7155 GET_CURRENT_CONTEXT(ctx);
7156 Node *n;
7157 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7158 n = alloc_instruction(ctx, OPCODE_UNIFORM_2D, 5);
7159 if (n) {
7160 n[1].i = location;
7161 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
7162 ASSIGN_DOUBLE_TO_NODES(n, 4, y);
7163 }
7164 if (ctx->ExecuteFlag) {
7165 CALL_Uniform2d(ctx->Exec, (location, x, y));
7166 }
7167 }
7168
7169
7170 static void GLAPIENTRY
7171 save_Uniform3d(GLint location, GLdouble x, GLdouble y, GLdouble z)
7172 {
7173 GET_CURRENT_CONTEXT(ctx);
7174 Node *n;
7175 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7176 n = alloc_instruction(ctx, OPCODE_UNIFORM_3D, 7);
7177 if (n) {
7178 n[1].i = location;
7179 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
7180 ASSIGN_DOUBLE_TO_NODES(n, 4, y);
7181 ASSIGN_DOUBLE_TO_NODES(n, 6, z);
7182 }
7183 if (ctx->ExecuteFlag) {
7184 CALL_Uniform3d(ctx->Exec, (location, x, y, z));
7185 }
7186 }
7187
7188
7189 static void GLAPIENTRY
7190 save_Uniform4d(GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
7191 {
7192 GET_CURRENT_CONTEXT(ctx);
7193 Node *n;
7194 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7195 n = alloc_instruction(ctx, OPCODE_UNIFORM_4D, 9);
7196 if (n) {
7197 n[1].i = location;
7198 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
7199 ASSIGN_DOUBLE_TO_NODES(n, 4, y);
7200 ASSIGN_DOUBLE_TO_NODES(n, 6, z);
7201 ASSIGN_DOUBLE_TO_NODES(n, 8, w);
7202 }
7203 if (ctx->ExecuteFlag) {
7204 CALL_Uniform4d(ctx->Exec, (location, x, y, z, w));
7205 }
7206 }
7207
7208
7209 static void GLAPIENTRY
7210 save_Uniform1dv(GLint location, GLsizei count, const GLdouble *v)
7211 {
7212 GET_CURRENT_CONTEXT(ctx);
7213 Node *n;
7214 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7215 n = alloc_instruction(ctx, OPCODE_UNIFORM_1DV, 2 + POINTER_DWORDS);
7216 if (n) {
7217 n[1].i = location;
7218 n[2].i = count;
7219 save_pointer(&n[3], memdup(v, count * 1 * sizeof(GLdouble)));
7220 }
7221 if (ctx->ExecuteFlag) {
7222 CALL_Uniform1dv(ctx->Exec, (location, count, v));
7223 }
7224 }
7225
7226
7227 static void GLAPIENTRY
7228 save_Uniform2dv(GLint location, GLsizei count, const GLdouble *v)
7229 {
7230 GET_CURRENT_CONTEXT(ctx);
7231 Node *n;
7232 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7233 n = alloc_instruction(ctx, OPCODE_UNIFORM_2DV, 2 + POINTER_DWORDS);
7234 if (n) {
7235 n[1].i = location;
7236 n[2].i = count;
7237 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLdouble)));
7238 }
7239 if (ctx->ExecuteFlag) {
7240 CALL_Uniform2dv(ctx->Exec, (location, count, v));
7241 }
7242 }
7243
7244
7245 static void GLAPIENTRY
7246 save_Uniform3dv(GLint location, GLsizei count, const GLdouble *v)
7247 {
7248 GET_CURRENT_CONTEXT(ctx);
7249 Node *n;
7250 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7251 n = alloc_instruction(ctx, OPCODE_UNIFORM_3DV, 2 + POINTER_DWORDS);
7252 if (n) {
7253 n[1].i = location;
7254 n[2].i = count;
7255 save_pointer(&n[3], memdup(v, count * 3 * sizeof(GLdouble)));
7256 }
7257 if (ctx->ExecuteFlag) {
7258 CALL_Uniform3dv(ctx->Exec, (location, count, v));
7259 }
7260 }
7261
7262
7263 static void GLAPIENTRY
7264 save_Uniform4dv(GLint location, GLsizei count, const GLdouble *v)
7265 {
7266 GET_CURRENT_CONTEXT(ctx);
7267 Node *n;
7268 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7269 n = alloc_instruction(ctx, OPCODE_UNIFORM_4DV, 2 + POINTER_DWORDS);
7270 if (n) {
7271 n[1].i = location;
7272 n[2].i = count;
7273 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLdouble)));
7274 }
7275 if (ctx->ExecuteFlag) {
7276 CALL_Uniform4dv(ctx->Exec, (location, count, v));
7277 }
7278 }
7279
7280
7281 static void GLAPIENTRY
7282 save_Uniform1iARB(GLint location, GLint x)
7283 {
7284 GET_CURRENT_CONTEXT(ctx);
7285 Node *n;
7286 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7287 n = alloc_instruction(ctx, OPCODE_UNIFORM_1I, 2);
7288 if (n) {
7289 n[1].i = location;
7290 n[2].i = x;
7291 }
7292 if (ctx->ExecuteFlag) {
7293 CALL_Uniform1i(ctx->Exec, (location, x));
7294 }
7295 }
7296
7297 static void GLAPIENTRY
7298 save_Uniform2iARB(GLint location, GLint x, GLint y)
7299 {
7300 GET_CURRENT_CONTEXT(ctx);
7301 Node *n;
7302 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7303 n = alloc_instruction(ctx, OPCODE_UNIFORM_2I, 3);
7304 if (n) {
7305 n[1].i = location;
7306 n[2].i = x;
7307 n[3].i = y;
7308 }
7309 if (ctx->ExecuteFlag) {
7310 CALL_Uniform2i(ctx->Exec, (location, x, y));
7311 }
7312 }
7313
7314 static void GLAPIENTRY
7315 save_Uniform3iARB(GLint location, GLint x, GLint y, GLint z)
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_3I, 4);
7321 if (n) {
7322 n[1].i = location;
7323 n[2].i = x;
7324 n[3].i = y;
7325 n[4].i = z;
7326 }
7327 if (ctx->ExecuteFlag) {
7328 CALL_Uniform3i(ctx->Exec, (location, x, y, z));
7329 }
7330 }
7331
7332 static void GLAPIENTRY
7333 save_Uniform4iARB(GLint location, GLint x, GLint y, GLint z, GLint w)
7334 {
7335 GET_CURRENT_CONTEXT(ctx);
7336 Node *n;
7337 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7338 n = alloc_instruction(ctx, OPCODE_UNIFORM_4I, 5);
7339 if (n) {
7340 n[1].i = location;
7341 n[2].i = x;
7342 n[3].i = y;
7343 n[4].i = z;
7344 n[5].i = w;
7345 }
7346 if (ctx->ExecuteFlag) {
7347 CALL_Uniform4i(ctx->Exec, (location, x, y, z, w));
7348 }
7349 }
7350
7351
7352
7353 static void GLAPIENTRY
7354 save_Uniform1ivARB(GLint location, GLsizei count, const GLint *v)
7355 {
7356 GET_CURRENT_CONTEXT(ctx);
7357 Node *n;
7358 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7359 n = alloc_instruction(ctx, OPCODE_UNIFORM_1IV, 2 + POINTER_DWORDS);
7360 if (n) {
7361 n[1].i = location;
7362 n[2].i = count;
7363 save_pointer(&n[3], memdup(v, count * 1 * sizeof(GLint)));
7364 }
7365 if (ctx->ExecuteFlag) {
7366 CALL_Uniform1iv(ctx->Exec, (location, count, v));
7367 }
7368 }
7369
7370 static void GLAPIENTRY
7371 save_Uniform2ivARB(GLint location, GLsizei count, const GLint *v)
7372 {
7373 GET_CURRENT_CONTEXT(ctx);
7374 Node *n;
7375 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7376 n = alloc_instruction(ctx, OPCODE_UNIFORM_2IV, 2 + POINTER_DWORDS);
7377 if (n) {
7378 n[1].i = location;
7379 n[2].i = count;
7380 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLint)));
7381 }
7382 if (ctx->ExecuteFlag) {
7383 CALL_Uniform2iv(ctx->Exec, (location, count, v));
7384 }
7385 }
7386
7387 static void GLAPIENTRY
7388 save_Uniform3ivARB(GLint location, GLsizei count, const GLint *v)
7389 {
7390 GET_CURRENT_CONTEXT(ctx);
7391 Node *n;
7392 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7393 n = alloc_instruction(ctx, OPCODE_UNIFORM_3IV, 2 + POINTER_DWORDS);
7394 if (n) {
7395 n[1].i = location;
7396 n[2].i = count;
7397 save_pointer(&n[3], memdup(v, count * 3 * sizeof(GLint)));
7398 }
7399 if (ctx->ExecuteFlag) {
7400 CALL_Uniform3iv(ctx->Exec, (location, count, v));
7401 }
7402 }
7403
7404 static void GLAPIENTRY
7405 save_Uniform4ivARB(GLint location, GLsizei count, const GLint *v)
7406 {
7407 GET_CURRENT_CONTEXT(ctx);
7408 Node *n;
7409 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7410 n = alloc_instruction(ctx, OPCODE_UNIFORM_4IV, 2 + POINTER_DWORDS);
7411 if (n) {
7412 n[1].i = location;
7413 n[2].i = count;
7414 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLfloat)));
7415 }
7416 if (ctx->ExecuteFlag) {
7417 CALL_Uniform4iv(ctx->Exec, (location, count, v));
7418 }
7419 }
7420
7421
7422
7423 static void GLAPIENTRY
7424 save_Uniform1ui(GLint location, GLuint x)
7425 {
7426 GET_CURRENT_CONTEXT(ctx);
7427 Node *n;
7428 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7429 n = alloc_instruction(ctx, OPCODE_UNIFORM_1UI, 2);
7430 if (n) {
7431 n[1].i = location;
7432 n[2].i = x;
7433 }
7434 if (ctx->ExecuteFlag) {
7435 CALL_Uniform1ui(ctx->Exec, (location, x));
7436 }
7437 }
7438
7439 static void GLAPIENTRY
7440 save_Uniform2ui(GLint location, GLuint x, GLuint y)
7441 {
7442 GET_CURRENT_CONTEXT(ctx);
7443 Node *n;
7444 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7445 n = alloc_instruction(ctx, OPCODE_UNIFORM_2UI, 3);
7446 if (n) {
7447 n[1].i = location;
7448 n[2].i = x;
7449 n[3].i = y;
7450 }
7451 if (ctx->ExecuteFlag) {
7452 CALL_Uniform2ui(ctx->Exec, (location, x, y));
7453 }
7454 }
7455
7456 static void GLAPIENTRY
7457 save_Uniform3ui(GLint location, GLuint x, GLuint y, GLuint z)
7458 {
7459 GET_CURRENT_CONTEXT(ctx);
7460 Node *n;
7461 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7462 n = alloc_instruction(ctx, OPCODE_UNIFORM_3UI, 4);
7463 if (n) {
7464 n[1].i = location;
7465 n[2].i = x;
7466 n[3].i = y;
7467 n[4].i = z;
7468 }
7469 if (ctx->ExecuteFlag) {
7470 CALL_Uniform3ui(ctx->Exec, (location, x, y, z));
7471 }
7472 }
7473
7474 static void GLAPIENTRY
7475 save_Uniform4ui(GLint location, GLuint x, GLuint y, GLuint z, GLuint w)
7476 {
7477 GET_CURRENT_CONTEXT(ctx);
7478 Node *n;
7479 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7480 n = alloc_instruction(ctx, OPCODE_UNIFORM_4UI, 5);
7481 if (n) {
7482 n[1].i = location;
7483 n[2].i = x;
7484 n[3].i = y;
7485 n[4].i = z;
7486 n[5].i = w;
7487 }
7488 if (ctx->ExecuteFlag) {
7489 CALL_Uniform4ui(ctx->Exec, (location, x, y, z, w));
7490 }
7491 }
7492
7493
7494
7495 static void GLAPIENTRY
7496 save_Uniform1uiv(GLint location, GLsizei count, const GLuint *v)
7497 {
7498 GET_CURRENT_CONTEXT(ctx);
7499 Node *n;
7500 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7501 n = alloc_instruction(ctx, OPCODE_UNIFORM_1UIV, 2 + POINTER_DWORDS);
7502 if (n) {
7503 n[1].i = location;
7504 n[2].i = count;
7505 save_pointer(&n[3], memdup(v, count * 1 * sizeof(*v)));
7506 }
7507 if (ctx->ExecuteFlag) {
7508 CALL_Uniform1uiv(ctx->Exec, (location, count, v));
7509 }
7510 }
7511
7512 static void GLAPIENTRY
7513 save_Uniform2uiv(GLint location, GLsizei count, const GLuint *v)
7514 {
7515 GET_CURRENT_CONTEXT(ctx);
7516 Node *n;
7517 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7518 n = alloc_instruction(ctx, OPCODE_UNIFORM_2UIV, 2 + POINTER_DWORDS);
7519 if (n) {
7520 n[1].i = location;
7521 n[2].i = count;
7522 save_pointer(&n[3], memdup(v, count * 2 * sizeof(*v)));
7523 }
7524 if (ctx->ExecuteFlag) {
7525 CALL_Uniform2uiv(ctx->Exec, (location, count, v));
7526 }
7527 }
7528
7529 static void GLAPIENTRY
7530 save_Uniform3uiv(GLint location, GLsizei count, const GLuint *v)
7531 {
7532 GET_CURRENT_CONTEXT(ctx);
7533 Node *n;
7534 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7535 n = alloc_instruction(ctx, OPCODE_UNIFORM_3UIV, 2 + POINTER_DWORDS);
7536 if (n) {
7537 n[1].i = location;
7538 n[2].i = count;
7539 save_pointer(&n[3], memdup(v, count * 3 * sizeof(*v)));
7540 }
7541 if (ctx->ExecuteFlag) {
7542 CALL_Uniform3uiv(ctx->Exec, (location, count, v));
7543 }
7544 }
7545
7546 static void GLAPIENTRY
7547 save_Uniform4uiv(GLint location, GLsizei count, const GLuint *v)
7548 {
7549 GET_CURRENT_CONTEXT(ctx);
7550 Node *n;
7551 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7552 n = alloc_instruction(ctx, OPCODE_UNIFORM_4UIV, 2 + POINTER_DWORDS);
7553 if (n) {
7554 n[1].i = location;
7555 n[2].i = count;
7556 save_pointer(&n[3], memdup(v, count * 4 * sizeof(*v)));
7557 }
7558 if (ctx->ExecuteFlag) {
7559 CALL_Uniform4uiv(ctx->Exec, (location, count, v));
7560 }
7561 }
7562
7563
7564
7565 static void GLAPIENTRY
7566 save_UniformMatrix2fvARB(GLint location, GLsizei count, GLboolean transpose,
7567 const GLfloat *m)
7568 {
7569 GET_CURRENT_CONTEXT(ctx);
7570 Node *n;
7571 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7572 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX22, 3 + POINTER_DWORDS);
7573 if (n) {
7574 n[1].i = location;
7575 n[2].i = count;
7576 n[3].b = transpose;
7577 save_pointer(&n[4], memdup(m, count * 2 * 2 * sizeof(GLfloat)));
7578 }
7579 if (ctx->ExecuteFlag) {
7580 CALL_UniformMatrix2fv(ctx->Exec, (location, count, transpose, m));
7581 }
7582 }
7583
7584 static void GLAPIENTRY
7585 save_UniformMatrix3fvARB(GLint location, GLsizei count, GLboolean transpose,
7586 const GLfloat *m)
7587 {
7588 GET_CURRENT_CONTEXT(ctx);
7589 Node *n;
7590 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7591 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX33, 3 + POINTER_DWORDS);
7592 if (n) {
7593 n[1].i = location;
7594 n[2].i = count;
7595 n[3].b = transpose;
7596 save_pointer(&n[4], memdup(m, count * 3 * 3 * sizeof(GLfloat)));
7597 }
7598 if (ctx->ExecuteFlag) {
7599 CALL_UniformMatrix3fv(ctx->Exec, (location, count, transpose, m));
7600 }
7601 }
7602
7603 static void GLAPIENTRY
7604 save_UniformMatrix4fvARB(GLint location, GLsizei count, GLboolean transpose,
7605 const GLfloat *m)
7606 {
7607 GET_CURRENT_CONTEXT(ctx);
7608 Node *n;
7609 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7610 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX44, 3 + POINTER_DWORDS);
7611 if (n) {
7612 n[1].i = location;
7613 n[2].i = count;
7614 n[3].b = transpose;
7615 save_pointer(&n[4], memdup(m, count * 4 * 4 * sizeof(GLfloat)));
7616 }
7617 if (ctx->ExecuteFlag) {
7618 CALL_UniformMatrix4fv(ctx->Exec, (location, count, transpose, m));
7619 }
7620 }
7621
7622
7623 static void GLAPIENTRY
7624 save_UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose,
7625 const GLfloat *m)
7626 {
7627 GET_CURRENT_CONTEXT(ctx);
7628 Node *n;
7629 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7630 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX23, 3 + POINTER_DWORDS);
7631 if (n) {
7632 n[1].i = location;
7633 n[2].i = count;
7634 n[3].b = transpose;
7635 save_pointer(&n[4], memdup(m, count * 2 * 3 * sizeof(GLfloat)));
7636 }
7637 if (ctx->ExecuteFlag) {
7638 CALL_UniformMatrix2x3fv(ctx->Exec, (location, count, transpose, m));
7639 }
7640 }
7641
7642 static void GLAPIENTRY
7643 save_UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose,
7644 const GLfloat *m)
7645 {
7646 GET_CURRENT_CONTEXT(ctx);
7647 Node *n;
7648 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7649 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX32, 3 + POINTER_DWORDS);
7650 if (n) {
7651 n[1].i = location;
7652 n[2].i = count;
7653 n[3].b = transpose;
7654 save_pointer(&n[4], memdup(m, count * 3 * 2 * sizeof(GLfloat)));
7655 }
7656 if (ctx->ExecuteFlag) {
7657 CALL_UniformMatrix3x2fv(ctx->Exec, (location, count, transpose, m));
7658 }
7659 }
7660
7661
7662 static void GLAPIENTRY
7663 save_UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose,
7664 const GLfloat *m)
7665 {
7666 GET_CURRENT_CONTEXT(ctx);
7667 Node *n;
7668 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7669 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX24, 3 + POINTER_DWORDS);
7670 if (n) {
7671 n[1].i = location;
7672 n[2].i = count;
7673 n[3].b = transpose;
7674 save_pointer(&n[4], memdup(m, count * 2 * 4 * sizeof(GLfloat)));
7675 }
7676 if (ctx->ExecuteFlag) {
7677 CALL_UniformMatrix2x4fv(ctx->Exec, (location, count, transpose, m));
7678 }
7679 }
7680
7681 static void GLAPIENTRY
7682 save_UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose,
7683 const GLfloat *m)
7684 {
7685 GET_CURRENT_CONTEXT(ctx);
7686 Node *n;
7687 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7688 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX42, 3 + POINTER_DWORDS);
7689 if (n) {
7690 n[1].i = location;
7691 n[2].i = count;
7692 n[3].b = transpose;
7693 save_pointer(&n[4], memdup(m, count * 4 * 2 * sizeof(GLfloat)));
7694 }
7695 if (ctx->ExecuteFlag) {
7696 CALL_UniformMatrix4x2fv(ctx->Exec, (location, count, transpose, m));
7697 }
7698 }
7699
7700
7701 static void GLAPIENTRY
7702 save_UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose,
7703 const GLfloat *m)
7704 {
7705 GET_CURRENT_CONTEXT(ctx);
7706 Node *n;
7707 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7708 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX34, 3 + POINTER_DWORDS);
7709 if (n) {
7710 n[1].i = location;
7711 n[2].i = count;
7712 n[3].b = transpose;
7713 save_pointer(&n[4], memdup(m, count * 3 * 4 * sizeof(GLfloat)));
7714 }
7715 if (ctx->ExecuteFlag) {
7716 CALL_UniformMatrix3x4fv(ctx->Exec, (location, count, transpose, m));
7717 }
7718 }
7719
7720 static void GLAPIENTRY
7721 save_UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose,
7722 const GLfloat *m)
7723 {
7724 GET_CURRENT_CONTEXT(ctx);
7725 Node *n;
7726 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7727 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX43, 3 + POINTER_DWORDS);
7728 if (n) {
7729 n[1].i = location;
7730 n[2].i = count;
7731 n[3].b = transpose;
7732 save_pointer(&n[4], memdup(m, count * 4 * 3 * sizeof(GLfloat)));
7733 }
7734 if (ctx->ExecuteFlag) {
7735 CALL_UniformMatrix4x3fv(ctx->Exec, (location, count, transpose, m));
7736 }
7737 }
7738
7739
7740 static void GLAPIENTRY
7741 save_UniformMatrix2dv(GLint location, GLsizei count, GLboolean transpose,
7742 const GLdouble *m)
7743 {
7744 GET_CURRENT_CONTEXT(ctx);
7745 Node *n;
7746 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7747 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX22D, 3 + POINTER_DWORDS);
7748 if (n) {
7749 n[1].i = location;
7750 n[2].i = count;
7751 n[3].b = transpose;
7752 save_pointer(&n[4], memdup(m, count * 2 * 2 * sizeof(GLdouble)));
7753 }
7754 if (ctx->ExecuteFlag) {
7755 CALL_UniformMatrix2dv(ctx->Exec, (location, count, transpose, m));
7756 }
7757 }
7758
7759 static void GLAPIENTRY
7760 save_UniformMatrix3dv(GLint location, GLsizei count, GLboolean transpose,
7761 const GLdouble *m)
7762 {
7763 GET_CURRENT_CONTEXT(ctx);
7764 Node *n;
7765 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7766 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX33D, 3 + POINTER_DWORDS);
7767 if (n) {
7768 n[1].i = location;
7769 n[2].i = count;
7770 n[3].b = transpose;
7771 save_pointer(&n[4], memdup(m, count * 3 * 3 * sizeof(GLdouble)));
7772 }
7773 if (ctx->ExecuteFlag) {
7774 CALL_UniformMatrix3dv(ctx->Exec, (location, count, transpose, m));
7775 }
7776 }
7777
7778 static void GLAPIENTRY
7779 save_UniformMatrix4dv(GLint location, GLsizei count, GLboolean transpose,
7780 const GLdouble *m)
7781 {
7782 GET_CURRENT_CONTEXT(ctx);
7783 Node *n;
7784 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7785 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX44D, 3 + POINTER_DWORDS);
7786 if (n) {
7787 n[1].i = location;
7788 n[2].i = count;
7789 n[3].b = transpose;
7790 save_pointer(&n[4], memdup(m, count * 4 * 4 * sizeof(GLdouble)));
7791 }
7792 if (ctx->ExecuteFlag) {
7793 CALL_UniformMatrix4dv(ctx->Exec, (location, count, transpose, m));
7794 }
7795 }
7796
7797
7798 static void GLAPIENTRY
7799 save_UniformMatrix2x3dv(GLint location, GLsizei count, GLboolean transpose,
7800 const GLdouble *m)
7801 {
7802 GET_CURRENT_CONTEXT(ctx);
7803 Node *n;
7804 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7805 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX23D, 3 + POINTER_DWORDS);
7806 if (n) {
7807 n[1].i = location;
7808 n[2].i = count;
7809 n[3].b = transpose;
7810 save_pointer(&n[4], memdup(m, count * 2 * 3 * sizeof(GLdouble)));
7811 }
7812 if (ctx->ExecuteFlag) {
7813 CALL_UniformMatrix2x3dv(ctx->Exec, (location, count, transpose, m));
7814 }
7815 }
7816
7817
7818 static void GLAPIENTRY
7819 save_UniformMatrix3x2dv(GLint location, GLsizei count, GLboolean transpose,
7820 const GLdouble *m)
7821 {
7822 GET_CURRENT_CONTEXT(ctx);
7823 Node *n;
7824 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7825 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX32D, 3 + POINTER_DWORDS);
7826 if (n) {
7827 n[1].i = location;
7828 n[2].i = count;
7829 n[3].b = transpose;
7830 save_pointer(&n[4], memdup(m, count * 3 * 2 * sizeof(GLdouble)));
7831 }
7832 if (ctx->ExecuteFlag) {
7833 CALL_UniformMatrix3x2dv(ctx->Exec, (location, count, transpose, m));
7834 }
7835 }
7836
7837
7838 static void GLAPIENTRY
7839 save_UniformMatrix2x4dv(GLint location, GLsizei count, GLboolean transpose,
7840 const GLdouble *m)
7841 {
7842 GET_CURRENT_CONTEXT(ctx);
7843 Node *n;
7844 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7845 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX24D, 3 + POINTER_DWORDS);
7846 if (n) {
7847 n[1].i = location;
7848 n[2].i = count;
7849 n[3].b = transpose;
7850 save_pointer(&n[4], memdup(m, count * 2 * 4 * sizeof(GLdouble)));
7851 }
7852 if (ctx->ExecuteFlag) {
7853 CALL_UniformMatrix2x4dv(ctx->Exec, (location, count, transpose, m));
7854 }
7855 }
7856
7857 static void GLAPIENTRY
7858 save_UniformMatrix4x2dv(GLint location, GLsizei count, GLboolean transpose,
7859 const GLdouble *m)
7860 {
7861 GET_CURRENT_CONTEXT(ctx);
7862 Node *n;
7863 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7864 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX42D, 3 + POINTER_DWORDS);
7865 if (n) {
7866 n[1].i = location;
7867 n[2].i = count;
7868 n[3].b = transpose;
7869 save_pointer(&n[4], memdup(m, count * 4 * 2 * sizeof(GLdouble)));
7870 }
7871 if (ctx->ExecuteFlag) {
7872 CALL_UniformMatrix4x2dv(ctx->Exec, (location, count, transpose, m));
7873 }
7874 }
7875
7876
7877 static void GLAPIENTRY
7878 save_UniformMatrix3x4dv(GLint location, GLsizei count, GLboolean transpose,
7879 const GLdouble *m)
7880 {
7881 GET_CURRENT_CONTEXT(ctx);
7882 Node *n;
7883 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7884 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX34D, 3 + POINTER_DWORDS);
7885 if (n) {
7886 n[1].i = location;
7887 n[2].i = count;
7888 n[3].b = transpose;
7889 save_pointer(&n[4], memdup(m, count * 3 * 4 * sizeof(GLdouble)));
7890 }
7891 if (ctx->ExecuteFlag) {
7892 CALL_UniformMatrix3x4dv(ctx->Exec, (location, count, transpose, m));
7893 }
7894 }
7895
7896
7897 static void GLAPIENTRY
7898 save_UniformMatrix4x3dv(GLint location, GLsizei count, GLboolean transpose,
7899 const GLdouble *m)
7900 {
7901 GET_CURRENT_CONTEXT(ctx);
7902 Node *n;
7903 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7904 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX43D, 3 + POINTER_DWORDS);
7905 if (n) {
7906 n[1].i = location;
7907 n[2].i = count;
7908 n[3].b = transpose;
7909 save_pointer(&n[4], memdup(m, count * 4 * 3 * sizeof(GLdouble)));
7910 }
7911 if (ctx->ExecuteFlag) {
7912 CALL_UniformMatrix4x3dv(ctx->Exec, (location, count, transpose, m));
7913 }
7914 }
7915
7916 static void GLAPIENTRY
7917 save_Uniform1i64ARB(GLint location, GLint64 x)
7918 {
7919 GET_CURRENT_CONTEXT(ctx);
7920 Node *n;
7921 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7922 n = alloc_instruction(ctx, OPCODE_UNIFORM_1I64, 3);
7923 if (n) {
7924 n[1].i = location;
7925 ASSIGN_INT64_TO_NODES(n, 2, x);
7926 }
7927 if (ctx->ExecuteFlag) {
7928 CALL_Uniform1i64ARB(ctx->Exec, (location, x));
7929 }
7930 }
7931
7932 static void GLAPIENTRY
7933 save_Uniform2i64ARB(GLint location, GLint64 x, GLint64 y)
7934 {
7935 GET_CURRENT_CONTEXT(ctx);
7936 Node *n;
7937 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7938 n = alloc_instruction(ctx, OPCODE_UNIFORM_2I64, 5);
7939 if (n) {
7940 n[1].i = location;
7941 ASSIGN_INT64_TO_NODES(n, 2, x);
7942 ASSIGN_INT64_TO_NODES(n, 4, y);
7943 }
7944 if (ctx->ExecuteFlag) {
7945 CALL_Uniform2i64ARB(ctx->Exec, (location, x, y));
7946 }
7947 }
7948
7949 static void GLAPIENTRY
7950 save_Uniform3i64ARB(GLint location, GLint64 x, GLint64 y, GLint64 z)
7951 {
7952 GET_CURRENT_CONTEXT(ctx);
7953 Node *n;
7954 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7955 n = alloc_instruction(ctx, OPCODE_UNIFORM_3I64, 7);
7956 if (n) {
7957 n[1].i = location;
7958 ASSIGN_INT64_TO_NODES(n, 2, x);
7959 ASSIGN_INT64_TO_NODES(n, 4, y);
7960 ASSIGN_INT64_TO_NODES(n, 6, z);
7961 }
7962 if (ctx->ExecuteFlag) {
7963 CALL_Uniform3i64ARB(ctx->Exec, (location, x, y, z));
7964 }
7965 }
7966
7967 static void GLAPIENTRY
7968 save_Uniform4i64ARB(GLint location, GLint64 x, GLint64 y, GLint64 z, GLint64 w)
7969 {
7970 GET_CURRENT_CONTEXT(ctx);
7971 Node *n;
7972 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7973 n = alloc_instruction(ctx, OPCODE_UNIFORM_4I64, 9);
7974 if (n) {
7975 n[1].i = location;
7976 ASSIGN_INT64_TO_NODES(n, 2, x);
7977 ASSIGN_INT64_TO_NODES(n, 4, y);
7978 ASSIGN_INT64_TO_NODES(n, 6, z);
7979 ASSIGN_INT64_TO_NODES(n, 8, w);
7980 }
7981 if (ctx->ExecuteFlag) {
7982 CALL_Uniform4i64ARB(ctx->Exec, (location, x, y, z, w));
7983 }
7984 }
7985
7986 static void GLAPIENTRY
7987 save_Uniform1i64vARB(GLint location, GLsizei count, const GLint64 *v)
7988 {
7989 GET_CURRENT_CONTEXT(ctx);
7990 Node *n;
7991 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7992 n = alloc_instruction(ctx, OPCODE_UNIFORM_1I64V, 2 + POINTER_DWORDS);
7993 if (n) {
7994 n[1].i = location;
7995 n[2].i = count;
7996 save_pointer(&n[3], memdup(v, count * 1 * sizeof(GLint64)));
7997 }
7998 if (ctx->ExecuteFlag) {
7999 CALL_Uniform1i64vARB(ctx->Exec, (location, count, v));
8000 }
8001 }
8002
8003 static void GLAPIENTRY
8004 save_Uniform2i64vARB(GLint location, GLsizei count, const GLint64 *v)
8005 {
8006 GET_CURRENT_CONTEXT(ctx);
8007 Node *n;
8008 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8009 n = alloc_instruction(ctx, OPCODE_UNIFORM_2I64V, 2 + POINTER_DWORDS);
8010 if (n) {
8011 n[1].i = location;
8012 n[2].i = count;
8013 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLint64)));
8014 }
8015 if (ctx->ExecuteFlag) {
8016 CALL_Uniform2i64vARB(ctx->Exec, (location, count, v));
8017 }
8018 }
8019
8020 static void GLAPIENTRY
8021 save_Uniform3i64vARB(GLint location, GLsizei count, const GLint64 *v)
8022 {
8023 GET_CURRENT_CONTEXT(ctx);
8024 Node *n;
8025 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8026 n = alloc_instruction(ctx, OPCODE_UNIFORM_3I64V, 2 + POINTER_DWORDS);
8027 if (n) {
8028 n[1].i = location;
8029 n[2].i = count;
8030 save_pointer(&n[3], memdup(v, count * 3 * sizeof(GLint64)));
8031 }
8032 if (ctx->ExecuteFlag) {
8033 CALL_Uniform3i64vARB(ctx->Exec, (location, count, v));
8034 }
8035 }
8036
8037 static void GLAPIENTRY
8038 save_Uniform4i64vARB(GLint location, GLsizei count, const GLint64 *v)
8039 {
8040 GET_CURRENT_CONTEXT(ctx);
8041 Node *n;
8042 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8043 n = alloc_instruction(ctx, OPCODE_UNIFORM_4I64V, 2 + POINTER_DWORDS);
8044 if (n) {
8045 n[1].i = location;
8046 n[2].i = count;
8047 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLint64)));
8048 }
8049 if (ctx->ExecuteFlag) {
8050 CALL_Uniform4i64vARB(ctx->Exec, (location, count, v));
8051 }
8052 }
8053
8054 static void GLAPIENTRY
8055 save_Uniform1ui64ARB(GLint location, GLuint64 x)
8056 {
8057 GET_CURRENT_CONTEXT(ctx);
8058 Node *n;
8059 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8060 n = alloc_instruction(ctx, OPCODE_UNIFORM_1UI64, 3);
8061 if (n) {
8062 n[1].i = location;
8063 ASSIGN_UINT64_TO_NODES(n, 2, x);
8064 }
8065 if (ctx->ExecuteFlag) {
8066 CALL_Uniform1ui64ARB(ctx->Exec, (location, x));
8067 }
8068 }
8069
8070 static void GLAPIENTRY
8071 save_Uniform2ui64ARB(GLint location, GLuint64 x, GLuint64 y)
8072 {
8073 GET_CURRENT_CONTEXT(ctx);
8074 Node *n;
8075 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8076 n = alloc_instruction(ctx, OPCODE_UNIFORM_2UI64, 5);
8077 if (n) {
8078 n[1].i = location;
8079 ASSIGN_UINT64_TO_NODES(n, 2, x);
8080 ASSIGN_UINT64_TO_NODES(n, 4, y);
8081 }
8082 if (ctx->ExecuteFlag) {
8083 CALL_Uniform2ui64ARB(ctx->Exec, (location, x, y));
8084 }
8085 }
8086
8087 static void GLAPIENTRY
8088 save_Uniform3ui64ARB(GLint location, GLuint64 x, GLuint64 y, GLuint64 z)
8089 {
8090 GET_CURRENT_CONTEXT(ctx);
8091 Node *n;
8092 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8093 n = alloc_instruction(ctx, OPCODE_UNIFORM_3UI64, 7);
8094 if (n) {
8095 n[1].i = location;
8096 ASSIGN_UINT64_TO_NODES(n, 2, x);
8097 ASSIGN_UINT64_TO_NODES(n, 4, y);
8098 ASSIGN_UINT64_TO_NODES(n, 6, z);
8099 }
8100 if (ctx->ExecuteFlag) {
8101 CALL_Uniform3ui64ARB(ctx->Exec, (location, x, y, z));
8102 }
8103 }
8104
8105 static void GLAPIENTRY
8106 save_Uniform4ui64ARB(GLint location, GLuint64 x, GLuint64 y, GLuint64 z, GLuint64 w)
8107 {
8108 GET_CURRENT_CONTEXT(ctx);
8109 Node *n;
8110 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8111 n = alloc_instruction(ctx, OPCODE_UNIFORM_4UI64, 9);
8112 if (n) {
8113 n[1].i = location;
8114 ASSIGN_UINT64_TO_NODES(n, 2, x);
8115 ASSIGN_UINT64_TO_NODES(n, 4, y);
8116 ASSIGN_UINT64_TO_NODES(n, 6, z);
8117 ASSIGN_UINT64_TO_NODES(n, 8, w);
8118 }
8119 if (ctx->ExecuteFlag) {
8120 CALL_Uniform4ui64ARB(ctx->Exec, (location, x, y, z, w));
8121 }
8122 }
8123
8124 static void GLAPIENTRY
8125 save_Uniform1ui64vARB(GLint location, GLsizei count, const GLuint64 *v)
8126 {
8127 GET_CURRENT_CONTEXT(ctx);
8128 Node *n;
8129 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8130 n = alloc_instruction(ctx, OPCODE_UNIFORM_1UI64V, 2 + POINTER_DWORDS);
8131 if (n) {
8132 n[1].i = location;
8133 n[2].i = count;
8134 save_pointer(&n[3], memdup(v, count * 1 * sizeof(GLuint64)));
8135 }
8136 if (ctx->ExecuteFlag) {
8137 CALL_Uniform1ui64vARB(ctx->Exec, (location, count, v));
8138 }
8139 }
8140
8141 static void GLAPIENTRY
8142 save_Uniform2ui64vARB(GLint location, GLsizei count, const GLuint64 *v)
8143 {
8144 GET_CURRENT_CONTEXT(ctx);
8145 Node *n;
8146 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8147 n = alloc_instruction(ctx, OPCODE_UNIFORM_2UI64V, 2 + POINTER_DWORDS);
8148 if (n) {
8149 n[1].i = location;
8150 n[2].i = count;
8151 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLuint64)));
8152 }
8153 if (ctx->ExecuteFlag) {
8154 CALL_Uniform2ui64vARB(ctx->Exec, (location, count, v));
8155 }
8156 }
8157
8158 static void GLAPIENTRY
8159 save_Uniform3ui64vARB(GLint location, GLsizei count, const GLuint64 *v)
8160 {
8161 GET_CURRENT_CONTEXT(ctx);
8162 Node *n;
8163 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8164 n = alloc_instruction(ctx, OPCODE_UNIFORM_3UI64V, 2 + POINTER_DWORDS);
8165 if (n) {
8166 n[1].i = location;
8167 n[2].i = count;
8168 save_pointer(&n[3], memdup(v, count * 3 * sizeof(GLuint64)));
8169 }
8170 if (ctx->ExecuteFlag) {
8171 CALL_Uniform3ui64vARB(ctx->Exec, (location, count, v));
8172 }
8173 }
8174
8175 static void GLAPIENTRY
8176 save_Uniform4ui64vARB(GLint location, GLsizei count, const GLuint64 *v)
8177 {
8178 GET_CURRENT_CONTEXT(ctx);
8179 Node *n;
8180 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8181 n = alloc_instruction(ctx, OPCODE_UNIFORM_4UI64V, 2 + POINTER_DWORDS);
8182 if (n) {
8183 n[1].i = location;
8184 n[2].i = count;
8185 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLuint64)));
8186 }
8187 if (ctx->ExecuteFlag) {
8188 CALL_Uniform4ui64vARB(ctx->Exec, (location, count, v));
8189 }
8190 }
8191
8192 static void GLAPIENTRY
8193 save_ProgramUniform1i64ARB(GLuint program, GLint location, GLint64 x)
8194 {
8195 GET_CURRENT_CONTEXT(ctx);
8196 Node *n;
8197 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8198 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1I64, 4);
8199 if (n) {
8200 n[1].ui = program;
8201 n[2].i = location;
8202 ASSIGN_INT64_TO_NODES(n, 3, x);
8203 }
8204 if (ctx->ExecuteFlag) {
8205 CALL_ProgramUniform1i64ARB(ctx->Exec, (program, location, x));
8206 }
8207 }
8208
8209 static void GLAPIENTRY
8210 save_ProgramUniform2i64ARB(GLuint program, GLint location, GLint64 x,
8211 GLint64 y)
8212 {
8213 GET_CURRENT_CONTEXT(ctx);
8214 Node *n;
8215 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8216 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2I64, 6);
8217 if (n) {
8218 n[1].ui = program;
8219 n[2].i = location;
8220 ASSIGN_INT64_TO_NODES(n, 3, x);
8221 ASSIGN_INT64_TO_NODES(n, 5, y);
8222 }
8223 if (ctx->ExecuteFlag) {
8224 CALL_ProgramUniform2i64ARB(ctx->Exec, (program, location, x, y));
8225 }
8226 }
8227
8228 static void GLAPIENTRY
8229 save_ProgramUniform3i64ARB(GLuint program, GLint location, GLint64 x,
8230 GLint64 y, GLint64 z)
8231 {
8232 GET_CURRENT_CONTEXT(ctx);
8233 Node *n;
8234 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8235 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3I64, 8);
8236 if (n) {
8237 n[1].ui = program;
8238 n[2].i = location;
8239 ASSIGN_INT64_TO_NODES(n, 3, x);
8240 ASSIGN_INT64_TO_NODES(n, 5, y);
8241 ASSIGN_INT64_TO_NODES(n, 7, z);
8242 }
8243 if (ctx->ExecuteFlag) {
8244 CALL_ProgramUniform3i64ARB(ctx->Exec, (program, location, x, y, z));
8245 }
8246 }
8247
8248 static void GLAPIENTRY
8249 save_ProgramUniform4i64ARB(GLuint program, GLint location, GLint64 x,
8250 GLint64 y, GLint64 z, GLint64 w)
8251 {
8252 GET_CURRENT_CONTEXT(ctx);
8253 Node *n;
8254 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8255 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4I64, 10);
8256 if (n) {
8257 n[1].ui = program;
8258 n[2].i = location;
8259 ASSIGN_INT64_TO_NODES(n, 3, x);
8260 ASSIGN_INT64_TO_NODES(n, 5, y);
8261 ASSIGN_INT64_TO_NODES(n, 7, z);
8262 ASSIGN_INT64_TO_NODES(n, 9, w);
8263 }
8264 if (ctx->ExecuteFlag) {
8265 CALL_ProgramUniform4i64ARB(ctx->Exec, (program, location, x, y, z, w));
8266 }
8267 }
8268
8269 static void GLAPIENTRY
8270 save_ProgramUniform1i64vARB(GLuint program, GLint location, GLsizei count,
8271 const GLint64 *v)
8272 {
8273 GET_CURRENT_CONTEXT(ctx);
8274 Node *n;
8275 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8276 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1I64V, 3 + POINTER_DWORDS);
8277 if (n) {
8278 n[1].ui = program;
8279 n[2].i = location;
8280 n[3].i = count;
8281 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLint64)));
8282 }
8283 if (ctx->ExecuteFlag) {
8284 CALL_ProgramUniform1i64vARB(ctx->Exec, (program, location, count, v));
8285 }
8286 }
8287
8288 static void GLAPIENTRY
8289 save_ProgramUniform2i64vARB(GLuint program, GLint location, GLsizei count,
8290 const GLint64 *v)
8291 {
8292 GET_CURRENT_CONTEXT(ctx);
8293 Node *n;
8294 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8295 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2I64V, 3 + POINTER_DWORDS);
8296 if (n) {
8297 n[1].ui = program;
8298 n[2].i = location;
8299 n[3].i = count;
8300 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLint64)));
8301 }
8302 if (ctx->ExecuteFlag) {
8303 CALL_ProgramUniform2i64vARB(ctx->Exec, (program, location, count, v));
8304 }
8305 }
8306
8307 static void GLAPIENTRY
8308 save_ProgramUniform3i64vARB(GLuint program, GLint location, GLsizei count,
8309 const GLint64 *v)
8310 {
8311 GET_CURRENT_CONTEXT(ctx);
8312 Node *n;
8313 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8314 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3I64V, 3 + POINTER_DWORDS);
8315 if (n) {
8316 n[1].ui = program;
8317 n[2].i = location;
8318 n[3].i = count;
8319 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLint64)));
8320 }
8321 if (ctx->ExecuteFlag) {
8322 CALL_ProgramUniform3i64vARB(ctx->Exec, (program, location, count, v));
8323 }
8324 }
8325
8326 static void GLAPIENTRY
8327 save_ProgramUniform4i64vARB(GLuint program, GLint location, GLsizei count,
8328 const GLint64 *v)
8329 {
8330 GET_CURRENT_CONTEXT(ctx);
8331 Node *n;
8332 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8333 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4I64V, 3 + POINTER_DWORDS);
8334 if (n) {
8335 n[1].ui = program;
8336 n[2].i = location;
8337 n[3].i = count;
8338 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLint64)));
8339 }
8340 if (ctx->ExecuteFlag) {
8341 CALL_ProgramUniform4i64vARB(ctx->Exec, (program, location, count, v));
8342 }
8343 }
8344
8345 static void GLAPIENTRY
8346 save_ProgramUniform1ui64ARB(GLuint program, GLint location, GLuint64 x)
8347 {
8348 GET_CURRENT_CONTEXT(ctx);
8349 Node *n;
8350 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8351 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1UI64, 4);
8352 if (n) {
8353 n[1].ui = program;
8354 n[2].i = location;
8355 ASSIGN_UINT64_TO_NODES(n, 3, x);
8356 }
8357 if (ctx->ExecuteFlag) {
8358 CALL_ProgramUniform1ui64ARB(ctx->Exec, (program, location, x));
8359 }
8360 }
8361
8362 static void GLAPIENTRY
8363 save_ProgramUniform2ui64ARB(GLuint program, GLint location, GLuint64 x,
8364 GLuint64 y)
8365 {
8366 GET_CURRENT_CONTEXT(ctx);
8367 Node *n;
8368 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8369 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2UI64, 6);
8370 if (n) {
8371 n[1].ui = program;
8372 n[2].i = location;
8373 ASSIGN_UINT64_TO_NODES(n, 3, x);
8374 ASSIGN_UINT64_TO_NODES(n, 5, y);
8375 }
8376 if (ctx->ExecuteFlag) {
8377 CALL_ProgramUniform2ui64ARB(ctx->Exec, (program, location, x, y));
8378 }
8379 }
8380
8381 static void GLAPIENTRY
8382 save_ProgramUniform3ui64ARB(GLuint program, GLint location, GLuint64 x,
8383 GLuint64 y, GLuint64 z)
8384 {
8385 GET_CURRENT_CONTEXT(ctx);
8386 Node *n;
8387 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8388 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3UI64, 8);
8389 if (n) {
8390 n[1].ui = program;
8391 n[2].i = location;
8392 ASSIGN_UINT64_TO_NODES(n, 3, x);
8393 ASSIGN_UINT64_TO_NODES(n, 5, y);
8394 ASSIGN_UINT64_TO_NODES(n, 7, z);
8395 }
8396 if (ctx->ExecuteFlag) {
8397 CALL_ProgramUniform3ui64ARB(ctx->Exec, (program, location, x, y, z));
8398 }
8399 }
8400
8401 static void GLAPIENTRY
8402 save_ProgramUniform4ui64ARB(GLuint program, GLint location, GLuint64 x,
8403 GLuint64 y, GLuint64 z, GLuint64 w)
8404 {
8405 GET_CURRENT_CONTEXT(ctx);
8406 Node *n;
8407 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8408 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4UI64, 10);
8409 if (n) {
8410 n[1].ui = program;
8411 n[2].i = location;
8412 ASSIGN_UINT64_TO_NODES(n, 3, x);
8413 ASSIGN_UINT64_TO_NODES(n, 5, y);
8414 ASSIGN_UINT64_TO_NODES(n, 7, z);
8415 ASSIGN_UINT64_TO_NODES(n, 9, w);
8416 }
8417 if (ctx->ExecuteFlag) {
8418 CALL_ProgramUniform4i64ARB(ctx->Exec, (program, location, x, y, z, w));
8419 }
8420 }
8421
8422 static void GLAPIENTRY
8423 save_ProgramUniform1ui64vARB(GLuint program, GLint location, GLsizei count,
8424 const GLuint64 *v)
8425 {
8426 GET_CURRENT_CONTEXT(ctx);
8427 Node *n;
8428 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8429 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1UI64V,
8430 3 + POINTER_DWORDS);
8431 if (n) {
8432 n[1].ui = program;
8433 n[2].i = location;
8434 n[3].i = count;
8435 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLuint64)));
8436 }
8437 if (ctx->ExecuteFlag) {
8438 CALL_ProgramUniform1ui64vARB(ctx->Exec, (program, location, count, v));
8439 }
8440 }
8441
8442 static void GLAPIENTRY
8443 save_ProgramUniform2ui64vARB(GLuint program, GLint location, GLsizei count,
8444 const GLuint64 *v)
8445 {
8446 GET_CURRENT_CONTEXT(ctx);
8447 Node *n;
8448 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8449 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2UI64V,
8450 3 + POINTER_DWORDS);
8451 if (n) {
8452 n[1].ui = program;
8453 n[2].i = location;
8454 n[3].i = count;
8455 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLuint64)));
8456 }
8457 if (ctx->ExecuteFlag) {
8458 CALL_ProgramUniform2ui64vARB(ctx->Exec, (program, location, count, v));
8459 }
8460 }
8461
8462 static void GLAPIENTRY
8463 save_ProgramUniform3ui64vARB(GLuint program, GLint location, GLsizei count,
8464 const GLuint64 *v)
8465 {
8466 GET_CURRENT_CONTEXT(ctx);
8467 Node *n;
8468 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8469 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3UI64V,
8470 3 + POINTER_DWORDS);
8471 if (n) {
8472 n[1].ui = program;
8473 n[2].i = location;
8474 n[3].i = count;
8475 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLuint64)));
8476 }
8477 if (ctx->ExecuteFlag) {
8478 CALL_ProgramUniform3ui64vARB(ctx->Exec, (program, location, count, v));
8479 }
8480 }
8481
8482 static void GLAPIENTRY
8483 save_ProgramUniform4ui64vARB(GLuint program, GLint location, GLsizei count,
8484 const GLuint64 *v)
8485 {
8486 GET_CURRENT_CONTEXT(ctx);
8487 Node *n;
8488 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8489 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4UI64V,
8490 3 + POINTER_DWORDS);
8491 if (n) {
8492 n[1].ui = program;
8493 n[2].i = location;
8494 n[3].i = count;
8495 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLuint64)));
8496 }
8497 if (ctx->ExecuteFlag) {
8498 CALL_ProgramUniform4ui64vARB(ctx->Exec, (program, location, count, v));
8499 }
8500 }
8501
8502
8503 static void GLAPIENTRY
8504 save_UseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program)
8505 {
8506 GET_CURRENT_CONTEXT(ctx);
8507 Node *n;
8508 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8509 n = alloc_instruction(ctx, OPCODE_USE_PROGRAM_STAGES, 3);
8510 if (n) {
8511 n[1].ui = pipeline;
8512 n[2].ui = stages;
8513 n[3].ui = program;
8514 }
8515 if (ctx->ExecuteFlag) {
8516 CALL_UseProgramStages(ctx->Exec, (pipeline, stages, program));
8517 }
8518 }
8519
8520 static void GLAPIENTRY
8521 save_ProgramUniform1f(GLuint program, GLint location, GLfloat x)
8522 {
8523 GET_CURRENT_CONTEXT(ctx);
8524 Node *n;
8525 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8526 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1F, 3);
8527 if (n) {
8528 n[1].ui = program;
8529 n[2].i = location;
8530 n[3].f = x;
8531 }
8532 if (ctx->ExecuteFlag) {
8533 CALL_ProgramUniform1f(ctx->Exec, (program, location, x));
8534 }
8535 }
8536
8537 static void GLAPIENTRY
8538 save_ProgramUniform2f(GLuint program, GLint location, GLfloat x, GLfloat y)
8539 {
8540 GET_CURRENT_CONTEXT(ctx);
8541 Node *n;
8542 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8543 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2F, 4);
8544 if (n) {
8545 n[1].ui = program;
8546 n[2].i = location;
8547 n[3].f = x;
8548 n[4].f = y;
8549 }
8550 if (ctx->ExecuteFlag) {
8551 CALL_ProgramUniform2f(ctx->Exec, (program, location, x, y));
8552 }
8553 }
8554
8555 static void GLAPIENTRY
8556 save_ProgramUniform3f(GLuint program, GLint location,
8557 GLfloat x, GLfloat y, GLfloat z)
8558 {
8559 GET_CURRENT_CONTEXT(ctx);
8560 Node *n;
8561 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8562 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3F, 5);
8563 if (n) {
8564 n[1].ui = program;
8565 n[2].i = location;
8566 n[3].f = x;
8567 n[4].f = y;
8568 n[5].f = z;
8569 }
8570 if (ctx->ExecuteFlag) {
8571 CALL_ProgramUniform3f(ctx->Exec, (program, location, x, y, z));
8572 }
8573 }
8574
8575 static void GLAPIENTRY
8576 save_ProgramUniform4f(GLuint program, GLint location,
8577 GLfloat x, GLfloat y, GLfloat z, GLfloat w)
8578 {
8579 GET_CURRENT_CONTEXT(ctx);
8580 Node *n;
8581 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8582 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4F, 6);
8583 if (n) {
8584 n[1].ui = program;
8585 n[2].i = location;
8586 n[3].f = x;
8587 n[4].f = y;
8588 n[5].f = z;
8589 n[6].f = w;
8590 }
8591 if (ctx->ExecuteFlag) {
8592 CALL_ProgramUniform4f(ctx->Exec, (program, location, x, y, z, w));
8593 }
8594 }
8595
8596 static void GLAPIENTRY
8597 save_ProgramUniform1fv(GLuint program, GLint location, GLsizei count,
8598 const GLfloat *v)
8599 {
8600 GET_CURRENT_CONTEXT(ctx);
8601 Node *n;
8602 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8603 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1FV, 3 + POINTER_DWORDS);
8604 if (n) {
8605 n[1].ui = program;
8606 n[2].i = location;
8607 n[3].i = count;
8608 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLfloat)));
8609 }
8610 if (ctx->ExecuteFlag) {
8611 CALL_ProgramUniform1fv(ctx->Exec, (program, location, count, v));
8612 }
8613 }
8614
8615 static void GLAPIENTRY
8616 save_ProgramUniform2fv(GLuint program, GLint location, GLsizei count,
8617 const GLfloat *v)
8618 {
8619 GET_CURRENT_CONTEXT(ctx);
8620 Node *n;
8621 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8622 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2FV, 3 + POINTER_DWORDS);
8623 if (n) {
8624 n[1].ui = program;
8625 n[2].i = location;
8626 n[3].i = count;
8627 save_pointer(&n[4], memdup(v, count * 2 * sizeof(GLfloat)));
8628 }
8629 if (ctx->ExecuteFlag) {
8630 CALL_ProgramUniform2fv(ctx->Exec, (program, location, count, v));
8631 }
8632 }
8633
8634 static void GLAPIENTRY
8635 save_ProgramUniform3fv(GLuint program, GLint location, GLsizei count,
8636 const GLfloat *v)
8637 {
8638 GET_CURRENT_CONTEXT(ctx);
8639 Node *n;
8640 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8641 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3FV, 3 + POINTER_DWORDS);
8642 if (n) {
8643 n[1].ui = program;
8644 n[2].i = location;
8645 n[3].i = count;
8646 save_pointer(&n[4], memdup(v, count * 3 * sizeof(GLfloat)));
8647 }
8648 if (ctx->ExecuteFlag) {
8649 CALL_ProgramUniform3fv(ctx->Exec, (program, location, count, v));
8650 }
8651 }
8652
8653 static void GLAPIENTRY
8654 save_ProgramUniform4fv(GLuint program, GLint location, GLsizei count,
8655 const GLfloat *v)
8656 {
8657 GET_CURRENT_CONTEXT(ctx);
8658 Node *n;
8659 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8660 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4FV, 3 + POINTER_DWORDS);
8661 if (n) {
8662 n[1].ui = program;
8663 n[2].i = location;
8664 n[3].i = count;
8665 save_pointer(&n[4], memdup(v, count * 4 * sizeof(GLfloat)));
8666 }
8667 if (ctx->ExecuteFlag) {
8668 CALL_ProgramUniform4fv(ctx->Exec, (program, location, count, v));
8669 }
8670 }
8671
8672 static void GLAPIENTRY
8673 save_ProgramUniform1d(GLuint program, GLint location, GLdouble x)
8674 {
8675 GET_CURRENT_CONTEXT(ctx);
8676 Node *n;
8677 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8678 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1D, 4);
8679 if (n) {
8680 n[1].ui = program;
8681 n[2].i = location;
8682 ASSIGN_DOUBLE_TO_NODES(n, 3, x);
8683 }
8684 if (ctx->ExecuteFlag) {
8685 CALL_ProgramUniform1d(ctx->Exec, (program, location, x));
8686 }
8687 }
8688
8689 static void GLAPIENTRY
8690 save_ProgramUniform2d(GLuint program, GLint location, GLdouble x, GLdouble y)
8691 {
8692 GET_CURRENT_CONTEXT(ctx);
8693 Node *n;
8694 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8695 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2D, 6);
8696 if (n) {
8697 n[1].ui = program;
8698 n[2].i = location;
8699 ASSIGN_DOUBLE_TO_NODES(n, 3, x);
8700 ASSIGN_DOUBLE_TO_NODES(n, 5, y);
8701 }
8702 if (ctx->ExecuteFlag) {
8703 CALL_ProgramUniform2d(ctx->Exec, (program, location, x, y));
8704 }
8705 }
8706
8707 static void GLAPIENTRY
8708 save_ProgramUniform3d(GLuint program, GLint location,
8709 GLdouble x, GLdouble y, GLdouble z)
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_3D, 8);
8715 if (n) {
8716 n[1].ui = program;
8717 n[2].i = location;
8718 ASSIGN_DOUBLE_TO_NODES(n, 3, x);
8719 ASSIGN_DOUBLE_TO_NODES(n, 5, y);
8720 ASSIGN_DOUBLE_TO_NODES(n, 7, z);
8721 }
8722 if (ctx->ExecuteFlag) {
8723 CALL_ProgramUniform3d(ctx->Exec, (program, location, x, y, z));
8724 }
8725 }
8726
8727 static void GLAPIENTRY
8728 save_ProgramUniform4d(GLuint program, GLint location,
8729 GLdouble x, GLdouble y, GLdouble z, GLdouble w)
8730 {
8731 GET_CURRENT_CONTEXT(ctx);
8732 Node *n;
8733 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8734 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4D, 10);
8735 if (n) {
8736 n[1].ui = program;
8737 n[2].i = location;
8738 ASSIGN_DOUBLE_TO_NODES(n, 3, x);
8739 ASSIGN_DOUBLE_TO_NODES(n, 5, y);
8740 ASSIGN_DOUBLE_TO_NODES(n, 7, z);
8741 ASSIGN_DOUBLE_TO_NODES(n, 9, w);
8742 }
8743 if (ctx->ExecuteFlag) {
8744 CALL_ProgramUniform4d(ctx->Exec, (program, location, x, y, z, w));
8745 }
8746 }
8747
8748 static void GLAPIENTRY
8749 save_ProgramUniform1dv(GLuint program, GLint location, GLsizei count,
8750 const GLdouble *v)
8751 {
8752 GET_CURRENT_CONTEXT(ctx);
8753 Node *n;
8754 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8755 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1DV, 3 + POINTER_DWORDS);
8756 if (n) {
8757 n[1].ui = program;
8758 n[2].i = location;
8759 n[3].i = count;
8760 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLdouble)));
8761 }
8762 if (ctx->ExecuteFlag) {
8763 CALL_ProgramUniform1dv(ctx->Exec, (program, location, count, v));
8764 }
8765 }
8766
8767 static void GLAPIENTRY
8768 save_ProgramUniform2dv(GLuint program, GLint location, GLsizei count,
8769 const GLdouble *v)
8770 {
8771 GET_CURRENT_CONTEXT(ctx);
8772 Node *n;
8773 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8774 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2DV, 3 + POINTER_DWORDS);
8775 if (n) {
8776 n[1].ui = program;
8777 n[2].i = location;
8778 n[3].i = count;
8779 save_pointer(&n[4], memdup(v, count * 2 * sizeof(GLdouble)));
8780 }
8781 if (ctx->ExecuteFlag) {
8782 CALL_ProgramUniform2dv(ctx->Exec, (program, location, count, v));
8783 }
8784 }
8785
8786 static void GLAPIENTRY
8787 save_ProgramUniform3dv(GLuint program, GLint location, GLsizei count,
8788 const GLdouble *v)
8789 {
8790 GET_CURRENT_CONTEXT(ctx);
8791 Node *n;
8792 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8793 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3DV, 3 + POINTER_DWORDS);
8794 if (n) {
8795 n[1].ui = program;
8796 n[2].i = location;
8797 n[3].i = count;
8798 save_pointer(&n[4], memdup(v, count * 3 * sizeof(GLdouble)));
8799 }
8800 if (ctx->ExecuteFlag) {
8801 CALL_ProgramUniform3dv(ctx->Exec, (program, location, count, v));
8802 }
8803 }
8804
8805 static void GLAPIENTRY
8806 save_ProgramUniform4dv(GLuint program, GLint location, GLsizei count,
8807 const GLdouble *v)
8808 {
8809 GET_CURRENT_CONTEXT(ctx);
8810 Node *n;
8811 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8812 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4DV, 3 + POINTER_DWORDS);
8813 if (n) {
8814 n[1].ui = program;
8815 n[2].i = location;
8816 n[3].i = count;
8817 save_pointer(&n[4], memdup(v, count * 4 * sizeof(GLdouble)));
8818 }
8819 if (ctx->ExecuteFlag) {
8820 CALL_ProgramUniform4dv(ctx->Exec, (program, location, count, v));
8821 }
8822 }
8823
8824 static void GLAPIENTRY
8825 save_ProgramUniform1i(GLuint program, GLint location, GLint x)
8826 {
8827 GET_CURRENT_CONTEXT(ctx);
8828 Node *n;
8829 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8830 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1I, 3);
8831 if (n) {
8832 n[1].ui = program;
8833 n[2].i = location;
8834 n[3].i = x;
8835 }
8836 if (ctx->ExecuteFlag) {
8837 CALL_ProgramUniform1i(ctx->Exec, (program, location, x));
8838 }
8839 }
8840
8841 static void GLAPIENTRY
8842 save_ProgramUniform2i(GLuint program, GLint location, GLint x, GLint y)
8843 {
8844 GET_CURRENT_CONTEXT(ctx);
8845 Node *n;
8846 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8847 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2I, 4);
8848 if (n) {
8849 n[1].ui = program;
8850 n[2].i = location;
8851 n[3].i = x;
8852 n[4].i = y;
8853 }
8854 if (ctx->ExecuteFlag) {
8855 CALL_ProgramUniform2i(ctx->Exec, (program, location, x, y));
8856 }
8857 }
8858
8859 static void GLAPIENTRY
8860 save_ProgramUniform3i(GLuint program, GLint location,
8861 GLint x, GLint y, GLint z)
8862 {
8863 GET_CURRENT_CONTEXT(ctx);
8864 Node *n;
8865 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8866 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3I, 5);
8867 if (n) {
8868 n[1].ui = program;
8869 n[2].i = location;
8870 n[3].i = x;
8871 n[4].i = y;
8872 n[5].i = z;
8873 }
8874 if (ctx->ExecuteFlag) {
8875 CALL_ProgramUniform3i(ctx->Exec, (program, location, x, y, z));
8876 }
8877 }
8878
8879 static void GLAPIENTRY
8880 save_ProgramUniform4i(GLuint program, GLint location,
8881 GLint x, GLint y, GLint z, GLint w)
8882 {
8883 GET_CURRENT_CONTEXT(ctx);
8884 Node *n;
8885 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8886 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4I, 6);
8887 if (n) {
8888 n[1].ui = program;
8889 n[2].i = location;
8890 n[3].i = x;
8891 n[4].i = y;
8892 n[5].i = z;
8893 n[6].i = w;
8894 }
8895 if (ctx->ExecuteFlag) {
8896 CALL_ProgramUniform4i(ctx->Exec, (program, location, x, y, z, w));
8897 }
8898 }
8899
8900 static void GLAPIENTRY
8901 save_ProgramUniform1iv(GLuint program, GLint location, GLsizei count,
8902 const GLint *v)
8903 {
8904 GET_CURRENT_CONTEXT(ctx);
8905 Node *n;
8906 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8907 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1IV, 3 + POINTER_DWORDS);
8908 if (n) {
8909 n[1].ui = program;
8910 n[2].i = location;
8911 n[3].i = count;
8912 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLint)));
8913 }
8914 if (ctx->ExecuteFlag) {
8915 CALL_ProgramUniform1iv(ctx->Exec, (program, location, count, v));
8916 }
8917 }
8918
8919 static void GLAPIENTRY
8920 save_ProgramUniform2iv(GLuint program, GLint location, GLsizei count,
8921 const GLint *v)
8922 {
8923 GET_CURRENT_CONTEXT(ctx);
8924 Node *n;
8925 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8926 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2IV, 3 + POINTER_DWORDS);
8927 if (n) {
8928 n[1].ui = program;
8929 n[2].i = location;
8930 n[3].i = count;
8931 save_pointer(&n[4], memdup(v, count * 2 * sizeof(GLint)));
8932 }
8933 if (ctx->ExecuteFlag) {
8934 CALL_ProgramUniform2iv(ctx->Exec, (program, location, count, v));
8935 }
8936 }
8937
8938 static void GLAPIENTRY
8939 save_ProgramUniform3iv(GLuint program, GLint location, GLsizei count,
8940 const GLint *v)
8941 {
8942 GET_CURRENT_CONTEXT(ctx);
8943 Node *n;
8944 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8945 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3IV, 3 + POINTER_DWORDS);
8946 if (n) {
8947 n[1].ui = program;
8948 n[2].i = location;
8949 n[3].i = count;
8950 save_pointer(&n[4], memdup(v, count * 3 * sizeof(GLint)));
8951 }
8952 if (ctx->ExecuteFlag) {
8953 CALL_ProgramUniform3iv(ctx->Exec, (program, location, count, v));
8954 }
8955 }
8956
8957 static void GLAPIENTRY
8958 save_ProgramUniform4iv(GLuint program, GLint location, GLsizei count,
8959 const GLint *v)
8960 {
8961 GET_CURRENT_CONTEXT(ctx);
8962 Node *n;
8963 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8964 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4IV, 3 + POINTER_DWORDS);
8965 if (n) {
8966 n[1].ui = program;
8967 n[2].i = location;
8968 n[3].i = count;
8969 save_pointer(&n[4], memdup(v, count * 4 * sizeof(GLint)));
8970 }
8971 if (ctx->ExecuteFlag) {
8972 CALL_ProgramUniform4iv(ctx->Exec, (program, location, count, v));
8973 }
8974 }
8975
8976 static void GLAPIENTRY
8977 save_ProgramUniform1ui(GLuint program, GLint location, GLuint x)
8978 {
8979 GET_CURRENT_CONTEXT(ctx);
8980 Node *n;
8981 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8982 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1UI, 3);
8983 if (n) {
8984 n[1].ui = program;
8985 n[2].i = location;
8986 n[3].ui = x;
8987 }
8988 if (ctx->ExecuteFlag) {
8989 CALL_ProgramUniform1ui(ctx->Exec, (program, location, x));
8990 }
8991 }
8992
8993 static void GLAPIENTRY
8994 save_ProgramUniform2ui(GLuint program, GLint location, GLuint x, GLuint y)
8995 {
8996 GET_CURRENT_CONTEXT(ctx);
8997 Node *n;
8998 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8999 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2UI, 4);
9000 if (n) {
9001 n[1].ui = program;
9002 n[2].i = location;
9003 n[3].ui = x;
9004 n[4].ui = y;
9005 }
9006 if (ctx->ExecuteFlag) {
9007 CALL_ProgramUniform2ui(ctx->Exec, (program, location, x, y));
9008 }
9009 }
9010
9011 static void GLAPIENTRY
9012 save_ProgramUniform3ui(GLuint program, GLint location,
9013 GLuint x, GLuint y, GLuint z)
9014 {
9015 GET_CURRENT_CONTEXT(ctx);
9016 Node *n;
9017 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9018 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3UI, 5);
9019 if (n) {
9020 n[1].ui = program;
9021 n[2].i = location;
9022 n[3].ui = x;
9023 n[4].ui = y;
9024 n[5].ui = z;
9025 }
9026 if (ctx->ExecuteFlag) {
9027 CALL_ProgramUniform3ui(ctx->Exec, (program, location, x, y, z));
9028 }
9029 }
9030
9031 static void GLAPIENTRY
9032 save_ProgramUniform4ui(GLuint program, GLint location,
9033 GLuint x, GLuint y, GLuint z, GLuint w)
9034 {
9035 GET_CURRENT_CONTEXT(ctx);
9036 Node *n;
9037 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9038 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4UI, 6);
9039 if (n) {
9040 n[1].ui = program;
9041 n[2].i = location;
9042 n[3].ui = x;
9043 n[4].ui = y;
9044 n[5].ui = z;
9045 n[6].ui = w;
9046 }
9047 if (ctx->ExecuteFlag) {
9048 CALL_ProgramUniform4ui(ctx->Exec, (program, location, x, y, z, w));
9049 }
9050 }
9051
9052 static void GLAPIENTRY
9053 save_ProgramUniform1uiv(GLuint program, GLint location, GLsizei count,
9054 const GLuint *v)
9055 {
9056 GET_CURRENT_CONTEXT(ctx);
9057 Node *n;
9058 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9059 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1UIV, 3 + POINTER_DWORDS);
9060 if (n) {
9061 n[1].ui = program;
9062 n[2].i = location;
9063 n[3].i = count;
9064 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLuint)));
9065 }
9066 if (ctx->ExecuteFlag) {
9067 CALL_ProgramUniform1uiv(ctx->Exec, (program, location, count, v));
9068 }
9069 }
9070
9071 static void GLAPIENTRY
9072 save_ProgramUniform2uiv(GLuint program, GLint location, GLsizei count,
9073 const GLuint *v)
9074 {
9075 GET_CURRENT_CONTEXT(ctx);
9076 Node *n;
9077 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9078 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2UIV, 3 + POINTER_DWORDS);
9079 if (n) {
9080 n[1].ui = program;
9081 n[2].i = location;
9082 n[3].i = count;
9083 save_pointer(&n[4], memdup(v, count * 2 * sizeof(GLuint)));
9084 }
9085 if (ctx->ExecuteFlag) {
9086 CALL_ProgramUniform2uiv(ctx->Exec, (program, location, count, v));
9087 }
9088 }
9089
9090 static void GLAPIENTRY
9091 save_ProgramUniform3uiv(GLuint program, GLint location, GLsizei count,
9092 const GLuint *v)
9093 {
9094 GET_CURRENT_CONTEXT(ctx);
9095 Node *n;
9096 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9097 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3UIV, 3 + POINTER_DWORDS);
9098 if (n) {
9099 n[1].ui = program;
9100 n[2].i = location;
9101 n[3].i = count;
9102 save_pointer(&n[4], memdup(v, count * 3 * sizeof(GLuint)));
9103 }
9104 if (ctx->ExecuteFlag) {
9105 CALL_ProgramUniform3uiv(ctx->Exec, (program, location, count, v));
9106 }
9107 }
9108
9109 static void GLAPIENTRY
9110 save_ProgramUniform4uiv(GLuint program, GLint location, GLsizei count,
9111 const GLuint *v)
9112 {
9113 GET_CURRENT_CONTEXT(ctx);
9114 Node *n;
9115 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9116 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4UIV, 3 + POINTER_DWORDS);
9117 if (n) {
9118 n[1].ui = program;
9119 n[2].i = location;
9120 n[3].i = count;
9121 save_pointer(&n[4], memdup(v, count * 4 * sizeof(GLuint)));
9122 }
9123 if (ctx->ExecuteFlag) {
9124 CALL_ProgramUniform4uiv(ctx->Exec, (program, location, count, v));
9125 }
9126 }
9127
9128 static void GLAPIENTRY
9129 save_ProgramUniformMatrix2fv(GLuint program, GLint location, GLsizei count,
9130 GLboolean transpose, const GLfloat *v)
9131 {
9132 GET_CURRENT_CONTEXT(ctx);
9133 Node *n;
9134 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9135 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX22F,
9136 4 + POINTER_DWORDS);
9137 if (n) {
9138 n[1].ui = program;
9139 n[2].i = location;
9140 n[3].i = count;
9141 n[4].b = transpose;
9142 save_pointer(&n[5], memdup(v, count * 2 * 2 * sizeof(GLfloat)));
9143 }
9144 if (ctx->ExecuteFlag) {
9145 CALL_ProgramUniformMatrix2fv(ctx->Exec,
9146 (program, location, count, transpose, v));
9147 }
9148 }
9149
9150 static void GLAPIENTRY
9151 save_ProgramUniformMatrix2x3fv(GLuint program, GLint location, GLsizei count,
9152 GLboolean transpose, const GLfloat *v)
9153 {
9154 GET_CURRENT_CONTEXT(ctx);
9155 Node *n;
9156 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9157 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX23F,
9158 4 + POINTER_DWORDS);
9159 if (n) {
9160 n[1].ui = program;
9161 n[2].i = location;
9162 n[3].i = count;
9163 n[4].b = transpose;
9164 save_pointer(&n[5], memdup(v, count * 2 * 3 * sizeof(GLfloat)));
9165 }
9166 if (ctx->ExecuteFlag) {
9167 CALL_ProgramUniformMatrix2x3fv(ctx->Exec,
9168 (program, location, count, transpose, v));
9169 }
9170 }
9171
9172 static void GLAPIENTRY
9173 save_ProgramUniformMatrix2x4fv(GLuint program, GLint location, GLsizei count,
9174 GLboolean transpose, const GLfloat *v)
9175 {
9176 GET_CURRENT_CONTEXT(ctx);
9177 Node *n;
9178 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9179 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX24F,
9180 4 + POINTER_DWORDS);
9181 if (n) {
9182 n[1].ui = program;
9183 n[2].i = location;
9184 n[3].i = count;
9185 n[4].b = transpose;
9186 save_pointer(&n[5], memdup(v, count * 2 * 4 * sizeof(GLfloat)));
9187 }
9188 if (ctx->ExecuteFlag) {
9189 CALL_ProgramUniformMatrix2x4fv(ctx->Exec,
9190 (program, location, count, transpose, v));
9191 }
9192 }
9193
9194 static void GLAPIENTRY
9195 save_ProgramUniformMatrix3x2fv(GLuint program, GLint location, GLsizei count,
9196 GLboolean transpose, const GLfloat *v)
9197 {
9198 GET_CURRENT_CONTEXT(ctx);
9199 Node *n;
9200 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9201 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX32F,
9202 4 + POINTER_DWORDS);
9203 if (n) {
9204 n[1].ui = program;
9205 n[2].i = location;
9206 n[3].i = count;
9207 n[4].b = transpose;
9208 save_pointer(&n[5], memdup(v, count * 3 * 2 * sizeof(GLfloat)));
9209 }
9210 if (ctx->ExecuteFlag) {
9211 CALL_ProgramUniformMatrix3x2fv(ctx->Exec,
9212 (program, location, count, transpose, v));
9213 }
9214 }
9215
9216 static void GLAPIENTRY
9217 save_ProgramUniformMatrix3fv(GLuint program, GLint location, GLsizei count,
9218 GLboolean transpose, const GLfloat *v)
9219 {
9220 GET_CURRENT_CONTEXT(ctx);
9221 Node *n;
9222 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9223 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX33F,
9224 4 + POINTER_DWORDS);
9225 if (n) {
9226 n[1].ui = program;
9227 n[2].i = location;
9228 n[3].i = count;
9229 n[4].b = transpose;
9230 save_pointer(&n[5], memdup(v, count * 3 * 3 * sizeof(GLfloat)));
9231 }
9232 if (ctx->ExecuteFlag) {
9233 CALL_ProgramUniformMatrix3fv(ctx->Exec,
9234 (program, location, count, transpose, v));
9235 }
9236 }
9237
9238 static void GLAPIENTRY
9239 save_ProgramUniformMatrix3x4fv(GLuint program, GLint location, GLsizei count,
9240 GLboolean transpose, const GLfloat *v)
9241 {
9242 GET_CURRENT_CONTEXT(ctx);
9243 Node *n;
9244 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9245 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX34F,
9246 4 + POINTER_DWORDS);
9247 if (n) {
9248 n[1].ui = program;
9249 n[2].i = location;
9250 n[3].i = count;
9251 n[4].b = transpose;
9252 save_pointer(&n[5], memdup(v, count * 3 * 4 * sizeof(GLfloat)));
9253 }
9254 if (ctx->ExecuteFlag) {
9255 CALL_ProgramUniformMatrix3x4fv(ctx->Exec,
9256 (program, location, count, transpose, v));
9257 }
9258 }
9259
9260 static void GLAPIENTRY
9261 save_ProgramUniformMatrix4x2fv(GLuint program, GLint location, GLsizei count,
9262 GLboolean transpose, const GLfloat *v)
9263 {
9264 GET_CURRENT_CONTEXT(ctx);
9265 Node *n;
9266 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9267 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX42F,
9268 4 + POINTER_DWORDS);
9269 if (n) {
9270 n[1].ui = program;
9271 n[2].i = location;
9272 n[3].i = count;
9273 n[4].b = transpose;
9274 save_pointer(&n[5], memdup(v, count * 4 * 2 * sizeof(GLfloat)));
9275 }
9276 if (ctx->ExecuteFlag) {
9277 CALL_ProgramUniformMatrix4x2fv(ctx->Exec,
9278 (program, location, count, transpose, v));
9279 }
9280 }
9281
9282 static void GLAPIENTRY
9283 save_ProgramUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count,
9284 GLboolean transpose, const GLfloat *v)
9285 {
9286 GET_CURRENT_CONTEXT(ctx);
9287 Node *n;
9288 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9289 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX43F,
9290 4 + POINTER_DWORDS);
9291 if (n) {
9292 n[1].ui = program;
9293 n[2].i = location;
9294 n[3].i = count;
9295 n[4].b = transpose;
9296 save_pointer(&n[5], memdup(v, count * 4 * 3 * sizeof(GLfloat)));
9297 }
9298 if (ctx->ExecuteFlag) {
9299 CALL_ProgramUniformMatrix4x3fv(ctx->Exec,
9300 (program, location, count, transpose, v));
9301 }
9302 }
9303
9304 static void GLAPIENTRY
9305 save_ProgramUniformMatrix4fv(GLuint program, GLint location, GLsizei count,
9306 GLboolean transpose, const GLfloat *v)
9307 {
9308 GET_CURRENT_CONTEXT(ctx);
9309 Node *n;
9310 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9311 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX44F,
9312 4 + POINTER_DWORDS);
9313 if (n) {
9314 n[1].ui = program;
9315 n[2].i = location;
9316 n[3].i = count;
9317 n[4].b = transpose;
9318 save_pointer(&n[5], memdup(v, count * 4 * 4 * sizeof(GLfloat)));
9319 }
9320 if (ctx->ExecuteFlag) {
9321 CALL_ProgramUniformMatrix4fv(ctx->Exec,
9322 (program, location, count, transpose, v));
9323 }
9324 }
9325
9326 static void GLAPIENTRY
9327 save_ProgramUniformMatrix2dv(GLuint program, GLint location, GLsizei count,
9328 GLboolean transpose, const GLdouble *v)
9329 {
9330 GET_CURRENT_CONTEXT(ctx);
9331 Node *n;
9332 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9333 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX22D,
9334 4 + POINTER_DWORDS);
9335 if (n) {
9336 n[1].ui = program;
9337 n[2].i = location;
9338 n[3].i = count;
9339 n[4].b = transpose;
9340 save_pointer(&n[5], memdup(v, count * 2 * 2 * sizeof(GLdouble)));
9341 }
9342 if (ctx->ExecuteFlag) {
9343 CALL_ProgramUniformMatrix2dv(ctx->Exec,
9344 (program, location, count, transpose, v));
9345 }
9346 }
9347
9348 static void GLAPIENTRY
9349 save_ProgramUniformMatrix2x3dv(GLuint program, GLint location, GLsizei count,
9350 GLboolean transpose, const GLdouble *v)
9351 {
9352 GET_CURRENT_CONTEXT(ctx);
9353 Node *n;
9354 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9355 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX23D,
9356 4 + POINTER_DWORDS);
9357 if (n) {
9358 n[1].ui = program;
9359 n[2].i = location;
9360 n[3].i = count;
9361 n[4].b = transpose;
9362 save_pointer(&n[5], memdup(v, count * 2 * 3 * sizeof(GLdouble)));
9363 }
9364 if (ctx->ExecuteFlag) {
9365 CALL_ProgramUniformMatrix2x3dv(ctx->Exec,
9366 (program, location, count, transpose, v));
9367 }
9368 }
9369
9370 static void GLAPIENTRY
9371 save_ProgramUniformMatrix2x4dv(GLuint program, GLint location, GLsizei count,
9372 GLboolean transpose, const GLdouble *v)
9373 {
9374 GET_CURRENT_CONTEXT(ctx);
9375 Node *n;
9376 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9377 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX24D,
9378 4 + POINTER_DWORDS);
9379 if (n) {
9380 n[1].ui = program;
9381 n[2].i = location;
9382 n[3].i = count;
9383 n[4].b = transpose;
9384 save_pointer(&n[5], memdup(v, count * 2 * 4 * sizeof(GLdouble)));
9385 }
9386 if (ctx->ExecuteFlag) {
9387 CALL_ProgramUniformMatrix2x4dv(ctx->Exec,
9388 (program, location, count, transpose, v));
9389 }
9390 }
9391
9392 static void GLAPIENTRY
9393 save_ProgramUniformMatrix3x2dv(GLuint program, GLint location, GLsizei count,
9394 GLboolean transpose, const GLdouble *v)
9395 {
9396 GET_CURRENT_CONTEXT(ctx);
9397 Node *n;
9398 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9399 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX32D,
9400 4 + POINTER_DWORDS);
9401 if (n) {
9402 n[1].ui = program;
9403 n[2].i = location;
9404 n[3].i = count;
9405 n[4].b = transpose;
9406 save_pointer(&n[5], memdup(v, count * 3 * 2 * sizeof(GLdouble)));
9407 }
9408 if (ctx->ExecuteFlag) {
9409 CALL_ProgramUniformMatrix3x2dv(ctx->Exec,
9410 (program, location, count, transpose, v));
9411 }
9412 }
9413
9414 static void GLAPIENTRY
9415 save_ProgramUniformMatrix3dv(GLuint program, GLint location, GLsizei count,
9416 GLboolean transpose, const GLdouble *v)
9417 {
9418 GET_CURRENT_CONTEXT(ctx);
9419 Node *n;
9420 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9421 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX33D,
9422 4 + POINTER_DWORDS);
9423 if (n) {
9424 n[1].ui = program;
9425 n[2].i = location;
9426 n[3].i = count;
9427 n[4].b = transpose;
9428 save_pointer(&n[5], memdup(v, count * 3 * 3 * sizeof(GLdouble)));
9429 }
9430 if (ctx->ExecuteFlag) {
9431 CALL_ProgramUniformMatrix3dv(ctx->Exec,
9432 (program, location, count, transpose, v));
9433 }
9434 }
9435
9436 static void GLAPIENTRY
9437 save_ProgramUniformMatrix3x4dv(GLuint program, GLint location, GLsizei count,
9438 GLboolean transpose, const GLdouble *v)
9439 {
9440 GET_CURRENT_CONTEXT(ctx);
9441 Node *n;
9442 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9443 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX34D,
9444 4 + POINTER_DWORDS);
9445 if (n) {
9446 n[1].ui = program;
9447 n[2].i = location;
9448 n[3].i = count;
9449 n[4].b = transpose;
9450 save_pointer(&n[5], memdup(v, count * 3 * 4 * sizeof(GLdouble)));
9451 }
9452 if (ctx->ExecuteFlag) {
9453 CALL_ProgramUniformMatrix3x4dv(ctx->Exec,
9454 (program, location, count, transpose, v));
9455 }
9456 }
9457
9458 static void GLAPIENTRY
9459 save_ProgramUniformMatrix4x2dv(GLuint program, GLint location, GLsizei count,
9460 GLboolean transpose, const GLdouble *v)
9461 {
9462 GET_CURRENT_CONTEXT(ctx);
9463 Node *n;
9464 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9465 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX42D,
9466 4 + POINTER_DWORDS);
9467 if (n) {
9468 n[1].ui = program;
9469 n[2].i = location;
9470 n[3].i = count;
9471 n[4].b = transpose;
9472 save_pointer(&n[5], memdup(v, count * 4 * 2 * sizeof(GLdouble)));
9473 }
9474 if (ctx->ExecuteFlag) {
9475 CALL_ProgramUniformMatrix4x2dv(ctx->Exec,
9476 (program, location, count, transpose, v));
9477 }
9478 }
9479
9480 static void GLAPIENTRY
9481 save_ProgramUniformMatrix4x3dv(GLuint program, GLint location, GLsizei count,
9482 GLboolean transpose, const GLdouble *v)
9483 {
9484 GET_CURRENT_CONTEXT(ctx);
9485 Node *n;
9486 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9487 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX43D,
9488 4 + POINTER_DWORDS);
9489 if (n) {
9490 n[1].ui = program;
9491 n[2].i = location;
9492 n[3].i = count;
9493 n[4].b = transpose;
9494 save_pointer(&n[5], memdup(v, count * 4 * 3 * sizeof(GLdouble)));
9495 }
9496 if (ctx->ExecuteFlag) {
9497 CALL_ProgramUniformMatrix4x3dv(ctx->Exec,
9498 (program, location, count, transpose, v));
9499 }
9500 }
9501
9502 static void GLAPIENTRY
9503 save_ProgramUniformMatrix4dv(GLuint program, GLint location, GLsizei count,
9504 GLboolean transpose, const GLdouble *v)
9505 {
9506 GET_CURRENT_CONTEXT(ctx);
9507 Node *n;
9508 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9509 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX44D,
9510 4 + POINTER_DWORDS);
9511 if (n) {
9512 n[1].ui = program;
9513 n[2].i = location;
9514 n[3].i = count;
9515 n[4].b = transpose;
9516 save_pointer(&n[5], memdup(v, count * 4 * 4 * sizeof(GLdouble)));
9517 }
9518 if (ctx->ExecuteFlag) {
9519 CALL_ProgramUniformMatrix4dv(ctx->Exec,
9520 (program, location, count, transpose, v));
9521 }
9522 }
9523
9524 static void GLAPIENTRY
9525 save_ClipControl(GLenum origin, GLenum depth)
9526 {
9527 GET_CURRENT_CONTEXT(ctx);
9528 Node *n;
9529 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9530 n = alloc_instruction(ctx, OPCODE_CLIP_CONTROL, 2);
9531 if (n) {
9532 n[1].e = origin;
9533 n[2].e = depth;
9534 }
9535 if (ctx->ExecuteFlag) {
9536 CALL_ClipControl(ctx->Exec, (origin, depth));
9537 }
9538 }
9539
9540 static void GLAPIENTRY
9541 save_ClampColorARB(GLenum target, GLenum clamp)
9542 {
9543 GET_CURRENT_CONTEXT(ctx);
9544 Node *n;
9545 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9546 n = alloc_instruction(ctx, OPCODE_CLAMP_COLOR, 2);
9547 if (n) {
9548 n[1].e = target;
9549 n[2].e = clamp;
9550 }
9551 if (ctx->ExecuteFlag) {
9552 CALL_ClampColor(ctx->Exec, (target, clamp));
9553 }
9554 }
9555
9556 /** GL_EXT_texture_integer */
9557 static void GLAPIENTRY
9558 save_ClearColorIi(GLint red, GLint green, GLint blue, GLint alpha)
9559 {
9560 GET_CURRENT_CONTEXT(ctx);
9561 Node *n;
9562 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9563 n = alloc_instruction(ctx, OPCODE_CLEARCOLOR_I, 4);
9564 if (n) {
9565 n[1].i = red;
9566 n[2].i = green;
9567 n[3].i = blue;
9568 n[4].i = alpha;
9569 }
9570 if (ctx->ExecuteFlag) {
9571 CALL_ClearColorIiEXT(ctx->Exec, (red, green, blue, alpha));
9572 }
9573 }
9574
9575 /** GL_EXT_texture_integer */
9576 static void GLAPIENTRY
9577 save_ClearColorIui(GLuint red, GLuint green, GLuint blue, GLuint alpha)
9578 {
9579 GET_CURRENT_CONTEXT(ctx);
9580 Node *n;
9581 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9582 n = alloc_instruction(ctx, OPCODE_CLEARCOLOR_UI, 4);
9583 if (n) {
9584 n[1].ui = red;
9585 n[2].ui = green;
9586 n[3].ui = blue;
9587 n[4].ui = alpha;
9588 }
9589 if (ctx->ExecuteFlag) {
9590 CALL_ClearColorIuiEXT(ctx->Exec, (red, green, blue, alpha));
9591 }
9592 }
9593
9594 /** GL_EXT_texture_integer */
9595 static void GLAPIENTRY
9596 save_TexParameterIiv(GLenum target, GLenum pname, const GLint *params)
9597 {
9598 GET_CURRENT_CONTEXT(ctx);
9599 Node *n;
9600 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9601 n = alloc_instruction(ctx, OPCODE_TEXPARAMETER_I, 6);
9602 if (n) {
9603 n[1].e = target;
9604 n[2].e = pname;
9605 n[3].i = params[0];
9606 n[4].i = params[1];
9607 n[5].i = params[2];
9608 n[6].i = params[3];
9609 }
9610 if (ctx->ExecuteFlag) {
9611 CALL_TexParameterIiv(ctx->Exec, (target, pname, params));
9612 }
9613 }
9614
9615 /** GL_EXT_texture_integer */
9616 static void GLAPIENTRY
9617 save_TexParameterIuiv(GLenum target, GLenum pname, const GLuint *params)
9618 {
9619 GET_CURRENT_CONTEXT(ctx);
9620 Node *n;
9621 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9622 n = alloc_instruction(ctx, OPCODE_TEXPARAMETER_UI, 6);
9623 if (n) {
9624 n[1].e = target;
9625 n[2].e = pname;
9626 n[3].ui = params[0];
9627 n[4].ui = params[1];
9628 n[5].ui = params[2];
9629 n[6].ui = params[3];
9630 }
9631 if (ctx->ExecuteFlag) {
9632 CALL_TexParameterIuiv(ctx->Exec, (target, pname, params));
9633 }
9634 }
9635
9636 /* GL_ARB_instanced_arrays */
9637 static void GLAPIENTRY
9638 save_VertexAttribDivisor(GLuint index, GLuint divisor)
9639 {
9640 GET_CURRENT_CONTEXT(ctx);
9641 Node *n;
9642 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9643 n = alloc_instruction(ctx, OPCODE_VERTEX_ATTRIB_DIVISOR, 2);
9644 if (n) {
9645 n[1].ui = index;
9646 n[2].ui = divisor;
9647 }
9648 if (ctx->ExecuteFlag) {
9649 CALL_VertexAttribDivisor(ctx->Exec, (index, divisor));
9650 }
9651 }
9652
9653
9654 /* GL_NV_texture_barrier */
9655 static void GLAPIENTRY
9656 save_TextureBarrierNV(void)
9657 {
9658 GET_CURRENT_CONTEXT(ctx);
9659 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9660 alloc_instruction(ctx, OPCODE_TEXTURE_BARRIER_NV, 0);
9661 if (ctx->ExecuteFlag) {
9662 CALL_TextureBarrierNV(ctx->Exec, ());
9663 }
9664 }
9665
9666
9667 /* GL_ARB_sampler_objects */
9668 static void GLAPIENTRY
9669 save_BindSampler(GLuint unit, GLuint sampler)
9670 {
9671 Node *n;
9672 GET_CURRENT_CONTEXT(ctx);
9673 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9674 n = alloc_instruction(ctx, OPCODE_BIND_SAMPLER, 2);
9675 if (n) {
9676 n[1].ui = unit;
9677 n[2].ui = sampler;
9678 }
9679 if (ctx->ExecuteFlag) {
9680 CALL_BindSampler(ctx->Exec, (unit, sampler));
9681 }
9682 }
9683
9684 static void GLAPIENTRY
9685 save_SamplerParameteriv(GLuint sampler, GLenum pname, const GLint *params)
9686 {
9687 Node *n;
9688 GET_CURRENT_CONTEXT(ctx);
9689 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9690 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERIV, 6);
9691 if (n) {
9692 n[1].ui = sampler;
9693 n[2].e = pname;
9694 n[3].i = params[0];
9695 if (pname == GL_TEXTURE_BORDER_COLOR) {
9696 n[4].i = params[1];
9697 n[5].i = params[2];
9698 n[6].i = params[3];
9699 }
9700 else {
9701 n[4].i = n[5].i = n[6].i = 0;
9702 }
9703 }
9704 if (ctx->ExecuteFlag) {
9705 CALL_SamplerParameteriv(ctx->Exec, (sampler, pname, params));
9706 }
9707 }
9708
9709 static void GLAPIENTRY
9710 save_SamplerParameteri(GLuint sampler, GLenum pname, GLint param)
9711 {
9712 GLint parray[4];
9713 parray[0] = param;
9714 parray[1] = parray[2] = parray[3] = 0;
9715 save_SamplerParameteriv(sampler, pname, parray);
9716 }
9717
9718 static void GLAPIENTRY
9719 save_SamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *params)
9720 {
9721 Node *n;
9722 GET_CURRENT_CONTEXT(ctx);
9723 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9724 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERFV, 6);
9725 if (n) {
9726 n[1].ui = sampler;
9727 n[2].e = pname;
9728 n[3].f = params[0];
9729 if (pname == GL_TEXTURE_BORDER_COLOR) {
9730 n[4].f = params[1];
9731 n[5].f = params[2];
9732 n[6].f = params[3];
9733 }
9734 else {
9735 n[4].f = n[5].f = n[6].f = 0.0F;
9736 }
9737 }
9738 if (ctx->ExecuteFlag) {
9739 CALL_SamplerParameterfv(ctx->Exec, (sampler, pname, params));
9740 }
9741 }
9742
9743 static void GLAPIENTRY
9744 save_SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
9745 {
9746 GLfloat parray[4];
9747 parray[0] = param;
9748 parray[1] = parray[2] = parray[3] = 0.0F;
9749 save_SamplerParameterfv(sampler, pname, parray);
9750 }
9751
9752 static void GLAPIENTRY
9753 save_SamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *params)
9754 {
9755 Node *n;
9756 GET_CURRENT_CONTEXT(ctx);
9757 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9758 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERIIV, 6);
9759 if (n) {
9760 n[1].ui = sampler;
9761 n[2].e = pname;
9762 n[3].i = params[0];
9763 if (pname == GL_TEXTURE_BORDER_COLOR) {
9764 n[4].i = params[1];
9765 n[5].i = params[2];
9766 n[6].i = params[3];
9767 }
9768 else {
9769 n[4].i = n[5].i = n[6].i = 0;
9770 }
9771 }
9772 if (ctx->ExecuteFlag) {
9773 CALL_SamplerParameterIiv(ctx->Exec, (sampler, pname, params));
9774 }
9775 }
9776
9777 static void GLAPIENTRY
9778 save_SamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *params)
9779 {
9780 Node *n;
9781 GET_CURRENT_CONTEXT(ctx);
9782 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9783 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERUIV, 6);
9784 if (n) {
9785 n[1].ui = sampler;
9786 n[2].e = pname;
9787 n[3].ui = params[0];
9788 if (pname == GL_TEXTURE_BORDER_COLOR) {
9789 n[4].ui = params[1];
9790 n[5].ui = params[2];
9791 n[6].ui = params[3];
9792 }
9793 else {
9794 n[4].ui = n[5].ui = n[6].ui = 0;
9795 }
9796 }
9797 if (ctx->ExecuteFlag) {
9798 CALL_SamplerParameterIuiv(ctx->Exec, (sampler, pname, params));
9799 }
9800 }
9801
9802 static void GLAPIENTRY
9803 save_WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
9804 {
9805 Node *n;
9806 GET_CURRENT_CONTEXT(ctx);
9807 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9808 n = alloc_instruction(ctx, OPCODE_WAIT_SYNC, 4);
9809 if (n) {
9810 union uint64_pair p;
9811 p.uint64 = timeout;
9812 n[1].bf = flags;
9813 n[2].ui = p.uint32[0];
9814 n[3].ui = p.uint32[1];
9815 save_pointer(&n[4], sync);
9816 }
9817 if (ctx->ExecuteFlag) {
9818 CALL_WaitSync(ctx->Exec, (sync, flags, timeout));
9819 }
9820 }
9821
9822
9823 /** GL_NV_conditional_render */
9824 static void GLAPIENTRY
9825 save_BeginConditionalRender(GLuint queryId, GLenum mode)
9826 {
9827 GET_CURRENT_CONTEXT(ctx);
9828 Node *n;
9829 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9830 n = alloc_instruction(ctx, OPCODE_BEGIN_CONDITIONAL_RENDER, 2);
9831 if (n) {
9832 n[1].i = queryId;
9833 n[2].e = mode;
9834 }
9835 if (ctx->ExecuteFlag) {
9836 CALL_BeginConditionalRender(ctx->Exec, (queryId, mode));
9837 }
9838 }
9839
9840 static void GLAPIENTRY
9841 save_EndConditionalRender(void)
9842 {
9843 GET_CURRENT_CONTEXT(ctx);
9844 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9845 alloc_instruction(ctx, OPCODE_END_CONDITIONAL_RENDER, 0);
9846 if (ctx->ExecuteFlag) {
9847 CALL_EndConditionalRender(ctx->Exec, ());
9848 }
9849 }
9850
9851 static void GLAPIENTRY
9852 save_UniformBlockBinding(GLuint prog, GLuint index, GLuint binding)
9853 {
9854 GET_CURRENT_CONTEXT(ctx);
9855 Node *n;
9856 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9857 n = alloc_instruction(ctx, OPCODE_UNIFORM_BLOCK_BINDING, 3);
9858 if (n) {
9859 n[1].ui = prog;
9860 n[2].ui = index;
9861 n[3].ui = binding;
9862 }
9863 if (ctx->ExecuteFlag) {
9864 CALL_UniformBlockBinding(ctx->Exec, (prog, index, binding));
9865 }
9866 }
9867
9868 static void GLAPIENTRY
9869 save_UniformSubroutinesuiv(GLenum shadertype, GLsizei count,
9870 const GLuint *indices)
9871 {
9872 GET_CURRENT_CONTEXT(ctx);
9873 Node *n;
9874 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9875 n = alloc_instruction(ctx, OPCODE_UNIFORM_SUBROUTINES, 2 + POINTER_DWORDS);
9876 if (n) {
9877 GLint *indices_copy = NULL;
9878
9879 if (count > 0)
9880 indices_copy = memdup(indices, sizeof(GLuint) * 4 * count);
9881 n[1].e = shadertype;
9882 n[2].si = count;
9883 save_pointer(&n[3], indices_copy);
9884 }
9885 if (ctx->ExecuteFlag) {
9886 CALL_UniformSubroutinesuiv(ctx->Exec, (shadertype, count, indices));
9887 }
9888 }
9889
9890 /** GL_EXT_window_rectangles */
9891 static void GLAPIENTRY
9892 save_WindowRectanglesEXT(GLenum mode, GLsizei count, const GLint *box)
9893 {
9894 GET_CURRENT_CONTEXT(ctx);
9895 Node *n;
9896 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9897 n = alloc_instruction(ctx, OPCODE_WINDOW_RECTANGLES, 2 + POINTER_DWORDS);
9898 if (n) {
9899 GLint *box_copy = NULL;
9900
9901 if (count > 0)
9902 box_copy = memdup(box, sizeof(GLint) * 4 * count);
9903 n[1].e = mode;
9904 n[2].si = count;
9905 save_pointer(&n[3], box_copy);
9906 }
9907 if (ctx->ExecuteFlag) {
9908 CALL_WindowRectanglesEXT(ctx->Exec, (mode, count, box));
9909 }
9910 }
9911
9912
9913 /** GL_NV_conservative_raster */
9914 static void GLAPIENTRY
9915 save_SubpixelPrecisionBiasNV(GLuint xbits, GLuint ybits)
9916 {
9917 GET_CURRENT_CONTEXT(ctx);
9918 Node *n;
9919 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9920 n = alloc_instruction(ctx, OPCODE_SUBPIXEL_PRECISION_BIAS, 2);
9921 if (n) {
9922 n[1].ui = xbits;
9923 n[2].ui = ybits;
9924 }
9925 if (ctx->ExecuteFlag) {
9926 CALL_SubpixelPrecisionBiasNV(ctx->Exec, (xbits, ybits));
9927 }
9928 }
9929
9930 /** GL_NV_conservative_raster_dilate */
9931 static void GLAPIENTRY
9932 save_ConservativeRasterParameterfNV(GLenum pname, GLfloat param)
9933 {
9934 GET_CURRENT_CONTEXT(ctx);
9935 Node *n;
9936 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9937 n = alloc_instruction(ctx, OPCODE_CONSERVATIVE_RASTER_PARAMETER_F, 2);
9938 if (n) {
9939 n[1].e = pname;
9940 n[2].f = param;
9941 }
9942 if (ctx->ExecuteFlag) {
9943 CALL_ConservativeRasterParameterfNV(ctx->Exec, (pname, param));
9944 }
9945 }
9946
9947 /** GL_NV_conservative_raster_pre_snap_triangles */
9948 static void GLAPIENTRY
9949 save_ConservativeRasterParameteriNV(GLenum pname, GLint param)
9950 {
9951 GET_CURRENT_CONTEXT(ctx);
9952 Node *n;
9953 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9954 n = alloc_instruction(ctx, OPCODE_CONSERVATIVE_RASTER_PARAMETER_I, 2);
9955 if (n) {
9956 n[1].e = pname;
9957 n[2].i = param;
9958 }
9959 if (ctx->ExecuteFlag) {
9960 CALL_ConservativeRasterParameteriNV(ctx->Exec, (pname, param));
9961 }
9962 }
9963
9964 /** GL_EXT_direct_state_access */
9965
9966 static void GLAPIENTRY
9967 save_MatrixLoadfEXT(GLenum matrixMode, const GLfloat *m)
9968 {
9969 GET_CURRENT_CONTEXT(ctx);
9970 Node *n;
9971 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9972 n = alloc_instruction(ctx, OPCODE_MATRIX_LOAD, 17);
9973 if (n) {
9974 n[1].e = matrixMode;
9975 for (unsigned i = 0; i < 16; i++) {
9976 n[2 + i].f = m[i];
9977 }
9978 }
9979 if (ctx->ExecuteFlag) {
9980 CALL_MatrixLoadfEXT(ctx->Exec, (matrixMode, m));
9981 }
9982 }
9983
9984 static void GLAPIENTRY
9985 save_MatrixLoaddEXT(GLenum matrixMode, const GLdouble *m)
9986 {
9987 GLfloat f[16];
9988 for (unsigned i = 0; i < 16; i++) {
9989 f[i] = (GLfloat) m[i];
9990 }
9991 save_MatrixLoadfEXT(matrixMode, f);
9992 }
9993
9994 static void GLAPIENTRY
9995 save_MatrixMultfEXT(GLenum matrixMode, const GLfloat * m)
9996 {
9997 GET_CURRENT_CONTEXT(ctx);
9998 Node *n;
9999 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10000 n = alloc_instruction(ctx, OPCODE_MATRIX_MULT, 17);
10001 if (n) {
10002 n[1].e = matrixMode;
10003 for (unsigned i = 0; i < 16; i++) {
10004 n[2 + i].f = m[i];
10005 }
10006 }
10007 if (ctx->ExecuteFlag) {
10008 CALL_MatrixMultfEXT(ctx->Exec, (matrixMode, m));
10009 }
10010 }
10011
10012 static void GLAPIENTRY
10013 save_MatrixMultdEXT(GLenum matrixMode, const GLdouble * m)
10014 {
10015 GLfloat f[16];
10016 for (unsigned i = 0; i < 16; i++) {
10017 f[i] = (GLfloat) m[i];
10018 }
10019 save_MatrixMultfEXT(matrixMode, f);
10020 }
10021
10022 static void GLAPIENTRY
10023 save_MatrixRotatefEXT(GLenum matrixMode, GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
10024 {
10025 GET_CURRENT_CONTEXT(ctx);
10026 Node *n;
10027 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10028 n = alloc_instruction(ctx, OPCODE_MATRIX_ROTATE, 5);
10029 if (n) {
10030 n[1].e = matrixMode;
10031 n[2].f = angle;
10032 n[3].f = x;
10033 n[4].f = y;
10034 n[5].f = z;
10035 }
10036 if (ctx->ExecuteFlag) {
10037 CALL_MatrixRotatefEXT(ctx->Exec, (matrixMode, angle, x, y, z));
10038 }
10039 }
10040
10041 static void GLAPIENTRY
10042 save_MatrixRotatedEXT(GLenum matrixMode, GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
10043 {
10044 save_MatrixRotatefEXT(matrixMode, (GLfloat) angle, (GLfloat) x, (GLfloat) y, (GLfloat) z);
10045 }
10046
10047 static void GLAPIENTRY
10048 save_MatrixScalefEXT(GLenum matrixMode, GLfloat x, GLfloat y, GLfloat z)
10049 {
10050 GET_CURRENT_CONTEXT(ctx);
10051 Node *n;
10052 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10053 n = alloc_instruction(ctx, OPCODE_MATRIX_SCALE, 4);
10054 if (n) {
10055 n[1].e = matrixMode;
10056 n[2].f = x;
10057 n[3].f = y;
10058 n[4].f = z;
10059 }
10060 if (ctx->ExecuteFlag) {
10061 CALL_MatrixScalefEXT(ctx->Exec, (matrixMode, x, y, z));
10062 }
10063 }
10064
10065 static void GLAPIENTRY
10066 save_MatrixScaledEXT(GLenum matrixMode, GLdouble x, GLdouble y, GLdouble z)
10067 {
10068 save_MatrixScalefEXT(matrixMode, (GLfloat) x, (GLfloat) y, (GLfloat) z);
10069 }
10070
10071 static void GLAPIENTRY
10072 save_MatrixTranslatefEXT(GLenum matrixMode, GLfloat x, GLfloat y, GLfloat z)
10073 {
10074 GET_CURRENT_CONTEXT(ctx);
10075 Node *n;
10076 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10077 n = alloc_instruction(ctx, OPCODE_MATRIX_TRANSLATE, 4);
10078 if (n) {
10079 n[1].e = matrixMode;
10080 n[2].f = x;
10081 n[3].f = y;
10082 n[4].f = z;
10083 }
10084 if (ctx->ExecuteFlag) {
10085 CALL_MatrixTranslatefEXT(ctx->Exec, (matrixMode, x, y, z));
10086 }
10087 }
10088
10089 static void GLAPIENTRY
10090 save_MatrixTranslatedEXT(GLenum matrixMode, GLdouble x, GLdouble y, GLdouble z)
10091 {
10092 save_MatrixTranslatefEXT(matrixMode, (GLfloat) x, (GLfloat) y, (GLfloat) z);
10093 }
10094
10095 static void GLAPIENTRY
10096 save_MatrixLoadIdentityEXT(GLenum matrixMode)
10097 {
10098 GET_CURRENT_CONTEXT(ctx);
10099 Node *n;
10100 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10101 n = alloc_instruction(ctx, OPCODE_MATRIX_LOAD_IDENTITY, 1);
10102 if (n) {
10103 n[1].e = matrixMode;
10104 }
10105 if (ctx->ExecuteFlag) {
10106 CALL_MatrixLoadIdentityEXT(ctx->Exec, (matrixMode));
10107 }
10108 }
10109
10110 static void GLAPIENTRY
10111 save_MatrixOrthoEXT(GLenum matrixMode, GLdouble left, GLdouble right,
10112 GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval)
10113 {
10114 GET_CURRENT_CONTEXT(ctx);
10115 Node *n;
10116 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10117 n = alloc_instruction(ctx, OPCODE_MATRIX_ORTHO, 7);
10118 if (n) {
10119 n[1].e = matrixMode;
10120 n[2].f = (GLfloat) left;
10121 n[3].f = (GLfloat) right;
10122 n[4].f = (GLfloat) bottom;
10123 n[5].f = (GLfloat) top;
10124 n[6].f = (GLfloat) nearval;
10125 n[7].f = (GLfloat) farval;
10126 }
10127 if (ctx->ExecuteFlag) {
10128 CALL_MatrixOrthoEXT(ctx->Exec, (matrixMode, left, right, bottom, top, nearval, farval));
10129 }
10130 }
10131
10132
10133 static void GLAPIENTRY
10134 save_MatrixFrustumEXT(GLenum matrixMode, GLdouble left, GLdouble right,
10135 GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval)
10136 {
10137 GET_CURRENT_CONTEXT(ctx);
10138 Node *n;
10139 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10140 n = alloc_instruction(ctx, OPCODE_MATRIX_FRUSTUM, 7);
10141 if (n) {
10142 n[1].e = matrixMode;
10143 n[2].f = (GLfloat) left;
10144 n[3].f = (GLfloat) right;
10145 n[4].f = (GLfloat) bottom;
10146 n[5].f = (GLfloat) top;
10147 n[6].f = (GLfloat) nearval;
10148 n[7].f = (GLfloat) farval;
10149 }
10150 if (ctx->ExecuteFlag) {
10151 CALL_MatrixFrustumEXT(ctx->Exec, (matrixMode, left, right, bottom, top, nearval, farval));
10152 }
10153 }
10154
10155 static void GLAPIENTRY
10156 save_MatrixPushEXT(GLenum matrixMode)
10157 {
10158 GET_CURRENT_CONTEXT(ctx);
10159 Node* n;
10160 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10161 n = alloc_instruction(ctx, OPCODE_MATRIX_PUSH, 1);
10162 if (n) {
10163 n[1].e = matrixMode;
10164 }
10165 if (ctx->ExecuteFlag) {
10166 CALL_MatrixPushEXT(ctx->Exec, (matrixMode));
10167 }
10168 }
10169
10170 static void GLAPIENTRY
10171 save_MatrixPopEXT(GLenum matrixMode)
10172 {
10173 GET_CURRENT_CONTEXT(ctx);
10174 Node* n;
10175 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10176 n = alloc_instruction(ctx, OPCODE_MATRIX_POP, 1);
10177 if (n) {
10178 n[1].e = matrixMode;
10179 }
10180 if (ctx->ExecuteFlag) {
10181 CALL_MatrixPopEXT(ctx->Exec, (matrixMode));
10182 }
10183 }
10184
10185 static void GLAPIENTRY
10186 save_MatrixLoadTransposefEXT(GLenum matrixMode, const GLfloat m[16])
10187 {
10188 GLfloat tm[16];
10189 _math_transposef(tm, m);
10190 save_MatrixLoadfEXT(matrixMode, tm);
10191 }
10192
10193 static void GLAPIENTRY
10194 save_MatrixLoadTransposedEXT(GLenum matrixMode, const GLdouble m[16])
10195 {
10196 GLfloat tm[16];
10197 _math_transposefd(tm, m);
10198 save_MatrixLoadfEXT(matrixMode, tm);
10199 }
10200
10201 static void GLAPIENTRY
10202 save_MatrixMultTransposefEXT(GLenum matrixMode, const GLfloat m[16])
10203 {
10204 GLfloat tm[16];
10205 _math_transposef(tm, m);
10206 save_MatrixMultfEXT(matrixMode, tm);
10207 }
10208
10209 static void GLAPIENTRY
10210 save_MatrixMultTransposedEXT(GLenum matrixMode, const GLdouble m[16])
10211 {
10212 GLfloat tm[16];
10213 _math_transposefd(tm, m);
10214 save_MatrixMultfEXT(matrixMode, tm);
10215 }
10216
10217 static void GLAPIENTRY
10218 save_TextureParameterfvEXT(GLuint texture, GLenum target, GLenum pname,
10219 const GLfloat *params)
10220 {
10221 GET_CURRENT_CONTEXT(ctx);
10222 Node *n;
10223 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10224 n = alloc_instruction(ctx, OPCODE_TEXTUREPARAMETER_F, 7);
10225 if (n) {
10226 n[1].ui = texture;
10227 n[2].e = target;
10228 n[3].e = pname;
10229 n[4].f = params[0];
10230 n[5].f = params[1];
10231 n[6].f = params[2];
10232 n[7].f = params[3];
10233 }
10234 if (ctx->ExecuteFlag) {
10235 CALL_TextureParameterfvEXT(ctx->Exec, (texture, target, pname, params));
10236 }
10237 }
10238
10239
10240 static void GLAPIENTRY
10241 save_TextureParameterfEXT(GLuint texture, GLenum target, GLenum pname, GLfloat param)
10242 {
10243 GLfloat parray[4];
10244 parray[0] = param;
10245 parray[1] = parray[2] = parray[3] = 0.0F;
10246 save_TextureParameterfvEXT(texture, target, pname, parray);
10247 }
10248
10249 static void GLAPIENTRY
10250 save_TextureParameterivEXT(GLuint texture, GLenum target, GLenum pname, const GLint *params)
10251 {
10252 GET_CURRENT_CONTEXT(ctx);
10253 Node *n;
10254 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10255 n = alloc_instruction(ctx, OPCODE_TEXTUREPARAMETER_I, 7);
10256 if (n) {
10257 n[1].ui = texture;
10258 n[2].e = target;
10259 n[3].e = pname;
10260 n[4].i = params[0];
10261 n[5].i = params[1];
10262 n[6].i = params[2];
10263 n[7].i = params[3];
10264 }
10265 if (ctx->ExecuteFlag) {
10266 CALL_TextureParameterivEXT(ctx->Exec, (texture, target, pname, params));
10267 }
10268 }
10269
10270 static void GLAPIENTRY
10271 save_TextureParameteriEXT(GLuint texture, GLenum target, GLenum pname, GLint param)
10272 {
10273 GLint fparam[4];
10274 fparam[0] = param;
10275 fparam[1] = fparam[2] = fparam[3] = 0;
10276 save_TextureParameterivEXT(texture, target, pname, fparam);
10277 }
10278
10279 static void GLAPIENTRY
10280 save_TextureParameterIivEXT(GLuint texture, GLenum target, GLenum pname, const GLint* params)
10281 {
10282 GET_CURRENT_CONTEXT(ctx);
10283 Node *n;
10284 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10285 n = alloc_instruction(ctx, OPCODE_TEXTUREPARAMETER_II, 7);
10286 if (n) {
10287 n[1].ui = texture;
10288 n[2].e = target;
10289 n[3].e = pname;
10290 n[4].i = params[0];
10291 n[5].i = params[1];
10292 n[6].i = params[2];
10293 n[7].i = params[3];
10294 }
10295 if (ctx->ExecuteFlag) {
10296 CALL_TextureParameterIivEXT(ctx->Exec, (texture, target, pname, params));
10297 }
10298 }
10299
10300 static void GLAPIENTRY
10301 save_TextureParameterIuivEXT(GLuint texture, GLenum target, GLenum pname, const GLuint* params)
10302 {
10303 GET_CURRENT_CONTEXT(ctx);
10304 Node *n;
10305 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10306 n = alloc_instruction(ctx, OPCODE_TEXTUREPARAMETER_IUI, 7);
10307 if (n) {
10308 n[1].ui = texture;
10309 n[2].e = target;
10310 n[3].e = pname;
10311 n[4].ui = params[0];
10312 n[5].ui = params[1];
10313 n[6].ui = params[2];
10314 n[7].ui = params[3];
10315 }
10316 if (ctx->ExecuteFlag) {
10317 CALL_TextureParameterIuivEXT(ctx->Exec, (texture, target, pname, params));
10318 }
10319 }
10320
10321
10322 static void GLAPIENTRY
10323 save_TextureImage1DEXT(GLuint texture, GLenum target,
10324 GLint level, GLint components,
10325 GLsizei width, GLint border,
10326 GLenum format, GLenum type, const GLvoid * pixels)
10327 {
10328 GET_CURRENT_CONTEXT(ctx);
10329 if (target == GL_PROXY_TEXTURE_1D) {
10330 /* don't compile, execute immediately */
10331 CALL_TextureImage1DEXT(ctx->Exec, (texture, target, level, components, width,
10332 border, format, type, pixels));
10333 }
10334 else {
10335 Node *n;
10336 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10337 n = alloc_instruction(ctx, OPCODE_TEXTURE_IMAGE1D, 8 + POINTER_DWORDS);
10338 if (n) {
10339 n[1].ui = texture;
10340 n[2].e = target;
10341 n[3].i = level;
10342 n[4].i = components;
10343 n[5].i = (GLint) width;
10344 n[6].i = border;
10345 n[7].e = format;
10346 n[8].e = type;
10347 save_pointer(&n[9],
10348 unpack_image(ctx, 1, width, 1, 1, format, type,
10349 pixels, &ctx->Unpack));
10350 }
10351 if (ctx->ExecuteFlag) {
10352 CALL_TextureImage1DEXT(ctx->Exec, (texture, target, level, components, width,
10353 border, format, type, pixels));
10354 }
10355 }
10356 }
10357
10358
10359 static void GLAPIENTRY
10360 save_TextureImage2DEXT(GLuint texture, GLenum target,
10361 GLint level, GLint components,
10362 GLsizei width, GLsizei height, GLint border,
10363 GLenum format, GLenum type, const GLvoid * pixels)
10364 {
10365 GET_CURRENT_CONTEXT(ctx);
10366 if (target == GL_PROXY_TEXTURE_2D) {
10367 /* don't compile, execute immediately */
10368 CALL_TextureImage2DEXT(ctx->Exec, (texture, target, level, components, width,
10369 height, border, format, type, pixels));
10370 }
10371 else {
10372 Node *n;
10373 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10374 n = alloc_instruction(ctx, OPCODE_TEXTURE_IMAGE2D, 9 + POINTER_DWORDS);
10375 if (n) {
10376 n[1].ui = texture;
10377 n[2].e = target;
10378 n[3].i = level;
10379 n[4].i = components;
10380 n[5].i = (GLint) width;
10381 n[6].i = (GLint) height;
10382 n[7].i = border;
10383 n[8].e = format;
10384 n[9].e = type;
10385 save_pointer(&n[10],
10386 unpack_image(ctx, 2, width, height, 1, format, type,
10387 pixels, &ctx->Unpack));
10388 }
10389 if (ctx->ExecuteFlag) {
10390 CALL_TextureImage2DEXT(ctx->Exec, (texture, target, level, components, width,
10391 height, border, format, type, pixels));
10392 }
10393 }
10394 }
10395
10396
10397 static void GLAPIENTRY
10398 save_TextureImage3DEXT(GLuint texture, GLenum target,
10399 GLint level, GLint internalFormat,
10400 GLsizei width, GLsizei height, GLsizei depth,
10401 GLint border,
10402 GLenum format, GLenum type, const GLvoid * pixels)
10403 {
10404 GET_CURRENT_CONTEXT(ctx);
10405 if (target == GL_PROXY_TEXTURE_3D) {
10406 /* don't compile, execute immediately */
10407 CALL_TextureImage3DEXT(ctx->Exec, (texture, target, level, internalFormat, width,
10408 height, depth, border, format, type,
10409 pixels));
10410 }
10411 else {
10412 Node *n;
10413 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10414 n = alloc_instruction(ctx, OPCODE_TEXTURE_IMAGE3D, 10 + POINTER_DWORDS);
10415 if (n) {
10416 n[1].ui = texture;
10417 n[2].e = target;
10418 n[3].i = level;
10419 n[4].i = (GLint) internalFormat;
10420 n[5].i = (GLint) width;
10421 n[6].i = (GLint) height;
10422 n[7].i = (GLint) depth;
10423 n[8].i = border;
10424 n[9].e = format;
10425 n[10].e = type;
10426 save_pointer(&n[11],
10427 unpack_image(ctx, 3, width, height, depth, format, type,
10428 pixels, &ctx->Unpack));
10429 }
10430 if (ctx->ExecuteFlag) {
10431 CALL_TextureImage3DEXT(ctx->Exec, (texture, target, level, internalFormat,
10432 width, height, depth, border, format,
10433 type, pixels));
10434 }
10435 }
10436 }
10437
10438
10439 static void GLAPIENTRY
10440 save_TextureSubImage1DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset,
10441 GLsizei width, GLenum format, GLenum type,
10442 const GLvoid * pixels)
10443 {
10444 GET_CURRENT_CONTEXT(ctx);
10445 Node *n;
10446
10447 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10448
10449 n = alloc_instruction(ctx, OPCODE_TEXTURE_SUB_IMAGE1D, 7 + POINTER_DWORDS);
10450 if (n) {
10451 n[1].ui = texture;
10452 n[2].e = target;
10453 n[3].i = level;
10454 n[4].i = xoffset;
10455 n[5].i = (GLint) width;
10456 n[6].e = format;
10457 n[7].e = type;
10458 save_pointer(&n[8],
10459 unpack_image(ctx, 1, width, 1, 1, format, type,
10460 pixels, &ctx->Unpack));
10461 }
10462 if (ctx->ExecuteFlag) {
10463 CALL_TextureSubImage1DEXT(ctx->Exec, (texture, target, level, xoffset, width,
10464 format, type, pixels));
10465 }
10466 }
10467
10468
10469 static void GLAPIENTRY
10470 save_TextureSubImage2DEXT(GLuint texture, GLenum target, GLint level,
10471 GLint xoffset, GLint yoffset,
10472 GLsizei width, GLsizei height,
10473 GLenum format, GLenum type, const GLvoid * pixels)
10474 {
10475 GET_CURRENT_CONTEXT(ctx);
10476 Node *n;
10477
10478 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10479
10480 n = alloc_instruction(ctx, OPCODE_TEXTURE_SUB_IMAGE2D, 9 + POINTER_DWORDS);
10481 if (n) {
10482 n[1].ui = texture;
10483 n[2].e = target;
10484 n[3].i = level;
10485 n[4].i = xoffset;
10486 n[5].i = yoffset;
10487 n[6].i = (GLint) width;
10488 n[7].i = (GLint) height;
10489 n[8].e = format;
10490 n[9].e = type;
10491 save_pointer(&n[10],
10492 unpack_image(ctx, 2, width, height, 1, format, type,
10493 pixels, &ctx->Unpack));
10494 }
10495 if (ctx->ExecuteFlag) {
10496 CALL_TextureSubImage2DEXT(ctx->Exec, (texture, target, level, xoffset, yoffset,
10497 width, height, format, type, pixels));
10498 }
10499 }
10500
10501
10502 static void GLAPIENTRY
10503 save_TextureSubImage3DEXT(GLuint texture, GLenum target, GLint level,
10504 GLint xoffset, GLint yoffset, GLint zoffset,
10505 GLsizei width, GLsizei height, GLsizei depth,
10506 GLenum format, GLenum type, const GLvoid * pixels)
10507 {
10508 GET_CURRENT_CONTEXT(ctx);
10509 Node *n;
10510
10511 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10512
10513 n = alloc_instruction(ctx, OPCODE_TEXTURE_SUB_IMAGE3D, 11 + POINTER_DWORDS);
10514 if (n) {
10515 n[1].ui = texture;
10516 n[2].e = target;
10517 n[3].i = level;
10518 n[4].i = xoffset;
10519 n[5].i = yoffset;
10520 n[6].i = zoffset;
10521 n[7].i = (GLint) width;
10522 n[8].i = (GLint) height;
10523 n[9].i = (GLint) depth;
10524 n[10].e = format;
10525 n[11].e = type;
10526 save_pointer(&n[12],
10527 unpack_image(ctx, 3, width, height, depth, format, type,
10528 pixels, &ctx->Unpack));
10529 }
10530 if (ctx->ExecuteFlag) {
10531 CALL_TextureSubImage3DEXT(ctx->Exec, (texture, target, level,
10532 xoffset, yoffset, zoffset,
10533 width, height, depth, format, type,
10534 pixels));
10535 }
10536 }
10537
10538 static void GLAPIENTRY
10539 save_CopyTextureImage1DEXT(GLuint texture, GLenum target, GLint level,
10540 GLenum internalformat, GLint x, GLint y,
10541 GLsizei width, GLint border)
10542 {
10543 GET_CURRENT_CONTEXT(ctx);
10544 Node *n;
10545 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10546 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_IMAGE1D, 8);
10547 if (n) {
10548 n[1].ui = texture;
10549 n[2].e = target;
10550 n[3].i = level;
10551 n[4].e = internalformat;
10552 n[5].i = x;
10553 n[6].i = y;
10554 n[7].i = width;
10555 n[8].i = border;
10556 }
10557 if (ctx->ExecuteFlag) {
10558 CALL_CopyTextureImage1DEXT(ctx->Exec, (texture, target, level,
10559 internalformat, x, y,
10560 width, border));
10561 }
10562 }
10563
10564 static void GLAPIENTRY
10565 save_CopyTextureImage2DEXT(GLuint texture, GLenum target, GLint level,
10566 GLenum internalformat,
10567 GLint x, GLint y, GLsizei width,
10568 GLsizei height, GLint border)
10569 {
10570 GET_CURRENT_CONTEXT(ctx);
10571 Node *n;
10572 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10573 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_IMAGE2D, 9);
10574 if (n) {
10575 n[1].ui = texture;
10576 n[2].e = target;
10577 n[3].i = level;
10578 n[4].e = internalformat;
10579 n[5].i = x;
10580 n[6].i = y;
10581 n[7].i = width;
10582 n[8].i = height;
10583 n[9].i = border;
10584 }
10585 if (ctx->ExecuteFlag) {
10586 CALL_CopyTextureImage2DEXT(ctx->Exec, (texture, target, level,
10587 internalformat, x, y,
10588 width, height, border));
10589 }
10590 }
10591
10592 static void GLAPIENTRY
10593 save_CopyTextureSubImage1DEXT(GLuint texture, GLenum target, GLint level,
10594 GLint xoffset, GLint x, GLint y, GLsizei width)
10595 {
10596 GET_CURRENT_CONTEXT(ctx);
10597 Node *n;
10598 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10599 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_SUB_IMAGE1D, 7);
10600 if (n) {
10601 n[1].ui = texture;
10602 n[2].e = target;
10603 n[3].i = level;
10604 n[4].i = xoffset;
10605 n[5].i = x;
10606 n[6].i = y;
10607 n[7].i = width;
10608 }
10609 if (ctx->ExecuteFlag) {
10610 CALL_CopyTextureSubImage1DEXT(ctx->Exec,
10611 (texture, target, level, xoffset, x, y, width));
10612 }
10613 }
10614
10615 static void GLAPIENTRY
10616 save_CopyTextureSubImage2DEXT(GLuint texture, GLenum target, GLint level,
10617 GLint xoffset, GLint yoffset,
10618 GLint x, GLint y, GLsizei width, GLint height)
10619 {
10620 GET_CURRENT_CONTEXT(ctx);
10621 Node *n;
10622 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10623 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_SUB_IMAGE2D, 9);
10624 if (n) {
10625 n[1].ui = texture;
10626 n[2].e = target;
10627 n[3].i = level;
10628 n[4].i = xoffset;
10629 n[5].i = yoffset;
10630 n[6].i = x;
10631 n[7].i = y;
10632 n[8].i = width;
10633 n[9].i = height;
10634 }
10635 if (ctx->ExecuteFlag) {
10636 CALL_CopyTextureSubImage2DEXT(ctx->Exec, (texture, target, level,
10637 xoffset, yoffset,
10638 x, y, width, height));
10639 }
10640 }
10641
10642
10643 static void GLAPIENTRY
10644 save_CopyTextureSubImage3DEXT(GLuint texture, GLenum target, GLint level,
10645 GLint xoffset, GLint yoffset, GLint zoffset,
10646 GLint x, GLint y, GLsizei width, GLint height)
10647 {
10648 GET_CURRENT_CONTEXT(ctx);
10649 Node *n;
10650 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10651 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_SUB_IMAGE3D, 10);
10652 if (n) {
10653 n[1].ui = texture;
10654 n[2].e = target;
10655 n[3].i = level;
10656 n[4].i = xoffset;
10657 n[5].i = yoffset;
10658 n[6].i = zoffset;
10659 n[7].i = x;
10660 n[8].i = y;
10661 n[9].i = width;
10662 n[10].i = height;
10663 }
10664 if (ctx->ExecuteFlag) {
10665 CALL_CopyTextureSubImage3DEXT(ctx->Exec, (texture, target, level,
10666 xoffset, yoffset, zoffset,
10667 x, y, width, height));
10668 }
10669 }
10670
10671
10672 static void GLAPIENTRY
10673 save_BindMultiTextureEXT(GLenum texunit, GLenum target, GLuint texture)
10674 {
10675 GET_CURRENT_CONTEXT(ctx);
10676 Node *n;
10677 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10678 n = alloc_instruction(ctx, OPCODE_BIND_MULTITEXTURE, 3);
10679 if (n) {
10680 n[1].e = texunit;
10681 n[2].e = target;
10682 n[3].ui = texture;
10683 }
10684 if (ctx->ExecuteFlag) {
10685 CALL_BindMultiTextureEXT(ctx->Exec, (texunit, target, texture));
10686 }
10687 }
10688
10689
10690 static void GLAPIENTRY
10691 save_MultiTexParameterfvEXT(GLenum texunit, GLenum target, GLenum pname,
10692 const GLfloat *params)
10693 {
10694 GET_CURRENT_CONTEXT(ctx);
10695 Node *n;
10696 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10697 n = alloc_instruction(ctx, OPCODE_MULTITEXPARAMETER_F, 7);
10698 if (n) {
10699 n[1].e = texunit;
10700 n[2].e = target;
10701 n[3].e = pname;
10702 n[4].f = params[0];
10703 n[5].f = params[1];
10704 n[6].f = params[2];
10705 n[7].f = params[3];
10706 }
10707 if (ctx->ExecuteFlag) {
10708 CALL_MultiTexParameterfvEXT(ctx->Exec, (texunit, target, pname, params));
10709 }
10710 }
10711
10712
10713 static void GLAPIENTRY
10714 save_MultiTexParameterfEXT(GLenum texunit, GLenum target, GLenum pname, GLfloat param)
10715 {
10716 GLfloat parray[4];
10717 parray[0] = param;
10718 parray[1] = parray[2] = parray[3] = 0.0F;
10719 save_MultiTexParameterfvEXT(texunit, target, pname, parray);
10720 }
10721
10722 static void GLAPIENTRY
10723 save_MultiTexParameterivEXT(GLenum texunit, GLenum target, GLenum pname, const GLint *params)
10724 {
10725 GET_CURRENT_CONTEXT(ctx);
10726 Node *n;
10727 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10728 n = alloc_instruction(ctx, OPCODE_MULTITEXPARAMETER_I, 7);
10729 if (n) {
10730 n[1].e = texunit;
10731 n[2].e = target;
10732 n[3].e = pname;
10733 n[4].i = params[0];
10734 n[5].i = params[1];
10735 n[6].i = params[2];
10736 n[7].i = params[3];
10737 }
10738 if (ctx->ExecuteFlag) {
10739 CALL_MultiTexParameterivEXT(ctx->Exec, (texunit, target, pname, params));
10740 }
10741 }
10742
10743 static void GLAPIENTRY
10744 save_MultiTexParameterIivEXT(GLenum texunit, GLenum target, GLenum pname, const GLint *params)
10745 {
10746 GET_CURRENT_CONTEXT(ctx);
10747 Node *n;
10748 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10749 n = alloc_instruction(ctx, OPCODE_MULTITEXPARAMETER_II, 7);
10750 if (n) {
10751 n[1].e = texunit;
10752 n[2].e = target;
10753 n[3].e = pname;
10754 n[4].i = params[0];
10755 n[5].i = params[1];
10756 n[6].i = params[2];
10757 n[7].i = params[3];
10758 }
10759 if (ctx->ExecuteFlag) {
10760 CALL_MultiTexParameterIivEXT(ctx->Exec, (texunit, target, pname, params));
10761 }
10762 }
10763
10764 static void GLAPIENTRY
10765 save_MultiTexParameterIuivEXT(GLenum texunit, GLenum target, GLenum pname, const GLuint *params)
10766 {
10767 GET_CURRENT_CONTEXT(ctx);
10768 Node *n;
10769 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10770 n = alloc_instruction(ctx, OPCODE_MULTITEXPARAMETER_IUI, 7);
10771 if (n) {
10772 n[1].e = texunit;
10773 n[2].e = target;
10774 n[3].e = pname;
10775 n[4].ui = params[0];
10776 n[5].ui = params[1];
10777 n[6].ui = params[2];
10778 n[7].ui = params[3];
10779 }
10780 if (ctx->ExecuteFlag) {
10781 CALL_MultiTexParameterIuivEXT(ctx->Exec, (texunit, target, pname, params));
10782 }
10783 }
10784
10785 static void GLAPIENTRY
10786 save_MultiTexParameteriEXT(GLenum texunit, GLenum target, GLenum pname, GLint param)
10787 {
10788 GLint fparam[4];
10789 fparam[0] = param;
10790 fparam[1] = fparam[2] = fparam[3] = 0;
10791 save_MultiTexParameterivEXT(texunit, target, pname, fparam);
10792 }
10793
10794
10795 static void GLAPIENTRY
10796 save_MultiTexImage1DEXT(GLenum texunit, GLenum target,
10797 GLint level, GLint components,
10798 GLsizei width, GLint border,
10799 GLenum format, GLenum type, const GLvoid * pixels)
10800 {
10801 GET_CURRENT_CONTEXT(ctx);
10802 if (target == GL_PROXY_TEXTURE_1D) {
10803 /* don't compile, execute immediately */
10804 CALL_MultiTexImage1DEXT(ctx->Exec, (texunit, target, level, components, width,
10805 border, format, type, pixels));
10806 }
10807 else {
10808 Node *n;
10809 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10810 n = alloc_instruction(ctx, OPCODE_MULTITEX_IMAGE1D, 8 + POINTER_DWORDS);
10811 if (n) {
10812 n[1].e = texunit;
10813 n[2].e = target;
10814 n[3].i = level;
10815 n[4].i = components;
10816 n[5].i = (GLint) width;
10817 n[6].i = border;
10818 n[7].e = format;
10819 n[8].e = type;
10820 save_pointer(&n[9],
10821 unpack_image(ctx, 1, width, 1, 1, format, type,
10822 pixels, &ctx->Unpack));
10823 }
10824 if (ctx->ExecuteFlag) {
10825 CALL_MultiTexImage1DEXT(ctx->Exec, (texunit, target, level, components, width,
10826 border, format, type, pixels));
10827 }
10828 }
10829 }
10830
10831
10832 static void GLAPIENTRY
10833 save_MultiTexImage2DEXT(GLenum texunit, GLenum target,
10834 GLint level, GLint components,
10835 GLsizei width, GLsizei height, GLint border,
10836 GLenum format, GLenum type, const GLvoid * pixels)
10837 {
10838 GET_CURRENT_CONTEXT(ctx);
10839 if (target == GL_PROXY_TEXTURE_2D) {
10840 /* don't compile, execute immediately */
10841 CALL_MultiTexImage2DEXT(ctx->Exec, (texunit, target, level, components, width,
10842 height, border, format, type, pixels));
10843 }
10844 else {
10845 Node *n;
10846 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10847 n = alloc_instruction(ctx, OPCODE_MULTITEX_IMAGE2D, 9 + POINTER_DWORDS);
10848 if (n) {
10849 n[1].e = texunit;
10850 n[2].e = target;
10851 n[3].i = level;
10852 n[4].i = components;
10853 n[5].i = (GLint) width;
10854 n[6].i = (GLint) height;
10855 n[7].i = border;
10856 n[8].e = format;
10857 n[9].e = type;
10858 save_pointer(&n[10],
10859 unpack_image(ctx, 2, width, height, 1, format, type,
10860 pixels, &ctx->Unpack));
10861 }
10862 if (ctx->ExecuteFlag) {
10863 CALL_MultiTexImage2DEXT(ctx->Exec, (texunit, target, level, components, width,
10864 height, border, format, type, pixels));
10865 }
10866 }
10867 }
10868
10869
10870 static void GLAPIENTRY
10871 save_MultiTexImage3DEXT(GLenum texunit, GLenum target,
10872 GLint level, GLint internalFormat,
10873 GLsizei width, GLsizei height, GLsizei depth,
10874 GLint border,
10875 GLenum format, GLenum type, const GLvoid * pixels)
10876 {
10877 GET_CURRENT_CONTEXT(ctx);
10878 if (target == GL_PROXY_TEXTURE_3D) {
10879 /* don't compile, execute immediately */
10880 CALL_MultiTexImage3DEXT(ctx->Exec, (texunit, target, level, internalFormat, width,
10881 height, depth, border, format, type,
10882 pixels));
10883 }
10884 else {
10885 Node *n;
10886 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10887 n = alloc_instruction(ctx, OPCODE_MULTITEX_IMAGE3D, 10 + POINTER_DWORDS);
10888 if (n) {
10889 n[1].e = texunit;
10890 n[2].e = target;
10891 n[3].i = level;
10892 n[4].i = (GLint) internalFormat;
10893 n[5].i = (GLint) width;
10894 n[6].i = (GLint) height;
10895 n[7].i = (GLint) depth;
10896 n[8].i = border;
10897 n[9].e = format;
10898 n[10].e = type;
10899 save_pointer(&n[11],
10900 unpack_image(ctx, 3, width, height, depth, format, type,
10901 pixels, &ctx->Unpack));
10902 }
10903 if (ctx->ExecuteFlag) {
10904 CALL_MultiTexImage3DEXT(ctx->Exec, (texunit, target, level, internalFormat,
10905 width, height, depth, border, format,
10906 type, pixels));
10907 }
10908 }
10909 }
10910
10911
10912 static void GLAPIENTRY
10913 save_MultiTexSubImage1DEXT(GLenum texunit, GLenum target, GLint level, GLint xoffset,
10914 GLsizei width, GLenum format, GLenum type,
10915 const GLvoid * pixels)
10916 {
10917 GET_CURRENT_CONTEXT(ctx);
10918 Node *n;
10919
10920 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10921
10922 n = alloc_instruction(ctx, OPCODE_MULTITEX_SUB_IMAGE1D, 7 + POINTER_DWORDS);
10923 if (n) {
10924 n[1].e = texunit;
10925 n[2].e = target;
10926 n[3].i = level;
10927 n[4].i = xoffset;
10928 n[5].i = (GLint) width;
10929 n[6].e = format;
10930 n[7].e = type;
10931 save_pointer(&n[8],
10932 unpack_image(ctx, 1, width, 1, 1, format, type,
10933 pixels, &ctx->Unpack));
10934 }
10935 if (ctx->ExecuteFlag) {
10936 CALL_MultiTexSubImage1DEXT(ctx->Exec, (texunit, target, level, xoffset, width,
10937 format, type, pixels));
10938 }
10939 }
10940
10941
10942 static void GLAPIENTRY
10943 save_MultiTexSubImage2DEXT(GLenum texunit, GLenum target, GLint level,
10944 GLint xoffset, GLint yoffset,
10945 GLsizei width, GLsizei height,
10946 GLenum format, GLenum type, const GLvoid * pixels)
10947 {
10948 GET_CURRENT_CONTEXT(ctx);
10949 Node *n;
10950
10951 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10952
10953 n = alloc_instruction(ctx, OPCODE_MULTITEX_SUB_IMAGE2D, 9 + POINTER_DWORDS);
10954 if (n) {
10955 n[1].e = texunit;
10956 n[2].e = target;
10957 n[3].i = level;
10958 n[4].i = xoffset;
10959 n[5].i = yoffset;
10960 n[6].i = (GLint) width;
10961 n[7].i = (GLint) height;
10962 n[8].e = format;
10963 n[9].e = type;
10964 save_pointer(&n[10],
10965 unpack_image(ctx, 2, width, height, 1, format, type,
10966 pixels, &ctx->Unpack));
10967 }
10968 if (ctx->ExecuteFlag) {
10969 CALL_MultiTexSubImage2DEXT(ctx->Exec, (texunit, target, level, xoffset, yoffset,
10970 width, height, format, type, pixels));
10971 }
10972 }
10973
10974
10975 static void GLAPIENTRY
10976 save_MultiTexSubImage3DEXT(GLenum texunit, GLenum target, GLint level,
10977 GLint xoffset, GLint yoffset, GLint zoffset,
10978 GLsizei width, GLsizei height, GLsizei depth,
10979 GLenum format, GLenum type, const GLvoid * pixels)
10980 {
10981 GET_CURRENT_CONTEXT(ctx);
10982 Node *n;
10983
10984 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10985
10986 n = alloc_instruction(ctx, OPCODE_MULTITEX_SUB_IMAGE3D, 11 + POINTER_DWORDS);
10987 if (n) {
10988 n[1].e = texunit;
10989 n[2].e = target;
10990 n[3].i = level;
10991 n[4].i = xoffset;
10992 n[5].i = yoffset;
10993 n[6].i = zoffset;
10994 n[7].i = (GLint) width;
10995 n[8].i = (GLint) height;
10996 n[9].i = (GLint) depth;
10997 n[10].e = format;
10998 n[11].e = type;
10999 save_pointer(&n[12],
11000 unpack_image(ctx, 3, width, height, depth, format, type,
11001 pixels, &ctx->Unpack));
11002 }
11003 if (ctx->ExecuteFlag) {
11004 CALL_MultiTexSubImage3DEXT(ctx->Exec, (texunit, target, level,
11005 xoffset, yoffset, zoffset,
11006 width, height, depth, format, type,
11007 pixels));
11008 }
11009 }
11010
11011
11012 static void GLAPIENTRY
11013 save_CopyMultiTexImage1DEXT(GLenum texunit, GLenum target, GLint level,
11014 GLenum internalformat, GLint x, GLint y,
11015 GLsizei width, GLint border)
11016 {
11017 GET_CURRENT_CONTEXT(ctx);
11018 Node *n;
11019 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
11020 n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_IMAGE1D, 8);
11021 if (n) {
11022 n[1].e = texunit;
11023 n[2].e = target;
11024 n[3].i = level;
11025 n[4].e = internalformat;
11026 n[5].i = x;
11027 n[6].i = y;
11028 n[7].i = width;
11029 n[8].i = border;
11030 }
11031 if (ctx->ExecuteFlag) {
11032 CALL_CopyMultiTexImage1DEXT(ctx->Exec, (texunit, target, level,
11033 internalformat, x, y,
11034 width, border));
11035 }
11036 }
11037
11038
11039 static void GLAPIENTRY
11040 save_CopyMultiTexImage2DEXT(GLenum texunit, GLenum target, GLint level,
11041 GLenum internalformat,
11042 GLint x, GLint y, GLsizei width,
11043 GLsizei height, GLint border)
11044 {
11045 GET_CURRENT_CONTEXT(ctx);
11046 Node *n;
11047 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
11048 n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_IMAGE2D, 9);
11049 if (n) {
11050 n[1].e = texunit;
11051 n[2].e = target;
11052 n[3].i = level;
11053 n[4].e = internalformat;
11054 n[5].i = x;
11055 n[6].i = y;
11056 n[7].i = width;
11057 n[8].i = height;
11058 n[9].i = border;
11059 }
11060 if (ctx->ExecuteFlag) {
11061 CALL_CopyMultiTexImage2DEXT(ctx->Exec, (texunit, target, level,
11062 internalformat, x, y,
11063 width, height, border));
11064 }
11065 }
11066
11067
11068 static void GLAPIENTRY
11069 save_CopyMultiTexSubImage1DEXT(GLenum texunit, GLenum target, GLint level,
11070 GLint xoffset, GLint x, GLint y, GLsizei width)
11071 {
11072 GET_CURRENT_CONTEXT(ctx);
11073 Node *n;
11074 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
11075 n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_SUB_IMAGE1D, 7);
11076 if (n) {
11077 n[1].e = texunit;
11078 n[2].e = target;
11079 n[3].i = level;
11080 n[4].i = xoffset;
11081 n[5].i = x;
11082 n[6].i = y;
11083 n[7].i = width;
11084 }
11085 if (ctx->ExecuteFlag) {
11086 CALL_CopyMultiTexSubImage1DEXT(ctx->Exec,
11087 (texunit, target, level, xoffset, x, y, width));
11088 }
11089 }
11090
11091
11092 static void GLAPIENTRY
11093 save_CopyMultiTexSubImage2DEXT(GLenum texunit, GLenum target, GLint level,
11094 GLint xoffset, GLint yoffset,
11095 GLint x, GLint y, GLsizei width, GLint height)
11096 {
11097 GET_CURRENT_CONTEXT(ctx);
11098 Node *n;
11099 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
11100 n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_SUB_IMAGE2D, 9);
11101 if (n) {
11102 n[1].e = texunit;
11103 n[2].e = target;
11104 n[3].i = level;
11105 n[4].i = xoffset;
11106 n[5].i = yoffset;
11107 n[6].i = x;
11108 n[7].i = y;
11109 n[8].i = width;
11110 n[9].i = height;
11111 }
11112 if (ctx->ExecuteFlag) {
11113 CALL_CopyMultiTexSubImage2DEXT(ctx->Exec, (texunit, target, level,
11114 xoffset, yoffset,
11115 x, y, width, height));
11116 }
11117 }
11118
11119
11120 static void GLAPIENTRY
11121 save_CopyMultiTexSubImage3DEXT(GLenum texunit, GLenum target, GLint level,
11122 GLint xoffset, GLint yoffset, GLint zoffset,
11123 GLint x, GLint y, GLsizei width, GLint height)
11124 {
11125 GET_CURRENT_CONTEXT(ctx);
11126 Node *n;
11127 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
11128 n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_SUB_IMAGE3D, 10);
11129 if (n) {
11130 n[1].e = texunit;
11131 n[2].e = target;
11132 n[3].i = level;
11133 n[4].i = xoffset;
11134 n[5].i = yoffset;
11135 n[6].i = zoffset;
11136 n[7].i = x;
11137 n[8].i = y;
11138 n[9].i = width;
11139 n[10].i = height;
11140 }
11141 if (ctx->ExecuteFlag) {
11142 CALL_CopyMultiTexSubImage3DEXT(ctx->Exec, (texunit, target, level,
11143 xoffset, yoffset, zoffset,
11144 x, y, width, height));
11145 }
11146 }
11147
11148
11149 static void GLAPIENTRY
11150 save_MultiTexEnvfvEXT(GLenum texunit, GLenum target, GLenum pname, const GLfloat *params)
11151 {
11152 GET_CURRENT_CONTEXT(ctx);
11153 Node *n;
11154 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
11155 n = alloc_instruction(ctx, OPCODE_MULTITEXENV, 7);
11156 if (n) {
11157 n[1].e = texunit;
11158 n[2].e = target;
11159 n[3].e = pname;
11160 if (pname == GL_TEXTURE_ENV_COLOR) {
11161 n[4].f = params[0];
11162 n[5].f = params[1];
11163 n[6].f = params[2];
11164 n[7].f = params[3];
11165 }
11166 else {
11167 n[4].f = params[0];
11168 n[5].f = n[6].f = n[7].f = 0.0F;
11169 }
11170 }
11171 if (ctx->ExecuteFlag) {
11172 CALL_MultiTexEnvfvEXT(ctx->Exec, (texunit, target, pname, params));
11173 }
11174 }
11175
11176
11177 static void GLAPIENTRY
11178 save_MultiTexEnvfEXT(GLenum texunit, GLenum target, GLenum pname, GLfloat param)
11179 {
11180 GLfloat parray[4];
11181 parray[0] = (GLfloat) param;
11182 parray[1] = parray[2] = parray[3] = 0.0F;
11183 save_MultiTexEnvfvEXT(texunit, target, pname, parray);
11184 }
11185
11186
11187 static void GLAPIENTRY
11188 save_MultiTexEnviEXT(GLenum texunit, GLenum target, GLenum pname, GLint param)
11189 {
11190 GLfloat p[4];
11191 p[0] = (GLfloat) param;
11192 p[1] = p[2] = p[3] = 0.0F;
11193 save_MultiTexEnvfvEXT(texunit, target, pname, p);
11194 }
11195
11196
11197 static void GLAPIENTRY
11198 save_MultiTexEnvivEXT(GLenum texunit, GLenum target, GLenum pname, const GLint * param)
11199 {
11200 GLfloat p[4];
11201 if (pname == GL_TEXTURE_ENV_COLOR) {
11202 p[0] = INT_TO_FLOAT(param[0]);
11203 p[1] = INT_TO_FLOAT(param[1]);
11204 p[2] = INT_TO_FLOAT(param[2]);
11205 p[3] = INT_TO_FLOAT(param[3]);
11206 }
11207 else {
11208 p[0] = (GLfloat) param[0];
11209 p[1] = p[2] = p[3] = 0.0F;
11210 }
11211 save_MultiTexEnvfvEXT(texunit, target, pname, p);
11212 }
11213
11214
11215 static void GLAPIENTRY
11216 save_CompressedTextureImage1DEXT(GLuint texture, GLenum target, GLint level,
11217 GLenum internalFormat, GLsizei width,
11218 GLint border, GLsizei imageSize,
11219 const GLvoid * data)
11220 {
11221 GET_CURRENT_CONTEXT(ctx);
11222 if (target == GL_PROXY_TEXTURE_1D) {
11223 /* don't compile, execute immediately */
11224 CALL_CompressedTextureImage1DEXT(ctx->Exec, (texture, target, level,
11225 internalFormat, width,
11226 border, imageSize,
11227 data));
11228 }
11229 else {
11230 Node *n;
11231 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
11232
11233 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_IMAGE_1D,
11234 7 + POINTER_DWORDS);
11235 if (n) {
11236 n[1].ui = texture;
11237 n[2].e = target;
11238 n[3].i = level;
11239 n[4].e = internalFormat;
11240 n[5].i = (GLint) width;
11241 n[6].i = border;
11242 n[7].i = imageSize;
11243 save_pointer(&n[8],
11244 copy_data(data, imageSize, "glCompressedTextureImage1DEXT"));
11245 }
11246 if (ctx->ExecuteFlag) {
11247 CALL_CompressedTextureImage1DEXT(ctx->Exec,
11248 (texture, target, level, internalFormat,
11249 width, border, imageSize, data));
11250 }
11251 }
11252 }
11253
11254
11255 static void GLAPIENTRY
11256 save_CompressedTextureImage2DEXT(GLuint texture, GLenum target, GLint level,
11257 GLenum internalFormat, GLsizei width,
11258 GLsizei height, GLint border, GLsizei imageSize,
11259 const GLvoid * data)
11260 {
11261 GET_CURRENT_CONTEXT(ctx);
11262 if (target == GL_PROXY_TEXTURE_2D) {
11263 /* don't compile, execute immediately */
11264 CALL_CompressedTextureImage2DEXT(ctx->Exec, (texture, target, level,
11265 internalFormat, width, height,
11266 border, imageSize, data));
11267 }
11268 else {
11269 Node *n;
11270 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
11271
11272 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_IMAGE_2D,
11273 8 + POINTER_DWORDS);
11274 if (n) {
11275 n[1].ui = texture;
11276 n[2].e = target;
11277 n[3].i = level;
11278 n[4].e = internalFormat;
11279 n[5].i = (GLint) width;
11280 n[6].i = (GLint) height;
11281 n[7].i = border;
11282 n[8].i = imageSize;
11283 save_pointer(&n[9],
11284 copy_data(data, imageSize, "glCompressedTextureImage2DEXT"));
11285 }
11286 if (ctx->ExecuteFlag) {
11287 CALL_CompressedTextureImage2DEXT(ctx->Exec,
11288 (texture, target, level, internalFormat,
11289 width, height, border, imageSize, data));
11290 }
11291 }
11292 }
11293
11294
11295 static void GLAPIENTRY
11296 save_CompressedTextureImage3DEXT(GLuint texture, GLenum target, GLint level,
11297 GLenum internalFormat, GLsizei width,
11298 GLsizei height, GLsizei depth, GLint border,
11299 GLsizei imageSize, const GLvoid * data)
11300 {
11301 GET_CURRENT_CONTEXT(ctx);
11302 if (target == GL_PROXY_TEXTURE_3D) {
11303 /* don't compile, execute immediately */
11304 CALL_CompressedTextureImage3DEXT(ctx->Exec, (texture, target, level,
11305 internalFormat, width,
11306 height, depth, border,
11307 imageSize, data));
11308 }
11309 else {
11310 Node *n;
11311 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
11312
11313 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_IMAGE_3D,
11314 9 + POINTER_DWORDS);
11315 if (n) {
11316 n[1].ui = texture;
11317 n[2].e = target;
11318 n[3].i = level;
11319 n[4].e = internalFormat;
11320 n[5].i = (GLint) width;
11321 n[6].i = (GLint) height;
11322 n[7].i = (GLint) depth;
11323 n[8].i = border;
11324 n[9].i = imageSize;
11325 save_pointer(&n[10],
11326 copy_data(data, imageSize, "glCompressedTextureImage3DEXT"));
11327 }
11328 if (ctx->ExecuteFlag) {
11329 CALL_CompressedTextureImage3DEXT(ctx->Exec,
11330 (texture, target, level, internalFormat,
11331 width, height, depth, border, imageSize,
11332 data));
11333 }
11334 }
11335 }
11336
11337
11338 static void GLAPIENTRY
11339 save_CompressedTextureSubImage1DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset,
11340 GLsizei width, GLenum format,
11341 GLsizei imageSize, const GLvoid * data)
11342 {
11343 Node *n;
11344 GET_CURRENT_CONTEXT(ctx);
11345 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
11346
11347 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_1D,
11348 7 + POINTER_DWORDS);
11349 if (n) {
11350 n[1].ui = texture;
11351 n[2].e = target;
11352 n[3].i = level;
11353 n[4].i = xoffset;
11354 n[5].i = (GLint) width;
11355 n[6].e = format;
11356 n[7].i = imageSize;
11357 save_pointer(&n[8],
11358 copy_data(data, imageSize, "glCompressedTextureSubImage1DEXT"));
11359 }
11360 if (ctx->ExecuteFlag) {
11361 CALL_CompressedTextureSubImage1DEXT(ctx->Exec, (texture, target, level, xoffset,
11362 width, format, imageSize, data));
11363 }
11364 }
11365
11366
11367 static void GLAPIENTRY
11368 save_CompressedTextureSubImage2DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset,
11369 GLint yoffset, GLsizei width, GLsizei height,
11370 GLenum format, GLsizei imageSize,
11371 const GLvoid * data)
11372 {
11373 Node *n;
11374 GET_CURRENT_CONTEXT(ctx);
11375 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
11376
11377 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_2D,
11378 9 + POINTER_DWORDS);
11379 if (n) {
11380 n[1].ui = texture;
11381 n[2].e = target;
11382 n[3].i = level;
11383 n[4].i = xoffset;
11384 n[5].i = yoffset;
11385 n[6].i = (GLint) width;
11386 n[7].i = (GLint) height;
11387 n[8].e = format;
11388 n[9].i = imageSize;
11389 save_pointer(&n[10],
11390 copy_data(data, imageSize, "glCompressedTextureSubImage2DEXT"));
11391 }
11392 if (ctx->ExecuteFlag) {
11393 CALL_CompressedTextureSubImage2DEXT(ctx->Exec,
11394 (texture, target, level, xoffset, yoffset,
11395 width, height, format, imageSize, data));
11396 }
11397 }
11398
11399
11400 static void GLAPIENTRY
11401 save_CompressedTextureSubImage3DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset,
11402 GLint yoffset, GLint zoffset, GLsizei width,
11403 GLsizei height, GLsizei depth, GLenum format,
11404 GLsizei imageSize, const GLvoid * data)
11405 {
11406 Node *n;
11407 GET_CURRENT_CONTEXT(ctx);
11408 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
11409
11410 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_3D,
11411 11 + POINTER_DWORDS);
11412 if (n) {
11413 n[1].ui = texture;
11414 n[2].e = target;
11415 n[3].i = level;
11416 n[4].i = xoffset;
11417 n[5].i = yoffset;
11418 n[6].i = zoffset;
11419 n[7].i = (GLint) width;
11420 n[8].i = (GLint) height;
11421 n[9].i = (GLint) depth;
11422 n[10].e = format;
11423 n[11].i = imageSize;
11424 save_pointer(&n[12],
11425 copy_data(data, imageSize, "glCompressedTextureSubImage3DEXT"));
11426 }
11427 if (ctx->ExecuteFlag) {
11428 CALL_CompressedTextureSubImage3DEXT(ctx->Exec,
11429 (texture, target, level, xoffset, yoffset,
11430 zoffset, width, height, depth, format,
11431 imageSize, data));
11432 }
11433 }
11434
11435
11436 static void GLAPIENTRY
11437 save_CompressedMultiTexImage1DEXT(GLenum texunit, GLenum target, GLint level,
11438 GLenum internalFormat, GLsizei width,
11439 GLint border, GLsizei imageSize,
11440 const GLvoid * data)
11441 {
11442 GET_CURRENT_CONTEXT(ctx);
11443 if (target == GL_PROXY_TEXTURE_1D) {
11444 /* don't compile, execute immediately */
11445 CALL_CompressedMultiTexImage1DEXT(ctx->Exec, (texunit, target, level,
11446 internalFormat, width,
11447 border, imageSize,
11448 data));
11449 }
11450 else {
11451 Node *n;
11452 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
11453
11454 n = alloc_instruction(ctx, OPCODE_COMPRESSED_MULTITEX_IMAGE_1D,
11455 7 + POINTER_DWORDS);
11456 if (n) {
11457 n[1].e = texunit;
11458 n[2].e = target;
11459 n[3].i = level;
11460 n[4].e = internalFormat;
11461 n[5].i = (GLint) width;
11462 n[6].i = border;
11463 n[7].i = imageSize;
11464 save_pointer(&n[8],
11465 copy_data(data, imageSize, "glCompressedMultiTexImage1DEXT"));
11466 }
11467 if (ctx->ExecuteFlag) {
11468 CALL_CompressedMultiTexImage1DEXT(ctx->Exec,
11469 (texunit, target, level, internalFormat,
11470 width, border, imageSize, data));
11471 }
11472 }
11473 }
11474
11475
11476 static void GLAPIENTRY
11477 save_CompressedMultiTexImage2DEXT(GLenum texunit, GLenum target, GLint level,
11478 GLenum internalFormat, GLsizei width,
11479 GLsizei height, GLint border, GLsizei imageSize,
11480 const GLvoid * data)
11481 {
11482 GET_CURRENT_CONTEXT(ctx);
11483 if (target == GL_PROXY_TEXTURE_2D) {
11484 /* don't compile, execute immediately */
11485 CALL_CompressedMultiTexImage2DEXT(ctx->Exec, (texunit, target, level,
11486 internalFormat, width, height,
11487 border, imageSize, data));
11488 }
11489 else {
11490 Node *n;
11491 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
11492
11493 n = alloc_instruction(ctx, OPCODE_COMPRESSED_MULTITEX_IMAGE_2D,
11494 8 + POINTER_DWORDS);
11495 if (n) {
11496 n[1].e = texunit;
11497 n[2].e = target;
11498 n[3].i = level;
11499 n[4].e = internalFormat;
11500 n[5].i = (GLint) width;
11501 n[6].i = (GLint) height;
11502 n[7].i = border;
11503 n[8].i = imageSize;
11504 save_pointer(&n[9],
11505 copy_data(data, imageSize, "glCompressedMultiTexImage2DEXT"));
11506 }
11507 if (ctx->ExecuteFlag) {
11508 CALL_CompressedMultiTexImage2DEXT(ctx->Exec,
11509 (texunit, target, level, internalFormat,
11510 width, height, border, imageSize, data));
11511 }
11512 }
11513 }
11514
11515
11516 static void GLAPIENTRY
11517 save_CompressedMultiTexImage3DEXT(GLenum texunit, GLenum target, GLint level,
11518 GLenum internalFormat, GLsizei width,
11519 GLsizei height, GLsizei depth, GLint border,
11520 GLsizei imageSize, const GLvoid * data)
11521 {
11522 GET_CURRENT_CONTEXT(ctx);
11523 if (target == GL_PROXY_TEXTURE_3D) {
11524 /* don't compile, execute immediately */
11525 CALL_CompressedMultiTexImage3DEXT(ctx->Exec, (texunit, target, level,
11526 internalFormat, width,
11527 height, depth, border,
11528 imageSize, data));
11529 }
11530 else {
11531 Node *n;
11532 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
11533
11534 n = alloc_instruction(ctx, OPCODE_COMPRESSED_MULTITEX_IMAGE_3D,
11535 9 + POINTER_DWORDS);
11536 if (n) {
11537 n[1].e = texunit;
11538 n[2].e = target;
11539 n[3].i = level;
11540 n[4].e = internalFormat;
11541 n[5].i = (GLint) width;
11542 n[6].i = (GLint) height;
11543 n[7].i = (GLint) depth;
11544 n[8].i = border;
11545 n[9].i = imageSize;
11546 save_pointer(&n[10],
11547 copy_data(data, imageSize, "glCompressedMultiTexImage3DEXT"));
11548 }
11549 if (ctx->ExecuteFlag) {
11550 CALL_CompressedMultiTexImage3DEXT(ctx->Exec,
11551 (texunit, target, level, internalFormat,
11552 width, height, depth, border, imageSize,
11553 data));
11554 }
11555 }
11556 }
11557
11558
11559 static void GLAPIENTRY
11560 save_CompressedMultiTexSubImage1DEXT(GLenum texunit, GLenum target, GLint level, GLint xoffset,
11561 GLsizei width, GLenum format,
11562 GLsizei imageSize, const GLvoid * data)
11563 {
11564 Node *n;
11565 GET_CURRENT_CONTEXT(ctx);
11566 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
11567
11568 n = alloc_instruction(ctx, OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_1D,
11569 7 + POINTER_DWORDS);
11570 if (n) {
11571 n[1].e = texunit;
11572 n[2].e = target;
11573 n[3].i = level;
11574 n[4].i = xoffset;
11575 n[5].i = (GLint) width;
11576 n[6].e = format;
11577 n[7].i = imageSize;
11578 save_pointer(&n[8],
11579 copy_data(data, imageSize, "glCompressedMultiTexSubImage1DEXT"));
11580 }
11581 if (ctx->ExecuteFlag) {
11582 CALL_CompressedMultiTexSubImage1DEXT(ctx->Exec, (texunit, target, level, xoffset,
11583 width, format, imageSize, data));
11584 }
11585 }
11586
11587
11588 static void GLAPIENTRY
11589 save_CompressedMultiTexSubImage2DEXT(GLenum texunit, GLenum target, GLint level, GLint xoffset,
11590 GLint yoffset, GLsizei width, GLsizei height,
11591 GLenum format, GLsizei imageSize,
11592 const GLvoid * data)
11593 {
11594 Node *n;
11595 GET_CURRENT_CONTEXT(ctx);
11596 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
11597
11598 n = alloc_instruction(ctx, OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_2D,
11599 9 + POINTER_DWORDS);
11600 if (n) {
11601 n[1].e = texunit;
11602 n[2].e = target;
11603 n[3].i = level;
11604 n[4].i = xoffset;
11605 n[5].i = yoffset;
11606 n[6].i = (GLint) width;
11607 n[7].i = (GLint) height;
11608 n[8].e = format;
11609 n[9].i = imageSize;
11610 save_pointer(&n[10],
11611 copy_data(data, imageSize, "glCompressedMultiTexSubImage2DEXT"));
11612 }
11613 if (ctx->ExecuteFlag) {
11614 CALL_CompressedMultiTexSubImage2DEXT(ctx->Exec,
11615 (texunit, target, level, xoffset, yoffset,
11616 width, height, format, imageSize, data));
11617 }
11618 }
11619
11620
11621 static void GLAPIENTRY
11622 save_CompressedMultiTexSubImage3DEXT(GLenum texunit, GLenum target, GLint level, GLint xoffset,
11623 GLint yoffset, GLint zoffset, GLsizei width,
11624 GLsizei height, GLsizei depth, GLenum format,
11625 GLsizei imageSize, const GLvoid * data)
11626 {
11627 Node *n;
11628 GET_CURRENT_CONTEXT(ctx);
11629 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
11630
11631 n = alloc_instruction(ctx, OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_3D,
11632 11 + POINTER_DWORDS);
11633 if (n) {
11634 n[1].e = texunit;
11635 n[2].e = target;
11636 n[3].i = level;
11637 n[4].i = xoffset;
11638 n[5].i = yoffset;
11639 n[6].i = zoffset;
11640 n[7].i = (GLint) width;
11641 n[8].i = (GLint) height;
11642 n[9].i = (GLint) depth;
11643 n[10].e = format;
11644 n[11].i = imageSize;
11645 save_pointer(&n[12],
11646 copy_data(data, imageSize, "glCompressedMultiTexSubImage3DEXT"));
11647 }
11648 if (ctx->ExecuteFlag) {
11649 CALL_CompressedMultiTexSubImage3DEXT(ctx->Exec,
11650 (texunit, target, level, xoffset, yoffset,
11651 zoffset, width, height, depth, format,
11652 imageSize, data));
11653 }
11654 }
11655
11656
11657 static void GLAPIENTRY
11658 save_NamedProgramStringEXT(GLuint program, GLenum target, GLenum format, GLsizei len,
11659 const GLvoid * string)
11660 {
11661 GET_CURRENT_CONTEXT(ctx);
11662 Node *n;
11663
11664 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
11665
11666 n = alloc_instruction(ctx, OPCODE_NAMED_PROGRAM_STRING, 4 + POINTER_DWORDS);
11667 if (n) {
11668 GLubyte *programCopy = malloc(len);
11669 if (!programCopy) {
11670 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glNamedProgramStringEXT");
11671 return;
11672 }
11673 memcpy(programCopy, string, len);
11674 n[1].ui = program;
11675 n[2].e = target;
11676 n[3].e = format;
11677 n[4].i = len;
11678 save_pointer(&n[5], programCopy);
11679 }
11680 if (ctx->ExecuteFlag) {
11681 CALL_NamedProgramStringEXT(ctx->Exec, (program, target, format, len, string));
11682 }
11683 }
11684
11685
11686 static void GLAPIENTRY
11687 save_NamedProgramLocalParameter4fEXT(GLuint program, GLenum target, GLuint index,
11688 GLfloat x, GLfloat y, GLfloat z, GLfloat w)
11689 {
11690 GET_CURRENT_CONTEXT(ctx);
11691 Node *n;
11692 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
11693 n = alloc_instruction(ctx, OPCODE_NAMED_PROGRAM_LOCAL_PARAMETER, 7);
11694 if (n) {
11695 n[1].ui = program;
11696 n[2].e = target;
11697 n[3].ui = index;
11698 n[4].f = x;
11699 n[5].f = y;
11700 n[6].f = z;
11701 n[7].f = w;
11702 }
11703 if (ctx->ExecuteFlag) {
11704 CALL_NamedProgramLocalParameter4fEXT(ctx->Exec, (program, target, index, x, y, z, w));
11705 }
11706 }
11707
11708
11709 static void GLAPIENTRY
11710 save_NamedProgramLocalParameter4fvEXT(GLuint program, GLenum target, GLuint index,
11711 const GLfloat *params)
11712 {
11713 save_NamedProgramLocalParameter4fEXT(program, target, index, params[0],
11714 params[1], params[2], params[3]);
11715 }
11716
11717
11718 static void GLAPIENTRY
11719 save_NamedProgramLocalParameter4dEXT(GLuint program, GLenum target, GLuint index,
11720 GLdouble x, GLdouble y,
11721 GLdouble z, GLdouble w)
11722 {
11723 save_NamedProgramLocalParameter4fEXT(program, target, index, (GLfloat) x,
11724 (GLfloat) y, (GLfloat) z, (GLfloat) w);
11725 }
11726
11727
11728 static void GLAPIENTRY
11729 save_NamedProgramLocalParameter4dvEXT(GLuint program, GLenum target, GLuint index,
11730 const GLdouble *params)
11731 {
11732 save_NamedProgramLocalParameter4fEXT(program, target, index, (GLfloat) params[0],
11733 (GLfloat) params[1], (GLfloat) params[2],
11734 (GLfloat) params[3]);
11735 }
11736
11737
11738 /**
11739 * Save an error-generating command into display list.
11740 *
11741 * KW: Will appear in the list before the vertex buffer containing the
11742 * command that provoked the error. I don't see this as a problem.
11743 */
11744 static void
11745 save_error(struct gl_context *ctx, GLenum error, const char *s)
11746 {
11747 Node *n;
11748 n = alloc_instruction(ctx, OPCODE_ERROR, 1 + POINTER_DWORDS);
11749 if (n) {
11750 n[1].e = error;
11751 save_pointer(&n[2], (void *) s);
11752 /* note: the data/string here doesn't have to be freed in
11753 * _mesa_delete_list() since the string is never dynamically
11754 * allocated.
11755 */
11756 }
11757 }
11758
11759
11760 /**
11761 * Compile an error into current display list.
11762 */
11763 void
11764 _mesa_compile_error(struct gl_context *ctx, GLenum error, const char *s)
11765 {
11766 if (ctx->CompileFlag)
11767 save_error(ctx, error, s);
11768 if (ctx->ExecuteFlag)
11769 _mesa_error(ctx, error, "%s", s);
11770 }
11771
11772
11773 /**
11774 * Test if ID names a display list.
11775 */
11776 static GLboolean
11777 islist(struct gl_context *ctx, GLuint list)
11778 {
11779 if (list > 0 && _mesa_lookup_list(ctx, list)) {
11780 return GL_TRUE;
11781 }
11782 else {
11783 return GL_FALSE;
11784 }
11785 }
11786
11787
11788
11789 /**********************************************************************/
11790 /* Display list execution */
11791 /**********************************************************************/
11792
11793
11794 /*
11795 * Execute a display list. Note that the ListBase offset must have already
11796 * been added before calling this function. I.e. the list argument is
11797 * the absolute list number, not relative to ListBase.
11798 * \param list - display list number
11799 */
11800 static void
11801 execute_list(struct gl_context *ctx, GLuint list)
11802 {
11803 struct gl_display_list *dlist;
11804 Node *n;
11805 GLboolean done;
11806
11807 if (list == 0 || !islist(ctx, list))
11808 return;
11809
11810 if (ctx->ListState.CallDepth == MAX_LIST_NESTING) {
11811 /* raise an error? */
11812 return;
11813 }
11814
11815 dlist = _mesa_lookup_list(ctx, list);
11816 if (!dlist)
11817 return;
11818
11819 ctx->ListState.CallDepth++;
11820
11821 vbo_save_BeginCallList(ctx, dlist);
11822
11823 n = dlist->Head;
11824
11825 done = GL_FALSE;
11826 while (!done) {
11827 const OpCode opcode = n[0].opcode;
11828
11829 if (is_ext_opcode(opcode)) {
11830 n += ext_opcode_execute(ctx, n);
11831 }
11832 else {
11833 switch (opcode) {
11834 case OPCODE_ERROR:
11835 _mesa_error(ctx, n[1].e, "%s", (const char *) get_pointer(&n[2]));
11836 break;
11837 case OPCODE_ACCUM:
11838 CALL_Accum(ctx->Exec, (n[1].e, n[2].f));
11839 break;
11840 case OPCODE_ALPHA_FUNC:
11841 CALL_AlphaFunc(ctx->Exec, (n[1].e, n[2].f));
11842 break;
11843 case OPCODE_BIND_TEXTURE:
11844 CALL_BindTexture(ctx->Exec, (n[1].e, n[2].ui));
11845 break;
11846 case OPCODE_BITMAP:
11847 {
11848 const struct gl_pixelstore_attrib save = ctx->Unpack;
11849 ctx->Unpack = ctx->DefaultPacking;
11850 CALL_Bitmap(ctx->Exec, ((GLsizei) n[1].i, (GLsizei) n[2].i,
11851 n[3].f, n[4].f, n[5].f, n[6].f,
11852 get_pointer(&n[7])));
11853 ctx->Unpack = save; /* restore */
11854 }
11855 break;
11856 case OPCODE_BLEND_COLOR:
11857 CALL_BlendColor(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
11858 break;
11859 case OPCODE_BLEND_EQUATION:
11860 CALL_BlendEquation(ctx->Exec, (n[1].e));
11861 break;
11862 case OPCODE_BLEND_EQUATION_SEPARATE:
11863 CALL_BlendEquationSeparate(ctx->Exec, (n[1].e, n[2].e));
11864 break;
11865 case OPCODE_BLEND_FUNC_SEPARATE:
11866 CALL_BlendFuncSeparate(ctx->Exec,
11867 (n[1].e, n[2].e, n[3].e, n[4].e));
11868 break;
11869
11870 case OPCODE_BLEND_FUNC_I:
11871 /* GL_ARB_draw_buffers_blend */
11872 CALL_BlendFunciARB(ctx->Exec, (n[1].ui, n[2].e, n[3].e));
11873 break;
11874 case OPCODE_BLEND_FUNC_SEPARATE_I:
11875 /* GL_ARB_draw_buffers_blend */
11876 CALL_BlendFuncSeparateiARB(ctx->Exec, (n[1].ui, n[2].e, n[3].e,
11877 n[4].e, n[5].e));
11878 break;
11879 case OPCODE_BLEND_EQUATION_I:
11880 /* GL_ARB_draw_buffers_blend */
11881 CALL_BlendEquationiARB(ctx->Exec, (n[1].ui, n[2].e));
11882 break;
11883 case OPCODE_BLEND_EQUATION_SEPARATE_I:
11884 /* GL_ARB_draw_buffers_blend */
11885 CALL_BlendEquationSeparateiARB(ctx->Exec,
11886 (n[1].ui, n[2].e, n[3].e));
11887 break;
11888
11889 case OPCODE_CALL_LIST:
11890 /* Generated by glCallList(), don't add ListBase */
11891 if (ctx->ListState.CallDepth < MAX_LIST_NESTING) {
11892 execute_list(ctx, n[1].ui);
11893 }
11894 break;
11895 case OPCODE_CALL_LISTS:
11896 if (ctx->ListState.CallDepth < MAX_LIST_NESTING) {
11897 CALL_CallLists(ctx->Exec, (n[1].i, n[2].e, get_pointer(&n[3])));
11898 }
11899 break;
11900 case OPCODE_CLEAR:
11901 CALL_Clear(ctx->Exec, (n[1].bf));
11902 break;
11903 case OPCODE_CLEAR_BUFFER_IV:
11904 {
11905 GLint value[4];
11906 value[0] = n[3].i;
11907 value[1] = n[4].i;
11908 value[2] = n[5].i;
11909 value[3] = n[6].i;
11910 CALL_ClearBufferiv(ctx->Exec, (n[1].e, n[2].i, value));
11911 }
11912 break;
11913 case OPCODE_CLEAR_BUFFER_UIV:
11914 {
11915 GLuint value[4];
11916 value[0] = n[3].ui;
11917 value[1] = n[4].ui;
11918 value[2] = n[5].ui;
11919 value[3] = n[6].ui;
11920 CALL_ClearBufferuiv(ctx->Exec, (n[1].e, n[2].i, value));
11921 }
11922 break;
11923 case OPCODE_CLEAR_BUFFER_FV:
11924 {
11925 GLfloat value[4];
11926 value[0] = n[3].f;
11927 value[1] = n[4].f;
11928 value[2] = n[5].f;
11929 value[3] = n[6].f;
11930 CALL_ClearBufferfv(ctx->Exec, (n[1].e, n[2].i, value));
11931 }
11932 break;
11933 case OPCODE_CLEAR_BUFFER_FI:
11934 CALL_ClearBufferfi(ctx->Exec, (n[1].e, n[2].i, n[3].f, n[4].i));
11935 break;
11936 case OPCODE_CLEAR_COLOR:
11937 CALL_ClearColor(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
11938 break;
11939 case OPCODE_CLEAR_ACCUM:
11940 CALL_ClearAccum(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
11941 break;
11942 case OPCODE_CLEAR_DEPTH:
11943 CALL_ClearDepth(ctx->Exec, ((GLclampd) n[1].f));
11944 break;
11945 case OPCODE_CLEAR_INDEX:
11946 CALL_ClearIndex(ctx->Exec, ((GLfloat) n[1].ui));
11947 break;
11948 case OPCODE_CLEAR_STENCIL:
11949 CALL_ClearStencil(ctx->Exec, (n[1].i));
11950 break;
11951 case OPCODE_CLIP_PLANE:
11952 {
11953 GLdouble eq[4];
11954 eq[0] = n[2].f;
11955 eq[1] = n[3].f;
11956 eq[2] = n[4].f;
11957 eq[3] = n[5].f;
11958 CALL_ClipPlane(ctx->Exec, (n[1].e, eq));
11959 }
11960 break;
11961 case OPCODE_COLOR_MASK:
11962 CALL_ColorMask(ctx->Exec, (n[1].b, n[2].b, n[3].b, n[4].b));
11963 break;
11964 case OPCODE_COLOR_MASK_INDEXED:
11965 CALL_ColorMaski(ctx->Exec, (n[1].ui, n[2].b, n[3].b,
11966 n[4].b, n[5].b));
11967 break;
11968 case OPCODE_COLOR_MATERIAL:
11969 CALL_ColorMaterial(ctx->Exec, (n[1].e, n[2].e));
11970 break;
11971 case OPCODE_COPY_PIXELS:
11972 CALL_CopyPixels(ctx->Exec, (n[1].i, n[2].i,
11973 (GLsizei) n[3].i, (GLsizei) n[4].i,
11974 n[5].e));
11975 break;
11976 case OPCODE_COPY_TEX_IMAGE1D:
11977 CALL_CopyTexImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].e, n[4].i,
11978 n[5].i, n[6].i, n[7].i));
11979 break;
11980 case OPCODE_COPY_TEX_IMAGE2D:
11981 CALL_CopyTexImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].e, n[4].i,
11982 n[5].i, n[6].i, n[7].i, n[8].i));
11983 break;
11984 case OPCODE_COPY_TEX_SUB_IMAGE1D:
11985 CALL_CopyTexSubImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
11986 n[4].i, n[5].i, n[6].i));
11987 break;
11988 case OPCODE_COPY_TEX_SUB_IMAGE2D:
11989 CALL_CopyTexSubImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
11990 n[4].i, n[5].i, n[6].i, n[7].i,
11991 n[8].i));
11992 break;
11993 case OPCODE_COPY_TEX_SUB_IMAGE3D:
11994 CALL_CopyTexSubImage3D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
11995 n[4].i, n[5].i, n[6].i, n[7].i,
11996 n[8].i, n[9].i));
11997 break;
11998 case OPCODE_CULL_FACE:
11999 CALL_CullFace(ctx->Exec, (n[1].e));
12000 break;
12001 case OPCODE_DEPTH_FUNC:
12002 CALL_DepthFunc(ctx->Exec, (n[1].e));
12003 break;
12004 case OPCODE_DEPTH_MASK:
12005 CALL_DepthMask(ctx->Exec, (n[1].b));
12006 break;
12007 case OPCODE_DEPTH_RANGE:
12008 CALL_DepthRange(ctx->Exec,
12009 ((GLclampd) n[1].f, (GLclampd) n[2].f));
12010 break;
12011 case OPCODE_DISABLE:
12012 CALL_Disable(ctx->Exec, (n[1].e));
12013 break;
12014 case OPCODE_DISABLE_INDEXED:
12015 CALL_Disablei(ctx->Exec, (n[1].ui, n[2].e));
12016 break;
12017 case OPCODE_DRAW_BUFFER:
12018 CALL_DrawBuffer(ctx->Exec, (n[1].e));
12019 break;
12020 case OPCODE_DRAW_PIXELS:
12021 {
12022 const struct gl_pixelstore_attrib save = ctx->Unpack;
12023 ctx->Unpack = ctx->DefaultPacking;
12024 CALL_DrawPixels(ctx->Exec, (n[1].i, n[2].i, n[3].e, n[4].e,
12025 get_pointer(&n[5])));
12026 ctx->Unpack = save; /* restore */
12027 }
12028 break;
12029 case OPCODE_ENABLE:
12030 CALL_Enable(ctx->Exec, (n[1].e));
12031 break;
12032 case OPCODE_ENABLE_INDEXED:
12033 CALL_Enablei(ctx->Exec, (n[1].ui, n[2].e));
12034 break;
12035 case OPCODE_EVALMESH1:
12036 CALL_EvalMesh1(ctx->Exec, (n[1].e, n[2].i, n[3].i));
12037 break;
12038 case OPCODE_EVALMESH2:
12039 CALL_EvalMesh2(ctx->Exec,
12040 (n[1].e, n[2].i, n[3].i, n[4].i, n[5].i));
12041 break;
12042 case OPCODE_FOG:
12043 {
12044 GLfloat p[4];
12045 p[0] = n[2].f;
12046 p[1] = n[3].f;
12047 p[2] = n[4].f;
12048 p[3] = n[5].f;
12049 CALL_Fogfv(ctx->Exec, (n[1].e, p));
12050 }
12051 break;
12052 case OPCODE_FRONT_FACE:
12053 CALL_FrontFace(ctx->Exec, (n[1].e));
12054 break;
12055 case OPCODE_FRUSTUM:
12056 CALL_Frustum(ctx->Exec,
12057 (n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f));
12058 break;
12059 case OPCODE_HINT:
12060 CALL_Hint(ctx->Exec, (n[1].e, n[2].e));
12061 break;
12062 case OPCODE_INDEX_MASK:
12063 CALL_IndexMask(ctx->Exec, (n[1].ui));
12064 break;
12065 case OPCODE_INIT_NAMES:
12066 CALL_InitNames(ctx->Exec, ());
12067 break;
12068 case OPCODE_LIGHT:
12069 {
12070 GLfloat p[4];
12071 p[0] = n[3].f;
12072 p[1] = n[4].f;
12073 p[2] = n[5].f;
12074 p[3] = n[6].f;
12075 CALL_Lightfv(ctx->Exec, (n[1].e, n[2].e, p));
12076 }
12077 break;
12078 case OPCODE_LIGHT_MODEL:
12079 {
12080 GLfloat p[4];
12081 p[0] = n[2].f;
12082 p[1] = n[3].f;
12083 p[2] = n[4].f;
12084 p[3] = n[5].f;
12085 CALL_LightModelfv(ctx->Exec, (n[1].e, p));
12086 }
12087 break;
12088 case OPCODE_LINE_STIPPLE:
12089 CALL_LineStipple(ctx->Exec, (n[1].i, n[2].us));
12090 break;
12091 case OPCODE_LINE_WIDTH:
12092 CALL_LineWidth(ctx->Exec, (n[1].f));
12093 break;
12094 case OPCODE_LIST_BASE:
12095 CALL_ListBase(ctx->Exec, (n[1].ui));
12096 break;
12097 case OPCODE_LOAD_IDENTITY:
12098 CALL_LoadIdentity(ctx->Exec, ());
12099 break;
12100 case OPCODE_LOAD_MATRIX:
12101 STATIC_ASSERT(sizeof(Node) == sizeof(GLfloat));
12102 CALL_LoadMatrixf(ctx->Exec, (&n[1].f));
12103 break;
12104 case OPCODE_LOAD_NAME:
12105 CALL_LoadName(ctx->Exec, (n[1].ui));
12106 break;
12107 case OPCODE_LOGIC_OP:
12108 CALL_LogicOp(ctx->Exec, (n[1].e));
12109 break;
12110 case OPCODE_MAP1:
12111 {
12112 GLenum target = n[1].e;
12113 GLint ustride = _mesa_evaluator_components(target);
12114 GLint uorder = n[5].i;
12115 GLfloat u1 = n[2].f;
12116 GLfloat u2 = n[3].f;
12117 CALL_Map1f(ctx->Exec, (target, u1, u2, ustride, uorder,
12118 (GLfloat *) get_pointer(&n[6])));
12119 }
12120 break;
12121 case OPCODE_MAP2:
12122 {
12123 GLenum target = n[1].e;
12124 GLfloat u1 = n[2].f;
12125 GLfloat u2 = n[3].f;
12126 GLfloat v1 = n[4].f;
12127 GLfloat v2 = n[5].f;
12128 GLint ustride = n[6].i;
12129 GLint vstride = n[7].i;
12130 GLint uorder = n[8].i;
12131 GLint vorder = n[9].i;
12132 CALL_Map2f(ctx->Exec, (target, u1, u2, ustride, uorder,
12133 v1, v2, vstride, vorder,
12134 (GLfloat *) get_pointer(&n[10])));
12135 }
12136 break;
12137 case OPCODE_MAPGRID1:
12138 CALL_MapGrid1f(ctx->Exec, (n[1].i, n[2].f, n[3].f));
12139 break;
12140 case OPCODE_MAPGRID2:
12141 CALL_MapGrid2f(ctx->Exec,
12142 (n[1].i, n[2].f, n[3].f, n[4].i, n[5].f, n[6].f));
12143 break;
12144 case OPCODE_MATRIX_MODE:
12145 CALL_MatrixMode(ctx->Exec, (n[1].e));
12146 break;
12147 case OPCODE_MULT_MATRIX:
12148 CALL_MultMatrixf(ctx->Exec, (&n[1].f));
12149 break;
12150 case OPCODE_ORTHO:
12151 CALL_Ortho(ctx->Exec,
12152 (n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f));
12153 break;
12154 case OPCODE_PASSTHROUGH:
12155 CALL_PassThrough(ctx->Exec, (n[1].f));
12156 break;
12157 case OPCODE_PATCH_PARAMETER_I:
12158 CALL_PatchParameteri(ctx->Exec, (n[1].e, n[2].i));
12159 break;
12160 case OPCODE_PATCH_PARAMETER_FV_INNER:
12161 {
12162 GLfloat params[2];
12163 params[0] = n[2].f;
12164 params[1] = n[3].f;
12165 CALL_PatchParameterfv(ctx->Exec, (n[1].e, params));
12166 }
12167 break;
12168 case OPCODE_PATCH_PARAMETER_FV_OUTER:
12169 {
12170 GLfloat params[4];
12171 params[0] = n[2].f;
12172 params[1] = n[3].f;
12173 params[2] = n[4].f;
12174 params[3] = n[5].f;
12175 CALL_PatchParameterfv(ctx->Exec, (n[1].e, params));
12176 }
12177 break;
12178 case OPCODE_PIXEL_MAP:
12179 CALL_PixelMapfv(ctx->Exec,
12180 (n[1].e, n[2].i, get_pointer(&n[3])));
12181 break;
12182 case OPCODE_PIXEL_TRANSFER:
12183 CALL_PixelTransferf(ctx->Exec, (n[1].e, n[2].f));
12184 break;
12185 case OPCODE_PIXEL_ZOOM:
12186 CALL_PixelZoom(ctx->Exec, (n[1].f, n[2].f));
12187 break;
12188 case OPCODE_POINT_SIZE:
12189 CALL_PointSize(ctx->Exec, (n[1].f));
12190 break;
12191 case OPCODE_POINT_PARAMETERS:
12192 {
12193 GLfloat params[3];
12194 params[0] = n[2].f;
12195 params[1] = n[3].f;
12196 params[2] = n[4].f;
12197 CALL_PointParameterfv(ctx->Exec, (n[1].e, params));
12198 }
12199 break;
12200 case OPCODE_POLYGON_MODE:
12201 CALL_PolygonMode(ctx->Exec, (n[1].e, n[2].e));
12202 break;
12203 case OPCODE_POLYGON_STIPPLE:
12204 {
12205 const struct gl_pixelstore_attrib save = ctx->Unpack;
12206 ctx->Unpack = ctx->DefaultPacking;
12207 CALL_PolygonStipple(ctx->Exec, (get_pointer(&n[1])));
12208 ctx->Unpack = save; /* restore */
12209 }
12210 break;
12211 case OPCODE_POLYGON_OFFSET:
12212 CALL_PolygonOffset(ctx->Exec, (n[1].f, n[2].f));
12213 break;
12214 case OPCODE_POLYGON_OFFSET_CLAMP:
12215 CALL_PolygonOffsetClampEXT(ctx->Exec, (n[1].f, n[2].f, n[3].f));
12216 break;
12217 case OPCODE_POP_ATTRIB:
12218 CALL_PopAttrib(ctx->Exec, ());
12219 break;
12220 case OPCODE_POP_MATRIX:
12221 CALL_PopMatrix(ctx->Exec, ());
12222 break;
12223 case OPCODE_POP_NAME:
12224 CALL_PopName(ctx->Exec, ());
12225 break;
12226 case OPCODE_PRIORITIZE_TEXTURE:
12227 CALL_PrioritizeTextures(ctx->Exec, (1, &n[1].ui, &n[2].f));
12228 break;
12229 case OPCODE_PUSH_ATTRIB:
12230 CALL_PushAttrib(ctx->Exec, (n[1].bf));
12231 break;
12232 case OPCODE_PUSH_MATRIX:
12233 CALL_PushMatrix(ctx->Exec, ());
12234 break;
12235 case OPCODE_PUSH_NAME:
12236 CALL_PushName(ctx->Exec, (n[1].ui));
12237 break;
12238 case OPCODE_RASTER_POS:
12239 CALL_RasterPos4f(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
12240 break;
12241 case OPCODE_READ_BUFFER:
12242 CALL_ReadBuffer(ctx->Exec, (n[1].e));
12243 break;
12244 case OPCODE_ROTATE:
12245 CALL_Rotatef(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
12246 break;
12247 case OPCODE_SCALE:
12248 CALL_Scalef(ctx->Exec, (n[1].f, n[2].f, n[3].f));
12249 break;
12250 case OPCODE_SCISSOR:
12251 CALL_Scissor(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
12252 break;
12253 case OPCODE_SHADE_MODEL:
12254 CALL_ShadeModel(ctx->Exec, (n[1].e));
12255 break;
12256 case OPCODE_PROVOKING_VERTEX:
12257 CALL_ProvokingVertex(ctx->Exec, (n[1].e));
12258 break;
12259 case OPCODE_STENCIL_FUNC:
12260 CALL_StencilFunc(ctx->Exec, (n[1].e, n[2].i, n[3].ui));
12261 break;
12262 case OPCODE_STENCIL_MASK:
12263 CALL_StencilMask(ctx->Exec, (n[1].ui));
12264 break;
12265 case OPCODE_STENCIL_OP:
12266 CALL_StencilOp(ctx->Exec, (n[1].e, n[2].e, n[3].e));
12267 break;
12268 case OPCODE_STENCIL_FUNC_SEPARATE:
12269 CALL_StencilFuncSeparate(ctx->Exec,
12270 (n[1].e, n[2].e, n[3].i, n[4].ui));
12271 break;
12272 case OPCODE_STENCIL_MASK_SEPARATE:
12273 CALL_StencilMaskSeparate(ctx->Exec, (n[1].e, n[2].ui));
12274 break;
12275 case OPCODE_STENCIL_OP_SEPARATE:
12276 CALL_StencilOpSeparate(ctx->Exec,
12277 (n[1].e, n[2].e, n[3].e, n[4].e));
12278 break;
12279 case OPCODE_TEXENV:
12280 {
12281 GLfloat params[4];
12282 params[0] = n[3].f;
12283 params[1] = n[4].f;
12284 params[2] = n[5].f;
12285 params[3] = n[6].f;
12286 CALL_TexEnvfv(ctx->Exec, (n[1].e, n[2].e, params));
12287 }
12288 break;
12289 case OPCODE_TEXGEN:
12290 {
12291 GLfloat params[4];
12292 params[0] = n[3].f;
12293 params[1] = n[4].f;
12294 params[2] = n[5].f;
12295 params[3] = n[6].f;
12296 CALL_TexGenfv(ctx->Exec, (n[1].e, n[2].e, params));
12297 }
12298 break;
12299 case OPCODE_TEXPARAMETER:
12300 {
12301 GLfloat params[4];
12302 params[0] = n[3].f;
12303 params[1] = n[4].f;
12304 params[2] = n[5].f;
12305 params[3] = n[6].f;
12306 CALL_TexParameterfv(ctx->Exec, (n[1].e, n[2].e, params));
12307 }
12308 break;
12309 case OPCODE_TEX_IMAGE1D:
12310 {
12311 const struct gl_pixelstore_attrib save = ctx->Unpack;
12312 ctx->Unpack = ctx->DefaultPacking;
12313 CALL_TexImage1D(ctx->Exec, (n[1].e, /* target */
12314 n[2].i, /* level */
12315 n[3].i, /* components */
12316 n[4].i, /* width */
12317 n[5].e, /* border */
12318 n[6].e, /* format */
12319 n[7].e, /* type */
12320 get_pointer(&n[8])));
12321 ctx->Unpack = save; /* restore */
12322 }
12323 break;
12324 case OPCODE_TEX_IMAGE2D:
12325 {
12326 const struct gl_pixelstore_attrib save = ctx->Unpack;
12327 ctx->Unpack = ctx->DefaultPacking;
12328 CALL_TexImage2D(ctx->Exec, (n[1].e, /* target */
12329 n[2].i, /* level */
12330 n[3].i, /* components */
12331 n[4].i, /* width */
12332 n[5].i, /* height */
12333 n[6].e, /* border */
12334 n[7].e, /* format */
12335 n[8].e, /* type */
12336 get_pointer(&n[9])));
12337 ctx->Unpack = save; /* restore */
12338 }
12339 break;
12340 case OPCODE_TEX_IMAGE3D:
12341 {
12342 const struct gl_pixelstore_attrib save = ctx->Unpack;
12343 ctx->Unpack = ctx->DefaultPacking;
12344 CALL_TexImage3D(ctx->Exec, (n[1].e, /* target */
12345 n[2].i, /* level */
12346 n[3].i, /* components */
12347 n[4].i, /* width */
12348 n[5].i, /* height */
12349 n[6].i, /* depth */
12350 n[7].e, /* border */
12351 n[8].e, /* format */
12352 n[9].e, /* type */
12353 get_pointer(&n[10])));
12354 ctx->Unpack = save; /* restore */
12355 }
12356 break;
12357 case OPCODE_TEX_SUB_IMAGE1D:
12358 {
12359 const struct gl_pixelstore_attrib save = ctx->Unpack;
12360 ctx->Unpack = ctx->DefaultPacking;
12361 CALL_TexSubImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
12362 n[4].i, n[5].e,
12363 n[6].e, get_pointer(&n[7])));
12364 ctx->Unpack = save; /* restore */
12365 }
12366 break;
12367 case OPCODE_TEX_SUB_IMAGE2D:
12368 {
12369 const struct gl_pixelstore_attrib save = ctx->Unpack;
12370 ctx->Unpack = ctx->DefaultPacking;
12371 CALL_TexSubImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
12372 n[4].i, n[5].e,
12373 n[6].i, n[7].e, n[8].e,
12374 get_pointer(&n[9])));
12375 ctx->Unpack = save; /* restore */
12376 }
12377 break;
12378 case OPCODE_TEX_SUB_IMAGE3D:
12379 {
12380 const struct gl_pixelstore_attrib save = ctx->Unpack;
12381 ctx->Unpack = ctx->DefaultPacking;
12382 CALL_TexSubImage3D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
12383 n[4].i, n[5].i, n[6].i, n[7].i,
12384 n[8].i, n[9].e, n[10].e,
12385 get_pointer(&n[11])));
12386 ctx->Unpack = save; /* restore */
12387 }
12388 break;
12389 case OPCODE_TRANSLATE:
12390 CALL_Translatef(ctx->Exec, (n[1].f, n[2].f, n[3].f));
12391 break;
12392 case OPCODE_VIEWPORT:
12393 CALL_Viewport(ctx->Exec, (n[1].i, n[2].i,
12394 (GLsizei) n[3].i, (GLsizei) n[4].i));
12395 break;
12396 case OPCODE_WINDOW_POS:
12397 CALL_WindowPos4fMESA(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
12398 break;
12399 case OPCODE_VIEWPORT_ARRAY_V:
12400 CALL_ViewportArrayv(ctx->Exec, (n[1].ui, n[2].si,
12401 get_pointer(&n[3])));
12402 break;
12403 case OPCODE_VIEWPORT_INDEXED_F:
12404 CALL_ViewportIndexedf(ctx->Exec, (n[1].ui, n[2].f, n[3].f, n[4].f,
12405 n[5].f));
12406 break;
12407 case OPCODE_VIEWPORT_INDEXED_FV: {
12408 GLfloat v[4];
12409 v[0] = n[2].f;
12410 v[1] = n[3].f;
12411 v[2] = n[4].f;
12412 v[3] = n[5].f;
12413 CALL_ViewportIndexedfv(ctx->Exec, (n[1].ui, v));
12414 break;
12415 }
12416 case OPCODE_SCISSOR_ARRAY_V:
12417 CALL_ScissorArrayv(ctx->Exec, (n[1].ui, n[2].si,
12418 get_pointer(&n[3])));
12419 break;
12420 case OPCODE_SCISSOR_INDEXED:
12421 CALL_ScissorIndexed(ctx->Exec, (n[1].ui, n[2].i, n[3].i, n[4].si,
12422 n[5].si));
12423 break;
12424 case OPCODE_SCISSOR_INDEXED_V: {
12425 GLint v[4];
12426 v[0] = n[2].i;
12427 v[1] = n[3].i;
12428 v[2] = n[4].si;
12429 v[3] = n[5].si;
12430 CALL_ScissorIndexedv(ctx->Exec, (n[1].ui, v));
12431 break;
12432 }
12433 case OPCODE_DEPTH_ARRAY_V:
12434 CALL_DepthRangeArrayv(ctx->Exec, (n[1].ui, n[2].si,
12435 get_pointer(&n[3])));
12436 break;
12437 case OPCODE_DEPTH_INDEXED:
12438 CALL_DepthRangeIndexed(ctx->Exec, (n[1].ui, n[2].f, n[3].f));
12439 break;
12440 case OPCODE_ACTIVE_TEXTURE: /* GL_ARB_multitexture */
12441 CALL_ActiveTexture(ctx->Exec, (n[1].e));
12442 break;
12443 case OPCODE_COMPRESSED_TEX_IMAGE_1D: /* GL_ARB_texture_compression */
12444 CALL_CompressedTexImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].e,
12445 n[4].i, n[5].i, n[6].i,
12446 get_pointer(&n[7])));
12447 break;
12448 case OPCODE_COMPRESSED_TEX_IMAGE_2D: /* GL_ARB_texture_compression */
12449 CALL_CompressedTexImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].e,
12450 n[4].i, n[5].i, n[6].i,
12451 n[7].i, get_pointer(&n[8])));
12452 break;
12453 case OPCODE_COMPRESSED_TEX_IMAGE_3D: /* GL_ARB_texture_compression */
12454 CALL_CompressedTexImage3D(ctx->Exec, (n[1].e, n[2].i, n[3].e,
12455 n[4].i, n[5].i, n[6].i,
12456 n[7].i, n[8].i,
12457 get_pointer(&n[9])));
12458 break;
12459 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D: /* GL_ARB_texture_compress */
12460 CALL_CompressedTexSubImage1D(ctx->Exec,
12461 (n[1].e, n[2].i, n[3].i, n[4].i,
12462 n[5].e, n[6].i,
12463 get_pointer(&n[7])));
12464 break;
12465 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D: /* GL_ARB_texture_compress */
12466 CALL_CompressedTexSubImage2D(ctx->Exec,
12467 (n[1].e, n[2].i, n[3].i, n[4].i,
12468 n[5].i, n[6].i, n[7].e, n[8].i,
12469 get_pointer(&n[9])));
12470 break;
12471 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D: /* GL_ARB_texture_compress */
12472 CALL_CompressedTexSubImage3D(ctx->Exec,
12473 (n[1].e, n[2].i, n[3].i, n[4].i,
12474 n[5].i, n[6].i, n[7].i, n[8].i,
12475 n[9].e, n[10].i,
12476 get_pointer(&n[11])));
12477 break;
12478 case OPCODE_SAMPLE_COVERAGE: /* GL_ARB_multisample */
12479 CALL_SampleCoverage(ctx->Exec, (n[1].f, n[2].b));
12480 break;
12481 case OPCODE_WINDOW_POS_ARB: /* GL_ARB_window_pos */
12482 CALL_WindowPos3f(ctx->Exec, (n[1].f, n[2].f, n[3].f));
12483 break;
12484 case OPCODE_BIND_PROGRAM_ARB: /* GL_ARB_vertex_program */
12485 CALL_BindProgramARB(ctx->Exec, (n[1].e, n[2].ui));
12486 break;
12487 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB:
12488 CALL_ProgramLocalParameter4fARB(ctx->Exec,
12489 (n[1].e, n[2].ui, n[3].f, n[4].f,
12490 n[5].f, n[6].f));
12491 break;
12492 case OPCODE_ACTIVE_STENCIL_FACE_EXT:
12493 CALL_ActiveStencilFaceEXT(ctx->Exec, (n[1].e));
12494 break;
12495 case OPCODE_DEPTH_BOUNDS_EXT:
12496 CALL_DepthBoundsEXT(ctx->Exec, (n[1].f, n[2].f));
12497 break;
12498 case OPCODE_PROGRAM_STRING_ARB:
12499 CALL_ProgramStringARB(ctx->Exec,
12500 (n[1].e, n[2].e, n[3].i,
12501 get_pointer(&n[4])));
12502 break;
12503 case OPCODE_PROGRAM_ENV_PARAMETER_ARB:
12504 CALL_ProgramEnvParameter4fARB(ctx->Exec, (n[1].e, n[2].ui, n[3].f,
12505 n[4].f, n[5].f,
12506 n[6].f));
12507 break;
12508 case OPCODE_BEGIN_QUERY_ARB:
12509 CALL_BeginQuery(ctx->Exec, (n[1].e, n[2].ui));
12510 break;
12511 case OPCODE_END_QUERY_ARB:
12512 CALL_EndQuery(ctx->Exec, (n[1].e));
12513 break;
12514 case OPCODE_QUERY_COUNTER:
12515 CALL_QueryCounter(ctx->Exec, (n[1].ui, n[2].e));
12516 break;
12517 case OPCODE_BEGIN_QUERY_INDEXED:
12518 CALL_BeginQueryIndexed(ctx->Exec, (n[1].e, n[2].ui, n[3].ui));
12519 break;
12520 case OPCODE_END_QUERY_INDEXED:
12521 CALL_EndQueryIndexed(ctx->Exec, (n[1].e, n[2].ui));
12522 break;
12523 case OPCODE_DRAW_BUFFERS_ARB:
12524 {
12525 GLenum buffers[MAX_DRAW_BUFFERS];
12526 GLint i, count = MIN2(n[1].i, MAX_DRAW_BUFFERS);
12527 for (i = 0; i < count; i++)
12528 buffers[i] = n[2 + i].e;
12529 CALL_DrawBuffers(ctx->Exec, (n[1].i, buffers));
12530 }
12531 break;
12532 case OPCODE_BLIT_FRAMEBUFFER:
12533 CALL_BlitFramebuffer(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i,
12534 n[5].i, n[6].i, n[7].i, n[8].i,
12535 n[9].i, n[10].e));
12536 break;
12537 case OPCODE_PRIMITIVE_RESTART_NV:
12538 CALL_PrimitiveRestartNV(ctx->Exec, ());
12539 break;
12540
12541 case OPCODE_USE_PROGRAM:
12542 CALL_UseProgram(ctx->Exec, (n[1].ui));
12543 break;
12544 case OPCODE_UNIFORM_1F:
12545 CALL_Uniform1f(ctx->Exec, (n[1].i, n[2].f));
12546 break;
12547 case OPCODE_UNIFORM_2F:
12548 CALL_Uniform2f(ctx->Exec, (n[1].i, n[2].f, n[3].f));
12549 break;
12550 case OPCODE_UNIFORM_3F:
12551 CALL_Uniform3f(ctx->Exec, (n[1].i, n[2].f, n[3].f, n[4].f));
12552 break;
12553 case OPCODE_UNIFORM_4F:
12554 CALL_Uniform4f(ctx->Exec,
12555 (n[1].i, n[2].f, n[3].f, n[4].f, n[5].f));
12556 break;
12557 case OPCODE_UNIFORM_1FV:
12558 CALL_Uniform1fv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12559 break;
12560 case OPCODE_UNIFORM_2FV:
12561 CALL_Uniform2fv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12562 break;
12563 case OPCODE_UNIFORM_3FV:
12564 CALL_Uniform3fv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12565 break;
12566 case OPCODE_UNIFORM_4FV:
12567 CALL_Uniform4fv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12568 break;
12569 case OPCODE_UNIFORM_1D: {
12570 union float64_pair x;
12571
12572 x.uint32[0] = n[2].ui;
12573 x.uint32[1] = n[3].ui;
12574
12575 CALL_Uniform1d(ctx->Exec, (n[1].i, x.d));
12576 break;
12577 }
12578 case OPCODE_UNIFORM_2D: {
12579 union float64_pair x;
12580 union float64_pair y;
12581
12582 x.uint32[0] = n[2].ui;
12583 x.uint32[1] = n[3].ui;
12584 y.uint32[0] = n[4].ui;
12585 y.uint32[1] = n[5].ui;
12586
12587 CALL_Uniform2d(ctx->Exec, (n[1].i, x.d, y.d));
12588 break;
12589 }
12590 case OPCODE_UNIFORM_3D: {
12591 union float64_pair x;
12592 union float64_pair y;
12593 union float64_pair z;
12594
12595 x.uint32[0] = n[2].ui;
12596 x.uint32[1] = n[3].ui;
12597 y.uint32[0] = n[4].ui;
12598 y.uint32[1] = n[5].ui;
12599 z.uint32[0] = n[6].ui;
12600 z.uint32[1] = n[7].ui;
12601
12602 CALL_Uniform3d(ctx->Exec, (n[1].i, x.d, y.d, z.d));
12603 break;
12604 }
12605 case OPCODE_UNIFORM_4D: {
12606 union float64_pair x;
12607 union float64_pair y;
12608 union float64_pair z;
12609 union float64_pair w;
12610
12611 x.uint32[0] = n[2].ui;
12612 x.uint32[1] = n[3].ui;
12613 y.uint32[0] = n[4].ui;
12614 y.uint32[1] = n[5].ui;
12615 z.uint32[0] = n[6].ui;
12616 z.uint32[1] = n[7].ui;
12617 w.uint32[0] = n[8].ui;
12618 w.uint32[1] = n[9].ui;
12619
12620 CALL_Uniform4d(ctx->Exec, (n[1].i, x.d, y.d, z.d, w.d));
12621 break;
12622 }
12623 case OPCODE_UNIFORM_1DV:
12624 CALL_Uniform1dv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12625 break;
12626 case OPCODE_UNIFORM_2DV:
12627 CALL_Uniform2dv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12628 break;
12629 case OPCODE_UNIFORM_3DV:
12630 CALL_Uniform3dv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12631 break;
12632 case OPCODE_UNIFORM_4DV:
12633 CALL_Uniform4dv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12634 break;
12635 case OPCODE_UNIFORM_1I:
12636 CALL_Uniform1i(ctx->Exec, (n[1].i, n[2].i));
12637 break;
12638 case OPCODE_UNIFORM_2I:
12639 CALL_Uniform2i(ctx->Exec, (n[1].i, n[2].i, n[3].i));
12640 break;
12641 case OPCODE_UNIFORM_3I:
12642 CALL_Uniform3i(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
12643 break;
12644 case OPCODE_UNIFORM_4I:
12645 CALL_Uniform4i(ctx->Exec,
12646 (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
12647 break;
12648 case OPCODE_UNIFORM_1IV:
12649 CALL_Uniform1iv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12650 break;
12651 case OPCODE_UNIFORM_2IV:
12652 CALL_Uniform2iv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12653 break;
12654 case OPCODE_UNIFORM_3IV:
12655 CALL_Uniform3iv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12656 break;
12657 case OPCODE_UNIFORM_4IV:
12658 CALL_Uniform4iv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12659 break;
12660 case OPCODE_UNIFORM_1UI:
12661 CALL_Uniform1ui(ctx->Exec, (n[1].i, n[2].i));
12662 break;
12663 case OPCODE_UNIFORM_2UI:
12664 CALL_Uniform2ui(ctx->Exec, (n[1].i, n[2].i, n[3].i));
12665 break;
12666 case OPCODE_UNIFORM_3UI:
12667 CALL_Uniform3ui(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
12668 break;
12669 case OPCODE_UNIFORM_4UI:
12670 CALL_Uniform4ui(ctx->Exec,
12671 (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
12672 break;
12673 case OPCODE_UNIFORM_1UIV:
12674 CALL_Uniform1uiv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12675 break;
12676 case OPCODE_UNIFORM_2UIV:
12677 CALL_Uniform2uiv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12678 break;
12679 case OPCODE_UNIFORM_3UIV:
12680 CALL_Uniform3uiv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12681 break;
12682 case OPCODE_UNIFORM_4UIV:
12683 CALL_Uniform4uiv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12684 break;
12685 case OPCODE_UNIFORM_MATRIX22:
12686 CALL_UniformMatrix2fv(ctx->Exec,
12687 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12688 break;
12689 case OPCODE_UNIFORM_MATRIX33:
12690 CALL_UniformMatrix3fv(ctx->Exec,
12691 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12692 break;
12693 case OPCODE_UNIFORM_MATRIX44:
12694 CALL_UniformMatrix4fv(ctx->Exec,
12695 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12696 break;
12697 case OPCODE_UNIFORM_MATRIX23:
12698 CALL_UniformMatrix2x3fv(ctx->Exec,
12699 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12700 break;
12701 case OPCODE_UNIFORM_MATRIX32:
12702 CALL_UniformMatrix3x2fv(ctx->Exec,
12703 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12704 break;
12705 case OPCODE_UNIFORM_MATRIX24:
12706 CALL_UniformMatrix2x4fv(ctx->Exec,
12707 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12708 break;
12709 case OPCODE_UNIFORM_MATRIX42:
12710 CALL_UniformMatrix4x2fv(ctx->Exec,
12711 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12712 break;
12713 case OPCODE_UNIFORM_MATRIX34:
12714 CALL_UniformMatrix3x4fv(ctx->Exec,
12715 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12716 break;
12717 case OPCODE_UNIFORM_MATRIX43:
12718 CALL_UniformMatrix4x3fv(ctx->Exec,
12719 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12720 break;
12721 case OPCODE_UNIFORM_MATRIX22D:
12722 CALL_UniformMatrix2dv(ctx->Exec,
12723 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12724 break;
12725 case OPCODE_UNIFORM_MATRIX33D:
12726 CALL_UniformMatrix3dv(ctx->Exec,
12727 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12728 break;
12729 case OPCODE_UNIFORM_MATRIX44D:
12730 CALL_UniformMatrix4dv(ctx->Exec,
12731 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12732 break;
12733 case OPCODE_UNIFORM_MATRIX23D:
12734 CALL_UniformMatrix2x3dv(ctx->Exec,
12735 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12736 break;
12737 case OPCODE_UNIFORM_MATRIX32D:
12738 CALL_UniformMatrix3x2dv(ctx->Exec,
12739 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12740 break;
12741 case OPCODE_UNIFORM_MATRIX24D:
12742 CALL_UniformMatrix2x4dv(ctx->Exec,
12743 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12744 break;
12745 case OPCODE_UNIFORM_MATRIX42D:
12746 CALL_UniformMatrix4x2dv(ctx->Exec,
12747 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12748 break;
12749 case OPCODE_UNIFORM_MATRIX34D:
12750 CALL_UniformMatrix3x4dv(ctx->Exec,
12751 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12752 break;
12753 case OPCODE_UNIFORM_MATRIX43D:
12754 CALL_UniformMatrix4x3dv(ctx->Exec,
12755 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12756 break;
12757
12758 case OPCODE_UNIFORM_1I64: {
12759 union int64_pair x;
12760
12761 x.int32[0] = n[2].i;
12762 x.int32[1] = n[3].i;
12763
12764 CALL_Uniform1i64ARB(ctx->Exec, (n[1].i, x.int64));
12765 break;
12766 }
12767 case OPCODE_UNIFORM_2I64: {
12768 union int64_pair x;
12769 union int64_pair y;
12770
12771 x.int32[0] = n[2].i;
12772 x.int32[1] = n[3].i;
12773 y.int32[0] = n[4].i;
12774 y.int32[1] = n[5].i;
12775
12776 CALL_Uniform2i64ARB(ctx->Exec, (n[1].i, x.int64, y.int64));
12777 break;
12778 }
12779 case OPCODE_UNIFORM_3I64: {
12780 union int64_pair x;
12781 union int64_pair y;
12782 union int64_pair z;
12783
12784 x.int32[0] = n[2].i;
12785 x.int32[1] = n[3].i;
12786 y.int32[0] = n[4].i;
12787 y.int32[1] = n[5].i;
12788 z.int32[0] = n[6].i;
12789 z.int32[1] = n[7].i;
12790
12791
12792 CALL_Uniform3i64ARB(ctx->Exec, (n[1].i, x.int64, y.int64, z.int64));
12793 break;
12794 }
12795 case OPCODE_UNIFORM_4I64: {
12796 union int64_pair x;
12797 union int64_pair y;
12798 union int64_pair z;
12799 union int64_pair w;
12800
12801 x.int32[0] = n[2].i;
12802 x.int32[1] = n[3].i;
12803 y.int32[0] = n[4].i;
12804 y.int32[1] = n[5].i;
12805 z.int32[0] = n[6].i;
12806 z.int32[1] = n[7].i;
12807 w.int32[0] = n[8].i;
12808 w.int32[1] = n[9].i;
12809
12810 CALL_Uniform4i64ARB(ctx->Exec, (n[1].i, x.int64, y.int64, z.int64, w.int64));
12811 break;
12812 }
12813 case OPCODE_UNIFORM_1I64V:
12814 CALL_Uniform1i64vARB(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12815 break;
12816 case OPCODE_UNIFORM_2I64V:
12817 CALL_Uniform2i64vARB(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12818 break;
12819 case OPCODE_UNIFORM_3I64V:
12820 CALL_Uniform3i64vARB(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12821 break;
12822 case OPCODE_UNIFORM_4I64V:
12823 CALL_Uniform4i64vARB(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12824 break;
12825 case OPCODE_UNIFORM_1UI64: {
12826 union uint64_pair x;
12827
12828 x.uint32[0] = n[2].ui;
12829 x.uint32[1] = n[3].ui;
12830
12831 CALL_Uniform1ui64ARB(ctx->Exec, (n[1].i, x.uint64));
12832 break;
12833 }
12834 case OPCODE_UNIFORM_2UI64: {
12835 union uint64_pair x;
12836 union uint64_pair y;
12837
12838 x.uint32[0] = n[2].ui;
12839 x.uint32[1] = n[3].ui;
12840 y.uint32[0] = n[4].ui;
12841 y.uint32[1] = n[5].ui;
12842
12843 CALL_Uniform2ui64ARB(ctx->Exec, (n[1].i, x.uint64, y.uint64));
12844 break;
12845 }
12846 case OPCODE_UNIFORM_3UI64: {
12847 union uint64_pair x;
12848 union uint64_pair y;
12849 union uint64_pair z;
12850
12851 x.uint32[0] = n[2].ui;
12852 x.uint32[1] = n[3].ui;
12853 y.uint32[0] = n[4].ui;
12854 y.uint32[1] = n[5].ui;
12855 z.uint32[0] = n[6].ui;
12856 z.uint32[1] = n[7].ui;
12857
12858
12859 CALL_Uniform3ui64ARB(ctx->Exec, (n[1].i, x.uint64, y.uint64,
12860 z.uint64));
12861 break;
12862 }
12863 case OPCODE_UNIFORM_4UI64: {
12864 union uint64_pair x;
12865 union uint64_pair y;
12866 union uint64_pair z;
12867 union uint64_pair w;
12868
12869 x.uint32[0] = n[2].ui;
12870 x.uint32[1] = n[3].ui;
12871 y.uint32[0] = n[4].ui;
12872 y.uint32[1] = n[5].ui;
12873 z.uint32[0] = n[6].ui;
12874 z.uint32[1] = n[7].ui;
12875 w.uint32[0] = n[8].ui;
12876 w.uint32[1] = n[9].ui;
12877
12878 CALL_Uniform4ui64ARB(ctx->Exec, (n[1].i, x.uint64, y.uint64,
12879 z.uint64, w.uint64));
12880 break;
12881 }
12882 case OPCODE_UNIFORM_1UI64V:
12883 CALL_Uniform1ui64vARB(ctx->Exec, (n[1].i, n[2].i,
12884 get_pointer(&n[3])));
12885 break;
12886 case OPCODE_UNIFORM_2UI64V:
12887 CALL_Uniform2ui64vARB(ctx->Exec, (n[1].i, n[2].i,
12888 get_pointer(&n[3])));
12889 break;
12890 case OPCODE_UNIFORM_3UI64V:
12891 CALL_Uniform3ui64vARB(ctx->Exec, (n[1].i, n[2].i,
12892 get_pointer(&n[3])));
12893 break;
12894 case OPCODE_UNIFORM_4UI64V:
12895 CALL_Uniform4ui64vARB(ctx->Exec, (n[1].i, n[2].i,
12896 get_pointer(&n[3])));
12897 break;
12898
12899 case OPCODE_PROGRAM_UNIFORM_1I64: {
12900 union int64_pair x;
12901
12902 x.int32[0] = n[3].i;
12903 x.int32[1] = n[4].i;
12904
12905 CALL_ProgramUniform1i64ARB(ctx->Exec, (n[1].ui, n[2].i, x.int64));
12906 break;
12907 }
12908 case OPCODE_PROGRAM_UNIFORM_2I64: {
12909 union int64_pair x;
12910 union int64_pair y;
12911
12912 x.int32[0] = n[3].i;
12913 x.int32[1] = n[4].i;
12914 y.int32[0] = n[5].i;
12915 y.int32[1] = n[6].i;
12916
12917 CALL_ProgramUniform2i64ARB(ctx->Exec, (n[1].ui, n[2].i, x.int64,
12918 y.int64));
12919 break;
12920 }
12921 case OPCODE_PROGRAM_UNIFORM_3I64: {
12922 union int64_pair x;
12923 union int64_pair y;
12924 union int64_pair z;
12925
12926 x.int32[0] = n[3].i;
12927 x.int32[1] = n[4].i;
12928 y.int32[0] = n[5].i;
12929 y.int32[1] = n[6].i;
12930 z.int32[0] = n[7].i;
12931 z.int32[1] = n[8].i;
12932
12933 CALL_ProgramUniform3i64ARB(ctx->Exec, (n[1].ui, n[2].i, x.int64,
12934 y.int64, z.int64));
12935 break;
12936 }
12937 case OPCODE_PROGRAM_UNIFORM_4I64: {
12938 union int64_pair x;
12939 union int64_pair y;
12940 union int64_pair z;
12941 union int64_pair w;
12942
12943 x.int32[0] = n[3].i;
12944 x.int32[1] = n[4].i;
12945 y.int32[0] = n[5].i;
12946 y.int32[1] = n[6].i;
12947 z.int32[0] = n[7].i;
12948 z.int32[1] = n[8].i;
12949 w.int32[0] = n[9].i;
12950 w.int32[1] = n[10].i;
12951
12952 CALL_ProgramUniform4i64ARB(ctx->Exec, (n[1].ui, n[2].i, x.int64,
12953 y.int64, z.int64, w.int64));
12954 break;
12955 }
12956 case OPCODE_PROGRAM_UNIFORM_1I64V:
12957 CALL_ProgramUniform1i64vARB(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12958 get_pointer(&n[4])));
12959 break;
12960 case OPCODE_PROGRAM_UNIFORM_2I64V:
12961 CALL_ProgramUniform2i64vARB(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12962 get_pointer(&n[4])));
12963 break;
12964 case OPCODE_PROGRAM_UNIFORM_3I64V:
12965 CALL_ProgramUniform3i64vARB(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12966 get_pointer(&n[4])));
12967 break;
12968 case OPCODE_PROGRAM_UNIFORM_4I64V:
12969 CALL_ProgramUniform4i64vARB(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12970 get_pointer(&n[4])));
12971 break;
12972 case OPCODE_PROGRAM_UNIFORM_1UI64: {
12973 union uint64_pair x;
12974
12975 x.uint32[0] = n[3].ui;
12976 x.uint32[1] = n[4].ui;
12977
12978 CALL_ProgramUniform1i64ARB(ctx->Exec, (n[1].ui, n[2].i, x.uint64));
12979 break;
12980 }
12981 case OPCODE_PROGRAM_UNIFORM_2UI64: {
12982 union uint64_pair x;
12983 union uint64_pair y;
12984
12985 x.uint32[0] = n[3].ui;
12986 x.uint32[1] = n[4].ui;
12987 y.uint32[0] = n[5].ui;
12988 y.uint32[1] = n[6].ui;
12989
12990 CALL_ProgramUniform2ui64ARB(ctx->Exec, (n[1].ui, n[2].i, x.uint64,
12991 y.uint64));
12992 break;
12993 }
12994 case OPCODE_PROGRAM_UNIFORM_3UI64: {
12995 union uint64_pair x;
12996 union uint64_pair y;
12997 union uint64_pair z;
12998
12999 x.uint32[0] = n[3].ui;
13000 x.uint32[1] = n[4].ui;
13001 y.uint32[0] = n[5].ui;
13002 y.uint32[1] = n[6].ui;
13003 z.uint32[0] = n[7].ui;
13004 z.uint32[1] = n[8].ui;
13005
13006 CALL_ProgramUniform3ui64ARB(ctx->Exec, (n[1].ui, n[2].i, x.uint64,
13007 y.uint64, z.uint64));
13008 break;
13009 }
13010 case OPCODE_PROGRAM_UNIFORM_4UI64: {
13011 union uint64_pair x;
13012 union uint64_pair y;
13013 union uint64_pair z;
13014 union uint64_pair w;
13015
13016 x.uint32[0] = n[3].ui;
13017 x.uint32[1] = n[4].ui;
13018 y.uint32[0] = n[5].ui;
13019 y.uint32[1] = n[6].ui;
13020 z.uint32[0] = n[7].ui;
13021 z.uint32[1] = n[8].ui;
13022 w.uint32[0] = n[9].ui;
13023 w.uint32[1] = n[10].ui;
13024
13025 CALL_ProgramUniform4ui64ARB(ctx->Exec, (n[1].ui, n[2].i, x.uint64,
13026 y.uint64, z.uint64, w.uint64));
13027 break;
13028 }
13029 case OPCODE_PROGRAM_UNIFORM_1UI64V:
13030 CALL_ProgramUniform1ui64vARB(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
13031 get_pointer(&n[4])));
13032 break;
13033 case OPCODE_PROGRAM_UNIFORM_2UI64V:
13034 CALL_ProgramUniform2ui64vARB(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
13035 get_pointer(&n[4])));
13036 break;
13037 case OPCODE_PROGRAM_UNIFORM_3UI64V:
13038 CALL_ProgramUniform3ui64vARB(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
13039 get_pointer(&n[4])));
13040 break;
13041 case OPCODE_PROGRAM_UNIFORM_4UI64V:
13042 CALL_ProgramUniform4ui64vARB(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
13043 get_pointer(&n[4])));
13044 break;
13045
13046 case OPCODE_USE_PROGRAM_STAGES:
13047 CALL_UseProgramStages(ctx->Exec, (n[1].ui, n[2].ui, n[3].ui));
13048 break;
13049 case OPCODE_PROGRAM_UNIFORM_1F:
13050 CALL_ProgramUniform1f(ctx->Exec, (n[1].ui, n[2].i, n[3].f));
13051 break;
13052 case OPCODE_PROGRAM_UNIFORM_2F:
13053 CALL_ProgramUniform2f(ctx->Exec, (n[1].ui, n[2].i, n[3].f, n[4].f));
13054 break;
13055 case OPCODE_PROGRAM_UNIFORM_3F:
13056 CALL_ProgramUniform3f(ctx->Exec, (n[1].ui, n[2].i,
13057 n[3].f, n[4].f, n[5].f));
13058 break;
13059 case OPCODE_PROGRAM_UNIFORM_4F:
13060 CALL_ProgramUniform4f(ctx->Exec, (n[1].ui, n[2].i,
13061 n[3].f, n[4].f, n[5].f, n[6].f));
13062 break;
13063 case OPCODE_PROGRAM_UNIFORM_1FV:
13064 CALL_ProgramUniform1fv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
13065 get_pointer(&n[4])));
13066 break;
13067 case OPCODE_PROGRAM_UNIFORM_2FV:
13068 CALL_ProgramUniform2fv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
13069 get_pointer(&n[4])));
13070 break;
13071 case OPCODE_PROGRAM_UNIFORM_3FV:
13072 CALL_ProgramUniform3fv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
13073 get_pointer(&n[4])));
13074 break;
13075 case OPCODE_PROGRAM_UNIFORM_4FV:
13076 CALL_ProgramUniform4fv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
13077 get_pointer(&n[4])));
13078 break;
13079 case OPCODE_PROGRAM_UNIFORM_1D: {
13080 union float64_pair x;
13081
13082 x.uint32[0] = n[3].ui;
13083 x.uint32[1] = n[4].ui;
13084
13085 CALL_ProgramUniform1d(ctx->Exec, (n[1].ui, n[2].i, x.d));
13086 break;
13087 }
13088 case OPCODE_PROGRAM_UNIFORM_2D: {
13089 union float64_pair x;
13090 union float64_pair y;
13091
13092 x.uint32[0] = n[3].ui;
13093 x.uint32[1] = n[4].ui;
13094 y.uint32[0] = n[5].ui;
13095 y.uint32[1] = n[6].ui;
13096
13097 CALL_ProgramUniform2d(ctx->Exec, (n[1].ui, n[2].i, x.d, y.d));
13098 break;
13099 }
13100 case OPCODE_PROGRAM_UNIFORM_3D: {
13101 union float64_pair x;
13102 union float64_pair y;
13103 union float64_pair z;
13104
13105 x.uint32[0] = n[3].ui;
13106 x.uint32[1] = n[4].ui;
13107 y.uint32[0] = n[5].ui;
13108 y.uint32[1] = n[6].ui;
13109 z.uint32[0] = n[7].ui;
13110 z.uint32[1] = n[8].ui;
13111
13112 CALL_ProgramUniform3d(ctx->Exec, (n[1].ui, n[2].i,
13113 x.d, y.d, z.d));
13114 break;
13115 }
13116 case OPCODE_PROGRAM_UNIFORM_4D: {
13117 union float64_pair x;
13118 union float64_pair y;
13119 union float64_pair z;
13120 union float64_pair w;
13121
13122 x.uint32[0] = n[3].ui;
13123 x.uint32[1] = n[4].ui;
13124 y.uint32[0] = n[5].ui;
13125 y.uint32[1] = n[6].ui;
13126 z.uint32[0] = n[7].ui;
13127 z.uint32[1] = n[8].ui;
13128 w.uint32[0] = n[9].ui;
13129 w.uint32[1] = n[10].ui;
13130
13131 CALL_ProgramUniform4d(ctx->Exec, (n[1].ui, n[2].i,
13132 x.d, y.d, z.d, w.d));
13133 break;
13134 }
13135 case OPCODE_PROGRAM_UNIFORM_1DV:
13136 CALL_ProgramUniform1dv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
13137 get_pointer(&n[4])));
13138 break;
13139 case OPCODE_PROGRAM_UNIFORM_2DV:
13140 CALL_ProgramUniform2dv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
13141 get_pointer(&n[4])));
13142 break;
13143 case OPCODE_PROGRAM_UNIFORM_3DV:
13144 CALL_ProgramUniform3dv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
13145 get_pointer(&n[4])));
13146 break;
13147 case OPCODE_PROGRAM_UNIFORM_4DV:
13148 CALL_ProgramUniform4dv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
13149 get_pointer(&n[4])));
13150 break;
13151 case OPCODE_PROGRAM_UNIFORM_1I:
13152 CALL_ProgramUniform1i(ctx->Exec, (n[1].ui, n[2].i, n[3].i));
13153 break;
13154 case OPCODE_PROGRAM_UNIFORM_2I:
13155 CALL_ProgramUniform2i(ctx->Exec, (n[1].ui, n[2].i, n[3].i, n[4].i));
13156 break;
13157 case OPCODE_PROGRAM_UNIFORM_3I:
13158 CALL_ProgramUniform3i(ctx->Exec, (n[1].ui, n[2].i,
13159 n[3].i, n[4].i, n[5].i));
13160 break;
13161 case OPCODE_PROGRAM_UNIFORM_4I:
13162 CALL_ProgramUniform4i(ctx->Exec, (n[1].ui, n[2].i,
13163 n[3].i, n[4].i, n[5].i, n[6].i));
13164 break;
13165 case OPCODE_PROGRAM_UNIFORM_1IV:
13166 CALL_ProgramUniform1iv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
13167 get_pointer(&n[4])));
13168 break;
13169 case OPCODE_PROGRAM_UNIFORM_2IV:
13170 CALL_ProgramUniform2iv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
13171 get_pointer(&n[4])));
13172 break;
13173 case OPCODE_PROGRAM_UNIFORM_3IV:
13174 CALL_ProgramUniform3iv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
13175 get_pointer(&n[4])));
13176 break;
13177 case OPCODE_PROGRAM_UNIFORM_4IV:
13178 CALL_ProgramUniform4iv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
13179 get_pointer(&n[4])));
13180 break;
13181 case OPCODE_PROGRAM_UNIFORM_1UI:
13182 CALL_ProgramUniform1ui(ctx->Exec, (n[1].ui, n[2].i, n[3].ui));
13183 break;
13184 case OPCODE_PROGRAM_UNIFORM_2UI:
13185 CALL_ProgramUniform2ui(ctx->Exec, (n[1].ui, n[2].i,
13186 n[3].ui, n[4].ui));
13187 break;
13188 case OPCODE_PROGRAM_UNIFORM_3UI:
13189 CALL_ProgramUniform3ui(ctx->Exec, (n[1].ui, n[2].i,
13190 n[3].ui, n[4].ui, n[5].ui));
13191 break;
13192 case OPCODE_PROGRAM_UNIFORM_4UI:
13193 CALL_ProgramUniform4ui(ctx->Exec, (n[1].ui, n[2].i,
13194 n[3].ui,
13195 n[4].ui, n[5].ui, n[6].ui));
13196 break;
13197 case OPCODE_PROGRAM_UNIFORM_1UIV:
13198 CALL_ProgramUniform1uiv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
13199 get_pointer(&n[4])));
13200 break;
13201 case OPCODE_PROGRAM_UNIFORM_2UIV:
13202 CALL_ProgramUniform2uiv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
13203 get_pointer(&n[4])));
13204 break;
13205 case OPCODE_PROGRAM_UNIFORM_3UIV:
13206 CALL_ProgramUniform3uiv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
13207 get_pointer(&n[4])));
13208 break;
13209 case OPCODE_PROGRAM_UNIFORM_4UIV:
13210 CALL_ProgramUniform4uiv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
13211 get_pointer(&n[4])));
13212 break;
13213 case OPCODE_PROGRAM_UNIFORM_MATRIX22F:
13214 CALL_ProgramUniformMatrix2fv(ctx->Exec,
13215 (n[1].ui, n[2].i, n[3].i, n[4].b,
13216 get_pointer(&n[5])));
13217 break;
13218 case OPCODE_PROGRAM_UNIFORM_MATRIX23F:
13219 CALL_ProgramUniformMatrix2x3fv(ctx->Exec,
13220 (n[1].ui, n[2].i, n[3].i, n[4].b,
13221 get_pointer(&n[5])));
13222 break;
13223 case OPCODE_PROGRAM_UNIFORM_MATRIX24F:
13224 CALL_ProgramUniformMatrix2x4fv(ctx->Exec,
13225 (n[1].ui, n[2].i, n[3].i, n[4].b,
13226 get_pointer(&n[5])));
13227 break;
13228 case OPCODE_PROGRAM_UNIFORM_MATRIX32F:
13229 CALL_ProgramUniformMatrix3x2fv(ctx->Exec,
13230 (n[1].ui, n[2].i, n[3].i, n[4].b,
13231 get_pointer(&n[5])));
13232 break;
13233 case OPCODE_PROGRAM_UNIFORM_MATRIX33F:
13234 CALL_ProgramUniformMatrix3fv(ctx->Exec,
13235 (n[1].ui, n[2].i, n[3].i, n[4].b,
13236 get_pointer(&n[5])));
13237 break;
13238 case OPCODE_PROGRAM_UNIFORM_MATRIX34F:
13239 CALL_ProgramUniformMatrix3x4fv(ctx->Exec,
13240 (n[1].ui, n[2].i, n[3].i, n[4].b,
13241 get_pointer(&n[5])));
13242 break;
13243 case OPCODE_PROGRAM_UNIFORM_MATRIX42F:
13244 CALL_ProgramUniformMatrix4x2fv(ctx->Exec,
13245 (n[1].ui, n[2].i, n[3].i, n[4].b,
13246 get_pointer(&n[5])));
13247 break;
13248 case OPCODE_PROGRAM_UNIFORM_MATRIX43F:
13249 CALL_ProgramUniformMatrix4x3fv(ctx->Exec,
13250 (n[1].ui, n[2].i, n[3].i, n[4].b,
13251 get_pointer(&n[5])));
13252 break;
13253 case OPCODE_PROGRAM_UNIFORM_MATRIX44F:
13254 CALL_ProgramUniformMatrix4fv(ctx->Exec,
13255 (n[1].ui, n[2].i, n[3].i, n[4].b,
13256 get_pointer(&n[5])));
13257 break;
13258 case OPCODE_PROGRAM_UNIFORM_MATRIX22D:
13259 CALL_ProgramUniformMatrix2dv(ctx->Exec,
13260 (n[1].ui, n[2].i, n[3].i, n[4].b,
13261 get_pointer(&n[5])));
13262 break;
13263 case OPCODE_PROGRAM_UNIFORM_MATRIX23D:
13264 CALL_ProgramUniformMatrix2x3dv(ctx->Exec,
13265 (n[1].ui, n[2].i, n[3].i, n[4].b,
13266 get_pointer(&n[5])));
13267 break;
13268 case OPCODE_PROGRAM_UNIFORM_MATRIX24D:
13269 CALL_ProgramUniformMatrix2x4dv(ctx->Exec,
13270 (n[1].ui, n[2].i, n[3].i, n[4].b,
13271 get_pointer(&n[5])));
13272 break;
13273 case OPCODE_PROGRAM_UNIFORM_MATRIX32D:
13274 CALL_ProgramUniformMatrix3x2dv(ctx->Exec,
13275 (n[1].ui, n[2].i, n[3].i, n[4].b,
13276 get_pointer(&n[5])));
13277 break;
13278 case OPCODE_PROGRAM_UNIFORM_MATRIX33D:
13279 CALL_ProgramUniformMatrix3dv(ctx->Exec,
13280 (n[1].ui, n[2].i, n[3].i, n[4].b,
13281 get_pointer(&n[5])));
13282 break;
13283 case OPCODE_PROGRAM_UNIFORM_MATRIX34D:
13284 CALL_ProgramUniformMatrix3x4dv(ctx->Exec,
13285 (n[1].ui, n[2].i, n[3].i, n[4].b,
13286 get_pointer(&n[5])));
13287 break;
13288 case OPCODE_PROGRAM_UNIFORM_MATRIX42D:
13289 CALL_ProgramUniformMatrix4x2dv(ctx->Exec,
13290 (n[1].ui, n[2].i, n[3].i, n[4].b,
13291 get_pointer(&n[5])));
13292 break;
13293 case OPCODE_PROGRAM_UNIFORM_MATRIX43D:
13294 CALL_ProgramUniformMatrix4x3dv(ctx->Exec,
13295 (n[1].ui, n[2].i, n[3].i, n[4].b,
13296 get_pointer(&n[5])));
13297 break;
13298 case OPCODE_PROGRAM_UNIFORM_MATRIX44D:
13299 CALL_ProgramUniformMatrix4dv(ctx->Exec,
13300 (n[1].ui, n[2].i, n[3].i, n[4].b,
13301 get_pointer(&n[5])));
13302 break;
13303
13304 case OPCODE_CLIP_CONTROL:
13305 CALL_ClipControl(ctx->Exec, (n[1].e, n[2].e));
13306 break;
13307
13308 case OPCODE_CLAMP_COLOR:
13309 CALL_ClampColor(ctx->Exec, (n[1].e, n[2].e));
13310 break;
13311
13312 case OPCODE_BIND_FRAGMENT_SHADER_ATI:
13313 CALL_BindFragmentShaderATI(ctx->Exec, (n[1].i));
13314 break;
13315 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI:
13316 CALL_SetFragmentShaderConstantATI(ctx->Exec, (n[1].ui, &n[2].f));
13317 break;
13318 case OPCODE_ATTR_1F_NV:
13319 CALL_VertexAttrib1fNV(ctx->Exec, (n[1].e, n[2].f));
13320 break;
13321 case OPCODE_ATTR_2F_NV:
13322 CALL_VertexAttrib2fvNV(ctx->Exec, (n[1].e, &n[2].f));
13323 break;
13324 case OPCODE_ATTR_3F_NV:
13325 CALL_VertexAttrib3fvNV(ctx->Exec, (n[1].e, &n[2].f));
13326 break;
13327 case OPCODE_ATTR_4F_NV:
13328 CALL_VertexAttrib4fvNV(ctx->Exec, (n[1].e, &n[2].f));
13329 break;
13330 case OPCODE_ATTR_1F_ARB:
13331 CALL_VertexAttrib1fARB(ctx->Exec, (n[1].e, n[2].f));
13332 break;
13333 case OPCODE_ATTR_2F_ARB:
13334 CALL_VertexAttrib2fvARB(ctx->Exec, (n[1].e, &n[2].f));
13335 break;
13336 case OPCODE_ATTR_3F_ARB:
13337 CALL_VertexAttrib3fvARB(ctx->Exec, (n[1].e, &n[2].f));
13338 break;
13339 case OPCODE_ATTR_4F_ARB:
13340 CALL_VertexAttrib4fvARB(ctx->Exec, (n[1].e, &n[2].f));
13341 break;
13342 case OPCODE_ATTR_1D: {
13343 GLdouble *d = (GLdouble *) &n[2];
13344 CALL_VertexAttribL1d(ctx->Exec, (n[1].ui, *d));
13345 break;
13346 }
13347 case OPCODE_ATTR_2D: {
13348 GLdouble *d = (GLdouble *) &n[2];
13349 CALL_VertexAttribL2dv(ctx->Exec, (n[1].ui, d));
13350 break;
13351 }
13352 case OPCODE_ATTR_3D: {
13353 GLdouble *d = (GLdouble *) &n[2];
13354 CALL_VertexAttribL3dv(ctx->Exec, (n[1].ui, d));
13355 break;
13356 }
13357 case OPCODE_ATTR_4D: {
13358 GLdouble *d = (GLdouble *) &n[2];
13359 CALL_VertexAttribL4dv(ctx->Exec, (n[1].ui, d));
13360 break;
13361 }
13362 case OPCODE_MATERIAL:
13363 CALL_Materialfv(ctx->Exec, (n[1].e, n[2].e, &n[3].f));
13364 break;
13365 case OPCODE_BEGIN:
13366 CALL_Begin(ctx->Exec, (n[1].e));
13367 break;
13368 case OPCODE_END:
13369 CALL_End(ctx->Exec, ());
13370 break;
13371 case OPCODE_RECTF:
13372 CALL_Rectf(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
13373 break;
13374 case OPCODE_EVAL_C1:
13375 CALL_EvalCoord1f(ctx->Exec, (n[1].f));
13376 break;
13377 case OPCODE_EVAL_C2:
13378 CALL_EvalCoord2f(ctx->Exec, (n[1].f, n[2].f));
13379 break;
13380 case OPCODE_EVAL_P1:
13381 CALL_EvalPoint1(ctx->Exec, (n[1].i));
13382 break;
13383 case OPCODE_EVAL_P2:
13384 CALL_EvalPoint2(ctx->Exec, (n[1].i, n[2].i));
13385 break;
13386
13387 /* GL_EXT_texture_integer */
13388 case OPCODE_CLEARCOLOR_I:
13389 CALL_ClearColorIiEXT(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
13390 break;
13391 case OPCODE_CLEARCOLOR_UI:
13392 CALL_ClearColorIuiEXT(ctx->Exec,
13393 (n[1].ui, n[2].ui, n[3].ui, n[4].ui));
13394 break;
13395 case OPCODE_TEXPARAMETER_I:
13396 {
13397 GLint params[4];
13398 params[0] = n[3].i;
13399 params[1] = n[4].i;
13400 params[2] = n[5].i;
13401 params[3] = n[6].i;
13402 CALL_TexParameterIiv(ctx->Exec, (n[1].e, n[2].e, params));
13403 }
13404 break;
13405 case OPCODE_TEXPARAMETER_UI:
13406 {
13407 GLuint params[4];
13408 params[0] = n[3].ui;
13409 params[1] = n[4].ui;
13410 params[2] = n[5].ui;
13411 params[3] = n[6].ui;
13412 CALL_TexParameterIuiv(ctx->Exec, (n[1].e, n[2].e, params));
13413 }
13414 break;
13415
13416 case OPCODE_VERTEX_ATTRIB_DIVISOR:
13417 /* GL_ARB_instanced_arrays */
13418 CALL_VertexAttribDivisor(ctx->Exec, (n[1].ui, n[2].ui));
13419 break;
13420
13421 case OPCODE_TEXTURE_BARRIER_NV:
13422 CALL_TextureBarrierNV(ctx->Exec, ());
13423 break;
13424
13425 /* GL_EXT/ARB_transform_feedback */
13426 case OPCODE_BEGIN_TRANSFORM_FEEDBACK:
13427 CALL_BeginTransformFeedback(ctx->Exec, (n[1].e));
13428 break;
13429 case OPCODE_END_TRANSFORM_FEEDBACK:
13430 CALL_EndTransformFeedback(ctx->Exec, ());
13431 break;
13432 case OPCODE_BIND_TRANSFORM_FEEDBACK:
13433 CALL_BindTransformFeedback(ctx->Exec, (n[1].e, n[2].ui));
13434 break;
13435 case OPCODE_PAUSE_TRANSFORM_FEEDBACK:
13436 CALL_PauseTransformFeedback(ctx->Exec, ());
13437 break;
13438 case OPCODE_RESUME_TRANSFORM_FEEDBACK:
13439 CALL_ResumeTransformFeedback(ctx->Exec, ());
13440 break;
13441 case OPCODE_DRAW_TRANSFORM_FEEDBACK:
13442 CALL_DrawTransformFeedback(ctx->Exec, (n[1].e, n[2].ui));
13443 break;
13444 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM:
13445 CALL_DrawTransformFeedbackStream(ctx->Exec,
13446 (n[1].e, n[2].ui, n[3].ui));
13447 break;
13448 case OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED:
13449 CALL_DrawTransformFeedbackInstanced(ctx->Exec,
13450 (n[1].e, n[2].ui, n[3].si));
13451 break;
13452 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED:
13453 CALL_DrawTransformFeedbackStreamInstanced(ctx->Exec,
13454 (n[1].e, n[2].ui, n[3].ui, n[4].si));
13455 break;
13456
13457
13458 case OPCODE_BIND_SAMPLER:
13459 CALL_BindSampler(ctx->Exec, (n[1].ui, n[2].ui));
13460 break;
13461 case OPCODE_SAMPLER_PARAMETERIV:
13462 {
13463 GLint params[4];
13464 params[0] = n[3].i;
13465 params[1] = n[4].i;
13466 params[2] = n[5].i;
13467 params[3] = n[6].i;
13468 CALL_SamplerParameteriv(ctx->Exec, (n[1].ui, n[2].e, params));
13469 }
13470 break;
13471 case OPCODE_SAMPLER_PARAMETERFV:
13472 {
13473 GLfloat params[4];
13474 params[0] = n[3].f;
13475 params[1] = n[4].f;
13476 params[2] = n[5].f;
13477 params[3] = n[6].f;
13478 CALL_SamplerParameterfv(ctx->Exec, (n[1].ui, n[2].e, params));
13479 }
13480 break;
13481 case OPCODE_SAMPLER_PARAMETERIIV:
13482 {
13483 GLint params[4];
13484 params[0] = n[3].i;
13485 params[1] = n[4].i;
13486 params[2] = n[5].i;
13487 params[3] = n[6].i;
13488 CALL_SamplerParameterIiv(ctx->Exec, (n[1].ui, n[2].e, params));
13489 }
13490 break;
13491 case OPCODE_SAMPLER_PARAMETERUIV:
13492 {
13493 GLuint params[4];
13494 params[0] = n[3].ui;
13495 params[1] = n[4].ui;
13496 params[2] = n[5].ui;
13497 params[3] = n[6].ui;
13498 CALL_SamplerParameterIuiv(ctx->Exec, (n[1].ui, n[2].e, params));
13499 }
13500 break;
13501
13502 /* ARB_compute_shader */
13503 case OPCODE_DISPATCH_COMPUTE:
13504 CALL_DispatchCompute(ctx->Exec, (n[1].ui, n[2].ui, n[3].ui));
13505 break;
13506
13507 /* GL_ARB_sync */
13508 case OPCODE_WAIT_SYNC:
13509 {
13510 union uint64_pair p;
13511 p.uint32[0] = n[2].ui;
13512 p.uint32[1] = n[3].ui;
13513 CALL_WaitSync(ctx->Exec,
13514 (get_pointer(&n[4]), n[1].bf, p.uint64));
13515 }
13516 break;
13517
13518 /* GL_NV_conditional_render */
13519 case OPCODE_BEGIN_CONDITIONAL_RENDER:
13520 CALL_BeginConditionalRender(ctx->Exec, (n[1].i, n[2].e));
13521 break;
13522 case OPCODE_END_CONDITIONAL_RENDER:
13523 CALL_EndConditionalRender(ctx->Exec, ());
13524 break;
13525
13526 case OPCODE_UNIFORM_BLOCK_BINDING:
13527 CALL_UniformBlockBinding(ctx->Exec, (n[1].ui, n[2].ui, n[3].ui));
13528 break;
13529
13530 case OPCODE_UNIFORM_SUBROUTINES:
13531 CALL_UniformSubroutinesuiv(ctx->Exec, (n[1].e, n[2].si,
13532 get_pointer(&n[3])));
13533 break;
13534
13535 /* GL_EXT_window_rectangles */
13536 case OPCODE_WINDOW_RECTANGLES:
13537 CALL_WindowRectanglesEXT(
13538 ctx->Exec, (n[1].e, n[2].si, get_pointer(&n[3])));
13539 break;
13540
13541 /* GL_NV_conservative_raster */
13542 case OPCODE_SUBPIXEL_PRECISION_BIAS:
13543 CALL_SubpixelPrecisionBiasNV(ctx->Exec, (n[1].ui, n[2].ui));
13544 break;
13545
13546 /* GL_NV_conservative_raster_dilate */
13547 case OPCODE_CONSERVATIVE_RASTER_PARAMETER_F:
13548 CALL_ConservativeRasterParameterfNV(ctx->Exec, (n[1].e, n[2].f));
13549 break;
13550
13551 /* GL_NV_conservative_raster_pre_snap_triangles */
13552 case OPCODE_CONSERVATIVE_RASTER_PARAMETER_I:
13553 CALL_ConservativeRasterParameteriNV(ctx->Exec, (n[1].e, n[2].i));
13554 break;
13555
13556 /* GL_EXT_direct_state_access */
13557 case OPCODE_MATRIX_LOAD:
13558 CALL_MatrixLoadfEXT(ctx->Exec, (n[1].e, &n[2].f));
13559 break;
13560 case OPCODE_MATRIX_MULT:
13561 CALL_MatrixMultfEXT(ctx->Exec, (n[1].e, &n[2].f));
13562 break;
13563 case OPCODE_MATRIX_ROTATE:
13564 CALL_MatrixRotatefEXT(ctx->Exec, (n[1].e, n[2].f, n[3].f, n[4].f, n[5].f));
13565 break;
13566 case OPCODE_MATRIX_SCALE:
13567 CALL_MatrixScalefEXT(ctx->Exec, (n[1].e, n[2].f, n[3].f, n[4].f));
13568 break;
13569 case OPCODE_MATRIX_TRANSLATE:
13570 CALL_MatrixTranslatefEXT(ctx->Exec, (n[1].e, n[2].f, n[3].f, n[4].f));
13571 break;
13572 case OPCODE_MATRIX_LOAD_IDENTITY:
13573 CALL_MatrixLoadIdentityEXT(ctx->Exec, (n[1].e));
13574 break;
13575 case OPCODE_MATRIX_ORTHO:
13576 CALL_MatrixOrthoEXT(ctx->Exec, (n[1].e,
13577 n[2].f, n[3].f, n[4].f,
13578 n[5].f, n[6].f, n[7].f));
13579 break;
13580 case OPCODE_MATRIX_FRUSTUM:
13581 CALL_MatrixFrustumEXT(ctx->Exec, (n[1].e,
13582 n[2].f, n[3].f, n[4].f,
13583 n[5].f, n[6].f, n[7].f));
13584 break;
13585 case OPCODE_MATRIX_PUSH:
13586 CALL_MatrixPushEXT(ctx->Exec, (n[1].e));
13587 break;
13588 case OPCODE_MATRIX_POP:
13589 CALL_MatrixPopEXT(ctx->Exec, (n[1].e));
13590 break;
13591 case OPCODE_TEXTUREPARAMETER_F:
13592 {
13593 GLfloat params[4];
13594 params[0] = n[4].f;
13595 params[1] = n[5].f;
13596 params[2] = n[6].f;
13597 params[3] = n[7].f;
13598 CALL_TextureParameterfvEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].e, params));
13599 }
13600 break;
13601 case OPCODE_TEXTUREPARAMETER_I:
13602 {
13603 GLint params[4];
13604 params[0] = n[4].i;
13605 params[1] = n[5].i;
13606 params[2] = n[6].i;
13607 params[3] = n[7].i;
13608 CALL_TextureParameterivEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].e, params));
13609 }
13610 break;
13611 case OPCODE_TEXTUREPARAMETER_II:
13612 {
13613 GLint params[4];
13614 params[0] = n[4].i;
13615 params[1] = n[5].i;
13616 params[2] = n[6].i;
13617 params[3] = n[7].i;
13618 CALL_TextureParameterIivEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].e, params));
13619 }
13620 break;
13621 case OPCODE_TEXTUREPARAMETER_IUI:
13622 {
13623 GLuint params[4];
13624 params[0] = n[4].ui;
13625 params[1] = n[5].ui;
13626 params[2] = n[6].ui;
13627 params[3] = n[7].ui;
13628 CALL_TextureParameterIuivEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].e, params));
13629 }
13630 break;
13631 case OPCODE_TEXTURE_IMAGE1D:
13632 {
13633 const struct gl_pixelstore_attrib save = ctx->Unpack;
13634 ctx->Unpack = ctx->DefaultPacking;
13635 CALL_TextureImage1DEXT(ctx->Exec, (n[1].ui, /* texture */
13636 n[2].e, /* target */
13637 n[3].i, /* level */
13638 n[4].i, /* components */
13639 n[5].i, /* width */
13640 n[6].e, /* border */
13641 n[7].e, /* format */
13642 n[8].e, /* type */
13643 get_pointer(&n[9])));
13644 ctx->Unpack = save; /* restore */
13645 }
13646 break;
13647 case OPCODE_TEXTURE_IMAGE2D:
13648 {
13649 const struct gl_pixelstore_attrib save = ctx->Unpack;
13650 ctx->Unpack = ctx->DefaultPacking;
13651 CALL_TextureImage2DEXT(ctx->Exec, (n[1].ui, /* texture */
13652 n[2].e, /* target */
13653 n[3].i, /* level */
13654 n[4].i, /* components */
13655 n[5].i, /* width */
13656 n[6].i, /* height */
13657 n[7].e, /* border */
13658 n[8].e, /* format */
13659 n[9].e, /* type */
13660 get_pointer(&n[10])));
13661 ctx->Unpack = save; /* restore */
13662 }
13663 break;
13664 case OPCODE_TEXTURE_IMAGE3D:
13665 {
13666 const struct gl_pixelstore_attrib save = ctx->Unpack;
13667 ctx->Unpack = ctx->DefaultPacking;
13668 CALL_TextureImage3DEXT(ctx->Exec, (n[1].ui, /* texture */
13669 n[2].e, /* target */
13670 n[3].i, /* level */
13671 n[4].i, /* components */
13672 n[5].i, /* width */
13673 n[6].i, /* height */
13674 n[7].i, /* depth */
13675 n[8].e, /* border */
13676 n[9].e, /* format */
13677 n[10].e, /* type */
13678 get_pointer(&n[11])));
13679 ctx->Unpack = save; /* restore */
13680 }
13681 break;
13682 case OPCODE_TEXTURE_SUB_IMAGE1D:
13683 {
13684 const struct gl_pixelstore_attrib save = ctx->Unpack;
13685 ctx->Unpack = ctx->DefaultPacking;
13686 CALL_TextureSubImage1DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13687 n[4].i, n[5].i, n[6].e,
13688 n[7].e, get_pointer(&n[8])));
13689 ctx->Unpack = save; /* restore */
13690 }
13691 break;
13692 case OPCODE_TEXTURE_SUB_IMAGE2D:
13693 {
13694 const struct gl_pixelstore_attrib save = ctx->Unpack;
13695 ctx->Unpack = ctx->DefaultPacking;
13696 CALL_TextureSubImage2DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13697 n[4].i, n[5].i, n[6].e,
13698 n[7].i, n[8].e, n[9].e,
13699 get_pointer(&n[10])));
13700 ctx->Unpack = save;
13701 }
13702 break;
13703 case OPCODE_TEXTURE_SUB_IMAGE3D:
13704 {
13705 const struct gl_pixelstore_attrib save = ctx->Unpack;
13706 ctx->Unpack = ctx->DefaultPacking;
13707 CALL_TextureSubImage3DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13708 n[4].i, n[5].i, n[6].i,
13709 n[7].i, n[8].i, n[9].i,
13710 n[10].e, n[11].e,
13711 get_pointer(&n[12])));
13712 ctx->Unpack = save; /* restore */
13713 }
13714 break;
13715 case OPCODE_COPY_TEXTURE_IMAGE1D:
13716 CALL_CopyTextureImage1DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13717 n[4].e, n[5].i, n[6].i,
13718 n[7].i, n[8].i));
13719 break;
13720 case OPCODE_COPY_TEXTURE_IMAGE2D:
13721 CALL_CopyTextureImage2DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13722 n[4].e, n[5].i, n[6].i,
13723 n[7].i, n[8].i, n[9].i));
13724 break;
13725 case OPCODE_COPY_TEXTURE_SUB_IMAGE1D:
13726 CALL_CopyTextureSubImage1DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13727 n[4].i, n[5].i, n[6].i,
13728 n[7].i));
13729 break;
13730 case OPCODE_COPY_TEXTURE_SUB_IMAGE2D:
13731 CALL_CopyTextureSubImage2DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13732 n[4].i, n[5].i, n[6].i,
13733 n[7].i, n[8].i, n[9].i));
13734 break;
13735 case OPCODE_COPY_TEXTURE_SUB_IMAGE3D:
13736 CALL_CopyTextureSubImage3DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13737 n[4].i, n[5].i, n[6].i,
13738 n[7].i, n[8].i, n[9].i,
13739 n[10].i));
13740 break;
13741 case OPCODE_BIND_MULTITEXTURE:
13742 CALL_BindMultiTextureEXT(ctx->Exec, (n[1].e, n[2].e, n[3].ui));
13743 break;
13744 case OPCODE_MULTITEXPARAMETER_F:
13745 {
13746 GLfloat params[4];
13747 params[0] = n[4].f;
13748 params[1] = n[5].f;
13749 params[2] = n[6].f;
13750 params[3] = n[7].f;
13751 CALL_MultiTexParameterfvEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, params));
13752 }
13753 break;
13754 case OPCODE_MULTITEXPARAMETER_I:
13755 {
13756 GLint params[4];
13757 params[0] = n[4].i;
13758 params[1] = n[5].i;
13759 params[2] = n[6].i;
13760 params[3] = n[7].i;
13761 CALL_MultiTexParameterivEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, params));
13762 }
13763 break;
13764 case OPCODE_MULTITEXPARAMETER_II:
13765 {
13766 GLint params[4];
13767 params[0] = n[4].i;
13768 params[1] = n[5].i;
13769 params[2] = n[6].i;
13770 params[3] = n[7].i;
13771 CALL_MultiTexParameterIivEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, params));
13772 }
13773 break;
13774 case OPCODE_MULTITEXPARAMETER_IUI:
13775 {
13776 GLuint params[4];
13777 params[0] = n[4].ui;
13778 params[1] = n[5].ui;
13779 params[2] = n[6].ui;
13780 params[3] = n[7].ui;
13781 CALL_MultiTexParameterIuivEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, params));
13782 }
13783 break;
13784 case OPCODE_MULTITEX_IMAGE1D:
13785 {
13786 const struct gl_pixelstore_attrib save = ctx->Unpack;
13787 ctx->Unpack = ctx->DefaultPacking;
13788 CALL_MultiTexImage1DEXT(ctx->Exec, (n[1].e, /* texture */
13789 n[2].e, /* target */
13790 n[3].i, /* level */
13791 n[4].i, /* components */
13792 n[5].i, /* width */
13793 n[6].e, /* border */
13794 n[7].e, /* format */
13795 n[8].e, /* type */
13796 get_pointer(&n[9])));
13797 ctx->Unpack = save; /* restore */
13798 }
13799 break;
13800 case OPCODE_MULTITEX_IMAGE2D:
13801 {
13802 const struct gl_pixelstore_attrib save = ctx->Unpack;
13803 ctx->Unpack = ctx->DefaultPacking;
13804 CALL_MultiTexImage2DEXT(ctx->Exec, (n[1].e, /* texture */
13805 n[2].e, /* target */
13806 n[3].i, /* level */
13807 n[4].i, /* components */
13808 n[5].i, /* width */
13809 n[6].i, /* height */
13810 n[7].e, /* border */
13811 n[8].e, /* format */
13812 n[9].e, /* type */
13813 get_pointer(&n[10])));
13814 ctx->Unpack = save; /* restore */
13815 }
13816 break;
13817 case OPCODE_MULTITEX_IMAGE3D:
13818 {
13819 const struct gl_pixelstore_attrib save = ctx->Unpack;
13820 ctx->Unpack = ctx->DefaultPacking;
13821 CALL_MultiTexImage3DEXT(ctx->Exec, (n[1].e, /* texture */
13822 n[2].e, /* target */
13823 n[3].i, /* level */
13824 n[4].i, /* components */
13825 n[5].i, /* width */
13826 n[6].i, /* height */
13827 n[7].i, /* depth */
13828 n[8].e, /* border */
13829 n[9].e, /* format */
13830 n[10].e, /* type */
13831 get_pointer(&n[11])));
13832 ctx->Unpack = save; /* restore */
13833 }
13834 break;
13835 case OPCODE_MULTITEX_SUB_IMAGE1D:
13836 {
13837 const struct gl_pixelstore_attrib save = ctx->Unpack;
13838 ctx->Unpack = ctx->DefaultPacking;
13839 CALL_MultiTexSubImage1DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13840 n[4].i, n[5].i, n[6].e,
13841 n[7].e, get_pointer(&n[8])));
13842 ctx->Unpack = save; /* restore */
13843 }
13844 break;
13845 case OPCODE_MULTITEX_SUB_IMAGE2D:
13846 {
13847 const struct gl_pixelstore_attrib save = ctx->Unpack;
13848 ctx->Unpack = ctx->DefaultPacking;
13849 CALL_MultiTexSubImage2DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13850 n[4].i, n[5].i, n[6].e,
13851 n[7].i, n[8].e, n[9].e,
13852 get_pointer(&n[10])));
13853 ctx->Unpack = save; /* restore */
13854 }
13855 break;
13856 case OPCODE_MULTITEX_SUB_IMAGE3D:
13857 {
13858 const struct gl_pixelstore_attrib save = ctx->Unpack;
13859 ctx->Unpack = ctx->DefaultPacking;
13860 CALL_MultiTexSubImage3DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13861 n[4].i, n[5].i, n[6].i,
13862 n[7].i, n[8].i, n[9].i,
13863 n[10].e, n[11].e,
13864 get_pointer(&n[12])));
13865 ctx->Unpack = save; /* restore */
13866 }
13867 break;
13868 case OPCODE_COPY_MULTITEX_IMAGE1D:
13869 CALL_CopyMultiTexImage1DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13870 n[4].e, n[5].i, n[6].i,
13871 n[7].i, n[8].i));
13872 break;
13873 case OPCODE_COPY_MULTITEX_IMAGE2D:
13874 CALL_CopyMultiTexImage2DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13875 n[4].e, n[5].i, n[6].i,
13876 n[7].i, n[8].i, n[9].i));
13877 break;
13878 case OPCODE_COPY_MULTITEX_SUB_IMAGE1D:
13879 CALL_CopyMultiTexSubImage1DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13880 n[4].i, n[5].i, n[6].i,
13881 n[7].i));
13882 break;
13883 case OPCODE_COPY_MULTITEX_SUB_IMAGE2D:
13884 CALL_CopyMultiTexSubImage2DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13885 n[4].i, n[5].i, n[6].i,
13886 n[7].i, n[8].i, n[9].i));
13887 break;
13888 case OPCODE_COPY_MULTITEX_SUB_IMAGE3D:
13889 CALL_CopyMultiTexSubImage3DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13890 n[4].i, n[5].i, n[6].i,
13891 n[7].i, n[8].i, n[9].i,
13892 n[10].i));
13893 break;
13894 case OPCODE_MULTITEXENV:
13895 {
13896 GLfloat params[4];
13897 params[0] = n[4].f;
13898 params[1] = n[5].f;
13899 params[2] = n[6].f;
13900 params[3] = n[7].f;
13901 CALL_MultiTexEnvfvEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, params));
13902 }
13903 break;
13904 case OPCODE_COMPRESSED_TEXTURE_IMAGE_1D:
13905 CALL_CompressedTextureImage1DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13906 n[4].e, n[5].i, n[6].i,
13907 n[7].i, get_pointer(&n[8])));
13908 break;
13909 case OPCODE_COMPRESSED_TEXTURE_IMAGE_2D:
13910 CALL_CompressedTextureImage2DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13911 n[4].e, n[5].i, n[6].i,
13912 n[7].i, n[8].i,
13913 get_pointer(&n[9])));
13914 break;
13915 case OPCODE_COMPRESSED_TEXTURE_IMAGE_3D:
13916 CALL_CompressedTextureImage3DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13917 n[4].e, n[5].i, n[6].i,
13918 n[7].i, n[8].i, n[9].i,
13919 get_pointer(&n[10])));
13920 break;
13921 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_1D:
13922 CALL_CompressedTextureSubImage1DEXT(ctx->Exec,
13923 (n[1].ui, n[2].e, n[3].i, n[4].i,
13924 n[5].i, n[6].e, n[7].i,
13925 get_pointer(&n[8])));
13926 break;
13927 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_2D:
13928 CALL_CompressedTextureSubImage2DEXT(ctx->Exec,
13929 (n[1].ui, n[2].e, n[3].i, n[4].i,
13930 n[5].i, n[6].i, n[7].i, n[8].e,
13931 n[9].i, get_pointer(&n[10])));
13932 break;
13933 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_3D:
13934 CALL_CompressedTextureSubImage3DEXT(ctx->Exec,
13935 (n[1].ui, n[2].e, n[3].i, n[4].i,
13936 n[5].i, n[6].i, n[7].i, n[8].i,
13937 n[9].i, n[10].e, n[11].i,
13938 get_pointer(&n[12])));
13939 break;
13940 case OPCODE_COMPRESSED_MULTITEX_IMAGE_1D:
13941 CALL_CompressedMultiTexImage1DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13942 n[4].e, n[5].i, n[6].i,
13943 n[7].i, get_pointer(&n[8])));
13944 break;
13945 case OPCODE_COMPRESSED_MULTITEX_IMAGE_2D:
13946 CALL_CompressedMultiTexImage2DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13947 n[4].e, n[5].i, n[6].i,
13948 n[7].i, n[8].i,
13949 get_pointer(&n[9])));
13950 break;
13951 case OPCODE_COMPRESSED_MULTITEX_IMAGE_3D:
13952 CALL_CompressedMultiTexImage3DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13953 n[4].e, n[5].i, n[6].i,
13954 n[7].i, n[8].i, n[9].i,
13955 get_pointer(&n[10])));
13956 break;
13957 case OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_1D:
13958 CALL_CompressedMultiTexSubImage1DEXT(ctx->Exec,
13959 (n[1].e, n[2].e, n[3].i, n[4].i,
13960 n[5].i, n[6].e, n[7].i,
13961 get_pointer(&n[8])));
13962 break;
13963 case OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_2D:
13964 CALL_CompressedMultiTexSubImage2DEXT(ctx->Exec,
13965 (n[1].e, n[2].e, n[3].i, n[4].i,
13966 n[5].i, n[6].i, n[7].i, n[8].e,
13967 n[9].i, get_pointer(&n[10])));
13968 break;
13969 case OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_3D:
13970 CALL_CompressedMultiTexSubImage3DEXT(ctx->Exec,
13971 (n[1].e, n[2].e, n[3].i, n[4].i,
13972 n[5].i, n[6].i, n[7].i, n[8].i,
13973 n[9].i, n[10].e, n[11].i,
13974 get_pointer(&n[12])));
13975 break;
13976 case OPCODE_NAMED_PROGRAM_STRING:
13977 CALL_NamedProgramStringEXT(ctx->Exec,
13978 (n[1].ui, n[2].e, n[3].e, n[4].i,
13979 get_pointer(&n[5])));
13980 break;
13981 case OPCODE_NAMED_PROGRAM_LOCAL_PARAMETER:
13982 CALL_NamedProgramLocalParameter4fEXT(ctx->Exec,
13983 (n[1].ui, n[2].e, n[3].ui, n[4].f,
13984 n[5].f, n[6].f, n[7].f));
13985 break;
13986
13987 case OPCODE_CONTINUE:
13988 n = (Node *) get_pointer(&n[1]);
13989 break;
13990 case OPCODE_NOP:
13991 /* no-op */
13992 break;
13993 case OPCODE_END_OF_LIST:
13994 done = GL_TRUE;
13995 break;
13996 default:
13997 {
13998 char msg[1000];
13999 _mesa_snprintf(msg, sizeof(msg), "Error in execute_list: opcode=%d",
14000 (int) opcode);
14001 _mesa_problem(ctx, "%s", msg);
14002 }
14003 done = GL_TRUE;
14004 }
14005
14006 /* increment n to point to next compiled command */
14007 if (opcode != OPCODE_CONTINUE) {
14008 assert(InstSize[opcode] > 0);
14009 n += InstSize[opcode];
14010 }
14011 }
14012 }
14013
14014 vbo_save_EndCallList(ctx);
14015
14016 ctx->ListState.CallDepth--;
14017 }
14018
14019
14020
14021 /**********************************************************************/
14022 /* GL functions */
14023 /**********************************************************************/
14024
14025 /**
14026 * Test if a display list number is valid.
14027 */
14028 GLboolean GLAPIENTRY
14029 _mesa_IsList(GLuint list)
14030 {
14031 GET_CURRENT_CONTEXT(ctx);
14032 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
14033 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
14034 return islist(ctx, list);
14035 }
14036
14037
14038 /**
14039 * Delete a sequence of consecutive display lists.
14040 */
14041 void GLAPIENTRY
14042 _mesa_DeleteLists(GLuint list, GLsizei range)
14043 {
14044 GET_CURRENT_CONTEXT(ctx);
14045 GLuint i;
14046 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
14047 ASSERT_OUTSIDE_BEGIN_END(ctx);
14048
14049 if (range < 0) {
14050 _mesa_error(ctx, GL_INVALID_VALUE, "glDeleteLists");
14051 return;
14052 }
14053
14054 if (range > 1) {
14055 /* We may be deleting a set of bitmap lists. See if there's a
14056 * bitmap atlas to free.
14057 */
14058 struct gl_bitmap_atlas *atlas = lookup_bitmap_atlas(ctx, list);
14059 if (atlas) {
14060 _mesa_delete_bitmap_atlas(ctx, atlas);
14061 _mesa_HashRemove(ctx->Shared->BitmapAtlas, list);
14062 }
14063 }
14064
14065 for (i = list; i < list + range; i++) {
14066 destroy_list(ctx, i);
14067 }
14068 }
14069
14070
14071 /**
14072 * Return a display list number, n, such that lists n through n+range-1
14073 * are free.
14074 */
14075 GLuint GLAPIENTRY
14076 _mesa_GenLists(GLsizei range)
14077 {
14078 GET_CURRENT_CONTEXT(ctx);
14079 GLuint base;
14080 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
14081 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
14082
14083 if (range < 0) {
14084 _mesa_error(ctx, GL_INVALID_VALUE, "glGenLists");
14085 return 0;
14086 }
14087 if (range == 0) {
14088 return 0;
14089 }
14090
14091 /*
14092 * Make this an atomic operation
14093 */
14094 _mesa_HashLockMutex(ctx->Shared->DisplayList);
14095
14096 base = _mesa_HashFindFreeKeyBlock(ctx->Shared->DisplayList, range);
14097 if (base) {
14098 /* reserve the list IDs by with empty/dummy lists */
14099 GLint i;
14100 for (i = 0; i < range; i++) {
14101 _mesa_HashInsertLocked(ctx->Shared->DisplayList, base + i,
14102 make_list(base + i, 1));
14103 }
14104 }
14105
14106 if (USE_BITMAP_ATLAS &&
14107 range > 16 &&
14108 ctx->Driver.DrawAtlasBitmaps) {
14109 /* "range > 16" is a rough heuristic to guess when glGenLists might be
14110 * used to allocate display lists for glXUseXFont or wglUseFontBitmaps.
14111 * Create the empty atlas now.
14112 */
14113 struct gl_bitmap_atlas *atlas = lookup_bitmap_atlas(ctx, base);
14114 if (!atlas) {
14115 atlas = alloc_bitmap_atlas(ctx, base);
14116 }
14117 if (atlas) {
14118 /* Atlas _should_ be new/empty now, but clobbering is OK */
14119 assert(atlas->numBitmaps == 0);
14120 atlas->numBitmaps = range;
14121 }
14122 }
14123
14124 _mesa_HashUnlockMutex(ctx->Shared->DisplayList);
14125
14126 return base;
14127 }
14128
14129
14130 /**
14131 * Begin a new display list.
14132 */
14133 void GLAPIENTRY
14134 _mesa_NewList(GLuint name, GLenum mode)
14135 {
14136 GET_CURRENT_CONTEXT(ctx);
14137
14138 FLUSH_CURRENT(ctx, 0); /* must be called before assert */
14139 ASSERT_OUTSIDE_BEGIN_END(ctx);
14140
14141 if (MESA_VERBOSE & VERBOSE_API)
14142 _mesa_debug(ctx, "glNewList %u %s\n", name,
14143 _mesa_enum_to_string(mode));
14144
14145 if (name == 0) {
14146 _mesa_error(ctx, GL_INVALID_VALUE, "glNewList");
14147 return;
14148 }
14149
14150 if (mode != GL_COMPILE && mode != GL_COMPILE_AND_EXECUTE) {
14151 _mesa_error(ctx, GL_INVALID_ENUM, "glNewList");
14152 return;
14153 }
14154
14155 if (ctx->ListState.CurrentList) {
14156 /* already compiling a display list */
14157 _mesa_error(ctx, GL_INVALID_OPERATION, "glNewList");
14158 return;
14159 }
14160
14161 ctx->CompileFlag = GL_TRUE;
14162 ctx->ExecuteFlag = (mode == GL_COMPILE_AND_EXECUTE);
14163
14164 /* Reset accumulated list state */
14165 invalidate_saved_current_state( ctx );
14166
14167 /* Allocate new display list */
14168 ctx->ListState.CurrentList = make_list(name, BLOCK_SIZE);
14169 ctx->ListState.CurrentBlock = ctx->ListState.CurrentList->Head;
14170 ctx->ListState.CurrentPos = 0;
14171
14172 vbo_save_NewList(ctx, name, mode);
14173
14174 ctx->CurrentServerDispatch = ctx->Save;
14175 _glapi_set_dispatch(ctx->CurrentServerDispatch);
14176 if (ctx->MarshalExec == NULL) {
14177 ctx->CurrentClientDispatch = ctx->CurrentServerDispatch;
14178 }
14179 }
14180
14181
14182 /**
14183 * End definition of current display list.
14184 */
14185 void GLAPIENTRY
14186 _mesa_EndList(void)
14187 {
14188 GET_CURRENT_CONTEXT(ctx);
14189 SAVE_FLUSH_VERTICES(ctx);
14190 FLUSH_VERTICES(ctx, 0);
14191
14192 if (MESA_VERBOSE & VERBOSE_API)
14193 _mesa_debug(ctx, "glEndList\n");
14194
14195 if (ctx->ExecuteFlag && _mesa_inside_dlist_begin_end(ctx)) {
14196 _mesa_error(ctx, GL_INVALID_OPERATION,
14197 "glEndList() called inside glBegin/End");
14198 }
14199
14200 /* Check that a list is under construction */
14201 if (!ctx->ListState.CurrentList) {
14202 _mesa_error(ctx, GL_INVALID_OPERATION, "glEndList");
14203 return;
14204 }
14205
14206 /* Call before emitting END_OF_LIST, in case the driver wants to
14207 * emit opcodes itself.
14208 */
14209 vbo_save_EndList(ctx);
14210
14211 (void) alloc_instruction(ctx, OPCODE_END_OF_LIST, 0);
14212
14213 trim_list(ctx);
14214
14215 /* Destroy old list, if any */
14216 destroy_list(ctx, ctx->ListState.CurrentList->Name);
14217
14218 /* Install the new list */
14219 _mesa_HashInsert(ctx->Shared->DisplayList,
14220 ctx->ListState.CurrentList->Name,
14221 ctx->ListState.CurrentList);
14222
14223
14224 if (MESA_VERBOSE & VERBOSE_DISPLAY_LIST)
14225 mesa_print_display_list(ctx->ListState.CurrentList->Name);
14226
14227 ctx->ListState.CurrentList = NULL;
14228 ctx->ListState.CurrentBlock = NULL;
14229 ctx->ListState.CurrentPos = 0;
14230 ctx->ExecuteFlag = GL_TRUE;
14231 ctx->CompileFlag = GL_FALSE;
14232
14233 ctx->CurrentServerDispatch = ctx->Exec;
14234 _glapi_set_dispatch(ctx->CurrentServerDispatch);
14235 if (ctx->MarshalExec == NULL) {
14236 ctx->CurrentClientDispatch = ctx->CurrentServerDispatch;
14237 }
14238 }
14239
14240
14241 void GLAPIENTRY
14242 _mesa_CallList(GLuint list)
14243 {
14244 GLboolean save_compile_flag;
14245 GET_CURRENT_CONTEXT(ctx);
14246 FLUSH_CURRENT(ctx, 0);
14247
14248 if (MESA_VERBOSE & VERBOSE_API)
14249 _mesa_debug(ctx, "glCallList %d\n", list);
14250
14251 if (list == 0) {
14252 _mesa_error(ctx, GL_INVALID_VALUE, "glCallList(list==0)");
14253 return;
14254 }
14255
14256 if (0)
14257 mesa_print_display_list( list );
14258
14259 /* VERY IMPORTANT: Save the CompileFlag status, turn it off,
14260 * execute the display list, and restore the CompileFlag.
14261 */
14262 save_compile_flag = ctx->CompileFlag;
14263 if (save_compile_flag) {
14264 ctx->CompileFlag = GL_FALSE;
14265 }
14266
14267 execute_list(ctx, list);
14268 ctx->CompileFlag = save_compile_flag;
14269
14270 /* also restore API function pointers to point to "save" versions */
14271 if (save_compile_flag) {
14272 ctx->CurrentServerDispatch = ctx->Save;
14273 _glapi_set_dispatch(ctx->CurrentServerDispatch);
14274 if (ctx->MarshalExec == NULL) {
14275 ctx->CurrentClientDispatch = ctx->CurrentServerDispatch;
14276 }
14277 }
14278 }
14279
14280
14281 /**
14282 * Try to execute a glCallLists() command where the display lists contain
14283 * glBitmap commands with a texture atlas.
14284 * \return true for success, false otherwise
14285 */
14286 static bool
14287 render_bitmap_atlas(struct gl_context *ctx, GLsizei n, GLenum type,
14288 const void *lists)
14289 {
14290 struct gl_bitmap_atlas *atlas;
14291 int i;
14292
14293 if (!USE_BITMAP_ATLAS ||
14294 !ctx->Current.RasterPosValid ||
14295 ctx->List.ListBase == 0 ||
14296 type != GL_UNSIGNED_BYTE ||
14297 !ctx->Driver.DrawAtlasBitmaps) {
14298 /* unsupported */
14299 return false;
14300 }
14301
14302 atlas = lookup_bitmap_atlas(ctx, ctx->List.ListBase);
14303
14304 if (!atlas) {
14305 /* Even if glGenLists wasn't called, we can still try to create
14306 * the atlas now.
14307 */
14308 atlas = alloc_bitmap_atlas(ctx, ctx->List.ListBase);
14309 }
14310
14311 if (atlas && !atlas->complete && !atlas->incomplete) {
14312 /* Try to build the bitmap atlas now.
14313 * If the atlas was created in glGenLists, we'll have recorded the
14314 * number of lists (bitmaps). Otherwise, take a guess at 256.
14315 */
14316 if (atlas->numBitmaps == 0)
14317 atlas->numBitmaps = 256;
14318 build_bitmap_atlas(ctx, atlas, ctx->List.ListBase);
14319 }
14320
14321 if (!atlas || !atlas->complete) {
14322 return false;
14323 }
14324
14325 /* check that all display list IDs are in the atlas */
14326 for (i = 0; i < n; i++) {
14327 const GLubyte *ids = (const GLubyte *) lists;
14328
14329 if (ids[i] >= atlas->numBitmaps) {
14330 return false;
14331 }
14332 }
14333
14334 ctx->Driver.DrawAtlasBitmaps(ctx, atlas, n, (const GLubyte *) lists);
14335
14336 return true;
14337 }
14338
14339
14340 /**
14341 * Execute glCallLists: call multiple display lists.
14342 */
14343 void GLAPIENTRY
14344 _mesa_CallLists(GLsizei n, GLenum type, const GLvoid * lists)
14345 {
14346 GET_CURRENT_CONTEXT(ctx);
14347 GLint i;
14348 GLboolean save_compile_flag;
14349
14350 if (MESA_VERBOSE & VERBOSE_API)
14351 _mesa_debug(ctx, "glCallLists %d\n", n);
14352
14353 switch (type) {
14354 case GL_BYTE:
14355 case GL_UNSIGNED_BYTE:
14356 case GL_SHORT:
14357 case GL_UNSIGNED_SHORT:
14358 case GL_INT:
14359 case GL_UNSIGNED_INT:
14360 case GL_FLOAT:
14361 case GL_2_BYTES:
14362 case GL_3_BYTES:
14363 case GL_4_BYTES:
14364 /* OK */
14365 break;
14366 default:
14367 _mesa_error(ctx, GL_INVALID_ENUM, "glCallLists(type)");
14368 return;
14369 }
14370
14371 if (n < 0) {
14372 _mesa_error(ctx, GL_INVALID_VALUE, "glCallLists(n < 0)");
14373 return;
14374 } else if (n == 0 || lists == NULL) {
14375 /* nothing to do */
14376 return;
14377 }
14378
14379 if (render_bitmap_atlas(ctx, n, type, lists)) {
14380 return;
14381 }
14382
14383 /* Save the CompileFlag status, turn it off, execute display list,
14384 * and restore the CompileFlag.
14385 */
14386 save_compile_flag = ctx->CompileFlag;
14387 ctx->CompileFlag = GL_FALSE;
14388
14389 for (i = 0; i < n; i++) {
14390 GLuint list = (GLuint) (ctx->List.ListBase + translate_id(i, type, lists));
14391 execute_list(ctx, list);
14392 }
14393
14394 ctx->CompileFlag = save_compile_flag;
14395
14396 /* also restore API function pointers to point to "save" versions */
14397 if (save_compile_flag) {
14398 ctx->CurrentServerDispatch = ctx->Save;
14399 _glapi_set_dispatch(ctx->CurrentServerDispatch);
14400 if (ctx->MarshalExec == NULL) {
14401 ctx->CurrentClientDispatch = ctx->CurrentServerDispatch;
14402 }
14403 }
14404 }
14405
14406
14407 /**
14408 * Set the offset added to list numbers in glCallLists.
14409 */
14410 void GLAPIENTRY
14411 _mesa_ListBase(GLuint base)
14412 {
14413 GET_CURRENT_CONTEXT(ctx);
14414 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
14415 ASSERT_OUTSIDE_BEGIN_END(ctx);
14416 ctx->List.ListBase = base;
14417 }
14418
14419 /**
14420 * Setup the given dispatch table to point to Mesa's display list
14421 * building functions.
14422 *
14423 * This does not include any of the tnl functions - they are
14424 * initialized from _mesa_init_api_defaults and from the active vtxfmt
14425 * struct.
14426 */
14427 void
14428 _mesa_initialize_save_table(const struct gl_context *ctx)
14429 {
14430 struct _glapi_table *table = ctx->Save;
14431 int numEntries = MAX2(_gloffset_COUNT, _glapi_get_dispatch_table_size());
14432
14433 /* Initially populate the dispatch table with the contents of the
14434 * normal-execution dispatch table. This lets us skip populating functions
14435 * that should be called directly instead of compiled into display lists.
14436 */
14437 memcpy(table, ctx->Exec, numEntries * sizeof(_glapi_proc));
14438
14439 _mesa_loopback_init_api_table(ctx, table);
14440
14441 /* VBO functions */
14442 vbo_initialize_save_dispatch(ctx, table);
14443
14444 /* GL 1.0 */
14445 SET_Accum(table, save_Accum);
14446 SET_AlphaFunc(table, save_AlphaFunc);
14447 SET_Bitmap(table, save_Bitmap);
14448 SET_BlendFunc(table, save_BlendFunc);
14449 SET_CallList(table, save_CallList);
14450 SET_CallLists(table, save_CallLists);
14451 SET_Clear(table, save_Clear);
14452 SET_ClearAccum(table, save_ClearAccum);
14453 SET_ClearColor(table, save_ClearColor);
14454 SET_ClearDepth(table, save_ClearDepth);
14455 SET_ClearIndex(table, save_ClearIndex);
14456 SET_ClearStencil(table, save_ClearStencil);
14457 SET_ClipPlane(table, save_ClipPlane);
14458 SET_ColorMask(table, save_ColorMask);
14459 SET_ColorMaski(table, save_ColorMaskIndexed);
14460 SET_ColorMaterial(table, save_ColorMaterial);
14461 SET_CopyPixels(table, save_CopyPixels);
14462 SET_CullFace(table, save_CullFace);
14463 SET_DepthFunc(table, save_DepthFunc);
14464 SET_DepthMask(table, save_DepthMask);
14465 SET_DepthRange(table, save_DepthRange);
14466 SET_Disable(table, save_Disable);
14467 SET_Disablei(table, save_DisableIndexed);
14468 SET_DrawBuffer(table, save_DrawBuffer);
14469 SET_DrawPixels(table, save_DrawPixels);
14470 SET_Enable(table, save_Enable);
14471 SET_Enablei(table, save_EnableIndexed);
14472 SET_EvalMesh1(table, save_EvalMesh1);
14473 SET_EvalMesh2(table, save_EvalMesh2);
14474 SET_Fogf(table, save_Fogf);
14475 SET_Fogfv(table, save_Fogfv);
14476 SET_Fogi(table, save_Fogi);
14477 SET_Fogiv(table, save_Fogiv);
14478 SET_FrontFace(table, save_FrontFace);
14479 SET_Frustum(table, save_Frustum);
14480 SET_Hint(table, save_Hint);
14481 SET_IndexMask(table, save_IndexMask);
14482 SET_InitNames(table, save_InitNames);
14483 SET_LightModelf(table, save_LightModelf);
14484 SET_LightModelfv(table, save_LightModelfv);
14485 SET_LightModeli(table, save_LightModeli);
14486 SET_LightModeliv(table, save_LightModeliv);
14487 SET_Lightf(table, save_Lightf);
14488 SET_Lightfv(table, save_Lightfv);
14489 SET_Lighti(table, save_Lighti);
14490 SET_Lightiv(table, save_Lightiv);
14491 SET_LineStipple(table, save_LineStipple);
14492 SET_LineWidth(table, save_LineWidth);
14493 SET_ListBase(table, save_ListBase);
14494 SET_LoadIdentity(table, save_LoadIdentity);
14495 SET_LoadMatrixd(table, save_LoadMatrixd);
14496 SET_LoadMatrixf(table, save_LoadMatrixf);
14497 SET_LoadName(table, save_LoadName);
14498 SET_LogicOp(table, save_LogicOp);
14499 SET_Map1d(table, save_Map1d);
14500 SET_Map1f(table, save_Map1f);
14501 SET_Map2d(table, save_Map2d);
14502 SET_Map2f(table, save_Map2f);
14503 SET_MapGrid1d(table, save_MapGrid1d);
14504 SET_MapGrid1f(table, save_MapGrid1f);
14505 SET_MapGrid2d(table, save_MapGrid2d);
14506 SET_MapGrid2f(table, save_MapGrid2f);
14507 SET_MatrixMode(table, save_MatrixMode);
14508 SET_MultMatrixd(table, save_MultMatrixd);
14509 SET_MultMatrixf(table, save_MultMatrixf);
14510 SET_NewList(table, save_NewList);
14511 SET_Ortho(table, save_Ortho);
14512 SET_PassThrough(table, save_PassThrough);
14513 SET_PixelMapfv(table, save_PixelMapfv);
14514 SET_PixelMapuiv(table, save_PixelMapuiv);
14515 SET_PixelMapusv(table, save_PixelMapusv);
14516 SET_PixelTransferf(table, save_PixelTransferf);
14517 SET_PixelTransferi(table, save_PixelTransferi);
14518 SET_PixelZoom(table, save_PixelZoom);
14519 SET_PointSize(table, save_PointSize);
14520 SET_PolygonMode(table, save_PolygonMode);
14521 SET_PolygonOffset(table, save_PolygonOffset);
14522 SET_PolygonStipple(table, save_PolygonStipple);
14523 SET_PopAttrib(table, save_PopAttrib);
14524 SET_PopMatrix(table, save_PopMatrix);
14525 SET_PopName(table, save_PopName);
14526 SET_PushAttrib(table, save_PushAttrib);
14527 SET_PushMatrix(table, save_PushMatrix);
14528 SET_PushName(table, save_PushName);
14529 SET_RasterPos2d(table, save_RasterPos2d);
14530 SET_RasterPos2dv(table, save_RasterPos2dv);
14531 SET_RasterPos2f(table, save_RasterPos2f);
14532 SET_RasterPos2fv(table, save_RasterPos2fv);
14533 SET_RasterPos2i(table, save_RasterPos2i);
14534 SET_RasterPos2iv(table, save_RasterPos2iv);
14535 SET_RasterPos2s(table, save_RasterPos2s);
14536 SET_RasterPos2sv(table, save_RasterPos2sv);
14537 SET_RasterPos3d(table, save_RasterPos3d);
14538 SET_RasterPos3dv(table, save_RasterPos3dv);
14539 SET_RasterPos3f(table, save_RasterPos3f);
14540 SET_RasterPos3fv(table, save_RasterPos3fv);
14541 SET_RasterPos3i(table, save_RasterPos3i);
14542 SET_RasterPos3iv(table, save_RasterPos3iv);
14543 SET_RasterPos3s(table, save_RasterPos3s);
14544 SET_RasterPos3sv(table, save_RasterPos3sv);
14545 SET_RasterPos4d(table, save_RasterPos4d);
14546 SET_RasterPos4dv(table, save_RasterPos4dv);
14547 SET_RasterPos4f(table, save_RasterPos4f);
14548 SET_RasterPos4fv(table, save_RasterPos4fv);
14549 SET_RasterPos4i(table, save_RasterPos4i);
14550 SET_RasterPos4iv(table, save_RasterPos4iv);
14551 SET_RasterPos4s(table, save_RasterPos4s);
14552 SET_RasterPos4sv(table, save_RasterPos4sv);
14553 SET_ReadBuffer(table, save_ReadBuffer);
14554 SET_Rectf(table, save_Rectf);
14555 SET_Rotated(table, save_Rotated);
14556 SET_Rotatef(table, save_Rotatef);
14557 SET_Scaled(table, save_Scaled);
14558 SET_Scalef(table, save_Scalef);
14559 SET_Scissor(table, save_Scissor);
14560 SET_ShadeModel(table, save_ShadeModel);
14561 SET_StencilFunc(table, save_StencilFunc);
14562 SET_StencilMask(table, save_StencilMask);
14563 SET_StencilOp(table, save_StencilOp);
14564 SET_TexEnvf(table, save_TexEnvf);
14565 SET_TexEnvfv(table, save_TexEnvfv);
14566 SET_TexEnvi(table, save_TexEnvi);
14567 SET_TexEnviv(table, save_TexEnviv);
14568 SET_TexGend(table, save_TexGend);
14569 SET_TexGendv(table, save_TexGendv);
14570 SET_TexGenf(table, save_TexGenf);
14571 SET_TexGenfv(table, save_TexGenfv);
14572 SET_TexGeni(table, save_TexGeni);
14573 SET_TexGeniv(table, save_TexGeniv);
14574 SET_TexImage1D(table, save_TexImage1D);
14575 SET_TexImage2D(table, save_TexImage2D);
14576 SET_TexParameterf(table, save_TexParameterf);
14577 SET_TexParameterfv(table, save_TexParameterfv);
14578 SET_TexParameteri(table, save_TexParameteri);
14579 SET_TexParameteriv(table, save_TexParameteriv);
14580 SET_Translated(table, save_Translated);
14581 SET_Translatef(table, save_Translatef);
14582 SET_Viewport(table, save_Viewport);
14583
14584 /* GL 1.1 */
14585 SET_BindTexture(table, save_BindTexture);
14586 SET_CopyTexImage1D(table, save_CopyTexImage1D);
14587 SET_CopyTexImage2D(table, save_CopyTexImage2D);
14588 SET_CopyTexSubImage1D(table, save_CopyTexSubImage1D);
14589 SET_CopyTexSubImage2D(table, save_CopyTexSubImage2D);
14590 SET_PrioritizeTextures(table, save_PrioritizeTextures);
14591 SET_TexSubImage1D(table, save_TexSubImage1D);
14592 SET_TexSubImage2D(table, save_TexSubImage2D);
14593
14594 /* GL 1.2 */
14595 SET_CopyTexSubImage3D(table, save_CopyTexSubImage3D);
14596 SET_TexImage3D(table, save_TexImage3D);
14597 SET_TexSubImage3D(table, save_TexSubImage3D);
14598
14599 /* GL 2.0 */
14600 SET_StencilFuncSeparate(table, save_StencilFuncSeparate);
14601 SET_StencilMaskSeparate(table, save_StencilMaskSeparate);
14602 SET_StencilOpSeparate(table, save_StencilOpSeparate);
14603
14604 /* ATI_separate_stencil */
14605 SET_StencilFuncSeparateATI(table, save_StencilFuncSeparateATI);
14606
14607 /* GL_ARB_imaging */
14608 /* Not all are supported */
14609 SET_BlendColor(table, save_BlendColor);
14610 SET_BlendEquation(table, save_BlendEquation);
14611
14612 /* 2. GL_EXT_blend_color */
14613 #if 0
14614 SET_BlendColorEXT(table, save_BlendColorEXT);
14615 #endif
14616
14617 /* 6. GL_EXT_texture3d */
14618 #if 0
14619 SET_CopyTexSubImage3DEXT(table, save_CopyTexSubImage3D);
14620 SET_TexImage3DEXT(table, save_TexImage3DEXT);
14621 SET_TexSubImage3DEXT(table, save_TexSubImage3D);
14622 #endif
14623
14624 /* 37. GL_EXT_blend_minmax */
14625 #if 0
14626 SET_BlendEquationEXT(table, save_BlendEquationEXT);
14627 #endif
14628
14629 /* 54. GL_EXT_point_parameters */
14630 SET_PointParameterf(table, save_PointParameterfEXT);
14631 SET_PointParameterfv(table, save_PointParameterfvEXT);
14632
14633 /* 91. GL_ARB_tessellation_shader */
14634 SET_PatchParameteri(table, save_PatchParameteri);
14635 SET_PatchParameterfv(table, save_PatchParameterfv);
14636
14637 /* 100. ARB_viewport_array */
14638 SET_ViewportArrayv(table, save_ViewportArrayv);
14639 SET_ViewportIndexedf(table, save_ViewportIndexedf);
14640 SET_ViewportIndexedfv(table, save_ViewportIndexedfv);
14641 SET_ScissorArrayv(table, save_ScissorArrayv);
14642 SET_ScissorIndexed(table, save_ScissorIndexed);
14643 SET_ScissorIndexedv(table, save_ScissorIndexedv);
14644 SET_DepthRangeArrayv(table, save_DepthRangeArrayv);
14645 SET_DepthRangeIndexed(table, save_DepthRangeIndexed);
14646
14647 /* 122. ARB_compute_shader */
14648 SET_DispatchCompute(table, save_DispatchCompute);
14649 SET_DispatchComputeIndirect(table, save_DispatchComputeIndirect);
14650
14651 /* 173. GL_EXT_blend_func_separate */
14652 SET_BlendFuncSeparate(table, save_BlendFuncSeparateEXT);
14653
14654 /* 197. GL_MESA_window_pos */
14655 SET_WindowPos2d(table, save_WindowPos2dMESA);
14656 SET_WindowPos2dv(table, save_WindowPos2dvMESA);
14657 SET_WindowPos2f(table, save_WindowPos2fMESA);
14658 SET_WindowPos2fv(table, save_WindowPos2fvMESA);
14659 SET_WindowPos2i(table, save_WindowPos2iMESA);
14660 SET_WindowPos2iv(table, save_WindowPos2ivMESA);
14661 SET_WindowPos2s(table, save_WindowPos2sMESA);
14662 SET_WindowPos2sv(table, save_WindowPos2svMESA);
14663 SET_WindowPos3d(table, save_WindowPos3dMESA);
14664 SET_WindowPos3dv(table, save_WindowPos3dvMESA);
14665 SET_WindowPos3f(table, save_WindowPos3fMESA);
14666 SET_WindowPos3fv(table, save_WindowPos3fvMESA);
14667 SET_WindowPos3i(table, save_WindowPos3iMESA);
14668 SET_WindowPos3iv(table, save_WindowPos3ivMESA);
14669 SET_WindowPos3s(table, save_WindowPos3sMESA);
14670 SET_WindowPos3sv(table, save_WindowPos3svMESA);
14671 SET_WindowPos4dMESA(table, save_WindowPos4dMESA);
14672 SET_WindowPos4dvMESA(table, save_WindowPos4dvMESA);
14673 SET_WindowPos4fMESA(table, save_WindowPos4fMESA);
14674 SET_WindowPos4fvMESA(table, save_WindowPos4fvMESA);
14675 SET_WindowPos4iMESA(table, save_WindowPos4iMESA);
14676 SET_WindowPos4ivMESA(table, save_WindowPos4ivMESA);
14677 SET_WindowPos4sMESA(table, save_WindowPos4sMESA);
14678 SET_WindowPos4svMESA(table, save_WindowPos4svMESA);
14679
14680 /* 245. GL_ATI_fragment_shader */
14681 SET_BindFragmentShaderATI(table, save_BindFragmentShaderATI);
14682 SET_SetFragmentShaderConstantATI(table, save_SetFragmentShaderConstantATI);
14683
14684 /* 262. GL_NV_point_sprite */
14685 SET_PointParameteri(table, save_PointParameteriNV);
14686 SET_PointParameteriv(table, save_PointParameterivNV);
14687
14688 /* 268. GL_EXT_stencil_two_side */
14689 SET_ActiveStencilFaceEXT(table, save_ActiveStencilFaceEXT);
14690
14691 /* ???. GL_EXT_depth_bounds_test */
14692 SET_DepthBoundsEXT(table, save_DepthBoundsEXT);
14693
14694 /* ARB 1. GL_ARB_multitexture */
14695 SET_ActiveTexture(table, save_ActiveTextureARB);
14696
14697 /* ARB 3. GL_ARB_transpose_matrix */
14698 SET_LoadTransposeMatrixd(table, save_LoadTransposeMatrixdARB);
14699 SET_LoadTransposeMatrixf(table, save_LoadTransposeMatrixfARB);
14700 SET_MultTransposeMatrixd(table, save_MultTransposeMatrixdARB);
14701 SET_MultTransposeMatrixf(table, save_MultTransposeMatrixfARB);
14702
14703 /* ARB 5. GL_ARB_multisample */
14704 SET_SampleCoverage(table, save_SampleCoverageARB);
14705
14706 /* ARB 12. GL_ARB_texture_compression */
14707 SET_CompressedTexImage3D(table, save_CompressedTexImage3DARB);
14708 SET_CompressedTexImage2D(table, save_CompressedTexImage2DARB);
14709 SET_CompressedTexImage1D(table, save_CompressedTexImage1DARB);
14710 SET_CompressedTexSubImage3D(table, save_CompressedTexSubImage3DARB);
14711 SET_CompressedTexSubImage2D(table, save_CompressedTexSubImage2DARB);
14712 SET_CompressedTexSubImage1D(table, save_CompressedTexSubImage1DARB);
14713
14714 /* ARB 14. GL_ARB_point_parameters */
14715 /* aliased with EXT_point_parameters functions */
14716
14717 /* ARB 25. GL_ARB_window_pos */
14718 /* aliased with MESA_window_pos functions */
14719
14720 /* ARB 26. GL_ARB_vertex_program */
14721 /* ARB 27. GL_ARB_fragment_program */
14722 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
14723 SET_ProgramStringARB(table, save_ProgramStringARB);
14724 SET_BindProgramARB(table, save_BindProgramARB);
14725 SET_ProgramEnvParameter4dARB(table, save_ProgramEnvParameter4dARB);
14726 SET_ProgramEnvParameter4dvARB(table, save_ProgramEnvParameter4dvARB);
14727 SET_ProgramEnvParameter4fARB(table, save_ProgramEnvParameter4fARB);
14728 SET_ProgramEnvParameter4fvARB(table, save_ProgramEnvParameter4fvARB);
14729 SET_ProgramLocalParameter4dARB(table, save_ProgramLocalParameter4dARB);
14730 SET_ProgramLocalParameter4dvARB(table, save_ProgramLocalParameter4dvARB);
14731 SET_ProgramLocalParameter4fARB(table, save_ProgramLocalParameter4fARB);
14732 SET_ProgramLocalParameter4fvARB(table, save_ProgramLocalParameter4fvARB);
14733
14734 SET_BeginQuery(table, save_BeginQueryARB);
14735 SET_EndQuery(table, save_EndQueryARB);
14736 SET_QueryCounter(table, save_QueryCounter);
14737
14738 SET_DrawBuffers(table, save_DrawBuffersARB);
14739
14740 SET_BlitFramebuffer(table, save_BlitFramebufferEXT);
14741
14742 SET_UseProgram(table, save_UseProgram);
14743 SET_Uniform1f(table, save_Uniform1fARB);
14744 SET_Uniform2f(table, save_Uniform2fARB);
14745 SET_Uniform3f(table, save_Uniform3fARB);
14746 SET_Uniform4f(table, save_Uniform4fARB);
14747 SET_Uniform1fv(table, save_Uniform1fvARB);
14748 SET_Uniform2fv(table, save_Uniform2fvARB);
14749 SET_Uniform3fv(table, save_Uniform3fvARB);
14750 SET_Uniform4fv(table, save_Uniform4fvARB);
14751 SET_Uniform1i(table, save_Uniform1iARB);
14752 SET_Uniform2i(table, save_Uniform2iARB);
14753 SET_Uniform3i(table, save_Uniform3iARB);
14754 SET_Uniform4i(table, save_Uniform4iARB);
14755 SET_Uniform1iv(table, save_Uniform1ivARB);
14756 SET_Uniform2iv(table, save_Uniform2ivARB);
14757 SET_Uniform3iv(table, save_Uniform3ivARB);
14758 SET_Uniform4iv(table, save_Uniform4ivARB);
14759 SET_UniformMatrix2fv(table, save_UniformMatrix2fvARB);
14760 SET_UniformMatrix3fv(table, save_UniformMatrix3fvARB);
14761 SET_UniformMatrix4fv(table, save_UniformMatrix4fvARB);
14762 SET_UniformMatrix2x3fv(table, save_UniformMatrix2x3fv);
14763 SET_UniformMatrix3x2fv(table, save_UniformMatrix3x2fv);
14764 SET_UniformMatrix2x4fv(table, save_UniformMatrix2x4fv);
14765 SET_UniformMatrix4x2fv(table, save_UniformMatrix4x2fv);
14766 SET_UniformMatrix3x4fv(table, save_UniformMatrix3x4fv);
14767 SET_UniformMatrix4x3fv(table, save_UniformMatrix4x3fv);
14768
14769 /* 299. GL_EXT_blend_equation_separate */
14770 SET_BlendEquationSeparate(table, save_BlendEquationSeparateEXT);
14771
14772 /* GL_EXT_gpu_program_parameters */
14773 SET_ProgramEnvParameters4fvEXT(table, save_ProgramEnvParameters4fvEXT);
14774 SET_ProgramLocalParameters4fvEXT(table, save_ProgramLocalParameters4fvEXT);
14775
14776 /* 364. GL_EXT_provoking_vertex */
14777 SET_ProvokingVertex(table, save_ProvokingVertexEXT);
14778
14779 /* GL_EXT_texture_integer */
14780 SET_ClearColorIiEXT(table, save_ClearColorIi);
14781 SET_ClearColorIuiEXT(table, save_ClearColorIui);
14782 SET_TexParameterIiv(table, save_TexParameterIiv);
14783 SET_TexParameterIuiv(table, save_TexParameterIuiv);
14784
14785 /* GL_ARB_clip_control */
14786 SET_ClipControl(table, save_ClipControl);
14787
14788 /* GL_ARB_color_buffer_float */
14789 SET_ClampColor(table, save_ClampColorARB);
14790
14791 /* GL 3.0 */
14792 SET_ClearBufferiv(table, save_ClearBufferiv);
14793 SET_ClearBufferuiv(table, save_ClearBufferuiv);
14794 SET_ClearBufferfv(table, save_ClearBufferfv);
14795 SET_ClearBufferfi(table, save_ClearBufferfi);
14796 SET_Uniform1ui(table, save_Uniform1ui);
14797 SET_Uniform2ui(table, save_Uniform2ui);
14798 SET_Uniform3ui(table, save_Uniform3ui);
14799 SET_Uniform4ui(table, save_Uniform4ui);
14800 SET_Uniform1uiv(table, save_Uniform1uiv);
14801 SET_Uniform2uiv(table, save_Uniform2uiv);
14802 SET_Uniform3uiv(table, save_Uniform3uiv);
14803 SET_Uniform4uiv(table, save_Uniform4uiv);
14804
14805 /* GL_ARB_gpu_shader_fp64 */
14806 SET_Uniform1d(table, save_Uniform1d);
14807 SET_Uniform2d(table, save_Uniform2d);
14808 SET_Uniform3d(table, save_Uniform3d);
14809 SET_Uniform4d(table, save_Uniform4d);
14810 SET_Uniform1dv(table, save_Uniform1dv);
14811 SET_Uniform2dv(table, save_Uniform2dv);
14812 SET_Uniform3dv(table, save_Uniform3dv);
14813 SET_Uniform4dv(table, save_Uniform4dv);
14814 SET_UniformMatrix2dv(table, save_UniformMatrix2dv);
14815 SET_UniformMatrix3dv(table, save_UniformMatrix3dv);
14816 SET_UniformMatrix4dv(table, save_UniformMatrix4dv);
14817 SET_UniformMatrix2x3dv(table, save_UniformMatrix2x3dv);
14818 SET_UniformMatrix3x2dv(table, save_UniformMatrix3x2dv);
14819 SET_UniformMatrix2x4dv(table, save_UniformMatrix2x4dv);
14820 SET_UniformMatrix4x2dv(table, save_UniformMatrix4x2dv);
14821 SET_UniformMatrix3x4dv(table, save_UniformMatrix3x4dv);
14822 SET_UniformMatrix4x3dv(table, save_UniformMatrix4x3dv);
14823
14824 /* GL_ARB_gpu_shader_int64 */
14825 SET_Uniform1i64ARB(table, save_Uniform1i64ARB);
14826 SET_Uniform2i64ARB(table, save_Uniform2i64ARB);
14827 SET_Uniform3i64ARB(table, save_Uniform3i64ARB);
14828 SET_Uniform4i64ARB(table, save_Uniform4i64ARB);
14829 SET_Uniform1i64vARB(table, save_Uniform1i64vARB);
14830 SET_Uniform2i64vARB(table, save_Uniform2i64vARB);
14831 SET_Uniform3i64vARB(table, save_Uniform3i64vARB);
14832 SET_Uniform4i64vARB(table, save_Uniform4i64vARB);
14833 SET_Uniform1ui64ARB(table, save_Uniform1ui64ARB);
14834 SET_Uniform2ui64ARB(table, save_Uniform2ui64ARB);
14835 SET_Uniform3ui64ARB(table, save_Uniform3ui64ARB);
14836 SET_Uniform4ui64ARB(table, save_Uniform4ui64ARB);
14837 SET_Uniform1ui64vARB(table, save_Uniform1ui64vARB);
14838 SET_Uniform2ui64vARB(table, save_Uniform2ui64vARB);
14839 SET_Uniform3ui64vARB(table, save_Uniform3ui64vARB);
14840 SET_Uniform4ui64vARB(table, save_Uniform4ui64vARB);
14841
14842 SET_ProgramUniform1i64ARB(table, save_ProgramUniform1i64ARB);
14843 SET_ProgramUniform2i64ARB(table, save_ProgramUniform2i64ARB);
14844 SET_ProgramUniform3i64ARB(table, save_ProgramUniform3i64ARB);
14845 SET_ProgramUniform4i64ARB(table, save_ProgramUniform4i64ARB);
14846 SET_ProgramUniform1i64vARB(table, save_ProgramUniform1i64vARB);
14847 SET_ProgramUniform2i64vARB(table, save_ProgramUniform2i64vARB);
14848 SET_ProgramUniform3i64vARB(table, save_ProgramUniform3i64vARB);
14849 SET_ProgramUniform4i64vARB(table, save_ProgramUniform4i64vARB);
14850 SET_ProgramUniform1ui64ARB(table, save_ProgramUniform1ui64ARB);
14851 SET_ProgramUniform2ui64ARB(table, save_ProgramUniform2ui64ARB);
14852 SET_ProgramUniform3ui64ARB(table, save_ProgramUniform3ui64ARB);
14853 SET_ProgramUniform4ui64ARB(table, save_ProgramUniform4ui64ARB);
14854 SET_ProgramUniform1ui64vARB(table, save_ProgramUniform1ui64vARB);
14855 SET_ProgramUniform2ui64vARB(table, save_ProgramUniform2ui64vARB);
14856 SET_ProgramUniform3ui64vARB(table, save_ProgramUniform3ui64vARB);
14857 SET_ProgramUniform4ui64vARB(table, save_ProgramUniform4ui64vARB);
14858
14859 /* These are: */
14860 SET_BeginTransformFeedback(table, save_BeginTransformFeedback);
14861 SET_EndTransformFeedback(table, save_EndTransformFeedback);
14862 SET_BindTransformFeedback(table, save_BindTransformFeedback);
14863 SET_PauseTransformFeedback(table, save_PauseTransformFeedback);
14864 SET_ResumeTransformFeedback(table, save_ResumeTransformFeedback);
14865 SET_DrawTransformFeedback(table, save_DrawTransformFeedback);
14866 SET_DrawTransformFeedbackStream(table, save_DrawTransformFeedbackStream);
14867 SET_DrawTransformFeedbackInstanced(table,
14868 save_DrawTransformFeedbackInstanced);
14869 SET_DrawTransformFeedbackStreamInstanced(table,
14870 save_DrawTransformFeedbackStreamInstanced);
14871 SET_BeginQueryIndexed(table, save_BeginQueryIndexed);
14872 SET_EndQueryIndexed(table, save_EndQueryIndexed);
14873
14874 /* GL_ARB_instanced_arrays */
14875 SET_VertexAttribDivisor(table, save_VertexAttribDivisor);
14876
14877 /* GL_NV_texture_barrier */
14878 SET_TextureBarrierNV(table, save_TextureBarrierNV);
14879
14880 SET_BindSampler(table, save_BindSampler);
14881 SET_SamplerParameteri(table, save_SamplerParameteri);
14882 SET_SamplerParameterf(table, save_SamplerParameterf);
14883 SET_SamplerParameteriv(table, save_SamplerParameteriv);
14884 SET_SamplerParameterfv(table, save_SamplerParameterfv);
14885 SET_SamplerParameterIiv(table, save_SamplerParameterIiv);
14886 SET_SamplerParameterIuiv(table, save_SamplerParameterIuiv);
14887
14888 /* GL_ARB_draw_buffer_blend */
14889 SET_BlendFunciARB(table, save_BlendFunci);
14890 SET_BlendFuncSeparateiARB(table, save_BlendFuncSeparatei);
14891 SET_BlendEquationiARB(table, save_BlendEquationi);
14892 SET_BlendEquationSeparateiARB(table, save_BlendEquationSeparatei);
14893
14894 /* GL_NV_conditional_render */
14895 SET_BeginConditionalRender(table, save_BeginConditionalRender);
14896 SET_EndConditionalRender(table, save_EndConditionalRender);
14897
14898 /* GL_ARB_sync */
14899 SET_WaitSync(table, save_WaitSync);
14900
14901 /* GL_ARB_uniform_buffer_object */
14902 SET_UniformBlockBinding(table, save_UniformBlockBinding);
14903
14904 /* GL_ARB_shader_subroutines */
14905 SET_UniformSubroutinesuiv(table, save_UniformSubroutinesuiv);
14906
14907 /* GL_ARB_draw_instanced */
14908 SET_DrawArraysInstancedARB(table, save_DrawArraysInstancedARB);
14909 SET_DrawElementsInstancedARB(table, save_DrawElementsInstancedARB);
14910
14911 /* GL_ARB_draw_elements_base_vertex */
14912 SET_DrawElementsInstancedBaseVertex(table, save_DrawElementsInstancedBaseVertexARB);
14913
14914 /* GL_ARB_base_instance */
14915 SET_DrawArraysInstancedBaseInstance(table, save_DrawArraysInstancedBaseInstance);
14916 SET_DrawElementsInstancedBaseInstance(table, save_DrawElementsInstancedBaseInstance);
14917 SET_DrawElementsInstancedBaseVertexBaseInstance(table, save_DrawElementsInstancedBaseVertexBaseInstance);
14918
14919 /* GL_ARB_draw_indirect / GL_ARB_multi_draw_indirect */
14920 SET_DrawArraysIndirect(table, save_DrawArraysIndirect);
14921 SET_DrawElementsIndirect(table, save_DrawElementsIndirect);
14922 SET_MultiDrawArraysIndirect(table, save_MultiDrawArraysIndirect);
14923 SET_MultiDrawElementsIndirect(table, save_MultiDrawElementsIndirect);
14924
14925 /* OpenGL 4.2 / GL_ARB_separate_shader_objects */
14926 SET_UseProgramStages(table, save_UseProgramStages);
14927 SET_ProgramUniform1f(table, save_ProgramUniform1f);
14928 SET_ProgramUniform2f(table, save_ProgramUniform2f);
14929 SET_ProgramUniform3f(table, save_ProgramUniform3f);
14930 SET_ProgramUniform4f(table, save_ProgramUniform4f);
14931 SET_ProgramUniform1fv(table, save_ProgramUniform1fv);
14932 SET_ProgramUniform2fv(table, save_ProgramUniform2fv);
14933 SET_ProgramUniform3fv(table, save_ProgramUniform3fv);
14934 SET_ProgramUniform4fv(table, save_ProgramUniform4fv);
14935 SET_ProgramUniform1d(table, save_ProgramUniform1d);
14936 SET_ProgramUniform2d(table, save_ProgramUniform2d);
14937 SET_ProgramUniform3d(table, save_ProgramUniform3d);
14938 SET_ProgramUniform4d(table, save_ProgramUniform4d);
14939 SET_ProgramUniform1dv(table, save_ProgramUniform1dv);
14940 SET_ProgramUniform2dv(table, save_ProgramUniform2dv);
14941 SET_ProgramUniform3dv(table, save_ProgramUniform3dv);
14942 SET_ProgramUniform4dv(table, save_ProgramUniform4dv);
14943 SET_ProgramUniform1i(table, save_ProgramUniform1i);
14944 SET_ProgramUniform2i(table, save_ProgramUniform2i);
14945 SET_ProgramUniform3i(table, save_ProgramUniform3i);
14946 SET_ProgramUniform4i(table, save_ProgramUniform4i);
14947 SET_ProgramUniform1iv(table, save_ProgramUniform1iv);
14948 SET_ProgramUniform2iv(table, save_ProgramUniform2iv);
14949 SET_ProgramUniform3iv(table, save_ProgramUniform3iv);
14950 SET_ProgramUniform4iv(table, save_ProgramUniform4iv);
14951 SET_ProgramUniform1ui(table, save_ProgramUniform1ui);
14952 SET_ProgramUniform2ui(table, save_ProgramUniform2ui);
14953 SET_ProgramUniform3ui(table, save_ProgramUniform3ui);
14954 SET_ProgramUniform4ui(table, save_ProgramUniform4ui);
14955 SET_ProgramUniform1uiv(table, save_ProgramUniform1uiv);
14956 SET_ProgramUniform2uiv(table, save_ProgramUniform2uiv);
14957 SET_ProgramUniform3uiv(table, save_ProgramUniform3uiv);
14958 SET_ProgramUniform4uiv(table, save_ProgramUniform4uiv);
14959 SET_ProgramUniformMatrix2fv(table, save_ProgramUniformMatrix2fv);
14960 SET_ProgramUniformMatrix3fv(table, save_ProgramUniformMatrix3fv);
14961 SET_ProgramUniformMatrix4fv(table, save_ProgramUniformMatrix4fv);
14962 SET_ProgramUniformMatrix2x3fv(table, save_ProgramUniformMatrix2x3fv);
14963 SET_ProgramUniformMatrix3x2fv(table, save_ProgramUniformMatrix3x2fv);
14964 SET_ProgramUniformMatrix2x4fv(table, save_ProgramUniformMatrix2x4fv);
14965 SET_ProgramUniformMatrix4x2fv(table, save_ProgramUniformMatrix4x2fv);
14966 SET_ProgramUniformMatrix3x4fv(table, save_ProgramUniformMatrix3x4fv);
14967 SET_ProgramUniformMatrix4x3fv(table, save_ProgramUniformMatrix4x3fv);
14968 SET_ProgramUniformMatrix2dv(table, save_ProgramUniformMatrix2dv);
14969 SET_ProgramUniformMatrix3dv(table, save_ProgramUniformMatrix3dv);
14970 SET_ProgramUniformMatrix4dv(table, save_ProgramUniformMatrix4dv);
14971 SET_ProgramUniformMatrix2x3dv(table, save_ProgramUniformMatrix2x3dv);
14972 SET_ProgramUniformMatrix3x2dv(table, save_ProgramUniformMatrix3x2dv);
14973 SET_ProgramUniformMatrix2x4dv(table, save_ProgramUniformMatrix2x4dv);
14974 SET_ProgramUniformMatrix4x2dv(table, save_ProgramUniformMatrix4x2dv);
14975 SET_ProgramUniformMatrix3x4dv(table, save_ProgramUniformMatrix3x4dv);
14976 SET_ProgramUniformMatrix4x3dv(table, save_ProgramUniformMatrix4x3dv);
14977
14978 /* GL_{ARB,EXT}_polygon_offset_clamp */
14979 SET_PolygonOffsetClampEXT(table, save_PolygonOffsetClampEXT);
14980
14981 /* GL_EXT_window_rectangles */
14982 SET_WindowRectanglesEXT(table, save_WindowRectanglesEXT);
14983
14984 /* GL_NV_conservative_raster */
14985 SET_SubpixelPrecisionBiasNV(table, save_SubpixelPrecisionBiasNV);
14986
14987 /* GL_NV_conservative_raster_dilate */
14988 SET_ConservativeRasterParameterfNV(table, save_ConservativeRasterParameterfNV);
14989
14990 /* GL_NV_conservative_raster_pre_snap_triangles */
14991 SET_ConservativeRasterParameteriNV(table, save_ConservativeRasterParameteriNV);
14992
14993 /* GL_EXT_direct_state_access */
14994 SET_MatrixLoadfEXT(table, save_MatrixLoadfEXT);
14995 SET_MatrixLoaddEXT(table, save_MatrixLoaddEXT);
14996 SET_MatrixMultfEXT(table, save_MatrixMultfEXT);
14997 SET_MatrixMultdEXT(table, save_MatrixMultdEXT);
14998 SET_MatrixRotatefEXT(table, save_MatrixRotatefEXT);
14999 SET_MatrixRotatedEXT(table, save_MatrixRotatedEXT);
15000 SET_MatrixScalefEXT(table, save_MatrixScalefEXT);
15001 SET_MatrixScaledEXT(table, save_MatrixScaledEXT);
15002 SET_MatrixTranslatefEXT(table, save_MatrixTranslatefEXT);
15003 SET_MatrixTranslatedEXT(table, save_MatrixTranslatedEXT);
15004 SET_MatrixLoadIdentityEXT(table, save_MatrixLoadIdentityEXT);
15005 SET_MatrixOrthoEXT(table, save_MatrixOrthoEXT);
15006 SET_MatrixFrustumEXT(table, save_MatrixFrustumEXT);
15007 SET_MatrixPushEXT(table, save_MatrixPushEXT);
15008 SET_MatrixPopEXT(table, save_MatrixPopEXT);
15009 SET_MatrixLoadTransposefEXT(table, save_MatrixLoadTransposefEXT);
15010 SET_MatrixLoadTransposedEXT(table, save_MatrixLoadTransposedEXT);
15011 SET_MatrixMultTransposefEXT(table, save_MatrixMultTransposefEXT);
15012 SET_MatrixMultTransposedEXT(table, save_MatrixMultTransposedEXT);
15013 SET_TextureParameteriEXT(table, save_TextureParameteriEXT);
15014 SET_TextureParameterivEXT(table, save_TextureParameterivEXT);
15015 SET_TextureParameterfEXT(table, save_TextureParameterfEXT);
15016 SET_TextureParameterfvEXT(table, save_TextureParameterfvEXT);
15017 SET_TextureParameterIivEXT(table, save_TextureParameterIivEXT);
15018 SET_TextureParameterIuivEXT(table, save_TextureParameterIuivEXT);
15019 SET_TextureImage1DEXT(table, save_TextureImage1DEXT);
15020 SET_TextureImage2DEXT(table, save_TextureImage2DEXT);
15021 SET_TextureImage3DEXT(table, save_TextureImage3DEXT);
15022 SET_TextureSubImage1DEXT(table, save_TextureSubImage1DEXT);
15023 SET_TextureSubImage2DEXT(table, save_TextureSubImage2DEXT);
15024 SET_TextureSubImage3DEXT(table, save_TextureSubImage3DEXT);
15025 SET_CopyTextureImage1DEXT(table, save_CopyTextureImage1DEXT);
15026 SET_CopyTextureImage2DEXT(table, save_CopyTextureImage2DEXT);
15027 SET_CopyTextureSubImage1DEXT(table, save_CopyTextureSubImage1DEXT);
15028 SET_CopyTextureSubImage2DEXT(table, save_CopyTextureSubImage2DEXT);
15029 SET_CopyTextureSubImage3DEXT(table, save_CopyTextureSubImage3DEXT);
15030 SET_BindMultiTextureEXT(table, save_BindMultiTextureEXT);
15031 SET_MultiTexParameteriEXT(table, save_MultiTexParameteriEXT);
15032 SET_MultiTexParameterivEXT(table, save_MultiTexParameterivEXT);
15033 SET_MultiTexParameterIivEXT(table, save_MultiTexParameterIivEXT);
15034 SET_MultiTexParameterIuivEXT(table, save_MultiTexParameterIuivEXT);
15035 SET_MultiTexParameterfEXT(table, save_MultiTexParameterfEXT);
15036 SET_MultiTexParameterfvEXT(table, save_MultiTexParameterfvEXT);
15037 SET_MultiTexImage1DEXT(table, save_MultiTexImage1DEXT);
15038 SET_MultiTexImage2DEXT(table, save_MultiTexImage2DEXT);
15039 SET_MultiTexImage3DEXT(table, save_MultiTexImage3DEXT);
15040 SET_MultiTexSubImage1DEXT(table, save_MultiTexSubImage1DEXT);
15041 SET_MultiTexSubImage2DEXT(table, save_MultiTexSubImage2DEXT);
15042 SET_MultiTexSubImage3DEXT(table, save_MultiTexSubImage3DEXT);
15043 SET_CopyMultiTexImage1DEXT(table, save_CopyMultiTexImage1DEXT);
15044 SET_CopyMultiTexImage2DEXT(table, save_CopyMultiTexImage2DEXT);
15045 SET_CopyMultiTexSubImage1DEXT(table, save_CopyMultiTexSubImage1DEXT);
15046 SET_CopyMultiTexSubImage2DEXT(table, save_CopyMultiTexSubImage2DEXT);
15047 SET_CopyMultiTexSubImage3DEXT(table, save_CopyMultiTexSubImage3DEXT);
15048 SET_MultiTexEnvfEXT(table, save_MultiTexEnvfEXT);
15049 SET_MultiTexEnvfvEXT(table, save_MultiTexEnvfvEXT);
15050 SET_MultiTexEnviEXT(table, save_MultiTexEnviEXT);
15051 SET_MultiTexEnvivEXT(table, save_MultiTexEnvivEXT);
15052 SET_CompressedTextureImage1DEXT(table, save_CompressedTextureImage1DEXT);
15053 SET_CompressedTextureImage2DEXT(table, save_CompressedTextureImage2DEXT);
15054 SET_CompressedTextureImage3DEXT(table, save_CompressedTextureImage3DEXT);
15055 SET_CompressedTextureSubImage1DEXT(table, save_CompressedTextureSubImage1DEXT);
15056 SET_CompressedTextureSubImage2DEXT(table, save_CompressedTextureSubImage2DEXT);
15057 SET_CompressedTextureSubImage3DEXT(table, save_CompressedTextureSubImage3DEXT);
15058 SET_CompressedMultiTexImage1DEXT(table, save_CompressedMultiTexImage1DEXT);
15059 SET_CompressedMultiTexImage2DEXT(table, save_CompressedMultiTexImage2DEXT);
15060 SET_CompressedMultiTexImage3DEXT(table, save_CompressedMultiTexImage3DEXT);
15061 SET_CompressedMultiTexSubImage1DEXT(table, save_CompressedMultiTexSubImage1DEXT);
15062 SET_CompressedMultiTexSubImage2DEXT(table, save_CompressedMultiTexSubImage2DEXT);
15063 SET_CompressedMultiTexSubImage3DEXT(table, save_CompressedMultiTexSubImage3DEXT);
15064 SET_NamedProgramStringEXT(table, save_NamedProgramStringEXT);
15065 SET_NamedProgramLocalParameter4dEXT(table, save_NamedProgramLocalParameter4dEXT);
15066 SET_NamedProgramLocalParameter4dvEXT(table, save_NamedProgramLocalParameter4dvEXT);
15067 SET_NamedProgramLocalParameter4fEXT(table, save_NamedProgramLocalParameter4fEXT);
15068 SET_NamedProgramLocalParameter4fvEXT(table, save_NamedProgramLocalParameter4fvEXT);
15069 }
15070
15071
15072
15073 static const char *
15074 enum_string(GLenum k)
15075 {
15076 return _mesa_enum_to_string(k);
15077 }
15078
15079
15080 /**
15081 * Print the commands in a display list. For debugging only.
15082 * TODO: many commands aren't handled yet.
15083 * \param fname filename to write display list to. If null, use stdout.
15084 */
15085 static void GLAPIENTRY
15086 print_list(struct gl_context *ctx, GLuint list, const char *fname)
15087 {
15088 struct gl_display_list *dlist;
15089 Node *n;
15090 GLboolean done;
15091 FILE *f = stdout;
15092
15093 if (fname) {
15094 f = fopen(fname, "w");
15095 if (!f)
15096 return;
15097 }
15098
15099 if (!islist(ctx, list)) {
15100 fprintf(f, "%u is not a display list ID\n", list);
15101 goto out;
15102 }
15103
15104 dlist = _mesa_lookup_list(ctx, list);
15105 if (!dlist) {
15106 goto out;
15107 }
15108
15109 n = dlist->Head;
15110
15111 fprintf(f, "START-LIST %u, address %p\n", list, (void *) n);
15112
15113 done = n ? GL_FALSE : GL_TRUE;
15114 while (!done) {
15115 const OpCode opcode = n[0].opcode;
15116
15117 if (is_ext_opcode(opcode)) {
15118 n += ext_opcode_print(ctx, n, f);
15119 }
15120 else {
15121 switch (opcode) {
15122 case OPCODE_ACCUM:
15123 fprintf(f, "Accum %s %g\n", enum_string(n[1].e), n[2].f);
15124 break;
15125 case OPCODE_ACTIVE_TEXTURE:
15126 fprintf(f, "ActiveTexture(%s)\n", enum_string(n[1].e));
15127 break;
15128 case OPCODE_BITMAP:
15129 fprintf(f, "Bitmap %d %d %g %g %g %g %p\n", n[1].i, n[2].i,
15130 n[3].f, n[4].f, n[5].f, n[6].f,
15131 get_pointer(&n[7]));
15132 break;
15133 case OPCODE_BLEND_COLOR:
15134 fprintf(f, "BlendColor %f, %f, %f, %f\n",
15135 n[1].f, n[2].f, n[3].f, n[4].f);
15136 break;
15137 case OPCODE_BLEND_EQUATION:
15138 fprintf(f, "BlendEquation %s\n",
15139 enum_string(n[1].e));
15140 break;
15141 case OPCODE_BLEND_EQUATION_SEPARATE:
15142 fprintf(f, "BlendEquationSeparate %s, %s\n",
15143 enum_string(n[1].e),
15144 enum_string(n[2].e));
15145 break;
15146 case OPCODE_BLEND_FUNC_SEPARATE:
15147 fprintf(f, "BlendFuncSeparate %s, %s, %s, %s\n",
15148 enum_string(n[1].e),
15149 enum_string(n[2].e),
15150 enum_string(n[3].e),
15151 enum_string(n[4].e));
15152 break;
15153 case OPCODE_BLEND_EQUATION_I:
15154 fprintf(f, "BlendEquationi %u, %s\n",
15155 n[1].ui, enum_string(n[2].e));
15156 break;
15157 case OPCODE_BLEND_EQUATION_SEPARATE_I:
15158 fprintf(f, "BlendEquationSeparatei %u, %s, %s\n",
15159 n[1].ui, enum_string(n[2].e), enum_string(n[3].e));
15160 break;
15161 case OPCODE_BLEND_FUNC_I:
15162 fprintf(f, "BlendFunci %u, %s, %s\n",
15163 n[1].ui, enum_string(n[2].e), enum_string(n[3].e));
15164 break;
15165 case OPCODE_BLEND_FUNC_SEPARATE_I:
15166 fprintf(f, "BlendFuncSeparatei %u, %s, %s, %s, %s\n",
15167 n[1].ui,
15168 enum_string(n[2].e),
15169 enum_string(n[3].e),
15170 enum_string(n[4].e),
15171 enum_string(n[5].e));
15172 break;
15173 case OPCODE_CALL_LIST:
15174 fprintf(f, "CallList %d\n", (int) n[1].ui);
15175 break;
15176 case OPCODE_CALL_LISTS:
15177 fprintf(f, "CallLists %d, %s\n", n[1].i, enum_string(n[1].e));
15178 break;
15179 case OPCODE_DISABLE:
15180 fprintf(f, "Disable %s\n", enum_string(n[1].e));
15181 break;
15182 case OPCODE_ENABLE:
15183 fprintf(f, "Enable %s\n", enum_string(n[1].e));
15184 break;
15185 case OPCODE_FRUSTUM:
15186 fprintf(f, "Frustum %g %g %g %g %g %g\n",
15187 n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f);
15188 break;
15189 case OPCODE_LINE_STIPPLE:
15190 fprintf(f, "LineStipple %d %x\n", n[1].i, (int) n[2].us);
15191 break;
15192 case OPCODE_LINE_WIDTH:
15193 fprintf(f, "LineWidth %f\n", n[1].f);
15194 break;
15195 case OPCODE_LOAD_IDENTITY:
15196 fprintf(f, "LoadIdentity\n");
15197 break;
15198 case OPCODE_LOAD_MATRIX:
15199 fprintf(f, "LoadMatrix\n");
15200 fprintf(f, " %8f %8f %8f %8f\n",
15201 n[1].f, n[5].f, n[9].f, n[13].f);
15202 fprintf(f, " %8f %8f %8f %8f\n",
15203 n[2].f, n[6].f, n[10].f, n[14].f);
15204 fprintf(f, " %8f %8f %8f %8f\n",
15205 n[3].f, n[7].f, n[11].f, n[15].f);
15206 fprintf(f, " %8f %8f %8f %8f\n",
15207 n[4].f, n[8].f, n[12].f, n[16].f);
15208 break;
15209 case OPCODE_MULT_MATRIX:
15210 fprintf(f, "MultMatrix (or Rotate)\n");
15211 fprintf(f, " %8f %8f %8f %8f\n",
15212 n[1].f, n[5].f, n[9].f, n[13].f);
15213 fprintf(f, " %8f %8f %8f %8f\n",
15214 n[2].f, n[6].f, n[10].f, n[14].f);
15215 fprintf(f, " %8f %8f %8f %8f\n",
15216 n[3].f, n[7].f, n[11].f, n[15].f);
15217 fprintf(f, " %8f %8f %8f %8f\n",
15218 n[4].f, n[8].f, n[12].f, n[16].f);
15219 break;
15220 case OPCODE_ORTHO:
15221 fprintf(f, "Ortho %g %g %g %g %g %g\n",
15222 n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f);
15223 break;
15224 case OPCODE_POINT_SIZE:
15225 fprintf(f, "PointSize %f\n", n[1].f);
15226 break;
15227 case OPCODE_POP_ATTRIB:
15228 fprintf(f, "PopAttrib\n");
15229 break;
15230 case OPCODE_POP_MATRIX:
15231 fprintf(f, "PopMatrix\n");
15232 break;
15233 case OPCODE_POP_NAME:
15234 fprintf(f, "PopName\n");
15235 break;
15236 case OPCODE_PUSH_ATTRIB:
15237 fprintf(f, "PushAttrib %x\n", n[1].bf);
15238 break;
15239 case OPCODE_PUSH_MATRIX:
15240 fprintf(f, "PushMatrix\n");
15241 break;
15242 case OPCODE_PUSH_NAME:
15243 fprintf(f, "PushName %d\n", (int) n[1].ui);
15244 break;
15245 case OPCODE_RASTER_POS:
15246 fprintf(f, "RasterPos %g %g %g %g\n",
15247 n[1].f, n[2].f, n[3].f, n[4].f);
15248 break;
15249 case OPCODE_ROTATE:
15250 fprintf(f, "Rotate %g %g %g %g\n",
15251 n[1].f, n[2].f, n[3].f, n[4].f);
15252 break;
15253 case OPCODE_SCALE:
15254 fprintf(f, "Scale %g %g %g\n", n[1].f, n[2].f, n[3].f);
15255 break;
15256 case OPCODE_TRANSLATE:
15257 fprintf(f, "Translate %g %g %g\n", n[1].f, n[2].f, n[3].f);
15258 break;
15259 case OPCODE_BIND_TEXTURE:
15260 fprintf(f, "BindTexture %s %d\n",
15261 _mesa_enum_to_string(n[1].ui), n[2].ui);
15262 break;
15263 case OPCODE_SHADE_MODEL:
15264 fprintf(f, "ShadeModel %s\n", _mesa_enum_to_string(n[1].ui));
15265 break;
15266 case OPCODE_MAP1:
15267 fprintf(f, "Map1 %s %.3f %.3f %d %d\n",
15268 _mesa_enum_to_string(n[1].ui),
15269 n[2].f, n[3].f, n[4].i, n[5].i);
15270 break;
15271 case OPCODE_MAP2:
15272 fprintf(f, "Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
15273 _mesa_enum_to_string(n[1].ui),
15274 n[2].f, n[3].f, n[4].f, n[5].f,
15275 n[6].i, n[7].i, n[8].i, n[9].i);
15276 break;
15277 case OPCODE_MAPGRID1:
15278 fprintf(f, "MapGrid1 %d %.3f %.3f\n", n[1].i, n[2].f, n[3].f);
15279 break;
15280 case OPCODE_MAPGRID2:
15281 fprintf(f, "MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
15282 n[1].i, n[2].f, n[3].f, n[4].i, n[5].f, n[6].f);
15283 break;
15284 case OPCODE_EVALMESH1:
15285 fprintf(f, "EvalMesh1 %d %d\n", n[1].i, n[2].i);
15286 break;
15287 case OPCODE_EVALMESH2:
15288 fprintf(f, "EvalMesh2 %d %d %d %d\n",
15289 n[1].i, n[2].i, n[3].i, n[4].i);
15290 break;
15291
15292 case OPCODE_ATTR_1F_NV:
15293 fprintf(f, "ATTR_1F_NV attr %d: %f\n", n[1].i, n[2].f);
15294 break;
15295 case OPCODE_ATTR_2F_NV:
15296 fprintf(f, "ATTR_2F_NV attr %d: %f %f\n",
15297 n[1].i, n[2].f, n[3].f);
15298 break;
15299 case OPCODE_ATTR_3F_NV:
15300 fprintf(f, "ATTR_3F_NV attr %d: %f %f %f\n",
15301 n[1].i, n[2].f, n[3].f, n[4].f);
15302 break;
15303 case OPCODE_ATTR_4F_NV:
15304 fprintf(f, "ATTR_4F_NV attr %d: %f %f %f %f\n",
15305 n[1].i, n[2].f, n[3].f, n[4].f, n[5].f);
15306 break;
15307 case OPCODE_ATTR_1F_ARB:
15308 fprintf(f, "ATTR_1F_ARB attr %d: %f\n", n[1].i, n[2].f);
15309 break;
15310 case OPCODE_ATTR_2F_ARB:
15311 fprintf(f, "ATTR_2F_ARB attr %d: %f %f\n",
15312 n[1].i, n[2].f, n[3].f);
15313 break;
15314 case OPCODE_ATTR_3F_ARB:
15315 fprintf(f, "ATTR_3F_ARB attr %d: %f %f %f\n",
15316 n[1].i, n[2].f, n[3].f, n[4].f);
15317 break;
15318 case OPCODE_ATTR_4F_ARB:
15319 fprintf(f, "ATTR_4F_ARB attr %d: %f %f %f %f\n",
15320 n[1].i, n[2].f, n[3].f, n[4].f, n[5].f);
15321 break;
15322
15323 case OPCODE_MATERIAL:
15324 fprintf(f, "MATERIAL %x %x: %f %f %f %f\n",
15325 n[1].i, n[2].i, n[3].f, n[4].f, n[5].f, n[6].f);
15326 break;
15327 case OPCODE_BEGIN:
15328 fprintf(f, "BEGIN %x\n", n[1].i);
15329 break;
15330 case OPCODE_END:
15331 fprintf(f, "END\n");
15332 break;
15333 case OPCODE_RECTF:
15334 fprintf(f, "RECTF %f %f %f %f\n", n[1].f, n[2].f, n[3].f,
15335 n[4].f);
15336 break;
15337 case OPCODE_EVAL_C1:
15338 fprintf(f, "EVAL_C1 %f\n", n[1].f);
15339 break;
15340 case OPCODE_EVAL_C2:
15341 fprintf(f, "EVAL_C2 %f %f\n", n[1].f, n[2].f);
15342 break;
15343 case OPCODE_EVAL_P1:
15344 fprintf(f, "EVAL_P1 %d\n", n[1].i);
15345 break;
15346 case OPCODE_EVAL_P2:
15347 fprintf(f, "EVAL_P2 %d %d\n", n[1].i, n[2].i);
15348 break;
15349
15350 case OPCODE_PROVOKING_VERTEX:
15351 fprintf(f, "ProvokingVertex %s\n",
15352 _mesa_enum_to_string(n[1].ui));
15353 break;
15354
15355 /*
15356 * meta opcodes/commands
15357 */
15358 case OPCODE_ERROR:
15359 fprintf(f, "Error: %s %s\n", enum_string(n[1].e),
15360 (const char *) get_pointer(&n[2]));
15361 break;
15362 case OPCODE_CONTINUE:
15363 fprintf(f, "DISPLAY-LIST-CONTINUE\n");
15364 n = (Node *) get_pointer(&n[1]);
15365 break;
15366 case OPCODE_NOP:
15367 fprintf(f, "NOP\n");
15368 break;
15369 case OPCODE_END_OF_LIST:
15370 fprintf(f, "END-LIST %u\n", list);
15371 done = GL_TRUE;
15372 break;
15373 default:
15374 if (opcode < 0 || opcode > OPCODE_END_OF_LIST) {
15375 printf
15376 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
15377 opcode, (void *) n);
15378 goto out;
15379 }
15380 else {
15381 fprintf(f, "command %d, %u operands\n", opcode,
15382 InstSize[opcode]);
15383 }
15384 }
15385 /* increment n to point to next compiled command */
15386 if (opcode != OPCODE_CONTINUE) {
15387 assert(InstSize[opcode] > 0);
15388 n += InstSize[opcode];
15389 }
15390 }
15391 }
15392
15393 out:
15394 fflush(f);
15395 if (fname)
15396 fclose(f);
15397 }
15398
15399
15400
15401 /**
15402 * Clients may call this function to help debug display list problems.
15403 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
15404 * changed, or break in the future without notice.
15405 */
15406 void
15407 mesa_print_display_list(GLuint list)
15408 {
15409 GET_CURRENT_CONTEXT(ctx);
15410 print_list(ctx, list, NULL);
15411 }
15412
15413
15414 /**********************************************************************/
15415 /***** Initialization *****/
15416 /**********************************************************************/
15417
15418 static void
15419 save_vtxfmt_init(GLvertexformat * vfmt)
15420 {
15421 vfmt->ArrayElement = _ae_ArrayElement;
15422
15423 vfmt->Begin = save_Begin;
15424
15425 vfmt->CallList = save_CallList;
15426 vfmt->CallLists = save_CallLists;
15427
15428 vfmt->Color3f = save_Color3f;
15429 vfmt->Color3fv = save_Color3fv;
15430 vfmt->Color4f = save_Color4f;
15431 vfmt->Color4fv = save_Color4fv;
15432 vfmt->EdgeFlag = save_EdgeFlag;
15433 vfmt->End = save_End;
15434
15435 vfmt->EvalCoord1f = save_EvalCoord1f;
15436 vfmt->EvalCoord1fv = save_EvalCoord1fv;
15437 vfmt->EvalCoord2f = save_EvalCoord2f;
15438 vfmt->EvalCoord2fv = save_EvalCoord2fv;
15439 vfmt->EvalPoint1 = save_EvalPoint1;
15440 vfmt->EvalPoint2 = save_EvalPoint2;
15441
15442 vfmt->FogCoordfEXT = save_FogCoordfEXT;
15443 vfmt->FogCoordfvEXT = save_FogCoordfvEXT;
15444 vfmt->Indexf = save_Indexf;
15445 vfmt->Indexfv = save_Indexfv;
15446 vfmt->Materialfv = save_Materialfv;
15447 vfmt->MultiTexCoord1fARB = save_MultiTexCoord1f;
15448 vfmt->MultiTexCoord1fvARB = save_MultiTexCoord1fv;
15449 vfmt->MultiTexCoord2fARB = save_MultiTexCoord2f;
15450 vfmt->MultiTexCoord2fvARB = save_MultiTexCoord2fv;
15451 vfmt->MultiTexCoord3fARB = save_MultiTexCoord3f;
15452 vfmt->MultiTexCoord3fvARB = save_MultiTexCoord3fv;
15453 vfmt->MultiTexCoord4fARB = save_MultiTexCoord4f;
15454 vfmt->MultiTexCoord4fvARB = save_MultiTexCoord4fv;
15455 vfmt->Normal3f = save_Normal3f;
15456 vfmt->Normal3fv = save_Normal3fv;
15457 vfmt->SecondaryColor3fEXT = save_SecondaryColor3fEXT;
15458 vfmt->SecondaryColor3fvEXT = save_SecondaryColor3fvEXT;
15459 vfmt->TexCoord1f = save_TexCoord1f;
15460 vfmt->TexCoord1fv = save_TexCoord1fv;
15461 vfmt->TexCoord2f = save_TexCoord2f;
15462 vfmt->TexCoord2fv = save_TexCoord2fv;
15463 vfmt->TexCoord3f = save_TexCoord3f;
15464 vfmt->TexCoord3fv = save_TexCoord3fv;
15465 vfmt->TexCoord4f = save_TexCoord4f;
15466 vfmt->TexCoord4fv = save_TexCoord4fv;
15467 vfmt->Vertex2f = save_Vertex2f;
15468 vfmt->Vertex2fv = save_Vertex2fv;
15469 vfmt->Vertex3f = save_Vertex3f;
15470 vfmt->Vertex3fv = save_Vertex3fv;
15471 vfmt->Vertex4f = save_Vertex4f;
15472 vfmt->Vertex4fv = save_Vertex4fv;
15473 vfmt->VertexAttrib1fARB = save_VertexAttrib1fARB;
15474 vfmt->VertexAttrib1fvARB = save_VertexAttrib1fvARB;
15475 vfmt->VertexAttrib2fARB = save_VertexAttrib2fARB;
15476 vfmt->VertexAttrib2fvARB = save_VertexAttrib2fvARB;
15477 vfmt->VertexAttrib3fARB = save_VertexAttrib3fARB;
15478 vfmt->VertexAttrib3fvARB = save_VertexAttrib3fvARB;
15479 vfmt->VertexAttrib4fARB = save_VertexAttrib4fARB;
15480 vfmt->VertexAttrib4fvARB = save_VertexAttrib4fvARB;
15481 vfmt->VertexAttribL1d = save_VertexAttribL1d;
15482 vfmt->VertexAttribL1dv = save_VertexAttribL1dv;
15483 vfmt->VertexAttribL2d = save_VertexAttribL2d;
15484 vfmt->VertexAttribL2dv = save_VertexAttribL2dv;
15485 vfmt->VertexAttribL3d = save_VertexAttribL3d;
15486 vfmt->VertexAttribL3dv = save_VertexAttribL3dv;
15487 vfmt->VertexAttribL4d = save_VertexAttribL4d;
15488 vfmt->VertexAttribL4dv = save_VertexAttribL4dv;
15489
15490 vfmt->PrimitiveRestartNV = save_PrimitiveRestartNV;
15491 }
15492
15493
15494 void
15495 _mesa_install_dlist_vtxfmt(struct _glapi_table *disp,
15496 const GLvertexformat *vfmt)
15497 {
15498 SET_CallList(disp, vfmt->CallList);
15499 SET_CallLists(disp, vfmt->CallLists);
15500 }
15501
15502
15503 /**
15504 * Initialize display list state for given context.
15505 */
15506 void
15507 _mesa_init_display_list(struct gl_context *ctx)
15508 {
15509 static GLboolean tableInitialized = GL_FALSE;
15510
15511 /* zero-out the instruction size table, just once */
15512 if (!tableInitialized) {
15513 memset(InstSize, 0, sizeof(InstSize));
15514 tableInitialized = GL_TRUE;
15515 }
15516
15517 /* extension info */
15518 ctx->ListExt = CALLOC_STRUCT(gl_list_extensions);
15519
15520 /* Display list */
15521 ctx->ListState.CallDepth = 0;
15522 ctx->ExecuteFlag = GL_TRUE;
15523 ctx->CompileFlag = GL_FALSE;
15524 ctx->ListState.CurrentBlock = NULL;
15525 ctx->ListState.CurrentPos = 0;
15526
15527 /* Display List group */
15528 ctx->List.ListBase = 0;
15529
15530 save_vtxfmt_init(&ctx->ListState.ListVtxfmt);
15531
15532 InstSize[OPCODE_NOP] = 1;
15533 }
15534
15535
15536 void
15537 _mesa_free_display_list_data(struct gl_context *ctx)
15538 {
15539 free(ctx->ListExt);
15540 ctx->ListExt = NULL;
15541 }