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