mesa: fix invalid target error handling for teximage
[mesa.git] / src / mesa / main / dlist.c
1 /*
2 * Mesa 3-D graphics library
3 *
4 * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
5 * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 * OTHER DEALINGS IN THE SOFTWARE.
24 */
25
26
27 /**
28 * \file dlist.c
29 * Display lists management functions.
30 */
31
32 #include "c99_math.h"
33 #include "glheader.h"
34 #include "imports.h"
35 #include "api_arrayelt.h"
36 #include "api_exec.h"
37 #include "api_loopback.h"
38 #include "draw_validate.h"
39 #include "atifragshader.h"
40 #include "config.h"
41 #include "bufferobj.h"
42 #include "arrayobj.h"
43 #include "context.h"
44 #include "dlist.h"
45 #include "enums.h"
46 #include "eval.h"
47 #include "fbobject.h"
48 #include "framebuffer.h"
49 #include "glapi/glapi.h"
50 #include "glformats.h"
51 #include "hash.h"
52 #include "image.h"
53 #include "light.h"
54 #include "macros.h"
55 #include "pack.h"
56 #include "pbo.h"
57 #include "queryobj.h"
58 #include "samplerobj.h"
59 #include "shaderapi.h"
60 #include "syncobj.h"
61 #include "teximage.h"
62 #include "texstorage.h"
63 #include "mtypes.h"
64 #include "varray.h"
65 #include "arbprogram.h"
66 #include "transformfeedback.h"
67
68 #include "math/m_matrix.h"
69
70 #include "main/dispatch.h"
71
72 #include "vbo/vbo.h"
73
74
75 #define USE_BITMAP_ATLAS 1
76
77
78
79 /**
80 * Other parts of Mesa (such as the VBO module) can plug into the display
81 * list system. This structure describes new display list instructions.
82 */
83 struct gl_list_instruction
84 {
85 GLuint Size;
86 void (*Execute)( struct gl_context *ctx, void *data );
87 void (*Destroy)( struct gl_context *ctx, void *data );
88 void (*Print)( struct gl_context *ctx, void *data, FILE *f );
89 };
90
91
92 #define MAX_DLIST_EXT_OPCODES 16
93
94 /**
95 * Used by device drivers to hook new commands into display lists.
96 */
97 struct gl_list_extensions
98 {
99 struct gl_list_instruction Opcode[MAX_DLIST_EXT_OPCODES];
100 GLuint NumOpcodes;
101 };
102
103
104
105 /**
106 * Flush vertices.
107 *
108 * \param ctx GL context.
109 *
110 * Checks if dd_function_table::SaveNeedFlush is marked to flush
111 * stored (save) vertices, and calls vbo_save_SaveFlushVertices if so.
112 */
113 #define SAVE_FLUSH_VERTICES(ctx) \
114 do { \
115 if (ctx->Driver.SaveNeedFlush) \
116 vbo_save_SaveFlushVertices(ctx); \
117 } while (0)
118
119
120 /**
121 * Macro to assert that the API call was made outside the
122 * glBegin()/glEnd() pair, with return value.
123 *
124 * \param ctx GL context.
125 * \param retval value to return value in case the assertion fails.
126 */
127 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval) \
128 do { \
129 if (ctx->Driver.CurrentSavePrimitive <= PRIM_MAX) { \
130 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glBegin/End" ); \
131 return retval; \
132 } \
133 } while (0)
134
135 /**
136 * Macro to assert that the API call was made outside the
137 * glBegin()/glEnd() pair.
138 *
139 * \param ctx GL context.
140 */
141 #define ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx) \
142 do { \
143 if (ctx->Driver.CurrentSavePrimitive <= PRIM_MAX) { \
144 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glBegin/End" ); \
145 return; \
146 } \
147 } while (0)
148
149 /**
150 * Macro to assert that the API call was made outside the
151 * glBegin()/glEnd() pair and flush the vertices.
152 *
153 * \param ctx GL context.
154 */
155 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx) \
156 do { \
157 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx); \
158 SAVE_FLUSH_VERTICES(ctx); \
159 } while (0)
160
161 /**
162 * Macro to assert that the API call was made outside the
163 * glBegin()/glEnd() pair and flush the vertices, with return value.
164 *
165 * \param ctx GL context.
166 * \param retval value to return value in case the assertion fails.
167 */
168 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval) \
169 do { \
170 ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval); \
171 SAVE_FLUSH_VERTICES(ctx); \
172 } while (0)
173
174
175 /**
176 * Display list opcodes.
177 *
178 * The fact that these identifiers are assigned consecutive
179 * integer values starting at 0 is very important, see InstSize array usage)
180 */
181 typedef enum
182 {
183 OPCODE_INVALID = -1, /* Force signed enum */
184 OPCODE_ACCUM,
185 OPCODE_ALPHA_FUNC,
186 OPCODE_BIND_TEXTURE,
187 OPCODE_BITMAP,
188 OPCODE_BLEND_COLOR,
189 OPCODE_BLEND_EQUATION,
190 OPCODE_BLEND_EQUATION_SEPARATE,
191 OPCODE_BLEND_FUNC_SEPARATE,
192
193 OPCODE_BLEND_EQUATION_I,
194 OPCODE_BLEND_EQUATION_SEPARATE_I,
195 OPCODE_BLEND_FUNC_I,
196 OPCODE_BLEND_FUNC_SEPARATE_I,
197
198 OPCODE_CALL_LIST,
199 OPCODE_CALL_LISTS,
200 OPCODE_CLEAR,
201 OPCODE_CLEAR_ACCUM,
202 OPCODE_CLEAR_COLOR,
203 OPCODE_CLEAR_DEPTH,
204 OPCODE_CLEAR_INDEX,
205 OPCODE_CLEAR_STENCIL,
206 OPCODE_CLEAR_BUFFER_IV,
207 OPCODE_CLEAR_BUFFER_UIV,
208 OPCODE_CLEAR_BUFFER_FV,
209 OPCODE_CLEAR_BUFFER_FI,
210 OPCODE_CLIP_PLANE,
211 OPCODE_COLOR_MASK,
212 OPCODE_COLOR_MASK_INDEXED,
213 OPCODE_COLOR_MATERIAL,
214 OPCODE_COPY_PIXELS,
215 OPCODE_COPY_TEX_IMAGE1D,
216 OPCODE_COPY_TEX_IMAGE2D,
217 OPCODE_COPY_TEX_SUB_IMAGE1D,
218 OPCODE_COPY_TEX_SUB_IMAGE2D,
219 OPCODE_COPY_TEX_SUB_IMAGE3D,
220 OPCODE_CULL_FACE,
221 OPCODE_DEPTH_FUNC,
222 OPCODE_DEPTH_MASK,
223 OPCODE_DEPTH_RANGE,
224 OPCODE_DISABLE,
225 OPCODE_DISABLE_INDEXED,
226 OPCODE_DRAW_BUFFER,
227 OPCODE_DRAW_PIXELS,
228 OPCODE_ENABLE,
229 OPCODE_ENABLE_INDEXED,
230 OPCODE_EVALMESH1,
231 OPCODE_EVALMESH2,
232 OPCODE_FOG,
233 OPCODE_FRONT_FACE,
234 OPCODE_FRUSTUM,
235 OPCODE_HINT,
236 OPCODE_INDEX_MASK,
237 OPCODE_INIT_NAMES,
238 OPCODE_LIGHT,
239 OPCODE_LIGHT_MODEL,
240 OPCODE_LINE_STIPPLE,
241 OPCODE_LINE_WIDTH,
242 OPCODE_LIST_BASE,
243 OPCODE_LOAD_IDENTITY,
244 OPCODE_LOAD_MATRIX,
245 OPCODE_LOAD_NAME,
246 OPCODE_LOGIC_OP,
247 OPCODE_MAP1,
248 OPCODE_MAP2,
249 OPCODE_MAPGRID1,
250 OPCODE_MAPGRID2,
251 OPCODE_MATRIX_MODE,
252 OPCODE_MULT_MATRIX,
253 OPCODE_ORTHO,
254 OPCODE_PASSTHROUGH,
255 OPCODE_PIXEL_MAP,
256 OPCODE_PIXEL_TRANSFER,
257 OPCODE_PIXEL_ZOOM,
258 OPCODE_POINT_SIZE,
259 OPCODE_POINT_PARAMETERS,
260 OPCODE_POLYGON_MODE,
261 OPCODE_POLYGON_STIPPLE,
262 OPCODE_POLYGON_OFFSET,
263 OPCODE_POP_ATTRIB,
264 OPCODE_POP_MATRIX,
265 OPCODE_POP_NAME,
266 OPCODE_PRIORITIZE_TEXTURE,
267 OPCODE_PUSH_ATTRIB,
268 OPCODE_PUSH_MATRIX,
269 OPCODE_PUSH_NAME,
270 OPCODE_RASTER_POS,
271 OPCODE_READ_BUFFER,
272 OPCODE_ROTATE,
273 OPCODE_SCALE,
274 OPCODE_SCISSOR,
275 OPCODE_SELECT_TEXTURE_SGIS,
276 OPCODE_SELECT_TEXTURE_COORD_SET,
277 OPCODE_SHADE_MODEL,
278 OPCODE_STENCIL_FUNC,
279 OPCODE_STENCIL_MASK,
280 OPCODE_STENCIL_OP,
281 OPCODE_TEXENV,
282 OPCODE_TEXGEN,
283 OPCODE_TEXPARAMETER,
284 OPCODE_TEX_IMAGE1D,
285 OPCODE_TEX_IMAGE2D,
286 OPCODE_TEX_IMAGE3D,
287 OPCODE_TEX_SUB_IMAGE1D,
288 OPCODE_TEX_SUB_IMAGE2D,
289 OPCODE_TEX_SUB_IMAGE3D,
290 OPCODE_TRANSLATE,
291 OPCODE_VIEWPORT,
292 OPCODE_WINDOW_POS,
293 /* ARB_viewport_array */
294 OPCODE_VIEWPORT_ARRAY_V,
295 OPCODE_VIEWPORT_INDEXED_F,
296 OPCODE_VIEWPORT_INDEXED_FV,
297 OPCODE_SCISSOR_ARRAY_V,
298 OPCODE_SCISSOR_INDEXED,
299 OPCODE_SCISSOR_INDEXED_V,
300 OPCODE_DEPTH_ARRAY_V,
301 OPCODE_DEPTH_INDEXED,
302 /* GL_ARB_multitexture */
303 OPCODE_ACTIVE_TEXTURE,
304 /* GL_ARB_texture_compression */
305 OPCODE_COMPRESSED_TEX_IMAGE_1D,
306 OPCODE_COMPRESSED_TEX_IMAGE_2D,
307 OPCODE_COMPRESSED_TEX_IMAGE_3D,
308 OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D,
309 OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D,
310 OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D,
311 /* GL_ARB_multisample */
312 OPCODE_SAMPLE_COVERAGE,
313 /* GL_ARB_window_pos */
314 OPCODE_WINDOW_POS_ARB,
315 /* GL_ARB_vertex_program */
316 OPCODE_BIND_PROGRAM_ARB,
317 OPCODE_PROGRAM_LOCAL_PARAMETER_ARB,
318 /* GL_EXT_stencil_two_side */
319 OPCODE_ACTIVE_STENCIL_FACE_EXT,
320 /* GL_EXT_depth_bounds_test */
321 OPCODE_DEPTH_BOUNDS_EXT,
322 /* GL_ARB_vertex/fragment_program */
323 OPCODE_PROGRAM_STRING_ARB,
324 OPCODE_PROGRAM_ENV_PARAMETER_ARB,
325 /* GL_ARB_occlusion_query */
326 OPCODE_BEGIN_QUERY_ARB,
327 OPCODE_END_QUERY_ARB,
328 /* GL_ARB_draw_buffers */
329 OPCODE_DRAW_BUFFERS_ARB,
330 /* GL_ATI_fragment_shader */
331 OPCODE_BIND_FRAGMENT_SHADER_ATI,
332 OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI,
333 /* OpenGL 2.0 */
334 OPCODE_STENCIL_FUNC_SEPARATE,
335 OPCODE_STENCIL_OP_SEPARATE,
336 OPCODE_STENCIL_MASK_SEPARATE,
337 /* GL_NV_primitive_restart */
338 OPCODE_PRIMITIVE_RESTART_NV,
339 /* GL_ARB_shader_objects */
340 OPCODE_USE_PROGRAM,
341 OPCODE_UNIFORM_1F,
342 OPCODE_UNIFORM_2F,
343 OPCODE_UNIFORM_3F,
344 OPCODE_UNIFORM_4F,
345 OPCODE_UNIFORM_1FV,
346 OPCODE_UNIFORM_2FV,
347 OPCODE_UNIFORM_3FV,
348 OPCODE_UNIFORM_4FV,
349 OPCODE_UNIFORM_1I,
350 OPCODE_UNIFORM_2I,
351 OPCODE_UNIFORM_3I,
352 OPCODE_UNIFORM_4I,
353 OPCODE_UNIFORM_1IV,
354 OPCODE_UNIFORM_2IV,
355 OPCODE_UNIFORM_3IV,
356 OPCODE_UNIFORM_4IV,
357 OPCODE_UNIFORM_MATRIX22,
358 OPCODE_UNIFORM_MATRIX33,
359 OPCODE_UNIFORM_MATRIX44,
360 OPCODE_UNIFORM_MATRIX23,
361 OPCODE_UNIFORM_MATRIX32,
362 OPCODE_UNIFORM_MATRIX24,
363 OPCODE_UNIFORM_MATRIX42,
364 OPCODE_UNIFORM_MATRIX34,
365 OPCODE_UNIFORM_MATRIX43,
366
367 /* OpenGL 3.0 */
368 OPCODE_UNIFORM_1UI,
369 OPCODE_UNIFORM_2UI,
370 OPCODE_UNIFORM_3UI,
371 OPCODE_UNIFORM_4UI,
372 OPCODE_UNIFORM_1UIV,
373 OPCODE_UNIFORM_2UIV,
374 OPCODE_UNIFORM_3UIV,
375 OPCODE_UNIFORM_4UIV,
376
377 /* GL_ARB_gpu_shader_fp64 */
378 OPCODE_UNIFORM_1D,
379 OPCODE_UNIFORM_2D,
380 OPCODE_UNIFORM_3D,
381 OPCODE_UNIFORM_4D,
382 OPCODE_UNIFORM_1DV,
383 OPCODE_UNIFORM_2DV,
384 OPCODE_UNIFORM_3DV,
385 OPCODE_UNIFORM_4DV,
386 OPCODE_UNIFORM_MATRIX22D,
387 OPCODE_UNIFORM_MATRIX33D,
388 OPCODE_UNIFORM_MATRIX44D,
389 OPCODE_UNIFORM_MATRIX23D,
390 OPCODE_UNIFORM_MATRIX32D,
391 OPCODE_UNIFORM_MATRIX24D,
392 OPCODE_UNIFORM_MATRIX42D,
393 OPCODE_UNIFORM_MATRIX34D,
394 OPCODE_UNIFORM_MATRIX43D,
395
396 /* OpenGL 4.0 / GL_ARB_tessellation_shader */
397 OPCODE_PATCH_PARAMETER_I,
398 OPCODE_PATCH_PARAMETER_FV_INNER,
399 OPCODE_PATCH_PARAMETER_FV_OUTER,
400
401 /* OpenGL 4.2 / GL_ARB_separate_shader_objects */
402 OPCODE_USE_PROGRAM_STAGES,
403 OPCODE_PROGRAM_UNIFORM_1F,
404 OPCODE_PROGRAM_UNIFORM_2F,
405 OPCODE_PROGRAM_UNIFORM_3F,
406 OPCODE_PROGRAM_UNIFORM_4F,
407 OPCODE_PROGRAM_UNIFORM_1FV,
408 OPCODE_PROGRAM_UNIFORM_2FV,
409 OPCODE_PROGRAM_UNIFORM_3FV,
410 OPCODE_PROGRAM_UNIFORM_4FV,
411 OPCODE_PROGRAM_UNIFORM_1D,
412 OPCODE_PROGRAM_UNIFORM_2D,
413 OPCODE_PROGRAM_UNIFORM_3D,
414 OPCODE_PROGRAM_UNIFORM_4D,
415 OPCODE_PROGRAM_UNIFORM_1DV,
416 OPCODE_PROGRAM_UNIFORM_2DV,
417 OPCODE_PROGRAM_UNIFORM_3DV,
418 OPCODE_PROGRAM_UNIFORM_4DV,
419 OPCODE_PROGRAM_UNIFORM_1I,
420 OPCODE_PROGRAM_UNIFORM_2I,
421 OPCODE_PROGRAM_UNIFORM_3I,
422 OPCODE_PROGRAM_UNIFORM_4I,
423 OPCODE_PROGRAM_UNIFORM_1IV,
424 OPCODE_PROGRAM_UNIFORM_2IV,
425 OPCODE_PROGRAM_UNIFORM_3IV,
426 OPCODE_PROGRAM_UNIFORM_4IV,
427 OPCODE_PROGRAM_UNIFORM_1UI,
428 OPCODE_PROGRAM_UNIFORM_2UI,
429 OPCODE_PROGRAM_UNIFORM_3UI,
430 OPCODE_PROGRAM_UNIFORM_4UI,
431 OPCODE_PROGRAM_UNIFORM_1UIV,
432 OPCODE_PROGRAM_UNIFORM_2UIV,
433 OPCODE_PROGRAM_UNIFORM_3UIV,
434 OPCODE_PROGRAM_UNIFORM_4UIV,
435 OPCODE_PROGRAM_UNIFORM_MATRIX22F,
436 OPCODE_PROGRAM_UNIFORM_MATRIX33F,
437 OPCODE_PROGRAM_UNIFORM_MATRIX44F,
438 OPCODE_PROGRAM_UNIFORM_MATRIX23F,
439 OPCODE_PROGRAM_UNIFORM_MATRIX32F,
440 OPCODE_PROGRAM_UNIFORM_MATRIX24F,
441 OPCODE_PROGRAM_UNIFORM_MATRIX42F,
442 OPCODE_PROGRAM_UNIFORM_MATRIX34F,
443 OPCODE_PROGRAM_UNIFORM_MATRIX43F,
444 OPCODE_PROGRAM_UNIFORM_MATRIX22D,
445 OPCODE_PROGRAM_UNIFORM_MATRIX33D,
446 OPCODE_PROGRAM_UNIFORM_MATRIX44D,
447 OPCODE_PROGRAM_UNIFORM_MATRIX23D,
448 OPCODE_PROGRAM_UNIFORM_MATRIX32D,
449 OPCODE_PROGRAM_UNIFORM_MATRIX24D,
450 OPCODE_PROGRAM_UNIFORM_MATRIX42D,
451 OPCODE_PROGRAM_UNIFORM_MATRIX34D,
452 OPCODE_PROGRAM_UNIFORM_MATRIX43D,
453
454 /* GL_ARB_clip_control */
455 OPCODE_CLIP_CONTROL,
456
457 /* GL_ARB_color_buffer_float */
458 OPCODE_CLAMP_COLOR,
459
460 /* GL_EXT_framebuffer_blit */
461 OPCODE_BLIT_FRAMEBUFFER,
462
463 /* Vertex attributes -- fallback for when optimized display
464 * list build isn't active.
465 */
466 OPCODE_ATTR_1F_NV,
467 OPCODE_ATTR_2F_NV,
468 OPCODE_ATTR_3F_NV,
469 OPCODE_ATTR_4F_NV,
470 OPCODE_ATTR_1F_ARB,
471 OPCODE_ATTR_2F_ARB,
472 OPCODE_ATTR_3F_ARB,
473 OPCODE_ATTR_4F_ARB,
474 OPCODE_ATTR_1D,
475 OPCODE_ATTR_2D,
476 OPCODE_ATTR_3D,
477 OPCODE_ATTR_4D,
478 OPCODE_MATERIAL,
479 OPCODE_BEGIN,
480 OPCODE_END,
481 OPCODE_RECTF,
482 OPCODE_EVAL_C1,
483 OPCODE_EVAL_C2,
484 OPCODE_EVAL_P1,
485 OPCODE_EVAL_P2,
486
487 /* GL_EXT_provoking_vertex */
488 OPCODE_PROVOKING_VERTEX,
489
490 /* GL_EXT_transform_feedback */
491 OPCODE_BEGIN_TRANSFORM_FEEDBACK,
492 OPCODE_END_TRANSFORM_FEEDBACK,
493 OPCODE_BIND_TRANSFORM_FEEDBACK,
494 OPCODE_PAUSE_TRANSFORM_FEEDBACK,
495 OPCODE_RESUME_TRANSFORM_FEEDBACK,
496 OPCODE_DRAW_TRANSFORM_FEEDBACK,
497
498 /* GL_EXT_texture_integer */
499 OPCODE_CLEARCOLOR_I,
500 OPCODE_CLEARCOLOR_UI,
501 OPCODE_TEXPARAMETER_I,
502 OPCODE_TEXPARAMETER_UI,
503
504 /* GL_ARB_instanced_arrays */
505 OPCODE_VERTEX_ATTRIB_DIVISOR,
506
507 /* GL_NV_texture_barrier */
508 OPCODE_TEXTURE_BARRIER_NV,
509
510 /* GL_ARB_sampler_object */
511 OPCODE_BIND_SAMPLER,
512 OPCODE_SAMPLER_PARAMETERIV,
513 OPCODE_SAMPLER_PARAMETERFV,
514 OPCODE_SAMPLER_PARAMETERIIV,
515 OPCODE_SAMPLER_PARAMETERUIV,
516
517 /* ARB_compute_shader */
518 OPCODE_DISPATCH_COMPUTE,
519
520 /* GL_ARB_sync */
521 OPCODE_WAIT_SYNC,
522
523 /* GL_NV_conditional_render */
524 OPCODE_BEGIN_CONDITIONAL_RENDER,
525 OPCODE_END_CONDITIONAL_RENDER,
526
527 /* ARB_timer_query */
528 OPCODE_QUERY_COUNTER,
529
530 /* ARB_transform_feedback3 */
531 OPCODE_BEGIN_QUERY_INDEXED,
532 OPCODE_END_QUERY_INDEXED,
533 OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM,
534
535 /* ARB_transform_feedback_instanced */
536 OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED,
537 OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED,
538
539 /* ARB_uniform_buffer_object */
540 OPCODE_UNIFORM_BLOCK_BINDING,
541
542 /* ARB_shader_subroutines */
543 OPCODE_UNIFORM_SUBROUTINES,
544
545 /* EXT_polygon_offset_clamp */
546 OPCODE_POLYGON_OFFSET_CLAMP,
547
548 /* EXT_window_rectangles */
549 OPCODE_WINDOW_RECTANGLES,
550
551 /* NV_conservative_raster */
552 OPCODE_SUBPIXEL_PRECISION_BIAS,
553
554 /* NV_conservative_raster_dilate */
555 OPCODE_CONSERVATIVE_RASTER_PARAMETER_F,
556
557 /* NV_conservative_raster_pre_snap_triangles */
558 OPCODE_CONSERVATIVE_RASTER_PARAMETER_I,
559
560 /* EXT_direct_state_access */
561 OPCODE_MATRIX_LOAD,
562 OPCODE_MATRIX_MULT,
563 OPCODE_MATRIX_ROTATE,
564 OPCODE_MATRIX_SCALE,
565 OPCODE_MATRIX_TRANSLATE,
566 OPCODE_MATRIX_LOAD_IDENTITY,
567 OPCODE_MATRIX_ORTHO,
568 OPCODE_MATRIX_FRUSTUM,
569 OPCODE_MATRIX_PUSH,
570 OPCODE_MATRIX_POP,
571 OPCODE_TEXTUREPARAMETER_F,
572 OPCODE_TEXTUREPARAMETER_I,
573 OPCODE_TEXTURE_IMAGE1D,
574 OPCODE_TEXTURE_IMAGE2D,
575 OPCODE_TEXTURE_IMAGE3D,
576 OPCODE_TEXTURE_SUB_IMAGE1D,
577 OPCODE_TEXTURE_SUB_IMAGE2D,
578 OPCODE_TEXTURE_SUB_IMAGE3D,
579 OPCODE_COPY_TEXTURE_IMAGE1D,
580 OPCODE_COPY_TEXTURE_IMAGE2D,
581 OPCODE_COPY_TEXTURE_SUB_IMAGE1D,
582 OPCODE_COPY_TEXTURE_SUB_IMAGE2D,
583 OPCODE_COPY_TEXTURE_SUB_IMAGE3D,
584 OPCODE_BIND_MULTITEXTURE,
585 OPCODE_MULTITEXPARAMETER_F,
586 OPCODE_MULTITEXPARAMETER_I,
587 OPCODE_MULTITEX_IMAGE1D,
588 OPCODE_MULTITEX_IMAGE2D,
589 OPCODE_MULTITEX_IMAGE3D,
590 OPCODE_MULTITEX_SUB_IMAGE1D,
591 OPCODE_MULTITEX_SUB_IMAGE2D,
592 OPCODE_MULTITEX_SUB_IMAGE3D,
593 OPCODE_COPY_MULTITEX_IMAGE1D,
594 OPCODE_COPY_MULTITEX_IMAGE2D,
595 OPCODE_COPY_MULTITEX_SUB_IMAGE1D,
596 OPCODE_COPY_MULTITEX_SUB_IMAGE2D,
597 OPCODE_COPY_MULTITEX_SUB_IMAGE3D,
598 OPCODE_MULTITEXENV,
599 OPCODE_COMPRESSED_TEXTURE_IMAGE_1D,
600 OPCODE_COMPRESSED_TEXTURE_IMAGE_2D,
601 OPCODE_COMPRESSED_TEXTURE_IMAGE_3D,
602 OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_1D,
603 OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_2D,
604 OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_3D,
605 OPCODE_COMPRESSED_MULTITEX_IMAGE_1D,
606 OPCODE_COMPRESSED_MULTITEX_IMAGE_2D,
607 OPCODE_COMPRESSED_MULTITEX_IMAGE_3D,
608 OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_1D,
609 OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_2D,
610 OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_3D,
611
612 /* The following three are meta instructions */
613 OPCODE_ERROR, /* raise compiled-in error */
614 OPCODE_CONTINUE,
615 OPCODE_NOP, /* No-op (used for 8-byte alignment */
616 OPCODE_END_OF_LIST,
617 OPCODE_EXT_0
618 } OpCode;
619
620
621
622 /**
623 * Display list node.
624 *
625 * Display list instructions are stored as sequences of "nodes". Nodes
626 * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
627 * are linked together with a pointer.
628 *
629 * Each instruction in the display list is stored as a sequence of
630 * contiguous nodes in memory.
631 * Each node is the union of a variety of data types.
632 *
633 * Note, all of these members should be 4 bytes in size or less for the
634 * sake of compact display lists. We store 8-byte pointers in a pair of
635 * these nodes using the save/get_pointer() functions below.
636 */
637 union gl_dlist_node
638 {
639 OpCode opcode;
640 GLboolean b;
641 GLbitfield bf;
642 GLubyte ub;
643 GLshort s;
644 GLushort us;
645 GLint i;
646 GLuint ui;
647 GLenum e;
648 GLfloat f;
649 GLsizei si;
650 };
651
652
653 typedef union gl_dlist_node Node;
654
655
656 /** How many 4-byte dwords to store a pointer */
657 #define POINTER_DWORDS (sizeof(void *) / 4)
658
659 /* We want to keep sizeof(union gl_dlist_node) == 4 to minimize
660 * space for display lists. The following types and functions are
661 * used to help store 4- and 8-byte pointers in 1 or 2 dlist_nodes.
662 */
663 union pointer
664 {
665 void *ptr;
666 GLuint dwords[POINTER_DWORDS];
667 };
668
669
670 /**
671 * Save a 4 or 8-byte pointer at dest (and dest+1).
672 */
673 static inline void
674 save_pointer(Node *dest, void *src)
675 {
676 union pointer p;
677 unsigned i;
678
679 STATIC_ASSERT(POINTER_DWORDS == 1 || POINTER_DWORDS == 2);
680 STATIC_ASSERT(sizeof(Node) == 4);
681
682 p.ptr = src;
683
684 for (i = 0; i < POINTER_DWORDS; i++)
685 dest[i].ui = p.dwords[i];
686 }
687
688
689 /**
690 * Retrieve a 4 or 8-byte pointer from node (node+1).
691 */
692 static inline void *
693 get_pointer(const Node *node)
694 {
695 union pointer p;
696 unsigned i;
697
698 for (i = 0; i < POINTER_DWORDS; i++)
699 p.dwords[i] = node[i].ui;
700
701 return p.ptr;
702 }
703
704
705 /**
706 * Used to store a 64-bit uint in a pair of "Nodes" for the sake of 32-bit
707 * environment.
708 */
709 union uint64_pair
710 {
711 GLuint64 uint64;
712 GLuint uint32[2];
713 };
714
715
716 union float64_pair
717 {
718 GLdouble d;
719 GLuint uint32[2];
720 };
721
722
723 #define ASSIGN_DOUBLE_TO_NODES(n, idx, value) \
724 do { \
725 union float64_pair tmp; \
726 tmp.d = value; \
727 n[idx].ui = tmp.uint32[0]; \
728 n[idx+1].ui = tmp.uint32[1]; \
729 } while (0)
730
731
732 /**
733 * How many nodes to allocate at a time. Note that bulk vertex data
734 * from glBegin/glVertex/glEnd primitives will typically wind up in
735 * a VBO, and not directly in the display list itself.
736 */
737 #define BLOCK_SIZE 256
738
739
740
741 /**
742 * Number of nodes of storage needed for each instruction.
743 * Sizes for dynamically allocated opcodes are stored in the context struct.
744 */
745 static GLuint InstSize[OPCODE_END_OF_LIST + 1];
746
747
748 void mesa_print_display_list(GLuint list);
749
750
751 /**
752 * Does the given display list only contain a single glBitmap call?
753 */
754 static bool
755 is_bitmap_list(const struct gl_display_list *dlist)
756 {
757 const Node *n = dlist->Head;
758 if (n[0].opcode == OPCODE_BITMAP) {
759 n += InstSize[OPCODE_BITMAP];
760 if (n[0].opcode == OPCODE_END_OF_LIST)
761 return true;
762 }
763 return false;
764 }
765
766
767 /**
768 * Is the given display list an empty list?
769 */
770 static bool
771 is_empty_list(const struct gl_display_list *dlist)
772 {
773 const Node *n = dlist->Head;
774 return n[0].opcode == OPCODE_END_OF_LIST;
775 }
776
777
778 /**
779 * Delete/free a gl_bitmap_atlas. Called during context tear-down.
780 */
781 void
782 _mesa_delete_bitmap_atlas(struct gl_context *ctx, struct gl_bitmap_atlas *atlas)
783 {
784 if (atlas->texObj) {
785 ctx->Driver.DeleteTexture(ctx, atlas->texObj);
786 }
787 free(atlas->glyphs);
788 free(atlas);
789 }
790
791
792 /**
793 * Lookup a gl_bitmap_atlas by listBase ID.
794 */
795 static struct gl_bitmap_atlas *
796 lookup_bitmap_atlas(struct gl_context *ctx, GLuint listBase)
797 {
798 struct gl_bitmap_atlas *atlas;
799
800 assert(listBase > 0);
801 atlas = _mesa_HashLookup(ctx->Shared->BitmapAtlas, listBase);
802 return atlas;
803 }
804
805
806 /**
807 * Create new bitmap atlas and insert into hash table.
808 */
809 static struct gl_bitmap_atlas *
810 alloc_bitmap_atlas(struct gl_context *ctx, GLuint listBase)
811 {
812 struct gl_bitmap_atlas *atlas;
813
814 assert(listBase > 0);
815 assert(_mesa_HashLookup(ctx->Shared->BitmapAtlas, listBase) == NULL);
816
817 atlas = calloc(1, sizeof(*atlas));
818 if (atlas) {
819 _mesa_HashInsert(ctx->Shared->BitmapAtlas, listBase, atlas);
820 }
821
822 return atlas;
823 }
824
825
826 /**
827 * Try to build a bitmap atlas. This involves examining a sequence of
828 * display lists which contain glBitmap commands and putting the bitmap
829 * images into a texture map (the atlas).
830 * If we succeed, gl_bitmap_atlas::complete will be set to true.
831 * If we fail, gl_bitmap_atlas::incomplete will be set to true.
832 */
833 static void
834 build_bitmap_atlas(struct gl_context *ctx, struct gl_bitmap_atlas *atlas,
835 GLuint listBase)
836 {
837 unsigned i, row_height = 0, xpos = 0, ypos = 0;
838 GLubyte *map;
839 GLint map_stride;
840
841 assert(atlas);
842 assert(!atlas->complete);
843 assert(atlas->numBitmaps > 0);
844
845 /* We use a rectangle texture (non-normalized coords) for the atlas */
846 assert(ctx->Extensions.NV_texture_rectangle);
847 assert(ctx->Const.MaxTextureRectSize >= 1024);
848
849 atlas->texWidth = 1024;
850 atlas->texHeight = 0; /* determined below */
851
852 atlas->glyphs = malloc(atlas->numBitmaps * sizeof(atlas->glyphs[0]));
853 if (!atlas->glyphs) {
854 /* give up */
855 atlas->incomplete = true;
856 return;
857 }
858
859 /* Loop over the display lists. They should all contain a single glBitmap
860 * call. If not, bail out. Also, compute the position and sizes of each
861 * bitmap in the atlas to determine the texture atlas size.
862 */
863 for (i = 0; i < atlas->numBitmaps; i++) {
864 const struct gl_display_list *list = _mesa_lookup_list(ctx, listBase + i);
865 const Node *n;
866 struct gl_bitmap_glyph *g = &atlas->glyphs[i];
867 unsigned bitmap_width, bitmap_height;
868 float bitmap_xmove, bitmap_ymove, bitmap_xorig, bitmap_yorig;
869
870 if (!list || is_empty_list(list)) {
871 /* stop here */
872 atlas->numBitmaps = i;
873 break;
874 }
875
876 if (!is_bitmap_list(list)) {
877 /* This list does not contain exactly one glBitmap command. Give up. */
878 atlas->incomplete = true;
879 return;
880 }
881
882 /* get bitmap info from the display list command */
883 n = list->Head;
884 assert(n[0].opcode == OPCODE_BITMAP);
885 bitmap_width = n[1].i;
886 bitmap_height = n[2].i;
887 bitmap_xorig = n[3].f;
888 bitmap_yorig = n[4].f;
889 bitmap_xmove = n[5].f;
890 bitmap_ymove = n[6].f;
891
892 if (xpos + bitmap_width > atlas->texWidth) {
893 /* advance to the next row of the texture */
894 xpos = 0;
895 ypos += row_height;
896 row_height = 0;
897 }
898
899 /* save the bitmap's position in the atlas */
900 g->x = xpos;
901 g->y = ypos;
902 g->w = bitmap_width;
903 g->h = bitmap_height;
904 g->xorig = bitmap_xorig;
905 g->yorig = bitmap_yorig;
906 g->xmove = bitmap_xmove;
907 g->ymove = bitmap_ymove;
908
909 xpos += bitmap_width;
910
911 /* keep track of tallest bitmap in the row */
912 row_height = MAX2(row_height, bitmap_height);
913 }
914
915 /* Now we know the texture height */
916 atlas->texHeight = ypos + row_height;
917
918 if (atlas->texHeight == 0) {
919 /* no glyphs found, give up */
920 goto fail;
921 }
922 else if (atlas->texHeight > ctx->Const.MaxTextureRectSize) {
923 /* too large, give up */
924 goto fail;
925 }
926
927 /* Create atlas texture (texture ID is irrelevant) */
928 atlas->texObj = ctx->Driver.NewTextureObject(ctx, 999, GL_TEXTURE_RECTANGLE);
929 if (!atlas->texObj) {
930 goto out_of_memory;
931 }
932
933 atlas->texObj->Sampler.MinFilter = GL_NEAREST;
934 atlas->texObj->Sampler.MagFilter = GL_NEAREST;
935 atlas->texObj->MaxLevel = 0;
936 atlas->texObj->Immutable = GL_TRUE;
937
938 atlas->texImage = _mesa_get_tex_image(ctx, atlas->texObj,
939 GL_TEXTURE_RECTANGLE, 0);
940 if (!atlas->texImage) {
941 goto out_of_memory;
942 }
943
944 if (ctx->Const.BitmapUsesRed)
945 _mesa_init_teximage_fields(ctx, atlas->texImage,
946 atlas->texWidth, atlas->texHeight, 1, 0,
947 GL_RED, MESA_FORMAT_R_UNORM8);
948 else
949 _mesa_init_teximage_fields(ctx, atlas->texImage,
950 atlas->texWidth, atlas->texHeight, 1, 0,
951 GL_ALPHA, MESA_FORMAT_A_UNORM8);
952
953 /* alloc image storage */
954 if (!ctx->Driver.AllocTextureImageBuffer(ctx, atlas->texImage)) {
955 goto out_of_memory;
956 }
957
958 /* map teximage, load with bitmap glyphs */
959 ctx->Driver.MapTextureImage(ctx, atlas->texImage, 0,
960 0, 0, atlas->texWidth, atlas->texHeight,
961 GL_MAP_WRITE_BIT, &map, &map_stride);
962 if (!map) {
963 goto out_of_memory;
964 }
965
966 /* Background/clear pixels are 0xff, foreground/set pixels are 0x0 */
967 memset(map, 0xff, map_stride * atlas->texHeight);
968
969 for (i = 0; i < atlas->numBitmaps; i++) {
970 const struct gl_display_list *list = _mesa_lookup_list(ctx, listBase + i);
971 const Node *n = list->Head;
972
973 assert(n[0].opcode == OPCODE_BITMAP ||
974 n[0].opcode == OPCODE_END_OF_LIST);
975
976 if (n[0].opcode == OPCODE_BITMAP) {
977 unsigned bitmap_width = n[1].i;
978 unsigned bitmap_height = n[2].i;
979 unsigned xpos = atlas->glyphs[i].x;
980 unsigned ypos = atlas->glyphs[i].y;
981 const void *bitmap_image = get_pointer(&n[7]);
982
983 assert(atlas->glyphs[i].w == bitmap_width);
984 assert(atlas->glyphs[i].h == bitmap_height);
985
986 /* put the bitmap image into the texture image */
987 _mesa_expand_bitmap(bitmap_width, bitmap_height,
988 &ctx->DefaultPacking, bitmap_image,
989 map + map_stride * ypos + xpos, /* dest addr */
990 map_stride, 0x0);
991 }
992 }
993
994 ctx->Driver.UnmapTextureImage(ctx, atlas->texImage, 0);
995
996 atlas->complete = true;
997
998 return;
999
1000 out_of_memory:
1001 _mesa_error(ctx, GL_OUT_OF_MEMORY, "Display list bitmap atlas");
1002 fail:
1003 if (atlas->texObj) {
1004 ctx->Driver.DeleteTexture(ctx, atlas->texObj);
1005 }
1006 free(atlas->glyphs);
1007 atlas->glyphs = NULL;
1008 atlas->incomplete = true;
1009 }
1010
1011
1012 /**
1013 * Allocate a gl_display_list object with an initial block of storage.
1014 * \param count how many display list nodes/tokens to allocate
1015 */
1016 static struct gl_display_list *
1017 make_list(GLuint name, GLuint count)
1018 {
1019 struct gl_display_list *dlist = CALLOC_STRUCT(gl_display_list);
1020 dlist->Name = name;
1021 dlist->Head = malloc(sizeof(Node) * count);
1022 dlist->Head[0].opcode = OPCODE_END_OF_LIST;
1023 /* All InstSize[] entries must be non-zero */
1024 InstSize[OPCODE_END_OF_LIST] = 1;
1025 return dlist;
1026 }
1027
1028
1029 /**
1030 * Lookup function to just encapsulate casting.
1031 */
1032 struct gl_display_list *
1033 _mesa_lookup_list(struct gl_context *ctx, GLuint list)
1034 {
1035 return (struct gl_display_list *)
1036 _mesa_HashLookup(ctx->Shared->DisplayList, list);
1037 }
1038
1039
1040 /** Is the given opcode an extension code? */
1041 static inline GLboolean
1042 is_ext_opcode(OpCode opcode)
1043 {
1044 return (opcode >= OPCODE_EXT_0);
1045 }
1046
1047
1048 /** Destroy an extended opcode instruction */
1049 static GLint
1050 ext_opcode_destroy(struct gl_context *ctx, Node *node)
1051 {
1052 const GLint i = node[0].opcode - OPCODE_EXT_0;
1053 GLint step;
1054 ctx->ListExt->Opcode[i].Destroy(ctx, &node[1]);
1055 step = ctx->ListExt->Opcode[i].Size;
1056 return step;
1057 }
1058
1059
1060 /** Execute an extended opcode instruction */
1061 static GLint
1062 ext_opcode_execute(struct gl_context *ctx, Node *node)
1063 {
1064 const GLint i = node[0].opcode - OPCODE_EXT_0;
1065 GLint step;
1066 ctx->ListExt->Opcode[i].Execute(ctx, &node[1]);
1067 step = ctx->ListExt->Opcode[i].Size;
1068 return step;
1069 }
1070
1071
1072 /** Print an extended opcode instruction */
1073 static GLint
1074 ext_opcode_print(struct gl_context *ctx, Node *node, FILE *f)
1075 {
1076 const GLint i = node[0].opcode - OPCODE_EXT_0;
1077 GLint step;
1078 ctx->ListExt->Opcode[i].Print(ctx, &node[1], f);
1079 step = ctx->ListExt->Opcode[i].Size;
1080 return step;
1081 }
1082
1083
1084 /**
1085 * Delete the named display list, but don't remove from hash table.
1086 * \param dlist - display list pointer
1087 */
1088 void
1089 _mesa_delete_list(struct gl_context *ctx, struct gl_display_list *dlist)
1090 {
1091 Node *n, *block;
1092 GLboolean done;
1093
1094 n = block = dlist->Head;
1095
1096 done = block ? GL_FALSE : GL_TRUE;
1097 while (!done) {
1098 const OpCode opcode = n[0].opcode;
1099
1100 /* check for extension opcodes first */
1101 if (is_ext_opcode(opcode)) {
1102 n += ext_opcode_destroy(ctx, n);
1103 }
1104 else {
1105 switch (opcode) {
1106 /* for some commands, we need to free malloc'd memory */
1107 case OPCODE_MAP1:
1108 free(get_pointer(&n[6]));
1109 break;
1110 case OPCODE_MAP2:
1111 free(get_pointer(&n[10]));
1112 break;
1113 case OPCODE_CALL_LISTS:
1114 free(get_pointer(&n[3]));
1115 break;
1116 case OPCODE_DRAW_PIXELS:
1117 free(get_pointer(&n[5]));
1118 break;
1119 case OPCODE_BITMAP:
1120 free(get_pointer(&n[7]));
1121 break;
1122 case OPCODE_POLYGON_STIPPLE:
1123 free(get_pointer(&n[1]));
1124 break;
1125 case OPCODE_TEX_IMAGE1D:
1126 free(get_pointer(&n[8]));
1127 break;
1128 case OPCODE_TEX_IMAGE2D:
1129 free(get_pointer(&n[9]));
1130 break;
1131 case OPCODE_TEX_IMAGE3D:
1132 free(get_pointer(&n[10]));
1133 break;
1134 case OPCODE_TEX_SUB_IMAGE1D:
1135 free(get_pointer(&n[7]));
1136 break;
1137 case OPCODE_TEX_SUB_IMAGE2D:
1138 free(get_pointer(&n[9]));
1139 break;
1140 case OPCODE_TEX_SUB_IMAGE3D:
1141 free(get_pointer(&n[11]));
1142 break;
1143 case OPCODE_COMPRESSED_TEX_IMAGE_1D:
1144 free(get_pointer(&n[7]));
1145 break;
1146 case OPCODE_COMPRESSED_TEX_IMAGE_2D:
1147 free(get_pointer(&n[8]));
1148 break;
1149 case OPCODE_COMPRESSED_TEX_IMAGE_3D:
1150 free(get_pointer(&n[9]));
1151 break;
1152 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D:
1153 free(get_pointer(&n[7]));
1154 break;
1155 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D:
1156 free(get_pointer(&n[9]));
1157 break;
1158 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D:
1159 free(get_pointer(&n[11]));
1160 break;
1161 case OPCODE_PROGRAM_STRING_ARB:
1162 free(get_pointer(&n[4])); /* program string */
1163 break;
1164 case OPCODE_UNIFORM_1FV:
1165 case OPCODE_UNIFORM_2FV:
1166 case OPCODE_UNIFORM_3FV:
1167 case OPCODE_UNIFORM_4FV:
1168 case OPCODE_UNIFORM_1DV:
1169 case OPCODE_UNIFORM_2DV:
1170 case OPCODE_UNIFORM_3DV:
1171 case OPCODE_UNIFORM_4DV:
1172 case OPCODE_UNIFORM_1IV:
1173 case OPCODE_UNIFORM_2IV:
1174 case OPCODE_UNIFORM_3IV:
1175 case OPCODE_UNIFORM_4IV:
1176 case OPCODE_UNIFORM_1UIV:
1177 case OPCODE_UNIFORM_2UIV:
1178 case OPCODE_UNIFORM_3UIV:
1179 case OPCODE_UNIFORM_4UIV:
1180 free(get_pointer(&n[3]));
1181 break;
1182 case OPCODE_UNIFORM_MATRIX22:
1183 case OPCODE_UNIFORM_MATRIX33:
1184 case OPCODE_UNIFORM_MATRIX44:
1185 case OPCODE_UNIFORM_MATRIX24:
1186 case OPCODE_UNIFORM_MATRIX42:
1187 case OPCODE_UNIFORM_MATRIX23:
1188 case OPCODE_UNIFORM_MATRIX32:
1189 case OPCODE_UNIFORM_MATRIX34:
1190 case OPCODE_UNIFORM_MATRIX43:
1191 case OPCODE_UNIFORM_MATRIX22D:
1192 case OPCODE_UNIFORM_MATRIX33D:
1193 case OPCODE_UNIFORM_MATRIX44D:
1194 case OPCODE_UNIFORM_MATRIX24D:
1195 case OPCODE_UNIFORM_MATRIX42D:
1196 case OPCODE_UNIFORM_MATRIX23D:
1197 case OPCODE_UNIFORM_MATRIX32D:
1198 case OPCODE_UNIFORM_MATRIX34D:
1199 case OPCODE_UNIFORM_MATRIX43D:
1200 free(get_pointer(&n[4]));
1201 break;
1202 case OPCODE_PROGRAM_UNIFORM_1FV:
1203 case OPCODE_PROGRAM_UNIFORM_2FV:
1204 case OPCODE_PROGRAM_UNIFORM_3FV:
1205 case OPCODE_PROGRAM_UNIFORM_4FV:
1206 case OPCODE_PROGRAM_UNIFORM_1DV:
1207 case OPCODE_PROGRAM_UNIFORM_2DV:
1208 case OPCODE_PROGRAM_UNIFORM_3DV:
1209 case OPCODE_PROGRAM_UNIFORM_4DV:
1210 case OPCODE_PROGRAM_UNIFORM_1IV:
1211 case OPCODE_PROGRAM_UNIFORM_2IV:
1212 case OPCODE_PROGRAM_UNIFORM_3IV:
1213 case OPCODE_PROGRAM_UNIFORM_4IV:
1214 case OPCODE_PROGRAM_UNIFORM_1UIV:
1215 case OPCODE_PROGRAM_UNIFORM_2UIV:
1216 case OPCODE_PROGRAM_UNIFORM_3UIV:
1217 case OPCODE_PROGRAM_UNIFORM_4UIV:
1218 free(get_pointer(&n[4]));
1219 break;
1220 case OPCODE_PROGRAM_UNIFORM_MATRIX22F:
1221 case OPCODE_PROGRAM_UNIFORM_MATRIX33F:
1222 case OPCODE_PROGRAM_UNIFORM_MATRIX44F:
1223 case OPCODE_PROGRAM_UNIFORM_MATRIX24F:
1224 case OPCODE_PROGRAM_UNIFORM_MATRIX42F:
1225 case OPCODE_PROGRAM_UNIFORM_MATRIX23F:
1226 case OPCODE_PROGRAM_UNIFORM_MATRIX32F:
1227 case OPCODE_PROGRAM_UNIFORM_MATRIX34F:
1228 case OPCODE_PROGRAM_UNIFORM_MATRIX43F:
1229 case OPCODE_PROGRAM_UNIFORM_MATRIX22D:
1230 case OPCODE_PROGRAM_UNIFORM_MATRIX33D:
1231 case OPCODE_PROGRAM_UNIFORM_MATRIX44D:
1232 case OPCODE_PROGRAM_UNIFORM_MATRIX24D:
1233 case OPCODE_PROGRAM_UNIFORM_MATRIX42D:
1234 case OPCODE_PROGRAM_UNIFORM_MATRIX23D:
1235 case OPCODE_PROGRAM_UNIFORM_MATRIX32D:
1236 case OPCODE_PROGRAM_UNIFORM_MATRIX34D:
1237 case OPCODE_PROGRAM_UNIFORM_MATRIX43D:
1238 free(get_pointer(&n[5]));
1239 break;
1240 case OPCODE_PIXEL_MAP:
1241 free(get_pointer(&n[3]));
1242 break;
1243 case OPCODE_VIEWPORT_ARRAY_V:
1244 case OPCODE_SCISSOR_ARRAY_V:
1245 case OPCODE_DEPTH_ARRAY_V:
1246 case OPCODE_UNIFORM_SUBROUTINES:
1247 case OPCODE_WINDOW_RECTANGLES:
1248 free(get_pointer(&n[3]));
1249 break;
1250 case OPCODE_TEXTURE_IMAGE1D:
1251 case OPCODE_MULTITEX_IMAGE1D:
1252 free(get_pointer(&n[9]));
1253 break;
1254 case OPCODE_TEXTURE_IMAGE2D:
1255 case OPCODE_MULTITEX_IMAGE2D:
1256 free(get_pointer(&n[10]));
1257 break;
1258 case OPCODE_TEXTURE_IMAGE3D:
1259 case OPCODE_MULTITEX_IMAGE3D:
1260 free(get_pointer(&n[11]));
1261 break;
1262 case OPCODE_TEXTURE_SUB_IMAGE1D:
1263 case OPCODE_MULTITEX_SUB_IMAGE1D:
1264 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_1D:
1265 case OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_1D:
1266 free(get_pointer(&n[8]));
1267 break;
1268 case OPCODE_TEXTURE_SUB_IMAGE2D:
1269 case OPCODE_MULTITEX_SUB_IMAGE2D:
1270 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_2D:
1271 case OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_2D:
1272 free(get_pointer(&n[10]));
1273 break;
1274 case OPCODE_TEXTURE_SUB_IMAGE3D:
1275 case OPCODE_MULTITEX_SUB_IMAGE3D:
1276 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_3D:
1277 case OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_3D:
1278 free(get_pointer(&n[12]));
1279 break;
1280 case OPCODE_COMPRESSED_TEXTURE_IMAGE_1D:
1281 case OPCODE_COMPRESSED_MULTITEX_IMAGE_1D:
1282 free(get_pointer(&n[8]));
1283 break;
1284 case OPCODE_COMPRESSED_TEXTURE_IMAGE_2D:
1285 case OPCODE_COMPRESSED_MULTITEX_IMAGE_2D:
1286 free(get_pointer(&n[9]));
1287 break;
1288 case OPCODE_COMPRESSED_TEXTURE_IMAGE_3D:
1289 case OPCODE_COMPRESSED_MULTITEX_IMAGE_3D:
1290 free(get_pointer(&n[10]));
1291 break;
1292
1293 case OPCODE_CONTINUE:
1294 n = (Node *) get_pointer(&n[1]);
1295 free(block);
1296 block = n;
1297 break;
1298 case OPCODE_END_OF_LIST:
1299 free(block);
1300 done = GL_TRUE;
1301 break;
1302 default:
1303 /* just increment 'n' pointer, below */
1304 ;
1305 }
1306
1307 if (opcode != OPCODE_CONTINUE) {
1308 assert(InstSize[opcode] > 0);
1309 n += InstSize[opcode];
1310 }
1311 }
1312 }
1313
1314 free(dlist->Label);
1315 free(dlist);
1316 }
1317
1318
1319 /**
1320 * Called by _mesa_HashWalk() to check if a display list which is being
1321 * deleted belongs to a bitmap texture atlas.
1322 */
1323 static void
1324 check_atlas_for_deleted_list(GLuint atlas_id, void *data, void *userData)
1325 {
1326 struct gl_bitmap_atlas *atlas = (struct gl_bitmap_atlas *) data;
1327 GLuint list_id = *((GLuint *) userData); /* the list being deleted */
1328
1329 /* See if the list_id falls in the range contained in this texture atlas */
1330 if (atlas->complete &&
1331 list_id >= atlas_id &&
1332 list_id < atlas_id + atlas->numBitmaps) {
1333 /* Mark the atlas as incomplete so it doesn't get used. But don't
1334 * delete it yet since we don't want to try to recreate it in the next
1335 * glCallLists.
1336 */
1337 atlas->complete = false;
1338 atlas->incomplete = true;
1339 }
1340 }
1341
1342
1343 /**
1344 * Destroy a display list and remove from hash table.
1345 * \param list - display list number
1346 */
1347 static void
1348 destroy_list(struct gl_context *ctx, GLuint list)
1349 {
1350 struct gl_display_list *dlist;
1351
1352 if (list == 0)
1353 return;
1354
1355 dlist = _mesa_lookup_list(ctx, list);
1356 if (!dlist)
1357 return;
1358
1359 if (is_bitmap_list(dlist)) {
1360 /* If we're destroying a simple glBitmap display list, there's a
1361 * chance that we're destroying a bitmap image that's in a texture
1362 * atlas. Examine all atlases to see if that's the case. There's
1363 * usually few (if any) atlases so this isn't expensive.
1364 */
1365 _mesa_HashWalk(ctx->Shared->BitmapAtlas,
1366 check_atlas_for_deleted_list, &list);
1367 }
1368
1369 _mesa_delete_list(ctx, dlist);
1370 _mesa_HashRemove(ctx->Shared->DisplayList, list);
1371 }
1372
1373
1374 /*
1375 * Translate the nth element of list from <type> to GLint.
1376 */
1377 static GLint
1378 translate_id(GLsizei n, GLenum type, const GLvoid * list)
1379 {
1380 GLbyte *bptr;
1381 GLubyte *ubptr;
1382 GLshort *sptr;
1383 GLushort *usptr;
1384 GLint *iptr;
1385 GLuint *uiptr;
1386 GLfloat *fptr;
1387
1388 switch (type) {
1389 case GL_BYTE:
1390 bptr = (GLbyte *) list;
1391 return (GLint) bptr[n];
1392 case GL_UNSIGNED_BYTE:
1393 ubptr = (GLubyte *) list;
1394 return (GLint) ubptr[n];
1395 case GL_SHORT:
1396 sptr = (GLshort *) list;
1397 return (GLint) sptr[n];
1398 case GL_UNSIGNED_SHORT:
1399 usptr = (GLushort *) list;
1400 return (GLint) usptr[n];
1401 case GL_INT:
1402 iptr = (GLint *) list;
1403 return iptr[n];
1404 case GL_UNSIGNED_INT:
1405 uiptr = (GLuint *) list;
1406 return (GLint) uiptr[n];
1407 case GL_FLOAT:
1408 fptr = (GLfloat *) list;
1409 return (GLint) floorf(fptr[n]);
1410 case GL_2_BYTES:
1411 ubptr = ((GLubyte *) list) + 2 * n;
1412 return (GLint) ubptr[0] * 256
1413 + (GLint) ubptr[1];
1414 case GL_3_BYTES:
1415 ubptr = ((GLubyte *) list) + 3 * n;
1416 return (GLint) ubptr[0] * 65536
1417 + (GLint) ubptr[1] * 256
1418 + (GLint) ubptr[2];
1419 case GL_4_BYTES:
1420 ubptr = ((GLubyte *) list) + 4 * n;
1421 return (GLint) ubptr[0] * 16777216
1422 + (GLint) ubptr[1] * 65536
1423 + (GLint) ubptr[2] * 256
1424 + (GLint) ubptr[3];
1425 default:
1426 return 0;
1427 }
1428 }
1429
1430
1431 /**
1432 * Wrapper for _mesa_unpack_image/bitmap() that handles pixel buffer objects.
1433 * If width < 0 or height < 0 or format or type are invalid we'll just
1434 * return NULL. We will not generate an error since OpenGL command
1435 * arguments aren't error-checked until the command is actually executed
1436 * (not when they're compiled).
1437 * But if we run out of memory, GL_OUT_OF_MEMORY will be recorded.
1438 */
1439 static GLvoid *
1440 unpack_image(struct gl_context *ctx, GLuint dimensions,
1441 GLsizei width, GLsizei height, GLsizei depth,
1442 GLenum format, GLenum type, const GLvoid * pixels,
1443 const struct gl_pixelstore_attrib *unpack)
1444 {
1445 if (width <= 0 || height <= 0) {
1446 return NULL;
1447 }
1448
1449 if (_mesa_bytes_per_pixel(format, type) < 0) {
1450 /* bad format and/or type */
1451 return NULL;
1452 }
1453
1454 if (!_mesa_is_bufferobj(unpack->BufferObj)) {
1455 /* no PBO */
1456 GLvoid *image;
1457
1458 image = _mesa_unpack_image(dimensions, width, height, depth,
1459 format, type, pixels, unpack);
1460 if (pixels && !image) {
1461 _mesa_error(ctx, GL_OUT_OF_MEMORY, "display list construction");
1462 }
1463 return image;
1464 }
1465 else if (_mesa_validate_pbo_access(dimensions, unpack, width, height,
1466 depth, format, type, INT_MAX, pixels)) {
1467 const GLubyte *map, *src;
1468 GLvoid *image;
1469
1470 map = (GLubyte *)
1471 ctx->Driver.MapBufferRange(ctx, 0, unpack->BufferObj->Size,
1472 GL_MAP_READ_BIT, unpack->BufferObj,
1473 MAP_INTERNAL);
1474 if (!map) {
1475 /* unable to map src buffer! */
1476 _mesa_error(ctx, GL_INVALID_OPERATION, "unable to map PBO");
1477 return NULL;
1478 }
1479
1480 src = ADD_POINTERS(map, pixels);
1481 image = _mesa_unpack_image(dimensions, width, height, depth,
1482 format, type, src, unpack);
1483
1484 ctx->Driver.UnmapBuffer(ctx, unpack->BufferObj, MAP_INTERNAL);
1485
1486 if (!image) {
1487 _mesa_error(ctx, GL_OUT_OF_MEMORY, "display list construction");
1488 }
1489 return image;
1490 }
1491
1492 /* bad access! */
1493 _mesa_error(ctx, GL_INVALID_OPERATION, "invalid PBO access");
1494 return NULL;
1495 }
1496
1497
1498 /** Return copy of memory */
1499 static void *
1500 memdup(const void *src, GLsizei bytes)
1501 {
1502 void *b = bytes >= 0 ? malloc(bytes) : NULL;
1503 if (b)
1504 memcpy(b, src, bytes);
1505 return b;
1506 }
1507
1508
1509 /**
1510 * Allocate space for a display list instruction (opcode + payload space).
1511 * \param opcode the instruction opcode (OPCODE_* value)
1512 * \param bytes instruction payload size (not counting opcode)
1513 * \param align8 does the payload need to be 8-byte aligned?
1514 * This is only relevant in 64-bit environments.
1515 * \return pointer to allocated memory (the payload will be at pointer+1)
1516 */
1517 static Node *
1518 dlist_alloc(struct gl_context *ctx, OpCode opcode, GLuint bytes, bool align8)
1519 {
1520 const GLuint numNodes = 1 + (bytes + sizeof(Node) - 1) / sizeof(Node);
1521 const GLuint contNodes = 1 + POINTER_DWORDS; /* size of continue info */
1522 GLuint nopNode;
1523 Node *n;
1524
1525 assert(bytes <= BLOCK_SIZE * sizeof(Node));
1526
1527 if (opcode < OPCODE_EXT_0) {
1528 if (InstSize[opcode] == 0) {
1529 /* save instruction size now */
1530 InstSize[opcode] = numNodes;
1531 }
1532 else {
1533 /* make sure instruction size agrees */
1534 assert(numNodes == InstSize[opcode]);
1535 }
1536 }
1537
1538 if (sizeof(void *) > sizeof(Node) && align8
1539 && ctx->ListState.CurrentPos % 2 == 0) {
1540 /* The opcode would get placed at node[0] and the payload would start
1541 * at node[1]. But the payload needs to be at an even offset (8-byte
1542 * multiple).
1543 */
1544 nopNode = 1;
1545 }
1546 else {
1547 nopNode = 0;
1548 }
1549
1550 if (ctx->ListState.CurrentPos + nopNode + numNodes + contNodes
1551 > BLOCK_SIZE) {
1552 /* This block is full. Allocate a new block and chain to it */
1553 Node *newblock;
1554 n = ctx->ListState.CurrentBlock + ctx->ListState.CurrentPos;
1555 n[0].opcode = OPCODE_CONTINUE;
1556 newblock = malloc(sizeof(Node) * BLOCK_SIZE);
1557 if (!newblock) {
1558 _mesa_error(ctx, GL_OUT_OF_MEMORY, "Building display list");
1559 return NULL;
1560 }
1561
1562 /* a fresh block should be 8-byte aligned on 64-bit systems */
1563 assert(((GLintptr) newblock) % sizeof(void *) == 0);
1564
1565 save_pointer(&n[1], newblock);
1566 ctx->ListState.CurrentBlock = newblock;
1567 ctx->ListState.CurrentPos = 0;
1568
1569 /* Display list nodes are always 4 bytes. If we need 8-byte alignment
1570 * we have to insert a NOP so that the payload of the real opcode lands
1571 * on an even location:
1572 * node[0] = OPCODE_NOP
1573 * node[1] = OPCODE_x;
1574 * node[2] = start of payload
1575 */
1576 nopNode = sizeof(void *) > sizeof(Node) && align8;
1577 }
1578
1579 n = ctx->ListState.CurrentBlock + ctx->ListState.CurrentPos;
1580 if (nopNode) {
1581 assert(ctx->ListState.CurrentPos % 2 == 0); /* even value */
1582 n[0].opcode = OPCODE_NOP;
1583 n++;
1584 /* The "real" opcode will now be at an odd location and the payload
1585 * will be at an even location.
1586 */
1587 }
1588 ctx->ListState.CurrentPos += nopNode + numNodes;
1589
1590 n[0].opcode = opcode;
1591
1592 return n;
1593 }
1594
1595
1596
1597 /**
1598 * Allocate space for a display list instruction. Used by callers outside
1599 * this file for things like VBO vertex data.
1600 *
1601 * \param opcode the instruction opcode (OPCODE_* value)
1602 * \param bytes instruction size in bytes, not counting opcode.
1603 * \return pointer to the usable data area (not including the internal
1604 * opcode).
1605 */
1606 void *
1607 _mesa_dlist_alloc(struct gl_context *ctx, GLuint opcode, GLuint bytes)
1608 {
1609 Node *n = dlist_alloc(ctx, (OpCode) opcode, bytes, false);
1610 if (n)
1611 return n + 1; /* return pointer to payload area, after opcode */
1612 else
1613 return NULL;
1614 }
1615
1616
1617 /**
1618 * Same as _mesa_dlist_alloc(), but return a pointer which is 8-byte
1619 * aligned in 64-bit environments, 4-byte aligned otherwise.
1620 */
1621 void *
1622 _mesa_dlist_alloc_aligned(struct gl_context *ctx, GLuint opcode, GLuint bytes)
1623 {
1624 Node *n = dlist_alloc(ctx, (OpCode) opcode, bytes, true);
1625 if (n)
1626 return n + 1; /* return pointer to payload area, after opcode */
1627 else
1628 return NULL;
1629 }
1630
1631
1632 /**
1633 * This function allows modules and drivers to get their own opcodes
1634 * for extending display list functionality.
1635 * \param ctx the rendering context
1636 * \param size number of bytes for storing the new display list command
1637 * \param execute function to execute the new display list command
1638 * \param destroy function to destroy the new display list command
1639 * \param print function to print the new display list command
1640 * \return the new opcode number or -1 if error
1641 */
1642 GLint
1643 _mesa_dlist_alloc_opcode(struct gl_context *ctx,
1644 GLuint size,
1645 void (*execute) (struct gl_context *, void *),
1646 void (*destroy) (struct gl_context *, void *),
1647 void (*print) (struct gl_context *, void *, FILE *))
1648 {
1649 if (ctx->ListExt->NumOpcodes < MAX_DLIST_EXT_OPCODES) {
1650 const GLuint i = ctx->ListExt->NumOpcodes++;
1651 ctx->ListExt->Opcode[i].Size =
1652 1 + (size + sizeof(Node) - 1) / sizeof(Node);
1653 ctx->ListExt->Opcode[i].Execute = execute;
1654 ctx->ListExt->Opcode[i].Destroy = destroy;
1655 ctx->ListExt->Opcode[i].Print = print;
1656 return i + OPCODE_EXT_0;
1657 }
1658 return -1;
1659 }
1660
1661
1662 /**
1663 * Allocate space for a display list instruction. The space is basically
1664 * an array of Nodes where node[0] holds the opcode, node[1] is the first
1665 * function parameter, node[2] is the second parameter, etc.
1666 *
1667 * \param opcode one of OPCODE_x
1668 * \param nparams number of function parameters
1669 * \return pointer to start of instruction space
1670 */
1671 static inline Node *
1672 alloc_instruction(struct gl_context *ctx, OpCode opcode, GLuint nparams)
1673 {
1674 return dlist_alloc(ctx, opcode, nparams * sizeof(Node), false);
1675 }
1676
1677
1678 /**
1679 * Called by EndList to try to reduce memory used for the list.
1680 */
1681 static void
1682 trim_list(struct gl_context *ctx)
1683 {
1684 /* If the list we're ending only has one allocated block of nodes/tokens
1685 * and its size isn't a full block size, realloc the block to use less
1686 * memory. This is important for apps that create many small display
1687 * lists and apps that use glXUseXFont (many lists each containing one
1688 * glBitmap call).
1689 * Note: we currently only trim display lists that allocated one block
1690 * of tokens. That hits the short list case which is what we're mainly
1691 * concerned with. Trimming longer lists would involve traversing the
1692 * linked list of blocks.
1693 */
1694 struct gl_dlist_state *list = &ctx->ListState;
1695
1696 if ((list->CurrentList->Head == list->CurrentBlock) &&
1697 (list->CurrentPos < BLOCK_SIZE)) {
1698 /* There's only one block and it's not full, so realloc */
1699 GLuint newSize = list->CurrentPos * sizeof(Node);
1700 list->CurrentList->Head =
1701 list->CurrentBlock = realloc(list->CurrentBlock, newSize);
1702 if (!list->CurrentBlock) {
1703 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glEndList");
1704 }
1705 }
1706 }
1707
1708
1709
1710 /*
1711 * Display List compilation functions
1712 */
1713 static void GLAPIENTRY
1714 save_Accum(GLenum op, GLfloat value)
1715 {
1716 GET_CURRENT_CONTEXT(ctx);
1717 Node *n;
1718 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1719 n = alloc_instruction(ctx, OPCODE_ACCUM, 2);
1720 if (n) {
1721 n[1].e = op;
1722 n[2].f = value;
1723 }
1724 if (ctx->ExecuteFlag) {
1725 CALL_Accum(ctx->Exec, (op, value));
1726 }
1727 }
1728
1729
1730 static void GLAPIENTRY
1731 save_AlphaFunc(GLenum func, GLclampf ref)
1732 {
1733 GET_CURRENT_CONTEXT(ctx);
1734 Node *n;
1735 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1736 n = alloc_instruction(ctx, OPCODE_ALPHA_FUNC, 2);
1737 if (n) {
1738 n[1].e = func;
1739 n[2].f = (GLfloat) ref;
1740 }
1741 if (ctx->ExecuteFlag) {
1742 CALL_AlphaFunc(ctx->Exec, (func, ref));
1743 }
1744 }
1745
1746
1747 static void GLAPIENTRY
1748 save_BindTexture(GLenum target, GLuint texture)
1749 {
1750 GET_CURRENT_CONTEXT(ctx);
1751 Node *n;
1752 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1753 n = alloc_instruction(ctx, OPCODE_BIND_TEXTURE, 2);
1754 if (n) {
1755 n[1].e = target;
1756 n[2].ui = texture;
1757 }
1758 if (ctx->ExecuteFlag) {
1759 CALL_BindTexture(ctx->Exec, (target, texture));
1760 }
1761 }
1762
1763
1764 static void GLAPIENTRY
1765 save_Bitmap(GLsizei width, GLsizei height,
1766 GLfloat xorig, GLfloat yorig,
1767 GLfloat xmove, GLfloat ymove, const GLubyte * pixels)
1768 {
1769 GET_CURRENT_CONTEXT(ctx);
1770 Node *n;
1771 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1772 n = alloc_instruction(ctx, OPCODE_BITMAP, 6 + POINTER_DWORDS);
1773 if (n) {
1774 n[1].i = (GLint) width;
1775 n[2].i = (GLint) height;
1776 n[3].f = xorig;
1777 n[4].f = yorig;
1778 n[5].f = xmove;
1779 n[6].f = ymove;
1780 save_pointer(&n[7],
1781 unpack_image(ctx, 2, width, height, 1, GL_COLOR_INDEX,
1782 GL_BITMAP, pixels, &ctx->Unpack));
1783 }
1784 if (ctx->ExecuteFlag) {
1785 CALL_Bitmap(ctx->Exec, (width, height,
1786 xorig, yorig, xmove, ymove, pixels));
1787 }
1788 }
1789
1790
1791 static void GLAPIENTRY
1792 save_BlendEquation(GLenum mode)
1793 {
1794 GET_CURRENT_CONTEXT(ctx);
1795 Node *n;
1796 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1797 n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION, 1);
1798 if (n) {
1799 n[1].e = mode;
1800 }
1801 if (ctx->ExecuteFlag) {
1802 CALL_BlendEquation(ctx->Exec, (mode));
1803 }
1804 }
1805
1806
1807 static void GLAPIENTRY
1808 save_BlendEquationSeparateEXT(GLenum modeRGB, GLenum modeA)
1809 {
1810 GET_CURRENT_CONTEXT(ctx);
1811 Node *n;
1812 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1813 n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION_SEPARATE, 2);
1814 if (n) {
1815 n[1].e = modeRGB;
1816 n[2].e = modeA;
1817 }
1818 if (ctx->ExecuteFlag) {
1819 CALL_BlendEquationSeparate(ctx->Exec, (modeRGB, modeA));
1820 }
1821 }
1822
1823
1824 static void GLAPIENTRY
1825 save_BlendFuncSeparateEXT(GLenum sfactorRGB, GLenum dfactorRGB,
1826 GLenum sfactorA, GLenum dfactorA)
1827 {
1828 GET_CURRENT_CONTEXT(ctx);
1829 Node *n;
1830 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1831 n = alloc_instruction(ctx, OPCODE_BLEND_FUNC_SEPARATE, 4);
1832 if (n) {
1833 n[1].e = sfactorRGB;
1834 n[2].e = dfactorRGB;
1835 n[3].e = sfactorA;
1836 n[4].e = dfactorA;
1837 }
1838 if (ctx->ExecuteFlag) {
1839 CALL_BlendFuncSeparate(ctx->Exec,
1840 (sfactorRGB, dfactorRGB, sfactorA, dfactorA));
1841 }
1842 }
1843
1844
1845 static void GLAPIENTRY
1846 save_BlendFunc(GLenum srcfactor, GLenum dstfactor)
1847 {
1848 save_BlendFuncSeparateEXT(srcfactor, dstfactor, srcfactor, dstfactor);
1849 }
1850
1851
1852 static void GLAPIENTRY
1853 save_BlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
1854 {
1855 GET_CURRENT_CONTEXT(ctx);
1856 Node *n;
1857 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1858 n = alloc_instruction(ctx, OPCODE_BLEND_COLOR, 4);
1859 if (n) {
1860 n[1].f = red;
1861 n[2].f = green;
1862 n[3].f = blue;
1863 n[4].f = alpha;
1864 }
1865 if (ctx->ExecuteFlag) {
1866 CALL_BlendColor(ctx->Exec, (red, green, blue, alpha));
1867 }
1868 }
1869
1870 /* GL_ARB_draw_buffers_blend */
1871 static void GLAPIENTRY
1872 save_BlendFuncSeparatei(GLuint buf, GLenum sfactorRGB, GLenum dfactorRGB,
1873 GLenum sfactorA, GLenum dfactorA)
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_FUNC_SEPARATE_I, 5);
1879 if (n) {
1880 n[1].ui = buf;
1881 n[2].e = sfactorRGB;
1882 n[3].e = dfactorRGB;
1883 n[4].e = sfactorA;
1884 n[5].e = dfactorA;
1885 }
1886 if (ctx->ExecuteFlag) {
1887 CALL_BlendFuncSeparateiARB(ctx->Exec, (buf, sfactorRGB, dfactorRGB,
1888 sfactorA, dfactorA));
1889 }
1890 }
1891
1892 /* GL_ARB_draw_buffers_blend */
1893 static void GLAPIENTRY
1894 save_BlendFunci(GLuint buf, GLenum sfactor, GLenum dfactor)
1895 {
1896 GET_CURRENT_CONTEXT(ctx);
1897 Node *n;
1898 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1899 n = alloc_instruction(ctx, OPCODE_BLEND_FUNC_I, 3);
1900 if (n) {
1901 n[1].ui = buf;
1902 n[2].e = sfactor;
1903 n[3].e = dfactor;
1904 }
1905 if (ctx->ExecuteFlag) {
1906 CALL_BlendFunciARB(ctx->Exec, (buf, sfactor, dfactor));
1907 }
1908 }
1909
1910 /* GL_ARB_draw_buffers_blend */
1911 static void GLAPIENTRY
1912 save_BlendEquationi(GLuint buf, GLenum mode)
1913 {
1914 GET_CURRENT_CONTEXT(ctx);
1915 Node *n;
1916 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1917 n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION_I, 2);
1918 if (n) {
1919 n[1].ui = buf;
1920 n[2].e = mode;
1921 }
1922 if (ctx->ExecuteFlag) {
1923 CALL_BlendEquationiARB(ctx->Exec, (buf, mode));
1924 }
1925 }
1926
1927 /* GL_ARB_draw_buffers_blend */
1928 static void GLAPIENTRY
1929 save_BlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeA)
1930 {
1931 GET_CURRENT_CONTEXT(ctx);
1932 Node *n;
1933 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1934 n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION_SEPARATE_I, 3);
1935 if (n) {
1936 n[1].ui = buf;
1937 n[2].e = modeRGB;
1938 n[3].e = modeA;
1939 }
1940 if (ctx->ExecuteFlag) {
1941 CALL_BlendEquationSeparateiARB(ctx->Exec, (buf, modeRGB, modeA));
1942 }
1943 }
1944
1945
1946 /* GL_ARB_draw_instanced. */
1947 static void GLAPIENTRY
1948 save_DrawArraysInstancedARB(UNUSED GLenum mode,
1949 UNUSED GLint first,
1950 UNUSED GLsizei count,
1951 UNUSED GLsizei primcount)
1952 {
1953 GET_CURRENT_CONTEXT(ctx);
1954 _mesa_error(ctx, GL_INVALID_OPERATION,
1955 "glDrawArraysInstanced() during display list compile");
1956 }
1957
1958 static void GLAPIENTRY
1959 save_DrawElementsInstancedARB(UNUSED GLenum mode,
1960 UNUSED GLsizei count,
1961 UNUSED GLenum type,
1962 UNUSED const GLvoid *indices,
1963 UNUSED GLsizei primcount)
1964 {
1965 GET_CURRENT_CONTEXT(ctx);
1966 _mesa_error(ctx, GL_INVALID_OPERATION,
1967 "glDrawElementsInstanced() during display list compile");
1968 }
1969
1970 static void GLAPIENTRY
1971 save_DrawElementsInstancedBaseVertexARB(UNUSED GLenum mode,
1972 UNUSED GLsizei count,
1973 UNUSED GLenum type,
1974 UNUSED const GLvoid *indices,
1975 UNUSED GLsizei primcount,
1976 UNUSED GLint basevertex)
1977 {
1978 GET_CURRENT_CONTEXT(ctx);
1979 _mesa_error(ctx, GL_INVALID_OPERATION,
1980 "glDrawElementsInstancedBaseVertex() during display list compile");
1981 }
1982
1983 /* GL_ARB_base_instance. */
1984 static void GLAPIENTRY
1985 save_DrawArraysInstancedBaseInstance(UNUSED GLenum mode,
1986 UNUSED GLint first,
1987 UNUSED GLsizei count,
1988 UNUSED GLsizei primcount,
1989 UNUSED GLuint baseinstance)
1990 {
1991 GET_CURRENT_CONTEXT(ctx);
1992 _mesa_error(ctx, GL_INVALID_OPERATION,
1993 "glDrawArraysInstancedBaseInstance() during display list compile");
1994 }
1995
1996 static void APIENTRY
1997 save_DrawElementsInstancedBaseInstance(UNUSED GLenum mode,
1998 UNUSED GLsizei count,
1999 UNUSED GLenum type,
2000 UNUSED const void *indices,
2001 UNUSED GLsizei primcount,
2002 UNUSED GLuint baseinstance)
2003 {
2004 GET_CURRENT_CONTEXT(ctx);
2005 _mesa_error(ctx, GL_INVALID_OPERATION,
2006 "glDrawElementsInstancedBaseInstance() during display list compile");
2007 }
2008
2009 static void APIENTRY
2010 save_DrawElementsInstancedBaseVertexBaseInstance(UNUSED GLenum mode,
2011 UNUSED GLsizei count,
2012 UNUSED GLenum type,
2013 UNUSED const void *indices,
2014 UNUSED GLsizei primcount,
2015 UNUSED GLint basevertex,
2016 UNUSED GLuint baseinstance)
2017 {
2018 GET_CURRENT_CONTEXT(ctx);
2019 _mesa_error(ctx, GL_INVALID_OPERATION,
2020 "glDrawElementsInstancedBaseVertexBaseInstance() during display list compile");
2021 }
2022
2023 static void APIENTRY
2024 save_DrawArraysIndirect(UNUSED GLenum mode,
2025 UNUSED const void *indirect)
2026 {
2027 GET_CURRENT_CONTEXT(ctx);
2028 _mesa_error(ctx, GL_INVALID_OPERATION,
2029 "glDrawArraysIndirect() during display list compile");
2030 }
2031
2032 static void APIENTRY
2033 save_DrawElementsIndirect(UNUSED GLenum mode,
2034 UNUSED GLenum type,
2035 UNUSED const void *indirect)
2036 {
2037 GET_CURRENT_CONTEXT(ctx);
2038 _mesa_error(ctx, GL_INVALID_OPERATION,
2039 "glDrawElementsIndirect() during display list compile");
2040 }
2041
2042 static void APIENTRY
2043 save_MultiDrawArraysIndirect(UNUSED GLenum mode,
2044 UNUSED const void *indirect,
2045 UNUSED GLsizei primcount,
2046 UNUSED GLsizei stride)
2047 {
2048 GET_CURRENT_CONTEXT(ctx);
2049 _mesa_error(ctx, GL_INVALID_OPERATION,
2050 "glMultiDrawArraysIndirect() during display list compile");
2051 }
2052
2053 static void APIENTRY
2054 save_MultiDrawElementsIndirect(UNUSED GLenum mode,
2055 UNUSED GLenum type,
2056 UNUSED const void *indirect,
2057 UNUSED GLsizei primcount,
2058 UNUSED GLsizei stride)
2059 {
2060 GET_CURRENT_CONTEXT(ctx);
2061 _mesa_error(ctx, GL_INVALID_OPERATION,
2062 "glMultiDrawElementsIndirect() during display list compile");
2063 }
2064
2065 /**
2066 * While building a display list we cache some OpenGL state.
2067 * Under some circumstances we need to invalidate that state (immediately
2068 * when we start compiling a list, or after glCallList(s)).
2069 */
2070 static void
2071 invalidate_saved_current_state(struct gl_context *ctx)
2072 {
2073 GLint i;
2074
2075 for (i = 0; i < VERT_ATTRIB_MAX; i++)
2076 ctx->ListState.ActiveAttribSize[i] = 0;
2077
2078 for (i = 0; i < MAT_ATTRIB_MAX; i++)
2079 ctx->ListState.ActiveMaterialSize[i] = 0;
2080
2081 memset(&ctx->ListState.Current, 0, sizeof ctx->ListState.Current);
2082
2083 ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN;
2084 }
2085
2086
2087 static void GLAPIENTRY
2088 save_CallList(GLuint list)
2089 {
2090 GET_CURRENT_CONTEXT(ctx);
2091 Node *n;
2092 SAVE_FLUSH_VERTICES(ctx);
2093
2094 n = alloc_instruction(ctx, OPCODE_CALL_LIST, 1);
2095 if (n) {
2096 n[1].ui = list;
2097 }
2098
2099 /* After this, we don't know what state we're in. Invalidate all
2100 * cached information previously gathered:
2101 */
2102 invalidate_saved_current_state( ctx );
2103
2104 if (ctx->ExecuteFlag) {
2105 _mesa_CallList(list);
2106 }
2107 }
2108
2109
2110 static void GLAPIENTRY
2111 save_CallLists(GLsizei num, GLenum type, const GLvoid * lists)
2112 {
2113 GET_CURRENT_CONTEXT(ctx);
2114 unsigned type_size;
2115 Node *n;
2116 void *lists_copy;
2117
2118 SAVE_FLUSH_VERTICES(ctx);
2119
2120 switch (type) {
2121 case GL_BYTE:
2122 case GL_UNSIGNED_BYTE:
2123 type_size = 1;
2124 break;
2125 case GL_SHORT:
2126 case GL_UNSIGNED_SHORT:
2127 case GL_2_BYTES:
2128 type_size = 2;
2129 break;
2130 case GL_3_BYTES:
2131 type_size = 3;
2132 break;
2133 case GL_INT:
2134 case GL_UNSIGNED_INT:
2135 case GL_FLOAT:
2136 case GL_4_BYTES:
2137 type_size = 4;
2138 break;
2139 default:
2140 type_size = 0;
2141 }
2142
2143 if (num > 0 && type_size > 0) {
2144 /* create a copy of the array of list IDs to save in the display list */
2145 lists_copy = memdup(lists, num * type_size);
2146 } else {
2147 lists_copy = NULL;
2148 }
2149
2150 n = alloc_instruction(ctx, OPCODE_CALL_LISTS, 2 + POINTER_DWORDS);
2151 if (n) {
2152 n[1].i = num;
2153 n[2].e = type;
2154 save_pointer(&n[3], lists_copy);
2155 }
2156
2157 /* After this, we don't know what state we're in. Invalidate all
2158 * cached information previously gathered:
2159 */
2160 invalidate_saved_current_state( ctx );
2161
2162 if (ctx->ExecuteFlag) {
2163 CALL_CallLists(ctx->Exec, (num, type, lists));
2164 }
2165 }
2166
2167
2168 static void GLAPIENTRY
2169 save_Clear(GLbitfield mask)
2170 {
2171 GET_CURRENT_CONTEXT(ctx);
2172 Node *n;
2173 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2174 n = alloc_instruction(ctx, OPCODE_CLEAR, 1);
2175 if (n) {
2176 n[1].bf = mask;
2177 }
2178 if (ctx->ExecuteFlag) {
2179 CALL_Clear(ctx->Exec, (mask));
2180 }
2181 }
2182
2183
2184 static void GLAPIENTRY
2185 save_ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value)
2186 {
2187 GET_CURRENT_CONTEXT(ctx);
2188 Node *n;
2189 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2190 n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_IV, 6);
2191 if (n) {
2192 n[1].e = buffer;
2193 n[2].i = drawbuffer;
2194 n[3].i = value[0];
2195 if (buffer == GL_COLOR) {
2196 n[4].i = value[1];
2197 n[5].i = value[2];
2198 n[6].i = value[3];
2199 }
2200 else {
2201 n[4].i = 0;
2202 n[5].i = 0;
2203 n[6].i = 0;
2204 }
2205 }
2206 if (ctx->ExecuteFlag) {
2207 CALL_ClearBufferiv(ctx->Exec, (buffer, drawbuffer, value));
2208 }
2209 }
2210
2211
2212 static void GLAPIENTRY
2213 save_ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value)
2214 {
2215 GET_CURRENT_CONTEXT(ctx);
2216 Node *n;
2217 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2218 n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_UIV, 6);
2219 if (n) {
2220 n[1].e = buffer;
2221 n[2].i = drawbuffer;
2222 n[3].ui = value[0];
2223 if (buffer == GL_COLOR) {
2224 n[4].ui = value[1];
2225 n[5].ui = value[2];
2226 n[6].ui = value[3];
2227 }
2228 else {
2229 n[4].ui = 0;
2230 n[5].ui = 0;
2231 n[6].ui = 0;
2232 }
2233 }
2234 if (ctx->ExecuteFlag) {
2235 CALL_ClearBufferuiv(ctx->Exec, (buffer, drawbuffer, value));
2236 }
2237 }
2238
2239
2240 static void GLAPIENTRY
2241 save_ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
2242 {
2243 GET_CURRENT_CONTEXT(ctx);
2244 Node *n;
2245 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2246 n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_FV, 6);
2247 if (n) {
2248 n[1].e = buffer;
2249 n[2].i = drawbuffer;
2250 n[3].f = value[0];
2251 if (buffer == GL_COLOR) {
2252 n[4].f = value[1];
2253 n[5].f = value[2];
2254 n[6].f = value[3];
2255 }
2256 else {
2257 n[4].f = 0.0F;
2258 n[5].f = 0.0F;
2259 n[6].f = 0.0F;
2260 }
2261 }
2262 if (ctx->ExecuteFlag) {
2263 CALL_ClearBufferfv(ctx->Exec, (buffer, drawbuffer, value));
2264 }
2265 }
2266
2267
2268 static void GLAPIENTRY
2269 save_ClearBufferfi(GLenum buffer, GLint drawbuffer,
2270 GLfloat depth, GLint stencil)
2271 {
2272 GET_CURRENT_CONTEXT(ctx);
2273 Node *n;
2274 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2275 n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_FI, 4);
2276 if (n) {
2277 n[1].e = buffer;
2278 n[2].i = drawbuffer;
2279 n[3].f = depth;
2280 n[4].i = stencil;
2281 }
2282 if (ctx->ExecuteFlag) {
2283 CALL_ClearBufferfi(ctx->Exec, (buffer, drawbuffer, depth, stencil));
2284 }
2285 }
2286
2287
2288 static void GLAPIENTRY
2289 save_ClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
2290 {
2291 GET_CURRENT_CONTEXT(ctx);
2292 Node *n;
2293 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2294 n = alloc_instruction(ctx, OPCODE_CLEAR_ACCUM, 4);
2295 if (n) {
2296 n[1].f = red;
2297 n[2].f = green;
2298 n[3].f = blue;
2299 n[4].f = alpha;
2300 }
2301 if (ctx->ExecuteFlag) {
2302 CALL_ClearAccum(ctx->Exec, (red, green, blue, alpha));
2303 }
2304 }
2305
2306
2307 static void GLAPIENTRY
2308 save_ClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
2309 {
2310 GET_CURRENT_CONTEXT(ctx);
2311 Node *n;
2312 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2313 n = alloc_instruction(ctx, OPCODE_CLEAR_COLOR, 4);
2314 if (n) {
2315 n[1].f = red;
2316 n[2].f = green;
2317 n[3].f = blue;
2318 n[4].f = alpha;
2319 }
2320 if (ctx->ExecuteFlag) {
2321 CALL_ClearColor(ctx->Exec, (red, green, blue, alpha));
2322 }
2323 }
2324
2325
2326 static void GLAPIENTRY
2327 save_ClearDepth(GLclampd depth)
2328 {
2329 GET_CURRENT_CONTEXT(ctx);
2330 Node *n;
2331 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2332 n = alloc_instruction(ctx, OPCODE_CLEAR_DEPTH, 1);
2333 if (n) {
2334 n[1].f = (GLfloat) depth;
2335 }
2336 if (ctx->ExecuteFlag) {
2337 CALL_ClearDepth(ctx->Exec, (depth));
2338 }
2339 }
2340
2341
2342 static void GLAPIENTRY
2343 save_ClearIndex(GLfloat c)
2344 {
2345 GET_CURRENT_CONTEXT(ctx);
2346 Node *n;
2347 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2348 n = alloc_instruction(ctx, OPCODE_CLEAR_INDEX, 1);
2349 if (n) {
2350 n[1].f = c;
2351 }
2352 if (ctx->ExecuteFlag) {
2353 CALL_ClearIndex(ctx->Exec, (c));
2354 }
2355 }
2356
2357
2358 static void GLAPIENTRY
2359 save_ClearStencil(GLint s)
2360 {
2361 GET_CURRENT_CONTEXT(ctx);
2362 Node *n;
2363 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2364 n = alloc_instruction(ctx, OPCODE_CLEAR_STENCIL, 1);
2365 if (n) {
2366 n[1].i = s;
2367 }
2368 if (ctx->ExecuteFlag) {
2369 CALL_ClearStencil(ctx->Exec, (s));
2370 }
2371 }
2372
2373
2374 static void GLAPIENTRY
2375 save_ClipPlane(GLenum plane, const GLdouble * equ)
2376 {
2377 GET_CURRENT_CONTEXT(ctx);
2378 Node *n;
2379 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2380 n = alloc_instruction(ctx, OPCODE_CLIP_PLANE, 5);
2381 if (n) {
2382 n[1].e = plane;
2383 n[2].f = (GLfloat) equ[0];
2384 n[3].f = (GLfloat) equ[1];
2385 n[4].f = (GLfloat) equ[2];
2386 n[5].f = (GLfloat) equ[3];
2387 }
2388 if (ctx->ExecuteFlag) {
2389 CALL_ClipPlane(ctx->Exec, (plane, equ));
2390 }
2391 }
2392
2393
2394
2395 static void GLAPIENTRY
2396 save_ColorMask(GLboolean red, GLboolean green,
2397 GLboolean blue, GLboolean alpha)
2398 {
2399 GET_CURRENT_CONTEXT(ctx);
2400 Node *n;
2401 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2402 n = alloc_instruction(ctx, OPCODE_COLOR_MASK, 4);
2403 if (n) {
2404 n[1].b = red;
2405 n[2].b = green;
2406 n[3].b = blue;
2407 n[4].b = alpha;
2408 }
2409 if (ctx->ExecuteFlag) {
2410 CALL_ColorMask(ctx->Exec, (red, green, blue, alpha));
2411 }
2412 }
2413
2414
2415 static void GLAPIENTRY
2416 save_ColorMaskIndexed(GLuint buf, GLboolean red, GLboolean green,
2417 GLboolean blue, GLboolean alpha)
2418 {
2419 GET_CURRENT_CONTEXT(ctx);
2420 Node *n;
2421 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2422 n = alloc_instruction(ctx, OPCODE_COLOR_MASK_INDEXED, 5);
2423 if (n) {
2424 n[1].ui = buf;
2425 n[2].b = red;
2426 n[3].b = green;
2427 n[4].b = blue;
2428 n[5].b = alpha;
2429 }
2430 if (ctx->ExecuteFlag) {
2431 /*CALL_ColorMaski(ctx->Exec, (buf, red, green, blue, alpha));*/
2432 }
2433 }
2434
2435
2436 static void GLAPIENTRY
2437 save_ColorMaterial(GLenum face, GLenum mode)
2438 {
2439 GET_CURRENT_CONTEXT(ctx);
2440 Node *n;
2441 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2442
2443 n = alloc_instruction(ctx, OPCODE_COLOR_MATERIAL, 2);
2444 if (n) {
2445 n[1].e = face;
2446 n[2].e = mode;
2447 }
2448 if (ctx->ExecuteFlag) {
2449 CALL_ColorMaterial(ctx->Exec, (face, mode));
2450 }
2451 }
2452
2453
2454 static void GLAPIENTRY
2455 save_CopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type)
2456 {
2457 GET_CURRENT_CONTEXT(ctx);
2458 Node *n;
2459 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2460 n = alloc_instruction(ctx, OPCODE_COPY_PIXELS, 5);
2461 if (n) {
2462 n[1].i = x;
2463 n[2].i = y;
2464 n[3].i = (GLint) width;
2465 n[4].i = (GLint) height;
2466 n[5].e = type;
2467 }
2468 if (ctx->ExecuteFlag) {
2469 CALL_CopyPixels(ctx->Exec, (x, y, width, height, type));
2470 }
2471 }
2472
2473
2474
2475 static void GLAPIENTRY
2476 save_CopyTexImage1D(GLenum target, GLint level, GLenum internalformat,
2477 GLint x, GLint y, GLsizei width, GLint border)
2478 {
2479 GET_CURRENT_CONTEXT(ctx);
2480 Node *n;
2481 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2482 n = alloc_instruction(ctx, OPCODE_COPY_TEX_IMAGE1D, 7);
2483 if (n) {
2484 n[1].e = target;
2485 n[2].i = level;
2486 n[3].e = internalformat;
2487 n[4].i = x;
2488 n[5].i = y;
2489 n[6].i = width;
2490 n[7].i = border;
2491 }
2492 if (ctx->ExecuteFlag) {
2493 CALL_CopyTexImage1D(ctx->Exec, (target, level, internalformat,
2494 x, y, width, border));
2495 }
2496 }
2497
2498
2499 static void GLAPIENTRY
2500 save_CopyTexImage2D(GLenum target, GLint level,
2501 GLenum internalformat,
2502 GLint x, GLint y, GLsizei width,
2503 GLsizei height, GLint border)
2504 {
2505 GET_CURRENT_CONTEXT(ctx);
2506 Node *n;
2507 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2508 n = alloc_instruction(ctx, OPCODE_COPY_TEX_IMAGE2D, 8);
2509 if (n) {
2510 n[1].e = target;
2511 n[2].i = level;
2512 n[3].e = internalformat;
2513 n[4].i = x;
2514 n[5].i = y;
2515 n[6].i = width;
2516 n[7].i = height;
2517 n[8].i = border;
2518 }
2519 if (ctx->ExecuteFlag) {
2520 CALL_CopyTexImage2D(ctx->Exec, (target, level, internalformat,
2521 x, y, width, height, border));
2522 }
2523 }
2524
2525
2526
2527 static void GLAPIENTRY
2528 save_CopyTexSubImage1D(GLenum target, GLint level,
2529 GLint xoffset, GLint x, GLint y, GLsizei width)
2530 {
2531 GET_CURRENT_CONTEXT(ctx);
2532 Node *n;
2533 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2534 n = alloc_instruction(ctx, OPCODE_COPY_TEX_SUB_IMAGE1D, 6);
2535 if (n) {
2536 n[1].e = target;
2537 n[2].i = level;
2538 n[3].i = xoffset;
2539 n[4].i = x;
2540 n[5].i = y;
2541 n[6].i = width;
2542 }
2543 if (ctx->ExecuteFlag) {
2544 CALL_CopyTexSubImage1D(ctx->Exec,
2545 (target, level, xoffset, x, y, width));
2546 }
2547 }
2548
2549
2550 static void GLAPIENTRY
2551 save_CopyTexSubImage2D(GLenum target, GLint level,
2552 GLint xoffset, GLint yoffset,
2553 GLint x, GLint y, GLsizei width, GLint height)
2554 {
2555 GET_CURRENT_CONTEXT(ctx);
2556 Node *n;
2557 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2558 n = alloc_instruction(ctx, OPCODE_COPY_TEX_SUB_IMAGE2D, 8);
2559 if (n) {
2560 n[1].e = target;
2561 n[2].i = level;
2562 n[3].i = xoffset;
2563 n[4].i = yoffset;
2564 n[5].i = x;
2565 n[6].i = y;
2566 n[7].i = width;
2567 n[8].i = height;
2568 }
2569 if (ctx->ExecuteFlag) {
2570 CALL_CopyTexSubImage2D(ctx->Exec, (target, level, xoffset, yoffset,
2571 x, y, width, height));
2572 }
2573 }
2574
2575
2576 static void GLAPIENTRY
2577 save_CopyTexSubImage3D(GLenum target, GLint level,
2578 GLint xoffset, GLint yoffset, GLint zoffset,
2579 GLint x, GLint y, GLsizei width, GLint height)
2580 {
2581 GET_CURRENT_CONTEXT(ctx);
2582 Node *n;
2583 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2584 n = alloc_instruction(ctx, OPCODE_COPY_TEX_SUB_IMAGE3D, 9);
2585 if (n) {
2586 n[1].e = target;
2587 n[2].i = level;
2588 n[3].i = xoffset;
2589 n[4].i = yoffset;
2590 n[5].i = zoffset;
2591 n[6].i = x;
2592 n[7].i = y;
2593 n[8].i = width;
2594 n[9].i = height;
2595 }
2596 if (ctx->ExecuteFlag) {
2597 CALL_CopyTexSubImage3D(ctx->Exec, (target, level,
2598 xoffset, yoffset, zoffset,
2599 x, y, width, height));
2600 }
2601 }
2602
2603
2604 static void GLAPIENTRY
2605 save_CullFace(GLenum mode)
2606 {
2607 GET_CURRENT_CONTEXT(ctx);
2608 Node *n;
2609 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2610 n = alloc_instruction(ctx, OPCODE_CULL_FACE, 1);
2611 if (n) {
2612 n[1].e = mode;
2613 }
2614 if (ctx->ExecuteFlag) {
2615 CALL_CullFace(ctx->Exec, (mode));
2616 }
2617 }
2618
2619
2620 static void GLAPIENTRY
2621 save_DepthFunc(GLenum func)
2622 {
2623 GET_CURRENT_CONTEXT(ctx);
2624 Node *n;
2625 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2626 n = alloc_instruction(ctx, OPCODE_DEPTH_FUNC, 1);
2627 if (n) {
2628 n[1].e = func;
2629 }
2630 if (ctx->ExecuteFlag) {
2631 CALL_DepthFunc(ctx->Exec, (func));
2632 }
2633 }
2634
2635
2636 static void GLAPIENTRY
2637 save_DepthMask(GLboolean mask)
2638 {
2639 GET_CURRENT_CONTEXT(ctx);
2640 Node *n;
2641 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2642 n = alloc_instruction(ctx, OPCODE_DEPTH_MASK, 1);
2643 if (n) {
2644 n[1].b = mask;
2645 }
2646 if (ctx->ExecuteFlag) {
2647 CALL_DepthMask(ctx->Exec, (mask));
2648 }
2649 }
2650
2651
2652 static void GLAPIENTRY
2653 save_DepthRange(GLclampd nearval, GLclampd farval)
2654 {
2655 GET_CURRENT_CONTEXT(ctx);
2656 Node *n;
2657 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2658 n = alloc_instruction(ctx, OPCODE_DEPTH_RANGE, 2);
2659 if (n) {
2660 n[1].f = (GLfloat) nearval;
2661 n[2].f = (GLfloat) farval;
2662 }
2663 if (ctx->ExecuteFlag) {
2664 CALL_DepthRange(ctx->Exec, (nearval, farval));
2665 }
2666 }
2667
2668
2669 static void GLAPIENTRY
2670 save_Disable(GLenum cap)
2671 {
2672 GET_CURRENT_CONTEXT(ctx);
2673 Node *n;
2674 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2675 n = alloc_instruction(ctx, OPCODE_DISABLE, 1);
2676 if (n) {
2677 n[1].e = cap;
2678 }
2679 if (ctx->ExecuteFlag) {
2680 CALL_Disable(ctx->Exec, (cap));
2681 }
2682 }
2683
2684
2685 static void GLAPIENTRY
2686 save_DisableIndexed(GLuint index, GLenum cap)
2687 {
2688 GET_CURRENT_CONTEXT(ctx);
2689 Node *n;
2690 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2691 n = alloc_instruction(ctx, OPCODE_DISABLE_INDEXED, 2);
2692 if (n) {
2693 n[1].ui = index;
2694 n[2].e = cap;
2695 }
2696 if (ctx->ExecuteFlag) {
2697 CALL_Disablei(ctx->Exec, (index, cap));
2698 }
2699 }
2700
2701
2702 static void GLAPIENTRY
2703 save_DrawBuffer(GLenum mode)
2704 {
2705 GET_CURRENT_CONTEXT(ctx);
2706 Node *n;
2707 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2708 n = alloc_instruction(ctx, OPCODE_DRAW_BUFFER, 1);
2709 if (n) {
2710 n[1].e = mode;
2711 }
2712 if (ctx->ExecuteFlag) {
2713 CALL_DrawBuffer(ctx->Exec, (mode));
2714 }
2715 }
2716
2717
2718 static void GLAPIENTRY
2719 save_DrawPixels(GLsizei width, GLsizei height,
2720 GLenum format, GLenum type, const GLvoid * pixels)
2721 {
2722 GET_CURRENT_CONTEXT(ctx);
2723 Node *n;
2724
2725 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2726
2727 n = alloc_instruction(ctx, OPCODE_DRAW_PIXELS, 4 + POINTER_DWORDS);
2728 if (n) {
2729 n[1].i = width;
2730 n[2].i = height;
2731 n[3].e = format;
2732 n[4].e = type;
2733 save_pointer(&n[5],
2734 unpack_image(ctx, 2, width, height, 1, format, type,
2735 pixels, &ctx->Unpack));
2736 }
2737 if (ctx->ExecuteFlag) {
2738 CALL_DrawPixels(ctx->Exec, (width, height, format, type, pixels));
2739 }
2740 }
2741
2742
2743
2744 static void GLAPIENTRY
2745 save_Enable(GLenum cap)
2746 {
2747 GET_CURRENT_CONTEXT(ctx);
2748 Node *n;
2749 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2750 n = alloc_instruction(ctx, OPCODE_ENABLE, 1);
2751 if (n) {
2752 n[1].e = cap;
2753 }
2754 if (ctx->ExecuteFlag) {
2755 CALL_Enable(ctx->Exec, (cap));
2756 }
2757 }
2758
2759
2760
2761 static void GLAPIENTRY
2762 save_EnableIndexed(GLuint index, GLenum cap)
2763 {
2764 GET_CURRENT_CONTEXT(ctx);
2765 Node *n;
2766 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2767 n = alloc_instruction(ctx, OPCODE_ENABLE_INDEXED, 2);
2768 if (n) {
2769 n[1].ui = index;
2770 n[2].e = cap;
2771 }
2772 if (ctx->ExecuteFlag) {
2773 CALL_Enablei(ctx->Exec, (index, cap));
2774 }
2775 }
2776
2777
2778
2779 static void GLAPIENTRY
2780 save_EvalMesh1(GLenum mode, GLint i1, GLint i2)
2781 {
2782 GET_CURRENT_CONTEXT(ctx);
2783 Node *n;
2784 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2785 n = alloc_instruction(ctx, OPCODE_EVALMESH1, 3);
2786 if (n) {
2787 n[1].e = mode;
2788 n[2].i = i1;
2789 n[3].i = i2;
2790 }
2791 if (ctx->ExecuteFlag) {
2792 CALL_EvalMesh1(ctx->Exec, (mode, i1, i2));
2793 }
2794 }
2795
2796
2797 static void GLAPIENTRY
2798 save_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)
2799 {
2800 GET_CURRENT_CONTEXT(ctx);
2801 Node *n;
2802 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2803 n = alloc_instruction(ctx, OPCODE_EVALMESH2, 5);
2804 if (n) {
2805 n[1].e = mode;
2806 n[2].i = i1;
2807 n[3].i = i2;
2808 n[4].i = j1;
2809 n[5].i = j2;
2810 }
2811 if (ctx->ExecuteFlag) {
2812 CALL_EvalMesh2(ctx->Exec, (mode, i1, i2, j1, j2));
2813 }
2814 }
2815
2816
2817
2818
2819 static void GLAPIENTRY
2820 save_Fogfv(GLenum pname, const GLfloat *params)
2821 {
2822 GET_CURRENT_CONTEXT(ctx);
2823 Node *n;
2824 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2825 n = alloc_instruction(ctx, OPCODE_FOG, 5);
2826 if (n) {
2827 n[1].e = pname;
2828 n[2].f = params[0];
2829 n[3].f = params[1];
2830 n[4].f = params[2];
2831 n[5].f = params[3];
2832 }
2833 if (ctx->ExecuteFlag) {
2834 CALL_Fogfv(ctx->Exec, (pname, params));
2835 }
2836 }
2837
2838
2839 static void GLAPIENTRY
2840 save_Fogf(GLenum pname, GLfloat param)
2841 {
2842 GLfloat parray[4];
2843 parray[0] = param;
2844 parray[1] = parray[2] = parray[3] = 0.0F;
2845 save_Fogfv(pname, parray);
2846 }
2847
2848
2849 static void GLAPIENTRY
2850 save_Fogiv(GLenum pname, const GLint *params)
2851 {
2852 GLfloat p[4];
2853 switch (pname) {
2854 case GL_FOG_MODE:
2855 case GL_FOG_DENSITY:
2856 case GL_FOG_START:
2857 case GL_FOG_END:
2858 case GL_FOG_INDEX:
2859 case GL_FOG_COORDINATE_SOURCE:
2860 p[0] = (GLfloat) *params;
2861 p[1] = 0.0f;
2862 p[2] = 0.0f;
2863 p[3] = 0.0f;
2864 break;
2865 case GL_FOG_COLOR:
2866 p[0] = INT_TO_FLOAT(params[0]);
2867 p[1] = INT_TO_FLOAT(params[1]);
2868 p[2] = INT_TO_FLOAT(params[2]);
2869 p[3] = INT_TO_FLOAT(params[3]);
2870 break;
2871 default:
2872 /* Error will be caught later in gl_Fogfv */
2873 ASSIGN_4V(p, 0.0F, 0.0F, 0.0F, 0.0F);
2874 }
2875 save_Fogfv(pname, p);
2876 }
2877
2878
2879 static void GLAPIENTRY
2880 save_Fogi(GLenum pname, GLint param)
2881 {
2882 GLint parray[4];
2883 parray[0] = param;
2884 parray[1] = parray[2] = parray[3] = 0;
2885 save_Fogiv(pname, parray);
2886 }
2887
2888
2889 static void GLAPIENTRY
2890 save_FrontFace(GLenum mode)
2891 {
2892 GET_CURRENT_CONTEXT(ctx);
2893 Node *n;
2894 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2895 n = alloc_instruction(ctx, OPCODE_FRONT_FACE, 1);
2896 if (n) {
2897 n[1].e = mode;
2898 }
2899 if (ctx->ExecuteFlag) {
2900 CALL_FrontFace(ctx->Exec, (mode));
2901 }
2902 }
2903
2904
2905 static void GLAPIENTRY
2906 save_Frustum(GLdouble left, GLdouble right,
2907 GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval)
2908 {
2909 GET_CURRENT_CONTEXT(ctx);
2910 Node *n;
2911 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2912 n = alloc_instruction(ctx, OPCODE_FRUSTUM, 6);
2913 if (n) {
2914 n[1].f = (GLfloat) left;
2915 n[2].f = (GLfloat) right;
2916 n[3].f = (GLfloat) bottom;
2917 n[4].f = (GLfloat) top;
2918 n[5].f = (GLfloat) nearval;
2919 n[6].f = (GLfloat) farval;
2920 }
2921 if (ctx->ExecuteFlag) {
2922 CALL_Frustum(ctx->Exec, (left, right, bottom, top, nearval, farval));
2923 }
2924 }
2925
2926
2927 static void GLAPIENTRY
2928 save_Hint(GLenum target, GLenum mode)
2929 {
2930 GET_CURRENT_CONTEXT(ctx);
2931 Node *n;
2932 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2933 n = alloc_instruction(ctx, OPCODE_HINT, 2);
2934 if (n) {
2935 n[1].e = target;
2936 n[2].e = mode;
2937 }
2938 if (ctx->ExecuteFlag) {
2939 CALL_Hint(ctx->Exec, (target, mode));
2940 }
2941 }
2942
2943
2944 static void GLAPIENTRY
2945 save_IndexMask(GLuint mask)
2946 {
2947 GET_CURRENT_CONTEXT(ctx);
2948 Node *n;
2949 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2950 n = alloc_instruction(ctx, OPCODE_INDEX_MASK, 1);
2951 if (n) {
2952 n[1].ui = mask;
2953 }
2954 if (ctx->ExecuteFlag) {
2955 CALL_IndexMask(ctx->Exec, (mask));
2956 }
2957 }
2958
2959
2960 static void GLAPIENTRY
2961 save_InitNames(void)
2962 {
2963 GET_CURRENT_CONTEXT(ctx);
2964 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2965 (void) alloc_instruction(ctx, OPCODE_INIT_NAMES, 0);
2966 if (ctx->ExecuteFlag) {
2967 CALL_InitNames(ctx->Exec, ());
2968 }
2969 }
2970
2971
2972 static void GLAPIENTRY
2973 save_Lightfv(GLenum light, GLenum pname, const GLfloat *params)
2974 {
2975 GET_CURRENT_CONTEXT(ctx);
2976 Node *n;
2977 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2978 n = alloc_instruction(ctx, OPCODE_LIGHT, 6);
2979 if (n) {
2980 GLint i, nParams;
2981 n[1].e = light;
2982 n[2].e = pname;
2983 switch (pname) {
2984 case GL_AMBIENT:
2985 nParams = 4;
2986 break;
2987 case GL_DIFFUSE:
2988 nParams = 4;
2989 break;
2990 case GL_SPECULAR:
2991 nParams = 4;
2992 break;
2993 case GL_POSITION:
2994 nParams = 4;
2995 break;
2996 case GL_SPOT_DIRECTION:
2997 nParams = 3;
2998 break;
2999 case GL_SPOT_EXPONENT:
3000 nParams = 1;
3001 break;
3002 case GL_SPOT_CUTOFF:
3003 nParams = 1;
3004 break;
3005 case GL_CONSTANT_ATTENUATION:
3006 nParams = 1;
3007 break;
3008 case GL_LINEAR_ATTENUATION:
3009 nParams = 1;
3010 break;
3011 case GL_QUADRATIC_ATTENUATION:
3012 nParams = 1;
3013 break;
3014 default:
3015 nParams = 0;
3016 }
3017 for (i = 0; i < nParams; i++) {
3018 n[3 + i].f = params[i];
3019 }
3020 }
3021 if (ctx->ExecuteFlag) {
3022 CALL_Lightfv(ctx->Exec, (light, pname, params));
3023 }
3024 }
3025
3026
3027 static void GLAPIENTRY
3028 save_Lightf(GLenum light, GLenum pname, GLfloat param)
3029 {
3030 GLfloat parray[4];
3031 parray[0] = param;
3032 parray[1] = parray[2] = parray[3] = 0.0F;
3033 save_Lightfv(light, pname, parray);
3034 }
3035
3036
3037 static void GLAPIENTRY
3038 save_Lightiv(GLenum light, GLenum pname, const GLint *params)
3039 {
3040 GLfloat fparam[4];
3041 switch (pname) {
3042 case GL_AMBIENT:
3043 case GL_DIFFUSE:
3044 case GL_SPECULAR:
3045 fparam[0] = INT_TO_FLOAT(params[0]);
3046 fparam[1] = INT_TO_FLOAT(params[1]);
3047 fparam[2] = INT_TO_FLOAT(params[2]);
3048 fparam[3] = INT_TO_FLOAT(params[3]);
3049 break;
3050 case GL_POSITION:
3051 fparam[0] = (GLfloat) params[0];
3052 fparam[1] = (GLfloat) params[1];
3053 fparam[2] = (GLfloat) params[2];
3054 fparam[3] = (GLfloat) params[3];
3055 break;
3056 case GL_SPOT_DIRECTION:
3057 fparam[0] = (GLfloat) params[0];
3058 fparam[1] = (GLfloat) params[1];
3059 fparam[2] = (GLfloat) params[2];
3060 break;
3061 case GL_SPOT_EXPONENT:
3062 case GL_SPOT_CUTOFF:
3063 case GL_CONSTANT_ATTENUATION:
3064 case GL_LINEAR_ATTENUATION:
3065 case GL_QUADRATIC_ATTENUATION:
3066 fparam[0] = (GLfloat) params[0];
3067 break;
3068 default:
3069 /* error will be caught later in gl_Lightfv */
3070 ;
3071 }
3072 save_Lightfv(light, pname, fparam);
3073 }
3074
3075
3076 static void GLAPIENTRY
3077 save_Lighti(GLenum light, GLenum pname, GLint param)
3078 {
3079 GLint parray[4];
3080 parray[0] = param;
3081 parray[1] = parray[2] = parray[3] = 0;
3082 save_Lightiv(light, pname, parray);
3083 }
3084
3085
3086 static void GLAPIENTRY
3087 save_LightModelfv(GLenum pname, const GLfloat *params)
3088 {
3089 GET_CURRENT_CONTEXT(ctx);
3090 Node *n;
3091 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3092 n = alloc_instruction(ctx, OPCODE_LIGHT_MODEL, 5);
3093 if (n) {
3094 n[1].e = pname;
3095 n[2].f = params[0];
3096 n[3].f = params[1];
3097 n[4].f = params[2];
3098 n[5].f = params[3];
3099 }
3100 if (ctx->ExecuteFlag) {
3101 CALL_LightModelfv(ctx->Exec, (pname, params));
3102 }
3103 }
3104
3105
3106 static void GLAPIENTRY
3107 save_LightModelf(GLenum pname, GLfloat param)
3108 {
3109 GLfloat parray[4];
3110 parray[0] = param;
3111 parray[1] = parray[2] = parray[3] = 0.0F;
3112 save_LightModelfv(pname, parray);
3113 }
3114
3115
3116 static void GLAPIENTRY
3117 save_LightModeliv(GLenum pname, const GLint *params)
3118 {
3119 GLfloat fparam[4];
3120 switch (pname) {
3121 case GL_LIGHT_MODEL_AMBIENT:
3122 fparam[0] = INT_TO_FLOAT(params[0]);
3123 fparam[1] = INT_TO_FLOAT(params[1]);
3124 fparam[2] = INT_TO_FLOAT(params[2]);
3125 fparam[3] = INT_TO_FLOAT(params[3]);
3126 break;
3127 case GL_LIGHT_MODEL_LOCAL_VIEWER:
3128 case GL_LIGHT_MODEL_TWO_SIDE:
3129 case GL_LIGHT_MODEL_COLOR_CONTROL:
3130 fparam[0] = (GLfloat) params[0];
3131 fparam[1] = 0.0F;
3132 fparam[2] = 0.0F;
3133 fparam[3] = 0.0F;
3134 break;
3135 default:
3136 /* Error will be caught later in gl_LightModelfv */
3137 ASSIGN_4V(fparam, 0.0F, 0.0F, 0.0F, 0.0F);
3138 }
3139 save_LightModelfv(pname, fparam);
3140 }
3141
3142
3143 static void GLAPIENTRY
3144 save_LightModeli(GLenum pname, GLint param)
3145 {
3146 GLint parray[4];
3147 parray[0] = param;
3148 parray[1] = parray[2] = parray[3] = 0;
3149 save_LightModeliv(pname, parray);
3150 }
3151
3152
3153 static void GLAPIENTRY
3154 save_LineStipple(GLint factor, GLushort pattern)
3155 {
3156 GET_CURRENT_CONTEXT(ctx);
3157 Node *n;
3158 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3159 n = alloc_instruction(ctx, OPCODE_LINE_STIPPLE, 2);
3160 if (n) {
3161 n[1].i = factor;
3162 n[2].us = pattern;
3163 }
3164 if (ctx->ExecuteFlag) {
3165 CALL_LineStipple(ctx->Exec, (factor, pattern));
3166 }
3167 }
3168
3169
3170 static void GLAPIENTRY
3171 save_LineWidth(GLfloat width)
3172 {
3173 GET_CURRENT_CONTEXT(ctx);
3174 Node *n;
3175 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3176 n = alloc_instruction(ctx, OPCODE_LINE_WIDTH, 1);
3177 if (n) {
3178 n[1].f = width;
3179 }
3180 if (ctx->ExecuteFlag) {
3181 CALL_LineWidth(ctx->Exec, (width));
3182 }
3183 }
3184
3185
3186 static void GLAPIENTRY
3187 save_ListBase(GLuint base)
3188 {
3189 GET_CURRENT_CONTEXT(ctx);
3190 Node *n;
3191 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3192 n = alloc_instruction(ctx, OPCODE_LIST_BASE, 1);
3193 if (n) {
3194 n[1].ui = base;
3195 }
3196 if (ctx->ExecuteFlag) {
3197 CALL_ListBase(ctx->Exec, (base));
3198 }
3199 }
3200
3201
3202 static void GLAPIENTRY
3203 save_LoadIdentity(void)
3204 {
3205 GET_CURRENT_CONTEXT(ctx);
3206 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3207 (void) alloc_instruction(ctx, OPCODE_LOAD_IDENTITY, 0);
3208 if (ctx->ExecuteFlag) {
3209 CALL_LoadIdentity(ctx->Exec, ());
3210 }
3211 }
3212
3213
3214 static void GLAPIENTRY
3215 save_LoadMatrixf(const GLfloat * m)
3216 {
3217 GET_CURRENT_CONTEXT(ctx);
3218 Node *n;
3219 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3220 n = alloc_instruction(ctx, OPCODE_LOAD_MATRIX, 16);
3221 if (n) {
3222 GLuint i;
3223 for (i = 0; i < 16; i++) {
3224 n[1 + i].f = m[i];
3225 }
3226 }
3227 if (ctx->ExecuteFlag) {
3228 CALL_LoadMatrixf(ctx->Exec, (m));
3229 }
3230 }
3231
3232
3233 static void GLAPIENTRY
3234 save_LoadMatrixd(const GLdouble * m)
3235 {
3236 GLfloat f[16];
3237 GLint i;
3238 for (i = 0; i < 16; i++) {
3239 f[i] = (GLfloat) m[i];
3240 }
3241 save_LoadMatrixf(f);
3242 }
3243
3244
3245 static void GLAPIENTRY
3246 save_LoadName(GLuint name)
3247 {
3248 GET_CURRENT_CONTEXT(ctx);
3249 Node *n;
3250 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3251 n = alloc_instruction(ctx, OPCODE_LOAD_NAME, 1);
3252 if (n) {
3253 n[1].ui = name;
3254 }
3255 if (ctx->ExecuteFlag) {
3256 CALL_LoadName(ctx->Exec, (name));
3257 }
3258 }
3259
3260
3261 static void GLAPIENTRY
3262 save_LogicOp(GLenum opcode)
3263 {
3264 GET_CURRENT_CONTEXT(ctx);
3265 Node *n;
3266 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3267 n = alloc_instruction(ctx, OPCODE_LOGIC_OP, 1);
3268 if (n) {
3269 n[1].e = opcode;
3270 }
3271 if (ctx->ExecuteFlag) {
3272 CALL_LogicOp(ctx->Exec, (opcode));
3273 }
3274 }
3275
3276
3277 static void GLAPIENTRY
3278 save_Map1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride,
3279 GLint order, const GLdouble * points)
3280 {
3281 GET_CURRENT_CONTEXT(ctx);
3282 Node *n;
3283 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3284 n = alloc_instruction(ctx, OPCODE_MAP1, 5 + POINTER_DWORDS);
3285 if (n) {
3286 GLfloat *pnts = _mesa_copy_map_points1d(target, stride, order, points);
3287 n[1].e = target;
3288 n[2].f = (GLfloat) u1;
3289 n[3].f = (GLfloat) u2;
3290 n[4].i = _mesa_evaluator_components(target); /* stride */
3291 n[5].i = order;
3292 save_pointer(&n[6], pnts);
3293 }
3294 if (ctx->ExecuteFlag) {
3295 CALL_Map1d(ctx->Exec, (target, u1, u2, stride, order, points));
3296 }
3297 }
3298
3299 static void GLAPIENTRY
3300 save_Map1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride,
3301 GLint order, const GLfloat * points)
3302 {
3303 GET_CURRENT_CONTEXT(ctx);
3304 Node *n;
3305 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3306 n = alloc_instruction(ctx, OPCODE_MAP1, 5 + POINTER_DWORDS);
3307 if (n) {
3308 GLfloat *pnts = _mesa_copy_map_points1f(target, stride, order, points);
3309 n[1].e = target;
3310 n[2].f = u1;
3311 n[3].f = u2;
3312 n[4].i = _mesa_evaluator_components(target); /* stride */
3313 n[5].i = order;
3314 save_pointer(&n[6], pnts);
3315 }
3316 if (ctx->ExecuteFlag) {
3317 CALL_Map1f(ctx->Exec, (target, u1, u2, stride, order, points));
3318 }
3319 }
3320
3321
3322 static void GLAPIENTRY
3323 save_Map2d(GLenum target,
3324 GLdouble u1, GLdouble u2, GLint ustride, GLint uorder,
3325 GLdouble v1, GLdouble v2, GLint vstride, GLint vorder,
3326 const GLdouble * points)
3327 {
3328 GET_CURRENT_CONTEXT(ctx);
3329 Node *n;
3330 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3331 n = alloc_instruction(ctx, OPCODE_MAP2, 9 + POINTER_DWORDS);
3332 if (n) {
3333 GLfloat *pnts = _mesa_copy_map_points2d(target, ustride, uorder,
3334 vstride, vorder, points);
3335 n[1].e = target;
3336 n[2].f = (GLfloat) u1;
3337 n[3].f = (GLfloat) u2;
3338 n[4].f = (GLfloat) v1;
3339 n[5].f = (GLfloat) v2;
3340 /* XXX verify these strides are correct */
3341 n[6].i = _mesa_evaluator_components(target) * vorder; /*ustride */
3342 n[7].i = _mesa_evaluator_components(target); /*vstride */
3343 n[8].i = uorder;
3344 n[9].i = vorder;
3345 save_pointer(&n[10], pnts);
3346 }
3347 if (ctx->ExecuteFlag) {
3348 CALL_Map2d(ctx->Exec, (target,
3349 u1, u2, ustride, uorder,
3350 v1, v2, vstride, vorder, points));
3351 }
3352 }
3353
3354
3355 static void GLAPIENTRY
3356 save_Map2f(GLenum target,
3357 GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
3358 GLfloat v1, GLfloat v2, GLint vstride, GLint vorder,
3359 const GLfloat * points)
3360 {
3361 GET_CURRENT_CONTEXT(ctx);
3362 Node *n;
3363 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3364 n = alloc_instruction(ctx, OPCODE_MAP2, 9 + POINTER_DWORDS);
3365 if (n) {
3366 GLfloat *pnts = _mesa_copy_map_points2f(target, ustride, uorder,
3367 vstride, vorder, points);
3368 n[1].e = target;
3369 n[2].f = u1;
3370 n[3].f = u2;
3371 n[4].f = v1;
3372 n[5].f = v2;
3373 /* XXX verify these strides are correct */
3374 n[6].i = _mesa_evaluator_components(target) * vorder; /*ustride */
3375 n[7].i = _mesa_evaluator_components(target); /*vstride */
3376 n[8].i = uorder;
3377 n[9].i = vorder;
3378 save_pointer(&n[10], pnts);
3379 }
3380 if (ctx->ExecuteFlag) {
3381 CALL_Map2f(ctx->Exec, (target, u1, u2, ustride, uorder,
3382 v1, v2, vstride, vorder, points));
3383 }
3384 }
3385
3386
3387 static void GLAPIENTRY
3388 save_MapGrid1f(GLint un, GLfloat u1, GLfloat u2)
3389 {
3390 GET_CURRENT_CONTEXT(ctx);
3391 Node *n;
3392 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3393 n = alloc_instruction(ctx, OPCODE_MAPGRID1, 3);
3394 if (n) {
3395 n[1].i = un;
3396 n[2].f = u1;
3397 n[3].f = u2;
3398 }
3399 if (ctx->ExecuteFlag) {
3400 CALL_MapGrid1f(ctx->Exec, (un, u1, u2));
3401 }
3402 }
3403
3404
3405 static void GLAPIENTRY
3406 save_MapGrid1d(GLint un, GLdouble u1, GLdouble u2)
3407 {
3408 save_MapGrid1f(un, (GLfloat) u1, (GLfloat) u2);
3409 }
3410
3411
3412 static void GLAPIENTRY
3413 save_MapGrid2f(GLint un, GLfloat u1, GLfloat u2,
3414 GLint vn, GLfloat v1, GLfloat v2)
3415 {
3416 GET_CURRENT_CONTEXT(ctx);
3417 Node *n;
3418 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3419 n = alloc_instruction(ctx, OPCODE_MAPGRID2, 6);
3420 if (n) {
3421 n[1].i = un;
3422 n[2].f = u1;
3423 n[3].f = u2;
3424 n[4].i = vn;
3425 n[5].f = v1;
3426 n[6].f = v2;
3427 }
3428 if (ctx->ExecuteFlag) {
3429 CALL_MapGrid2f(ctx->Exec, (un, u1, u2, vn, v1, v2));
3430 }
3431 }
3432
3433
3434
3435 static void GLAPIENTRY
3436 save_MapGrid2d(GLint un, GLdouble u1, GLdouble u2,
3437 GLint vn, GLdouble v1, GLdouble v2)
3438 {
3439 save_MapGrid2f(un, (GLfloat) u1, (GLfloat) u2,
3440 vn, (GLfloat) v1, (GLfloat) v2);
3441 }
3442
3443
3444 static void GLAPIENTRY
3445 save_MatrixMode(GLenum mode)
3446 {
3447 GET_CURRENT_CONTEXT(ctx);
3448 Node *n;
3449 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3450 n = alloc_instruction(ctx, OPCODE_MATRIX_MODE, 1);
3451 if (n) {
3452 n[1].e = mode;
3453 }
3454 if (ctx->ExecuteFlag) {
3455 CALL_MatrixMode(ctx->Exec, (mode));
3456 }
3457 }
3458
3459
3460 static void GLAPIENTRY
3461 save_MultMatrixf(const GLfloat * m)
3462 {
3463 GET_CURRENT_CONTEXT(ctx);
3464 Node *n;
3465 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3466 n = alloc_instruction(ctx, OPCODE_MULT_MATRIX, 16);
3467 if (n) {
3468 GLuint i;
3469 for (i = 0; i < 16; i++) {
3470 n[1 + i].f = m[i];
3471 }
3472 }
3473 if (ctx->ExecuteFlag) {
3474 CALL_MultMatrixf(ctx->Exec, (m));
3475 }
3476 }
3477
3478
3479 static void GLAPIENTRY
3480 save_MultMatrixd(const GLdouble * m)
3481 {
3482 GLfloat f[16];
3483 GLint i;
3484 for (i = 0; i < 16; i++) {
3485 f[i] = (GLfloat) m[i];
3486 }
3487 save_MultMatrixf(f);
3488 }
3489
3490
3491 static void GLAPIENTRY
3492 save_NewList(GLuint name, GLenum mode)
3493 {
3494 GET_CURRENT_CONTEXT(ctx);
3495 /* It's an error to call this function while building a display list */
3496 _mesa_error(ctx, GL_INVALID_OPERATION, "glNewList");
3497 (void) name;
3498 (void) mode;
3499 }
3500
3501
3502
3503 static void GLAPIENTRY
3504 save_Ortho(GLdouble left, GLdouble right,
3505 GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval)
3506 {
3507 GET_CURRENT_CONTEXT(ctx);
3508 Node *n;
3509 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3510 n = alloc_instruction(ctx, OPCODE_ORTHO, 6);
3511 if (n) {
3512 n[1].f = (GLfloat) left;
3513 n[2].f = (GLfloat) right;
3514 n[3].f = (GLfloat) bottom;
3515 n[4].f = (GLfloat) top;
3516 n[5].f = (GLfloat) nearval;
3517 n[6].f = (GLfloat) farval;
3518 }
3519 if (ctx->ExecuteFlag) {
3520 CALL_Ortho(ctx->Exec, (left, right, bottom, top, nearval, farval));
3521 }
3522 }
3523
3524
3525 static void GLAPIENTRY
3526 save_PatchParameteri(GLenum pname, const GLint value)
3527 {
3528 GET_CURRENT_CONTEXT(ctx);
3529 Node *n;
3530 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3531 n = alloc_instruction(ctx, OPCODE_PATCH_PARAMETER_I, 2);
3532 if (n) {
3533 n[1].e = pname;
3534 n[2].i = value;
3535 }
3536 if (ctx->ExecuteFlag) {
3537 CALL_PatchParameteri(ctx->Exec, (pname, value));
3538 }
3539 }
3540
3541
3542 static void GLAPIENTRY
3543 save_PatchParameterfv(GLenum pname, const GLfloat *params)
3544 {
3545 GET_CURRENT_CONTEXT(ctx);
3546 Node *n;
3547 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3548
3549 if (pname == GL_PATCH_DEFAULT_OUTER_LEVEL) {
3550 n = alloc_instruction(ctx, OPCODE_PATCH_PARAMETER_FV_OUTER, 5);
3551 } else {
3552 assert(pname == GL_PATCH_DEFAULT_INNER_LEVEL);
3553 n = alloc_instruction(ctx, OPCODE_PATCH_PARAMETER_FV_INNER, 3);
3554 }
3555 if (n) {
3556 n[1].e = pname;
3557 if (pname == GL_PATCH_DEFAULT_OUTER_LEVEL) {
3558 n[2].f = params[0];
3559 n[3].f = params[1];
3560 n[4].f = params[2];
3561 n[5].f = params[3];
3562 } else {
3563 n[2].f = params[0];
3564 n[3].f = params[1];
3565 }
3566 }
3567 if (ctx->ExecuteFlag) {
3568 CALL_PatchParameterfv(ctx->Exec, (pname, params));
3569 }
3570 }
3571
3572
3573 static void GLAPIENTRY
3574 save_PixelMapfv(GLenum map, GLint mapsize, const GLfloat *values)
3575 {
3576 GET_CURRENT_CONTEXT(ctx);
3577 Node *n;
3578 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3579 n = alloc_instruction(ctx, OPCODE_PIXEL_MAP, 2 + POINTER_DWORDS);
3580 if (n) {
3581 n[1].e = map;
3582 n[2].i = mapsize;
3583 save_pointer(&n[3], memdup(values, mapsize * sizeof(GLfloat)));
3584 }
3585 if (ctx->ExecuteFlag) {
3586 CALL_PixelMapfv(ctx->Exec, (map, mapsize, values));
3587 }
3588 }
3589
3590
3591 static void GLAPIENTRY
3592 save_PixelMapuiv(GLenum map, GLint mapsize, const GLuint *values)
3593 {
3594 GLfloat fvalues[MAX_PIXEL_MAP_TABLE];
3595 GLint i;
3596 if (map == GL_PIXEL_MAP_I_TO_I || map == GL_PIXEL_MAP_S_TO_S) {
3597 for (i = 0; i < mapsize; i++) {
3598 fvalues[i] = (GLfloat) values[i];
3599 }
3600 }
3601 else {
3602 for (i = 0; i < mapsize; i++) {
3603 fvalues[i] = UINT_TO_FLOAT(values[i]);
3604 }
3605 }
3606 save_PixelMapfv(map, mapsize, fvalues);
3607 }
3608
3609
3610 static void GLAPIENTRY
3611 save_PixelMapusv(GLenum map, GLint mapsize, const GLushort *values)
3612 {
3613 GLfloat fvalues[MAX_PIXEL_MAP_TABLE];
3614 GLint i;
3615 if (map == GL_PIXEL_MAP_I_TO_I || map == GL_PIXEL_MAP_S_TO_S) {
3616 for (i = 0; i < mapsize; i++) {
3617 fvalues[i] = (GLfloat) values[i];
3618 }
3619 }
3620 else {
3621 for (i = 0; i < mapsize; i++) {
3622 fvalues[i] = USHORT_TO_FLOAT(values[i]);
3623 }
3624 }
3625 save_PixelMapfv(map, mapsize, fvalues);
3626 }
3627
3628
3629 static void GLAPIENTRY
3630 save_PixelTransferf(GLenum pname, GLfloat param)
3631 {
3632 GET_CURRENT_CONTEXT(ctx);
3633 Node *n;
3634 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3635 n = alloc_instruction(ctx, OPCODE_PIXEL_TRANSFER, 2);
3636 if (n) {
3637 n[1].e = pname;
3638 n[2].f = param;
3639 }
3640 if (ctx->ExecuteFlag) {
3641 CALL_PixelTransferf(ctx->Exec, (pname, param));
3642 }
3643 }
3644
3645
3646 static void GLAPIENTRY
3647 save_PixelTransferi(GLenum pname, GLint param)
3648 {
3649 save_PixelTransferf(pname, (GLfloat) param);
3650 }
3651
3652
3653 static void GLAPIENTRY
3654 save_PixelZoom(GLfloat xfactor, GLfloat yfactor)
3655 {
3656 GET_CURRENT_CONTEXT(ctx);
3657 Node *n;
3658 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3659 n = alloc_instruction(ctx, OPCODE_PIXEL_ZOOM, 2);
3660 if (n) {
3661 n[1].f = xfactor;
3662 n[2].f = yfactor;
3663 }
3664 if (ctx->ExecuteFlag) {
3665 CALL_PixelZoom(ctx->Exec, (xfactor, yfactor));
3666 }
3667 }
3668
3669
3670 static void GLAPIENTRY
3671 save_PointParameterfvEXT(GLenum pname, const GLfloat *params)
3672 {
3673 GET_CURRENT_CONTEXT(ctx);
3674 Node *n;
3675 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3676 n = alloc_instruction(ctx, OPCODE_POINT_PARAMETERS, 4);
3677 if (n) {
3678 n[1].e = pname;
3679 n[2].f = params[0];
3680 n[3].f = params[1];
3681 n[4].f = params[2];
3682 }
3683 if (ctx->ExecuteFlag) {
3684 CALL_PointParameterfv(ctx->Exec, (pname, params));
3685 }
3686 }
3687
3688
3689 static void GLAPIENTRY
3690 save_PointParameterfEXT(GLenum pname, GLfloat param)
3691 {
3692 GLfloat parray[3];
3693 parray[0] = param;
3694 parray[1] = parray[2] = 0.0F;
3695 save_PointParameterfvEXT(pname, parray);
3696 }
3697
3698 static void GLAPIENTRY
3699 save_PointParameteriNV(GLenum pname, GLint param)
3700 {
3701 GLfloat parray[3];
3702 parray[0] = (GLfloat) param;
3703 parray[1] = parray[2] = 0.0F;
3704 save_PointParameterfvEXT(pname, parray);
3705 }
3706
3707 static void GLAPIENTRY
3708 save_PointParameterivNV(GLenum pname, const GLint * param)
3709 {
3710 GLfloat parray[3];
3711 parray[0] = (GLfloat) param[0];
3712 parray[1] = parray[2] = 0.0F;
3713 save_PointParameterfvEXT(pname, parray);
3714 }
3715
3716
3717 static void GLAPIENTRY
3718 save_PointSize(GLfloat size)
3719 {
3720 GET_CURRENT_CONTEXT(ctx);
3721 Node *n;
3722 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3723 n = alloc_instruction(ctx, OPCODE_POINT_SIZE, 1);
3724 if (n) {
3725 n[1].f = size;
3726 }
3727 if (ctx->ExecuteFlag) {
3728 CALL_PointSize(ctx->Exec, (size));
3729 }
3730 }
3731
3732
3733 static void GLAPIENTRY
3734 save_PolygonMode(GLenum face, GLenum mode)
3735 {
3736 GET_CURRENT_CONTEXT(ctx);
3737 Node *n;
3738 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3739 n = alloc_instruction(ctx, OPCODE_POLYGON_MODE, 2);
3740 if (n) {
3741 n[1].e = face;
3742 n[2].e = mode;
3743 }
3744 if (ctx->ExecuteFlag) {
3745 CALL_PolygonMode(ctx->Exec, (face, mode));
3746 }
3747 }
3748
3749
3750 static void GLAPIENTRY
3751 save_PolygonStipple(const GLubyte * pattern)
3752 {
3753 GET_CURRENT_CONTEXT(ctx);
3754 Node *n;
3755
3756 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3757
3758 n = alloc_instruction(ctx, OPCODE_POLYGON_STIPPLE, POINTER_DWORDS);
3759 if (n) {
3760 save_pointer(&n[1],
3761 unpack_image(ctx, 2, 32, 32, 1, GL_COLOR_INDEX, GL_BITMAP,
3762 pattern, &ctx->Unpack));
3763 }
3764 if (ctx->ExecuteFlag) {
3765 CALL_PolygonStipple(ctx->Exec, ((GLubyte *) pattern));
3766 }
3767 }
3768
3769
3770 static void GLAPIENTRY
3771 save_PolygonOffset(GLfloat factor, GLfloat units)
3772 {
3773 GET_CURRENT_CONTEXT(ctx);
3774 Node *n;
3775 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3776 n = alloc_instruction(ctx, OPCODE_POLYGON_OFFSET, 2);
3777 if (n) {
3778 n[1].f = factor;
3779 n[2].f = units;
3780 }
3781 if (ctx->ExecuteFlag) {
3782 CALL_PolygonOffset(ctx->Exec, (factor, units));
3783 }
3784 }
3785
3786
3787 static void GLAPIENTRY
3788 save_PolygonOffsetClampEXT(GLfloat factor, GLfloat units, GLfloat clamp)
3789 {
3790 GET_CURRENT_CONTEXT(ctx);
3791 Node *n;
3792 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3793 n = alloc_instruction(ctx, OPCODE_POLYGON_OFFSET_CLAMP, 3);
3794 if (n) {
3795 n[1].f = factor;
3796 n[2].f = units;
3797 n[3].f = clamp;
3798 }
3799 if (ctx->ExecuteFlag) {
3800 CALL_PolygonOffsetClampEXT(ctx->Exec, (factor, units, clamp));
3801 }
3802 }
3803
3804 static void GLAPIENTRY
3805 save_PopAttrib(void)
3806 {
3807 GET_CURRENT_CONTEXT(ctx);
3808 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3809 (void) alloc_instruction(ctx, OPCODE_POP_ATTRIB, 0);
3810 if (ctx->ExecuteFlag) {
3811 CALL_PopAttrib(ctx->Exec, ());
3812 }
3813 }
3814
3815
3816 static void GLAPIENTRY
3817 save_PopMatrix(void)
3818 {
3819 GET_CURRENT_CONTEXT(ctx);
3820 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3821 (void) alloc_instruction(ctx, OPCODE_POP_MATRIX, 0);
3822 if (ctx->ExecuteFlag) {
3823 CALL_PopMatrix(ctx->Exec, ());
3824 }
3825 }
3826
3827
3828 static void GLAPIENTRY
3829 save_PopName(void)
3830 {
3831 GET_CURRENT_CONTEXT(ctx);
3832 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3833 (void) alloc_instruction(ctx, OPCODE_POP_NAME, 0);
3834 if (ctx->ExecuteFlag) {
3835 CALL_PopName(ctx->Exec, ());
3836 }
3837 }
3838
3839
3840 static void GLAPIENTRY
3841 save_PrioritizeTextures(GLsizei num, const GLuint * textures,
3842 const GLclampf * priorities)
3843 {
3844 GET_CURRENT_CONTEXT(ctx);
3845 GLint i;
3846 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3847
3848 for (i = 0; i < num; i++) {
3849 Node *n;
3850 n = alloc_instruction(ctx, OPCODE_PRIORITIZE_TEXTURE, 2);
3851 if (n) {
3852 n[1].ui = textures[i];
3853 n[2].f = priorities[i];
3854 }
3855 }
3856 if (ctx->ExecuteFlag) {
3857 CALL_PrioritizeTextures(ctx->Exec, (num, textures, priorities));
3858 }
3859 }
3860
3861
3862 static void GLAPIENTRY
3863 save_PushAttrib(GLbitfield mask)
3864 {
3865 GET_CURRENT_CONTEXT(ctx);
3866 Node *n;
3867 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3868 n = alloc_instruction(ctx, OPCODE_PUSH_ATTRIB, 1);
3869 if (n) {
3870 n[1].bf = mask;
3871 }
3872 if (ctx->ExecuteFlag) {
3873 CALL_PushAttrib(ctx->Exec, (mask));
3874 }
3875 }
3876
3877
3878 static void GLAPIENTRY
3879 save_PushMatrix(void)
3880 {
3881 GET_CURRENT_CONTEXT(ctx);
3882 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3883 (void) alloc_instruction(ctx, OPCODE_PUSH_MATRIX, 0);
3884 if (ctx->ExecuteFlag) {
3885 CALL_PushMatrix(ctx->Exec, ());
3886 }
3887 }
3888
3889
3890 static void GLAPIENTRY
3891 save_PushName(GLuint name)
3892 {
3893 GET_CURRENT_CONTEXT(ctx);
3894 Node *n;
3895 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3896 n = alloc_instruction(ctx, OPCODE_PUSH_NAME, 1);
3897 if (n) {
3898 n[1].ui = name;
3899 }
3900 if (ctx->ExecuteFlag) {
3901 CALL_PushName(ctx->Exec, (name));
3902 }
3903 }
3904
3905
3906 static void GLAPIENTRY
3907 save_RasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
3908 {
3909 GET_CURRENT_CONTEXT(ctx);
3910 Node *n;
3911 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3912 n = alloc_instruction(ctx, OPCODE_RASTER_POS, 4);
3913 if (n) {
3914 n[1].f = x;
3915 n[2].f = y;
3916 n[3].f = z;
3917 n[4].f = w;
3918 }
3919 if (ctx->ExecuteFlag) {
3920 CALL_RasterPos4f(ctx->Exec, (x, y, z, w));
3921 }
3922 }
3923
3924 static void GLAPIENTRY
3925 save_RasterPos2d(GLdouble x, GLdouble y)
3926 {
3927 save_RasterPos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
3928 }
3929
3930 static void GLAPIENTRY
3931 save_RasterPos2f(GLfloat x, GLfloat y)
3932 {
3933 save_RasterPos4f(x, y, 0.0F, 1.0F);
3934 }
3935
3936 static void GLAPIENTRY
3937 save_RasterPos2i(GLint x, GLint y)
3938 {
3939 save_RasterPos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
3940 }
3941
3942 static void GLAPIENTRY
3943 save_RasterPos2s(GLshort x, GLshort y)
3944 {
3945 save_RasterPos4f(x, y, 0.0F, 1.0F);
3946 }
3947
3948 static void GLAPIENTRY
3949 save_RasterPos3d(GLdouble x, GLdouble y, GLdouble z)
3950 {
3951 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
3952 }
3953
3954 static void GLAPIENTRY
3955 save_RasterPos3f(GLfloat x, GLfloat y, GLfloat z)
3956 {
3957 save_RasterPos4f(x, y, z, 1.0F);
3958 }
3959
3960 static void GLAPIENTRY
3961 save_RasterPos3i(GLint x, GLint y, GLint z)
3962 {
3963 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
3964 }
3965
3966 static void GLAPIENTRY
3967 save_RasterPos3s(GLshort x, GLshort y, GLshort z)
3968 {
3969 save_RasterPos4f(x, y, z, 1.0F);
3970 }
3971
3972 static void GLAPIENTRY
3973 save_RasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
3974 {
3975 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
3976 }
3977
3978 static void GLAPIENTRY
3979 save_RasterPos4i(GLint x, GLint y, GLint z, GLint w)
3980 {
3981 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
3982 }
3983
3984 static void GLAPIENTRY
3985 save_RasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w)
3986 {
3987 save_RasterPos4f(x, y, z, w);
3988 }
3989
3990 static void GLAPIENTRY
3991 save_RasterPos2dv(const GLdouble * v)
3992 {
3993 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
3994 }
3995
3996 static void GLAPIENTRY
3997 save_RasterPos2fv(const GLfloat * v)
3998 {
3999 save_RasterPos4f(v[0], v[1], 0.0F, 1.0F);
4000 }
4001
4002 static void GLAPIENTRY
4003 save_RasterPos2iv(const GLint * v)
4004 {
4005 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
4006 }
4007
4008 static void GLAPIENTRY
4009 save_RasterPos2sv(const GLshort * v)
4010 {
4011 save_RasterPos4f(v[0], v[1], 0.0F, 1.0F);
4012 }
4013
4014 static void GLAPIENTRY
4015 save_RasterPos3dv(const GLdouble * v)
4016 {
4017 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
4018 }
4019
4020 static void GLAPIENTRY
4021 save_RasterPos3fv(const GLfloat * v)
4022 {
4023 save_RasterPos4f(v[0], v[1], v[2], 1.0F);
4024 }
4025
4026 static void GLAPIENTRY
4027 save_RasterPos3iv(const GLint * v)
4028 {
4029 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
4030 }
4031
4032 static void GLAPIENTRY
4033 save_RasterPos3sv(const GLshort * v)
4034 {
4035 save_RasterPos4f(v[0], v[1], v[2], 1.0F);
4036 }
4037
4038 static void GLAPIENTRY
4039 save_RasterPos4dv(const GLdouble * v)
4040 {
4041 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1],
4042 (GLfloat) v[2], (GLfloat) v[3]);
4043 }
4044
4045 static void GLAPIENTRY
4046 save_RasterPos4fv(const GLfloat * v)
4047 {
4048 save_RasterPos4f(v[0], v[1], v[2], v[3]);
4049 }
4050
4051 static void GLAPIENTRY
4052 save_RasterPos4iv(const GLint * v)
4053 {
4054 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1],
4055 (GLfloat) v[2], (GLfloat) v[3]);
4056 }
4057
4058 static void GLAPIENTRY
4059 save_RasterPos4sv(const GLshort * v)
4060 {
4061 save_RasterPos4f(v[0], v[1], v[2], v[3]);
4062 }
4063
4064
4065 static void GLAPIENTRY
4066 save_PassThrough(GLfloat token)
4067 {
4068 GET_CURRENT_CONTEXT(ctx);
4069 Node *n;
4070 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4071 n = alloc_instruction(ctx, OPCODE_PASSTHROUGH, 1);
4072 if (n) {
4073 n[1].f = token;
4074 }
4075 if (ctx->ExecuteFlag) {
4076 CALL_PassThrough(ctx->Exec, (token));
4077 }
4078 }
4079
4080
4081 static void GLAPIENTRY
4082 save_ReadBuffer(GLenum mode)
4083 {
4084 GET_CURRENT_CONTEXT(ctx);
4085 Node *n;
4086 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4087 n = alloc_instruction(ctx, OPCODE_READ_BUFFER, 1);
4088 if (n) {
4089 n[1].e = mode;
4090 }
4091 if (ctx->ExecuteFlag) {
4092 CALL_ReadBuffer(ctx->Exec, (mode));
4093 }
4094 }
4095
4096
4097 static void GLAPIENTRY
4098 save_Rotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
4099 {
4100 GET_CURRENT_CONTEXT(ctx);
4101 Node *n;
4102 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4103 n = alloc_instruction(ctx, OPCODE_ROTATE, 4);
4104 if (n) {
4105 n[1].f = angle;
4106 n[2].f = x;
4107 n[3].f = y;
4108 n[4].f = z;
4109 }
4110 if (ctx->ExecuteFlag) {
4111 CALL_Rotatef(ctx->Exec, (angle, x, y, z));
4112 }
4113 }
4114
4115
4116 static void GLAPIENTRY
4117 save_Rotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
4118 {
4119 save_Rotatef((GLfloat) angle, (GLfloat) x, (GLfloat) y, (GLfloat) z);
4120 }
4121
4122
4123 static void GLAPIENTRY
4124 save_Scalef(GLfloat x, GLfloat y, GLfloat z)
4125 {
4126 GET_CURRENT_CONTEXT(ctx);
4127 Node *n;
4128 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4129 n = alloc_instruction(ctx, OPCODE_SCALE, 3);
4130 if (n) {
4131 n[1].f = x;
4132 n[2].f = y;
4133 n[3].f = z;
4134 }
4135 if (ctx->ExecuteFlag) {
4136 CALL_Scalef(ctx->Exec, (x, y, z));
4137 }
4138 }
4139
4140
4141 static void GLAPIENTRY
4142 save_Scaled(GLdouble x, GLdouble y, GLdouble z)
4143 {
4144 save_Scalef((GLfloat) x, (GLfloat) y, (GLfloat) z);
4145 }
4146
4147
4148 static void GLAPIENTRY
4149 save_Scissor(GLint x, GLint y, GLsizei width, GLsizei height)
4150 {
4151 GET_CURRENT_CONTEXT(ctx);
4152 Node *n;
4153 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4154 n = alloc_instruction(ctx, OPCODE_SCISSOR, 4);
4155 if (n) {
4156 n[1].i = x;
4157 n[2].i = y;
4158 n[3].i = width;
4159 n[4].i = height;
4160 }
4161 if (ctx->ExecuteFlag) {
4162 CALL_Scissor(ctx->Exec, (x, y, width, height));
4163 }
4164 }
4165
4166
4167 static void GLAPIENTRY
4168 save_ShadeModel(GLenum mode)
4169 {
4170 GET_CURRENT_CONTEXT(ctx);
4171 Node *n;
4172 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx);
4173
4174 if (ctx->ExecuteFlag) {
4175 CALL_ShadeModel(ctx->Exec, (mode));
4176 }
4177
4178 /* Don't compile this call if it's a no-op.
4179 * By avoiding this state change we have a better chance of
4180 * coalescing subsequent drawing commands into one batch.
4181 */
4182 if (ctx->ListState.Current.ShadeModel == mode)
4183 return;
4184
4185 SAVE_FLUSH_VERTICES(ctx);
4186
4187 ctx->ListState.Current.ShadeModel = mode;
4188
4189 n = alloc_instruction(ctx, OPCODE_SHADE_MODEL, 1);
4190 if (n) {
4191 n[1].e = mode;
4192 }
4193 }
4194
4195
4196 static void GLAPIENTRY
4197 save_StencilFunc(GLenum func, GLint ref, GLuint mask)
4198 {
4199 GET_CURRENT_CONTEXT(ctx);
4200 Node *n;
4201 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4202 n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC, 3);
4203 if (n) {
4204 n[1].e = func;
4205 n[2].i = ref;
4206 n[3].ui = mask;
4207 }
4208 if (ctx->ExecuteFlag) {
4209 CALL_StencilFunc(ctx->Exec, (func, ref, mask));
4210 }
4211 }
4212
4213
4214 static void GLAPIENTRY
4215 save_StencilMask(GLuint mask)
4216 {
4217 GET_CURRENT_CONTEXT(ctx);
4218 Node *n;
4219 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4220 n = alloc_instruction(ctx, OPCODE_STENCIL_MASK, 1);
4221 if (n) {
4222 n[1].ui = mask;
4223 }
4224 if (ctx->ExecuteFlag) {
4225 CALL_StencilMask(ctx->Exec, (mask));
4226 }
4227 }
4228
4229
4230 static void GLAPIENTRY
4231 save_StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
4232 {
4233 GET_CURRENT_CONTEXT(ctx);
4234 Node *n;
4235 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4236 n = alloc_instruction(ctx, OPCODE_STENCIL_OP, 3);
4237 if (n) {
4238 n[1].e = fail;
4239 n[2].e = zfail;
4240 n[3].e = zpass;
4241 }
4242 if (ctx->ExecuteFlag) {
4243 CALL_StencilOp(ctx->Exec, (fail, zfail, zpass));
4244 }
4245 }
4246
4247
4248 static void GLAPIENTRY
4249 save_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
4250 {
4251 GET_CURRENT_CONTEXT(ctx);
4252 Node *n;
4253 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4254 n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4);
4255 if (n) {
4256 n[1].e = face;
4257 n[2].e = func;
4258 n[3].i = ref;
4259 n[4].ui = mask;
4260 }
4261 if (ctx->ExecuteFlag) {
4262 CALL_StencilFuncSeparate(ctx->Exec, (face, func, ref, mask));
4263 }
4264 }
4265
4266
4267 static void GLAPIENTRY
4268 save_StencilFuncSeparateATI(GLenum frontfunc, GLenum backfunc, GLint ref,
4269 GLuint mask)
4270 {
4271 GET_CURRENT_CONTEXT(ctx);
4272 Node *n;
4273 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4274 /* GL_FRONT */
4275 n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4);
4276 if (n) {
4277 n[1].e = GL_FRONT;
4278 n[2].e = frontfunc;
4279 n[3].i = ref;
4280 n[4].ui = mask;
4281 }
4282 /* GL_BACK */
4283 n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4);
4284 if (n) {
4285 n[1].e = GL_BACK;
4286 n[2].e = backfunc;
4287 n[3].i = ref;
4288 n[4].ui = mask;
4289 }
4290 if (ctx->ExecuteFlag) {
4291 CALL_StencilFuncSeparate(ctx->Exec, (GL_FRONT, frontfunc, ref, mask));
4292 CALL_StencilFuncSeparate(ctx->Exec, (GL_BACK, backfunc, ref, mask));
4293 }
4294 }
4295
4296
4297 static void GLAPIENTRY
4298 save_StencilMaskSeparate(GLenum face, GLuint mask)
4299 {
4300 GET_CURRENT_CONTEXT(ctx);
4301 Node *n;
4302 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4303 n = alloc_instruction(ctx, OPCODE_STENCIL_MASK_SEPARATE, 2);
4304 if (n) {
4305 n[1].e = face;
4306 n[2].ui = mask;
4307 }
4308 if (ctx->ExecuteFlag) {
4309 CALL_StencilMaskSeparate(ctx->Exec, (face, mask));
4310 }
4311 }
4312
4313
4314 static void GLAPIENTRY
4315 save_StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
4316 {
4317 GET_CURRENT_CONTEXT(ctx);
4318 Node *n;
4319 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4320 n = alloc_instruction(ctx, OPCODE_STENCIL_OP_SEPARATE, 4);
4321 if (n) {
4322 n[1].e = face;
4323 n[2].e = fail;
4324 n[3].e = zfail;
4325 n[4].e = zpass;
4326 }
4327 if (ctx->ExecuteFlag) {
4328 CALL_StencilOpSeparate(ctx->Exec, (face, fail, zfail, zpass));
4329 }
4330 }
4331
4332
4333 static void GLAPIENTRY
4334 save_TexEnvfv(GLenum target, GLenum pname, const GLfloat *params)
4335 {
4336 GET_CURRENT_CONTEXT(ctx);
4337 Node *n;
4338 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4339 n = alloc_instruction(ctx, OPCODE_TEXENV, 6);
4340 if (n) {
4341 n[1].e = target;
4342 n[2].e = pname;
4343 if (pname == GL_TEXTURE_ENV_COLOR) {
4344 n[3].f = params[0];
4345 n[4].f = params[1];
4346 n[5].f = params[2];
4347 n[6].f = params[3];
4348 }
4349 else {
4350 n[3].f = params[0];
4351 n[4].f = n[5].f = n[6].f = 0.0F;
4352 }
4353 }
4354 if (ctx->ExecuteFlag) {
4355 CALL_TexEnvfv(ctx->Exec, (target, pname, params));
4356 }
4357 }
4358
4359
4360 static void GLAPIENTRY
4361 save_TexEnvf(GLenum target, GLenum pname, GLfloat param)
4362 {
4363 GLfloat parray[4];
4364 parray[0] = (GLfloat) param;
4365 parray[1] = parray[2] = parray[3] = 0.0F;
4366 save_TexEnvfv(target, pname, parray);
4367 }
4368
4369
4370 static void GLAPIENTRY
4371 save_TexEnvi(GLenum target, GLenum pname, GLint param)
4372 {
4373 GLfloat p[4];
4374 p[0] = (GLfloat) param;
4375 p[1] = p[2] = p[3] = 0.0F;
4376 save_TexEnvfv(target, pname, p);
4377 }
4378
4379
4380 static void GLAPIENTRY
4381 save_TexEnviv(GLenum target, GLenum pname, const GLint * param)
4382 {
4383 GLfloat p[4];
4384 if (pname == GL_TEXTURE_ENV_COLOR) {
4385 p[0] = INT_TO_FLOAT(param[0]);
4386 p[1] = INT_TO_FLOAT(param[1]);
4387 p[2] = INT_TO_FLOAT(param[2]);
4388 p[3] = INT_TO_FLOAT(param[3]);
4389 }
4390 else {
4391 p[0] = (GLfloat) param[0];
4392 p[1] = p[2] = p[3] = 0.0F;
4393 }
4394 save_TexEnvfv(target, pname, p);
4395 }
4396
4397
4398 static void GLAPIENTRY
4399 save_TexGenfv(GLenum coord, GLenum pname, const GLfloat *params)
4400 {
4401 GET_CURRENT_CONTEXT(ctx);
4402 Node *n;
4403 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4404 n = alloc_instruction(ctx, OPCODE_TEXGEN, 6);
4405 if (n) {
4406 n[1].e = coord;
4407 n[2].e = pname;
4408 n[3].f = params[0];
4409 n[4].f = params[1];
4410 n[5].f = params[2];
4411 n[6].f = params[3];
4412 }
4413 if (ctx->ExecuteFlag) {
4414 CALL_TexGenfv(ctx->Exec, (coord, pname, params));
4415 }
4416 }
4417
4418
4419 static void GLAPIENTRY
4420 save_TexGeniv(GLenum coord, GLenum pname, const GLint *params)
4421 {
4422 GLfloat p[4];
4423 p[0] = (GLfloat) params[0];
4424 p[1] = (GLfloat) params[1];
4425 p[2] = (GLfloat) params[2];
4426 p[3] = (GLfloat) params[3];
4427 save_TexGenfv(coord, pname, p);
4428 }
4429
4430
4431 static void GLAPIENTRY
4432 save_TexGend(GLenum coord, GLenum pname, GLdouble param)
4433 {
4434 GLfloat parray[4];
4435 parray[0] = (GLfloat) param;
4436 parray[1] = parray[2] = parray[3] = 0.0F;
4437 save_TexGenfv(coord, pname, parray);
4438 }
4439
4440
4441 static void GLAPIENTRY
4442 save_TexGendv(GLenum coord, GLenum pname, const GLdouble *params)
4443 {
4444 GLfloat p[4];
4445 p[0] = (GLfloat) params[0];
4446 p[1] = (GLfloat) params[1];
4447 p[2] = (GLfloat) params[2];
4448 p[3] = (GLfloat) params[3];
4449 save_TexGenfv(coord, pname, p);
4450 }
4451
4452
4453 static void GLAPIENTRY
4454 save_TexGenf(GLenum coord, GLenum pname, GLfloat param)
4455 {
4456 GLfloat parray[4];
4457 parray[0] = param;
4458 parray[1] = parray[2] = parray[3] = 0.0F;
4459 save_TexGenfv(coord, pname, parray);
4460 }
4461
4462
4463 static void GLAPIENTRY
4464 save_TexGeni(GLenum coord, GLenum pname, GLint param)
4465 {
4466 GLint parray[4];
4467 parray[0] = param;
4468 parray[1] = parray[2] = parray[3] = 0;
4469 save_TexGeniv(coord, pname, parray);
4470 }
4471
4472
4473 static void GLAPIENTRY
4474 save_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
4475 {
4476 GET_CURRENT_CONTEXT(ctx);
4477 Node *n;
4478 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4479 n = alloc_instruction(ctx, OPCODE_TEXPARAMETER, 6);
4480 if (n) {
4481 n[1].e = target;
4482 n[2].e = pname;
4483 n[3].f = params[0];
4484 n[4].f = params[1];
4485 n[5].f = params[2];
4486 n[6].f = params[3];
4487 }
4488 if (ctx->ExecuteFlag) {
4489 CALL_TexParameterfv(ctx->Exec, (target, pname, params));
4490 }
4491 }
4492
4493
4494 static void GLAPIENTRY
4495 save_TexParameterf(GLenum target, GLenum pname, GLfloat param)
4496 {
4497 GLfloat parray[4];
4498 parray[0] = param;
4499 parray[1] = parray[2] = parray[3] = 0.0F;
4500 save_TexParameterfv(target, pname, parray);
4501 }
4502
4503
4504 static void GLAPIENTRY
4505 save_TexParameteri(GLenum target, GLenum pname, GLint param)
4506 {
4507 GLfloat fparam[4];
4508 fparam[0] = (GLfloat) param;
4509 fparam[1] = fparam[2] = fparam[3] = 0.0F;
4510 save_TexParameterfv(target, pname, fparam);
4511 }
4512
4513
4514 static void GLAPIENTRY
4515 save_TexParameteriv(GLenum target, GLenum pname, const GLint *params)
4516 {
4517 GLfloat fparam[4];
4518 fparam[0] = (GLfloat) params[0];
4519 fparam[1] = fparam[2] = fparam[3] = 0.0F;
4520 save_TexParameterfv(target, pname, fparam);
4521 }
4522
4523
4524 static void GLAPIENTRY
4525 save_TexImage1D(GLenum target,
4526 GLint level, GLint components,
4527 GLsizei width, GLint border,
4528 GLenum format, GLenum type, const GLvoid * pixels)
4529 {
4530 GET_CURRENT_CONTEXT(ctx);
4531 if (target == GL_PROXY_TEXTURE_1D) {
4532 /* don't compile, execute immediately */
4533 CALL_TexImage1D(ctx->Exec, (target, level, components, width,
4534 border, format, type, pixels));
4535 }
4536 else {
4537 Node *n;
4538 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4539 n = alloc_instruction(ctx, OPCODE_TEX_IMAGE1D, 7 + POINTER_DWORDS);
4540 if (n) {
4541 n[1].e = target;
4542 n[2].i = level;
4543 n[3].i = components;
4544 n[4].i = (GLint) width;
4545 n[5].i = border;
4546 n[6].e = format;
4547 n[7].e = type;
4548 save_pointer(&n[8],
4549 unpack_image(ctx, 1, width, 1, 1, format, type,
4550 pixels, &ctx->Unpack));
4551 }
4552 if (ctx->ExecuteFlag) {
4553 CALL_TexImage1D(ctx->Exec, (target, level, components, width,
4554 border, format, type, pixels));
4555 }
4556 }
4557 }
4558
4559
4560 static void GLAPIENTRY
4561 save_TexImage2D(GLenum target,
4562 GLint level, GLint components,
4563 GLsizei width, GLsizei height, GLint border,
4564 GLenum format, GLenum type, const GLvoid * pixels)
4565 {
4566 GET_CURRENT_CONTEXT(ctx);
4567 if (target == GL_PROXY_TEXTURE_2D) {
4568 /* don't compile, execute immediately */
4569 CALL_TexImage2D(ctx->Exec, (target, level, components, width,
4570 height, border, format, type, pixels));
4571 }
4572 else {
4573 Node *n;
4574 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4575 n = alloc_instruction(ctx, OPCODE_TEX_IMAGE2D, 8 + POINTER_DWORDS);
4576 if (n) {
4577 n[1].e = target;
4578 n[2].i = level;
4579 n[3].i = components;
4580 n[4].i = (GLint) width;
4581 n[5].i = (GLint) height;
4582 n[6].i = border;
4583 n[7].e = format;
4584 n[8].e = type;
4585 save_pointer(&n[9],
4586 unpack_image(ctx, 2, width, height, 1, format, type,
4587 pixels, &ctx->Unpack));
4588 }
4589 if (ctx->ExecuteFlag) {
4590 CALL_TexImage2D(ctx->Exec, (target, level, components, width,
4591 height, border, format, type, pixels));
4592 }
4593 }
4594 }
4595
4596
4597 static void GLAPIENTRY
4598 save_TexImage3D(GLenum target,
4599 GLint level, GLint internalFormat,
4600 GLsizei width, GLsizei height, GLsizei depth,
4601 GLint border,
4602 GLenum format, GLenum type, const GLvoid * pixels)
4603 {
4604 GET_CURRENT_CONTEXT(ctx);
4605 if (target == GL_PROXY_TEXTURE_3D) {
4606 /* don't compile, execute immediately */
4607 CALL_TexImage3D(ctx->Exec, (target, level, internalFormat, width,
4608 height, depth, border, format, type,
4609 pixels));
4610 }
4611 else {
4612 Node *n;
4613 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4614 n = alloc_instruction(ctx, OPCODE_TEX_IMAGE3D, 9 + POINTER_DWORDS);
4615 if (n) {
4616 n[1].e = target;
4617 n[2].i = level;
4618 n[3].i = (GLint) internalFormat;
4619 n[4].i = (GLint) width;
4620 n[5].i = (GLint) height;
4621 n[6].i = (GLint) depth;
4622 n[7].i = border;
4623 n[8].e = format;
4624 n[9].e = type;
4625 save_pointer(&n[10],
4626 unpack_image(ctx, 3, width, height, depth, format, type,
4627 pixels, &ctx->Unpack));
4628 }
4629 if (ctx->ExecuteFlag) {
4630 CALL_TexImage3D(ctx->Exec, (target, level, internalFormat, width,
4631 height, depth, border, format, type,
4632 pixels));
4633 }
4634 }
4635 }
4636
4637
4638 static void GLAPIENTRY
4639 save_TexSubImage1D(GLenum target, GLint level, GLint xoffset,
4640 GLsizei width, GLenum format, GLenum type,
4641 const GLvoid * pixels)
4642 {
4643 GET_CURRENT_CONTEXT(ctx);
4644 Node *n;
4645
4646 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4647
4648 n = alloc_instruction(ctx, OPCODE_TEX_SUB_IMAGE1D, 6 + POINTER_DWORDS);
4649 if (n) {
4650 n[1].e = target;
4651 n[2].i = level;
4652 n[3].i = xoffset;
4653 n[4].i = (GLint) width;
4654 n[5].e = format;
4655 n[6].e = type;
4656 save_pointer(&n[7],
4657 unpack_image(ctx, 1, width, 1, 1, format, type,
4658 pixels, &ctx->Unpack));
4659 }
4660 if (ctx->ExecuteFlag) {
4661 CALL_TexSubImage1D(ctx->Exec, (target, level, xoffset, width,
4662 format, type, pixels));
4663 }
4664 }
4665
4666
4667 static void GLAPIENTRY
4668 save_TexSubImage2D(GLenum target, GLint level,
4669 GLint xoffset, GLint yoffset,
4670 GLsizei width, GLsizei height,
4671 GLenum format, GLenum type, const GLvoid * pixels)
4672 {
4673 GET_CURRENT_CONTEXT(ctx);
4674 Node *n;
4675
4676 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4677
4678 n = alloc_instruction(ctx, OPCODE_TEX_SUB_IMAGE2D, 8 + POINTER_DWORDS);
4679 if (n) {
4680 n[1].e = target;
4681 n[2].i = level;
4682 n[3].i = xoffset;
4683 n[4].i = yoffset;
4684 n[5].i = (GLint) width;
4685 n[6].i = (GLint) height;
4686 n[7].e = format;
4687 n[8].e = type;
4688 save_pointer(&n[9],
4689 unpack_image(ctx, 2, width, height, 1, format, type,
4690 pixels, &ctx->Unpack));
4691 }
4692 if (ctx->ExecuteFlag) {
4693 CALL_TexSubImage2D(ctx->Exec, (target, level, xoffset, yoffset,
4694 width, height, format, type, pixels));
4695 }
4696 }
4697
4698
4699 static void GLAPIENTRY
4700 save_TexSubImage3D(GLenum target, GLint level,
4701 GLint xoffset, GLint yoffset, GLint zoffset,
4702 GLsizei width, GLsizei height, GLsizei depth,
4703 GLenum format, GLenum type, const GLvoid * pixels)
4704 {
4705 GET_CURRENT_CONTEXT(ctx);
4706 Node *n;
4707
4708 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4709
4710 n = alloc_instruction(ctx, OPCODE_TEX_SUB_IMAGE3D, 10 + POINTER_DWORDS);
4711 if (n) {
4712 n[1].e = target;
4713 n[2].i = level;
4714 n[3].i = xoffset;
4715 n[4].i = yoffset;
4716 n[5].i = zoffset;
4717 n[6].i = (GLint) width;
4718 n[7].i = (GLint) height;
4719 n[8].i = (GLint) depth;
4720 n[9].e = format;
4721 n[10].e = type;
4722 save_pointer(&n[11],
4723 unpack_image(ctx, 3, width, height, depth, format, type,
4724 pixels, &ctx->Unpack));
4725 }
4726 if (ctx->ExecuteFlag) {
4727 CALL_TexSubImage3D(ctx->Exec, (target, level,
4728 xoffset, yoffset, zoffset,
4729 width, height, depth, format, type,
4730 pixels));
4731 }
4732 }
4733
4734
4735 static void GLAPIENTRY
4736 save_Translatef(GLfloat x, GLfloat y, GLfloat z)
4737 {
4738 GET_CURRENT_CONTEXT(ctx);
4739 Node *n;
4740 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4741 n = alloc_instruction(ctx, OPCODE_TRANSLATE, 3);
4742 if (n) {
4743 n[1].f = x;
4744 n[2].f = y;
4745 n[3].f = z;
4746 }
4747 if (ctx->ExecuteFlag) {
4748 CALL_Translatef(ctx->Exec, (x, y, z));
4749 }
4750 }
4751
4752
4753 static void GLAPIENTRY
4754 save_Translated(GLdouble x, GLdouble y, GLdouble z)
4755 {
4756 save_Translatef((GLfloat) x, (GLfloat) y, (GLfloat) z);
4757 }
4758
4759
4760
4761 static void GLAPIENTRY
4762 save_Viewport(GLint x, GLint y, GLsizei width, GLsizei height)
4763 {
4764 GET_CURRENT_CONTEXT(ctx);
4765 Node *n;
4766 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4767 n = alloc_instruction(ctx, OPCODE_VIEWPORT, 4);
4768 if (n) {
4769 n[1].i = x;
4770 n[2].i = y;
4771 n[3].i = (GLint) width;
4772 n[4].i = (GLint) height;
4773 }
4774 if (ctx->ExecuteFlag) {
4775 CALL_Viewport(ctx->Exec, (x, y, width, height));
4776 }
4777 }
4778
4779 static void GLAPIENTRY
4780 save_ViewportIndexedf(GLuint index, GLfloat x, GLfloat y, GLfloat width,
4781 GLfloat height)
4782 {
4783 GET_CURRENT_CONTEXT(ctx);
4784 Node *n;
4785 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4786 n = alloc_instruction(ctx, OPCODE_VIEWPORT_INDEXED_F, 5);
4787 if (n) {
4788 n[1].ui = index;
4789 n[2].f = x;
4790 n[3].f = y;
4791 n[4].f = width;
4792 n[5].f = height;
4793 }
4794 if (ctx->ExecuteFlag) {
4795 CALL_ViewportIndexedf(ctx->Exec, (index, x, y, width, height));
4796 }
4797 }
4798
4799 static void GLAPIENTRY
4800 save_ViewportIndexedfv(GLuint index, const GLfloat *v)
4801 {
4802 GET_CURRENT_CONTEXT(ctx);
4803 Node *n;
4804 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4805 n = alloc_instruction(ctx, OPCODE_VIEWPORT_INDEXED_FV, 5);
4806 if (n) {
4807 n[1].ui = index;
4808 n[2].f = v[0];
4809 n[3].f = v[1];
4810 n[4].f = v[2];
4811 n[5].f = v[3];
4812 }
4813 if (ctx->ExecuteFlag) {
4814 CALL_ViewportIndexedfv(ctx->Exec, (index, v));
4815 }
4816 }
4817
4818 static void GLAPIENTRY
4819 save_ViewportArrayv(GLuint first, GLsizei count, const GLfloat *v)
4820 {
4821 GET_CURRENT_CONTEXT(ctx);
4822 Node *n;
4823 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4824 n = alloc_instruction(ctx, OPCODE_VIEWPORT_ARRAY_V, 2 + POINTER_DWORDS);
4825 if (n) {
4826 n[1].ui = first;
4827 n[2].si = count;
4828 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLfloat)));
4829 }
4830 if (ctx->ExecuteFlag) {
4831 CALL_ViewportArrayv(ctx->Exec, (first, count, v));
4832 }
4833 }
4834
4835 static void GLAPIENTRY
4836 save_ScissorIndexed(GLuint index, GLint left, GLint bottom, GLsizei width,
4837 GLsizei height)
4838 {
4839 GET_CURRENT_CONTEXT(ctx);
4840 Node *n;
4841 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4842 n = alloc_instruction(ctx, OPCODE_SCISSOR_INDEXED, 5);
4843 if (n) {
4844 n[1].ui = index;
4845 n[2].i = left;
4846 n[3].i = bottom;
4847 n[4].si = width;
4848 n[5].si = height;
4849 }
4850 if (ctx->ExecuteFlag) {
4851 CALL_ScissorIndexed(ctx->Exec, (index, left, bottom, width, height));
4852 }
4853 }
4854
4855 static void GLAPIENTRY
4856 save_ScissorIndexedv(GLuint index, const GLint *v)
4857 {
4858 GET_CURRENT_CONTEXT(ctx);
4859 Node *n;
4860 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4861 n = alloc_instruction(ctx, OPCODE_SCISSOR_INDEXED_V, 5);
4862 if (n) {
4863 n[1].ui = index;
4864 n[2].i = v[0];
4865 n[3].i = v[1];
4866 n[4].si = v[2];
4867 n[5].si = v[3];
4868 }
4869 if (ctx->ExecuteFlag) {
4870 CALL_ScissorIndexedv(ctx->Exec, (index, v));
4871 }
4872 }
4873
4874 static void GLAPIENTRY
4875 save_ScissorArrayv(GLuint first, GLsizei count, const GLint *v)
4876 {
4877 GET_CURRENT_CONTEXT(ctx);
4878 Node *n;
4879 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4880 n = alloc_instruction(ctx, OPCODE_SCISSOR_ARRAY_V, 2 + POINTER_DWORDS);
4881 if (n) {
4882 n[1].ui = first;
4883 n[2].si = count;
4884 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLint)));
4885 }
4886 if (ctx->ExecuteFlag) {
4887 CALL_ScissorArrayv(ctx->Exec, (first, count, v));
4888 }
4889 }
4890
4891 static void GLAPIENTRY
4892 save_DepthRangeIndexed(GLuint index, GLclampd n, GLclampd f)
4893 {
4894 GET_CURRENT_CONTEXT(ctx);
4895 Node *node;
4896 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4897 node = alloc_instruction(ctx, OPCODE_DEPTH_INDEXED, 3);
4898 if (node) {
4899 node[1].ui = index;
4900 /* Mesa stores these as floats internally so we deliberately convert
4901 * them to a float here.
4902 */
4903 node[2].f = n;
4904 node[3].f = f;
4905 }
4906 if (ctx->ExecuteFlag) {
4907 CALL_DepthRangeIndexed(ctx->Exec, (index, n, f));
4908 }
4909 }
4910
4911 static void GLAPIENTRY
4912 save_DepthRangeArrayv(GLuint first, GLsizei count, const GLclampd *v)
4913 {
4914 GET_CURRENT_CONTEXT(ctx);
4915 Node *n;
4916 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4917 n = alloc_instruction(ctx, OPCODE_DEPTH_ARRAY_V, 2 + POINTER_DWORDS);
4918 if (n) {
4919 n[1].ui = first;
4920 n[2].si = count;
4921 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLclampd)));
4922 }
4923 if (ctx->ExecuteFlag) {
4924 CALL_DepthRangeArrayv(ctx->Exec, (first, count, v));
4925 }
4926 }
4927
4928 static void GLAPIENTRY
4929 save_WindowPos4fMESA(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
4930 {
4931 GET_CURRENT_CONTEXT(ctx);
4932 Node *n;
4933 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4934 n = alloc_instruction(ctx, OPCODE_WINDOW_POS, 4);
4935 if (n) {
4936 n[1].f = x;
4937 n[2].f = y;
4938 n[3].f = z;
4939 n[4].f = w;
4940 }
4941 if (ctx->ExecuteFlag) {
4942 CALL_WindowPos4fMESA(ctx->Exec, (x, y, z, w));
4943 }
4944 }
4945
4946 static void GLAPIENTRY
4947 save_WindowPos2dMESA(GLdouble x, GLdouble y)
4948 {
4949 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
4950 }
4951
4952 static void GLAPIENTRY
4953 save_WindowPos2fMESA(GLfloat x, GLfloat y)
4954 {
4955 save_WindowPos4fMESA(x, y, 0.0F, 1.0F);
4956 }
4957
4958 static void GLAPIENTRY
4959 save_WindowPos2iMESA(GLint x, GLint y)
4960 {
4961 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
4962 }
4963
4964 static void GLAPIENTRY
4965 save_WindowPos2sMESA(GLshort x, GLshort y)
4966 {
4967 save_WindowPos4fMESA(x, y, 0.0F, 1.0F);
4968 }
4969
4970 static void GLAPIENTRY
4971 save_WindowPos3dMESA(GLdouble x, GLdouble y, GLdouble z)
4972 {
4973 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
4974 }
4975
4976 static void GLAPIENTRY
4977 save_WindowPos3fMESA(GLfloat x, GLfloat y, GLfloat z)
4978 {
4979 save_WindowPos4fMESA(x, y, z, 1.0F);
4980 }
4981
4982 static void GLAPIENTRY
4983 save_WindowPos3iMESA(GLint x, GLint y, GLint z)
4984 {
4985 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
4986 }
4987
4988 static void GLAPIENTRY
4989 save_WindowPos3sMESA(GLshort x, GLshort y, GLshort z)
4990 {
4991 save_WindowPos4fMESA(x, y, z, 1.0F);
4992 }
4993
4994 static void GLAPIENTRY
4995 save_WindowPos4dMESA(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
4996 {
4997 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
4998 }
4999
5000 static void GLAPIENTRY
5001 save_WindowPos4iMESA(GLint x, GLint y, GLint z, GLint w)
5002 {
5003 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
5004 }
5005
5006 static void GLAPIENTRY
5007 save_WindowPos4sMESA(GLshort x, GLshort y, GLshort z, GLshort w)
5008 {
5009 save_WindowPos4fMESA(x, y, z, w);
5010 }
5011
5012 static void GLAPIENTRY
5013 save_WindowPos2dvMESA(const GLdouble * v)
5014 {
5015 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
5016 }
5017
5018 static void GLAPIENTRY
5019 save_WindowPos2fvMESA(const GLfloat * v)
5020 {
5021 save_WindowPos4fMESA(v[0], v[1], 0.0F, 1.0F);
5022 }
5023
5024 static void GLAPIENTRY
5025 save_WindowPos2ivMESA(const GLint * v)
5026 {
5027 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
5028 }
5029
5030 static void GLAPIENTRY
5031 save_WindowPos2svMESA(const GLshort * v)
5032 {
5033 save_WindowPos4fMESA(v[0], v[1], 0.0F, 1.0F);
5034 }
5035
5036 static void GLAPIENTRY
5037 save_WindowPos3dvMESA(const GLdouble * v)
5038 {
5039 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
5040 }
5041
5042 static void GLAPIENTRY
5043 save_WindowPos3fvMESA(const GLfloat * v)
5044 {
5045 save_WindowPos4fMESA(v[0], v[1], v[2], 1.0F);
5046 }
5047
5048 static void GLAPIENTRY
5049 save_WindowPos3ivMESA(const GLint * v)
5050 {
5051 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
5052 }
5053
5054 static void GLAPIENTRY
5055 save_WindowPos3svMESA(const GLshort * v)
5056 {
5057 save_WindowPos4fMESA(v[0], v[1], v[2], 1.0F);
5058 }
5059
5060 static void GLAPIENTRY
5061 save_WindowPos4dvMESA(const GLdouble * v)
5062 {
5063 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1],
5064 (GLfloat) v[2], (GLfloat) v[3]);
5065 }
5066
5067 static void GLAPIENTRY
5068 save_WindowPos4fvMESA(const GLfloat * v)
5069 {
5070 save_WindowPos4fMESA(v[0], v[1], v[2], v[3]);
5071 }
5072
5073 static void GLAPIENTRY
5074 save_WindowPos4ivMESA(const GLint * v)
5075 {
5076 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1],
5077 (GLfloat) v[2], (GLfloat) v[3]);
5078 }
5079
5080 static void GLAPIENTRY
5081 save_WindowPos4svMESA(const GLshort * v)
5082 {
5083 save_WindowPos4fMESA(v[0], v[1], v[2], v[3]);
5084 }
5085
5086
5087
5088 /* GL_ARB_multitexture */
5089 static void GLAPIENTRY
5090 save_ActiveTextureARB(GLenum target)
5091 {
5092 GET_CURRENT_CONTEXT(ctx);
5093 Node *n;
5094 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5095 n = alloc_instruction(ctx, OPCODE_ACTIVE_TEXTURE, 1);
5096 if (n) {
5097 n[1].e = target;
5098 }
5099 if (ctx->ExecuteFlag) {
5100 CALL_ActiveTexture(ctx->Exec, (target));
5101 }
5102 }
5103
5104
5105 /* GL_ARB_transpose_matrix */
5106
5107 static void GLAPIENTRY
5108 save_LoadTransposeMatrixdARB(const GLdouble m[16])
5109 {
5110 GLfloat tm[16];
5111 _math_transposefd(tm, m);
5112 save_LoadMatrixf(tm);
5113 }
5114
5115
5116 static void GLAPIENTRY
5117 save_LoadTransposeMatrixfARB(const GLfloat m[16])
5118 {
5119 GLfloat tm[16];
5120 _math_transposef(tm, m);
5121 save_LoadMatrixf(tm);
5122 }
5123
5124
5125 static void GLAPIENTRY
5126 save_MultTransposeMatrixdARB(const GLdouble m[16])
5127 {
5128 GLfloat tm[16];
5129 _math_transposefd(tm, m);
5130 save_MultMatrixf(tm);
5131 }
5132
5133
5134 static void GLAPIENTRY
5135 save_MultTransposeMatrixfARB(const GLfloat m[16])
5136 {
5137 GLfloat tm[16];
5138 _math_transposef(tm, m);
5139 save_MultMatrixf(tm);
5140 }
5141
5142 static GLvoid *copy_data(const GLvoid *data, GLsizei size, const char *func)
5143 {
5144 GET_CURRENT_CONTEXT(ctx);
5145 GLvoid *image;
5146
5147 if (!data)
5148 return NULL;
5149
5150 image = malloc(size);
5151 if (!image) {
5152 _mesa_error(ctx, GL_OUT_OF_MEMORY, "%s", func);
5153 return NULL;
5154 }
5155 memcpy(image, data, size);
5156
5157 return image;
5158 }
5159
5160
5161 /* GL_ARB_texture_compression */
5162 static void GLAPIENTRY
5163 save_CompressedTexImage1DARB(GLenum target, GLint level,
5164 GLenum internalFormat, GLsizei width,
5165 GLint border, GLsizei imageSize,
5166 const GLvoid * data)
5167 {
5168 GET_CURRENT_CONTEXT(ctx);
5169 if (target == GL_PROXY_TEXTURE_1D) {
5170 /* don't compile, execute immediately */
5171 CALL_CompressedTexImage1D(ctx->Exec, (target, level, internalFormat,
5172 width, border, imageSize,
5173 data));
5174 }
5175 else {
5176 Node *n;
5177 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5178
5179 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_1D,
5180 6 + POINTER_DWORDS);
5181 if (n) {
5182 n[1].e = target;
5183 n[2].i = level;
5184 n[3].e = internalFormat;
5185 n[4].i = (GLint) width;
5186 n[5].i = border;
5187 n[6].i = imageSize;
5188 save_pointer(&n[7],
5189 copy_data(data, imageSize, "glCompressedTexImage1DARB"));
5190 }
5191 if (ctx->ExecuteFlag) {
5192 CALL_CompressedTexImage1D(ctx->Exec,
5193 (target, level, internalFormat, width,
5194 border, imageSize, data));
5195 }
5196 }
5197 }
5198
5199
5200 static void GLAPIENTRY
5201 save_CompressedTexImage2DARB(GLenum target, GLint level,
5202 GLenum internalFormat, GLsizei width,
5203 GLsizei height, GLint border, GLsizei imageSize,
5204 const GLvoid * data)
5205 {
5206 GET_CURRENT_CONTEXT(ctx);
5207 if (target == GL_PROXY_TEXTURE_2D) {
5208 /* don't compile, execute immediately */
5209 CALL_CompressedTexImage2D(ctx->Exec, (target, level, internalFormat,
5210 width, height, 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_2D,
5218 7 + 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 = border;
5226 n[7].i = imageSize;
5227 save_pointer(&n[8],
5228 copy_data(data, imageSize, "glCompressedTexImage2DARB"));
5229 }
5230 if (ctx->ExecuteFlag) {
5231 CALL_CompressedTexImage2D(ctx->Exec,
5232 (target, level, internalFormat, width,
5233 height, border, imageSize, data));
5234 }
5235 }
5236 }
5237
5238
5239 static void GLAPIENTRY
5240 save_CompressedTexImage3DARB(GLenum target, GLint level,
5241 GLenum internalFormat, GLsizei width,
5242 GLsizei height, GLsizei depth, GLint border,
5243 GLsizei imageSize, const GLvoid * data)
5244 {
5245 GET_CURRENT_CONTEXT(ctx);
5246 if (target == GL_PROXY_TEXTURE_3D) {
5247 /* don't compile, execute immediately */
5248 CALL_CompressedTexImage3D(ctx->Exec, (target, level, internalFormat,
5249 width, height, depth, border,
5250 imageSize, data));
5251 }
5252 else {
5253 Node *n;
5254 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5255
5256 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_3D,
5257 8 + POINTER_DWORDS);
5258 if (n) {
5259 n[1].e = target;
5260 n[2].i = level;
5261 n[3].e = internalFormat;
5262 n[4].i = (GLint) width;
5263 n[5].i = (GLint) height;
5264 n[6].i = (GLint) depth;
5265 n[7].i = border;
5266 n[8].i = imageSize;
5267 save_pointer(&n[9],
5268 copy_data(data, imageSize, "glCompressedTexImage3DARB"));
5269 }
5270 if (ctx->ExecuteFlag) {
5271 CALL_CompressedTexImage3D(ctx->Exec,
5272 (target, level, internalFormat, width,
5273 height, depth, border, imageSize,
5274 data));
5275 }
5276 }
5277 }
5278
5279
5280 static void GLAPIENTRY
5281 save_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset,
5282 GLsizei width, GLenum format,
5283 GLsizei imageSize, const GLvoid * data)
5284 {
5285 Node *n;
5286 GET_CURRENT_CONTEXT(ctx);
5287 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5288
5289 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D,
5290 6 + POINTER_DWORDS);
5291 if (n) {
5292 n[1].e = target;
5293 n[2].i = level;
5294 n[3].i = xoffset;
5295 n[4].i = (GLint) width;
5296 n[5].e = format;
5297 n[6].i = imageSize;
5298 save_pointer(&n[7],
5299 copy_data(data, imageSize, "glCompressedTexSubImage1DARB"));
5300 }
5301 if (ctx->ExecuteFlag) {
5302 CALL_CompressedTexSubImage1D(ctx->Exec, (target, level, xoffset,
5303 width, format, imageSize,
5304 data));
5305 }
5306 }
5307
5308
5309 static void GLAPIENTRY
5310 save_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset,
5311 GLint yoffset, GLsizei width, GLsizei height,
5312 GLenum format, GLsizei imageSize,
5313 const GLvoid * data)
5314 {
5315 Node *n;
5316 GET_CURRENT_CONTEXT(ctx);
5317 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5318
5319 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D,
5320 8 + POINTER_DWORDS);
5321 if (n) {
5322 n[1].e = target;
5323 n[2].i = level;
5324 n[3].i = xoffset;
5325 n[4].i = yoffset;
5326 n[5].i = (GLint) width;
5327 n[6].i = (GLint) height;
5328 n[7].e = format;
5329 n[8].i = imageSize;
5330 save_pointer(&n[9],
5331 copy_data(data, imageSize, "glCompressedTexSubImage2DARB"));
5332 }
5333 if (ctx->ExecuteFlag) {
5334 CALL_CompressedTexSubImage2D(ctx->Exec,
5335 (target, level, xoffset, yoffset, width,
5336 height, format, imageSize, data));
5337 }
5338 }
5339
5340
5341 static void GLAPIENTRY
5342 save_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset,
5343 GLint yoffset, GLint zoffset, GLsizei width,
5344 GLsizei height, GLsizei depth, GLenum format,
5345 GLsizei imageSize, const GLvoid * data)
5346 {
5347 Node *n;
5348 GET_CURRENT_CONTEXT(ctx);
5349 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5350
5351 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D,
5352 10 + POINTER_DWORDS);
5353 if (n) {
5354 n[1].e = target;
5355 n[2].i = level;
5356 n[3].i = xoffset;
5357 n[4].i = yoffset;
5358 n[5].i = zoffset;
5359 n[6].i = (GLint) width;
5360 n[7].i = (GLint) height;
5361 n[8].i = (GLint) depth;
5362 n[9].e = format;
5363 n[10].i = imageSize;
5364 save_pointer(&n[11],
5365 copy_data(data, imageSize, "glCompressedTexSubImage3DARB"));
5366 }
5367 if (ctx->ExecuteFlag) {
5368 CALL_CompressedTexSubImage3D(ctx->Exec,
5369 (target, level, xoffset, yoffset,
5370 zoffset, width, height, depth, format,
5371 imageSize, data));
5372 }
5373 }
5374
5375
5376 /* GL_ARB_multisample */
5377 static void GLAPIENTRY
5378 save_SampleCoverageARB(GLclampf value, GLboolean invert)
5379 {
5380 GET_CURRENT_CONTEXT(ctx);
5381 Node *n;
5382 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5383 n = alloc_instruction(ctx, OPCODE_SAMPLE_COVERAGE, 2);
5384 if (n) {
5385 n[1].f = value;
5386 n[2].b = invert;
5387 }
5388 if (ctx->ExecuteFlag) {
5389 CALL_SampleCoverage(ctx->Exec, (value, invert));
5390 }
5391 }
5392
5393
5394 /*
5395 * GL_ARB_vertex_program
5396 */
5397 static void GLAPIENTRY
5398 save_BindProgramARB(GLenum target, GLuint id)
5399 {
5400 GET_CURRENT_CONTEXT(ctx);
5401 Node *n;
5402 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5403 n = alloc_instruction(ctx, OPCODE_BIND_PROGRAM_ARB, 2);
5404 if (n) {
5405 n[1].e = target;
5406 n[2].ui = id;
5407 }
5408 if (ctx->ExecuteFlag) {
5409 CALL_BindProgramARB(ctx->Exec, (target, id));
5410 }
5411 }
5412
5413 static void GLAPIENTRY
5414 save_ProgramEnvParameter4fARB(GLenum target, GLuint index,
5415 GLfloat x, GLfloat y, GLfloat z, GLfloat w)
5416 {
5417 GET_CURRENT_CONTEXT(ctx);
5418 Node *n;
5419 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5420 n = alloc_instruction(ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6);
5421 if (n) {
5422 n[1].e = target;
5423 n[2].ui = index;
5424 n[3].f = x;
5425 n[4].f = y;
5426 n[5].f = z;
5427 n[6].f = w;
5428 }
5429 if (ctx->ExecuteFlag) {
5430 CALL_ProgramEnvParameter4fARB(ctx->Exec, (target, index, x, y, z, w));
5431 }
5432 }
5433
5434
5435 static void GLAPIENTRY
5436 save_ProgramEnvParameter4fvARB(GLenum target, GLuint index,
5437 const GLfloat *params)
5438 {
5439 save_ProgramEnvParameter4fARB(target, index, params[0], params[1],
5440 params[2], params[3]);
5441 }
5442
5443
5444 static void GLAPIENTRY
5445 save_ProgramEnvParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
5446 const GLfloat * params)
5447 {
5448 GET_CURRENT_CONTEXT(ctx);
5449 Node *n;
5450 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5451
5452 if (count > 0) {
5453 GLint i;
5454 const GLfloat * p = params;
5455
5456 for (i = 0 ; i < count ; i++) {
5457 n = alloc_instruction(ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6);
5458 if (n) {
5459 n[1].e = target;
5460 n[2].ui = index;
5461 n[3].f = p[0];
5462 n[4].f = p[1];
5463 n[5].f = p[2];
5464 n[6].f = p[3];
5465 p += 4;
5466 }
5467 }
5468 }
5469
5470 if (ctx->ExecuteFlag) {
5471 CALL_ProgramEnvParameters4fvEXT(ctx->Exec, (target, index, count, params));
5472 }
5473 }
5474
5475
5476 static void GLAPIENTRY
5477 save_ProgramEnvParameter4dARB(GLenum target, GLuint index,
5478 GLdouble x, GLdouble y, GLdouble z, GLdouble w)
5479 {
5480 save_ProgramEnvParameter4fARB(target, index,
5481 (GLfloat) x,
5482 (GLfloat) y, (GLfloat) z, (GLfloat) w);
5483 }
5484
5485
5486 static void GLAPIENTRY
5487 save_ProgramEnvParameter4dvARB(GLenum target, GLuint index,
5488 const GLdouble *params)
5489 {
5490 save_ProgramEnvParameter4fARB(target, index,
5491 (GLfloat) params[0],
5492 (GLfloat) params[1],
5493 (GLfloat) params[2], (GLfloat) params[3]);
5494 }
5495
5496
5497 static void GLAPIENTRY
5498 save_ProgramLocalParameter4fARB(GLenum target, GLuint index,
5499 GLfloat x, GLfloat y, GLfloat z, GLfloat w)
5500 {
5501 GET_CURRENT_CONTEXT(ctx);
5502 Node *n;
5503 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5504 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5505 if (n) {
5506 n[1].e = target;
5507 n[2].ui = index;
5508 n[3].f = x;
5509 n[4].f = y;
5510 n[5].f = z;
5511 n[6].f = w;
5512 }
5513 if (ctx->ExecuteFlag) {
5514 CALL_ProgramLocalParameter4fARB(ctx->Exec, (target, index, x, y, z, w));
5515 }
5516 }
5517
5518
5519 static void GLAPIENTRY
5520 save_ProgramLocalParameter4fvARB(GLenum target, GLuint index,
5521 const GLfloat *params)
5522 {
5523 GET_CURRENT_CONTEXT(ctx);
5524 Node *n;
5525 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5526 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5527 if (n) {
5528 n[1].e = target;
5529 n[2].ui = index;
5530 n[3].f = params[0];
5531 n[4].f = params[1];
5532 n[5].f = params[2];
5533 n[6].f = params[3];
5534 }
5535 if (ctx->ExecuteFlag) {
5536 CALL_ProgramLocalParameter4fvARB(ctx->Exec, (target, index, params));
5537 }
5538 }
5539
5540
5541 static void GLAPIENTRY
5542 save_ProgramLocalParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
5543 const GLfloat *params)
5544 {
5545 GET_CURRENT_CONTEXT(ctx);
5546 Node *n;
5547 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5548
5549 if (count > 0) {
5550 GLint i;
5551 const GLfloat * p = params;
5552
5553 for (i = 0 ; i < count ; i++) {
5554 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5555 if (n) {
5556 n[1].e = target;
5557 n[2].ui = index;
5558 n[3].f = p[0];
5559 n[4].f = p[1];
5560 n[5].f = p[2];
5561 n[6].f = p[3];
5562 p += 4;
5563 }
5564 }
5565 }
5566
5567 if (ctx->ExecuteFlag) {
5568 CALL_ProgramLocalParameters4fvEXT(ctx->Exec, (target, index, count, params));
5569 }
5570 }
5571
5572
5573 static void GLAPIENTRY
5574 save_ProgramLocalParameter4dARB(GLenum target, GLuint index,
5575 GLdouble x, GLdouble y,
5576 GLdouble z, GLdouble w)
5577 {
5578 GET_CURRENT_CONTEXT(ctx);
5579 Node *n;
5580 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5581 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5582 if (n) {
5583 n[1].e = target;
5584 n[2].ui = index;
5585 n[3].f = (GLfloat) x;
5586 n[4].f = (GLfloat) y;
5587 n[5].f = (GLfloat) z;
5588 n[6].f = (GLfloat) w;
5589 }
5590 if (ctx->ExecuteFlag) {
5591 CALL_ProgramLocalParameter4dARB(ctx->Exec, (target, index, x, y, z, w));
5592 }
5593 }
5594
5595
5596 static void GLAPIENTRY
5597 save_ProgramLocalParameter4dvARB(GLenum target, GLuint index,
5598 const GLdouble *params)
5599 {
5600 GET_CURRENT_CONTEXT(ctx);
5601 Node *n;
5602 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5603 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5604 if (n) {
5605 n[1].e = target;
5606 n[2].ui = index;
5607 n[3].f = (GLfloat) params[0];
5608 n[4].f = (GLfloat) params[1];
5609 n[5].f = (GLfloat) params[2];
5610 n[6].f = (GLfloat) params[3];
5611 }
5612 if (ctx->ExecuteFlag) {
5613 CALL_ProgramLocalParameter4dvARB(ctx->Exec, (target, index, params));
5614 }
5615 }
5616
5617
5618 /* GL_EXT_stencil_two_side */
5619 static void GLAPIENTRY
5620 save_ActiveStencilFaceEXT(GLenum face)
5621 {
5622 GET_CURRENT_CONTEXT(ctx);
5623 Node *n;
5624 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5625 n = alloc_instruction(ctx, OPCODE_ACTIVE_STENCIL_FACE_EXT, 1);
5626 if (n) {
5627 n[1].e = face;
5628 }
5629 if (ctx->ExecuteFlag) {
5630 CALL_ActiveStencilFaceEXT(ctx->Exec, (face));
5631 }
5632 }
5633
5634
5635 /* GL_EXT_depth_bounds_test */
5636 static void GLAPIENTRY
5637 save_DepthBoundsEXT(GLclampd zmin, GLclampd zmax)
5638 {
5639 GET_CURRENT_CONTEXT(ctx);
5640 Node *n;
5641 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5642 n = alloc_instruction(ctx, OPCODE_DEPTH_BOUNDS_EXT, 2);
5643 if (n) {
5644 n[1].f = (GLfloat) zmin;
5645 n[2].f = (GLfloat) zmax;
5646 }
5647 if (ctx->ExecuteFlag) {
5648 CALL_DepthBoundsEXT(ctx->Exec, (zmin, zmax));
5649 }
5650 }
5651
5652
5653
5654 static void GLAPIENTRY
5655 save_ProgramStringARB(GLenum target, GLenum format, GLsizei len,
5656 const GLvoid * string)
5657 {
5658 GET_CURRENT_CONTEXT(ctx);
5659 Node *n;
5660
5661 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5662
5663 n = alloc_instruction(ctx, OPCODE_PROGRAM_STRING_ARB, 3 + POINTER_DWORDS);
5664 if (n) {
5665 GLubyte *programCopy = malloc(len);
5666 if (!programCopy) {
5667 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramStringARB");
5668 return;
5669 }
5670 memcpy(programCopy, string, len);
5671 n[1].e = target;
5672 n[2].e = format;
5673 n[3].i = len;
5674 save_pointer(&n[4], programCopy);
5675 }
5676 if (ctx->ExecuteFlag) {
5677 CALL_ProgramStringARB(ctx->Exec, (target, format, len, string));
5678 }
5679 }
5680
5681
5682 static void GLAPIENTRY
5683 save_BeginQueryARB(GLenum target, GLuint id)
5684 {
5685 GET_CURRENT_CONTEXT(ctx);
5686 Node *n;
5687 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5688 n = alloc_instruction(ctx, OPCODE_BEGIN_QUERY_ARB, 2);
5689 if (n) {
5690 n[1].e = target;
5691 n[2].ui = id;
5692 }
5693 if (ctx->ExecuteFlag) {
5694 CALL_BeginQuery(ctx->Exec, (target, id));
5695 }
5696 }
5697
5698 static void GLAPIENTRY
5699 save_EndQueryARB(GLenum target)
5700 {
5701 GET_CURRENT_CONTEXT(ctx);
5702 Node *n;
5703 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5704 n = alloc_instruction(ctx, OPCODE_END_QUERY_ARB, 1);
5705 if (n) {
5706 n[1].e = target;
5707 }
5708 if (ctx->ExecuteFlag) {
5709 CALL_EndQuery(ctx->Exec, (target));
5710 }
5711 }
5712
5713 static void GLAPIENTRY
5714 save_QueryCounter(GLuint id, GLenum target)
5715 {
5716 GET_CURRENT_CONTEXT(ctx);
5717 Node *n;
5718 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5719 n = alloc_instruction(ctx, OPCODE_QUERY_COUNTER, 2);
5720 if (n) {
5721 n[1].ui = id;
5722 n[2].e = target;
5723 }
5724 if (ctx->ExecuteFlag) {
5725 CALL_QueryCounter(ctx->Exec, (id, target));
5726 }
5727 }
5728
5729 static void GLAPIENTRY
5730 save_BeginQueryIndexed(GLenum target, GLuint index, GLuint id)
5731 {
5732 GET_CURRENT_CONTEXT(ctx);
5733 Node *n;
5734 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5735 n = alloc_instruction(ctx, OPCODE_BEGIN_QUERY_INDEXED, 3);
5736 if (n) {
5737 n[1].e = target;
5738 n[2].ui = index;
5739 n[3].ui = id;
5740 }
5741 if (ctx->ExecuteFlag) {
5742 CALL_BeginQueryIndexed(ctx->Exec, (target, index, id));
5743 }
5744 }
5745
5746 static void GLAPIENTRY
5747 save_EndQueryIndexed(GLenum target, GLuint index)
5748 {
5749 GET_CURRENT_CONTEXT(ctx);
5750 Node *n;
5751 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5752 n = alloc_instruction(ctx, OPCODE_END_QUERY_INDEXED, 2);
5753 if (n) {
5754 n[1].e = target;
5755 n[2].ui = index;
5756 }
5757 if (ctx->ExecuteFlag) {
5758 CALL_EndQueryIndexed(ctx->Exec, (target, index));
5759 }
5760 }
5761
5762
5763 static void GLAPIENTRY
5764 save_DrawBuffersARB(GLsizei count, const GLenum * buffers)
5765 {
5766 GET_CURRENT_CONTEXT(ctx);
5767 Node *n;
5768 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5769 n = alloc_instruction(ctx, OPCODE_DRAW_BUFFERS_ARB, 1 + MAX_DRAW_BUFFERS);
5770 if (n) {
5771 GLint i;
5772 n[1].i = count;
5773 if (count > MAX_DRAW_BUFFERS)
5774 count = MAX_DRAW_BUFFERS;
5775 for (i = 0; i < count; i++) {
5776 n[2 + i].e = buffers[i];
5777 }
5778 }
5779 if (ctx->ExecuteFlag) {
5780 CALL_DrawBuffers(ctx->Exec, (count, buffers));
5781 }
5782 }
5783
5784 static void GLAPIENTRY
5785 save_BindFragmentShaderATI(GLuint id)
5786 {
5787 GET_CURRENT_CONTEXT(ctx);
5788 Node *n;
5789
5790 n = alloc_instruction(ctx, OPCODE_BIND_FRAGMENT_SHADER_ATI, 1);
5791 if (n) {
5792 n[1].ui = id;
5793 }
5794 if (ctx->ExecuteFlag) {
5795 CALL_BindFragmentShaderATI(ctx->Exec, (id));
5796 }
5797 }
5798
5799 static void GLAPIENTRY
5800 save_SetFragmentShaderConstantATI(GLuint dst, const GLfloat *value)
5801 {
5802 GET_CURRENT_CONTEXT(ctx);
5803 Node *n;
5804
5805 n = alloc_instruction(ctx, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI, 5);
5806 if (n) {
5807 n[1].ui = dst;
5808 n[2].f = value[0];
5809 n[3].f = value[1];
5810 n[4].f = value[2];
5811 n[5].f = value[3];
5812 }
5813 if (ctx->ExecuteFlag) {
5814 CALL_SetFragmentShaderConstantATI(ctx->Exec, (dst, value));
5815 }
5816 }
5817
5818 static void GLAPIENTRY
5819 save_Attr1fNV(GLenum attr, GLfloat x)
5820 {
5821 GET_CURRENT_CONTEXT(ctx);
5822 Node *n;
5823 SAVE_FLUSH_VERTICES(ctx);
5824 n = alloc_instruction(ctx, OPCODE_ATTR_1F_NV, 2);
5825 if (n) {
5826 n[1].e = attr;
5827 n[2].f = x;
5828 }
5829
5830 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5831 ctx->ListState.ActiveAttribSize[attr] = 1;
5832 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, 0, 0, 1);
5833
5834 if (ctx->ExecuteFlag) {
5835 CALL_VertexAttrib1fNV(ctx->Exec, (attr, x));
5836 }
5837 }
5838
5839 static void GLAPIENTRY
5840 save_Attr2fNV(GLenum attr, GLfloat x, GLfloat y)
5841 {
5842 GET_CURRENT_CONTEXT(ctx);
5843 Node *n;
5844 SAVE_FLUSH_VERTICES(ctx);
5845 n = alloc_instruction(ctx, OPCODE_ATTR_2F_NV, 3);
5846 if (n) {
5847 n[1].e = attr;
5848 n[2].f = x;
5849 n[3].f = y;
5850 }
5851
5852 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5853 ctx->ListState.ActiveAttribSize[attr] = 2;
5854 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, 0, 1);
5855
5856 if (ctx->ExecuteFlag) {
5857 CALL_VertexAttrib2fNV(ctx->Exec, (attr, x, y));
5858 }
5859 }
5860
5861 static void GLAPIENTRY
5862 save_Attr3fNV(GLenum attr, GLfloat x, GLfloat y, GLfloat z)
5863 {
5864 GET_CURRENT_CONTEXT(ctx);
5865 Node *n;
5866 SAVE_FLUSH_VERTICES(ctx);
5867 n = alloc_instruction(ctx, OPCODE_ATTR_3F_NV, 4);
5868 if (n) {
5869 n[1].e = attr;
5870 n[2].f = x;
5871 n[3].f = y;
5872 n[4].f = z;
5873 }
5874
5875 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5876 ctx->ListState.ActiveAttribSize[attr] = 3;
5877 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, 1);
5878
5879 if (ctx->ExecuteFlag) {
5880 CALL_VertexAttrib3fNV(ctx->Exec, (attr, x, y, z));
5881 }
5882 }
5883
5884 static void GLAPIENTRY
5885 save_Attr4fNV(GLenum attr, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
5886 {
5887 GET_CURRENT_CONTEXT(ctx);
5888 Node *n;
5889 SAVE_FLUSH_VERTICES(ctx);
5890 n = alloc_instruction(ctx, OPCODE_ATTR_4F_NV, 5);
5891 if (n) {
5892 n[1].e = attr;
5893 n[2].f = x;
5894 n[3].f = y;
5895 n[4].f = z;
5896 n[5].f = w;
5897 }
5898
5899 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5900 ctx->ListState.ActiveAttribSize[attr] = 4;
5901 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, w);
5902
5903 if (ctx->ExecuteFlag) {
5904 CALL_VertexAttrib4fNV(ctx->Exec, (attr, x, y, z, w));
5905 }
5906 }
5907
5908
5909 static void GLAPIENTRY
5910 save_Attr1fARB(GLenum attr, GLfloat x)
5911 {
5912 GET_CURRENT_CONTEXT(ctx);
5913 Node *n;
5914 SAVE_FLUSH_VERTICES(ctx);
5915 n = alloc_instruction(ctx, OPCODE_ATTR_1F_ARB, 2);
5916 if (n) {
5917 n[1].e = attr;
5918 n[2].f = x;
5919 }
5920
5921 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5922 ctx->ListState.ActiveAttribSize[attr] = 1;
5923 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, 0, 0, 1);
5924
5925 if (ctx->ExecuteFlag) {
5926 CALL_VertexAttrib1fARB(ctx->Exec, (attr, x));
5927 }
5928 }
5929
5930 static void GLAPIENTRY
5931 save_Attr2fARB(GLenum attr, GLfloat x, GLfloat y)
5932 {
5933 GET_CURRENT_CONTEXT(ctx);
5934 Node *n;
5935 SAVE_FLUSH_VERTICES(ctx);
5936 n = alloc_instruction(ctx, OPCODE_ATTR_2F_ARB, 3);
5937 if (n) {
5938 n[1].e = attr;
5939 n[2].f = x;
5940 n[3].f = y;
5941 }
5942
5943 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5944 ctx->ListState.ActiveAttribSize[attr] = 2;
5945 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, 0, 1);
5946
5947 if (ctx->ExecuteFlag) {
5948 CALL_VertexAttrib2fARB(ctx->Exec, (attr, x, y));
5949 }
5950 }
5951
5952 static void GLAPIENTRY
5953 save_Attr3fARB(GLenum attr, GLfloat x, GLfloat y, GLfloat z)
5954 {
5955 GET_CURRENT_CONTEXT(ctx);
5956 Node *n;
5957 SAVE_FLUSH_VERTICES(ctx);
5958 n = alloc_instruction(ctx, OPCODE_ATTR_3F_ARB, 4);
5959 if (n) {
5960 n[1].e = attr;
5961 n[2].f = x;
5962 n[3].f = y;
5963 n[4].f = z;
5964 }
5965
5966 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5967 ctx->ListState.ActiveAttribSize[attr] = 3;
5968 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, 1);
5969
5970 if (ctx->ExecuteFlag) {
5971 CALL_VertexAttrib3fARB(ctx->Exec, (attr, x, y, z));
5972 }
5973 }
5974
5975 static void GLAPIENTRY
5976 save_Attr4fARB(GLenum attr, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
5977 {
5978 GET_CURRENT_CONTEXT(ctx);
5979 Node *n;
5980 SAVE_FLUSH_VERTICES(ctx);
5981 n = alloc_instruction(ctx, OPCODE_ATTR_4F_ARB, 5);
5982 if (n) {
5983 n[1].e = attr;
5984 n[2].f = x;
5985 n[3].f = y;
5986 n[4].f = z;
5987 n[5].f = w;
5988 }
5989
5990 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5991 ctx->ListState.ActiveAttribSize[attr] = 4;
5992 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, w);
5993
5994 if (ctx->ExecuteFlag) {
5995 CALL_VertexAttrib4fARB(ctx->Exec, (attr, x, y, z, w));
5996 }
5997 }
5998
5999
6000 static void GLAPIENTRY
6001 save_EvalCoord1f(GLfloat x)
6002 {
6003 GET_CURRENT_CONTEXT(ctx);
6004 Node *n;
6005 SAVE_FLUSH_VERTICES(ctx);
6006 n = alloc_instruction(ctx, OPCODE_EVAL_C1, 1);
6007 if (n) {
6008 n[1].f = x;
6009 }
6010 if (ctx->ExecuteFlag) {
6011 CALL_EvalCoord1f(ctx->Exec, (x));
6012 }
6013 }
6014
6015 static void GLAPIENTRY
6016 save_EvalCoord1fv(const GLfloat * v)
6017 {
6018 save_EvalCoord1f(v[0]);
6019 }
6020
6021 static void GLAPIENTRY
6022 save_EvalCoord2f(GLfloat x, GLfloat y)
6023 {
6024 GET_CURRENT_CONTEXT(ctx);
6025 Node *n;
6026 SAVE_FLUSH_VERTICES(ctx);
6027 n = alloc_instruction(ctx, OPCODE_EVAL_C2, 2);
6028 if (n) {
6029 n[1].f = x;
6030 n[2].f = y;
6031 }
6032 if (ctx->ExecuteFlag) {
6033 CALL_EvalCoord2f(ctx->Exec, (x, y));
6034 }
6035 }
6036
6037 static void GLAPIENTRY
6038 save_EvalCoord2fv(const GLfloat * v)
6039 {
6040 save_EvalCoord2f(v[0], v[1]);
6041 }
6042
6043
6044 static void GLAPIENTRY
6045 save_EvalPoint1(GLint x)
6046 {
6047 GET_CURRENT_CONTEXT(ctx);
6048 Node *n;
6049 SAVE_FLUSH_VERTICES(ctx);
6050 n = alloc_instruction(ctx, OPCODE_EVAL_P1, 1);
6051 if (n) {
6052 n[1].i = x;
6053 }
6054 if (ctx->ExecuteFlag) {
6055 CALL_EvalPoint1(ctx->Exec, (x));
6056 }
6057 }
6058
6059 static void GLAPIENTRY
6060 save_EvalPoint2(GLint x, GLint y)
6061 {
6062 GET_CURRENT_CONTEXT(ctx);
6063 Node *n;
6064 SAVE_FLUSH_VERTICES(ctx);
6065 n = alloc_instruction(ctx, OPCODE_EVAL_P2, 2);
6066 if (n) {
6067 n[1].i = x;
6068 n[2].i = y;
6069 }
6070 if (ctx->ExecuteFlag) {
6071 CALL_EvalPoint2(ctx->Exec, (x, y));
6072 }
6073 }
6074
6075 static void GLAPIENTRY
6076 save_Indexf(GLfloat x)
6077 {
6078 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX, x);
6079 }
6080
6081 static void GLAPIENTRY
6082 save_Indexfv(const GLfloat * v)
6083 {
6084 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX, v[0]);
6085 }
6086
6087 static void GLAPIENTRY
6088 save_EdgeFlag(GLboolean x)
6089 {
6090 save_Attr1fNV(VERT_ATTRIB_EDGEFLAG, x ? 1.0f : 0.0f);
6091 }
6092
6093
6094 /**
6095 * Compare 'count' elements of vectors 'a' and 'b'.
6096 * \return GL_TRUE if equal, GL_FALSE if different.
6097 */
6098 static inline GLboolean
6099 compare_vec(const GLfloat *a, const GLfloat *b, GLuint count)
6100 {
6101 return memcmp( a, b, count * sizeof(GLfloat) ) == 0;
6102 }
6103
6104
6105 /**
6106 * This glMaterial function is used for glMaterial calls that are outside
6107 * a glBegin/End pair. For glMaterial inside glBegin/End, see the VBO code.
6108 */
6109 static void GLAPIENTRY
6110 save_Materialfv(GLenum face, GLenum pname, const GLfloat * param)
6111 {
6112 GET_CURRENT_CONTEXT(ctx);
6113 Node *n;
6114 int args, i;
6115 GLuint bitmask;
6116
6117 switch (face) {
6118 case GL_BACK:
6119 case GL_FRONT:
6120 case GL_FRONT_AND_BACK:
6121 break;
6122 default:
6123 _mesa_compile_error(ctx, GL_INVALID_ENUM, "glMaterial(face)");
6124 return;
6125 }
6126
6127 switch (pname) {
6128 case GL_EMISSION:
6129 case GL_AMBIENT:
6130 case GL_DIFFUSE:
6131 case GL_SPECULAR:
6132 case GL_AMBIENT_AND_DIFFUSE:
6133 args = 4;
6134 break;
6135 case GL_SHININESS:
6136 args = 1;
6137 break;
6138 case GL_COLOR_INDEXES:
6139 args = 3;
6140 break;
6141 default:
6142 _mesa_compile_error(ctx, GL_INVALID_ENUM, "glMaterial(pname)");
6143 return;
6144 }
6145
6146 if (ctx->ExecuteFlag) {
6147 CALL_Materialfv(ctx->Exec, (face, pname, param));
6148 }
6149
6150 bitmask = _mesa_material_bitmask(ctx, face, pname, ~0, NULL);
6151
6152 /* Try to eliminate redundant statechanges. Because it is legal to
6153 * call glMaterial even inside begin/end calls, don't need to worry
6154 * about ctx->Driver.CurrentSavePrimitive here.
6155 */
6156 for (i = 0; i < MAT_ATTRIB_MAX; i++) {
6157 if (bitmask & (1 << i)) {
6158 if (ctx->ListState.ActiveMaterialSize[i] == args &&
6159 compare_vec(ctx->ListState.CurrentMaterial[i], param, args)) {
6160 /* no change in material value */
6161 bitmask &= ~(1 << i);
6162 }
6163 else {
6164 ctx->ListState.ActiveMaterialSize[i] = args;
6165 COPY_SZ_4V(ctx->ListState.CurrentMaterial[i], args, param);
6166 }
6167 }
6168 }
6169
6170 /* If this call has no effect, return early */
6171 if (bitmask == 0)
6172 return;
6173
6174 SAVE_FLUSH_VERTICES(ctx);
6175
6176 n = alloc_instruction(ctx, OPCODE_MATERIAL, 6);
6177 if (n) {
6178 n[1].e = face;
6179 n[2].e = pname;
6180 for (i = 0; i < args; i++)
6181 n[3 + i].f = param[i];
6182 }
6183 }
6184
6185 static void GLAPIENTRY
6186 save_Begin(GLenum mode)
6187 {
6188 GET_CURRENT_CONTEXT(ctx);
6189
6190 if (!_mesa_is_valid_prim_mode(ctx, mode)) {
6191 /* compile this error into the display list */
6192 _mesa_compile_error(ctx, GL_INVALID_ENUM, "glBegin(mode)");
6193 }
6194 else if (_mesa_inside_dlist_begin_end(ctx)) {
6195 /* compile this error into the display list */
6196 _mesa_compile_error(ctx, GL_INVALID_OPERATION, "recursive glBegin");
6197 }
6198 else {
6199 ctx->Driver.CurrentSavePrimitive = mode;
6200
6201 vbo_save_NotifyBegin(ctx, mode, false);
6202 }
6203 }
6204
6205 static void GLAPIENTRY
6206 save_End(void)
6207 {
6208 GET_CURRENT_CONTEXT(ctx);
6209 SAVE_FLUSH_VERTICES(ctx);
6210 (void) alloc_instruction(ctx, OPCODE_END, 0);
6211 ctx->Driver.CurrentSavePrimitive = PRIM_OUTSIDE_BEGIN_END;
6212 if (ctx->ExecuteFlag) {
6213 CALL_End(ctx->Exec, ());
6214 }
6215 }
6216
6217 static void GLAPIENTRY
6218 save_Rectf(GLfloat a, GLfloat b, GLfloat c, GLfloat d)
6219 {
6220 GET_CURRENT_CONTEXT(ctx);
6221 Node *n;
6222 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6223 n = alloc_instruction(ctx, OPCODE_RECTF, 4);
6224 if (n) {
6225 n[1].f = a;
6226 n[2].f = b;
6227 n[3].f = c;
6228 n[4].f = d;
6229 }
6230 if (ctx->ExecuteFlag) {
6231 CALL_Rectf(ctx->Exec, (a, b, c, d));
6232 }
6233 }
6234
6235
6236 static void GLAPIENTRY
6237 save_Vertex2f(GLfloat x, GLfloat y)
6238 {
6239 save_Attr2fNV(VERT_ATTRIB_POS, x, y);
6240 }
6241
6242 static void GLAPIENTRY
6243 save_Vertex2fv(const GLfloat * v)
6244 {
6245 save_Attr2fNV(VERT_ATTRIB_POS, v[0], v[1]);
6246 }
6247
6248 static void GLAPIENTRY
6249 save_Vertex3f(GLfloat x, GLfloat y, GLfloat z)
6250 {
6251 save_Attr3fNV(VERT_ATTRIB_POS, x, y, z);
6252 }
6253
6254 static void GLAPIENTRY
6255 save_Vertex3fv(const GLfloat * v)
6256 {
6257 save_Attr3fNV(VERT_ATTRIB_POS, v[0], v[1], v[2]);
6258 }
6259
6260 static void GLAPIENTRY
6261 save_Vertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
6262 {
6263 save_Attr4fNV(VERT_ATTRIB_POS, x, y, z, w);
6264 }
6265
6266 static void GLAPIENTRY
6267 save_Vertex4fv(const GLfloat * v)
6268 {
6269 save_Attr4fNV(VERT_ATTRIB_POS, v[0], v[1], v[2], v[3]);
6270 }
6271
6272 static void GLAPIENTRY
6273 save_TexCoord1f(GLfloat x)
6274 {
6275 save_Attr1fNV(VERT_ATTRIB_TEX0, x);
6276 }
6277
6278 static void GLAPIENTRY
6279 save_TexCoord1fv(const GLfloat * v)
6280 {
6281 save_Attr1fNV(VERT_ATTRIB_TEX0, v[0]);
6282 }
6283
6284 static void GLAPIENTRY
6285 save_TexCoord2f(GLfloat x, GLfloat y)
6286 {
6287 save_Attr2fNV(VERT_ATTRIB_TEX0, x, y);
6288 }
6289
6290 static void GLAPIENTRY
6291 save_TexCoord2fv(const GLfloat * v)
6292 {
6293 save_Attr2fNV(VERT_ATTRIB_TEX0, v[0], v[1]);
6294 }
6295
6296 static void GLAPIENTRY
6297 save_TexCoord3f(GLfloat x, GLfloat y, GLfloat z)
6298 {
6299 save_Attr3fNV(VERT_ATTRIB_TEX0, x, y, z);
6300 }
6301
6302 static void GLAPIENTRY
6303 save_TexCoord3fv(const GLfloat * v)
6304 {
6305 save_Attr3fNV(VERT_ATTRIB_TEX0, v[0], v[1], v[2]);
6306 }
6307
6308 static void GLAPIENTRY
6309 save_TexCoord4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
6310 {
6311 save_Attr4fNV(VERT_ATTRIB_TEX0, x, y, z, w);
6312 }
6313
6314 static void GLAPIENTRY
6315 save_TexCoord4fv(const GLfloat * v)
6316 {
6317 save_Attr4fNV(VERT_ATTRIB_TEX0, v[0], v[1], v[2], v[3]);
6318 }
6319
6320 static void GLAPIENTRY
6321 save_Normal3f(GLfloat x, GLfloat y, GLfloat z)
6322 {
6323 save_Attr3fNV(VERT_ATTRIB_NORMAL, x, y, z);
6324 }
6325
6326 static void GLAPIENTRY
6327 save_Normal3fv(const GLfloat * v)
6328 {
6329 save_Attr3fNV(VERT_ATTRIB_NORMAL, v[0], v[1], v[2]);
6330 }
6331
6332 static void GLAPIENTRY
6333 save_FogCoordfEXT(GLfloat x)
6334 {
6335 save_Attr1fNV(VERT_ATTRIB_FOG, x);
6336 }
6337
6338 static void GLAPIENTRY
6339 save_FogCoordfvEXT(const GLfloat * v)
6340 {
6341 save_Attr1fNV(VERT_ATTRIB_FOG, v[0]);
6342 }
6343
6344 static void GLAPIENTRY
6345 save_Color3f(GLfloat x, GLfloat y, GLfloat z)
6346 {
6347 save_Attr3fNV(VERT_ATTRIB_COLOR0, x, y, z);
6348 }
6349
6350 static void GLAPIENTRY
6351 save_Color3fv(const GLfloat * v)
6352 {
6353 save_Attr3fNV(VERT_ATTRIB_COLOR0, v[0], v[1], v[2]);
6354 }
6355
6356 static void GLAPIENTRY
6357 save_Color4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
6358 {
6359 save_Attr4fNV(VERT_ATTRIB_COLOR0, x, y, z, w);
6360 }
6361
6362 static void GLAPIENTRY
6363 save_Color4fv(const GLfloat * v)
6364 {
6365 save_Attr4fNV(VERT_ATTRIB_COLOR0, v[0], v[1], v[2], v[3]);
6366 }
6367
6368 static void GLAPIENTRY
6369 save_SecondaryColor3fEXT(GLfloat x, GLfloat y, GLfloat z)
6370 {
6371 save_Attr3fNV(VERT_ATTRIB_COLOR1, x, y, z);
6372 }
6373
6374 static void GLAPIENTRY
6375 save_SecondaryColor3fvEXT(const GLfloat * v)
6376 {
6377 save_Attr3fNV(VERT_ATTRIB_COLOR1, v[0], v[1], v[2]);
6378 }
6379
6380
6381 /* Just call the respective ATTR for texcoord
6382 */
6383 static void GLAPIENTRY
6384 save_MultiTexCoord1f(GLenum target, GLfloat x)
6385 {
6386 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6387 save_Attr1fNV(attr, x);
6388 }
6389
6390 static void GLAPIENTRY
6391 save_MultiTexCoord1fv(GLenum target, const GLfloat * v)
6392 {
6393 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6394 save_Attr1fNV(attr, v[0]);
6395 }
6396
6397 static void GLAPIENTRY
6398 save_MultiTexCoord2f(GLenum target, GLfloat x, GLfloat y)
6399 {
6400 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6401 save_Attr2fNV(attr, x, y);
6402 }
6403
6404 static void GLAPIENTRY
6405 save_MultiTexCoord2fv(GLenum target, const GLfloat * v)
6406 {
6407 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6408 save_Attr2fNV(attr, v[0], v[1]);
6409 }
6410
6411 static void GLAPIENTRY
6412 save_MultiTexCoord3f(GLenum target, GLfloat x, GLfloat y, GLfloat z)
6413 {
6414 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6415 save_Attr3fNV(attr, x, y, z);
6416 }
6417
6418 static void GLAPIENTRY
6419 save_MultiTexCoord3fv(GLenum target, const GLfloat * v)
6420 {
6421 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6422 save_Attr3fNV(attr, v[0], v[1], v[2]);
6423 }
6424
6425 static void GLAPIENTRY
6426 save_MultiTexCoord4f(GLenum target, GLfloat x, GLfloat y,
6427 GLfloat z, GLfloat w)
6428 {
6429 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6430 save_Attr4fNV(attr, x, y, z, w);
6431 }
6432
6433 static void GLAPIENTRY
6434 save_MultiTexCoord4fv(GLenum target, const GLfloat * v)
6435 {
6436 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6437 save_Attr4fNV(attr, v[0], v[1], v[2], v[3]);
6438 }
6439
6440
6441 /**
6442 * Record a GL_INVALID_VALUE error when an invalid vertex attribute
6443 * index is found.
6444 */
6445 static void
6446 index_error(void)
6447 {
6448 GET_CURRENT_CONTEXT(ctx);
6449 _mesa_error(ctx, GL_INVALID_VALUE, "VertexAttribf(index)");
6450 }
6451
6452
6453
6454 static void GLAPIENTRY
6455 save_VertexAttrib1fARB(GLuint index, GLfloat x)
6456 {
6457 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6458 save_Attr1fARB(index, x);
6459 else
6460 index_error();
6461 }
6462
6463 static void GLAPIENTRY
6464 save_VertexAttrib1fvARB(GLuint index, const GLfloat * v)
6465 {
6466 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6467 save_Attr1fARB(index, v[0]);
6468 else
6469 index_error();
6470 }
6471
6472 static void GLAPIENTRY
6473 save_VertexAttrib2fARB(GLuint index, GLfloat x, GLfloat y)
6474 {
6475 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6476 save_Attr2fARB(index, x, y);
6477 else
6478 index_error();
6479 }
6480
6481 static void GLAPIENTRY
6482 save_VertexAttrib2fvARB(GLuint index, const GLfloat * v)
6483 {
6484 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6485 save_Attr2fARB(index, v[0], v[1]);
6486 else
6487 index_error();
6488 }
6489
6490 static void GLAPIENTRY
6491 save_VertexAttrib3fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z)
6492 {
6493 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6494 save_Attr3fARB(index, x, y, z);
6495 else
6496 index_error();
6497 }
6498
6499 static void GLAPIENTRY
6500 save_VertexAttrib3fvARB(GLuint index, const GLfloat * v)
6501 {
6502 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6503 save_Attr3fARB(index, v[0], v[1], v[2]);
6504 else
6505 index_error();
6506 }
6507
6508 static void GLAPIENTRY
6509 save_VertexAttrib4fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z,
6510 GLfloat w)
6511 {
6512 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6513 save_Attr4fARB(index, x, y, z, w);
6514 else
6515 index_error();
6516 }
6517
6518 static void GLAPIENTRY
6519 save_VertexAttrib4fvARB(GLuint index, const GLfloat * v)
6520 {
6521 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6522 save_Attr4fARB(index, v[0], v[1], v[2], v[3]);
6523 else
6524 index_error();
6525 }
6526
6527 static void GLAPIENTRY
6528 save_VertexAttribL1d(GLuint index, GLdouble x)
6529 {
6530 GET_CURRENT_CONTEXT(ctx);
6531
6532 if (index < MAX_VERTEX_GENERIC_ATTRIBS) {
6533 Node *n;
6534 SAVE_FLUSH_VERTICES(ctx);
6535 n = alloc_instruction(ctx, OPCODE_ATTR_1D, 3);
6536 if (n) {
6537 n[1].ui = index;
6538 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
6539 }
6540
6541 ctx->ListState.ActiveAttribSize[index] = 1;
6542 memcpy(ctx->ListState.CurrentAttrib[index], &n[2], sizeof(GLdouble));
6543
6544 if (ctx->ExecuteFlag) {
6545 CALL_VertexAttribL1d(ctx->Exec, (index, x));
6546 }
6547 } else {
6548 index_error();
6549 }
6550 }
6551
6552 static void GLAPIENTRY
6553 save_VertexAttribL1dv(GLuint index, const GLdouble *v)
6554 {
6555 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6556 save_VertexAttribL1d(index, v[0]);
6557 else
6558 index_error();
6559 }
6560
6561 static void GLAPIENTRY
6562 save_VertexAttribL2d(GLuint index, GLdouble x, GLdouble y)
6563 {
6564 GET_CURRENT_CONTEXT(ctx);
6565
6566 if (index < MAX_VERTEX_GENERIC_ATTRIBS) {
6567 Node *n;
6568 SAVE_FLUSH_VERTICES(ctx);
6569 n = alloc_instruction(ctx, OPCODE_ATTR_2D, 5);
6570 if (n) {
6571 n[1].ui = index;
6572 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
6573 ASSIGN_DOUBLE_TO_NODES(n, 4, y);
6574 }
6575
6576 ctx->ListState.ActiveAttribSize[index] = 2;
6577 memcpy(ctx->ListState.CurrentAttrib[index], &n[2],
6578 2 * sizeof(GLdouble));
6579
6580 if (ctx->ExecuteFlag) {
6581 CALL_VertexAttribL2d(ctx->Exec, (index, x, y));
6582 }
6583 } else {
6584 index_error();
6585 }
6586 }
6587
6588 static void GLAPIENTRY
6589 save_VertexAttribL2dv(GLuint index, const GLdouble *v)
6590 {
6591 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6592 save_VertexAttribL2d(index, v[0], v[1]);
6593 else
6594 index_error();
6595 }
6596
6597 static void GLAPIENTRY
6598 save_VertexAttribL3d(GLuint index, GLdouble x, GLdouble y, GLdouble z)
6599 {
6600 GET_CURRENT_CONTEXT(ctx);
6601
6602 if (index < MAX_VERTEX_GENERIC_ATTRIBS) {
6603 Node *n;
6604 SAVE_FLUSH_VERTICES(ctx);
6605 n = alloc_instruction(ctx, OPCODE_ATTR_3D, 7);
6606 if (n) {
6607 n[1].ui = index;
6608 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
6609 ASSIGN_DOUBLE_TO_NODES(n, 4, y);
6610 ASSIGN_DOUBLE_TO_NODES(n, 6, z);
6611 }
6612
6613 ctx->ListState.ActiveAttribSize[index] = 3;
6614 memcpy(ctx->ListState.CurrentAttrib[index], &n[2],
6615 3 * sizeof(GLdouble));
6616
6617 if (ctx->ExecuteFlag) {
6618 CALL_VertexAttribL3d(ctx->Exec, (index, x, y, z));
6619 }
6620 } else {
6621 index_error();
6622 }
6623 }
6624
6625 static void GLAPIENTRY
6626 save_VertexAttribL3dv(GLuint index, const GLdouble *v)
6627 {
6628 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6629 save_VertexAttribL3d(index, v[0], v[1], v[2]);
6630 else
6631 index_error();
6632 }
6633
6634 static void GLAPIENTRY
6635 save_VertexAttribL4d(GLuint index, GLdouble x, GLdouble y, GLdouble z,
6636 GLdouble w)
6637 {
6638 GET_CURRENT_CONTEXT(ctx);
6639
6640 if (index < MAX_VERTEX_GENERIC_ATTRIBS) {
6641 Node *n;
6642 SAVE_FLUSH_VERTICES(ctx);
6643 n = alloc_instruction(ctx, OPCODE_ATTR_4D, 9);
6644 if (n) {
6645 n[1].ui = index;
6646 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
6647 ASSIGN_DOUBLE_TO_NODES(n, 4, y);
6648 ASSIGN_DOUBLE_TO_NODES(n, 6, z);
6649 ASSIGN_DOUBLE_TO_NODES(n, 8, w);
6650 }
6651
6652 ctx->ListState.ActiveAttribSize[index] = 4;
6653 memcpy(ctx->ListState.CurrentAttrib[index], &n[2],
6654 4 * sizeof(GLdouble));
6655
6656 if (ctx->ExecuteFlag) {
6657 CALL_VertexAttribL4d(ctx->Exec, (index, x, y, z, w));
6658 }
6659 } else {
6660 index_error();
6661 }
6662 }
6663
6664 static void GLAPIENTRY
6665 save_VertexAttribL4dv(GLuint index, const GLdouble *v)
6666 {
6667 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6668 save_VertexAttribL4d(index, v[0], v[1], v[2], v[3]);
6669 else
6670 index_error();
6671 }
6672
6673 static void GLAPIENTRY
6674 save_PrimitiveRestartNV(void)
6675 {
6676 /* Note: this is used when outside a glBegin/End pair in a display list */
6677 GET_CURRENT_CONTEXT(ctx);
6678 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6679 (void) alloc_instruction(ctx, OPCODE_PRIMITIVE_RESTART_NV, 0);
6680 if (ctx->ExecuteFlag) {
6681 CALL_PrimitiveRestartNV(ctx->Exec, ());
6682 }
6683 }
6684
6685
6686 static void GLAPIENTRY
6687 save_BlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
6688 GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
6689 GLbitfield mask, GLenum filter)
6690 {
6691 GET_CURRENT_CONTEXT(ctx);
6692 Node *n;
6693 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6694 n = alloc_instruction(ctx, OPCODE_BLIT_FRAMEBUFFER, 10);
6695 if (n) {
6696 n[1].i = srcX0;
6697 n[2].i = srcY0;
6698 n[3].i = srcX1;
6699 n[4].i = srcY1;
6700 n[5].i = dstX0;
6701 n[6].i = dstY0;
6702 n[7].i = dstX1;
6703 n[8].i = dstY1;
6704 n[9].i = mask;
6705 n[10].e = filter;
6706 }
6707 if (ctx->ExecuteFlag) {
6708 CALL_BlitFramebuffer(ctx->Exec, (srcX0, srcY0, srcX1, srcY1,
6709 dstX0, dstY0, dstX1, dstY1,
6710 mask, filter));
6711 }
6712 }
6713
6714
6715 /** GL_EXT_provoking_vertex */
6716 static void GLAPIENTRY
6717 save_ProvokingVertexEXT(GLenum mode)
6718 {
6719 GET_CURRENT_CONTEXT(ctx);
6720 Node *n;
6721 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6722 n = alloc_instruction(ctx, OPCODE_PROVOKING_VERTEX, 1);
6723 if (n) {
6724 n[1].e = mode;
6725 }
6726 if (ctx->ExecuteFlag) {
6727 /*CALL_ProvokingVertex(ctx->Exec, (mode));*/
6728 _mesa_ProvokingVertex(mode);
6729 }
6730 }
6731
6732
6733 /** GL_EXT_transform_feedback */
6734 static void GLAPIENTRY
6735 save_BeginTransformFeedback(GLenum mode)
6736 {
6737 GET_CURRENT_CONTEXT(ctx);
6738 Node *n;
6739 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6740 n = alloc_instruction(ctx, OPCODE_BEGIN_TRANSFORM_FEEDBACK, 1);
6741 if (n) {
6742 n[1].e = mode;
6743 }
6744 if (ctx->ExecuteFlag) {
6745 CALL_BeginTransformFeedback(ctx->Exec, (mode));
6746 }
6747 }
6748
6749
6750 /** GL_EXT_transform_feedback */
6751 static void GLAPIENTRY
6752 save_EndTransformFeedback(void)
6753 {
6754 GET_CURRENT_CONTEXT(ctx);
6755 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6756 (void) alloc_instruction(ctx, OPCODE_END_TRANSFORM_FEEDBACK, 0);
6757 if (ctx->ExecuteFlag) {
6758 CALL_EndTransformFeedback(ctx->Exec, ());
6759 }
6760 }
6761
6762 static void GLAPIENTRY
6763 save_BindTransformFeedback(GLenum target, GLuint name)
6764 {
6765 GET_CURRENT_CONTEXT(ctx);
6766 Node *n;
6767 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6768 n = alloc_instruction(ctx, OPCODE_BIND_TRANSFORM_FEEDBACK, 2);
6769 if (n) {
6770 n[1].e = target;
6771 n[2].ui = name;
6772 }
6773 if (ctx->ExecuteFlag) {
6774 CALL_BindTransformFeedback(ctx->Exec, (target, name));
6775 }
6776 }
6777
6778 static void GLAPIENTRY
6779 save_PauseTransformFeedback(void)
6780 {
6781 GET_CURRENT_CONTEXT(ctx);
6782 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6783 (void) alloc_instruction(ctx, OPCODE_PAUSE_TRANSFORM_FEEDBACK, 0);
6784 if (ctx->ExecuteFlag) {
6785 CALL_PauseTransformFeedback(ctx->Exec, ());
6786 }
6787 }
6788
6789 static void GLAPIENTRY
6790 save_ResumeTransformFeedback(void)
6791 {
6792 GET_CURRENT_CONTEXT(ctx);
6793 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6794 (void) alloc_instruction(ctx, OPCODE_RESUME_TRANSFORM_FEEDBACK, 0);
6795 if (ctx->ExecuteFlag) {
6796 CALL_ResumeTransformFeedback(ctx->Exec, ());
6797 }
6798 }
6799
6800 static void GLAPIENTRY
6801 save_DrawTransformFeedback(GLenum mode, GLuint name)
6802 {
6803 GET_CURRENT_CONTEXT(ctx);
6804 Node *n;
6805 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6806 n = alloc_instruction(ctx, OPCODE_DRAW_TRANSFORM_FEEDBACK, 2);
6807 if (n) {
6808 n[1].e = mode;
6809 n[2].ui = name;
6810 }
6811 if (ctx->ExecuteFlag) {
6812 CALL_DrawTransformFeedback(ctx->Exec, (mode, name));
6813 }
6814 }
6815
6816 static void GLAPIENTRY
6817 save_DrawTransformFeedbackStream(GLenum mode, GLuint name, GLuint stream)
6818 {
6819 GET_CURRENT_CONTEXT(ctx);
6820 Node *n;
6821 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6822 n = alloc_instruction(ctx, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM, 3);
6823 if (n) {
6824 n[1].e = mode;
6825 n[2].ui = name;
6826 n[3].ui = stream;
6827 }
6828 if (ctx->ExecuteFlag) {
6829 CALL_DrawTransformFeedbackStream(ctx->Exec, (mode, name, stream));
6830 }
6831 }
6832
6833 static void GLAPIENTRY
6834 save_DrawTransformFeedbackInstanced(GLenum mode, GLuint name,
6835 GLsizei primcount)
6836 {
6837 GET_CURRENT_CONTEXT(ctx);
6838 Node *n;
6839 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6840 n = alloc_instruction(ctx, OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED, 3);
6841 if (n) {
6842 n[1].e = mode;
6843 n[2].ui = name;
6844 n[3].si = primcount;
6845 }
6846 if (ctx->ExecuteFlag) {
6847 CALL_DrawTransformFeedbackInstanced(ctx->Exec, (mode, name, primcount));
6848 }
6849 }
6850
6851 static void GLAPIENTRY
6852 save_DrawTransformFeedbackStreamInstanced(GLenum mode, GLuint name,
6853 GLuint stream, GLsizei primcount)
6854 {
6855 GET_CURRENT_CONTEXT(ctx);
6856 Node *n;
6857 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6858 n = alloc_instruction(ctx, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED, 4);
6859 if (n) {
6860 n[1].e = mode;
6861 n[2].ui = name;
6862 n[3].ui = stream;
6863 n[4].si = primcount;
6864 }
6865 if (ctx->ExecuteFlag) {
6866 CALL_DrawTransformFeedbackStreamInstanced(ctx->Exec, (mode, name, stream,
6867 primcount));
6868 }
6869 }
6870
6871 static void GLAPIENTRY
6872 save_DispatchCompute(GLuint num_groups_x, GLuint num_groups_y,
6873 GLuint num_groups_z)
6874 {
6875 GET_CURRENT_CONTEXT(ctx);
6876 Node *n;
6877 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6878 n = alloc_instruction(ctx, OPCODE_DISPATCH_COMPUTE, 3);
6879 if (n) {
6880 n[1].ui = num_groups_x;
6881 n[2].ui = num_groups_y;
6882 n[3].ui = num_groups_z;
6883 }
6884 if (ctx->ExecuteFlag) {
6885 CALL_DispatchCompute(ctx->Exec, (num_groups_x, num_groups_y,
6886 num_groups_z));
6887 }
6888 }
6889
6890 static void GLAPIENTRY
6891 save_DispatchComputeIndirect(GLintptr indirect)
6892 {
6893 GET_CURRENT_CONTEXT(ctx);
6894 _mesa_error(ctx, GL_INVALID_OPERATION,
6895 "glDispatchComputeIndirect() during display list compile");
6896 }
6897
6898 static void GLAPIENTRY
6899 save_UseProgram(GLuint program)
6900 {
6901 GET_CURRENT_CONTEXT(ctx);
6902 Node *n;
6903 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6904 n = alloc_instruction(ctx, OPCODE_USE_PROGRAM, 1);
6905 if (n) {
6906 n[1].ui = program;
6907 }
6908 if (ctx->ExecuteFlag) {
6909 CALL_UseProgram(ctx->Exec, (program));
6910 }
6911 }
6912
6913
6914 static void GLAPIENTRY
6915 save_Uniform1fARB(GLint location, GLfloat x)
6916 {
6917 GET_CURRENT_CONTEXT(ctx);
6918 Node *n;
6919 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6920 n = alloc_instruction(ctx, OPCODE_UNIFORM_1F, 2);
6921 if (n) {
6922 n[1].i = location;
6923 n[2].f = x;
6924 }
6925 if (ctx->ExecuteFlag) {
6926 CALL_Uniform1f(ctx->Exec, (location, x));
6927 }
6928 }
6929
6930
6931 static void GLAPIENTRY
6932 save_Uniform2fARB(GLint location, GLfloat x, GLfloat y)
6933 {
6934 GET_CURRENT_CONTEXT(ctx);
6935 Node *n;
6936 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6937 n = alloc_instruction(ctx, OPCODE_UNIFORM_2F, 3);
6938 if (n) {
6939 n[1].i = location;
6940 n[2].f = x;
6941 n[3].f = y;
6942 }
6943 if (ctx->ExecuteFlag) {
6944 CALL_Uniform2f(ctx->Exec, (location, x, y));
6945 }
6946 }
6947
6948
6949 static void GLAPIENTRY
6950 save_Uniform3fARB(GLint location, GLfloat x, GLfloat y, GLfloat z)
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_3F, 4);
6956 if (n) {
6957 n[1].i = location;
6958 n[2].f = x;
6959 n[3].f = y;
6960 n[4].f = z;
6961 }
6962 if (ctx->ExecuteFlag) {
6963 CALL_Uniform3f(ctx->Exec, (location, x, y, z));
6964 }
6965 }
6966
6967
6968 static void GLAPIENTRY
6969 save_Uniform4fARB(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
6970 {
6971 GET_CURRENT_CONTEXT(ctx);
6972 Node *n;
6973 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6974 n = alloc_instruction(ctx, OPCODE_UNIFORM_4F, 5);
6975 if (n) {
6976 n[1].i = location;
6977 n[2].f = x;
6978 n[3].f = y;
6979 n[4].f = z;
6980 n[5].f = w;
6981 }
6982 if (ctx->ExecuteFlag) {
6983 CALL_Uniform4f(ctx->Exec, (location, x, y, z, w));
6984 }
6985 }
6986
6987
6988 static void GLAPIENTRY
6989 save_Uniform1fvARB(GLint location, GLsizei count, const GLfloat *v)
6990 {
6991 GET_CURRENT_CONTEXT(ctx);
6992 Node *n;
6993 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6994 n = alloc_instruction(ctx, OPCODE_UNIFORM_1FV, 2 + POINTER_DWORDS);
6995 if (n) {
6996 n[1].i = location;
6997 n[2].i = count;
6998 save_pointer(&n[3], memdup(v, count * 1 * sizeof(GLfloat)));
6999 }
7000 if (ctx->ExecuteFlag) {
7001 CALL_Uniform1fv(ctx->Exec, (location, count, v));
7002 }
7003 }
7004
7005 static void GLAPIENTRY
7006 save_Uniform2fvARB(GLint location, GLsizei count, const GLfloat *v)
7007 {
7008 GET_CURRENT_CONTEXT(ctx);
7009 Node *n;
7010 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7011 n = alloc_instruction(ctx, OPCODE_UNIFORM_2FV, 2 + POINTER_DWORDS);
7012 if (n) {
7013 n[1].i = location;
7014 n[2].i = count;
7015 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLfloat)));
7016 }
7017 if (ctx->ExecuteFlag) {
7018 CALL_Uniform2fv(ctx->Exec, (location, count, v));
7019 }
7020 }
7021
7022 static void GLAPIENTRY
7023 save_Uniform3fvARB(GLint location, GLsizei count, const GLfloat *v)
7024 {
7025 GET_CURRENT_CONTEXT(ctx);
7026 Node *n;
7027 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7028 n = alloc_instruction(ctx, OPCODE_UNIFORM_3FV, 2 + POINTER_DWORDS);
7029 if (n) {
7030 n[1].i = location;
7031 n[2].i = count;
7032 save_pointer(&n[3], memdup(v, count * 3 * sizeof(GLfloat)));
7033 }
7034 if (ctx->ExecuteFlag) {
7035 CALL_Uniform3fv(ctx->Exec, (location, count, v));
7036 }
7037 }
7038
7039 static void GLAPIENTRY
7040 save_Uniform4fvARB(GLint location, GLsizei count, const GLfloat *v)
7041 {
7042 GET_CURRENT_CONTEXT(ctx);
7043 Node *n;
7044 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7045 n = alloc_instruction(ctx, OPCODE_UNIFORM_4FV, 2 + POINTER_DWORDS);
7046 if (n) {
7047 n[1].i = location;
7048 n[2].i = count;
7049 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLfloat)));
7050 }
7051 if (ctx->ExecuteFlag) {
7052 CALL_Uniform4fv(ctx->Exec, (location, count, v));
7053 }
7054 }
7055
7056
7057 static void GLAPIENTRY
7058 save_Uniform1d(GLint location, GLdouble x)
7059 {
7060 GET_CURRENT_CONTEXT(ctx);
7061 Node *n;
7062 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7063 n = alloc_instruction(ctx, OPCODE_UNIFORM_1D, 3);
7064 if (n) {
7065 n[1].i = location;
7066 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
7067 }
7068 if (ctx->ExecuteFlag) {
7069 CALL_Uniform1d(ctx->Exec, (location, x));
7070 }
7071 }
7072
7073
7074 static void GLAPIENTRY
7075 save_Uniform2d(GLint location, GLdouble x, GLdouble y)
7076 {
7077 GET_CURRENT_CONTEXT(ctx);
7078 Node *n;
7079 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7080 n = alloc_instruction(ctx, OPCODE_UNIFORM_2D, 5);
7081 if (n) {
7082 n[1].i = location;
7083 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
7084 ASSIGN_DOUBLE_TO_NODES(n, 4, y);
7085 }
7086 if (ctx->ExecuteFlag) {
7087 CALL_Uniform2d(ctx->Exec, (location, x, y));
7088 }
7089 }
7090
7091
7092 static void GLAPIENTRY
7093 save_Uniform3d(GLint location, GLdouble x, GLdouble y, GLdouble z)
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_3D, 7);
7099 if (n) {
7100 n[1].i = location;
7101 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
7102 ASSIGN_DOUBLE_TO_NODES(n, 4, y);
7103 ASSIGN_DOUBLE_TO_NODES(n, 6, z);
7104 }
7105 if (ctx->ExecuteFlag) {
7106 CALL_Uniform3d(ctx->Exec, (location, x, y, z));
7107 }
7108 }
7109
7110
7111 static void GLAPIENTRY
7112 save_Uniform4d(GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
7113 {
7114 GET_CURRENT_CONTEXT(ctx);
7115 Node *n;
7116 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7117 n = alloc_instruction(ctx, OPCODE_UNIFORM_4D, 9);
7118 if (n) {
7119 n[1].i = location;
7120 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
7121 ASSIGN_DOUBLE_TO_NODES(n, 4, y);
7122 ASSIGN_DOUBLE_TO_NODES(n, 6, z);
7123 ASSIGN_DOUBLE_TO_NODES(n, 8, w);
7124 }
7125 if (ctx->ExecuteFlag) {
7126 CALL_Uniform4d(ctx->Exec, (location, x, y, z, w));
7127 }
7128 }
7129
7130
7131 static void GLAPIENTRY
7132 save_Uniform1dv(GLint location, GLsizei count, const GLdouble *v)
7133 {
7134 GET_CURRENT_CONTEXT(ctx);
7135 Node *n;
7136 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7137 n = alloc_instruction(ctx, OPCODE_UNIFORM_1DV, 2 + POINTER_DWORDS);
7138 if (n) {
7139 n[1].i = location;
7140 n[2].i = count;
7141 save_pointer(&n[3], memdup(v, count * 1 * sizeof(GLdouble)));
7142 }
7143 if (ctx->ExecuteFlag) {
7144 CALL_Uniform1dv(ctx->Exec, (location, count, v));
7145 }
7146 }
7147
7148
7149 static void GLAPIENTRY
7150 save_Uniform2dv(GLint location, GLsizei count, const GLdouble *v)
7151 {
7152 GET_CURRENT_CONTEXT(ctx);
7153 Node *n;
7154 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7155 n = alloc_instruction(ctx, OPCODE_UNIFORM_2DV, 2 + POINTER_DWORDS);
7156 if (n) {
7157 n[1].i = location;
7158 n[2].i = count;
7159 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLdouble)));
7160 }
7161 if (ctx->ExecuteFlag) {
7162 CALL_Uniform2dv(ctx->Exec, (location, count, v));
7163 }
7164 }
7165
7166
7167 static void GLAPIENTRY
7168 save_Uniform3dv(GLint location, GLsizei count, const GLdouble *v)
7169 {
7170 GET_CURRENT_CONTEXT(ctx);
7171 Node *n;
7172 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7173 n = alloc_instruction(ctx, OPCODE_UNIFORM_3DV, 2 + POINTER_DWORDS);
7174 if (n) {
7175 n[1].i = location;
7176 n[2].i = count;
7177 save_pointer(&n[3], memdup(v, count * 3 * sizeof(GLdouble)));
7178 }
7179 if (ctx->ExecuteFlag) {
7180 CALL_Uniform3dv(ctx->Exec, (location, count, v));
7181 }
7182 }
7183
7184
7185 static void GLAPIENTRY
7186 save_Uniform4dv(GLint location, GLsizei count, const GLdouble *v)
7187 {
7188 GET_CURRENT_CONTEXT(ctx);
7189 Node *n;
7190 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7191 n = alloc_instruction(ctx, OPCODE_UNIFORM_4DV, 2 + POINTER_DWORDS);
7192 if (n) {
7193 n[1].i = location;
7194 n[2].i = count;
7195 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLdouble)));
7196 }
7197 if (ctx->ExecuteFlag) {
7198 CALL_Uniform4dv(ctx->Exec, (location, count, v));
7199 }
7200 }
7201
7202
7203 static void GLAPIENTRY
7204 save_Uniform1iARB(GLint location, GLint x)
7205 {
7206 GET_CURRENT_CONTEXT(ctx);
7207 Node *n;
7208 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7209 n = alloc_instruction(ctx, OPCODE_UNIFORM_1I, 2);
7210 if (n) {
7211 n[1].i = location;
7212 n[2].i = x;
7213 }
7214 if (ctx->ExecuteFlag) {
7215 CALL_Uniform1i(ctx->Exec, (location, x));
7216 }
7217 }
7218
7219 static void GLAPIENTRY
7220 save_Uniform2iARB(GLint location, GLint x, GLint y)
7221 {
7222 GET_CURRENT_CONTEXT(ctx);
7223 Node *n;
7224 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7225 n = alloc_instruction(ctx, OPCODE_UNIFORM_2I, 3);
7226 if (n) {
7227 n[1].i = location;
7228 n[2].i = x;
7229 n[3].i = y;
7230 }
7231 if (ctx->ExecuteFlag) {
7232 CALL_Uniform2i(ctx->Exec, (location, x, y));
7233 }
7234 }
7235
7236 static void GLAPIENTRY
7237 save_Uniform3iARB(GLint location, GLint x, GLint y, GLint z)
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_3I, 4);
7243 if (n) {
7244 n[1].i = location;
7245 n[2].i = x;
7246 n[3].i = y;
7247 n[4].i = z;
7248 }
7249 if (ctx->ExecuteFlag) {
7250 CALL_Uniform3i(ctx->Exec, (location, x, y, z));
7251 }
7252 }
7253
7254 static void GLAPIENTRY
7255 save_Uniform4iARB(GLint location, GLint x, GLint y, GLint z, GLint w)
7256 {
7257 GET_CURRENT_CONTEXT(ctx);
7258 Node *n;
7259 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7260 n = alloc_instruction(ctx, OPCODE_UNIFORM_4I, 5);
7261 if (n) {
7262 n[1].i = location;
7263 n[2].i = x;
7264 n[3].i = y;
7265 n[4].i = z;
7266 n[5].i = w;
7267 }
7268 if (ctx->ExecuteFlag) {
7269 CALL_Uniform4i(ctx->Exec, (location, x, y, z, w));
7270 }
7271 }
7272
7273
7274
7275 static void GLAPIENTRY
7276 save_Uniform1ivARB(GLint location, GLsizei count, const GLint *v)
7277 {
7278 GET_CURRENT_CONTEXT(ctx);
7279 Node *n;
7280 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7281 n = alloc_instruction(ctx, OPCODE_UNIFORM_1IV, 2 + POINTER_DWORDS);
7282 if (n) {
7283 n[1].i = location;
7284 n[2].i = count;
7285 save_pointer(&n[3], memdup(v, count * 1 * sizeof(GLint)));
7286 }
7287 if (ctx->ExecuteFlag) {
7288 CALL_Uniform1iv(ctx->Exec, (location, count, v));
7289 }
7290 }
7291
7292 static void GLAPIENTRY
7293 save_Uniform2ivARB(GLint location, GLsizei count, const GLint *v)
7294 {
7295 GET_CURRENT_CONTEXT(ctx);
7296 Node *n;
7297 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7298 n = alloc_instruction(ctx, OPCODE_UNIFORM_2IV, 2 + POINTER_DWORDS);
7299 if (n) {
7300 n[1].i = location;
7301 n[2].i = count;
7302 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLint)));
7303 }
7304 if (ctx->ExecuteFlag) {
7305 CALL_Uniform2iv(ctx->Exec, (location, count, v));
7306 }
7307 }
7308
7309 static void GLAPIENTRY
7310 save_Uniform3ivARB(GLint location, GLsizei count, const GLint *v)
7311 {
7312 GET_CURRENT_CONTEXT(ctx);
7313 Node *n;
7314 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7315 n = alloc_instruction(ctx, OPCODE_UNIFORM_3IV, 2 + POINTER_DWORDS);
7316 if (n) {
7317 n[1].i = location;
7318 n[2].i = count;
7319 save_pointer(&n[3], memdup(v, count * 3 * sizeof(GLint)));
7320 }
7321 if (ctx->ExecuteFlag) {
7322 CALL_Uniform3iv(ctx->Exec, (location, count, v));
7323 }
7324 }
7325
7326 static void GLAPIENTRY
7327 save_Uniform4ivARB(GLint location, GLsizei count, const GLint *v)
7328 {
7329 GET_CURRENT_CONTEXT(ctx);
7330 Node *n;
7331 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7332 n = alloc_instruction(ctx, OPCODE_UNIFORM_4IV, 2 + POINTER_DWORDS);
7333 if (n) {
7334 n[1].i = location;
7335 n[2].i = count;
7336 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLfloat)));
7337 }
7338 if (ctx->ExecuteFlag) {
7339 CALL_Uniform4iv(ctx->Exec, (location, count, v));
7340 }
7341 }
7342
7343
7344
7345 static void GLAPIENTRY
7346 save_Uniform1ui(GLint location, GLuint x)
7347 {
7348 GET_CURRENT_CONTEXT(ctx);
7349 Node *n;
7350 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7351 n = alloc_instruction(ctx, OPCODE_UNIFORM_1UI, 2);
7352 if (n) {
7353 n[1].i = location;
7354 n[2].i = x;
7355 }
7356 if (ctx->ExecuteFlag) {
7357 CALL_Uniform1ui(ctx->Exec, (location, x));
7358 }
7359 }
7360
7361 static void GLAPIENTRY
7362 save_Uniform2ui(GLint location, GLuint x, GLuint y)
7363 {
7364 GET_CURRENT_CONTEXT(ctx);
7365 Node *n;
7366 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7367 n = alloc_instruction(ctx, OPCODE_UNIFORM_2UI, 3);
7368 if (n) {
7369 n[1].i = location;
7370 n[2].i = x;
7371 n[3].i = y;
7372 }
7373 if (ctx->ExecuteFlag) {
7374 CALL_Uniform2ui(ctx->Exec, (location, x, y));
7375 }
7376 }
7377
7378 static void GLAPIENTRY
7379 save_Uniform3ui(GLint location, GLuint x, GLuint y, GLuint z)
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_3UI, 4);
7385 if (n) {
7386 n[1].i = location;
7387 n[2].i = x;
7388 n[3].i = y;
7389 n[4].i = z;
7390 }
7391 if (ctx->ExecuteFlag) {
7392 CALL_Uniform3ui(ctx->Exec, (location, x, y, z));
7393 }
7394 }
7395
7396 static void GLAPIENTRY
7397 save_Uniform4ui(GLint location, GLuint x, GLuint y, GLuint z, GLuint w)
7398 {
7399 GET_CURRENT_CONTEXT(ctx);
7400 Node *n;
7401 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7402 n = alloc_instruction(ctx, OPCODE_UNIFORM_4UI, 5);
7403 if (n) {
7404 n[1].i = location;
7405 n[2].i = x;
7406 n[3].i = y;
7407 n[4].i = z;
7408 n[5].i = w;
7409 }
7410 if (ctx->ExecuteFlag) {
7411 CALL_Uniform4ui(ctx->Exec, (location, x, y, z, w));
7412 }
7413 }
7414
7415
7416
7417 static void GLAPIENTRY
7418 save_Uniform1uiv(GLint location, GLsizei count, const GLuint *v)
7419 {
7420 GET_CURRENT_CONTEXT(ctx);
7421 Node *n;
7422 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7423 n = alloc_instruction(ctx, OPCODE_UNIFORM_1UIV, 2 + POINTER_DWORDS);
7424 if (n) {
7425 n[1].i = location;
7426 n[2].i = count;
7427 save_pointer(&n[3], memdup(v, count * 1 * sizeof(*v)));
7428 }
7429 if (ctx->ExecuteFlag) {
7430 CALL_Uniform1uiv(ctx->Exec, (location, count, v));
7431 }
7432 }
7433
7434 static void GLAPIENTRY
7435 save_Uniform2uiv(GLint location, GLsizei count, const GLuint *v)
7436 {
7437 GET_CURRENT_CONTEXT(ctx);
7438 Node *n;
7439 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7440 n = alloc_instruction(ctx, OPCODE_UNIFORM_2UIV, 2 + POINTER_DWORDS);
7441 if (n) {
7442 n[1].i = location;
7443 n[2].i = count;
7444 save_pointer(&n[3], memdup(v, count * 2 * sizeof(*v)));
7445 }
7446 if (ctx->ExecuteFlag) {
7447 CALL_Uniform2uiv(ctx->Exec, (location, count, v));
7448 }
7449 }
7450
7451 static void GLAPIENTRY
7452 save_Uniform3uiv(GLint location, GLsizei count, const GLuint *v)
7453 {
7454 GET_CURRENT_CONTEXT(ctx);
7455 Node *n;
7456 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7457 n = alloc_instruction(ctx, OPCODE_UNIFORM_3UIV, 2 + POINTER_DWORDS);
7458 if (n) {
7459 n[1].i = location;
7460 n[2].i = count;
7461 save_pointer(&n[3], memdup(v, count * 3 * sizeof(*v)));
7462 }
7463 if (ctx->ExecuteFlag) {
7464 CALL_Uniform3uiv(ctx->Exec, (location, count, v));
7465 }
7466 }
7467
7468 static void GLAPIENTRY
7469 save_Uniform4uiv(GLint location, GLsizei count, const GLuint *v)
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_4UIV, 2 + POINTER_DWORDS);
7475 if (n) {
7476 n[1].i = location;
7477 n[2].i = count;
7478 save_pointer(&n[3], memdup(v, count * 4 * sizeof(*v)));
7479 }
7480 if (ctx->ExecuteFlag) {
7481 CALL_Uniform4uiv(ctx->Exec, (location, count, v));
7482 }
7483 }
7484
7485
7486
7487 static void GLAPIENTRY
7488 save_UniformMatrix2fvARB(GLint location, GLsizei count, GLboolean transpose,
7489 const GLfloat *m)
7490 {
7491 GET_CURRENT_CONTEXT(ctx);
7492 Node *n;
7493 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7494 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX22, 3 + POINTER_DWORDS);
7495 if (n) {
7496 n[1].i = location;
7497 n[2].i = count;
7498 n[3].b = transpose;
7499 save_pointer(&n[4], memdup(m, count * 2 * 2 * sizeof(GLfloat)));
7500 }
7501 if (ctx->ExecuteFlag) {
7502 CALL_UniformMatrix2fv(ctx->Exec, (location, count, transpose, m));
7503 }
7504 }
7505
7506 static void GLAPIENTRY
7507 save_UniformMatrix3fvARB(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_MATRIX33, 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 * 3 * 3 * sizeof(GLfloat)));
7519 }
7520 if (ctx->ExecuteFlag) {
7521 CALL_UniformMatrix3fv(ctx->Exec, (location, count, transpose, m));
7522 }
7523 }
7524
7525 static void GLAPIENTRY
7526 save_UniformMatrix4fvARB(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_MATRIX44, 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 * 4 * 4 * sizeof(GLfloat)));
7538 }
7539 if (ctx->ExecuteFlag) {
7540 CALL_UniformMatrix4fv(ctx->Exec, (location, count, transpose, m));
7541 }
7542 }
7543
7544
7545 static void GLAPIENTRY
7546 save_UniformMatrix2x3fv(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_MATRIX23, 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 * 3 * sizeof(GLfloat)));
7558 }
7559 if (ctx->ExecuteFlag) {
7560 CALL_UniformMatrix2x3fv(ctx->Exec, (location, count, transpose, m));
7561 }
7562 }
7563
7564 static void GLAPIENTRY
7565 save_UniformMatrix3x2fv(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_MATRIX32, 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 * 3 * 2 * sizeof(GLfloat)));
7577 }
7578 if (ctx->ExecuteFlag) {
7579 CALL_UniformMatrix3x2fv(ctx->Exec, (location, count, transpose, m));
7580 }
7581 }
7582
7583
7584 static void GLAPIENTRY
7585 save_UniformMatrix2x4fv(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_MATRIX24, 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 * 2 * 4 * sizeof(GLfloat)));
7597 }
7598 if (ctx->ExecuteFlag) {
7599 CALL_UniformMatrix2x4fv(ctx->Exec, (location, count, transpose, m));
7600 }
7601 }
7602
7603 static void GLAPIENTRY
7604 save_UniformMatrix4x2fv(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_MATRIX42, 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 * 2 * sizeof(GLfloat)));
7616 }
7617 if (ctx->ExecuteFlag) {
7618 CALL_UniformMatrix4x2fv(ctx->Exec, (location, count, transpose, m));
7619 }
7620 }
7621
7622
7623 static void GLAPIENTRY
7624 save_UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose,
7625 const GLfloat *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_MATRIX34, 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 * 3 * 4 * sizeof(GLfloat)));
7636 }
7637 if (ctx->ExecuteFlag) {
7638 CALL_UniformMatrix3x4fv(ctx->Exec, (location, count, transpose, m));
7639 }
7640 }
7641
7642 static void GLAPIENTRY
7643 save_UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose,
7644 const GLfloat *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_MATRIX43, 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 * 4 * 3 * sizeof(GLfloat)));
7655 }
7656 if (ctx->ExecuteFlag) {
7657 CALL_UniformMatrix4x3fv(ctx->Exec, (location, count, transpose, m));
7658 }
7659 }
7660
7661
7662 static void GLAPIENTRY
7663 save_UniformMatrix2dv(GLint location, GLsizei count, GLboolean transpose,
7664 const GLdouble *m)
7665 {
7666 GET_CURRENT_CONTEXT(ctx);
7667 Node *n;
7668 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7669 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX22D, 3 + POINTER_DWORDS);
7670 if (n) {
7671 n[1].i = location;
7672 n[2].i = count;
7673 n[3].b = transpose;
7674 save_pointer(&n[4], memdup(m, count * 2 * 2 * sizeof(GLdouble)));
7675 }
7676 if (ctx->ExecuteFlag) {
7677 CALL_UniformMatrix2dv(ctx->Exec, (location, count, transpose, m));
7678 }
7679 }
7680
7681 static void GLAPIENTRY
7682 save_UniformMatrix3dv(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_MATRIX33D, 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 * 3 * 3 * sizeof(GLdouble)));
7694 }
7695 if (ctx->ExecuteFlag) {
7696 CALL_UniformMatrix3dv(ctx->Exec, (location, count, transpose, m));
7697 }
7698 }
7699
7700 static void GLAPIENTRY
7701 save_UniformMatrix4dv(GLint location, GLsizei count, GLboolean transpose,
7702 const GLdouble *m)
7703 {
7704 GET_CURRENT_CONTEXT(ctx);
7705 Node *n;
7706 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7707 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX44D, 3 + POINTER_DWORDS);
7708 if (n) {
7709 n[1].i = location;
7710 n[2].i = count;
7711 n[3].b = transpose;
7712 save_pointer(&n[4], memdup(m, count * 4 * 4 * sizeof(GLdouble)));
7713 }
7714 if (ctx->ExecuteFlag) {
7715 CALL_UniformMatrix4dv(ctx->Exec, (location, count, transpose, m));
7716 }
7717 }
7718
7719
7720 static void GLAPIENTRY
7721 save_UniformMatrix2x3dv(GLint location, GLsizei count, GLboolean transpose,
7722 const GLdouble *m)
7723 {
7724 GET_CURRENT_CONTEXT(ctx);
7725 Node *n;
7726 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7727 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX23D, 3 + POINTER_DWORDS);
7728 if (n) {
7729 n[1].i = location;
7730 n[2].i = count;
7731 n[3].b = transpose;
7732 save_pointer(&n[4], memdup(m, count * 2 * 3 * sizeof(GLdouble)));
7733 }
7734 if (ctx->ExecuteFlag) {
7735 CALL_UniformMatrix2x3dv(ctx->Exec, (location, count, transpose, m));
7736 }
7737 }
7738
7739
7740 static void GLAPIENTRY
7741 save_UniformMatrix3x2dv(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_MATRIX32D, 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 * 3 * 2 * sizeof(GLdouble)));
7753 }
7754 if (ctx->ExecuteFlag) {
7755 CALL_UniformMatrix3x2dv(ctx->Exec, (location, count, transpose, m));
7756 }
7757 }
7758
7759
7760 static void GLAPIENTRY
7761 save_UniformMatrix2x4dv(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_MATRIX24D, 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 * 2 * 4 * sizeof(GLdouble)));
7773 }
7774 if (ctx->ExecuteFlag) {
7775 CALL_UniformMatrix2x4dv(ctx->Exec, (location, count, transpose, m));
7776 }
7777 }
7778
7779 static void GLAPIENTRY
7780 save_UniformMatrix4x2dv(GLint location, GLsizei count, GLboolean transpose,
7781 const GLdouble *m)
7782 {
7783 GET_CURRENT_CONTEXT(ctx);
7784 Node *n;
7785 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7786 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX42D, 3 + POINTER_DWORDS);
7787 if (n) {
7788 n[1].i = location;
7789 n[2].i = count;
7790 n[3].b = transpose;
7791 save_pointer(&n[4], memdup(m, count * 4 * 2 * sizeof(GLdouble)));
7792 }
7793 if (ctx->ExecuteFlag) {
7794 CALL_UniformMatrix4x2dv(ctx->Exec, (location, count, transpose, m));
7795 }
7796 }
7797
7798
7799 static void GLAPIENTRY
7800 save_UniformMatrix3x4dv(GLint location, GLsizei count, GLboolean transpose,
7801 const GLdouble *m)
7802 {
7803 GET_CURRENT_CONTEXT(ctx);
7804 Node *n;
7805 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7806 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX34D, 3 + POINTER_DWORDS);
7807 if (n) {
7808 n[1].i = location;
7809 n[2].i = count;
7810 n[3].b = transpose;
7811 save_pointer(&n[4], memdup(m, count * 3 * 4 * sizeof(GLdouble)));
7812 }
7813 if (ctx->ExecuteFlag) {
7814 CALL_UniformMatrix3x4dv(ctx->Exec, (location, count, transpose, m));
7815 }
7816 }
7817
7818
7819 static void GLAPIENTRY
7820 save_UniformMatrix4x3dv(GLint location, GLsizei count, GLboolean transpose,
7821 const GLdouble *m)
7822 {
7823 GET_CURRENT_CONTEXT(ctx);
7824 Node *n;
7825 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7826 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX43D, 3 + POINTER_DWORDS);
7827 if (n) {
7828 n[1].i = location;
7829 n[2].i = count;
7830 n[3].b = transpose;
7831 save_pointer(&n[4], memdup(m, count * 4 * 3 * sizeof(GLdouble)));
7832 }
7833 if (ctx->ExecuteFlag) {
7834 CALL_UniformMatrix4x3dv(ctx->Exec, (location, count, transpose, m));
7835 }
7836 }
7837
7838
7839 static void GLAPIENTRY
7840 save_UseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program)
7841 {
7842 GET_CURRENT_CONTEXT(ctx);
7843 Node *n;
7844 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7845 n = alloc_instruction(ctx, OPCODE_USE_PROGRAM_STAGES, 3);
7846 if (n) {
7847 n[1].ui = pipeline;
7848 n[2].ui = stages;
7849 n[3].ui = program;
7850 }
7851 if (ctx->ExecuteFlag) {
7852 CALL_UseProgramStages(ctx->Exec, (pipeline, stages, program));
7853 }
7854 }
7855
7856 static void GLAPIENTRY
7857 save_ProgramUniform1f(GLuint program, GLint location, GLfloat x)
7858 {
7859 GET_CURRENT_CONTEXT(ctx);
7860 Node *n;
7861 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7862 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1F, 3);
7863 if (n) {
7864 n[1].ui = program;
7865 n[2].i = location;
7866 n[3].f = x;
7867 }
7868 if (ctx->ExecuteFlag) {
7869 CALL_ProgramUniform1f(ctx->Exec, (program, location, x));
7870 }
7871 }
7872
7873 static void GLAPIENTRY
7874 save_ProgramUniform2f(GLuint program, GLint location, GLfloat x, GLfloat y)
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_2F, 4);
7880 if (n) {
7881 n[1].ui = program;
7882 n[2].i = location;
7883 n[3].f = x;
7884 n[4].f = y;
7885 }
7886 if (ctx->ExecuteFlag) {
7887 CALL_ProgramUniform2f(ctx->Exec, (program, location, x, y));
7888 }
7889 }
7890
7891 static void GLAPIENTRY
7892 save_ProgramUniform3f(GLuint program, GLint location,
7893 GLfloat x, GLfloat y, GLfloat z)
7894 {
7895 GET_CURRENT_CONTEXT(ctx);
7896 Node *n;
7897 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7898 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3F, 5);
7899 if (n) {
7900 n[1].ui = program;
7901 n[2].i = location;
7902 n[3].f = x;
7903 n[4].f = y;
7904 n[5].f = z;
7905 }
7906 if (ctx->ExecuteFlag) {
7907 CALL_ProgramUniform3f(ctx->Exec, (program, location, x, y, z));
7908 }
7909 }
7910
7911 static void GLAPIENTRY
7912 save_ProgramUniform4f(GLuint program, GLint location,
7913 GLfloat x, GLfloat y, GLfloat z, GLfloat w)
7914 {
7915 GET_CURRENT_CONTEXT(ctx);
7916 Node *n;
7917 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7918 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4F, 6);
7919 if (n) {
7920 n[1].ui = program;
7921 n[2].i = location;
7922 n[3].f = x;
7923 n[4].f = y;
7924 n[5].f = z;
7925 n[6].f = w;
7926 }
7927 if (ctx->ExecuteFlag) {
7928 CALL_ProgramUniform4f(ctx->Exec, (program, location, x, y, z, w));
7929 }
7930 }
7931
7932 static void GLAPIENTRY
7933 save_ProgramUniform1fv(GLuint program, GLint location, GLsizei count,
7934 const GLfloat *v)
7935 {
7936 GET_CURRENT_CONTEXT(ctx);
7937 Node *n;
7938 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7939 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1FV, 3 + POINTER_DWORDS);
7940 if (n) {
7941 n[1].ui = program;
7942 n[2].i = location;
7943 n[3].i = count;
7944 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLfloat)));
7945 }
7946 if (ctx->ExecuteFlag) {
7947 CALL_ProgramUniform1fv(ctx->Exec, (program, location, count, v));
7948 }
7949 }
7950
7951 static void GLAPIENTRY
7952 save_ProgramUniform2fv(GLuint program, GLint location, GLsizei count,
7953 const GLfloat *v)
7954 {
7955 GET_CURRENT_CONTEXT(ctx);
7956 Node *n;
7957 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7958 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2FV, 3 + POINTER_DWORDS);
7959 if (n) {
7960 n[1].ui = program;
7961 n[2].i = location;
7962 n[3].i = count;
7963 save_pointer(&n[4], memdup(v, count * 2 * sizeof(GLfloat)));
7964 }
7965 if (ctx->ExecuteFlag) {
7966 CALL_ProgramUniform2fv(ctx->Exec, (program, location, count, v));
7967 }
7968 }
7969
7970 static void GLAPIENTRY
7971 save_ProgramUniform3fv(GLuint program, GLint location, GLsizei count,
7972 const GLfloat *v)
7973 {
7974 GET_CURRENT_CONTEXT(ctx);
7975 Node *n;
7976 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7977 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3FV, 3 + POINTER_DWORDS);
7978 if (n) {
7979 n[1].ui = program;
7980 n[2].i = location;
7981 n[3].i = count;
7982 save_pointer(&n[4], memdup(v, count * 3 * sizeof(GLfloat)));
7983 }
7984 if (ctx->ExecuteFlag) {
7985 CALL_ProgramUniform3fv(ctx->Exec, (program, location, count, v));
7986 }
7987 }
7988
7989 static void GLAPIENTRY
7990 save_ProgramUniform4fv(GLuint program, GLint location, GLsizei count,
7991 const GLfloat *v)
7992 {
7993 GET_CURRENT_CONTEXT(ctx);
7994 Node *n;
7995 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7996 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4FV, 3 + POINTER_DWORDS);
7997 if (n) {
7998 n[1].ui = program;
7999 n[2].i = location;
8000 n[3].i = count;
8001 save_pointer(&n[4], memdup(v, count * 4 * sizeof(GLfloat)));
8002 }
8003 if (ctx->ExecuteFlag) {
8004 CALL_ProgramUniform4fv(ctx->Exec, (program, location, count, v));
8005 }
8006 }
8007
8008 static void GLAPIENTRY
8009 save_ProgramUniform1d(GLuint program, GLint location, GLdouble x)
8010 {
8011 GET_CURRENT_CONTEXT(ctx);
8012 Node *n;
8013 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8014 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1D, 4);
8015 if (n) {
8016 n[1].ui = program;
8017 n[2].i = location;
8018 ASSIGN_DOUBLE_TO_NODES(n, 3, x);
8019 }
8020 if (ctx->ExecuteFlag) {
8021 CALL_ProgramUniform1d(ctx->Exec, (program, location, x));
8022 }
8023 }
8024
8025 static void GLAPIENTRY
8026 save_ProgramUniform2d(GLuint program, GLint location, GLdouble x, GLdouble y)
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_2D, 6);
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 }
8038 if (ctx->ExecuteFlag) {
8039 CALL_ProgramUniform2d(ctx->Exec, (program, location, x, y));
8040 }
8041 }
8042
8043 static void GLAPIENTRY
8044 save_ProgramUniform3d(GLuint program, GLint location,
8045 GLdouble x, GLdouble y, GLdouble z)
8046 {
8047 GET_CURRENT_CONTEXT(ctx);
8048 Node *n;
8049 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8050 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3D, 8);
8051 if (n) {
8052 n[1].ui = program;
8053 n[2].i = location;
8054 ASSIGN_DOUBLE_TO_NODES(n, 3, x);
8055 ASSIGN_DOUBLE_TO_NODES(n, 5, y);
8056 ASSIGN_DOUBLE_TO_NODES(n, 7, z);
8057 }
8058 if (ctx->ExecuteFlag) {
8059 CALL_ProgramUniform3d(ctx->Exec, (program, location, x, y, z));
8060 }
8061 }
8062
8063 static void GLAPIENTRY
8064 save_ProgramUniform4d(GLuint program, GLint location,
8065 GLdouble x, GLdouble y, GLdouble z, GLdouble w)
8066 {
8067 GET_CURRENT_CONTEXT(ctx);
8068 Node *n;
8069 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8070 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4D, 10);
8071 if (n) {
8072 n[1].ui = program;
8073 n[2].i = location;
8074 ASSIGN_DOUBLE_TO_NODES(n, 3, x);
8075 ASSIGN_DOUBLE_TO_NODES(n, 5, y);
8076 ASSIGN_DOUBLE_TO_NODES(n, 7, z);
8077 ASSIGN_DOUBLE_TO_NODES(n, 9, w);
8078 }
8079 if (ctx->ExecuteFlag) {
8080 CALL_ProgramUniform4d(ctx->Exec, (program, location, x, y, z, w));
8081 }
8082 }
8083
8084 static void GLAPIENTRY
8085 save_ProgramUniform1dv(GLuint program, GLint location, GLsizei count,
8086 const GLdouble *v)
8087 {
8088 GET_CURRENT_CONTEXT(ctx);
8089 Node *n;
8090 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8091 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1DV, 3 + POINTER_DWORDS);
8092 if (n) {
8093 n[1].ui = program;
8094 n[2].i = location;
8095 n[3].i = count;
8096 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLdouble)));
8097 }
8098 if (ctx->ExecuteFlag) {
8099 CALL_ProgramUniform1dv(ctx->Exec, (program, location, count, v));
8100 }
8101 }
8102
8103 static void GLAPIENTRY
8104 save_ProgramUniform2dv(GLuint program, GLint location, GLsizei count,
8105 const GLdouble *v)
8106 {
8107 GET_CURRENT_CONTEXT(ctx);
8108 Node *n;
8109 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8110 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2DV, 3 + POINTER_DWORDS);
8111 if (n) {
8112 n[1].ui = program;
8113 n[2].i = location;
8114 n[3].i = count;
8115 save_pointer(&n[4], memdup(v, count * 2 * sizeof(GLdouble)));
8116 }
8117 if (ctx->ExecuteFlag) {
8118 CALL_ProgramUniform2dv(ctx->Exec, (program, location, count, v));
8119 }
8120 }
8121
8122 static void GLAPIENTRY
8123 save_ProgramUniform3dv(GLuint program, GLint location, GLsizei count,
8124 const GLdouble *v)
8125 {
8126 GET_CURRENT_CONTEXT(ctx);
8127 Node *n;
8128 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8129 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3DV, 3 + POINTER_DWORDS);
8130 if (n) {
8131 n[1].ui = program;
8132 n[2].i = location;
8133 n[3].i = count;
8134 save_pointer(&n[4], memdup(v, count * 3 * sizeof(GLdouble)));
8135 }
8136 if (ctx->ExecuteFlag) {
8137 CALL_ProgramUniform3dv(ctx->Exec, (program, location, count, v));
8138 }
8139 }
8140
8141 static void GLAPIENTRY
8142 save_ProgramUniform4dv(GLuint program, GLint location, GLsizei count,
8143 const GLdouble *v)
8144 {
8145 GET_CURRENT_CONTEXT(ctx);
8146 Node *n;
8147 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8148 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4DV, 3 + POINTER_DWORDS);
8149 if (n) {
8150 n[1].ui = program;
8151 n[2].i = location;
8152 n[3].i = count;
8153 save_pointer(&n[4], memdup(v, count * 4 * sizeof(GLdouble)));
8154 }
8155 if (ctx->ExecuteFlag) {
8156 CALL_ProgramUniform4dv(ctx->Exec, (program, location, count, v));
8157 }
8158 }
8159
8160 static void GLAPIENTRY
8161 save_ProgramUniform1i(GLuint program, GLint location, GLint x)
8162 {
8163 GET_CURRENT_CONTEXT(ctx);
8164 Node *n;
8165 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8166 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1I, 3);
8167 if (n) {
8168 n[1].ui = program;
8169 n[2].i = location;
8170 n[3].i = x;
8171 }
8172 if (ctx->ExecuteFlag) {
8173 CALL_ProgramUniform1i(ctx->Exec, (program, location, x));
8174 }
8175 }
8176
8177 static void GLAPIENTRY
8178 save_ProgramUniform2i(GLuint program, GLint location, GLint x, GLint y)
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_2I, 4);
8184 if (n) {
8185 n[1].ui = program;
8186 n[2].i = location;
8187 n[3].i = x;
8188 n[4].i = y;
8189 }
8190 if (ctx->ExecuteFlag) {
8191 CALL_ProgramUniform2i(ctx->Exec, (program, location, x, y));
8192 }
8193 }
8194
8195 static void GLAPIENTRY
8196 save_ProgramUniform3i(GLuint program, GLint location,
8197 GLint x, GLint y, GLint z)
8198 {
8199 GET_CURRENT_CONTEXT(ctx);
8200 Node *n;
8201 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8202 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3I, 5);
8203 if (n) {
8204 n[1].ui = program;
8205 n[2].i = location;
8206 n[3].i = x;
8207 n[4].i = y;
8208 n[5].i = z;
8209 }
8210 if (ctx->ExecuteFlag) {
8211 CALL_ProgramUniform3i(ctx->Exec, (program, location, x, y, z));
8212 }
8213 }
8214
8215 static void GLAPIENTRY
8216 save_ProgramUniform4i(GLuint program, GLint location,
8217 GLint x, GLint y, GLint z, GLint w)
8218 {
8219 GET_CURRENT_CONTEXT(ctx);
8220 Node *n;
8221 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8222 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4I, 6);
8223 if (n) {
8224 n[1].ui = program;
8225 n[2].i = location;
8226 n[3].i = x;
8227 n[4].i = y;
8228 n[5].i = z;
8229 n[6].i = w;
8230 }
8231 if (ctx->ExecuteFlag) {
8232 CALL_ProgramUniform4i(ctx->Exec, (program, location, x, y, z, w));
8233 }
8234 }
8235
8236 static void GLAPIENTRY
8237 save_ProgramUniform1iv(GLuint program, GLint location, GLsizei count,
8238 const GLint *v)
8239 {
8240 GET_CURRENT_CONTEXT(ctx);
8241 Node *n;
8242 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8243 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1IV, 3 + POINTER_DWORDS);
8244 if (n) {
8245 n[1].ui = program;
8246 n[2].i = location;
8247 n[3].i = count;
8248 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLint)));
8249 }
8250 if (ctx->ExecuteFlag) {
8251 CALL_ProgramUniform1iv(ctx->Exec, (program, location, count, v));
8252 }
8253 }
8254
8255 static void GLAPIENTRY
8256 save_ProgramUniform2iv(GLuint program, GLint location, GLsizei count,
8257 const GLint *v)
8258 {
8259 GET_CURRENT_CONTEXT(ctx);
8260 Node *n;
8261 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8262 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2IV, 3 + POINTER_DWORDS);
8263 if (n) {
8264 n[1].ui = program;
8265 n[2].i = location;
8266 n[3].i = count;
8267 save_pointer(&n[4], memdup(v, count * 2 * sizeof(GLint)));
8268 }
8269 if (ctx->ExecuteFlag) {
8270 CALL_ProgramUniform2iv(ctx->Exec, (program, location, count, v));
8271 }
8272 }
8273
8274 static void GLAPIENTRY
8275 save_ProgramUniform3iv(GLuint program, GLint location, GLsizei count,
8276 const GLint *v)
8277 {
8278 GET_CURRENT_CONTEXT(ctx);
8279 Node *n;
8280 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8281 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3IV, 3 + POINTER_DWORDS);
8282 if (n) {
8283 n[1].ui = program;
8284 n[2].i = location;
8285 n[3].i = count;
8286 save_pointer(&n[4], memdup(v, count * 3 * sizeof(GLint)));
8287 }
8288 if (ctx->ExecuteFlag) {
8289 CALL_ProgramUniform3iv(ctx->Exec, (program, location, count, v));
8290 }
8291 }
8292
8293 static void GLAPIENTRY
8294 save_ProgramUniform4iv(GLuint program, GLint location, GLsizei count,
8295 const GLint *v)
8296 {
8297 GET_CURRENT_CONTEXT(ctx);
8298 Node *n;
8299 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8300 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4IV, 3 + POINTER_DWORDS);
8301 if (n) {
8302 n[1].ui = program;
8303 n[2].i = location;
8304 n[3].i = count;
8305 save_pointer(&n[4], memdup(v, count * 4 * sizeof(GLint)));
8306 }
8307 if (ctx->ExecuteFlag) {
8308 CALL_ProgramUniform4iv(ctx->Exec, (program, location, count, v));
8309 }
8310 }
8311
8312 static void GLAPIENTRY
8313 save_ProgramUniform1ui(GLuint program, GLint location, GLuint x)
8314 {
8315 GET_CURRENT_CONTEXT(ctx);
8316 Node *n;
8317 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8318 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1UI, 3);
8319 if (n) {
8320 n[1].ui = program;
8321 n[2].i = location;
8322 n[3].ui = x;
8323 }
8324 if (ctx->ExecuteFlag) {
8325 CALL_ProgramUniform1ui(ctx->Exec, (program, location, x));
8326 }
8327 }
8328
8329 static void GLAPIENTRY
8330 save_ProgramUniform2ui(GLuint program, GLint location, GLuint x, GLuint y)
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_2UI, 4);
8336 if (n) {
8337 n[1].ui = program;
8338 n[2].i = location;
8339 n[3].ui = x;
8340 n[4].ui = y;
8341 }
8342 if (ctx->ExecuteFlag) {
8343 CALL_ProgramUniform2ui(ctx->Exec, (program, location, x, y));
8344 }
8345 }
8346
8347 static void GLAPIENTRY
8348 save_ProgramUniform3ui(GLuint program, GLint location,
8349 GLuint x, GLuint y, GLuint z)
8350 {
8351 GET_CURRENT_CONTEXT(ctx);
8352 Node *n;
8353 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8354 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3UI, 5);
8355 if (n) {
8356 n[1].ui = program;
8357 n[2].i = location;
8358 n[3].ui = x;
8359 n[4].ui = y;
8360 n[5].ui = z;
8361 }
8362 if (ctx->ExecuteFlag) {
8363 CALL_ProgramUniform3ui(ctx->Exec, (program, location, x, y, z));
8364 }
8365 }
8366
8367 static void GLAPIENTRY
8368 save_ProgramUniform4ui(GLuint program, GLint location,
8369 GLuint x, GLuint y, GLuint z, GLuint w)
8370 {
8371 GET_CURRENT_CONTEXT(ctx);
8372 Node *n;
8373 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8374 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4UI, 6);
8375 if (n) {
8376 n[1].ui = program;
8377 n[2].i = location;
8378 n[3].ui = x;
8379 n[4].ui = y;
8380 n[5].ui = z;
8381 n[6].ui = w;
8382 }
8383 if (ctx->ExecuteFlag) {
8384 CALL_ProgramUniform4ui(ctx->Exec, (program, location, x, y, z, w));
8385 }
8386 }
8387
8388 static void GLAPIENTRY
8389 save_ProgramUniform1uiv(GLuint program, GLint location, GLsizei count,
8390 const GLuint *v)
8391 {
8392 GET_CURRENT_CONTEXT(ctx);
8393 Node *n;
8394 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8395 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1UIV, 3 + POINTER_DWORDS);
8396 if (n) {
8397 n[1].ui = program;
8398 n[2].i = location;
8399 n[3].i = count;
8400 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLuint)));
8401 }
8402 if (ctx->ExecuteFlag) {
8403 CALL_ProgramUniform1uiv(ctx->Exec, (program, location, count, v));
8404 }
8405 }
8406
8407 static void GLAPIENTRY
8408 save_ProgramUniform2uiv(GLuint program, GLint location, GLsizei count,
8409 const GLuint *v)
8410 {
8411 GET_CURRENT_CONTEXT(ctx);
8412 Node *n;
8413 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8414 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2UIV, 3 + POINTER_DWORDS);
8415 if (n) {
8416 n[1].ui = program;
8417 n[2].i = location;
8418 n[3].i = count;
8419 save_pointer(&n[4], memdup(v, count * 2 * sizeof(GLuint)));
8420 }
8421 if (ctx->ExecuteFlag) {
8422 CALL_ProgramUniform2uiv(ctx->Exec, (program, location, count, v));
8423 }
8424 }
8425
8426 static void GLAPIENTRY
8427 save_ProgramUniform3uiv(GLuint program, GLint location, GLsizei count,
8428 const GLuint *v)
8429 {
8430 GET_CURRENT_CONTEXT(ctx);
8431 Node *n;
8432 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8433 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3UIV, 3 + POINTER_DWORDS);
8434 if (n) {
8435 n[1].ui = program;
8436 n[2].i = location;
8437 n[3].i = count;
8438 save_pointer(&n[4], memdup(v, count * 3 * sizeof(GLuint)));
8439 }
8440 if (ctx->ExecuteFlag) {
8441 CALL_ProgramUniform3uiv(ctx->Exec, (program, location, count, v));
8442 }
8443 }
8444
8445 static void GLAPIENTRY
8446 save_ProgramUniform4uiv(GLuint program, GLint location, GLsizei count,
8447 const GLuint *v)
8448 {
8449 GET_CURRENT_CONTEXT(ctx);
8450 Node *n;
8451 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8452 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4UIV, 3 + POINTER_DWORDS);
8453 if (n) {
8454 n[1].ui = program;
8455 n[2].i = location;
8456 n[3].i = count;
8457 save_pointer(&n[4], memdup(v, count * 4 * sizeof(GLuint)));
8458 }
8459 if (ctx->ExecuteFlag) {
8460 CALL_ProgramUniform4uiv(ctx->Exec, (program, location, count, v));
8461 }
8462 }
8463
8464 static void GLAPIENTRY
8465 save_ProgramUniformMatrix2fv(GLuint program, GLint location, GLsizei count,
8466 GLboolean transpose, const GLfloat *v)
8467 {
8468 GET_CURRENT_CONTEXT(ctx);
8469 Node *n;
8470 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8471 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX22F,
8472 4 + POINTER_DWORDS);
8473 if (n) {
8474 n[1].ui = program;
8475 n[2].i = location;
8476 n[3].i = count;
8477 n[4].b = transpose;
8478 save_pointer(&n[5], memdup(v, count * 2 * 2 * sizeof(GLfloat)));
8479 }
8480 if (ctx->ExecuteFlag) {
8481 CALL_ProgramUniformMatrix2fv(ctx->Exec,
8482 (program, location, count, transpose, v));
8483 }
8484 }
8485
8486 static void GLAPIENTRY
8487 save_ProgramUniformMatrix2x3fv(GLuint program, GLint location, GLsizei count,
8488 GLboolean transpose, const GLfloat *v)
8489 {
8490 GET_CURRENT_CONTEXT(ctx);
8491 Node *n;
8492 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8493 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX23F,
8494 4 + POINTER_DWORDS);
8495 if (n) {
8496 n[1].ui = program;
8497 n[2].i = location;
8498 n[3].i = count;
8499 n[4].b = transpose;
8500 save_pointer(&n[5], memdup(v, count * 2 * 3 * sizeof(GLfloat)));
8501 }
8502 if (ctx->ExecuteFlag) {
8503 CALL_ProgramUniformMatrix2x3fv(ctx->Exec,
8504 (program, location, count, transpose, v));
8505 }
8506 }
8507
8508 static void GLAPIENTRY
8509 save_ProgramUniformMatrix2x4fv(GLuint program, GLint location, GLsizei count,
8510 GLboolean transpose, const GLfloat *v)
8511 {
8512 GET_CURRENT_CONTEXT(ctx);
8513 Node *n;
8514 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8515 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX24F,
8516 4 + POINTER_DWORDS);
8517 if (n) {
8518 n[1].ui = program;
8519 n[2].i = location;
8520 n[3].i = count;
8521 n[4].b = transpose;
8522 save_pointer(&n[5], memdup(v, count * 2 * 4 * sizeof(GLfloat)));
8523 }
8524 if (ctx->ExecuteFlag) {
8525 CALL_ProgramUniformMatrix2x4fv(ctx->Exec,
8526 (program, location, count, transpose, v));
8527 }
8528 }
8529
8530 static void GLAPIENTRY
8531 save_ProgramUniformMatrix3x2fv(GLuint program, GLint location, GLsizei count,
8532 GLboolean transpose, const GLfloat *v)
8533 {
8534 GET_CURRENT_CONTEXT(ctx);
8535 Node *n;
8536 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8537 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX32F,
8538 4 + POINTER_DWORDS);
8539 if (n) {
8540 n[1].ui = program;
8541 n[2].i = location;
8542 n[3].i = count;
8543 n[4].b = transpose;
8544 save_pointer(&n[5], memdup(v, count * 3 * 2 * sizeof(GLfloat)));
8545 }
8546 if (ctx->ExecuteFlag) {
8547 CALL_ProgramUniformMatrix3x2fv(ctx->Exec,
8548 (program, location, count, transpose, v));
8549 }
8550 }
8551
8552 static void GLAPIENTRY
8553 save_ProgramUniformMatrix3fv(GLuint program, GLint location, GLsizei count,
8554 GLboolean transpose, const GLfloat *v)
8555 {
8556 GET_CURRENT_CONTEXT(ctx);
8557 Node *n;
8558 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8559 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX33F,
8560 4 + POINTER_DWORDS);
8561 if (n) {
8562 n[1].ui = program;
8563 n[2].i = location;
8564 n[3].i = count;
8565 n[4].b = transpose;
8566 save_pointer(&n[5], memdup(v, count * 3 * 3 * sizeof(GLfloat)));
8567 }
8568 if (ctx->ExecuteFlag) {
8569 CALL_ProgramUniformMatrix3fv(ctx->Exec,
8570 (program, location, count, transpose, v));
8571 }
8572 }
8573
8574 static void GLAPIENTRY
8575 save_ProgramUniformMatrix3x4fv(GLuint program, GLint location, GLsizei count,
8576 GLboolean transpose, const GLfloat *v)
8577 {
8578 GET_CURRENT_CONTEXT(ctx);
8579 Node *n;
8580 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8581 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX34F,
8582 4 + POINTER_DWORDS);
8583 if (n) {
8584 n[1].ui = program;
8585 n[2].i = location;
8586 n[3].i = count;
8587 n[4].b = transpose;
8588 save_pointer(&n[5], memdup(v, count * 3 * 4 * sizeof(GLfloat)));
8589 }
8590 if (ctx->ExecuteFlag) {
8591 CALL_ProgramUniformMatrix3x4fv(ctx->Exec,
8592 (program, location, count, transpose, v));
8593 }
8594 }
8595
8596 static void GLAPIENTRY
8597 save_ProgramUniformMatrix4x2fv(GLuint program, GLint location, GLsizei count,
8598 GLboolean transpose, const GLfloat *v)
8599 {
8600 GET_CURRENT_CONTEXT(ctx);
8601 Node *n;
8602 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8603 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX42F,
8604 4 + POINTER_DWORDS);
8605 if (n) {
8606 n[1].ui = program;
8607 n[2].i = location;
8608 n[3].i = count;
8609 n[4].b = transpose;
8610 save_pointer(&n[5], memdup(v, count * 4 * 2 * sizeof(GLfloat)));
8611 }
8612 if (ctx->ExecuteFlag) {
8613 CALL_ProgramUniformMatrix4x2fv(ctx->Exec,
8614 (program, location, count, transpose, v));
8615 }
8616 }
8617
8618 static void GLAPIENTRY
8619 save_ProgramUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count,
8620 GLboolean transpose, const GLfloat *v)
8621 {
8622 GET_CURRENT_CONTEXT(ctx);
8623 Node *n;
8624 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8625 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX43F,
8626 4 + POINTER_DWORDS);
8627 if (n) {
8628 n[1].ui = program;
8629 n[2].i = location;
8630 n[3].i = count;
8631 n[4].b = transpose;
8632 save_pointer(&n[5], memdup(v, count * 4 * 3 * sizeof(GLfloat)));
8633 }
8634 if (ctx->ExecuteFlag) {
8635 CALL_ProgramUniformMatrix4x3fv(ctx->Exec,
8636 (program, location, count, transpose, v));
8637 }
8638 }
8639
8640 static void GLAPIENTRY
8641 save_ProgramUniformMatrix4fv(GLuint program, GLint location, GLsizei count,
8642 GLboolean transpose, const GLfloat *v)
8643 {
8644 GET_CURRENT_CONTEXT(ctx);
8645 Node *n;
8646 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8647 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX44F,
8648 4 + POINTER_DWORDS);
8649 if (n) {
8650 n[1].ui = program;
8651 n[2].i = location;
8652 n[3].i = count;
8653 n[4].b = transpose;
8654 save_pointer(&n[5], memdup(v, count * 4 * 4 * sizeof(GLfloat)));
8655 }
8656 if (ctx->ExecuteFlag) {
8657 CALL_ProgramUniformMatrix4fv(ctx->Exec,
8658 (program, location, count, transpose, v));
8659 }
8660 }
8661
8662 static void GLAPIENTRY
8663 save_ProgramUniformMatrix2dv(GLuint program, GLint location, GLsizei count,
8664 GLboolean transpose, const GLdouble *v)
8665 {
8666 GET_CURRENT_CONTEXT(ctx);
8667 Node *n;
8668 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8669 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX22D,
8670 4 + POINTER_DWORDS);
8671 if (n) {
8672 n[1].ui = program;
8673 n[2].i = location;
8674 n[3].i = count;
8675 n[4].b = transpose;
8676 save_pointer(&n[5], memdup(v, count * 2 * 2 * sizeof(GLdouble)));
8677 }
8678 if (ctx->ExecuteFlag) {
8679 CALL_ProgramUniformMatrix2dv(ctx->Exec,
8680 (program, location, count, transpose, v));
8681 }
8682 }
8683
8684 static void GLAPIENTRY
8685 save_ProgramUniformMatrix2x3dv(GLuint program, GLint location, GLsizei count,
8686 GLboolean transpose, const GLdouble *v)
8687 {
8688 GET_CURRENT_CONTEXT(ctx);
8689 Node *n;
8690 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8691 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX23D,
8692 4 + POINTER_DWORDS);
8693 if (n) {
8694 n[1].ui = program;
8695 n[2].i = location;
8696 n[3].i = count;
8697 n[4].b = transpose;
8698 save_pointer(&n[5], memdup(v, count * 2 * 3 * sizeof(GLdouble)));
8699 }
8700 if (ctx->ExecuteFlag) {
8701 CALL_ProgramUniformMatrix2x3dv(ctx->Exec,
8702 (program, location, count, transpose, v));
8703 }
8704 }
8705
8706 static void GLAPIENTRY
8707 save_ProgramUniformMatrix2x4dv(GLuint program, GLint location, GLsizei count,
8708 GLboolean transpose, const GLdouble *v)
8709 {
8710 GET_CURRENT_CONTEXT(ctx);
8711 Node *n;
8712 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8713 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX24D,
8714 4 + POINTER_DWORDS);
8715 if (n) {
8716 n[1].ui = program;
8717 n[2].i = location;
8718 n[3].i = count;
8719 n[4].b = transpose;
8720 save_pointer(&n[5], memdup(v, count * 2 * 4 * sizeof(GLdouble)));
8721 }
8722 if (ctx->ExecuteFlag) {
8723 CALL_ProgramUniformMatrix2x4dv(ctx->Exec,
8724 (program, location, count, transpose, v));
8725 }
8726 }
8727
8728 static void GLAPIENTRY
8729 save_ProgramUniformMatrix3x2dv(GLuint program, GLint location, GLsizei count,
8730 GLboolean transpose, const GLdouble *v)
8731 {
8732 GET_CURRENT_CONTEXT(ctx);
8733 Node *n;
8734 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8735 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX32D,
8736 4 + POINTER_DWORDS);
8737 if (n) {
8738 n[1].ui = program;
8739 n[2].i = location;
8740 n[3].i = count;
8741 n[4].b = transpose;
8742 save_pointer(&n[5], memdup(v, count * 3 * 2 * sizeof(GLdouble)));
8743 }
8744 if (ctx->ExecuteFlag) {
8745 CALL_ProgramUniformMatrix3x2dv(ctx->Exec,
8746 (program, location, count, transpose, v));
8747 }
8748 }
8749
8750 static void GLAPIENTRY
8751 save_ProgramUniformMatrix3dv(GLuint program, GLint location, GLsizei count,
8752 GLboolean transpose, const GLdouble *v)
8753 {
8754 GET_CURRENT_CONTEXT(ctx);
8755 Node *n;
8756 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8757 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX33D,
8758 4 + POINTER_DWORDS);
8759 if (n) {
8760 n[1].ui = program;
8761 n[2].i = location;
8762 n[3].i = count;
8763 n[4].b = transpose;
8764 save_pointer(&n[5], memdup(v, count * 3 * 3 * sizeof(GLdouble)));
8765 }
8766 if (ctx->ExecuteFlag) {
8767 CALL_ProgramUniformMatrix3dv(ctx->Exec,
8768 (program, location, count, transpose, v));
8769 }
8770 }
8771
8772 static void GLAPIENTRY
8773 save_ProgramUniformMatrix3x4dv(GLuint program, GLint location, GLsizei count,
8774 GLboolean transpose, const GLdouble *v)
8775 {
8776 GET_CURRENT_CONTEXT(ctx);
8777 Node *n;
8778 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8779 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX34D,
8780 4 + POINTER_DWORDS);
8781 if (n) {
8782 n[1].ui = program;
8783 n[2].i = location;
8784 n[3].i = count;
8785 n[4].b = transpose;
8786 save_pointer(&n[5], memdup(v, count * 3 * 4 * sizeof(GLdouble)));
8787 }
8788 if (ctx->ExecuteFlag) {
8789 CALL_ProgramUniformMatrix3x4dv(ctx->Exec,
8790 (program, location, count, transpose, v));
8791 }
8792 }
8793
8794 static void GLAPIENTRY
8795 save_ProgramUniformMatrix4x2dv(GLuint program, GLint location, GLsizei count,
8796 GLboolean transpose, const GLdouble *v)
8797 {
8798 GET_CURRENT_CONTEXT(ctx);
8799 Node *n;
8800 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8801 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX42D,
8802 4 + POINTER_DWORDS);
8803 if (n) {
8804 n[1].ui = program;
8805 n[2].i = location;
8806 n[3].i = count;
8807 n[4].b = transpose;
8808 save_pointer(&n[5], memdup(v, count * 4 * 2 * sizeof(GLdouble)));
8809 }
8810 if (ctx->ExecuteFlag) {
8811 CALL_ProgramUniformMatrix4x2dv(ctx->Exec,
8812 (program, location, count, transpose, v));
8813 }
8814 }
8815
8816 static void GLAPIENTRY
8817 save_ProgramUniformMatrix4x3dv(GLuint program, GLint location, GLsizei count,
8818 GLboolean transpose, const GLdouble *v)
8819 {
8820 GET_CURRENT_CONTEXT(ctx);
8821 Node *n;
8822 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8823 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX43D,
8824 4 + POINTER_DWORDS);
8825 if (n) {
8826 n[1].ui = program;
8827 n[2].i = location;
8828 n[3].i = count;
8829 n[4].b = transpose;
8830 save_pointer(&n[5], memdup(v, count * 4 * 3 * sizeof(GLdouble)));
8831 }
8832 if (ctx->ExecuteFlag) {
8833 CALL_ProgramUniformMatrix4x3dv(ctx->Exec,
8834 (program, location, count, transpose, v));
8835 }
8836 }
8837
8838 static void GLAPIENTRY
8839 save_ProgramUniformMatrix4dv(GLuint program, GLint location, GLsizei count,
8840 GLboolean transpose, const GLdouble *v)
8841 {
8842 GET_CURRENT_CONTEXT(ctx);
8843 Node *n;
8844 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8845 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX44D,
8846 4 + POINTER_DWORDS);
8847 if (n) {
8848 n[1].ui = program;
8849 n[2].i = location;
8850 n[3].i = count;
8851 n[4].b = transpose;
8852 save_pointer(&n[5], memdup(v, count * 4 * 4 * sizeof(GLdouble)));
8853 }
8854 if (ctx->ExecuteFlag) {
8855 CALL_ProgramUniformMatrix4dv(ctx->Exec,
8856 (program, location, count, transpose, v));
8857 }
8858 }
8859
8860 static void GLAPIENTRY
8861 save_ClipControl(GLenum origin, GLenum depth)
8862 {
8863 GET_CURRENT_CONTEXT(ctx);
8864 Node *n;
8865 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8866 n = alloc_instruction(ctx, OPCODE_CLIP_CONTROL, 2);
8867 if (n) {
8868 n[1].e = origin;
8869 n[2].e = depth;
8870 }
8871 if (ctx->ExecuteFlag) {
8872 CALL_ClipControl(ctx->Exec, (origin, depth));
8873 }
8874 }
8875
8876 static void GLAPIENTRY
8877 save_ClampColorARB(GLenum target, GLenum clamp)
8878 {
8879 GET_CURRENT_CONTEXT(ctx);
8880 Node *n;
8881 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8882 n = alloc_instruction(ctx, OPCODE_CLAMP_COLOR, 2);
8883 if (n) {
8884 n[1].e = target;
8885 n[2].e = clamp;
8886 }
8887 if (ctx->ExecuteFlag) {
8888 CALL_ClampColor(ctx->Exec, (target, clamp));
8889 }
8890 }
8891
8892 /** GL_EXT_texture_integer */
8893 static void GLAPIENTRY
8894 save_ClearColorIi(GLint red, GLint green, GLint blue, GLint alpha)
8895 {
8896 GET_CURRENT_CONTEXT(ctx);
8897 Node *n;
8898 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8899 n = alloc_instruction(ctx, OPCODE_CLEARCOLOR_I, 4);
8900 if (n) {
8901 n[1].i = red;
8902 n[2].i = green;
8903 n[3].i = blue;
8904 n[4].i = alpha;
8905 }
8906 if (ctx->ExecuteFlag) {
8907 CALL_ClearColorIiEXT(ctx->Exec, (red, green, blue, alpha));
8908 }
8909 }
8910
8911 /** GL_EXT_texture_integer */
8912 static void GLAPIENTRY
8913 save_ClearColorIui(GLuint red, GLuint green, GLuint blue, GLuint alpha)
8914 {
8915 GET_CURRENT_CONTEXT(ctx);
8916 Node *n;
8917 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8918 n = alloc_instruction(ctx, OPCODE_CLEARCOLOR_UI, 4);
8919 if (n) {
8920 n[1].ui = red;
8921 n[2].ui = green;
8922 n[3].ui = blue;
8923 n[4].ui = alpha;
8924 }
8925 if (ctx->ExecuteFlag) {
8926 CALL_ClearColorIuiEXT(ctx->Exec, (red, green, blue, alpha));
8927 }
8928 }
8929
8930 /** GL_EXT_texture_integer */
8931 static void GLAPIENTRY
8932 save_TexParameterIiv(GLenum target, GLenum pname, const GLint *params)
8933 {
8934 GET_CURRENT_CONTEXT(ctx);
8935 Node *n;
8936 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8937 n = alloc_instruction(ctx, OPCODE_TEXPARAMETER_I, 6);
8938 if (n) {
8939 n[1].e = target;
8940 n[2].e = pname;
8941 n[3].i = params[0];
8942 n[4].i = params[1];
8943 n[5].i = params[2];
8944 n[6].i = params[3];
8945 }
8946 if (ctx->ExecuteFlag) {
8947 CALL_TexParameterIiv(ctx->Exec, (target, pname, params));
8948 }
8949 }
8950
8951 /** GL_EXT_texture_integer */
8952 static void GLAPIENTRY
8953 save_TexParameterIuiv(GLenum target, GLenum pname, const GLuint *params)
8954 {
8955 GET_CURRENT_CONTEXT(ctx);
8956 Node *n;
8957 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8958 n = alloc_instruction(ctx, OPCODE_TEXPARAMETER_UI, 6);
8959 if (n) {
8960 n[1].e = target;
8961 n[2].e = pname;
8962 n[3].ui = params[0];
8963 n[4].ui = params[1];
8964 n[5].ui = params[2];
8965 n[6].ui = params[3];
8966 }
8967 if (ctx->ExecuteFlag) {
8968 CALL_TexParameterIuiv(ctx->Exec, (target, pname, params));
8969 }
8970 }
8971
8972 /* GL_ARB_instanced_arrays */
8973 static void GLAPIENTRY
8974 save_VertexAttribDivisor(GLuint index, GLuint divisor)
8975 {
8976 GET_CURRENT_CONTEXT(ctx);
8977 Node *n;
8978 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8979 n = alloc_instruction(ctx, OPCODE_VERTEX_ATTRIB_DIVISOR, 2);
8980 if (n) {
8981 n[1].ui = index;
8982 n[2].ui = divisor;
8983 }
8984 if (ctx->ExecuteFlag) {
8985 CALL_VertexAttribDivisor(ctx->Exec, (index, divisor));
8986 }
8987 }
8988
8989
8990 /* GL_NV_texture_barrier */
8991 static void GLAPIENTRY
8992 save_TextureBarrierNV(void)
8993 {
8994 GET_CURRENT_CONTEXT(ctx);
8995 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8996 alloc_instruction(ctx, OPCODE_TEXTURE_BARRIER_NV, 0);
8997 if (ctx->ExecuteFlag) {
8998 CALL_TextureBarrierNV(ctx->Exec, ());
8999 }
9000 }
9001
9002
9003 /* GL_ARB_sampler_objects */
9004 static void GLAPIENTRY
9005 save_BindSampler(GLuint unit, GLuint sampler)
9006 {
9007 Node *n;
9008 GET_CURRENT_CONTEXT(ctx);
9009 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9010 n = alloc_instruction(ctx, OPCODE_BIND_SAMPLER, 2);
9011 if (n) {
9012 n[1].ui = unit;
9013 n[2].ui = sampler;
9014 }
9015 if (ctx->ExecuteFlag) {
9016 CALL_BindSampler(ctx->Exec, (unit, sampler));
9017 }
9018 }
9019
9020 static void GLAPIENTRY
9021 save_SamplerParameteriv(GLuint sampler, GLenum pname, const GLint *params)
9022 {
9023 Node *n;
9024 GET_CURRENT_CONTEXT(ctx);
9025 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9026 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERIV, 6);
9027 if (n) {
9028 n[1].ui = sampler;
9029 n[2].e = pname;
9030 n[3].i = params[0];
9031 if (pname == GL_TEXTURE_BORDER_COLOR) {
9032 n[4].i = params[1];
9033 n[5].i = params[2];
9034 n[6].i = params[3];
9035 }
9036 else {
9037 n[4].i = n[5].i = n[6].i = 0;
9038 }
9039 }
9040 if (ctx->ExecuteFlag) {
9041 CALL_SamplerParameteriv(ctx->Exec, (sampler, pname, params));
9042 }
9043 }
9044
9045 static void GLAPIENTRY
9046 save_SamplerParameteri(GLuint sampler, GLenum pname, GLint param)
9047 {
9048 GLint parray[4];
9049 parray[0] = param;
9050 parray[1] = parray[2] = parray[3] = 0;
9051 save_SamplerParameteriv(sampler, pname, parray);
9052 }
9053
9054 static void GLAPIENTRY
9055 save_SamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *params)
9056 {
9057 Node *n;
9058 GET_CURRENT_CONTEXT(ctx);
9059 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9060 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERFV, 6);
9061 if (n) {
9062 n[1].ui = sampler;
9063 n[2].e = pname;
9064 n[3].f = params[0];
9065 if (pname == GL_TEXTURE_BORDER_COLOR) {
9066 n[4].f = params[1];
9067 n[5].f = params[2];
9068 n[6].f = params[3];
9069 }
9070 else {
9071 n[4].f = n[5].f = n[6].f = 0.0F;
9072 }
9073 }
9074 if (ctx->ExecuteFlag) {
9075 CALL_SamplerParameterfv(ctx->Exec, (sampler, pname, params));
9076 }
9077 }
9078
9079 static void GLAPIENTRY
9080 save_SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
9081 {
9082 GLfloat parray[4];
9083 parray[0] = param;
9084 parray[1] = parray[2] = parray[3] = 0.0F;
9085 save_SamplerParameterfv(sampler, pname, parray);
9086 }
9087
9088 static void GLAPIENTRY
9089 save_SamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *params)
9090 {
9091 Node *n;
9092 GET_CURRENT_CONTEXT(ctx);
9093 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9094 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERIIV, 6);
9095 if (n) {
9096 n[1].ui = sampler;
9097 n[2].e = pname;
9098 n[3].i = params[0];
9099 if (pname == GL_TEXTURE_BORDER_COLOR) {
9100 n[4].i = params[1];
9101 n[5].i = params[2];
9102 n[6].i = params[3];
9103 }
9104 else {
9105 n[4].i = n[5].i = n[6].i = 0;
9106 }
9107 }
9108 if (ctx->ExecuteFlag) {
9109 CALL_SamplerParameterIiv(ctx->Exec, (sampler, pname, params));
9110 }
9111 }
9112
9113 static void GLAPIENTRY
9114 save_SamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *params)
9115 {
9116 Node *n;
9117 GET_CURRENT_CONTEXT(ctx);
9118 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9119 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERUIV, 6);
9120 if (n) {
9121 n[1].ui = sampler;
9122 n[2].e = pname;
9123 n[3].ui = params[0];
9124 if (pname == GL_TEXTURE_BORDER_COLOR) {
9125 n[4].ui = params[1];
9126 n[5].ui = params[2];
9127 n[6].ui = params[3];
9128 }
9129 else {
9130 n[4].ui = n[5].ui = n[6].ui = 0;
9131 }
9132 }
9133 if (ctx->ExecuteFlag) {
9134 CALL_SamplerParameterIuiv(ctx->Exec, (sampler, pname, params));
9135 }
9136 }
9137
9138 static void GLAPIENTRY
9139 save_WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
9140 {
9141 Node *n;
9142 GET_CURRENT_CONTEXT(ctx);
9143 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9144 n = alloc_instruction(ctx, OPCODE_WAIT_SYNC, 4);
9145 if (n) {
9146 union uint64_pair p;
9147 p.uint64 = timeout;
9148 n[1].bf = flags;
9149 n[2].ui = p.uint32[0];
9150 n[3].ui = p.uint32[1];
9151 save_pointer(&n[4], sync);
9152 }
9153 if (ctx->ExecuteFlag) {
9154 CALL_WaitSync(ctx->Exec, (sync, flags, timeout));
9155 }
9156 }
9157
9158
9159 /** GL_NV_conditional_render */
9160 static void GLAPIENTRY
9161 save_BeginConditionalRender(GLuint queryId, GLenum mode)
9162 {
9163 GET_CURRENT_CONTEXT(ctx);
9164 Node *n;
9165 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9166 n = alloc_instruction(ctx, OPCODE_BEGIN_CONDITIONAL_RENDER, 2);
9167 if (n) {
9168 n[1].i = queryId;
9169 n[2].e = mode;
9170 }
9171 if (ctx->ExecuteFlag) {
9172 CALL_BeginConditionalRender(ctx->Exec, (queryId, mode));
9173 }
9174 }
9175
9176 static void GLAPIENTRY
9177 save_EndConditionalRender(void)
9178 {
9179 GET_CURRENT_CONTEXT(ctx);
9180 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9181 alloc_instruction(ctx, OPCODE_END_CONDITIONAL_RENDER, 0);
9182 if (ctx->ExecuteFlag) {
9183 CALL_EndConditionalRender(ctx->Exec, ());
9184 }
9185 }
9186
9187 static void GLAPIENTRY
9188 save_UniformBlockBinding(GLuint prog, GLuint index, GLuint binding)
9189 {
9190 GET_CURRENT_CONTEXT(ctx);
9191 Node *n;
9192 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9193 n = alloc_instruction(ctx, OPCODE_UNIFORM_BLOCK_BINDING, 3);
9194 if (n) {
9195 n[1].ui = prog;
9196 n[2].ui = index;
9197 n[3].ui = binding;
9198 }
9199 if (ctx->ExecuteFlag) {
9200 CALL_UniformBlockBinding(ctx->Exec, (prog, index, binding));
9201 }
9202 }
9203
9204 static void GLAPIENTRY
9205 save_UniformSubroutinesuiv(GLenum shadertype, GLsizei count,
9206 const GLuint *indices)
9207 {
9208 GET_CURRENT_CONTEXT(ctx);
9209 Node *n;
9210 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9211 n = alloc_instruction(ctx, OPCODE_UNIFORM_SUBROUTINES, 2 + POINTER_DWORDS);
9212 if (n) {
9213 GLint *indices_copy = NULL;
9214
9215 if (count > 0)
9216 indices_copy = memdup(indices, sizeof(GLuint) * 4 * count);
9217 n[1].e = shadertype;
9218 n[2].si = count;
9219 save_pointer(&n[3], indices_copy);
9220 }
9221 if (ctx->ExecuteFlag) {
9222 CALL_UniformSubroutinesuiv(ctx->Exec, (shadertype, count, indices));
9223 }
9224 }
9225
9226 /** GL_EXT_window_rectangles */
9227 static void GLAPIENTRY
9228 save_WindowRectanglesEXT(GLenum mode, GLsizei count, const GLint *box)
9229 {
9230 GET_CURRENT_CONTEXT(ctx);
9231 Node *n;
9232 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9233 n = alloc_instruction(ctx, OPCODE_WINDOW_RECTANGLES, 2 + POINTER_DWORDS);
9234 if (n) {
9235 GLint *box_copy = NULL;
9236
9237 if (count > 0)
9238 box_copy = memdup(box, sizeof(GLint) * 4 * count);
9239 n[1].e = mode;
9240 n[2].si = count;
9241 save_pointer(&n[3], box_copy);
9242 }
9243 if (ctx->ExecuteFlag) {
9244 CALL_WindowRectanglesEXT(ctx->Exec, (mode, count, box));
9245 }
9246 }
9247
9248
9249 /** GL_NV_conservative_raster */
9250 static void GLAPIENTRY
9251 save_SubpixelPrecisionBiasNV(GLuint xbits, GLuint ybits)
9252 {
9253 GET_CURRENT_CONTEXT(ctx);
9254 Node *n;
9255 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9256 n = alloc_instruction(ctx, OPCODE_SUBPIXEL_PRECISION_BIAS, 2);
9257 if (n) {
9258 n[1].ui = xbits;
9259 n[2].ui = ybits;
9260 }
9261 if (ctx->ExecuteFlag) {
9262 CALL_SubpixelPrecisionBiasNV(ctx->Exec, (xbits, ybits));
9263 }
9264 }
9265
9266 /** GL_NV_conservative_raster_dilate */
9267 static void GLAPIENTRY
9268 save_ConservativeRasterParameterfNV(GLenum pname, GLfloat param)
9269 {
9270 GET_CURRENT_CONTEXT(ctx);
9271 Node *n;
9272 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9273 n = alloc_instruction(ctx, OPCODE_CONSERVATIVE_RASTER_PARAMETER_F, 2);
9274 if (n) {
9275 n[1].e = pname;
9276 n[2].f = param;
9277 }
9278 if (ctx->ExecuteFlag) {
9279 CALL_ConservativeRasterParameterfNV(ctx->Exec, (pname, param));
9280 }
9281 }
9282
9283 /** GL_NV_conservative_raster_pre_snap_triangles */
9284 static void GLAPIENTRY
9285 save_ConservativeRasterParameteriNV(GLenum pname, GLint param)
9286 {
9287 GET_CURRENT_CONTEXT(ctx);
9288 Node *n;
9289 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9290 n = alloc_instruction(ctx, OPCODE_CONSERVATIVE_RASTER_PARAMETER_I, 2);
9291 if (n) {
9292 n[1].e = pname;
9293 n[2].i = param;
9294 }
9295 if (ctx->ExecuteFlag) {
9296 CALL_ConservativeRasterParameteriNV(ctx->Exec, (pname, param));
9297 }
9298 }
9299
9300 /** GL_EXT_direct_state_access */
9301
9302 static void GLAPIENTRY
9303 save_MatrixLoadfEXT(GLenum matrixMode, const GLfloat *m)
9304 {
9305 GET_CURRENT_CONTEXT(ctx);
9306 Node *n;
9307 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9308 n = alloc_instruction(ctx, OPCODE_MATRIX_LOAD, 17);
9309 if (n) {
9310 n[1].e = matrixMode;
9311 for (unsigned i = 0; i < 16; i++) {
9312 n[2 + i].f = m[i];
9313 }
9314 }
9315 if (ctx->ExecuteFlag) {
9316 CALL_MatrixLoadfEXT(ctx->Exec, (matrixMode, m));
9317 }
9318 }
9319
9320 static void GLAPIENTRY
9321 save_MatrixLoaddEXT(GLenum matrixMode, const GLdouble *m)
9322 {
9323 GLfloat f[16];
9324 for (unsigned i = 0; i < 16; i++) {
9325 f[i] = (GLfloat) m[i];
9326 }
9327 save_MatrixLoadfEXT(matrixMode, f);
9328 }
9329
9330 static void GLAPIENTRY
9331 save_MatrixMultfEXT(GLenum matrixMode, const GLfloat * m)
9332 {
9333 GET_CURRENT_CONTEXT(ctx);
9334 Node *n;
9335 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9336 n = alloc_instruction(ctx, OPCODE_MATRIX_MULT, 17);
9337 if (n) {
9338 n[1].e = matrixMode;
9339 for (unsigned i = 0; i < 16; i++) {
9340 n[2 + i].f = m[i];
9341 }
9342 }
9343 if (ctx->ExecuteFlag) {
9344 CALL_MatrixMultfEXT(ctx->Exec, (matrixMode, m));
9345 }
9346 }
9347
9348 static void GLAPIENTRY
9349 save_MatrixMultdEXT(GLenum matrixMode, const GLdouble * m)
9350 {
9351 GLfloat f[16];
9352 for (unsigned i = 0; i < 16; i++) {
9353 f[i] = (GLfloat) m[i];
9354 }
9355 save_MatrixMultfEXT(matrixMode, f);
9356 }
9357
9358 static void GLAPIENTRY
9359 save_MatrixRotatefEXT(GLenum matrixMode, GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
9360 {
9361 GET_CURRENT_CONTEXT(ctx);
9362 Node *n;
9363 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9364 n = alloc_instruction(ctx, OPCODE_MATRIX_ROTATE, 5);
9365 if (n) {
9366 n[1].e = matrixMode;
9367 n[2].f = angle;
9368 n[3].f = x;
9369 n[4].f = y;
9370 n[5].f = z;
9371 }
9372 if (ctx->ExecuteFlag) {
9373 CALL_MatrixRotatefEXT(ctx->Exec, (matrixMode, angle, x, y, z));
9374 }
9375 }
9376
9377 static void GLAPIENTRY
9378 save_MatrixRotatedEXT(GLenum matrixMode, GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
9379 {
9380 save_MatrixRotatefEXT(matrixMode, (GLfloat) angle, (GLfloat) x, (GLfloat) y, (GLfloat) z);
9381 }
9382
9383 static void GLAPIENTRY
9384 save_MatrixScalefEXT(GLenum matrixMode, GLfloat x, GLfloat y, GLfloat z)
9385 {
9386 GET_CURRENT_CONTEXT(ctx);
9387 Node *n;
9388 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9389 n = alloc_instruction(ctx, OPCODE_MATRIX_SCALE, 4);
9390 if (n) {
9391 n[1].e = matrixMode;
9392 n[2].f = x;
9393 n[3].f = y;
9394 n[4].f = z;
9395 }
9396 if (ctx->ExecuteFlag) {
9397 CALL_MatrixScalefEXT(ctx->Exec, (matrixMode, x, y, z));
9398 }
9399 }
9400
9401 static void GLAPIENTRY
9402 save_MatrixScaledEXT(GLenum matrixMode, GLdouble x, GLdouble y, GLdouble z)
9403 {
9404 save_MatrixScalefEXT(matrixMode, (GLfloat) x, (GLfloat) y, (GLfloat) z);
9405 }
9406
9407 static void GLAPIENTRY
9408 save_MatrixTranslatefEXT(GLenum matrixMode, GLfloat x, GLfloat y, GLfloat z)
9409 {
9410 GET_CURRENT_CONTEXT(ctx);
9411 Node *n;
9412 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9413 n = alloc_instruction(ctx, OPCODE_MATRIX_TRANSLATE, 4);
9414 if (n) {
9415 n[1].e = matrixMode;
9416 n[2].f = x;
9417 n[3].f = y;
9418 n[4].f = z;
9419 }
9420 if (ctx->ExecuteFlag) {
9421 CALL_MatrixTranslatefEXT(ctx->Exec, (matrixMode, x, y, z));
9422 }
9423 }
9424
9425 static void GLAPIENTRY
9426 save_MatrixTranslatedEXT(GLenum matrixMode, GLdouble x, GLdouble y, GLdouble z)
9427 {
9428 save_MatrixTranslatefEXT(matrixMode, (GLfloat) x, (GLfloat) y, (GLfloat) z);
9429 }
9430
9431 static void GLAPIENTRY
9432 save_MatrixLoadIdentityEXT(GLenum matrixMode)
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_LOAD_IDENTITY, 1);
9438 if (n) {
9439 n[1].e = matrixMode;
9440 }
9441 if (ctx->ExecuteFlag) {
9442 CALL_MatrixLoadIdentityEXT(ctx->Exec, (matrixMode));
9443 }
9444 }
9445
9446 static void GLAPIENTRY
9447 save_MatrixOrthoEXT(GLenum matrixMode, GLdouble left, GLdouble right,
9448 GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval)
9449 {
9450 GET_CURRENT_CONTEXT(ctx);
9451 Node *n;
9452 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9453 n = alloc_instruction(ctx, OPCODE_MATRIX_ORTHO, 7);
9454 if (n) {
9455 n[1].e = matrixMode;
9456 n[2].f = (GLfloat) left;
9457 n[3].f = (GLfloat) right;
9458 n[4].f = (GLfloat) bottom;
9459 n[5].f = (GLfloat) top;
9460 n[6].f = (GLfloat) nearval;
9461 n[7].f = (GLfloat) farval;
9462 }
9463 if (ctx->ExecuteFlag) {
9464 CALL_MatrixOrthoEXT(ctx->Exec, (matrixMode, left, right, bottom, top, nearval, farval));
9465 }
9466 }
9467
9468
9469 static void GLAPIENTRY
9470 save_MatrixFrustumEXT(GLenum matrixMode, GLdouble left, GLdouble right,
9471 GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval)
9472 {
9473 GET_CURRENT_CONTEXT(ctx);
9474 Node *n;
9475 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9476 n = alloc_instruction(ctx, OPCODE_MATRIX_FRUSTUM, 7);
9477 if (n) {
9478 n[1].e = matrixMode;
9479 n[2].f = (GLfloat) left;
9480 n[3].f = (GLfloat) right;
9481 n[4].f = (GLfloat) bottom;
9482 n[5].f = (GLfloat) top;
9483 n[6].f = (GLfloat) nearval;
9484 n[7].f = (GLfloat) farval;
9485 }
9486 if (ctx->ExecuteFlag) {
9487 CALL_MatrixFrustumEXT(ctx->Exec, (matrixMode, left, right, bottom, top, nearval, farval));
9488 }
9489 }
9490
9491 static void GLAPIENTRY
9492 save_MatrixPushEXT(GLenum matrixMode)
9493 {
9494 GET_CURRENT_CONTEXT(ctx);
9495 Node* n;
9496 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9497 n = alloc_instruction(ctx, OPCODE_MATRIX_PUSH, 1);
9498 if (n) {
9499 n[1].e = matrixMode;
9500 }
9501 if (ctx->ExecuteFlag) {
9502 CALL_MatrixPushEXT(ctx->Exec, (matrixMode));
9503 }
9504 }
9505
9506 static void GLAPIENTRY
9507 save_MatrixPopEXT(GLenum matrixMode)
9508 {
9509 GET_CURRENT_CONTEXT(ctx);
9510 Node* n;
9511 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9512 n = alloc_instruction(ctx, OPCODE_MATRIX_POP, 1);
9513 if (n) {
9514 n[1].e = matrixMode;
9515 }
9516 if (ctx->ExecuteFlag) {
9517 CALL_MatrixPopEXT(ctx->Exec, (matrixMode));
9518 }
9519 }
9520
9521 static void GLAPIENTRY
9522 save_MatrixLoadTransposefEXT(GLenum matrixMode, const GLfloat m[16])
9523 {
9524 GLfloat tm[16];
9525 _math_transposef(tm, m);
9526 save_MatrixLoadfEXT(matrixMode, tm);
9527 }
9528
9529 static void GLAPIENTRY
9530 save_MatrixLoadTransposedEXT(GLenum matrixMode, const GLdouble m[16])
9531 {
9532 GLfloat tm[16];
9533 _math_transposefd(tm, m);
9534 save_MatrixLoadfEXT(matrixMode, tm);
9535 }
9536
9537 static void GLAPIENTRY
9538 save_MatrixMultTransposefEXT(GLenum matrixMode, const GLfloat m[16])
9539 {
9540 GLfloat tm[16];
9541 _math_transposef(tm, m);
9542 save_MatrixMultfEXT(matrixMode, tm);
9543 }
9544
9545 static void GLAPIENTRY
9546 save_MatrixMultTransposedEXT(GLenum matrixMode, const GLdouble m[16])
9547 {
9548 GLfloat tm[16];
9549 _math_transposefd(tm, m);
9550 save_MatrixMultfEXT(matrixMode, tm);
9551 }
9552
9553 static void GLAPIENTRY
9554 save_TextureParameterfvEXT(GLuint texture, GLenum target, GLenum pname,
9555 const GLfloat *params)
9556 {
9557 GET_CURRENT_CONTEXT(ctx);
9558 Node *n;
9559 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9560 n = alloc_instruction(ctx, OPCODE_TEXTUREPARAMETER_F, 7);
9561 if (n) {
9562 n[1].ui = texture;
9563 n[2].e = target;
9564 n[3].e = pname;
9565 n[4].f = params[0];
9566 n[5].f = params[1];
9567 n[6].f = params[2];
9568 n[7].f = params[3];
9569 }
9570 if (ctx->ExecuteFlag) {
9571 CALL_TextureParameterfvEXT(ctx->Exec, (texture, target, pname, params));
9572 }
9573 }
9574
9575
9576 static void GLAPIENTRY
9577 save_TextureParameterfEXT(GLuint texture, GLenum target, GLenum pname, GLfloat param)
9578 {
9579 GLfloat parray[4];
9580 parray[0] = param;
9581 parray[1] = parray[2] = parray[3] = 0.0F;
9582 save_TextureParameterfvEXT(texture, target, pname, parray);
9583 }
9584
9585 static void GLAPIENTRY
9586 save_TextureParameterivEXT(GLuint texture, GLenum target, GLenum pname, const GLint *params)
9587 {
9588 GET_CURRENT_CONTEXT(ctx);
9589 Node *n;
9590 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9591 n = alloc_instruction(ctx, OPCODE_TEXTUREPARAMETER_I, 7);
9592 if (n) {
9593 n[1].ui = texture;
9594 n[2].e = target;
9595 n[3].e = pname;
9596 n[4].i = params[0];
9597 n[5].i = params[1];
9598 n[6].i = params[2];
9599 n[7].i = params[3];
9600 }
9601 if (ctx->ExecuteFlag) {
9602 CALL_TextureParameterivEXT(ctx->Exec, (texture, target, pname, params));
9603 }
9604 }
9605
9606 static void GLAPIENTRY
9607 save_TextureParameteriEXT(GLuint texture, GLenum target, GLenum pname, GLint param)
9608 {
9609 GLint fparam[4];
9610 fparam[0] = param;
9611 fparam[1] = fparam[2] = fparam[3] = 0;
9612 save_TextureParameterivEXT(texture, target, pname, fparam);
9613 }
9614
9615 static void GLAPIENTRY
9616 save_TextureImage1DEXT(GLuint texture, GLenum target,
9617 GLint level, GLint components,
9618 GLsizei width, GLint border,
9619 GLenum format, GLenum type, const GLvoid * pixels)
9620 {
9621 GET_CURRENT_CONTEXT(ctx);
9622 if (target == GL_PROXY_TEXTURE_1D) {
9623 /* don't compile, execute immediately */
9624 CALL_TextureImage1DEXT(ctx->Exec, (texture, target, level, components, width,
9625 border, format, type, pixels));
9626 }
9627 else {
9628 Node *n;
9629 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9630 n = alloc_instruction(ctx, OPCODE_TEXTURE_IMAGE1D, 8 + POINTER_DWORDS);
9631 if (n) {
9632 n[1].ui = texture;
9633 n[2].e = target;
9634 n[3].i = level;
9635 n[4].i = components;
9636 n[5].i = (GLint) width;
9637 n[6].i = border;
9638 n[7].e = format;
9639 n[8].e = type;
9640 save_pointer(&n[9],
9641 unpack_image(ctx, 1, width, 1, 1, format, type,
9642 pixels, &ctx->Unpack));
9643 }
9644 if (ctx->ExecuteFlag) {
9645 CALL_TextureImage1DEXT(ctx->Exec, (texture, target, level, components, width,
9646 border, format, type, pixels));
9647 }
9648 }
9649 }
9650
9651
9652 static void GLAPIENTRY
9653 save_TextureImage2DEXT(GLuint texture, GLenum target,
9654 GLint level, GLint components,
9655 GLsizei width, GLsizei height, GLint border,
9656 GLenum format, GLenum type, const GLvoid * pixels)
9657 {
9658 GET_CURRENT_CONTEXT(ctx);
9659 if (target == GL_PROXY_TEXTURE_2D) {
9660 /* don't compile, execute immediately */
9661 CALL_TextureImage2DEXT(ctx->Exec, (texture, target, level, components, width,
9662 height, border, format, type, pixels));
9663 }
9664 else {
9665 Node *n;
9666 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9667 n = alloc_instruction(ctx, OPCODE_TEXTURE_IMAGE2D, 9 + POINTER_DWORDS);
9668 if (n) {
9669 n[1].ui = texture;
9670 n[2].e = target;
9671 n[3].i = level;
9672 n[4].i = components;
9673 n[5].i = (GLint) width;
9674 n[6].i = (GLint) height;
9675 n[7].i = border;
9676 n[8].e = format;
9677 n[9].e = type;
9678 save_pointer(&n[10],
9679 unpack_image(ctx, 2, width, height, 1, format, type,
9680 pixels, &ctx->Unpack));
9681 }
9682 if (ctx->ExecuteFlag) {
9683 CALL_TextureImage2DEXT(ctx->Exec, (texture, target, level, components, width,
9684 height, border, format, type, pixels));
9685 }
9686 }
9687 }
9688
9689
9690 static void GLAPIENTRY
9691 save_TextureImage3DEXT(GLuint texture, GLenum target,
9692 GLint level, GLint internalFormat,
9693 GLsizei width, GLsizei height, GLsizei depth,
9694 GLint border,
9695 GLenum format, GLenum type, const GLvoid * pixels)
9696 {
9697 GET_CURRENT_CONTEXT(ctx);
9698 if (target == GL_PROXY_TEXTURE_3D) {
9699 /* don't compile, execute immediately */
9700 CALL_TextureImage3DEXT(ctx->Exec, (texture, target, level, internalFormat, width,
9701 height, depth, border, format, type,
9702 pixels));
9703 }
9704 else {
9705 Node *n;
9706 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9707 n = alloc_instruction(ctx, OPCODE_TEXTURE_IMAGE3D, 10 + POINTER_DWORDS);
9708 if (n) {
9709 n[1].ui = texture;
9710 n[2].e = target;
9711 n[3].i = level;
9712 n[4].i = (GLint) internalFormat;
9713 n[5].i = (GLint) width;
9714 n[6].i = (GLint) height;
9715 n[7].i = (GLint) depth;
9716 n[8].i = border;
9717 n[9].e = format;
9718 n[10].e = type;
9719 save_pointer(&n[11],
9720 unpack_image(ctx, 3, width, height, depth, format, type,
9721 pixels, &ctx->Unpack));
9722 }
9723 if (ctx->ExecuteFlag) {
9724 CALL_TextureImage3DEXT(ctx->Exec, (texture, target, level, internalFormat,
9725 width, height, depth, border, format,
9726 type, pixels));
9727 }
9728 }
9729 }
9730
9731
9732 static void GLAPIENTRY
9733 save_TextureSubImage1DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset,
9734 GLsizei width, GLenum format, GLenum type,
9735 const GLvoid * pixels)
9736 {
9737 GET_CURRENT_CONTEXT(ctx);
9738 Node *n;
9739
9740 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9741
9742 n = alloc_instruction(ctx, OPCODE_TEXTURE_SUB_IMAGE1D, 7 + POINTER_DWORDS);
9743 if (n) {
9744 n[1].ui = texture;
9745 n[2].e = target;
9746 n[3].i = level;
9747 n[4].i = xoffset;
9748 n[5].i = (GLint) width;
9749 n[6].e = format;
9750 n[7].e = type;
9751 save_pointer(&n[8],
9752 unpack_image(ctx, 1, width, 1, 1, format, type,
9753 pixels, &ctx->Unpack));
9754 }
9755 if (ctx->ExecuteFlag) {
9756 CALL_TextureSubImage1DEXT(ctx->Exec, (texture, target, level, xoffset, width,
9757 format, type, pixels));
9758 }
9759 }
9760
9761
9762 static void GLAPIENTRY
9763 save_TextureSubImage2DEXT(GLuint texture, GLenum target, GLint level,
9764 GLint xoffset, GLint yoffset,
9765 GLsizei width, GLsizei height,
9766 GLenum format, GLenum type, const GLvoid * pixels)
9767 {
9768 GET_CURRENT_CONTEXT(ctx);
9769 Node *n;
9770
9771 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9772
9773 n = alloc_instruction(ctx, OPCODE_TEXTURE_SUB_IMAGE2D, 9 + POINTER_DWORDS);
9774 if (n) {
9775 n[1].ui = texture;
9776 n[2].e = target;
9777 n[3].i = level;
9778 n[4].i = xoffset;
9779 n[5].i = yoffset;
9780 n[6].i = (GLint) width;
9781 n[7].i = (GLint) height;
9782 n[8].e = format;
9783 n[9].e = type;
9784 save_pointer(&n[10],
9785 unpack_image(ctx, 2, width, height, 1, format, type,
9786 pixels, &ctx->Unpack));
9787 }
9788 if (ctx->ExecuteFlag) {
9789 CALL_TextureSubImage2DEXT(ctx->Exec, (texture, target, level, xoffset, yoffset,
9790 width, height, format, type, pixels));
9791 }
9792 }
9793
9794
9795 static void GLAPIENTRY
9796 save_TextureSubImage3DEXT(GLuint texture, GLenum target, GLint level,
9797 GLint xoffset, GLint yoffset, GLint zoffset,
9798 GLsizei width, GLsizei height, GLsizei depth,
9799 GLenum format, GLenum type, const GLvoid * pixels)
9800 {
9801 GET_CURRENT_CONTEXT(ctx);
9802 Node *n;
9803
9804 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9805
9806 n = alloc_instruction(ctx, OPCODE_TEXTURE_SUB_IMAGE3D, 11 + POINTER_DWORDS);
9807 if (n) {
9808 n[1].ui = texture;
9809 n[2].e = target;
9810 n[3].i = level;
9811 n[4].i = xoffset;
9812 n[5].i = yoffset;
9813 n[6].i = zoffset;
9814 n[7].i = (GLint) width;
9815 n[8].i = (GLint) height;
9816 n[9].i = (GLint) depth;
9817 n[10].e = format;
9818 n[11].e = type;
9819 save_pointer(&n[12],
9820 unpack_image(ctx, 3, width, height, depth, format, type,
9821 pixels, &ctx->Unpack));
9822 }
9823 if (ctx->ExecuteFlag) {
9824 CALL_TextureSubImage3DEXT(ctx->Exec, (texture, target, level,
9825 xoffset, yoffset, zoffset,
9826 width, height, depth, format, type,
9827 pixels));
9828 }
9829 }
9830
9831 static void GLAPIENTRY
9832 save_CopyTextureImage1DEXT(GLuint texture, GLenum target, GLint level,
9833 GLenum internalformat, GLint x, GLint y,
9834 GLsizei width, GLint border)
9835 {
9836 GET_CURRENT_CONTEXT(ctx);
9837 Node *n;
9838 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9839 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_IMAGE1D, 8);
9840 if (n) {
9841 n[1].ui = texture;
9842 n[2].e = target;
9843 n[3].i = level;
9844 n[4].e = internalformat;
9845 n[5].i = x;
9846 n[6].i = y;
9847 n[7].i = width;
9848 n[8].i = border;
9849 }
9850 if (ctx->ExecuteFlag) {
9851 CALL_CopyTextureImage1DEXT(ctx->Exec, (texture, target, level,
9852 internalformat, x, y,
9853 width, border));
9854 }
9855 }
9856
9857 static void GLAPIENTRY
9858 save_CopyTextureImage2DEXT(GLuint texture, GLenum target, GLint level,
9859 GLenum internalformat,
9860 GLint x, GLint y, GLsizei width,
9861 GLsizei height, GLint border)
9862 {
9863 GET_CURRENT_CONTEXT(ctx);
9864 Node *n;
9865 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9866 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_IMAGE2D, 9);
9867 if (n) {
9868 n[1].ui = texture;
9869 n[2].e = target;
9870 n[3].i = level;
9871 n[4].e = internalformat;
9872 n[5].i = x;
9873 n[6].i = y;
9874 n[7].i = width;
9875 n[8].i = height;
9876 n[9].i = border;
9877 }
9878 if (ctx->ExecuteFlag) {
9879 CALL_CopyTextureImage2DEXT(ctx->Exec, (texture, target, level,
9880 internalformat, x, y,
9881 width, height, border));
9882 }
9883 }
9884
9885 static void GLAPIENTRY
9886 save_CopyTextureSubImage1DEXT(GLuint texture, GLenum target, GLint level,
9887 GLint xoffset, GLint x, GLint y, GLsizei width)
9888 {
9889 GET_CURRENT_CONTEXT(ctx);
9890 Node *n;
9891 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9892 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_SUB_IMAGE1D, 7);
9893 if (n) {
9894 n[1].ui = texture;
9895 n[2].e = target;
9896 n[3].i = level;
9897 n[4].i = xoffset;
9898 n[5].i = x;
9899 n[6].i = y;
9900 n[7].i = width;
9901 }
9902 if (ctx->ExecuteFlag) {
9903 CALL_CopyTextureSubImage1DEXT(ctx->Exec,
9904 (texture, target, level, xoffset, x, y, width));
9905 }
9906 }
9907
9908 static void GLAPIENTRY
9909 save_CopyTextureSubImage2DEXT(GLuint texture, GLenum target, GLint level,
9910 GLint xoffset, GLint yoffset,
9911 GLint x, GLint y, GLsizei width, GLint height)
9912 {
9913 GET_CURRENT_CONTEXT(ctx);
9914 Node *n;
9915 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9916 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_SUB_IMAGE2D, 9);
9917 if (n) {
9918 n[1].ui = texture;
9919 n[2].e = target;
9920 n[3].i = level;
9921 n[4].i = xoffset;
9922 n[5].i = yoffset;
9923 n[6].i = x;
9924 n[7].i = y;
9925 n[8].i = width;
9926 n[9].i = height;
9927 }
9928 if (ctx->ExecuteFlag) {
9929 CALL_CopyTextureSubImage2DEXT(ctx->Exec, (texture, target, level,
9930 xoffset, yoffset,
9931 x, y, width, height));
9932 }
9933 }
9934
9935
9936 static void GLAPIENTRY
9937 save_CopyTextureSubImage3DEXT(GLuint texture, GLenum target, GLint level,
9938 GLint xoffset, GLint yoffset, GLint zoffset,
9939 GLint x, GLint y, GLsizei width, GLint height)
9940 {
9941 GET_CURRENT_CONTEXT(ctx);
9942 Node *n;
9943 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9944 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_SUB_IMAGE3D, 10);
9945 if (n) {
9946 n[1].ui = texture;
9947 n[2].e = target;
9948 n[3].i = level;
9949 n[4].i = xoffset;
9950 n[5].i = yoffset;
9951 n[6].i = zoffset;
9952 n[7].i = x;
9953 n[8].i = y;
9954 n[9].i = width;
9955 n[10].i = height;
9956 }
9957 if (ctx->ExecuteFlag) {
9958 CALL_CopyTextureSubImage3DEXT(ctx->Exec, (texture, target, level,
9959 xoffset, yoffset, zoffset,
9960 x, y, width, height));
9961 }
9962 }
9963
9964
9965 static void GLAPIENTRY
9966 save_BindMultiTextureEXT(GLenum texunit, GLenum target, GLuint texture)
9967 {
9968 GET_CURRENT_CONTEXT(ctx);
9969 Node *n;
9970 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9971 n = alloc_instruction(ctx, OPCODE_BIND_MULTITEXTURE, 3);
9972 if (n) {
9973 n[1].e = texunit;
9974 n[2].e = target;
9975 n[3].ui = texture;
9976 }
9977 if (ctx->ExecuteFlag) {
9978 CALL_BindMultiTextureEXT(ctx->Exec, (texunit, target, texture));
9979 }
9980 }
9981
9982
9983 static void GLAPIENTRY
9984 save_MultiTexParameterfvEXT(GLenum texunit, GLenum target, GLenum pname,
9985 const GLfloat *params)
9986 {
9987 GET_CURRENT_CONTEXT(ctx);
9988 Node *n;
9989 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9990 n = alloc_instruction(ctx, OPCODE_MULTITEXPARAMETER_F, 7);
9991 if (n) {
9992 n[1].e = texunit;
9993 n[2].e = target;
9994 n[3].e = pname;
9995 n[4].f = params[0];
9996 n[5].f = params[1];
9997 n[6].f = params[2];
9998 n[7].f = params[3];
9999 }
10000 if (ctx->ExecuteFlag) {
10001 CALL_MultiTexParameterfvEXT(ctx->Exec, (texunit, target, pname, params));
10002 }
10003 }
10004
10005
10006 static void GLAPIENTRY
10007 save_MultiTexParameterfEXT(GLenum texunit, GLenum target, GLenum pname, GLfloat param)
10008 {
10009 GLfloat parray[4];
10010 parray[0] = param;
10011 parray[1] = parray[2] = parray[3] = 0.0F;
10012 save_MultiTexParameterfvEXT(texunit, target, pname, parray);
10013 }
10014
10015 static void GLAPIENTRY
10016 save_MultiTexParameterivEXT(GLenum texunit, GLenum target, GLenum pname, const GLint *params)
10017 {
10018 GET_CURRENT_CONTEXT(ctx);
10019 Node *n;
10020 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10021 n = alloc_instruction(ctx, OPCODE_MULTITEXPARAMETER_I, 7);
10022 if (n) {
10023 n[1].e = texunit;
10024 n[2].e = target;
10025 n[3].e = pname;
10026 n[4].i = params[0];
10027 n[5].i = params[1];
10028 n[6].i = params[2];
10029 n[7].i = params[3];
10030 }
10031 if (ctx->ExecuteFlag) {
10032 CALL_MultiTexParameterivEXT(ctx->Exec, (texunit, target, pname, params));
10033 }
10034 }
10035
10036 static void GLAPIENTRY
10037 save_MultiTexParameteriEXT(GLenum texunit, GLenum target, GLenum pname, GLint param)
10038 {
10039 GLint fparam[4];
10040 fparam[0] = param;
10041 fparam[1] = fparam[2] = fparam[3] = 0;
10042 save_MultiTexParameterivEXT(texunit, target, pname, fparam);
10043 }
10044
10045
10046 static void GLAPIENTRY
10047 save_MultiTexImage1DEXT(GLenum texunit, GLenum target,
10048 GLint level, GLint components,
10049 GLsizei width, GLint border,
10050 GLenum format, GLenum type, const GLvoid * pixels)
10051 {
10052 GET_CURRENT_CONTEXT(ctx);
10053 if (target == GL_PROXY_TEXTURE_1D) {
10054 /* don't compile, execute immediately */
10055 CALL_MultiTexImage1DEXT(ctx->Exec, (texunit, target, level, components, width,
10056 border, format, type, pixels));
10057 }
10058 else {
10059 Node *n;
10060 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10061 n = alloc_instruction(ctx, OPCODE_MULTITEX_IMAGE1D, 8 + POINTER_DWORDS);
10062 if (n) {
10063 n[1].e = texunit;
10064 n[2].e = target;
10065 n[3].i = level;
10066 n[4].i = components;
10067 n[5].i = (GLint) width;
10068 n[6].i = border;
10069 n[7].e = format;
10070 n[8].e = type;
10071 save_pointer(&n[9],
10072 unpack_image(ctx, 1, width, 1, 1, format, type,
10073 pixels, &ctx->Unpack));
10074 }
10075 if (ctx->ExecuteFlag) {
10076 CALL_MultiTexImage1DEXT(ctx->Exec, (texunit, target, level, components, width,
10077 border, format, type, pixels));
10078 }
10079 }
10080 }
10081
10082
10083 static void GLAPIENTRY
10084 save_MultiTexImage2DEXT(GLenum texunit, GLenum target,
10085 GLint level, GLint components,
10086 GLsizei width, GLsizei height, GLint border,
10087 GLenum format, GLenum type, const GLvoid * pixels)
10088 {
10089 GET_CURRENT_CONTEXT(ctx);
10090 if (target == GL_PROXY_TEXTURE_2D) {
10091 /* don't compile, execute immediately */
10092 CALL_MultiTexImage2DEXT(ctx->Exec, (texunit, target, level, components, width,
10093 height, border, format, type, pixels));
10094 }
10095 else {
10096 Node *n;
10097 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10098 n = alloc_instruction(ctx, OPCODE_MULTITEX_IMAGE2D, 9 + POINTER_DWORDS);
10099 if (n) {
10100 n[1].e = texunit;
10101 n[2].e = target;
10102 n[3].i = level;
10103 n[4].i = components;
10104 n[5].i = (GLint) width;
10105 n[6].i = (GLint) height;
10106 n[7].i = border;
10107 n[8].e = format;
10108 n[9].e = type;
10109 save_pointer(&n[10],
10110 unpack_image(ctx, 2, width, height, 1, format, type,
10111 pixels, &ctx->Unpack));
10112 }
10113 if (ctx->ExecuteFlag) {
10114 CALL_MultiTexImage2DEXT(ctx->Exec, (texunit, target, level, components, width,
10115 height, border, format, type, pixels));
10116 }
10117 }
10118 }
10119
10120
10121 static void GLAPIENTRY
10122 save_MultiTexImage3DEXT(GLenum texunit, GLenum target,
10123 GLint level, GLint internalFormat,
10124 GLsizei width, GLsizei height, GLsizei depth,
10125 GLint border,
10126 GLenum format, GLenum type, const GLvoid * pixels)
10127 {
10128 GET_CURRENT_CONTEXT(ctx);
10129 if (target == GL_PROXY_TEXTURE_3D) {
10130 /* don't compile, execute immediately */
10131 CALL_MultiTexImage3DEXT(ctx->Exec, (texunit, target, level, internalFormat, width,
10132 height, depth, border, format, type,
10133 pixels));
10134 }
10135 else {
10136 Node *n;
10137 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10138 n = alloc_instruction(ctx, OPCODE_MULTITEX_IMAGE3D, 10 + POINTER_DWORDS);
10139 if (n) {
10140 n[1].e = texunit;
10141 n[2].e = target;
10142 n[3].i = level;
10143 n[4].i = (GLint) internalFormat;
10144 n[5].i = (GLint) width;
10145 n[6].i = (GLint) height;
10146 n[7].i = (GLint) depth;
10147 n[8].i = border;
10148 n[9].e = format;
10149 n[10].e = type;
10150 save_pointer(&n[11],
10151 unpack_image(ctx, 3, width, height, depth, format, type,
10152 pixels, &ctx->Unpack));
10153 }
10154 if (ctx->ExecuteFlag) {
10155 CALL_MultiTexImage3DEXT(ctx->Exec, (texunit, target, level, internalFormat,
10156 width, height, depth, border, format,
10157 type, pixels));
10158 }
10159 }
10160 }
10161
10162
10163 static void GLAPIENTRY
10164 save_MultiTexSubImage1DEXT(GLenum texunit, GLenum target, GLint level, GLint xoffset,
10165 GLsizei width, GLenum format, GLenum type,
10166 const GLvoid * pixels)
10167 {
10168 GET_CURRENT_CONTEXT(ctx);
10169 Node *n;
10170
10171 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10172
10173 n = alloc_instruction(ctx, OPCODE_MULTITEX_SUB_IMAGE1D, 7 + POINTER_DWORDS);
10174 if (n) {
10175 n[1].e = texunit;
10176 n[2].e = target;
10177 n[3].i = level;
10178 n[4].i = xoffset;
10179 n[5].i = (GLint) width;
10180 n[6].e = format;
10181 n[7].e = type;
10182 save_pointer(&n[8],
10183 unpack_image(ctx, 1, width, 1, 1, format, type,
10184 pixels, &ctx->Unpack));
10185 }
10186 if (ctx->ExecuteFlag) {
10187 CALL_MultiTexSubImage1DEXT(ctx->Exec, (texunit, target, level, xoffset, width,
10188 format, type, pixels));
10189 }
10190 }
10191
10192
10193 static void GLAPIENTRY
10194 save_MultiTexSubImage2DEXT(GLenum texunit, GLenum target, GLint level,
10195 GLint xoffset, GLint yoffset,
10196 GLsizei width, GLsizei height,
10197 GLenum format, GLenum type, const GLvoid * pixels)
10198 {
10199 GET_CURRENT_CONTEXT(ctx);
10200 Node *n;
10201
10202 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10203
10204 n = alloc_instruction(ctx, OPCODE_MULTITEX_SUB_IMAGE2D, 9 + POINTER_DWORDS);
10205 if (n) {
10206 n[1].e = texunit;
10207 n[2].e = target;
10208 n[3].i = level;
10209 n[4].i = xoffset;
10210 n[5].i = yoffset;
10211 n[6].i = (GLint) width;
10212 n[7].i = (GLint) height;
10213 n[8].e = format;
10214 n[9].e = type;
10215 save_pointer(&n[10],
10216 unpack_image(ctx, 2, width, height, 1, format, type,
10217 pixels, &ctx->Unpack));
10218 }
10219 if (ctx->ExecuteFlag) {
10220 CALL_MultiTexSubImage2DEXT(ctx->Exec, (texunit, target, level, xoffset, yoffset,
10221 width, height, format, type, pixels));
10222 }
10223 }
10224
10225
10226 static void GLAPIENTRY
10227 save_MultiTexSubImage3DEXT(GLenum texunit, GLenum target, GLint level,
10228 GLint xoffset, GLint yoffset, GLint zoffset,
10229 GLsizei width, GLsizei height, GLsizei depth,
10230 GLenum format, GLenum type, const GLvoid * pixels)
10231 {
10232 GET_CURRENT_CONTEXT(ctx);
10233 Node *n;
10234
10235 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10236
10237 n = alloc_instruction(ctx, OPCODE_MULTITEX_SUB_IMAGE3D, 11 + POINTER_DWORDS);
10238 if (n) {
10239 n[1].e = texunit;
10240 n[2].e = target;
10241 n[3].i = level;
10242 n[4].i = xoffset;
10243 n[5].i = yoffset;
10244 n[6].i = zoffset;
10245 n[7].i = (GLint) width;
10246 n[8].i = (GLint) height;
10247 n[9].i = (GLint) depth;
10248 n[10].e = format;
10249 n[11].e = type;
10250 save_pointer(&n[12],
10251 unpack_image(ctx, 3, width, height, depth, format, type,
10252 pixels, &ctx->Unpack));
10253 }
10254 if (ctx->ExecuteFlag) {
10255 CALL_MultiTexSubImage3DEXT(ctx->Exec, (texunit, target, level,
10256 xoffset, yoffset, zoffset,
10257 width, height, depth, format, type,
10258 pixels));
10259 }
10260 }
10261
10262
10263 static void GLAPIENTRY
10264 save_CopyMultiTexImage1DEXT(GLenum texunit, GLenum target, GLint level,
10265 GLenum internalformat, GLint x, GLint y,
10266 GLsizei width, GLint border)
10267 {
10268 GET_CURRENT_CONTEXT(ctx);
10269 Node *n;
10270 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10271 n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_IMAGE1D, 8);
10272 if (n) {
10273 n[1].e = texunit;
10274 n[2].e = target;
10275 n[3].i = level;
10276 n[4].e = internalformat;
10277 n[5].i = x;
10278 n[6].i = y;
10279 n[7].i = width;
10280 n[8].i = border;
10281 }
10282 if (ctx->ExecuteFlag) {
10283 CALL_CopyMultiTexImage1DEXT(ctx->Exec, (texunit, target, level,
10284 internalformat, x, y,
10285 width, border));
10286 }
10287 }
10288
10289
10290 static void GLAPIENTRY
10291 save_CopyMultiTexImage2DEXT(GLenum texunit, GLenum target, GLint level,
10292 GLenum internalformat,
10293 GLint x, GLint y, GLsizei width,
10294 GLsizei height, GLint border)
10295 {
10296 GET_CURRENT_CONTEXT(ctx);
10297 Node *n;
10298 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10299 n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_IMAGE2D, 9);
10300 if (n) {
10301 n[1].e = texunit;
10302 n[2].e = target;
10303 n[3].i = level;
10304 n[4].e = internalformat;
10305 n[5].i = x;
10306 n[6].i = y;
10307 n[7].i = width;
10308 n[8].i = height;
10309 n[9].i = border;
10310 }
10311 if (ctx->ExecuteFlag) {
10312 CALL_CopyMultiTexImage2DEXT(ctx->Exec, (texunit, target, level,
10313 internalformat, x, y,
10314 width, height, border));
10315 }
10316 }
10317
10318
10319 static void GLAPIENTRY
10320 save_CopyMultiTexSubImage1DEXT(GLenum texunit, GLenum target, GLint level,
10321 GLint xoffset, GLint x, GLint y, GLsizei width)
10322 {
10323 GET_CURRENT_CONTEXT(ctx);
10324 Node *n;
10325 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10326 n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_SUB_IMAGE1D, 7);
10327 if (n) {
10328 n[1].e = texunit;
10329 n[2].e = target;
10330 n[3].i = level;
10331 n[4].i = xoffset;
10332 n[5].i = x;
10333 n[6].i = y;
10334 n[7].i = width;
10335 }
10336 if (ctx->ExecuteFlag) {
10337 CALL_CopyMultiTexSubImage1DEXT(ctx->Exec,
10338 (texunit, target, level, xoffset, x, y, width));
10339 }
10340 }
10341
10342
10343 static void GLAPIENTRY
10344 save_CopyMultiTexSubImage2DEXT(GLenum texunit, GLenum target, GLint level,
10345 GLint xoffset, GLint yoffset,
10346 GLint x, GLint y, GLsizei width, GLint height)
10347 {
10348 GET_CURRENT_CONTEXT(ctx);
10349 Node *n;
10350 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10351 n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_SUB_IMAGE2D, 9);
10352 if (n) {
10353 n[1].e = texunit;
10354 n[2].e = target;
10355 n[3].i = level;
10356 n[4].i = xoffset;
10357 n[5].i = yoffset;
10358 n[6].i = x;
10359 n[7].i = y;
10360 n[8].i = width;
10361 n[9].i = height;
10362 }
10363 if (ctx->ExecuteFlag) {
10364 CALL_CopyMultiTexSubImage2DEXT(ctx->Exec, (texunit, target, level,
10365 xoffset, yoffset,
10366 x, y, width, height));
10367 }
10368 }
10369
10370
10371 static void GLAPIENTRY
10372 save_CopyMultiTexSubImage3DEXT(GLenum texunit, GLenum target, GLint level,
10373 GLint xoffset, GLint yoffset, GLint zoffset,
10374 GLint x, GLint y, GLsizei width, GLint height)
10375 {
10376 GET_CURRENT_CONTEXT(ctx);
10377 Node *n;
10378 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10379 n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_SUB_IMAGE3D, 10);
10380 if (n) {
10381 n[1].e = texunit;
10382 n[2].e = target;
10383 n[3].i = level;
10384 n[4].i = xoffset;
10385 n[5].i = yoffset;
10386 n[6].i = zoffset;
10387 n[7].i = x;
10388 n[8].i = y;
10389 n[9].i = width;
10390 n[10].i = height;
10391 }
10392 if (ctx->ExecuteFlag) {
10393 CALL_CopyMultiTexSubImage3DEXT(ctx->Exec, (texunit, target, level,
10394 xoffset, yoffset, zoffset,
10395 x, y, width, height));
10396 }
10397 }
10398
10399
10400 static void GLAPIENTRY
10401 save_MultiTexEnvfvEXT(GLenum texunit, GLenum target, GLenum pname, const GLfloat *params)
10402 {
10403 GET_CURRENT_CONTEXT(ctx);
10404 Node *n;
10405 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10406 n = alloc_instruction(ctx, OPCODE_MULTITEXENV, 7);
10407 if (n) {
10408 n[1].e = texunit;
10409 n[2].e = target;
10410 n[3].e = pname;
10411 if (pname == GL_TEXTURE_ENV_COLOR) {
10412 n[4].f = params[0];
10413 n[5].f = params[1];
10414 n[6].f = params[2];
10415 n[7].f = params[3];
10416 }
10417 else {
10418 n[4].f = params[0];
10419 n[5].f = n[6].f = n[7].f = 0.0F;
10420 }
10421 }
10422 if (ctx->ExecuteFlag) {
10423 CALL_MultiTexEnvfvEXT(ctx->Exec, (texunit, target, pname, params));
10424 }
10425 }
10426
10427
10428 static void GLAPIENTRY
10429 save_MultiTexEnvfEXT(GLenum texunit, GLenum target, GLenum pname, GLfloat param)
10430 {
10431 GLfloat parray[4];
10432 parray[0] = (GLfloat) param;
10433 parray[1] = parray[2] = parray[3] = 0.0F;
10434 save_MultiTexEnvfvEXT(texunit, target, pname, parray);
10435 }
10436
10437
10438 static void GLAPIENTRY
10439 save_MultiTexEnviEXT(GLenum texunit, GLenum target, GLenum pname, GLint param)
10440 {
10441 GLfloat p[4];
10442 p[0] = (GLfloat) param;
10443 p[1] = p[2] = p[3] = 0.0F;
10444 save_MultiTexEnvfvEXT(texunit, target, pname, p);
10445 }
10446
10447
10448 static void GLAPIENTRY
10449 save_MultiTexEnvivEXT(GLenum texunit, GLenum target, GLenum pname, const GLint * param)
10450 {
10451 GLfloat p[4];
10452 if (pname == GL_TEXTURE_ENV_COLOR) {
10453 p[0] = INT_TO_FLOAT(param[0]);
10454 p[1] = INT_TO_FLOAT(param[1]);
10455 p[2] = INT_TO_FLOAT(param[2]);
10456 p[3] = INT_TO_FLOAT(param[3]);
10457 }
10458 else {
10459 p[0] = (GLfloat) param[0];
10460 p[1] = p[2] = p[3] = 0.0F;
10461 }
10462 save_MultiTexEnvfvEXT(texunit, target, pname, p);
10463 }
10464
10465
10466 static void GLAPIENTRY
10467 save_CompressedTextureImage1DEXT(GLuint texture, GLenum target, GLint level,
10468 GLenum internalFormat, GLsizei width,
10469 GLint border, GLsizei imageSize,
10470 const GLvoid * data)
10471 {
10472 GET_CURRENT_CONTEXT(ctx);
10473 if (target == GL_PROXY_TEXTURE_1D) {
10474 /* don't compile, execute immediately */
10475 CALL_CompressedTextureImage1DEXT(ctx->Exec, (texture, target, level,
10476 internalFormat, width,
10477 border, imageSize,
10478 data));
10479 }
10480 else {
10481 Node *n;
10482 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10483
10484 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_IMAGE_1D,
10485 7 + POINTER_DWORDS);
10486 if (n) {
10487 n[1].ui = texture;
10488 n[2].e = target;
10489 n[3].i = level;
10490 n[4].e = internalFormat;
10491 n[5].i = (GLint) width;
10492 n[6].i = border;
10493 n[7].i = imageSize;
10494 save_pointer(&n[8],
10495 copy_data(data, imageSize, "glCompressedTextureImage1DEXT"));
10496 }
10497 if (ctx->ExecuteFlag) {
10498 CALL_CompressedTextureImage1DEXT(ctx->Exec,
10499 (texture, target, level, internalFormat,
10500 width, border, imageSize, data));
10501 }
10502 }
10503 }
10504
10505
10506 static void GLAPIENTRY
10507 save_CompressedTextureImage2DEXT(GLuint texture, GLenum target, GLint level,
10508 GLenum internalFormat, GLsizei width,
10509 GLsizei height, GLint border, GLsizei imageSize,
10510 const GLvoid * data)
10511 {
10512 GET_CURRENT_CONTEXT(ctx);
10513 if (target == GL_PROXY_TEXTURE_2D) {
10514 /* don't compile, execute immediately */
10515 CALL_CompressedTextureImage2DEXT(ctx->Exec, (texture, target, level,
10516 internalFormat, width, height,
10517 border, imageSize, data));
10518 }
10519 else {
10520 Node *n;
10521 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10522
10523 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_IMAGE_2D,
10524 8 + POINTER_DWORDS);
10525 if (n) {
10526 n[1].ui = texture;
10527 n[2].e = target;
10528 n[3].i = level;
10529 n[4].e = internalFormat;
10530 n[5].i = (GLint) width;
10531 n[6].i = (GLint) height;
10532 n[7].i = border;
10533 n[8].i = imageSize;
10534 save_pointer(&n[9],
10535 copy_data(data, imageSize, "glCompressedTextureImage2DEXT"));
10536 }
10537 if (ctx->ExecuteFlag) {
10538 CALL_CompressedTextureImage2DEXT(ctx->Exec,
10539 (texture, target, level, internalFormat,
10540 width, height, border, imageSize, data));
10541 }
10542 }
10543 }
10544
10545
10546 static void GLAPIENTRY
10547 save_CompressedTextureImage3DEXT(GLuint texture, GLenum target, GLint level,
10548 GLenum internalFormat, GLsizei width,
10549 GLsizei height, GLsizei depth, GLint border,
10550 GLsizei imageSize, const GLvoid * data)
10551 {
10552 GET_CURRENT_CONTEXT(ctx);
10553 if (target == GL_PROXY_TEXTURE_3D) {
10554 /* don't compile, execute immediately */
10555 CALL_CompressedTextureImage3DEXT(ctx->Exec, (texture, target, level,
10556 internalFormat, width,
10557 height, depth, border,
10558 imageSize, data));
10559 }
10560 else {
10561 Node *n;
10562 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10563
10564 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_IMAGE_3D,
10565 9 + POINTER_DWORDS);
10566 if (n) {
10567 n[1].ui = texture;
10568 n[2].e = target;
10569 n[3].i = level;
10570 n[4].e = internalFormat;
10571 n[5].i = (GLint) width;
10572 n[6].i = (GLint) height;
10573 n[7].i = (GLint) depth;
10574 n[8].i = border;
10575 n[9].i = imageSize;
10576 save_pointer(&n[10],
10577 copy_data(data, imageSize, "glCompressedTextureImage3DEXT"));
10578 }
10579 if (ctx->ExecuteFlag) {
10580 CALL_CompressedTextureImage3DEXT(ctx->Exec,
10581 (texture, target, level, internalFormat,
10582 width, height, depth, border, imageSize,
10583 data));
10584 }
10585 }
10586 }
10587
10588
10589 static void GLAPIENTRY
10590 save_CompressedTextureSubImage1DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset,
10591 GLsizei width, GLenum format,
10592 GLsizei imageSize, const GLvoid * data)
10593 {
10594 Node *n;
10595 GET_CURRENT_CONTEXT(ctx);
10596 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10597
10598 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_1D,
10599 7 + POINTER_DWORDS);
10600 if (n) {
10601 n[1].ui = texture;
10602 n[2].e = target;
10603 n[3].i = level;
10604 n[4].i = xoffset;
10605 n[5].i = (GLint) width;
10606 n[6].e = format;
10607 n[7].i = imageSize;
10608 save_pointer(&n[8],
10609 copy_data(data, imageSize, "glCompressedTextureSubImage1DEXT"));
10610 }
10611 if (ctx->ExecuteFlag) {
10612 CALL_CompressedTextureSubImage1DEXT(ctx->Exec, (texture, target, level, xoffset,
10613 width, format, imageSize, data));
10614 }
10615 }
10616
10617
10618 static void GLAPIENTRY
10619 save_CompressedTextureSubImage2DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset,
10620 GLint yoffset, GLsizei width, GLsizei height,
10621 GLenum format, GLsizei imageSize,
10622 const GLvoid * data)
10623 {
10624 Node *n;
10625 GET_CURRENT_CONTEXT(ctx);
10626 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10627
10628 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_2D,
10629 9 + POINTER_DWORDS);
10630 if (n) {
10631 n[1].ui = texture;
10632 n[2].e = target;
10633 n[3].i = level;
10634 n[4].i = xoffset;
10635 n[5].i = yoffset;
10636 n[6].i = (GLint) width;
10637 n[7].i = (GLint) height;
10638 n[8].e = format;
10639 n[9].i = imageSize;
10640 save_pointer(&n[10],
10641 copy_data(data, imageSize, "glCompressedTextureSubImage2DEXT"));
10642 }
10643 if (ctx->ExecuteFlag) {
10644 CALL_CompressedTextureSubImage2DEXT(ctx->Exec,
10645 (texture, target, level, xoffset, yoffset,
10646 width, height, format, imageSize, data));
10647 }
10648 }
10649
10650
10651 static void GLAPIENTRY
10652 save_CompressedTextureSubImage3DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset,
10653 GLint yoffset, GLint zoffset, GLsizei width,
10654 GLsizei height, GLsizei depth, GLenum format,
10655 GLsizei imageSize, const GLvoid * data)
10656 {
10657 Node *n;
10658 GET_CURRENT_CONTEXT(ctx);
10659 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10660
10661 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_3D,
10662 11 + POINTER_DWORDS);
10663 if (n) {
10664 n[1].ui = texture;
10665 n[2].e = target;
10666 n[3].i = level;
10667 n[4].i = xoffset;
10668 n[5].i = yoffset;
10669 n[6].i = zoffset;
10670 n[7].i = (GLint) width;
10671 n[8].i = (GLint) height;
10672 n[9].i = (GLint) depth;
10673 n[10].e = format;
10674 n[11].i = imageSize;
10675 save_pointer(&n[12],
10676 copy_data(data, imageSize, "glCompressedTextureSubImage3DEXT"));
10677 }
10678 if (ctx->ExecuteFlag) {
10679 CALL_CompressedTextureSubImage3DEXT(ctx->Exec,
10680 (texture, target, level, xoffset, yoffset,
10681 zoffset, width, height, depth, format,
10682 imageSize, data));
10683 }
10684 }
10685
10686
10687 static void GLAPIENTRY
10688 save_CompressedMultiTexImage1DEXT(GLenum texunit, GLenum target, GLint level,
10689 GLenum internalFormat, GLsizei width,
10690 GLint border, GLsizei imageSize,
10691 const GLvoid * data)
10692 {
10693 GET_CURRENT_CONTEXT(ctx);
10694 if (target == GL_PROXY_TEXTURE_1D) {
10695 /* don't compile, execute immediately */
10696 CALL_CompressedMultiTexImage1DEXT(ctx->Exec, (texunit, target, level,
10697 internalFormat, width,
10698 border, imageSize,
10699 data));
10700 }
10701 else {
10702 Node *n;
10703 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10704
10705 n = alloc_instruction(ctx, OPCODE_COMPRESSED_MULTITEX_IMAGE_1D,
10706 7 + POINTER_DWORDS);
10707 if (n) {
10708 n[1].e = texunit;
10709 n[2].e = target;
10710 n[3].i = level;
10711 n[4].e = internalFormat;
10712 n[5].i = (GLint) width;
10713 n[6].i = border;
10714 n[7].i = imageSize;
10715 save_pointer(&n[8],
10716 copy_data(data, imageSize, "glCompressedMultiTexImage1DEXT"));
10717 }
10718 if (ctx->ExecuteFlag) {
10719 CALL_CompressedMultiTexImage1DEXT(ctx->Exec,
10720 (texunit, target, level, internalFormat,
10721 width, border, imageSize, data));
10722 }
10723 }
10724 }
10725
10726
10727 static void GLAPIENTRY
10728 save_CompressedMultiTexImage2DEXT(GLenum texunit, GLenum target, GLint level,
10729 GLenum internalFormat, GLsizei width,
10730 GLsizei height, GLint border, GLsizei imageSize,
10731 const GLvoid * data)
10732 {
10733 GET_CURRENT_CONTEXT(ctx);
10734 if (target == GL_PROXY_TEXTURE_2D) {
10735 /* don't compile, execute immediately */
10736 CALL_CompressedMultiTexImage2DEXT(ctx->Exec, (texunit, target, level,
10737 internalFormat, width, height,
10738 border, imageSize, data));
10739 }
10740 else {
10741 Node *n;
10742 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10743
10744 n = alloc_instruction(ctx, OPCODE_COMPRESSED_MULTITEX_IMAGE_2D,
10745 8 + POINTER_DWORDS);
10746 if (n) {
10747 n[1].e = texunit;
10748 n[2].e = target;
10749 n[3].i = level;
10750 n[4].e = internalFormat;
10751 n[5].i = (GLint) width;
10752 n[6].i = (GLint) height;
10753 n[7].i = border;
10754 n[8].i = imageSize;
10755 save_pointer(&n[9],
10756 copy_data(data, imageSize, "glCompressedMultiTexImage2DEXT"));
10757 }
10758 if (ctx->ExecuteFlag) {
10759 CALL_CompressedMultiTexImage2DEXT(ctx->Exec,
10760 (texunit, target, level, internalFormat,
10761 width, height, border, imageSize, data));
10762 }
10763 }
10764 }
10765
10766
10767 static void GLAPIENTRY
10768 save_CompressedMultiTexImage3DEXT(GLenum texunit, GLenum target, GLint level,
10769 GLenum internalFormat, GLsizei width,
10770 GLsizei height, GLsizei depth, GLint border,
10771 GLsizei imageSize, const GLvoid * data)
10772 {
10773 GET_CURRENT_CONTEXT(ctx);
10774 if (target == GL_PROXY_TEXTURE_3D) {
10775 /* don't compile, execute immediately */
10776 CALL_CompressedMultiTexImage3DEXT(ctx->Exec, (texunit, target, level,
10777 internalFormat, width,
10778 height, depth, border,
10779 imageSize, data));
10780 }
10781 else {
10782 Node *n;
10783 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10784
10785 n = alloc_instruction(ctx, OPCODE_COMPRESSED_MULTITEX_IMAGE_3D,
10786 9 + POINTER_DWORDS);
10787 if (n) {
10788 n[1].e = texunit;
10789 n[2].e = target;
10790 n[3].i = level;
10791 n[4].e = internalFormat;
10792 n[5].i = (GLint) width;
10793 n[6].i = (GLint) height;
10794 n[7].i = (GLint) depth;
10795 n[8].i = border;
10796 n[9].i = imageSize;
10797 save_pointer(&n[10],
10798 copy_data(data, imageSize, "glCompressedMultiTexImage3DEXT"));
10799 }
10800 if (ctx->ExecuteFlag) {
10801 CALL_CompressedMultiTexImage3DEXT(ctx->Exec,
10802 (texunit, target, level, internalFormat,
10803 width, height, depth, border, imageSize,
10804 data));
10805 }
10806 }
10807 }
10808
10809
10810 static void GLAPIENTRY
10811 save_CompressedMultiTexSubImage1DEXT(GLenum texunit, GLenum target, GLint level, GLint xoffset,
10812 GLsizei width, GLenum format,
10813 GLsizei imageSize, const GLvoid * data)
10814 {
10815 Node *n;
10816 GET_CURRENT_CONTEXT(ctx);
10817 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10818
10819 n = alloc_instruction(ctx, OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_1D,
10820 7 + POINTER_DWORDS);
10821 if (n) {
10822 n[1].e = texunit;
10823 n[2].e = target;
10824 n[3].i = level;
10825 n[4].i = xoffset;
10826 n[5].i = (GLint) width;
10827 n[6].e = format;
10828 n[7].i = imageSize;
10829 save_pointer(&n[8],
10830 copy_data(data, imageSize, "glCompressedMultiTexSubImage1DEXT"));
10831 }
10832 if (ctx->ExecuteFlag) {
10833 CALL_CompressedMultiTexSubImage1DEXT(ctx->Exec, (texunit, target, level, xoffset,
10834 width, format, imageSize, data));
10835 }
10836 }
10837
10838
10839 static void GLAPIENTRY
10840 save_CompressedMultiTexSubImage2DEXT(GLenum texunit, GLenum target, GLint level, GLint xoffset,
10841 GLint yoffset, GLsizei width, GLsizei height,
10842 GLenum format, GLsizei imageSize,
10843 const GLvoid * data)
10844 {
10845 Node *n;
10846 GET_CURRENT_CONTEXT(ctx);
10847 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10848
10849 n = alloc_instruction(ctx, OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_2D,
10850 9 + POINTER_DWORDS);
10851 if (n) {
10852 n[1].e = texunit;
10853 n[2].e = target;
10854 n[3].i = level;
10855 n[4].i = xoffset;
10856 n[5].i = yoffset;
10857 n[6].i = (GLint) width;
10858 n[7].i = (GLint) height;
10859 n[8].e = format;
10860 n[9].i = imageSize;
10861 save_pointer(&n[10],
10862 copy_data(data, imageSize, "glCompressedMultiTexSubImage2DEXT"));
10863 }
10864 if (ctx->ExecuteFlag) {
10865 CALL_CompressedMultiTexSubImage2DEXT(ctx->Exec,
10866 (texunit, target, level, xoffset, yoffset,
10867 width, height, format, imageSize, data));
10868 }
10869 }
10870
10871
10872 static void GLAPIENTRY
10873 save_CompressedMultiTexSubImage3DEXT(GLenum texunit, GLenum target, GLint level, GLint xoffset,
10874 GLint yoffset, GLint zoffset, GLsizei width,
10875 GLsizei height, GLsizei depth, GLenum format,
10876 GLsizei imageSize, const GLvoid * data)
10877 {
10878 Node *n;
10879 GET_CURRENT_CONTEXT(ctx);
10880 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10881
10882 n = alloc_instruction(ctx, OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_3D,
10883 11 + POINTER_DWORDS);
10884 if (n) {
10885 n[1].e = texunit;
10886 n[2].e = target;
10887 n[3].i = level;
10888 n[4].i = xoffset;
10889 n[5].i = yoffset;
10890 n[6].i = zoffset;
10891 n[7].i = (GLint) width;
10892 n[8].i = (GLint) height;
10893 n[9].i = (GLint) depth;
10894 n[10].e = format;
10895 n[11].i = imageSize;
10896 save_pointer(&n[12],
10897 copy_data(data, imageSize, "glCompressedMultiTexSubImage3DEXT"));
10898 }
10899 if (ctx->ExecuteFlag) {
10900 CALL_CompressedMultiTexSubImage3DEXT(ctx->Exec,
10901 (texunit, target, level, xoffset, yoffset,
10902 zoffset, width, height, depth, format,
10903 imageSize, data));
10904 }
10905 }
10906
10907
10908 /**
10909 * Save an error-generating command into display list.
10910 *
10911 * KW: Will appear in the list before the vertex buffer containing the
10912 * command that provoked the error. I don't see this as a problem.
10913 */
10914 static void
10915 save_error(struct gl_context *ctx, GLenum error, const char *s)
10916 {
10917 Node *n;
10918 n = alloc_instruction(ctx, OPCODE_ERROR, 1 + POINTER_DWORDS);
10919 if (n) {
10920 n[1].e = error;
10921 save_pointer(&n[2], (void *) s);
10922 /* note: the data/string here doesn't have to be freed in
10923 * _mesa_delete_list() since the string is never dynamically
10924 * allocated.
10925 */
10926 }
10927 }
10928
10929
10930 /**
10931 * Compile an error into current display list.
10932 */
10933 void
10934 _mesa_compile_error(struct gl_context *ctx, GLenum error, const char *s)
10935 {
10936 if (ctx->CompileFlag)
10937 save_error(ctx, error, s);
10938 if (ctx->ExecuteFlag)
10939 _mesa_error(ctx, error, "%s", s);
10940 }
10941
10942
10943 /**
10944 * Test if ID names a display list.
10945 */
10946 static GLboolean
10947 islist(struct gl_context *ctx, GLuint list)
10948 {
10949 if (list > 0 && _mesa_lookup_list(ctx, list)) {
10950 return GL_TRUE;
10951 }
10952 else {
10953 return GL_FALSE;
10954 }
10955 }
10956
10957
10958
10959 /**********************************************************************/
10960 /* Display list execution */
10961 /**********************************************************************/
10962
10963
10964 /*
10965 * Execute a display list. Note that the ListBase offset must have already
10966 * been added before calling this function. I.e. the list argument is
10967 * the absolute list number, not relative to ListBase.
10968 * \param list - display list number
10969 */
10970 static void
10971 execute_list(struct gl_context *ctx, GLuint list)
10972 {
10973 struct gl_display_list *dlist;
10974 Node *n;
10975 GLboolean done;
10976
10977 if (list == 0 || !islist(ctx, list))
10978 return;
10979
10980 if (ctx->ListState.CallDepth == MAX_LIST_NESTING) {
10981 /* raise an error? */
10982 return;
10983 }
10984
10985 dlist = _mesa_lookup_list(ctx, list);
10986 if (!dlist)
10987 return;
10988
10989 ctx->ListState.CallDepth++;
10990
10991 vbo_save_BeginCallList(ctx, dlist);
10992
10993 n = dlist->Head;
10994
10995 done = GL_FALSE;
10996 while (!done) {
10997 const OpCode opcode = n[0].opcode;
10998
10999 if (is_ext_opcode(opcode)) {
11000 n += ext_opcode_execute(ctx, n);
11001 }
11002 else {
11003 switch (opcode) {
11004 case OPCODE_ERROR:
11005 _mesa_error(ctx, n[1].e, "%s", (const char *) get_pointer(&n[2]));
11006 break;
11007 case OPCODE_ACCUM:
11008 CALL_Accum(ctx->Exec, (n[1].e, n[2].f));
11009 break;
11010 case OPCODE_ALPHA_FUNC:
11011 CALL_AlphaFunc(ctx->Exec, (n[1].e, n[2].f));
11012 break;
11013 case OPCODE_BIND_TEXTURE:
11014 CALL_BindTexture(ctx->Exec, (n[1].e, n[2].ui));
11015 break;
11016 case OPCODE_BITMAP:
11017 {
11018 const struct gl_pixelstore_attrib save = ctx->Unpack;
11019 ctx->Unpack = ctx->DefaultPacking;
11020 CALL_Bitmap(ctx->Exec, ((GLsizei) n[1].i, (GLsizei) n[2].i,
11021 n[3].f, n[4].f, n[5].f, n[6].f,
11022 get_pointer(&n[7])));
11023 ctx->Unpack = save; /* restore */
11024 }
11025 break;
11026 case OPCODE_BLEND_COLOR:
11027 CALL_BlendColor(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
11028 break;
11029 case OPCODE_BLEND_EQUATION:
11030 CALL_BlendEquation(ctx->Exec, (n[1].e));
11031 break;
11032 case OPCODE_BLEND_EQUATION_SEPARATE:
11033 CALL_BlendEquationSeparate(ctx->Exec, (n[1].e, n[2].e));
11034 break;
11035 case OPCODE_BLEND_FUNC_SEPARATE:
11036 CALL_BlendFuncSeparate(ctx->Exec,
11037 (n[1].e, n[2].e, n[3].e, n[4].e));
11038 break;
11039
11040 case OPCODE_BLEND_FUNC_I:
11041 /* GL_ARB_draw_buffers_blend */
11042 CALL_BlendFunciARB(ctx->Exec, (n[1].ui, n[2].e, n[3].e));
11043 break;
11044 case OPCODE_BLEND_FUNC_SEPARATE_I:
11045 /* GL_ARB_draw_buffers_blend */
11046 CALL_BlendFuncSeparateiARB(ctx->Exec, (n[1].ui, n[2].e, n[3].e,
11047 n[4].e, n[5].e));
11048 break;
11049 case OPCODE_BLEND_EQUATION_I:
11050 /* GL_ARB_draw_buffers_blend */
11051 CALL_BlendEquationiARB(ctx->Exec, (n[1].ui, n[2].e));
11052 break;
11053 case OPCODE_BLEND_EQUATION_SEPARATE_I:
11054 /* GL_ARB_draw_buffers_blend */
11055 CALL_BlendEquationSeparateiARB(ctx->Exec,
11056 (n[1].ui, n[2].e, n[3].e));
11057 break;
11058
11059 case OPCODE_CALL_LIST:
11060 /* Generated by glCallList(), don't add ListBase */
11061 if (ctx->ListState.CallDepth < MAX_LIST_NESTING) {
11062 execute_list(ctx, n[1].ui);
11063 }
11064 break;
11065 case OPCODE_CALL_LISTS:
11066 if (ctx->ListState.CallDepth < MAX_LIST_NESTING) {
11067 CALL_CallLists(ctx->Exec, (n[1].i, n[2].e, get_pointer(&n[3])));
11068 }
11069 break;
11070 case OPCODE_CLEAR:
11071 CALL_Clear(ctx->Exec, (n[1].bf));
11072 break;
11073 case OPCODE_CLEAR_BUFFER_IV:
11074 {
11075 GLint value[4];
11076 value[0] = n[3].i;
11077 value[1] = n[4].i;
11078 value[2] = n[5].i;
11079 value[3] = n[6].i;
11080 CALL_ClearBufferiv(ctx->Exec, (n[1].e, n[2].i, value));
11081 }
11082 break;
11083 case OPCODE_CLEAR_BUFFER_UIV:
11084 {
11085 GLuint value[4];
11086 value[0] = n[3].ui;
11087 value[1] = n[4].ui;
11088 value[2] = n[5].ui;
11089 value[3] = n[6].ui;
11090 CALL_ClearBufferuiv(ctx->Exec, (n[1].e, n[2].i, value));
11091 }
11092 break;
11093 case OPCODE_CLEAR_BUFFER_FV:
11094 {
11095 GLfloat value[4];
11096 value[0] = n[3].f;
11097 value[1] = n[4].f;
11098 value[2] = n[5].f;
11099 value[3] = n[6].f;
11100 CALL_ClearBufferfv(ctx->Exec, (n[1].e, n[2].i, value));
11101 }
11102 break;
11103 case OPCODE_CLEAR_BUFFER_FI:
11104 CALL_ClearBufferfi(ctx->Exec, (n[1].e, n[2].i, n[3].f, n[4].i));
11105 break;
11106 case OPCODE_CLEAR_COLOR:
11107 CALL_ClearColor(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
11108 break;
11109 case OPCODE_CLEAR_ACCUM:
11110 CALL_ClearAccum(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
11111 break;
11112 case OPCODE_CLEAR_DEPTH:
11113 CALL_ClearDepth(ctx->Exec, ((GLclampd) n[1].f));
11114 break;
11115 case OPCODE_CLEAR_INDEX:
11116 CALL_ClearIndex(ctx->Exec, ((GLfloat) n[1].ui));
11117 break;
11118 case OPCODE_CLEAR_STENCIL:
11119 CALL_ClearStencil(ctx->Exec, (n[1].i));
11120 break;
11121 case OPCODE_CLIP_PLANE:
11122 {
11123 GLdouble eq[4];
11124 eq[0] = n[2].f;
11125 eq[1] = n[3].f;
11126 eq[2] = n[4].f;
11127 eq[3] = n[5].f;
11128 CALL_ClipPlane(ctx->Exec, (n[1].e, eq));
11129 }
11130 break;
11131 case OPCODE_COLOR_MASK:
11132 CALL_ColorMask(ctx->Exec, (n[1].b, n[2].b, n[3].b, n[4].b));
11133 break;
11134 case OPCODE_COLOR_MASK_INDEXED:
11135 CALL_ColorMaski(ctx->Exec, (n[1].ui, n[2].b, n[3].b,
11136 n[4].b, n[5].b));
11137 break;
11138 case OPCODE_COLOR_MATERIAL:
11139 CALL_ColorMaterial(ctx->Exec, (n[1].e, n[2].e));
11140 break;
11141 case OPCODE_COPY_PIXELS:
11142 CALL_CopyPixels(ctx->Exec, (n[1].i, n[2].i,
11143 (GLsizei) n[3].i, (GLsizei) n[4].i,
11144 n[5].e));
11145 break;
11146 case OPCODE_COPY_TEX_IMAGE1D:
11147 CALL_CopyTexImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].e, n[4].i,
11148 n[5].i, n[6].i, n[7].i));
11149 break;
11150 case OPCODE_COPY_TEX_IMAGE2D:
11151 CALL_CopyTexImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].e, n[4].i,
11152 n[5].i, n[6].i, n[7].i, n[8].i));
11153 break;
11154 case OPCODE_COPY_TEX_SUB_IMAGE1D:
11155 CALL_CopyTexSubImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
11156 n[4].i, n[5].i, n[6].i));
11157 break;
11158 case OPCODE_COPY_TEX_SUB_IMAGE2D:
11159 CALL_CopyTexSubImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
11160 n[4].i, n[5].i, n[6].i, n[7].i,
11161 n[8].i));
11162 break;
11163 case OPCODE_COPY_TEX_SUB_IMAGE3D:
11164 CALL_CopyTexSubImage3D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
11165 n[4].i, n[5].i, n[6].i, n[7].i,
11166 n[8].i, n[9].i));
11167 break;
11168 case OPCODE_CULL_FACE:
11169 CALL_CullFace(ctx->Exec, (n[1].e));
11170 break;
11171 case OPCODE_DEPTH_FUNC:
11172 CALL_DepthFunc(ctx->Exec, (n[1].e));
11173 break;
11174 case OPCODE_DEPTH_MASK:
11175 CALL_DepthMask(ctx->Exec, (n[1].b));
11176 break;
11177 case OPCODE_DEPTH_RANGE:
11178 CALL_DepthRange(ctx->Exec,
11179 ((GLclampd) n[1].f, (GLclampd) n[2].f));
11180 break;
11181 case OPCODE_DISABLE:
11182 CALL_Disable(ctx->Exec, (n[1].e));
11183 break;
11184 case OPCODE_DISABLE_INDEXED:
11185 CALL_Disablei(ctx->Exec, (n[1].ui, n[2].e));
11186 break;
11187 case OPCODE_DRAW_BUFFER:
11188 CALL_DrawBuffer(ctx->Exec, (n[1].e));
11189 break;
11190 case OPCODE_DRAW_PIXELS:
11191 {
11192 const struct gl_pixelstore_attrib save = ctx->Unpack;
11193 ctx->Unpack = ctx->DefaultPacking;
11194 CALL_DrawPixels(ctx->Exec, (n[1].i, n[2].i, n[3].e, n[4].e,
11195 get_pointer(&n[5])));
11196 ctx->Unpack = save; /* restore */
11197 }
11198 break;
11199 case OPCODE_ENABLE:
11200 CALL_Enable(ctx->Exec, (n[1].e));
11201 break;
11202 case OPCODE_ENABLE_INDEXED:
11203 CALL_Enablei(ctx->Exec, (n[1].ui, n[2].e));
11204 break;
11205 case OPCODE_EVALMESH1:
11206 CALL_EvalMesh1(ctx->Exec, (n[1].e, n[2].i, n[3].i));
11207 break;
11208 case OPCODE_EVALMESH2:
11209 CALL_EvalMesh2(ctx->Exec,
11210 (n[1].e, n[2].i, n[3].i, n[4].i, n[5].i));
11211 break;
11212 case OPCODE_FOG:
11213 {
11214 GLfloat p[4];
11215 p[0] = n[2].f;
11216 p[1] = n[3].f;
11217 p[2] = n[4].f;
11218 p[3] = n[5].f;
11219 CALL_Fogfv(ctx->Exec, (n[1].e, p));
11220 }
11221 break;
11222 case OPCODE_FRONT_FACE:
11223 CALL_FrontFace(ctx->Exec, (n[1].e));
11224 break;
11225 case OPCODE_FRUSTUM:
11226 CALL_Frustum(ctx->Exec,
11227 (n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f));
11228 break;
11229 case OPCODE_HINT:
11230 CALL_Hint(ctx->Exec, (n[1].e, n[2].e));
11231 break;
11232 case OPCODE_INDEX_MASK:
11233 CALL_IndexMask(ctx->Exec, (n[1].ui));
11234 break;
11235 case OPCODE_INIT_NAMES:
11236 CALL_InitNames(ctx->Exec, ());
11237 break;
11238 case OPCODE_LIGHT:
11239 {
11240 GLfloat p[4];
11241 p[0] = n[3].f;
11242 p[1] = n[4].f;
11243 p[2] = n[5].f;
11244 p[3] = n[6].f;
11245 CALL_Lightfv(ctx->Exec, (n[1].e, n[2].e, p));
11246 }
11247 break;
11248 case OPCODE_LIGHT_MODEL:
11249 {
11250 GLfloat p[4];
11251 p[0] = n[2].f;
11252 p[1] = n[3].f;
11253 p[2] = n[4].f;
11254 p[3] = n[5].f;
11255 CALL_LightModelfv(ctx->Exec, (n[1].e, p));
11256 }
11257 break;
11258 case OPCODE_LINE_STIPPLE:
11259 CALL_LineStipple(ctx->Exec, (n[1].i, n[2].us));
11260 break;
11261 case OPCODE_LINE_WIDTH:
11262 CALL_LineWidth(ctx->Exec, (n[1].f));
11263 break;
11264 case OPCODE_LIST_BASE:
11265 CALL_ListBase(ctx->Exec, (n[1].ui));
11266 break;
11267 case OPCODE_LOAD_IDENTITY:
11268 CALL_LoadIdentity(ctx->Exec, ());
11269 break;
11270 case OPCODE_LOAD_MATRIX:
11271 STATIC_ASSERT(sizeof(Node) == sizeof(GLfloat));
11272 CALL_LoadMatrixf(ctx->Exec, (&n[1].f));
11273 break;
11274 case OPCODE_LOAD_NAME:
11275 CALL_LoadName(ctx->Exec, (n[1].ui));
11276 break;
11277 case OPCODE_LOGIC_OP:
11278 CALL_LogicOp(ctx->Exec, (n[1].e));
11279 break;
11280 case OPCODE_MAP1:
11281 {
11282 GLenum target = n[1].e;
11283 GLint ustride = _mesa_evaluator_components(target);
11284 GLint uorder = n[5].i;
11285 GLfloat u1 = n[2].f;
11286 GLfloat u2 = n[3].f;
11287 CALL_Map1f(ctx->Exec, (target, u1, u2, ustride, uorder,
11288 (GLfloat *) get_pointer(&n[6])));
11289 }
11290 break;
11291 case OPCODE_MAP2:
11292 {
11293 GLenum target = n[1].e;
11294 GLfloat u1 = n[2].f;
11295 GLfloat u2 = n[3].f;
11296 GLfloat v1 = n[4].f;
11297 GLfloat v2 = n[5].f;
11298 GLint ustride = n[6].i;
11299 GLint vstride = n[7].i;
11300 GLint uorder = n[8].i;
11301 GLint vorder = n[9].i;
11302 CALL_Map2f(ctx->Exec, (target, u1, u2, ustride, uorder,
11303 v1, v2, vstride, vorder,
11304 (GLfloat *) get_pointer(&n[10])));
11305 }
11306 break;
11307 case OPCODE_MAPGRID1:
11308 CALL_MapGrid1f(ctx->Exec, (n[1].i, n[2].f, n[3].f));
11309 break;
11310 case OPCODE_MAPGRID2:
11311 CALL_MapGrid2f(ctx->Exec,
11312 (n[1].i, n[2].f, n[3].f, n[4].i, n[5].f, n[6].f));
11313 break;
11314 case OPCODE_MATRIX_MODE:
11315 CALL_MatrixMode(ctx->Exec, (n[1].e));
11316 break;
11317 case OPCODE_MULT_MATRIX:
11318 CALL_MultMatrixf(ctx->Exec, (&n[1].f));
11319 break;
11320 case OPCODE_ORTHO:
11321 CALL_Ortho(ctx->Exec,
11322 (n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f));
11323 break;
11324 case OPCODE_PASSTHROUGH:
11325 CALL_PassThrough(ctx->Exec, (n[1].f));
11326 break;
11327 case OPCODE_PATCH_PARAMETER_I:
11328 CALL_PatchParameteri(ctx->Exec, (n[1].e, n[2].i));
11329 break;
11330 case OPCODE_PATCH_PARAMETER_FV_INNER:
11331 {
11332 GLfloat params[2];
11333 params[0] = n[2].f;
11334 params[1] = n[3].f;
11335 CALL_PatchParameterfv(ctx->Exec, (n[1].e, params));
11336 }
11337 break;
11338 case OPCODE_PATCH_PARAMETER_FV_OUTER:
11339 {
11340 GLfloat params[4];
11341 params[0] = n[2].f;
11342 params[1] = n[3].f;
11343 params[2] = n[4].f;
11344 params[3] = n[5].f;
11345 CALL_PatchParameterfv(ctx->Exec, (n[1].e, params));
11346 }
11347 break;
11348 case OPCODE_PIXEL_MAP:
11349 CALL_PixelMapfv(ctx->Exec,
11350 (n[1].e, n[2].i, get_pointer(&n[3])));
11351 break;
11352 case OPCODE_PIXEL_TRANSFER:
11353 CALL_PixelTransferf(ctx->Exec, (n[1].e, n[2].f));
11354 break;
11355 case OPCODE_PIXEL_ZOOM:
11356 CALL_PixelZoom(ctx->Exec, (n[1].f, n[2].f));
11357 break;
11358 case OPCODE_POINT_SIZE:
11359 CALL_PointSize(ctx->Exec, (n[1].f));
11360 break;
11361 case OPCODE_POINT_PARAMETERS:
11362 {
11363 GLfloat params[3];
11364 params[0] = n[2].f;
11365 params[1] = n[3].f;
11366 params[2] = n[4].f;
11367 CALL_PointParameterfv(ctx->Exec, (n[1].e, params));
11368 }
11369 break;
11370 case OPCODE_POLYGON_MODE:
11371 CALL_PolygonMode(ctx->Exec, (n[1].e, n[2].e));
11372 break;
11373 case OPCODE_POLYGON_STIPPLE:
11374 {
11375 const struct gl_pixelstore_attrib save = ctx->Unpack;
11376 ctx->Unpack = ctx->DefaultPacking;
11377 CALL_PolygonStipple(ctx->Exec, (get_pointer(&n[1])));
11378 ctx->Unpack = save; /* restore */
11379 }
11380 break;
11381 case OPCODE_POLYGON_OFFSET:
11382 CALL_PolygonOffset(ctx->Exec, (n[1].f, n[2].f));
11383 break;
11384 case OPCODE_POLYGON_OFFSET_CLAMP:
11385 CALL_PolygonOffsetClampEXT(ctx->Exec, (n[1].f, n[2].f, n[3].f));
11386 break;
11387 case OPCODE_POP_ATTRIB:
11388 CALL_PopAttrib(ctx->Exec, ());
11389 break;
11390 case OPCODE_POP_MATRIX:
11391 CALL_PopMatrix(ctx->Exec, ());
11392 break;
11393 case OPCODE_POP_NAME:
11394 CALL_PopName(ctx->Exec, ());
11395 break;
11396 case OPCODE_PRIORITIZE_TEXTURE:
11397 CALL_PrioritizeTextures(ctx->Exec, (1, &n[1].ui, &n[2].f));
11398 break;
11399 case OPCODE_PUSH_ATTRIB:
11400 CALL_PushAttrib(ctx->Exec, (n[1].bf));
11401 break;
11402 case OPCODE_PUSH_MATRIX:
11403 CALL_PushMatrix(ctx->Exec, ());
11404 break;
11405 case OPCODE_PUSH_NAME:
11406 CALL_PushName(ctx->Exec, (n[1].ui));
11407 break;
11408 case OPCODE_RASTER_POS:
11409 CALL_RasterPos4f(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
11410 break;
11411 case OPCODE_READ_BUFFER:
11412 CALL_ReadBuffer(ctx->Exec, (n[1].e));
11413 break;
11414 case OPCODE_ROTATE:
11415 CALL_Rotatef(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
11416 break;
11417 case OPCODE_SCALE:
11418 CALL_Scalef(ctx->Exec, (n[1].f, n[2].f, n[3].f));
11419 break;
11420 case OPCODE_SCISSOR:
11421 CALL_Scissor(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
11422 break;
11423 case OPCODE_SHADE_MODEL:
11424 CALL_ShadeModel(ctx->Exec, (n[1].e));
11425 break;
11426 case OPCODE_PROVOKING_VERTEX:
11427 CALL_ProvokingVertex(ctx->Exec, (n[1].e));
11428 break;
11429 case OPCODE_STENCIL_FUNC:
11430 CALL_StencilFunc(ctx->Exec, (n[1].e, n[2].i, n[3].ui));
11431 break;
11432 case OPCODE_STENCIL_MASK:
11433 CALL_StencilMask(ctx->Exec, (n[1].ui));
11434 break;
11435 case OPCODE_STENCIL_OP:
11436 CALL_StencilOp(ctx->Exec, (n[1].e, n[2].e, n[3].e));
11437 break;
11438 case OPCODE_STENCIL_FUNC_SEPARATE:
11439 CALL_StencilFuncSeparate(ctx->Exec,
11440 (n[1].e, n[2].e, n[3].i, n[4].ui));
11441 break;
11442 case OPCODE_STENCIL_MASK_SEPARATE:
11443 CALL_StencilMaskSeparate(ctx->Exec, (n[1].e, n[2].ui));
11444 break;
11445 case OPCODE_STENCIL_OP_SEPARATE:
11446 CALL_StencilOpSeparate(ctx->Exec,
11447 (n[1].e, n[2].e, n[3].e, n[4].e));
11448 break;
11449 case OPCODE_TEXENV:
11450 {
11451 GLfloat params[4];
11452 params[0] = n[3].f;
11453 params[1] = n[4].f;
11454 params[2] = n[5].f;
11455 params[3] = n[6].f;
11456 CALL_TexEnvfv(ctx->Exec, (n[1].e, n[2].e, params));
11457 }
11458 break;
11459 case OPCODE_TEXGEN:
11460 {
11461 GLfloat params[4];
11462 params[0] = n[3].f;
11463 params[1] = n[4].f;
11464 params[2] = n[5].f;
11465 params[3] = n[6].f;
11466 CALL_TexGenfv(ctx->Exec, (n[1].e, n[2].e, params));
11467 }
11468 break;
11469 case OPCODE_TEXPARAMETER:
11470 {
11471 GLfloat params[4];
11472 params[0] = n[3].f;
11473 params[1] = n[4].f;
11474 params[2] = n[5].f;
11475 params[3] = n[6].f;
11476 CALL_TexParameterfv(ctx->Exec, (n[1].e, n[2].e, params));
11477 }
11478 break;
11479 case OPCODE_TEX_IMAGE1D:
11480 {
11481 const struct gl_pixelstore_attrib save = ctx->Unpack;
11482 ctx->Unpack = ctx->DefaultPacking;
11483 CALL_TexImage1D(ctx->Exec, (n[1].e, /* target */
11484 n[2].i, /* level */
11485 n[3].i, /* components */
11486 n[4].i, /* width */
11487 n[5].e, /* border */
11488 n[6].e, /* format */
11489 n[7].e, /* type */
11490 get_pointer(&n[8])));
11491 ctx->Unpack = save; /* restore */
11492 }
11493 break;
11494 case OPCODE_TEX_IMAGE2D:
11495 {
11496 const struct gl_pixelstore_attrib save = ctx->Unpack;
11497 ctx->Unpack = ctx->DefaultPacking;
11498 CALL_TexImage2D(ctx->Exec, (n[1].e, /* target */
11499 n[2].i, /* level */
11500 n[3].i, /* components */
11501 n[4].i, /* width */
11502 n[5].i, /* height */
11503 n[6].e, /* border */
11504 n[7].e, /* format */
11505 n[8].e, /* type */
11506 get_pointer(&n[9])));
11507 ctx->Unpack = save; /* restore */
11508 }
11509 break;
11510 case OPCODE_TEX_IMAGE3D:
11511 {
11512 const struct gl_pixelstore_attrib save = ctx->Unpack;
11513 ctx->Unpack = ctx->DefaultPacking;
11514 CALL_TexImage3D(ctx->Exec, (n[1].e, /* target */
11515 n[2].i, /* level */
11516 n[3].i, /* components */
11517 n[4].i, /* width */
11518 n[5].i, /* height */
11519 n[6].i, /* depth */
11520 n[7].e, /* border */
11521 n[8].e, /* format */
11522 n[9].e, /* type */
11523 get_pointer(&n[10])));
11524 ctx->Unpack = save; /* restore */
11525 }
11526 break;
11527 case OPCODE_TEX_SUB_IMAGE1D:
11528 {
11529 const struct gl_pixelstore_attrib save = ctx->Unpack;
11530 ctx->Unpack = ctx->DefaultPacking;
11531 CALL_TexSubImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
11532 n[4].i, n[5].e,
11533 n[6].e, get_pointer(&n[7])));
11534 ctx->Unpack = save; /* restore */
11535 }
11536 break;
11537 case OPCODE_TEX_SUB_IMAGE2D:
11538 {
11539 const struct gl_pixelstore_attrib save = ctx->Unpack;
11540 ctx->Unpack = ctx->DefaultPacking;
11541 CALL_TexSubImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
11542 n[4].i, n[5].e,
11543 n[6].i, n[7].e, n[8].e,
11544 get_pointer(&n[9])));
11545 ctx->Unpack = save; /* restore */
11546 }
11547 break;
11548 case OPCODE_TEX_SUB_IMAGE3D:
11549 {
11550 const struct gl_pixelstore_attrib save = ctx->Unpack;
11551 ctx->Unpack = ctx->DefaultPacking;
11552 CALL_TexSubImage3D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
11553 n[4].i, n[5].i, n[6].i, n[7].i,
11554 n[8].i, n[9].e, n[10].e,
11555 get_pointer(&n[11])));
11556 ctx->Unpack = save; /* restore */
11557 }
11558 break;
11559 case OPCODE_TRANSLATE:
11560 CALL_Translatef(ctx->Exec, (n[1].f, n[2].f, n[3].f));
11561 break;
11562 case OPCODE_VIEWPORT:
11563 CALL_Viewport(ctx->Exec, (n[1].i, n[2].i,
11564 (GLsizei) n[3].i, (GLsizei) n[4].i));
11565 break;
11566 case OPCODE_WINDOW_POS:
11567 CALL_WindowPos4fMESA(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
11568 break;
11569 case OPCODE_VIEWPORT_ARRAY_V:
11570 CALL_ViewportArrayv(ctx->Exec, (n[1].ui, n[2].si,
11571 get_pointer(&n[3])));
11572 break;
11573 case OPCODE_VIEWPORT_INDEXED_F:
11574 CALL_ViewportIndexedf(ctx->Exec, (n[1].ui, n[2].f, n[3].f, n[4].f,
11575 n[5].f));
11576 break;
11577 case OPCODE_VIEWPORT_INDEXED_FV: {
11578 GLfloat v[4];
11579 v[0] = n[2].f;
11580 v[1] = n[3].f;
11581 v[2] = n[4].f;
11582 v[3] = n[5].f;
11583 CALL_ViewportIndexedfv(ctx->Exec, (n[1].ui, v));
11584 break;
11585 }
11586 case OPCODE_SCISSOR_ARRAY_V:
11587 CALL_ScissorArrayv(ctx->Exec, (n[1].ui, n[2].si,
11588 get_pointer(&n[3])));
11589 break;
11590 case OPCODE_SCISSOR_INDEXED:
11591 CALL_ScissorIndexed(ctx->Exec, (n[1].ui, n[2].i, n[3].i, n[4].si,
11592 n[5].si));
11593 break;
11594 case OPCODE_SCISSOR_INDEXED_V: {
11595 GLint v[4];
11596 v[0] = n[2].i;
11597 v[1] = n[3].i;
11598 v[2] = n[4].si;
11599 v[3] = n[5].si;
11600 CALL_ScissorIndexedv(ctx->Exec, (n[1].ui, v));
11601 break;
11602 }
11603 case OPCODE_DEPTH_ARRAY_V:
11604 CALL_DepthRangeArrayv(ctx->Exec, (n[1].ui, n[2].si,
11605 get_pointer(&n[3])));
11606 break;
11607 case OPCODE_DEPTH_INDEXED:
11608 CALL_DepthRangeIndexed(ctx->Exec, (n[1].ui, n[2].f, n[3].f));
11609 break;
11610 case OPCODE_ACTIVE_TEXTURE: /* GL_ARB_multitexture */
11611 CALL_ActiveTexture(ctx->Exec, (n[1].e));
11612 break;
11613 case OPCODE_COMPRESSED_TEX_IMAGE_1D: /* GL_ARB_texture_compression */
11614 CALL_CompressedTexImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].e,
11615 n[4].i, n[5].i, n[6].i,
11616 get_pointer(&n[7])));
11617 break;
11618 case OPCODE_COMPRESSED_TEX_IMAGE_2D: /* GL_ARB_texture_compression */
11619 CALL_CompressedTexImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].e,
11620 n[4].i, n[5].i, n[6].i,
11621 n[7].i, get_pointer(&n[8])));
11622 break;
11623 case OPCODE_COMPRESSED_TEX_IMAGE_3D: /* GL_ARB_texture_compression */
11624 CALL_CompressedTexImage3D(ctx->Exec, (n[1].e, n[2].i, n[3].e,
11625 n[4].i, n[5].i, n[6].i,
11626 n[7].i, n[8].i,
11627 get_pointer(&n[9])));
11628 break;
11629 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D: /* GL_ARB_texture_compress */
11630 CALL_CompressedTexSubImage1D(ctx->Exec,
11631 (n[1].e, n[2].i, n[3].i, n[4].i,
11632 n[5].e, n[6].i,
11633 get_pointer(&n[7])));
11634 break;
11635 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D: /* GL_ARB_texture_compress */
11636 CALL_CompressedTexSubImage2D(ctx->Exec,
11637 (n[1].e, n[2].i, n[3].i, n[4].i,
11638 n[5].i, n[6].i, n[7].e, n[8].i,
11639 get_pointer(&n[9])));
11640 break;
11641 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D: /* GL_ARB_texture_compress */
11642 CALL_CompressedTexSubImage3D(ctx->Exec,
11643 (n[1].e, n[2].i, n[3].i, n[4].i,
11644 n[5].i, n[6].i, n[7].i, n[8].i,
11645 n[9].e, n[10].i,
11646 get_pointer(&n[11])));
11647 break;
11648 case OPCODE_SAMPLE_COVERAGE: /* GL_ARB_multisample */
11649 CALL_SampleCoverage(ctx->Exec, (n[1].f, n[2].b));
11650 break;
11651 case OPCODE_WINDOW_POS_ARB: /* GL_ARB_window_pos */
11652 CALL_WindowPos3f(ctx->Exec, (n[1].f, n[2].f, n[3].f));
11653 break;
11654 case OPCODE_BIND_PROGRAM_ARB: /* GL_ARB_vertex_program */
11655 CALL_BindProgramARB(ctx->Exec, (n[1].e, n[2].ui));
11656 break;
11657 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB:
11658 CALL_ProgramLocalParameter4fARB(ctx->Exec,
11659 (n[1].e, n[2].ui, n[3].f, n[4].f,
11660 n[5].f, n[6].f));
11661 break;
11662 case OPCODE_ACTIVE_STENCIL_FACE_EXT:
11663 CALL_ActiveStencilFaceEXT(ctx->Exec, (n[1].e));
11664 break;
11665 case OPCODE_DEPTH_BOUNDS_EXT:
11666 CALL_DepthBoundsEXT(ctx->Exec, (n[1].f, n[2].f));
11667 break;
11668 case OPCODE_PROGRAM_STRING_ARB:
11669 CALL_ProgramStringARB(ctx->Exec,
11670 (n[1].e, n[2].e, n[3].i,
11671 get_pointer(&n[4])));
11672 break;
11673 case OPCODE_PROGRAM_ENV_PARAMETER_ARB:
11674 CALL_ProgramEnvParameter4fARB(ctx->Exec, (n[1].e, n[2].ui, n[3].f,
11675 n[4].f, n[5].f,
11676 n[6].f));
11677 break;
11678 case OPCODE_BEGIN_QUERY_ARB:
11679 CALL_BeginQuery(ctx->Exec, (n[1].e, n[2].ui));
11680 break;
11681 case OPCODE_END_QUERY_ARB:
11682 CALL_EndQuery(ctx->Exec, (n[1].e));
11683 break;
11684 case OPCODE_QUERY_COUNTER:
11685 CALL_QueryCounter(ctx->Exec, (n[1].ui, n[2].e));
11686 break;
11687 case OPCODE_BEGIN_QUERY_INDEXED:
11688 CALL_BeginQueryIndexed(ctx->Exec, (n[1].e, n[2].ui, n[3].ui));
11689 break;
11690 case OPCODE_END_QUERY_INDEXED:
11691 CALL_EndQueryIndexed(ctx->Exec, (n[1].e, n[2].ui));
11692 break;
11693 case OPCODE_DRAW_BUFFERS_ARB:
11694 {
11695 GLenum buffers[MAX_DRAW_BUFFERS];
11696 GLint i, count = MIN2(n[1].i, MAX_DRAW_BUFFERS);
11697 for (i = 0; i < count; i++)
11698 buffers[i] = n[2 + i].e;
11699 CALL_DrawBuffers(ctx->Exec, (n[1].i, buffers));
11700 }
11701 break;
11702 case OPCODE_BLIT_FRAMEBUFFER:
11703 CALL_BlitFramebuffer(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i,
11704 n[5].i, n[6].i, n[7].i, n[8].i,
11705 n[9].i, n[10].e));
11706 break;
11707 case OPCODE_PRIMITIVE_RESTART_NV:
11708 CALL_PrimitiveRestartNV(ctx->Exec, ());
11709 break;
11710
11711 case OPCODE_USE_PROGRAM:
11712 CALL_UseProgram(ctx->Exec, (n[1].ui));
11713 break;
11714 case OPCODE_UNIFORM_1F:
11715 CALL_Uniform1f(ctx->Exec, (n[1].i, n[2].f));
11716 break;
11717 case OPCODE_UNIFORM_2F:
11718 CALL_Uniform2f(ctx->Exec, (n[1].i, n[2].f, n[3].f));
11719 break;
11720 case OPCODE_UNIFORM_3F:
11721 CALL_Uniform3f(ctx->Exec, (n[1].i, n[2].f, n[3].f, n[4].f));
11722 break;
11723 case OPCODE_UNIFORM_4F:
11724 CALL_Uniform4f(ctx->Exec,
11725 (n[1].i, n[2].f, n[3].f, n[4].f, n[5].f));
11726 break;
11727 case OPCODE_UNIFORM_1FV:
11728 CALL_Uniform1fv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11729 break;
11730 case OPCODE_UNIFORM_2FV:
11731 CALL_Uniform2fv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11732 break;
11733 case OPCODE_UNIFORM_3FV:
11734 CALL_Uniform3fv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11735 break;
11736 case OPCODE_UNIFORM_4FV:
11737 CALL_Uniform4fv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11738 break;
11739 case OPCODE_UNIFORM_1D: {
11740 union float64_pair x;
11741
11742 x.uint32[0] = n[2].ui;
11743 x.uint32[1] = n[3].ui;
11744
11745 CALL_Uniform1d(ctx->Exec, (n[1].i, x.d));
11746 break;
11747 }
11748 case OPCODE_UNIFORM_2D: {
11749 union float64_pair x;
11750 union float64_pair y;
11751
11752 x.uint32[0] = n[2].ui;
11753 x.uint32[1] = n[3].ui;
11754 y.uint32[0] = n[4].ui;
11755 y.uint32[1] = n[5].ui;
11756
11757 CALL_Uniform2d(ctx->Exec, (n[1].i, x.d, y.d));
11758 break;
11759 }
11760 case OPCODE_UNIFORM_3D: {
11761 union float64_pair x;
11762 union float64_pair y;
11763 union float64_pair z;
11764
11765 x.uint32[0] = n[2].ui;
11766 x.uint32[1] = n[3].ui;
11767 y.uint32[0] = n[4].ui;
11768 y.uint32[1] = n[5].ui;
11769 z.uint32[0] = n[6].ui;
11770 z.uint32[1] = n[7].ui;
11771
11772 CALL_Uniform3d(ctx->Exec, (n[1].i, x.d, y.d, z.d));
11773 break;
11774 }
11775 case OPCODE_UNIFORM_4D: {
11776 union float64_pair x;
11777 union float64_pair y;
11778 union float64_pair z;
11779 union float64_pair w;
11780
11781 x.uint32[0] = n[2].ui;
11782 x.uint32[1] = n[3].ui;
11783 y.uint32[0] = n[4].ui;
11784 y.uint32[1] = n[5].ui;
11785 z.uint32[0] = n[6].ui;
11786 z.uint32[1] = n[7].ui;
11787 w.uint32[0] = n[8].ui;
11788 w.uint32[1] = n[9].ui;
11789
11790 CALL_Uniform4d(ctx->Exec, (n[1].i, x.d, y.d, z.d, w.d));
11791 break;
11792 }
11793 case OPCODE_UNIFORM_1DV:
11794 CALL_Uniform1dv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11795 break;
11796 case OPCODE_UNIFORM_2DV:
11797 CALL_Uniform2dv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11798 break;
11799 case OPCODE_UNIFORM_3DV:
11800 CALL_Uniform3dv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11801 break;
11802 case OPCODE_UNIFORM_4DV:
11803 CALL_Uniform4dv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11804 break;
11805 case OPCODE_UNIFORM_1I:
11806 CALL_Uniform1i(ctx->Exec, (n[1].i, n[2].i));
11807 break;
11808 case OPCODE_UNIFORM_2I:
11809 CALL_Uniform2i(ctx->Exec, (n[1].i, n[2].i, n[3].i));
11810 break;
11811 case OPCODE_UNIFORM_3I:
11812 CALL_Uniform3i(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
11813 break;
11814 case OPCODE_UNIFORM_4I:
11815 CALL_Uniform4i(ctx->Exec,
11816 (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
11817 break;
11818 case OPCODE_UNIFORM_1IV:
11819 CALL_Uniform1iv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11820 break;
11821 case OPCODE_UNIFORM_2IV:
11822 CALL_Uniform2iv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11823 break;
11824 case OPCODE_UNIFORM_3IV:
11825 CALL_Uniform3iv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11826 break;
11827 case OPCODE_UNIFORM_4IV:
11828 CALL_Uniform4iv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11829 break;
11830 case OPCODE_UNIFORM_1UI:
11831 CALL_Uniform1ui(ctx->Exec, (n[1].i, n[2].i));
11832 break;
11833 case OPCODE_UNIFORM_2UI:
11834 CALL_Uniform2ui(ctx->Exec, (n[1].i, n[2].i, n[3].i));
11835 break;
11836 case OPCODE_UNIFORM_3UI:
11837 CALL_Uniform3ui(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
11838 break;
11839 case OPCODE_UNIFORM_4UI:
11840 CALL_Uniform4ui(ctx->Exec,
11841 (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
11842 break;
11843 case OPCODE_UNIFORM_1UIV:
11844 CALL_Uniform1uiv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11845 break;
11846 case OPCODE_UNIFORM_2UIV:
11847 CALL_Uniform2uiv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11848 break;
11849 case OPCODE_UNIFORM_3UIV:
11850 CALL_Uniform3uiv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11851 break;
11852 case OPCODE_UNIFORM_4UIV:
11853 CALL_Uniform4uiv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11854 break;
11855 case OPCODE_UNIFORM_MATRIX22:
11856 CALL_UniformMatrix2fv(ctx->Exec,
11857 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11858 break;
11859 case OPCODE_UNIFORM_MATRIX33:
11860 CALL_UniformMatrix3fv(ctx->Exec,
11861 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11862 break;
11863 case OPCODE_UNIFORM_MATRIX44:
11864 CALL_UniformMatrix4fv(ctx->Exec,
11865 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11866 break;
11867 case OPCODE_UNIFORM_MATRIX23:
11868 CALL_UniformMatrix2x3fv(ctx->Exec,
11869 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11870 break;
11871 case OPCODE_UNIFORM_MATRIX32:
11872 CALL_UniformMatrix3x2fv(ctx->Exec,
11873 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11874 break;
11875 case OPCODE_UNIFORM_MATRIX24:
11876 CALL_UniformMatrix2x4fv(ctx->Exec,
11877 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11878 break;
11879 case OPCODE_UNIFORM_MATRIX42:
11880 CALL_UniformMatrix4x2fv(ctx->Exec,
11881 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11882 break;
11883 case OPCODE_UNIFORM_MATRIX34:
11884 CALL_UniformMatrix3x4fv(ctx->Exec,
11885 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11886 break;
11887 case OPCODE_UNIFORM_MATRIX43:
11888 CALL_UniformMatrix4x3fv(ctx->Exec,
11889 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11890 break;
11891 case OPCODE_UNIFORM_MATRIX22D:
11892 CALL_UniformMatrix2dv(ctx->Exec,
11893 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11894 break;
11895 case OPCODE_UNIFORM_MATRIX33D:
11896 CALL_UniformMatrix3dv(ctx->Exec,
11897 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11898 break;
11899 case OPCODE_UNIFORM_MATRIX44D:
11900 CALL_UniformMatrix4dv(ctx->Exec,
11901 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11902 break;
11903 case OPCODE_UNIFORM_MATRIX23D:
11904 CALL_UniformMatrix2x3dv(ctx->Exec,
11905 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11906 break;
11907 case OPCODE_UNIFORM_MATRIX32D:
11908 CALL_UniformMatrix3x2dv(ctx->Exec,
11909 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11910 break;
11911 case OPCODE_UNIFORM_MATRIX24D:
11912 CALL_UniformMatrix2x4dv(ctx->Exec,
11913 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11914 break;
11915 case OPCODE_UNIFORM_MATRIX42D:
11916 CALL_UniformMatrix4x2dv(ctx->Exec,
11917 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11918 break;
11919 case OPCODE_UNIFORM_MATRIX34D:
11920 CALL_UniformMatrix3x4dv(ctx->Exec,
11921 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11922 break;
11923 case OPCODE_UNIFORM_MATRIX43D:
11924 CALL_UniformMatrix4x3dv(ctx->Exec,
11925 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11926 break;
11927
11928 case OPCODE_USE_PROGRAM_STAGES:
11929 CALL_UseProgramStages(ctx->Exec, (n[1].ui, n[2].ui, n[3].ui));
11930 break;
11931 case OPCODE_PROGRAM_UNIFORM_1F:
11932 CALL_ProgramUniform1f(ctx->Exec, (n[1].ui, n[2].i, n[3].f));
11933 break;
11934 case OPCODE_PROGRAM_UNIFORM_2F:
11935 CALL_ProgramUniform2f(ctx->Exec, (n[1].ui, n[2].i, n[3].f, n[4].f));
11936 break;
11937 case OPCODE_PROGRAM_UNIFORM_3F:
11938 CALL_ProgramUniform3f(ctx->Exec, (n[1].ui, n[2].i,
11939 n[3].f, n[4].f, n[5].f));
11940 break;
11941 case OPCODE_PROGRAM_UNIFORM_4F:
11942 CALL_ProgramUniform4f(ctx->Exec, (n[1].ui, n[2].i,
11943 n[3].f, n[4].f, n[5].f, n[6].f));
11944 break;
11945 case OPCODE_PROGRAM_UNIFORM_1FV:
11946 CALL_ProgramUniform1fv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11947 get_pointer(&n[4])));
11948 break;
11949 case OPCODE_PROGRAM_UNIFORM_2FV:
11950 CALL_ProgramUniform2fv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11951 get_pointer(&n[4])));
11952 break;
11953 case OPCODE_PROGRAM_UNIFORM_3FV:
11954 CALL_ProgramUniform3fv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11955 get_pointer(&n[4])));
11956 break;
11957 case OPCODE_PROGRAM_UNIFORM_4FV:
11958 CALL_ProgramUniform4fv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11959 get_pointer(&n[4])));
11960 break;
11961 case OPCODE_PROGRAM_UNIFORM_1D: {
11962 union float64_pair x;
11963
11964 x.uint32[0] = n[3].ui;
11965 x.uint32[1] = n[4].ui;
11966
11967 CALL_ProgramUniform1d(ctx->Exec, (n[1].ui, n[2].i, x.d));
11968 break;
11969 }
11970 case OPCODE_PROGRAM_UNIFORM_2D: {
11971 union float64_pair x;
11972 union float64_pair y;
11973
11974 x.uint32[0] = n[3].ui;
11975 x.uint32[1] = n[4].ui;
11976 y.uint32[0] = n[5].ui;
11977 y.uint32[1] = n[6].ui;
11978
11979 CALL_ProgramUniform2d(ctx->Exec, (n[1].ui, n[2].i, x.d, y.d));
11980 break;
11981 }
11982 case OPCODE_PROGRAM_UNIFORM_3D: {
11983 union float64_pair x;
11984 union float64_pair y;
11985 union float64_pair z;
11986
11987 x.uint32[0] = n[3].ui;
11988 x.uint32[1] = n[4].ui;
11989 y.uint32[0] = n[5].ui;
11990 y.uint32[1] = n[6].ui;
11991 z.uint32[0] = n[7].ui;
11992 z.uint32[1] = n[8].ui;
11993
11994 CALL_ProgramUniform3d(ctx->Exec, (n[1].ui, n[2].i,
11995 x.d, y.d, z.d));
11996 break;
11997 }
11998 case OPCODE_PROGRAM_UNIFORM_4D: {
11999 union float64_pair x;
12000 union float64_pair y;
12001 union float64_pair z;
12002 union float64_pair w;
12003
12004 x.uint32[0] = n[3].ui;
12005 x.uint32[1] = n[4].ui;
12006 y.uint32[0] = n[5].ui;
12007 y.uint32[1] = n[6].ui;
12008 z.uint32[0] = n[7].ui;
12009 z.uint32[1] = n[8].ui;
12010 w.uint32[0] = n[9].ui;
12011 w.uint32[1] = n[10].ui;
12012
12013 CALL_ProgramUniform4d(ctx->Exec, (n[1].ui, n[2].i,
12014 x.d, y.d, z.d, w.d));
12015 break;
12016 }
12017 case OPCODE_PROGRAM_UNIFORM_1DV:
12018 CALL_ProgramUniform1dv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12019 get_pointer(&n[4])));
12020 break;
12021 case OPCODE_PROGRAM_UNIFORM_2DV:
12022 CALL_ProgramUniform2dv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12023 get_pointer(&n[4])));
12024 break;
12025 case OPCODE_PROGRAM_UNIFORM_3DV:
12026 CALL_ProgramUniform3dv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12027 get_pointer(&n[4])));
12028 break;
12029 case OPCODE_PROGRAM_UNIFORM_4DV:
12030 CALL_ProgramUniform4dv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12031 get_pointer(&n[4])));
12032 break;
12033 case OPCODE_PROGRAM_UNIFORM_1I:
12034 CALL_ProgramUniform1i(ctx->Exec, (n[1].ui, n[2].i, n[3].i));
12035 break;
12036 case OPCODE_PROGRAM_UNIFORM_2I:
12037 CALL_ProgramUniform2i(ctx->Exec, (n[1].ui, n[2].i, n[3].i, n[4].i));
12038 break;
12039 case OPCODE_PROGRAM_UNIFORM_3I:
12040 CALL_ProgramUniform3i(ctx->Exec, (n[1].ui, n[2].i,
12041 n[3].i, n[4].i, n[5].i));
12042 break;
12043 case OPCODE_PROGRAM_UNIFORM_4I:
12044 CALL_ProgramUniform4i(ctx->Exec, (n[1].ui, n[2].i,
12045 n[3].i, n[4].i, n[5].i, n[6].i));
12046 break;
12047 case OPCODE_PROGRAM_UNIFORM_1IV:
12048 CALL_ProgramUniform1iv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12049 get_pointer(&n[4])));
12050 break;
12051 case OPCODE_PROGRAM_UNIFORM_2IV:
12052 CALL_ProgramUniform2iv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12053 get_pointer(&n[4])));
12054 break;
12055 case OPCODE_PROGRAM_UNIFORM_3IV:
12056 CALL_ProgramUniform3iv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12057 get_pointer(&n[4])));
12058 break;
12059 case OPCODE_PROGRAM_UNIFORM_4IV:
12060 CALL_ProgramUniform4iv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12061 get_pointer(&n[4])));
12062 break;
12063 case OPCODE_PROGRAM_UNIFORM_1UI:
12064 CALL_ProgramUniform1ui(ctx->Exec, (n[1].ui, n[2].i, n[3].ui));
12065 break;
12066 case OPCODE_PROGRAM_UNIFORM_2UI:
12067 CALL_ProgramUniform2ui(ctx->Exec, (n[1].ui, n[2].i,
12068 n[3].ui, n[4].ui));
12069 break;
12070 case OPCODE_PROGRAM_UNIFORM_3UI:
12071 CALL_ProgramUniform3ui(ctx->Exec, (n[1].ui, n[2].i,
12072 n[3].ui, n[4].ui, n[5].ui));
12073 break;
12074 case OPCODE_PROGRAM_UNIFORM_4UI:
12075 CALL_ProgramUniform4ui(ctx->Exec, (n[1].ui, n[2].i,
12076 n[3].ui,
12077 n[4].ui, n[5].ui, n[6].ui));
12078 break;
12079 case OPCODE_PROGRAM_UNIFORM_1UIV:
12080 CALL_ProgramUniform1uiv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12081 get_pointer(&n[4])));
12082 break;
12083 case OPCODE_PROGRAM_UNIFORM_2UIV:
12084 CALL_ProgramUniform2uiv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12085 get_pointer(&n[4])));
12086 break;
12087 case OPCODE_PROGRAM_UNIFORM_3UIV:
12088 CALL_ProgramUniform3uiv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12089 get_pointer(&n[4])));
12090 break;
12091 case OPCODE_PROGRAM_UNIFORM_4UIV:
12092 CALL_ProgramUniform4uiv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12093 get_pointer(&n[4])));
12094 break;
12095 case OPCODE_PROGRAM_UNIFORM_MATRIX22F:
12096 CALL_ProgramUniformMatrix2fv(ctx->Exec,
12097 (n[1].ui, n[2].i, n[3].i, n[4].b,
12098 get_pointer(&n[5])));
12099 break;
12100 case OPCODE_PROGRAM_UNIFORM_MATRIX23F:
12101 CALL_ProgramUniformMatrix2x3fv(ctx->Exec,
12102 (n[1].ui, n[2].i, n[3].i, n[4].b,
12103 get_pointer(&n[5])));
12104 break;
12105 case OPCODE_PROGRAM_UNIFORM_MATRIX24F:
12106 CALL_ProgramUniformMatrix2x4fv(ctx->Exec,
12107 (n[1].ui, n[2].i, n[3].i, n[4].b,
12108 get_pointer(&n[5])));
12109 break;
12110 case OPCODE_PROGRAM_UNIFORM_MATRIX32F:
12111 CALL_ProgramUniformMatrix3x2fv(ctx->Exec,
12112 (n[1].ui, n[2].i, n[3].i, n[4].b,
12113 get_pointer(&n[5])));
12114 break;
12115 case OPCODE_PROGRAM_UNIFORM_MATRIX33F:
12116 CALL_ProgramUniformMatrix3fv(ctx->Exec,
12117 (n[1].ui, n[2].i, n[3].i, n[4].b,
12118 get_pointer(&n[5])));
12119 break;
12120 case OPCODE_PROGRAM_UNIFORM_MATRIX34F:
12121 CALL_ProgramUniformMatrix3x4fv(ctx->Exec,
12122 (n[1].ui, n[2].i, n[3].i, n[4].b,
12123 get_pointer(&n[5])));
12124 break;
12125 case OPCODE_PROGRAM_UNIFORM_MATRIX42F:
12126 CALL_ProgramUniformMatrix4x2fv(ctx->Exec,
12127 (n[1].ui, n[2].i, n[3].i, n[4].b,
12128 get_pointer(&n[5])));
12129 break;
12130 case OPCODE_PROGRAM_UNIFORM_MATRIX43F:
12131 CALL_ProgramUniformMatrix4x3fv(ctx->Exec,
12132 (n[1].ui, n[2].i, n[3].i, n[4].b,
12133 get_pointer(&n[5])));
12134 break;
12135 case OPCODE_PROGRAM_UNIFORM_MATRIX44F:
12136 CALL_ProgramUniformMatrix4fv(ctx->Exec,
12137 (n[1].ui, n[2].i, n[3].i, n[4].b,
12138 get_pointer(&n[5])));
12139 break;
12140 case OPCODE_PROGRAM_UNIFORM_MATRIX22D:
12141 CALL_ProgramUniformMatrix2dv(ctx->Exec,
12142 (n[1].ui, n[2].i, n[3].i, n[4].b,
12143 get_pointer(&n[5])));
12144 break;
12145 case OPCODE_PROGRAM_UNIFORM_MATRIX23D:
12146 CALL_ProgramUniformMatrix2x3dv(ctx->Exec,
12147 (n[1].ui, n[2].i, n[3].i, n[4].b,
12148 get_pointer(&n[5])));
12149 break;
12150 case OPCODE_PROGRAM_UNIFORM_MATRIX24D:
12151 CALL_ProgramUniformMatrix2x4dv(ctx->Exec,
12152 (n[1].ui, n[2].i, n[3].i, n[4].b,
12153 get_pointer(&n[5])));
12154 break;
12155 case OPCODE_PROGRAM_UNIFORM_MATRIX32D:
12156 CALL_ProgramUniformMatrix3x2dv(ctx->Exec,
12157 (n[1].ui, n[2].i, n[3].i, n[4].b,
12158 get_pointer(&n[5])));
12159 break;
12160 case OPCODE_PROGRAM_UNIFORM_MATRIX33D:
12161 CALL_ProgramUniformMatrix3dv(ctx->Exec,
12162 (n[1].ui, n[2].i, n[3].i, n[4].b,
12163 get_pointer(&n[5])));
12164 break;
12165 case OPCODE_PROGRAM_UNIFORM_MATRIX34D:
12166 CALL_ProgramUniformMatrix3x4dv(ctx->Exec,
12167 (n[1].ui, n[2].i, n[3].i, n[4].b,
12168 get_pointer(&n[5])));
12169 break;
12170 case OPCODE_PROGRAM_UNIFORM_MATRIX42D:
12171 CALL_ProgramUniformMatrix4x2dv(ctx->Exec,
12172 (n[1].ui, n[2].i, n[3].i, n[4].b,
12173 get_pointer(&n[5])));
12174 break;
12175 case OPCODE_PROGRAM_UNIFORM_MATRIX43D:
12176 CALL_ProgramUniformMatrix4x3dv(ctx->Exec,
12177 (n[1].ui, n[2].i, n[3].i, n[4].b,
12178 get_pointer(&n[5])));
12179 break;
12180 case OPCODE_PROGRAM_UNIFORM_MATRIX44D:
12181 CALL_ProgramUniformMatrix4dv(ctx->Exec,
12182 (n[1].ui, n[2].i, n[3].i, n[4].b,
12183 get_pointer(&n[5])));
12184 break;
12185
12186 case OPCODE_CLIP_CONTROL:
12187 CALL_ClipControl(ctx->Exec, (n[1].e, n[2].e));
12188 break;
12189
12190 case OPCODE_CLAMP_COLOR:
12191 CALL_ClampColor(ctx->Exec, (n[1].e, n[2].e));
12192 break;
12193
12194 case OPCODE_BIND_FRAGMENT_SHADER_ATI:
12195 CALL_BindFragmentShaderATI(ctx->Exec, (n[1].i));
12196 break;
12197 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI:
12198 CALL_SetFragmentShaderConstantATI(ctx->Exec, (n[1].ui, &n[2].f));
12199 break;
12200 case OPCODE_ATTR_1F_NV:
12201 CALL_VertexAttrib1fNV(ctx->Exec, (n[1].e, n[2].f));
12202 break;
12203 case OPCODE_ATTR_2F_NV:
12204 CALL_VertexAttrib2fvNV(ctx->Exec, (n[1].e, &n[2].f));
12205 break;
12206 case OPCODE_ATTR_3F_NV:
12207 CALL_VertexAttrib3fvNV(ctx->Exec, (n[1].e, &n[2].f));
12208 break;
12209 case OPCODE_ATTR_4F_NV:
12210 CALL_VertexAttrib4fvNV(ctx->Exec, (n[1].e, &n[2].f));
12211 break;
12212 case OPCODE_ATTR_1F_ARB:
12213 CALL_VertexAttrib1fARB(ctx->Exec, (n[1].e, n[2].f));
12214 break;
12215 case OPCODE_ATTR_2F_ARB:
12216 CALL_VertexAttrib2fvARB(ctx->Exec, (n[1].e, &n[2].f));
12217 break;
12218 case OPCODE_ATTR_3F_ARB:
12219 CALL_VertexAttrib3fvARB(ctx->Exec, (n[1].e, &n[2].f));
12220 break;
12221 case OPCODE_ATTR_4F_ARB:
12222 CALL_VertexAttrib4fvARB(ctx->Exec, (n[1].e, &n[2].f));
12223 break;
12224 case OPCODE_ATTR_1D: {
12225 GLdouble *d = (GLdouble *) &n[2];
12226 CALL_VertexAttribL1d(ctx->Exec, (n[1].ui, *d));
12227 break;
12228 }
12229 case OPCODE_ATTR_2D: {
12230 GLdouble *d = (GLdouble *) &n[2];
12231 CALL_VertexAttribL2dv(ctx->Exec, (n[1].ui, d));
12232 break;
12233 }
12234 case OPCODE_ATTR_3D: {
12235 GLdouble *d = (GLdouble *) &n[2];
12236 CALL_VertexAttribL3dv(ctx->Exec, (n[1].ui, d));
12237 break;
12238 }
12239 case OPCODE_ATTR_4D: {
12240 GLdouble *d = (GLdouble *) &n[2];
12241 CALL_VertexAttribL4dv(ctx->Exec, (n[1].ui, d));
12242 break;
12243 }
12244 case OPCODE_MATERIAL:
12245 CALL_Materialfv(ctx->Exec, (n[1].e, n[2].e, &n[3].f));
12246 break;
12247 case OPCODE_BEGIN:
12248 CALL_Begin(ctx->Exec, (n[1].e));
12249 break;
12250 case OPCODE_END:
12251 CALL_End(ctx->Exec, ());
12252 break;
12253 case OPCODE_RECTF:
12254 CALL_Rectf(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
12255 break;
12256 case OPCODE_EVAL_C1:
12257 CALL_EvalCoord1f(ctx->Exec, (n[1].f));
12258 break;
12259 case OPCODE_EVAL_C2:
12260 CALL_EvalCoord2f(ctx->Exec, (n[1].f, n[2].f));
12261 break;
12262 case OPCODE_EVAL_P1:
12263 CALL_EvalPoint1(ctx->Exec, (n[1].i));
12264 break;
12265 case OPCODE_EVAL_P2:
12266 CALL_EvalPoint2(ctx->Exec, (n[1].i, n[2].i));
12267 break;
12268
12269 /* GL_EXT_texture_integer */
12270 case OPCODE_CLEARCOLOR_I:
12271 CALL_ClearColorIiEXT(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
12272 break;
12273 case OPCODE_CLEARCOLOR_UI:
12274 CALL_ClearColorIuiEXT(ctx->Exec,
12275 (n[1].ui, n[2].ui, n[3].ui, n[4].ui));
12276 break;
12277 case OPCODE_TEXPARAMETER_I:
12278 {
12279 GLint params[4];
12280 params[0] = n[3].i;
12281 params[1] = n[4].i;
12282 params[2] = n[5].i;
12283 params[3] = n[6].i;
12284 CALL_TexParameterIiv(ctx->Exec, (n[1].e, n[2].e, params));
12285 }
12286 break;
12287 case OPCODE_TEXPARAMETER_UI:
12288 {
12289 GLuint params[4];
12290 params[0] = n[3].ui;
12291 params[1] = n[4].ui;
12292 params[2] = n[5].ui;
12293 params[3] = n[6].ui;
12294 CALL_TexParameterIuiv(ctx->Exec, (n[1].e, n[2].e, params));
12295 }
12296 break;
12297
12298 case OPCODE_VERTEX_ATTRIB_DIVISOR:
12299 /* GL_ARB_instanced_arrays */
12300 CALL_VertexAttribDivisor(ctx->Exec, (n[1].ui, n[2].ui));
12301 break;
12302
12303 case OPCODE_TEXTURE_BARRIER_NV:
12304 CALL_TextureBarrierNV(ctx->Exec, ());
12305 break;
12306
12307 /* GL_EXT/ARB_transform_feedback */
12308 case OPCODE_BEGIN_TRANSFORM_FEEDBACK:
12309 CALL_BeginTransformFeedback(ctx->Exec, (n[1].e));
12310 break;
12311 case OPCODE_END_TRANSFORM_FEEDBACK:
12312 CALL_EndTransformFeedback(ctx->Exec, ());
12313 break;
12314 case OPCODE_BIND_TRANSFORM_FEEDBACK:
12315 CALL_BindTransformFeedback(ctx->Exec, (n[1].e, n[2].ui));
12316 break;
12317 case OPCODE_PAUSE_TRANSFORM_FEEDBACK:
12318 CALL_PauseTransformFeedback(ctx->Exec, ());
12319 break;
12320 case OPCODE_RESUME_TRANSFORM_FEEDBACK:
12321 CALL_ResumeTransformFeedback(ctx->Exec, ());
12322 break;
12323 case OPCODE_DRAW_TRANSFORM_FEEDBACK:
12324 CALL_DrawTransformFeedback(ctx->Exec, (n[1].e, n[2].ui));
12325 break;
12326 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM:
12327 CALL_DrawTransformFeedbackStream(ctx->Exec,
12328 (n[1].e, n[2].ui, n[3].ui));
12329 break;
12330 case OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED:
12331 CALL_DrawTransformFeedbackInstanced(ctx->Exec,
12332 (n[1].e, n[2].ui, n[3].si));
12333 break;
12334 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED:
12335 CALL_DrawTransformFeedbackStreamInstanced(ctx->Exec,
12336 (n[1].e, n[2].ui, n[3].ui, n[4].si));
12337 break;
12338
12339
12340 case OPCODE_BIND_SAMPLER:
12341 CALL_BindSampler(ctx->Exec, (n[1].ui, n[2].ui));
12342 break;
12343 case OPCODE_SAMPLER_PARAMETERIV:
12344 {
12345 GLint params[4];
12346 params[0] = n[3].i;
12347 params[1] = n[4].i;
12348 params[2] = n[5].i;
12349 params[3] = n[6].i;
12350 CALL_SamplerParameteriv(ctx->Exec, (n[1].ui, n[2].e, params));
12351 }
12352 break;
12353 case OPCODE_SAMPLER_PARAMETERFV:
12354 {
12355 GLfloat params[4];
12356 params[0] = n[3].f;
12357 params[1] = n[4].f;
12358 params[2] = n[5].f;
12359 params[3] = n[6].f;
12360 CALL_SamplerParameterfv(ctx->Exec, (n[1].ui, n[2].e, params));
12361 }
12362 break;
12363 case OPCODE_SAMPLER_PARAMETERIIV:
12364 {
12365 GLint params[4];
12366 params[0] = n[3].i;
12367 params[1] = n[4].i;
12368 params[2] = n[5].i;
12369 params[3] = n[6].i;
12370 CALL_SamplerParameterIiv(ctx->Exec, (n[1].ui, n[2].e, params));
12371 }
12372 break;
12373 case OPCODE_SAMPLER_PARAMETERUIV:
12374 {
12375 GLuint params[4];
12376 params[0] = n[3].ui;
12377 params[1] = n[4].ui;
12378 params[2] = n[5].ui;
12379 params[3] = n[6].ui;
12380 CALL_SamplerParameterIuiv(ctx->Exec, (n[1].ui, n[2].e, params));
12381 }
12382 break;
12383
12384 /* ARB_compute_shader */
12385 case OPCODE_DISPATCH_COMPUTE:
12386 CALL_DispatchCompute(ctx->Exec, (n[1].ui, n[2].ui, n[3].ui));
12387 break;
12388
12389 /* GL_ARB_sync */
12390 case OPCODE_WAIT_SYNC:
12391 {
12392 union uint64_pair p;
12393 p.uint32[0] = n[2].ui;
12394 p.uint32[1] = n[3].ui;
12395 CALL_WaitSync(ctx->Exec,
12396 (get_pointer(&n[4]), n[1].bf, p.uint64));
12397 }
12398 break;
12399
12400 /* GL_NV_conditional_render */
12401 case OPCODE_BEGIN_CONDITIONAL_RENDER:
12402 CALL_BeginConditionalRender(ctx->Exec, (n[1].i, n[2].e));
12403 break;
12404 case OPCODE_END_CONDITIONAL_RENDER:
12405 CALL_EndConditionalRender(ctx->Exec, ());
12406 break;
12407
12408 case OPCODE_UNIFORM_BLOCK_BINDING:
12409 CALL_UniformBlockBinding(ctx->Exec, (n[1].ui, n[2].ui, n[3].ui));
12410 break;
12411
12412 case OPCODE_UNIFORM_SUBROUTINES:
12413 CALL_UniformSubroutinesuiv(ctx->Exec, (n[1].e, n[2].si,
12414 get_pointer(&n[3])));
12415 break;
12416
12417 /* GL_EXT_window_rectangles */
12418 case OPCODE_WINDOW_RECTANGLES:
12419 CALL_WindowRectanglesEXT(
12420 ctx->Exec, (n[1].e, n[2].si, get_pointer(&n[3])));
12421 break;
12422
12423 /* GL_NV_conservative_raster */
12424 case OPCODE_SUBPIXEL_PRECISION_BIAS:
12425 CALL_SubpixelPrecisionBiasNV(ctx->Exec, (n[1].ui, n[2].ui));
12426 break;
12427
12428 /* GL_NV_conservative_raster_dilate */
12429 case OPCODE_CONSERVATIVE_RASTER_PARAMETER_F:
12430 CALL_ConservativeRasterParameterfNV(ctx->Exec, (n[1].e, n[2].f));
12431 break;
12432
12433 /* GL_NV_conservative_raster_pre_snap_triangles */
12434 case OPCODE_CONSERVATIVE_RASTER_PARAMETER_I:
12435 CALL_ConservativeRasterParameteriNV(ctx->Exec, (n[1].e, n[2].i));
12436 break;
12437
12438 /* GL_EXT_direct_state_access */
12439 case OPCODE_MATRIX_LOAD:
12440 CALL_MatrixLoadfEXT(ctx->Exec, (n[1].e, &n[2].f));
12441 break;
12442 case OPCODE_MATRIX_MULT:
12443 CALL_MatrixMultfEXT(ctx->Exec, (n[1].e, &n[2].f));
12444 break;
12445 case OPCODE_MATRIX_ROTATE:
12446 CALL_MatrixRotatefEXT(ctx->Exec, (n[1].e, n[2].f, n[3].f, n[4].f, n[5].f));
12447 break;
12448 case OPCODE_MATRIX_SCALE:
12449 CALL_MatrixScalefEXT(ctx->Exec, (n[1].e, n[2].f, n[3].f, n[4].f));
12450 break;
12451 case OPCODE_MATRIX_TRANSLATE:
12452 CALL_MatrixTranslatefEXT(ctx->Exec, (n[1].e, n[2].f, n[3].f, n[4].f));
12453 break;
12454 case OPCODE_MATRIX_LOAD_IDENTITY:
12455 CALL_MatrixLoadIdentityEXT(ctx->Exec, (n[1].e));
12456 break;
12457 case OPCODE_MATRIX_ORTHO:
12458 CALL_MatrixOrthoEXT(ctx->Exec, (n[1].e,
12459 n[2].f, n[3].f, n[4].f,
12460 n[5].f, n[6].f, n[7].f));
12461 break;
12462 case OPCODE_MATRIX_FRUSTUM:
12463 CALL_MatrixFrustumEXT(ctx->Exec, (n[1].e,
12464 n[2].f, n[3].f, n[4].f,
12465 n[5].f, n[6].f, n[7].f));
12466 break;
12467 case OPCODE_MATRIX_PUSH:
12468 CALL_MatrixPushEXT(ctx->Exec, (n[1].e));
12469 break;
12470 case OPCODE_MATRIX_POP:
12471 CALL_MatrixPopEXT(ctx->Exec, (n[1].e));
12472 break;
12473 case OPCODE_TEXTUREPARAMETER_F:
12474 {
12475 GLfloat params[4];
12476 params[0] = n[4].f;
12477 params[1] = n[5].f;
12478 params[2] = n[6].f;
12479 params[3] = n[7].f;
12480 CALL_TextureParameterfvEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].e, params));
12481 }
12482 break;
12483 case OPCODE_TEXTUREPARAMETER_I:
12484 {
12485 GLint params[4];
12486 params[0] = n[4].i;
12487 params[1] = n[5].i;
12488 params[2] = n[6].i;
12489 params[3] = n[7].i;
12490 CALL_TextureParameterivEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].e, params));
12491 }
12492 break;
12493 case OPCODE_TEXTURE_IMAGE1D:
12494 {
12495 const struct gl_pixelstore_attrib save = ctx->Unpack;
12496 ctx->Unpack = ctx->DefaultPacking;
12497 CALL_TextureImage1DEXT(ctx->Exec, (n[1].ui, /* texture */
12498 n[2].e, /* target */
12499 n[3].i, /* level */
12500 n[4].i, /* components */
12501 n[5].i, /* width */
12502 n[6].e, /* border */
12503 n[7].e, /* format */
12504 n[8].e, /* type */
12505 get_pointer(&n[9])));
12506 ctx->Unpack = save; /* restore */
12507 }
12508 break;
12509 case OPCODE_TEXTURE_IMAGE2D:
12510 {
12511 const struct gl_pixelstore_attrib save = ctx->Unpack;
12512 ctx->Unpack = ctx->DefaultPacking;
12513 CALL_TextureImage2DEXT(ctx->Exec, (n[1].ui, /* texture */
12514 n[2].e, /* target */
12515 n[3].i, /* level */
12516 n[4].i, /* components */
12517 n[5].i, /* width */
12518 n[6].i, /* height */
12519 n[7].e, /* border */
12520 n[8].e, /* format */
12521 n[9].e, /* type */
12522 get_pointer(&n[10])));
12523 ctx->Unpack = save; /* restore */
12524 }
12525 break;
12526 case OPCODE_TEXTURE_IMAGE3D:
12527 {
12528 const struct gl_pixelstore_attrib save = ctx->Unpack;
12529 ctx->Unpack = ctx->DefaultPacking;
12530 CALL_TextureImage3DEXT(ctx->Exec, (n[1].ui, /* texture */
12531 n[2].e, /* target */
12532 n[3].i, /* level */
12533 n[4].i, /* components */
12534 n[5].i, /* width */
12535 n[6].i, /* height */
12536 n[7].i, /* depth */
12537 n[8].e, /* border */
12538 n[9].e, /* format */
12539 n[10].e, /* type */
12540 get_pointer(&n[11])));
12541 ctx->Unpack = save; /* restore */
12542 }
12543 break;
12544 case OPCODE_TEXTURE_SUB_IMAGE1D:
12545 {
12546 const struct gl_pixelstore_attrib save = ctx->Unpack;
12547 ctx->Unpack = ctx->DefaultPacking;
12548 CALL_TextureSubImage1DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
12549 n[4].i, n[5].i, n[6].e,
12550 n[7].e, get_pointer(&n[8])));
12551 ctx->Unpack = save; /* restore */
12552 }
12553 break;
12554 case OPCODE_TEXTURE_SUB_IMAGE2D:
12555 {
12556 const struct gl_pixelstore_attrib save = ctx->Unpack;
12557 ctx->Unpack = ctx->DefaultPacking;
12558 CALL_TextureSubImage2DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
12559 n[4].i, n[5].i, n[6].e,
12560 n[7].i, n[8].e, n[9].e,
12561 get_pointer(&n[10])));
12562 ctx->Unpack = save;
12563 }
12564 break;
12565 case OPCODE_TEXTURE_SUB_IMAGE3D:
12566 {
12567 const struct gl_pixelstore_attrib save = ctx->Unpack;
12568 ctx->Unpack = ctx->DefaultPacking;
12569 CALL_TextureSubImage3DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
12570 n[4].i, n[5].i, n[6].i,
12571 n[7].i, n[8].i, n[9].i,
12572 n[10].e, n[11].e,
12573 get_pointer(&n[12])));
12574 ctx->Unpack = save; /* restore */
12575 }
12576 break;
12577 case OPCODE_COPY_TEXTURE_IMAGE1D:
12578 CALL_CopyTextureImage1DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
12579 n[4].e, n[5].i, n[6].i,
12580 n[7].i, n[8].i));
12581 break;
12582 case OPCODE_COPY_TEXTURE_IMAGE2D:
12583 CALL_CopyTextureImage2DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
12584 n[4].e, n[5].i, n[6].i,
12585 n[7].i, n[8].i, n[9].i));
12586 break;
12587 case OPCODE_COPY_TEXTURE_SUB_IMAGE1D:
12588 CALL_CopyTextureSubImage1DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
12589 n[4].i, n[5].i, n[6].i,
12590 n[7].i));
12591 break;
12592 case OPCODE_COPY_TEXTURE_SUB_IMAGE2D:
12593 CALL_CopyTextureSubImage2DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
12594 n[4].i, n[5].i, n[6].i,
12595 n[7].i, n[8].i, n[9].i));
12596 break;
12597 case OPCODE_COPY_TEXTURE_SUB_IMAGE3D:
12598 CALL_CopyTextureSubImage3DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
12599 n[4].i, n[5].i, n[6].i,
12600 n[7].i, n[8].i, n[9].i,
12601 n[10].i));
12602 break;
12603 case OPCODE_BIND_MULTITEXTURE:
12604 CALL_BindMultiTextureEXT(ctx->Exec, (n[1].e, n[2].e, n[3].ui));
12605 break;
12606 case OPCODE_MULTITEXPARAMETER_F:
12607 {
12608 GLfloat params[4];
12609 params[0] = n[4].f;
12610 params[1] = n[5].f;
12611 params[2] = n[6].f;
12612 params[3] = n[7].f;
12613 CALL_MultiTexParameterfvEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, params));
12614 }
12615 break;
12616 case OPCODE_MULTITEXPARAMETER_I:
12617 {
12618 GLint params[4];
12619 params[0] = n[4].i;
12620 params[1] = n[5].i;
12621 params[2] = n[6].i;
12622 params[3] = n[7].i;
12623 CALL_MultiTexParameterivEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, params));
12624 }
12625 break;
12626 case OPCODE_MULTITEX_IMAGE1D:
12627 {
12628 const struct gl_pixelstore_attrib save = ctx->Unpack;
12629 ctx->Unpack = ctx->DefaultPacking;
12630 CALL_MultiTexImage1DEXT(ctx->Exec, (n[1].e, /* texture */
12631 n[2].e, /* target */
12632 n[3].i, /* level */
12633 n[4].i, /* components */
12634 n[5].i, /* width */
12635 n[6].e, /* border */
12636 n[7].e, /* format */
12637 n[8].e, /* type */
12638 get_pointer(&n[9])));
12639 ctx->Unpack = save; /* restore */
12640 }
12641 break;
12642 case OPCODE_MULTITEX_IMAGE2D:
12643 {
12644 const struct gl_pixelstore_attrib save = ctx->Unpack;
12645 ctx->Unpack = ctx->DefaultPacking;
12646 CALL_MultiTexImage2DEXT(ctx->Exec, (n[1].e, /* texture */
12647 n[2].e, /* target */
12648 n[3].i, /* level */
12649 n[4].i, /* components */
12650 n[5].i, /* width */
12651 n[6].i, /* height */
12652 n[7].e, /* border */
12653 n[8].e, /* format */
12654 n[9].e, /* type */
12655 get_pointer(&n[10])));
12656 ctx->Unpack = save; /* restore */
12657 }
12658 break;
12659 case OPCODE_MULTITEX_IMAGE3D:
12660 {
12661 const struct gl_pixelstore_attrib save = ctx->Unpack;
12662 ctx->Unpack = ctx->DefaultPacking;
12663 CALL_MultiTexImage3DEXT(ctx->Exec, (n[1].e, /* texture */
12664 n[2].e, /* target */
12665 n[3].i, /* level */
12666 n[4].i, /* components */
12667 n[5].i, /* width */
12668 n[6].i, /* height */
12669 n[7].i, /* depth */
12670 n[8].e, /* border */
12671 n[9].e, /* format */
12672 n[10].e, /* type */
12673 get_pointer(&n[11])));
12674 ctx->Unpack = save; /* restore */
12675 }
12676 break;
12677 case OPCODE_MULTITEX_SUB_IMAGE1D:
12678 {
12679 const struct gl_pixelstore_attrib save = ctx->Unpack;
12680 ctx->Unpack = ctx->DefaultPacking;
12681 CALL_MultiTexSubImage1DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
12682 n[4].i, n[5].i, n[6].e,
12683 n[7].e, get_pointer(&n[8])));
12684 ctx->Unpack = save; /* restore */
12685 }
12686 break;
12687 case OPCODE_MULTITEX_SUB_IMAGE2D:
12688 {
12689 const struct gl_pixelstore_attrib save = ctx->Unpack;
12690 ctx->Unpack = ctx->DefaultPacking;
12691 CALL_MultiTexSubImage2DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
12692 n[4].i, n[5].i, n[6].e,
12693 n[7].i, n[8].e, n[9].e,
12694 get_pointer(&n[10])));
12695 ctx->Unpack = save; /* restore */
12696 }
12697 break;
12698 case OPCODE_MULTITEX_SUB_IMAGE3D:
12699 {
12700 const struct gl_pixelstore_attrib save = ctx->Unpack;
12701 ctx->Unpack = ctx->DefaultPacking;
12702 CALL_MultiTexSubImage3DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
12703 n[4].i, n[5].i, n[6].i,
12704 n[7].i, n[8].i, n[9].i,
12705 n[10].e, n[11].e,
12706 get_pointer(&n[12])));
12707 ctx->Unpack = save; /* restore */
12708 }
12709 break;
12710 case OPCODE_COPY_MULTITEX_IMAGE1D:
12711 CALL_CopyMultiTexImage1DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
12712 n[4].e, n[5].i, n[6].i,
12713 n[7].i, n[8].i));
12714 break;
12715 case OPCODE_COPY_MULTITEX_IMAGE2D:
12716 CALL_CopyMultiTexImage2DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
12717 n[4].e, n[5].i, n[6].i,
12718 n[7].i, n[8].i, n[9].i));
12719 break;
12720 case OPCODE_COPY_MULTITEX_SUB_IMAGE1D:
12721 CALL_CopyMultiTexSubImage1DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
12722 n[4].i, n[5].i, n[6].i,
12723 n[7].i));
12724 break;
12725 case OPCODE_COPY_MULTITEX_SUB_IMAGE2D:
12726 CALL_CopyMultiTexSubImage2DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
12727 n[4].i, n[5].i, n[6].i,
12728 n[7].i, n[8].i, n[9].i));
12729 break;
12730 case OPCODE_COPY_MULTITEX_SUB_IMAGE3D:
12731 CALL_CopyMultiTexSubImage3DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
12732 n[4].i, n[5].i, n[6].i,
12733 n[7].i, n[8].i, n[9].i,
12734 n[10].i));
12735 break;
12736 case OPCODE_MULTITEXENV:
12737 {
12738 GLfloat params[4];
12739 params[0] = n[4].f;
12740 params[1] = n[5].f;
12741 params[2] = n[6].f;
12742 params[3] = n[7].f;
12743 CALL_MultiTexEnvfvEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, params));
12744 }
12745 break;
12746 case OPCODE_COMPRESSED_TEXTURE_IMAGE_1D:
12747 CALL_CompressedTextureImage1DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
12748 n[4].e, n[5].i, n[6].i,
12749 n[7].i, get_pointer(&n[8])));
12750 break;
12751 case OPCODE_COMPRESSED_TEXTURE_IMAGE_2D:
12752 CALL_CompressedTextureImage2DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
12753 n[4].e, n[5].i, n[6].i,
12754 n[7].i, n[8].i,
12755 get_pointer(&n[9])));
12756 break;
12757 case OPCODE_COMPRESSED_TEXTURE_IMAGE_3D:
12758 CALL_CompressedTextureImage3DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
12759 n[4].e, n[5].i, n[6].i,
12760 n[7].i, n[8].i, n[9].i,
12761 get_pointer(&n[10])));
12762 break;
12763 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_1D:
12764 CALL_CompressedTextureSubImage1DEXT(ctx->Exec,
12765 (n[1].ui, n[2].e, n[3].i, n[4].i,
12766 n[5].i, n[6].e, n[7].i,
12767 get_pointer(&n[8])));
12768 break;
12769 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_2D:
12770 CALL_CompressedTextureSubImage2DEXT(ctx->Exec,
12771 (n[1].ui, n[2].e, n[3].i, n[4].i,
12772 n[5].i, n[6].i, n[7].i, n[8].e,
12773 n[9].i, get_pointer(&n[10])));
12774 break;
12775 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_3D:
12776 CALL_CompressedTextureSubImage3DEXT(ctx->Exec,
12777 (n[1].ui, n[2].e, n[3].i, n[4].i,
12778 n[5].i, n[6].i, n[7].i, n[8].i,
12779 n[9].i, n[10].e, n[11].i,
12780 get_pointer(&n[12])));
12781 break;
12782 case OPCODE_COMPRESSED_MULTITEX_IMAGE_1D:
12783 CALL_CompressedMultiTexImage1DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
12784 n[4].e, n[5].i, n[6].i,
12785 n[7].i, get_pointer(&n[8])));
12786 break;
12787 case OPCODE_COMPRESSED_MULTITEX_IMAGE_2D:
12788 CALL_CompressedMultiTexImage2DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
12789 n[4].e, n[5].i, n[6].i,
12790 n[7].i, n[8].i,
12791 get_pointer(&n[9])));
12792 break;
12793 case OPCODE_COMPRESSED_MULTITEX_IMAGE_3D:
12794 CALL_CompressedMultiTexImage3DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
12795 n[4].e, n[5].i, n[6].i,
12796 n[7].i, n[8].i, n[9].i,
12797 get_pointer(&n[10])));
12798 break;
12799 case OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_1D:
12800 CALL_CompressedMultiTexSubImage1DEXT(ctx->Exec,
12801 (n[1].e, n[2].e, n[3].i, n[4].i,
12802 n[5].i, n[6].e, n[7].i,
12803 get_pointer(&n[8])));
12804 break;
12805 case OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_2D:
12806 CALL_CompressedMultiTexSubImage2DEXT(ctx->Exec,
12807 (n[1].e, n[2].e, n[3].i, n[4].i,
12808 n[5].i, n[6].i, n[7].i, n[8].e,
12809 n[9].i, get_pointer(&n[10])));
12810 break;
12811 case OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_3D:
12812 CALL_CompressedMultiTexSubImage3DEXT(ctx->Exec,
12813 (n[1].e, n[2].e, n[3].i, n[4].i,
12814 n[5].i, n[6].i, n[7].i, n[8].i,
12815 n[9].i, n[10].e, n[11].i,
12816 get_pointer(&n[12])));
12817 break;
12818
12819 case OPCODE_CONTINUE:
12820 n = (Node *) get_pointer(&n[1]);
12821 break;
12822 case OPCODE_NOP:
12823 /* no-op */
12824 break;
12825 case OPCODE_END_OF_LIST:
12826 done = GL_TRUE;
12827 break;
12828 default:
12829 {
12830 char msg[1000];
12831 _mesa_snprintf(msg, sizeof(msg), "Error in execute_list: opcode=%d",
12832 (int) opcode);
12833 _mesa_problem(ctx, "%s", msg);
12834 }
12835 done = GL_TRUE;
12836 }
12837
12838 /* increment n to point to next compiled command */
12839 if (opcode != OPCODE_CONTINUE) {
12840 assert(InstSize[opcode] > 0);
12841 n += InstSize[opcode];
12842 }
12843 }
12844 }
12845
12846 vbo_save_EndCallList(ctx);
12847
12848 ctx->ListState.CallDepth--;
12849 }
12850
12851
12852
12853 /**********************************************************************/
12854 /* GL functions */
12855 /**********************************************************************/
12856
12857 /**
12858 * Test if a display list number is valid.
12859 */
12860 GLboolean GLAPIENTRY
12861 _mesa_IsList(GLuint list)
12862 {
12863 GET_CURRENT_CONTEXT(ctx);
12864 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
12865 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
12866 return islist(ctx, list);
12867 }
12868
12869
12870 /**
12871 * Delete a sequence of consecutive display lists.
12872 */
12873 void GLAPIENTRY
12874 _mesa_DeleteLists(GLuint list, GLsizei range)
12875 {
12876 GET_CURRENT_CONTEXT(ctx);
12877 GLuint i;
12878 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
12879 ASSERT_OUTSIDE_BEGIN_END(ctx);
12880
12881 if (range < 0) {
12882 _mesa_error(ctx, GL_INVALID_VALUE, "glDeleteLists");
12883 return;
12884 }
12885
12886 if (range > 1) {
12887 /* We may be deleting a set of bitmap lists. See if there's a
12888 * bitmap atlas to free.
12889 */
12890 struct gl_bitmap_atlas *atlas = lookup_bitmap_atlas(ctx, list);
12891 if (atlas) {
12892 _mesa_delete_bitmap_atlas(ctx, atlas);
12893 _mesa_HashRemove(ctx->Shared->BitmapAtlas, list);
12894 }
12895 }
12896
12897 for (i = list; i < list + range; i++) {
12898 destroy_list(ctx, i);
12899 }
12900 }
12901
12902
12903 /**
12904 * Return a display list number, n, such that lists n through n+range-1
12905 * are free.
12906 */
12907 GLuint GLAPIENTRY
12908 _mesa_GenLists(GLsizei range)
12909 {
12910 GET_CURRENT_CONTEXT(ctx);
12911 GLuint base;
12912 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
12913 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
12914
12915 if (range < 0) {
12916 _mesa_error(ctx, GL_INVALID_VALUE, "glGenLists");
12917 return 0;
12918 }
12919 if (range == 0) {
12920 return 0;
12921 }
12922
12923 /*
12924 * Make this an atomic operation
12925 */
12926 _mesa_HashLockMutex(ctx->Shared->DisplayList);
12927
12928 base = _mesa_HashFindFreeKeyBlock(ctx->Shared->DisplayList, range);
12929 if (base) {
12930 /* reserve the list IDs by with empty/dummy lists */
12931 GLint i;
12932 for (i = 0; i < range; i++) {
12933 _mesa_HashInsertLocked(ctx->Shared->DisplayList, base + i,
12934 make_list(base + i, 1));
12935 }
12936 }
12937
12938 if (USE_BITMAP_ATLAS &&
12939 range > 16 &&
12940 ctx->Driver.DrawAtlasBitmaps) {
12941 /* "range > 16" is a rough heuristic to guess when glGenLists might be
12942 * used to allocate display lists for glXUseXFont or wglUseFontBitmaps.
12943 * Create the empty atlas now.
12944 */
12945 struct gl_bitmap_atlas *atlas = lookup_bitmap_atlas(ctx, base);
12946 if (!atlas) {
12947 atlas = alloc_bitmap_atlas(ctx, base);
12948 }
12949 if (atlas) {
12950 /* Atlas _should_ be new/empty now, but clobbering is OK */
12951 assert(atlas->numBitmaps == 0);
12952 atlas->numBitmaps = range;
12953 }
12954 }
12955
12956 _mesa_HashUnlockMutex(ctx->Shared->DisplayList);
12957
12958 return base;
12959 }
12960
12961
12962 /**
12963 * Begin a new display list.
12964 */
12965 void GLAPIENTRY
12966 _mesa_NewList(GLuint name, GLenum mode)
12967 {
12968 GET_CURRENT_CONTEXT(ctx);
12969
12970 FLUSH_CURRENT(ctx, 0); /* must be called before assert */
12971 ASSERT_OUTSIDE_BEGIN_END(ctx);
12972
12973 if (MESA_VERBOSE & VERBOSE_API)
12974 _mesa_debug(ctx, "glNewList %u %s\n", name,
12975 _mesa_enum_to_string(mode));
12976
12977 if (name == 0) {
12978 _mesa_error(ctx, GL_INVALID_VALUE, "glNewList");
12979 return;
12980 }
12981
12982 if (mode != GL_COMPILE && mode != GL_COMPILE_AND_EXECUTE) {
12983 _mesa_error(ctx, GL_INVALID_ENUM, "glNewList");
12984 return;
12985 }
12986
12987 if (ctx->ListState.CurrentList) {
12988 /* already compiling a display list */
12989 _mesa_error(ctx, GL_INVALID_OPERATION, "glNewList");
12990 return;
12991 }
12992
12993 ctx->CompileFlag = GL_TRUE;
12994 ctx->ExecuteFlag = (mode == GL_COMPILE_AND_EXECUTE);
12995
12996 /* Reset accumulated list state */
12997 invalidate_saved_current_state( ctx );
12998
12999 /* Allocate new display list */
13000 ctx->ListState.CurrentList = make_list(name, BLOCK_SIZE);
13001 ctx->ListState.CurrentBlock = ctx->ListState.CurrentList->Head;
13002 ctx->ListState.CurrentPos = 0;
13003
13004 vbo_save_NewList(ctx, name, mode);
13005
13006 ctx->CurrentServerDispatch = ctx->Save;
13007 _glapi_set_dispatch(ctx->CurrentServerDispatch);
13008 if (ctx->MarshalExec == NULL) {
13009 ctx->CurrentClientDispatch = ctx->CurrentServerDispatch;
13010 }
13011 }
13012
13013
13014 /**
13015 * End definition of current display list.
13016 */
13017 void GLAPIENTRY
13018 _mesa_EndList(void)
13019 {
13020 GET_CURRENT_CONTEXT(ctx);
13021 SAVE_FLUSH_VERTICES(ctx);
13022 FLUSH_VERTICES(ctx, 0);
13023
13024 if (MESA_VERBOSE & VERBOSE_API)
13025 _mesa_debug(ctx, "glEndList\n");
13026
13027 if (ctx->ExecuteFlag && _mesa_inside_dlist_begin_end(ctx)) {
13028 _mesa_error(ctx, GL_INVALID_OPERATION,
13029 "glEndList() called inside glBegin/End");
13030 }
13031
13032 /* Check that a list is under construction */
13033 if (!ctx->ListState.CurrentList) {
13034 _mesa_error(ctx, GL_INVALID_OPERATION, "glEndList");
13035 return;
13036 }
13037
13038 /* Call before emitting END_OF_LIST, in case the driver wants to
13039 * emit opcodes itself.
13040 */
13041 vbo_save_EndList(ctx);
13042
13043 (void) alloc_instruction(ctx, OPCODE_END_OF_LIST, 0);
13044
13045 trim_list(ctx);
13046
13047 /* Destroy old list, if any */
13048 destroy_list(ctx, ctx->ListState.CurrentList->Name);
13049
13050 /* Install the new list */
13051 _mesa_HashInsert(ctx->Shared->DisplayList,
13052 ctx->ListState.CurrentList->Name,
13053 ctx->ListState.CurrentList);
13054
13055
13056 if (MESA_VERBOSE & VERBOSE_DISPLAY_LIST)
13057 mesa_print_display_list(ctx->ListState.CurrentList->Name);
13058
13059 ctx->ListState.CurrentList = NULL;
13060 ctx->ListState.CurrentBlock = NULL;
13061 ctx->ListState.CurrentPos = 0;
13062 ctx->ExecuteFlag = GL_TRUE;
13063 ctx->CompileFlag = GL_FALSE;
13064
13065 ctx->CurrentServerDispatch = ctx->Exec;
13066 _glapi_set_dispatch(ctx->CurrentServerDispatch);
13067 if (ctx->MarshalExec == NULL) {
13068 ctx->CurrentClientDispatch = ctx->CurrentServerDispatch;
13069 }
13070 }
13071
13072
13073 void GLAPIENTRY
13074 _mesa_CallList(GLuint list)
13075 {
13076 GLboolean save_compile_flag;
13077 GET_CURRENT_CONTEXT(ctx);
13078 FLUSH_CURRENT(ctx, 0);
13079
13080 if (MESA_VERBOSE & VERBOSE_API)
13081 _mesa_debug(ctx, "glCallList %d\n", list);
13082
13083 if (list == 0) {
13084 _mesa_error(ctx, GL_INVALID_VALUE, "glCallList(list==0)");
13085 return;
13086 }
13087
13088 if (0)
13089 mesa_print_display_list( list );
13090
13091 /* VERY IMPORTANT: Save the CompileFlag status, turn it off,
13092 * execute the display list, and restore the CompileFlag.
13093 */
13094 save_compile_flag = ctx->CompileFlag;
13095 if (save_compile_flag) {
13096 ctx->CompileFlag = GL_FALSE;
13097 }
13098
13099 execute_list(ctx, list);
13100 ctx->CompileFlag = save_compile_flag;
13101
13102 /* also restore API function pointers to point to "save" versions */
13103 if (save_compile_flag) {
13104 ctx->CurrentServerDispatch = ctx->Save;
13105 _glapi_set_dispatch(ctx->CurrentServerDispatch);
13106 if (ctx->MarshalExec == NULL) {
13107 ctx->CurrentClientDispatch = ctx->CurrentServerDispatch;
13108 }
13109 }
13110 }
13111
13112
13113 /**
13114 * Try to execute a glCallLists() command where the display lists contain
13115 * glBitmap commands with a texture atlas.
13116 * \return true for success, false otherwise
13117 */
13118 static bool
13119 render_bitmap_atlas(struct gl_context *ctx, GLsizei n, GLenum type,
13120 const void *lists)
13121 {
13122 struct gl_bitmap_atlas *atlas;
13123 int i;
13124
13125 if (!USE_BITMAP_ATLAS ||
13126 !ctx->Current.RasterPosValid ||
13127 ctx->List.ListBase == 0 ||
13128 type != GL_UNSIGNED_BYTE ||
13129 !ctx->Driver.DrawAtlasBitmaps) {
13130 /* unsupported */
13131 return false;
13132 }
13133
13134 atlas = lookup_bitmap_atlas(ctx, ctx->List.ListBase);
13135
13136 if (!atlas) {
13137 /* Even if glGenLists wasn't called, we can still try to create
13138 * the atlas now.
13139 */
13140 atlas = alloc_bitmap_atlas(ctx, ctx->List.ListBase);
13141 }
13142
13143 if (atlas && !atlas->complete && !atlas->incomplete) {
13144 /* Try to build the bitmap atlas now.
13145 * If the atlas was created in glGenLists, we'll have recorded the
13146 * number of lists (bitmaps). Otherwise, take a guess at 256.
13147 */
13148 if (atlas->numBitmaps == 0)
13149 atlas->numBitmaps = 256;
13150 build_bitmap_atlas(ctx, atlas, ctx->List.ListBase);
13151 }
13152
13153 if (!atlas || !atlas->complete) {
13154 return false;
13155 }
13156
13157 /* check that all display list IDs are in the atlas */
13158 for (i = 0; i < n; i++) {
13159 const GLubyte *ids = (const GLubyte *) lists;
13160
13161 if (ids[i] >= atlas->numBitmaps) {
13162 return false;
13163 }
13164 }
13165
13166 ctx->Driver.DrawAtlasBitmaps(ctx, atlas, n, (const GLubyte *) lists);
13167
13168 return true;
13169 }
13170
13171
13172 /**
13173 * Execute glCallLists: call multiple display lists.
13174 */
13175 void GLAPIENTRY
13176 _mesa_CallLists(GLsizei n, GLenum type, const GLvoid * lists)
13177 {
13178 GET_CURRENT_CONTEXT(ctx);
13179 GLint i;
13180 GLboolean save_compile_flag;
13181
13182 if (MESA_VERBOSE & VERBOSE_API)
13183 _mesa_debug(ctx, "glCallLists %d\n", n);
13184
13185 switch (type) {
13186 case GL_BYTE:
13187 case GL_UNSIGNED_BYTE:
13188 case GL_SHORT:
13189 case GL_UNSIGNED_SHORT:
13190 case GL_INT:
13191 case GL_UNSIGNED_INT:
13192 case GL_FLOAT:
13193 case GL_2_BYTES:
13194 case GL_3_BYTES:
13195 case GL_4_BYTES:
13196 /* OK */
13197 break;
13198 default:
13199 _mesa_error(ctx, GL_INVALID_ENUM, "glCallLists(type)");
13200 return;
13201 }
13202
13203 if (n < 0) {
13204 _mesa_error(ctx, GL_INVALID_VALUE, "glCallLists(n < 0)");
13205 return;
13206 } else if (n == 0 || lists == NULL) {
13207 /* nothing to do */
13208 return;
13209 }
13210
13211 if (render_bitmap_atlas(ctx, n, type, lists)) {
13212 return;
13213 }
13214
13215 /* Save the CompileFlag status, turn it off, execute display list,
13216 * and restore the CompileFlag.
13217 */
13218 save_compile_flag = ctx->CompileFlag;
13219 ctx->CompileFlag = GL_FALSE;
13220
13221 for (i = 0; i < n; i++) {
13222 GLuint list = (GLuint) (ctx->List.ListBase + translate_id(i, type, lists));
13223 execute_list(ctx, list);
13224 }
13225
13226 ctx->CompileFlag = save_compile_flag;
13227
13228 /* also restore API function pointers to point to "save" versions */
13229 if (save_compile_flag) {
13230 ctx->CurrentServerDispatch = ctx->Save;
13231 _glapi_set_dispatch(ctx->CurrentServerDispatch);
13232 if (ctx->MarshalExec == NULL) {
13233 ctx->CurrentClientDispatch = ctx->CurrentServerDispatch;
13234 }
13235 }
13236 }
13237
13238
13239 /**
13240 * Set the offset added to list numbers in glCallLists.
13241 */
13242 void GLAPIENTRY
13243 _mesa_ListBase(GLuint base)
13244 {
13245 GET_CURRENT_CONTEXT(ctx);
13246 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
13247 ASSERT_OUTSIDE_BEGIN_END(ctx);
13248 ctx->List.ListBase = base;
13249 }
13250
13251 /**
13252 * Setup the given dispatch table to point to Mesa's display list
13253 * building functions.
13254 *
13255 * This does not include any of the tnl functions - they are
13256 * initialized from _mesa_init_api_defaults and from the active vtxfmt
13257 * struct.
13258 */
13259 void
13260 _mesa_initialize_save_table(const struct gl_context *ctx)
13261 {
13262 struct _glapi_table *table = ctx->Save;
13263 int numEntries = MAX2(_gloffset_COUNT, _glapi_get_dispatch_table_size());
13264
13265 /* Initially populate the dispatch table with the contents of the
13266 * normal-execution dispatch table. This lets us skip populating functions
13267 * that should be called directly instead of compiled into display lists.
13268 */
13269 memcpy(table, ctx->Exec, numEntries * sizeof(_glapi_proc));
13270
13271 _mesa_loopback_init_api_table(ctx, table);
13272
13273 /* VBO functions */
13274 vbo_initialize_save_dispatch(ctx, table);
13275
13276 /* GL 1.0 */
13277 SET_Accum(table, save_Accum);
13278 SET_AlphaFunc(table, save_AlphaFunc);
13279 SET_Bitmap(table, save_Bitmap);
13280 SET_BlendFunc(table, save_BlendFunc);
13281 SET_CallList(table, save_CallList);
13282 SET_CallLists(table, save_CallLists);
13283 SET_Clear(table, save_Clear);
13284 SET_ClearAccum(table, save_ClearAccum);
13285 SET_ClearColor(table, save_ClearColor);
13286 SET_ClearDepth(table, save_ClearDepth);
13287 SET_ClearIndex(table, save_ClearIndex);
13288 SET_ClearStencil(table, save_ClearStencil);
13289 SET_ClipPlane(table, save_ClipPlane);
13290 SET_ColorMask(table, save_ColorMask);
13291 SET_ColorMaski(table, save_ColorMaskIndexed);
13292 SET_ColorMaterial(table, save_ColorMaterial);
13293 SET_CopyPixels(table, save_CopyPixels);
13294 SET_CullFace(table, save_CullFace);
13295 SET_DepthFunc(table, save_DepthFunc);
13296 SET_DepthMask(table, save_DepthMask);
13297 SET_DepthRange(table, save_DepthRange);
13298 SET_Disable(table, save_Disable);
13299 SET_Disablei(table, save_DisableIndexed);
13300 SET_DrawBuffer(table, save_DrawBuffer);
13301 SET_DrawPixels(table, save_DrawPixels);
13302 SET_Enable(table, save_Enable);
13303 SET_Enablei(table, save_EnableIndexed);
13304 SET_EvalMesh1(table, save_EvalMesh1);
13305 SET_EvalMesh2(table, save_EvalMesh2);
13306 SET_Fogf(table, save_Fogf);
13307 SET_Fogfv(table, save_Fogfv);
13308 SET_Fogi(table, save_Fogi);
13309 SET_Fogiv(table, save_Fogiv);
13310 SET_FrontFace(table, save_FrontFace);
13311 SET_Frustum(table, save_Frustum);
13312 SET_Hint(table, save_Hint);
13313 SET_IndexMask(table, save_IndexMask);
13314 SET_InitNames(table, save_InitNames);
13315 SET_LightModelf(table, save_LightModelf);
13316 SET_LightModelfv(table, save_LightModelfv);
13317 SET_LightModeli(table, save_LightModeli);
13318 SET_LightModeliv(table, save_LightModeliv);
13319 SET_Lightf(table, save_Lightf);
13320 SET_Lightfv(table, save_Lightfv);
13321 SET_Lighti(table, save_Lighti);
13322 SET_Lightiv(table, save_Lightiv);
13323 SET_LineStipple(table, save_LineStipple);
13324 SET_LineWidth(table, save_LineWidth);
13325 SET_ListBase(table, save_ListBase);
13326 SET_LoadIdentity(table, save_LoadIdentity);
13327 SET_LoadMatrixd(table, save_LoadMatrixd);
13328 SET_LoadMatrixf(table, save_LoadMatrixf);
13329 SET_LoadName(table, save_LoadName);
13330 SET_LogicOp(table, save_LogicOp);
13331 SET_Map1d(table, save_Map1d);
13332 SET_Map1f(table, save_Map1f);
13333 SET_Map2d(table, save_Map2d);
13334 SET_Map2f(table, save_Map2f);
13335 SET_MapGrid1d(table, save_MapGrid1d);
13336 SET_MapGrid1f(table, save_MapGrid1f);
13337 SET_MapGrid2d(table, save_MapGrid2d);
13338 SET_MapGrid2f(table, save_MapGrid2f);
13339 SET_MatrixMode(table, save_MatrixMode);
13340 SET_MultMatrixd(table, save_MultMatrixd);
13341 SET_MultMatrixf(table, save_MultMatrixf);
13342 SET_NewList(table, save_NewList);
13343 SET_Ortho(table, save_Ortho);
13344 SET_PassThrough(table, save_PassThrough);
13345 SET_PixelMapfv(table, save_PixelMapfv);
13346 SET_PixelMapuiv(table, save_PixelMapuiv);
13347 SET_PixelMapusv(table, save_PixelMapusv);
13348 SET_PixelTransferf(table, save_PixelTransferf);
13349 SET_PixelTransferi(table, save_PixelTransferi);
13350 SET_PixelZoom(table, save_PixelZoom);
13351 SET_PointSize(table, save_PointSize);
13352 SET_PolygonMode(table, save_PolygonMode);
13353 SET_PolygonOffset(table, save_PolygonOffset);
13354 SET_PolygonStipple(table, save_PolygonStipple);
13355 SET_PopAttrib(table, save_PopAttrib);
13356 SET_PopMatrix(table, save_PopMatrix);
13357 SET_PopName(table, save_PopName);
13358 SET_PushAttrib(table, save_PushAttrib);
13359 SET_PushMatrix(table, save_PushMatrix);
13360 SET_PushName(table, save_PushName);
13361 SET_RasterPos2d(table, save_RasterPos2d);
13362 SET_RasterPos2dv(table, save_RasterPos2dv);
13363 SET_RasterPos2f(table, save_RasterPos2f);
13364 SET_RasterPos2fv(table, save_RasterPos2fv);
13365 SET_RasterPos2i(table, save_RasterPos2i);
13366 SET_RasterPos2iv(table, save_RasterPos2iv);
13367 SET_RasterPos2s(table, save_RasterPos2s);
13368 SET_RasterPos2sv(table, save_RasterPos2sv);
13369 SET_RasterPos3d(table, save_RasterPos3d);
13370 SET_RasterPos3dv(table, save_RasterPos3dv);
13371 SET_RasterPos3f(table, save_RasterPos3f);
13372 SET_RasterPos3fv(table, save_RasterPos3fv);
13373 SET_RasterPos3i(table, save_RasterPos3i);
13374 SET_RasterPos3iv(table, save_RasterPos3iv);
13375 SET_RasterPos3s(table, save_RasterPos3s);
13376 SET_RasterPos3sv(table, save_RasterPos3sv);
13377 SET_RasterPos4d(table, save_RasterPos4d);
13378 SET_RasterPos4dv(table, save_RasterPos4dv);
13379 SET_RasterPos4f(table, save_RasterPos4f);
13380 SET_RasterPos4fv(table, save_RasterPos4fv);
13381 SET_RasterPos4i(table, save_RasterPos4i);
13382 SET_RasterPos4iv(table, save_RasterPos4iv);
13383 SET_RasterPos4s(table, save_RasterPos4s);
13384 SET_RasterPos4sv(table, save_RasterPos4sv);
13385 SET_ReadBuffer(table, save_ReadBuffer);
13386 SET_Rectf(table, save_Rectf);
13387 SET_Rotated(table, save_Rotated);
13388 SET_Rotatef(table, save_Rotatef);
13389 SET_Scaled(table, save_Scaled);
13390 SET_Scalef(table, save_Scalef);
13391 SET_Scissor(table, save_Scissor);
13392 SET_ShadeModel(table, save_ShadeModel);
13393 SET_StencilFunc(table, save_StencilFunc);
13394 SET_StencilMask(table, save_StencilMask);
13395 SET_StencilOp(table, save_StencilOp);
13396 SET_TexEnvf(table, save_TexEnvf);
13397 SET_TexEnvfv(table, save_TexEnvfv);
13398 SET_TexEnvi(table, save_TexEnvi);
13399 SET_TexEnviv(table, save_TexEnviv);
13400 SET_TexGend(table, save_TexGend);
13401 SET_TexGendv(table, save_TexGendv);
13402 SET_TexGenf(table, save_TexGenf);
13403 SET_TexGenfv(table, save_TexGenfv);
13404 SET_TexGeni(table, save_TexGeni);
13405 SET_TexGeniv(table, save_TexGeniv);
13406 SET_TexImage1D(table, save_TexImage1D);
13407 SET_TexImage2D(table, save_TexImage2D);
13408 SET_TexParameterf(table, save_TexParameterf);
13409 SET_TexParameterfv(table, save_TexParameterfv);
13410 SET_TexParameteri(table, save_TexParameteri);
13411 SET_TexParameteriv(table, save_TexParameteriv);
13412 SET_Translated(table, save_Translated);
13413 SET_Translatef(table, save_Translatef);
13414 SET_Viewport(table, save_Viewport);
13415
13416 /* GL 1.1 */
13417 SET_BindTexture(table, save_BindTexture);
13418 SET_CopyTexImage1D(table, save_CopyTexImage1D);
13419 SET_CopyTexImage2D(table, save_CopyTexImage2D);
13420 SET_CopyTexSubImage1D(table, save_CopyTexSubImage1D);
13421 SET_CopyTexSubImage2D(table, save_CopyTexSubImage2D);
13422 SET_PrioritizeTextures(table, save_PrioritizeTextures);
13423 SET_TexSubImage1D(table, save_TexSubImage1D);
13424 SET_TexSubImage2D(table, save_TexSubImage2D);
13425
13426 /* GL 1.2 */
13427 SET_CopyTexSubImage3D(table, save_CopyTexSubImage3D);
13428 SET_TexImage3D(table, save_TexImage3D);
13429 SET_TexSubImage3D(table, save_TexSubImage3D);
13430
13431 /* GL 2.0 */
13432 SET_StencilFuncSeparate(table, save_StencilFuncSeparate);
13433 SET_StencilMaskSeparate(table, save_StencilMaskSeparate);
13434 SET_StencilOpSeparate(table, save_StencilOpSeparate);
13435
13436 /* ATI_separate_stencil */
13437 SET_StencilFuncSeparateATI(table, save_StencilFuncSeparateATI);
13438
13439 /* GL_ARB_imaging */
13440 /* Not all are supported */
13441 SET_BlendColor(table, save_BlendColor);
13442 SET_BlendEquation(table, save_BlendEquation);
13443
13444 /* 2. GL_EXT_blend_color */
13445 #if 0
13446 SET_BlendColorEXT(table, save_BlendColorEXT);
13447 #endif
13448
13449 /* 6. GL_EXT_texture3d */
13450 #if 0
13451 SET_CopyTexSubImage3DEXT(table, save_CopyTexSubImage3D);
13452 SET_TexImage3DEXT(table, save_TexImage3DEXT);
13453 SET_TexSubImage3DEXT(table, save_TexSubImage3D);
13454 #endif
13455
13456 /* 37. GL_EXT_blend_minmax */
13457 #if 0
13458 SET_BlendEquationEXT(table, save_BlendEquationEXT);
13459 #endif
13460
13461 /* 54. GL_EXT_point_parameters */
13462 SET_PointParameterf(table, save_PointParameterfEXT);
13463 SET_PointParameterfv(table, save_PointParameterfvEXT);
13464
13465 /* 91. GL_ARB_tessellation_shader */
13466 SET_PatchParameteri(table, save_PatchParameteri);
13467 SET_PatchParameterfv(table, save_PatchParameterfv);
13468
13469 /* 100. ARB_viewport_array */
13470 SET_ViewportArrayv(table, save_ViewportArrayv);
13471 SET_ViewportIndexedf(table, save_ViewportIndexedf);
13472 SET_ViewportIndexedfv(table, save_ViewportIndexedfv);
13473 SET_ScissorArrayv(table, save_ScissorArrayv);
13474 SET_ScissorIndexed(table, save_ScissorIndexed);
13475 SET_ScissorIndexedv(table, save_ScissorIndexedv);
13476 SET_DepthRangeArrayv(table, save_DepthRangeArrayv);
13477 SET_DepthRangeIndexed(table, save_DepthRangeIndexed);
13478
13479 /* 122. ARB_compute_shader */
13480 SET_DispatchCompute(table, save_DispatchCompute);
13481 SET_DispatchComputeIndirect(table, save_DispatchComputeIndirect);
13482
13483 /* 173. GL_EXT_blend_func_separate */
13484 SET_BlendFuncSeparate(table, save_BlendFuncSeparateEXT);
13485
13486 /* 197. GL_MESA_window_pos */
13487 SET_WindowPos2d(table, save_WindowPos2dMESA);
13488 SET_WindowPos2dv(table, save_WindowPos2dvMESA);
13489 SET_WindowPos2f(table, save_WindowPos2fMESA);
13490 SET_WindowPos2fv(table, save_WindowPos2fvMESA);
13491 SET_WindowPos2i(table, save_WindowPos2iMESA);
13492 SET_WindowPos2iv(table, save_WindowPos2ivMESA);
13493 SET_WindowPos2s(table, save_WindowPos2sMESA);
13494 SET_WindowPos2sv(table, save_WindowPos2svMESA);
13495 SET_WindowPos3d(table, save_WindowPos3dMESA);
13496 SET_WindowPos3dv(table, save_WindowPos3dvMESA);
13497 SET_WindowPos3f(table, save_WindowPos3fMESA);
13498 SET_WindowPos3fv(table, save_WindowPos3fvMESA);
13499 SET_WindowPos3i(table, save_WindowPos3iMESA);
13500 SET_WindowPos3iv(table, save_WindowPos3ivMESA);
13501 SET_WindowPos3s(table, save_WindowPos3sMESA);
13502 SET_WindowPos3sv(table, save_WindowPos3svMESA);
13503 SET_WindowPos4dMESA(table, save_WindowPos4dMESA);
13504 SET_WindowPos4dvMESA(table, save_WindowPos4dvMESA);
13505 SET_WindowPos4fMESA(table, save_WindowPos4fMESA);
13506 SET_WindowPos4fvMESA(table, save_WindowPos4fvMESA);
13507 SET_WindowPos4iMESA(table, save_WindowPos4iMESA);
13508 SET_WindowPos4ivMESA(table, save_WindowPos4ivMESA);
13509 SET_WindowPos4sMESA(table, save_WindowPos4sMESA);
13510 SET_WindowPos4svMESA(table, save_WindowPos4svMESA);
13511
13512 /* 245. GL_ATI_fragment_shader */
13513 SET_BindFragmentShaderATI(table, save_BindFragmentShaderATI);
13514 SET_SetFragmentShaderConstantATI(table, save_SetFragmentShaderConstantATI);
13515
13516 /* 262. GL_NV_point_sprite */
13517 SET_PointParameteri(table, save_PointParameteriNV);
13518 SET_PointParameteriv(table, save_PointParameterivNV);
13519
13520 /* 268. GL_EXT_stencil_two_side */
13521 SET_ActiveStencilFaceEXT(table, save_ActiveStencilFaceEXT);
13522
13523 /* ???. GL_EXT_depth_bounds_test */
13524 SET_DepthBoundsEXT(table, save_DepthBoundsEXT);
13525
13526 /* ARB 1. GL_ARB_multitexture */
13527 SET_ActiveTexture(table, save_ActiveTextureARB);
13528
13529 /* ARB 3. GL_ARB_transpose_matrix */
13530 SET_LoadTransposeMatrixd(table, save_LoadTransposeMatrixdARB);
13531 SET_LoadTransposeMatrixf(table, save_LoadTransposeMatrixfARB);
13532 SET_MultTransposeMatrixd(table, save_MultTransposeMatrixdARB);
13533 SET_MultTransposeMatrixf(table, save_MultTransposeMatrixfARB);
13534
13535 /* ARB 5. GL_ARB_multisample */
13536 SET_SampleCoverage(table, save_SampleCoverageARB);
13537
13538 /* ARB 12. GL_ARB_texture_compression */
13539 SET_CompressedTexImage3D(table, save_CompressedTexImage3DARB);
13540 SET_CompressedTexImage2D(table, save_CompressedTexImage2DARB);
13541 SET_CompressedTexImage1D(table, save_CompressedTexImage1DARB);
13542 SET_CompressedTexSubImage3D(table, save_CompressedTexSubImage3DARB);
13543 SET_CompressedTexSubImage2D(table, save_CompressedTexSubImage2DARB);
13544 SET_CompressedTexSubImage1D(table, save_CompressedTexSubImage1DARB);
13545
13546 /* ARB 14. GL_ARB_point_parameters */
13547 /* aliased with EXT_point_parameters functions */
13548
13549 /* ARB 25. GL_ARB_window_pos */
13550 /* aliased with MESA_window_pos functions */
13551
13552 /* ARB 26. GL_ARB_vertex_program */
13553 /* ARB 27. GL_ARB_fragment_program */
13554 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
13555 SET_ProgramStringARB(table, save_ProgramStringARB);
13556 SET_BindProgramARB(table, save_BindProgramARB);
13557 SET_ProgramEnvParameter4dARB(table, save_ProgramEnvParameter4dARB);
13558 SET_ProgramEnvParameter4dvARB(table, save_ProgramEnvParameter4dvARB);
13559 SET_ProgramEnvParameter4fARB(table, save_ProgramEnvParameter4fARB);
13560 SET_ProgramEnvParameter4fvARB(table, save_ProgramEnvParameter4fvARB);
13561 SET_ProgramLocalParameter4dARB(table, save_ProgramLocalParameter4dARB);
13562 SET_ProgramLocalParameter4dvARB(table, save_ProgramLocalParameter4dvARB);
13563 SET_ProgramLocalParameter4fARB(table, save_ProgramLocalParameter4fARB);
13564 SET_ProgramLocalParameter4fvARB(table, save_ProgramLocalParameter4fvARB);
13565
13566 SET_BeginQuery(table, save_BeginQueryARB);
13567 SET_EndQuery(table, save_EndQueryARB);
13568 SET_QueryCounter(table, save_QueryCounter);
13569
13570 SET_DrawBuffers(table, save_DrawBuffersARB);
13571
13572 SET_BlitFramebuffer(table, save_BlitFramebufferEXT);
13573
13574 SET_UseProgram(table, save_UseProgram);
13575 SET_Uniform1f(table, save_Uniform1fARB);
13576 SET_Uniform2f(table, save_Uniform2fARB);
13577 SET_Uniform3f(table, save_Uniform3fARB);
13578 SET_Uniform4f(table, save_Uniform4fARB);
13579 SET_Uniform1fv(table, save_Uniform1fvARB);
13580 SET_Uniform2fv(table, save_Uniform2fvARB);
13581 SET_Uniform3fv(table, save_Uniform3fvARB);
13582 SET_Uniform4fv(table, save_Uniform4fvARB);
13583 SET_Uniform1i(table, save_Uniform1iARB);
13584 SET_Uniform2i(table, save_Uniform2iARB);
13585 SET_Uniform3i(table, save_Uniform3iARB);
13586 SET_Uniform4i(table, save_Uniform4iARB);
13587 SET_Uniform1iv(table, save_Uniform1ivARB);
13588 SET_Uniform2iv(table, save_Uniform2ivARB);
13589 SET_Uniform3iv(table, save_Uniform3ivARB);
13590 SET_Uniform4iv(table, save_Uniform4ivARB);
13591 SET_UniformMatrix2fv(table, save_UniformMatrix2fvARB);
13592 SET_UniformMatrix3fv(table, save_UniformMatrix3fvARB);
13593 SET_UniformMatrix4fv(table, save_UniformMatrix4fvARB);
13594 SET_UniformMatrix2x3fv(table, save_UniformMatrix2x3fv);
13595 SET_UniformMatrix3x2fv(table, save_UniformMatrix3x2fv);
13596 SET_UniformMatrix2x4fv(table, save_UniformMatrix2x4fv);
13597 SET_UniformMatrix4x2fv(table, save_UniformMatrix4x2fv);
13598 SET_UniformMatrix3x4fv(table, save_UniformMatrix3x4fv);
13599 SET_UniformMatrix4x3fv(table, save_UniformMatrix4x3fv);
13600
13601 /* 299. GL_EXT_blend_equation_separate */
13602 SET_BlendEquationSeparate(table, save_BlendEquationSeparateEXT);
13603
13604 /* GL_EXT_gpu_program_parameters */
13605 SET_ProgramEnvParameters4fvEXT(table, save_ProgramEnvParameters4fvEXT);
13606 SET_ProgramLocalParameters4fvEXT(table, save_ProgramLocalParameters4fvEXT);
13607
13608 /* 364. GL_EXT_provoking_vertex */
13609 SET_ProvokingVertex(table, save_ProvokingVertexEXT);
13610
13611 /* GL_EXT_texture_integer */
13612 SET_ClearColorIiEXT(table, save_ClearColorIi);
13613 SET_ClearColorIuiEXT(table, save_ClearColorIui);
13614 SET_TexParameterIiv(table, save_TexParameterIiv);
13615 SET_TexParameterIuiv(table, save_TexParameterIuiv);
13616
13617 /* GL_ARB_clip_control */
13618 SET_ClipControl(table, save_ClipControl);
13619
13620 /* GL_ARB_color_buffer_float */
13621 SET_ClampColor(table, save_ClampColorARB);
13622
13623 /* GL 3.0 */
13624 SET_ClearBufferiv(table, save_ClearBufferiv);
13625 SET_ClearBufferuiv(table, save_ClearBufferuiv);
13626 SET_ClearBufferfv(table, save_ClearBufferfv);
13627 SET_ClearBufferfi(table, save_ClearBufferfi);
13628 SET_Uniform1ui(table, save_Uniform1ui);
13629 SET_Uniform2ui(table, save_Uniform2ui);
13630 SET_Uniform3ui(table, save_Uniform3ui);
13631 SET_Uniform4ui(table, save_Uniform4ui);
13632 SET_Uniform1uiv(table, save_Uniform1uiv);
13633 SET_Uniform2uiv(table, save_Uniform2uiv);
13634 SET_Uniform3uiv(table, save_Uniform3uiv);
13635 SET_Uniform4uiv(table, save_Uniform4uiv);
13636
13637 /* GL_ARB_gpu_shader_fp64 */
13638 SET_Uniform1d(table, save_Uniform1d);
13639 SET_Uniform2d(table, save_Uniform2d);
13640 SET_Uniform3d(table, save_Uniform3d);
13641 SET_Uniform4d(table, save_Uniform4d);
13642 SET_Uniform1dv(table, save_Uniform1dv);
13643 SET_Uniform2dv(table, save_Uniform2dv);
13644 SET_Uniform3dv(table, save_Uniform3dv);
13645 SET_Uniform4dv(table, save_Uniform4dv);
13646 SET_UniformMatrix2dv(table, save_UniformMatrix2dv);
13647 SET_UniformMatrix3dv(table, save_UniformMatrix3dv);
13648 SET_UniformMatrix4dv(table, save_UniformMatrix4dv);
13649 SET_UniformMatrix2x3dv(table, save_UniformMatrix2x3dv);
13650 SET_UniformMatrix3x2dv(table, save_UniformMatrix3x2dv);
13651 SET_UniformMatrix2x4dv(table, save_UniformMatrix2x4dv);
13652 SET_UniformMatrix4x2dv(table, save_UniformMatrix4x2dv);
13653 SET_UniformMatrix3x4dv(table, save_UniformMatrix3x4dv);
13654 SET_UniformMatrix4x3dv(table, save_UniformMatrix4x3dv);
13655
13656 /* These are: */
13657 SET_BeginTransformFeedback(table, save_BeginTransformFeedback);
13658 SET_EndTransformFeedback(table, save_EndTransformFeedback);
13659 SET_BindTransformFeedback(table, save_BindTransformFeedback);
13660 SET_PauseTransformFeedback(table, save_PauseTransformFeedback);
13661 SET_ResumeTransformFeedback(table, save_ResumeTransformFeedback);
13662 SET_DrawTransformFeedback(table, save_DrawTransformFeedback);
13663 SET_DrawTransformFeedbackStream(table, save_DrawTransformFeedbackStream);
13664 SET_DrawTransformFeedbackInstanced(table,
13665 save_DrawTransformFeedbackInstanced);
13666 SET_DrawTransformFeedbackStreamInstanced(table,
13667 save_DrawTransformFeedbackStreamInstanced);
13668 SET_BeginQueryIndexed(table, save_BeginQueryIndexed);
13669 SET_EndQueryIndexed(table, save_EndQueryIndexed);
13670
13671 /* GL_ARB_instanced_arrays */
13672 SET_VertexAttribDivisor(table, save_VertexAttribDivisor);
13673
13674 /* GL_NV_texture_barrier */
13675 SET_TextureBarrierNV(table, save_TextureBarrierNV);
13676
13677 SET_BindSampler(table, save_BindSampler);
13678 SET_SamplerParameteri(table, save_SamplerParameteri);
13679 SET_SamplerParameterf(table, save_SamplerParameterf);
13680 SET_SamplerParameteriv(table, save_SamplerParameteriv);
13681 SET_SamplerParameterfv(table, save_SamplerParameterfv);
13682 SET_SamplerParameterIiv(table, save_SamplerParameterIiv);
13683 SET_SamplerParameterIuiv(table, save_SamplerParameterIuiv);
13684
13685 /* GL_ARB_draw_buffer_blend */
13686 SET_BlendFunciARB(table, save_BlendFunci);
13687 SET_BlendFuncSeparateiARB(table, save_BlendFuncSeparatei);
13688 SET_BlendEquationiARB(table, save_BlendEquationi);
13689 SET_BlendEquationSeparateiARB(table, save_BlendEquationSeparatei);
13690
13691 /* GL_NV_conditional_render */
13692 SET_BeginConditionalRender(table, save_BeginConditionalRender);
13693 SET_EndConditionalRender(table, save_EndConditionalRender);
13694
13695 /* GL_ARB_sync */
13696 SET_WaitSync(table, save_WaitSync);
13697
13698 /* GL_ARB_uniform_buffer_object */
13699 SET_UniformBlockBinding(table, save_UniformBlockBinding);
13700
13701 /* GL_ARB_shader_subroutines */
13702 SET_UniformSubroutinesuiv(table, save_UniformSubroutinesuiv);
13703
13704 /* GL_ARB_draw_instanced */
13705 SET_DrawArraysInstancedARB(table, save_DrawArraysInstancedARB);
13706 SET_DrawElementsInstancedARB(table, save_DrawElementsInstancedARB);
13707
13708 /* GL_ARB_draw_elements_base_vertex */
13709 SET_DrawElementsInstancedBaseVertex(table, save_DrawElementsInstancedBaseVertexARB);
13710
13711 /* GL_ARB_base_instance */
13712 SET_DrawArraysInstancedBaseInstance(table, save_DrawArraysInstancedBaseInstance);
13713 SET_DrawElementsInstancedBaseInstance(table, save_DrawElementsInstancedBaseInstance);
13714 SET_DrawElementsInstancedBaseVertexBaseInstance(table, save_DrawElementsInstancedBaseVertexBaseInstance);
13715
13716 /* GL_ARB_draw_indirect / GL_ARB_multi_draw_indirect */
13717 SET_DrawArraysIndirect(table, save_DrawArraysIndirect);
13718 SET_DrawElementsIndirect(table, save_DrawElementsIndirect);
13719 SET_MultiDrawArraysIndirect(table, save_MultiDrawArraysIndirect);
13720 SET_MultiDrawElementsIndirect(table, save_MultiDrawElementsIndirect);
13721
13722 /* OpenGL 4.2 / GL_ARB_separate_shader_objects */
13723 SET_UseProgramStages(table, save_UseProgramStages);
13724 SET_ProgramUniform1f(table, save_ProgramUniform1f);
13725 SET_ProgramUniform2f(table, save_ProgramUniform2f);
13726 SET_ProgramUniform3f(table, save_ProgramUniform3f);
13727 SET_ProgramUniform4f(table, save_ProgramUniform4f);
13728 SET_ProgramUniform1fv(table, save_ProgramUniform1fv);
13729 SET_ProgramUniform2fv(table, save_ProgramUniform2fv);
13730 SET_ProgramUniform3fv(table, save_ProgramUniform3fv);
13731 SET_ProgramUniform4fv(table, save_ProgramUniform4fv);
13732 SET_ProgramUniform1d(table, save_ProgramUniform1d);
13733 SET_ProgramUniform2d(table, save_ProgramUniform2d);
13734 SET_ProgramUniform3d(table, save_ProgramUniform3d);
13735 SET_ProgramUniform4d(table, save_ProgramUniform4d);
13736 SET_ProgramUniform1dv(table, save_ProgramUniform1dv);
13737 SET_ProgramUniform2dv(table, save_ProgramUniform2dv);
13738 SET_ProgramUniform3dv(table, save_ProgramUniform3dv);
13739 SET_ProgramUniform4dv(table, save_ProgramUniform4dv);
13740 SET_ProgramUniform1i(table, save_ProgramUniform1i);
13741 SET_ProgramUniform2i(table, save_ProgramUniform2i);
13742 SET_ProgramUniform3i(table, save_ProgramUniform3i);
13743 SET_ProgramUniform4i(table, save_ProgramUniform4i);
13744 SET_ProgramUniform1iv(table, save_ProgramUniform1iv);
13745 SET_ProgramUniform2iv(table, save_ProgramUniform2iv);
13746 SET_ProgramUniform3iv(table, save_ProgramUniform3iv);
13747 SET_ProgramUniform4iv(table, save_ProgramUniform4iv);
13748 SET_ProgramUniform1ui(table, save_ProgramUniform1ui);
13749 SET_ProgramUniform2ui(table, save_ProgramUniform2ui);
13750 SET_ProgramUniform3ui(table, save_ProgramUniform3ui);
13751 SET_ProgramUniform4ui(table, save_ProgramUniform4ui);
13752 SET_ProgramUniform1uiv(table, save_ProgramUniform1uiv);
13753 SET_ProgramUniform2uiv(table, save_ProgramUniform2uiv);
13754 SET_ProgramUniform3uiv(table, save_ProgramUniform3uiv);
13755 SET_ProgramUniform4uiv(table, save_ProgramUniform4uiv);
13756 SET_ProgramUniformMatrix2fv(table, save_ProgramUniformMatrix2fv);
13757 SET_ProgramUniformMatrix3fv(table, save_ProgramUniformMatrix3fv);
13758 SET_ProgramUniformMatrix4fv(table, save_ProgramUniformMatrix4fv);
13759 SET_ProgramUniformMatrix2x3fv(table, save_ProgramUniformMatrix2x3fv);
13760 SET_ProgramUniformMatrix3x2fv(table, save_ProgramUniformMatrix3x2fv);
13761 SET_ProgramUniformMatrix2x4fv(table, save_ProgramUniformMatrix2x4fv);
13762 SET_ProgramUniformMatrix4x2fv(table, save_ProgramUniformMatrix4x2fv);
13763 SET_ProgramUniformMatrix3x4fv(table, save_ProgramUniformMatrix3x4fv);
13764 SET_ProgramUniformMatrix4x3fv(table, save_ProgramUniformMatrix4x3fv);
13765 SET_ProgramUniformMatrix2dv(table, save_ProgramUniformMatrix2dv);
13766 SET_ProgramUniformMatrix3dv(table, save_ProgramUniformMatrix3dv);
13767 SET_ProgramUniformMatrix4dv(table, save_ProgramUniformMatrix4dv);
13768 SET_ProgramUniformMatrix2x3dv(table, save_ProgramUniformMatrix2x3dv);
13769 SET_ProgramUniformMatrix3x2dv(table, save_ProgramUniformMatrix3x2dv);
13770 SET_ProgramUniformMatrix2x4dv(table, save_ProgramUniformMatrix2x4dv);
13771 SET_ProgramUniformMatrix4x2dv(table, save_ProgramUniformMatrix4x2dv);
13772 SET_ProgramUniformMatrix3x4dv(table, save_ProgramUniformMatrix3x4dv);
13773 SET_ProgramUniformMatrix4x3dv(table, save_ProgramUniformMatrix4x3dv);
13774
13775 /* GL_{ARB,EXT}_polygon_offset_clamp */
13776 SET_PolygonOffsetClampEXT(table, save_PolygonOffsetClampEXT);
13777
13778 /* GL_EXT_window_rectangles */
13779 SET_WindowRectanglesEXT(table, save_WindowRectanglesEXT);
13780
13781 /* GL_NV_conservative_raster */
13782 SET_SubpixelPrecisionBiasNV(table, save_SubpixelPrecisionBiasNV);
13783
13784 /* GL_NV_conservative_raster_dilate */
13785 SET_ConservativeRasterParameterfNV(table, save_ConservativeRasterParameterfNV);
13786
13787 /* GL_NV_conservative_raster_pre_snap_triangles */
13788 SET_ConservativeRasterParameteriNV(table, save_ConservativeRasterParameteriNV);
13789
13790 /* GL_EXT_direct_state_access */
13791 SET_MatrixLoadfEXT(table, save_MatrixLoadfEXT);
13792 SET_MatrixLoaddEXT(table, save_MatrixLoaddEXT);
13793 SET_MatrixMultfEXT(table, save_MatrixMultfEXT);
13794 SET_MatrixMultdEXT(table, save_MatrixMultdEXT);
13795 SET_MatrixRotatefEXT(table, save_MatrixRotatefEXT);
13796 SET_MatrixRotatedEXT(table, save_MatrixRotatedEXT);
13797 SET_MatrixScalefEXT(table, save_MatrixScalefEXT);
13798 SET_MatrixScaledEXT(table, save_MatrixScaledEXT);
13799 SET_MatrixTranslatefEXT(table, save_MatrixTranslatefEXT);
13800 SET_MatrixTranslatedEXT(table, save_MatrixTranslatedEXT);
13801 SET_MatrixLoadIdentityEXT(table, save_MatrixLoadIdentityEXT);
13802 SET_MatrixOrthoEXT(table, save_MatrixOrthoEXT);
13803 SET_MatrixFrustumEXT(table, save_MatrixFrustumEXT);
13804 SET_MatrixPushEXT(table, save_MatrixPushEXT);
13805 SET_MatrixPopEXT(table, save_MatrixPopEXT);
13806 SET_MatrixLoadTransposefEXT(table, save_MatrixLoadTransposefEXT);
13807 SET_MatrixLoadTransposedEXT(table, save_MatrixLoadTransposedEXT);
13808 SET_MatrixMultTransposefEXT(table, save_MatrixMultTransposefEXT);
13809 SET_MatrixMultTransposedEXT(table, save_MatrixMultTransposedEXT);
13810 SET_TextureParameteriEXT(table, save_TextureParameteriEXT);
13811 SET_TextureParameterivEXT(table, save_TextureParameterivEXT);
13812 SET_TextureParameterfEXT(table, save_TextureParameterfEXT);
13813 SET_TextureParameterfvEXT(table, save_TextureParameterfvEXT);
13814 SET_TextureImage1DEXT(table, save_TextureImage1DEXT);
13815 SET_TextureImage2DEXT(table, save_TextureImage2DEXT);
13816 SET_TextureImage3DEXT(table, save_TextureImage3DEXT);
13817 SET_TextureSubImage1DEXT(table, save_TextureSubImage1DEXT);
13818 SET_TextureSubImage2DEXT(table, save_TextureSubImage2DEXT);
13819 SET_TextureSubImage3DEXT(table, save_TextureSubImage3DEXT);
13820 SET_CopyTextureImage1DEXT(table, save_CopyTextureImage1DEXT);
13821 SET_CopyTextureImage2DEXT(table, save_CopyTextureImage2DEXT);
13822 SET_CopyTextureSubImage1DEXT(table, save_CopyTextureSubImage1DEXT);
13823 SET_CopyTextureSubImage2DEXT(table, save_CopyTextureSubImage2DEXT);
13824 SET_CopyTextureSubImage3DEXT(table, save_CopyTextureSubImage3DEXT);
13825 SET_BindMultiTextureEXT(table, save_BindMultiTextureEXT);
13826 SET_MultiTexParameteriEXT(table, save_MultiTexParameteriEXT);
13827 SET_MultiTexParameterivEXT(table, save_MultiTexParameterivEXT);
13828 SET_MultiTexParameterfEXT(table, save_MultiTexParameterfEXT);
13829 SET_MultiTexParameterfvEXT(table, save_MultiTexParameterfvEXT);
13830 SET_MultiTexImage1DEXT(table, save_MultiTexImage1DEXT);
13831 SET_MultiTexImage2DEXT(table, save_MultiTexImage2DEXT);
13832 SET_MultiTexImage3DEXT(table, save_MultiTexImage3DEXT);
13833 SET_MultiTexSubImage1DEXT(table, save_MultiTexSubImage1DEXT);
13834 SET_MultiTexSubImage2DEXT(table, save_MultiTexSubImage2DEXT);
13835 SET_MultiTexSubImage3DEXT(table, save_MultiTexSubImage3DEXT);
13836 SET_CopyMultiTexImage1DEXT(table, save_CopyMultiTexImage1DEXT);
13837 SET_CopyMultiTexImage2DEXT(table, save_CopyMultiTexImage2DEXT);
13838 SET_CopyMultiTexSubImage1DEXT(table, save_CopyMultiTexSubImage1DEXT);
13839 SET_CopyMultiTexSubImage2DEXT(table, save_CopyMultiTexSubImage2DEXT);
13840 SET_CopyMultiTexSubImage3DEXT(table, save_CopyMultiTexSubImage3DEXT);
13841 SET_MultiTexEnvfEXT(table, save_MultiTexEnvfEXT);
13842 SET_MultiTexEnvfvEXT(table, save_MultiTexEnvfvEXT);
13843 SET_MultiTexEnviEXT(table, save_MultiTexEnviEXT);
13844 SET_MultiTexEnvivEXT(table, save_MultiTexEnvivEXT);
13845 SET_CompressedTextureImage1DEXT(table, save_CompressedTextureImage1DEXT);
13846 SET_CompressedTextureImage2DEXT(table, save_CompressedTextureImage2DEXT);
13847 SET_CompressedTextureImage3DEXT(table, save_CompressedTextureImage3DEXT);
13848 SET_CompressedTextureSubImage1DEXT(table, save_CompressedTextureSubImage1DEXT);
13849 SET_CompressedTextureSubImage2DEXT(table, save_CompressedTextureSubImage2DEXT);
13850 SET_CompressedTextureSubImage3DEXT(table, save_CompressedTextureSubImage3DEXT);
13851 SET_CompressedMultiTexImage1DEXT(table, save_CompressedMultiTexImage1DEXT);
13852 SET_CompressedMultiTexImage2DEXT(table, save_CompressedMultiTexImage2DEXT);
13853 SET_CompressedMultiTexImage3DEXT(table, save_CompressedMultiTexImage3DEXT);
13854 SET_CompressedMultiTexSubImage1DEXT(table, save_CompressedMultiTexSubImage1DEXT);
13855 SET_CompressedMultiTexSubImage2DEXT(table, save_CompressedMultiTexSubImage2DEXT);
13856 SET_CompressedMultiTexSubImage3DEXT(table, save_CompressedMultiTexSubImage3DEXT);
13857 }
13858
13859
13860
13861 static const char *
13862 enum_string(GLenum k)
13863 {
13864 return _mesa_enum_to_string(k);
13865 }
13866
13867
13868 /**
13869 * Print the commands in a display list. For debugging only.
13870 * TODO: many commands aren't handled yet.
13871 * \param fname filename to write display list to. If null, use stdout.
13872 */
13873 static void GLAPIENTRY
13874 print_list(struct gl_context *ctx, GLuint list, const char *fname)
13875 {
13876 struct gl_display_list *dlist;
13877 Node *n;
13878 GLboolean done;
13879 FILE *f = stdout;
13880
13881 if (fname) {
13882 f = fopen(fname, "w");
13883 if (!f)
13884 return;
13885 }
13886
13887 if (!islist(ctx, list)) {
13888 fprintf(f, "%u is not a display list ID\n", list);
13889 goto out;
13890 }
13891
13892 dlist = _mesa_lookup_list(ctx, list);
13893 if (!dlist) {
13894 goto out;
13895 }
13896
13897 n = dlist->Head;
13898
13899 fprintf(f, "START-LIST %u, address %p\n", list, (void *) n);
13900
13901 done = n ? GL_FALSE : GL_TRUE;
13902 while (!done) {
13903 const OpCode opcode = n[0].opcode;
13904
13905 if (is_ext_opcode(opcode)) {
13906 n += ext_opcode_print(ctx, n, f);
13907 }
13908 else {
13909 switch (opcode) {
13910 case OPCODE_ACCUM:
13911 fprintf(f, "Accum %s %g\n", enum_string(n[1].e), n[2].f);
13912 break;
13913 case OPCODE_ACTIVE_TEXTURE:
13914 fprintf(f, "ActiveTexture(%s)\n", enum_string(n[1].e));
13915 break;
13916 case OPCODE_BITMAP:
13917 fprintf(f, "Bitmap %d %d %g %g %g %g %p\n", n[1].i, n[2].i,
13918 n[3].f, n[4].f, n[5].f, n[6].f,
13919 get_pointer(&n[7]));
13920 break;
13921 case OPCODE_BLEND_COLOR:
13922 fprintf(f, "BlendColor %f, %f, %f, %f\n",
13923 n[1].f, n[2].f, n[3].f, n[4].f);
13924 break;
13925 case OPCODE_BLEND_EQUATION:
13926 fprintf(f, "BlendEquation %s\n",
13927 enum_string(n[1].e));
13928 break;
13929 case OPCODE_BLEND_EQUATION_SEPARATE:
13930 fprintf(f, "BlendEquationSeparate %s, %s\n",
13931 enum_string(n[1].e),
13932 enum_string(n[2].e));
13933 break;
13934 case OPCODE_BLEND_FUNC_SEPARATE:
13935 fprintf(f, "BlendFuncSeparate %s, %s, %s, %s\n",
13936 enum_string(n[1].e),
13937 enum_string(n[2].e),
13938 enum_string(n[3].e),
13939 enum_string(n[4].e));
13940 break;
13941 case OPCODE_BLEND_EQUATION_I:
13942 fprintf(f, "BlendEquationi %u, %s\n",
13943 n[1].ui, enum_string(n[2].e));
13944 break;
13945 case OPCODE_BLEND_EQUATION_SEPARATE_I:
13946 fprintf(f, "BlendEquationSeparatei %u, %s, %s\n",
13947 n[1].ui, enum_string(n[2].e), enum_string(n[3].e));
13948 break;
13949 case OPCODE_BLEND_FUNC_I:
13950 fprintf(f, "BlendFunci %u, %s, %s\n",
13951 n[1].ui, enum_string(n[2].e), enum_string(n[3].e));
13952 break;
13953 case OPCODE_BLEND_FUNC_SEPARATE_I:
13954 fprintf(f, "BlendFuncSeparatei %u, %s, %s, %s, %s\n",
13955 n[1].ui,
13956 enum_string(n[2].e),
13957 enum_string(n[3].e),
13958 enum_string(n[4].e),
13959 enum_string(n[5].e));
13960 break;
13961 case OPCODE_CALL_LIST:
13962 fprintf(f, "CallList %d\n", (int) n[1].ui);
13963 break;
13964 case OPCODE_CALL_LISTS:
13965 fprintf(f, "CallLists %d, %s\n", n[1].i, enum_string(n[1].e));
13966 break;
13967 case OPCODE_DISABLE:
13968 fprintf(f, "Disable %s\n", enum_string(n[1].e));
13969 break;
13970 case OPCODE_ENABLE:
13971 fprintf(f, "Enable %s\n", enum_string(n[1].e));
13972 break;
13973 case OPCODE_FRUSTUM:
13974 fprintf(f, "Frustum %g %g %g %g %g %g\n",
13975 n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f);
13976 break;
13977 case OPCODE_LINE_STIPPLE:
13978 fprintf(f, "LineStipple %d %x\n", n[1].i, (int) n[2].us);
13979 break;
13980 case OPCODE_LINE_WIDTH:
13981 fprintf(f, "LineWidth %f\n", n[1].f);
13982 break;
13983 case OPCODE_LOAD_IDENTITY:
13984 fprintf(f, "LoadIdentity\n");
13985 break;
13986 case OPCODE_LOAD_MATRIX:
13987 fprintf(f, "LoadMatrix\n");
13988 fprintf(f, " %8f %8f %8f %8f\n",
13989 n[1].f, n[5].f, n[9].f, n[13].f);
13990 fprintf(f, " %8f %8f %8f %8f\n",
13991 n[2].f, n[6].f, n[10].f, n[14].f);
13992 fprintf(f, " %8f %8f %8f %8f\n",
13993 n[3].f, n[7].f, n[11].f, n[15].f);
13994 fprintf(f, " %8f %8f %8f %8f\n",
13995 n[4].f, n[8].f, n[12].f, n[16].f);
13996 break;
13997 case OPCODE_MULT_MATRIX:
13998 fprintf(f, "MultMatrix (or Rotate)\n");
13999 fprintf(f, " %8f %8f %8f %8f\n",
14000 n[1].f, n[5].f, n[9].f, n[13].f);
14001 fprintf(f, " %8f %8f %8f %8f\n",
14002 n[2].f, n[6].f, n[10].f, n[14].f);
14003 fprintf(f, " %8f %8f %8f %8f\n",
14004 n[3].f, n[7].f, n[11].f, n[15].f);
14005 fprintf(f, " %8f %8f %8f %8f\n",
14006 n[4].f, n[8].f, n[12].f, n[16].f);
14007 break;
14008 case OPCODE_ORTHO:
14009 fprintf(f, "Ortho %g %g %g %g %g %g\n",
14010 n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f);
14011 break;
14012 case OPCODE_POINT_SIZE:
14013 fprintf(f, "PointSize %f\n", n[1].f);
14014 break;
14015 case OPCODE_POP_ATTRIB:
14016 fprintf(f, "PopAttrib\n");
14017 break;
14018 case OPCODE_POP_MATRIX:
14019 fprintf(f, "PopMatrix\n");
14020 break;
14021 case OPCODE_POP_NAME:
14022 fprintf(f, "PopName\n");
14023 break;
14024 case OPCODE_PUSH_ATTRIB:
14025 fprintf(f, "PushAttrib %x\n", n[1].bf);
14026 break;
14027 case OPCODE_PUSH_MATRIX:
14028 fprintf(f, "PushMatrix\n");
14029 break;
14030 case OPCODE_PUSH_NAME:
14031 fprintf(f, "PushName %d\n", (int) n[1].ui);
14032 break;
14033 case OPCODE_RASTER_POS:
14034 fprintf(f, "RasterPos %g %g %g %g\n",
14035 n[1].f, n[2].f, n[3].f, n[4].f);
14036 break;
14037 case OPCODE_ROTATE:
14038 fprintf(f, "Rotate %g %g %g %g\n",
14039 n[1].f, n[2].f, n[3].f, n[4].f);
14040 break;
14041 case OPCODE_SCALE:
14042 fprintf(f, "Scale %g %g %g\n", n[1].f, n[2].f, n[3].f);
14043 break;
14044 case OPCODE_TRANSLATE:
14045 fprintf(f, "Translate %g %g %g\n", n[1].f, n[2].f, n[3].f);
14046 break;
14047 case OPCODE_BIND_TEXTURE:
14048 fprintf(f, "BindTexture %s %d\n",
14049 _mesa_enum_to_string(n[1].ui), n[2].ui);
14050 break;
14051 case OPCODE_SHADE_MODEL:
14052 fprintf(f, "ShadeModel %s\n", _mesa_enum_to_string(n[1].ui));
14053 break;
14054 case OPCODE_MAP1:
14055 fprintf(f, "Map1 %s %.3f %.3f %d %d\n",
14056 _mesa_enum_to_string(n[1].ui),
14057 n[2].f, n[3].f, n[4].i, n[5].i);
14058 break;
14059 case OPCODE_MAP2:
14060 fprintf(f, "Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
14061 _mesa_enum_to_string(n[1].ui),
14062 n[2].f, n[3].f, n[4].f, n[5].f,
14063 n[6].i, n[7].i, n[8].i, n[9].i);
14064 break;
14065 case OPCODE_MAPGRID1:
14066 fprintf(f, "MapGrid1 %d %.3f %.3f\n", n[1].i, n[2].f, n[3].f);
14067 break;
14068 case OPCODE_MAPGRID2:
14069 fprintf(f, "MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
14070 n[1].i, n[2].f, n[3].f, n[4].i, n[5].f, n[6].f);
14071 break;
14072 case OPCODE_EVALMESH1:
14073 fprintf(f, "EvalMesh1 %d %d\n", n[1].i, n[2].i);
14074 break;
14075 case OPCODE_EVALMESH2:
14076 fprintf(f, "EvalMesh2 %d %d %d %d\n",
14077 n[1].i, n[2].i, n[3].i, n[4].i);
14078 break;
14079
14080 case OPCODE_ATTR_1F_NV:
14081 fprintf(f, "ATTR_1F_NV attr %d: %f\n", n[1].i, n[2].f);
14082 break;
14083 case OPCODE_ATTR_2F_NV:
14084 fprintf(f, "ATTR_2F_NV attr %d: %f %f\n",
14085 n[1].i, n[2].f, n[3].f);
14086 break;
14087 case OPCODE_ATTR_3F_NV:
14088 fprintf(f, "ATTR_3F_NV attr %d: %f %f %f\n",
14089 n[1].i, n[2].f, n[3].f, n[4].f);
14090 break;
14091 case OPCODE_ATTR_4F_NV:
14092 fprintf(f, "ATTR_4F_NV attr %d: %f %f %f %f\n",
14093 n[1].i, n[2].f, n[3].f, n[4].f, n[5].f);
14094 break;
14095 case OPCODE_ATTR_1F_ARB:
14096 fprintf(f, "ATTR_1F_ARB attr %d: %f\n", n[1].i, n[2].f);
14097 break;
14098 case OPCODE_ATTR_2F_ARB:
14099 fprintf(f, "ATTR_2F_ARB attr %d: %f %f\n",
14100 n[1].i, n[2].f, n[3].f);
14101 break;
14102 case OPCODE_ATTR_3F_ARB:
14103 fprintf(f, "ATTR_3F_ARB attr %d: %f %f %f\n",
14104 n[1].i, n[2].f, n[3].f, n[4].f);
14105 break;
14106 case OPCODE_ATTR_4F_ARB:
14107 fprintf(f, "ATTR_4F_ARB attr %d: %f %f %f %f\n",
14108 n[1].i, n[2].f, n[3].f, n[4].f, n[5].f);
14109 break;
14110
14111 case OPCODE_MATERIAL:
14112 fprintf(f, "MATERIAL %x %x: %f %f %f %f\n",
14113 n[1].i, n[2].i, n[3].f, n[4].f, n[5].f, n[6].f);
14114 break;
14115 case OPCODE_BEGIN:
14116 fprintf(f, "BEGIN %x\n", n[1].i);
14117 break;
14118 case OPCODE_END:
14119 fprintf(f, "END\n");
14120 break;
14121 case OPCODE_RECTF:
14122 fprintf(f, "RECTF %f %f %f %f\n", n[1].f, n[2].f, n[3].f,
14123 n[4].f);
14124 break;
14125 case OPCODE_EVAL_C1:
14126 fprintf(f, "EVAL_C1 %f\n", n[1].f);
14127 break;
14128 case OPCODE_EVAL_C2:
14129 fprintf(f, "EVAL_C2 %f %f\n", n[1].f, n[2].f);
14130 break;
14131 case OPCODE_EVAL_P1:
14132 fprintf(f, "EVAL_P1 %d\n", n[1].i);
14133 break;
14134 case OPCODE_EVAL_P2:
14135 fprintf(f, "EVAL_P2 %d %d\n", n[1].i, n[2].i);
14136 break;
14137
14138 case OPCODE_PROVOKING_VERTEX:
14139 fprintf(f, "ProvokingVertex %s\n",
14140 _mesa_enum_to_string(n[1].ui));
14141 break;
14142
14143 /*
14144 * meta opcodes/commands
14145 */
14146 case OPCODE_ERROR:
14147 fprintf(f, "Error: %s %s\n", enum_string(n[1].e),
14148 (const char *) get_pointer(&n[2]));
14149 break;
14150 case OPCODE_CONTINUE:
14151 fprintf(f, "DISPLAY-LIST-CONTINUE\n");
14152 n = (Node *) get_pointer(&n[1]);
14153 break;
14154 case OPCODE_NOP:
14155 fprintf(f, "NOP\n");
14156 break;
14157 case OPCODE_END_OF_LIST:
14158 fprintf(f, "END-LIST %u\n", list);
14159 done = GL_TRUE;
14160 break;
14161 default:
14162 if (opcode < 0 || opcode > OPCODE_END_OF_LIST) {
14163 printf
14164 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
14165 opcode, (void *) n);
14166 goto out;
14167 }
14168 else {
14169 fprintf(f, "command %d, %u operands\n", opcode,
14170 InstSize[opcode]);
14171 }
14172 }
14173 /* increment n to point to next compiled command */
14174 if (opcode != OPCODE_CONTINUE) {
14175 assert(InstSize[opcode] > 0);
14176 n += InstSize[opcode];
14177 }
14178 }
14179 }
14180
14181 out:
14182 fflush(f);
14183 if (fname)
14184 fclose(f);
14185 }
14186
14187
14188
14189 /**
14190 * Clients may call this function to help debug display list problems.
14191 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
14192 * changed, or break in the future without notice.
14193 */
14194 void
14195 mesa_print_display_list(GLuint list)
14196 {
14197 GET_CURRENT_CONTEXT(ctx);
14198 print_list(ctx, list, NULL);
14199 }
14200
14201
14202 /**********************************************************************/
14203 /***** Initialization *****/
14204 /**********************************************************************/
14205
14206 static void
14207 save_vtxfmt_init(GLvertexformat * vfmt)
14208 {
14209 vfmt->ArrayElement = _ae_ArrayElement;
14210
14211 vfmt->Begin = save_Begin;
14212
14213 vfmt->CallList = save_CallList;
14214 vfmt->CallLists = save_CallLists;
14215
14216 vfmt->Color3f = save_Color3f;
14217 vfmt->Color3fv = save_Color3fv;
14218 vfmt->Color4f = save_Color4f;
14219 vfmt->Color4fv = save_Color4fv;
14220 vfmt->EdgeFlag = save_EdgeFlag;
14221 vfmt->End = save_End;
14222
14223 vfmt->EvalCoord1f = save_EvalCoord1f;
14224 vfmt->EvalCoord1fv = save_EvalCoord1fv;
14225 vfmt->EvalCoord2f = save_EvalCoord2f;
14226 vfmt->EvalCoord2fv = save_EvalCoord2fv;
14227 vfmt->EvalPoint1 = save_EvalPoint1;
14228 vfmt->EvalPoint2 = save_EvalPoint2;
14229
14230 vfmt->FogCoordfEXT = save_FogCoordfEXT;
14231 vfmt->FogCoordfvEXT = save_FogCoordfvEXT;
14232 vfmt->Indexf = save_Indexf;
14233 vfmt->Indexfv = save_Indexfv;
14234 vfmt->Materialfv = save_Materialfv;
14235 vfmt->MultiTexCoord1fARB = save_MultiTexCoord1f;
14236 vfmt->MultiTexCoord1fvARB = save_MultiTexCoord1fv;
14237 vfmt->MultiTexCoord2fARB = save_MultiTexCoord2f;
14238 vfmt->MultiTexCoord2fvARB = save_MultiTexCoord2fv;
14239 vfmt->MultiTexCoord3fARB = save_MultiTexCoord3f;
14240 vfmt->MultiTexCoord3fvARB = save_MultiTexCoord3fv;
14241 vfmt->MultiTexCoord4fARB = save_MultiTexCoord4f;
14242 vfmt->MultiTexCoord4fvARB = save_MultiTexCoord4fv;
14243 vfmt->Normal3f = save_Normal3f;
14244 vfmt->Normal3fv = save_Normal3fv;
14245 vfmt->SecondaryColor3fEXT = save_SecondaryColor3fEXT;
14246 vfmt->SecondaryColor3fvEXT = save_SecondaryColor3fvEXT;
14247 vfmt->TexCoord1f = save_TexCoord1f;
14248 vfmt->TexCoord1fv = save_TexCoord1fv;
14249 vfmt->TexCoord2f = save_TexCoord2f;
14250 vfmt->TexCoord2fv = save_TexCoord2fv;
14251 vfmt->TexCoord3f = save_TexCoord3f;
14252 vfmt->TexCoord3fv = save_TexCoord3fv;
14253 vfmt->TexCoord4f = save_TexCoord4f;
14254 vfmt->TexCoord4fv = save_TexCoord4fv;
14255 vfmt->Vertex2f = save_Vertex2f;
14256 vfmt->Vertex2fv = save_Vertex2fv;
14257 vfmt->Vertex3f = save_Vertex3f;
14258 vfmt->Vertex3fv = save_Vertex3fv;
14259 vfmt->Vertex4f = save_Vertex4f;
14260 vfmt->Vertex4fv = save_Vertex4fv;
14261 vfmt->VertexAttrib1fARB = save_VertexAttrib1fARB;
14262 vfmt->VertexAttrib1fvARB = save_VertexAttrib1fvARB;
14263 vfmt->VertexAttrib2fARB = save_VertexAttrib2fARB;
14264 vfmt->VertexAttrib2fvARB = save_VertexAttrib2fvARB;
14265 vfmt->VertexAttrib3fARB = save_VertexAttrib3fARB;
14266 vfmt->VertexAttrib3fvARB = save_VertexAttrib3fvARB;
14267 vfmt->VertexAttrib4fARB = save_VertexAttrib4fARB;
14268 vfmt->VertexAttrib4fvARB = save_VertexAttrib4fvARB;
14269 vfmt->VertexAttribL1d = save_VertexAttribL1d;
14270 vfmt->VertexAttribL1dv = save_VertexAttribL1dv;
14271 vfmt->VertexAttribL2d = save_VertexAttribL2d;
14272 vfmt->VertexAttribL2dv = save_VertexAttribL2dv;
14273 vfmt->VertexAttribL3d = save_VertexAttribL3d;
14274 vfmt->VertexAttribL3dv = save_VertexAttribL3dv;
14275 vfmt->VertexAttribL4d = save_VertexAttribL4d;
14276 vfmt->VertexAttribL4dv = save_VertexAttribL4dv;
14277
14278 vfmt->PrimitiveRestartNV = save_PrimitiveRestartNV;
14279 }
14280
14281
14282 void
14283 _mesa_install_dlist_vtxfmt(struct _glapi_table *disp,
14284 const GLvertexformat *vfmt)
14285 {
14286 SET_CallList(disp, vfmt->CallList);
14287 SET_CallLists(disp, vfmt->CallLists);
14288 }
14289
14290
14291 /**
14292 * Initialize display list state for given context.
14293 */
14294 void
14295 _mesa_init_display_list(struct gl_context *ctx)
14296 {
14297 static GLboolean tableInitialized = GL_FALSE;
14298
14299 /* zero-out the instruction size table, just once */
14300 if (!tableInitialized) {
14301 memset(InstSize, 0, sizeof(InstSize));
14302 tableInitialized = GL_TRUE;
14303 }
14304
14305 /* extension info */
14306 ctx->ListExt = CALLOC_STRUCT(gl_list_extensions);
14307
14308 /* Display list */
14309 ctx->ListState.CallDepth = 0;
14310 ctx->ExecuteFlag = GL_TRUE;
14311 ctx->CompileFlag = GL_FALSE;
14312 ctx->ListState.CurrentBlock = NULL;
14313 ctx->ListState.CurrentPos = 0;
14314
14315 /* Display List group */
14316 ctx->List.ListBase = 0;
14317
14318 save_vtxfmt_init(&ctx->ListState.ListVtxfmt);
14319
14320 InstSize[OPCODE_NOP] = 1;
14321 }
14322
14323
14324 void
14325 _mesa_free_display_list_data(struct gl_context *ctx)
14326 {
14327 free(ctx->ListExt);
14328 ctx->ListExt = NULL;
14329 }