mesa: add EXT_dsa glMultiTexSubImage1D/2D/3DEXT
[mesa.git] / src / mesa / main / dlist.c
1 /*
2 * Mesa 3-D graphics library
3 *
4 * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
5 * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 * OTHER DEALINGS IN THE SOFTWARE.
24 */
25
26
27 /**
28 * \file dlist.c
29 * Display lists management functions.
30 */
31
32 #include "c99_math.h"
33 #include "glheader.h"
34 #include "imports.h"
35 #include "api_arrayelt.h"
36 #include "api_exec.h"
37 #include "api_loopback.h"
38 #include "draw_validate.h"
39 #include "atifragshader.h"
40 #include "config.h"
41 #include "bufferobj.h"
42 #include "arrayobj.h"
43 #include "context.h"
44 #include "dlist.h"
45 #include "enums.h"
46 #include "eval.h"
47 #include "fbobject.h"
48 #include "framebuffer.h"
49 #include "glapi/glapi.h"
50 #include "glformats.h"
51 #include "hash.h"
52 #include "image.h"
53 #include "light.h"
54 #include "macros.h"
55 #include "pack.h"
56 #include "pbo.h"
57 #include "queryobj.h"
58 #include "samplerobj.h"
59 #include "shaderapi.h"
60 #include "syncobj.h"
61 #include "teximage.h"
62 #include "texstorage.h"
63 #include "mtypes.h"
64 #include "varray.h"
65 #include "arbprogram.h"
66 #include "transformfeedback.h"
67
68 #include "math/m_matrix.h"
69
70 #include "main/dispatch.h"
71
72 #include "vbo/vbo.h"
73
74
75 #define USE_BITMAP_ATLAS 1
76
77
78
79 /**
80 * Other parts of Mesa (such as the VBO module) can plug into the display
81 * list system. This structure describes new display list instructions.
82 */
83 struct gl_list_instruction
84 {
85 GLuint Size;
86 void (*Execute)( struct gl_context *ctx, void *data );
87 void (*Destroy)( struct gl_context *ctx, void *data );
88 void (*Print)( struct gl_context *ctx, void *data, FILE *f );
89 };
90
91
92 #define MAX_DLIST_EXT_OPCODES 16
93
94 /**
95 * Used by device drivers to hook new commands into display lists.
96 */
97 struct gl_list_extensions
98 {
99 struct gl_list_instruction Opcode[MAX_DLIST_EXT_OPCODES];
100 GLuint NumOpcodes;
101 };
102
103
104
105 /**
106 * Flush vertices.
107 *
108 * \param ctx GL context.
109 *
110 * Checks if dd_function_table::SaveNeedFlush is marked to flush
111 * stored (save) vertices, and calls vbo_save_SaveFlushVertices if so.
112 */
113 #define SAVE_FLUSH_VERTICES(ctx) \
114 do { \
115 if (ctx->Driver.SaveNeedFlush) \
116 vbo_save_SaveFlushVertices(ctx); \
117 } while (0)
118
119
120 /**
121 * Macro to assert that the API call was made outside the
122 * glBegin()/glEnd() pair, with return value.
123 *
124 * \param ctx GL context.
125 * \param retval value to return value in case the assertion fails.
126 */
127 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval) \
128 do { \
129 if (ctx->Driver.CurrentSavePrimitive <= PRIM_MAX) { \
130 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glBegin/End" ); \
131 return retval; \
132 } \
133 } while (0)
134
135 /**
136 * Macro to assert that the API call was made outside the
137 * glBegin()/glEnd() pair.
138 *
139 * \param ctx GL context.
140 */
141 #define ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx) \
142 do { \
143 if (ctx->Driver.CurrentSavePrimitive <= PRIM_MAX) { \
144 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glBegin/End" ); \
145 return; \
146 } \
147 } while (0)
148
149 /**
150 * Macro to assert that the API call was made outside the
151 * glBegin()/glEnd() pair and flush the vertices.
152 *
153 * \param ctx GL context.
154 */
155 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx) \
156 do { \
157 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx); \
158 SAVE_FLUSH_VERTICES(ctx); \
159 } while (0)
160
161 /**
162 * Macro to assert that the API call was made outside the
163 * glBegin()/glEnd() pair and flush the vertices, with return value.
164 *
165 * \param ctx GL context.
166 * \param retval value to return value in case the assertion fails.
167 */
168 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval) \
169 do { \
170 ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval); \
171 SAVE_FLUSH_VERTICES(ctx); \
172 } while (0)
173
174
175 /**
176 * Display list opcodes.
177 *
178 * The fact that these identifiers are assigned consecutive
179 * integer values starting at 0 is very important, see InstSize array usage)
180 */
181 typedef enum
182 {
183 OPCODE_INVALID = -1, /* Force signed enum */
184 OPCODE_ACCUM,
185 OPCODE_ALPHA_FUNC,
186 OPCODE_BIND_TEXTURE,
187 OPCODE_BITMAP,
188 OPCODE_BLEND_COLOR,
189 OPCODE_BLEND_EQUATION,
190 OPCODE_BLEND_EQUATION_SEPARATE,
191 OPCODE_BLEND_FUNC_SEPARATE,
192
193 OPCODE_BLEND_EQUATION_I,
194 OPCODE_BLEND_EQUATION_SEPARATE_I,
195 OPCODE_BLEND_FUNC_I,
196 OPCODE_BLEND_FUNC_SEPARATE_I,
197
198 OPCODE_CALL_LIST,
199 OPCODE_CALL_LISTS,
200 OPCODE_CLEAR,
201 OPCODE_CLEAR_ACCUM,
202 OPCODE_CLEAR_COLOR,
203 OPCODE_CLEAR_DEPTH,
204 OPCODE_CLEAR_INDEX,
205 OPCODE_CLEAR_STENCIL,
206 OPCODE_CLEAR_BUFFER_IV,
207 OPCODE_CLEAR_BUFFER_UIV,
208 OPCODE_CLEAR_BUFFER_FV,
209 OPCODE_CLEAR_BUFFER_FI,
210 OPCODE_CLIP_PLANE,
211 OPCODE_COLOR_MASK,
212 OPCODE_COLOR_MASK_INDEXED,
213 OPCODE_COLOR_MATERIAL,
214 OPCODE_COPY_PIXELS,
215 OPCODE_COPY_TEX_IMAGE1D,
216 OPCODE_COPY_TEX_IMAGE2D,
217 OPCODE_COPY_TEX_SUB_IMAGE1D,
218 OPCODE_COPY_TEX_SUB_IMAGE2D,
219 OPCODE_COPY_TEX_SUB_IMAGE3D,
220 OPCODE_CULL_FACE,
221 OPCODE_DEPTH_FUNC,
222 OPCODE_DEPTH_MASK,
223 OPCODE_DEPTH_RANGE,
224 OPCODE_DISABLE,
225 OPCODE_DISABLE_INDEXED,
226 OPCODE_DRAW_BUFFER,
227 OPCODE_DRAW_PIXELS,
228 OPCODE_ENABLE,
229 OPCODE_ENABLE_INDEXED,
230 OPCODE_EVALMESH1,
231 OPCODE_EVALMESH2,
232 OPCODE_FOG,
233 OPCODE_FRONT_FACE,
234 OPCODE_FRUSTUM,
235 OPCODE_HINT,
236 OPCODE_INDEX_MASK,
237 OPCODE_INIT_NAMES,
238 OPCODE_LIGHT,
239 OPCODE_LIGHT_MODEL,
240 OPCODE_LINE_STIPPLE,
241 OPCODE_LINE_WIDTH,
242 OPCODE_LIST_BASE,
243 OPCODE_LOAD_IDENTITY,
244 OPCODE_LOAD_MATRIX,
245 OPCODE_LOAD_NAME,
246 OPCODE_LOGIC_OP,
247 OPCODE_MAP1,
248 OPCODE_MAP2,
249 OPCODE_MAPGRID1,
250 OPCODE_MAPGRID2,
251 OPCODE_MATRIX_MODE,
252 OPCODE_MULT_MATRIX,
253 OPCODE_ORTHO,
254 OPCODE_PASSTHROUGH,
255 OPCODE_PIXEL_MAP,
256 OPCODE_PIXEL_TRANSFER,
257 OPCODE_PIXEL_ZOOM,
258 OPCODE_POINT_SIZE,
259 OPCODE_POINT_PARAMETERS,
260 OPCODE_POLYGON_MODE,
261 OPCODE_POLYGON_STIPPLE,
262 OPCODE_POLYGON_OFFSET,
263 OPCODE_POP_ATTRIB,
264 OPCODE_POP_MATRIX,
265 OPCODE_POP_NAME,
266 OPCODE_PRIORITIZE_TEXTURE,
267 OPCODE_PUSH_ATTRIB,
268 OPCODE_PUSH_MATRIX,
269 OPCODE_PUSH_NAME,
270 OPCODE_RASTER_POS,
271 OPCODE_READ_BUFFER,
272 OPCODE_ROTATE,
273 OPCODE_SCALE,
274 OPCODE_SCISSOR,
275 OPCODE_SELECT_TEXTURE_SGIS,
276 OPCODE_SELECT_TEXTURE_COORD_SET,
277 OPCODE_SHADE_MODEL,
278 OPCODE_STENCIL_FUNC,
279 OPCODE_STENCIL_MASK,
280 OPCODE_STENCIL_OP,
281 OPCODE_TEXENV,
282 OPCODE_TEXGEN,
283 OPCODE_TEXPARAMETER,
284 OPCODE_TEX_IMAGE1D,
285 OPCODE_TEX_IMAGE2D,
286 OPCODE_TEX_IMAGE3D,
287 OPCODE_TEX_SUB_IMAGE1D,
288 OPCODE_TEX_SUB_IMAGE2D,
289 OPCODE_TEX_SUB_IMAGE3D,
290 OPCODE_TRANSLATE,
291 OPCODE_VIEWPORT,
292 OPCODE_WINDOW_POS,
293 /* ARB_viewport_array */
294 OPCODE_VIEWPORT_ARRAY_V,
295 OPCODE_VIEWPORT_INDEXED_F,
296 OPCODE_VIEWPORT_INDEXED_FV,
297 OPCODE_SCISSOR_ARRAY_V,
298 OPCODE_SCISSOR_INDEXED,
299 OPCODE_SCISSOR_INDEXED_V,
300 OPCODE_DEPTH_ARRAY_V,
301 OPCODE_DEPTH_INDEXED,
302 /* GL_ARB_multitexture */
303 OPCODE_ACTIVE_TEXTURE,
304 /* GL_ARB_texture_compression */
305 OPCODE_COMPRESSED_TEX_IMAGE_1D,
306 OPCODE_COMPRESSED_TEX_IMAGE_2D,
307 OPCODE_COMPRESSED_TEX_IMAGE_3D,
308 OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D,
309 OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D,
310 OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D,
311 /* GL_ARB_multisample */
312 OPCODE_SAMPLE_COVERAGE,
313 /* GL_ARB_window_pos */
314 OPCODE_WINDOW_POS_ARB,
315 /* GL_ARB_vertex_program */
316 OPCODE_BIND_PROGRAM_ARB,
317 OPCODE_PROGRAM_LOCAL_PARAMETER_ARB,
318 /* GL_EXT_stencil_two_side */
319 OPCODE_ACTIVE_STENCIL_FACE_EXT,
320 /* GL_EXT_depth_bounds_test */
321 OPCODE_DEPTH_BOUNDS_EXT,
322 /* GL_ARB_vertex/fragment_program */
323 OPCODE_PROGRAM_STRING_ARB,
324 OPCODE_PROGRAM_ENV_PARAMETER_ARB,
325 /* GL_ARB_occlusion_query */
326 OPCODE_BEGIN_QUERY_ARB,
327 OPCODE_END_QUERY_ARB,
328 /* GL_ARB_draw_buffers */
329 OPCODE_DRAW_BUFFERS_ARB,
330 /* GL_ATI_fragment_shader */
331 OPCODE_BIND_FRAGMENT_SHADER_ATI,
332 OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI,
333 /* OpenGL 2.0 */
334 OPCODE_STENCIL_FUNC_SEPARATE,
335 OPCODE_STENCIL_OP_SEPARATE,
336 OPCODE_STENCIL_MASK_SEPARATE,
337 /* GL_NV_primitive_restart */
338 OPCODE_PRIMITIVE_RESTART_NV,
339 /* GL_ARB_shader_objects */
340 OPCODE_USE_PROGRAM,
341 OPCODE_UNIFORM_1F,
342 OPCODE_UNIFORM_2F,
343 OPCODE_UNIFORM_3F,
344 OPCODE_UNIFORM_4F,
345 OPCODE_UNIFORM_1FV,
346 OPCODE_UNIFORM_2FV,
347 OPCODE_UNIFORM_3FV,
348 OPCODE_UNIFORM_4FV,
349 OPCODE_UNIFORM_1I,
350 OPCODE_UNIFORM_2I,
351 OPCODE_UNIFORM_3I,
352 OPCODE_UNIFORM_4I,
353 OPCODE_UNIFORM_1IV,
354 OPCODE_UNIFORM_2IV,
355 OPCODE_UNIFORM_3IV,
356 OPCODE_UNIFORM_4IV,
357 OPCODE_UNIFORM_MATRIX22,
358 OPCODE_UNIFORM_MATRIX33,
359 OPCODE_UNIFORM_MATRIX44,
360 OPCODE_UNIFORM_MATRIX23,
361 OPCODE_UNIFORM_MATRIX32,
362 OPCODE_UNIFORM_MATRIX24,
363 OPCODE_UNIFORM_MATRIX42,
364 OPCODE_UNIFORM_MATRIX34,
365 OPCODE_UNIFORM_MATRIX43,
366
367 /* OpenGL 3.0 */
368 OPCODE_UNIFORM_1UI,
369 OPCODE_UNIFORM_2UI,
370 OPCODE_UNIFORM_3UI,
371 OPCODE_UNIFORM_4UI,
372 OPCODE_UNIFORM_1UIV,
373 OPCODE_UNIFORM_2UIV,
374 OPCODE_UNIFORM_3UIV,
375 OPCODE_UNIFORM_4UIV,
376
377 /* GL_ARB_gpu_shader_fp64 */
378 OPCODE_UNIFORM_1D,
379 OPCODE_UNIFORM_2D,
380 OPCODE_UNIFORM_3D,
381 OPCODE_UNIFORM_4D,
382 OPCODE_UNIFORM_1DV,
383 OPCODE_UNIFORM_2DV,
384 OPCODE_UNIFORM_3DV,
385 OPCODE_UNIFORM_4DV,
386 OPCODE_UNIFORM_MATRIX22D,
387 OPCODE_UNIFORM_MATRIX33D,
388 OPCODE_UNIFORM_MATRIX44D,
389 OPCODE_UNIFORM_MATRIX23D,
390 OPCODE_UNIFORM_MATRIX32D,
391 OPCODE_UNIFORM_MATRIX24D,
392 OPCODE_UNIFORM_MATRIX42D,
393 OPCODE_UNIFORM_MATRIX34D,
394 OPCODE_UNIFORM_MATRIX43D,
395
396 /* OpenGL 4.0 / GL_ARB_tessellation_shader */
397 OPCODE_PATCH_PARAMETER_I,
398 OPCODE_PATCH_PARAMETER_FV_INNER,
399 OPCODE_PATCH_PARAMETER_FV_OUTER,
400
401 /* OpenGL 4.2 / GL_ARB_separate_shader_objects */
402 OPCODE_USE_PROGRAM_STAGES,
403 OPCODE_PROGRAM_UNIFORM_1F,
404 OPCODE_PROGRAM_UNIFORM_2F,
405 OPCODE_PROGRAM_UNIFORM_3F,
406 OPCODE_PROGRAM_UNIFORM_4F,
407 OPCODE_PROGRAM_UNIFORM_1FV,
408 OPCODE_PROGRAM_UNIFORM_2FV,
409 OPCODE_PROGRAM_UNIFORM_3FV,
410 OPCODE_PROGRAM_UNIFORM_4FV,
411 OPCODE_PROGRAM_UNIFORM_1D,
412 OPCODE_PROGRAM_UNIFORM_2D,
413 OPCODE_PROGRAM_UNIFORM_3D,
414 OPCODE_PROGRAM_UNIFORM_4D,
415 OPCODE_PROGRAM_UNIFORM_1DV,
416 OPCODE_PROGRAM_UNIFORM_2DV,
417 OPCODE_PROGRAM_UNIFORM_3DV,
418 OPCODE_PROGRAM_UNIFORM_4DV,
419 OPCODE_PROGRAM_UNIFORM_1I,
420 OPCODE_PROGRAM_UNIFORM_2I,
421 OPCODE_PROGRAM_UNIFORM_3I,
422 OPCODE_PROGRAM_UNIFORM_4I,
423 OPCODE_PROGRAM_UNIFORM_1IV,
424 OPCODE_PROGRAM_UNIFORM_2IV,
425 OPCODE_PROGRAM_UNIFORM_3IV,
426 OPCODE_PROGRAM_UNIFORM_4IV,
427 OPCODE_PROGRAM_UNIFORM_1UI,
428 OPCODE_PROGRAM_UNIFORM_2UI,
429 OPCODE_PROGRAM_UNIFORM_3UI,
430 OPCODE_PROGRAM_UNIFORM_4UI,
431 OPCODE_PROGRAM_UNIFORM_1UIV,
432 OPCODE_PROGRAM_UNIFORM_2UIV,
433 OPCODE_PROGRAM_UNIFORM_3UIV,
434 OPCODE_PROGRAM_UNIFORM_4UIV,
435 OPCODE_PROGRAM_UNIFORM_MATRIX22F,
436 OPCODE_PROGRAM_UNIFORM_MATRIX33F,
437 OPCODE_PROGRAM_UNIFORM_MATRIX44F,
438 OPCODE_PROGRAM_UNIFORM_MATRIX23F,
439 OPCODE_PROGRAM_UNIFORM_MATRIX32F,
440 OPCODE_PROGRAM_UNIFORM_MATRIX24F,
441 OPCODE_PROGRAM_UNIFORM_MATRIX42F,
442 OPCODE_PROGRAM_UNIFORM_MATRIX34F,
443 OPCODE_PROGRAM_UNIFORM_MATRIX43F,
444 OPCODE_PROGRAM_UNIFORM_MATRIX22D,
445 OPCODE_PROGRAM_UNIFORM_MATRIX33D,
446 OPCODE_PROGRAM_UNIFORM_MATRIX44D,
447 OPCODE_PROGRAM_UNIFORM_MATRIX23D,
448 OPCODE_PROGRAM_UNIFORM_MATRIX32D,
449 OPCODE_PROGRAM_UNIFORM_MATRIX24D,
450 OPCODE_PROGRAM_UNIFORM_MATRIX42D,
451 OPCODE_PROGRAM_UNIFORM_MATRIX34D,
452 OPCODE_PROGRAM_UNIFORM_MATRIX43D,
453
454 /* GL_ARB_clip_control */
455 OPCODE_CLIP_CONTROL,
456
457 /* GL_ARB_color_buffer_float */
458 OPCODE_CLAMP_COLOR,
459
460 /* GL_EXT_framebuffer_blit */
461 OPCODE_BLIT_FRAMEBUFFER,
462
463 /* Vertex attributes -- fallback for when optimized display
464 * list build isn't active.
465 */
466 OPCODE_ATTR_1F_NV,
467 OPCODE_ATTR_2F_NV,
468 OPCODE_ATTR_3F_NV,
469 OPCODE_ATTR_4F_NV,
470 OPCODE_ATTR_1F_ARB,
471 OPCODE_ATTR_2F_ARB,
472 OPCODE_ATTR_3F_ARB,
473 OPCODE_ATTR_4F_ARB,
474 OPCODE_ATTR_1D,
475 OPCODE_ATTR_2D,
476 OPCODE_ATTR_3D,
477 OPCODE_ATTR_4D,
478 OPCODE_MATERIAL,
479 OPCODE_BEGIN,
480 OPCODE_END,
481 OPCODE_RECTF,
482 OPCODE_EVAL_C1,
483 OPCODE_EVAL_C2,
484 OPCODE_EVAL_P1,
485 OPCODE_EVAL_P2,
486
487 /* GL_EXT_provoking_vertex */
488 OPCODE_PROVOKING_VERTEX,
489
490 /* GL_EXT_transform_feedback */
491 OPCODE_BEGIN_TRANSFORM_FEEDBACK,
492 OPCODE_END_TRANSFORM_FEEDBACK,
493 OPCODE_BIND_TRANSFORM_FEEDBACK,
494 OPCODE_PAUSE_TRANSFORM_FEEDBACK,
495 OPCODE_RESUME_TRANSFORM_FEEDBACK,
496 OPCODE_DRAW_TRANSFORM_FEEDBACK,
497
498 /* GL_EXT_texture_integer */
499 OPCODE_CLEARCOLOR_I,
500 OPCODE_CLEARCOLOR_UI,
501 OPCODE_TEXPARAMETER_I,
502 OPCODE_TEXPARAMETER_UI,
503
504 /* GL_ARB_instanced_arrays */
505 OPCODE_VERTEX_ATTRIB_DIVISOR,
506
507 /* GL_NV_texture_barrier */
508 OPCODE_TEXTURE_BARRIER_NV,
509
510 /* GL_ARB_sampler_object */
511 OPCODE_BIND_SAMPLER,
512 OPCODE_SAMPLER_PARAMETERIV,
513 OPCODE_SAMPLER_PARAMETERFV,
514 OPCODE_SAMPLER_PARAMETERIIV,
515 OPCODE_SAMPLER_PARAMETERUIV,
516
517 /* ARB_compute_shader */
518 OPCODE_DISPATCH_COMPUTE,
519
520 /* GL_ARB_sync */
521 OPCODE_WAIT_SYNC,
522
523 /* GL_NV_conditional_render */
524 OPCODE_BEGIN_CONDITIONAL_RENDER,
525 OPCODE_END_CONDITIONAL_RENDER,
526
527 /* ARB_timer_query */
528 OPCODE_QUERY_COUNTER,
529
530 /* ARB_transform_feedback3 */
531 OPCODE_BEGIN_QUERY_INDEXED,
532 OPCODE_END_QUERY_INDEXED,
533 OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM,
534
535 /* ARB_transform_feedback_instanced */
536 OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED,
537 OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED,
538
539 /* ARB_uniform_buffer_object */
540 OPCODE_UNIFORM_BLOCK_BINDING,
541
542 /* ARB_shader_subroutines */
543 OPCODE_UNIFORM_SUBROUTINES,
544
545 /* EXT_polygon_offset_clamp */
546 OPCODE_POLYGON_OFFSET_CLAMP,
547
548 /* EXT_window_rectangles */
549 OPCODE_WINDOW_RECTANGLES,
550
551 /* NV_conservative_raster */
552 OPCODE_SUBPIXEL_PRECISION_BIAS,
553
554 /* NV_conservative_raster_dilate */
555 OPCODE_CONSERVATIVE_RASTER_PARAMETER_F,
556
557 /* NV_conservative_raster_pre_snap_triangles */
558 OPCODE_CONSERVATIVE_RASTER_PARAMETER_I,
559
560 /* EXT_direct_state_access */
561 OPCODE_MATRIX_LOAD,
562 OPCODE_MATRIX_MULT,
563 OPCODE_MATRIX_ROTATE,
564 OPCODE_MATRIX_SCALE,
565 OPCODE_MATRIX_TRANSLATE,
566 OPCODE_MATRIX_LOAD_IDENTITY,
567 OPCODE_MATRIX_ORTHO,
568 OPCODE_MATRIX_FRUSTUM,
569 OPCODE_MATRIX_PUSH,
570 OPCODE_MATRIX_POP,
571 OPCODE_TEXTUREPARAMETER_F,
572 OPCODE_TEXTUREPARAMETER_I,
573 OPCODE_TEXTURE_IMAGE1D,
574 OPCODE_TEXTURE_IMAGE2D,
575 OPCODE_TEXTURE_IMAGE3D,
576 OPCODE_TEXTURE_SUB_IMAGE1D,
577 OPCODE_TEXTURE_SUB_IMAGE2D,
578 OPCODE_TEXTURE_SUB_IMAGE3D,
579 OPCODE_COPY_TEXTURE_IMAGE1D,
580 OPCODE_COPY_TEXTURE_IMAGE2D,
581 OPCODE_COPY_TEXTURE_SUB_IMAGE1D,
582 OPCODE_COPY_TEXTURE_SUB_IMAGE2D,
583 OPCODE_COPY_TEXTURE_SUB_IMAGE3D,
584 OPCODE_BIND_MULTITEXTURE,
585 OPCODE_MULTITEXPARAMETER_F,
586 OPCODE_MULTITEXPARAMETER_I,
587 OPCODE_MULTITEX_IMAGE1D,
588 OPCODE_MULTITEX_IMAGE2D,
589 OPCODE_MULTITEX_IMAGE3D,
590 OPCODE_MULTITEX_SUB_IMAGE1D,
591 OPCODE_MULTITEX_SUB_IMAGE2D,
592 OPCODE_MULTITEX_SUB_IMAGE3D,
593 OPCODE_MULTITEXENV,
594 OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_2D,
595
596 /* The following three are meta instructions */
597 OPCODE_ERROR, /* raise compiled-in error */
598 OPCODE_CONTINUE,
599 OPCODE_NOP, /* No-op (used for 8-byte alignment */
600 OPCODE_END_OF_LIST,
601 OPCODE_EXT_0
602 } OpCode;
603
604
605
606 /**
607 * Display list node.
608 *
609 * Display list instructions are stored as sequences of "nodes". Nodes
610 * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
611 * are linked together with a pointer.
612 *
613 * Each instruction in the display list is stored as a sequence of
614 * contiguous nodes in memory.
615 * Each node is the union of a variety of data types.
616 *
617 * Note, all of these members should be 4 bytes in size or less for the
618 * sake of compact display lists. We store 8-byte pointers in a pair of
619 * these nodes using the save/get_pointer() functions below.
620 */
621 union gl_dlist_node
622 {
623 OpCode opcode;
624 GLboolean b;
625 GLbitfield bf;
626 GLubyte ub;
627 GLshort s;
628 GLushort us;
629 GLint i;
630 GLuint ui;
631 GLenum e;
632 GLfloat f;
633 GLsizei si;
634 };
635
636
637 typedef union gl_dlist_node Node;
638
639
640 /** How many 4-byte dwords to store a pointer */
641 #define POINTER_DWORDS (sizeof(void *) / 4)
642
643 /* We want to keep sizeof(union gl_dlist_node) == 4 to minimize
644 * space for display lists. The following types and functions are
645 * used to help store 4- and 8-byte pointers in 1 or 2 dlist_nodes.
646 */
647 union pointer
648 {
649 void *ptr;
650 GLuint dwords[POINTER_DWORDS];
651 };
652
653
654 /**
655 * Save a 4 or 8-byte pointer at dest (and dest+1).
656 */
657 static inline void
658 save_pointer(Node *dest, void *src)
659 {
660 union pointer p;
661 unsigned i;
662
663 STATIC_ASSERT(POINTER_DWORDS == 1 || POINTER_DWORDS == 2);
664 STATIC_ASSERT(sizeof(Node) == 4);
665
666 p.ptr = src;
667
668 for (i = 0; i < POINTER_DWORDS; i++)
669 dest[i].ui = p.dwords[i];
670 }
671
672
673 /**
674 * Retrieve a 4 or 8-byte pointer from node (node+1).
675 */
676 static inline void *
677 get_pointer(const Node *node)
678 {
679 union pointer p;
680 unsigned i;
681
682 for (i = 0; i < POINTER_DWORDS; i++)
683 p.dwords[i] = node[i].ui;
684
685 return p.ptr;
686 }
687
688
689 /**
690 * Used to store a 64-bit uint in a pair of "Nodes" for the sake of 32-bit
691 * environment.
692 */
693 union uint64_pair
694 {
695 GLuint64 uint64;
696 GLuint uint32[2];
697 };
698
699
700 union float64_pair
701 {
702 GLdouble d;
703 GLuint uint32[2];
704 };
705
706
707 #define ASSIGN_DOUBLE_TO_NODES(n, idx, value) \
708 do { \
709 union float64_pair tmp; \
710 tmp.d = value; \
711 n[idx].ui = tmp.uint32[0]; \
712 n[idx+1].ui = tmp.uint32[1]; \
713 } while (0)
714
715
716 /**
717 * How many nodes to allocate at a time. Note that bulk vertex data
718 * from glBegin/glVertex/glEnd primitives will typically wind up in
719 * a VBO, and not directly in the display list itself.
720 */
721 #define BLOCK_SIZE 256
722
723
724
725 /**
726 * Number of nodes of storage needed for each instruction.
727 * Sizes for dynamically allocated opcodes are stored in the context struct.
728 */
729 static GLuint InstSize[OPCODE_END_OF_LIST + 1];
730
731
732 void mesa_print_display_list(GLuint list);
733
734
735 /**
736 * Does the given display list only contain a single glBitmap call?
737 */
738 static bool
739 is_bitmap_list(const struct gl_display_list *dlist)
740 {
741 const Node *n = dlist->Head;
742 if (n[0].opcode == OPCODE_BITMAP) {
743 n += InstSize[OPCODE_BITMAP];
744 if (n[0].opcode == OPCODE_END_OF_LIST)
745 return true;
746 }
747 return false;
748 }
749
750
751 /**
752 * Is the given display list an empty list?
753 */
754 static bool
755 is_empty_list(const struct gl_display_list *dlist)
756 {
757 const Node *n = dlist->Head;
758 return n[0].opcode == OPCODE_END_OF_LIST;
759 }
760
761
762 /**
763 * Delete/free a gl_bitmap_atlas. Called during context tear-down.
764 */
765 void
766 _mesa_delete_bitmap_atlas(struct gl_context *ctx, struct gl_bitmap_atlas *atlas)
767 {
768 if (atlas->texObj) {
769 ctx->Driver.DeleteTexture(ctx, atlas->texObj);
770 }
771 free(atlas->glyphs);
772 free(atlas);
773 }
774
775
776 /**
777 * Lookup a gl_bitmap_atlas by listBase ID.
778 */
779 static struct gl_bitmap_atlas *
780 lookup_bitmap_atlas(struct gl_context *ctx, GLuint listBase)
781 {
782 struct gl_bitmap_atlas *atlas;
783
784 assert(listBase > 0);
785 atlas = _mesa_HashLookup(ctx->Shared->BitmapAtlas, listBase);
786 return atlas;
787 }
788
789
790 /**
791 * Create new bitmap atlas and insert into hash table.
792 */
793 static struct gl_bitmap_atlas *
794 alloc_bitmap_atlas(struct gl_context *ctx, GLuint listBase)
795 {
796 struct gl_bitmap_atlas *atlas;
797
798 assert(listBase > 0);
799 assert(_mesa_HashLookup(ctx->Shared->BitmapAtlas, listBase) == NULL);
800
801 atlas = calloc(1, sizeof(*atlas));
802 if (atlas) {
803 _mesa_HashInsert(ctx->Shared->BitmapAtlas, listBase, atlas);
804 }
805
806 return atlas;
807 }
808
809
810 /**
811 * Try to build a bitmap atlas. This involves examining a sequence of
812 * display lists which contain glBitmap commands and putting the bitmap
813 * images into a texture map (the atlas).
814 * If we succeed, gl_bitmap_atlas::complete will be set to true.
815 * If we fail, gl_bitmap_atlas::incomplete will be set to true.
816 */
817 static void
818 build_bitmap_atlas(struct gl_context *ctx, struct gl_bitmap_atlas *atlas,
819 GLuint listBase)
820 {
821 unsigned i, row_height = 0, xpos = 0, ypos = 0;
822 GLubyte *map;
823 GLint map_stride;
824
825 assert(atlas);
826 assert(!atlas->complete);
827 assert(atlas->numBitmaps > 0);
828
829 /* We use a rectangle texture (non-normalized coords) for the atlas */
830 assert(ctx->Extensions.NV_texture_rectangle);
831 assert(ctx->Const.MaxTextureRectSize >= 1024);
832
833 atlas->texWidth = 1024;
834 atlas->texHeight = 0; /* determined below */
835
836 atlas->glyphs = malloc(atlas->numBitmaps * sizeof(atlas->glyphs[0]));
837 if (!atlas->glyphs) {
838 /* give up */
839 atlas->incomplete = true;
840 return;
841 }
842
843 /* Loop over the display lists. They should all contain a single glBitmap
844 * call. If not, bail out. Also, compute the position and sizes of each
845 * bitmap in the atlas to determine the texture atlas size.
846 */
847 for (i = 0; i < atlas->numBitmaps; i++) {
848 const struct gl_display_list *list = _mesa_lookup_list(ctx, listBase + i);
849 const Node *n;
850 struct gl_bitmap_glyph *g = &atlas->glyphs[i];
851 unsigned bitmap_width, bitmap_height;
852 float bitmap_xmove, bitmap_ymove, bitmap_xorig, bitmap_yorig;
853
854 if (!list || is_empty_list(list)) {
855 /* stop here */
856 atlas->numBitmaps = i;
857 break;
858 }
859
860 if (!is_bitmap_list(list)) {
861 /* This list does not contain exactly one glBitmap command. Give up. */
862 atlas->incomplete = true;
863 return;
864 }
865
866 /* get bitmap info from the display list command */
867 n = list->Head;
868 assert(n[0].opcode == OPCODE_BITMAP);
869 bitmap_width = n[1].i;
870 bitmap_height = n[2].i;
871 bitmap_xorig = n[3].f;
872 bitmap_yorig = n[4].f;
873 bitmap_xmove = n[5].f;
874 bitmap_ymove = n[6].f;
875
876 if (xpos + bitmap_width > atlas->texWidth) {
877 /* advance to the next row of the texture */
878 xpos = 0;
879 ypos += row_height;
880 row_height = 0;
881 }
882
883 /* save the bitmap's position in the atlas */
884 g->x = xpos;
885 g->y = ypos;
886 g->w = bitmap_width;
887 g->h = bitmap_height;
888 g->xorig = bitmap_xorig;
889 g->yorig = bitmap_yorig;
890 g->xmove = bitmap_xmove;
891 g->ymove = bitmap_ymove;
892
893 xpos += bitmap_width;
894
895 /* keep track of tallest bitmap in the row */
896 row_height = MAX2(row_height, bitmap_height);
897 }
898
899 /* Now we know the texture height */
900 atlas->texHeight = ypos + row_height;
901
902 if (atlas->texHeight == 0) {
903 /* no glyphs found, give up */
904 goto fail;
905 }
906 else if (atlas->texHeight > ctx->Const.MaxTextureRectSize) {
907 /* too large, give up */
908 goto fail;
909 }
910
911 /* Create atlas texture (texture ID is irrelevant) */
912 atlas->texObj = ctx->Driver.NewTextureObject(ctx, 999, GL_TEXTURE_RECTANGLE);
913 if (!atlas->texObj) {
914 goto out_of_memory;
915 }
916
917 atlas->texObj->Sampler.MinFilter = GL_NEAREST;
918 atlas->texObj->Sampler.MagFilter = GL_NEAREST;
919 atlas->texObj->MaxLevel = 0;
920 atlas->texObj->Immutable = GL_TRUE;
921
922 atlas->texImage = _mesa_get_tex_image(ctx, atlas->texObj,
923 GL_TEXTURE_RECTANGLE, 0);
924 if (!atlas->texImage) {
925 goto out_of_memory;
926 }
927
928 _mesa_init_teximage_fields(ctx, atlas->texImage,
929 atlas->texWidth, atlas->texHeight, 1, 0,
930 GL_ALPHA, MESA_FORMAT_A_UNORM8);
931
932 /* alloc image storage */
933 if (!ctx->Driver.AllocTextureImageBuffer(ctx, atlas->texImage)) {
934 goto out_of_memory;
935 }
936
937 /* map teximage, load with bitmap glyphs */
938 ctx->Driver.MapTextureImage(ctx, atlas->texImage, 0,
939 0, 0, atlas->texWidth, atlas->texHeight,
940 GL_MAP_WRITE_BIT, &map, &map_stride);
941 if (!map) {
942 goto out_of_memory;
943 }
944
945 /* Background/clear pixels are 0xff, foreground/set pixels are 0x0 */
946 memset(map, 0xff, map_stride * atlas->texHeight);
947
948 for (i = 0; i < atlas->numBitmaps; i++) {
949 const struct gl_display_list *list = _mesa_lookup_list(ctx, listBase + i);
950 const Node *n = list->Head;
951
952 assert(n[0].opcode == OPCODE_BITMAP ||
953 n[0].opcode == OPCODE_END_OF_LIST);
954
955 if (n[0].opcode == OPCODE_BITMAP) {
956 unsigned bitmap_width = n[1].i;
957 unsigned bitmap_height = n[2].i;
958 unsigned xpos = atlas->glyphs[i].x;
959 unsigned ypos = atlas->glyphs[i].y;
960 const void *bitmap_image = get_pointer(&n[7]);
961
962 assert(atlas->glyphs[i].w == bitmap_width);
963 assert(atlas->glyphs[i].h == bitmap_height);
964
965 /* put the bitmap image into the texture image */
966 _mesa_expand_bitmap(bitmap_width, bitmap_height,
967 &ctx->DefaultPacking, bitmap_image,
968 map + map_stride * ypos + xpos, /* dest addr */
969 map_stride, 0x0);
970 }
971 }
972
973 ctx->Driver.UnmapTextureImage(ctx, atlas->texImage, 0);
974
975 atlas->complete = true;
976
977 return;
978
979 out_of_memory:
980 _mesa_error(ctx, GL_OUT_OF_MEMORY, "Display list bitmap atlas");
981 fail:
982 if (atlas->texObj) {
983 ctx->Driver.DeleteTexture(ctx, atlas->texObj);
984 }
985 free(atlas->glyphs);
986 atlas->glyphs = NULL;
987 atlas->incomplete = true;
988 }
989
990
991 /**
992 * Allocate a gl_display_list object with an initial block of storage.
993 * \param count how many display list nodes/tokens to allocate
994 */
995 static struct gl_display_list *
996 make_list(GLuint name, GLuint count)
997 {
998 struct gl_display_list *dlist = CALLOC_STRUCT(gl_display_list);
999 dlist->Name = name;
1000 dlist->Head = malloc(sizeof(Node) * count);
1001 dlist->Head[0].opcode = OPCODE_END_OF_LIST;
1002 /* All InstSize[] entries must be non-zero */
1003 InstSize[OPCODE_END_OF_LIST] = 1;
1004 return dlist;
1005 }
1006
1007
1008 /**
1009 * Lookup function to just encapsulate casting.
1010 */
1011 struct gl_display_list *
1012 _mesa_lookup_list(struct gl_context *ctx, GLuint list)
1013 {
1014 return (struct gl_display_list *)
1015 _mesa_HashLookup(ctx->Shared->DisplayList, list);
1016 }
1017
1018
1019 /** Is the given opcode an extension code? */
1020 static inline GLboolean
1021 is_ext_opcode(OpCode opcode)
1022 {
1023 return (opcode >= OPCODE_EXT_0);
1024 }
1025
1026
1027 /** Destroy an extended opcode instruction */
1028 static GLint
1029 ext_opcode_destroy(struct gl_context *ctx, Node *node)
1030 {
1031 const GLint i = node[0].opcode - OPCODE_EXT_0;
1032 GLint step;
1033 ctx->ListExt->Opcode[i].Destroy(ctx, &node[1]);
1034 step = ctx->ListExt->Opcode[i].Size;
1035 return step;
1036 }
1037
1038
1039 /** Execute an extended opcode instruction */
1040 static GLint
1041 ext_opcode_execute(struct gl_context *ctx, Node *node)
1042 {
1043 const GLint i = node[0].opcode - OPCODE_EXT_0;
1044 GLint step;
1045 ctx->ListExt->Opcode[i].Execute(ctx, &node[1]);
1046 step = ctx->ListExt->Opcode[i].Size;
1047 return step;
1048 }
1049
1050
1051 /** Print an extended opcode instruction */
1052 static GLint
1053 ext_opcode_print(struct gl_context *ctx, Node *node, FILE *f)
1054 {
1055 const GLint i = node[0].opcode - OPCODE_EXT_0;
1056 GLint step;
1057 ctx->ListExt->Opcode[i].Print(ctx, &node[1], f);
1058 step = ctx->ListExt->Opcode[i].Size;
1059 return step;
1060 }
1061
1062
1063 /**
1064 * Delete the named display list, but don't remove from hash table.
1065 * \param dlist - display list pointer
1066 */
1067 void
1068 _mesa_delete_list(struct gl_context *ctx, struct gl_display_list *dlist)
1069 {
1070 Node *n, *block;
1071 GLboolean done;
1072
1073 n = block = dlist->Head;
1074
1075 done = block ? GL_FALSE : GL_TRUE;
1076 while (!done) {
1077 const OpCode opcode = n[0].opcode;
1078
1079 /* check for extension opcodes first */
1080 if (is_ext_opcode(opcode)) {
1081 n += ext_opcode_destroy(ctx, n);
1082 }
1083 else {
1084 switch (opcode) {
1085 /* for some commands, we need to free malloc'd memory */
1086 case OPCODE_MAP1:
1087 free(get_pointer(&n[6]));
1088 break;
1089 case OPCODE_MAP2:
1090 free(get_pointer(&n[10]));
1091 break;
1092 case OPCODE_CALL_LISTS:
1093 free(get_pointer(&n[3]));
1094 break;
1095 case OPCODE_DRAW_PIXELS:
1096 free(get_pointer(&n[5]));
1097 break;
1098 case OPCODE_BITMAP:
1099 free(get_pointer(&n[7]));
1100 break;
1101 case OPCODE_POLYGON_STIPPLE:
1102 free(get_pointer(&n[1]));
1103 break;
1104 case OPCODE_TEX_IMAGE1D:
1105 free(get_pointer(&n[8]));
1106 break;
1107 case OPCODE_TEX_IMAGE2D:
1108 free(get_pointer(&n[9]));
1109 break;
1110 case OPCODE_TEX_IMAGE3D:
1111 free(get_pointer(&n[10]));
1112 break;
1113 case OPCODE_TEX_SUB_IMAGE1D:
1114 free(get_pointer(&n[7]));
1115 break;
1116 case OPCODE_TEX_SUB_IMAGE2D:
1117 free(get_pointer(&n[9]));
1118 break;
1119 case OPCODE_TEX_SUB_IMAGE3D:
1120 free(get_pointer(&n[11]));
1121 break;
1122 case OPCODE_COMPRESSED_TEX_IMAGE_1D:
1123 free(get_pointer(&n[7]));
1124 break;
1125 case OPCODE_COMPRESSED_TEX_IMAGE_2D:
1126 free(get_pointer(&n[8]));
1127 break;
1128 case OPCODE_COMPRESSED_TEX_IMAGE_3D:
1129 free(get_pointer(&n[9]));
1130 break;
1131 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D:
1132 free(get_pointer(&n[7]));
1133 break;
1134 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D:
1135 free(get_pointer(&n[9]));
1136 break;
1137 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D:
1138 free(get_pointer(&n[11]));
1139 break;
1140 case OPCODE_PROGRAM_STRING_ARB:
1141 free(get_pointer(&n[4])); /* program string */
1142 break;
1143 case OPCODE_UNIFORM_1FV:
1144 case OPCODE_UNIFORM_2FV:
1145 case OPCODE_UNIFORM_3FV:
1146 case OPCODE_UNIFORM_4FV:
1147 case OPCODE_UNIFORM_1DV:
1148 case OPCODE_UNIFORM_2DV:
1149 case OPCODE_UNIFORM_3DV:
1150 case OPCODE_UNIFORM_4DV:
1151 case OPCODE_UNIFORM_1IV:
1152 case OPCODE_UNIFORM_2IV:
1153 case OPCODE_UNIFORM_3IV:
1154 case OPCODE_UNIFORM_4IV:
1155 case OPCODE_UNIFORM_1UIV:
1156 case OPCODE_UNIFORM_2UIV:
1157 case OPCODE_UNIFORM_3UIV:
1158 case OPCODE_UNIFORM_4UIV:
1159 free(get_pointer(&n[3]));
1160 break;
1161 case OPCODE_UNIFORM_MATRIX22:
1162 case OPCODE_UNIFORM_MATRIX33:
1163 case OPCODE_UNIFORM_MATRIX44:
1164 case OPCODE_UNIFORM_MATRIX24:
1165 case OPCODE_UNIFORM_MATRIX42:
1166 case OPCODE_UNIFORM_MATRIX23:
1167 case OPCODE_UNIFORM_MATRIX32:
1168 case OPCODE_UNIFORM_MATRIX34:
1169 case OPCODE_UNIFORM_MATRIX43:
1170 case OPCODE_UNIFORM_MATRIX22D:
1171 case OPCODE_UNIFORM_MATRIX33D:
1172 case OPCODE_UNIFORM_MATRIX44D:
1173 case OPCODE_UNIFORM_MATRIX24D:
1174 case OPCODE_UNIFORM_MATRIX42D:
1175 case OPCODE_UNIFORM_MATRIX23D:
1176 case OPCODE_UNIFORM_MATRIX32D:
1177 case OPCODE_UNIFORM_MATRIX34D:
1178 case OPCODE_UNIFORM_MATRIX43D:
1179 free(get_pointer(&n[4]));
1180 break;
1181 case OPCODE_PROGRAM_UNIFORM_1FV:
1182 case OPCODE_PROGRAM_UNIFORM_2FV:
1183 case OPCODE_PROGRAM_UNIFORM_3FV:
1184 case OPCODE_PROGRAM_UNIFORM_4FV:
1185 case OPCODE_PROGRAM_UNIFORM_1DV:
1186 case OPCODE_PROGRAM_UNIFORM_2DV:
1187 case OPCODE_PROGRAM_UNIFORM_3DV:
1188 case OPCODE_PROGRAM_UNIFORM_4DV:
1189 case OPCODE_PROGRAM_UNIFORM_1IV:
1190 case OPCODE_PROGRAM_UNIFORM_2IV:
1191 case OPCODE_PROGRAM_UNIFORM_3IV:
1192 case OPCODE_PROGRAM_UNIFORM_4IV:
1193 case OPCODE_PROGRAM_UNIFORM_1UIV:
1194 case OPCODE_PROGRAM_UNIFORM_2UIV:
1195 case OPCODE_PROGRAM_UNIFORM_3UIV:
1196 case OPCODE_PROGRAM_UNIFORM_4UIV:
1197 free(get_pointer(&n[4]));
1198 break;
1199 case OPCODE_PROGRAM_UNIFORM_MATRIX22F:
1200 case OPCODE_PROGRAM_UNIFORM_MATRIX33F:
1201 case OPCODE_PROGRAM_UNIFORM_MATRIX44F:
1202 case OPCODE_PROGRAM_UNIFORM_MATRIX24F:
1203 case OPCODE_PROGRAM_UNIFORM_MATRIX42F:
1204 case OPCODE_PROGRAM_UNIFORM_MATRIX23F:
1205 case OPCODE_PROGRAM_UNIFORM_MATRIX32F:
1206 case OPCODE_PROGRAM_UNIFORM_MATRIX34F:
1207 case OPCODE_PROGRAM_UNIFORM_MATRIX43F:
1208 case OPCODE_PROGRAM_UNIFORM_MATRIX22D:
1209 case OPCODE_PROGRAM_UNIFORM_MATRIX33D:
1210 case OPCODE_PROGRAM_UNIFORM_MATRIX44D:
1211 case OPCODE_PROGRAM_UNIFORM_MATRIX24D:
1212 case OPCODE_PROGRAM_UNIFORM_MATRIX42D:
1213 case OPCODE_PROGRAM_UNIFORM_MATRIX23D:
1214 case OPCODE_PROGRAM_UNIFORM_MATRIX32D:
1215 case OPCODE_PROGRAM_UNIFORM_MATRIX34D:
1216 case OPCODE_PROGRAM_UNIFORM_MATRIX43D:
1217 free(get_pointer(&n[5]));
1218 break;
1219 case OPCODE_PIXEL_MAP:
1220 free(get_pointer(&n[3]));
1221 break;
1222 case OPCODE_VIEWPORT_ARRAY_V:
1223 case OPCODE_SCISSOR_ARRAY_V:
1224 case OPCODE_DEPTH_ARRAY_V:
1225 case OPCODE_UNIFORM_SUBROUTINES:
1226 case OPCODE_WINDOW_RECTANGLES:
1227 free(get_pointer(&n[3]));
1228 break;
1229 case OPCODE_TEXTURE_IMAGE1D:
1230 case OPCODE_MULTITEX_IMAGE1D:
1231 free(get_pointer(&n[9]));
1232 break;
1233 case OPCODE_TEXTURE_IMAGE2D:
1234 case OPCODE_MULTITEX_IMAGE2D:
1235 free(get_pointer(&n[10]));
1236 break;
1237 case OPCODE_TEXTURE_IMAGE3D:
1238 case OPCODE_MULTITEX_IMAGE3D:
1239 free(get_pointer(&n[11]));
1240 break;
1241 case OPCODE_TEXTURE_SUB_IMAGE1D:
1242 case OPCODE_MULTITEX_SUB_IMAGE1D:
1243 free(get_pointer(&n[8]));
1244 break;
1245 case OPCODE_TEXTURE_SUB_IMAGE2D:
1246 case OPCODE_MULTITEX_SUB_IMAGE2D:
1247 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_2D:
1248 free(get_pointer(&n[10]));
1249 break;
1250 case OPCODE_TEXTURE_SUB_IMAGE3D:
1251 case OPCODE_MULTITEX_SUB_IMAGE3D:
1252 free(get_pointer(&n[12]));
1253 break;
1254 case OPCODE_CONTINUE:
1255 n = (Node *) get_pointer(&n[1]);
1256 free(block);
1257 block = n;
1258 break;
1259 case OPCODE_END_OF_LIST:
1260 free(block);
1261 done = GL_TRUE;
1262 break;
1263 default:
1264 /* just increment 'n' pointer, below */
1265 ;
1266 }
1267
1268 if (opcode != OPCODE_CONTINUE) {
1269 assert(InstSize[opcode] > 0);
1270 n += InstSize[opcode];
1271 }
1272 }
1273 }
1274
1275 free(dlist->Label);
1276 free(dlist);
1277 }
1278
1279
1280 /**
1281 * Called by _mesa_HashWalk() to check if a display list which is being
1282 * deleted belongs to a bitmap texture atlas.
1283 */
1284 static void
1285 check_atlas_for_deleted_list(GLuint atlas_id, void *data, void *userData)
1286 {
1287 struct gl_bitmap_atlas *atlas = (struct gl_bitmap_atlas *) data;
1288 GLuint list_id = *((GLuint *) userData); /* the list being deleted */
1289
1290 /* See if the list_id falls in the range contained in this texture atlas */
1291 if (atlas->complete &&
1292 list_id >= atlas_id &&
1293 list_id < atlas_id + atlas->numBitmaps) {
1294 /* Mark the atlas as incomplete so it doesn't get used. But don't
1295 * delete it yet since we don't want to try to recreate it in the next
1296 * glCallLists.
1297 */
1298 atlas->complete = false;
1299 atlas->incomplete = true;
1300 }
1301 }
1302
1303
1304 /**
1305 * Destroy a display list and remove from hash table.
1306 * \param list - display list number
1307 */
1308 static void
1309 destroy_list(struct gl_context *ctx, GLuint list)
1310 {
1311 struct gl_display_list *dlist;
1312
1313 if (list == 0)
1314 return;
1315
1316 dlist = _mesa_lookup_list(ctx, list);
1317 if (!dlist)
1318 return;
1319
1320 if (is_bitmap_list(dlist)) {
1321 /* If we're destroying a simple glBitmap display list, there's a
1322 * chance that we're destroying a bitmap image that's in a texture
1323 * atlas. Examine all atlases to see if that's the case. There's
1324 * usually few (if any) atlases so this isn't expensive.
1325 */
1326 _mesa_HashWalk(ctx->Shared->BitmapAtlas,
1327 check_atlas_for_deleted_list, &list);
1328 }
1329
1330 _mesa_delete_list(ctx, dlist);
1331 _mesa_HashRemove(ctx->Shared->DisplayList, list);
1332 }
1333
1334
1335 /*
1336 * Translate the nth element of list from <type> to GLint.
1337 */
1338 static GLint
1339 translate_id(GLsizei n, GLenum type, const GLvoid * list)
1340 {
1341 GLbyte *bptr;
1342 GLubyte *ubptr;
1343 GLshort *sptr;
1344 GLushort *usptr;
1345 GLint *iptr;
1346 GLuint *uiptr;
1347 GLfloat *fptr;
1348
1349 switch (type) {
1350 case GL_BYTE:
1351 bptr = (GLbyte *) list;
1352 return (GLint) bptr[n];
1353 case GL_UNSIGNED_BYTE:
1354 ubptr = (GLubyte *) list;
1355 return (GLint) ubptr[n];
1356 case GL_SHORT:
1357 sptr = (GLshort *) list;
1358 return (GLint) sptr[n];
1359 case GL_UNSIGNED_SHORT:
1360 usptr = (GLushort *) list;
1361 return (GLint) usptr[n];
1362 case GL_INT:
1363 iptr = (GLint *) list;
1364 return iptr[n];
1365 case GL_UNSIGNED_INT:
1366 uiptr = (GLuint *) list;
1367 return (GLint) uiptr[n];
1368 case GL_FLOAT:
1369 fptr = (GLfloat *) list;
1370 return (GLint) floorf(fptr[n]);
1371 case GL_2_BYTES:
1372 ubptr = ((GLubyte *) list) + 2 * n;
1373 return (GLint) ubptr[0] * 256
1374 + (GLint) ubptr[1];
1375 case GL_3_BYTES:
1376 ubptr = ((GLubyte *) list) + 3 * n;
1377 return (GLint) ubptr[0] * 65536
1378 + (GLint) ubptr[1] * 256
1379 + (GLint) ubptr[2];
1380 case GL_4_BYTES:
1381 ubptr = ((GLubyte *) list) + 4 * n;
1382 return (GLint) ubptr[0] * 16777216
1383 + (GLint) ubptr[1] * 65536
1384 + (GLint) ubptr[2] * 256
1385 + (GLint) ubptr[3];
1386 default:
1387 return 0;
1388 }
1389 }
1390
1391
1392 /**
1393 * Wrapper for _mesa_unpack_image/bitmap() that handles pixel buffer objects.
1394 * If width < 0 or height < 0 or format or type are invalid we'll just
1395 * return NULL. We will not generate an error since OpenGL command
1396 * arguments aren't error-checked until the command is actually executed
1397 * (not when they're compiled).
1398 * But if we run out of memory, GL_OUT_OF_MEMORY will be recorded.
1399 */
1400 static GLvoid *
1401 unpack_image(struct gl_context *ctx, GLuint dimensions,
1402 GLsizei width, GLsizei height, GLsizei depth,
1403 GLenum format, GLenum type, const GLvoid * pixels,
1404 const struct gl_pixelstore_attrib *unpack)
1405 {
1406 if (width <= 0 || height <= 0) {
1407 return NULL;
1408 }
1409
1410 if (_mesa_bytes_per_pixel(format, type) < 0) {
1411 /* bad format and/or type */
1412 return NULL;
1413 }
1414
1415 if (!_mesa_is_bufferobj(unpack->BufferObj)) {
1416 /* no PBO */
1417 GLvoid *image;
1418
1419 image = _mesa_unpack_image(dimensions, width, height, depth,
1420 format, type, pixels, unpack);
1421 if (pixels && !image) {
1422 _mesa_error(ctx, GL_OUT_OF_MEMORY, "display list construction");
1423 }
1424 return image;
1425 }
1426 else if (_mesa_validate_pbo_access(dimensions, unpack, width, height,
1427 depth, format, type, INT_MAX, pixels)) {
1428 const GLubyte *map, *src;
1429 GLvoid *image;
1430
1431 map = (GLubyte *)
1432 ctx->Driver.MapBufferRange(ctx, 0, unpack->BufferObj->Size,
1433 GL_MAP_READ_BIT, unpack->BufferObj,
1434 MAP_INTERNAL);
1435 if (!map) {
1436 /* unable to map src buffer! */
1437 _mesa_error(ctx, GL_INVALID_OPERATION, "unable to map PBO");
1438 return NULL;
1439 }
1440
1441 src = ADD_POINTERS(map, pixels);
1442 image = _mesa_unpack_image(dimensions, width, height, depth,
1443 format, type, src, unpack);
1444
1445 ctx->Driver.UnmapBuffer(ctx, unpack->BufferObj, MAP_INTERNAL);
1446
1447 if (!image) {
1448 _mesa_error(ctx, GL_OUT_OF_MEMORY, "display list construction");
1449 }
1450 return image;
1451 }
1452
1453 /* bad access! */
1454 _mesa_error(ctx, GL_INVALID_OPERATION, "invalid PBO access");
1455 return NULL;
1456 }
1457
1458
1459 /** Return copy of memory */
1460 static void *
1461 memdup(const void *src, GLsizei bytes)
1462 {
1463 void *b = bytes >= 0 ? malloc(bytes) : NULL;
1464 if (b)
1465 memcpy(b, src, bytes);
1466 return b;
1467 }
1468
1469
1470 /**
1471 * Allocate space for a display list instruction (opcode + payload space).
1472 * \param opcode the instruction opcode (OPCODE_* value)
1473 * \param bytes instruction payload size (not counting opcode)
1474 * \param align8 does the payload need to be 8-byte aligned?
1475 * This is only relevant in 64-bit environments.
1476 * \return pointer to allocated memory (the payload will be at pointer+1)
1477 */
1478 static Node *
1479 dlist_alloc(struct gl_context *ctx, OpCode opcode, GLuint bytes, bool align8)
1480 {
1481 const GLuint numNodes = 1 + (bytes + sizeof(Node) - 1) / sizeof(Node);
1482 const GLuint contNodes = 1 + POINTER_DWORDS; /* size of continue info */
1483 GLuint nopNode;
1484 Node *n;
1485
1486 assert(bytes <= BLOCK_SIZE * sizeof(Node));
1487
1488 if (opcode < OPCODE_EXT_0) {
1489 if (InstSize[opcode] == 0) {
1490 /* save instruction size now */
1491 InstSize[opcode] = numNodes;
1492 }
1493 else {
1494 /* make sure instruction size agrees */
1495 assert(numNodes == InstSize[opcode]);
1496 }
1497 }
1498
1499 if (sizeof(void *) > sizeof(Node) && align8
1500 && ctx->ListState.CurrentPos % 2 == 0) {
1501 /* The opcode would get placed at node[0] and the payload would start
1502 * at node[1]. But the payload needs to be at an even offset (8-byte
1503 * multiple).
1504 */
1505 nopNode = 1;
1506 }
1507 else {
1508 nopNode = 0;
1509 }
1510
1511 if (ctx->ListState.CurrentPos + nopNode + numNodes + contNodes
1512 > BLOCK_SIZE) {
1513 /* This block is full. Allocate a new block and chain to it */
1514 Node *newblock;
1515 n = ctx->ListState.CurrentBlock + ctx->ListState.CurrentPos;
1516 n[0].opcode = OPCODE_CONTINUE;
1517 newblock = malloc(sizeof(Node) * BLOCK_SIZE);
1518 if (!newblock) {
1519 _mesa_error(ctx, GL_OUT_OF_MEMORY, "Building display list");
1520 return NULL;
1521 }
1522
1523 /* a fresh block should be 8-byte aligned on 64-bit systems */
1524 assert(((GLintptr) newblock) % sizeof(void *) == 0);
1525
1526 save_pointer(&n[1], newblock);
1527 ctx->ListState.CurrentBlock = newblock;
1528 ctx->ListState.CurrentPos = 0;
1529
1530 /* Display list nodes are always 4 bytes. If we need 8-byte alignment
1531 * we have to insert a NOP so that the payload of the real opcode lands
1532 * on an even location:
1533 * node[0] = OPCODE_NOP
1534 * node[1] = OPCODE_x;
1535 * node[2] = start of payload
1536 */
1537 nopNode = sizeof(void *) > sizeof(Node) && align8;
1538 }
1539
1540 n = ctx->ListState.CurrentBlock + ctx->ListState.CurrentPos;
1541 if (nopNode) {
1542 assert(ctx->ListState.CurrentPos % 2 == 0); /* even value */
1543 n[0].opcode = OPCODE_NOP;
1544 n++;
1545 /* The "real" opcode will now be at an odd location and the payload
1546 * will be at an even location.
1547 */
1548 }
1549 ctx->ListState.CurrentPos += nopNode + numNodes;
1550
1551 n[0].opcode = opcode;
1552
1553 return n;
1554 }
1555
1556
1557
1558 /**
1559 * Allocate space for a display list instruction. Used by callers outside
1560 * this file for things like VBO vertex data.
1561 *
1562 * \param opcode the instruction opcode (OPCODE_* value)
1563 * \param bytes instruction size in bytes, not counting opcode.
1564 * \return pointer to the usable data area (not including the internal
1565 * opcode).
1566 */
1567 void *
1568 _mesa_dlist_alloc(struct gl_context *ctx, GLuint opcode, GLuint bytes)
1569 {
1570 Node *n = dlist_alloc(ctx, (OpCode) opcode, bytes, false);
1571 if (n)
1572 return n + 1; /* return pointer to payload area, after opcode */
1573 else
1574 return NULL;
1575 }
1576
1577
1578 /**
1579 * Same as _mesa_dlist_alloc(), but return a pointer which is 8-byte
1580 * aligned in 64-bit environments, 4-byte aligned otherwise.
1581 */
1582 void *
1583 _mesa_dlist_alloc_aligned(struct gl_context *ctx, GLuint opcode, GLuint bytes)
1584 {
1585 Node *n = dlist_alloc(ctx, (OpCode) opcode, bytes, true);
1586 if (n)
1587 return n + 1; /* return pointer to payload area, after opcode */
1588 else
1589 return NULL;
1590 }
1591
1592
1593 /**
1594 * This function allows modules and drivers to get their own opcodes
1595 * for extending display list functionality.
1596 * \param ctx the rendering context
1597 * \param size number of bytes for storing the new display list command
1598 * \param execute function to execute the new display list command
1599 * \param destroy function to destroy the new display list command
1600 * \param print function to print the new display list command
1601 * \return the new opcode number or -1 if error
1602 */
1603 GLint
1604 _mesa_dlist_alloc_opcode(struct gl_context *ctx,
1605 GLuint size,
1606 void (*execute) (struct gl_context *, void *),
1607 void (*destroy) (struct gl_context *, void *),
1608 void (*print) (struct gl_context *, void *, FILE *))
1609 {
1610 if (ctx->ListExt->NumOpcodes < MAX_DLIST_EXT_OPCODES) {
1611 const GLuint i = ctx->ListExt->NumOpcodes++;
1612 ctx->ListExt->Opcode[i].Size =
1613 1 + (size + sizeof(Node) - 1) / sizeof(Node);
1614 ctx->ListExt->Opcode[i].Execute = execute;
1615 ctx->ListExt->Opcode[i].Destroy = destroy;
1616 ctx->ListExt->Opcode[i].Print = print;
1617 return i + OPCODE_EXT_0;
1618 }
1619 return -1;
1620 }
1621
1622
1623 /**
1624 * Allocate space for a display list instruction. The space is basically
1625 * an array of Nodes where node[0] holds the opcode, node[1] is the first
1626 * function parameter, node[2] is the second parameter, etc.
1627 *
1628 * \param opcode one of OPCODE_x
1629 * \param nparams number of function parameters
1630 * \return pointer to start of instruction space
1631 */
1632 static inline Node *
1633 alloc_instruction(struct gl_context *ctx, OpCode opcode, GLuint nparams)
1634 {
1635 return dlist_alloc(ctx, opcode, nparams * sizeof(Node), false);
1636 }
1637
1638
1639 /**
1640 * Called by EndList to try to reduce memory used for the list.
1641 */
1642 static void
1643 trim_list(struct gl_context *ctx)
1644 {
1645 /* If the list we're ending only has one allocated block of nodes/tokens
1646 * and its size isn't a full block size, realloc the block to use less
1647 * memory. This is important for apps that create many small display
1648 * lists and apps that use glXUseXFont (many lists each containing one
1649 * glBitmap call).
1650 * Note: we currently only trim display lists that allocated one block
1651 * of tokens. That hits the short list case which is what we're mainly
1652 * concerned with. Trimming longer lists would involve traversing the
1653 * linked list of blocks.
1654 */
1655 struct gl_dlist_state *list = &ctx->ListState;
1656
1657 if ((list->CurrentList->Head == list->CurrentBlock) &&
1658 (list->CurrentPos < BLOCK_SIZE)) {
1659 /* There's only one block and it's not full, so realloc */
1660 GLuint newSize = list->CurrentPos * sizeof(Node);
1661 list->CurrentList->Head =
1662 list->CurrentBlock = realloc(list->CurrentBlock, newSize);
1663 if (!list->CurrentBlock) {
1664 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glEndList");
1665 }
1666 }
1667 }
1668
1669
1670
1671 /*
1672 * Display List compilation functions
1673 */
1674 static void GLAPIENTRY
1675 save_Accum(GLenum op, GLfloat value)
1676 {
1677 GET_CURRENT_CONTEXT(ctx);
1678 Node *n;
1679 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1680 n = alloc_instruction(ctx, OPCODE_ACCUM, 2);
1681 if (n) {
1682 n[1].e = op;
1683 n[2].f = value;
1684 }
1685 if (ctx->ExecuteFlag) {
1686 CALL_Accum(ctx->Exec, (op, value));
1687 }
1688 }
1689
1690
1691 static void GLAPIENTRY
1692 save_AlphaFunc(GLenum func, GLclampf ref)
1693 {
1694 GET_CURRENT_CONTEXT(ctx);
1695 Node *n;
1696 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1697 n = alloc_instruction(ctx, OPCODE_ALPHA_FUNC, 2);
1698 if (n) {
1699 n[1].e = func;
1700 n[2].f = (GLfloat) ref;
1701 }
1702 if (ctx->ExecuteFlag) {
1703 CALL_AlphaFunc(ctx->Exec, (func, ref));
1704 }
1705 }
1706
1707
1708 static void GLAPIENTRY
1709 save_BindTexture(GLenum target, GLuint texture)
1710 {
1711 GET_CURRENT_CONTEXT(ctx);
1712 Node *n;
1713 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1714 n = alloc_instruction(ctx, OPCODE_BIND_TEXTURE, 2);
1715 if (n) {
1716 n[1].e = target;
1717 n[2].ui = texture;
1718 }
1719 if (ctx->ExecuteFlag) {
1720 CALL_BindTexture(ctx->Exec, (target, texture));
1721 }
1722 }
1723
1724
1725 static void GLAPIENTRY
1726 save_Bitmap(GLsizei width, GLsizei height,
1727 GLfloat xorig, GLfloat yorig,
1728 GLfloat xmove, GLfloat ymove, const GLubyte * pixels)
1729 {
1730 GET_CURRENT_CONTEXT(ctx);
1731 Node *n;
1732 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1733 n = alloc_instruction(ctx, OPCODE_BITMAP, 6 + POINTER_DWORDS);
1734 if (n) {
1735 n[1].i = (GLint) width;
1736 n[2].i = (GLint) height;
1737 n[3].f = xorig;
1738 n[4].f = yorig;
1739 n[5].f = xmove;
1740 n[6].f = ymove;
1741 save_pointer(&n[7],
1742 unpack_image(ctx, 2, width, height, 1, GL_COLOR_INDEX,
1743 GL_BITMAP, pixels, &ctx->Unpack));
1744 }
1745 if (ctx->ExecuteFlag) {
1746 CALL_Bitmap(ctx->Exec, (width, height,
1747 xorig, yorig, xmove, ymove, pixels));
1748 }
1749 }
1750
1751
1752 static void GLAPIENTRY
1753 save_BlendEquation(GLenum mode)
1754 {
1755 GET_CURRENT_CONTEXT(ctx);
1756 Node *n;
1757 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1758 n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION, 1);
1759 if (n) {
1760 n[1].e = mode;
1761 }
1762 if (ctx->ExecuteFlag) {
1763 CALL_BlendEquation(ctx->Exec, (mode));
1764 }
1765 }
1766
1767
1768 static void GLAPIENTRY
1769 save_BlendEquationSeparateEXT(GLenum modeRGB, GLenum modeA)
1770 {
1771 GET_CURRENT_CONTEXT(ctx);
1772 Node *n;
1773 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1774 n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION_SEPARATE, 2);
1775 if (n) {
1776 n[1].e = modeRGB;
1777 n[2].e = modeA;
1778 }
1779 if (ctx->ExecuteFlag) {
1780 CALL_BlendEquationSeparate(ctx->Exec, (modeRGB, modeA));
1781 }
1782 }
1783
1784
1785 static void GLAPIENTRY
1786 save_BlendFuncSeparateEXT(GLenum sfactorRGB, GLenum dfactorRGB,
1787 GLenum sfactorA, GLenum dfactorA)
1788 {
1789 GET_CURRENT_CONTEXT(ctx);
1790 Node *n;
1791 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1792 n = alloc_instruction(ctx, OPCODE_BLEND_FUNC_SEPARATE, 4);
1793 if (n) {
1794 n[1].e = sfactorRGB;
1795 n[2].e = dfactorRGB;
1796 n[3].e = sfactorA;
1797 n[4].e = dfactorA;
1798 }
1799 if (ctx->ExecuteFlag) {
1800 CALL_BlendFuncSeparate(ctx->Exec,
1801 (sfactorRGB, dfactorRGB, sfactorA, dfactorA));
1802 }
1803 }
1804
1805
1806 static void GLAPIENTRY
1807 save_BlendFunc(GLenum srcfactor, GLenum dstfactor)
1808 {
1809 save_BlendFuncSeparateEXT(srcfactor, dstfactor, srcfactor, dstfactor);
1810 }
1811
1812
1813 static void GLAPIENTRY
1814 save_BlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
1815 {
1816 GET_CURRENT_CONTEXT(ctx);
1817 Node *n;
1818 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1819 n = alloc_instruction(ctx, OPCODE_BLEND_COLOR, 4);
1820 if (n) {
1821 n[1].f = red;
1822 n[2].f = green;
1823 n[3].f = blue;
1824 n[4].f = alpha;
1825 }
1826 if (ctx->ExecuteFlag) {
1827 CALL_BlendColor(ctx->Exec, (red, green, blue, alpha));
1828 }
1829 }
1830
1831 /* GL_ARB_draw_buffers_blend */
1832 static void GLAPIENTRY
1833 save_BlendFuncSeparatei(GLuint buf, GLenum sfactorRGB, GLenum dfactorRGB,
1834 GLenum sfactorA, GLenum dfactorA)
1835 {
1836 GET_CURRENT_CONTEXT(ctx);
1837 Node *n;
1838 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1839 n = alloc_instruction(ctx, OPCODE_BLEND_FUNC_SEPARATE_I, 5);
1840 if (n) {
1841 n[1].ui = buf;
1842 n[2].e = sfactorRGB;
1843 n[3].e = dfactorRGB;
1844 n[4].e = sfactorA;
1845 n[5].e = dfactorA;
1846 }
1847 if (ctx->ExecuteFlag) {
1848 CALL_BlendFuncSeparateiARB(ctx->Exec, (buf, sfactorRGB, dfactorRGB,
1849 sfactorA, dfactorA));
1850 }
1851 }
1852
1853 /* GL_ARB_draw_buffers_blend */
1854 static void GLAPIENTRY
1855 save_BlendFunci(GLuint buf, GLenum sfactor, GLenum dfactor)
1856 {
1857 GET_CURRENT_CONTEXT(ctx);
1858 Node *n;
1859 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1860 n = alloc_instruction(ctx, OPCODE_BLEND_FUNC_I, 3);
1861 if (n) {
1862 n[1].ui = buf;
1863 n[2].e = sfactor;
1864 n[3].e = dfactor;
1865 }
1866 if (ctx->ExecuteFlag) {
1867 CALL_BlendFunciARB(ctx->Exec, (buf, sfactor, dfactor));
1868 }
1869 }
1870
1871 /* GL_ARB_draw_buffers_blend */
1872 static void GLAPIENTRY
1873 save_BlendEquationi(GLuint buf, GLenum mode)
1874 {
1875 GET_CURRENT_CONTEXT(ctx);
1876 Node *n;
1877 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1878 n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION_I, 2);
1879 if (n) {
1880 n[1].ui = buf;
1881 n[2].e = mode;
1882 }
1883 if (ctx->ExecuteFlag) {
1884 CALL_BlendEquationiARB(ctx->Exec, (buf, mode));
1885 }
1886 }
1887
1888 /* GL_ARB_draw_buffers_blend */
1889 static void GLAPIENTRY
1890 save_BlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeA)
1891 {
1892 GET_CURRENT_CONTEXT(ctx);
1893 Node *n;
1894 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1895 n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION_SEPARATE_I, 3);
1896 if (n) {
1897 n[1].ui = buf;
1898 n[2].e = modeRGB;
1899 n[3].e = modeA;
1900 }
1901 if (ctx->ExecuteFlag) {
1902 CALL_BlendEquationSeparateiARB(ctx->Exec, (buf, modeRGB, modeA));
1903 }
1904 }
1905
1906
1907 /* GL_ARB_draw_instanced. */
1908 static void GLAPIENTRY
1909 save_DrawArraysInstancedARB(UNUSED GLenum mode,
1910 UNUSED GLint first,
1911 UNUSED GLsizei count,
1912 UNUSED GLsizei primcount)
1913 {
1914 GET_CURRENT_CONTEXT(ctx);
1915 _mesa_error(ctx, GL_INVALID_OPERATION,
1916 "glDrawArraysInstanced() during display list compile");
1917 }
1918
1919 static void GLAPIENTRY
1920 save_DrawElementsInstancedARB(UNUSED GLenum mode,
1921 UNUSED GLsizei count,
1922 UNUSED GLenum type,
1923 UNUSED const GLvoid *indices,
1924 UNUSED GLsizei primcount)
1925 {
1926 GET_CURRENT_CONTEXT(ctx);
1927 _mesa_error(ctx, GL_INVALID_OPERATION,
1928 "glDrawElementsInstanced() during display list compile");
1929 }
1930
1931 static void GLAPIENTRY
1932 save_DrawElementsInstancedBaseVertexARB(UNUSED GLenum mode,
1933 UNUSED GLsizei count,
1934 UNUSED GLenum type,
1935 UNUSED const GLvoid *indices,
1936 UNUSED GLsizei primcount,
1937 UNUSED GLint basevertex)
1938 {
1939 GET_CURRENT_CONTEXT(ctx);
1940 _mesa_error(ctx, GL_INVALID_OPERATION,
1941 "glDrawElementsInstancedBaseVertex() during display list compile");
1942 }
1943
1944 /* GL_ARB_base_instance. */
1945 static void GLAPIENTRY
1946 save_DrawArraysInstancedBaseInstance(UNUSED GLenum mode,
1947 UNUSED GLint first,
1948 UNUSED GLsizei count,
1949 UNUSED GLsizei primcount,
1950 UNUSED GLuint baseinstance)
1951 {
1952 GET_CURRENT_CONTEXT(ctx);
1953 _mesa_error(ctx, GL_INVALID_OPERATION,
1954 "glDrawArraysInstancedBaseInstance() during display list compile");
1955 }
1956
1957 static void APIENTRY
1958 save_DrawElementsInstancedBaseInstance(UNUSED GLenum mode,
1959 UNUSED GLsizei count,
1960 UNUSED GLenum type,
1961 UNUSED const void *indices,
1962 UNUSED GLsizei primcount,
1963 UNUSED GLuint baseinstance)
1964 {
1965 GET_CURRENT_CONTEXT(ctx);
1966 _mesa_error(ctx, GL_INVALID_OPERATION,
1967 "glDrawElementsInstancedBaseInstance() during display list compile");
1968 }
1969
1970 static void APIENTRY
1971 save_DrawElementsInstancedBaseVertexBaseInstance(UNUSED GLenum mode,
1972 UNUSED GLsizei count,
1973 UNUSED GLenum type,
1974 UNUSED const void *indices,
1975 UNUSED GLsizei primcount,
1976 UNUSED GLint basevertex,
1977 UNUSED GLuint baseinstance)
1978 {
1979 GET_CURRENT_CONTEXT(ctx);
1980 _mesa_error(ctx, GL_INVALID_OPERATION,
1981 "glDrawElementsInstancedBaseVertexBaseInstance() during display list compile");
1982 }
1983
1984 static void APIENTRY
1985 save_DrawArraysIndirect(UNUSED GLenum mode,
1986 UNUSED const void *indirect)
1987 {
1988 GET_CURRENT_CONTEXT(ctx);
1989 _mesa_error(ctx, GL_INVALID_OPERATION,
1990 "glDrawArraysIndirect() during display list compile");
1991 }
1992
1993 static void APIENTRY
1994 save_DrawElementsIndirect(UNUSED GLenum mode,
1995 UNUSED GLenum type,
1996 UNUSED const void *indirect)
1997 {
1998 GET_CURRENT_CONTEXT(ctx);
1999 _mesa_error(ctx, GL_INVALID_OPERATION,
2000 "glDrawElementsIndirect() during display list compile");
2001 }
2002
2003 static void APIENTRY
2004 save_MultiDrawArraysIndirect(UNUSED GLenum mode,
2005 UNUSED const void *indirect,
2006 UNUSED GLsizei primcount,
2007 UNUSED GLsizei stride)
2008 {
2009 GET_CURRENT_CONTEXT(ctx);
2010 _mesa_error(ctx, GL_INVALID_OPERATION,
2011 "glMultiDrawArraysIndirect() during display list compile");
2012 }
2013
2014 static void APIENTRY
2015 save_MultiDrawElementsIndirect(UNUSED GLenum mode,
2016 UNUSED GLenum type,
2017 UNUSED const void *indirect,
2018 UNUSED GLsizei primcount,
2019 UNUSED GLsizei stride)
2020 {
2021 GET_CURRENT_CONTEXT(ctx);
2022 _mesa_error(ctx, GL_INVALID_OPERATION,
2023 "glMultiDrawElementsIndirect() during display list compile");
2024 }
2025
2026 /**
2027 * While building a display list we cache some OpenGL state.
2028 * Under some circumstances we need to invalidate that state (immediately
2029 * when we start compiling a list, or after glCallList(s)).
2030 */
2031 static void
2032 invalidate_saved_current_state(struct gl_context *ctx)
2033 {
2034 GLint i;
2035
2036 for (i = 0; i < VERT_ATTRIB_MAX; i++)
2037 ctx->ListState.ActiveAttribSize[i] = 0;
2038
2039 for (i = 0; i < MAT_ATTRIB_MAX; i++)
2040 ctx->ListState.ActiveMaterialSize[i] = 0;
2041
2042 memset(&ctx->ListState.Current, 0, sizeof ctx->ListState.Current);
2043
2044 ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN;
2045 }
2046
2047
2048 static void GLAPIENTRY
2049 save_CallList(GLuint list)
2050 {
2051 GET_CURRENT_CONTEXT(ctx);
2052 Node *n;
2053 SAVE_FLUSH_VERTICES(ctx);
2054
2055 n = alloc_instruction(ctx, OPCODE_CALL_LIST, 1);
2056 if (n) {
2057 n[1].ui = list;
2058 }
2059
2060 /* After this, we don't know what state we're in. Invalidate all
2061 * cached information previously gathered:
2062 */
2063 invalidate_saved_current_state( ctx );
2064
2065 if (ctx->ExecuteFlag) {
2066 _mesa_CallList(list);
2067 }
2068 }
2069
2070
2071 static void GLAPIENTRY
2072 save_CallLists(GLsizei num, GLenum type, const GLvoid * lists)
2073 {
2074 GET_CURRENT_CONTEXT(ctx);
2075 unsigned type_size;
2076 Node *n;
2077 void *lists_copy;
2078
2079 SAVE_FLUSH_VERTICES(ctx);
2080
2081 switch (type) {
2082 case GL_BYTE:
2083 case GL_UNSIGNED_BYTE:
2084 type_size = 1;
2085 break;
2086 case GL_SHORT:
2087 case GL_UNSIGNED_SHORT:
2088 case GL_2_BYTES:
2089 type_size = 2;
2090 break;
2091 case GL_3_BYTES:
2092 type_size = 3;
2093 break;
2094 case GL_INT:
2095 case GL_UNSIGNED_INT:
2096 case GL_FLOAT:
2097 case GL_4_BYTES:
2098 type_size = 4;
2099 break;
2100 default:
2101 type_size = 0;
2102 }
2103
2104 if (num > 0 && type_size > 0) {
2105 /* create a copy of the array of list IDs to save in the display list */
2106 lists_copy = memdup(lists, num * type_size);
2107 } else {
2108 lists_copy = NULL;
2109 }
2110
2111 n = alloc_instruction(ctx, OPCODE_CALL_LISTS, 2 + POINTER_DWORDS);
2112 if (n) {
2113 n[1].i = num;
2114 n[2].e = type;
2115 save_pointer(&n[3], lists_copy);
2116 }
2117
2118 /* After this, we don't know what state we're in. Invalidate all
2119 * cached information previously gathered:
2120 */
2121 invalidate_saved_current_state( ctx );
2122
2123 if (ctx->ExecuteFlag) {
2124 CALL_CallLists(ctx->Exec, (num, type, lists));
2125 }
2126 }
2127
2128
2129 static void GLAPIENTRY
2130 save_Clear(GLbitfield mask)
2131 {
2132 GET_CURRENT_CONTEXT(ctx);
2133 Node *n;
2134 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2135 n = alloc_instruction(ctx, OPCODE_CLEAR, 1);
2136 if (n) {
2137 n[1].bf = mask;
2138 }
2139 if (ctx->ExecuteFlag) {
2140 CALL_Clear(ctx->Exec, (mask));
2141 }
2142 }
2143
2144
2145 static void GLAPIENTRY
2146 save_ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value)
2147 {
2148 GET_CURRENT_CONTEXT(ctx);
2149 Node *n;
2150 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2151 n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_IV, 6);
2152 if (n) {
2153 n[1].e = buffer;
2154 n[2].i = drawbuffer;
2155 n[3].i = value[0];
2156 if (buffer == GL_COLOR) {
2157 n[4].i = value[1];
2158 n[5].i = value[2];
2159 n[6].i = value[3];
2160 }
2161 else {
2162 n[4].i = 0;
2163 n[5].i = 0;
2164 n[6].i = 0;
2165 }
2166 }
2167 if (ctx->ExecuteFlag) {
2168 CALL_ClearBufferiv(ctx->Exec, (buffer, drawbuffer, value));
2169 }
2170 }
2171
2172
2173 static void GLAPIENTRY
2174 save_ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value)
2175 {
2176 GET_CURRENT_CONTEXT(ctx);
2177 Node *n;
2178 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2179 n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_UIV, 6);
2180 if (n) {
2181 n[1].e = buffer;
2182 n[2].i = drawbuffer;
2183 n[3].ui = value[0];
2184 if (buffer == GL_COLOR) {
2185 n[4].ui = value[1];
2186 n[5].ui = value[2];
2187 n[6].ui = value[3];
2188 }
2189 else {
2190 n[4].ui = 0;
2191 n[5].ui = 0;
2192 n[6].ui = 0;
2193 }
2194 }
2195 if (ctx->ExecuteFlag) {
2196 CALL_ClearBufferuiv(ctx->Exec, (buffer, drawbuffer, value));
2197 }
2198 }
2199
2200
2201 static void GLAPIENTRY
2202 save_ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
2203 {
2204 GET_CURRENT_CONTEXT(ctx);
2205 Node *n;
2206 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2207 n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_FV, 6);
2208 if (n) {
2209 n[1].e = buffer;
2210 n[2].i = drawbuffer;
2211 n[3].f = value[0];
2212 if (buffer == GL_COLOR) {
2213 n[4].f = value[1];
2214 n[5].f = value[2];
2215 n[6].f = value[3];
2216 }
2217 else {
2218 n[4].f = 0.0F;
2219 n[5].f = 0.0F;
2220 n[6].f = 0.0F;
2221 }
2222 }
2223 if (ctx->ExecuteFlag) {
2224 CALL_ClearBufferfv(ctx->Exec, (buffer, drawbuffer, value));
2225 }
2226 }
2227
2228
2229 static void GLAPIENTRY
2230 save_ClearBufferfi(GLenum buffer, GLint drawbuffer,
2231 GLfloat depth, GLint stencil)
2232 {
2233 GET_CURRENT_CONTEXT(ctx);
2234 Node *n;
2235 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2236 n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_FI, 4);
2237 if (n) {
2238 n[1].e = buffer;
2239 n[2].i = drawbuffer;
2240 n[3].f = depth;
2241 n[4].i = stencil;
2242 }
2243 if (ctx->ExecuteFlag) {
2244 CALL_ClearBufferfi(ctx->Exec, (buffer, drawbuffer, depth, stencil));
2245 }
2246 }
2247
2248
2249 static void GLAPIENTRY
2250 save_ClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
2251 {
2252 GET_CURRENT_CONTEXT(ctx);
2253 Node *n;
2254 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2255 n = alloc_instruction(ctx, OPCODE_CLEAR_ACCUM, 4);
2256 if (n) {
2257 n[1].f = red;
2258 n[2].f = green;
2259 n[3].f = blue;
2260 n[4].f = alpha;
2261 }
2262 if (ctx->ExecuteFlag) {
2263 CALL_ClearAccum(ctx->Exec, (red, green, blue, alpha));
2264 }
2265 }
2266
2267
2268 static void GLAPIENTRY
2269 save_ClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
2270 {
2271 GET_CURRENT_CONTEXT(ctx);
2272 Node *n;
2273 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2274 n = alloc_instruction(ctx, OPCODE_CLEAR_COLOR, 4);
2275 if (n) {
2276 n[1].f = red;
2277 n[2].f = green;
2278 n[3].f = blue;
2279 n[4].f = alpha;
2280 }
2281 if (ctx->ExecuteFlag) {
2282 CALL_ClearColor(ctx->Exec, (red, green, blue, alpha));
2283 }
2284 }
2285
2286
2287 static void GLAPIENTRY
2288 save_ClearDepth(GLclampd depth)
2289 {
2290 GET_CURRENT_CONTEXT(ctx);
2291 Node *n;
2292 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2293 n = alloc_instruction(ctx, OPCODE_CLEAR_DEPTH, 1);
2294 if (n) {
2295 n[1].f = (GLfloat) depth;
2296 }
2297 if (ctx->ExecuteFlag) {
2298 CALL_ClearDepth(ctx->Exec, (depth));
2299 }
2300 }
2301
2302
2303 static void GLAPIENTRY
2304 save_ClearIndex(GLfloat c)
2305 {
2306 GET_CURRENT_CONTEXT(ctx);
2307 Node *n;
2308 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2309 n = alloc_instruction(ctx, OPCODE_CLEAR_INDEX, 1);
2310 if (n) {
2311 n[1].f = c;
2312 }
2313 if (ctx->ExecuteFlag) {
2314 CALL_ClearIndex(ctx->Exec, (c));
2315 }
2316 }
2317
2318
2319 static void GLAPIENTRY
2320 save_ClearStencil(GLint s)
2321 {
2322 GET_CURRENT_CONTEXT(ctx);
2323 Node *n;
2324 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2325 n = alloc_instruction(ctx, OPCODE_CLEAR_STENCIL, 1);
2326 if (n) {
2327 n[1].i = s;
2328 }
2329 if (ctx->ExecuteFlag) {
2330 CALL_ClearStencil(ctx->Exec, (s));
2331 }
2332 }
2333
2334
2335 static void GLAPIENTRY
2336 save_ClipPlane(GLenum plane, const GLdouble * equ)
2337 {
2338 GET_CURRENT_CONTEXT(ctx);
2339 Node *n;
2340 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2341 n = alloc_instruction(ctx, OPCODE_CLIP_PLANE, 5);
2342 if (n) {
2343 n[1].e = plane;
2344 n[2].f = (GLfloat) equ[0];
2345 n[3].f = (GLfloat) equ[1];
2346 n[4].f = (GLfloat) equ[2];
2347 n[5].f = (GLfloat) equ[3];
2348 }
2349 if (ctx->ExecuteFlag) {
2350 CALL_ClipPlane(ctx->Exec, (plane, equ));
2351 }
2352 }
2353
2354
2355
2356 static void GLAPIENTRY
2357 save_ColorMask(GLboolean red, GLboolean green,
2358 GLboolean blue, GLboolean alpha)
2359 {
2360 GET_CURRENT_CONTEXT(ctx);
2361 Node *n;
2362 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2363 n = alloc_instruction(ctx, OPCODE_COLOR_MASK, 4);
2364 if (n) {
2365 n[1].b = red;
2366 n[2].b = green;
2367 n[3].b = blue;
2368 n[4].b = alpha;
2369 }
2370 if (ctx->ExecuteFlag) {
2371 CALL_ColorMask(ctx->Exec, (red, green, blue, alpha));
2372 }
2373 }
2374
2375
2376 static void GLAPIENTRY
2377 save_ColorMaskIndexed(GLuint buf, GLboolean red, GLboolean green,
2378 GLboolean blue, GLboolean alpha)
2379 {
2380 GET_CURRENT_CONTEXT(ctx);
2381 Node *n;
2382 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2383 n = alloc_instruction(ctx, OPCODE_COLOR_MASK_INDEXED, 5);
2384 if (n) {
2385 n[1].ui = buf;
2386 n[2].b = red;
2387 n[3].b = green;
2388 n[4].b = blue;
2389 n[5].b = alpha;
2390 }
2391 if (ctx->ExecuteFlag) {
2392 /*CALL_ColorMaski(ctx->Exec, (buf, red, green, blue, alpha));*/
2393 }
2394 }
2395
2396
2397 static void GLAPIENTRY
2398 save_ColorMaterial(GLenum face, GLenum mode)
2399 {
2400 GET_CURRENT_CONTEXT(ctx);
2401 Node *n;
2402 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2403
2404 n = alloc_instruction(ctx, OPCODE_COLOR_MATERIAL, 2);
2405 if (n) {
2406 n[1].e = face;
2407 n[2].e = mode;
2408 }
2409 if (ctx->ExecuteFlag) {
2410 CALL_ColorMaterial(ctx->Exec, (face, mode));
2411 }
2412 }
2413
2414
2415 static void GLAPIENTRY
2416 save_CopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type)
2417 {
2418 GET_CURRENT_CONTEXT(ctx);
2419 Node *n;
2420 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2421 n = alloc_instruction(ctx, OPCODE_COPY_PIXELS, 5);
2422 if (n) {
2423 n[1].i = x;
2424 n[2].i = y;
2425 n[3].i = (GLint) width;
2426 n[4].i = (GLint) height;
2427 n[5].e = type;
2428 }
2429 if (ctx->ExecuteFlag) {
2430 CALL_CopyPixels(ctx->Exec, (x, y, width, height, type));
2431 }
2432 }
2433
2434
2435
2436 static void GLAPIENTRY
2437 save_CopyTexImage1D(GLenum target, GLint level, GLenum internalformat,
2438 GLint x, GLint y, GLsizei width, GLint border)
2439 {
2440 GET_CURRENT_CONTEXT(ctx);
2441 Node *n;
2442 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2443 n = alloc_instruction(ctx, OPCODE_COPY_TEX_IMAGE1D, 7);
2444 if (n) {
2445 n[1].e = target;
2446 n[2].i = level;
2447 n[3].e = internalformat;
2448 n[4].i = x;
2449 n[5].i = y;
2450 n[6].i = width;
2451 n[7].i = border;
2452 }
2453 if (ctx->ExecuteFlag) {
2454 CALL_CopyTexImage1D(ctx->Exec, (target, level, internalformat,
2455 x, y, width, border));
2456 }
2457 }
2458
2459
2460 static void GLAPIENTRY
2461 save_CopyTexImage2D(GLenum target, GLint level,
2462 GLenum internalformat,
2463 GLint x, GLint y, GLsizei width,
2464 GLsizei height, GLint border)
2465 {
2466 GET_CURRENT_CONTEXT(ctx);
2467 Node *n;
2468 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2469 n = alloc_instruction(ctx, OPCODE_COPY_TEX_IMAGE2D, 8);
2470 if (n) {
2471 n[1].e = target;
2472 n[2].i = level;
2473 n[3].e = internalformat;
2474 n[4].i = x;
2475 n[5].i = y;
2476 n[6].i = width;
2477 n[7].i = height;
2478 n[8].i = border;
2479 }
2480 if (ctx->ExecuteFlag) {
2481 CALL_CopyTexImage2D(ctx->Exec, (target, level, internalformat,
2482 x, y, width, height, border));
2483 }
2484 }
2485
2486
2487
2488 static void GLAPIENTRY
2489 save_CopyTexSubImage1D(GLenum target, GLint level,
2490 GLint xoffset, GLint x, GLint y, GLsizei width)
2491 {
2492 GET_CURRENT_CONTEXT(ctx);
2493 Node *n;
2494 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2495 n = alloc_instruction(ctx, OPCODE_COPY_TEX_SUB_IMAGE1D, 6);
2496 if (n) {
2497 n[1].e = target;
2498 n[2].i = level;
2499 n[3].i = xoffset;
2500 n[4].i = x;
2501 n[5].i = y;
2502 n[6].i = width;
2503 }
2504 if (ctx->ExecuteFlag) {
2505 CALL_CopyTexSubImage1D(ctx->Exec,
2506 (target, level, xoffset, x, y, width));
2507 }
2508 }
2509
2510
2511 static void GLAPIENTRY
2512 save_CopyTexSubImage2D(GLenum target, GLint level,
2513 GLint xoffset, GLint yoffset,
2514 GLint x, GLint y, GLsizei width, GLint height)
2515 {
2516 GET_CURRENT_CONTEXT(ctx);
2517 Node *n;
2518 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2519 n = alloc_instruction(ctx, OPCODE_COPY_TEX_SUB_IMAGE2D, 8);
2520 if (n) {
2521 n[1].e = target;
2522 n[2].i = level;
2523 n[3].i = xoffset;
2524 n[4].i = yoffset;
2525 n[5].i = x;
2526 n[6].i = y;
2527 n[7].i = width;
2528 n[8].i = height;
2529 }
2530 if (ctx->ExecuteFlag) {
2531 CALL_CopyTexSubImage2D(ctx->Exec, (target, level, xoffset, yoffset,
2532 x, y, width, height));
2533 }
2534 }
2535
2536
2537 static void GLAPIENTRY
2538 save_CopyTexSubImage3D(GLenum target, GLint level,
2539 GLint xoffset, GLint yoffset, GLint zoffset,
2540 GLint x, GLint y, GLsizei width, GLint height)
2541 {
2542 GET_CURRENT_CONTEXT(ctx);
2543 Node *n;
2544 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2545 n = alloc_instruction(ctx, OPCODE_COPY_TEX_SUB_IMAGE3D, 9);
2546 if (n) {
2547 n[1].e = target;
2548 n[2].i = level;
2549 n[3].i = xoffset;
2550 n[4].i = yoffset;
2551 n[5].i = zoffset;
2552 n[6].i = x;
2553 n[7].i = y;
2554 n[8].i = width;
2555 n[9].i = height;
2556 }
2557 if (ctx->ExecuteFlag) {
2558 CALL_CopyTexSubImage3D(ctx->Exec, (target, level,
2559 xoffset, yoffset, zoffset,
2560 x, y, width, height));
2561 }
2562 }
2563
2564
2565 static void GLAPIENTRY
2566 save_CullFace(GLenum mode)
2567 {
2568 GET_CURRENT_CONTEXT(ctx);
2569 Node *n;
2570 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2571 n = alloc_instruction(ctx, OPCODE_CULL_FACE, 1);
2572 if (n) {
2573 n[1].e = mode;
2574 }
2575 if (ctx->ExecuteFlag) {
2576 CALL_CullFace(ctx->Exec, (mode));
2577 }
2578 }
2579
2580
2581 static void GLAPIENTRY
2582 save_DepthFunc(GLenum func)
2583 {
2584 GET_CURRENT_CONTEXT(ctx);
2585 Node *n;
2586 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2587 n = alloc_instruction(ctx, OPCODE_DEPTH_FUNC, 1);
2588 if (n) {
2589 n[1].e = func;
2590 }
2591 if (ctx->ExecuteFlag) {
2592 CALL_DepthFunc(ctx->Exec, (func));
2593 }
2594 }
2595
2596
2597 static void GLAPIENTRY
2598 save_DepthMask(GLboolean mask)
2599 {
2600 GET_CURRENT_CONTEXT(ctx);
2601 Node *n;
2602 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2603 n = alloc_instruction(ctx, OPCODE_DEPTH_MASK, 1);
2604 if (n) {
2605 n[1].b = mask;
2606 }
2607 if (ctx->ExecuteFlag) {
2608 CALL_DepthMask(ctx->Exec, (mask));
2609 }
2610 }
2611
2612
2613 static void GLAPIENTRY
2614 save_DepthRange(GLclampd nearval, GLclampd farval)
2615 {
2616 GET_CURRENT_CONTEXT(ctx);
2617 Node *n;
2618 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2619 n = alloc_instruction(ctx, OPCODE_DEPTH_RANGE, 2);
2620 if (n) {
2621 n[1].f = (GLfloat) nearval;
2622 n[2].f = (GLfloat) farval;
2623 }
2624 if (ctx->ExecuteFlag) {
2625 CALL_DepthRange(ctx->Exec, (nearval, farval));
2626 }
2627 }
2628
2629
2630 static void GLAPIENTRY
2631 save_Disable(GLenum cap)
2632 {
2633 GET_CURRENT_CONTEXT(ctx);
2634 Node *n;
2635 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2636 n = alloc_instruction(ctx, OPCODE_DISABLE, 1);
2637 if (n) {
2638 n[1].e = cap;
2639 }
2640 if (ctx->ExecuteFlag) {
2641 CALL_Disable(ctx->Exec, (cap));
2642 }
2643 }
2644
2645
2646 static void GLAPIENTRY
2647 save_DisableIndexed(GLuint index, GLenum cap)
2648 {
2649 GET_CURRENT_CONTEXT(ctx);
2650 Node *n;
2651 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2652 n = alloc_instruction(ctx, OPCODE_DISABLE_INDEXED, 2);
2653 if (n) {
2654 n[1].ui = index;
2655 n[2].e = cap;
2656 }
2657 if (ctx->ExecuteFlag) {
2658 CALL_Disablei(ctx->Exec, (index, cap));
2659 }
2660 }
2661
2662
2663 static void GLAPIENTRY
2664 save_DrawBuffer(GLenum mode)
2665 {
2666 GET_CURRENT_CONTEXT(ctx);
2667 Node *n;
2668 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2669 n = alloc_instruction(ctx, OPCODE_DRAW_BUFFER, 1);
2670 if (n) {
2671 n[1].e = mode;
2672 }
2673 if (ctx->ExecuteFlag) {
2674 CALL_DrawBuffer(ctx->Exec, (mode));
2675 }
2676 }
2677
2678
2679 static void GLAPIENTRY
2680 save_DrawPixels(GLsizei width, GLsizei height,
2681 GLenum format, GLenum type, const GLvoid * pixels)
2682 {
2683 GET_CURRENT_CONTEXT(ctx);
2684 Node *n;
2685
2686 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2687
2688 n = alloc_instruction(ctx, OPCODE_DRAW_PIXELS, 4 + POINTER_DWORDS);
2689 if (n) {
2690 n[1].i = width;
2691 n[2].i = height;
2692 n[3].e = format;
2693 n[4].e = type;
2694 save_pointer(&n[5],
2695 unpack_image(ctx, 2, width, height, 1, format, type,
2696 pixels, &ctx->Unpack));
2697 }
2698 if (ctx->ExecuteFlag) {
2699 CALL_DrawPixels(ctx->Exec, (width, height, format, type, pixels));
2700 }
2701 }
2702
2703
2704
2705 static void GLAPIENTRY
2706 save_Enable(GLenum cap)
2707 {
2708 GET_CURRENT_CONTEXT(ctx);
2709 Node *n;
2710 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2711 n = alloc_instruction(ctx, OPCODE_ENABLE, 1);
2712 if (n) {
2713 n[1].e = cap;
2714 }
2715 if (ctx->ExecuteFlag) {
2716 CALL_Enable(ctx->Exec, (cap));
2717 }
2718 }
2719
2720
2721
2722 static void GLAPIENTRY
2723 save_EnableIndexed(GLuint index, GLenum cap)
2724 {
2725 GET_CURRENT_CONTEXT(ctx);
2726 Node *n;
2727 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2728 n = alloc_instruction(ctx, OPCODE_ENABLE_INDEXED, 2);
2729 if (n) {
2730 n[1].ui = index;
2731 n[2].e = cap;
2732 }
2733 if (ctx->ExecuteFlag) {
2734 CALL_Enablei(ctx->Exec, (index, cap));
2735 }
2736 }
2737
2738
2739
2740 static void GLAPIENTRY
2741 save_EvalMesh1(GLenum mode, GLint i1, GLint i2)
2742 {
2743 GET_CURRENT_CONTEXT(ctx);
2744 Node *n;
2745 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2746 n = alloc_instruction(ctx, OPCODE_EVALMESH1, 3);
2747 if (n) {
2748 n[1].e = mode;
2749 n[2].i = i1;
2750 n[3].i = i2;
2751 }
2752 if (ctx->ExecuteFlag) {
2753 CALL_EvalMesh1(ctx->Exec, (mode, i1, i2));
2754 }
2755 }
2756
2757
2758 static void GLAPIENTRY
2759 save_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)
2760 {
2761 GET_CURRENT_CONTEXT(ctx);
2762 Node *n;
2763 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2764 n = alloc_instruction(ctx, OPCODE_EVALMESH2, 5);
2765 if (n) {
2766 n[1].e = mode;
2767 n[2].i = i1;
2768 n[3].i = i2;
2769 n[4].i = j1;
2770 n[5].i = j2;
2771 }
2772 if (ctx->ExecuteFlag) {
2773 CALL_EvalMesh2(ctx->Exec, (mode, i1, i2, j1, j2));
2774 }
2775 }
2776
2777
2778
2779
2780 static void GLAPIENTRY
2781 save_Fogfv(GLenum pname, const GLfloat *params)
2782 {
2783 GET_CURRENT_CONTEXT(ctx);
2784 Node *n;
2785 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2786 n = alloc_instruction(ctx, OPCODE_FOG, 5);
2787 if (n) {
2788 n[1].e = pname;
2789 n[2].f = params[0];
2790 n[3].f = params[1];
2791 n[4].f = params[2];
2792 n[5].f = params[3];
2793 }
2794 if (ctx->ExecuteFlag) {
2795 CALL_Fogfv(ctx->Exec, (pname, params));
2796 }
2797 }
2798
2799
2800 static void GLAPIENTRY
2801 save_Fogf(GLenum pname, GLfloat param)
2802 {
2803 GLfloat parray[4];
2804 parray[0] = param;
2805 parray[1] = parray[2] = parray[3] = 0.0F;
2806 save_Fogfv(pname, parray);
2807 }
2808
2809
2810 static void GLAPIENTRY
2811 save_Fogiv(GLenum pname, const GLint *params)
2812 {
2813 GLfloat p[4];
2814 switch (pname) {
2815 case GL_FOG_MODE:
2816 case GL_FOG_DENSITY:
2817 case GL_FOG_START:
2818 case GL_FOG_END:
2819 case GL_FOG_INDEX:
2820 case GL_FOG_COORDINATE_SOURCE:
2821 p[0] = (GLfloat) *params;
2822 p[1] = 0.0f;
2823 p[2] = 0.0f;
2824 p[3] = 0.0f;
2825 break;
2826 case GL_FOG_COLOR:
2827 p[0] = INT_TO_FLOAT(params[0]);
2828 p[1] = INT_TO_FLOAT(params[1]);
2829 p[2] = INT_TO_FLOAT(params[2]);
2830 p[3] = INT_TO_FLOAT(params[3]);
2831 break;
2832 default:
2833 /* Error will be caught later in gl_Fogfv */
2834 ASSIGN_4V(p, 0.0F, 0.0F, 0.0F, 0.0F);
2835 }
2836 save_Fogfv(pname, p);
2837 }
2838
2839
2840 static void GLAPIENTRY
2841 save_Fogi(GLenum pname, GLint param)
2842 {
2843 GLint parray[4];
2844 parray[0] = param;
2845 parray[1] = parray[2] = parray[3] = 0;
2846 save_Fogiv(pname, parray);
2847 }
2848
2849
2850 static void GLAPIENTRY
2851 save_FrontFace(GLenum mode)
2852 {
2853 GET_CURRENT_CONTEXT(ctx);
2854 Node *n;
2855 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2856 n = alloc_instruction(ctx, OPCODE_FRONT_FACE, 1);
2857 if (n) {
2858 n[1].e = mode;
2859 }
2860 if (ctx->ExecuteFlag) {
2861 CALL_FrontFace(ctx->Exec, (mode));
2862 }
2863 }
2864
2865
2866 static void GLAPIENTRY
2867 save_Frustum(GLdouble left, GLdouble right,
2868 GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval)
2869 {
2870 GET_CURRENT_CONTEXT(ctx);
2871 Node *n;
2872 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2873 n = alloc_instruction(ctx, OPCODE_FRUSTUM, 6);
2874 if (n) {
2875 n[1].f = (GLfloat) left;
2876 n[2].f = (GLfloat) right;
2877 n[3].f = (GLfloat) bottom;
2878 n[4].f = (GLfloat) top;
2879 n[5].f = (GLfloat) nearval;
2880 n[6].f = (GLfloat) farval;
2881 }
2882 if (ctx->ExecuteFlag) {
2883 CALL_Frustum(ctx->Exec, (left, right, bottom, top, nearval, farval));
2884 }
2885 }
2886
2887
2888 static void GLAPIENTRY
2889 save_Hint(GLenum target, GLenum mode)
2890 {
2891 GET_CURRENT_CONTEXT(ctx);
2892 Node *n;
2893 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2894 n = alloc_instruction(ctx, OPCODE_HINT, 2);
2895 if (n) {
2896 n[1].e = target;
2897 n[2].e = mode;
2898 }
2899 if (ctx->ExecuteFlag) {
2900 CALL_Hint(ctx->Exec, (target, mode));
2901 }
2902 }
2903
2904
2905 static void GLAPIENTRY
2906 save_IndexMask(GLuint mask)
2907 {
2908 GET_CURRENT_CONTEXT(ctx);
2909 Node *n;
2910 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2911 n = alloc_instruction(ctx, OPCODE_INDEX_MASK, 1);
2912 if (n) {
2913 n[1].ui = mask;
2914 }
2915 if (ctx->ExecuteFlag) {
2916 CALL_IndexMask(ctx->Exec, (mask));
2917 }
2918 }
2919
2920
2921 static void GLAPIENTRY
2922 save_InitNames(void)
2923 {
2924 GET_CURRENT_CONTEXT(ctx);
2925 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2926 (void) alloc_instruction(ctx, OPCODE_INIT_NAMES, 0);
2927 if (ctx->ExecuteFlag) {
2928 CALL_InitNames(ctx->Exec, ());
2929 }
2930 }
2931
2932
2933 static void GLAPIENTRY
2934 save_Lightfv(GLenum light, GLenum pname, const GLfloat *params)
2935 {
2936 GET_CURRENT_CONTEXT(ctx);
2937 Node *n;
2938 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2939 n = alloc_instruction(ctx, OPCODE_LIGHT, 6);
2940 if (n) {
2941 GLint i, nParams;
2942 n[1].e = light;
2943 n[2].e = pname;
2944 switch (pname) {
2945 case GL_AMBIENT:
2946 nParams = 4;
2947 break;
2948 case GL_DIFFUSE:
2949 nParams = 4;
2950 break;
2951 case GL_SPECULAR:
2952 nParams = 4;
2953 break;
2954 case GL_POSITION:
2955 nParams = 4;
2956 break;
2957 case GL_SPOT_DIRECTION:
2958 nParams = 3;
2959 break;
2960 case GL_SPOT_EXPONENT:
2961 nParams = 1;
2962 break;
2963 case GL_SPOT_CUTOFF:
2964 nParams = 1;
2965 break;
2966 case GL_CONSTANT_ATTENUATION:
2967 nParams = 1;
2968 break;
2969 case GL_LINEAR_ATTENUATION:
2970 nParams = 1;
2971 break;
2972 case GL_QUADRATIC_ATTENUATION:
2973 nParams = 1;
2974 break;
2975 default:
2976 nParams = 0;
2977 }
2978 for (i = 0; i < nParams; i++) {
2979 n[3 + i].f = params[i];
2980 }
2981 }
2982 if (ctx->ExecuteFlag) {
2983 CALL_Lightfv(ctx->Exec, (light, pname, params));
2984 }
2985 }
2986
2987
2988 static void GLAPIENTRY
2989 save_Lightf(GLenum light, GLenum pname, GLfloat param)
2990 {
2991 GLfloat parray[4];
2992 parray[0] = param;
2993 parray[1] = parray[2] = parray[3] = 0.0F;
2994 save_Lightfv(light, pname, parray);
2995 }
2996
2997
2998 static void GLAPIENTRY
2999 save_Lightiv(GLenum light, GLenum pname, const GLint *params)
3000 {
3001 GLfloat fparam[4];
3002 switch (pname) {
3003 case GL_AMBIENT:
3004 case GL_DIFFUSE:
3005 case GL_SPECULAR:
3006 fparam[0] = INT_TO_FLOAT(params[0]);
3007 fparam[1] = INT_TO_FLOAT(params[1]);
3008 fparam[2] = INT_TO_FLOAT(params[2]);
3009 fparam[3] = INT_TO_FLOAT(params[3]);
3010 break;
3011 case GL_POSITION:
3012 fparam[0] = (GLfloat) params[0];
3013 fparam[1] = (GLfloat) params[1];
3014 fparam[2] = (GLfloat) params[2];
3015 fparam[3] = (GLfloat) params[3];
3016 break;
3017 case GL_SPOT_DIRECTION:
3018 fparam[0] = (GLfloat) params[0];
3019 fparam[1] = (GLfloat) params[1];
3020 fparam[2] = (GLfloat) params[2];
3021 break;
3022 case GL_SPOT_EXPONENT:
3023 case GL_SPOT_CUTOFF:
3024 case GL_CONSTANT_ATTENUATION:
3025 case GL_LINEAR_ATTENUATION:
3026 case GL_QUADRATIC_ATTENUATION:
3027 fparam[0] = (GLfloat) params[0];
3028 break;
3029 default:
3030 /* error will be caught later in gl_Lightfv */
3031 ;
3032 }
3033 save_Lightfv(light, pname, fparam);
3034 }
3035
3036
3037 static void GLAPIENTRY
3038 save_Lighti(GLenum light, GLenum pname, GLint param)
3039 {
3040 GLint parray[4];
3041 parray[0] = param;
3042 parray[1] = parray[2] = parray[3] = 0;
3043 save_Lightiv(light, pname, parray);
3044 }
3045
3046
3047 static void GLAPIENTRY
3048 save_LightModelfv(GLenum pname, const GLfloat *params)
3049 {
3050 GET_CURRENT_CONTEXT(ctx);
3051 Node *n;
3052 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3053 n = alloc_instruction(ctx, OPCODE_LIGHT_MODEL, 5);
3054 if (n) {
3055 n[1].e = pname;
3056 n[2].f = params[0];
3057 n[3].f = params[1];
3058 n[4].f = params[2];
3059 n[5].f = params[3];
3060 }
3061 if (ctx->ExecuteFlag) {
3062 CALL_LightModelfv(ctx->Exec, (pname, params));
3063 }
3064 }
3065
3066
3067 static void GLAPIENTRY
3068 save_LightModelf(GLenum pname, GLfloat param)
3069 {
3070 GLfloat parray[4];
3071 parray[0] = param;
3072 parray[1] = parray[2] = parray[3] = 0.0F;
3073 save_LightModelfv(pname, parray);
3074 }
3075
3076
3077 static void GLAPIENTRY
3078 save_LightModeliv(GLenum pname, const GLint *params)
3079 {
3080 GLfloat fparam[4];
3081 switch (pname) {
3082 case GL_LIGHT_MODEL_AMBIENT:
3083 fparam[0] = INT_TO_FLOAT(params[0]);
3084 fparam[1] = INT_TO_FLOAT(params[1]);
3085 fparam[2] = INT_TO_FLOAT(params[2]);
3086 fparam[3] = INT_TO_FLOAT(params[3]);
3087 break;
3088 case GL_LIGHT_MODEL_LOCAL_VIEWER:
3089 case GL_LIGHT_MODEL_TWO_SIDE:
3090 case GL_LIGHT_MODEL_COLOR_CONTROL:
3091 fparam[0] = (GLfloat) params[0];
3092 fparam[1] = 0.0F;
3093 fparam[2] = 0.0F;
3094 fparam[3] = 0.0F;
3095 break;
3096 default:
3097 /* Error will be caught later in gl_LightModelfv */
3098 ASSIGN_4V(fparam, 0.0F, 0.0F, 0.0F, 0.0F);
3099 }
3100 save_LightModelfv(pname, fparam);
3101 }
3102
3103
3104 static void GLAPIENTRY
3105 save_LightModeli(GLenum pname, GLint param)
3106 {
3107 GLint parray[4];
3108 parray[0] = param;
3109 parray[1] = parray[2] = parray[3] = 0;
3110 save_LightModeliv(pname, parray);
3111 }
3112
3113
3114 static void GLAPIENTRY
3115 save_LineStipple(GLint factor, GLushort pattern)
3116 {
3117 GET_CURRENT_CONTEXT(ctx);
3118 Node *n;
3119 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3120 n = alloc_instruction(ctx, OPCODE_LINE_STIPPLE, 2);
3121 if (n) {
3122 n[1].i = factor;
3123 n[2].us = pattern;
3124 }
3125 if (ctx->ExecuteFlag) {
3126 CALL_LineStipple(ctx->Exec, (factor, pattern));
3127 }
3128 }
3129
3130
3131 static void GLAPIENTRY
3132 save_LineWidth(GLfloat width)
3133 {
3134 GET_CURRENT_CONTEXT(ctx);
3135 Node *n;
3136 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3137 n = alloc_instruction(ctx, OPCODE_LINE_WIDTH, 1);
3138 if (n) {
3139 n[1].f = width;
3140 }
3141 if (ctx->ExecuteFlag) {
3142 CALL_LineWidth(ctx->Exec, (width));
3143 }
3144 }
3145
3146
3147 static void GLAPIENTRY
3148 save_ListBase(GLuint base)
3149 {
3150 GET_CURRENT_CONTEXT(ctx);
3151 Node *n;
3152 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3153 n = alloc_instruction(ctx, OPCODE_LIST_BASE, 1);
3154 if (n) {
3155 n[1].ui = base;
3156 }
3157 if (ctx->ExecuteFlag) {
3158 CALL_ListBase(ctx->Exec, (base));
3159 }
3160 }
3161
3162
3163 static void GLAPIENTRY
3164 save_LoadIdentity(void)
3165 {
3166 GET_CURRENT_CONTEXT(ctx);
3167 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3168 (void) alloc_instruction(ctx, OPCODE_LOAD_IDENTITY, 0);
3169 if (ctx->ExecuteFlag) {
3170 CALL_LoadIdentity(ctx->Exec, ());
3171 }
3172 }
3173
3174
3175 static void GLAPIENTRY
3176 save_LoadMatrixf(const GLfloat * m)
3177 {
3178 GET_CURRENT_CONTEXT(ctx);
3179 Node *n;
3180 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3181 n = alloc_instruction(ctx, OPCODE_LOAD_MATRIX, 16);
3182 if (n) {
3183 GLuint i;
3184 for (i = 0; i < 16; i++) {
3185 n[1 + i].f = m[i];
3186 }
3187 }
3188 if (ctx->ExecuteFlag) {
3189 CALL_LoadMatrixf(ctx->Exec, (m));
3190 }
3191 }
3192
3193
3194 static void GLAPIENTRY
3195 save_LoadMatrixd(const GLdouble * m)
3196 {
3197 GLfloat f[16];
3198 GLint i;
3199 for (i = 0; i < 16; i++) {
3200 f[i] = (GLfloat) m[i];
3201 }
3202 save_LoadMatrixf(f);
3203 }
3204
3205
3206 static void GLAPIENTRY
3207 save_LoadName(GLuint name)
3208 {
3209 GET_CURRENT_CONTEXT(ctx);
3210 Node *n;
3211 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3212 n = alloc_instruction(ctx, OPCODE_LOAD_NAME, 1);
3213 if (n) {
3214 n[1].ui = name;
3215 }
3216 if (ctx->ExecuteFlag) {
3217 CALL_LoadName(ctx->Exec, (name));
3218 }
3219 }
3220
3221
3222 static void GLAPIENTRY
3223 save_LogicOp(GLenum opcode)
3224 {
3225 GET_CURRENT_CONTEXT(ctx);
3226 Node *n;
3227 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3228 n = alloc_instruction(ctx, OPCODE_LOGIC_OP, 1);
3229 if (n) {
3230 n[1].e = opcode;
3231 }
3232 if (ctx->ExecuteFlag) {
3233 CALL_LogicOp(ctx->Exec, (opcode));
3234 }
3235 }
3236
3237
3238 static void GLAPIENTRY
3239 save_Map1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride,
3240 GLint order, const GLdouble * points)
3241 {
3242 GET_CURRENT_CONTEXT(ctx);
3243 Node *n;
3244 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3245 n = alloc_instruction(ctx, OPCODE_MAP1, 5 + POINTER_DWORDS);
3246 if (n) {
3247 GLfloat *pnts = _mesa_copy_map_points1d(target, stride, order, points);
3248 n[1].e = target;
3249 n[2].f = (GLfloat) u1;
3250 n[3].f = (GLfloat) u2;
3251 n[4].i = _mesa_evaluator_components(target); /* stride */
3252 n[5].i = order;
3253 save_pointer(&n[6], pnts);
3254 }
3255 if (ctx->ExecuteFlag) {
3256 CALL_Map1d(ctx->Exec, (target, u1, u2, stride, order, points));
3257 }
3258 }
3259
3260 static void GLAPIENTRY
3261 save_Map1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride,
3262 GLint order, const GLfloat * points)
3263 {
3264 GET_CURRENT_CONTEXT(ctx);
3265 Node *n;
3266 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3267 n = alloc_instruction(ctx, OPCODE_MAP1, 5 + POINTER_DWORDS);
3268 if (n) {
3269 GLfloat *pnts = _mesa_copy_map_points1f(target, stride, order, points);
3270 n[1].e = target;
3271 n[2].f = u1;
3272 n[3].f = u2;
3273 n[4].i = _mesa_evaluator_components(target); /* stride */
3274 n[5].i = order;
3275 save_pointer(&n[6], pnts);
3276 }
3277 if (ctx->ExecuteFlag) {
3278 CALL_Map1f(ctx->Exec, (target, u1, u2, stride, order, points));
3279 }
3280 }
3281
3282
3283 static void GLAPIENTRY
3284 save_Map2d(GLenum target,
3285 GLdouble u1, GLdouble u2, GLint ustride, GLint uorder,
3286 GLdouble v1, GLdouble v2, GLint vstride, GLint vorder,
3287 const GLdouble * points)
3288 {
3289 GET_CURRENT_CONTEXT(ctx);
3290 Node *n;
3291 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3292 n = alloc_instruction(ctx, OPCODE_MAP2, 9 + POINTER_DWORDS);
3293 if (n) {
3294 GLfloat *pnts = _mesa_copy_map_points2d(target, ustride, uorder,
3295 vstride, vorder, points);
3296 n[1].e = target;
3297 n[2].f = (GLfloat) u1;
3298 n[3].f = (GLfloat) u2;
3299 n[4].f = (GLfloat) v1;
3300 n[5].f = (GLfloat) v2;
3301 /* XXX verify these strides are correct */
3302 n[6].i = _mesa_evaluator_components(target) * vorder; /*ustride */
3303 n[7].i = _mesa_evaluator_components(target); /*vstride */
3304 n[8].i = uorder;
3305 n[9].i = vorder;
3306 save_pointer(&n[10], pnts);
3307 }
3308 if (ctx->ExecuteFlag) {
3309 CALL_Map2d(ctx->Exec, (target,
3310 u1, u2, ustride, uorder,
3311 v1, v2, vstride, vorder, points));
3312 }
3313 }
3314
3315
3316 static void GLAPIENTRY
3317 save_Map2f(GLenum target,
3318 GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
3319 GLfloat v1, GLfloat v2, GLint vstride, GLint vorder,
3320 const GLfloat * points)
3321 {
3322 GET_CURRENT_CONTEXT(ctx);
3323 Node *n;
3324 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3325 n = alloc_instruction(ctx, OPCODE_MAP2, 9 + POINTER_DWORDS);
3326 if (n) {
3327 GLfloat *pnts = _mesa_copy_map_points2f(target, ustride, uorder,
3328 vstride, vorder, points);
3329 n[1].e = target;
3330 n[2].f = u1;
3331 n[3].f = u2;
3332 n[4].f = v1;
3333 n[5].f = v2;
3334 /* XXX verify these strides are correct */
3335 n[6].i = _mesa_evaluator_components(target) * vorder; /*ustride */
3336 n[7].i = _mesa_evaluator_components(target); /*vstride */
3337 n[8].i = uorder;
3338 n[9].i = vorder;
3339 save_pointer(&n[10], pnts);
3340 }
3341 if (ctx->ExecuteFlag) {
3342 CALL_Map2f(ctx->Exec, (target, u1, u2, ustride, uorder,
3343 v1, v2, vstride, vorder, points));
3344 }
3345 }
3346
3347
3348 static void GLAPIENTRY
3349 save_MapGrid1f(GLint un, GLfloat u1, GLfloat u2)
3350 {
3351 GET_CURRENT_CONTEXT(ctx);
3352 Node *n;
3353 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3354 n = alloc_instruction(ctx, OPCODE_MAPGRID1, 3);
3355 if (n) {
3356 n[1].i = un;
3357 n[2].f = u1;
3358 n[3].f = u2;
3359 }
3360 if (ctx->ExecuteFlag) {
3361 CALL_MapGrid1f(ctx->Exec, (un, u1, u2));
3362 }
3363 }
3364
3365
3366 static void GLAPIENTRY
3367 save_MapGrid1d(GLint un, GLdouble u1, GLdouble u2)
3368 {
3369 save_MapGrid1f(un, (GLfloat) u1, (GLfloat) u2);
3370 }
3371
3372
3373 static void GLAPIENTRY
3374 save_MapGrid2f(GLint un, GLfloat u1, GLfloat u2,
3375 GLint vn, GLfloat v1, GLfloat v2)
3376 {
3377 GET_CURRENT_CONTEXT(ctx);
3378 Node *n;
3379 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3380 n = alloc_instruction(ctx, OPCODE_MAPGRID2, 6);
3381 if (n) {
3382 n[1].i = un;
3383 n[2].f = u1;
3384 n[3].f = u2;
3385 n[4].i = vn;
3386 n[5].f = v1;
3387 n[6].f = v2;
3388 }
3389 if (ctx->ExecuteFlag) {
3390 CALL_MapGrid2f(ctx->Exec, (un, u1, u2, vn, v1, v2));
3391 }
3392 }
3393
3394
3395
3396 static void GLAPIENTRY
3397 save_MapGrid2d(GLint un, GLdouble u1, GLdouble u2,
3398 GLint vn, GLdouble v1, GLdouble v2)
3399 {
3400 save_MapGrid2f(un, (GLfloat) u1, (GLfloat) u2,
3401 vn, (GLfloat) v1, (GLfloat) v2);
3402 }
3403
3404
3405 static void GLAPIENTRY
3406 save_MatrixMode(GLenum mode)
3407 {
3408 GET_CURRENT_CONTEXT(ctx);
3409 Node *n;
3410 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3411 n = alloc_instruction(ctx, OPCODE_MATRIX_MODE, 1);
3412 if (n) {
3413 n[1].e = mode;
3414 }
3415 if (ctx->ExecuteFlag) {
3416 CALL_MatrixMode(ctx->Exec, (mode));
3417 }
3418 }
3419
3420
3421 static void GLAPIENTRY
3422 save_MultMatrixf(const GLfloat * m)
3423 {
3424 GET_CURRENT_CONTEXT(ctx);
3425 Node *n;
3426 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3427 n = alloc_instruction(ctx, OPCODE_MULT_MATRIX, 16);
3428 if (n) {
3429 GLuint i;
3430 for (i = 0; i < 16; i++) {
3431 n[1 + i].f = m[i];
3432 }
3433 }
3434 if (ctx->ExecuteFlag) {
3435 CALL_MultMatrixf(ctx->Exec, (m));
3436 }
3437 }
3438
3439
3440 static void GLAPIENTRY
3441 save_MultMatrixd(const GLdouble * m)
3442 {
3443 GLfloat f[16];
3444 GLint i;
3445 for (i = 0; i < 16; i++) {
3446 f[i] = (GLfloat) m[i];
3447 }
3448 save_MultMatrixf(f);
3449 }
3450
3451
3452 static void GLAPIENTRY
3453 save_NewList(GLuint name, GLenum mode)
3454 {
3455 GET_CURRENT_CONTEXT(ctx);
3456 /* It's an error to call this function while building a display list */
3457 _mesa_error(ctx, GL_INVALID_OPERATION, "glNewList");
3458 (void) name;
3459 (void) mode;
3460 }
3461
3462
3463
3464 static void GLAPIENTRY
3465 save_Ortho(GLdouble left, GLdouble right,
3466 GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval)
3467 {
3468 GET_CURRENT_CONTEXT(ctx);
3469 Node *n;
3470 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3471 n = alloc_instruction(ctx, OPCODE_ORTHO, 6);
3472 if (n) {
3473 n[1].f = (GLfloat) left;
3474 n[2].f = (GLfloat) right;
3475 n[3].f = (GLfloat) bottom;
3476 n[4].f = (GLfloat) top;
3477 n[5].f = (GLfloat) nearval;
3478 n[6].f = (GLfloat) farval;
3479 }
3480 if (ctx->ExecuteFlag) {
3481 CALL_Ortho(ctx->Exec, (left, right, bottom, top, nearval, farval));
3482 }
3483 }
3484
3485
3486 static void GLAPIENTRY
3487 save_PatchParameteri(GLenum pname, const GLint value)
3488 {
3489 GET_CURRENT_CONTEXT(ctx);
3490 Node *n;
3491 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3492 n = alloc_instruction(ctx, OPCODE_PATCH_PARAMETER_I, 2);
3493 if (n) {
3494 n[1].e = pname;
3495 n[2].i = value;
3496 }
3497 if (ctx->ExecuteFlag) {
3498 CALL_PatchParameteri(ctx->Exec, (pname, value));
3499 }
3500 }
3501
3502
3503 static void GLAPIENTRY
3504 save_PatchParameterfv(GLenum pname, const GLfloat *params)
3505 {
3506 GET_CURRENT_CONTEXT(ctx);
3507 Node *n;
3508 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3509
3510 if (pname == GL_PATCH_DEFAULT_OUTER_LEVEL) {
3511 n = alloc_instruction(ctx, OPCODE_PATCH_PARAMETER_FV_OUTER, 5);
3512 } else {
3513 assert(pname == GL_PATCH_DEFAULT_INNER_LEVEL);
3514 n = alloc_instruction(ctx, OPCODE_PATCH_PARAMETER_FV_INNER, 3);
3515 }
3516 if (n) {
3517 n[1].e = pname;
3518 if (pname == GL_PATCH_DEFAULT_OUTER_LEVEL) {
3519 n[2].f = params[0];
3520 n[3].f = params[1];
3521 n[4].f = params[2];
3522 n[5].f = params[3];
3523 } else {
3524 n[2].f = params[0];
3525 n[3].f = params[1];
3526 }
3527 }
3528 if (ctx->ExecuteFlag) {
3529 CALL_PatchParameterfv(ctx->Exec, (pname, params));
3530 }
3531 }
3532
3533
3534 static void GLAPIENTRY
3535 save_PixelMapfv(GLenum map, GLint mapsize, const GLfloat *values)
3536 {
3537 GET_CURRENT_CONTEXT(ctx);
3538 Node *n;
3539 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3540 n = alloc_instruction(ctx, OPCODE_PIXEL_MAP, 2 + POINTER_DWORDS);
3541 if (n) {
3542 n[1].e = map;
3543 n[2].i = mapsize;
3544 save_pointer(&n[3], memdup(values, mapsize * sizeof(GLfloat)));
3545 }
3546 if (ctx->ExecuteFlag) {
3547 CALL_PixelMapfv(ctx->Exec, (map, mapsize, values));
3548 }
3549 }
3550
3551
3552 static void GLAPIENTRY
3553 save_PixelMapuiv(GLenum map, GLint mapsize, const GLuint *values)
3554 {
3555 GLfloat fvalues[MAX_PIXEL_MAP_TABLE];
3556 GLint i;
3557 if (map == GL_PIXEL_MAP_I_TO_I || map == GL_PIXEL_MAP_S_TO_S) {
3558 for (i = 0; i < mapsize; i++) {
3559 fvalues[i] = (GLfloat) values[i];
3560 }
3561 }
3562 else {
3563 for (i = 0; i < mapsize; i++) {
3564 fvalues[i] = UINT_TO_FLOAT(values[i]);
3565 }
3566 }
3567 save_PixelMapfv(map, mapsize, fvalues);
3568 }
3569
3570
3571 static void GLAPIENTRY
3572 save_PixelMapusv(GLenum map, GLint mapsize, const GLushort *values)
3573 {
3574 GLfloat fvalues[MAX_PIXEL_MAP_TABLE];
3575 GLint i;
3576 if (map == GL_PIXEL_MAP_I_TO_I || map == GL_PIXEL_MAP_S_TO_S) {
3577 for (i = 0; i < mapsize; i++) {
3578 fvalues[i] = (GLfloat) values[i];
3579 }
3580 }
3581 else {
3582 for (i = 0; i < mapsize; i++) {
3583 fvalues[i] = USHORT_TO_FLOAT(values[i]);
3584 }
3585 }
3586 save_PixelMapfv(map, mapsize, fvalues);
3587 }
3588
3589
3590 static void GLAPIENTRY
3591 save_PixelTransferf(GLenum pname, GLfloat param)
3592 {
3593 GET_CURRENT_CONTEXT(ctx);
3594 Node *n;
3595 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3596 n = alloc_instruction(ctx, OPCODE_PIXEL_TRANSFER, 2);
3597 if (n) {
3598 n[1].e = pname;
3599 n[2].f = param;
3600 }
3601 if (ctx->ExecuteFlag) {
3602 CALL_PixelTransferf(ctx->Exec, (pname, param));
3603 }
3604 }
3605
3606
3607 static void GLAPIENTRY
3608 save_PixelTransferi(GLenum pname, GLint param)
3609 {
3610 save_PixelTransferf(pname, (GLfloat) param);
3611 }
3612
3613
3614 static void GLAPIENTRY
3615 save_PixelZoom(GLfloat xfactor, GLfloat yfactor)
3616 {
3617 GET_CURRENT_CONTEXT(ctx);
3618 Node *n;
3619 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3620 n = alloc_instruction(ctx, OPCODE_PIXEL_ZOOM, 2);
3621 if (n) {
3622 n[1].f = xfactor;
3623 n[2].f = yfactor;
3624 }
3625 if (ctx->ExecuteFlag) {
3626 CALL_PixelZoom(ctx->Exec, (xfactor, yfactor));
3627 }
3628 }
3629
3630
3631 static void GLAPIENTRY
3632 save_PointParameterfvEXT(GLenum pname, const GLfloat *params)
3633 {
3634 GET_CURRENT_CONTEXT(ctx);
3635 Node *n;
3636 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3637 n = alloc_instruction(ctx, OPCODE_POINT_PARAMETERS, 4);
3638 if (n) {
3639 n[1].e = pname;
3640 n[2].f = params[0];
3641 n[3].f = params[1];
3642 n[4].f = params[2];
3643 }
3644 if (ctx->ExecuteFlag) {
3645 CALL_PointParameterfv(ctx->Exec, (pname, params));
3646 }
3647 }
3648
3649
3650 static void GLAPIENTRY
3651 save_PointParameterfEXT(GLenum pname, GLfloat param)
3652 {
3653 GLfloat parray[3];
3654 parray[0] = param;
3655 parray[1] = parray[2] = 0.0F;
3656 save_PointParameterfvEXT(pname, parray);
3657 }
3658
3659 static void GLAPIENTRY
3660 save_PointParameteriNV(GLenum pname, GLint param)
3661 {
3662 GLfloat parray[3];
3663 parray[0] = (GLfloat) param;
3664 parray[1] = parray[2] = 0.0F;
3665 save_PointParameterfvEXT(pname, parray);
3666 }
3667
3668 static void GLAPIENTRY
3669 save_PointParameterivNV(GLenum pname, const GLint * param)
3670 {
3671 GLfloat parray[3];
3672 parray[0] = (GLfloat) param[0];
3673 parray[1] = parray[2] = 0.0F;
3674 save_PointParameterfvEXT(pname, parray);
3675 }
3676
3677
3678 static void GLAPIENTRY
3679 save_PointSize(GLfloat size)
3680 {
3681 GET_CURRENT_CONTEXT(ctx);
3682 Node *n;
3683 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3684 n = alloc_instruction(ctx, OPCODE_POINT_SIZE, 1);
3685 if (n) {
3686 n[1].f = size;
3687 }
3688 if (ctx->ExecuteFlag) {
3689 CALL_PointSize(ctx->Exec, (size));
3690 }
3691 }
3692
3693
3694 static void GLAPIENTRY
3695 save_PolygonMode(GLenum face, GLenum mode)
3696 {
3697 GET_CURRENT_CONTEXT(ctx);
3698 Node *n;
3699 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3700 n = alloc_instruction(ctx, OPCODE_POLYGON_MODE, 2);
3701 if (n) {
3702 n[1].e = face;
3703 n[2].e = mode;
3704 }
3705 if (ctx->ExecuteFlag) {
3706 CALL_PolygonMode(ctx->Exec, (face, mode));
3707 }
3708 }
3709
3710
3711 static void GLAPIENTRY
3712 save_PolygonStipple(const GLubyte * pattern)
3713 {
3714 GET_CURRENT_CONTEXT(ctx);
3715 Node *n;
3716
3717 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3718
3719 n = alloc_instruction(ctx, OPCODE_POLYGON_STIPPLE, POINTER_DWORDS);
3720 if (n) {
3721 save_pointer(&n[1],
3722 unpack_image(ctx, 2, 32, 32, 1, GL_COLOR_INDEX, GL_BITMAP,
3723 pattern, &ctx->Unpack));
3724 }
3725 if (ctx->ExecuteFlag) {
3726 CALL_PolygonStipple(ctx->Exec, ((GLubyte *) pattern));
3727 }
3728 }
3729
3730
3731 static void GLAPIENTRY
3732 save_PolygonOffset(GLfloat factor, GLfloat units)
3733 {
3734 GET_CURRENT_CONTEXT(ctx);
3735 Node *n;
3736 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3737 n = alloc_instruction(ctx, OPCODE_POLYGON_OFFSET, 2);
3738 if (n) {
3739 n[1].f = factor;
3740 n[2].f = units;
3741 }
3742 if (ctx->ExecuteFlag) {
3743 CALL_PolygonOffset(ctx->Exec, (factor, units));
3744 }
3745 }
3746
3747
3748 static void GLAPIENTRY
3749 save_PolygonOffsetClampEXT(GLfloat factor, GLfloat units, GLfloat clamp)
3750 {
3751 GET_CURRENT_CONTEXT(ctx);
3752 Node *n;
3753 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3754 n = alloc_instruction(ctx, OPCODE_POLYGON_OFFSET_CLAMP, 3);
3755 if (n) {
3756 n[1].f = factor;
3757 n[2].f = units;
3758 n[3].f = clamp;
3759 }
3760 if (ctx->ExecuteFlag) {
3761 CALL_PolygonOffsetClampEXT(ctx->Exec, (factor, units, clamp));
3762 }
3763 }
3764
3765 static void GLAPIENTRY
3766 save_PopAttrib(void)
3767 {
3768 GET_CURRENT_CONTEXT(ctx);
3769 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3770 (void) alloc_instruction(ctx, OPCODE_POP_ATTRIB, 0);
3771 if (ctx->ExecuteFlag) {
3772 CALL_PopAttrib(ctx->Exec, ());
3773 }
3774 }
3775
3776
3777 static void GLAPIENTRY
3778 save_PopMatrix(void)
3779 {
3780 GET_CURRENT_CONTEXT(ctx);
3781 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3782 (void) alloc_instruction(ctx, OPCODE_POP_MATRIX, 0);
3783 if (ctx->ExecuteFlag) {
3784 CALL_PopMatrix(ctx->Exec, ());
3785 }
3786 }
3787
3788
3789 static void GLAPIENTRY
3790 save_PopName(void)
3791 {
3792 GET_CURRENT_CONTEXT(ctx);
3793 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3794 (void) alloc_instruction(ctx, OPCODE_POP_NAME, 0);
3795 if (ctx->ExecuteFlag) {
3796 CALL_PopName(ctx->Exec, ());
3797 }
3798 }
3799
3800
3801 static void GLAPIENTRY
3802 save_PrioritizeTextures(GLsizei num, const GLuint * textures,
3803 const GLclampf * priorities)
3804 {
3805 GET_CURRENT_CONTEXT(ctx);
3806 GLint i;
3807 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3808
3809 for (i = 0; i < num; i++) {
3810 Node *n;
3811 n = alloc_instruction(ctx, OPCODE_PRIORITIZE_TEXTURE, 2);
3812 if (n) {
3813 n[1].ui = textures[i];
3814 n[2].f = priorities[i];
3815 }
3816 }
3817 if (ctx->ExecuteFlag) {
3818 CALL_PrioritizeTextures(ctx->Exec, (num, textures, priorities));
3819 }
3820 }
3821
3822
3823 static void GLAPIENTRY
3824 save_PushAttrib(GLbitfield mask)
3825 {
3826 GET_CURRENT_CONTEXT(ctx);
3827 Node *n;
3828 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3829 n = alloc_instruction(ctx, OPCODE_PUSH_ATTRIB, 1);
3830 if (n) {
3831 n[1].bf = mask;
3832 }
3833 if (ctx->ExecuteFlag) {
3834 CALL_PushAttrib(ctx->Exec, (mask));
3835 }
3836 }
3837
3838
3839 static void GLAPIENTRY
3840 save_PushMatrix(void)
3841 {
3842 GET_CURRENT_CONTEXT(ctx);
3843 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3844 (void) alloc_instruction(ctx, OPCODE_PUSH_MATRIX, 0);
3845 if (ctx->ExecuteFlag) {
3846 CALL_PushMatrix(ctx->Exec, ());
3847 }
3848 }
3849
3850
3851 static void GLAPIENTRY
3852 save_PushName(GLuint name)
3853 {
3854 GET_CURRENT_CONTEXT(ctx);
3855 Node *n;
3856 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3857 n = alloc_instruction(ctx, OPCODE_PUSH_NAME, 1);
3858 if (n) {
3859 n[1].ui = name;
3860 }
3861 if (ctx->ExecuteFlag) {
3862 CALL_PushName(ctx->Exec, (name));
3863 }
3864 }
3865
3866
3867 static void GLAPIENTRY
3868 save_RasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
3869 {
3870 GET_CURRENT_CONTEXT(ctx);
3871 Node *n;
3872 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3873 n = alloc_instruction(ctx, OPCODE_RASTER_POS, 4);
3874 if (n) {
3875 n[1].f = x;
3876 n[2].f = y;
3877 n[3].f = z;
3878 n[4].f = w;
3879 }
3880 if (ctx->ExecuteFlag) {
3881 CALL_RasterPos4f(ctx->Exec, (x, y, z, w));
3882 }
3883 }
3884
3885 static void GLAPIENTRY
3886 save_RasterPos2d(GLdouble x, GLdouble y)
3887 {
3888 save_RasterPos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
3889 }
3890
3891 static void GLAPIENTRY
3892 save_RasterPos2f(GLfloat x, GLfloat y)
3893 {
3894 save_RasterPos4f(x, y, 0.0F, 1.0F);
3895 }
3896
3897 static void GLAPIENTRY
3898 save_RasterPos2i(GLint x, GLint y)
3899 {
3900 save_RasterPos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
3901 }
3902
3903 static void GLAPIENTRY
3904 save_RasterPos2s(GLshort x, GLshort y)
3905 {
3906 save_RasterPos4f(x, y, 0.0F, 1.0F);
3907 }
3908
3909 static void GLAPIENTRY
3910 save_RasterPos3d(GLdouble x, GLdouble y, GLdouble z)
3911 {
3912 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
3913 }
3914
3915 static void GLAPIENTRY
3916 save_RasterPos3f(GLfloat x, GLfloat y, GLfloat z)
3917 {
3918 save_RasterPos4f(x, y, z, 1.0F);
3919 }
3920
3921 static void GLAPIENTRY
3922 save_RasterPos3i(GLint x, GLint y, GLint z)
3923 {
3924 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
3925 }
3926
3927 static void GLAPIENTRY
3928 save_RasterPos3s(GLshort x, GLshort y, GLshort z)
3929 {
3930 save_RasterPos4f(x, y, z, 1.0F);
3931 }
3932
3933 static void GLAPIENTRY
3934 save_RasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
3935 {
3936 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
3937 }
3938
3939 static void GLAPIENTRY
3940 save_RasterPos4i(GLint x, GLint y, GLint z, GLint w)
3941 {
3942 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
3943 }
3944
3945 static void GLAPIENTRY
3946 save_RasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w)
3947 {
3948 save_RasterPos4f(x, y, z, w);
3949 }
3950
3951 static void GLAPIENTRY
3952 save_RasterPos2dv(const GLdouble * v)
3953 {
3954 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
3955 }
3956
3957 static void GLAPIENTRY
3958 save_RasterPos2fv(const GLfloat * v)
3959 {
3960 save_RasterPos4f(v[0], v[1], 0.0F, 1.0F);
3961 }
3962
3963 static void GLAPIENTRY
3964 save_RasterPos2iv(const GLint * v)
3965 {
3966 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
3967 }
3968
3969 static void GLAPIENTRY
3970 save_RasterPos2sv(const GLshort * v)
3971 {
3972 save_RasterPos4f(v[0], v[1], 0.0F, 1.0F);
3973 }
3974
3975 static void GLAPIENTRY
3976 save_RasterPos3dv(const GLdouble * v)
3977 {
3978 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
3979 }
3980
3981 static void GLAPIENTRY
3982 save_RasterPos3fv(const GLfloat * v)
3983 {
3984 save_RasterPos4f(v[0], v[1], v[2], 1.0F);
3985 }
3986
3987 static void GLAPIENTRY
3988 save_RasterPos3iv(const GLint * v)
3989 {
3990 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
3991 }
3992
3993 static void GLAPIENTRY
3994 save_RasterPos3sv(const GLshort * v)
3995 {
3996 save_RasterPos4f(v[0], v[1], v[2], 1.0F);
3997 }
3998
3999 static void GLAPIENTRY
4000 save_RasterPos4dv(const GLdouble * v)
4001 {
4002 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1],
4003 (GLfloat) v[2], (GLfloat) v[3]);
4004 }
4005
4006 static void GLAPIENTRY
4007 save_RasterPos4fv(const GLfloat * v)
4008 {
4009 save_RasterPos4f(v[0], v[1], v[2], v[3]);
4010 }
4011
4012 static void GLAPIENTRY
4013 save_RasterPos4iv(const GLint * v)
4014 {
4015 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1],
4016 (GLfloat) v[2], (GLfloat) v[3]);
4017 }
4018
4019 static void GLAPIENTRY
4020 save_RasterPos4sv(const GLshort * v)
4021 {
4022 save_RasterPos4f(v[0], v[1], v[2], v[3]);
4023 }
4024
4025
4026 static void GLAPIENTRY
4027 save_PassThrough(GLfloat token)
4028 {
4029 GET_CURRENT_CONTEXT(ctx);
4030 Node *n;
4031 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4032 n = alloc_instruction(ctx, OPCODE_PASSTHROUGH, 1);
4033 if (n) {
4034 n[1].f = token;
4035 }
4036 if (ctx->ExecuteFlag) {
4037 CALL_PassThrough(ctx->Exec, (token));
4038 }
4039 }
4040
4041
4042 static void GLAPIENTRY
4043 save_ReadBuffer(GLenum mode)
4044 {
4045 GET_CURRENT_CONTEXT(ctx);
4046 Node *n;
4047 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4048 n = alloc_instruction(ctx, OPCODE_READ_BUFFER, 1);
4049 if (n) {
4050 n[1].e = mode;
4051 }
4052 if (ctx->ExecuteFlag) {
4053 CALL_ReadBuffer(ctx->Exec, (mode));
4054 }
4055 }
4056
4057
4058 static void GLAPIENTRY
4059 save_Rotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
4060 {
4061 GET_CURRENT_CONTEXT(ctx);
4062 Node *n;
4063 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4064 n = alloc_instruction(ctx, OPCODE_ROTATE, 4);
4065 if (n) {
4066 n[1].f = angle;
4067 n[2].f = x;
4068 n[3].f = y;
4069 n[4].f = z;
4070 }
4071 if (ctx->ExecuteFlag) {
4072 CALL_Rotatef(ctx->Exec, (angle, x, y, z));
4073 }
4074 }
4075
4076
4077 static void GLAPIENTRY
4078 save_Rotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
4079 {
4080 save_Rotatef((GLfloat) angle, (GLfloat) x, (GLfloat) y, (GLfloat) z);
4081 }
4082
4083
4084 static void GLAPIENTRY
4085 save_Scalef(GLfloat x, GLfloat y, GLfloat z)
4086 {
4087 GET_CURRENT_CONTEXT(ctx);
4088 Node *n;
4089 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4090 n = alloc_instruction(ctx, OPCODE_SCALE, 3);
4091 if (n) {
4092 n[1].f = x;
4093 n[2].f = y;
4094 n[3].f = z;
4095 }
4096 if (ctx->ExecuteFlag) {
4097 CALL_Scalef(ctx->Exec, (x, y, z));
4098 }
4099 }
4100
4101
4102 static void GLAPIENTRY
4103 save_Scaled(GLdouble x, GLdouble y, GLdouble z)
4104 {
4105 save_Scalef((GLfloat) x, (GLfloat) y, (GLfloat) z);
4106 }
4107
4108
4109 static void GLAPIENTRY
4110 save_Scissor(GLint x, GLint y, GLsizei width, GLsizei height)
4111 {
4112 GET_CURRENT_CONTEXT(ctx);
4113 Node *n;
4114 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4115 n = alloc_instruction(ctx, OPCODE_SCISSOR, 4);
4116 if (n) {
4117 n[1].i = x;
4118 n[2].i = y;
4119 n[3].i = width;
4120 n[4].i = height;
4121 }
4122 if (ctx->ExecuteFlag) {
4123 CALL_Scissor(ctx->Exec, (x, y, width, height));
4124 }
4125 }
4126
4127
4128 static void GLAPIENTRY
4129 save_ShadeModel(GLenum mode)
4130 {
4131 GET_CURRENT_CONTEXT(ctx);
4132 Node *n;
4133 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx);
4134
4135 if (ctx->ExecuteFlag) {
4136 CALL_ShadeModel(ctx->Exec, (mode));
4137 }
4138
4139 /* Don't compile this call if it's a no-op.
4140 * By avoiding this state change we have a better chance of
4141 * coalescing subsequent drawing commands into one batch.
4142 */
4143 if (ctx->ListState.Current.ShadeModel == mode)
4144 return;
4145
4146 SAVE_FLUSH_VERTICES(ctx);
4147
4148 ctx->ListState.Current.ShadeModel = mode;
4149
4150 n = alloc_instruction(ctx, OPCODE_SHADE_MODEL, 1);
4151 if (n) {
4152 n[1].e = mode;
4153 }
4154 }
4155
4156
4157 static void GLAPIENTRY
4158 save_StencilFunc(GLenum func, GLint ref, GLuint mask)
4159 {
4160 GET_CURRENT_CONTEXT(ctx);
4161 Node *n;
4162 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4163 n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC, 3);
4164 if (n) {
4165 n[1].e = func;
4166 n[2].i = ref;
4167 n[3].ui = mask;
4168 }
4169 if (ctx->ExecuteFlag) {
4170 CALL_StencilFunc(ctx->Exec, (func, ref, mask));
4171 }
4172 }
4173
4174
4175 static void GLAPIENTRY
4176 save_StencilMask(GLuint mask)
4177 {
4178 GET_CURRENT_CONTEXT(ctx);
4179 Node *n;
4180 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4181 n = alloc_instruction(ctx, OPCODE_STENCIL_MASK, 1);
4182 if (n) {
4183 n[1].ui = mask;
4184 }
4185 if (ctx->ExecuteFlag) {
4186 CALL_StencilMask(ctx->Exec, (mask));
4187 }
4188 }
4189
4190
4191 static void GLAPIENTRY
4192 save_StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
4193 {
4194 GET_CURRENT_CONTEXT(ctx);
4195 Node *n;
4196 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4197 n = alloc_instruction(ctx, OPCODE_STENCIL_OP, 3);
4198 if (n) {
4199 n[1].e = fail;
4200 n[2].e = zfail;
4201 n[3].e = zpass;
4202 }
4203 if (ctx->ExecuteFlag) {
4204 CALL_StencilOp(ctx->Exec, (fail, zfail, zpass));
4205 }
4206 }
4207
4208
4209 static void GLAPIENTRY
4210 save_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
4211 {
4212 GET_CURRENT_CONTEXT(ctx);
4213 Node *n;
4214 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4215 n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4);
4216 if (n) {
4217 n[1].e = face;
4218 n[2].e = func;
4219 n[3].i = ref;
4220 n[4].ui = mask;
4221 }
4222 if (ctx->ExecuteFlag) {
4223 CALL_StencilFuncSeparate(ctx->Exec, (face, func, ref, mask));
4224 }
4225 }
4226
4227
4228 static void GLAPIENTRY
4229 save_StencilFuncSeparateATI(GLenum frontfunc, GLenum backfunc, GLint ref,
4230 GLuint mask)
4231 {
4232 GET_CURRENT_CONTEXT(ctx);
4233 Node *n;
4234 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4235 /* GL_FRONT */
4236 n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4);
4237 if (n) {
4238 n[1].e = GL_FRONT;
4239 n[2].e = frontfunc;
4240 n[3].i = ref;
4241 n[4].ui = mask;
4242 }
4243 /* GL_BACK */
4244 n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4);
4245 if (n) {
4246 n[1].e = GL_BACK;
4247 n[2].e = backfunc;
4248 n[3].i = ref;
4249 n[4].ui = mask;
4250 }
4251 if (ctx->ExecuteFlag) {
4252 CALL_StencilFuncSeparate(ctx->Exec, (GL_FRONT, frontfunc, ref, mask));
4253 CALL_StencilFuncSeparate(ctx->Exec, (GL_BACK, backfunc, ref, mask));
4254 }
4255 }
4256
4257
4258 static void GLAPIENTRY
4259 save_StencilMaskSeparate(GLenum face, GLuint mask)
4260 {
4261 GET_CURRENT_CONTEXT(ctx);
4262 Node *n;
4263 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4264 n = alloc_instruction(ctx, OPCODE_STENCIL_MASK_SEPARATE, 2);
4265 if (n) {
4266 n[1].e = face;
4267 n[2].ui = mask;
4268 }
4269 if (ctx->ExecuteFlag) {
4270 CALL_StencilMaskSeparate(ctx->Exec, (face, mask));
4271 }
4272 }
4273
4274
4275 static void GLAPIENTRY
4276 save_StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
4277 {
4278 GET_CURRENT_CONTEXT(ctx);
4279 Node *n;
4280 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4281 n = alloc_instruction(ctx, OPCODE_STENCIL_OP_SEPARATE, 4);
4282 if (n) {
4283 n[1].e = face;
4284 n[2].e = fail;
4285 n[3].e = zfail;
4286 n[4].e = zpass;
4287 }
4288 if (ctx->ExecuteFlag) {
4289 CALL_StencilOpSeparate(ctx->Exec, (face, fail, zfail, zpass));
4290 }
4291 }
4292
4293
4294 static void GLAPIENTRY
4295 save_TexEnvfv(GLenum target, GLenum pname, const GLfloat *params)
4296 {
4297 GET_CURRENT_CONTEXT(ctx);
4298 Node *n;
4299 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4300 n = alloc_instruction(ctx, OPCODE_TEXENV, 6);
4301 if (n) {
4302 n[1].e = target;
4303 n[2].e = pname;
4304 if (pname == GL_TEXTURE_ENV_COLOR) {
4305 n[3].f = params[0];
4306 n[4].f = params[1];
4307 n[5].f = params[2];
4308 n[6].f = params[3];
4309 }
4310 else {
4311 n[3].f = params[0];
4312 n[4].f = n[5].f = n[6].f = 0.0F;
4313 }
4314 }
4315 if (ctx->ExecuteFlag) {
4316 CALL_TexEnvfv(ctx->Exec, (target, pname, params));
4317 }
4318 }
4319
4320
4321 static void GLAPIENTRY
4322 save_TexEnvf(GLenum target, GLenum pname, GLfloat param)
4323 {
4324 GLfloat parray[4];
4325 parray[0] = (GLfloat) param;
4326 parray[1] = parray[2] = parray[3] = 0.0F;
4327 save_TexEnvfv(target, pname, parray);
4328 }
4329
4330
4331 static void GLAPIENTRY
4332 save_TexEnvi(GLenum target, GLenum pname, GLint param)
4333 {
4334 GLfloat p[4];
4335 p[0] = (GLfloat) param;
4336 p[1] = p[2] = p[3] = 0.0F;
4337 save_TexEnvfv(target, pname, p);
4338 }
4339
4340
4341 static void GLAPIENTRY
4342 save_TexEnviv(GLenum target, GLenum pname, const GLint * param)
4343 {
4344 GLfloat p[4];
4345 if (pname == GL_TEXTURE_ENV_COLOR) {
4346 p[0] = INT_TO_FLOAT(param[0]);
4347 p[1] = INT_TO_FLOAT(param[1]);
4348 p[2] = INT_TO_FLOAT(param[2]);
4349 p[3] = INT_TO_FLOAT(param[3]);
4350 }
4351 else {
4352 p[0] = (GLfloat) param[0];
4353 p[1] = p[2] = p[3] = 0.0F;
4354 }
4355 save_TexEnvfv(target, pname, p);
4356 }
4357
4358
4359 static void GLAPIENTRY
4360 save_TexGenfv(GLenum coord, GLenum pname, const GLfloat *params)
4361 {
4362 GET_CURRENT_CONTEXT(ctx);
4363 Node *n;
4364 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4365 n = alloc_instruction(ctx, OPCODE_TEXGEN, 6);
4366 if (n) {
4367 n[1].e = coord;
4368 n[2].e = pname;
4369 n[3].f = params[0];
4370 n[4].f = params[1];
4371 n[5].f = params[2];
4372 n[6].f = params[3];
4373 }
4374 if (ctx->ExecuteFlag) {
4375 CALL_TexGenfv(ctx->Exec, (coord, pname, params));
4376 }
4377 }
4378
4379
4380 static void GLAPIENTRY
4381 save_TexGeniv(GLenum coord, GLenum pname, const GLint *params)
4382 {
4383 GLfloat p[4];
4384 p[0] = (GLfloat) params[0];
4385 p[1] = (GLfloat) params[1];
4386 p[2] = (GLfloat) params[2];
4387 p[3] = (GLfloat) params[3];
4388 save_TexGenfv(coord, pname, p);
4389 }
4390
4391
4392 static void GLAPIENTRY
4393 save_TexGend(GLenum coord, GLenum pname, GLdouble param)
4394 {
4395 GLfloat parray[4];
4396 parray[0] = (GLfloat) param;
4397 parray[1] = parray[2] = parray[3] = 0.0F;
4398 save_TexGenfv(coord, pname, parray);
4399 }
4400
4401
4402 static void GLAPIENTRY
4403 save_TexGendv(GLenum coord, GLenum pname, const GLdouble *params)
4404 {
4405 GLfloat p[4];
4406 p[0] = (GLfloat) params[0];
4407 p[1] = (GLfloat) params[1];
4408 p[2] = (GLfloat) params[2];
4409 p[3] = (GLfloat) params[3];
4410 save_TexGenfv(coord, pname, p);
4411 }
4412
4413
4414 static void GLAPIENTRY
4415 save_TexGenf(GLenum coord, GLenum pname, GLfloat param)
4416 {
4417 GLfloat parray[4];
4418 parray[0] = param;
4419 parray[1] = parray[2] = parray[3] = 0.0F;
4420 save_TexGenfv(coord, pname, parray);
4421 }
4422
4423
4424 static void GLAPIENTRY
4425 save_TexGeni(GLenum coord, GLenum pname, GLint param)
4426 {
4427 GLint parray[4];
4428 parray[0] = param;
4429 parray[1] = parray[2] = parray[3] = 0;
4430 save_TexGeniv(coord, pname, parray);
4431 }
4432
4433
4434 static void GLAPIENTRY
4435 save_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
4436 {
4437 GET_CURRENT_CONTEXT(ctx);
4438 Node *n;
4439 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4440 n = alloc_instruction(ctx, OPCODE_TEXPARAMETER, 6);
4441 if (n) {
4442 n[1].e = target;
4443 n[2].e = pname;
4444 n[3].f = params[0];
4445 n[4].f = params[1];
4446 n[5].f = params[2];
4447 n[6].f = params[3];
4448 }
4449 if (ctx->ExecuteFlag) {
4450 CALL_TexParameterfv(ctx->Exec, (target, pname, params));
4451 }
4452 }
4453
4454
4455 static void GLAPIENTRY
4456 save_TexParameterf(GLenum target, GLenum pname, GLfloat param)
4457 {
4458 GLfloat parray[4];
4459 parray[0] = param;
4460 parray[1] = parray[2] = parray[3] = 0.0F;
4461 save_TexParameterfv(target, pname, parray);
4462 }
4463
4464
4465 static void GLAPIENTRY
4466 save_TexParameteri(GLenum target, GLenum pname, GLint param)
4467 {
4468 GLfloat fparam[4];
4469 fparam[0] = (GLfloat) param;
4470 fparam[1] = fparam[2] = fparam[3] = 0.0F;
4471 save_TexParameterfv(target, pname, fparam);
4472 }
4473
4474
4475 static void GLAPIENTRY
4476 save_TexParameteriv(GLenum target, GLenum pname, const GLint *params)
4477 {
4478 GLfloat fparam[4];
4479 fparam[0] = (GLfloat) params[0];
4480 fparam[1] = fparam[2] = fparam[3] = 0.0F;
4481 save_TexParameterfv(target, pname, fparam);
4482 }
4483
4484
4485 static void GLAPIENTRY
4486 save_TexImage1D(GLenum target,
4487 GLint level, GLint components,
4488 GLsizei width, GLint border,
4489 GLenum format, GLenum type, const GLvoid * pixels)
4490 {
4491 GET_CURRENT_CONTEXT(ctx);
4492 if (target == GL_PROXY_TEXTURE_1D) {
4493 /* don't compile, execute immediately */
4494 CALL_TexImage1D(ctx->Exec, (target, level, components, width,
4495 border, format, type, pixels));
4496 }
4497 else {
4498 Node *n;
4499 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4500 n = alloc_instruction(ctx, OPCODE_TEX_IMAGE1D, 7 + POINTER_DWORDS);
4501 if (n) {
4502 n[1].e = target;
4503 n[2].i = level;
4504 n[3].i = components;
4505 n[4].i = (GLint) width;
4506 n[5].i = border;
4507 n[6].e = format;
4508 n[7].e = type;
4509 save_pointer(&n[8],
4510 unpack_image(ctx, 1, width, 1, 1, format, type,
4511 pixels, &ctx->Unpack));
4512 }
4513 if (ctx->ExecuteFlag) {
4514 CALL_TexImage1D(ctx->Exec, (target, level, components, width,
4515 border, format, type, pixels));
4516 }
4517 }
4518 }
4519
4520
4521 static void GLAPIENTRY
4522 save_TexImage2D(GLenum target,
4523 GLint level, GLint components,
4524 GLsizei width, GLsizei height, GLint border,
4525 GLenum format, GLenum type, const GLvoid * pixels)
4526 {
4527 GET_CURRENT_CONTEXT(ctx);
4528 if (target == GL_PROXY_TEXTURE_2D) {
4529 /* don't compile, execute immediately */
4530 CALL_TexImage2D(ctx->Exec, (target, level, components, width,
4531 height, border, format, type, pixels));
4532 }
4533 else {
4534 Node *n;
4535 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4536 n = alloc_instruction(ctx, OPCODE_TEX_IMAGE2D, 8 + POINTER_DWORDS);
4537 if (n) {
4538 n[1].e = target;
4539 n[2].i = level;
4540 n[3].i = components;
4541 n[4].i = (GLint) width;
4542 n[5].i = (GLint) height;
4543 n[6].i = border;
4544 n[7].e = format;
4545 n[8].e = type;
4546 save_pointer(&n[9],
4547 unpack_image(ctx, 2, width, height, 1, format, type,
4548 pixels, &ctx->Unpack));
4549 }
4550 if (ctx->ExecuteFlag) {
4551 CALL_TexImage2D(ctx->Exec, (target, level, components, width,
4552 height, border, format, type, pixels));
4553 }
4554 }
4555 }
4556
4557
4558 static void GLAPIENTRY
4559 save_TexImage3D(GLenum target,
4560 GLint level, GLint internalFormat,
4561 GLsizei width, GLsizei height, GLsizei depth,
4562 GLint border,
4563 GLenum format, GLenum type, const GLvoid * pixels)
4564 {
4565 GET_CURRENT_CONTEXT(ctx);
4566 if (target == GL_PROXY_TEXTURE_3D) {
4567 /* don't compile, execute immediately */
4568 CALL_TexImage3D(ctx->Exec, (target, level, internalFormat, width,
4569 height, depth, border, format, type,
4570 pixels));
4571 }
4572 else {
4573 Node *n;
4574 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4575 n = alloc_instruction(ctx, OPCODE_TEX_IMAGE3D, 9 + POINTER_DWORDS);
4576 if (n) {
4577 n[1].e = target;
4578 n[2].i = level;
4579 n[3].i = (GLint) internalFormat;
4580 n[4].i = (GLint) width;
4581 n[5].i = (GLint) height;
4582 n[6].i = (GLint) depth;
4583 n[7].i = border;
4584 n[8].e = format;
4585 n[9].e = type;
4586 save_pointer(&n[10],
4587 unpack_image(ctx, 3, width, height, depth, format, type,
4588 pixels, &ctx->Unpack));
4589 }
4590 if (ctx->ExecuteFlag) {
4591 CALL_TexImage3D(ctx->Exec, (target, level, internalFormat, width,
4592 height, depth, border, format, type,
4593 pixels));
4594 }
4595 }
4596 }
4597
4598
4599 static void GLAPIENTRY
4600 save_TexSubImage1D(GLenum target, GLint level, GLint xoffset,
4601 GLsizei width, GLenum format, GLenum type,
4602 const GLvoid * pixels)
4603 {
4604 GET_CURRENT_CONTEXT(ctx);
4605 Node *n;
4606
4607 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4608
4609 n = alloc_instruction(ctx, OPCODE_TEX_SUB_IMAGE1D, 6 + POINTER_DWORDS);
4610 if (n) {
4611 n[1].e = target;
4612 n[2].i = level;
4613 n[3].i = xoffset;
4614 n[4].i = (GLint) width;
4615 n[5].e = format;
4616 n[6].e = type;
4617 save_pointer(&n[7],
4618 unpack_image(ctx, 1, width, 1, 1, format, type,
4619 pixels, &ctx->Unpack));
4620 }
4621 if (ctx->ExecuteFlag) {
4622 CALL_TexSubImage1D(ctx->Exec, (target, level, xoffset, width,
4623 format, type, pixels));
4624 }
4625 }
4626
4627
4628 static void GLAPIENTRY
4629 save_TexSubImage2D(GLenum target, GLint level,
4630 GLint xoffset, GLint yoffset,
4631 GLsizei width, GLsizei height,
4632 GLenum format, GLenum type, const GLvoid * pixels)
4633 {
4634 GET_CURRENT_CONTEXT(ctx);
4635 Node *n;
4636
4637 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4638
4639 n = alloc_instruction(ctx, OPCODE_TEX_SUB_IMAGE2D, 8 + POINTER_DWORDS);
4640 if (n) {
4641 n[1].e = target;
4642 n[2].i = level;
4643 n[3].i = xoffset;
4644 n[4].i = yoffset;
4645 n[5].i = (GLint) width;
4646 n[6].i = (GLint) height;
4647 n[7].e = format;
4648 n[8].e = type;
4649 save_pointer(&n[9],
4650 unpack_image(ctx, 2, width, height, 1, format, type,
4651 pixels, &ctx->Unpack));
4652 }
4653 if (ctx->ExecuteFlag) {
4654 CALL_TexSubImage2D(ctx->Exec, (target, level, xoffset, yoffset,
4655 width, height, format, type, pixels));
4656 }
4657 }
4658
4659
4660 static void GLAPIENTRY
4661 save_TexSubImage3D(GLenum target, GLint level,
4662 GLint xoffset, GLint yoffset, GLint zoffset,
4663 GLsizei width, GLsizei height, GLsizei depth,
4664 GLenum format, GLenum type, const GLvoid * pixels)
4665 {
4666 GET_CURRENT_CONTEXT(ctx);
4667 Node *n;
4668
4669 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4670
4671 n = alloc_instruction(ctx, OPCODE_TEX_SUB_IMAGE3D, 10 + POINTER_DWORDS);
4672 if (n) {
4673 n[1].e = target;
4674 n[2].i = level;
4675 n[3].i = xoffset;
4676 n[4].i = yoffset;
4677 n[5].i = zoffset;
4678 n[6].i = (GLint) width;
4679 n[7].i = (GLint) height;
4680 n[8].i = (GLint) depth;
4681 n[9].e = format;
4682 n[10].e = type;
4683 save_pointer(&n[11],
4684 unpack_image(ctx, 3, width, height, depth, format, type,
4685 pixels, &ctx->Unpack));
4686 }
4687 if (ctx->ExecuteFlag) {
4688 CALL_TexSubImage3D(ctx->Exec, (target, level,
4689 xoffset, yoffset, zoffset,
4690 width, height, depth, format, type,
4691 pixels));
4692 }
4693 }
4694
4695
4696 static void GLAPIENTRY
4697 save_Translatef(GLfloat x, GLfloat y, GLfloat z)
4698 {
4699 GET_CURRENT_CONTEXT(ctx);
4700 Node *n;
4701 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4702 n = alloc_instruction(ctx, OPCODE_TRANSLATE, 3);
4703 if (n) {
4704 n[1].f = x;
4705 n[2].f = y;
4706 n[3].f = z;
4707 }
4708 if (ctx->ExecuteFlag) {
4709 CALL_Translatef(ctx->Exec, (x, y, z));
4710 }
4711 }
4712
4713
4714 static void GLAPIENTRY
4715 save_Translated(GLdouble x, GLdouble y, GLdouble z)
4716 {
4717 save_Translatef((GLfloat) x, (GLfloat) y, (GLfloat) z);
4718 }
4719
4720
4721
4722 static void GLAPIENTRY
4723 save_Viewport(GLint x, GLint y, GLsizei width, GLsizei height)
4724 {
4725 GET_CURRENT_CONTEXT(ctx);
4726 Node *n;
4727 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4728 n = alloc_instruction(ctx, OPCODE_VIEWPORT, 4);
4729 if (n) {
4730 n[1].i = x;
4731 n[2].i = y;
4732 n[3].i = (GLint) width;
4733 n[4].i = (GLint) height;
4734 }
4735 if (ctx->ExecuteFlag) {
4736 CALL_Viewport(ctx->Exec, (x, y, width, height));
4737 }
4738 }
4739
4740 static void GLAPIENTRY
4741 save_ViewportIndexedf(GLuint index, GLfloat x, GLfloat y, GLfloat width,
4742 GLfloat height)
4743 {
4744 GET_CURRENT_CONTEXT(ctx);
4745 Node *n;
4746 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4747 n = alloc_instruction(ctx, OPCODE_VIEWPORT_INDEXED_F, 5);
4748 if (n) {
4749 n[1].ui = index;
4750 n[2].f = x;
4751 n[3].f = y;
4752 n[4].f = width;
4753 n[5].f = height;
4754 }
4755 if (ctx->ExecuteFlag) {
4756 CALL_ViewportIndexedf(ctx->Exec, (index, x, y, width, height));
4757 }
4758 }
4759
4760 static void GLAPIENTRY
4761 save_ViewportIndexedfv(GLuint index, const GLfloat *v)
4762 {
4763 GET_CURRENT_CONTEXT(ctx);
4764 Node *n;
4765 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4766 n = alloc_instruction(ctx, OPCODE_VIEWPORT_INDEXED_FV, 5);
4767 if (n) {
4768 n[1].ui = index;
4769 n[2].f = v[0];
4770 n[3].f = v[1];
4771 n[4].f = v[2];
4772 n[5].f = v[3];
4773 }
4774 if (ctx->ExecuteFlag) {
4775 CALL_ViewportIndexedfv(ctx->Exec, (index, v));
4776 }
4777 }
4778
4779 static void GLAPIENTRY
4780 save_ViewportArrayv(GLuint first, GLsizei count, const GLfloat *v)
4781 {
4782 GET_CURRENT_CONTEXT(ctx);
4783 Node *n;
4784 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4785 n = alloc_instruction(ctx, OPCODE_VIEWPORT_ARRAY_V, 2 + POINTER_DWORDS);
4786 if (n) {
4787 n[1].ui = first;
4788 n[2].si = count;
4789 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLfloat)));
4790 }
4791 if (ctx->ExecuteFlag) {
4792 CALL_ViewportArrayv(ctx->Exec, (first, count, v));
4793 }
4794 }
4795
4796 static void GLAPIENTRY
4797 save_ScissorIndexed(GLuint index, GLint left, GLint bottom, GLsizei width,
4798 GLsizei height)
4799 {
4800 GET_CURRENT_CONTEXT(ctx);
4801 Node *n;
4802 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4803 n = alloc_instruction(ctx, OPCODE_SCISSOR_INDEXED, 5);
4804 if (n) {
4805 n[1].ui = index;
4806 n[2].i = left;
4807 n[3].i = bottom;
4808 n[4].si = width;
4809 n[5].si = height;
4810 }
4811 if (ctx->ExecuteFlag) {
4812 CALL_ScissorIndexed(ctx->Exec, (index, left, bottom, width, height));
4813 }
4814 }
4815
4816 static void GLAPIENTRY
4817 save_ScissorIndexedv(GLuint index, const GLint *v)
4818 {
4819 GET_CURRENT_CONTEXT(ctx);
4820 Node *n;
4821 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4822 n = alloc_instruction(ctx, OPCODE_SCISSOR_INDEXED_V, 5);
4823 if (n) {
4824 n[1].ui = index;
4825 n[2].i = v[0];
4826 n[3].i = v[1];
4827 n[4].si = v[2];
4828 n[5].si = v[3];
4829 }
4830 if (ctx->ExecuteFlag) {
4831 CALL_ScissorIndexedv(ctx->Exec, (index, v));
4832 }
4833 }
4834
4835 static void GLAPIENTRY
4836 save_ScissorArrayv(GLuint first, GLsizei count, const GLint *v)
4837 {
4838 GET_CURRENT_CONTEXT(ctx);
4839 Node *n;
4840 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4841 n = alloc_instruction(ctx, OPCODE_SCISSOR_ARRAY_V, 2 + POINTER_DWORDS);
4842 if (n) {
4843 n[1].ui = first;
4844 n[2].si = count;
4845 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLint)));
4846 }
4847 if (ctx->ExecuteFlag) {
4848 CALL_ScissorArrayv(ctx->Exec, (first, count, v));
4849 }
4850 }
4851
4852 static void GLAPIENTRY
4853 save_DepthRangeIndexed(GLuint index, GLclampd n, GLclampd f)
4854 {
4855 GET_CURRENT_CONTEXT(ctx);
4856 Node *node;
4857 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4858 node = alloc_instruction(ctx, OPCODE_DEPTH_INDEXED, 3);
4859 if (node) {
4860 node[1].ui = index;
4861 /* Mesa stores these as floats internally so we deliberately convert
4862 * them to a float here.
4863 */
4864 node[2].f = n;
4865 node[3].f = f;
4866 }
4867 if (ctx->ExecuteFlag) {
4868 CALL_DepthRangeIndexed(ctx->Exec, (index, n, f));
4869 }
4870 }
4871
4872 static void GLAPIENTRY
4873 save_DepthRangeArrayv(GLuint first, GLsizei count, const GLclampd *v)
4874 {
4875 GET_CURRENT_CONTEXT(ctx);
4876 Node *n;
4877 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4878 n = alloc_instruction(ctx, OPCODE_DEPTH_ARRAY_V, 2 + POINTER_DWORDS);
4879 if (n) {
4880 n[1].ui = first;
4881 n[2].si = count;
4882 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLclampd)));
4883 }
4884 if (ctx->ExecuteFlag) {
4885 CALL_DepthRangeArrayv(ctx->Exec, (first, count, v));
4886 }
4887 }
4888
4889 static void GLAPIENTRY
4890 save_WindowPos4fMESA(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
4891 {
4892 GET_CURRENT_CONTEXT(ctx);
4893 Node *n;
4894 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4895 n = alloc_instruction(ctx, OPCODE_WINDOW_POS, 4);
4896 if (n) {
4897 n[1].f = x;
4898 n[2].f = y;
4899 n[3].f = z;
4900 n[4].f = w;
4901 }
4902 if (ctx->ExecuteFlag) {
4903 CALL_WindowPos4fMESA(ctx->Exec, (x, y, z, w));
4904 }
4905 }
4906
4907 static void GLAPIENTRY
4908 save_WindowPos2dMESA(GLdouble x, GLdouble y)
4909 {
4910 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
4911 }
4912
4913 static void GLAPIENTRY
4914 save_WindowPos2fMESA(GLfloat x, GLfloat y)
4915 {
4916 save_WindowPos4fMESA(x, y, 0.0F, 1.0F);
4917 }
4918
4919 static void GLAPIENTRY
4920 save_WindowPos2iMESA(GLint x, GLint y)
4921 {
4922 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
4923 }
4924
4925 static void GLAPIENTRY
4926 save_WindowPos2sMESA(GLshort x, GLshort y)
4927 {
4928 save_WindowPos4fMESA(x, y, 0.0F, 1.0F);
4929 }
4930
4931 static void GLAPIENTRY
4932 save_WindowPos3dMESA(GLdouble x, GLdouble y, GLdouble z)
4933 {
4934 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
4935 }
4936
4937 static void GLAPIENTRY
4938 save_WindowPos3fMESA(GLfloat x, GLfloat y, GLfloat z)
4939 {
4940 save_WindowPos4fMESA(x, y, z, 1.0F);
4941 }
4942
4943 static void GLAPIENTRY
4944 save_WindowPos3iMESA(GLint x, GLint y, GLint z)
4945 {
4946 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
4947 }
4948
4949 static void GLAPIENTRY
4950 save_WindowPos3sMESA(GLshort x, GLshort y, GLshort z)
4951 {
4952 save_WindowPos4fMESA(x, y, z, 1.0F);
4953 }
4954
4955 static void GLAPIENTRY
4956 save_WindowPos4dMESA(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
4957 {
4958 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
4959 }
4960
4961 static void GLAPIENTRY
4962 save_WindowPos4iMESA(GLint x, GLint y, GLint z, GLint w)
4963 {
4964 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
4965 }
4966
4967 static void GLAPIENTRY
4968 save_WindowPos4sMESA(GLshort x, GLshort y, GLshort z, GLshort w)
4969 {
4970 save_WindowPos4fMESA(x, y, z, w);
4971 }
4972
4973 static void GLAPIENTRY
4974 save_WindowPos2dvMESA(const GLdouble * v)
4975 {
4976 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
4977 }
4978
4979 static void GLAPIENTRY
4980 save_WindowPos2fvMESA(const GLfloat * v)
4981 {
4982 save_WindowPos4fMESA(v[0], v[1], 0.0F, 1.0F);
4983 }
4984
4985 static void GLAPIENTRY
4986 save_WindowPos2ivMESA(const GLint * v)
4987 {
4988 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
4989 }
4990
4991 static void GLAPIENTRY
4992 save_WindowPos2svMESA(const GLshort * v)
4993 {
4994 save_WindowPos4fMESA(v[0], v[1], 0.0F, 1.0F);
4995 }
4996
4997 static void GLAPIENTRY
4998 save_WindowPos3dvMESA(const GLdouble * v)
4999 {
5000 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
5001 }
5002
5003 static void GLAPIENTRY
5004 save_WindowPos3fvMESA(const GLfloat * v)
5005 {
5006 save_WindowPos4fMESA(v[0], v[1], v[2], 1.0F);
5007 }
5008
5009 static void GLAPIENTRY
5010 save_WindowPos3ivMESA(const GLint * v)
5011 {
5012 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
5013 }
5014
5015 static void GLAPIENTRY
5016 save_WindowPos3svMESA(const GLshort * v)
5017 {
5018 save_WindowPos4fMESA(v[0], v[1], v[2], 1.0F);
5019 }
5020
5021 static void GLAPIENTRY
5022 save_WindowPos4dvMESA(const GLdouble * v)
5023 {
5024 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1],
5025 (GLfloat) v[2], (GLfloat) v[3]);
5026 }
5027
5028 static void GLAPIENTRY
5029 save_WindowPos4fvMESA(const GLfloat * v)
5030 {
5031 save_WindowPos4fMESA(v[0], v[1], v[2], v[3]);
5032 }
5033
5034 static void GLAPIENTRY
5035 save_WindowPos4ivMESA(const GLint * v)
5036 {
5037 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1],
5038 (GLfloat) v[2], (GLfloat) v[3]);
5039 }
5040
5041 static void GLAPIENTRY
5042 save_WindowPos4svMESA(const GLshort * v)
5043 {
5044 save_WindowPos4fMESA(v[0], v[1], v[2], v[3]);
5045 }
5046
5047
5048
5049 /* GL_ARB_multitexture */
5050 static void GLAPIENTRY
5051 save_ActiveTextureARB(GLenum target)
5052 {
5053 GET_CURRENT_CONTEXT(ctx);
5054 Node *n;
5055 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5056 n = alloc_instruction(ctx, OPCODE_ACTIVE_TEXTURE, 1);
5057 if (n) {
5058 n[1].e = target;
5059 }
5060 if (ctx->ExecuteFlag) {
5061 CALL_ActiveTexture(ctx->Exec, (target));
5062 }
5063 }
5064
5065
5066 /* GL_ARB_transpose_matrix */
5067
5068 static void GLAPIENTRY
5069 save_LoadTransposeMatrixdARB(const GLdouble m[16])
5070 {
5071 GLfloat tm[16];
5072 _math_transposefd(tm, m);
5073 save_LoadMatrixf(tm);
5074 }
5075
5076
5077 static void GLAPIENTRY
5078 save_LoadTransposeMatrixfARB(const GLfloat m[16])
5079 {
5080 GLfloat tm[16];
5081 _math_transposef(tm, m);
5082 save_LoadMatrixf(tm);
5083 }
5084
5085
5086 static void GLAPIENTRY
5087 save_MultTransposeMatrixdARB(const GLdouble m[16])
5088 {
5089 GLfloat tm[16];
5090 _math_transposefd(tm, m);
5091 save_MultMatrixf(tm);
5092 }
5093
5094
5095 static void GLAPIENTRY
5096 save_MultTransposeMatrixfARB(const GLfloat m[16])
5097 {
5098 GLfloat tm[16];
5099 _math_transposef(tm, m);
5100 save_MultMatrixf(tm);
5101 }
5102
5103 static GLvoid *copy_data(const GLvoid *data, GLsizei size, const char *func)
5104 {
5105 GET_CURRENT_CONTEXT(ctx);
5106 GLvoid *image;
5107
5108 if (!data)
5109 return NULL;
5110
5111 image = malloc(size);
5112 if (!image) {
5113 _mesa_error(ctx, GL_OUT_OF_MEMORY, "%s", func);
5114 return NULL;
5115 }
5116 memcpy(image, data, size);
5117
5118 return image;
5119 }
5120
5121
5122 /* GL_ARB_texture_compression */
5123 static void GLAPIENTRY
5124 save_CompressedTexImage1DARB(GLenum target, GLint level,
5125 GLenum internalFormat, GLsizei width,
5126 GLint border, GLsizei imageSize,
5127 const GLvoid * data)
5128 {
5129 GET_CURRENT_CONTEXT(ctx);
5130 if (target == GL_PROXY_TEXTURE_1D) {
5131 /* don't compile, execute immediately */
5132 CALL_CompressedTexImage1D(ctx->Exec, (target, level, internalFormat,
5133 width, border, imageSize,
5134 data));
5135 }
5136 else {
5137 Node *n;
5138 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5139
5140 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_1D,
5141 6 + POINTER_DWORDS);
5142 if (n) {
5143 n[1].e = target;
5144 n[2].i = level;
5145 n[3].e = internalFormat;
5146 n[4].i = (GLint) width;
5147 n[5].i = border;
5148 n[6].i = imageSize;
5149 save_pointer(&n[7],
5150 copy_data(data, imageSize, "glCompressedTexImage1DARB"));
5151 }
5152 if (ctx->ExecuteFlag) {
5153 CALL_CompressedTexImage1D(ctx->Exec,
5154 (target, level, internalFormat, width,
5155 border, imageSize, data));
5156 }
5157 }
5158 }
5159
5160
5161 static void GLAPIENTRY
5162 save_CompressedTexImage2DARB(GLenum target, GLint level,
5163 GLenum internalFormat, GLsizei width,
5164 GLsizei height, GLint border, GLsizei imageSize,
5165 const GLvoid * data)
5166 {
5167 GET_CURRENT_CONTEXT(ctx);
5168 if (target == GL_PROXY_TEXTURE_2D) {
5169 /* don't compile, execute immediately */
5170 CALL_CompressedTexImage2D(ctx->Exec, (target, level, internalFormat,
5171 width, height, border,
5172 imageSize, data));
5173 }
5174 else {
5175 Node *n;
5176 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5177
5178 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_2D,
5179 7 + POINTER_DWORDS);
5180 if (n) {
5181 n[1].e = target;
5182 n[2].i = level;
5183 n[3].e = internalFormat;
5184 n[4].i = (GLint) width;
5185 n[5].i = (GLint) height;
5186 n[6].i = border;
5187 n[7].i = imageSize;
5188 save_pointer(&n[8],
5189 copy_data(data, imageSize, "glCompressedTexImage2DARB"));
5190 }
5191 if (ctx->ExecuteFlag) {
5192 CALL_CompressedTexImage2D(ctx->Exec,
5193 (target, level, internalFormat, width,
5194 height, border, imageSize, data));
5195 }
5196 }
5197 }
5198
5199
5200 static void GLAPIENTRY
5201 save_CompressedTexImage3DARB(GLenum target, GLint level,
5202 GLenum internalFormat, GLsizei width,
5203 GLsizei height, GLsizei depth, GLint border,
5204 GLsizei imageSize, const GLvoid * data)
5205 {
5206 GET_CURRENT_CONTEXT(ctx);
5207 if (target == GL_PROXY_TEXTURE_3D) {
5208 /* don't compile, execute immediately */
5209 CALL_CompressedTexImage3D(ctx->Exec, (target, level, internalFormat,
5210 width, height, depth, border,
5211 imageSize, data));
5212 }
5213 else {
5214 Node *n;
5215 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5216
5217 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_3D,
5218 8 + POINTER_DWORDS);
5219 if (n) {
5220 n[1].e = target;
5221 n[2].i = level;
5222 n[3].e = internalFormat;
5223 n[4].i = (GLint) width;
5224 n[5].i = (GLint) height;
5225 n[6].i = (GLint) depth;
5226 n[7].i = border;
5227 n[8].i = imageSize;
5228 save_pointer(&n[9],
5229 copy_data(data, imageSize, "glCompressedTexImage3DARB"));
5230 }
5231 if (ctx->ExecuteFlag) {
5232 CALL_CompressedTexImage3D(ctx->Exec,
5233 (target, level, internalFormat, width,
5234 height, depth, border, imageSize,
5235 data));
5236 }
5237 }
5238 }
5239
5240
5241 static void GLAPIENTRY
5242 save_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset,
5243 GLsizei width, GLenum format,
5244 GLsizei imageSize, const GLvoid * data)
5245 {
5246 Node *n;
5247 GET_CURRENT_CONTEXT(ctx);
5248 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5249
5250 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D,
5251 6 + POINTER_DWORDS);
5252 if (n) {
5253 n[1].e = target;
5254 n[2].i = level;
5255 n[3].i = xoffset;
5256 n[4].i = (GLint) width;
5257 n[5].e = format;
5258 n[6].i = imageSize;
5259 save_pointer(&n[7],
5260 copy_data(data, imageSize, "glCompressedTexSubImage1DARB"));
5261 }
5262 if (ctx->ExecuteFlag) {
5263 CALL_CompressedTexSubImage1D(ctx->Exec, (target, level, xoffset,
5264 width, format, imageSize,
5265 data));
5266 }
5267 }
5268
5269
5270 static void GLAPIENTRY
5271 save_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset,
5272 GLint yoffset, GLsizei width, GLsizei height,
5273 GLenum format, GLsizei imageSize,
5274 const GLvoid * data)
5275 {
5276 Node *n;
5277 GET_CURRENT_CONTEXT(ctx);
5278 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5279
5280 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D,
5281 8 + POINTER_DWORDS);
5282 if (n) {
5283 n[1].e = target;
5284 n[2].i = level;
5285 n[3].i = xoffset;
5286 n[4].i = yoffset;
5287 n[5].i = (GLint) width;
5288 n[6].i = (GLint) height;
5289 n[7].e = format;
5290 n[8].i = imageSize;
5291 save_pointer(&n[9],
5292 copy_data(data, imageSize, "glCompressedTexSubImage2DARB"));
5293 }
5294 if (ctx->ExecuteFlag) {
5295 CALL_CompressedTexSubImage2D(ctx->Exec,
5296 (target, level, xoffset, yoffset, width,
5297 height, format, imageSize, data));
5298 }
5299 }
5300
5301
5302 static void GLAPIENTRY
5303 save_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset,
5304 GLint yoffset, GLint zoffset, GLsizei width,
5305 GLsizei height, GLsizei depth, GLenum format,
5306 GLsizei imageSize, const GLvoid * data)
5307 {
5308 Node *n;
5309 GET_CURRENT_CONTEXT(ctx);
5310 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5311
5312 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D,
5313 10 + POINTER_DWORDS);
5314 if (n) {
5315 n[1].e = target;
5316 n[2].i = level;
5317 n[3].i = xoffset;
5318 n[4].i = yoffset;
5319 n[5].i = zoffset;
5320 n[6].i = (GLint) width;
5321 n[7].i = (GLint) height;
5322 n[8].i = (GLint) depth;
5323 n[9].e = format;
5324 n[10].i = imageSize;
5325 save_pointer(&n[11],
5326 copy_data(data, imageSize, "glCompressedTexSubImage3DARB"));
5327 }
5328 if (ctx->ExecuteFlag) {
5329 CALL_CompressedTexSubImage3D(ctx->Exec,
5330 (target, level, xoffset, yoffset,
5331 zoffset, width, height, depth, format,
5332 imageSize, data));
5333 }
5334 }
5335
5336
5337 /* GL_ARB_multisample */
5338 static void GLAPIENTRY
5339 save_SampleCoverageARB(GLclampf value, GLboolean invert)
5340 {
5341 GET_CURRENT_CONTEXT(ctx);
5342 Node *n;
5343 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5344 n = alloc_instruction(ctx, OPCODE_SAMPLE_COVERAGE, 2);
5345 if (n) {
5346 n[1].f = value;
5347 n[2].b = invert;
5348 }
5349 if (ctx->ExecuteFlag) {
5350 CALL_SampleCoverage(ctx->Exec, (value, invert));
5351 }
5352 }
5353
5354
5355 /*
5356 * GL_ARB_vertex_program
5357 */
5358 static void GLAPIENTRY
5359 save_BindProgramARB(GLenum target, GLuint id)
5360 {
5361 GET_CURRENT_CONTEXT(ctx);
5362 Node *n;
5363 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5364 n = alloc_instruction(ctx, OPCODE_BIND_PROGRAM_ARB, 2);
5365 if (n) {
5366 n[1].e = target;
5367 n[2].ui = id;
5368 }
5369 if (ctx->ExecuteFlag) {
5370 CALL_BindProgramARB(ctx->Exec, (target, id));
5371 }
5372 }
5373
5374 static void GLAPIENTRY
5375 save_ProgramEnvParameter4fARB(GLenum target, GLuint index,
5376 GLfloat x, GLfloat y, GLfloat z, GLfloat w)
5377 {
5378 GET_CURRENT_CONTEXT(ctx);
5379 Node *n;
5380 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5381 n = alloc_instruction(ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6);
5382 if (n) {
5383 n[1].e = target;
5384 n[2].ui = index;
5385 n[3].f = x;
5386 n[4].f = y;
5387 n[5].f = z;
5388 n[6].f = w;
5389 }
5390 if (ctx->ExecuteFlag) {
5391 CALL_ProgramEnvParameter4fARB(ctx->Exec, (target, index, x, y, z, w));
5392 }
5393 }
5394
5395
5396 static void GLAPIENTRY
5397 save_ProgramEnvParameter4fvARB(GLenum target, GLuint index,
5398 const GLfloat *params)
5399 {
5400 save_ProgramEnvParameter4fARB(target, index, params[0], params[1],
5401 params[2], params[3]);
5402 }
5403
5404
5405 static void GLAPIENTRY
5406 save_ProgramEnvParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
5407 const GLfloat * params)
5408 {
5409 GET_CURRENT_CONTEXT(ctx);
5410 Node *n;
5411 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5412
5413 if (count > 0) {
5414 GLint i;
5415 const GLfloat * p = params;
5416
5417 for (i = 0 ; i < count ; i++) {
5418 n = alloc_instruction(ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6);
5419 if (n) {
5420 n[1].e = target;
5421 n[2].ui = index;
5422 n[3].f = p[0];
5423 n[4].f = p[1];
5424 n[5].f = p[2];
5425 n[6].f = p[3];
5426 p += 4;
5427 }
5428 }
5429 }
5430
5431 if (ctx->ExecuteFlag) {
5432 CALL_ProgramEnvParameters4fvEXT(ctx->Exec, (target, index, count, params));
5433 }
5434 }
5435
5436
5437 static void GLAPIENTRY
5438 save_ProgramEnvParameter4dARB(GLenum target, GLuint index,
5439 GLdouble x, GLdouble y, GLdouble z, GLdouble w)
5440 {
5441 save_ProgramEnvParameter4fARB(target, index,
5442 (GLfloat) x,
5443 (GLfloat) y, (GLfloat) z, (GLfloat) w);
5444 }
5445
5446
5447 static void GLAPIENTRY
5448 save_ProgramEnvParameter4dvARB(GLenum target, GLuint index,
5449 const GLdouble *params)
5450 {
5451 save_ProgramEnvParameter4fARB(target, index,
5452 (GLfloat) params[0],
5453 (GLfloat) params[1],
5454 (GLfloat) params[2], (GLfloat) params[3]);
5455 }
5456
5457
5458 static void GLAPIENTRY
5459 save_ProgramLocalParameter4fARB(GLenum target, GLuint index,
5460 GLfloat x, GLfloat y, GLfloat z, GLfloat w)
5461 {
5462 GET_CURRENT_CONTEXT(ctx);
5463 Node *n;
5464 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5465 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5466 if (n) {
5467 n[1].e = target;
5468 n[2].ui = index;
5469 n[3].f = x;
5470 n[4].f = y;
5471 n[5].f = z;
5472 n[6].f = w;
5473 }
5474 if (ctx->ExecuteFlag) {
5475 CALL_ProgramLocalParameter4fARB(ctx->Exec, (target, index, x, y, z, w));
5476 }
5477 }
5478
5479
5480 static void GLAPIENTRY
5481 save_ProgramLocalParameter4fvARB(GLenum target, GLuint index,
5482 const GLfloat *params)
5483 {
5484 GET_CURRENT_CONTEXT(ctx);
5485 Node *n;
5486 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5487 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5488 if (n) {
5489 n[1].e = target;
5490 n[2].ui = index;
5491 n[3].f = params[0];
5492 n[4].f = params[1];
5493 n[5].f = params[2];
5494 n[6].f = params[3];
5495 }
5496 if (ctx->ExecuteFlag) {
5497 CALL_ProgramLocalParameter4fvARB(ctx->Exec, (target, index, params));
5498 }
5499 }
5500
5501
5502 static void GLAPIENTRY
5503 save_ProgramLocalParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
5504 const GLfloat *params)
5505 {
5506 GET_CURRENT_CONTEXT(ctx);
5507 Node *n;
5508 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5509
5510 if (count > 0) {
5511 GLint i;
5512 const GLfloat * p = params;
5513
5514 for (i = 0 ; i < count ; i++) {
5515 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5516 if (n) {
5517 n[1].e = target;
5518 n[2].ui = index;
5519 n[3].f = p[0];
5520 n[4].f = p[1];
5521 n[5].f = p[2];
5522 n[6].f = p[3];
5523 p += 4;
5524 }
5525 }
5526 }
5527
5528 if (ctx->ExecuteFlag) {
5529 CALL_ProgramLocalParameters4fvEXT(ctx->Exec, (target, index, count, params));
5530 }
5531 }
5532
5533
5534 static void GLAPIENTRY
5535 save_ProgramLocalParameter4dARB(GLenum target, GLuint index,
5536 GLdouble x, GLdouble y,
5537 GLdouble z, GLdouble w)
5538 {
5539 GET_CURRENT_CONTEXT(ctx);
5540 Node *n;
5541 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5542 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5543 if (n) {
5544 n[1].e = target;
5545 n[2].ui = index;
5546 n[3].f = (GLfloat) x;
5547 n[4].f = (GLfloat) y;
5548 n[5].f = (GLfloat) z;
5549 n[6].f = (GLfloat) w;
5550 }
5551 if (ctx->ExecuteFlag) {
5552 CALL_ProgramLocalParameter4dARB(ctx->Exec, (target, index, x, y, z, w));
5553 }
5554 }
5555
5556
5557 static void GLAPIENTRY
5558 save_ProgramLocalParameter4dvARB(GLenum target, GLuint index,
5559 const GLdouble *params)
5560 {
5561 GET_CURRENT_CONTEXT(ctx);
5562 Node *n;
5563 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5564 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5565 if (n) {
5566 n[1].e = target;
5567 n[2].ui = index;
5568 n[3].f = (GLfloat) params[0];
5569 n[4].f = (GLfloat) params[1];
5570 n[5].f = (GLfloat) params[2];
5571 n[6].f = (GLfloat) params[3];
5572 }
5573 if (ctx->ExecuteFlag) {
5574 CALL_ProgramLocalParameter4dvARB(ctx->Exec, (target, index, params));
5575 }
5576 }
5577
5578
5579 /* GL_EXT_stencil_two_side */
5580 static void GLAPIENTRY
5581 save_ActiveStencilFaceEXT(GLenum face)
5582 {
5583 GET_CURRENT_CONTEXT(ctx);
5584 Node *n;
5585 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5586 n = alloc_instruction(ctx, OPCODE_ACTIVE_STENCIL_FACE_EXT, 1);
5587 if (n) {
5588 n[1].e = face;
5589 }
5590 if (ctx->ExecuteFlag) {
5591 CALL_ActiveStencilFaceEXT(ctx->Exec, (face));
5592 }
5593 }
5594
5595
5596 /* GL_EXT_depth_bounds_test */
5597 static void GLAPIENTRY
5598 save_DepthBoundsEXT(GLclampd zmin, GLclampd zmax)
5599 {
5600 GET_CURRENT_CONTEXT(ctx);
5601 Node *n;
5602 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5603 n = alloc_instruction(ctx, OPCODE_DEPTH_BOUNDS_EXT, 2);
5604 if (n) {
5605 n[1].f = (GLfloat) zmin;
5606 n[2].f = (GLfloat) zmax;
5607 }
5608 if (ctx->ExecuteFlag) {
5609 CALL_DepthBoundsEXT(ctx->Exec, (zmin, zmax));
5610 }
5611 }
5612
5613
5614
5615 static void GLAPIENTRY
5616 save_ProgramStringARB(GLenum target, GLenum format, GLsizei len,
5617 const GLvoid * string)
5618 {
5619 GET_CURRENT_CONTEXT(ctx);
5620 Node *n;
5621
5622 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5623
5624 n = alloc_instruction(ctx, OPCODE_PROGRAM_STRING_ARB, 3 + POINTER_DWORDS);
5625 if (n) {
5626 GLubyte *programCopy = malloc(len);
5627 if (!programCopy) {
5628 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramStringARB");
5629 return;
5630 }
5631 memcpy(programCopy, string, len);
5632 n[1].e = target;
5633 n[2].e = format;
5634 n[3].i = len;
5635 save_pointer(&n[4], programCopy);
5636 }
5637 if (ctx->ExecuteFlag) {
5638 CALL_ProgramStringARB(ctx->Exec, (target, format, len, string));
5639 }
5640 }
5641
5642
5643 static void GLAPIENTRY
5644 save_BeginQueryARB(GLenum target, GLuint id)
5645 {
5646 GET_CURRENT_CONTEXT(ctx);
5647 Node *n;
5648 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5649 n = alloc_instruction(ctx, OPCODE_BEGIN_QUERY_ARB, 2);
5650 if (n) {
5651 n[1].e = target;
5652 n[2].ui = id;
5653 }
5654 if (ctx->ExecuteFlag) {
5655 CALL_BeginQuery(ctx->Exec, (target, id));
5656 }
5657 }
5658
5659 static void GLAPIENTRY
5660 save_EndQueryARB(GLenum target)
5661 {
5662 GET_CURRENT_CONTEXT(ctx);
5663 Node *n;
5664 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5665 n = alloc_instruction(ctx, OPCODE_END_QUERY_ARB, 1);
5666 if (n) {
5667 n[1].e = target;
5668 }
5669 if (ctx->ExecuteFlag) {
5670 CALL_EndQuery(ctx->Exec, (target));
5671 }
5672 }
5673
5674 static void GLAPIENTRY
5675 save_QueryCounter(GLuint id, GLenum target)
5676 {
5677 GET_CURRENT_CONTEXT(ctx);
5678 Node *n;
5679 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5680 n = alloc_instruction(ctx, OPCODE_QUERY_COUNTER, 2);
5681 if (n) {
5682 n[1].ui = id;
5683 n[2].e = target;
5684 }
5685 if (ctx->ExecuteFlag) {
5686 CALL_QueryCounter(ctx->Exec, (id, target));
5687 }
5688 }
5689
5690 static void GLAPIENTRY
5691 save_BeginQueryIndexed(GLenum target, GLuint index, GLuint id)
5692 {
5693 GET_CURRENT_CONTEXT(ctx);
5694 Node *n;
5695 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5696 n = alloc_instruction(ctx, OPCODE_BEGIN_QUERY_INDEXED, 3);
5697 if (n) {
5698 n[1].e = target;
5699 n[2].ui = index;
5700 n[3].ui = id;
5701 }
5702 if (ctx->ExecuteFlag) {
5703 CALL_BeginQueryIndexed(ctx->Exec, (target, index, id));
5704 }
5705 }
5706
5707 static void GLAPIENTRY
5708 save_EndQueryIndexed(GLenum target, GLuint index)
5709 {
5710 GET_CURRENT_CONTEXT(ctx);
5711 Node *n;
5712 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5713 n = alloc_instruction(ctx, OPCODE_END_QUERY_INDEXED, 2);
5714 if (n) {
5715 n[1].e = target;
5716 n[2].ui = index;
5717 }
5718 if (ctx->ExecuteFlag) {
5719 CALL_EndQueryIndexed(ctx->Exec, (target, index));
5720 }
5721 }
5722
5723
5724 static void GLAPIENTRY
5725 save_DrawBuffersARB(GLsizei count, const GLenum * buffers)
5726 {
5727 GET_CURRENT_CONTEXT(ctx);
5728 Node *n;
5729 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5730 n = alloc_instruction(ctx, OPCODE_DRAW_BUFFERS_ARB, 1 + MAX_DRAW_BUFFERS);
5731 if (n) {
5732 GLint i;
5733 n[1].i = count;
5734 if (count > MAX_DRAW_BUFFERS)
5735 count = MAX_DRAW_BUFFERS;
5736 for (i = 0; i < count; i++) {
5737 n[2 + i].e = buffers[i];
5738 }
5739 }
5740 if (ctx->ExecuteFlag) {
5741 CALL_DrawBuffers(ctx->Exec, (count, buffers));
5742 }
5743 }
5744
5745 static void GLAPIENTRY
5746 save_BindFragmentShaderATI(GLuint id)
5747 {
5748 GET_CURRENT_CONTEXT(ctx);
5749 Node *n;
5750
5751 n = alloc_instruction(ctx, OPCODE_BIND_FRAGMENT_SHADER_ATI, 1);
5752 if (n) {
5753 n[1].ui = id;
5754 }
5755 if (ctx->ExecuteFlag) {
5756 CALL_BindFragmentShaderATI(ctx->Exec, (id));
5757 }
5758 }
5759
5760 static void GLAPIENTRY
5761 save_SetFragmentShaderConstantATI(GLuint dst, const GLfloat *value)
5762 {
5763 GET_CURRENT_CONTEXT(ctx);
5764 Node *n;
5765
5766 n = alloc_instruction(ctx, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI, 5);
5767 if (n) {
5768 n[1].ui = dst;
5769 n[2].f = value[0];
5770 n[3].f = value[1];
5771 n[4].f = value[2];
5772 n[5].f = value[3];
5773 }
5774 if (ctx->ExecuteFlag) {
5775 CALL_SetFragmentShaderConstantATI(ctx->Exec, (dst, value));
5776 }
5777 }
5778
5779 static void GLAPIENTRY
5780 save_Attr1fNV(GLenum attr, GLfloat x)
5781 {
5782 GET_CURRENT_CONTEXT(ctx);
5783 Node *n;
5784 SAVE_FLUSH_VERTICES(ctx);
5785 n = alloc_instruction(ctx, OPCODE_ATTR_1F_NV, 2);
5786 if (n) {
5787 n[1].e = attr;
5788 n[2].f = x;
5789 }
5790
5791 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5792 ctx->ListState.ActiveAttribSize[attr] = 1;
5793 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, 0, 0, 1);
5794
5795 if (ctx->ExecuteFlag) {
5796 CALL_VertexAttrib1fNV(ctx->Exec, (attr, x));
5797 }
5798 }
5799
5800 static void GLAPIENTRY
5801 save_Attr2fNV(GLenum attr, GLfloat x, GLfloat y)
5802 {
5803 GET_CURRENT_CONTEXT(ctx);
5804 Node *n;
5805 SAVE_FLUSH_VERTICES(ctx);
5806 n = alloc_instruction(ctx, OPCODE_ATTR_2F_NV, 3);
5807 if (n) {
5808 n[1].e = attr;
5809 n[2].f = x;
5810 n[3].f = y;
5811 }
5812
5813 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5814 ctx->ListState.ActiveAttribSize[attr] = 2;
5815 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, 0, 1);
5816
5817 if (ctx->ExecuteFlag) {
5818 CALL_VertexAttrib2fNV(ctx->Exec, (attr, x, y));
5819 }
5820 }
5821
5822 static void GLAPIENTRY
5823 save_Attr3fNV(GLenum attr, GLfloat x, GLfloat y, GLfloat z)
5824 {
5825 GET_CURRENT_CONTEXT(ctx);
5826 Node *n;
5827 SAVE_FLUSH_VERTICES(ctx);
5828 n = alloc_instruction(ctx, OPCODE_ATTR_3F_NV, 4);
5829 if (n) {
5830 n[1].e = attr;
5831 n[2].f = x;
5832 n[3].f = y;
5833 n[4].f = z;
5834 }
5835
5836 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5837 ctx->ListState.ActiveAttribSize[attr] = 3;
5838 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, 1);
5839
5840 if (ctx->ExecuteFlag) {
5841 CALL_VertexAttrib3fNV(ctx->Exec, (attr, x, y, z));
5842 }
5843 }
5844
5845 static void GLAPIENTRY
5846 save_Attr4fNV(GLenum attr, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
5847 {
5848 GET_CURRENT_CONTEXT(ctx);
5849 Node *n;
5850 SAVE_FLUSH_VERTICES(ctx);
5851 n = alloc_instruction(ctx, OPCODE_ATTR_4F_NV, 5);
5852 if (n) {
5853 n[1].e = attr;
5854 n[2].f = x;
5855 n[3].f = y;
5856 n[4].f = z;
5857 n[5].f = w;
5858 }
5859
5860 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5861 ctx->ListState.ActiveAttribSize[attr] = 4;
5862 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, w);
5863
5864 if (ctx->ExecuteFlag) {
5865 CALL_VertexAttrib4fNV(ctx->Exec, (attr, x, y, z, w));
5866 }
5867 }
5868
5869
5870 static void GLAPIENTRY
5871 save_Attr1fARB(GLenum attr, GLfloat x)
5872 {
5873 GET_CURRENT_CONTEXT(ctx);
5874 Node *n;
5875 SAVE_FLUSH_VERTICES(ctx);
5876 n = alloc_instruction(ctx, OPCODE_ATTR_1F_ARB, 2);
5877 if (n) {
5878 n[1].e = attr;
5879 n[2].f = x;
5880 }
5881
5882 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5883 ctx->ListState.ActiveAttribSize[attr] = 1;
5884 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, 0, 0, 1);
5885
5886 if (ctx->ExecuteFlag) {
5887 CALL_VertexAttrib1fARB(ctx->Exec, (attr, x));
5888 }
5889 }
5890
5891 static void GLAPIENTRY
5892 save_Attr2fARB(GLenum attr, GLfloat x, GLfloat y)
5893 {
5894 GET_CURRENT_CONTEXT(ctx);
5895 Node *n;
5896 SAVE_FLUSH_VERTICES(ctx);
5897 n = alloc_instruction(ctx, OPCODE_ATTR_2F_ARB, 3);
5898 if (n) {
5899 n[1].e = attr;
5900 n[2].f = x;
5901 n[3].f = y;
5902 }
5903
5904 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5905 ctx->ListState.ActiveAttribSize[attr] = 2;
5906 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, 0, 1);
5907
5908 if (ctx->ExecuteFlag) {
5909 CALL_VertexAttrib2fARB(ctx->Exec, (attr, x, y));
5910 }
5911 }
5912
5913 static void GLAPIENTRY
5914 save_Attr3fARB(GLenum attr, GLfloat x, GLfloat y, GLfloat z)
5915 {
5916 GET_CURRENT_CONTEXT(ctx);
5917 Node *n;
5918 SAVE_FLUSH_VERTICES(ctx);
5919 n = alloc_instruction(ctx, OPCODE_ATTR_3F_ARB, 4);
5920 if (n) {
5921 n[1].e = attr;
5922 n[2].f = x;
5923 n[3].f = y;
5924 n[4].f = z;
5925 }
5926
5927 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5928 ctx->ListState.ActiveAttribSize[attr] = 3;
5929 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, 1);
5930
5931 if (ctx->ExecuteFlag) {
5932 CALL_VertexAttrib3fARB(ctx->Exec, (attr, x, y, z));
5933 }
5934 }
5935
5936 static void GLAPIENTRY
5937 save_Attr4fARB(GLenum attr, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
5938 {
5939 GET_CURRENT_CONTEXT(ctx);
5940 Node *n;
5941 SAVE_FLUSH_VERTICES(ctx);
5942 n = alloc_instruction(ctx, OPCODE_ATTR_4F_ARB, 5);
5943 if (n) {
5944 n[1].e = attr;
5945 n[2].f = x;
5946 n[3].f = y;
5947 n[4].f = z;
5948 n[5].f = w;
5949 }
5950
5951 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5952 ctx->ListState.ActiveAttribSize[attr] = 4;
5953 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, w);
5954
5955 if (ctx->ExecuteFlag) {
5956 CALL_VertexAttrib4fARB(ctx->Exec, (attr, x, y, z, w));
5957 }
5958 }
5959
5960
5961 static void GLAPIENTRY
5962 save_EvalCoord1f(GLfloat x)
5963 {
5964 GET_CURRENT_CONTEXT(ctx);
5965 Node *n;
5966 SAVE_FLUSH_VERTICES(ctx);
5967 n = alloc_instruction(ctx, OPCODE_EVAL_C1, 1);
5968 if (n) {
5969 n[1].f = x;
5970 }
5971 if (ctx->ExecuteFlag) {
5972 CALL_EvalCoord1f(ctx->Exec, (x));
5973 }
5974 }
5975
5976 static void GLAPIENTRY
5977 save_EvalCoord1fv(const GLfloat * v)
5978 {
5979 save_EvalCoord1f(v[0]);
5980 }
5981
5982 static void GLAPIENTRY
5983 save_EvalCoord2f(GLfloat x, GLfloat y)
5984 {
5985 GET_CURRENT_CONTEXT(ctx);
5986 Node *n;
5987 SAVE_FLUSH_VERTICES(ctx);
5988 n = alloc_instruction(ctx, OPCODE_EVAL_C2, 2);
5989 if (n) {
5990 n[1].f = x;
5991 n[2].f = y;
5992 }
5993 if (ctx->ExecuteFlag) {
5994 CALL_EvalCoord2f(ctx->Exec, (x, y));
5995 }
5996 }
5997
5998 static void GLAPIENTRY
5999 save_EvalCoord2fv(const GLfloat * v)
6000 {
6001 save_EvalCoord2f(v[0], v[1]);
6002 }
6003
6004
6005 static void GLAPIENTRY
6006 save_EvalPoint1(GLint x)
6007 {
6008 GET_CURRENT_CONTEXT(ctx);
6009 Node *n;
6010 SAVE_FLUSH_VERTICES(ctx);
6011 n = alloc_instruction(ctx, OPCODE_EVAL_P1, 1);
6012 if (n) {
6013 n[1].i = x;
6014 }
6015 if (ctx->ExecuteFlag) {
6016 CALL_EvalPoint1(ctx->Exec, (x));
6017 }
6018 }
6019
6020 static void GLAPIENTRY
6021 save_EvalPoint2(GLint x, GLint y)
6022 {
6023 GET_CURRENT_CONTEXT(ctx);
6024 Node *n;
6025 SAVE_FLUSH_VERTICES(ctx);
6026 n = alloc_instruction(ctx, OPCODE_EVAL_P2, 2);
6027 if (n) {
6028 n[1].i = x;
6029 n[2].i = y;
6030 }
6031 if (ctx->ExecuteFlag) {
6032 CALL_EvalPoint2(ctx->Exec, (x, y));
6033 }
6034 }
6035
6036 static void GLAPIENTRY
6037 save_Indexf(GLfloat x)
6038 {
6039 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX, x);
6040 }
6041
6042 static void GLAPIENTRY
6043 save_Indexfv(const GLfloat * v)
6044 {
6045 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX, v[0]);
6046 }
6047
6048 static void GLAPIENTRY
6049 save_EdgeFlag(GLboolean x)
6050 {
6051 save_Attr1fNV(VERT_ATTRIB_EDGEFLAG, x ? 1.0f : 0.0f);
6052 }
6053
6054
6055 /**
6056 * Compare 'count' elements of vectors 'a' and 'b'.
6057 * \return GL_TRUE if equal, GL_FALSE if different.
6058 */
6059 static inline GLboolean
6060 compare_vec(const GLfloat *a, const GLfloat *b, GLuint count)
6061 {
6062 return memcmp( a, b, count * sizeof(GLfloat) ) == 0;
6063 }
6064
6065
6066 /**
6067 * This glMaterial function is used for glMaterial calls that are outside
6068 * a glBegin/End pair. For glMaterial inside glBegin/End, see the VBO code.
6069 */
6070 static void GLAPIENTRY
6071 save_Materialfv(GLenum face, GLenum pname, const GLfloat * param)
6072 {
6073 GET_CURRENT_CONTEXT(ctx);
6074 Node *n;
6075 int args, i;
6076 GLuint bitmask;
6077
6078 switch (face) {
6079 case GL_BACK:
6080 case GL_FRONT:
6081 case GL_FRONT_AND_BACK:
6082 break;
6083 default:
6084 _mesa_compile_error(ctx, GL_INVALID_ENUM, "glMaterial(face)");
6085 return;
6086 }
6087
6088 switch (pname) {
6089 case GL_EMISSION:
6090 case GL_AMBIENT:
6091 case GL_DIFFUSE:
6092 case GL_SPECULAR:
6093 case GL_AMBIENT_AND_DIFFUSE:
6094 args = 4;
6095 break;
6096 case GL_SHININESS:
6097 args = 1;
6098 break;
6099 case GL_COLOR_INDEXES:
6100 args = 3;
6101 break;
6102 default:
6103 _mesa_compile_error(ctx, GL_INVALID_ENUM, "glMaterial(pname)");
6104 return;
6105 }
6106
6107 if (ctx->ExecuteFlag) {
6108 CALL_Materialfv(ctx->Exec, (face, pname, param));
6109 }
6110
6111 bitmask = _mesa_material_bitmask(ctx, face, pname, ~0, NULL);
6112
6113 /* Try to eliminate redundant statechanges. Because it is legal to
6114 * call glMaterial even inside begin/end calls, don't need to worry
6115 * about ctx->Driver.CurrentSavePrimitive here.
6116 */
6117 for (i = 0; i < MAT_ATTRIB_MAX; i++) {
6118 if (bitmask & (1 << i)) {
6119 if (ctx->ListState.ActiveMaterialSize[i] == args &&
6120 compare_vec(ctx->ListState.CurrentMaterial[i], param, args)) {
6121 /* no change in material value */
6122 bitmask &= ~(1 << i);
6123 }
6124 else {
6125 ctx->ListState.ActiveMaterialSize[i] = args;
6126 COPY_SZ_4V(ctx->ListState.CurrentMaterial[i], args, param);
6127 }
6128 }
6129 }
6130
6131 /* If this call has no effect, return early */
6132 if (bitmask == 0)
6133 return;
6134
6135 SAVE_FLUSH_VERTICES(ctx);
6136
6137 n = alloc_instruction(ctx, OPCODE_MATERIAL, 6);
6138 if (n) {
6139 n[1].e = face;
6140 n[2].e = pname;
6141 for (i = 0; i < args; i++)
6142 n[3 + i].f = param[i];
6143 }
6144 }
6145
6146 static void GLAPIENTRY
6147 save_Begin(GLenum mode)
6148 {
6149 GET_CURRENT_CONTEXT(ctx);
6150
6151 if (!_mesa_is_valid_prim_mode(ctx, mode)) {
6152 /* compile this error into the display list */
6153 _mesa_compile_error(ctx, GL_INVALID_ENUM, "glBegin(mode)");
6154 }
6155 else if (_mesa_inside_dlist_begin_end(ctx)) {
6156 /* compile this error into the display list */
6157 _mesa_compile_error(ctx, GL_INVALID_OPERATION, "recursive glBegin");
6158 }
6159 else {
6160 ctx->Driver.CurrentSavePrimitive = mode;
6161
6162 vbo_save_NotifyBegin(ctx, mode, false);
6163 }
6164 }
6165
6166 static void GLAPIENTRY
6167 save_End(void)
6168 {
6169 GET_CURRENT_CONTEXT(ctx);
6170 SAVE_FLUSH_VERTICES(ctx);
6171 (void) alloc_instruction(ctx, OPCODE_END, 0);
6172 ctx->Driver.CurrentSavePrimitive = PRIM_OUTSIDE_BEGIN_END;
6173 if (ctx->ExecuteFlag) {
6174 CALL_End(ctx->Exec, ());
6175 }
6176 }
6177
6178 static void GLAPIENTRY
6179 save_Rectf(GLfloat a, GLfloat b, GLfloat c, GLfloat d)
6180 {
6181 GET_CURRENT_CONTEXT(ctx);
6182 Node *n;
6183 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6184 n = alloc_instruction(ctx, OPCODE_RECTF, 4);
6185 if (n) {
6186 n[1].f = a;
6187 n[2].f = b;
6188 n[3].f = c;
6189 n[4].f = d;
6190 }
6191 if (ctx->ExecuteFlag) {
6192 CALL_Rectf(ctx->Exec, (a, b, c, d));
6193 }
6194 }
6195
6196
6197 static void GLAPIENTRY
6198 save_Vertex2f(GLfloat x, GLfloat y)
6199 {
6200 save_Attr2fNV(VERT_ATTRIB_POS, x, y);
6201 }
6202
6203 static void GLAPIENTRY
6204 save_Vertex2fv(const GLfloat * v)
6205 {
6206 save_Attr2fNV(VERT_ATTRIB_POS, v[0], v[1]);
6207 }
6208
6209 static void GLAPIENTRY
6210 save_Vertex3f(GLfloat x, GLfloat y, GLfloat z)
6211 {
6212 save_Attr3fNV(VERT_ATTRIB_POS, x, y, z);
6213 }
6214
6215 static void GLAPIENTRY
6216 save_Vertex3fv(const GLfloat * v)
6217 {
6218 save_Attr3fNV(VERT_ATTRIB_POS, v[0], v[1], v[2]);
6219 }
6220
6221 static void GLAPIENTRY
6222 save_Vertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
6223 {
6224 save_Attr4fNV(VERT_ATTRIB_POS, x, y, z, w);
6225 }
6226
6227 static void GLAPIENTRY
6228 save_Vertex4fv(const GLfloat * v)
6229 {
6230 save_Attr4fNV(VERT_ATTRIB_POS, v[0], v[1], v[2], v[3]);
6231 }
6232
6233 static void GLAPIENTRY
6234 save_TexCoord1f(GLfloat x)
6235 {
6236 save_Attr1fNV(VERT_ATTRIB_TEX0, x);
6237 }
6238
6239 static void GLAPIENTRY
6240 save_TexCoord1fv(const GLfloat * v)
6241 {
6242 save_Attr1fNV(VERT_ATTRIB_TEX0, v[0]);
6243 }
6244
6245 static void GLAPIENTRY
6246 save_TexCoord2f(GLfloat x, GLfloat y)
6247 {
6248 save_Attr2fNV(VERT_ATTRIB_TEX0, x, y);
6249 }
6250
6251 static void GLAPIENTRY
6252 save_TexCoord2fv(const GLfloat * v)
6253 {
6254 save_Attr2fNV(VERT_ATTRIB_TEX0, v[0], v[1]);
6255 }
6256
6257 static void GLAPIENTRY
6258 save_TexCoord3f(GLfloat x, GLfloat y, GLfloat z)
6259 {
6260 save_Attr3fNV(VERT_ATTRIB_TEX0, x, y, z);
6261 }
6262
6263 static void GLAPIENTRY
6264 save_TexCoord3fv(const GLfloat * v)
6265 {
6266 save_Attr3fNV(VERT_ATTRIB_TEX0, v[0], v[1], v[2]);
6267 }
6268
6269 static void GLAPIENTRY
6270 save_TexCoord4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
6271 {
6272 save_Attr4fNV(VERT_ATTRIB_TEX0, x, y, z, w);
6273 }
6274
6275 static void GLAPIENTRY
6276 save_TexCoord4fv(const GLfloat * v)
6277 {
6278 save_Attr4fNV(VERT_ATTRIB_TEX0, v[0], v[1], v[2], v[3]);
6279 }
6280
6281 static void GLAPIENTRY
6282 save_Normal3f(GLfloat x, GLfloat y, GLfloat z)
6283 {
6284 save_Attr3fNV(VERT_ATTRIB_NORMAL, x, y, z);
6285 }
6286
6287 static void GLAPIENTRY
6288 save_Normal3fv(const GLfloat * v)
6289 {
6290 save_Attr3fNV(VERT_ATTRIB_NORMAL, v[0], v[1], v[2]);
6291 }
6292
6293 static void GLAPIENTRY
6294 save_FogCoordfEXT(GLfloat x)
6295 {
6296 save_Attr1fNV(VERT_ATTRIB_FOG, x);
6297 }
6298
6299 static void GLAPIENTRY
6300 save_FogCoordfvEXT(const GLfloat * v)
6301 {
6302 save_Attr1fNV(VERT_ATTRIB_FOG, v[0]);
6303 }
6304
6305 static void GLAPIENTRY
6306 save_Color3f(GLfloat x, GLfloat y, GLfloat z)
6307 {
6308 save_Attr3fNV(VERT_ATTRIB_COLOR0, x, y, z);
6309 }
6310
6311 static void GLAPIENTRY
6312 save_Color3fv(const GLfloat * v)
6313 {
6314 save_Attr3fNV(VERT_ATTRIB_COLOR0, v[0], v[1], v[2]);
6315 }
6316
6317 static void GLAPIENTRY
6318 save_Color4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
6319 {
6320 save_Attr4fNV(VERT_ATTRIB_COLOR0, x, y, z, w);
6321 }
6322
6323 static void GLAPIENTRY
6324 save_Color4fv(const GLfloat * v)
6325 {
6326 save_Attr4fNV(VERT_ATTRIB_COLOR0, v[0], v[1], v[2], v[3]);
6327 }
6328
6329 static void GLAPIENTRY
6330 save_SecondaryColor3fEXT(GLfloat x, GLfloat y, GLfloat z)
6331 {
6332 save_Attr3fNV(VERT_ATTRIB_COLOR1, x, y, z);
6333 }
6334
6335 static void GLAPIENTRY
6336 save_SecondaryColor3fvEXT(const GLfloat * v)
6337 {
6338 save_Attr3fNV(VERT_ATTRIB_COLOR1, v[0], v[1], v[2]);
6339 }
6340
6341
6342 /* Just call the respective ATTR for texcoord
6343 */
6344 static void GLAPIENTRY
6345 save_MultiTexCoord1f(GLenum target, GLfloat x)
6346 {
6347 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6348 save_Attr1fNV(attr, x);
6349 }
6350
6351 static void GLAPIENTRY
6352 save_MultiTexCoord1fv(GLenum target, const GLfloat * v)
6353 {
6354 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6355 save_Attr1fNV(attr, v[0]);
6356 }
6357
6358 static void GLAPIENTRY
6359 save_MultiTexCoord2f(GLenum target, GLfloat x, GLfloat y)
6360 {
6361 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6362 save_Attr2fNV(attr, x, y);
6363 }
6364
6365 static void GLAPIENTRY
6366 save_MultiTexCoord2fv(GLenum target, const GLfloat * v)
6367 {
6368 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6369 save_Attr2fNV(attr, v[0], v[1]);
6370 }
6371
6372 static void GLAPIENTRY
6373 save_MultiTexCoord3f(GLenum target, GLfloat x, GLfloat y, GLfloat z)
6374 {
6375 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6376 save_Attr3fNV(attr, x, y, z);
6377 }
6378
6379 static void GLAPIENTRY
6380 save_MultiTexCoord3fv(GLenum target, const GLfloat * v)
6381 {
6382 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6383 save_Attr3fNV(attr, v[0], v[1], v[2]);
6384 }
6385
6386 static void GLAPIENTRY
6387 save_MultiTexCoord4f(GLenum target, GLfloat x, GLfloat y,
6388 GLfloat z, GLfloat w)
6389 {
6390 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6391 save_Attr4fNV(attr, x, y, z, w);
6392 }
6393
6394 static void GLAPIENTRY
6395 save_MultiTexCoord4fv(GLenum target, const GLfloat * v)
6396 {
6397 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6398 save_Attr4fNV(attr, v[0], v[1], v[2], v[3]);
6399 }
6400
6401
6402 /**
6403 * Record a GL_INVALID_VALUE error when an invalid vertex attribute
6404 * index is found.
6405 */
6406 static void
6407 index_error(void)
6408 {
6409 GET_CURRENT_CONTEXT(ctx);
6410 _mesa_error(ctx, GL_INVALID_VALUE, "VertexAttribf(index)");
6411 }
6412
6413
6414
6415 static void GLAPIENTRY
6416 save_VertexAttrib1fARB(GLuint index, GLfloat x)
6417 {
6418 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6419 save_Attr1fARB(index, x);
6420 else
6421 index_error();
6422 }
6423
6424 static void GLAPIENTRY
6425 save_VertexAttrib1fvARB(GLuint index, const GLfloat * v)
6426 {
6427 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6428 save_Attr1fARB(index, v[0]);
6429 else
6430 index_error();
6431 }
6432
6433 static void GLAPIENTRY
6434 save_VertexAttrib2fARB(GLuint index, GLfloat x, GLfloat y)
6435 {
6436 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6437 save_Attr2fARB(index, x, y);
6438 else
6439 index_error();
6440 }
6441
6442 static void GLAPIENTRY
6443 save_VertexAttrib2fvARB(GLuint index, const GLfloat * v)
6444 {
6445 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6446 save_Attr2fARB(index, v[0], v[1]);
6447 else
6448 index_error();
6449 }
6450
6451 static void GLAPIENTRY
6452 save_VertexAttrib3fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z)
6453 {
6454 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6455 save_Attr3fARB(index, x, y, z);
6456 else
6457 index_error();
6458 }
6459
6460 static void GLAPIENTRY
6461 save_VertexAttrib3fvARB(GLuint index, const GLfloat * v)
6462 {
6463 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6464 save_Attr3fARB(index, v[0], v[1], v[2]);
6465 else
6466 index_error();
6467 }
6468
6469 static void GLAPIENTRY
6470 save_VertexAttrib4fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z,
6471 GLfloat w)
6472 {
6473 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6474 save_Attr4fARB(index, x, y, z, w);
6475 else
6476 index_error();
6477 }
6478
6479 static void GLAPIENTRY
6480 save_VertexAttrib4fvARB(GLuint index, const GLfloat * v)
6481 {
6482 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6483 save_Attr4fARB(index, v[0], v[1], v[2], v[3]);
6484 else
6485 index_error();
6486 }
6487
6488 static void GLAPIENTRY
6489 save_VertexAttribL1d(GLuint index, GLdouble x)
6490 {
6491 GET_CURRENT_CONTEXT(ctx);
6492
6493 if (index < MAX_VERTEX_GENERIC_ATTRIBS) {
6494 Node *n;
6495 SAVE_FLUSH_VERTICES(ctx);
6496 n = alloc_instruction(ctx, OPCODE_ATTR_1D, 3);
6497 if (n) {
6498 n[1].ui = index;
6499 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
6500 }
6501
6502 ctx->ListState.ActiveAttribSize[index] = 1;
6503 memcpy(ctx->ListState.CurrentAttrib[index], &n[2], sizeof(GLdouble));
6504
6505 if (ctx->ExecuteFlag) {
6506 CALL_VertexAttribL1d(ctx->Exec, (index, x));
6507 }
6508 } else {
6509 index_error();
6510 }
6511 }
6512
6513 static void GLAPIENTRY
6514 save_VertexAttribL1dv(GLuint index, const GLdouble *v)
6515 {
6516 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6517 save_VertexAttribL1d(index, v[0]);
6518 else
6519 index_error();
6520 }
6521
6522 static void GLAPIENTRY
6523 save_VertexAttribL2d(GLuint index, GLdouble x, GLdouble y)
6524 {
6525 GET_CURRENT_CONTEXT(ctx);
6526
6527 if (index < MAX_VERTEX_GENERIC_ATTRIBS) {
6528 Node *n;
6529 SAVE_FLUSH_VERTICES(ctx);
6530 n = alloc_instruction(ctx, OPCODE_ATTR_2D, 5);
6531 if (n) {
6532 n[1].ui = index;
6533 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
6534 ASSIGN_DOUBLE_TO_NODES(n, 4, y);
6535 }
6536
6537 ctx->ListState.ActiveAttribSize[index] = 2;
6538 memcpy(ctx->ListState.CurrentAttrib[index], &n[2],
6539 2 * sizeof(GLdouble));
6540
6541 if (ctx->ExecuteFlag) {
6542 CALL_VertexAttribL2d(ctx->Exec, (index, x, y));
6543 }
6544 } else {
6545 index_error();
6546 }
6547 }
6548
6549 static void GLAPIENTRY
6550 save_VertexAttribL2dv(GLuint index, const GLdouble *v)
6551 {
6552 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6553 save_VertexAttribL2d(index, v[0], v[1]);
6554 else
6555 index_error();
6556 }
6557
6558 static void GLAPIENTRY
6559 save_VertexAttribL3d(GLuint index, GLdouble x, GLdouble y, GLdouble z)
6560 {
6561 GET_CURRENT_CONTEXT(ctx);
6562
6563 if (index < MAX_VERTEX_GENERIC_ATTRIBS) {
6564 Node *n;
6565 SAVE_FLUSH_VERTICES(ctx);
6566 n = alloc_instruction(ctx, OPCODE_ATTR_3D, 7);
6567 if (n) {
6568 n[1].ui = index;
6569 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
6570 ASSIGN_DOUBLE_TO_NODES(n, 4, y);
6571 ASSIGN_DOUBLE_TO_NODES(n, 6, z);
6572 }
6573
6574 ctx->ListState.ActiveAttribSize[index] = 3;
6575 memcpy(ctx->ListState.CurrentAttrib[index], &n[2],
6576 3 * sizeof(GLdouble));
6577
6578 if (ctx->ExecuteFlag) {
6579 CALL_VertexAttribL3d(ctx->Exec, (index, x, y, z));
6580 }
6581 } else {
6582 index_error();
6583 }
6584 }
6585
6586 static void GLAPIENTRY
6587 save_VertexAttribL3dv(GLuint index, const GLdouble *v)
6588 {
6589 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6590 save_VertexAttribL3d(index, v[0], v[1], v[2]);
6591 else
6592 index_error();
6593 }
6594
6595 static void GLAPIENTRY
6596 save_VertexAttribL4d(GLuint index, GLdouble x, GLdouble y, GLdouble z,
6597 GLdouble w)
6598 {
6599 GET_CURRENT_CONTEXT(ctx);
6600
6601 if (index < MAX_VERTEX_GENERIC_ATTRIBS) {
6602 Node *n;
6603 SAVE_FLUSH_VERTICES(ctx);
6604 n = alloc_instruction(ctx, OPCODE_ATTR_4D, 9);
6605 if (n) {
6606 n[1].ui = index;
6607 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
6608 ASSIGN_DOUBLE_TO_NODES(n, 4, y);
6609 ASSIGN_DOUBLE_TO_NODES(n, 6, z);
6610 ASSIGN_DOUBLE_TO_NODES(n, 8, w);
6611 }
6612
6613 ctx->ListState.ActiveAttribSize[index] = 4;
6614 memcpy(ctx->ListState.CurrentAttrib[index], &n[2],
6615 4 * sizeof(GLdouble));
6616
6617 if (ctx->ExecuteFlag) {
6618 CALL_VertexAttribL4d(ctx->Exec, (index, x, y, z, w));
6619 }
6620 } else {
6621 index_error();
6622 }
6623 }
6624
6625 static void GLAPIENTRY
6626 save_VertexAttribL4dv(GLuint index, const GLdouble *v)
6627 {
6628 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6629 save_VertexAttribL4d(index, v[0], v[1], v[2], v[3]);
6630 else
6631 index_error();
6632 }
6633
6634 static void GLAPIENTRY
6635 save_PrimitiveRestartNV(void)
6636 {
6637 /* Note: this is used when outside a glBegin/End pair in a display list */
6638 GET_CURRENT_CONTEXT(ctx);
6639 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6640 (void) alloc_instruction(ctx, OPCODE_PRIMITIVE_RESTART_NV, 0);
6641 if (ctx->ExecuteFlag) {
6642 CALL_PrimitiveRestartNV(ctx->Exec, ());
6643 }
6644 }
6645
6646
6647 static void GLAPIENTRY
6648 save_BlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
6649 GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
6650 GLbitfield mask, GLenum filter)
6651 {
6652 GET_CURRENT_CONTEXT(ctx);
6653 Node *n;
6654 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6655 n = alloc_instruction(ctx, OPCODE_BLIT_FRAMEBUFFER, 10);
6656 if (n) {
6657 n[1].i = srcX0;
6658 n[2].i = srcY0;
6659 n[3].i = srcX1;
6660 n[4].i = srcY1;
6661 n[5].i = dstX0;
6662 n[6].i = dstY0;
6663 n[7].i = dstX1;
6664 n[8].i = dstY1;
6665 n[9].i = mask;
6666 n[10].e = filter;
6667 }
6668 if (ctx->ExecuteFlag) {
6669 CALL_BlitFramebuffer(ctx->Exec, (srcX0, srcY0, srcX1, srcY1,
6670 dstX0, dstY0, dstX1, dstY1,
6671 mask, filter));
6672 }
6673 }
6674
6675
6676 /** GL_EXT_provoking_vertex */
6677 static void GLAPIENTRY
6678 save_ProvokingVertexEXT(GLenum mode)
6679 {
6680 GET_CURRENT_CONTEXT(ctx);
6681 Node *n;
6682 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6683 n = alloc_instruction(ctx, OPCODE_PROVOKING_VERTEX, 1);
6684 if (n) {
6685 n[1].e = mode;
6686 }
6687 if (ctx->ExecuteFlag) {
6688 /*CALL_ProvokingVertex(ctx->Exec, (mode));*/
6689 _mesa_ProvokingVertex(mode);
6690 }
6691 }
6692
6693
6694 /** GL_EXT_transform_feedback */
6695 static void GLAPIENTRY
6696 save_BeginTransformFeedback(GLenum mode)
6697 {
6698 GET_CURRENT_CONTEXT(ctx);
6699 Node *n;
6700 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6701 n = alloc_instruction(ctx, OPCODE_BEGIN_TRANSFORM_FEEDBACK, 1);
6702 if (n) {
6703 n[1].e = mode;
6704 }
6705 if (ctx->ExecuteFlag) {
6706 CALL_BeginTransformFeedback(ctx->Exec, (mode));
6707 }
6708 }
6709
6710
6711 /** GL_EXT_transform_feedback */
6712 static void GLAPIENTRY
6713 save_EndTransformFeedback(void)
6714 {
6715 GET_CURRENT_CONTEXT(ctx);
6716 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6717 (void) alloc_instruction(ctx, OPCODE_END_TRANSFORM_FEEDBACK, 0);
6718 if (ctx->ExecuteFlag) {
6719 CALL_EndTransformFeedback(ctx->Exec, ());
6720 }
6721 }
6722
6723 static void GLAPIENTRY
6724 save_BindTransformFeedback(GLenum target, GLuint name)
6725 {
6726 GET_CURRENT_CONTEXT(ctx);
6727 Node *n;
6728 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6729 n = alloc_instruction(ctx, OPCODE_BIND_TRANSFORM_FEEDBACK, 2);
6730 if (n) {
6731 n[1].e = target;
6732 n[2].ui = name;
6733 }
6734 if (ctx->ExecuteFlag) {
6735 CALL_BindTransformFeedback(ctx->Exec, (target, name));
6736 }
6737 }
6738
6739 static void GLAPIENTRY
6740 save_PauseTransformFeedback(void)
6741 {
6742 GET_CURRENT_CONTEXT(ctx);
6743 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6744 (void) alloc_instruction(ctx, OPCODE_PAUSE_TRANSFORM_FEEDBACK, 0);
6745 if (ctx->ExecuteFlag) {
6746 CALL_PauseTransformFeedback(ctx->Exec, ());
6747 }
6748 }
6749
6750 static void GLAPIENTRY
6751 save_ResumeTransformFeedback(void)
6752 {
6753 GET_CURRENT_CONTEXT(ctx);
6754 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6755 (void) alloc_instruction(ctx, OPCODE_RESUME_TRANSFORM_FEEDBACK, 0);
6756 if (ctx->ExecuteFlag) {
6757 CALL_ResumeTransformFeedback(ctx->Exec, ());
6758 }
6759 }
6760
6761 static void GLAPIENTRY
6762 save_DrawTransformFeedback(GLenum mode, GLuint name)
6763 {
6764 GET_CURRENT_CONTEXT(ctx);
6765 Node *n;
6766 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6767 n = alloc_instruction(ctx, OPCODE_DRAW_TRANSFORM_FEEDBACK, 2);
6768 if (n) {
6769 n[1].e = mode;
6770 n[2].ui = name;
6771 }
6772 if (ctx->ExecuteFlag) {
6773 CALL_DrawTransformFeedback(ctx->Exec, (mode, name));
6774 }
6775 }
6776
6777 static void GLAPIENTRY
6778 save_DrawTransformFeedbackStream(GLenum mode, GLuint name, GLuint stream)
6779 {
6780 GET_CURRENT_CONTEXT(ctx);
6781 Node *n;
6782 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6783 n = alloc_instruction(ctx, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM, 3);
6784 if (n) {
6785 n[1].e = mode;
6786 n[2].ui = name;
6787 n[3].ui = stream;
6788 }
6789 if (ctx->ExecuteFlag) {
6790 CALL_DrawTransformFeedbackStream(ctx->Exec, (mode, name, stream));
6791 }
6792 }
6793
6794 static void GLAPIENTRY
6795 save_DrawTransformFeedbackInstanced(GLenum mode, GLuint name,
6796 GLsizei primcount)
6797 {
6798 GET_CURRENT_CONTEXT(ctx);
6799 Node *n;
6800 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6801 n = alloc_instruction(ctx, OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED, 3);
6802 if (n) {
6803 n[1].e = mode;
6804 n[2].ui = name;
6805 n[3].si = primcount;
6806 }
6807 if (ctx->ExecuteFlag) {
6808 CALL_DrawTransformFeedbackInstanced(ctx->Exec, (mode, name, primcount));
6809 }
6810 }
6811
6812 static void GLAPIENTRY
6813 save_DrawTransformFeedbackStreamInstanced(GLenum mode, GLuint name,
6814 GLuint stream, GLsizei primcount)
6815 {
6816 GET_CURRENT_CONTEXT(ctx);
6817 Node *n;
6818 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6819 n = alloc_instruction(ctx, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED, 4);
6820 if (n) {
6821 n[1].e = mode;
6822 n[2].ui = name;
6823 n[3].ui = stream;
6824 n[4].si = primcount;
6825 }
6826 if (ctx->ExecuteFlag) {
6827 CALL_DrawTransformFeedbackStreamInstanced(ctx->Exec, (mode, name, stream,
6828 primcount));
6829 }
6830 }
6831
6832 static void GLAPIENTRY
6833 save_DispatchCompute(GLuint num_groups_x, GLuint num_groups_y,
6834 GLuint num_groups_z)
6835 {
6836 GET_CURRENT_CONTEXT(ctx);
6837 Node *n;
6838 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6839 n = alloc_instruction(ctx, OPCODE_DISPATCH_COMPUTE, 3);
6840 if (n) {
6841 n[1].ui = num_groups_x;
6842 n[2].ui = num_groups_y;
6843 n[3].ui = num_groups_z;
6844 }
6845 if (ctx->ExecuteFlag) {
6846 CALL_DispatchCompute(ctx->Exec, (num_groups_x, num_groups_y,
6847 num_groups_z));
6848 }
6849 }
6850
6851 static void GLAPIENTRY
6852 save_DispatchComputeIndirect(GLintptr indirect)
6853 {
6854 GET_CURRENT_CONTEXT(ctx);
6855 _mesa_error(ctx, GL_INVALID_OPERATION,
6856 "glDispatchComputeIndirect() during display list compile");
6857 }
6858
6859 static void GLAPIENTRY
6860 save_UseProgram(GLuint program)
6861 {
6862 GET_CURRENT_CONTEXT(ctx);
6863 Node *n;
6864 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6865 n = alloc_instruction(ctx, OPCODE_USE_PROGRAM, 1);
6866 if (n) {
6867 n[1].ui = program;
6868 }
6869 if (ctx->ExecuteFlag) {
6870 CALL_UseProgram(ctx->Exec, (program));
6871 }
6872 }
6873
6874
6875 static void GLAPIENTRY
6876 save_Uniform1fARB(GLint location, GLfloat x)
6877 {
6878 GET_CURRENT_CONTEXT(ctx);
6879 Node *n;
6880 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6881 n = alloc_instruction(ctx, OPCODE_UNIFORM_1F, 2);
6882 if (n) {
6883 n[1].i = location;
6884 n[2].f = x;
6885 }
6886 if (ctx->ExecuteFlag) {
6887 CALL_Uniform1f(ctx->Exec, (location, x));
6888 }
6889 }
6890
6891
6892 static void GLAPIENTRY
6893 save_Uniform2fARB(GLint location, GLfloat x, GLfloat y)
6894 {
6895 GET_CURRENT_CONTEXT(ctx);
6896 Node *n;
6897 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6898 n = alloc_instruction(ctx, OPCODE_UNIFORM_2F, 3);
6899 if (n) {
6900 n[1].i = location;
6901 n[2].f = x;
6902 n[3].f = y;
6903 }
6904 if (ctx->ExecuteFlag) {
6905 CALL_Uniform2f(ctx->Exec, (location, x, y));
6906 }
6907 }
6908
6909
6910 static void GLAPIENTRY
6911 save_Uniform3fARB(GLint location, GLfloat x, GLfloat y, GLfloat z)
6912 {
6913 GET_CURRENT_CONTEXT(ctx);
6914 Node *n;
6915 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6916 n = alloc_instruction(ctx, OPCODE_UNIFORM_3F, 4);
6917 if (n) {
6918 n[1].i = location;
6919 n[2].f = x;
6920 n[3].f = y;
6921 n[4].f = z;
6922 }
6923 if (ctx->ExecuteFlag) {
6924 CALL_Uniform3f(ctx->Exec, (location, x, y, z));
6925 }
6926 }
6927
6928
6929 static void GLAPIENTRY
6930 save_Uniform4fARB(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
6931 {
6932 GET_CURRENT_CONTEXT(ctx);
6933 Node *n;
6934 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6935 n = alloc_instruction(ctx, OPCODE_UNIFORM_4F, 5);
6936 if (n) {
6937 n[1].i = location;
6938 n[2].f = x;
6939 n[3].f = y;
6940 n[4].f = z;
6941 n[5].f = w;
6942 }
6943 if (ctx->ExecuteFlag) {
6944 CALL_Uniform4f(ctx->Exec, (location, x, y, z, w));
6945 }
6946 }
6947
6948
6949 static void GLAPIENTRY
6950 save_Uniform1fvARB(GLint location, GLsizei count, const GLfloat *v)
6951 {
6952 GET_CURRENT_CONTEXT(ctx);
6953 Node *n;
6954 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6955 n = alloc_instruction(ctx, OPCODE_UNIFORM_1FV, 2 + POINTER_DWORDS);
6956 if (n) {
6957 n[1].i = location;
6958 n[2].i = count;
6959 save_pointer(&n[3], memdup(v, count * 1 * sizeof(GLfloat)));
6960 }
6961 if (ctx->ExecuteFlag) {
6962 CALL_Uniform1fv(ctx->Exec, (location, count, v));
6963 }
6964 }
6965
6966 static void GLAPIENTRY
6967 save_Uniform2fvARB(GLint location, GLsizei count, const GLfloat *v)
6968 {
6969 GET_CURRENT_CONTEXT(ctx);
6970 Node *n;
6971 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6972 n = alloc_instruction(ctx, OPCODE_UNIFORM_2FV, 2 + POINTER_DWORDS);
6973 if (n) {
6974 n[1].i = location;
6975 n[2].i = count;
6976 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLfloat)));
6977 }
6978 if (ctx->ExecuteFlag) {
6979 CALL_Uniform2fv(ctx->Exec, (location, count, v));
6980 }
6981 }
6982
6983 static void GLAPIENTRY
6984 save_Uniform3fvARB(GLint location, GLsizei count, const GLfloat *v)
6985 {
6986 GET_CURRENT_CONTEXT(ctx);
6987 Node *n;
6988 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6989 n = alloc_instruction(ctx, OPCODE_UNIFORM_3FV, 2 + POINTER_DWORDS);
6990 if (n) {
6991 n[1].i = location;
6992 n[2].i = count;
6993 save_pointer(&n[3], memdup(v, count * 3 * sizeof(GLfloat)));
6994 }
6995 if (ctx->ExecuteFlag) {
6996 CALL_Uniform3fv(ctx->Exec, (location, count, v));
6997 }
6998 }
6999
7000 static void GLAPIENTRY
7001 save_Uniform4fvARB(GLint location, GLsizei count, const GLfloat *v)
7002 {
7003 GET_CURRENT_CONTEXT(ctx);
7004 Node *n;
7005 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7006 n = alloc_instruction(ctx, OPCODE_UNIFORM_4FV, 2 + POINTER_DWORDS);
7007 if (n) {
7008 n[1].i = location;
7009 n[2].i = count;
7010 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLfloat)));
7011 }
7012 if (ctx->ExecuteFlag) {
7013 CALL_Uniform4fv(ctx->Exec, (location, count, v));
7014 }
7015 }
7016
7017
7018 static void GLAPIENTRY
7019 save_Uniform1d(GLint location, GLdouble x)
7020 {
7021 GET_CURRENT_CONTEXT(ctx);
7022 Node *n;
7023 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7024 n = alloc_instruction(ctx, OPCODE_UNIFORM_1D, 3);
7025 if (n) {
7026 n[1].i = location;
7027 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
7028 }
7029 if (ctx->ExecuteFlag) {
7030 CALL_Uniform1d(ctx->Exec, (location, x));
7031 }
7032 }
7033
7034
7035 static void GLAPIENTRY
7036 save_Uniform2d(GLint location, GLdouble x, GLdouble y)
7037 {
7038 GET_CURRENT_CONTEXT(ctx);
7039 Node *n;
7040 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7041 n = alloc_instruction(ctx, OPCODE_UNIFORM_2D, 5);
7042 if (n) {
7043 n[1].i = location;
7044 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
7045 ASSIGN_DOUBLE_TO_NODES(n, 4, y);
7046 }
7047 if (ctx->ExecuteFlag) {
7048 CALL_Uniform2d(ctx->Exec, (location, x, y));
7049 }
7050 }
7051
7052
7053 static void GLAPIENTRY
7054 save_Uniform3d(GLint location, GLdouble x, GLdouble y, GLdouble z)
7055 {
7056 GET_CURRENT_CONTEXT(ctx);
7057 Node *n;
7058 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7059 n = alloc_instruction(ctx, OPCODE_UNIFORM_3D, 7);
7060 if (n) {
7061 n[1].i = location;
7062 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
7063 ASSIGN_DOUBLE_TO_NODES(n, 4, y);
7064 ASSIGN_DOUBLE_TO_NODES(n, 6, z);
7065 }
7066 if (ctx->ExecuteFlag) {
7067 CALL_Uniform3d(ctx->Exec, (location, x, y, z));
7068 }
7069 }
7070
7071
7072 static void GLAPIENTRY
7073 save_Uniform4d(GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
7074 {
7075 GET_CURRENT_CONTEXT(ctx);
7076 Node *n;
7077 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7078 n = alloc_instruction(ctx, OPCODE_UNIFORM_4D, 9);
7079 if (n) {
7080 n[1].i = location;
7081 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
7082 ASSIGN_DOUBLE_TO_NODES(n, 4, y);
7083 ASSIGN_DOUBLE_TO_NODES(n, 6, z);
7084 ASSIGN_DOUBLE_TO_NODES(n, 8, w);
7085 }
7086 if (ctx->ExecuteFlag) {
7087 CALL_Uniform4d(ctx->Exec, (location, x, y, z, w));
7088 }
7089 }
7090
7091
7092 static void GLAPIENTRY
7093 save_Uniform1dv(GLint location, GLsizei count, const GLdouble *v)
7094 {
7095 GET_CURRENT_CONTEXT(ctx);
7096 Node *n;
7097 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7098 n = alloc_instruction(ctx, OPCODE_UNIFORM_1DV, 2 + POINTER_DWORDS);
7099 if (n) {
7100 n[1].i = location;
7101 n[2].i = count;
7102 save_pointer(&n[3], memdup(v, count * 1 * sizeof(GLdouble)));
7103 }
7104 if (ctx->ExecuteFlag) {
7105 CALL_Uniform1dv(ctx->Exec, (location, count, v));
7106 }
7107 }
7108
7109
7110 static void GLAPIENTRY
7111 save_Uniform2dv(GLint location, GLsizei count, const GLdouble *v)
7112 {
7113 GET_CURRENT_CONTEXT(ctx);
7114 Node *n;
7115 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7116 n = alloc_instruction(ctx, OPCODE_UNIFORM_2DV, 2 + POINTER_DWORDS);
7117 if (n) {
7118 n[1].i = location;
7119 n[2].i = count;
7120 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLdouble)));
7121 }
7122 if (ctx->ExecuteFlag) {
7123 CALL_Uniform2dv(ctx->Exec, (location, count, v));
7124 }
7125 }
7126
7127
7128 static void GLAPIENTRY
7129 save_Uniform3dv(GLint location, GLsizei count, const GLdouble *v)
7130 {
7131 GET_CURRENT_CONTEXT(ctx);
7132 Node *n;
7133 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7134 n = alloc_instruction(ctx, OPCODE_UNIFORM_3DV, 2 + POINTER_DWORDS);
7135 if (n) {
7136 n[1].i = location;
7137 n[2].i = count;
7138 save_pointer(&n[3], memdup(v, count * 3 * sizeof(GLdouble)));
7139 }
7140 if (ctx->ExecuteFlag) {
7141 CALL_Uniform3dv(ctx->Exec, (location, count, v));
7142 }
7143 }
7144
7145
7146 static void GLAPIENTRY
7147 save_Uniform4dv(GLint location, GLsizei count, const GLdouble *v)
7148 {
7149 GET_CURRENT_CONTEXT(ctx);
7150 Node *n;
7151 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7152 n = alloc_instruction(ctx, OPCODE_UNIFORM_4DV, 2 + POINTER_DWORDS);
7153 if (n) {
7154 n[1].i = location;
7155 n[2].i = count;
7156 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLdouble)));
7157 }
7158 if (ctx->ExecuteFlag) {
7159 CALL_Uniform4dv(ctx->Exec, (location, count, v));
7160 }
7161 }
7162
7163
7164 static void GLAPIENTRY
7165 save_Uniform1iARB(GLint location, GLint x)
7166 {
7167 GET_CURRENT_CONTEXT(ctx);
7168 Node *n;
7169 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7170 n = alloc_instruction(ctx, OPCODE_UNIFORM_1I, 2);
7171 if (n) {
7172 n[1].i = location;
7173 n[2].i = x;
7174 }
7175 if (ctx->ExecuteFlag) {
7176 CALL_Uniform1i(ctx->Exec, (location, x));
7177 }
7178 }
7179
7180 static void GLAPIENTRY
7181 save_Uniform2iARB(GLint location, GLint x, GLint y)
7182 {
7183 GET_CURRENT_CONTEXT(ctx);
7184 Node *n;
7185 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7186 n = alloc_instruction(ctx, OPCODE_UNIFORM_2I, 3);
7187 if (n) {
7188 n[1].i = location;
7189 n[2].i = x;
7190 n[3].i = y;
7191 }
7192 if (ctx->ExecuteFlag) {
7193 CALL_Uniform2i(ctx->Exec, (location, x, y));
7194 }
7195 }
7196
7197 static void GLAPIENTRY
7198 save_Uniform3iARB(GLint location, GLint x, GLint y, GLint z)
7199 {
7200 GET_CURRENT_CONTEXT(ctx);
7201 Node *n;
7202 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7203 n = alloc_instruction(ctx, OPCODE_UNIFORM_3I, 4);
7204 if (n) {
7205 n[1].i = location;
7206 n[2].i = x;
7207 n[3].i = y;
7208 n[4].i = z;
7209 }
7210 if (ctx->ExecuteFlag) {
7211 CALL_Uniform3i(ctx->Exec, (location, x, y, z));
7212 }
7213 }
7214
7215 static void GLAPIENTRY
7216 save_Uniform4iARB(GLint location, GLint x, GLint y, GLint z, GLint w)
7217 {
7218 GET_CURRENT_CONTEXT(ctx);
7219 Node *n;
7220 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7221 n = alloc_instruction(ctx, OPCODE_UNIFORM_4I, 5);
7222 if (n) {
7223 n[1].i = location;
7224 n[2].i = x;
7225 n[3].i = y;
7226 n[4].i = z;
7227 n[5].i = w;
7228 }
7229 if (ctx->ExecuteFlag) {
7230 CALL_Uniform4i(ctx->Exec, (location, x, y, z, w));
7231 }
7232 }
7233
7234
7235
7236 static void GLAPIENTRY
7237 save_Uniform1ivARB(GLint location, GLsizei count, const GLint *v)
7238 {
7239 GET_CURRENT_CONTEXT(ctx);
7240 Node *n;
7241 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7242 n = alloc_instruction(ctx, OPCODE_UNIFORM_1IV, 2 + POINTER_DWORDS);
7243 if (n) {
7244 n[1].i = location;
7245 n[2].i = count;
7246 save_pointer(&n[3], memdup(v, count * 1 * sizeof(GLint)));
7247 }
7248 if (ctx->ExecuteFlag) {
7249 CALL_Uniform1iv(ctx->Exec, (location, count, v));
7250 }
7251 }
7252
7253 static void GLAPIENTRY
7254 save_Uniform2ivARB(GLint location, GLsizei count, const GLint *v)
7255 {
7256 GET_CURRENT_CONTEXT(ctx);
7257 Node *n;
7258 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7259 n = alloc_instruction(ctx, OPCODE_UNIFORM_2IV, 2 + POINTER_DWORDS);
7260 if (n) {
7261 n[1].i = location;
7262 n[2].i = count;
7263 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLint)));
7264 }
7265 if (ctx->ExecuteFlag) {
7266 CALL_Uniform2iv(ctx->Exec, (location, count, v));
7267 }
7268 }
7269
7270 static void GLAPIENTRY
7271 save_Uniform3ivARB(GLint location, GLsizei count, const GLint *v)
7272 {
7273 GET_CURRENT_CONTEXT(ctx);
7274 Node *n;
7275 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7276 n = alloc_instruction(ctx, OPCODE_UNIFORM_3IV, 2 + POINTER_DWORDS);
7277 if (n) {
7278 n[1].i = location;
7279 n[2].i = count;
7280 save_pointer(&n[3], memdup(v, count * 3 * sizeof(GLint)));
7281 }
7282 if (ctx->ExecuteFlag) {
7283 CALL_Uniform3iv(ctx->Exec, (location, count, v));
7284 }
7285 }
7286
7287 static void GLAPIENTRY
7288 save_Uniform4ivARB(GLint location, GLsizei count, const GLint *v)
7289 {
7290 GET_CURRENT_CONTEXT(ctx);
7291 Node *n;
7292 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7293 n = alloc_instruction(ctx, OPCODE_UNIFORM_4IV, 2 + POINTER_DWORDS);
7294 if (n) {
7295 n[1].i = location;
7296 n[2].i = count;
7297 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLfloat)));
7298 }
7299 if (ctx->ExecuteFlag) {
7300 CALL_Uniform4iv(ctx->Exec, (location, count, v));
7301 }
7302 }
7303
7304
7305
7306 static void GLAPIENTRY
7307 save_Uniform1ui(GLint location, GLuint x)
7308 {
7309 GET_CURRENT_CONTEXT(ctx);
7310 Node *n;
7311 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7312 n = alloc_instruction(ctx, OPCODE_UNIFORM_1UI, 2);
7313 if (n) {
7314 n[1].i = location;
7315 n[2].i = x;
7316 }
7317 if (ctx->ExecuteFlag) {
7318 CALL_Uniform1ui(ctx->Exec, (location, x));
7319 }
7320 }
7321
7322 static void GLAPIENTRY
7323 save_Uniform2ui(GLint location, GLuint x, GLuint y)
7324 {
7325 GET_CURRENT_CONTEXT(ctx);
7326 Node *n;
7327 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7328 n = alloc_instruction(ctx, OPCODE_UNIFORM_2UI, 3);
7329 if (n) {
7330 n[1].i = location;
7331 n[2].i = x;
7332 n[3].i = y;
7333 }
7334 if (ctx->ExecuteFlag) {
7335 CALL_Uniform2ui(ctx->Exec, (location, x, y));
7336 }
7337 }
7338
7339 static void GLAPIENTRY
7340 save_Uniform3ui(GLint location, GLuint x, GLuint y, GLuint z)
7341 {
7342 GET_CURRENT_CONTEXT(ctx);
7343 Node *n;
7344 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7345 n = alloc_instruction(ctx, OPCODE_UNIFORM_3UI, 4);
7346 if (n) {
7347 n[1].i = location;
7348 n[2].i = x;
7349 n[3].i = y;
7350 n[4].i = z;
7351 }
7352 if (ctx->ExecuteFlag) {
7353 CALL_Uniform3ui(ctx->Exec, (location, x, y, z));
7354 }
7355 }
7356
7357 static void GLAPIENTRY
7358 save_Uniform4ui(GLint location, GLuint x, GLuint y, GLuint z, GLuint w)
7359 {
7360 GET_CURRENT_CONTEXT(ctx);
7361 Node *n;
7362 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7363 n = alloc_instruction(ctx, OPCODE_UNIFORM_4UI, 5);
7364 if (n) {
7365 n[1].i = location;
7366 n[2].i = x;
7367 n[3].i = y;
7368 n[4].i = z;
7369 n[5].i = w;
7370 }
7371 if (ctx->ExecuteFlag) {
7372 CALL_Uniform4ui(ctx->Exec, (location, x, y, z, w));
7373 }
7374 }
7375
7376
7377
7378 static void GLAPIENTRY
7379 save_Uniform1uiv(GLint location, GLsizei count, const GLuint *v)
7380 {
7381 GET_CURRENT_CONTEXT(ctx);
7382 Node *n;
7383 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7384 n = alloc_instruction(ctx, OPCODE_UNIFORM_1UIV, 2 + POINTER_DWORDS);
7385 if (n) {
7386 n[1].i = location;
7387 n[2].i = count;
7388 save_pointer(&n[3], memdup(v, count * 1 * sizeof(*v)));
7389 }
7390 if (ctx->ExecuteFlag) {
7391 CALL_Uniform1uiv(ctx->Exec, (location, count, v));
7392 }
7393 }
7394
7395 static void GLAPIENTRY
7396 save_Uniform2uiv(GLint location, GLsizei count, const GLuint *v)
7397 {
7398 GET_CURRENT_CONTEXT(ctx);
7399 Node *n;
7400 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7401 n = alloc_instruction(ctx, OPCODE_UNIFORM_2UIV, 2 + POINTER_DWORDS);
7402 if (n) {
7403 n[1].i = location;
7404 n[2].i = count;
7405 save_pointer(&n[3], memdup(v, count * 2 * sizeof(*v)));
7406 }
7407 if (ctx->ExecuteFlag) {
7408 CALL_Uniform2uiv(ctx->Exec, (location, count, v));
7409 }
7410 }
7411
7412 static void GLAPIENTRY
7413 save_Uniform3uiv(GLint location, GLsizei count, const GLuint *v)
7414 {
7415 GET_CURRENT_CONTEXT(ctx);
7416 Node *n;
7417 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7418 n = alloc_instruction(ctx, OPCODE_UNIFORM_3UIV, 2 + POINTER_DWORDS);
7419 if (n) {
7420 n[1].i = location;
7421 n[2].i = count;
7422 save_pointer(&n[3], memdup(v, count * 3 * sizeof(*v)));
7423 }
7424 if (ctx->ExecuteFlag) {
7425 CALL_Uniform3uiv(ctx->Exec, (location, count, v));
7426 }
7427 }
7428
7429 static void GLAPIENTRY
7430 save_Uniform4uiv(GLint location, GLsizei count, const GLuint *v)
7431 {
7432 GET_CURRENT_CONTEXT(ctx);
7433 Node *n;
7434 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7435 n = alloc_instruction(ctx, OPCODE_UNIFORM_4UIV, 2 + POINTER_DWORDS);
7436 if (n) {
7437 n[1].i = location;
7438 n[2].i = count;
7439 save_pointer(&n[3], memdup(v, count * 4 * sizeof(*v)));
7440 }
7441 if (ctx->ExecuteFlag) {
7442 CALL_Uniform4uiv(ctx->Exec, (location, count, v));
7443 }
7444 }
7445
7446
7447
7448 static void GLAPIENTRY
7449 save_UniformMatrix2fvARB(GLint location, GLsizei count, GLboolean transpose,
7450 const GLfloat *m)
7451 {
7452 GET_CURRENT_CONTEXT(ctx);
7453 Node *n;
7454 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7455 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX22, 3 + POINTER_DWORDS);
7456 if (n) {
7457 n[1].i = location;
7458 n[2].i = count;
7459 n[3].b = transpose;
7460 save_pointer(&n[4], memdup(m, count * 2 * 2 * sizeof(GLfloat)));
7461 }
7462 if (ctx->ExecuteFlag) {
7463 CALL_UniformMatrix2fv(ctx->Exec, (location, count, transpose, m));
7464 }
7465 }
7466
7467 static void GLAPIENTRY
7468 save_UniformMatrix3fvARB(GLint location, GLsizei count, GLboolean transpose,
7469 const GLfloat *m)
7470 {
7471 GET_CURRENT_CONTEXT(ctx);
7472 Node *n;
7473 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7474 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX33, 3 + POINTER_DWORDS);
7475 if (n) {
7476 n[1].i = location;
7477 n[2].i = count;
7478 n[3].b = transpose;
7479 save_pointer(&n[4], memdup(m, count * 3 * 3 * sizeof(GLfloat)));
7480 }
7481 if (ctx->ExecuteFlag) {
7482 CALL_UniformMatrix3fv(ctx->Exec, (location, count, transpose, m));
7483 }
7484 }
7485
7486 static void GLAPIENTRY
7487 save_UniformMatrix4fvARB(GLint location, GLsizei count, GLboolean transpose,
7488 const GLfloat *m)
7489 {
7490 GET_CURRENT_CONTEXT(ctx);
7491 Node *n;
7492 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7493 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX44, 3 + POINTER_DWORDS);
7494 if (n) {
7495 n[1].i = location;
7496 n[2].i = count;
7497 n[3].b = transpose;
7498 save_pointer(&n[4], memdup(m, count * 4 * 4 * sizeof(GLfloat)));
7499 }
7500 if (ctx->ExecuteFlag) {
7501 CALL_UniformMatrix4fv(ctx->Exec, (location, count, transpose, m));
7502 }
7503 }
7504
7505
7506 static void GLAPIENTRY
7507 save_UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose,
7508 const GLfloat *m)
7509 {
7510 GET_CURRENT_CONTEXT(ctx);
7511 Node *n;
7512 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7513 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX23, 3 + POINTER_DWORDS);
7514 if (n) {
7515 n[1].i = location;
7516 n[2].i = count;
7517 n[3].b = transpose;
7518 save_pointer(&n[4], memdup(m, count * 2 * 3 * sizeof(GLfloat)));
7519 }
7520 if (ctx->ExecuteFlag) {
7521 CALL_UniformMatrix2x3fv(ctx->Exec, (location, count, transpose, m));
7522 }
7523 }
7524
7525 static void GLAPIENTRY
7526 save_UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose,
7527 const GLfloat *m)
7528 {
7529 GET_CURRENT_CONTEXT(ctx);
7530 Node *n;
7531 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7532 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX32, 3 + POINTER_DWORDS);
7533 if (n) {
7534 n[1].i = location;
7535 n[2].i = count;
7536 n[3].b = transpose;
7537 save_pointer(&n[4], memdup(m, count * 3 * 2 * sizeof(GLfloat)));
7538 }
7539 if (ctx->ExecuteFlag) {
7540 CALL_UniformMatrix3x2fv(ctx->Exec, (location, count, transpose, m));
7541 }
7542 }
7543
7544
7545 static void GLAPIENTRY
7546 save_UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose,
7547 const GLfloat *m)
7548 {
7549 GET_CURRENT_CONTEXT(ctx);
7550 Node *n;
7551 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7552 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX24, 3 + POINTER_DWORDS);
7553 if (n) {
7554 n[1].i = location;
7555 n[2].i = count;
7556 n[3].b = transpose;
7557 save_pointer(&n[4], memdup(m, count * 2 * 4 * sizeof(GLfloat)));
7558 }
7559 if (ctx->ExecuteFlag) {
7560 CALL_UniformMatrix2x4fv(ctx->Exec, (location, count, transpose, m));
7561 }
7562 }
7563
7564 static void GLAPIENTRY
7565 save_UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose,
7566 const GLfloat *m)
7567 {
7568 GET_CURRENT_CONTEXT(ctx);
7569 Node *n;
7570 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7571 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX42, 3 + POINTER_DWORDS);
7572 if (n) {
7573 n[1].i = location;
7574 n[2].i = count;
7575 n[3].b = transpose;
7576 save_pointer(&n[4], memdup(m, count * 4 * 2 * sizeof(GLfloat)));
7577 }
7578 if (ctx->ExecuteFlag) {
7579 CALL_UniformMatrix4x2fv(ctx->Exec, (location, count, transpose, m));
7580 }
7581 }
7582
7583
7584 static void GLAPIENTRY
7585 save_UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose,
7586 const GLfloat *m)
7587 {
7588 GET_CURRENT_CONTEXT(ctx);
7589 Node *n;
7590 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7591 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX34, 3 + POINTER_DWORDS);
7592 if (n) {
7593 n[1].i = location;
7594 n[2].i = count;
7595 n[3].b = transpose;
7596 save_pointer(&n[4], memdup(m, count * 3 * 4 * sizeof(GLfloat)));
7597 }
7598 if (ctx->ExecuteFlag) {
7599 CALL_UniformMatrix3x4fv(ctx->Exec, (location, count, transpose, m));
7600 }
7601 }
7602
7603 static void GLAPIENTRY
7604 save_UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose,
7605 const GLfloat *m)
7606 {
7607 GET_CURRENT_CONTEXT(ctx);
7608 Node *n;
7609 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7610 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX43, 3 + POINTER_DWORDS);
7611 if (n) {
7612 n[1].i = location;
7613 n[2].i = count;
7614 n[3].b = transpose;
7615 save_pointer(&n[4], memdup(m, count * 4 * 3 * sizeof(GLfloat)));
7616 }
7617 if (ctx->ExecuteFlag) {
7618 CALL_UniformMatrix4x3fv(ctx->Exec, (location, count, transpose, m));
7619 }
7620 }
7621
7622
7623 static void GLAPIENTRY
7624 save_UniformMatrix2dv(GLint location, GLsizei count, GLboolean transpose,
7625 const GLdouble *m)
7626 {
7627 GET_CURRENT_CONTEXT(ctx);
7628 Node *n;
7629 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7630 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX22D, 3 + POINTER_DWORDS);
7631 if (n) {
7632 n[1].i = location;
7633 n[2].i = count;
7634 n[3].b = transpose;
7635 save_pointer(&n[4], memdup(m, count * 2 * 2 * sizeof(GLdouble)));
7636 }
7637 if (ctx->ExecuteFlag) {
7638 CALL_UniformMatrix2dv(ctx->Exec, (location, count, transpose, m));
7639 }
7640 }
7641
7642 static void GLAPIENTRY
7643 save_UniformMatrix3dv(GLint location, GLsizei count, GLboolean transpose,
7644 const GLdouble *m)
7645 {
7646 GET_CURRENT_CONTEXT(ctx);
7647 Node *n;
7648 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7649 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX33D, 3 + POINTER_DWORDS);
7650 if (n) {
7651 n[1].i = location;
7652 n[2].i = count;
7653 n[3].b = transpose;
7654 save_pointer(&n[4], memdup(m, count * 3 * 3 * sizeof(GLdouble)));
7655 }
7656 if (ctx->ExecuteFlag) {
7657 CALL_UniformMatrix3dv(ctx->Exec, (location, count, transpose, m));
7658 }
7659 }
7660
7661 static void GLAPIENTRY
7662 save_UniformMatrix4dv(GLint location, GLsizei count, GLboolean transpose,
7663 const GLdouble *m)
7664 {
7665 GET_CURRENT_CONTEXT(ctx);
7666 Node *n;
7667 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7668 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX44D, 3 + POINTER_DWORDS);
7669 if (n) {
7670 n[1].i = location;
7671 n[2].i = count;
7672 n[3].b = transpose;
7673 save_pointer(&n[4], memdup(m, count * 4 * 4 * sizeof(GLdouble)));
7674 }
7675 if (ctx->ExecuteFlag) {
7676 CALL_UniformMatrix4dv(ctx->Exec, (location, count, transpose, m));
7677 }
7678 }
7679
7680
7681 static void GLAPIENTRY
7682 save_UniformMatrix2x3dv(GLint location, GLsizei count, GLboolean transpose,
7683 const GLdouble *m)
7684 {
7685 GET_CURRENT_CONTEXT(ctx);
7686 Node *n;
7687 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7688 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX23D, 3 + POINTER_DWORDS);
7689 if (n) {
7690 n[1].i = location;
7691 n[2].i = count;
7692 n[3].b = transpose;
7693 save_pointer(&n[4], memdup(m, count * 2 * 3 * sizeof(GLdouble)));
7694 }
7695 if (ctx->ExecuteFlag) {
7696 CALL_UniformMatrix2x3dv(ctx->Exec, (location, count, transpose, m));
7697 }
7698 }
7699
7700
7701 static void GLAPIENTRY
7702 save_UniformMatrix3x2dv(GLint location, GLsizei count, GLboolean transpose,
7703 const GLdouble *m)
7704 {
7705 GET_CURRENT_CONTEXT(ctx);
7706 Node *n;
7707 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7708 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX32D, 3 + POINTER_DWORDS);
7709 if (n) {
7710 n[1].i = location;
7711 n[2].i = count;
7712 n[3].b = transpose;
7713 save_pointer(&n[4], memdup(m, count * 3 * 2 * sizeof(GLdouble)));
7714 }
7715 if (ctx->ExecuteFlag) {
7716 CALL_UniformMatrix3x2dv(ctx->Exec, (location, count, transpose, m));
7717 }
7718 }
7719
7720
7721 static void GLAPIENTRY
7722 save_UniformMatrix2x4dv(GLint location, GLsizei count, GLboolean transpose,
7723 const GLdouble *m)
7724 {
7725 GET_CURRENT_CONTEXT(ctx);
7726 Node *n;
7727 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7728 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX24D, 3 + POINTER_DWORDS);
7729 if (n) {
7730 n[1].i = location;
7731 n[2].i = count;
7732 n[3].b = transpose;
7733 save_pointer(&n[4], memdup(m, count * 2 * 4 * sizeof(GLdouble)));
7734 }
7735 if (ctx->ExecuteFlag) {
7736 CALL_UniformMatrix2x4dv(ctx->Exec, (location, count, transpose, m));
7737 }
7738 }
7739
7740 static void GLAPIENTRY
7741 save_UniformMatrix4x2dv(GLint location, GLsizei count, GLboolean transpose,
7742 const GLdouble *m)
7743 {
7744 GET_CURRENT_CONTEXT(ctx);
7745 Node *n;
7746 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7747 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX42D, 3 + POINTER_DWORDS);
7748 if (n) {
7749 n[1].i = location;
7750 n[2].i = count;
7751 n[3].b = transpose;
7752 save_pointer(&n[4], memdup(m, count * 4 * 2 * sizeof(GLdouble)));
7753 }
7754 if (ctx->ExecuteFlag) {
7755 CALL_UniformMatrix4x2dv(ctx->Exec, (location, count, transpose, m));
7756 }
7757 }
7758
7759
7760 static void GLAPIENTRY
7761 save_UniformMatrix3x4dv(GLint location, GLsizei count, GLboolean transpose,
7762 const GLdouble *m)
7763 {
7764 GET_CURRENT_CONTEXT(ctx);
7765 Node *n;
7766 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7767 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX34D, 3 + POINTER_DWORDS);
7768 if (n) {
7769 n[1].i = location;
7770 n[2].i = count;
7771 n[3].b = transpose;
7772 save_pointer(&n[4], memdup(m, count * 3 * 4 * sizeof(GLdouble)));
7773 }
7774 if (ctx->ExecuteFlag) {
7775 CALL_UniformMatrix3x4dv(ctx->Exec, (location, count, transpose, m));
7776 }
7777 }
7778
7779
7780 static void GLAPIENTRY
7781 save_UniformMatrix4x3dv(GLint location, GLsizei count, GLboolean transpose,
7782 const GLdouble *m)
7783 {
7784 GET_CURRENT_CONTEXT(ctx);
7785 Node *n;
7786 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7787 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX43D, 3 + POINTER_DWORDS);
7788 if (n) {
7789 n[1].i = location;
7790 n[2].i = count;
7791 n[3].b = transpose;
7792 save_pointer(&n[4], memdup(m, count * 4 * 3 * sizeof(GLdouble)));
7793 }
7794 if (ctx->ExecuteFlag) {
7795 CALL_UniformMatrix4x3dv(ctx->Exec, (location, count, transpose, m));
7796 }
7797 }
7798
7799
7800 static void GLAPIENTRY
7801 save_UseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program)
7802 {
7803 GET_CURRENT_CONTEXT(ctx);
7804 Node *n;
7805 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7806 n = alloc_instruction(ctx, OPCODE_USE_PROGRAM_STAGES, 3);
7807 if (n) {
7808 n[1].ui = pipeline;
7809 n[2].ui = stages;
7810 n[3].ui = program;
7811 }
7812 if (ctx->ExecuteFlag) {
7813 CALL_UseProgramStages(ctx->Exec, (pipeline, stages, program));
7814 }
7815 }
7816
7817 static void GLAPIENTRY
7818 save_ProgramUniform1f(GLuint program, GLint location, GLfloat x)
7819 {
7820 GET_CURRENT_CONTEXT(ctx);
7821 Node *n;
7822 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7823 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1F, 3);
7824 if (n) {
7825 n[1].ui = program;
7826 n[2].i = location;
7827 n[3].f = x;
7828 }
7829 if (ctx->ExecuteFlag) {
7830 CALL_ProgramUniform1f(ctx->Exec, (program, location, x));
7831 }
7832 }
7833
7834 static void GLAPIENTRY
7835 save_ProgramUniform2f(GLuint program, GLint location, GLfloat x, GLfloat y)
7836 {
7837 GET_CURRENT_CONTEXT(ctx);
7838 Node *n;
7839 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7840 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2F, 4);
7841 if (n) {
7842 n[1].ui = program;
7843 n[2].i = location;
7844 n[3].f = x;
7845 n[4].f = y;
7846 }
7847 if (ctx->ExecuteFlag) {
7848 CALL_ProgramUniform2f(ctx->Exec, (program, location, x, y));
7849 }
7850 }
7851
7852 static void GLAPIENTRY
7853 save_ProgramUniform3f(GLuint program, GLint location,
7854 GLfloat x, GLfloat y, GLfloat z)
7855 {
7856 GET_CURRENT_CONTEXT(ctx);
7857 Node *n;
7858 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7859 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3F, 5);
7860 if (n) {
7861 n[1].ui = program;
7862 n[2].i = location;
7863 n[3].f = x;
7864 n[4].f = y;
7865 n[5].f = z;
7866 }
7867 if (ctx->ExecuteFlag) {
7868 CALL_ProgramUniform3f(ctx->Exec, (program, location, x, y, z));
7869 }
7870 }
7871
7872 static void GLAPIENTRY
7873 save_ProgramUniform4f(GLuint program, GLint location,
7874 GLfloat x, GLfloat y, GLfloat z, GLfloat w)
7875 {
7876 GET_CURRENT_CONTEXT(ctx);
7877 Node *n;
7878 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7879 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4F, 6);
7880 if (n) {
7881 n[1].ui = program;
7882 n[2].i = location;
7883 n[3].f = x;
7884 n[4].f = y;
7885 n[5].f = z;
7886 n[6].f = w;
7887 }
7888 if (ctx->ExecuteFlag) {
7889 CALL_ProgramUniform4f(ctx->Exec, (program, location, x, y, z, w));
7890 }
7891 }
7892
7893 static void GLAPIENTRY
7894 save_ProgramUniform1fv(GLuint program, GLint location, GLsizei count,
7895 const GLfloat *v)
7896 {
7897 GET_CURRENT_CONTEXT(ctx);
7898 Node *n;
7899 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7900 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1FV, 3 + POINTER_DWORDS);
7901 if (n) {
7902 n[1].ui = program;
7903 n[2].i = location;
7904 n[3].i = count;
7905 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLfloat)));
7906 }
7907 if (ctx->ExecuteFlag) {
7908 CALL_ProgramUniform1fv(ctx->Exec, (program, location, count, v));
7909 }
7910 }
7911
7912 static void GLAPIENTRY
7913 save_ProgramUniform2fv(GLuint program, GLint location, GLsizei count,
7914 const GLfloat *v)
7915 {
7916 GET_CURRENT_CONTEXT(ctx);
7917 Node *n;
7918 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7919 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2FV, 3 + POINTER_DWORDS);
7920 if (n) {
7921 n[1].ui = program;
7922 n[2].i = location;
7923 n[3].i = count;
7924 save_pointer(&n[4], memdup(v, count * 2 * sizeof(GLfloat)));
7925 }
7926 if (ctx->ExecuteFlag) {
7927 CALL_ProgramUniform2fv(ctx->Exec, (program, location, count, v));
7928 }
7929 }
7930
7931 static void GLAPIENTRY
7932 save_ProgramUniform3fv(GLuint program, GLint location, GLsizei count,
7933 const GLfloat *v)
7934 {
7935 GET_CURRENT_CONTEXT(ctx);
7936 Node *n;
7937 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7938 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3FV, 3 + POINTER_DWORDS);
7939 if (n) {
7940 n[1].ui = program;
7941 n[2].i = location;
7942 n[3].i = count;
7943 save_pointer(&n[4], memdup(v, count * 3 * sizeof(GLfloat)));
7944 }
7945 if (ctx->ExecuteFlag) {
7946 CALL_ProgramUniform3fv(ctx->Exec, (program, location, count, v));
7947 }
7948 }
7949
7950 static void GLAPIENTRY
7951 save_ProgramUniform4fv(GLuint program, GLint location, GLsizei count,
7952 const GLfloat *v)
7953 {
7954 GET_CURRENT_CONTEXT(ctx);
7955 Node *n;
7956 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7957 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4FV, 3 + POINTER_DWORDS);
7958 if (n) {
7959 n[1].ui = program;
7960 n[2].i = location;
7961 n[3].i = count;
7962 save_pointer(&n[4], memdup(v, count * 4 * sizeof(GLfloat)));
7963 }
7964 if (ctx->ExecuteFlag) {
7965 CALL_ProgramUniform4fv(ctx->Exec, (program, location, count, v));
7966 }
7967 }
7968
7969 static void GLAPIENTRY
7970 save_ProgramUniform1d(GLuint program, GLint location, GLdouble x)
7971 {
7972 GET_CURRENT_CONTEXT(ctx);
7973 Node *n;
7974 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7975 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1D, 4);
7976 if (n) {
7977 n[1].ui = program;
7978 n[2].i = location;
7979 ASSIGN_DOUBLE_TO_NODES(n, 3, x);
7980 }
7981 if (ctx->ExecuteFlag) {
7982 CALL_ProgramUniform1d(ctx->Exec, (program, location, x));
7983 }
7984 }
7985
7986 static void GLAPIENTRY
7987 save_ProgramUniform2d(GLuint program, GLint location, GLdouble x, GLdouble y)
7988 {
7989 GET_CURRENT_CONTEXT(ctx);
7990 Node *n;
7991 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7992 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2D, 6);
7993 if (n) {
7994 n[1].ui = program;
7995 n[2].i = location;
7996 ASSIGN_DOUBLE_TO_NODES(n, 3, x);
7997 ASSIGN_DOUBLE_TO_NODES(n, 5, y);
7998 }
7999 if (ctx->ExecuteFlag) {
8000 CALL_ProgramUniform2d(ctx->Exec, (program, location, x, y));
8001 }
8002 }
8003
8004 static void GLAPIENTRY
8005 save_ProgramUniform3d(GLuint program, GLint location,
8006 GLdouble x, GLdouble y, GLdouble z)
8007 {
8008 GET_CURRENT_CONTEXT(ctx);
8009 Node *n;
8010 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8011 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3D, 8);
8012 if (n) {
8013 n[1].ui = program;
8014 n[2].i = location;
8015 ASSIGN_DOUBLE_TO_NODES(n, 3, x);
8016 ASSIGN_DOUBLE_TO_NODES(n, 5, y);
8017 ASSIGN_DOUBLE_TO_NODES(n, 7, z);
8018 }
8019 if (ctx->ExecuteFlag) {
8020 CALL_ProgramUniform3d(ctx->Exec, (program, location, x, y, z));
8021 }
8022 }
8023
8024 static void GLAPIENTRY
8025 save_ProgramUniform4d(GLuint program, GLint location,
8026 GLdouble x, GLdouble y, GLdouble z, GLdouble w)
8027 {
8028 GET_CURRENT_CONTEXT(ctx);
8029 Node *n;
8030 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8031 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4D, 10);
8032 if (n) {
8033 n[1].ui = program;
8034 n[2].i = location;
8035 ASSIGN_DOUBLE_TO_NODES(n, 3, x);
8036 ASSIGN_DOUBLE_TO_NODES(n, 5, y);
8037 ASSIGN_DOUBLE_TO_NODES(n, 7, z);
8038 ASSIGN_DOUBLE_TO_NODES(n, 9, w);
8039 }
8040 if (ctx->ExecuteFlag) {
8041 CALL_ProgramUniform4d(ctx->Exec, (program, location, x, y, z, w));
8042 }
8043 }
8044
8045 static void GLAPIENTRY
8046 save_ProgramUniform1dv(GLuint program, GLint location, GLsizei count,
8047 const GLdouble *v)
8048 {
8049 GET_CURRENT_CONTEXT(ctx);
8050 Node *n;
8051 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8052 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1DV, 3 + POINTER_DWORDS);
8053 if (n) {
8054 n[1].ui = program;
8055 n[2].i = location;
8056 n[3].i = count;
8057 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLdouble)));
8058 }
8059 if (ctx->ExecuteFlag) {
8060 CALL_ProgramUniform1dv(ctx->Exec, (program, location, count, v));
8061 }
8062 }
8063
8064 static void GLAPIENTRY
8065 save_ProgramUniform2dv(GLuint program, GLint location, GLsizei count,
8066 const GLdouble *v)
8067 {
8068 GET_CURRENT_CONTEXT(ctx);
8069 Node *n;
8070 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8071 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2DV, 3 + POINTER_DWORDS);
8072 if (n) {
8073 n[1].ui = program;
8074 n[2].i = location;
8075 n[3].i = count;
8076 save_pointer(&n[4], memdup(v, count * 2 * sizeof(GLdouble)));
8077 }
8078 if (ctx->ExecuteFlag) {
8079 CALL_ProgramUniform2dv(ctx->Exec, (program, location, count, v));
8080 }
8081 }
8082
8083 static void GLAPIENTRY
8084 save_ProgramUniform3dv(GLuint program, GLint location, GLsizei count,
8085 const GLdouble *v)
8086 {
8087 GET_CURRENT_CONTEXT(ctx);
8088 Node *n;
8089 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8090 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3DV, 3 + POINTER_DWORDS);
8091 if (n) {
8092 n[1].ui = program;
8093 n[2].i = location;
8094 n[3].i = count;
8095 save_pointer(&n[4], memdup(v, count * 3 * sizeof(GLdouble)));
8096 }
8097 if (ctx->ExecuteFlag) {
8098 CALL_ProgramUniform3dv(ctx->Exec, (program, location, count, v));
8099 }
8100 }
8101
8102 static void GLAPIENTRY
8103 save_ProgramUniform4dv(GLuint program, GLint location, GLsizei count,
8104 const GLdouble *v)
8105 {
8106 GET_CURRENT_CONTEXT(ctx);
8107 Node *n;
8108 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8109 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4DV, 3 + POINTER_DWORDS);
8110 if (n) {
8111 n[1].ui = program;
8112 n[2].i = location;
8113 n[3].i = count;
8114 save_pointer(&n[4], memdup(v, count * 4 * sizeof(GLdouble)));
8115 }
8116 if (ctx->ExecuteFlag) {
8117 CALL_ProgramUniform4dv(ctx->Exec, (program, location, count, v));
8118 }
8119 }
8120
8121 static void GLAPIENTRY
8122 save_ProgramUniform1i(GLuint program, GLint location, GLint x)
8123 {
8124 GET_CURRENT_CONTEXT(ctx);
8125 Node *n;
8126 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8127 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1I, 3);
8128 if (n) {
8129 n[1].ui = program;
8130 n[2].i = location;
8131 n[3].i = x;
8132 }
8133 if (ctx->ExecuteFlag) {
8134 CALL_ProgramUniform1i(ctx->Exec, (program, location, x));
8135 }
8136 }
8137
8138 static void GLAPIENTRY
8139 save_ProgramUniform2i(GLuint program, GLint location, GLint x, GLint y)
8140 {
8141 GET_CURRENT_CONTEXT(ctx);
8142 Node *n;
8143 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8144 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2I, 4);
8145 if (n) {
8146 n[1].ui = program;
8147 n[2].i = location;
8148 n[3].i = x;
8149 n[4].i = y;
8150 }
8151 if (ctx->ExecuteFlag) {
8152 CALL_ProgramUniform2i(ctx->Exec, (program, location, x, y));
8153 }
8154 }
8155
8156 static void GLAPIENTRY
8157 save_ProgramUniform3i(GLuint program, GLint location,
8158 GLint x, GLint y, GLint z)
8159 {
8160 GET_CURRENT_CONTEXT(ctx);
8161 Node *n;
8162 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8163 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3I, 5);
8164 if (n) {
8165 n[1].ui = program;
8166 n[2].i = location;
8167 n[3].i = x;
8168 n[4].i = y;
8169 n[5].i = z;
8170 }
8171 if (ctx->ExecuteFlag) {
8172 CALL_ProgramUniform3i(ctx->Exec, (program, location, x, y, z));
8173 }
8174 }
8175
8176 static void GLAPIENTRY
8177 save_ProgramUniform4i(GLuint program, GLint location,
8178 GLint x, GLint y, GLint z, GLint w)
8179 {
8180 GET_CURRENT_CONTEXT(ctx);
8181 Node *n;
8182 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8183 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4I, 6);
8184 if (n) {
8185 n[1].ui = program;
8186 n[2].i = location;
8187 n[3].i = x;
8188 n[4].i = y;
8189 n[5].i = z;
8190 n[6].i = w;
8191 }
8192 if (ctx->ExecuteFlag) {
8193 CALL_ProgramUniform4i(ctx->Exec, (program, location, x, y, z, w));
8194 }
8195 }
8196
8197 static void GLAPIENTRY
8198 save_ProgramUniform1iv(GLuint program, GLint location, GLsizei count,
8199 const GLint *v)
8200 {
8201 GET_CURRENT_CONTEXT(ctx);
8202 Node *n;
8203 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8204 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1IV, 3 + POINTER_DWORDS);
8205 if (n) {
8206 n[1].ui = program;
8207 n[2].i = location;
8208 n[3].i = count;
8209 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLint)));
8210 }
8211 if (ctx->ExecuteFlag) {
8212 CALL_ProgramUniform1iv(ctx->Exec, (program, location, count, v));
8213 }
8214 }
8215
8216 static void GLAPIENTRY
8217 save_ProgramUniform2iv(GLuint program, GLint location, GLsizei count,
8218 const GLint *v)
8219 {
8220 GET_CURRENT_CONTEXT(ctx);
8221 Node *n;
8222 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8223 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2IV, 3 + POINTER_DWORDS);
8224 if (n) {
8225 n[1].ui = program;
8226 n[2].i = location;
8227 n[3].i = count;
8228 save_pointer(&n[4], memdup(v, count * 2 * sizeof(GLint)));
8229 }
8230 if (ctx->ExecuteFlag) {
8231 CALL_ProgramUniform2iv(ctx->Exec, (program, location, count, v));
8232 }
8233 }
8234
8235 static void GLAPIENTRY
8236 save_ProgramUniform3iv(GLuint program, GLint location, GLsizei count,
8237 const GLint *v)
8238 {
8239 GET_CURRENT_CONTEXT(ctx);
8240 Node *n;
8241 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8242 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3IV, 3 + POINTER_DWORDS);
8243 if (n) {
8244 n[1].ui = program;
8245 n[2].i = location;
8246 n[3].i = count;
8247 save_pointer(&n[4], memdup(v, count * 3 * sizeof(GLint)));
8248 }
8249 if (ctx->ExecuteFlag) {
8250 CALL_ProgramUniform3iv(ctx->Exec, (program, location, count, v));
8251 }
8252 }
8253
8254 static void GLAPIENTRY
8255 save_ProgramUniform4iv(GLuint program, GLint location, GLsizei count,
8256 const GLint *v)
8257 {
8258 GET_CURRENT_CONTEXT(ctx);
8259 Node *n;
8260 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8261 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4IV, 3 + POINTER_DWORDS);
8262 if (n) {
8263 n[1].ui = program;
8264 n[2].i = location;
8265 n[3].i = count;
8266 save_pointer(&n[4], memdup(v, count * 4 * sizeof(GLint)));
8267 }
8268 if (ctx->ExecuteFlag) {
8269 CALL_ProgramUniform4iv(ctx->Exec, (program, location, count, v));
8270 }
8271 }
8272
8273 static void GLAPIENTRY
8274 save_ProgramUniform1ui(GLuint program, GLint location, GLuint x)
8275 {
8276 GET_CURRENT_CONTEXT(ctx);
8277 Node *n;
8278 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8279 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1UI, 3);
8280 if (n) {
8281 n[1].ui = program;
8282 n[2].i = location;
8283 n[3].ui = x;
8284 }
8285 if (ctx->ExecuteFlag) {
8286 CALL_ProgramUniform1ui(ctx->Exec, (program, location, x));
8287 }
8288 }
8289
8290 static void GLAPIENTRY
8291 save_ProgramUniform2ui(GLuint program, GLint location, GLuint x, GLuint y)
8292 {
8293 GET_CURRENT_CONTEXT(ctx);
8294 Node *n;
8295 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8296 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2UI, 4);
8297 if (n) {
8298 n[1].ui = program;
8299 n[2].i = location;
8300 n[3].ui = x;
8301 n[4].ui = y;
8302 }
8303 if (ctx->ExecuteFlag) {
8304 CALL_ProgramUniform2ui(ctx->Exec, (program, location, x, y));
8305 }
8306 }
8307
8308 static void GLAPIENTRY
8309 save_ProgramUniform3ui(GLuint program, GLint location,
8310 GLuint x, GLuint y, GLuint z)
8311 {
8312 GET_CURRENT_CONTEXT(ctx);
8313 Node *n;
8314 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8315 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3UI, 5);
8316 if (n) {
8317 n[1].ui = program;
8318 n[2].i = location;
8319 n[3].ui = x;
8320 n[4].ui = y;
8321 n[5].ui = z;
8322 }
8323 if (ctx->ExecuteFlag) {
8324 CALL_ProgramUniform3ui(ctx->Exec, (program, location, x, y, z));
8325 }
8326 }
8327
8328 static void GLAPIENTRY
8329 save_ProgramUniform4ui(GLuint program, GLint location,
8330 GLuint x, GLuint y, GLuint z, GLuint w)
8331 {
8332 GET_CURRENT_CONTEXT(ctx);
8333 Node *n;
8334 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8335 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4UI, 6);
8336 if (n) {
8337 n[1].ui = program;
8338 n[2].i = location;
8339 n[3].ui = x;
8340 n[4].ui = y;
8341 n[5].ui = z;
8342 n[6].ui = w;
8343 }
8344 if (ctx->ExecuteFlag) {
8345 CALL_ProgramUniform4ui(ctx->Exec, (program, location, x, y, z, w));
8346 }
8347 }
8348
8349 static void GLAPIENTRY
8350 save_ProgramUniform1uiv(GLuint program, GLint location, GLsizei count,
8351 const GLuint *v)
8352 {
8353 GET_CURRENT_CONTEXT(ctx);
8354 Node *n;
8355 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8356 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1UIV, 3 + POINTER_DWORDS);
8357 if (n) {
8358 n[1].ui = program;
8359 n[2].i = location;
8360 n[3].i = count;
8361 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLuint)));
8362 }
8363 if (ctx->ExecuteFlag) {
8364 CALL_ProgramUniform1uiv(ctx->Exec, (program, location, count, v));
8365 }
8366 }
8367
8368 static void GLAPIENTRY
8369 save_ProgramUniform2uiv(GLuint program, GLint location, GLsizei count,
8370 const GLuint *v)
8371 {
8372 GET_CURRENT_CONTEXT(ctx);
8373 Node *n;
8374 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8375 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2UIV, 3 + POINTER_DWORDS);
8376 if (n) {
8377 n[1].ui = program;
8378 n[2].i = location;
8379 n[3].i = count;
8380 save_pointer(&n[4], memdup(v, count * 2 * sizeof(GLuint)));
8381 }
8382 if (ctx->ExecuteFlag) {
8383 CALL_ProgramUniform2uiv(ctx->Exec, (program, location, count, v));
8384 }
8385 }
8386
8387 static void GLAPIENTRY
8388 save_ProgramUniform3uiv(GLuint program, GLint location, GLsizei count,
8389 const GLuint *v)
8390 {
8391 GET_CURRENT_CONTEXT(ctx);
8392 Node *n;
8393 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8394 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3UIV, 3 + POINTER_DWORDS);
8395 if (n) {
8396 n[1].ui = program;
8397 n[2].i = location;
8398 n[3].i = count;
8399 save_pointer(&n[4], memdup(v, count * 3 * sizeof(GLuint)));
8400 }
8401 if (ctx->ExecuteFlag) {
8402 CALL_ProgramUniform3uiv(ctx->Exec, (program, location, count, v));
8403 }
8404 }
8405
8406 static void GLAPIENTRY
8407 save_ProgramUniform4uiv(GLuint program, GLint location, GLsizei count,
8408 const GLuint *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_4UIV, 3 + POINTER_DWORDS);
8414 if (n) {
8415 n[1].ui = program;
8416 n[2].i = location;
8417 n[3].i = count;
8418 save_pointer(&n[4], memdup(v, count * 4 * sizeof(GLuint)));
8419 }
8420 if (ctx->ExecuteFlag) {
8421 CALL_ProgramUniform4uiv(ctx->Exec, (program, location, count, v));
8422 }
8423 }
8424
8425 static void GLAPIENTRY
8426 save_ProgramUniformMatrix2fv(GLuint program, GLint location, GLsizei count,
8427 GLboolean transpose, const GLfloat *v)
8428 {
8429 GET_CURRENT_CONTEXT(ctx);
8430 Node *n;
8431 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8432 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX22F,
8433 4 + POINTER_DWORDS);
8434 if (n) {
8435 n[1].ui = program;
8436 n[2].i = location;
8437 n[3].i = count;
8438 n[4].b = transpose;
8439 save_pointer(&n[5], memdup(v, count * 2 * 2 * sizeof(GLfloat)));
8440 }
8441 if (ctx->ExecuteFlag) {
8442 CALL_ProgramUniformMatrix2fv(ctx->Exec,
8443 (program, location, count, transpose, v));
8444 }
8445 }
8446
8447 static void GLAPIENTRY
8448 save_ProgramUniformMatrix2x3fv(GLuint program, GLint location, GLsizei count,
8449 GLboolean transpose, const GLfloat *v)
8450 {
8451 GET_CURRENT_CONTEXT(ctx);
8452 Node *n;
8453 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8454 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX23F,
8455 4 + POINTER_DWORDS);
8456 if (n) {
8457 n[1].ui = program;
8458 n[2].i = location;
8459 n[3].i = count;
8460 n[4].b = transpose;
8461 save_pointer(&n[5], memdup(v, count * 2 * 3 * sizeof(GLfloat)));
8462 }
8463 if (ctx->ExecuteFlag) {
8464 CALL_ProgramUniformMatrix2x3fv(ctx->Exec,
8465 (program, location, count, transpose, v));
8466 }
8467 }
8468
8469 static void GLAPIENTRY
8470 save_ProgramUniformMatrix2x4fv(GLuint program, GLint location, GLsizei count,
8471 GLboolean transpose, const GLfloat *v)
8472 {
8473 GET_CURRENT_CONTEXT(ctx);
8474 Node *n;
8475 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8476 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX24F,
8477 4 + POINTER_DWORDS);
8478 if (n) {
8479 n[1].ui = program;
8480 n[2].i = location;
8481 n[3].i = count;
8482 n[4].b = transpose;
8483 save_pointer(&n[5], memdup(v, count * 2 * 4 * sizeof(GLfloat)));
8484 }
8485 if (ctx->ExecuteFlag) {
8486 CALL_ProgramUniformMatrix2x4fv(ctx->Exec,
8487 (program, location, count, transpose, v));
8488 }
8489 }
8490
8491 static void GLAPIENTRY
8492 save_ProgramUniformMatrix3x2fv(GLuint program, GLint location, GLsizei count,
8493 GLboolean transpose, const GLfloat *v)
8494 {
8495 GET_CURRENT_CONTEXT(ctx);
8496 Node *n;
8497 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8498 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX32F,
8499 4 + POINTER_DWORDS);
8500 if (n) {
8501 n[1].ui = program;
8502 n[2].i = location;
8503 n[3].i = count;
8504 n[4].b = transpose;
8505 save_pointer(&n[5], memdup(v, count * 3 * 2 * sizeof(GLfloat)));
8506 }
8507 if (ctx->ExecuteFlag) {
8508 CALL_ProgramUniformMatrix3x2fv(ctx->Exec,
8509 (program, location, count, transpose, v));
8510 }
8511 }
8512
8513 static void GLAPIENTRY
8514 save_ProgramUniformMatrix3fv(GLuint program, GLint location, GLsizei count,
8515 GLboolean transpose, const GLfloat *v)
8516 {
8517 GET_CURRENT_CONTEXT(ctx);
8518 Node *n;
8519 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8520 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX33F,
8521 4 + POINTER_DWORDS);
8522 if (n) {
8523 n[1].ui = program;
8524 n[2].i = location;
8525 n[3].i = count;
8526 n[4].b = transpose;
8527 save_pointer(&n[5], memdup(v, count * 3 * 3 * sizeof(GLfloat)));
8528 }
8529 if (ctx->ExecuteFlag) {
8530 CALL_ProgramUniformMatrix3fv(ctx->Exec,
8531 (program, location, count, transpose, v));
8532 }
8533 }
8534
8535 static void GLAPIENTRY
8536 save_ProgramUniformMatrix3x4fv(GLuint program, GLint location, GLsizei count,
8537 GLboolean transpose, const GLfloat *v)
8538 {
8539 GET_CURRENT_CONTEXT(ctx);
8540 Node *n;
8541 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8542 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX34F,
8543 4 + POINTER_DWORDS);
8544 if (n) {
8545 n[1].ui = program;
8546 n[2].i = location;
8547 n[3].i = count;
8548 n[4].b = transpose;
8549 save_pointer(&n[5], memdup(v, count * 3 * 4 * sizeof(GLfloat)));
8550 }
8551 if (ctx->ExecuteFlag) {
8552 CALL_ProgramUniformMatrix3x4fv(ctx->Exec,
8553 (program, location, count, transpose, v));
8554 }
8555 }
8556
8557 static void GLAPIENTRY
8558 save_ProgramUniformMatrix4x2fv(GLuint program, GLint location, GLsizei count,
8559 GLboolean transpose, const GLfloat *v)
8560 {
8561 GET_CURRENT_CONTEXT(ctx);
8562 Node *n;
8563 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8564 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX42F,
8565 4 + POINTER_DWORDS);
8566 if (n) {
8567 n[1].ui = program;
8568 n[2].i = location;
8569 n[3].i = count;
8570 n[4].b = transpose;
8571 save_pointer(&n[5], memdup(v, count * 4 * 2 * sizeof(GLfloat)));
8572 }
8573 if (ctx->ExecuteFlag) {
8574 CALL_ProgramUniformMatrix4x2fv(ctx->Exec,
8575 (program, location, count, transpose, v));
8576 }
8577 }
8578
8579 static void GLAPIENTRY
8580 save_ProgramUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count,
8581 GLboolean transpose, const GLfloat *v)
8582 {
8583 GET_CURRENT_CONTEXT(ctx);
8584 Node *n;
8585 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8586 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX43F,
8587 4 + POINTER_DWORDS);
8588 if (n) {
8589 n[1].ui = program;
8590 n[2].i = location;
8591 n[3].i = count;
8592 n[4].b = transpose;
8593 save_pointer(&n[5], memdup(v, count * 4 * 3 * sizeof(GLfloat)));
8594 }
8595 if (ctx->ExecuteFlag) {
8596 CALL_ProgramUniformMatrix4x3fv(ctx->Exec,
8597 (program, location, count, transpose, v));
8598 }
8599 }
8600
8601 static void GLAPIENTRY
8602 save_ProgramUniformMatrix4fv(GLuint program, GLint location, GLsizei count,
8603 GLboolean transpose, const GLfloat *v)
8604 {
8605 GET_CURRENT_CONTEXT(ctx);
8606 Node *n;
8607 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8608 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX44F,
8609 4 + POINTER_DWORDS);
8610 if (n) {
8611 n[1].ui = program;
8612 n[2].i = location;
8613 n[3].i = count;
8614 n[4].b = transpose;
8615 save_pointer(&n[5], memdup(v, count * 4 * 4 * sizeof(GLfloat)));
8616 }
8617 if (ctx->ExecuteFlag) {
8618 CALL_ProgramUniformMatrix4fv(ctx->Exec,
8619 (program, location, count, transpose, v));
8620 }
8621 }
8622
8623 static void GLAPIENTRY
8624 save_ProgramUniformMatrix2dv(GLuint program, GLint location, GLsizei count,
8625 GLboolean transpose, const GLdouble *v)
8626 {
8627 GET_CURRENT_CONTEXT(ctx);
8628 Node *n;
8629 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8630 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX22D,
8631 4 + POINTER_DWORDS);
8632 if (n) {
8633 n[1].ui = program;
8634 n[2].i = location;
8635 n[3].i = count;
8636 n[4].b = transpose;
8637 save_pointer(&n[5], memdup(v, count * 2 * 2 * sizeof(GLdouble)));
8638 }
8639 if (ctx->ExecuteFlag) {
8640 CALL_ProgramUniformMatrix2dv(ctx->Exec,
8641 (program, location, count, transpose, v));
8642 }
8643 }
8644
8645 static void GLAPIENTRY
8646 save_ProgramUniformMatrix2x3dv(GLuint program, GLint location, GLsizei count,
8647 GLboolean transpose, const GLdouble *v)
8648 {
8649 GET_CURRENT_CONTEXT(ctx);
8650 Node *n;
8651 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8652 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX23D,
8653 4 + POINTER_DWORDS);
8654 if (n) {
8655 n[1].ui = program;
8656 n[2].i = location;
8657 n[3].i = count;
8658 n[4].b = transpose;
8659 save_pointer(&n[5], memdup(v, count * 2 * 3 * sizeof(GLdouble)));
8660 }
8661 if (ctx->ExecuteFlag) {
8662 CALL_ProgramUniformMatrix2x3dv(ctx->Exec,
8663 (program, location, count, transpose, v));
8664 }
8665 }
8666
8667 static void GLAPIENTRY
8668 save_ProgramUniformMatrix2x4dv(GLuint program, GLint location, GLsizei count,
8669 GLboolean transpose, const GLdouble *v)
8670 {
8671 GET_CURRENT_CONTEXT(ctx);
8672 Node *n;
8673 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8674 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX24D,
8675 4 + POINTER_DWORDS);
8676 if (n) {
8677 n[1].ui = program;
8678 n[2].i = location;
8679 n[3].i = count;
8680 n[4].b = transpose;
8681 save_pointer(&n[5], memdup(v, count * 2 * 4 * sizeof(GLdouble)));
8682 }
8683 if (ctx->ExecuteFlag) {
8684 CALL_ProgramUniformMatrix2x4dv(ctx->Exec,
8685 (program, location, count, transpose, v));
8686 }
8687 }
8688
8689 static void GLAPIENTRY
8690 save_ProgramUniformMatrix3x2dv(GLuint program, GLint location, GLsizei count,
8691 GLboolean transpose, const GLdouble *v)
8692 {
8693 GET_CURRENT_CONTEXT(ctx);
8694 Node *n;
8695 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8696 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX32D,
8697 4 + POINTER_DWORDS);
8698 if (n) {
8699 n[1].ui = program;
8700 n[2].i = location;
8701 n[3].i = count;
8702 n[4].b = transpose;
8703 save_pointer(&n[5], memdup(v, count * 3 * 2 * sizeof(GLdouble)));
8704 }
8705 if (ctx->ExecuteFlag) {
8706 CALL_ProgramUniformMatrix3x2dv(ctx->Exec,
8707 (program, location, count, transpose, v));
8708 }
8709 }
8710
8711 static void GLAPIENTRY
8712 save_ProgramUniformMatrix3dv(GLuint program, GLint location, GLsizei count,
8713 GLboolean transpose, const GLdouble *v)
8714 {
8715 GET_CURRENT_CONTEXT(ctx);
8716 Node *n;
8717 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8718 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX33D,
8719 4 + POINTER_DWORDS);
8720 if (n) {
8721 n[1].ui = program;
8722 n[2].i = location;
8723 n[3].i = count;
8724 n[4].b = transpose;
8725 save_pointer(&n[5], memdup(v, count * 3 * 3 * sizeof(GLdouble)));
8726 }
8727 if (ctx->ExecuteFlag) {
8728 CALL_ProgramUniformMatrix3dv(ctx->Exec,
8729 (program, location, count, transpose, v));
8730 }
8731 }
8732
8733 static void GLAPIENTRY
8734 save_ProgramUniformMatrix3x4dv(GLuint program, GLint location, GLsizei count,
8735 GLboolean transpose, const GLdouble *v)
8736 {
8737 GET_CURRENT_CONTEXT(ctx);
8738 Node *n;
8739 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8740 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX34D,
8741 4 + POINTER_DWORDS);
8742 if (n) {
8743 n[1].ui = program;
8744 n[2].i = location;
8745 n[3].i = count;
8746 n[4].b = transpose;
8747 save_pointer(&n[5], memdup(v, count * 3 * 4 * sizeof(GLdouble)));
8748 }
8749 if (ctx->ExecuteFlag) {
8750 CALL_ProgramUniformMatrix3x4dv(ctx->Exec,
8751 (program, location, count, transpose, v));
8752 }
8753 }
8754
8755 static void GLAPIENTRY
8756 save_ProgramUniformMatrix4x2dv(GLuint program, GLint location, GLsizei count,
8757 GLboolean transpose, const GLdouble *v)
8758 {
8759 GET_CURRENT_CONTEXT(ctx);
8760 Node *n;
8761 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8762 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX42D,
8763 4 + POINTER_DWORDS);
8764 if (n) {
8765 n[1].ui = program;
8766 n[2].i = location;
8767 n[3].i = count;
8768 n[4].b = transpose;
8769 save_pointer(&n[5], memdup(v, count * 4 * 2 * sizeof(GLdouble)));
8770 }
8771 if (ctx->ExecuteFlag) {
8772 CALL_ProgramUniformMatrix4x2dv(ctx->Exec,
8773 (program, location, count, transpose, v));
8774 }
8775 }
8776
8777 static void GLAPIENTRY
8778 save_ProgramUniformMatrix4x3dv(GLuint program, GLint location, GLsizei count,
8779 GLboolean transpose, const GLdouble *v)
8780 {
8781 GET_CURRENT_CONTEXT(ctx);
8782 Node *n;
8783 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8784 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX43D,
8785 4 + POINTER_DWORDS);
8786 if (n) {
8787 n[1].ui = program;
8788 n[2].i = location;
8789 n[3].i = count;
8790 n[4].b = transpose;
8791 save_pointer(&n[5], memdup(v, count * 4 * 3 * sizeof(GLdouble)));
8792 }
8793 if (ctx->ExecuteFlag) {
8794 CALL_ProgramUniformMatrix4x3dv(ctx->Exec,
8795 (program, location, count, transpose, v));
8796 }
8797 }
8798
8799 static void GLAPIENTRY
8800 save_ProgramUniformMatrix4dv(GLuint program, GLint location, GLsizei count,
8801 GLboolean transpose, const GLdouble *v)
8802 {
8803 GET_CURRENT_CONTEXT(ctx);
8804 Node *n;
8805 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8806 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX44D,
8807 4 + POINTER_DWORDS);
8808 if (n) {
8809 n[1].ui = program;
8810 n[2].i = location;
8811 n[3].i = count;
8812 n[4].b = transpose;
8813 save_pointer(&n[5], memdup(v, count * 4 * 4 * sizeof(GLdouble)));
8814 }
8815 if (ctx->ExecuteFlag) {
8816 CALL_ProgramUniformMatrix4dv(ctx->Exec,
8817 (program, location, count, transpose, v));
8818 }
8819 }
8820
8821 static void GLAPIENTRY
8822 save_ClipControl(GLenum origin, GLenum depth)
8823 {
8824 GET_CURRENT_CONTEXT(ctx);
8825 Node *n;
8826 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8827 n = alloc_instruction(ctx, OPCODE_CLIP_CONTROL, 2);
8828 if (n) {
8829 n[1].e = origin;
8830 n[2].e = depth;
8831 }
8832 if (ctx->ExecuteFlag) {
8833 CALL_ClipControl(ctx->Exec, (origin, depth));
8834 }
8835 }
8836
8837 static void GLAPIENTRY
8838 save_ClampColorARB(GLenum target, GLenum clamp)
8839 {
8840 GET_CURRENT_CONTEXT(ctx);
8841 Node *n;
8842 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8843 n = alloc_instruction(ctx, OPCODE_CLAMP_COLOR, 2);
8844 if (n) {
8845 n[1].e = target;
8846 n[2].e = clamp;
8847 }
8848 if (ctx->ExecuteFlag) {
8849 CALL_ClampColor(ctx->Exec, (target, clamp));
8850 }
8851 }
8852
8853 /** GL_EXT_texture_integer */
8854 static void GLAPIENTRY
8855 save_ClearColorIi(GLint red, GLint green, GLint blue, GLint alpha)
8856 {
8857 GET_CURRENT_CONTEXT(ctx);
8858 Node *n;
8859 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8860 n = alloc_instruction(ctx, OPCODE_CLEARCOLOR_I, 4);
8861 if (n) {
8862 n[1].i = red;
8863 n[2].i = green;
8864 n[3].i = blue;
8865 n[4].i = alpha;
8866 }
8867 if (ctx->ExecuteFlag) {
8868 CALL_ClearColorIiEXT(ctx->Exec, (red, green, blue, alpha));
8869 }
8870 }
8871
8872 /** GL_EXT_texture_integer */
8873 static void GLAPIENTRY
8874 save_ClearColorIui(GLuint red, GLuint green, GLuint blue, GLuint alpha)
8875 {
8876 GET_CURRENT_CONTEXT(ctx);
8877 Node *n;
8878 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8879 n = alloc_instruction(ctx, OPCODE_CLEARCOLOR_UI, 4);
8880 if (n) {
8881 n[1].ui = red;
8882 n[2].ui = green;
8883 n[3].ui = blue;
8884 n[4].ui = alpha;
8885 }
8886 if (ctx->ExecuteFlag) {
8887 CALL_ClearColorIuiEXT(ctx->Exec, (red, green, blue, alpha));
8888 }
8889 }
8890
8891 /** GL_EXT_texture_integer */
8892 static void GLAPIENTRY
8893 save_TexParameterIiv(GLenum target, GLenum pname, const GLint *params)
8894 {
8895 GET_CURRENT_CONTEXT(ctx);
8896 Node *n;
8897 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8898 n = alloc_instruction(ctx, OPCODE_TEXPARAMETER_I, 6);
8899 if (n) {
8900 n[1].e = target;
8901 n[2].e = pname;
8902 n[3].i = params[0];
8903 n[4].i = params[1];
8904 n[5].i = params[2];
8905 n[6].i = params[3];
8906 }
8907 if (ctx->ExecuteFlag) {
8908 CALL_TexParameterIiv(ctx->Exec, (target, pname, params));
8909 }
8910 }
8911
8912 /** GL_EXT_texture_integer */
8913 static void GLAPIENTRY
8914 save_TexParameterIuiv(GLenum target, GLenum pname, const GLuint *params)
8915 {
8916 GET_CURRENT_CONTEXT(ctx);
8917 Node *n;
8918 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8919 n = alloc_instruction(ctx, OPCODE_TEXPARAMETER_UI, 6);
8920 if (n) {
8921 n[1].e = target;
8922 n[2].e = pname;
8923 n[3].ui = params[0];
8924 n[4].ui = params[1];
8925 n[5].ui = params[2];
8926 n[6].ui = params[3];
8927 }
8928 if (ctx->ExecuteFlag) {
8929 CALL_TexParameterIuiv(ctx->Exec, (target, pname, params));
8930 }
8931 }
8932
8933 /* GL_ARB_instanced_arrays */
8934 static void GLAPIENTRY
8935 save_VertexAttribDivisor(GLuint index, GLuint divisor)
8936 {
8937 GET_CURRENT_CONTEXT(ctx);
8938 Node *n;
8939 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8940 n = alloc_instruction(ctx, OPCODE_VERTEX_ATTRIB_DIVISOR, 2);
8941 if (n) {
8942 n[1].ui = index;
8943 n[2].ui = divisor;
8944 }
8945 if (ctx->ExecuteFlag) {
8946 CALL_VertexAttribDivisor(ctx->Exec, (index, divisor));
8947 }
8948 }
8949
8950
8951 /* GL_NV_texture_barrier */
8952 static void GLAPIENTRY
8953 save_TextureBarrierNV(void)
8954 {
8955 GET_CURRENT_CONTEXT(ctx);
8956 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8957 alloc_instruction(ctx, OPCODE_TEXTURE_BARRIER_NV, 0);
8958 if (ctx->ExecuteFlag) {
8959 CALL_TextureBarrierNV(ctx->Exec, ());
8960 }
8961 }
8962
8963
8964 /* GL_ARB_sampler_objects */
8965 static void GLAPIENTRY
8966 save_BindSampler(GLuint unit, GLuint sampler)
8967 {
8968 Node *n;
8969 GET_CURRENT_CONTEXT(ctx);
8970 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8971 n = alloc_instruction(ctx, OPCODE_BIND_SAMPLER, 2);
8972 if (n) {
8973 n[1].ui = unit;
8974 n[2].ui = sampler;
8975 }
8976 if (ctx->ExecuteFlag) {
8977 CALL_BindSampler(ctx->Exec, (unit, sampler));
8978 }
8979 }
8980
8981 static void GLAPIENTRY
8982 save_SamplerParameteriv(GLuint sampler, GLenum pname, const GLint *params)
8983 {
8984 Node *n;
8985 GET_CURRENT_CONTEXT(ctx);
8986 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8987 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERIV, 6);
8988 if (n) {
8989 n[1].ui = sampler;
8990 n[2].e = pname;
8991 n[3].i = params[0];
8992 if (pname == GL_TEXTURE_BORDER_COLOR) {
8993 n[4].i = params[1];
8994 n[5].i = params[2];
8995 n[6].i = params[3];
8996 }
8997 else {
8998 n[4].i = n[5].i = n[6].i = 0;
8999 }
9000 }
9001 if (ctx->ExecuteFlag) {
9002 CALL_SamplerParameteriv(ctx->Exec, (sampler, pname, params));
9003 }
9004 }
9005
9006 static void GLAPIENTRY
9007 save_SamplerParameteri(GLuint sampler, GLenum pname, GLint param)
9008 {
9009 GLint parray[4];
9010 parray[0] = param;
9011 parray[1] = parray[2] = parray[3] = 0;
9012 save_SamplerParameteriv(sampler, pname, parray);
9013 }
9014
9015 static void GLAPIENTRY
9016 save_SamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *params)
9017 {
9018 Node *n;
9019 GET_CURRENT_CONTEXT(ctx);
9020 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9021 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERFV, 6);
9022 if (n) {
9023 n[1].ui = sampler;
9024 n[2].e = pname;
9025 n[3].f = params[0];
9026 if (pname == GL_TEXTURE_BORDER_COLOR) {
9027 n[4].f = params[1];
9028 n[5].f = params[2];
9029 n[6].f = params[3];
9030 }
9031 else {
9032 n[4].f = n[5].f = n[6].f = 0.0F;
9033 }
9034 }
9035 if (ctx->ExecuteFlag) {
9036 CALL_SamplerParameterfv(ctx->Exec, (sampler, pname, params));
9037 }
9038 }
9039
9040 static void GLAPIENTRY
9041 save_SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
9042 {
9043 GLfloat parray[4];
9044 parray[0] = param;
9045 parray[1] = parray[2] = parray[3] = 0.0F;
9046 save_SamplerParameterfv(sampler, pname, parray);
9047 }
9048
9049 static void GLAPIENTRY
9050 save_SamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *params)
9051 {
9052 Node *n;
9053 GET_CURRENT_CONTEXT(ctx);
9054 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9055 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERIIV, 6);
9056 if (n) {
9057 n[1].ui = sampler;
9058 n[2].e = pname;
9059 n[3].i = params[0];
9060 if (pname == GL_TEXTURE_BORDER_COLOR) {
9061 n[4].i = params[1];
9062 n[5].i = params[2];
9063 n[6].i = params[3];
9064 }
9065 else {
9066 n[4].i = n[5].i = n[6].i = 0;
9067 }
9068 }
9069 if (ctx->ExecuteFlag) {
9070 CALL_SamplerParameterIiv(ctx->Exec, (sampler, pname, params));
9071 }
9072 }
9073
9074 static void GLAPIENTRY
9075 save_SamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *params)
9076 {
9077 Node *n;
9078 GET_CURRENT_CONTEXT(ctx);
9079 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9080 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERUIV, 6);
9081 if (n) {
9082 n[1].ui = sampler;
9083 n[2].e = pname;
9084 n[3].ui = params[0];
9085 if (pname == GL_TEXTURE_BORDER_COLOR) {
9086 n[4].ui = params[1];
9087 n[5].ui = params[2];
9088 n[6].ui = params[3];
9089 }
9090 else {
9091 n[4].ui = n[5].ui = n[6].ui = 0;
9092 }
9093 }
9094 if (ctx->ExecuteFlag) {
9095 CALL_SamplerParameterIuiv(ctx->Exec, (sampler, pname, params));
9096 }
9097 }
9098
9099 static void GLAPIENTRY
9100 save_WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
9101 {
9102 Node *n;
9103 GET_CURRENT_CONTEXT(ctx);
9104 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9105 n = alloc_instruction(ctx, OPCODE_WAIT_SYNC, 4);
9106 if (n) {
9107 union uint64_pair p;
9108 p.uint64 = timeout;
9109 n[1].bf = flags;
9110 n[2].ui = p.uint32[0];
9111 n[3].ui = p.uint32[1];
9112 save_pointer(&n[4], sync);
9113 }
9114 if (ctx->ExecuteFlag) {
9115 CALL_WaitSync(ctx->Exec, (sync, flags, timeout));
9116 }
9117 }
9118
9119
9120 /** GL_NV_conditional_render */
9121 static void GLAPIENTRY
9122 save_BeginConditionalRender(GLuint queryId, GLenum mode)
9123 {
9124 GET_CURRENT_CONTEXT(ctx);
9125 Node *n;
9126 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9127 n = alloc_instruction(ctx, OPCODE_BEGIN_CONDITIONAL_RENDER, 2);
9128 if (n) {
9129 n[1].i = queryId;
9130 n[2].e = mode;
9131 }
9132 if (ctx->ExecuteFlag) {
9133 CALL_BeginConditionalRender(ctx->Exec, (queryId, mode));
9134 }
9135 }
9136
9137 static void GLAPIENTRY
9138 save_EndConditionalRender(void)
9139 {
9140 GET_CURRENT_CONTEXT(ctx);
9141 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9142 alloc_instruction(ctx, OPCODE_END_CONDITIONAL_RENDER, 0);
9143 if (ctx->ExecuteFlag) {
9144 CALL_EndConditionalRender(ctx->Exec, ());
9145 }
9146 }
9147
9148 static void GLAPIENTRY
9149 save_UniformBlockBinding(GLuint prog, GLuint index, GLuint binding)
9150 {
9151 GET_CURRENT_CONTEXT(ctx);
9152 Node *n;
9153 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9154 n = alloc_instruction(ctx, OPCODE_UNIFORM_BLOCK_BINDING, 3);
9155 if (n) {
9156 n[1].ui = prog;
9157 n[2].ui = index;
9158 n[3].ui = binding;
9159 }
9160 if (ctx->ExecuteFlag) {
9161 CALL_UniformBlockBinding(ctx->Exec, (prog, index, binding));
9162 }
9163 }
9164
9165 static void GLAPIENTRY
9166 save_UniformSubroutinesuiv(GLenum shadertype, GLsizei count,
9167 const GLuint *indices)
9168 {
9169 GET_CURRENT_CONTEXT(ctx);
9170 Node *n;
9171 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9172 n = alloc_instruction(ctx, OPCODE_UNIFORM_SUBROUTINES, 2 + POINTER_DWORDS);
9173 if (n) {
9174 GLint *indices_copy = NULL;
9175
9176 if (count > 0)
9177 indices_copy = memdup(indices, sizeof(GLuint) * 4 * count);
9178 n[1].e = shadertype;
9179 n[2].si = count;
9180 save_pointer(&n[3], indices_copy);
9181 }
9182 if (ctx->ExecuteFlag) {
9183 CALL_UniformSubroutinesuiv(ctx->Exec, (shadertype, count, indices));
9184 }
9185 }
9186
9187 /** GL_EXT_window_rectangles */
9188 static void GLAPIENTRY
9189 save_WindowRectanglesEXT(GLenum mode, GLsizei count, const GLint *box)
9190 {
9191 GET_CURRENT_CONTEXT(ctx);
9192 Node *n;
9193 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9194 n = alloc_instruction(ctx, OPCODE_WINDOW_RECTANGLES, 2 + POINTER_DWORDS);
9195 if (n) {
9196 GLint *box_copy = NULL;
9197
9198 if (count > 0)
9199 box_copy = memdup(box, sizeof(GLint) * 4 * count);
9200 n[1].e = mode;
9201 n[2].si = count;
9202 save_pointer(&n[3], box_copy);
9203 }
9204 if (ctx->ExecuteFlag) {
9205 CALL_WindowRectanglesEXT(ctx->Exec, (mode, count, box));
9206 }
9207 }
9208
9209
9210 /** GL_NV_conservative_raster */
9211 static void GLAPIENTRY
9212 save_SubpixelPrecisionBiasNV(GLuint xbits, GLuint ybits)
9213 {
9214 GET_CURRENT_CONTEXT(ctx);
9215 Node *n;
9216 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9217 n = alloc_instruction(ctx, OPCODE_SUBPIXEL_PRECISION_BIAS, 2);
9218 if (n) {
9219 n[1].ui = xbits;
9220 n[2].ui = ybits;
9221 }
9222 if (ctx->ExecuteFlag) {
9223 CALL_SubpixelPrecisionBiasNV(ctx->Exec, (xbits, ybits));
9224 }
9225 }
9226
9227 /** GL_NV_conservative_raster_dilate */
9228 static void GLAPIENTRY
9229 save_ConservativeRasterParameterfNV(GLenum pname, GLfloat param)
9230 {
9231 GET_CURRENT_CONTEXT(ctx);
9232 Node *n;
9233 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9234 n = alloc_instruction(ctx, OPCODE_CONSERVATIVE_RASTER_PARAMETER_F, 2);
9235 if (n) {
9236 n[1].e = pname;
9237 n[2].f = param;
9238 }
9239 if (ctx->ExecuteFlag) {
9240 CALL_ConservativeRasterParameterfNV(ctx->Exec, (pname, param));
9241 }
9242 }
9243
9244 /** GL_NV_conservative_raster_pre_snap_triangles */
9245 static void GLAPIENTRY
9246 save_ConservativeRasterParameteriNV(GLenum pname, GLint param)
9247 {
9248 GET_CURRENT_CONTEXT(ctx);
9249 Node *n;
9250 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9251 n = alloc_instruction(ctx, OPCODE_CONSERVATIVE_RASTER_PARAMETER_I, 2);
9252 if (n) {
9253 n[1].e = pname;
9254 n[2].i = param;
9255 }
9256 if (ctx->ExecuteFlag) {
9257 CALL_ConservativeRasterParameteriNV(ctx->Exec, (pname, param));
9258 }
9259 }
9260
9261 /** GL_EXT_direct_state_access */
9262
9263 static void GLAPIENTRY
9264 save_MatrixLoadfEXT(GLenum matrixMode, const GLfloat *m)
9265 {
9266 GET_CURRENT_CONTEXT(ctx);
9267 Node *n;
9268 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9269 n = alloc_instruction(ctx, OPCODE_MATRIX_LOAD, 17);
9270 if (n) {
9271 n[1].e = matrixMode;
9272 for (unsigned i = 0; i < 16; i++) {
9273 n[2 + i].f = m[i];
9274 }
9275 }
9276 if (ctx->ExecuteFlag) {
9277 CALL_MatrixLoadfEXT(ctx->Exec, (matrixMode, m));
9278 }
9279 }
9280
9281 static void GLAPIENTRY
9282 save_MatrixLoaddEXT(GLenum matrixMode, const GLdouble *m)
9283 {
9284 GLfloat f[16];
9285 for (unsigned i = 0; i < 16; i++) {
9286 f[i] = (GLfloat) m[i];
9287 }
9288 save_MatrixLoadfEXT(matrixMode, f);
9289 }
9290
9291 static void GLAPIENTRY
9292 save_MatrixMultfEXT(GLenum matrixMode, const GLfloat * m)
9293 {
9294 GET_CURRENT_CONTEXT(ctx);
9295 Node *n;
9296 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9297 n = alloc_instruction(ctx, OPCODE_MATRIX_MULT, 17);
9298 if (n) {
9299 n[1].e = matrixMode;
9300 for (unsigned i = 0; i < 16; i++) {
9301 n[2 + i].f = m[i];
9302 }
9303 }
9304 if (ctx->ExecuteFlag) {
9305 CALL_MatrixMultfEXT(ctx->Exec, (matrixMode, m));
9306 }
9307 }
9308
9309 static void GLAPIENTRY
9310 save_MatrixMultdEXT(GLenum matrixMode, const GLdouble * m)
9311 {
9312 GLfloat f[16];
9313 for (unsigned i = 0; i < 16; i++) {
9314 f[i] = (GLfloat) m[i];
9315 }
9316 save_MatrixMultfEXT(matrixMode, f);
9317 }
9318
9319 static void GLAPIENTRY
9320 save_MatrixRotatefEXT(GLenum matrixMode, GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
9321 {
9322 GET_CURRENT_CONTEXT(ctx);
9323 Node *n;
9324 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9325 n = alloc_instruction(ctx, OPCODE_MATRIX_ROTATE, 5);
9326 if (n) {
9327 n[1].e = matrixMode;
9328 n[2].f = angle;
9329 n[3].f = x;
9330 n[4].f = y;
9331 n[5].f = z;
9332 }
9333 if (ctx->ExecuteFlag) {
9334 CALL_MatrixRotatefEXT(ctx->Exec, (matrixMode, angle, x, y, z));
9335 }
9336 }
9337
9338 static void GLAPIENTRY
9339 save_MatrixRotatedEXT(GLenum matrixMode, GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
9340 {
9341 save_MatrixRotatefEXT(matrixMode, (GLfloat) angle, (GLfloat) x, (GLfloat) y, (GLfloat) z);
9342 }
9343
9344 static void GLAPIENTRY
9345 save_MatrixScalefEXT(GLenum matrixMode, GLfloat x, GLfloat y, GLfloat z)
9346 {
9347 GET_CURRENT_CONTEXT(ctx);
9348 Node *n;
9349 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9350 n = alloc_instruction(ctx, OPCODE_MATRIX_SCALE, 4);
9351 if (n) {
9352 n[1].e = matrixMode;
9353 n[2].f = x;
9354 n[3].f = y;
9355 n[4].f = z;
9356 }
9357 if (ctx->ExecuteFlag) {
9358 CALL_MatrixScalefEXT(ctx->Exec, (matrixMode, x, y, z));
9359 }
9360 }
9361
9362 static void GLAPIENTRY
9363 save_MatrixScaledEXT(GLenum matrixMode, GLdouble x, GLdouble y, GLdouble z)
9364 {
9365 save_MatrixScalefEXT(matrixMode, (GLfloat) x, (GLfloat) y, (GLfloat) z);
9366 }
9367
9368 static void GLAPIENTRY
9369 save_MatrixTranslatefEXT(GLenum matrixMode, GLfloat x, GLfloat y, GLfloat z)
9370 {
9371 GET_CURRENT_CONTEXT(ctx);
9372 Node *n;
9373 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9374 n = alloc_instruction(ctx, OPCODE_MATRIX_TRANSLATE, 4);
9375 if (n) {
9376 n[1].e = matrixMode;
9377 n[2].f = x;
9378 n[3].f = y;
9379 n[4].f = z;
9380 }
9381 if (ctx->ExecuteFlag) {
9382 CALL_MatrixTranslatefEXT(ctx->Exec, (matrixMode, x, y, z));
9383 }
9384 }
9385
9386 static void GLAPIENTRY
9387 save_MatrixTranslatedEXT(GLenum matrixMode, GLdouble x, GLdouble y, GLdouble z)
9388 {
9389 save_MatrixTranslatefEXT(matrixMode, (GLfloat) x, (GLfloat) y, (GLfloat) z);
9390 }
9391
9392 static void GLAPIENTRY
9393 save_MatrixLoadIdentityEXT(GLenum matrixMode)
9394 {
9395 GET_CURRENT_CONTEXT(ctx);
9396 Node *n;
9397 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9398 n = alloc_instruction(ctx, OPCODE_MATRIX_LOAD_IDENTITY, 1);
9399 if (n) {
9400 n[1].e = matrixMode;
9401 }
9402 if (ctx->ExecuteFlag) {
9403 CALL_MatrixLoadIdentityEXT(ctx->Exec, (matrixMode));
9404 }
9405 }
9406
9407 static void GLAPIENTRY
9408 save_MatrixOrthoEXT(GLenum matrixMode, GLdouble left, GLdouble right,
9409 GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval)
9410 {
9411 GET_CURRENT_CONTEXT(ctx);
9412 Node *n;
9413 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9414 n = alloc_instruction(ctx, OPCODE_MATRIX_ORTHO, 7);
9415 if (n) {
9416 n[1].e = matrixMode;
9417 n[2].f = (GLfloat) left;
9418 n[3].f = (GLfloat) right;
9419 n[4].f = (GLfloat) bottom;
9420 n[5].f = (GLfloat) top;
9421 n[6].f = (GLfloat) nearval;
9422 n[7].f = (GLfloat) farval;
9423 }
9424 if (ctx->ExecuteFlag) {
9425 CALL_MatrixOrthoEXT(ctx->Exec, (matrixMode, left, right, bottom, top, nearval, farval));
9426 }
9427 }
9428
9429
9430 static void GLAPIENTRY
9431 save_MatrixFrustumEXT(GLenum matrixMode, GLdouble left, GLdouble right,
9432 GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval)
9433 {
9434 GET_CURRENT_CONTEXT(ctx);
9435 Node *n;
9436 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9437 n = alloc_instruction(ctx, OPCODE_MATRIX_FRUSTUM, 7);
9438 if (n) {
9439 n[1].e = matrixMode;
9440 n[2].f = (GLfloat) left;
9441 n[3].f = (GLfloat) right;
9442 n[4].f = (GLfloat) bottom;
9443 n[5].f = (GLfloat) top;
9444 n[6].f = (GLfloat) nearval;
9445 n[7].f = (GLfloat) farval;
9446 }
9447 if (ctx->ExecuteFlag) {
9448 CALL_MatrixFrustumEXT(ctx->Exec, (matrixMode, left, right, bottom, top, nearval, farval));
9449 }
9450 }
9451
9452 static void GLAPIENTRY
9453 save_MatrixPushEXT(GLenum matrixMode)
9454 {
9455 GET_CURRENT_CONTEXT(ctx);
9456 Node* n;
9457 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9458 n = alloc_instruction(ctx, OPCODE_MATRIX_PUSH, 1);
9459 if (n) {
9460 n[1].e = matrixMode;
9461 }
9462 if (ctx->ExecuteFlag) {
9463 CALL_MatrixPushEXT(ctx->Exec, (matrixMode));
9464 }
9465 }
9466
9467 static void GLAPIENTRY
9468 save_MatrixPopEXT(GLenum matrixMode)
9469 {
9470 GET_CURRENT_CONTEXT(ctx);
9471 Node* n;
9472 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9473 n = alloc_instruction(ctx, OPCODE_MATRIX_POP, 1);
9474 if (n) {
9475 n[1].e = matrixMode;
9476 }
9477 if (ctx->ExecuteFlag) {
9478 CALL_MatrixPopEXT(ctx->Exec, (matrixMode));
9479 }
9480 }
9481
9482 static void GLAPIENTRY
9483 save_MatrixLoadTransposefEXT(GLenum matrixMode, const GLfloat m[16])
9484 {
9485 GLfloat tm[16];
9486 _math_transposef(tm, m);
9487 save_MatrixLoadfEXT(matrixMode, tm);
9488 }
9489
9490 static void GLAPIENTRY
9491 save_MatrixLoadTransposedEXT(GLenum matrixMode, const GLdouble m[16])
9492 {
9493 GLfloat tm[16];
9494 _math_transposefd(tm, m);
9495 save_MatrixLoadfEXT(matrixMode, tm);
9496 }
9497
9498 static void GLAPIENTRY
9499 save_MatrixMultTransposefEXT(GLenum matrixMode, const GLfloat m[16])
9500 {
9501 GLfloat tm[16];
9502 _math_transposef(tm, m);
9503 save_MatrixMultfEXT(matrixMode, tm);
9504 }
9505
9506 static void GLAPIENTRY
9507 save_MatrixMultTransposedEXT(GLenum matrixMode, const GLdouble m[16])
9508 {
9509 GLfloat tm[16];
9510 _math_transposefd(tm, m);
9511 save_MatrixMultfEXT(matrixMode, tm);
9512 }
9513
9514 static void GLAPIENTRY
9515 save_TextureParameterfvEXT(GLuint texture, GLenum target, GLenum pname,
9516 const GLfloat *params)
9517 {
9518 GET_CURRENT_CONTEXT(ctx);
9519 Node *n;
9520 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9521 n = alloc_instruction(ctx, OPCODE_TEXTUREPARAMETER_F, 7);
9522 if (n) {
9523 n[1].ui = texture;
9524 n[2].e = target;
9525 n[3].e = pname;
9526 n[4].f = params[0];
9527 n[5].f = params[1];
9528 n[6].f = params[2];
9529 n[7].f = params[3];
9530 }
9531 if (ctx->ExecuteFlag) {
9532 CALL_TextureParameterfvEXT(ctx->Exec, (texture, target, pname, params));
9533 }
9534 }
9535
9536
9537 static void GLAPIENTRY
9538 save_TextureParameterfEXT(GLuint texture, GLenum target, GLenum pname, GLfloat param)
9539 {
9540 GLfloat parray[4];
9541 parray[0] = param;
9542 parray[1] = parray[2] = parray[3] = 0.0F;
9543 save_TextureParameterfvEXT(texture, target, pname, parray);
9544 }
9545
9546 static void GLAPIENTRY
9547 save_TextureParameterivEXT(GLuint texture, GLenum target, GLenum pname, const GLint *params)
9548 {
9549 GET_CURRENT_CONTEXT(ctx);
9550 Node *n;
9551 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9552 n = alloc_instruction(ctx, OPCODE_TEXTUREPARAMETER_I, 7);
9553 if (n) {
9554 n[1].ui = texture;
9555 n[2].e = target;
9556 n[3].e = pname;
9557 n[4].i = params[0];
9558 n[5].i = params[1];
9559 n[6].i = params[2];
9560 n[7].i = params[3];
9561 }
9562 if (ctx->ExecuteFlag) {
9563 CALL_TextureParameterivEXT(ctx->Exec, (texture, target, pname, params));
9564 }
9565 }
9566
9567 static void GLAPIENTRY
9568 save_TextureParameteriEXT(GLuint texture, GLenum target, GLenum pname, GLint param)
9569 {
9570 GLint fparam[4];
9571 fparam[0] = param;
9572 fparam[1] = fparam[2] = fparam[3] = 0;
9573 save_TextureParameterivEXT(texture, target, pname, fparam);
9574 }
9575
9576 static void GLAPIENTRY
9577 save_TextureImage1DEXT(GLuint texture, GLenum target,
9578 GLint level, GLint components,
9579 GLsizei width, GLint border,
9580 GLenum format, GLenum type, const GLvoid * pixels)
9581 {
9582 GET_CURRENT_CONTEXT(ctx);
9583 if (target == GL_PROXY_TEXTURE_1D) {
9584 /* don't compile, execute immediately */
9585 CALL_TextureImage1DEXT(ctx->Exec, (texture, target, level, components, width,
9586 border, format, type, pixels));
9587 }
9588 else {
9589 Node *n;
9590 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9591 n = alloc_instruction(ctx, OPCODE_TEXTURE_IMAGE1D, 8 + POINTER_DWORDS);
9592 if (n) {
9593 n[1].ui = texture;
9594 n[2].e = target;
9595 n[3].i = level;
9596 n[4].i = components;
9597 n[5].i = (GLint) width;
9598 n[6].i = border;
9599 n[7].e = format;
9600 n[8].e = type;
9601 save_pointer(&n[9],
9602 unpack_image(ctx, 1, width, 1, 1, format, type,
9603 pixels, &ctx->Unpack));
9604 }
9605 if (ctx->ExecuteFlag) {
9606 CALL_TextureImage1DEXT(ctx->Exec, (texture, target, level, components, width,
9607 border, format, type, pixels));
9608 }
9609 }
9610 }
9611
9612
9613 static void GLAPIENTRY
9614 save_TextureImage2DEXT(GLuint texture, GLenum target,
9615 GLint level, GLint components,
9616 GLsizei width, GLsizei height, GLint border,
9617 GLenum format, GLenum type, const GLvoid * pixels)
9618 {
9619 GET_CURRENT_CONTEXT(ctx);
9620 if (target == GL_PROXY_TEXTURE_2D) {
9621 /* don't compile, execute immediately */
9622 CALL_TextureImage2DEXT(ctx->Exec, (texture, target, level, components, width,
9623 height, border, format, type, pixels));
9624 }
9625 else {
9626 Node *n;
9627 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9628 n = alloc_instruction(ctx, OPCODE_TEXTURE_IMAGE2D, 9 + POINTER_DWORDS);
9629 if (n) {
9630 n[1].ui = texture;
9631 n[2].e = target;
9632 n[3].i = level;
9633 n[4].i = components;
9634 n[5].i = (GLint) width;
9635 n[6].i = (GLint) height;
9636 n[7].i = border;
9637 n[8].e = format;
9638 n[9].e = type;
9639 save_pointer(&n[10],
9640 unpack_image(ctx, 2, width, height, 1, format, type,
9641 pixels, &ctx->Unpack));
9642 }
9643 if (ctx->ExecuteFlag) {
9644 CALL_TextureImage2DEXT(ctx->Exec, (texture, target, level, components, width,
9645 height, border, format, type, pixels));
9646 }
9647 }
9648 }
9649
9650
9651 static void GLAPIENTRY
9652 save_TextureImage3DEXT(GLuint texture, GLenum target,
9653 GLint level, GLint internalFormat,
9654 GLsizei width, GLsizei height, GLsizei depth,
9655 GLint border,
9656 GLenum format, GLenum type, const GLvoid * pixels)
9657 {
9658 GET_CURRENT_CONTEXT(ctx);
9659 if (target == GL_PROXY_TEXTURE_3D) {
9660 /* don't compile, execute immediately */
9661 CALL_TextureImage3DEXT(ctx->Exec, (texture, target, level, internalFormat, width,
9662 height, depth, border, format, type,
9663 pixels));
9664 }
9665 else {
9666 Node *n;
9667 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9668 n = alloc_instruction(ctx, OPCODE_TEXTURE_IMAGE3D, 10 + POINTER_DWORDS);
9669 if (n) {
9670 n[1].ui = texture;
9671 n[2].e = target;
9672 n[3].i = level;
9673 n[4].i = (GLint) internalFormat;
9674 n[5].i = (GLint) width;
9675 n[6].i = (GLint) height;
9676 n[7].i = (GLint) depth;
9677 n[8].i = border;
9678 n[9].e = format;
9679 n[10].e = type;
9680 save_pointer(&n[11],
9681 unpack_image(ctx, 3, width, height, depth, format, type,
9682 pixels, &ctx->Unpack));
9683 }
9684 if (ctx->ExecuteFlag) {
9685 CALL_TextureImage3DEXT(ctx->Exec, (texture, target, level, internalFormat,
9686 width, height, depth, border, format,
9687 type, pixels));
9688 }
9689 }
9690 }
9691
9692
9693 static void GLAPIENTRY
9694 save_TextureSubImage1DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset,
9695 GLsizei width, GLenum format, GLenum type,
9696 const GLvoid * pixels)
9697 {
9698 GET_CURRENT_CONTEXT(ctx);
9699 Node *n;
9700
9701 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9702
9703 n = alloc_instruction(ctx, OPCODE_TEXTURE_SUB_IMAGE1D, 7 + POINTER_DWORDS);
9704 if (n) {
9705 n[1].ui = texture;
9706 n[2].e = target;
9707 n[3].i = level;
9708 n[4].i = xoffset;
9709 n[5].i = (GLint) width;
9710 n[6].e = format;
9711 n[7].e = type;
9712 save_pointer(&n[8],
9713 unpack_image(ctx, 1, width, 1, 1, format, type,
9714 pixels, &ctx->Unpack));
9715 }
9716 if (ctx->ExecuteFlag) {
9717 CALL_TextureSubImage1DEXT(ctx->Exec, (texture, target, level, xoffset, width,
9718 format, type, pixels));
9719 }
9720 }
9721
9722
9723 static void GLAPIENTRY
9724 save_TextureSubImage2DEXT(GLuint texture, GLenum target, GLint level,
9725 GLint xoffset, GLint yoffset,
9726 GLsizei width, GLsizei height,
9727 GLenum format, GLenum type, const GLvoid * pixels)
9728 {
9729 GET_CURRENT_CONTEXT(ctx);
9730 Node *n;
9731
9732 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9733
9734 n = alloc_instruction(ctx, OPCODE_TEXTURE_SUB_IMAGE2D, 9 + POINTER_DWORDS);
9735 if (n) {
9736 n[1].ui = texture;
9737 n[2].e = target;
9738 n[3].i = level;
9739 n[4].i = xoffset;
9740 n[5].i = yoffset;
9741 n[6].i = (GLint) width;
9742 n[7].i = (GLint) height;
9743 n[8].e = format;
9744 n[9].e = type;
9745 save_pointer(&n[10],
9746 unpack_image(ctx, 2, width, height, 1, format, type,
9747 pixels, &ctx->Unpack));
9748 }
9749 if (ctx->ExecuteFlag) {
9750 CALL_TextureSubImage2DEXT(ctx->Exec, (texture, target, level, xoffset, yoffset,
9751 width, height, format, type, pixels));
9752 }
9753 }
9754
9755
9756 static void GLAPIENTRY
9757 save_TextureSubImage3DEXT(GLuint texture, GLenum target, GLint level,
9758 GLint xoffset, GLint yoffset, GLint zoffset,
9759 GLsizei width, GLsizei height, GLsizei depth,
9760 GLenum format, GLenum type, const GLvoid * pixels)
9761 {
9762 GET_CURRENT_CONTEXT(ctx);
9763 Node *n;
9764
9765 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9766
9767 n = alloc_instruction(ctx, OPCODE_TEXTURE_SUB_IMAGE3D, 11 + POINTER_DWORDS);
9768 if (n) {
9769 n[1].ui = texture;
9770 n[2].e = target;
9771 n[3].i = level;
9772 n[4].i = xoffset;
9773 n[5].i = yoffset;
9774 n[6].i = zoffset;
9775 n[7].i = (GLint) width;
9776 n[8].i = (GLint) height;
9777 n[9].i = (GLint) depth;
9778 n[10].e = format;
9779 n[11].e = type;
9780 save_pointer(&n[12],
9781 unpack_image(ctx, 3, width, height, depth, format, type,
9782 pixels, &ctx->Unpack));
9783 }
9784 if (ctx->ExecuteFlag) {
9785 CALL_TextureSubImage3DEXT(ctx->Exec, (texture, target, level,
9786 xoffset, yoffset, zoffset,
9787 width, height, depth, format, type,
9788 pixels));
9789 }
9790 }
9791
9792 static void GLAPIENTRY
9793 save_CopyTextureImage1DEXT(GLuint texture, GLenum target, GLint level,
9794 GLenum internalformat, GLint x, GLint y,
9795 GLsizei width, GLint border)
9796 {
9797 GET_CURRENT_CONTEXT(ctx);
9798 Node *n;
9799 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9800 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_IMAGE1D, 8);
9801 if (n) {
9802 n[1].ui = texture;
9803 n[2].e = target;
9804 n[3].i = level;
9805 n[4].e = internalformat;
9806 n[5].i = x;
9807 n[6].i = y;
9808 n[7].i = width;
9809 n[8].i = border;
9810 }
9811 if (ctx->ExecuteFlag) {
9812 CALL_CopyTextureImage1DEXT(ctx->Exec, (texture, target, level,
9813 internalformat, x, y,
9814 width, border));
9815 }
9816 }
9817
9818 static void GLAPIENTRY
9819 save_CopyTextureImage2DEXT(GLuint texture, GLenum target, GLint level,
9820 GLenum internalformat,
9821 GLint x, GLint y, GLsizei width,
9822 GLsizei height, GLint border)
9823 {
9824 GET_CURRENT_CONTEXT(ctx);
9825 Node *n;
9826 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9827 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_IMAGE2D, 9);
9828 if (n) {
9829 n[1].ui = texture;
9830 n[2].e = target;
9831 n[3].i = level;
9832 n[4].e = internalformat;
9833 n[5].i = x;
9834 n[6].i = y;
9835 n[7].i = width;
9836 n[8].i = height;
9837 n[9].i = border;
9838 }
9839 if (ctx->ExecuteFlag) {
9840 CALL_CopyTextureImage2DEXT(ctx->Exec, (texture, target, level,
9841 internalformat, x, y,
9842 width, height, border));
9843 }
9844 }
9845
9846 static void GLAPIENTRY
9847 save_CopyTextureSubImage1DEXT(GLuint texture, GLenum target, GLint level,
9848 GLint xoffset, GLint x, GLint y, GLsizei width)
9849 {
9850 GET_CURRENT_CONTEXT(ctx);
9851 Node *n;
9852 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9853 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_SUB_IMAGE1D, 7);
9854 if (n) {
9855 n[1].ui = texture;
9856 n[2].e = target;
9857 n[3].i = level;
9858 n[4].i = xoffset;
9859 n[5].i = x;
9860 n[6].i = y;
9861 n[7].i = width;
9862 }
9863 if (ctx->ExecuteFlag) {
9864 CALL_CopyTextureSubImage1DEXT(ctx->Exec,
9865 (texture, target, level, xoffset, x, y, width));
9866 }
9867 }
9868
9869 static void GLAPIENTRY
9870 save_CopyTextureSubImage2DEXT(GLuint texture, GLenum target, GLint level,
9871 GLint xoffset, GLint yoffset,
9872 GLint x, GLint y, GLsizei width, GLint height)
9873 {
9874 GET_CURRENT_CONTEXT(ctx);
9875 Node *n;
9876 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9877 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_SUB_IMAGE2D, 9);
9878 if (n) {
9879 n[1].ui = texture;
9880 n[2].e = target;
9881 n[3].i = level;
9882 n[4].i = xoffset;
9883 n[5].i = yoffset;
9884 n[6].i = x;
9885 n[7].i = y;
9886 n[8].i = width;
9887 n[9].i = height;
9888 }
9889 if (ctx->ExecuteFlag) {
9890 CALL_CopyTextureSubImage2DEXT(ctx->Exec, (texture, target, level,
9891 xoffset, yoffset,
9892 x, y, width, height));
9893 }
9894 }
9895
9896
9897 static void GLAPIENTRY
9898 save_CopyTextureSubImage3DEXT(GLuint texture, GLenum target, GLint level,
9899 GLint xoffset, GLint yoffset, GLint zoffset,
9900 GLint x, GLint y, GLsizei width, GLint height)
9901 {
9902 GET_CURRENT_CONTEXT(ctx);
9903 Node *n;
9904 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9905 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_SUB_IMAGE3D, 10);
9906 if (n) {
9907 n[1].ui = texture;
9908 n[2].e = target;
9909 n[3].i = level;
9910 n[4].i = xoffset;
9911 n[5].i = yoffset;
9912 n[6].i = zoffset;
9913 n[7].i = x;
9914 n[8].i = y;
9915 n[9].i = width;
9916 n[10].i = height;
9917 }
9918 if (ctx->ExecuteFlag) {
9919 CALL_CopyTextureSubImage3DEXT(ctx->Exec, (texture, target, level,
9920 xoffset, yoffset, zoffset,
9921 x, y, width, height));
9922 }
9923 }
9924
9925
9926 static void GLAPIENTRY
9927 save_BindMultiTextureEXT(GLenum texunit, GLenum target, GLuint texture)
9928 {
9929 GET_CURRENT_CONTEXT(ctx);
9930 Node *n;
9931 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9932 n = alloc_instruction(ctx, OPCODE_BIND_MULTITEXTURE, 3);
9933 if (n) {
9934 n[1].e = texunit;
9935 n[2].e = target;
9936 n[3].ui = texture;
9937 }
9938 if (ctx->ExecuteFlag) {
9939 CALL_BindMultiTextureEXT(ctx->Exec, (texunit, target, texture));
9940 }
9941 }
9942
9943
9944 static void GLAPIENTRY
9945 save_MultiTexParameterfvEXT(GLenum texunit, GLenum target, GLenum pname,
9946 const GLfloat *params)
9947 {
9948 GET_CURRENT_CONTEXT(ctx);
9949 Node *n;
9950 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9951 n = alloc_instruction(ctx, OPCODE_MULTITEXPARAMETER_F, 7);
9952 if (n) {
9953 n[1].e = texunit;
9954 n[2].e = target;
9955 n[3].e = pname;
9956 n[4].f = params[0];
9957 n[5].f = params[1];
9958 n[6].f = params[2];
9959 n[7].f = params[3];
9960 }
9961 if (ctx->ExecuteFlag) {
9962 CALL_MultiTexParameterfvEXT(ctx->Exec, (texunit, target, pname, params));
9963 }
9964 }
9965
9966
9967 static void GLAPIENTRY
9968 save_MultiTexParameterfEXT(GLenum texunit, GLenum target, GLenum pname, GLfloat param)
9969 {
9970 GLfloat parray[4];
9971 parray[0] = param;
9972 parray[1] = parray[2] = parray[3] = 0.0F;
9973 save_MultiTexParameterfvEXT(texunit, target, pname, parray);
9974 }
9975
9976 static void GLAPIENTRY
9977 save_MultiTexParameterivEXT(GLenum texunit, GLenum target, GLenum pname, const GLint *params)
9978 {
9979 GET_CURRENT_CONTEXT(ctx);
9980 Node *n;
9981 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9982 n = alloc_instruction(ctx, OPCODE_MULTITEXPARAMETER_I, 7);
9983 if (n) {
9984 n[1].e = texunit;
9985 n[2].e = target;
9986 n[3].e = pname;
9987 n[4].i = params[0];
9988 n[5].i = params[1];
9989 n[6].i = params[2];
9990 n[7].i = params[3];
9991 }
9992 if (ctx->ExecuteFlag) {
9993 CALL_MultiTexParameterivEXT(ctx->Exec, (texunit, target, pname, params));
9994 }
9995 }
9996
9997 static void GLAPIENTRY
9998 save_MultiTexParameteriEXT(GLenum texunit, GLenum target, GLenum pname, GLint param)
9999 {
10000 GLint fparam[4];
10001 fparam[0] = param;
10002 fparam[1] = fparam[2] = fparam[3] = 0;
10003 save_MultiTexParameterivEXT(texunit, target, pname, fparam);
10004 }
10005
10006
10007 static void GLAPIENTRY
10008 save_MultiTexImage1DEXT(GLenum texunit, GLenum target,
10009 GLint level, GLint components,
10010 GLsizei width, GLint border,
10011 GLenum format, GLenum type, const GLvoid * pixels)
10012 {
10013 GET_CURRENT_CONTEXT(ctx);
10014 if (target == GL_PROXY_TEXTURE_1D) {
10015 /* don't compile, execute immediately */
10016 CALL_MultiTexImage1DEXT(ctx->Exec, (texunit, target, level, components, width,
10017 border, format, type, pixels));
10018 }
10019 else {
10020 Node *n;
10021 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10022 n = alloc_instruction(ctx, OPCODE_MULTITEX_IMAGE1D, 8 + POINTER_DWORDS);
10023 if (n) {
10024 n[1].e = texunit;
10025 n[2].e = target;
10026 n[3].i = level;
10027 n[4].i = components;
10028 n[5].i = (GLint) width;
10029 n[6].i = border;
10030 n[7].e = format;
10031 n[8].e = type;
10032 save_pointer(&n[9],
10033 unpack_image(ctx, 1, width, 1, 1, format, type,
10034 pixels, &ctx->Unpack));
10035 }
10036 if (ctx->ExecuteFlag) {
10037 CALL_MultiTexImage1DEXT(ctx->Exec, (texunit, target, level, components, width,
10038 border, format, type, pixels));
10039 }
10040 }
10041 }
10042
10043
10044 static void GLAPIENTRY
10045 save_MultiTexImage2DEXT(GLenum texunit, GLenum target,
10046 GLint level, GLint components,
10047 GLsizei width, GLsizei height, GLint border,
10048 GLenum format, GLenum type, const GLvoid * pixels)
10049 {
10050 GET_CURRENT_CONTEXT(ctx);
10051 if (target == GL_PROXY_TEXTURE_2D) {
10052 /* don't compile, execute immediately */
10053 CALL_MultiTexImage2DEXT(ctx->Exec, (texunit, target, level, components, width,
10054 height, border, format, type, pixels));
10055 }
10056 else {
10057 Node *n;
10058 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10059 n = alloc_instruction(ctx, OPCODE_MULTITEX_IMAGE2D, 9 + POINTER_DWORDS);
10060 if (n) {
10061 n[1].e = texunit;
10062 n[2].e = target;
10063 n[3].i = level;
10064 n[4].i = components;
10065 n[5].i = (GLint) width;
10066 n[6].i = (GLint) height;
10067 n[7].i = border;
10068 n[8].e = format;
10069 n[9].e = type;
10070 save_pointer(&n[10],
10071 unpack_image(ctx, 2, width, height, 1, format, type,
10072 pixels, &ctx->Unpack));
10073 }
10074 if (ctx->ExecuteFlag) {
10075 CALL_MultiTexImage2DEXT(ctx->Exec, (texunit, target, level, components, width,
10076 height, border, format, type, pixels));
10077 }
10078 }
10079 }
10080
10081
10082 static void GLAPIENTRY
10083 save_MultiTexImage3DEXT(GLenum texunit, GLenum target,
10084 GLint level, GLint internalFormat,
10085 GLsizei width, GLsizei height, GLsizei depth,
10086 GLint border,
10087 GLenum format, GLenum type, const GLvoid * pixels)
10088 {
10089 GET_CURRENT_CONTEXT(ctx);
10090 if (target == GL_PROXY_TEXTURE_3D) {
10091 /* don't compile, execute immediately */
10092 CALL_MultiTexImage3DEXT(ctx->Exec, (texunit, target, level, internalFormat, width,
10093 height, depth, border, format, type,
10094 pixels));
10095 }
10096 else {
10097 Node *n;
10098 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10099 n = alloc_instruction(ctx, OPCODE_MULTITEX_IMAGE3D, 10 + POINTER_DWORDS);
10100 if (n) {
10101 n[1].e = texunit;
10102 n[2].e = target;
10103 n[3].i = level;
10104 n[4].i = (GLint) internalFormat;
10105 n[5].i = (GLint) width;
10106 n[6].i = (GLint) height;
10107 n[7].i = (GLint) depth;
10108 n[8].i = border;
10109 n[9].e = format;
10110 n[10].e = type;
10111 save_pointer(&n[11],
10112 unpack_image(ctx, 3, width, height, depth, format, type,
10113 pixels, &ctx->Unpack));
10114 }
10115 if (ctx->ExecuteFlag) {
10116 CALL_MultiTexImage3DEXT(ctx->Exec, (texunit, target, level, internalFormat,
10117 width, height, depth, border, format,
10118 type, pixels));
10119 }
10120 }
10121 }
10122
10123
10124 static void GLAPIENTRY
10125 save_MultiTexSubImage1DEXT(GLenum texunit, GLenum target, GLint level, GLint xoffset,
10126 GLsizei width, GLenum format, GLenum type,
10127 const GLvoid * pixels)
10128 {
10129 GET_CURRENT_CONTEXT(ctx);
10130 Node *n;
10131
10132 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10133
10134 n = alloc_instruction(ctx, OPCODE_MULTITEX_SUB_IMAGE1D, 7 + POINTER_DWORDS);
10135 if (n) {
10136 n[1].e = texunit;
10137 n[2].e = target;
10138 n[3].i = level;
10139 n[4].i = xoffset;
10140 n[5].i = (GLint) width;
10141 n[6].e = format;
10142 n[7].e = type;
10143 save_pointer(&n[8],
10144 unpack_image(ctx, 1, width, 1, 1, format, type,
10145 pixels, &ctx->Unpack));
10146 }
10147 if (ctx->ExecuteFlag) {
10148 CALL_MultiTexSubImage1DEXT(ctx->Exec, (texunit, target, level, xoffset, width,
10149 format, type, pixels));
10150 }
10151 }
10152
10153
10154 static void GLAPIENTRY
10155 save_MultiTexSubImage2DEXT(GLenum texunit, GLenum target, GLint level,
10156 GLint xoffset, GLint yoffset,
10157 GLsizei width, GLsizei height,
10158 GLenum format, GLenum type, const GLvoid * pixels)
10159 {
10160 GET_CURRENT_CONTEXT(ctx);
10161 Node *n;
10162
10163 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10164
10165 n = alloc_instruction(ctx, OPCODE_MULTITEX_SUB_IMAGE2D, 9 + POINTER_DWORDS);
10166 if (n) {
10167 n[1].e = texunit;
10168 n[2].e = target;
10169 n[3].i = level;
10170 n[4].i = xoffset;
10171 n[5].i = yoffset;
10172 n[6].i = (GLint) width;
10173 n[7].i = (GLint) height;
10174 n[8].e = format;
10175 n[9].e = type;
10176 save_pointer(&n[10],
10177 unpack_image(ctx, 2, width, height, 1, format, type,
10178 pixels, &ctx->Unpack));
10179 }
10180 if (ctx->ExecuteFlag) {
10181 CALL_MultiTexSubImage2DEXT(ctx->Exec, (texunit, target, level, xoffset, yoffset,
10182 width, height, format, type, pixels));
10183 }
10184 }
10185
10186
10187 static void GLAPIENTRY
10188 save_MultiTexSubImage3DEXT(GLenum texunit, GLenum target, GLint level,
10189 GLint xoffset, GLint yoffset, GLint zoffset,
10190 GLsizei width, GLsizei height, GLsizei depth,
10191 GLenum format, GLenum type, const GLvoid * pixels)
10192 {
10193 GET_CURRENT_CONTEXT(ctx);
10194 Node *n;
10195
10196 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10197
10198 n = alloc_instruction(ctx, OPCODE_MULTITEX_SUB_IMAGE3D, 11 + POINTER_DWORDS);
10199 if (n) {
10200 n[1].e = texunit;
10201 n[2].e = target;
10202 n[3].i = level;
10203 n[4].i = xoffset;
10204 n[5].i = yoffset;
10205 n[6].i = zoffset;
10206 n[7].i = (GLint) width;
10207 n[8].i = (GLint) height;
10208 n[9].i = (GLint) depth;
10209 n[10].e = format;
10210 n[11].e = type;
10211 save_pointer(&n[12],
10212 unpack_image(ctx, 3, width, height, depth, format, type,
10213 pixels, &ctx->Unpack));
10214 }
10215 if (ctx->ExecuteFlag) {
10216 CALL_MultiTexSubImage3DEXT(ctx->Exec, (texunit, target, level,
10217 xoffset, yoffset, zoffset,
10218 width, height, depth, format, type,
10219 pixels));
10220 }
10221 }
10222
10223
10224 static void GLAPIENTRY
10225 save_MultiTexEnvfvEXT(GLenum texunit, GLenum target, GLenum pname, const GLfloat *params)
10226 {
10227 GET_CURRENT_CONTEXT(ctx);
10228 Node *n;
10229 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10230 n = alloc_instruction(ctx, OPCODE_MULTITEXENV, 7);
10231 if (n) {
10232 n[1].e = texunit;
10233 n[2].e = target;
10234 n[3].e = pname;
10235 if (pname == GL_TEXTURE_ENV_COLOR) {
10236 n[4].f = params[0];
10237 n[5].f = params[1];
10238 n[6].f = params[2];
10239 n[7].f = params[3];
10240 }
10241 else {
10242 n[4].f = params[0];
10243 n[5].f = n[6].f = n[7].f = 0.0F;
10244 }
10245 }
10246 if (ctx->ExecuteFlag) {
10247 CALL_MultiTexEnvfvEXT(ctx->Exec, (texunit, target, pname, params));
10248 }
10249 }
10250
10251
10252 static void GLAPIENTRY
10253 save_MultiTexEnvfEXT(GLenum texunit, GLenum target, GLenum pname, GLfloat param)
10254 {
10255 GLfloat parray[4];
10256 parray[0] = (GLfloat) param;
10257 parray[1] = parray[2] = parray[3] = 0.0F;
10258 save_MultiTexEnvfvEXT(texunit, target, pname, parray);
10259 }
10260
10261
10262 static void GLAPIENTRY
10263 save_MultiTexEnviEXT(GLenum texunit, GLenum target, GLenum pname, GLint param)
10264 {
10265 GLfloat p[4];
10266 p[0] = (GLfloat) param;
10267 p[1] = p[2] = p[3] = 0.0F;
10268 save_MultiTexEnvfvEXT(texunit, target, pname, p);
10269 }
10270
10271
10272 static void GLAPIENTRY
10273 save_MultiTexEnvivEXT(GLenum texunit, GLenum target, GLenum pname, const GLint * param)
10274 {
10275 GLfloat p[4];
10276 if (pname == GL_TEXTURE_ENV_COLOR) {
10277 p[0] = INT_TO_FLOAT(param[0]);
10278 p[1] = INT_TO_FLOAT(param[1]);
10279 p[2] = INT_TO_FLOAT(param[2]);
10280 p[3] = INT_TO_FLOAT(param[3]);
10281 }
10282 else {
10283 p[0] = (GLfloat) param[0];
10284 p[1] = p[2] = p[3] = 0.0F;
10285 }
10286 save_MultiTexEnvfvEXT(texunit, target, pname, p);
10287 }
10288
10289
10290 static void GLAPIENTRY
10291 save_CompressedTextureSubImage2DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset,
10292 GLint yoffset, GLsizei width, GLsizei height,
10293 GLenum format, GLsizei imageSize,
10294 const GLvoid * data)
10295 {
10296 Node *n;
10297 GET_CURRENT_CONTEXT(ctx);
10298 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10299
10300 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_2D,
10301 9 + POINTER_DWORDS);
10302 if (n) {
10303 n[1].ui = texture;
10304 n[2].e = target;
10305 n[3].i = level;
10306 n[4].i = xoffset;
10307 n[5].i = yoffset;
10308 n[6].i = (GLint) width;
10309 n[7].i = (GLint) height;
10310 n[8].e = format;
10311 n[9].i = imageSize;
10312 save_pointer(&n[10],
10313 copy_data(data, imageSize, "glCompressedTextureSubImage2DEXT"));
10314 }
10315 if (ctx->ExecuteFlag) {
10316 CALL_CompressedTextureSubImage2DEXT(ctx->Exec,
10317 (texture, target, level, xoffset, yoffset,
10318 width, height, format, imageSize, data));
10319 }
10320 }
10321
10322
10323 /**
10324 * Save an error-generating command into display list.
10325 *
10326 * KW: Will appear in the list before the vertex buffer containing the
10327 * command that provoked the error. I don't see this as a problem.
10328 */
10329 static void
10330 save_error(struct gl_context *ctx, GLenum error, const char *s)
10331 {
10332 Node *n;
10333 n = alloc_instruction(ctx, OPCODE_ERROR, 1 + POINTER_DWORDS);
10334 if (n) {
10335 n[1].e = error;
10336 save_pointer(&n[2], (void *) s);
10337 /* note: the data/string here doesn't have to be freed in
10338 * _mesa_delete_list() since the string is never dynamically
10339 * allocated.
10340 */
10341 }
10342 }
10343
10344
10345 /**
10346 * Compile an error into current display list.
10347 */
10348 void
10349 _mesa_compile_error(struct gl_context *ctx, GLenum error, const char *s)
10350 {
10351 if (ctx->CompileFlag)
10352 save_error(ctx, error, s);
10353 if (ctx->ExecuteFlag)
10354 _mesa_error(ctx, error, "%s", s);
10355 }
10356
10357
10358 /**
10359 * Test if ID names a display list.
10360 */
10361 static GLboolean
10362 islist(struct gl_context *ctx, GLuint list)
10363 {
10364 if (list > 0 && _mesa_lookup_list(ctx, list)) {
10365 return GL_TRUE;
10366 }
10367 else {
10368 return GL_FALSE;
10369 }
10370 }
10371
10372
10373
10374 /**********************************************************************/
10375 /* Display list execution */
10376 /**********************************************************************/
10377
10378
10379 /*
10380 * Execute a display list. Note that the ListBase offset must have already
10381 * been added before calling this function. I.e. the list argument is
10382 * the absolute list number, not relative to ListBase.
10383 * \param list - display list number
10384 */
10385 static void
10386 execute_list(struct gl_context *ctx, GLuint list)
10387 {
10388 struct gl_display_list *dlist;
10389 Node *n;
10390 GLboolean done;
10391
10392 if (list == 0 || !islist(ctx, list))
10393 return;
10394
10395 if (ctx->ListState.CallDepth == MAX_LIST_NESTING) {
10396 /* raise an error? */
10397 return;
10398 }
10399
10400 dlist = _mesa_lookup_list(ctx, list);
10401 if (!dlist)
10402 return;
10403
10404 ctx->ListState.CallDepth++;
10405
10406 vbo_save_BeginCallList(ctx, dlist);
10407
10408 n = dlist->Head;
10409
10410 done = GL_FALSE;
10411 while (!done) {
10412 const OpCode opcode = n[0].opcode;
10413
10414 if (is_ext_opcode(opcode)) {
10415 n += ext_opcode_execute(ctx, n);
10416 }
10417 else {
10418 switch (opcode) {
10419 case OPCODE_ERROR:
10420 _mesa_error(ctx, n[1].e, "%s", (const char *) get_pointer(&n[2]));
10421 break;
10422 case OPCODE_ACCUM:
10423 CALL_Accum(ctx->Exec, (n[1].e, n[2].f));
10424 break;
10425 case OPCODE_ALPHA_FUNC:
10426 CALL_AlphaFunc(ctx->Exec, (n[1].e, n[2].f));
10427 break;
10428 case OPCODE_BIND_TEXTURE:
10429 CALL_BindTexture(ctx->Exec, (n[1].e, n[2].ui));
10430 break;
10431 case OPCODE_BITMAP:
10432 {
10433 const struct gl_pixelstore_attrib save = ctx->Unpack;
10434 ctx->Unpack = ctx->DefaultPacking;
10435 CALL_Bitmap(ctx->Exec, ((GLsizei) n[1].i, (GLsizei) n[2].i,
10436 n[3].f, n[4].f, n[5].f, n[6].f,
10437 get_pointer(&n[7])));
10438 ctx->Unpack = save; /* restore */
10439 }
10440 break;
10441 case OPCODE_BLEND_COLOR:
10442 CALL_BlendColor(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
10443 break;
10444 case OPCODE_BLEND_EQUATION:
10445 CALL_BlendEquation(ctx->Exec, (n[1].e));
10446 break;
10447 case OPCODE_BLEND_EQUATION_SEPARATE:
10448 CALL_BlendEquationSeparate(ctx->Exec, (n[1].e, n[2].e));
10449 break;
10450 case OPCODE_BLEND_FUNC_SEPARATE:
10451 CALL_BlendFuncSeparate(ctx->Exec,
10452 (n[1].e, n[2].e, n[3].e, n[4].e));
10453 break;
10454
10455 case OPCODE_BLEND_FUNC_I:
10456 /* GL_ARB_draw_buffers_blend */
10457 CALL_BlendFunciARB(ctx->Exec, (n[1].ui, n[2].e, n[3].e));
10458 break;
10459 case OPCODE_BLEND_FUNC_SEPARATE_I:
10460 /* GL_ARB_draw_buffers_blend */
10461 CALL_BlendFuncSeparateiARB(ctx->Exec, (n[1].ui, n[2].e, n[3].e,
10462 n[4].e, n[5].e));
10463 break;
10464 case OPCODE_BLEND_EQUATION_I:
10465 /* GL_ARB_draw_buffers_blend */
10466 CALL_BlendEquationiARB(ctx->Exec, (n[1].ui, n[2].e));
10467 break;
10468 case OPCODE_BLEND_EQUATION_SEPARATE_I:
10469 /* GL_ARB_draw_buffers_blend */
10470 CALL_BlendEquationSeparateiARB(ctx->Exec,
10471 (n[1].ui, n[2].e, n[3].e));
10472 break;
10473
10474 case OPCODE_CALL_LIST:
10475 /* Generated by glCallList(), don't add ListBase */
10476 if (ctx->ListState.CallDepth < MAX_LIST_NESTING) {
10477 execute_list(ctx, n[1].ui);
10478 }
10479 break;
10480 case OPCODE_CALL_LISTS:
10481 if (ctx->ListState.CallDepth < MAX_LIST_NESTING) {
10482 CALL_CallLists(ctx->Exec, (n[1].i, n[2].e, get_pointer(&n[3])));
10483 }
10484 break;
10485 case OPCODE_CLEAR:
10486 CALL_Clear(ctx->Exec, (n[1].bf));
10487 break;
10488 case OPCODE_CLEAR_BUFFER_IV:
10489 {
10490 GLint value[4];
10491 value[0] = n[3].i;
10492 value[1] = n[4].i;
10493 value[2] = n[5].i;
10494 value[3] = n[6].i;
10495 CALL_ClearBufferiv(ctx->Exec, (n[1].e, n[2].i, value));
10496 }
10497 break;
10498 case OPCODE_CLEAR_BUFFER_UIV:
10499 {
10500 GLuint value[4];
10501 value[0] = n[3].ui;
10502 value[1] = n[4].ui;
10503 value[2] = n[5].ui;
10504 value[3] = n[6].ui;
10505 CALL_ClearBufferuiv(ctx->Exec, (n[1].e, n[2].i, value));
10506 }
10507 break;
10508 case OPCODE_CLEAR_BUFFER_FV:
10509 {
10510 GLfloat value[4];
10511 value[0] = n[3].f;
10512 value[1] = n[4].f;
10513 value[2] = n[5].f;
10514 value[3] = n[6].f;
10515 CALL_ClearBufferfv(ctx->Exec, (n[1].e, n[2].i, value));
10516 }
10517 break;
10518 case OPCODE_CLEAR_BUFFER_FI:
10519 CALL_ClearBufferfi(ctx->Exec, (n[1].e, n[2].i, n[3].f, n[4].i));
10520 break;
10521 case OPCODE_CLEAR_COLOR:
10522 CALL_ClearColor(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
10523 break;
10524 case OPCODE_CLEAR_ACCUM:
10525 CALL_ClearAccum(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
10526 break;
10527 case OPCODE_CLEAR_DEPTH:
10528 CALL_ClearDepth(ctx->Exec, ((GLclampd) n[1].f));
10529 break;
10530 case OPCODE_CLEAR_INDEX:
10531 CALL_ClearIndex(ctx->Exec, ((GLfloat) n[1].ui));
10532 break;
10533 case OPCODE_CLEAR_STENCIL:
10534 CALL_ClearStencil(ctx->Exec, (n[1].i));
10535 break;
10536 case OPCODE_CLIP_PLANE:
10537 {
10538 GLdouble eq[4];
10539 eq[0] = n[2].f;
10540 eq[1] = n[3].f;
10541 eq[2] = n[4].f;
10542 eq[3] = n[5].f;
10543 CALL_ClipPlane(ctx->Exec, (n[1].e, eq));
10544 }
10545 break;
10546 case OPCODE_COLOR_MASK:
10547 CALL_ColorMask(ctx->Exec, (n[1].b, n[2].b, n[3].b, n[4].b));
10548 break;
10549 case OPCODE_COLOR_MASK_INDEXED:
10550 CALL_ColorMaski(ctx->Exec, (n[1].ui, n[2].b, n[3].b,
10551 n[4].b, n[5].b));
10552 break;
10553 case OPCODE_COLOR_MATERIAL:
10554 CALL_ColorMaterial(ctx->Exec, (n[1].e, n[2].e));
10555 break;
10556 case OPCODE_COPY_PIXELS:
10557 CALL_CopyPixels(ctx->Exec, (n[1].i, n[2].i,
10558 (GLsizei) n[3].i, (GLsizei) n[4].i,
10559 n[5].e));
10560 break;
10561 case OPCODE_COPY_TEX_IMAGE1D:
10562 CALL_CopyTexImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].e, n[4].i,
10563 n[5].i, n[6].i, n[7].i));
10564 break;
10565 case OPCODE_COPY_TEX_IMAGE2D:
10566 CALL_CopyTexImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].e, n[4].i,
10567 n[5].i, n[6].i, n[7].i, n[8].i));
10568 break;
10569 case OPCODE_COPY_TEX_SUB_IMAGE1D:
10570 CALL_CopyTexSubImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
10571 n[4].i, n[5].i, n[6].i));
10572 break;
10573 case OPCODE_COPY_TEX_SUB_IMAGE2D:
10574 CALL_CopyTexSubImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
10575 n[4].i, n[5].i, n[6].i, n[7].i,
10576 n[8].i));
10577 break;
10578 case OPCODE_COPY_TEX_SUB_IMAGE3D:
10579 CALL_CopyTexSubImage3D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
10580 n[4].i, n[5].i, n[6].i, n[7].i,
10581 n[8].i, n[9].i));
10582 break;
10583 case OPCODE_CULL_FACE:
10584 CALL_CullFace(ctx->Exec, (n[1].e));
10585 break;
10586 case OPCODE_DEPTH_FUNC:
10587 CALL_DepthFunc(ctx->Exec, (n[1].e));
10588 break;
10589 case OPCODE_DEPTH_MASK:
10590 CALL_DepthMask(ctx->Exec, (n[1].b));
10591 break;
10592 case OPCODE_DEPTH_RANGE:
10593 CALL_DepthRange(ctx->Exec,
10594 ((GLclampd) n[1].f, (GLclampd) n[2].f));
10595 break;
10596 case OPCODE_DISABLE:
10597 CALL_Disable(ctx->Exec, (n[1].e));
10598 break;
10599 case OPCODE_DISABLE_INDEXED:
10600 CALL_Disablei(ctx->Exec, (n[1].ui, n[2].e));
10601 break;
10602 case OPCODE_DRAW_BUFFER:
10603 CALL_DrawBuffer(ctx->Exec, (n[1].e));
10604 break;
10605 case OPCODE_DRAW_PIXELS:
10606 {
10607 const struct gl_pixelstore_attrib save = ctx->Unpack;
10608 ctx->Unpack = ctx->DefaultPacking;
10609 CALL_DrawPixels(ctx->Exec, (n[1].i, n[2].i, n[3].e, n[4].e,
10610 get_pointer(&n[5])));
10611 ctx->Unpack = save; /* restore */
10612 }
10613 break;
10614 case OPCODE_ENABLE:
10615 CALL_Enable(ctx->Exec, (n[1].e));
10616 break;
10617 case OPCODE_ENABLE_INDEXED:
10618 CALL_Enablei(ctx->Exec, (n[1].ui, n[2].e));
10619 break;
10620 case OPCODE_EVALMESH1:
10621 CALL_EvalMesh1(ctx->Exec, (n[1].e, n[2].i, n[3].i));
10622 break;
10623 case OPCODE_EVALMESH2:
10624 CALL_EvalMesh2(ctx->Exec,
10625 (n[1].e, n[2].i, n[3].i, n[4].i, n[5].i));
10626 break;
10627 case OPCODE_FOG:
10628 {
10629 GLfloat p[4];
10630 p[0] = n[2].f;
10631 p[1] = n[3].f;
10632 p[2] = n[4].f;
10633 p[3] = n[5].f;
10634 CALL_Fogfv(ctx->Exec, (n[1].e, p));
10635 }
10636 break;
10637 case OPCODE_FRONT_FACE:
10638 CALL_FrontFace(ctx->Exec, (n[1].e));
10639 break;
10640 case OPCODE_FRUSTUM:
10641 CALL_Frustum(ctx->Exec,
10642 (n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f));
10643 break;
10644 case OPCODE_HINT:
10645 CALL_Hint(ctx->Exec, (n[1].e, n[2].e));
10646 break;
10647 case OPCODE_INDEX_MASK:
10648 CALL_IndexMask(ctx->Exec, (n[1].ui));
10649 break;
10650 case OPCODE_INIT_NAMES:
10651 CALL_InitNames(ctx->Exec, ());
10652 break;
10653 case OPCODE_LIGHT:
10654 {
10655 GLfloat p[4];
10656 p[0] = n[3].f;
10657 p[1] = n[4].f;
10658 p[2] = n[5].f;
10659 p[3] = n[6].f;
10660 CALL_Lightfv(ctx->Exec, (n[1].e, n[2].e, p));
10661 }
10662 break;
10663 case OPCODE_LIGHT_MODEL:
10664 {
10665 GLfloat p[4];
10666 p[0] = n[2].f;
10667 p[1] = n[3].f;
10668 p[2] = n[4].f;
10669 p[3] = n[5].f;
10670 CALL_LightModelfv(ctx->Exec, (n[1].e, p));
10671 }
10672 break;
10673 case OPCODE_LINE_STIPPLE:
10674 CALL_LineStipple(ctx->Exec, (n[1].i, n[2].us));
10675 break;
10676 case OPCODE_LINE_WIDTH:
10677 CALL_LineWidth(ctx->Exec, (n[1].f));
10678 break;
10679 case OPCODE_LIST_BASE:
10680 CALL_ListBase(ctx->Exec, (n[1].ui));
10681 break;
10682 case OPCODE_LOAD_IDENTITY:
10683 CALL_LoadIdentity(ctx->Exec, ());
10684 break;
10685 case OPCODE_LOAD_MATRIX:
10686 STATIC_ASSERT(sizeof(Node) == sizeof(GLfloat));
10687 CALL_LoadMatrixf(ctx->Exec, (&n[1].f));
10688 break;
10689 case OPCODE_LOAD_NAME:
10690 CALL_LoadName(ctx->Exec, (n[1].ui));
10691 break;
10692 case OPCODE_LOGIC_OP:
10693 CALL_LogicOp(ctx->Exec, (n[1].e));
10694 break;
10695 case OPCODE_MAP1:
10696 {
10697 GLenum target = n[1].e;
10698 GLint ustride = _mesa_evaluator_components(target);
10699 GLint uorder = n[5].i;
10700 GLfloat u1 = n[2].f;
10701 GLfloat u2 = n[3].f;
10702 CALL_Map1f(ctx->Exec, (target, u1, u2, ustride, uorder,
10703 (GLfloat *) get_pointer(&n[6])));
10704 }
10705 break;
10706 case OPCODE_MAP2:
10707 {
10708 GLenum target = n[1].e;
10709 GLfloat u1 = n[2].f;
10710 GLfloat u2 = n[3].f;
10711 GLfloat v1 = n[4].f;
10712 GLfloat v2 = n[5].f;
10713 GLint ustride = n[6].i;
10714 GLint vstride = n[7].i;
10715 GLint uorder = n[8].i;
10716 GLint vorder = n[9].i;
10717 CALL_Map2f(ctx->Exec, (target, u1, u2, ustride, uorder,
10718 v1, v2, vstride, vorder,
10719 (GLfloat *) get_pointer(&n[10])));
10720 }
10721 break;
10722 case OPCODE_MAPGRID1:
10723 CALL_MapGrid1f(ctx->Exec, (n[1].i, n[2].f, n[3].f));
10724 break;
10725 case OPCODE_MAPGRID2:
10726 CALL_MapGrid2f(ctx->Exec,
10727 (n[1].i, n[2].f, n[3].f, n[4].i, n[5].f, n[6].f));
10728 break;
10729 case OPCODE_MATRIX_MODE:
10730 CALL_MatrixMode(ctx->Exec, (n[1].e));
10731 break;
10732 case OPCODE_MULT_MATRIX:
10733 CALL_MultMatrixf(ctx->Exec, (&n[1].f));
10734 break;
10735 case OPCODE_ORTHO:
10736 CALL_Ortho(ctx->Exec,
10737 (n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f));
10738 break;
10739 case OPCODE_PASSTHROUGH:
10740 CALL_PassThrough(ctx->Exec, (n[1].f));
10741 break;
10742 case OPCODE_PATCH_PARAMETER_I:
10743 CALL_PatchParameteri(ctx->Exec, (n[1].e, n[2].i));
10744 break;
10745 case OPCODE_PATCH_PARAMETER_FV_INNER:
10746 {
10747 GLfloat params[2];
10748 params[0] = n[2].f;
10749 params[1] = n[3].f;
10750 CALL_PatchParameterfv(ctx->Exec, (n[1].e, params));
10751 }
10752 break;
10753 case OPCODE_PATCH_PARAMETER_FV_OUTER:
10754 {
10755 GLfloat params[4];
10756 params[0] = n[2].f;
10757 params[1] = n[3].f;
10758 params[2] = n[4].f;
10759 params[3] = n[5].f;
10760 CALL_PatchParameterfv(ctx->Exec, (n[1].e, params));
10761 }
10762 break;
10763 case OPCODE_PIXEL_MAP:
10764 CALL_PixelMapfv(ctx->Exec,
10765 (n[1].e, n[2].i, get_pointer(&n[3])));
10766 break;
10767 case OPCODE_PIXEL_TRANSFER:
10768 CALL_PixelTransferf(ctx->Exec, (n[1].e, n[2].f));
10769 break;
10770 case OPCODE_PIXEL_ZOOM:
10771 CALL_PixelZoom(ctx->Exec, (n[1].f, n[2].f));
10772 break;
10773 case OPCODE_POINT_SIZE:
10774 CALL_PointSize(ctx->Exec, (n[1].f));
10775 break;
10776 case OPCODE_POINT_PARAMETERS:
10777 {
10778 GLfloat params[3];
10779 params[0] = n[2].f;
10780 params[1] = n[3].f;
10781 params[2] = n[4].f;
10782 CALL_PointParameterfv(ctx->Exec, (n[1].e, params));
10783 }
10784 break;
10785 case OPCODE_POLYGON_MODE:
10786 CALL_PolygonMode(ctx->Exec, (n[1].e, n[2].e));
10787 break;
10788 case OPCODE_POLYGON_STIPPLE:
10789 {
10790 const struct gl_pixelstore_attrib save = ctx->Unpack;
10791 ctx->Unpack = ctx->DefaultPacking;
10792 CALL_PolygonStipple(ctx->Exec, (get_pointer(&n[1])));
10793 ctx->Unpack = save; /* restore */
10794 }
10795 break;
10796 case OPCODE_POLYGON_OFFSET:
10797 CALL_PolygonOffset(ctx->Exec, (n[1].f, n[2].f));
10798 break;
10799 case OPCODE_POLYGON_OFFSET_CLAMP:
10800 CALL_PolygonOffsetClampEXT(ctx->Exec, (n[1].f, n[2].f, n[3].f));
10801 break;
10802 case OPCODE_POP_ATTRIB:
10803 CALL_PopAttrib(ctx->Exec, ());
10804 break;
10805 case OPCODE_POP_MATRIX:
10806 CALL_PopMatrix(ctx->Exec, ());
10807 break;
10808 case OPCODE_POP_NAME:
10809 CALL_PopName(ctx->Exec, ());
10810 break;
10811 case OPCODE_PRIORITIZE_TEXTURE:
10812 CALL_PrioritizeTextures(ctx->Exec, (1, &n[1].ui, &n[2].f));
10813 break;
10814 case OPCODE_PUSH_ATTRIB:
10815 CALL_PushAttrib(ctx->Exec, (n[1].bf));
10816 break;
10817 case OPCODE_PUSH_MATRIX:
10818 CALL_PushMatrix(ctx->Exec, ());
10819 break;
10820 case OPCODE_PUSH_NAME:
10821 CALL_PushName(ctx->Exec, (n[1].ui));
10822 break;
10823 case OPCODE_RASTER_POS:
10824 CALL_RasterPos4f(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
10825 break;
10826 case OPCODE_READ_BUFFER:
10827 CALL_ReadBuffer(ctx->Exec, (n[1].e));
10828 break;
10829 case OPCODE_ROTATE:
10830 CALL_Rotatef(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
10831 break;
10832 case OPCODE_SCALE:
10833 CALL_Scalef(ctx->Exec, (n[1].f, n[2].f, n[3].f));
10834 break;
10835 case OPCODE_SCISSOR:
10836 CALL_Scissor(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
10837 break;
10838 case OPCODE_SHADE_MODEL:
10839 CALL_ShadeModel(ctx->Exec, (n[1].e));
10840 break;
10841 case OPCODE_PROVOKING_VERTEX:
10842 CALL_ProvokingVertex(ctx->Exec, (n[1].e));
10843 break;
10844 case OPCODE_STENCIL_FUNC:
10845 CALL_StencilFunc(ctx->Exec, (n[1].e, n[2].i, n[3].ui));
10846 break;
10847 case OPCODE_STENCIL_MASK:
10848 CALL_StencilMask(ctx->Exec, (n[1].ui));
10849 break;
10850 case OPCODE_STENCIL_OP:
10851 CALL_StencilOp(ctx->Exec, (n[1].e, n[2].e, n[3].e));
10852 break;
10853 case OPCODE_STENCIL_FUNC_SEPARATE:
10854 CALL_StencilFuncSeparate(ctx->Exec,
10855 (n[1].e, n[2].e, n[3].i, n[4].ui));
10856 break;
10857 case OPCODE_STENCIL_MASK_SEPARATE:
10858 CALL_StencilMaskSeparate(ctx->Exec, (n[1].e, n[2].ui));
10859 break;
10860 case OPCODE_STENCIL_OP_SEPARATE:
10861 CALL_StencilOpSeparate(ctx->Exec,
10862 (n[1].e, n[2].e, n[3].e, n[4].e));
10863 break;
10864 case OPCODE_TEXENV:
10865 {
10866 GLfloat params[4];
10867 params[0] = n[3].f;
10868 params[1] = n[4].f;
10869 params[2] = n[5].f;
10870 params[3] = n[6].f;
10871 CALL_TexEnvfv(ctx->Exec, (n[1].e, n[2].e, params));
10872 }
10873 break;
10874 case OPCODE_TEXGEN:
10875 {
10876 GLfloat params[4];
10877 params[0] = n[3].f;
10878 params[1] = n[4].f;
10879 params[2] = n[5].f;
10880 params[3] = n[6].f;
10881 CALL_TexGenfv(ctx->Exec, (n[1].e, n[2].e, params));
10882 }
10883 break;
10884 case OPCODE_TEXPARAMETER:
10885 {
10886 GLfloat params[4];
10887 params[0] = n[3].f;
10888 params[1] = n[4].f;
10889 params[2] = n[5].f;
10890 params[3] = n[6].f;
10891 CALL_TexParameterfv(ctx->Exec, (n[1].e, n[2].e, params));
10892 }
10893 break;
10894 case OPCODE_TEX_IMAGE1D:
10895 {
10896 const struct gl_pixelstore_attrib save = ctx->Unpack;
10897 ctx->Unpack = ctx->DefaultPacking;
10898 CALL_TexImage1D(ctx->Exec, (n[1].e, /* target */
10899 n[2].i, /* level */
10900 n[3].i, /* components */
10901 n[4].i, /* width */
10902 n[5].e, /* border */
10903 n[6].e, /* format */
10904 n[7].e, /* type */
10905 get_pointer(&n[8])));
10906 ctx->Unpack = save; /* restore */
10907 }
10908 break;
10909 case OPCODE_TEX_IMAGE2D:
10910 {
10911 const struct gl_pixelstore_attrib save = ctx->Unpack;
10912 ctx->Unpack = ctx->DefaultPacking;
10913 CALL_TexImage2D(ctx->Exec, (n[1].e, /* target */
10914 n[2].i, /* level */
10915 n[3].i, /* components */
10916 n[4].i, /* width */
10917 n[5].i, /* height */
10918 n[6].e, /* border */
10919 n[7].e, /* format */
10920 n[8].e, /* type */
10921 get_pointer(&n[9])));
10922 ctx->Unpack = save; /* restore */
10923 }
10924 break;
10925 case OPCODE_TEX_IMAGE3D:
10926 {
10927 const struct gl_pixelstore_attrib save = ctx->Unpack;
10928 ctx->Unpack = ctx->DefaultPacking;
10929 CALL_TexImage3D(ctx->Exec, (n[1].e, /* target */
10930 n[2].i, /* level */
10931 n[3].i, /* components */
10932 n[4].i, /* width */
10933 n[5].i, /* height */
10934 n[6].i, /* depth */
10935 n[7].e, /* border */
10936 n[8].e, /* format */
10937 n[9].e, /* type */
10938 get_pointer(&n[10])));
10939 ctx->Unpack = save; /* restore */
10940 }
10941 break;
10942 case OPCODE_TEX_SUB_IMAGE1D:
10943 {
10944 const struct gl_pixelstore_attrib save = ctx->Unpack;
10945 ctx->Unpack = ctx->DefaultPacking;
10946 CALL_TexSubImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
10947 n[4].i, n[5].e,
10948 n[6].e, get_pointer(&n[7])));
10949 ctx->Unpack = save; /* restore */
10950 }
10951 break;
10952 case OPCODE_TEX_SUB_IMAGE2D:
10953 {
10954 const struct gl_pixelstore_attrib save = ctx->Unpack;
10955 ctx->Unpack = ctx->DefaultPacking;
10956 CALL_TexSubImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
10957 n[4].i, n[5].e,
10958 n[6].i, n[7].e, n[8].e,
10959 get_pointer(&n[9])));
10960 ctx->Unpack = save; /* restore */
10961 }
10962 break;
10963 case OPCODE_TEX_SUB_IMAGE3D:
10964 {
10965 const struct gl_pixelstore_attrib save = ctx->Unpack;
10966 ctx->Unpack = ctx->DefaultPacking;
10967 CALL_TexSubImage3D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
10968 n[4].i, n[5].i, n[6].i, n[7].i,
10969 n[8].i, n[9].e, n[10].e,
10970 get_pointer(&n[11])));
10971 ctx->Unpack = save; /* restore */
10972 }
10973 break;
10974 case OPCODE_TRANSLATE:
10975 CALL_Translatef(ctx->Exec, (n[1].f, n[2].f, n[3].f));
10976 break;
10977 case OPCODE_VIEWPORT:
10978 CALL_Viewport(ctx->Exec, (n[1].i, n[2].i,
10979 (GLsizei) n[3].i, (GLsizei) n[4].i));
10980 break;
10981 case OPCODE_WINDOW_POS:
10982 CALL_WindowPos4fMESA(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
10983 break;
10984 case OPCODE_VIEWPORT_ARRAY_V:
10985 CALL_ViewportArrayv(ctx->Exec, (n[1].ui, n[2].si,
10986 get_pointer(&n[3])));
10987 break;
10988 case OPCODE_VIEWPORT_INDEXED_F:
10989 CALL_ViewportIndexedf(ctx->Exec, (n[1].ui, n[2].f, n[3].f, n[4].f,
10990 n[5].f));
10991 break;
10992 case OPCODE_VIEWPORT_INDEXED_FV: {
10993 GLfloat v[4];
10994 v[0] = n[2].f;
10995 v[1] = n[3].f;
10996 v[2] = n[4].f;
10997 v[3] = n[5].f;
10998 CALL_ViewportIndexedfv(ctx->Exec, (n[1].ui, v));
10999 break;
11000 }
11001 case OPCODE_SCISSOR_ARRAY_V:
11002 CALL_ScissorArrayv(ctx->Exec, (n[1].ui, n[2].si,
11003 get_pointer(&n[3])));
11004 break;
11005 case OPCODE_SCISSOR_INDEXED:
11006 CALL_ScissorIndexed(ctx->Exec, (n[1].ui, n[2].i, n[3].i, n[4].si,
11007 n[5].si));
11008 break;
11009 case OPCODE_SCISSOR_INDEXED_V: {
11010 GLint v[4];
11011 v[0] = n[2].i;
11012 v[1] = n[3].i;
11013 v[2] = n[4].si;
11014 v[3] = n[5].si;
11015 CALL_ScissorIndexedv(ctx->Exec, (n[1].ui, v));
11016 break;
11017 }
11018 case OPCODE_DEPTH_ARRAY_V:
11019 CALL_DepthRangeArrayv(ctx->Exec, (n[1].ui, n[2].si,
11020 get_pointer(&n[3])));
11021 break;
11022 case OPCODE_DEPTH_INDEXED:
11023 CALL_DepthRangeIndexed(ctx->Exec, (n[1].ui, n[2].f, n[3].f));
11024 break;
11025 case OPCODE_ACTIVE_TEXTURE: /* GL_ARB_multitexture */
11026 CALL_ActiveTexture(ctx->Exec, (n[1].e));
11027 break;
11028 case OPCODE_COMPRESSED_TEX_IMAGE_1D: /* GL_ARB_texture_compression */
11029 CALL_CompressedTexImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].e,
11030 n[4].i, n[5].i, n[6].i,
11031 get_pointer(&n[7])));
11032 break;
11033 case OPCODE_COMPRESSED_TEX_IMAGE_2D: /* GL_ARB_texture_compression */
11034 CALL_CompressedTexImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].e,
11035 n[4].i, n[5].i, n[6].i,
11036 n[7].i, get_pointer(&n[8])));
11037 break;
11038 case OPCODE_COMPRESSED_TEX_IMAGE_3D: /* GL_ARB_texture_compression */
11039 CALL_CompressedTexImage3D(ctx->Exec, (n[1].e, n[2].i, n[3].e,
11040 n[4].i, n[5].i, n[6].i,
11041 n[7].i, n[8].i,
11042 get_pointer(&n[9])));
11043 break;
11044 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D: /* GL_ARB_texture_compress */
11045 CALL_CompressedTexSubImage1D(ctx->Exec,
11046 (n[1].e, n[2].i, n[3].i, n[4].i,
11047 n[5].e, n[6].i,
11048 get_pointer(&n[7])));
11049 break;
11050 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D: /* GL_ARB_texture_compress */
11051 CALL_CompressedTexSubImage2D(ctx->Exec,
11052 (n[1].e, n[2].i, n[3].i, n[4].i,
11053 n[5].i, n[6].i, n[7].e, n[8].i,
11054 get_pointer(&n[9])));
11055 break;
11056 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D: /* GL_ARB_texture_compress */
11057 CALL_CompressedTexSubImage3D(ctx->Exec,
11058 (n[1].e, n[2].i, n[3].i, n[4].i,
11059 n[5].i, n[6].i, n[7].i, n[8].i,
11060 n[9].e, n[10].i,
11061 get_pointer(&n[11])));
11062 break;
11063 case OPCODE_SAMPLE_COVERAGE: /* GL_ARB_multisample */
11064 CALL_SampleCoverage(ctx->Exec, (n[1].f, n[2].b));
11065 break;
11066 case OPCODE_WINDOW_POS_ARB: /* GL_ARB_window_pos */
11067 CALL_WindowPos3f(ctx->Exec, (n[1].f, n[2].f, n[3].f));
11068 break;
11069 case OPCODE_BIND_PROGRAM_ARB: /* GL_ARB_vertex_program */
11070 CALL_BindProgramARB(ctx->Exec, (n[1].e, n[2].ui));
11071 break;
11072 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB:
11073 CALL_ProgramLocalParameter4fARB(ctx->Exec,
11074 (n[1].e, n[2].ui, n[3].f, n[4].f,
11075 n[5].f, n[6].f));
11076 break;
11077 case OPCODE_ACTIVE_STENCIL_FACE_EXT:
11078 CALL_ActiveStencilFaceEXT(ctx->Exec, (n[1].e));
11079 break;
11080 case OPCODE_DEPTH_BOUNDS_EXT:
11081 CALL_DepthBoundsEXT(ctx->Exec, (n[1].f, n[2].f));
11082 break;
11083 case OPCODE_PROGRAM_STRING_ARB:
11084 CALL_ProgramStringARB(ctx->Exec,
11085 (n[1].e, n[2].e, n[3].i,
11086 get_pointer(&n[4])));
11087 break;
11088 case OPCODE_PROGRAM_ENV_PARAMETER_ARB:
11089 CALL_ProgramEnvParameter4fARB(ctx->Exec, (n[1].e, n[2].ui, n[3].f,
11090 n[4].f, n[5].f,
11091 n[6].f));
11092 break;
11093 case OPCODE_BEGIN_QUERY_ARB:
11094 CALL_BeginQuery(ctx->Exec, (n[1].e, n[2].ui));
11095 break;
11096 case OPCODE_END_QUERY_ARB:
11097 CALL_EndQuery(ctx->Exec, (n[1].e));
11098 break;
11099 case OPCODE_QUERY_COUNTER:
11100 CALL_QueryCounter(ctx->Exec, (n[1].ui, n[2].e));
11101 break;
11102 case OPCODE_BEGIN_QUERY_INDEXED:
11103 CALL_BeginQueryIndexed(ctx->Exec, (n[1].e, n[2].ui, n[3].ui));
11104 break;
11105 case OPCODE_END_QUERY_INDEXED:
11106 CALL_EndQueryIndexed(ctx->Exec, (n[1].e, n[2].ui));
11107 break;
11108 case OPCODE_DRAW_BUFFERS_ARB:
11109 {
11110 GLenum buffers[MAX_DRAW_BUFFERS];
11111 GLint i, count = MIN2(n[1].i, MAX_DRAW_BUFFERS);
11112 for (i = 0; i < count; i++)
11113 buffers[i] = n[2 + i].e;
11114 CALL_DrawBuffers(ctx->Exec, (n[1].i, buffers));
11115 }
11116 break;
11117 case OPCODE_BLIT_FRAMEBUFFER:
11118 CALL_BlitFramebuffer(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i,
11119 n[5].i, n[6].i, n[7].i, n[8].i,
11120 n[9].i, n[10].e));
11121 break;
11122 case OPCODE_PRIMITIVE_RESTART_NV:
11123 CALL_PrimitiveRestartNV(ctx->Exec, ());
11124 break;
11125
11126 case OPCODE_USE_PROGRAM:
11127 CALL_UseProgram(ctx->Exec, (n[1].ui));
11128 break;
11129 case OPCODE_UNIFORM_1F:
11130 CALL_Uniform1f(ctx->Exec, (n[1].i, n[2].f));
11131 break;
11132 case OPCODE_UNIFORM_2F:
11133 CALL_Uniform2f(ctx->Exec, (n[1].i, n[2].f, n[3].f));
11134 break;
11135 case OPCODE_UNIFORM_3F:
11136 CALL_Uniform3f(ctx->Exec, (n[1].i, n[2].f, n[3].f, n[4].f));
11137 break;
11138 case OPCODE_UNIFORM_4F:
11139 CALL_Uniform4f(ctx->Exec,
11140 (n[1].i, n[2].f, n[3].f, n[4].f, n[5].f));
11141 break;
11142 case OPCODE_UNIFORM_1FV:
11143 CALL_Uniform1fv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11144 break;
11145 case OPCODE_UNIFORM_2FV:
11146 CALL_Uniform2fv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11147 break;
11148 case OPCODE_UNIFORM_3FV:
11149 CALL_Uniform3fv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11150 break;
11151 case OPCODE_UNIFORM_4FV:
11152 CALL_Uniform4fv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11153 break;
11154 case OPCODE_UNIFORM_1D: {
11155 union float64_pair x;
11156
11157 x.uint32[0] = n[2].ui;
11158 x.uint32[1] = n[3].ui;
11159
11160 CALL_Uniform1d(ctx->Exec, (n[1].i, x.d));
11161 break;
11162 }
11163 case OPCODE_UNIFORM_2D: {
11164 union float64_pair x;
11165 union float64_pair y;
11166
11167 x.uint32[0] = n[2].ui;
11168 x.uint32[1] = n[3].ui;
11169 y.uint32[0] = n[4].ui;
11170 y.uint32[1] = n[5].ui;
11171
11172 CALL_Uniform2d(ctx->Exec, (n[1].i, x.d, y.d));
11173 break;
11174 }
11175 case OPCODE_UNIFORM_3D: {
11176 union float64_pair x;
11177 union float64_pair y;
11178 union float64_pair z;
11179
11180 x.uint32[0] = n[2].ui;
11181 x.uint32[1] = n[3].ui;
11182 y.uint32[0] = n[4].ui;
11183 y.uint32[1] = n[5].ui;
11184 z.uint32[0] = n[6].ui;
11185 z.uint32[1] = n[7].ui;
11186
11187 CALL_Uniform3d(ctx->Exec, (n[1].i, x.d, y.d, z.d));
11188 break;
11189 }
11190 case OPCODE_UNIFORM_4D: {
11191 union float64_pair x;
11192 union float64_pair y;
11193 union float64_pair z;
11194 union float64_pair w;
11195
11196 x.uint32[0] = n[2].ui;
11197 x.uint32[1] = n[3].ui;
11198 y.uint32[0] = n[4].ui;
11199 y.uint32[1] = n[5].ui;
11200 z.uint32[0] = n[6].ui;
11201 z.uint32[1] = n[7].ui;
11202 w.uint32[0] = n[8].ui;
11203 w.uint32[1] = n[9].ui;
11204
11205 CALL_Uniform4d(ctx->Exec, (n[1].i, x.d, y.d, z.d, w.d));
11206 break;
11207 }
11208 case OPCODE_UNIFORM_1DV:
11209 CALL_Uniform1dv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11210 break;
11211 case OPCODE_UNIFORM_2DV:
11212 CALL_Uniform2dv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11213 break;
11214 case OPCODE_UNIFORM_3DV:
11215 CALL_Uniform3dv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11216 break;
11217 case OPCODE_UNIFORM_4DV:
11218 CALL_Uniform4dv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11219 break;
11220 case OPCODE_UNIFORM_1I:
11221 CALL_Uniform1i(ctx->Exec, (n[1].i, n[2].i));
11222 break;
11223 case OPCODE_UNIFORM_2I:
11224 CALL_Uniform2i(ctx->Exec, (n[1].i, n[2].i, n[3].i));
11225 break;
11226 case OPCODE_UNIFORM_3I:
11227 CALL_Uniform3i(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
11228 break;
11229 case OPCODE_UNIFORM_4I:
11230 CALL_Uniform4i(ctx->Exec,
11231 (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
11232 break;
11233 case OPCODE_UNIFORM_1IV:
11234 CALL_Uniform1iv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11235 break;
11236 case OPCODE_UNIFORM_2IV:
11237 CALL_Uniform2iv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11238 break;
11239 case OPCODE_UNIFORM_3IV:
11240 CALL_Uniform3iv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11241 break;
11242 case OPCODE_UNIFORM_4IV:
11243 CALL_Uniform4iv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11244 break;
11245 case OPCODE_UNIFORM_1UI:
11246 CALL_Uniform1ui(ctx->Exec, (n[1].i, n[2].i));
11247 break;
11248 case OPCODE_UNIFORM_2UI:
11249 CALL_Uniform2ui(ctx->Exec, (n[1].i, n[2].i, n[3].i));
11250 break;
11251 case OPCODE_UNIFORM_3UI:
11252 CALL_Uniform3ui(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
11253 break;
11254 case OPCODE_UNIFORM_4UI:
11255 CALL_Uniform4ui(ctx->Exec,
11256 (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
11257 break;
11258 case OPCODE_UNIFORM_1UIV:
11259 CALL_Uniform1uiv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11260 break;
11261 case OPCODE_UNIFORM_2UIV:
11262 CALL_Uniform2uiv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11263 break;
11264 case OPCODE_UNIFORM_3UIV:
11265 CALL_Uniform3uiv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11266 break;
11267 case OPCODE_UNIFORM_4UIV:
11268 CALL_Uniform4uiv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11269 break;
11270 case OPCODE_UNIFORM_MATRIX22:
11271 CALL_UniformMatrix2fv(ctx->Exec,
11272 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11273 break;
11274 case OPCODE_UNIFORM_MATRIX33:
11275 CALL_UniformMatrix3fv(ctx->Exec,
11276 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11277 break;
11278 case OPCODE_UNIFORM_MATRIX44:
11279 CALL_UniformMatrix4fv(ctx->Exec,
11280 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11281 break;
11282 case OPCODE_UNIFORM_MATRIX23:
11283 CALL_UniformMatrix2x3fv(ctx->Exec,
11284 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11285 break;
11286 case OPCODE_UNIFORM_MATRIX32:
11287 CALL_UniformMatrix3x2fv(ctx->Exec,
11288 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11289 break;
11290 case OPCODE_UNIFORM_MATRIX24:
11291 CALL_UniformMatrix2x4fv(ctx->Exec,
11292 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11293 break;
11294 case OPCODE_UNIFORM_MATRIX42:
11295 CALL_UniformMatrix4x2fv(ctx->Exec,
11296 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11297 break;
11298 case OPCODE_UNIFORM_MATRIX34:
11299 CALL_UniformMatrix3x4fv(ctx->Exec,
11300 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11301 break;
11302 case OPCODE_UNIFORM_MATRIX43:
11303 CALL_UniformMatrix4x3fv(ctx->Exec,
11304 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11305 break;
11306 case OPCODE_UNIFORM_MATRIX22D:
11307 CALL_UniformMatrix2dv(ctx->Exec,
11308 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11309 break;
11310 case OPCODE_UNIFORM_MATRIX33D:
11311 CALL_UniformMatrix3dv(ctx->Exec,
11312 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11313 break;
11314 case OPCODE_UNIFORM_MATRIX44D:
11315 CALL_UniformMatrix4dv(ctx->Exec,
11316 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11317 break;
11318 case OPCODE_UNIFORM_MATRIX23D:
11319 CALL_UniformMatrix2x3dv(ctx->Exec,
11320 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11321 break;
11322 case OPCODE_UNIFORM_MATRIX32D:
11323 CALL_UniformMatrix3x2dv(ctx->Exec,
11324 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11325 break;
11326 case OPCODE_UNIFORM_MATRIX24D:
11327 CALL_UniformMatrix2x4dv(ctx->Exec,
11328 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11329 break;
11330 case OPCODE_UNIFORM_MATRIX42D:
11331 CALL_UniformMatrix4x2dv(ctx->Exec,
11332 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11333 break;
11334 case OPCODE_UNIFORM_MATRIX34D:
11335 CALL_UniformMatrix3x4dv(ctx->Exec,
11336 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11337 break;
11338 case OPCODE_UNIFORM_MATRIX43D:
11339 CALL_UniformMatrix4x3dv(ctx->Exec,
11340 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11341 break;
11342
11343 case OPCODE_USE_PROGRAM_STAGES:
11344 CALL_UseProgramStages(ctx->Exec, (n[1].ui, n[2].ui, n[3].ui));
11345 break;
11346 case OPCODE_PROGRAM_UNIFORM_1F:
11347 CALL_ProgramUniform1f(ctx->Exec, (n[1].ui, n[2].i, n[3].f));
11348 break;
11349 case OPCODE_PROGRAM_UNIFORM_2F:
11350 CALL_ProgramUniform2f(ctx->Exec, (n[1].ui, n[2].i, n[3].f, n[4].f));
11351 break;
11352 case OPCODE_PROGRAM_UNIFORM_3F:
11353 CALL_ProgramUniform3f(ctx->Exec, (n[1].ui, n[2].i,
11354 n[3].f, n[4].f, n[5].f));
11355 break;
11356 case OPCODE_PROGRAM_UNIFORM_4F:
11357 CALL_ProgramUniform4f(ctx->Exec, (n[1].ui, n[2].i,
11358 n[3].f, n[4].f, n[5].f, n[6].f));
11359 break;
11360 case OPCODE_PROGRAM_UNIFORM_1FV:
11361 CALL_ProgramUniform1fv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11362 get_pointer(&n[4])));
11363 break;
11364 case OPCODE_PROGRAM_UNIFORM_2FV:
11365 CALL_ProgramUniform2fv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11366 get_pointer(&n[4])));
11367 break;
11368 case OPCODE_PROGRAM_UNIFORM_3FV:
11369 CALL_ProgramUniform3fv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11370 get_pointer(&n[4])));
11371 break;
11372 case OPCODE_PROGRAM_UNIFORM_4FV:
11373 CALL_ProgramUniform4fv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11374 get_pointer(&n[4])));
11375 break;
11376 case OPCODE_PROGRAM_UNIFORM_1D: {
11377 union float64_pair x;
11378
11379 x.uint32[0] = n[3].ui;
11380 x.uint32[1] = n[4].ui;
11381
11382 CALL_ProgramUniform1d(ctx->Exec, (n[1].ui, n[2].i, x.d));
11383 break;
11384 }
11385 case OPCODE_PROGRAM_UNIFORM_2D: {
11386 union float64_pair x;
11387 union float64_pair y;
11388
11389 x.uint32[0] = n[3].ui;
11390 x.uint32[1] = n[4].ui;
11391 y.uint32[0] = n[5].ui;
11392 y.uint32[1] = n[6].ui;
11393
11394 CALL_ProgramUniform2d(ctx->Exec, (n[1].ui, n[2].i, x.d, y.d));
11395 break;
11396 }
11397 case OPCODE_PROGRAM_UNIFORM_3D: {
11398 union float64_pair x;
11399 union float64_pair y;
11400 union float64_pair z;
11401
11402 x.uint32[0] = n[3].ui;
11403 x.uint32[1] = n[4].ui;
11404 y.uint32[0] = n[5].ui;
11405 y.uint32[1] = n[6].ui;
11406 z.uint32[0] = n[7].ui;
11407 z.uint32[1] = n[8].ui;
11408
11409 CALL_ProgramUniform3d(ctx->Exec, (n[1].ui, n[2].i,
11410 x.d, y.d, z.d));
11411 break;
11412 }
11413 case OPCODE_PROGRAM_UNIFORM_4D: {
11414 union float64_pair x;
11415 union float64_pair y;
11416 union float64_pair z;
11417 union float64_pair w;
11418
11419 x.uint32[0] = n[3].ui;
11420 x.uint32[1] = n[4].ui;
11421 y.uint32[0] = n[5].ui;
11422 y.uint32[1] = n[6].ui;
11423 z.uint32[0] = n[7].ui;
11424 z.uint32[1] = n[8].ui;
11425 w.uint32[0] = n[9].ui;
11426 w.uint32[1] = n[10].ui;
11427
11428 CALL_ProgramUniform4d(ctx->Exec, (n[1].ui, n[2].i,
11429 x.d, y.d, z.d, w.d));
11430 break;
11431 }
11432 case OPCODE_PROGRAM_UNIFORM_1DV:
11433 CALL_ProgramUniform1dv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11434 get_pointer(&n[4])));
11435 break;
11436 case OPCODE_PROGRAM_UNIFORM_2DV:
11437 CALL_ProgramUniform2dv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11438 get_pointer(&n[4])));
11439 break;
11440 case OPCODE_PROGRAM_UNIFORM_3DV:
11441 CALL_ProgramUniform3dv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11442 get_pointer(&n[4])));
11443 break;
11444 case OPCODE_PROGRAM_UNIFORM_4DV:
11445 CALL_ProgramUniform4dv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11446 get_pointer(&n[4])));
11447 break;
11448 case OPCODE_PROGRAM_UNIFORM_1I:
11449 CALL_ProgramUniform1i(ctx->Exec, (n[1].ui, n[2].i, n[3].i));
11450 break;
11451 case OPCODE_PROGRAM_UNIFORM_2I:
11452 CALL_ProgramUniform2i(ctx->Exec, (n[1].ui, n[2].i, n[3].i, n[4].i));
11453 break;
11454 case OPCODE_PROGRAM_UNIFORM_3I:
11455 CALL_ProgramUniform3i(ctx->Exec, (n[1].ui, n[2].i,
11456 n[3].i, n[4].i, n[5].i));
11457 break;
11458 case OPCODE_PROGRAM_UNIFORM_4I:
11459 CALL_ProgramUniform4i(ctx->Exec, (n[1].ui, n[2].i,
11460 n[3].i, n[4].i, n[5].i, n[6].i));
11461 break;
11462 case OPCODE_PROGRAM_UNIFORM_1IV:
11463 CALL_ProgramUniform1iv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11464 get_pointer(&n[4])));
11465 break;
11466 case OPCODE_PROGRAM_UNIFORM_2IV:
11467 CALL_ProgramUniform2iv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11468 get_pointer(&n[4])));
11469 break;
11470 case OPCODE_PROGRAM_UNIFORM_3IV:
11471 CALL_ProgramUniform3iv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11472 get_pointer(&n[4])));
11473 break;
11474 case OPCODE_PROGRAM_UNIFORM_4IV:
11475 CALL_ProgramUniform4iv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11476 get_pointer(&n[4])));
11477 break;
11478 case OPCODE_PROGRAM_UNIFORM_1UI:
11479 CALL_ProgramUniform1ui(ctx->Exec, (n[1].ui, n[2].i, n[3].ui));
11480 break;
11481 case OPCODE_PROGRAM_UNIFORM_2UI:
11482 CALL_ProgramUniform2ui(ctx->Exec, (n[1].ui, n[2].i,
11483 n[3].ui, n[4].ui));
11484 break;
11485 case OPCODE_PROGRAM_UNIFORM_3UI:
11486 CALL_ProgramUniform3ui(ctx->Exec, (n[1].ui, n[2].i,
11487 n[3].ui, n[4].ui, n[5].ui));
11488 break;
11489 case OPCODE_PROGRAM_UNIFORM_4UI:
11490 CALL_ProgramUniform4ui(ctx->Exec, (n[1].ui, n[2].i,
11491 n[3].ui,
11492 n[4].ui, n[5].ui, n[6].ui));
11493 break;
11494 case OPCODE_PROGRAM_UNIFORM_1UIV:
11495 CALL_ProgramUniform1uiv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11496 get_pointer(&n[4])));
11497 break;
11498 case OPCODE_PROGRAM_UNIFORM_2UIV:
11499 CALL_ProgramUniform2uiv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11500 get_pointer(&n[4])));
11501 break;
11502 case OPCODE_PROGRAM_UNIFORM_3UIV:
11503 CALL_ProgramUniform3uiv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11504 get_pointer(&n[4])));
11505 break;
11506 case OPCODE_PROGRAM_UNIFORM_4UIV:
11507 CALL_ProgramUniform4uiv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11508 get_pointer(&n[4])));
11509 break;
11510 case OPCODE_PROGRAM_UNIFORM_MATRIX22F:
11511 CALL_ProgramUniformMatrix2fv(ctx->Exec,
11512 (n[1].ui, n[2].i, n[3].i, n[4].b,
11513 get_pointer(&n[5])));
11514 break;
11515 case OPCODE_PROGRAM_UNIFORM_MATRIX23F:
11516 CALL_ProgramUniformMatrix2x3fv(ctx->Exec,
11517 (n[1].ui, n[2].i, n[3].i, n[4].b,
11518 get_pointer(&n[5])));
11519 break;
11520 case OPCODE_PROGRAM_UNIFORM_MATRIX24F:
11521 CALL_ProgramUniformMatrix2x4fv(ctx->Exec,
11522 (n[1].ui, n[2].i, n[3].i, n[4].b,
11523 get_pointer(&n[5])));
11524 break;
11525 case OPCODE_PROGRAM_UNIFORM_MATRIX32F:
11526 CALL_ProgramUniformMatrix3x2fv(ctx->Exec,
11527 (n[1].ui, n[2].i, n[3].i, n[4].b,
11528 get_pointer(&n[5])));
11529 break;
11530 case OPCODE_PROGRAM_UNIFORM_MATRIX33F:
11531 CALL_ProgramUniformMatrix3fv(ctx->Exec,
11532 (n[1].ui, n[2].i, n[3].i, n[4].b,
11533 get_pointer(&n[5])));
11534 break;
11535 case OPCODE_PROGRAM_UNIFORM_MATRIX34F:
11536 CALL_ProgramUniformMatrix3x4fv(ctx->Exec,
11537 (n[1].ui, n[2].i, n[3].i, n[4].b,
11538 get_pointer(&n[5])));
11539 break;
11540 case OPCODE_PROGRAM_UNIFORM_MATRIX42F:
11541 CALL_ProgramUniformMatrix4x2fv(ctx->Exec,
11542 (n[1].ui, n[2].i, n[3].i, n[4].b,
11543 get_pointer(&n[5])));
11544 break;
11545 case OPCODE_PROGRAM_UNIFORM_MATRIX43F:
11546 CALL_ProgramUniformMatrix4x3fv(ctx->Exec,
11547 (n[1].ui, n[2].i, n[3].i, n[4].b,
11548 get_pointer(&n[5])));
11549 break;
11550 case OPCODE_PROGRAM_UNIFORM_MATRIX44F:
11551 CALL_ProgramUniformMatrix4fv(ctx->Exec,
11552 (n[1].ui, n[2].i, n[3].i, n[4].b,
11553 get_pointer(&n[5])));
11554 break;
11555 case OPCODE_PROGRAM_UNIFORM_MATRIX22D:
11556 CALL_ProgramUniformMatrix2dv(ctx->Exec,
11557 (n[1].ui, n[2].i, n[3].i, n[4].b,
11558 get_pointer(&n[5])));
11559 break;
11560 case OPCODE_PROGRAM_UNIFORM_MATRIX23D:
11561 CALL_ProgramUniformMatrix2x3dv(ctx->Exec,
11562 (n[1].ui, n[2].i, n[3].i, n[4].b,
11563 get_pointer(&n[5])));
11564 break;
11565 case OPCODE_PROGRAM_UNIFORM_MATRIX24D:
11566 CALL_ProgramUniformMatrix2x4dv(ctx->Exec,
11567 (n[1].ui, n[2].i, n[3].i, n[4].b,
11568 get_pointer(&n[5])));
11569 break;
11570 case OPCODE_PROGRAM_UNIFORM_MATRIX32D:
11571 CALL_ProgramUniformMatrix3x2dv(ctx->Exec,
11572 (n[1].ui, n[2].i, n[3].i, n[4].b,
11573 get_pointer(&n[5])));
11574 break;
11575 case OPCODE_PROGRAM_UNIFORM_MATRIX33D:
11576 CALL_ProgramUniformMatrix3dv(ctx->Exec,
11577 (n[1].ui, n[2].i, n[3].i, n[4].b,
11578 get_pointer(&n[5])));
11579 break;
11580 case OPCODE_PROGRAM_UNIFORM_MATRIX34D:
11581 CALL_ProgramUniformMatrix3x4dv(ctx->Exec,
11582 (n[1].ui, n[2].i, n[3].i, n[4].b,
11583 get_pointer(&n[5])));
11584 break;
11585 case OPCODE_PROGRAM_UNIFORM_MATRIX42D:
11586 CALL_ProgramUniformMatrix4x2dv(ctx->Exec,
11587 (n[1].ui, n[2].i, n[3].i, n[4].b,
11588 get_pointer(&n[5])));
11589 break;
11590 case OPCODE_PROGRAM_UNIFORM_MATRIX43D:
11591 CALL_ProgramUniformMatrix4x3dv(ctx->Exec,
11592 (n[1].ui, n[2].i, n[3].i, n[4].b,
11593 get_pointer(&n[5])));
11594 break;
11595 case OPCODE_PROGRAM_UNIFORM_MATRIX44D:
11596 CALL_ProgramUniformMatrix4dv(ctx->Exec,
11597 (n[1].ui, n[2].i, n[3].i, n[4].b,
11598 get_pointer(&n[5])));
11599 break;
11600
11601 case OPCODE_CLIP_CONTROL:
11602 CALL_ClipControl(ctx->Exec, (n[1].e, n[2].e));
11603 break;
11604
11605 case OPCODE_CLAMP_COLOR:
11606 CALL_ClampColor(ctx->Exec, (n[1].e, n[2].e));
11607 break;
11608
11609 case OPCODE_BIND_FRAGMENT_SHADER_ATI:
11610 CALL_BindFragmentShaderATI(ctx->Exec, (n[1].i));
11611 break;
11612 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI:
11613 CALL_SetFragmentShaderConstantATI(ctx->Exec, (n[1].ui, &n[2].f));
11614 break;
11615 case OPCODE_ATTR_1F_NV:
11616 CALL_VertexAttrib1fNV(ctx->Exec, (n[1].e, n[2].f));
11617 break;
11618 case OPCODE_ATTR_2F_NV:
11619 CALL_VertexAttrib2fvNV(ctx->Exec, (n[1].e, &n[2].f));
11620 break;
11621 case OPCODE_ATTR_3F_NV:
11622 CALL_VertexAttrib3fvNV(ctx->Exec, (n[1].e, &n[2].f));
11623 break;
11624 case OPCODE_ATTR_4F_NV:
11625 CALL_VertexAttrib4fvNV(ctx->Exec, (n[1].e, &n[2].f));
11626 break;
11627 case OPCODE_ATTR_1F_ARB:
11628 CALL_VertexAttrib1fARB(ctx->Exec, (n[1].e, n[2].f));
11629 break;
11630 case OPCODE_ATTR_2F_ARB:
11631 CALL_VertexAttrib2fvARB(ctx->Exec, (n[1].e, &n[2].f));
11632 break;
11633 case OPCODE_ATTR_3F_ARB:
11634 CALL_VertexAttrib3fvARB(ctx->Exec, (n[1].e, &n[2].f));
11635 break;
11636 case OPCODE_ATTR_4F_ARB:
11637 CALL_VertexAttrib4fvARB(ctx->Exec, (n[1].e, &n[2].f));
11638 break;
11639 case OPCODE_ATTR_1D: {
11640 GLdouble *d = (GLdouble *) &n[2];
11641 CALL_VertexAttribL1d(ctx->Exec, (n[1].ui, *d));
11642 break;
11643 }
11644 case OPCODE_ATTR_2D: {
11645 GLdouble *d = (GLdouble *) &n[2];
11646 CALL_VertexAttribL2dv(ctx->Exec, (n[1].ui, d));
11647 break;
11648 }
11649 case OPCODE_ATTR_3D: {
11650 GLdouble *d = (GLdouble *) &n[2];
11651 CALL_VertexAttribL3dv(ctx->Exec, (n[1].ui, d));
11652 break;
11653 }
11654 case OPCODE_ATTR_4D: {
11655 GLdouble *d = (GLdouble *) &n[2];
11656 CALL_VertexAttribL4dv(ctx->Exec, (n[1].ui, d));
11657 break;
11658 }
11659 case OPCODE_MATERIAL:
11660 CALL_Materialfv(ctx->Exec, (n[1].e, n[2].e, &n[3].f));
11661 break;
11662 case OPCODE_BEGIN:
11663 CALL_Begin(ctx->Exec, (n[1].e));
11664 break;
11665 case OPCODE_END:
11666 CALL_End(ctx->Exec, ());
11667 break;
11668 case OPCODE_RECTF:
11669 CALL_Rectf(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
11670 break;
11671 case OPCODE_EVAL_C1:
11672 CALL_EvalCoord1f(ctx->Exec, (n[1].f));
11673 break;
11674 case OPCODE_EVAL_C2:
11675 CALL_EvalCoord2f(ctx->Exec, (n[1].f, n[2].f));
11676 break;
11677 case OPCODE_EVAL_P1:
11678 CALL_EvalPoint1(ctx->Exec, (n[1].i));
11679 break;
11680 case OPCODE_EVAL_P2:
11681 CALL_EvalPoint2(ctx->Exec, (n[1].i, n[2].i));
11682 break;
11683
11684 /* GL_EXT_texture_integer */
11685 case OPCODE_CLEARCOLOR_I:
11686 CALL_ClearColorIiEXT(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
11687 break;
11688 case OPCODE_CLEARCOLOR_UI:
11689 CALL_ClearColorIuiEXT(ctx->Exec,
11690 (n[1].ui, n[2].ui, n[3].ui, n[4].ui));
11691 break;
11692 case OPCODE_TEXPARAMETER_I:
11693 {
11694 GLint params[4];
11695 params[0] = n[3].i;
11696 params[1] = n[4].i;
11697 params[2] = n[5].i;
11698 params[3] = n[6].i;
11699 CALL_TexParameterIiv(ctx->Exec, (n[1].e, n[2].e, params));
11700 }
11701 break;
11702 case OPCODE_TEXPARAMETER_UI:
11703 {
11704 GLuint params[4];
11705 params[0] = n[3].ui;
11706 params[1] = n[4].ui;
11707 params[2] = n[5].ui;
11708 params[3] = n[6].ui;
11709 CALL_TexParameterIuiv(ctx->Exec, (n[1].e, n[2].e, params));
11710 }
11711 break;
11712
11713 case OPCODE_VERTEX_ATTRIB_DIVISOR:
11714 /* GL_ARB_instanced_arrays */
11715 CALL_VertexAttribDivisor(ctx->Exec, (n[1].ui, n[2].ui));
11716 break;
11717
11718 case OPCODE_TEXTURE_BARRIER_NV:
11719 CALL_TextureBarrierNV(ctx->Exec, ());
11720 break;
11721
11722 /* GL_EXT/ARB_transform_feedback */
11723 case OPCODE_BEGIN_TRANSFORM_FEEDBACK:
11724 CALL_BeginTransformFeedback(ctx->Exec, (n[1].e));
11725 break;
11726 case OPCODE_END_TRANSFORM_FEEDBACK:
11727 CALL_EndTransformFeedback(ctx->Exec, ());
11728 break;
11729 case OPCODE_BIND_TRANSFORM_FEEDBACK:
11730 CALL_BindTransformFeedback(ctx->Exec, (n[1].e, n[2].ui));
11731 break;
11732 case OPCODE_PAUSE_TRANSFORM_FEEDBACK:
11733 CALL_PauseTransformFeedback(ctx->Exec, ());
11734 break;
11735 case OPCODE_RESUME_TRANSFORM_FEEDBACK:
11736 CALL_ResumeTransformFeedback(ctx->Exec, ());
11737 break;
11738 case OPCODE_DRAW_TRANSFORM_FEEDBACK:
11739 CALL_DrawTransformFeedback(ctx->Exec, (n[1].e, n[2].ui));
11740 break;
11741 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM:
11742 CALL_DrawTransformFeedbackStream(ctx->Exec,
11743 (n[1].e, n[2].ui, n[3].ui));
11744 break;
11745 case OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED:
11746 CALL_DrawTransformFeedbackInstanced(ctx->Exec,
11747 (n[1].e, n[2].ui, n[3].si));
11748 break;
11749 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED:
11750 CALL_DrawTransformFeedbackStreamInstanced(ctx->Exec,
11751 (n[1].e, n[2].ui, n[3].ui, n[4].si));
11752 break;
11753
11754
11755 case OPCODE_BIND_SAMPLER:
11756 CALL_BindSampler(ctx->Exec, (n[1].ui, n[2].ui));
11757 break;
11758 case OPCODE_SAMPLER_PARAMETERIV:
11759 {
11760 GLint params[4];
11761 params[0] = n[3].i;
11762 params[1] = n[4].i;
11763 params[2] = n[5].i;
11764 params[3] = n[6].i;
11765 CALL_SamplerParameteriv(ctx->Exec, (n[1].ui, n[2].e, params));
11766 }
11767 break;
11768 case OPCODE_SAMPLER_PARAMETERFV:
11769 {
11770 GLfloat params[4];
11771 params[0] = n[3].f;
11772 params[1] = n[4].f;
11773 params[2] = n[5].f;
11774 params[3] = n[6].f;
11775 CALL_SamplerParameterfv(ctx->Exec, (n[1].ui, n[2].e, params));
11776 }
11777 break;
11778 case OPCODE_SAMPLER_PARAMETERIIV:
11779 {
11780 GLint params[4];
11781 params[0] = n[3].i;
11782 params[1] = n[4].i;
11783 params[2] = n[5].i;
11784 params[3] = n[6].i;
11785 CALL_SamplerParameterIiv(ctx->Exec, (n[1].ui, n[2].e, params));
11786 }
11787 break;
11788 case OPCODE_SAMPLER_PARAMETERUIV:
11789 {
11790 GLuint params[4];
11791 params[0] = n[3].ui;
11792 params[1] = n[4].ui;
11793 params[2] = n[5].ui;
11794 params[3] = n[6].ui;
11795 CALL_SamplerParameterIuiv(ctx->Exec, (n[1].ui, n[2].e, params));
11796 }
11797 break;
11798
11799 /* ARB_compute_shader */
11800 case OPCODE_DISPATCH_COMPUTE:
11801 CALL_DispatchCompute(ctx->Exec, (n[1].ui, n[2].ui, n[3].ui));
11802 break;
11803
11804 /* GL_ARB_sync */
11805 case OPCODE_WAIT_SYNC:
11806 {
11807 union uint64_pair p;
11808 p.uint32[0] = n[2].ui;
11809 p.uint32[1] = n[3].ui;
11810 CALL_WaitSync(ctx->Exec,
11811 (get_pointer(&n[4]), n[1].bf, p.uint64));
11812 }
11813 break;
11814
11815 /* GL_NV_conditional_render */
11816 case OPCODE_BEGIN_CONDITIONAL_RENDER:
11817 CALL_BeginConditionalRender(ctx->Exec, (n[1].i, n[2].e));
11818 break;
11819 case OPCODE_END_CONDITIONAL_RENDER:
11820 CALL_EndConditionalRender(ctx->Exec, ());
11821 break;
11822
11823 case OPCODE_UNIFORM_BLOCK_BINDING:
11824 CALL_UniformBlockBinding(ctx->Exec, (n[1].ui, n[2].ui, n[3].ui));
11825 break;
11826
11827 case OPCODE_UNIFORM_SUBROUTINES:
11828 CALL_UniformSubroutinesuiv(ctx->Exec, (n[1].e, n[2].si,
11829 get_pointer(&n[3])));
11830 break;
11831
11832 /* GL_EXT_window_rectangles */
11833 case OPCODE_WINDOW_RECTANGLES:
11834 CALL_WindowRectanglesEXT(
11835 ctx->Exec, (n[1].e, n[2].si, get_pointer(&n[3])));
11836 break;
11837
11838 /* GL_NV_conservative_raster */
11839 case OPCODE_SUBPIXEL_PRECISION_BIAS:
11840 CALL_SubpixelPrecisionBiasNV(ctx->Exec, (n[1].ui, n[2].ui));
11841 break;
11842
11843 /* GL_NV_conservative_raster_dilate */
11844 case OPCODE_CONSERVATIVE_RASTER_PARAMETER_F:
11845 CALL_ConservativeRasterParameterfNV(ctx->Exec, (n[1].e, n[2].f));
11846 break;
11847
11848 /* GL_NV_conservative_raster_pre_snap_triangles */
11849 case OPCODE_CONSERVATIVE_RASTER_PARAMETER_I:
11850 CALL_ConservativeRasterParameteriNV(ctx->Exec, (n[1].e, n[2].i));
11851 break;
11852
11853 /* GL_EXT_direct_state_access */
11854 case OPCODE_MATRIX_LOAD:
11855 CALL_MatrixLoadfEXT(ctx->Exec, (n[1].e, &n[2].f));
11856 break;
11857 case OPCODE_MATRIX_MULT:
11858 CALL_MatrixMultfEXT(ctx->Exec, (n[1].e, &n[2].f));
11859 break;
11860 case OPCODE_MATRIX_ROTATE:
11861 CALL_MatrixRotatefEXT(ctx->Exec, (n[1].e, n[2].f, n[3].f, n[4].f, n[5].f));
11862 break;
11863 case OPCODE_MATRIX_SCALE:
11864 CALL_MatrixScalefEXT(ctx->Exec, (n[1].e, n[2].f, n[3].f, n[4].f));
11865 break;
11866 case OPCODE_MATRIX_TRANSLATE:
11867 CALL_MatrixTranslatefEXT(ctx->Exec, (n[1].e, n[2].f, n[3].f, n[4].f));
11868 break;
11869 case OPCODE_MATRIX_LOAD_IDENTITY:
11870 CALL_MatrixLoadIdentityEXT(ctx->Exec, (n[1].e));
11871 break;
11872 case OPCODE_MATRIX_ORTHO:
11873 CALL_MatrixOrthoEXT(ctx->Exec, (n[1].e,
11874 n[2].f, n[3].f, n[4].f,
11875 n[5].f, n[6].f, n[7].f));
11876 break;
11877 case OPCODE_MATRIX_FRUSTUM:
11878 CALL_MatrixFrustumEXT(ctx->Exec, (n[1].e,
11879 n[2].f, n[3].f, n[4].f,
11880 n[5].f, n[6].f, n[7].f));
11881 break;
11882 case OPCODE_MATRIX_PUSH:
11883 CALL_MatrixPushEXT(ctx->Exec, (n[1].e));
11884 break;
11885 case OPCODE_MATRIX_POP:
11886 CALL_MatrixPopEXT(ctx->Exec, (n[1].e));
11887 break;
11888 case OPCODE_TEXTUREPARAMETER_F:
11889 {
11890 GLfloat params[4];
11891 params[0] = n[4].f;
11892 params[1] = n[5].f;
11893 params[2] = n[6].f;
11894 params[3] = n[7].f;
11895 CALL_TextureParameterfvEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].e, params));
11896 }
11897 break;
11898 case OPCODE_TEXTUREPARAMETER_I:
11899 {
11900 GLint params[4];
11901 params[0] = n[4].i;
11902 params[1] = n[5].i;
11903 params[2] = n[6].i;
11904 params[3] = n[7].i;
11905 CALL_TextureParameterivEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].e, params));
11906 }
11907 break;
11908 case OPCODE_TEXTURE_IMAGE1D:
11909 {
11910 const struct gl_pixelstore_attrib save = ctx->Unpack;
11911 ctx->Unpack = ctx->DefaultPacking;
11912 CALL_TextureImage1DEXT(ctx->Exec, (n[1].ui, /* texture */
11913 n[2].e, /* target */
11914 n[3].i, /* level */
11915 n[4].i, /* components */
11916 n[5].i, /* width */
11917 n[6].e, /* border */
11918 n[7].e, /* format */
11919 n[8].e, /* type */
11920 get_pointer(&n[9])));
11921 ctx->Unpack = save; /* restore */
11922 }
11923 break;
11924 case OPCODE_TEXTURE_IMAGE2D:
11925 {
11926 const struct gl_pixelstore_attrib save = ctx->Unpack;
11927 ctx->Unpack = ctx->DefaultPacking;
11928 CALL_TextureImage2DEXT(ctx->Exec, (n[1].ui, /* texture */
11929 n[2].e, /* target */
11930 n[3].i, /* level */
11931 n[4].i, /* components */
11932 n[5].i, /* width */
11933 n[6].i, /* height */
11934 n[7].e, /* border */
11935 n[8].e, /* format */
11936 n[9].e, /* type */
11937 get_pointer(&n[10])));
11938 ctx->Unpack = save; /* restore */
11939 }
11940 break;
11941 case OPCODE_TEXTURE_IMAGE3D:
11942 {
11943 const struct gl_pixelstore_attrib save = ctx->Unpack;
11944 ctx->Unpack = ctx->DefaultPacking;
11945 CALL_TextureImage3DEXT(ctx->Exec, (n[1].ui, /* texture */
11946 n[2].e, /* target */
11947 n[3].i, /* level */
11948 n[4].i, /* components */
11949 n[5].i, /* width */
11950 n[6].i, /* height */
11951 n[7].i, /* depth */
11952 n[8].e, /* border */
11953 n[9].e, /* format */
11954 n[10].e, /* type */
11955 get_pointer(&n[11])));
11956 ctx->Unpack = save; /* restore */
11957 }
11958 break;
11959 case OPCODE_TEXTURE_SUB_IMAGE1D:
11960 {
11961 const struct gl_pixelstore_attrib save = ctx->Unpack;
11962 ctx->Unpack = ctx->DefaultPacking;
11963 CALL_TextureSubImage1DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
11964 n[4].i, n[5].i, n[6].e,
11965 n[7].e, get_pointer(&n[8])));
11966 ctx->Unpack = save; /* restore */
11967 }
11968 break;
11969 case OPCODE_TEXTURE_SUB_IMAGE2D:
11970 {
11971 const struct gl_pixelstore_attrib save = ctx->Unpack;
11972 ctx->Unpack = ctx->DefaultPacking;
11973 CALL_TextureSubImage2DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
11974 n[4].i, n[5].i, n[6].e,
11975 n[7].i, n[8].e, n[9].e,
11976 get_pointer(&n[10])));
11977 ctx->Unpack = save;
11978 }
11979 break;
11980 case OPCODE_TEXTURE_SUB_IMAGE3D:
11981 {
11982 const struct gl_pixelstore_attrib save = ctx->Unpack;
11983 ctx->Unpack = ctx->DefaultPacking;
11984 CALL_TextureSubImage3DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
11985 n[4].i, n[5].i, n[6].i,
11986 n[7].i, n[8].i, n[9].i,
11987 n[10].e, n[11].e,
11988 get_pointer(&n[12])));
11989 ctx->Unpack = save; /* restore */
11990 }
11991 break;
11992 case OPCODE_COPY_TEXTURE_IMAGE1D:
11993 CALL_CopyTextureImage1DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
11994 n[4].e, n[5].i, n[6].i,
11995 n[7].i, n[8].i));
11996 break;
11997 case OPCODE_COPY_TEXTURE_IMAGE2D:
11998 CALL_CopyTextureImage2DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
11999 n[4].e, n[5].i, n[6].i,
12000 n[7].i, n[8].i, n[9].i));
12001 break;
12002 case OPCODE_COPY_TEXTURE_SUB_IMAGE1D:
12003 CALL_CopyTextureSubImage1DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
12004 n[4].i, n[5].i, n[6].i,
12005 n[7].i));
12006 break;
12007 case OPCODE_COPY_TEXTURE_SUB_IMAGE2D:
12008 CALL_CopyTextureSubImage2DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
12009 n[4].i, n[5].i, n[6].i,
12010 n[7].i, n[8].i, n[9].i));
12011 break;
12012 case OPCODE_COPY_TEXTURE_SUB_IMAGE3D:
12013 CALL_CopyTextureSubImage3DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
12014 n[4].i, n[5].i, n[6].i,
12015 n[7].i, n[8].i, n[9].i,
12016 n[10].i));
12017 break;
12018 case OPCODE_BIND_MULTITEXTURE:
12019 CALL_BindMultiTextureEXT(ctx->Exec, (n[1].e, n[2].e, n[3].ui));
12020 break;
12021 case OPCODE_MULTITEXPARAMETER_F:
12022 {
12023 GLfloat params[4];
12024 params[0] = n[4].f;
12025 params[1] = n[5].f;
12026 params[2] = n[6].f;
12027 params[3] = n[7].f;
12028 CALL_MultiTexParameterfvEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, params));
12029 }
12030 break;
12031 case OPCODE_MULTITEXPARAMETER_I:
12032 {
12033 GLint params[4];
12034 params[0] = n[4].i;
12035 params[1] = n[5].i;
12036 params[2] = n[6].i;
12037 params[3] = n[7].i;
12038 CALL_MultiTexParameterivEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, params));
12039 }
12040 break;
12041 case OPCODE_MULTITEX_IMAGE1D:
12042 {
12043 const struct gl_pixelstore_attrib save = ctx->Unpack;
12044 ctx->Unpack = ctx->DefaultPacking;
12045 CALL_MultiTexImage1DEXT(ctx->Exec, (n[1].e, /* texture */
12046 n[2].e, /* target */
12047 n[3].i, /* level */
12048 n[4].i, /* components */
12049 n[5].i, /* width */
12050 n[6].e, /* border */
12051 n[7].e, /* format */
12052 n[8].e, /* type */
12053 get_pointer(&n[9])));
12054 ctx->Unpack = save; /* restore */
12055 }
12056 break;
12057 case OPCODE_MULTITEX_IMAGE2D:
12058 {
12059 const struct gl_pixelstore_attrib save = ctx->Unpack;
12060 ctx->Unpack = ctx->DefaultPacking;
12061 CALL_MultiTexImage2DEXT(ctx->Exec, (n[1].e, /* texture */
12062 n[2].e, /* target */
12063 n[3].i, /* level */
12064 n[4].i, /* components */
12065 n[5].i, /* width */
12066 n[6].i, /* height */
12067 n[7].e, /* border */
12068 n[8].e, /* format */
12069 n[9].e, /* type */
12070 get_pointer(&n[10])));
12071 ctx->Unpack = save; /* restore */
12072 }
12073 break;
12074 case OPCODE_MULTITEX_IMAGE3D:
12075 {
12076 const struct gl_pixelstore_attrib save = ctx->Unpack;
12077 ctx->Unpack = ctx->DefaultPacking;
12078 CALL_MultiTexImage3DEXT(ctx->Exec, (n[1].e, /* texture */
12079 n[2].e, /* target */
12080 n[3].i, /* level */
12081 n[4].i, /* components */
12082 n[5].i, /* width */
12083 n[6].i, /* height */
12084 n[7].i, /* depth */
12085 n[8].e, /* border */
12086 n[9].e, /* format */
12087 n[10].e, /* type */
12088 get_pointer(&n[11])));
12089 ctx->Unpack = save; /* restore */
12090 }
12091 break;
12092 case OPCODE_MULTITEX_SUB_IMAGE1D:
12093 {
12094 const struct gl_pixelstore_attrib save = ctx->Unpack;
12095 ctx->Unpack = ctx->DefaultPacking;
12096 CALL_MultiTexSubImage1DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
12097 n[4].i, n[5].i, n[6].e,
12098 n[7].e, get_pointer(&n[8])));
12099 ctx->Unpack = save; /* restore */
12100 }
12101 break;
12102 case OPCODE_MULTITEX_SUB_IMAGE2D:
12103 {
12104 const struct gl_pixelstore_attrib save = ctx->Unpack;
12105 ctx->Unpack = ctx->DefaultPacking;
12106 CALL_MultiTexSubImage2DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
12107 n[4].i, n[5].i, n[6].e,
12108 n[7].i, n[8].e, n[9].e,
12109 get_pointer(&n[10])));
12110 ctx->Unpack = save; /* restore */
12111 }
12112 break;
12113 case OPCODE_MULTITEX_SUB_IMAGE3D:
12114 {
12115 const struct gl_pixelstore_attrib save = ctx->Unpack;
12116 ctx->Unpack = ctx->DefaultPacking;
12117 CALL_MultiTexSubImage3DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
12118 n[4].i, n[5].i, n[6].i,
12119 n[7].i, n[8].i, n[9].i,
12120 n[10].e, n[11].e,
12121 get_pointer(&n[12])));
12122 ctx->Unpack = save; /* restore */
12123 }
12124 break;
12125 case OPCODE_MULTITEXENV:
12126 {
12127 GLfloat params[4];
12128 params[0] = n[4].f;
12129 params[1] = n[5].f;
12130 params[2] = n[6].f;
12131 params[3] = n[7].f;
12132 CALL_MultiTexEnvfvEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, params));
12133 }
12134 break;
12135 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_2D:
12136 CALL_CompressedTextureSubImage2DEXT(ctx->Exec,
12137 (n[1].ui, n[2].e, n[3].i, n[4].i,
12138 n[5].i, n[6].i, n[7].i, n[8].e,
12139 n[9].i, get_pointer(&n[10])));
12140 break;
12141
12142 case OPCODE_CONTINUE:
12143 n = (Node *) get_pointer(&n[1]);
12144 break;
12145 case OPCODE_NOP:
12146 /* no-op */
12147 break;
12148 case OPCODE_END_OF_LIST:
12149 done = GL_TRUE;
12150 break;
12151 default:
12152 {
12153 char msg[1000];
12154 _mesa_snprintf(msg, sizeof(msg), "Error in execute_list: opcode=%d",
12155 (int) opcode);
12156 _mesa_problem(ctx, "%s", msg);
12157 }
12158 done = GL_TRUE;
12159 }
12160
12161 /* increment n to point to next compiled command */
12162 if (opcode != OPCODE_CONTINUE) {
12163 assert(InstSize[opcode] > 0);
12164 n += InstSize[opcode];
12165 }
12166 }
12167 }
12168
12169 vbo_save_EndCallList(ctx);
12170
12171 ctx->ListState.CallDepth--;
12172 }
12173
12174
12175
12176 /**********************************************************************/
12177 /* GL functions */
12178 /**********************************************************************/
12179
12180 /**
12181 * Test if a display list number is valid.
12182 */
12183 GLboolean GLAPIENTRY
12184 _mesa_IsList(GLuint list)
12185 {
12186 GET_CURRENT_CONTEXT(ctx);
12187 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
12188 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
12189 return islist(ctx, list);
12190 }
12191
12192
12193 /**
12194 * Delete a sequence of consecutive display lists.
12195 */
12196 void GLAPIENTRY
12197 _mesa_DeleteLists(GLuint list, GLsizei range)
12198 {
12199 GET_CURRENT_CONTEXT(ctx);
12200 GLuint i;
12201 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
12202 ASSERT_OUTSIDE_BEGIN_END(ctx);
12203
12204 if (range < 0) {
12205 _mesa_error(ctx, GL_INVALID_VALUE, "glDeleteLists");
12206 return;
12207 }
12208
12209 if (range > 1) {
12210 /* We may be deleting a set of bitmap lists. See if there's a
12211 * bitmap atlas to free.
12212 */
12213 struct gl_bitmap_atlas *atlas = lookup_bitmap_atlas(ctx, list);
12214 if (atlas) {
12215 _mesa_delete_bitmap_atlas(ctx, atlas);
12216 _mesa_HashRemove(ctx->Shared->BitmapAtlas, list);
12217 }
12218 }
12219
12220 for (i = list; i < list + range; i++) {
12221 destroy_list(ctx, i);
12222 }
12223 }
12224
12225
12226 /**
12227 * Return a display list number, n, such that lists n through n+range-1
12228 * are free.
12229 */
12230 GLuint GLAPIENTRY
12231 _mesa_GenLists(GLsizei range)
12232 {
12233 GET_CURRENT_CONTEXT(ctx);
12234 GLuint base;
12235 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
12236 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
12237
12238 if (range < 0) {
12239 _mesa_error(ctx, GL_INVALID_VALUE, "glGenLists");
12240 return 0;
12241 }
12242 if (range == 0) {
12243 return 0;
12244 }
12245
12246 /*
12247 * Make this an atomic operation
12248 */
12249 _mesa_HashLockMutex(ctx->Shared->DisplayList);
12250
12251 base = _mesa_HashFindFreeKeyBlock(ctx->Shared->DisplayList, range);
12252 if (base) {
12253 /* reserve the list IDs by with empty/dummy lists */
12254 GLint i;
12255 for (i = 0; i < range; i++) {
12256 _mesa_HashInsertLocked(ctx->Shared->DisplayList, base + i,
12257 make_list(base + i, 1));
12258 }
12259 }
12260
12261 if (USE_BITMAP_ATLAS &&
12262 range > 16 &&
12263 ctx->Driver.DrawAtlasBitmaps) {
12264 /* "range > 16" is a rough heuristic to guess when glGenLists might be
12265 * used to allocate display lists for glXUseXFont or wglUseFontBitmaps.
12266 * Create the empty atlas now.
12267 */
12268 struct gl_bitmap_atlas *atlas = lookup_bitmap_atlas(ctx, base);
12269 if (!atlas) {
12270 atlas = alloc_bitmap_atlas(ctx, base);
12271 }
12272 if (atlas) {
12273 /* Atlas _should_ be new/empty now, but clobbering is OK */
12274 assert(atlas->numBitmaps == 0);
12275 atlas->numBitmaps = range;
12276 }
12277 }
12278
12279 _mesa_HashUnlockMutex(ctx->Shared->DisplayList);
12280
12281 return base;
12282 }
12283
12284
12285 /**
12286 * Begin a new display list.
12287 */
12288 void GLAPIENTRY
12289 _mesa_NewList(GLuint name, GLenum mode)
12290 {
12291 GET_CURRENT_CONTEXT(ctx);
12292
12293 FLUSH_CURRENT(ctx, 0); /* must be called before assert */
12294 ASSERT_OUTSIDE_BEGIN_END(ctx);
12295
12296 if (MESA_VERBOSE & VERBOSE_API)
12297 _mesa_debug(ctx, "glNewList %u %s\n", name,
12298 _mesa_enum_to_string(mode));
12299
12300 if (name == 0) {
12301 _mesa_error(ctx, GL_INVALID_VALUE, "glNewList");
12302 return;
12303 }
12304
12305 if (mode != GL_COMPILE && mode != GL_COMPILE_AND_EXECUTE) {
12306 _mesa_error(ctx, GL_INVALID_ENUM, "glNewList");
12307 return;
12308 }
12309
12310 if (ctx->ListState.CurrentList) {
12311 /* already compiling a display list */
12312 _mesa_error(ctx, GL_INVALID_OPERATION, "glNewList");
12313 return;
12314 }
12315
12316 ctx->CompileFlag = GL_TRUE;
12317 ctx->ExecuteFlag = (mode == GL_COMPILE_AND_EXECUTE);
12318
12319 /* Reset accumulated list state */
12320 invalidate_saved_current_state( ctx );
12321
12322 /* Allocate new display list */
12323 ctx->ListState.CurrentList = make_list(name, BLOCK_SIZE);
12324 ctx->ListState.CurrentBlock = ctx->ListState.CurrentList->Head;
12325 ctx->ListState.CurrentPos = 0;
12326
12327 vbo_save_NewList(ctx, name, mode);
12328
12329 ctx->CurrentServerDispatch = ctx->Save;
12330 _glapi_set_dispatch(ctx->CurrentServerDispatch);
12331 if (ctx->MarshalExec == NULL) {
12332 ctx->CurrentClientDispatch = ctx->CurrentServerDispatch;
12333 }
12334 }
12335
12336
12337 /**
12338 * End definition of current display list.
12339 */
12340 void GLAPIENTRY
12341 _mesa_EndList(void)
12342 {
12343 GET_CURRENT_CONTEXT(ctx);
12344 SAVE_FLUSH_VERTICES(ctx);
12345 FLUSH_VERTICES(ctx, 0);
12346
12347 if (MESA_VERBOSE & VERBOSE_API)
12348 _mesa_debug(ctx, "glEndList\n");
12349
12350 if (ctx->ExecuteFlag && _mesa_inside_dlist_begin_end(ctx)) {
12351 _mesa_error(ctx, GL_INVALID_OPERATION,
12352 "glEndList() called inside glBegin/End");
12353 }
12354
12355 /* Check that a list is under construction */
12356 if (!ctx->ListState.CurrentList) {
12357 _mesa_error(ctx, GL_INVALID_OPERATION, "glEndList");
12358 return;
12359 }
12360
12361 /* Call before emitting END_OF_LIST, in case the driver wants to
12362 * emit opcodes itself.
12363 */
12364 vbo_save_EndList(ctx);
12365
12366 (void) alloc_instruction(ctx, OPCODE_END_OF_LIST, 0);
12367
12368 trim_list(ctx);
12369
12370 /* Destroy old list, if any */
12371 destroy_list(ctx, ctx->ListState.CurrentList->Name);
12372
12373 /* Install the new list */
12374 _mesa_HashInsert(ctx->Shared->DisplayList,
12375 ctx->ListState.CurrentList->Name,
12376 ctx->ListState.CurrentList);
12377
12378
12379 if (MESA_VERBOSE & VERBOSE_DISPLAY_LIST)
12380 mesa_print_display_list(ctx->ListState.CurrentList->Name);
12381
12382 ctx->ListState.CurrentList = NULL;
12383 ctx->ListState.CurrentBlock = NULL;
12384 ctx->ListState.CurrentPos = 0;
12385 ctx->ExecuteFlag = GL_TRUE;
12386 ctx->CompileFlag = GL_FALSE;
12387
12388 ctx->CurrentServerDispatch = ctx->Exec;
12389 _glapi_set_dispatch(ctx->CurrentServerDispatch);
12390 if (ctx->MarshalExec == NULL) {
12391 ctx->CurrentClientDispatch = ctx->CurrentServerDispatch;
12392 }
12393 }
12394
12395
12396 void GLAPIENTRY
12397 _mesa_CallList(GLuint list)
12398 {
12399 GLboolean save_compile_flag;
12400 GET_CURRENT_CONTEXT(ctx);
12401 FLUSH_CURRENT(ctx, 0);
12402
12403 if (MESA_VERBOSE & VERBOSE_API)
12404 _mesa_debug(ctx, "glCallList %d\n", list);
12405
12406 if (list == 0) {
12407 _mesa_error(ctx, GL_INVALID_VALUE, "glCallList(list==0)");
12408 return;
12409 }
12410
12411 if (0)
12412 mesa_print_display_list( list );
12413
12414 /* VERY IMPORTANT: Save the CompileFlag status, turn it off,
12415 * execute the display list, and restore the CompileFlag.
12416 */
12417 save_compile_flag = ctx->CompileFlag;
12418 if (save_compile_flag) {
12419 ctx->CompileFlag = GL_FALSE;
12420 }
12421
12422 execute_list(ctx, list);
12423 ctx->CompileFlag = save_compile_flag;
12424
12425 /* also restore API function pointers to point to "save" versions */
12426 if (save_compile_flag) {
12427 ctx->CurrentServerDispatch = ctx->Save;
12428 _glapi_set_dispatch(ctx->CurrentServerDispatch);
12429 if (ctx->MarshalExec == NULL) {
12430 ctx->CurrentClientDispatch = ctx->CurrentServerDispatch;
12431 }
12432 }
12433 }
12434
12435
12436 /**
12437 * Try to execute a glCallLists() command where the display lists contain
12438 * glBitmap commands with a texture atlas.
12439 * \return true for success, false otherwise
12440 */
12441 static bool
12442 render_bitmap_atlas(struct gl_context *ctx, GLsizei n, GLenum type,
12443 const void *lists)
12444 {
12445 struct gl_bitmap_atlas *atlas;
12446 int i;
12447
12448 if (!USE_BITMAP_ATLAS ||
12449 !ctx->Current.RasterPosValid ||
12450 ctx->List.ListBase == 0 ||
12451 type != GL_UNSIGNED_BYTE ||
12452 !ctx->Driver.DrawAtlasBitmaps) {
12453 /* unsupported */
12454 return false;
12455 }
12456
12457 atlas = lookup_bitmap_atlas(ctx, ctx->List.ListBase);
12458
12459 if (!atlas) {
12460 /* Even if glGenLists wasn't called, we can still try to create
12461 * the atlas now.
12462 */
12463 atlas = alloc_bitmap_atlas(ctx, ctx->List.ListBase);
12464 }
12465
12466 if (atlas && !atlas->complete && !atlas->incomplete) {
12467 /* Try to build the bitmap atlas now.
12468 * If the atlas was created in glGenLists, we'll have recorded the
12469 * number of lists (bitmaps). Otherwise, take a guess at 256.
12470 */
12471 if (atlas->numBitmaps == 0)
12472 atlas->numBitmaps = 256;
12473 build_bitmap_atlas(ctx, atlas, ctx->List.ListBase);
12474 }
12475
12476 if (!atlas || !atlas->complete) {
12477 return false;
12478 }
12479
12480 /* check that all display list IDs are in the atlas */
12481 for (i = 0; i < n; i++) {
12482 const GLubyte *ids = (const GLubyte *) lists;
12483
12484 if (ids[i] >= atlas->numBitmaps) {
12485 return false;
12486 }
12487 }
12488
12489 ctx->Driver.DrawAtlasBitmaps(ctx, atlas, n, (const GLubyte *) lists);
12490
12491 return true;
12492 }
12493
12494
12495 /**
12496 * Execute glCallLists: call multiple display lists.
12497 */
12498 void GLAPIENTRY
12499 _mesa_CallLists(GLsizei n, GLenum type, const GLvoid * lists)
12500 {
12501 GET_CURRENT_CONTEXT(ctx);
12502 GLint i;
12503 GLboolean save_compile_flag;
12504
12505 if (MESA_VERBOSE & VERBOSE_API)
12506 _mesa_debug(ctx, "glCallLists %d\n", n);
12507
12508 switch (type) {
12509 case GL_BYTE:
12510 case GL_UNSIGNED_BYTE:
12511 case GL_SHORT:
12512 case GL_UNSIGNED_SHORT:
12513 case GL_INT:
12514 case GL_UNSIGNED_INT:
12515 case GL_FLOAT:
12516 case GL_2_BYTES:
12517 case GL_3_BYTES:
12518 case GL_4_BYTES:
12519 /* OK */
12520 break;
12521 default:
12522 _mesa_error(ctx, GL_INVALID_ENUM, "glCallLists(type)");
12523 return;
12524 }
12525
12526 if (n < 0) {
12527 _mesa_error(ctx, GL_INVALID_VALUE, "glCallLists(n < 0)");
12528 return;
12529 } else if (n == 0 || lists == NULL) {
12530 /* nothing to do */
12531 return;
12532 }
12533
12534 if (render_bitmap_atlas(ctx, n, type, lists)) {
12535 return;
12536 }
12537
12538 /* Save the CompileFlag status, turn it off, execute display list,
12539 * and restore the CompileFlag.
12540 */
12541 save_compile_flag = ctx->CompileFlag;
12542 ctx->CompileFlag = GL_FALSE;
12543
12544 for (i = 0; i < n; i++) {
12545 GLuint list = (GLuint) (ctx->List.ListBase + translate_id(i, type, lists));
12546 execute_list(ctx, list);
12547 }
12548
12549 ctx->CompileFlag = save_compile_flag;
12550
12551 /* also restore API function pointers to point to "save" versions */
12552 if (save_compile_flag) {
12553 ctx->CurrentServerDispatch = ctx->Save;
12554 _glapi_set_dispatch(ctx->CurrentServerDispatch);
12555 if (ctx->MarshalExec == NULL) {
12556 ctx->CurrentClientDispatch = ctx->CurrentServerDispatch;
12557 }
12558 }
12559 }
12560
12561
12562 /**
12563 * Set the offset added to list numbers in glCallLists.
12564 */
12565 void GLAPIENTRY
12566 _mesa_ListBase(GLuint base)
12567 {
12568 GET_CURRENT_CONTEXT(ctx);
12569 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
12570 ASSERT_OUTSIDE_BEGIN_END(ctx);
12571 ctx->List.ListBase = base;
12572 }
12573
12574 /**
12575 * Setup the given dispatch table to point to Mesa's display list
12576 * building functions.
12577 *
12578 * This does not include any of the tnl functions - they are
12579 * initialized from _mesa_init_api_defaults and from the active vtxfmt
12580 * struct.
12581 */
12582 void
12583 _mesa_initialize_save_table(const struct gl_context *ctx)
12584 {
12585 struct _glapi_table *table = ctx->Save;
12586 int numEntries = MAX2(_gloffset_COUNT, _glapi_get_dispatch_table_size());
12587
12588 /* Initially populate the dispatch table with the contents of the
12589 * normal-execution dispatch table. This lets us skip populating functions
12590 * that should be called directly instead of compiled into display lists.
12591 */
12592 memcpy(table, ctx->Exec, numEntries * sizeof(_glapi_proc));
12593
12594 _mesa_loopback_init_api_table(ctx, table);
12595
12596 /* VBO functions */
12597 vbo_initialize_save_dispatch(ctx, table);
12598
12599 /* GL 1.0 */
12600 SET_Accum(table, save_Accum);
12601 SET_AlphaFunc(table, save_AlphaFunc);
12602 SET_Bitmap(table, save_Bitmap);
12603 SET_BlendFunc(table, save_BlendFunc);
12604 SET_CallList(table, save_CallList);
12605 SET_CallLists(table, save_CallLists);
12606 SET_Clear(table, save_Clear);
12607 SET_ClearAccum(table, save_ClearAccum);
12608 SET_ClearColor(table, save_ClearColor);
12609 SET_ClearDepth(table, save_ClearDepth);
12610 SET_ClearIndex(table, save_ClearIndex);
12611 SET_ClearStencil(table, save_ClearStencil);
12612 SET_ClipPlane(table, save_ClipPlane);
12613 SET_ColorMask(table, save_ColorMask);
12614 SET_ColorMaski(table, save_ColorMaskIndexed);
12615 SET_ColorMaterial(table, save_ColorMaterial);
12616 SET_CopyPixels(table, save_CopyPixels);
12617 SET_CullFace(table, save_CullFace);
12618 SET_DepthFunc(table, save_DepthFunc);
12619 SET_DepthMask(table, save_DepthMask);
12620 SET_DepthRange(table, save_DepthRange);
12621 SET_Disable(table, save_Disable);
12622 SET_Disablei(table, save_DisableIndexed);
12623 SET_DrawBuffer(table, save_DrawBuffer);
12624 SET_DrawPixels(table, save_DrawPixels);
12625 SET_Enable(table, save_Enable);
12626 SET_Enablei(table, save_EnableIndexed);
12627 SET_EvalMesh1(table, save_EvalMesh1);
12628 SET_EvalMesh2(table, save_EvalMesh2);
12629 SET_Fogf(table, save_Fogf);
12630 SET_Fogfv(table, save_Fogfv);
12631 SET_Fogi(table, save_Fogi);
12632 SET_Fogiv(table, save_Fogiv);
12633 SET_FrontFace(table, save_FrontFace);
12634 SET_Frustum(table, save_Frustum);
12635 SET_Hint(table, save_Hint);
12636 SET_IndexMask(table, save_IndexMask);
12637 SET_InitNames(table, save_InitNames);
12638 SET_LightModelf(table, save_LightModelf);
12639 SET_LightModelfv(table, save_LightModelfv);
12640 SET_LightModeli(table, save_LightModeli);
12641 SET_LightModeliv(table, save_LightModeliv);
12642 SET_Lightf(table, save_Lightf);
12643 SET_Lightfv(table, save_Lightfv);
12644 SET_Lighti(table, save_Lighti);
12645 SET_Lightiv(table, save_Lightiv);
12646 SET_LineStipple(table, save_LineStipple);
12647 SET_LineWidth(table, save_LineWidth);
12648 SET_ListBase(table, save_ListBase);
12649 SET_LoadIdentity(table, save_LoadIdentity);
12650 SET_LoadMatrixd(table, save_LoadMatrixd);
12651 SET_LoadMatrixf(table, save_LoadMatrixf);
12652 SET_LoadName(table, save_LoadName);
12653 SET_LogicOp(table, save_LogicOp);
12654 SET_Map1d(table, save_Map1d);
12655 SET_Map1f(table, save_Map1f);
12656 SET_Map2d(table, save_Map2d);
12657 SET_Map2f(table, save_Map2f);
12658 SET_MapGrid1d(table, save_MapGrid1d);
12659 SET_MapGrid1f(table, save_MapGrid1f);
12660 SET_MapGrid2d(table, save_MapGrid2d);
12661 SET_MapGrid2f(table, save_MapGrid2f);
12662 SET_MatrixMode(table, save_MatrixMode);
12663 SET_MultMatrixd(table, save_MultMatrixd);
12664 SET_MultMatrixf(table, save_MultMatrixf);
12665 SET_NewList(table, save_NewList);
12666 SET_Ortho(table, save_Ortho);
12667 SET_PassThrough(table, save_PassThrough);
12668 SET_PixelMapfv(table, save_PixelMapfv);
12669 SET_PixelMapuiv(table, save_PixelMapuiv);
12670 SET_PixelMapusv(table, save_PixelMapusv);
12671 SET_PixelTransferf(table, save_PixelTransferf);
12672 SET_PixelTransferi(table, save_PixelTransferi);
12673 SET_PixelZoom(table, save_PixelZoom);
12674 SET_PointSize(table, save_PointSize);
12675 SET_PolygonMode(table, save_PolygonMode);
12676 SET_PolygonOffset(table, save_PolygonOffset);
12677 SET_PolygonStipple(table, save_PolygonStipple);
12678 SET_PopAttrib(table, save_PopAttrib);
12679 SET_PopMatrix(table, save_PopMatrix);
12680 SET_PopName(table, save_PopName);
12681 SET_PushAttrib(table, save_PushAttrib);
12682 SET_PushMatrix(table, save_PushMatrix);
12683 SET_PushName(table, save_PushName);
12684 SET_RasterPos2d(table, save_RasterPos2d);
12685 SET_RasterPos2dv(table, save_RasterPos2dv);
12686 SET_RasterPos2f(table, save_RasterPos2f);
12687 SET_RasterPos2fv(table, save_RasterPos2fv);
12688 SET_RasterPos2i(table, save_RasterPos2i);
12689 SET_RasterPos2iv(table, save_RasterPos2iv);
12690 SET_RasterPos2s(table, save_RasterPos2s);
12691 SET_RasterPos2sv(table, save_RasterPos2sv);
12692 SET_RasterPos3d(table, save_RasterPos3d);
12693 SET_RasterPos3dv(table, save_RasterPos3dv);
12694 SET_RasterPos3f(table, save_RasterPos3f);
12695 SET_RasterPos3fv(table, save_RasterPos3fv);
12696 SET_RasterPos3i(table, save_RasterPos3i);
12697 SET_RasterPos3iv(table, save_RasterPos3iv);
12698 SET_RasterPos3s(table, save_RasterPos3s);
12699 SET_RasterPos3sv(table, save_RasterPos3sv);
12700 SET_RasterPos4d(table, save_RasterPos4d);
12701 SET_RasterPos4dv(table, save_RasterPos4dv);
12702 SET_RasterPos4f(table, save_RasterPos4f);
12703 SET_RasterPos4fv(table, save_RasterPos4fv);
12704 SET_RasterPos4i(table, save_RasterPos4i);
12705 SET_RasterPos4iv(table, save_RasterPos4iv);
12706 SET_RasterPos4s(table, save_RasterPos4s);
12707 SET_RasterPos4sv(table, save_RasterPos4sv);
12708 SET_ReadBuffer(table, save_ReadBuffer);
12709 SET_Rectf(table, save_Rectf);
12710 SET_Rotated(table, save_Rotated);
12711 SET_Rotatef(table, save_Rotatef);
12712 SET_Scaled(table, save_Scaled);
12713 SET_Scalef(table, save_Scalef);
12714 SET_Scissor(table, save_Scissor);
12715 SET_ShadeModel(table, save_ShadeModel);
12716 SET_StencilFunc(table, save_StencilFunc);
12717 SET_StencilMask(table, save_StencilMask);
12718 SET_StencilOp(table, save_StencilOp);
12719 SET_TexEnvf(table, save_TexEnvf);
12720 SET_TexEnvfv(table, save_TexEnvfv);
12721 SET_TexEnvi(table, save_TexEnvi);
12722 SET_TexEnviv(table, save_TexEnviv);
12723 SET_TexGend(table, save_TexGend);
12724 SET_TexGendv(table, save_TexGendv);
12725 SET_TexGenf(table, save_TexGenf);
12726 SET_TexGenfv(table, save_TexGenfv);
12727 SET_TexGeni(table, save_TexGeni);
12728 SET_TexGeniv(table, save_TexGeniv);
12729 SET_TexImage1D(table, save_TexImage1D);
12730 SET_TexImage2D(table, save_TexImage2D);
12731 SET_TexParameterf(table, save_TexParameterf);
12732 SET_TexParameterfv(table, save_TexParameterfv);
12733 SET_TexParameteri(table, save_TexParameteri);
12734 SET_TexParameteriv(table, save_TexParameteriv);
12735 SET_Translated(table, save_Translated);
12736 SET_Translatef(table, save_Translatef);
12737 SET_Viewport(table, save_Viewport);
12738
12739 /* GL 1.1 */
12740 SET_BindTexture(table, save_BindTexture);
12741 SET_CopyTexImage1D(table, save_CopyTexImage1D);
12742 SET_CopyTexImage2D(table, save_CopyTexImage2D);
12743 SET_CopyTexSubImage1D(table, save_CopyTexSubImage1D);
12744 SET_CopyTexSubImage2D(table, save_CopyTexSubImage2D);
12745 SET_PrioritizeTextures(table, save_PrioritizeTextures);
12746 SET_TexSubImage1D(table, save_TexSubImage1D);
12747 SET_TexSubImage2D(table, save_TexSubImage2D);
12748
12749 /* GL 1.2 */
12750 SET_CopyTexSubImage3D(table, save_CopyTexSubImage3D);
12751 SET_TexImage3D(table, save_TexImage3D);
12752 SET_TexSubImage3D(table, save_TexSubImage3D);
12753
12754 /* GL 2.0 */
12755 SET_StencilFuncSeparate(table, save_StencilFuncSeparate);
12756 SET_StencilMaskSeparate(table, save_StencilMaskSeparate);
12757 SET_StencilOpSeparate(table, save_StencilOpSeparate);
12758
12759 /* ATI_separate_stencil */
12760 SET_StencilFuncSeparateATI(table, save_StencilFuncSeparateATI);
12761
12762 /* GL_ARB_imaging */
12763 /* Not all are supported */
12764 SET_BlendColor(table, save_BlendColor);
12765 SET_BlendEquation(table, save_BlendEquation);
12766
12767 /* 2. GL_EXT_blend_color */
12768 #if 0
12769 SET_BlendColorEXT(table, save_BlendColorEXT);
12770 #endif
12771
12772 /* 6. GL_EXT_texture3d */
12773 #if 0
12774 SET_CopyTexSubImage3DEXT(table, save_CopyTexSubImage3D);
12775 SET_TexImage3DEXT(table, save_TexImage3DEXT);
12776 SET_TexSubImage3DEXT(table, save_TexSubImage3D);
12777 #endif
12778
12779 /* 37. GL_EXT_blend_minmax */
12780 #if 0
12781 SET_BlendEquationEXT(table, save_BlendEquationEXT);
12782 #endif
12783
12784 /* 54. GL_EXT_point_parameters */
12785 SET_PointParameterf(table, save_PointParameterfEXT);
12786 SET_PointParameterfv(table, save_PointParameterfvEXT);
12787
12788 /* 91. GL_ARB_tessellation_shader */
12789 SET_PatchParameteri(table, save_PatchParameteri);
12790 SET_PatchParameterfv(table, save_PatchParameterfv);
12791
12792 /* 100. ARB_viewport_array */
12793 SET_ViewportArrayv(table, save_ViewportArrayv);
12794 SET_ViewportIndexedf(table, save_ViewportIndexedf);
12795 SET_ViewportIndexedfv(table, save_ViewportIndexedfv);
12796 SET_ScissorArrayv(table, save_ScissorArrayv);
12797 SET_ScissorIndexed(table, save_ScissorIndexed);
12798 SET_ScissorIndexedv(table, save_ScissorIndexedv);
12799 SET_DepthRangeArrayv(table, save_DepthRangeArrayv);
12800 SET_DepthRangeIndexed(table, save_DepthRangeIndexed);
12801
12802 /* 122. ARB_compute_shader */
12803 SET_DispatchCompute(table, save_DispatchCompute);
12804 SET_DispatchComputeIndirect(table, save_DispatchComputeIndirect);
12805
12806 /* 173. GL_EXT_blend_func_separate */
12807 SET_BlendFuncSeparate(table, save_BlendFuncSeparateEXT);
12808
12809 /* 197. GL_MESA_window_pos */
12810 SET_WindowPos2d(table, save_WindowPos2dMESA);
12811 SET_WindowPos2dv(table, save_WindowPos2dvMESA);
12812 SET_WindowPos2f(table, save_WindowPos2fMESA);
12813 SET_WindowPos2fv(table, save_WindowPos2fvMESA);
12814 SET_WindowPos2i(table, save_WindowPos2iMESA);
12815 SET_WindowPos2iv(table, save_WindowPos2ivMESA);
12816 SET_WindowPos2s(table, save_WindowPos2sMESA);
12817 SET_WindowPos2sv(table, save_WindowPos2svMESA);
12818 SET_WindowPos3d(table, save_WindowPos3dMESA);
12819 SET_WindowPos3dv(table, save_WindowPos3dvMESA);
12820 SET_WindowPos3f(table, save_WindowPos3fMESA);
12821 SET_WindowPos3fv(table, save_WindowPos3fvMESA);
12822 SET_WindowPos3i(table, save_WindowPos3iMESA);
12823 SET_WindowPos3iv(table, save_WindowPos3ivMESA);
12824 SET_WindowPos3s(table, save_WindowPos3sMESA);
12825 SET_WindowPos3sv(table, save_WindowPos3svMESA);
12826 SET_WindowPos4dMESA(table, save_WindowPos4dMESA);
12827 SET_WindowPos4dvMESA(table, save_WindowPos4dvMESA);
12828 SET_WindowPos4fMESA(table, save_WindowPos4fMESA);
12829 SET_WindowPos4fvMESA(table, save_WindowPos4fvMESA);
12830 SET_WindowPos4iMESA(table, save_WindowPos4iMESA);
12831 SET_WindowPos4ivMESA(table, save_WindowPos4ivMESA);
12832 SET_WindowPos4sMESA(table, save_WindowPos4sMESA);
12833 SET_WindowPos4svMESA(table, save_WindowPos4svMESA);
12834
12835 /* 245. GL_ATI_fragment_shader */
12836 SET_BindFragmentShaderATI(table, save_BindFragmentShaderATI);
12837 SET_SetFragmentShaderConstantATI(table, save_SetFragmentShaderConstantATI);
12838
12839 /* 262. GL_NV_point_sprite */
12840 SET_PointParameteri(table, save_PointParameteriNV);
12841 SET_PointParameteriv(table, save_PointParameterivNV);
12842
12843 /* 268. GL_EXT_stencil_two_side */
12844 SET_ActiveStencilFaceEXT(table, save_ActiveStencilFaceEXT);
12845
12846 /* ???. GL_EXT_depth_bounds_test */
12847 SET_DepthBoundsEXT(table, save_DepthBoundsEXT);
12848
12849 /* ARB 1. GL_ARB_multitexture */
12850 SET_ActiveTexture(table, save_ActiveTextureARB);
12851
12852 /* ARB 3. GL_ARB_transpose_matrix */
12853 SET_LoadTransposeMatrixd(table, save_LoadTransposeMatrixdARB);
12854 SET_LoadTransposeMatrixf(table, save_LoadTransposeMatrixfARB);
12855 SET_MultTransposeMatrixd(table, save_MultTransposeMatrixdARB);
12856 SET_MultTransposeMatrixf(table, save_MultTransposeMatrixfARB);
12857
12858 /* ARB 5. GL_ARB_multisample */
12859 SET_SampleCoverage(table, save_SampleCoverageARB);
12860
12861 /* ARB 12. GL_ARB_texture_compression */
12862 SET_CompressedTexImage3D(table, save_CompressedTexImage3DARB);
12863 SET_CompressedTexImage2D(table, save_CompressedTexImage2DARB);
12864 SET_CompressedTexImage1D(table, save_CompressedTexImage1DARB);
12865 SET_CompressedTexSubImage3D(table, save_CompressedTexSubImage3DARB);
12866 SET_CompressedTexSubImage2D(table, save_CompressedTexSubImage2DARB);
12867 SET_CompressedTexSubImage1D(table, save_CompressedTexSubImage1DARB);
12868
12869 /* ARB 14. GL_ARB_point_parameters */
12870 /* aliased with EXT_point_parameters functions */
12871
12872 /* ARB 25. GL_ARB_window_pos */
12873 /* aliased with MESA_window_pos functions */
12874
12875 /* ARB 26. GL_ARB_vertex_program */
12876 /* ARB 27. GL_ARB_fragment_program */
12877 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
12878 SET_ProgramStringARB(table, save_ProgramStringARB);
12879 SET_BindProgramARB(table, save_BindProgramARB);
12880 SET_ProgramEnvParameter4dARB(table, save_ProgramEnvParameter4dARB);
12881 SET_ProgramEnvParameter4dvARB(table, save_ProgramEnvParameter4dvARB);
12882 SET_ProgramEnvParameter4fARB(table, save_ProgramEnvParameter4fARB);
12883 SET_ProgramEnvParameter4fvARB(table, save_ProgramEnvParameter4fvARB);
12884 SET_ProgramLocalParameter4dARB(table, save_ProgramLocalParameter4dARB);
12885 SET_ProgramLocalParameter4dvARB(table, save_ProgramLocalParameter4dvARB);
12886 SET_ProgramLocalParameter4fARB(table, save_ProgramLocalParameter4fARB);
12887 SET_ProgramLocalParameter4fvARB(table, save_ProgramLocalParameter4fvARB);
12888
12889 SET_BeginQuery(table, save_BeginQueryARB);
12890 SET_EndQuery(table, save_EndQueryARB);
12891 SET_QueryCounter(table, save_QueryCounter);
12892
12893 SET_DrawBuffers(table, save_DrawBuffersARB);
12894
12895 SET_BlitFramebuffer(table, save_BlitFramebufferEXT);
12896
12897 SET_UseProgram(table, save_UseProgram);
12898 SET_Uniform1f(table, save_Uniform1fARB);
12899 SET_Uniform2f(table, save_Uniform2fARB);
12900 SET_Uniform3f(table, save_Uniform3fARB);
12901 SET_Uniform4f(table, save_Uniform4fARB);
12902 SET_Uniform1fv(table, save_Uniform1fvARB);
12903 SET_Uniform2fv(table, save_Uniform2fvARB);
12904 SET_Uniform3fv(table, save_Uniform3fvARB);
12905 SET_Uniform4fv(table, save_Uniform4fvARB);
12906 SET_Uniform1i(table, save_Uniform1iARB);
12907 SET_Uniform2i(table, save_Uniform2iARB);
12908 SET_Uniform3i(table, save_Uniform3iARB);
12909 SET_Uniform4i(table, save_Uniform4iARB);
12910 SET_Uniform1iv(table, save_Uniform1ivARB);
12911 SET_Uniform2iv(table, save_Uniform2ivARB);
12912 SET_Uniform3iv(table, save_Uniform3ivARB);
12913 SET_Uniform4iv(table, save_Uniform4ivARB);
12914 SET_UniformMatrix2fv(table, save_UniformMatrix2fvARB);
12915 SET_UniformMatrix3fv(table, save_UniformMatrix3fvARB);
12916 SET_UniformMatrix4fv(table, save_UniformMatrix4fvARB);
12917 SET_UniformMatrix2x3fv(table, save_UniformMatrix2x3fv);
12918 SET_UniformMatrix3x2fv(table, save_UniformMatrix3x2fv);
12919 SET_UniformMatrix2x4fv(table, save_UniformMatrix2x4fv);
12920 SET_UniformMatrix4x2fv(table, save_UniformMatrix4x2fv);
12921 SET_UniformMatrix3x4fv(table, save_UniformMatrix3x4fv);
12922 SET_UniformMatrix4x3fv(table, save_UniformMatrix4x3fv);
12923
12924 /* 299. GL_EXT_blend_equation_separate */
12925 SET_BlendEquationSeparate(table, save_BlendEquationSeparateEXT);
12926
12927 /* GL_EXT_gpu_program_parameters */
12928 SET_ProgramEnvParameters4fvEXT(table, save_ProgramEnvParameters4fvEXT);
12929 SET_ProgramLocalParameters4fvEXT(table, save_ProgramLocalParameters4fvEXT);
12930
12931 /* 364. GL_EXT_provoking_vertex */
12932 SET_ProvokingVertex(table, save_ProvokingVertexEXT);
12933
12934 /* GL_EXT_texture_integer */
12935 SET_ClearColorIiEXT(table, save_ClearColorIi);
12936 SET_ClearColorIuiEXT(table, save_ClearColorIui);
12937 SET_TexParameterIiv(table, save_TexParameterIiv);
12938 SET_TexParameterIuiv(table, save_TexParameterIuiv);
12939
12940 /* GL_ARB_clip_control */
12941 SET_ClipControl(table, save_ClipControl);
12942
12943 /* GL_ARB_color_buffer_float */
12944 SET_ClampColor(table, save_ClampColorARB);
12945
12946 /* GL 3.0 */
12947 SET_ClearBufferiv(table, save_ClearBufferiv);
12948 SET_ClearBufferuiv(table, save_ClearBufferuiv);
12949 SET_ClearBufferfv(table, save_ClearBufferfv);
12950 SET_ClearBufferfi(table, save_ClearBufferfi);
12951 SET_Uniform1ui(table, save_Uniform1ui);
12952 SET_Uniform2ui(table, save_Uniform2ui);
12953 SET_Uniform3ui(table, save_Uniform3ui);
12954 SET_Uniform4ui(table, save_Uniform4ui);
12955 SET_Uniform1uiv(table, save_Uniform1uiv);
12956 SET_Uniform2uiv(table, save_Uniform2uiv);
12957 SET_Uniform3uiv(table, save_Uniform3uiv);
12958 SET_Uniform4uiv(table, save_Uniform4uiv);
12959
12960 /* GL_ARB_gpu_shader_fp64 */
12961 SET_Uniform1d(table, save_Uniform1d);
12962 SET_Uniform2d(table, save_Uniform2d);
12963 SET_Uniform3d(table, save_Uniform3d);
12964 SET_Uniform4d(table, save_Uniform4d);
12965 SET_Uniform1dv(table, save_Uniform1dv);
12966 SET_Uniform2dv(table, save_Uniform2dv);
12967 SET_Uniform3dv(table, save_Uniform3dv);
12968 SET_Uniform4dv(table, save_Uniform4dv);
12969 SET_UniformMatrix2dv(table, save_UniformMatrix2dv);
12970 SET_UniformMatrix3dv(table, save_UniformMatrix3dv);
12971 SET_UniformMatrix4dv(table, save_UniformMatrix4dv);
12972 SET_UniformMatrix2x3dv(table, save_UniformMatrix2x3dv);
12973 SET_UniformMatrix3x2dv(table, save_UniformMatrix3x2dv);
12974 SET_UniformMatrix2x4dv(table, save_UniformMatrix2x4dv);
12975 SET_UniformMatrix4x2dv(table, save_UniformMatrix4x2dv);
12976 SET_UniformMatrix3x4dv(table, save_UniformMatrix3x4dv);
12977 SET_UniformMatrix4x3dv(table, save_UniformMatrix4x3dv);
12978
12979 /* These are: */
12980 SET_BeginTransformFeedback(table, save_BeginTransformFeedback);
12981 SET_EndTransformFeedback(table, save_EndTransformFeedback);
12982 SET_BindTransformFeedback(table, save_BindTransformFeedback);
12983 SET_PauseTransformFeedback(table, save_PauseTransformFeedback);
12984 SET_ResumeTransformFeedback(table, save_ResumeTransformFeedback);
12985 SET_DrawTransformFeedback(table, save_DrawTransformFeedback);
12986 SET_DrawTransformFeedbackStream(table, save_DrawTransformFeedbackStream);
12987 SET_DrawTransformFeedbackInstanced(table,
12988 save_DrawTransformFeedbackInstanced);
12989 SET_DrawTransformFeedbackStreamInstanced(table,
12990 save_DrawTransformFeedbackStreamInstanced);
12991 SET_BeginQueryIndexed(table, save_BeginQueryIndexed);
12992 SET_EndQueryIndexed(table, save_EndQueryIndexed);
12993
12994 /* GL_ARB_instanced_arrays */
12995 SET_VertexAttribDivisor(table, save_VertexAttribDivisor);
12996
12997 /* GL_NV_texture_barrier */
12998 SET_TextureBarrierNV(table, save_TextureBarrierNV);
12999
13000 SET_BindSampler(table, save_BindSampler);
13001 SET_SamplerParameteri(table, save_SamplerParameteri);
13002 SET_SamplerParameterf(table, save_SamplerParameterf);
13003 SET_SamplerParameteriv(table, save_SamplerParameteriv);
13004 SET_SamplerParameterfv(table, save_SamplerParameterfv);
13005 SET_SamplerParameterIiv(table, save_SamplerParameterIiv);
13006 SET_SamplerParameterIuiv(table, save_SamplerParameterIuiv);
13007
13008 /* GL_ARB_draw_buffer_blend */
13009 SET_BlendFunciARB(table, save_BlendFunci);
13010 SET_BlendFuncSeparateiARB(table, save_BlendFuncSeparatei);
13011 SET_BlendEquationiARB(table, save_BlendEquationi);
13012 SET_BlendEquationSeparateiARB(table, save_BlendEquationSeparatei);
13013
13014 /* GL_NV_conditional_render */
13015 SET_BeginConditionalRender(table, save_BeginConditionalRender);
13016 SET_EndConditionalRender(table, save_EndConditionalRender);
13017
13018 /* GL_ARB_sync */
13019 SET_WaitSync(table, save_WaitSync);
13020
13021 /* GL_ARB_uniform_buffer_object */
13022 SET_UniformBlockBinding(table, save_UniformBlockBinding);
13023
13024 /* GL_ARB_shader_subroutines */
13025 SET_UniformSubroutinesuiv(table, save_UniformSubroutinesuiv);
13026
13027 /* GL_ARB_draw_instanced */
13028 SET_DrawArraysInstancedARB(table, save_DrawArraysInstancedARB);
13029 SET_DrawElementsInstancedARB(table, save_DrawElementsInstancedARB);
13030
13031 /* GL_ARB_draw_elements_base_vertex */
13032 SET_DrawElementsInstancedBaseVertex(table, save_DrawElementsInstancedBaseVertexARB);
13033
13034 /* GL_ARB_base_instance */
13035 SET_DrawArraysInstancedBaseInstance(table, save_DrawArraysInstancedBaseInstance);
13036 SET_DrawElementsInstancedBaseInstance(table, save_DrawElementsInstancedBaseInstance);
13037 SET_DrawElementsInstancedBaseVertexBaseInstance(table, save_DrawElementsInstancedBaseVertexBaseInstance);
13038
13039 /* GL_ARB_draw_indirect / GL_ARB_multi_draw_indirect */
13040 SET_DrawArraysIndirect(table, save_DrawArraysIndirect);
13041 SET_DrawElementsIndirect(table, save_DrawElementsIndirect);
13042 SET_MultiDrawArraysIndirect(table, save_MultiDrawArraysIndirect);
13043 SET_MultiDrawElementsIndirect(table, save_MultiDrawElementsIndirect);
13044
13045 /* OpenGL 4.2 / GL_ARB_separate_shader_objects */
13046 SET_UseProgramStages(table, save_UseProgramStages);
13047 SET_ProgramUniform1f(table, save_ProgramUniform1f);
13048 SET_ProgramUniform2f(table, save_ProgramUniform2f);
13049 SET_ProgramUniform3f(table, save_ProgramUniform3f);
13050 SET_ProgramUniform4f(table, save_ProgramUniform4f);
13051 SET_ProgramUniform1fv(table, save_ProgramUniform1fv);
13052 SET_ProgramUniform2fv(table, save_ProgramUniform2fv);
13053 SET_ProgramUniform3fv(table, save_ProgramUniform3fv);
13054 SET_ProgramUniform4fv(table, save_ProgramUniform4fv);
13055 SET_ProgramUniform1d(table, save_ProgramUniform1d);
13056 SET_ProgramUniform2d(table, save_ProgramUniform2d);
13057 SET_ProgramUniform3d(table, save_ProgramUniform3d);
13058 SET_ProgramUniform4d(table, save_ProgramUniform4d);
13059 SET_ProgramUniform1dv(table, save_ProgramUniform1dv);
13060 SET_ProgramUniform2dv(table, save_ProgramUniform2dv);
13061 SET_ProgramUniform3dv(table, save_ProgramUniform3dv);
13062 SET_ProgramUniform4dv(table, save_ProgramUniform4dv);
13063 SET_ProgramUniform1i(table, save_ProgramUniform1i);
13064 SET_ProgramUniform2i(table, save_ProgramUniform2i);
13065 SET_ProgramUniform3i(table, save_ProgramUniform3i);
13066 SET_ProgramUniform4i(table, save_ProgramUniform4i);
13067 SET_ProgramUniform1iv(table, save_ProgramUniform1iv);
13068 SET_ProgramUniform2iv(table, save_ProgramUniform2iv);
13069 SET_ProgramUniform3iv(table, save_ProgramUniform3iv);
13070 SET_ProgramUniform4iv(table, save_ProgramUniform4iv);
13071 SET_ProgramUniform1ui(table, save_ProgramUniform1ui);
13072 SET_ProgramUniform2ui(table, save_ProgramUniform2ui);
13073 SET_ProgramUniform3ui(table, save_ProgramUniform3ui);
13074 SET_ProgramUniform4ui(table, save_ProgramUniform4ui);
13075 SET_ProgramUniform1uiv(table, save_ProgramUniform1uiv);
13076 SET_ProgramUniform2uiv(table, save_ProgramUniform2uiv);
13077 SET_ProgramUniform3uiv(table, save_ProgramUniform3uiv);
13078 SET_ProgramUniform4uiv(table, save_ProgramUniform4uiv);
13079 SET_ProgramUniformMatrix2fv(table, save_ProgramUniformMatrix2fv);
13080 SET_ProgramUniformMatrix3fv(table, save_ProgramUniformMatrix3fv);
13081 SET_ProgramUniformMatrix4fv(table, save_ProgramUniformMatrix4fv);
13082 SET_ProgramUniformMatrix2x3fv(table, save_ProgramUniformMatrix2x3fv);
13083 SET_ProgramUniformMatrix3x2fv(table, save_ProgramUniformMatrix3x2fv);
13084 SET_ProgramUniformMatrix2x4fv(table, save_ProgramUniformMatrix2x4fv);
13085 SET_ProgramUniformMatrix4x2fv(table, save_ProgramUniformMatrix4x2fv);
13086 SET_ProgramUniformMatrix3x4fv(table, save_ProgramUniformMatrix3x4fv);
13087 SET_ProgramUniformMatrix4x3fv(table, save_ProgramUniformMatrix4x3fv);
13088 SET_ProgramUniformMatrix2dv(table, save_ProgramUniformMatrix2dv);
13089 SET_ProgramUniformMatrix3dv(table, save_ProgramUniformMatrix3dv);
13090 SET_ProgramUniformMatrix4dv(table, save_ProgramUniformMatrix4dv);
13091 SET_ProgramUniformMatrix2x3dv(table, save_ProgramUniformMatrix2x3dv);
13092 SET_ProgramUniformMatrix3x2dv(table, save_ProgramUniformMatrix3x2dv);
13093 SET_ProgramUniformMatrix2x4dv(table, save_ProgramUniformMatrix2x4dv);
13094 SET_ProgramUniformMatrix4x2dv(table, save_ProgramUniformMatrix4x2dv);
13095 SET_ProgramUniformMatrix3x4dv(table, save_ProgramUniformMatrix3x4dv);
13096 SET_ProgramUniformMatrix4x3dv(table, save_ProgramUniformMatrix4x3dv);
13097
13098 /* GL_{ARB,EXT}_polygon_offset_clamp */
13099 SET_PolygonOffsetClampEXT(table, save_PolygonOffsetClampEXT);
13100
13101 /* GL_EXT_window_rectangles */
13102 SET_WindowRectanglesEXT(table, save_WindowRectanglesEXT);
13103
13104 /* GL_NV_conservative_raster */
13105 SET_SubpixelPrecisionBiasNV(table, save_SubpixelPrecisionBiasNV);
13106
13107 /* GL_NV_conservative_raster_dilate */
13108 SET_ConservativeRasterParameterfNV(table, save_ConservativeRasterParameterfNV);
13109
13110 /* GL_NV_conservative_raster_pre_snap_triangles */
13111 SET_ConservativeRasterParameteriNV(table, save_ConservativeRasterParameteriNV);
13112
13113 /* GL_EXT_direct_state_access */
13114 SET_MatrixLoadfEXT(table, save_MatrixLoadfEXT);
13115 SET_MatrixLoaddEXT(table, save_MatrixLoaddEXT);
13116 SET_MatrixMultfEXT(table, save_MatrixMultfEXT);
13117 SET_MatrixMultdEXT(table, save_MatrixMultdEXT);
13118 SET_MatrixRotatefEXT(table, save_MatrixRotatefEXT);
13119 SET_MatrixRotatedEXT(table, save_MatrixRotatedEXT);
13120 SET_MatrixScalefEXT(table, save_MatrixScalefEXT);
13121 SET_MatrixScaledEXT(table, save_MatrixScaledEXT);
13122 SET_MatrixTranslatefEXT(table, save_MatrixTranslatefEXT);
13123 SET_MatrixTranslatedEXT(table, save_MatrixTranslatedEXT);
13124 SET_MatrixLoadIdentityEXT(table, save_MatrixLoadIdentityEXT);
13125 SET_MatrixOrthoEXT(table, save_MatrixOrthoEXT);
13126 SET_MatrixFrustumEXT(table, save_MatrixFrustumEXT);
13127 SET_MatrixPushEXT(table, save_MatrixPushEXT);
13128 SET_MatrixPopEXT(table, save_MatrixPopEXT);
13129 SET_MatrixLoadTransposefEXT(table, save_MatrixLoadTransposefEXT);
13130 SET_MatrixLoadTransposedEXT(table, save_MatrixLoadTransposedEXT);
13131 SET_MatrixMultTransposefEXT(table, save_MatrixMultTransposefEXT);
13132 SET_MatrixMultTransposedEXT(table, save_MatrixMultTransposedEXT);
13133 SET_TextureParameteriEXT(table, save_TextureParameteriEXT);
13134 SET_TextureParameterivEXT(table, save_TextureParameterivEXT);
13135 SET_TextureParameterfEXT(table, save_TextureParameterfEXT);
13136 SET_TextureParameterfvEXT(table, save_TextureParameterfvEXT);
13137 SET_TextureImage1DEXT(table, save_TextureImage1DEXT);
13138 SET_TextureImage2DEXT(table, save_TextureImage2DEXT);
13139 SET_TextureImage3DEXT(table, save_TextureImage3DEXT);
13140 SET_TextureSubImage1DEXT(table, save_TextureSubImage1DEXT);
13141 SET_TextureSubImage2DEXT(table, save_TextureSubImage2DEXT);
13142 SET_TextureSubImage3DEXT(table, save_TextureSubImage3DEXT);
13143 SET_CopyTextureImage1DEXT(table, save_CopyTextureImage1DEXT);
13144 SET_CopyTextureImage2DEXT(table, save_CopyTextureImage2DEXT);
13145 SET_CopyTextureSubImage1DEXT(table, save_CopyTextureSubImage1DEXT);
13146 SET_CopyTextureSubImage2DEXT(table, save_CopyTextureSubImage2DEXT);
13147 SET_CopyTextureSubImage3DEXT(table, save_CopyTextureSubImage3DEXT);
13148 SET_BindMultiTextureEXT(table, save_BindMultiTextureEXT);
13149 SET_MultiTexParameteriEXT(table, save_MultiTexParameteriEXT);
13150 SET_MultiTexParameterivEXT(table, save_MultiTexParameterivEXT);
13151 SET_MultiTexParameterfEXT(table, save_MultiTexParameterfEXT);
13152 SET_MultiTexParameterfvEXT(table, save_MultiTexParameterfvEXT);
13153 SET_MultiTexImage1DEXT(table, save_MultiTexImage1DEXT);
13154 SET_MultiTexImage2DEXT(table, save_MultiTexImage2DEXT);
13155 SET_MultiTexImage3DEXT(table, save_MultiTexImage3DEXT);
13156 SET_MultiTexSubImage1DEXT(table, save_MultiTexSubImage1DEXT);
13157 SET_MultiTexSubImage2DEXT(table, save_MultiTexSubImage2DEXT);
13158 SET_MultiTexSubImage3DEXT(table, save_MultiTexSubImage3DEXT);
13159 SET_MultiTexEnvfEXT(table, save_MultiTexEnvfEXT);
13160 SET_MultiTexEnvfvEXT(table, save_MultiTexEnvfvEXT);
13161 SET_MultiTexEnviEXT(table, save_MultiTexEnviEXT);
13162 SET_MultiTexEnvivEXT(table, save_MultiTexEnvivEXT);
13163 SET_CompressedTextureSubImage2DEXT(table, save_CompressedTextureSubImage2DEXT);
13164 }
13165
13166
13167
13168 static const char *
13169 enum_string(GLenum k)
13170 {
13171 return _mesa_enum_to_string(k);
13172 }
13173
13174
13175 /**
13176 * Print the commands in a display list. For debugging only.
13177 * TODO: many commands aren't handled yet.
13178 * \param fname filename to write display list to. If null, use stdout.
13179 */
13180 static void GLAPIENTRY
13181 print_list(struct gl_context *ctx, GLuint list, const char *fname)
13182 {
13183 struct gl_display_list *dlist;
13184 Node *n;
13185 GLboolean done;
13186 FILE *f = stdout;
13187
13188 if (fname) {
13189 f = fopen(fname, "w");
13190 if (!f)
13191 return;
13192 }
13193
13194 if (!islist(ctx, list)) {
13195 fprintf(f, "%u is not a display list ID\n", list);
13196 goto out;
13197 }
13198
13199 dlist = _mesa_lookup_list(ctx, list);
13200 if (!dlist) {
13201 goto out;
13202 }
13203
13204 n = dlist->Head;
13205
13206 fprintf(f, "START-LIST %u, address %p\n", list, (void *) n);
13207
13208 done = n ? GL_FALSE : GL_TRUE;
13209 while (!done) {
13210 const OpCode opcode = n[0].opcode;
13211
13212 if (is_ext_opcode(opcode)) {
13213 n += ext_opcode_print(ctx, n, f);
13214 }
13215 else {
13216 switch (opcode) {
13217 case OPCODE_ACCUM:
13218 fprintf(f, "Accum %s %g\n", enum_string(n[1].e), n[2].f);
13219 break;
13220 case OPCODE_ACTIVE_TEXTURE:
13221 fprintf(f, "ActiveTexture(%s)\n", enum_string(n[1].e));
13222 break;
13223 case OPCODE_BITMAP:
13224 fprintf(f, "Bitmap %d %d %g %g %g %g %p\n", n[1].i, n[2].i,
13225 n[3].f, n[4].f, n[5].f, n[6].f,
13226 get_pointer(&n[7]));
13227 break;
13228 case OPCODE_BLEND_COLOR:
13229 fprintf(f, "BlendColor %f, %f, %f, %f\n",
13230 n[1].f, n[2].f, n[3].f, n[4].f);
13231 break;
13232 case OPCODE_BLEND_EQUATION:
13233 fprintf(f, "BlendEquation %s\n",
13234 enum_string(n[1].e));
13235 break;
13236 case OPCODE_BLEND_EQUATION_SEPARATE:
13237 fprintf(f, "BlendEquationSeparate %s, %s\n",
13238 enum_string(n[1].e),
13239 enum_string(n[2].e));
13240 break;
13241 case OPCODE_BLEND_FUNC_SEPARATE:
13242 fprintf(f, "BlendFuncSeparate %s, %s, %s, %s\n",
13243 enum_string(n[1].e),
13244 enum_string(n[2].e),
13245 enum_string(n[3].e),
13246 enum_string(n[4].e));
13247 break;
13248 case OPCODE_BLEND_EQUATION_I:
13249 fprintf(f, "BlendEquationi %u, %s\n",
13250 n[1].ui, enum_string(n[2].e));
13251 break;
13252 case OPCODE_BLEND_EQUATION_SEPARATE_I:
13253 fprintf(f, "BlendEquationSeparatei %u, %s, %s\n",
13254 n[1].ui, enum_string(n[2].e), enum_string(n[3].e));
13255 break;
13256 case OPCODE_BLEND_FUNC_I:
13257 fprintf(f, "BlendFunci %u, %s, %s\n",
13258 n[1].ui, enum_string(n[2].e), enum_string(n[3].e));
13259 break;
13260 case OPCODE_BLEND_FUNC_SEPARATE_I:
13261 fprintf(f, "BlendFuncSeparatei %u, %s, %s, %s, %s\n",
13262 n[1].ui,
13263 enum_string(n[2].e),
13264 enum_string(n[3].e),
13265 enum_string(n[4].e),
13266 enum_string(n[5].e));
13267 break;
13268 case OPCODE_CALL_LIST:
13269 fprintf(f, "CallList %d\n", (int) n[1].ui);
13270 break;
13271 case OPCODE_CALL_LISTS:
13272 fprintf(f, "CallLists %d, %s\n", n[1].i, enum_string(n[1].e));
13273 break;
13274 case OPCODE_DISABLE:
13275 fprintf(f, "Disable %s\n", enum_string(n[1].e));
13276 break;
13277 case OPCODE_ENABLE:
13278 fprintf(f, "Enable %s\n", enum_string(n[1].e));
13279 break;
13280 case OPCODE_FRUSTUM:
13281 fprintf(f, "Frustum %g %g %g %g %g %g\n",
13282 n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f);
13283 break;
13284 case OPCODE_LINE_STIPPLE:
13285 fprintf(f, "LineStipple %d %x\n", n[1].i, (int) n[2].us);
13286 break;
13287 case OPCODE_LINE_WIDTH:
13288 fprintf(f, "LineWidth %f\n", n[1].f);
13289 break;
13290 case OPCODE_LOAD_IDENTITY:
13291 fprintf(f, "LoadIdentity\n");
13292 break;
13293 case OPCODE_LOAD_MATRIX:
13294 fprintf(f, "LoadMatrix\n");
13295 fprintf(f, " %8f %8f %8f %8f\n",
13296 n[1].f, n[5].f, n[9].f, n[13].f);
13297 fprintf(f, " %8f %8f %8f %8f\n",
13298 n[2].f, n[6].f, n[10].f, n[14].f);
13299 fprintf(f, " %8f %8f %8f %8f\n",
13300 n[3].f, n[7].f, n[11].f, n[15].f);
13301 fprintf(f, " %8f %8f %8f %8f\n",
13302 n[4].f, n[8].f, n[12].f, n[16].f);
13303 break;
13304 case OPCODE_MULT_MATRIX:
13305 fprintf(f, "MultMatrix (or Rotate)\n");
13306 fprintf(f, " %8f %8f %8f %8f\n",
13307 n[1].f, n[5].f, n[9].f, n[13].f);
13308 fprintf(f, " %8f %8f %8f %8f\n",
13309 n[2].f, n[6].f, n[10].f, n[14].f);
13310 fprintf(f, " %8f %8f %8f %8f\n",
13311 n[3].f, n[7].f, n[11].f, n[15].f);
13312 fprintf(f, " %8f %8f %8f %8f\n",
13313 n[4].f, n[8].f, n[12].f, n[16].f);
13314 break;
13315 case OPCODE_ORTHO:
13316 fprintf(f, "Ortho %g %g %g %g %g %g\n",
13317 n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f);
13318 break;
13319 case OPCODE_POINT_SIZE:
13320 fprintf(f, "PointSize %f\n", n[1].f);
13321 break;
13322 case OPCODE_POP_ATTRIB:
13323 fprintf(f, "PopAttrib\n");
13324 break;
13325 case OPCODE_POP_MATRIX:
13326 fprintf(f, "PopMatrix\n");
13327 break;
13328 case OPCODE_POP_NAME:
13329 fprintf(f, "PopName\n");
13330 break;
13331 case OPCODE_PUSH_ATTRIB:
13332 fprintf(f, "PushAttrib %x\n", n[1].bf);
13333 break;
13334 case OPCODE_PUSH_MATRIX:
13335 fprintf(f, "PushMatrix\n");
13336 break;
13337 case OPCODE_PUSH_NAME:
13338 fprintf(f, "PushName %d\n", (int) n[1].ui);
13339 break;
13340 case OPCODE_RASTER_POS:
13341 fprintf(f, "RasterPos %g %g %g %g\n",
13342 n[1].f, n[2].f, n[3].f, n[4].f);
13343 break;
13344 case OPCODE_ROTATE:
13345 fprintf(f, "Rotate %g %g %g %g\n",
13346 n[1].f, n[2].f, n[3].f, n[4].f);
13347 break;
13348 case OPCODE_SCALE:
13349 fprintf(f, "Scale %g %g %g\n", n[1].f, n[2].f, n[3].f);
13350 break;
13351 case OPCODE_TRANSLATE:
13352 fprintf(f, "Translate %g %g %g\n", n[1].f, n[2].f, n[3].f);
13353 break;
13354 case OPCODE_BIND_TEXTURE:
13355 fprintf(f, "BindTexture %s %d\n",
13356 _mesa_enum_to_string(n[1].ui), n[2].ui);
13357 break;
13358 case OPCODE_SHADE_MODEL:
13359 fprintf(f, "ShadeModel %s\n", _mesa_enum_to_string(n[1].ui));
13360 break;
13361 case OPCODE_MAP1:
13362 fprintf(f, "Map1 %s %.3f %.3f %d %d\n",
13363 _mesa_enum_to_string(n[1].ui),
13364 n[2].f, n[3].f, n[4].i, n[5].i);
13365 break;
13366 case OPCODE_MAP2:
13367 fprintf(f, "Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
13368 _mesa_enum_to_string(n[1].ui),
13369 n[2].f, n[3].f, n[4].f, n[5].f,
13370 n[6].i, n[7].i, n[8].i, n[9].i);
13371 break;
13372 case OPCODE_MAPGRID1:
13373 fprintf(f, "MapGrid1 %d %.3f %.3f\n", n[1].i, n[2].f, n[3].f);
13374 break;
13375 case OPCODE_MAPGRID2:
13376 fprintf(f, "MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
13377 n[1].i, n[2].f, n[3].f, n[4].i, n[5].f, n[6].f);
13378 break;
13379 case OPCODE_EVALMESH1:
13380 fprintf(f, "EvalMesh1 %d %d\n", n[1].i, n[2].i);
13381 break;
13382 case OPCODE_EVALMESH2:
13383 fprintf(f, "EvalMesh2 %d %d %d %d\n",
13384 n[1].i, n[2].i, n[3].i, n[4].i);
13385 break;
13386
13387 case OPCODE_ATTR_1F_NV:
13388 fprintf(f, "ATTR_1F_NV attr %d: %f\n", n[1].i, n[2].f);
13389 break;
13390 case OPCODE_ATTR_2F_NV:
13391 fprintf(f, "ATTR_2F_NV attr %d: %f %f\n",
13392 n[1].i, n[2].f, n[3].f);
13393 break;
13394 case OPCODE_ATTR_3F_NV:
13395 fprintf(f, "ATTR_3F_NV attr %d: %f %f %f\n",
13396 n[1].i, n[2].f, n[3].f, n[4].f);
13397 break;
13398 case OPCODE_ATTR_4F_NV:
13399 fprintf(f, "ATTR_4F_NV attr %d: %f %f %f %f\n",
13400 n[1].i, n[2].f, n[3].f, n[4].f, n[5].f);
13401 break;
13402 case OPCODE_ATTR_1F_ARB:
13403 fprintf(f, "ATTR_1F_ARB attr %d: %f\n", n[1].i, n[2].f);
13404 break;
13405 case OPCODE_ATTR_2F_ARB:
13406 fprintf(f, "ATTR_2F_ARB attr %d: %f %f\n",
13407 n[1].i, n[2].f, n[3].f);
13408 break;
13409 case OPCODE_ATTR_3F_ARB:
13410 fprintf(f, "ATTR_3F_ARB attr %d: %f %f %f\n",
13411 n[1].i, n[2].f, n[3].f, n[4].f);
13412 break;
13413 case OPCODE_ATTR_4F_ARB:
13414 fprintf(f, "ATTR_4F_ARB attr %d: %f %f %f %f\n",
13415 n[1].i, n[2].f, n[3].f, n[4].f, n[5].f);
13416 break;
13417
13418 case OPCODE_MATERIAL:
13419 fprintf(f, "MATERIAL %x %x: %f %f %f %f\n",
13420 n[1].i, n[2].i, n[3].f, n[4].f, n[5].f, n[6].f);
13421 break;
13422 case OPCODE_BEGIN:
13423 fprintf(f, "BEGIN %x\n", n[1].i);
13424 break;
13425 case OPCODE_END:
13426 fprintf(f, "END\n");
13427 break;
13428 case OPCODE_RECTF:
13429 fprintf(f, "RECTF %f %f %f %f\n", n[1].f, n[2].f, n[3].f,
13430 n[4].f);
13431 break;
13432 case OPCODE_EVAL_C1:
13433 fprintf(f, "EVAL_C1 %f\n", n[1].f);
13434 break;
13435 case OPCODE_EVAL_C2:
13436 fprintf(f, "EVAL_C2 %f %f\n", n[1].f, n[2].f);
13437 break;
13438 case OPCODE_EVAL_P1:
13439 fprintf(f, "EVAL_P1 %d\n", n[1].i);
13440 break;
13441 case OPCODE_EVAL_P2:
13442 fprintf(f, "EVAL_P2 %d %d\n", n[1].i, n[2].i);
13443 break;
13444
13445 case OPCODE_PROVOKING_VERTEX:
13446 fprintf(f, "ProvokingVertex %s\n",
13447 _mesa_enum_to_string(n[1].ui));
13448 break;
13449
13450 /*
13451 * meta opcodes/commands
13452 */
13453 case OPCODE_ERROR:
13454 fprintf(f, "Error: %s %s\n", enum_string(n[1].e),
13455 (const char *) get_pointer(&n[2]));
13456 break;
13457 case OPCODE_CONTINUE:
13458 fprintf(f, "DISPLAY-LIST-CONTINUE\n");
13459 n = (Node *) get_pointer(&n[1]);
13460 break;
13461 case OPCODE_NOP:
13462 fprintf(f, "NOP\n");
13463 break;
13464 case OPCODE_END_OF_LIST:
13465 fprintf(f, "END-LIST %u\n", list);
13466 done = GL_TRUE;
13467 break;
13468 default:
13469 if (opcode < 0 || opcode > OPCODE_END_OF_LIST) {
13470 printf
13471 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
13472 opcode, (void *) n);
13473 goto out;
13474 }
13475 else {
13476 fprintf(f, "command %d, %u operands\n", opcode,
13477 InstSize[opcode]);
13478 }
13479 }
13480 /* increment n to point to next compiled command */
13481 if (opcode != OPCODE_CONTINUE) {
13482 assert(InstSize[opcode] > 0);
13483 n += InstSize[opcode];
13484 }
13485 }
13486 }
13487
13488 out:
13489 fflush(f);
13490 if (fname)
13491 fclose(f);
13492 }
13493
13494
13495
13496 /**
13497 * Clients may call this function to help debug display list problems.
13498 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
13499 * changed, or break in the future without notice.
13500 */
13501 void
13502 mesa_print_display_list(GLuint list)
13503 {
13504 GET_CURRENT_CONTEXT(ctx);
13505 print_list(ctx, list, NULL);
13506 }
13507
13508
13509 /**********************************************************************/
13510 /***** Initialization *****/
13511 /**********************************************************************/
13512
13513 static void
13514 save_vtxfmt_init(GLvertexformat * vfmt)
13515 {
13516 vfmt->ArrayElement = _ae_ArrayElement;
13517
13518 vfmt->Begin = save_Begin;
13519
13520 vfmt->CallList = save_CallList;
13521 vfmt->CallLists = save_CallLists;
13522
13523 vfmt->Color3f = save_Color3f;
13524 vfmt->Color3fv = save_Color3fv;
13525 vfmt->Color4f = save_Color4f;
13526 vfmt->Color4fv = save_Color4fv;
13527 vfmt->EdgeFlag = save_EdgeFlag;
13528 vfmt->End = save_End;
13529
13530 vfmt->EvalCoord1f = save_EvalCoord1f;
13531 vfmt->EvalCoord1fv = save_EvalCoord1fv;
13532 vfmt->EvalCoord2f = save_EvalCoord2f;
13533 vfmt->EvalCoord2fv = save_EvalCoord2fv;
13534 vfmt->EvalPoint1 = save_EvalPoint1;
13535 vfmt->EvalPoint2 = save_EvalPoint2;
13536
13537 vfmt->FogCoordfEXT = save_FogCoordfEXT;
13538 vfmt->FogCoordfvEXT = save_FogCoordfvEXT;
13539 vfmt->Indexf = save_Indexf;
13540 vfmt->Indexfv = save_Indexfv;
13541 vfmt->Materialfv = save_Materialfv;
13542 vfmt->MultiTexCoord1fARB = save_MultiTexCoord1f;
13543 vfmt->MultiTexCoord1fvARB = save_MultiTexCoord1fv;
13544 vfmt->MultiTexCoord2fARB = save_MultiTexCoord2f;
13545 vfmt->MultiTexCoord2fvARB = save_MultiTexCoord2fv;
13546 vfmt->MultiTexCoord3fARB = save_MultiTexCoord3f;
13547 vfmt->MultiTexCoord3fvARB = save_MultiTexCoord3fv;
13548 vfmt->MultiTexCoord4fARB = save_MultiTexCoord4f;
13549 vfmt->MultiTexCoord4fvARB = save_MultiTexCoord4fv;
13550 vfmt->Normal3f = save_Normal3f;
13551 vfmt->Normal3fv = save_Normal3fv;
13552 vfmt->SecondaryColor3fEXT = save_SecondaryColor3fEXT;
13553 vfmt->SecondaryColor3fvEXT = save_SecondaryColor3fvEXT;
13554 vfmt->TexCoord1f = save_TexCoord1f;
13555 vfmt->TexCoord1fv = save_TexCoord1fv;
13556 vfmt->TexCoord2f = save_TexCoord2f;
13557 vfmt->TexCoord2fv = save_TexCoord2fv;
13558 vfmt->TexCoord3f = save_TexCoord3f;
13559 vfmt->TexCoord3fv = save_TexCoord3fv;
13560 vfmt->TexCoord4f = save_TexCoord4f;
13561 vfmt->TexCoord4fv = save_TexCoord4fv;
13562 vfmt->Vertex2f = save_Vertex2f;
13563 vfmt->Vertex2fv = save_Vertex2fv;
13564 vfmt->Vertex3f = save_Vertex3f;
13565 vfmt->Vertex3fv = save_Vertex3fv;
13566 vfmt->Vertex4f = save_Vertex4f;
13567 vfmt->Vertex4fv = save_Vertex4fv;
13568 vfmt->VertexAttrib1fARB = save_VertexAttrib1fARB;
13569 vfmt->VertexAttrib1fvARB = save_VertexAttrib1fvARB;
13570 vfmt->VertexAttrib2fARB = save_VertexAttrib2fARB;
13571 vfmt->VertexAttrib2fvARB = save_VertexAttrib2fvARB;
13572 vfmt->VertexAttrib3fARB = save_VertexAttrib3fARB;
13573 vfmt->VertexAttrib3fvARB = save_VertexAttrib3fvARB;
13574 vfmt->VertexAttrib4fARB = save_VertexAttrib4fARB;
13575 vfmt->VertexAttrib4fvARB = save_VertexAttrib4fvARB;
13576 vfmt->VertexAttribL1d = save_VertexAttribL1d;
13577 vfmt->VertexAttribL1dv = save_VertexAttribL1dv;
13578 vfmt->VertexAttribL2d = save_VertexAttribL2d;
13579 vfmt->VertexAttribL2dv = save_VertexAttribL2dv;
13580 vfmt->VertexAttribL3d = save_VertexAttribL3d;
13581 vfmt->VertexAttribL3dv = save_VertexAttribL3dv;
13582 vfmt->VertexAttribL4d = save_VertexAttribL4d;
13583 vfmt->VertexAttribL4dv = save_VertexAttribL4dv;
13584
13585 vfmt->PrimitiveRestartNV = save_PrimitiveRestartNV;
13586 }
13587
13588
13589 void
13590 _mesa_install_dlist_vtxfmt(struct _glapi_table *disp,
13591 const GLvertexformat *vfmt)
13592 {
13593 SET_CallList(disp, vfmt->CallList);
13594 SET_CallLists(disp, vfmt->CallLists);
13595 }
13596
13597
13598 /**
13599 * Initialize display list state for given context.
13600 */
13601 void
13602 _mesa_init_display_list(struct gl_context *ctx)
13603 {
13604 static GLboolean tableInitialized = GL_FALSE;
13605
13606 /* zero-out the instruction size table, just once */
13607 if (!tableInitialized) {
13608 memset(InstSize, 0, sizeof(InstSize));
13609 tableInitialized = GL_TRUE;
13610 }
13611
13612 /* extension info */
13613 ctx->ListExt = CALLOC_STRUCT(gl_list_extensions);
13614
13615 /* Display list */
13616 ctx->ListState.CallDepth = 0;
13617 ctx->ExecuteFlag = GL_TRUE;
13618 ctx->CompileFlag = GL_FALSE;
13619 ctx->ListState.CurrentBlock = NULL;
13620 ctx->ListState.CurrentPos = 0;
13621
13622 /* Display List group */
13623 ctx->List.ListBase = 0;
13624
13625 save_vtxfmt_init(&ctx->ListState.ListVtxfmt);
13626
13627 InstSize[OPCODE_NOP] = 1;
13628 }
13629
13630
13631 void
13632 _mesa_free_display_list_data(struct gl_context *ctx)
13633 {
13634 free(ctx->ListExt);
13635 ctx->ListExt = NULL;
13636 }