mesa: add EXT_dsa glCompressedTex* functions display list support
[mesa.git] / src / mesa / main / dlist.c
1 /*
2 * Mesa 3-D graphics library
3 *
4 * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
5 * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 * OTHER DEALINGS IN THE SOFTWARE.
24 */
25
26
27 /**
28 * \file dlist.c
29 * Display lists management functions.
30 */
31
32 #include "c99_math.h"
33 #include "glheader.h"
34 #include "imports.h"
35 #include "api_arrayelt.h"
36 #include "api_exec.h"
37 #include "api_loopback.h"
38 #include "draw_validate.h"
39 #include "atifragshader.h"
40 #include "config.h"
41 #include "bufferobj.h"
42 #include "arrayobj.h"
43 #include "context.h"
44 #include "dlist.h"
45 #include "enums.h"
46 #include "eval.h"
47 #include "fbobject.h"
48 #include "framebuffer.h"
49 #include "glapi/glapi.h"
50 #include "glformats.h"
51 #include "hash.h"
52 #include "image.h"
53 #include "light.h"
54 #include "macros.h"
55 #include "pack.h"
56 #include "pbo.h"
57 #include "queryobj.h"
58 #include "samplerobj.h"
59 #include "shaderapi.h"
60 #include "syncobj.h"
61 #include "teximage.h"
62 #include "texstorage.h"
63 #include "mtypes.h"
64 #include "varray.h"
65 #include "arbprogram.h"
66 #include "transformfeedback.h"
67
68 #include "math/m_matrix.h"
69
70 #include "main/dispatch.h"
71
72 #include "vbo/vbo.h"
73
74
75 #define USE_BITMAP_ATLAS 1
76
77
78
79 /**
80 * Other parts of Mesa (such as the VBO module) can plug into the display
81 * list system. This structure describes new display list instructions.
82 */
83 struct gl_list_instruction
84 {
85 GLuint Size;
86 void (*Execute)( struct gl_context *ctx, void *data );
87 void (*Destroy)( struct gl_context *ctx, void *data );
88 void (*Print)( struct gl_context *ctx, void *data, FILE *f );
89 };
90
91
92 #define MAX_DLIST_EXT_OPCODES 16
93
94 /**
95 * Used by device drivers to hook new commands into display lists.
96 */
97 struct gl_list_extensions
98 {
99 struct gl_list_instruction Opcode[MAX_DLIST_EXT_OPCODES];
100 GLuint NumOpcodes;
101 };
102
103
104
105 /**
106 * Flush vertices.
107 *
108 * \param ctx GL context.
109 *
110 * Checks if dd_function_table::SaveNeedFlush is marked to flush
111 * stored (save) vertices, and calls vbo_save_SaveFlushVertices if so.
112 */
113 #define SAVE_FLUSH_VERTICES(ctx) \
114 do { \
115 if (ctx->Driver.SaveNeedFlush) \
116 vbo_save_SaveFlushVertices(ctx); \
117 } while (0)
118
119
120 /**
121 * Macro to assert that the API call was made outside the
122 * glBegin()/glEnd() pair, with return value.
123 *
124 * \param ctx GL context.
125 * \param retval value to return value in case the assertion fails.
126 */
127 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval) \
128 do { \
129 if (ctx->Driver.CurrentSavePrimitive <= PRIM_MAX) { \
130 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glBegin/End" ); \
131 return retval; \
132 } \
133 } while (0)
134
135 /**
136 * Macro to assert that the API call was made outside the
137 * glBegin()/glEnd() pair.
138 *
139 * \param ctx GL context.
140 */
141 #define ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx) \
142 do { \
143 if (ctx->Driver.CurrentSavePrimitive <= PRIM_MAX) { \
144 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glBegin/End" ); \
145 return; \
146 } \
147 } while (0)
148
149 /**
150 * Macro to assert that the API call was made outside the
151 * glBegin()/glEnd() pair and flush the vertices.
152 *
153 * \param ctx GL context.
154 */
155 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx) \
156 do { \
157 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx); \
158 SAVE_FLUSH_VERTICES(ctx); \
159 } while (0)
160
161 /**
162 * Macro to assert that the API call was made outside the
163 * glBegin()/glEnd() pair and flush the vertices, with return value.
164 *
165 * \param ctx GL context.
166 * \param retval value to return value in case the assertion fails.
167 */
168 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval) \
169 do { \
170 ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval); \
171 SAVE_FLUSH_VERTICES(ctx); \
172 } while (0)
173
174
175 /**
176 * Display list opcodes.
177 *
178 * The fact that these identifiers are assigned consecutive
179 * integer values starting at 0 is very important, see InstSize array usage)
180 */
181 typedef enum
182 {
183 OPCODE_INVALID = -1, /* Force signed enum */
184 OPCODE_ACCUM,
185 OPCODE_ALPHA_FUNC,
186 OPCODE_BIND_TEXTURE,
187 OPCODE_BITMAP,
188 OPCODE_BLEND_COLOR,
189 OPCODE_BLEND_EQUATION,
190 OPCODE_BLEND_EQUATION_SEPARATE,
191 OPCODE_BLEND_FUNC_SEPARATE,
192
193 OPCODE_BLEND_EQUATION_I,
194 OPCODE_BLEND_EQUATION_SEPARATE_I,
195 OPCODE_BLEND_FUNC_I,
196 OPCODE_BLEND_FUNC_SEPARATE_I,
197
198 OPCODE_CALL_LIST,
199 OPCODE_CALL_LISTS,
200 OPCODE_CLEAR,
201 OPCODE_CLEAR_ACCUM,
202 OPCODE_CLEAR_COLOR,
203 OPCODE_CLEAR_DEPTH,
204 OPCODE_CLEAR_INDEX,
205 OPCODE_CLEAR_STENCIL,
206 OPCODE_CLEAR_BUFFER_IV,
207 OPCODE_CLEAR_BUFFER_UIV,
208 OPCODE_CLEAR_BUFFER_FV,
209 OPCODE_CLEAR_BUFFER_FI,
210 OPCODE_CLIP_PLANE,
211 OPCODE_COLOR_MASK,
212 OPCODE_COLOR_MASK_INDEXED,
213 OPCODE_COLOR_MATERIAL,
214 OPCODE_COPY_PIXELS,
215 OPCODE_COPY_TEX_IMAGE1D,
216 OPCODE_COPY_TEX_IMAGE2D,
217 OPCODE_COPY_TEX_SUB_IMAGE1D,
218 OPCODE_COPY_TEX_SUB_IMAGE2D,
219 OPCODE_COPY_TEX_SUB_IMAGE3D,
220 OPCODE_CULL_FACE,
221 OPCODE_DEPTH_FUNC,
222 OPCODE_DEPTH_MASK,
223 OPCODE_DEPTH_RANGE,
224 OPCODE_DISABLE,
225 OPCODE_DISABLE_INDEXED,
226 OPCODE_DRAW_BUFFER,
227 OPCODE_DRAW_PIXELS,
228 OPCODE_ENABLE,
229 OPCODE_ENABLE_INDEXED,
230 OPCODE_EVALMESH1,
231 OPCODE_EVALMESH2,
232 OPCODE_FOG,
233 OPCODE_FRONT_FACE,
234 OPCODE_FRUSTUM,
235 OPCODE_HINT,
236 OPCODE_INDEX_MASK,
237 OPCODE_INIT_NAMES,
238 OPCODE_LIGHT,
239 OPCODE_LIGHT_MODEL,
240 OPCODE_LINE_STIPPLE,
241 OPCODE_LINE_WIDTH,
242 OPCODE_LIST_BASE,
243 OPCODE_LOAD_IDENTITY,
244 OPCODE_LOAD_MATRIX,
245 OPCODE_LOAD_NAME,
246 OPCODE_LOGIC_OP,
247 OPCODE_MAP1,
248 OPCODE_MAP2,
249 OPCODE_MAPGRID1,
250 OPCODE_MAPGRID2,
251 OPCODE_MATRIX_MODE,
252 OPCODE_MULT_MATRIX,
253 OPCODE_ORTHO,
254 OPCODE_PASSTHROUGH,
255 OPCODE_PIXEL_MAP,
256 OPCODE_PIXEL_TRANSFER,
257 OPCODE_PIXEL_ZOOM,
258 OPCODE_POINT_SIZE,
259 OPCODE_POINT_PARAMETERS,
260 OPCODE_POLYGON_MODE,
261 OPCODE_POLYGON_STIPPLE,
262 OPCODE_POLYGON_OFFSET,
263 OPCODE_POP_ATTRIB,
264 OPCODE_POP_MATRIX,
265 OPCODE_POP_NAME,
266 OPCODE_PRIORITIZE_TEXTURE,
267 OPCODE_PUSH_ATTRIB,
268 OPCODE_PUSH_MATRIX,
269 OPCODE_PUSH_NAME,
270 OPCODE_RASTER_POS,
271 OPCODE_READ_BUFFER,
272 OPCODE_ROTATE,
273 OPCODE_SCALE,
274 OPCODE_SCISSOR,
275 OPCODE_SELECT_TEXTURE_SGIS,
276 OPCODE_SELECT_TEXTURE_COORD_SET,
277 OPCODE_SHADE_MODEL,
278 OPCODE_STENCIL_FUNC,
279 OPCODE_STENCIL_MASK,
280 OPCODE_STENCIL_OP,
281 OPCODE_TEXENV,
282 OPCODE_TEXGEN,
283 OPCODE_TEXPARAMETER,
284 OPCODE_TEX_IMAGE1D,
285 OPCODE_TEX_IMAGE2D,
286 OPCODE_TEX_IMAGE3D,
287 OPCODE_TEX_SUB_IMAGE1D,
288 OPCODE_TEX_SUB_IMAGE2D,
289 OPCODE_TEX_SUB_IMAGE3D,
290 OPCODE_TRANSLATE,
291 OPCODE_VIEWPORT,
292 OPCODE_WINDOW_POS,
293 /* ARB_viewport_array */
294 OPCODE_VIEWPORT_ARRAY_V,
295 OPCODE_VIEWPORT_INDEXED_F,
296 OPCODE_VIEWPORT_INDEXED_FV,
297 OPCODE_SCISSOR_ARRAY_V,
298 OPCODE_SCISSOR_INDEXED,
299 OPCODE_SCISSOR_INDEXED_V,
300 OPCODE_DEPTH_ARRAY_V,
301 OPCODE_DEPTH_INDEXED,
302 /* GL_ARB_multitexture */
303 OPCODE_ACTIVE_TEXTURE,
304 /* GL_ARB_texture_compression */
305 OPCODE_COMPRESSED_TEX_IMAGE_1D,
306 OPCODE_COMPRESSED_TEX_IMAGE_2D,
307 OPCODE_COMPRESSED_TEX_IMAGE_3D,
308 OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D,
309 OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D,
310 OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D,
311 /* GL_ARB_multisample */
312 OPCODE_SAMPLE_COVERAGE,
313 /* GL_ARB_window_pos */
314 OPCODE_WINDOW_POS_ARB,
315 /* GL_ARB_vertex_program */
316 OPCODE_BIND_PROGRAM_ARB,
317 OPCODE_PROGRAM_LOCAL_PARAMETER_ARB,
318 /* GL_EXT_stencil_two_side */
319 OPCODE_ACTIVE_STENCIL_FACE_EXT,
320 /* GL_EXT_depth_bounds_test */
321 OPCODE_DEPTH_BOUNDS_EXT,
322 /* GL_ARB_vertex/fragment_program */
323 OPCODE_PROGRAM_STRING_ARB,
324 OPCODE_PROGRAM_ENV_PARAMETER_ARB,
325 /* GL_ARB_occlusion_query */
326 OPCODE_BEGIN_QUERY_ARB,
327 OPCODE_END_QUERY_ARB,
328 /* GL_ARB_draw_buffers */
329 OPCODE_DRAW_BUFFERS_ARB,
330 /* GL_ATI_fragment_shader */
331 OPCODE_BIND_FRAGMENT_SHADER_ATI,
332 OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI,
333 /* OpenGL 2.0 */
334 OPCODE_STENCIL_FUNC_SEPARATE,
335 OPCODE_STENCIL_OP_SEPARATE,
336 OPCODE_STENCIL_MASK_SEPARATE,
337 /* GL_NV_primitive_restart */
338 OPCODE_PRIMITIVE_RESTART_NV,
339 /* GL_ARB_shader_objects */
340 OPCODE_USE_PROGRAM,
341 OPCODE_UNIFORM_1F,
342 OPCODE_UNIFORM_2F,
343 OPCODE_UNIFORM_3F,
344 OPCODE_UNIFORM_4F,
345 OPCODE_UNIFORM_1FV,
346 OPCODE_UNIFORM_2FV,
347 OPCODE_UNIFORM_3FV,
348 OPCODE_UNIFORM_4FV,
349 OPCODE_UNIFORM_1I,
350 OPCODE_UNIFORM_2I,
351 OPCODE_UNIFORM_3I,
352 OPCODE_UNIFORM_4I,
353 OPCODE_UNIFORM_1IV,
354 OPCODE_UNIFORM_2IV,
355 OPCODE_UNIFORM_3IV,
356 OPCODE_UNIFORM_4IV,
357 OPCODE_UNIFORM_MATRIX22,
358 OPCODE_UNIFORM_MATRIX33,
359 OPCODE_UNIFORM_MATRIX44,
360 OPCODE_UNIFORM_MATRIX23,
361 OPCODE_UNIFORM_MATRIX32,
362 OPCODE_UNIFORM_MATRIX24,
363 OPCODE_UNIFORM_MATRIX42,
364 OPCODE_UNIFORM_MATRIX34,
365 OPCODE_UNIFORM_MATRIX43,
366
367 /* OpenGL 3.0 */
368 OPCODE_UNIFORM_1UI,
369 OPCODE_UNIFORM_2UI,
370 OPCODE_UNIFORM_3UI,
371 OPCODE_UNIFORM_4UI,
372 OPCODE_UNIFORM_1UIV,
373 OPCODE_UNIFORM_2UIV,
374 OPCODE_UNIFORM_3UIV,
375 OPCODE_UNIFORM_4UIV,
376
377 /* GL_ARB_gpu_shader_fp64 */
378 OPCODE_UNIFORM_1D,
379 OPCODE_UNIFORM_2D,
380 OPCODE_UNIFORM_3D,
381 OPCODE_UNIFORM_4D,
382 OPCODE_UNIFORM_1DV,
383 OPCODE_UNIFORM_2DV,
384 OPCODE_UNIFORM_3DV,
385 OPCODE_UNIFORM_4DV,
386 OPCODE_UNIFORM_MATRIX22D,
387 OPCODE_UNIFORM_MATRIX33D,
388 OPCODE_UNIFORM_MATRIX44D,
389 OPCODE_UNIFORM_MATRIX23D,
390 OPCODE_UNIFORM_MATRIX32D,
391 OPCODE_UNIFORM_MATRIX24D,
392 OPCODE_UNIFORM_MATRIX42D,
393 OPCODE_UNIFORM_MATRIX34D,
394 OPCODE_UNIFORM_MATRIX43D,
395
396 /* OpenGL 4.0 / GL_ARB_tessellation_shader */
397 OPCODE_PATCH_PARAMETER_I,
398 OPCODE_PATCH_PARAMETER_FV_INNER,
399 OPCODE_PATCH_PARAMETER_FV_OUTER,
400
401 /* OpenGL 4.2 / GL_ARB_separate_shader_objects */
402 OPCODE_USE_PROGRAM_STAGES,
403 OPCODE_PROGRAM_UNIFORM_1F,
404 OPCODE_PROGRAM_UNIFORM_2F,
405 OPCODE_PROGRAM_UNIFORM_3F,
406 OPCODE_PROGRAM_UNIFORM_4F,
407 OPCODE_PROGRAM_UNIFORM_1FV,
408 OPCODE_PROGRAM_UNIFORM_2FV,
409 OPCODE_PROGRAM_UNIFORM_3FV,
410 OPCODE_PROGRAM_UNIFORM_4FV,
411 OPCODE_PROGRAM_UNIFORM_1D,
412 OPCODE_PROGRAM_UNIFORM_2D,
413 OPCODE_PROGRAM_UNIFORM_3D,
414 OPCODE_PROGRAM_UNIFORM_4D,
415 OPCODE_PROGRAM_UNIFORM_1DV,
416 OPCODE_PROGRAM_UNIFORM_2DV,
417 OPCODE_PROGRAM_UNIFORM_3DV,
418 OPCODE_PROGRAM_UNIFORM_4DV,
419 OPCODE_PROGRAM_UNIFORM_1I,
420 OPCODE_PROGRAM_UNIFORM_2I,
421 OPCODE_PROGRAM_UNIFORM_3I,
422 OPCODE_PROGRAM_UNIFORM_4I,
423 OPCODE_PROGRAM_UNIFORM_1IV,
424 OPCODE_PROGRAM_UNIFORM_2IV,
425 OPCODE_PROGRAM_UNIFORM_3IV,
426 OPCODE_PROGRAM_UNIFORM_4IV,
427 OPCODE_PROGRAM_UNIFORM_1UI,
428 OPCODE_PROGRAM_UNIFORM_2UI,
429 OPCODE_PROGRAM_UNIFORM_3UI,
430 OPCODE_PROGRAM_UNIFORM_4UI,
431 OPCODE_PROGRAM_UNIFORM_1UIV,
432 OPCODE_PROGRAM_UNIFORM_2UIV,
433 OPCODE_PROGRAM_UNIFORM_3UIV,
434 OPCODE_PROGRAM_UNIFORM_4UIV,
435 OPCODE_PROGRAM_UNIFORM_MATRIX22F,
436 OPCODE_PROGRAM_UNIFORM_MATRIX33F,
437 OPCODE_PROGRAM_UNIFORM_MATRIX44F,
438 OPCODE_PROGRAM_UNIFORM_MATRIX23F,
439 OPCODE_PROGRAM_UNIFORM_MATRIX32F,
440 OPCODE_PROGRAM_UNIFORM_MATRIX24F,
441 OPCODE_PROGRAM_UNIFORM_MATRIX42F,
442 OPCODE_PROGRAM_UNIFORM_MATRIX34F,
443 OPCODE_PROGRAM_UNIFORM_MATRIX43F,
444 OPCODE_PROGRAM_UNIFORM_MATRIX22D,
445 OPCODE_PROGRAM_UNIFORM_MATRIX33D,
446 OPCODE_PROGRAM_UNIFORM_MATRIX44D,
447 OPCODE_PROGRAM_UNIFORM_MATRIX23D,
448 OPCODE_PROGRAM_UNIFORM_MATRIX32D,
449 OPCODE_PROGRAM_UNIFORM_MATRIX24D,
450 OPCODE_PROGRAM_UNIFORM_MATRIX42D,
451 OPCODE_PROGRAM_UNIFORM_MATRIX34D,
452 OPCODE_PROGRAM_UNIFORM_MATRIX43D,
453
454 /* GL_ARB_clip_control */
455 OPCODE_CLIP_CONTROL,
456
457 /* GL_ARB_color_buffer_float */
458 OPCODE_CLAMP_COLOR,
459
460 /* GL_EXT_framebuffer_blit */
461 OPCODE_BLIT_FRAMEBUFFER,
462
463 /* Vertex attributes -- fallback for when optimized display
464 * list build isn't active.
465 */
466 OPCODE_ATTR_1F_NV,
467 OPCODE_ATTR_2F_NV,
468 OPCODE_ATTR_3F_NV,
469 OPCODE_ATTR_4F_NV,
470 OPCODE_ATTR_1F_ARB,
471 OPCODE_ATTR_2F_ARB,
472 OPCODE_ATTR_3F_ARB,
473 OPCODE_ATTR_4F_ARB,
474 OPCODE_ATTR_1D,
475 OPCODE_ATTR_2D,
476 OPCODE_ATTR_3D,
477 OPCODE_ATTR_4D,
478 OPCODE_MATERIAL,
479 OPCODE_BEGIN,
480 OPCODE_END,
481 OPCODE_RECTF,
482 OPCODE_EVAL_C1,
483 OPCODE_EVAL_C2,
484 OPCODE_EVAL_P1,
485 OPCODE_EVAL_P2,
486
487 /* GL_EXT_provoking_vertex */
488 OPCODE_PROVOKING_VERTEX,
489
490 /* GL_EXT_transform_feedback */
491 OPCODE_BEGIN_TRANSFORM_FEEDBACK,
492 OPCODE_END_TRANSFORM_FEEDBACK,
493 OPCODE_BIND_TRANSFORM_FEEDBACK,
494 OPCODE_PAUSE_TRANSFORM_FEEDBACK,
495 OPCODE_RESUME_TRANSFORM_FEEDBACK,
496 OPCODE_DRAW_TRANSFORM_FEEDBACK,
497
498 /* GL_EXT_texture_integer */
499 OPCODE_CLEARCOLOR_I,
500 OPCODE_CLEARCOLOR_UI,
501 OPCODE_TEXPARAMETER_I,
502 OPCODE_TEXPARAMETER_UI,
503
504 /* GL_ARB_instanced_arrays */
505 OPCODE_VERTEX_ATTRIB_DIVISOR,
506
507 /* GL_NV_texture_barrier */
508 OPCODE_TEXTURE_BARRIER_NV,
509
510 /* GL_ARB_sampler_object */
511 OPCODE_BIND_SAMPLER,
512 OPCODE_SAMPLER_PARAMETERIV,
513 OPCODE_SAMPLER_PARAMETERFV,
514 OPCODE_SAMPLER_PARAMETERIIV,
515 OPCODE_SAMPLER_PARAMETERUIV,
516
517 /* ARB_compute_shader */
518 OPCODE_DISPATCH_COMPUTE,
519
520 /* GL_ARB_sync */
521 OPCODE_WAIT_SYNC,
522
523 /* GL_NV_conditional_render */
524 OPCODE_BEGIN_CONDITIONAL_RENDER,
525 OPCODE_END_CONDITIONAL_RENDER,
526
527 /* ARB_timer_query */
528 OPCODE_QUERY_COUNTER,
529
530 /* ARB_transform_feedback3 */
531 OPCODE_BEGIN_QUERY_INDEXED,
532 OPCODE_END_QUERY_INDEXED,
533 OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM,
534
535 /* ARB_transform_feedback_instanced */
536 OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED,
537 OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED,
538
539 /* ARB_uniform_buffer_object */
540 OPCODE_UNIFORM_BLOCK_BINDING,
541
542 /* ARB_shader_subroutines */
543 OPCODE_UNIFORM_SUBROUTINES,
544
545 /* EXT_polygon_offset_clamp */
546 OPCODE_POLYGON_OFFSET_CLAMP,
547
548 /* EXT_window_rectangles */
549 OPCODE_WINDOW_RECTANGLES,
550
551 /* NV_conservative_raster */
552 OPCODE_SUBPIXEL_PRECISION_BIAS,
553
554 /* NV_conservative_raster_dilate */
555 OPCODE_CONSERVATIVE_RASTER_PARAMETER_F,
556
557 /* NV_conservative_raster_pre_snap_triangles */
558 OPCODE_CONSERVATIVE_RASTER_PARAMETER_I,
559
560 /* EXT_direct_state_access */
561 OPCODE_MATRIX_LOAD,
562 OPCODE_MATRIX_MULT,
563 OPCODE_MATRIX_ROTATE,
564 OPCODE_MATRIX_SCALE,
565 OPCODE_MATRIX_TRANSLATE,
566 OPCODE_MATRIX_LOAD_IDENTITY,
567 OPCODE_MATRIX_ORTHO,
568 OPCODE_MATRIX_FRUSTUM,
569 OPCODE_MATRIX_PUSH,
570 OPCODE_MATRIX_POP,
571 OPCODE_TEXTUREPARAMETER_F,
572 OPCODE_TEXTUREPARAMETER_I,
573 OPCODE_TEXTURE_IMAGE1D,
574 OPCODE_TEXTURE_IMAGE2D,
575 OPCODE_TEXTURE_IMAGE3D,
576 OPCODE_TEXTURE_SUB_IMAGE1D,
577 OPCODE_TEXTURE_SUB_IMAGE2D,
578 OPCODE_TEXTURE_SUB_IMAGE3D,
579 OPCODE_COPY_TEXTURE_IMAGE1D,
580 OPCODE_COPY_TEXTURE_IMAGE2D,
581 OPCODE_COPY_TEXTURE_SUB_IMAGE1D,
582 OPCODE_COPY_TEXTURE_SUB_IMAGE2D,
583 OPCODE_COPY_TEXTURE_SUB_IMAGE3D,
584 OPCODE_BIND_MULTITEXTURE,
585 OPCODE_MULTITEXPARAMETER_F,
586 OPCODE_MULTITEXPARAMETER_I,
587 OPCODE_MULTITEX_IMAGE1D,
588 OPCODE_MULTITEX_IMAGE2D,
589 OPCODE_MULTITEX_IMAGE3D,
590 OPCODE_MULTITEX_SUB_IMAGE1D,
591 OPCODE_MULTITEX_SUB_IMAGE2D,
592 OPCODE_MULTITEX_SUB_IMAGE3D,
593 OPCODE_COPY_MULTITEX_IMAGE1D,
594 OPCODE_COPY_MULTITEX_IMAGE2D,
595 OPCODE_COPY_MULTITEX_SUB_IMAGE1D,
596 OPCODE_COPY_MULTITEX_SUB_IMAGE2D,
597 OPCODE_COPY_MULTITEX_SUB_IMAGE3D,
598 OPCODE_MULTITEXENV,
599 OPCODE_COMPRESSED_TEXTURE_IMAGE_1D,
600 OPCODE_COMPRESSED_TEXTURE_IMAGE_2D,
601 OPCODE_COMPRESSED_TEXTURE_IMAGE_3D,
602 OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_1D,
603 OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_2D,
604 OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_3D,
605
606 /* The following three are meta instructions */
607 OPCODE_ERROR, /* raise compiled-in error */
608 OPCODE_CONTINUE,
609 OPCODE_NOP, /* No-op (used for 8-byte alignment */
610 OPCODE_END_OF_LIST,
611 OPCODE_EXT_0
612 } OpCode;
613
614
615
616 /**
617 * Display list node.
618 *
619 * Display list instructions are stored as sequences of "nodes". Nodes
620 * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
621 * are linked together with a pointer.
622 *
623 * Each instruction in the display list is stored as a sequence of
624 * contiguous nodes in memory.
625 * Each node is the union of a variety of data types.
626 *
627 * Note, all of these members should be 4 bytes in size or less for the
628 * sake of compact display lists. We store 8-byte pointers in a pair of
629 * these nodes using the save/get_pointer() functions below.
630 */
631 union gl_dlist_node
632 {
633 OpCode opcode;
634 GLboolean b;
635 GLbitfield bf;
636 GLubyte ub;
637 GLshort s;
638 GLushort us;
639 GLint i;
640 GLuint ui;
641 GLenum e;
642 GLfloat f;
643 GLsizei si;
644 };
645
646
647 typedef union gl_dlist_node Node;
648
649
650 /** How many 4-byte dwords to store a pointer */
651 #define POINTER_DWORDS (sizeof(void *) / 4)
652
653 /* We want to keep sizeof(union gl_dlist_node) == 4 to minimize
654 * space for display lists. The following types and functions are
655 * used to help store 4- and 8-byte pointers in 1 or 2 dlist_nodes.
656 */
657 union pointer
658 {
659 void *ptr;
660 GLuint dwords[POINTER_DWORDS];
661 };
662
663
664 /**
665 * Save a 4 or 8-byte pointer at dest (and dest+1).
666 */
667 static inline void
668 save_pointer(Node *dest, void *src)
669 {
670 union pointer p;
671 unsigned i;
672
673 STATIC_ASSERT(POINTER_DWORDS == 1 || POINTER_DWORDS == 2);
674 STATIC_ASSERT(sizeof(Node) == 4);
675
676 p.ptr = src;
677
678 for (i = 0; i < POINTER_DWORDS; i++)
679 dest[i].ui = p.dwords[i];
680 }
681
682
683 /**
684 * Retrieve a 4 or 8-byte pointer from node (node+1).
685 */
686 static inline void *
687 get_pointer(const Node *node)
688 {
689 union pointer p;
690 unsigned i;
691
692 for (i = 0; i < POINTER_DWORDS; i++)
693 p.dwords[i] = node[i].ui;
694
695 return p.ptr;
696 }
697
698
699 /**
700 * Used to store a 64-bit uint in a pair of "Nodes" for the sake of 32-bit
701 * environment.
702 */
703 union uint64_pair
704 {
705 GLuint64 uint64;
706 GLuint uint32[2];
707 };
708
709
710 union float64_pair
711 {
712 GLdouble d;
713 GLuint uint32[2];
714 };
715
716
717 #define ASSIGN_DOUBLE_TO_NODES(n, idx, value) \
718 do { \
719 union float64_pair tmp; \
720 tmp.d = value; \
721 n[idx].ui = tmp.uint32[0]; \
722 n[idx+1].ui = tmp.uint32[1]; \
723 } while (0)
724
725
726 /**
727 * How many nodes to allocate at a time. Note that bulk vertex data
728 * from glBegin/glVertex/glEnd primitives will typically wind up in
729 * a VBO, and not directly in the display list itself.
730 */
731 #define BLOCK_SIZE 256
732
733
734
735 /**
736 * Number of nodes of storage needed for each instruction.
737 * Sizes for dynamically allocated opcodes are stored in the context struct.
738 */
739 static GLuint InstSize[OPCODE_END_OF_LIST + 1];
740
741
742 void mesa_print_display_list(GLuint list);
743
744
745 /**
746 * Does the given display list only contain a single glBitmap call?
747 */
748 static bool
749 is_bitmap_list(const struct gl_display_list *dlist)
750 {
751 const Node *n = dlist->Head;
752 if (n[0].opcode == OPCODE_BITMAP) {
753 n += InstSize[OPCODE_BITMAP];
754 if (n[0].opcode == OPCODE_END_OF_LIST)
755 return true;
756 }
757 return false;
758 }
759
760
761 /**
762 * Is the given display list an empty list?
763 */
764 static bool
765 is_empty_list(const struct gl_display_list *dlist)
766 {
767 const Node *n = dlist->Head;
768 return n[0].opcode == OPCODE_END_OF_LIST;
769 }
770
771
772 /**
773 * Delete/free a gl_bitmap_atlas. Called during context tear-down.
774 */
775 void
776 _mesa_delete_bitmap_atlas(struct gl_context *ctx, struct gl_bitmap_atlas *atlas)
777 {
778 if (atlas->texObj) {
779 ctx->Driver.DeleteTexture(ctx, atlas->texObj);
780 }
781 free(atlas->glyphs);
782 free(atlas);
783 }
784
785
786 /**
787 * Lookup a gl_bitmap_atlas by listBase ID.
788 */
789 static struct gl_bitmap_atlas *
790 lookup_bitmap_atlas(struct gl_context *ctx, GLuint listBase)
791 {
792 struct gl_bitmap_atlas *atlas;
793
794 assert(listBase > 0);
795 atlas = _mesa_HashLookup(ctx->Shared->BitmapAtlas, listBase);
796 return atlas;
797 }
798
799
800 /**
801 * Create new bitmap atlas and insert into hash table.
802 */
803 static struct gl_bitmap_atlas *
804 alloc_bitmap_atlas(struct gl_context *ctx, GLuint listBase)
805 {
806 struct gl_bitmap_atlas *atlas;
807
808 assert(listBase > 0);
809 assert(_mesa_HashLookup(ctx->Shared->BitmapAtlas, listBase) == NULL);
810
811 atlas = calloc(1, sizeof(*atlas));
812 if (atlas) {
813 _mesa_HashInsert(ctx->Shared->BitmapAtlas, listBase, atlas);
814 }
815
816 return atlas;
817 }
818
819
820 /**
821 * Try to build a bitmap atlas. This involves examining a sequence of
822 * display lists which contain glBitmap commands and putting the bitmap
823 * images into a texture map (the atlas).
824 * If we succeed, gl_bitmap_atlas::complete will be set to true.
825 * If we fail, gl_bitmap_atlas::incomplete will be set to true.
826 */
827 static void
828 build_bitmap_atlas(struct gl_context *ctx, struct gl_bitmap_atlas *atlas,
829 GLuint listBase)
830 {
831 unsigned i, row_height = 0, xpos = 0, ypos = 0;
832 GLubyte *map;
833 GLint map_stride;
834
835 assert(atlas);
836 assert(!atlas->complete);
837 assert(atlas->numBitmaps > 0);
838
839 /* We use a rectangle texture (non-normalized coords) for the atlas */
840 assert(ctx->Extensions.NV_texture_rectangle);
841 assert(ctx->Const.MaxTextureRectSize >= 1024);
842
843 atlas->texWidth = 1024;
844 atlas->texHeight = 0; /* determined below */
845
846 atlas->glyphs = malloc(atlas->numBitmaps * sizeof(atlas->glyphs[0]));
847 if (!atlas->glyphs) {
848 /* give up */
849 atlas->incomplete = true;
850 return;
851 }
852
853 /* Loop over the display lists. They should all contain a single glBitmap
854 * call. If not, bail out. Also, compute the position and sizes of each
855 * bitmap in the atlas to determine the texture atlas size.
856 */
857 for (i = 0; i < atlas->numBitmaps; i++) {
858 const struct gl_display_list *list = _mesa_lookup_list(ctx, listBase + i);
859 const Node *n;
860 struct gl_bitmap_glyph *g = &atlas->glyphs[i];
861 unsigned bitmap_width, bitmap_height;
862 float bitmap_xmove, bitmap_ymove, bitmap_xorig, bitmap_yorig;
863
864 if (!list || is_empty_list(list)) {
865 /* stop here */
866 atlas->numBitmaps = i;
867 break;
868 }
869
870 if (!is_bitmap_list(list)) {
871 /* This list does not contain exactly one glBitmap command. Give up. */
872 atlas->incomplete = true;
873 return;
874 }
875
876 /* get bitmap info from the display list command */
877 n = list->Head;
878 assert(n[0].opcode == OPCODE_BITMAP);
879 bitmap_width = n[1].i;
880 bitmap_height = n[2].i;
881 bitmap_xorig = n[3].f;
882 bitmap_yorig = n[4].f;
883 bitmap_xmove = n[5].f;
884 bitmap_ymove = n[6].f;
885
886 if (xpos + bitmap_width > atlas->texWidth) {
887 /* advance to the next row of the texture */
888 xpos = 0;
889 ypos += row_height;
890 row_height = 0;
891 }
892
893 /* save the bitmap's position in the atlas */
894 g->x = xpos;
895 g->y = ypos;
896 g->w = bitmap_width;
897 g->h = bitmap_height;
898 g->xorig = bitmap_xorig;
899 g->yorig = bitmap_yorig;
900 g->xmove = bitmap_xmove;
901 g->ymove = bitmap_ymove;
902
903 xpos += bitmap_width;
904
905 /* keep track of tallest bitmap in the row */
906 row_height = MAX2(row_height, bitmap_height);
907 }
908
909 /* Now we know the texture height */
910 atlas->texHeight = ypos + row_height;
911
912 if (atlas->texHeight == 0) {
913 /* no glyphs found, give up */
914 goto fail;
915 }
916 else if (atlas->texHeight > ctx->Const.MaxTextureRectSize) {
917 /* too large, give up */
918 goto fail;
919 }
920
921 /* Create atlas texture (texture ID is irrelevant) */
922 atlas->texObj = ctx->Driver.NewTextureObject(ctx, 999, GL_TEXTURE_RECTANGLE);
923 if (!atlas->texObj) {
924 goto out_of_memory;
925 }
926
927 atlas->texObj->Sampler.MinFilter = GL_NEAREST;
928 atlas->texObj->Sampler.MagFilter = GL_NEAREST;
929 atlas->texObj->MaxLevel = 0;
930 atlas->texObj->Immutable = GL_TRUE;
931
932 atlas->texImage = _mesa_get_tex_image(ctx, atlas->texObj,
933 GL_TEXTURE_RECTANGLE, 0);
934 if (!atlas->texImage) {
935 goto out_of_memory;
936 }
937
938 _mesa_init_teximage_fields(ctx, atlas->texImage,
939 atlas->texWidth, atlas->texHeight, 1, 0,
940 GL_ALPHA, MESA_FORMAT_A_UNORM8);
941
942 /* alloc image storage */
943 if (!ctx->Driver.AllocTextureImageBuffer(ctx, atlas->texImage)) {
944 goto out_of_memory;
945 }
946
947 /* map teximage, load with bitmap glyphs */
948 ctx->Driver.MapTextureImage(ctx, atlas->texImage, 0,
949 0, 0, atlas->texWidth, atlas->texHeight,
950 GL_MAP_WRITE_BIT, &map, &map_stride);
951 if (!map) {
952 goto out_of_memory;
953 }
954
955 /* Background/clear pixels are 0xff, foreground/set pixels are 0x0 */
956 memset(map, 0xff, map_stride * atlas->texHeight);
957
958 for (i = 0; i < atlas->numBitmaps; i++) {
959 const struct gl_display_list *list = _mesa_lookup_list(ctx, listBase + i);
960 const Node *n = list->Head;
961
962 assert(n[0].opcode == OPCODE_BITMAP ||
963 n[0].opcode == OPCODE_END_OF_LIST);
964
965 if (n[0].opcode == OPCODE_BITMAP) {
966 unsigned bitmap_width = n[1].i;
967 unsigned bitmap_height = n[2].i;
968 unsigned xpos = atlas->glyphs[i].x;
969 unsigned ypos = atlas->glyphs[i].y;
970 const void *bitmap_image = get_pointer(&n[7]);
971
972 assert(atlas->glyphs[i].w == bitmap_width);
973 assert(atlas->glyphs[i].h == bitmap_height);
974
975 /* put the bitmap image into the texture image */
976 _mesa_expand_bitmap(bitmap_width, bitmap_height,
977 &ctx->DefaultPacking, bitmap_image,
978 map + map_stride * ypos + xpos, /* dest addr */
979 map_stride, 0x0);
980 }
981 }
982
983 ctx->Driver.UnmapTextureImage(ctx, atlas->texImage, 0);
984
985 atlas->complete = true;
986
987 return;
988
989 out_of_memory:
990 _mesa_error(ctx, GL_OUT_OF_MEMORY, "Display list bitmap atlas");
991 fail:
992 if (atlas->texObj) {
993 ctx->Driver.DeleteTexture(ctx, atlas->texObj);
994 }
995 free(atlas->glyphs);
996 atlas->glyphs = NULL;
997 atlas->incomplete = true;
998 }
999
1000
1001 /**
1002 * Allocate a gl_display_list object with an initial block of storage.
1003 * \param count how many display list nodes/tokens to allocate
1004 */
1005 static struct gl_display_list *
1006 make_list(GLuint name, GLuint count)
1007 {
1008 struct gl_display_list *dlist = CALLOC_STRUCT(gl_display_list);
1009 dlist->Name = name;
1010 dlist->Head = malloc(sizeof(Node) * count);
1011 dlist->Head[0].opcode = OPCODE_END_OF_LIST;
1012 /* All InstSize[] entries must be non-zero */
1013 InstSize[OPCODE_END_OF_LIST] = 1;
1014 return dlist;
1015 }
1016
1017
1018 /**
1019 * Lookup function to just encapsulate casting.
1020 */
1021 struct gl_display_list *
1022 _mesa_lookup_list(struct gl_context *ctx, GLuint list)
1023 {
1024 return (struct gl_display_list *)
1025 _mesa_HashLookup(ctx->Shared->DisplayList, list);
1026 }
1027
1028
1029 /** Is the given opcode an extension code? */
1030 static inline GLboolean
1031 is_ext_opcode(OpCode opcode)
1032 {
1033 return (opcode >= OPCODE_EXT_0);
1034 }
1035
1036
1037 /** Destroy an extended opcode instruction */
1038 static GLint
1039 ext_opcode_destroy(struct gl_context *ctx, Node *node)
1040 {
1041 const GLint i = node[0].opcode - OPCODE_EXT_0;
1042 GLint step;
1043 ctx->ListExt->Opcode[i].Destroy(ctx, &node[1]);
1044 step = ctx->ListExt->Opcode[i].Size;
1045 return step;
1046 }
1047
1048
1049 /** Execute an extended opcode instruction */
1050 static GLint
1051 ext_opcode_execute(struct gl_context *ctx, Node *node)
1052 {
1053 const GLint i = node[0].opcode - OPCODE_EXT_0;
1054 GLint step;
1055 ctx->ListExt->Opcode[i].Execute(ctx, &node[1]);
1056 step = ctx->ListExt->Opcode[i].Size;
1057 return step;
1058 }
1059
1060
1061 /** Print an extended opcode instruction */
1062 static GLint
1063 ext_opcode_print(struct gl_context *ctx, Node *node, FILE *f)
1064 {
1065 const GLint i = node[0].opcode - OPCODE_EXT_0;
1066 GLint step;
1067 ctx->ListExt->Opcode[i].Print(ctx, &node[1], f);
1068 step = ctx->ListExt->Opcode[i].Size;
1069 return step;
1070 }
1071
1072
1073 /**
1074 * Delete the named display list, but don't remove from hash table.
1075 * \param dlist - display list pointer
1076 */
1077 void
1078 _mesa_delete_list(struct gl_context *ctx, struct gl_display_list *dlist)
1079 {
1080 Node *n, *block;
1081 GLboolean done;
1082
1083 n = block = dlist->Head;
1084
1085 done = block ? GL_FALSE : GL_TRUE;
1086 while (!done) {
1087 const OpCode opcode = n[0].opcode;
1088
1089 /* check for extension opcodes first */
1090 if (is_ext_opcode(opcode)) {
1091 n += ext_opcode_destroy(ctx, n);
1092 }
1093 else {
1094 switch (opcode) {
1095 /* for some commands, we need to free malloc'd memory */
1096 case OPCODE_MAP1:
1097 free(get_pointer(&n[6]));
1098 break;
1099 case OPCODE_MAP2:
1100 free(get_pointer(&n[10]));
1101 break;
1102 case OPCODE_CALL_LISTS:
1103 free(get_pointer(&n[3]));
1104 break;
1105 case OPCODE_DRAW_PIXELS:
1106 free(get_pointer(&n[5]));
1107 break;
1108 case OPCODE_BITMAP:
1109 free(get_pointer(&n[7]));
1110 break;
1111 case OPCODE_POLYGON_STIPPLE:
1112 free(get_pointer(&n[1]));
1113 break;
1114 case OPCODE_TEX_IMAGE1D:
1115 free(get_pointer(&n[8]));
1116 break;
1117 case OPCODE_TEX_IMAGE2D:
1118 free(get_pointer(&n[9]));
1119 break;
1120 case OPCODE_TEX_IMAGE3D:
1121 free(get_pointer(&n[10]));
1122 break;
1123 case OPCODE_TEX_SUB_IMAGE1D:
1124 free(get_pointer(&n[7]));
1125 break;
1126 case OPCODE_TEX_SUB_IMAGE2D:
1127 free(get_pointer(&n[9]));
1128 break;
1129 case OPCODE_TEX_SUB_IMAGE3D:
1130 free(get_pointer(&n[11]));
1131 break;
1132 case OPCODE_COMPRESSED_TEX_IMAGE_1D:
1133 free(get_pointer(&n[7]));
1134 break;
1135 case OPCODE_COMPRESSED_TEX_IMAGE_2D:
1136 free(get_pointer(&n[8]));
1137 break;
1138 case OPCODE_COMPRESSED_TEX_IMAGE_3D:
1139 free(get_pointer(&n[9]));
1140 break;
1141 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D:
1142 free(get_pointer(&n[7]));
1143 break;
1144 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D:
1145 free(get_pointer(&n[9]));
1146 break;
1147 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D:
1148 free(get_pointer(&n[11]));
1149 break;
1150 case OPCODE_PROGRAM_STRING_ARB:
1151 free(get_pointer(&n[4])); /* program string */
1152 break;
1153 case OPCODE_UNIFORM_1FV:
1154 case OPCODE_UNIFORM_2FV:
1155 case OPCODE_UNIFORM_3FV:
1156 case OPCODE_UNIFORM_4FV:
1157 case OPCODE_UNIFORM_1DV:
1158 case OPCODE_UNIFORM_2DV:
1159 case OPCODE_UNIFORM_3DV:
1160 case OPCODE_UNIFORM_4DV:
1161 case OPCODE_UNIFORM_1IV:
1162 case OPCODE_UNIFORM_2IV:
1163 case OPCODE_UNIFORM_3IV:
1164 case OPCODE_UNIFORM_4IV:
1165 case OPCODE_UNIFORM_1UIV:
1166 case OPCODE_UNIFORM_2UIV:
1167 case OPCODE_UNIFORM_3UIV:
1168 case OPCODE_UNIFORM_4UIV:
1169 free(get_pointer(&n[3]));
1170 break;
1171 case OPCODE_UNIFORM_MATRIX22:
1172 case OPCODE_UNIFORM_MATRIX33:
1173 case OPCODE_UNIFORM_MATRIX44:
1174 case OPCODE_UNIFORM_MATRIX24:
1175 case OPCODE_UNIFORM_MATRIX42:
1176 case OPCODE_UNIFORM_MATRIX23:
1177 case OPCODE_UNIFORM_MATRIX32:
1178 case OPCODE_UNIFORM_MATRIX34:
1179 case OPCODE_UNIFORM_MATRIX43:
1180 case OPCODE_UNIFORM_MATRIX22D:
1181 case OPCODE_UNIFORM_MATRIX33D:
1182 case OPCODE_UNIFORM_MATRIX44D:
1183 case OPCODE_UNIFORM_MATRIX24D:
1184 case OPCODE_UNIFORM_MATRIX42D:
1185 case OPCODE_UNIFORM_MATRIX23D:
1186 case OPCODE_UNIFORM_MATRIX32D:
1187 case OPCODE_UNIFORM_MATRIX34D:
1188 case OPCODE_UNIFORM_MATRIX43D:
1189 free(get_pointer(&n[4]));
1190 break;
1191 case OPCODE_PROGRAM_UNIFORM_1FV:
1192 case OPCODE_PROGRAM_UNIFORM_2FV:
1193 case OPCODE_PROGRAM_UNIFORM_3FV:
1194 case OPCODE_PROGRAM_UNIFORM_4FV:
1195 case OPCODE_PROGRAM_UNIFORM_1DV:
1196 case OPCODE_PROGRAM_UNIFORM_2DV:
1197 case OPCODE_PROGRAM_UNIFORM_3DV:
1198 case OPCODE_PROGRAM_UNIFORM_4DV:
1199 case OPCODE_PROGRAM_UNIFORM_1IV:
1200 case OPCODE_PROGRAM_UNIFORM_2IV:
1201 case OPCODE_PROGRAM_UNIFORM_3IV:
1202 case OPCODE_PROGRAM_UNIFORM_4IV:
1203 case OPCODE_PROGRAM_UNIFORM_1UIV:
1204 case OPCODE_PROGRAM_UNIFORM_2UIV:
1205 case OPCODE_PROGRAM_UNIFORM_3UIV:
1206 case OPCODE_PROGRAM_UNIFORM_4UIV:
1207 free(get_pointer(&n[4]));
1208 break;
1209 case OPCODE_PROGRAM_UNIFORM_MATRIX22F:
1210 case OPCODE_PROGRAM_UNIFORM_MATRIX33F:
1211 case OPCODE_PROGRAM_UNIFORM_MATRIX44F:
1212 case OPCODE_PROGRAM_UNIFORM_MATRIX24F:
1213 case OPCODE_PROGRAM_UNIFORM_MATRIX42F:
1214 case OPCODE_PROGRAM_UNIFORM_MATRIX23F:
1215 case OPCODE_PROGRAM_UNIFORM_MATRIX32F:
1216 case OPCODE_PROGRAM_UNIFORM_MATRIX34F:
1217 case OPCODE_PROGRAM_UNIFORM_MATRIX43F:
1218 case OPCODE_PROGRAM_UNIFORM_MATRIX22D:
1219 case OPCODE_PROGRAM_UNIFORM_MATRIX33D:
1220 case OPCODE_PROGRAM_UNIFORM_MATRIX44D:
1221 case OPCODE_PROGRAM_UNIFORM_MATRIX24D:
1222 case OPCODE_PROGRAM_UNIFORM_MATRIX42D:
1223 case OPCODE_PROGRAM_UNIFORM_MATRIX23D:
1224 case OPCODE_PROGRAM_UNIFORM_MATRIX32D:
1225 case OPCODE_PROGRAM_UNIFORM_MATRIX34D:
1226 case OPCODE_PROGRAM_UNIFORM_MATRIX43D:
1227 free(get_pointer(&n[5]));
1228 break;
1229 case OPCODE_PIXEL_MAP:
1230 free(get_pointer(&n[3]));
1231 break;
1232 case OPCODE_VIEWPORT_ARRAY_V:
1233 case OPCODE_SCISSOR_ARRAY_V:
1234 case OPCODE_DEPTH_ARRAY_V:
1235 case OPCODE_UNIFORM_SUBROUTINES:
1236 case OPCODE_WINDOW_RECTANGLES:
1237 free(get_pointer(&n[3]));
1238 break;
1239 case OPCODE_TEXTURE_IMAGE1D:
1240 case OPCODE_MULTITEX_IMAGE1D:
1241 free(get_pointer(&n[9]));
1242 break;
1243 case OPCODE_TEXTURE_IMAGE2D:
1244 case OPCODE_MULTITEX_IMAGE2D:
1245 free(get_pointer(&n[10]));
1246 break;
1247 case OPCODE_TEXTURE_IMAGE3D:
1248 case OPCODE_MULTITEX_IMAGE3D:
1249 free(get_pointer(&n[11]));
1250 break;
1251 case OPCODE_TEXTURE_SUB_IMAGE1D:
1252 case OPCODE_MULTITEX_SUB_IMAGE1D:
1253 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_1D:
1254 free(get_pointer(&n[8]));
1255 break;
1256 case OPCODE_TEXTURE_SUB_IMAGE2D:
1257 case OPCODE_MULTITEX_SUB_IMAGE2D:
1258 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_2D:
1259 free(get_pointer(&n[10]));
1260 break;
1261 case OPCODE_TEXTURE_SUB_IMAGE3D:
1262 case OPCODE_MULTITEX_SUB_IMAGE3D:
1263 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_3D:
1264 free(get_pointer(&n[12]));
1265 break;
1266 case OPCODE_COMPRESSED_TEXTURE_IMAGE_1D:
1267 free(get_pointer(&n[8]));
1268 break;
1269 case OPCODE_COMPRESSED_TEXTURE_IMAGE_2D:
1270 free(get_pointer(&n[9]));
1271 break;
1272 case OPCODE_COMPRESSED_TEXTURE_IMAGE_3D:
1273 free(get_pointer(&n[10]));
1274 break;
1275 case OPCODE_CONTINUE:
1276 n = (Node *) get_pointer(&n[1]);
1277 free(block);
1278 block = n;
1279 break;
1280 case OPCODE_END_OF_LIST:
1281 free(block);
1282 done = GL_TRUE;
1283 break;
1284 default:
1285 /* just increment 'n' pointer, below */
1286 ;
1287 }
1288
1289 if (opcode != OPCODE_CONTINUE) {
1290 assert(InstSize[opcode] > 0);
1291 n += InstSize[opcode];
1292 }
1293 }
1294 }
1295
1296 free(dlist->Label);
1297 free(dlist);
1298 }
1299
1300
1301 /**
1302 * Called by _mesa_HashWalk() to check if a display list which is being
1303 * deleted belongs to a bitmap texture atlas.
1304 */
1305 static void
1306 check_atlas_for_deleted_list(GLuint atlas_id, void *data, void *userData)
1307 {
1308 struct gl_bitmap_atlas *atlas = (struct gl_bitmap_atlas *) data;
1309 GLuint list_id = *((GLuint *) userData); /* the list being deleted */
1310
1311 /* See if the list_id falls in the range contained in this texture atlas */
1312 if (atlas->complete &&
1313 list_id >= atlas_id &&
1314 list_id < atlas_id + atlas->numBitmaps) {
1315 /* Mark the atlas as incomplete so it doesn't get used. But don't
1316 * delete it yet since we don't want to try to recreate it in the next
1317 * glCallLists.
1318 */
1319 atlas->complete = false;
1320 atlas->incomplete = true;
1321 }
1322 }
1323
1324
1325 /**
1326 * Destroy a display list and remove from hash table.
1327 * \param list - display list number
1328 */
1329 static void
1330 destroy_list(struct gl_context *ctx, GLuint list)
1331 {
1332 struct gl_display_list *dlist;
1333
1334 if (list == 0)
1335 return;
1336
1337 dlist = _mesa_lookup_list(ctx, list);
1338 if (!dlist)
1339 return;
1340
1341 if (is_bitmap_list(dlist)) {
1342 /* If we're destroying a simple glBitmap display list, there's a
1343 * chance that we're destroying a bitmap image that's in a texture
1344 * atlas. Examine all atlases to see if that's the case. There's
1345 * usually few (if any) atlases so this isn't expensive.
1346 */
1347 _mesa_HashWalk(ctx->Shared->BitmapAtlas,
1348 check_atlas_for_deleted_list, &list);
1349 }
1350
1351 _mesa_delete_list(ctx, dlist);
1352 _mesa_HashRemove(ctx->Shared->DisplayList, list);
1353 }
1354
1355
1356 /*
1357 * Translate the nth element of list from <type> to GLint.
1358 */
1359 static GLint
1360 translate_id(GLsizei n, GLenum type, const GLvoid * list)
1361 {
1362 GLbyte *bptr;
1363 GLubyte *ubptr;
1364 GLshort *sptr;
1365 GLushort *usptr;
1366 GLint *iptr;
1367 GLuint *uiptr;
1368 GLfloat *fptr;
1369
1370 switch (type) {
1371 case GL_BYTE:
1372 bptr = (GLbyte *) list;
1373 return (GLint) bptr[n];
1374 case GL_UNSIGNED_BYTE:
1375 ubptr = (GLubyte *) list;
1376 return (GLint) ubptr[n];
1377 case GL_SHORT:
1378 sptr = (GLshort *) list;
1379 return (GLint) sptr[n];
1380 case GL_UNSIGNED_SHORT:
1381 usptr = (GLushort *) list;
1382 return (GLint) usptr[n];
1383 case GL_INT:
1384 iptr = (GLint *) list;
1385 return iptr[n];
1386 case GL_UNSIGNED_INT:
1387 uiptr = (GLuint *) list;
1388 return (GLint) uiptr[n];
1389 case GL_FLOAT:
1390 fptr = (GLfloat *) list;
1391 return (GLint) floorf(fptr[n]);
1392 case GL_2_BYTES:
1393 ubptr = ((GLubyte *) list) + 2 * n;
1394 return (GLint) ubptr[0] * 256
1395 + (GLint) ubptr[1];
1396 case GL_3_BYTES:
1397 ubptr = ((GLubyte *) list) + 3 * n;
1398 return (GLint) ubptr[0] * 65536
1399 + (GLint) ubptr[1] * 256
1400 + (GLint) ubptr[2];
1401 case GL_4_BYTES:
1402 ubptr = ((GLubyte *) list) + 4 * n;
1403 return (GLint) ubptr[0] * 16777216
1404 + (GLint) ubptr[1] * 65536
1405 + (GLint) ubptr[2] * 256
1406 + (GLint) ubptr[3];
1407 default:
1408 return 0;
1409 }
1410 }
1411
1412
1413 /**
1414 * Wrapper for _mesa_unpack_image/bitmap() that handles pixel buffer objects.
1415 * If width < 0 or height < 0 or format or type are invalid we'll just
1416 * return NULL. We will not generate an error since OpenGL command
1417 * arguments aren't error-checked until the command is actually executed
1418 * (not when they're compiled).
1419 * But if we run out of memory, GL_OUT_OF_MEMORY will be recorded.
1420 */
1421 static GLvoid *
1422 unpack_image(struct gl_context *ctx, GLuint dimensions,
1423 GLsizei width, GLsizei height, GLsizei depth,
1424 GLenum format, GLenum type, const GLvoid * pixels,
1425 const struct gl_pixelstore_attrib *unpack)
1426 {
1427 if (width <= 0 || height <= 0) {
1428 return NULL;
1429 }
1430
1431 if (_mesa_bytes_per_pixel(format, type) < 0) {
1432 /* bad format and/or type */
1433 return NULL;
1434 }
1435
1436 if (!_mesa_is_bufferobj(unpack->BufferObj)) {
1437 /* no PBO */
1438 GLvoid *image;
1439
1440 image = _mesa_unpack_image(dimensions, width, height, depth,
1441 format, type, pixels, unpack);
1442 if (pixels && !image) {
1443 _mesa_error(ctx, GL_OUT_OF_MEMORY, "display list construction");
1444 }
1445 return image;
1446 }
1447 else if (_mesa_validate_pbo_access(dimensions, unpack, width, height,
1448 depth, format, type, INT_MAX, pixels)) {
1449 const GLubyte *map, *src;
1450 GLvoid *image;
1451
1452 map = (GLubyte *)
1453 ctx->Driver.MapBufferRange(ctx, 0, unpack->BufferObj->Size,
1454 GL_MAP_READ_BIT, unpack->BufferObj,
1455 MAP_INTERNAL);
1456 if (!map) {
1457 /* unable to map src buffer! */
1458 _mesa_error(ctx, GL_INVALID_OPERATION, "unable to map PBO");
1459 return NULL;
1460 }
1461
1462 src = ADD_POINTERS(map, pixels);
1463 image = _mesa_unpack_image(dimensions, width, height, depth,
1464 format, type, src, unpack);
1465
1466 ctx->Driver.UnmapBuffer(ctx, unpack->BufferObj, MAP_INTERNAL);
1467
1468 if (!image) {
1469 _mesa_error(ctx, GL_OUT_OF_MEMORY, "display list construction");
1470 }
1471 return image;
1472 }
1473
1474 /* bad access! */
1475 _mesa_error(ctx, GL_INVALID_OPERATION, "invalid PBO access");
1476 return NULL;
1477 }
1478
1479
1480 /** Return copy of memory */
1481 static void *
1482 memdup(const void *src, GLsizei bytes)
1483 {
1484 void *b = bytes >= 0 ? malloc(bytes) : NULL;
1485 if (b)
1486 memcpy(b, src, bytes);
1487 return b;
1488 }
1489
1490
1491 /**
1492 * Allocate space for a display list instruction (opcode + payload space).
1493 * \param opcode the instruction opcode (OPCODE_* value)
1494 * \param bytes instruction payload size (not counting opcode)
1495 * \param align8 does the payload need to be 8-byte aligned?
1496 * This is only relevant in 64-bit environments.
1497 * \return pointer to allocated memory (the payload will be at pointer+1)
1498 */
1499 static Node *
1500 dlist_alloc(struct gl_context *ctx, OpCode opcode, GLuint bytes, bool align8)
1501 {
1502 const GLuint numNodes = 1 + (bytes + sizeof(Node) - 1) / sizeof(Node);
1503 const GLuint contNodes = 1 + POINTER_DWORDS; /* size of continue info */
1504 GLuint nopNode;
1505 Node *n;
1506
1507 assert(bytes <= BLOCK_SIZE * sizeof(Node));
1508
1509 if (opcode < OPCODE_EXT_0) {
1510 if (InstSize[opcode] == 0) {
1511 /* save instruction size now */
1512 InstSize[opcode] = numNodes;
1513 }
1514 else {
1515 /* make sure instruction size agrees */
1516 assert(numNodes == InstSize[opcode]);
1517 }
1518 }
1519
1520 if (sizeof(void *) > sizeof(Node) && align8
1521 && ctx->ListState.CurrentPos % 2 == 0) {
1522 /* The opcode would get placed at node[0] and the payload would start
1523 * at node[1]. But the payload needs to be at an even offset (8-byte
1524 * multiple).
1525 */
1526 nopNode = 1;
1527 }
1528 else {
1529 nopNode = 0;
1530 }
1531
1532 if (ctx->ListState.CurrentPos + nopNode + numNodes + contNodes
1533 > BLOCK_SIZE) {
1534 /* This block is full. Allocate a new block and chain to it */
1535 Node *newblock;
1536 n = ctx->ListState.CurrentBlock + ctx->ListState.CurrentPos;
1537 n[0].opcode = OPCODE_CONTINUE;
1538 newblock = malloc(sizeof(Node) * BLOCK_SIZE);
1539 if (!newblock) {
1540 _mesa_error(ctx, GL_OUT_OF_MEMORY, "Building display list");
1541 return NULL;
1542 }
1543
1544 /* a fresh block should be 8-byte aligned on 64-bit systems */
1545 assert(((GLintptr) newblock) % sizeof(void *) == 0);
1546
1547 save_pointer(&n[1], newblock);
1548 ctx->ListState.CurrentBlock = newblock;
1549 ctx->ListState.CurrentPos = 0;
1550
1551 /* Display list nodes are always 4 bytes. If we need 8-byte alignment
1552 * we have to insert a NOP so that the payload of the real opcode lands
1553 * on an even location:
1554 * node[0] = OPCODE_NOP
1555 * node[1] = OPCODE_x;
1556 * node[2] = start of payload
1557 */
1558 nopNode = sizeof(void *) > sizeof(Node) && align8;
1559 }
1560
1561 n = ctx->ListState.CurrentBlock + ctx->ListState.CurrentPos;
1562 if (nopNode) {
1563 assert(ctx->ListState.CurrentPos % 2 == 0); /* even value */
1564 n[0].opcode = OPCODE_NOP;
1565 n++;
1566 /* The "real" opcode will now be at an odd location and the payload
1567 * will be at an even location.
1568 */
1569 }
1570 ctx->ListState.CurrentPos += nopNode + numNodes;
1571
1572 n[0].opcode = opcode;
1573
1574 return n;
1575 }
1576
1577
1578
1579 /**
1580 * Allocate space for a display list instruction. Used by callers outside
1581 * this file for things like VBO vertex data.
1582 *
1583 * \param opcode the instruction opcode (OPCODE_* value)
1584 * \param bytes instruction size in bytes, not counting opcode.
1585 * \return pointer to the usable data area (not including the internal
1586 * opcode).
1587 */
1588 void *
1589 _mesa_dlist_alloc(struct gl_context *ctx, GLuint opcode, GLuint bytes)
1590 {
1591 Node *n = dlist_alloc(ctx, (OpCode) opcode, bytes, false);
1592 if (n)
1593 return n + 1; /* return pointer to payload area, after opcode */
1594 else
1595 return NULL;
1596 }
1597
1598
1599 /**
1600 * Same as _mesa_dlist_alloc(), but return a pointer which is 8-byte
1601 * aligned in 64-bit environments, 4-byte aligned otherwise.
1602 */
1603 void *
1604 _mesa_dlist_alloc_aligned(struct gl_context *ctx, GLuint opcode, GLuint bytes)
1605 {
1606 Node *n = dlist_alloc(ctx, (OpCode) opcode, bytes, true);
1607 if (n)
1608 return n + 1; /* return pointer to payload area, after opcode */
1609 else
1610 return NULL;
1611 }
1612
1613
1614 /**
1615 * This function allows modules and drivers to get their own opcodes
1616 * for extending display list functionality.
1617 * \param ctx the rendering context
1618 * \param size number of bytes for storing the new display list command
1619 * \param execute function to execute the new display list command
1620 * \param destroy function to destroy the new display list command
1621 * \param print function to print the new display list command
1622 * \return the new opcode number or -1 if error
1623 */
1624 GLint
1625 _mesa_dlist_alloc_opcode(struct gl_context *ctx,
1626 GLuint size,
1627 void (*execute) (struct gl_context *, void *),
1628 void (*destroy) (struct gl_context *, void *),
1629 void (*print) (struct gl_context *, void *, FILE *))
1630 {
1631 if (ctx->ListExt->NumOpcodes < MAX_DLIST_EXT_OPCODES) {
1632 const GLuint i = ctx->ListExt->NumOpcodes++;
1633 ctx->ListExt->Opcode[i].Size =
1634 1 + (size + sizeof(Node) - 1) / sizeof(Node);
1635 ctx->ListExt->Opcode[i].Execute = execute;
1636 ctx->ListExt->Opcode[i].Destroy = destroy;
1637 ctx->ListExt->Opcode[i].Print = print;
1638 return i + OPCODE_EXT_0;
1639 }
1640 return -1;
1641 }
1642
1643
1644 /**
1645 * Allocate space for a display list instruction. The space is basically
1646 * an array of Nodes where node[0] holds the opcode, node[1] is the first
1647 * function parameter, node[2] is the second parameter, etc.
1648 *
1649 * \param opcode one of OPCODE_x
1650 * \param nparams number of function parameters
1651 * \return pointer to start of instruction space
1652 */
1653 static inline Node *
1654 alloc_instruction(struct gl_context *ctx, OpCode opcode, GLuint nparams)
1655 {
1656 return dlist_alloc(ctx, opcode, nparams * sizeof(Node), false);
1657 }
1658
1659
1660 /**
1661 * Called by EndList to try to reduce memory used for the list.
1662 */
1663 static void
1664 trim_list(struct gl_context *ctx)
1665 {
1666 /* If the list we're ending only has one allocated block of nodes/tokens
1667 * and its size isn't a full block size, realloc the block to use less
1668 * memory. This is important for apps that create many small display
1669 * lists and apps that use glXUseXFont (many lists each containing one
1670 * glBitmap call).
1671 * Note: we currently only trim display lists that allocated one block
1672 * of tokens. That hits the short list case which is what we're mainly
1673 * concerned with. Trimming longer lists would involve traversing the
1674 * linked list of blocks.
1675 */
1676 struct gl_dlist_state *list = &ctx->ListState;
1677
1678 if ((list->CurrentList->Head == list->CurrentBlock) &&
1679 (list->CurrentPos < BLOCK_SIZE)) {
1680 /* There's only one block and it's not full, so realloc */
1681 GLuint newSize = list->CurrentPos * sizeof(Node);
1682 list->CurrentList->Head =
1683 list->CurrentBlock = realloc(list->CurrentBlock, newSize);
1684 if (!list->CurrentBlock) {
1685 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glEndList");
1686 }
1687 }
1688 }
1689
1690
1691
1692 /*
1693 * Display List compilation functions
1694 */
1695 static void GLAPIENTRY
1696 save_Accum(GLenum op, GLfloat value)
1697 {
1698 GET_CURRENT_CONTEXT(ctx);
1699 Node *n;
1700 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1701 n = alloc_instruction(ctx, OPCODE_ACCUM, 2);
1702 if (n) {
1703 n[1].e = op;
1704 n[2].f = value;
1705 }
1706 if (ctx->ExecuteFlag) {
1707 CALL_Accum(ctx->Exec, (op, value));
1708 }
1709 }
1710
1711
1712 static void GLAPIENTRY
1713 save_AlphaFunc(GLenum func, GLclampf ref)
1714 {
1715 GET_CURRENT_CONTEXT(ctx);
1716 Node *n;
1717 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1718 n = alloc_instruction(ctx, OPCODE_ALPHA_FUNC, 2);
1719 if (n) {
1720 n[1].e = func;
1721 n[2].f = (GLfloat) ref;
1722 }
1723 if (ctx->ExecuteFlag) {
1724 CALL_AlphaFunc(ctx->Exec, (func, ref));
1725 }
1726 }
1727
1728
1729 static void GLAPIENTRY
1730 save_BindTexture(GLenum target, GLuint texture)
1731 {
1732 GET_CURRENT_CONTEXT(ctx);
1733 Node *n;
1734 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1735 n = alloc_instruction(ctx, OPCODE_BIND_TEXTURE, 2);
1736 if (n) {
1737 n[1].e = target;
1738 n[2].ui = texture;
1739 }
1740 if (ctx->ExecuteFlag) {
1741 CALL_BindTexture(ctx->Exec, (target, texture));
1742 }
1743 }
1744
1745
1746 static void GLAPIENTRY
1747 save_Bitmap(GLsizei width, GLsizei height,
1748 GLfloat xorig, GLfloat yorig,
1749 GLfloat xmove, GLfloat ymove, const GLubyte * pixels)
1750 {
1751 GET_CURRENT_CONTEXT(ctx);
1752 Node *n;
1753 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1754 n = alloc_instruction(ctx, OPCODE_BITMAP, 6 + POINTER_DWORDS);
1755 if (n) {
1756 n[1].i = (GLint) width;
1757 n[2].i = (GLint) height;
1758 n[3].f = xorig;
1759 n[4].f = yorig;
1760 n[5].f = xmove;
1761 n[6].f = ymove;
1762 save_pointer(&n[7],
1763 unpack_image(ctx, 2, width, height, 1, GL_COLOR_INDEX,
1764 GL_BITMAP, pixels, &ctx->Unpack));
1765 }
1766 if (ctx->ExecuteFlag) {
1767 CALL_Bitmap(ctx->Exec, (width, height,
1768 xorig, yorig, xmove, ymove, pixels));
1769 }
1770 }
1771
1772
1773 static void GLAPIENTRY
1774 save_BlendEquation(GLenum mode)
1775 {
1776 GET_CURRENT_CONTEXT(ctx);
1777 Node *n;
1778 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1779 n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION, 1);
1780 if (n) {
1781 n[1].e = mode;
1782 }
1783 if (ctx->ExecuteFlag) {
1784 CALL_BlendEquation(ctx->Exec, (mode));
1785 }
1786 }
1787
1788
1789 static void GLAPIENTRY
1790 save_BlendEquationSeparateEXT(GLenum modeRGB, GLenum modeA)
1791 {
1792 GET_CURRENT_CONTEXT(ctx);
1793 Node *n;
1794 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1795 n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION_SEPARATE, 2);
1796 if (n) {
1797 n[1].e = modeRGB;
1798 n[2].e = modeA;
1799 }
1800 if (ctx->ExecuteFlag) {
1801 CALL_BlendEquationSeparate(ctx->Exec, (modeRGB, modeA));
1802 }
1803 }
1804
1805
1806 static void GLAPIENTRY
1807 save_BlendFuncSeparateEXT(GLenum sfactorRGB, GLenum dfactorRGB,
1808 GLenum sfactorA, GLenum dfactorA)
1809 {
1810 GET_CURRENT_CONTEXT(ctx);
1811 Node *n;
1812 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1813 n = alloc_instruction(ctx, OPCODE_BLEND_FUNC_SEPARATE, 4);
1814 if (n) {
1815 n[1].e = sfactorRGB;
1816 n[2].e = dfactorRGB;
1817 n[3].e = sfactorA;
1818 n[4].e = dfactorA;
1819 }
1820 if (ctx->ExecuteFlag) {
1821 CALL_BlendFuncSeparate(ctx->Exec,
1822 (sfactorRGB, dfactorRGB, sfactorA, dfactorA));
1823 }
1824 }
1825
1826
1827 static void GLAPIENTRY
1828 save_BlendFunc(GLenum srcfactor, GLenum dstfactor)
1829 {
1830 save_BlendFuncSeparateEXT(srcfactor, dstfactor, srcfactor, dstfactor);
1831 }
1832
1833
1834 static void GLAPIENTRY
1835 save_BlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
1836 {
1837 GET_CURRENT_CONTEXT(ctx);
1838 Node *n;
1839 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1840 n = alloc_instruction(ctx, OPCODE_BLEND_COLOR, 4);
1841 if (n) {
1842 n[1].f = red;
1843 n[2].f = green;
1844 n[3].f = blue;
1845 n[4].f = alpha;
1846 }
1847 if (ctx->ExecuteFlag) {
1848 CALL_BlendColor(ctx->Exec, (red, green, blue, alpha));
1849 }
1850 }
1851
1852 /* GL_ARB_draw_buffers_blend */
1853 static void GLAPIENTRY
1854 save_BlendFuncSeparatei(GLuint buf, GLenum sfactorRGB, GLenum dfactorRGB,
1855 GLenum sfactorA, GLenum dfactorA)
1856 {
1857 GET_CURRENT_CONTEXT(ctx);
1858 Node *n;
1859 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1860 n = alloc_instruction(ctx, OPCODE_BLEND_FUNC_SEPARATE_I, 5);
1861 if (n) {
1862 n[1].ui = buf;
1863 n[2].e = sfactorRGB;
1864 n[3].e = dfactorRGB;
1865 n[4].e = sfactorA;
1866 n[5].e = dfactorA;
1867 }
1868 if (ctx->ExecuteFlag) {
1869 CALL_BlendFuncSeparateiARB(ctx->Exec, (buf, sfactorRGB, dfactorRGB,
1870 sfactorA, dfactorA));
1871 }
1872 }
1873
1874 /* GL_ARB_draw_buffers_blend */
1875 static void GLAPIENTRY
1876 save_BlendFunci(GLuint buf, GLenum sfactor, GLenum dfactor)
1877 {
1878 GET_CURRENT_CONTEXT(ctx);
1879 Node *n;
1880 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1881 n = alloc_instruction(ctx, OPCODE_BLEND_FUNC_I, 3);
1882 if (n) {
1883 n[1].ui = buf;
1884 n[2].e = sfactor;
1885 n[3].e = dfactor;
1886 }
1887 if (ctx->ExecuteFlag) {
1888 CALL_BlendFunciARB(ctx->Exec, (buf, sfactor, dfactor));
1889 }
1890 }
1891
1892 /* GL_ARB_draw_buffers_blend */
1893 static void GLAPIENTRY
1894 save_BlendEquationi(GLuint buf, GLenum mode)
1895 {
1896 GET_CURRENT_CONTEXT(ctx);
1897 Node *n;
1898 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1899 n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION_I, 2);
1900 if (n) {
1901 n[1].ui = buf;
1902 n[2].e = mode;
1903 }
1904 if (ctx->ExecuteFlag) {
1905 CALL_BlendEquationiARB(ctx->Exec, (buf, mode));
1906 }
1907 }
1908
1909 /* GL_ARB_draw_buffers_blend */
1910 static void GLAPIENTRY
1911 save_BlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeA)
1912 {
1913 GET_CURRENT_CONTEXT(ctx);
1914 Node *n;
1915 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1916 n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION_SEPARATE_I, 3);
1917 if (n) {
1918 n[1].ui = buf;
1919 n[2].e = modeRGB;
1920 n[3].e = modeA;
1921 }
1922 if (ctx->ExecuteFlag) {
1923 CALL_BlendEquationSeparateiARB(ctx->Exec, (buf, modeRGB, modeA));
1924 }
1925 }
1926
1927
1928 /* GL_ARB_draw_instanced. */
1929 static void GLAPIENTRY
1930 save_DrawArraysInstancedARB(UNUSED GLenum mode,
1931 UNUSED GLint first,
1932 UNUSED GLsizei count,
1933 UNUSED GLsizei primcount)
1934 {
1935 GET_CURRENT_CONTEXT(ctx);
1936 _mesa_error(ctx, GL_INVALID_OPERATION,
1937 "glDrawArraysInstanced() during display list compile");
1938 }
1939
1940 static void GLAPIENTRY
1941 save_DrawElementsInstancedARB(UNUSED GLenum mode,
1942 UNUSED GLsizei count,
1943 UNUSED GLenum type,
1944 UNUSED const GLvoid *indices,
1945 UNUSED GLsizei primcount)
1946 {
1947 GET_CURRENT_CONTEXT(ctx);
1948 _mesa_error(ctx, GL_INVALID_OPERATION,
1949 "glDrawElementsInstanced() during display list compile");
1950 }
1951
1952 static void GLAPIENTRY
1953 save_DrawElementsInstancedBaseVertexARB(UNUSED GLenum mode,
1954 UNUSED GLsizei count,
1955 UNUSED GLenum type,
1956 UNUSED const GLvoid *indices,
1957 UNUSED GLsizei primcount,
1958 UNUSED GLint basevertex)
1959 {
1960 GET_CURRENT_CONTEXT(ctx);
1961 _mesa_error(ctx, GL_INVALID_OPERATION,
1962 "glDrawElementsInstancedBaseVertex() during display list compile");
1963 }
1964
1965 /* GL_ARB_base_instance. */
1966 static void GLAPIENTRY
1967 save_DrawArraysInstancedBaseInstance(UNUSED GLenum mode,
1968 UNUSED GLint first,
1969 UNUSED GLsizei count,
1970 UNUSED GLsizei primcount,
1971 UNUSED GLuint baseinstance)
1972 {
1973 GET_CURRENT_CONTEXT(ctx);
1974 _mesa_error(ctx, GL_INVALID_OPERATION,
1975 "glDrawArraysInstancedBaseInstance() during display list compile");
1976 }
1977
1978 static void APIENTRY
1979 save_DrawElementsInstancedBaseInstance(UNUSED GLenum mode,
1980 UNUSED GLsizei count,
1981 UNUSED GLenum type,
1982 UNUSED const void *indices,
1983 UNUSED GLsizei primcount,
1984 UNUSED GLuint baseinstance)
1985 {
1986 GET_CURRENT_CONTEXT(ctx);
1987 _mesa_error(ctx, GL_INVALID_OPERATION,
1988 "glDrawElementsInstancedBaseInstance() during display list compile");
1989 }
1990
1991 static void APIENTRY
1992 save_DrawElementsInstancedBaseVertexBaseInstance(UNUSED GLenum mode,
1993 UNUSED GLsizei count,
1994 UNUSED GLenum type,
1995 UNUSED const void *indices,
1996 UNUSED GLsizei primcount,
1997 UNUSED GLint basevertex,
1998 UNUSED GLuint baseinstance)
1999 {
2000 GET_CURRENT_CONTEXT(ctx);
2001 _mesa_error(ctx, GL_INVALID_OPERATION,
2002 "glDrawElementsInstancedBaseVertexBaseInstance() during display list compile");
2003 }
2004
2005 static void APIENTRY
2006 save_DrawArraysIndirect(UNUSED GLenum mode,
2007 UNUSED const void *indirect)
2008 {
2009 GET_CURRENT_CONTEXT(ctx);
2010 _mesa_error(ctx, GL_INVALID_OPERATION,
2011 "glDrawArraysIndirect() during display list compile");
2012 }
2013
2014 static void APIENTRY
2015 save_DrawElementsIndirect(UNUSED GLenum mode,
2016 UNUSED GLenum type,
2017 UNUSED const void *indirect)
2018 {
2019 GET_CURRENT_CONTEXT(ctx);
2020 _mesa_error(ctx, GL_INVALID_OPERATION,
2021 "glDrawElementsIndirect() during display list compile");
2022 }
2023
2024 static void APIENTRY
2025 save_MultiDrawArraysIndirect(UNUSED GLenum mode,
2026 UNUSED const void *indirect,
2027 UNUSED GLsizei primcount,
2028 UNUSED GLsizei stride)
2029 {
2030 GET_CURRENT_CONTEXT(ctx);
2031 _mesa_error(ctx, GL_INVALID_OPERATION,
2032 "glMultiDrawArraysIndirect() during display list compile");
2033 }
2034
2035 static void APIENTRY
2036 save_MultiDrawElementsIndirect(UNUSED GLenum mode,
2037 UNUSED GLenum type,
2038 UNUSED const void *indirect,
2039 UNUSED GLsizei primcount,
2040 UNUSED GLsizei stride)
2041 {
2042 GET_CURRENT_CONTEXT(ctx);
2043 _mesa_error(ctx, GL_INVALID_OPERATION,
2044 "glMultiDrawElementsIndirect() during display list compile");
2045 }
2046
2047 /**
2048 * While building a display list we cache some OpenGL state.
2049 * Under some circumstances we need to invalidate that state (immediately
2050 * when we start compiling a list, or after glCallList(s)).
2051 */
2052 static void
2053 invalidate_saved_current_state(struct gl_context *ctx)
2054 {
2055 GLint i;
2056
2057 for (i = 0; i < VERT_ATTRIB_MAX; i++)
2058 ctx->ListState.ActiveAttribSize[i] = 0;
2059
2060 for (i = 0; i < MAT_ATTRIB_MAX; i++)
2061 ctx->ListState.ActiveMaterialSize[i] = 0;
2062
2063 memset(&ctx->ListState.Current, 0, sizeof ctx->ListState.Current);
2064
2065 ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN;
2066 }
2067
2068
2069 static void GLAPIENTRY
2070 save_CallList(GLuint list)
2071 {
2072 GET_CURRENT_CONTEXT(ctx);
2073 Node *n;
2074 SAVE_FLUSH_VERTICES(ctx);
2075
2076 n = alloc_instruction(ctx, OPCODE_CALL_LIST, 1);
2077 if (n) {
2078 n[1].ui = list;
2079 }
2080
2081 /* After this, we don't know what state we're in. Invalidate all
2082 * cached information previously gathered:
2083 */
2084 invalidate_saved_current_state( ctx );
2085
2086 if (ctx->ExecuteFlag) {
2087 _mesa_CallList(list);
2088 }
2089 }
2090
2091
2092 static void GLAPIENTRY
2093 save_CallLists(GLsizei num, GLenum type, const GLvoid * lists)
2094 {
2095 GET_CURRENT_CONTEXT(ctx);
2096 unsigned type_size;
2097 Node *n;
2098 void *lists_copy;
2099
2100 SAVE_FLUSH_VERTICES(ctx);
2101
2102 switch (type) {
2103 case GL_BYTE:
2104 case GL_UNSIGNED_BYTE:
2105 type_size = 1;
2106 break;
2107 case GL_SHORT:
2108 case GL_UNSIGNED_SHORT:
2109 case GL_2_BYTES:
2110 type_size = 2;
2111 break;
2112 case GL_3_BYTES:
2113 type_size = 3;
2114 break;
2115 case GL_INT:
2116 case GL_UNSIGNED_INT:
2117 case GL_FLOAT:
2118 case GL_4_BYTES:
2119 type_size = 4;
2120 break;
2121 default:
2122 type_size = 0;
2123 }
2124
2125 if (num > 0 && type_size > 0) {
2126 /* create a copy of the array of list IDs to save in the display list */
2127 lists_copy = memdup(lists, num * type_size);
2128 } else {
2129 lists_copy = NULL;
2130 }
2131
2132 n = alloc_instruction(ctx, OPCODE_CALL_LISTS, 2 + POINTER_DWORDS);
2133 if (n) {
2134 n[1].i = num;
2135 n[2].e = type;
2136 save_pointer(&n[3], lists_copy);
2137 }
2138
2139 /* After this, we don't know what state we're in. Invalidate all
2140 * cached information previously gathered:
2141 */
2142 invalidate_saved_current_state( ctx );
2143
2144 if (ctx->ExecuteFlag) {
2145 CALL_CallLists(ctx->Exec, (num, type, lists));
2146 }
2147 }
2148
2149
2150 static void GLAPIENTRY
2151 save_Clear(GLbitfield mask)
2152 {
2153 GET_CURRENT_CONTEXT(ctx);
2154 Node *n;
2155 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2156 n = alloc_instruction(ctx, OPCODE_CLEAR, 1);
2157 if (n) {
2158 n[1].bf = mask;
2159 }
2160 if (ctx->ExecuteFlag) {
2161 CALL_Clear(ctx->Exec, (mask));
2162 }
2163 }
2164
2165
2166 static void GLAPIENTRY
2167 save_ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value)
2168 {
2169 GET_CURRENT_CONTEXT(ctx);
2170 Node *n;
2171 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2172 n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_IV, 6);
2173 if (n) {
2174 n[1].e = buffer;
2175 n[2].i = drawbuffer;
2176 n[3].i = value[0];
2177 if (buffer == GL_COLOR) {
2178 n[4].i = value[1];
2179 n[5].i = value[2];
2180 n[6].i = value[3];
2181 }
2182 else {
2183 n[4].i = 0;
2184 n[5].i = 0;
2185 n[6].i = 0;
2186 }
2187 }
2188 if (ctx->ExecuteFlag) {
2189 CALL_ClearBufferiv(ctx->Exec, (buffer, drawbuffer, value));
2190 }
2191 }
2192
2193
2194 static void GLAPIENTRY
2195 save_ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value)
2196 {
2197 GET_CURRENT_CONTEXT(ctx);
2198 Node *n;
2199 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2200 n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_UIV, 6);
2201 if (n) {
2202 n[1].e = buffer;
2203 n[2].i = drawbuffer;
2204 n[3].ui = value[0];
2205 if (buffer == GL_COLOR) {
2206 n[4].ui = value[1];
2207 n[5].ui = value[2];
2208 n[6].ui = value[3];
2209 }
2210 else {
2211 n[4].ui = 0;
2212 n[5].ui = 0;
2213 n[6].ui = 0;
2214 }
2215 }
2216 if (ctx->ExecuteFlag) {
2217 CALL_ClearBufferuiv(ctx->Exec, (buffer, drawbuffer, value));
2218 }
2219 }
2220
2221
2222 static void GLAPIENTRY
2223 save_ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
2224 {
2225 GET_CURRENT_CONTEXT(ctx);
2226 Node *n;
2227 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2228 n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_FV, 6);
2229 if (n) {
2230 n[1].e = buffer;
2231 n[2].i = drawbuffer;
2232 n[3].f = value[0];
2233 if (buffer == GL_COLOR) {
2234 n[4].f = value[1];
2235 n[5].f = value[2];
2236 n[6].f = value[3];
2237 }
2238 else {
2239 n[4].f = 0.0F;
2240 n[5].f = 0.0F;
2241 n[6].f = 0.0F;
2242 }
2243 }
2244 if (ctx->ExecuteFlag) {
2245 CALL_ClearBufferfv(ctx->Exec, (buffer, drawbuffer, value));
2246 }
2247 }
2248
2249
2250 static void GLAPIENTRY
2251 save_ClearBufferfi(GLenum buffer, GLint drawbuffer,
2252 GLfloat depth, GLint stencil)
2253 {
2254 GET_CURRENT_CONTEXT(ctx);
2255 Node *n;
2256 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2257 n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_FI, 4);
2258 if (n) {
2259 n[1].e = buffer;
2260 n[2].i = drawbuffer;
2261 n[3].f = depth;
2262 n[4].i = stencil;
2263 }
2264 if (ctx->ExecuteFlag) {
2265 CALL_ClearBufferfi(ctx->Exec, (buffer, drawbuffer, depth, stencil));
2266 }
2267 }
2268
2269
2270 static void GLAPIENTRY
2271 save_ClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
2272 {
2273 GET_CURRENT_CONTEXT(ctx);
2274 Node *n;
2275 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2276 n = alloc_instruction(ctx, OPCODE_CLEAR_ACCUM, 4);
2277 if (n) {
2278 n[1].f = red;
2279 n[2].f = green;
2280 n[3].f = blue;
2281 n[4].f = alpha;
2282 }
2283 if (ctx->ExecuteFlag) {
2284 CALL_ClearAccum(ctx->Exec, (red, green, blue, alpha));
2285 }
2286 }
2287
2288
2289 static void GLAPIENTRY
2290 save_ClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
2291 {
2292 GET_CURRENT_CONTEXT(ctx);
2293 Node *n;
2294 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2295 n = alloc_instruction(ctx, OPCODE_CLEAR_COLOR, 4);
2296 if (n) {
2297 n[1].f = red;
2298 n[2].f = green;
2299 n[3].f = blue;
2300 n[4].f = alpha;
2301 }
2302 if (ctx->ExecuteFlag) {
2303 CALL_ClearColor(ctx->Exec, (red, green, blue, alpha));
2304 }
2305 }
2306
2307
2308 static void GLAPIENTRY
2309 save_ClearDepth(GLclampd depth)
2310 {
2311 GET_CURRENT_CONTEXT(ctx);
2312 Node *n;
2313 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2314 n = alloc_instruction(ctx, OPCODE_CLEAR_DEPTH, 1);
2315 if (n) {
2316 n[1].f = (GLfloat) depth;
2317 }
2318 if (ctx->ExecuteFlag) {
2319 CALL_ClearDepth(ctx->Exec, (depth));
2320 }
2321 }
2322
2323
2324 static void GLAPIENTRY
2325 save_ClearIndex(GLfloat c)
2326 {
2327 GET_CURRENT_CONTEXT(ctx);
2328 Node *n;
2329 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2330 n = alloc_instruction(ctx, OPCODE_CLEAR_INDEX, 1);
2331 if (n) {
2332 n[1].f = c;
2333 }
2334 if (ctx->ExecuteFlag) {
2335 CALL_ClearIndex(ctx->Exec, (c));
2336 }
2337 }
2338
2339
2340 static void GLAPIENTRY
2341 save_ClearStencil(GLint s)
2342 {
2343 GET_CURRENT_CONTEXT(ctx);
2344 Node *n;
2345 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2346 n = alloc_instruction(ctx, OPCODE_CLEAR_STENCIL, 1);
2347 if (n) {
2348 n[1].i = s;
2349 }
2350 if (ctx->ExecuteFlag) {
2351 CALL_ClearStencil(ctx->Exec, (s));
2352 }
2353 }
2354
2355
2356 static void GLAPIENTRY
2357 save_ClipPlane(GLenum plane, const GLdouble * equ)
2358 {
2359 GET_CURRENT_CONTEXT(ctx);
2360 Node *n;
2361 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2362 n = alloc_instruction(ctx, OPCODE_CLIP_PLANE, 5);
2363 if (n) {
2364 n[1].e = plane;
2365 n[2].f = (GLfloat) equ[0];
2366 n[3].f = (GLfloat) equ[1];
2367 n[4].f = (GLfloat) equ[2];
2368 n[5].f = (GLfloat) equ[3];
2369 }
2370 if (ctx->ExecuteFlag) {
2371 CALL_ClipPlane(ctx->Exec, (plane, equ));
2372 }
2373 }
2374
2375
2376
2377 static void GLAPIENTRY
2378 save_ColorMask(GLboolean red, GLboolean green,
2379 GLboolean blue, GLboolean alpha)
2380 {
2381 GET_CURRENT_CONTEXT(ctx);
2382 Node *n;
2383 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2384 n = alloc_instruction(ctx, OPCODE_COLOR_MASK, 4);
2385 if (n) {
2386 n[1].b = red;
2387 n[2].b = green;
2388 n[3].b = blue;
2389 n[4].b = alpha;
2390 }
2391 if (ctx->ExecuteFlag) {
2392 CALL_ColorMask(ctx->Exec, (red, green, blue, alpha));
2393 }
2394 }
2395
2396
2397 static void GLAPIENTRY
2398 save_ColorMaskIndexed(GLuint buf, GLboolean red, GLboolean green,
2399 GLboolean blue, GLboolean alpha)
2400 {
2401 GET_CURRENT_CONTEXT(ctx);
2402 Node *n;
2403 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2404 n = alloc_instruction(ctx, OPCODE_COLOR_MASK_INDEXED, 5);
2405 if (n) {
2406 n[1].ui = buf;
2407 n[2].b = red;
2408 n[3].b = green;
2409 n[4].b = blue;
2410 n[5].b = alpha;
2411 }
2412 if (ctx->ExecuteFlag) {
2413 /*CALL_ColorMaski(ctx->Exec, (buf, red, green, blue, alpha));*/
2414 }
2415 }
2416
2417
2418 static void GLAPIENTRY
2419 save_ColorMaterial(GLenum face, GLenum mode)
2420 {
2421 GET_CURRENT_CONTEXT(ctx);
2422 Node *n;
2423 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2424
2425 n = alloc_instruction(ctx, OPCODE_COLOR_MATERIAL, 2);
2426 if (n) {
2427 n[1].e = face;
2428 n[2].e = mode;
2429 }
2430 if (ctx->ExecuteFlag) {
2431 CALL_ColorMaterial(ctx->Exec, (face, mode));
2432 }
2433 }
2434
2435
2436 static void GLAPIENTRY
2437 save_CopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type)
2438 {
2439 GET_CURRENT_CONTEXT(ctx);
2440 Node *n;
2441 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2442 n = alloc_instruction(ctx, OPCODE_COPY_PIXELS, 5);
2443 if (n) {
2444 n[1].i = x;
2445 n[2].i = y;
2446 n[3].i = (GLint) width;
2447 n[4].i = (GLint) height;
2448 n[5].e = type;
2449 }
2450 if (ctx->ExecuteFlag) {
2451 CALL_CopyPixels(ctx->Exec, (x, y, width, height, type));
2452 }
2453 }
2454
2455
2456
2457 static void GLAPIENTRY
2458 save_CopyTexImage1D(GLenum target, GLint level, GLenum internalformat,
2459 GLint x, GLint y, GLsizei width, GLint border)
2460 {
2461 GET_CURRENT_CONTEXT(ctx);
2462 Node *n;
2463 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2464 n = alloc_instruction(ctx, OPCODE_COPY_TEX_IMAGE1D, 7);
2465 if (n) {
2466 n[1].e = target;
2467 n[2].i = level;
2468 n[3].e = internalformat;
2469 n[4].i = x;
2470 n[5].i = y;
2471 n[6].i = width;
2472 n[7].i = border;
2473 }
2474 if (ctx->ExecuteFlag) {
2475 CALL_CopyTexImage1D(ctx->Exec, (target, level, internalformat,
2476 x, y, width, border));
2477 }
2478 }
2479
2480
2481 static void GLAPIENTRY
2482 save_CopyTexImage2D(GLenum target, GLint level,
2483 GLenum internalformat,
2484 GLint x, GLint y, GLsizei width,
2485 GLsizei height, GLint border)
2486 {
2487 GET_CURRENT_CONTEXT(ctx);
2488 Node *n;
2489 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2490 n = alloc_instruction(ctx, OPCODE_COPY_TEX_IMAGE2D, 8);
2491 if (n) {
2492 n[1].e = target;
2493 n[2].i = level;
2494 n[3].e = internalformat;
2495 n[4].i = x;
2496 n[5].i = y;
2497 n[6].i = width;
2498 n[7].i = height;
2499 n[8].i = border;
2500 }
2501 if (ctx->ExecuteFlag) {
2502 CALL_CopyTexImage2D(ctx->Exec, (target, level, internalformat,
2503 x, y, width, height, border));
2504 }
2505 }
2506
2507
2508
2509 static void GLAPIENTRY
2510 save_CopyTexSubImage1D(GLenum target, GLint level,
2511 GLint xoffset, GLint x, GLint y, GLsizei width)
2512 {
2513 GET_CURRENT_CONTEXT(ctx);
2514 Node *n;
2515 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2516 n = alloc_instruction(ctx, OPCODE_COPY_TEX_SUB_IMAGE1D, 6);
2517 if (n) {
2518 n[1].e = target;
2519 n[2].i = level;
2520 n[3].i = xoffset;
2521 n[4].i = x;
2522 n[5].i = y;
2523 n[6].i = width;
2524 }
2525 if (ctx->ExecuteFlag) {
2526 CALL_CopyTexSubImage1D(ctx->Exec,
2527 (target, level, xoffset, x, y, width));
2528 }
2529 }
2530
2531
2532 static void GLAPIENTRY
2533 save_CopyTexSubImage2D(GLenum target, GLint level,
2534 GLint xoffset, GLint yoffset,
2535 GLint x, GLint y, GLsizei width, GLint height)
2536 {
2537 GET_CURRENT_CONTEXT(ctx);
2538 Node *n;
2539 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2540 n = alloc_instruction(ctx, OPCODE_COPY_TEX_SUB_IMAGE2D, 8);
2541 if (n) {
2542 n[1].e = target;
2543 n[2].i = level;
2544 n[3].i = xoffset;
2545 n[4].i = yoffset;
2546 n[5].i = x;
2547 n[6].i = y;
2548 n[7].i = width;
2549 n[8].i = height;
2550 }
2551 if (ctx->ExecuteFlag) {
2552 CALL_CopyTexSubImage2D(ctx->Exec, (target, level, xoffset, yoffset,
2553 x, y, width, height));
2554 }
2555 }
2556
2557
2558 static void GLAPIENTRY
2559 save_CopyTexSubImage3D(GLenum target, GLint level,
2560 GLint xoffset, GLint yoffset, GLint zoffset,
2561 GLint x, GLint y, GLsizei width, GLint height)
2562 {
2563 GET_CURRENT_CONTEXT(ctx);
2564 Node *n;
2565 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2566 n = alloc_instruction(ctx, OPCODE_COPY_TEX_SUB_IMAGE3D, 9);
2567 if (n) {
2568 n[1].e = target;
2569 n[2].i = level;
2570 n[3].i = xoffset;
2571 n[4].i = yoffset;
2572 n[5].i = zoffset;
2573 n[6].i = x;
2574 n[7].i = y;
2575 n[8].i = width;
2576 n[9].i = height;
2577 }
2578 if (ctx->ExecuteFlag) {
2579 CALL_CopyTexSubImage3D(ctx->Exec, (target, level,
2580 xoffset, yoffset, zoffset,
2581 x, y, width, height));
2582 }
2583 }
2584
2585
2586 static void GLAPIENTRY
2587 save_CullFace(GLenum mode)
2588 {
2589 GET_CURRENT_CONTEXT(ctx);
2590 Node *n;
2591 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2592 n = alloc_instruction(ctx, OPCODE_CULL_FACE, 1);
2593 if (n) {
2594 n[1].e = mode;
2595 }
2596 if (ctx->ExecuteFlag) {
2597 CALL_CullFace(ctx->Exec, (mode));
2598 }
2599 }
2600
2601
2602 static void GLAPIENTRY
2603 save_DepthFunc(GLenum func)
2604 {
2605 GET_CURRENT_CONTEXT(ctx);
2606 Node *n;
2607 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2608 n = alloc_instruction(ctx, OPCODE_DEPTH_FUNC, 1);
2609 if (n) {
2610 n[1].e = func;
2611 }
2612 if (ctx->ExecuteFlag) {
2613 CALL_DepthFunc(ctx->Exec, (func));
2614 }
2615 }
2616
2617
2618 static void GLAPIENTRY
2619 save_DepthMask(GLboolean mask)
2620 {
2621 GET_CURRENT_CONTEXT(ctx);
2622 Node *n;
2623 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2624 n = alloc_instruction(ctx, OPCODE_DEPTH_MASK, 1);
2625 if (n) {
2626 n[1].b = mask;
2627 }
2628 if (ctx->ExecuteFlag) {
2629 CALL_DepthMask(ctx->Exec, (mask));
2630 }
2631 }
2632
2633
2634 static void GLAPIENTRY
2635 save_DepthRange(GLclampd nearval, GLclampd farval)
2636 {
2637 GET_CURRENT_CONTEXT(ctx);
2638 Node *n;
2639 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2640 n = alloc_instruction(ctx, OPCODE_DEPTH_RANGE, 2);
2641 if (n) {
2642 n[1].f = (GLfloat) nearval;
2643 n[2].f = (GLfloat) farval;
2644 }
2645 if (ctx->ExecuteFlag) {
2646 CALL_DepthRange(ctx->Exec, (nearval, farval));
2647 }
2648 }
2649
2650
2651 static void GLAPIENTRY
2652 save_Disable(GLenum cap)
2653 {
2654 GET_CURRENT_CONTEXT(ctx);
2655 Node *n;
2656 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2657 n = alloc_instruction(ctx, OPCODE_DISABLE, 1);
2658 if (n) {
2659 n[1].e = cap;
2660 }
2661 if (ctx->ExecuteFlag) {
2662 CALL_Disable(ctx->Exec, (cap));
2663 }
2664 }
2665
2666
2667 static void GLAPIENTRY
2668 save_DisableIndexed(GLuint index, GLenum cap)
2669 {
2670 GET_CURRENT_CONTEXT(ctx);
2671 Node *n;
2672 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2673 n = alloc_instruction(ctx, OPCODE_DISABLE_INDEXED, 2);
2674 if (n) {
2675 n[1].ui = index;
2676 n[2].e = cap;
2677 }
2678 if (ctx->ExecuteFlag) {
2679 CALL_Disablei(ctx->Exec, (index, cap));
2680 }
2681 }
2682
2683
2684 static void GLAPIENTRY
2685 save_DrawBuffer(GLenum mode)
2686 {
2687 GET_CURRENT_CONTEXT(ctx);
2688 Node *n;
2689 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2690 n = alloc_instruction(ctx, OPCODE_DRAW_BUFFER, 1);
2691 if (n) {
2692 n[1].e = mode;
2693 }
2694 if (ctx->ExecuteFlag) {
2695 CALL_DrawBuffer(ctx->Exec, (mode));
2696 }
2697 }
2698
2699
2700 static void GLAPIENTRY
2701 save_DrawPixels(GLsizei width, GLsizei height,
2702 GLenum format, GLenum type, const GLvoid * pixels)
2703 {
2704 GET_CURRENT_CONTEXT(ctx);
2705 Node *n;
2706
2707 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2708
2709 n = alloc_instruction(ctx, OPCODE_DRAW_PIXELS, 4 + POINTER_DWORDS);
2710 if (n) {
2711 n[1].i = width;
2712 n[2].i = height;
2713 n[3].e = format;
2714 n[4].e = type;
2715 save_pointer(&n[5],
2716 unpack_image(ctx, 2, width, height, 1, format, type,
2717 pixels, &ctx->Unpack));
2718 }
2719 if (ctx->ExecuteFlag) {
2720 CALL_DrawPixels(ctx->Exec, (width, height, format, type, pixels));
2721 }
2722 }
2723
2724
2725
2726 static void GLAPIENTRY
2727 save_Enable(GLenum cap)
2728 {
2729 GET_CURRENT_CONTEXT(ctx);
2730 Node *n;
2731 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2732 n = alloc_instruction(ctx, OPCODE_ENABLE, 1);
2733 if (n) {
2734 n[1].e = cap;
2735 }
2736 if (ctx->ExecuteFlag) {
2737 CALL_Enable(ctx->Exec, (cap));
2738 }
2739 }
2740
2741
2742
2743 static void GLAPIENTRY
2744 save_EnableIndexed(GLuint index, GLenum cap)
2745 {
2746 GET_CURRENT_CONTEXT(ctx);
2747 Node *n;
2748 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2749 n = alloc_instruction(ctx, OPCODE_ENABLE_INDEXED, 2);
2750 if (n) {
2751 n[1].ui = index;
2752 n[2].e = cap;
2753 }
2754 if (ctx->ExecuteFlag) {
2755 CALL_Enablei(ctx->Exec, (index, cap));
2756 }
2757 }
2758
2759
2760
2761 static void GLAPIENTRY
2762 save_EvalMesh1(GLenum mode, GLint i1, GLint i2)
2763 {
2764 GET_CURRENT_CONTEXT(ctx);
2765 Node *n;
2766 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2767 n = alloc_instruction(ctx, OPCODE_EVALMESH1, 3);
2768 if (n) {
2769 n[1].e = mode;
2770 n[2].i = i1;
2771 n[3].i = i2;
2772 }
2773 if (ctx->ExecuteFlag) {
2774 CALL_EvalMesh1(ctx->Exec, (mode, i1, i2));
2775 }
2776 }
2777
2778
2779 static void GLAPIENTRY
2780 save_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)
2781 {
2782 GET_CURRENT_CONTEXT(ctx);
2783 Node *n;
2784 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2785 n = alloc_instruction(ctx, OPCODE_EVALMESH2, 5);
2786 if (n) {
2787 n[1].e = mode;
2788 n[2].i = i1;
2789 n[3].i = i2;
2790 n[4].i = j1;
2791 n[5].i = j2;
2792 }
2793 if (ctx->ExecuteFlag) {
2794 CALL_EvalMesh2(ctx->Exec, (mode, i1, i2, j1, j2));
2795 }
2796 }
2797
2798
2799
2800
2801 static void GLAPIENTRY
2802 save_Fogfv(GLenum pname, const GLfloat *params)
2803 {
2804 GET_CURRENT_CONTEXT(ctx);
2805 Node *n;
2806 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2807 n = alloc_instruction(ctx, OPCODE_FOG, 5);
2808 if (n) {
2809 n[1].e = pname;
2810 n[2].f = params[0];
2811 n[3].f = params[1];
2812 n[4].f = params[2];
2813 n[5].f = params[3];
2814 }
2815 if (ctx->ExecuteFlag) {
2816 CALL_Fogfv(ctx->Exec, (pname, params));
2817 }
2818 }
2819
2820
2821 static void GLAPIENTRY
2822 save_Fogf(GLenum pname, GLfloat param)
2823 {
2824 GLfloat parray[4];
2825 parray[0] = param;
2826 parray[1] = parray[2] = parray[3] = 0.0F;
2827 save_Fogfv(pname, parray);
2828 }
2829
2830
2831 static void GLAPIENTRY
2832 save_Fogiv(GLenum pname, const GLint *params)
2833 {
2834 GLfloat p[4];
2835 switch (pname) {
2836 case GL_FOG_MODE:
2837 case GL_FOG_DENSITY:
2838 case GL_FOG_START:
2839 case GL_FOG_END:
2840 case GL_FOG_INDEX:
2841 case GL_FOG_COORDINATE_SOURCE:
2842 p[0] = (GLfloat) *params;
2843 p[1] = 0.0f;
2844 p[2] = 0.0f;
2845 p[3] = 0.0f;
2846 break;
2847 case GL_FOG_COLOR:
2848 p[0] = INT_TO_FLOAT(params[0]);
2849 p[1] = INT_TO_FLOAT(params[1]);
2850 p[2] = INT_TO_FLOAT(params[2]);
2851 p[3] = INT_TO_FLOAT(params[3]);
2852 break;
2853 default:
2854 /* Error will be caught later in gl_Fogfv */
2855 ASSIGN_4V(p, 0.0F, 0.0F, 0.0F, 0.0F);
2856 }
2857 save_Fogfv(pname, p);
2858 }
2859
2860
2861 static void GLAPIENTRY
2862 save_Fogi(GLenum pname, GLint param)
2863 {
2864 GLint parray[4];
2865 parray[0] = param;
2866 parray[1] = parray[2] = parray[3] = 0;
2867 save_Fogiv(pname, parray);
2868 }
2869
2870
2871 static void GLAPIENTRY
2872 save_FrontFace(GLenum mode)
2873 {
2874 GET_CURRENT_CONTEXT(ctx);
2875 Node *n;
2876 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2877 n = alloc_instruction(ctx, OPCODE_FRONT_FACE, 1);
2878 if (n) {
2879 n[1].e = mode;
2880 }
2881 if (ctx->ExecuteFlag) {
2882 CALL_FrontFace(ctx->Exec, (mode));
2883 }
2884 }
2885
2886
2887 static void GLAPIENTRY
2888 save_Frustum(GLdouble left, GLdouble right,
2889 GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval)
2890 {
2891 GET_CURRENT_CONTEXT(ctx);
2892 Node *n;
2893 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2894 n = alloc_instruction(ctx, OPCODE_FRUSTUM, 6);
2895 if (n) {
2896 n[1].f = (GLfloat) left;
2897 n[2].f = (GLfloat) right;
2898 n[3].f = (GLfloat) bottom;
2899 n[4].f = (GLfloat) top;
2900 n[5].f = (GLfloat) nearval;
2901 n[6].f = (GLfloat) farval;
2902 }
2903 if (ctx->ExecuteFlag) {
2904 CALL_Frustum(ctx->Exec, (left, right, bottom, top, nearval, farval));
2905 }
2906 }
2907
2908
2909 static void GLAPIENTRY
2910 save_Hint(GLenum target, GLenum mode)
2911 {
2912 GET_CURRENT_CONTEXT(ctx);
2913 Node *n;
2914 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2915 n = alloc_instruction(ctx, OPCODE_HINT, 2);
2916 if (n) {
2917 n[1].e = target;
2918 n[2].e = mode;
2919 }
2920 if (ctx->ExecuteFlag) {
2921 CALL_Hint(ctx->Exec, (target, mode));
2922 }
2923 }
2924
2925
2926 static void GLAPIENTRY
2927 save_IndexMask(GLuint mask)
2928 {
2929 GET_CURRENT_CONTEXT(ctx);
2930 Node *n;
2931 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2932 n = alloc_instruction(ctx, OPCODE_INDEX_MASK, 1);
2933 if (n) {
2934 n[1].ui = mask;
2935 }
2936 if (ctx->ExecuteFlag) {
2937 CALL_IndexMask(ctx->Exec, (mask));
2938 }
2939 }
2940
2941
2942 static void GLAPIENTRY
2943 save_InitNames(void)
2944 {
2945 GET_CURRENT_CONTEXT(ctx);
2946 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2947 (void) alloc_instruction(ctx, OPCODE_INIT_NAMES, 0);
2948 if (ctx->ExecuteFlag) {
2949 CALL_InitNames(ctx->Exec, ());
2950 }
2951 }
2952
2953
2954 static void GLAPIENTRY
2955 save_Lightfv(GLenum light, GLenum pname, const GLfloat *params)
2956 {
2957 GET_CURRENT_CONTEXT(ctx);
2958 Node *n;
2959 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2960 n = alloc_instruction(ctx, OPCODE_LIGHT, 6);
2961 if (n) {
2962 GLint i, nParams;
2963 n[1].e = light;
2964 n[2].e = pname;
2965 switch (pname) {
2966 case GL_AMBIENT:
2967 nParams = 4;
2968 break;
2969 case GL_DIFFUSE:
2970 nParams = 4;
2971 break;
2972 case GL_SPECULAR:
2973 nParams = 4;
2974 break;
2975 case GL_POSITION:
2976 nParams = 4;
2977 break;
2978 case GL_SPOT_DIRECTION:
2979 nParams = 3;
2980 break;
2981 case GL_SPOT_EXPONENT:
2982 nParams = 1;
2983 break;
2984 case GL_SPOT_CUTOFF:
2985 nParams = 1;
2986 break;
2987 case GL_CONSTANT_ATTENUATION:
2988 nParams = 1;
2989 break;
2990 case GL_LINEAR_ATTENUATION:
2991 nParams = 1;
2992 break;
2993 case GL_QUADRATIC_ATTENUATION:
2994 nParams = 1;
2995 break;
2996 default:
2997 nParams = 0;
2998 }
2999 for (i = 0; i < nParams; i++) {
3000 n[3 + i].f = params[i];
3001 }
3002 }
3003 if (ctx->ExecuteFlag) {
3004 CALL_Lightfv(ctx->Exec, (light, pname, params));
3005 }
3006 }
3007
3008
3009 static void GLAPIENTRY
3010 save_Lightf(GLenum light, GLenum pname, GLfloat param)
3011 {
3012 GLfloat parray[4];
3013 parray[0] = param;
3014 parray[1] = parray[2] = parray[3] = 0.0F;
3015 save_Lightfv(light, pname, parray);
3016 }
3017
3018
3019 static void GLAPIENTRY
3020 save_Lightiv(GLenum light, GLenum pname, const GLint *params)
3021 {
3022 GLfloat fparam[4];
3023 switch (pname) {
3024 case GL_AMBIENT:
3025 case GL_DIFFUSE:
3026 case GL_SPECULAR:
3027 fparam[0] = INT_TO_FLOAT(params[0]);
3028 fparam[1] = INT_TO_FLOAT(params[1]);
3029 fparam[2] = INT_TO_FLOAT(params[2]);
3030 fparam[3] = INT_TO_FLOAT(params[3]);
3031 break;
3032 case GL_POSITION:
3033 fparam[0] = (GLfloat) params[0];
3034 fparam[1] = (GLfloat) params[1];
3035 fparam[2] = (GLfloat) params[2];
3036 fparam[3] = (GLfloat) params[3];
3037 break;
3038 case GL_SPOT_DIRECTION:
3039 fparam[0] = (GLfloat) params[0];
3040 fparam[1] = (GLfloat) params[1];
3041 fparam[2] = (GLfloat) params[2];
3042 break;
3043 case GL_SPOT_EXPONENT:
3044 case GL_SPOT_CUTOFF:
3045 case GL_CONSTANT_ATTENUATION:
3046 case GL_LINEAR_ATTENUATION:
3047 case GL_QUADRATIC_ATTENUATION:
3048 fparam[0] = (GLfloat) params[0];
3049 break;
3050 default:
3051 /* error will be caught later in gl_Lightfv */
3052 ;
3053 }
3054 save_Lightfv(light, pname, fparam);
3055 }
3056
3057
3058 static void GLAPIENTRY
3059 save_Lighti(GLenum light, GLenum pname, GLint param)
3060 {
3061 GLint parray[4];
3062 parray[0] = param;
3063 parray[1] = parray[2] = parray[3] = 0;
3064 save_Lightiv(light, pname, parray);
3065 }
3066
3067
3068 static void GLAPIENTRY
3069 save_LightModelfv(GLenum pname, const GLfloat *params)
3070 {
3071 GET_CURRENT_CONTEXT(ctx);
3072 Node *n;
3073 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3074 n = alloc_instruction(ctx, OPCODE_LIGHT_MODEL, 5);
3075 if (n) {
3076 n[1].e = pname;
3077 n[2].f = params[0];
3078 n[3].f = params[1];
3079 n[4].f = params[2];
3080 n[5].f = params[3];
3081 }
3082 if (ctx->ExecuteFlag) {
3083 CALL_LightModelfv(ctx->Exec, (pname, params));
3084 }
3085 }
3086
3087
3088 static void GLAPIENTRY
3089 save_LightModelf(GLenum pname, GLfloat param)
3090 {
3091 GLfloat parray[4];
3092 parray[0] = param;
3093 parray[1] = parray[2] = parray[3] = 0.0F;
3094 save_LightModelfv(pname, parray);
3095 }
3096
3097
3098 static void GLAPIENTRY
3099 save_LightModeliv(GLenum pname, const GLint *params)
3100 {
3101 GLfloat fparam[4];
3102 switch (pname) {
3103 case GL_LIGHT_MODEL_AMBIENT:
3104 fparam[0] = INT_TO_FLOAT(params[0]);
3105 fparam[1] = INT_TO_FLOAT(params[1]);
3106 fparam[2] = INT_TO_FLOAT(params[2]);
3107 fparam[3] = INT_TO_FLOAT(params[3]);
3108 break;
3109 case GL_LIGHT_MODEL_LOCAL_VIEWER:
3110 case GL_LIGHT_MODEL_TWO_SIDE:
3111 case GL_LIGHT_MODEL_COLOR_CONTROL:
3112 fparam[0] = (GLfloat) params[0];
3113 fparam[1] = 0.0F;
3114 fparam[2] = 0.0F;
3115 fparam[3] = 0.0F;
3116 break;
3117 default:
3118 /* Error will be caught later in gl_LightModelfv */
3119 ASSIGN_4V(fparam, 0.0F, 0.0F, 0.0F, 0.0F);
3120 }
3121 save_LightModelfv(pname, fparam);
3122 }
3123
3124
3125 static void GLAPIENTRY
3126 save_LightModeli(GLenum pname, GLint param)
3127 {
3128 GLint parray[4];
3129 parray[0] = param;
3130 parray[1] = parray[2] = parray[3] = 0;
3131 save_LightModeliv(pname, parray);
3132 }
3133
3134
3135 static void GLAPIENTRY
3136 save_LineStipple(GLint factor, GLushort pattern)
3137 {
3138 GET_CURRENT_CONTEXT(ctx);
3139 Node *n;
3140 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3141 n = alloc_instruction(ctx, OPCODE_LINE_STIPPLE, 2);
3142 if (n) {
3143 n[1].i = factor;
3144 n[2].us = pattern;
3145 }
3146 if (ctx->ExecuteFlag) {
3147 CALL_LineStipple(ctx->Exec, (factor, pattern));
3148 }
3149 }
3150
3151
3152 static void GLAPIENTRY
3153 save_LineWidth(GLfloat width)
3154 {
3155 GET_CURRENT_CONTEXT(ctx);
3156 Node *n;
3157 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3158 n = alloc_instruction(ctx, OPCODE_LINE_WIDTH, 1);
3159 if (n) {
3160 n[1].f = width;
3161 }
3162 if (ctx->ExecuteFlag) {
3163 CALL_LineWidth(ctx->Exec, (width));
3164 }
3165 }
3166
3167
3168 static void GLAPIENTRY
3169 save_ListBase(GLuint base)
3170 {
3171 GET_CURRENT_CONTEXT(ctx);
3172 Node *n;
3173 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3174 n = alloc_instruction(ctx, OPCODE_LIST_BASE, 1);
3175 if (n) {
3176 n[1].ui = base;
3177 }
3178 if (ctx->ExecuteFlag) {
3179 CALL_ListBase(ctx->Exec, (base));
3180 }
3181 }
3182
3183
3184 static void GLAPIENTRY
3185 save_LoadIdentity(void)
3186 {
3187 GET_CURRENT_CONTEXT(ctx);
3188 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3189 (void) alloc_instruction(ctx, OPCODE_LOAD_IDENTITY, 0);
3190 if (ctx->ExecuteFlag) {
3191 CALL_LoadIdentity(ctx->Exec, ());
3192 }
3193 }
3194
3195
3196 static void GLAPIENTRY
3197 save_LoadMatrixf(const GLfloat * m)
3198 {
3199 GET_CURRENT_CONTEXT(ctx);
3200 Node *n;
3201 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3202 n = alloc_instruction(ctx, OPCODE_LOAD_MATRIX, 16);
3203 if (n) {
3204 GLuint i;
3205 for (i = 0; i < 16; i++) {
3206 n[1 + i].f = m[i];
3207 }
3208 }
3209 if (ctx->ExecuteFlag) {
3210 CALL_LoadMatrixf(ctx->Exec, (m));
3211 }
3212 }
3213
3214
3215 static void GLAPIENTRY
3216 save_LoadMatrixd(const GLdouble * m)
3217 {
3218 GLfloat f[16];
3219 GLint i;
3220 for (i = 0; i < 16; i++) {
3221 f[i] = (GLfloat) m[i];
3222 }
3223 save_LoadMatrixf(f);
3224 }
3225
3226
3227 static void GLAPIENTRY
3228 save_LoadName(GLuint name)
3229 {
3230 GET_CURRENT_CONTEXT(ctx);
3231 Node *n;
3232 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3233 n = alloc_instruction(ctx, OPCODE_LOAD_NAME, 1);
3234 if (n) {
3235 n[1].ui = name;
3236 }
3237 if (ctx->ExecuteFlag) {
3238 CALL_LoadName(ctx->Exec, (name));
3239 }
3240 }
3241
3242
3243 static void GLAPIENTRY
3244 save_LogicOp(GLenum opcode)
3245 {
3246 GET_CURRENT_CONTEXT(ctx);
3247 Node *n;
3248 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3249 n = alloc_instruction(ctx, OPCODE_LOGIC_OP, 1);
3250 if (n) {
3251 n[1].e = opcode;
3252 }
3253 if (ctx->ExecuteFlag) {
3254 CALL_LogicOp(ctx->Exec, (opcode));
3255 }
3256 }
3257
3258
3259 static void GLAPIENTRY
3260 save_Map1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride,
3261 GLint order, const GLdouble * points)
3262 {
3263 GET_CURRENT_CONTEXT(ctx);
3264 Node *n;
3265 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3266 n = alloc_instruction(ctx, OPCODE_MAP1, 5 + POINTER_DWORDS);
3267 if (n) {
3268 GLfloat *pnts = _mesa_copy_map_points1d(target, stride, order, points);
3269 n[1].e = target;
3270 n[2].f = (GLfloat) u1;
3271 n[3].f = (GLfloat) u2;
3272 n[4].i = _mesa_evaluator_components(target); /* stride */
3273 n[5].i = order;
3274 save_pointer(&n[6], pnts);
3275 }
3276 if (ctx->ExecuteFlag) {
3277 CALL_Map1d(ctx->Exec, (target, u1, u2, stride, order, points));
3278 }
3279 }
3280
3281 static void GLAPIENTRY
3282 save_Map1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride,
3283 GLint order, const GLfloat * points)
3284 {
3285 GET_CURRENT_CONTEXT(ctx);
3286 Node *n;
3287 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3288 n = alloc_instruction(ctx, OPCODE_MAP1, 5 + POINTER_DWORDS);
3289 if (n) {
3290 GLfloat *pnts = _mesa_copy_map_points1f(target, stride, order, points);
3291 n[1].e = target;
3292 n[2].f = u1;
3293 n[3].f = u2;
3294 n[4].i = _mesa_evaluator_components(target); /* stride */
3295 n[5].i = order;
3296 save_pointer(&n[6], pnts);
3297 }
3298 if (ctx->ExecuteFlag) {
3299 CALL_Map1f(ctx->Exec, (target, u1, u2, stride, order, points));
3300 }
3301 }
3302
3303
3304 static void GLAPIENTRY
3305 save_Map2d(GLenum target,
3306 GLdouble u1, GLdouble u2, GLint ustride, GLint uorder,
3307 GLdouble v1, GLdouble v2, GLint vstride, GLint vorder,
3308 const GLdouble * points)
3309 {
3310 GET_CURRENT_CONTEXT(ctx);
3311 Node *n;
3312 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3313 n = alloc_instruction(ctx, OPCODE_MAP2, 9 + POINTER_DWORDS);
3314 if (n) {
3315 GLfloat *pnts = _mesa_copy_map_points2d(target, ustride, uorder,
3316 vstride, vorder, points);
3317 n[1].e = target;
3318 n[2].f = (GLfloat) u1;
3319 n[3].f = (GLfloat) u2;
3320 n[4].f = (GLfloat) v1;
3321 n[5].f = (GLfloat) v2;
3322 /* XXX verify these strides are correct */
3323 n[6].i = _mesa_evaluator_components(target) * vorder; /*ustride */
3324 n[7].i = _mesa_evaluator_components(target); /*vstride */
3325 n[8].i = uorder;
3326 n[9].i = vorder;
3327 save_pointer(&n[10], pnts);
3328 }
3329 if (ctx->ExecuteFlag) {
3330 CALL_Map2d(ctx->Exec, (target,
3331 u1, u2, ustride, uorder,
3332 v1, v2, vstride, vorder, points));
3333 }
3334 }
3335
3336
3337 static void GLAPIENTRY
3338 save_Map2f(GLenum target,
3339 GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
3340 GLfloat v1, GLfloat v2, GLint vstride, GLint vorder,
3341 const GLfloat * points)
3342 {
3343 GET_CURRENT_CONTEXT(ctx);
3344 Node *n;
3345 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3346 n = alloc_instruction(ctx, OPCODE_MAP2, 9 + POINTER_DWORDS);
3347 if (n) {
3348 GLfloat *pnts = _mesa_copy_map_points2f(target, ustride, uorder,
3349 vstride, vorder, points);
3350 n[1].e = target;
3351 n[2].f = u1;
3352 n[3].f = u2;
3353 n[4].f = v1;
3354 n[5].f = v2;
3355 /* XXX verify these strides are correct */
3356 n[6].i = _mesa_evaluator_components(target) * vorder; /*ustride */
3357 n[7].i = _mesa_evaluator_components(target); /*vstride */
3358 n[8].i = uorder;
3359 n[9].i = vorder;
3360 save_pointer(&n[10], pnts);
3361 }
3362 if (ctx->ExecuteFlag) {
3363 CALL_Map2f(ctx->Exec, (target, u1, u2, ustride, uorder,
3364 v1, v2, vstride, vorder, points));
3365 }
3366 }
3367
3368
3369 static void GLAPIENTRY
3370 save_MapGrid1f(GLint un, GLfloat u1, GLfloat u2)
3371 {
3372 GET_CURRENT_CONTEXT(ctx);
3373 Node *n;
3374 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3375 n = alloc_instruction(ctx, OPCODE_MAPGRID1, 3);
3376 if (n) {
3377 n[1].i = un;
3378 n[2].f = u1;
3379 n[3].f = u2;
3380 }
3381 if (ctx->ExecuteFlag) {
3382 CALL_MapGrid1f(ctx->Exec, (un, u1, u2));
3383 }
3384 }
3385
3386
3387 static void GLAPIENTRY
3388 save_MapGrid1d(GLint un, GLdouble u1, GLdouble u2)
3389 {
3390 save_MapGrid1f(un, (GLfloat) u1, (GLfloat) u2);
3391 }
3392
3393
3394 static void GLAPIENTRY
3395 save_MapGrid2f(GLint un, GLfloat u1, GLfloat u2,
3396 GLint vn, GLfloat v1, GLfloat v2)
3397 {
3398 GET_CURRENT_CONTEXT(ctx);
3399 Node *n;
3400 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3401 n = alloc_instruction(ctx, OPCODE_MAPGRID2, 6);
3402 if (n) {
3403 n[1].i = un;
3404 n[2].f = u1;
3405 n[3].f = u2;
3406 n[4].i = vn;
3407 n[5].f = v1;
3408 n[6].f = v2;
3409 }
3410 if (ctx->ExecuteFlag) {
3411 CALL_MapGrid2f(ctx->Exec, (un, u1, u2, vn, v1, v2));
3412 }
3413 }
3414
3415
3416
3417 static void GLAPIENTRY
3418 save_MapGrid2d(GLint un, GLdouble u1, GLdouble u2,
3419 GLint vn, GLdouble v1, GLdouble v2)
3420 {
3421 save_MapGrid2f(un, (GLfloat) u1, (GLfloat) u2,
3422 vn, (GLfloat) v1, (GLfloat) v2);
3423 }
3424
3425
3426 static void GLAPIENTRY
3427 save_MatrixMode(GLenum mode)
3428 {
3429 GET_CURRENT_CONTEXT(ctx);
3430 Node *n;
3431 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3432 n = alloc_instruction(ctx, OPCODE_MATRIX_MODE, 1);
3433 if (n) {
3434 n[1].e = mode;
3435 }
3436 if (ctx->ExecuteFlag) {
3437 CALL_MatrixMode(ctx->Exec, (mode));
3438 }
3439 }
3440
3441
3442 static void GLAPIENTRY
3443 save_MultMatrixf(const GLfloat * m)
3444 {
3445 GET_CURRENT_CONTEXT(ctx);
3446 Node *n;
3447 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3448 n = alloc_instruction(ctx, OPCODE_MULT_MATRIX, 16);
3449 if (n) {
3450 GLuint i;
3451 for (i = 0; i < 16; i++) {
3452 n[1 + i].f = m[i];
3453 }
3454 }
3455 if (ctx->ExecuteFlag) {
3456 CALL_MultMatrixf(ctx->Exec, (m));
3457 }
3458 }
3459
3460
3461 static void GLAPIENTRY
3462 save_MultMatrixd(const GLdouble * m)
3463 {
3464 GLfloat f[16];
3465 GLint i;
3466 for (i = 0; i < 16; i++) {
3467 f[i] = (GLfloat) m[i];
3468 }
3469 save_MultMatrixf(f);
3470 }
3471
3472
3473 static void GLAPIENTRY
3474 save_NewList(GLuint name, GLenum mode)
3475 {
3476 GET_CURRENT_CONTEXT(ctx);
3477 /* It's an error to call this function while building a display list */
3478 _mesa_error(ctx, GL_INVALID_OPERATION, "glNewList");
3479 (void) name;
3480 (void) mode;
3481 }
3482
3483
3484
3485 static void GLAPIENTRY
3486 save_Ortho(GLdouble left, GLdouble right,
3487 GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval)
3488 {
3489 GET_CURRENT_CONTEXT(ctx);
3490 Node *n;
3491 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3492 n = alloc_instruction(ctx, OPCODE_ORTHO, 6);
3493 if (n) {
3494 n[1].f = (GLfloat) left;
3495 n[2].f = (GLfloat) right;
3496 n[3].f = (GLfloat) bottom;
3497 n[4].f = (GLfloat) top;
3498 n[5].f = (GLfloat) nearval;
3499 n[6].f = (GLfloat) farval;
3500 }
3501 if (ctx->ExecuteFlag) {
3502 CALL_Ortho(ctx->Exec, (left, right, bottom, top, nearval, farval));
3503 }
3504 }
3505
3506
3507 static void GLAPIENTRY
3508 save_PatchParameteri(GLenum pname, const GLint value)
3509 {
3510 GET_CURRENT_CONTEXT(ctx);
3511 Node *n;
3512 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3513 n = alloc_instruction(ctx, OPCODE_PATCH_PARAMETER_I, 2);
3514 if (n) {
3515 n[1].e = pname;
3516 n[2].i = value;
3517 }
3518 if (ctx->ExecuteFlag) {
3519 CALL_PatchParameteri(ctx->Exec, (pname, value));
3520 }
3521 }
3522
3523
3524 static void GLAPIENTRY
3525 save_PatchParameterfv(GLenum pname, const GLfloat *params)
3526 {
3527 GET_CURRENT_CONTEXT(ctx);
3528 Node *n;
3529 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3530
3531 if (pname == GL_PATCH_DEFAULT_OUTER_LEVEL) {
3532 n = alloc_instruction(ctx, OPCODE_PATCH_PARAMETER_FV_OUTER, 5);
3533 } else {
3534 assert(pname == GL_PATCH_DEFAULT_INNER_LEVEL);
3535 n = alloc_instruction(ctx, OPCODE_PATCH_PARAMETER_FV_INNER, 3);
3536 }
3537 if (n) {
3538 n[1].e = pname;
3539 if (pname == GL_PATCH_DEFAULT_OUTER_LEVEL) {
3540 n[2].f = params[0];
3541 n[3].f = params[1];
3542 n[4].f = params[2];
3543 n[5].f = params[3];
3544 } else {
3545 n[2].f = params[0];
3546 n[3].f = params[1];
3547 }
3548 }
3549 if (ctx->ExecuteFlag) {
3550 CALL_PatchParameterfv(ctx->Exec, (pname, params));
3551 }
3552 }
3553
3554
3555 static void GLAPIENTRY
3556 save_PixelMapfv(GLenum map, GLint mapsize, const GLfloat *values)
3557 {
3558 GET_CURRENT_CONTEXT(ctx);
3559 Node *n;
3560 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3561 n = alloc_instruction(ctx, OPCODE_PIXEL_MAP, 2 + POINTER_DWORDS);
3562 if (n) {
3563 n[1].e = map;
3564 n[2].i = mapsize;
3565 save_pointer(&n[3], memdup(values, mapsize * sizeof(GLfloat)));
3566 }
3567 if (ctx->ExecuteFlag) {
3568 CALL_PixelMapfv(ctx->Exec, (map, mapsize, values));
3569 }
3570 }
3571
3572
3573 static void GLAPIENTRY
3574 save_PixelMapuiv(GLenum map, GLint mapsize, const GLuint *values)
3575 {
3576 GLfloat fvalues[MAX_PIXEL_MAP_TABLE];
3577 GLint i;
3578 if (map == GL_PIXEL_MAP_I_TO_I || map == GL_PIXEL_MAP_S_TO_S) {
3579 for (i = 0; i < mapsize; i++) {
3580 fvalues[i] = (GLfloat) values[i];
3581 }
3582 }
3583 else {
3584 for (i = 0; i < mapsize; i++) {
3585 fvalues[i] = UINT_TO_FLOAT(values[i]);
3586 }
3587 }
3588 save_PixelMapfv(map, mapsize, fvalues);
3589 }
3590
3591
3592 static void GLAPIENTRY
3593 save_PixelMapusv(GLenum map, GLint mapsize, const GLushort *values)
3594 {
3595 GLfloat fvalues[MAX_PIXEL_MAP_TABLE];
3596 GLint i;
3597 if (map == GL_PIXEL_MAP_I_TO_I || map == GL_PIXEL_MAP_S_TO_S) {
3598 for (i = 0; i < mapsize; i++) {
3599 fvalues[i] = (GLfloat) values[i];
3600 }
3601 }
3602 else {
3603 for (i = 0; i < mapsize; i++) {
3604 fvalues[i] = USHORT_TO_FLOAT(values[i]);
3605 }
3606 }
3607 save_PixelMapfv(map, mapsize, fvalues);
3608 }
3609
3610
3611 static void GLAPIENTRY
3612 save_PixelTransferf(GLenum pname, GLfloat param)
3613 {
3614 GET_CURRENT_CONTEXT(ctx);
3615 Node *n;
3616 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3617 n = alloc_instruction(ctx, OPCODE_PIXEL_TRANSFER, 2);
3618 if (n) {
3619 n[1].e = pname;
3620 n[2].f = param;
3621 }
3622 if (ctx->ExecuteFlag) {
3623 CALL_PixelTransferf(ctx->Exec, (pname, param));
3624 }
3625 }
3626
3627
3628 static void GLAPIENTRY
3629 save_PixelTransferi(GLenum pname, GLint param)
3630 {
3631 save_PixelTransferf(pname, (GLfloat) param);
3632 }
3633
3634
3635 static void GLAPIENTRY
3636 save_PixelZoom(GLfloat xfactor, GLfloat yfactor)
3637 {
3638 GET_CURRENT_CONTEXT(ctx);
3639 Node *n;
3640 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3641 n = alloc_instruction(ctx, OPCODE_PIXEL_ZOOM, 2);
3642 if (n) {
3643 n[1].f = xfactor;
3644 n[2].f = yfactor;
3645 }
3646 if (ctx->ExecuteFlag) {
3647 CALL_PixelZoom(ctx->Exec, (xfactor, yfactor));
3648 }
3649 }
3650
3651
3652 static void GLAPIENTRY
3653 save_PointParameterfvEXT(GLenum pname, const GLfloat *params)
3654 {
3655 GET_CURRENT_CONTEXT(ctx);
3656 Node *n;
3657 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3658 n = alloc_instruction(ctx, OPCODE_POINT_PARAMETERS, 4);
3659 if (n) {
3660 n[1].e = pname;
3661 n[2].f = params[0];
3662 n[3].f = params[1];
3663 n[4].f = params[2];
3664 }
3665 if (ctx->ExecuteFlag) {
3666 CALL_PointParameterfv(ctx->Exec, (pname, params));
3667 }
3668 }
3669
3670
3671 static void GLAPIENTRY
3672 save_PointParameterfEXT(GLenum pname, GLfloat param)
3673 {
3674 GLfloat parray[3];
3675 parray[0] = param;
3676 parray[1] = parray[2] = 0.0F;
3677 save_PointParameterfvEXT(pname, parray);
3678 }
3679
3680 static void GLAPIENTRY
3681 save_PointParameteriNV(GLenum pname, GLint param)
3682 {
3683 GLfloat parray[3];
3684 parray[0] = (GLfloat) param;
3685 parray[1] = parray[2] = 0.0F;
3686 save_PointParameterfvEXT(pname, parray);
3687 }
3688
3689 static void GLAPIENTRY
3690 save_PointParameterivNV(GLenum pname, const GLint * param)
3691 {
3692 GLfloat parray[3];
3693 parray[0] = (GLfloat) param[0];
3694 parray[1] = parray[2] = 0.0F;
3695 save_PointParameterfvEXT(pname, parray);
3696 }
3697
3698
3699 static void GLAPIENTRY
3700 save_PointSize(GLfloat size)
3701 {
3702 GET_CURRENT_CONTEXT(ctx);
3703 Node *n;
3704 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3705 n = alloc_instruction(ctx, OPCODE_POINT_SIZE, 1);
3706 if (n) {
3707 n[1].f = size;
3708 }
3709 if (ctx->ExecuteFlag) {
3710 CALL_PointSize(ctx->Exec, (size));
3711 }
3712 }
3713
3714
3715 static void GLAPIENTRY
3716 save_PolygonMode(GLenum face, GLenum mode)
3717 {
3718 GET_CURRENT_CONTEXT(ctx);
3719 Node *n;
3720 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3721 n = alloc_instruction(ctx, OPCODE_POLYGON_MODE, 2);
3722 if (n) {
3723 n[1].e = face;
3724 n[2].e = mode;
3725 }
3726 if (ctx->ExecuteFlag) {
3727 CALL_PolygonMode(ctx->Exec, (face, mode));
3728 }
3729 }
3730
3731
3732 static void GLAPIENTRY
3733 save_PolygonStipple(const GLubyte * pattern)
3734 {
3735 GET_CURRENT_CONTEXT(ctx);
3736 Node *n;
3737
3738 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3739
3740 n = alloc_instruction(ctx, OPCODE_POLYGON_STIPPLE, POINTER_DWORDS);
3741 if (n) {
3742 save_pointer(&n[1],
3743 unpack_image(ctx, 2, 32, 32, 1, GL_COLOR_INDEX, GL_BITMAP,
3744 pattern, &ctx->Unpack));
3745 }
3746 if (ctx->ExecuteFlag) {
3747 CALL_PolygonStipple(ctx->Exec, ((GLubyte *) pattern));
3748 }
3749 }
3750
3751
3752 static void GLAPIENTRY
3753 save_PolygonOffset(GLfloat factor, GLfloat units)
3754 {
3755 GET_CURRENT_CONTEXT(ctx);
3756 Node *n;
3757 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3758 n = alloc_instruction(ctx, OPCODE_POLYGON_OFFSET, 2);
3759 if (n) {
3760 n[1].f = factor;
3761 n[2].f = units;
3762 }
3763 if (ctx->ExecuteFlag) {
3764 CALL_PolygonOffset(ctx->Exec, (factor, units));
3765 }
3766 }
3767
3768
3769 static void GLAPIENTRY
3770 save_PolygonOffsetClampEXT(GLfloat factor, GLfloat units, GLfloat clamp)
3771 {
3772 GET_CURRENT_CONTEXT(ctx);
3773 Node *n;
3774 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3775 n = alloc_instruction(ctx, OPCODE_POLYGON_OFFSET_CLAMP, 3);
3776 if (n) {
3777 n[1].f = factor;
3778 n[2].f = units;
3779 n[3].f = clamp;
3780 }
3781 if (ctx->ExecuteFlag) {
3782 CALL_PolygonOffsetClampEXT(ctx->Exec, (factor, units, clamp));
3783 }
3784 }
3785
3786 static void GLAPIENTRY
3787 save_PopAttrib(void)
3788 {
3789 GET_CURRENT_CONTEXT(ctx);
3790 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3791 (void) alloc_instruction(ctx, OPCODE_POP_ATTRIB, 0);
3792 if (ctx->ExecuteFlag) {
3793 CALL_PopAttrib(ctx->Exec, ());
3794 }
3795 }
3796
3797
3798 static void GLAPIENTRY
3799 save_PopMatrix(void)
3800 {
3801 GET_CURRENT_CONTEXT(ctx);
3802 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3803 (void) alloc_instruction(ctx, OPCODE_POP_MATRIX, 0);
3804 if (ctx->ExecuteFlag) {
3805 CALL_PopMatrix(ctx->Exec, ());
3806 }
3807 }
3808
3809
3810 static void GLAPIENTRY
3811 save_PopName(void)
3812 {
3813 GET_CURRENT_CONTEXT(ctx);
3814 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3815 (void) alloc_instruction(ctx, OPCODE_POP_NAME, 0);
3816 if (ctx->ExecuteFlag) {
3817 CALL_PopName(ctx->Exec, ());
3818 }
3819 }
3820
3821
3822 static void GLAPIENTRY
3823 save_PrioritizeTextures(GLsizei num, const GLuint * textures,
3824 const GLclampf * priorities)
3825 {
3826 GET_CURRENT_CONTEXT(ctx);
3827 GLint i;
3828 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3829
3830 for (i = 0; i < num; i++) {
3831 Node *n;
3832 n = alloc_instruction(ctx, OPCODE_PRIORITIZE_TEXTURE, 2);
3833 if (n) {
3834 n[1].ui = textures[i];
3835 n[2].f = priorities[i];
3836 }
3837 }
3838 if (ctx->ExecuteFlag) {
3839 CALL_PrioritizeTextures(ctx->Exec, (num, textures, priorities));
3840 }
3841 }
3842
3843
3844 static void GLAPIENTRY
3845 save_PushAttrib(GLbitfield mask)
3846 {
3847 GET_CURRENT_CONTEXT(ctx);
3848 Node *n;
3849 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3850 n = alloc_instruction(ctx, OPCODE_PUSH_ATTRIB, 1);
3851 if (n) {
3852 n[1].bf = mask;
3853 }
3854 if (ctx->ExecuteFlag) {
3855 CALL_PushAttrib(ctx->Exec, (mask));
3856 }
3857 }
3858
3859
3860 static void GLAPIENTRY
3861 save_PushMatrix(void)
3862 {
3863 GET_CURRENT_CONTEXT(ctx);
3864 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3865 (void) alloc_instruction(ctx, OPCODE_PUSH_MATRIX, 0);
3866 if (ctx->ExecuteFlag) {
3867 CALL_PushMatrix(ctx->Exec, ());
3868 }
3869 }
3870
3871
3872 static void GLAPIENTRY
3873 save_PushName(GLuint name)
3874 {
3875 GET_CURRENT_CONTEXT(ctx);
3876 Node *n;
3877 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3878 n = alloc_instruction(ctx, OPCODE_PUSH_NAME, 1);
3879 if (n) {
3880 n[1].ui = name;
3881 }
3882 if (ctx->ExecuteFlag) {
3883 CALL_PushName(ctx->Exec, (name));
3884 }
3885 }
3886
3887
3888 static void GLAPIENTRY
3889 save_RasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
3890 {
3891 GET_CURRENT_CONTEXT(ctx);
3892 Node *n;
3893 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3894 n = alloc_instruction(ctx, OPCODE_RASTER_POS, 4);
3895 if (n) {
3896 n[1].f = x;
3897 n[2].f = y;
3898 n[3].f = z;
3899 n[4].f = w;
3900 }
3901 if (ctx->ExecuteFlag) {
3902 CALL_RasterPos4f(ctx->Exec, (x, y, z, w));
3903 }
3904 }
3905
3906 static void GLAPIENTRY
3907 save_RasterPos2d(GLdouble x, GLdouble y)
3908 {
3909 save_RasterPos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
3910 }
3911
3912 static void GLAPIENTRY
3913 save_RasterPos2f(GLfloat x, GLfloat y)
3914 {
3915 save_RasterPos4f(x, y, 0.0F, 1.0F);
3916 }
3917
3918 static void GLAPIENTRY
3919 save_RasterPos2i(GLint x, GLint y)
3920 {
3921 save_RasterPos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
3922 }
3923
3924 static void GLAPIENTRY
3925 save_RasterPos2s(GLshort x, GLshort y)
3926 {
3927 save_RasterPos4f(x, y, 0.0F, 1.0F);
3928 }
3929
3930 static void GLAPIENTRY
3931 save_RasterPos3d(GLdouble x, GLdouble y, GLdouble z)
3932 {
3933 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
3934 }
3935
3936 static void GLAPIENTRY
3937 save_RasterPos3f(GLfloat x, GLfloat y, GLfloat z)
3938 {
3939 save_RasterPos4f(x, y, z, 1.0F);
3940 }
3941
3942 static void GLAPIENTRY
3943 save_RasterPos3i(GLint x, GLint y, GLint z)
3944 {
3945 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
3946 }
3947
3948 static void GLAPIENTRY
3949 save_RasterPos3s(GLshort x, GLshort y, GLshort z)
3950 {
3951 save_RasterPos4f(x, y, z, 1.0F);
3952 }
3953
3954 static void GLAPIENTRY
3955 save_RasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
3956 {
3957 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
3958 }
3959
3960 static void GLAPIENTRY
3961 save_RasterPos4i(GLint x, GLint y, GLint z, GLint w)
3962 {
3963 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
3964 }
3965
3966 static void GLAPIENTRY
3967 save_RasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w)
3968 {
3969 save_RasterPos4f(x, y, z, w);
3970 }
3971
3972 static void GLAPIENTRY
3973 save_RasterPos2dv(const GLdouble * v)
3974 {
3975 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
3976 }
3977
3978 static void GLAPIENTRY
3979 save_RasterPos2fv(const GLfloat * v)
3980 {
3981 save_RasterPos4f(v[0], v[1], 0.0F, 1.0F);
3982 }
3983
3984 static void GLAPIENTRY
3985 save_RasterPos2iv(const GLint * v)
3986 {
3987 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
3988 }
3989
3990 static void GLAPIENTRY
3991 save_RasterPos2sv(const GLshort * v)
3992 {
3993 save_RasterPos4f(v[0], v[1], 0.0F, 1.0F);
3994 }
3995
3996 static void GLAPIENTRY
3997 save_RasterPos3dv(const GLdouble * v)
3998 {
3999 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
4000 }
4001
4002 static void GLAPIENTRY
4003 save_RasterPos3fv(const GLfloat * v)
4004 {
4005 save_RasterPos4f(v[0], v[1], v[2], 1.0F);
4006 }
4007
4008 static void GLAPIENTRY
4009 save_RasterPos3iv(const GLint * v)
4010 {
4011 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
4012 }
4013
4014 static void GLAPIENTRY
4015 save_RasterPos3sv(const GLshort * v)
4016 {
4017 save_RasterPos4f(v[0], v[1], v[2], 1.0F);
4018 }
4019
4020 static void GLAPIENTRY
4021 save_RasterPos4dv(const GLdouble * v)
4022 {
4023 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1],
4024 (GLfloat) v[2], (GLfloat) v[3]);
4025 }
4026
4027 static void GLAPIENTRY
4028 save_RasterPos4fv(const GLfloat * v)
4029 {
4030 save_RasterPos4f(v[0], v[1], v[2], v[3]);
4031 }
4032
4033 static void GLAPIENTRY
4034 save_RasterPos4iv(const GLint * v)
4035 {
4036 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1],
4037 (GLfloat) v[2], (GLfloat) v[3]);
4038 }
4039
4040 static void GLAPIENTRY
4041 save_RasterPos4sv(const GLshort * v)
4042 {
4043 save_RasterPos4f(v[0], v[1], v[2], v[3]);
4044 }
4045
4046
4047 static void GLAPIENTRY
4048 save_PassThrough(GLfloat token)
4049 {
4050 GET_CURRENT_CONTEXT(ctx);
4051 Node *n;
4052 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4053 n = alloc_instruction(ctx, OPCODE_PASSTHROUGH, 1);
4054 if (n) {
4055 n[1].f = token;
4056 }
4057 if (ctx->ExecuteFlag) {
4058 CALL_PassThrough(ctx->Exec, (token));
4059 }
4060 }
4061
4062
4063 static void GLAPIENTRY
4064 save_ReadBuffer(GLenum mode)
4065 {
4066 GET_CURRENT_CONTEXT(ctx);
4067 Node *n;
4068 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4069 n = alloc_instruction(ctx, OPCODE_READ_BUFFER, 1);
4070 if (n) {
4071 n[1].e = mode;
4072 }
4073 if (ctx->ExecuteFlag) {
4074 CALL_ReadBuffer(ctx->Exec, (mode));
4075 }
4076 }
4077
4078
4079 static void GLAPIENTRY
4080 save_Rotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
4081 {
4082 GET_CURRENT_CONTEXT(ctx);
4083 Node *n;
4084 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4085 n = alloc_instruction(ctx, OPCODE_ROTATE, 4);
4086 if (n) {
4087 n[1].f = angle;
4088 n[2].f = x;
4089 n[3].f = y;
4090 n[4].f = z;
4091 }
4092 if (ctx->ExecuteFlag) {
4093 CALL_Rotatef(ctx->Exec, (angle, x, y, z));
4094 }
4095 }
4096
4097
4098 static void GLAPIENTRY
4099 save_Rotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
4100 {
4101 save_Rotatef((GLfloat) angle, (GLfloat) x, (GLfloat) y, (GLfloat) z);
4102 }
4103
4104
4105 static void GLAPIENTRY
4106 save_Scalef(GLfloat x, GLfloat y, GLfloat z)
4107 {
4108 GET_CURRENT_CONTEXT(ctx);
4109 Node *n;
4110 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4111 n = alloc_instruction(ctx, OPCODE_SCALE, 3);
4112 if (n) {
4113 n[1].f = x;
4114 n[2].f = y;
4115 n[3].f = z;
4116 }
4117 if (ctx->ExecuteFlag) {
4118 CALL_Scalef(ctx->Exec, (x, y, z));
4119 }
4120 }
4121
4122
4123 static void GLAPIENTRY
4124 save_Scaled(GLdouble x, GLdouble y, GLdouble z)
4125 {
4126 save_Scalef((GLfloat) x, (GLfloat) y, (GLfloat) z);
4127 }
4128
4129
4130 static void GLAPIENTRY
4131 save_Scissor(GLint x, GLint y, GLsizei width, GLsizei height)
4132 {
4133 GET_CURRENT_CONTEXT(ctx);
4134 Node *n;
4135 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4136 n = alloc_instruction(ctx, OPCODE_SCISSOR, 4);
4137 if (n) {
4138 n[1].i = x;
4139 n[2].i = y;
4140 n[3].i = width;
4141 n[4].i = height;
4142 }
4143 if (ctx->ExecuteFlag) {
4144 CALL_Scissor(ctx->Exec, (x, y, width, height));
4145 }
4146 }
4147
4148
4149 static void GLAPIENTRY
4150 save_ShadeModel(GLenum mode)
4151 {
4152 GET_CURRENT_CONTEXT(ctx);
4153 Node *n;
4154 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx);
4155
4156 if (ctx->ExecuteFlag) {
4157 CALL_ShadeModel(ctx->Exec, (mode));
4158 }
4159
4160 /* Don't compile this call if it's a no-op.
4161 * By avoiding this state change we have a better chance of
4162 * coalescing subsequent drawing commands into one batch.
4163 */
4164 if (ctx->ListState.Current.ShadeModel == mode)
4165 return;
4166
4167 SAVE_FLUSH_VERTICES(ctx);
4168
4169 ctx->ListState.Current.ShadeModel = mode;
4170
4171 n = alloc_instruction(ctx, OPCODE_SHADE_MODEL, 1);
4172 if (n) {
4173 n[1].e = mode;
4174 }
4175 }
4176
4177
4178 static void GLAPIENTRY
4179 save_StencilFunc(GLenum func, GLint ref, GLuint mask)
4180 {
4181 GET_CURRENT_CONTEXT(ctx);
4182 Node *n;
4183 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4184 n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC, 3);
4185 if (n) {
4186 n[1].e = func;
4187 n[2].i = ref;
4188 n[3].ui = mask;
4189 }
4190 if (ctx->ExecuteFlag) {
4191 CALL_StencilFunc(ctx->Exec, (func, ref, mask));
4192 }
4193 }
4194
4195
4196 static void GLAPIENTRY
4197 save_StencilMask(GLuint mask)
4198 {
4199 GET_CURRENT_CONTEXT(ctx);
4200 Node *n;
4201 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4202 n = alloc_instruction(ctx, OPCODE_STENCIL_MASK, 1);
4203 if (n) {
4204 n[1].ui = mask;
4205 }
4206 if (ctx->ExecuteFlag) {
4207 CALL_StencilMask(ctx->Exec, (mask));
4208 }
4209 }
4210
4211
4212 static void GLAPIENTRY
4213 save_StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
4214 {
4215 GET_CURRENT_CONTEXT(ctx);
4216 Node *n;
4217 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4218 n = alloc_instruction(ctx, OPCODE_STENCIL_OP, 3);
4219 if (n) {
4220 n[1].e = fail;
4221 n[2].e = zfail;
4222 n[3].e = zpass;
4223 }
4224 if (ctx->ExecuteFlag) {
4225 CALL_StencilOp(ctx->Exec, (fail, zfail, zpass));
4226 }
4227 }
4228
4229
4230 static void GLAPIENTRY
4231 save_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
4232 {
4233 GET_CURRENT_CONTEXT(ctx);
4234 Node *n;
4235 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4236 n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4);
4237 if (n) {
4238 n[1].e = face;
4239 n[2].e = func;
4240 n[3].i = ref;
4241 n[4].ui = mask;
4242 }
4243 if (ctx->ExecuteFlag) {
4244 CALL_StencilFuncSeparate(ctx->Exec, (face, func, ref, mask));
4245 }
4246 }
4247
4248
4249 static void GLAPIENTRY
4250 save_StencilFuncSeparateATI(GLenum frontfunc, GLenum backfunc, GLint ref,
4251 GLuint mask)
4252 {
4253 GET_CURRENT_CONTEXT(ctx);
4254 Node *n;
4255 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4256 /* GL_FRONT */
4257 n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4);
4258 if (n) {
4259 n[1].e = GL_FRONT;
4260 n[2].e = frontfunc;
4261 n[3].i = ref;
4262 n[4].ui = mask;
4263 }
4264 /* GL_BACK */
4265 n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4);
4266 if (n) {
4267 n[1].e = GL_BACK;
4268 n[2].e = backfunc;
4269 n[3].i = ref;
4270 n[4].ui = mask;
4271 }
4272 if (ctx->ExecuteFlag) {
4273 CALL_StencilFuncSeparate(ctx->Exec, (GL_FRONT, frontfunc, ref, mask));
4274 CALL_StencilFuncSeparate(ctx->Exec, (GL_BACK, backfunc, ref, mask));
4275 }
4276 }
4277
4278
4279 static void GLAPIENTRY
4280 save_StencilMaskSeparate(GLenum face, GLuint mask)
4281 {
4282 GET_CURRENT_CONTEXT(ctx);
4283 Node *n;
4284 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4285 n = alloc_instruction(ctx, OPCODE_STENCIL_MASK_SEPARATE, 2);
4286 if (n) {
4287 n[1].e = face;
4288 n[2].ui = mask;
4289 }
4290 if (ctx->ExecuteFlag) {
4291 CALL_StencilMaskSeparate(ctx->Exec, (face, mask));
4292 }
4293 }
4294
4295
4296 static void GLAPIENTRY
4297 save_StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
4298 {
4299 GET_CURRENT_CONTEXT(ctx);
4300 Node *n;
4301 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4302 n = alloc_instruction(ctx, OPCODE_STENCIL_OP_SEPARATE, 4);
4303 if (n) {
4304 n[1].e = face;
4305 n[2].e = fail;
4306 n[3].e = zfail;
4307 n[4].e = zpass;
4308 }
4309 if (ctx->ExecuteFlag) {
4310 CALL_StencilOpSeparate(ctx->Exec, (face, fail, zfail, zpass));
4311 }
4312 }
4313
4314
4315 static void GLAPIENTRY
4316 save_TexEnvfv(GLenum target, GLenum pname, const GLfloat *params)
4317 {
4318 GET_CURRENT_CONTEXT(ctx);
4319 Node *n;
4320 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4321 n = alloc_instruction(ctx, OPCODE_TEXENV, 6);
4322 if (n) {
4323 n[1].e = target;
4324 n[2].e = pname;
4325 if (pname == GL_TEXTURE_ENV_COLOR) {
4326 n[3].f = params[0];
4327 n[4].f = params[1];
4328 n[5].f = params[2];
4329 n[6].f = params[3];
4330 }
4331 else {
4332 n[3].f = params[0];
4333 n[4].f = n[5].f = n[6].f = 0.0F;
4334 }
4335 }
4336 if (ctx->ExecuteFlag) {
4337 CALL_TexEnvfv(ctx->Exec, (target, pname, params));
4338 }
4339 }
4340
4341
4342 static void GLAPIENTRY
4343 save_TexEnvf(GLenum target, GLenum pname, GLfloat param)
4344 {
4345 GLfloat parray[4];
4346 parray[0] = (GLfloat) param;
4347 parray[1] = parray[2] = parray[3] = 0.0F;
4348 save_TexEnvfv(target, pname, parray);
4349 }
4350
4351
4352 static void GLAPIENTRY
4353 save_TexEnvi(GLenum target, GLenum pname, GLint param)
4354 {
4355 GLfloat p[4];
4356 p[0] = (GLfloat) param;
4357 p[1] = p[2] = p[3] = 0.0F;
4358 save_TexEnvfv(target, pname, p);
4359 }
4360
4361
4362 static void GLAPIENTRY
4363 save_TexEnviv(GLenum target, GLenum pname, const GLint * param)
4364 {
4365 GLfloat p[4];
4366 if (pname == GL_TEXTURE_ENV_COLOR) {
4367 p[0] = INT_TO_FLOAT(param[0]);
4368 p[1] = INT_TO_FLOAT(param[1]);
4369 p[2] = INT_TO_FLOAT(param[2]);
4370 p[3] = INT_TO_FLOAT(param[3]);
4371 }
4372 else {
4373 p[0] = (GLfloat) param[0];
4374 p[1] = p[2] = p[3] = 0.0F;
4375 }
4376 save_TexEnvfv(target, pname, p);
4377 }
4378
4379
4380 static void GLAPIENTRY
4381 save_TexGenfv(GLenum coord, GLenum pname, const GLfloat *params)
4382 {
4383 GET_CURRENT_CONTEXT(ctx);
4384 Node *n;
4385 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4386 n = alloc_instruction(ctx, OPCODE_TEXGEN, 6);
4387 if (n) {
4388 n[1].e = coord;
4389 n[2].e = pname;
4390 n[3].f = params[0];
4391 n[4].f = params[1];
4392 n[5].f = params[2];
4393 n[6].f = params[3];
4394 }
4395 if (ctx->ExecuteFlag) {
4396 CALL_TexGenfv(ctx->Exec, (coord, pname, params));
4397 }
4398 }
4399
4400
4401 static void GLAPIENTRY
4402 save_TexGeniv(GLenum coord, GLenum pname, const GLint *params)
4403 {
4404 GLfloat p[4];
4405 p[0] = (GLfloat) params[0];
4406 p[1] = (GLfloat) params[1];
4407 p[2] = (GLfloat) params[2];
4408 p[3] = (GLfloat) params[3];
4409 save_TexGenfv(coord, pname, p);
4410 }
4411
4412
4413 static void GLAPIENTRY
4414 save_TexGend(GLenum coord, GLenum pname, GLdouble param)
4415 {
4416 GLfloat parray[4];
4417 parray[0] = (GLfloat) param;
4418 parray[1] = parray[2] = parray[3] = 0.0F;
4419 save_TexGenfv(coord, pname, parray);
4420 }
4421
4422
4423 static void GLAPIENTRY
4424 save_TexGendv(GLenum coord, GLenum pname, const GLdouble *params)
4425 {
4426 GLfloat p[4];
4427 p[0] = (GLfloat) params[0];
4428 p[1] = (GLfloat) params[1];
4429 p[2] = (GLfloat) params[2];
4430 p[3] = (GLfloat) params[3];
4431 save_TexGenfv(coord, pname, p);
4432 }
4433
4434
4435 static void GLAPIENTRY
4436 save_TexGenf(GLenum coord, GLenum pname, GLfloat param)
4437 {
4438 GLfloat parray[4];
4439 parray[0] = param;
4440 parray[1] = parray[2] = parray[3] = 0.0F;
4441 save_TexGenfv(coord, pname, parray);
4442 }
4443
4444
4445 static void GLAPIENTRY
4446 save_TexGeni(GLenum coord, GLenum pname, GLint param)
4447 {
4448 GLint parray[4];
4449 parray[0] = param;
4450 parray[1] = parray[2] = parray[3] = 0;
4451 save_TexGeniv(coord, pname, parray);
4452 }
4453
4454
4455 static void GLAPIENTRY
4456 save_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
4457 {
4458 GET_CURRENT_CONTEXT(ctx);
4459 Node *n;
4460 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4461 n = alloc_instruction(ctx, OPCODE_TEXPARAMETER, 6);
4462 if (n) {
4463 n[1].e = target;
4464 n[2].e = pname;
4465 n[3].f = params[0];
4466 n[4].f = params[1];
4467 n[5].f = params[2];
4468 n[6].f = params[3];
4469 }
4470 if (ctx->ExecuteFlag) {
4471 CALL_TexParameterfv(ctx->Exec, (target, pname, params));
4472 }
4473 }
4474
4475
4476 static void GLAPIENTRY
4477 save_TexParameterf(GLenum target, GLenum pname, GLfloat param)
4478 {
4479 GLfloat parray[4];
4480 parray[0] = param;
4481 parray[1] = parray[2] = parray[3] = 0.0F;
4482 save_TexParameterfv(target, pname, parray);
4483 }
4484
4485
4486 static void GLAPIENTRY
4487 save_TexParameteri(GLenum target, GLenum pname, GLint param)
4488 {
4489 GLfloat fparam[4];
4490 fparam[0] = (GLfloat) param;
4491 fparam[1] = fparam[2] = fparam[3] = 0.0F;
4492 save_TexParameterfv(target, pname, fparam);
4493 }
4494
4495
4496 static void GLAPIENTRY
4497 save_TexParameteriv(GLenum target, GLenum pname, const GLint *params)
4498 {
4499 GLfloat fparam[4];
4500 fparam[0] = (GLfloat) params[0];
4501 fparam[1] = fparam[2] = fparam[3] = 0.0F;
4502 save_TexParameterfv(target, pname, fparam);
4503 }
4504
4505
4506 static void GLAPIENTRY
4507 save_TexImage1D(GLenum target,
4508 GLint level, GLint components,
4509 GLsizei width, GLint border,
4510 GLenum format, GLenum type, const GLvoid * pixels)
4511 {
4512 GET_CURRENT_CONTEXT(ctx);
4513 if (target == GL_PROXY_TEXTURE_1D) {
4514 /* don't compile, execute immediately */
4515 CALL_TexImage1D(ctx->Exec, (target, level, components, width,
4516 border, format, type, pixels));
4517 }
4518 else {
4519 Node *n;
4520 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4521 n = alloc_instruction(ctx, OPCODE_TEX_IMAGE1D, 7 + POINTER_DWORDS);
4522 if (n) {
4523 n[1].e = target;
4524 n[2].i = level;
4525 n[3].i = components;
4526 n[4].i = (GLint) width;
4527 n[5].i = border;
4528 n[6].e = format;
4529 n[7].e = type;
4530 save_pointer(&n[8],
4531 unpack_image(ctx, 1, width, 1, 1, format, type,
4532 pixels, &ctx->Unpack));
4533 }
4534 if (ctx->ExecuteFlag) {
4535 CALL_TexImage1D(ctx->Exec, (target, level, components, width,
4536 border, format, type, pixels));
4537 }
4538 }
4539 }
4540
4541
4542 static void GLAPIENTRY
4543 save_TexImage2D(GLenum target,
4544 GLint level, GLint components,
4545 GLsizei width, GLsizei height, GLint border,
4546 GLenum format, GLenum type, const GLvoid * pixels)
4547 {
4548 GET_CURRENT_CONTEXT(ctx);
4549 if (target == GL_PROXY_TEXTURE_2D) {
4550 /* don't compile, execute immediately */
4551 CALL_TexImage2D(ctx->Exec, (target, level, components, width,
4552 height, border, format, type, pixels));
4553 }
4554 else {
4555 Node *n;
4556 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4557 n = alloc_instruction(ctx, OPCODE_TEX_IMAGE2D, 8 + POINTER_DWORDS);
4558 if (n) {
4559 n[1].e = target;
4560 n[2].i = level;
4561 n[3].i = components;
4562 n[4].i = (GLint) width;
4563 n[5].i = (GLint) height;
4564 n[6].i = border;
4565 n[7].e = format;
4566 n[8].e = type;
4567 save_pointer(&n[9],
4568 unpack_image(ctx, 2, width, height, 1, format, type,
4569 pixels, &ctx->Unpack));
4570 }
4571 if (ctx->ExecuteFlag) {
4572 CALL_TexImage2D(ctx->Exec, (target, level, components, width,
4573 height, border, format, type, pixels));
4574 }
4575 }
4576 }
4577
4578
4579 static void GLAPIENTRY
4580 save_TexImage3D(GLenum target,
4581 GLint level, GLint internalFormat,
4582 GLsizei width, GLsizei height, GLsizei depth,
4583 GLint border,
4584 GLenum format, GLenum type, const GLvoid * pixels)
4585 {
4586 GET_CURRENT_CONTEXT(ctx);
4587 if (target == GL_PROXY_TEXTURE_3D) {
4588 /* don't compile, execute immediately */
4589 CALL_TexImage3D(ctx->Exec, (target, level, internalFormat, width,
4590 height, depth, border, format, type,
4591 pixels));
4592 }
4593 else {
4594 Node *n;
4595 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4596 n = alloc_instruction(ctx, OPCODE_TEX_IMAGE3D, 9 + POINTER_DWORDS);
4597 if (n) {
4598 n[1].e = target;
4599 n[2].i = level;
4600 n[3].i = (GLint) internalFormat;
4601 n[4].i = (GLint) width;
4602 n[5].i = (GLint) height;
4603 n[6].i = (GLint) depth;
4604 n[7].i = border;
4605 n[8].e = format;
4606 n[9].e = type;
4607 save_pointer(&n[10],
4608 unpack_image(ctx, 3, width, height, depth, format, type,
4609 pixels, &ctx->Unpack));
4610 }
4611 if (ctx->ExecuteFlag) {
4612 CALL_TexImage3D(ctx->Exec, (target, level, internalFormat, width,
4613 height, depth, border, format, type,
4614 pixels));
4615 }
4616 }
4617 }
4618
4619
4620 static void GLAPIENTRY
4621 save_TexSubImage1D(GLenum target, GLint level, GLint xoffset,
4622 GLsizei width, GLenum format, GLenum type,
4623 const GLvoid * pixels)
4624 {
4625 GET_CURRENT_CONTEXT(ctx);
4626 Node *n;
4627
4628 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4629
4630 n = alloc_instruction(ctx, OPCODE_TEX_SUB_IMAGE1D, 6 + POINTER_DWORDS);
4631 if (n) {
4632 n[1].e = target;
4633 n[2].i = level;
4634 n[3].i = xoffset;
4635 n[4].i = (GLint) width;
4636 n[5].e = format;
4637 n[6].e = type;
4638 save_pointer(&n[7],
4639 unpack_image(ctx, 1, width, 1, 1, format, type,
4640 pixels, &ctx->Unpack));
4641 }
4642 if (ctx->ExecuteFlag) {
4643 CALL_TexSubImage1D(ctx->Exec, (target, level, xoffset, width,
4644 format, type, pixels));
4645 }
4646 }
4647
4648
4649 static void GLAPIENTRY
4650 save_TexSubImage2D(GLenum target, GLint level,
4651 GLint xoffset, GLint yoffset,
4652 GLsizei width, GLsizei height,
4653 GLenum format, GLenum type, const GLvoid * pixels)
4654 {
4655 GET_CURRENT_CONTEXT(ctx);
4656 Node *n;
4657
4658 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4659
4660 n = alloc_instruction(ctx, OPCODE_TEX_SUB_IMAGE2D, 8 + POINTER_DWORDS);
4661 if (n) {
4662 n[1].e = target;
4663 n[2].i = level;
4664 n[3].i = xoffset;
4665 n[4].i = yoffset;
4666 n[5].i = (GLint) width;
4667 n[6].i = (GLint) height;
4668 n[7].e = format;
4669 n[8].e = type;
4670 save_pointer(&n[9],
4671 unpack_image(ctx, 2, width, height, 1, format, type,
4672 pixels, &ctx->Unpack));
4673 }
4674 if (ctx->ExecuteFlag) {
4675 CALL_TexSubImage2D(ctx->Exec, (target, level, xoffset, yoffset,
4676 width, height, format, type, pixels));
4677 }
4678 }
4679
4680
4681 static void GLAPIENTRY
4682 save_TexSubImage3D(GLenum target, GLint level,
4683 GLint xoffset, GLint yoffset, GLint zoffset,
4684 GLsizei width, GLsizei height, GLsizei depth,
4685 GLenum format, GLenum type, const GLvoid * pixels)
4686 {
4687 GET_CURRENT_CONTEXT(ctx);
4688 Node *n;
4689
4690 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4691
4692 n = alloc_instruction(ctx, OPCODE_TEX_SUB_IMAGE3D, 10 + POINTER_DWORDS);
4693 if (n) {
4694 n[1].e = target;
4695 n[2].i = level;
4696 n[3].i = xoffset;
4697 n[4].i = yoffset;
4698 n[5].i = zoffset;
4699 n[6].i = (GLint) width;
4700 n[7].i = (GLint) height;
4701 n[8].i = (GLint) depth;
4702 n[9].e = format;
4703 n[10].e = type;
4704 save_pointer(&n[11],
4705 unpack_image(ctx, 3, width, height, depth, format, type,
4706 pixels, &ctx->Unpack));
4707 }
4708 if (ctx->ExecuteFlag) {
4709 CALL_TexSubImage3D(ctx->Exec, (target, level,
4710 xoffset, yoffset, zoffset,
4711 width, height, depth, format, type,
4712 pixels));
4713 }
4714 }
4715
4716
4717 static void GLAPIENTRY
4718 save_Translatef(GLfloat x, GLfloat y, GLfloat z)
4719 {
4720 GET_CURRENT_CONTEXT(ctx);
4721 Node *n;
4722 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4723 n = alloc_instruction(ctx, OPCODE_TRANSLATE, 3);
4724 if (n) {
4725 n[1].f = x;
4726 n[2].f = y;
4727 n[3].f = z;
4728 }
4729 if (ctx->ExecuteFlag) {
4730 CALL_Translatef(ctx->Exec, (x, y, z));
4731 }
4732 }
4733
4734
4735 static void GLAPIENTRY
4736 save_Translated(GLdouble x, GLdouble y, GLdouble z)
4737 {
4738 save_Translatef((GLfloat) x, (GLfloat) y, (GLfloat) z);
4739 }
4740
4741
4742
4743 static void GLAPIENTRY
4744 save_Viewport(GLint x, GLint y, GLsizei width, GLsizei height)
4745 {
4746 GET_CURRENT_CONTEXT(ctx);
4747 Node *n;
4748 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4749 n = alloc_instruction(ctx, OPCODE_VIEWPORT, 4);
4750 if (n) {
4751 n[1].i = x;
4752 n[2].i = y;
4753 n[3].i = (GLint) width;
4754 n[4].i = (GLint) height;
4755 }
4756 if (ctx->ExecuteFlag) {
4757 CALL_Viewport(ctx->Exec, (x, y, width, height));
4758 }
4759 }
4760
4761 static void GLAPIENTRY
4762 save_ViewportIndexedf(GLuint index, GLfloat x, GLfloat y, GLfloat width,
4763 GLfloat height)
4764 {
4765 GET_CURRENT_CONTEXT(ctx);
4766 Node *n;
4767 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4768 n = alloc_instruction(ctx, OPCODE_VIEWPORT_INDEXED_F, 5);
4769 if (n) {
4770 n[1].ui = index;
4771 n[2].f = x;
4772 n[3].f = y;
4773 n[4].f = width;
4774 n[5].f = height;
4775 }
4776 if (ctx->ExecuteFlag) {
4777 CALL_ViewportIndexedf(ctx->Exec, (index, x, y, width, height));
4778 }
4779 }
4780
4781 static void GLAPIENTRY
4782 save_ViewportIndexedfv(GLuint index, const GLfloat *v)
4783 {
4784 GET_CURRENT_CONTEXT(ctx);
4785 Node *n;
4786 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4787 n = alloc_instruction(ctx, OPCODE_VIEWPORT_INDEXED_FV, 5);
4788 if (n) {
4789 n[1].ui = index;
4790 n[2].f = v[0];
4791 n[3].f = v[1];
4792 n[4].f = v[2];
4793 n[5].f = v[3];
4794 }
4795 if (ctx->ExecuteFlag) {
4796 CALL_ViewportIndexedfv(ctx->Exec, (index, v));
4797 }
4798 }
4799
4800 static void GLAPIENTRY
4801 save_ViewportArrayv(GLuint first, GLsizei count, const GLfloat *v)
4802 {
4803 GET_CURRENT_CONTEXT(ctx);
4804 Node *n;
4805 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4806 n = alloc_instruction(ctx, OPCODE_VIEWPORT_ARRAY_V, 2 + POINTER_DWORDS);
4807 if (n) {
4808 n[1].ui = first;
4809 n[2].si = count;
4810 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLfloat)));
4811 }
4812 if (ctx->ExecuteFlag) {
4813 CALL_ViewportArrayv(ctx->Exec, (first, count, v));
4814 }
4815 }
4816
4817 static void GLAPIENTRY
4818 save_ScissorIndexed(GLuint index, GLint left, GLint bottom, GLsizei width,
4819 GLsizei height)
4820 {
4821 GET_CURRENT_CONTEXT(ctx);
4822 Node *n;
4823 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4824 n = alloc_instruction(ctx, OPCODE_SCISSOR_INDEXED, 5);
4825 if (n) {
4826 n[1].ui = index;
4827 n[2].i = left;
4828 n[3].i = bottom;
4829 n[4].si = width;
4830 n[5].si = height;
4831 }
4832 if (ctx->ExecuteFlag) {
4833 CALL_ScissorIndexed(ctx->Exec, (index, left, bottom, width, height));
4834 }
4835 }
4836
4837 static void GLAPIENTRY
4838 save_ScissorIndexedv(GLuint index, const GLint *v)
4839 {
4840 GET_CURRENT_CONTEXT(ctx);
4841 Node *n;
4842 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4843 n = alloc_instruction(ctx, OPCODE_SCISSOR_INDEXED_V, 5);
4844 if (n) {
4845 n[1].ui = index;
4846 n[2].i = v[0];
4847 n[3].i = v[1];
4848 n[4].si = v[2];
4849 n[5].si = v[3];
4850 }
4851 if (ctx->ExecuteFlag) {
4852 CALL_ScissorIndexedv(ctx->Exec, (index, v));
4853 }
4854 }
4855
4856 static void GLAPIENTRY
4857 save_ScissorArrayv(GLuint first, GLsizei count, const GLint *v)
4858 {
4859 GET_CURRENT_CONTEXT(ctx);
4860 Node *n;
4861 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4862 n = alloc_instruction(ctx, OPCODE_SCISSOR_ARRAY_V, 2 + POINTER_DWORDS);
4863 if (n) {
4864 n[1].ui = first;
4865 n[2].si = count;
4866 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLint)));
4867 }
4868 if (ctx->ExecuteFlag) {
4869 CALL_ScissorArrayv(ctx->Exec, (first, count, v));
4870 }
4871 }
4872
4873 static void GLAPIENTRY
4874 save_DepthRangeIndexed(GLuint index, GLclampd n, GLclampd f)
4875 {
4876 GET_CURRENT_CONTEXT(ctx);
4877 Node *node;
4878 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4879 node = alloc_instruction(ctx, OPCODE_DEPTH_INDEXED, 3);
4880 if (node) {
4881 node[1].ui = index;
4882 /* Mesa stores these as floats internally so we deliberately convert
4883 * them to a float here.
4884 */
4885 node[2].f = n;
4886 node[3].f = f;
4887 }
4888 if (ctx->ExecuteFlag) {
4889 CALL_DepthRangeIndexed(ctx->Exec, (index, n, f));
4890 }
4891 }
4892
4893 static void GLAPIENTRY
4894 save_DepthRangeArrayv(GLuint first, GLsizei count, const GLclampd *v)
4895 {
4896 GET_CURRENT_CONTEXT(ctx);
4897 Node *n;
4898 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4899 n = alloc_instruction(ctx, OPCODE_DEPTH_ARRAY_V, 2 + POINTER_DWORDS);
4900 if (n) {
4901 n[1].ui = first;
4902 n[2].si = count;
4903 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLclampd)));
4904 }
4905 if (ctx->ExecuteFlag) {
4906 CALL_DepthRangeArrayv(ctx->Exec, (first, count, v));
4907 }
4908 }
4909
4910 static void GLAPIENTRY
4911 save_WindowPos4fMESA(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
4912 {
4913 GET_CURRENT_CONTEXT(ctx);
4914 Node *n;
4915 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4916 n = alloc_instruction(ctx, OPCODE_WINDOW_POS, 4);
4917 if (n) {
4918 n[1].f = x;
4919 n[2].f = y;
4920 n[3].f = z;
4921 n[4].f = w;
4922 }
4923 if (ctx->ExecuteFlag) {
4924 CALL_WindowPos4fMESA(ctx->Exec, (x, y, z, w));
4925 }
4926 }
4927
4928 static void GLAPIENTRY
4929 save_WindowPos2dMESA(GLdouble x, GLdouble y)
4930 {
4931 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
4932 }
4933
4934 static void GLAPIENTRY
4935 save_WindowPos2fMESA(GLfloat x, GLfloat y)
4936 {
4937 save_WindowPos4fMESA(x, y, 0.0F, 1.0F);
4938 }
4939
4940 static void GLAPIENTRY
4941 save_WindowPos2iMESA(GLint x, GLint y)
4942 {
4943 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
4944 }
4945
4946 static void GLAPIENTRY
4947 save_WindowPos2sMESA(GLshort x, GLshort y)
4948 {
4949 save_WindowPos4fMESA(x, y, 0.0F, 1.0F);
4950 }
4951
4952 static void GLAPIENTRY
4953 save_WindowPos3dMESA(GLdouble x, GLdouble y, GLdouble z)
4954 {
4955 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
4956 }
4957
4958 static void GLAPIENTRY
4959 save_WindowPos3fMESA(GLfloat x, GLfloat y, GLfloat z)
4960 {
4961 save_WindowPos4fMESA(x, y, z, 1.0F);
4962 }
4963
4964 static void GLAPIENTRY
4965 save_WindowPos3iMESA(GLint x, GLint y, GLint z)
4966 {
4967 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
4968 }
4969
4970 static void GLAPIENTRY
4971 save_WindowPos3sMESA(GLshort x, GLshort y, GLshort z)
4972 {
4973 save_WindowPos4fMESA(x, y, z, 1.0F);
4974 }
4975
4976 static void GLAPIENTRY
4977 save_WindowPos4dMESA(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
4978 {
4979 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
4980 }
4981
4982 static void GLAPIENTRY
4983 save_WindowPos4iMESA(GLint x, GLint y, GLint z, GLint w)
4984 {
4985 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
4986 }
4987
4988 static void GLAPIENTRY
4989 save_WindowPos4sMESA(GLshort x, GLshort y, GLshort z, GLshort w)
4990 {
4991 save_WindowPos4fMESA(x, y, z, w);
4992 }
4993
4994 static void GLAPIENTRY
4995 save_WindowPos2dvMESA(const GLdouble * v)
4996 {
4997 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
4998 }
4999
5000 static void GLAPIENTRY
5001 save_WindowPos2fvMESA(const GLfloat * v)
5002 {
5003 save_WindowPos4fMESA(v[0], v[1], 0.0F, 1.0F);
5004 }
5005
5006 static void GLAPIENTRY
5007 save_WindowPos2ivMESA(const GLint * v)
5008 {
5009 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
5010 }
5011
5012 static void GLAPIENTRY
5013 save_WindowPos2svMESA(const GLshort * v)
5014 {
5015 save_WindowPos4fMESA(v[0], v[1], 0.0F, 1.0F);
5016 }
5017
5018 static void GLAPIENTRY
5019 save_WindowPos3dvMESA(const GLdouble * v)
5020 {
5021 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
5022 }
5023
5024 static void GLAPIENTRY
5025 save_WindowPos3fvMESA(const GLfloat * v)
5026 {
5027 save_WindowPos4fMESA(v[0], v[1], v[2], 1.0F);
5028 }
5029
5030 static void GLAPIENTRY
5031 save_WindowPos3ivMESA(const GLint * v)
5032 {
5033 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
5034 }
5035
5036 static void GLAPIENTRY
5037 save_WindowPos3svMESA(const GLshort * v)
5038 {
5039 save_WindowPos4fMESA(v[0], v[1], v[2], 1.0F);
5040 }
5041
5042 static void GLAPIENTRY
5043 save_WindowPos4dvMESA(const GLdouble * v)
5044 {
5045 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1],
5046 (GLfloat) v[2], (GLfloat) v[3]);
5047 }
5048
5049 static void GLAPIENTRY
5050 save_WindowPos4fvMESA(const GLfloat * v)
5051 {
5052 save_WindowPos4fMESA(v[0], v[1], v[2], v[3]);
5053 }
5054
5055 static void GLAPIENTRY
5056 save_WindowPos4ivMESA(const GLint * v)
5057 {
5058 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1],
5059 (GLfloat) v[2], (GLfloat) v[3]);
5060 }
5061
5062 static void GLAPIENTRY
5063 save_WindowPos4svMESA(const GLshort * v)
5064 {
5065 save_WindowPos4fMESA(v[0], v[1], v[2], v[3]);
5066 }
5067
5068
5069
5070 /* GL_ARB_multitexture */
5071 static void GLAPIENTRY
5072 save_ActiveTextureARB(GLenum target)
5073 {
5074 GET_CURRENT_CONTEXT(ctx);
5075 Node *n;
5076 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5077 n = alloc_instruction(ctx, OPCODE_ACTIVE_TEXTURE, 1);
5078 if (n) {
5079 n[1].e = target;
5080 }
5081 if (ctx->ExecuteFlag) {
5082 CALL_ActiveTexture(ctx->Exec, (target));
5083 }
5084 }
5085
5086
5087 /* GL_ARB_transpose_matrix */
5088
5089 static void GLAPIENTRY
5090 save_LoadTransposeMatrixdARB(const GLdouble m[16])
5091 {
5092 GLfloat tm[16];
5093 _math_transposefd(tm, m);
5094 save_LoadMatrixf(tm);
5095 }
5096
5097
5098 static void GLAPIENTRY
5099 save_LoadTransposeMatrixfARB(const GLfloat m[16])
5100 {
5101 GLfloat tm[16];
5102 _math_transposef(tm, m);
5103 save_LoadMatrixf(tm);
5104 }
5105
5106
5107 static void GLAPIENTRY
5108 save_MultTransposeMatrixdARB(const GLdouble m[16])
5109 {
5110 GLfloat tm[16];
5111 _math_transposefd(tm, m);
5112 save_MultMatrixf(tm);
5113 }
5114
5115
5116 static void GLAPIENTRY
5117 save_MultTransposeMatrixfARB(const GLfloat m[16])
5118 {
5119 GLfloat tm[16];
5120 _math_transposef(tm, m);
5121 save_MultMatrixf(tm);
5122 }
5123
5124 static GLvoid *copy_data(const GLvoid *data, GLsizei size, const char *func)
5125 {
5126 GET_CURRENT_CONTEXT(ctx);
5127 GLvoid *image;
5128
5129 if (!data)
5130 return NULL;
5131
5132 image = malloc(size);
5133 if (!image) {
5134 _mesa_error(ctx, GL_OUT_OF_MEMORY, "%s", func);
5135 return NULL;
5136 }
5137 memcpy(image, data, size);
5138
5139 return image;
5140 }
5141
5142
5143 /* GL_ARB_texture_compression */
5144 static void GLAPIENTRY
5145 save_CompressedTexImage1DARB(GLenum target, GLint level,
5146 GLenum internalFormat, GLsizei width,
5147 GLint border, GLsizei imageSize,
5148 const GLvoid * data)
5149 {
5150 GET_CURRENT_CONTEXT(ctx);
5151 if (target == GL_PROXY_TEXTURE_1D) {
5152 /* don't compile, execute immediately */
5153 CALL_CompressedTexImage1D(ctx->Exec, (target, level, internalFormat,
5154 width, border, imageSize,
5155 data));
5156 }
5157 else {
5158 Node *n;
5159 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5160
5161 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_1D,
5162 6 + POINTER_DWORDS);
5163 if (n) {
5164 n[1].e = target;
5165 n[2].i = level;
5166 n[3].e = internalFormat;
5167 n[4].i = (GLint) width;
5168 n[5].i = border;
5169 n[6].i = imageSize;
5170 save_pointer(&n[7],
5171 copy_data(data, imageSize, "glCompressedTexImage1DARB"));
5172 }
5173 if (ctx->ExecuteFlag) {
5174 CALL_CompressedTexImage1D(ctx->Exec,
5175 (target, level, internalFormat, width,
5176 border, imageSize, data));
5177 }
5178 }
5179 }
5180
5181
5182 static void GLAPIENTRY
5183 save_CompressedTexImage2DARB(GLenum target, GLint level,
5184 GLenum internalFormat, GLsizei width,
5185 GLsizei height, GLint border, GLsizei imageSize,
5186 const GLvoid * data)
5187 {
5188 GET_CURRENT_CONTEXT(ctx);
5189 if (target == GL_PROXY_TEXTURE_2D) {
5190 /* don't compile, execute immediately */
5191 CALL_CompressedTexImage2D(ctx->Exec, (target, level, internalFormat,
5192 width, height, border,
5193 imageSize, data));
5194 }
5195 else {
5196 Node *n;
5197 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5198
5199 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_2D,
5200 7 + POINTER_DWORDS);
5201 if (n) {
5202 n[1].e = target;
5203 n[2].i = level;
5204 n[3].e = internalFormat;
5205 n[4].i = (GLint) width;
5206 n[5].i = (GLint) height;
5207 n[6].i = border;
5208 n[7].i = imageSize;
5209 save_pointer(&n[8],
5210 copy_data(data, imageSize, "glCompressedTexImage2DARB"));
5211 }
5212 if (ctx->ExecuteFlag) {
5213 CALL_CompressedTexImage2D(ctx->Exec,
5214 (target, level, internalFormat, width,
5215 height, border, imageSize, data));
5216 }
5217 }
5218 }
5219
5220
5221 static void GLAPIENTRY
5222 save_CompressedTexImage3DARB(GLenum target, GLint level,
5223 GLenum internalFormat, GLsizei width,
5224 GLsizei height, GLsizei depth, GLint border,
5225 GLsizei imageSize, const GLvoid * data)
5226 {
5227 GET_CURRENT_CONTEXT(ctx);
5228 if (target == GL_PROXY_TEXTURE_3D) {
5229 /* don't compile, execute immediately */
5230 CALL_CompressedTexImage3D(ctx->Exec, (target, level, internalFormat,
5231 width, height, depth, border,
5232 imageSize, data));
5233 }
5234 else {
5235 Node *n;
5236 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5237
5238 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_3D,
5239 8 + POINTER_DWORDS);
5240 if (n) {
5241 n[1].e = target;
5242 n[2].i = level;
5243 n[3].e = internalFormat;
5244 n[4].i = (GLint) width;
5245 n[5].i = (GLint) height;
5246 n[6].i = (GLint) depth;
5247 n[7].i = border;
5248 n[8].i = imageSize;
5249 save_pointer(&n[9],
5250 copy_data(data, imageSize, "glCompressedTexImage3DARB"));
5251 }
5252 if (ctx->ExecuteFlag) {
5253 CALL_CompressedTexImage3D(ctx->Exec,
5254 (target, level, internalFormat, width,
5255 height, depth, border, imageSize,
5256 data));
5257 }
5258 }
5259 }
5260
5261
5262 static void GLAPIENTRY
5263 save_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset,
5264 GLsizei width, GLenum format,
5265 GLsizei imageSize, const GLvoid * data)
5266 {
5267 Node *n;
5268 GET_CURRENT_CONTEXT(ctx);
5269 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5270
5271 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D,
5272 6 + POINTER_DWORDS);
5273 if (n) {
5274 n[1].e = target;
5275 n[2].i = level;
5276 n[3].i = xoffset;
5277 n[4].i = (GLint) width;
5278 n[5].e = format;
5279 n[6].i = imageSize;
5280 save_pointer(&n[7],
5281 copy_data(data, imageSize, "glCompressedTexSubImage1DARB"));
5282 }
5283 if (ctx->ExecuteFlag) {
5284 CALL_CompressedTexSubImage1D(ctx->Exec, (target, level, xoffset,
5285 width, format, imageSize,
5286 data));
5287 }
5288 }
5289
5290
5291 static void GLAPIENTRY
5292 save_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset,
5293 GLint yoffset, GLsizei width, GLsizei height,
5294 GLenum format, GLsizei imageSize,
5295 const GLvoid * data)
5296 {
5297 Node *n;
5298 GET_CURRENT_CONTEXT(ctx);
5299 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5300
5301 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D,
5302 8 + POINTER_DWORDS);
5303 if (n) {
5304 n[1].e = target;
5305 n[2].i = level;
5306 n[3].i = xoffset;
5307 n[4].i = yoffset;
5308 n[5].i = (GLint) width;
5309 n[6].i = (GLint) height;
5310 n[7].e = format;
5311 n[8].i = imageSize;
5312 save_pointer(&n[9],
5313 copy_data(data, imageSize, "glCompressedTexSubImage2DARB"));
5314 }
5315 if (ctx->ExecuteFlag) {
5316 CALL_CompressedTexSubImage2D(ctx->Exec,
5317 (target, level, xoffset, yoffset, width,
5318 height, format, imageSize, data));
5319 }
5320 }
5321
5322
5323 static void GLAPIENTRY
5324 save_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset,
5325 GLint yoffset, GLint zoffset, GLsizei width,
5326 GLsizei height, GLsizei depth, GLenum format,
5327 GLsizei imageSize, const GLvoid * data)
5328 {
5329 Node *n;
5330 GET_CURRENT_CONTEXT(ctx);
5331 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5332
5333 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D,
5334 10 + POINTER_DWORDS);
5335 if (n) {
5336 n[1].e = target;
5337 n[2].i = level;
5338 n[3].i = xoffset;
5339 n[4].i = yoffset;
5340 n[5].i = zoffset;
5341 n[6].i = (GLint) width;
5342 n[7].i = (GLint) height;
5343 n[8].i = (GLint) depth;
5344 n[9].e = format;
5345 n[10].i = imageSize;
5346 save_pointer(&n[11],
5347 copy_data(data, imageSize, "glCompressedTexSubImage3DARB"));
5348 }
5349 if (ctx->ExecuteFlag) {
5350 CALL_CompressedTexSubImage3D(ctx->Exec,
5351 (target, level, xoffset, yoffset,
5352 zoffset, width, height, depth, format,
5353 imageSize, data));
5354 }
5355 }
5356
5357
5358 /* GL_ARB_multisample */
5359 static void GLAPIENTRY
5360 save_SampleCoverageARB(GLclampf value, GLboolean invert)
5361 {
5362 GET_CURRENT_CONTEXT(ctx);
5363 Node *n;
5364 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5365 n = alloc_instruction(ctx, OPCODE_SAMPLE_COVERAGE, 2);
5366 if (n) {
5367 n[1].f = value;
5368 n[2].b = invert;
5369 }
5370 if (ctx->ExecuteFlag) {
5371 CALL_SampleCoverage(ctx->Exec, (value, invert));
5372 }
5373 }
5374
5375
5376 /*
5377 * GL_ARB_vertex_program
5378 */
5379 static void GLAPIENTRY
5380 save_BindProgramARB(GLenum target, GLuint id)
5381 {
5382 GET_CURRENT_CONTEXT(ctx);
5383 Node *n;
5384 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5385 n = alloc_instruction(ctx, OPCODE_BIND_PROGRAM_ARB, 2);
5386 if (n) {
5387 n[1].e = target;
5388 n[2].ui = id;
5389 }
5390 if (ctx->ExecuteFlag) {
5391 CALL_BindProgramARB(ctx->Exec, (target, id));
5392 }
5393 }
5394
5395 static void GLAPIENTRY
5396 save_ProgramEnvParameter4fARB(GLenum target, GLuint index,
5397 GLfloat x, GLfloat y, GLfloat z, GLfloat w)
5398 {
5399 GET_CURRENT_CONTEXT(ctx);
5400 Node *n;
5401 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5402 n = alloc_instruction(ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6);
5403 if (n) {
5404 n[1].e = target;
5405 n[2].ui = index;
5406 n[3].f = x;
5407 n[4].f = y;
5408 n[5].f = z;
5409 n[6].f = w;
5410 }
5411 if (ctx->ExecuteFlag) {
5412 CALL_ProgramEnvParameter4fARB(ctx->Exec, (target, index, x, y, z, w));
5413 }
5414 }
5415
5416
5417 static void GLAPIENTRY
5418 save_ProgramEnvParameter4fvARB(GLenum target, GLuint index,
5419 const GLfloat *params)
5420 {
5421 save_ProgramEnvParameter4fARB(target, index, params[0], params[1],
5422 params[2], params[3]);
5423 }
5424
5425
5426 static void GLAPIENTRY
5427 save_ProgramEnvParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
5428 const GLfloat * params)
5429 {
5430 GET_CURRENT_CONTEXT(ctx);
5431 Node *n;
5432 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5433
5434 if (count > 0) {
5435 GLint i;
5436 const GLfloat * p = params;
5437
5438 for (i = 0 ; i < count ; i++) {
5439 n = alloc_instruction(ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6);
5440 if (n) {
5441 n[1].e = target;
5442 n[2].ui = index;
5443 n[3].f = p[0];
5444 n[4].f = p[1];
5445 n[5].f = p[2];
5446 n[6].f = p[3];
5447 p += 4;
5448 }
5449 }
5450 }
5451
5452 if (ctx->ExecuteFlag) {
5453 CALL_ProgramEnvParameters4fvEXT(ctx->Exec, (target, index, count, params));
5454 }
5455 }
5456
5457
5458 static void GLAPIENTRY
5459 save_ProgramEnvParameter4dARB(GLenum target, GLuint index,
5460 GLdouble x, GLdouble y, GLdouble z, GLdouble w)
5461 {
5462 save_ProgramEnvParameter4fARB(target, index,
5463 (GLfloat) x,
5464 (GLfloat) y, (GLfloat) z, (GLfloat) w);
5465 }
5466
5467
5468 static void GLAPIENTRY
5469 save_ProgramEnvParameter4dvARB(GLenum target, GLuint index,
5470 const GLdouble *params)
5471 {
5472 save_ProgramEnvParameter4fARB(target, index,
5473 (GLfloat) params[0],
5474 (GLfloat) params[1],
5475 (GLfloat) params[2], (GLfloat) params[3]);
5476 }
5477
5478
5479 static void GLAPIENTRY
5480 save_ProgramLocalParameter4fARB(GLenum target, GLuint index,
5481 GLfloat x, GLfloat y, GLfloat z, GLfloat w)
5482 {
5483 GET_CURRENT_CONTEXT(ctx);
5484 Node *n;
5485 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5486 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5487 if (n) {
5488 n[1].e = target;
5489 n[2].ui = index;
5490 n[3].f = x;
5491 n[4].f = y;
5492 n[5].f = z;
5493 n[6].f = w;
5494 }
5495 if (ctx->ExecuteFlag) {
5496 CALL_ProgramLocalParameter4fARB(ctx->Exec, (target, index, x, y, z, w));
5497 }
5498 }
5499
5500
5501 static void GLAPIENTRY
5502 save_ProgramLocalParameter4fvARB(GLenum target, GLuint index,
5503 const GLfloat *params)
5504 {
5505 GET_CURRENT_CONTEXT(ctx);
5506 Node *n;
5507 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5508 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5509 if (n) {
5510 n[1].e = target;
5511 n[2].ui = index;
5512 n[3].f = params[0];
5513 n[4].f = params[1];
5514 n[5].f = params[2];
5515 n[6].f = params[3];
5516 }
5517 if (ctx->ExecuteFlag) {
5518 CALL_ProgramLocalParameter4fvARB(ctx->Exec, (target, index, params));
5519 }
5520 }
5521
5522
5523 static void GLAPIENTRY
5524 save_ProgramLocalParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
5525 const GLfloat *params)
5526 {
5527 GET_CURRENT_CONTEXT(ctx);
5528 Node *n;
5529 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5530
5531 if (count > 0) {
5532 GLint i;
5533 const GLfloat * p = params;
5534
5535 for (i = 0 ; i < count ; i++) {
5536 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5537 if (n) {
5538 n[1].e = target;
5539 n[2].ui = index;
5540 n[3].f = p[0];
5541 n[4].f = p[1];
5542 n[5].f = p[2];
5543 n[6].f = p[3];
5544 p += 4;
5545 }
5546 }
5547 }
5548
5549 if (ctx->ExecuteFlag) {
5550 CALL_ProgramLocalParameters4fvEXT(ctx->Exec, (target, index, count, params));
5551 }
5552 }
5553
5554
5555 static void GLAPIENTRY
5556 save_ProgramLocalParameter4dARB(GLenum target, GLuint index,
5557 GLdouble x, GLdouble y,
5558 GLdouble z, GLdouble w)
5559 {
5560 GET_CURRENT_CONTEXT(ctx);
5561 Node *n;
5562 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5563 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5564 if (n) {
5565 n[1].e = target;
5566 n[2].ui = index;
5567 n[3].f = (GLfloat) x;
5568 n[4].f = (GLfloat) y;
5569 n[5].f = (GLfloat) z;
5570 n[6].f = (GLfloat) w;
5571 }
5572 if (ctx->ExecuteFlag) {
5573 CALL_ProgramLocalParameter4dARB(ctx->Exec, (target, index, x, y, z, w));
5574 }
5575 }
5576
5577
5578 static void GLAPIENTRY
5579 save_ProgramLocalParameter4dvARB(GLenum target, GLuint index,
5580 const GLdouble *params)
5581 {
5582 GET_CURRENT_CONTEXT(ctx);
5583 Node *n;
5584 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5585 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5586 if (n) {
5587 n[1].e = target;
5588 n[2].ui = index;
5589 n[3].f = (GLfloat) params[0];
5590 n[4].f = (GLfloat) params[1];
5591 n[5].f = (GLfloat) params[2];
5592 n[6].f = (GLfloat) params[3];
5593 }
5594 if (ctx->ExecuteFlag) {
5595 CALL_ProgramLocalParameter4dvARB(ctx->Exec, (target, index, params));
5596 }
5597 }
5598
5599
5600 /* GL_EXT_stencil_two_side */
5601 static void GLAPIENTRY
5602 save_ActiveStencilFaceEXT(GLenum face)
5603 {
5604 GET_CURRENT_CONTEXT(ctx);
5605 Node *n;
5606 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5607 n = alloc_instruction(ctx, OPCODE_ACTIVE_STENCIL_FACE_EXT, 1);
5608 if (n) {
5609 n[1].e = face;
5610 }
5611 if (ctx->ExecuteFlag) {
5612 CALL_ActiveStencilFaceEXT(ctx->Exec, (face));
5613 }
5614 }
5615
5616
5617 /* GL_EXT_depth_bounds_test */
5618 static void GLAPIENTRY
5619 save_DepthBoundsEXT(GLclampd zmin, GLclampd zmax)
5620 {
5621 GET_CURRENT_CONTEXT(ctx);
5622 Node *n;
5623 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5624 n = alloc_instruction(ctx, OPCODE_DEPTH_BOUNDS_EXT, 2);
5625 if (n) {
5626 n[1].f = (GLfloat) zmin;
5627 n[2].f = (GLfloat) zmax;
5628 }
5629 if (ctx->ExecuteFlag) {
5630 CALL_DepthBoundsEXT(ctx->Exec, (zmin, zmax));
5631 }
5632 }
5633
5634
5635
5636 static void GLAPIENTRY
5637 save_ProgramStringARB(GLenum target, GLenum format, GLsizei len,
5638 const GLvoid * string)
5639 {
5640 GET_CURRENT_CONTEXT(ctx);
5641 Node *n;
5642
5643 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5644
5645 n = alloc_instruction(ctx, OPCODE_PROGRAM_STRING_ARB, 3 + POINTER_DWORDS);
5646 if (n) {
5647 GLubyte *programCopy = malloc(len);
5648 if (!programCopy) {
5649 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramStringARB");
5650 return;
5651 }
5652 memcpy(programCopy, string, len);
5653 n[1].e = target;
5654 n[2].e = format;
5655 n[3].i = len;
5656 save_pointer(&n[4], programCopy);
5657 }
5658 if (ctx->ExecuteFlag) {
5659 CALL_ProgramStringARB(ctx->Exec, (target, format, len, string));
5660 }
5661 }
5662
5663
5664 static void GLAPIENTRY
5665 save_BeginQueryARB(GLenum target, GLuint id)
5666 {
5667 GET_CURRENT_CONTEXT(ctx);
5668 Node *n;
5669 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5670 n = alloc_instruction(ctx, OPCODE_BEGIN_QUERY_ARB, 2);
5671 if (n) {
5672 n[1].e = target;
5673 n[2].ui = id;
5674 }
5675 if (ctx->ExecuteFlag) {
5676 CALL_BeginQuery(ctx->Exec, (target, id));
5677 }
5678 }
5679
5680 static void GLAPIENTRY
5681 save_EndQueryARB(GLenum target)
5682 {
5683 GET_CURRENT_CONTEXT(ctx);
5684 Node *n;
5685 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5686 n = alloc_instruction(ctx, OPCODE_END_QUERY_ARB, 1);
5687 if (n) {
5688 n[1].e = target;
5689 }
5690 if (ctx->ExecuteFlag) {
5691 CALL_EndQuery(ctx->Exec, (target));
5692 }
5693 }
5694
5695 static void GLAPIENTRY
5696 save_QueryCounter(GLuint id, GLenum target)
5697 {
5698 GET_CURRENT_CONTEXT(ctx);
5699 Node *n;
5700 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5701 n = alloc_instruction(ctx, OPCODE_QUERY_COUNTER, 2);
5702 if (n) {
5703 n[1].ui = id;
5704 n[2].e = target;
5705 }
5706 if (ctx->ExecuteFlag) {
5707 CALL_QueryCounter(ctx->Exec, (id, target));
5708 }
5709 }
5710
5711 static void GLAPIENTRY
5712 save_BeginQueryIndexed(GLenum target, GLuint index, GLuint id)
5713 {
5714 GET_CURRENT_CONTEXT(ctx);
5715 Node *n;
5716 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5717 n = alloc_instruction(ctx, OPCODE_BEGIN_QUERY_INDEXED, 3);
5718 if (n) {
5719 n[1].e = target;
5720 n[2].ui = index;
5721 n[3].ui = id;
5722 }
5723 if (ctx->ExecuteFlag) {
5724 CALL_BeginQueryIndexed(ctx->Exec, (target, index, id));
5725 }
5726 }
5727
5728 static void GLAPIENTRY
5729 save_EndQueryIndexed(GLenum target, GLuint index)
5730 {
5731 GET_CURRENT_CONTEXT(ctx);
5732 Node *n;
5733 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5734 n = alloc_instruction(ctx, OPCODE_END_QUERY_INDEXED, 2);
5735 if (n) {
5736 n[1].e = target;
5737 n[2].ui = index;
5738 }
5739 if (ctx->ExecuteFlag) {
5740 CALL_EndQueryIndexed(ctx->Exec, (target, index));
5741 }
5742 }
5743
5744
5745 static void GLAPIENTRY
5746 save_DrawBuffersARB(GLsizei count, const GLenum * buffers)
5747 {
5748 GET_CURRENT_CONTEXT(ctx);
5749 Node *n;
5750 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5751 n = alloc_instruction(ctx, OPCODE_DRAW_BUFFERS_ARB, 1 + MAX_DRAW_BUFFERS);
5752 if (n) {
5753 GLint i;
5754 n[1].i = count;
5755 if (count > MAX_DRAW_BUFFERS)
5756 count = MAX_DRAW_BUFFERS;
5757 for (i = 0; i < count; i++) {
5758 n[2 + i].e = buffers[i];
5759 }
5760 }
5761 if (ctx->ExecuteFlag) {
5762 CALL_DrawBuffers(ctx->Exec, (count, buffers));
5763 }
5764 }
5765
5766 static void GLAPIENTRY
5767 save_BindFragmentShaderATI(GLuint id)
5768 {
5769 GET_CURRENT_CONTEXT(ctx);
5770 Node *n;
5771
5772 n = alloc_instruction(ctx, OPCODE_BIND_FRAGMENT_SHADER_ATI, 1);
5773 if (n) {
5774 n[1].ui = id;
5775 }
5776 if (ctx->ExecuteFlag) {
5777 CALL_BindFragmentShaderATI(ctx->Exec, (id));
5778 }
5779 }
5780
5781 static void GLAPIENTRY
5782 save_SetFragmentShaderConstantATI(GLuint dst, const GLfloat *value)
5783 {
5784 GET_CURRENT_CONTEXT(ctx);
5785 Node *n;
5786
5787 n = alloc_instruction(ctx, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI, 5);
5788 if (n) {
5789 n[1].ui = dst;
5790 n[2].f = value[0];
5791 n[3].f = value[1];
5792 n[4].f = value[2];
5793 n[5].f = value[3];
5794 }
5795 if (ctx->ExecuteFlag) {
5796 CALL_SetFragmentShaderConstantATI(ctx->Exec, (dst, value));
5797 }
5798 }
5799
5800 static void GLAPIENTRY
5801 save_Attr1fNV(GLenum attr, GLfloat x)
5802 {
5803 GET_CURRENT_CONTEXT(ctx);
5804 Node *n;
5805 SAVE_FLUSH_VERTICES(ctx);
5806 n = alloc_instruction(ctx, OPCODE_ATTR_1F_NV, 2);
5807 if (n) {
5808 n[1].e = attr;
5809 n[2].f = x;
5810 }
5811
5812 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5813 ctx->ListState.ActiveAttribSize[attr] = 1;
5814 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, 0, 0, 1);
5815
5816 if (ctx->ExecuteFlag) {
5817 CALL_VertexAttrib1fNV(ctx->Exec, (attr, x));
5818 }
5819 }
5820
5821 static void GLAPIENTRY
5822 save_Attr2fNV(GLenum attr, GLfloat x, GLfloat y)
5823 {
5824 GET_CURRENT_CONTEXT(ctx);
5825 Node *n;
5826 SAVE_FLUSH_VERTICES(ctx);
5827 n = alloc_instruction(ctx, OPCODE_ATTR_2F_NV, 3);
5828 if (n) {
5829 n[1].e = attr;
5830 n[2].f = x;
5831 n[3].f = y;
5832 }
5833
5834 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5835 ctx->ListState.ActiveAttribSize[attr] = 2;
5836 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, 0, 1);
5837
5838 if (ctx->ExecuteFlag) {
5839 CALL_VertexAttrib2fNV(ctx->Exec, (attr, x, y));
5840 }
5841 }
5842
5843 static void GLAPIENTRY
5844 save_Attr3fNV(GLenum attr, GLfloat x, GLfloat y, GLfloat z)
5845 {
5846 GET_CURRENT_CONTEXT(ctx);
5847 Node *n;
5848 SAVE_FLUSH_VERTICES(ctx);
5849 n = alloc_instruction(ctx, OPCODE_ATTR_3F_NV, 4);
5850 if (n) {
5851 n[1].e = attr;
5852 n[2].f = x;
5853 n[3].f = y;
5854 n[4].f = z;
5855 }
5856
5857 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5858 ctx->ListState.ActiveAttribSize[attr] = 3;
5859 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, 1);
5860
5861 if (ctx->ExecuteFlag) {
5862 CALL_VertexAttrib3fNV(ctx->Exec, (attr, x, y, z));
5863 }
5864 }
5865
5866 static void GLAPIENTRY
5867 save_Attr4fNV(GLenum attr, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
5868 {
5869 GET_CURRENT_CONTEXT(ctx);
5870 Node *n;
5871 SAVE_FLUSH_VERTICES(ctx);
5872 n = alloc_instruction(ctx, OPCODE_ATTR_4F_NV, 5);
5873 if (n) {
5874 n[1].e = attr;
5875 n[2].f = x;
5876 n[3].f = y;
5877 n[4].f = z;
5878 n[5].f = w;
5879 }
5880
5881 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5882 ctx->ListState.ActiveAttribSize[attr] = 4;
5883 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, w);
5884
5885 if (ctx->ExecuteFlag) {
5886 CALL_VertexAttrib4fNV(ctx->Exec, (attr, x, y, z, w));
5887 }
5888 }
5889
5890
5891 static void GLAPIENTRY
5892 save_Attr1fARB(GLenum attr, GLfloat x)
5893 {
5894 GET_CURRENT_CONTEXT(ctx);
5895 Node *n;
5896 SAVE_FLUSH_VERTICES(ctx);
5897 n = alloc_instruction(ctx, OPCODE_ATTR_1F_ARB, 2);
5898 if (n) {
5899 n[1].e = attr;
5900 n[2].f = x;
5901 }
5902
5903 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5904 ctx->ListState.ActiveAttribSize[attr] = 1;
5905 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, 0, 0, 1);
5906
5907 if (ctx->ExecuteFlag) {
5908 CALL_VertexAttrib1fARB(ctx->Exec, (attr, x));
5909 }
5910 }
5911
5912 static void GLAPIENTRY
5913 save_Attr2fARB(GLenum attr, GLfloat x, GLfloat y)
5914 {
5915 GET_CURRENT_CONTEXT(ctx);
5916 Node *n;
5917 SAVE_FLUSH_VERTICES(ctx);
5918 n = alloc_instruction(ctx, OPCODE_ATTR_2F_ARB, 3);
5919 if (n) {
5920 n[1].e = attr;
5921 n[2].f = x;
5922 n[3].f = y;
5923 }
5924
5925 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5926 ctx->ListState.ActiveAttribSize[attr] = 2;
5927 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, 0, 1);
5928
5929 if (ctx->ExecuteFlag) {
5930 CALL_VertexAttrib2fARB(ctx->Exec, (attr, x, y));
5931 }
5932 }
5933
5934 static void GLAPIENTRY
5935 save_Attr3fARB(GLenum attr, GLfloat x, GLfloat y, GLfloat z)
5936 {
5937 GET_CURRENT_CONTEXT(ctx);
5938 Node *n;
5939 SAVE_FLUSH_VERTICES(ctx);
5940 n = alloc_instruction(ctx, OPCODE_ATTR_3F_ARB, 4);
5941 if (n) {
5942 n[1].e = attr;
5943 n[2].f = x;
5944 n[3].f = y;
5945 n[4].f = z;
5946 }
5947
5948 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5949 ctx->ListState.ActiveAttribSize[attr] = 3;
5950 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, 1);
5951
5952 if (ctx->ExecuteFlag) {
5953 CALL_VertexAttrib3fARB(ctx->Exec, (attr, x, y, z));
5954 }
5955 }
5956
5957 static void GLAPIENTRY
5958 save_Attr4fARB(GLenum attr, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
5959 {
5960 GET_CURRENT_CONTEXT(ctx);
5961 Node *n;
5962 SAVE_FLUSH_VERTICES(ctx);
5963 n = alloc_instruction(ctx, OPCODE_ATTR_4F_ARB, 5);
5964 if (n) {
5965 n[1].e = attr;
5966 n[2].f = x;
5967 n[3].f = y;
5968 n[4].f = z;
5969 n[5].f = w;
5970 }
5971
5972 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5973 ctx->ListState.ActiveAttribSize[attr] = 4;
5974 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, w);
5975
5976 if (ctx->ExecuteFlag) {
5977 CALL_VertexAttrib4fARB(ctx->Exec, (attr, x, y, z, w));
5978 }
5979 }
5980
5981
5982 static void GLAPIENTRY
5983 save_EvalCoord1f(GLfloat x)
5984 {
5985 GET_CURRENT_CONTEXT(ctx);
5986 Node *n;
5987 SAVE_FLUSH_VERTICES(ctx);
5988 n = alloc_instruction(ctx, OPCODE_EVAL_C1, 1);
5989 if (n) {
5990 n[1].f = x;
5991 }
5992 if (ctx->ExecuteFlag) {
5993 CALL_EvalCoord1f(ctx->Exec, (x));
5994 }
5995 }
5996
5997 static void GLAPIENTRY
5998 save_EvalCoord1fv(const GLfloat * v)
5999 {
6000 save_EvalCoord1f(v[0]);
6001 }
6002
6003 static void GLAPIENTRY
6004 save_EvalCoord2f(GLfloat x, GLfloat y)
6005 {
6006 GET_CURRENT_CONTEXT(ctx);
6007 Node *n;
6008 SAVE_FLUSH_VERTICES(ctx);
6009 n = alloc_instruction(ctx, OPCODE_EVAL_C2, 2);
6010 if (n) {
6011 n[1].f = x;
6012 n[2].f = y;
6013 }
6014 if (ctx->ExecuteFlag) {
6015 CALL_EvalCoord2f(ctx->Exec, (x, y));
6016 }
6017 }
6018
6019 static void GLAPIENTRY
6020 save_EvalCoord2fv(const GLfloat * v)
6021 {
6022 save_EvalCoord2f(v[0], v[1]);
6023 }
6024
6025
6026 static void GLAPIENTRY
6027 save_EvalPoint1(GLint x)
6028 {
6029 GET_CURRENT_CONTEXT(ctx);
6030 Node *n;
6031 SAVE_FLUSH_VERTICES(ctx);
6032 n = alloc_instruction(ctx, OPCODE_EVAL_P1, 1);
6033 if (n) {
6034 n[1].i = x;
6035 }
6036 if (ctx->ExecuteFlag) {
6037 CALL_EvalPoint1(ctx->Exec, (x));
6038 }
6039 }
6040
6041 static void GLAPIENTRY
6042 save_EvalPoint2(GLint x, GLint y)
6043 {
6044 GET_CURRENT_CONTEXT(ctx);
6045 Node *n;
6046 SAVE_FLUSH_VERTICES(ctx);
6047 n = alloc_instruction(ctx, OPCODE_EVAL_P2, 2);
6048 if (n) {
6049 n[1].i = x;
6050 n[2].i = y;
6051 }
6052 if (ctx->ExecuteFlag) {
6053 CALL_EvalPoint2(ctx->Exec, (x, y));
6054 }
6055 }
6056
6057 static void GLAPIENTRY
6058 save_Indexf(GLfloat x)
6059 {
6060 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX, x);
6061 }
6062
6063 static void GLAPIENTRY
6064 save_Indexfv(const GLfloat * v)
6065 {
6066 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX, v[0]);
6067 }
6068
6069 static void GLAPIENTRY
6070 save_EdgeFlag(GLboolean x)
6071 {
6072 save_Attr1fNV(VERT_ATTRIB_EDGEFLAG, x ? 1.0f : 0.0f);
6073 }
6074
6075
6076 /**
6077 * Compare 'count' elements of vectors 'a' and 'b'.
6078 * \return GL_TRUE if equal, GL_FALSE if different.
6079 */
6080 static inline GLboolean
6081 compare_vec(const GLfloat *a, const GLfloat *b, GLuint count)
6082 {
6083 return memcmp( a, b, count * sizeof(GLfloat) ) == 0;
6084 }
6085
6086
6087 /**
6088 * This glMaterial function is used for glMaterial calls that are outside
6089 * a glBegin/End pair. For glMaterial inside glBegin/End, see the VBO code.
6090 */
6091 static void GLAPIENTRY
6092 save_Materialfv(GLenum face, GLenum pname, const GLfloat * param)
6093 {
6094 GET_CURRENT_CONTEXT(ctx);
6095 Node *n;
6096 int args, i;
6097 GLuint bitmask;
6098
6099 switch (face) {
6100 case GL_BACK:
6101 case GL_FRONT:
6102 case GL_FRONT_AND_BACK:
6103 break;
6104 default:
6105 _mesa_compile_error(ctx, GL_INVALID_ENUM, "glMaterial(face)");
6106 return;
6107 }
6108
6109 switch (pname) {
6110 case GL_EMISSION:
6111 case GL_AMBIENT:
6112 case GL_DIFFUSE:
6113 case GL_SPECULAR:
6114 case GL_AMBIENT_AND_DIFFUSE:
6115 args = 4;
6116 break;
6117 case GL_SHININESS:
6118 args = 1;
6119 break;
6120 case GL_COLOR_INDEXES:
6121 args = 3;
6122 break;
6123 default:
6124 _mesa_compile_error(ctx, GL_INVALID_ENUM, "glMaterial(pname)");
6125 return;
6126 }
6127
6128 if (ctx->ExecuteFlag) {
6129 CALL_Materialfv(ctx->Exec, (face, pname, param));
6130 }
6131
6132 bitmask = _mesa_material_bitmask(ctx, face, pname, ~0, NULL);
6133
6134 /* Try to eliminate redundant statechanges. Because it is legal to
6135 * call glMaterial even inside begin/end calls, don't need to worry
6136 * about ctx->Driver.CurrentSavePrimitive here.
6137 */
6138 for (i = 0; i < MAT_ATTRIB_MAX; i++) {
6139 if (bitmask & (1 << i)) {
6140 if (ctx->ListState.ActiveMaterialSize[i] == args &&
6141 compare_vec(ctx->ListState.CurrentMaterial[i], param, args)) {
6142 /* no change in material value */
6143 bitmask &= ~(1 << i);
6144 }
6145 else {
6146 ctx->ListState.ActiveMaterialSize[i] = args;
6147 COPY_SZ_4V(ctx->ListState.CurrentMaterial[i], args, param);
6148 }
6149 }
6150 }
6151
6152 /* If this call has no effect, return early */
6153 if (bitmask == 0)
6154 return;
6155
6156 SAVE_FLUSH_VERTICES(ctx);
6157
6158 n = alloc_instruction(ctx, OPCODE_MATERIAL, 6);
6159 if (n) {
6160 n[1].e = face;
6161 n[2].e = pname;
6162 for (i = 0; i < args; i++)
6163 n[3 + i].f = param[i];
6164 }
6165 }
6166
6167 static void GLAPIENTRY
6168 save_Begin(GLenum mode)
6169 {
6170 GET_CURRENT_CONTEXT(ctx);
6171
6172 if (!_mesa_is_valid_prim_mode(ctx, mode)) {
6173 /* compile this error into the display list */
6174 _mesa_compile_error(ctx, GL_INVALID_ENUM, "glBegin(mode)");
6175 }
6176 else if (_mesa_inside_dlist_begin_end(ctx)) {
6177 /* compile this error into the display list */
6178 _mesa_compile_error(ctx, GL_INVALID_OPERATION, "recursive glBegin");
6179 }
6180 else {
6181 ctx->Driver.CurrentSavePrimitive = mode;
6182
6183 vbo_save_NotifyBegin(ctx, mode, false);
6184 }
6185 }
6186
6187 static void GLAPIENTRY
6188 save_End(void)
6189 {
6190 GET_CURRENT_CONTEXT(ctx);
6191 SAVE_FLUSH_VERTICES(ctx);
6192 (void) alloc_instruction(ctx, OPCODE_END, 0);
6193 ctx->Driver.CurrentSavePrimitive = PRIM_OUTSIDE_BEGIN_END;
6194 if (ctx->ExecuteFlag) {
6195 CALL_End(ctx->Exec, ());
6196 }
6197 }
6198
6199 static void GLAPIENTRY
6200 save_Rectf(GLfloat a, GLfloat b, GLfloat c, GLfloat d)
6201 {
6202 GET_CURRENT_CONTEXT(ctx);
6203 Node *n;
6204 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6205 n = alloc_instruction(ctx, OPCODE_RECTF, 4);
6206 if (n) {
6207 n[1].f = a;
6208 n[2].f = b;
6209 n[3].f = c;
6210 n[4].f = d;
6211 }
6212 if (ctx->ExecuteFlag) {
6213 CALL_Rectf(ctx->Exec, (a, b, c, d));
6214 }
6215 }
6216
6217
6218 static void GLAPIENTRY
6219 save_Vertex2f(GLfloat x, GLfloat y)
6220 {
6221 save_Attr2fNV(VERT_ATTRIB_POS, x, y);
6222 }
6223
6224 static void GLAPIENTRY
6225 save_Vertex2fv(const GLfloat * v)
6226 {
6227 save_Attr2fNV(VERT_ATTRIB_POS, v[0], v[1]);
6228 }
6229
6230 static void GLAPIENTRY
6231 save_Vertex3f(GLfloat x, GLfloat y, GLfloat z)
6232 {
6233 save_Attr3fNV(VERT_ATTRIB_POS, x, y, z);
6234 }
6235
6236 static void GLAPIENTRY
6237 save_Vertex3fv(const GLfloat * v)
6238 {
6239 save_Attr3fNV(VERT_ATTRIB_POS, v[0], v[1], v[2]);
6240 }
6241
6242 static void GLAPIENTRY
6243 save_Vertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
6244 {
6245 save_Attr4fNV(VERT_ATTRIB_POS, x, y, z, w);
6246 }
6247
6248 static void GLAPIENTRY
6249 save_Vertex4fv(const GLfloat * v)
6250 {
6251 save_Attr4fNV(VERT_ATTRIB_POS, v[0], v[1], v[2], v[3]);
6252 }
6253
6254 static void GLAPIENTRY
6255 save_TexCoord1f(GLfloat x)
6256 {
6257 save_Attr1fNV(VERT_ATTRIB_TEX0, x);
6258 }
6259
6260 static void GLAPIENTRY
6261 save_TexCoord1fv(const GLfloat * v)
6262 {
6263 save_Attr1fNV(VERT_ATTRIB_TEX0, v[0]);
6264 }
6265
6266 static void GLAPIENTRY
6267 save_TexCoord2f(GLfloat x, GLfloat y)
6268 {
6269 save_Attr2fNV(VERT_ATTRIB_TEX0, x, y);
6270 }
6271
6272 static void GLAPIENTRY
6273 save_TexCoord2fv(const GLfloat * v)
6274 {
6275 save_Attr2fNV(VERT_ATTRIB_TEX0, v[0], v[1]);
6276 }
6277
6278 static void GLAPIENTRY
6279 save_TexCoord3f(GLfloat x, GLfloat y, GLfloat z)
6280 {
6281 save_Attr3fNV(VERT_ATTRIB_TEX0, x, y, z);
6282 }
6283
6284 static void GLAPIENTRY
6285 save_TexCoord3fv(const GLfloat * v)
6286 {
6287 save_Attr3fNV(VERT_ATTRIB_TEX0, v[0], v[1], v[2]);
6288 }
6289
6290 static void GLAPIENTRY
6291 save_TexCoord4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
6292 {
6293 save_Attr4fNV(VERT_ATTRIB_TEX0, x, y, z, w);
6294 }
6295
6296 static void GLAPIENTRY
6297 save_TexCoord4fv(const GLfloat * v)
6298 {
6299 save_Attr4fNV(VERT_ATTRIB_TEX0, v[0], v[1], v[2], v[3]);
6300 }
6301
6302 static void GLAPIENTRY
6303 save_Normal3f(GLfloat x, GLfloat y, GLfloat z)
6304 {
6305 save_Attr3fNV(VERT_ATTRIB_NORMAL, x, y, z);
6306 }
6307
6308 static void GLAPIENTRY
6309 save_Normal3fv(const GLfloat * v)
6310 {
6311 save_Attr3fNV(VERT_ATTRIB_NORMAL, v[0], v[1], v[2]);
6312 }
6313
6314 static void GLAPIENTRY
6315 save_FogCoordfEXT(GLfloat x)
6316 {
6317 save_Attr1fNV(VERT_ATTRIB_FOG, x);
6318 }
6319
6320 static void GLAPIENTRY
6321 save_FogCoordfvEXT(const GLfloat * v)
6322 {
6323 save_Attr1fNV(VERT_ATTRIB_FOG, v[0]);
6324 }
6325
6326 static void GLAPIENTRY
6327 save_Color3f(GLfloat x, GLfloat y, GLfloat z)
6328 {
6329 save_Attr3fNV(VERT_ATTRIB_COLOR0, x, y, z);
6330 }
6331
6332 static void GLAPIENTRY
6333 save_Color3fv(const GLfloat * v)
6334 {
6335 save_Attr3fNV(VERT_ATTRIB_COLOR0, v[0], v[1], v[2]);
6336 }
6337
6338 static void GLAPIENTRY
6339 save_Color4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
6340 {
6341 save_Attr4fNV(VERT_ATTRIB_COLOR0, x, y, z, w);
6342 }
6343
6344 static void GLAPIENTRY
6345 save_Color4fv(const GLfloat * v)
6346 {
6347 save_Attr4fNV(VERT_ATTRIB_COLOR0, v[0], v[1], v[2], v[3]);
6348 }
6349
6350 static void GLAPIENTRY
6351 save_SecondaryColor3fEXT(GLfloat x, GLfloat y, GLfloat z)
6352 {
6353 save_Attr3fNV(VERT_ATTRIB_COLOR1, x, y, z);
6354 }
6355
6356 static void GLAPIENTRY
6357 save_SecondaryColor3fvEXT(const GLfloat * v)
6358 {
6359 save_Attr3fNV(VERT_ATTRIB_COLOR1, v[0], v[1], v[2]);
6360 }
6361
6362
6363 /* Just call the respective ATTR for texcoord
6364 */
6365 static void GLAPIENTRY
6366 save_MultiTexCoord1f(GLenum target, GLfloat x)
6367 {
6368 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6369 save_Attr1fNV(attr, x);
6370 }
6371
6372 static void GLAPIENTRY
6373 save_MultiTexCoord1fv(GLenum target, const GLfloat * v)
6374 {
6375 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6376 save_Attr1fNV(attr, v[0]);
6377 }
6378
6379 static void GLAPIENTRY
6380 save_MultiTexCoord2f(GLenum target, GLfloat x, GLfloat y)
6381 {
6382 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6383 save_Attr2fNV(attr, x, y);
6384 }
6385
6386 static void GLAPIENTRY
6387 save_MultiTexCoord2fv(GLenum target, const GLfloat * v)
6388 {
6389 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6390 save_Attr2fNV(attr, v[0], v[1]);
6391 }
6392
6393 static void GLAPIENTRY
6394 save_MultiTexCoord3f(GLenum target, GLfloat x, GLfloat y, GLfloat z)
6395 {
6396 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6397 save_Attr3fNV(attr, x, y, z);
6398 }
6399
6400 static void GLAPIENTRY
6401 save_MultiTexCoord3fv(GLenum target, const GLfloat * v)
6402 {
6403 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6404 save_Attr3fNV(attr, v[0], v[1], v[2]);
6405 }
6406
6407 static void GLAPIENTRY
6408 save_MultiTexCoord4f(GLenum target, GLfloat x, GLfloat y,
6409 GLfloat z, GLfloat w)
6410 {
6411 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6412 save_Attr4fNV(attr, x, y, z, w);
6413 }
6414
6415 static void GLAPIENTRY
6416 save_MultiTexCoord4fv(GLenum target, const GLfloat * v)
6417 {
6418 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6419 save_Attr4fNV(attr, v[0], v[1], v[2], v[3]);
6420 }
6421
6422
6423 /**
6424 * Record a GL_INVALID_VALUE error when an invalid vertex attribute
6425 * index is found.
6426 */
6427 static void
6428 index_error(void)
6429 {
6430 GET_CURRENT_CONTEXT(ctx);
6431 _mesa_error(ctx, GL_INVALID_VALUE, "VertexAttribf(index)");
6432 }
6433
6434
6435
6436 static void GLAPIENTRY
6437 save_VertexAttrib1fARB(GLuint index, GLfloat x)
6438 {
6439 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6440 save_Attr1fARB(index, x);
6441 else
6442 index_error();
6443 }
6444
6445 static void GLAPIENTRY
6446 save_VertexAttrib1fvARB(GLuint index, const GLfloat * v)
6447 {
6448 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6449 save_Attr1fARB(index, v[0]);
6450 else
6451 index_error();
6452 }
6453
6454 static void GLAPIENTRY
6455 save_VertexAttrib2fARB(GLuint index, GLfloat x, GLfloat y)
6456 {
6457 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6458 save_Attr2fARB(index, x, y);
6459 else
6460 index_error();
6461 }
6462
6463 static void GLAPIENTRY
6464 save_VertexAttrib2fvARB(GLuint index, const GLfloat * v)
6465 {
6466 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6467 save_Attr2fARB(index, v[0], v[1]);
6468 else
6469 index_error();
6470 }
6471
6472 static void GLAPIENTRY
6473 save_VertexAttrib3fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z)
6474 {
6475 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6476 save_Attr3fARB(index, x, y, z);
6477 else
6478 index_error();
6479 }
6480
6481 static void GLAPIENTRY
6482 save_VertexAttrib3fvARB(GLuint index, const GLfloat * v)
6483 {
6484 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6485 save_Attr3fARB(index, v[0], v[1], v[2]);
6486 else
6487 index_error();
6488 }
6489
6490 static void GLAPIENTRY
6491 save_VertexAttrib4fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z,
6492 GLfloat w)
6493 {
6494 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6495 save_Attr4fARB(index, x, y, z, w);
6496 else
6497 index_error();
6498 }
6499
6500 static void GLAPIENTRY
6501 save_VertexAttrib4fvARB(GLuint index, const GLfloat * v)
6502 {
6503 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6504 save_Attr4fARB(index, v[0], v[1], v[2], v[3]);
6505 else
6506 index_error();
6507 }
6508
6509 static void GLAPIENTRY
6510 save_VertexAttribL1d(GLuint index, GLdouble x)
6511 {
6512 GET_CURRENT_CONTEXT(ctx);
6513
6514 if (index < MAX_VERTEX_GENERIC_ATTRIBS) {
6515 Node *n;
6516 SAVE_FLUSH_VERTICES(ctx);
6517 n = alloc_instruction(ctx, OPCODE_ATTR_1D, 3);
6518 if (n) {
6519 n[1].ui = index;
6520 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
6521 }
6522
6523 ctx->ListState.ActiveAttribSize[index] = 1;
6524 memcpy(ctx->ListState.CurrentAttrib[index], &n[2], sizeof(GLdouble));
6525
6526 if (ctx->ExecuteFlag) {
6527 CALL_VertexAttribL1d(ctx->Exec, (index, x));
6528 }
6529 } else {
6530 index_error();
6531 }
6532 }
6533
6534 static void GLAPIENTRY
6535 save_VertexAttribL1dv(GLuint index, const GLdouble *v)
6536 {
6537 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6538 save_VertexAttribL1d(index, v[0]);
6539 else
6540 index_error();
6541 }
6542
6543 static void GLAPIENTRY
6544 save_VertexAttribL2d(GLuint index, GLdouble x, GLdouble y)
6545 {
6546 GET_CURRENT_CONTEXT(ctx);
6547
6548 if (index < MAX_VERTEX_GENERIC_ATTRIBS) {
6549 Node *n;
6550 SAVE_FLUSH_VERTICES(ctx);
6551 n = alloc_instruction(ctx, OPCODE_ATTR_2D, 5);
6552 if (n) {
6553 n[1].ui = index;
6554 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
6555 ASSIGN_DOUBLE_TO_NODES(n, 4, y);
6556 }
6557
6558 ctx->ListState.ActiveAttribSize[index] = 2;
6559 memcpy(ctx->ListState.CurrentAttrib[index], &n[2],
6560 2 * sizeof(GLdouble));
6561
6562 if (ctx->ExecuteFlag) {
6563 CALL_VertexAttribL2d(ctx->Exec, (index, x, y));
6564 }
6565 } else {
6566 index_error();
6567 }
6568 }
6569
6570 static void GLAPIENTRY
6571 save_VertexAttribL2dv(GLuint index, const GLdouble *v)
6572 {
6573 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6574 save_VertexAttribL2d(index, v[0], v[1]);
6575 else
6576 index_error();
6577 }
6578
6579 static void GLAPIENTRY
6580 save_VertexAttribL3d(GLuint index, GLdouble x, GLdouble y, GLdouble z)
6581 {
6582 GET_CURRENT_CONTEXT(ctx);
6583
6584 if (index < MAX_VERTEX_GENERIC_ATTRIBS) {
6585 Node *n;
6586 SAVE_FLUSH_VERTICES(ctx);
6587 n = alloc_instruction(ctx, OPCODE_ATTR_3D, 7);
6588 if (n) {
6589 n[1].ui = index;
6590 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
6591 ASSIGN_DOUBLE_TO_NODES(n, 4, y);
6592 ASSIGN_DOUBLE_TO_NODES(n, 6, z);
6593 }
6594
6595 ctx->ListState.ActiveAttribSize[index] = 3;
6596 memcpy(ctx->ListState.CurrentAttrib[index], &n[2],
6597 3 * sizeof(GLdouble));
6598
6599 if (ctx->ExecuteFlag) {
6600 CALL_VertexAttribL3d(ctx->Exec, (index, x, y, z));
6601 }
6602 } else {
6603 index_error();
6604 }
6605 }
6606
6607 static void GLAPIENTRY
6608 save_VertexAttribL3dv(GLuint index, const GLdouble *v)
6609 {
6610 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6611 save_VertexAttribL3d(index, v[0], v[1], v[2]);
6612 else
6613 index_error();
6614 }
6615
6616 static void GLAPIENTRY
6617 save_VertexAttribL4d(GLuint index, GLdouble x, GLdouble y, GLdouble z,
6618 GLdouble w)
6619 {
6620 GET_CURRENT_CONTEXT(ctx);
6621
6622 if (index < MAX_VERTEX_GENERIC_ATTRIBS) {
6623 Node *n;
6624 SAVE_FLUSH_VERTICES(ctx);
6625 n = alloc_instruction(ctx, OPCODE_ATTR_4D, 9);
6626 if (n) {
6627 n[1].ui = index;
6628 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
6629 ASSIGN_DOUBLE_TO_NODES(n, 4, y);
6630 ASSIGN_DOUBLE_TO_NODES(n, 6, z);
6631 ASSIGN_DOUBLE_TO_NODES(n, 8, w);
6632 }
6633
6634 ctx->ListState.ActiveAttribSize[index] = 4;
6635 memcpy(ctx->ListState.CurrentAttrib[index], &n[2],
6636 4 * sizeof(GLdouble));
6637
6638 if (ctx->ExecuteFlag) {
6639 CALL_VertexAttribL4d(ctx->Exec, (index, x, y, z, w));
6640 }
6641 } else {
6642 index_error();
6643 }
6644 }
6645
6646 static void GLAPIENTRY
6647 save_VertexAttribL4dv(GLuint index, const GLdouble *v)
6648 {
6649 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6650 save_VertexAttribL4d(index, v[0], v[1], v[2], v[3]);
6651 else
6652 index_error();
6653 }
6654
6655 static void GLAPIENTRY
6656 save_PrimitiveRestartNV(void)
6657 {
6658 /* Note: this is used when outside a glBegin/End pair in a display list */
6659 GET_CURRENT_CONTEXT(ctx);
6660 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6661 (void) alloc_instruction(ctx, OPCODE_PRIMITIVE_RESTART_NV, 0);
6662 if (ctx->ExecuteFlag) {
6663 CALL_PrimitiveRestartNV(ctx->Exec, ());
6664 }
6665 }
6666
6667
6668 static void GLAPIENTRY
6669 save_BlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
6670 GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
6671 GLbitfield mask, GLenum filter)
6672 {
6673 GET_CURRENT_CONTEXT(ctx);
6674 Node *n;
6675 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6676 n = alloc_instruction(ctx, OPCODE_BLIT_FRAMEBUFFER, 10);
6677 if (n) {
6678 n[1].i = srcX0;
6679 n[2].i = srcY0;
6680 n[3].i = srcX1;
6681 n[4].i = srcY1;
6682 n[5].i = dstX0;
6683 n[6].i = dstY0;
6684 n[7].i = dstX1;
6685 n[8].i = dstY1;
6686 n[9].i = mask;
6687 n[10].e = filter;
6688 }
6689 if (ctx->ExecuteFlag) {
6690 CALL_BlitFramebuffer(ctx->Exec, (srcX0, srcY0, srcX1, srcY1,
6691 dstX0, dstY0, dstX1, dstY1,
6692 mask, filter));
6693 }
6694 }
6695
6696
6697 /** GL_EXT_provoking_vertex */
6698 static void GLAPIENTRY
6699 save_ProvokingVertexEXT(GLenum mode)
6700 {
6701 GET_CURRENT_CONTEXT(ctx);
6702 Node *n;
6703 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6704 n = alloc_instruction(ctx, OPCODE_PROVOKING_VERTEX, 1);
6705 if (n) {
6706 n[1].e = mode;
6707 }
6708 if (ctx->ExecuteFlag) {
6709 /*CALL_ProvokingVertex(ctx->Exec, (mode));*/
6710 _mesa_ProvokingVertex(mode);
6711 }
6712 }
6713
6714
6715 /** GL_EXT_transform_feedback */
6716 static void GLAPIENTRY
6717 save_BeginTransformFeedback(GLenum mode)
6718 {
6719 GET_CURRENT_CONTEXT(ctx);
6720 Node *n;
6721 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6722 n = alloc_instruction(ctx, OPCODE_BEGIN_TRANSFORM_FEEDBACK, 1);
6723 if (n) {
6724 n[1].e = mode;
6725 }
6726 if (ctx->ExecuteFlag) {
6727 CALL_BeginTransformFeedback(ctx->Exec, (mode));
6728 }
6729 }
6730
6731
6732 /** GL_EXT_transform_feedback */
6733 static void GLAPIENTRY
6734 save_EndTransformFeedback(void)
6735 {
6736 GET_CURRENT_CONTEXT(ctx);
6737 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6738 (void) alloc_instruction(ctx, OPCODE_END_TRANSFORM_FEEDBACK, 0);
6739 if (ctx->ExecuteFlag) {
6740 CALL_EndTransformFeedback(ctx->Exec, ());
6741 }
6742 }
6743
6744 static void GLAPIENTRY
6745 save_BindTransformFeedback(GLenum target, GLuint name)
6746 {
6747 GET_CURRENT_CONTEXT(ctx);
6748 Node *n;
6749 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6750 n = alloc_instruction(ctx, OPCODE_BIND_TRANSFORM_FEEDBACK, 2);
6751 if (n) {
6752 n[1].e = target;
6753 n[2].ui = name;
6754 }
6755 if (ctx->ExecuteFlag) {
6756 CALL_BindTransformFeedback(ctx->Exec, (target, name));
6757 }
6758 }
6759
6760 static void GLAPIENTRY
6761 save_PauseTransformFeedback(void)
6762 {
6763 GET_CURRENT_CONTEXT(ctx);
6764 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6765 (void) alloc_instruction(ctx, OPCODE_PAUSE_TRANSFORM_FEEDBACK, 0);
6766 if (ctx->ExecuteFlag) {
6767 CALL_PauseTransformFeedback(ctx->Exec, ());
6768 }
6769 }
6770
6771 static void GLAPIENTRY
6772 save_ResumeTransformFeedback(void)
6773 {
6774 GET_CURRENT_CONTEXT(ctx);
6775 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6776 (void) alloc_instruction(ctx, OPCODE_RESUME_TRANSFORM_FEEDBACK, 0);
6777 if (ctx->ExecuteFlag) {
6778 CALL_ResumeTransformFeedback(ctx->Exec, ());
6779 }
6780 }
6781
6782 static void GLAPIENTRY
6783 save_DrawTransformFeedback(GLenum mode, GLuint name)
6784 {
6785 GET_CURRENT_CONTEXT(ctx);
6786 Node *n;
6787 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6788 n = alloc_instruction(ctx, OPCODE_DRAW_TRANSFORM_FEEDBACK, 2);
6789 if (n) {
6790 n[1].e = mode;
6791 n[2].ui = name;
6792 }
6793 if (ctx->ExecuteFlag) {
6794 CALL_DrawTransformFeedback(ctx->Exec, (mode, name));
6795 }
6796 }
6797
6798 static void GLAPIENTRY
6799 save_DrawTransformFeedbackStream(GLenum mode, GLuint name, GLuint stream)
6800 {
6801 GET_CURRENT_CONTEXT(ctx);
6802 Node *n;
6803 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6804 n = alloc_instruction(ctx, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM, 3);
6805 if (n) {
6806 n[1].e = mode;
6807 n[2].ui = name;
6808 n[3].ui = stream;
6809 }
6810 if (ctx->ExecuteFlag) {
6811 CALL_DrawTransformFeedbackStream(ctx->Exec, (mode, name, stream));
6812 }
6813 }
6814
6815 static void GLAPIENTRY
6816 save_DrawTransformFeedbackInstanced(GLenum mode, GLuint name,
6817 GLsizei primcount)
6818 {
6819 GET_CURRENT_CONTEXT(ctx);
6820 Node *n;
6821 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6822 n = alloc_instruction(ctx, OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED, 3);
6823 if (n) {
6824 n[1].e = mode;
6825 n[2].ui = name;
6826 n[3].si = primcount;
6827 }
6828 if (ctx->ExecuteFlag) {
6829 CALL_DrawTransformFeedbackInstanced(ctx->Exec, (mode, name, primcount));
6830 }
6831 }
6832
6833 static void GLAPIENTRY
6834 save_DrawTransformFeedbackStreamInstanced(GLenum mode, GLuint name,
6835 GLuint stream, GLsizei primcount)
6836 {
6837 GET_CURRENT_CONTEXT(ctx);
6838 Node *n;
6839 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6840 n = alloc_instruction(ctx, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED, 4);
6841 if (n) {
6842 n[1].e = mode;
6843 n[2].ui = name;
6844 n[3].ui = stream;
6845 n[4].si = primcount;
6846 }
6847 if (ctx->ExecuteFlag) {
6848 CALL_DrawTransformFeedbackStreamInstanced(ctx->Exec, (mode, name, stream,
6849 primcount));
6850 }
6851 }
6852
6853 static void GLAPIENTRY
6854 save_DispatchCompute(GLuint num_groups_x, GLuint num_groups_y,
6855 GLuint num_groups_z)
6856 {
6857 GET_CURRENT_CONTEXT(ctx);
6858 Node *n;
6859 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6860 n = alloc_instruction(ctx, OPCODE_DISPATCH_COMPUTE, 3);
6861 if (n) {
6862 n[1].ui = num_groups_x;
6863 n[2].ui = num_groups_y;
6864 n[3].ui = num_groups_z;
6865 }
6866 if (ctx->ExecuteFlag) {
6867 CALL_DispatchCompute(ctx->Exec, (num_groups_x, num_groups_y,
6868 num_groups_z));
6869 }
6870 }
6871
6872 static void GLAPIENTRY
6873 save_DispatchComputeIndirect(GLintptr indirect)
6874 {
6875 GET_CURRENT_CONTEXT(ctx);
6876 _mesa_error(ctx, GL_INVALID_OPERATION,
6877 "glDispatchComputeIndirect() during display list compile");
6878 }
6879
6880 static void GLAPIENTRY
6881 save_UseProgram(GLuint program)
6882 {
6883 GET_CURRENT_CONTEXT(ctx);
6884 Node *n;
6885 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6886 n = alloc_instruction(ctx, OPCODE_USE_PROGRAM, 1);
6887 if (n) {
6888 n[1].ui = program;
6889 }
6890 if (ctx->ExecuteFlag) {
6891 CALL_UseProgram(ctx->Exec, (program));
6892 }
6893 }
6894
6895
6896 static void GLAPIENTRY
6897 save_Uniform1fARB(GLint location, GLfloat x)
6898 {
6899 GET_CURRENT_CONTEXT(ctx);
6900 Node *n;
6901 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6902 n = alloc_instruction(ctx, OPCODE_UNIFORM_1F, 2);
6903 if (n) {
6904 n[1].i = location;
6905 n[2].f = x;
6906 }
6907 if (ctx->ExecuteFlag) {
6908 CALL_Uniform1f(ctx->Exec, (location, x));
6909 }
6910 }
6911
6912
6913 static void GLAPIENTRY
6914 save_Uniform2fARB(GLint location, GLfloat x, GLfloat y)
6915 {
6916 GET_CURRENT_CONTEXT(ctx);
6917 Node *n;
6918 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6919 n = alloc_instruction(ctx, OPCODE_UNIFORM_2F, 3);
6920 if (n) {
6921 n[1].i = location;
6922 n[2].f = x;
6923 n[3].f = y;
6924 }
6925 if (ctx->ExecuteFlag) {
6926 CALL_Uniform2f(ctx->Exec, (location, x, y));
6927 }
6928 }
6929
6930
6931 static void GLAPIENTRY
6932 save_Uniform3fARB(GLint location, GLfloat x, GLfloat y, GLfloat z)
6933 {
6934 GET_CURRENT_CONTEXT(ctx);
6935 Node *n;
6936 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6937 n = alloc_instruction(ctx, OPCODE_UNIFORM_3F, 4);
6938 if (n) {
6939 n[1].i = location;
6940 n[2].f = x;
6941 n[3].f = y;
6942 n[4].f = z;
6943 }
6944 if (ctx->ExecuteFlag) {
6945 CALL_Uniform3f(ctx->Exec, (location, x, y, z));
6946 }
6947 }
6948
6949
6950 static void GLAPIENTRY
6951 save_Uniform4fARB(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
6952 {
6953 GET_CURRENT_CONTEXT(ctx);
6954 Node *n;
6955 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6956 n = alloc_instruction(ctx, OPCODE_UNIFORM_4F, 5);
6957 if (n) {
6958 n[1].i = location;
6959 n[2].f = x;
6960 n[3].f = y;
6961 n[4].f = z;
6962 n[5].f = w;
6963 }
6964 if (ctx->ExecuteFlag) {
6965 CALL_Uniform4f(ctx->Exec, (location, x, y, z, w));
6966 }
6967 }
6968
6969
6970 static void GLAPIENTRY
6971 save_Uniform1fvARB(GLint location, GLsizei count, const GLfloat *v)
6972 {
6973 GET_CURRENT_CONTEXT(ctx);
6974 Node *n;
6975 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6976 n = alloc_instruction(ctx, OPCODE_UNIFORM_1FV, 2 + POINTER_DWORDS);
6977 if (n) {
6978 n[1].i = location;
6979 n[2].i = count;
6980 save_pointer(&n[3], memdup(v, count * 1 * sizeof(GLfloat)));
6981 }
6982 if (ctx->ExecuteFlag) {
6983 CALL_Uniform1fv(ctx->Exec, (location, count, v));
6984 }
6985 }
6986
6987 static void GLAPIENTRY
6988 save_Uniform2fvARB(GLint location, GLsizei count, const GLfloat *v)
6989 {
6990 GET_CURRENT_CONTEXT(ctx);
6991 Node *n;
6992 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6993 n = alloc_instruction(ctx, OPCODE_UNIFORM_2FV, 2 + POINTER_DWORDS);
6994 if (n) {
6995 n[1].i = location;
6996 n[2].i = count;
6997 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLfloat)));
6998 }
6999 if (ctx->ExecuteFlag) {
7000 CALL_Uniform2fv(ctx->Exec, (location, count, v));
7001 }
7002 }
7003
7004 static void GLAPIENTRY
7005 save_Uniform3fvARB(GLint location, GLsizei count, const GLfloat *v)
7006 {
7007 GET_CURRENT_CONTEXT(ctx);
7008 Node *n;
7009 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7010 n = alloc_instruction(ctx, OPCODE_UNIFORM_3FV, 2 + POINTER_DWORDS);
7011 if (n) {
7012 n[1].i = location;
7013 n[2].i = count;
7014 save_pointer(&n[3], memdup(v, count * 3 * sizeof(GLfloat)));
7015 }
7016 if (ctx->ExecuteFlag) {
7017 CALL_Uniform3fv(ctx->Exec, (location, count, v));
7018 }
7019 }
7020
7021 static void GLAPIENTRY
7022 save_Uniform4fvARB(GLint location, GLsizei count, const GLfloat *v)
7023 {
7024 GET_CURRENT_CONTEXT(ctx);
7025 Node *n;
7026 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7027 n = alloc_instruction(ctx, OPCODE_UNIFORM_4FV, 2 + POINTER_DWORDS);
7028 if (n) {
7029 n[1].i = location;
7030 n[2].i = count;
7031 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLfloat)));
7032 }
7033 if (ctx->ExecuteFlag) {
7034 CALL_Uniform4fv(ctx->Exec, (location, count, v));
7035 }
7036 }
7037
7038
7039 static void GLAPIENTRY
7040 save_Uniform1d(GLint location, GLdouble x)
7041 {
7042 GET_CURRENT_CONTEXT(ctx);
7043 Node *n;
7044 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7045 n = alloc_instruction(ctx, OPCODE_UNIFORM_1D, 3);
7046 if (n) {
7047 n[1].i = location;
7048 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
7049 }
7050 if (ctx->ExecuteFlag) {
7051 CALL_Uniform1d(ctx->Exec, (location, x));
7052 }
7053 }
7054
7055
7056 static void GLAPIENTRY
7057 save_Uniform2d(GLint location, GLdouble x, GLdouble y)
7058 {
7059 GET_CURRENT_CONTEXT(ctx);
7060 Node *n;
7061 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7062 n = alloc_instruction(ctx, OPCODE_UNIFORM_2D, 5);
7063 if (n) {
7064 n[1].i = location;
7065 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
7066 ASSIGN_DOUBLE_TO_NODES(n, 4, y);
7067 }
7068 if (ctx->ExecuteFlag) {
7069 CALL_Uniform2d(ctx->Exec, (location, x, y));
7070 }
7071 }
7072
7073
7074 static void GLAPIENTRY
7075 save_Uniform3d(GLint location, GLdouble x, GLdouble y, GLdouble z)
7076 {
7077 GET_CURRENT_CONTEXT(ctx);
7078 Node *n;
7079 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7080 n = alloc_instruction(ctx, OPCODE_UNIFORM_3D, 7);
7081 if (n) {
7082 n[1].i = location;
7083 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
7084 ASSIGN_DOUBLE_TO_NODES(n, 4, y);
7085 ASSIGN_DOUBLE_TO_NODES(n, 6, z);
7086 }
7087 if (ctx->ExecuteFlag) {
7088 CALL_Uniform3d(ctx->Exec, (location, x, y, z));
7089 }
7090 }
7091
7092
7093 static void GLAPIENTRY
7094 save_Uniform4d(GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
7095 {
7096 GET_CURRENT_CONTEXT(ctx);
7097 Node *n;
7098 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7099 n = alloc_instruction(ctx, OPCODE_UNIFORM_4D, 9);
7100 if (n) {
7101 n[1].i = location;
7102 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
7103 ASSIGN_DOUBLE_TO_NODES(n, 4, y);
7104 ASSIGN_DOUBLE_TO_NODES(n, 6, z);
7105 ASSIGN_DOUBLE_TO_NODES(n, 8, w);
7106 }
7107 if (ctx->ExecuteFlag) {
7108 CALL_Uniform4d(ctx->Exec, (location, x, y, z, w));
7109 }
7110 }
7111
7112
7113 static void GLAPIENTRY
7114 save_Uniform1dv(GLint location, GLsizei count, const GLdouble *v)
7115 {
7116 GET_CURRENT_CONTEXT(ctx);
7117 Node *n;
7118 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7119 n = alloc_instruction(ctx, OPCODE_UNIFORM_1DV, 2 + POINTER_DWORDS);
7120 if (n) {
7121 n[1].i = location;
7122 n[2].i = count;
7123 save_pointer(&n[3], memdup(v, count * 1 * sizeof(GLdouble)));
7124 }
7125 if (ctx->ExecuteFlag) {
7126 CALL_Uniform1dv(ctx->Exec, (location, count, v));
7127 }
7128 }
7129
7130
7131 static void GLAPIENTRY
7132 save_Uniform2dv(GLint location, GLsizei count, const GLdouble *v)
7133 {
7134 GET_CURRENT_CONTEXT(ctx);
7135 Node *n;
7136 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7137 n = alloc_instruction(ctx, OPCODE_UNIFORM_2DV, 2 + POINTER_DWORDS);
7138 if (n) {
7139 n[1].i = location;
7140 n[2].i = count;
7141 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLdouble)));
7142 }
7143 if (ctx->ExecuteFlag) {
7144 CALL_Uniform2dv(ctx->Exec, (location, count, v));
7145 }
7146 }
7147
7148
7149 static void GLAPIENTRY
7150 save_Uniform3dv(GLint location, GLsizei count, const GLdouble *v)
7151 {
7152 GET_CURRENT_CONTEXT(ctx);
7153 Node *n;
7154 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7155 n = alloc_instruction(ctx, OPCODE_UNIFORM_3DV, 2 + POINTER_DWORDS);
7156 if (n) {
7157 n[1].i = location;
7158 n[2].i = count;
7159 save_pointer(&n[3], memdup(v, count * 3 * sizeof(GLdouble)));
7160 }
7161 if (ctx->ExecuteFlag) {
7162 CALL_Uniform3dv(ctx->Exec, (location, count, v));
7163 }
7164 }
7165
7166
7167 static void GLAPIENTRY
7168 save_Uniform4dv(GLint location, GLsizei count, const GLdouble *v)
7169 {
7170 GET_CURRENT_CONTEXT(ctx);
7171 Node *n;
7172 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7173 n = alloc_instruction(ctx, OPCODE_UNIFORM_4DV, 2 + POINTER_DWORDS);
7174 if (n) {
7175 n[1].i = location;
7176 n[2].i = count;
7177 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLdouble)));
7178 }
7179 if (ctx->ExecuteFlag) {
7180 CALL_Uniform4dv(ctx->Exec, (location, count, v));
7181 }
7182 }
7183
7184
7185 static void GLAPIENTRY
7186 save_Uniform1iARB(GLint location, GLint x)
7187 {
7188 GET_CURRENT_CONTEXT(ctx);
7189 Node *n;
7190 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7191 n = alloc_instruction(ctx, OPCODE_UNIFORM_1I, 2);
7192 if (n) {
7193 n[1].i = location;
7194 n[2].i = x;
7195 }
7196 if (ctx->ExecuteFlag) {
7197 CALL_Uniform1i(ctx->Exec, (location, x));
7198 }
7199 }
7200
7201 static void GLAPIENTRY
7202 save_Uniform2iARB(GLint location, GLint x, GLint y)
7203 {
7204 GET_CURRENT_CONTEXT(ctx);
7205 Node *n;
7206 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7207 n = alloc_instruction(ctx, OPCODE_UNIFORM_2I, 3);
7208 if (n) {
7209 n[1].i = location;
7210 n[2].i = x;
7211 n[3].i = y;
7212 }
7213 if (ctx->ExecuteFlag) {
7214 CALL_Uniform2i(ctx->Exec, (location, x, y));
7215 }
7216 }
7217
7218 static void GLAPIENTRY
7219 save_Uniform3iARB(GLint location, GLint x, GLint y, GLint z)
7220 {
7221 GET_CURRENT_CONTEXT(ctx);
7222 Node *n;
7223 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7224 n = alloc_instruction(ctx, OPCODE_UNIFORM_3I, 4);
7225 if (n) {
7226 n[1].i = location;
7227 n[2].i = x;
7228 n[3].i = y;
7229 n[4].i = z;
7230 }
7231 if (ctx->ExecuteFlag) {
7232 CALL_Uniform3i(ctx->Exec, (location, x, y, z));
7233 }
7234 }
7235
7236 static void GLAPIENTRY
7237 save_Uniform4iARB(GLint location, GLint x, GLint y, GLint z, GLint w)
7238 {
7239 GET_CURRENT_CONTEXT(ctx);
7240 Node *n;
7241 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7242 n = alloc_instruction(ctx, OPCODE_UNIFORM_4I, 5);
7243 if (n) {
7244 n[1].i = location;
7245 n[2].i = x;
7246 n[3].i = y;
7247 n[4].i = z;
7248 n[5].i = w;
7249 }
7250 if (ctx->ExecuteFlag) {
7251 CALL_Uniform4i(ctx->Exec, (location, x, y, z, w));
7252 }
7253 }
7254
7255
7256
7257 static void GLAPIENTRY
7258 save_Uniform1ivARB(GLint location, GLsizei count, const GLint *v)
7259 {
7260 GET_CURRENT_CONTEXT(ctx);
7261 Node *n;
7262 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7263 n = alloc_instruction(ctx, OPCODE_UNIFORM_1IV, 2 + POINTER_DWORDS);
7264 if (n) {
7265 n[1].i = location;
7266 n[2].i = count;
7267 save_pointer(&n[3], memdup(v, count * 1 * sizeof(GLint)));
7268 }
7269 if (ctx->ExecuteFlag) {
7270 CALL_Uniform1iv(ctx->Exec, (location, count, v));
7271 }
7272 }
7273
7274 static void GLAPIENTRY
7275 save_Uniform2ivARB(GLint location, GLsizei count, const GLint *v)
7276 {
7277 GET_CURRENT_CONTEXT(ctx);
7278 Node *n;
7279 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7280 n = alloc_instruction(ctx, OPCODE_UNIFORM_2IV, 2 + POINTER_DWORDS);
7281 if (n) {
7282 n[1].i = location;
7283 n[2].i = count;
7284 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLint)));
7285 }
7286 if (ctx->ExecuteFlag) {
7287 CALL_Uniform2iv(ctx->Exec, (location, count, v));
7288 }
7289 }
7290
7291 static void GLAPIENTRY
7292 save_Uniform3ivARB(GLint location, GLsizei count, const GLint *v)
7293 {
7294 GET_CURRENT_CONTEXT(ctx);
7295 Node *n;
7296 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7297 n = alloc_instruction(ctx, OPCODE_UNIFORM_3IV, 2 + POINTER_DWORDS);
7298 if (n) {
7299 n[1].i = location;
7300 n[2].i = count;
7301 save_pointer(&n[3], memdup(v, count * 3 * sizeof(GLint)));
7302 }
7303 if (ctx->ExecuteFlag) {
7304 CALL_Uniform3iv(ctx->Exec, (location, count, v));
7305 }
7306 }
7307
7308 static void GLAPIENTRY
7309 save_Uniform4ivARB(GLint location, GLsizei count, const GLint *v)
7310 {
7311 GET_CURRENT_CONTEXT(ctx);
7312 Node *n;
7313 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7314 n = alloc_instruction(ctx, OPCODE_UNIFORM_4IV, 2 + POINTER_DWORDS);
7315 if (n) {
7316 n[1].i = location;
7317 n[2].i = count;
7318 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLfloat)));
7319 }
7320 if (ctx->ExecuteFlag) {
7321 CALL_Uniform4iv(ctx->Exec, (location, count, v));
7322 }
7323 }
7324
7325
7326
7327 static void GLAPIENTRY
7328 save_Uniform1ui(GLint location, GLuint x)
7329 {
7330 GET_CURRENT_CONTEXT(ctx);
7331 Node *n;
7332 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7333 n = alloc_instruction(ctx, OPCODE_UNIFORM_1UI, 2);
7334 if (n) {
7335 n[1].i = location;
7336 n[2].i = x;
7337 }
7338 if (ctx->ExecuteFlag) {
7339 CALL_Uniform1ui(ctx->Exec, (location, x));
7340 }
7341 }
7342
7343 static void GLAPIENTRY
7344 save_Uniform2ui(GLint location, GLuint x, GLuint y)
7345 {
7346 GET_CURRENT_CONTEXT(ctx);
7347 Node *n;
7348 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7349 n = alloc_instruction(ctx, OPCODE_UNIFORM_2UI, 3);
7350 if (n) {
7351 n[1].i = location;
7352 n[2].i = x;
7353 n[3].i = y;
7354 }
7355 if (ctx->ExecuteFlag) {
7356 CALL_Uniform2ui(ctx->Exec, (location, x, y));
7357 }
7358 }
7359
7360 static void GLAPIENTRY
7361 save_Uniform3ui(GLint location, GLuint x, GLuint y, GLuint z)
7362 {
7363 GET_CURRENT_CONTEXT(ctx);
7364 Node *n;
7365 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7366 n = alloc_instruction(ctx, OPCODE_UNIFORM_3UI, 4);
7367 if (n) {
7368 n[1].i = location;
7369 n[2].i = x;
7370 n[3].i = y;
7371 n[4].i = z;
7372 }
7373 if (ctx->ExecuteFlag) {
7374 CALL_Uniform3ui(ctx->Exec, (location, x, y, z));
7375 }
7376 }
7377
7378 static void GLAPIENTRY
7379 save_Uniform4ui(GLint location, GLuint x, GLuint y, GLuint z, GLuint w)
7380 {
7381 GET_CURRENT_CONTEXT(ctx);
7382 Node *n;
7383 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7384 n = alloc_instruction(ctx, OPCODE_UNIFORM_4UI, 5);
7385 if (n) {
7386 n[1].i = location;
7387 n[2].i = x;
7388 n[3].i = y;
7389 n[4].i = z;
7390 n[5].i = w;
7391 }
7392 if (ctx->ExecuteFlag) {
7393 CALL_Uniform4ui(ctx->Exec, (location, x, y, z, w));
7394 }
7395 }
7396
7397
7398
7399 static void GLAPIENTRY
7400 save_Uniform1uiv(GLint location, GLsizei count, const GLuint *v)
7401 {
7402 GET_CURRENT_CONTEXT(ctx);
7403 Node *n;
7404 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7405 n = alloc_instruction(ctx, OPCODE_UNIFORM_1UIV, 2 + POINTER_DWORDS);
7406 if (n) {
7407 n[1].i = location;
7408 n[2].i = count;
7409 save_pointer(&n[3], memdup(v, count * 1 * sizeof(*v)));
7410 }
7411 if (ctx->ExecuteFlag) {
7412 CALL_Uniform1uiv(ctx->Exec, (location, count, v));
7413 }
7414 }
7415
7416 static void GLAPIENTRY
7417 save_Uniform2uiv(GLint location, GLsizei count, const GLuint *v)
7418 {
7419 GET_CURRENT_CONTEXT(ctx);
7420 Node *n;
7421 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7422 n = alloc_instruction(ctx, OPCODE_UNIFORM_2UIV, 2 + POINTER_DWORDS);
7423 if (n) {
7424 n[1].i = location;
7425 n[2].i = count;
7426 save_pointer(&n[3], memdup(v, count * 2 * sizeof(*v)));
7427 }
7428 if (ctx->ExecuteFlag) {
7429 CALL_Uniform2uiv(ctx->Exec, (location, count, v));
7430 }
7431 }
7432
7433 static void GLAPIENTRY
7434 save_Uniform3uiv(GLint location, GLsizei count, const GLuint *v)
7435 {
7436 GET_CURRENT_CONTEXT(ctx);
7437 Node *n;
7438 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7439 n = alloc_instruction(ctx, OPCODE_UNIFORM_3UIV, 2 + POINTER_DWORDS);
7440 if (n) {
7441 n[1].i = location;
7442 n[2].i = count;
7443 save_pointer(&n[3], memdup(v, count * 3 * sizeof(*v)));
7444 }
7445 if (ctx->ExecuteFlag) {
7446 CALL_Uniform3uiv(ctx->Exec, (location, count, v));
7447 }
7448 }
7449
7450 static void GLAPIENTRY
7451 save_Uniform4uiv(GLint location, GLsizei count, const GLuint *v)
7452 {
7453 GET_CURRENT_CONTEXT(ctx);
7454 Node *n;
7455 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7456 n = alloc_instruction(ctx, OPCODE_UNIFORM_4UIV, 2 + POINTER_DWORDS);
7457 if (n) {
7458 n[1].i = location;
7459 n[2].i = count;
7460 save_pointer(&n[3], memdup(v, count * 4 * sizeof(*v)));
7461 }
7462 if (ctx->ExecuteFlag) {
7463 CALL_Uniform4uiv(ctx->Exec, (location, count, v));
7464 }
7465 }
7466
7467
7468
7469 static void GLAPIENTRY
7470 save_UniformMatrix2fvARB(GLint location, GLsizei count, GLboolean transpose,
7471 const GLfloat *m)
7472 {
7473 GET_CURRENT_CONTEXT(ctx);
7474 Node *n;
7475 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7476 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX22, 3 + POINTER_DWORDS);
7477 if (n) {
7478 n[1].i = location;
7479 n[2].i = count;
7480 n[3].b = transpose;
7481 save_pointer(&n[4], memdup(m, count * 2 * 2 * sizeof(GLfloat)));
7482 }
7483 if (ctx->ExecuteFlag) {
7484 CALL_UniformMatrix2fv(ctx->Exec, (location, count, transpose, m));
7485 }
7486 }
7487
7488 static void GLAPIENTRY
7489 save_UniformMatrix3fvARB(GLint location, GLsizei count, GLboolean transpose,
7490 const GLfloat *m)
7491 {
7492 GET_CURRENT_CONTEXT(ctx);
7493 Node *n;
7494 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7495 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX33, 3 + POINTER_DWORDS);
7496 if (n) {
7497 n[1].i = location;
7498 n[2].i = count;
7499 n[3].b = transpose;
7500 save_pointer(&n[4], memdup(m, count * 3 * 3 * sizeof(GLfloat)));
7501 }
7502 if (ctx->ExecuteFlag) {
7503 CALL_UniformMatrix3fv(ctx->Exec, (location, count, transpose, m));
7504 }
7505 }
7506
7507 static void GLAPIENTRY
7508 save_UniformMatrix4fvARB(GLint location, GLsizei count, GLboolean transpose,
7509 const GLfloat *m)
7510 {
7511 GET_CURRENT_CONTEXT(ctx);
7512 Node *n;
7513 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7514 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX44, 3 + POINTER_DWORDS);
7515 if (n) {
7516 n[1].i = location;
7517 n[2].i = count;
7518 n[3].b = transpose;
7519 save_pointer(&n[4], memdup(m, count * 4 * 4 * sizeof(GLfloat)));
7520 }
7521 if (ctx->ExecuteFlag) {
7522 CALL_UniformMatrix4fv(ctx->Exec, (location, count, transpose, m));
7523 }
7524 }
7525
7526
7527 static void GLAPIENTRY
7528 save_UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose,
7529 const GLfloat *m)
7530 {
7531 GET_CURRENT_CONTEXT(ctx);
7532 Node *n;
7533 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7534 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX23, 3 + POINTER_DWORDS);
7535 if (n) {
7536 n[1].i = location;
7537 n[2].i = count;
7538 n[3].b = transpose;
7539 save_pointer(&n[4], memdup(m, count * 2 * 3 * sizeof(GLfloat)));
7540 }
7541 if (ctx->ExecuteFlag) {
7542 CALL_UniformMatrix2x3fv(ctx->Exec, (location, count, transpose, m));
7543 }
7544 }
7545
7546 static void GLAPIENTRY
7547 save_UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose,
7548 const GLfloat *m)
7549 {
7550 GET_CURRENT_CONTEXT(ctx);
7551 Node *n;
7552 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7553 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX32, 3 + POINTER_DWORDS);
7554 if (n) {
7555 n[1].i = location;
7556 n[2].i = count;
7557 n[3].b = transpose;
7558 save_pointer(&n[4], memdup(m, count * 3 * 2 * sizeof(GLfloat)));
7559 }
7560 if (ctx->ExecuteFlag) {
7561 CALL_UniformMatrix3x2fv(ctx->Exec, (location, count, transpose, m));
7562 }
7563 }
7564
7565
7566 static void GLAPIENTRY
7567 save_UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose,
7568 const GLfloat *m)
7569 {
7570 GET_CURRENT_CONTEXT(ctx);
7571 Node *n;
7572 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7573 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX24, 3 + POINTER_DWORDS);
7574 if (n) {
7575 n[1].i = location;
7576 n[2].i = count;
7577 n[3].b = transpose;
7578 save_pointer(&n[4], memdup(m, count * 2 * 4 * sizeof(GLfloat)));
7579 }
7580 if (ctx->ExecuteFlag) {
7581 CALL_UniformMatrix2x4fv(ctx->Exec, (location, count, transpose, m));
7582 }
7583 }
7584
7585 static void GLAPIENTRY
7586 save_UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose,
7587 const GLfloat *m)
7588 {
7589 GET_CURRENT_CONTEXT(ctx);
7590 Node *n;
7591 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7592 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX42, 3 + POINTER_DWORDS);
7593 if (n) {
7594 n[1].i = location;
7595 n[2].i = count;
7596 n[3].b = transpose;
7597 save_pointer(&n[4], memdup(m, count * 4 * 2 * sizeof(GLfloat)));
7598 }
7599 if (ctx->ExecuteFlag) {
7600 CALL_UniformMatrix4x2fv(ctx->Exec, (location, count, transpose, m));
7601 }
7602 }
7603
7604
7605 static void GLAPIENTRY
7606 save_UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose,
7607 const GLfloat *m)
7608 {
7609 GET_CURRENT_CONTEXT(ctx);
7610 Node *n;
7611 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7612 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX34, 3 + POINTER_DWORDS);
7613 if (n) {
7614 n[1].i = location;
7615 n[2].i = count;
7616 n[3].b = transpose;
7617 save_pointer(&n[4], memdup(m, count * 3 * 4 * sizeof(GLfloat)));
7618 }
7619 if (ctx->ExecuteFlag) {
7620 CALL_UniformMatrix3x4fv(ctx->Exec, (location, count, transpose, m));
7621 }
7622 }
7623
7624 static void GLAPIENTRY
7625 save_UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose,
7626 const GLfloat *m)
7627 {
7628 GET_CURRENT_CONTEXT(ctx);
7629 Node *n;
7630 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7631 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX43, 3 + POINTER_DWORDS);
7632 if (n) {
7633 n[1].i = location;
7634 n[2].i = count;
7635 n[3].b = transpose;
7636 save_pointer(&n[4], memdup(m, count * 4 * 3 * sizeof(GLfloat)));
7637 }
7638 if (ctx->ExecuteFlag) {
7639 CALL_UniformMatrix4x3fv(ctx->Exec, (location, count, transpose, m));
7640 }
7641 }
7642
7643
7644 static void GLAPIENTRY
7645 save_UniformMatrix2dv(GLint location, GLsizei count, GLboolean transpose,
7646 const GLdouble *m)
7647 {
7648 GET_CURRENT_CONTEXT(ctx);
7649 Node *n;
7650 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7651 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX22D, 3 + POINTER_DWORDS);
7652 if (n) {
7653 n[1].i = location;
7654 n[2].i = count;
7655 n[3].b = transpose;
7656 save_pointer(&n[4], memdup(m, count * 2 * 2 * sizeof(GLdouble)));
7657 }
7658 if (ctx->ExecuteFlag) {
7659 CALL_UniformMatrix2dv(ctx->Exec, (location, count, transpose, m));
7660 }
7661 }
7662
7663 static void GLAPIENTRY
7664 save_UniformMatrix3dv(GLint location, GLsizei count, GLboolean transpose,
7665 const GLdouble *m)
7666 {
7667 GET_CURRENT_CONTEXT(ctx);
7668 Node *n;
7669 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7670 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX33D, 3 + POINTER_DWORDS);
7671 if (n) {
7672 n[1].i = location;
7673 n[2].i = count;
7674 n[3].b = transpose;
7675 save_pointer(&n[4], memdup(m, count * 3 * 3 * sizeof(GLdouble)));
7676 }
7677 if (ctx->ExecuteFlag) {
7678 CALL_UniformMatrix3dv(ctx->Exec, (location, count, transpose, m));
7679 }
7680 }
7681
7682 static void GLAPIENTRY
7683 save_UniformMatrix4dv(GLint location, GLsizei count, GLboolean transpose,
7684 const GLdouble *m)
7685 {
7686 GET_CURRENT_CONTEXT(ctx);
7687 Node *n;
7688 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7689 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX44D, 3 + POINTER_DWORDS);
7690 if (n) {
7691 n[1].i = location;
7692 n[2].i = count;
7693 n[3].b = transpose;
7694 save_pointer(&n[4], memdup(m, count * 4 * 4 * sizeof(GLdouble)));
7695 }
7696 if (ctx->ExecuteFlag) {
7697 CALL_UniformMatrix4dv(ctx->Exec, (location, count, transpose, m));
7698 }
7699 }
7700
7701
7702 static void GLAPIENTRY
7703 save_UniformMatrix2x3dv(GLint location, GLsizei count, GLboolean transpose,
7704 const GLdouble *m)
7705 {
7706 GET_CURRENT_CONTEXT(ctx);
7707 Node *n;
7708 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7709 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX23D, 3 + POINTER_DWORDS);
7710 if (n) {
7711 n[1].i = location;
7712 n[2].i = count;
7713 n[3].b = transpose;
7714 save_pointer(&n[4], memdup(m, count * 2 * 3 * sizeof(GLdouble)));
7715 }
7716 if (ctx->ExecuteFlag) {
7717 CALL_UniformMatrix2x3dv(ctx->Exec, (location, count, transpose, m));
7718 }
7719 }
7720
7721
7722 static void GLAPIENTRY
7723 save_UniformMatrix3x2dv(GLint location, GLsizei count, GLboolean transpose,
7724 const GLdouble *m)
7725 {
7726 GET_CURRENT_CONTEXT(ctx);
7727 Node *n;
7728 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7729 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX32D, 3 + POINTER_DWORDS);
7730 if (n) {
7731 n[1].i = location;
7732 n[2].i = count;
7733 n[3].b = transpose;
7734 save_pointer(&n[4], memdup(m, count * 3 * 2 * sizeof(GLdouble)));
7735 }
7736 if (ctx->ExecuteFlag) {
7737 CALL_UniformMatrix3x2dv(ctx->Exec, (location, count, transpose, m));
7738 }
7739 }
7740
7741
7742 static void GLAPIENTRY
7743 save_UniformMatrix2x4dv(GLint location, GLsizei count, GLboolean transpose,
7744 const GLdouble *m)
7745 {
7746 GET_CURRENT_CONTEXT(ctx);
7747 Node *n;
7748 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7749 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX24D, 3 + POINTER_DWORDS);
7750 if (n) {
7751 n[1].i = location;
7752 n[2].i = count;
7753 n[3].b = transpose;
7754 save_pointer(&n[4], memdup(m, count * 2 * 4 * sizeof(GLdouble)));
7755 }
7756 if (ctx->ExecuteFlag) {
7757 CALL_UniformMatrix2x4dv(ctx->Exec, (location, count, transpose, m));
7758 }
7759 }
7760
7761 static void GLAPIENTRY
7762 save_UniformMatrix4x2dv(GLint location, GLsizei count, GLboolean transpose,
7763 const GLdouble *m)
7764 {
7765 GET_CURRENT_CONTEXT(ctx);
7766 Node *n;
7767 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7768 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX42D, 3 + POINTER_DWORDS);
7769 if (n) {
7770 n[1].i = location;
7771 n[2].i = count;
7772 n[3].b = transpose;
7773 save_pointer(&n[4], memdup(m, count * 4 * 2 * sizeof(GLdouble)));
7774 }
7775 if (ctx->ExecuteFlag) {
7776 CALL_UniformMatrix4x2dv(ctx->Exec, (location, count, transpose, m));
7777 }
7778 }
7779
7780
7781 static void GLAPIENTRY
7782 save_UniformMatrix3x4dv(GLint location, GLsizei count, GLboolean transpose,
7783 const GLdouble *m)
7784 {
7785 GET_CURRENT_CONTEXT(ctx);
7786 Node *n;
7787 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7788 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX34D, 3 + POINTER_DWORDS);
7789 if (n) {
7790 n[1].i = location;
7791 n[2].i = count;
7792 n[3].b = transpose;
7793 save_pointer(&n[4], memdup(m, count * 3 * 4 * sizeof(GLdouble)));
7794 }
7795 if (ctx->ExecuteFlag) {
7796 CALL_UniformMatrix3x4dv(ctx->Exec, (location, count, transpose, m));
7797 }
7798 }
7799
7800
7801 static void GLAPIENTRY
7802 save_UniformMatrix4x3dv(GLint location, GLsizei count, GLboolean transpose,
7803 const GLdouble *m)
7804 {
7805 GET_CURRENT_CONTEXT(ctx);
7806 Node *n;
7807 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7808 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX43D, 3 + POINTER_DWORDS);
7809 if (n) {
7810 n[1].i = location;
7811 n[2].i = count;
7812 n[3].b = transpose;
7813 save_pointer(&n[4], memdup(m, count * 4 * 3 * sizeof(GLdouble)));
7814 }
7815 if (ctx->ExecuteFlag) {
7816 CALL_UniformMatrix4x3dv(ctx->Exec, (location, count, transpose, m));
7817 }
7818 }
7819
7820
7821 static void GLAPIENTRY
7822 save_UseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program)
7823 {
7824 GET_CURRENT_CONTEXT(ctx);
7825 Node *n;
7826 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7827 n = alloc_instruction(ctx, OPCODE_USE_PROGRAM_STAGES, 3);
7828 if (n) {
7829 n[1].ui = pipeline;
7830 n[2].ui = stages;
7831 n[3].ui = program;
7832 }
7833 if (ctx->ExecuteFlag) {
7834 CALL_UseProgramStages(ctx->Exec, (pipeline, stages, program));
7835 }
7836 }
7837
7838 static void GLAPIENTRY
7839 save_ProgramUniform1f(GLuint program, GLint location, GLfloat x)
7840 {
7841 GET_CURRENT_CONTEXT(ctx);
7842 Node *n;
7843 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7844 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1F, 3);
7845 if (n) {
7846 n[1].ui = program;
7847 n[2].i = location;
7848 n[3].f = x;
7849 }
7850 if (ctx->ExecuteFlag) {
7851 CALL_ProgramUniform1f(ctx->Exec, (program, location, x));
7852 }
7853 }
7854
7855 static void GLAPIENTRY
7856 save_ProgramUniform2f(GLuint program, GLint location, GLfloat x, GLfloat y)
7857 {
7858 GET_CURRENT_CONTEXT(ctx);
7859 Node *n;
7860 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7861 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2F, 4);
7862 if (n) {
7863 n[1].ui = program;
7864 n[2].i = location;
7865 n[3].f = x;
7866 n[4].f = y;
7867 }
7868 if (ctx->ExecuteFlag) {
7869 CALL_ProgramUniform2f(ctx->Exec, (program, location, x, y));
7870 }
7871 }
7872
7873 static void GLAPIENTRY
7874 save_ProgramUniform3f(GLuint program, GLint location,
7875 GLfloat x, GLfloat y, GLfloat z)
7876 {
7877 GET_CURRENT_CONTEXT(ctx);
7878 Node *n;
7879 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7880 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3F, 5);
7881 if (n) {
7882 n[1].ui = program;
7883 n[2].i = location;
7884 n[3].f = x;
7885 n[4].f = y;
7886 n[5].f = z;
7887 }
7888 if (ctx->ExecuteFlag) {
7889 CALL_ProgramUniform3f(ctx->Exec, (program, location, x, y, z));
7890 }
7891 }
7892
7893 static void GLAPIENTRY
7894 save_ProgramUniform4f(GLuint program, GLint location,
7895 GLfloat x, GLfloat y, GLfloat z, GLfloat w)
7896 {
7897 GET_CURRENT_CONTEXT(ctx);
7898 Node *n;
7899 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7900 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4F, 6);
7901 if (n) {
7902 n[1].ui = program;
7903 n[2].i = location;
7904 n[3].f = x;
7905 n[4].f = y;
7906 n[5].f = z;
7907 n[6].f = w;
7908 }
7909 if (ctx->ExecuteFlag) {
7910 CALL_ProgramUniform4f(ctx->Exec, (program, location, x, y, z, w));
7911 }
7912 }
7913
7914 static void GLAPIENTRY
7915 save_ProgramUniform1fv(GLuint program, GLint location, GLsizei count,
7916 const GLfloat *v)
7917 {
7918 GET_CURRENT_CONTEXT(ctx);
7919 Node *n;
7920 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7921 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1FV, 3 + POINTER_DWORDS);
7922 if (n) {
7923 n[1].ui = program;
7924 n[2].i = location;
7925 n[3].i = count;
7926 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLfloat)));
7927 }
7928 if (ctx->ExecuteFlag) {
7929 CALL_ProgramUniform1fv(ctx->Exec, (program, location, count, v));
7930 }
7931 }
7932
7933 static void GLAPIENTRY
7934 save_ProgramUniform2fv(GLuint program, GLint location, GLsizei count,
7935 const GLfloat *v)
7936 {
7937 GET_CURRENT_CONTEXT(ctx);
7938 Node *n;
7939 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7940 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2FV, 3 + POINTER_DWORDS);
7941 if (n) {
7942 n[1].ui = program;
7943 n[2].i = location;
7944 n[3].i = count;
7945 save_pointer(&n[4], memdup(v, count * 2 * sizeof(GLfloat)));
7946 }
7947 if (ctx->ExecuteFlag) {
7948 CALL_ProgramUniform2fv(ctx->Exec, (program, location, count, v));
7949 }
7950 }
7951
7952 static void GLAPIENTRY
7953 save_ProgramUniform3fv(GLuint program, GLint location, GLsizei count,
7954 const GLfloat *v)
7955 {
7956 GET_CURRENT_CONTEXT(ctx);
7957 Node *n;
7958 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7959 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3FV, 3 + POINTER_DWORDS);
7960 if (n) {
7961 n[1].ui = program;
7962 n[2].i = location;
7963 n[3].i = count;
7964 save_pointer(&n[4], memdup(v, count * 3 * sizeof(GLfloat)));
7965 }
7966 if (ctx->ExecuteFlag) {
7967 CALL_ProgramUniform3fv(ctx->Exec, (program, location, count, v));
7968 }
7969 }
7970
7971 static void GLAPIENTRY
7972 save_ProgramUniform4fv(GLuint program, GLint location, GLsizei count,
7973 const GLfloat *v)
7974 {
7975 GET_CURRENT_CONTEXT(ctx);
7976 Node *n;
7977 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7978 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4FV, 3 + POINTER_DWORDS);
7979 if (n) {
7980 n[1].ui = program;
7981 n[2].i = location;
7982 n[3].i = count;
7983 save_pointer(&n[4], memdup(v, count * 4 * sizeof(GLfloat)));
7984 }
7985 if (ctx->ExecuteFlag) {
7986 CALL_ProgramUniform4fv(ctx->Exec, (program, location, count, v));
7987 }
7988 }
7989
7990 static void GLAPIENTRY
7991 save_ProgramUniform1d(GLuint program, GLint location, GLdouble x)
7992 {
7993 GET_CURRENT_CONTEXT(ctx);
7994 Node *n;
7995 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7996 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1D, 4);
7997 if (n) {
7998 n[1].ui = program;
7999 n[2].i = location;
8000 ASSIGN_DOUBLE_TO_NODES(n, 3, x);
8001 }
8002 if (ctx->ExecuteFlag) {
8003 CALL_ProgramUniform1d(ctx->Exec, (program, location, x));
8004 }
8005 }
8006
8007 static void GLAPIENTRY
8008 save_ProgramUniform2d(GLuint program, GLint location, GLdouble x, GLdouble y)
8009 {
8010 GET_CURRENT_CONTEXT(ctx);
8011 Node *n;
8012 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8013 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2D, 6);
8014 if (n) {
8015 n[1].ui = program;
8016 n[2].i = location;
8017 ASSIGN_DOUBLE_TO_NODES(n, 3, x);
8018 ASSIGN_DOUBLE_TO_NODES(n, 5, y);
8019 }
8020 if (ctx->ExecuteFlag) {
8021 CALL_ProgramUniform2d(ctx->Exec, (program, location, x, y));
8022 }
8023 }
8024
8025 static void GLAPIENTRY
8026 save_ProgramUniform3d(GLuint program, GLint location,
8027 GLdouble x, GLdouble y, GLdouble z)
8028 {
8029 GET_CURRENT_CONTEXT(ctx);
8030 Node *n;
8031 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8032 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3D, 8);
8033 if (n) {
8034 n[1].ui = program;
8035 n[2].i = location;
8036 ASSIGN_DOUBLE_TO_NODES(n, 3, x);
8037 ASSIGN_DOUBLE_TO_NODES(n, 5, y);
8038 ASSIGN_DOUBLE_TO_NODES(n, 7, z);
8039 }
8040 if (ctx->ExecuteFlag) {
8041 CALL_ProgramUniform3d(ctx->Exec, (program, location, x, y, z));
8042 }
8043 }
8044
8045 static void GLAPIENTRY
8046 save_ProgramUniform4d(GLuint program, GLint location,
8047 GLdouble x, GLdouble y, GLdouble z, GLdouble w)
8048 {
8049 GET_CURRENT_CONTEXT(ctx);
8050 Node *n;
8051 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8052 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4D, 10);
8053 if (n) {
8054 n[1].ui = program;
8055 n[2].i = location;
8056 ASSIGN_DOUBLE_TO_NODES(n, 3, x);
8057 ASSIGN_DOUBLE_TO_NODES(n, 5, y);
8058 ASSIGN_DOUBLE_TO_NODES(n, 7, z);
8059 ASSIGN_DOUBLE_TO_NODES(n, 9, w);
8060 }
8061 if (ctx->ExecuteFlag) {
8062 CALL_ProgramUniform4d(ctx->Exec, (program, location, x, y, z, w));
8063 }
8064 }
8065
8066 static void GLAPIENTRY
8067 save_ProgramUniform1dv(GLuint program, GLint location, GLsizei count,
8068 const GLdouble *v)
8069 {
8070 GET_CURRENT_CONTEXT(ctx);
8071 Node *n;
8072 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8073 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1DV, 3 + POINTER_DWORDS);
8074 if (n) {
8075 n[1].ui = program;
8076 n[2].i = location;
8077 n[3].i = count;
8078 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLdouble)));
8079 }
8080 if (ctx->ExecuteFlag) {
8081 CALL_ProgramUniform1dv(ctx->Exec, (program, location, count, v));
8082 }
8083 }
8084
8085 static void GLAPIENTRY
8086 save_ProgramUniform2dv(GLuint program, GLint location, GLsizei count,
8087 const GLdouble *v)
8088 {
8089 GET_CURRENT_CONTEXT(ctx);
8090 Node *n;
8091 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8092 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2DV, 3 + POINTER_DWORDS);
8093 if (n) {
8094 n[1].ui = program;
8095 n[2].i = location;
8096 n[3].i = count;
8097 save_pointer(&n[4], memdup(v, count * 2 * sizeof(GLdouble)));
8098 }
8099 if (ctx->ExecuteFlag) {
8100 CALL_ProgramUniform2dv(ctx->Exec, (program, location, count, v));
8101 }
8102 }
8103
8104 static void GLAPIENTRY
8105 save_ProgramUniform3dv(GLuint program, GLint location, GLsizei count,
8106 const GLdouble *v)
8107 {
8108 GET_CURRENT_CONTEXT(ctx);
8109 Node *n;
8110 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8111 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3DV, 3 + POINTER_DWORDS);
8112 if (n) {
8113 n[1].ui = program;
8114 n[2].i = location;
8115 n[3].i = count;
8116 save_pointer(&n[4], memdup(v, count * 3 * sizeof(GLdouble)));
8117 }
8118 if (ctx->ExecuteFlag) {
8119 CALL_ProgramUniform3dv(ctx->Exec, (program, location, count, v));
8120 }
8121 }
8122
8123 static void GLAPIENTRY
8124 save_ProgramUniform4dv(GLuint program, GLint location, GLsizei count,
8125 const GLdouble *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_PROGRAM_UNIFORM_4DV, 3 + POINTER_DWORDS);
8131 if (n) {
8132 n[1].ui = program;
8133 n[2].i = location;
8134 n[3].i = count;
8135 save_pointer(&n[4], memdup(v, count * 4 * sizeof(GLdouble)));
8136 }
8137 if (ctx->ExecuteFlag) {
8138 CALL_ProgramUniform4dv(ctx->Exec, (program, location, count, v));
8139 }
8140 }
8141
8142 static void GLAPIENTRY
8143 save_ProgramUniform1i(GLuint program, GLint location, GLint x)
8144 {
8145 GET_CURRENT_CONTEXT(ctx);
8146 Node *n;
8147 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8148 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1I, 3);
8149 if (n) {
8150 n[1].ui = program;
8151 n[2].i = location;
8152 n[3].i = x;
8153 }
8154 if (ctx->ExecuteFlag) {
8155 CALL_ProgramUniform1i(ctx->Exec, (program, location, x));
8156 }
8157 }
8158
8159 static void GLAPIENTRY
8160 save_ProgramUniform2i(GLuint program, GLint location, GLint x, GLint y)
8161 {
8162 GET_CURRENT_CONTEXT(ctx);
8163 Node *n;
8164 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8165 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2I, 4);
8166 if (n) {
8167 n[1].ui = program;
8168 n[2].i = location;
8169 n[3].i = x;
8170 n[4].i = y;
8171 }
8172 if (ctx->ExecuteFlag) {
8173 CALL_ProgramUniform2i(ctx->Exec, (program, location, x, y));
8174 }
8175 }
8176
8177 static void GLAPIENTRY
8178 save_ProgramUniform3i(GLuint program, GLint location,
8179 GLint x, GLint y, GLint z)
8180 {
8181 GET_CURRENT_CONTEXT(ctx);
8182 Node *n;
8183 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8184 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3I, 5);
8185 if (n) {
8186 n[1].ui = program;
8187 n[2].i = location;
8188 n[3].i = x;
8189 n[4].i = y;
8190 n[5].i = z;
8191 }
8192 if (ctx->ExecuteFlag) {
8193 CALL_ProgramUniform3i(ctx->Exec, (program, location, x, y, z));
8194 }
8195 }
8196
8197 static void GLAPIENTRY
8198 save_ProgramUniform4i(GLuint program, GLint location,
8199 GLint x, GLint y, GLint z, GLint w)
8200 {
8201 GET_CURRENT_CONTEXT(ctx);
8202 Node *n;
8203 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8204 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4I, 6);
8205 if (n) {
8206 n[1].ui = program;
8207 n[2].i = location;
8208 n[3].i = x;
8209 n[4].i = y;
8210 n[5].i = z;
8211 n[6].i = w;
8212 }
8213 if (ctx->ExecuteFlag) {
8214 CALL_ProgramUniform4i(ctx->Exec, (program, location, x, y, z, w));
8215 }
8216 }
8217
8218 static void GLAPIENTRY
8219 save_ProgramUniform1iv(GLuint program, GLint location, GLsizei count,
8220 const GLint *v)
8221 {
8222 GET_CURRENT_CONTEXT(ctx);
8223 Node *n;
8224 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8225 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1IV, 3 + POINTER_DWORDS);
8226 if (n) {
8227 n[1].ui = program;
8228 n[2].i = location;
8229 n[3].i = count;
8230 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLint)));
8231 }
8232 if (ctx->ExecuteFlag) {
8233 CALL_ProgramUniform1iv(ctx->Exec, (program, location, count, v));
8234 }
8235 }
8236
8237 static void GLAPIENTRY
8238 save_ProgramUniform2iv(GLuint program, GLint location, GLsizei count,
8239 const GLint *v)
8240 {
8241 GET_CURRENT_CONTEXT(ctx);
8242 Node *n;
8243 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8244 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2IV, 3 + POINTER_DWORDS);
8245 if (n) {
8246 n[1].ui = program;
8247 n[2].i = location;
8248 n[3].i = count;
8249 save_pointer(&n[4], memdup(v, count * 2 * sizeof(GLint)));
8250 }
8251 if (ctx->ExecuteFlag) {
8252 CALL_ProgramUniform2iv(ctx->Exec, (program, location, count, v));
8253 }
8254 }
8255
8256 static void GLAPIENTRY
8257 save_ProgramUniform3iv(GLuint program, GLint location, GLsizei count,
8258 const GLint *v)
8259 {
8260 GET_CURRENT_CONTEXT(ctx);
8261 Node *n;
8262 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8263 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3IV, 3 + POINTER_DWORDS);
8264 if (n) {
8265 n[1].ui = program;
8266 n[2].i = location;
8267 n[3].i = count;
8268 save_pointer(&n[4], memdup(v, count * 3 * sizeof(GLint)));
8269 }
8270 if (ctx->ExecuteFlag) {
8271 CALL_ProgramUniform3iv(ctx->Exec, (program, location, count, v));
8272 }
8273 }
8274
8275 static void GLAPIENTRY
8276 save_ProgramUniform4iv(GLuint program, GLint location, GLsizei count,
8277 const GLint *v)
8278 {
8279 GET_CURRENT_CONTEXT(ctx);
8280 Node *n;
8281 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8282 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4IV, 3 + POINTER_DWORDS);
8283 if (n) {
8284 n[1].ui = program;
8285 n[2].i = location;
8286 n[3].i = count;
8287 save_pointer(&n[4], memdup(v, count * 4 * sizeof(GLint)));
8288 }
8289 if (ctx->ExecuteFlag) {
8290 CALL_ProgramUniform4iv(ctx->Exec, (program, location, count, v));
8291 }
8292 }
8293
8294 static void GLAPIENTRY
8295 save_ProgramUniform1ui(GLuint program, GLint location, GLuint x)
8296 {
8297 GET_CURRENT_CONTEXT(ctx);
8298 Node *n;
8299 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8300 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1UI, 3);
8301 if (n) {
8302 n[1].ui = program;
8303 n[2].i = location;
8304 n[3].ui = x;
8305 }
8306 if (ctx->ExecuteFlag) {
8307 CALL_ProgramUniform1ui(ctx->Exec, (program, location, x));
8308 }
8309 }
8310
8311 static void GLAPIENTRY
8312 save_ProgramUniform2ui(GLuint program, GLint location, GLuint x, GLuint y)
8313 {
8314 GET_CURRENT_CONTEXT(ctx);
8315 Node *n;
8316 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8317 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2UI, 4);
8318 if (n) {
8319 n[1].ui = program;
8320 n[2].i = location;
8321 n[3].ui = x;
8322 n[4].ui = y;
8323 }
8324 if (ctx->ExecuteFlag) {
8325 CALL_ProgramUniform2ui(ctx->Exec, (program, location, x, y));
8326 }
8327 }
8328
8329 static void GLAPIENTRY
8330 save_ProgramUniform3ui(GLuint program, GLint location,
8331 GLuint x, GLuint y, GLuint z)
8332 {
8333 GET_CURRENT_CONTEXT(ctx);
8334 Node *n;
8335 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8336 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3UI, 5);
8337 if (n) {
8338 n[1].ui = program;
8339 n[2].i = location;
8340 n[3].ui = x;
8341 n[4].ui = y;
8342 n[5].ui = z;
8343 }
8344 if (ctx->ExecuteFlag) {
8345 CALL_ProgramUniform3ui(ctx->Exec, (program, location, x, y, z));
8346 }
8347 }
8348
8349 static void GLAPIENTRY
8350 save_ProgramUniform4ui(GLuint program, GLint location,
8351 GLuint x, GLuint y, GLuint z, GLuint w)
8352 {
8353 GET_CURRENT_CONTEXT(ctx);
8354 Node *n;
8355 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8356 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4UI, 6);
8357 if (n) {
8358 n[1].ui = program;
8359 n[2].i = location;
8360 n[3].ui = x;
8361 n[4].ui = y;
8362 n[5].ui = z;
8363 n[6].ui = w;
8364 }
8365 if (ctx->ExecuteFlag) {
8366 CALL_ProgramUniform4ui(ctx->Exec, (program, location, x, y, z, w));
8367 }
8368 }
8369
8370 static void GLAPIENTRY
8371 save_ProgramUniform1uiv(GLuint program, GLint location, GLsizei count,
8372 const GLuint *v)
8373 {
8374 GET_CURRENT_CONTEXT(ctx);
8375 Node *n;
8376 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8377 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1UIV, 3 + POINTER_DWORDS);
8378 if (n) {
8379 n[1].ui = program;
8380 n[2].i = location;
8381 n[3].i = count;
8382 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLuint)));
8383 }
8384 if (ctx->ExecuteFlag) {
8385 CALL_ProgramUniform1uiv(ctx->Exec, (program, location, count, v));
8386 }
8387 }
8388
8389 static void GLAPIENTRY
8390 save_ProgramUniform2uiv(GLuint program, GLint location, GLsizei count,
8391 const GLuint *v)
8392 {
8393 GET_CURRENT_CONTEXT(ctx);
8394 Node *n;
8395 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8396 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2UIV, 3 + POINTER_DWORDS);
8397 if (n) {
8398 n[1].ui = program;
8399 n[2].i = location;
8400 n[3].i = count;
8401 save_pointer(&n[4], memdup(v, count * 2 * sizeof(GLuint)));
8402 }
8403 if (ctx->ExecuteFlag) {
8404 CALL_ProgramUniform2uiv(ctx->Exec, (program, location, count, v));
8405 }
8406 }
8407
8408 static void GLAPIENTRY
8409 save_ProgramUniform3uiv(GLuint program, GLint location, GLsizei count,
8410 const GLuint *v)
8411 {
8412 GET_CURRENT_CONTEXT(ctx);
8413 Node *n;
8414 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8415 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3UIV, 3 + POINTER_DWORDS);
8416 if (n) {
8417 n[1].ui = program;
8418 n[2].i = location;
8419 n[3].i = count;
8420 save_pointer(&n[4], memdup(v, count * 3 * sizeof(GLuint)));
8421 }
8422 if (ctx->ExecuteFlag) {
8423 CALL_ProgramUniform3uiv(ctx->Exec, (program, location, count, v));
8424 }
8425 }
8426
8427 static void GLAPIENTRY
8428 save_ProgramUniform4uiv(GLuint program, GLint location, GLsizei count,
8429 const GLuint *v)
8430 {
8431 GET_CURRENT_CONTEXT(ctx);
8432 Node *n;
8433 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8434 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4UIV, 3 + POINTER_DWORDS);
8435 if (n) {
8436 n[1].ui = program;
8437 n[2].i = location;
8438 n[3].i = count;
8439 save_pointer(&n[4], memdup(v, count * 4 * sizeof(GLuint)));
8440 }
8441 if (ctx->ExecuteFlag) {
8442 CALL_ProgramUniform4uiv(ctx->Exec, (program, location, count, v));
8443 }
8444 }
8445
8446 static void GLAPIENTRY
8447 save_ProgramUniformMatrix2fv(GLuint program, GLint location, GLsizei count,
8448 GLboolean transpose, const GLfloat *v)
8449 {
8450 GET_CURRENT_CONTEXT(ctx);
8451 Node *n;
8452 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8453 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX22F,
8454 4 + POINTER_DWORDS);
8455 if (n) {
8456 n[1].ui = program;
8457 n[2].i = location;
8458 n[3].i = count;
8459 n[4].b = transpose;
8460 save_pointer(&n[5], memdup(v, count * 2 * 2 * sizeof(GLfloat)));
8461 }
8462 if (ctx->ExecuteFlag) {
8463 CALL_ProgramUniformMatrix2fv(ctx->Exec,
8464 (program, location, count, transpose, v));
8465 }
8466 }
8467
8468 static void GLAPIENTRY
8469 save_ProgramUniformMatrix2x3fv(GLuint program, GLint location, GLsizei count,
8470 GLboolean transpose, const GLfloat *v)
8471 {
8472 GET_CURRENT_CONTEXT(ctx);
8473 Node *n;
8474 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8475 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX23F,
8476 4 + POINTER_DWORDS);
8477 if (n) {
8478 n[1].ui = program;
8479 n[2].i = location;
8480 n[3].i = count;
8481 n[4].b = transpose;
8482 save_pointer(&n[5], memdup(v, count * 2 * 3 * sizeof(GLfloat)));
8483 }
8484 if (ctx->ExecuteFlag) {
8485 CALL_ProgramUniformMatrix2x3fv(ctx->Exec,
8486 (program, location, count, transpose, v));
8487 }
8488 }
8489
8490 static void GLAPIENTRY
8491 save_ProgramUniformMatrix2x4fv(GLuint program, GLint location, GLsizei count,
8492 GLboolean transpose, const GLfloat *v)
8493 {
8494 GET_CURRENT_CONTEXT(ctx);
8495 Node *n;
8496 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8497 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX24F,
8498 4 + POINTER_DWORDS);
8499 if (n) {
8500 n[1].ui = program;
8501 n[2].i = location;
8502 n[3].i = count;
8503 n[4].b = transpose;
8504 save_pointer(&n[5], memdup(v, count * 2 * 4 * sizeof(GLfloat)));
8505 }
8506 if (ctx->ExecuteFlag) {
8507 CALL_ProgramUniformMatrix2x4fv(ctx->Exec,
8508 (program, location, count, transpose, v));
8509 }
8510 }
8511
8512 static void GLAPIENTRY
8513 save_ProgramUniformMatrix3x2fv(GLuint program, GLint location, GLsizei count,
8514 GLboolean transpose, const GLfloat *v)
8515 {
8516 GET_CURRENT_CONTEXT(ctx);
8517 Node *n;
8518 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8519 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX32F,
8520 4 + POINTER_DWORDS);
8521 if (n) {
8522 n[1].ui = program;
8523 n[2].i = location;
8524 n[3].i = count;
8525 n[4].b = transpose;
8526 save_pointer(&n[5], memdup(v, count * 3 * 2 * sizeof(GLfloat)));
8527 }
8528 if (ctx->ExecuteFlag) {
8529 CALL_ProgramUniformMatrix3x2fv(ctx->Exec,
8530 (program, location, count, transpose, v));
8531 }
8532 }
8533
8534 static void GLAPIENTRY
8535 save_ProgramUniformMatrix3fv(GLuint program, GLint location, GLsizei count,
8536 GLboolean transpose, const GLfloat *v)
8537 {
8538 GET_CURRENT_CONTEXT(ctx);
8539 Node *n;
8540 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8541 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX33F,
8542 4 + POINTER_DWORDS);
8543 if (n) {
8544 n[1].ui = program;
8545 n[2].i = location;
8546 n[3].i = count;
8547 n[4].b = transpose;
8548 save_pointer(&n[5], memdup(v, count * 3 * 3 * sizeof(GLfloat)));
8549 }
8550 if (ctx->ExecuteFlag) {
8551 CALL_ProgramUniformMatrix3fv(ctx->Exec,
8552 (program, location, count, transpose, v));
8553 }
8554 }
8555
8556 static void GLAPIENTRY
8557 save_ProgramUniformMatrix3x4fv(GLuint program, GLint location, GLsizei count,
8558 GLboolean transpose, const GLfloat *v)
8559 {
8560 GET_CURRENT_CONTEXT(ctx);
8561 Node *n;
8562 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8563 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX34F,
8564 4 + POINTER_DWORDS);
8565 if (n) {
8566 n[1].ui = program;
8567 n[2].i = location;
8568 n[3].i = count;
8569 n[4].b = transpose;
8570 save_pointer(&n[5], memdup(v, count * 3 * 4 * sizeof(GLfloat)));
8571 }
8572 if (ctx->ExecuteFlag) {
8573 CALL_ProgramUniformMatrix3x4fv(ctx->Exec,
8574 (program, location, count, transpose, v));
8575 }
8576 }
8577
8578 static void GLAPIENTRY
8579 save_ProgramUniformMatrix4x2fv(GLuint program, GLint location, GLsizei count,
8580 GLboolean transpose, const GLfloat *v)
8581 {
8582 GET_CURRENT_CONTEXT(ctx);
8583 Node *n;
8584 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8585 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX42F,
8586 4 + POINTER_DWORDS);
8587 if (n) {
8588 n[1].ui = program;
8589 n[2].i = location;
8590 n[3].i = count;
8591 n[4].b = transpose;
8592 save_pointer(&n[5], memdup(v, count * 4 * 2 * sizeof(GLfloat)));
8593 }
8594 if (ctx->ExecuteFlag) {
8595 CALL_ProgramUniformMatrix4x2fv(ctx->Exec,
8596 (program, location, count, transpose, v));
8597 }
8598 }
8599
8600 static void GLAPIENTRY
8601 save_ProgramUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count,
8602 GLboolean transpose, const GLfloat *v)
8603 {
8604 GET_CURRENT_CONTEXT(ctx);
8605 Node *n;
8606 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8607 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX43F,
8608 4 + POINTER_DWORDS);
8609 if (n) {
8610 n[1].ui = program;
8611 n[2].i = location;
8612 n[3].i = count;
8613 n[4].b = transpose;
8614 save_pointer(&n[5], memdup(v, count * 4 * 3 * sizeof(GLfloat)));
8615 }
8616 if (ctx->ExecuteFlag) {
8617 CALL_ProgramUniformMatrix4x3fv(ctx->Exec,
8618 (program, location, count, transpose, v));
8619 }
8620 }
8621
8622 static void GLAPIENTRY
8623 save_ProgramUniformMatrix4fv(GLuint program, GLint location, GLsizei count,
8624 GLboolean transpose, const GLfloat *v)
8625 {
8626 GET_CURRENT_CONTEXT(ctx);
8627 Node *n;
8628 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8629 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX44F,
8630 4 + POINTER_DWORDS);
8631 if (n) {
8632 n[1].ui = program;
8633 n[2].i = location;
8634 n[3].i = count;
8635 n[4].b = transpose;
8636 save_pointer(&n[5], memdup(v, count * 4 * 4 * sizeof(GLfloat)));
8637 }
8638 if (ctx->ExecuteFlag) {
8639 CALL_ProgramUniformMatrix4fv(ctx->Exec,
8640 (program, location, count, transpose, v));
8641 }
8642 }
8643
8644 static void GLAPIENTRY
8645 save_ProgramUniformMatrix2dv(GLuint program, GLint location, GLsizei count,
8646 GLboolean transpose, const GLdouble *v)
8647 {
8648 GET_CURRENT_CONTEXT(ctx);
8649 Node *n;
8650 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8651 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX22D,
8652 4 + POINTER_DWORDS);
8653 if (n) {
8654 n[1].ui = program;
8655 n[2].i = location;
8656 n[3].i = count;
8657 n[4].b = transpose;
8658 save_pointer(&n[5], memdup(v, count * 2 * 2 * sizeof(GLdouble)));
8659 }
8660 if (ctx->ExecuteFlag) {
8661 CALL_ProgramUniformMatrix2dv(ctx->Exec,
8662 (program, location, count, transpose, v));
8663 }
8664 }
8665
8666 static void GLAPIENTRY
8667 save_ProgramUniformMatrix2x3dv(GLuint program, GLint location, GLsizei count,
8668 GLboolean transpose, const GLdouble *v)
8669 {
8670 GET_CURRENT_CONTEXT(ctx);
8671 Node *n;
8672 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8673 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX23D,
8674 4 + POINTER_DWORDS);
8675 if (n) {
8676 n[1].ui = program;
8677 n[2].i = location;
8678 n[3].i = count;
8679 n[4].b = transpose;
8680 save_pointer(&n[5], memdup(v, count * 2 * 3 * sizeof(GLdouble)));
8681 }
8682 if (ctx->ExecuteFlag) {
8683 CALL_ProgramUniformMatrix2x3dv(ctx->Exec,
8684 (program, location, count, transpose, v));
8685 }
8686 }
8687
8688 static void GLAPIENTRY
8689 save_ProgramUniformMatrix2x4dv(GLuint program, GLint location, GLsizei count,
8690 GLboolean transpose, const GLdouble *v)
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_MATRIX24D,
8696 4 + POINTER_DWORDS);
8697 if (n) {
8698 n[1].ui = program;
8699 n[2].i = location;
8700 n[3].i = count;
8701 n[4].b = transpose;
8702 save_pointer(&n[5], memdup(v, count * 2 * 4 * sizeof(GLdouble)));
8703 }
8704 if (ctx->ExecuteFlag) {
8705 CALL_ProgramUniformMatrix2x4dv(ctx->Exec,
8706 (program, location, count, transpose, v));
8707 }
8708 }
8709
8710 static void GLAPIENTRY
8711 save_ProgramUniformMatrix3x2dv(GLuint program, GLint location, GLsizei count,
8712 GLboolean transpose, const GLdouble *v)
8713 {
8714 GET_CURRENT_CONTEXT(ctx);
8715 Node *n;
8716 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8717 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX32D,
8718 4 + POINTER_DWORDS);
8719 if (n) {
8720 n[1].ui = program;
8721 n[2].i = location;
8722 n[3].i = count;
8723 n[4].b = transpose;
8724 save_pointer(&n[5], memdup(v, count * 3 * 2 * sizeof(GLdouble)));
8725 }
8726 if (ctx->ExecuteFlag) {
8727 CALL_ProgramUniformMatrix3x2dv(ctx->Exec,
8728 (program, location, count, transpose, v));
8729 }
8730 }
8731
8732 static void GLAPIENTRY
8733 save_ProgramUniformMatrix3dv(GLuint program, GLint location, GLsizei count,
8734 GLboolean transpose, const GLdouble *v)
8735 {
8736 GET_CURRENT_CONTEXT(ctx);
8737 Node *n;
8738 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8739 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX33D,
8740 4 + POINTER_DWORDS);
8741 if (n) {
8742 n[1].ui = program;
8743 n[2].i = location;
8744 n[3].i = count;
8745 n[4].b = transpose;
8746 save_pointer(&n[5], memdup(v, count * 3 * 3 * sizeof(GLdouble)));
8747 }
8748 if (ctx->ExecuteFlag) {
8749 CALL_ProgramUniformMatrix3dv(ctx->Exec,
8750 (program, location, count, transpose, v));
8751 }
8752 }
8753
8754 static void GLAPIENTRY
8755 save_ProgramUniformMatrix3x4dv(GLuint program, GLint location, GLsizei count,
8756 GLboolean transpose, const GLdouble *v)
8757 {
8758 GET_CURRENT_CONTEXT(ctx);
8759 Node *n;
8760 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8761 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX34D,
8762 4 + POINTER_DWORDS);
8763 if (n) {
8764 n[1].ui = program;
8765 n[2].i = location;
8766 n[3].i = count;
8767 n[4].b = transpose;
8768 save_pointer(&n[5], memdup(v, count * 3 * 4 * sizeof(GLdouble)));
8769 }
8770 if (ctx->ExecuteFlag) {
8771 CALL_ProgramUniformMatrix3x4dv(ctx->Exec,
8772 (program, location, count, transpose, v));
8773 }
8774 }
8775
8776 static void GLAPIENTRY
8777 save_ProgramUniformMatrix4x2dv(GLuint program, GLint location, GLsizei count,
8778 GLboolean transpose, const GLdouble *v)
8779 {
8780 GET_CURRENT_CONTEXT(ctx);
8781 Node *n;
8782 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8783 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX42D,
8784 4 + POINTER_DWORDS);
8785 if (n) {
8786 n[1].ui = program;
8787 n[2].i = location;
8788 n[3].i = count;
8789 n[4].b = transpose;
8790 save_pointer(&n[5], memdup(v, count * 4 * 2 * sizeof(GLdouble)));
8791 }
8792 if (ctx->ExecuteFlag) {
8793 CALL_ProgramUniformMatrix4x2dv(ctx->Exec,
8794 (program, location, count, transpose, v));
8795 }
8796 }
8797
8798 static void GLAPIENTRY
8799 save_ProgramUniformMatrix4x3dv(GLuint program, GLint location, GLsizei count,
8800 GLboolean transpose, const GLdouble *v)
8801 {
8802 GET_CURRENT_CONTEXT(ctx);
8803 Node *n;
8804 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8805 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX43D,
8806 4 + POINTER_DWORDS);
8807 if (n) {
8808 n[1].ui = program;
8809 n[2].i = location;
8810 n[3].i = count;
8811 n[4].b = transpose;
8812 save_pointer(&n[5], memdup(v, count * 4 * 3 * sizeof(GLdouble)));
8813 }
8814 if (ctx->ExecuteFlag) {
8815 CALL_ProgramUniformMatrix4x3dv(ctx->Exec,
8816 (program, location, count, transpose, v));
8817 }
8818 }
8819
8820 static void GLAPIENTRY
8821 save_ProgramUniformMatrix4dv(GLuint program, GLint location, GLsizei count,
8822 GLboolean transpose, const GLdouble *v)
8823 {
8824 GET_CURRENT_CONTEXT(ctx);
8825 Node *n;
8826 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8827 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX44D,
8828 4 + POINTER_DWORDS);
8829 if (n) {
8830 n[1].ui = program;
8831 n[2].i = location;
8832 n[3].i = count;
8833 n[4].b = transpose;
8834 save_pointer(&n[5], memdup(v, count * 4 * 4 * sizeof(GLdouble)));
8835 }
8836 if (ctx->ExecuteFlag) {
8837 CALL_ProgramUniformMatrix4dv(ctx->Exec,
8838 (program, location, count, transpose, v));
8839 }
8840 }
8841
8842 static void GLAPIENTRY
8843 save_ClipControl(GLenum origin, GLenum depth)
8844 {
8845 GET_CURRENT_CONTEXT(ctx);
8846 Node *n;
8847 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8848 n = alloc_instruction(ctx, OPCODE_CLIP_CONTROL, 2);
8849 if (n) {
8850 n[1].e = origin;
8851 n[2].e = depth;
8852 }
8853 if (ctx->ExecuteFlag) {
8854 CALL_ClipControl(ctx->Exec, (origin, depth));
8855 }
8856 }
8857
8858 static void GLAPIENTRY
8859 save_ClampColorARB(GLenum target, GLenum clamp)
8860 {
8861 GET_CURRENT_CONTEXT(ctx);
8862 Node *n;
8863 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8864 n = alloc_instruction(ctx, OPCODE_CLAMP_COLOR, 2);
8865 if (n) {
8866 n[1].e = target;
8867 n[2].e = clamp;
8868 }
8869 if (ctx->ExecuteFlag) {
8870 CALL_ClampColor(ctx->Exec, (target, clamp));
8871 }
8872 }
8873
8874 /** GL_EXT_texture_integer */
8875 static void GLAPIENTRY
8876 save_ClearColorIi(GLint red, GLint green, GLint blue, GLint alpha)
8877 {
8878 GET_CURRENT_CONTEXT(ctx);
8879 Node *n;
8880 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8881 n = alloc_instruction(ctx, OPCODE_CLEARCOLOR_I, 4);
8882 if (n) {
8883 n[1].i = red;
8884 n[2].i = green;
8885 n[3].i = blue;
8886 n[4].i = alpha;
8887 }
8888 if (ctx->ExecuteFlag) {
8889 CALL_ClearColorIiEXT(ctx->Exec, (red, green, blue, alpha));
8890 }
8891 }
8892
8893 /** GL_EXT_texture_integer */
8894 static void GLAPIENTRY
8895 save_ClearColorIui(GLuint red, GLuint green, GLuint blue, GLuint alpha)
8896 {
8897 GET_CURRENT_CONTEXT(ctx);
8898 Node *n;
8899 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8900 n = alloc_instruction(ctx, OPCODE_CLEARCOLOR_UI, 4);
8901 if (n) {
8902 n[1].ui = red;
8903 n[2].ui = green;
8904 n[3].ui = blue;
8905 n[4].ui = alpha;
8906 }
8907 if (ctx->ExecuteFlag) {
8908 CALL_ClearColorIuiEXT(ctx->Exec, (red, green, blue, alpha));
8909 }
8910 }
8911
8912 /** GL_EXT_texture_integer */
8913 static void GLAPIENTRY
8914 save_TexParameterIiv(GLenum target, GLenum pname, const GLint *params)
8915 {
8916 GET_CURRENT_CONTEXT(ctx);
8917 Node *n;
8918 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8919 n = alloc_instruction(ctx, OPCODE_TEXPARAMETER_I, 6);
8920 if (n) {
8921 n[1].e = target;
8922 n[2].e = pname;
8923 n[3].i = params[0];
8924 n[4].i = params[1];
8925 n[5].i = params[2];
8926 n[6].i = params[3];
8927 }
8928 if (ctx->ExecuteFlag) {
8929 CALL_TexParameterIiv(ctx->Exec, (target, pname, params));
8930 }
8931 }
8932
8933 /** GL_EXT_texture_integer */
8934 static void GLAPIENTRY
8935 save_TexParameterIuiv(GLenum target, GLenum pname, const GLuint *params)
8936 {
8937 GET_CURRENT_CONTEXT(ctx);
8938 Node *n;
8939 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8940 n = alloc_instruction(ctx, OPCODE_TEXPARAMETER_UI, 6);
8941 if (n) {
8942 n[1].e = target;
8943 n[2].e = pname;
8944 n[3].ui = params[0];
8945 n[4].ui = params[1];
8946 n[5].ui = params[2];
8947 n[6].ui = params[3];
8948 }
8949 if (ctx->ExecuteFlag) {
8950 CALL_TexParameterIuiv(ctx->Exec, (target, pname, params));
8951 }
8952 }
8953
8954 /* GL_ARB_instanced_arrays */
8955 static void GLAPIENTRY
8956 save_VertexAttribDivisor(GLuint index, GLuint divisor)
8957 {
8958 GET_CURRENT_CONTEXT(ctx);
8959 Node *n;
8960 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8961 n = alloc_instruction(ctx, OPCODE_VERTEX_ATTRIB_DIVISOR, 2);
8962 if (n) {
8963 n[1].ui = index;
8964 n[2].ui = divisor;
8965 }
8966 if (ctx->ExecuteFlag) {
8967 CALL_VertexAttribDivisor(ctx->Exec, (index, divisor));
8968 }
8969 }
8970
8971
8972 /* GL_NV_texture_barrier */
8973 static void GLAPIENTRY
8974 save_TextureBarrierNV(void)
8975 {
8976 GET_CURRENT_CONTEXT(ctx);
8977 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8978 alloc_instruction(ctx, OPCODE_TEXTURE_BARRIER_NV, 0);
8979 if (ctx->ExecuteFlag) {
8980 CALL_TextureBarrierNV(ctx->Exec, ());
8981 }
8982 }
8983
8984
8985 /* GL_ARB_sampler_objects */
8986 static void GLAPIENTRY
8987 save_BindSampler(GLuint unit, GLuint sampler)
8988 {
8989 Node *n;
8990 GET_CURRENT_CONTEXT(ctx);
8991 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8992 n = alloc_instruction(ctx, OPCODE_BIND_SAMPLER, 2);
8993 if (n) {
8994 n[1].ui = unit;
8995 n[2].ui = sampler;
8996 }
8997 if (ctx->ExecuteFlag) {
8998 CALL_BindSampler(ctx->Exec, (unit, sampler));
8999 }
9000 }
9001
9002 static void GLAPIENTRY
9003 save_SamplerParameteriv(GLuint sampler, GLenum pname, const GLint *params)
9004 {
9005 Node *n;
9006 GET_CURRENT_CONTEXT(ctx);
9007 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9008 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERIV, 6);
9009 if (n) {
9010 n[1].ui = sampler;
9011 n[2].e = pname;
9012 n[3].i = params[0];
9013 if (pname == GL_TEXTURE_BORDER_COLOR) {
9014 n[4].i = params[1];
9015 n[5].i = params[2];
9016 n[6].i = params[3];
9017 }
9018 else {
9019 n[4].i = n[5].i = n[6].i = 0;
9020 }
9021 }
9022 if (ctx->ExecuteFlag) {
9023 CALL_SamplerParameteriv(ctx->Exec, (sampler, pname, params));
9024 }
9025 }
9026
9027 static void GLAPIENTRY
9028 save_SamplerParameteri(GLuint sampler, GLenum pname, GLint param)
9029 {
9030 GLint parray[4];
9031 parray[0] = param;
9032 parray[1] = parray[2] = parray[3] = 0;
9033 save_SamplerParameteriv(sampler, pname, parray);
9034 }
9035
9036 static void GLAPIENTRY
9037 save_SamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *params)
9038 {
9039 Node *n;
9040 GET_CURRENT_CONTEXT(ctx);
9041 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9042 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERFV, 6);
9043 if (n) {
9044 n[1].ui = sampler;
9045 n[2].e = pname;
9046 n[3].f = params[0];
9047 if (pname == GL_TEXTURE_BORDER_COLOR) {
9048 n[4].f = params[1];
9049 n[5].f = params[2];
9050 n[6].f = params[3];
9051 }
9052 else {
9053 n[4].f = n[5].f = n[6].f = 0.0F;
9054 }
9055 }
9056 if (ctx->ExecuteFlag) {
9057 CALL_SamplerParameterfv(ctx->Exec, (sampler, pname, params));
9058 }
9059 }
9060
9061 static void GLAPIENTRY
9062 save_SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
9063 {
9064 GLfloat parray[4];
9065 parray[0] = param;
9066 parray[1] = parray[2] = parray[3] = 0.0F;
9067 save_SamplerParameterfv(sampler, pname, parray);
9068 }
9069
9070 static void GLAPIENTRY
9071 save_SamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *params)
9072 {
9073 Node *n;
9074 GET_CURRENT_CONTEXT(ctx);
9075 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9076 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERIIV, 6);
9077 if (n) {
9078 n[1].ui = sampler;
9079 n[2].e = pname;
9080 n[3].i = params[0];
9081 if (pname == GL_TEXTURE_BORDER_COLOR) {
9082 n[4].i = params[1];
9083 n[5].i = params[2];
9084 n[6].i = params[3];
9085 }
9086 else {
9087 n[4].i = n[5].i = n[6].i = 0;
9088 }
9089 }
9090 if (ctx->ExecuteFlag) {
9091 CALL_SamplerParameterIiv(ctx->Exec, (sampler, pname, params));
9092 }
9093 }
9094
9095 static void GLAPIENTRY
9096 save_SamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *params)
9097 {
9098 Node *n;
9099 GET_CURRENT_CONTEXT(ctx);
9100 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9101 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERUIV, 6);
9102 if (n) {
9103 n[1].ui = sampler;
9104 n[2].e = pname;
9105 n[3].ui = params[0];
9106 if (pname == GL_TEXTURE_BORDER_COLOR) {
9107 n[4].ui = params[1];
9108 n[5].ui = params[2];
9109 n[6].ui = params[3];
9110 }
9111 else {
9112 n[4].ui = n[5].ui = n[6].ui = 0;
9113 }
9114 }
9115 if (ctx->ExecuteFlag) {
9116 CALL_SamplerParameterIuiv(ctx->Exec, (sampler, pname, params));
9117 }
9118 }
9119
9120 static void GLAPIENTRY
9121 save_WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
9122 {
9123 Node *n;
9124 GET_CURRENT_CONTEXT(ctx);
9125 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9126 n = alloc_instruction(ctx, OPCODE_WAIT_SYNC, 4);
9127 if (n) {
9128 union uint64_pair p;
9129 p.uint64 = timeout;
9130 n[1].bf = flags;
9131 n[2].ui = p.uint32[0];
9132 n[3].ui = p.uint32[1];
9133 save_pointer(&n[4], sync);
9134 }
9135 if (ctx->ExecuteFlag) {
9136 CALL_WaitSync(ctx->Exec, (sync, flags, timeout));
9137 }
9138 }
9139
9140
9141 /** GL_NV_conditional_render */
9142 static void GLAPIENTRY
9143 save_BeginConditionalRender(GLuint queryId, GLenum mode)
9144 {
9145 GET_CURRENT_CONTEXT(ctx);
9146 Node *n;
9147 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9148 n = alloc_instruction(ctx, OPCODE_BEGIN_CONDITIONAL_RENDER, 2);
9149 if (n) {
9150 n[1].i = queryId;
9151 n[2].e = mode;
9152 }
9153 if (ctx->ExecuteFlag) {
9154 CALL_BeginConditionalRender(ctx->Exec, (queryId, mode));
9155 }
9156 }
9157
9158 static void GLAPIENTRY
9159 save_EndConditionalRender(void)
9160 {
9161 GET_CURRENT_CONTEXT(ctx);
9162 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9163 alloc_instruction(ctx, OPCODE_END_CONDITIONAL_RENDER, 0);
9164 if (ctx->ExecuteFlag) {
9165 CALL_EndConditionalRender(ctx->Exec, ());
9166 }
9167 }
9168
9169 static void GLAPIENTRY
9170 save_UniformBlockBinding(GLuint prog, GLuint index, GLuint binding)
9171 {
9172 GET_CURRENT_CONTEXT(ctx);
9173 Node *n;
9174 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9175 n = alloc_instruction(ctx, OPCODE_UNIFORM_BLOCK_BINDING, 3);
9176 if (n) {
9177 n[1].ui = prog;
9178 n[2].ui = index;
9179 n[3].ui = binding;
9180 }
9181 if (ctx->ExecuteFlag) {
9182 CALL_UniformBlockBinding(ctx->Exec, (prog, index, binding));
9183 }
9184 }
9185
9186 static void GLAPIENTRY
9187 save_UniformSubroutinesuiv(GLenum shadertype, GLsizei count,
9188 const GLuint *indices)
9189 {
9190 GET_CURRENT_CONTEXT(ctx);
9191 Node *n;
9192 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9193 n = alloc_instruction(ctx, OPCODE_UNIFORM_SUBROUTINES, 2 + POINTER_DWORDS);
9194 if (n) {
9195 GLint *indices_copy = NULL;
9196
9197 if (count > 0)
9198 indices_copy = memdup(indices, sizeof(GLuint) * 4 * count);
9199 n[1].e = shadertype;
9200 n[2].si = count;
9201 save_pointer(&n[3], indices_copy);
9202 }
9203 if (ctx->ExecuteFlag) {
9204 CALL_UniformSubroutinesuiv(ctx->Exec, (shadertype, count, indices));
9205 }
9206 }
9207
9208 /** GL_EXT_window_rectangles */
9209 static void GLAPIENTRY
9210 save_WindowRectanglesEXT(GLenum mode, GLsizei count, const GLint *box)
9211 {
9212 GET_CURRENT_CONTEXT(ctx);
9213 Node *n;
9214 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9215 n = alloc_instruction(ctx, OPCODE_WINDOW_RECTANGLES, 2 + POINTER_DWORDS);
9216 if (n) {
9217 GLint *box_copy = NULL;
9218
9219 if (count > 0)
9220 box_copy = memdup(box, sizeof(GLint) * 4 * count);
9221 n[1].e = mode;
9222 n[2].si = count;
9223 save_pointer(&n[3], box_copy);
9224 }
9225 if (ctx->ExecuteFlag) {
9226 CALL_WindowRectanglesEXT(ctx->Exec, (mode, count, box));
9227 }
9228 }
9229
9230
9231 /** GL_NV_conservative_raster */
9232 static void GLAPIENTRY
9233 save_SubpixelPrecisionBiasNV(GLuint xbits, GLuint ybits)
9234 {
9235 GET_CURRENT_CONTEXT(ctx);
9236 Node *n;
9237 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9238 n = alloc_instruction(ctx, OPCODE_SUBPIXEL_PRECISION_BIAS, 2);
9239 if (n) {
9240 n[1].ui = xbits;
9241 n[2].ui = ybits;
9242 }
9243 if (ctx->ExecuteFlag) {
9244 CALL_SubpixelPrecisionBiasNV(ctx->Exec, (xbits, ybits));
9245 }
9246 }
9247
9248 /** GL_NV_conservative_raster_dilate */
9249 static void GLAPIENTRY
9250 save_ConservativeRasterParameterfNV(GLenum pname, GLfloat param)
9251 {
9252 GET_CURRENT_CONTEXT(ctx);
9253 Node *n;
9254 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9255 n = alloc_instruction(ctx, OPCODE_CONSERVATIVE_RASTER_PARAMETER_F, 2);
9256 if (n) {
9257 n[1].e = pname;
9258 n[2].f = param;
9259 }
9260 if (ctx->ExecuteFlag) {
9261 CALL_ConservativeRasterParameterfNV(ctx->Exec, (pname, param));
9262 }
9263 }
9264
9265 /** GL_NV_conservative_raster_pre_snap_triangles */
9266 static void GLAPIENTRY
9267 save_ConservativeRasterParameteriNV(GLenum pname, GLint param)
9268 {
9269 GET_CURRENT_CONTEXT(ctx);
9270 Node *n;
9271 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9272 n = alloc_instruction(ctx, OPCODE_CONSERVATIVE_RASTER_PARAMETER_I, 2);
9273 if (n) {
9274 n[1].e = pname;
9275 n[2].i = param;
9276 }
9277 if (ctx->ExecuteFlag) {
9278 CALL_ConservativeRasterParameteriNV(ctx->Exec, (pname, param));
9279 }
9280 }
9281
9282 /** GL_EXT_direct_state_access */
9283
9284 static void GLAPIENTRY
9285 save_MatrixLoadfEXT(GLenum matrixMode, const GLfloat *m)
9286 {
9287 GET_CURRENT_CONTEXT(ctx);
9288 Node *n;
9289 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9290 n = alloc_instruction(ctx, OPCODE_MATRIX_LOAD, 17);
9291 if (n) {
9292 n[1].e = matrixMode;
9293 for (unsigned i = 0; i < 16; i++) {
9294 n[2 + i].f = m[i];
9295 }
9296 }
9297 if (ctx->ExecuteFlag) {
9298 CALL_MatrixLoadfEXT(ctx->Exec, (matrixMode, m));
9299 }
9300 }
9301
9302 static void GLAPIENTRY
9303 save_MatrixLoaddEXT(GLenum matrixMode, const GLdouble *m)
9304 {
9305 GLfloat f[16];
9306 for (unsigned i = 0; i < 16; i++) {
9307 f[i] = (GLfloat) m[i];
9308 }
9309 save_MatrixLoadfEXT(matrixMode, f);
9310 }
9311
9312 static void GLAPIENTRY
9313 save_MatrixMultfEXT(GLenum matrixMode, const GLfloat * m)
9314 {
9315 GET_CURRENT_CONTEXT(ctx);
9316 Node *n;
9317 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9318 n = alloc_instruction(ctx, OPCODE_MATRIX_MULT, 17);
9319 if (n) {
9320 n[1].e = matrixMode;
9321 for (unsigned i = 0; i < 16; i++) {
9322 n[2 + i].f = m[i];
9323 }
9324 }
9325 if (ctx->ExecuteFlag) {
9326 CALL_MatrixMultfEXT(ctx->Exec, (matrixMode, m));
9327 }
9328 }
9329
9330 static void GLAPIENTRY
9331 save_MatrixMultdEXT(GLenum matrixMode, const GLdouble * m)
9332 {
9333 GLfloat f[16];
9334 for (unsigned i = 0; i < 16; i++) {
9335 f[i] = (GLfloat) m[i];
9336 }
9337 save_MatrixMultfEXT(matrixMode, f);
9338 }
9339
9340 static void GLAPIENTRY
9341 save_MatrixRotatefEXT(GLenum matrixMode, GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
9342 {
9343 GET_CURRENT_CONTEXT(ctx);
9344 Node *n;
9345 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9346 n = alloc_instruction(ctx, OPCODE_MATRIX_ROTATE, 5);
9347 if (n) {
9348 n[1].e = matrixMode;
9349 n[2].f = angle;
9350 n[3].f = x;
9351 n[4].f = y;
9352 n[5].f = z;
9353 }
9354 if (ctx->ExecuteFlag) {
9355 CALL_MatrixRotatefEXT(ctx->Exec, (matrixMode, angle, x, y, z));
9356 }
9357 }
9358
9359 static void GLAPIENTRY
9360 save_MatrixRotatedEXT(GLenum matrixMode, GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
9361 {
9362 save_MatrixRotatefEXT(matrixMode, (GLfloat) angle, (GLfloat) x, (GLfloat) y, (GLfloat) z);
9363 }
9364
9365 static void GLAPIENTRY
9366 save_MatrixScalefEXT(GLenum matrixMode, GLfloat x, GLfloat y, GLfloat z)
9367 {
9368 GET_CURRENT_CONTEXT(ctx);
9369 Node *n;
9370 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9371 n = alloc_instruction(ctx, OPCODE_MATRIX_SCALE, 4);
9372 if (n) {
9373 n[1].e = matrixMode;
9374 n[2].f = x;
9375 n[3].f = y;
9376 n[4].f = z;
9377 }
9378 if (ctx->ExecuteFlag) {
9379 CALL_MatrixScalefEXT(ctx->Exec, (matrixMode, x, y, z));
9380 }
9381 }
9382
9383 static void GLAPIENTRY
9384 save_MatrixScaledEXT(GLenum matrixMode, GLdouble x, GLdouble y, GLdouble z)
9385 {
9386 save_MatrixScalefEXT(matrixMode, (GLfloat) x, (GLfloat) y, (GLfloat) z);
9387 }
9388
9389 static void GLAPIENTRY
9390 save_MatrixTranslatefEXT(GLenum matrixMode, GLfloat x, GLfloat y, GLfloat z)
9391 {
9392 GET_CURRENT_CONTEXT(ctx);
9393 Node *n;
9394 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9395 n = alloc_instruction(ctx, OPCODE_MATRIX_TRANSLATE, 4);
9396 if (n) {
9397 n[1].e = matrixMode;
9398 n[2].f = x;
9399 n[3].f = y;
9400 n[4].f = z;
9401 }
9402 if (ctx->ExecuteFlag) {
9403 CALL_MatrixTranslatefEXT(ctx->Exec, (matrixMode, x, y, z));
9404 }
9405 }
9406
9407 static void GLAPIENTRY
9408 save_MatrixTranslatedEXT(GLenum matrixMode, GLdouble x, GLdouble y, GLdouble z)
9409 {
9410 save_MatrixTranslatefEXT(matrixMode, (GLfloat) x, (GLfloat) y, (GLfloat) z);
9411 }
9412
9413 static void GLAPIENTRY
9414 save_MatrixLoadIdentityEXT(GLenum matrixMode)
9415 {
9416 GET_CURRENT_CONTEXT(ctx);
9417 Node *n;
9418 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9419 n = alloc_instruction(ctx, OPCODE_MATRIX_LOAD_IDENTITY, 1);
9420 if (n) {
9421 n[1].e = matrixMode;
9422 }
9423 if (ctx->ExecuteFlag) {
9424 CALL_MatrixLoadIdentityEXT(ctx->Exec, (matrixMode));
9425 }
9426 }
9427
9428 static void GLAPIENTRY
9429 save_MatrixOrthoEXT(GLenum matrixMode, GLdouble left, GLdouble right,
9430 GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval)
9431 {
9432 GET_CURRENT_CONTEXT(ctx);
9433 Node *n;
9434 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9435 n = alloc_instruction(ctx, OPCODE_MATRIX_ORTHO, 7);
9436 if (n) {
9437 n[1].e = matrixMode;
9438 n[2].f = (GLfloat) left;
9439 n[3].f = (GLfloat) right;
9440 n[4].f = (GLfloat) bottom;
9441 n[5].f = (GLfloat) top;
9442 n[6].f = (GLfloat) nearval;
9443 n[7].f = (GLfloat) farval;
9444 }
9445 if (ctx->ExecuteFlag) {
9446 CALL_MatrixOrthoEXT(ctx->Exec, (matrixMode, left, right, bottom, top, nearval, farval));
9447 }
9448 }
9449
9450
9451 static void GLAPIENTRY
9452 save_MatrixFrustumEXT(GLenum matrixMode, GLdouble left, GLdouble right,
9453 GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval)
9454 {
9455 GET_CURRENT_CONTEXT(ctx);
9456 Node *n;
9457 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9458 n = alloc_instruction(ctx, OPCODE_MATRIX_FRUSTUM, 7);
9459 if (n) {
9460 n[1].e = matrixMode;
9461 n[2].f = (GLfloat) left;
9462 n[3].f = (GLfloat) right;
9463 n[4].f = (GLfloat) bottom;
9464 n[5].f = (GLfloat) top;
9465 n[6].f = (GLfloat) nearval;
9466 n[7].f = (GLfloat) farval;
9467 }
9468 if (ctx->ExecuteFlag) {
9469 CALL_MatrixFrustumEXT(ctx->Exec, (matrixMode, left, right, bottom, top, nearval, farval));
9470 }
9471 }
9472
9473 static void GLAPIENTRY
9474 save_MatrixPushEXT(GLenum matrixMode)
9475 {
9476 GET_CURRENT_CONTEXT(ctx);
9477 Node* n;
9478 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9479 n = alloc_instruction(ctx, OPCODE_MATRIX_PUSH, 1);
9480 if (n) {
9481 n[1].e = matrixMode;
9482 }
9483 if (ctx->ExecuteFlag) {
9484 CALL_MatrixPushEXT(ctx->Exec, (matrixMode));
9485 }
9486 }
9487
9488 static void GLAPIENTRY
9489 save_MatrixPopEXT(GLenum matrixMode)
9490 {
9491 GET_CURRENT_CONTEXT(ctx);
9492 Node* n;
9493 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9494 n = alloc_instruction(ctx, OPCODE_MATRIX_POP, 1);
9495 if (n) {
9496 n[1].e = matrixMode;
9497 }
9498 if (ctx->ExecuteFlag) {
9499 CALL_MatrixPopEXT(ctx->Exec, (matrixMode));
9500 }
9501 }
9502
9503 static void GLAPIENTRY
9504 save_MatrixLoadTransposefEXT(GLenum matrixMode, const GLfloat m[16])
9505 {
9506 GLfloat tm[16];
9507 _math_transposef(tm, m);
9508 save_MatrixLoadfEXT(matrixMode, tm);
9509 }
9510
9511 static void GLAPIENTRY
9512 save_MatrixLoadTransposedEXT(GLenum matrixMode, const GLdouble m[16])
9513 {
9514 GLfloat tm[16];
9515 _math_transposefd(tm, m);
9516 save_MatrixLoadfEXT(matrixMode, tm);
9517 }
9518
9519 static void GLAPIENTRY
9520 save_MatrixMultTransposefEXT(GLenum matrixMode, const GLfloat m[16])
9521 {
9522 GLfloat tm[16];
9523 _math_transposef(tm, m);
9524 save_MatrixMultfEXT(matrixMode, tm);
9525 }
9526
9527 static void GLAPIENTRY
9528 save_MatrixMultTransposedEXT(GLenum matrixMode, const GLdouble m[16])
9529 {
9530 GLfloat tm[16];
9531 _math_transposefd(tm, m);
9532 save_MatrixMultfEXT(matrixMode, tm);
9533 }
9534
9535 static void GLAPIENTRY
9536 save_TextureParameterfvEXT(GLuint texture, GLenum target, GLenum pname,
9537 const GLfloat *params)
9538 {
9539 GET_CURRENT_CONTEXT(ctx);
9540 Node *n;
9541 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9542 n = alloc_instruction(ctx, OPCODE_TEXTUREPARAMETER_F, 7);
9543 if (n) {
9544 n[1].ui = texture;
9545 n[2].e = target;
9546 n[3].e = pname;
9547 n[4].f = params[0];
9548 n[5].f = params[1];
9549 n[6].f = params[2];
9550 n[7].f = params[3];
9551 }
9552 if (ctx->ExecuteFlag) {
9553 CALL_TextureParameterfvEXT(ctx->Exec, (texture, target, pname, params));
9554 }
9555 }
9556
9557
9558 static void GLAPIENTRY
9559 save_TextureParameterfEXT(GLuint texture, GLenum target, GLenum pname, GLfloat param)
9560 {
9561 GLfloat parray[4];
9562 parray[0] = param;
9563 parray[1] = parray[2] = parray[3] = 0.0F;
9564 save_TextureParameterfvEXT(texture, target, pname, parray);
9565 }
9566
9567 static void GLAPIENTRY
9568 save_TextureParameterivEXT(GLuint texture, GLenum target, GLenum pname, const GLint *params)
9569 {
9570 GET_CURRENT_CONTEXT(ctx);
9571 Node *n;
9572 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9573 n = alloc_instruction(ctx, OPCODE_TEXTUREPARAMETER_I, 7);
9574 if (n) {
9575 n[1].ui = texture;
9576 n[2].e = target;
9577 n[3].e = pname;
9578 n[4].i = params[0];
9579 n[5].i = params[1];
9580 n[6].i = params[2];
9581 n[7].i = params[3];
9582 }
9583 if (ctx->ExecuteFlag) {
9584 CALL_TextureParameterivEXT(ctx->Exec, (texture, target, pname, params));
9585 }
9586 }
9587
9588 static void GLAPIENTRY
9589 save_TextureParameteriEXT(GLuint texture, GLenum target, GLenum pname, GLint param)
9590 {
9591 GLint fparam[4];
9592 fparam[0] = param;
9593 fparam[1] = fparam[2] = fparam[3] = 0;
9594 save_TextureParameterivEXT(texture, target, pname, fparam);
9595 }
9596
9597 static void GLAPIENTRY
9598 save_TextureImage1DEXT(GLuint texture, GLenum target,
9599 GLint level, GLint components,
9600 GLsizei width, GLint border,
9601 GLenum format, GLenum type, const GLvoid * pixels)
9602 {
9603 GET_CURRENT_CONTEXT(ctx);
9604 if (target == GL_PROXY_TEXTURE_1D) {
9605 /* don't compile, execute immediately */
9606 CALL_TextureImage1DEXT(ctx->Exec, (texture, target, level, components, width,
9607 border, format, type, pixels));
9608 }
9609 else {
9610 Node *n;
9611 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9612 n = alloc_instruction(ctx, OPCODE_TEXTURE_IMAGE1D, 8 + POINTER_DWORDS);
9613 if (n) {
9614 n[1].ui = texture;
9615 n[2].e = target;
9616 n[3].i = level;
9617 n[4].i = components;
9618 n[5].i = (GLint) width;
9619 n[6].i = border;
9620 n[7].e = format;
9621 n[8].e = type;
9622 save_pointer(&n[9],
9623 unpack_image(ctx, 1, width, 1, 1, format, type,
9624 pixels, &ctx->Unpack));
9625 }
9626 if (ctx->ExecuteFlag) {
9627 CALL_TextureImage1DEXT(ctx->Exec, (texture, target, level, components, width,
9628 border, format, type, pixels));
9629 }
9630 }
9631 }
9632
9633
9634 static void GLAPIENTRY
9635 save_TextureImage2DEXT(GLuint texture, GLenum target,
9636 GLint level, GLint components,
9637 GLsizei width, GLsizei height, GLint border,
9638 GLenum format, GLenum type, const GLvoid * pixels)
9639 {
9640 GET_CURRENT_CONTEXT(ctx);
9641 if (target == GL_PROXY_TEXTURE_2D) {
9642 /* don't compile, execute immediately */
9643 CALL_TextureImage2DEXT(ctx->Exec, (texture, target, level, components, width,
9644 height, border, format, type, pixels));
9645 }
9646 else {
9647 Node *n;
9648 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9649 n = alloc_instruction(ctx, OPCODE_TEXTURE_IMAGE2D, 9 + POINTER_DWORDS);
9650 if (n) {
9651 n[1].ui = texture;
9652 n[2].e = target;
9653 n[3].i = level;
9654 n[4].i = components;
9655 n[5].i = (GLint) width;
9656 n[6].i = (GLint) height;
9657 n[7].i = border;
9658 n[8].e = format;
9659 n[9].e = type;
9660 save_pointer(&n[10],
9661 unpack_image(ctx, 2, width, height, 1, format, type,
9662 pixels, &ctx->Unpack));
9663 }
9664 if (ctx->ExecuteFlag) {
9665 CALL_TextureImage2DEXT(ctx->Exec, (texture, target, level, components, width,
9666 height, border, format, type, pixels));
9667 }
9668 }
9669 }
9670
9671
9672 static void GLAPIENTRY
9673 save_TextureImage3DEXT(GLuint texture, GLenum target,
9674 GLint level, GLint internalFormat,
9675 GLsizei width, GLsizei height, GLsizei depth,
9676 GLint border,
9677 GLenum format, GLenum type, const GLvoid * pixels)
9678 {
9679 GET_CURRENT_CONTEXT(ctx);
9680 if (target == GL_PROXY_TEXTURE_3D) {
9681 /* don't compile, execute immediately */
9682 CALL_TextureImage3DEXT(ctx->Exec, (texture, target, level, internalFormat, width,
9683 height, depth, border, format, type,
9684 pixels));
9685 }
9686 else {
9687 Node *n;
9688 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9689 n = alloc_instruction(ctx, OPCODE_TEXTURE_IMAGE3D, 10 + POINTER_DWORDS);
9690 if (n) {
9691 n[1].ui = texture;
9692 n[2].e = target;
9693 n[3].i = level;
9694 n[4].i = (GLint) internalFormat;
9695 n[5].i = (GLint) width;
9696 n[6].i = (GLint) height;
9697 n[7].i = (GLint) depth;
9698 n[8].i = border;
9699 n[9].e = format;
9700 n[10].e = type;
9701 save_pointer(&n[11],
9702 unpack_image(ctx, 3, width, height, depth, format, type,
9703 pixels, &ctx->Unpack));
9704 }
9705 if (ctx->ExecuteFlag) {
9706 CALL_TextureImage3DEXT(ctx->Exec, (texture, target, level, internalFormat,
9707 width, height, depth, border, format,
9708 type, pixels));
9709 }
9710 }
9711 }
9712
9713
9714 static void GLAPIENTRY
9715 save_TextureSubImage1DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset,
9716 GLsizei width, GLenum format, GLenum type,
9717 const GLvoid * pixels)
9718 {
9719 GET_CURRENT_CONTEXT(ctx);
9720 Node *n;
9721
9722 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9723
9724 n = alloc_instruction(ctx, OPCODE_TEXTURE_SUB_IMAGE1D, 7 + POINTER_DWORDS);
9725 if (n) {
9726 n[1].ui = texture;
9727 n[2].e = target;
9728 n[3].i = level;
9729 n[4].i = xoffset;
9730 n[5].i = (GLint) width;
9731 n[6].e = format;
9732 n[7].e = type;
9733 save_pointer(&n[8],
9734 unpack_image(ctx, 1, width, 1, 1, format, type,
9735 pixels, &ctx->Unpack));
9736 }
9737 if (ctx->ExecuteFlag) {
9738 CALL_TextureSubImage1DEXT(ctx->Exec, (texture, target, level, xoffset, width,
9739 format, type, pixels));
9740 }
9741 }
9742
9743
9744 static void GLAPIENTRY
9745 save_TextureSubImage2DEXT(GLuint texture, GLenum target, GLint level,
9746 GLint xoffset, GLint yoffset,
9747 GLsizei width, GLsizei height,
9748 GLenum format, GLenum type, const GLvoid * pixels)
9749 {
9750 GET_CURRENT_CONTEXT(ctx);
9751 Node *n;
9752
9753 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9754
9755 n = alloc_instruction(ctx, OPCODE_TEXTURE_SUB_IMAGE2D, 9 + POINTER_DWORDS);
9756 if (n) {
9757 n[1].ui = texture;
9758 n[2].e = target;
9759 n[3].i = level;
9760 n[4].i = xoffset;
9761 n[5].i = yoffset;
9762 n[6].i = (GLint) width;
9763 n[7].i = (GLint) height;
9764 n[8].e = format;
9765 n[9].e = type;
9766 save_pointer(&n[10],
9767 unpack_image(ctx, 2, width, height, 1, format, type,
9768 pixels, &ctx->Unpack));
9769 }
9770 if (ctx->ExecuteFlag) {
9771 CALL_TextureSubImage2DEXT(ctx->Exec, (texture, target, level, xoffset, yoffset,
9772 width, height, format, type, pixels));
9773 }
9774 }
9775
9776
9777 static void GLAPIENTRY
9778 save_TextureSubImage3DEXT(GLuint texture, GLenum target, GLint level,
9779 GLint xoffset, GLint yoffset, GLint zoffset,
9780 GLsizei width, GLsizei height, GLsizei depth,
9781 GLenum format, GLenum type, const GLvoid * pixels)
9782 {
9783 GET_CURRENT_CONTEXT(ctx);
9784 Node *n;
9785
9786 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9787
9788 n = alloc_instruction(ctx, OPCODE_TEXTURE_SUB_IMAGE3D, 11 + POINTER_DWORDS);
9789 if (n) {
9790 n[1].ui = texture;
9791 n[2].e = target;
9792 n[3].i = level;
9793 n[4].i = xoffset;
9794 n[5].i = yoffset;
9795 n[6].i = zoffset;
9796 n[7].i = (GLint) width;
9797 n[8].i = (GLint) height;
9798 n[9].i = (GLint) depth;
9799 n[10].e = format;
9800 n[11].e = type;
9801 save_pointer(&n[12],
9802 unpack_image(ctx, 3, width, height, depth, format, type,
9803 pixels, &ctx->Unpack));
9804 }
9805 if (ctx->ExecuteFlag) {
9806 CALL_TextureSubImage3DEXT(ctx->Exec, (texture, target, level,
9807 xoffset, yoffset, zoffset,
9808 width, height, depth, format, type,
9809 pixels));
9810 }
9811 }
9812
9813 static void GLAPIENTRY
9814 save_CopyTextureImage1DEXT(GLuint texture, GLenum target, GLint level,
9815 GLenum internalformat, GLint x, GLint y,
9816 GLsizei width, GLint border)
9817 {
9818 GET_CURRENT_CONTEXT(ctx);
9819 Node *n;
9820 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9821 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_IMAGE1D, 8);
9822 if (n) {
9823 n[1].ui = texture;
9824 n[2].e = target;
9825 n[3].i = level;
9826 n[4].e = internalformat;
9827 n[5].i = x;
9828 n[6].i = y;
9829 n[7].i = width;
9830 n[8].i = border;
9831 }
9832 if (ctx->ExecuteFlag) {
9833 CALL_CopyTextureImage1DEXT(ctx->Exec, (texture, target, level,
9834 internalformat, x, y,
9835 width, border));
9836 }
9837 }
9838
9839 static void GLAPIENTRY
9840 save_CopyTextureImage2DEXT(GLuint texture, GLenum target, GLint level,
9841 GLenum internalformat,
9842 GLint x, GLint y, GLsizei width,
9843 GLsizei height, GLint border)
9844 {
9845 GET_CURRENT_CONTEXT(ctx);
9846 Node *n;
9847 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9848 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_IMAGE2D, 9);
9849 if (n) {
9850 n[1].ui = texture;
9851 n[2].e = target;
9852 n[3].i = level;
9853 n[4].e = internalformat;
9854 n[5].i = x;
9855 n[6].i = y;
9856 n[7].i = width;
9857 n[8].i = height;
9858 n[9].i = border;
9859 }
9860 if (ctx->ExecuteFlag) {
9861 CALL_CopyTextureImage2DEXT(ctx->Exec, (texture, target, level,
9862 internalformat, x, y,
9863 width, height, border));
9864 }
9865 }
9866
9867 static void GLAPIENTRY
9868 save_CopyTextureSubImage1DEXT(GLuint texture, GLenum target, GLint level,
9869 GLint xoffset, GLint x, GLint y, GLsizei width)
9870 {
9871 GET_CURRENT_CONTEXT(ctx);
9872 Node *n;
9873 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9874 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_SUB_IMAGE1D, 7);
9875 if (n) {
9876 n[1].ui = texture;
9877 n[2].e = target;
9878 n[3].i = level;
9879 n[4].i = xoffset;
9880 n[5].i = x;
9881 n[6].i = y;
9882 n[7].i = width;
9883 }
9884 if (ctx->ExecuteFlag) {
9885 CALL_CopyTextureSubImage1DEXT(ctx->Exec,
9886 (texture, target, level, xoffset, x, y, width));
9887 }
9888 }
9889
9890 static void GLAPIENTRY
9891 save_CopyTextureSubImage2DEXT(GLuint texture, GLenum target, GLint level,
9892 GLint xoffset, GLint yoffset,
9893 GLint x, GLint y, GLsizei width, GLint height)
9894 {
9895 GET_CURRENT_CONTEXT(ctx);
9896 Node *n;
9897 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9898 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_SUB_IMAGE2D, 9);
9899 if (n) {
9900 n[1].ui = texture;
9901 n[2].e = target;
9902 n[3].i = level;
9903 n[4].i = xoffset;
9904 n[5].i = yoffset;
9905 n[6].i = x;
9906 n[7].i = y;
9907 n[8].i = width;
9908 n[9].i = height;
9909 }
9910 if (ctx->ExecuteFlag) {
9911 CALL_CopyTextureSubImage2DEXT(ctx->Exec, (texture, target, level,
9912 xoffset, yoffset,
9913 x, y, width, height));
9914 }
9915 }
9916
9917
9918 static void GLAPIENTRY
9919 save_CopyTextureSubImage3DEXT(GLuint texture, GLenum target, GLint level,
9920 GLint xoffset, GLint yoffset, GLint zoffset,
9921 GLint x, GLint y, GLsizei width, GLint height)
9922 {
9923 GET_CURRENT_CONTEXT(ctx);
9924 Node *n;
9925 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9926 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_SUB_IMAGE3D, 10);
9927 if (n) {
9928 n[1].ui = texture;
9929 n[2].e = target;
9930 n[3].i = level;
9931 n[4].i = xoffset;
9932 n[5].i = yoffset;
9933 n[6].i = zoffset;
9934 n[7].i = x;
9935 n[8].i = y;
9936 n[9].i = width;
9937 n[10].i = height;
9938 }
9939 if (ctx->ExecuteFlag) {
9940 CALL_CopyTextureSubImage3DEXT(ctx->Exec, (texture, target, level,
9941 xoffset, yoffset, zoffset,
9942 x, y, width, height));
9943 }
9944 }
9945
9946
9947 static void GLAPIENTRY
9948 save_BindMultiTextureEXT(GLenum texunit, GLenum target, GLuint texture)
9949 {
9950 GET_CURRENT_CONTEXT(ctx);
9951 Node *n;
9952 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9953 n = alloc_instruction(ctx, OPCODE_BIND_MULTITEXTURE, 3);
9954 if (n) {
9955 n[1].e = texunit;
9956 n[2].e = target;
9957 n[3].ui = texture;
9958 }
9959 if (ctx->ExecuteFlag) {
9960 CALL_BindMultiTextureEXT(ctx->Exec, (texunit, target, texture));
9961 }
9962 }
9963
9964
9965 static void GLAPIENTRY
9966 save_MultiTexParameterfvEXT(GLenum texunit, GLenum target, GLenum pname,
9967 const GLfloat *params)
9968 {
9969 GET_CURRENT_CONTEXT(ctx);
9970 Node *n;
9971 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9972 n = alloc_instruction(ctx, OPCODE_MULTITEXPARAMETER_F, 7);
9973 if (n) {
9974 n[1].e = texunit;
9975 n[2].e = target;
9976 n[3].e = pname;
9977 n[4].f = params[0];
9978 n[5].f = params[1];
9979 n[6].f = params[2];
9980 n[7].f = params[3];
9981 }
9982 if (ctx->ExecuteFlag) {
9983 CALL_MultiTexParameterfvEXT(ctx->Exec, (texunit, target, pname, params));
9984 }
9985 }
9986
9987
9988 static void GLAPIENTRY
9989 save_MultiTexParameterfEXT(GLenum texunit, GLenum target, GLenum pname, GLfloat param)
9990 {
9991 GLfloat parray[4];
9992 parray[0] = param;
9993 parray[1] = parray[2] = parray[3] = 0.0F;
9994 save_MultiTexParameterfvEXT(texunit, target, pname, parray);
9995 }
9996
9997 static void GLAPIENTRY
9998 save_MultiTexParameterivEXT(GLenum texunit, GLenum target, GLenum pname, const GLint *params)
9999 {
10000 GET_CURRENT_CONTEXT(ctx);
10001 Node *n;
10002 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10003 n = alloc_instruction(ctx, OPCODE_MULTITEXPARAMETER_I, 7);
10004 if (n) {
10005 n[1].e = texunit;
10006 n[2].e = target;
10007 n[3].e = pname;
10008 n[4].i = params[0];
10009 n[5].i = params[1];
10010 n[6].i = params[2];
10011 n[7].i = params[3];
10012 }
10013 if (ctx->ExecuteFlag) {
10014 CALL_MultiTexParameterivEXT(ctx->Exec, (texunit, target, pname, params));
10015 }
10016 }
10017
10018 static void GLAPIENTRY
10019 save_MultiTexParameteriEXT(GLenum texunit, GLenum target, GLenum pname, GLint param)
10020 {
10021 GLint fparam[4];
10022 fparam[0] = param;
10023 fparam[1] = fparam[2] = fparam[3] = 0;
10024 save_MultiTexParameterivEXT(texunit, target, pname, fparam);
10025 }
10026
10027
10028 static void GLAPIENTRY
10029 save_MultiTexImage1DEXT(GLenum texunit, GLenum target,
10030 GLint level, GLint components,
10031 GLsizei width, GLint border,
10032 GLenum format, GLenum type, const GLvoid * pixels)
10033 {
10034 GET_CURRENT_CONTEXT(ctx);
10035 if (target == GL_PROXY_TEXTURE_1D) {
10036 /* don't compile, execute immediately */
10037 CALL_MultiTexImage1DEXT(ctx->Exec, (texunit, target, level, components, width,
10038 border, format, type, pixels));
10039 }
10040 else {
10041 Node *n;
10042 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10043 n = alloc_instruction(ctx, OPCODE_MULTITEX_IMAGE1D, 8 + POINTER_DWORDS);
10044 if (n) {
10045 n[1].e = texunit;
10046 n[2].e = target;
10047 n[3].i = level;
10048 n[4].i = components;
10049 n[5].i = (GLint) width;
10050 n[6].i = border;
10051 n[7].e = format;
10052 n[8].e = type;
10053 save_pointer(&n[9],
10054 unpack_image(ctx, 1, width, 1, 1, format, type,
10055 pixels, &ctx->Unpack));
10056 }
10057 if (ctx->ExecuteFlag) {
10058 CALL_MultiTexImage1DEXT(ctx->Exec, (texunit, target, level, components, width,
10059 border, format, type, pixels));
10060 }
10061 }
10062 }
10063
10064
10065 static void GLAPIENTRY
10066 save_MultiTexImage2DEXT(GLenum texunit, GLenum target,
10067 GLint level, GLint components,
10068 GLsizei width, GLsizei height, GLint border,
10069 GLenum format, GLenum type, const GLvoid * pixels)
10070 {
10071 GET_CURRENT_CONTEXT(ctx);
10072 if (target == GL_PROXY_TEXTURE_2D) {
10073 /* don't compile, execute immediately */
10074 CALL_MultiTexImage2DEXT(ctx->Exec, (texunit, target, level, components, width,
10075 height, border, format, type, pixels));
10076 }
10077 else {
10078 Node *n;
10079 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10080 n = alloc_instruction(ctx, OPCODE_MULTITEX_IMAGE2D, 9 + POINTER_DWORDS);
10081 if (n) {
10082 n[1].e = texunit;
10083 n[2].e = target;
10084 n[3].i = level;
10085 n[4].i = components;
10086 n[5].i = (GLint) width;
10087 n[6].i = (GLint) height;
10088 n[7].i = border;
10089 n[8].e = format;
10090 n[9].e = type;
10091 save_pointer(&n[10],
10092 unpack_image(ctx, 2, width, height, 1, format, type,
10093 pixels, &ctx->Unpack));
10094 }
10095 if (ctx->ExecuteFlag) {
10096 CALL_MultiTexImage2DEXT(ctx->Exec, (texunit, target, level, components, width,
10097 height, border, format, type, pixels));
10098 }
10099 }
10100 }
10101
10102
10103 static void GLAPIENTRY
10104 save_MultiTexImage3DEXT(GLenum texunit, GLenum target,
10105 GLint level, GLint internalFormat,
10106 GLsizei width, GLsizei height, GLsizei depth,
10107 GLint border,
10108 GLenum format, GLenum type, const GLvoid * pixels)
10109 {
10110 GET_CURRENT_CONTEXT(ctx);
10111 if (target == GL_PROXY_TEXTURE_3D) {
10112 /* don't compile, execute immediately */
10113 CALL_MultiTexImage3DEXT(ctx->Exec, (texunit, target, level, internalFormat, width,
10114 height, depth, border, format, type,
10115 pixels));
10116 }
10117 else {
10118 Node *n;
10119 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10120 n = alloc_instruction(ctx, OPCODE_MULTITEX_IMAGE3D, 10 + POINTER_DWORDS);
10121 if (n) {
10122 n[1].e = texunit;
10123 n[2].e = target;
10124 n[3].i = level;
10125 n[4].i = (GLint) internalFormat;
10126 n[5].i = (GLint) width;
10127 n[6].i = (GLint) height;
10128 n[7].i = (GLint) depth;
10129 n[8].i = border;
10130 n[9].e = format;
10131 n[10].e = type;
10132 save_pointer(&n[11],
10133 unpack_image(ctx, 3, width, height, depth, format, type,
10134 pixels, &ctx->Unpack));
10135 }
10136 if (ctx->ExecuteFlag) {
10137 CALL_MultiTexImage3DEXT(ctx->Exec, (texunit, target, level, internalFormat,
10138 width, height, depth, border, format,
10139 type, pixels));
10140 }
10141 }
10142 }
10143
10144
10145 static void GLAPIENTRY
10146 save_MultiTexSubImage1DEXT(GLenum texunit, GLenum target, GLint level, GLint xoffset,
10147 GLsizei width, GLenum format, GLenum type,
10148 const GLvoid * pixels)
10149 {
10150 GET_CURRENT_CONTEXT(ctx);
10151 Node *n;
10152
10153 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10154
10155 n = alloc_instruction(ctx, OPCODE_MULTITEX_SUB_IMAGE1D, 7 + POINTER_DWORDS);
10156 if (n) {
10157 n[1].e = texunit;
10158 n[2].e = target;
10159 n[3].i = level;
10160 n[4].i = xoffset;
10161 n[5].i = (GLint) width;
10162 n[6].e = format;
10163 n[7].e = type;
10164 save_pointer(&n[8],
10165 unpack_image(ctx, 1, width, 1, 1, format, type,
10166 pixels, &ctx->Unpack));
10167 }
10168 if (ctx->ExecuteFlag) {
10169 CALL_MultiTexSubImage1DEXT(ctx->Exec, (texunit, target, level, xoffset, width,
10170 format, type, pixels));
10171 }
10172 }
10173
10174
10175 static void GLAPIENTRY
10176 save_MultiTexSubImage2DEXT(GLenum texunit, GLenum target, GLint level,
10177 GLint xoffset, GLint yoffset,
10178 GLsizei width, GLsizei height,
10179 GLenum format, GLenum type, const GLvoid * pixels)
10180 {
10181 GET_CURRENT_CONTEXT(ctx);
10182 Node *n;
10183
10184 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10185
10186 n = alloc_instruction(ctx, OPCODE_MULTITEX_SUB_IMAGE2D, 9 + POINTER_DWORDS);
10187 if (n) {
10188 n[1].e = texunit;
10189 n[2].e = target;
10190 n[3].i = level;
10191 n[4].i = xoffset;
10192 n[5].i = yoffset;
10193 n[6].i = (GLint) width;
10194 n[7].i = (GLint) height;
10195 n[8].e = format;
10196 n[9].e = type;
10197 save_pointer(&n[10],
10198 unpack_image(ctx, 2, width, height, 1, format, type,
10199 pixels, &ctx->Unpack));
10200 }
10201 if (ctx->ExecuteFlag) {
10202 CALL_MultiTexSubImage2DEXT(ctx->Exec, (texunit, target, level, xoffset, yoffset,
10203 width, height, format, type, pixels));
10204 }
10205 }
10206
10207
10208 static void GLAPIENTRY
10209 save_MultiTexSubImage3DEXT(GLenum texunit, GLenum target, GLint level,
10210 GLint xoffset, GLint yoffset, GLint zoffset,
10211 GLsizei width, GLsizei height, GLsizei depth,
10212 GLenum format, GLenum type, const GLvoid * pixels)
10213 {
10214 GET_CURRENT_CONTEXT(ctx);
10215 Node *n;
10216
10217 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10218
10219 n = alloc_instruction(ctx, OPCODE_MULTITEX_SUB_IMAGE3D, 11 + POINTER_DWORDS);
10220 if (n) {
10221 n[1].e = texunit;
10222 n[2].e = target;
10223 n[3].i = level;
10224 n[4].i = xoffset;
10225 n[5].i = yoffset;
10226 n[6].i = zoffset;
10227 n[7].i = (GLint) width;
10228 n[8].i = (GLint) height;
10229 n[9].i = (GLint) depth;
10230 n[10].e = format;
10231 n[11].e = type;
10232 save_pointer(&n[12],
10233 unpack_image(ctx, 3, width, height, depth, format, type,
10234 pixels, &ctx->Unpack));
10235 }
10236 if (ctx->ExecuteFlag) {
10237 CALL_MultiTexSubImage3DEXT(ctx->Exec, (texunit, target, level,
10238 xoffset, yoffset, zoffset,
10239 width, height, depth, format, type,
10240 pixels));
10241 }
10242 }
10243
10244
10245 static void GLAPIENTRY
10246 save_CopyMultiTexImage1DEXT(GLenum texunit, GLenum target, GLint level,
10247 GLenum internalformat, GLint x, GLint y,
10248 GLsizei width, GLint border)
10249 {
10250 GET_CURRENT_CONTEXT(ctx);
10251 Node *n;
10252 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10253 n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_IMAGE1D, 8);
10254 if (n) {
10255 n[1].e = texunit;
10256 n[2].e = target;
10257 n[3].i = level;
10258 n[4].e = internalformat;
10259 n[5].i = x;
10260 n[6].i = y;
10261 n[7].i = width;
10262 n[8].i = border;
10263 }
10264 if (ctx->ExecuteFlag) {
10265 CALL_CopyMultiTexImage1DEXT(ctx->Exec, (texunit, target, level,
10266 internalformat, x, y,
10267 width, border));
10268 }
10269 }
10270
10271
10272 static void GLAPIENTRY
10273 save_CopyMultiTexImage2DEXT(GLenum texunit, GLenum target, GLint level,
10274 GLenum internalformat,
10275 GLint x, GLint y, GLsizei width,
10276 GLsizei height, GLint border)
10277 {
10278 GET_CURRENT_CONTEXT(ctx);
10279 Node *n;
10280 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10281 n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_IMAGE2D, 9);
10282 if (n) {
10283 n[1].e = texunit;
10284 n[2].e = target;
10285 n[3].i = level;
10286 n[4].e = internalformat;
10287 n[5].i = x;
10288 n[6].i = y;
10289 n[7].i = width;
10290 n[8].i = height;
10291 n[9].i = border;
10292 }
10293 if (ctx->ExecuteFlag) {
10294 CALL_CopyMultiTexImage2DEXT(ctx->Exec, (texunit, target, level,
10295 internalformat, x, y,
10296 width, height, border));
10297 }
10298 }
10299
10300
10301 static void GLAPIENTRY
10302 save_CopyMultiTexSubImage1DEXT(GLenum texunit, GLenum target, GLint level,
10303 GLint xoffset, GLint x, GLint y, GLsizei width)
10304 {
10305 GET_CURRENT_CONTEXT(ctx);
10306 Node *n;
10307 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10308 n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_SUB_IMAGE1D, 7);
10309 if (n) {
10310 n[1].e = texunit;
10311 n[2].e = target;
10312 n[3].i = level;
10313 n[4].i = xoffset;
10314 n[5].i = x;
10315 n[6].i = y;
10316 n[7].i = width;
10317 }
10318 if (ctx->ExecuteFlag) {
10319 CALL_CopyMultiTexSubImage1DEXT(ctx->Exec,
10320 (texunit, target, level, xoffset, x, y, width));
10321 }
10322 }
10323
10324
10325 static void GLAPIENTRY
10326 save_CopyMultiTexSubImage2DEXT(GLenum texunit, GLenum target, GLint level,
10327 GLint xoffset, GLint yoffset,
10328 GLint x, GLint y, GLsizei width, GLint height)
10329 {
10330 GET_CURRENT_CONTEXT(ctx);
10331 Node *n;
10332 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10333 n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_SUB_IMAGE2D, 9);
10334 if (n) {
10335 n[1].e = texunit;
10336 n[2].e = target;
10337 n[3].i = level;
10338 n[4].i = xoffset;
10339 n[5].i = yoffset;
10340 n[6].i = x;
10341 n[7].i = y;
10342 n[8].i = width;
10343 n[9].i = height;
10344 }
10345 if (ctx->ExecuteFlag) {
10346 CALL_CopyMultiTexSubImage2DEXT(ctx->Exec, (texunit, target, level,
10347 xoffset, yoffset,
10348 x, y, width, height));
10349 }
10350 }
10351
10352
10353 static void GLAPIENTRY
10354 save_CopyMultiTexSubImage3DEXT(GLenum texunit, GLenum target, GLint level,
10355 GLint xoffset, GLint yoffset, GLint zoffset,
10356 GLint x, GLint y, GLsizei width, GLint height)
10357 {
10358 GET_CURRENT_CONTEXT(ctx);
10359 Node *n;
10360 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10361 n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_SUB_IMAGE3D, 10);
10362 if (n) {
10363 n[1].e = texunit;
10364 n[2].e = target;
10365 n[3].i = level;
10366 n[4].i = xoffset;
10367 n[5].i = yoffset;
10368 n[6].i = zoffset;
10369 n[7].i = x;
10370 n[8].i = y;
10371 n[9].i = width;
10372 n[10].i = height;
10373 }
10374 if (ctx->ExecuteFlag) {
10375 CALL_CopyMultiTexSubImage3DEXT(ctx->Exec, (texunit, target, level,
10376 xoffset, yoffset, zoffset,
10377 x, y, width, height));
10378 }
10379 }
10380
10381
10382 static void GLAPIENTRY
10383 save_MultiTexEnvfvEXT(GLenum texunit, GLenum target, GLenum pname, const GLfloat *params)
10384 {
10385 GET_CURRENT_CONTEXT(ctx);
10386 Node *n;
10387 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10388 n = alloc_instruction(ctx, OPCODE_MULTITEXENV, 7);
10389 if (n) {
10390 n[1].e = texunit;
10391 n[2].e = target;
10392 n[3].e = pname;
10393 if (pname == GL_TEXTURE_ENV_COLOR) {
10394 n[4].f = params[0];
10395 n[5].f = params[1];
10396 n[6].f = params[2];
10397 n[7].f = params[3];
10398 }
10399 else {
10400 n[4].f = params[0];
10401 n[5].f = n[6].f = n[7].f = 0.0F;
10402 }
10403 }
10404 if (ctx->ExecuteFlag) {
10405 CALL_MultiTexEnvfvEXT(ctx->Exec, (texunit, target, pname, params));
10406 }
10407 }
10408
10409
10410 static void GLAPIENTRY
10411 save_MultiTexEnvfEXT(GLenum texunit, GLenum target, GLenum pname, GLfloat param)
10412 {
10413 GLfloat parray[4];
10414 parray[0] = (GLfloat) param;
10415 parray[1] = parray[2] = parray[3] = 0.0F;
10416 save_MultiTexEnvfvEXT(texunit, target, pname, parray);
10417 }
10418
10419
10420 static void GLAPIENTRY
10421 save_MultiTexEnviEXT(GLenum texunit, GLenum target, GLenum pname, GLint param)
10422 {
10423 GLfloat p[4];
10424 p[0] = (GLfloat) param;
10425 p[1] = p[2] = p[3] = 0.0F;
10426 save_MultiTexEnvfvEXT(texunit, target, pname, p);
10427 }
10428
10429
10430 static void GLAPIENTRY
10431 save_MultiTexEnvivEXT(GLenum texunit, GLenum target, GLenum pname, const GLint * param)
10432 {
10433 GLfloat p[4];
10434 if (pname == GL_TEXTURE_ENV_COLOR) {
10435 p[0] = INT_TO_FLOAT(param[0]);
10436 p[1] = INT_TO_FLOAT(param[1]);
10437 p[2] = INT_TO_FLOAT(param[2]);
10438 p[3] = INT_TO_FLOAT(param[3]);
10439 }
10440 else {
10441 p[0] = (GLfloat) param[0];
10442 p[1] = p[2] = p[3] = 0.0F;
10443 }
10444 save_MultiTexEnvfvEXT(texunit, target, pname, p);
10445 }
10446
10447
10448 static void GLAPIENTRY
10449 save_CompressedTextureImage1DEXT(GLuint texture, GLenum target, GLint level,
10450 GLenum internalFormat, GLsizei width,
10451 GLint border, GLsizei imageSize,
10452 const GLvoid * data)
10453 {
10454 GET_CURRENT_CONTEXT(ctx);
10455 if (target == GL_PROXY_TEXTURE_1D) {
10456 /* don't compile, execute immediately */
10457 CALL_CompressedTextureImage1DEXT(ctx->Exec, (texture, target, level,
10458 internalFormat, width,
10459 border, imageSize,
10460 data));
10461 }
10462 else {
10463 Node *n;
10464 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10465
10466 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_IMAGE_1D,
10467 7 + POINTER_DWORDS);
10468 if (n) {
10469 n[1].ui = texture;
10470 n[2].e = target;
10471 n[3].i = level;
10472 n[4].e = internalFormat;
10473 n[5].i = (GLint) width;
10474 n[6].i = border;
10475 n[7].i = imageSize;
10476 save_pointer(&n[8],
10477 copy_data(data, imageSize, "glCompressedTextureImage1DEXT"));
10478 }
10479 if (ctx->ExecuteFlag) {
10480 CALL_CompressedTextureImage1DEXT(ctx->Exec,
10481 (texture, target, level, internalFormat,
10482 width, border, imageSize, data));
10483 }
10484 }
10485 }
10486
10487
10488 static void GLAPIENTRY
10489 save_CompressedTextureImage2DEXT(GLuint texture, GLenum target, GLint level,
10490 GLenum internalFormat, GLsizei width,
10491 GLsizei height, GLint border, GLsizei imageSize,
10492 const GLvoid * data)
10493 {
10494 GET_CURRENT_CONTEXT(ctx);
10495 if (target == GL_PROXY_TEXTURE_2D) {
10496 /* don't compile, execute immediately */
10497 CALL_CompressedTextureImage2DEXT(ctx->Exec, (texture, target, level,
10498 internalFormat, width, height,
10499 border, imageSize, data));
10500 }
10501 else {
10502 Node *n;
10503 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10504
10505 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_IMAGE_2D,
10506 8 + POINTER_DWORDS);
10507 if (n) {
10508 n[1].ui = texture;
10509 n[2].e = target;
10510 n[3].i = level;
10511 n[4].e = internalFormat;
10512 n[5].i = (GLint) width;
10513 n[6].i = (GLint) height;
10514 n[7].i = border;
10515 n[8].i = imageSize;
10516 save_pointer(&n[9],
10517 copy_data(data, imageSize, "glCompressedTextureImage2DEXT"));
10518 }
10519 if (ctx->ExecuteFlag) {
10520 CALL_CompressedTextureImage2DEXT(ctx->Exec,
10521 (texture, target, level, internalFormat,
10522 width, height, border, imageSize, data));
10523 }
10524 }
10525 }
10526
10527
10528 static void GLAPIENTRY
10529 save_CompressedTextureImage3DEXT(GLuint texture, GLenum target, GLint level,
10530 GLenum internalFormat, GLsizei width,
10531 GLsizei height, GLsizei depth, GLint border,
10532 GLsizei imageSize, const GLvoid * data)
10533 {
10534 GET_CURRENT_CONTEXT(ctx);
10535 if (target == GL_PROXY_TEXTURE_3D) {
10536 /* don't compile, execute immediately */
10537 CALL_CompressedTextureImage3DEXT(ctx->Exec, (texture, target, level,
10538 internalFormat, width,
10539 height, depth, border,
10540 imageSize, data));
10541 }
10542 else {
10543 Node *n;
10544 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10545
10546 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_IMAGE_3D,
10547 9 + POINTER_DWORDS);
10548 if (n) {
10549 n[1].ui = texture;
10550 n[2].e = target;
10551 n[3].i = level;
10552 n[4].e = internalFormat;
10553 n[5].i = (GLint) width;
10554 n[6].i = (GLint) height;
10555 n[7].i = (GLint) depth;
10556 n[8].i = border;
10557 n[9].i = imageSize;
10558 save_pointer(&n[10],
10559 copy_data(data, imageSize, "glCompressedTextureImage3DEXT"));
10560 }
10561 if (ctx->ExecuteFlag) {
10562 CALL_CompressedTextureImage3DEXT(ctx->Exec,
10563 (texture, target, level, internalFormat,
10564 width, height, depth, border, imageSize,
10565 data));
10566 }
10567 }
10568 }
10569
10570
10571 static void GLAPIENTRY
10572 save_CompressedTextureSubImage1DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset,
10573 GLsizei width, GLenum format,
10574 GLsizei imageSize, const GLvoid * data)
10575 {
10576 Node *n;
10577 GET_CURRENT_CONTEXT(ctx);
10578 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10579
10580 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_1D,
10581 7 + POINTER_DWORDS);
10582 if (n) {
10583 n[1].ui = texture;
10584 n[2].e = target;
10585 n[3].i = level;
10586 n[4].i = xoffset;
10587 n[5].i = (GLint) width;
10588 n[6].e = format;
10589 n[7].i = imageSize;
10590 save_pointer(&n[8],
10591 copy_data(data, imageSize, "glCompressedTextureSubImage1DEXT"));
10592 }
10593 if (ctx->ExecuteFlag) {
10594 CALL_CompressedTextureSubImage1DEXT(ctx->Exec, (texture, target, level, xoffset,
10595 width, format, imageSize, data));
10596 }
10597 }
10598
10599
10600 static void GLAPIENTRY
10601 save_CompressedTextureSubImage2DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset,
10602 GLint yoffset, GLsizei width, GLsizei height,
10603 GLenum format, GLsizei imageSize,
10604 const GLvoid * data)
10605 {
10606 Node *n;
10607 GET_CURRENT_CONTEXT(ctx);
10608 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10609
10610 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_2D,
10611 9 + POINTER_DWORDS);
10612 if (n) {
10613 n[1].ui = texture;
10614 n[2].e = target;
10615 n[3].i = level;
10616 n[4].i = xoffset;
10617 n[5].i = yoffset;
10618 n[6].i = (GLint) width;
10619 n[7].i = (GLint) height;
10620 n[8].e = format;
10621 n[9].i = imageSize;
10622 save_pointer(&n[10],
10623 copy_data(data, imageSize, "glCompressedTextureSubImage2DEXT"));
10624 }
10625 if (ctx->ExecuteFlag) {
10626 CALL_CompressedTextureSubImage2DEXT(ctx->Exec,
10627 (texture, target, level, xoffset, yoffset,
10628 width, height, format, imageSize, data));
10629 }
10630 }
10631
10632
10633 static void GLAPIENTRY
10634 save_CompressedTextureSubImage3DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset,
10635 GLint yoffset, GLint zoffset, GLsizei width,
10636 GLsizei height, GLsizei depth, GLenum format,
10637 GLsizei imageSize, const GLvoid * data)
10638 {
10639 Node *n;
10640 GET_CURRENT_CONTEXT(ctx);
10641 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10642
10643 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_3D,
10644 11 + POINTER_DWORDS);
10645 if (n) {
10646 n[1].ui = texture;
10647 n[2].e = target;
10648 n[3].i = level;
10649 n[4].i = xoffset;
10650 n[5].i = yoffset;
10651 n[6].i = zoffset;
10652 n[7].i = (GLint) width;
10653 n[8].i = (GLint) height;
10654 n[9].i = (GLint) depth;
10655 n[10].e = format;
10656 n[11].i = imageSize;
10657 save_pointer(&n[12],
10658 copy_data(data, imageSize, "glCompressedTextureSubImage3DEXT"));
10659 }
10660 if (ctx->ExecuteFlag) {
10661 CALL_CompressedTextureSubImage3DEXT(ctx->Exec,
10662 (texture, target, level, xoffset, yoffset,
10663 zoffset, width, height, depth, format,
10664 imageSize, data));
10665 }
10666 }
10667
10668
10669 /**
10670 * Save an error-generating command into display list.
10671 *
10672 * KW: Will appear in the list before the vertex buffer containing the
10673 * command that provoked the error. I don't see this as a problem.
10674 */
10675 static void
10676 save_error(struct gl_context *ctx, GLenum error, const char *s)
10677 {
10678 Node *n;
10679 n = alloc_instruction(ctx, OPCODE_ERROR, 1 + POINTER_DWORDS);
10680 if (n) {
10681 n[1].e = error;
10682 save_pointer(&n[2], (void *) s);
10683 /* note: the data/string here doesn't have to be freed in
10684 * _mesa_delete_list() since the string is never dynamically
10685 * allocated.
10686 */
10687 }
10688 }
10689
10690
10691 /**
10692 * Compile an error into current display list.
10693 */
10694 void
10695 _mesa_compile_error(struct gl_context *ctx, GLenum error, const char *s)
10696 {
10697 if (ctx->CompileFlag)
10698 save_error(ctx, error, s);
10699 if (ctx->ExecuteFlag)
10700 _mesa_error(ctx, error, "%s", s);
10701 }
10702
10703
10704 /**
10705 * Test if ID names a display list.
10706 */
10707 static GLboolean
10708 islist(struct gl_context *ctx, GLuint list)
10709 {
10710 if (list > 0 && _mesa_lookup_list(ctx, list)) {
10711 return GL_TRUE;
10712 }
10713 else {
10714 return GL_FALSE;
10715 }
10716 }
10717
10718
10719
10720 /**********************************************************************/
10721 /* Display list execution */
10722 /**********************************************************************/
10723
10724
10725 /*
10726 * Execute a display list. Note that the ListBase offset must have already
10727 * been added before calling this function. I.e. the list argument is
10728 * the absolute list number, not relative to ListBase.
10729 * \param list - display list number
10730 */
10731 static void
10732 execute_list(struct gl_context *ctx, GLuint list)
10733 {
10734 struct gl_display_list *dlist;
10735 Node *n;
10736 GLboolean done;
10737
10738 if (list == 0 || !islist(ctx, list))
10739 return;
10740
10741 if (ctx->ListState.CallDepth == MAX_LIST_NESTING) {
10742 /* raise an error? */
10743 return;
10744 }
10745
10746 dlist = _mesa_lookup_list(ctx, list);
10747 if (!dlist)
10748 return;
10749
10750 ctx->ListState.CallDepth++;
10751
10752 vbo_save_BeginCallList(ctx, dlist);
10753
10754 n = dlist->Head;
10755
10756 done = GL_FALSE;
10757 while (!done) {
10758 const OpCode opcode = n[0].opcode;
10759
10760 if (is_ext_opcode(opcode)) {
10761 n += ext_opcode_execute(ctx, n);
10762 }
10763 else {
10764 switch (opcode) {
10765 case OPCODE_ERROR:
10766 _mesa_error(ctx, n[1].e, "%s", (const char *) get_pointer(&n[2]));
10767 break;
10768 case OPCODE_ACCUM:
10769 CALL_Accum(ctx->Exec, (n[1].e, n[2].f));
10770 break;
10771 case OPCODE_ALPHA_FUNC:
10772 CALL_AlphaFunc(ctx->Exec, (n[1].e, n[2].f));
10773 break;
10774 case OPCODE_BIND_TEXTURE:
10775 CALL_BindTexture(ctx->Exec, (n[1].e, n[2].ui));
10776 break;
10777 case OPCODE_BITMAP:
10778 {
10779 const struct gl_pixelstore_attrib save = ctx->Unpack;
10780 ctx->Unpack = ctx->DefaultPacking;
10781 CALL_Bitmap(ctx->Exec, ((GLsizei) n[1].i, (GLsizei) n[2].i,
10782 n[3].f, n[4].f, n[5].f, n[6].f,
10783 get_pointer(&n[7])));
10784 ctx->Unpack = save; /* restore */
10785 }
10786 break;
10787 case OPCODE_BLEND_COLOR:
10788 CALL_BlendColor(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
10789 break;
10790 case OPCODE_BLEND_EQUATION:
10791 CALL_BlendEquation(ctx->Exec, (n[1].e));
10792 break;
10793 case OPCODE_BLEND_EQUATION_SEPARATE:
10794 CALL_BlendEquationSeparate(ctx->Exec, (n[1].e, n[2].e));
10795 break;
10796 case OPCODE_BLEND_FUNC_SEPARATE:
10797 CALL_BlendFuncSeparate(ctx->Exec,
10798 (n[1].e, n[2].e, n[3].e, n[4].e));
10799 break;
10800
10801 case OPCODE_BLEND_FUNC_I:
10802 /* GL_ARB_draw_buffers_blend */
10803 CALL_BlendFunciARB(ctx->Exec, (n[1].ui, n[2].e, n[3].e));
10804 break;
10805 case OPCODE_BLEND_FUNC_SEPARATE_I:
10806 /* GL_ARB_draw_buffers_blend */
10807 CALL_BlendFuncSeparateiARB(ctx->Exec, (n[1].ui, n[2].e, n[3].e,
10808 n[4].e, n[5].e));
10809 break;
10810 case OPCODE_BLEND_EQUATION_I:
10811 /* GL_ARB_draw_buffers_blend */
10812 CALL_BlendEquationiARB(ctx->Exec, (n[1].ui, n[2].e));
10813 break;
10814 case OPCODE_BLEND_EQUATION_SEPARATE_I:
10815 /* GL_ARB_draw_buffers_blend */
10816 CALL_BlendEquationSeparateiARB(ctx->Exec,
10817 (n[1].ui, n[2].e, n[3].e));
10818 break;
10819
10820 case OPCODE_CALL_LIST:
10821 /* Generated by glCallList(), don't add ListBase */
10822 if (ctx->ListState.CallDepth < MAX_LIST_NESTING) {
10823 execute_list(ctx, n[1].ui);
10824 }
10825 break;
10826 case OPCODE_CALL_LISTS:
10827 if (ctx->ListState.CallDepth < MAX_LIST_NESTING) {
10828 CALL_CallLists(ctx->Exec, (n[1].i, n[2].e, get_pointer(&n[3])));
10829 }
10830 break;
10831 case OPCODE_CLEAR:
10832 CALL_Clear(ctx->Exec, (n[1].bf));
10833 break;
10834 case OPCODE_CLEAR_BUFFER_IV:
10835 {
10836 GLint value[4];
10837 value[0] = n[3].i;
10838 value[1] = n[4].i;
10839 value[2] = n[5].i;
10840 value[3] = n[6].i;
10841 CALL_ClearBufferiv(ctx->Exec, (n[1].e, n[2].i, value));
10842 }
10843 break;
10844 case OPCODE_CLEAR_BUFFER_UIV:
10845 {
10846 GLuint value[4];
10847 value[0] = n[3].ui;
10848 value[1] = n[4].ui;
10849 value[2] = n[5].ui;
10850 value[3] = n[6].ui;
10851 CALL_ClearBufferuiv(ctx->Exec, (n[1].e, n[2].i, value));
10852 }
10853 break;
10854 case OPCODE_CLEAR_BUFFER_FV:
10855 {
10856 GLfloat value[4];
10857 value[0] = n[3].f;
10858 value[1] = n[4].f;
10859 value[2] = n[5].f;
10860 value[3] = n[6].f;
10861 CALL_ClearBufferfv(ctx->Exec, (n[1].e, n[2].i, value));
10862 }
10863 break;
10864 case OPCODE_CLEAR_BUFFER_FI:
10865 CALL_ClearBufferfi(ctx->Exec, (n[1].e, n[2].i, n[3].f, n[4].i));
10866 break;
10867 case OPCODE_CLEAR_COLOR:
10868 CALL_ClearColor(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
10869 break;
10870 case OPCODE_CLEAR_ACCUM:
10871 CALL_ClearAccum(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
10872 break;
10873 case OPCODE_CLEAR_DEPTH:
10874 CALL_ClearDepth(ctx->Exec, ((GLclampd) n[1].f));
10875 break;
10876 case OPCODE_CLEAR_INDEX:
10877 CALL_ClearIndex(ctx->Exec, ((GLfloat) n[1].ui));
10878 break;
10879 case OPCODE_CLEAR_STENCIL:
10880 CALL_ClearStencil(ctx->Exec, (n[1].i));
10881 break;
10882 case OPCODE_CLIP_PLANE:
10883 {
10884 GLdouble eq[4];
10885 eq[0] = n[2].f;
10886 eq[1] = n[3].f;
10887 eq[2] = n[4].f;
10888 eq[3] = n[5].f;
10889 CALL_ClipPlane(ctx->Exec, (n[1].e, eq));
10890 }
10891 break;
10892 case OPCODE_COLOR_MASK:
10893 CALL_ColorMask(ctx->Exec, (n[1].b, n[2].b, n[3].b, n[4].b));
10894 break;
10895 case OPCODE_COLOR_MASK_INDEXED:
10896 CALL_ColorMaski(ctx->Exec, (n[1].ui, n[2].b, n[3].b,
10897 n[4].b, n[5].b));
10898 break;
10899 case OPCODE_COLOR_MATERIAL:
10900 CALL_ColorMaterial(ctx->Exec, (n[1].e, n[2].e));
10901 break;
10902 case OPCODE_COPY_PIXELS:
10903 CALL_CopyPixels(ctx->Exec, (n[1].i, n[2].i,
10904 (GLsizei) n[3].i, (GLsizei) n[4].i,
10905 n[5].e));
10906 break;
10907 case OPCODE_COPY_TEX_IMAGE1D:
10908 CALL_CopyTexImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].e, n[4].i,
10909 n[5].i, n[6].i, n[7].i));
10910 break;
10911 case OPCODE_COPY_TEX_IMAGE2D:
10912 CALL_CopyTexImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].e, n[4].i,
10913 n[5].i, n[6].i, n[7].i, n[8].i));
10914 break;
10915 case OPCODE_COPY_TEX_SUB_IMAGE1D:
10916 CALL_CopyTexSubImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
10917 n[4].i, n[5].i, n[6].i));
10918 break;
10919 case OPCODE_COPY_TEX_SUB_IMAGE2D:
10920 CALL_CopyTexSubImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
10921 n[4].i, n[5].i, n[6].i, n[7].i,
10922 n[8].i));
10923 break;
10924 case OPCODE_COPY_TEX_SUB_IMAGE3D:
10925 CALL_CopyTexSubImage3D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
10926 n[4].i, n[5].i, n[6].i, n[7].i,
10927 n[8].i, n[9].i));
10928 break;
10929 case OPCODE_CULL_FACE:
10930 CALL_CullFace(ctx->Exec, (n[1].e));
10931 break;
10932 case OPCODE_DEPTH_FUNC:
10933 CALL_DepthFunc(ctx->Exec, (n[1].e));
10934 break;
10935 case OPCODE_DEPTH_MASK:
10936 CALL_DepthMask(ctx->Exec, (n[1].b));
10937 break;
10938 case OPCODE_DEPTH_RANGE:
10939 CALL_DepthRange(ctx->Exec,
10940 ((GLclampd) n[1].f, (GLclampd) n[2].f));
10941 break;
10942 case OPCODE_DISABLE:
10943 CALL_Disable(ctx->Exec, (n[1].e));
10944 break;
10945 case OPCODE_DISABLE_INDEXED:
10946 CALL_Disablei(ctx->Exec, (n[1].ui, n[2].e));
10947 break;
10948 case OPCODE_DRAW_BUFFER:
10949 CALL_DrawBuffer(ctx->Exec, (n[1].e));
10950 break;
10951 case OPCODE_DRAW_PIXELS:
10952 {
10953 const struct gl_pixelstore_attrib save = ctx->Unpack;
10954 ctx->Unpack = ctx->DefaultPacking;
10955 CALL_DrawPixels(ctx->Exec, (n[1].i, n[2].i, n[3].e, n[4].e,
10956 get_pointer(&n[5])));
10957 ctx->Unpack = save; /* restore */
10958 }
10959 break;
10960 case OPCODE_ENABLE:
10961 CALL_Enable(ctx->Exec, (n[1].e));
10962 break;
10963 case OPCODE_ENABLE_INDEXED:
10964 CALL_Enablei(ctx->Exec, (n[1].ui, n[2].e));
10965 break;
10966 case OPCODE_EVALMESH1:
10967 CALL_EvalMesh1(ctx->Exec, (n[1].e, n[2].i, n[3].i));
10968 break;
10969 case OPCODE_EVALMESH2:
10970 CALL_EvalMesh2(ctx->Exec,
10971 (n[1].e, n[2].i, n[3].i, n[4].i, n[5].i));
10972 break;
10973 case OPCODE_FOG:
10974 {
10975 GLfloat p[4];
10976 p[0] = n[2].f;
10977 p[1] = n[3].f;
10978 p[2] = n[4].f;
10979 p[3] = n[5].f;
10980 CALL_Fogfv(ctx->Exec, (n[1].e, p));
10981 }
10982 break;
10983 case OPCODE_FRONT_FACE:
10984 CALL_FrontFace(ctx->Exec, (n[1].e));
10985 break;
10986 case OPCODE_FRUSTUM:
10987 CALL_Frustum(ctx->Exec,
10988 (n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f));
10989 break;
10990 case OPCODE_HINT:
10991 CALL_Hint(ctx->Exec, (n[1].e, n[2].e));
10992 break;
10993 case OPCODE_INDEX_MASK:
10994 CALL_IndexMask(ctx->Exec, (n[1].ui));
10995 break;
10996 case OPCODE_INIT_NAMES:
10997 CALL_InitNames(ctx->Exec, ());
10998 break;
10999 case OPCODE_LIGHT:
11000 {
11001 GLfloat p[4];
11002 p[0] = n[3].f;
11003 p[1] = n[4].f;
11004 p[2] = n[5].f;
11005 p[3] = n[6].f;
11006 CALL_Lightfv(ctx->Exec, (n[1].e, n[2].e, p));
11007 }
11008 break;
11009 case OPCODE_LIGHT_MODEL:
11010 {
11011 GLfloat p[4];
11012 p[0] = n[2].f;
11013 p[1] = n[3].f;
11014 p[2] = n[4].f;
11015 p[3] = n[5].f;
11016 CALL_LightModelfv(ctx->Exec, (n[1].e, p));
11017 }
11018 break;
11019 case OPCODE_LINE_STIPPLE:
11020 CALL_LineStipple(ctx->Exec, (n[1].i, n[2].us));
11021 break;
11022 case OPCODE_LINE_WIDTH:
11023 CALL_LineWidth(ctx->Exec, (n[1].f));
11024 break;
11025 case OPCODE_LIST_BASE:
11026 CALL_ListBase(ctx->Exec, (n[1].ui));
11027 break;
11028 case OPCODE_LOAD_IDENTITY:
11029 CALL_LoadIdentity(ctx->Exec, ());
11030 break;
11031 case OPCODE_LOAD_MATRIX:
11032 STATIC_ASSERT(sizeof(Node) == sizeof(GLfloat));
11033 CALL_LoadMatrixf(ctx->Exec, (&n[1].f));
11034 break;
11035 case OPCODE_LOAD_NAME:
11036 CALL_LoadName(ctx->Exec, (n[1].ui));
11037 break;
11038 case OPCODE_LOGIC_OP:
11039 CALL_LogicOp(ctx->Exec, (n[1].e));
11040 break;
11041 case OPCODE_MAP1:
11042 {
11043 GLenum target = n[1].e;
11044 GLint ustride = _mesa_evaluator_components(target);
11045 GLint uorder = n[5].i;
11046 GLfloat u1 = n[2].f;
11047 GLfloat u2 = n[3].f;
11048 CALL_Map1f(ctx->Exec, (target, u1, u2, ustride, uorder,
11049 (GLfloat *) get_pointer(&n[6])));
11050 }
11051 break;
11052 case OPCODE_MAP2:
11053 {
11054 GLenum target = n[1].e;
11055 GLfloat u1 = n[2].f;
11056 GLfloat u2 = n[3].f;
11057 GLfloat v1 = n[4].f;
11058 GLfloat v2 = n[5].f;
11059 GLint ustride = n[6].i;
11060 GLint vstride = n[7].i;
11061 GLint uorder = n[8].i;
11062 GLint vorder = n[9].i;
11063 CALL_Map2f(ctx->Exec, (target, u1, u2, ustride, uorder,
11064 v1, v2, vstride, vorder,
11065 (GLfloat *) get_pointer(&n[10])));
11066 }
11067 break;
11068 case OPCODE_MAPGRID1:
11069 CALL_MapGrid1f(ctx->Exec, (n[1].i, n[2].f, n[3].f));
11070 break;
11071 case OPCODE_MAPGRID2:
11072 CALL_MapGrid2f(ctx->Exec,
11073 (n[1].i, n[2].f, n[3].f, n[4].i, n[5].f, n[6].f));
11074 break;
11075 case OPCODE_MATRIX_MODE:
11076 CALL_MatrixMode(ctx->Exec, (n[1].e));
11077 break;
11078 case OPCODE_MULT_MATRIX:
11079 CALL_MultMatrixf(ctx->Exec, (&n[1].f));
11080 break;
11081 case OPCODE_ORTHO:
11082 CALL_Ortho(ctx->Exec,
11083 (n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f));
11084 break;
11085 case OPCODE_PASSTHROUGH:
11086 CALL_PassThrough(ctx->Exec, (n[1].f));
11087 break;
11088 case OPCODE_PATCH_PARAMETER_I:
11089 CALL_PatchParameteri(ctx->Exec, (n[1].e, n[2].i));
11090 break;
11091 case OPCODE_PATCH_PARAMETER_FV_INNER:
11092 {
11093 GLfloat params[2];
11094 params[0] = n[2].f;
11095 params[1] = n[3].f;
11096 CALL_PatchParameterfv(ctx->Exec, (n[1].e, params));
11097 }
11098 break;
11099 case OPCODE_PATCH_PARAMETER_FV_OUTER:
11100 {
11101 GLfloat params[4];
11102 params[0] = n[2].f;
11103 params[1] = n[3].f;
11104 params[2] = n[4].f;
11105 params[3] = n[5].f;
11106 CALL_PatchParameterfv(ctx->Exec, (n[1].e, params));
11107 }
11108 break;
11109 case OPCODE_PIXEL_MAP:
11110 CALL_PixelMapfv(ctx->Exec,
11111 (n[1].e, n[2].i, get_pointer(&n[3])));
11112 break;
11113 case OPCODE_PIXEL_TRANSFER:
11114 CALL_PixelTransferf(ctx->Exec, (n[1].e, n[2].f));
11115 break;
11116 case OPCODE_PIXEL_ZOOM:
11117 CALL_PixelZoom(ctx->Exec, (n[1].f, n[2].f));
11118 break;
11119 case OPCODE_POINT_SIZE:
11120 CALL_PointSize(ctx->Exec, (n[1].f));
11121 break;
11122 case OPCODE_POINT_PARAMETERS:
11123 {
11124 GLfloat params[3];
11125 params[0] = n[2].f;
11126 params[1] = n[3].f;
11127 params[2] = n[4].f;
11128 CALL_PointParameterfv(ctx->Exec, (n[1].e, params));
11129 }
11130 break;
11131 case OPCODE_POLYGON_MODE:
11132 CALL_PolygonMode(ctx->Exec, (n[1].e, n[2].e));
11133 break;
11134 case OPCODE_POLYGON_STIPPLE:
11135 {
11136 const struct gl_pixelstore_attrib save = ctx->Unpack;
11137 ctx->Unpack = ctx->DefaultPacking;
11138 CALL_PolygonStipple(ctx->Exec, (get_pointer(&n[1])));
11139 ctx->Unpack = save; /* restore */
11140 }
11141 break;
11142 case OPCODE_POLYGON_OFFSET:
11143 CALL_PolygonOffset(ctx->Exec, (n[1].f, n[2].f));
11144 break;
11145 case OPCODE_POLYGON_OFFSET_CLAMP:
11146 CALL_PolygonOffsetClampEXT(ctx->Exec, (n[1].f, n[2].f, n[3].f));
11147 break;
11148 case OPCODE_POP_ATTRIB:
11149 CALL_PopAttrib(ctx->Exec, ());
11150 break;
11151 case OPCODE_POP_MATRIX:
11152 CALL_PopMatrix(ctx->Exec, ());
11153 break;
11154 case OPCODE_POP_NAME:
11155 CALL_PopName(ctx->Exec, ());
11156 break;
11157 case OPCODE_PRIORITIZE_TEXTURE:
11158 CALL_PrioritizeTextures(ctx->Exec, (1, &n[1].ui, &n[2].f));
11159 break;
11160 case OPCODE_PUSH_ATTRIB:
11161 CALL_PushAttrib(ctx->Exec, (n[1].bf));
11162 break;
11163 case OPCODE_PUSH_MATRIX:
11164 CALL_PushMatrix(ctx->Exec, ());
11165 break;
11166 case OPCODE_PUSH_NAME:
11167 CALL_PushName(ctx->Exec, (n[1].ui));
11168 break;
11169 case OPCODE_RASTER_POS:
11170 CALL_RasterPos4f(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
11171 break;
11172 case OPCODE_READ_BUFFER:
11173 CALL_ReadBuffer(ctx->Exec, (n[1].e));
11174 break;
11175 case OPCODE_ROTATE:
11176 CALL_Rotatef(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
11177 break;
11178 case OPCODE_SCALE:
11179 CALL_Scalef(ctx->Exec, (n[1].f, n[2].f, n[3].f));
11180 break;
11181 case OPCODE_SCISSOR:
11182 CALL_Scissor(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
11183 break;
11184 case OPCODE_SHADE_MODEL:
11185 CALL_ShadeModel(ctx->Exec, (n[1].e));
11186 break;
11187 case OPCODE_PROVOKING_VERTEX:
11188 CALL_ProvokingVertex(ctx->Exec, (n[1].e));
11189 break;
11190 case OPCODE_STENCIL_FUNC:
11191 CALL_StencilFunc(ctx->Exec, (n[1].e, n[2].i, n[3].ui));
11192 break;
11193 case OPCODE_STENCIL_MASK:
11194 CALL_StencilMask(ctx->Exec, (n[1].ui));
11195 break;
11196 case OPCODE_STENCIL_OP:
11197 CALL_StencilOp(ctx->Exec, (n[1].e, n[2].e, n[3].e));
11198 break;
11199 case OPCODE_STENCIL_FUNC_SEPARATE:
11200 CALL_StencilFuncSeparate(ctx->Exec,
11201 (n[1].e, n[2].e, n[3].i, n[4].ui));
11202 break;
11203 case OPCODE_STENCIL_MASK_SEPARATE:
11204 CALL_StencilMaskSeparate(ctx->Exec, (n[1].e, n[2].ui));
11205 break;
11206 case OPCODE_STENCIL_OP_SEPARATE:
11207 CALL_StencilOpSeparate(ctx->Exec,
11208 (n[1].e, n[2].e, n[3].e, n[4].e));
11209 break;
11210 case OPCODE_TEXENV:
11211 {
11212 GLfloat params[4];
11213 params[0] = n[3].f;
11214 params[1] = n[4].f;
11215 params[2] = n[5].f;
11216 params[3] = n[6].f;
11217 CALL_TexEnvfv(ctx->Exec, (n[1].e, n[2].e, params));
11218 }
11219 break;
11220 case OPCODE_TEXGEN:
11221 {
11222 GLfloat params[4];
11223 params[0] = n[3].f;
11224 params[1] = n[4].f;
11225 params[2] = n[5].f;
11226 params[3] = n[6].f;
11227 CALL_TexGenfv(ctx->Exec, (n[1].e, n[2].e, params));
11228 }
11229 break;
11230 case OPCODE_TEXPARAMETER:
11231 {
11232 GLfloat params[4];
11233 params[0] = n[3].f;
11234 params[1] = n[4].f;
11235 params[2] = n[5].f;
11236 params[3] = n[6].f;
11237 CALL_TexParameterfv(ctx->Exec, (n[1].e, n[2].e, params));
11238 }
11239 break;
11240 case OPCODE_TEX_IMAGE1D:
11241 {
11242 const struct gl_pixelstore_attrib save = ctx->Unpack;
11243 ctx->Unpack = ctx->DefaultPacking;
11244 CALL_TexImage1D(ctx->Exec, (n[1].e, /* target */
11245 n[2].i, /* level */
11246 n[3].i, /* components */
11247 n[4].i, /* width */
11248 n[5].e, /* border */
11249 n[6].e, /* format */
11250 n[7].e, /* type */
11251 get_pointer(&n[8])));
11252 ctx->Unpack = save; /* restore */
11253 }
11254 break;
11255 case OPCODE_TEX_IMAGE2D:
11256 {
11257 const struct gl_pixelstore_attrib save = ctx->Unpack;
11258 ctx->Unpack = ctx->DefaultPacking;
11259 CALL_TexImage2D(ctx->Exec, (n[1].e, /* target */
11260 n[2].i, /* level */
11261 n[3].i, /* components */
11262 n[4].i, /* width */
11263 n[5].i, /* height */
11264 n[6].e, /* border */
11265 n[7].e, /* format */
11266 n[8].e, /* type */
11267 get_pointer(&n[9])));
11268 ctx->Unpack = save; /* restore */
11269 }
11270 break;
11271 case OPCODE_TEX_IMAGE3D:
11272 {
11273 const struct gl_pixelstore_attrib save = ctx->Unpack;
11274 ctx->Unpack = ctx->DefaultPacking;
11275 CALL_TexImage3D(ctx->Exec, (n[1].e, /* target */
11276 n[2].i, /* level */
11277 n[3].i, /* components */
11278 n[4].i, /* width */
11279 n[5].i, /* height */
11280 n[6].i, /* depth */
11281 n[7].e, /* border */
11282 n[8].e, /* format */
11283 n[9].e, /* type */
11284 get_pointer(&n[10])));
11285 ctx->Unpack = save; /* restore */
11286 }
11287 break;
11288 case OPCODE_TEX_SUB_IMAGE1D:
11289 {
11290 const struct gl_pixelstore_attrib save = ctx->Unpack;
11291 ctx->Unpack = ctx->DefaultPacking;
11292 CALL_TexSubImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
11293 n[4].i, n[5].e,
11294 n[6].e, get_pointer(&n[7])));
11295 ctx->Unpack = save; /* restore */
11296 }
11297 break;
11298 case OPCODE_TEX_SUB_IMAGE2D:
11299 {
11300 const struct gl_pixelstore_attrib save = ctx->Unpack;
11301 ctx->Unpack = ctx->DefaultPacking;
11302 CALL_TexSubImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
11303 n[4].i, n[5].e,
11304 n[6].i, n[7].e, n[8].e,
11305 get_pointer(&n[9])));
11306 ctx->Unpack = save; /* restore */
11307 }
11308 break;
11309 case OPCODE_TEX_SUB_IMAGE3D:
11310 {
11311 const struct gl_pixelstore_attrib save = ctx->Unpack;
11312 ctx->Unpack = ctx->DefaultPacking;
11313 CALL_TexSubImage3D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
11314 n[4].i, n[5].i, n[6].i, n[7].i,
11315 n[8].i, n[9].e, n[10].e,
11316 get_pointer(&n[11])));
11317 ctx->Unpack = save; /* restore */
11318 }
11319 break;
11320 case OPCODE_TRANSLATE:
11321 CALL_Translatef(ctx->Exec, (n[1].f, n[2].f, n[3].f));
11322 break;
11323 case OPCODE_VIEWPORT:
11324 CALL_Viewport(ctx->Exec, (n[1].i, n[2].i,
11325 (GLsizei) n[3].i, (GLsizei) n[4].i));
11326 break;
11327 case OPCODE_WINDOW_POS:
11328 CALL_WindowPos4fMESA(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
11329 break;
11330 case OPCODE_VIEWPORT_ARRAY_V:
11331 CALL_ViewportArrayv(ctx->Exec, (n[1].ui, n[2].si,
11332 get_pointer(&n[3])));
11333 break;
11334 case OPCODE_VIEWPORT_INDEXED_F:
11335 CALL_ViewportIndexedf(ctx->Exec, (n[1].ui, n[2].f, n[3].f, n[4].f,
11336 n[5].f));
11337 break;
11338 case OPCODE_VIEWPORT_INDEXED_FV: {
11339 GLfloat v[4];
11340 v[0] = n[2].f;
11341 v[1] = n[3].f;
11342 v[2] = n[4].f;
11343 v[3] = n[5].f;
11344 CALL_ViewportIndexedfv(ctx->Exec, (n[1].ui, v));
11345 break;
11346 }
11347 case OPCODE_SCISSOR_ARRAY_V:
11348 CALL_ScissorArrayv(ctx->Exec, (n[1].ui, n[2].si,
11349 get_pointer(&n[3])));
11350 break;
11351 case OPCODE_SCISSOR_INDEXED:
11352 CALL_ScissorIndexed(ctx->Exec, (n[1].ui, n[2].i, n[3].i, n[4].si,
11353 n[5].si));
11354 break;
11355 case OPCODE_SCISSOR_INDEXED_V: {
11356 GLint v[4];
11357 v[0] = n[2].i;
11358 v[1] = n[3].i;
11359 v[2] = n[4].si;
11360 v[3] = n[5].si;
11361 CALL_ScissorIndexedv(ctx->Exec, (n[1].ui, v));
11362 break;
11363 }
11364 case OPCODE_DEPTH_ARRAY_V:
11365 CALL_DepthRangeArrayv(ctx->Exec, (n[1].ui, n[2].si,
11366 get_pointer(&n[3])));
11367 break;
11368 case OPCODE_DEPTH_INDEXED:
11369 CALL_DepthRangeIndexed(ctx->Exec, (n[1].ui, n[2].f, n[3].f));
11370 break;
11371 case OPCODE_ACTIVE_TEXTURE: /* GL_ARB_multitexture */
11372 CALL_ActiveTexture(ctx->Exec, (n[1].e));
11373 break;
11374 case OPCODE_COMPRESSED_TEX_IMAGE_1D: /* GL_ARB_texture_compression */
11375 CALL_CompressedTexImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].e,
11376 n[4].i, n[5].i, n[6].i,
11377 get_pointer(&n[7])));
11378 break;
11379 case OPCODE_COMPRESSED_TEX_IMAGE_2D: /* GL_ARB_texture_compression */
11380 CALL_CompressedTexImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].e,
11381 n[4].i, n[5].i, n[6].i,
11382 n[7].i, get_pointer(&n[8])));
11383 break;
11384 case OPCODE_COMPRESSED_TEX_IMAGE_3D: /* GL_ARB_texture_compression */
11385 CALL_CompressedTexImage3D(ctx->Exec, (n[1].e, n[2].i, n[3].e,
11386 n[4].i, n[5].i, n[6].i,
11387 n[7].i, n[8].i,
11388 get_pointer(&n[9])));
11389 break;
11390 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D: /* GL_ARB_texture_compress */
11391 CALL_CompressedTexSubImage1D(ctx->Exec,
11392 (n[1].e, n[2].i, n[3].i, n[4].i,
11393 n[5].e, n[6].i,
11394 get_pointer(&n[7])));
11395 break;
11396 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D: /* GL_ARB_texture_compress */
11397 CALL_CompressedTexSubImage2D(ctx->Exec,
11398 (n[1].e, n[2].i, n[3].i, n[4].i,
11399 n[5].i, n[6].i, n[7].e, n[8].i,
11400 get_pointer(&n[9])));
11401 break;
11402 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D: /* GL_ARB_texture_compress */
11403 CALL_CompressedTexSubImage3D(ctx->Exec,
11404 (n[1].e, n[2].i, n[3].i, n[4].i,
11405 n[5].i, n[6].i, n[7].i, n[8].i,
11406 n[9].e, n[10].i,
11407 get_pointer(&n[11])));
11408 break;
11409 case OPCODE_SAMPLE_COVERAGE: /* GL_ARB_multisample */
11410 CALL_SampleCoverage(ctx->Exec, (n[1].f, n[2].b));
11411 break;
11412 case OPCODE_WINDOW_POS_ARB: /* GL_ARB_window_pos */
11413 CALL_WindowPos3f(ctx->Exec, (n[1].f, n[2].f, n[3].f));
11414 break;
11415 case OPCODE_BIND_PROGRAM_ARB: /* GL_ARB_vertex_program */
11416 CALL_BindProgramARB(ctx->Exec, (n[1].e, n[2].ui));
11417 break;
11418 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB:
11419 CALL_ProgramLocalParameter4fARB(ctx->Exec,
11420 (n[1].e, n[2].ui, n[3].f, n[4].f,
11421 n[5].f, n[6].f));
11422 break;
11423 case OPCODE_ACTIVE_STENCIL_FACE_EXT:
11424 CALL_ActiveStencilFaceEXT(ctx->Exec, (n[1].e));
11425 break;
11426 case OPCODE_DEPTH_BOUNDS_EXT:
11427 CALL_DepthBoundsEXT(ctx->Exec, (n[1].f, n[2].f));
11428 break;
11429 case OPCODE_PROGRAM_STRING_ARB:
11430 CALL_ProgramStringARB(ctx->Exec,
11431 (n[1].e, n[2].e, n[3].i,
11432 get_pointer(&n[4])));
11433 break;
11434 case OPCODE_PROGRAM_ENV_PARAMETER_ARB:
11435 CALL_ProgramEnvParameter4fARB(ctx->Exec, (n[1].e, n[2].ui, n[3].f,
11436 n[4].f, n[5].f,
11437 n[6].f));
11438 break;
11439 case OPCODE_BEGIN_QUERY_ARB:
11440 CALL_BeginQuery(ctx->Exec, (n[1].e, n[2].ui));
11441 break;
11442 case OPCODE_END_QUERY_ARB:
11443 CALL_EndQuery(ctx->Exec, (n[1].e));
11444 break;
11445 case OPCODE_QUERY_COUNTER:
11446 CALL_QueryCounter(ctx->Exec, (n[1].ui, n[2].e));
11447 break;
11448 case OPCODE_BEGIN_QUERY_INDEXED:
11449 CALL_BeginQueryIndexed(ctx->Exec, (n[1].e, n[2].ui, n[3].ui));
11450 break;
11451 case OPCODE_END_QUERY_INDEXED:
11452 CALL_EndQueryIndexed(ctx->Exec, (n[1].e, n[2].ui));
11453 break;
11454 case OPCODE_DRAW_BUFFERS_ARB:
11455 {
11456 GLenum buffers[MAX_DRAW_BUFFERS];
11457 GLint i, count = MIN2(n[1].i, MAX_DRAW_BUFFERS);
11458 for (i = 0; i < count; i++)
11459 buffers[i] = n[2 + i].e;
11460 CALL_DrawBuffers(ctx->Exec, (n[1].i, buffers));
11461 }
11462 break;
11463 case OPCODE_BLIT_FRAMEBUFFER:
11464 CALL_BlitFramebuffer(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i,
11465 n[5].i, n[6].i, n[7].i, n[8].i,
11466 n[9].i, n[10].e));
11467 break;
11468 case OPCODE_PRIMITIVE_RESTART_NV:
11469 CALL_PrimitiveRestartNV(ctx->Exec, ());
11470 break;
11471
11472 case OPCODE_USE_PROGRAM:
11473 CALL_UseProgram(ctx->Exec, (n[1].ui));
11474 break;
11475 case OPCODE_UNIFORM_1F:
11476 CALL_Uniform1f(ctx->Exec, (n[1].i, n[2].f));
11477 break;
11478 case OPCODE_UNIFORM_2F:
11479 CALL_Uniform2f(ctx->Exec, (n[1].i, n[2].f, n[3].f));
11480 break;
11481 case OPCODE_UNIFORM_3F:
11482 CALL_Uniform3f(ctx->Exec, (n[1].i, n[2].f, n[3].f, n[4].f));
11483 break;
11484 case OPCODE_UNIFORM_4F:
11485 CALL_Uniform4f(ctx->Exec,
11486 (n[1].i, n[2].f, n[3].f, n[4].f, n[5].f));
11487 break;
11488 case OPCODE_UNIFORM_1FV:
11489 CALL_Uniform1fv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11490 break;
11491 case OPCODE_UNIFORM_2FV:
11492 CALL_Uniform2fv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11493 break;
11494 case OPCODE_UNIFORM_3FV:
11495 CALL_Uniform3fv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11496 break;
11497 case OPCODE_UNIFORM_4FV:
11498 CALL_Uniform4fv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11499 break;
11500 case OPCODE_UNIFORM_1D: {
11501 union float64_pair x;
11502
11503 x.uint32[0] = n[2].ui;
11504 x.uint32[1] = n[3].ui;
11505
11506 CALL_Uniform1d(ctx->Exec, (n[1].i, x.d));
11507 break;
11508 }
11509 case OPCODE_UNIFORM_2D: {
11510 union float64_pair x;
11511 union float64_pair y;
11512
11513 x.uint32[0] = n[2].ui;
11514 x.uint32[1] = n[3].ui;
11515 y.uint32[0] = n[4].ui;
11516 y.uint32[1] = n[5].ui;
11517
11518 CALL_Uniform2d(ctx->Exec, (n[1].i, x.d, y.d));
11519 break;
11520 }
11521 case OPCODE_UNIFORM_3D: {
11522 union float64_pair x;
11523 union float64_pair y;
11524 union float64_pair z;
11525
11526 x.uint32[0] = n[2].ui;
11527 x.uint32[1] = n[3].ui;
11528 y.uint32[0] = n[4].ui;
11529 y.uint32[1] = n[5].ui;
11530 z.uint32[0] = n[6].ui;
11531 z.uint32[1] = n[7].ui;
11532
11533 CALL_Uniform3d(ctx->Exec, (n[1].i, x.d, y.d, z.d));
11534 break;
11535 }
11536 case OPCODE_UNIFORM_4D: {
11537 union float64_pair x;
11538 union float64_pair y;
11539 union float64_pair z;
11540 union float64_pair w;
11541
11542 x.uint32[0] = n[2].ui;
11543 x.uint32[1] = n[3].ui;
11544 y.uint32[0] = n[4].ui;
11545 y.uint32[1] = n[5].ui;
11546 z.uint32[0] = n[6].ui;
11547 z.uint32[1] = n[7].ui;
11548 w.uint32[0] = n[8].ui;
11549 w.uint32[1] = n[9].ui;
11550
11551 CALL_Uniform4d(ctx->Exec, (n[1].i, x.d, y.d, z.d, w.d));
11552 break;
11553 }
11554 case OPCODE_UNIFORM_1DV:
11555 CALL_Uniform1dv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11556 break;
11557 case OPCODE_UNIFORM_2DV:
11558 CALL_Uniform2dv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11559 break;
11560 case OPCODE_UNIFORM_3DV:
11561 CALL_Uniform3dv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11562 break;
11563 case OPCODE_UNIFORM_4DV:
11564 CALL_Uniform4dv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11565 break;
11566 case OPCODE_UNIFORM_1I:
11567 CALL_Uniform1i(ctx->Exec, (n[1].i, n[2].i));
11568 break;
11569 case OPCODE_UNIFORM_2I:
11570 CALL_Uniform2i(ctx->Exec, (n[1].i, n[2].i, n[3].i));
11571 break;
11572 case OPCODE_UNIFORM_3I:
11573 CALL_Uniform3i(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
11574 break;
11575 case OPCODE_UNIFORM_4I:
11576 CALL_Uniform4i(ctx->Exec,
11577 (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
11578 break;
11579 case OPCODE_UNIFORM_1IV:
11580 CALL_Uniform1iv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11581 break;
11582 case OPCODE_UNIFORM_2IV:
11583 CALL_Uniform2iv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11584 break;
11585 case OPCODE_UNIFORM_3IV:
11586 CALL_Uniform3iv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11587 break;
11588 case OPCODE_UNIFORM_4IV:
11589 CALL_Uniform4iv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11590 break;
11591 case OPCODE_UNIFORM_1UI:
11592 CALL_Uniform1ui(ctx->Exec, (n[1].i, n[2].i));
11593 break;
11594 case OPCODE_UNIFORM_2UI:
11595 CALL_Uniform2ui(ctx->Exec, (n[1].i, n[2].i, n[3].i));
11596 break;
11597 case OPCODE_UNIFORM_3UI:
11598 CALL_Uniform3ui(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
11599 break;
11600 case OPCODE_UNIFORM_4UI:
11601 CALL_Uniform4ui(ctx->Exec,
11602 (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
11603 break;
11604 case OPCODE_UNIFORM_1UIV:
11605 CALL_Uniform1uiv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11606 break;
11607 case OPCODE_UNIFORM_2UIV:
11608 CALL_Uniform2uiv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11609 break;
11610 case OPCODE_UNIFORM_3UIV:
11611 CALL_Uniform3uiv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11612 break;
11613 case OPCODE_UNIFORM_4UIV:
11614 CALL_Uniform4uiv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11615 break;
11616 case OPCODE_UNIFORM_MATRIX22:
11617 CALL_UniformMatrix2fv(ctx->Exec,
11618 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11619 break;
11620 case OPCODE_UNIFORM_MATRIX33:
11621 CALL_UniformMatrix3fv(ctx->Exec,
11622 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11623 break;
11624 case OPCODE_UNIFORM_MATRIX44:
11625 CALL_UniformMatrix4fv(ctx->Exec,
11626 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11627 break;
11628 case OPCODE_UNIFORM_MATRIX23:
11629 CALL_UniformMatrix2x3fv(ctx->Exec,
11630 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11631 break;
11632 case OPCODE_UNIFORM_MATRIX32:
11633 CALL_UniformMatrix3x2fv(ctx->Exec,
11634 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11635 break;
11636 case OPCODE_UNIFORM_MATRIX24:
11637 CALL_UniformMatrix2x4fv(ctx->Exec,
11638 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11639 break;
11640 case OPCODE_UNIFORM_MATRIX42:
11641 CALL_UniformMatrix4x2fv(ctx->Exec,
11642 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11643 break;
11644 case OPCODE_UNIFORM_MATRIX34:
11645 CALL_UniformMatrix3x4fv(ctx->Exec,
11646 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11647 break;
11648 case OPCODE_UNIFORM_MATRIX43:
11649 CALL_UniformMatrix4x3fv(ctx->Exec,
11650 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11651 break;
11652 case OPCODE_UNIFORM_MATRIX22D:
11653 CALL_UniformMatrix2dv(ctx->Exec,
11654 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11655 break;
11656 case OPCODE_UNIFORM_MATRIX33D:
11657 CALL_UniformMatrix3dv(ctx->Exec,
11658 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11659 break;
11660 case OPCODE_UNIFORM_MATRIX44D:
11661 CALL_UniformMatrix4dv(ctx->Exec,
11662 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11663 break;
11664 case OPCODE_UNIFORM_MATRIX23D:
11665 CALL_UniformMatrix2x3dv(ctx->Exec,
11666 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11667 break;
11668 case OPCODE_UNIFORM_MATRIX32D:
11669 CALL_UniformMatrix3x2dv(ctx->Exec,
11670 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11671 break;
11672 case OPCODE_UNIFORM_MATRIX24D:
11673 CALL_UniformMatrix2x4dv(ctx->Exec,
11674 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11675 break;
11676 case OPCODE_UNIFORM_MATRIX42D:
11677 CALL_UniformMatrix4x2dv(ctx->Exec,
11678 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11679 break;
11680 case OPCODE_UNIFORM_MATRIX34D:
11681 CALL_UniformMatrix3x4dv(ctx->Exec,
11682 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11683 break;
11684 case OPCODE_UNIFORM_MATRIX43D:
11685 CALL_UniformMatrix4x3dv(ctx->Exec,
11686 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11687 break;
11688
11689 case OPCODE_USE_PROGRAM_STAGES:
11690 CALL_UseProgramStages(ctx->Exec, (n[1].ui, n[2].ui, n[3].ui));
11691 break;
11692 case OPCODE_PROGRAM_UNIFORM_1F:
11693 CALL_ProgramUniform1f(ctx->Exec, (n[1].ui, n[2].i, n[3].f));
11694 break;
11695 case OPCODE_PROGRAM_UNIFORM_2F:
11696 CALL_ProgramUniform2f(ctx->Exec, (n[1].ui, n[2].i, n[3].f, n[4].f));
11697 break;
11698 case OPCODE_PROGRAM_UNIFORM_3F:
11699 CALL_ProgramUniform3f(ctx->Exec, (n[1].ui, n[2].i,
11700 n[3].f, n[4].f, n[5].f));
11701 break;
11702 case OPCODE_PROGRAM_UNIFORM_4F:
11703 CALL_ProgramUniform4f(ctx->Exec, (n[1].ui, n[2].i,
11704 n[3].f, n[4].f, n[5].f, n[6].f));
11705 break;
11706 case OPCODE_PROGRAM_UNIFORM_1FV:
11707 CALL_ProgramUniform1fv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11708 get_pointer(&n[4])));
11709 break;
11710 case OPCODE_PROGRAM_UNIFORM_2FV:
11711 CALL_ProgramUniform2fv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11712 get_pointer(&n[4])));
11713 break;
11714 case OPCODE_PROGRAM_UNIFORM_3FV:
11715 CALL_ProgramUniform3fv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11716 get_pointer(&n[4])));
11717 break;
11718 case OPCODE_PROGRAM_UNIFORM_4FV:
11719 CALL_ProgramUniform4fv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11720 get_pointer(&n[4])));
11721 break;
11722 case OPCODE_PROGRAM_UNIFORM_1D: {
11723 union float64_pair x;
11724
11725 x.uint32[0] = n[3].ui;
11726 x.uint32[1] = n[4].ui;
11727
11728 CALL_ProgramUniform1d(ctx->Exec, (n[1].ui, n[2].i, x.d));
11729 break;
11730 }
11731 case OPCODE_PROGRAM_UNIFORM_2D: {
11732 union float64_pair x;
11733 union float64_pair y;
11734
11735 x.uint32[0] = n[3].ui;
11736 x.uint32[1] = n[4].ui;
11737 y.uint32[0] = n[5].ui;
11738 y.uint32[1] = n[6].ui;
11739
11740 CALL_ProgramUniform2d(ctx->Exec, (n[1].ui, n[2].i, x.d, y.d));
11741 break;
11742 }
11743 case OPCODE_PROGRAM_UNIFORM_3D: {
11744 union float64_pair x;
11745 union float64_pair y;
11746 union float64_pair z;
11747
11748 x.uint32[0] = n[3].ui;
11749 x.uint32[1] = n[4].ui;
11750 y.uint32[0] = n[5].ui;
11751 y.uint32[1] = n[6].ui;
11752 z.uint32[0] = n[7].ui;
11753 z.uint32[1] = n[8].ui;
11754
11755 CALL_ProgramUniform3d(ctx->Exec, (n[1].ui, n[2].i,
11756 x.d, y.d, z.d));
11757 break;
11758 }
11759 case OPCODE_PROGRAM_UNIFORM_4D: {
11760 union float64_pair x;
11761 union float64_pair y;
11762 union float64_pair z;
11763 union float64_pair w;
11764
11765 x.uint32[0] = n[3].ui;
11766 x.uint32[1] = n[4].ui;
11767 y.uint32[0] = n[5].ui;
11768 y.uint32[1] = n[6].ui;
11769 z.uint32[0] = n[7].ui;
11770 z.uint32[1] = n[8].ui;
11771 w.uint32[0] = n[9].ui;
11772 w.uint32[1] = n[10].ui;
11773
11774 CALL_ProgramUniform4d(ctx->Exec, (n[1].ui, n[2].i,
11775 x.d, y.d, z.d, w.d));
11776 break;
11777 }
11778 case OPCODE_PROGRAM_UNIFORM_1DV:
11779 CALL_ProgramUniform1dv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11780 get_pointer(&n[4])));
11781 break;
11782 case OPCODE_PROGRAM_UNIFORM_2DV:
11783 CALL_ProgramUniform2dv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11784 get_pointer(&n[4])));
11785 break;
11786 case OPCODE_PROGRAM_UNIFORM_3DV:
11787 CALL_ProgramUniform3dv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11788 get_pointer(&n[4])));
11789 break;
11790 case OPCODE_PROGRAM_UNIFORM_4DV:
11791 CALL_ProgramUniform4dv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11792 get_pointer(&n[4])));
11793 break;
11794 case OPCODE_PROGRAM_UNIFORM_1I:
11795 CALL_ProgramUniform1i(ctx->Exec, (n[1].ui, n[2].i, n[3].i));
11796 break;
11797 case OPCODE_PROGRAM_UNIFORM_2I:
11798 CALL_ProgramUniform2i(ctx->Exec, (n[1].ui, n[2].i, n[3].i, n[4].i));
11799 break;
11800 case OPCODE_PROGRAM_UNIFORM_3I:
11801 CALL_ProgramUniform3i(ctx->Exec, (n[1].ui, n[2].i,
11802 n[3].i, n[4].i, n[5].i));
11803 break;
11804 case OPCODE_PROGRAM_UNIFORM_4I:
11805 CALL_ProgramUniform4i(ctx->Exec, (n[1].ui, n[2].i,
11806 n[3].i, n[4].i, n[5].i, n[6].i));
11807 break;
11808 case OPCODE_PROGRAM_UNIFORM_1IV:
11809 CALL_ProgramUniform1iv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11810 get_pointer(&n[4])));
11811 break;
11812 case OPCODE_PROGRAM_UNIFORM_2IV:
11813 CALL_ProgramUniform2iv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11814 get_pointer(&n[4])));
11815 break;
11816 case OPCODE_PROGRAM_UNIFORM_3IV:
11817 CALL_ProgramUniform3iv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11818 get_pointer(&n[4])));
11819 break;
11820 case OPCODE_PROGRAM_UNIFORM_4IV:
11821 CALL_ProgramUniform4iv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11822 get_pointer(&n[4])));
11823 break;
11824 case OPCODE_PROGRAM_UNIFORM_1UI:
11825 CALL_ProgramUniform1ui(ctx->Exec, (n[1].ui, n[2].i, n[3].ui));
11826 break;
11827 case OPCODE_PROGRAM_UNIFORM_2UI:
11828 CALL_ProgramUniform2ui(ctx->Exec, (n[1].ui, n[2].i,
11829 n[3].ui, n[4].ui));
11830 break;
11831 case OPCODE_PROGRAM_UNIFORM_3UI:
11832 CALL_ProgramUniform3ui(ctx->Exec, (n[1].ui, n[2].i,
11833 n[3].ui, n[4].ui, n[5].ui));
11834 break;
11835 case OPCODE_PROGRAM_UNIFORM_4UI:
11836 CALL_ProgramUniform4ui(ctx->Exec, (n[1].ui, n[2].i,
11837 n[3].ui,
11838 n[4].ui, n[5].ui, n[6].ui));
11839 break;
11840 case OPCODE_PROGRAM_UNIFORM_1UIV:
11841 CALL_ProgramUniform1uiv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11842 get_pointer(&n[4])));
11843 break;
11844 case OPCODE_PROGRAM_UNIFORM_2UIV:
11845 CALL_ProgramUniform2uiv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11846 get_pointer(&n[4])));
11847 break;
11848 case OPCODE_PROGRAM_UNIFORM_3UIV:
11849 CALL_ProgramUniform3uiv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11850 get_pointer(&n[4])));
11851 break;
11852 case OPCODE_PROGRAM_UNIFORM_4UIV:
11853 CALL_ProgramUniform4uiv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11854 get_pointer(&n[4])));
11855 break;
11856 case OPCODE_PROGRAM_UNIFORM_MATRIX22F:
11857 CALL_ProgramUniformMatrix2fv(ctx->Exec,
11858 (n[1].ui, n[2].i, n[3].i, n[4].b,
11859 get_pointer(&n[5])));
11860 break;
11861 case OPCODE_PROGRAM_UNIFORM_MATRIX23F:
11862 CALL_ProgramUniformMatrix2x3fv(ctx->Exec,
11863 (n[1].ui, n[2].i, n[3].i, n[4].b,
11864 get_pointer(&n[5])));
11865 break;
11866 case OPCODE_PROGRAM_UNIFORM_MATRIX24F:
11867 CALL_ProgramUniformMatrix2x4fv(ctx->Exec,
11868 (n[1].ui, n[2].i, n[3].i, n[4].b,
11869 get_pointer(&n[5])));
11870 break;
11871 case OPCODE_PROGRAM_UNIFORM_MATRIX32F:
11872 CALL_ProgramUniformMatrix3x2fv(ctx->Exec,
11873 (n[1].ui, n[2].i, n[3].i, n[4].b,
11874 get_pointer(&n[5])));
11875 break;
11876 case OPCODE_PROGRAM_UNIFORM_MATRIX33F:
11877 CALL_ProgramUniformMatrix3fv(ctx->Exec,
11878 (n[1].ui, n[2].i, n[3].i, n[4].b,
11879 get_pointer(&n[5])));
11880 break;
11881 case OPCODE_PROGRAM_UNIFORM_MATRIX34F:
11882 CALL_ProgramUniformMatrix3x4fv(ctx->Exec,
11883 (n[1].ui, n[2].i, n[3].i, n[4].b,
11884 get_pointer(&n[5])));
11885 break;
11886 case OPCODE_PROGRAM_UNIFORM_MATRIX42F:
11887 CALL_ProgramUniformMatrix4x2fv(ctx->Exec,
11888 (n[1].ui, n[2].i, n[3].i, n[4].b,
11889 get_pointer(&n[5])));
11890 break;
11891 case OPCODE_PROGRAM_UNIFORM_MATRIX43F:
11892 CALL_ProgramUniformMatrix4x3fv(ctx->Exec,
11893 (n[1].ui, n[2].i, n[3].i, n[4].b,
11894 get_pointer(&n[5])));
11895 break;
11896 case OPCODE_PROGRAM_UNIFORM_MATRIX44F:
11897 CALL_ProgramUniformMatrix4fv(ctx->Exec,
11898 (n[1].ui, n[2].i, n[3].i, n[4].b,
11899 get_pointer(&n[5])));
11900 break;
11901 case OPCODE_PROGRAM_UNIFORM_MATRIX22D:
11902 CALL_ProgramUniformMatrix2dv(ctx->Exec,
11903 (n[1].ui, n[2].i, n[3].i, n[4].b,
11904 get_pointer(&n[5])));
11905 break;
11906 case OPCODE_PROGRAM_UNIFORM_MATRIX23D:
11907 CALL_ProgramUniformMatrix2x3dv(ctx->Exec,
11908 (n[1].ui, n[2].i, n[3].i, n[4].b,
11909 get_pointer(&n[5])));
11910 break;
11911 case OPCODE_PROGRAM_UNIFORM_MATRIX24D:
11912 CALL_ProgramUniformMatrix2x4dv(ctx->Exec,
11913 (n[1].ui, n[2].i, n[3].i, n[4].b,
11914 get_pointer(&n[5])));
11915 break;
11916 case OPCODE_PROGRAM_UNIFORM_MATRIX32D:
11917 CALL_ProgramUniformMatrix3x2dv(ctx->Exec,
11918 (n[1].ui, n[2].i, n[3].i, n[4].b,
11919 get_pointer(&n[5])));
11920 break;
11921 case OPCODE_PROGRAM_UNIFORM_MATRIX33D:
11922 CALL_ProgramUniformMatrix3dv(ctx->Exec,
11923 (n[1].ui, n[2].i, n[3].i, n[4].b,
11924 get_pointer(&n[5])));
11925 break;
11926 case OPCODE_PROGRAM_UNIFORM_MATRIX34D:
11927 CALL_ProgramUniformMatrix3x4dv(ctx->Exec,
11928 (n[1].ui, n[2].i, n[3].i, n[4].b,
11929 get_pointer(&n[5])));
11930 break;
11931 case OPCODE_PROGRAM_UNIFORM_MATRIX42D:
11932 CALL_ProgramUniformMatrix4x2dv(ctx->Exec,
11933 (n[1].ui, n[2].i, n[3].i, n[4].b,
11934 get_pointer(&n[5])));
11935 break;
11936 case OPCODE_PROGRAM_UNIFORM_MATRIX43D:
11937 CALL_ProgramUniformMatrix4x3dv(ctx->Exec,
11938 (n[1].ui, n[2].i, n[3].i, n[4].b,
11939 get_pointer(&n[5])));
11940 break;
11941 case OPCODE_PROGRAM_UNIFORM_MATRIX44D:
11942 CALL_ProgramUniformMatrix4dv(ctx->Exec,
11943 (n[1].ui, n[2].i, n[3].i, n[4].b,
11944 get_pointer(&n[5])));
11945 break;
11946
11947 case OPCODE_CLIP_CONTROL:
11948 CALL_ClipControl(ctx->Exec, (n[1].e, n[2].e));
11949 break;
11950
11951 case OPCODE_CLAMP_COLOR:
11952 CALL_ClampColor(ctx->Exec, (n[1].e, n[2].e));
11953 break;
11954
11955 case OPCODE_BIND_FRAGMENT_SHADER_ATI:
11956 CALL_BindFragmentShaderATI(ctx->Exec, (n[1].i));
11957 break;
11958 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI:
11959 CALL_SetFragmentShaderConstantATI(ctx->Exec, (n[1].ui, &n[2].f));
11960 break;
11961 case OPCODE_ATTR_1F_NV:
11962 CALL_VertexAttrib1fNV(ctx->Exec, (n[1].e, n[2].f));
11963 break;
11964 case OPCODE_ATTR_2F_NV:
11965 CALL_VertexAttrib2fvNV(ctx->Exec, (n[1].e, &n[2].f));
11966 break;
11967 case OPCODE_ATTR_3F_NV:
11968 CALL_VertexAttrib3fvNV(ctx->Exec, (n[1].e, &n[2].f));
11969 break;
11970 case OPCODE_ATTR_4F_NV:
11971 CALL_VertexAttrib4fvNV(ctx->Exec, (n[1].e, &n[2].f));
11972 break;
11973 case OPCODE_ATTR_1F_ARB:
11974 CALL_VertexAttrib1fARB(ctx->Exec, (n[1].e, n[2].f));
11975 break;
11976 case OPCODE_ATTR_2F_ARB:
11977 CALL_VertexAttrib2fvARB(ctx->Exec, (n[1].e, &n[2].f));
11978 break;
11979 case OPCODE_ATTR_3F_ARB:
11980 CALL_VertexAttrib3fvARB(ctx->Exec, (n[1].e, &n[2].f));
11981 break;
11982 case OPCODE_ATTR_4F_ARB:
11983 CALL_VertexAttrib4fvARB(ctx->Exec, (n[1].e, &n[2].f));
11984 break;
11985 case OPCODE_ATTR_1D: {
11986 GLdouble *d = (GLdouble *) &n[2];
11987 CALL_VertexAttribL1d(ctx->Exec, (n[1].ui, *d));
11988 break;
11989 }
11990 case OPCODE_ATTR_2D: {
11991 GLdouble *d = (GLdouble *) &n[2];
11992 CALL_VertexAttribL2dv(ctx->Exec, (n[1].ui, d));
11993 break;
11994 }
11995 case OPCODE_ATTR_3D: {
11996 GLdouble *d = (GLdouble *) &n[2];
11997 CALL_VertexAttribL3dv(ctx->Exec, (n[1].ui, d));
11998 break;
11999 }
12000 case OPCODE_ATTR_4D: {
12001 GLdouble *d = (GLdouble *) &n[2];
12002 CALL_VertexAttribL4dv(ctx->Exec, (n[1].ui, d));
12003 break;
12004 }
12005 case OPCODE_MATERIAL:
12006 CALL_Materialfv(ctx->Exec, (n[1].e, n[2].e, &n[3].f));
12007 break;
12008 case OPCODE_BEGIN:
12009 CALL_Begin(ctx->Exec, (n[1].e));
12010 break;
12011 case OPCODE_END:
12012 CALL_End(ctx->Exec, ());
12013 break;
12014 case OPCODE_RECTF:
12015 CALL_Rectf(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
12016 break;
12017 case OPCODE_EVAL_C1:
12018 CALL_EvalCoord1f(ctx->Exec, (n[1].f));
12019 break;
12020 case OPCODE_EVAL_C2:
12021 CALL_EvalCoord2f(ctx->Exec, (n[1].f, n[2].f));
12022 break;
12023 case OPCODE_EVAL_P1:
12024 CALL_EvalPoint1(ctx->Exec, (n[1].i));
12025 break;
12026 case OPCODE_EVAL_P2:
12027 CALL_EvalPoint2(ctx->Exec, (n[1].i, n[2].i));
12028 break;
12029
12030 /* GL_EXT_texture_integer */
12031 case OPCODE_CLEARCOLOR_I:
12032 CALL_ClearColorIiEXT(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
12033 break;
12034 case OPCODE_CLEARCOLOR_UI:
12035 CALL_ClearColorIuiEXT(ctx->Exec,
12036 (n[1].ui, n[2].ui, n[3].ui, n[4].ui));
12037 break;
12038 case OPCODE_TEXPARAMETER_I:
12039 {
12040 GLint params[4];
12041 params[0] = n[3].i;
12042 params[1] = n[4].i;
12043 params[2] = n[5].i;
12044 params[3] = n[6].i;
12045 CALL_TexParameterIiv(ctx->Exec, (n[1].e, n[2].e, params));
12046 }
12047 break;
12048 case OPCODE_TEXPARAMETER_UI:
12049 {
12050 GLuint params[4];
12051 params[0] = n[3].ui;
12052 params[1] = n[4].ui;
12053 params[2] = n[5].ui;
12054 params[3] = n[6].ui;
12055 CALL_TexParameterIuiv(ctx->Exec, (n[1].e, n[2].e, params));
12056 }
12057 break;
12058
12059 case OPCODE_VERTEX_ATTRIB_DIVISOR:
12060 /* GL_ARB_instanced_arrays */
12061 CALL_VertexAttribDivisor(ctx->Exec, (n[1].ui, n[2].ui));
12062 break;
12063
12064 case OPCODE_TEXTURE_BARRIER_NV:
12065 CALL_TextureBarrierNV(ctx->Exec, ());
12066 break;
12067
12068 /* GL_EXT/ARB_transform_feedback */
12069 case OPCODE_BEGIN_TRANSFORM_FEEDBACK:
12070 CALL_BeginTransformFeedback(ctx->Exec, (n[1].e));
12071 break;
12072 case OPCODE_END_TRANSFORM_FEEDBACK:
12073 CALL_EndTransformFeedback(ctx->Exec, ());
12074 break;
12075 case OPCODE_BIND_TRANSFORM_FEEDBACK:
12076 CALL_BindTransformFeedback(ctx->Exec, (n[1].e, n[2].ui));
12077 break;
12078 case OPCODE_PAUSE_TRANSFORM_FEEDBACK:
12079 CALL_PauseTransformFeedback(ctx->Exec, ());
12080 break;
12081 case OPCODE_RESUME_TRANSFORM_FEEDBACK:
12082 CALL_ResumeTransformFeedback(ctx->Exec, ());
12083 break;
12084 case OPCODE_DRAW_TRANSFORM_FEEDBACK:
12085 CALL_DrawTransformFeedback(ctx->Exec, (n[1].e, n[2].ui));
12086 break;
12087 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM:
12088 CALL_DrawTransformFeedbackStream(ctx->Exec,
12089 (n[1].e, n[2].ui, n[3].ui));
12090 break;
12091 case OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED:
12092 CALL_DrawTransformFeedbackInstanced(ctx->Exec,
12093 (n[1].e, n[2].ui, n[3].si));
12094 break;
12095 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED:
12096 CALL_DrawTransformFeedbackStreamInstanced(ctx->Exec,
12097 (n[1].e, n[2].ui, n[3].ui, n[4].si));
12098 break;
12099
12100
12101 case OPCODE_BIND_SAMPLER:
12102 CALL_BindSampler(ctx->Exec, (n[1].ui, n[2].ui));
12103 break;
12104 case OPCODE_SAMPLER_PARAMETERIV:
12105 {
12106 GLint params[4];
12107 params[0] = n[3].i;
12108 params[1] = n[4].i;
12109 params[2] = n[5].i;
12110 params[3] = n[6].i;
12111 CALL_SamplerParameteriv(ctx->Exec, (n[1].ui, n[2].e, params));
12112 }
12113 break;
12114 case OPCODE_SAMPLER_PARAMETERFV:
12115 {
12116 GLfloat params[4];
12117 params[0] = n[3].f;
12118 params[1] = n[4].f;
12119 params[2] = n[5].f;
12120 params[3] = n[6].f;
12121 CALL_SamplerParameterfv(ctx->Exec, (n[1].ui, n[2].e, params));
12122 }
12123 break;
12124 case OPCODE_SAMPLER_PARAMETERIIV:
12125 {
12126 GLint params[4];
12127 params[0] = n[3].i;
12128 params[1] = n[4].i;
12129 params[2] = n[5].i;
12130 params[3] = n[6].i;
12131 CALL_SamplerParameterIiv(ctx->Exec, (n[1].ui, n[2].e, params));
12132 }
12133 break;
12134 case OPCODE_SAMPLER_PARAMETERUIV:
12135 {
12136 GLuint params[4];
12137 params[0] = n[3].ui;
12138 params[1] = n[4].ui;
12139 params[2] = n[5].ui;
12140 params[3] = n[6].ui;
12141 CALL_SamplerParameterIuiv(ctx->Exec, (n[1].ui, n[2].e, params));
12142 }
12143 break;
12144
12145 /* ARB_compute_shader */
12146 case OPCODE_DISPATCH_COMPUTE:
12147 CALL_DispatchCompute(ctx->Exec, (n[1].ui, n[2].ui, n[3].ui));
12148 break;
12149
12150 /* GL_ARB_sync */
12151 case OPCODE_WAIT_SYNC:
12152 {
12153 union uint64_pair p;
12154 p.uint32[0] = n[2].ui;
12155 p.uint32[1] = n[3].ui;
12156 CALL_WaitSync(ctx->Exec,
12157 (get_pointer(&n[4]), n[1].bf, p.uint64));
12158 }
12159 break;
12160
12161 /* GL_NV_conditional_render */
12162 case OPCODE_BEGIN_CONDITIONAL_RENDER:
12163 CALL_BeginConditionalRender(ctx->Exec, (n[1].i, n[2].e));
12164 break;
12165 case OPCODE_END_CONDITIONAL_RENDER:
12166 CALL_EndConditionalRender(ctx->Exec, ());
12167 break;
12168
12169 case OPCODE_UNIFORM_BLOCK_BINDING:
12170 CALL_UniformBlockBinding(ctx->Exec, (n[1].ui, n[2].ui, n[3].ui));
12171 break;
12172
12173 case OPCODE_UNIFORM_SUBROUTINES:
12174 CALL_UniformSubroutinesuiv(ctx->Exec, (n[1].e, n[2].si,
12175 get_pointer(&n[3])));
12176 break;
12177
12178 /* GL_EXT_window_rectangles */
12179 case OPCODE_WINDOW_RECTANGLES:
12180 CALL_WindowRectanglesEXT(
12181 ctx->Exec, (n[1].e, n[2].si, get_pointer(&n[3])));
12182 break;
12183
12184 /* GL_NV_conservative_raster */
12185 case OPCODE_SUBPIXEL_PRECISION_BIAS:
12186 CALL_SubpixelPrecisionBiasNV(ctx->Exec, (n[1].ui, n[2].ui));
12187 break;
12188
12189 /* GL_NV_conservative_raster_dilate */
12190 case OPCODE_CONSERVATIVE_RASTER_PARAMETER_F:
12191 CALL_ConservativeRasterParameterfNV(ctx->Exec, (n[1].e, n[2].f));
12192 break;
12193
12194 /* GL_NV_conservative_raster_pre_snap_triangles */
12195 case OPCODE_CONSERVATIVE_RASTER_PARAMETER_I:
12196 CALL_ConservativeRasterParameteriNV(ctx->Exec, (n[1].e, n[2].i));
12197 break;
12198
12199 /* GL_EXT_direct_state_access */
12200 case OPCODE_MATRIX_LOAD:
12201 CALL_MatrixLoadfEXT(ctx->Exec, (n[1].e, &n[2].f));
12202 break;
12203 case OPCODE_MATRIX_MULT:
12204 CALL_MatrixMultfEXT(ctx->Exec, (n[1].e, &n[2].f));
12205 break;
12206 case OPCODE_MATRIX_ROTATE:
12207 CALL_MatrixRotatefEXT(ctx->Exec, (n[1].e, n[2].f, n[3].f, n[4].f, n[5].f));
12208 break;
12209 case OPCODE_MATRIX_SCALE:
12210 CALL_MatrixScalefEXT(ctx->Exec, (n[1].e, n[2].f, n[3].f, n[4].f));
12211 break;
12212 case OPCODE_MATRIX_TRANSLATE:
12213 CALL_MatrixTranslatefEXT(ctx->Exec, (n[1].e, n[2].f, n[3].f, n[4].f));
12214 break;
12215 case OPCODE_MATRIX_LOAD_IDENTITY:
12216 CALL_MatrixLoadIdentityEXT(ctx->Exec, (n[1].e));
12217 break;
12218 case OPCODE_MATRIX_ORTHO:
12219 CALL_MatrixOrthoEXT(ctx->Exec, (n[1].e,
12220 n[2].f, n[3].f, n[4].f,
12221 n[5].f, n[6].f, n[7].f));
12222 break;
12223 case OPCODE_MATRIX_FRUSTUM:
12224 CALL_MatrixFrustumEXT(ctx->Exec, (n[1].e,
12225 n[2].f, n[3].f, n[4].f,
12226 n[5].f, n[6].f, n[7].f));
12227 break;
12228 case OPCODE_MATRIX_PUSH:
12229 CALL_MatrixPushEXT(ctx->Exec, (n[1].e));
12230 break;
12231 case OPCODE_MATRIX_POP:
12232 CALL_MatrixPopEXT(ctx->Exec, (n[1].e));
12233 break;
12234 case OPCODE_TEXTUREPARAMETER_F:
12235 {
12236 GLfloat params[4];
12237 params[0] = n[4].f;
12238 params[1] = n[5].f;
12239 params[2] = n[6].f;
12240 params[3] = n[7].f;
12241 CALL_TextureParameterfvEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].e, params));
12242 }
12243 break;
12244 case OPCODE_TEXTUREPARAMETER_I:
12245 {
12246 GLint params[4];
12247 params[0] = n[4].i;
12248 params[1] = n[5].i;
12249 params[2] = n[6].i;
12250 params[3] = n[7].i;
12251 CALL_TextureParameterivEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].e, params));
12252 }
12253 break;
12254 case OPCODE_TEXTURE_IMAGE1D:
12255 {
12256 const struct gl_pixelstore_attrib save = ctx->Unpack;
12257 ctx->Unpack = ctx->DefaultPacking;
12258 CALL_TextureImage1DEXT(ctx->Exec, (n[1].ui, /* texture */
12259 n[2].e, /* target */
12260 n[3].i, /* level */
12261 n[4].i, /* components */
12262 n[5].i, /* width */
12263 n[6].e, /* border */
12264 n[7].e, /* format */
12265 n[8].e, /* type */
12266 get_pointer(&n[9])));
12267 ctx->Unpack = save; /* restore */
12268 }
12269 break;
12270 case OPCODE_TEXTURE_IMAGE2D:
12271 {
12272 const struct gl_pixelstore_attrib save = ctx->Unpack;
12273 ctx->Unpack = ctx->DefaultPacking;
12274 CALL_TextureImage2DEXT(ctx->Exec, (n[1].ui, /* texture */
12275 n[2].e, /* target */
12276 n[3].i, /* level */
12277 n[4].i, /* components */
12278 n[5].i, /* width */
12279 n[6].i, /* height */
12280 n[7].e, /* border */
12281 n[8].e, /* format */
12282 n[9].e, /* type */
12283 get_pointer(&n[10])));
12284 ctx->Unpack = save; /* restore */
12285 }
12286 break;
12287 case OPCODE_TEXTURE_IMAGE3D:
12288 {
12289 const struct gl_pixelstore_attrib save = ctx->Unpack;
12290 ctx->Unpack = ctx->DefaultPacking;
12291 CALL_TextureImage3DEXT(ctx->Exec, (n[1].ui, /* texture */
12292 n[2].e, /* target */
12293 n[3].i, /* level */
12294 n[4].i, /* components */
12295 n[5].i, /* width */
12296 n[6].i, /* height */
12297 n[7].i, /* depth */
12298 n[8].e, /* border */
12299 n[9].e, /* format */
12300 n[10].e, /* type */
12301 get_pointer(&n[11])));
12302 ctx->Unpack = save; /* restore */
12303 }
12304 break;
12305 case OPCODE_TEXTURE_SUB_IMAGE1D:
12306 {
12307 const struct gl_pixelstore_attrib save = ctx->Unpack;
12308 ctx->Unpack = ctx->DefaultPacking;
12309 CALL_TextureSubImage1DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
12310 n[4].i, n[5].i, n[6].e,
12311 n[7].e, get_pointer(&n[8])));
12312 ctx->Unpack = save; /* restore */
12313 }
12314 break;
12315 case OPCODE_TEXTURE_SUB_IMAGE2D:
12316 {
12317 const struct gl_pixelstore_attrib save = ctx->Unpack;
12318 ctx->Unpack = ctx->DefaultPacking;
12319 CALL_TextureSubImage2DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
12320 n[4].i, n[5].i, n[6].e,
12321 n[7].i, n[8].e, n[9].e,
12322 get_pointer(&n[10])));
12323 ctx->Unpack = save;
12324 }
12325 break;
12326 case OPCODE_TEXTURE_SUB_IMAGE3D:
12327 {
12328 const struct gl_pixelstore_attrib save = ctx->Unpack;
12329 ctx->Unpack = ctx->DefaultPacking;
12330 CALL_TextureSubImage3DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
12331 n[4].i, n[5].i, n[6].i,
12332 n[7].i, n[8].i, n[9].i,
12333 n[10].e, n[11].e,
12334 get_pointer(&n[12])));
12335 ctx->Unpack = save; /* restore */
12336 }
12337 break;
12338 case OPCODE_COPY_TEXTURE_IMAGE1D:
12339 CALL_CopyTextureImage1DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
12340 n[4].e, n[5].i, n[6].i,
12341 n[7].i, n[8].i));
12342 break;
12343 case OPCODE_COPY_TEXTURE_IMAGE2D:
12344 CALL_CopyTextureImage2DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
12345 n[4].e, n[5].i, n[6].i,
12346 n[7].i, n[8].i, n[9].i));
12347 break;
12348 case OPCODE_COPY_TEXTURE_SUB_IMAGE1D:
12349 CALL_CopyTextureSubImage1DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
12350 n[4].i, n[5].i, n[6].i,
12351 n[7].i));
12352 break;
12353 case OPCODE_COPY_TEXTURE_SUB_IMAGE2D:
12354 CALL_CopyTextureSubImage2DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
12355 n[4].i, n[5].i, n[6].i,
12356 n[7].i, n[8].i, n[9].i));
12357 break;
12358 case OPCODE_COPY_TEXTURE_SUB_IMAGE3D:
12359 CALL_CopyTextureSubImage3DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
12360 n[4].i, n[5].i, n[6].i,
12361 n[7].i, n[8].i, n[9].i,
12362 n[10].i));
12363 break;
12364 case OPCODE_BIND_MULTITEXTURE:
12365 CALL_BindMultiTextureEXT(ctx->Exec, (n[1].e, n[2].e, n[3].ui));
12366 break;
12367 case OPCODE_MULTITEXPARAMETER_F:
12368 {
12369 GLfloat params[4];
12370 params[0] = n[4].f;
12371 params[1] = n[5].f;
12372 params[2] = n[6].f;
12373 params[3] = n[7].f;
12374 CALL_MultiTexParameterfvEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, params));
12375 }
12376 break;
12377 case OPCODE_MULTITEXPARAMETER_I:
12378 {
12379 GLint params[4];
12380 params[0] = n[4].i;
12381 params[1] = n[5].i;
12382 params[2] = n[6].i;
12383 params[3] = n[7].i;
12384 CALL_MultiTexParameterivEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, params));
12385 }
12386 break;
12387 case OPCODE_MULTITEX_IMAGE1D:
12388 {
12389 const struct gl_pixelstore_attrib save = ctx->Unpack;
12390 ctx->Unpack = ctx->DefaultPacking;
12391 CALL_MultiTexImage1DEXT(ctx->Exec, (n[1].e, /* texture */
12392 n[2].e, /* target */
12393 n[3].i, /* level */
12394 n[4].i, /* components */
12395 n[5].i, /* width */
12396 n[6].e, /* border */
12397 n[7].e, /* format */
12398 n[8].e, /* type */
12399 get_pointer(&n[9])));
12400 ctx->Unpack = save; /* restore */
12401 }
12402 break;
12403 case OPCODE_MULTITEX_IMAGE2D:
12404 {
12405 const struct gl_pixelstore_attrib save = ctx->Unpack;
12406 ctx->Unpack = ctx->DefaultPacking;
12407 CALL_MultiTexImage2DEXT(ctx->Exec, (n[1].e, /* texture */
12408 n[2].e, /* target */
12409 n[3].i, /* level */
12410 n[4].i, /* components */
12411 n[5].i, /* width */
12412 n[6].i, /* height */
12413 n[7].e, /* border */
12414 n[8].e, /* format */
12415 n[9].e, /* type */
12416 get_pointer(&n[10])));
12417 ctx->Unpack = save; /* restore */
12418 }
12419 break;
12420 case OPCODE_MULTITEX_IMAGE3D:
12421 {
12422 const struct gl_pixelstore_attrib save = ctx->Unpack;
12423 ctx->Unpack = ctx->DefaultPacking;
12424 CALL_MultiTexImage3DEXT(ctx->Exec, (n[1].e, /* texture */
12425 n[2].e, /* target */
12426 n[3].i, /* level */
12427 n[4].i, /* components */
12428 n[5].i, /* width */
12429 n[6].i, /* height */
12430 n[7].i, /* depth */
12431 n[8].e, /* border */
12432 n[9].e, /* format */
12433 n[10].e, /* type */
12434 get_pointer(&n[11])));
12435 ctx->Unpack = save; /* restore */
12436 }
12437 break;
12438 case OPCODE_MULTITEX_SUB_IMAGE1D:
12439 {
12440 const struct gl_pixelstore_attrib save = ctx->Unpack;
12441 ctx->Unpack = ctx->DefaultPacking;
12442 CALL_MultiTexSubImage1DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
12443 n[4].i, n[5].i, n[6].e,
12444 n[7].e, get_pointer(&n[8])));
12445 ctx->Unpack = save; /* restore */
12446 }
12447 break;
12448 case OPCODE_MULTITEX_SUB_IMAGE2D:
12449 {
12450 const struct gl_pixelstore_attrib save = ctx->Unpack;
12451 ctx->Unpack = ctx->DefaultPacking;
12452 CALL_MultiTexSubImage2DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
12453 n[4].i, n[5].i, n[6].e,
12454 n[7].i, n[8].e, n[9].e,
12455 get_pointer(&n[10])));
12456 ctx->Unpack = save; /* restore */
12457 }
12458 break;
12459 case OPCODE_MULTITEX_SUB_IMAGE3D:
12460 {
12461 const struct gl_pixelstore_attrib save = ctx->Unpack;
12462 ctx->Unpack = ctx->DefaultPacking;
12463 CALL_MultiTexSubImage3DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
12464 n[4].i, n[5].i, n[6].i,
12465 n[7].i, n[8].i, n[9].i,
12466 n[10].e, n[11].e,
12467 get_pointer(&n[12])));
12468 ctx->Unpack = save; /* restore */
12469 }
12470 break;
12471 case OPCODE_COPY_MULTITEX_IMAGE1D:
12472 CALL_CopyMultiTexImage1DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
12473 n[4].e, n[5].i, n[6].i,
12474 n[7].i, n[8].i));
12475 break;
12476 case OPCODE_COPY_MULTITEX_IMAGE2D:
12477 CALL_CopyMultiTexImage2DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
12478 n[4].e, n[5].i, n[6].i,
12479 n[7].i, n[8].i, n[9].i));
12480 break;
12481 case OPCODE_COPY_MULTITEX_SUB_IMAGE1D:
12482 CALL_CopyMultiTexSubImage1DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
12483 n[4].i, n[5].i, n[6].i,
12484 n[7].i));
12485 break;
12486 case OPCODE_COPY_MULTITEX_SUB_IMAGE2D:
12487 CALL_CopyMultiTexSubImage2DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
12488 n[4].i, n[5].i, n[6].i,
12489 n[7].i, n[8].i, n[9].i));
12490 break;
12491 case OPCODE_COPY_MULTITEX_SUB_IMAGE3D:
12492 CALL_CopyMultiTexSubImage3DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
12493 n[4].i, n[5].i, n[6].i,
12494 n[7].i, n[8].i, n[9].i,
12495 n[10].i));
12496 break;
12497 case OPCODE_MULTITEXENV:
12498 {
12499 GLfloat params[4];
12500 params[0] = n[4].f;
12501 params[1] = n[5].f;
12502 params[2] = n[6].f;
12503 params[3] = n[7].f;
12504 CALL_MultiTexEnvfvEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, params));
12505 }
12506 break;
12507 case OPCODE_COMPRESSED_TEXTURE_IMAGE_1D:
12508 CALL_CompressedTextureImage1DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
12509 n[4].e, n[5].i, n[6].i,
12510 n[7].i, get_pointer(&n[8])));
12511 break;
12512 case OPCODE_COMPRESSED_TEXTURE_IMAGE_2D:
12513 CALL_CompressedTextureImage2DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
12514 n[4].e, n[5].i, n[6].i,
12515 n[7].i, n[8].i,
12516 get_pointer(&n[9])));
12517 break;
12518 case OPCODE_COMPRESSED_TEXTURE_IMAGE_3D:
12519 CALL_CompressedTextureImage3DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
12520 n[4].e, n[5].i, n[6].i,
12521 n[7].i, n[8].i, n[9].i,
12522 get_pointer(&n[10])));
12523 break;
12524 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_1D:
12525 CALL_CompressedTextureSubImage1DEXT(ctx->Exec,
12526 (n[1].ui, n[2].e, n[3].i, n[4].i,
12527 n[5].i, n[6].e, n[7].i,
12528 get_pointer(&n[8])));
12529 break;
12530 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_2D:
12531 CALL_CompressedTextureSubImage2DEXT(ctx->Exec,
12532 (n[1].ui, n[2].e, n[3].i, n[4].i,
12533 n[5].i, n[6].i, n[7].i, n[8].e,
12534 n[9].i, get_pointer(&n[10])));
12535 break;
12536 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_3D:
12537 CALL_CompressedTextureSubImage3DEXT(ctx->Exec,
12538 (n[1].ui, n[2].e, n[3].i, n[4].i,
12539 n[5].i, n[6].i, n[7].i, n[8].i,
12540 n[9].i, n[10].e, n[11].i,
12541 get_pointer(&n[12])));
12542 break;
12543
12544 case OPCODE_CONTINUE:
12545 n = (Node *) get_pointer(&n[1]);
12546 break;
12547 case OPCODE_NOP:
12548 /* no-op */
12549 break;
12550 case OPCODE_END_OF_LIST:
12551 done = GL_TRUE;
12552 break;
12553 default:
12554 {
12555 char msg[1000];
12556 _mesa_snprintf(msg, sizeof(msg), "Error in execute_list: opcode=%d",
12557 (int) opcode);
12558 _mesa_problem(ctx, "%s", msg);
12559 }
12560 done = GL_TRUE;
12561 }
12562
12563 /* increment n to point to next compiled command */
12564 if (opcode != OPCODE_CONTINUE) {
12565 assert(InstSize[opcode] > 0);
12566 n += InstSize[opcode];
12567 }
12568 }
12569 }
12570
12571 vbo_save_EndCallList(ctx);
12572
12573 ctx->ListState.CallDepth--;
12574 }
12575
12576
12577
12578 /**********************************************************************/
12579 /* GL functions */
12580 /**********************************************************************/
12581
12582 /**
12583 * Test if a display list number is valid.
12584 */
12585 GLboolean GLAPIENTRY
12586 _mesa_IsList(GLuint list)
12587 {
12588 GET_CURRENT_CONTEXT(ctx);
12589 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
12590 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
12591 return islist(ctx, list);
12592 }
12593
12594
12595 /**
12596 * Delete a sequence of consecutive display lists.
12597 */
12598 void GLAPIENTRY
12599 _mesa_DeleteLists(GLuint list, GLsizei range)
12600 {
12601 GET_CURRENT_CONTEXT(ctx);
12602 GLuint i;
12603 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
12604 ASSERT_OUTSIDE_BEGIN_END(ctx);
12605
12606 if (range < 0) {
12607 _mesa_error(ctx, GL_INVALID_VALUE, "glDeleteLists");
12608 return;
12609 }
12610
12611 if (range > 1) {
12612 /* We may be deleting a set of bitmap lists. See if there's a
12613 * bitmap atlas to free.
12614 */
12615 struct gl_bitmap_atlas *atlas = lookup_bitmap_atlas(ctx, list);
12616 if (atlas) {
12617 _mesa_delete_bitmap_atlas(ctx, atlas);
12618 _mesa_HashRemove(ctx->Shared->BitmapAtlas, list);
12619 }
12620 }
12621
12622 for (i = list; i < list + range; i++) {
12623 destroy_list(ctx, i);
12624 }
12625 }
12626
12627
12628 /**
12629 * Return a display list number, n, such that lists n through n+range-1
12630 * are free.
12631 */
12632 GLuint GLAPIENTRY
12633 _mesa_GenLists(GLsizei range)
12634 {
12635 GET_CURRENT_CONTEXT(ctx);
12636 GLuint base;
12637 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
12638 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
12639
12640 if (range < 0) {
12641 _mesa_error(ctx, GL_INVALID_VALUE, "glGenLists");
12642 return 0;
12643 }
12644 if (range == 0) {
12645 return 0;
12646 }
12647
12648 /*
12649 * Make this an atomic operation
12650 */
12651 _mesa_HashLockMutex(ctx->Shared->DisplayList);
12652
12653 base = _mesa_HashFindFreeKeyBlock(ctx->Shared->DisplayList, range);
12654 if (base) {
12655 /* reserve the list IDs by with empty/dummy lists */
12656 GLint i;
12657 for (i = 0; i < range; i++) {
12658 _mesa_HashInsertLocked(ctx->Shared->DisplayList, base + i,
12659 make_list(base + i, 1));
12660 }
12661 }
12662
12663 if (USE_BITMAP_ATLAS &&
12664 range > 16 &&
12665 ctx->Driver.DrawAtlasBitmaps) {
12666 /* "range > 16" is a rough heuristic to guess when glGenLists might be
12667 * used to allocate display lists for glXUseXFont or wglUseFontBitmaps.
12668 * Create the empty atlas now.
12669 */
12670 struct gl_bitmap_atlas *atlas = lookup_bitmap_atlas(ctx, base);
12671 if (!atlas) {
12672 atlas = alloc_bitmap_atlas(ctx, base);
12673 }
12674 if (atlas) {
12675 /* Atlas _should_ be new/empty now, but clobbering is OK */
12676 assert(atlas->numBitmaps == 0);
12677 atlas->numBitmaps = range;
12678 }
12679 }
12680
12681 _mesa_HashUnlockMutex(ctx->Shared->DisplayList);
12682
12683 return base;
12684 }
12685
12686
12687 /**
12688 * Begin a new display list.
12689 */
12690 void GLAPIENTRY
12691 _mesa_NewList(GLuint name, GLenum mode)
12692 {
12693 GET_CURRENT_CONTEXT(ctx);
12694
12695 FLUSH_CURRENT(ctx, 0); /* must be called before assert */
12696 ASSERT_OUTSIDE_BEGIN_END(ctx);
12697
12698 if (MESA_VERBOSE & VERBOSE_API)
12699 _mesa_debug(ctx, "glNewList %u %s\n", name,
12700 _mesa_enum_to_string(mode));
12701
12702 if (name == 0) {
12703 _mesa_error(ctx, GL_INVALID_VALUE, "glNewList");
12704 return;
12705 }
12706
12707 if (mode != GL_COMPILE && mode != GL_COMPILE_AND_EXECUTE) {
12708 _mesa_error(ctx, GL_INVALID_ENUM, "glNewList");
12709 return;
12710 }
12711
12712 if (ctx->ListState.CurrentList) {
12713 /* already compiling a display list */
12714 _mesa_error(ctx, GL_INVALID_OPERATION, "glNewList");
12715 return;
12716 }
12717
12718 ctx->CompileFlag = GL_TRUE;
12719 ctx->ExecuteFlag = (mode == GL_COMPILE_AND_EXECUTE);
12720
12721 /* Reset accumulated list state */
12722 invalidate_saved_current_state( ctx );
12723
12724 /* Allocate new display list */
12725 ctx->ListState.CurrentList = make_list(name, BLOCK_SIZE);
12726 ctx->ListState.CurrentBlock = ctx->ListState.CurrentList->Head;
12727 ctx->ListState.CurrentPos = 0;
12728
12729 vbo_save_NewList(ctx, name, mode);
12730
12731 ctx->CurrentServerDispatch = ctx->Save;
12732 _glapi_set_dispatch(ctx->CurrentServerDispatch);
12733 if (ctx->MarshalExec == NULL) {
12734 ctx->CurrentClientDispatch = ctx->CurrentServerDispatch;
12735 }
12736 }
12737
12738
12739 /**
12740 * End definition of current display list.
12741 */
12742 void GLAPIENTRY
12743 _mesa_EndList(void)
12744 {
12745 GET_CURRENT_CONTEXT(ctx);
12746 SAVE_FLUSH_VERTICES(ctx);
12747 FLUSH_VERTICES(ctx, 0);
12748
12749 if (MESA_VERBOSE & VERBOSE_API)
12750 _mesa_debug(ctx, "glEndList\n");
12751
12752 if (ctx->ExecuteFlag && _mesa_inside_dlist_begin_end(ctx)) {
12753 _mesa_error(ctx, GL_INVALID_OPERATION,
12754 "glEndList() called inside glBegin/End");
12755 }
12756
12757 /* Check that a list is under construction */
12758 if (!ctx->ListState.CurrentList) {
12759 _mesa_error(ctx, GL_INVALID_OPERATION, "glEndList");
12760 return;
12761 }
12762
12763 /* Call before emitting END_OF_LIST, in case the driver wants to
12764 * emit opcodes itself.
12765 */
12766 vbo_save_EndList(ctx);
12767
12768 (void) alloc_instruction(ctx, OPCODE_END_OF_LIST, 0);
12769
12770 trim_list(ctx);
12771
12772 /* Destroy old list, if any */
12773 destroy_list(ctx, ctx->ListState.CurrentList->Name);
12774
12775 /* Install the new list */
12776 _mesa_HashInsert(ctx->Shared->DisplayList,
12777 ctx->ListState.CurrentList->Name,
12778 ctx->ListState.CurrentList);
12779
12780
12781 if (MESA_VERBOSE & VERBOSE_DISPLAY_LIST)
12782 mesa_print_display_list(ctx->ListState.CurrentList->Name);
12783
12784 ctx->ListState.CurrentList = NULL;
12785 ctx->ListState.CurrentBlock = NULL;
12786 ctx->ListState.CurrentPos = 0;
12787 ctx->ExecuteFlag = GL_TRUE;
12788 ctx->CompileFlag = GL_FALSE;
12789
12790 ctx->CurrentServerDispatch = ctx->Exec;
12791 _glapi_set_dispatch(ctx->CurrentServerDispatch);
12792 if (ctx->MarshalExec == NULL) {
12793 ctx->CurrentClientDispatch = ctx->CurrentServerDispatch;
12794 }
12795 }
12796
12797
12798 void GLAPIENTRY
12799 _mesa_CallList(GLuint list)
12800 {
12801 GLboolean save_compile_flag;
12802 GET_CURRENT_CONTEXT(ctx);
12803 FLUSH_CURRENT(ctx, 0);
12804
12805 if (MESA_VERBOSE & VERBOSE_API)
12806 _mesa_debug(ctx, "glCallList %d\n", list);
12807
12808 if (list == 0) {
12809 _mesa_error(ctx, GL_INVALID_VALUE, "glCallList(list==0)");
12810 return;
12811 }
12812
12813 if (0)
12814 mesa_print_display_list( list );
12815
12816 /* VERY IMPORTANT: Save the CompileFlag status, turn it off,
12817 * execute the display list, and restore the CompileFlag.
12818 */
12819 save_compile_flag = ctx->CompileFlag;
12820 if (save_compile_flag) {
12821 ctx->CompileFlag = GL_FALSE;
12822 }
12823
12824 execute_list(ctx, list);
12825 ctx->CompileFlag = save_compile_flag;
12826
12827 /* also restore API function pointers to point to "save" versions */
12828 if (save_compile_flag) {
12829 ctx->CurrentServerDispatch = ctx->Save;
12830 _glapi_set_dispatch(ctx->CurrentServerDispatch);
12831 if (ctx->MarshalExec == NULL) {
12832 ctx->CurrentClientDispatch = ctx->CurrentServerDispatch;
12833 }
12834 }
12835 }
12836
12837
12838 /**
12839 * Try to execute a glCallLists() command where the display lists contain
12840 * glBitmap commands with a texture atlas.
12841 * \return true for success, false otherwise
12842 */
12843 static bool
12844 render_bitmap_atlas(struct gl_context *ctx, GLsizei n, GLenum type,
12845 const void *lists)
12846 {
12847 struct gl_bitmap_atlas *atlas;
12848 int i;
12849
12850 if (!USE_BITMAP_ATLAS ||
12851 !ctx->Current.RasterPosValid ||
12852 ctx->List.ListBase == 0 ||
12853 type != GL_UNSIGNED_BYTE ||
12854 !ctx->Driver.DrawAtlasBitmaps) {
12855 /* unsupported */
12856 return false;
12857 }
12858
12859 atlas = lookup_bitmap_atlas(ctx, ctx->List.ListBase);
12860
12861 if (!atlas) {
12862 /* Even if glGenLists wasn't called, we can still try to create
12863 * the atlas now.
12864 */
12865 atlas = alloc_bitmap_atlas(ctx, ctx->List.ListBase);
12866 }
12867
12868 if (atlas && !atlas->complete && !atlas->incomplete) {
12869 /* Try to build the bitmap atlas now.
12870 * If the atlas was created in glGenLists, we'll have recorded the
12871 * number of lists (bitmaps). Otherwise, take a guess at 256.
12872 */
12873 if (atlas->numBitmaps == 0)
12874 atlas->numBitmaps = 256;
12875 build_bitmap_atlas(ctx, atlas, ctx->List.ListBase);
12876 }
12877
12878 if (!atlas || !atlas->complete) {
12879 return false;
12880 }
12881
12882 /* check that all display list IDs are in the atlas */
12883 for (i = 0; i < n; i++) {
12884 const GLubyte *ids = (const GLubyte *) lists;
12885
12886 if (ids[i] >= atlas->numBitmaps) {
12887 return false;
12888 }
12889 }
12890
12891 ctx->Driver.DrawAtlasBitmaps(ctx, atlas, n, (const GLubyte *) lists);
12892
12893 return true;
12894 }
12895
12896
12897 /**
12898 * Execute glCallLists: call multiple display lists.
12899 */
12900 void GLAPIENTRY
12901 _mesa_CallLists(GLsizei n, GLenum type, const GLvoid * lists)
12902 {
12903 GET_CURRENT_CONTEXT(ctx);
12904 GLint i;
12905 GLboolean save_compile_flag;
12906
12907 if (MESA_VERBOSE & VERBOSE_API)
12908 _mesa_debug(ctx, "glCallLists %d\n", n);
12909
12910 switch (type) {
12911 case GL_BYTE:
12912 case GL_UNSIGNED_BYTE:
12913 case GL_SHORT:
12914 case GL_UNSIGNED_SHORT:
12915 case GL_INT:
12916 case GL_UNSIGNED_INT:
12917 case GL_FLOAT:
12918 case GL_2_BYTES:
12919 case GL_3_BYTES:
12920 case GL_4_BYTES:
12921 /* OK */
12922 break;
12923 default:
12924 _mesa_error(ctx, GL_INVALID_ENUM, "glCallLists(type)");
12925 return;
12926 }
12927
12928 if (n < 0) {
12929 _mesa_error(ctx, GL_INVALID_VALUE, "glCallLists(n < 0)");
12930 return;
12931 } else if (n == 0 || lists == NULL) {
12932 /* nothing to do */
12933 return;
12934 }
12935
12936 if (render_bitmap_atlas(ctx, n, type, lists)) {
12937 return;
12938 }
12939
12940 /* Save the CompileFlag status, turn it off, execute display list,
12941 * and restore the CompileFlag.
12942 */
12943 save_compile_flag = ctx->CompileFlag;
12944 ctx->CompileFlag = GL_FALSE;
12945
12946 for (i = 0; i < n; i++) {
12947 GLuint list = (GLuint) (ctx->List.ListBase + translate_id(i, type, lists));
12948 execute_list(ctx, list);
12949 }
12950
12951 ctx->CompileFlag = save_compile_flag;
12952
12953 /* also restore API function pointers to point to "save" versions */
12954 if (save_compile_flag) {
12955 ctx->CurrentServerDispatch = ctx->Save;
12956 _glapi_set_dispatch(ctx->CurrentServerDispatch);
12957 if (ctx->MarshalExec == NULL) {
12958 ctx->CurrentClientDispatch = ctx->CurrentServerDispatch;
12959 }
12960 }
12961 }
12962
12963
12964 /**
12965 * Set the offset added to list numbers in glCallLists.
12966 */
12967 void GLAPIENTRY
12968 _mesa_ListBase(GLuint base)
12969 {
12970 GET_CURRENT_CONTEXT(ctx);
12971 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
12972 ASSERT_OUTSIDE_BEGIN_END(ctx);
12973 ctx->List.ListBase = base;
12974 }
12975
12976 /**
12977 * Setup the given dispatch table to point to Mesa's display list
12978 * building functions.
12979 *
12980 * This does not include any of the tnl functions - they are
12981 * initialized from _mesa_init_api_defaults and from the active vtxfmt
12982 * struct.
12983 */
12984 void
12985 _mesa_initialize_save_table(const struct gl_context *ctx)
12986 {
12987 struct _glapi_table *table = ctx->Save;
12988 int numEntries = MAX2(_gloffset_COUNT, _glapi_get_dispatch_table_size());
12989
12990 /* Initially populate the dispatch table with the contents of the
12991 * normal-execution dispatch table. This lets us skip populating functions
12992 * that should be called directly instead of compiled into display lists.
12993 */
12994 memcpy(table, ctx->Exec, numEntries * sizeof(_glapi_proc));
12995
12996 _mesa_loopback_init_api_table(ctx, table);
12997
12998 /* VBO functions */
12999 vbo_initialize_save_dispatch(ctx, table);
13000
13001 /* GL 1.0 */
13002 SET_Accum(table, save_Accum);
13003 SET_AlphaFunc(table, save_AlphaFunc);
13004 SET_Bitmap(table, save_Bitmap);
13005 SET_BlendFunc(table, save_BlendFunc);
13006 SET_CallList(table, save_CallList);
13007 SET_CallLists(table, save_CallLists);
13008 SET_Clear(table, save_Clear);
13009 SET_ClearAccum(table, save_ClearAccum);
13010 SET_ClearColor(table, save_ClearColor);
13011 SET_ClearDepth(table, save_ClearDepth);
13012 SET_ClearIndex(table, save_ClearIndex);
13013 SET_ClearStencil(table, save_ClearStencil);
13014 SET_ClipPlane(table, save_ClipPlane);
13015 SET_ColorMask(table, save_ColorMask);
13016 SET_ColorMaski(table, save_ColorMaskIndexed);
13017 SET_ColorMaterial(table, save_ColorMaterial);
13018 SET_CopyPixels(table, save_CopyPixels);
13019 SET_CullFace(table, save_CullFace);
13020 SET_DepthFunc(table, save_DepthFunc);
13021 SET_DepthMask(table, save_DepthMask);
13022 SET_DepthRange(table, save_DepthRange);
13023 SET_Disable(table, save_Disable);
13024 SET_Disablei(table, save_DisableIndexed);
13025 SET_DrawBuffer(table, save_DrawBuffer);
13026 SET_DrawPixels(table, save_DrawPixels);
13027 SET_Enable(table, save_Enable);
13028 SET_Enablei(table, save_EnableIndexed);
13029 SET_EvalMesh1(table, save_EvalMesh1);
13030 SET_EvalMesh2(table, save_EvalMesh2);
13031 SET_Fogf(table, save_Fogf);
13032 SET_Fogfv(table, save_Fogfv);
13033 SET_Fogi(table, save_Fogi);
13034 SET_Fogiv(table, save_Fogiv);
13035 SET_FrontFace(table, save_FrontFace);
13036 SET_Frustum(table, save_Frustum);
13037 SET_Hint(table, save_Hint);
13038 SET_IndexMask(table, save_IndexMask);
13039 SET_InitNames(table, save_InitNames);
13040 SET_LightModelf(table, save_LightModelf);
13041 SET_LightModelfv(table, save_LightModelfv);
13042 SET_LightModeli(table, save_LightModeli);
13043 SET_LightModeliv(table, save_LightModeliv);
13044 SET_Lightf(table, save_Lightf);
13045 SET_Lightfv(table, save_Lightfv);
13046 SET_Lighti(table, save_Lighti);
13047 SET_Lightiv(table, save_Lightiv);
13048 SET_LineStipple(table, save_LineStipple);
13049 SET_LineWidth(table, save_LineWidth);
13050 SET_ListBase(table, save_ListBase);
13051 SET_LoadIdentity(table, save_LoadIdentity);
13052 SET_LoadMatrixd(table, save_LoadMatrixd);
13053 SET_LoadMatrixf(table, save_LoadMatrixf);
13054 SET_LoadName(table, save_LoadName);
13055 SET_LogicOp(table, save_LogicOp);
13056 SET_Map1d(table, save_Map1d);
13057 SET_Map1f(table, save_Map1f);
13058 SET_Map2d(table, save_Map2d);
13059 SET_Map2f(table, save_Map2f);
13060 SET_MapGrid1d(table, save_MapGrid1d);
13061 SET_MapGrid1f(table, save_MapGrid1f);
13062 SET_MapGrid2d(table, save_MapGrid2d);
13063 SET_MapGrid2f(table, save_MapGrid2f);
13064 SET_MatrixMode(table, save_MatrixMode);
13065 SET_MultMatrixd(table, save_MultMatrixd);
13066 SET_MultMatrixf(table, save_MultMatrixf);
13067 SET_NewList(table, save_NewList);
13068 SET_Ortho(table, save_Ortho);
13069 SET_PassThrough(table, save_PassThrough);
13070 SET_PixelMapfv(table, save_PixelMapfv);
13071 SET_PixelMapuiv(table, save_PixelMapuiv);
13072 SET_PixelMapusv(table, save_PixelMapusv);
13073 SET_PixelTransferf(table, save_PixelTransferf);
13074 SET_PixelTransferi(table, save_PixelTransferi);
13075 SET_PixelZoom(table, save_PixelZoom);
13076 SET_PointSize(table, save_PointSize);
13077 SET_PolygonMode(table, save_PolygonMode);
13078 SET_PolygonOffset(table, save_PolygonOffset);
13079 SET_PolygonStipple(table, save_PolygonStipple);
13080 SET_PopAttrib(table, save_PopAttrib);
13081 SET_PopMatrix(table, save_PopMatrix);
13082 SET_PopName(table, save_PopName);
13083 SET_PushAttrib(table, save_PushAttrib);
13084 SET_PushMatrix(table, save_PushMatrix);
13085 SET_PushName(table, save_PushName);
13086 SET_RasterPos2d(table, save_RasterPos2d);
13087 SET_RasterPos2dv(table, save_RasterPos2dv);
13088 SET_RasterPos2f(table, save_RasterPos2f);
13089 SET_RasterPos2fv(table, save_RasterPos2fv);
13090 SET_RasterPos2i(table, save_RasterPos2i);
13091 SET_RasterPos2iv(table, save_RasterPos2iv);
13092 SET_RasterPos2s(table, save_RasterPos2s);
13093 SET_RasterPos2sv(table, save_RasterPos2sv);
13094 SET_RasterPos3d(table, save_RasterPos3d);
13095 SET_RasterPos3dv(table, save_RasterPos3dv);
13096 SET_RasterPos3f(table, save_RasterPos3f);
13097 SET_RasterPos3fv(table, save_RasterPos3fv);
13098 SET_RasterPos3i(table, save_RasterPos3i);
13099 SET_RasterPos3iv(table, save_RasterPos3iv);
13100 SET_RasterPos3s(table, save_RasterPos3s);
13101 SET_RasterPos3sv(table, save_RasterPos3sv);
13102 SET_RasterPos4d(table, save_RasterPos4d);
13103 SET_RasterPos4dv(table, save_RasterPos4dv);
13104 SET_RasterPos4f(table, save_RasterPos4f);
13105 SET_RasterPos4fv(table, save_RasterPos4fv);
13106 SET_RasterPos4i(table, save_RasterPos4i);
13107 SET_RasterPos4iv(table, save_RasterPos4iv);
13108 SET_RasterPos4s(table, save_RasterPos4s);
13109 SET_RasterPos4sv(table, save_RasterPos4sv);
13110 SET_ReadBuffer(table, save_ReadBuffer);
13111 SET_Rectf(table, save_Rectf);
13112 SET_Rotated(table, save_Rotated);
13113 SET_Rotatef(table, save_Rotatef);
13114 SET_Scaled(table, save_Scaled);
13115 SET_Scalef(table, save_Scalef);
13116 SET_Scissor(table, save_Scissor);
13117 SET_ShadeModel(table, save_ShadeModel);
13118 SET_StencilFunc(table, save_StencilFunc);
13119 SET_StencilMask(table, save_StencilMask);
13120 SET_StencilOp(table, save_StencilOp);
13121 SET_TexEnvf(table, save_TexEnvf);
13122 SET_TexEnvfv(table, save_TexEnvfv);
13123 SET_TexEnvi(table, save_TexEnvi);
13124 SET_TexEnviv(table, save_TexEnviv);
13125 SET_TexGend(table, save_TexGend);
13126 SET_TexGendv(table, save_TexGendv);
13127 SET_TexGenf(table, save_TexGenf);
13128 SET_TexGenfv(table, save_TexGenfv);
13129 SET_TexGeni(table, save_TexGeni);
13130 SET_TexGeniv(table, save_TexGeniv);
13131 SET_TexImage1D(table, save_TexImage1D);
13132 SET_TexImage2D(table, save_TexImage2D);
13133 SET_TexParameterf(table, save_TexParameterf);
13134 SET_TexParameterfv(table, save_TexParameterfv);
13135 SET_TexParameteri(table, save_TexParameteri);
13136 SET_TexParameteriv(table, save_TexParameteriv);
13137 SET_Translated(table, save_Translated);
13138 SET_Translatef(table, save_Translatef);
13139 SET_Viewport(table, save_Viewport);
13140
13141 /* GL 1.1 */
13142 SET_BindTexture(table, save_BindTexture);
13143 SET_CopyTexImage1D(table, save_CopyTexImage1D);
13144 SET_CopyTexImage2D(table, save_CopyTexImage2D);
13145 SET_CopyTexSubImage1D(table, save_CopyTexSubImage1D);
13146 SET_CopyTexSubImage2D(table, save_CopyTexSubImage2D);
13147 SET_PrioritizeTextures(table, save_PrioritizeTextures);
13148 SET_TexSubImage1D(table, save_TexSubImage1D);
13149 SET_TexSubImage2D(table, save_TexSubImage2D);
13150
13151 /* GL 1.2 */
13152 SET_CopyTexSubImage3D(table, save_CopyTexSubImage3D);
13153 SET_TexImage3D(table, save_TexImage3D);
13154 SET_TexSubImage3D(table, save_TexSubImage3D);
13155
13156 /* GL 2.0 */
13157 SET_StencilFuncSeparate(table, save_StencilFuncSeparate);
13158 SET_StencilMaskSeparate(table, save_StencilMaskSeparate);
13159 SET_StencilOpSeparate(table, save_StencilOpSeparate);
13160
13161 /* ATI_separate_stencil */
13162 SET_StencilFuncSeparateATI(table, save_StencilFuncSeparateATI);
13163
13164 /* GL_ARB_imaging */
13165 /* Not all are supported */
13166 SET_BlendColor(table, save_BlendColor);
13167 SET_BlendEquation(table, save_BlendEquation);
13168
13169 /* 2. GL_EXT_blend_color */
13170 #if 0
13171 SET_BlendColorEXT(table, save_BlendColorEXT);
13172 #endif
13173
13174 /* 6. GL_EXT_texture3d */
13175 #if 0
13176 SET_CopyTexSubImage3DEXT(table, save_CopyTexSubImage3D);
13177 SET_TexImage3DEXT(table, save_TexImage3DEXT);
13178 SET_TexSubImage3DEXT(table, save_TexSubImage3D);
13179 #endif
13180
13181 /* 37. GL_EXT_blend_minmax */
13182 #if 0
13183 SET_BlendEquationEXT(table, save_BlendEquationEXT);
13184 #endif
13185
13186 /* 54. GL_EXT_point_parameters */
13187 SET_PointParameterf(table, save_PointParameterfEXT);
13188 SET_PointParameterfv(table, save_PointParameterfvEXT);
13189
13190 /* 91. GL_ARB_tessellation_shader */
13191 SET_PatchParameteri(table, save_PatchParameteri);
13192 SET_PatchParameterfv(table, save_PatchParameterfv);
13193
13194 /* 100. ARB_viewport_array */
13195 SET_ViewportArrayv(table, save_ViewportArrayv);
13196 SET_ViewportIndexedf(table, save_ViewportIndexedf);
13197 SET_ViewportIndexedfv(table, save_ViewportIndexedfv);
13198 SET_ScissorArrayv(table, save_ScissorArrayv);
13199 SET_ScissorIndexed(table, save_ScissorIndexed);
13200 SET_ScissorIndexedv(table, save_ScissorIndexedv);
13201 SET_DepthRangeArrayv(table, save_DepthRangeArrayv);
13202 SET_DepthRangeIndexed(table, save_DepthRangeIndexed);
13203
13204 /* 122. ARB_compute_shader */
13205 SET_DispatchCompute(table, save_DispatchCompute);
13206 SET_DispatchComputeIndirect(table, save_DispatchComputeIndirect);
13207
13208 /* 173. GL_EXT_blend_func_separate */
13209 SET_BlendFuncSeparate(table, save_BlendFuncSeparateEXT);
13210
13211 /* 197. GL_MESA_window_pos */
13212 SET_WindowPos2d(table, save_WindowPos2dMESA);
13213 SET_WindowPos2dv(table, save_WindowPos2dvMESA);
13214 SET_WindowPos2f(table, save_WindowPos2fMESA);
13215 SET_WindowPos2fv(table, save_WindowPos2fvMESA);
13216 SET_WindowPos2i(table, save_WindowPos2iMESA);
13217 SET_WindowPos2iv(table, save_WindowPos2ivMESA);
13218 SET_WindowPos2s(table, save_WindowPos2sMESA);
13219 SET_WindowPos2sv(table, save_WindowPos2svMESA);
13220 SET_WindowPos3d(table, save_WindowPos3dMESA);
13221 SET_WindowPos3dv(table, save_WindowPos3dvMESA);
13222 SET_WindowPos3f(table, save_WindowPos3fMESA);
13223 SET_WindowPos3fv(table, save_WindowPos3fvMESA);
13224 SET_WindowPos3i(table, save_WindowPos3iMESA);
13225 SET_WindowPos3iv(table, save_WindowPos3ivMESA);
13226 SET_WindowPos3s(table, save_WindowPos3sMESA);
13227 SET_WindowPos3sv(table, save_WindowPos3svMESA);
13228 SET_WindowPos4dMESA(table, save_WindowPos4dMESA);
13229 SET_WindowPos4dvMESA(table, save_WindowPos4dvMESA);
13230 SET_WindowPos4fMESA(table, save_WindowPos4fMESA);
13231 SET_WindowPos4fvMESA(table, save_WindowPos4fvMESA);
13232 SET_WindowPos4iMESA(table, save_WindowPos4iMESA);
13233 SET_WindowPos4ivMESA(table, save_WindowPos4ivMESA);
13234 SET_WindowPos4sMESA(table, save_WindowPos4sMESA);
13235 SET_WindowPos4svMESA(table, save_WindowPos4svMESA);
13236
13237 /* 245. GL_ATI_fragment_shader */
13238 SET_BindFragmentShaderATI(table, save_BindFragmentShaderATI);
13239 SET_SetFragmentShaderConstantATI(table, save_SetFragmentShaderConstantATI);
13240
13241 /* 262. GL_NV_point_sprite */
13242 SET_PointParameteri(table, save_PointParameteriNV);
13243 SET_PointParameteriv(table, save_PointParameterivNV);
13244
13245 /* 268. GL_EXT_stencil_two_side */
13246 SET_ActiveStencilFaceEXT(table, save_ActiveStencilFaceEXT);
13247
13248 /* ???. GL_EXT_depth_bounds_test */
13249 SET_DepthBoundsEXT(table, save_DepthBoundsEXT);
13250
13251 /* ARB 1. GL_ARB_multitexture */
13252 SET_ActiveTexture(table, save_ActiveTextureARB);
13253
13254 /* ARB 3. GL_ARB_transpose_matrix */
13255 SET_LoadTransposeMatrixd(table, save_LoadTransposeMatrixdARB);
13256 SET_LoadTransposeMatrixf(table, save_LoadTransposeMatrixfARB);
13257 SET_MultTransposeMatrixd(table, save_MultTransposeMatrixdARB);
13258 SET_MultTransposeMatrixf(table, save_MultTransposeMatrixfARB);
13259
13260 /* ARB 5. GL_ARB_multisample */
13261 SET_SampleCoverage(table, save_SampleCoverageARB);
13262
13263 /* ARB 12. GL_ARB_texture_compression */
13264 SET_CompressedTexImage3D(table, save_CompressedTexImage3DARB);
13265 SET_CompressedTexImage2D(table, save_CompressedTexImage2DARB);
13266 SET_CompressedTexImage1D(table, save_CompressedTexImage1DARB);
13267 SET_CompressedTexSubImage3D(table, save_CompressedTexSubImage3DARB);
13268 SET_CompressedTexSubImage2D(table, save_CompressedTexSubImage2DARB);
13269 SET_CompressedTexSubImage1D(table, save_CompressedTexSubImage1DARB);
13270
13271 /* ARB 14. GL_ARB_point_parameters */
13272 /* aliased with EXT_point_parameters functions */
13273
13274 /* ARB 25. GL_ARB_window_pos */
13275 /* aliased with MESA_window_pos functions */
13276
13277 /* ARB 26. GL_ARB_vertex_program */
13278 /* ARB 27. GL_ARB_fragment_program */
13279 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
13280 SET_ProgramStringARB(table, save_ProgramStringARB);
13281 SET_BindProgramARB(table, save_BindProgramARB);
13282 SET_ProgramEnvParameter4dARB(table, save_ProgramEnvParameter4dARB);
13283 SET_ProgramEnvParameter4dvARB(table, save_ProgramEnvParameter4dvARB);
13284 SET_ProgramEnvParameter4fARB(table, save_ProgramEnvParameter4fARB);
13285 SET_ProgramEnvParameter4fvARB(table, save_ProgramEnvParameter4fvARB);
13286 SET_ProgramLocalParameter4dARB(table, save_ProgramLocalParameter4dARB);
13287 SET_ProgramLocalParameter4dvARB(table, save_ProgramLocalParameter4dvARB);
13288 SET_ProgramLocalParameter4fARB(table, save_ProgramLocalParameter4fARB);
13289 SET_ProgramLocalParameter4fvARB(table, save_ProgramLocalParameter4fvARB);
13290
13291 SET_BeginQuery(table, save_BeginQueryARB);
13292 SET_EndQuery(table, save_EndQueryARB);
13293 SET_QueryCounter(table, save_QueryCounter);
13294
13295 SET_DrawBuffers(table, save_DrawBuffersARB);
13296
13297 SET_BlitFramebuffer(table, save_BlitFramebufferEXT);
13298
13299 SET_UseProgram(table, save_UseProgram);
13300 SET_Uniform1f(table, save_Uniform1fARB);
13301 SET_Uniform2f(table, save_Uniform2fARB);
13302 SET_Uniform3f(table, save_Uniform3fARB);
13303 SET_Uniform4f(table, save_Uniform4fARB);
13304 SET_Uniform1fv(table, save_Uniform1fvARB);
13305 SET_Uniform2fv(table, save_Uniform2fvARB);
13306 SET_Uniform3fv(table, save_Uniform3fvARB);
13307 SET_Uniform4fv(table, save_Uniform4fvARB);
13308 SET_Uniform1i(table, save_Uniform1iARB);
13309 SET_Uniform2i(table, save_Uniform2iARB);
13310 SET_Uniform3i(table, save_Uniform3iARB);
13311 SET_Uniform4i(table, save_Uniform4iARB);
13312 SET_Uniform1iv(table, save_Uniform1ivARB);
13313 SET_Uniform2iv(table, save_Uniform2ivARB);
13314 SET_Uniform3iv(table, save_Uniform3ivARB);
13315 SET_Uniform4iv(table, save_Uniform4ivARB);
13316 SET_UniformMatrix2fv(table, save_UniformMatrix2fvARB);
13317 SET_UniformMatrix3fv(table, save_UniformMatrix3fvARB);
13318 SET_UniformMatrix4fv(table, save_UniformMatrix4fvARB);
13319 SET_UniformMatrix2x3fv(table, save_UniformMatrix2x3fv);
13320 SET_UniformMatrix3x2fv(table, save_UniformMatrix3x2fv);
13321 SET_UniformMatrix2x4fv(table, save_UniformMatrix2x4fv);
13322 SET_UniformMatrix4x2fv(table, save_UniformMatrix4x2fv);
13323 SET_UniformMatrix3x4fv(table, save_UniformMatrix3x4fv);
13324 SET_UniformMatrix4x3fv(table, save_UniformMatrix4x3fv);
13325
13326 /* 299. GL_EXT_blend_equation_separate */
13327 SET_BlendEquationSeparate(table, save_BlendEquationSeparateEXT);
13328
13329 /* GL_EXT_gpu_program_parameters */
13330 SET_ProgramEnvParameters4fvEXT(table, save_ProgramEnvParameters4fvEXT);
13331 SET_ProgramLocalParameters4fvEXT(table, save_ProgramLocalParameters4fvEXT);
13332
13333 /* 364. GL_EXT_provoking_vertex */
13334 SET_ProvokingVertex(table, save_ProvokingVertexEXT);
13335
13336 /* GL_EXT_texture_integer */
13337 SET_ClearColorIiEXT(table, save_ClearColorIi);
13338 SET_ClearColorIuiEXT(table, save_ClearColorIui);
13339 SET_TexParameterIiv(table, save_TexParameterIiv);
13340 SET_TexParameterIuiv(table, save_TexParameterIuiv);
13341
13342 /* GL_ARB_clip_control */
13343 SET_ClipControl(table, save_ClipControl);
13344
13345 /* GL_ARB_color_buffer_float */
13346 SET_ClampColor(table, save_ClampColorARB);
13347
13348 /* GL 3.0 */
13349 SET_ClearBufferiv(table, save_ClearBufferiv);
13350 SET_ClearBufferuiv(table, save_ClearBufferuiv);
13351 SET_ClearBufferfv(table, save_ClearBufferfv);
13352 SET_ClearBufferfi(table, save_ClearBufferfi);
13353 SET_Uniform1ui(table, save_Uniform1ui);
13354 SET_Uniform2ui(table, save_Uniform2ui);
13355 SET_Uniform3ui(table, save_Uniform3ui);
13356 SET_Uniform4ui(table, save_Uniform4ui);
13357 SET_Uniform1uiv(table, save_Uniform1uiv);
13358 SET_Uniform2uiv(table, save_Uniform2uiv);
13359 SET_Uniform3uiv(table, save_Uniform3uiv);
13360 SET_Uniform4uiv(table, save_Uniform4uiv);
13361
13362 /* GL_ARB_gpu_shader_fp64 */
13363 SET_Uniform1d(table, save_Uniform1d);
13364 SET_Uniform2d(table, save_Uniform2d);
13365 SET_Uniform3d(table, save_Uniform3d);
13366 SET_Uniform4d(table, save_Uniform4d);
13367 SET_Uniform1dv(table, save_Uniform1dv);
13368 SET_Uniform2dv(table, save_Uniform2dv);
13369 SET_Uniform3dv(table, save_Uniform3dv);
13370 SET_Uniform4dv(table, save_Uniform4dv);
13371 SET_UniformMatrix2dv(table, save_UniformMatrix2dv);
13372 SET_UniformMatrix3dv(table, save_UniformMatrix3dv);
13373 SET_UniformMatrix4dv(table, save_UniformMatrix4dv);
13374 SET_UniformMatrix2x3dv(table, save_UniformMatrix2x3dv);
13375 SET_UniformMatrix3x2dv(table, save_UniformMatrix3x2dv);
13376 SET_UniformMatrix2x4dv(table, save_UniformMatrix2x4dv);
13377 SET_UniformMatrix4x2dv(table, save_UniformMatrix4x2dv);
13378 SET_UniformMatrix3x4dv(table, save_UniformMatrix3x4dv);
13379 SET_UniformMatrix4x3dv(table, save_UniformMatrix4x3dv);
13380
13381 /* These are: */
13382 SET_BeginTransformFeedback(table, save_BeginTransformFeedback);
13383 SET_EndTransformFeedback(table, save_EndTransformFeedback);
13384 SET_BindTransformFeedback(table, save_BindTransformFeedback);
13385 SET_PauseTransformFeedback(table, save_PauseTransformFeedback);
13386 SET_ResumeTransformFeedback(table, save_ResumeTransformFeedback);
13387 SET_DrawTransformFeedback(table, save_DrawTransformFeedback);
13388 SET_DrawTransformFeedbackStream(table, save_DrawTransformFeedbackStream);
13389 SET_DrawTransformFeedbackInstanced(table,
13390 save_DrawTransformFeedbackInstanced);
13391 SET_DrawTransformFeedbackStreamInstanced(table,
13392 save_DrawTransformFeedbackStreamInstanced);
13393 SET_BeginQueryIndexed(table, save_BeginQueryIndexed);
13394 SET_EndQueryIndexed(table, save_EndQueryIndexed);
13395
13396 /* GL_ARB_instanced_arrays */
13397 SET_VertexAttribDivisor(table, save_VertexAttribDivisor);
13398
13399 /* GL_NV_texture_barrier */
13400 SET_TextureBarrierNV(table, save_TextureBarrierNV);
13401
13402 SET_BindSampler(table, save_BindSampler);
13403 SET_SamplerParameteri(table, save_SamplerParameteri);
13404 SET_SamplerParameterf(table, save_SamplerParameterf);
13405 SET_SamplerParameteriv(table, save_SamplerParameteriv);
13406 SET_SamplerParameterfv(table, save_SamplerParameterfv);
13407 SET_SamplerParameterIiv(table, save_SamplerParameterIiv);
13408 SET_SamplerParameterIuiv(table, save_SamplerParameterIuiv);
13409
13410 /* GL_ARB_draw_buffer_blend */
13411 SET_BlendFunciARB(table, save_BlendFunci);
13412 SET_BlendFuncSeparateiARB(table, save_BlendFuncSeparatei);
13413 SET_BlendEquationiARB(table, save_BlendEquationi);
13414 SET_BlendEquationSeparateiARB(table, save_BlendEquationSeparatei);
13415
13416 /* GL_NV_conditional_render */
13417 SET_BeginConditionalRender(table, save_BeginConditionalRender);
13418 SET_EndConditionalRender(table, save_EndConditionalRender);
13419
13420 /* GL_ARB_sync */
13421 SET_WaitSync(table, save_WaitSync);
13422
13423 /* GL_ARB_uniform_buffer_object */
13424 SET_UniformBlockBinding(table, save_UniformBlockBinding);
13425
13426 /* GL_ARB_shader_subroutines */
13427 SET_UniformSubroutinesuiv(table, save_UniformSubroutinesuiv);
13428
13429 /* GL_ARB_draw_instanced */
13430 SET_DrawArraysInstancedARB(table, save_DrawArraysInstancedARB);
13431 SET_DrawElementsInstancedARB(table, save_DrawElementsInstancedARB);
13432
13433 /* GL_ARB_draw_elements_base_vertex */
13434 SET_DrawElementsInstancedBaseVertex(table, save_DrawElementsInstancedBaseVertexARB);
13435
13436 /* GL_ARB_base_instance */
13437 SET_DrawArraysInstancedBaseInstance(table, save_DrawArraysInstancedBaseInstance);
13438 SET_DrawElementsInstancedBaseInstance(table, save_DrawElementsInstancedBaseInstance);
13439 SET_DrawElementsInstancedBaseVertexBaseInstance(table, save_DrawElementsInstancedBaseVertexBaseInstance);
13440
13441 /* GL_ARB_draw_indirect / GL_ARB_multi_draw_indirect */
13442 SET_DrawArraysIndirect(table, save_DrawArraysIndirect);
13443 SET_DrawElementsIndirect(table, save_DrawElementsIndirect);
13444 SET_MultiDrawArraysIndirect(table, save_MultiDrawArraysIndirect);
13445 SET_MultiDrawElementsIndirect(table, save_MultiDrawElementsIndirect);
13446
13447 /* OpenGL 4.2 / GL_ARB_separate_shader_objects */
13448 SET_UseProgramStages(table, save_UseProgramStages);
13449 SET_ProgramUniform1f(table, save_ProgramUniform1f);
13450 SET_ProgramUniform2f(table, save_ProgramUniform2f);
13451 SET_ProgramUniform3f(table, save_ProgramUniform3f);
13452 SET_ProgramUniform4f(table, save_ProgramUniform4f);
13453 SET_ProgramUniform1fv(table, save_ProgramUniform1fv);
13454 SET_ProgramUniform2fv(table, save_ProgramUniform2fv);
13455 SET_ProgramUniform3fv(table, save_ProgramUniform3fv);
13456 SET_ProgramUniform4fv(table, save_ProgramUniform4fv);
13457 SET_ProgramUniform1d(table, save_ProgramUniform1d);
13458 SET_ProgramUniform2d(table, save_ProgramUniform2d);
13459 SET_ProgramUniform3d(table, save_ProgramUniform3d);
13460 SET_ProgramUniform4d(table, save_ProgramUniform4d);
13461 SET_ProgramUniform1dv(table, save_ProgramUniform1dv);
13462 SET_ProgramUniform2dv(table, save_ProgramUniform2dv);
13463 SET_ProgramUniform3dv(table, save_ProgramUniform3dv);
13464 SET_ProgramUniform4dv(table, save_ProgramUniform4dv);
13465 SET_ProgramUniform1i(table, save_ProgramUniform1i);
13466 SET_ProgramUniform2i(table, save_ProgramUniform2i);
13467 SET_ProgramUniform3i(table, save_ProgramUniform3i);
13468 SET_ProgramUniform4i(table, save_ProgramUniform4i);
13469 SET_ProgramUniform1iv(table, save_ProgramUniform1iv);
13470 SET_ProgramUniform2iv(table, save_ProgramUniform2iv);
13471 SET_ProgramUniform3iv(table, save_ProgramUniform3iv);
13472 SET_ProgramUniform4iv(table, save_ProgramUniform4iv);
13473 SET_ProgramUniform1ui(table, save_ProgramUniform1ui);
13474 SET_ProgramUniform2ui(table, save_ProgramUniform2ui);
13475 SET_ProgramUniform3ui(table, save_ProgramUniform3ui);
13476 SET_ProgramUniform4ui(table, save_ProgramUniform4ui);
13477 SET_ProgramUniform1uiv(table, save_ProgramUniform1uiv);
13478 SET_ProgramUniform2uiv(table, save_ProgramUniform2uiv);
13479 SET_ProgramUniform3uiv(table, save_ProgramUniform3uiv);
13480 SET_ProgramUniform4uiv(table, save_ProgramUniform4uiv);
13481 SET_ProgramUniformMatrix2fv(table, save_ProgramUniformMatrix2fv);
13482 SET_ProgramUniformMatrix3fv(table, save_ProgramUniformMatrix3fv);
13483 SET_ProgramUniformMatrix4fv(table, save_ProgramUniformMatrix4fv);
13484 SET_ProgramUniformMatrix2x3fv(table, save_ProgramUniformMatrix2x3fv);
13485 SET_ProgramUniformMatrix3x2fv(table, save_ProgramUniformMatrix3x2fv);
13486 SET_ProgramUniformMatrix2x4fv(table, save_ProgramUniformMatrix2x4fv);
13487 SET_ProgramUniformMatrix4x2fv(table, save_ProgramUniformMatrix4x2fv);
13488 SET_ProgramUniformMatrix3x4fv(table, save_ProgramUniformMatrix3x4fv);
13489 SET_ProgramUniformMatrix4x3fv(table, save_ProgramUniformMatrix4x3fv);
13490 SET_ProgramUniformMatrix2dv(table, save_ProgramUniformMatrix2dv);
13491 SET_ProgramUniformMatrix3dv(table, save_ProgramUniformMatrix3dv);
13492 SET_ProgramUniformMatrix4dv(table, save_ProgramUniformMatrix4dv);
13493 SET_ProgramUniformMatrix2x3dv(table, save_ProgramUniformMatrix2x3dv);
13494 SET_ProgramUniformMatrix3x2dv(table, save_ProgramUniformMatrix3x2dv);
13495 SET_ProgramUniformMatrix2x4dv(table, save_ProgramUniformMatrix2x4dv);
13496 SET_ProgramUniformMatrix4x2dv(table, save_ProgramUniformMatrix4x2dv);
13497 SET_ProgramUniformMatrix3x4dv(table, save_ProgramUniformMatrix3x4dv);
13498 SET_ProgramUniformMatrix4x3dv(table, save_ProgramUniformMatrix4x3dv);
13499
13500 /* GL_{ARB,EXT}_polygon_offset_clamp */
13501 SET_PolygonOffsetClampEXT(table, save_PolygonOffsetClampEXT);
13502
13503 /* GL_EXT_window_rectangles */
13504 SET_WindowRectanglesEXT(table, save_WindowRectanglesEXT);
13505
13506 /* GL_NV_conservative_raster */
13507 SET_SubpixelPrecisionBiasNV(table, save_SubpixelPrecisionBiasNV);
13508
13509 /* GL_NV_conservative_raster_dilate */
13510 SET_ConservativeRasterParameterfNV(table, save_ConservativeRasterParameterfNV);
13511
13512 /* GL_NV_conservative_raster_pre_snap_triangles */
13513 SET_ConservativeRasterParameteriNV(table, save_ConservativeRasterParameteriNV);
13514
13515 /* GL_EXT_direct_state_access */
13516 SET_MatrixLoadfEXT(table, save_MatrixLoadfEXT);
13517 SET_MatrixLoaddEXT(table, save_MatrixLoaddEXT);
13518 SET_MatrixMultfEXT(table, save_MatrixMultfEXT);
13519 SET_MatrixMultdEXT(table, save_MatrixMultdEXT);
13520 SET_MatrixRotatefEXT(table, save_MatrixRotatefEXT);
13521 SET_MatrixRotatedEXT(table, save_MatrixRotatedEXT);
13522 SET_MatrixScalefEXT(table, save_MatrixScalefEXT);
13523 SET_MatrixScaledEXT(table, save_MatrixScaledEXT);
13524 SET_MatrixTranslatefEXT(table, save_MatrixTranslatefEXT);
13525 SET_MatrixTranslatedEXT(table, save_MatrixTranslatedEXT);
13526 SET_MatrixLoadIdentityEXT(table, save_MatrixLoadIdentityEXT);
13527 SET_MatrixOrthoEXT(table, save_MatrixOrthoEXT);
13528 SET_MatrixFrustumEXT(table, save_MatrixFrustumEXT);
13529 SET_MatrixPushEXT(table, save_MatrixPushEXT);
13530 SET_MatrixPopEXT(table, save_MatrixPopEXT);
13531 SET_MatrixLoadTransposefEXT(table, save_MatrixLoadTransposefEXT);
13532 SET_MatrixLoadTransposedEXT(table, save_MatrixLoadTransposedEXT);
13533 SET_MatrixMultTransposefEXT(table, save_MatrixMultTransposefEXT);
13534 SET_MatrixMultTransposedEXT(table, save_MatrixMultTransposedEXT);
13535 SET_TextureParameteriEXT(table, save_TextureParameteriEXT);
13536 SET_TextureParameterivEXT(table, save_TextureParameterivEXT);
13537 SET_TextureParameterfEXT(table, save_TextureParameterfEXT);
13538 SET_TextureParameterfvEXT(table, save_TextureParameterfvEXT);
13539 SET_TextureImage1DEXT(table, save_TextureImage1DEXT);
13540 SET_TextureImage2DEXT(table, save_TextureImage2DEXT);
13541 SET_TextureImage3DEXT(table, save_TextureImage3DEXT);
13542 SET_TextureSubImage1DEXT(table, save_TextureSubImage1DEXT);
13543 SET_TextureSubImage2DEXT(table, save_TextureSubImage2DEXT);
13544 SET_TextureSubImage3DEXT(table, save_TextureSubImage3DEXT);
13545 SET_CopyTextureImage1DEXT(table, save_CopyTextureImage1DEXT);
13546 SET_CopyTextureImage2DEXT(table, save_CopyTextureImage2DEXT);
13547 SET_CopyTextureSubImage1DEXT(table, save_CopyTextureSubImage1DEXT);
13548 SET_CopyTextureSubImage2DEXT(table, save_CopyTextureSubImage2DEXT);
13549 SET_CopyTextureSubImage3DEXT(table, save_CopyTextureSubImage3DEXT);
13550 SET_BindMultiTextureEXT(table, save_BindMultiTextureEXT);
13551 SET_MultiTexParameteriEXT(table, save_MultiTexParameteriEXT);
13552 SET_MultiTexParameterivEXT(table, save_MultiTexParameterivEXT);
13553 SET_MultiTexParameterfEXT(table, save_MultiTexParameterfEXT);
13554 SET_MultiTexParameterfvEXT(table, save_MultiTexParameterfvEXT);
13555 SET_MultiTexImage1DEXT(table, save_MultiTexImage1DEXT);
13556 SET_MultiTexImage2DEXT(table, save_MultiTexImage2DEXT);
13557 SET_MultiTexImage3DEXT(table, save_MultiTexImage3DEXT);
13558 SET_MultiTexSubImage1DEXT(table, save_MultiTexSubImage1DEXT);
13559 SET_MultiTexSubImage2DEXT(table, save_MultiTexSubImage2DEXT);
13560 SET_MultiTexSubImage3DEXT(table, save_MultiTexSubImage3DEXT);
13561 SET_CopyMultiTexImage1DEXT(table, save_CopyMultiTexImage1DEXT);
13562 SET_CopyMultiTexImage2DEXT(table, save_CopyMultiTexImage2DEXT);
13563 SET_CopyMultiTexSubImage1DEXT(table, save_CopyMultiTexSubImage1DEXT);
13564 SET_CopyMultiTexSubImage2DEXT(table, save_CopyMultiTexSubImage2DEXT);
13565 SET_CopyMultiTexSubImage3DEXT(table, save_CopyMultiTexSubImage3DEXT);
13566 SET_MultiTexEnvfEXT(table, save_MultiTexEnvfEXT);
13567 SET_MultiTexEnvfvEXT(table, save_MultiTexEnvfvEXT);
13568 SET_MultiTexEnviEXT(table, save_MultiTexEnviEXT);
13569 SET_MultiTexEnvivEXT(table, save_MultiTexEnvivEXT);
13570 SET_CompressedTextureImage1DEXT(table, save_CompressedTextureImage1DEXT);
13571 SET_CompressedTextureImage2DEXT(table, save_CompressedTextureImage2DEXT);
13572 SET_CompressedTextureImage3DEXT(table, save_CompressedTextureImage3DEXT);
13573 SET_CompressedTextureSubImage1DEXT(table, save_CompressedTextureSubImage1DEXT);
13574 SET_CompressedTextureSubImage2DEXT(table, save_CompressedTextureSubImage2DEXT);
13575 SET_CompressedTextureSubImage3DEXT(table, save_CompressedTextureSubImage3DEXT);
13576 }
13577
13578
13579
13580 static const char *
13581 enum_string(GLenum k)
13582 {
13583 return _mesa_enum_to_string(k);
13584 }
13585
13586
13587 /**
13588 * Print the commands in a display list. For debugging only.
13589 * TODO: many commands aren't handled yet.
13590 * \param fname filename to write display list to. If null, use stdout.
13591 */
13592 static void GLAPIENTRY
13593 print_list(struct gl_context *ctx, GLuint list, const char *fname)
13594 {
13595 struct gl_display_list *dlist;
13596 Node *n;
13597 GLboolean done;
13598 FILE *f = stdout;
13599
13600 if (fname) {
13601 f = fopen(fname, "w");
13602 if (!f)
13603 return;
13604 }
13605
13606 if (!islist(ctx, list)) {
13607 fprintf(f, "%u is not a display list ID\n", list);
13608 goto out;
13609 }
13610
13611 dlist = _mesa_lookup_list(ctx, list);
13612 if (!dlist) {
13613 goto out;
13614 }
13615
13616 n = dlist->Head;
13617
13618 fprintf(f, "START-LIST %u, address %p\n", list, (void *) n);
13619
13620 done = n ? GL_FALSE : GL_TRUE;
13621 while (!done) {
13622 const OpCode opcode = n[0].opcode;
13623
13624 if (is_ext_opcode(opcode)) {
13625 n += ext_opcode_print(ctx, n, f);
13626 }
13627 else {
13628 switch (opcode) {
13629 case OPCODE_ACCUM:
13630 fprintf(f, "Accum %s %g\n", enum_string(n[1].e), n[2].f);
13631 break;
13632 case OPCODE_ACTIVE_TEXTURE:
13633 fprintf(f, "ActiveTexture(%s)\n", enum_string(n[1].e));
13634 break;
13635 case OPCODE_BITMAP:
13636 fprintf(f, "Bitmap %d %d %g %g %g %g %p\n", n[1].i, n[2].i,
13637 n[3].f, n[4].f, n[5].f, n[6].f,
13638 get_pointer(&n[7]));
13639 break;
13640 case OPCODE_BLEND_COLOR:
13641 fprintf(f, "BlendColor %f, %f, %f, %f\n",
13642 n[1].f, n[2].f, n[3].f, n[4].f);
13643 break;
13644 case OPCODE_BLEND_EQUATION:
13645 fprintf(f, "BlendEquation %s\n",
13646 enum_string(n[1].e));
13647 break;
13648 case OPCODE_BLEND_EQUATION_SEPARATE:
13649 fprintf(f, "BlendEquationSeparate %s, %s\n",
13650 enum_string(n[1].e),
13651 enum_string(n[2].e));
13652 break;
13653 case OPCODE_BLEND_FUNC_SEPARATE:
13654 fprintf(f, "BlendFuncSeparate %s, %s, %s, %s\n",
13655 enum_string(n[1].e),
13656 enum_string(n[2].e),
13657 enum_string(n[3].e),
13658 enum_string(n[4].e));
13659 break;
13660 case OPCODE_BLEND_EQUATION_I:
13661 fprintf(f, "BlendEquationi %u, %s\n",
13662 n[1].ui, enum_string(n[2].e));
13663 break;
13664 case OPCODE_BLEND_EQUATION_SEPARATE_I:
13665 fprintf(f, "BlendEquationSeparatei %u, %s, %s\n",
13666 n[1].ui, enum_string(n[2].e), enum_string(n[3].e));
13667 break;
13668 case OPCODE_BLEND_FUNC_I:
13669 fprintf(f, "BlendFunci %u, %s, %s\n",
13670 n[1].ui, enum_string(n[2].e), enum_string(n[3].e));
13671 break;
13672 case OPCODE_BLEND_FUNC_SEPARATE_I:
13673 fprintf(f, "BlendFuncSeparatei %u, %s, %s, %s, %s\n",
13674 n[1].ui,
13675 enum_string(n[2].e),
13676 enum_string(n[3].e),
13677 enum_string(n[4].e),
13678 enum_string(n[5].e));
13679 break;
13680 case OPCODE_CALL_LIST:
13681 fprintf(f, "CallList %d\n", (int) n[1].ui);
13682 break;
13683 case OPCODE_CALL_LISTS:
13684 fprintf(f, "CallLists %d, %s\n", n[1].i, enum_string(n[1].e));
13685 break;
13686 case OPCODE_DISABLE:
13687 fprintf(f, "Disable %s\n", enum_string(n[1].e));
13688 break;
13689 case OPCODE_ENABLE:
13690 fprintf(f, "Enable %s\n", enum_string(n[1].e));
13691 break;
13692 case OPCODE_FRUSTUM:
13693 fprintf(f, "Frustum %g %g %g %g %g %g\n",
13694 n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f);
13695 break;
13696 case OPCODE_LINE_STIPPLE:
13697 fprintf(f, "LineStipple %d %x\n", n[1].i, (int) n[2].us);
13698 break;
13699 case OPCODE_LINE_WIDTH:
13700 fprintf(f, "LineWidth %f\n", n[1].f);
13701 break;
13702 case OPCODE_LOAD_IDENTITY:
13703 fprintf(f, "LoadIdentity\n");
13704 break;
13705 case OPCODE_LOAD_MATRIX:
13706 fprintf(f, "LoadMatrix\n");
13707 fprintf(f, " %8f %8f %8f %8f\n",
13708 n[1].f, n[5].f, n[9].f, n[13].f);
13709 fprintf(f, " %8f %8f %8f %8f\n",
13710 n[2].f, n[6].f, n[10].f, n[14].f);
13711 fprintf(f, " %8f %8f %8f %8f\n",
13712 n[3].f, n[7].f, n[11].f, n[15].f);
13713 fprintf(f, " %8f %8f %8f %8f\n",
13714 n[4].f, n[8].f, n[12].f, n[16].f);
13715 break;
13716 case OPCODE_MULT_MATRIX:
13717 fprintf(f, "MultMatrix (or Rotate)\n");
13718 fprintf(f, " %8f %8f %8f %8f\n",
13719 n[1].f, n[5].f, n[9].f, n[13].f);
13720 fprintf(f, " %8f %8f %8f %8f\n",
13721 n[2].f, n[6].f, n[10].f, n[14].f);
13722 fprintf(f, " %8f %8f %8f %8f\n",
13723 n[3].f, n[7].f, n[11].f, n[15].f);
13724 fprintf(f, " %8f %8f %8f %8f\n",
13725 n[4].f, n[8].f, n[12].f, n[16].f);
13726 break;
13727 case OPCODE_ORTHO:
13728 fprintf(f, "Ortho %g %g %g %g %g %g\n",
13729 n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f);
13730 break;
13731 case OPCODE_POINT_SIZE:
13732 fprintf(f, "PointSize %f\n", n[1].f);
13733 break;
13734 case OPCODE_POP_ATTRIB:
13735 fprintf(f, "PopAttrib\n");
13736 break;
13737 case OPCODE_POP_MATRIX:
13738 fprintf(f, "PopMatrix\n");
13739 break;
13740 case OPCODE_POP_NAME:
13741 fprintf(f, "PopName\n");
13742 break;
13743 case OPCODE_PUSH_ATTRIB:
13744 fprintf(f, "PushAttrib %x\n", n[1].bf);
13745 break;
13746 case OPCODE_PUSH_MATRIX:
13747 fprintf(f, "PushMatrix\n");
13748 break;
13749 case OPCODE_PUSH_NAME:
13750 fprintf(f, "PushName %d\n", (int) n[1].ui);
13751 break;
13752 case OPCODE_RASTER_POS:
13753 fprintf(f, "RasterPos %g %g %g %g\n",
13754 n[1].f, n[2].f, n[3].f, n[4].f);
13755 break;
13756 case OPCODE_ROTATE:
13757 fprintf(f, "Rotate %g %g %g %g\n",
13758 n[1].f, n[2].f, n[3].f, n[4].f);
13759 break;
13760 case OPCODE_SCALE:
13761 fprintf(f, "Scale %g %g %g\n", n[1].f, n[2].f, n[3].f);
13762 break;
13763 case OPCODE_TRANSLATE:
13764 fprintf(f, "Translate %g %g %g\n", n[1].f, n[2].f, n[3].f);
13765 break;
13766 case OPCODE_BIND_TEXTURE:
13767 fprintf(f, "BindTexture %s %d\n",
13768 _mesa_enum_to_string(n[1].ui), n[2].ui);
13769 break;
13770 case OPCODE_SHADE_MODEL:
13771 fprintf(f, "ShadeModel %s\n", _mesa_enum_to_string(n[1].ui));
13772 break;
13773 case OPCODE_MAP1:
13774 fprintf(f, "Map1 %s %.3f %.3f %d %d\n",
13775 _mesa_enum_to_string(n[1].ui),
13776 n[2].f, n[3].f, n[4].i, n[5].i);
13777 break;
13778 case OPCODE_MAP2:
13779 fprintf(f, "Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
13780 _mesa_enum_to_string(n[1].ui),
13781 n[2].f, n[3].f, n[4].f, n[5].f,
13782 n[6].i, n[7].i, n[8].i, n[9].i);
13783 break;
13784 case OPCODE_MAPGRID1:
13785 fprintf(f, "MapGrid1 %d %.3f %.3f\n", n[1].i, n[2].f, n[3].f);
13786 break;
13787 case OPCODE_MAPGRID2:
13788 fprintf(f, "MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
13789 n[1].i, n[2].f, n[3].f, n[4].i, n[5].f, n[6].f);
13790 break;
13791 case OPCODE_EVALMESH1:
13792 fprintf(f, "EvalMesh1 %d %d\n", n[1].i, n[2].i);
13793 break;
13794 case OPCODE_EVALMESH2:
13795 fprintf(f, "EvalMesh2 %d %d %d %d\n",
13796 n[1].i, n[2].i, n[3].i, n[4].i);
13797 break;
13798
13799 case OPCODE_ATTR_1F_NV:
13800 fprintf(f, "ATTR_1F_NV attr %d: %f\n", n[1].i, n[2].f);
13801 break;
13802 case OPCODE_ATTR_2F_NV:
13803 fprintf(f, "ATTR_2F_NV attr %d: %f %f\n",
13804 n[1].i, n[2].f, n[3].f);
13805 break;
13806 case OPCODE_ATTR_3F_NV:
13807 fprintf(f, "ATTR_3F_NV attr %d: %f %f %f\n",
13808 n[1].i, n[2].f, n[3].f, n[4].f);
13809 break;
13810 case OPCODE_ATTR_4F_NV:
13811 fprintf(f, "ATTR_4F_NV attr %d: %f %f %f %f\n",
13812 n[1].i, n[2].f, n[3].f, n[4].f, n[5].f);
13813 break;
13814 case OPCODE_ATTR_1F_ARB:
13815 fprintf(f, "ATTR_1F_ARB attr %d: %f\n", n[1].i, n[2].f);
13816 break;
13817 case OPCODE_ATTR_2F_ARB:
13818 fprintf(f, "ATTR_2F_ARB attr %d: %f %f\n",
13819 n[1].i, n[2].f, n[3].f);
13820 break;
13821 case OPCODE_ATTR_3F_ARB:
13822 fprintf(f, "ATTR_3F_ARB attr %d: %f %f %f\n",
13823 n[1].i, n[2].f, n[3].f, n[4].f);
13824 break;
13825 case OPCODE_ATTR_4F_ARB:
13826 fprintf(f, "ATTR_4F_ARB attr %d: %f %f %f %f\n",
13827 n[1].i, n[2].f, n[3].f, n[4].f, n[5].f);
13828 break;
13829
13830 case OPCODE_MATERIAL:
13831 fprintf(f, "MATERIAL %x %x: %f %f %f %f\n",
13832 n[1].i, n[2].i, n[3].f, n[4].f, n[5].f, n[6].f);
13833 break;
13834 case OPCODE_BEGIN:
13835 fprintf(f, "BEGIN %x\n", n[1].i);
13836 break;
13837 case OPCODE_END:
13838 fprintf(f, "END\n");
13839 break;
13840 case OPCODE_RECTF:
13841 fprintf(f, "RECTF %f %f %f %f\n", n[1].f, n[2].f, n[3].f,
13842 n[4].f);
13843 break;
13844 case OPCODE_EVAL_C1:
13845 fprintf(f, "EVAL_C1 %f\n", n[1].f);
13846 break;
13847 case OPCODE_EVAL_C2:
13848 fprintf(f, "EVAL_C2 %f %f\n", n[1].f, n[2].f);
13849 break;
13850 case OPCODE_EVAL_P1:
13851 fprintf(f, "EVAL_P1 %d\n", n[1].i);
13852 break;
13853 case OPCODE_EVAL_P2:
13854 fprintf(f, "EVAL_P2 %d %d\n", n[1].i, n[2].i);
13855 break;
13856
13857 case OPCODE_PROVOKING_VERTEX:
13858 fprintf(f, "ProvokingVertex %s\n",
13859 _mesa_enum_to_string(n[1].ui));
13860 break;
13861
13862 /*
13863 * meta opcodes/commands
13864 */
13865 case OPCODE_ERROR:
13866 fprintf(f, "Error: %s %s\n", enum_string(n[1].e),
13867 (const char *) get_pointer(&n[2]));
13868 break;
13869 case OPCODE_CONTINUE:
13870 fprintf(f, "DISPLAY-LIST-CONTINUE\n");
13871 n = (Node *) get_pointer(&n[1]);
13872 break;
13873 case OPCODE_NOP:
13874 fprintf(f, "NOP\n");
13875 break;
13876 case OPCODE_END_OF_LIST:
13877 fprintf(f, "END-LIST %u\n", list);
13878 done = GL_TRUE;
13879 break;
13880 default:
13881 if (opcode < 0 || opcode > OPCODE_END_OF_LIST) {
13882 printf
13883 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
13884 opcode, (void *) n);
13885 goto out;
13886 }
13887 else {
13888 fprintf(f, "command %d, %u operands\n", opcode,
13889 InstSize[opcode]);
13890 }
13891 }
13892 /* increment n to point to next compiled command */
13893 if (opcode != OPCODE_CONTINUE) {
13894 assert(InstSize[opcode] > 0);
13895 n += InstSize[opcode];
13896 }
13897 }
13898 }
13899
13900 out:
13901 fflush(f);
13902 if (fname)
13903 fclose(f);
13904 }
13905
13906
13907
13908 /**
13909 * Clients may call this function to help debug display list problems.
13910 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
13911 * changed, or break in the future without notice.
13912 */
13913 void
13914 mesa_print_display_list(GLuint list)
13915 {
13916 GET_CURRENT_CONTEXT(ctx);
13917 print_list(ctx, list, NULL);
13918 }
13919
13920
13921 /**********************************************************************/
13922 /***** Initialization *****/
13923 /**********************************************************************/
13924
13925 static void
13926 save_vtxfmt_init(GLvertexformat * vfmt)
13927 {
13928 vfmt->ArrayElement = _ae_ArrayElement;
13929
13930 vfmt->Begin = save_Begin;
13931
13932 vfmt->CallList = save_CallList;
13933 vfmt->CallLists = save_CallLists;
13934
13935 vfmt->Color3f = save_Color3f;
13936 vfmt->Color3fv = save_Color3fv;
13937 vfmt->Color4f = save_Color4f;
13938 vfmt->Color4fv = save_Color4fv;
13939 vfmt->EdgeFlag = save_EdgeFlag;
13940 vfmt->End = save_End;
13941
13942 vfmt->EvalCoord1f = save_EvalCoord1f;
13943 vfmt->EvalCoord1fv = save_EvalCoord1fv;
13944 vfmt->EvalCoord2f = save_EvalCoord2f;
13945 vfmt->EvalCoord2fv = save_EvalCoord2fv;
13946 vfmt->EvalPoint1 = save_EvalPoint1;
13947 vfmt->EvalPoint2 = save_EvalPoint2;
13948
13949 vfmt->FogCoordfEXT = save_FogCoordfEXT;
13950 vfmt->FogCoordfvEXT = save_FogCoordfvEXT;
13951 vfmt->Indexf = save_Indexf;
13952 vfmt->Indexfv = save_Indexfv;
13953 vfmt->Materialfv = save_Materialfv;
13954 vfmt->MultiTexCoord1fARB = save_MultiTexCoord1f;
13955 vfmt->MultiTexCoord1fvARB = save_MultiTexCoord1fv;
13956 vfmt->MultiTexCoord2fARB = save_MultiTexCoord2f;
13957 vfmt->MultiTexCoord2fvARB = save_MultiTexCoord2fv;
13958 vfmt->MultiTexCoord3fARB = save_MultiTexCoord3f;
13959 vfmt->MultiTexCoord3fvARB = save_MultiTexCoord3fv;
13960 vfmt->MultiTexCoord4fARB = save_MultiTexCoord4f;
13961 vfmt->MultiTexCoord4fvARB = save_MultiTexCoord4fv;
13962 vfmt->Normal3f = save_Normal3f;
13963 vfmt->Normal3fv = save_Normal3fv;
13964 vfmt->SecondaryColor3fEXT = save_SecondaryColor3fEXT;
13965 vfmt->SecondaryColor3fvEXT = save_SecondaryColor3fvEXT;
13966 vfmt->TexCoord1f = save_TexCoord1f;
13967 vfmt->TexCoord1fv = save_TexCoord1fv;
13968 vfmt->TexCoord2f = save_TexCoord2f;
13969 vfmt->TexCoord2fv = save_TexCoord2fv;
13970 vfmt->TexCoord3f = save_TexCoord3f;
13971 vfmt->TexCoord3fv = save_TexCoord3fv;
13972 vfmt->TexCoord4f = save_TexCoord4f;
13973 vfmt->TexCoord4fv = save_TexCoord4fv;
13974 vfmt->Vertex2f = save_Vertex2f;
13975 vfmt->Vertex2fv = save_Vertex2fv;
13976 vfmt->Vertex3f = save_Vertex3f;
13977 vfmt->Vertex3fv = save_Vertex3fv;
13978 vfmt->Vertex4f = save_Vertex4f;
13979 vfmt->Vertex4fv = save_Vertex4fv;
13980 vfmt->VertexAttrib1fARB = save_VertexAttrib1fARB;
13981 vfmt->VertexAttrib1fvARB = save_VertexAttrib1fvARB;
13982 vfmt->VertexAttrib2fARB = save_VertexAttrib2fARB;
13983 vfmt->VertexAttrib2fvARB = save_VertexAttrib2fvARB;
13984 vfmt->VertexAttrib3fARB = save_VertexAttrib3fARB;
13985 vfmt->VertexAttrib3fvARB = save_VertexAttrib3fvARB;
13986 vfmt->VertexAttrib4fARB = save_VertexAttrib4fARB;
13987 vfmt->VertexAttrib4fvARB = save_VertexAttrib4fvARB;
13988 vfmt->VertexAttribL1d = save_VertexAttribL1d;
13989 vfmt->VertexAttribL1dv = save_VertexAttribL1dv;
13990 vfmt->VertexAttribL2d = save_VertexAttribL2d;
13991 vfmt->VertexAttribL2dv = save_VertexAttribL2dv;
13992 vfmt->VertexAttribL3d = save_VertexAttribL3d;
13993 vfmt->VertexAttribL3dv = save_VertexAttribL3dv;
13994 vfmt->VertexAttribL4d = save_VertexAttribL4d;
13995 vfmt->VertexAttribL4dv = save_VertexAttribL4dv;
13996
13997 vfmt->PrimitiveRestartNV = save_PrimitiveRestartNV;
13998 }
13999
14000
14001 void
14002 _mesa_install_dlist_vtxfmt(struct _glapi_table *disp,
14003 const GLvertexformat *vfmt)
14004 {
14005 SET_CallList(disp, vfmt->CallList);
14006 SET_CallLists(disp, vfmt->CallLists);
14007 }
14008
14009
14010 /**
14011 * Initialize display list state for given context.
14012 */
14013 void
14014 _mesa_init_display_list(struct gl_context *ctx)
14015 {
14016 static GLboolean tableInitialized = GL_FALSE;
14017
14018 /* zero-out the instruction size table, just once */
14019 if (!tableInitialized) {
14020 memset(InstSize, 0, sizeof(InstSize));
14021 tableInitialized = GL_TRUE;
14022 }
14023
14024 /* extension info */
14025 ctx->ListExt = CALLOC_STRUCT(gl_list_extensions);
14026
14027 /* Display list */
14028 ctx->ListState.CallDepth = 0;
14029 ctx->ExecuteFlag = GL_TRUE;
14030 ctx->CompileFlag = GL_FALSE;
14031 ctx->ListState.CurrentBlock = NULL;
14032 ctx->ListState.CurrentPos = 0;
14033
14034 /* Display List group */
14035 ctx->List.ListBase = 0;
14036
14037 save_vtxfmt_init(&ctx->ListState.ListVtxfmt);
14038
14039 InstSize[OPCODE_NOP] = 1;
14040 }
14041
14042
14043 void
14044 _mesa_free_display_list_data(struct gl_context *ctx)
14045 {
14046 free(ctx->ListExt);
14047 ctx->ListExt = NULL;
14048 }