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