mesa: add EXT_dsa glCompressedMultiTex* functions display list support
[mesa.git] / src / mesa / main / dlist.c
1 /*
2 * Mesa 3-D graphics library
3 *
4 * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
5 * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 * OTHER DEALINGS IN THE SOFTWARE.
24 */
25
26
27 /**
28 * \file dlist.c
29 * Display lists management functions.
30 */
31
32 #include "c99_math.h"
33 #include "glheader.h"
34 #include "imports.h"
35 #include "api_arrayelt.h"
36 #include "api_exec.h"
37 #include "api_loopback.h"
38 #include "draw_validate.h"
39 #include "atifragshader.h"
40 #include "config.h"
41 #include "bufferobj.h"
42 #include "arrayobj.h"
43 #include "context.h"
44 #include "dlist.h"
45 #include "enums.h"
46 #include "eval.h"
47 #include "fbobject.h"
48 #include "framebuffer.h"
49 #include "glapi/glapi.h"
50 #include "glformats.h"
51 #include "hash.h"
52 #include "image.h"
53 #include "light.h"
54 #include "macros.h"
55 #include "pack.h"
56 #include "pbo.h"
57 #include "queryobj.h"
58 #include "samplerobj.h"
59 #include "shaderapi.h"
60 #include "syncobj.h"
61 #include "teximage.h"
62 #include "texstorage.h"
63 #include "mtypes.h"
64 #include "varray.h"
65 #include "arbprogram.h"
66 #include "transformfeedback.h"
67
68 #include "math/m_matrix.h"
69
70 #include "main/dispatch.h"
71
72 #include "vbo/vbo.h"
73
74
75 #define USE_BITMAP_ATLAS 1
76
77
78
79 /**
80 * Other parts of Mesa (such as the VBO module) can plug into the display
81 * list system. This structure describes new display list instructions.
82 */
83 struct gl_list_instruction
84 {
85 GLuint Size;
86 void (*Execute)( struct gl_context *ctx, void *data );
87 void (*Destroy)( struct gl_context *ctx, void *data );
88 void (*Print)( struct gl_context *ctx, void *data, FILE *f );
89 };
90
91
92 #define MAX_DLIST_EXT_OPCODES 16
93
94 /**
95 * Used by device drivers to hook new commands into display lists.
96 */
97 struct gl_list_extensions
98 {
99 struct gl_list_instruction Opcode[MAX_DLIST_EXT_OPCODES];
100 GLuint NumOpcodes;
101 };
102
103
104
105 /**
106 * Flush vertices.
107 *
108 * \param ctx GL context.
109 *
110 * Checks if dd_function_table::SaveNeedFlush is marked to flush
111 * stored (save) vertices, and calls vbo_save_SaveFlushVertices if so.
112 */
113 #define SAVE_FLUSH_VERTICES(ctx) \
114 do { \
115 if (ctx->Driver.SaveNeedFlush) \
116 vbo_save_SaveFlushVertices(ctx); \
117 } while (0)
118
119
120 /**
121 * Macro to assert that the API call was made outside the
122 * glBegin()/glEnd() pair, with return value.
123 *
124 * \param ctx GL context.
125 * \param retval value to return value in case the assertion fails.
126 */
127 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval) \
128 do { \
129 if (ctx->Driver.CurrentSavePrimitive <= PRIM_MAX) { \
130 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glBegin/End" ); \
131 return retval; \
132 } \
133 } while (0)
134
135 /**
136 * Macro to assert that the API call was made outside the
137 * glBegin()/glEnd() pair.
138 *
139 * \param ctx GL context.
140 */
141 #define ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx) \
142 do { \
143 if (ctx->Driver.CurrentSavePrimitive <= PRIM_MAX) { \
144 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glBegin/End" ); \
145 return; \
146 } \
147 } while (0)
148
149 /**
150 * Macro to assert that the API call was made outside the
151 * glBegin()/glEnd() pair and flush the vertices.
152 *
153 * \param ctx GL context.
154 */
155 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx) \
156 do { \
157 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx); \
158 SAVE_FLUSH_VERTICES(ctx); \
159 } while (0)
160
161 /**
162 * Macro to assert that the API call was made outside the
163 * glBegin()/glEnd() pair and flush the vertices, with return value.
164 *
165 * \param ctx GL context.
166 * \param retval value to return value in case the assertion fails.
167 */
168 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval) \
169 do { \
170 ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval); \
171 SAVE_FLUSH_VERTICES(ctx); \
172 } while (0)
173
174
175 /**
176 * Display list opcodes.
177 *
178 * The fact that these identifiers are assigned consecutive
179 * integer values starting at 0 is very important, see InstSize array usage)
180 */
181 typedef enum
182 {
183 OPCODE_INVALID = -1, /* Force signed enum */
184 OPCODE_ACCUM,
185 OPCODE_ALPHA_FUNC,
186 OPCODE_BIND_TEXTURE,
187 OPCODE_BITMAP,
188 OPCODE_BLEND_COLOR,
189 OPCODE_BLEND_EQUATION,
190 OPCODE_BLEND_EQUATION_SEPARATE,
191 OPCODE_BLEND_FUNC_SEPARATE,
192
193 OPCODE_BLEND_EQUATION_I,
194 OPCODE_BLEND_EQUATION_SEPARATE_I,
195 OPCODE_BLEND_FUNC_I,
196 OPCODE_BLEND_FUNC_SEPARATE_I,
197
198 OPCODE_CALL_LIST,
199 OPCODE_CALL_LISTS,
200 OPCODE_CLEAR,
201 OPCODE_CLEAR_ACCUM,
202 OPCODE_CLEAR_COLOR,
203 OPCODE_CLEAR_DEPTH,
204 OPCODE_CLEAR_INDEX,
205 OPCODE_CLEAR_STENCIL,
206 OPCODE_CLEAR_BUFFER_IV,
207 OPCODE_CLEAR_BUFFER_UIV,
208 OPCODE_CLEAR_BUFFER_FV,
209 OPCODE_CLEAR_BUFFER_FI,
210 OPCODE_CLIP_PLANE,
211 OPCODE_COLOR_MASK,
212 OPCODE_COLOR_MASK_INDEXED,
213 OPCODE_COLOR_MATERIAL,
214 OPCODE_COPY_PIXELS,
215 OPCODE_COPY_TEX_IMAGE1D,
216 OPCODE_COPY_TEX_IMAGE2D,
217 OPCODE_COPY_TEX_SUB_IMAGE1D,
218 OPCODE_COPY_TEX_SUB_IMAGE2D,
219 OPCODE_COPY_TEX_SUB_IMAGE3D,
220 OPCODE_CULL_FACE,
221 OPCODE_DEPTH_FUNC,
222 OPCODE_DEPTH_MASK,
223 OPCODE_DEPTH_RANGE,
224 OPCODE_DISABLE,
225 OPCODE_DISABLE_INDEXED,
226 OPCODE_DRAW_BUFFER,
227 OPCODE_DRAW_PIXELS,
228 OPCODE_ENABLE,
229 OPCODE_ENABLE_INDEXED,
230 OPCODE_EVALMESH1,
231 OPCODE_EVALMESH2,
232 OPCODE_FOG,
233 OPCODE_FRONT_FACE,
234 OPCODE_FRUSTUM,
235 OPCODE_HINT,
236 OPCODE_INDEX_MASK,
237 OPCODE_INIT_NAMES,
238 OPCODE_LIGHT,
239 OPCODE_LIGHT_MODEL,
240 OPCODE_LINE_STIPPLE,
241 OPCODE_LINE_WIDTH,
242 OPCODE_LIST_BASE,
243 OPCODE_LOAD_IDENTITY,
244 OPCODE_LOAD_MATRIX,
245 OPCODE_LOAD_NAME,
246 OPCODE_LOGIC_OP,
247 OPCODE_MAP1,
248 OPCODE_MAP2,
249 OPCODE_MAPGRID1,
250 OPCODE_MAPGRID2,
251 OPCODE_MATRIX_MODE,
252 OPCODE_MULT_MATRIX,
253 OPCODE_ORTHO,
254 OPCODE_PASSTHROUGH,
255 OPCODE_PIXEL_MAP,
256 OPCODE_PIXEL_TRANSFER,
257 OPCODE_PIXEL_ZOOM,
258 OPCODE_POINT_SIZE,
259 OPCODE_POINT_PARAMETERS,
260 OPCODE_POLYGON_MODE,
261 OPCODE_POLYGON_STIPPLE,
262 OPCODE_POLYGON_OFFSET,
263 OPCODE_POP_ATTRIB,
264 OPCODE_POP_MATRIX,
265 OPCODE_POP_NAME,
266 OPCODE_PRIORITIZE_TEXTURE,
267 OPCODE_PUSH_ATTRIB,
268 OPCODE_PUSH_MATRIX,
269 OPCODE_PUSH_NAME,
270 OPCODE_RASTER_POS,
271 OPCODE_READ_BUFFER,
272 OPCODE_ROTATE,
273 OPCODE_SCALE,
274 OPCODE_SCISSOR,
275 OPCODE_SELECT_TEXTURE_SGIS,
276 OPCODE_SELECT_TEXTURE_COORD_SET,
277 OPCODE_SHADE_MODEL,
278 OPCODE_STENCIL_FUNC,
279 OPCODE_STENCIL_MASK,
280 OPCODE_STENCIL_OP,
281 OPCODE_TEXENV,
282 OPCODE_TEXGEN,
283 OPCODE_TEXPARAMETER,
284 OPCODE_TEX_IMAGE1D,
285 OPCODE_TEX_IMAGE2D,
286 OPCODE_TEX_IMAGE3D,
287 OPCODE_TEX_SUB_IMAGE1D,
288 OPCODE_TEX_SUB_IMAGE2D,
289 OPCODE_TEX_SUB_IMAGE3D,
290 OPCODE_TRANSLATE,
291 OPCODE_VIEWPORT,
292 OPCODE_WINDOW_POS,
293 /* ARB_viewport_array */
294 OPCODE_VIEWPORT_ARRAY_V,
295 OPCODE_VIEWPORT_INDEXED_F,
296 OPCODE_VIEWPORT_INDEXED_FV,
297 OPCODE_SCISSOR_ARRAY_V,
298 OPCODE_SCISSOR_INDEXED,
299 OPCODE_SCISSOR_INDEXED_V,
300 OPCODE_DEPTH_ARRAY_V,
301 OPCODE_DEPTH_INDEXED,
302 /* GL_ARB_multitexture */
303 OPCODE_ACTIVE_TEXTURE,
304 /* GL_ARB_texture_compression */
305 OPCODE_COMPRESSED_TEX_IMAGE_1D,
306 OPCODE_COMPRESSED_TEX_IMAGE_2D,
307 OPCODE_COMPRESSED_TEX_IMAGE_3D,
308 OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D,
309 OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D,
310 OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D,
311 /* GL_ARB_multisample */
312 OPCODE_SAMPLE_COVERAGE,
313 /* GL_ARB_window_pos */
314 OPCODE_WINDOW_POS_ARB,
315 /* GL_ARB_vertex_program */
316 OPCODE_BIND_PROGRAM_ARB,
317 OPCODE_PROGRAM_LOCAL_PARAMETER_ARB,
318 /* GL_EXT_stencil_two_side */
319 OPCODE_ACTIVE_STENCIL_FACE_EXT,
320 /* GL_EXT_depth_bounds_test */
321 OPCODE_DEPTH_BOUNDS_EXT,
322 /* GL_ARB_vertex/fragment_program */
323 OPCODE_PROGRAM_STRING_ARB,
324 OPCODE_PROGRAM_ENV_PARAMETER_ARB,
325 /* GL_ARB_occlusion_query */
326 OPCODE_BEGIN_QUERY_ARB,
327 OPCODE_END_QUERY_ARB,
328 /* GL_ARB_draw_buffers */
329 OPCODE_DRAW_BUFFERS_ARB,
330 /* GL_ATI_fragment_shader */
331 OPCODE_BIND_FRAGMENT_SHADER_ATI,
332 OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI,
333 /* OpenGL 2.0 */
334 OPCODE_STENCIL_FUNC_SEPARATE,
335 OPCODE_STENCIL_OP_SEPARATE,
336 OPCODE_STENCIL_MASK_SEPARATE,
337 /* GL_NV_primitive_restart */
338 OPCODE_PRIMITIVE_RESTART_NV,
339 /* GL_ARB_shader_objects */
340 OPCODE_USE_PROGRAM,
341 OPCODE_UNIFORM_1F,
342 OPCODE_UNIFORM_2F,
343 OPCODE_UNIFORM_3F,
344 OPCODE_UNIFORM_4F,
345 OPCODE_UNIFORM_1FV,
346 OPCODE_UNIFORM_2FV,
347 OPCODE_UNIFORM_3FV,
348 OPCODE_UNIFORM_4FV,
349 OPCODE_UNIFORM_1I,
350 OPCODE_UNIFORM_2I,
351 OPCODE_UNIFORM_3I,
352 OPCODE_UNIFORM_4I,
353 OPCODE_UNIFORM_1IV,
354 OPCODE_UNIFORM_2IV,
355 OPCODE_UNIFORM_3IV,
356 OPCODE_UNIFORM_4IV,
357 OPCODE_UNIFORM_MATRIX22,
358 OPCODE_UNIFORM_MATRIX33,
359 OPCODE_UNIFORM_MATRIX44,
360 OPCODE_UNIFORM_MATRIX23,
361 OPCODE_UNIFORM_MATRIX32,
362 OPCODE_UNIFORM_MATRIX24,
363 OPCODE_UNIFORM_MATRIX42,
364 OPCODE_UNIFORM_MATRIX34,
365 OPCODE_UNIFORM_MATRIX43,
366
367 /* OpenGL 3.0 */
368 OPCODE_UNIFORM_1UI,
369 OPCODE_UNIFORM_2UI,
370 OPCODE_UNIFORM_3UI,
371 OPCODE_UNIFORM_4UI,
372 OPCODE_UNIFORM_1UIV,
373 OPCODE_UNIFORM_2UIV,
374 OPCODE_UNIFORM_3UIV,
375 OPCODE_UNIFORM_4UIV,
376
377 /* GL_ARB_gpu_shader_fp64 */
378 OPCODE_UNIFORM_1D,
379 OPCODE_UNIFORM_2D,
380 OPCODE_UNIFORM_3D,
381 OPCODE_UNIFORM_4D,
382 OPCODE_UNIFORM_1DV,
383 OPCODE_UNIFORM_2DV,
384 OPCODE_UNIFORM_3DV,
385 OPCODE_UNIFORM_4DV,
386 OPCODE_UNIFORM_MATRIX22D,
387 OPCODE_UNIFORM_MATRIX33D,
388 OPCODE_UNIFORM_MATRIX44D,
389 OPCODE_UNIFORM_MATRIX23D,
390 OPCODE_UNIFORM_MATRIX32D,
391 OPCODE_UNIFORM_MATRIX24D,
392 OPCODE_UNIFORM_MATRIX42D,
393 OPCODE_UNIFORM_MATRIX34D,
394 OPCODE_UNIFORM_MATRIX43D,
395
396 /* OpenGL 4.0 / GL_ARB_tessellation_shader */
397 OPCODE_PATCH_PARAMETER_I,
398 OPCODE_PATCH_PARAMETER_FV_INNER,
399 OPCODE_PATCH_PARAMETER_FV_OUTER,
400
401 /* OpenGL 4.2 / GL_ARB_separate_shader_objects */
402 OPCODE_USE_PROGRAM_STAGES,
403 OPCODE_PROGRAM_UNIFORM_1F,
404 OPCODE_PROGRAM_UNIFORM_2F,
405 OPCODE_PROGRAM_UNIFORM_3F,
406 OPCODE_PROGRAM_UNIFORM_4F,
407 OPCODE_PROGRAM_UNIFORM_1FV,
408 OPCODE_PROGRAM_UNIFORM_2FV,
409 OPCODE_PROGRAM_UNIFORM_3FV,
410 OPCODE_PROGRAM_UNIFORM_4FV,
411 OPCODE_PROGRAM_UNIFORM_1D,
412 OPCODE_PROGRAM_UNIFORM_2D,
413 OPCODE_PROGRAM_UNIFORM_3D,
414 OPCODE_PROGRAM_UNIFORM_4D,
415 OPCODE_PROGRAM_UNIFORM_1DV,
416 OPCODE_PROGRAM_UNIFORM_2DV,
417 OPCODE_PROGRAM_UNIFORM_3DV,
418 OPCODE_PROGRAM_UNIFORM_4DV,
419 OPCODE_PROGRAM_UNIFORM_1I,
420 OPCODE_PROGRAM_UNIFORM_2I,
421 OPCODE_PROGRAM_UNIFORM_3I,
422 OPCODE_PROGRAM_UNIFORM_4I,
423 OPCODE_PROGRAM_UNIFORM_1IV,
424 OPCODE_PROGRAM_UNIFORM_2IV,
425 OPCODE_PROGRAM_UNIFORM_3IV,
426 OPCODE_PROGRAM_UNIFORM_4IV,
427 OPCODE_PROGRAM_UNIFORM_1UI,
428 OPCODE_PROGRAM_UNIFORM_2UI,
429 OPCODE_PROGRAM_UNIFORM_3UI,
430 OPCODE_PROGRAM_UNIFORM_4UI,
431 OPCODE_PROGRAM_UNIFORM_1UIV,
432 OPCODE_PROGRAM_UNIFORM_2UIV,
433 OPCODE_PROGRAM_UNIFORM_3UIV,
434 OPCODE_PROGRAM_UNIFORM_4UIV,
435 OPCODE_PROGRAM_UNIFORM_MATRIX22F,
436 OPCODE_PROGRAM_UNIFORM_MATRIX33F,
437 OPCODE_PROGRAM_UNIFORM_MATRIX44F,
438 OPCODE_PROGRAM_UNIFORM_MATRIX23F,
439 OPCODE_PROGRAM_UNIFORM_MATRIX32F,
440 OPCODE_PROGRAM_UNIFORM_MATRIX24F,
441 OPCODE_PROGRAM_UNIFORM_MATRIX42F,
442 OPCODE_PROGRAM_UNIFORM_MATRIX34F,
443 OPCODE_PROGRAM_UNIFORM_MATRIX43F,
444 OPCODE_PROGRAM_UNIFORM_MATRIX22D,
445 OPCODE_PROGRAM_UNIFORM_MATRIX33D,
446 OPCODE_PROGRAM_UNIFORM_MATRIX44D,
447 OPCODE_PROGRAM_UNIFORM_MATRIX23D,
448 OPCODE_PROGRAM_UNIFORM_MATRIX32D,
449 OPCODE_PROGRAM_UNIFORM_MATRIX24D,
450 OPCODE_PROGRAM_UNIFORM_MATRIX42D,
451 OPCODE_PROGRAM_UNIFORM_MATRIX34D,
452 OPCODE_PROGRAM_UNIFORM_MATRIX43D,
453
454 /* GL_ARB_clip_control */
455 OPCODE_CLIP_CONTROL,
456
457 /* GL_ARB_color_buffer_float */
458 OPCODE_CLAMP_COLOR,
459
460 /* GL_EXT_framebuffer_blit */
461 OPCODE_BLIT_FRAMEBUFFER,
462
463 /* Vertex attributes -- fallback for when optimized display
464 * list build isn't active.
465 */
466 OPCODE_ATTR_1F_NV,
467 OPCODE_ATTR_2F_NV,
468 OPCODE_ATTR_3F_NV,
469 OPCODE_ATTR_4F_NV,
470 OPCODE_ATTR_1F_ARB,
471 OPCODE_ATTR_2F_ARB,
472 OPCODE_ATTR_3F_ARB,
473 OPCODE_ATTR_4F_ARB,
474 OPCODE_ATTR_1D,
475 OPCODE_ATTR_2D,
476 OPCODE_ATTR_3D,
477 OPCODE_ATTR_4D,
478 OPCODE_MATERIAL,
479 OPCODE_BEGIN,
480 OPCODE_END,
481 OPCODE_RECTF,
482 OPCODE_EVAL_C1,
483 OPCODE_EVAL_C2,
484 OPCODE_EVAL_P1,
485 OPCODE_EVAL_P2,
486
487 /* GL_EXT_provoking_vertex */
488 OPCODE_PROVOKING_VERTEX,
489
490 /* GL_EXT_transform_feedback */
491 OPCODE_BEGIN_TRANSFORM_FEEDBACK,
492 OPCODE_END_TRANSFORM_FEEDBACK,
493 OPCODE_BIND_TRANSFORM_FEEDBACK,
494 OPCODE_PAUSE_TRANSFORM_FEEDBACK,
495 OPCODE_RESUME_TRANSFORM_FEEDBACK,
496 OPCODE_DRAW_TRANSFORM_FEEDBACK,
497
498 /* GL_EXT_texture_integer */
499 OPCODE_CLEARCOLOR_I,
500 OPCODE_CLEARCOLOR_UI,
501 OPCODE_TEXPARAMETER_I,
502 OPCODE_TEXPARAMETER_UI,
503
504 /* GL_ARB_instanced_arrays */
505 OPCODE_VERTEX_ATTRIB_DIVISOR,
506
507 /* GL_NV_texture_barrier */
508 OPCODE_TEXTURE_BARRIER_NV,
509
510 /* GL_ARB_sampler_object */
511 OPCODE_BIND_SAMPLER,
512 OPCODE_SAMPLER_PARAMETERIV,
513 OPCODE_SAMPLER_PARAMETERFV,
514 OPCODE_SAMPLER_PARAMETERIIV,
515 OPCODE_SAMPLER_PARAMETERUIV,
516
517 /* ARB_compute_shader */
518 OPCODE_DISPATCH_COMPUTE,
519
520 /* GL_ARB_sync */
521 OPCODE_WAIT_SYNC,
522
523 /* GL_NV_conditional_render */
524 OPCODE_BEGIN_CONDITIONAL_RENDER,
525 OPCODE_END_CONDITIONAL_RENDER,
526
527 /* ARB_timer_query */
528 OPCODE_QUERY_COUNTER,
529
530 /* ARB_transform_feedback3 */
531 OPCODE_BEGIN_QUERY_INDEXED,
532 OPCODE_END_QUERY_INDEXED,
533 OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM,
534
535 /* ARB_transform_feedback_instanced */
536 OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED,
537 OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED,
538
539 /* ARB_uniform_buffer_object */
540 OPCODE_UNIFORM_BLOCK_BINDING,
541
542 /* ARB_shader_subroutines */
543 OPCODE_UNIFORM_SUBROUTINES,
544
545 /* EXT_polygon_offset_clamp */
546 OPCODE_POLYGON_OFFSET_CLAMP,
547
548 /* EXT_window_rectangles */
549 OPCODE_WINDOW_RECTANGLES,
550
551 /* NV_conservative_raster */
552 OPCODE_SUBPIXEL_PRECISION_BIAS,
553
554 /* NV_conservative_raster_dilate */
555 OPCODE_CONSERVATIVE_RASTER_PARAMETER_F,
556
557 /* NV_conservative_raster_pre_snap_triangles */
558 OPCODE_CONSERVATIVE_RASTER_PARAMETER_I,
559
560 /* EXT_direct_state_access */
561 OPCODE_MATRIX_LOAD,
562 OPCODE_MATRIX_MULT,
563 OPCODE_MATRIX_ROTATE,
564 OPCODE_MATRIX_SCALE,
565 OPCODE_MATRIX_TRANSLATE,
566 OPCODE_MATRIX_LOAD_IDENTITY,
567 OPCODE_MATRIX_ORTHO,
568 OPCODE_MATRIX_FRUSTUM,
569 OPCODE_MATRIX_PUSH,
570 OPCODE_MATRIX_POP,
571 OPCODE_TEXTUREPARAMETER_F,
572 OPCODE_TEXTUREPARAMETER_I,
573 OPCODE_TEXTURE_IMAGE1D,
574 OPCODE_TEXTURE_IMAGE2D,
575 OPCODE_TEXTURE_IMAGE3D,
576 OPCODE_TEXTURE_SUB_IMAGE1D,
577 OPCODE_TEXTURE_SUB_IMAGE2D,
578 OPCODE_TEXTURE_SUB_IMAGE3D,
579 OPCODE_COPY_TEXTURE_IMAGE1D,
580 OPCODE_COPY_TEXTURE_IMAGE2D,
581 OPCODE_COPY_TEXTURE_SUB_IMAGE1D,
582 OPCODE_COPY_TEXTURE_SUB_IMAGE2D,
583 OPCODE_COPY_TEXTURE_SUB_IMAGE3D,
584 OPCODE_BIND_MULTITEXTURE,
585 OPCODE_MULTITEXPARAMETER_F,
586 OPCODE_MULTITEXPARAMETER_I,
587 OPCODE_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 _mesa_init_teximage_fields(ctx, atlas->texImage,
945 atlas->texWidth, atlas->texHeight, 1, 0,
946 GL_ALPHA, MESA_FORMAT_A_UNORM8);
947
948 /* alloc image storage */
949 if (!ctx->Driver.AllocTextureImageBuffer(ctx, atlas->texImage)) {
950 goto out_of_memory;
951 }
952
953 /* map teximage, load with bitmap glyphs */
954 ctx->Driver.MapTextureImage(ctx, atlas->texImage, 0,
955 0, 0, atlas->texWidth, atlas->texHeight,
956 GL_MAP_WRITE_BIT, &map, &map_stride);
957 if (!map) {
958 goto out_of_memory;
959 }
960
961 /* Background/clear pixels are 0xff, foreground/set pixels are 0x0 */
962 memset(map, 0xff, map_stride * atlas->texHeight);
963
964 for (i = 0; i < atlas->numBitmaps; i++) {
965 const struct gl_display_list *list = _mesa_lookup_list(ctx, listBase + i);
966 const Node *n = list->Head;
967
968 assert(n[0].opcode == OPCODE_BITMAP ||
969 n[0].opcode == OPCODE_END_OF_LIST);
970
971 if (n[0].opcode == OPCODE_BITMAP) {
972 unsigned bitmap_width = n[1].i;
973 unsigned bitmap_height = n[2].i;
974 unsigned xpos = atlas->glyphs[i].x;
975 unsigned ypos = atlas->glyphs[i].y;
976 const void *bitmap_image = get_pointer(&n[7]);
977
978 assert(atlas->glyphs[i].w == bitmap_width);
979 assert(atlas->glyphs[i].h == bitmap_height);
980
981 /* put the bitmap image into the texture image */
982 _mesa_expand_bitmap(bitmap_width, bitmap_height,
983 &ctx->DefaultPacking, bitmap_image,
984 map + map_stride * ypos + xpos, /* dest addr */
985 map_stride, 0x0);
986 }
987 }
988
989 ctx->Driver.UnmapTextureImage(ctx, atlas->texImage, 0);
990
991 atlas->complete = true;
992
993 return;
994
995 out_of_memory:
996 _mesa_error(ctx, GL_OUT_OF_MEMORY, "Display list bitmap atlas");
997 fail:
998 if (atlas->texObj) {
999 ctx->Driver.DeleteTexture(ctx, atlas->texObj);
1000 }
1001 free(atlas->glyphs);
1002 atlas->glyphs = NULL;
1003 atlas->incomplete = true;
1004 }
1005
1006
1007 /**
1008 * Allocate a gl_display_list object with an initial block of storage.
1009 * \param count how many display list nodes/tokens to allocate
1010 */
1011 static struct gl_display_list *
1012 make_list(GLuint name, GLuint count)
1013 {
1014 struct gl_display_list *dlist = CALLOC_STRUCT(gl_display_list);
1015 dlist->Name = name;
1016 dlist->Head = malloc(sizeof(Node) * count);
1017 dlist->Head[0].opcode = OPCODE_END_OF_LIST;
1018 /* All InstSize[] entries must be non-zero */
1019 InstSize[OPCODE_END_OF_LIST] = 1;
1020 return dlist;
1021 }
1022
1023
1024 /**
1025 * Lookup function to just encapsulate casting.
1026 */
1027 struct gl_display_list *
1028 _mesa_lookup_list(struct gl_context *ctx, GLuint list)
1029 {
1030 return (struct gl_display_list *)
1031 _mesa_HashLookup(ctx->Shared->DisplayList, list);
1032 }
1033
1034
1035 /** Is the given opcode an extension code? */
1036 static inline GLboolean
1037 is_ext_opcode(OpCode opcode)
1038 {
1039 return (opcode >= OPCODE_EXT_0);
1040 }
1041
1042
1043 /** Destroy an extended opcode instruction */
1044 static GLint
1045 ext_opcode_destroy(struct gl_context *ctx, Node *node)
1046 {
1047 const GLint i = node[0].opcode - OPCODE_EXT_0;
1048 GLint step;
1049 ctx->ListExt->Opcode[i].Destroy(ctx, &node[1]);
1050 step = ctx->ListExt->Opcode[i].Size;
1051 return step;
1052 }
1053
1054
1055 /** Execute an extended opcode instruction */
1056 static GLint
1057 ext_opcode_execute(struct gl_context *ctx, Node *node)
1058 {
1059 const GLint i = node[0].opcode - OPCODE_EXT_0;
1060 GLint step;
1061 ctx->ListExt->Opcode[i].Execute(ctx, &node[1]);
1062 step = ctx->ListExt->Opcode[i].Size;
1063 return step;
1064 }
1065
1066
1067 /** Print an extended opcode instruction */
1068 static GLint
1069 ext_opcode_print(struct gl_context *ctx, Node *node, FILE *f)
1070 {
1071 const GLint i = node[0].opcode - OPCODE_EXT_0;
1072 GLint step;
1073 ctx->ListExt->Opcode[i].Print(ctx, &node[1], f);
1074 step = ctx->ListExt->Opcode[i].Size;
1075 return step;
1076 }
1077
1078
1079 /**
1080 * Delete the named display list, but don't remove from hash table.
1081 * \param dlist - display list pointer
1082 */
1083 void
1084 _mesa_delete_list(struct gl_context *ctx, struct gl_display_list *dlist)
1085 {
1086 Node *n, *block;
1087 GLboolean done;
1088
1089 n = block = dlist->Head;
1090
1091 done = block ? GL_FALSE : GL_TRUE;
1092 while (!done) {
1093 const OpCode opcode = n[0].opcode;
1094
1095 /* check for extension opcodes first */
1096 if (is_ext_opcode(opcode)) {
1097 n += ext_opcode_destroy(ctx, n);
1098 }
1099 else {
1100 switch (opcode) {
1101 /* for some commands, we need to free malloc'd memory */
1102 case OPCODE_MAP1:
1103 free(get_pointer(&n[6]));
1104 break;
1105 case OPCODE_MAP2:
1106 free(get_pointer(&n[10]));
1107 break;
1108 case OPCODE_CALL_LISTS:
1109 free(get_pointer(&n[3]));
1110 break;
1111 case OPCODE_DRAW_PIXELS:
1112 free(get_pointer(&n[5]));
1113 break;
1114 case OPCODE_BITMAP:
1115 free(get_pointer(&n[7]));
1116 break;
1117 case OPCODE_POLYGON_STIPPLE:
1118 free(get_pointer(&n[1]));
1119 break;
1120 case OPCODE_TEX_IMAGE1D:
1121 free(get_pointer(&n[8]));
1122 break;
1123 case OPCODE_TEX_IMAGE2D:
1124 free(get_pointer(&n[9]));
1125 break;
1126 case OPCODE_TEX_IMAGE3D:
1127 free(get_pointer(&n[10]));
1128 break;
1129 case OPCODE_TEX_SUB_IMAGE1D:
1130 free(get_pointer(&n[7]));
1131 break;
1132 case OPCODE_TEX_SUB_IMAGE2D:
1133 free(get_pointer(&n[9]));
1134 break;
1135 case OPCODE_TEX_SUB_IMAGE3D:
1136 free(get_pointer(&n[11]));
1137 break;
1138 case OPCODE_COMPRESSED_TEX_IMAGE_1D:
1139 free(get_pointer(&n[7]));
1140 break;
1141 case OPCODE_COMPRESSED_TEX_IMAGE_2D:
1142 free(get_pointer(&n[8]));
1143 break;
1144 case OPCODE_COMPRESSED_TEX_IMAGE_3D:
1145 free(get_pointer(&n[9]));
1146 break;
1147 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D:
1148 free(get_pointer(&n[7]));
1149 break;
1150 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D:
1151 free(get_pointer(&n[9]));
1152 break;
1153 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D:
1154 free(get_pointer(&n[11]));
1155 break;
1156 case OPCODE_PROGRAM_STRING_ARB:
1157 free(get_pointer(&n[4])); /* program string */
1158 break;
1159 case OPCODE_UNIFORM_1FV:
1160 case OPCODE_UNIFORM_2FV:
1161 case OPCODE_UNIFORM_3FV:
1162 case OPCODE_UNIFORM_4FV:
1163 case OPCODE_UNIFORM_1DV:
1164 case OPCODE_UNIFORM_2DV:
1165 case OPCODE_UNIFORM_3DV:
1166 case OPCODE_UNIFORM_4DV:
1167 case OPCODE_UNIFORM_1IV:
1168 case OPCODE_UNIFORM_2IV:
1169 case OPCODE_UNIFORM_3IV:
1170 case OPCODE_UNIFORM_4IV:
1171 case OPCODE_UNIFORM_1UIV:
1172 case OPCODE_UNIFORM_2UIV:
1173 case OPCODE_UNIFORM_3UIV:
1174 case OPCODE_UNIFORM_4UIV:
1175 free(get_pointer(&n[3]));
1176 break;
1177 case OPCODE_UNIFORM_MATRIX22:
1178 case OPCODE_UNIFORM_MATRIX33:
1179 case OPCODE_UNIFORM_MATRIX44:
1180 case OPCODE_UNIFORM_MATRIX24:
1181 case OPCODE_UNIFORM_MATRIX42:
1182 case OPCODE_UNIFORM_MATRIX23:
1183 case OPCODE_UNIFORM_MATRIX32:
1184 case OPCODE_UNIFORM_MATRIX34:
1185 case OPCODE_UNIFORM_MATRIX43:
1186 case OPCODE_UNIFORM_MATRIX22D:
1187 case OPCODE_UNIFORM_MATRIX33D:
1188 case OPCODE_UNIFORM_MATRIX44D:
1189 case OPCODE_UNIFORM_MATRIX24D:
1190 case OPCODE_UNIFORM_MATRIX42D:
1191 case OPCODE_UNIFORM_MATRIX23D:
1192 case OPCODE_UNIFORM_MATRIX32D:
1193 case OPCODE_UNIFORM_MATRIX34D:
1194 case OPCODE_UNIFORM_MATRIX43D:
1195 free(get_pointer(&n[4]));
1196 break;
1197 case OPCODE_PROGRAM_UNIFORM_1FV:
1198 case OPCODE_PROGRAM_UNIFORM_2FV:
1199 case OPCODE_PROGRAM_UNIFORM_3FV:
1200 case OPCODE_PROGRAM_UNIFORM_4FV:
1201 case OPCODE_PROGRAM_UNIFORM_1DV:
1202 case OPCODE_PROGRAM_UNIFORM_2DV:
1203 case OPCODE_PROGRAM_UNIFORM_3DV:
1204 case OPCODE_PROGRAM_UNIFORM_4DV:
1205 case OPCODE_PROGRAM_UNIFORM_1IV:
1206 case OPCODE_PROGRAM_UNIFORM_2IV:
1207 case OPCODE_PROGRAM_UNIFORM_3IV:
1208 case OPCODE_PROGRAM_UNIFORM_4IV:
1209 case OPCODE_PROGRAM_UNIFORM_1UIV:
1210 case OPCODE_PROGRAM_UNIFORM_2UIV:
1211 case OPCODE_PROGRAM_UNIFORM_3UIV:
1212 case OPCODE_PROGRAM_UNIFORM_4UIV:
1213 free(get_pointer(&n[4]));
1214 break;
1215 case OPCODE_PROGRAM_UNIFORM_MATRIX22F:
1216 case OPCODE_PROGRAM_UNIFORM_MATRIX33F:
1217 case OPCODE_PROGRAM_UNIFORM_MATRIX44F:
1218 case OPCODE_PROGRAM_UNIFORM_MATRIX24F:
1219 case OPCODE_PROGRAM_UNIFORM_MATRIX42F:
1220 case OPCODE_PROGRAM_UNIFORM_MATRIX23F:
1221 case OPCODE_PROGRAM_UNIFORM_MATRIX32F:
1222 case OPCODE_PROGRAM_UNIFORM_MATRIX34F:
1223 case OPCODE_PROGRAM_UNIFORM_MATRIX43F:
1224 case OPCODE_PROGRAM_UNIFORM_MATRIX22D:
1225 case OPCODE_PROGRAM_UNIFORM_MATRIX33D:
1226 case OPCODE_PROGRAM_UNIFORM_MATRIX44D:
1227 case OPCODE_PROGRAM_UNIFORM_MATRIX24D:
1228 case OPCODE_PROGRAM_UNIFORM_MATRIX42D:
1229 case OPCODE_PROGRAM_UNIFORM_MATRIX23D:
1230 case OPCODE_PROGRAM_UNIFORM_MATRIX32D:
1231 case OPCODE_PROGRAM_UNIFORM_MATRIX34D:
1232 case OPCODE_PROGRAM_UNIFORM_MATRIX43D:
1233 free(get_pointer(&n[5]));
1234 break;
1235 case OPCODE_PIXEL_MAP:
1236 free(get_pointer(&n[3]));
1237 break;
1238 case OPCODE_VIEWPORT_ARRAY_V:
1239 case OPCODE_SCISSOR_ARRAY_V:
1240 case OPCODE_DEPTH_ARRAY_V:
1241 case OPCODE_UNIFORM_SUBROUTINES:
1242 case OPCODE_WINDOW_RECTANGLES:
1243 free(get_pointer(&n[3]));
1244 break;
1245 case OPCODE_TEXTURE_IMAGE1D:
1246 case OPCODE_MULTITEX_IMAGE1D:
1247 free(get_pointer(&n[9]));
1248 break;
1249 case OPCODE_TEXTURE_IMAGE2D:
1250 case OPCODE_MULTITEX_IMAGE2D:
1251 free(get_pointer(&n[10]));
1252 break;
1253 case OPCODE_TEXTURE_IMAGE3D:
1254 case OPCODE_MULTITEX_IMAGE3D:
1255 free(get_pointer(&n[11]));
1256 break;
1257 case OPCODE_TEXTURE_SUB_IMAGE1D:
1258 case OPCODE_MULTITEX_SUB_IMAGE1D:
1259 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_1D:
1260 case OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_1D:
1261 free(get_pointer(&n[8]));
1262 break;
1263 case OPCODE_TEXTURE_SUB_IMAGE2D:
1264 case OPCODE_MULTITEX_SUB_IMAGE2D:
1265 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_2D:
1266 case OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_2D:
1267 free(get_pointer(&n[10]));
1268 break;
1269 case OPCODE_TEXTURE_SUB_IMAGE3D:
1270 case OPCODE_MULTITEX_SUB_IMAGE3D:
1271 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_3D:
1272 case OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_3D:
1273 free(get_pointer(&n[12]));
1274 break;
1275 case OPCODE_COMPRESSED_TEXTURE_IMAGE_1D:
1276 case OPCODE_COMPRESSED_MULTITEX_IMAGE_1D:
1277 free(get_pointer(&n[8]));
1278 break;
1279 case OPCODE_COMPRESSED_TEXTURE_IMAGE_2D:
1280 case OPCODE_COMPRESSED_MULTITEX_IMAGE_2D:
1281 free(get_pointer(&n[9]));
1282 break;
1283 case OPCODE_COMPRESSED_TEXTURE_IMAGE_3D:
1284 case OPCODE_COMPRESSED_MULTITEX_IMAGE_3D:
1285 free(get_pointer(&n[10]));
1286 break;
1287
1288 case OPCODE_CONTINUE:
1289 n = (Node *) get_pointer(&n[1]);
1290 free(block);
1291 block = n;
1292 break;
1293 case OPCODE_END_OF_LIST:
1294 free(block);
1295 done = GL_TRUE;
1296 break;
1297 default:
1298 /* just increment 'n' pointer, below */
1299 ;
1300 }
1301
1302 if (opcode != OPCODE_CONTINUE) {
1303 assert(InstSize[opcode] > 0);
1304 n += InstSize[opcode];
1305 }
1306 }
1307 }
1308
1309 free(dlist->Label);
1310 free(dlist);
1311 }
1312
1313
1314 /**
1315 * Called by _mesa_HashWalk() to check if a display list which is being
1316 * deleted belongs to a bitmap texture atlas.
1317 */
1318 static void
1319 check_atlas_for_deleted_list(GLuint atlas_id, void *data, void *userData)
1320 {
1321 struct gl_bitmap_atlas *atlas = (struct gl_bitmap_atlas *) data;
1322 GLuint list_id = *((GLuint *) userData); /* the list being deleted */
1323
1324 /* See if the list_id falls in the range contained in this texture atlas */
1325 if (atlas->complete &&
1326 list_id >= atlas_id &&
1327 list_id < atlas_id + atlas->numBitmaps) {
1328 /* Mark the atlas as incomplete so it doesn't get used. But don't
1329 * delete it yet since we don't want to try to recreate it in the next
1330 * glCallLists.
1331 */
1332 atlas->complete = false;
1333 atlas->incomplete = true;
1334 }
1335 }
1336
1337
1338 /**
1339 * Destroy a display list and remove from hash table.
1340 * \param list - display list number
1341 */
1342 static void
1343 destroy_list(struct gl_context *ctx, GLuint list)
1344 {
1345 struct gl_display_list *dlist;
1346
1347 if (list == 0)
1348 return;
1349
1350 dlist = _mesa_lookup_list(ctx, list);
1351 if (!dlist)
1352 return;
1353
1354 if (is_bitmap_list(dlist)) {
1355 /* If we're destroying a simple glBitmap display list, there's a
1356 * chance that we're destroying a bitmap image that's in a texture
1357 * atlas. Examine all atlases to see if that's the case. There's
1358 * usually few (if any) atlases so this isn't expensive.
1359 */
1360 _mesa_HashWalk(ctx->Shared->BitmapAtlas,
1361 check_atlas_for_deleted_list, &list);
1362 }
1363
1364 _mesa_delete_list(ctx, dlist);
1365 _mesa_HashRemove(ctx->Shared->DisplayList, list);
1366 }
1367
1368
1369 /*
1370 * Translate the nth element of list from <type> to GLint.
1371 */
1372 static GLint
1373 translate_id(GLsizei n, GLenum type, const GLvoid * list)
1374 {
1375 GLbyte *bptr;
1376 GLubyte *ubptr;
1377 GLshort *sptr;
1378 GLushort *usptr;
1379 GLint *iptr;
1380 GLuint *uiptr;
1381 GLfloat *fptr;
1382
1383 switch (type) {
1384 case GL_BYTE:
1385 bptr = (GLbyte *) list;
1386 return (GLint) bptr[n];
1387 case GL_UNSIGNED_BYTE:
1388 ubptr = (GLubyte *) list;
1389 return (GLint) ubptr[n];
1390 case GL_SHORT:
1391 sptr = (GLshort *) list;
1392 return (GLint) sptr[n];
1393 case GL_UNSIGNED_SHORT:
1394 usptr = (GLushort *) list;
1395 return (GLint) usptr[n];
1396 case GL_INT:
1397 iptr = (GLint *) list;
1398 return iptr[n];
1399 case GL_UNSIGNED_INT:
1400 uiptr = (GLuint *) list;
1401 return (GLint) uiptr[n];
1402 case GL_FLOAT:
1403 fptr = (GLfloat *) list;
1404 return (GLint) floorf(fptr[n]);
1405 case GL_2_BYTES:
1406 ubptr = ((GLubyte *) list) + 2 * n;
1407 return (GLint) ubptr[0] * 256
1408 + (GLint) ubptr[1];
1409 case GL_3_BYTES:
1410 ubptr = ((GLubyte *) list) + 3 * n;
1411 return (GLint) ubptr[0] * 65536
1412 + (GLint) ubptr[1] * 256
1413 + (GLint) ubptr[2];
1414 case GL_4_BYTES:
1415 ubptr = ((GLubyte *) list) + 4 * n;
1416 return (GLint) ubptr[0] * 16777216
1417 + (GLint) ubptr[1] * 65536
1418 + (GLint) ubptr[2] * 256
1419 + (GLint) ubptr[3];
1420 default:
1421 return 0;
1422 }
1423 }
1424
1425
1426 /**
1427 * Wrapper for _mesa_unpack_image/bitmap() that handles pixel buffer objects.
1428 * If width < 0 or height < 0 or format or type are invalid we'll just
1429 * return NULL. We will not generate an error since OpenGL command
1430 * arguments aren't error-checked until the command is actually executed
1431 * (not when they're compiled).
1432 * But if we run out of memory, GL_OUT_OF_MEMORY will be recorded.
1433 */
1434 static GLvoid *
1435 unpack_image(struct gl_context *ctx, GLuint dimensions,
1436 GLsizei width, GLsizei height, GLsizei depth,
1437 GLenum format, GLenum type, const GLvoid * pixels,
1438 const struct gl_pixelstore_attrib *unpack)
1439 {
1440 if (width <= 0 || height <= 0) {
1441 return NULL;
1442 }
1443
1444 if (_mesa_bytes_per_pixel(format, type) < 0) {
1445 /* bad format and/or type */
1446 return NULL;
1447 }
1448
1449 if (!_mesa_is_bufferobj(unpack->BufferObj)) {
1450 /* no PBO */
1451 GLvoid *image;
1452
1453 image = _mesa_unpack_image(dimensions, width, height, depth,
1454 format, type, pixels, unpack);
1455 if (pixels && !image) {
1456 _mesa_error(ctx, GL_OUT_OF_MEMORY, "display list construction");
1457 }
1458 return image;
1459 }
1460 else if (_mesa_validate_pbo_access(dimensions, unpack, width, height,
1461 depth, format, type, INT_MAX, pixels)) {
1462 const GLubyte *map, *src;
1463 GLvoid *image;
1464
1465 map = (GLubyte *)
1466 ctx->Driver.MapBufferRange(ctx, 0, unpack->BufferObj->Size,
1467 GL_MAP_READ_BIT, unpack->BufferObj,
1468 MAP_INTERNAL);
1469 if (!map) {
1470 /* unable to map src buffer! */
1471 _mesa_error(ctx, GL_INVALID_OPERATION, "unable to map PBO");
1472 return NULL;
1473 }
1474
1475 src = ADD_POINTERS(map, pixels);
1476 image = _mesa_unpack_image(dimensions, width, height, depth,
1477 format, type, src, unpack);
1478
1479 ctx->Driver.UnmapBuffer(ctx, unpack->BufferObj, MAP_INTERNAL);
1480
1481 if (!image) {
1482 _mesa_error(ctx, GL_OUT_OF_MEMORY, "display list construction");
1483 }
1484 return image;
1485 }
1486
1487 /* bad access! */
1488 _mesa_error(ctx, GL_INVALID_OPERATION, "invalid PBO access");
1489 return NULL;
1490 }
1491
1492
1493 /** Return copy of memory */
1494 static void *
1495 memdup(const void *src, GLsizei bytes)
1496 {
1497 void *b = bytes >= 0 ? malloc(bytes) : NULL;
1498 if (b)
1499 memcpy(b, src, bytes);
1500 return b;
1501 }
1502
1503
1504 /**
1505 * Allocate space for a display list instruction (opcode + payload space).
1506 * \param opcode the instruction opcode (OPCODE_* value)
1507 * \param bytes instruction payload size (not counting opcode)
1508 * \param align8 does the payload need to be 8-byte aligned?
1509 * This is only relevant in 64-bit environments.
1510 * \return pointer to allocated memory (the payload will be at pointer+1)
1511 */
1512 static Node *
1513 dlist_alloc(struct gl_context *ctx, OpCode opcode, GLuint bytes, bool align8)
1514 {
1515 const GLuint numNodes = 1 + (bytes + sizeof(Node) - 1) / sizeof(Node);
1516 const GLuint contNodes = 1 + POINTER_DWORDS; /* size of continue info */
1517 GLuint nopNode;
1518 Node *n;
1519
1520 assert(bytes <= BLOCK_SIZE * sizeof(Node));
1521
1522 if (opcode < OPCODE_EXT_0) {
1523 if (InstSize[opcode] == 0) {
1524 /* save instruction size now */
1525 InstSize[opcode] = numNodes;
1526 }
1527 else {
1528 /* make sure instruction size agrees */
1529 assert(numNodes == InstSize[opcode]);
1530 }
1531 }
1532
1533 if (sizeof(void *) > sizeof(Node) && align8
1534 && ctx->ListState.CurrentPos % 2 == 0) {
1535 /* The opcode would get placed at node[0] and the payload would start
1536 * at node[1]. But the payload needs to be at an even offset (8-byte
1537 * multiple).
1538 */
1539 nopNode = 1;
1540 }
1541 else {
1542 nopNode = 0;
1543 }
1544
1545 if (ctx->ListState.CurrentPos + nopNode + numNodes + contNodes
1546 > BLOCK_SIZE) {
1547 /* This block is full. Allocate a new block and chain to it */
1548 Node *newblock;
1549 n = ctx->ListState.CurrentBlock + ctx->ListState.CurrentPos;
1550 n[0].opcode = OPCODE_CONTINUE;
1551 newblock = malloc(sizeof(Node) * BLOCK_SIZE);
1552 if (!newblock) {
1553 _mesa_error(ctx, GL_OUT_OF_MEMORY, "Building display list");
1554 return NULL;
1555 }
1556
1557 /* a fresh block should be 8-byte aligned on 64-bit systems */
1558 assert(((GLintptr) newblock) % sizeof(void *) == 0);
1559
1560 save_pointer(&n[1], newblock);
1561 ctx->ListState.CurrentBlock = newblock;
1562 ctx->ListState.CurrentPos = 0;
1563
1564 /* Display list nodes are always 4 bytes. If we need 8-byte alignment
1565 * we have to insert a NOP so that the payload of the real opcode lands
1566 * on an even location:
1567 * node[0] = OPCODE_NOP
1568 * node[1] = OPCODE_x;
1569 * node[2] = start of payload
1570 */
1571 nopNode = sizeof(void *) > sizeof(Node) && align8;
1572 }
1573
1574 n = ctx->ListState.CurrentBlock + ctx->ListState.CurrentPos;
1575 if (nopNode) {
1576 assert(ctx->ListState.CurrentPos % 2 == 0); /* even value */
1577 n[0].opcode = OPCODE_NOP;
1578 n++;
1579 /* The "real" opcode will now be at an odd location and the payload
1580 * will be at an even location.
1581 */
1582 }
1583 ctx->ListState.CurrentPos += nopNode + numNodes;
1584
1585 n[0].opcode = opcode;
1586
1587 return n;
1588 }
1589
1590
1591
1592 /**
1593 * Allocate space for a display list instruction. Used by callers outside
1594 * this file for things like VBO vertex data.
1595 *
1596 * \param opcode the instruction opcode (OPCODE_* value)
1597 * \param bytes instruction size in bytes, not counting opcode.
1598 * \return pointer to the usable data area (not including the internal
1599 * opcode).
1600 */
1601 void *
1602 _mesa_dlist_alloc(struct gl_context *ctx, GLuint opcode, GLuint bytes)
1603 {
1604 Node *n = dlist_alloc(ctx, (OpCode) opcode, bytes, false);
1605 if (n)
1606 return n + 1; /* return pointer to payload area, after opcode */
1607 else
1608 return NULL;
1609 }
1610
1611
1612 /**
1613 * Same as _mesa_dlist_alloc(), but return a pointer which is 8-byte
1614 * aligned in 64-bit environments, 4-byte aligned otherwise.
1615 */
1616 void *
1617 _mesa_dlist_alloc_aligned(struct gl_context *ctx, GLuint opcode, GLuint bytes)
1618 {
1619 Node *n = dlist_alloc(ctx, (OpCode) opcode, bytes, true);
1620 if (n)
1621 return n + 1; /* return pointer to payload area, after opcode */
1622 else
1623 return NULL;
1624 }
1625
1626
1627 /**
1628 * This function allows modules and drivers to get their own opcodes
1629 * for extending display list functionality.
1630 * \param ctx the rendering context
1631 * \param size number of bytes for storing the new display list command
1632 * \param execute function to execute the new display list command
1633 * \param destroy function to destroy the new display list command
1634 * \param print function to print the new display list command
1635 * \return the new opcode number or -1 if error
1636 */
1637 GLint
1638 _mesa_dlist_alloc_opcode(struct gl_context *ctx,
1639 GLuint size,
1640 void (*execute) (struct gl_context *, void *),
1641 void (*destroy) (struct gl_context *, void *),
1642 void (*print) (struct gl_context *, void *, FILE *))
1643 {
1644 if (ctx->ListExt->NumOpcodes < MAX_DLIST_EXT_OPCODES) {
1645 const GLuint i = ctx->ListExt->NumOpcodes++;
1646 ctx->ListExt->Opcode[i].Size =
1647 1 + (size + sizeof(Node) - 1) / sizeof(Node);
1648 ctx->ListExt->Opcode[i].Execute = execute;
1649 ctx->ListExt->Opcode[i].Destroy = destroy;
1650 ctx->ListExt->Opcode[i].Print = print;
1651 return i + OPCODE_EXT_0;
1652 }
1653 return -1;
1654 }
1655
1656
1657 /**
1658 * Allocate space for a display list instruction. The space is basically
1659 * an array of Nodes where node[0] holds the opcode, node[1] is the first
1660 * function parameter, node[2] is the second parameter, etc.
1661 *
1662 * \param opcode one of OPCODE_x
1663 * \param nparams number of function parameters
1664 * \return pointer to start of instruction space
1665 */
1666 static inline Node *
1667 alloc_instruction(struct gl_context *ctx, OpCode opcode, GLuint nparams)
1668 {
1669 return dlist_alloc(ctx, opcode, nparams * sizeof(Node), false);
1670 }
1671
1672
1673 /**
1674 * Called by EndList to try to reduce memory used for the list.
1675 */
1676 static void
1677 trim_list(struct gl_context *ctx)
1678 {
1679 /* If the list we're ending only has one allocated block of nodes/tokens
1680 * and its size isn't a full block size, realloc the block to use less
1681 * memory. This is important for apps that create many small display
1682 * lists and apps that use glXUseXFont (many lists each containing one
1683 * glBitmap call).
1684 * Note: we currently only trim display lists that allocated one block
1685 * of tokens. That hits the short list case which is what we're mainly
1686 * concerned with. Trimming longer lists would involve traversing the
1687 * linked list of blocks.
1688 */
1689 struct gl_dlist_state *list = &ctx->ListState;
1690
1691 if ((list->CurrentList->Head == list->CurrentBlock) &&
1692 (list->CurrentPos < BLOCK_SIZE)) {
1693 /* There's only one block and it's not full, so realloc */
1694 GLuint newSize = list->CurrentPos * sizeof(Node);
1695 list->CurrentList->Head =
1696 list->CurrentBlock = realloc(list->CurrentBlock, newSize);
1697 if (!list->CurrentBlock) {
1698 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glEndList");
1699 }
1700 }
1701 }
1702
1703
1704
1705 /*
1706 * Display List compilation functions
1707 */
1708 static void GLAPIENTRY
1709 save_Accum(GLenum op, GLfloat value)
1710 {
1711 GET_CURRENT_CONTEXT(ctx);
1712 Node *n;
1713 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1714 n = alloc_instruction(ctx, OPCODE_ACCUM, 2);
1715 if (n) {
1716 n[1].e = op;
1717 n[2].f = value;
1718 }
1719 if (ctx->ExecuteFlag) {
1720 CALL_Accum(ctx->Exec, (op, value));
1721 }
1722 }
1723
1724
1725 static void GLAPIENTRY
1726 save_AlphaFunc(GLenum func, GLclampf ref)
1727 {
1728 GET_CURRENT_CONTEXT(ctx);
1729 Node *n;
1730 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1731 n = alloc_instruction(ctx, OPCODE_ALPHA_FUNC, 2);
1732 if (n) {
1733 n[1].e = func;
1734 n[2].f = (GLfloat) ref;
1735 }
1736 if (ctx->ExecuteFlag) {
1737 CALL_AlphaFunc(ctx->Exec, (func, ref));
1738 }
1739 }
1740
1741
1742 static void GLAPIENTRY
1743 save_BindTexture(GLenum target, GLuint texture)
1744 {
1745 GET_CURRENT_CONTEXT(ctx);
1746 Node *n;
1747 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1748 n = alloc_instruction(ctx, OPCODE_BIND_TEXTURE, 2);
1749 if (n) {
1750 n[1].e = target;
1751 n[2].ui = texture;
1752 }
1753 if (ctx->ExecuteFlag) {
1754 CALL_BindTexture(ctx->Exec, (target, texture));
1755 }
1756 }
1757
1758
1759 static void GLAPIENTRY
1760 save_Bitmap(GLsizei width, GLsizei height,
1761 GLfloat xorig, GLfloat yorig,
1762 GLfloat xmove, GLfloat ymove, const GLubyte * pixels)
1763 {
1764 GET_CURRENT_CONTEXT(ctx);
1765 Node *n;
1766 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1767 n = alloc_instruction(ctx, OPCODE_BITMAP, 6 + POINTER_DWORDS);
1768 if (n) {
1769 n[1].i = (GLint) width;
1770 n[2].i = (GLint) height;
1771 n[3].f = xorig;
1772 n[4].f = yorig;
1773 n[5].f = xmove;
1774 n[6].f = ymove;
1775 save_pointer(&n[7],
1776 unpack_image(ctx, 2, width, height, 1, GL_COLOR_INDEX,
1777 GL_BITMAP, pixels, &ctx->Unpack));
1778 }
1779 if (ctx->ExecuteFlag) {
1780 CALL_Bitmap(ctx->Exec, (width, height,
1781 xorig, yorig, xmove, ymove, pixels));
1782 }
1783 }
1784
1785
1786 static void GLAPIENTRY
1787 save_BlendEquation(GLenum mode)
1788 {
1789 GET_CURRENT_CONTEXT(ctx);
1790 Node *n;
1791 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1792 n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION, 1);
1793 if (n) {
1794 n[1].e = mode;
1795 }
1796 if (ctx->ExecuteFlag) {
1797 CALL_BlendEquation(ctx->Exec, (mode));
1798 }
1799 }
1800
1801
1802 static void GLAPIENTRY
1803 save_BlendEquationSeparateEXT(GLenum modeRGB, GLenum modeA)
1804 {
1805 GET_CURRENT_CONTEXT(ctx);
1806 Node *n;
1807 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1808 n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION_SEPARATE, 2);
1809 if (n) {
1810 n[1].e = modeRGB;
1811 n[2].e = modeA;
1812 }
1813 if (ctx->ExecuteFlag) {
1814 CALL_BlendEquationSeparate(ctx->Exec, (modeRGB, modeA));
1815 }
1816 }
1817
1818
1819 static void GLAPIENTRY
1820 save_BlendFuncSeparateEXT(GLenum sfactorRGB, GLenum dfactorRGB,
1821 GLenum sfactorA, GLenum dfactorA)
1822 {
1823 GET_CURRENT_CONTEXT(ctx);
1824 Node *n;
1825 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1826 n = alloc_instruction(ctx, OPCODE_BLEND_FUNC_SEPARATE, 4);
1827 if (n) {
1828 n[1].e = sfactorRGB;
1829 n[2].e = dfactorRGB;
1830 n[3].e = sfactorA;
1831 n[4].e = dfactorA;
1832 }
1833 if (ctx->ExecuteFlag) {
1834 CALL_BlendFuncSeparate(ctx->Exec,
1835 (sfactorRGB, dfactorRGB, sfactorA, dfactorA));
1836 }
1837 }
1838
1839
1840 static void GLAPIENTRY
1841 save_BlendFunc(GLenum srcfactor, GLenum dstfactor)
1842 {
1843 save_BlendFuncSeparateEXT(srcfactor, dstfactor, srcfactor, dstfactor);
1844 }
1845
1846
1847 static void GLAPIENTRY
1848 save_BlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
1849 {
1850 GET_CURRENT_CONTEXT(ctx);
1851 Node *n;
1852 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1853 n = alloc_instruction(ctx, OPCODE_BLEND_COLOR, 4);
1854 if (n) {
1855 n[1].f = red;
1856 n[2].f = green;
1857 n[3].f = blue;
1858 n[4].f = alpha;
1859 }
1860 if (ctx->ExecuteFlag) {
1861 CALL_BlendColor(ctx->Exec, (red, green, blue, alpha));
1862 }
1863 }
1864
1865 /* GL_ARB_draw_buffers_blend */
1866 static void GLAPIENTRY
1867 save_BlendFuncSeparatei(GLuint buf, GLenum sfactorRGB, GLenum dfactorRGB,
1868 GLenum sfactorA, GLenum dfactorA)
1869 {
1870 GET_CURRENT_CONTEXT(ctx);
1871 Node *n;
1872 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1873 n = alloc_instruction(ctx, OPCODE_BLEND_FUNC_SEPARATE_I, 5);
1874 if (n) {
1875 n[1].ui = buf;
1876 n[2].e = sfactorRGB;
1877 n[3].e = dfactorRGB;
1878 n[4].e = sfactorA;
1879 n[5].e = dfactorA;
1880 }
1881 if (ctx->ExecuteFlag) {
1882 CALL_BlendFuncSeparateiARB(ctx->Exec, (buf, sfactorRGB, dfactorRGB,
1883 sfactorA, dfactorA));
1884 }
1885 }
1886
1887 /* GL_ARB_draw_buffers_blend */
1888 static void GLAPIENTRY
1889 save_BlendFunci(GLuint buf, GLenum sfactor, GLenum dfactor)
1890 {
1891 GET_CURRENT_CONTEXT(ctx);
1892 Node *n;
1893 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1894 n = alloc_instruction(ctx, OPCODE_BLEND_FUNC_I, 3);
1895 if (n) {
1896 n[1].ui = buf;
1897 n[2].e = sfactor;
1898 n[3].e = dfactor;
1899 }
1900 if (ctx->ExecuteFlag) {
1901 CALL_BlendFunciARB(ctx->Exec, (buf, sfactor, dfactor));
1902 }
1903 }
1904
1905 /* GL_ARB_draw_buffers_blend */
1906 static void GLAPIENTRY
1907 save_BlendEquationi(GLuint buf, GLenum mode)
1908 {
1909 GET_CURRENT_CONTEXT(ctx);
1910 Node *n;
1911 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1912 n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION_I, 2);
1913 if (n) {
1914 n[1].ui = buf;
1915 n[2].e = mode;
1916 }
1917 if (ctx->ExecuteFlag) {
1918 CALL_BlendEquationiARB(ctx->Exec, (buf, mode));
1919 }
1920 }
1921
1922 /* GL_ARB_draw_buffers_blend */
1923 static void GLAPIENTRY
1924 save_BlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeA)
1925 {
1926 GET_CURRENT_CONTEXT(ctx);
1927 Node *n;
1928 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1929 n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION_SEPARATE_I, 3);
1930 if (n) {
1931 n[1].ui = buf;
1932 n[2].e = modeRGB;
1933 n[3].e = modeA;
1934 }
1935 if (ctx->ExecuteFlag) {
1936 CALL_BlendEquationSeparateiARB(ctx->Exec, (buf, modeRGB, modeA));
1937 }
1938 }
1939
1940
1941 /* GL_ARB_draw_instanced. */
1942 static void GLAPIENTRY
1943 save_DrawArraysInstancedARB(UNUSED GLenum mode,
1944 UNUSED GLint first,
1945 UNUSED GLsizei count,
1946 UNUSED GLsizei primcount)
1947 {
1948 GET_CURRENT_CONTEXT(ctx);
1949 _mesa_error(ctx, GL_INVALID_OPERATION,
1950 "glDrawArraysInstanced() during display list compile");
1951 }
1952
1953 static void GLAPIENTRY
1954 save_DrawElementsInstancedARB(UNUSED GLenum mode,
1955 UNUSED GLsizei count,
1956 UNUSED GLenum type,
1957 UNUSED const GLvoid *indices,
1958 UNUSED GLsizei primcount)
1959 {
1960 GET_CURRENT_CONTEXT(ctx);
1961 _mesa_error(ctx, GL_INVALID_OPERATION,
1962 "glDrawElementsInstanced() during display list compile");
1963 }
1964
1965 static void GLAPIENTRY
1966 save_DrawElementsInstancedBaseVertexARB(UNUSED GLenum mode,
1967 UNUSED GLsizei count,
1968 UNUSED GLenum type,
1969 UNUSED const GLvoid *indices,
1970 UNUSED GLsizei primcount,
1971 UNUSED GLint basevertex)
1972 {
1973 GET_CURRENT_CONTEXT(ctx);
1974 _mesa_error(ctx, GL_INVALID_OPERATION,
1975 "glDrawElementsInstancedBaseVertex() during display list compile");
1976 }
1977
1978 /* GL_ARB_base_instance. */
1979 static void GLAPIENTRY
1980 save_DrawArraysInstancedBaseInstance(UNUSED GLenum mode,
1981 UNUSED GLint first,
1982 UNUSED GLsizei count,
1983 UNUSED GLsizei primcount,
1984 UNUSED GLuint baseinstance)
1985 {
1986 GET_CURRENT_CONTEXT(ctx);
1987 _mesa_error(ctx, GL_INVALID_OPERATION,
1988 "glDrawArraysInstancedBaseInstance() during display list compile");
1989 }
1990
1991 static void APIENTRY
1992 save_DrawElementsInstancedBaseInstance(UNUSED GLenum mode,
1993 UNUSED GLsizei count,
1994 UNUSED GLenum type,
1995 UNUSED const void *indices,
1996 UNUSED GLsizei primcount,
1997 UNUSED GLuint baseinstance)
1998 {
1999 GET_CURRENT_CONTEXT(ctx);
2000 _mesa_error(ctx, GL_INVALID_OPERATION,
2001 "glDrawElementsInstancedBaseInstance() during display list compile");
2002 }
2003
2004 static void APIENTRY
2005 save_DrawElementsInstancedBaseVertexBaseInstance(UNUSED GLenum mode,
2006 UNUSED GLsizei count,
2007 UNUSED GLenum type,
2008 UNUSED const void *indices,
2009 UNUSED GLsizei primcount,
2010 UNUSED GLint basevertex,
2011 UNUSED GLuint baseinstance)
2012 {
2013 GET_CURRENT_CONTEXT(ctx);
2014 _mesa_error(ctx, GL_INVALID_OPERATION,
2015 "glDrawElementsInstancedBaseVertexBaseInstance() during display list compile");
2016 }
2017
2018 static void APIENTRY
2019 save_DrawArraysIndirect(UNUSED GLenum mode,
2020 UNUSED const void *indirect)
2021 {
2022 GET_CURRENT_CONTEXT(ctx);
2023 _mesa_error(ctx, GL_INVALID_OPERATION,
2024 "glDrawArraysIndirect() during display list compile");
2025 }
2026
2027 static void APIENTRY
2028 save_DrawElementsIndirect(UNUSED GLenum mode,
2029 UNUSED GLenum type,
2030 UNUSED const void *indirect)
2031 {
2032 GET_CURRENT_CONTEXT(ctx);
2033 _mesa_error(ctx, GL_INVALID_OPERATION,
2034 "glDrawElementsIndirect() during display list compile");
2035 }
2036
2037 static void APIENTRY
2038 save_MultiDrawArraysIndirect(UNUSED GLenum mode,
2039 UNUSED const void *indirect,
2040 UNUSED GLsizei primcount,
2041 UNUSED GLsizei stride)
2042 {
2043 GET_CURRENT_CONTEXT(ctx);
2044 _mesa_error(ctx, GL_INVALID_OPERATION,
2045 "glMultiDrawArraysIndirect() during display list compile");
2046 }
2047
2048 static void APIENTRY
2049 save_MultiDrawElementsIndirect(UNUSED GLenum mode,
2050 UNUSED GLenum type,
2051 UNUSED const void *indirect,
2052 UNUSED GLsizei primcount,
2053 UNUSED GLsizei stride)
2054 {
2055 GET_CURRENT_CONTEXT(ctx);
2056 _mesa_error(ctx, GL_INVALID_OPERATION,
2057 "glMultiDrawElementsIndirect() during display list compile");
2058 }
2059
2060 /**
2061 * While building a display list we cache some OpenGL state.
2062 * Under some circumstances we need to invalidate that state (immediately
2063 * when we start compiling a list, or after glCallList(s)).
2064 */
2065 static void
2066 invalidate_saved_current_state(struct gl_context *ctx)
2067 {
2068 GLint i;
2069
2070 for (i = 0; i < VERT_ATTRIB_MAX; i++)
2071 ctx->ListState.ActiveAttribSize[i] = 0;
2072
2073 for (i = 0; i < MAT_ATTRIB_MAX; i++)
2074 ctx->ListState.ActiveMaterialSize[i] = 0;
2075
2076 memset(&ctx->ListState.Current, 0, sizeof ctx->ListState.Current);
2077
2078 ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN;
2079 }
2080
2081
2082 static void GLAPIENTRY
2083 save_CallList(GLuint list)
2084 {
2085 GET_CURRENT_CONTEXT(ctx);
2086 Node *n;
2087 SAVE_FLUSH_VERTICES(ctx);
2088
2089 n = alloc_instruction(ctx, OPCODE_CALL_LIST, 1);
2090 if (n) {
2091 n[1].ui = list;
2092 }
2093
2094 /* After this, we don't know what state we're in. Invalidate all
2095 * cached information previously gathered:
2096 */
2097 invalidate_saved_current_state( ctx );
2098
2099 if (ctx->ExecuteFlag) {
2100 _mesa_CallList(list);
2101 }
2102 }
2103
2104
2105 static void GLAPIENTRY
2106 save_CallLists(GLsizei num, GLenum type, const GLvoid * lists)
2107 {
2108 GET_CURRENT_CONTEXT(ctx);
2109 unsigned type_size;
2110 Node *n;
2111 void *lists_copy;
2112
2113 SAVE_FLUSH_VERTICES(ctx);
2114
2115 switch (type) {
2116 case GL_BYTE:
2117 case GL_UNSIGNED_BYTE:
2118 type_size = 1;
2119 break;
2120 case GL_SHORT:
2121 case GL_UNSIGNED_SHORT:
2122 case GL_2_BYTES:
2123 type_size = 2;
2124 break;
2125 case GL_3_BYTES:
2126 type_size = 3;
2127 break;
2128 case GL_INT:
2129 case GL_UNSIGNED_INT:
2130 case GL_FLOAT:
2131 case GL_4_BYTES:
2132 type_size = 4;
2133 break;
2134 default:
2135 type_size = 0;
2136 }
2137
2138 if (num > 0 && type_size > 0) {
2139 /* create a copy of the array of list IDs to save in the display list */
2140 lists_copy = memdup(lists, num * type_size);
2141 } else {
2142 lists_copy = NULL;
2143 }
2144
2145 n = alloc_instruction(ctx, OPCODE_CALL_LISTS, 2 + POINTER_DWORDS);
2146 if (n) {
2147 n[1].i = num;
2148 n[2].e = type;
2149 save_pointer(&n[3], lists_copy);
2150 }
2151
2152 /* After this, we don't know what state we're in. Invalidate all
2153 * cached information previously gathered:
2154 */
2155 invalidate_saved_current_state( ctx );
2156
2157 if (ctx->ExecuteFlag) {
2158 CALL_CallLists(ctx->Exec, (num, type, lists));
2159 }
2160 }
2161
2162
2163 static void GLAPIENTRY
2164 save_Clear(GLbitfield mask)
2165 {
2166 GET_CURRENT_CONTEXT(ctx);
2167 Node *n;
2168 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2169 n = alloc_instruction(ctx, OPCODE_CLEAR, 1);
2170 if (n) {
2171 n[1].bf = mask;
2172 }
2173 if (ctx->ExecuteFlag) {
2174 CALL_Clear(ctx->Exec, (mask));
2175 }
2176 }
2177
2178
2179 static void GLAPIENTRY
2180 save_ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value)
2181 {
2182 GET_CURRENT_CONTEXT(ctx);
2183 Node *n;
2184 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2185 n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_IV, 6);
2186 if (n) {
2187 n[1].e = buffer;
2188 n[2].i = drawbuffer;
2189 n[3].i = value[0];
2190 if (buffer == GL_COLOR) {
2191 n[4].i = value[1];
2192 n[5].i = value[2];
2193 n[6].i = value[3];
2194 }
2195 else {
2196 n[4].i = 0;
2197 n[5].i = 0;
2198 n[6].i = 0;
2199 }
2200 }
2201 if (ctx->ExecuteFlag) {
2202 CALL_ClearBufferiv(ctx->Exec, (buffer, drawbuffer, value));
2203 }
2204 }
2205
2206
2207 static void GLAPIENTRY
2208 save_ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value)
2209 {
2210 GET_CURRENT_CONTEXT(ctx);
2211 Node *n;
2212 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2213 n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_UIV, 6);
2214 if (n) {
2215 n[1].e = buffer;
2216 n[2].i = drawbuffer;
2217 n[3].ui = value[0];
2218 if (buffer == GL_COLOR) {
2219 n[4].ui = value[1];
2220 n[5].ui = value[2];
2221 n[6].ui = value[3];
2222 }
2223 else {
2224 n[4].ui = 0;
2225 n[5].ui = 0;
2226 n[6].ui = 0;
2227 }
2228 }
2229 if (ctx->ExecuteFlag) {
2230 CALL_ClearBufferuiv(ctx->Exec, (buffer, drawbuffer, value));
2231 }
2232 }
2233
2234
2235 static void GLAPIENTRY
2236 save_ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
2237 {
2238 GET_CURRENT_CONTEXT(ctx);
2239 Node *n;
2240 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2241 n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_FV, 6);
2242 if (n) {
2243 n[1].e = buffer;
2244 n[2].i = drawbuffer;
2245 n[3].f = value[0];
2246 if (buffer == GL_COLOR) {
2247 n[4].f = value[1];
2248 n[5].f = value[2];
2249 n[6].f = value[3];
2250 }
2251 else {
2252 n[4].f = 0.0F;
2253 n[5].f = 0.0F;
2254 n[6].f = 0.0F;
2255 }
2256 }
2257 if (ctx->ExecuteFlag) {
2258 CALL_ClearBufferfv(ctx->Exec, (buffer, drawbuffer, value));
2259 }
2260 }
2261
2262
2263 static void GLAPIENTRY
2264 save_ClearBufferfi(GLenum buffer, GLint drawbuffer,
2265 GLfloat depth, GLint stencil)
2266 {
2267 GET_CURRENT_CONTEXT(ctx);
2268 Node *n;
2269 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2270 n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_FI, 4);
2271 if (n) {
2272 n[1].e = buffer;
2273 n[2].i = drawbuffer;
2274 n[3].f = depth;
2275 n[4].i = stencil;
2276 }
2277 if (ctx->ExecuteFlag) {
2278 CALL_ClearBufferfi(ctx->Exec, (buffer, drawbuffer, depth, stencil));
2279 }
2280 }
2281
2282
2283 static void GLAPIENTRY
2284 save_ClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
2285 {
2286 GET_CURRENT_CONTEXT(ctx);
2287 Node *n;
2288 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2289 n = alloc_instruction(ctx, OPCODE_CLEAR_ACCUM, 4);
2290 if (n) {
2291 n[1].f = red;
2292 n[2].f = green;
2293 n[3].f = blue;
2294 n[4].f = alpha;
2295 }
2296 if (ctx->ExecuteFlag) {
2297 CALL_ClearAccum(ctx->Exec, (red, green, blue, alpha));
2298 }
2299 }
2300
2301
2302 static void GLAPIENTRY
2303 save_ClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
2304 {
2305 GET_CURRENT_CONTEXT(ctx);
2306 Node *n;
2307 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2308 n = alloc_instruction(ctx, OPCODE_CLEAR_COLOR, 4);
2309 if (n) {
2310 n[1].f = red;
2311 n[2].f = green;
2312 n[3].f = blue;
2313 n[4].f = alpha;
2314 }
2315 if (ctx->ExecuteFlag) {
2316 CALL_ClearColor(ctx->Exec, (red, green, blue, alpha));
2317 }
2318 }
2319
2320
2321 static void GLAPIENTRY
2322 save_ClearDepth(GLclampd depth)
2323 {
2324 GET_CURRENT_CONTEXT(ctx);
2325 Node *n;
2326 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2327 n = alloc_instruction(ctx, OPCODE_CLEAR_DEPTH, 1);
2328 if (n) {
2329 n[1].f = (GLfloat) depth;
2330 }
2331 if (ctx->ExecuteFlag) {
2332 CALL_ClearDepth(ctx->Exec, (depth));
2333 }
2334 }
2335
2336
2337 static void GLAPIENTRY
2338 save_ClearIndex(GLfloat c)
2339 {
2340 GET_CURRENT_CONTEXT(ctx);
2341 Node *n;
2342 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2343 n = alloc_instruction(ctx, OPCODE_CLEAR_INDEX, 1);
2344 if (n) {
2345 n[1].f = c;
2346 }
2347 if (ctx->ExecuteFlag) {
2348 CALL_ClearIndex(ctx->Exec, (c));
2349 }
2350 }
2351
2352
2353 static void GLAPIENTRY
2354 save_ClearStencil(GLint s)
2355 {
2356 GET_CURRENT_CONTEXT(ctx);
2357 Node *n;
2358 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2359 n = alloc_instruction(ctx, OPCODE_CLEAR_STENCIL, 1);
2360 if (n) {
2361 n[1].i = s;
2362 }
2363 if (ctx->ExecuteFlag) {
2364 CALL_ClearStencil(ctx->Exec, (s));
2365 }
2366 }
2367
2368
2369 static void GLAPIENTRY
2370 save_ClipPlane(GLenum plane, const GLdouble * equ)
2371 {
2372 GET_CURRENT_CONTEXT(ctx);
2373 Node *n;
2374 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2375 n = alloc_instruction(ctx, OPCODE_CLIP_PLANE, 5);
2376 if (n) {
2377 n[1].e = plane;
2378 n[2].f = (GLfloat) equ[0];
2379 n[3].f = (GLfloat) equ[1];
2380 n[4].f = (GLfloat) equ[2];
2381 n[5].f = (GLfloat) equ[3];
2382 }
2383 if (ctx->ExecuteFlag) {
2384 CALL_ClipPlane(ctx->Exec, (plane, equ));
2385 }
2386 }
2387
2388
2389
2390 static void GLAPIENTRY
2391 save_ColorMask(GLboolean red, GLboolean green,
2392 GLboolean blue, GLboolean alpha)
2393 {
2394 GET_CURRENT_CONTEXT(ctx);
2395 Node *n;
2396 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2397 n = alloc_instruction(ctx, OPCODE_COLOR_MASK, 4);
2398 if (n) {
2399 n[1].b = red;
2400 n[2].b = green;
2401 n[3].b = blue;
2402 n[4].b = alpha;
2403 }
2404 if (ctx->ExecuteFlag) {
2405 CALL_ColorMask(ctx->Exec, (red, green, blue, alpha));
2406 }
2407 }
2408
2409
2410 static void GLAPIENTRY
2411 save_ColorMaskIndexed(GLuint buf, GLboolean red, GLboolean green,
2412 GLboolean blue, GLboolean alpha)
2413 {
2414 GET_CURRENT_CONTEXT(ctx);
2415 Node *n;
2416 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2417 n = alloc_instruction(ctx, OPCODE_COLOR_MASK_INDEXED, 5);
2418 if (n) {
2419 n[1].ui = buf;
2420 n[2].b = red;
2421 n[3].b = green;
2422 n[4].b = blue;
2423 n[5].b = alpha;
2424 }
2425 if (ctx->ExecuteFlag) {
2426 /*CALL_ColorMaski(ctx->Exec, (buf, red, green, blue, alpha));*/
2427 }
2428 }
2429
2430
2431 static void GLAPIENTRY
2432 save_ColorMaterial(GLenum face, GLenum mode)
2433 {
2434 GET_CURRENT_CONTEXT(ctx);
2435 Node *n;
2436 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2437
2438 n = alloc_instruction(ctx, OPCODE_COLOR_MATERIAL, 2);
2439 if (n) {
2440 n[1].e = face;
2441 n[2].e = mode;
2442 }
2443 if (ctx->ExecuteFlag) {
2444 CALL_ColorMaterial(ctx->Exec, (face, mode));
2445 }
2446 }
2447
2448
2449 static void GLAPIENTRY
2450 save_CopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type)
2451 {
2452 GET_CURRENT_CONTEXT(ctx);
2453 Node *n;
2454 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2455 n = alloc_instruction(ctx, OPCODE_COPY_PIXELS, 5);
2456 if (n) {
2457 n[1].i = x;
2458 n[2].i = y;
2459 n[3].i = (GLint) width;
2460 n[4].i = (GLint) height;
2461 n[5].e = type;
2462 }
2463 if (ctx->ExecuteFlag) {
2464 CALL_CopyPixels(ctx->Exec, (x, y, width, height, type));
2465 }
2466 }
2467
2468
2469
2470 static void GLAPIENTRY
2471 save_CopyTexImage1D(GLenum target, GLint level, GLenum internalformat,
2472 GLint x, GLint y, GLsizei width, GLint border)
2473 {
2474 GET_CURRENT_CONTEXT(ctx);
2475 Node *n;
2476 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2477 n = alloc_instruction(ctx, OPCODE_COPY_TEX_IMAGE1D, 7);
2478 if (n) {
2479 n[1].e = target;
2480 n[2].i = level;
2481 n[3].e = internalformat;
2482 n[4].i = x;
2483 n[5].i = y;
2484 n[6].i = width;
2485 n[7].i = border;
2486 }
2487 if (ctx->ExecuteFlag) {
2488 CALL_CopyTexImage1D(ctx->Exec, (target, level, internalformat,
2489 x, y, width, border));
2490 }
2491 }
2492
2493
2494 static void GLAPIENTRY
2495 save_CopyTexImage2D(GLenum target, GLint level,
2496 GLenum internalformat,
2497 GLint x, GLint y, GLsizei width,
2498 GLsizei height, GLint border)
2499 {
2500 GET_CURRENT_CONTEXT(ctx);
2501 Node *n;
2502 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2503 n = alloc_instruction(ctx, OPCODE_COPY_TEX_IMAGE2D, 8);
2504 if (n) {
2505 n[1].e = target;
2506 n[2].i = level;
2507 n[3].e = internalformat;
2508 n[4].i = x;
2509 n[5].i = y;
2510 n[6].i = width;
2511 n[7].i = height;
2512 n[8].i = border;
2513 }
2514 if (ctx->ExecuteFlag) {
2515 CALL_CopyTexImage2D(ctx->Exec, (target, level, internalformat,
2516 x, y, width, height, border));
2517 }
2518 }
2519
2520
2521
2522 static void GLAPIENTRY
2523 save_CopyTexSubImage1D(GLenum target, GLint level,
2524 GLint xoffset, GLint x, GLint y, GLsizei width)
2525 {
2526 GET_CURRENT_CONTEXT(ctx);
2527 Node *n;
2528 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2529 n = alloc_instruction(ctx, OPCODE_COPY_TEX_SUB_IMAGE1D, 6);
2530 if (n) {
2531 n[1].e = target;
2532 n[2].i = level;
2533 n[3].i = xoffset;
2534 n[4].i = x;
2535 n[5].i = y;
2536 n[6].i = width;
2537 }
2538 if (ctx->ExecuteFlag) {
2539 CALL_CopyTexSubImage1D(ctx->Exec,
2540 (target, level, xoffset, x, y, width));
2541 }
2542 }
2543
2544
2545 static void GLAPIENTRY
2546 save_CopyTexSubImage2D(GLenum target, GLint level,
2547 GLint xoffset, GLint yoffset,
2548 GLint x, GLint y, GLsizei width, GLint height)
2549 {
2550 GET_CURRENT_CONTEXT(ctx);
2551 Node *n;
2552 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2553 n = alloc_instruction(ctx, OPCODE_COPY_TEX_SUB_IMAGE2D, 8);
2554 if (n) {
2555 n[1].e = target;
2556 n[2].i = level;
2557 n[3].i = xoffset;
2558 n[4].i = yoffset;
2559 n[5].i = x;
2560 n[6].i = y;
2561 n[7].i = width;
2562 n[8].i = height;
2563 }
2564 if (ctx->ExecuteFlag) {
2565 CALL_CopyTexSubImage2D(ctx->Exec, (target, level, xoffset, yoffset,
2566 x, y, width, height));
2567 }
2568 }
2569
2570
2571 static void GLAPIENTRY
2572 save_CopyTexSubImage3D(GLenum target, GLint level,
2573 GLint xoffset, GLint yoffset, GLint zoffset,
2574 GLint x, GLint y, GLsizei width, GLint height)
2575 {
2576 GET_CURRENT_CONTEXT(ctx);
2577 Node *n;
2578 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2579 n = alloc_instruction(ctx, OPCODE_COPY_TEX_SUB_IMAGE3D, 9);
2580 if (n) {
2581 n[1].e = target;
2582 n[2].i = level;
2583 n[3].i = xoffset;
2584 n[4].i = yoffset;
2585 n[5].i = zoffset;
2586 n[6].i = x;
2587 n[7].i = y;
2588 n[8].i = width;
2589 n[9].i = height;
2590 }
2591 if (ctx->ExecuteFlag) {
2592 CALL_CopyTexSubImage3D(ctx->Exec, (target, level,
2593 xoffset, yoffset, zoffset,
2594 x, y, width, height));
2595 }
2596 }
2597
2598
2599 static void GLAPIENTRY
2600 save_CullFace(GLenum mode)
2601 {
2602 GET_CURRENT_CONTEXT(ctx);
2603 Node *n;
2604 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2605 n = alloc_instruction(ctx, OPCODE_CULL_FACE, 1);
2606 if (n) {
2607 n[1].e = mode;
2608 }
2609 if (ctx->ExecuteFlag) {
2610 CALL_CullFace(ctx->Exec, (mode));
2611 }
2612 }
2613
2614
2615 static void GLAPIENTRY
2616 save_DepthFunc(GLenum func)
2617 {
2618 GET_CURRENT_CONTEXT(ctx);
2619 Node *n;
2620 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2621 n = alloc_instruction(ctx, OPCODE_DEPTH_FUNC, 1);
2622 if (n) {
2623 n[1].e = func;
2624 }
2625 if (ctx->ExecuteFlag) {
2626 CALL_DepthFunc(ctx->Exec, (func));
2627 }
2628 }
2629
2630
2631 static void GLAPIENTRY
2632 save_DepthMask(GLboolean mask)
2633 {
2634 GET_CURRENT_CONTEXT(ctx);
2635 Node *n;
2636 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2637 n = alloc_instruction(ctx, OPCODE_DEPTH_MASK, 1);
2638 if (n) {
2639 n[1].b = mask;
2640 }
2641 if (ctx->ExecuteFlag) {
2642 CALL_DepthMask(ctx->Exec, (mask));
2643 }
2644 }
2645
2646
2647 static void GLAPIENTRY
2648 save_DepthRange(GLclampd nearval, GLclampd farval)
2649 {
2650 GET_CURRENT_CONTEXT(ctx);
2651 Node *n;
2652 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2653 n = alloc_instruction(ctx, OPCODE_DEPTH_RANGE, 2);
2654 if (n) {
2655 n[1].f = (GLfloat) nearval;
2656 n[2].f = (GLfloat) farval;
2657 }
2658 if (ctx->ExecuteFlag) {
2659 CALL_DepthRange(ctx->Exec, (nearval, farval));
2660 }
2661 }
2662
2663
2664 static void GLAPIENTRY
2665 save_Disable(GLenum cap)
2666 {
2667 GET_CURRENT_CONTEXT(ctx);
2668 Node *n;
2669 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2670 n = alloc_instruction(ctx, OPCODE_DISABLE, 1);
2671 if (n) {
2672 n[1].e = cap;
2673 }
2674 if (ctx->ExecuteFlag) {
2675 CALL_Disable(ctx->Exec, (cap));
2676 }
2677 }
2678
2679
2680 static void GLAPIENTRY
2681 save_DisableIndexed(GLuint index, GLenum cap)
2682 {
2683 GET_CURRENT_CONTEXT(ctx);
2684 Node *n;
2685 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2686 n = alloc_instruction(ctx, OPCODE_DISABLE_INDEXED, 2);
2687 if (n) {
2688 n[1].ui = index;
2689 n[2].e = cap;
2690 }
2691 if (ctx->ExecuteFlag) {
2692 CALL_Disablei(ctx->Exec, (index, cap));
2693 }
2694 }
2695
2696
2697 static void GLAPIENTRY
2698 save_DrawBuffer(GLenum mode)
2699 {
2700 GET_CURRENT_CONTEXT(ctx);
2701 Node *n;
2702 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2703 n = alloc_instruction(ctx, OPCODE_DRAW_BUFFER, 1);
2704 if (n) {
2705 n[1].e = mode;
2706 }
2707 if (ctx->ExecuteFlag) {
2708 CALL_DrawBuffer(ctx->Exec, (mode));
2709 }
2710 }
2711
2712
2713 static void GLAPIENTRY
2714 save_DrawPixels(GLsizei width, GLsizei height,
2715 GLenum format, GLenum type, const GLvoid * pixels)
2716 {
2717 GET_CURRENT_CONTEXT(ctx);
2718 Node *n;
2719
2720 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2721
2722 n = alloc_instruction(ctx, OPCODE_DRAW_PIXELS, 4 + POINTER_DWORDS);
2723 if (n) {
2724 n[1].i = width;
2725 n[2].i = height;
2726 n[3].e = format;
2727 n[4].e = type;
2728 save_pointer(&n[5],
2729 unpack_image(ctx, 2, width, height, 1, format, type,
2730 pixels, &ctx->Unpack));
2731 }
2732 if (ctx->ExecuteFlag) {
2733 CALL_DrawPixels(ctx->Exec, (width, height, format, type, pixels));
2734 }
2735 }
2736
2737
2738
2739 static void GLAPIENTRY
2740 save_Enable(GLenum cap)
2741 {
2742 GET_CURRENT_CONTEXT(ctx);
2743 Node *n;
2744 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2745 n = alloc_instruction(ctx, OPCODE_ENABLE, 1);
2746 if (n) {
2747 n[1].e = cap;
2748 }
2749 if (ctx->ExecuteFlag) {
2750 CALL_Enable(ctx->Exec, (cap));
2751 }
2752 }
2753
2754
2755
2756 static void GLAPIENTRY
2757 save_EnableIndexed(GLuint index, GLenum cap)
2758 {
2759 GET_CURRENT_CONTEXT(ctx);
2760 Node *n;
2761 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2762 n = alloc_instruction(ctx, OPCODE_ENABLE_INDEXED, 2);
2763 if (n) {
2764 n[1].ui = index;
2765 n[2].e = cap;
2766 }
2767 if (ctx->ExecuteFlag) {
2768 CALL_Enablei(ctx->Exec, (index, cap));
2769 }
2770 }
2771
2772
2773
2774 static void GLAPIENTRY
2775 save_EvalMesh1(GLenum mode, GLint i1, GLint i2)
2776 {
2777 GET_CURRENT_CONTEXT(ctx);
2778 Node *n;
2779 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2780 n = alloc_instruction(ctx, OPCODE_EVALMESH1, 3);
2781 if (n) {
2782 n[1].e = mode;
2783 n[2].i = i1;
2784 n[3].i = i2;
2785 }
2786 if (ctx->ExecuteFlag) {
2787 CALL_EvalMesh1(ctx->Exec, (mode, i1, i2));
2788 }
2789 }
2790
2791
2792 static void GLAPIENTRY
2793 save_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)
2794 {
2795 GET_CURRENT_CONTEXT(ctx);
2796 Node *n;
2797 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2798 n = alloc_instruction(ctx, OPCODE_EVALMESH2, 5);
2799 if (n) {
2800 n[1].e = mode;
2801 n[2].i = i1;
2802 n[3].i = i2;
2803 n[4].i = j1;
2804 n[5].i = j2;
2805 }
2806 if (ctx->ExecuteFlag) {
2807 CALL_EvalMesh2(ctx->Exec, (mode, i1, i2, j1, j2));
2808 }
2809 }
2810
2811
2812
2813
2814 static void GLAPIENTRY
2815 save_Fogfv(GLenum pname, const GLfloat *params)
2816 {
2817 GET_CURRENT_CONTEXT(ctx);
2818 Node *n;
2819 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2820 n = alloc_instruction(ctx, OPCODE_FOG, 5);
2821 if (n) {
2822 n[1].e = pname;
2823 n[2].f = params[0];
2824 n[3].f = params[1];
2825 n[4].f = params[2];
2826 n[5].f = params[3];
2827 }
2828 if (ctx->ExecuteFlag) {
2829 CALL_Fogfv(ctx->Exec, (pname, params));
2830 }
2831 }
2832
2833
2834 static void GLAPIENTRY
2835 save_Fogf(GLenum pname, GLfloat param)
2836 {
2837 GLfloat parray[4];
2838 parray[0] = param;
2839 parray[1] = parray[2] = parray[3] = 0.0F;
2840 save_Fogfv(pname, parray);
2841 }
2842
2843
2844 static void GLAPIENTRY
2845 save_Fogiv(GLenum pname, const GLint *params)
2846 {
2847 GLfloat p[4];
2848 switch (pname) {
2849 case GL_FOG_MODE:
2850 case GL_FOG_DENSITY:
2851 case GL_FOG_START:
2852 case GL_FOG_END:
2853 case GL_FOG_INDEX:
2854 case GL_FOG_COORDINATE_SOURCE:
2855 p[0] = (GLfloat) *params;
2856 p[1] = 0.0f;
2857 p[2] = 0.0f;
2858 p[3] = 0.0f;
2859 break;
2860 case GL_FOG_COLOR:
2861 p[0] = INT_TO_FLOAT(params[0]);
2862 p[1] = INT_TO_FLOAT(params[1]);
2863 p[2] = INT_TO_FLOAT(params[2]);
2864 p[3] = INT_TO_FLOAT(params[3]);
2865 break;
2866 default:
2867 /* Error will be caught later in gl_Fogfv */
2868 ASSIGN_4V(p, 0.0F, 0.0F, 0.0F, 0.0F);
2869 }
2870 save_Fogfv(pname, p);
2871 }
2872
2873
2874 static void GLAPIENTRY
2875 save_Fogi(GLenum pname, GLint param)
2876 {
2877 GLint parray[4];
2878 parray[0] = param;
2879 parray[1] = parray[2] = parray[3] = 0;
2880 save_Fogiv(pname, parray);
2881 }
2882
2883
2884 static void GLAPIENTRY
2885 save_FrontFace(GLenum mode)
2886 {
2887 GET_CURRENT_CONTEXT(ctx);
2888 Node *n;
2889 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2890 n = alloc_instruction(ctx, OPCODE_FRONT_FACE, 1);
2891 if (n) {
2892 n[1].e = mode;
2893 }
2894 if (ctx->ExecuteFlag) {
2895 CALL_FrontFace(ctx->Exec, (mode));
2896 }
2897 }
2898
2899
2900 static void GLAPIENTRY
2901 save_Frustum(GLdouble left, GLdouble right,
2902 GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval)
2903 {
2904 GET_CURRENT_CONTEXT(ctx);
2905 Node *n;
2906 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2907 n = alloc_instruction(ctx, OPCODE_FRUSTUM, 6);
2908 if (n) {
2909 n[1].f = (GLfloat) left;
2910 n[2].f = (GLfloat) right;
2911 n[3].f = (GLfloat) bottom;
2912 n[4].f = (GLfloat) top;
2913 n[5].f = (GLfloat) nearval;
2914 n[6].f = (GLfloat) farval;
2915 }
2916 if (ctx->ExecuteFlag) {
2917 CALL_Frustum(ctx->Exec, (left, right, bottom, top, nearval, farval));
2918 }
2919 }
2920
2921
2922 static void GLAPIENTRY
2923 save_Hint(GLenum target, GLenum mode)
2924 {
2925 GET_CURRENT_CONTEXT(ctx);
2926 Node *n;
2927 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2928 n = alloc_instruction(ctx, OPCODE_HINT, 2);
2929 if (n) {
2930 n[1].e = target;
2931 n[2].e = mode;
2932 }
2933 if (ctx->ExecuteFlag) {
2934 CALL_Hint(ctx->Exec, (target, mode));
2935 }
2936 }
2937
2938
2939 static void GLAPIENTRY
2940 save_IndexMask(GLuint mask)
2941 {
2942 GET_CURRENT_CONTEXT(ctx);
2943 Node *n;
2944 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2945 n = alloc_instruction(ctx, OPCODE_INDEX_MASK, 1);
2946 if (n) {
2947 n[1].ui = mask;
2948 }
2949 if (ctx->ExecuteFlag) {
2950 CALL_IndexMask(ctx->Exec, (mask));
2951 }
2952 }
2953
2954
2955 static void GLAPIENTRY
2956 save_InitNames(void)
2957 {
2958 GET_CURRENT_CONTEXT(ctx);
2959 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2960 (void) alloc_instruction(ctx, OPCODE_INIT_NAMES, 0);
2961 if (ctx->ExecuteFlag) {
2962 CALL_InitNames(ctx->Exec, ());
2963 }
2964 }
2965
2966
2967 static void GLAPIENTRY
2968 save_Lightfv(GLenum light, GLenum pname, const GLfloat *params)
2969 {
2970 GET_CURRENT_CONTEXT(ctx);
2971 Node *n;
2972 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2973 n = alloc_instruction(ctx, OPCODE_LIGHT, 6);
2974 if (n) {
2975 GLint i, nParams;
2976 n[1].e = light;
2977 n[2].e = pname;
2978 switch (pname) {
2979 case GL_AMBIENT:
2980 nParams = 4;
2981 break;
2982 case GL_DIFFUSE:
2983 nParams = 4;
2984 break;
2985 case GL_SPECULAR:
2986 nParams = 4;
2987 break;
2988 case GL_POSITION:
2989 nParams = 4;
2990 break;
2991 case GL_SPOT_DIRECTION:
2992 nParams = 3;
2993 break;
2994 case GL_SPOT_EXPONENT:
2995 nParams = 1;
2996 break;
2997 case GL_SPOT_CUTOFF:
2998 nParams = 1;
2999 break;
3000 case GL_CONSTANT_ATTENUATION:
3001 nParams = 1;
3002 break;
3003 case GL_LINEAR_ATTENUATION:
3004 nParams = 1;
3005 break;
3006 case GL_QUADRATIC_ATTENUATION:
3007 nParams = 1;
3008 break;
3009 default:
3010 nParams = 0;
3011 }
3012 for (i = 0; i < nParams; i++) {
3013 n[3 + i].f = params[i];
3014 }
3015 }
3016 if (ctx->ExecuteFlag) {
3017 CALL_Lightfv(ctx->Exec, (light, pname, params));
3018 }
3019 }
3020
3021
3022 static void GLAPIENTRY
3023 save_Lightf(GLenum light, GLenum pname, GLfloat param)
3024 {
3025 GLfloat parray[4];
3026 parray[0] = param;
3027 parray[1] = parray[2] = parray[3] = 0.0F;
3028 save_Lightfv(light, pname, parray);
3029 }
3030
3031
3032 static void GLAPIENTRY
3033 save_Lightiv(GLenum light, GLenum pname, const GLint *params)
3034 {
3035 GLfloat fparam[4];
3036 switch (pname) {
3037 case GL_AMBIENT:
3038 case GL_DIFFUSE:
3039 case GL_SPECULAR:
3040 fparam[0] = INT_TO_FLOAT(params[0]);
3041 fparam[1] = INT_TO_FLOAT(params[1]);
3042 fparam[2] = INT_TO_FLOAT(params[2]);
3043 fparam[3] = INT_TO_FLOAT(params[3]);
3044 break;
3045 case GL_POSITION:
3046 fparam[0] = (GLfloat) params[0];
3047 fparam[1] = (GLfloat) params[1];
3048 fparam[2] = (GLfloat) params[2];
3049 fparam[3] = (GLfloat) params[3];
3050 break;
3051 case GL_SPOT_DIRECTION:
3052 fparam[0] = (GLfloat) params[0];
3053 fparam[1] = (GLfloat) params[1];
3054 fparam[2] = (GLfloat) params[2];
3055 break;
3056 case GL_SPOT_EXPONENT:
3057 case GL_SPOT_CUTOFF:
3058 case GL_CONSTANT_ATTENUATION:
3059 case GL_LINEAR_ATTENUATION:
3060 case GL_QUADRATIC_ATTENUATION:
3061 fparam[0] = (GLfloat) params[0];
3062 break;
3063 default:
3064 /* error will be caught later in gl_Lightfv */
3065 ;
3066 }
3067 save_Lightfv(light, pname, fparam);
3068 }
3069
3070
3071 static void GLAPIENTRY
3072 save_Lighti(GLenum light, GLenum pname, GLint param)
3073 {
3074 GLint parray[4];
3075 parray[0] = param;
3076 parray[1] = parray[2] = parray[3] = 0;
3077 save_Lightiv(light, pname, parray);
3078 }
3079
3080
3081 static void GLAPIENTRY
3082 save_LightModelfv(GLenum pname, const GLfloat *params)
3083 {
3084 GET_CURRENT_CONTEXT(ctx);
3085 Node *n;
3086 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3087 n = alloc_instruction(ctx, OPCODE_LIGHT_MODEL, 5);
3088 if (n) {
3089 n[1].e = pname;
3090 n[2].f = params[0];
3091 n[3].f = params[1];
3092 n[4].f = params[2];
3093 n[5].f = params[3];
3094 }
3095 if (ctx->ExecuteFlag) {
3096 CALL_LightModelfv(ctx->Exec, (pname, params));
3097 }
3098 }
3099
3100
3101 static void GLAPIENTRY
3102 save_LightModelf(GLenum pname, GLfloat param)
3103 {
3104 GLfloat parray[4];
3105 parray[0] = param;
3106 parray[1] = parray[2] = parray[3] = 0.0F;
3107 save_LightModelfv(pname, parray);
3108 }
3109
3110
3111 static void GLAPIENTRY
3112 save_LightModeliv(GLenum pname, const GLint *params)
3113 {
3114 GLfloat fparam[4];
3115 switch (pname) {
3116 case GL_LIGHT_MODEL_AMBIENT:
3117 fparam[0] = INT_TO_FLOAT(params[0]);
3118 fparam[1] = INT_TO_FLOAT(params[1]);
3119 fparam[2] = INT_TO_FLOAT(params[2]);
3120 fparam[3] = INT_TO_FLOAT(params[3]);
3121 break;
3122 case GL_LIGHT_MODEL_LOCAL_VIEWER:
3123 case GL_LIGHT_MODEL_TWO_SIDE:
3124 case GL_LIGHT_MODEL_COLOR_CONTROL:
3125 fparam[0] = (GLfloat) params[0];
3126 fparam[1] = 0.0F;
3127 fparam[2] = 0.0F;
3128 fparam[3] = 0.0F;
3129 break;
3130 default:
3131 /* Error will be caught later in gl_LightModelfv */
3132 ASSIGN_4V(fparam, 0.0F, 0.0F, 0.0F, 0.0F);
3133 }
3134 save_LightModelfv(pname, fparam);
3135 }
3136
3137
3138 static void GLAPIENTRY
3139 save_LightModeli(GLenum pname, GLint param)
3140 {
3141 GLint parray[4];
3142 parray[0] = param;
3143 parray[1] = parray[2] = parray[3] = 0;
3144 save_LightModeliv(pname, parray);
3145 }
3146
3147
3148 static void GLAPIENTRY
3149 save_LineStipple(GLint factor, GLushort pattern)
3150 {
3151 GET_CURRENT_CONTEXT(ctx);
3152 Node *n;
3153 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3154 n = alloc_instruction(ctx, OPCODE_LINE_STIPPLE, 2);
3155 if (n) {
3156 n[1].i = factor;
3157 n[2].us = pattern;
3158 }
3159 if (ctx->ExecuteFlag) {
3160 CALL_LineStipple(ctx->Exec, (factor, pattern));
3161 }
3162 }
3163
3164
3165 static void GLAPIENTRY
3166 save_LineWidth(GLfloat width)
3167 {
3168 GET_CURRENT_CONTEXT(ctx);
3169 Node *n;
3170 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3171 n = alloc_instruction(ctx, OPCODE_LINE_WIDTH, 1);
3172 if (n) {
3173 n[1].f = width;
3174 }
3175 if (ctx->ExecuteFlag) {
3176 CALL_LineWidth(ctx->Exec, (width));
3177 }
3178 }
3179
3180
3181 static void GLAPIENTRY
3182 save_ListBase(GLuint base)
3183 {
3184 GET_CURRENT_CONTEXT(ctx);
3185 Node *n;
3186 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3187 n = alloc_instruction(ctx, OPCODE_LIST_BASE, 1);
3188 if (n) {
3189 n[1].ui = base;
3190 }
3191 if (ctx->ExecuteFlag) {
3192 CALL_ListBase(ctx->Exec, (base));
3193 }
3194 }
3195
3196
3197 static void GLAPIENTRY
3198 save_LoadIdentity(void)
3199 {
3200 GET_CURRENT_CONTEXT(ctx);
3201 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3202 (void) alloc_instruction(ctx, OPCODE_LOAD_IDENTITY, 0);
3203 if (ctx->ExecuteFlag) {
3204 CALL_LoadIdentity(ctx->Exec, ());
3205 }
3206 }
3207
3208
3209 static void GLAPIENTRY
3210 save_LoadMatrixf(const GLfloat * m)
3211 {
3212 GET_CURRENT_CONTEXT(ctx);
3213 Node *n;
3214 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3215 n = alloc_instruction(ctx, OPCODE_LOAD_MATRIX, 16);
3216 if (n) {
3217 GLuint i;
3218 for (i = 0; i < 16; i++) {
3219 n[1 + i].f = m[i];
3220 }
3221 }
3222 if (ctx->ExecuteFlag) {
3223 CALL_LoadMatrixf(ctx->Exec, (m));
3224 }
3225 }
3226
3227
3228 static void GLAPIENTRY
3229 save_LoadMatrixd(const GLdouble * m)
3230 {
3231 GLfloat f[16];
3232 GLint i;
3233 for (i = 0; i < 16; i++) {
3234 f[i] = (GLfloat) m[i];
3235 }
3236 save_LoadMatrixf(f);
3237 }
3238
3239
3240 static void GLAPIENTRY
3241 save_LoadName(GLuint name)
3242 {
3243 GET_CURRENT_CONTEXT(ctx);
3244 Node *n;
3245 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3246 n = alloc_instruction(ctx, OPCODE_LOAD_NAME, 1);
3247 if (n) {
3248 n[1].ui = name;
3249 }
3250 if (ctx->ExecuteFlag) {
3251 CALL_LoadName(ctx->Exec, (name));
3252 }
3253 }
3254
3255
3256 static void GLAPIENTRY
3257 save_LogicOp(GLenum opcode)
3258 {
3259 GET_CURRENT_CONTEXT(ctx);
3260 Node *n;
3261 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3262 n = alloc_instruction(ctx, OPCODE_LOGIC_OP, 1);
3263 if (n) {
3264 n[1].e = opcode;
3265 }
3266 if (ctx->ExecuteFlag) {
3267 CALL_LogicOp(ctx->Exec, (opcode));
3268 }
3269 }
3270
3271
3272 static void GLAPIENTRY
3273 save_Map1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride,
3274 GLint order, const GLdouble * points)
3275 {
3276 GET_CURRENT_CONTEXT(ctx);
3277 Node *n;
3278 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3279 n = alloc_instruction(ctx, OPCODE_MAP1, 5 + POINTER_DWORDS);
3280 if (n) {
3281 GLfloat *pnts = _mesa_copy_map_points1d(target, stride, order, points);
3282 n[1].e = target;
3283 n[2].f = (GLfloat) u1;
3284 n[3].f = (GLfloat) u2;
3285 n[4].i = _mesa_evaluator_components(target); /* stride */
3286 n[5].i = order;
3287 save_pointer(&n[6], pnts);
3288 }
3289 if (ctx->ExecuteFlag) {
3290 CALL_Map1d(ctx->Exec, (target, u1, u2, stride, order, points));
3291 }
3292 }
3293
3294 static void GLAPIENTRY
3295 save_Map1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride,
3296 GLint order, const GLfloat * points)
3297 {
3298 GET_CURRENT_CONTEXT(ctx);
3299 Node *n;
3300 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3301 n = alloc_instruction(ctx, OPCODE_MAP1, 5 + POINTER_DWORDS);
3302 if (n) {
3303 GLfloat *pnts = _mesa_copy_map_points1f(target, stride, order, points);
3304 n[1].e = target;
3305 n[2].f = u1;
3306 n[3].f = u2;
3307 n[4].i = _mesa_evaluator_components(target); /* stride */
3308 n[5].i = order;
3309 save_pointer(&n[6], pnts);
3310 }
3311 if (ctx->ExecuteFlag) {
3312 CALL_Map1f(ctx->Exec, (target, u1, u2, stride, order, points));
3313 }
3314 }
3315
3316
3317 static void GLAPIENTRY
3318 save_Map2d(GLenum target,
3319 GLdouble u1, GLdouble u2, GLint ustride, GLint uorder,
3320 GLdouble v1, GLdouble v2, GLint vstride, GLint vorder,
3321 const GLdouble * points)
3322 {
3323 GET_CURRENT_CONTEXT(ctx);
3324 Node *n;
3325 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3326 n = alloc_instruction(ctx, OPCODE_MAP2, 9 + POINTER_DWORDS);
3327 if (n) {
3328 GLfloat *pnts = _mesa_copy_map_points2d(target, ustride, uorder,
3329 vstride, vorder, points);
3330 n[1].e = target;
3331 n[2].f = (GLfloat) u1;
3332 n[3].f = (GLfloat) u2;
3333 n[4].f = (GLfloat) v1;
3334 n[5].f = (GLfloat) v2;
3335 /* XXX verify these strides are correct */
3336 n[6].i = _mesa_evaluator_components(target) * vorder; /*ustride */
3337 n[7].i = _mesa_evaluator_components(target); /*vstride */
3338 n[8].i = uorder;
3339 n[9].i = vorder;
3340 save_pointer(&n[10], pnts);
3341 }
3342 if (ctx->ExecuteFlag) {
3343 CALL_Map2d(ctx->Exec, (target,
3344 u1, u2, ustride, uorder,
3345 v1, v2, vstride, vorder, points));
3346 }
3347 }
3348
3349
3350 static void GLAPIENTRY
3351 save_Map2f(GLenum target,
3352 GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
3353 GLfloat v1, GLfloat v2, GLint vstride, GLint vorder,
3354 const GLfloat * points)
3355 {
3356 GET_CURRENT_CONTEXT(ctx);
3357 Node *n;
3358 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3359 n = alloc_instruction(ctx, OPCODE_MAP2, 9 + POINTER_DWORDS);
3360 if (n) {
3361 GLfloat *pnts = _mesa_copy_map_points2f(target, ustride, uorder,
3362 vstride, vorder, points);
3363 n[1].e = target;
3364 n[2].f = u1;
3365 n[3].f = u2;
3366 n[4].f = v1;
3367 n[5].f = v2;
3368 /* XXX verify these strides are correct */
3369 n[6].i = _mesa_evaluator_components(target) * vorder; /*ustride */
3370 n[7].i = _mesa_evaluator_components(target); /*vstride */
3371 n[8].i = uorder;
3372 n[9].i = vorder;
3373 save_pointer(&n[10], pnts);
3374 }
3375 if (ctx->ExecuteFlag) {
3376 CALL_Map2f(ctx->Exec, (target, u1, u2, ustride, uorder,
3377 v1, v2, vstride, vorder, points));
3378 }
3379 }
3380
3381
3382 static void GLAPIENTRY
3383 save_MapGrid1f(GLint un, GLfloat u1, GLfloat u2)
3384 {
3385 GET_CURRENT_CONTEXT(ctx);
3386 Node *n;
3387 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3388 n = alloc_instruction(ctx, OPCODE_MAPGRID1, 3);
3389 if (n) {
3390 n[1].i = un;
3391 n[2].f = u1;
3392 n[3].f = u2;
3393 }
3394 if (ctx->ExecuteFlag) {
3395 CALL_MapGrid1f(ctx->Exec, (un, u1, u2));
3396 }
3397 }
3398
3399
3400 static void GLAPIENTRY
3401 save_MapGrid1d(GLint un, GLdouble u1, GLdouble u2)
3402 {
3403 save_MapGrid1f(un, (GLfloat) u1, (GLfloat) u2);
3404 }
3405
3406
3407 static void GLAPIENTRY
3408 save_MapGrid2f(GLint un, GLfloat u1, GLfloat u2,
3409 GLint vn, GLfloat v1, GLfloat v2)
3410 {
3411 GET_CURRENT_CONTEXT(ctx);
3412 Node *n;
3413 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3414 n = alloc_instruction(ctx, OPCODE_MAPGRID2, 6);
3415 if (n) {
3416 n[1].i = un;
3417 n[2].f = u1;
3418 n[3].f = u2;
3419 n[4].i = vn;
3420 n[5].f = v1;
3421 n[6].f = v2;
3422 }
3423 if (ctx->ExecuteFlag) {
3424 CALL_MapGrid2f(ctx->Exec, (un, u1, u2, vn, v1, v2));
3425 }
3426 }
3427
3428
3429
3430 static void GLAPIENTRY
3431 save_MapGrid2d(GLint un, GLdouble u1, GLdouble u2,
3432 GLint vn, GLdouble v1, GLdouble v2)
3433 {
3434 save_MapGrid2f(un, (GLfloat) u1, (GLfloat) u2,
3435 vn, (GLfloat) v1, (GLfloat) v2);
3436 }
3437
3438
3439 static void GLAPIENTRY
3440 save_MatrixMode(GLenum mode)
3441 {
3442 GET_CURRENT_CONTEXT(ctx);
3443 Node *n;
3444 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3445 n = alloc_instruction(ctx, OPCODE_MATRIX_MODE, 1);
3446 if (n) {
3447 n[1].e = mode;
3448 }
3449 if (ctx->ExecuteFlag) {
3450 CALL_MatrixMode(ctx->Exec, (mode));
3451 }
3452 }
3453
3454
3455 static void GLAPIENTRY
3456 save_MultMatrixf(const GLfloat * m)
3457 {
3458 GET_CURRENT_CONTEXT(ctx);
3459 Node *n;
3460 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3461 n = alloc_instruction(ctx, OPCODE_MULT_MATRIX, 16);
3462 if (n) {
3463 GLuint i;
3464 for (i = 0; i < 16; i++) {
3465 n[1 + i].f = m[i];
3466 }
3467 }
3468 if (ctx->ExecuteFlag) {
3469 CALL_MultMatrixf(ctx->Exec, (m));
3470 }
3471 }
3472
3473
3474 static void GLAPIENTRY
3475 save_MultMatrixd(const GLdouble * m)
3476 {
3477 GLfloat f[16];
3478 GLint i;
3479 for (i = 0; i < 16; i++) {
3480 f[i] = (GLfloat) m[i];
3481 }
3482 save_MultMatrixf(f);
3483 }
3484
3485
3486 static void GLAPIENTRY
3487 save_NewList(GLuint name, GLenum mode)
3488 {
3489 GET_CURRENT_CONTEXT(ctx);
3490 /* It's an error to call this function while building a display list */
3491 _mesa_error(ctx, GL_INVALID_OPERATION, "glNewList");
3492 (void) name;
3493 (void) mode;
3494 }
3495
3496
3497
3498 static void GLAPIENTRY
3499 save_Ortho(GLdouble left, GLdouble right,
3500 GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval)
3501 {
3502 GET_CURRENT_CONTEXT(ctx);
3503 Node *n;
3504 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3505 n = alloc_instruction(ctx, OPCODE_ORTHO, 6);
3506 if (n) {
3507 n[1].f = (GLfloat) left;
3508 n[2].f = (GLfloat) right;
3509 n[3].f = (GLfloat) bottom;
3510 n[4].f = (GLfloat) top;
3511 n[5].f = (GLfloat) nearval;
3512 n[6].f = (GLfloat) farval;
3513 }
3514 if (ctx->ExecuteFlag) {
3515 CALL_Ortho(ctx->Exec, (left, right, bottom, top, nearval, farval));
3516 }
3517 }
3518
3519
3520 static void GLAPIENTRY
3521 save_PatchParameteri(GLenum pname, const GLint value)
3522 {
3523 GET_CURRENT_CONTEXT(ctx);
3524 Node *n;
3525 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3526 n = alloc_instruction(ctx, OPCODE_PATCH_PARAMETER_I, 2);
3527 if (n) {
3528 n[1].e = pname;
3529 n[2].i = value;
3530 }
3531 if (ctx->ExecuteFlag) {
3532 CALL_PatchParameteri(ctx->Exec, (pname, value));
3533 }
3534 }
3535
3536
3537 static void GLAPIENTRY
3538 save_PatchParameterfv(GLenum pname, const GLfloat *params)
3539 {
3540 GET_CURRENT_CONTEXT(ctx);
3541 Node *n;
3542 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3543
3544 if (pname == GL_PATCH_DEFAULT_OUTER_LEVEL) {
3545 n = alloc_instruction(ctx, OPCODE_PATCH_PARAMETER_FV_OUTER, 5);
3546 } else {
3547 assert(pname == GL_PATCH_DEFAULT_INNER_LEVEL);
3548 n = alloc_instruction(ctx, OPCODE_PATCH_PARAMETER_FV_INNER, 3);
3549 }
3550 if (n) {
3551 n[1].e = pname;
3552 if (pname == GL_PATCH_DEFAULT_OUTER_LEVEL) {
3553 n[2].f = params[0];
3554 n[3].f = params[1];
3555 n[4].f = params[2];
3556 n[5].f = params[3];
3557 } else {
3558 n[2].f = params[0];
3559 n[3].f = params[1];
3560 }
3561 }
3562 if (ctx->ExecuteFlag) {
3563 CALL_PatchParameterfv(ctx->Exec, (pname, params));
3564 }
3565 }
3566
3567
3568 static void GLAPIENTRY
3569 save_PixelMapfv(GLenum map, GLint mapsize, const GLfloat *values)
3570 {
3571 GET_CURRENT_CONTEXT(ctx);
3572 Node *n;
3573 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3574 n = alloc_instruction(ctx, OPCODE_PIXEL_MAP, 2 + POINTER_DWORDS);
3575 if (n) {
3576 n[1].e = map;
3577 n[2].i = mapsize;
3578 save_pointer(&n[3], memdup(values, mapsize * sizeof(GLfloat)));
3579 }
3580 if (ctx->ExecuteFlag) {
3581 CALL_PixelMapfv(ctx->Exec, (map, mapsize, values));
3582 }
3583 }
3584
3585
3586 static void GLAPIENTRY
3587 save_PixelMapuiv(GLenum map, GLint mapsize, const GLuint *values)
3588 {
3589 GLfloat fvalues[MAX_PIXEL_MAP_TABLE];
3590 GLint i;
3591 if (map == GL_PIXEL_MAP_I_TO_I || map == GL_PIXEL_MAP_S_TO_S) {
3592 for (i = 0; i < mapsize; i++) {
3593 fvalues[i] = (GLfloat) values[i];
3594 }
3595 }
3596 else {
3597 for (i = 0; i < mapsize; i++) {
3598 fvalues[i] = UINT_TO_FLOAT(values[i]);
3599 }
3600 }
3601 save_PixelMapfv(map, mapsize, fvalues);
3602 }
3603
3604
3605 static void GLAPIENTRY
3606 save_PixelMapusv(GLenum map, GLint mapsize, const GLushort *values)
3607 {
3608 GLfloat fvalues[MAX_PIXEL_MAP_TABLE];
3609 GLint i;
3610 if (map == GL_PIXEL_MAP_I_TO_I || map == GL_PIXEL_MAP_S_TO_S) {
3611 for (i = 0; i < mapsize; i++) {
3612 fvalues[i] = (GLfloat) values[i];
3613 }
3614 }
3615 else {
3616 for (i = 0; i < mapsize; i++) {
3617 fvalues[i] = USHORT_TO_FLOAT(values[i]);
3618 }
3619 }
3620 save_PixelMapfv(map, mapsize, fvalues);
3621 }
3622
3623
3624 static void GLAPIENTRY
3625 save_PixelTransferf(GLenum pname, GLfloat param)
3626 {
3627 GET_CURRENT_CONTEXT(ctx);
3628 Node *n;
3629 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3630 n = alloc_instruction(ctx, OPCODE_PIXEL_TRANSFER, 2);
3631 if (n) {
3632 n[1].e = pname;
3633 n[2].f = param;
3634 }
3635 if (ctx->ExecuteFlag) {
3636 CALL_PixelTransferf(ctx->Exec, (pname, param));
3637 }
3638 }
3639
3640
3641 static void GLAPIENTRY
3642 save_PixelTransferi(GLenum pname, GLint param)
3643 {
3644 save_PixelTransferf(pname, (GLfloat) param);
3645 }
3646
3647
3648 static void GLAPIENTRY
3649 save_PixelZoom(GLfloat xfactor, GLfloat yfactor)
3650 {
3651 GET_CURRENT_CONTEXT(ctx);
3652 Node *n;
3653 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3654 n = alloc_instruction(ctx, OPCODE_PIXEL_ZOOM, 2);
3655 if (n) {
3656 n[1].f = xfactor;
3657 n[2].f = yfactor;
3658 }
3659 if (ctx->ExecuteFlag) {
3660 CALL_PixelZoom(ctx->Exec, (xfactor, yfactor));
3661 }
3662 }
3663
3664
3665 static void GLAPIENTRY
3666 save_PointParameterfvEXT(GLenum pname, const GLfloat *params)
3667 {
3668 GET_CURRENT_CONTEXT(ctx);
3669 Node *n;
3670 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3671 n = alloc_instruction(ctx, OPCODE_POINT_PARAMETERS, 4);
3672 if (n) {
3673 n[1].e = pname;
3674 n[2].f = params[0];
3675 n[3].f = params[1];
3676 n[4].f = params[2];
3677 }
3678 if (ctx->ExecuteFlag) {
3679 CALL_PointParameterfv(ctx->Exec, (pname, params));
3680 }
3681 }
3682
3683
3684 static void GLAPIENTRY
3685 save_PointParameterfEXT(GLenum pname, GLfloat param)
3686 {
3687 GLfloat parray[3];
3688 parray[0] = param;
3689 parray[1] = parray[2] = 0.0F;
3690 save_PointParameterfvEXT(pname, parray);
3691 }
3692
3693 static void GLAPIENTRY
3694 save_PointParameteriNV(GLenum pname, GLint param)
3695 {
3696 GLfloat parray[3];
3697 parray[0] = (GLfloat) param;
3698 parray[1] = parray[2] = 0.0F;
3699 save_PointParameterfvEXT(pname, parray);
3700 }
3701
3702 static void GLAPIENTRY
3703 save_PointParameterivNV(GLenum pname, const GLint * param)
3704 {
3705 GLfloat parray[3];
3706 parray[0] = (GLfloat) param[0];
3707 parray[1] = parray[2] = 0.0F;
3708 save_PointParameterfvEXT(pname, parray);
3709 }
3710
3711
3712 static void GLAPIENTRY
3713 save_PointSize(GLfloat size)
3714 {
3715 GET_CURRENT_CONTEXT(ctx);
3716 Node *n;
3717 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3718 n = alloc_instruction(ctx, OPCODE_POINT_SIZE, 1);
3719 if (n) {
3720 n[1].f = size;
3721 }
3722 if (ctx->ExecuteFlag) {
3723 CALL_PointSize(ctx->Exec, (size));
3724 }
3725 }
3726
3727
3728 static void GLAPIENTRY
3729 save_PolygonMode(GLenum face, GLenum mode)
3730 {
3731 GET_CURRENT_CONTEXT(ctx);
3732 Node *n;
3733 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3734 n = alloc_instruction(ctx, OPCODE_POLYGON_MODE, 2);
3735 if (n) {
3736 n[1].e = face;
3737 n[2].e = mode;
3738 }
3739 if (ctx->ExecuteFlag) {
3740 CALL_PolygonMode(ctx->Exec, (face, mode));
3741 }
3742 }
3743
3744
3745 static void GLAPIENTRY
3746 save_PolygonStipple(const GLubyte * pattern)
3747 {
3748 GET_CURRENT_CONTEXT(ctx);
3749 Node *n;
3750
3751 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3752
3753 n = alloc_instruction(ctx, OPCODE_POLYGON_STIPPLE, POINTER_DWORDS);
3754 if (n) {
3755 save_pointer(&n[1],
3756 unpack_image(ctx, 2, 32, 32, 1, GL_COLOR_INDEX, GL_BITMAP,
3757 pattern, &ctx->Unpack));
3758 }
3759 if (ctx->ExecuteFlag) {
3760 CALL_PolygonStipple(ctx->Exec, ((GLubyte *) pattern));
3761 }
3762 }
3763
3764
3765 static void GLAPIENTRY
3766 save_PolygonOffset(GLfloat factor, GLfloat units)
3767 {
3768 GET_CURRENT_CONTEXT(ctx);
3769 Node *n;
3770 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3771 n = alloc_instruction(ctx, OPCODE_POLYGON_OFFSET, 2);
3772 if (n) {
3773 n[1].f = factor;
3774 n[2].f = units;
3775 }
3776 if (ctx->ExecuteFlag) {
3777 CALL_PolygonOffset(ctx->Exec, (factor, units));
3778 }
3779 }
3780
3781
3782 static void GLAPIENTRY
3783 save_PolygonOffsetClampEXT(GLfloat factor, GLfloat units, GLfloat clamp)
3784 {
3785 GET_CURRENT_CONTEXT(ctx);
3786 Node *n;
3787 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3788 n = alloc_instruction(ctx, OPCODE_POLYGON_OFFSET_CLAMP, 3);
3789 if (n) {
3790 n[1].f = factor;
3791 n[2].f = units;
3792 n[3].f = clamp;
3793 }
3794 if (ctx->ExecuteFlag) {
3795 CALL_PolygonOffsetClampEXT(ctx->Exec, (factor, units, clamp));
3796 }
3797 }
3798
3799 static void GLAPIENTRY
3800 save_PopAttrib(void)
3801 {
3802 GET_CURRENT_CONTEXT(ctx);
3803 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3804 (void) alloc_instruction(ctx, OPCODE_POP_ATTRIB, 0);
3805 if (ctx->ExecuteFlag) {
3806 CALL_PopAttrib(ctx->Exec, ());
3807 }
3808 }
3809
3810
3811 static void GLAPIENTRY
3812 save_PopMatrix(void)
3813 {
3814 GET_CURRENT_CONTEXT(ctx);
3815 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3816 (void) alloc_instruction(ctx, OPCODE_POP_MATRIX, 0);
3817 if (ctx->ExecuteFlag) {
3818 CALL_PopMatrix(ctx->Exec, ());
3819 }
3820 }
3821
3822
3823 static void GLAPIENTRY
3824 save_PopName(void)
3825 {
3826 GET_CURRENT_CONTEXT(ctx);
3827 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3828 (void) alloc_instruction(ctx, OPCODE_POP_NAME, 0);
3829 if (ctx->ExecuteFlag) {
3830 CALL_PopName(ctx->Exec, ());
3831 }
3832 }
3833
3834
3835 static void GLAPIENTRY
3836 save_PrioritizeTextures(GLsizei num, const GLuint * textures,
3837 const GLclampf * priorities)
3838 {
3839 GET_CURRENT_CONTEXT(ctx);
3840 GLint i;
3841 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3842
3843 for (i = 0; i < num; i++) {
3844 Node *n;
3845 n = alloc_instruction(ctx, OPCODE_PRIORITIZE_TEXTURE, 2);
3846 if (n) {
3847 n[1].ui = textures[i];
3848 n[2].f = priorities[i];
3849 }
3850 }
3851 if (ctx->ExecuteFlag) {
3852 CALL_PrioritizeTextures(ctx->Exec, (num, textures, priorities));
3853 }
3854 }
3855
3856
3857 static void GLAPIENTRY
3858 save_PushAttrib(GLbitfield mask)
3859 {
3860 GET_CURRENT_CONTEXT(ctx);
3861 Node *n;
3862 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3863 n = alloc_instruction(ctx, OPCODE_PUSH_ATTRIB, 1);
3864 if (n) {
3865 n[1].bf = mask;
3866 }
3867 if (ctx->ExecuteFlag) {
3868 CALL_PushAttrib(ctx->Exec, (mask));
3869 }
3870 }
3871
3872
3873 static void GLAPIENTRY
3874 save_PushMatrix(void)
3875 {
3876 GET_CURRENT_CONTEXT(ctx);
3877 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3878 (void) alloc_instruction(ctx, OPCODE_PUSH_MATRIX, 0);
3879 if (ctx->ExecuteFlag) {
3880 CALL_PushMatrix(ctx->Exec, ());
3881 }
3882 }
3883
3884
3885 static void GLAPIENTRY
3886 save_PushName(GLuint name)
3887 {
3888 GET_CURRENT_CONTEXT(ctx);
3889 Node *n;
3890 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3891 n = alloc_instruction(ctx, OPCODE_PUSH_NAME, 1);
3892 if (n) {
3893 n[1].ui = name;
3894 }
3895 if (ctx->ExecuteFlag) {
3896 CALL_PushName(ctx->Exec, (name));
3897 }
3898 }
3899
3900
3901 static void GLAPIENTRY
3902 save_RasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
3903 {
3904 GET_CURRENT_CONTEXT(ctx);
3905 Node *n;
3906 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3907 n = alloc_instruction(ctx, OPCODE_RASTER_POS, 4);
3908 if (n) {
3909 n[1].f = x;
3910 n[2].f = y;
3911 n[3].f = z;
3912 n[4].f = w;
3913 }
3914 if (ctx->ExecuteFlag) {
3915 CALL_RasterPos4f(ctx->Exec, (x, y, z, w));
3916 }
3917 }
3918
3919 static void GLAPIENTRY
3920 save_RasterPos2d(GLdouble x, GLdouble y)
3921 {
3922 save_RasterPos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
3923 }
3924
3925 static void GLAPIENTRY
3926 save_RasterPos2f(GLfloat x, GLfloat y)
3927 {
3928 save_RasterPos4f(x, y, 0.0F, 1.0F);
3929 }
3930
3931 static void GLAPIENTRY
3932 save_RasterPos2i(GLint x, GLint y)
3933 {
3934 save_RasterPos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
3935 }
3936
3937 static void GLAPIENTRY
3938 save_RasterPos2s(GLshort x, GLshort y)
3939 {
3940 save_RasterPos4f(x, y, 0.0F, 1.0F);
3941 }
3942
3943 static void GLAPIENTRY
3944 save_RasterPos3d(GLdouble x, GLdouble y, GLdouble z)
3945 {
3946 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
3947 }
3948
3949 static void GLAPIENTRY
3950 save_RasterPos3f(GLfloat x, GLfloat y, GLfloat z)
3951 {
3952 save_RasterPos4f(x, y, z, 1.0F);
3953 }
3954
3955 static void GLAPIENTRY
3956 save_RasterPos3i(GLint x, GLint y, GLint z)
3957 {
3958 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
3959 }
3960
3961 static void GLAPIENTRY
3962 save_RasterPos3s(GLshort x, GLshort y, GLshort z)
3963 {
3964 save_RasterPos4f(x, y, z, 1.0F);
3965 }
3966
3967 static void GLAPIENTRY
3968 save_RasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
3969 {
3970 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
3971 }
3972
3973 static void GLAPIENTRY
3974 save_RasterPos4i(GLint x, GLint y, GLint z, GLint w)
3975 {
3976 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
3977 }
3978
3979 static void GLAPIENTRY
3980 save_RasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w)
3981 {
3982 save_RasterPos4f(x, y, z, w);
3983 }
3984
3985 static void GLAPIENTRY
3986 save_RasterPos2dv(const GLdouble * v)
3987 {
3988 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
3989 }
3990
3991 static void GLAPIENTRY
3992 save_RasterPos2fv(const GLfloat * v)
3993 {
3994 save_RasterPos4f(v[0], v[1], 0.0F, 1.0F);
3995 }
3996
3997 static void GLAPIENTRY
3998 save_RasterPos2iv(const GLint * v)
3999 {
4000 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
4001 }
4002
4003 static void GLAPIENTRY
4004 save_RasterPos2sv(const GLshort * v)
4005 {
4006 save_RasterPos4f(v[0], v[1], 0.0F, 1.0F);
4007 }
4008
4009 static void GLAPIENTRY
4010 save_RasterPos3dv(const GLdouble * v)
4011 {
4012 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
4013 }
4014
4015 static void GLAPIENTRY
4016 save_RasterPos3fv(const GLfloat * v)
4017 {
4018 save_RasterPos4f(v[0], v[1], v[2], 1.0F);
4019 }
4020
4021 static void GLAPIENTRY
4022 save_RasterPos3iv(const GLint * v)
4023 {
4024 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
4025 }
4026
4027 static void GLAPIENTRY
4028 save_RasterPos3sv(const GLshort * v)
4029 {
4030 save_RasterPos4f(v[0], v[1], v[2], 1.0F);
4031 }
4032
4033 static void GLAPIENTRY
4034 save_RasterPos4dv(const GLdouble * v)
4035 {
4036 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1],
4037 (GLfloat) v[2], (GLfloat) v[3]);
4038 }
4039
4040 static void GLAPIENTRY
4041 save_RasterPos4fv(const GLfloat * v)
4042 {
4043 save_RasterPos4f(v[0], v[1], v[2], v[3]);
4044 }
4045
4046 static void GLAPIENTRY
4047 save_RasterPos4iv(const GLint * v)
4048 {
4049 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1],
4050 (GLfloat) v[2], (GLfloat) v[3]);
4051 }
4052
4053 static void GLAPIENTRY
4054 save_RasterPos4sv(const GLshort * v)
4055 {
4056 save_RasterPos4f(v[0], v[1], v[2], v[3]);
4057 }
4058
4059
4060 static void GLAPIENTRY
4061 save_PassThrough(GLfloat token)
4062 {
4063 GET_CURRENT_CONTEXT(ctx);
4064 Node *n;
4065 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4066 n = alloc_instruction(ctx, OPCODE_PASSTHROUGH, 1);
4067 if (n) {
4068 n[1].f = token;
4069 }
4070 if (ctx->ExecuteFlag) {
4071 CALL_PassThrough(ctx->Exec, (token));
4072 }
4073 }
4074
4075
4076 static void GLAPIENTRY
4077 save_ReadBuffer(GLenum mode)
4078 {
4079 GET_CURRENT_CONTEXT(ctx);
4080 Node *n;
4081 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4082 n = alloc_instruction(ctx, OPCODE_READ_BUFFER, 1);
4083 if (n) {
4084 n[1].e = mode;
4085 }
4086 if (ctx->ExecuteFlag) {
4087 CALL_ReadBuffer(ctx->Exec, (mode));
4088 }
4089 }
4090
4091
4092 static void GLAPIENTRY
4093 save_Rotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
4094 {
4095 GET_CURRENT_CONTEXT(ctx);
4096 Node *n;
4097 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4098 n = alloc_instruction(ctx, OPCODE_ROTATE, 4);
4099 if (n) {
4100 n[1].f = angle;
4101 n[2].f = x;
4102 n[3].f = y;
4103 n[4].f = z;
4104 }
4105 if (ctx->ExecuteFlag) {
4106 CALL_Rotatef(ctx->Exec, (angle, x, y, z));
4107 }
4108 }
4109
4110
4111 static void GLAPIENTRY
4112 save_Rotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
4113 {
4114 save_Rotatef((GLfloat) angle, (GLfloat) x, (GLfloat) y, (GLfloat) z);
4115 }
4116
4117
4118 static void GLAPIENTRY
4119 save_Scalef(GLfloat x, GLfloat y, GLfloat z)
4120 {
4121 GET_CURRENT_CONTEXT(ctx);
4122 Node *n;
4123 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4124 n = alloc_instruction(ctx, OPCODE_SCALE, 3);
4125 if (n) {
4126 n[1].f = x;
4127 n[2].f = y;
4128 n[3].f = z;
4129 }
4130 if (ctx->ExecuteFlag) {
4131 CALL_Scalef(ctx->Exec, (x, y, z));
4132 }
4133 }
4134
4135
4136 static void GLAPIENTRY
4137 save_Scaled(GLdouble x, GLdouble y, GLdouble z)
4138 {
4139 save_Scalef((GLfloat) x, (GLfloat) y, (GLfloat) z);
4140 }
4141
4142
4143 static void GLAPIENTRY
4144 save_Scissor(GLint x, GLint y, GLsizei width, GLsizei height)
4145 {
4146 GET_CURRENT_CONTEXT(ctx);
4147 Node *n;
4148 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4149 n = alloc_instruction(ctx, OPCODE_SCISSOR, 4);
4150 if (n) {
4151 n[1].i = x;
4152 n[2].i = y;
4153 n[3].i = width;
4154 n[4].i = height;
4155 }
4156 if (ctx->ExecuteFlag) {
4157 CALL_Scissor(ctx->Exec, (x, y, width, height));
4158 }
4159 }
4160
4161
4162 static void GLAPIENTRY
4163 save_ShadeModel(GLenum mode)
4164 {
4165 GET_CURRENT_CONTEXT(ctx);
4166 Node *n;
4167 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx);
4168
4169 if (ctx->ExecuteFlag) {
4170 CALL_ShadeModel(ctx->Exec, (mode));
4171 }
4172
4173 /* Don't compile this call if it's a no-op.
4174 * By avoiding this state change we have a better chance of
4175 * coalescing subsequent drawing commands into one batch.
4176 */
4177 if (ctx->ListState.Current.ShadeModel == mode)
4178 return;
4179
4180 SAVE_FLUSH_VERTICES(ctx);
4181
4182 ctx->ListState.Current.ShadeModel = mode;
4183
4184 n = alloc_instruction(ctx, OPCODE_SHADE_MODEL, 1);
4185 if (n) {
4186 n[1].e = mode;
4187 }
4188 }
4189
4190
4191 static void GLAPIENTRY
4192 save_StencilFunc(GLenum func, GLint ref, GLuint mask)
4193 {
4194 GET_CURRENT_CONTEXT(ctx);
4195 Node *n;
4196 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4197 n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC, 3);
4198 if (n) {
4199 n[1].e = func;
4200 n[2].i = ref;
4201 n[3].ui = mask;
4202 }
4203 if (ctx->ExecuteFlag) {
4204 CALL_StencilFunc(ctx->Exec, (func, ref, mask));
4205 }
4206 }
4207
4208
4209 static void GLAPIENTRY
4210 save_StencilMask(GLuint mask)
4211 {
4212 GET_CURRENT_CONTEXT(ctx);
4213 Node *n;
4214 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4215 n = alloc_instruction(ctx, OPCODE_STENCIL_MASK, 1);
4216 if (n) {
4217 n[1].ui = mask;
4218 }
4219 if (ctx->ExecuteFlag) {
4220 CALL_StencilMask(ctx->Exec, (mask));
4221 }
4222 }
4223
4224
4225 static void GLAPIENTRY
4226 save_StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
4227 {
4228 GET_CURRENT_CONTEXT(ctx);
4229 Node *n;
4230 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4231 n = alloc_instruction(ctx, OPCODE_STENCIL_OP, 3);
4232 if (n) {
4233 n[1].e = fail;
4234 n[2].e = zfail;
4235 n[3].e = zpass;
4236 }
4237 if (ctx->ExecuteFlag) {
4238 CALL_StencilOp(ctx->Exec, (fail, zfail, zpass));
4239 }
4240 }
4241
4242
4243 static void GLAPIENTRY
4244 save_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
4245 {
4246 GET_CURRENT_CONTEXT(ctx);
4247 Node *n;
4248 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4249 n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4);
4250 if (n) {
4251 n[1].e = face;
4252 n[2].e = func;
4253 n[3].i = ref;
4254 n[4].ui = mask;
4255 }
4256 if (ctx->ExecuteFlag) {
4257 CALL_StencilFuncSeparate(ctx->Exec, (face, func, ref, mask));
4258 }
4259 }
4260
4261
4262 static void GLAPIENTRY
4263 save_StencilFuncSeparateATI(GLenum frontfunc, GLenum backfunc, GLint ref,
4264 GLuint mask)
4265 {
4266 GET_CURRENT_CONTEXT(ctx);
4267 Node *n;
4268 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4269 /* GL_FRONT */
4270 n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4);
4271 if (n) {
4272 n[1].e = GL_FRONT;
4273 n[2].e = frontfunc;
4274 n[3].i = ref;
4275 n[4].ui = mask;
4276 }
4277 /* GL_BACK */
4278 n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4);
4279 if (n) {
4280 n[1].e = GL_BACK;
4281 n[2].e = backfunc;
4282 n[3].i = ref;
4283 n[4].ui = mask;
4284 }
4285 if (ctx->ExecuteFlag) {
4286 CALL_StencilFuncSeparate(ctx->Exec, (GL_FRONT, frontfunc, ref, mask));
4287 CALL_StencilFuncSeparate(ctx->Exec, (GL_BACK, backfunc, ref, mask));
4288 }
4289 }
4290
4291
4292 static void GLAPIENTRY
4293 save_StencilMaskSeparate(GLenum face, GLuint mask)
4294 {
4295 GET_CURRENT_CONTEXT(ctx);
4296 Node *n;
4297 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4298 n = alloc_instruction(ctx, OPCODE_STENCIL_MASK_SEPARATE, 2);
4299 if (n) {
4300 n[1].e = face;
4301 n[2].ui = mask;
4302 }
4303 if (ctx->ExecuteFlag) {
4304 CALL_StencilMaskSeparate(ctx->Exec, (face, mask));
4305 }
4306 }
4307
4308
4309 static void GLAPIENTRY
4310 save_StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
4311 {
4312 GET_CURRENT_CONTEXT(ctx);
4313 Node *n;
4314 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4315 n = alloc_instruction(ctx, OPCODE_STENCIL_OP_SEPARATE, 4);
4316 if (n) {
4317 n[1].e = face;
4318 n[2].e = fail;
4319 n[3].e = zfail;
4320 n[4].e = zpass;
4321 }
4322 if (ctx->ExecuteFlag) {
4323 CALL_StencilOpSeparate(ctx->Exec, (face, fail, zfail, zpass));
4324 }
4325 }
4326
4327
4328 static void GLAPIENTRY
4329 save_TexEnvfv(GLenum target, GLenum pname, const GLfloat *params)
4330 {
4331 GET_CURRENT_CONTEXT(ctx);
4332 Node *n;
4333 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4334 n = alloc_instruction(ctx, OPCODE_TEXENV, 6);
4335 if (n) {
4336 n[1].e = target;
4337 n[2].e = pname;
4338 if (pname == GL_TEXTURE_ENV_COLOR) {
4339 n[3].f = params[0];
4340 n[4].f = params[1];
4341 n[5].f = params[2];
4342 n[6].f = params[3];
4343 }
4344 else {
4345 n[3].f = params[0];
4346 n[4].f = n[5].f = n[6].f = 0.0F;
4347 }
4348 }
4349 if (ctx->ExecuteFlag) {
4350 CALL_TexEnvfv(ctx->Exec, (target, pname, params));
4351 }
4352 }
4353
4354
4355 static void GLAPIENTRY
4356 save_TexEnvf(GLenum target, GLenum pname, GLfloat param)
4357 {
4358 GLfloat parray[4];
4359 parray[0] = (GLfloat) param;
4360 parray[1] = parray[2] = parray[3] = 0.0F;
4361 save_TexEnvfv(target, pname, parray);
4362 }
4363
4364
4365 static void GLAPIENTRY
4366 save_TexEnvi(GLenum target, GLenum pname, GLint param)
4367 {
4368 GLfloat p[4];
4369 p[0] = (GLfloat) param;
4370 p[1] = p[2] = p[3] = 0.0F;
4371 save_TexEnvfv(target, pname, p);
4372 }
4373
4374
4375 static void GLAPIENTRY
4376 save_TexEnviv(GLenum target, GLenum pname, const GLint * param)
4377 {
4378 GLfloat p[4];
4379 if (pname == GL_TEXTURE_ENV_COLOR) {
4380 p[0] = INT_TO_FLOAT(param[0]);
4381 p[1] = INT_TO_FLOAT(param[1]);
4382 p[2] = INT_TO_FLOAT(param[2]);
4383 p[3] = INT_TO_FLOAT(param[3]);
4384 }
4385 else {
4386 p[0] = (GLfloat) param[0];
4387 p[1] = p[2] = p[3] = 0.0F;
4388 }
4389 save_TexEnvfv(target, pname, p);
4390 }
4391
4392
4393 static void GLAPIENTRY
4394 save_TexGenfv(GLenum coord, GLenum pname, const GLfloat *params)
4395 {
4396 GET_CURRENT_CONTEXT(ctx);
4397 Node *n;
4398 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4399 n = alloc_instruction(ctx, OPCODE_TEXGEN, 6);
4400 if (n) {
4401 n[1].e = coord;
4402 n[2].e = pname;
4403 n[3].f = params[0];
4404 n[4].f = params[1];
4405 n[5].f = params[2];
4406 n[6].f = params[3];
4407 }
4408 if (ctx->ExecuteFlag) {
4409 CALL_TexGenfv(ctx->Exec, (coord, pname, params));
4410 }
4411 }
4412
4413
4414 static void GLAPIENTRY
4415 save_TexGeniv(GLenum coord, GLenum pname, const GLint *params)
4416 {
4417 GLfloat p[4];
4418 p[0] = (GLfloat) params[0];
4419 p[1] = (GLfloat) params[1];
4420 p[2] = (GLfloat) params[2];
4421 p[3] = (GLfloat) params[3];
4422 save_TexGenfv(coord, pname, p);
4423 }
4424
4425
4426 static void GLAPIENTRY
4427 save_TexGend(GLenum coord, GLenum pname, GLdouble param)
4428 {
4429 GLfloat parray[4];
4430 parray[0] = (GLfloat) param;
4431 parray[1] = parray[2] = parray[3] = 0.0F;
4432 save_TexGenfv(coord, pname, parray);
4433 }
4434
4435
4436 static void GLAPIENTRY
4437 save_TexGendv(GLenum coord, GLenum pname, const GLdouble *params)
4438 {
4439 GLfloat p[4];
4440 p[0] = (GLfloat) params[0];
4441 p[1] = (GLfloat) params[1];
4442 p[2] = (GLfloat) params[2];
4443 p[3] = (GLfloat) params[3];
4444 save_TexGenfv(coord, pname, p);
4445 }
4446
4447
4448 static void GLAPIENTRY
4449 save_TexGenf(GLenum coord, GLenum pname, GLfloat param)
4450 {
4451 GLfloat parray[4];
4452 parray[0] = param;
4453 parray[1] = parray[2] = parray[3] = 0.0F;
4454 save_TexGenfv(coord, pname, parray);
4455 }
4456
4457
4458 static void GLAPIENTRY
4459 save_TexGeni(GLenum coord, GLenum pname, GLint param)
4460 {
4461 GLint parray[4];
4462 parray[0] = param;
4463 parray[1] = parray[2] = parray[3] = 0;
4464 save_TexGeniv(coord, pname, parray);
4465 }
4466
4467
4468 static void GLAPIENTRY
4469 save_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
4470 {
4471 GET_CURRENT_CONTEXT(ctx);
4472 Node *n;
4473 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4474 n = alloc_instruction(ctx, OPCODE_TEXPARAMETER, 6);
4475 if (n) {
4476 n[1].e = target;
4477 n[2].e = pname;
4478 n[3].f = params[0];
4479 n[4].f = params[1];
4480 n[5].f = params[2];
4481 n[6].f = params[3];
4482 }
4483 if (ctx->ExecuteFlag) {
4484 CALL_TexParameterfv(ctx->Exec, (target, pname, params));
4485 }
4486 }
4487
4488
4489 static void GLAPIENTRY
4490 save_TexParameterf(GLenum target, GLenum pname, GLfloat param)
4491 {
4492 GLfloat parray[4];
4493 parray[0] = param;
4494 parray[1] = parray[2] = parray[3] = 0.0F;
4495 save_TexParameterfv(target, pname, parray);
4496 }
4497
4498
4499 static void GLAPIENTRY
4500 save_TexParameteri(GLenum target, GLenum pname, GLint param)
4501 {
4502 GLfloat fparam[4];
4503 fparam[0] = (GLfloat) param;
4504 fparam[1] = fparam[2] = fparam[3] = 0.0F;
4505 save_TexParameterfv(target, pname, fparam);
4506 }
4507
4508
4509 static void GLAPIENTRY
4510 save_TexParameteriv(GLenum target, GLenum pname, const GLint *params)
4511 {
4512 GLfloat fparam[4];
4513 fparam[0] = (GLfloat) params[0];
4514 fparam[1] = fparam[2] = fparam[3] = 0.0F;
4515 save_TexParameterfv(target, pname, fparam);
4516 }
4517
4518
4519 static void GLAPIENTRY
4520 save_TexImage1D(GLenum target,
4521 GLint level, GLint components,
4522 GLsizei width, GLint border,
4523 GLenum format, GLenum type, const GLvoid * pixels)
4524 {
4525 GET_CURRENT_CONTEXT(ctx);
4526 if (target == GL_PROXY_TEXTURE_1D) {
4527 /* don't compile, execute immediately */
4528 CALL_TexImage1D(ctx->Exec, (target, level, components, width,
4529 border, format, type, pixels));
4530 }
4531 else {
4532 Node *n;
4533 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4534 n = alloc_instruction(ctx, OPCODE_TEX_IMAGE1D, 7 + POINTER_DWORDS);
4535 if (n) {
4536 n[1].e = target;
4537 n[2].i = level;
4538 n[3].i = components;
4539 n[4].i = (GLint) width;
4540 n[5].i = border;
4541 n[6].e = format;
4542 n[7].e = type;
4543 save_pointer(&n[8],
4544 unpack_image(ctx, 1, width, 1, 1, format, type,
4545 pixels, &ctx->Unpack));
4546 }
4547 if (ctx->ExecuteFlag) {
4548 CALL_TexImage1D(ctx->Exec, (target, level, components, width,
4549 border, format, type, pixels));
4550 }
4551 }
4552 }
4553
4554
4555 static void GLAPIENTRY
4556 save_TexImage2D(GLenum target,
4557 GLint level, GLint components,
4558 GLsizei width, GLsizei height, GLint border,
4559 GLenum format, GLenum type, const GLvoid * pixels)
4560 {
4561 GET_CURRENT_CONTEXT(ctx);
4562 if (target == GL_PROXY_TEXTURE_2D) {
4563 /* don't compile, execute immediately */
4564 CALL_TexImage2D(ctx->Exec, (target, level, components, width,
4565 height, border, format, type, pixels));
4566 }
4567 else {
4568 Node *n;
4569 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4570 n = alloc_instruction(ctx, OPCODE_TEX_IMAGE2D, 8 + POINTER_DWORDS);
4571 if (n) {
4572 n[1].e = target;
4573 n[2].i = level;
4574 n[3].i = components;
4575 n[4].i = (GLint) width;
4576 n[5].i = (GLint) height;
4577 n[6].i = border;
4578 n[7].e = format;
4579 n[8].e = type;
4580 save_pointer(&n[9],
4581 unpack_image(ctx, 2, width, height, 1, format, type,
4582 pixels, &ctx->Unpack));
4583 }
4584 if (ctx->ExecuteFlag) {
4585 CALL_TexImage2D(ctx->Exec, (target, level, components, width,
4586 height, border, format, type, pixels));
4587 }
4588 }
4589 }
4590
4591
4592 static void GLAPIENTRY
4593 save_TexImage3D(GLenum target,
4594 GLint level, GLint internalFormat,
4595 GLsizei width, GLsizei height, GLsizei depth,
4596 GLint border,
4597 GLenum format, GLenum type, const GLvoid * pixels)
4598 {
4599 GET_CURRENT_CONTEXT(ctx);
4600 if (target == GL_PROXY_TEXTURE_3D) {
4601 /* don't compile, execute immediately */
4602 CALL_TexImage3D(ctx->Exec, (target, level, internalFormat, width,
4603 height, depth, border, format, type,
4604 pixels));
4605 }
4606 else {
4607 Node *n;
4608 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4609 n = alloc_instruction(ctx, OPCODE_TEX_IMAGE3D, 9 + POINTER_DWORDS);
4610 if (n) {
4611 n[1].e = target;
4612 n[2].i = level;
4613 n[3].i = (GLint) internalFormat;
4614 n[4].i = (GLint) width;
4615 n[5].i = (GLint) height;
4616 n[6].i = (GLint) depth;
4617 n[7].i = border;
4618 n[8].e = format;
4619 n[9].e = type;
4620 save_pointer(&n[10],
4621 unpack_image(ctx, 3, width, height, depth, format, type,
4622 pixels, &ctx->Unpack));
4623 }
4624 if (ctx->ExecuteFlag) {
4625 CALL_TexImage3D(ctx->Exec, (target, level, internalFormat, width,
4626 height, depth, border, format, type,
4627 pixels));
4628 }
4629 }
4630 }
4631
4632
4633 static void GLAPIENTRY
4634 save_TexSubImage1D(GLenum target, GLint level, GLint xoffset,
4635 GLsizei width, GLenum format, GLenum type,
4636 const GLvoid * pixels)
4637 {
4638 GET_CURRENT_CONTEXT(ctx);
4639 Node *n;
4640
4641 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4642
4643 n = alloc_instruction(ctx, OPCODE_TEX_SUB_IMAGE1D, 6 + POINTER_DWORDS);
4644 if (n) {
4645 n[1].e = target;
4646 n[2].i = level;
4647 n[3].i = xoffset;
4648 n[4].i = (GLint) width;
4649 n[5].e = format;
4650 n[6].e = type;
4651 save_pointer(&n[7],
4652 unpack_image(ctx, 1, width, 1, 1, format, type,
4653 pixels, &ctx->Unpack));
4654 }
4655 if (ctx->ExecuteFlag) {
4656 CALL_TexSubImage1D(ctx->Exec, (target, level, xoffset, width,
4657 format, type, pixels));
4658 }
4659 }
4660
4661
4662 static void GLAPIENTRY
4663 save_TexSubImage2D(GLenum target, GLint level,
4664 GLint xoffset, GLint yoffset,
4665 GLsizei width, GLsizei height,
4666 GLenum format, GLenum type, const GLvoid * pixels)
4667 {
4668 GET_CURRENT_CONTEXT(ctx);
4669 Node *n;
4670
4671 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4672
4673 n = alloc_instruction(ctx, OPCODE_TEX_SUB_IMAGE2D, 8 + POINTER_DWORDS);
4674 if (n) {
4675 n[1].e = target;
4676 n[2].i = level;
4677 n[3].i = xoffset;
4678 n[4].i = yoffset;
4679 n[5].i = (GLint) width;
4680 n[6].i = (GLint) height;
4681 n[7].e = format;
4682 n[8].e = type;
4683 save_pointer(&n[9],
4684 unpack_image(ctx, 2, width, height, 1, format, type,
4685 pixels, &ctx->Unpack));
4686 }
4687 if (ctx->ExecuteFlag) {
4688 CALL_TexSubImage2D(ctx->Exec, (target, level, xoffset, yoffset,
4689 width, height, format, type, pixels));
4690 }
4691 }
4692
4693
4694 static void GLAPIENTRY
4695 save_TexSubImage3D(GLenum target, GLint level,
4696 GLint xoffset, GLint yoffset, GLint zoffset,
4697 GLsizei width, GLsizei height, GLsizei depth,
4698 GLenum format, GLenum type, const GLvoid * pixels)
4699 {
4700 GET_CURRENT_CONTEXT(ctx);
4701 Node *n;
4702
4703 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4704
4705 n = alloc_instruction(ctx, OPCODE_TEX_SUB_IMAGE3D, 10 + POINTER_DWORDS);
4706 if (n) {
4707 n[1].e = target;
4708 n[2].i = level;
4709 n[3].i = xoffset;
4710 n[4].i = yoffset;
4711 n[5].i = zoffset;
4712 n[6].i = (GLint) width;
4713 n[7].i = (GLint) height;
4714 n[8].i = (GLint) depth;
4715 n[9].e = format;
4716 n[10].e = type;
4717 save_pointer(&n[11],
4718 unpack_image(ctx, 3, width, height, depth, format, type,
4719 pixels, &ctx->Unpack));
4720 }
4721 if (ctx->ExecuteFlag) {
4722 CALL_TexSubImage3D(ctx->Exec, (target, level,
4723 xoffset, yoffset, zoffset,
4724 width, height, depth, format, type,
4725 pixels));
4726 }
4727 }
4728
4729
4730 static void GLAPIENTRY
4731 save_Translatef(GLfloat x, GLfloat y, GLfloat z)
4732 {
4733 GET_CURRENT_CONTEXT(ctx);
4734 Node *n;
4735 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4736 n = alloc_instruction(ctx, OPCODE_TRANSLATE, 3);
4737 if (n) {
4738 n[1].f = x;
4739 n[2].f = y;
4740 n[3].f = z;
4741 }
4742 if (ctx->ExecuteFlag) {
4743 CALL_Translatef(ctx->Exec, (x, y, z));
4744 }
4745 }
4746
4747
4748 static void GLAPIENTRY
4749 save_Translated(GLdouble x, GLdouble y, GLdouble z)
4750 {
4751 save_Translatef((GLfloat) x, (GLfloat) y, (GLfloat) z);
4752 }
4753
4754
4755
4756 static void GLAPIENTRY
4757 save_Viewport(GLint x, GLint y, GLsizei width, GLsizei height)
4758 {
4759 GET_CURRENT_CONTEXT(ctx);
4760 Node *n;
4761 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4762 n = alloc_instruction(ctx, OPCODE_VIEWPORT, 4);
4763 if (n) {
4764 n[1].i = x;
4765 n[2].i = y;
4766 n[3].i = (GLint) width;
4767 n[4].i = (GLint) height;
4768 }
4769 if (ctx->ExecuteFlag) {
4770 CALL_Viewport(ctx->Exec, (x, y, width, height));
4771 }
4772 }
4773
4774 static void GLAPIENTRY
4775 save_ViewportIndexedf(GLuint index, GLfloat x, GLfloat y, GLfloat width,
4776 GLfloat height)
4777 {
4778 GET_CURRENT_CONTEXT(ctx);
4779 Node *n;
4780 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4781 n = alloc_instruction(ctx, OPCODE_VIEWPORT_INDEXED_F, 5);
4782 if (n) {
4783 n[1].ui = index;
4784 n[2].f = x;
4785 n[3].f = y;
4786 n[4].f = width;
4787 n[5].f = height;
4788 }
4789 if (ctx->ExecuteFlag) {
4790 CALL_ViewportIndexedf(ctx->Exec, (index, x, y, width, height));
4791 }
4792 }
4793
4794 static void GLAPIENTRY
4795 save_ViewportIndexedfv(GLuint index, const GLfloat *v)
4796 {
4797 GET_CURRENT_CONTEXT(ctx);
4798 Node *n;
4799 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4800 n = alloc_instruction(ctx, OPCODE_VIEWPORT_INDEXED_FV, 5);
4801 if (n) {
4802 n[1].ui = index;
4803 n[2].f = v[0];
4804 n[3].f = v[1];
4805 n[4].f = v[2];
4806 n[5].f = v[3];
4807 }
4808 if (ctx->ExecuteFlag) {
4809 CALL_ViewportIndexedfv(ctx->Exec, (index, v));
4810 }
4811 }
4812
4813 static void GLAPIENTRY
4814 save_ViewportArrayv(GLuint first, GLsizei count, const GLfloat *v)
4815 {
4816 GET_CURRENT_CONTEXT(ctx);
4817 Node *n;
4818 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4819 n = alloc_instruction(ctx, OPCODE_VIEWPORT_ARRAY_V, 2 + POINTER_DWORDS);
4820 if (n) {
4821 n[1].ui = first;
4822 n[2].si = count;
4823 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLfloat)));
4824 }
4825 if (ctx->ExecuteFlag) {
4826 CALL_ViewportArrayv(ctx->Exec, (first, count, v));
4827 }
4828 }
4829
4830 static void GLAPIENTRY
4831 save_ScissorIndexed(GLuint index, GLint left, GLint bottom, GLsizei width,
4832 GLsizei height)
4833 {
4834 GET_CURRENT_CONTEXT(ctx);
4835 Node *n;
4836 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4837 n = alloc_instruction(ctx, OPCODE_SCISSOR_INDEXED, 5);
4838 if (n) {
4839 n[1].ui = index;
4840 n[2].i = left;
4841 n[3].i = bottom;
4842 n[4].si = width;
4843 n[5].si = height;
4844 }
4845 if (ctx->ExecuteFlag) {
4846 CALL_ScissorIndexed(ctx->Exec, (index, left, bottom, width, height));
4847 }
4848 }
4849
4850 static void GLAPIENTRY
4851 save_ScissorIndexedv(GLuint index, const GLint *v)
4852 {
4853 GET_CURRENT_CONTEXT(ctx);
4854 Node *n;
4855 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4856 n = alloc_instruction(ctx, OPCODE_SCISSOR_INDEXED_V, 5);
4857 if (n) {
4858 n[1].ui = index;
4859 n[2].i = v[0];
4860 n[3].i = v[1];
4861 n[4].si = v[2];
4862 n[5].si = v[3];
4863 }
4864 if (ctx->ExecuteFlag) {
4865 CALL_ScissorIndexedv(ctx->Exec, (index, v));
4866 }
4867 }
4868
4869 static void GLAPIENTRY
4870 save_ScissorArrayv(GLuint first, GLsizei count, const GLint *v)
4871 {
4872 GET_CURRENT_CONTEXT(ctx);
4873 Node *n;
4874 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4875 n = alloc_instruction(ctx, OPCODE_SCISSOR_ARRAY_V, 2 + POINTER_DWORDS);
4876 if (n) {
4877 n[1].ui = first;
4878 n[2].si = count;
4879 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLint)));
4880 }
4881 if (ctx->ExecuteFlag) {
4882 CALL_ScissorArrayv(ctx->Exec, (first, count, v));
4883 }
4884 }
4885
4886 static void GLAPIENTRY
4887 save_DepthRangeIndexed(GLuint index, GLclampd n, GLclampd f)
4888 {
4889 GET_CURRENT_CONTEXT(ctx);
4890 Node *node;
4891 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4892 node = alloc_instruction(ctx, OPCODE_DEPTH_INDEXED, 3);
4893 if (node) {
4894 node[1].ui = index;
4895 /* Mesa stores these as floats internally so we deliberately convert
4896 * them to a float here.
4897 */
4898 node[2].f = n;
4899 node[3].f = f;
4900 }
4901 if (ctx->ExecuteFlag) {
4902 CALL_DepthRangeIndexed(ctx->Exec, (index, n, f));
4903 }
4904 }
4905
4906 static void GLAPIENTRY
4907 save_DepthRangeArrayv(GLuint first, GLsizei count, const GLclampd *v)
4908 {
4909 GET_CURRENT_CONTEXT(ctx);
4910 Node *n;
4911 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4912 n = alloc_instruction(ctx, OPCODE_DEPTH_ARRAY_V, 2 + POINTER_DWORDS);
4913 if (n) {
4914 n[1].ui = first;
4915 n[2].si = count;
4916 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLclampd)));
4917 }
4918 if (ctx->ExecuteFlag) {
4919 CALL_DepthRangeArrayv(ctx->Exec, (first, count, v));
4920 }
4921 }
4922
4923 static void GLAPIENTRY
4924 save_WindowPos4fMESA(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
4925 {
4926 GET_CURRENT_CONTEXT(ctx);
4927 Node *n;
4928 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4929 n = alloc_instruction(ctx, OPCODE_WINDOW_POS, 4);
4930 if (n) {
4931 n[1].f = x;
4932 n[2].f = y;
4933 n[3].f = z;
4934 n[4].f = w;
4935 }
4936 if (ctx->ExecuteFlag) {
4937 CALL_WindowPos4fMESA(ctx->Exec, (x, y, z, w));
4938 }
4939 }
4940
4941 static void GLAPIENTRY
4942 save_WindowPos2dMESA(GLdouble x, GLdouble y)
4943 {
4944 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
4945 }
4946
4947 static void GLAPIENTRY
4948 save_WindowPos2fMESA(GLfloat x, GLfloat y)
4949 {
4950 save_WindowPos4fMESA(x, y, 0.0F, 1.0F);
4951 }
4952
4953 static void GLAPIENTRY
4954 save_WindowPos2iMESA(GLint x, GLint y)
4955 {
4956 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
4957 }
4958
4959 static void GLAPIENTRY
4960 save_WindowPos2sMESA(GLshort x, GLshort y)
4961 {
4962 save_WindowPos4fMESA(x, y, 0.0F, 1.0F);
4963 }
4964
4965 static void GLAPIENTRY
4966 save_WindowPos3dMESA(GLdouble x, GLdouble y, GLdouble z)
4967 {
4968 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
4969 }
4970
4971 static void GLAPIENTRY
4972 save_WindowPos3fMESA(GLfloat x, GLfloat y, GLfloat z)
4973 {
4974 save_WindowPos4fMESA(x, y, z, 1.0F);
4975 }
4976
4977 static void GLAPIENTRY
4978 save_WindowPos3iMESA(GLint x, GLint y, GLint z)
4979 {
4980 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
4981 }
4982
4983 static void GLAPIENTRY
4984 save_WindowPos3sMESA(GLshort x, GLshort y, GLshort z)
4985 {
4986 save_WindowPos4fMESA(x, y, z, 1.0F);
4987 }
4988
4989 static void GLAPIENTRY
4990 save_WindowPos4dMESA(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
4991 {
4992 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
4993 }
4994
4995 static void GLAPIENTRY
4996 save_WindowPos4iMESA(GLint x, GLint y, GLint z, GLint w)
4997 {
4998 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
4999 }
5000
5001 static void GLAPIENTRY
5002 save_WindowPos4sMESA(GLshort x, GLshort y, GLshort z, GLshort w)
5003 {
5004 save_WindowPos4fMESA(x, y, z, w);
5005 }
5006
5007 static void GLAPIENTRY
5008 save_WindowPos2dvMESA(const GLdouble * v)
5009 {
5010 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
5011 }
5012
5013 static void GLAPIENTRY
5014 save_WindowPos2fvMESA(const GLfloat * v)
5015 {
5016 save_WindowPos4fMESA(v[0], v[1], 0.0F, 1.0F);
5017 }
5018
5019 static void GLAPIENTRY
5020 save_WindowPos2ivMESA(const GLint * v)
5021 {
5022 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
5023 }
5024
5025 static void GLAPIENTRY
5026 save_WindowPos2svMESA(const GLshort * v)
5027 {
5028 save_WindowPos4fMESA(v[0], v[1], 0.0F, 1.0F);
5029 }
5030
5031 static void GLAPIENTRY
5032 save_WindowPos3dvMESA(const GLdouble * v)
5033 {
5034 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
5035 }
5036
5037 static void GLAPIENTRY
5038 save_WindowPos3fvMESA(const GLfloat * v)
5039 {
5040 save_WindowPos4fMESA(v[0], v[1], v[2], 1.0F);
5041 }
5042
5043 static void GLAPIENTRY
5044 save_WindowPos3ivMESA(const GLint * v)
5045 {
5046 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
5047 }
5048
5049 static void GLAPIENTRY
5050 save_WindowPos3svMESA(const GLshort * v)
5051 {
5052 save_WindowPos4fMESA(v[0], v[1], v[2], 1.0F);
5053 }
5054
5055 static void GLAPIENTRY
5056 save_WindowPos4dvMESA(const GLdouble * v)
5057 {
5058 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1],
5059 (GLfloat) v[2], (GLfloat) v[3]);
5060 }
5061
5062 static void GLAPIENTRY
5063 save_WindowPos4fvMESA(const GLfloat * v)
5064 {
5065 save_WindowPos4fMESA(v[0], v[1], v[2], v[3]);
5066 }
5067
5068 static void GLAPIENTRY
5069 save_WindowPos4ivMESA(const GLint * v)
5070 {
5071 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1],
5072 (GLfloat) v[2], (GLfloat) v[3]);
5073 }
5074
5075 static void GLAPIENTRY
5076 save_WindowPos4svMESA(const GLshort * v)
5077 {
5078 save_WindowPos4fMESA(v[0], v[1], v[2], v[3]);
5079 }
5080
5081
5082
5083 /* GL_ARB_multitexture */
5084 static void GLAPIENTRY
5085 save_ActiveTextureARB(GLenum target)
5086 {
5087 GET_CURRENT_CONTEXT(ctx);
5088 Node *n;
5089 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5090 n = alloc_instruction(ctx, OPCODE_ACTIVE_TEXTURE, 1);
5091 if (n) {
5092 n[1].e = target;
5093 }
5094 if (ctx->ExecuteFlag) {
5095 CALL_ActiveTexture(ctx->Exec, (target));
5096 }
5097 }
5098
5099
5100 /* GL_ARB_transpose_matrix */
5101
5102 static void GLAPIENTRY
5103 save_LoadTransposeMatrixdARB(const GLdouble m[16])
5104 {
5105 GLfloat tm[16];
5106 _math_transposefd(tm, m);
5107 save_LoadMatrixf(tm);
5108 }
5109
5110
5111 static void GLAPIENTRY
5112 save_LoadTransposeMatrixfARB(const GLfloat m[16])
5113 {
5114 GLfloat tm[16];
5115 _math_transposef(tm, m);
5116 save_LoadMatrixf(tm);
5117 }
5118
5119
5120 static void GLAPIENTRY
5121 save_MultTransposeMatrixdARB(const GLdouble m[16])
5122 {
5123 GLfloat tm[16];
5124 _math_transposefd(tm, m);
5125 save_MultMatrixf(tm);
5126 }
5127
5128
5129 static void GLAPIENTRY
5130 save_MultTransposeMatrixfARB(const GLfloat m[16])
5131 {
5132 GLfloat tm[16];
5133 _math_transposef(tm, m);
5134 save_MultMatrixf(tm);
5135 }
5136
5137 static GLvoid *copy_data(const GLvoid *data, GLsizei size, const char *func)
5138 {
5139 GET_CURRENT_CONTEXT(ctx);
5140 GLvoid *image;
5141
5142 if (!data)
5143 return NULL;
5144
5145 image = malloc(size);
5146 if (!image) {
5147 _mesa_error(ctx, GL_OUT_OF_MEMORY, "%s", func);
5148 return NULL;
5149 }
5150 memcpy(image, data, size);
5151
5152 return image;
5153 }
5154
5155
5156 /* GL_ARB_texture_compression */
5157 static void GLAPIENTRY
5158 save_CompressedTexImage1DARB(GLenum target, GLint level,
5159 GLenum internalFormat, GLsizei width,
5160 GLint border, GLsizei imageSize,
5161 const GLvoid * data)
5162 {
5163 GET_CURRENT_CONTEXT(ctx);
5164 if (target == GL_PROXY_TEXTURE_1D) {
5165 /* don't compile, execute immediately */
5166 CALL_CompressedTexImage1D(ctx->Exec, (target, level, internalFormat,
5167 width, border, imageSize,
5168 data));
5169 }
5170 else {
5171 Node *n;
5172 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5173
5174 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_1D,
5175 6 + POINTER_DWORDS);
5176 if (n) {
5177 n[1].e = target;
5178 n[2].i = level;
5179 n[3].e = internalFormat;
5180 n[4].i = (GLint) width;
5181 n[5].i = border;
5182 n[6].i = imageSize;
5183 save_pointer(&n[7],
5184 copy_data(data, imageSize, "glCompressedTexImage1DARB"));
5185 }
5186 if (ctx->ExecuteFlag) {
5187 CALL_CompressedTexImage1D(ctx->Exec,
5188 (target, level, internalFormat, width,
5189 border, imageSize, data));
5190 }
5191 }
5192 }
5193
5194
5195 static void GLAPIENTRY
5196 save_CompressedTexImage2DARB(GLenum target, GLint level,
5197 GLenum internalFormat, GLsizei width,
5198 GLsizei height, GLint border, GLsizei imageSize,
5199 const GLvoid * data)
5200 {
5201 GET_CURRENT_CONTEXT(ctx);
5202 if (target == GL_PROXY_TEXTURE_2D) {
5203 /* don't compile, execute immediately */
5204 CALL_CompressedTexImage2D(ctx->Exec, (target, level, internalFormat,
5205 width, height, border,
5206 imageSize, data));
5207 }
5208 else {
5209 Node *n;
5210 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5211
5212 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_2D,
5213 7 + POINTER_DWORDS);
5214 if (n) {
5215 n[1].e = target;
5216 n[2].i = level;
5217 n[3].e = internalFormat;
5218 n[4].i = (GLint) width;
5219 n[5].i = (GLint) height;
5220 n[6].i = border;
5221 n[7].i = imageSize;
5222 save_pointer(&n[8],
5223 copy_data(data, imageSize, "glCompressedTexImage2DARB"));
5224 }
5225 if (ctx->ExecuteFlag) {
5226 CALL_CompressedTexImage2D(ctx->Exec,
5227 (target, level, internalFormat, width,
5228 height, border, imageSize, data));
5229 }
5230 }
5231 }
5232
5233
5234 static void GLAPIENTRY
5235 save_CompressedTexImage3DARB(GLenum target, GLint level,
5236 GLenum internalFormat, GLsizei width,
5237 GLsizei height, GLsizei depth, GLint border,
5238 GLsizei imageSize, const GLvoid * data)
5239 {
5240 GET_CURRENT_CONTEXT(ctx);
5241 if (target == GL_PROXY_TEXTURE_3D) {
5242 /* don't compile, execute immediately */
5243 CALL_CompressedTexImage3D(ctx->Exec, (target, level, internalFormat,
5244 width, height, depth, border,
5245 imageSize, data));
5246 }
5247 else {
5248 Node *n;
5249 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5250
5251 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_3D,
5252 8 + POINTER_DWORDS);
5253 if (n) {
5254 n[1].e = target;
5255 n[2].i = level;
5256 n[3].e = internalFormat;
5257 n[4].i = (GLint) width;
5258 n[5].i = (GLint) height;
5259 n[6].i = (GLint) depth;
5260 n[7].i = border;
5261 n[8].i = imageSize;
5262 save_pointer(&n[9],
5263 copy_data(data, imageSize, "glCompressedTexImage3DARB"));
5264 }
5265 if (ctx->ExecuteFlag) {
5266 CALL_CompressedTexImage3D(ctx->Exec,
5267 (target, level, internalFormat, width,
5268 height, depth, border, imageSize,
5269 data));
5270 }
5271 }
5272 }
5273
5274
5275 static void GLAPIENTRY
5276 save_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset,
5277 GLsizei width, GLenum format,
5278 GLsizei imageSize, const GLvoid * data)
5279 {
5280 Node *n;
5281 GET_CURRENT_CONTEXT(ctx);
5282 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5283
5284 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D,
5285 6 + POINTER_DWORDS);
5286 if (n) {
5287 n[1].e = target;
5288 n[2].i = level;
5289 n[3].i = xoffset;
5290 n[4].i = (GLint) width;
5291 n[5].e = format;
5292 n[6].i = imageSize;
5293 save_pointer(&n[7],
5294 copy_data(data, imageSize, "glCompressedTexSubImage1DARB"));
5295 }
5296 if (ctx->ExecuteFlag) {
5297 CALL_CompressedTexSubImage1D(ctx->Exec, (target, level, xoffset,
5298 width, format, imageSize,
5299 data));
5300 }
5301 }
5302
5303
5304 static void GLAPIENTRY
5305 save_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset,
5306 GLint yoffset, GLsizei width, GLsizei height,
5307 GLenum format, GLsizei imageSize,
5308 const GLvoid * data)
5309 {
5310 Node *n;
5311 GET_CURRENT_CONTEXT(ctx);
5312 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5313
5314 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D,
5315 8 + POINTER_DWORDS);
5316 if (n) {
5317 n[1].e = target;
5318 n[2].i = level;
5319 n[3].i = xoffset;
5320 n[4].i = yoffset;
5321 n[5].i = (GLint) width;
5322 n[6].i = (GLint) height;
5323 n[7].e = format;
5324 n[8].i = imageSize;
5325 save_pointer(&n[9],
5326 copy_data(data, imageSize, "glCompressedTexSubImage2DARB"));
5327 }
5328 if (ctx->ExecuteFlag) {
5329 CALL_CompressedTexSubImage2D(ctx->Exec,
5330 (target, level, xoffset, yoffset, width,
5331 height, format, imageSize, data));
5332 }
5333 }
5334
5335
5336 static void GLAPIENTRY
5337 save_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset,
5338 GLint yoffset, GLint zoffset, GLsizei width,
5339 GLsizei height, GLsizei depth, GLenum format,
5340 GLsizei imageSize, const GLvoid * data)
5341 {
5342 Node *n;
5343 GET_CURRENT_CONTEXT(ctx);
5344 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5345
5346 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D,
5347 10 + POINTER_DWORDS);
5348 if (n) {
5349 n[1].e = target;
5350 n[2].i = level;
5351 n[3].i = xoffset;
5352 n[4].i = yoffset;
5353 n[5].i = zoffset;
5354 n[6].i = (GLint) width;
5355 n[7].i = (GLint) height;
5356 n[8].i = (GLint) depth;
5357 n[9].e = format;
5358 n[10].i = imageSize;
5359 save_pointer(&n[11],
5360 copy_data(data, imageSize, "glCompressedTexSubImage3DARB"));
5361 }
5362 if (ctx->ExecuteFlag) {
5363 CALL_CompressedTexSubImage3D(ctx->Exec,
5364 (target, level, xoffset, yoffset,
5365 zoffset, width, height, depth, format,
5366 imageSize, data));
5367 }
5368 }
5369
5370
5371 /* GL_ARB_multisample */
5372 static void GLAPIENTRY
5373 save_SampleCoverageARB(GLclampf value, GLboolean invert)
5374 {
5375 GET_CURRENT_CONTEXT(ctx);
5376 Node *n;
5377 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5378 n = alloc_instruction(ctx, OPCODE_SAMPLE_COVERAGE, 2);
5379 if (n) {
5380 n[1].f = value;
5381 n[2].b = invert;
5382 }
5383 if (ctx->ExecuteFlag) {
5384 CALL_SampleCoverage(ctx->Exec, (value, invert));
5385 }
5386 }
5387
5388
5389 /*
5390 * GL_ARB_vertex_program
5391 */
5392 static void GLAPIENTRY
5393 save_BindProgramARB(GLenum target, GLuint id)
5394 {
5395 GET_CURRENT_CONTEXT(ctx);
5396 Node *n;
5397 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5398 n = alloc_instruction(ctx, OPCODE_BIND_PROGRAM_ARB, 2);
5399 if (n) {
5400 n[1].e = target;
5401 n[2].ui = id;
5402 }
5403 if (ctx->ExecuteFlag) {
5404 CALL_BindProgramARB(ctx->Exec, (target, id));
5405 }
5406 }
5407
5408 static void GLAPIENTRY
5409 save_ProgramEnvParameter4fARB(GLenum target, GLuint index,
5410 GLfloat x, GLfloat y, GLfloat z, GLfloat w)
5411 {
5412 GET_CURRENT_CONTEXT(ctx);
5413 Node *n;
5414 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5415 n = alloc_instruction(ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6);
5416 if (n) {
5417 n[1].e = target;
5418 n[2].ui = index;
5419 n[3].f = x;
5420 n[4].f = y;
5421 n[5].f = z;
5422 n[6].f = w;
5423 }
5424 if (ctx->ExecuteFlag) {
5425 CALL_ProgramEnvParameter4fARB(ctx->Exec, (target, index, x, y, z, w));
5426 }
5427 }
5428
5429
5430 static void GLAPIENTRY
5431 save_ProgramEnvParameter4fvARB(GLenum target, GLuint index,
5432 const GLfloat *params)
5433 {
5434 save_ProgramEnvParameter4fARB(target, index, params[0], params[1],
5435 params[2], params[3]);
5436 }
5437
5438
5439 static void GLAPIENTRY
5440 save_ProgramEnvParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
5441 const GLfloat * params)
5442 {
5443 GET_CURRENT_CONTEXT(ctx);
5444 Node *n;
5445 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5446
5447 if (count > 0) {
5448 GLint i;
5449 const GLfloat * p = params;
5450
5451 for (i = 0 ; i < count ; i++) {
5452 n = alloc_instruction(ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6);
5453 if (n) {
5454 n[1].e = target;
5455 n[2].ui = index;
5456 n[3].f = p[0];
5457 n[4].f = p[1];
5458 n[5].f = p[2];
5459 n[6].f = p[3];
5460 p += 4;
5461 }
5462 }
5463 }
5464
5465 if (ctx->ExecuteFlag) {
5466 CALL_ProgramEnvParameters4fvEXT(ctx->Exec, (target, index, count, params));
5467 }
5468 }
5469
5470
5471 static void GLAPIENTRY
5472 save_ProgramEnvParameter4dARB(GLenum target, GLuint index,
5473 GLdouble x, GLdouble y, GLdouble z, GLdouble w)
5474 {
5475 save_ProgramEnvParameter4fARB(target, index,
5476 (GLfloat) x,
5477 (GLfloat) y, (GLfloat) z, (GLfloat) w);
5478 }
5479
5480
5481 static void GLAPIENTRY
5482 save_ProgramEnvParameter4dvARB(GLenum target, GLuint index,
5483 const GLdouble *params)
5484 {
5485 save_ProgramEnvParameter4fARB(target, index,
5486 (GLfloat) params[0],
5487 (GLfloat) params[1],
5488 (GLfloat) params[2], (GLfloat) params[3]);
5489 }
5490
5491
5492 static void GLAPIENTRY
5493 save_ProgramLocalParameter4fARB(GLenum target, GLuint index,
5494 GLfloat x, GLfloat y, GLfloat z, GLfloat w)
5495 {
5496 GET_CURRENT_CONTEXT(ctx);
5497 Node *n;
5498 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5499 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5500 if (n) {
5501 n[1].e = target;
5502 n[2].ui = index;
5503 n[3].f = x;
5504 n[4].f = y;
5505 n[5].f = z;
5506 n[6].f = w;
5507 }
5508 if (ctx->ExecuteFlag) {
5509 CALL_ProgramLocalParameter4fARB(ctx->Exec, (target, index, x, y, z, w));
5510 }
5511 }
5512
5513
5514 static void GLAPIENTRY
5515 save_ProgramLocalParameter4fvARB(GLenum target, GLuint index,
5516 const GLfloat *params)
5517 {
5518 GET_CURRENT_CONTEXT(ctx);
5519 Node *n;
5520 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5521 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5522 if (n) {
5523 n[1].e = target;
5524 n[2].ui = index;
5525 n[3].f = params[0];
5526 n[4].f = params[1];
5527 n[5].f = params[2];
5528 n[6].f = params[3];
5529 }
5530 if (ctx->ExecuteFlag) {
5531 CALL_ProgramLocalParameter4fvARB(ctx->Exec, (target, index, params));
5532 }
5533 }
5534
5535
5536 static void GLAPIENTRY
5537 save_ProgramLocalParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
5538 const GLfloat *params)
5539 {
5540 GET_CURRENT_CONTEXT(ctx);
5541 Node *n;
5542 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5543
5544 if (count > 0) {
5545 GLint i;
5546 const GLfloat * p = params;
5547
5548 for (i = 0 ; i < count ; i++) {
5549 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5550 if (n) {
5551 n[1].e = target;
5552 n[2].ui = index;
5553 n[3].f = p[0];
5554 n[4].f = p[1];
5555 n[5].f = p[2];
5556 n[6].f = p[3];
5557 p += 4;
5558 }
5559 }
5560 }
5561
5562 if (ctx->ExecuteFlag) {
5563 CALL_ProgramLocalParameters4fvEXT(ctx->Exec, (target, index, count, params));
5564 }
5565 }
5566
5567
5568 static void GLAPIENTRY
5569 save_ProgramLocalParameter4dARB(GLenum target, GLuint index,
5570 GLdouble x, GLdouble y,
5571 GLdouble z, GLdouble w)
5572 {
5573 GET_CURRENT_CONTEXT(ctx);
5574 Node *n;
5575 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5576 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5577 if (n) {
5578 n[1].e = target;
5579 n[2].ui = index;
5580 n[3].f = (GLfloat) x;
5581 n[4].f = (GLfloat) y;
5582 n[5].f = (GLfloat) z;
5583 n[6].f = (GLfloat) w;
5584 }
5585 if (ctx->ExecuteFlag) {
5586 CALL_ProgramLocalParameter4dARB(ctx->Exec, (target, index, x, y, z, w));
5587 }
5588 }
5589
5590
5591 static void GLAPIENTRY
5592 save_ProgramLocalParameter4dvARB(GLenum target, GLuint index,
5593 const GLdouble *params)
5594 {
5595 GET_CURRENT_CONTEXT(ctx);
5596 Node *n;
5597 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5598 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5599 if (n) {
5600 n[1].e = target;
5601 n[2].ui = index;
5602 n[3].f = (GLfloat) params[0];
5603 n[4].f = (GLfloat) params[1];
5604 n[5].f = (GLfloat) params[2];
5605 n[6].f = (GLfloat) params[3];
5606 }
5607 if (ctx->ExecuteFlag) {
5608 CALL_ProgramLocalParameter4dvARB(ctx->Exec, (target, index, params));
5609 }
5610 }
5611
5612
5613 /* GL_EXT_stencil_two_side */
5614 static void GLAPIENTRY
5615 save_ActiveStencilFaceEXT(GLenum face)
5616 {
5617 GET_CURRENT_CONTEXT(ctx);
5618 Node *n;
5619 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5620 n = alloc_instruction(ctx, OPCODE_ACTIVE_STENCIL_FACE_EXT, 1);
5621 if (n) {
5622 n[1].e = face;
5623 }
5624 if (ctx->ExecuteFlag) {
5625 CALL_ActiveStencilFaceEXT(ctx->Exec, (face));
5626 }
5627 }
5628
5629
5630 /* GL_EXT_depth_bounds_test */
5631 static void GLAPIENTRY
5632 save_DepthBoundsEXT(GLclampd zmin, GLclampd zmax)
5633 {
5634 GET_CURRENT_CONTEXT(ctx);
5635 Node *n;
5636 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5637 n = alloc_instruction(ctx, OPCODE_DEPTH_BOUNDS_EXT, 2);
5638 if (n) {
5639 n[1].f = (GLfloat) zmin;
5640 n[2].f = (GLfloat) zmax;
5641 }
5642 if (ctx->ExecuteFlag) {
5643 CALL_DepthBoundsEXT(ctx->Exec, (zmin, zmax));
5644 }
5645 }
5646
5647
5648
5649 static void GLAPIENTRY
5650 save_ProgramStringARB(GLenum target, GLenum format, GLsizei len,
5651 const GLvoid * string)
5652 {
5653 GET_CURRENT_CONTEXT(ctx);
5654 Node *n;
5655
5656 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5657
5658 n = alloc_instruction(ctx, OPCODE_PROGRAM_STRING_ARB, 3 + POINTER_DWORDS);
5659 if (n) {
5660 GLubyte *programCopy = malloc(len);
5661 if (!programCopy) {
5662 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramStringARB");
5663 return;
5664 }
5665 memcpy(programCopy, string, len);
5666 n[1].e = target;
5667 n[2].e = format;
5668 n[3].i = len;
5669 save_pointer(&n[4], programCopy);
5670 }
5671 if (ctx->ExecuteFlag) {
5672 CALL_ProgramStringARB(ctx->Exec, (target, format, len, string));
5673 }
5674 }
5675
5676
5677 static void GLAPIENTRY
5678 save_BeginQueryARB(GLenum target, GLuint id)
5679 {
5680 GET_CURRENT_CONTEXT(ctx);
5681 Node *n;
5682 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5683 n = alloc_instruction(ctx, OPCODE_BEGIN_QUERY_ARB, 2);
5684 if (n) {
5685 n[1].e = target;
5686 n[2].ui = id;
5687 }
5688 if (ctx->ExecuteFlag) {
5689 CALL_BeginQuery(ctx->Exec, (target, id));
5690 }
5691 }
5692
5693 static void GLAPIENTRY
5694 save_EndQueryARB(GLenum target)
5695 {
5696 GET_CURRENT_CONTEXT(ctx);
5697 Node *n;
5698 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5699 n = alloc_instruction(ctx, OPCODE_END_QUERY_ARB, 1);
5700 if (n) {
5701 n[1].e = target;
5702 }
5703 if (ctx->ExecuteFlag) {
5704 CALL_EndQuery(ctx->Exec, (target));
5705 }
5706 }
5707
5708 static void GLAPIENTRY
5709 save_QueryCounter(GLuint id, GLenum target)
5710 {
5711 GET_CURRENT_CONTEXT(ctx);
5712 Node *n;
5713 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5714 n = alloc_instruction(ctx, OPCODE_QUERY_COUNTER, 2);
5715 if (n) {
5716 n[1].ui = id;
5717 n[2].e = target;
5718 }
5719 if (ctx->ExecuteFlag) {
5720 CALL_QueryCounter(ctx->Exec, (id, target));
5721 }
5722 }
5723
5724 static void GLAPIENTRY
5725 save_BeginQueryIndexed(GLenum target, GLuint index, GLuint id)
5726 {
5727 GET_CURRENT_CONTEXT(ctx);
5728 Node *n;
5729 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5730 n = alloc_instruction(ctx, OPCODE_BEGIN_QUERY_INDEXED, 3);
5731 if (n) {
5732 n[1].e = target;
5733 n[2].ui = index;
5734 n[3].ui = id;
5735 }
5736 if (ctx->ExecuteFlag) {
5737 CALL_BeginQueryIndexed(ctx->Exec, (target, index, id));
5738 }
5739 }
5740
5741 static void GLAPIENTRY
5742 save_EndQueryIndexed(GLenum target, GLuint index)
5743 {
5744 GET_CURRENT_CONTEXT(ctx);
5745 Node *n;
5746 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5747 n = alloc_instruction(ctx, OPCODE_END_QUERY_INDEXED, 2);
5748 if (n) {
5749 n[1].e = target;
5750 n[2].ui = index;
5751 }
5752 if (ctx->ExecuteFlag) {
5753 CALL_EndQueryIndexed(ctx->Exec, (target, index));
5754 }
5755 }
5756
5757
5758 static void GLAPIENTRY
5759 save_DrawBuffersARB(GLsizei count, const GLenum * buffers)
5760 {
5761 GET_CURRENT_CONTEXT(ctx);
5762 Node *n;
5763 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5764 n = alloc_instruction(ctx, OPCODE_DRAW_BUFFERS_ARB, 1 + MAX_DRAW_BUFFERS);
5765 if (n) {
5766 GLint i;
5767 n[1].i = count;
5768 if (count > MAX_DRAW_BUFFERS)
5769 count = MAX_DRAW_BUFFERS;
5770 for (i = 0; i < count; i++) {
5771 n[2 + i].e = buffers[i];
5772 }
5773 }
5774 if (ctx->ExecuteFlag) {
5775 CALL_DrawBuffers(ctx->Exec, (count, buffers));
5776 }
5777 }
5778
5779 static void GLAPIENTRY
5780 save_BindFragmentShaderATI(GLuint id)
5781 {
5782 GET_CURRENT_CONTEXT(ctx);
5783 Node *n;
5784
5785 n = alloc_instruction(ctx, OPCODE_BIND_FRAGMENT_SHADER_ATI, 1);
5786 if (n) {
5787 n[1].ui = id;
5788 }
5789 if (ctx->ExecuteFlag) {
5790 CALL_BindFragmentShaderATI(ctx->Exec, (id));
5791 }
5792 }
5793
5794 static void GLAPIENTRY
5795 save_SetFragmentShaderConstantATI(GLuint dst, const GLfloat *value)
5796 {
5797 GET_CURRENT_CONTEXT(ctx);
5798 Node *n;
5799
5800 n = alloc_instruction(ctx, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI, 5);
5801 if (n) {
5802 n[1].ui = dst;
5803 n[2].f = value[0];
5804 n[3].f = value[1];
5805 n[4].f = value[2];
5806 n[5].f = value[3];
5807 }
5808 if (ctx->ExecuteFlag) {
5809 CALL_SetFragmentShaderConstantATI(ctx->Exec, (dst, value));
5810 }
5811 }
5812
5813 static void GLAPIENTRY
5814 save_Attr1fNV(GLenum attr, GLfloat x)
5815 {
5816 GET_CURRENT_CONTEXT(ctx);
5817 Node *n;
5818 SAVE_FLUSH_VERTICES(ctx);
5819 n = alloc_instruction(ctx, OPCODE_ATTR_1F_NV, 2);
5820 if (n) {
5821 n[1].e = attr;
5822 n[2].f = x;
5823 }
5824
5825 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5826 ctx->ListState.ActiveAttribSize[attr] = 1;
5827 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, 0, 0, 1);
5828
5829 if (ctx->ExecuteFlag) {
5830 CALL_VertexAttrib1fNV(ctx->Exec, (attr, x));
5831 }
5832 }
5833
5834 static void GLAPIENTRY
5835 save_Attr2fNV(GLenum attr, GLfloat x, GLfloat y)
5836 {
5837 GET_CURRENT_CONTEXT(ctx);
5838 Node *n;
5839 SAVE_FLUSH_VERTICES(ctx);
5840 n = alloc_instruction(ctx, OPCODE_ATTR_2F_NV, 3);
5841 if (n) {
5842 n[1].e = attr;
5843 n[2].f = x;
5844 n[3].f = y;
5845 }
5846
5847 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5848 ctx->ListState.ActiveAttribSize[attr] = 2;
5849 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, 0, 1);
5850
5851 if (ctx->ExecuteFlag) {
5852 CALL_VertexAttrib2fNV(ctx->Exec, (attr, x, y));
5853 }
5854 }
5855
5856 static void GLAPIENTRY
5857 save_Attr3fNV(GLenum attr, GLfloat x, GLfloat y, GLfloat z)
5858 {
5859 GET_CURRENT_CONTEXT(ctx);
5860 Node *n;
5861 SAVE_FLUSH_VERTICES(ctx);
5862 n = alloc_instruction(ctx, OPCODE_ATTR_3F_NV, 4);
5863 if (n) {
5864 n[1].e = attr;
5865 n[2].f = x;
5866 n[3].f = y;
5867 n[4].f = z;
5868 }
5869
5870 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5871 ctx->ListState.ActiveAttribSize[attr] = 3;
5872 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, 1);
5873
5874 if (ctx->ExecuteFlag) {
5875 CALL_VertexAttrib3fNV(ctx->Exec, (attr, x, y, z));
5876 }
5877 }
5878
5879 static void GLAPIENTRY
5880 save_Attr4fNV(GLenum attr, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
5881 {
5882 GET_CURRENT_CONTEXT(ctx);
5883 Node *n;
5884 SAVE_FLUSH_VERTICES(ctx);
5885 n = alloc_instruction(ctx, OPCODE_ATTR_4F_NV, 5);
5886 if (n) {
5887 n[1].e = attr;
5888 n[2].f = x;
5889 n[3].f = y;
5890 n[4].f = z;
5891 n[5].f = w;
5892 }
5893
5894 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5895 ctx->ListState.ActiveAttribSize[attr] = 4;
5896 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, w);
5897
5898 if (ctx->ExecuteFlag) {
5899 CALL_VertexAttrib4fNV(ctx->Exec, (attr, x, y, z, w));
5900 }
5901 }
5902
5903
5904 static void GLAPIENTRY
5905 save_Attr1fARB(GLenum attr, GLfloat x)
5906 {
5907 GET_CURRENT_CONTEXT(ctx);
5908 Node *n;
5909 SAVE_FLUSH_VERTICES(ctx);
5910 n = alloc_instruction(ctx, OPCODE_ATTR_1F_ARB, 2);
5911 if (n) {
5912 n[1].e = attr;
5913 n[2].f = x;
5914 }
5915
5916 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5917 ctx->ListState.ActiveAttribSize[attr] = 1;
5918 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, 0, 0, 1);
5919
5920 if (ctx->ExecuteFlag) {
5921 CALL_VertexAttrib1fARB(ctx->Exec, (attr, x));
5922 }
5923 }
5924
5925 static void GLAPIENTRY
5926 save_Attr2fARB(GLenum attr, GLfloat x, GLfloat y)
5927 {
5928 GET_CURRENT_CONTEXT(ctx);
5929 Node *n;
5930 SAVE_FLUSH_VERTICES(ctx);
5931 n = alloc_instruction(ctx, OPCODE_ATTR_2F_ARB, 3);
5932 if (n) {
5933 n[1].e = attr;
5934 n[2].f = x;
5935 n[3].f = y;
5936 }
5937
5938 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5939 ctx->ListState.ActiveAttribSize[attr] = 2;
5940 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, 0, 1);
5941
5942 if (ctx->ExecuteFlag) {
5943 CALL_VertexAttrib2fARB(ctx->Exec, (attr, x, y));
5944 }
5945 }
5946
5947 static void GLAPIENTRY
5948 save_Attr3fARB(GLenum attr, GLfloat x, GLfloat y, GLfloat z)
5949 {
5950 GET_CURRENT_CONTEXT(ctx);
5951 Node *n;
5952 SAVE_FLUSH_VERTICES(ctx);
5953 n = alloc_instruction(ctx, OPCODE_ATTR_3F_ARB, 4);
5954 if (n) {
5955 n[1].e = attr;
5956 n[2].f = x;
5957 n[3].f = y;
5958 n[4].f = z;
5959 }
5960
5961 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5962 ctx->ListState.ActiveAttribSize[attr] = 3;
5963 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, 1);
5964
5965 if (ctx->ExecuteFlag) {
5966 CALL_VertexAttrib3fARB(ctx->Exec, (attr, x, y, z));
5967 }
5968 }
5969
5970 static void GLAPIENTRY
5971 save_Attr4fARB(GLenum attr, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
5972 {
5973 GET_CURRENT_CONTEXT(ctx);
5974 Node *n;
5975 SAVE_FLUSH_VERTICES(ctx);
5976 n = alloc_instruction(ctx, OPCODE_ATTR_4F_ARB, 5);
5977 if (n) {
5978 n[1].e = attr;
5979 n[2].f = x;
5980 n[3].f = y;
5981 n[4].f = z;
5982 n[5].f = w;
5983 }
5984
5985 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5986 ctx->ListState.ActiveAttribSize[attr] = 4;
5987 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, w);
5988
5989 if (ctx->ExecuteFlag) {
5990 CALL_VertexAttrib4fARB(ctx->Exec, (attr, x, y, z, w));
5991 }
5992 }
5993
5994
5995 static void GLAPIENTRY
5996 save_EvalCoord1f(GLfloat x)
5997 {
5998 GET_CURRENT_CONTEXT(ctx);
5999 Node *n;
6000 SAVE_FLUSH_VERTICES(ctx);
6001 n = alloc_instruction(ctx, OPCODE_EVAL_C1, 1);
6002 if (n) {
6003 n[1].f = x;
6004 }
6005 if (ctx->ExecuteFlag) {
6006 CALL_EvalCoord1f(ctx->Exec, (x));
6007 }
6008 }
6009
6010 static void GLAPIENTRY
6011 save_EvalCoord1fv(const GLfloat * v)
6012 {
6013 save_EvalCoord1f(v[0]);
6014 }
6015
6016 static void GLAPIENTRY
6017 save_EvalCoord2f(GLfloat x, GLfloat y)
6018 {
6019 GET_CURRENT_CONTEXT(ctx);
6020 Node *n;
6021 SAVE_FLUSH_VERTICES(ctx);
6022 n = alloc_instruction(ctx, OPCODE_EVAL_C2, 2);
6023 if (n) {
6024 n[1].f = x;
6025 n[2].f = y;
6026 }
6027 if (ctx->ExecuteFlag) {
6028 CALL_EvalCoord2f(ctx->Exec, (x, y));
6029 }
6030 }
6031
6032 static void GLAPIENTRY
6033 save_EvalCoord2fv(const GLfloat * v)
6034 {
6035 save_EvalCoord2f(v[0], v[1]);
6036 }
6037
6038
6039 static void GLAPIENTRY
6040 save_EvalPoint1(GLint x)
6041 {
6042 GET_CURRENT_CONTEXT(ctx);
6043 Node *n;
6044 SAVE_FLUSH_VERTICES(ctx);
6045 n = alloc_instruction(ctx, OPCODE_EVAL_P1, 1);
6046 if (n) {
6047 n[1].i = x;
6048 }
6049 if (ctx->ExecuteFlag) {
6050 CALL_EvalPoint1(ctx->Exec, (x));
6051 }
6052 }
6053
6054 static void GLAPIENTRY
6055 save_EvalPoint2(GLint x, GLint y)
6056 {
6057 GET_CURRENT_CONTEXT(ctx);
6058 Node *n;
6059 SAVE_FLUSH_VERTICES(ctx);
6060 n = alloc_instruction(ctx, OPCODE_EVAL_P2, 2);
6061 if (n) {
6062 n[1].i = x;
6063 n[2].i = y;
6064 }
6065 if (ctx->ExecuteFlag) {
6066 CALL_EvalPoint2(ctx->Exec, (x, y));
6067 }
6068 }
6069
6070 static void GLAPIENTRY
6071 save_Indexf(GLfloat x)
6072 {
6073 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX, x);
6074 }
6075
6076 static void GLAPIENTRY
6077 save_Indexfv(const GLfloat * v)
6078 {
6079 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX, v[0]);
6080 }
6081
6082 static void GLAPIENTRY
6083 save_EdgeFlag(GLboolean x)
6084 {
6085 save_Attr1fNV(VERT_ATTRIB_EDGEFLAG, x ? 1.0f : 0.0f);
6086 }
6087
6088
6089 /**
6090 * Compare 'count' elements of vectors 'a' and 'b'.
6091 * \return GL_TRUE if equal, GL_FALSE if different.
6092 */
6093 static inline GLboolean
6094 compare_vec(const GLfloat *a, const GLfloat *b, GLuint count)
6095 {
6096 return memcmp( a, b, count * sizeof(GLfloat) ) == 0;
6097 }
6098
6099
6100 /**
6101 * This glMaterial function is used for glMaterial calls that are outside
6102 * a glBegin/End pair. For glMaterial inside glBegin/End, see the VBO code.
6103 */
6104 static void GLAPIENTRY
6105 save_Materialfv(GLenum face, GLenum pname, const GLfloat * param)
6106 {
6107 GET_CURRENT_CONTEXT(ctx);
6108 Node *n;
6109 int args, i;
6110 GLuint bitmask;
6111
6112 switch (face) {
6113 case GL_BACK:
6114 case GL_FRONT:
6115 case GL_FRONT_AND_BACK:
6116 break;
6117 default:
6118 _mesa_compile_error(ctx, GL_INVALID_ENUM, "glMaterial(face)");
6119 return;
6120 }
6121
6122 switch (pname) {
6123 case GL_EMISSION:
6124 case GL_AMBIENT:
6125 case GL_DIFFUSE:
6126 case GL_SPECULAR:
6127 case GL_AMBIENT_AND_DIFFUSE:
6128 args = 4;
6129 break;
6130 case GL_SHININESS:
6131 args = 1;
6132 break;
6133 case GL_COLOR_INDEXES:
6134 args = 3;
6135 break;
6136 default:
6137 _mesa_compile_error(ctx, GL_INVALID_ENUM, "glMaterial(pname)");
6138 return;
6139 }
6140
6141 if (ctx->ExecuteFlag) {
6142 CALL_Materialfv(ctx->Exec, (face, pname, param));
6143 }
6144
6145 bitmask = _mesa_material_bitmask(ctx, face, pname, ~0, NULL);
6146
6147 /* Try to eliminate redundant statechanges. Because it is legal to
6148 * call glMaterial even inside begin/end calls, don't need to worry
6149 * about ctx->Driver.CurrentSavePrimitive here.
6150 */
6151 for (i = 0; i < MAT_ATTRIB_MAX; i++) {
6152 if (bitmask & (1 << i)) {
6153 if (ctx->ListState.ActiveMaterialSize[i] == args &&
6154 compare_vec(ctx->ListState.CurrentMaterial[i], param, args)) {
6155 /* no change in material value */
6156 bitmask &= ~(1 << i);
6157 }
6158 else {
6159 ctx->ListState.ActiveMaterialSize[i] = args;
6160 COPY_SZ_4V(ctx->ListState.CurrentMaterial[i], args, param);
6161 }
6162 }
6163 }
6164
6165 /* If this call has no effect, return early */
6166 if (bitmask == 0)
6167 return;
6168
6169 SAVE_FLUSH_VERTICES(ctx);
6170
6171 n = alloc_instruction(ctx, OPCODE_MATERIAL, 6);
6172 if (n) {
6173 n[1].e = face;
6174 n[2].e = pname;
6175 for (i = 0; i < args; i++)
6176 n[3 + i].f = param[i];
6177 }
6178 }
6179
6180 static void GLAPIENTRY
6181 save_Begin(GLenum mode)
6182 {
6183 GET_CURRENT_CONTEXT(ctx);
6184
6185 if (!_mesa_is_valid_prim_mode(ctx, mode)) {
6186 /* compile this error into the display list */
6187 _mesa_compile_error(ctx, GL_INVALID_ENUM, "glBegin(mode)");
6188 }
6189 else if (_mesa_inside_dlist_begin_end(ctx)) {
6190 /* compile this error into the display list */
6191 _mesa_compile_error(ctx, GL_INVALID_OPERATION, "recursive glBegin");
6192 }
6193 else {
6194 ctx->Driver.CurrentSavePrimitive = mode;
6195
6196 vbo_save_NotifyBegin(ctx, mode, false);
6197 }
6198 }
6199
6200 static void GLAPIENTRY
6201 save_End(void)
6202 {
6203 GET_CURRENT_CONTEXT(ctx);
6204 SAVE_FLUSH_VERTICES(ctx);
6205 (void) alloc_instruction(ctx, OPCODE_END, 0);
6206 ctx->Driver.CurrentSavePrimitive = PRIM_OUTSIDE_BEGIN_END;
6207 if (ctx->ExecuteFlag) {
6208 CALL_End(ctx->Exec, ());
6209 }
6210 }
6211
6212 static void GLAPIENTRY
6213 save_Rectf(GLfloat a, GLfloat b, GLfloat c, GLfloat d)
6214 {
6215 GET_CURRENT_CONTEXT(ctx);
6216 Node *n;
6217 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6218 n = alloc_instruction(ctx, OPCODE_RECTF, 4);
6219 if (n) {
6220 n[1].f = a;
6221 n[2].f = b;
6222 n[3].f = c;
6223 n[4].f = d;
6224 }
6225 if (ctx->ExecuteFlag) {
6226 CALL_Rectf(ctx->Exec, (a, b, c, d));
6227 }
6228 }
6229
6230
6231 static void GLAPIENTRY
6232 save_Vertex2f(GLfloat x, GLfloat y)
6233 {
6234 save_Attr2fNV(VERT_ATTRIB_POS, x, y);
6235 }
6236
6237 static void GLAPIENTRY
6238 save_Vertex2fv(const GLfloat * v)
6239 {
6240 save_Attr2fNV(VERT_ATTRIB_POS, v[0], v[1]);
6241 }
6242
6243 static void GLAPIENTRY
6244 save_Vertex3f(GLfloat x, GLfloat y, GLfloat z)
6245 {
6246 save_Attr3fNV(VERT_ATTRIB_POS, x, y, z);
6247 }
6248
6249 static void GLAPIENTRY
6250 save_Vertex3fv(const GLfloat * v)
6251 {
6252 save_Attr3fNV(VERT_ATTRIB_POS, v[0], v[1], v[2]);
6253 }
6254
6255 static void GLAPIENTRY
6256 save_Vertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
6257 {
6258 save_Attr4fNV(VERT_ATTRIB_POS, x, y, z, w);
6259 }
6260
6261 static void GLAPIENTRY
6262 save_Vertex4fv(const GLfloat * v)
6263 {
6264 save_Attr4fNV(VERT_ATTRIB_POS, v[0], v[1], v[2], v[3]);
6265 }
6266
6267 static void GLAPIENTRY
6268 save_TexCoord1f(GLfloat x)
6269 {
6270 save_Attr1fNV(VERT_ATTRIB_TEX0, x);
6271 }
6272
6273 static void GLAPIENTRY
6274 save_TexCoord1fv(const GLfloat * v)
6275 {
6276 save_Attr1fNV(VERT_ATTRIB_TEX0, v[0]);
6277 }
6278
6279 static void GLAPIENTRY
6280 save_TexCoord2f(GLfloat x, GLfloat y)
6281 {
6282 save_Attr2fNV(VERT_ATTRIB_TEX0, x, y);
6283 }
6284
6285 static void GLAPIENTRY
6286 save_TexCoord2fv(const GLfloat * v)
6287 {
6288 save_Attr2fNV(VERT_ATTRIB_TEX0, v[0], v[1]);
6289 }
6290
6291 static void GLAPIENTRY
6292 save_TexCoord3f(GLfloat x, GLfloat y, GLfloat z)
6293 {
6294 save_Attr3fNV(VERT_ATTRIB_TEX0, x, y, z);
6295 }
6296
6297 static void GLAPIENTRY
6298 save_TexCoord3fv(const GLfloat * v)
6299 {
6300 save_Attr3fNV(VERT_ATTRIB_TEX0, v[0], v[1], v[2]);
6301 }
6302
6303 static void GLAPIENTRY
6304 save_TexCoord4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
6305 {
6306 save_Attr4fNV(VERT_ATTRIB_TEX0, x, y, z, w);
6307 }
6308
6309 static void GLAPIENTRY
6310 save_TexCoord4fv(const GLfloat * v)
6311 {
6312 save_Attr4fNV(VERT_ATTRIB_TEX0, v[0], v[1], v[2], v[3]);
6313 }
6314
6315 static void GLAPIENTRY
6316 save_Normal3f(GLfloat x, GLfloat y, GLfloat z)
6317 {
6318 save_Attr3fNV(VERT_ATTRIB_NORMAL, x, y, z);
6319 }
6320
6321 static void GLAPIENTRY
6322 save_Normal3fv(const GLfloat * v)
6323 {
6324 save_Attr3fNV(VERT_ATTRIB_NORMAL, v[0], v[1], v[2]);
6325 }
6326
6327 static void GLAPIENTRY
6328 save_FogCoordfEXT(GLfloat x)
6329 {
6330 save_Attr1fNV(VERT_ATTRIB_FOG, x);
6331 }
6332
6333 static void GLAPIENTRY
6334 save_FogCoordfvEXT(const GLfloat * v)
6335 {
6336 save_Attr1fNV(VERT_ATTRIB_FOG, v[0]);
6337 }
6338
6339 static void GLAPIENTRY
6340 save_Color3f(GLfloat x, GLfloat y, GLfloat z)
6341 {
6342 save_Attr3fNV(VERT_ATTRIB_COLOR0, x, y, z);
6343 }
6344
6345 static void GLAPIENTRY
6346 save_Color3fv(const GLfloat * v)
6347 {
6348 save_Attr3fNV(VERT_ATTRIB_COLOR0, v[0], v[1], v[2]);
6349 }
6350
6351 static void GLAPIENTRY
6352 save_Color4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
6353 {
6354 save_Attr4fNV(VERT_ATTRIB_COLOR0, x, y, z, w);
6355 }
6356
6357 static void GLAPIENTRY
6358 save_Color4fv(const GLfloat * v)
6359 {
6360 save_Attr4fNV(VERT_ATTRIB_COLOR0, v[0], v[1], v[2], v[3]);
6361 }
6362
6363 static void GLAPIENTRY
6364 save_SecondaryColor3fEXT(GLfloat x, GLfloat y, GLfloat z)
6365 {
6366 save_Attr3fNV(VERT_ATTRIB_COLOR1, x, y, z);
6367 }
6368
6369 static void GLAPIENTRY
6370 save_SecondaryColor3fvEXT(const GLfloat * v)
6371 {
6372 save_Attr3fNV(VERT_ATTRIB_COLOR1, v[0], v[1], v[2]);
6373 }
6374
6375
6376 /* Just call the respective ATTR for texcoord
6377 */
6378 static void GLAPIENTRY
6379 save_MultiTexCoord1f(GLenum target, GLfloat x)
6380 {
6381 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6382 save_Attr1fNV(attr, x);
6383 }
6384
6385 static void GLAPIENTRY
6386 save_MultiTexCoord1fv(GLenum target, const GLfloat * v)
6387 {
6388 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6389 save_Attr1fNV(attr, v[0]);
6390 }
6391
6392 static void GLAPIENTRY
6393 save_MultiTexCoord2f(GLenum target, GLfloat x, GLfloat y)
6394 {
6395 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6396 save_Attr2fNV(attr, x, y);
6397 }
6398
6399 static void GLAPIENTRY
6400 save_MultiTexCoord2fv(GLenum target, const GLfloat * v)
6401 {
6402 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6403 save_Attr2fNV(attr, v[0], v[1]);
6404 }
6405
6406 static void GLAPIENTRY
6407 save_MultiTexCoord3f(GLenum target, GLfloat x, GLfloat y, GLfloat z)
6408 {
6409 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6410 save_Attr3fNV(attr, x, y, z);
6411 }
6412
6413 static void GLAPIENTRY
6414 save_MultiTexCoord3fv(GLenum target, const GLfloat * v)
6415 {
6416 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6417 save_Attr3fNV(attr, v[0], v[1], v[2]);
6418 }
6419
6420 static void GLAPIENTRY
6421 save_MultiTexCoord4f(GLenum target, GLfloat x, GLfloat y,
6422 GLfloat z, GLfloat w)
6423 {
6424 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6425 save_Attr4fNV(attr, x, y, z, w);
6426 }
6427
6428 static void GLAPIENTRY
6429 save_MultiTexCoord4fv(GLenum target, const GLfloat * v)
6430 {
6431 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6432 save_Attr4fNV(attr, v[0], v[1], v[2], v[3]);
6433 }
6434
6435
6436 /**
6437 * Record a GL_INVALID_VALUE error when an invalid vertex attribute
6438 * index is found.
6439 */
6440 static void
6441 index_error(void)
6442 {
6443 GET_CURRENT_CONTEXT(ctx);
6444 _mesa_error(ctx, GL_INVALID_VALUE, "VertexAttribf(index)");
6445 }
6446
6447
6448
6449 static void GLAPIENTRY
6450 save_VertexAttrib1fARB(GLuint index, GLfloat x)
6451 {
6452 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6453 save_Attr1fARB(index, x);
6454 else
6455 index_error();
6456 }
6457
6458 static void GLAPIENTRY
6459 save_VertexAttrib1fvARB(GLuint index, const GLfloat * v)
6460 {
6461 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6462 save_Attr1fARB(index, v[0]);
6463 else
6464 index_error();
6465 }
6466
6467 static void GLAPIENTRY
6468 save_VertexAttrib2fARB(GLuint index, GLfloat x, GLfloat y)
6469 {
6470 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6471 save_Attr2fARB(index, x, y);
6472 else
6473 index_error();
6474 }
6475
6476 static void GLAPIENTRY
6477 save_VertexAttrib2fvARB(GLuint index, const GLfloat * v)
6478 {
6479 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6480 save_Attr2fARB(index, v[0], v[1]);
6481 else
6482 index_error();
6483 }
6484
6485 static void GLAPIENTRY
6486 save_VertexAttrib3fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z)
6487 {
6488 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6489 save_Attr3fARB(index, x, y, z);
6490 else
6491 index_error();
6492 }
6493
6494 static void GLAPIENTRY
6495 save_VertexAttrib3fvARB(GLuint index, const GLfloat * v)
6496 {
6497 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6498 save_Attr3fARB(index, v[0], v[1], v[2]);
6499 else
6500 index_error();
6501 }
6502
6503 static void GLAPIENTRY
6504 save_VertexAttrib4fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z,
6505 GLfloat w)
6506 {
6507 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6508 save_Attr4fARB(index, x, y, z, w);
6509 else
6510 index_error();
6511 }
6512
6513 static void GLAPIENTRY
6514 save_VertexAttrib4fvARB(GLuint index, const GLfloat * v)
6515 {
6516 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6517 save_Attr4fARB(index, v[0], v[1], v[2], v[3]);
6518 else
6519 index_error();
6520 }
6521
6522 static void GLAPIENTRY
6523 save_VertexAttribL1d(GLuint index, GLdouble x)
6524 {
6525 GET_CURRENT_CONTEXT(ctx);
6526
6527 if (index < MAX_VERTEX_GENERIC_ATTRIBS) {
6528 Node *n;
6529 SAVE_FLUSH_VERTICES(ctx);
6530 n = alloc_instruction(ctx, OPCODE_ATTR_1D, 3);
6531 if (n) {
6532 n[1].ui = index;
6533 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
6534 }
6535
6536 ctx->ListState.ActiveAttribSize[index] = 1;
6537 memcpy(ctx->ListState.CurrentAttrib[index], &n[2], sizeof(GLdouble));
6538
6539 if (ctx->ExecuteFlag) {
6540 CALL_VertexAttribL1d(ctx->Exec, (index, x));
6541 }
6542 } else {
6543 index_error();
6544 }
6545 }
6546
6547 static void GLAPIENTRY
6548 save_VertexAttribL1dv(GLuint index, const GLdouble *v)
6549 {
6550 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6551 save_VertexAttribL1d(index, v[0]);
6552 else
6553 index_error();
6554 }
6555
6556 static void GLAPIENTRY
6557 save_VertexAttribL2d(GLuint index, GLdouble x, GLdouble y)
6558 {
6559 GET_CURRENT_CONTEXT(ctx);
6560
6561 if (index < MAX_VERTEX_GENERIC_ATTRIBS) {
6562 Node *n;
6563 SAVE_FLUSH_VERTICES(ctx);
6564 n = alloc_instruction(ctx, OPCODE_ATTR_2D, 5);
6565 if (n) {
6566 n[1].ui = index;
6567 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
6568 ASSIGN_DOUBLE_TO_NODES(n, 4, y);
6569 }
6570
6571 ctx->ListState.ActiveAttribSize[index] = 2;
6572 memcpy(ctx->ListState.CurrentAttrib[index], &n[2],
6573 2 * sizeof(GLdouble));
6574
6575 if (ctx->ExecuteFlag) {
6576 CALL_VertexAttribL2d(ctx->Exec, (index, x, y));
6577 }
6578 } else {
6579 index_error();
6580 }
6581 }
6582
6583 static void GLAPIENTRY
6584 save_VertexAttribL2dv(GLuint index, const GLdouble *v)
6585 {
6586 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6587 save_VertexAttribL2d(index, v[0], v[1]);
6588 else
6589 index_error();
6590 }
6591
6592 static void GLAPIENTRY
6593 save_VertexAttribL3d(GLuint index, GLdouble x, GLdouble y, GLdouble z)
6594 {
6595 GET_CURRENT_CONTEXT(ctx);
6596
6597 if (index < MAX_VERTEX_GENERIC_ATTRIBS) {
6598 Node *n;
6599 SAVE_FLUSH_VERTICES(ctx);
6600 n = alloc_instruction(ctx, OPCODE_ATTR_3D, 7);
6601 if (n) {
6602 n[1].ui = index;
6603 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
6604 ASSIGN_DOUBLE_TO_NODES(n, 4, y);
6605 ASSIGN_DOUBLE_TO_NODES(n, 6, z);
6606 }
6607
6608 ctx->ListState.ActiveAttribSize[index] = 3;
6609 memcpy(ctx->ListState.CurrentAttrib[index], &n[2],
6610 3 * sizeof(GLdouble));
6611
6612 if (ctx->ExecuteFlag) {
6613 CALL_VertexAttribL3d(ctx->Exec, (index, x, y, z));
6614 }
6615 } else {
6616 index_error();
6617 }
6618 }
6619
6620 static void GLAPIENTRY
6621 save_VertexAttribL3dv(GLuint index, const GLdouble *v)
6622 {
6623 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6624 save_VertexAttribL3d(index, v[0], v[1], v[2]);
6625 else
6626 index_error();
6627 }
6628
6629 static void GLAPIENTRY
6630 save_VertexAttribL4d(GLuint index, GLdouble x, GLdouble y, GLdouble z,
6631 GLdouble w)
6632 {
6633 GET_CURRENT_CONTEXT(ctx);
6634
6635 if (index < MAX_VERTEX_GENERIC_ATTRIBS) {
6636 Node *n;
6637 SAVE_FLUSH_VERTICES(ctx);
6638 n = alloc_instruction(ctx, OPCODE_ATTR_4D, 9);
6639 if (n) {
6640 n[1].ui = index;
6641 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
6642 ASSIGN_DOUBLE_TO_NODES(n, 4, y);
6643 ASSIGN_DOUBLE_TO_NODES(n, 6, z);
6644 ASSIGN_DOUBLE_TO_NODES(n, 8, w);
6645 }
6646
6647 ctx->ListState.ActiveAttribSize[index] = 4;
6648 memcpy(ctx->ListState.CurrentAttrib[index], &n[2],
6649 4 * sizeof(GLdouble));
6650
6651 if (ctx->ExecuteFlag) {
6652 CALL_VertexAttribL4d(ctx->Exec, (index, x, y, z, w));
6653 }
6654 } else {
6655 index_error();
6656 }
6657 }
6658
6659 static void GLAPIENTRY
6660 save_VertexAttribL4dv(GLuint index, const GLdouble *v)
6661 {
6662 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6663 save_VertexAttribL4d(index, v[0], v[1], v[2], v[3]);
6664 else
6665 index_error();
6666 }
6667
6668 static void GLAPIENTRY
6669 save_PrimitiveRestartNV(void)
6670 {
6671 /* Note: this is used when outside a glBegin/End pair in a display list */
6672 GET_CURRENT_CONTEXT(ctx);
6673 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6674 (void) alloc_instruction(ctx, OPCODE_PRIMITIVE_RESTART_NV, 0);
6675 if (ctx->ExecuteFlag) {
6676 CALL_PrimitiveRestartNV(ctx->Exec, ());
6677 }
6678 }
6679
6680
6681 static void GLAPIENTRY
6682 save_BlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
6683 GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
6684 GLbitfield mask, GLenum filter)
6685 {
6686 GET_CURRENT_CONTEXT(ctx);
6687 Node *n;
6688 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6689 n = alloc_instruction(ctx, OPCODE_BLIT_FRAMEBUFFER, 10);
6690 if (n) {
6691 n[1].i = srcX0;
6692 n[2].i = srcY0;
6693 n[3].i = srcX1;
6694 n[4].i = srcY1;
6695 n[5].i = dstX0;
6696 n[6].i = dstY0;
6697 n[7].i = dstX1;
6698 n[8].i = dstY1;
6699 n[9].i = mask;
6700 n[10].e = filter;
6701 }
6702 if (ctx->ExecuteFlag) {
6703 CALL_BlitFramebuffer(ctx->Exec, (srcX0, srcY0, srcX1, srcY1,
6704 dstX0, dstY0, dstX1, dstY1,
6705 mask, filter));
6706 }
6707 }
6708
6709
6710 /** GL_EXT_provoking_vertex */
6711 static void GLAPIENTRY
6712 save_ProvokingVertexEXT(GLenum mode)
6713 {
6714 GET_CURRENT_CONTEXT(ctx);
6715 Node *n;
6716 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6717 n = alloc_instruction(ctx, OPCODE_PROVOKING_VERTEX, 1);
6718 if (n) {
6719 n[1].e = mode;
6720 }
6721 if (ctx->ExecuteFlag) {
6722 /*CALL_ProvokingVertex(ctx->Exec, (mode));*/
6723 _mesa_ProvokingVertex(mode);
6724 }
6725 }
6726
6727
6728 /** GL_EXT_transform_feedback */
6729 static void GLAPIENTRY
6730 save_BeginTransformFeedback(GLenum mode)
6731 {
6732 GET_CURRENT_CONTEXT(ctx);
6733 Node *n;
6734 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6735 n = alloc_instruction(ctx, OPCODE_BEGIN_TRANSFORM_FEEDBACK, 1);
6736 if (n) {
6737 n[1].e = mode;
6738 }
6739 if (ctx->ExecuteFlag) {
6740 CALL_BeginTransformFeedback(ctx->Exec, (mode));
6741 }
6742 }
6743
6744
6745 /** GL_EXT_transform_feedback */
6746 static void GLAPIENTRY
6747 save_EndTransformFeedback(void)
6748 {
6749 GET_CURRENT_CONTEXT(ctx);
6750 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6751 (void) alloc_instruction(ctx, OPCODE_END_TRANSFORM_FEEDBACK, 0);
6752 if (ctx->ExecuteFlag) {
6753 CALL_EndTransformFeedback(ctx->Exec, ());
6754 }
6755 }
6756
6757 static void GLAPIENTRY
6758 save_BindTransformFeedback(GLenum target, GLuint name)
6759 {
6760 GET_CURRENT_CONTEXT(ctx);
6761 Node *n;
6762 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6763 n = alloc_instruction(ctx, OPCODE_BIND_TRANSFORM_FEEDBACK, 2);
6764 if (n) {
6765 n[1].e = target;
6766 n[2].ui = name;
6767 }
6768 if (ctx->ExecuteFlag) {
6769 CALL_BindTransformFeedback(ctx->Exec, (target, name));
6770 }
6771 }
6772
6773 static void GLAPIENTRY
6774 save_PauseTransformFeedback(void)
6775 {
6776 GET_CURRENT_CONTEXT(ctx);
6777 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6778 (void) alloc_instruction(ctx, OPCODE_PAUSE_TRANSFORM_FEEDBACK, 0);
6779 if (ctx->ExecuteFlag) {
6780 CALL_PauseTransformFeedback(ctx->Exec, ());
6781 }
6782 }
6783
6784 static void GLAPIENTRY
6785 save_ResumeTransformFeedback(void)
6786 {
6787 GET_CURRENT_CONTEXT(ctx);
6788 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6789 (void) alloc_instruction(ctx, OPCODE_RESUME_TRANSFORM_FEEDBACK, 0);
6790 if (ctx->ExecuteFlag) {
6791 CALL_ResumeTransformFeedback(ctx->Exec, ());
6792 }
6793 }
6794
6795 static void GLAPIENTRY
6796 save_DrawTransformFeedback(GLenum mode, GLuint name)
6797 {
6798 GET_CURRENT_CONTEXT(ctx);
6799 Node *n;
6800 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6801 n = alloc_instruction(ctx, OPCODE_DRAW_TRANSFORM_FEEDBACK, 2);
6802 if (n) {
6803 n[1].e = mode;
6804 n[2].ui = name;
6805 }
6806 if (ctx->ExecuteFlag) {
6807 CALL_DrawTransformFeedback(ctx->Exec, (mode, name));
6808 }
6809 }
6810
6811 static void GLAPIENTRY
6812 save_DrawTransformFeedbackStream(GLenum mode, GLuint name, GLuint stream)
6813 {
6814 GET_CURRENT_CONTEXT(ctx);
6815 Node *n;
6816 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6817 n = alloc_instruction(ctx, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM, 3);
6818 if (n) {
6819 n[1].e = mode;
6820 n[2].ui = name;
6821 n[3].ui = stream;
6822 }
6823 if (ctx->ExecuteFlag) {
6824 CALL_DrawTransformFeedbackStream(ctx->Exec, (mode, name, stream));
6825 }
6826 }
6827
6828 static void GLAPIENTRY
6829 save_DrawTransformFeedbackInstanced(GLenum mode, GLuint name,
6830 GLsizei primcount)
6831 {
6832 GET_CURRENT_CONTEXT(ctx);
6833 Node *n;
6834 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6835 n = alloc_instruction(ctx, OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED, 3);
6836 if (n) {
6837 n[1].e = mode;
6838 n[2].ui = name;
6839 n[3].si = primcount;
6840 }
6841 if (ctx->ExecuteFlag) {
6842 CALL_DrawTransformFeedbackInstanced(ctx->Exec, (mode, name, primcount));
6843 }
6844 }
6845
6846 static void GLAPIENTRY
6847 save_DrawTransformFeedbackStreamInstanced(GLenum mode, GLuint name,
6848 GLuint stream, GLsizei primcount)
6849 {
6850 GET_CURRENT_CONTEXT(ctx);
6851 Node *n;
6852 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6853 n = alloc_instruction(ctx, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED, 4);
6854 if (n) {
6855 n[1].e = mode;
6856 n[2].ui = name;
6857 n[3].ui = stream;
6858 n[4].si = primcount;
6859 }
6860 if (ctx->ExecuteFlag) {
6861 CALL_DrawTransformFeedbackStreamInstanced(ctx->Exec, (mode, name, stream,
6862 primcount));
6863 }
6864 }
6865
6866 static void GLAPIENTRY
6867 save_DispatchCompute(GLuint num_groups_x, GLuint num_groups_y,
6868 GLuint num_groups_z)
6869 {
6870 GET_CURRENT_CONTEXT(ctx);
6871 Node *n;
6872 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6873 n = alloc_instruction(ctx, OPCODE_DISPATCH_COMPUTE, 3);
6874 if (n) {
6875 n[1].ui = num_groups_x;
6876 n[2].ui = num_groups_y;
6877 n[3].ui = num_groups_z;
6878 }
6879 if (ctx->ExecuteFlag) {
6880 CALL_DispatchCompute(ctx->Exec, (num_groups_x, num_groups_y,
6881 num_groups_z));
6882 }
6883 }
6884
6885 static void GLAPIENTRY
6886 save_DispatchComputeIndirect(GLintptr indirect)
6887 {
6888 GET_CURRENT_CONTEXT(ctx);
6889 _mesa_error(ctx, GL_INVALID_OPERATION,
6890 "glDispatchComputeIndirect() during display list compile");
6891 }
6892
6893 static void GLAPIENTRY
6894 save_UseProgram(GLuint program)
6895 {
6896 GET_CURRENT_CONTEXT(ctx);
6897 Node *n;
6898 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6899 n = alloc_instruction(ctx, OPCODE_USE_PROGRAM, 1);
6900 if (n) {
6901 n[1].ui = program;
6902 }
6903 if (ctx->ExecuteFlag) {
6904 CALL_UseProgram(ctx->Exec, (program));
6905 }
6906 }
6907
6908
6909 static void GLAPIENTRY
6910 save_Uniform1fARB(GLint location, GLfloat x)
6911 {
6912 GET_CURRENT_CONTEXT(ctx);
6913 Node *n;
6914 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6915 n = alloc_instruction(ctx, OPCODE_UNIFORM_1F, 2);
6916 if (n) {
6917 n[1].i = location;
6918 n[2].f = x;
6919 }
6920 if (ctx->ExecuteFlag) {
6921 CALL_Uniform1f(ctx->Exec, (location, x));
6922 }
6923 }
6924
6925
6926 static void GLAPIENTRY
6927 save_Uniform2fARB(GLint location, GLfloat x, GLfloat y)
6928 {
6929 GET_CURRENT_CONTEXT(ctx);
6930 Node *n;
6931 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6932 n = alloc_instruction(ctx, OPCODE_UNIFORM_2F, 3);
6933 if (n) {
6934 n[1].i = location;
6935 n[2].f = x;
6936 n[3].f = y;
6937 }
6938 if (ctx->ExecuteFlag) {
6939 CALL_Uniform2f(ctx->Exec, (location, x, y));
6940 }
6941 }
6942
6943
6944 static void GLAPIENTRY
6945 save_Uniform3fARB(GLint location, GLfloat x, GLfloat y, GLfloat z)
6946 {
6947 GET_CURRENT_CONTEXT(ctx);
6948 Node *n;
6949 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6950 n = alloc_instruction(ctx, OPCODE_UNIFORM_3F, 4);
6951 if (n) {
6952 n[1].i = location;
6953 n[2].f = x;
6954 n[3].f = y;
6955 n[4].f = z;
6956 }
6957 if (ctx->ExecuteFlag) {
6958 CALL_Uniform3f(ctx->Exec, (location, x, y, z));
6959 }
6960 }
6961
6962
6963 static void GLAPIENTRY
6964 save_Uniform4fARB(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
6965 {
6966 GET_CURRENT_CONTEXT(ctx);
6967 Node *n;
6968 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6969 n = alloc_instruction(ctx, OPCODE_UNIFORM_4F, 5);
6970 if (n) {
6971 n[1].i = location;
6972 n[2].f = x;
6973 n[3].f = y;
6974 n[4].f = z;
6975 n[5].f = w;
6976 }
6977 if (ctx->ExecuteFlag) {
6978 CALL_Uniform4f(ctx->Exec, (location, x, y, z, w));
6979 }
6980 }
6981
6982
6983 static void GLAPIENTRY
6984 save_Uniform1fvARB(GLint location, GLsizei count, const GLfloat *v)
6985 {
6986 GET_CURRENT_CONTEXT(ctx);
6987 Node *n;
6988 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6989 n = alloc_instruction(ctx, OPCODE_UNIFORM_1FV, 2 + POINTER_DWORDS);
6990 if (n) {
6991 n[1].i = location;
6992 n[2].i = count;
6993 save_pointer(&n[3], memdup(v, count * 1 * sizeof(GLfloat)));
6994 }
6995 if (ctx->ExecuteFlag) {
6996 CALL_Uniform1fv(ctx->Exec, (location, count, v));
6997 }
6998 }
6999
7000 static void GLAPIENTRY
7001 save_Uniform2fvARB(GLint location, GLsizei count, const GLfloat *v)
7002 {
7003 GET_CURRENT_CONTEXT(ctx);
7004 Node *n;
7005 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7006 n = alloc_instruction(ctx, OPCODE_UNIFORM_2FV, 2 + POINTER_DWORDS);
7007 if (n) {
7008 n[1].i = location;
7009 n[2].i = count;
7010 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLfloat)));
7011 }
7012 if (ctx->ExecuteFlag) {
7013 CALL_Uniform2fv(ctx->Exec, (location, count, v));
7014 }
7015 }
7016
7017 static void GLAPIENTRY
7018 save_Uniform3fvARB(GLint location, GLsizei count, const GLfloat *v)
7019 {
7020 GET_CURRENT_CONTEXT(ctx);
7021 Node *n;
7022 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7023 n = alloc_instruction(ctx, OPCODE_UNIFORM_3FV, 2 + POINTER_DWORDS);
7024 if (n) {
7025 n[1].i = location;
7026 n[2].i = count;
7027 save_pointer(&n[3], memdup(v, count * 3 * sizeof(GLfloat)));
7028 }
7029 if (ctx->ExecuteFlag) {
7030 CALL_Uniform3fv(ctx->Exec, (location, count, v));
7031 }
7032 }
7033
7034 static void GLAPIENTRY
7035 save_Uniform4fvARB(GLint location, GLsizei count, const GLfloat *v)
7036 {
7037 GET_CURRENT_CONTEXT(ctx);
7038 Node *n;
7039 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7040 n = alloc_instruction(ctx, OPCODE_UNIFORM_4FV, 2 + POINTER_DWORDS);
7041 if (n) {
7042 n[1].i = location;
7043 n[2].i = count;
7044 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLfloat)));
7045 }
7046 if (ctx->ExecuteFlag) {
7047 CALL_Uniform4fv(ctx->Exec, (location, count, v));
7048 }
7049 }
7050
7051
7052 static void GLAPIENTRY
7053 save_Uniform1d(GLint location, GLdouble x)
7054 {
7055 GET_CURRENT_CONTEXT(ctx);
7056 Node *n;
7057 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7058 n = alloc_instruction(ctx, OPCODE_UNIFORM_1D, 3);
7059 if (n) {
7060 n[1].i = location;
7061 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
7062 }
7063 if (ctx->ExecuteFlag) {
7064 CALL_Uniform1d(ctx->Exec, (location, x));
7065 }
7066 }
7067
7068
7069 static void GLAPIENTRY
7070 save_Uniform2d(GLint location, GLdouble x, GLdouble y)
7071 {
7072 GET_CURRENT_CONTEXT(ctx);
7073 Node *n;
7074 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7075 n = alloc_instruction(ctx, OPCODE_UNIFORM_2D, 5);
7076 if (n) {
7077 n[1].i = location;
7078 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
7079 ASSIGN_DOUBLE_TO_NODES(n, 4, y);
7080 }
7081 if (ctx->ExecuteFlag) {
7082 CALL_Uniform2d(ctx->Exec, (location, x, y));
7083 }
7084 }
7085
7086
7087 static void GLAPIENTRY
7088 save_Uniform3d(GLint location, GLdouble x, GLdouble y, GLdouble z)
7089 {
7090 GET_CURRENT_CONTEXT(ctx);
7091 Node *n;
7092 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7093 n = alloc_instruction(ctx, OPCODE_UNIFORM_3D, 7);
7094 if (n) {
7095 n[1].i = location;
7096 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
7097 ASSIGN_DOUBLE_TO_NODES(n, 4, y);
7098 ASSIGN_DOUBLE_TO_NODES(n, 6, z);
7099 }
7100 if (ctx->ExecuteFlag) {
7101 CALL_Uniform3d(ctx->Exec, (location, x, y, z));
7102 }
7103 }
7104
7105
7106 static void GLAPIENTRY
7107 save_Uniform4d(GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
7108 {
7109 GET_CURRENT_CONTEXT(ctx);
7110 Node *n;
7111 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7112 n = alloc_instruction(ctx, OPCODE_UNIFORM_4D, 9);
7113 if (n) {
7114 n[1].i = location;
7115 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
7116 ASSIGN_DOUBLE_TO_NODES(n, 4, y);
7117 ASSIGN_DOUBLE_TO_NODES(n, 6, z);
7118 ASSIGN_DOUBLE_TO_NODES(n, 8, w);
7119 }
7120 if (ctx->ExecuteFlag) {
7121 CALL_Uniform4d(ctx->Exec, (location, x, y, z, w));
7122 }
7123 }
7124
7125
7126 static void GLAPIENTRY
7127 save_Uniform1dv(GLint location, GLsizei count, const GLdouble *v)
7128 {
7129 GET_CURRENT_CONTEXT(ctx);
7130 Node *n;
7131 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7132 n = alloc_instruction(ctx, OPCODE_UNIFORM_1DV, 2 + POINTER_DWORDS);
7133 if (n) {
7134 n[1].i = location;
7135 n[2].i = count;
7136 save_pointer(&n[3], memdup(v, count * 1 * sizeof(GLdouble)));
7137 }
7138 if (ctx->ExecuteFlag) {
7139 CALL_Uniform1dv(ctx->Exec, (location, count, v));
7140 }
7141 }
7142
7143
7144 static void GLAPIENTRY
7145 save_Uniform2dv(GLint location, GLsizei count, const GLdouble *v)
7146 {
7147 GET_CURRENT_CONTEXT(ctx);
7148 Node *n;
7149 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7150 n = alloc_instruction(ctx, OPCODE_UNIFORM_2DV, 2 + POINTER_DWORDS);
7151 if (n) {
7152 n[1].i = location;
7153 n[2].i = count;
7154 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLdouble)));
7155 }
7156 if (ctx->ExecuteFlag) {
7157 CALL_Uniform2dv(ctx->Exec, (location, count, v));
7158 }
7159 }
7160
7161
7162 static void GLAPIENTRY
7163 save_Uniform3dv(GLint location, GLsizei count, const GLdouble *v)
7164 {
7165 GET_CURRENT_CONTEXT(ctx);
7166 Node *n;
7167 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7168 n = alloc_instruction(ctx, OPCODE_UNIFORM_3DV, 2 + POINTER_DWORDS);
7169 if (n) {
7170 n[1].i = location;
7171 n[2].i = count;
7172 save_pointer(&n[3], memdup(v, count * 3 * sizeof(GLdouble)));
7173 }
7174 if (ctx->ExecuteFlag) {
7175 CALL_Uniform3dv(ctx->Exec, (location, count, v));
7176 }
7177 }
7178
7179
7180 static void GLAPIENTRY
7181 save_Uniform4dv(GLint location, GLsizei count, const GLdouble *v)
7182 {
7183 GET_CURRENT_CONTEXT(ctx);
7184 Node *n;
7185 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7186 n = alloc_instruction(ctx, OPCODE_UNIFORM_4DV, 2 + POINTER_DWORDS);
7187 if (n) {
7188 n[1].i = location;
7189 n[2].i = count;
7190 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLdouble)));
7191 }
7192 if (ctx->ExecuteFlag) {
7193 CALL_Uniform4dv(ctx->Exec, (location, count, v));
7194 }
7195 }
7196
7197
7198 static void GLAPIENTRY
7199 save_Uniform1iARB(GLint location, GLint x)
7200 {
7201 GET_CURRENT_CONTEXT(ctx);
7202 Node *n;
7203 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7204 n = alloc_instruction(ctx, OPCODE_UNIFORM_1I, 2);
7205 if (n) {
7206 n[1].i = location;
7207 n[2].i = x;
7208 }
7209 if (ctx->ExecuteFlag) {
7210 CALL_Uniform1i(ctx->Exec, (location, x));
7211 }
7212 }
7213
7214 static void GLAPIENTRY
7215 save_Uniform2iARB(GLint location, GLint x, GLint y)
7216 {
7217 GET_CURRENT_CONTEXT(ctx);
7218 Node *n;
7219 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7220 n = alloc_instruction(ctx, OPCODE_UNIFORM_2I, 3);
7221 if (n) {
7222 n[1].i = location;
7223 n[2].i = x;
7224 n[3].i = y;
7225 }
7226 if (ctx->ExecuteFlag) {
7227 CALL_Uniform2i(ctx->Exec, (location, x, y));
7228 }
7229 }
7230
7231 static void GLAPIENTRY
7232 save_Uniform3iARB(GLint location, GLint x, GLint y, GLint z)
7233 {
7234 GET_CURRENT_CONTEXT(ctx);
7235 Node *n;
7236 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7237 n = alloc_instruction(ctx, OPCODE_UNIFORM_3I, 4);
7238 if (n) {
7239 n[1].i = location;
7240 n[2].i = x;
7241 n[3].i = y;
7242 n[4].i = z;
7243 }
7244 if (ctx->ExecuteFlag) {
7245 CALL_Uniform3i(ctx->Exec, (location, x, y, z));
7246 }
7247 }
7248
7249 static void GLAPIENTRY
7250 save_Uniform4iARB(GLint location, GLint x, GLint y, GLint z, GLint w)
7251 {
7252 GET_CURRENT_CONTEXT(ctx);
7253 Node *n;
7254 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7255 n = alloc_instruction(ctx, OPCODE_UNIFORM_4I, 5);
7256 if (n) {
7257 n[1].i = location;
7258 n[2].i = x;
7259 n[3].i = y;
7260 n[4].i = z;
7261 n[5].i = w;
7262 }
7263 if (ctx->ExecuteFlag) {
7264 CALL_Uniform4i(ctx->Exec, (location, x, y, z, w));
7265 }
7266 }
7267
7268
7269
7270 static void GLAPIENTRY
7271 save_Uniform1ivARB(GLint location, GLsizei count, const GLint *v)
7272 {
7273 GET_CURRENT_CONTEXT(ctx);
7274 Node *n;
7275 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7276 n = alloc_instruction(ctx, OPCODE_UNIFORM_1IV, 2 + POINTER_DWORDS);
7277 if (n) {
7278 n[1].i = location;
7279 n[2].i = count;
7280 save_pointer(&n[3], memdup(v, count * 1 * sizeof(GLint)));
7281 }
7282 if (ctx->ExecuteFlag) {
7283 CALL_Uniform1iv(ctx->Exec, (location, count, v));
7284 }
7285 }
7286
7287 static void GLAPIENTRY
7288 save_Uniform2ivARB(GLint location, GLsizei count, const GLint *v)
7289 {
7290 GET_CURRENT_CONTEXT(ctx);
7291 Node *n;
7292 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7293 n = alloc_instruction(ctx, OPCODE_UNIFORM_2IV, 2 + POINTER_DWORDS);
7294 if (n) {
7295 n[1].i = location;
7296 n[2].i = count;
7297 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLint)));
7298 }
7299 if (ctx->ExecuteFlag) {
7300 CALL_Uniform2iv(ctx->Exec, (location, count, v));
7301 }
7302 }
7303
7304 static void GLAPIENTRY
7305 save_Uniform3ivARB(GLint location, GLsizei count, const GLint *v)
7306 {
7307 GET_CURRENT_CONTEXT(ctx);
7308 Node *n;
7309 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7310 n = alloc_instruction(ctx, OPCODE_UNIFORM_3IV, 2 + POINTER_DWORDS);
7311 if (n) {
7312 n[1].i = location;
7313 n[2].i = count;
7314 save_pointer(&n[3], memdup(v, count * 3 * sizeof(GLint)));
7315 }
7316 if (ctx->ExecuteFlag) {
7317 CALL_Uniform3iv(ctx->Exec, (location, count, v));
7318 }
7319 }
7320
7321 static void GLAPIENTRY
7322 save_Uniform4ivARB(GLint location, GLsizei count, const GLint *v)
7323 {
7324 GET_CURRENT_CONTEXT(ctx);
7325 Node *n;
7326 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7327 n = alloc_instruction(ctx, OPCODE_UNIFORM_4IV, 2 + POINTER_DWORDS);
7328 if (n) {
7329 n[1].i = location;
7330 n[2].i = count;
7331 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLfloat)));
7332 }
7333 if (ctx->ExecuteFlag) {
7334 CALL_Uniform4iv(ctx->Exec, (location, count, v));
7335 }
7336 }
7337
7338
7339
7340 static void GLAPIENTRY
7341 save_Uniform1ui(GLint location, GLuint x)
7342 {
7343 GET_CURRENT_CONTEXT(ctx);
7344 Node *n;
7345 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7346 n = alloc_instruction(ctx, OPCODE_UNIFORM_1UI, 2);
7347 if (n) {
7348 n[1].i = location;
7349 n[2].i = x;
7350 }
7351 if (ctx->ExecuteFlag) {
7352 CALL_Uniform1ui(ctx->Exec, (location, x));
7353 }
7354 }
7355
7356 static void GLAPIENTRY
7357 save_Uniform2ui(GLint location, GLuint x, GLuint y)
7358 {
7359 GET_CURRENT_CONTEXT(ctx);
7360 Node *n;
7361 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7362 n = alloc_instruction(ctx, OPCODE_UNIFORM_2UI, 3);
7363 if (n) {
7364 n[1].i = location;
7365 n[2].i = x;
7366 n[3].i = y;
7367 }
7368 if (ctx->ExecuteFlag) {
7369 CALL_Uniform2ui(ctx->Exec, (location, x, y));
7370 }
7371 }
7372
7373 static void GLAPIENTRY
7374 save_Uniform3ui(GLint location, GLuint x, GLuint y, GLuint z)
7375 {
7376 GET_CURRENT_CONTEXT(ctx);
7377 Node *n;
7378 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7379 n = alloc_instruction(ctx, OPCODE_UNIFORM_3UI, 4);
7380 if (n) {
7381 n[1].i = location;
7382 n[2].i = x;
7383 n[3].i = y;
7384 n[4].i = z;
7385 }
7386 if (ctx->ExecuteFlag) {
7387 CALL_Uniform3ui(ctx->Exec, (location, x, y, z));
7388 }
7389 }
7390
7391 static void GLAPIENTRY
7392 save_Uniform4ui(GLint location, GLuint x, GLuint y, GLuint z, GLuint w)
7393 {
7394 GET_CURRENT_CONTEXT(ctx);
7395 Node *n;
7396 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7397 n = alloc_instruction(ctx, OPCODE_UNIFORM_4UI, 5);
7398 if (n) {
7399 n[1].i = location;
7400 n[2].i = x;
7401 n[3].i = y;
7402 n[4].i = z;
7403 n[5].i = w;
7404 }
7405 if (ctx->ExecuteFlag) {
7406 CALL_Uniform4ui(ctx->Exec, (location, x, y, z, w));
7407 }
7408 }
7409
7410
7411
7412 static void GLAPIENTRY
7413 save_Uniform1uiv(GLint location, GLsizei count, const GLuint *v)
7414 {
7415 GET_CURRENT_CONTEXT(ctx);
7416 Node *n;
7417 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7418 n = alloc_instruction(ctx, OPCODE_UNIFORM_1UIV, 2 + POINTER_DWORDS);
7419 if (n) {
7420 n[1].i = location;
7421 n[2].i = count;
7422 save_pointer(&n[3], memdup(v, count * 1 * sizeof(*v)));
7423 }
7424 if (ctx->ExecuteFlag) {
7425 CALL_Uniform1uiv(ctx->Exec, (location, count, v));
7426 }
7427 }
7428
7429 static void GLAPIENTRY
7430 save_Uniform2uiv(GLint location, GLsizei count, const GLuint *v)
7431 {
7432 GET_CURRENT_CONTEXT(ctx);
7433 Node *n;
7434 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7435 n = alloc_instruction(ctx, OPCODE_UNIFORM_2UIV, 2 + POINTER_DWORDS);
7436 if (n) {
7437 n[1].i = location;
7438 n[2].i = count;
7439 save_pointer(&n[3], memdup(v, count * 2 * sizeof(*v)));
7440 }
7441 if (ctx->ExecuteFlag) {
7442 CALL_Uniform2uiv(ctx->Exec, (location, count, v));
7443 }
7444 }
7445
7446 static void GLAPIENTRY
7447 save_Uniform3uiv(GLint location, GLsizei count, const GLuint *v)
7448 {
7449 GET_CURRENT_CONTEXT(ctx);
7450 Node *n;
7451 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7452 n = alloc_instruction(ctx, OPCODE_UNIFORM_3UIV, 2 + POINTER_DWORDS);
7453 if (n) {
7454 n[1].i = location;
7455 n[2].i = count;
7456 save_pointer(&n[3], memdup(v, count * 3 * sizeof(*v)));
7457 }
7458 if (ctx->ExecuteFlag) {
7459 CALL_Uniform3uiv(ctx->Exec, (location, count, v));
7460 }
7461 }
7462
7463 static void GLAPIENTRY
7464 save_Uniform4uiv(GLint location, GLsizei count, const GLuint *v)
7465 {
7466 GET_CURRENT_CONTEXT(ctx);
7467 Node *n;
7468 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7469 n = alloc_instruction(ctx, OPCODE_UNIFORM_4UIV, 2 + POINTER_DWORDS);
7470 if (n) {
7471 n[1].i = location;
7472 n[2].i = count;
7473 save_pointer(&n[3], memdup(v, count * 4 * sizeof(*v)));
7474 }
7475 if (ctx->ExecuteFlag) {
7476 CALL_Uniform4uiv(ctx->Exec, (location, count, v));
7477 }
7478 }
7479
7480
7481
7482 static void GLAPIENTRY
7483 save_UniformMatrix2fvARB(GLint location, GLsizei count, GLboolean transpose,
7484 const GLfloat *m)
7485 {
7486 GET_CURRENT_CONTEXT(ctx);
7487 Node *n;
7488 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7489 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX22, 3 + POINTER_DWORDS);
7490 if (n) {
7491 n[1].i = location;
7492 n[2].i = count;
7493 n[3].b = transpose;
7494 save_pointer(&n[4], memdup(m, count * 2 * 2 * sizeof(GLfloat)));
7495 }
7496 if (ctx->ExecuteFlag) {
7497 CALL_UniformMatrix2fv(ctx->Exec, (location, count, transpose, m));
7498 }
7499 }
7500
7501 static void GLAPIENTRY
7502 save_UniformMatrix3fvARB(GLint location, GLsizei count, GLboolean transpose,
7503 const GLfloat *m)
7504 {
7505 GET_CURRENT_CONTEXT(ctx);
7506 Node *n;
7507 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7508 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX33, 3 + POINTER_DWORDS);
7509 if (n) {
7510 n[1].i = location;
7511 n[2].i = count;
7512 n[3].b = transpose;
7513 save_pointer(&n[4], memdup(m, count * 3 * 3 * sizeof(GLfloat)));
7514 }
7515 if (ctx->ExecuteFlag) {
7516 CALL_UniformMatrix3fv(ctx->Exec, (location, count, transpose, m));
7517 }
7518 }
7519
7520 static void GLAPIENTRY
7521 save_UniformMatrix4fvARB(GLint location, GLsizei count, GLboolean transpose,
7522 const GLfloat *m)
7523 {
7524 GET_CURRENT_CONTEXT(ctx);
7525 Node *n;
7526 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7527 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX44, 3 + POINTER_DWORDS);
7528 if (n) {
7529 n[1].i = location;
7530 n[2].i = count;
7531 n[3].b = transpose;
7532 save_pointer(&n[4], memdup(m, count * 4 * 4 * sizeof(GLfloat)));
7533 }
7534 if (ctx->ExecuteFlag) {
7535 CALL_UniformMatrix4fv(ctx->Exec, (location, count, transpose, m));
7536 }
7537 }
7538
7539
7540 static void GLAPIENTRY
7541 save_UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose,
7542 const GLfloat *m)
7543 {
7544 GET_CURRENT_CONTEXT(ctx);
7545 Node *n;
7546 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7547 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX23, 3 + POINTER_DWORDS);
7548 if (n) {
7549 n[1].i = location;
7550 n[2].i = count;
7551 n[3].b = transpose;
7552 save_pointer(&n[4], memdup(m, count * 2 * 3 * sizeof(GLfloat)));
7553 }
7554 if (ctx->ExecuteFlag) {
7555 CALL_UniformMatrix2x3fv(ctx->Exec, (location, count, transpose, m));
7556 }
7557 }
7558
7559 static void GLAPIENTRY
7560 save_UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose,
7561 const GLfloat *m)
7562 {
7563 GET_CURRENT_CONTEXT(ctx);
7564 Node *n;
7565 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7566 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX32, 3 + POINTER_DWORDS);
7567 if (n) {
7568 n[1].i = location;
7569 n[2].i = count;
7570 n[3].b = transpose;
7571 save_pointer(&n[4], memdup(m, count * 3 * 2 * sizeof(GLfloat)));
7572 }
7573 if (ctx->ExecuteFlag) {
7574 CALL_UniformMatrix3x2fv(ctx->Exec, (location, count, transpose, m));
7575 }
7576 }
7577
7578
7579 static void GLAPIENTRY
7580 save_UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose,
7581 const GLfloat *m)
7582 {
7583 GET_CURRENT_CONTEXT(ctx);
7584 Node *n;
7585 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7586 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX24, 3 + POINTER_DWORDS);
7587 if (n) {
7588 n[1].i = location;
7589 n[2].i = count;
7590 n[3].b = transpose;
7591 save_pointer(&n[4], memdup(m, count * 2 * 4 * sizeof(GLfloat)));
7592 }
7593 if (ctx->ExecuteFlag) {
7594 CALL_UniformMatrix2x4fv(ctx->Exec, (location, count, transpose, m));
7595 }
7596 }
7597
7598 static void GLAPIENTRY
7599 save_UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose,
7600 const GLfloat *m)
7601 {
7602 GET_CURRENT_CONTEXT(ctx);
7603 Node *n;
7604 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7605 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX42, 3 + POINTER_DWORDS);
7606 if (n) {
7607 n[1].i = location;
7608 n[2].i = count;
7609 n[3].b = transpose;
7610 save_pointer(&n[4], memdup(m, count * 4 * 2 * sizeof(GLfloat)));
7611 }
7612 if (ctx->ExecuteFlag) {
7613 CALL_UniformMatrix4x2fv(ctx->Exec, (location, count, transpose, m));
7614 }
7615 }
7616
7617
7618 static void GLAPIENTRY
7619 save_UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose,
7620 const GLfloat *m)
7621 {
7622 GET_CURRENT_CONTEXT(ctx);
7623 Node *n;
7624 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7625 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX34, 3 + POINTER_DWORDS);
7626 if (n) {
7627 n[1].i = location;
7628 n[2].i = count;
7629 n[3].b = transpose;
7630 save_pointer(&n[4], memdup(m, count * 3 * 4 * sizeof(GLfloat)));
7631 }
7632 if (ctx->ExecuteFlag) {
7633 CALL_UniformMatrix3x4fv(ctx->Exec, (location, count, transpose, m));
7634 }
7635 }
7636
7637 static void GLAPIENTRY
7638 save_UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose,
7639 const GLfloat *m)
7640 {
7641 GET_CURRENT_CONTEXT(ctx);
7642 Node *n;
7643 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7644 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX43, 3 + POINTER_DWORDS);
7645 if (n) {
7646 n[1].i = location;
7647 n[2].i = count;
7648 n[3].b = transpose;
7649 save_pointer(&n[4], memdup(m, count * 4 * 3 * sizeof(GLfloat)));
7650 }
7651 if (ctx->ExecuteFlag) {
7652 CALL_UniformMatrix4x3fv(ctx->Exec, (location, count, transpose, m));
7653 }
7654 }
7655
7656
7657 static void GLAPIENTRY
7658 save_UniformMatrix2dv(GLint location, GLsizei count, GLboolean transpose,
7659 const GLdouble *m)
7660 {
7661 GET_CURRENT_CONTEXT(ctx);
7662 Node *n;
7663 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7664 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX22D, 3 + POINTER_DWORDS);
7665 if (n) {
7666 n[1].i = location;
7667 n[2].i = count;
7668 n[3].b = transpose;
7669 save_pointer(&n[4], memdup(m, count * 2 * 2 * sizeof(GLdouble)));
7670 }
7671 if (ctx->ExecuteFlag) {
7672 CALL_UniformMatrix2dv(ctx->Exec, (location, count, transpose, m));
7673 }
7674 }
7675
7676 static void GLAPIENTRY
7677 save_UniformMatrix3dv(GLint location, GLsizei count, GLboolean transpose,
7678 const GLdouble *m)
7679 {
7680 GET_CURRENT_CONTEXT(ctx);
7681 Node *n;
7682 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7683 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX33D, 3 + POINTER_DWORDS);
7684 if (n) {
7685 n[1].i = location;
7686 n[2].i = count;
7687 n[3].b = transpose;
7688 save_pointer(&n[4], memdup(m, count * 3 * 3 * sizeof(GLdouble)));
7689 }
7690 if (ctx->ExecuteFlag) {
7691 CALL_UniformMatrix3dv(ctx->Exec, (location, count, transpose, m));
7692 }
7693 }
7694
7695 static void GLAPIENTRY
7696 save_UniformMatrix4dv(GLint location, GLsizei count, GLboolean transpose,
7697 const GLdouble *m)
7698 {
7699 GET_CURRENT_CONTEXT(ctx);
7700 Node *n;
7701 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7702 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX44D, 3 + POINTER_DWORDS);
7703 if (n) {
7704 n[1].i = location;
7705 n[2].i = count;
7706 n[3].b = transpose;
7707 save_pointer(&n[4], memdup(m, count * 4 * 4 * sizeof(GLdouble)));
7708 }
7709 if (ctx->ExecuteFlag) {
7710 CALL_UniformMatrix4dv(ctx->Exec, (location, count, transpose, m));
7711 }
7712 }
7713
7714
7715 static void GLAPIENTRY
7716 save_UniformMatrix2x3dv(GLint location, GLsizei count, GLboolean transpose,
7717 const GLdouble *m)
7718 {
7719 GET_CURRENT_CONTEXT(ctx);
7720 Node *n;
7721 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7722 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX23D, 3 + POINTER_DWORDS);
7723 if (n) {
7724 n[1].i = location;
7725 n[2].i = count;
7726 n[3].b = transpose;
7727 save_pointer(&n[4], memdup(m, count * 2 * 3 * sizeof(GLdouble)));
7728 }
7729 if (ctx->ExecuteFlag) {
7730 CALL_UniformMatrix2x3dv(ctx->Exec, (location, count, transpose, m));
7731 }
7732 }
7733
7734
7735 static void GLAPIENTRY
7736 save_UniformMatrix3x2dv(GLint location, GLsizei count, GLboolean transpose,
7737 const GLdouble *m)
7738 {
7739 GET_CURRENT_CONTEXT(ctx);
7740 Node *n;
7741 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7742 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX32D, 3 + POINTER_DWORDS);
7743 if (n) {
7744 n[1].i = location;
7745 n[2].i = count;
7746 n[3].b = transpose;
7747 save_pointer(&n[4], memdup(m, count * 3 * 2 * sizeof(GLdouble)));
7748 }
7749 if (ctx->ExecuteFlag) {
7750 CALL_UniformMatrix3x2dv(ctx->Exec, (location, count, transpose, m));
7751 }
7752 }
7753
7754
7755 static void GLAPIENTRY
7756 save_UniformMatrix2x4dv(GLint location, GLsizei count, GLboolean transpose,
7757 const GLdouble *m)
7758 {
7759 GET_CURRENT_CONTEXT(ctx);
7760 Node *n;
7761 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7762 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX24D, 3 + POINTER_DWORDS);
7763 if (n) {
7764 n[1].i = location;
7765 n[2].i = count;
7766 n[3].b = transpose;
7767 save_pointer(&n[4], memdup(m, count * 2 * 4 * sizeof(GLdouble)));
7768 }
7769 if (ctx->ExecuteFlag) {
7770 CALL_UniformMatrix2x4dv(ctx->Exec, (location, count, transpose, m));
7771 }
7772 }
7773
7774 static void GLAPIENTRY
7775 save_UniformMatrix4x2dv(GLint location, GLsizei count, GLboolean transpose,
7776 const GLdouble *m)
7777 {
7778 GET_CURRENT_CONTEXT(ctx);
7779 Node *n;
7780 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7781 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX42D, 3 + POINTER_DWORDS);
7782 if (n) {
7783 n[1].i = location;
7784 n[2].i = count;
7785 n[3].b = transpose;
7786 save_pointer(&n[4], memdup(m, count * 4 * 2 * sizeof(GLdouble)));
7787 }
7788 if (ctx->ExecuteFlag) {
7789 CALL_UniformMatrix4x2dv(ctx->Exec, (location, count, transpose, m));
7790 }
7791 }
7792
7793
7794 static void GLAPIENTRY
7795 save_UniformMatrix3x4dv(GLint location, GLsizei count, GLboolean transpose,
7796 const GLdouble *m)
7797 {
7798 GET_CURRENT_CONTEXT(ctx);
7799 Node *n;
7800 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7801 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX34D, 3 + POINTER_DWORDS);
7802 if (n) {
7803 n[1].i = location;
7804 n[2].i = count;
7805 n[3].b = transpose;
7806 save_pointer(&n[4], memdup(m, count * 3 * 4 * sizeof(GLdouble)));
7807 }
7808 if (ctx->ExecuteFlag) {
7809 CALL_UniformMatrix3x4dv(ctx->Exec, (location, count, transpose, m));
7810 }
7811 }
7812
7813
7814 static void GLAPIENTRY
7815 save_UniformMatrix4x3dv(GLint location, GLsizei count, GLboolean transpose,
7816 const GLdouble *m)
7817 {
7818 GET_CURRENT_CONTEXT(ctx);
7819 Node *n;
7820 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7821 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX43D, 3 + POINTER_DWORDS);
7822 if (n) {
7823 n[1].i = location;
7824 n[2].i = count;
7825 n[3].b = transpose;
7826 save_pointer(&n[4], memdup(m, count * 4 * 3 * sizeof(GLdouble)));
7827 }
7828 if (ctx->ExecuteFlag) {
7829 CALL_UniformMatrix4x3dv(ctx->Exec, (location, count, transpose, m));
7830 }
7831 }
7832
7833
7834 static void GLAPIENTRY
7835 save_UseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program)
7836 {
7837 GET_CURRENT_CONTEXT(ctx);
7838 Node *n;
7839 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7840 n = alloc_instruction(ctx, OPCODE_USE_PROGRAM_STAGES, 3);
7841 if (n) {
7842 n[1].ui = pipeline;
7843 n[2].ui = stages;
7844 n[3].ui = program;
7845 }
7846 if (ctx->ExecuteFlag) {
7847 CALL_UseProgramStages(ctx->Exec, (pipeline, stages, program));
7848 }
7849 }
7850
7851 static void GLAPIENTRY
7852 save_ProgramUniform1f(GLuint program, GLint location, GLfloat x)
7853 {
7854 GET_CURRENT_CONTEXT(ctx);
7855 Node *n;
7856 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7857 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1F, 3);
7858 if (n) {
7859 n[1].ui = program;
7860 n[2].i = location;
7861 n[3].f = x;
7862 }
7863 if (ctx->ExecuteFlag) {
7864 CALL_ProgramUniform1f(ctx->Exec, (program, location, x));
7865 }
7866 }
7867
7868 static void GLAPIENTRY
7869 save_ProgramUniform2f(GLuint program, GLint location, GLfloat x, GLfloat y)
7870 {
7871 GET_CURRENT_CONTEXT(ctx);
7872 Node *n;
7873 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7874 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2F, 4);
7875 if (n) {
7876 n[1].ui = program;
7877 n[2].i = location;
7878 n[3].f = x;
7879 n[4].f = y;
7880 }
7881 if (ctx->ExecuteFlag) {
7882 CALL_ProgramUniform2f(ctx->Exec, (program, location, x, y));
7883 }
7884 }
7885
7886 static void GLAPIENTRY
7887 save_ProgramUniform3f(GLuint program, GLint location,
7888 GLfloat x, GLfloat y, GLfloat z)
7889 {
7890 GET_CURRENT_CONTEXT(ctx);
7891 Node *n;
7892 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7893 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3F, 5);
7894 if (n) {
7895 n[1].ui = program;
7896 n[2].i = location;
7897 n[3].f = x;
7898 n[4].f = y;
7899 n[5].f = z;
7900 }
7901 if (ctx->ExecuteFlag) {
7902 CALL_ProgramUniform3f(ctx->Exec, (program, location, x, y, z));
7903 }
7904 }
7905
7906 static void GLAPIENTRY
7907 save_ProgramUniform4f(GLuint program, GLint location,
7908 GLfloat x, GLfloat y, GLfloat z, GLfloat w)
7909 {
7910 GET_CURRENT_CONTEXT(ctx);
7911 Node *n;
7912 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7913 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4F, 6);
7914 if (n) {
7915 n[1].ui = program;
7916 n[2].i = location;
7917 n[3].f = x;
7918 n[4].f = y;
7919 n[5].f = z;
7920 n[6].f = w;
7921 }
7922 if (ctx->ExecuteFlag) {
7923 CALL_ProgramUniform4f(ctx->Exec, (program, location, x, y, z, w));
7924 }
7925 }
7926
7927 static void GLAPIENTRY
7928 save_ProgramUniform1fv(GLuint program, GLint location, GLsizei count,
7929 const GLfloat *v)
7930 {
7931 GET_CURRENT_CONTEXT(ctx);
7932 Node *n;
7933 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7934 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1FV, 3 + POINTER_DWORDS);
7935 if (n) {
7936 n[1].ui = program;
7937 n[2].i = location;
7938 n[3].i = count;
7939 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLfloat)));
7940 }
7941 if (ctx->ExecuteFlag) {
7942 CALL_ProgramUniform1fv(ctx->Exec, (program, location, count, v));
7943 }
7944 }
7945
7946 static void GLAPIENTRY
7947 save_ProgramUniform2fv(GLuint program, GLint location, GLsizei count,
7948 const GLfloat *v)
7949 {
7950 GET_CURRENT_CONTEXT(ctx);
7951 Node *n;
7952 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7953 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2FV, 3 + POINTER_DWORDS);
7954 if (n) {
7955 n[1].ui = program;
7956 n[2].i = location;
7957 n[3].i = count;
7958 save_pointer(&n[4], memdup(v, count * 2 * sizeof(GLfloat)));
7959 }
7960 if (ctx->ExecuteFlag) {
7961 CALL_ProgramUniform2fv(ctx->Exec, (program, location, count, v));
7962 }
7963 }
7964
7965 static void GLAPIENTRY
7966 save_ProgramUniform3fv(GLuint program, GLint location, GLsizei count,
7967 const GLfloat *v)
7968 {
7969 GET_CURRENT_CONTEXT(ctx);
7970 Node *n;
7971 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7972 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3FV, 3 + POINTER_DWORDS);
7973 if (n) {
7974 n[1].ui = program;
7975 n[2].i = location;
7976 n[3].i = count;
7977 save_pointer(&n[4], memdup(v, count * 3 * sizeof(GLfloat)));
7978 }
7979 if (ctx->ExecuteFlag) {
7980 CALL_ProgramUniform3fv(ctx->Exec, (program, location, count, v));
7981 }
7982 }
7983
7984 static void GLAPIENTRY
7985 save_ProgramUniform4fv(GLuint program, GLint location, GLsizei count,
7986 const GLfloat *v)
7987 {
7988 GET_CURRENT_CONTEXT(ctx);
7989 Node *n;
7990 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7991 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4FV, 3 + POINTER_DWORDS);
7992 if (n) {
7993 n[1].ui = program;
7994 n[2].i = location;
7995 n[3].i = count;
7996 save_pointer(&n[4], memdup(v, count * 4 * sizeof(GLfloat)));
7997 }
7998 if (ctx->ExecuteFlag) {
7999 CALL_ProgramUniform4fv(ctx->Exec, (program, location, count, v));
8000 }
8001 }
8002
8003 static void GLAPIENTRY
8004 save_ProgramUniform1d(GLuint program, GLint location, GLdouble x)
8005 {
8006 GET_CURRENT_CONTEXT(ctx);
8007 Node *n;
8008 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8009 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1D, 4);
8010 if (n) {
8011 n[1].ui = program;
8012 n[2].i = location;
8013 ASSIGN_DOUBLE_TO_NODES(n, 3, x);
8014 }
8015 if (ctx->ExecuteFlag) {
8016 CALL_ProgramUniform1d(ctx->Exec, (program, location, x));
8017 }
8018 }
8019
8020 static void GLAPIENTRY
8021 save_ProgramUniform2d(GLuint program, GLint location, GLdouble x, GLdouble y)
8022 {
8023 GET_CURRENT_CONTEXT(ctx);
8024 Node *n;
8025 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8026 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2D, 6);
8027 if (n) {
8028 n[1].ui = program;
8029 n[2].i = location;
8030 ASSIGN_DOUBLE_TO_NODES(n, 3, x);
8031 ASSIGN_DOUBLE_TO_NODES(n, 5, y);
8032 }
8033 if (ctx->ExecuteFlag) {
8034 CALL_ProgramUniform2d(ctx->Exec, (program, location, x, y));
8035 }
8036 }
8037
8038 static void GLAPIENTRY
8039 save_ProgramUniform3d(GLuint program, GLint location,
8040 GLdouble x, GLdouble y, GLdouble z)
8041 {
8042 GET_CURRENT_CONTEXT(ctx);
8043 Node *n;
8044 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8045 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3D, 8);
8046 if (n) {
8047 n[1].ui = program;
8048 n[2].i = location;
8049 ASSIGN_DOUBLE_TO_NODES(n, 3, x);
8050 ASSIGN_DOUBLE_TO_NODES(n, 5, y);
8051 ASSIGN_DOUBLE_TO_NODES(n, 7, z);
8052 }
8053 if (ctx->ExecuteFlag) {
8054 CALL_ProgramUniform3d(ctx->Exec, (program, location, x, y, z));
8055 }
8056 }
8057
8058 static void GLAPIENTRY
8059 save_ProgramUniform4d(GLuint program, GLint location,
8060 GLdouble x, GLdouble y, GLdouble z, GLdouble w)
8061 {
8062 GET_CURRENT_CONTEXT(ctx);
8063 Node *n;
8064 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8065 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4D, 10);
8066 if (n) {
8067 n[1].ui = program;
8068 n[2].i = location;
8069 ASSIGN_DOUBLE_TO_NODES(n, 3, x);
8070 ASSIGN_DOUBLE_TO_NODES(n, 5, y);
8071 ASSIGN_DOUBLE_TO_NODES(n, 7, z);
8072 ASSIGN_DOUBLE_TO_NODES(n, 9, w);
8073 }
8074 if (ctx->ExecuteFlag) {
8075 CALL_ProgramUniform4d(ctx->Exec, (program, location, x, y, z, w));
8076 }
8077 }
8078
8079 static void GLAPIENTRY
8080 save_ProgramUniform1dv(GLuint program, GLint location, GLsizei count,
8081 const GLdouble *v)
8082 {
8083 GET_CURRENT_CONTEXT(ctx);
8084 Node *n;
8085 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8086 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1DV, 3 + POINTER_DWORDS);
8087 if (n) {
8088 n[1].ui = program;
8089 n[2].i = location;
8090 n[3].i = count;
8091 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLdouble)));
8092 }
8093 if (ctx->ExecuteFlag) {
8094 CALL_ProgramUniform1dv(ctx->Exec, (program, location, count, v));
8095 }
8096 }
8097
8098 static void GLAPIENTRY
8099 save_ProgramUniform2dv(GLuint program, GLint location, GLsizei count,
8100 const GLdouble *v)
8101 {
8102 GET_CURRENT_CONTEXT(ctx);
8103 Node *n;
8104 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8105 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2DV, 3 + POINTER_DWORDS);
8106 if (n) {
8107 n[1].ui = program;
8108 n[2].i = location;
8109 n[3].i = count;
8110 save_pointer(&n[4], memdup(v, count * 2 * sizeof(GLdouble)));
8111 }
8112 if (ctx->ExecuteFlag) {
8113 CALL_ProgramUniform2dv(ctx->Exec, (program, location, count, v));
8114 }
8115 }
8116
8117 static void GLAPIENTRY
8118 save_ProgramUniform3dv(GLuint program, GLint location, GLsizei count,
8119 const GLdouble *v)
8120 {
8121 GET_CURRENT_CONTEXT(ctx);
8122 Node *n;
8123 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8124 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3DV, 3 + POINTER_DWORDS);
8125 if (n) {
8126 n[1].ui = program;
8127 n[2].i = location;
8128 n[3].i = count;
8129 save_pointer(&n[4], memdup(v, count * 3 * sizeof(GLdouble)));
8130 }
8131 if (ctx->ExecuteFlag) {
8132 CALL_ProgramUniform3dv(ctx->Exec, (program, location, count, v));
8133 }
8134 }
8135
8136 static void GLAPIENTRY
8137 save_ProgramUniform4dv(GLuint program, GLint location, GLsizei count,
8138 const GLdouble *v)
8139 {
8140 GET_CURRENT_CONTEXT(ctx);
8141 Node *n;
8142 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8143 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4DV, 3 + POINTER_DWORDS);
8144 if (n) {
8145 n[1].ui = program;
8146 n[2].i = location;
8147 n[3].i = count;
8148 save_pointer(&n[4], memdup(v, count * 4 * sizeof(GLdouble)));
8149 }
8150 if (ctx->ExecuteFlag) {
8151 CALL_ProgramUniform4dv(ctx->Exec, (program, location, count, v));
8152 }
8153 }
8154
8155 static void GLAPIENTRY
8156 save_ProgramUniform1i(GLuint program, GLint location, GLint x)
8157 {
8158 GET_CURRENT_CONTEXT(ctx);
8159 Node *n;
8160 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8161 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1I, 3);
8162 if (n) {
8163 n[1].ui = program;
8164 n[2].i = location;
8165 n[3].i = x;
8166 }
8167 if (ctx->ExecuteFlag) {
8168 CALL_ProgramUniform1i(ctx->Exec, (program, location, x));
8169 }
8170 }
8171
8172 static void GLAPIENTRY
8173 save_ProgramUniform2i(GLuint program, GLint location, GLint x, GLint y)
8174 {
8175 GET_CURRENT_CONTEXT(ctx);
8176 Node *n;
8177 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8178 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2I, 4);
8179 if (n) {
8180 n[1].ui = program;
8181 n[2].i = location;
8182 n[3].i = x;
8183 n[4].i = y;
8184 }
8185 if (ctx->ExecuteFlag) {
8186 CALL_ProgramUniform2i(ctx->Exec, (program, location, x, y));
8187 }
8188 }
8189
8190 static void GLAPIENTRY
8191 save_ProgramUniform3i(GLuint program, GLint location,
8192 GLint x, GLint y, GLint z)
8193 {
8194 GET_CURRENT_CONTEXT(ctx);
8195 Node *n;
8196 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8197 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3I, 5);
8198 if (n) {
8199 n[1].ui = program;
8200 n[2].i = location;
8201 n[3].i = x;
8202 n[4].i = y;
8203 n[5].i = z;
8204 }
8205 if (ctx->ExecuteFlag) {
8206 CALL_ProgramUniform3i(ctx->Exec, (program, location, x, y, z));
8207 }
8208 }
8209
8210 static void GLAPIENTRY
8211 save_ProgramUniform4i(GLuint program, GLint location,
8212 GLint x, GLint y, GLint z, GLint w)
8213 {
8214 GET_CURRENT_CONTEXT(ctx);
8215 Node *n;
8216 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8217 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4I, 6);
8218 if (n) {
8219 n[1].ui = program;
8220 n[2].i = location;
8221 n[3].i = x;
8222 n[4].i = y;
8223 n[5].i = z;
8224 n[6].i = w;
8225 }
8226 if (ctx->ExecuteFlag) {
8227 CALL_ProgramUniform4i(ctx->Exec, (program, location, x, y, z, w));
8228 }
8229 }
8230
8231 static void GLAPIENTRY
8232 save_ProgramUniform1iv(GLuint program, GLint location, GLsizei count,
8233 const GLint *v)
8234 {
8235 GET_CURRENT_CONTEXT(ctx);
8236 Node *n;
8237 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8238 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1IV, 3 + POINTER_DWORDS);
8239 if (n) {
8240 n[1].ui = program;
8241 n[2].i = location;
8242 n[3].i = count;
8243 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLint)));
8244 }
8245 if (ctx->ExecuteFlag) {
8246 CALL_ProgramUniform1iv(ctx->Exec, (program, location, count, v));
8247 }
8248 }
8249
8250 static void GLAPIENTRY
8251 save_ProgramUniform2iv(GLuint program, GLint location, GLsizei count,
8252 const GLint *v)
8253 {
8254 GET_CURRENT_CONTEXT(ctx);
8255 Node *n;
8256 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8257 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2IV, 3 + POINTER_DWORDS);
8258 if (n) {
8259 n[1].ui = program;
8260 n[2].i = location;
8261 n[3].i = count;
8262 save_pointer(&n[4], memdup(v, count * 2 * sizeof(GLint)));
8263 }
8264 if (ctx->ExecuteFlag) {
8265 CALL_ProgramUniform2iv(ctx->Exec, (program, location, count, v));
8266 }
8267 }
8268
8269 static void GLAPIENTRY
8270 save_ProgramUniform3iv(GLuint program, GLint location, GLsizei count,
8271 const GLint *v)
8272 {
8273 GET_CURRENT_CONTEXT(ctx);
8274 Node *n;
8275 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8276 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3IV, 3 + POINTER_DWORDS);
8277 if (n) {
8278 n[1].ui = program;
8279 n[2].i = location;
8280 n[3].i = count;
8281 save_pointer(&n[4], memdup(v, count * 3 * sizeof(GLint)));
8282 }
8283 if (ctx->ExecuteFlag) {
8284 CALL_ProgramUniform3iv(ctx->Exec, (program, location, count, v));
8285 }
8286 }
8287
8288 static void GLAPIENTRY
8289 save_ProgramUniform4iv(GLuint program, GLint location, GLsizei count,
8290 const GLint *v)
8291 {
8292 GET_CURRENT_CONTEXT(ctx);
8293 Node *n;
8294 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8295 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4IV, 3 + POINTER_DWORDS);
8296 if (n) {
8297 n[1].ui = program;
8298 n[2].i = location;
8299 n[3].i = count;
8300 save_pointer(&n[4], memdup(v, count * 4 * sizeof(GLint)));
8301 }
8302 if (ctx->ExecuteFlag) {
8303 CALL_ProgramUniform4iv(ctx->Exec, (program, location, count, v));
8304 }
8305 }
8306
8307 static void GLAPIENTRY
8308 save_ProgramUniform1ui(GLuint program, GLint location, GLuint x)
8309 {
8310 GET_CURRENT_CONTEXT(ctx);
8311 Node *n;
8312 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8313 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1UI, 3);
8314 if (n) {
8315 n[1].ui = program;
8316 n[2].i = location;
8317 n[3].ui = x;
8318 }
8319 if (ctx->ExecuteFlag) {
8320 CALL_ProgramUniform1ui(ctx->Exec, (program, location, x));
8321 }
8322 }
8323
8324 static void GLAPIENTRY
8325 save_ProgramUniform2ui(GLuint program, GLint location, GLuint x, GLuint y)
8326 {
8327 GET_CURRENT_CONTEXT(ctx);
8328 Node *n;
8329 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8330 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2UI, 4);
8331 if (n) {
8332 n[1].ui = program;
8333 n[2].i = location;
8334 n[3].ui = x;
8335 n[4].ui = y;
8336 }
8337 if (ctx->ExecuteFlag) {
8338 CALL_ProgramUniform2ui(ctx->Exec, (program, location, x, y));
8339 }
8340 }
8341
8342 static void GLAPIENTRY
8343 save_ProgramUniform3ui(GLuint program, GLint location,
8344 GLuint x, GLuint y, GLuint z)
8345 {
8346 GET_CURRENT_CONTEXT(ctx);
8347 Node *n;
8348 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8349 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3UI, 5);
8350 if (n) {
8351 n[1].ui = program;
8352 n[2].i = location;
8353 n[3].ui = x;
8354 n[4].ui = y;
8355 n[5].ui = z;
8356 }
8357 if (ctx->ExecuteFlag) {
8358 CALL_ProgramUniform3ui(ctx->Exec, (program, location, x, y, z));
8359 }
8360 }
8361
8362 static void GLAPIENTRY
8363 save_ProgramUniform4ui(GLuint program, GLint location,
8364 GLuint x, GLuint y, GLuint z, GLuint w)
8365 {
8366 GET_CURRENT_CONTEXT(ctx);
8367 Node *n;
8368 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8369 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4UI, 6);
8370 if (n) {
8371 n[1].ui = program;
8372 n[2].i = location;
8373 n[3].ui = x;
8374 n[4].ui = y;
8375 n[5].ui = z;
8376 n[6].ui = w;
8377 }
8378 if (ctx->ExecuteFlag) {
8379 CALL_ProgramUniform4ui(ctx->Exec, (program, location, x, y, z, w));
8380 }
8381 }
8382
8383 static void GLAPIENTRY
8384 save_ProgramUniform1uiv(GLuint program, GLint location, GLsizei count,
8385 const GLuint *v)
8386 {
8387 GET_CURRENT_CONTEXT(ctx);
8388 Node *n;
8389 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8390 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1UIV, 3 + POINTER_DWORDS);
8391 if (n) {
8392 n[1].ui = program;
8393 n[2].i = location;
8394 n[3].i = count;
8395 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLuint)));
8396 }
8397 if (ctx->ExecuteFlag) {
8398 CALL_ProgramUniform1uiv(ctx->Exec, (program, location, count, v));
8399 }
8400 }
8401
8402 static void GLAPIENTRY
8403 save_ProgramUniform2uiv(GLuint program, GLint location, GLsizei count,
8404 const GLuint *v)
8405 {
8406 GET_CURRENT_CONTEXT(ctx);
8407 Node *n;
8408 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8409 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2UIV, 3 + POINTER_DWORDS);
8410 if (n) {
8411 n[1].ui = program;
8412 n[2].i = location;
8413 n[3].i = count;
8414 save_pointer(&n[4], memdup(v, count * 2 * sizeof(GLuint)));
8415 }
8416 if (ctx->ExecuteFlag) {
8417 CALL_ProgramUniform2uiv(ctx->Exec, (program, location, count, v));
8418 }
8419 }
8420
8421 static void GLAPIENTRY
8422 save_ProgramUniform3uiv(GLuint program, GLint location, GLsizei count,
8423 const GLuint *v)
8424 {
8425 GET_CURRENT_CONTEXT(ctx);
8426 Node *n;
8427 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8428 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3UIV, 3 + POINTER_DWORDS);
8429 if (n) {
8430 n[1].ui = program;
8431 n[2].i = location;
8432 n[3].i = count;
8433 save_pointer(&n[4], memdup(v, count * 3 * sizeof(GLuint)));
8434 }
8435 if (ctx->ExecuteFlag) {
8436 CALL_ProgramUniform3uiv(ctx->Exec, (program, location, count, v));
8437 }
8438 }
8439
8440 static void GLAPIENTRY
8441 save_ProgramUniform4uiv(GLuint program, GLint location, GLsizei count,
8442 const GLuint *v)
8443 {
8444 GET_CURRENT_CONTEXT(ctx);
8445 Node *n;
8446 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8447 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4UIV, 3 + POINTER_DWORDS);
8448 if (n) {
8449 n[1].ui = program;
8450 n[2].i = location;
8451 n[3].i = count;
8452 save_pointer(&n[4], memdup(v, count * 4 * sizeof(GLuint)));
8453 }
8454 if (ctx->ExecuteFlag) {
8455 CALL_ProgramUniform4uiv(ctx->Exec, (program, location, count, v));
8456 }
8457 }
8458
8459 static void GLAPIENTRY
8460 save_ProgramUniformMatrix2fv(GLuint program, GLint location, GLsizei count,
8461 GLboolean transpose, const GLfloat *v)
8462 {
8463 GET_CURRENT_CONTEXT(ctx);
8464 Node *n;
8465 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8466 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX22F,
8467 4 + POINTER_DWORDS);
8468 if (n) {
8469 n[1].ui = program;
8470 n[2].i = location;
8471 n[3].i = count;
8472 n[4].b = transpose;
8473 save_pointer(&n[5], memdup(v, count * 2 * 2 * sizeof(GLfloat)));
8474 }
8475 if (ctx->ExecuteFlag) {
8476 CALL_ProgramUniformMatrix2fv(ctx->Exec,
8477 (program, location, count, transpose, v));
8478 }
8479 }
8480
8481 static void GLAPIENTRY
8482 save_ProgramUniformMatrix2x3fv(GLuint program, GLint location, GLsizei count,
8483 GLboolean transpose, const GLfloat *v)
8484 {
8485 GET_CURRENT_CONTEXT(ctx);
8486 Node *n;
8487 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8488 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX23F,
8489 4 + POINTER_DWORDS);
8490 if (n) {
8491 n[1].ui = program;
8492 n[2].i = location;
8493 n[3].i = count;
8494 n[4].b = transpose;
8495 save_pointer(&n[5], memdup(v, count * 2 * 3 * sizeof(GLfloat)));
8496 }
8497 if (ctx->ExecuteFlag) {
8498 CALL_ProgramUniformMatrix2x3fv(ctx->Exec,
8499 (program, location, count, transpose, v));
8500 }
8501 }
8502
8503 static void GLAPIENTRY
8504 save_ProgramUniformMatrix2x4fv(GLuint program, GLint location, GLsizei count,
8505 GLboolean transpose, const GLfloat *v)
8506 {
8507 GET_CURRENT_CONTEXT(ctx);
8508 Node *n;
8509 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8510 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX24F,
8511 4 + POINTER_DWORDS);
8512 if (n) {
8513 n[1].ui = program;
8514 n[2].i = location;
8515 n[3].i = count;
8516 n[4].b = transpose;
8517 save_pointer(&n[5], memdup(v, count * 2 * 4 * sizeof(GLfloat)));
8518 }
8519 if (ctx->ExecuteFlag) {
8520 CALL_ProgramUniformMatrix2x4fv(ctx->Exec,
8521 (program, location, count, transpose, v));
8522 }
8523 }
8524
8525 static void GLAPIENTRY
8526 save_ProgramUniformMatrix3x2fv(GLuint program, GLint location, GLsizei count,
8527 GLboolean transpose, const GLfloat *v)
8528 {
8529 GET_CURRENT_CONTEXT(ctx);
8530 Node *n;
8531 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8532 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX32F,
8533 4 + POINTER_DWORDS);
8534 if (n) {
8535 n[1].ui = program;
8536 n[2].i = location;
8537 n[3].i = count;
8538 n[4].b = transpose;
8539 save_pointer(&n[5], memdup(v, count * 3 * 2 * sizeof(GLfloat)));
8540 }
8541 if (ctx->ExecuteFlag) {
8542 CALL_ProgramUniformMatrix3x2fv(ctx->Exec,
8543 (program, location, count, transpose, v));
8544 }
8545 }
8546
8547 static void GLAPIENTRY
8548 save_ProgramUniformMatrix3fv(GLuint program, GLint location, GLsizei count,
8549 GLboolean transpose, const GLfloat *v)
8550 {
8551 GET_CURRENT_CONTEXT(ctx);
8552 Node *n;
8553 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8554 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX33F,
8555 4 + POINTER_DWORDS);
8556 if (n) {
8557 n[1].ui = program;
8558 n[2].i = location;
8559 n[3].i = count;
8560 n[4].b = transpose;
8561 save_pointer(&n[5], memdup(v, count * 3 * 3 * sizeof(GLfloat)));
8562 }
8563 if (ctx->ExecuteFlag) {
8564 CALL_ProgramUniformMatrix3fv(ctx->Exec,
8565 (program, location, count, transpose, v));
8566 }
8567 }
8568
8569 static void GLAPIENTRY
8570 save_ProgramUniformMatrix3x4fv(GLuint program, GLint location, GLsizei count,
8571 GLboolean transpose, const GLfloat *v)
8572 {
8573 GET_CURRENT_CONTEXT(ctx);
8574 Node *n;
8575 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8576 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX34F,
8577 4 + POINTER_DWORDS);
8578 if (n) {
8579 n[1].ui = program;
8580 n[2].i = location;
8581 n[3].i = count;
8582 n[4].b = transpose;
8583 save_pointer(&n[5], memdup(v, count * 3 * 4 * sizeof(GLfloat)));
8584 }
8585 if (ctx->ExecuteFlag) {
8586 CALL_ProgramUniformMatrix3x4fv(ctx->Exec,
8587 (program, location, count, transpose, v));
8588 }
8589 }
8590
8591 static void GLAPIENTRY
8592 save_ProgramUniformMatrix4x2fv(GLuint program, GLint location, GLsizei count,
8593 GLboolean transpose, const GLfloat *v)
8594 {
8595 GET_CURRENT_CONTEXT(ctx);
8596 Node *n;
8597 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8598 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX42F,
8599 4 + POINTER_DWORDS);
8600 if (n) {
8601 n[1].ui = program;
8602 n[2].i = location;
8603 n[3].i = count;
8604 n[4].b = transpose;
8605 save_pointer(&n[5], memdup(v, count * 4 * 2 * sizeof(GLfloat)));
8606 }
8607 if (ctx->ExecuteFlag) {
8608 CALL_ProgramUniformMatrix4x2fv(ctx->Exec,
8609 (program, location, count, transpose, v));
8610 }
8611 }
8612
8613 static void GLAPIENTRY
8614 save_ProgramUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count,
8615 GLboolean transpose, const GLfloat *v)
8616 {
8617 GET_CURRENT_CONTEXT(ctx);
8618 Node *n;
8619 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8620 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX43F,
8621 4 + POINTER_DWORDS);
8622 if (n) {
8623 n[1].ui = program;
8624 n[2].i = location;
8625 n[3].i = count;
8626 n[4].b = transpose;
8627 save_pointer(&n[5], memdup(v, count * 4 * 3 * sizeof(GLfloat)));
8628 }
8629 if (ctx->ExecuteFlag) {
8630 CALL_ProgramUniformMatrix4x3fv(ctx->Exec,
8631 (program, location, count, transpose, v));
8632 }
8633 }
8634
8635 static void GLAPIENTRY
8636 save_ProgramUniformMatrix4fv(GLuint program, GLint location, GLsizei count,
8637 GLboolean transpose, const GLfloat *v)
8638 {
8639 GET_CURRENT_CONTEXT(ctx);
8640 Node *n;
8641 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8642 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX44F,
8643 4 + POINTER_DWORDS);
8644 if (n) {
8645 n[1].ui = program;
8646 n[2].i = location;
8647 n[3].i = count;
8648 n[4].b = transpose;
8649 save_pointer(&n[5], memdup(v, count * 4 * 4 * sizeof(GLfloat)));
8650 }
8651 if (ctx->ExecuteFlag) {
8652 CALL_ProgramUniformMatrix4fv(ctx->Exec,
8653 (program, location, count, transpose, v));
8654 }
8655 }
8656
8657 static void GLAPIENTRY
8658 save_ProgramUniformMatrix2dv(GLuint program, GLint location, GLsizei count,
8659 GLboolean transpose, const GLdouble *v)
8660 {
8661 GET_CURRENT_CONTEXT(ctx);
8662 Node *n;
8663 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8664 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX22D,
8665 4 + POINTER_DWORDS);
8666 if (n) {
8667 n[1].ui = program;
8668 n[2].i = location;
8669 n[3].i = count;
8670 n[4].b = transpose;
8671 save_pointer(&n[5], memdup(v, count * 2 * 2 * sizeof(GLdouble)));
8672 }
8673 if (ctx->ExecuteFlag) {
8674 CALL_ProgramUniformMatrix2dv(ctx->Exec,
8675 (program, location, count, transpose, v));
8676 }
8677 }
8678
8679 static void GLAPIENTRY
8680 save_ProgramUniformMatrix2x3dv(GLuint program, GLint location, GLsizei count,
8681 GLboolean transpose, const GLdouble *v)
8682 {
8683 GET_CURRENT_CONTEXT(ctx);
8684 Node *n;
8685 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8686 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX23D,
8687 4 + POINTER_DWORDS);
8688 if (n) {
8689 n[1].ui = program;
8690 n[2].i = location;
8691 n[3].i = count;
8692 n[4].b = transpose;
8693 save_pointer(&n[5], memdup(v, count * 2 * 3 * sizeof(GLdouble)));
8694 }
8695 if (ctx->ExecuteFlag) {
8696 CALL_ProgramUniformMatrix2x3dv(ctx->Exec,
8697 (program, location, count, transpose, v));
8698 }
8699 }
8700
8701 static void GLAPIENTRY
8702 save_ProgramUniformMatrix2x4dv(GLuint program, GLint location, GLsizei count,
8703 GLboolean transpose, const GLdouble *v)
8704 {
8705 GET_CURRENT_CONTEXT(ctx);
8706 Node *n;
8707 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8708 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX24D,
8709 4 + POINTER_DWORDS);
8710 if (n) {
8711 n[1].ui = program;
8712 n[2].i = location;
8713 n[3].i = count;
8714 n[4].b = transpose;
8715 save_pointer(&n[5], memdup(v, count * 2 * 4 * sizeof(GLdouble)));
8716 }
8717 if (ctx->ExecuteFlag) {
8718 CALL_ProgramUniformMatrix2x4dv(ctx->Exec,
8719 (program, location, count, transpose, v));
8720 }
8721 }
8722
8723 static void GLAPIENTRY
8724 save_ProgramUniformMatrix3x2dv(GLuint program, GLint location, GLsizei count,
8725 GLboolean transpose, const GLdouble *v)
8726 {
8727 GET_CURRENT_CONTEXT(ctx);
8728 Node *n;
8729 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8730 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX32D,
8731 4 + POINTER_DWORDS);
8732 if (n) {
8733 n[1].ui = program;
8734 n[2].i = location;
8735 n[3].i = count;
8736 n[4].b = transpose;
8737 save_pointer(&n[5], memdup(v, count * 3 * 2 * sizeof(GLdouble)));
8738 }
8739 if (ctx->ExecuteFlag) {
8740 CALL_ProgramUniformMatrix3x2dv(ctx->Exec,
8741 (program, location, count, transpose, v));
8742 }
8743 }
8744
8745 static void GLAPIENTRY
8746 save_ProgramUniformMatrix3dv(GLuint program, GLint location, GLsizei count,
8747 GLboolean transpose, const GLdouble *v)
8748 {
8749 GET_CURRENT_CONTEXT(ctx);
8750 Node *n;
8751 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8752 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX33D,
8753 4 + POINTER_DWORDS);
8754 if (n) {
8755 n[1].ui = program;
8756 n[2].i = location;
8757 n[3].i = count;
8758 n[4].b = transpose;
8759 save_pointer(&n[5], memdup(v, count * 3 * 3 * sizeof(GLdouble)));
8760 }
8761 if (ctx->ExecuteFlag) {
8762 CALL_ProgramUniformMatrix3dv(ctx->Exec,
8763 (program, location, count, transpose, v));
8764 }
8765 }
8766
8767 static void GLAPIENTRY
8768 save_ProgramUniformMatrix3x4dv(GLuint program, GLint location, GLsizei count,
8769 GLboolean transpose, const GLdouble *v)
8770 {
8771 GET_CURRENT_CONTEXT(ctx);
8772 Node *n;
8773 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8774 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX34D,
8775 4 + POINTER_DWORDS);
8776 if (n) {
8777 n[1].ui = program;
8778 n[2].i = location;
8779 n[3].i = count;
8780 n[4].b = transpose;
8781 save_pointer(&n[5], memdup(v, count * 3 * 4 * sizeof(GLdouble)));
8782 }
8783 if (ctx->ExecuteFlag) {
8784 CALL_ProgramUniformMatrix3x4dv(ctx->Exec,
8785 (program, location, count, transpose, v));
8786 }
8787 }
8788
8789 static void GLAPIENTRY
8790 save_ProgramUniformMatrix4x2dv(GLuint program, GLint location, GLsizei count,
8791 GLboolean transpose, const GLdouble *v)
8792 {
8793 GET_CURRENT_CONTEXT(ctx);
8794 Node *n;
8795 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8796 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX42D,
8797 4 + POINTER_DWORDS);
8798 if (n) {
8799 n[1].ui = program;
8800 n[2].i = location;
8801 n[3].i = count;
8802 n[4].b = transpose;
8803 save_pointer(&n[5], memdup(v, count * 4 * 2 * sizeof(GLdouble)));
8804 }
8805 if (ctx->ExecuteFlag) {
8806 CALL_ProgramUniformMatrix4x2dv(ctx->Exec,
8807 (program, location, count, transpose, v));
8808 }
8809 }
8810
8811 static void GLAPIENTRY
8812 save_ProgramUniformMatrix4x3dv(GLuint program, GLint location, GLsizei count,
8813 GLboolean transpose, const GLdouble *v)
8814 {
8815 GET_CURRENT_CONTEXT(ctx);
8816 Node *n;
8817 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8818 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX43D,
8819 4 + POINTER_DWORDS);
8820 if (n) {
8821 n[1].ui = program;
8822 n[2].i = location;
8823 n[3].i = count;
8824 n[4].b = transpose;
8825 save_pointer(&n[5], memdup(v, count * 4 * 3 * sizeof(GLdouble)));
8826 }
8827 if (ctx->ExecuteFlag) {
8828 CALL_ProgramUniformMatrix4x3dv(ctx->Exec,
8829 (program, location, count, transpose, v));
8830 }
8831 }
8832
8833 static void GLAPIENTRY
8834 save_ProgramUniformMatrix4dv(GLuint program, GLint location, GLsizei count,
8835 GLboolean transpose, const GLdouble *v)
8836 {
8837 GET_CURRENT_CONTEXT(ctx);
8838 Node *n;
8839 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8840 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX44D,
8841 4 + POINTER_DWORDS);
8842 if (n) {
8843 n[1].ui = program;
8844 n[2].i = location;
8845 n[3].i = count;
8846 n[4].b = transpose;
8847 save_pointer(&n[5], memdup(v, count * 4 * 4 * sizeof(GLdouble)));
8848 }
8849 if (ctx->ExecuteFlag) {
8850 CALL_ProgramUniformMatrix4dv(ctx->Exec,
8851 (program, location, count, transpose, v));
8852 }
8853 }
8854
8855 static void GLAPIENTRY
8856 save_ClipControl(GLenum origin, GLenum depth)
8857 {
8858 GET_CURRENT_CONTEXT(ctx);
8859 Node *n;
8860 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8861 n = alloc_instruction(ctx, OPCODE_CLIP_CONTROL, 2);
8862 if (n) {
8863 n[1].e = origin;
8864 n[2].e = depth;
8865 }
8866 if (ctx->ExecuteFlag) {
8867 CALL_ClipControl(ctx->Exec, (origin, depth));
8868 }
8869 }
8870
8871 static void GLAPIENTRY
8872 save_ClampColorARB(GLenum target, GLenum clamp)
8873 {
8874 GET_CURRENT_CONTEXT(ctx);
8875 Node *n;
8876 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8877 n = alloc_instruction(ctx, OPCODE_CLAMP_COLOR, 2);
8878 if (n) {
8879 n[1].e = target;
8880 n[2].e = clamp;
8881 }
8882 if (ctx->ExecuteFlag) {
8883 CALL_ClampColor(ctx->Exec, (target, clamp));
8884 }
8885 }
8886
8887 /** GL_EXT_texture_integer */
8888 static void GLAPIENTRY
8889 save_ClearColorIi(GLint red, GLint green, GLint blue, GLint alpha)
8890 {
8891 GET_CURRENT_CONTEXT(ctx);
8892 Node *n;
8893 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8894 n = alloc_instruction(ctx, OPCODE_CLEARCOLOR_I, 4);
8895 if (n) {
8896 n[1].i = red;
8897 n[2].i = green;
8898 n[3].i = blue;
8899 n[4].i = alpha;
8900 }
8901 if (ctx->ExecuteFlag) {
8902 CALL_ClearColorIiEXT(ctx->Exec, (red, green, blue, alpha));
8903 }
8904 }
8905
8906 /** GL_EXT_texture_integer */
8907 static void GLAPIENTRY
8908 save_ClearColorIui(GLuint red, GLuint green, GLuint blue, GLuint alpha)
8909 {
8910 GET_CURRENT_CONTEXT(ctx);
8911 Node *n;
8912 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8913 n = alloc_instruction(ctx, OPCODE_CLEARCOLOR_UI, 4);
8914 if (n) {
8915 n[1].ui = red;
8916 n[2].ui = green;
8917 n[3].ui = blue;
8918 n[4].ui = alpha;
8919 }
8920 if (ctx->ExecuteFlag) {
8921 CALL_ClearColorIuiEXT(ctx->Exec, (red, green, blue, alpha));
8922 }
8923 }
8924
8925 /** GL_EXT_texture_integer */
8926 static void GLAPIENTRY
8927 save_TexParameterIiv(GLenum target, GLenum pname, const GLint *params)
8928 {
8929 GET_CURRENT_CONTEXT(ctx);
8930 Node *n;
8931 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8932 n = alloc_instruction(ctx, OPCODE_TEXPARAMETER_I, 6);
8933 if (n) {
8934 n[1].e = target;
8935 n[2].e = pname;
8936 n[3].i = params[0];
8937 n[4].i = params[1];
8938 n[5].i = params[2];
8939 n[6].i = params[3];
8940 }
8941 if (ctx->ExecuteFlag) {
8942 CALL_TexParameterIiv(ctx->Exec, (target, pname, params));
8943 }
8944 }
8945
8946 /** GL_EXT_texture_integer */
8947 static void GLAPIENTRY
8948 save_TexParameterIuiv(GLenum target, GLenum pname, const GLuint *params)
8949 {
8950 GET_CURRENT_CONTEXT(ctx);
8951 Node *n;
8952 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8953 n = alloc_instruction(ctx, OPCODE_TEXPARAMETER_UI, 6);
8954 if (n) {
8955 n[1].e = target;
8956 n[2].e = pname;
8957 n[3].ui = params[0];
8958 n[4].ui = params[1];
8959 n[5].ui = params[2];
8960 n[6].ui = params[3];
8961 }
8962 if (ctx->ExecuteFlag) {
8963 CALL_TexParameterIuiv(ctx->Exec, (target, pname, params));
8964 }
8965 }
8966
8967 /* GL_ARB_instanced_arrays */
8968 static void GLAPIENTRY
8969 save_VertexAttribDivisor(GLuint index, GLuint divisor)
8970 {
8971 GET_CURRENT_CONTEXT(ctx);
8972 Node *n;
8973 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8974 n = alloc_instruction(ctx, OPCODE_VERTEX_ATTRIB_DIVISOR, 2);
8975 if (n) {
8976 n[1].ui = index;
8977 n[2].ui = divisor;
8978 }
8979 if (ctx->ExecuteFlag) {
8980 CALL_VertexAttribDivisor(ctx->Exec, (index, divisor));
8981 }
8982 }
8983
8984
8985 /* GL_NV_texture_barrier */
8986 static void GLAPIENTRY
8987 save_TextureBarrierNV(void)
8988 {
8989 GET_CURRENT_CONTEXT(ctx);
8990 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8991 alloc_instruction(ctx, OPCODE_TEXTURE_BARRIER_NV, 0);
8992 if (ctx->ExecuteFlag) {
8993 CALL_TextureBarrierNV(ctx->Exec, ());
8994 }
8995 }
8996
8997
8998 /* GL_ARB_sampler_objects */
8999 static void GLAPIENTRY
9000 save_BindSampler(GLuint unit, GLuint sampler)
9001 {
9002 Node *n;
9003 GET_CURRENT_CONTEXT(ctx);
9004 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9005 n = alloc_instruction(ctx, OPCODE_BIND_SAMPLER, 2);
9006 if (n) {
9007 n[1].ui = unit;
9008 n[2].ui = sampler;
9009 }
9010 if (ctx->ExecuteFlag) {
9011 CALL_BindSampler(ctx->Exec, (unit, sampler));
9012 }
9013 }
9014
9015 static void GLAPIENTRY
9016 save_SamplerParameteriv(GLuint sampler, GLenum pname, const GLint *params)
9017 {
9018 Node *n;
9019 GET_CURRENT_CONTEXT(ctx);
9020 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9021 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERIV, 6);
9022 if (n) {
9023 n[1].ui = sampler;
9024 n[2].e = pname;
9025 n[3].i = params[0];
9026 if (pname == GL_TEXTURE_BORDER_COLOR) {
9027 n[4].i = params[1];
9028 n[5].i = params[2];
9029 n[6].i = params[3];
9030 }
9031 else {
9032 n[4].i = n[5].i = n[6].i = 0;
9033 }
9034 }
9035 if (ctx->ExecuteFlag) {
9036 CALL_SamplerParameteriv(ctx->Exec, (sampler, pname, params));
9037 }
9038 }
9039
9040 static void GLAPIENTRY
9041 save_SamplerParameteri(GLuint sampler, GLenum pname, GLint param)
9042 {
9043 GLint parray[4];
9044 parray[0] = param;
9045 parray[1] = parray[2] = parray[3] = 0;
9046 save_SamplerParameteriv(sampler, pname, parray);
9047 }
9048
9049 static void GLAPIENTRY
9050 save_SamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *params)
9051 {
9052 Node *n;
9053 GET_CURRENT_CONTEXT(ctx);
9054 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9055 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERFV, 6);
9056 if (n) {
9057 n[1].ui = sampler;
9058 n[2].e = pname;
9059 n[3].f = params[0];
9060 if (pname == GL_TEXTURE_BORDER_COLOR) {
9061 n[4].f = params[1];
9062 n[5].f = params[2];
9063 n[6].f = params[3];
9064 }
9065 else {
9066 n[4].f = n[5].f = n[6].f = 0.0F;
9067 }
9068 }
9069 if (ctx->ExecuteFlag) {
9070 CALL_SamplerParameterfv(ctx->Exec, (sampler, pname, params));
9071 }
9072 }
9073
9074 static void GLAPIENTRY
9075 save_SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
9076 {
9077 GLfloat parray[4];
9078 parray[0] = param;
9079 parray[1] = parray[2] = parray[3] = 0.0F;
9080 save_SamplerParameterfv(sampler, pname, parray);
9081 }
9082
9083 static void GLAPIENTRY
9084 save_SamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *params)
9085 {
9086 Node *n;
9087 GET_CURRENT_CONTEXT(ctx);
9088 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9089 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERIIV, 6);
9090 if (n) {
9091 n[1].ui = sampler;
9092 n[2].e = pname;
9093 n[3].i = params[0];
9094 if (pname == GL_TEXTURE_BORDER_COLOR) {
9095 n[4].i = params[1];
9096 n[5].i = params[2];
9097 n[6].i = params[3];
9098 }
9099 else {
9100 n[4].i = n[5].i = n[6].i = 0;
9101 }
9102 }
9103 if (ctx->ExecuteFlag) {
9104 CALL_SamplerParameterIiv(ctx->Exec, (sampler, pname, params));
9105 }
9106 }
9107
9108 static void GLAPIENTRY
9109 save_SamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *params)
9110 {
9111 Node *n;
9112 GET_CURRENT_CONTEXT(ctx);
9113 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9114 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERUIV, 6);
9115 if (n) {
9116 n[1].ui = sampler;
9117 n[2].e = pname;
9118 n[3].ui = params[0];
9119 if (pname == GL_TEXTURE_BORDER_COLOR) {
9120 n[4].ui = params[1];
9121 n[5].ui = params[2];
9122 n[6].ui = params[3];
9123 }
9124 else {
9125 n[4].ui = n[5].ui = n[6].ui = 0;
9126 }
9127 }
9128 if (ctx->ExecuteFlag) {
9129 CALL_SamplerParameterIuiv(ctx->Exec, (sampler, pname, params));
9130 }
9131 }
9132
9133 static void GLAPIENTRY
9134 save_WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
9135 {
9136 Node *n;
9137 GET_CURRENT_CONTEXT(ctx);
9138 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9139 n = alloc_instruction(ctx, OPCODE_WAIT_SYNC, 4);
9140 if (n) {
9141 union uint64_pair p;
9142 p.uint64 = timeout;
9143 n[1].bf = flags;
9144 n[2].ui = p.uint32[0];
9145 n[3].ui = p.uint32[1];
9146 save_pointer(&n[4], sync);
9147 }
9148 if (ctx->ExecuteFlag) {
9149 CALL_WaitSync(ctx->Exec, (sync, flags, timeout));
9150 }
9151 }
9152
9153
9154 /** GL_NV_conditional_render */
9155 static void GLAPIENTRY
9156 save_BeginConditionalRender(GLuint queryId, GLenum mode)
9157 {
9158 GET_CURRENT_CONTEXT(ctx);
9159 Node *n;
9160 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9161 n = alloc_instruction(ctx, OPCODE_BEGIN_CONDITIONAL_RENDER, 2);
9162 if (n) {
9163 n[1].i = queryId;
9164 n[2].e = mode;
9165 }
9166 if (ctx->ExecuteFlag) {
9167 CALL_BeginConditionalRender(ctx->Exec, (queryId, mode));
9168 }
9169 }
9170
9171 static void GLAPIENTRY
9172 save_EndConditionalRender(void)
9173 {
9174 GET_CURRENT_CONTEXT(ctx);
9175 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9176 alloc_instruction(ctx, OPCODE_END_CONDITIONAL_RENDER, 0);
9177 if (ctx->ExecuteFlag) {
9178 CALL_EndConditionalRender(ctx->Exec, ());
9179 }
9180 }
9181
9182 static void GLAPIENTRY
9183 save_UniformBlockBinding(GLuint prog, GLuint index, GLuint binding)
9184 {
9185 GET_CURRENT_CONTEXT(ctx);
9186 Node *n;
9187 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9188 n = alloc_instruction(ctx, OPCODE_UNIFORM_BLOCK_BINDING, 3);
9189 if (n) {
9190 n[1].ui = prog;
9191 n[2].ui = index;
9192 n[3].ui = binding;
9193 }
9194 if (ctx->ExecuteFlag) {
9195 CALL_UniformBlockBinding(ctx->Exec, (prog, index, binding));
9196 }
9197 }
9198
9199 static void GLAPIENTRY
9200 save_UniformSubroutinesuiv(GLenum shadertype, GLsizei count,
9201 const GLuint *indices)
9202 {
9203 GET_CURRENT_CONTEXT(ctx);
9204 Node *n;
9205 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9206 n = alloc_instruction(ctx, OPCODE_UNIFORM_SUBROUTINES, 2 + POINTER_DWORDS);
9207 if (n) {
9208 GLint *indices_copy = NULL;
9209
9210 if (count > 0)
9211 indices_copy = memdup(indices, sizeof(GLuint) * 4 * count);
9212 n[1].e = shadertype;
9213 n[2].si = count;
9214 save_pointer(&n[3], indices_copy);
9215 }
9216 if (ctx->ExecuteFlag) {
9217 CALL_UniformSubroutinesuiv(ctx->Exec, (shadertype, count, indices));
9218 }
9219 }
9220
9221 /** GL_EXT_window_rectangles */
9222 static void GLAPIENTRY
9223 save_WindowRectanglesEXT(GLenum mode, GLsizei count, const GLint *box)
9224 {
9225 GET_CURRENT_CONTEXT(ctx);
9226 Node *n;
9227 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9228 n = alloc_instruction(ctx, OPCODE_WINDOW_RECTANGLES, 2 + POINTER_DWORDS);
9229 if (n) {
9230 GLint *box_copy = NULL;
9231
9232 if (count > 0)
9233 box_copy = memdup(box, sizeof(GLint) * 4 * count);
9234 n[1].e = mode;
9235 n[2].si = count;
9236 save_pointer(&n[3], box_copy);
9237 }
9238 if (ctx->ExecuteFlag) {
9239 CALL_WindowRectanglesEXT(ctx->Exec, (mode, count, box));
9240 }
9241 }
9242
9243
9244 /** GL_NV_conservative_raster */
9245 static void GLAPIENTRY
9246 save_SubpixelPrecisionBiasNV(GLuint xbits, GLuint ybits)
9247 {
9248 GET_CURRENT_CONTEXT(ctx);
9249 Node *n;
9250 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9251 n = alloc_instruction(ctx, OPCODE_SUBPIXEL_PRECISION_BIAS, 2);
9252 if (n) {
9253 n[1].ui = xbits;
9254 n[2].ui = ybits;
9255 }
9256 if (ctx->ExecuteFlag) {
9257 CALL_SubpixelPrecisionBiasNV(ctx->Exec, (xbits, ybits));
9258 }
9259 }
9260
9261 /** GL_NV_conservative_raster_dilate */
9262 static void GLAPIENTRY
9263 save_ConservativeRasterParameterfNV(GLenum pname, GLfloat param)
9264 {
9265 GET_CURRENT_CONTEXT(ctx);
9266 Node *n;
9267 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9268 n = alloc_instruction(ctx, OPCODE_CONSERVATIVE_RASTER_PARAMETER_F, 2);
9269 if (n) {
9270 n[1].e = pname;
9271 n[2].f = param;
9272 }
9273 if (ctx->ExecuteFlag) {
9274 CALL_ConservativeRasterParameterfNV(ctx->Exec, (pname, param));
9275 }
9276 }
9277
9278 /** GL_NV_conservative_raster_pre_snap_triangles */
9279 static void GLAPIENTRY
9280 save_ConservativeRasterParameteriNV(GLenum pname, GLint param)
9281 {
9282 GET_CURRENT_CONTEXT(ctx);
9283 Node *n;
9284 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9285 n = alloc_instruction(ctx, OPCODE_CONSERVATIVE_RASTER_PARAMETER_I, 2);
9286 if (n) {
9287 n[1].e = pname;
9288 n[2].i = param;
9289 }
9290 if (ctx->ExecuteFlag) {
9291 CALL_ConservativeRasterParameteriNV(ctx->Exec, (pname, param));
9292 }
9293 }
9294
9295 /** GL_EXT_direct_state_access */
9296
9297 static void GLAPIENTRY
9298 save_MatrixLoadfEXT(GLenum matrixMode, const GLfloat *m)
9299 {
9300 GET_CURRENT_CONTEXT(ctx);
9301 Node *n;
9302 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9303 n = alloc_instruction(ctx, OPCODE_MATRIX_LOAD, 17);
9304 if (n) {
9305 n[1].e = matrixMode;
9306 for (unsigned i = 0; i < 16; i++) {
9307 n[2 + i].f = m[i];
9308 }
9309 }
9310 if (ctx->ExecuteFlag) {
9311 CALL_MatrixLoadfEXT(ctx->Exec, (matrixMode, m));
9312 }
9313 }
9314
9315 static void GLAPIENTRY
9316 save_MatrixLoaddEXT(GLenum matrixMode, const GLdouble *m)
9317 {
9318 GLfloat f[16];
9319 for (unsigned i = 0; i < 16; i++) {
9320 f[i] = (GLfloat) m[i];
9321 }
9322 save_MatrixLoadfEXT(matrixMode, f);
9323 }
9324
9325 static void GLAPIENTRY
9326 save_MatrixMultfEXT(GLenum matrixMode, const GLfloat * m)
9327 {
9328 GET_CURRENT_CONTEXT(ctx);
9329 Node *n;
9330 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9331 n = alloc_instruction(ctx, OPCODE_MATRIX_MULT, 17);
9332 if (n) {
9333 n[1].e = matrixMode;
9334 for (unsigned i = 0; i < 16; i++) {
9335 n[2 + i].f = m[i];
9336 }
9337 }
9338 if (ctx->ExecuteFlag) {
9339 CALL_MatrixMultfEXT(ctx->Exec, (matrixMode, m));
9340 }
9341 }
9342
9343 static void GLAPIENTRY
9344 save_MatrixMultdEXT(GLenum matrixMode, const GLdouble * m)
9345 {
9346 GLfloat f[16];
9347 for (unsigned i = 0; i < 16; i++) {
9348 f[i] = (GLfloat) m[i];
9349 }
9350 save_MatrixMultfEXT(matrixMode, f);
9351 }
9352
9353 static void GLAPIENTRY
9354 save_MatrixRotatefEXT(GLenum matrixMode, GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
9355 {
9356 GET_CURRENT_CONTEXT(ctx);
9357 Node *n;
9358 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9359 n = alloc_instruction(ctx, OPCODE_MATRIX_ROTATE, 5);
9360 if (n) {
9361 n[1].e = matrixMode;
9362 n[2].f = angle;
9363 n[3].f = x;
9364 n[4].f = y;
9365 n[5].f = z;
9366 }
9367 if (ctx->ExecuteFlag) {
9368 CALL_MatrixRotatefEXT(ctx->Exec, (matrixMode, angle, x, y, z));
9369 }
9370 }
9371
9372 static void GLAPIENTRY
9373 save_MatrixRotatedEXT(GLenum matrixMode, GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
9374 {
9375 save_MatrixRotatefEXT(matrixMode, (GLfloat) angle, (GLfloat) x, (GLfloat) y, (GLfloat) z);
9376 }
9377
9378 static void GLAPIENTRY
9379 save_MatrixScalefEXT(GLenum matrixMode, GLfloat x, GLfloat y, GLfloat z)
9380 {
9381 GET_CURRENT_CONTEXT(ctx);
9382 Node *n;
9383 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9384 n = alloc_instruction(ctx, OPCODE_MATRIX_SCALE, 4);
9385 if (n) {
9386 n[1].e = matrixMode;
9387 n[2].f = x;
9388 n[3].f = y;
9389 n[4].f = z;
9390 }
9391 if (ctx->ExecuteFlag) {
9392 CALL_MatrixScalefEXT(ctx->Exec, (matrixMode, x, y, z));
9393 }
9394 }
9395
9396 static void GLAPIENTRY
9397 save_MatrixScaledEXT(GLenum matrixMode, GLdouble x, GLdouble y, GLdouble z)
9398 {
9399 save_MatrixScalefEXT(matrixMode, (GLfloat) x, (GLfloat) y, (GLfloat) z);
9400 }
9401
9402 static void GLAPIENTRY
9403 save_MatrixTranslatefEXT(GLenum matrixMode, GLfloat x, GLfloat y, GLfloat z)
9404 {
9405 GET_CURRENT_CONTEXT(ctx);
9406 Node *n;
9407 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9408 n = alloc_instruction(ctx, OPCODE_MATRIX_TRANSLATE, 4);
9409 if (n) {
9410 n[1].e = matrixMode;
9411 n[2].f = x;
9412 n[3].f = y;
9413 n[4].f = z;
9414 }
9415 if (ctx->ExecuteFlag) {
9416 CALL_MatrixTranslatefEXT(ctx->Exec, (matrixMode, x, y, z));
9417 }
9418 }
9419
9420 static void GLAPIENTRY
9421 save_MatrixTranslatedEXT(GLenum matrixMode, GLdouble x, GLdouble y, GLdouble z)
9422 {
9423 save_MatrixTranslatefEXT(matrixMode, (GLfloat) x, (GLfloat) y, (GLfloat) z);
9424 }
9425
9426 static void GLAPIENTRY
9427 save_MatrixLoadIdentityEXT(GLenum matrixMode)
9428 {
9429 GET_CURRENT_CONTEXT(ctx);
9430 Node *n;
9431 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9432 n = alloc_instruction(ctx, OPCODE_MATRIX_LOAD_IDENTITY, 1);
9433 if (n) {
9434 n[1].e = matrixMode;
9435 }
9436 if (ctx->ExecuteFlag) {
9437 CALL_MatrixLoadIdentityEXT(ctx->Exec, (matrixMode));
9438 }
9439 }
9440
9441 static void GLAPIENTRY
9442 save_MatrixOrthoEXT(GLenum matrixMode, GLdouble left, GLdouble right,
9443 GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval)
9444 {
9445 GET_CURRENT_CONTEXT(ctx);
9446 Node *n;
9447 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9448 n = alloc_instruction(ctx, OPCODE_MATRIX_ORTHO, 7);
9449 if (n) {
9450 n[1].e = matrixMode;
9451 n[2].f = (GLfloat) left;
9452 n[3].f = (GLfloat) right;
9453 n[4].f = (GLfloat) bottom;
9454 n[5].f = (GLfloat) top;
9455 n[6].f = (GLfloat) nearval;
9456 n[7].f = (GLfloat) farval;
9457 }
9458 if (ctx->ExecuteFlag) {
9459 CALL_MatrixOrthoEXT(ctx->Exec, (matrixMode, left, right, bottom, top, nearval, farval));
9460 }
9461 }
9462
9463
9464 static void GLAPIENTRY
9465 save_MatrixFrustumEXT(GLenum matrixMode, GLdouble left, GLdouble right,
9466 GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval)
9467 {
9468 GET_CURRENT_CONTEXT(ctx);
9469 Node *n;
9470 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9471 n = alloc_instruction(ctx, OPCODE_MATRIX_FRUSTUM, 7);
9472 if (n) {
9473 n[1].e = matrixMode;
9474 n[2].f = (GLfloat) left;
9475 n[3].f = (GLfloat) right;
9476 n[4].f = (GLfloat) bottom;
9477 n[5].f = (GLfloat) top;
9478 n[6].f = (GLfloat) nearval;
9479 n[7].f = (GLfloat) farval;
9480 }
9481 if (ctx->ExecuteFlag) {
9482 CALL_MatrixFrustumEXT(ctx->Exec, (matrixMode, left, right, bottom, top, nearval, farval));
9483 }
9484 }
9485
9486 static void GLAPIENTRY
9487 save_MatrixPushEXT(GLenum matrixMode)
9488 {
9489 GET_CURRENT_CONTEXT(ctx);
9490 Node* n;
9491 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9492 n = alloc_instruction(ctx, OPCODE_MATRIX_PUSH, 1);
9493 if (n) {
9494 n[1].e = matrixMode;
9495 }
9496 if (ctx->ExecuteFlag) {
9497 CALL_MatrixPushEXT(ctx->Exec, (matrixMode));
9498 }
9499 }
9500
9501 static void GLAPIENTRY
9502 save_MatrixPopEXT(GLenum matrixMode)
9503 {
9504 GET_CURRENT_CONTEXT(ctx);
9505 Node* n;
9506 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9507 n = alloc_instruction(ctx, OPCODE_MATRIX_POP, 1);
9508 if (n) {
9509 n[1].e = matrixMode;
9510 }
9511 if (ctx->ExecuteFlag) {
9512 CALL_MatrixPopEXT(ctx->Exec, (matrixMode));
9513 }
9514 }
9515
9516 static void GLAPIENTRY
9517 save_MatrixLoadTransposefEXT(GLenum matrixMode, const GLfloat m[16])
9518 {
9519 GLfloat tm[16];
9520 _math_transposef(tm, m);
9521 save_MatrixLoadfEXT(matrixMode, tm);
9522 }
9523
9524 static void GLAPIENTRY
9525 save_MatrixLoadTransposedEXT(GLenum matrixMode, const GLdouble m[16])
9526 {
9527 GLfloat tm[16];
9528 _math_transposefd(tm, m);
9529 save_MatrixLoadfEXT(matrixMode, tm);
9530 }
9531
9532 static void GLAPIENTRY
9533 save_MatrixMultTransposefEXT(GLenum matrixMode, const GLfloat m[16])
9534 {
9535 GLfloat tm[16];
9536 _math_transposef(tm, m);
9537 save_MatrixMultfEXT(matrixMode, tm);
9538 }
9539
9540 static void GLAPIENTRY
9541 save_MatrixMultTransposedEXT(GLenum matrixMode, const GLdouble m[16])
9542 {
9543 GLfloat tm[16];
9544 _math_transposefd(tm, m);
9545 save_MatrixMultfEXT(matrixMode, tm);
9546 }
9547
9548 static void GLAPIENTRY
9549 save_TextureParameterfvEXT(GLuint texture, GLenum target, GLenum pname,
9550 const GLfloat *params)
9551 {
9552 GET_CURRENT_CONTEXT(ctx);
9553 Node *n;
9554 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9555 n = alloc_instruction(ctx, OPCODE_TEXTUREPARAMETER_F, 7);
9556 if (n) {
9557 n[1].ui = texture;
9558 n[2].e = target;
9559 n[3].e = pname;
9560 n[4].f = params[0];
9561 n[5].f = params[1];
9562 n[6].f = params[2];
9563 n[7].f = params[3];
9564 }
9565 if (ctx->ExecuteFlag) {
9566 CALL_TextureParameterfvEXT(ctx->Exec, (texture, target, pname, params));
9567 }
9568 }
9569
9570
9571 static void GLAPIENTRY
9572 save_TextureParameterfEXT(GLuint texture, GLenum target, GLenum pname, GLfloat param)
9573 {
9574 GLfloat parray[4];
9575 parray[0] = param;
9576 parray[1] = parray[2] = parray[3] = 0.0F;
9577 save_TextureParameterfvEXT(texture, target, pname, parray);
9578 }
9579
9580 static void GLAPIENTRY
9581 save_TextureParameterivEXT(GLuint texture, GLenum target, GLenum pname, const GLint *params)
9582 {
9583 GET_CURRENT_CONTEXT(ctx);
9584 Node *n;
9585 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9586 n = alloc_instruction(ctx, OPCODE_TEXTUREPARAMETER_I, 7);
9587 if (n) {
9588 n[1].ui = texture;
9589 n[2].e = target;
9590 n[3].e = pname;
9591 n[4].i = params[0];
9592 n[5].i = params[1];
9593 n[6].i = params[2];
9594 n[7].i = params[3];
9595 }
9596 if (ctx->ExecuteFlag) {
9597 CALL_TextureParameterivEXT(ctx->Exec, (texture, target, pname, params));
9598 }
9599 }
9600
9601 static void GLAPIENTRY
9602 save_TextureParameteriEXT(GLuint texture, GLenum target, GLenum pname, GLint param)
9603 {
9604 GLint fparam[4];
9605 fparam[0] = param;
9606 fparam[1] = fparam[2] = fparam[3] = 0;
9607 save_TextureParameterivEXT(texture, target, pname, fparam);
9608 }
9609
9610 static void GLAPIENTRY
9611 save_TextureImage1DEXT(GLuint texture, GLenum target,
9612 GLint level, GLint components,
9613 GLsizei width, GLint border,
9614 GLenum format, GLenum type, const GLvoid * pixels)
9615 {
9616 GET_CURRENT_CONTEXT(ctx);
9617 if (target == GL_PROXY_TEXTURE_1D) {
9618 /* don't compile, execute immediately */
9619 CALL_TextureImage1DEXT(ctx->Exec, (texture, target, level, components, width,
9620 border, format, type, pixels));
9621 }
9622 else {
9623 Node *n;
9624 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9625 n = alloc_instruction(ctx, OPCODE_TEXTURE_IMAGE1D, 8 + POINTER_DWORDS);
9626 if (n) {
9627 n[1].ui = texture;
9628 n[2].e = target;
9629 n[3].i = level;
9630 n[4].i = components;
9631 n[5].i = (GLint) width;
9632 n[6].i = border;
9633 n[7].e = format;
9634 n[8].e = type;
9635 save_pointer(&n[9],
9636 unpack_image(ctx, 1, width, 1, 1, format, type,
9637 pixels, &ctx->Unpack));
9638 }
9639 if (ctx->ExecuteFlag) {
9640 CALL_TextureImage1DEXT(ctx->Exec, (texture, target, level, components, width,
9641 border, format, type, pixels));
9642 }
9643 }
9644 }
9645
9646
9647 static void GLAPIENTRY
9648 save_TextureImage2DEXT(GLuint texture, GLenum target,
9649 GLint level, GLint components,
9650 GLsizei width, GLsizei height, GLint border,
9651 GLenum format, GLenum type, const GLvoid * pixels)
9652 {
9653 GET_CURRENT_CONTEXT(ctx);
9654 if (target == GL_PROXY_TEXTURE_2D) {
9655 /* don't compile, execute immediately */
9656 CALL_TextureImage2DEXT(ctx->Exec, (texture, target, level, components, width,
9657 height, border, format, type, pixels));
9658 }
9659 else {
9660 Node *n;
9661 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9662 n = alloc_instruction(ctx, OPCODE_TEXTURE_IMAGE2D, 9 + POINTER_DWORDS);
9663 if (n) {
9664 n[1].ui = texture;
9665 n[2].e = target;
9666 n[3].i = level;
9667 n[4].i = components;
9668 n[5].i = (GLint) width;
9669 n[6].i = (GLint) height;
9670 n[7].i = border;
9671 n[8].e = format;
9672 n[9].e = type;
9673 save_pointer(&n[10],
9674 unpack_image(ctx, 2, width, height, 1, format, type,
9675 pixels, &ctx->Unpack));
9676 }
9677 if (ctx->ExecuteFlag) {
9678 CALL_TextureImage2DEXT(ctx->Exec, (texture, target, level, components, width,
9679 height, border, format, type, pixels));
9680 }
9681 }
9682 }
9683
9684
9685 static void GLAPIENTRY
9686 save_TextureImage3DEXT(GLuint texture, GLenum target,
9687 GLint level, GLint internalFormat,
9688 GLsizei width, GLsizei height, GLsizei depth,
9689 GLint border,
9690 GLenum format, GLenum type, const GLvoid * pixels)
9691 {
9692 GET_CURRENT_CONTEXT(ctx);
9693 if (target == GL_PROXY_TEXTURE_3D) {
9694 /* don't compile, execute immediately */
9695 CALL_TextureImage3DEXT(ctx->Exec, (texture, target, level, internalFormat, width,
9696 height, depth, border, format, type,
9697 pixels));
9698 }
9699 else {
9700 Node *n;
9701 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9702 n = alloc_instruction(ctx, OPCODE_TEXTURE_IMAGE3D, 10 + POINTER_DWORDS);
9703 if (n) {
9704 n[1].ui = texture;
9705 n[2].e = target;
9706 n[3].i = level;
9707 n[4].i = (GLint) internalFormat;
9708 n[5].i = (GLint) width;
9709 n[6].i = (GLint) height;
9710 n[7].i = (GLint) depth;
9711 n[8].i = border;
9712 n[9].e = format;
9713 n[10].e = type;
9714 save_pointer(&n[11],
9715 unpack_image(ctx, 3, width, height, depth, format, type,
9716 pixels, &ctx->Unpack));
9717 }
9718 if (ctx->ExecuteFlag) {
9719 CALL_TextureImage3DEXT(ctx->Exec, (texture, target, level, internalFormat,
9720 width, height, depth, border, format,
9721 type, pixels));
9722 }
9723 }
9724 }
9725
9726
9727 static void GLAPIENTRY
9728 save_TextureSubImage1DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset,
9729 GLsizei width, GLenum format, GLenum type,
9730 const GLvoid * pixels)
9731 {
9732 GET_CURRENT_CONTEXT(ctx);
9733 Node *n;
9734
9735 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9736
9737 n = alloc_instruction(ctx, OPCODE_TEXTURE_SUB_IMAGE1D, 7 + POINTER_DWORDS);
9738 if (n) {
9739 n[1].ui = texture;
9740 n[2].e = target;
9741 n[3].i = level;
9742 n[4].i = xoffset;
9743 n[5].i = (GLint) width;
9744 n[6].e = format;
9745 n[7].e = type;
9746 save_pointer(&n[8],
9747 unpack_image(ctx, 1, width, 1, 1, format, type,
9748 pixels, &ctx->Unpack));
9749 }
9750 if (ctx->ExecuteFlag) {
9751 CALL_TextureSubImage1DEXT(ctx->Exec, (texture, target, level, xoffset, width,
9752 format, type, pixels));
9753 }
9754 }
9755
9756
9757 static void GLAPIENTRY
9758 save_TextureSubImage2DEXT(GLuint texture, GLenum target, GLint level,
9759 GLint xoffset, GLint yoffset,
9760 GLsizei width, GLsizei height,
9761 GLenum format, GLenum type, const GLvoid * pixels)
9762 {
9763 GET_CURRENT_CONTEXT(ctx);
9764 Node *n;
9765
9766 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9767
9768 n = alloc_instruction(ctx, OPCODE_TEXTURE_SUB_IMAGE2D, 9 + POINTER_DWORDS);
9769 if (n) {
9770 n[1].ui = texture;
9771 n[2].e = target;
9772 n[3].i = level;
9773 n[4].i = xoffset;
9774 n[5].i = yoffset;
9775 n[6].i = (GLint) width;
9776 n[7].i = (GLint) height;
9777 n[8].e = format;
9778 n[9].e = type;
9779 save_pointer(&n[10],
9780 unpack_image(ctx, 2, width, height, 1, format, type,
9781 pixels, &ctx->Unpack));
9782 }
9783 if (ctx->ExecuteFlag) {
9784 CALL_TextureSubImage2DEXT(ctx->Exec, (texture, target, level, xoffset, yoffset,
9785 width, height, format, type, pixels));
9786 }
9787 }
9788
9789
9790 static void GLAPIENTRY
9791 save_TextureSubImage3DEXT(GLuint texture, GLenum target, GLint level,
9792 GLint xoffset, GLint yoffset, GLint zoffset,
9793 GLsizei width, GLsizei height, GLsizei depth,
9794 GLenum format, GLenum type, const GLvoid * pixels)
9795 {
9796 GET_CURRENT_CONTEXT(ctx);
9797 Node *n;
9798
9799 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9800
9801 n = alloc_instruction(ctx, OPCODE_TEXTURE_SUB_IMAGE3D, 11 + POINTER_DWORDS);
9802 if (n) {
9803 n[1].ui = texture;
9804 n[2].e = target;
9805 n[3].i = level;
9806 n[4].i = xoffset;
9807 n[5].i = yoffset;
9808 n[6].i = zoffset;
9809 n[7].i = (GLint) width;
9810 n[8].i = (GLint) height;
9811 n[9].i = (GLint) depth;
9812 n[10].e = format;
9813 n[11].e = type;
9814 save_pointer(&n[12],
9815 unpack_image(ctx, 3, width, height, depth, format, type,
9816 pixels, &ctx->Unpack));
9817 }
9818 if (ctx->ExecuteFlag) {
9819 CALL_TextureSubImage3DEXT(ctx->Exec, (texture, target, level,
9820 xoffset, yoffset, zoffset,
9821 width, height, depth, format, type,
9822 pixels));
9823 }
9824 }
9825
9826 static void GLAPIENTRY
9827 save_CopyTextureImage1DEXT(GLuint texture, GLenum target, GLint level,
9828 GLenum internalformat, GLint x, GLint y,
9829 GLsizei width, GLint border)
9830 {
9831 GET_CURRENT_CONTEXT(ctx);
9832 Node *n;
9833 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9834 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_IMAGE1D, 8);
9835 if (n) {
9836 n[1].ui = texture;
9837 n[2].e = target;
9838 n[3].i = level;
9839 n[4].e = internalformat;
9840 n[5].i = x;
9841 n[6].i = y;
9842 n[7].i = width;
9843 n[8].i = border;
9844 }
9845 if (ctx->ExecuteFlag) {
9846 CALL_CopyTextureImage1DEXT(ctx->Exec, (texture, target, level,
9847 internalformat, x, y,
9848 width, border));
9849 }
9850 }
9851
9852 static void GLAPIENTRY
9853 save_CopyTextureImage2DEXT(GLuint texture, GLenum target, GLint level,
9854 GLenum internalformat,
9855 GLint x, GLint y, GLsizei width,
9856 GLsizei height, GLint border)
9857 {
9858 GET_CURRENT_CONTEXT(ctx);
9859 Node *n;
9860 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9861 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_IMAGE2D, 9);
9862 if (n) {
9863 n[1].ui = texture;
9864 n[2].e = target;
9865 n[3].i = level;
9866 n[4].e = internalformat;
9867 n[5].i = x;
9868 n[6].i = y;
9869 n[7].i = width;
9870 n[8].i = height;
9871 n[9].i = border;
9872 }
9873 if (ctx->ExecuteFlag) {
9874 CALL_CopyTextureImage2DEXT(ctx->Exec, (texture, target, level,
9875 internalformat, x, y,
9876 width, height, border));
9877 }
9878 }
9879
9880 static void GLAPIENTRY
9881 save_CopyTextureSubImage1DEXT(GLuint texture, GLenum target, GLint level,
9882 GLint xoffset, GLint x, GLint y, GLsizei width)
9883 {
9884 GET_CURRENT_CONTEXT(ctx);
9885 Node *n;
9886 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9887 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_SUB_IMAGE1D, 7);
9888 if (n) {
9889 n[1].ui = texture;
9890 n[2].e = target;
9891 n[3].i = level;
9892 n[4].i = xoffset;
9893 n[5].i = x;
9894 n[6].i = y;
9895 n[7].i = width;
9896 }
9897 if (ctx->ExecuteFlag) {
9898 CALL_CopyTextureSubImage1DEXT(ctx->Exec,
9899 (texture, target, level, xoffset, x, y, width));
9900 }
9901 }
9902
9903 static void GLAPIENTRY
9904 save_CopyTextureSubImage2DEXT(GLuint texture, GLenum target, GLint level,
9905 GLint xoffset, GLint yoffset,
9906 GLint x, GLint y, GLsizei width, GLint height)
9907 {
9908 GET_CURRENT_CONTEXT(ctx);
9909 Node *n;
9910 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9911 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_SUB_IMAGE2D, 9);
9912 if (n) {
9913 n[1].ui = texture;
9914 n[2].e = target;
9915 n[3].i = level;
9916 n[4].i = xoffset;
9917 n[5].i = yoffset;
9918 n[6].i = x;
9919 n[7].i = y;
9920 n[8].i = width;
9921 n[9].i = height;
9922 }
9923 if (ctx->ExecuteFlag) {
9924 CALL_CopyTextureSubImage2DEXT(ctx->Exec, (texture, target, level,
9925 xoffset, yoffset,
9926 x, y, width, height));
9927 }
9928 }
9929
9930
9931 static void GLAPIENTRY
9932 save_CopyTextureSubImage3DEXT(GLuint texture, GLenum target, GLint level,
9933 GLint xoffset, GLint yoffset, GLint zoffset,
9934 GLint x, GLint y, GLsizei width, GLint height)
9935 {
9936 GET_CURRENT_CONTEXT(ctx);
9937 Node *n;
9938 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9939 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_SUB_IMAGE3D, 10);
9940 if (n) {
9941 n[1].ui = texture;
9942 n[2].e = target;
9943 n[3].i = level;
9944 n[4].i = xoffset;
9945 n[5].i = yoffset;
9946 n[6].i = zoffset;
9947 n[7].i = x;
9948 n[8].i = y;
9949 n[9].i = width;
9950 n[10].i = height;
9951 }
9952 if (ctx->ExecuteFlag) {
9953 CALL_CopyTextureSubImage3DEXT(ctx->Exec, (texture, target, level,
9954 xoffset, yoffset, zoffset,
9955 x, y, width, height));
9956 }
9957 }
9958
9959
9960 static void GLAPIENTRY
9961 save_BindMultiTextureEXT(GLenum texunit, GLenum target, GLuint texture)
9962 {
9963 GET_CURRENT_CONTEXT(ctx);
9964 Node *n;
9965 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9966 n = alloc_instruction(ctx, OPCODE_BIND_MULTITEXTURE, 3);
9967 if (n) {
9968 n[1].e = texunit;
9969 n[2].e = target;
9970 n[3].ui = texture;
9971 }
9972 if (ctx->ExecuteFlag) {
9973 CALL_BindMultiTextureEXT(ctx->Exec, (texunit, target, texture));
9974 }
9975 }
9976
9977
9978 static void GLAPIENTRY
9979 save_MultiTexParameterfvEXT(GLenum texunit, GLenum target, GLenum pname,
9980 const GLfloat *params)
9981 {
9982 GET_CURRENT_CONTEXT(ctx);
9983 Node *n;
9984 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9985 n = alloc_instruction(ctx, OPCODE_MULTITEXPARAMETER_F, 7);
9986 if (n) {
9987 n[1].e = texunit;
9988 n[2].e = target;
9989 n[3].e = pname;
9990 n[4].f = params[0];
9991 n[5].f = params[1];
9992 n[6].f = params[2];
9993 n[7].f = params[3];
9994 }
9995 if (ctx->ExecuteFlag) {
9996 CALL_MultiTexParameterfvEXT(ctx->Exec, (texunit, target, pname, params));
9997 }
9998 }
9999
10000
10001 static void GLAPIENTRY
10002 save_MultiTexParameterfEXT(GLenum texunit, GLenum target, GLenum pname, GLfloat param)
10003 {
10004 GLfloat parray[4];
10005 parray[0] = param;
10006 parray[1] = parray[2] = parray[3] = 0.0F;
10007 save_MultiTexParameterfvEXT(texunit, target, pname, parray);
10008 }
10009
10010 static void GLAPIENTRY
10011 save_MultiTexParameterivEXT(GLenum texunit, GLenum target, GLenum pname, const GLint *params)
10012 {
10013 GET_CURRENT_CONTEXT(ctx);
10014 Node *n;
10015 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10016 n = alloc_instruction(ctx, OPCODE_MULTITEXPARAMETER_I, 7);
10017 if (n) {
10018 n[1].e = texunit;
10019 n[2].e = target;
10020 n[3].e = pname;
10021 n[4].i = params[0];
10022 n[5].i = params[1];
10023 n[6].i = params[2];
10024 n[7].i = params[3];
10025 }
10026 if (ctx->ExecuteFlag) {
10027 CALL_MultiTexParameterivEXT(ctx->Exec, (texunit, target, pname, params));
10028 }
10029 }
10030
10031 static void GLAPIENTRY
10032 save_MultiTexParameteriEXT(GLenum texunit, GLenum target, GLenum pname, GLint param)
10033 {
10034 GLint fparam[4];
10035 fparam[0] = param;
10036 fparam[1] = fparam[2] = fparam[3] = 0;
10037 save_MultiTexParameterivEXT(texunit, target, pname, fparam);
10038 }
10039
10040
10041 static void GLAPIENTRY
10042 save_MultiTexImage1DEXT(GLenum texunit, GLenum target,
10043 GLint level, GLint components,
10044 GLsizei width, GLint border,
10045 GLenum format, GLenum type, const GLvoid * pixels)
10046 {
10047 GET_CURRENT_CONTEXT(ctx);
10048 if (target == GL_PROXY_TEXTURE_1D) {
10049 /* don't compile, execute immediately */
10050 CALL_MultiTexImage1DEXT(ctx->Exec, (texunit, target, level, components, width,
10051 border, format, type, pixels));
10052 }
10053 else {
10054 Node *n;
10055 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10056 n = alloc_instruction(ctx, OPCODE_MULTITEX_IMAGE1D, 8 + POINTER_DWORDS);
10057 if (n) {
10058 n[1].e = texunit;
10059 n[2].e = target;
10060 n[3].i = level;
10061 n[4].i = components;
10062 n[5].i = (GLint) width;
10063 n[6].i = border;
10064 n[7].e = format;
10065 n[8].e = type;
10066 save_pointer(&n[9],
10067 unpack_image(ctx, 1, width, 1, 1, format, type,
10068 pixels, &ctx->Unpack));
10069 }
10070 if (ctx->ExecuteFlag) {
10071 CALL_MultiTexImage1DEXT(ctx->Exec, (texunit, target, level, components, width,
10072 border, format, type, pixels));
10073 }
10074 }
10075 }
10076
10077
10078 static void GLAPIENTRY
10079 save_MultiTexImage2DEXT(GLenum texunit, GLenum target,
10080 GLint level, GLint components,
10081 GLsizei width, GLsizei height, GLint border,
10082 GLenum format, GLenum type, const GLvoid * pixels)
10083 {
10084 GET_CURRENT_CONTEXT(ctx);
10085 if (target == GL_PROXY_TEXTURE_2D) {
10086 /* don't compile, execute immediately */
10087 CALL_MultiTexImage2DEXT(ctx->Exec, (texunit, target, level, components, width,
10088 height, border, format, type, pixels));
10089 }
10090 else {
10091 Node *n;
10092 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10093 n = alloc_instruction(ctx, OPCODE_MULTITEX_IMAGE2D, 9 + POINTER_DWORDS);
10094 if (n) {
10095 n[1].e = texunit;
10096 n[2].e = target;
10097 n[3].i = level;
10098 n[4].i = components;
10099 n[5].i = (GLint) width;
10100 n[6].i = (GLint) height;
10101 n[7].i = border;
10102 n[8].e = format;
10103 n[9].e = type;
10104 save_pointer(&n[10],
10105 unpack_image(ctx, 2, width, height, 1, format, type,
10106 pixels, &ctx->Unpack));
10107 }
10108 if (ctx->ExecuteFlag) {
10109 CALL_MultiTexImage2DEXT(ctx->Exec, (texunit, target, level, components, width,
10110 height, border, format, type, pixels));
10111 }
10112 }
10113 }
10114
10115
10116 static void GLAPIENTRY
10117 save_MultiTexImage3DEXT(GLenum texunit, GLenum target,
10118 GLint level, GLint internalFormat,
10119 GLsizei width, GLsizei height, GLsizei depth,
10120 GLint border,
10121 GLenum format, GLenum type, const GLvoid * pixels)
10122 {
10123 GET_CURRENT_CONTEXT(ctx);
10124 if (target == GL_PROXY_TEXTURE_3D) {
10125 /* don't compile, execute immediately */
10126 CALL_MultiTexImage3DEXT(ctx->Exec, (texunit, target, level, internalFormat, width,
10127 height, depth, border, format, type,
10128 pixels));
10129 }
10130 else {
10131 Node *n;
10132 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10133 n = alloc_instruction(ctx, OPCODE_MULTITEX_IMAGE3D, 10 + POINTER_DWORDS);
10134 if (n) {
10135 n[1].e = texunit;
10136 n[2].e = target;
10137 n[3].i = level;
10138 n[4].i = (GLint) internalFormat;
10139 n[5].i = (GLint) width;
10140 n[6].i = (GLint) height;
10141 n[7].i = (GLint) depth;
10142 n[8].i = border;
10143 n[9].e = format;
10144 n[10].e = type;
10145 save_pointer(&n[11],
10146 unpack_image(ctx, 3, width, height, depth, format, type,
10147 pixels, &ctx->Unpack));
10148 }
10149 if (ctx->ExecuteFlag) {
10150 CALL_MultiTexImage3DEXT(ctx->Exec, (texunit, target, level, internalFormat,
10151 width, height, depth, border, format,
10152 type, pixels));
10153 }
10154 }
10155 }
10156
10157
10158 static void GLAPIENTRY
10159 save_MultiTexSubImage1DEXT(GLenum texunit, GLenum target, GLint level, GLint xoffset,
10160 GLsizei width, GLenum format, GLenum type,
10161 const GLvoid * pixels)
10162 {
10163 GET_CURRENT_CONTEXT(ctx);
10164 Node *n;
10165
10166 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10167
10168 n = alloc_instruction(ctx, OPCODE_MULTITEX_SUB_IMAGE1D, 7 + POINTER_DWORDS);
10169 if (n) {
10170 n[1].e = texunit;
10171 n[2].e = target;
10172 n[3].i = level;
10173 n[4].i = xoffset;
10174 n[5].i = (GLint) width;
10175 n[6].e = format;
10176 n[7].e = type;
10177 save_pointer(&n[8],
10178 unpack_image(ctx, 1, width, 1, 1, format, type,
10179 pixels, &ctx->Unpack));
10180 }
10181 if (ctx->ExecuteFlag) {
10182 CALL_MultiTexSubImage1DEXT(ctx->Exec, (texunit, target, level, xoffset, width,
10183 format, type, pixels));
10184 }
10185 }
10186
10187
10188 static void GLAPIENTRY
10189 save_MultiTexSubImage2DEXT(GLenum texunit, GLenum target, GLint level,
10190 GLint xoffset, GLint yoffset,
10191 GLsizei width, GLsizei height,
10192 GLenum format, GLenum type, const GLvoid * pixels)
10193 {
10194 GET_CURRENT_CONTEXT(ctx);
10195 Node *n;
10196
10197 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10198
10199 n = alloc_instruction(ctx, OPCODE_MULTITEX_SUB_IMAGE2D, 9 + POINTER_DWORDS);
10200 if (n) {
10201 n[1].e = texunit;
10202 n[2].e = target;
10203 n[3].i = level;
10204 n[4].i = xoffset;
10205 n[5].i = yoffset;
10206 n[6].i = (GLint) width;
10207 n[7].i = (GLint) height;
10208 n[8].e = format;
10209 n[9].e = type;
10210 save_pointer(&n[10],
10211 unpack_image(ctx, 2, width, height, 1, format, type,
10212 pixels, &ctx->Unpack));
10213 }
10214 if (ctx->ExecuteFlag) {
10215 CALL_MultiTexSubImage2DEXT(ctx->Exec, (texunit, target, level, xoffset, yoffset,
10216 width, height, format, type, pixels));
10217 }
10218 }
10219
10220
10221 static void GLAPIENTRY
10222 save_MultiTexSubImage3DEXT(GLenum texunit, GLenum target, GLint level,
10223 GLint xoffset, GLint yoffset, GLint zoffset,
10224 GLsizei width, GLsizei height, GLsizei depth,
10225 GLenum format, GLenum type, const GLvoid * pixels)
10226 {
10227 GET_CURRENT_CONTEXT(ctx);
10228 Node *n;
10229
10230 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10231
10232 n = alloc_instruction(ctx, OPCODE_MULTITEX_SUB_IMAGE3D, 11 + POINTER_DWORDS);
10233 if (n) {
10234 n[1].e = texunit;
10235 n[2].e = target;
10236 n[3].i = level;
10237 n[4].i = xoffset;
10238 n[5].i = yoffset;
10239 n[6].i = zoffset;
10240 n[7].i = (GLint) width;
10241 n[8].i = (GLint) height;
10242 n[9].i = (GLint) depth;
10243 n[10].e = format;
10244 n[11].e = type;
10245 save_pointer(&n[12],
10246 unpack_image(ctx, 3, width, height, depth, format, type,
10247 pixels, &ctx->Unpack));
10248 }
10249 if (ctx->ExecuteFlag) {
10250 CALL_MultiTexSubImage3DEXT(ctx->Exec, (texunit, target, level,
10251 xoffset, yoffset, zoffset,
10252 width, height, depth, format, type,
10253 pixels));
10254 }
10255 }
10256
10257
10258 static void GLAPIENTRY
10259 save_CopyMultiTexImage1DEXT(GLenum texunit, GLenum target, GLint level,
10260 GLenum internalformat, GLint x, GLint y,
10261 GLsizei width, GLint border)
10262 {
10263 GET_CURRENT_CONTEXT(ctx);
10264 Node *n;
10265 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10266 n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_IMAGE1D, 8);
10267 if (n) {
10268 n[1].e = texunit;
10269 n[2].e = target;
10270 n[3].i = level;
10271 n[4].e = internalformat;
10272 n[5].i = x;
10273 n[6].i = y;
10274 n[7].i = width;
10275 n[8].i = border;
10276 }
10277 if (ctx->ExecuteFlag) {
10278 CALL_CopyMultiTexImage1DEXT(ctx->Exec, (texunit, target, level,
10279 internalformat, x, y,
10280 width, border));
10281 }
10282 }
10283
10284
10285 static void GLAPIENTRY
10286 save_CopyMultiTexImage2DEXT(GLenum texunit, GLenum target, GLint level,
10287 GLenum internalformat,
10288 GLint x, GLint y, GLsizei width,
10289 GLsizei height, GLint border)
10290 {
10291 GET_CURRENT_CONTEXT(ctx);
10292 Node *n;
10293 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10294 n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_IMAGE2D, 9);
10295 if (n) {
10296 n[1].e = texunit;
10297 n[2].e = target;
10298 n[3].i = level;
10299 n[4].e = internalformat;
10300 n[5].i = x;
10301 n[6].i = y;
10302 n[7].i = width;
10303 n[8].i = height;
10304 n[9].i = border;
10305 }
10306 if (ctx->ExecuteFlag) {
10307 CALL_CopyMultiTexImage2DEXT(ctx->Exec, (texunit, target, level,
10308 internalformat, x, y,
10309 width, height, border));
10310 }
10311 }
10312
10313
10314 static void GLAPIENTRY
10315 save_CopyMultiTexSubImage1DEXT(GLenum texunit, GLenum target, GLint level,
10316 GLint xoffset, GLint x, GLint y, GLsizei width)
10317 {
10318 GET_CURRENT_CONTEXT(ctx);
10319 Node *n;
10320 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10321 n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_SUB_IMAGE1D, 7);
10322 if (n) {
10323 n[1].e = texunit;
10324 n[2].e = target;
10325 n[3].i = level;
10326 n[4].i = xoffset;
10327 n[5].i = x;
10328 n[6].i = y;
10329 n[7].i = width;
10330 }
10331 if (ctx->ExecuteFlag) {
10332 CALL_CopyMultiTexSubImage1DEXT(ctx->Exec,
10333 (texunit, target, level, xoffset, x, y, width));
10334 }
10335 }
10336
10337
10338 static void GLAPIENTRY
10339 save_CopyMultiTexSubImage2DEXT(GLenum texunit, GLenum target, GLint level,
10340 GLint xoffset, GLint yoffset,
10341 GLint x, GLint y, GLsizei width, GLint height)
10342 {
10343 GET_CURRENT_CONTEXT(ctx);
10344 Node *n;
10345 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10346 n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_SUB_IMAGE2D, 9);
10347 if (n) {
10348 n[1].e = texunit;
10349 n[2].e = target;
10350 n[3].i = level;
10351 n[4].i = xoffset;
10352 n[5].i = yoffset;
10353 n[6].i = x;
10354 n[7].i = y;
10355 n[8].i = width;
10356 n[9].i = height;
10357 }
10358 if (ctx->ExecuteFlag) {
10359 CALL_CopyMultiTexSubImage2DEXT(ctx->Exec, (texunit, target, level,
10360 xoffset, yoffset,
10361 x, y, width, height));
10362 }
10363 }
10364
10365
10366 static void GLAPIENTRY
10367 save_CopyMultiTexSubImage3DEXT(GLenum texunit, GLenum target, GLint level,
10368 GLint xoffset, GLint yoffset, GLint zoffset,
10369 GLint x, GLint y, GLsizei width, GLint height)
10370 {
10371 GET_CURRENT_CONTEXT(ctx);
10372 Node *n;
10373 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10374 n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_SUB_IMAGE3D, 10);
10375 if (n) {
10376 n[1].e = texunit;
10377 n[2].e = target;
10378 n[3].i = level;
10379 n[4].i = xoffset;
10380 n[5].i = yoffset;
10381 n[6].i = zoffset;
10382 n[7].i = x;
10383 n[8].i = y;
10384 n[9].i = width;
10385 n[10].i = height;
10386 }
10387 if (ctx->ExecuteFlag) {
10388 CALL_CopyMultiTexSubImage3DEXT(ctx->Exec, (texunit, target, level,
10389 xoffset, yoffset, zoffset,
10390 x, y, width, height));
10391 }
10392 }
10393
10394
10395 static void GLAPIENTRY
10396 save_MultiTexEnvfvEXT(GLenum texunit, GLenum target, GLenum pname, const GLfloat *params)
10397 {
10398 GET_CURRENT_CONTEXT(ctx);
10399 Node *n;
10400 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10401 n = alloc_instruction(ctx, OPCODE_MULTITEXENV, 7);
10402 if (n) {
10403 n[1].e = texunit;
10404 n[2].e = target;
10405 n[3].e = pname;
10406 if (pname == GL_TEXTURE_ENV_COLOR) {
10407 n[4].f = params[0];
10408 n[5].f = params[1];
10409 n[6].f = params[2];
10410 n[7].f = params[3];
10411 }
10412 else {
10413 n[4].f = params[0];
10414 n[5].f = n[6].f = n[7].f = 0.0F;
10415 }
10416 }
10417 if (ctx->ExecuteFlag) {
10418 CALL_MultiTexEnvfvEXT(ctx->Exec, (texunit, target, pname, params));
10419 }
10420 }
10421
10422
10423 static void GLAPIENTRY
10424 save_MultiTexEnvfEXT(GLenum texunit, GLenum target, GLenum pname, GLfloat param)
10425 {
10426 GLfloat parray[4];
10427 parray[0] = (GLfloat) param;
10428 parray[1] = parray[2] = parray[3] = 0.0F;
10429 save_MultiTexEnvfvEXT(texunit, target, pname, parray);
10430 }
10431
10432
10433 static void GLAPIENTRY
10434 save_MultiTexEnviEXT(GLenum texunit, GLenum target, GLenum pname, GLint param)
10435 {
10436 GLfloat p[4];
10437 p[0] = (GLfloat) param;
10438 p[1] = p[2] = p[3] = 0.0F;
10439 save_MultiTexEnvfvEXT(texunit, target, pname, p);
10440 }
10441
10442
10443 static void GLAPIENTRY
10444 save_MultiTexEnvivEXT(GLenum texunit, GLenum target, GLenum pname, const GLint * param)
10445 {
10446 GLfloat p[4];
10447 if (pname == GL_TEXTURE_ENV_COLOR) {
10448 p[0] = INT_TO_FLOAT(param[0]);
10449 p[1] = INT_TO_FLOAT(param[1]);
10450 p[2] = INT_TO_FLOAT(param[2]);
10451 p[3] = INT_TO_FLOAT(param[3]);
10452 }
10453 else {
10454 p[0] = (GLfloat) param[0];
10455 p[1] = p[2] = p[3] = 0.0F;
10456 }
10457 save_MultiTexEnvfvEXT(texunit, target, pname, p);
10458 }
10459
10460
10461 static void GLAPIENTRY
10462 save_CompressedTextureImage1DEXT(GLuint texture, GLenum target, GLint level,
10463 GLenum internalFormat, GLsizei width,
10464 GLint border, GLsizei imageSize,
10465 const GLvoid * data)
10466 {
10467 GET_CURRENT_CONTEXT(ctx);
10468 if (target == GL_PROXY_TEXTURE_1D) {
10469 /* don't compile, execute immediately */
10470 CALL_CompressedTextureImage1DEXT(ctx->Exec, (texture, target, level,
10471 internalFormat, width,
10472 border, imageSize,
10473 data));
10474 }
10475 else {
10476 Node *n;
10477 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10478
10479 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_IMAGE_1D,
10480 7 + POINTER_DWORDS);
10481 if (n) {
10482 n[1].ui = texture;
10483 n[2].e = target;
10484 n[3].i = level;
10485 n[4].e = internalFormat;
10486 n[5].i = (GLint) width;
10487 n[6].i = border;
10488 n[7].i = imageSize;
10489 save_pointer(&n[8],
10490 copy_data(data, imageSize, "glCompressedTextureImage1DEXT"));
10491 }
10492 if (ctx->ExecuteFlag) {
10493 CALL_CompressedTextureImage1DEXT(ctx->Exec,
10494 (texture, target, level, internalFormat,
10495 width, border, imageSize, data));
10496 }
10497 }
10498 }
10499
10500
10501 static void GLAPIENTRY
10502 save_CompressedTextureImage2DEXT(GLuint texture, GLenum target, GLint level,
10503 GLenum internalFormat, GLsizei width,
10504 GLsizei height, GLint border, GLsizei imageSize,
10505 const GLvoid * data)
10506 {
10507 GET_CURRENT_CONTEXT(ctx);
10508 if (target == GL_PROXY_TEXTURE_2D) {
10509 /* don't compile, execute immediately */
10510 CALL_CompressedTextureImage2DEXT(ctx->Exec, (texture, target, level,
10511 internalFormat, width, height,
10512 border, imageSize, data));
10513 }
10514 else {
10515 Node *n;
10516 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10517
10518 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_IMAGE_2D,
10519 8 + POINTER_DWORDS);
10520 if (n) {
10521 n[1].ui = texture;
10522 n[2].e = target;
10523 n[3].i = level;
10524 n[4].e = internalFormat;
10525 n[5].i = (GLint) width;
10526 n[6].i = (GLint) height;
10527 n[7].i = border;
10528 n[8].i = imageSize;
10529 save_pointer(&n[9],
10530 copy_data(data, imageSize, "glCompressedTextureImage2DEXT"));
10531 }
10532 if (ctx->ExecuteFlag) {
10533 CALL_CompressedTextureImage2DEXT(ctx->Exec,
10534 (texture, target, level, internalFormat,
10535 width, height, border, imageSize, data));
10536 }
10537 }
10538 }
10539
10540
10541 static void GLAPIENTRY
10542 save_CompressedTextureImage3DEXT(GLuint texture, GLenum target, GLint level,
10543 GLenum internalFormat, GLsizei width,
10544 GLsizei height, GLsizei depth, GLint border,
10545 GLsizei imageSize, const GLvoid * data)
10546 {
10547 GET_CURRENT_CONTEXT(ctx);
10548 if (target == GL_PROXY_TEXTURE_3D) {
10549 /* don't compile, execute immediately */
10550 CALL_CompressedTextureImage3DEXT(ctx->Exec, (texture, target, level,
10551 internalFormat, width,
10552 height, depth, border,
10553 imageSize, data));
10554 }
10555 else {
10556 Node *n;
10557 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10558
10559 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_IMAGE_3D,
10560 9 + POINTER_DWORDS);
10561 if (n) {
10562 n[1].ui = texture;
10563 n[2].e = target;
10564 n[3].i = level;
10565 n[4].e = internalFormat;
10566 n[5].i = (GLint) width;
10567 n[6].i = (GLint) height;
10568 n[7].i = (GLint) depth;
10569 n[8].i = border;
10570 n[9].i = imageSize;
10571 save_pointer(&n[10],
10572 copy_data(data, imageSize, "glCompressedTextureImage3DEXT"));
10573 }
10574 if (ctx->ExecuteFlag) {
10575 CALL_CompressedTextureImage3DEXT(ctx->Exec,
10576 (texture, target, level, internalFormat,
10577 width, height, depth, border, imageSize,
10578 data));
10579 }
10580 }
10581 }
10582
10583
10584 static void GLAPIENTRY
10585 save_CompressedTextureSubImage1DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset,
10586 GLsizei width, GLenum format,
10587 GLsizei imageSize, const GLvoid * data)
10588 {
10589 Node *n;
10590 GET_CURRENT_CONTEXT(ctx);
10591 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10592
10593 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_1D,
10594 7 + POINTER_DWORDS);
10595 if (n) {
10596 n[1].ui = texture;
10597 n[2].e = target;
10598 n[3].i = level;
10599 n[4].i = xoffset;
10600 n[5].i = (GLint) width;
10601 n[6].e = format;
10602 n[7].i = imageSize;
10603 save_pointer(&n[8],
10604 copy_data(data, imageSize, "glCompressedTextureSubImage1DEXT"));
10605 }
10606 if (ctx->ExecuteFlag) {
10607 CALL_CompressedTextureSubImage1DEXT(ctx->Exec, (texture, target, level, xoffset,
10608 width, format, imageSize, data));
10609 }
10610 }
10611
10612
10613 static void GLAPIENTRY
10614 save_CompressedTextureSubImage2DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset,
10615 GLint yoffset, GLsizei width, GLsizei height,
10616 GLenum format, GLsizei imageSize,
10617 const GLvoid * data)
10618 {
10619 Node *n;
10620 GET_CURRENT_CONTEXT(ctx);
10621 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10622
10623 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_2D,
10624 9 + POINTER_DWORDS);
10625 if (n) {
10626 n[1].ui = texture;
10627 n[2].e = target;
10628 n[3].i = level;
10629 n[4].i = xoffset;
10630 n[5].i = yoffset;
10631 n[6].i = (GLint) width;
10632 n[7].i = (GLint) height;
10633 n[8].e = format;
10634 n[9].i = imageSize;
10635 save_pointer(&n[10],
10636 copy_data(data, imageSize, "glCompressedTextureSubImage2DEXT"));
10637 }
10638 if (ctx->ExecuteFlag) {
10639 CALL_CompressedTextureSubImage2DEXT(ctx->Exec,
10640 (texture, target, level, xoffset, yoffset,
10641 width, height, format, imageSize, data));
10642 }
10643 }
10644
10645
10646 static void GLAPIENTRY
10647 save_CompressedTextureSubImage3DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset,
10648 GLint yoffset, GLint zoffset, GLsizei width,
10649 GLsizei height, GLsizei depth, GLenum format,
10650 GLsizei imageSize, const GLvoid * data)
10651 {
10652 Node *n;
10653 GET_CURRENT_CONTEXT(ctx);
10654 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10655
10656 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_3D,
10657 11 + POINTER_DWORDS);
10658 if (n) {
10659 n[1].ui = texture;
10660 n[2].e = target;
10661 n[3].i = level;
10662 n[4].i = xoffset;
10663 n[5].i = yoffset;
10664 n[6].i = zoffset;
10665 n[7].i = (GLint) width;
10666 n[8].i = (GLint) height;
10667 n[9].i = (GLint) depth;
10668 n[10].e = format;
10669 n[11].i = imageSize;
10670 save_pointer(&n[12],
10671 copy_data(data, imageSize, "glCompressedTextureSubImage3DEXT"));
10672 }
10673 if (ctx->ExecuteFlag) {
10674 CALL_CompressedTextureSubImage3DEXT(ctx->Exec,
10675 (texture, target, level, xoffset, yoffset,
10676 zoffset, width, height, depth, format,
10677 imageSize, data));
10678 }
10679 }
10680
10681
10682 static void GLAPIENTRY
10683 save_CompressedMultiTexImage1DEXT(GLenum texunit, GLenum target, GLint level,
10684 GLenum internalFormat, GLsizei width,
10685 GLint border, GLsizei imageSize,
10686 const GLvoid * data)
10687 {
10688 GET_CURRENT_CONTEXT(ctx);
10689 if (target == GL_PROXY_TEXTURE_1D) {
10690 /* don't compile, execute immediately */
10691 CALL_CompressedMultiTexImage1DEXT(ctx->Exec, (texunit, target, level,
10692 internalFormat, width,
10693 border, imageSize,
10694 data));
10695 }
10696 else {
10697 Node *n;
10698 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10699
10700 n = alloc_instruction(ctx, OPCODE_COMPRESSED_MULTITEX_IMAGE_1D,
10701 7 + POINTER_DWORDS);
10702 if (n) {
10703 n[1].e = texunit;
10704 n[2].e = target;
10705 n[3].i = level;
10706 n[4].e = internalFormat;
10707 n[5].i = (GLint) width;
10708 n[6].i = border;
10709 n[7].i = imageSize;
10710 save_pointer(&n[8],
10711 copy_data(data, imageSize, "glCompressedMultiTexImage1DEXT"));
10712 }
10713 if (ctx->ExecuteFlag) {
10714 CALL_CompressedMultiTexImage1DEXT(ctx->Exec,
10715 (texunit, target, level, internalFormat,
10716 width, border, imageSize, data));
10717 }
10718 }
10719 }
10720
10721
10722 static void GLAPIENTRY
10723 save_CompressedMultiTexImage2DEXT(GLenum texunit, GLenum target, GLint level,
10724 GLenum internalFormat, GLsizei width,
10725 GLsizei height, GLint border, GLsizei imageSize,
10726 const GLvoid * data)
10727 {
10728 GET_CURRENT_CONTEXT(ctx);
10729 if (target == GL_PROXY_TEXTURE_2D) {
10730 /* don't compile, execute immediately */
10731 CALL_CompressedMultiTexImage2DEXT(ctx->Exec, (texunit, target, level,
10732 internalFormat, width, height,
10733 border, imageSize, data));
10734 }
10735 else {
10736 Node *n;
10737 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10738
10739 n = alloc_instruction(ctx, OPCODE_COMPRESSED_MULTITEX_IMAGE_2D,
10740 8 + POINTER_DWORDS);
10741 if (n) {
10742 n[1].e = texunit;
10743 n[2].e = target;
10744 n[3].i = level;
10745 n[4].e = internalFormat;
10746 n[5].i = (GLint) width;
10747 n[6].i = (GLint) height;
10748 n[7].i = border;
10749 n[8].i = imageSize;
10750 save_pointer(&n[9],
10751 copy_data(data, imageSize, "glCompressedMultiTexImage2DEXT"));
10752 }
10753 if (ctx->ExecuteFlag) {
10754 CALL_CompressedMultiTexImage2DEXT(ctx->Exec,
10755 (texunit, target, level, internalFormat,
10756 width, height, border, imageSize, data));
10757 }
10758 }
10759 }
10760
10761
10762 static void GLAPIENTRY
10763 save_CompressedMultiTexImage3DEXT(GLenum texunit, GLenum target, GLint level,
10764 GLenum internalFormat, GLsizei width,
10765 GLsizei height, GLsizei depth, GLint border,
10766 GLsizei imageSize, const GLvoid * data)
10767 {
10768 GET_CURRENT_CONTEXT(ctx);
10769 if (target == GL_PROXY_TEXTURE_3D) {
10770 /* don't compile, execute immediately */
10771 CALL_CompressedMultiTexImage3DEXT(ctx->Exec, (texunit, target, level,
10772 internalFormat, width,
10773 height, depth, border,
10774 imageSize, data));
10775 }
10776 else {
10777 Node *n;
10778 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10779
10780 n = alloc_instruction(ctx, OPCODE_COMPRESSED_MULTITEX_IMAGE_3D,
10781 9 + POINTER_DWORDS);
10782 if (n) {
10783 n[1].e = texunit;
10784 n[2].e = target;
10785 n[3].i = level;
10786 n[4].e = internalFormat;
10787 n[5].i = (GLint) width;
10788 n[6].i = (GLint) height;
10789 n[7].i = (GLint) depth;
10790 n[8].i = border;
10791 n[9].i = imageSize;
10792 save_pointer(&n[10],
10793 copy_data(data, imageSize, "glCompressedMultiTexImage3DEXT"));
10794 }
10795 if (ctx->ExecuteFlag) {
10796 CALL_CompressedMultiTexImage3DEXT(ctx->Exec,
10797 (texunit, target, level, internalFormat,
10798 width, height, depth, border, imageSize,
10799 data));
10800 }
10801 }
10802 }
10803
10804
10805 static void GLAPIENTRY
10806 save_CompressedMultiTexSubImage1DEXT(GLenum texunit, GLenum target, GLint level, GLint xoffset,
10807 GLsizei width, GLenum format,
10808 GLsizei imageSize, const GLvoid * data)
10809 {
10810 Node *n;
10811 GET_CURRENT_CONTEXT(ctx);
10812 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10813
10814 n = alloc_instruction(ctx, OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_1D,
10815 7 + POINTER_DWORDS);
10816 if (n) {
10817 n[1].e = texunit;
10818 n[2].e = target;
10819 n[3].i = level;
10820 n[4].i = xoffset;
10821 n[5].i = (GLint) width;
10822 n[6].e = format;
10823 n[7].i = imageSize;
10824 save_pointer(&n[8],
10825 copy_data(data, imageSize, "glCompressedMultiTexSubImage1DEXT"));
10826 }
10827 if (ctx->ExecuteFlag) {
10828 CALL_CompressedMultiTexSubImage1DEXT(ctx->Exec, (texunit, target, level, xoffset,
10829 width, format, imageSize, data));
10830 }
10831 }
10832
10833
10834 static void GLAPIENTRY
10835 save_CompressedMultiTexSubImage2DEXT(GLenum texunit, GLenum target, GLint level, GLint xoffset,
10836 GLint yoffset, GLsizei width, GLsizei height,
10837 GLenum format, GLsizei imageSize,
10838 const GLvoid * data)
10839 {
10840 Node *n;
10841 GET_CURRENT_CONTEXT(ctx);
10842 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10843
10844 n = alloc_instruction(ctx, OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_2D,
10845 9 + POINTER_DWORDS);
10846 if (n) {
10847 n[1].e = texunit;
10848 n[2].e = target;
10849 n[3].i = level;
10850 n[4].i = xoffset;
10851 n[5].i = yoffset;
10852 n[6].i = (GLint) width;
10853 n[7].i = (GLint) height;
10854 n[8].e = format;
10855 n[9].i = imageSize;
10856 save_pointer(&n[10],
10857 copy_data(data, imageSize, "glCompressedMultiTexSubImage2DEXT"));
10858 }
10859 if (ctx->ExecuteFlag) {
10860 CALL_CompressedMultiTexSubImage2DEXT(ctx->Exec,
10861 (texunit, target, level, xoffset, yoffset,
10862 width, height, format, imageSize, data));
10863 }
10864 }
10865
10866
10867 static void GLAPIENTRY
10868 save_CompressedMultiTexSubImage3DEXT(GLenum texunit, GLenum target, GLint level, GLint xoffset,
10869 GLint yoffset, GLint zoffset, GLsizei width,
10870 GLsizei height, GLsizei depth, GLenum format,
10871 GLsizei imageSize, const GLvoid * data)
10872 {
10873 Node *n;
10874 GET_CURRENT_CONTEXT(ctx);
10875 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10876
10877 n = alloc_instruction(ctx, OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_3D,
10878 11 + POINTER_DWORDS);
10879 if (n) {
10880 n[1].e = texunit;
10881 n[2].e = target;
10882 n[3].i = level;
10883 n[4].i = xoffset;
10884 n[5].i = yoffset;
10885 n[6].i = zoffset;
10886 n[7].i = (GLint) width;
10887 n[8].i = (GLint) height;
10888 n[9].i = (GLint) depth;
10889 n[10].e = format;
10890 n[11].i = imageSize;
10891 save_pointer(&n[12],
10892 copy_data(data, imageSize, "glCompressedMultiTexSubImage3DEXT"));
10893 }
10894 if (ctx->ExecuteFlag) {
10895 CALL_CompressedMultiTexSubImage3DEXT(ctx->Exec,
10896 (texunit, target, level, xoffset, yoffset,
10897 zoffset, width, height, depth, format,
10898 imageSize, data));
10899 }
10900 }
10901
10902
10903 /**
10904 * Save an error-generating command into display list.
10905 *
10906 * KW: Will appear in the list before the vertex buffer containing the
10907 * command that provoked the error. I don't see this as a problem.
10908 */
10909 static void
10910 save_error(struct gl_context *ctx, GLenum error, const char *s)
10911 {
10912 Node *n;
10913 n = alloc_instruction(ctx, OPCODE_ERROR, 1 + POINTER_DWORDS);
10914 if (n) {
10915 n[1].e = error;
10916 save_pointer(&n[2], (void *) s);
10917 /* note: the data/string here doesn't have to be freed in
10918 * _mesa_delete_list() since the string is never dynamically
10919 * allocated.
10920 */
10921 }
10922 }
10923
10924
10925 /**
10926 * Compile an error into current display list.
10927 */
10928 void
10929 _mesa_compile_error(struct gl_context *ctx, GLenum error, const char *s)
10930 {
10931 if (ctx->CompileFlag)
10932 save_error(ctx, error, s);
10933 if (ctx->ExecuteFlag)
10934 _mesa_error(ctx, error, "%s", s);
10935 }
10936
10937
10938 /**
10939 * Test if ID names a display list.
10940 */
10941 static GLboolean
10942 islist(struct gl_context *ctx, GLuint list)
10943 {
10944 if (list > 0 && _mesa_lookup_list(ctx, list)) {
10945 return GL_TRUE;
10946 }
10947 else {
10948 return GL_FALSE;
10949 }
10950 }
10951
10952
10953
10954 /**********************************************************************/
10955 /* Display list execution */
10956 /**********************************************************************/
10957
10958
10959 /*
10960 * Execute a display list. Note that the ListBase offset must have already
10961 * been added before calling this function. I.e. the list argument is
10962 * the absolute list number, not relative to ListBase.
10963 * \param list - display list number
10964 */
10965 static void
10966 execute_list(struct gl_context *ctx, GLuint list)
10967 {
10968 struct gl_display_list *dlist;
10969 Node *n;
10970 GLboolean done;
10971
10972 if (list == 0 || !islist(ctx, list))
10973 return;
10974
10975 if (ctx->ListState.CallDepth == MAX_LIST_NESTING) {
10976 /* raise an error? */
10977 return;
10978 }
10979
10980 dlist = _mesa_lookup_list(ctx, list);
10981 if (!dlist)
10982 return;
10983
10984 ctx->ListState.CallDepth++;
10985
10986 vbo_save_BeginCallList(ctx, dlist);
10987
10988 n = dlist->Head;
10989
10990 done = GL_FALSE;
10991 while (!done) {
10992 const OpCode opcode = n[0].opcode;
10993
10994 if (is_ext_opcode(opcode)) {
10995 n += ext_opcode_execute(ctx, n);
10996 }
10997 else {
10998 switch (opcode) {
10999 case OPCODE_ERROR:
11000 _mesa_error(ctx, n[1].e, "%s", (const char *) get_pointer(&n[2]));
11001 break;
11002 case OPCODE_ACCUM:
11003 CALL_Accum(ctx->Exec, (n[1].e, n[2].f));
11004 break;
11005 case OPCODE_ALPHA_FUNC:
11006 CALL_AlphaFunc(ctx->Exec, (n[1].e, n[2].f));
11007 break;
11008 case OPCODE_BIND_TEXTURE:
11009 CALL_BindTexture(ctx->Exec, (n[1].e, n[2].ui));
11010 break;
11011 case OPCODE_BITMAP:
11012 {
11013 const struct gl_pixelstore_attrib save = ctx->Unpack;
11014 ctx->Unpack = ctx->DefaultPacking;
11015 CALL_Bitmap(ctx->Exec, ((GLsizei) n[1].i, (GLsizei) n[2].i,
11016 n[3].f, n[4].f, n[5].f, n[6].f,
11017 get_pointer(&n[7])));
11018 ctx->Unpack = save; /* restore */
11019 }
11020 break;
11021 case OPCODE_BLEND_COLOR:
11022 CALL_BlendColor(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
11023 break;
11024 case OPCODE_BLEND_EQUATION:
11025 CALL_BlendEquation(ctx->Exec, (n[1].e));
11026 break;
11027 case OPCODE_BLEND_EQUATION_SEPARATE:
11028 CALL_BlendEquationSeparate(ctx->Exec, (n[1].e, n[2].e));
11029 break;
11030 case OPCODE_BLEND_FUNC_SEPARATE:
11031 CALL_BlendFuncSeparate(ctx->Exec,
11032 (n[1].e, n[2].e, n[3].e, n[4].e));
11033 break;
11034
11035 case OPCODE_BLEND_FUNC_I:
11036 /* GL_ARB_draw_buffers_blend */
11037 CALL_BlendFunciARB(ctx->Exec, (n[1].ui, n[2].e, n[3].e));
11038 break;
11039 case OPCODE_BLEND_FUNC_SEPARATE_I:
11040 /* GL_ARB_draw_buffers_blend */
11041 CALL_BlendFuncSeparateiARB(ctx->Exec, (n[1].ui, n[2].e, n[3].e,
11042 n[4].e, n[5].e));
11043 break;
11044 case OPCODE_BLEND_EQUATION_I:
11045 /* GL_ARB_draw_buffers_blend */
11046 CALL_BlendEquationiARB(ctx->Exec, (n[1].ui, n[2].e));
11047 break;
11048 case OPCODE_BLEND_EQUATION_SEPARATE_I:
11049 /* GL_ARB_draw_buffers_blend */
11050 CALL_BlendEquationSeparateiARB(ctx->Exec,
11051 (n[1].ui, n[2].e, n[3].e));
11052 break;
11053
11054 case OPCODE_CALL_LIST:
11055 /* Generated by glCallList(), don't add ListBase */
11056 if (ctx->ListState.CallDepth < MAX_LIST_NESTING) {
11057 execute_list(ctx, n[1].ui);
11058 }
11059 break;
11060 case OPCODE_CALL_LISTS:
11061 if (ctx->ListState.CallDepth < MAX_LIST_NESTING) {
11062 CALL_CallLists(ctx->Exec, (n[1].i, n[2].e, get_pointer(&n[3])));
11063 }
11064 break;
11065 case OPCODE_CLEAR:
11066 CALL_Clear(ctx->Exec, (n[1].bf));
11067 break;
11068 case OPCODE_CLEAR_BUFFER_IV:
11069 {
11070 GLint value[4];
11071 value[0] = n[3].i;
11072 value[1] = n[4].i;
11073 value[2] = n[5].i;
11074 value[3] = n[6].i;
11075 CALL_ClearBufferiv(ctx->Exec, (n[1].e, n[2].i, value));
11076 }
11077 break;
11078 case OPCODE_CLEAR_BUFFER_UIV:
11079 {
11080 GLuint value[4];
11081 value[0] = n[3].ui;
11082 value[1] = n[4].ui;
11083 value[2] = n[5].ui;
11084 value[3] = n[6].ui;
11085 CALL_ClearBufferuiv(ctx->Exec, (n[1].e, n[2].i, value));
11086 }
11087 break;
11088 case OPCODE_CLEAR_BUFFER_FV:
11089 {
11090 GLfloat value[4];
11091 value[0] = n[3].f;
11092 value[1] = n[4].f;
11093 value[2] = n[5].f;
11094 value[3] = n[6].f;
11095 CALL_ClearBufferfv(ctx->Exec, (n[1].e, n[2].i, value));
11096 }
11097 break;
11098 case OPCODE_CLEAR_BUFFER_FI:
11099 CALL_ClearBufferfi(ctx->Exec, (n[1].e, n[2].i, n[3].f, n[4].i));
11100 break;
11101 case OPCODE_CLEAR_COLOR:
11102 CALL_ClearColor(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
11103 break;
11104 case OPCODE_CLEAR_ACCUM:
11105 CALL_ClearAccum(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
11106 break;
11107 case OPCODE_CLEAR_DEPTH:
11108 CALL_ClearDepth(ctx->Exec, ((GLclampd) n[1].f));
11109 break;
11110 case OPCODE_CLEAR_INDEX:
11111 CALL_ClearIndex(ctx->Exec, ((GLfloat) n[1].ui));
11112 break;
11113 case OPCODE_CLEAR_STENCIL:
11114 CALL_ClearStencil(ctx->Exec, (n[1].i));
11115 break;
11116 case OPCODE_CLIP_PLANE:
11117 {
11118 GLdouble eq[4];
11119 eq[0] = n[2].f;
11120 eq[1] = n[3].f;
11121 eq[2] = n[4].f;
11122 eq[3] = n[5].f;
11123 CALL_ClipPlane(ctx->Exec, (n[1].e, eq));
11124 }
11125 break;
11126 case OPCODE_COLOR_MASK:
11127 CALL_ColorMask(ctx->Exec, (n[1].b, n[2].b, n[3].b, n[4].b));
11128 break;
11129 case OPCODE_COLOR_MASK_INDEXED:
11130 CALL_ColorMaski(ctx->Exec, (n[1].ui, n[2].b, n[3].b,
11131 n[4].b, n[5].b));
11132 break;
11133 case OPCODE_COLOR_MATERIAL:
11134 CALL_ColorMaterial(ctx->Exec, (n[1].e, n[2].e));
11135 break;
11136 case OPCODE_COPY_PIXELS:
11137 CALL_CopyPixels(ctx->Exec, (n[1].i, n[2].i,
11138 (GLsizei) n[3].i, (GLsizei) n[4].i,
11139 n[5].e));
11140 break;
11141 case OPCODE_COPY_TEX_IMAGE1D:
11142 CALL_CopyTexImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].e, n[4].i,
11143 n[5].i, n[6].i, n[7].i));
11144 break;
11145 case OPCODE_COPY_TEX_IMAGE2D:
11146 CALL_CopyTexImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].e, n[4].i,
11147 n[5].i, n[6].i, n[7].i, n[8].i));
11148 break;
11149 case OPCODE_COPY_TEX_SUB_IMAGE1D:
11150 CALL_CopyTexSubImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
11151 n[4].i, n[5].i, n[6].i));
11152 break;
11153 case OPCODE_COPY_TEX_SUB_IMAGE2D:
11154 CALL_CopyTexSubImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
11155 n[4].i, n[5].i, n[6].i, n[7].i,
11156 n[8].i));
11157 break;
11158 case OPCODE_COPY_TEX_SUB_IMAGE3D:
11159 CALL_CopyTexSubImage3D(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, n[9].i));
11162 break;
11163 case OPCODE_CULL_FACE:
11164 CALL_CullFace(ctx->Exec, (n[1].e));
11165 break;
11166 case OPCODE_DEPTH_FUNC:
11167 CALL_DepthFunc(ctx->Exec, (n[1].e));
11168 break;
11169 case OPCODE_DEPTH_MASK:
11170 CALL_DepthMask(ctx->Exec, (n[1].b));
11171 break;
11172 case OPCODE_DEPTH_RANGE:
11173 CALL_DepthRange(ctx->Exec,
11174 ((GLclampd) n[1].f, (GLclampd) n[2].f));
11175 break;
11176 case OPCODE_DISABLE:
11177 CALL_Disable(ctx->Exec, (n[1].e));
11178 break;
11179 case OPCODE_DISABLE_INDEXED:
11180 CALL_Disablei(ctx->Exec, (n[1].ui, n[2].e));
11181 break;
11182 case OPCODE_DRAW_BUFFER:
11183 CALL_DrawBuffer(ctx->Exec, (n[1].e));
11184 break;
11185 case OPCODE_DRAW_PIXELS:
11186 {
11187 const struct gl_pixelstore_attrib save = ctx->Unpack;
11188 ctx->Unpack = ctx->DefaultPacking;
11189 CALL_DrawPixels(ctx->Exec, (n[1].i, n[2].i, n[3].e, n[4].e,
11190 get_pointer(&n[5])));
11191 ctx->Unpack = save; /* restore */
11192 }
11193 break;
11194 case OPCODE_ENABLE:
11195 CALL_Enable(ctx->Exec, (n[1].e));
11196 break;
11197 case OPCODE_ENABLE_INDEXED:
11198 CALL_Enablei(ctx->Exec, (n[1].ui, n[2].e));
11199 break;
11200 case OPCODE_EVALMESH1:
11201 CALL_EvalMesh1(ctx->Exec, (n[1].e, n[2].i, n[3].i));
11202 break;
11203 case OPCODE_EVALMESH2:
11204 CALL_EvalMesh2(ctx->Exec,
11205 (n[1].e, n[2].i, n[3].i, n[4].i, n[5].i));
11206 break;
11207 case OPCODE_FOG:
11208 {
11209 GLfloat p[4];
11210 p[0] = n[2].f;
11211 p[1] = n[3].f;
11212 p[2] = n[4].f;
11213 p[3] = n[5].f;
11214 CALL_Fogfv(ctx->Exec, (n[1].e, p));
11215 }
11216 break;
11217 case OPCODE_FRONT_FACE:
11218 CALL_FrontFace(ctx->Exec, (n[1].e));
11219 break;
11220 case OPCODE_FRUSTUM:
11221 CALL_Frustum(ctx->Exec,
11222 (n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f));
11223 break;
11224 case OPCODE_HINT:
11225 CALL_Hint(ctx->Exec, (n[1].e, n[2].e));
11226 break;
11227 case OPCODE_INDEX_MASK:
11228 CALL_IndexMask(ctx->Exec, (n[1].ui));
11229 break;
11230 case OPCODE_INIT_NAMES:
11231 CALL_InitNames(ctx->Exec, ());
11232 break;
11233 case OPCODE_LIGHT:
11234 {
11235 GLfloat p[4];
11236 p[0] = n[3].f;
11237 p[1] = n[4].f;
11238 p[2] = n[5].f;
11239 p[3] = n[6].f;
11240 CALL_Lightfv(ctx->Exec, (n[1].e, n[2].e, p));
11241 }
11242 break;
11243 case OPCODE_LIGHT_MODEL:
11244 {
11245 GLfloat p[4];
11246 p[0] = n[2].f;
11247 p[1] = n[3].f;
11248 p[2] = n[4].f;
11249 p[3] = n[5].f;
11250 CALL_LightModelfv(ctx->Exec, (n[1].e, p));
11251 }
11252 break;
11253 case OPCODE_LINE_STIPPLE:
11254 CALL_LineStipple(ctx->Exec, (n[1].i, n[2].us));
11255 break;
11256 case OPCODE_LINE_WIDTH:
11257 CALL_LineWidth(ctx->Exec, (n[1].f));
11258 break;
11259 case OPCODE_LIST_BASE:
11260 CALL_ListBase(ctx->Exec, (n[1].ui));
11261 break;
11262 case OPCODE_LOAD_IDENTITY:
11263 CALL_LoadIdentity(ctx->Exec, ());
11264 break;
11265 case OPCODE_LOAD_MATRIX:
11266 STATIC_ASSERT(sizeof(Node) == sizeof(GLfloat));
11267 CALL_LoadMatrixf(ctx->Exec, (&n[1].f));
11268 break;
11269 case OPCODE_LOAD_NAME:
11270 CALL_LoadName(ctx->Exec, (n[1].ui));
11271 break;
11272 case OPCODE_LOGIC_OP:
11273 CALL_LogicOp(ctx->Exec, (n[1].e));
11274 break;
11275 case OPCODE_MAP1:
11276 {
11277 GLenum target = n[1].e;
11278 GLint ustride = _mesa_evaluator_components(target);
11279 GLint uorder = n[5].i;
11280 GLfloat u1 = n[2].f;
11281 GLfloat u2 = n[3].f;
11282 CALL_Map1f(ctx->Exec, (target, u1, u2, ustride, uorder,
11283 (GLfloat *) get_pointer(&n[6])));
11284 }
11285 break;
11286 case OPCODE_MAP2:
11287 {
11288 GLenum target = n[1].e;
11289 GLfloat u1 = n[2].f;
11290 GLfloat u2 = n[3].f;
11291 GLfloat v1 = n[4].f;
11292 GLfloat v2 = n[5].f;
11293 GLint ustride = n[6].i;
11294 GLint vstride = n[7].i;
11295 GLint uorder = n[8].i;
11296 GLint vorder = n[9].i;
11297 CALL_Map2f(ctx->Exec, (target, u1, u2, ustride, uorder,
11298 v1, v2, vstride, vorder,
11299 (GLfloat *) get_pointer(&n[10])));
11300 }
11301 break;
11302 case OPCODE_MAPGRID1:
11303 CALL_MapGrid1f(ctx->Exec, (n[1].i, n[2].f, n[3].f));
11304 break;
11305 case OPCODE_MAPGRID2:
11306 CALL_MapGrid2f(ctx->Exec,
11307 (n[1].i, n[2].f, n[3].f, n[4].i, n[5].f, n[6].f));
11308 break;
11309 case OPCODE_MATRIX_MODE:
11310 CALL_MatrixMode(ctx->Exec, (n[1].e));
11311 break;
11312 case OPCODE_MULT_MATRIX:
11313 CALL_MultMatrixf(ctx->Exec, (&n[1].f));
11314 break;
11315 case OPCODE_ORTHO:
11316 CALL_Ortho(ctx->Exec,
11317 (n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f));
11318 break;
11319 case OPCODE_PASSTHROUGH:
11320 CALL_PassThrough(ctx->Exec, (n[1].f));
11321 break;
11322 case OPCODE_PATCH_PARAMETER_I:
11323 CALL_PatchParameteri(ctx->Exec, (n[1].e, n[2].i));
11324 break;
11325 case OPCODE_PATCH_PARAMETER_FV_INNER:
11326 {
11327 GLfloat params[2];
11328 params[0] = n[2].f;
11329 params[1] = n[3].f;
11330 CALL_PatchParameterfv(ctx->Exec, (n[1].e, params));
11331 }
11332 break;
11333 case OPCODE_PATCH_PARAMETER_FV_OUTER:
11334 {
11335 GLfloat params[4];
11336 params[0] = n[2].f;
11337 params[1] = n[3].f;
11338 params[2] = n[4].f;
11339 params[3] = n[5].f;
11340 CALL_PatchParameterfv(ctx->Exec, (n[1].e, params));
11341 }
11342 break;
11343 case OPCODE_PIXEL_MAP:
11344 CALL_PixelMapfv(ctx->Exec,
11345 (n[1].e, n[2].i, get_pointer(&n[3])));
11346 break;
11347 case OPCODE_PIXEL_TRANSFER:
11348 CALL_PixelTransferf(ctx->Exec, (n[1].e, n[2].f));
11349 break;
11350 case OPCODE_PIXEL_ZOOM:
11351 CALL_PixelZoom(ctx->Exec, (n[1].f, n[2].f));
11352 break;
11353 case OPCODE_POINT_SIZE:
11354 CALL_PointSize(ctx->Exec, (n[1].f));
11355 break;
11356 case OPCODE_POINT_PARAMETERS:
11357 {
11358 GLfloat params[3];
11359 params[0] = n[2].f;
11360 params[1] = n[3].f;
11361 params[2] = n[4].f;
11362 CALL_PointParameterfv(ctx->Exec, (n[1].e, params));
11363 }
11364 break;
11365 case OPCODE_POLYGON_MODE:
11366 CALL_PolygonMode(ctx->Exec, (n[1].e, n[2].e));
11367 break;
11368 case OPCODE_POLYGON_STIPPLE:
11369 {
11370 const struct gl_pixelstore_attrib save = ctx->Unpack;
11371 ctx->Unpack = ctx->DefaultPacking;
11372 CALL_PolygonStipple(ctx->Exec, (get_pointer(&n[1])));
11373 ctx->Unpack = save; /* restore */
11374 }
11375 break;
11376 case OPCODE_POLYGON_OFFSET:
11377 CALL_PolygonOffset(ctx->Exec, (n[1].f, n[2].f));
11378 break;
11379 case OPCODE_POLYGON_OFFSET_CLAMP:
11380 CALL_PolygonOffsetClampEXT(ctx->Exec, (n[1].f, n[2].f, n[3].f));
11381 break;
11382 case OPCODE_POP_ATTRIB:
11383 CALL_PopAttrib(ctx->Exec, ());
11384 break;
11385 case OPCODE_POP_MATRIX:
11386 CALL_PopMatrix(ctx->Exec, ());
11387 break;
11388 case OPCODE_POP_NAME:
11389 CALL_PopName(ctx->Exec, ());
11390 break;
11391 case OPCODE_PRIORITIZE_TEXTURE:
11392 CALL_PrioritizeTextures(ctx->Exec, (1, &n[1].ui, &n[2].f));
11393 break;
11394 case OPCODE_PUSH_ATTRIB:
11395 CALL_PushAttrib(ctx->Exec, (n[1].bf));
11396 break;
11397 case OPCODE_PUSH_MATRIX:
11398 CALL_PushMatrix(ctx->Exec, ());
11399 break;
11400 case OPCODE_PUSH_NAME:
11401 CALL_PushName(ctx->Exec, (n[1].ui));
11402 break;
11403 case OPCODE_RASTER_POS:
11404 CALL_RasterPos4f(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
11405 break;
11406 case OPCODE_READ_BUFFER:
11407 CALL_ReadBuffer(ctx->Exec, (n[1].e));
11408 break;
11409 case OPCODE_ROTATE:
11410 CALL_Rotatef(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
11411 break;
11412 case OPCODE_SCALE:
11413 CALL_Scalef(ctx->Exec, (n[1].f, n[2].f, n[3].f));
11414 break;
11415 case OPCODE_SCISSOR:
11416 CALL_Scissor(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
11417 break;
11418 case OPCODE_SHADE_MODEL:
11419 CALL_ShadeModel(ctx->Exec, (n[1].e));
11420 break;
11421 case OPCODE_PROVOKING_VERTEX:
11422 CALL_ProvokingVertex(ctx->Exec, (n[1].e));
11423 break;
11424 case OPCODE_STENCIL_FUNC:
11425 CALL_StencilFunc(ctx->Exec, (n[1].e, n[2].i, n[3].ui));
11426 break;
11427 case OPCODE_STENCIL_MASK:
11428 CALL_StencilMask(ctx->Exec, (n[1].ui));
11429 break;
11430 case OPCODE_STENCIL_OP:
11431 CALL_StencilOp(ctx->Exec, (n[1].e, n[2].e, n[3].e));
11432 break;
11433 case OPCODE_STENCIL_FUNC_SEPARATE:
11434 CALL_StencilFuncSeparate(ctx->Exec,
11435 (n[1].e, n[2].e, n[3].i, n[4].ui));
11436 break;
11437 case OPCODE_STENCIL_MASK_SEPARATE:
11438 CALL_StencilMaskSeparate(ctx->Exec, (n[1].e, n[2].ui));
11439 break;
11440 case OPCODE_STENCIL_OP_SEPARATE:
11441 CALL_StencilOpSeparate(ctx->Exec,
11442 (n[1].e, n[2].e, n[3].e, n[4].e));
11443 break;
11444 case OPCODE_TEXENV:
11445 {
11446 GLfloat params[4];
11447 params[0] = n[3].f;
11448 params[1] = n[4].f;
11449 params[2] = n[5].f;
11450 params[3] = n[6].f;
11451 CALL_TexEnvfv(ctx->Exec, (n[1].e, n[2].e, params));
11452 }
11453 break;
11454 case OPCODE_TEXGEN:
11455 {
11456 GLfloat params[4];
11457 params[0] = n[3].f;
11458 params[1] = n[4].f;
11459 params[2] = n[5].f;
11460 params[3] = n[6].f;
11461 CALL_TexGenfv(ctx->Exec, (n[1].e, n[2].e, params));
11462 }
11463 break;
11464 case OPCODE_TEXPARAMETER:
11465 {
11466 GLfloat params[4];
11467 params[0] = n[3].f;
11468 params[1] = n[4].f;
11469 params[2] = n[5].f;
11470 params[3] = n[6].f;
11471 CALL_TexParameterfv(ctx->Exec, (n[1].e, n[2].e, params));
11472 }
11473 break;
11474 case OPCODE_TEX_IMAGE1D:
11475 {
11476 const struct gl_pixelstore_attrib save = ctx->Unpack;
11477 ctx->Unpack = ctx->DefaultPacking;
11478 CALL_TexImage1D(ctx->Exec, (n[1].e, /* target */
11479 n[2].i, /* level */
11480 n[3].i, /* components */
11481 n[4].i, /* width */
11482 n[5].e, /* border */
11483 n[6].e, /* format */
11484 n[7].e, /* type */
11485 get_pointer(&n[8])));
11486 ctx->Unpack = save; /* restore */
11487 }
11488 break;
11489 case OPCODE_TEX_IMAGE2D:
11490 {
11491 const struct gl_pixelstore_attrib save = ctx->Unpack;
11492 ctx->Unpack = ctx->DefaultPacking;
11493 CALL_TexImage2D(ctx->Exec, (n[1].e, /* target */
11494 n[2].i, /* level */
11495 n[3].i, /* components */
11496 n[4].i, /* width */
11497 n[5].i, /* height */
11498 n[6].e, /* border */
11499 n[7].e, /* format */
11500 n[8].e, /* type */
11501 get_pointer(&n[9])));
11502 ctx->Unpack = save; /* restore */
11503 }
11504 break;
11505 case OPCODE_TEX_IMAGE3D:
11506 {
11507 const struct gl_pixelstore_attrib save = ctx->Unpack;
11508 ctx->Unpack = ctx->DefaultPacking;
11509 CALL_TexImage3D(ctx->Exec, (n[1].e, /* target */
11510 n[2].i, /* level */
11511 n[3].i, /* components */
11512 n[4].i, /* width */
11513 n[5].i, /* height */
11514 n[6].i, /* depth */
11515 n[7].e, /* border */
11516 n[8].e, /* format */
11517 n[9].e, /* type */
11518 get_pointer(&n[10])));
11519 ctx->Unpack = save; /* restore */
11520 }
11521 break;
11522 case OPCODE_TEX_SUB_IMAGE1D:
11523 {
11524 const struct gl_pixelstore_attrib save = ctx->Unpack;
11525 ctx->Unpack = ctx->DefaultPacking;
11526 CALL_TexSubImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
11527 n[4].i, n[5].e,
11528 n[6].e, get_pointer(&n[7])));
11529 ctx->Unpack = save; /* restore */
11530 }
11531 break;
11532 case OPCODE_TEX_SUB_IMAGE2D:
11533 {
11534 const struct gl_pixelstore_attrib save = ctx->Unpack;
11535 ctx->Unpack = ctx->DefaultPacking;
11536 CALL_TexSubImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
11537 n[4].i, n[5].e,
11538 n[6].i, n[7].e, n[8].e,
11539 get_pointer(&n[9])));
11540 ctx->Unpack = save; /* restore */
11541 }
11542 break;
11543 case OPCODE_TEX_SUB_IMAGE3D:
11544 {
11545 const struct gl_pixelstore_attrib save = ctx->Unpack;
11546 ctx->Unpack = ctx->DefaultPacking;
11547 CALL_TexSubImage3D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
11548 n[4].i, n[5].i, n[6].i, n[7].i,
11549 n[8].i, n[9].e, n[10].e,
11550 get_pointer(&n[11])));
11551 ctx->Unpack = save; /* restore */
11552 }
11553 break;
11554 case OPCODE_TRANSLATE:
11555 CALL_Translatef(ctx->Exec, (n[1].f, n[2].f, n[3].f));
11556 break;
11557 case OPCODE_VIEWPORT:
11558 CALL_Viewport(ctx->Exec, (n[1].i, n[2].i,
11559 (GLsizei) n[3].i, (GLsizei) n[4].i));
11560 break;
11561 case OPCODE_WINDOW_POS:
11562 CALL_WindowPos4fMESA(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
11563 break;
11564 case OPCODE_VIEWPORT_ARRAY_V:
11565 CALL_ViewportArrayv(ctx->Exec, (n[1].ui, n[2].si,
11566 get_pointer(&n[3])));
11567 break;
11568 case OPCODE_VIEWPORT_INDEXED_F:
11569 CALL_ViewportIndexedf(ctx->Exec, (n[1].ui, n[2].f, n[3].f, n[4].f,
11570 n[5].f));
11571 break;
11572 case OPCODE_VIEWPORT_INDEXED_FV: {
11573 GLfloat v[4];
11574 v[0] = n[2].f;
11575 v[1] = n[3].f;
11576 v[2] = n[4].f;
11577 v[3] = n[5].f;
11578 CALL_ViewportIndexedfv(ctx->Exec, (n[1].ui, v));
11579 break;
11580 }
11581 case OPCODE_SCISSOR_ARRAY_V:
11582 CALL_ScissorArrayv(ctx->Exec, (n[1].ui, n[2].si,
11583 get_pointer(&n[3])));
11584 break;
11585 case OPCODE_SCISSOR_INDEXED:
11586 CALL_ScissorIndexed(ctx->Exec, (n[1].ui, n[2].i, n[3].i, n[4].si,
11587 n[5].si));
11588 break;
11589 case OPCODE_SCISSOR_INDEXED_V: {
11590 GLint v[4];
11591 v[0] = n[2].i;
11592 v[1] = n[3].i;
11593 v[2] = n[4].si;
11594 v[3] = n[5].si;
11595 CALL_ScissorIndexedv(ctx->Exec, (n[1].ui, v));
11596 break;
11597 }
11598 case OPCODE_DEPTH_ARRAY_V:
11599 CALL_DepthRangeArrayv(ctx->Exec, (n[1].ui, n[2].si,
11600 get_pointer(&n[3])));
11601 break;
11602 case OPCODE_DEPTH_INDEXED:
11603 CALL_DepthRangeIndexed(ctx->Exec, (n[1].ui, n[2].f, n[3].f));
11604 break;
11605 case OPCODE_ACTIVE_TEXTURE: /* GL_ARB_multitexture */
11606 CALL_ActiveTexture(ctx->Exec, (n[1].e));
11607 break;
11608 case OPCODE_COMPRESSED_TEX_IMAGE_1D: /* GL_ARB_texture_compression */
11609 CALL_CompressedTexImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].e,
11610 n[4].i, n[5].i, n[6].i,
11611 get_pointer(&n[7])));
11612 break;
11613 case OPCODE_COMPRESSED_TEX_IMAGE_2D: /* GL_ARB_texture_compression */
11614 CALL_CompressedTexImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].e,
11615 n[4].i, n[5].i, n[6].i,
11616 n[7].i, get_pointer(&n[8])));
11617 break;
11618 case OPCODE_COMPRESSED_TEX_IMAGE_3D: /* GL_ARB_texture_compression */
11619 CALL_CompressedTexImage3D(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, n[8].i,
11622 get_pointer(&n[9])));
11623 break;
11624 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D: /* GL_ARB_texture_compress */
11625 CALL_CompressedTexSubImage1D(ctx->Exec,
11626 (n[1].e, n[2].i, n[3].i, n[4].i,
11627 n[5].e, n[6].i,
11628 get_pointer(&n[7])));
11629 break;
11630 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D: /* GL_ARB_texture_compress */
11631 CALL_CompressedTexSubImage2D(ctx->Exec,
11632 (n[1].e, n[2].i, n[3].i, n[4].i,
11633 n[5].i, n[6].i, n[7].e, n[8].i,
11634 get_pointer(&n[9])));
11635 break;
11636 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D: /* GL_ARB_texture_compress */
11637 CALL_CompressedTexSubImage3D(ctx->Exec,
11638 (n[1].e, n[2].i, n[3].i, n[4].i,
11639 n[5].i, n[6].i, n[7].i, n[8].i,
11640 n[9].e, n[10].i,
11641 get_pointer(&n[11])));
11642 break;
11643 case OPCODE_SAMPLE_COVERAGE: /* GL_ARB_multisample */
11644 CALL_SampleCoverage(ctx->Exec, (n[1].f, n[2].b));
11645 break;
11646 case OPCODE_WINDOW_POS_ARB: /* GL_ARB_window_pos */
11647 CALL_WindowPos3f(ctx->Exec, (n[1].f, n[2].f, n[3].f));
11648 break;
11649 case OPCODE_BIND_PROGRAM_ARB: /* GL_ARB_vertex_program */
11650 CALL_BindProgramARB(ctx->Exec, (n[1].e, n[2].ui));
11651 break;
11652 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB:
11653 CALL_ProgramLocalParameter4fARB(ctx->Exec,
11654 (n[1].e, n[2].ui, n[3].f, n[4].f,
11655 n[5].f, n[6].f));
11656 break;
11657 case OPCODE_ACTIVE_STENCIL_FACE_EXT:
11658 CALL_ActiveStencilFaceEXT(ctx->Exec, (n[1].e));
11659 break;
11660 case OPCODE_DEPTH_BOUNDS_EXT:
11661 CALL_DepthBoundsEXT(ctx->Exec, (n[1].f, n[2].f));
11662 break;
11663 case OPCODE_PROGRAM_STRING_ARB:
11664 CALL_ProgramStringARB(ctx->Exec,
11665 (n[1].e, n[2].e, n[3].i,
11666 get_pointer(&n[4])));
11667 break;
11668 case OPCODE_PROGRAM_ENV_PARAMETER_ARB:
11669 CALL_ProgramEnvParameter4fARB(ctx->Exec, (n[1].e, n[2].ui, n[3].f,
11670 n[4].f, n[5].f,
11671 n[6].f));
11672 break;
11673 case OPCODE_BEGIN_QUERY_ARB:
11674 CALL_BeginQuery(ctx->Exec, (n[1].e, n[2].ui));
11675 break;
11676 case OPCODE_END_QUERY_ARB:
11677 CALL_EndQuery(ctx->Exec, (n[1].e));
11678 break;
11679 case OPCODE_QUERY_COUNTER:
11680 CALL_QueryCounter(ctx->Exec, (n[1].ui, n[2].e));
11681 break;
11682 case OPCODE_BEGIN_QUERY_INDEXED:
11683 CALL_BeginQueryIndexed(ctx->Exec, (n[1].e, n[2].ui, n[3].ui));
11684 break;
11685 case OPCODE_END_QUERY_INDEXED:
11686 CALL_EndQueryIndexed(ctx->Exec, (n[1].e, n[2].ui));
11687 break;
11688 case OPCODE_DRAW_BUFFERS_ARB:
11689 {
11690 GLenum buffers[MAX_DRAW_BUFFERS];
11691 GLint i, count = MIN2(n[1].i, MAX_DRAW_BUFFERS);
11692 for (i = 0; i < count; i++)
11693 buffers[i] = n[2 + i].e;
11694 CALL_DrawBuffers(ctx->Exec, (n[1].i, buffers));
11695 }
11696 break;
11697 case OPCODE_BLIT_FRAMEBUFFER:
11698 CALL_BlitFramebuffer(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i,
11699 n[5].i, n[6].i, n[7].i, n[8].i,
11700 n[9].i, n[10].e));
11701 break;
11702 case OPCODE_PRIMITIVE_RESTART_NV:
11703 CALL_PrimitiveRestartNV(ctx->Exec, ());
11704 break;
11705
11706 case OPCODE_USE_PROGRAM:
11707 CALL_UseProgram(ctx->Exec, (n[1].ui));
11708 break;
11709 case OPCODE_UNIFORM_1F:
11710 CALL_Uniform1f(ctx->Exec, (n[1].i, n[2].f));
11711 break;
11712 case OPCODE_UNIFORM_2F:
11713 CALL_Uniform2f(ctx->Exec, (n[1].i, n[2].f, n[3].f));
11714 break;
11715 case OPCODE_UNIFORM_3F:
11716 CALL_Uniform3f(ctx->Exec, (n[1].i, n[2].f, n[3].f, n[4].f));
11717 break;
11718 case OPCODE_UNIFORM_4F:
11719 CALL_Uniform4f(ctx->Exec,
11720 (n[1].i, n[2].f, n[3].f, n[4].f, n[5].f));
11721 break;
11722 case OPCODE_UNIFORM_1FV:
11723 CALL_Uniform1fv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11724 break;
11725 case OPCODE_UNIFORM_2FV:
11726 CALL_Uniform2fv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11727 break;
11728 case OPCODE_UNIFORM_3FV:
11729 CALL_Uniform3fv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11730 break;
11731 case OPCODE_UNIFORM_4FV:
11732 CALL_Uniform4fv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11733 break;
11734 case OPCODE_UNIFORM_1D: {
11735 union float64_pair x;
11736
11737 x.uint32[0] = n[2].ui;
11738 x.uint32[1] = n[3].ui;
11739
11740 CALL_Uniform1d(ctx->Exec, (n[1].i, x.d));
11741 break;
11742 }
11743 case OPCODE_UNIFORM_2D: {
11744 union float64_pair x;
11745 union float64_pair y;
11746
11747 x.uint32[0] = n[2].ui;
11748 x.uint32[1] = n[3].ui;
11749 y.uint32[0] = n[4].ui;
11750 y.uint32[1] = n[5].ui;
11751
11752 CALL_Uniform2d(ctx->Exec, (n[1].i, x.d, y.d));
11753 break;
11754 }
11755 case OPCODE_UNIFORM_3D: {
11756 union float64_pair x;
11757 union float64_pair y;
11758 union float64_pair z;
11759
11760 x.uint32[0] = n[2].ui;
11761 x.uint32[1] = n[3].ui;
11762 y.uint32[0] = n[4].ui;
11763 y.uint32[1] = n[5].ui;
11764 z.uint32[0] = n[6].ui;
11765 z.uint32[1] = n[7].ui;
11766
11767 CALL_Uniform3d(ctx->Exec, (n[1].i, x.d, y.d, z.d));
11768 break;
11769 }
11770 case OPCODE_UNIFORM_4D: {
11771 union float64_pair x;
11772 union float64_pair y;
11773 union float64_pair z;
11774 union float64_pair w;
11775
11776 x.uint32[0] = n[2].ui;
11777 x.uint32[1] = n[3].ui;
11778 y.uint32[0] = n[4].ui;
11779 y.uint32[1] = n[5].ui;
11780 z.uint32[0] = n[6].ui;
11781 z.uint32[1] = n[7].ui;
11782 w.uint32[0] = n[8].ui;
11783 w.uint32[1] = n[9].ui;
11784
11785 CALL_Uniform4d(ctx->Exec, (n[1].i, x.d, y.d, z.d, w.d));
11786 break;
11787 }
11788 case OPCODE_UNIFORM_1DV:
11789 CALL_Uniform1dv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11790 break;
11791 case OPCODE_UNIFORM_2DV:
11792 CALL_Uniform2dv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11793 break;
11794 case OPCODE_UNIFORM_3DV:
11795 CALL_Uniform3dv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11796 break;
11797 case OPCODE_UNIFORM_4DV:
11798 CALL_Uniform4dv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11799 break;
11800 case OPCODE_UNIFORM_1I:
11801 CALL_Uniform1i(ctx->Exec, (n[1].i, n[2].i));
11802 break;
11803 case OPCODE_UNIFORM_2I:
11804 CALL_Uniform2i(ctx->Exec, (n[1].i, n[2].i, n[3].i));
11805 break;
11806 case OPCODE_UNIFORM_3I:
11807 CALL_Uniform3i(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
11808 break;
11809 case OPCODE_UNIFORM_4I:
11810 CALL_Uniform4i(ctx->Exec,
11811 (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
11812 break;
11813 case OPCODE_UNIFORM_1IV:
11814 CALL_Uniform1iv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11815 break;
11816 case OPCODE_UNIFORM_2IV:
11817 CALL_Uniform2iv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11818 break;
11819 case OPCODE_UNIFORM_3IV:
11820 CALL_Uniform3iv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11821 break;
11822 case OPCODE_UNIFORM_4IV:
11823 CALL_Uniform4iv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11824 break;
11825 case OPCODE_UNIFORM_1UI:
11826 CALL_Uniform1ui(ctx->Exec, (n[1].i, n[2].i));
11827 break;
11828 case OPCODE_UNIFORM_2UI:
11829 CALL_Uniform2ui(ctx->Exec, (n[1].i, n[2].i, n[3].i));
11830 break;
11831 case OPCODE_UNIFORM_3UI:
11832 CALL_Uniform3ui(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
11833 break;
11834 case OPCODE_UNIFORM_4UI:
11835 CALL_Uniform4ui(ctx->Exec,
11836 (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
11837 break;
11838 case OPCODE_UNIFORM_1UIV:
11839 CALL_Uniform1uiv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11840 break;
11841 case OPCODE_UNIFORM_2UIV:
11842 CALL_Uniform2uiv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11843 break;
11844 case OPCODE_UNIFORM_3UIV:
11845 CALL_Uniform3uiv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11846 break;
11847 case OPCODE_UNIFORM_4UIV:
11848 CALL_Uniform4uiv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11849 break;
11850 case OPCODE_UNIFORM_MATRIX22:
11851 CALL_UniformMatrix2fv(ctx->Exec,
11852 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11853 break;
11854 case OPCODE_UNIFORM_MATRIX33:
11855 CALL_UniformMatrix3fv(ctx->Exec,
11856 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11857 break;
11858 case OPCODE_UNIFORM_MATRIX44:
11859 CALL_UniformMatrix4fv(ctx->Exec,
11860 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11861 break;
11862 case OPCODE_UNIFORM_MATRIX23:
11863 CALL_UniformMatrix2x3fv(ctx->Exec,
11864 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11865 break;
11866 case OPCODE_UNIFORM_MATRIX32:
11867 CALL_UniformMatrix3x2fv(ctx->Exec,
11868 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11869 break;
11870 case OPCODE_UNIFORM_MATRIX24:
11871 CALL_UniformMatrix2x4fv(ctx->Exec,
11872 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11873 break;
11874 case OPCODE_UNIFORM_MATRIX42:
11875 CALL_UniformMatrix4x2fv(ctx->Exec,
11876 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11877 break;
11878 case OPCODE_UNIFORM_MATRIX34:
11879 CALL_UniformMatrix3x4fv(ctx->Exec,
11880 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11881 break;
11882 case OPCODE_UNIFORM_MATRIX43:
11883 CALL_UniformMatrix4x3fv(ctx->Exec,
11884 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11885 break;
11886 case OPCODE_UNIFORM_MATRIX22D:
11887 CALL_UniformMatrix2dv(ctx->Exec,
11888 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11889 break;
11890 case OPCODE_UNIFORM_MATRIX33D:
11891 CALL_UniformMatrix3dv(ctx->Exec,
11892 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11893 break;
11894 case OPCODE_UNIFORM_MATRIX44D:
11895 CALL_UniformMatrix4dv(ctx->Exec,
11896 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11897 break;
11898 case OPCODE_UNIFORM_MATRIX23D:
11899 CALL_UniformMatrix2x3dv(ctx->Exec,
11900 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11901 break;
11902 case OPCODE_UNIFORM_MATRIX32D:
11903 CALL_UniformMatrix3x2dv(ctx->Exec,
11904 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11905 break;
11906 case OPCODE_UNIFORM_MATRIX24D:
11907 CALL_UniformMatrix2x4dv(ctx->Exec,
11908 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11909 break;
11910 case OPCODE_UNIFORM_MATRIX42D:
11911 CALL_UniformMatrix4x2dv(ctx->Exec,
11912 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11913 break;
11914 case OPCODE_UNIFORM_MATRIX34D:
11915 CALL_UniformMatrix3x4dv(ctx->Exec,
11916 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11917 break;
11918 case OPCODE_UNIFORM_MATRIX43D:
11919 CALL_UniformMatrix4x3dv(ctx->Exec,
11920 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11921 break;
11922
11923 case OPCODE_USE_PROGRAM_STAGES:
11924 CALL_UseProgramStages(ctx->Exec, (n[1].ui, n[2].ui, n[3].ui));
11925 break;
11926 case OPCODE_PROGRAM_UNIFORM_1F:
11927 CALL_ProgramUniform1f(ctx->Exec, (n[1].ui, n[2].i, n[3].f));
11928 break;
11929 case OPCODE_PROGRAM_UNIFORM_2F:
11930 CALL_ProgramUniform2f(ctx->Exec, (n[1].ui, n[2].i, n[3].f, n[4].f));
11931 break;
11932 case OPCODE_PROGRAM_UNIFORM_3F:
11933 CALL_ProgramUniform3f(ctx->Exec, (n[1].ui, n[2].i,
11934 n[3].f, n[4].f, n[5].f));
11935 break;
11936 case OPCODE_PROGRAM_UNIFORM_4F:
11937 CALL_ProgramUniform4f(ctx->Exec, (n[1].ui, n[2].i,
11938 n[3].f, n[4].f, n[5].f, n[6].f));
11939 break;
11940 case OPCODE_PROGRAM_UNIFORM_1FV:
11941 CALL_ProgramUniform1fv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11942 get_pointer(&n[4])));
11943 break;
11944 case OPCODE_PROGRAM_UNIFORM_2FV:
11945 CALL_ProgramUniform2fv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11946 get_pointer(&n[4])));
11947 break;
11948 case OPCODE_PROGRAM_UNIFORM_3FV:
11949 CALL_ProgramUniform3fv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11950 get_pointer(&n[4])));
11951 break;
11952 case OPCODE_PROGRAM_UNIFORM_4FV:
11953 CALL_ProgramUniform4fv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11954 get_pointer(&n[4])));
11955 break;
11956 case OPCODE_PROGRAM_UNIFORM_1D: {
11957 union float64_pair x;
11958
11959 x.uint32[0] = n[3].ui;
11960 x.uint32[1] = n[4].ui;
11961
11962 CALL_ProgramUniform1d(ctx->Exec, (n[1].ui, n[2].i, x.d));
11963 break;
11964 }
11965 case OPCODE_PROGRAM_UNIFORM_2D: {
11966 union float64_pair x;
11967 union float64_pair y;
11968
11969 x.uint32[0] = n[3].ui;
11970 x.uint32[1] = n[4].ui;
11971 y.uint32[0] = n[5].ui;
11972 y.uint32[1] = n[6].ui;
11973
11974 CALL_ProgramUniform2d(ctx->Exec, (n[1].ui, n[2].i, x.d, y.d));
11975 break;
11976 }
11977 case OPCODE_PROGRAM_UNIFORM_3D: {
11978 union float64_pair x;
11979 union float64_pair y;
11980 union float64_pair z;
11981
11982 x.uint32[0] = n[3].ui;
11983 x.uint32[1] = n[4].ui;
11984 y.uint32[0] = n[5].ui;
11985 y.uint32[1] = n[6].ui;
11986 z.uint32[0] = n[7].ui;
11987 z.uint32[1] = n[8].ui;
11988
11989 CALL_ProgramUniform3d(ctx->Exec, (n[1].ui, n[2].i,
11990 x.d, y.d, z.d));
11991 break;
11992 }
11993 case OPCODE_PROGRAM_UNIFORM_4D: {
11994 union float64_pair x;
11995 union float64_pair y;
11996 union float64_pair z;
11997 union float64_pair w;
11998
11999 x.uint32[0] = n[3].ui;
12000 x.uint32[1] = n[4].ui;
12001 y.uint32[0] = n[5].ui;
12002 y.uint32[1] = n[6].ui;
12003 z.uint32[0] = n[7].ui;
12004 z.uint32[1] = n[8].ui;
12005 w.uint32[0] = n[9].ui;
12006 w.uint32[1] = n[10].ui;
12007
12008 CALL_ProgramUniform4d(ctx->Exec, (n[1].ui, n[2].i,
12009 x.d, y.d, z.d, w.d));
12010 break;
12011 }
12012 case OPCODE_PROGRAM_UNIFORM_1DV:
12013 CALL_ProgramUniform1dv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12014 get_pointer(&n[4])));
12015 break;
12016 case OPCODE_PROGRAM_UNIFORM_2DV:
12017 CALL_ProgramUniform2dv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12018 get_pointer(&n[4])));
12019 break;
12020 case OPCODE_PROGRAM_UNIFORM_3DV:
12021 CALL_ProgramUniform3dv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12022 get_pointer(&n[4])));
12023 break;
12024 case OPCODE_PROGRAM_UNIFORM_4DV:
12025 CALL_ProgramUniform4dv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12026 get_pointer(&n[4])));
12027 break;
12028 case OPCODE_PROGRAM_UNIFORM_1I:
12029 CALL_ProgramUniform1i(ctx->Exec, (n[1].ui, n[2].i, n[3].i));
12030 break;
12031 case OPCODE_PROGRAM_UNIFORM_2I:
12032 CALL_ProgramUniform2i(ctx->Exec, (n[1].ui, n[2].i, n[3].i, n[4].i));
12033 break;
12034 case OPCODE_PROGRAM_UNIFORM_3I:
12035 CALL_ProgramUniform3i(ctx->Exec, (n[1].ui, n[2].i,
12036 n[3].i, n[4].i, n[5].i));
12037 break;
12038 case OPCODE_PROGRAM_UNIFORM_4I:
12039 CALL_ProgramUniform4i(ctx->Exec, (n[1].ui, n[2].i,
12040 n[3].i, n[4].i, n[5].i, n[6].i));
12041 break;
12042 case OPCODE_PROGRAM_UNIFORM_1IV:
12043 CALL_ProgramUniform1iv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12044 get_pointer(&n[4])));
12045 break;
12046 case OPCODE_PROGRAM_UNIFORM_2IV:
12047 CALL_ProgramUniform2iv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12048 get_pointer(&n[4])));
12049 break;
12050 case OPCODE_PROGRAM_UNIFORM_3IV:
12051 CALL_ProgramUniform3iv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12052 get_pointer(&n[4])));
12053 break;
12054 case OPCODE_PROGRAM_UNIFORM_4IV:
12055 CALL_ProgramUniform4iv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12056 get_pointer(&n[4])));
12057 break;
12058 case OPCODE_PROGRAM_UNIFORM_1UI:
12059 CALL_ProgramUniform1ui(ctx->Exec, (n[1].ui, n[2].i, n[3].ui));
12060 break;
12061 case OPCODE_PROGRAM_UNIFORM_2UI:
12062 CALL_ProgramUniform2ui(ctx->Exec, (n[1].ui, n[2].i,
12063 n[3].ui, n[4].ui));
12064 break;
12065 case OPCODE_PROGRAM_UNIFORM_3UI:
12066 CALL_ProgramUniform3ui(ctx->Exec, (n[1].ui, n[2].i,
12067 n[3].ui, n[4].ui, n[5].ui));
12068 break;
12069 case OPCODE_PROGRAM_UNIFORM_4UI:
12070 CALL_ProgramUniform4ui(ctx->Exec, (n[1].ui, n[2].i,
12071 n[3].ui,
12072 n[4].ui, n[5].ui, n[6].ui));
12073 break;
12074 case OPCODE_PROGRAM_UNIFORM_1UIV:
12075 CALL_ProgramUniform1uiv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12076 get_pointer(&n[4])));
12077 break;
12078 case OPCODE_PROGRAM_UNIFORM_2UIV:
12079 CALL_ProgramUniform2uiv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12080 get_pointer(&n[4])));
12081 break;
12082 case OPCODE_PROGRAM_UNIFORM_3UIV:
12083 CALL_ProgramUniform3uiv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12084 get_pointer(&n[4])));
12085 break;
12086 case OPCODE_PROGRAM_UNIFORM_4UIV:
12087 CALL_ProgramUniform4uiv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12088 get_pointer(&n[4])));
12089 break;
12090 case OPCODE_PROGRAM_UNIFORM_MATRIX22F:
12091 CALL_ProgramUniformMatrix2fv(ctx->Exec,
12092 (n[1].ui, n[2].i, n[3].i, n[4].b,
12093 get_pointer(&n[5])));
12094 break;
12095 case OPCODE_PROGRAM_UNIFORM_MATRIX23F:
12096 CALL_ProgramUniformMatrix2x3fv(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_MATRIX24F:
12101 CALL_ProgramUniformMatrix2x4fv(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_MATRIX32F:
12106 CALL_ProgramUniformMatrix3x2fv(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_MATRIX33F:
12111 CALL_ProgramUniformMatrix3fv(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_MATRIX34F:
12116 CALL_ProgramUniformMatrix3x4fv(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_MATRIX42F:
12121 CALL_ProgramUniformMatrix4x2fv(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_MATRIX43F:
12126 CALL_ProgramUniformMatrix4x3fv(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_MATRIX44F:
12131 CALL_ProgramUniformMatrix4fv(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_MATRIX22D:
12136 CALL_ProgramUniformMatrix2dv(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_MATRIX23D:
12141 CALL_ProgramUniformMatrix2x3dv(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_MATRIX24D:
12146 CALL_ProgramUniformMatrix2x4dv(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_MATRIX32D:
12151 CALL_ProgramUniformMatrix3x2dv(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_MATRIX33D:
12156 CALL_ProgramUniformMatrix3dv(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_MATRIX34D:
12161 CALL_ProgramUniformMatrix3x4dv(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_MATRIX42D:
12166 CALL_ProgramUniformMatrix4x2dv(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_MATRIX43D:
12171 CALL_ProgramUniformMatrix4x3dv(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_MATRIX44D:
12176 CALL_ProgramUniformMatrix4dv(ctx->Exec,
12177 (n[1].ui, n[2].i, n[3].i, n[4].b,
12178 get_pointer(&n[5])));
12179 break;
12180
12181 case OPCODE_CLIP_CONTROL:
12182 CALL_ClipControl(ctx->Exec, (n[1].e, n[2].e));
12183 break;
12184
12185 case OPCODE_CLAMP_COLOR:
12186 CALL_ClampColor(ctx->Exec, (n[1].e, n[2].e));
12187 break;
12188
12189 case OPCODE_BIND_FRAGMENT_SHADER_ATI:
12190 CALL_BindFragmentShaderATI(ctx->Exec, (n[1].i));
12191 break;
12192 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI:
12193 CALL_SetFragmentShaderConstantATI(ctx->Exec, (n[1].ui, &n[2].f));
12194 break;
12195 case OPCODE_ATTR_1F_NV:
12196 CALL_VertexAttrib1fNV(ctx->Exec, (n[1].e, n[2].f));
12197 break;
12198 case OPCODE_ATTR_2F_NV:
12199 CALL_VertexAttrib2fvNV(ctx->Exec, (n[1].e, &n[2].f));
12200 break;
12201 case OPCODE_ATTR_3F_NV:
12202 CALL_VertexAttrib3fvNV(ctx->Exec, (n[1].e, &n[2].f));
12203 break;
12204 case OPCODE_ATTR_4F_NV:
12205 CALL_VertexAttrib4fvNV(ctx->Exec, (n[1].e, &n[2].f));
12206 break;
12207 case OPCODE_ATTR_1F_ARB:
12208 CALL_VertexAttrib1fARB(ctx->Exec, (n[1].e, n[2].f));
12209 break;
12210 case OPCODE_ATTR_2F_ARB:
12211 CALL_VertexAttrib2fvARB(ctx->Exec, (n[1].e, &n[2].f));
12212 break;
12213 case OPCODE_ATTR_3F_ARB:
12214 CALL_VertexAttrib3fvARB(ctx->Exec, (n[1].e, &n[2].f));
12215 break;
12216 case OPCODE_ATTR_4F_ARB:
12217 CALL_VertexAttrib4fvARB(ctx->Exec, (n[1].e, &n[2].f));
12218 break;
12219 case OPCODE_ATTR_1D: {
12220 GLdouble *d = (GLdouble *) &n[2];
12221 CALL_VertexAttribL1d(ctx->Exec, (n[1].ui, *d));
12222 break;
12223 }
12224 case OPCODE_ATTR_2D: {
12225 GLdouble *d = (GLdouble *) &n[2];
12226 CALL_VertexAttribL2dv(ctx->Exec, (n[1].ui, d));
12227 break;
12228 }
12229 case OPCODE_ATTR_3D: {
12230 GLdouble *d = (GLdouble *) &n[2];
12231 CALL_VertexAttribL3dv(ctx->Exec, (n[1].ui, d));
12232 break;
12233 }
12234 case OPCODE_ATTR_4D: {
12235 GLdouble *d = (GLdouble *) &n[2];
12236 CALL_VertexAttribL4dv(ctx->Exec, (n[1].ui, d));
12237 break;
12238 }
12239 case OPCODE_MATERIAL:
12240 CALL_Materialfv(ctx->Exec, (n[1].e, n[2].e, &n[3].f));
12241 break;
12242 case OPCODE_BEGIN:
12243 CALL_Begin(ctx->Exec, (n[1].e));
12244 break;
12245 case OPCODE_END:
12246 CALL_End(ctx->Exec, ());
12247 break;
12248 case OPCODE_RECTF:
12249 CALL_Rectf(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
12250 break;
12251 case OPCODE_EVAL_C1:
12252 CALL_EvalCoord1f(ctx->Exec, (n[1].f));
12253 break;
12254 case OPCODE_EVAL_C2:
12255 CALL_EvalCoord2f(ctx->Exec, (n[1].f, n[2].f));
12256 break;
12257 case OPCODE_EVAL_P1:
12258 CALL_EvalPoint1(ctx->Exec, (n[1].i));
12259 break;
12260 case OPCODE_EVAL_P2:
12261 CALL_EvalPoint2(ctx->Exec, (n[1].i, n[2].i));
12262 break;
12263
12264 /* GL_EXT_texture_integer */
12265 case OPCODE_CLEARCOLOR_I:
12266 CALL_ClearColorIiEXT(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
12267 break;
12268 case OPCODE_CLEARCOLOR_UI:
12269 CALL_ClearColorIuiEXT(ctx->Exec,
12270 (n[1].ui, n[2].ui, n[3].ui, n[4].ui));
12271 break;
12272 case OPCODE_TEXPARAMETER_I:
12273 {
12274 GLint params[4];
12275 params[0] = n[3].i;
12276 params[1] = n[4].i;
12277 params[2] = n[5].i;
12278 params[3] = n[6].i;
12279 CALL_TexParameterIiv(ctx->Exec, (n[1].e, n[2].e, params));
12280 }
12281 break;
12282 case OPCODE_TEXPARAMETER_UI:
12283 {
12284 GLuint params[4];
12285 params[0] = n[3].ui;
12286 params[1] = n[4].ui;
12287 params[2] = n[5].ui;
12288 params[3] = n[6].ui;
12289 CALL_TexParameterIuiv(ctx->Exec, (n[1].e, n[2].e, params));
12290 }
12291 break;
12292
12293 case OPCODE_VERTEX_ATTRIB_DIVISOR:
12294 /* GL_ARB_instanced_arrays */
12295 CALL_VertexAttribDivisor(ctx->Exec, (n[1].ui, n[2].ui));
12296 break;
12297
12298 case OPCODE_TEXTURE_BARRIER_NV:
12299 CALL_TextureBarrierNV(ctx->Exec, ());
12300 break;
12301
12302 /* GL_EXT/ARB_transform_feedback */
12303 case OPCODE_BEGIN_TRANSFORM_FEEDBACK:
12304 CALL_BeginTransformFeedback(ctx->Exec, (n[1].e));
12305 break;
12306 case OPCODE_END_TRANSFORM_FEEDBACK:
12307 CALL_EndTransformFeedback(ctx->Exec, ());
12308 break;
12309 case OPCODE_BIND_TRANSFORM_FEEDBACK:
12310 CALL_BindTransformFeedback(ctx->Exec, (n[1].e, n[2].ui));
12311 break;
12312 case OPCODE_PAUSE_TRANSFORM_FEEDBACK:
12313 CALL_PauseTransformFeedback(ctx->Exec, ());
12314 break;
12315 case OPCODE_RESUME_TRANSFORM_FEEDBACK:
12316 CALL_ResumeTransformFeedback(ctx->Exec, ());
12317 break;
12318 case OPCODE_DRAW_TRANSFORM_FEEDBACK:
12319 CALL_DrawTransformFeedback(ctx->Exec, (n[1].e, n[2].ui));
12320 break;
12321 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM:
12322 CALL_DrawTransformFeedbackStream(ctx->Exec,
12323 (n[1].e, n[2].ui, n[3].ui));
12324 break;
12325 case OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED:
12326 CALL_DrawTransformFeedbackInstanced(ctx->Exec,
12327 (n[1].e, n[2].ui, n[3].si));
12328 break;
12329 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED:
12330 CALL_DrawTransformFeedbackStreamInstanced(ctx->Exec,
12331 (n[1].e, n[2].ui, n[3].ui, n[4].si));
12332 break;
12333
12334
12335 case OPCODE_BIND_SAMPLER:
12336 CALL_BindSampler(ctx->Exec, (n[1].ui, n[2].ui));
12337 break;
12338 case OPCODE_SAMPLER_PARAMETERIV:
12339 {
12340 GLint params[4];
12341 params[0] = n[3].i;
12342 params[1] = n[4].i;
12343 params[2] = n[5].i;
12344 params[3] = n[6].i;
12345 CALL_SamplerParameteriv(ctx->Exec, (n[1].ui, n[2].e, params));
12346 }
12347 break;
12348 case OPCODE_SAMPLER_PARAMETERFV:
12349 {
12350 GLfloat params[4];
12351 params[0] = n[3].f;
12352 params[1] = n[4].f;
12353 params[2] = n[5].f;
12354 params[3] = n[6].f;
12355 CALL_SamplerParameterfv(ctx->Exec, (n[1].ui, n[2].e, params));
12356 }
12357 break;
12358 case OPCODE_SAMPLER_PARAMETERIIV:
12359 {
12360 GLint params[4];
12361 params[0] = n[3].i;
12362 params[1] = n[4].i;
12363 params[2] = n[5].i;
12364 params[3] = n[6].i;
12365 CALL_SamplerParameterIiv(ctx->Exec, (n[1].ui, n[2].e, params));
12366 }
12367 break;
12368 case OPCODE_SAMPLER_PARAMETERUIV:
12369 {
12370 GLuint params[4];
12371 params[0] = n[3].ui;
12372 params[1] = n[4].ui;
12373 params[2] = n[5].ui;
12374 params[3] = n[6].ui;
12375 CALL_SamplerParameterIuiv(ctx->Exec, (n[1].ui, n[2].e, params));
12376 }
12377 break;
12378
12379 /* ARB_compute_shader */
12380 case OPCODE_DISPATCH_COMPUTE:
12381 CALL_DispatchCompute(ctx->Exec, (n[1].ui, n[2].ui, n[3].ui));
12382 break;
12383
12384 /* GL_ARB_sync */
12385 case OPCODE_WAIT_SYNC:
12386 {
12387 union uint64_pair p;
12388 p.uint32[0] = n[2].ui;
12389 p.uint32[1] = n[3].ui;
12390 CALL_WaitSync(ctx->Exec,
12391 (get_pointer(&n[4]), n[1].bf, p.uint64));
12392 }
12393 break;
12394
12395 /* GL_NV_conditional_render */
12396 case OPCODE_BEGIN_CONDITIONAL_RENDER:
12397 CALL_BeginConditionalRender(ctx->Exec, (n[1].i, n[2].e));
12398 break;
12399 case OPCODE_END_CONDITIONAL_RENDER:
12400 CALL_EndConditionalRender(ctx->Exec, ());
12401 break;
12402
12403 case OPCODE_UNIFORM_BLOCK_BINDING:
12404 CALL_UniformBlockBinding(ctx->Exec, (n[1].ui, n[2].ui, n[3].ui));
12405 break;
12406
12407 case OPCODE_UNIFORM_SUBROUTINES:
12408 CALL_UniformSubroutinesuiv(ctx->Exec, (n[1].e, n[2].si,
12409 get_pointer(&n[3])));
12410 break;
12411
12412 /* GL_EXT_window_rectangles */
12413 case OPCODE_WINDOW_RECTANGLES:
12414 CALL_WindowRectanglesEXT(
12415 ctx->Exec, (n[1].e, n[2].si, get_pointer(&n[3])));
12416 break;
12417
12418 /* GL_NV_conservative_raster */
12419 case OPCODE_SUBPIXEL_PRECISION_BIAS:
12420 CALL_SubpixelPrecisionBiasNV(ctx->Exec, (n[1].ui, n[2].ui));
12421 break;
12422
12423 /* GL_NV_conservative_raster_dilate */
12424 case OPCODE_CONSERVATIVE_RASTER_PARAMETER_F:
12425 CALL_ConservativeRasterParameterfNV(ctx->Exec, (n[1].e, n[2].f));
12426 break;
12427
12428 /* GL_NV_conservative_raster_pre_snap_triangles */
12429 case OPCODE_CONSERVATIVE_RASTER_PARAMETER_I:
12430 CALL_ConservativeRasterParameteriNV(ctx->Exec, (n[1].e, n[2].i));
12431 break;
12432
12433 /* GL_EXT_direct_state_access */
12434 case OPCODE_MATRIX_LOAD:
12435 CALL_MatrixLoadfEXT(ctx->Exec, (n[1].e, &n[2].f));
12436 break;
12437 case OPCODE_MATRIX_MULT:
12438 CALL_MatrixMultfEXT(ctx->Exec, (n[1].e, &n[2].f));
12439 break;
12440 case OPCODE_MATRIX_ROTATE:
12441 CALL_MatrixRotatefEXT(ctx->Exec, (n[1].e, n[2].f, n[3].f, n[4].f, n[5].f));
12442 break;
12443 case OPCODE_MATRIX_SCALE:
12444 CALL_MatrixScalefEXT(ctx->Exec, (n[1].e, n[2].f, n[3].f, n[4].f));
12445 break;
12446 case OPCODE_MATRIX_TRANSLATE:
12447 CALL_MatrixTranslatefEXT(ctx->Exec, (n[1].e, n[2].f, n[3].f, n[4].f));
12448 break;
12449 case OPCODE_MATRIX_LOAD_IDENTITY:
12450 CALL_MatrixLoadIdentityEXT(ctx->Exec, (n[1].e));
12451 break;
12452 case OPCODE_MATRIX_ORTHO:
12453 CALL_MatrixOrthoEXT(ctx->Exec, (n[1].e,
12454 n[2].f, n[3].f, n[4].f,
12455 n[5].f, n[6].f, n[7].f));
12456 break;
12457 case OPCODE_MATRIX_FRUSTUM:
12458 CALL_MatrixFrustumEXT(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_PUSH:
12463 CALL_MatrixPushEXT(ctx->Exec, (n[1].e));
12464 break;
12465 case OPCODE_MATRIX_POP:
12466 CALL_MatrixPopEXT(ctx->Exec, (n[1].e));
12467 break;
12468 case OPCODE_TEXTUREPARAMETER_F:
12469 {
12470 GLfloat params[4];
12471 params[0] = n[4].f;
12472 params[1] = n[5].f;
12473 params[2] = n[6].f;
12474 params[3] = n[7].f;
12475 CALL_TextureParameterfvEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].e, params));
12476 }
12477 break;
12478 case OPCODE_TEXTUREPARAMETER_I:
12479 {
12480 GLint params[4];
12481 params[0] = n[4].i;
12482 params[1] = n[5].i;
12483 params[2] = n[6].i;
12484 params[3] = n[7].i;
12485 CALL_TextureParameterivEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].e, params));
12486 }
12487 break;
12488 case OPCODE_TEXTURE_IMAGE1D:
12489 {
12490 const struct gl_pixelstore_attrib save = ctx->Unpack;
12491 ctx->Unpack = ctx->DefaultPacking;
12492 CALL_TextureImage1DEXT(ctx->Exec, (n[1].ui, /* texture */
12493 n[2].e, /* target */
12494 n[3].i, /* level */
12495 n[4].i, /* components */
12496 n[5].i, /* width */
12497 n[6].e, /* border */
12498 n[7].e, /* format */
12499 n[8].e, /* type */
12500 get_pointer(&n[9])));
12501 ctx->Unpack = save; /* restore */
12502 }
12503 break;
12504 case OPCODE_TEXTURE_IMAGE2D:
12505 {
12506 const struct gl_pixelstore_attrib save = ctx->Unpack;
12507 ctx->Unpack = ctx->DefaultPacking;
12508 CALL_TextureImage2DEXT(ctx->Exec, (n[1].ui, /* texture */
12509 n[2].e, /* target */
12510 n[3].i, /* level */
12511 n[4].i, /* components */
12512 n[5].i, /* width */
12513 n[6].i, /* height */
12514 n[7].e, /* border */
12515 n[8].e, /* format */
12516 n[9].e, /* type */
12517 get_pointer(&n[10])));
12518 ctx->Unpack = save; /* restore */
12519 }
12520 break;
12521 case OPCODE_TEXTURE_IMAGE3D:
12522 {
12523 const struct gl_pixelstore_attrib save = ctx->Unpack;
12524 ctx->Unpack = ctx->DefaultPacking;
12525 CALL_TextureImage3DEXT(ctx->Exec, (n[1].ui, /* texture */
12526 n[2].e, /* target */
12527 n[3].i, /* level */
12528 n[4].i, /* components */
12529 n[5].i, /* width */
12530 n[6].i, /* height */
12531 n[7].i, /* depth */
12532 n[8].e, /* border */
12533 n[9].e, /* format */
12534 n[10].e, /* type */
12535 get_pointer(&n[11])));
12536 ctx->Unpack = save; /* restore */
12537 }
12538 break;
12539 case OPCODE_TEXTURE_SUB_IMAGE1D:
12540 {
12541 const struct gl_pixelstore_attrib save = ctx->Unpack;
12542 ctx->Unpack = ctx->DefaultPacking;
12543 CALL_TextureSubImage1DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
12544 n[4].i, n[5].i, n[6].e,
12545 n[7].e, get_pointer(&n[8])));
12546 ctx->Unpack = save; /* restore */
12547 }
12548 break;
12549 case OPCODE_TEXTURE_SUB_IMAGE2D:
12550 {
12551 const struct gl_pixelstore_attrib save = ctx->Unpack;
12552 ctx->Unpack = ctx->DefaultPacking;
12553 CALL_TextureSubImage2DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
12554 n[4].i, n[5].i, n[6].e,
12555 n[7].i, n[8].e, n[9].e,
12556 get_pointer(&n[10])));
12557 ctx->Unpack = save;
12558 }
12559 break;
12560 case OPCODE_TEXTURE_SUB_IMAGE3D:
12561 {
12562 const struct gl_pixelstore_attrib save = ctx->Unpack;
12563 ctx->Unpack = ctx->DefaultPacking;
12564 CALL_TextureSubImage3DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
12565 n[4].i, n[5].i, n[6].i,
12566 n[7].i, n[8].i, n[9].i,
12567 n[10].e, n[11].e,
12568 get_pointer(&n[12])));
12569 ctx->Unpack = save; /* restore */
12570 }
12571 break;
12572 case OPCODE_COPY_TEXTURE_IMAGE1D:
12573 CALL_CopyTextureImage1DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
12574 n[4].e, n[5].i, n[6].i,
12575 n[7].i, n[8].i));
12576 break;
12577 case OPCODE_COPY_TEXTURE_IMAGE2D:
12578 CALL_CopyTextureImage2DEXT(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, n[9].i));
12581 break;
12582 case OPCODE_COPY_TEXTURE_SUB_IMAGE1D:
12583 CALL_CopyTextureSubImage1DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
12584 n[4].i, n[5].i, n[6].i,
12585 n[7].i));
12586 break;
12587 case OPCODE_COPY_TEXTURE_SUB_IMAGE2D:
12588 CALL_CopyTextureSubImage2DEXT(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, n[8].i, n[9].i));
12591 break;
12592 case OPCODE_COPY_TEXTURE_SUB_IMAGE3D:
12593 CALL_CopyTextureSubImage3DEXT(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 n[10].i));
12597 break;
12598 case OPCODE_BIND_MULTITEXTURE:
12599 CALL_BindMultiTextureEXT(ctx->Exec, (n[1].e, n[2].e, n[3].ui));
12600 break;
12601 case OPCODE_MULTITEXPARAMETER_F:
12602 {
12603 GLfloat params[4];
12604 params[0] = n[4].f;
12605 params[1] = n[5].f;
12606 params[2] = n[6].f;
12607 params[3] = n[7].f;
12608 CALL_MultiTexParameterfvEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, params));
12609 }
12610 break;
12611 case OPCODE_MULTITEXPARAMETER_I:
12612 {
12613 GLint params[4];
12614 params[0] = n[4].i;
12615 params[1] = n[5].i;
12616 params[2] = n[6].i;
12617 params[3] = n[7].i;
12618 CALL_MultiTexParameterivEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, params));
12619 }
12620 break;
12621 case OPCODE_MULTITEX_IMAGE1D:
12622 {
12623 const struct gl_pixelstore_attrib save = ctx->Unpack;
12624 ctx->Unpack = ctx->DefaultPacking;
12625 CALL_MultiTexImage1DEXT(ctx->Exec, (n[1].e, /* texture */
12626 n[2].e, /* target */
12627 n[3].i, /* level */
12628 n[4].i, /* components */
12629 n[5].i, /* width */
12630 n[6].e, /* border */
12631 n[7].e, /* format */
12632 n[8].e, /* type */
12633 get_pointer(&n[9])));
12634 ctx->Unpack = save; /* restore */
12635 }
12636 break;
12637 case OPCODE_MULTITEX_IMAGE2D:
12638 {
12639 const struct gl_pixelstore_attrib save = ctx->Unpack;
12640 ctx->Unpack = ctx->DefaultPacking;
12641 CALL_MultiTexImage2DEXT(ctx->Exec, (n[1].e, /* texture */
12642 n[2].e, /* target */
12643 n[3].i, /* level */
12644 n[4].i, /* components */
12645 n[5].i, /* width */
12646 n[6].i, /* height */
12647 n[7].e, /* border */
12648 n[8].e, /* format */
12649 n[9].e, /* type */
12650 get_pointer(&n[10])));
12651 ctx->Unpack = save; /* restore */
12652 }
12653 break;
12654 case OPCODE_MULTITEX_IMAGE3D:
12655 {
12656 const struct gl_pixelstore_attrib save = ctx->Unpack;
12657 ctx->Unpack = ctx->DefaultPacking;
12658 CALL_MultiTexImage3DEXT(ctx->Exec, (n[1].e, /* texture */
12659 n[2].e, /* target */
12660 n[3].i, /* level */
12661 n[4].i, /* components */
12662 n[5].i, /* width */
12663 n[6].i, /* height */
12664 n[7].i, /* depth */
12665 n[8].e, /* border */
12666 n[9].e, /* format */
12667 n[10].e, /* type */
12668 get_pointer(&n[11])));
12669 ctx->Unpack = save; /* restore */
12670 }
12671 break;
12672 case OPCODE_MULTITEX_SUB_IMAGE1D:
12673 {
12674 const struct gl_pixelstore_attrib save = ctx->Unpack;
12675 ctx->Unpack = ctx->DefaultPacking;
12676 CALL_MultiTexSubImage1DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
12677 n[4].i, n[5].i, n[6].e,
12678 n[7].e, get_pointer(&n[8])));
12679 ctx->Unpack = save; /* restore */
12680 }
12681 break;
12682 case OPCODE_MULTITEX_SUB_IMAGE2D:
12683 {
12684 const struct gl_pixelstore_attrib save = ctx->Unpack;
12685 ctx->Unpack = ctx->DefaultPacking;
12686 CALL_MultiTexSubImage2DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
12687 n[4].i, n[5].i, n[6].e,
12688 n[7].i, n[8].e, n[9].e,
12689 get_pointer(&n[10])));
12690 ctx->Unpack = save; /* restore */
12691 }
12692 break;
12693 case OPCODE_MULTITEX_SUB_IMAGE3D:
12694 {
12695 const struct gl_pixelstore_attrib save = ctx->Unpack;
12696 ctx->Unpack = ctx->DefaultPacking;
12697 CALL_MultiTexSubImage3DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
12698 n[4].i, n[5].i, n[6].i,
12699 n[7].i, n[8].i, n[9].i,
12700 n[10].e, n[11].e,
12701 get_pointer(&n[12])));
12702 ctx->Unpack = save; /* restore */
12703 }
12704 break;
12705 case OPCODE_COPY_MULTITEX_IMAGE1D:
12706 CALL_CopyMultiTexImage1DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
12707 n[4].e, n[5].i, n[6].i,
12708 n[7].i, n[8].i));
12709 break;
12710 case OPCODE_COPY_MULTITEX_IMAGE2D:
12711 CALL_CopyMultiTexImage2DEXT(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, n[9].i));
12714 break;
12715 case OPCODE_COPY_MULTITEX_SUB_IMAGE1D:
12716 CALL_CopyMultiTexSubImage1DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
12717 n[4].i, n[5].i, n[6].i,
12718 n[7].i));
12719 break;
12720 case OPCODE_COPY_MULTITEX_SUB_IMAGE2D:
12721 CALL_CopyMultiTexSubImage2DEXT(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, n[8].i, n[9].i));
12724 break;
12725 case OPCODE_COPY_MULTITEX_SUB_IMAGE3D:
12726 CALL_CopyMultiTexSubImage3DEXT(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 n[10].i));
12730 break;
12731 case OPCODE_MULTITEXENV:
12732 {
12733 GLfloat params[4];
12734 params[0] = n[4].f;
12735 params[1] = n[5].f;
12736 params[2] = n[6].f;
12737 params[3] = n[7].f;
12738 CALL_MultiTexEnvfvEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, params));
12739 }
12740 break;
12741 case OPCODE_COMPRESSED_TEXTURE_IMAGE_1D:
12742 CALL_CompressedTextureImage1DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
12743 n[4].e, n[5].i, n[6].i,
12744 n[7].i, get_pointer(&n[8])));
12745 break;
12746 case OPCODE_COMPRESSED_TEXTURE_IMAGE_2D:
12747 CALL_CompressedTextureImage2DEXT(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, n[8].i,
12750 get_pointer(&n[9])));
12751 break;
12752 case OPCODE_COMPRESSED_TEXTURE_IMAGE_3D:
12753 CALL_CompressedTextureImage3DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
12754 n[4].e, n[5].i, n[6].i,
12755 n[7].i, n[8].i, n[9].i,
12756 get_pointer(&n[10])));
12757 break;
12758 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_1D:
12759 CALL_CompressedTextureSubImage1DEXT(ctx->Exec,
12760 (n[1].ui, n[2].e, n[3].i, n[4].i,
12761 n[5].i, n[6].e, n[7].i,
12762 get_pointer(&n[8])));
12763 break;
12764 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_2D:
12765 CALL_CompressedTextureSubImage2DEXT(ctx->Exec,
12766 (n[1].ui, n[2].e, n[3].i, n[4].i,
12767 n[5].i, n[6].i, n[7].i, n[8].e,
12768 n[9].i, get_pointer(&n[10])));
12769 break;
12770 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_3D:
12771 CALL_CompressedTextureSubImage3DEXT(ctx->Exec,
12772 (n[1].ui, n[2].e, n[3].i, n[4].i,
12773 n[5].i, n[6].i, n[7].i, n[8].i,
12774 n[9].i, n[10].e, n[11].i,
12775 get_pointer(&n[12])));
12776 break;
12777 case OPCODE_COMPRESSED_MULTITEX_IMAGE_1D:
12778 CALL_CompressedMultiTexImage1DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
12779 n[4].e, n[5].i, n[6].i,
12780 n[7].i, get_pointer(&n[8])));
12781 break;
12782 case OPCODE_COMPRESSED_MULTITEX_IMAGE_2D:
12783 CALL_CompressedMultiTexImage2DEXT(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, n[8].i,
12786 get_pointer(&n[9])));
12787 break;
12788 case OPCODE_COMPRESSED_MULTITEX_IMAGE_3D:
12789 CALL_CompressedMultiTexImage3DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
12790 n[4].e, n[5].i, n[6].i,
12791 n[7].i, n[8].i, n[9].i,
12792 get_pointer(&n[10])));
12793 break;
12794 case OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_1D:
12795 CALL_CompressedMultiTexSubImage1DEXT(ctx->Exec,
12796 (n[1].e, n[2].e, n[3].i, n[4].i,
12797 n[5].i, n[6].e, n[7].i,
12798 get_pointer(&n[8])));
12799 break;
12800 case OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_2D:
12801 CALL_CompressedMultiTexSubImage2DEXT(ctx->Exec,
12802 (n[1].e, n[2].e, n[3].i, n[4].i,
12803 n[5].i, n[6].i, n[7].i, n[8].e,
12804 n[9].i, get_pointer(&n[10])));
12805 break;
12806 case OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_3D:
12807 CALL_CompressedMultiTexSubImage3DEXT(ctx->Exec,
12808 (n[1].e, n[2].e, n[3].i, n[4].i,
12809 n[5].i, n[6].i, n[7].i, n[8].i,
12810 n[9].i, n[10].e, n[11].i,
12811 get_pointer(&n[12])));
12812 break;
12813
12814 case OPCODE_CONTINUE:
12815 n = (Node *) get_pointer(&n[1]);
12816 break;
12817 case OPCODE_NOP:
12818 /* no-op */
12819 break;
12820 case OPCODE_END_OF_LIST:
12821 done = GL_TRUE;
12822 break;
12823 default:
12824 {
12825 char msg[1000];
12826 _mesa_snprintf(msg, sizeof(msg), "Error in execute_list: opcode=%d",
12827 (int) opcode);
12828 _mesa_problem(ctx, "%s", msg);
12829 }
12830 done = GL_TRUE;
12831 }
12832
12833 /* increment n to point to next compiled command */
12834 if (opcode != OPCODE_CONTINUE) {
12835 assert(InstSize[opcode] > 0);
12836 n += InstSize[opcode];
12837 }
12838 }
12839 }
12840
12841 vbo_save_EndCallList(ctx);
12842
12843 ctx->ListState.CallDepth--;
12844 }
12845
12846
12847
12848 /**********************************************************************/
12849 /* GL functions */
12850 /**********************************************************************/
12851
12852 /**
12853 * Test if a display list number is valid.
12854 */
12855 GLboolean GLAPIENTRY
12856 _mesa_IsList(GLuint list)
12857 {
12858 GET_CURRENT_CONTEXT(ctx);
12859 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
12860 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
12861 return islist(ctx, list);
12862 }
12863
12864
12865 /**
12866 * Delete a sequence of consecutive display lists.
12867 */
12868 void GLAPIENTRY
12869 _mesa_DeleteLists(GLuint list, GLsizei range)
12870 {
12871 GET_CURRENT_CONTEXT(ctx);
12872 GLuint i;
12873 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
12874 ASSERT_OUTSIDE_BEGIN_END(ctx);
12875
12876 if (range < 0) {
12877 _mesa_error(ctx, GL_INVALID_VALUE, "glDeleteLists");
12878 return;
12879 }
12880
12881 if (range > 1) {
12882 /* We may be deleting a set of bitmap lists. See if there's a
12883 * bitmap atlas to free.
12884 */
12885 struct gl_bitmap_atlas *atlas = lookup_bitmap_atlas(ctx, list);
12886 if (atlas) {
12887 _mesa_delete_bitmap_atlas(ctx, atlas);
12888 _mesa_HashRemove(ctx->Shared->BitmapAtlas, list);
12889 }
12890 }
12891
12892 for (i = list; i < list + range; i++) {
12893 destroy_list(ctx, i);
12894 }
12895 }
12896
12897
12898 /**
12899 * Return a display list number, n, such that lists n through n+range-1
12900 * are free.
12901 */
12902 GLuint GLAPIENTRY
12903 _mesa_GenLists(GLsizei range)
12904 {
12905 GET_CURRENT_CONTEXT(ctx);
12906 GLuint base;
12907 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
12908 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
12909
12910 if (range < 0) {
12911 _mesa_error(ctx, GL_INVALID_VALUE, "glGenLists");
12912 return 0;
12913 }
12914 if (range == 0) {
12915 return 0;
12916 }
12917
12918 /*
12919 * Make this an atomic operation
12920 */
12921 _mesa_HashLockMutex(ctx->Shared->DisplayList);
12922
12923 base = _mesa_HashFindFreeKeyBlock(ctx->Shared->DisplayList, range);
12924 if (base) {
12925 /* reserve the list IDs by with empty/dummy lists */
12926 GLint i;
12927 for (i = 0; i < range; i++) {
12928 _mesa_HashInsertLocked(ctx->Shared->DisplayList, base + i,
12929 make_list(base + i, 1));
12930 }
12931 }
12932
12933 if (USE_BITMAP_ATLAS &&
12934 range > 16 &&
12935 ctx->Driver.DrawAtlasBitmaps) {
12936 /* "range > 16" is a rough heuristic to guess when glGenLists might be
12937 * used to allocate display lists for glXUseXFont or wglUseFontBitmaps.
12938 * Create the empty atlas now.
12939 */
12940 struct gl_bitmap_atlas *atlas = lookup_bitmap_atlas(ctx, base);
12941 if (!atlas) {
12942 atlas = alloc_bitmap_atlas(ctx, base);
12943 }
12944 if (atlas) {
12945 /* Atlas _should_ be new/empty now, but clobbering is OK */
12946 assert(atlas->numBitmaps == 0);
12947 atlas->numBitmaps = range;
12948 }
12949 }
12950
12951 _mesa_HashUnlockMutex(ctx->Shared->DisplayList);
12952
12953 return base;
12954 }
12955
12956
12957 /**
12958 * Begin a new display list.
12959 */
12960 void GLAPIENTRY
12961 _mesa_NewList(GLuint name, GLenum mode)
12962 {
12963 GET_CURRENT_CONTEXT(ctx);
12964
12965 FLUSH_CURRENT(ctx, 0); /* must be called before assert */
12966 ASSERT_OUTSIDE_BEGIN_END(ctx);
12967
12968 if (MESA_VERBOSE & VERBOSE_API)
12969 _mesa_debug(ctx, "glNewList %u %s\n", name,
12970 _mesa_enum_to_string(mode));
12971
12972 if (name == 0) {
12973 _mesa_error(ctx, GL_INVALID_VALUE, "glNewList");
12974 return;
12975 }
12976
12977 if (mode != GL_COMPILE && mode != GL_COMPILE_AND_EXECUTE) {
12978 _mesa_error(ctx, GL_INVALID_ENUM, "glNewList");
12979 return;
12980 }
12981
12982 if (ctx->ListState.CurrentList) {
12983 /* already compiling a display list */
12984 _mesa_error(ctx, GL_INVALID_OPERATION, "glNewList");
12985 return;
12986 }
12987
12988 ctx->CompileFlag = GL_TRUE;
12989 ctx->ExecuteFlag = (mode == GL_COMPILE_AND_EXECUTE);
12990
12991 /* Reset accumulated list state */
12992 invalidate_saved_current_state( ctx );
12993
12994 /* Allocate new display list */
12995 ctx->ListState.CurrentList = make_list(name, BLOCK_SIZE);
12996 ctx->ListState.CurrentBlock = ctx->ListState.CurrentList->Head;
12997 ctx->ListState.CurrentPos = 0;
12998
12999 vbo_save_NewList(ctx, name, mode);
13000
13001 ctx->CurrentServerDispatch = ctx->Save;
13002 _glapi_set_dispatch(ctx->CurrentServerDispatch);
13003 if (ctx->MarshalExec == NULL) {
13004 ctx->CurrentClientDispatch = ctx->CurrentServerDispatch;
13005 }
13006 }
13007
13008
13009 /**
13010 * End definition of current display list.
13011 */
13012 void GLAPIENTRY
13013 _mesa_EndList(void)
13014 {
13015 GET_CURRENT_CONTEXT(ctx);
13016 SAVE_FLUSH_VERTICES(ctx);
13017 FLUSH_VERTICES(ctx, 0);
13018
13019 if (MESA_VERBOSE & VERBOSE_API)
13020 _mesa_debug(ctx, "glEndList\n");
13021
13022 if (ctx->ExecuteFlag && _mesa_inside_dlist_begin_end(ctx)) {
13023 _mesa_error(ctx, GL_INVALID_OPERATION,
13024 "glEndList() called inside glBegin/End");
13025 }
13026
13027 /* Check that a list is under construction */
13028 if (!ctx->ListState.CurrentList) {
13029 _mesa_error(ctx, GL_INVALID_OPERATION, "glEndList");
13030 return;
13031 }
13032
13033 /* Call before emitting END_OF_LIST, in case the driver wants to
13034 * emit opcodes itself.
13035 */
13036 vbo_save_EndList(ctx);
13037
13038 (void) alloc_instruction(ctx, OPCODE_END_OF_LIST, 0);
13039
13040 trim_list(ctx);
13041
13042 /* Destroy old list, if any */
13043 destroy_list(ctx, ctx->ListState.CurrentList->Name);
13044
13045 /* Install the new list */
13046 _mesa_HashInsert(ctx->Shared->DisplayList,
13047 ctx->ListState.CurrentList->Name,
13048 ctx->ListState.CurrentList);
13049
13050
13051 if (MESA_VERBOSE & VERBOSE_DISPLAY_LIST)
13052 mesa_print_display_list(ctx->ListState.CurrentList->Name);
13053
13054 ctx->ListState.CurrentList = NULL;
13055 ctx->ListState.CurrentBlock = NULL;
13056 ctx->ListState.CurrentPos = 0;
13057 ctx->ExecuteFlag = GL_TRUE;
13058 ctx->CompileFlag = GL_FALSE;
13059
13060 ctx->CurrentServerDispatch = ctx->Exec;
13061 _glapi_set_dispatch(ctx->CurrentServerDispatch);
13062 if (ctx->MarshalExec == NULL) {
13063 ctx->CurrentClientDispatch = ctx->CurrentServerDispatch;
13064 }
13065 }
13066
13067
13068 void GLAPIENTRY
13069 _mesa_CallList(GLuint list)
13070 {
13071 GLboolean save_compile_flag;
13072 GET_CURRENT_CONTEXT(ctx);
13073 FLUSH_CURRENT(ctx, 0);
13074
13075 if (MESA_VERBOSE & VERBOSE_API)
13076 _mesa_debug(ctx, "glCallList %d\n", list);
13077
13078 if (list == 0) {
13079 _mesa_error(ctx, GL_INVALID_VALUE, "glCallList(list==0)");
13080 return;
13081 }
13082
13083 if (0)
13084 mesa_print_display_list( list );
13085
13086 /* VERY IMPORTANT: Save the CompileFlag status, turn it off,
13087 * execute the display list, and restore the CompileFlag.
13088 */
13089 save_compile_flag = ctx->CompileFlag;
13090 if (save_compile_flag) {
13091 ctx->CompileFlag = GL_FALSE;
13092 }
13093
13094 execute_list(ctx, list);
13095 ctx->CompileFlag = save_compile_flag;
13096
13097 /* also restore API function pointers to point to "save" versions */
13098 if (save_compile_flag) {
13099 ctx->CurrentServerDispatch = ctx->Save;
13100 _glapi_set_dispatch(ctx->CurrentServerDispatch);
13101 if (ctx->MarshalExec == NULL) {
13102 ctx->CurrentClientDispatch = ctx->CurrentServerDispatch;
13103 }
13104 }
13105 }
13106
13107
13108 /**
13109 * Try to execute a glCallLists() command where the display lists contain
13110 * glBitmap commands with a texture atlas.
13111 * \return true for success, false otherwise
13112 */
13113 static bool
13114 render_bitmap_atlas(struct gl_context *ctx, GLsizei n, GLenum type,
13115 const void *lists)
13116 {
13117 struct gl_bitmap_atlas *atlas;
13118 int i;
13119
13120 if (!USE_BITMAP_ATLAS ||
13121 !ctx->Current.RasterPosValid ||
13122 ctx->List.ListBase == 0 ||
13123 type != GL_UNSIGNED_BYTE ||
13124 !ctx->Driver.DrawAtlasBitmaps) {
13125 /* unsupported */
13126 return false;
13127 }
13128
13129 atlas = lookup_bitmap_atlas(ctx, ctx->List.ListBase);
13130
13131 if (!atlas) {
13132 /* Even if glGenLists wasn't called, we can still try to create
13133 * the atlas now.
13134 */
13135 atlas = alloc_bitmap_atlas(ctx, ctx->List.ListBase);
13136 }
13137
13138 if (atlas && !atlas->complete && !atlas->incomplete) {
13139 /* Try to build the bitmap atlas now.
13140 * If the atlas was created in glGenLists, we'll have recorded the
13141 * number of lists (bitmaps). Otherwise, take a guess at 256.
13142 */
13143 if (atlas->numBitmaps == 0)
13144 atlas->numBitmaps = 256;
13145 build_bitmap_atlas(ctx, atlas, ctx->List.ListBase);
13146 }
13147
13148 if (!atlas || !atlas->complete) {
13149 return false;
13150 }
13151
13152 /* check that all display list IDs are in the atlas */
13153 for (i = 0; i < n; i++) {
13154 const GLubyte *ids = (const GLubyte *) lists;
13155
13156 if (ids[i] >= atlas->numBitmaps) {
13157 return false;
13158 }
13159 }
13160
13161 ctx->Driver.DrawAtlasBitmaps(ctx, atlas, n, (const GLubyte *) lists);
13162
13163 return true;
13164 }
13165
13166
13167 /**
13168 * Execute glCallLists: call multiple display lists.
13169 */
13170 void GLAPIENTRY
13171 _mesa_CallLists(GLsizei n, GLenum type, const GLvoid * lists)
13172 {
13173 GET_CURRENT_CONTEXT(ctx);
13174 GLint i;
13175 GLboolean save_compile_flag;
13176
13177 if (MESA_VERBOSE & VERBOSE_API)
13178 _mesa_debug(ctx, "glCallLists %d\n", n);
13179
13180 switch (type) {
13181 case GL_BYTE:
13182 case GL_UNSIGNED_BYTE:
13183 case GL_SHORT:
13184 case GL_UNSIGNED_SHORT:
13185 case GL_INT:
13186 case GL_UNSIGNED_INT:
13187 case GL_FLOAT:
13188 case GL_2_BYTES:
13189 case GL_3_BYTES:
13190 case GL_4_BYTES:
13191 /* OK */
13192 break;
13193 default:
13194 _mesa_error(ctx, GL_INVALID_ENUM, "glCallLists(type)");
13195 return;
13196 }
13197
13198 if (n < 0) {
13199 _mesa_error(ctx, GL_INVALID_VALUE, "glCallLists(n < 0)");
13200 return;
13201 } else if (n == 0 || lists == NULL) {
13202 /* nothing to do */
13203 return;
13204 }
13205
13206 if (render_bitmap_atlas(ctx, n, type, lists)) {
13207 return;
13208 }
13209
13210 /* Save the CompileFlag status, turn it off, execute display list,
13211 * and restore the CompileFlag.
13212 */
13213 save_compile_flag = ctx->CompileFlag;
13214 ctx->CompileFlag = GL_FALSE;
13215
13216 for (i = 0; i < n; i++) {
13217 GLuint list = (GLuint) (ctx->List.ListBase + translate_id(i, type, lists));
13218 execute_list(ctx, list);
13219 }
13220
13221 ctx->CompileFlag = save_compile_flag;
13222
13223 /* also restore API function pointers to point to "save" versions */
13224 if (save_compile_flag) {
13225 ctx->CurrentServerDispatch = ctx->Save;
13226 _glapi_set_dispatch(ctx->CurrentServerDispatch);
13227 if (ctx->MarshalExec == NULL) {
13228 ctx->CurrentClientDispatch = ctx->CurrentServerDispatch;
13229 }
13230 }
13231 }
13232
13233
13234 /**
13235 * Set the offset added to list numbers in glCallLists.
13236 */
13237 void GLAPIENTRY
13238 _mesa_ListBase(GLuint base)
13239 {
13240 GET_CURRENT_CONTEXT(ctx);
13241 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
13242 ASSERT_OUTSIDE_BEGIN_END(ctx);
13243 ctx->List.ListBase = base;
13244 }
13245
13246 /**
13247 * Setup the given dispatch table to point to Mesa's display list
13248 * building functions.
13249 *
13250 * This does not include any of the tnl functions - they are
13251 * initialized from _mesa_init_api_defaults and from the active vtxfmt
13252 * struct.
13253 */
13254 void
13255 _mesa_initialize_save_table(const struct gl_context *ctx)
13256 {
13257 struct _glapi_table *table = ctx->Save;
13258 int numEntries = MAX2(_gloffset_COUNT, _glapi_get_dispatch_table_size());
13259
13260 /* Initially populate the dispatch table with the contents of the
13261 * normal-execution dispatch table. This lets us skip populating functions
13262 * that should be called directly instead of compiled into display lists.
13263 */
13264 memcpy(table, ctx->Exec, numEntries * sizeof(_glapi_proc));
13265
13266 _mesa_loopback_init_api_table(ctx, table);
13267
13268 /* VBO functions */
13269 vbo_initialize_save_dispatch(ctx, table);
13270
13271 /* GL 1.0 */
13272 SET_Accum(table, save_Accum);
13273 SET_AlphaFunc(table, save_AlphaFunc);
13274 SET_Bitmap(table, save_Bitmap);
13275 SET_BlendFunc(table, save_BlendFunc);
13276 SET_CallList(table, save_CallList);
13277 SET_CallLists(table, save_CallLists);
13278 SET_Clear(table, save_Clear);
13279 SET_ClearAccum(table, save_ClearAccum);
13280 SET_ClearColor(table, save_ClearColor);
13281 SET_ClearDepth(table, save_ClearDepth);
13282 SET_ClearIndex(table, save_ClearIndex);
13283 SET_ClearStencil(table, save_ClearStencil);
13284 SET_ClipPlane(table, save_ClipPlane);
13285 SET_ColorMask(table, save_ColorMask);
13286 SET_ColorMaski(table, save_ColorMaskIndexed);
13287 SET_ColorMaterial(table, save_ColorMaterial);
13288 SET_CopyPixels(table, save_CopyPixels);
13289 SET_CullFace(table, save_CullFace);
13290 SET_DepthFunc(table, save_DepthFunc);
13291 SET_DepthMask(table, save_DepthMask);
13292 SET_DepthRange(table, save_DepthRange);
13293 SET_Disable(table, save_Disable);
13294 SET_Disablei(table, save_DisableIndexed);
13295 SET_DrawBuffer(table, save_DrawBuffer);
13296 SET_DrawPixels(table, save_DrawPixels);
13297 SET_Enable(table, save_Enable);
13298 SET_Enablei(table, save_EnableIndexed);
13299 SET_EvalMesh1(table, save_EvalMesh1);
13300 SET_EvalMesh2(table, save_EvalMesh2);
13301 SET_Fogf(table, save_Fogf);
13302 SET_Fogfv(table, save_Fogfv);
13303 SET_Fogi(table, save_Fogi);
13304 SET_Fogiv(table, save_Fogiv);
13305 SET_FrontFace(table, save_FrontFace);
13306 SET_Frustum(table, save_Frustum);
13307 SET_Hint(table, save_Hint);
13308 SET_IndexMask(table, save_IndexMask);
13309 SET_InitNames(table, save_InitNames);
13310 SET_LightModelf(table, save_LightModelf);
13311 SET_LightModelfv(table, save_LightModelfv);
13312 SET_LightModeli(table, save_LightModeli);
13313 SET_LightModeliv(table, save_LightModeliv);
13314 SET_Lightf(table, save_Lightf);
13315 SET_Lightfv(table, save_Lightfv);
13316 SET_Lighti(table, save_Lighti);
13317 SET_Lightiv(table, save_Lightiv);
13318 SET_LineStipple(table, save_LineStipple);
13319 SET_LineWidth(table, save_LineWidth);
13320 SET_ListBase(table, save_ListBase);
13321 SET_LoadIdentity(table, save_LoadIdentity);
13322 SET_LoadMatrixd(table, save_LoadMatrixd);
13323 SET_LoadMatrixf(table, save_LoadMatrixf);
13324 SET_LoadName(table, save_LoadName);
13325 SET_LogicOp(table, save_LogicOp);
13326 SET_Map1d(table, save_Map1d);
13327 SET_Map1f(table, save_Map1f);
13328 SET_Map2d(table, save_Map2d);
13329 SET_Map2f(table, save_Map2f);
13330 SET_MapGrid1d(table, save_MapGrid1d);
13331 SET_MapGrid1f(table, save_MapGrid1f);
13332 SET_MapGrid2d(table, save_MapGrid2d);
13333 SET_MapGrid2f(table, save_MapGrid2f);
13334 SET_MatrixMode(table, save_MatrixMode);
13335 SET_MultMatrixd(table, save_MultMatrixd);
13336 SET_MultMatrixf(table, save_MultMatrixf);
13337 SET_NewList(table, save_NewList);
13338 SET_Ortho(table, save_Ortho);
13339 SET_PassThrough(table, save_PassThrough);
13340 SET_PixelMapfv(table, save_PixelMapfv);
13341 SET_PixelMapuiv(table, save_PixelMapuiv);
13342 SET_PixelMapusv(table, save_PixelMapusv);
13343 SET_PixelTransferf(table, save_PixelTransferf);
13344 SET_PixelTransferi(table, save_PixelTransferi);
13345 SET_PixelZoom(table, save_PixelZoom);
13346 SET_PointSize(table, save_PointSize);
13347 SET_PolygonMode(table, save_PolygonMode);
13348 SET_PolygonOffset(table, save_PolygonOffset);
13349 SET_PolygonStipple(table, save_PolygonStipple);
13350 SET_PopAttrib(table, save_PopAttrib);
13351 SET_PopMatrix(table, save_PopMatrix);
13352 SET_PopName(table, save_PopName);
13353 SET_PushAttrib(table, save_PushAttrib);
13354 SET_PushMatrix(table, save_PushMatrix);
13355 SET_PushName(table, save_PushName);
13356 SET_RasterPos2d(table, save_RasterPos2d);
13357 SET_RasterPos2dv(table, save_RasterPos2dv);
13358 SET_RasterPos2f(table, save_RasterPos2f);
13359 SET_RasterPos2fv(table, save_RasterPos2fv);
13360 SET_RasterPos2i(table, save_RasterPos2i);
13361 SET_RasterPos2iv(table, save_RasterPos2iv);
13362 SET_RasterPos2s(table, save_RasterPos2s);
13363 SET_RasterPos2sv(table, save_RasterPos2sv);
13364 SET_RasterPos3d(table, save_RasterPos3d);
13365 SET_RasterPos3dv(table, save_RasterPos3dv);
13366 SET_RasterPos3f(table, save_RasterPos3f);
13367 SET_RasterPos3fv(table, save_RasterPos3fv);
13368 SET_RasterPos3i(table, save_RasterPos3i);
13369 SET_RasterPos3iv(table, save_RasterPos3iv);
13370 SET_RasterPos3s(table, save_RasterPos3s);
13371 SET_RasterPos3sv(table, save_RasterPos3sv);
13372 SET_RasterPos4d(table, save_RasterPos4d);
13373 SET_RasterPos4dv(table, save_RasterPos4dv);
13374 SET_RasterPos4f(table, save_RasterPos4f);
13375 SET_RasterPos4fv(table, save_RasterPos4fv);
13376 SET_RasterPos4i(table, save_RasterPos4i);
13377 SET_RasterPos4iv(table, save_RasterPos4iv);
13378 SET_RasterPos4s(table, save_RasterPos4s);
13379 SET_RasterPos4sv(table, save_RasterPos4sv);
13380 SET_ReadBuffer(table, save_ReadBuffer);
13381 SET_Rectf(table, save_Rectf);
13382 SET_Rotated(table, save_Rotated);
13383 SET_Rotatef(table, save_Rotatef);
13384 SET_Scaled(table, save_Scaled);
13385 SET_Scalef(table, save_Scalef);
13386 SET_Scissor(table, save_Scissor);
13387 SET_ShadeModel(table, save_ShadeModel);
13388 SET_StencilFunc(table, save_StencilFunc);
13389 SET_StencilMask(table, save_StencilMask);
13390 SET_StencilOp(table, save_StencilOp);
13391 SET_TexEnvf(table, save_TexEnvf);
13392 SET_TexEnvfv(table, save_TexEnvfv);
13393 SET_TexEnvi(table, save_TexEnvi);
13394 SET_TexEnviv(table, save_TexEnviv);
13395 SET_TexGend(table, save_TexGend);
13396 SET_TexGendv(table, save_TexGendv);
13397 SET_TexGenf(table, save_TexGenf);
13398 SET_TexGenfv(table, save_TexGenfv);
13399 SET_TexGeni(table, save_TexGeni);
13400 SET_TexGeniv(table, save_TexGeniv);
13401 SET_TexImage1D(table, save_TexImage1D);
13402 SET_TexImage2D(table, save_TexImage2D);
13403 SET_TexParameterf(table, save_TexParameterf);
13404 SET_TexParameterfv(table, save_TexParameterfv);
13405 SET_TexParameteri(table, save_TexParameteri);
13406 SET_TexParameteriv(table, save_TexParameteriv);
13407 SET_Translated(table, save_Translated);
13408 SET_Translatef(table, save_Translatef);
13409 SET_Viewport(table, save_Viewport);
13410
13411 /* GL 1.1 */
13412 SET_BindTexture(table, save_BindTexture);
13413 SET_CopyTexImage1D(table, save_CopyTexImage1D);
13414 SET_CopyTexImage2D(table, save_CopyTexImage2D);
13415 SET_CopyTexSubImage1D(table, save_CopyTexSubImage1D);
13416 SET_CopyTexSubImage2D(table, save_CopyTexSubImage2D);
13417 SET_PrioritizeTextures(table, save_PrioritizeTextures);
13418 SET_TexSubImage1D(table, save_TexSubImage1D);
13419 SET_TexSubImage2D(table, save_TexSubImage2D);
13420
13421 /* GL 1.2 */
13422 SET_CopyTexSubImage3D(table, save_CopyTexSubImage3D);
13423 SET_TexImage3D(table, save_TexImage3D);
13424 SET_TexSubImage3D(table, save_TexSubImage3D);
13425
13426 /* GL 2.0 */
13427 SET_StencilFuncSeparate(table, save_StencilFuncSeparate);
13428 SET_StencilMaskSeparate(table, save_StencilMaskSeparate);
13429 SET_StencilOpSeparate(table, save_StencilOpSeparate);
13430
13431 /* ATI_separate_stencil */
13432 SET_StencilFuncSeparateATI(table, save_StencilFuncSeparateATI);
13433
13434 /* GL_ARB_imaging */
13435 /* Not all are supported */
13436 SET_BlendColor(table, save_BlendColor);
13437 SET_BlendEquation(table, save_BlendEquation);
13438
13439 /* 2. GL_EXT_blend_color */
13440 #if 0
13441 SET_BlendColorEXT(table, save_BlendColorEXT);
13442 #endif
13443
13444 /* 6. GL_EXT_texture3d */
13445 #if 0
13446 SET_CopyTexSubImage3DEXT(table, save_CopyTexSubImage3D);
13447 SET_TexImage3DEXT(table, save_TexImage3DEXT);
13448 SET_TexSubImage3DEXT(table, save_TexSubImage3D);
13449 #endif
13450
13451 /* 37. GL_EXT_blend_minmax */
13452 #if 0
13453 SET_BlendEquationEXT(table, save_BlendEquationEXT);
13454 #endif
13455
13456 /* 54. GL_EXT_point_parameters */
13457 SET_PointParameterf(table, save_PointParameterfEXT);
13458 SET_PointParameterfv(table, save_PointParameterfvEXT);
13459
13460 /* 91. GL_ARB_tessellation_shader */
13461 SET_PatchParameteri(table, save_PatchParameteri);
13462 SET_PatchParameterfv(table, save_PatchParameterfv);
13463
13464 /* 100. ARB_viewport_array */
13465 SET_ViewportArrayv(table, save_ViewportArrayv);
13466 SET_ViewportIndexedf(table, save_ViewportIndexedf);
13467 SET_ViewportIndexedfv(table, save_ViewportIndexedfv);
13468 SET_ScissorArrayv(table, save_ScissorArrayv);
13469 SET_ScissorIndexed(table, save_ScissorIndexed);
13470 SET_ScissorIndexedv(table, save_ScissorIndexedv);
13471 SET_DepthRangeArrayv(table, save_DepthRangeArrayv);
13472 SET_DepthRangeIndexed(table, save_DepthRangeIndexed);
13473
13474 /* 122. ARB_compute_shader */
13475 SET_DispatchCompute(table, save_DispatchCompute);
13476 SET_DispatchComputeIndirect(table, save_DispatchComputeIndirect);
13477
13478 /* 173. GL_EXT_blend_func_separate */
13479 SET_BlendFuncSeparate(table, save_BlendFuncSeparateEXT);
13480
13481 /* 197. GL_MESA_window_pos */
13482 SET_WindowPos2d(table, save_WindowPos2dMESA);
13483 SET_WindowPos2dv(table, save_WindowPos2dvMESA);
13484 SET_WindowPos2f(table, save_WindowPos2fMESA);
13485 SET_WindowPos2fv(table, save_WindowPos2fvMESA);
13486 SET_WindowPos2i(table, save_WindowPos2iMESA);
13487 SET_WindowPos2iv(table, save_WindowPos2ivMESA);
13488 SET_WindowPos2s(table, save_WindowPos2sMESA);
13489 SET_WindowPos2sv(table, save_WindowPos2svMESA);
13490 SET_WindowPos3d(table, save_WindowPos3dMESA);
13491 SET_WindowPos3dv(table, save_WindowPos3dvMESA);
13492 SET_WindowPos3f(table, save_WindowPos3fMESA);
13493 SET_WindowPos3fv(table, save_WindowPos3fvMESA);
13494 SET_WindowPos3i(table, save_WindowPos3iMESA);
13495 SET_WindowPos3iv(table, save_WindowPos3ivMESA);
13496 SET_WindowPos3s(table, save_WindowPos3sMESA);
13497 SET_WindowPos3sv(table, save_WindowPos3svMESA);
13498 SET_WindowPos4dMESA(table, save_WindowPos4dMESA);
13499 SET_WindowPos4dvMESA(table, save_WindowPos4dvMESA);
13500 SET_WindowPos4fMESA(table, save_WindowPos4fMESA);
13501 SET_WindowPos4fvMESA(table, save_WindowPos4fvMESA);
13502 SET_WindowPos4iMESA(table, save_WindowPos4iMESA);
13503 SET_WindowPos4ivMESA(table, save_WindowPos4ivMESA);
13504 SET_WindowPos4sMESA(table, save_WindowPos4sMESA);
13505 SET_WindowPos4svMESA(table, save_WindowPos4svMESA);
13506
13507 /* 245. GL_ATI_fragment_shader */
13508 SET_BindFragmentShaderATI(table, save_BindFragmentShaderATI);
13509 SET_SetFragmentShaderConstantATI(table, save_SetFragmentShaderConstantATI);
13510
13511 /* 262. GL_NV_point_sprite */
13512 SET_PointParameteri(table, save_PointParameteriNV);
13513 SET_PointParameteriv(table, save_PointParameterivNV);
13514
13515 /* 268. GL_EXT_stencil_two_side */
13516 SET_ActiveStencilFaceEXT(table, save_ActiveStencilFaceEXT);
13517
13518 /* ???. GL_EXT_depth_bounds_test */
13519 SET_DepthBoundsEXT(table, save_DepthBoundsEXT);
13520
13521 /* ARB 1. GL_ARB_multitexture */
13522 SET_ActiveTexture(table, save_ActiveTextureARB);
13523
13524 /* ARB 3. GL_ARB_transpose_matrix */
13525 SET_LoadTransposeMatrixd(table, save_LoadTransposeMatrixdARB);
13526 SET_LoadTransposeMatrixf(table, save_LoadTransposeMatrixfARB);
13527 SET_MultTransposeMatrixd(table, save_MultTransposeMatrixdARB);
13528 SET_MultTransposeMatrixf(table, save_MultTransposeMatrixfARB);
13529
13530 /* ARB 5. GL_ARB_multisample */
13531 SET_SampleCoverage(table, save_SampleCoverageARB);
13532
13533 /* ARB 12. GL_ARB_texture_compression */
13534 SET_CompressedTexImage3D(table, save_CompressedTexImage3DARB);
13535 SET_CompressedTexImage2D(table, save_CompressedTexImage2DARB);
13536 SET_CompressedTexImage1D(table, save_CompressedTexImage1DARB);
13537 SET_CompressedTexSubImage3D(table, save_CompressedTexSubImage3DARB);
13538 SET_CompressedTexSubImage2D(table, save_CompressedTexSubImage2DARB);
13539 SET_CompressedTexSubImage1D(table, save_CompressedTexSubImage1DARB);
13540
13541 /* ARB 14. GL_ARB_point_parameters */
13542 /* aliased with EXT_point_parameters functions */
13543
13544 /* ARB 25. GL_ARB_window_pos */
13545 /* aliased with MESA_window_pos functions */
13546
13547 /* ARB 26. GL_ARB_vertex_program */
13548 /* ARB 27. GL_ARB_fragment_program */
13549 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
13550 SET_ProgramStringARB(table, save_ProgramStringARB);
13551 SET_BindProgramARB(table, save_BindProgramARB);
13552 SET_ProgramEnvParameter4dARB(table, save_ProgramEnvParameter4dARB);
13553 SET_ProgramEnvParameter4dvARB(table, save_ProgramEnvParameter4dvARB);
13554 SET_ProgramEnvParameter4fARB(table, save_ProgramEnvParameter4fARB);
13555 SET_ProgramEnvParameter4fvARB(table, save_ProgramEnvParameter4fvARB);
13556 SET_ProgramLocalParameter4dARB(table, save_ProgramLocalParameter4dARB);
13557 SET_ProgramLocalParameter4dvARB(table, save_ProgramLocalParameter4dvARB);
13558 SET_ProgramLocalParameter4fARB(table, save_ProgramLocalParameter4fARB);
13559 SET_ProgramLocalParameter4fvARB(table, save_ProgramLocalParameter4fvARB);
13560
13561 SET_BeginQuery(table, save_BeginQueryARB);
13562 SET_EndQuery(table, save_EndQueryARB);
13563 SET_QueryCounter(table, save_QueryCounter);
13564
13565 SET_DrawBuffers(table, save_DrawBuffersARB);
13566
13567 SET_BlitFramebuffer(table, save_BlitFramebufferEXT);
13568
13569 SET_UseProgram(table, save_UseProgram);
13570 SET_Uniform1f(table, save_Uniform1fARB);
13571 SET_Uniform2f(table, save_Uniform2fARB);
13572 SET_Uniform3f(table, save_Uniform3fARB);
13573 SET_Uniform4f(table, save_Uniform4fARB);
13574 SET_Uniform1fv(table, save_Uniform1fvARB);
13575 SET_Uniform2fv(table, save_Uniform2fvARB);
13576 SET_Uniform3fv(table, save_Uniform3fvARB);
13577 SET_Uniform4fv(table, save_Uniform4fvARB);
13578 SET_Uniform1i(table, save_Uniform1iARB);
13579 SET_Uniform2i(table, save_Uniform2iARB);
13580 SET_Uniform3i(table, save_Uniform3iARB);
13581 SET_Uniform4i(table, save_Uniform4iARB);
13582 SET_Uniform1iv(table, save_Uniform1ivARB);
13583 SET_Uniform2iv(table, save_Uniform2ivARB);
13584 SET_Uniform3iv(table, save_Uniform3ivARB);
13585 SET_Uniform4iv(table, save_Uniform4ivARB);
13586 SET_UniformMatrix2fv(table, save_UniformMatrix2fvARB);
13587 SET_UniformMatrix3fv(table, save_UniformMatrix3fvARB);
13588 SET_UniformMatrix4fv(table, save_UniformMatrix4fvARB);
13589 SET_UniformMatrix2x3fv(table, save_UniformMatrix2x3fv);
13590 SET_UniformMatrix3x2fv(table, save_UniformMatrix3x2fv);
13591 SET_UniformMatrix2x4fv(table, save_UniformMatrix2x4fv);
13592 SET_UniformMatrix4x2fv(table, save_UniformMatrix4x2fv);
13593 SET_UniformMatrix3x4fv(table, save_UniformMatrix3x4fv);
13594 SET_UniformMatrix4x3fv(table, save_UniformMatrix4x3fv);
13595
13596 /* 299. GL_EXT_blend_equation_separate */
13597 SET_BlendEquationSeparate(table, save_BlendEquationSeparateEXT);
13598
13599 /* GL_EXT_gpu_program_parameters */
13600 SET_ProgramEnvParameters4fvEXT(table, save_ProgramEnvParameters4fvEXT);
13601 SET_ProgramLocalParameters4fvEXT(table, save_ProgramLocalParameters4fvEXT);
13602
13603 /* 364. GL_EXT_provoking_vertex */
13604 SET_ProvokingVertex(table, save_ProvokingVertexEXT);
13605
13606 /* GL_EXT_texture_integer */
13607 SET_ClearColorIiEXT(table, save_ClearColorIi);
13608 SET_ClearColorIuiEXT(table, save_ClearColorIui);
13609 SET_TexParameterIiv(table, save_TexParameterIiv);
13610 SET_TexParameterIuiv(table, save_TexParameterIuiv);
13611
13612 /* GL_ARB_clip_control */
13613 SET_ClipControl(table, save_ClipControl);
13614
13615 /* GL_ARB_color_buffer_float */
13616 SET_ClampColor(table, save_ClampColorARB);
13617
13618 /* GL 3.0 */
13619 SET_ClearBufferiv(table, save_ClearBufferiv);
13620 SET_ClearBufferuiv(table, save_ClearBufferuiv);
13621 SET_ClearBufferfv(table, save_ClearBufferfv);
13622 SET_ClearBufferfi(table, save_ClearBufferfi);
13623 SET_Uniform1ui(table, save_Uniform1ui);
13624 SET_Uniform2ui(table, save_Uniform2ui);
13625 SET_Uniform3ui(table, save_Uniform3ui);
13626 SET_Uniform4ui(table, save_Uniform4ui);
13627 SET_Uniform1uiv(table, save_Uniform1uiv);
13628 SET_Uniform2uiv(table, save_Uniform2uiv);
13629 SET_Uniform3uiv(table, save_Uniform3uiv);
13630 SET_Uniform4uiv(table, save_Uniform4uiv);
13631
13632 /* GL_ARB_gpu_shader_fp64 */
13633 SET_Uniform1d(table, save_Uniform1d);
13634 SET_Uniform2d(table, save_Uniform2d);
13635 SET_Uniform3d(table, save_Uniform3d);
13636 SET_Uniform4d(table, save_Uniform4d);
13637 SET_Uniform1dv(table, save_Uniform1dv);
13638 SET_Uniform2dv(table, save_Uniform2dv);
13639 SET_Uniform3dv(table, save_Uniform3dv);
13640 SET_Uniform4dv(table, save_Uniform4dv);
13641 SET_UniformMatrix2dv(table, save_UniformMatrix2dv);
13642 SET_UniformMatrix3dv(table, save_UniformMatrix3dv);
13643 SET_UniformMatrix4dv(table, save_UniformMatrix4dv);
13644 SET_UniformMatrix2x3dv(table, save_UniformMatrix2x3dv);
13645 SET_UniformMatrix3x2dv(table, save_UniformMatrix3x2dv);
13646 SET_UniformMatrix2x4dv(table, save_UniformMatrix2x4dv);
13647 SET_UniformMatrix4x2dv(table, save_UniformMatrix4x2dv);
13648 SET_UniformMatrix3x4dv(table, save_UniformMatrix3x4dv);
13649 SET_UniformMatrix4x3dv(table, save_UniformMatrix4x3dv);
13650
13651 /* These are: */
13652 SET_BeginTransformFeedback(table, save_BeginTransformFeedback);
13653 SET_EndTransformFeedback(table, save_EndTransformFeedback);
13654 SET_BindTransformFeedback(table, save_BindTransformFeedback);
13655 SET_PauseTransformFeedback(table, save_PauseTransformFeedback);
13656 SET_ResumeTransformFeedback(table, save_ResumeTransformFeedback);
13657 SET_DrawTransformFeedback(table, save_DrawTransformFeedback);
13658 SET_DrawTransformFeedbackStream(table, save_DrawTransformFeedbackStream);
13659 SET_DrawTransformFeedbackInstanced(table,
13660 save_DrawTransformFeedbackInstanced);
13661 SET_DrawTransformFeedbackStreamInstanced(table,
13662 save_DrawTransformFeedbackStreamInstanced);
13663 SET_BeginQueryIndexed(table, save_BeginQueryIndexed);
13664 SET_EndQueryIndexed(table, save_EndQueryIndexed);
13665
13666 /* GL_ARB_instanced_arrays */
13667 SET_VertexAttribDivisor(table, save_VertexAttribDivisor);
13668
13669 /* GL_NV_texture_barrier */
13670 SET_TextureBarrierNV(table, save_TextureBarrierNV);
13671
13672 SET_BindSampler(table, save_BindSampler);
13673 SET_SamplerParameteri(table, save_SamplerParameteri);
13674 SET_SamplerParameterf(table, save_SamplerParameterf);
13675 SET_SamplerParameteriv(table, save_SamplerParameteriv);
13676 SET_SamplerParameterfv(table, save_SamplerParameterfv);
13677 SET_SamplerParameterIiv(table, save_SamplerParameterIiv);
13678 SET_SamplerParameterIuiv(table, save_SamplerParameterIuiv);
13679
13680 /* GL_ARB_draw_buffer_blend */
13681 SET_BlendFunciARB(table, save_BlendFunci);
13682 SET_BlendFuncSeparateiARB(table, save_BlendFuncSeparatei);
13683 SET_BlendEquationiARB(table, save_BlendEquationi);
13684 SET_BlendEquationSeparateiARB(table, save_BlendEquationSeparatei);
13685
13686 /* GL_NV_conditional_render */
13687 SET_BeginConditionalRender(table, save_BeginConditionalRender);
13688 SET_EndConditionalRender(table, save_EndConditionalRender);
13689
13690 /* GL_ARB_sync */
13691 SET_WaitSync(table, save_WaitSync);
13692
13693 /* GL_ARB_uniform_buffer_object */
13694 SET_UniformBlockBinding(table, save_UniformBlockBinding);
13695
13696 /* GL_ARB_shader_subroutines */
13697 SET_UniformSubroutinesuiv(table, save_UniformSubroutinesuiv);
13698
13699 /* GL_ARB_draw_instanced */
13700 SET_DrawArraysInstancedARB(table, save_DrawArraysInstancedARB);
13701 SET_DrawElementsInstancedARB(table, save_DrawElementsInstancedARB);
13702
13703 /* GL_ARB_draw_elements_base_vertex */
13704 SET_DrawElementsInstancedBaseVertex(table, save_DrawElementsInstancedBaseVertexARB);
13705
13706 /* GL_ARB_base_instance */
13707 SET_DrawArraysInstancedBaseInstance(table, save_DrawArraysInstancedBaseInstance);
13708 SET_DrawElementsInstancedBaseInstance(table, save_DrawElementsInstancedBaseInstance);
13709 SET_DrawElementsInstancedBaseVertexBaseInstance(table, save_DrawElementsInstancedBaseVertexBaseInstance);
13710
13711 /* GL_ARB_draw_indirect / GL_ARB_multi_draw_indirect */
13712 SET_DrawArraysIndirect(table, save_DrawArraysIndirect);
13713 SET_DrawElementsIndirect(table, save_DrawElementsIndirect);
13714 SET_MultiDrawArraysIndirect(table, save_MultiDrawArraysIndirect);
13715 SET_MultiDrawElementsIndirect(table, save_MultiDrawElementsIndirect);
13716
13717 /* OpenGL 4.2 / GL_ARB_separate_shader_objects */
13718 SET_UseProgramStages(table, save_UseProgramStages);
13719 SET_ProgramUniform1f(table, save_ProgramUniform1f);
13720 SET_ProgramUniform2f(table, save_ProgramUniform2f);
13721 SET_ProgramUniform3f(table, save_ProgramUniform3f);
13722 SET_ProgramUniform4f(table, save_ProgramUniform4f);
13723 SET_ProgramUniform1fv(table, save_ProgramUniform1fv);
13724 SET_ProgramUniform2fv(table, save_ProgramUniform2fv);
13725 SET_ProgramUniform3fv(table, save_ProgramUniform3fv);
13726 SET_ProgramUniform4fv(table, save_ProgramUniform4fv);
13727 SET_ProgramUniform1d(table, save_ProgramUniform1d);
13728 SET_ProgramUniform2d(table, save_ProgramUniform2d);
13729 SET_ProgramUniform3d(table, save_ProgramUniform3d);
13730 SET_ProgramUniform4d(table, save_ProgramUniform4d);
13731 SET_ProgramUniform1dv(table, save_ProgramUniform1dv);
13732 SET_ProgramUniform2dv(table, save_ProgramUniform2dv);
13733 SET_ProgramUniform3dv(table, save_ProgramUniform3dv);
13734 SET_ProgramUniform4dv(table, save_ProgramUniform4dv);
13735 SET_ProgramUniform1i(table, save_ProgramUniform1i);
13736 SET_ProgramUniform2i(table, save_ProgramUniform2i);
13737 SET_ProgramUniform3i(table, save_ProgramUniform3i);
13738 SET_ProgramUniform4i(table, save_ProgramUniform4i);
13739 SET_ProgramUniform1iv(table, save_ProgramUniform1iv);
13740 SET_ProgramUniform2iv(table, save_ProgramUniform2iv);
13741 SET_ProgramUniform3iv(table, save_ProgramUniform3iv);
13742 SET_ProgramUniform4iv(table, save_ProgramUniform4iv);
13743 SET_ProgramUniform1ui(table, save_ProgramUniform1ui);
13744 SET_ProgramUniform2ui(table, save_ProgramUniform2ui);
13745 SET_ProgramUniform3ui(table, save_ProgramUniform3ui);
13746 SET_ProgramUniform4ui(table, save_ProgramUniform4ui);
13747 SET_ProgramUniform1uiv(table, save_ProgramUniform1uiv);
13748 SET_ProgramUniform2uiv(table, save_ProgramUniform2uiv);
13749 SET_ProgramUniform3uiv(table, save_ProgramUniform3uiv);
13750 SET_ProgramUniform4uiv(table, save_ProgramUniform4uiv);
13751 SET_ProgramUniformMatrix2fv(table, save_ProgramUniformMatrix2fv);
13752 SET_ProgramUniformMatrix3fv(table, save_ProgramUniformMatrix3fv);
13753 SET_ProgramUniformMatrix4fv(table, save_ProgramUniformMatrix4fv);
13754 SET_ProgramUniformMatrix2x3fv(table, save_ProgramUniformMatrix2x3fv);
13755 SET_ProgramUniformMatrix3x2fv(table, save_ProgramUniformMatrix3x2fv);
13756 SET_ProgramUniformMatrix2x4fv(table, save_ProgramUniformMatrix2x4fv);
13757 SET_ProgramUniformMatrix4x2fv(table, save_ProgramUniformMatrix4x2fv);
13758 SET_ProgramUniformMatrix3x4fv(table, save_ProgramUniformMatrix3x4fv);
13759 SET_ProgramUniformMatrix4x3fv(table, save_ProgramUniformMatrix4x3fv);
13760 SET_ProgramUniformMatrix2dv(table, save_ProgramUniformMatrix2dv);
13761 SET_ProgramUniformMatrix3dv(table, save_ProgramUniformMatrix3dv);
13762 SET_ProgramUniformMatrix4dv(table, save_ProgramUniformMatrix4dv);
13763 SET_ProgramUniformMatrix2x3dv(table, save_ProgramUniformMatrix2x3dv);
13764 SET_ProgramUniformMatrix3x2dv(table, save_ProgramUniformMatrix3x2dv);
13765 SET_ProgramUniformMatrix2x4dv(table, save_ProgramUniformMatrix2x4dv);
13766 SET_ProgramUniformMatrix4x2dv(table, save_ProgramUniformMatrix4x2dv);
13767 SET_ProgramUniformMatrix3x4dv(table, save_ProgramUniformMatrix3x4dv);
13768 SET_ProgramUniformMatrix4x3dv(table, save_ProgramUniformMatrix4x3dv);
13769
13770 /* GL_{ARB,EXT}_polygon_offset_clamp */
13771 SET_PolygonOffsetClampEXT(table, save_PolygonOffsetClampEXT);
13772
13773 /* GL_EXT_window_rectangles */
13774 SET_WindowRectanglesEXT(table, save_WindowRectanglesEXT);
13775
13776 /* GL_NV_conservative_raster */
13777 SET_SubpixelPrecisionBiasNV(table, save_SubpixelPrecisionBiasNV);
13778
13779 /* GL_NV_conservative_raster_dilate */
13780 SET_ConservativeRasterParameterfNV(table, save_ConservativeRasterParameterfNV);
13781
13782 /* GL_NV_conservative_raster_pre_snap_triangles */
13783 SET_ConservativeRasterParameteriNV(table, save_ConservativeRasterParameteriNV);
13784
13785 /* GL_EXT_direct_state_access */
13786 SET_MatrixLoadfEXT(table, save_MatrixLoadfEXT);
13787 SET_MatrixLoaddEXT(table, save_MatrixLoaddEXT);
13788 SET_MatrixMultfEXT(table, save_MatrixMultfEXT);
13789 SET_MatrixMultdEXT(table, save_MatrixMultdEXT);
13790 SET_MatrixRotatefEXT(table, save_MatrixRotatefEXT);
13791 SET_MatrixRotatedEXT(table, save_MatrixRotatedEXT);
13792 SET_MatrixScalefEXT(table, save_MatrixScalefEXT);
13793 SET_MatrixScaledEXT(table, save_MatrixScaledEXT);
13794 SET_MatrixTranslatefEXT(table, save_MatrixTranslatefEXT);
13795 SET_MatrixTranslatedEXT(table, save_MatrixTranslatedEXT);
13796 SET_MatrixLoadIdentityEXT(table, save_MatrixLoadIdentityEXT);
13797 SET_MatrixOrthoEXT(table, save_MatrixOrthoEXT);
13798 SET_MatrixFrustumEXT(table, save_MatrixFrustumEXT);
13799 SET_MatrixPushEXT(table, save_MatrixPushEXT);
13800 SET_MatrixPopEXT(table, save_MatrixPopEXT);
13801 SET_MatrixLoadTransposefEXT(table, save_MatrixLoadTransposefEXT);
13802 SET_MatrixLoadTransposedEXT(table, save_MatrixLoadTransposedEXT);
13803 SET_MatrixMultTransposefEXT(table, save_MatrixMultTransposefEXT);
13804 SET_MatrixMultTransposedEXT(table, save_MatrixMultTransposedEXT);
13805 SET_TextureParameteriEXT(table, save_TextureParameteriEXT);
13806 SET_TextureParameterivEXT(table, save_TextureParameterivEXT);
13807 SET_TextureParameterfEXT(table, save_TextureParameterfEXT);
13808 SET_TextureParameterfvEXT(table, save_TextureParameterfvEXT);
13809 SET_TextureImage1DEXT(table, save_TextureImage1DEXT);
13810 SET_TextureImage2DEXT(table, save_TextureImage2DEXT);
13811 SET_TextureImage3DEXT(table, save_TextureImage3DEXT);
13812 SET_TextureSubImage1DEXT(table, save_TextureSubImage1DEXT);
13813 SET_TextureSubImage2DEXT(table, save_TextureSubImage2DEXT);
13814 SET_TextureSubImage3DEXT(table, save_TextureSubImage3DEXT);
13815 SET_CopyTextureImage1DEXT(table, save_CopyTextureImage1DEXT);
13816 SET_CopyTextureImage2DEXT(table, save_CopyTextureImage2DEXT);
13817 SET_CopyTextureSubImage1DEXT(table, save_CopyTextureSubImage1DEXT);
13818 SET_CopyTextureSubImage2DEXT(table, save_CopyTextureSubImage2DEXT);
13819 SET_CopyTextureSubImage3DEXT(table, save_CopyTextureSubImage3DEXT);
13820 SET_BindMultiTextureEXT(table, save_BindMultiTextureEXT);
13821 SET_MultiTexParameteriEXT(table, save_MultiTexParameteriEXT);
13822 SET_MultiTexParameterivEXT(table, save_MultiTexParameterivEXT);
13823 SET_MultiTexParameterfEXT(table, save_MultiTexParameterfEXT);
13824 SET_MultiTexParameterfvEXT(table, save_MultiTexParameterfvEXT);
13825 SET_MultiTexImage1DEXT(table, save_MultiTexImage1DEXT);
13826 SET_MultiTexImage2DEXT(table, save_MultiTexImage2DEXT);
13827 SET_MultiTexImage3DEXT(table, save_MultiTexImage3DEXT);
13828 SET_MultiTexSubImage1DEXT(table, save_MultiTexSubImage1DEXT);
13829 SET_MultiTexSubImage2DEXT(table, save_MultiTexSubImage2DEXT);
13830 SET_MultiTexSubImage3DEXT(table, save_MultiTexSubImage3DEXT);
13831 SET_CopyMultiTexImage1DEXT(table, save_CopyMultiTexImage1DEXT);
13832 SET_CopyMultiTexImage2DEXT(table, save_CopyMultiTexImage2DEXT);
13833 SET_CopyMultiTexSubImage1DEXT(table, save_CopyMultiTexSubImage1DEXT);
13834 SET_CopyMultiTexSubImage2DEXT(table, save_CopyMultiTexSubImage2DEXT);
13835 SET_CopyMultiTexSubImage3DEXT(table, save_CopyMultiTexSubImage3DEXT);
13836 SET_MultiTexEnvfEXT(table, save_MultiTexEnvfEXT);
13837 SET_MultiTexEnvfvEXT(table, save_MultiTexEnvfvEXT);
13838 SET_MultiTexEnviEXT(table, save_MultiTexEnviEXT);
13839 SET_MultiTexEnvivEXT(table, save_MultiTexEnvivEXT);
13840 SET_CompressedTextureImage1DEXT(table, save_CompressedTextureImage1DEXT);
13841 SET_CompressedTextureImage2DEXT(table, save_CompressedTextureImage2DEXT);
13842 SET_CompressedTextureImage3DEXT(table, save_CompressedTextureImage3DEXT);
13843 SET_CompressedTextureSubImage1DEXT(table, save_CompressedTextureSubImage1DEXT);
13844 SET_CompressedTextureSubImage2DEXT(table, save_CompressedTextureSubImage2DEXT);
13845 SET_CompressedTextureSubImage3DEXT(table, save_CompressedTextureSubImage3DEXT);
13846 SET_CompressedMultiTexImage1DEXT(table, save_CompressedMultiTexImage1DEXT);
13847 SET_CompressedMultiTexImage2DEXT(table, save_CompressedMultiTexImage2DEXT);
13848 SET_CompressedMultiTexImage3DEXT(table, save_CompressedMultiTexImage3DEXT);
13849 SET_CompressedMultiTexSubImage1DEXT(table, save_CompressedMultiTexSubImage1DEXT);
13850 SET_CompressedMultiTexSubImage2DEXT(table, save_CompressedMultiTexSubImage2DEXT);
13851 SET_CompressedMultiTexSubImage3DEXT(table, save_CompressedMultiTexSubImage3DEXT);
13852 }
13853
13854
13855
13856 static const char *
13857 enum_string(GLenum k)
13858 {
13859 return _mesa_enum_to_string(k);
13860 }
13861
13862
13863 /**
13864 * Print the commands in a display list. For debugging only.
13865 * TODO: many commands aren't handled yet.
13866 * \param fname filename to write display list to. If null, use stdout.
13867 */
13868 static void GLAPIENTRY
13869 print_list(struct gl_context *ctx, GLuint list, const char *fname)
13870 {
13871 struct gl_display_list *dlist;
13872 Node *n;
13873 GLboolean done;
13874 FILE *f = stdout;
13875
13876 if (fname) {
13877 f = fopen(fname, "w");
13878 if (!f)
13879 return;
13880 }
13881
13882 if (!islist(ctx, list)) {
13883 fprintf(f, "%u is not a display list ID\n", list);
13884 goto out;
13885 }
13886
13887 dlist = _mesa_lookup_list(ctx, list);
13888 if (!dlist) {
13889 goto out;
13890 }
13891
13892 n = dlist->Head;
13893
13894 fprintf(f, "START-LIST %u, address %p\n", list, (void *) n);
13895
13896 done = n ? GL_FALSE : GL_TRUE;
13897 while (!done) {
13898 const OpCode opcode = n[0].opcode;
13899
13900 if (is_ext_opcode(opcode)) {
13901 n += ext_opcode_print(ctx, n, f);
13902 }
13903 else {
13904 switch (opcode) {
13905 case OPCODE_ACCUM:
13906 fprintf(f, "Accum %s %g\n", enum_string(n[1].e), n[2].f);
13907 break;
13908 case OPCODE_ACTIVE_TEXTURE:
13909 fprintf(f, "ActiveTexture(%s)\n", enum_string(n[1].e));
13910 break;
13911 case OPCODE_BITMAP:
13912 fprintf(f, "Bitmap %d %d %g %g %g %g %p\n", n[1].i, n[2].i,
13913 n[3].f, n[4].f, n[5].f, n[6].f,
13914 get_pointer(&n[7]));
13915 break;
13916 case OPCODE_BLEND_COLOR:
13917 fprintf(f, "BlendColor %f, %f, %f, %f\n",
13918 n[1].f, n[2].f, n[3].f, n[4].f);
13919 break;
13920 case OPCODE_BLEND_EQUATION:
13921 fprintf(f, "BlendEquation %s\n",
13922 enum_string(n[1].e));
13923 break;
13924 case OPCODE_BLEND_EQUATION_SEPARATE:
13925 fprintf(f, "BlendEquationSeparate %s, %s\n",
13926 enum_string(n[1].e),
13927 enum_string(n[2].e));
13928 break;
13929 case OPCODE_BLEND_FUNC_SEPARATE:
13930 fprintf(f, "BlendFuncSeparate %s, %s, %s, %s\n",
13931 enum_string(n[1].e),
13932 enum_string(n[2].e),
13933 enum_string(n[3].e),
13934 enum_string(n[4].e));
13935 break;
13936 case OPCODE_BLEND_EQUATION_I:
13937 fprintf(f, "BlendEquationi %u, %s\n",
13938 n[1].ui, enum_string(n[2].e));
13939 break;
13940 case OPCODE_BLEND_EQUATION_SEPARATE_I:
13941 fprintf(f, "BlendEquationSeparatei %u, %s, %s\n",
13942 n[1].ui, enum_string(n[2].e), enum_string(n[3].e));
13943 break;
13944 case OPCODE_BLEND_FUNC_I:
13945 fprintf(f, "BlendFunci %u, %s, %s\n",
13946 n[1].ui, enum_string(n[2].e), enum_string(n[3].e));
13947 break;
13948 case OPCODE_BLEND_FUNC_SEPARATE_I:
13949 fprintf(f, "BlendFuncSeparatei %u, %s, %s, %s, %s\n",
13950 n[1].ui,
13951 enum_string(n[2].e),
13952 enum_string(n[3].e),
13953 enum_string(n[4].e),
13954 enum_string(n[5].e));
13955 break;
13956 case OPCODE_CALL_LIST:
13957 fprintf(f, "CallList %d\n", (int) n[1].ui);
13958 break;
13959 case OPCODE_CALL_LISTS:
13960 fprintf(f, "CallLists %d, %s\n", n[1].i, enum_string(n[1].e));
13961 break;
13962 case OPCODE_DISABLE:
13963 fprintf(f, "Disable %s\n", enum_string(n[1].e));
13964 break;
13965 case OPCODE_ENABLE:
13966 fprintf(f, "Enable %s\n", enum_string(n[1].e));
13967 break;
13968 case OPCODE_FRUSTUM:
13969 fprintf(f, "Frustum %g %g %g %g %g %g\n",
13970 n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f);
13971 break;
13972 case OPCODE_LINE_STIPPLE:
13973 fprintf(f, "LineStipple %d %x\n", n[1].i, (int) n[2].us);
13974 break;
13975 case OPCODE_LINE_WIDTH:
13976 fprintf(f, "LineWidth %f\n", n[1].f);
13977 break;
13978 case OPCODE_LOAD_IDENTITY:
13979 fprintf(f, "LoadIdentity\n");
13980 break;
13981 case OPCODE_LOAD_MATRIX:
13982 fprintf(f, "LoadMatrix\n");
13983 fprintf(f, " %8f %8f %8f %8f\n",
13984 n[1].f, n[5].f, n[9].f, n[13].f);
13985 fprintf(f, " %8f %8f %8f %8f\n",
13986 n[2].f, n[6].f, n[10].f, n[14].f);
13987 fprintf(f, " %8f %8f %8f %8f\n",
13988 n[3].f, n[7].f, n[11].f, n[15].f);
13989 fprintf(f, " %8f %8f %8f %8f\n",
13990 n[4].f, n[8].f, n[12].f, n[16].f);
13991 break;
13992 case OPCODE_MULT_MATRIX:
13993 fprintf(f, "MultMatrix (or Rotate)\n");
13994 fprintf(f, " %8f %8f %8f %8f\n",
13995 n[1].f, n[5].f, n[9].f, n[13].f);
13996 fprintf(f, " %8f %8f %8f %8f\n",
13997 n[2].f, n[6].f, n[10].f, n[14].f);
13998 fprintf(f, " %8f %8f %8f %8f\n",
13999 n[3].f, n[7].f, n[11].f, n[15].f);
14000 fprintf(f, " %8f %8f %8f %8f\n",
14001 n[4].f, n[8].f, n[12].f, n[16].f);
14002 break;
14003 case OPCODE_ORTHO:
14004 fprintf(f, "Ortho %g %g %g %g %g %g\n",
14005 n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f);
14006 break;
14007 case OPCODE_POINT_SIZE:
14008 fprintf(f, "PointSize %f\n", n[1].f);
14009 break;
14010 case OPCODE_POP_ATTRIB:
14011 fprintf(f, "PopAttrib\n");
14012 break;
14013 case OPCODE_POP_MATRIX:
14014 fprintf(f, "PopMatrix\n");
14015 break;
14016 case OPCODE_POP_NAME:
14017 fprintf(f, "PopName\n");
14018 break;
14019 case OPCODE_PUSH_ATTRIB:
14020 fprintf(f, "PushAttrib %x\n", n[1].bf);
14021 break;
14022 case OPCODE_PUSH_MATRIX:
14023 fprintf(f, "PushMatrix\n");
14024 break;
14025 case OPCODE_PUSH_NAME:
14026 fprintf(f, "PushName %d\n", (int) n[1].ui);
14027 break;
14028 case OPCODE_RASTER_POS:
14029 fprintf(f, "RasterPos %g %g %g %g\n",
14030 n[1].f, n[2].f, n[3].f, n[4].f);
14031 break;
14032 case OPCODE_ROTATE:
14033 fprintf(f, "Rotate %g %g %g %g\n",
14034 n[1].f, n[2].f, n[3].f, n[4].f);
14035 break;
14036 case OPCODE_SCALE:
14037 fprintf(f, "Scale %g %g %g\n", n[1].f, n[2].f, n[3].f);
14038 break;
14039 case OPCODE_TRANSLATE:
14040 fprintf(f, "Translate %g %g %g\n", n[1].f, n[2].f, n[3].f);
14041 break;
14042 case OPCODE_BIND_TEXTURE:
14043 fprintf(f, "BindTexture %s %d\n",
14044 _mesa_enum_to_string(n[1].ui), n[2].ui);
14045 break;
14046 case OPCODE_SHADE_MODEL:
14047 fprintf(f, "ShadeModel %s\n", _mesa_enum_to_string(n[1].ui));
14048 break;
14049 case OPCODE_MAP1:
14050 fprintf(f, "Map1 %s %.3f %.3f %d %d\n",
14051 _mesa_enum_to_string(n[1].ui),
14052 n[2].f, n[3].f, n[4].i, n[5].i);
14053 break;
14054 case OPCODE_MAP2:
14055 fprintf(f, "Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
14056 _mesa_enum_to_string(n[1].ui),
14057 n[2].f, n[3].f, n[4].f, n[5].f,
14058 n[6].i, n[7].i, n[8].i, n[9].i);
14059 break;
14060 case OPCODE_MAPGRID1:
14061 fprintf(f, "MapGrid1 %d %.3f %.3f\n", n[1].i, n[2].f, n[3].f);
14062 break;
14063 case OPCODE_MAPGRID2:
14064 fprintf(f, "MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
14065 n[1].i, n[2].f, n[3].f, n[4].i, n[5].f, n[6].f);
14066 break;
14067 case OPCODE_EVALMESH1:
14068 fprintf(f, "EvalMesh1 %d %d\n", n[1].i, n[2].i);
14069 break;
14070 case OPCODE_EVALMESH2:
14071 fprintf(f, "EvalMesh2 %d %d %d %d\n",
14072 n[1].i, n[2].i, n[3].i, n[4].i);
14073 break;
14074
14075 case OPCODE_ATTR_1F_NV:
14076 fprintf(f, "ATTR_1F_NV attr %d: %f\n", n[1].i, n[2].f);
14077 break;
14078 case OPCODE_ATTR_2F_NV:
14079 fprintf(f, "ATTR_2F_NV attr %d: %f %f\n",
14080 n[1].i, n[2].f, n[3].f);
14081 break;
14082 case OPCODE_ATTR_3F_NV:
14083 fprintf(f, "ATTR_3F_NV attr %d: %f %f %f\n",
14084 n[1].i, n[2].f, n[3].f, n[4].f);
14085 break;
14086 case OPCODE_ATTR_4F_NV:
14087 fprintf(f, "ATTR_4F_NV attr %d: %f %f %f %f\n",
14088 n[1].i, n[2].f, n[3].f, n[4].f, n[5].f);
14089 break;
14090 case OPCODE_ATTR_1F_ARB:
14091 fprintf(f, "ATTR_1F_ARB attr %d: %f\n", n[1].i, n[2].f);
14092 break;
14093 case OPCODE_ATTR_2F_ARB:
14094 fprintf(f, "ATTR_2F_ARB attr %d: %f %f\n",
14095 n[1].i, n[2].f, n[3].f);
14096 break;
14097 case OPCODE_ATTR_3F_ARB:
14098 fprintf(f, "ATTR_3F_ARB attr %d: %f %f %f\n",
14099 n[1].i, n[2].f, n[3].f, n[4].f);
14100 break;
14101 case OPCODE_ATTR_4F_ARB:
14102 fprintf(f, "ATTR_4F_ARB attr %d: %f %f %f %f\n",
14103 n[1].i, n[2].f, n[3].f, n[4].f, n[5].f);
14104 break;
14105
14106 case OPCODE_MATERIAL:
14107 fprintf(f, "MATERIAL %x %x: %f %f %f %f\n",
14108 n[1].i, n[2].i, n[3].f, n[4].f, n[5].f, n[6].f);
14109 break;
14110 case OPCODE_BEGIN:
14111 fprintf(f, "BEGIN %x\n", n[1].i);
14112 break;
14113 case OPCODE_END:
14114 fprintf(f, "END\n");
14115 break;
14116 case OPCODE_RECTF:
14117 fprintf(f, "RECTF %f %f %f %f\n", n[1].f, n[2].f, n[3].f,
14118 n[4].f);
14119 break;
14120 case OPCODE_EVAL_C1:
14121 fprintf(f, "EVAL_C1 %f\n", n[1].f);
14122 break;
14123 case OPCODE_EVAL_C2:
14124 fprintf(f, "EVAL_C2 %f %f\n", n[1].f, n[2].f);
14125 break;
14126 case OPCODE_EVAL_P1:
14127 fprintf(f, "EVAL_P1 %d\n", n[1].i);
14128 break;
14129 case OPCODE_EVAL_P2:
14130 fprintf(f, "EVAL_P2 %d %d\n", n[1].i, n[2].i);
14131 break;
14132
14133 case OPCODE_PROVOKING_VERTEX:
14134 fprintf(f, "ProvokingVertex %s\n",
14135 _mesa_enum_to_string(n[1].ui));
14136 break;
14137
14138 /*
14139 * meta opcodes/commands
14140 */
14141 case OPCODE_ERROR:
14142 fprintf(f, "Error: %s %s\n", enum_string(n[1].e),
14143 (const char *) get_pointer(&n[2]));
14144 break;
14145 case OPCODE_CONTINUE:
14146 fprintf(f, "DISPLAY-LIST-CONTINUE\n");
14147 n = (Node *) get_pointer(&n[1]);
14148 break;
14149 case OPCODE_NOP:
14150 fprintf(f, "NOP\n");
14151 break;
14152 case OPCODE_END_OF_LIST:
14153 fprintf(f, "END-LIST %u\n", list);
14154 done = GL_TRUE;
14155 break;
14156 default:
14157 if (opcode < 0 || opcode > OPCODE_END_OF_LIST) {
14158 printf
14159 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
14160 opcode, (void *) n);
14161 goto out;
14162 }
14163 else {
14164 fprintf(f, "command %d, %u operands\n", opcode,
14165 InstSize[opcode]);
14166 }
14167 }
14168 /* increment n to point to next compiled command */
14169 if (opcode != OPCODE_CONTINUE) {
14170 assert(InstSize[opcode] > 0);
14171 n += InstSize[opcode];
14172 }
14173 }
14174 }
14175
14176 out:
14177 fflush(f);
14178 if (fname)
14179 fclose(f);
14180 }
14181
14182
14183
14184 /**
14185 * Clients may call this function to help debug display list problems.
14186 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
14187 * changed, or break in the future without notice.
14188 */
14189 void
14190 mesa_print_display_list(GLuint list)
14191 {
14192 GET_CURRENT_CONTEXT(ctx);
14193 print_list(ctx, list, NULL);
14194 }
14195
14196
14197 /**********************************************************************/
14198 /***** Initialization *****/
14199 /**********************************************************************/
14200
14201 static void
14202 save_vtxfmt_init(GLvertexformat * vfmt)
14203 {
14204 vfmt->ArrayElement = _ae_ArrayElement;
14205
14206 vfmt->Begin = save_Begin;
14207
14208 vfmt->CallList = save_CallList;
14209 vfmt->CallLists = save_CallLists;
14210
14211 vfmt->Color3f = save_Color3f;
14212 vfmt->Color3fv = save_Color3fv;
14213 vfmt->Color4f = save_Color4f;
14214 vfmt->Color4fv = save_Color4fv;
14215 vfmt->EdgeFlag = save_EdgeFlag;
14216 vfmt->End = save_End;
14217
14218 vfmt->EvalCoord1f = save_EvalCoord1f;
14219 vfmt->EvalCoord1fv = save_EvalCoord1fv;
14220 vfmt->EvalCoord2f = save_EvalCoord2f;
14221 vfmt->EvalCoord2fv = save_EvalCoord2fv;
14222 vfmt->EvalPoint1 = save_EvalPoint1;
14223 vfmt->EvalPoint2 = save_EvalPoint2;
14224
14225 vfmt->FogCoordfEXT = save_FogCoordfEXT;
14226 vfmt->FogCoordfvEXT = save_FogCoordfvEXT;
14227 vfmt->Indexf = save_Indexf;
14228 vfmt->Indexfv = save_Indexfv;
14229 vfmt->Materialfv = save_Materialfv;
14230 vfmt->MultiTexCoord1fARB = save_MultiTexCoord1f;
14231 vfmt->MultiTexCoord1fvARB = save_MultiTexCoord1fv;
14232 vfmt->MultiTexCoord2fARB = save_MultiTexCoord2f;
14233 vfmt->MultiTexCoord2fvARB = save_MultiTexCoord2fv;
14234 vfmt->MultiTexCoord3fARB = save_MultiTexCoord3f;
14235 vfmt->MultiTexCoord3fvARB = save_MultiTexCoord3fv;
14236 vfmt->MultiTexCoord4fARB = save_MultiTexCoord4f;
14237 vfmt->MultiTexCoord4fvARB = save_MultiTexCoord4fv;
14238 vfmt->Normal3f = save_Normal3f;
14239 vfmt->Normal3fv = save_Normal3fv;
14240 vfmt->SecondaryColor3fEXT = save_SecondaryColor3fEXT;
14241 vfmt->SecondaryColor3fvEXT = save_SecondaryColor3fvEXT;
14242 vfmt->TexCoord1f = save_TexCoord1f;
14243 vfmt->TexCoord1fv = save_TexCoord1fv;
14244 vfmt->TexCoord2f = save_TexCoord2f;
14245 vfmt->TexCoord2fv = save_TexCoord2fv;
14246 vfmt->TexCoord3f = save_TexCoord3f;
14247 vfmt->TexCoord3fv = save_TexCoord3fv;
14248 vfmt->TexCoord4f = save_TexCoord4f;
14249 vfmt->TexCoord4fv = save_TexCoord4fv;
14250 vfmt->Vertex2f = save_Vertex2f;
14251 vfmt->Vertex2fv = save_Vertex2fv;
14252 vfmt->Vertex3f = save_Vertex3f;
14253 vfmt->Vertex3fv = save_Vertex3fv;
14254 vfmt->Vertex4f = save_Vertex4f;
14255 vfmt->Vertex4fv = save_Vertex4fv;
14256 vfmt->VertexAttrib1fARB = save_VertexAttrib1fARB;
14257 vfmt->VertexAttrib1fvARB = save_VertexAttrib1fvARB;
14258 vfmt->VertexAttrib2fARB = save_VertexAttrib2fARB;
14259 vfmt->VertexAttrib2fvARB = save_VertexAttrib2fvARB;
14260 vfmt->VertexAttrib3fARB = save_VertexAttrib3fARB;
14261 vfmt->VertexAttrib3fvARB = save_VertexAttrib3fvARB;
14262 vfmt->VertexAttrib4fARB = save_VertexAttrib4fARB;
14263 vfmt->VertexAttrib4fvARB = save_VertexAttrib4fvARB;
14264 vfmt->VertexAttribL1d = save_VertexAttribL1d;
14265 vfmt->VertexAttribL1dv = save_VertexAttribL1dv;
14266 vfmt->VertexAttribL2d = save_VertexAttribL2d;
14267 vfmt->VertexAttribL2dv = save_VertexAttribL2dv;
14268 vfmt->VertexAttribL3d = save_VertexAttribL3d;
14269 vfmt->VertexAttribL3dv = save_VertexAttribL3dv;
14270 vfmt->VertexAttribL4d = save_VertexAttribL4d;
14271 vfmt->VertexAttribL4dv = save_VertexAttribL4dv;
14272
14273 vfmt->PrimitiveRestartNV = save_PrimitiveRestartNV;
14274 }
14275
14276
14277 void
14278 _mesa_install_dlist_vtxfmt(struct _glapi_table *disp,
14279 const GLvertexformat *vfmt)
14280 {
14281 SET_CallList(disp, vfmt->CallList);
14282 SET_CallLists(disp, vfmt->CallLists);
14283 }
14284
14285
14286 /**
14287 * Initialize display list state for given context.
14288 */
14289 void
14290 _mesa_init_display_list(struct gl_context *ctx)
14291 {
14292 static GLboolean tableInitialized = GL_FALSE;
14293
14294 /* zero-out the instruction size table, just once */
14295 if (!tableInitialized) {
14296 memset(InstSize, 0, sizeof(InstSize));
14297 tableInitialized = GL_TRUE;
14298 }
14299
14300 /* extension info */
14301 ctx->ListExt = CALLOC_STRUCT(gl_list_extensions);
14302
14303 /* Display list */
14304 ctx->ListState.CallDepth = 0;
14305 ctx->ExecuteFlag = GL_TRUE;
14306 ctx->CompileFlag = GL_FALSE;
14307 ctx->ListState.CurrentBlock = NULL;
14308 ctx->ListState.CurrentPos = 0;
14309
14310 /* Display List group */
14311 ctx->List.ListBase = 0;
14312
14313 save_vtxfmt_init(&ctx->ListState.ListVtxfmt);
14314
14315 InstSize[OPCODE_NOP] = 1;
14316 }
14317
14318
14319 void
14320 _mesa_free_display_list_data(struct gl_context *ctx)
14321 {
14322 free(ctx->ListExt);
14323 ctx->ListExt = NULL;
14324 }