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