mesa: add EXT_dsa + EXT_texture_integer functions
[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_TEXTUREPARAMETER_II,
574 OPCODE_TEXTUREPARAMETER_IUI,
575 OPCODE_TEXTURE_IMAGE1D,
576 OPCODE_TEXTURE_IMAGE2D,
577 OPCODE_TEXTURE_IMAGE3D,
578 OPCODE_TEXTURE_SUB_IMAGE1D,
579 OPCODE_TEXTURE_SUB_IMAGE2D,
580 OPCODE_TEXTURE_SUB_IMAGE3D,
581 OPCODE_COPY_TEXTURE_IMAGE1D,
582 OPCODE_COPY_TEXTURE_IMAGE2D,
583 OPCODE_COPY_TEXTURE_SUB_IMAGE1D,
584 OPCODE_COPY_TEXTURE_SUB_IMAGE2D,
585 OPCODE_COPY_TEXTURE_SUB_IMAGE3D,
586 OPCODE_BIND_MULTITEXTURE,
587 OPCODE_MULTITEXPARAMETER_F,
588 OPCODE_MULTITEXPARAMETER_I,
589 OPCODE_MULTITEXPARAMETER_II,
590 OPCODE_MULTITEXPARAMETER_IUI,
591 OPCODE_MULTITEX_IMAGE1D,
592 OPCODE_MULTITEX_IMAGE2D,
593 OPCODE_MULTITEX_IMAGE3D,
594 OPCODE_MULTITEX_SUB_IMAGE1D,
595 OPCODE_MULTITEX_SUB_IMAGE2D,
596 OPCODE_MULTITEX_SUB_IMAGE3D,
597 OPCODE_COPY_MULTITEX_IMAGE1D,
598 OPCODE_COPY_MULTITEX_IMAGE2D,
599 OPCODE_COPY_MULTITEX_SUB_IMAGE1D,
600 OPCODE_COPY_MULTITEX_SUB_IMAGE2D,
601 OPCODE_COPY_MULTITEX_SUB_IMAGE3D,
602 OPCODE_MULTITEXENV,
603 OPCODE_COMPRESSED_TEXTURE_IMAGE_1D,
604 OPCODE_COMPRESSED_TEXTURE_IMAGE_2D,
605 OPCODE_COMPRESSED_TEXTURE_IMAGE_3D,
606 OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_1D,
607 OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_2D,
608 OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_3D,
609 OPCODE_COMPRESSED_MULTITEX_IMAGE_1D,
610 OPCODE_COMPRESSED_MULTITEX_IMAGE_2D,
611 OPCODE_COMPRESSED_MULTITEX_IMAGE_3D,
612 OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_1D,
613 OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_2D,
614 OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_3D,
615 OPCODE_NAMED_PROGRAM_STRING,
616 OPCODE_NAMED_PROGRAM_LOCAL_PARAMETER,
617
618 /* The following three are meta instructions */
619 OPCODE_ERROR, /* raise compiled-in error */
620 OPCODE_CONTINUE,
621 OPCODE_NOP, /* No-op (used for 8-byte alignment */
622 OPCODE_END_OF_LIST,
623 OPCODE_EXT_0
624 } OpCode;
625
626
627
628 /**
629 * Display list node.
630 *
631 * Display list instructions are stored as sequences of "nodes". Nodes
632 * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
633 * are linked together with a pointer.
634 *
635 * Each instruction in the display list is stored as a sequence of
636 * contiguous nodes in memory.
637 * Each node is the union of a variety of data types.
638 *
639 * Note, all of these members should be 4 bytes in size or less for the
640 * sake of compact display lists. We store 8-byte pointers in a pair of
641 * these nodes using the save/get_pointer() functions below.
642 */
643 union gl_dlist_node
644 {
645 OpCode opcode;
646 GLboolean b;
647 GLbitfield bf;
648 GLubyte ub;
649 GLshort s;
650 GLushort us;
651 GLint i;
652 GLuint ui;
653 GLenum e;
654 GLfloat f;
655 GLsizei si;
656 };
657
658
659 typedef union gl_dlist_node Node;
660
661
662 /** How many 4-byte dwords to store a pointer */
663 #define POINTER_DWORDS (sizeof(void *) / 4)
664
665 /* We want to keep sizeof(union gl_dlist_node) == 4 to minimize
666 * space for display lists. The following types and functions are
667 * used to help store 4- and 8-byte pointers in 1 or 2 dlist_nodes.
668 */
669 union pointer
670 {
671 void *ptr;
672 GLuint dwords[POINTER_DWORDS];
673 };
674
675
676 /**
677 * Save a 4 or 8-byte pointer at dest (and dest+1).
678 */
679 static inline void
680 save_pointer(Node *dest, void *src)
681 {
682 union pointer p;
683 unsigned i;
684
685 STATIC_ASSERT(POINTER_DWORDS == 1 || POINTER_DWORDS == 2);
686 STATIC_ASSERT(sizeof(Node) == 4);
687
688 p.ptr = src;
689
690 for (i = 0; i < POINTER_DWORDS; i++)
691 dest[i].ui = p.dwords[i];
692 }
693
694
695 /**
696 * Retrieve a 4 or 8-byte pointer from node (node+1).
697 */
698 static inline void *
699 get_pointer(const Node *node)
700 {
701 union pointer p;
702 unsigned i;
703
704 for (i = 0; i < POINTER_DWORDS; i++)
705 p.dwords[i] = node[i].ui;
706
707 return p.ptr;
708 }
709
710
711 /**
712 * Used to store a 64-bit uint in a pair of "Nodes" for the sake of 32-bit
713 * environment.
714 */
715 union uint64_pair
716 {
717 GLuint64 uint64;
718 GLuint uint32[2];
719 };
720
721
722 union float64_pair
723 {
724 GLdouble d;
725 GLuint uint32[2];
726 };
727
728
729 #define ASSIGN_DOUBLE_TO_NODES(n, idx, value) \
730 do { \
731 union float64_pair tmp; \
732 tmp.d = value; \
733 n[idx].ui = tmp.uint32[0]; \
734 n[idx+1].ui = tmp.uint32[1]; \
735 } while (0)
736
737
738 /**
739 * How many nodes to allocate at a time. Note that bulk vertex data
740 * from glBegin/glVertex/glEnd primitives will typically wind up in
741 * a VBO, and not directly in the display list itself.
742 */
743 #define BLOCK_SIZE 256
744
745
746
747 /**
748 * Number of nodes of storage needed for each instruction.
749 * Sizes for dynamically allocated opcodes are stored in the context struct.
750 */
751 static GLuint InstSize[OPCODE_END_OF_LIST + 1];
752
753
754 void mesa_print_display_list(GLuint list);
755
756
757 /**
758 * Does the given display list only contain a single glBitmap call?
759 */
760 static bool
761 is_bitmap_list(const struct gl_display_list *dlist)
762 {
763 const Node *n = dlist->Head;
764 if (n[0].opcode == OPCODE_BITMAP) {
765 n += InstSize[OPCODE_BITMAP];
766 if (n[0].opcode == OPCODE_END_OF_LIST)
767 return true;
768 }
769 return false;
770 }
771
772
773 /**
774 * Is the given display list an empty list?
775 */
776 static bool
777 is_empty_list(const struct gl_display_list *dlist)
778 {
779 const Node *n = dlist->Head;
780 return n[0].opcode == OPCODE_END_OF_LIST;
781 }
782
783
784 /**
785 * Delete/free a gl_bitmap_atlas. Called during context tear-down.
786 */
787 void
788 _mesa_delete_bitmap_atlas(struct gl_context *ctx, struct gl_bitmap_atlas *atlas)
789 {
790 if (atlas->texObj) {
791 ctx->Driver.DeleteTexture(ctx, atlas->texObj);
792 }
793 free(atlas->glyphs);
794 free(atlas);
795 }
796
797
798 /**
799 * Lookup a gl_bitmap_atlas by listBase ID.
800 */
801 static struct gl_bitmap_atlas *
802 lookup_bitmap_atlas(struct gl_context *ctx, GLuint listBase)
803 {
804 struct gl_bitmap_atlas *atlas;
805
806 assert(listBase > 0);
807 atlas = _mesa_HashLookup(ctx->Shared->BitmapAtlas, listBase);
808 return atlas;
809 }
810
811
812 /**
813 * Create new bitmap atlas and insert into hash table.
814 */
815 static struct gl_bitmap_atlas *
816 alloc_bitmap_atlas(struct gl_context *ctx, GLuint listBase)
817 {
818 struct gl_bitmap_atlas *atlas;
819
820 assert(listBase > 0);
821 assert(_mesa_HashLookup(ctx->Shared->BitmapAtlas, listBase) == NULL);
822
823 atlas = calloc(1, sizeof(*atlas));
824 if (atlas) {
825 _mesa_HashInsert(ctx->Shared->BitmapAtlas, listBase, atlas);
826 }
827
828 return atlas;
829 }
830
831
832 /**
833 * Try to build a bitmap atlas. This involves examining a sequence of
834 * display lists which contain glBitmap commands and putting the bitmap
835 * images into a texture map (the atlas).
836 * If we succeed, gl_bitmap_atlas::complete will be set to true.
837 * If we fail, gl_bitmap_atlas::incomplete will be set to true.
838 */
839 static void
840 build_bitmap_atlas(struct gl_context *ctx, struct gl_bitmap_atlas *atlas,
841 GLuint listBase)
842 {
843 unsigned i, row_height = 0, xpos = 0, ypos = 0;
844 GLubyte *map;
845 GLint map_stride;
846
847 assert(atlas);
848 assert(!atlas->complete);
849 assert(atlas->numBitmaps > 0);
850
851 /* We use a rectangle texture (non-normalized coords) for the atlas */
852 assert(ctx->Extensions.NV_texture_rectangle);
853 assert(ctx->Const.MaxTextureRectSize >= 1024);
854
855 atlas->texWidth = 1024;
856 atlas->texHeight = 0; /* determined below */
857
858 atlas->glyphs = malloc(atlas->numBitmaps * sizeof(atlas->glyphs[0]));
859 if (!atlas->glyphs) {
860 /* give up */
861 atlas->incomplete = true;
862 return;
863 }
864
865 /* Loop over the display lists. They should all contain a single glBitmap
866 * call. If not, bail out. Also, compute the position and sizes of each
867 * bitmap in the atlas to determine the texture atlas size.
868 */
869 for (i = 0; i < atlas->numBitmaps; i++) {
870 const struct gl_display_list *list = _mesa_lookup_list(ctx, listBase + i);
871 const Node *n;
872 struct gl_bitmap_glyph *g = &atlas->glyphs[i];
873 unsigned bitmap_width, bitmap_height;
874 float bitmap_xmove, bitmap_ymove, bitmap_xorig, bitmap_yorig;
875
876 if (!list || is_empty_list(list)) {
877 /* stop here */
878 atlas->numBitmaps = i;
879 break;
880 }
881
882 if (!is_bitmap_list(list)) {
883 /* This list does not contain exactly one glBitmap command. Give up. */
884 atlas->incomplete = true;
885 return;
886 }
887
888 /* get bitmap info from the display list command */
889 n = list->Head;
890 assert(n[0].opcode == OPCODE_BITMAP);
891 bitmap_width = n[1].i;
892 bitmap_height = n[2].i;
893 bitmap_xorig = n[3].f;
894 bitmap_yorig = n[4].f;
895 bitmap_xmove = n[5].f;
896 bitmap_ymove = n[6].f;
897
898 if (xpos + bitmap_width > atlas->texWidth) {
899 /* advance to the next row of the texture */
900 xpos = 0;
901 ypos += row_height;
902 row_height = 0;
903 }
904
905 /* save the bitmap's position in the atlas */
906 g->x = xpos;
907 g->y = ypos;
908 g->w = bitmap_width;
909 g->h = bitmap_height;
910 g->xorig = bitmap_xorig;
911 g->yorig = bitmap_yorig;
912 g->xmove = bitmap_xmove;
913 g->ymove = bitmap_ymove;
914
915 xpos += bitmap_width;
916
917 /* keep track of tallest bitmap in the row */
918 row_height = MAX2(row_height, bitmap_height);
919 }
920
921 /* Now we know the texture height */
922 atlas->texHeight = ypos + row_height;
923
924 if (atlas->texHeight == 0) {
925 /* no glyphs found, give up */
926 goto fail;
927 }
928 else if (atlas->texHeight > ctx->Const.MaxTextureRectSize) {
929 /* too large, give up */
930 goto fail;
931 }
932
933 /* Create atlas texture (texture ID is irrelevant) */
934 atlas->texObj = ctx->Driver.NewTextureObject(ctx, 999, GL_TEXTURE_RECTANGLE);
935 if (!atlas->texObj) {
936 goto out_of_memory;
937 }
938
939 atlas->texObj->Sampler.MinFilter = GL_NEAREST;
940 atlas->texObj->Sampler.MagFilter = GL_NEAREST;
941 atlas->texObj->MaxLevel = 0;
942 atlas->texObj->Immutable = GL_TRUE;
943
944 atlas->texImage = _mesa_get_tex_image(ctx, atlas->texObj,
945 GL_TEXTURE_RECTANGLE, 0);
946 if (!atlas->texImage) {
947 goto out_of_memory;
948 }
949
950 if (ctx->Const.BitmapUsesRed)
951 _mesa_init_teximage_fields(ctx, atlas->texImage,
952 atlas->texWidth, atlas->texHeight, 1, 0,
953 GL_RED, MESA_FORMAT_R_UNORM8);
954 else
955 _mesa_init_teximage_fields(ctx, atlas->texImage,
956 atlas->texWidth, atlas->texHeight, 1, 0,
957 GL_ALPHA, MESA_FORMAT_A_UNORM8);
958
959 /* alloc image storage */
960 if (!ctx->Driver.AllocTextureImageBuffer(ctx, atlas->texImage)) {
961 goto out_of_memory;
962 }
963
964 /* map teximage, load with bitmap glyphs */
965 ctx->Driver.MapTextureImage(ctx, atlas->texImage, 0,
966 0, 0, atlas->texWidth, atlas->texHeight,
967 GL_MAP_WRITE_BIT, &map, &map_stride);
968 if (!map) {
969 goto out_of_memory;
970 }
971
972 /* Background/clear pixels are 0xff, foreground/set pixels are 0x0 */
973 memset(map, 0xff, map_stride * atlas->texHeight);
974
975 for (i = 0; i < atlas->numBitmaps; i++) {
976 const struct gl_display_list *list = _mesa_lookup_list(ctx, listBase + i);
977 const Node *n = list->Head;
978
979 assert(n[0].opcode == OPCODE_BITMAP ||
980 n[0].opcode == OPCODE_END_OF_LIST);
981
982 if (n[0].opcode == OPCODE_BITMAP) {
983 unsigned bitmap_width = n[1].i;
984 unsigned bitmap_height = n[2].i;
985 unsigned xpos = atlas->glyphs[i].x;
986 unsigned ypos = atlas->glyphs[i].y;
987 const void *bitmap_image = get_pointer(&n[7]);
988
989 assert(atlas->glyphs[i].w == bitmap_width);
990 assert(atlas->glyphs[i].h == bitmap_height);
991
992 /* put the bitmap image into the texture image */
993 _mesa_expand_bitmap(bitmap_width, bitmap_height,
994 &ctx->DefaultPacking, bitmap_image,
995 map + map_stride * ypos + xpos, /* dest addr */
996 map_stride, 0x0);
997 }
998 }
999
1000 ctx->Driver.UnmapTextureImage(ctx, atlas->texImage, 0);
1001
1002 atlas->complete = true;
1003
1004 return;
1005
1006 out_of_memory:
1007 _mesa_error(ctx, GL_OUT_OF_MEMORY, "Display list bitmap atlas");
1008 fail:
1009 if (atlas->texObj) {
1010 ctx->Driver.DeleteTexture(ctx, atlas->texObj);
1011 }
1012 free(atlas->glyphs);
1013 atlas->glyphs = NULL;
1014 atlas->incomplete = true;
1015 }
1016
1017
1018 /**
1019 * Allocate a gl_display_list object with an initial block of storage.
1020 * \param count how many display list nodes/tokens to allocate
1021 */
1022 static struct gl_display_list *
1023 make_list(GLuint name, GLuint count)
1024 {
1025 struct gl_display_list *dlist = CALLOC_STRUCT(gl_display_list);
1026 dlist->Name = name;
1027 dlist->Head = malloc(sizeof(Node) * count);
1028 dlist->Head[0].opcode = OPCODE_END_OF_LIST;
1029 /* All InstSize[] entries must be non-zero */
1030 InstSize[OPCODE_END_OF_LIST] = 1;
1031 return dlist;
1032 }
1033
1034
1035 /**
1036 * Lookup function to just encapsulate casting.
1037 */
1038 struct gl_display_list *
1039 _mesa_lookup_list(struct gl_context *ctx, GLuint list)
1040 {
1041 return (struct gl_display_list *)
1042 _mesa_HashLookup(ctx->Shared->DisplayList, list);
1043 }
1044
1045
1046 /** Is the given opcode an extension code? */
1047 static inline GLboolean
1048 is_ext_opcode(OpCode opcode)
1049 {
1050 return (opcode >= OPCODE_EXT_0);
1051 }
1052
1053
1054 /** Destroy an extended opcode instruction */
1055 static GLint
1056 ext_opcode_destroy(struct gl_context *ctx, Node *node)
1057 {
1058 const GLint i = node[0].opcode - OPCODE_EXT_0;
1059 GLint step;
1060 ctx->ListExt->Opcode[i].Destroy(ctx, &node[1]);
1061 step = ctx->ListExt->Opcode[i].Size;
1062 return step;
1063 }
1064
1065
1066 /** Execute an extended opcode instruction */
1067 static GLint
1068 ext_opcode_execute(struct gl_context *ctx, Node *node)
1069 {
1070 const GLint i = node[0].opcode - OPCODE_EXT_0;
1071 GLint step;
1072 ctx->ListExt->Opcode[i].Execute(ctx, &node[1]);
1073 step = ctx->ListExt->Opcode[i].Size;
1074 return step;
1075 }
1076
1077
1078 /** Print an extended opcode instruction */
1079 static GLint
1080 ext_opcode_print(struct gl_context *ctx, Node *node, FILE *f)
1081 {
1082 const GLint i = node[0].opcode - OPCODE_EXT_0;
1083 GLint step;
1084 ctx->ListExt->Opcode[i].Print(ctx, &node[1], f);
1085 step = ctx->ListExt->Opcode[i].Size;
1086 return step;
1087 }
1088
1089
1090 /**
1091 * Delete the named display list, but don't remove from hash table.
1092 * \param dlist - display list pointer
1093 */
1094 void
1095 _mesa_delete_list(struct gl_context *ctx, struct gl_display_list *dlist)
1096 {
1097 Node *n, *block;
1098 GLboolean done;
1099
1100 n = block = dlist->Head;
1101
1102 done = block ? GL_FALSE : GL_TRUE;
1103 while (!done) {
1104 const OpCode opcode = n[0].opcode;
1105
1106 /* check for extension opcodes first */
1107 if (is_ext_opcode(opcode)) {
1108 n += ext_opcode_destroy(ctx, n);
1109 }
1110 else {
1111 switch (opcode) {
1112 /* for some commands, we need to free malloc'd memory */
1113 case OPCODE_MAP1:
1114 free(get_pointer(&n[6]));
1115 break;
1116 case OPCODE_MAP2:
1117 free(get_pointer(&n[10]));
1118 break;
1119 case OPCODE_CALL_LISTS:
1120 free(get_pointer(&n[3]));
1121 break;
1122 case OPCODE_DRAW_PIXELS:
1123 free(get_pointer(&n[5]));
1124 break;
1125 case OPCODE_BITMAP:
1126 free(get_pointer(&n[7]));
1127 break;
1128 case OPCODE_POLYGON_STIPPLE:
1129 free(get_pointer(&n[1]));
1130 break;
1131 case OPCODE_TEX_IMAGE1D:
1132 free(get_pointer(&n[8]));
1133 break;
1134 case OPCODE_TEX_IMAGE2D:
1135 free(get_pointer(&n[9]));
1136 break;
1137 case OPCODE_TEX_IMAGE3D:
1138 free(get_pointer(&n[10]));
1139 break;
1140 case OPCODE_TEX_SUB_IMAGE1D:
1141 free(get_pointer(&n[7]));
1142 break;
1143 case OPCODE_TEX_SUB_IMAGE2D:
1144 free(get_pointer(&n[9]));
1145 break;
1146 case OPCODE_TEX_SUB_IMAGE3D:
1147 free(get_pointer(&n[11]));
1148 break;
1149 case OPCODE_COMPRESSED_TEX_IMAGE_1D:
1150 free(get_pointer(&n[7]));
1151 break;
1152 case OPCODE_COMPRESSED_TEX_IMAGE_2D:
1153 free(get_pointer(&n[8]));
1154 break;
1155 case OPCODE_COMPRESSED_TEX_IMAGE_3D:
1156 free(get_pointer(&n[9]));
1157 break;
1158 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D:
1159 free(get_pointer(&n[7]));
1160 break;
1161 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D:
1162 free(get_pointer(&n[9]));
1163 break;
1164 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D:
1165 free(get_pointer(&n[11]));
1166 break;
1167 case OPCODE_PROGRAM_STRING_ARB:
1168 free(get_pointer(&n[4])); /* program string */
1169 break;
1170 case OPCODE_UNIFORM_1FV:
1171 case OPCODE_UNIFORM_2FV:
1172 case OPCODE_UNIFORM_3FV:
1173 case OPCODE_UNIFORM_4FV:
1174 case OPCODE_UNIFORM_1DV:
1175 case OPCODE_UNIFORM_2DV:
1176 case OPCODE_UNIFORM_3DV:
1177 case OPCODE_UNIFORM_4DV:
1178 case OPCODE_UNIFORM_1IV:
1179 case OPCODE_UNIFORM_2IV:
1180 case OPCODE_UNIFORM_3IV:
1181 case OPCODE_UNIFORM_4IV:
1182 case OPCODE_UNIFORM_1UIV:
1183 case OPCODE_UNIFORM_2UIV:
1184 case OPCODE_UNIFORM_3UIV:
1185 case OPCODE_UNIFORM_4UIV:
1186 free(get_pointer(&n[3]));
1187 break;
1188 case OPCODE_UNIFORM_MATRIX22:
1189 case OPCODE_UNIFORM_MATRIX33:
1190 case OPCODE_UNIFORM_MATRIX44:
1191 case OPCODE_UNIFORM_MATRIX24:
1192 case OPCODE_UNIFORM_MATRIX42:
1193 case OPCODE_UNIFORM_MATRIX23:
1194 case OPCODE_UNIFORM_MATRIX32:
1195 case OPCODE_UNIFORM_MATRIX34:
1196 case OPCODE_UNIFORM_MATRIX43:
1197 case OPCODE_UNIFORM_MATRIX22D:
1198 case OPCODE_UNIFORM_MATRIX33D:
1199 case OPCODE_UNIFORM_MATRIX44D:
1200 case OPCODE_UNIFORM_MATRIX24D:
1201 case OPCODE_UNIFORM_MATRIX42D:
1202 case OPCODE_UNIFORM_MATRIX23D:
1203 case OPCODE_UNIFORM_MATRIX32D:
1204 case OPCODE_UNIFORM_MATRIX34D:
1205 case OPCODE_UNIFORM_MATRIX43D:
1206 free(get_pointer(&n[4]));
1207 break;
1208 case OPCODE_PROGRAM_UNIFORM_1FV:
1209 case OPCODE_PROGRAM_UNIFORM_2FV:
1210 case OPCODE_PROGRAM_UNIFORM_3FV:
1211 case OPCODE_PROGRAM_UNIFORM_4FV:
1212 case OPCODE_PROGRAM_UNIFORM_1DV:
1213 case OPCODE_PROGRAM_UNIFORM_2DV:
1214 case OPCODE_PROGRAM_UNIFORM_3DV:
1215 case OPCODE_PROGRAM_UNIFORM_4DV:
1216 case OPCODE_PROGRAM_UNIFORM_1IV:
1217 case OPCODE_PROGRAM_UNIFORM_2IV:
1218 case OPCODE_PROGRAM_UNIFORM_3IV:
1219 case OPCODE_PROGRAM_UNIFORM_4IV:
1220 case OPCODE_PROGRAM_UNIFORM_1UIV:
1221 case OPCODE_PROGRAM_UNIFORM_2UIV:
1222 case OPCODE_PROGRAM_UNIFORM_3UIV:
1223 case OPCODE_PROGRAM_UNIFORM_4UIV:
1224 free(get_pointer(&n[4]));
1225 break;
1226 case OPCODE_PROGRAM_UNIFORM_MATRIX22F:
1227 case OPCODE_PROGRAM_UNIFORM_MATRIX33F:
1228 case OPCODE_PROGRAM_UNIFORM_MATRIX44F:
1229 case OPCODE_PROGRAM_UNIFORM_MATRIX24F:
1230 case OPCODE_PROGRAM_UNIFORM_MATRIX42F:
1231 case OPCODE_PROGRAM_UNIFORM_MATRIX23F:
1232 case OPCODE_PROGRAM_UNIFORM_MATRIX32F:
1233 case OPCODE_PROGRAM_UNIFORM_MATRIX34F:
1234 case OPCODE_PROGRAM_UNIFORM_MATRIX43F:
1235 case OPCODE_PROGRAM_UNIFORM_MATRIX22D:
1236 case OPCODE_PROGRAM_UNIFORM_MATRIX33D:
1237 case OPCODE_PROGRAM_UNIFORM_MATRIX44D:
1238 case OPCODE_PROGRAM_UNIFORM_MATRIX24D:
1239 case OPCODE_PROGRAM_UNIFORM_MATRIX42D:
1240 case OPCODE_PROGRAM_UNIFORM_MATRIX23D:
1241 case OPCODE_PROGRAM_UNIFORM_MATRIX32D:
1242 case OPCODE_PROGRAM_UNIFORM_MATRIX34D:
1243 case OPCODE_PROGRAM_UNIFORM_MATRIX43D:
1244 free(get_pointer(&n[5]));
1245 break;
1246 case OPCODE_PIXEL_MAP:
1247 free(get_pointer(&n[3]));
1248 break;
1249 case OPCODE_VIEWPORT_ARRAY_V:
1250 case OPCODE_SCISSOR_ARRAY_V:
1251 case OPCODE_DEPTH_ARRAY_V:
1252 case OPCODE_UNIFORM_SUBROUTINES:
1253 case OPCODE_WINDOW_RECTANGLES:
1254 free(get_pointer(&n[3]));
1255 break;
1256 case OPCODE_TEXTURE_IMAGE1D:
1257 case OPCODE_MULTITEX_IMAGE1D:
1258 free(get_pointer(&n[9]));
1259 break;
1260 case OPCODE_TEXTURE_IMAGE2D:
1261 case OPCODE_MULTITEX_IMAGE2D:
1262 free(get_pointer(&n[10]));
1263 break;
1264 case OPCODE_TEXTURE_IMAGE3D:
1265 case OPCODE_MULTITEX_IMAGE3D:
1266 free(get_pointer(&n[11]));
1267 break;
1268 case OPCODE_TEXTURE_SUB_IMAGE1D:
1269 case OPCODE_MULTITEX_SUB_IMAGE1D:
1270 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_1D:
1271 case OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_1D:
1272 free(get_pointer(&n[8]));
1273 break;
1274 case OPCODE_TEXTURE_SUB_IMAGE2D:
1275 case OPCODE_MULTITEX_SUB_IMAGE2D:
1276 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_2D:
1277 case OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_2D:
1278 free(get_pointer(&n[10]));
1279 break;
1280 case OPCODE_TEXTURE_SUB_IMAGE3D:
1281 case OPCODE_MULTITEX_SUB_IMAGE3D:
1282 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_3D:
1283 case OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_3D:
1284 free(get_pointer(&n[12]));
1285 break;
1286 case OPCODE_COMPRESSED_TEXTURE_IMAGE_1D:
1287 case OPCODE_COMPRESSED_MULTITEX_IMAGE_1D:
1288 free(get_pointer(&n[8]));
1289 break;
1290 case OPCODE_COMPRESSED_TEXTURE_IMAGE_2D:
1291 case OPCODE_COMPRESSED_MULTITEX_IMAGE_2D:
1292 free(get_pointer(&n[9]));
1293 break;
1294 case OPCODE_COMPRESSED_TEXTURE_IMAGE_3D:
1295 case OPCODE_COMPRESSED_MULTITEX_IMAGE_3D:
1296 free(get_pointer(&n[10]));
1297 break;
1298 case OPCODE_NAMED_PROGRAM_STRING:
1299 free(get_pointer(&n[5]));
1300 break;
1301 case OPCODE_CONTINUE:
1302 n = (Node *) get_pointer(&n[1]);
1303 free(block);
1304 block = n;
1305 break;
1306 case OPCODE_END_OF_LIST:
1307 free(block);
1308 done = GL_TRUE;
1309 break;
1310 default:
1311 /* just increment 'n' pointer, below */
1312 ;
1313 }
1314
1315 if (opcode != OPCODE_CONTINUE) {
1316 assert(InstSize[opcode] > 0);
1317 n += InstSize[opcode];
1318 }
1319 }
1320 }
1321
1322 free(dlist->Label);
1323 free(dlist);
1324 }
1325
1326
1327 /**
1328 * Called by _mesa_HashWalk() to check if a display list which is being
1329 * deleted belongs to a bitmap texture atlas.
1330 */
1331 static void
1332 check_atlas_for_deleted_list(GLuint atlas_id, void *data, void *userData)
1333 {
1334 struct gl_bitmap_atlas *atlas = (struct gl_bitmap_atlas *) data;
1335 GLuint list_id = *((GLuint *) userData); /* the list being deleted */
1336
1337 /* See if the list_id falls in the range contained in this texture atlas */
1338 if (atlas->complete &&
1339 list_id >= atlas_id &&
1340 list_id < atlas_id + atlas->numBitmaps) {
1341 /* Mark the atlas as incomplete so it doesn't get used. But don't
1342 * delete it yet since we don't want to try to recreate it in the next
1343 * glCallLists.
1344 */
1345 atlas->complete = false;
1346 atlas->incomplete = true;
1347 }
1348 }
1349
1350
1351 /**
1352 * Destroy a display list and remove from hash table.
1353 * \param list - display list number
1354 */
1355 static void
1356 destroy_list(struct gl_context *ctx, GLuint list)
1357 {
1358 struct gl_display_list *dlist;
1359
1360 if (list == 0)
1361 return;
1362
1363 dlist = _mesa_lookup_list(ctx, list);
1364 if (!dlist)
1365 return;
1366
1367 if (is_bitmap_list(dlist)) {
1368 /* If we're destroying a simple glBitmap display list, there's a
1369 * chance that we're destroying a bitmap image that's in a texture
1370 * atlas. Examine all atlases to see if that's the case. There's
1371 * usually few (if any) atlases so this isn't expensive.
1372 */
1373 _mesa_HashWalk(ctx->Shared->BitmapAtlas,
1374 check_atlas_for_deleted_list, &list);
1375 }
1376
1377 _mesa_delete_list(ctx, dlist);
1378 _mesa_HashRemove(ctx->Shared->DisplayList, list);
1379 }
1380
1381
1382 /*
1383 * Translate the nth element of list from <type> to GLint.
1384 */
1385 static GLint
1386 translate_id(GLsizei n, GLenum type, const GLvoid * list)
1387 {
1388 GLbyte *bptr;
1389 GLubyte *ubptr;
1390 GLshort *sptr;
1391 GLushort *usptr;
1392 GLint *iptr;
1393 GLuint *uiptr;
1394 GLfloat *fptr;
1395
1396 switch (type) {
1397 case GL_BYTE:
1398 bptr = (GLbyte *) list;
1399 return (GLint) bptr[n];
1400 case GL_UNSIGNED_BYTE:
1401 ubptr = (GLubyte *) list;
1402 return (GLint) ubptr[n];
1403 case GL_SHORT:
1404 sptr = (GLshort *) list;
1405 return (GLint) sptr[n];
1406 case GL_UNSIGNED_SHORT:
1407 usptr = (GLushort *) list;
1408 return (GLint) usptr[n];
1409 case GL_INT:
1410 iptr = (GLint *) list;
1411 return iptr[n];
1412 case GL_UNSIGNED_INT:
1413 uiptr = (GLuint *) list;
1414 return (GLint) uiptr[n];
1415 case GL_FLOAT:
1416 fptr = (GLfloat *) list;
1417 return (GLint) floorf(fptr[n]);
1418 case GL_2_BYTES:
1419 ubptr = ((GLubyte *) list) + 2 * n;
1420 return (GLint) ubptr[0] * 256
1421 + (GLint) ubptr[1];
1422 case GL_3_BYTES:
1423 ubptr = ((GLubyte *) list) + 3 * n;
1424 return (GLint) ubptr[0] * 65536
1425 + (GLint) ubptr[1] * 256
1426 + (GLint) ubptr[2];
1427 case GL_4_BYTES:
1428 ubptr = ((GLubyte *) list) + 4 * n;
1429 return (GLint) ubptr[0] * 16777216
1430 + (GLint) ubptr[1] * 65536
1431 + (GLint) ubptr[2] * 256
1432 + (GLint) ubptr[3];
1433 default:
1434 return 0;
1435 }
1436 }
1437
1438
1439 /**
1440 * Wrapper for _mesa_unpack_image/bitmap() that handles pixel buffer objects.
1441 * If width < 0 or height < 0 or format or type are invalid we'll just
1442 * return NULL. We will not generate an error since OpenGL command
1443 * arguments aren't error-checked until the command is actually executed
1444 * (not when they're compiled).
1445 * But if we run out of memory, GL_OUT_OF_MEMORY will be recorded.
1446 */
1447 static GLvoid *
1448 unpack_image(struct gl_context *ctx, GLuint dimensions,
1449 GLsizei width, GLsizei height, GLsizei depth,
1450 GLenum format, GLenum type, const GLvoid * pixels,
1451 const struct gl_pixelstore_attrib *unpack)
1452 {
1453 if (width <= 0 || height <= 0) {
1454 return NULL;
1455 }
1456
1457 if (_mesa_bytes_per_pixel(format, type) < 0) {
1458 /* bad format and/or type */
1459 return NULL;
1460 }
1461
1462 if (!_mesa_is_bufferobj(unpack->BufferObj)) {
1463 /* no PBO */
1464 GLvoid *image;
1465
1466 image = _mesa_unpack_image(dimensions, width, height, depth,
1467 format, type, pixels, unpack);
1468 if (pixels && !image) {
1469 _mesa_error(ctx, GL_OUT_OF_MEMORY, "display list construction");
1470 }
1471 return image;
1472 }
1473 else if (_mesa_validate_pbo_access(dimensions, unpack, width, height,
1474 depth, format, type, INT_MAX, pixels)) {
1475 const GLubyte *map, *src;
1476 GLvoid *image;
1477
1478 map = (GLubyte *)
1479 ctx->Driver.MapBufferRange(ctx, 0, unpack->BufferObj->Size,
1480 GL_MAP_READ_BIT, unpack->BufferObj,
1481 MAP_INTERNAL);
1482 if (!map) {
1483 /* unable to map src buffer! */
1484 _mesa_error(ctx, GL_INVALID_OPERATION, "unable to map PBO");
1485 return NULL;
1486 }
1487
1488 src = ADD_POINTERS(map, pixels);
1489 image = _mesa_unpack_image(dimensions, width, height, depth,
1490 format, type, src, unpack);
1491
1492 ctx->Driver.UnmapBuffer(ctx, unpack->BufferObj, MAP_INTERNAL);
1493
1494 if (!image) {
1495 _mesa_error(ctx, GL_OUT_OF_MEMORY, "display list construction");
1496 }
1497 return image;
1498 }
1499
1500 /* bad access! */
1501 _mesa_error(ctx, GL_INVALID_OPERATION, "invalid PBO access");
1502 return NULL;
1503 }
1504
1505
1506 /** Return copy of memory */
1507 static void *
1508 memdup(const void *src, GLsizei bytes)
1509 {
1510 void *b = bytes >= 0 ? malloc(bytes) : NULL;
1511 if (b)
1512 memcpy(b, src, bytes);
1513 return b;
1514 }
1515
1516
1517 /**
1518 * Allocate space for a display list instruction (opcode + payload space).
1519 * \param opcode the instruction opcode (OPCODE_* value)
1520 * \param bytes instruction payload size (not counting opcode)
1521 * \param align8 does the payload need to be 8-byte aligned?
1522 * This is only relevant in 64-bit environments.
1523 * \return pointer to allocated memory (the payload will be at pointer+1)
1524 */
1525 static Node *
1526 dlist_alloc(struct gl_context *ctx, OpCode opcode, GLuint bytes, bool align8)
1527 {
1528 const GLuint numNodes = 1 + (bytes + sizeof(Node) - 1) / sizeof(Node);
1529 const GLuint contNodes = 1 + POINTER_DWORDS; /* size of continue info */
1530 GLuint nopNode;
1531 Node *n;
1532
1533 assert(bytes <= BLOCK_SIZE * sizeof(Node));
1534
1535 if (opcode < OPCODE_EXT_0) {
1536 if (InstSize[opcode] == 0) {
1537 /* save instruction size now */
1538 InstSize[opcode] = numNodes;
1539 }
1540 else {
1541 /* make sure instruction size agrees */
1542 assert(numNodes == InstSize[opcode]);
1543 }
1544 }
1545
1546 if (sizeof(void *) > sizeof(Node) && align8
1547 && ctx->ListState.CurrentPos % 2 == 0) {
1548 /* The opcode would get placed at node[0] and the payload would start
1549 * at node[1]. But the payload needs to be at an even offset (8-byte
1550 * multiple).
1551 */
1552 nopNode = 1;
1553 }
1554 else {
1555 nopNode = 0;
1556 }
1557
1558 if (ctx->ListState.CurrentPos + nopNode + numNodes + contNodes
1559 > BLOCK_SIZE) {
1560 /* This block is full. Allocate a new block and chain to it */
1561 Node *newblock;
1562 n = ctx->ListState.CurrentBlock + ctx->ListState.CurrentPos;
1563 n[0].opcode = OPCODE_CONTINUE;
1564 newblock = malloc(sizeof(Node) * BLOCK_SIZE);
1565 if (!newblock) {
1566 _mesa_error(ctx, GL_OUT_OF_MEMORY, "Building display list");
1567 return NULL;
1568 }
1569
1570 /* a fresh block should be 8-byte aligned on 64-bit systems */
1571 assert(((GLintptr) newblock) % sizeof(void *) == 0);
1572
1573 save_pointer(&n[1], newblock);
1574 ctx->ListState.CurrentBlock = newblock;
1575 ctx->ListState.CurrentPos = 0;
1576
1577 /* Display list nodes are always 4 bytes. If we need 8-byte alignment
1578 * we have to insert a NOP so that the payload of the real opcode lands
1579 * on an even location:
1580 * node[0] = OPCODE_NOP
1581 * node[1] = OPCODE_x;
1582 * node[2] = start of payload
1583 */
1584 nopNode = sizeof(void *) > sizeof(Node) && align8;
1585 }
1586
1587 n = ctx->ListState.CurrentBlock + ctx->ListState.CurrentPos;
1588 if (nopNode) {
1589 assert(ctx->ListState.CurrentPos % 2 == 0); /* even value */
1590 n[0].opcode = OPCODE_NOP;
1591 n++;
1592 /* The "real" opcode will now be at an odd location and the payload
1593 * will be at an even location.
1594 */
1595 }
1596 ctx->ListState.CurrentPos += nopNode + numNodes;
1597
1598 n[0].opcode = opcode;
1599
1600 return n;
1601 }
1602
1603
1604
1605 /**
1606 * Allocate space for a display list instruction. Used by callers outside
1607 * this file for things like VBO vertex data.
1608 *
1609 * \param opcode the instruction opcode (OPCODE_* value)
1610 * \param bytes instruction size in bytes, not counting opcode.
1611 * \return pointer to the usable data area (not including the internal
1612 * opcode).
1613 */
1614 void *
1615 _mesa_dlist_alloc(struct gl_context *ctx, GLuint opcode, GLuint bytes)
1616 {
1617 Node *n = dlist_alloc(ctx, (OpCode) opcode, bytes, false);
1618 if (n)
1619 return n + 1; /* return pointer to payload area, after opcode */
1620 else
1621 return NULL;
1622 }
1623
1624
1625 /**
1626 * Same as _mesa_dlist_alloc(), but return a pointer which is 8-byte
1627 * aligned in 64-bit environments, 4-byte aligned otherwise.
1628 */
1629 void *
1630 _mesa_dlist_alloc_aligned(struct gl_context *ctx, GLuint opcode, GLuint bytes)
1631 {
1632 Node *n = dlist_alloc(ctx, (OpCode) opcode, bytes, true);
1633 if (n)
1634 return n + 1; /* return pointer to payload area, after opcode */
1635 else
1636 return NULL;
1637 }
1638
1639
1640 /**
1641 * This function allows modules and drivers to get their own opcodes
1642 * for extending display list functionality.
1643 * \param ctx the rendering context
1644 * \param size number of bytes for storing the new display list command
1645 * \param execute function to execute the new display list command
1646 * \param destroy function to destroy the new display list command
1647 * \param print function to print the new display list command
1648 * \return the new opcode number or -1 if error
1649 */
1650 GLint
1651 _mesa_dlist_alloc_opcode(struct gl_context *ctx,
1652 GLuint size,
1653 void (*execute) (struct gl_context *, void *),
1654 void (*destroy) (struct gl_context *, void *),
1655 void (*print) (struct gl_context *, void *, FILE *))
1656 {
1657 if (ctx->ListExt->NumOpcodes < MAX_DLIST_EXT_OPCODES) {
1658 const GLuint i = ctx->ListExt->NumOpcodes++;
1659 ctx->ListExt->Opcode[i].Size =
1660 1 + (size + sizeof(Node) - 1) / sizeof(Node);
1661 ctx->ListExt->Opcode[i].Execute = execute;
1662 ctx->ListExt->Opcode[i].Destroy = destroy;
1663 ctx->ListExt->Opcode[i].Print = print;
1664 return i + OPCODE_EXT_0;
1665 }
1666 return -1;
1667 }
1668
1669
1670 /**
1671 * Allocate space for a display list instruction. The space is basically
1672 * an array of Nodes where node[0] holds the opcode, node[1] is the first
1673 * function parameter, node[2] is the second parameter, etc.
1674 *
1675 * \param opcode one of OPCODE_x
1676 * \param nparams number of function parameters
1677 * \return pointer to start of instruction space
1678 */
1679 static inline Node *
1680 alloc_instruction(struct gl_context *ctx, OpCode opcode, GLuint nparams)
1681 {
1682 return dlist_alloc(ctx, opcode, nparams * sizeof(Node), false);
1683 }
1684
1685
1686 /**
1687 * Called by EndList to try to reduce memory used for the list.
1688 */
1689 static void
1690 trim_list(struct gl_context *ctx)
1691 {
1692 /* If the list we're ending only has one allocated block of nodes/tokens
1693 * and its size isn't a full block size, realloc the block to use less
1694 * memory. This is important for apps that create many small display
1695 * lists and apps that use glXUseXFont (many lists each containing one
1696 * glBitmap call).
1697 * Note: we currently only trim display lists that allocated one block
1698 * of tokens. That hits the short list case which is what we're mainly
1699 * concerned with. Trimming longer lists would involve traversing the
1700 * linked list of blocks.
1701 */
1702 struct gl_dlist_state *list = &ctx->ListState;
1703
1704 if ((list->CurrentList->Head == list->CurrentBlock) &&
1705 (list->CurrentPos < BLOCK_SIZE)) {
1706 /* There's only one block and it's not full, so realloc */
1707 GLuint newSize = list->CurrentPos * sizeof(Node);
1708 list->CurrentList->Head =
1709 list->CurrentBlock = realloc(list->CurrentBlock, newSize);
1710 if (!list->CurrentBlock) {
1711 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glEndList");
1712 }
1713 }
1714 }
1715
1716
1717
1718 /*
1719 * Display List compilation functions
1720 */
1721 static void GLAPIENTRY
1722 save_Accum(GLenum op, GLfloat value)
1723 {
1724 GET_CURRENT_CONTEXT(ctx);
1725 Node *n;
1726 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1727 n = alloc_instruction(ctx, OPCODE_ACCUM, 2);
1728 if (n) {
1729 n[1].e = op;
1730 n[2].f = value;
1731 }
1732 if (ctx->ExecuteFlag) {
1733 CALL_Accum(ctx->Exec, (op, value));
1734 }
1735 }
1736
1737
1738 static void GLAPIENTRY
1739 save_AlphaFunc(GLenum func, GLclampf ref)
1740 {
1741 GET_CURRENT_CONTEXT(ctx);
1742 Node *n;
1743 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1744 n = alloc_instruction(ctx, OPCODE_ALPHA_FUNC, 2);
1745 if (n) {
1746 n[1].e = func;
1747 n[2].f = (GLfloat) ref;
1748 }
1749 if (ctx->ExecuteFlag) {
1750 CALL_AlphaFunc(ctx->Exec, (func, ref));
1751 }
1752 }
1753
1754
1755 static void GLAPIENTRY
1756 save_BindTexture(GLenum target, GLuint texture)
1757 {
1758 GET_CURRENT_CONTEXT(ctx);
1759 Node *n;
1760 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1761 n = alloc_instruction(ctx, OPCODE_BIND_TEXTURE, 2);
1762 if (n) {
1763 n[1].e = target;
1764 n[2].ui = texture;
1765 }
1766 if (ctx->ExecuteFlag) {
1767 CALL_BindTexture(ctx->Exec, (target, texture));
1768 }
1769 }
1770
1771
1772 static void GLAPIENTRY
1773 save_Bitmap(GLsizei width, GLsizei height,
1774 GLfloat xorig, GLfloat yorig,
1775 GLfloat xmove, GLfloat ymove, const GLubyte * pixels)
1776 {
1777 GET_CURRENT_CONTEXT(ctx);
1778 Node *n;
1779 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1780 n = alloc_instruction(ctx, OPCODE_BITMAP, 6 + POINTER_DWORDS);
1781 if (n) {
1782 n[1].i = (GLint) width;
1783 n[2].i = (GLint) height;
1784 n[3].f = xorig;
1785 n[4].f = yorig;
1786 n[5].f = xmove;
1787 n[6].f = ymove;
1788 save_pointer(&n[7],
1789 unpack_image(ctx, 2, width, height, 1, GL_COLOR_INDEX,
1790 GL_BITMAP, pixels, &ctx->Unpack));
1791 }
1792 if (ctx->ExecuteFlag) {
1793 CALL_Bitmap(ctx->Exec, (width, height,
1794 xorig, yorig, xmove, ymove, pixels));
1795 }
1796 }
1797
1798
1799 static void GLAPIENTRY
1800 save_BlendEquation(GLenum mode)
1801 {
1802 GET_CURRENT_CONTEXT(ctx);
1803 Node *n;
1804 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1805 n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION, 1);
1806 if (n) {
1807 n[1].e = mode;
1808 }
1809 if (ctx->ExecuteFlag) {
1810 CALL_BlendEquation(ctx->Exec, (mode));
1811 }
1812 }
1813
1814
1815 static void GLAPIENTRY
1816 save_BlendEquationSeparateEXT(GLenum modeRGB, GLenum modeA)
1817 {
1818 GET_CURRENT_CONTEXT(ctx);
1819 Node *n;
1820 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1821 n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION_SEPARATE, 2);
1822 if (n) {
1823 n[1].e = modeRGB;
1824 n[2].e = modeA;
1825 }
1826 if (ctx->ExecuteFlag) {
1827 CALL_BlendEquationSeparate(ctx->Exec, (modeRGB, modeA));
1828 }
1829 }
1830
1831
1832 static void GLAPIENTRY
1833 save_BlendFuncSeparateEXT(GLenum sfactorRGB, GLenum dfactorRGB,
1834 GLenum sfactorA, GLenum dfactorA)
1835 {
1836 GET_CURRENT_CONTEXT(ctx);
1837 Node *n;
1838 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1839 n = alloc_instruction(ctx, OPCODE_BLEND_FUNC_SEPARATE, 4);
1840 if (n) {
1841 n[1].e = sfactorRGB;
1842 n[2].e = dfactorRGB;
1843 n[3].e = sfactorA;
1844 n[4].e = dfactorA;
1845 }
1846 if (ctx->ExecuteFlag) {
1847 CALL_BlendFuncSeparate(ctx->Exec,
1848 (sfactorRGB, dfactorRGB, sfactorA, dfactorA));
1849 }
1850 }
1851
1852
1853 static void GLAPIENTRY
1854 save_BlendFunc(GLenum srcfactor, GLenum dstfactor)
1855 {
1856 save_BlendFuncSeparateEXT(srcfactor, dstfactor, srcfactor, dstfactor);
1857 }
1858
1859
1860 static void GLAPIENTRY
1861 save_BlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
1862 {
1863 GET_CURRENT_CONTEXT(ctx);
1864 Node *n;
1865 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1866 n = alloc_instruction(ctx, OPCODE_BLEND_COLOR, 4);
1867 if (n) {
1868 n[1].f = red;
1869 n[2].f = green;
1870 n[3].f = blue;
1871 n[4].f = alpha;
1872 }
1873 if (ctx->ExecuteFlag) {
1874 CALL_BlendColor(ctx->Exec, (red, green, blue, alpha));
1875 }
1876 }
1877
1878 /* GL_ARB_draw_buffers_blend */
1879 static void GLAPIENTRY
1880 save_BlendFuncSeparatei(GLuint buf, GLenum sfactorRGB, GLenum dfactorRGB,
1881 GLenum sfactorA, GLenum dfactorA)
1882 {
1883 GET_CURRENT_CONTEXT(ctx);
1884 Node *n;
1885 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1886 n = alloc_instruction(ctx, OPCODE_BLEND_FUNC_SEPARATE_I, 5);
1887 if (n) {
1888 n[1].ui = buf;
1889 n[2].e = sfactorRGB;
1890 n[3].e = dfactorRGB;
1891 n[4].e = sfactorA;
1892 n[5].e = dfactorA;
1893 }
1894 if (ctx->ExecuteFlag) {
1895 CALL_BlendFuncSeparateiARB(ctx->Exec, (buf, sfactorRGB, dfactorRGB,
1896 sfactorA, dfactorA));
1897 }
1898 }
1899
1900 /* GL_ARB_draw_buffers_blend */
1901 static void GLAPIENTRY
1902 save_BlendFunci(GLuint buf, GLenum sfactor, GLenum dfactor)
1903 {
1904 GET_CURRENT_CONTEXT(ctx);
1905 Node *n;
1906 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1907 n = alloc_instruction(ctx, OPCODE_BLEND_FUNC_I, 3);
1908 if (n) {
1909 n[1].ui = buf;
1910 n[2].e = sfactor;
1911 n[3].e = dfactor;
1912 }
1913 if (ctx->ExecuteFlag) {
1914 CALL_BlendFunciARB(ctx->Exec, (buf, sfactor, dfactor));
1915 }
1916 }
1917
1918 /* GL_ARB_draw_buffers_blend */
1919 static void GLAPIENTRY
1920 save_BlendEquationi(GLuint buf, GLenum mode)
1921 {
1922 GET_CURRENT_CONTEXT(ctx);
1923 Node *n;
1924 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1925 n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION_I, 2);
1926 if (n) {
1927 n[1].ui = buf;
1928 n[2].e = mode;
1929 }
1930 if (ctx->ExecuteFlag) {
1931 CALL_BlendEquationiARB(ctx->Exec, (buf, mode));
1932 }
1933 }
1934
1935 /* GL_ARB_draw_buffers_blend */
1936 static void GLAPIENTRY
1937 save_BlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeA)
1938 {
1939 GET_CURRENT_CONTEXT(ctx);
1940 Node *n;
1941 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1942 n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION_SEPARATE_I, 3);
1943 if (n) {
1944 n[1].ui = buf;
1945 n[2].e = modeRGB;
1946 n[3].e = modeA;
1947 }
1948 if (ctx->ExecuteFlag) {
1949 CALL_BlendEquationSeparateiARB(ctx->Exec, (buf, modeRGB, modeA));
1950 }
1951 }
1952
1953
1954 /* GL_ARB_draw_instanced. */
1955 static void GLAPIENTRY
1956 save_DrawArraysInstancedARB(UNUSED GLenum mode,
1957 UNUSED GLint first,
1958 UNUSED GLsizei count,
1959 UNUSED GLsizei primcount)
1960 {
1961 GET_CURRENT_CONTEXT(ctx);
1962 _mesa_error(ctx, GL_INVALID_OPERATION,
1963 "glDrawArraysInstanced() during display list compile");
1964 }
1965
1966 static void GLAPIENTRY
1967 save_DrawElementsInstancedARB(UNUSED GLenum mode,
1968 UNUSED GLsizei count,
1969 UNUSED GLenum type,
1970 UNUSED const GLvoid *indices,
1971 UNUSED GLsizei primcount)
1972 {
1973 GET_CURRENT_CONTEXT(ctx);
1974 _mesa_error(ctx, GL_INVALID_OPERATION,
1975 "glDrawElementsInstanced() during display list compile");
1976 }
1977
1978 static void GLAPIENTRY
1979 save_DrawElementsInstancedBaseVertexARB(UNUSED GLenum mode,
1980 UNUSED GLsizei count,
1981 UNUSED GLenum type,
1982 UNUSED const GLvoid *indices,
1983 UNUSED GLsizei primcount,
1984 UNUSED GLint basevertex)
1985 {
1986 GET_CURRENT_CONTEXT(ctx);
1987 _mesa_error(ctx, GL_INVALID_OPERATION,
1988 "glDrawElementsInstancedBaseVertex() during display list compile");
1989 }
1990
1991 /* GL_ARB_base_instance. */
1992 static void GLAPIENTRY
1993 save_DrawArraysInstancedBaseInstance(UNUSED GLenum mode,
1994 UNUSED GLint first,
1995 UNUSED GLsizei count,
1996 UNUSED GLsizei primcount,
1997 UNUSED GLuint baseinstance)
1998 {
1999 GET_CURRENT_CONTEXT(ctx);
2000 _mesa_error(ctx, GL_INVALID_OPERATION,
2001 "glDrawArraysInstancedBaseInstance() during display list compile");
2002 }
2003
2004 static void APIENTRY
2005 save_DrawElementsInstancedBaseInstance(UNUSED GLenum mode,
2006 UNUSED GLsizei count,
2007 UNUSED GLenum type,
2008 UNUSED const void *indices,
2009 UNUSED GLsizei primcount,
2010 UNUSED GLuint baseinstance)
2011 {
2012 GET_CURRENT_CONTEXT(ctx);
2013 _mesa_error(ctx, GL_INVALID_OPERATION,
2014 "glDrawElementsInstancedBaseInstance() during display list compile");
2015 }
2016
2017 static void APIENTRY
2018 save_DrawElementsInstancedBaseVertexBaseInstance(UNUSED GLenum mode,
2019 UNUSED GLsizei count,
2020 UNUSED GLenum type,
2021 UNUSED const void *indices,
2022 UNUSED GLsizei primcount,
2023 UNUSED GLint basevertex,
2024 UNUSED GLuint baseinstance)
2025 {
2026 GET_CURRENT_CONTEXT(ctx);
2027 _mesa_error(ctx, GL_INVALID_OPERATION,
2028 "glDrawElementsInstancedBaseVertexBaseInstance() during display list compile");
2029 }
2030
2031 static void APIENTRY
2032 save_DrawArraysIndirect(UNUSED GLenum mode,
2033 UNUSED const void *indirect)
2034 {
2035 GET_CURRENT_CONTEXT(ctx);
2036 _mesa_error(ctx, GL_INVALID_OPERATION,
2037 "glDrawArraysIndirect() during display list compile");
2038 }
2039
2040 static void APIENTRY
2041 save_DrawElementsIndirect(UNUSED GLenum mode,
2042 UNUSED GLenum type,
2043 UNUSED const void *indirect)
2044 {
2045 GET_CURRENT_CONTEXT(ctx);
2046 _mesa_error(ctx, GL_INVALID_OPERATION,
2047 "glDrawElementsIndirect() during display list compile");
2048 }
2049
2050 static void APIENTRY
2051 save_MultiDrawArraysIndirect(UNUSED GLenum mode,
2052 UNUSED const void *indirect,
2053 UNUSED GLsizei primcount,
2054 UNUSED GLsizei stride)
2055 {
2056 GET_CURRENT_CONTEXT(ctx);
2057 _mesa_error(ctx, GL_INVALID_OPERATION,
2058 "glMultiDrawArraysIndirect() during display list compile");
2059 }
2060
2061 static void APIENTRY
2062 save_MultiDrawElementsIndirect(UNUSED GLenum mode,
2063 UNUSED GLenum type,
2064 UNUSED const void *indirect,
2065 UNUSED GLsizei primcount,
2066 UNUSED GLsizei stride)
2067 {
2068 GET_CURRENT_CONTEXT(ctx);
2069 _mesa_error(ctx, GL_INVALID_OPERATION,
2070 "glMultiDrawElementsIndirect() during display list compile");
2071 }
2072
2073 /**
2074 * While building a display list we cache some OpenGL state.
2075 * Under some circumstances we need to invalidate that state (immediately
2076 * when we start compiling a list, or after glCallList(s)).
2077 */
2078 static void
2079 invalidate_saved_current_state(struct gl_context *ctx)
2080 {
2081 GLint i;
2082
2083 for (i = 0; i < VERT_ATTRIB_MAX; i++)
2084 ctx->ListState.ActiveAttribSize[i] = 0;
2085
2086 for (i = 0; i < MAT_ATTRIB_MAX; i++)
2087 ctx->ListState.ActiveMaterialSize[i] = 0;
2088
2089 memset(&ctx->ListState.Current, 0, sizeof ctx->ListState.Current);
2090
2091 ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN;
2092 }
2093
2094
2095 static void GLAPIENTRY
2096 save_CallList(GLuint list)
2097 {
2098 GET_CURRENT_CONTEXT(ctx);
2099 Node *n;
2100 SAVE_FLUSH_VERTICES(ctx);
2101
2102 n = alloc_instruction(ctx, OPCODE_CALL_LIST, 1);
2103 if (n) {
2104 n[1].ui = list;
2105 }
2106
2107 /* After this, we don't know what state we're in. Invalidate all
2108 * cached information previously gathered:
2109 */
2110 invalidate_saved_current_state( ctx );
2111
2112 if (ctx->ExecuteFlag) {
2113 _mesa_CallList(list);
2114 }
2115 }
2116
2117
2118 static void GLAPIENTRY
2119 save_CallLists(GLsizei num, GLenum type, const GLvoid * lists)
2120 {
2121 GET_CURRENT_CONTEXT(ctx);
2122 unsigned type_size;
2123 Node *n;
2124 void *lists_copy;
2125
2126 SAVE_FLUSH_VERTICES(ctx);
2127
2128 switch (type) {
2129 case GL_BYTE:
2130 case GL_UNSIGNED_BYTE:
2131 type_size = 1;
2132 break;
2133 case GL_SHORT:
2134 case GL_UNSIGNED_SHORT:
2135 case GL_2_BYTES:
2136 type_size = 2;
2137 break;
2138 case GL_3_BYTES:
2139 type_size = 3;
2140 break;
2141 case GL_INT:
2142 case GL_UNSIGNED_INT:
2143 case GL_FLOAT:
2144 case GL_4_BYTES:
2145 type_size = 4;
2146 break;
2147 default:
2148 type_size = 0;
2149 }
2150
2151 if (num > 0 && type_size > 0) {
2152 /* create a copy of the array of list IDs to save in the display list */
2153 lists_copy = memdup(lists, num * type_size);
2154 } else {
2155 lists_copy = NULL;
2156 }
2157
2158 n = alloc_instruction(ctx, OPCODE_CALL_LISTS, 2 + POINTER_DWORDS);
2159 if (n) {
2160 n[1].i = num;
2161 n[2].e = type;
2162 save_pointer(&n[3], lists_copy);
2163 }
2164
2165 /* After this, we don't know what state we're in. Invalidate all
2166 * cached information previously gathered:
2167 */
2168 invalidate_saved_current_state( ctx );
2169
2170 if (ctx->ExecuteFlag) {
2171 CALL_CallLists(ctx->Exec, (num, type, lists));
2172 }
2173 }
2174
2175
2176 static void GLAPIENTRY
2177 save_Clear(GLbitfield mask)
2178 {
2179 GET_CURRENT_CONTEXT(ctx);
2180 Node *n;
2181 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2182 n = alloc_instruction(ctx, OPCODE_CLEAR, 1);
2183 if (n) {
2184 n[1].bf = mask;
2185 }
2186 if (ctx->ExecuteFlag) {
2187 CALL_Clear(ctx->Exec, (mask));
2188 }
2189 }
2190
2191
2192 static void GLAPIENTRY
2193 save_ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value)
2194 {
2195 GET_CURRENT_CONTEXT(ctx);
2196 Node *n;
2197 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2198 n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_IV, 6);
2199 if (n) {
2200 n[1].e = buffer;
2201 n[2].i = drawbuffer;
2202 n[3].i = value[0];
2203 if (buffer == GL_COLOR) {
2204 n[4].i = value[1];
2205 n[5].i = value[2];
2206 n[6].i = value[3];
2207 }
2208 else {
2209 n[4].i = 0;
2210 n[5].i = 0;
2211 n[6].i = 0;
2212 }
2213 }
2214 if (ctx->ExecuteFlag) {
2215 CALL_ClearBufferiv(ctx->Exec, (buffer, drawbuffer, value));
2216 }
2217 }
2218
2219
2220 static void GLAPIENTRY
2221 save_ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value)
2222 {
2223 GET_CURRENT_CONTEXT(ctx);
2224 Node *n;
2225 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2226 n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_UIV, 6);
2227 if (n) {
2228 n[1].e = buffer;
2229 n[2].i = drawbuffer;
2230 n[3].ui = value[0];
2231 if (buffer == GL_COLOR) {
2232 n[4].ui = value[1];
2233 n[5].ui = value[2];
2234 n[6].ui = value[3];
2235 }
2236 else {
2237 n[4].ui = 0;
2238 n[5].ui = 0;
2239 n[6].ui = 0;
2240 }
2241 }
2242 if (ctx->ExecuteFlag) {
2243 CALL_ClearBufferuiv(ctx->Exec, (buffer, drawbuffer, value));
2244 }
2245 }
2246
2247
2248 static void GLAPIENTRY
2249 save_ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
2250 {
2251 GET_CURRENT_CONTEXT(ctx);
2252 Node *n;
2253 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2254 n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_FV, 6);
2255 if (n) {
2256 n[1].e = buffer;
2257 n[2].i = drawbuffer;
2258 n[3].f = value[0];
2259 if (buffer == GL_COLOR) {
2260 n[4].f = value[1];
2261 n[5].f = value[2];
2262 n[6].f = value[3];
2263 }
2264 else {
2265 n[4].f = 0.0F;
2266 n[5].f = 0.0F;
2267 n[6].f = 0.0F;
2268 }
2269 }
2270 if (ctx->ExecuteFlag) {
2271 CALL_ClearBufferfv(ctx->Exec, (buffer, drawbuffer, value));
2272 }
2273 }
2274
2275
2276 static void GLAPIENTRY
2277 save_ClearBufferfi(GLenum buffer, GLint drawbuffer,
2278 GLfloat depth, GLint stencil)
2279 {
2280 GET_CURRENT_CONTEXT(ctx);
2281 Node *n;
2282 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2283 n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_FI, 4);
2284 if (n) {
2285 n[1].e = buffer;
2286 n[2].i = drawbuffer;
2287 n[3].f = depth;
2288 n[4].i = stencil;
2289 }
2290 if (ctx->ExecuteFlag) {
2291 CALL_ClearBufferfi(ctx->Exec, (buffer, drawbuffer, depth, stencil));
2292 }
2293 }
2294
2295
2296 static void GLAPIENTRY
2297 save_ClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
2298 {
2299 GET_CURRENT_CONTEXT(ctx);
2300 Node *n;
2301 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2302 n = alloc_instruction(ctx, OPCODE_CLEAR_ACCUM, 4);
2303 if (n) {
2304 n[1].f = red;
2305 n[2].f = green;
2306 n[3].f = blue;
2307 n[4].f = alpha;
2308 }
2309 if (ctx->ExecuteFlag) {
2310 CALL_ClearAccum(ctx->Exec, (red, green, blue, alpha));
2311 }
2312 }
2313
2314
2315 static void GLAPIENTRY
2316 save_ClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
2317 {
2318 GET_CURRENT_CONTEXT(ctx);
2319 Node *n;
2320 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2321 n = alloc_instruction(ctx, OPCODE_CLEAR_COLOR, 4);
2322 if (n) {
2323 n[1].f = red;
2324 n[2].f = green;
2325 n[3].f = blue;
2326 n[4].f = alpha;
2327 }
2328 if (ctx->ExecuteFlag) {
2329 CALL_ClearColor(ctx->Exec, (red, green, blue, alpha));
2330 }
2331 }
2332
2333
2334 static void GLAPIENTRY
2335 save_ClearDepth(GLclampd depth)
2336 {
2337 GET_CURRENT_CONTEXT(ctx);
2338 Node *n;
2339 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2340 n = alloc_instruction(ctx, OPCODE_CLEAR_DEPTH, 1);
2341 if (n) {
2342 n[1].f = (GLfloat) depth;
2343 }
2344 if (ctx->ExecuteFlag) {
2345 CALL_ClearDepth(ctx->Exec, (depth));
2346 }
2347 }
2348
2349
2350 static void GLAPIENTRY
2351 save_ClearIndex(GLfloat c)
2352 {
2353 GET_CURRENT_CONTEXT(ctx);
2354 Node *n;
2355 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2356 n = alloc_instruction(ctx, OPCODE_CLEAR_INDEX, 1);
2357 if (n) {
2358 n[1].f = c;
2359 }
2360 if (ctx->ExecuteFlag) {
2361 CALL_ClearIndex(ctx->Exec, (c));
2362 }
2363 }
2364
2365
2366 static void GLAPIENTRY
2367 save_ClearStencil(GLint s)
2368 {
2369 GET_CURRENT_CONTEXT(ctx);
2370 Node *n;
2371 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2372 n = alloc_instruction(ctx, OPCODE_CLEAR_STENCIL, 1);
2373 if (n) {
2374 n[1].i = s;
2375 }
2376 if (ctx->ExecuteFlag) {
2377 CALL_ClearStencil(ctx->Exec, (s));
2378 }
2379 }
2380
2381
2382 static void GLAPIENTRY
2383 save_ClipPlane(GLenum plane, const GLdouble * equ)
2384 {
2385 GET_CURRENT_CONTEXT(ctx);
2386 Node *n;
2387 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2388 n = alloc_instruction(ctx, OPCODE_CLIP_PLANE, 5);
2389 if (n) {
2390 n[1].e = plane;
2391 n[2].f = (GLfloat) equ[0];
2392 n[3].f = (GLfloat) equ[1];
2393 n[4].f = (GLfloat) equ[2];
2394 n[5].f = (GLfloat) equ[3];
2395 }
2396 if (ctx->ExecuteFlag) {
2397 CALL_ClipPlane(ctx->Exec, (plane, equ));
2398 }
2399 }
2400
2401
2402
2403 static void GLAPIENTRY
2404 save_ColorMask(GLboolean red, GLboolean green,
2405 GLboolean blue, GLboolean alpha)
2406 {
2407 GET_CURRENT_CONTEXT(ctx);
2408 Node *n;
2409 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2410 n = alloc_instruction(ctx, OPCODE_COLOR_MASK, 4);
2411 if (n) {
2412 n[1].b = red;
2413 n[2].b = green;
2414 n[3].b = blue;
2415 n[4].b = alpha;
2416 }
2417 if (ctx->ExecuteFlag) {
2418 CALL_ColorMask(ctx->Exec, (red, green, blue, alpha));
2419 }
2420 }
2421
2422
2423 static void GLAPIENTRY
2424 save_ColorMaskIndexed(GLuint buf, GLboolean red, GLboolean green,
2425 GLboolean blue, GLboolean alpha)
2426 {
2427 GET_CURRENT_CONTEXT(ctx);
2428 Node *n;
2429 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2430 n = alloc_instruction(ctx, OPCODE_COLOR_MASK_INDEXED, 5);
2431 if (n) {
2432 n[1].ui = buf;
2433 n[2].b = red;
2434 n[3].b = green;
2435 n[4].b = blue;
2436 n[5].b = alpha;
2437 }
2438 if (ctx->ExecuteFlag) {
2439 /*CALL_ColorMaski(ctx->Exec, (buf, red, green, blue, alpha));*/
2440 }
2441 }
2442
2443
2444 static void GLAPIENTRY
2445 save_ColorMaterial(GLenum face, GLenum mode)
2446 {
2447 GET_CURRENT_CONTEXT(ctx);
2448 Node *n;
2449 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2450
2451 n = alloc_instruction(ctx, OPCODE_COLOR_MATERIAL, 2);
2452 if (n) {
2453 n[1].e = face;
2454 n[2].e = mode;
2455 }
2456 if (ctx->ExecuteFlag) {
2457 CALL_ColorMaterial(ctx->Exec, (face, mode));
2458 }
2459 }
2460
2461
2462 static void GLAPIENTRY
2463 save_CopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type)
2464 {
2465 GET_CURRENT_CONTEXT(ctx);
2466 Node *n;
2467 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2468 n = alloc_instruction(ctx, OPCODE_COPY_PIXELS, 5);
2469 if (n) {
2470 n[1].i = x;
2471 n[2].i = y;
2472 n[3].i = (GLint) width;
2473 n[4].i = (GLint) height;
2474 n[5].e = type;
2475 }
2476 if (ctx->ExecuteFlag) {
2477 CALL_CopyPixels(ctx->Exec, (x, y, width, height, type));
2478 }
2479 }
2480
2481
2482
2483 static void GLAPIENTRY
2484 save_CopyTexImage1D(GLenum target, GLint level, GLenum internalformat,
2485 GLint x, GLint y, GLsizei width, GLint border)
2486 {
2487 GET_CURRENT_CONTEXT(ctx);
2488 Node *n;
2489 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2490 n = alloc_instruction(ctx, OPCODE_COPY_TEX_IMAGE1D, 7);
2491 if (n) {
2492 n[1].e = target;
2493 n[2].i = level;
2494 n[3].e = internalformat;
2495 n[4].i = x;
2496 n[5].i = y;
2497 n[6].i = width;
2498 n[7].i = border;
2499 }
2500 if (ctx->ExecuteFlag) {
2501 CALL_CopyTexImage1D(ctx->Exec, (target, level, internalformat,
2502 x, y, width, border));
2503 }
2504 }
2505
2506
2507 static void GLAPIENTRY
2508 save_CopyTexImage2D(GLenum target, GLint level,
2509 GLenum internalformat,
2510 GLint x, GLint y, GLsizei width,
2511 GLsizei height, GLint border)
2512 {
2513 GET_CURRENT_CONTEXT(ctx);
2514 Node *n;
2515 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2516 n = alloc_instruction(ctx, OPCODE_COPY_TEX_IMAGE2D, 8);
2517 if (n) {
2518 n[1].e = target;
2519 n[2].i = level;
2520 n[3].e = internalformat;
2521 n[4].i = x;
2522 n[5].i = y;
2523 n[6].i = width;
2524 n[7].i = height;
2525 n[8].i = border;
2526 }
2527 if (ctx->ExecuteFlag) {
2528 CALL_CopyTexImage2D(ctx->Exec, (target, level, internalformat,
2529 x, y, width, height, border));
2530 }
2531 }
2532
2533
2534
2535 static void GLAPIENTRY
2536 save_CopyTexSubImage1D(GLenum target, GLint level,
2537 GLint xoffset, GLint x, GLint y, GLsizei width)
2538 {
2539 GET_CURRENT_CONTEXT(ctx);
2540 Node *n;
2541 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2542 n = alloc_instruction(ctx, OPCODE_COPY_TEX_SUB_IMAGE1D, 6);
2543 if (n) {
2544 n[1].e = target;
2545 n[2].i = level;
2546 n[3].i = xoffset;
2547 n[4].i = x;
2548 n[5].i = y;
2549 n[6].i = width;
2550 }
2551 if (ctx->ExecuteFlag) {
2552 CALL_CopyTexSubImage1D(ctx->Exec,
2553 (target, level, xoffset, x, y, width));
2554 }
2555 }
2556
2557
2558 static void GLAPIENTRY
2559 save_CopyTexSubImage2D(GLenum target, GLint level,
2560 GLint xoffset, GLint yoffset,
2561 GLint x, GLint y, GLsizei width, GLint height)
2562 {
2563 GET_CURRENT_CONTEXT(ctx);
2564 Node *n;
2565 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2566 n = alloc_instruction(ctx, OPCODE_COPY_TEX_SUB_IMAGE2D, 8);
2567 if (n) {
2568 n[1].e = target;
2569 n[2].i = level;
2570 n[3].i = xoffset;
2571 n[4].i = yoffset;
2572 n[5].i = x;
2573 n[6].i = y;
2574 n[7].i = width;
2575 n[8].i = height;
2576 }
2577 if (ctx->ExecuteFlag) {
2578 CALL_CopyTexSubImage2D(ctx->Exec, (target, level, xoffset, yoffset,
2579 x, y, width, height));
2580 }
2581 }
2582
2583
2584 static void GLAPIENTRY
2585 save_CopyTexSubImage3D(GLenum target, GLint level,
2586 GLint xoffset, GLint yoffset, GLint zoffset,
2587 GLint x, GLint y, GLsizei width, GLint height)
2588 {
2589 GET_CURRENT_CONTEXT(ctx);
2590 Node *n;
2591 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2592 n = alloc_instruction(ctx, OPCODE_COPY_TEX_SUB_IMAGE3D, 9);
2593 if (n) {
2594 n[1].e = target;
2595 n[2].i = level;
2596 n[3].i = xoffset;
2597 n[4].i = yoffset;
2598 n[5].i = zoffset;
2599 n[6].i = x;
2600 n[7].i = y;
2601 n[8].i = width;
2602 n[9].i = height;
2603 }
2604 if (ctx->ExecuteFlag) {
2605 CALL_CopyTexSubImage3D(ctx->Exec, (target, level,
2606 xoffset, yoffset, zoffset,
2607 x, y, width, height));
2608 }
2609 }
2610
2611
2612 static void GLAPIENTRY
2613 save_CullFace(GLenum mode)
2614 {
2615 GET_CURRENT_CONTEXT(ctx);
2616 Node *n;
2617 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2618 n = alloc_instruction(ctx, OPCODE_CULL_FACE, 1);
2619 if (n) {
2620 n[1].e = mode;
2621 }
2622 if (ctx->ExecuteFlag) {
2623 CALL_CullFace(ctx->Exec, (mode));
2624 }
2625 }
2626
2627
2628 static void GLAPIENTRY
2629 save_DepthFunc(GLenum func)
2630 {
2631 GET_CURRENT_CONTEXT(ctx);
2632 Node *n;
2633 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2634 n = alloc_instruction(ctx, OPCODE_DEPTH_FUNC, 1);
2635 if (n) {
2636 n[1].e = func;
2637 }
2638 if (ctx->ExecuteFlag) {
2639 CALL_DepthFunc(ctx->Exec, (func));
2640 }
2641 }
2642
2643
2644 static void GLAPIENTRY
2645 save_DepthMask(GLboolean mask)
2646 {
2647 GET_CURRENT_CONTEXT(ctx);
2648 Node *n;
2649 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2650 n = alloc_instruction(ctx, OPCODE_DEPTH_MASK, 1);
2651 if (n) {
2652 n[1].b = mask;
2653 }
2654 if (ctx->ExecuteFlag) {
2655 CALL_DepthMask(ctx->Exec, (mask));
2656 }
2657 }
2658
2659
2660 static void GLAPIENTRY
2661 save_DepthRange(GLclampd nearval, GLclampd farval)
2662 {
2663 GET_CURRENT_CONTEXT(ctx);
2664 Node *n;
2665 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2666 n = alloc_instruction(ctx, OPCODE_DEPTH_RANGE, 2);
2667 if (n) {
2668 n[1].f = (GLfloat) nearval;
2669 n[2].f = (GLfloat) farval;
2670 }
2671 if (ctx->ExecuteFlag) {
2672 CALL_DepthRange(ctx->Exec, (nearval, farval));
2673 }
2674 }
2675
2676
2677 static void GLAPIENTRY
2678 save_Disable(GLenum cap)
2679 {
2680 GET_CURRENT_CONTEXT(ctx);
2681 Node *n;
2682 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2683 n = alloc_instruction(ctx, OPCODE_DISABLE, 1);
2684 if (n) {
2685 n[1].e = cap;
2686 }
2687 if (ctx->ExecuteFlag) {
2688 CALL_Disable(ctx->Exec, (cap));
2689 }
2690 }
2691
2692
2693 static void GLAPIENTRY
2694 save_DisableIndexed(GLuint index, GLenum cap)
2695 {
2696 GET_CURRENT_CONTEXT(ctx);
2697 Node *n;
2698 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2699 n = alloc_instruction(ctx, OPCODE_DISABLE_INDEXED, 2);
2700 if (n) {
2701 n[1].ui = index;
2702 n[2].e = cap;
2703 }
2704 if (ctx->ExecuteFlag) {
2705 CALL_Disablei(ctx->Exec, (index, cap));
2706 }
2707 }
2708
2709
2710 static void GLAPIENTRY
2711 save_DrawBuffer(GLenum mode)
2712 {
2713 GET_CURRENT_CONTEXT(ctx);
2714 Node *n;
2715 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2716 n = alloc_instruction(ctx, OPCODE_DRAW_BUFFER, 1);
2717 if (n) {
2718 n[1].e = mode;
2719 }
2720 if (ctx->ExecuteFlag) {
2721 CALL_DrawBuffer(ctx->Exec, (mode));
2722 }
2723 }
2724
2725
2726 static void GLAPIENTRY
2727 save_DrawPixels(GLsizei width, GLsizei height,
2728 GLenum format, GLenum type, const GLvoid * pixels)
2729 {
2730 GET_CURRENT_CONTEXT(ctx);
2731 Node *n;
2732
2733 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2734
2735 n = alloc_instruction(ctx, OPCODE_DRAW_PIXELS, 4 + POINTER_DWORDS);
2736 if (n) {
2737 n[1].i = width;
2738 n[2].i = height;
2739 n[3].e = format;
2740 n[4].e = type;
2741 save_pointer(&n[5],
2742 unpack_image(ctx, 2, width, height, 1, format, type,
2743 pixels, &ctx->Unpack));
2744 }
2745 if (ctx->ExecuteFlag) {
2746 CALL_DrawPixels(ctx->Exec, (width, height, format, type, pixels));
2747 }
2748 }
2749
2750
2751
2752 static void GLAPIENTRY
2753 save_Enable(GLenum cap)
2754 {
2755 GET_CURRENT_CONTEXT(ctx);
2756 Node *n;
2757 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2758 n = alloc_instruction(ctx, OPCODE_ENABLE, 1);
2759 if (n) {
2760 n[1].e = cap;
2761 }
2762 if (ctx->ExecuteFlag) {
2763 CALL_Enable(ctx->Exec, (cap));
2764 }
2765 }
2766
2767
2768
2769 static void GLAPIENTRY
2770 save_EnableIndexed(GLuint index, GLenum cap)
2771 {
2772 GET_CURRENT_CONTEXT(ctx);
2773 Node *n;
2774 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2775 n = alloc_instruction(ctx, OPCODE_ENABLE_INDEXED, 2);
2776 if (n) {
2777 n[1].ui = index;
2778 n[2].e = cap;
2779 }
2780 if (ctx->ExecuteFlag) {
2781 CALL_Enablei(ctx->Exec, (index, cap));
2782 }
2783 }
2784
2785
2786
2787 static void GLAPIENTRY
2788 save_EvalMesh1(GLenum mode, GLint i1, GLint i2)
2789 {
2790 GET_CURRENT_CONTEXT(ctx);
2791 Node *n;
2792 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2793 n = alloc_instruction(ctx, OPCODE_EVALMESH1, 3);
2794 if (n) {
2795 n[1].e = mode;
2796 n[2].i = i1;
2797 n[3].i = i2;
2798 }
2799 if (ctx->ExecuteFlag) {
2800 CALL_EvalMesh1(ctx->Exec, (mode, i1, i2));
2801 }
2802 }
2803
2804
2805 static void GLAPIENTRY
2806 save_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)
2807 {
2808 GET_CURRENT_CONTEXT(ctx);
2809 Node *n;
2810 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2811 n = alloc_instruction(ctx, OPCODE_EVALMESH2, 5);
2812 if (n) {
2813 n[1].e = mode;
2814 n[2].i = i1;
2815 n[3].i = i2;
2816 n[4].i = j1;
2817 n[5].i = j2;
2818 }
2819 if (ctx->ExecuteFlag) {
2820 CALL_EvalMesh2(ctx->Exec, (mode, i1, i2, j1, j2));
2821 }
2822 }
2823
2824
2825
2826
2827 static void GLAPIENTRY
2828 save_Fogfv(GLenum pname, const GLfloat *params)
2829 {
2830 GET_CURRENT_CONTEXT(ctx);
2831 Node *n;
2832 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2833 n = alloc_instruction(ctx, OPCODE_FOG, 5);
2834 if (n) {
2835 n[1].e = pname;
2836 n[2].f = params[0];
2837 n[3].f = params[1];
2838 n[4].f = params[2];
2839 n[5].f = params[3];
2840 }
2841 if (ctx->ExecuteFlag) {
2842 CALL_Fogfv(ctx->Exec, (pname, params));
2843 }
2844 }
2845
2846
2847 static void GLAPIENTRY
2848 save_Fogf(GLenum pname, GLfloat param)
2849 {
2850 GLfloat parray[4];
2851 parray[0] = param;
2852 parray[1] = parray[2] = parray[3] = 0.0F;
2853 save_Fogfv(pname, parray);
2854 }
2855
2856
2857 static void GLAPIENTRY
2858 save_Fogiv(GLenum pname, const GLint *params)
2859 {
2860 GLfloat p[4];
2861 switch (pname) {
2862 case GL_FOG_MODE:
2863 case GL_FOG_DENSITY:
2864 case GL_FOG_START:
2865 case GL_FOG_END:
2866 case GL_FOG_INDEX:
2867 case GL_FOG_COORDINATE_SOURCE:
2868 p[0] = (GLfloat) *params;
2869 p[1] = 0.0f;
2870 p[2] = 0.0f;
2871 p[3] = 0.0f;
2872 break;
2873 case GL_FOG_COLOR:
2874 p[0] = INT_TO_FLOAT(params[0]);
2875 p[1] = INT_TO_FLOAT(params[1]);
2876 p[2] = INT_TO_FLOAT(params[2]);
2877 p[3] = INT_TO_FLOAT(params[3]);
2878 break;
2879 default:
2880 /* Error will be caught later in gl_Fogfv */
2881 ASSIGN_4V(p, 0.0F, 0.0F, 0.0F, 0.0F);
2882 }
2883 save_Fogfv(pname, p);
2884 }
2885
2886
2887 static void GLAPIENTRY
2888 save_Fogi(GLenum pname, GLint param)
2889 {
2890 GLint parray[4];
2891 parray[0] = param;
2892 parray[1] = parray[2] = parray[3] = 0;
2893 save_Fogiv(pname, parray);
2894 }
2895
2896
2897 static void GLAPIENTRY
2898 save_FrontFace(GLenum mode)
2899 {
2900 GET_CURRENT_CONTEXT(ctx);
2901 Node *n;
2902 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2903 n = alloc_instruction(ctx, OPCODE_FRONT_FACE, 1);
2904 if (n) {
2905 n[1].e = mode;
2906 }
2907 if (ctx->ExecuteFlag) {
2908 CALL_FrontFace(ctx->Exec, (mode));
2909 }
2910 }
2911
2912
2913 static void GLAPIENTRY
2914 save_Frustum(GLdouble left, GLdouble right,
2915 GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval)
2916 {
2917 GET_CURRENT_CONTEXT(ctx);
2918 Node *n;
2919 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2920 n = alloc_instruction(ctx, OPCODE_FRUSTUM, 6);
2921 if (n) {
2922 n[1].f = (GLfloat) left;
2923 n[2].f = (GLfloat) right;
2924 n[3].f = (GLfloat) bottom;
2925 n[4].f = (GLfloat) top;
2926 n[5].f = (GLfloat) nearval;
2927 n[6].f = (GLfloat) farval;
2928 }
2929 if (ctx->ExecuteFlag) {
2930 CALL_Frustum(ctx->Exec, (left, right, bottom, top, nearval, farval));
2931 }
2932 }
2933
2934
2935 static void GLAPIENTRY
2936 save_Hint(GLenum target, GLenum mode)
2937 {
2938 GET_CURRENT_CONTEXT(ctx);
2939 Node *n;
2940 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2941 n = alloc_instruction(ctx, OPCODE_HINT, 2);
2942 if (n) {
2943 n[1].e = target;
2944 n[2].e = mode;
2945 }
2946 if (ctx->ExecuteFlag) {
2947 CALL_Hint(ctx->Exec, (target, mode));
2948 }
2949 }
2950
2951
2952 static void GLAPIENTRY
2953 save_IndexMask(GLuint mask)
2954 {
2955 GET_CURRENT_CONTEXT(ctx);
2956 Node *n;
2957 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2958 n = alloc_instruction(ctx, OPCODE_INDEX_MASK, 1);
2959 if (n) {
2960 n[1].ui = mask;
2961 }
2962 if (ctx->ExecuteFlag) {
2963 CALL_IndexMask(ctx->Exec, (mask));
2964 }
2965 }
2966
2967
2968 static void GLAPIENTRY
2969 save_InitNames(void)
2970 {
2971 GET_CURRENT_CONTEXT(ctx);
2972 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2973 (void) alloc_instruction(ctx, OPCODE_INIT_NAMES, 0);
2974 if (ctx->ExecuteFlag) {
2975 CALL_InitNames(ctx->Exec, ());
2976 }
2977 }
2978
2979
2980 static void GLAPIENTRY
2981 save_Lightfv(GLenum light, GLenum pname, const GLfloat *params)
2982 {
2983 GET_CURRENT_CONTEXT(ctx);
2984 Node *n;
2985 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2986 n = alloc_instruction(ctx, OPCODE_LIGHT, 6);
2987 if (n) {
2988 GLint i, nParams;
2989 n[1].e = light;
2990 n[2].e = pname;
2991 switch (pname) {
2992 case GL_AMBIENT:
2993 nParams = 4;
2994 break;
2995 case GL_DIFFUSE:
2996 nParams = 4;
2997 break;
2998 case GL_SPECULAR:
2999 nParams = 4;
3000 break;
3001 case GL_POSITION:
3002 nParams = 4;
3003 break;
3004 case GL_SPOT_DIRECTION:
3005 nParams = 3;
3006 break;
3007 case GL_SPOT_EXPONENT:
3008 nParams = 1;
3009 break;
3010 case GL_SPOT_CUTOFF:
3011 nParams = 1;
3012 break;
3013 case GL_CONSTANT_ATTENUATION:
3014 nParams = 1;
3015 break;
3016 case GL_LINEAR_ATTENUATION:
3017 nParams = 1;
3018 break;
3019 case GL_QUADRATIC_ATTENUATION:
3020 nParams = 1;
3021 break;
3022 default:
3023 nParams = 0;
3024 }
3025 for (i = 0; i < nParams; i++) {
3026 n[3 + i].f = params[i];
3027 }
3028 }
3029 if (ctx->ExecuteFlag) {
3030 CALL_Lightfv(ctx->Exec, (light, pname, params));
3031 }
3032 }
3033
3034
3035 static void GLAPIENTRY
3036 save_Lightf(GLenum light, GLenum pname, GLfloat param)
3037 {
3038 GLfloat parray[4];
3039 parray[0] = param;
3040 parray[1] = parray[2] = parray[3] = 0.0F;
3041 save_Lightfv(light, pname, parray);
3042 }
3043
3044
3045 static void GLAPIENTRY
3046 save_Lightiv(GLenum light, GLenum pname, const GLint *params)
3047 {
3048 GLfloat fparam[4];
3049 switch (pname) {
3050 case GL_AMBIENT:
3051 case GL_DIFFUSE:
3052 case GL_SPECULAR:
3053 fparam[0] = INT_TO_FLOAT(params[0]);
3054 fparam[1] = INT_TO_FLOAT(params[1]);
3055 fparam[2] = INT_TO_FLOAT(params[2]);
3056 fparam[3] = INT_TO_FLOAT(params[3]);
3057 break;
3058 case GL_POSITION:
3059 fparam[0] = (GLfloat) params[0];
3060 fparam[1] = (GLfloat) params[1];
3061 fparam[2] = (GLfloat) params[2];
3062 fparam[3] = (GLfloat) params[3];
3063 break;
3064 case GL_SPOT_DIRECTION:
3065 fparam[0] = (GLfloat) params[0];
3066 fparam[1] = (GLfloat) params[1];
3067 fparam[2] = (GLfloat) params[2];
3068 break;
3069 case GL_SPOT_EXPONENT:
3070 case GL_SPOT_CUTOFF:
3071 case GL_CONSTANT_ATTENUATION:
3072 case GL_LINEAR_ATTENUATION:
3073 case GL_QUADRATIC_ATTENUATION:
3074 fparam[0] = (GLfloat) params[0];
3075 break;
3076 default:
3077 /* error will be caught later in gl_Lightfv */
3078 ;
3079 }
3080 save_Lightfv(light, pname, fparam);
3081 }
3082
3083
3084 static void GLAPIENTRY
3085 save_Lighti(GLenum light, GLenum pname, GLint param)
3086 {
3087 GLint parray[4];
3088 parray[0] = param;
3089 parray[1] = parray[2] = parray[3] = 0;
3090 save_Lightiv(light, pname, parray);
3091 }
3092
3093
3094 static void GLAPIENTRY
3095 save_LightModelfv(GLenum pname, const GLfloat *params)
3096 {
3097 GET_CURRENT_CONTEXT(ctx);
3098 Node *n;
3099 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3100 n = alloc_instruction(ctx, OPCODE_LIGHT_MODEL, 5);
3101 if (n) {
3102 n[1].e = pname;
3103 n[2].f = params[0];
3104 n[3].f = params[1];
3105 n[4].f = params[2];
3106 n[5].f = params[3];
3107 }
3108 if (ctx->ExecuteFlag) {
3109 CALL_LightModelfv(ctx->Exec, (pname, params));
3110 }
3111 }
3112
3113
3114 static void GLAPIENTRY
3115 save_LightModelf(GLenum pname, GLfloat param)
3116 {
3117 GLfloat parray[4];
3118 parray[0] = param;
3119 parray[1] = parray[2] = parray[3] = 0.0F;
3120 save_LightModelfv(pname, parray);
3121 }
3122
3123
3124 static void GLAPIENTRY
3125 save_LightModeliv(GLenum pname, const GLint *params)
3126 {
3127 GLfloat fparam[4];
3128 switch (pname) {
3129 case GL_LIGHT_MODEL_AMBIENT:
3130 fparam[0] = INT_TO_FLOAT(params[0]);
3131 fparam[1] = INT_TO_FLOAT(params[1]);
3132 fparam[2] = INT_TO_FLOAT(params[2]);
3133 fparam[3] = INT_TO_FLOAT(params[3]);
3134 break;
3135 case GL_LIGHT_MODEL_LOCAL_VIEWER:
3136 case GL_LIGHT_MODEL_TWO_SIDE:
3137 case GL_LIGHT_MODEL_COLOR_CONTROL:
3138 fparam[0] = (GLfloat) params[0];
3139 fparam[1] = 0.0F;
3140 fparam[2] = 0.0F;
3141 fparam[3] = 0.0F;
3142 break;
3143 default:
3144 /* Error will be caught later in gl_LightModelfv */
3145 ASSIGN_4V(fparam, 0.0F, 0.0F, 0.0F, 0.0F);
3146 }
3147 save_LightModelfv(pname, fparam);
3148 }
3149
3150
3151 static void GLAPIENTRY
3152 save_LightModeli(GLenum pname, GLint param)
3153 {
3154 GLint parray[4];
3155 parray[0] = param;
3156 parray[1] = parray[2] = parray[3] = 0;
3157 save_LightModeliv(pname, parray);
3158 }
3159
3160
3161 static void GLAPIENTRY
3162 save_LineStipple(GLint factor, GLushort pattern)
3163 {
3164 GET_CURRENT_CONTEXT(ctx);
3165 Node *n;
3166 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3167 n = alloc_instruction(ctx, OPCODE_LINE_STIPPLE, 2);
3168 if (n) {
3169 n[1].i = factor;
3170 n[2].us = pattern;
3171 }
3172 if (ctx->ExecuteFlag) {
3173 CALL_LineStipple(ctx->Exec, (factor, pattern));
3174 }
3175 }
3176
3177
3178 static void GLAPIENTRY
3179 save_LineWidth(GLfloat width)
3180 {
3181 GET_CURRENT_CONTEXT(ctx);
3182 Node *n;
3183 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3184 n = alloc_instruction(ctx, OPCODE_LINE_WIDTH, 1);
3185 if (n) {
3186 n[1].f = width;
3187 }
3188 if (ctx->ExecuteFlag) {
3189 CALL_LineWidth(ctx->Exec, (width));
3190 }
3191 }
3192
3193
3194 static void GLAPIENTRY
3195 save_ListBase(GLuint base)
3196 {
3197 GET_CURRENT_CONTEXT(ctx);
3198 Node *n;
3199 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3200 n = alloc_instruction(ctx, OPCODE_LIST_BASE, 1);
3201 if (n) {
3202 n[1].ui = base;
3203 }
3204 if (ctx->ExecuteFlag) {
3205 CALL_ListBase(ctx->Exec, (base));
3206 }
3207 }
3208
3209
3210 static void GLAPIENTRY
3211 save_LoadIdentity(void)
3212 {
3213 GET_CURRENT_CONTEXT(ctx);
3214 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3215 (void) alloc_instruction(ctx, OPCODE_LOAD_IDENTITY, 0);
3216 if (ctx->ExecuteFlag) {
3217 CALL_LoadIdentity(ctx->Exec, ());
3218 }
3219 }
3220
3221
3222 static void GLAPIENTRY
3223 save_LoadMatrixf(const GLfloat * m)
3224 {
3225 GET_CURRENT_CONTEXT(ctx);
3226 Node *n;
3227 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3228 n = alloc_instruction(ctx, OPCODE_LOAD_MATRIX, 16);
3229 if (n) {
3230 GLuint i;
3231 for (i = 0; i < 16; i++) {
3232 n[1 + i].f = m[i];
3233 }
3234 }
3235 if (ctx->ExecuteFlag) {
3236 CALL_LoadMatrixf(ctx->Exec, (m));
3237 }
3238 }
3239
3240
3241 static void GLAPIENTRY
3242 save_LoadMatrixd(const GLdouble * m)
3243 {
3244 GLfloat f[16];
3245 GLint i;
3246 for (i = 0; i < 16; i++) {
3247 f[i] = (GLfloat) m[i];
3248 }
3249 save_LoadMatrixf(f);
3250 }
3251
3252
3253 static void GLAPIENTRY
3254 save_LoadName(GLuint name)
3255 {
3256 GET_CURRENT_CONTEXT(ctx);
3257 Node *n;
3258 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3259 n = alloc_instruction(ctx, OPCODE_LOAD_NAME, 1);
3260 if (n) {
3261 n[1].ui = name;
3262 }
3263 if (ctx->ExecuteFlag) {
3264 CALL_LoadName(ctx->Exec, (name));
3265 }
3266 }
3267
3268
3269 static void GLAPIENTRY
3270 save_LogicOp(GLenum opcode)
3271 {
3272 GET_CURRENT_CONTEXT(ctx);
3273 Node *n;
3274 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3275 n = alloc_instruction(ctx, OPCODE_LOGIC_OP, 1);
3276 if (n) {
3277 n[1].e = opcode;
3278 }
3279 if (ctx->ExecuteFlag) {
3280 CALL_LogicOp(ctx->Exec, (opcode));
3281 }
3282 }
3283
3284
3285 static void GLAPIENTRY
3286 save_Map1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride,
3287 GLint order, const GLdouble * points)
3288 {
3289 GET_CURRENT_CONTEXT(ctx);
3290 Node *n;
3291 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3292 n = alloc_instruction(ctx, OPCODE_MAP1, 5 + POINTER_DWORDS);
3293 if (n) {
3294 GLfloat *pnts = _mesa_copy_map_points1d(target, stride, order, points);
3295 n[1].e = target;
3296 n[2].f = (GLfloat) u1;
3297 n[3].f = (GLfloat) u2;
3298 n[4].i = _mesa_evaluator_components(target); /* stride */
3299 n[5].i = order;
3300 save_pointer(&n[6], pnts);
3301 }
3302 if (ctx->ExecuteFlag) {
3303 CALL_Map1d(ctx->Exec, (target, u1, u2, stride, order, points));
3304 }
3305 }
3306
3307 static void GLAPIENTRY
3308 save_Map1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride,
3309 GLint order, const GLfloat * points)
3310 {
3311 GET_CURRENT_CONTEXT(ctx);
3312 Node *n;
3313 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3314 n = alloc_instruction(ctx, OPCODE_MAP1, 5 + POINTER_DWORDS);
3315 if (n) {
3316 GLfloat *pnts = _mesa_copy_map_points1f(target, stride, order, points);
3317 n[1].e = target;
3318 n[2].f = u1;
3319 n[3].f = u2;
3320 n[4].i = _mesa_evaluator_components(target); /* stride */
3321 n[5].i = order;
3322 save_pointer(&n[6], pnts);
3323 }
3324 if (ctx->ExecuteFlag) {
3325 CALL_Map1f(ctx->Exec, (target, u1, u2, stride, order, points));
3326 }
3327 }
3328
3329
3330 static void GLAPIENTRY
3331 save_Map2d(GLenum target,
3332 GLdouble u1, GLdouble u2, GLint ustride, GLint uorder,
3333 GLdouble v1, GLdouble v2, GLint vstride, GLint vorder,
3334 const GLdouble * points)
3335 {
3336 GET_CURRENT_CONTEXT(ctx);
3337 Node *n;
3338 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3339 n = alloc_instruction(ctx, OPCODE_MAP2, 9 + POINTER_DWORDS);
3340 if (n) {
3341 GLfloat *pnts = _mesa_copy_map_points2d(target, ustride, uorder,
3342 vstride, vorder, points);
3343 n[1].e = target;
3344 n[2].f = (GLfloat) u1;
3345 n[3].f = (GLfloat) u2;
3346 n[4].f = (GLfloat) v1;
3347 n[5].f = (GLfloat) v2;
3348 /* XXX verify these strides are correct */
3349 n[6].i = _mesa_evaluator_components(target) * vorder; /*ustride */
3350 n[7].i = _mesa_evaluator_components(target); /*vstride */
3351 n[8].i = uorder;
3352 n[9].i = vorder;
3353 save_pointer(&n[10], pnts);
3354 }
3355 if (ctx->ExecuteFlag) {
3356 CALL_Map2d(ctx->Exec, (target,
3357 u1, u2, ustride, uorder,
3358 v1, v2, vstride, vorder, points));
3359 }
3360 }
3361
3362
3363 static void GLAPIENTRY
3364 save_Map2f(GLenum target,
3365 GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
3366 GLfloat v1, GLfloat v2, GLint vstride, GLint vorder,
3367 const GLfloat * points)
3368 {
3369 GET_CURRENT_CONTEXT(ctx);
3370 Node *n;
3371 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3372 n = alloc_instruction(ctx, OPCODE_MAP2, 9 + POINTER_DWORDS);
3373 if (n) {
3374 GLfloat *pnts = _mesa_copy_map_points2f(target, ustride, uorder,
3375 vstride, vorder, points);
3376 n[1].e = target;
3377 n[2].f = u1;
3378 n[3].f = u2;
3379 n[4].f = v1;
3380 n[5].f = v2;
3381 /* XXX verify these strides are correct */
3382 n[6].i = _mesa_evaluator_components(target) * vorder; /*ustride */
3383 n[7].i = _mesa_evaluator_components(target); /*vstride */
3384 n[8].i = uorder;
3385 n[9].i = vorder;
3386 save_pointer(&n[10], pnts);
3387 }
3388 if (ctx->ExecuteFlag) {
3389 CALL_Map2f(ctx->Exec, (target, u1, u2, ustride, uorder,
3390 v1, v2, vstride, vorder, points));
3391 }
3392 }
3393
3394
3395 static void GLAPIENTRY
3396 save_MapGrid1f(GLint un, GLfloat u1, GLfloat u2)
3397 {
3398 GET_CURRENT_CONTEXT(ctx);
3399 Node *n;
3400 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3401 n = alloc_instruction(ctx, OPCODE_MAPGRID1, 3);
3402 if (n) {
3403 n[1].i = un;
3404 n[2].f = u1;
3405 n[3].f = u2;
3406 }
3407 if (ctx->ExecuteFlag) {
3408 CALL_MapGrid1f(ctx->Exec, (un, u1, u2));
3409 }
3410 }
3411
3412
3413 static void GLAPIENTRY
3414 save_MapGrid1d(GLint un, GLdouble u1, GLdouble u2)
3415 {
3416 save_MapGrid1f(un, (GLfloat) u1, (GLfloat) u2);
3417 }
3418
3419
3420 static void GLAPIENTRY
3421 save_MapGrid2f(GLint un, GLfloat u1, GLfloat u2,
3422 GLint vn, GLfloat v1, GLfloat v2)
3423 {
3424 GET_CURRENT_CONTEXT(ctx);
3425 Node *n;
3426 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3427 n = alloc_instruction(ctx, OPCODE_MAPGRID2, 6);
3428 if (n) {
3429 n[1].i = un;
3430 n[2].f = u1;
3431 n[3].f = u2;
3432 n[4].i = vn;
3433 n[5].f = v1;
3434 n[6].f = v2;
3435 }
3436 if (ctx->ExecuteFlag) {
3437 CALL_MapGrid2f(ctx->Exec, (un, u1, u2, vn, v1, v2));
3438 }
3439 }
3440
3441
3442
3443 static void GLAPIENTRY
3444 save_MapGrid2d(GLint un, GLdouble u1, GLdouble u2,
3445 GLint vn, GLdouble v1, GLdouble v2)
3446 {
3447 save_MapGrid2f(un, (GLfloat) u1, (GLfloat) u2,
3448 vn, (GLfloat) v1, (GLfloat) v2);
3449 }
3450
3451
3452 static void GLAPIENTRY
3453 save_MatrixMode(GLenum mode)
3454 {
3455 GET_CURRENT_CONTEXT(ctx);
3456 Node *n;
3457 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3458 n = alloc_instruction(ctx, OPCODE_MATRIX_MODE, 1);
3459 if (n) {
3460 n[1].e = mode;
3461 }
3462 if (ctx->ExecuteFlag) {
3463 CALL_MatrixMode(ctx->Exec, (mode));
3464 }
3465 }
3466
3467
3468 static void GLAPIENTRY
3469 save_MultMatrixf(const GLfloat * m)
3470 {
3471 GET_CURRENT_CONTEXT(ctx);
3472 Node *n;
3473 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3474 n = alloc_instruction(ctx, OPCODE_MULT_MATRIX, 16);
3475 if (n) {
3476 GLuint i;
3477 for (i = 0; i < 16; i++) {
3478 n[1 + i].f = m[i];
3479 }
3480 }
3481 if (ctx->ExecuteFlag) {
3482 CALL_MultMatrixf(ctx->Exec, (m));
3483 }
3484 }
3485
3486
3487 static void GLAPIENTRY
3488 save_MultMatrixd(const GLdouble * m)
3489 {
3490 GLfloat f[16];
3491 GLint i;
3492 for (i = 0; i < 16; i++) {
3493 f[i] = (GLfloat) m[i];
3494 }
3495 save_MultMatrixf(f);
3496 }
3497
3498
3499 static void GLAPIENTRY
3500 save_NewList(GLuint name, GLenum mode)
3501 {
3502 GET_CURRENT_CONTEXT(ctx);
3503 /* It's an error to call this function while building a display list */
3504 _mesa_error(ctx, GL_INVALID_OPERATION, "glNewList");
3505 (void) name;
3506 (void) mode;
3507 }
3508
3509
3510
3511 static void GLAPIENTRY
3512 save_Ortho(GLdouble left, GLdouble right,
3513 GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval)
3514 {
3515 GET_CURRENT_CONTEXT(ctx);
3516 Node *n;
3517 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3518 n = alloc_instruction(ctx, OPCODE_ORTHO, 6);
3519 if (n) {
3520 n[1].f = (GLfloat) left;
3521 n[2].f = (GLfloat) right;
3522 n[3].f = (GLfloat) bottom;
3523 n[4].f = (GLfloat) top;
3524 n[5].f = (GLfloat) nearval;
3525 n[6].f = (GLfloat) farval;
3526 }
3527 if (ctx->ExecuteFlag) {
3528 CALL_Ortho(ctx->Exec, (left, right, bottom, top, nearval, farval));
3529 }
3530 }
3531
3532
3533 static void GLAPIENTRY
3534 save_PatchParameteri(GLenum pname, const GLint value)
3535 {
3536 GET_CURRENT_CONTEXT(ctx);
3537 Node *n;
3538 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3539 n = alloc_instruction(ctx, OPCODE_PATCH_PARAMETER_I, 2);
3540 if (n) {
3541 n[1].e = pname;
3542 n[2].i = value;
3543 }
3544 if (ctx->ExecuteFlag) {
3545 CALL_PatchParameteri(ctx->Exec, (pname, value));
3546 }
3547 }
3548
3549
3550 static void GLAPIENTRY
3551 save_PatchParameterfv(GLenum pname, const GLfloat *params)
3552 {
3553 GET_CURRENT_CONTEXT(ctx);
3554 Node *n;
3555 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3556
3557 if (pname == GL_PATCH_DEFAULT_OUTER_LEVEL) {
3558 n = alloc_instruction(ctx, OPCODE_PATCH_PARAMETER_FV_OUTER, 5);
3559 } else {
3560 assert(pname == GL_PATCH_DEFAULT_INNER_LEVEL);
3561 n = alloc_instruction(ctx, OPCODE_PATCH_PARAMETER_FV_INNER, 3);
3562 }
3563 if (n) {
3564 n[1].e = pname;
3565 if (pname == GL_PATCH_DEFAULT_OUTER_LEVEL) {
3566 n[2].f = params[0];
3567 n[3].f = params[1];
3568 n[4].f = params[2];
3569 n[5].f = params[3];
3570 } else {
3571 n[2].f = params[0];
3572 n[3].f = params[1];
3573 }
3574 }
3575 if (ctx->ExecuteFlag) {
3576 CALL_PatchParameterfv(ctx->Exec, (pname, params));
3577 }
3578 }
3579
3580
3581 static void GLAPIENTRY
3582 save_PixelMapfv(GLenum map, GLint mapsize, const GLfloat *values)
3583 {
3584 GET_CURRENT_CONTEXT(ctx);
3585 Node *n;
3586 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3587 n = alloc_instruction(ctx, OPCODE_PIXEL_MAP, 2 + POINTER_DWORDS);
3588 if (n) {
3589 n[1].e = map;
3590 n[2].i = mapsize;
3591 save_pointer(&n[3], memdup(values, mapsize * sizeof(GLfloat)));
3592 }
3593 if (ctx->ExecuteFlag) {
3594 CALL_PixelMapfv(ctx->Exec, (map, mapsize, values));
3595 }
3596 }
3597
3598
3599 static void GLAPIENTRY
3600 save_PixelMapuiv(GLenum map, GLint mapsize, const GLuint *values)
3601 {
3602 GLfloat fvalues[MAX_PIXEL_MAP_TABLE];
3603 GLint i;
3604 if (map == GL_PIXEL_MAP_I_TO_I || map == GL_PIXEL_MAP_S_TO_S) {
3605 for (i = 0; i < mapsize; i++) {
3606 fvalues[i] = (GLfloat) values[i];
3607 }
3608 }
3609 else {
3610 for (i = 0; i < mapsize; i++) {
3611 fvalues[i] = UINT_TO_FLOAT(values[i]);
3612 }
3613 }
3614 save_PixelMapfv(map, mapsize, fvalues);
3615 }
3616
3617
3618 static void GLAPIENTRY
3619 save_PixelMapusv(GLenum map, GLint mapsize, const GLushort *values)
3620 {
3621 GLfloat fvalues[MAX_PIXEL_MAP_TABLE];
3622 GLint i;
3623 if (map == GL_PIXEL_MAP_I_TO_I || map == GL_PIXEL_MAP_S_TO_S) {
3624 for (i = 0; i < mapsize; i++) {
3625 fvalues[i] = (GLfloat) values[i];
3626 }
3627 }
3628 else {
3629 for (i = 0; i < mapsize; i++) {
3630 fvalues[i] = USHORT_TO_FLOAT(values[i]);
3631 }
3632 }
3633 save_PixelMapfv(map, mapsize, fvalues);
3634 }
3635
3636
3637 static void GLAPIENTRY
3638 save_PixelTransferf(GLenum pname, GLfloat param)
3639 {
3640 GET_CURRENT_CONTEXT(ctx);
3641 Node *n;
3642 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3643 n = alloc_instruction(ctx, OPCODE_PIXEL_TRANSFER, 2);
3644 if (n) {
3645 n[1].e = pname;
3646 n[2].f = param;
3647 }
3648 if (ctx->ExecuteFlag) {
3649 CALL_PixelTransferf(ctx->Exec, (pname, param));
3650 }
3651 }
3652
3653
3654 static void GLAPIENTRY
3655 save_PixelTransferi(GLenum pname, GLint param)
3656 {
3657 save_PixelTransferf(pname, (GLfloat) param);
3658 }
3659
3660
3661 static void GLAPIENTRY
3662 save_PixelZoom(GLfloat xfactor, GLfloat yfactor)
3663 {
3664 GET_CURRENT_CONTEXT(ctx);
3665 Node *n;
3666 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3667 n = alloc_instruction(ctx, OPCODE_PIXEL_ZOOM, 2);
3668 if (n) {
3669 n[1].f = xfactor;
3670 n[2].f = yfactor;
3671 }
3672 if (ctx->ExecuteFlag) {
3673 CALL_PixelZoom(ctx->Exec, (xfactor, yfactor));
3674 }
3675 }
3676
3677
3678 static void GLAPIENTRY
3679 save_PointParameterfvEXT(GLenum pname, const GLfloat *params)
3680 {
3681 GET_CURRENT_CONTEXT(ctx);
3682 Node *n;
3683 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3684 n = alloc_instruction(ctx, OPCODE_POINT_PARAMETERS, 4);
3685 if (n) {
3686 n[1].e = pname;
3687 n[2].f = params[0];
3688 n[3].f = params[1];
3689 n[4].f = params[2];
3690 }
3691 if (ctx->ExecuteFlag) {
3692 CALL_PointParameterfv(ctx->Exec, (pname, params));
3693 }
3694 }
3695
3696
3697 static void GLAPIENTRY
3698 save_PointParameterfEXT(GLenum pname, GLfloat param)
3699 {
3700 GLfloat parray[3];
3701 parray[0] = param;
3702 parray[1] = parray[2] = 0.0F;
3703 save_PointParameterfvEXT(pname, parray);
3704 }
3705
3706 static void GLAPIENTRY
3707 save_PointParameteriNV(GLenum pname, GLint param)
3708 {
3709 GLfloat parray[3];
3710 parray[0] = (GLfloat) param;
3711 parray[1] = parray[2] = 0.0F;
3712 save_PointParameterfvEXT(pname, parray);
3713 }
3714
3715 static void GLAPIENTRY
3716 save_PointParameterivNV(GLenum pname, const GLint * param)
3717 {
3718 GLfloat parray[3];
3719 parray[0] = (GLfloat) param[0];
3720 parray[1] = parray[2] = 0.0F;
3721 save_PointParameterfvEXT(pname, parray);
3722 }
3723
3724
3725 static void GLAPIENTRY
3726 save_PointSize(GLfloat size)
3727 {
3728 GET_CURRENT_CONTEXT(ctx);
3729 Node *n;
3730 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3731 n = alloc_instruction(ctx, OPCODE_POINT_SIZE, 1);
3732 if (n) {
3733 n[1].f = size;
3734 }
3735 if (ctx->ExecuteFlag) {
3736 CALL_PointSize(ctx->Exec, (size));
3737 }
3738 }
3739
3740
3741 static void GLAPIENTRY
3742 save_PolygonMode(GLenum face, GLenum mode)
3743 {
3744 GET_CURRENT_CONTEXT(ctx);
3745 Node *n;
3746 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3747 n = alloc_instruction(ctx, OPCODE_POLYGON_MODE, 2);
3748 if (n) {
3749 n[1].e = face;
3750 n[2].e = mode;
3751 }
3752 if (ctx->ExecuteFlag) {
3753 CALL_PolygonMode(ctx->Exec, (face, mode));
3754 }
3755 }
3756
3757
3758 static void GLAPIENTRY
3759 save_PolygonStipple(const GLubyte * pattern)
3760 {
3761 GET_CURRENT_CONTEXT(ctx);
3762 Node *n;
3763
3764 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3765
3766 n = alloc_instruction(ctx, OPCODE_POLYGON_STIPPLE, POINTER_DWORDS);
3767 if (n) {
3768 save_pointer(&n[1],
3769 unpack_image(ctx, 2, 32, 32, 1, GL_COLOR_INDEX, GL_BITMAP,
3770 pattern, &ctx->Unpack));
3771 }
3772 if (ctx->ExecuteFlag) {
3773 CALL_PolygonStipple(ctx->Exec, ((GLubyte *) pattern));
3774 }
3775 }
3776
3777
3778 static void GLAPIENTRY
3779 save_PolygonOffset(GLfloat factor, GLfloat units)
3780 {
3781 GET_CURRENT_CONTEXT(ctx);
3782 Node *n;
3783 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3784 n = alloc_instruction(ctx, OPCODE_POLYGON_OFFSET, 2);
3785 if (n) {
3786 n[1].f = factor;
3787 n[2].f = units;
3788 }
3789 if (ctx->ExecuteFlag) {
3790 CALL_PolygonOffset(ctx->Exec, (factor, units));
3791 }
3792 }
3793
3794
3795 static void GLAPIENTRY
3796 save_PolygonOffsetClampEXT(GLfloat factor, GLfloat units, GLfloat clamp)
3797 {
3798 GET_CURRENT_CONTEXT(ctx);
3799 Node *n;
3800 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3801 n = alloc_instruction(ctx, OPCODE_POLYGON_OFFSET_CLAMP, 3);
3802 if (n) {
3803 n[1].f = factor;
3804 n[2].f = units;
3805 n[3].f = clamp;
3806 }
3807 if (ctx->ExecuteFlag) {
3808 CALL_PolygonOffsetClampEXT(ctx->Exec, (factor, units, clamp));
3809 }
3810 }
3811
3812 static void GLAPIENTRY
3813 save_PopAttrib(void)
3814 {
3815 GET_CURRENT_CONTEXT(ctx);
3816 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3817 (void) alloc_instruction(ctx, OPCODE_POP_ATTRIB, 0);
3818 if (ctx->ExecuteFlag) {
3819 CALL_PopAttrib(ctx->Exec, ());
3820 }
3821 }
3822
3823
3824 static void GLAPIENTRY
3825 save_PopMatrix(void)
3826 {
3827 GET_CURRENT_CONTEXT(ctx);
3828 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3829 (void) alloc_instruction(ctx, OPCODE_POP_MATRIX, 0);
3830 if (ctx->ExecuteFlag) {
3831 CALL_PopMatrix(ctx->Exec, ());
3832 }
3833 }
3834
3835
3836 static void GLAPIENTRY
3837 save_PopName(void)
3838 {
3839 GET_CURRENT_CONTEXT(ctx);
3840 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3841 (void) alloc_instruction(ctx, OPCODE_POP_NAME, 0);
3842 if (ctx->ExecuteFlag) {
3843 CALL_PopName(ctx->Exec, ());
3844 }
3845 }
3846
3847
3848 static void GLAPIENTRY
3849 save_PrioritizeTextures(GLsizei num, const GLuint * textures,
3850 const GLclampf * priorities)
3851 {
3852 GET_CURRENT_CONTEXT(ctx);
3853 GLint i;
3854 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3855
3856 for (i = 0; i < num; i++) {
3857 Node *n;
3858 n = alloc_instruction(ctx, OPCODE_PRIORITIZE_TEXTURE, 2);
3859 if (n) {
3860 n[1].ui = textures[i];
3861 n[2].f = priorities[i];
3862 }
3863 }
3864 if (ctx->ExecuteFlag) {
3865 CALL_PrioritizeTextures(ctx->Exec, (num, textures, priorities));
3866 }
3867 }
3868
3869
3870 static void GLAPIENTRY
3871 save_PushAttrib(GLbitfield mask)
3872 {
3873 GET_CURRENT_CONTEXT(ctx);
3874 Node *n;
3875 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3876 n = alloc_instruction(ctx, OPCODE_PUSH_ATTRIB, 1);
3877 if (n) {
3878 n[1].bf = mask;
3879 }
3880 if (ctx->ExecuteFlag) {
3881 CALL_PushAttrib(ctx->Exec, (mask));
3882 }
3883 }
3884
3885
3886 static void GLAPIENTRY
3887 save_PushMatrix(void)
3888 {
3889 GET_CURRENT_CONTEXT(ctx);
3890 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3891 (void) alloc_instruction(ctx, OPCODE_PUSH_MATRIX, 0);
3892 if (ctx->ExecuteFlag) {
3893 CALL_PushMatrix(ctx->Exec, ());
3894 }
3895 }
3896
3897
3898 static void GLAPIENTRY
3899 save_PushName(GLuint name)
3900 {
3901 GET_CURRENT_CONTEXT(ctx);
3902 Node *n;
3903 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3904 n = alloc_instruction(ctx, OPCODE_PUSH_NAME, 1);
3905 if (n) {
3906 n[1].ui = name;
3907 }
3908 if (ctx->ExecuteFlag) {
3909 CALL_PushName(ctx->Exec, (name));
3910 }
3911 }
3912
3913
3914 static void GLAPIENTRY
3915 save_RasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
3916 {
3917 GET_CURRENT_CONTEXT(ctx);
3918 Node *n;
3919 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3920 n = alloc_instruction(ctx, OPCODE_RASTER_POS, 4);
3921 if (n) {
3922 n[1].f = x;
3923 n[2].f = y;
3924 n[3].f = z;
3925 n[4].f = w;
3926 }
3927 if (ctx->ExecuteFlag) {
3928 CALL_RasterPos4f(ctx->Exec, (x, y, z, w));
3929 }
3930 }
3931
3932 static void GLAPIENTRY
3933 save_RasterPos2d(GLdouble x, GLdouble y)
3934 {
3935 save_RasterPos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
3936 }
3937
3938 static void GLAPIENTRY
3939 save_RasterPos2f(GLfloat x, GLfloat y)
3940 {
3941 save_RasterPos4f(x, y, 0.0F, 1.0F);
3942 }
3943
3944 static void GLAPIENTRY
3945 save_RasterPos2i(GLint x, GLint y)
3946 {
3947 save_RasterPos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
3948 }
3949
3950 static void GLAPIENTRY
3951 save_RasterPos2s(GLshort x, GLshort y)
3952 {
3953 save_RasterPos4f(x, y, 0.0F, 1.0F);
3954 }
3955
3956 static void GLAPIENTRY
3957 save_RasterPos3d(GLdouble x, GLdouble y, GLdouble z)
3958 {
3959 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
3960 }
3961
3962 static void GLAPIENTRY
3963 save_RasterPos3f(GLfloat x, GLfloat y, GLfloat z)
3964 {
3965 save_RasterPos4f(x, y, z, 1.0F);
3966 }
3967
3968 static void GLAPIENTRY
3969 save_RasterPos3i(GLint x, GLint y, GLint z)
3970 {
3971 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
3972 }
3973
3974 static void GLAPIENTRY
3975 save_RasterPos3s(GLshort x, GLshort y, GLshort z)
3976 {
3977 save_RasterPos4f(x, y, z, 1.0F);
3978 }
3979
3980 static void GLAPIENTRY
3981 save_RasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
3982 {
3983 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
3984 }
3985
3986 static void GLAPIENTRY
3987 save_RasterPos4i(GLint x, GLint y, GLint z, GLint w)
3988 {
3989 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
3990 }
3991
3992 static void GLAPIENTRY
3993 save_RasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w)
3994 {
3995 save_RasterPos4f(x, y, z, w);
3996 }
3997
3998 static void GLAPIENTRY
3999 save_RasterPos2dv(const GLdouble * v)
4000 {
4001 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
4002 }
4003
4004 static void GLAPIENTRY
4005 save_RasterPos2fv(const GLfloat * v)
4006 {
4007 save_RasterPos4f(v[0], v[1], 0.0F, 1.0F);
4008 }
4009
4010 static void GLAPIENTRY
4011 save_RasterPos2iv(const GLint * v)
4012 {
4013 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
4014 }
4015
4016 static void GLAPIENTRY
4017 save_RasterPos2sv(const GLshort * v)
4018 {
4019 save_RasterPos4f(v[0], v[1], 0.0F, 1.0F);
4020 }
4021
4022 static void GLAPIENTRY
4023 save_RasterPos3dv(const GLdouble * v)
4024 {
4025 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
4026 }
4027
4028 static void GLAPIENTRY
4029 save_RasterPos3fv(const GLfloat * v)
4030 {
4031 save_RasterPos4f(v[0], v[1], v[2], 1.0F);
4032 }
4033
4034 static void GLAPIENTRY
4035 save_RasterPos3iv(const GLint * v)
4036 {
4037 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
4038 }
4039
4040 static void GLAPIENTRY
4041 save_RasterPos3sv(const GLshort * v)
4042 {
4043 save_RasterPos4f(v[0], v[1], v[2], 1.0F);
4044 }
4045
4046 static void GLAPIENTRY
4047 save_RasterPos4dv(const GLdouble * 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_RasterPos4fv(const GLfloat * v)
4055 {
4056 save_RasterPos4f(v[0], v[1], v[2], v[3]);
4057 }
4058
4059 static void GLAPIENTRY
4060 save_RasterPos4iv(const GLint * v)
4061 {
4062 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1],
4063 (GLfloat) v[2], (GLfloat) v[3]);
4064 }
4065
4066 static void GLAPIENTRY
4067 save_RasterPos4sv(const GLshort * v)
4068 {
4069 save_RasterPos4f(v[0], v[1], v[2], v[3]);
4070 }
4071
4072
4073 static void GLAPIENTRY
4074 save_PassThrough(GLfloat token)
4075 {
4076 GET_CURRENT_CONTEXT(ctx);
4077 Node *n;
4078 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4079 n = alloc_instruction(ctx, OPCODE_PASSTHROUGH, 1);
4080 if (n) {
4081 n[1].f = token;
4082 }
4083 if (ctx->ExecuteFlag) {
4084 CALL_PassThrough(ctx->Exec, (token));
4085 }
4086 }
4087
4088
4089 static void GLAPIENTRY
4090 save_ReadBuffer(GLenum mode)
4091 {
4092 GET_CURRENT_CONTEXT(ctx);
4093 Node *n;
4094 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4095 n = alloc_instruction(ctx, OPCODE_READ_BUFFER, 1);
4096 if (n) {
4097 n[1].e = mode;
4098 }
4099 if (ctx->ExecuteFlag) {
4100 CALL_ReadBuffer(ctx->Exec, (mode));
4101 }
4102 }
4103
4104
4105 static void GLAPIENTRY
4106 save_Rotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
4107 {
4108 GET_CURRENT_CONTEXT(ctx);
4109 Node *n;
4110 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4111 n = alloc_instruction(ctx, OPCODE_ROTATE, 4);
4112 if (n) {
4113 n[1].f = angle;
4114 n[2].f = x;
4115 n[3].f = y;
4116 n[4].f = z;
4117 }
4118 if (ctx->ExecuteFlag) {
4119 CALL_Rotatef(ctx->Exec, (angle, x, y, z));
4120 }
4121 }
4122
4123
4124 static void GLAPIENTRY
4125 save_Rotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
4126 {
4127 save_Rotatef((GLfloat) angle, (GLfloat) x, (GLfloat) y, (GLfloat) z);
4128 }
4129
4130
4131 static void GLAPIENTRY
4132 save_Scalef(GLfloat x, GLfloat y, GLfloat z)
4133 {
4134 GET_CURRENT_CONTEXT(ctx);
4135 Node *n;
4136 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4137 n = alloc_instruction(ctx, OPCODE_SCALE, 3);
4138 if (n) {
4139 n[1].f = x;
4140 n[2].f = y;
4141 n[3].f = z;
4142 }
4143 if (ctx->ExecuteFlag) {
4144 CALL_Scalef(ctx->Exec, (x, y, z));
4145 }
4146 }
4147
4148
4149 static void GLAPIENTRY
4150 save_Scaled(GLdouble x, GLdouble y, GLdouble z)
4151 {
4152 save_Scalef((GLfloat) x, (GLfloat) y, (GLfloat) z);
4153 }
4154
4155
4156 static void GLAPIENTRY
4157 save_Scissor(GLint x, GLint y, GLsizei width, GLsizei height)
4158 {
4159 GET_CURRENT_CONTEXT(ctx);
4160 Node *n;
4161 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4162 n = alloc_instruction(ctx, OPCODE_SCISSOR, 4);
4163 if (n) {
4164 n[1].i = x;
4165 n[2].i = y;
4166 n[3].i = width;
4167 n[4].i = height;
4168 }
4169 if (ctx->ExecuteFlag) {
4170 CALL_Scissor(ctx->Exec, (x, y, width, height));
4171 }
4172 }
4173
4174
4175 static void GLAPIENTRY
4176 save_ShadeModel(GLenum mode)
4177 {
4178 GET_CURRENT_CONTEXT(ctx);
4179 Node *n;
4180 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx);
4181
4182 if (ctx->ExecuteFlag) {
4183 CALL_ShadeModel(ctx->Exec, (mode));
4184 }
4185
4186 /* Don't compile this call if it's a no-op.
4187 * By avoiding this state change we have a better chance of
4188 * coalescing subsequent drawing commands into one batch.
4189 */
4190 if (ctx->ListState.Current.ShadeModel == mode)
4191 return;
4192
4193 SAVE_FLUSH_VERTICES(ctx);
4194
4195 ctx->ListState.Current.ShadeModel = mode;
4196
4197 n = alloc_instruction(ctx, OPCODE_SHADE_MODEL, 1);
4198 if (n) {
4199 n[1].e = mode;
4200 }
4201 }
4202
4203
4204 static void GLAPIENTRY
4205 save_StencilFunc(GLenum func, GLint ref, GLuint mask)
4206 {
4207 GET_CURRENT_CONTEXT(ctx);
4208 Node *n;
4209 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4210 n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC, 3);
4211 if (n) {
4212 n[1].e = func;
4213 n[2].i = ref;
4214 n[3].ui = mask;
4215 }
4216 if (ctx->ExecuteFlag) {
4217 CALL_StencilFunc(ctx->Exec, (func, ref, mask));
4218 }
4219 }
4220
4221
4222 static void GLAPIENTRY
4223 save_StencilMask(GLuint mask)
4224 {
4225 GET_CURRENT_CONTEXT(ctx);
4226 Node *n;
4227 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4228 n = alloc_instruction(ctx, OPCODE_STENCIL_MASK, 1);
4229 if (n) {
4230 n[1].ui = mask;
4231 }
4232 if (ctx->ExecuteFlag) {
4233 CALL_StencilMask(ctx->Exec, (mask));
4234 }
4235 }
4236
4237
4238 static void GLAPIENTRY
4239 save_StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
4240 {
4241 GET_CURRENT_CONTEXT(ctx);
4242 Node *n;
4243 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4244 n = alloc_instruction(ctx, OPCODE_STENCIL_OP, 3);
4245 if (n) {
4246 n[1].e = fail;
4247 n[2].e = zfail;
4248 n[3].e = zpass;
4249 }
4250 if (ctx->ExecuteFlag) {
4251 CALL_StencilOp(ctx->Exec, (fail, zfail, zpass));
4252 }
4253 }
4254
4255
4256 static void GLAPIENTRY
4257 save_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
4258 {
4259 GET_CURRENT_CONTEXT(ctx);
4260 Node *n;
4261 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4262 n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4);
4263 if (n) {
4264 n[1].e = face;
4265 n[2].e = func;
4266 n[3].i = ref;
4267 n[4].ui = mask;
4268 }
4269 if (ctx->ExecuteFlag) {
4270 CALL_StencilFuncSeparate(ctx->Exec, (face, func, ref, mask));
4271 }
4272 }
4273
4274
4275 static void GLAPIENTRY
4276 save_StencilFuncSeparateATI(GLenum frontfunc, GLenum backfunc, GLint ref,
4277 GLuint mask)
4278 {
4279 GET_CURRENT_CONTEXT(ctx);
4280 Node *n;
4281 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4282 /* GL_FRONT */
4283 n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4);
4284 if (n) {
4285 n[1].e = GL_FRONT;
4286 n[2].e = frontfunc;
4287 n[3].i = ref;
4288 n[4].ui = mask;
4289 }
4290 /* GL_BACK */
4291 n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4);
4292 if (n) {
4293 n[1].e = GL_BACK;
4294 n[2].e = backfunc;
4295 n[3].i = ref;
4296 n[4].ui = mask;
4297 }
4298 if (ctx->ExecuteFlag) {
4299 CALL_StencilFuncSeparate(ctx->Exec, (GL_FRONT, frontfunc, ref, mask));
4300 CALL_StencilFuncSeparate(ctx->Exec, (GL_BACK, backfunc, ref, mask));
4301 }
4302 }
4303
4304
4305 static void GLAPIENTRY
4306 save_StencilMaskSeparate(GLenum face, GLuint mask)
4307 {
4308 GET_CURRENT_CONTEXT(ctx);
4309 Node *n;
4310 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4311 n = alloc_instruction(ctx, OPCODE_STENCIL_MASK_SEPARATE, 2);
4312 if (n) {
4313 n[1].e = face;
4314 n[2].ui = mask;
4315 }
4316 if (ctx->ExecuteFlag) {
4317 CALL_StencilMaskSeparate(ctx->Exec, (face, mask));
4318 }
4319 }
4320
4321
4322 static void GLAPIENTRY
4323 save_StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
4324 {
4325 GET_CURRENT_CONTEXT(ctx);
4326 Node *n;
4327 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4328 n = alloc_instruction(ctx, OPCODE_STENCIL_OP_SEPARATE, 4);
4329 if (n) {
4330 n[1].e = face;
4331 n[2].e = fail;
4332 n[3].e = zfail;
4333 n[4].e = zpass;
4334 }
4335 if (ctx->ExecuteFlag) {
4336 CALL_StencilOpSeparate(ctx->Exec, (face, fail, zfail, zpass));
4337 }
4338 }
4339
4340
4341 static void GLAPIENTRY
4342 save_TexEnvfv(GLenum target, GLenum pname, const GLfloat *params)
4343 {
4344 GET_CURRENT_CONTEXT(ctx);
4345 Node *n;
4346 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4347 n = alloc_instruction(ctx, OPCODE_TEXENV, 6);
4348 if (n) {
4349 n[1].e = target;
4350 n[2].e = pname;
4351 if (pname == GL_TEXTURE_ENV_COLOR) {
4352 n[3].f = params[0];
4353 n[4].f = params[1];
4354 n[5].f = params[2];
4355 n[6].f = params[3];
4356 }
4357 else {
4358 n[3].f = params[0];
4359 n[4].f = n[5].f = n[6].f = 0.0F;
4360 }
4361 }
4362 if (ctx->ExecuteFlag) {
4363 CALL_TexEnvfv(ctx->Exec, (target, pname, params));
4364 }
4365 }
4366
4367
4368 static void GLAPIENTRY
4369 save_TexEnvf(GLenum target, GLenum pname, GLfloat param)
4370 {
4371 GLfloat parray[4];
4372 parray[0] = (GLfloat) param;
4373 parray[1] = parray[2] = parray[3] = 0.0F;
4374 save_TexEnvfv(target, pname, parray);
4375 }
4376
4377
4378 static void GLAPIENTRY
4379 save_TexEnvi(GLenum target, GLenum pname, GLint param)
4380 {
4381 GLfloat p[4];
4382 p[0] = (GLfloat) param;
4383 p[1] = p[2] = p[3] = 0.0F;
4384 save_TexEnvfv(target, pname, p);
4385 }
4386
4387
4388 static void GLAPIENTRY
4389 save_TexEnviv(GLenum target, GLenum pname, const GLint * param)
4390 {
4391 GLfloat p[4];
4392 if (pname == GL_TEXTURE_ENV_COLOR) {
4393 p[0] = INT_TO_FLOAT(param[0]);
4394 p[1] = INT_TO_FLOAT(param[1]);
4395 p[2] = INT_TO_FLOAT(param[2]);
4396 p[3] = INT_TO_FLOAT(param[3]);
4397 }
4398 else {
4399 p[0] = (GLfloat) param[0];
4400 p[1] = p[2] = p[3] = 0.0F;
4401 }
4402 save_TexEnvfv(target, pname, p);
4403 }
4404
4405
4406 static void GLAPIENTRY
4407 save_TexGenfv(GLenum coord, GLenum pname, const GLfloat *params)
4408 {
4409 GET_CURRENT_CONTEXT(ctx);
4410 Node *n;
4411 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4412 n = alloc_instruction(ctx, OPCODE_TEXGEN, 6);
4413 if (n) {
4414 n[1].e = coord;
4415 n[2].e = pname;
4416 n[3].f = params[0];
4417 n[4].f = params[1];
4418 n[5].f = params[2];
4419 n[6].f = params[3];
4420 }
4421 if (ctx->ExecuteFlag) {
4422 CALL_TexGenfv(ctx->Exec, (coord, pname, params));
4423 }
4424 }
4425
4426
4427 static void GLAPIENTRY
4428 save_TexGeniv(GLenum coord, GLenum pname, const GLint *params)
4429 {
4430 GLfloat p[4];
4431 p[0] = (GLfloat) params[0];
4432 p[1] = (GLfloat) params[1];
4433 p[2] = (GLfloat) params[2];
4434 p[3] = (GLfloat) params[3];
4435 save_TexGenfv(coord, pname, p);
4436 }
4437
4438
4439 static void GLAPIENTRY
4440 save_TexGend(GLenum coord, GLenum pname, GLdouble param)
4441 {
4442 GLfloat parray[4];
4443 parray[0] = (GLfloat) param;
4444 parray[1] = parray[2] = parray[3] = 0.0F;
4445 save_TexGenfv(coord, pname, parray);
4446 }
4447
4448
4449 static void GLAPIENTRY
4450 save_TexGendv(GLenum coord, GLenum pname, const GLdouble *params)
4451 {
4452 GLfloat p[4];
4453 p[0] = (GLfloat) params[0];
4454 p[1] = (GLfloat) params[1];
4455 p[2] = (GLfloat) params[2];
4456 p[3] = (GLfloat) params[3];
4457 save_TexGenfv(coord, pname, p);
4458 }
4459
4460
4461 static void GLAPIENTRY
4462 save_TexGenf(GLenum coord, GLenum pname, GLfloat param)
4463 {
4464 GLfloat parray[4];
4465 parray[0] = param;
4466 parray[1] = parray[2] = parray[3] = 0.0F;
4467 save_TexGenfv(coord, pname, parray);
4468 }
4469
4470
4471 static void GLAPIENTRY
4472 save_TexGeni(GLenum coord, GLenum pname, GLint param)
4473 {
4474 GLint parray[4];
4475 parray[0] = param;
4476 parray[1] = parray[2] = parray[3] = 0;
4477 save_TexGeniv(coord, pname, parray);
4478 }
4479
4480
4481 static void GLAPIENTRY
4482 save_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
4483 {
4484 GET_CURRENT_CONTEXT(ctx);
4485 Node *n;
4486 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4487 n = alloc_instruction(ctx, OPCODE_TEXPARAMETER, 6);
4488 if (n) {
4489 n[1].e = target;
4490 n[2].e = pname;
4491 n[3].f = params[0];
4492 n[4].f = params[1];
4493 n[5].f = params[2];
4494 n[6].f = params[3];
4495 }
4496 if (ctx->ExecuteFlag) {
4497 CALL_TexParameterfv(ctx->Exec, (target, pname, params));
4498 }
4499 }
4500
4501
4502 static void GLAPIENTRY
4503 save_TexParameterf(GLenum target, GLenum pname, GLfloat param)
4504 {
4505 GLfloat parray[4];
4506 parray[0] = param;
4507 parray[1] = parray[2] = parray[3] = 0.0F;
4508 save_TexParameterfv(target, pname, parray);
4509 }
4510
4511
4512 static void GLAPIENTRY
4513 save_TexParameteri(GLenum target, GLenum pname, GLint param)
4514 {
4515 GLfloat fparam[4];
4516 fparam[0] = (GLfloat) param;
4517 fparam[1] = fparam[2] = fparam[3] = 0.0F;
4518 save_TexParameterfv(target, pname, fparam);
4519 }
4520
4521
4522 static void GLAPIENTRY
4523 save_TexParameteriv(GLenum target, GLenum pname, const GLint *params)
4524 {
4525 GLfloat fparam[4];
4526 fparam[0] = (GLfloat) params[0];
4527 fparam[1] = fparam[2] = fparam[3] = 0.0F;
4528 save_TexParameterfv(target, pname, fparam);
4529 }
4530
4531
4532 static void GLAPIENTRY
4533 save_TexImage1D(GLenum target,
4534 GLint level, GLint components,
4535 GLsizei width, GLint border,
4536 GLenum format, GLenum type, const GLvoid * pixels)
4537 {
4538 GET_CURRENT_CONTEXT(ctx);
4539 if (target == GL_PROXY_TEXTURE_1D) {
4540 /* don't compile, execute immediately */
4541 CALL_TexImage1D(ctx->Exec, (target, level, components, width,
4542 border, format, type, pixels));
4543 }
4544 else {
4545 Node *n;
4546 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4547 n = alloc_instruction(ctx, OPCODE_TEX_IMAGE1D, 7 + POINTER_DWORDS);
4548 if (n) {
4549 n[1].e = target;
4550 n[2].i = level;
4551 n[3].i = components;
4552 n[4].i = (GLint) width;
4553 n[5].i = border;
4554 n[6].e = format;
4555 n[7].e = type;
4556 save_pointer(&n[8],
4557 unpack_image(ctx, 1, width, 1, 1, format, type,
4558 pixels, &ctx->Unpack));
4559 }
4560 if (ctx->ExecuteFlag) {
4561 CALL_TexImage1D(ctx->Exec, (target, level, components, width,
4562 border, format, type, pixels));
4563 }
4564 }
4565 }
4566
4567
4568 static void GLAPIENTRY
4569 save_TexImage2D(GLenum target,
4570 GLint level, GLint components,
4571 GLsizei width, GLsizei height, GLint border,
4572 GLenum format, GLenum type, const GLvoid * pixels)
4573 {
4574 GET_CURRENT_CONTEXT(ctx);
4575 if (target == GL_PROXY_TEXTURE_2D) {
4576 /* don't compile, execute immediately */
4577 CALL_TexImage2D(ctx->Exec, (target, level, components, width,
4578 height, border, format, type, pixels));
4579 }
4580 else {
4581 Node *n;
4582 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4583 n = alloc_instruction(ctx, OPCODE_TEX_IMAGE2D, 8 + POINTER_DWORDS);
4584 if (n) {
4585 n[1].e = target;
4586 n[2].i = level;
4587 n[3].i = components;
4588 n[4].i = (GLint) width;
4589 n[5].i = (GLint) height;
4590 n[6].i = border;
4591 n[7].e = format;
4592 n[8].e = type;
4593 save_pointer(&n[9],
4594 unpack_image(ctx, 2, width, height, 1, format, type,
4595 pixels, &ctx->Unpack));
4596 }
4597 if (ctx->ExecuteFlag) {
4598 CALL_TexImage2D(ctx->Exec, (target, level, components, width,
4599 height, border, format, type, pixels));
4600 }
4601 }
4602 }
4603
4604
4605 static void GLAPIENTRY
4606 save_TexImage3D(GLenum target,
4607 GLint level, GLint internalFormat,
4608 GLsizei width, GLsizei height, GLsizei depth,
4609 GLint border,
4610 GLenum format, GLenum type, const GLvoid * pixels)
4611 {
4612 GET_CURRENT_CONTEXT(ctx);
4613 if (target == GL_PROXY_TEXTURE_3D) {
4614 /* don't compile, execute immediately */
4615 CALL_TexImage3D(ctx->Exec, (target, level, internalFormat, width,
4616 height, depth, border, format, type,
4617 pixels));
4618 }
4619 else {
4620 Node *n;
4621 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4622 n = alloc_instruction(ctx, OPCODE_TEX_IMAGE3D, 9 + POINTER_DWORDS);
4623 if (n) {
4624 n[1].e = target;
4625 n[2].i = level;
4626 n[3].i = (GLint) internalFormat;
4627 n[4].i = (GLint) width;
4628 n[5].i = (GLint) height;
4629 n[6].i = (GLint) depth;
4630 n[7].i = border;
4631 n[8].e = format;
4632 n[9].e = type;
4633 save_pointer(&n[10],
4634 unpack_image(ctx, 3, width, height, depth, format, type,
4635 pixels, &ctx->Unpack));
4636 }
4637 if (ctx->ExecuteFlag) {
4638 CALL_TexImage3D(ctx->Exec, (target, level, internalFormat, width,
4639 height, depth, border, format, type,
4640 pixels));
4641 }
4642 }
4643 }
4644
4645
4646 static void GLAPIENTRY
4647 save_TexSubImage1D(GLenum target, GLint level, GLint xoffset,
4648 GLsizei width, GLenum format, GLenum type,
4649 const GLvoid * pixels)
4650 {
4651 GET_CURRENT_CONTEXT(ctx);
4652 Node *n;
4653
4654 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4655
4656 n = alloc_instruction(ctx, OPCODE_TEX_SUB_IMAGE1D, 6 + POINTER_DWORDS);
4657 if (n) {
4658 n[1].e = target;
4659 n[2].i = level;
4660 n[3].i = xoffset;
4661 n[4].i = (GLint) width;
4662 n[5].e = format;
4663 n[6].e = type;
4664 save_pointer(&n[7],
4665 unpack_image(ctx, 1, width, 1, 1, format, type,
4666 pixels, &ctx->Unpack));
4667 }
4668 if (ctx->ExecuteFlag) {
4669 CALL_TexSubImage1D(ctx->Exec, (target, level, xoffset, width,
4670 format, type, pixels));
4671 }
4672 }
4673
4674
4675 static void GLAPIENTRY
4676 save_TexSubImage2D(GLenum target, GLint level,
4677 GLint xoffset, GLint yoffset,
4678 GLsizei width, GLsizei height,
4679 GLenum format, GLenum type, const GLvoid * pixels)
4680 {
4681 GET_CURRENT_CONTEXT(ctx);
4682 Node *n;
4683
4684 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4685
4686 n = alloc_instruction(ctx, OPCODE_TEX_SUB_IMAGE2D, 8 + POINTER_DWORDS);
4687 if (n) {
4688 n[1].e = target;
4689 n[2].i = level;
4690 n[3].i = xoffset;
4691 n[4].i = yoffset;
4692 n[5].i = (GLint) width;
4693 n[6].i = (GLint) height;
4694 n[7].e = format;
4695 n[8].e = type;
4696 save_pointer(&n[9],
4697 unpack_image(ctx, 2, width, height, 1, format, type,
4698 pixels, &ctx->Unpack));
4699 }
4700 if (ctx->ExecuteFlag) {
4701 CALL_TexSubImage2D(ctx->Exec, (target, level, xoffset, yoffset,
4702 width, height, format, type, pixels));
4703 }
4704 }
4705
4706
4707 static void GLAPIENTRY
4708 save_TexSubImage3D(GLenum target, GLint level,
4709 GLint xoffset, GLint yoffset, GLint zoffset,
4710 GLsizei width, GLsizei height, GLsizei depth,
4711 GLenum format, GLenum type, const GLvoid * pixels)
4712 {
4713 GET_CURRENT_CONTEXT(ctx);
4714 Node *n;
4715
4716 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4717
4718 n = alloc_instruction(ctx, OPCODE_TEX_SUB_IMAGE3D, 10 + POINTER_DWORDS);
4719 if (n) {
4720 n[1].e = target;
4721 n[2].i = level;
4722 n[3].i = xoffset;
4723 n[4].i = yoffset;
4724 n[5].i = zoffset;
4725 n[6].i = (GLint) width;
4726 n[7].i = (GLint) height;
4727 n[8].i = (GLint) depth;
4728 n[9].e = format;
4729 n[10].e = type;
4730 save_pointer(&n[11],
4731 unpack_image(ctx, 3, width, height, depth, format, type,
4732 pixels, &ctx->Unpack));
4733 }
4734 if (ctx->ExecuteFlag) {
4735 CALL_TexSubImage3D(ctx->Exec, (target, level,
4736 xoffset, yoffset, zoffset,
4737 width, height, depth, format, type,
4738 pixels));
4739 }
4740 }
4741
4742
4743 static void GLAPIENTRY
4744 save_Translatef(GLfloat x, GLfloat y, GLfloat z)
4745 {
4746 GET_CURRENT_CONTEXT(ctx);
4747 Node *n;
4748 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4749 n = alloc_instruction(ctx, OPCODE_TRANSLATE, 3);
4750 if (n) {
4751 n[1].f = x;
4752 n[2].f = y;
4753 n[3].f = z;
4754 }
4755 if (ctx->ExecuteFlag) {
4756 CALL_Translatef(ctx->Exec, (x, y, z));
4757 }
4758 }
4759
4760
4761 static void GLAPIENTRY
4762 save_Translated(GLdouble x, GLdouble y, GLdouble z)
4763 {
4764 save_Translatef((GLfloat) x, (GLfloat) y, (GLfloat) z);
4765 }
4766
4767
4768
4769 static void GLAPIENTRY
4770 save_Viewport(GLint x, GLint y, GLsizei width, GLsizei height)
4771 {
4772 GET_CURRENT_CONTEXT(ctx);
4773 Node *n;
4774 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4775 n = alloc_instruction(ctx, OPCODE_VIEWPORT, 4);
4776 if (n) {
4777 n[1].i = x;
4778 n[2].i = y;
4779 n[3].i = (GLint) width;
4780 n[4].i = (GLint) height;
4781 }
4782 if (ctx->ExecuteFlag) {
4783 CALL_Viewport(ctx->Exec, (x, y, width, height));
4784 }
4785 }
4786
4787 static void GLAPIENTRY
4788 save_ViewportIndexedf(GLuint index, GLfloat x, GLfloat y, GLfloat width,
4789 GLfloat height)
4790 {
4791 GET_CURRENT_CONTEXT(ctx);
4792 Node *n;
4793 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4794 n = alloc_instruction(ctx, OPCODE_VIEWPORT_INDEXED_F, 5);
4795 if (n) {
4796 n[1].ui = index;
4797 n[2].f = x;
4798 n[3].f = y;
4799 n[4].f = width;
4800 n[5].f = height;
4801 }
4802 if (ctx->ExecuteFlag) {
4803 CALL_ViewportIndexedf(ctx->Exec, (index, x, y, width, height));
4804 }
4805 }
4806
4807 static void GLAPIENTRY
4808 save_ViewportIndexedfv(GLuint index, const GLfloat *v)
4809 {
4810 GET_CURRENT_CONTEXT(ctx);
4811 Node *n;
4812 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4813 n = alloc_instruction(ctx, OPCODE_VIEWPORT_INDEXED_FV, 5);
4814 if (n) {
4815 n[1].ui = index;
4816 n[2].f = v[0];
4817 n[3].f = v[1];
4818 n[4].f = v[2];
4819 n[5].f = v[3];
4820 }
4821 if (ctx->ExecuteFlag) {
4822 CALL_ViewportIndexedfv(ctx->Exec, (index, v));
4823 }
4824 }
4825
4826 static void GLAPIENTRY
4827 save_ViewportArrayv(GLuint first, GLsizei count, const GLfloat *v)
4828 {
4829 GET_CURRENT_CONTEXT(ctx);
4830 Node *n;
4831 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4832 n = alloc_instruction(ctx, OPCODE_VIEWPORT_ARRAY_V, 2 + POINTER_DWORDS);
4833 if (n) {
4834 n[1].ui = first;
4835 n[2].si = count;
4836 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLfloat)));
4837 }
4838 if (ctx->ExecuteFlag) {
4839 CALL_ViewportArrayv(ctx->Exec, (first, count, v));
4840 }
4841 }
4842
4843 static void GLAPIENTRY
4844 save_ScissorIndexed(GLuint index, GLint left, GLint bottom, GLsizei width,
4845 GLsizei height)
4846 {
4847 GET_CURRENT_CONTEXT(ctx);
4848 Node *n;
4849 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4850 n = alloc_instruction(ctx, OPCODE_SCISSOR_INDEXED, 5);
4851 if (n) {
4852 n[1].ui = index;
4853 n[2].i = left;
4854 n[3].i = bottom;
4855 n[4].si = width;
4856 n[5].si = height;
4857 }
4858 if (ctx->ExecuteFlag) {
4859 CALL_ScissorIndexed(ctx->Exec, (index, left, bottom, width, height));
4860 }
4861 }
4862
4863 static void GLAPIENTRY
4864 save_ScissorIndexedv(GLuint index, const GLint *v)
4865 {
4866 GET_CURRENT_CONTEXT(ctx);
4867 Node *n;
4868 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4869 n = alloc_instruction(ctx, OPCODE_SCISSOR_INDEXED_V, 5);
4870 if (n) {
4871 n[1].ui = index;
4872 n[2].i = v[0];
4873 n[3].i = v[1];
4874 n[4].si = v[2];
4875 n[5].si = v[3];
4876 }
4877 if (ctx->ExecuteFlag) {
4878 CALL_ScissorIndexedv(ctx->Exec, (index, v));
4879 }
4880 }
4881
4882 static void GLAPIENTRY
4883 save_ScissorArrayv(GLuint first, GLsizei count, const GLint *v)
4884 {
4885 GET_CURRENT_CONTEXT(ctx);
4886 Node *n;
4887 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4888 n = alloc_instruction(ctx, OPCODE_SCISSOR_ARRAY_V, 2 + POINTER_DWORDS);
4889 if (n) {
4890 n[1].ui = first;
4891 n[2].si = count;
4892 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLint)));
4893 }
4894 if (ctx->ExecuteFlag) {
4895 CALL_ScissorArrayv(ctx->Exec, (first, count, v));
4896 }
4897 }
4898
4899 static void GLAPIENTRY
4900 save_DepthRangeIndexed(GLuint index, GLclampd n, GLclampd f)
4901 {
4902 GET_CURRENT_CONTEXT(ctx);
4903 Node *node;
4904 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4905 node = alloc_instruction(ctx, OPCODE_DEPTH_INDEXED, 3);
4906 if (node) {
4907 node[1].ui = index;
4908 /* Mesa stores these as floats internally so we deliberately convert
4909 * them to a float here.
4910 */
4911 node[2].f = n;
4912 node[3].f = f;
4913 }
4914 if (ctx->ExecuteFlag) {
4915 CALL_DepthRangeIndexed(ctx->Exec, (index, n, f));
4916 }
4917 }
4918
4919 static void GLAPIENTRY
4920 save_DepthRangeArrayv(GLuint first, GLsizei count, const GLclampd *v)
4921 {
4922 GET_CURRENT_CONTEXT(ctx);
4923 Node *n;
4924 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4925 n = alloc_instruction(ctx, OPCODE_DEPTH_ARRAY_V, 2 + POINTER_DWORDS);
4926 if (n) {
4927 n[1].ui = first;
4928 n[2].si = count;
4929 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLclampd)));
4930 }
4931 if (ctx->ExecuteFlag) {
4932 CALL_DepthRangeArrayv(ctx->Exec, (first, count, v));
4933 }
4934 }
4935
4936 static void GLAPIENTRY
4937 save_WindowPos4fMESA(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
4938 {
4939 GET_CURRENT_CONTEXT(ctx);
4940 Node *n;
4941 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4942 n = alloc_instruction(ctx, OPCODE_WINDOW_POS, 4);
4943 if (n) {
4944 n[1].f = x;
4945 n[2].f = y;
4946 n[3].f = z;
4947 n[4].f = w;
4948 }
4949 if (ctx->ExecuteFlag) {
4950 CALL_WindowPos4fMESA(ctx->Exec, (x, y, z, w));
4951 }
4952 }
4953
4954 static void GLAPIENTRY
4955 save_WindowPos2dMESA(GLdouble x, GLdouble y)
4956 {
4957 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
4958 }
4959
4960 static void GLAPIENTRY
4961 save_WindowPos2fMESA(GLfloat x, GLfloat y)
4962 {
4963 save_WindowPos4fMESA(x, y, 0.0F, 1.0F);
4964 }
4965
4966 static void GLAPIENTRY
4967 save_WindowPos2iMESA(GLint x, GLint y)
4968 {
4969 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
4970 }
4971
4972 static void GLAPIENTRY
4973 save_WindowPos2sMESA(GLshort x, GLshort y)
4974 {
4975 save_WindowPos4fMESA(x, y, 0.0F, 1.0F);
4976 }
4977
4978 static void GLAPIENTRY
4979 save_WindowPos3dMESA(GLdouble x, GLdouble y, GLdouble z)
4980 {
4981 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
4982 }
4983
4984 static void GLAPIENTRY
4985 save_WindowPos3fMESA(GLfloat x, GLfloat y, GLfloat z)
4986 {
4987 save_WindowPos4fMESA(x, y, z, 1.0F);
4988 }
4989
4990 static void GLAPIENTRY
4991 save_WindowPos3iMESA(GLint x, GLint y, GLint z)
4992 {
4993 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
4994 }
4995
4996 static void GLAPIENTRY
4997 save_WindowPos3sMESA(GLshort x, GLshort y, GLshort z)
4998 {
4999 save_WindowPos4fMESA(x, y, z, 1.0F);
5000 }
5001
5002 static void GLAPIENTRY
5003 save_WindowPos4dMESA(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
5004 {
5005 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
5006 }
5007
5008 static void GLAPIENTRY
5009 save_WindowPos4iMESA(GLint x, GLint y, GLint z, GLint w)
5010 {
5011 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
5012 }
5013
5014 static void GLAPIENTRY
5015 save_WindowPos4sMESA(GLshort x, GLshort y, GLshort z, GLshort w)
5016 {
5017 save_WindowPos4fMESA(x, y, z, w);
5018 }
5019
5020 static void GLAPIENTRY
5021 save_WindowPos2dvMESA(const GLdouble * v)
5022 {
5023 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
5024 }
5025
5026 static void GLAPIENTRY
5027 save_WindowPos2fvMESA(const GLfloat * v)
5028 {
5029 save_WindowPos4fMESA(v[0], v[1], 0.0F, 1.0F);
5030 }
5031
5032 static void GLAPIENTRY
5033 save_WindowPos2ivMESA(const GLint * v)
5034 {
5035 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
5036 }
5037
5038 static void GLAPIENTRY
5039 save_WindowPos2svMESA(const GLshort * v)
5040 {
5041 save_WindowPos4fMESA(v[0], v[1], 0.0F, 1.0F);
5042 }
5043
5044 static void GLAPIENTRY
5045 save_WindowPos3dvMESA(const GLdouble * v)
5046 {
5047 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
5048 }
5049
5050 static void GLAPIENTRY
5051 save_WindowPos3fvMESA(const GLfloat * v)
5052 {
5053 save_WindowPos4fMESA(v[0], v[1], v[2], 1.0F);
5054 }
5055
5056 static void GLAPIENTRY
5057 save_WindowPos3ivMESA(const GLint * v)
5058 {
5059 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
5060 }
5061
5062 static void GLAPIENTRY
5063 save_WindowPos3svMESA(const GLshort * v)
5064 {
5065 save_WindowPos4fMESA(v[0], v[1], v[2], 1.0F);
5066 }
5067
5068 static void GLAPIENTRY
5069 save_WindowPos4dvMESA(const GLdouble * 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_WindowPos4fvMESA(const GLfloat * v)
5077 {
5078 save_WindowPos4fMESA(v[0], v[1], v[2], v[3]);
5079 }
5080
5081 static void GLAPIENTRY
5082 save_WindowPos4ivMESA(const GLint * v)
5083 {
5084 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1],
5085 (GLfloat) v[2], (GLfloat) v[3]);
5086 }
5087
5088 static void GLAPIENTRY
5089 save_WindowPos4svMESA(const GLshort * v)
5090 {
5091 save_WindowPos4fMESA(v[0], v[1], v[2], v[3]);
5092 }
5093
5094
5095
5096 /* GL_ARB_multitexture */
5097 static void GLAPIENTRY
5098 save_ActiveTextureARB(GLenum target)
5099 {
5100 GET_CURRENT_CONTEXT(ctx);
5101 Node *n;
5102 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5103 n = alloc_instruction(ctx, OPCODE_ACTIVE_TEXTURE, 1);
5104 if (n) {
5105 n[1].e = target;
5106 }
5107 if (ctx->ExecuteFlag) {
5108 CALL_ActiveTexture(ctx->Exec, (target));
5109 }
5110 }
5111
5112
5113 /* GL_ARB_transpose_matrix */
5114
5115 static void GLAPIENTRY
5116 save_LoadTransposeMatrixdARB(const GLdouble m[16])
5117 {
5118 GLfloat tm[16];
5119 _math_transposefd(tm, m);
5120 save_LoadMatrixf(tm);
5121 }
5122
5123
5124 static void GLAPIENTRY
5125 save_LoadTransposeMatrixfARB(const GLfloat m[16])
5126 {
5127 GLfloat tm[16];
5128 _math_transposef(tm, m);
5129 save_LoadMatrixf(tm);
5130 }
5131
5132
5133 static void GLAPIENTRY
5134 save_MultTransposeMatrixdARB(const GLdouble m[16])
5135 {
5136 GLfloat tm[16];
5137 _math_transposefd(tm, m);
5138 save_MultMatrixf(tm);
5139 }
5140
5141
5142 static void GLAPIENTRY
5143 save_MultTransposeMatrixfARB(const GLfloat m[16])
5144 {
5145 GLfloat tm[16];
5146 _math_transposef(tm, m);
5147 save_MultMatrixf(tm);
5148 }
5149
5150 static GLvoid *copy_data(const GLvoid *data, GLsizei size, const char *func)
5151 {
5152 GET_CURRENT_CONTEXT(ctx);
5153 GLvoid *image;
5154
5155 if (!data)
5156 return NULL;
5157
5158 image = malloc(size);
5159 if (!image) {
5160 _mesa_error(ctx, GL_OUT_OF_MEMORY, "%s", func);
5161 return NULL;
5162 }
5163 memcpy(image, data, size);
5164
5165 return image;
5166 }
5167
5168
5169 /* GL_ARB_texture_compression */
5170 static void GLAPIENTRY
5171 save_CompressedTexImage1DARB(GLenum target, GLint level,
5172 GLenum internalFormat, GLsizei width,
5173 GLint border, GLsizei imageSize,
5174 const GLvoid * data)
5175 {
5176 GET_CURRENT_CONTEXT(ctx);
5177 if (target == GL_PROXY_TEXTURE_1D) {
5178 /* don't compile, execute immediately */
5179 CALL_CompressedTexImage1D(ctx->Exec, (target, level, internalFormat,
5180 width, border, imageSize,
5181 data));
5182 }
5183 else {
5184 Node *n;
5185 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5186
5187 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_1D,
5188 6 + POINTER_DWORDS);
5189 if (n) {
5190 n[1].e = target;
5191 n[2].i = level;
5192 n[3].e = internalFormat;
5193 n[4].i = (GLint) width;
5194 n[5].i = border;
5195 n[6].i = imageSize;
5196 save_pointer(&n[7],
5197 copy_data(data, imageSize, "glCompressedTexImage1DARB"));
5198 }
5199 if (ctx->ExecuteFlag) {
5200 CALL_CompressedTexImage1D(ctx->Exec,
5201 (target, level, internalFormat, width,
5202 border, imageSize, data));
5203 }
5204 }
5205 }
5206
5207
5208 static void GLAPIENTRY
5209 save_CompressedTexImage2DARB(GLenum target, GLint level,
5210 GLenum internalFormat, GLsizei width,
5211 GLsizei height, GLint border, GLsizei imageSize,
5212 const GLvoid * data)
5213 {
5214 GET_CURRENT_CONTEXT(ctx);
5215 if (target == GL_PROXY_TEXTURE_2D) {
5216 /* don't compile, execute immediately */
5217 CALL_CompressedTexImage2D(ctx->Exec, (target, level, internalFormat,
5218 width, height, border,
5219 imageSize, data));
5220 }
5221 else {
5222 Node *n;
5223 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5224
5225 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_2D,
5226 7 + POINTER_DWORDS);
5227 if (n) {
5228 n[1].e = target;
5229 n[2].i = level;
5230 n[3].e = internalFormat;
5231 n[4].i = (GLint) width;
5232 n[5].i = (GLint) height;
5233 n[6].i = border;
5234 n[7].i = imageSize;
5235 save_pointer(&n[8],
5236 copy_data(data, imageSize, "glCompressedTexImage2DARB"));
5237 }
5238 if (ctx->ExecuteFlag) {
5239 CALL_CompressedTexImage2D(ctx->Exec,
5240 (target, level, internalFormat, width,
5241 height, border, imageSize, data));
5242 }
5243 }
5244 }
5245
5246
5247 static void GLAPIENTRY
5248 save_CompressedTexImage3DARB(GLenum target, GLint level,
5249 GLenum internalFormat, GLsizei width,
5250 GLsizei height, GLsizei depth, GLint border,
5251 GLsizei imageSize, const GLvoid * data)
5252 {
5253 GET_CURRENT_CONTEXT(ctx);
5254 if (target == GL_PROXY_TEXTURE_3D) {
5255 /* don't compile, execute immediately */
5256 CALL_CompressedTexImage3D(ctx->Exec, (target, level, internalFormat,
5257 width, height, depth, border,
5258 imageSize, data));
5259 }
5260 else {
5261 Node *n;
5262 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5263
5264 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_3D,
5265 8 + POINTER_DWORDS);
5266 if (n) {
5267 n[1].e = target;
5268 n[2].i = level;
5269 n[3].e = internalFormat;
5270 n[4].i = (GLint) width;
5271 n[5].i = (GLint) height;
5272 n[6].i = (GLint) depth;
5273 n[7].i = border;
5274 n[8].i = imageSize;
5275 save_pointer(&n[9],
5276 copy_data(data, imageSize, "glCompressedTexImage3DARB"));
5277 }
5278 if (ctx->ExecuteFlag) {
5279 CALL_CompressedTexImage3D(ctx->Exec,
5280 (target, level, internalFormat, width,
5281 height, depth, border, imageSize,
5282 data));
5283 }
5284 }
5285 }
5286
5287
5288 static void GLAPIENTRY
5289 save_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset,
5290 GLsizei width, GLenum format,
5291 GLsizei imageSize, const GLvoid * data)
5292 {
5293 Node *n;
5294 GET_CURRENT_CONTEXT(ctx);
5295 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5296
5297 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D,
5298 6 + POINTER_DWORDS);
5299 if (n) {
5300 n[1].e = target;
5301 n[2].i = level;
5302 n[3].i = xoffset;
5303 n[4].i = (GLint) width;
5304 n[5].e = format;
5305 n[6].i = imageSize;
5306 save_pointer(&n[7],
5307 copy_data(data, imageSize, "glCompressedTexSubImage1DARB"));
5308 }
5309 if (ctx->ExecuteFlag) {
5310 CALL_CompressedTexSubImage1D(ctx->Exec, (target, level, xoffset,
5311 width, format, imageSize,
5312 data));
5313 }
5314 }
5315
5316
5317 static void GLAPIENTRY
5318 save_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset,
5319 GLint yoffset, GLsizei width, GLsizei height,
5320 GLenum format, GLsizei imageSize,
5321 const GLvoid * data)
5322 {
5323 Node *n;
5324 GET_CURRENT_CONTEXT(ctx);
5325 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5326
5327 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D,
5328 8 + POINTER_DWORDS);
5329 if (n) {
5330 n[1].e = target;
5331 n[2].i = level;
5332 n[3].i = xoffset;
5333 n[4].i = yoffset;
5334 n[5].i = (GLint) width;
5335 n[6].i = (GLint) height;
5336 n[7].e = format;
5337 n[8].i = imageSize;
5338 save_pointer(&n[9],
5339 copy_data(data, imageSize, "glCompressedTexSubImage2DARB"));
5340 }
5341 if (ctx->ExecuteFlag) {
5342 CALL_CompressedTexSubImage2D(ctx->Exec,
5343 (target, level, xoffset, yoffset, width,
5344 height, format, imageSize, data));
5345 }
5346 }
5347
5348
5349 static void GLAPIENTRY
5350 save_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset,
5351 GLint yoffset, GLint zoffset, GLsizei width,
5352 GLsizei height, GLsizei depth, GLenum format,
5353 GLsizei imageSize, const GLvoid * data)
5354 {
5355 Node *n;
5356 GET_CURRENT_CONTEXT(ctx);
5357 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5358
5359 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D,
5360 10 + POINTER_DWORDS);
5361 if (n) {
5362 n[1].e = target;
5363 n[2].i = level;
5364 n[3].i = xoffset;
5365 n[4].i = yoffset;
5366 n[5].i = zoffset;
5367 n[6].i = (GLint) width;
5368 n[7].i = (GLint) height;
5369 n[8].i = (GLint) depth;
5370 n[9].e = format;
5371 n[10].i = imageSize;
5372 save_pointer(&n[11],
5373 copy_data(data, imageSize, "glCompressedTexSubImage3DARB"));
5374 }
5375 if (ctx->ExecuteFlag) {
5376 CALL_CompressedTexSubImage3D(ctx->Exec,
5377 (target, level, xoffset, yoffset,
5378 zoffset, width, height, depth, format,
5379 imageSize, data));
5380 }
5381 }
5382
5383
5384 /* GL_ARB_multisample */
5385 static void GLAPIENTRY
5386 save_SampleCoverageARB(GLclampf value, GLboolean invert)
5387 {
5388 GET_CURRENT_CONTEXT(ctx);
5389 Node *n;
5390 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5391 n = alloc_instruction(ctx, OPCODE_SAMPLE_COVERAGE, 2);
5392 if (n) {
5393 n[1].f = value;
5394 n[2].b = invert;
5395 }
5396 if (ctx->ExecuteFlag) {
5397 CALL_SampleCoverage(ctx->Exec, (value, invert));
5398 }
5399 }
5400
5401
5402 /*
5403 * GL_ARB_vertex_program
5404 */
5405 static void GLAPIENTRY
5406 save_BindProgramARB(GLenum target, GLuint id)
5407 {
5408 GET_CURRENT_CONTEXT(ctx);
5409 Node *n;
5410 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5411 n = alloc_instruction(ctx, OPCODE_BIND_PROGRAM_ARB, 2);
5412 if (n) {
5413 n[1].e = target;
5414 n[2].ui = id;
5415 }
5416 if (ctx->ExecuteFlag) {
5417 CALL_BindProgramARB(ctx->Exec, (target, id));
5418 }
5419 }
5420
5421 static void GLAPIENTRY
5422 save_ProgramEnvParameter4fARB(GLenum target, GLuint index,
5423 GLfloat x, GLfloat y, GLfloat z, GLfloat w)
5424 {
5425 GET_CURRENT_CONTEXT(ctx);
5426 Node *n;
5427 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5428 n = alloc_instruction(ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6);
5429 if (n) {
5430 n[1].e = target;
5431 n[2].ui = index;
5432 n[3].f = x;
5433 n[4].f = y;
5434 n[5].f = z;
5435 n[6].f = w;
5436 }
5437 if (ctx->ExecuteFlag) {
5438 CALL_ProgramEnvParameter4fARB(ctx->Exec, (target, index, x, y, z, w));
5439 }
5440 }
5441
5442
5443 static void GLAPIENTRY
5444 save_ProgramEnvParameter4fvARB(GLenum target, GLuint index,
5445 const GLfloat *params)
5446 {
5447 save_ProgramEnvParameter4fARB(target, index, params[0], params[1],
5448 params[2], params[3]);
5449 }
5450
5451
5452 static void GLAPIENTRY
5453 save_ProgramEnvParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
5454 const GLfloat * params)
5455 {
5456 GET_CURRENT_CONTEXT(ctx);
5457 Node *n;
5458 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5459
5460 if (count > 0) {
5461 GLint i;
5462 const GLfloat * p = params;
5463
5464 for (i = 0 ; i < count ; i++) {
5465 n = alloc_instruction(ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6);
5466 if (n) {
5467 n[1].e = target;
5468 n[2].ui = index;
5469 n[3].f = p[0];
5470 n[4].f = p[1];
5471 n[5].f = p[2];
5472 n[6].f = p[3];
5473 p += 4;
5474 }
5475 }
5476 }
5477
5478 if (ctx->ExecuteFlag) {
5479 CALL_ProgramEnvParameters4fvEXT(ctx->Exec, (target, index, count, params));
5480 }
5481 }
5482
5483
5484 static void GLAPIENTRY
5485 save_ProgramEnvParameter4dARB(GLenum target, GLuint index,
5486 GLdouble x, GLdouble y, GLdouble z, GLdouble w)
5487 {
5488 save_ProgramEnvParameter4fARB(target, index,
5489 (GLfloat) x,
5490 (GLfloat) y, (GLfloat) z, (GLfloat) w);
5491 }
5492
5493
5494 static void GLAPIENTRY
5495 save_ProgramEnvParameter4dvARB(GLenum target, GLuint index,
5496 const GLdouble *params)
5497 {
5498 save_ProgramEnvParameter4fARB(target, index,
5499 (GLfloat) params[0],
5500 (GLfloat) params[1],
5501 (GLfloat) params[2], (GLfloat) params[3]);
5502 }
5503
5504
5505 static void GLAPIENTRY
5506 save_ProgramLocalParameter4fARB(GLenum target, GLuint index,
5507 GLfloat x, GLfloat y, GLfloat z, GLfloat w)
5508 {
5509 GET_CURRENT_CONTEXT(ctx);
5510 Node *n;
5511 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5512 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5513 if (n) {
5514 n[1].e = target;
5515 n[2].ui = index;
5516 n[3].f = x;
5517 n[4].f = y;
5518 n[5].f = z;
5519 n[6].f = w;
5520 }
5521 if (ctx->ExecuteFlag) {
5522 CALL_ProgramLocalParameter4fARB(ctx->Exec, (target, index, x, y, z, w));
5523 }
5524 }
5525
5526
5527 static void GLAPIENTRY
5528 save_ProgramLocalParameter4fvARB(GLenum target, GLuint index,
5529 const GLfloat *params)
5530 {
5531 GET_CURRENT_CONTEXT(ctx);
5532 Node *n;
5533 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5534 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5535 if (n) {
5536 n[1].e = target;
5537 n[2].ui = index;
5538 n[3].f = params[0];
5539 n[4].f = params[1];
5540 n[5].f = params[2];
5541 n[6].f = params[3];
5542 }
5543 if (ctx->ExecuteFlag) {
5544 CALL_ProgramLocalParameter4fvARB(ctx->Exec, (target, index, params));
5545 }
5546 }
5547
5548
5549 static void GLAPIENTRY
5550 save_ProgramLocalParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
5551 const GLfloat *params)
5552 {
5553 GET_CURRENT_CONTEXT(ctx);
5554 Node *n;
5555 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5556
5557 if (count > 0) {
5558 GLint i;
5559 const GLfloat * p = params;
5560
5561 for (i = 0 ; i < count ; i++) {
5562 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5563 if (n) {
5564 n[1].e = target;
5565 n[2].ui = index;
5566 n[3].f = p[0];
5567 n[4].f = p[1];
5568 n[5].f = p[2];
5569 n[6].f = p[3];
5570 p += 4;
5571 }
5572 }
5573 }
5574
5575 if (ctx->ExecuteFlag) {
5576 CALL_ProgramLocalParameters4fvEXT(ctx->Exec, (target, index, count, params));
5577 }
5578 }
5579
5580
5581 static void GLAPIENTRY
5582 save_ProgramLocalParameter4dARB(GLenum target, GLuint index,
5583 GLdouble x, GLdouble y,
5584 GLdouble z, GLdouble w)
5585 {
5586 GET_CURRENT_CONTEXT(ctx);
5587 Node *n;
5588 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5589 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5590 if (n) {
5591 n[1].e = target;
5592 n[2].ui = index;
5593 n[3].f = (GLfloat) x;
5594 n[4].f = (GLfloat) y;
5595 n[5].f = (GLfloat) z;
5596 n[6].f = (GLfloat) w;
5597 }
5598 if (ctx->ExecuteFlag) {
5599 CALL_ProgramLocalParameter4dARB(ctx->Exec, (target, index, x, y, z, w));
5600 }
5601 }
5602
5603
5604 static void GLAPIENTRY
5605 save_ProgramLocalParameter4dvARB(GLenum target, GLuint index,
5606 const GLdouble *params)
5607 {
5608 GET_CURRENT_CONTEXT(ctx);
5609 Node *n;
5610 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5611 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5612 if (n) {
5613 n[1].e = target;
5614 n[2].ui = index;
5615 n[3].f = (GLfloat) params[0];
5616 n[4].f = (GLfloat) params[1];
5617 n[5].f = (GLfloat) params[2];
5618 n[6].f = (GLfloat) params[3];
5619 }
5620 if (ctx->ExecuteFlag) {
5621 CALL_ProgramLocalParameter4dvARB(ctx->Exec, (target, index, params));
5622 }
5623 }
5624
5625
5626 /* GL_EXT_stencil_two_side */
5627 static void GLAPIENTRY
5628 save_ActiveStencilFaceEXT(GLenum face)
5629 {
5630 GET_CURRENT_CONTEXT(ctx);
5631 Node *n;
5632 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5633 n = alloc_instruction(ctx, OPCODE_ACTIVE_STENCIL_FACE_EXT, 1);
5634 if (n) {
5635 n[1].e = face;
5636 }
5637 if (ctx->ExecuteFlag) {
5638 CALL_ActiveStencilFaceEXT(ctx->Exec, (face));
5639 }
5640 }
5641
5642
5643 /* GL_EXT_depth_bounds_test */
5644 static void GLAPIENTRY
5645 save_DepthBoundsEXT(GLclampd zmin, GLclampd zmax)
5646 {
5647 GET_CURRENT_CONTEXT(ctx);
5648 Node *n;
5649 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5650 n = alloc_instruction(ctx, OPCODE_DEPTH_BOUNDS_EXT, 2);
5651 if (n) {
5652 n[1].f = (GLfloat) zmin;
5653 n[2].f = (GLfloat) zmax;
5654 }
5655 if (ctx->ExecuteFlag) {
5656 CALL_DepthBoundsEXT(ctx->Exec, (zmin, zmax));
5657 }
5658 }
5659
5660
5661
5662 static void GLAPIENTRY
5663 save_ProgramStringARB(GLenum target, GLenum format, GLsizei len,
5664 const GLvoid * string)
5665 {
5666 GET_CURRENT_CONTEXT(ctx);
5667 Node *n;
5668
5669 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5670
5671 n = alloc_instruction(ctx, OPCODE_PROGRAM_STRING_ARB, 3 + POINTER_DWORDS);
5672 if (n) {
5673 GLubyte *programCopy = malloc(len);
5674 if (!programCopy) {
5675 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramStringARB");
5676 return;
5677 }
5678 memcpy(programCopy, string, len);
5679 n[1].e = target;
5680 n[2].e = format;
5681 n[3].i = len;
5682 save_pointer(&n[4], programCopy);
5683 }
5684 if (ctx->ExecuteFlag) {
5685 CALL_ProgramStringARB(ctx->Exec, (target, format, len, string));
5686 }
5687 }
5688
5689
5690 static void GLAPIENTRY
5691 save_BeginQueryARB(GLenum target, GLuint id)
5692 {
5693 GET_CURRENT_CONTEXT(ctx);
5694 Node *n;
5695 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5696 n = alloc_instruction(ctx, OPCODE_BEGIN_QUERY_ARB, 2);
5697 if (n) {
5698 n[1].e = target;
5699 n[2].ui = id;
5700 }
5701 if (ctx->ExecuteFlag) {
5702 CALL_BeginQuery(ctx->Exec, (target, id));
5703 }
5704 }
5705
5706 static void GLAPIENTRY
5707 save_EndQueryARB(GLenum target)
5708 {
5709 GET_CURRENT_CONTEXT(ctx);
5710 Node *n;
5711 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5712 n = alloc_instruction(ctx, OPCODE_END_QUERY_ARB, 1);
5713 if (n) {
5714 n[1].e = target;
5715 }
5716 if (ctx->ExecuteFlag) {
5717 CALL_EndQuery(ctx->Exec, (target));
5718 }
5719 }
5720
5721 static void GLAPIENTRY
5722 save_QueryCounter(GLuint id, GLenum target)
5723 {
5724 GET_CURRENT_CONTEXT(ctx);
5725 Node *n;
5726 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5727 n = alloc_instruction(ctx, OPCODE_QUERY_COUNTER, 2);
5728 if (n) {
5729 n[1].ui = id;
5730 n[2].e = target;
5731 }
5732 if (ctx->ExecuteFlag) {
5733 CALL_QueryCounter(ctx->Exec, (id, target));
5734 }
5735 }
5736
5737 static void GLAPIENTRY
5738 save_BeginQueryIndexed(GLenum target, GLuint index, GLuint id)
5739 {
5740 GET_CURRENT_CONTEXT(ctx);
5741 Node *n;
5742 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5743 n = alloc_instruction(ctx, OPCODE_BEGIN_QUERY_INDEXED, 3);
5744 if (n) {
5745 n[1].e = target;
5746 n[2].ui = index;
5747 n[3].ui = id;
5748 }
5749 if (ctx->ExecuteFlag) {
5750 CALL_BeginQueryIndexed(ctx->Exec, (target, index, id));
5751 }
5752 }
5753
5754 static void GLAPIENTRY
5755 save_EndQueryIndexed(GLenum target, GLuint index)
5756 {
5757 GET_CURRENT_CONTEXT(ctx);
5758 Node *n;
5759 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5760 n = alloc_instruction(ctx, OPCODE_END_QUERY_INDEXED, 2);
5761 if (n) {
5762 n[1].e = target;
5763 n[2].ui = index;
5764 }
5765 if (ctx->ExecuteFlag) {
5766 CALL_EndQueryIndexed(ctx->Exec, (target, index));
5767 }
5768 }
5769
5770
5771 static void GLAPIENTRY
5772 save_DrawBuffersARB(GLsizei count, const GLenum * buffers)
5773 {
5774 GET_CURRENT_CONTEXT(ctx);
5775 Node *n;
5776 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5777 n = alloc_instruction(ctx, OPCODE_DRAW_BUFFERS_ARB, 1 + MAX_DRAW_BUFFERS);
5778 if (n) {
5779 GLint i;
5780 n[1].i = count;
5781 if (count > MAX_DRAW_BUFFERS)
5782 count = MAX_DRAW_BUFFERS;
5783 for (i = 0; i < count; i++) {
5784 n[2 + i].e = buffers[i];
5785 }
5786 }
5787 if (ctx->ExecuteFlag) {
5788 CALL_DrawBuffers(ctx->Exec, (count, buffers));
5789 }
5790 }
5791
5792 static void GLAPIENTRY
5793 save_BindFragmentShaderATI(GLuint id)
5794 {
5795 GET_CURRENT_CONTEXT(ctx);
5796 Node *n;
5797
5798 n = alloc_instruction(ctx, OPCODE_BIND_FRAGMENT_SHADER_ATI, 1);
5799 if (n) {
5800 n[1].ui = id;
5801 }
5802 if (ctx->ExecuteFlag) {
5803 CALL_BindFragmentShaderATI(ctx->Exec, (id));
5804 }
5805 }
5806
5807 static void GLAPIENTRY
5808 save_SetFragmentShaderConstantATI(GLuint dst, const GLfloat *value)
5809 {
5810 GET_CURRENT_CONTEXT(ctx);
5811 Node *n;
5812
5813 n = alloc_instruction(ctx, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI, 5);
5814 if (n) {
5815 n[1].ui = dst;
5816 n[2].f = value[0];
5817 n[3].f = value[1];
5818 n[4].f = value[2];
5819 n[5].f = value[3];
5820 }
5821 if (ctx->ExecuteFlag) {
5822 CALL_SetFragmentShaderConstantATI(ctx->Exec, (dst, value));
5823 }
5824 }
5825
5826 static void GLAPIENTRY
5827 save_Attr1fNV(GLenum attr, GLfloat x)
5828 {
5829 GET_CURRENT_CONTEXT(ctx);
5830 Node *n;
5831 SAVE_FLUSH_VERTICES(ctx);
5832 n = alloc_instruction(ctx, OPCODE_ATTR_1F_NV, 2);
5833 if (n) {
5834 n[1].e = attr;
5835 n[2].f = x;
5836 }
5837
5838 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5839 ctx->ListState.ActiveAttribSize[attr] = 1;
5840 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, 0, 0, 1);
5841
5842 if (ctx->ExecuteFlag) {
5843 CALL_VertexAttrib1fNV(ctx->Exec, (attr, x));
5844 }
5845 }
5846
5847 static void GLAPIENTRY
5848 save_Attr2fNV(GLenum attr, GLfloat x, GLfloat y)
5849 {
5850 GET_CURRENT_CONTEXT(ctx);
5851 Node *n;
5852 SAVE_FLUSH_VERTICES(ctx);
5853 n = alloc_instruction(ctx, OPCODE_ATTR_2F_NV, 3);
5854 if (n) {
5855 n[1].e = attr;
5856 n[2].f = x;
5857 n[3].f = y;
5858 }
5859
5860 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5861 ctx->ListState.ActiveAttribSize[attr] = 2;
5862 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, 0, 1);
5863
5864 if (ctx->ExecuteFlag) {
5865 CALL_VertexAttrib2fNV(ctx->Exec, (attr, x, y));
5866 }
5867 }
5868
5869 static void GLAPIENTRY
5870 save_Attr3fNV(GLenum attr, GLfloat x, GLfloat y, GLfloat z)
5871 {
5872 GET_CURRENT_CONTEXT(ctx);
5873 Node *n;
5874 SAVE_FLUSH_VERTICES(ctx);
5875 n = alloc_instruction(ctx, OPCODE_ATTR_3F_NV, 4);
5876 if (n) {
5877 n[1].e = attr;
5878 n[2].f = x;
5879 n[3].f = y;
5880 n[4].f = z;
5881 }
5882
5883 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5884 ctx->ListState.ActiveAttribSize[attr] = 3;
5885 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, 1);
5886
5887 if (ctx->ExecuteFlag) {
5888 CALL_VertexAttrib3fNV(ctx->Exec, (attr, x, y, z));
5889 }
5890 }
5891
5892 static void GLAPIENTRY
5893 save_Attr4fNV(GLenum attr, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
5894 {
5895 GET_CURRENT_CONTEXT(ctx);
5896 Node *n;
5897 SAVE_FLUSH_VERTICES(ctx);
5898 n = alloc_instruction(ctx, OPCODE_ATTR_4F_NV, 5);
5899 if (n) {
5900 n[1].e = attr;
5901 n[2].f = x;
5902 n[3].f = y;
5903 n[4].f = z;
5904 n[5].f = w;
5905 }
5906
5907 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5908 ctx->ListState.ActiveAttribSize[attr] = 4;
5909 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, w);
5910
5911 if (ctx->ExecuteFlag) {
5912 CALL_VertexAttrib4fNV(ctx->Exec, (attr, x, y, z, w));
5913 }
5914 }
5915
5916
5917 static void GLAPIENTRY
5918 save_Attr1fARB(GLenum attr, GLfloat x)
5919 {
5920 GET_CURRENT_CONTEXT(ctx);
5921 Node *n;
5922 SAVE_FLUSH_VERTICES(ctx);
5923 n = alloc_instruction(ctx, OPCODE_ATTR_1F_ARB, 2);
5924 if (n) {
5925 n[1].e = attr;
5926 n[2].f = x;
5927 }
5928
5929 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5930 ctx->ListState.ActiveAttribSize[attr] = 1;
5931 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, 0, 0, 1);
5932
5933 if (ctx->ExecuteFlag) {
5934 CALL_VertexAttrib1fARB(ctx->Exec, (attr, x));
5935 }
5936 }
5937
5938 static void GLAPIENTRY
5939 save_Attr2fARB(GLenum attr, GLfloat x, GLfloat y)
5940 {
5941 GET_CURRENT_CONTEXT(ctx);
5942 Node *n;
5943 SAVE_FLUSH_VERTICES(ctx);
5944 n = alloc_instruction(ctx, OPCODE_ATTR_2F_ARB, 3);
5945 if (n) {
5946 n[1].e = attr;
5947 n[2].f = x;
5948 n[3].f = y;
5949 }
5950
5951 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5952 ctx->ListState.ActiveAttribSize[attr] = 2;
5953 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, 0, 1);
5954
5955 if (ctx->ExecuteFlag) {
5956 CALL_VertexAttrib2fARB(ctx->Exec, (attr, x, y));
5957 }
5958 }
5959
5960 static void GLAPIENTRY
5961 save_Attr3fARB(GLenum attr, GLfloat x, GLfloat y, GLfloat z)
5962 {
5963 GET_CURRENT_CONTEXT(ctx);
5964 Node *n;
5965 SAVE_FLUSH_VERTICES(ctx);
5966 n = alloc_instruction(ctx, OPCODE_ATTR_3F_ARB, 4);
5967 if (n) {
5968 n[1].e = attr;
5969 n[2].f = x;
5970 n[3].f = y;
5971 n[4].f = z;
5972 }
5973
5974 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5975 ctx->ListState.ActiveAttribSize[attr] = 3;
5976 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, 1);
5977
5978 if (ctx->ExecuteFlag) {
5979 CALL_VertexAttrib3fARB(ctx->Exec, (attr, x, y, z));
5980 }
5981 }
5982
5983 static void GLAPIENTRY
5984 save_Attr4fARB(GLenum attr, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
5985 {
5986 GET_CURRENT_CONTEXT(ctx);
5987 Node *n;
5988 SAVE_FLUSH_VERTICES(ctx);
5989 n = alloc_instruction(ctx, OPCODE_ATTR_4F_ARB, 5);
5990 if (n) {
5991 n[1].e = attr;
5992 n[2].f = x;
5993 n[3].f = y;
5994 n[4].f = z;
5995 n[5].f = w;
5996 }
5997
5998 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5999 ctx->ListState.ActiveAttribSize[attr] = 4;
6000 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, w);
6001
6002 if (ctx->ExecuteFlag) {
6003 CALL_VertexAttrib4fARB(ctx->Exec, (attr, x, y, z, w));
6004 }
6005 }
6006
6007
6008 static void GLAPIENTRY
6009 save_EvalCoord1f(GLfloat x)
6010 {
6011 GET_CURRENT_CONTEXT(ctx);
6012 Node *n;
6013 SAVE_FLUSH_VERTICES(ctx);
6014 n = alloc_instruction(ctx, OPCODE_EVAL_C1, 1);
6015 if (n) {
6016 n[1].f = x;
6017 }
6018 if (ctx->ExecuteFlag) {
6019 CALL_EvalCoord1f(ctx->Exec, (x));
6020 }
6021 }
6022
6023 static void GLAPIENTRY
6024 save_EvalCoord1fv(const GLfloat * v)
6025 {
6026 save_EvalCoord1f(v[0]);
6027 }
6028
6029 static void GLAPIENTRY
6030 save_EvalCoord2f(GLfloat x, GLfloat y)
6031 {
6032 GET_CURRENT_CONTEXT(ctx);
6033 Node *n;
6034 SAVE_FLUSH_VERTICES(ctx);
6035 n = alloc_instruction(ctx, OPCODE_EVAL_C2, 2);
6036 if (n) {
6037 n[1].f = x;
6038 n[2].f = y;
6039 }
6040 if (ctx->ExecuteFlag) {
6041 CALL_EvalCoord2f(ctx->Exec, (x, y));
6042 }
6043 }
6044
6045 static void GLAPIENTRY
6046 save_EvalCoord2fv(const GLfloat * v)
6047 {
6048 save_EvalCoord2f(v[0], v[1]);
6049 }
6050
6051
6052 static void GLAPIENTRY
6053 save_EvalPoint1(GLint x)
6054 {
6055 GET_CURRENT_CONTEXT(ctx);
6056 Node *n;
6057 SAVE_FLUSH_VERTICES(ctx);
6058 n = alloc_instruction(ctx, OPCODE_EVAL_P1, 1);
6059 if (n) {
6060 n[1].i = x;
6061 }
6062 if (ctx->ExecuteFlag) {
6063 CALL_EvalPoint1(ctx->Exec, (x));
6064 }
6065 }
6066
6067 static void GLAPIENTRY
6068 save_EvalPoint2(GLint x, GLint y)
6069 {
6070 GET_CURRENT_CONTEXT(ctx);
6071 Node *n;
6072 SAVE_FLUSH_VERTICES(ctx);
6073 n = alloc_instruction(ctx, OPCODE_EVAL_P2, 2);
6074 if (n) {
6075 n[1].i = x;
6076 n[2].i = y;
6077 }
6078 if (ctx->ExecuteFlag) {
6079 CALL_EvalPoint2(ctx->Exec, (x, y));
6080 }
6081 }
6082
6083 static void GLAPIENTRY
6084 save_Indexf(GLfloat x)
6085 {
6086 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX, x);
6087 }
6088
6089 static void GLAPIENTRY
6090 save_Indexfv(const GLfloat * v)
6091 {
6092 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX, v[0]);
6093 }
6094
6095 static void GLAPIENTRY
6096 save_EdgeFlag(GLboolean x)
6097 {
6098 save_Attr1fNV(VERT_ATTRIB_EDGEFLAG, x ? 1.0f : 0.0f);
6099 }
6100
6101
6102 /**
6103 * Compare 'count' elements of vectors 'a' and 'b'.
6104 * \return GL_TRUE if equal, GL_FALSE if different.
6105 */
6106 static inline GLboolean
6107 compare_vec(const GLfloat *a, const GLfloat *b, GLuint count)
6108 {
6109 return memcmp( a, b, count * sizeof(GLfloat) ) == 0;
6110 }
6111
6112
6113 /**
6114 * This glMaterial function is used for glMaterial calls that are outside
6115 * a glBegin/End pair. For glMaterial inside glBegin/End, see the VBO code.
6116 */
6117 static void GLAPIENTRY
6118 save_Materialfv(GLenum face, GLenum pname, const GLfloat * param)
6119 {
6120 GET_CURRENT_CONTEXT(ctx);
6121 Node *n;
6122 int args, i;
6123 GLuint bitmask;
6124
6125 switch (face) {
6126 case GL_BACK:
6127 case GL_FRONT:
6128 case GL_FRONT_AND_BACK:
6129 break;
6130 default:
6131 _mesa_compile_error(ctx, GL_INVALID_ENUM, "glMaterial(face)");
6132 return;
6133 }
6134
6135 switch (pname) {
6136 case GL_EMISSION:
6137 case GL_AMBIENT:
6138 case GL_DIFFUSE:
6139 case GL_SPECULAR:
6140 case GL_AMBIENT_AND_DIFFUSE:
6141 args = 4;
6142 break;
6143 case GL_SHININESS:
6144 args = 1;
6145 break;
6146 case GL_COLOR_INDEXES:
6147 args = 3;
6148 break;
6149 default:
6150 _mesa_compile_error(ctx, GL_INVALID_ENUM, "glMaterial(pname)");
6151 return;
6152 }
6153
6154 if (ctx->ExecuteFlag) {
6155 CALL_Materialfv(ctx->Exec, (face, pname, param));
6156 }
6157
6158 bitmask = _mesa_material_bitmask(ctx, face, pname, ~0, NULL);
6159
6160 /* Try to eliminate redundant statechanges. Because it is legal to
6161 * call glMaterial even inside begin/end calls, don't need to worry
6162 * about ctx->Driver.CurrentSavePrimitive here.
6163 */
6164 for (i = 0; i < MAT_ATTRIB_MAX; i++) {
6165 if (bitmask & (1 << i)) {
6166 if (ctx->ListState.ActiveMaterialSize[i] == args &&
6167 compare_vec(ctx->ListState.CurrentMaterial[i], param, args)) {
6168 /* no change in material value */
6169 bitmask &= ~(1 << i);
6170 }
6171 else {
6172 ctx->ListState.ActiveMaterialSize[i] = args;
6173 COPY_SZ_4V(ctx->ListState.CurrentMaterial[i], args, param);
6174 }
6175 }
6176 }
6177
6178 /* If this call has no effect, return early */
6179 if (bitmask == 0)
6180 return;
6181
6182 SAVE_FLUSH_VERTICES(ctx);
6183
6184 n = alloc_instruction(ctx, OPCODE_MATERIAL, 6);
6185 if (n) {
6186 n[1].e = face;
6187 n[2].e = pname;
6188 for (i = 0; i < args; i++)
6189 n[3 + i].f = param[i];
6190 }
6191 }
6192
6193 static void GLAPIENTRY
6194 save_Begin(GLenum mode)
6195 {
6196 GET_CURRENT_CONTEXT(ctx);
6197
6198 if (!_mesa_is_valid_prim_mode(ctx, mode)) {
6199 /* compile this error into the display list */
6200 _mesa_compile_error(ctx, GL_INVALID_ENUM, "glBegin(mode)");
6201 }
6202 else if (_mesa_inside_dlist_begin_end(ctx)) {
6203 /* compile this error into the display list */
6204 _mesa_compile_error(ctx, GL_INVALID_OPERATION, "recursive glBegin");
6205 }
6206 else {
6207 ctx->Driver.CurrentSavePrimitive = mode;
6208
6209 vbo_save_NotifyBegin(ctx, mode, false);
6210 }
6211 }
6212
6213 static void GLAPIENTRY
6214 save_End(void)
6215 {
6216 GET_CURRENT_CONTEXT(ctx);
6217 SAVE_FLUSH_VERTICES(ctx);
6218 (void) alloc_instruction(ctx, OPCODE_END, 0);
6219 ctx->Driver.CurrentSavePrimitive = PRIM_OUTSIDE_BEGIN_END;
6220 if (ctx->ExecuteFlag) {
6221 CALL_End(ctx->Exec, ());
6222 }
6223 }
6224
6225 static void GLAPIENTRY
6226 save_Rectf(GLfloat a, GLfloat b, GLfloat c, GLfloat d)
6227 {
6228 GET_CURRENT_CONTEXT(ctx);
6229 Node *n;
6230 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6231 n = alloc_instruction(ctx, OPCODE_RECTF, 4);
6232 if (n) {
6233 n[1].f = a;
6234 n[2].f = b;
6235 n[3].f = c;
6236 n[4].f = d;
6237 }
6238 if (ctx->ExecuteFlag) {
6239 CALL_Rectf(ctx->Exec, (a, b, c, d));
6240 }
6241 }
6242
6243
6244 static void GLAPIENTRY
6245 save_Vertex2f(GLfloat x, GLfloat y)
6246 {
6247 save_Attr2fNV(VERT_ATTRIB_POS, x, y);
6248 }
6249
6250 static void GLAPIENTRY
6251 save_Vertex2fv(const GLfloat * v)
6252 {
6253 save_Attr2fNV(VERT_ATTRIB_POS, v[0], v[1]);
6254 }
6255
6256 static void GLAPIENTRY
6257 save_Vertex3f(GLfloat x, GLfloat y, GLfloat z)
6258 {
6259 save_Attr3fNV(VERT_ATTRIB_POS, x, y, z);
6260 }
6261
6262 static void GLAPIENTRY
6263 save_Vertex3fv(const GLfloat * v)
6264 {
6265 save_Attr3fNV(VERT_ATTRIB_POS, v[0], v[1], v[2]);
6266 }
6267
6268 static void GLAPIENTRY
6269 save_Vertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
6270 {
6271 save_Attr4fNV(VERT_ATTRIB_POS, x, y, z, w);
6272 }
6273
6274 static void GLAPIENTRY
6275 save_Vertex4fv(const GLfloat * v)
6276 {
6277 save_Attr4fNV(VERT_ATTRIB_POS, v[0], v[1], v[2], v[3]);
6278 }
6279
6280 static void GLAPIENTRY
6281 save_TexCoord1f(GLfloat x)
6282 {
6283 save_Attr1fNV(VERT_ATTRIB_TEX0, x);
6284 }
6285
6286 static void GLAPIENTRY
6287 save_TexCoord1fv(const GLfloat * v)
6288 {
6289 save_Attr1fNV(VERT_ATTRIB_TEX0, v[0]);
6290 }
6291
6292 static void GLAPIENTRY
6293 save_TexCoord2f(GLfloat x, GLfloat y)
6294 {
6295 save_Attr2fNV(VERT_ATTRIB_TEX0, x, y);
6296 }
6297
6298 static void GLAPIENTRY
6299 save_TexCoord2fv(const GLfloat * v)
6300 {
6301 save_Attr2fNV(VERT_ATTRIB_TEX0, v[0], v[1]);
6302 }
6303
6304 static void GLAPIENTRY
6305 save_TexCoord3f(GLfloat x, GLfloat y, GLfloat z)
6306 {
6307 save_Attr3fNV(VERT_ATTRIB_TEX0, x, y, z);
6308 }
6309
6310 static void GLAPIENTRY
6311 save_TexCoord3fv(const GLfloat * v)
6312 {
6313 save_Attr3fNV(VERT_ATTRIB_TEX0, v[0], v[1], v[2]);
6314 }
6315
6316 static void GLAPIENTRY
6317 save_TexCoord4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
6318 {
6319 save_Attr4fNV(VERT_ATTRIB_TEX0, x, y, z, w);
6320 }
6321
6322 static void GLAPIENTRY
6323 save_TexCoord4fv(const GLfloat * v)
6324 {
6325 save_Attr4fNV(VERT_ATTRIB_TEX0, v[0], v[1], v[2], v[3]);
6326 }
6327
6328 static void GLAPIENTRY
6329 save_Normal3f(GLfloat x, GLfloat y, GLfloat z)
6330 {
6331 save_Attr3fNV(VERT_ATTRIB_NORMAL, x, y, z);
6332 }
6333
6334 static void GLAPIENTRY
6335 save_Normal3fv(const GLfloat * v)
6336 {
6337 save_Attr3fNV(VERT_ATTRIB_NORMAL, v[0], v[1], v[2]);
6338 }
6339
6340 static void GLAPIENTRY
6341 save_FogCoordfEXT(GLfloat x)
6342 {
6343 save_Attr1fNV(VERT_ATTRIB_FOG, x);
6344 }
6345
6346 static void GLAPIENTRY
6347 save_FogCoordfvEXT(const GLfloat * v)
6348 {
6349 save_Attr1fNV(VERT_ATTRIB_FOG, v[0]);
6350 }
6351
6352 static void GLAPIENTRY
6353 save_Color3f(GLfloat x, GLfloat y, GLfloat z)
6354 {
6355 save_Attr3fNV(VERT_ATTRIB_COLOR0, x, y, z);
6356 }
6357
6358 static void GLAPIENTRY
6359 save_Color3fv(const GLfloat * v)
6360 {
6361 save_Attr3fNV(VERT_ATTRIB_COLOR0, v[0], v[1], v[2]);
6362 }
6363
6364 static void GLAPIENTRY
6365 save_Color4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
6366 {
6367 save_Attr4fNV(VERT_ATTRIB_COLOR0, x, y, z, w);
6368 }
6369
6370 static void GLAPIENTRY
6371 save_Color4fv(const GLfloat * v)
6372 {
6373 save_Attr4fNV(VERT_ATTRIB_COLOR0, v[0], v[1], v[2], v[3]);
6374 }
6375
6376 static void GLAPIENTRY
6377 save_SecondaryColor3fEXT(GLfloat x, GLfloat y, GLfloat z)
6378 {
6379 save_Attr3fNV(VERT_ATTRIB_COLOR1, x, y, z);
6380 }
6381
6382 static void GLAPIENTRY
6383 save_SecondaryColor3fvEXT(const GLfloat * v)
6384 {
6385 save_Attr3fNV(VERT_ATTRIB_COLOR1, v[0], v[1], v[2]);
6386 }
6387
6388
6389 /* Just call the respective ATTR for texcoord
6390 */
6391 static void GLAPIENTRY
6392 save_MultiTexCoord1f(GLenum target, GLfloat x)
6393 {
6394 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6395 save_Attr1fNV(attr, x);
6396 }
6397
6398 static void GLAPIENTRY
6399 save_MultiTexCoord1fv(GLenum target, const GLfloat * v)
6400 {
6401 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6402 save_Attr1fNV(attr, v[0]);
6403 }
6404
6405 static void GLAPIENTRY
6406 save_MultiTexCoord2f(GLenum target, GLfloat x, GLfloat y)
6407 {
6408 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6409 save_Attr2fNV(attr, x, y);
6410 }
6411
6412 static void GLAPIENTRY
6413 save_MultiTexCoord2fv(GLenum target, const GLfloat * v)
6414 {
6415 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6416 save_Attr2fNV(attr, v[0], v[1]);
6417 }
6418
6419 static void GLAPIENTRY
6420 save_MultiTexCoord3f(GLenum target, GLfloat x, GLfloat y, GLfloat z)
6421 {
6422 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6423 save_Attr3fNV(attr, x, y, z);
6424 }
6425
6426 static void GLAPIENTRY
6427 save_MultiTexCoord3fv(GLenum target, const GLfloat * v)
6428 {
6429 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6430 save_Attr3fNV(attr, v[0], v[1], v[2]);
6431 }
6432
6433 static void GLAPIENTRY
6434 save_MultiTexCoord4f(GLenum target, GLfloat x, GLfloat y,
6435 GLfloat z, GLfloat w)
6436 {
6437 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6438 save_Attr4fNV(attr, x, y, z, w);
6439 }
6440
6441 static void GLAPIENTRY
6442 save_MultiTexCoord4fv(GLenum target, const GLfloat * v)
6443 {
6444 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6445 save_Attr4fNV(attr, v[0], v[1], v[2], v[3]);
6446 }
6447
6448
6449 /**
6450 * Record a GL_INVALID_VALUE error when an invalid vertex attribute
6451 * index is found.
6452 */
6453 static void
6454 index_error(void)
6455 {
6456 GET_CURRENT_CONTEXT(ctx);
6457 _mesa_error(ctx, GL_INVALID_VALUE, "VertexAttribf(index)");
6458 }
6459
6460
6461
6462 static void GLAPIENTRY
6463 save_VertexAttrib1fARB(GLuint index, GLfloat x)
6464 {
6465 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6466 save_Attr1fARB(index, x);
6467 else
6468 index_error();
6469 }
6470
6471 static void GLAPIENTRY
6472 save_VertexAttrib1fvARB(GLuint index, const GLfloat * v)
6473 {
6474 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6475 save_Attr1fARB(index, v[0]);
6476 else
6477 index_error();
6478 }
6479
6480 static void GLAPIENTRY
6481 save_VertexAttrib2fARB(GLuint index, GLfloat x, GLfloat y)
6482 {
6483 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6484 save_Attr2fARB(index, x, y);
6485 else
6486 index_error();
6487 }
6488
6489 static void GLAPIENTRY
6490 save_VertexAttrib2fvARB(GLuint index, const GLfloat * v)
6491 {
6492 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6493 save_Attr2fARB(index, v[0], v[1]);
6494 else
6495 index_error();
6496 }
6497
6498 static void GLAPIENTRY
6499 save_VertexAttrib3fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z)
6500 {
6501 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6502 save_Attr3fARB(index, x, y, z);
6503 else
6504 index_error();
6505 }
6506
6507 static void GLAPIENTRY
6508 save_VertexAttrib3fvARB(GLuint index, const GLfloat * v)
6509 {
6510 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6511 save_Attr3fARB(index, v[0], v[1], v[2]);
6512 else
6513 index_error();
6514 }
6515
6516 static void GLAPIENTRY
6517 save_VertexAttrib4fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z,
6518 GLfloat w)
6519 {
6520 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6521 save_Attr4fARB(index, x, y, z, w);
6522 else
6523 index_error();
6524 }
6525
6526 static void GLAPIENTRY
6527 save_VertexAttrib4fvARB(GLuint index, const GLfloat * v)
6528 {
6529 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6530 save_Attr4fARB(index, v[0], v[1], v[2], v[3]);
6531 else
6532 index_error();
6533 }
6534
6535 static void GLAPIENTRY
6536 save_VertexAttribL1d(GLuint index, GLdouble x)
6537 {
6538 GET_CURRENT_CONTEXT(ctx);
6539
6540 if (index < MAX_VERTEX_GENERIC_ATTRIBS) {
6541 Node *n;
6542 SAVE_FLUSH_VERTICES(ctx);
6543 n = alloc_instruction(ctx, OPCODE_ATTR_1D, 3);
6544 if (n) {
6545 n[1].ui = index;
6546 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
6547 }
6548
6549 ctx->ListState.ActiveAttribSize[index] = 1;
6550 memcpy(ctx->ListState.CurrentAttrib[index], &n[2], sizeof(GLdouble));
6551
6552 if (ctx->ExecuteFlag) {
6553 CALL_VertexAttribL1d(ctx->Exec, (index, x));
6554 }
6555 } else {
6556 index_error();
6557 }
6558 }
6559
6560 static void GLAPIENTRY
6561 save_VertexAttribL1dv(GLuint index, const GLdouble *v)
6562 {
6563 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6564 save_VertexAttribL1d(index, v[0]);
6565 else
6566 index_error();
6567 }
6568
6569 static void GLAPIENTRY
6570 save_VertexAttribL2d(GLuint index, GLdouble x, GLdouble y)
6571 {
6572 GET_CURRENT_CONTEXT(ctx);
6573
6574 if (index < MAX_VERTEX_GENERIC_ATTRIBS) {
6575 Node *n;
6576 SAVE_FLUSH_VERTICES(ctx);
6577 n = alloc_instruction(ctx, OPCODE_ATTR_2D, 5);
6578 if (n) {
6579 n[1].ui = index;
6580 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
6581 ASSIGN_DOUBLE_TO_NODES(n, 4, y);
6582 }
6583
6584 ctx->ListState.ActiveAttribSize[index] = 2;
6585 memcpy(ctx->ListState.CurrentAttrib[index], &n[2],
6586 2 * sizeof(GLdouble));
6587
6588 if (ctx->ExecuteFlag) {
6589 CALL_VertexAttribL2d(ctx->Exec, (index, x, y));
6590 }
6591 } else {
6592 index_error();
6593 }
6594 }
6595
6596 static void GLAPIENTRY
6597 save_VertexAttribL2dv(GLuint index, const GLdouble *v)
6598 {
6599 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6600 save_VertexAttribL2d(index, v[0], v[1]);
6601 else
6602 index_error();
6603 }
6604
6605 static void GLAPIENTRY
6606 save_VertexAttribL3d(GLuint index, GLdouble x, GLdouble y, GLdouble z)
6607 {
6608 GET_CURRENT_CONTEXT(ctx);
6609
6610 if (index < MAX_VERTEX_GENERIC_ATTRIBS) {
6611 Node *n;
6612 SAVE_FLUSH_VERTICES(ctx);
6613 n = alloc_instruction(ctx, OPCODE_ATTR_3D, 7);
6614 if (n) {
6615 n[1].ui = index;
6616 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
6617 ASSIGN_DOUBLE_TO_NODES(n, 4, y);
6618 ASSIGN_DOUBLE_TO_NODES(n, 6, z);
6619 }
6620
6621 ctx->ListState.ActiveAttribSize[index] = 3;
6622 memcpy(ctx->ListState.CurrentAttrib[index], &n[2],
6623 3 * sizeof(GLdouble));
6624
6625 if (ctx->ExecuteFlag) {
6626 CALL_VertexAttribL3d(ctx->Exec, (index, x, y, z));
6627 }
6628 } else {
6629 index_error();
6630 }
6631 }
6632
6633 static void GLAPIENTRY
6634 save_VertexAttribL3dv(GLuint index, const GLdouble *v)
6635 {
6636 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6637 save_VertexAttribL3d(index, v[0], v[1], v[2]);
6638 else
6639 index_error();
6640 }
6641
6642 static void GLAPIENTRY
6643 save_VertexAttribL4d(GLuint index, GLdouble x, GLdouble y, GLdouble z,
6644 GLdouble w)
6645 {
6646 GET_CURRENT_CONTEXT(ctx);
6647
6648 if (index < MAX_VERTEX_GENERIC_ATTRIBS) {
6649 Node *n;
6650 SAVE_FLUSH_VERTICES(ctx);
6651 n = alloc_instruction(ctx, OPCODE_ATTR_4D, 9);
6652 if (n) {
6653 n[1].ui = index;
6654 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
6655 ASSIGN_DOUBLE_TO_NODES(n, 4, y);
6656 ASSIGN_DOUBLE_TO_NODES(n, 6, z);
6657 ASSIGN_DOUBLE_TO_NODES(n, 8, w);
6658 }
6659
6660 ctx->ListState.ActiveAttribSize[index] = 4;
6661 memcpy(ctx->ListState.CurrentAttrib[index], &n[2],
6662 4 * sizeof(GLdouble));
6663
6664 if (ctx->ExecuteFlag) {
6665 CALL_VertexAttribL4d(ctx->Exec, (index, x, y, z, w));
6666 }
6667 } else {
6668 index_error();
6669 }
6670 }
6671
6672 static void GLAPIENTRY
6673 save_VertexAttribL4dv(GLuint index, const GLdouble *v)
6674 {
6675 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6676 save_VertexAttribL4d(index, v[0], v[1], v[2], v[3]);
6677 else
6678 index_error();
6679 }
6680
6681 static void GLAPIENTRY
6682 save_PrimitiveRestartNV(void)
6683 {
6684 /* Note: this is used when outside a glBegin/End pair in a display list */
6685 GET_CURRENT_CONTEXT(ctx);
6686 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6687 (void) alloc_instruction(ctx, OPCODE_PRIMITIVE_RESTART_NV, 0);
6688 if (ctx->ExecuteFlag) {
6689 CALL_PrimitiveRestartNV(ctx->Exec, ());
6690 }
6691 }
6692
6693
6694 static void GLAPIENTRY
6695 save_BlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
6696 GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
6697 GLbitfield mask, GLenum filter)
6698 {
6699 GET_CURRENT_CONTEXT(ctx);
6700 Node *n;
6701 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6702 n = alloc_instruction(ctx, OPCODE_BLIT_FRAMEBUFFER, 10);
6703 if (n) {
6704 n[1].i = srcX0;
6705 n[2].i = srcY0;
6706 n[3].i = srcX1;
6707 n[4].i = srcY1;
6708 n[5].i = dstX0;
6709 n[6].i = dstY0;
6710 n[7].i = dstX1;
6711 n[8].i = dstY1;
6712 n[9].i = mask;
6713 n[10].e = filter;
6714 }
6715 if (ctx->ExecuteFlag) {
6716 CALL_BlitFramebuffer(ctx->Exec, (srcX0, srcY0, srcX1, srcY1,
6717 dstX0, dstY0, dstX1, dstY1,
6718 mask, filter));
6719 }
6720 }
6721
6722
6723 /** GL_EXT_provoking_vertex */
6724 static void GLAPIENTRY
6725 save_ProvokingVertexEXT(GLenum mode)
6726 {
6727 GET_CURRENT_CONTEXT(ctx);
6728 Node *n;
6729 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6730 n = alloc_instruction(ctx, OPCODE_PROVOKING_VERTEX, 1);
6731 if (n) {
6732 n[1].e = mode;
6733 }
6734 if (ctx->ExecuteFlag) {
6735 /*CALL_ProvokingVertex(ctx->Exec, (mode));*/
6736 _mesa_ProvokingVertex(mode);
6737 }
6738 }
6739
6740
6741 /** GL_EXT_transform_feedback */
6742 static void GLAPIENTRY
6743 save_BeginTransformFeedback(GLenum mode)
6744 {
6745 GET_CURRENT_CONTEXT(ctx);
6746 Node *n;
6747 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6748 n = alloc_instruction(ctx, OPCODE_BEGIN_TRANSFORM_FEEDBACK, 1);
6749 if (n) {
6750 n[1].e = mode;
6751 }
6752 if (ctx->ExecuteFlag) {
6753 CALL_BeginTransformFeedback(ctx->Exec, (mode));
6754 }
6755 }
6756
6757
6758 /** GL_EXT_transform_feedback */
6759 static void GLAPIENTRY
6760 save_EndTransformFeedback(void)
6761 {
6762 GET_CURRENT_CONTEXT(ctx);
6763 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6764 (void) alloc_instruction(ctx, OPCODE_END_TRANSFORM_FEEDBACK, 0);
6765 if (ctx->ExecuteFlag) {
6766 CALL_EndTransformFeedback(ctx->Exec, ());
6767 }
6768 }
6769
6770 static void GLAPIENTRY
6771 save_BindTransformFeedback(GLenum target, GLuint name)
6772 {
6773 GET_CURRENT_CONTEXT(ctx);
6774 Node *n;
6775 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6776 n = alloc_instruction(ctx, OPCODE_BIND_TRANSFORM_FEEDBACK, 2);
6777 if (n) {
6778 n[1].e = target;
6779 n[2].ui = name;
6780 }
6781 if (ctx->ExecuteFlag) {
6782 CALL_BindTransformFeedback(ctx->Exec, (target, name));
6783 }
6784 }
6785
6786 static void GLAPIENTRY
6787 save_PauseTransformFeedback(void)
6788 {
6789 GET_CURRENT_CONTEXT(ctx);
6790 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6791 (void) alloc_instruction(ctx, OPCODE_PAUSE_TRANSFORM_FEEDBACK, 0);
6792 if (ctx->ExecuteFlag) {
6793 CALL_PauseTransformFeedback(ctx->Exec, ());
6794 }
6795 }
6796
6797 static void GLAPIENTRY
6798 save_ResumeTransformFeedback(void)
6799 {
6800 GET_CURRENT_CONTEXT(ctx);
6801 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6802 (void) alloc_instruction(ctx, OPCODE_RESUME_TRANSFORM_FEEDBACK, 0);
6803 if (ctx->ExecuteFlag) {
6804 CALL_ResumeTransformFeedback(ctx->Exec, ());
6805 }
6806 }
6807
6808 static void GLAPIENTRY
6809 save_DrawTransformFeedback(GLenum mode, GLuint name)
6810 {
6811 GET_CURRENT_CONTEXT(ctx);
6812 Node *n;
6813 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6814 n = alloc_instruction(ctx, OPCODE_DRAW_TRANSFORM_FEEDBACK, 2);
6815 if (n) {
6816 n[1].e = mode;
6817 n[2].ui = name;
6818 }
6819 if (ctx->ExecuteFlag) {
6820 CALL_DrawTransformFeedback(ctx->Exec, (mode, name));
6821 }
6822 }
6823
6824 static void GLAPIENTRY
6825 save_DrawTransformFeedbackStream(GLenum mode, GLuint name, GLuint stream)
6826 {
6827 GET_CURRENT_CONTEXT(ctx);
6828 Node *n;
6829 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6830 n = alloc_instruction(ctx, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM, 3);
6831 if (n) {
6832 n[1].e = mode;
6833 n[2].ui = name;
6834 n[3].ui = stream;
6835 }
6836 if (ctx->ExecuteFlag) {
6837 CALL_DrawTransformFeedbackStream(ctx->Exec, (mode, name, stream));
6838 }
6839 }
6840
6841 static void GLAPIENTRY
6842 save_DrawTransformFeedbackInstanced(GLenum mode, GLuint name,
6843 GLsizei primcount)
6844 {
6845 GET_CURRENT_CONTEXT(ctx);
6846 Node *n;
6847 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6848 n = alloc_instruction(ctx, OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED, 3);
6849 if (n) {
6850 n[1].e = mode;
6851 n[2].ui = name;
6852 n[3].si = primcount;
6853 }
6854 if (ctx->ExecuteFlag) {
6855 CALL_DrawTransformFeedbackInstanced(ctx->Exec, (mode, name, primcount));
6856 }
6857 }
6858
6859 static void GLAPIENTRY
6860 save_DrawTransformFeedbackStreamInstanced(GLenum mode, GLuint name,
6861 GLuint stream, GLsizei primcount)
6862 {
6863 GET_CURRENT_CONTEXT(ctx);
6864 Node *n;
6865 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6866 n = alloc_instruction(ctx, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED, 4);
6867 if (n) {
6868 n[1].e = mode;
6869 n[2].ui = name;
6870 n[3].ui = stream;
6871 n[4].si = primcount;
6872 }
6873 if (ctx->ExecuteFlag) {
6874 CALL_DrawTransformFeedbackStreamInstanced(ctx->Exec, (mode, name, stream,
6875 primcount));
6876 }
6877 }
6878
6879 static void GLAPIENTRY
6880 save_DispatchCompute(GLuint num_groups_x, GLuint num_groups_y,
6881 GLuint num_groups_z)
6882 {
6883 GET_CURRENT_CONTEXT(ctx);
6884 Node *n;
6885 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6886 n = alloc_instruction(ctx, OPCODE_DISPATCH_COMPUTE, 3);
6887 if (n) {
6888 n[1].ui = num_groups_x;
6889 n[2].ui = num_groups_y;
6890 n[3].ui = num_groups_z;
6891 }
6892 if (ctx->ExecuteFlag) {
6893 CALL_DispatchCompute(ctx->Exec, (num_groups_x, num_groups_y,
6894 num_groups_z));
6895 }
6896 }
6897
6898 static void GLAPIENTRY
6899 save_DispatchComputeIndirect(GLintptr indirect)
6900 {
6901 GET_CURRENT_CONTEXT(ctx);
6902 _mesa_error(ctx, GL_INVALID_OPERATION,
6903 "glDispatchComputeIndirect() during display list compile");
6904 }
6905
6906 static void GLAPIENTRY
6907 save_UseProgram(GLuint program)
6908 {
6909 GET_CURRENT_CONTEXT(ctx);
6910 Node *n;
6911 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6912 n = alloc_instruction(ctx, OPCODE_USE_PROGRAM, 1);
6913 if (n) {
6914 n[1].ui = program;
6915 }
6916 if (ctx->ExecuteFlag) {
6917 CALL_UseProgram(ctx->Exec, (program));
6918 }
6919 }
6920
6921
6922 static void GLAPIENTRY
6923 save_Uniform1fARB(GLint location, GLfloat x)
6924 {
6925 GET_CURRENT_CONTEXT(ctx);
6926 Node *n;
6927 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6928 n = alloc_instruction(ctx, OPCODE_UNIFORM_1F, 2);
6929 if (n) {
6930 n[1].i = location;
6931 n[2].f = x;
6932 }
6933 if (ctx->ExecuteFlag) {
6934 CALL_Uniform1f(ctx->Exec, (location, x));
6935 }
6936 }
6937
6938
6939 static void GLAPIENTRY
6940 save_Uniform2fARB(GLint location, GLfloat x, GLfloat y)
6941 {
6942 GET_CURRENT_CONTEXT(ctx);
6943 Node *n;
6944 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6945 n = alloc_instruction(ctx, OPCODE_UNIFORM_2F, 3);
6946 if (n) {
6947 n[1].i = location;
6948 n[2].f = x;
6949 n[3].f = y;
6950 }
6951 if (ctx->ExecuteFlag) {
6952 CALL_Uniform2f(ctx->Exec, (location, x, y));
6953 }
6954 }
6955
6956
6957 static void GLAPIENTRY
6958 save_Uniform3fARB(GLint location, GLfloat x, GLfloat y, GLfloat z)
6959 {
6960 GET_CURRENT_CONTEXT(ctx);
6961 Node *n;
6962 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6963 n = alloc_instruction(ctx, OPCODE_UNIFORM_3F, 4);
6964 if (n) {
6965 n[1].i = location;
6966 n[2].f = x;
6967 n[3].f = y;
6968 n[4].f = z;
6969 }
6970 if (ctx->ExecuteFlag) {
6971 CALL_Uniform3f(ctx->Exec, (location, x, y, z));
6972 }
6973 }
6974
6975
6976 static void GLAPIENTRY
6977 save_Uniform4fARB(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
6978 {
6979 GET_CURRENT_CONTEXT(ctx);
6980 Node *n;
6981 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6982 n = alloc_instruction(ctx, OPCODE_UNIFORM_4F, 5);
6983 if (n) {
6984 n[1].i = location;
6985 n[2].f = x;
6986 n[3].f = y;
6987 n[4].f = z;
6988 n[5].f = w;
6989 }
6990 if (ctx->ExecuteFlag) {
6991 CALL_Uniform4f(ctx->Exec, (location, x, y, z, w));
6992 }
6993 }
6994
6995
6996 static void GLAPIENTRY
6997 save_Uniform1fvARB(GLint location, GLsizei count, const GLfloat *v)
6998 {
6999 GET_CURRENT_CONTEXT(ctx);
7000 Node *n;
7001 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7002 n = alloc_instruction(ctx, OPCODE_UNIFORM_1FV, 2 + POINTER_DWORDS);
7003 if (n) {
7004 n[1].i = location;
7005 n[2].i = count;
7006 save_pointer(&n[3], memdup(v, count * 1 * sizeof(GLfloat)));
7007 }
7008 if (ctx->ExecuteFlag) {
7009 CALL_Uniform1fv(ctx->Exec, (location, count, v));
7010 }
7011 }
7012
7013 static void GLAPIENTRY
7014 save_Uniform2fvARB(GLint location, GLsizei count, const GLfloat *v)
7015 {
7016 GET_CURRENT_CONTEXT(ctx);
7017 Node *n;
7018 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7019 n = alloc_instruction(ctx, OPCODE_UNIFORM_2FV, 2 + POINTER_DWORDS);
7020 if (n) {
7021 n[1].i = location;
7022 n[2].i = count;
7023 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLfloat)));
7024 }
7025 if (ctx->ExecuteFlag) {
7026 CALL_Uniform2fv(ctx->Exec, (location, count, v));
7027 }
7028 }
7029
7030 static void GLAPIENTRY
7031 save_Uniform3fvARB(GLint location, GLsizei count, const GLfloat *v)
7032 {
7033 GET_CURRENT_CONTEXT(ctx);
7034 Node *n;
7035 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7036 n = alloc_instruction(ctx, OPCODE_UNIFORM_3FV, 2 + POINTER_DWORDS);
7037 if (n) {
7038 n[1].i = location;
7039 n[2].i = count;
7040 save_pointer(&n[3], memdup(v, count * 3 * sizeof(GLfloat)));
7041 }
7042 if (ctx->ExecuteFlag) {
7043 CALL_Uniform3fv(ctx->Exec, (location, count, v));
7044 }
7045 }
7046
7047 static void GLAPIENTRY
7048 save_Uniform4fvARB(GLint location, GLsizei count, const GLfloat *v)
7049 {
7050 GET_CURRENT_CONTEXT(ctx);
7051 Node *n;
7052 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7053 n = alloc_instruction(ctx, OPCODE_UNIFORM_4FV, 2 + POINTER_DWORDS);
7054 if (n) {
7055 n[1].i = location;
7056 n[2].i = count;
7057 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLfloat)));
7058 }
7059 if (ctx->ExecuteFlag) {
7060 CALL_Uniform4fv(ctx->Exec, (location, count, v));
7061 }
7062 }
7063
7064
7065 static void GLAPIENTRY
7066 save_Uniform1d(GLint location, GLdouble x)
7067 {
7068 GET_CURRENT_CONTEXT(ctx);
7069 Node *n;
7070 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7071 n = alloc_instruction(ctx, OPCODE_UNIFORM_1D, 3);
7072 if (n) {
7073 n[1].i = location;
7074 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
7075 }
7076 if (ctx->ExecuteFlag) {
7077 CALL_Uniform1d(ctx->Exec, (location, x));
7078 }
7079 }
7080
7081
7082 static void GLAPIENTRY
7083 save_Uniform2d(GLint location, GLdouble x, GLdouble y)
7084 {
7085 GET_CURRENT_CONTEXT(ctx);
7086 Node *n;
7087 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7088 n = alloc_instruction(ctx, OPCODE_UNIFORM_2D, 5);
7089 if (n) {
7090 n[1].i = location;
7091 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
7092 ASSIGN_DOUBLE_TO_NODES(n, 4, y);
7093 }
7094 if (ctx->ExecuteFlag) {
7095 CALL_Uniform2d(ctx->Exec, (location, x, y));
7096 }
7097 }
7098
7099
7100 static void GLAPIENTRY
7101 save_Uniform3d(GLint location, GLdouble x, GLdouble y, GLdouble z)
7102 {
7103 GET_CURRENT_CONTEXT(ctx);
7104 Node *n;
7105 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7106 n = alloc_instruction(ctx, OPCODE_UNIFORM_3D, 7);
7107 if (n) {
7108 n[1].i = location;
7109 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
7110 ASSIGN_DOUBLE_TO_NODES(n, 4, y);
7111 ASSIGN_DOUBLE_TO_NODES(n, 6, z);
7112 }
7113 if (ctx->ExecuteFlag) {
7114 CALL_Uniform3d(ctx->Exec, (location, x, y, z));
7115 }
7116 }
7117
7118
7119 static void GLAPIENTRY
7120 save_Uniform4d(GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
7121 {
7122 GET_CURRENT_CONTEXT(ctx);
7123 Node *n;
7124 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7125 n = alloc_instruction(ctx, OPCODE_UNIFORM_4D, 9);
7126 if (n) {
7127 n[1].i = location;
7128 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
7129 ASSIGN_DOUBLE_TO_NODES(n, 4, y);
7130 ASSIGN_DOUBLE_TO_NODES(n, 6, z);
7131 ASSIGN_DOUBLE_TO_NODES(n, 8, w);
7132 }
7133 if (ctx->ExecuteFlag) {
7134 CALL_Uniform4d(ctx->Exec, (location, x, y, z, w));
7135 }
7136 }
7137
7138
7139 static void GLAPIENTRY
7140 save_Uniform1dv(GLint location, GLsizei count, const GLdouble *v)
7141 {
7142 GET_CURRENT_CONTEXT(ctx);
7143 Node *n;
7144 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7145 n = alloc_instruction(ctx, OPCODE_UNIFORM_1DV, 2 + POINTER_DWORDS);
7146 if (n) {
7147 n[1].i = location;
7148 n[2].i = count;
7149 save_pointer(&n[3], memdup(v, count * 1 * sizeof(GLdouble)));
7150 }
7151 if (ctx->ExecuteFlag) {
7152 CALL_Uniform1dv(ctx->Exec, (location, count, v));
7153 }
7154 }
7155
7156
7157 static void GLAPIENTRY
7158 save_Uniform2dv(GLint location, GLsizei count, const GLdouble *v)
7159 {
7160 GET_CURRENT_CONTEXT(ctx);
7161 Node *n;
7162 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7163 n = alloc_instruction(ctx, OPCODE_UNIFORM_2DV, 2 + POINTER_DWORDS);
7164 if (n) {
7165 n[1].i = location;
7166 n[2].i = count;
7167 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLdouble)));
7168 }
7169 if (ctx->ExecuteFlag) {
7170 CALL_Uniform2dv(ctx->Exec, (location, count, v));
7171 }
7172 }
7173
7174
7175 static void GLAPIENTRY
7176 save_Uniform3dv(GLint location, GLsizei count, const GLdouble *v)
7177 {
7178 GET_CURRENT_CONTEXT(ctx);
7179 Node *n;
7180 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7181 n = alloc_instruction(ctx, OPCODE_UNIFORM_3DV, 2 + POINTER_DWORDS);
7182 if (n) {
7183 n[1].i = location;
7184 n[2].i = count;
7185 save_pointer(&n[3], memdup(v, count * 3 * sizeof(GLdouble)));
7186 }
7187 if (ctx->ExecuteFlag) {
7188 CALL_Uniform3dv(ctx->Exec, (location, count, v));
7189 }
7190 }
7191
7192
7193 static void GLAPIENTRY
7194 save_Uniform4dv(GLint location, GLsizei count, const GLdouble *v)
7195 {
7196 GET_CURRENT_CONTEXT(ctx);
7197 Node *n;
7198 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7199 n = alloc_instruction(ctx, OPCODE_UNIFORM_4DV, 2 + POINTER_DWORDS);
7200 if (n) {
7201 n[1].i = location;
7202 n[2].i = count;
7203 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLdouble)));
7204 }
7205 if (ctx->ExecuteFlag) {
7206 CALL_Uniform4dv(ctx->Exec, (location, count, v));
7207 }
7208 }
7209
7210
7211 static void GLAPIENTRY
7212 save_Uniform1iARB(GLint location, GLint x)
7213 {
7214 GET_CURRENT_CONTEXT(ctx);
7215 Node *n;
7216 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7217 n = alloc_instruction(ctx, OPCODE_UNIFORM_1I, 2);
7218 if (n) {
7219 n[1].i = location;
7220 n[2].i = x;
7221 }
7222 if (ctx->ExecuteFlag) {
7223 CALL_Uniform1i(ctx->Exec, (location, x));
7224 }
7225 }
7226
7227 static void GLAPIENTRY
7228 save_Uniform2iARB(GLint location, GLint x, GLint y)
7229 {
7230 GET_CURRENT_CONTEXT(ctx);
7231 Node *n;
7232 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7233 n = alloc_instruction(ctx, OPCODE_UNIFORM_2I, 3);
7234 if (n) {
7235 n[1].i = location;
7236 n[2].i = x;
7237 n[3].i = y;
7238 }
7239 if (ctx->ExecuteFlag) {
7240 CALL_Uniform2i(ctx->Exec, (location, x, y));
7241 }
7242 }
7243
7244 static void GLAPIENTRY
7245 save_Uniform3iARB(GLint location, GLint x, GLint y, GLint z)
7246 {
7247 GET_CURRENT_CONTEXT(ctx);
7248 Node *n;
7249 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7250 n = alloc_instruction(ctx, OPCODE_UNIFORM_3I, 4);
7251 if (n) {
7252 n[1].i = location;
7253 n[2].i = x;
7254 n[3].i = y;
7255 n[4].i = z;
7256 }
7257 if (ctx->ExecuteFlag) {
7258 CALL_Uniform3i(ctx->Exec, (location, x, y, z));
7259 }
7260 }
7261
7262 static void GLAPIENTRY
7263 save_Uniform4iARB(GLint location, GLint x, GLint y, GLint z, GLint w)
7264 {
7265 GET_CURRENT_CONTEXT(ctx);
7266 Node *n;
7267 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7268 n = alloc_instruction(ctx, OPCODE_UNIFORM_4I, 5);
7269 if (n) {
7270 n[1].i = location;
7271 n[2].i = x;
7272 n[3].i = y;
7273 n[4].i = z;
7274 n[5].i = w;
7275 }
7276 if (ctx->ExecuteFlag) {
7277 CALL_Uniform4i(ctx->Exec, (location, x, y, z, w));
7278 }
7279 }
7280
7281
7282
7283 static void GLAPIENTRY
7284 save_Uniform1ivARB(GLint location, GLsizei count, const GLint *v)
7285 {
7286 GET_CURRENT_CONTEXT(ctx);
7287 Node *n;
7288 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7289 n = alloc_instruction(ctx, OPCODE_UNIFORM_1IV, 2 + POINTER_DWORDS);
7290 if (n) {
7291 n[1].i = location;
7292 n[2].i = count;
7293 save_pointer(&n[3], memdup(v, count * 1 * sizeof(GLint)));
7294 }
7295 if (ctx->ExecuteFlag) {
7296 CALL_Uniform1iv(ctx->Exec, (location, count, v));
7297 }
7298 }
7299
7300 static void GLAPIENTRY
7301 save_Uniform2ivARB(GLint location, GLsizei count, const GLint *v)
7302 {
7303 GET_CURRENT_CONTEXT(ctx);
7304 Node *n;
7305 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7306 n = alloc_instruction(ctx, OPCODE_UNIFORM_2IV, 2 + POINTER_DWORDS);
7307 if (n) {
7308 n[1].i = location;
7309 n[2].i = count;
7310 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLint)));
7311 }
7312 if (ctx->ExecuteFlag) {
7313 CALL_Uniform2iv(ctx->Exec, (location, count, v));
7314 }
7315 }
7316
7317 static void GLAPIENTRY
7318 save_Uniform3ivARB(GLint location, GLsizei count, const GLint *v)
7319 {
7320 GET_CURRENT_CONTEXT(ctx);
7321 Node *n;
7322 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7323 n = alloc_instruction(ctx, OPCODE_UNIFORM_3IV, 2 + POINTER_DWORDS);
7324 if (n) {
7325 n[1].i = location;
7326 n[2].i = count;
7327 save_pointer(&n[3], memdup(v, count * 3 * sizeof(GLint)));
7328 }
7329 if (ctx->ExecuteFlag) {
7330 CALL_Uniform3iv(ctx->Exec, (location, count, v));
7331 }
7332 }
7333
7334 static void GLAPIENTRY
7335 save_Uniform4ivARB(GLint location, GLsizei count, const GLint *v)
7336 {
7337 GET_CURRENT_CONTEXT(ctx);
7338 Node *n;
7339 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7340 n = alloc_instruction(ctx, OPCODE_UNIFORM_4IV, 2 + POINTER_DWORDS);
7341 if (n) {
7342 n[1].i = location;
7343 n[2].i = count;
7344 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLfloat)));
7345 }
7346 if (ctx->ExecuteFlag) {
7347 CALL_Uniform4iv(ctx->Exec, (location, count, v));
7348 }
7349 }
7350
7351
7352
7353 static void GLAPIENTRY
7354 save_Uniform1ui(GLint location, GLuint x)
7355 {
7356 GET_CURRENT_CONTEXT(ctx);
7357 Node *n;
7358 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7359 n = alloc_instruction(ctx, OPCODE_UNIFORM_1UI, 2);
7360 if (n) {
7361 n[1].i = location;
7362 n[2].i = x;
7363 }
7364 if (ctx->ExecuteFlag) {
7365 CALL_Uniform1ui(ctx->Exec, (location, x));
7366 }
7367 }
7368
7369 static void GLAPIENTRY
7370 save_Uniform2ui(GLint location, GLuint x, GLuint y)
7371 {
7372 GET_CURRENT_CONTEXT(ctx);
7373 Node *n;
7374 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7375 n = alloc_instruction(ctx, OPCODE_UNIFORM_2UI, 3);
7376 if (n) {
7377 n[1].i = location;
7378 n[2].i = x;
7379 n[3].i = y;
7380 }
7381 if (ctx->ExecuteFlag) {
7382 CALL_Uniform2ui(ctx->Exec, (location, x, y));
7383 }
7384 }
7385
7386 static void GLAPIENTRY
7387 save_Uniform3ui(GLint location, GLuint x, GLuint y, GLuint z)
7388 {
7389 GET_CURRENT_CONTEXT(ctx);
7390 Node *n;
7391 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7392 n = alloc_instruction(ctx, OPCODE_UNIFORM_3UI, 4);
7393 if (n) {
7394 n[1].i = location;
7395 n[2].i = x;
7396 n[3].i = y;
7397 n[4].i = z;
7398 }
7399 if (ctx->ExecuteFlag) {
7400 CALL_Uniform3ui(ctx->Exec, (location, x, y, z));
7401 }
7402 }
7403
7404 static void GLAPIENTRY
7405 save_Uniform4ui(GLint location, GLuint x, GLuint y, GLuint z, GLuint w)
7406 {
7407 GET_CURRENT_CONTEXT(ctx);
7408 Node *n;
7409 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7410 n = alloc_instruction(ctx, OPCODE_UNIFORM_4UI, 5);
7411 if (n) {
7412 n[1].i = location;
7413 n[2].i = x;
7414 n[3].i = y;
7415 n[4].i = z;
7416 n[5].i = w;
7417 }
7418 if (ctx->ExecuteFlag) {
7419 CALL_Uniform4ui(ctx->Exec, (location, x, y, z, w));
7420 }
7421 }
7422
7423
7424
7425 static void GLAPIENTRY
7426 save_Uniform1uiv(GLint location, GLsizei count, const GLuint *v)
7427 {
7428 GET_CURRENT_CONTEXT(ctx);
7429 Node *n;
7430 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7431 n = alloc_instruction(ctx, OPCODE_UNIFORM_1UIV, 2 + POINTER_DWORDS);
7432 if (n) {
7433 n[1].i = location;
7434 n[2].i = count;
7435 save_pointer(&n[3], memdup(v, count * 1 * sizeof(*v)));
7436 }
7437 if (ctx->ExecuteFlag) {
7438 CALL_Uniform1uiv(ctx->Exec, (location, count, v));
7439 }
7440 }
7441
7442 static void GLAPIENTRY
7443 save_Uniform2uiv(GLint location, GLsizei count, const GLuint *v)
7444 {
7445 GET_CURRENT_CONTEXT(ctx);
7446 Node *n;
7447 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7448 n = alloc_instruction(ctx, OPCODE_UNIFORM_2UIV, 2 + POINTER_DWORDS);
7449 if (n) {
7450 n[1].i = location;
7451 n[2].i = count;
7452 save_pointer(&n[3], memdup(v, count * 2 * sizeof(*v)));
7453 }
7454 if (ctx->ExecuteFlag) {
7455 CALL_Uniform2uiv(ctx->Exec, (location, count, v));
7456 }
7457 }
7458
7459 static void GLAPIENTRY
7460 save_Uniform3uiv(GLint location, GLsizei count, const GLuint *v)
7461 {
7462 GET_CURRENT_CONTEXT(ctx);
7463 Node *n;
7464 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7465 n = alloc_instruction(ctx, OPCODE_UNIFORM_3UIV, 2 + POINTER_DWORDS);
7466 if (n) {
7467 n[1].i = location;
7468 n[2].i = count;
7469 save_pointer(&n[3], memdup(v, count * 3 * sizeof(*v)));
7470 }
7471 if (ctx->ExecuteFlag) {
7472 CALL_Uniform3uiv(ctx->Exec, (location, count, v));
7473 }
7474 }
7475
7476 static void GLAPIENTRY
7477 save_Uniform4uiv(GLint location, GLsizei count, const GLuint *v)
7478 {
7479 GET_CURRENT_CONTEXT(ctx);
7480 Node *n;
7481 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7482 n = alloc_instruction(ctx, OPCODE_UNIFORM_4UIV, 2 + POINTER_DWORDS);
7483 if (n) {
7484 n[1].i = location;
7485 n[2].i = count;
7486 save_pointer(&n[3], memdup(v, count * 4 * sizeof(*v)));
7487 }
7488 if (ctx->ExecuteFlag) {
7489 CALL_Uniform4uiv(ctx->Exec, (location, count, v));
7490 }
7491 }
7492
7493
7494
7495 static void GLAPIENTRY
7496 save_UniformMatrix2fvARB(GLint location, GLsizei count, GLboolean transpose,
7497 const GLfloat *m)
7498 {
7499 GET_CURRENT_CONTEXT(ctx);
7500 Node *n;
7501 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7502 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX22, 3 + POINTER_DWORDS);
7503 if (n) {
7504 n[1].i = location;
7505 n[2].i = count;
7506 n[3].b = transpose;
7507 save_pointer(&n[4], memdup(m, count * 2 * 2 * sizeof(GLfloat)));
7508 }
7509 if (ctx->ExecuteFlag) {
7510 CALL_UniformMatrix2fv(ctx->Exec, (location, count, transpose, m));
7511 }
7512 }
7513
7514 static void GLAPIENTRY
7515 save_UniformMatrix3fvARB(GLint location, GLsizei count, GLboolean transpose,
7516 const GLfloat *m)
7517 {
7518 GET_CURRENT_CONTEXT(ctx);
7519 Node *n;
7520 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7521 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX33, 3 + POINTER_DWORDS);
7522 if (n) {
7523 n[1].i = location;
7524 n[2].i = count;
7525 n[3].b = transpose;
7526 save_pointer(&n[4], memdup(m, count * 3 * 3 * sizeof(GLfloat)));
7527 }
7528 if (ctx->ExecuteFlag) {
7529 CALL_UniformMatrix3fv(ctx->Exec, (location, count, transpose, m));
7530 }
7531 }
7532
7533 static void GLAPIENTRY
7534 save_UniformMatrix4fvARB(GLint location, GLsizei count, GLboolean transpose,
7535 const GLfloat *m)
7536 {
7537 GET_CURRENT_CONTEXT(ctx);
7538 Node *n;
7539 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7540 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX44, 3 + POINTER_DWORDS);
7541 if (n) {
7542 n[1].i = location;
7543 n[2].i = count;
7544 n[3].b = transpose;
7545 save_pointer(&n[4], memdup(m, count * 4 * 4 * sizeof(GLfloat)));
7546 }
7547 if (ctx->ExecuteFlag) {
7548 CALL_UniformMatrix4fv(ctx->Exec, (location, count, transpose, m));
7549 }
7550 }
7551
7552
7553 static void GLAPIENTRY
7554 save_UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose,
7555 const GLfloat *m)
7556 {
7557 GET_CURRENT_CONTEXT(ctx);
7558 Node *n;
7559 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7560 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX23, 3 + POINTER_DWORDS);
7561 if (n) {
7562 n[1].i = location;
7563 n[2].i = count;
7564 n[3].b = transpose;
7565 save_pointer(&n[4], memdup(m, count * 2 * 3 * sizeof(GLfloat)));
7566 }
7567 if (ctx->ExecuteFlag) {
7568 CALL_UniformMatrix2x3fv(ctx->Exec, (location, count, transpose, m));
7569 }
7570 }
7571
7572 static void GLAPIENTRY
7573 save_UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose,
7574 const GLfloat *m)
7575 {
7576 GET_CURRENT_CONTEXT(ctx);
7577 Node *n;
7578 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7579 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX32, 3 + POINTER_DWORDS);
7580 if (n) {
7581 n[1].i = location;
7582 n[2].i = count;
7583 n[3].b = transpose;
7584 save_pointer(&n[4], memdup(m, count * 3 * 2 * sizeof(GLfloat)));
7585 }
7586 if (ctx->ExecuteFlag) {
7587 CALL_UniformMatrix3x2fv(ctx->Exec, (location, count, transpose, m));
7588 }
7589 }
7590
7591
7592 static void GLAPIENTRY
7593 save_UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose,
7594 const GLfloat *m)
7595 {
7596 GET_CURRENT_CONTEXT(ctx);
7597 Node *n;
7598 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7599 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX24, 3 + POINTER_DWORDS);
7600 if (n) {
7601 n[1].i = location;
7602 n[2].i = count;
7603 n[3].b = transpose;
7604 save_pointer(&n[4], memdup(m, count * 2 * 4 * sizeof(GLfloat)));
7605 }
7606 if (ctx->ExecuteFlag) {
7607 CALL_UniformMatrix2x4fv(ctx->Exec, (location, count, transpose, m));
7608 }
7609 }
7610
7611 static void GLAPIENTRY
7612 save_UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose,
7613 const GLfloat *m)
7614 {
7615 GET_CURRENT_CONTEXT(ctx);
7616 Node *n;
7617 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7618 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX42, 3 + POINTER_DWORDS);
7619 if (n) {
7620 n[1].i = location;
7621 n[2].i = count;
7622 n[3].b = transpose;
7623 save_pointer(&n[4], memdup(m, count * 4 * 2 * sizeof(GLfloat)));
7624 }
7625 if (ctx->ExecuteFlag) {
7626 CALL_UniformMatrix4x2fv(ctx->Exec, (location, count, transpose, m));
7627 }
7628 }
7629
7630
7631 static void GLAPIENTRY
7632 save_UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose,
7633 const GLfloat *m)
7634 {
7635 GET_CURRENT_CONTEXT(ctx);
7636 Node *n;
7637 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7638 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX34, 3 + POINTER_DWORDS);
7639 if (n) {
7640 n[1].i = location;
7641 n[2].i = count;
7642 n[3].b = transpose;
7643 save_pointer(&n[4], memdup(m, count * 3 * 4 * sizeof(GLfloat)));
7644 }
7645 if (ctx->ExecuteFlag) {
7646 CALL_UniformMatrix3x4fv(ctx->Exec, (location, count, transpose, m));
7647 }
7648 }
7649
7650 static void GLAPIENTRY
7651 save_UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose,
7652 const GLfloat *m)
7653 {
7654 GET_CURRENT_CONTEXT(ctx);
7655 Node *n;
7656 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7657 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX43, 3 + POINTER_DWORDS);
7658 if (n) {
7659 n[1].i = location;
7660 n[2].i = count;
7661 n[3].b = transpose;
7662 save_pointer(&n[4], memdup(m, count * 4 * 3 * sizeof(GLfloat)));
7663 }
7664 if (ctx->ExecuteFlag) {
7665 CALL_UniformMatrix4x3fv(ctx->Exec, (location, count, transpose, m));
7666 }
7667 }
7668
7669
7670 static void GLAPIENTRY
7671 save_UniformMatrix2dv(GLint location, GLsizei count, GLboolean transpose,
7672 const GLdouble *m)
7673 {
7674 GET_CURRENT_CONTEXT(ctx);
7675 Node *n;
7676 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7677 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX22D, 3 + POINTER_DWORDS);
7678 if (n) {
7679 n[1].i = location;
7680 n[2].i = count;
7681 n[3].b = transpose;
7682 save_pointer(&n[4], memdup(m, count * 2 * 2 * sizeof(GLdouble)));
7683 }
7684 if (ctx->ExecuteFlag) {
7685 CALL_UniformMatrix2dv(ctx->Exec, (location, count, transpose, m));
7686 }
7687 }
7688
7689 static void GLAPIENTRY
7690 save_UniformMatrix3dv(GLint location, GLsizei count, GLboolean transpose,
7691 const GLdouble *m)
7692 {
7693 GET_CURRENT_CONTEXT(ctx);
7694 Node *n;
7695 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7696 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX33D, 3 + POINTER_DWORDS);
7697 if (n) {
7698 n[1].i = location;
7699 n[2].i = count;
7700 n[3].b = transpose;
7701 save_pointer(&n[4], memdup(m, count * 3 * 3 * sizeof(GLdouble)));
7702 }
7703 if (ctx->ExecuteFlag) {
7704 CALL_UniformMatrix3dv(ctx->Exec, (location, count, transpose, m));
7705 }
7706 }
7707
7708 static void GLAPIENTRY
7709 save_UniformMatrix4dv(GLint location, GLsizei count, GLboolean transpose,
7710 const GLdouble *m)
7711 {
7712 GET_CURRENT_CONTEXT(ctx);
7713 Node *n;
7714 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7715 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX44D, 3 + POINTER_DWORDS);
7716 if (n) {
7717 n[1].i = location;
7718 n[2].i = count;
7719 n[3].b = transpose;
7720 save_pointer(&n[4], memdup(m, count * 4 * 4 * sizeof(GLdouble)));
7721 }
7722 if (ctx->ExecuteFlag) {
7723 CALL_UniformMatrix4dv(ctx->Exec, (location, count, transpose, m));
7724 }
7725 }
7726
7727
7728 static void GLAPIENTRY
7729 save_UniformMatrix2x3dv(GLint location, GLsizei count, GLboolean transpose,
7730 const GLdouble *m)
7731 {
7732 GET_CURRENT_CONTEXT(ctx);
7733 Node *n;
7734 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7735 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX23D, 3 + POINTER_DWORDS);
7736 if (n) {
7737 n[1].i = location;
7738 n[2].i = count;
7739 n[3].b = transpose;
7740 save_pointer(&n[4], memdup(m, count * 2 * 3 * sizeof(GLdouble)));
7741 }
7742 if (ctx->ExecuteFlag) {
7743 CALL_UniformMatrix2x3dv(ctx->Exec, (location, count, transpose, m));
7744 }
7745 }
7746
7747
7748 static void GLAPIENTRY
7749 save_UniformMatrix3x2dv(GLint location, GLsizei count, GLboolean transpose,
7750 const GLdouble *m)
7751 {
7752 GET_CURRENT_CONTEXT(ctx);
7753 Node *n;
7754 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7755 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX32D, 3 + POINTER_DWORDS);
7756 if (n) {
7757 n[1].i = location;
7758 n[2].i = count;
7759 n[3].b = transpose;
7760 save_pointer(&n[4], memdup(m, count * 3 * 2 * sizeof(GLdouble)));
7761 }
7762 if (ctx->ExecuteFlag) {
7763 CALL_UniformMatrix3x2dv(ctx->Exec, (location, count, transpose, m));
7764 }
7765 }
7766
7767
7768 static void GLAPIENTRY
7769 save_UniformMatrix2x4dv(GLint location, GLsizei count, GLboolean transpose,
7770 const GLdouble *m)
7771 {
7772 GET_CURRENT_CONTEXT(ctx);
7773 Node *n;
7774 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7775 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX24D, 3 + POINTER_DWORDS);
7776 if (n) {
7777 n[1].i = location;
7778 n[2].i = count;
7779 n[3].b = transpose;
7780 save_pointer(&n[4], memdup(m, count * 2 * 4 * sizeof(GLdouble)));
7781 }
7782 if (ctx->ExecuteFlag) {
7783 CALL_UniformMatrix2x4dv(ctx->Exec, (location, count, transpose, m));
7784 }
7785 }
7786
7787 static void GLAPIENTRY
7788 save_UniformMatrix4x2dv(GLint location, GLsizei count, GLboolean transpose,
7789 const GLdouble *m)
7790 {
7791 GET_CURRENT_CONTEXT(ctx);
7792 Node *n;
7793 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7794 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX42D, 3 + POINTER_DWORDS);
7795 if (n) {
7796 n[1].i = location;
7797 n[2].i = count;
7798 n[3].b = transpose;
7799 save_pointer(&n[4], memdup(m, count * 4 * 2 * sizeof(GLdouble)));
7800 }
7801 if (ctx->ExecuteFlag) {
7802 CALL_UniformMatrix4x2dv(ctx->Exec, (location, count, transpose, m));
7803 }
7804 }
7805
7806
7807 static void GLAPIENTRY
7808 save_UniformMatrix3x4dv(GLint location, GLsizei count, GLboolean transpose,
7809 const GLdouble *m)
7810 {
7811 GET_CURRENT_CONTEXT(ctx);
7812 Node *n;
7813 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7814 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX34D, 3 + POINTER_DWORDS);
7815 if (n) {
7816 n[1].i = location;
7817 n[2].i = count;
7818 n[3].b = transpose;
7819 save_pointer(&n[4], memdup(m, count * 3 * 4 * sizeof(GLdouble)));
7820 }
7821 if (ctx->ExecuteFlag) {
7822 CALL_UniformMatrix3x4dv(ctx->Exec, (location, count, transpose, m));
7823 }
7824 }
7825
7826
7827 static void GLAPIENTRY
7828 save_UniformMatrix4x3dv(GLint location, GLsizei count, GLboolean transpose,
7829 const GLdouble *m)
7830 {
7831 GET_CURRENT_CONTEXT(ctx);
7832 Node *n;
7833 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7834 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX43D, 3 + POINTER_DWORDS);
7835 if (n) {
7836 n[1].i = location;
7837 n[2].i = count;
7838 n[3].b = transpose;
7839 save_pointer(&n[4], memdup(m, count * 4 * 3 * sizeof(GLdouble)));
7840 }
7841 if (ctx->ExecuteFlag) {
7842 CALL_UniformMatrix4x3dv(ctx->Exec, (location, count, transpose, m));
7843 }
7844 }
7845
7846
7847 static void GLAPIENTRY
7848 save_UseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program)
7849 {
7850 GET_CURRENT_CONTEXT(ctx);
7851 Node *n;
7852 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7853 n = alloc_instruction(ctx, OPCODE_USE_PROGRAM_STAGES, 3);
7854 if (n) {
7855 n[1].ui = pipeline;
7856 n[2].ui = stages;
7857 n[3].ui = program;
7858 }
7859 if (ctx->ExecuteFlag) {
7860 CALL_UseProgramStages(ctx->Exec, (pipeline, stages, program));
7861 }
7862 }
7863
7864 static void GLAPIENTRY
7865 save_ProgramUniform1f(GLuint program, GLint location, GLfloat x)
7866 {
7867 GET_CURRENT_CONTEXT(ctx);
7868 Node *n;
7869 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7870 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1F, 3);
7871 if (n) {
7872 n[1].ui = program;
7873 n[2].i = location;
7874 n[3].f = x;
7875 }
7876 if (ctx->ExecuteFlag) {
7877 CALL_ProgramUniform1f(ctx->Exec, (program, location, x));
7878 }
7879 }
7880
7881 static void GLAPIENTRY
7882 save_ProgramUniform2f(GLuint program, GLint location, GLfloat x, GLfloat y)
7883 {
7884 GET_CURRENT_CONTEXT(ctx);
7885 Node *n;
7886 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7887 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2F, 4);
7888 if (n) {
7889 n[1].ui = program;
7890 n[2].i = location;
7891 n[3].f = x;
7892 n[4].f = y;
7893 }
7894 if (ctx->ExecuteFlag) {
7895 CALL_ProgramUniform2f(ctx->Exec, (program, location, x, y));
7896 }
7897 }
7898
7899 static void GLAPIENTRY
7900 save_ProgramUniform3f(GLuint program, GLint location,
7901 GLfloat x, GLfloat y, GLfloat z)
7902 {
7903 GET_CURRENT_CONTEXT(ctx);
7904 Node *n;
7905 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7906 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3F, 5);
7907 if (n) {
7908 n[1].ui = program;
7909 n[2].i = location;
7910 n[3].f = x;
7911 n[4].f = y;
7912 n[5].f = z;
7913 }
7914 if (ctx->ExecuteFlag) {
7915 CALL_ProgramUniform3f(ctx->Exec, (program, location, x, y, z));
7916 }
7917 }
7918
7919 static void GLAPIENTRY
7920 save_ProgramUniform4f(GLuint program, GLint location,
7921 GLfloat x, GLfloat y, GLfloat z, GLfloat w)
7922 {
7923 GET_CURRENT_CONTEXT(ctx);
7924 Node *n;
7925 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7926 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4F, 6);
7927 if (n) {
7928 n[1].ui = program;
7929 n[2].i = location;
7930 n[3].f = x;
7931 n[4].f = y;
7932 n[5].f = z;
7933 n[6].f = w;
7934 }
7935 if (ctx->ExecuteFlag) {
7936 CALL_ProgramUniform4f(ctx->Exec, (program, location, x, y, z, w));
7937 }
7938 }
7939
7940 static void GLAPIENTRY
7941 save_ProgramUniform1fv(GLuint program, GLint location, GLsizei count,
7942 const GLfloat *v)
7943 {
7944 GET_CURRENT_CONTEXT(ctx);
7945 Node *n;
7946 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7947 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1FV, 3 + POINTER_DWORDS);
7948 if (n) {
7949 n[1].ui = program;
7950 n[2].i = location;
7951 n[3].i = count;
7952 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLfloat)));
7953 }
7954 if (ctx->ExecuteFlag) {
7955 CALL_ProgramUniform1fv(ctx->Exec, (program, location, count, v));
7956 }
7957 }
7958
7959 static void GLAPIENTRY
7960 save_ProgramUniform2fv(GLuint program, GLint location, GLsizei count,
7961 const GLfloat *v)
7962 {
7963 GET_CURRENT_CONTEXT(ctx);
7964 Node *n;
7965 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7966 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2FV, 3 + POINTER_DWORDS);
7967 if (n) {
7968 n[1].ui = program;
7969 n[2].i = location;
7970 n[3].i = count;
7971 save_pointer(&n[4], memdup(v, count * 2 * sizeof(GLfloat)));
7972 }
7973 if (ctx->ExecuteFlag) {
7974 CALL_ProgramUniform2fv(ctx->Exec, (program, location, count, v));
7975 }
7976 }
7977
7978 static void GLAPIENTRY
7979 save_ProgramUniform3fv(GLuint program, GLint location, GLsizei count,
7980 const GLfloat *v)
7981 {
7982 GET_CURRENT_CONTEXT(ctx);
7983 Node *n;
7984 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7985 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3FV, 3 + POINTER_DWORDS);
7986 if (n) {
7987 n[1].ui = program;
7988 n[2].i = location;
7989 n[3].i = count;
7990 save_pointer(&n[4], memdup(v, count * 3 * sizeof(GLfloat)));
7991 }
7992 if (ctx->ExecuteFlag) {
7993 CALL_ProgramUniform3fv(ctx->Exec, (program, location, count, v));
7994 }
7995 }
7996
7997 static void GLAPIENTRY
7998 save_ProgramUniform4fv(GLuint program, GLint location, GLsizei count,
7999 const GLfloat *v)
8000 {
8001 GET_CURRENT_CONTEXT(ctx);
8002 Node *n;
8003 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8004 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4FV, 3 + POINTER_DWORDS);
8005 if (n) {
8006 n[1].ui = program;
8007 n[2].i = location;
8008 n[3].i = count;
8009 save_pointer(&n[4], memdup(v, count * 4 * sizeof(GLfloat)));
8010 }
8011 if (ctx->ExecuteFlag) {
8012 CALL_ProgramUniform4fv(ctx->Exec, (program, location, count, v));
8013 }
8014 }
8015
8016 static void GLAPIENTRY
8017 save_ProgramUniform1d(GLuint program, GLint location, GLdouble x)
8018 {
8019 GET_CURRENT_CONTEXT(ctx);
8020 Node *n;
8021 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8022 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1D, 4);
8023 if (n) {
8024 n[1].ui = program;
8025 n[2].i = location;
8026 ASSIGN_DOUBLE_TO_NODES(n, 3, x);
8027 }
8028 if (ctx->ExecuteFlag) {
8029 CALL_ProgramUniform1d(ctx->Exec, (program, location, x));
8030 }
8031 }
8032
8033 static void GLAPIENTRY
8034 save_ProgramUniform2d(GLuint program, GLint location, GLdouble x, GLdouble y)
8035 {
8036 GET_CURRENT_CONTEXT(ctx);
8037 Node *n;
8038 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8039 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2D, 6);
8040 if (n) {
8041 n[1].ui = program;
8042 n[2].i = location;
8043 ASSIGN_DOUBLE_TO_NODES(n, 3, x);
8044 ASSIGN_DOUBLE_TO_NODES(n, 5, y);
8045 }
8046 if (ctx->ExecuteFlag) {
8047 CALL_ProgramUniform2d(ctx->Exec, (program, location, x, y));
8048 }
8049 }
8050
8051 static void GLAPIENTRY
8052 save_ProgramUniform3d(GLuint program, GLint location,
8053 GLdouble x, GLdouble y, GLdouble z)
8054 {
8055 GET_CURRENT_CONTEXT(ctx);
8056 Node *n;
8057 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8058 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3D, 8);
8059 if (n) {
8060 n[1].ui = program;
8061 n[2].i = location;
8062 ASSIGN_DOUBLE_TO_NODES(n, 3, x);
8063 ASSIGN_DOUBLE_TO_NODES(n, 5, y);
8064 ASSIGN_DOUBLE_TO_NODES(n, 7, z);
8065 }
8066 if (ctx->ExecuteFlag) {
8067 CALL_ProgramUniform3d(ctx->Exec, (program, location, x, y, z));
8068 }
8069 }
8070
8071 static void GLAPIENTRY
8072 save_ProgramUniform4d(GLuint program, GLint location,
8073 GLdouble x, GLdouble y, GLdouble z, GLdouble w)
8074 {
8075 GET_CURRENT_CONTEXT(ctx);
8076 Node *n;
8077 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8078 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4D, 10);
8079 if (n) {
8080 n[1].ui = program;
8081 n[2].i = location;
8082 ASSIGN_DOUBLE_TO_NODES(n, 3, x);
8083 ASSIGN_DOUBLE_TO_NODES(n, 5, y);
8084 ASSIGN_DOUBLE_TO_NODES(n, 7, z);
8085 ASSIGN_DOUBLE_TO_NODES(n, 9, w);
8086 }
8087 if (ctx->ExecuteFlag) {
8088 CALL_ProgramUniform4d(ctx->Exec, (program, location, x, y, z, w));
8089 }
8090 }
8091
8092 static void GLAPIENTRY
8093 save_ProgramUniform1dv(GLuint program, GLint location, GLsizei count,
8094 const GLdouble *v)
8095 {
8096 GET_CURRENT_CONTEXT(ctx);
8097 Node *n;
8098 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8099 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1DV, 3 + POINTER_DWORDS);
8100 if (n) {
8101 n[1].ui = program;
8102 n[2].i = location;
8103 n[3].i = count;
8104 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLdouble)));
8105 }
8106 if (ctx->ExecuteFlag) {
8107 CALL_ProgramUniform1dv(ctx->Exec, (program, location, count, v));
8108 }
8109 }
8110
8111 static void GLAPIENTRY
8112 save_ProgramUniform2dv(GLuint program, GLint location, GLsizei count,
8113 const GLdouble *v)
8114 {
8115 GET_CURRENT_CONTEXT(ctx);
8116 Node *n;
8117 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8118 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2DV, 3 + POINTER_DWORDS);
8119 if (n) {
8120 n[1].ui = program;
8121 n[2].i = location;
8122 n[3].i = count;
8123 save_pointer(&n[4], memdup(v, count * 2 * sizeof(GLdouble)));
8124 }
8125 if (ctx->ExecuteFlag) {
8126 CALL_ProgramUniform2dv(ctx->Exec, (program, location, count, v));
8127 }
8128 }
8129
8130 static void GLAPIENTRY
8131 save_ProgramUniform3dv(GLuint program, GLint location, GLsizei count,
8132 const GLdouble *v)
8133 {
8134 GET_CURRENT_CONTEXT(ctx);
8135 Node *n;
8136 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8137 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3DV, 3 + POINTER_DWORDS);
8138 if (n) {
8139 n[1].ui = program;
8140 n[2].i = location;
8141 n[3].i = count;
8142 save_pointer(&n[4], memdup(v, count * 3 * sizeof(GLdouble)));
8143 }
8144 if (ctx->ExecuteFlag) {
8145 CALL_ProgramUniform3dv(ctx->Exec, (program, location, count, v));
8146 }
8147 }
8148
8149 static void GLAPIENTRY
8150 save_ProgramUniform4dv(GLuint program, GLint location, GLsizei count,
8151 const GLdouble *v)
8152 {
8153 GET_CURRENT_CONTEXT(ctx);
8154 Node *n;
8155 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8156 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4DV, 3 + POINTER_DWORDS);
8157 if (n) {
8158 n[1].ui = program;
8159 n[2].i = location;
8160 n[3].i = count;
8161 save_pointer(&n[4], memdup(v, count * 4 * sizeof(GLdouble)));
8162 }
8163 if (ctx->ExecuteFlag) {
8164 CALL_ProgramUniform4dv(ctx->Exec, (program, location, count, v));
8165 }
8166 }
8167
8168 static void GLAPIENTRY
8169 save_ProgramUniform1i(GLuint program, GLint location, GLint x)
8170 {
8171 GET_CURRENT_CONTEXT(ctx);
8172 Node *n;
8173 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8174 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1I, 3);
8175 if (n) {
8176 n[1].ui = program;
8177 n[2].i = location;
8178 n[3].i = x;
8179 }
8180 if (ctx->ExecuteFlag) {
8181 CALL_ProgramUniform1i(ctx->Exec, (program, location, x));
8182 }
8183 }
8184
8185 static void GLAPIENTRY
8186 save_ProgramUniform2i(GLuint program, GLint location, GLint x, GLint y)
8187 {
8188 GET_CURRENT_CONTEXT(ctx);
8189 Node *n;
8190 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8191 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2I, 4);
8192 if (n) {
8193 n[1].ui = program;
8194 n[2].i = location;
8195 n[3].i = x;
8196 n[4].i = y;
8197 }
8198 if (ctx->ExecuteFlag) {
8199 CALL_ProgramUniform2i(ctx->Exec, (program, location, x, y));
8200 }
8201 }
8202
8203 static void GLAPIENTRY
8204 save_ProgramUniform3i(GLuint program, GLint location,
8205 GLint x, GLint y, GLint z)
8206 {
8207 GET_CURRENT_CONTEXT(ctx);
8208 Node *n;
8209 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8210 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3I, 5);
8211 if (n) {
8212 n[1].ui = program;
8213 n[2].i = location;
8214 n[3].i = x;
8215 n[4].i = y;
8216 n[5].i = z;
8217 }
8218 if (ctx->ExecuteFlag) {
8219 CALL_ProgramUniform3i(ctx->Exec, (program, location, x, y, z));
8220 }
8221 }
8222
8223 static void GLAPIENTRY
8224 save_ProgramUniform4i(GLuint program, GLint location,
8225 GLint x, GLint y, GLint z, GLint w)
8226 {
8227 GET_CURRENT_CONTEXT(ctx);
8228 Node *n;
8229 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8230 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4I, 6);
8231 if (n) {
8232 n[1].ui = program;
8233 n[2].i = location;
8234 n[3].i = x;
8235 n[4].i = y;
8236 n[5].i = z;
8237 n[6].i = w;
8238 }
8239 if (ctx->ExecuteFlag) {
8240 CALL_ProgramUniform4i(ctx->Exec, (program, location, x, y, z, w));
8241 }
8242 }
8243
8244 static void GLAPIENTRY
8245 save_ProgramUniform1iv(GLuint program, GLint location, GLsizei count,
8246 const GLint *v)
8247 {
8248 GET_CURRENT_CONTEXT(ctx);
8249 Node *n;
8250 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8251 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1IV, 3 + POINTER_DWORDS);
8252 if (n) {
8253 n[1].ui = program;
8254 n[2].i = location;
8255 n[3].i = count;
8256 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLint)));
8257 }
8258 if (ctx->ExecuteFlag) {
8259 CALL_ProgramUniform1iv(ctx->Exec, (program, location, count, v));
8260 }
8261 }
8262
8263 static void GLAPIENTRY
8264 save_ProgramUniform2iv(GLuint program, GLint location, GLsizei count,
8265 const GLint *v)
8266 {
8267 GET_CURRENT_CONTEXT(ctx);
8268 Node *n;
8269 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8270 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2IV, 3 + POINTER_DWORDS);
8271 if (n) {
8272 n[1].ui = program;
8273 n[2].i = location;
8274 n[3].i = count;
8275 save_pointer(&n[4], memdup(v, count * 2 * sizeof(GLint)));
8276 }
8277 if (ctx->ExecuteFlag) {
8278 CALL_ProgramUniform2iv(ctx->Exec, (program, location, count, v));
8279 }
8280 }
8281
8282 static void GLAPIENTRY
8283 save_ProgramUniform3iv(GLuint program, GLint location, GLsizei count,
8284 const GLint *v)
8285 {
8286 GET_CURRENT_CONTEXT(ctx);
8287 Node *n;
8288 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8289 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3IV, 3 + POINTER_DWORDS);
8290 if (n) {
8291 n[1].ui = program;
8292 n[2].i = location;
8293 n[3].i = count;
8294 save_pointer(&n[4], memdup(v, count * 3 * sizeof(GLint)));
8295 }
8296 if (ctx->ExecuteFlag) {
8297 CALL_ProgramUniform3iv(ctx->Exec, (program, location, count, v));
8298 }
8299 }
8300
8301 static void GLAPIENTRY
8302 save_ProgramUniform4iv(GLuint program, GLint location, GLsizei count,
8303 const GLint *v)
8304 {
8305 GET_CURRENT_CONTEXT(ctx);
8306 Node *n;
8307 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8308 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4IV, 3 + POINTER_DWORDS);
8309 if (n) {
8310 n[1].ui = program;
8311 n[2].i = location;
8312 n[3].i = count;
8313 save_pointer(&n[4], memdup(v, count * 4 * sizeof(GLint)));
8314 }
8315 if (ctx->ExecuteFlag) {
8316 CALL_ProgramUniform4iv(ctx->Exec, (program, location, count, v));
8317 }
8318 }
8319
8320 static void GLAPIENTRY
8321 save_ProgramUniform1ui(GLuint program, GLint location, GLuint x)
8322 {
8323 GET_CURRENT_CONTEXT(ctx);
8324 Node *n;
8325 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8326 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1UI, 3);
8327 if (n) {
8328 n[1].ui = program;
8329 n[2].i = location;
8330 n[3].ui = x;
8331 }
8332 if (ctx->ExecuteFlag) {
8333 CALL_ProgramUniform1ui(ctx->Exec, (program, location, x));
8334 }
8335 }
8336
8337 static void GLAPIENTRY
8338 save_ProgramUniform2ui(GLuint program, GLint location, GLuint x, GLuint y)
8339 {
8340 GET_CURRENT_CONTEXT(ctx);
8341 Node *n;
8342 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8343 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2UI, 4);
8344 if (n) {
8345 n[1].ui = program;
8346 n[2].i = location;
8347 n[3].ui = x;
8348 n[4].ui = y;
8349 }
8350 if (ctx->ExecuteFlag) {
8351 CALL_ProgramUniform2ui(ctx->Exec, (program, location, x, y));
8352 }
8353 }
8354
8355 static void GLAPIENTRY
8356 save_ProgramUniform3ui(GLuint program, GLint location,
8357 GLuint x, GLuint y, GLuint z)
8358 {
8359 GET_CURRENT_CONTEXT(ctx);
8360 Node *n;
8361 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8362 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3UI, 5);
8363 if (n) {
8364 n[1].ui = program;
8365 n[2].i = location;
8366 n[3].ui = x;
8367 n[4].ui = y;
8368 n[5].ui = z;
8369 }
8370 if (ctx->ExecuteFlag) {
8371 CALL_ProgramUniform3ui(ctx->Exec, (program, location, x, y, z));
8372 }
8373 }
8374
8375 static void GLAPIENTRY
8376 save_ProgramUniform4ui(GLuint program, GLint location,
8377 GLuint x, GLuint y, GLuint z, GLuint w)
8378 {
8379 GET_CURRENT_CONTEXT(ctx);
8380 Node *n;
8381 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8382 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4UI, 6);
8383 if (n) {
8384 n[1].ui = program;
8385 n[2].i = location;
8386 n[3].ui = x;
8387 n[4].ui = y;
8388 n[5].ui = z;
8389 n[6].ui = w;
8390 }
8391 if (ctx->ExecuteFlag) {
8392 CALL_ProgramUniform4ui(ctx->Exec, (program, location, x, y, z, w));
8393 }
8394 }
8395
8396 static void GLAPIENTRY
8397 save_ProgramUniform1uiv(GLuint program, GLint location, GLsizei count,
8398 const GLuint *v)
8399 {
8400 GET_CURRENT_CONTEXT(ctx);
8401 Node *n;
8402 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8403 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1UIV, 3 + POINTER_DWORDS);
8404 if (n) {
8405 n[1].ui = program;
8406 n[2].i = location;
8407 n[3].i = count;
8408 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLuint)));
8409 }
8410 if (ctx->ExecuteFlag) {
8411 CALL_ProgramUniform1uiv(ctx->Exec, (program, location, count, v));
8412 }
8413 }
8414
8415 static void GLAPIENTRY
8416 save_ProgramUniform2uiv(GLuint program, GLint location, GLsizei count,
8417 const GLuint *v)
8418 {
8419 GET_CURRENT_CONTEXT(ctx);
8420 Node *n;
8421 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8422 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2UIV, 3 + POINTER_DWORDS);
8423 if (n) {
8424 n[1].ui = program;
8425 n[2].i = location;
8426 n[3].i = count;
8427 save_pointer(&n[4], memdup(v, count * 2 * sizeof(GLuint)));
8428 }
8429 if (ctx->ExecuteFlag) {
8430 CALL_ProgramUniform2uiv(ctx->Exec, (program, location, count, v));
8431 }
8432 }
8433
8434 static void GLAPIENTRY
8435 save_ProgramUniform3uiv(GLuint program, GLint location, GLsizei count,
8436 const GLuint *v)
8437 {
8438 GET_CURRENT_CONTEXT(ctx);
8439 Node *n;
8440 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8441 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3UIV, 3 + POINTER_DWORDS);
8442 if (n) {
8443 n[1].ui = program;
8444 n[2].i = location;
8445 n[3].i = count;
8446 save_pointer(&n[4], memdup(v, count * 3 * sizeof(GLuint)));
8447 }
8448 if (ctx->ExecuteFlag) {
8449 CALL_ProgramUniform3uiv(ctx->Exec, (program, location, count, v));
8450 }
8451 }
8452
8453 static void GLAPIENTRY
8454 save_ProgramUniform4uiv(GLuint program, GLint location, GLsizei count,
8455 const GLuint *v)
8456 {
8457 GET_CURRENT_CONTEXT(ctx);
8458 Node *n;
8459 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8460 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4UIV, 3 + POINTER_DWORDS);
8461 if (n) {
8462 n[1].ui = program;
8463 n[2].i = location;
8464 n[3].i = count;
8465 save_pointer(&n[4], memdup(v, count * 4 * sizeof(GLuint)));
8466 }
8467 if (ctx->ExecuteFlag) {
8468 CALL_ProgramUniform4uiv(ctx->Exec, (program, location, count, v));
8469 }
8470 }
8471
8472 static void GLAPIENTRY
8473 save_ProgramUniformMatrix2fv(GLuint program, GLint location, GLsizei count,
8474 GLboolean transpose, const GLfloat *v)
8475 {
8476 GET_CURRENT_CONTEXT(ctx);
8477 Node *n;
8478 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8479 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX22F,
8480 4 + POINTER_DWORDS);
8481 if (n) {
8482 n[1].ui = program;
8483 n[2].i = location;
8484 n[3].i = count;
8485 n[4].b = transpose;
8486 save_pointer(&n[5], memdup(v, count * 2 * 2 * sizeof(GLfloat)));
8487 }
8488 if (ctx->ExecuteFlag) {
8489 CALL_ProgramUniformMatrix2fv(ctx->Exec,
8490 (program, location, count, transpose, v));
8491 }
8492 }
8493
8494 static void GLAPIENTRY
8495 save_ProgramUniformMatrix2x3fv(GLuint program, GLint location, GLsizei count,
8496 GLboolean transpose, const GLfloat *v)
8497 {
8498 GET_CURRENT_CONTEXT(ctx);
8499 Node *n;
8500 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8501 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX23F,
8502 4 + POINTER_DWORDS);
8503 if (n) {
8504 n[1].ui = program;
8505 n[2].i = location;
8506 n[3].i = count;
8507 n[4].b = transpose;
8508 save_pointer(&n[5], memdup(v, count * 2 * 3 * sizeof(GLfloat)));
8509 }
8510 if (ctx->ExecuteFlag) {
8511 CALL_ProgramUniformMatrix2x3fv(ctx->Exec,
8512 (program, location, count, transpose, v));
8513 }
8514 }
8515
8516 static void GLAPIENTRY
8517 save_ProgramUniformMatrix2x4fv(GLuint program, GLint location, GLsizei count,
8518 GLboolean transpose, const GLfloat *v)
8519 {
8520 GET_CURRENT_CONTEXT(ctx);
8521 Node *n;
8522 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8523 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX24F,
8524 4 + POINTER_DWORDS);
8525 if (n) {
8526 n[1].ui = program;
8527 n[2].i = location;
8528 n[3].i = count;
8529 n[4].b = transpose;
8530 save_pointer(&n[5], memdup(v, count * 2 * 4 * sizeof(GLfloat)));
8531 }
8532 if (ctx->ExecuteFlag) {
8533 CALL_ProgramUniformMatrix2x4fv(ctx->Exec,
8534 (program, location, count, transpose, v));
8535 }
8536 }
8537
8538 static void GLAPIENTRY
8539 save_ProgramUniformMatrix3x2fv(GLuint program, GLint location, GLsizei count,
8540 GLboolean transpose, const GLfloat *v)
8541 {
8542 GET_CURRENT_CONTEXT(ctx);
8543 Node *n;
8544 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8545 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX32F,
8546 4 + POINTER_DWORDS);
8547 if (n) {
8548 n[1].ui = program;
8549 n[2].i = location;
8550 n[3].i = count;
8551 n[4].b = transpose;
8552 save_pointer(&n[5], memdup(v, count * 3 * 2 * sizeof(GLfloat)));
8553 }
8554 if (ctx->ExecuteFlag) {
8555 CALL_ProgramUniformMatrix3x2fv(ctx->Exec,
8556 (program, location, count, transpose, v));
8557 }
8558 }
8559
8560 static void GLAPIENTRY
8561 save_ProgramUniformMatrix3fv(GLuint program, GLint location, GLsizei count,
8562 GLboolean transpose, const GLfloat *v)
8563 {
8564 GET_CURRENT_CONTEXT(ctx);
8565 Node *n;
8566 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8567 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX33F,
8568 4 + POINTER_DWORDS);
8569 if (n) {
8570 n[1].ui = program;
8571 n[2].i = location;
8572 n[3].i = count;
8573 n[4].b = transpose;
8574 save_pointer(&n[5], memdup(v, count * 3 * 3 * sizeof(GLfloat)));
8575 }
8576 if (ctx->ExecuteFlag) {
8577 CALL_ProgramUniformMatrix3fv(ctx->Exec,
8578 (program, location, count, transpose, v));
8579 }
8580 }
8581
8582 static void GLAPIENTRY
8583 save_ProgramUniformMatrix3x4fv(GLuint program, GLint location, GLsizei count,
8584 GLboolean transpose, const GLfloat *v)
8585 {
8586 GET_CURRENT_CONTEXT(ctx);
8587 Node *n;
8588 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8589 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX34F,
8590 4 + POINTER_DWORDS);
8591 if (n) {
8592 n[1].ui = program;
8593 n[2].i = location;
8594 n[3].i = count;
8595 n[4].b = transpose;
8596 save_pointer(&n[5], memdup(v, count * 3 * 4 * sizeof(GLfloat)));
8597 }
8598 if (ctx->ExecuteFlag) {
8599 CALL_ProgramUniformMatrix3x4fv(ctx->Exec,
8600 (program, location, count, transpose, v));
8601 }
8602 }
8603
8604 static void GLAPIENTRY
8605 save_ProgramUniformMatrix4x2fv(GLuint program, GLint location, GLsizei count,
8606 GLboolean transpose, const GLfloat *v)
8607 {
8608 GET_CURRENT_CONTEXT(ctx);
8609 Node *n;
8610 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8611 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX42F,
8612 4 + POINTER_DWORDS);
8613 if (n) {
8614 n[1].ui = program;
8615 n[2].i = location;
8616 n[3].i = count;
8617 n[4].b = transpose;
8618 save_pointer(&n[5], memdup(v, count * 4 * 2 * sizeof(GLfloat)));
8619 }
8620 if (ctx->ExecuteFlag) {
8621 CALL_ProgramUniformMatrix4x2fv(ctx->Exec,
8622 (program, location, count, transpose, v));
8623 }
8624 }
8625
8626 static void GLAPIENTRY
8627 save_ProgramUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count,
8628 GLboolean transpose, const GLfloat *v)
8629 {
8630 GET_CURRENT_CONTEXT(ctx);
8631 Node *n;
8632 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8633 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX43F,
8634 4 + POINTER_DWORDS);
8635 if (n) {
8636 n[1].ui = program;
8637 n[2].i = location;
8638 n[3].i = count;
8639 n[4].b = transpose;
8640 save_pointer(&n[5], memdup(v, count * 4 * 3 * sizeof(GLfloat)));
8641 }
8642 if (ctx->ExecuteFlag) {
8643 CALL_ProgramUniformMatrix4x3fv(ctx->Exec,
8644 (program, location, count, transpose, v));
8645 }
8646 }
8647
8648 static void GLAPIENTRY
8649 save_ProgramUniformMatrix4fv(GLuint program, GLint location, GLsizei count,
8650 GLboolean transpose, const GLfloat *v)
8651 {
8652 GET_CURRENT_CONTEXT(ctx);
8653 Node *n;
8654 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8655 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX44F,
8656 4 + POINTER_DWORDS);
8657 if (n) {
8658 n[1].ui = program;
8659 n[2].i = location;
8660 n[3].i = count;
8661 n[4].b = transpose;
8662 save_pointer(&n[5], memdup(v, count * 4 * 4 * sizeof(GLfloat)));
8663 }
8664 if (ctx->ExecuteFlag) {
8665 CALL_ProgramUniformMatrix4fv(ctx->Exec,
8666 (program, location, count, transpose, v));
8667 }
8668 }
8669
8670 static void GLAPIENTRY
8671 save_ProgramUniformMatrix2dv(GLuint program, GLint location, GLsizei count,
8672 GLboolean transpose, const GLdouble *v)
8673 {
8674 GET_CURRENT_CONTEXT(ctx);
8675 Node *n;
8676 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8677 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX22D,
8678 4 + POINTER_DWORDS);
8679 if (n) {
8680 n[1].ui = program;
8681 n[2].i = location;
8682 n[3].i = count;
8683 n[4].b = transpose;
8684 save_pointer(&n[5], memdup(v, count * 2 * 2 * sizeof(GLdouble)));
8685 }
8686 if (ctx->ExecuteFlag) {
8687 CALL_ProgramUniformMatrix2dv(ctx->Exec,
8688 (program, location, count, transpose, v));
8689 }
8690 }
8691
8692 static void GLAPIENTRY
8693 save_ProgramUniformMatrix2x3dv(GLuint program, GLint location, GLsizei count,
8694 GLboolean transpose, const GLdouble *v)
8695 {
8696 GET_CURRENT_CONTEXT(ctx);
8697 Node *n;
8698 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8699 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX23D,
8700 4 + POINTER_DWORDS);
8701 if (n) {
8702 n[1].ui = program;
8703 n[2].i = location;
8704 n[3].i = count;
8705 n[4].b = transpose;
8706 save_pointer(&n[5], memdup(v, count * 2 * 3 * sizeof(GLdouble)));
8707 }
8708 if (ctx->ExecuteFlag) {
8709 CALL_ProgramUniformMatrix2x3dv(ctx->Exec,
8710 (program, location, count, transpose, v));
8711 }
8712 }
8713
8714 static void GLAPIENTRY
8715 save_ProgramUniformMatrix2x4dv(GLuint program, GLint location, GLsizei count,
8716 GLboolean transpose, const GLdouble *v)
8717 {
8718 GET_CURRENT_CONTEXT(ctx);
8719 Node *n;
8720 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8721 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX24D,
8722 4 + POINTER_DWORDS);
8723 if (n) {
8724 n[1].ui = program;
8725 n[2].i = location;
8726 n[3].i = count;
8727 n[4].b = transpose;
8728 save_pointer(&n[5], memdup(v, count * 2 * 4 * sizeof(GLdouble)));
8729 }
8730 if (ctx->ExecuteFlag) {
8731 CALL_ProgramUniformMatrix2x4dv(ctx->Exec,
8732 (program, location, count, transpose, v));
8733 }
8734 }
8735
8736 static void GLAPIENTRY
8737 save_ProgramUniformMatrix3x2dv(GLuint program, GLint location, GLsizei count,
8738 GLboolean transpose, const GLdouble *v)
8739 {
8740 GET_CURRENT_CONTEXT(ctx);
8741 Node *n;
8742 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8743 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX32D,
8744 4 + POINTER_DWORDS);
8745 if (n) {
8746 n[1].ui = program;
8747 n[2].i = location;
8748 n[3].i = count;
8749 n[4].b = transpose;
8750 save_pointer(&n[5], memdup(v, count * 3 * 2 * sizeof(GLdouble)));
8751 }
8752 if (ctx->ExecuteFlag) {
8753 CALL_ProgramUniformMatrix3x2dv(ctx->Exec,
8754 (program, location, count, transpose, v));
8755 }
8756 }
8757
8758 static void GLAPIENTRY
8759 save_ProgramUniformMatrix3dv(GLuint program, GLint location, GLsizei count,
8760 GLboolean transpose, const GLdouble *v)
8761 {
8762 GET_CURRENT_CONTEXT(ctx);
8763 Node *n;
8764 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8765 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX33D,
8766 4 + POINTER_DWORDS);
8767 if (n) {
8768 n[1].ui = program;
8769 n[2].i = location;
8770 n[3].i = count;
8771 n[4].b = transpose;
8772 save_pointer(&n[5], memdup(v, count * 3 * 3 * sizeof(GLdouble)));
8773 }
8774 if (ctx->ExecuteFlag) {
8775 CALL_ProgramUniformMatrix3dv(ctx->Exec,
8776 (program, location, count, transpose, v));
8777 }
8778 }
8779
8780 static void GLAPIENTRY
8781 save_ProgramUniformMatrix3x4dv(GLuint program, GLint location, GLsizei count,
8782 GLboolean transpose, const GLdouble *v)
8783 {
8784 GET_CURRENT_CONTEXT(ctx);
8785 Node *n;
8786 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8787 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX34D,
8788 4 + POINTER_DWORDS);
8789 if (n) {
8790 n[1].ui = program;
8791 n[2].i = location;
8792 n[3].i = count;
8793 n[4].b = transpose;
8794 save_pointer(&n[5], memdup(v, count * 3 * 4 * sizeof(GLdouble)));
8795 }
8796 if (ctx->ExecuteFlag) {
8797 CALL_ProgramUniformMatrix3x4dv(ctx->Exec,
8798 (program, location, count, transpose, v));
8799 }
8800 }
8801
8802 static void GLAPIENTRY
8803 save_ProgramUniformMatrix4x2dv(GLuint program, GLint location, GLsizei count,
8804 GLboolean transpose, const GLdouble *v)
8805 {
8806 GET_CURRENT_CONTEXT(ctx);
8807 Node *n;
8808 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8809 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX42D,
8810 4 + POINTER_DWORDS);
8811 if (n) {
8812 n[1].ui = program;
8813 n[2].i = location;
8814 n[3].i = count;
8815 n[4].b = transpose;
8816 save_pointer(&n[5], memdup(v, count * 4 * 2 * sizeof(GLdouble)));
8817 }
8818 if (ctx->ExecuteFlag) {
8819 CALL_ProgramUniformMatrix4x2dv(ctx->Exec,
8820 (program, location, count, transpose, v));
8821 }
8822 }
8823
8824 static void GLAPIENTRY
8825 save_ProgramUniformMatrix4x3dv(GLuint program, GLint location, GLsizei count,
8826 GLboolean transpose, const GLdouble *v)
8827 {
8828 GET_CURRENT_CONTEXT(ctx);
8829 Node *n;
8830 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8831 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX43D,
8832 4 + POINTER_DWORDS);
8833 if (n) {
8834 n[1].ui = program;
8835 n[2].i = location;
8836 n[3].i = count;
8837 n[4].b = transpose;
8838 save_pointer(&n[5], memdup(v, count * 4 * 3 * sizeof(GLdouble)));
8839 }
8840 if (ctx->ExecuteFlag) {
8841 CALL_ProgramUniformMatrix4x3dv(ctx->Exec,
8842 (program, location, count, transpose, v));
8843 }
8844 }
8845
8846 static void GLAPIENTRY
8847 save_ProgramUniformMatrix4dv(GLuint program, GLint location, GLsizei count,
8848 GLboolean transpose, const GLdouble *v)
8849 {
8850 GET_CURRENT_CONTEXT(ctx);
8851 Node *n;
8852 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8853 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX44D,
8854 4 + POINTER_DWORDS);
8855 if (n) {
8856 n[1].ui = program;
8857 n[2].i = location;
8858 n[3].i = count;
8859 n[4].b = transpose;
8860 save_pointer(&n[5], memdup(v, count * 4 * 4 * sizeof(GLdouble)));
8861 }
8862 if (ctx->ExecuteFlag) {
8863 CALL_ProgramUniformMatrix4dv(ctx->Exec,
8864 (program, location, count, transpose, v));
8865 }
8866 }
8867
8868 static void GLAPIENTRY
8869 save_ClipControl(GLenum origin, GLenum depth)
8870 {
8871 GET_CURRENT_CONTEXT(ctx);
8872 Node *n;
8873 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8874 n = alloc_instruction(ctx, OPCODE_CLIP_CONTROL, 2);
8875 if (n) {
8876 n[1].e = origin;
8877 n[2].e = depth;
8878 }
8879 if (ctx->ExecuteFlag) {
8880 CALL_ClipControl(ctx->Exec, (origin, depth));
8881 }
8882 }
8883
8884 static void GLAPIENTRY
8885 save_ClampColorARB(GLenum target, GLenum clamp)
8886 {
8887 GET_CURRENT_CONTEXT(ctx);
8888 Node *n;
8889 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8890 n = alloc_instruction(ctx, OPCODE_CLAMP_COLOR, 2);
8891 if (n) {
8892 n[1].e = target;
8893 n[2].e = clamp;
8894 }
8895 if (ctx->ExecuteFlag) {
8896 CALL_ClampColor(ctx->Exec, (target, clamp));
8897 }
8898 }
8899
8900 /** GL_EXT_texture_integer */
8901 static void GLAPIENTRY
8902 save_ClearColorIi(GLint red, GLint green, GLint blue, GLint alpha)
8903 {
8904 GET_CURRENT_CONTEXT(ctx);
8905 Node *n;
8906 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8907 n = alloc_instruction(ctx, OPCODE_CLEARCOLOR_I, 4);
8908 if (n) {
8909 n[1].i = red;
8910 n[2].i = green;
8911 n[3].i = blue;
8912 n[4].i = alpha;
8913 }
8914 if (ctx->ExecuteFlag) {
8915 CALL_ClearColorIiEXT(ctx->Exec, (red, green, blue, alpha));
8916 }
8917 }
8918
8919 /** GL_EXT_texture_integer */
8920 static void GLAPIENTRY
8921 save_ClearColorIui(GLuint red, GLuint green, GLuint blue, GLuint alpha)
8922 {
8923 GET_CURRENT_CONTEXT(ctx);
8924 Node *n;
8925 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8926 n = alloc_instruction(ctx, OPCODE_CLEARCOLOR_UI, 4);
8927 if (n) {
8928 n[1].ui = red;
8929 n[2].ui = green;
8930 n[3].ui = blue;
8931 n[4].ui = alpha;
8932 }
8933 if (ctx->ExecuteFlag) {
8934 CALL_ClearColorIuiEXT(ctx->Exec, (red, green, blue, alpha));
8935 }
8936 }
8937
8938 /** GL_EXT_texture_integer */
8939 static void GLAPIENTRY
8940 save_TexParameterIiv(GLenum target, GLenum pname, const GLint *params)
8941 {
8942 GET_CURRENT_CONTEXT(ctx);
8943 Node *n;
8944 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8945 n = alloc_instruction(ctx, OPCODE_TEXPARAMETER_I, 6);
8946 if (n) {
8947 n[1].e = target;
8948 n[2].e = pname;
8949 n[3].i = params[0];
8950 n[4].i = params[1];
8951 n[5].i = params[2];
8952 n[6].i = params[3];
8953 }
8954 if (ctx->ExecuteFlag) {
8955 CALL_TexParameterIiv(ctx->Exec, (target, pname, params));
8956 }
8957 }
8958
8959 /** GL_EXT_texture_integer */
8960 static void GLAPIENTRY
8961 save_TexParameterIuiv(GLenum target, GLenum pname, const GLuint *params)
8962 {
8963 GET_CURRENT_CONTEXT(ctx);
8964 Node *n;
8965 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8966 n = alloc_instruction(ctx, OPCODE_TEXPARAMETER_UI, 6);
8967 if (n) {
8968 n[1].e = target;
8969 n[2].e = pname;
8970 n[3].ui = params[0];
8971 n[4].ui = params[1];
8972 n[5].ui = params[2];
8973 n[6].ui = params[3];
8974 }
8975 if (ctx->ExecuteFlag) {
8976 CALL_TexParameterIuiv(ctx->Exec, (target, pname, params));
8977 }
8978 }
8979
8980 /* GL_ARB_instanced_arrays */
8981 static void GLAPIENTRY
8982 save_VertexAttribDivisor(GLuint index, GLuint divisor)
8983 {
8984 GET_CURRENT_CONTEXT(ctx);
8985 Node *n;
8986 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8987 n = alloc_instruction(ctx, OPCODE_VERTEX_ATTRIB_DIVISOR, 2);
8988 if (n) {
8989 n[1].ui = index;
8990 n[2].ui = divisor;
8991 }
8992 if (ctx->ExecuteFlag) {
8993 CALL_VertexAttribDivisor(ctx->Exec, (index, divisor));
8994 }
8995 }
8996
8997
8998 /* GL_NV_texture_barrier */
8999 static void GLAPIENTRY
9000 save_TextureBarrierNV(void)
9001 {
9002 GET_CURRENT_CONTEXT(ctx);
9003 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9004 alloc_instruction(ctx, OPCODE_TEXTURE_BARRIER_NV, 0);
9005 if (ctx->ExecuteFlag) {
9006 CALL_TextureBarrierNV(ctx->Exec, ());
9007 }
9008 }
9009
9010
9011 /* GL_ARB_sampler_objects */
9012 static void GLAPIENTRY
9013 save_BindSampler(GLuint unit, GLuint sampler)
9014 {
9015 Node *n;
9016 GET_CURRENT_CONTEXT(ctx);
9017 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9018 n = alloc_instruction(ctx, OPCODE_BIND_SAMPLER, 2);
9019 if (n) {
9020 n[1].ui = unit;
9021 n[2].ui = sampler;
9022 }
9023 if (ctx->ExecuteFlag) {
9024 CALL_BindSampler(ctx->Exec, (unit, sampler));
9025 }
9026 }
9027
9028 static void GLAPIENTRY
9029 save_SamplerParameteriv(GLuint sampler, GLenum pname, const GLint *params)
9030 {
9031 Node *n;
9032 GET_CURRENT_CONTEXT(ctx);
9033 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9034 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERIV, 6);
9035 if (n) {
9036 n[1].ui = sampler;
9037 n[2].e = pname;
9038 n[3].i = params[0];
9039 if (pname == GL_TEXTURE_BORDER_COLOR) {
9040 n[4].i = params[1];
9041 n[5].i = params[2];
9042 n[6].i = params[3];
9043 }
9044 else {
9045 n[4].i = n[5].i = n[6].i = 0;
9046 }
9047 }
9048 if (ctx->ExecuteFlag) {
9049 CALL_SamplerParameteriv(ctx->Exec, (sampler, pname, params));
9050 }
9051 }
9052
9053 static void GLAPIENTRY
9054 save_SamplerParameteri(GLuint sampler, GLenum pname, GLint param)
9055 {
9056 GLint parray[4];
9057 parray[0] = param;
9058 parray[1] = parray[2] = parray[3] = 0;
9059 save_SamplerParameteriv(sampler, pname, parray);
9060 }
9061
9062 static void GLAPIENTRY
9063 save_SamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *params)
9064 {
9065 Node *n;
9066 GET_CURRENT_CONTEXT(ctx);
9067 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9068 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERFV, 6);
9069 if (n) {
9070 n[1].ui = sampler;
9071 n[2].e = pname;
9072 n[3].f = params[0];
9073 if (pname == GL_TEXTURE_BORDER_COLOR) {
9074 n[4].f = params[1];
9075 n[5].f = params[2];
9076 n[6].f = params[3];
9077 }
9078 else {
9079 n[4].f = n[5].f = n[6].f = 0.0F;
9080 }
9081 }
9082 if (ctx->ExecuteFlag) {
9083 CALL_SamplerParameterfv(ctx->Exec, (sampler, pname, params));
9084 }
9085 }
9086
9087 static void GLAPIENTRY
9088 save_SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
9089 {
9090 GLfloat parray[4];
9091 parray[0] = param;
9092 parray[1] = parray[2] = parray[3] = 0.0F;
9093 save_SamplerParameterfv(sampler, pname, parray);
9094 }
9095
9096 static void GLAPIENTRY
9097 save_SamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *params)
9098 {
9099 Node *n;
9100 GET_CURRENT_CONTEXT(ctx);
9101 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9102 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERIIV, 6);
9103 if (n) {
9104 n[1].ui = sampler;
9105 n[2].e = pname;
9106 n[3].i = params[0];
9107 if (pname == GL_TEXTURE_BORDER_COLOR) {
9108 n[4].i = params[1];
9109 n[5].i = params[2];
9110 n[6].i = params[3];
9111 }
9112 else {
9113 n[4].i = n[5].i = n[6].i = 0;
9114 }
9115 }
9116 if (ctx->ExecuteFlag) {
9117 CALL_SamplerParameterIiv(ctx->Exec, (sampler, pname, params));
9118 }
9119 }
9120
9121 static void GLAPIENTRY
9122 save_SamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *params)
9123 {
9124 Node *n;
9125 GET_CURRENT_CONTEXT(ctx);
9126 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9127 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERUIV, 6);
9128 if (n) {
9129 n[1].ui = sampler;
9130 n[2].e = pname;
9131 n[3].ui = params[0];
9132 if (pname == GL_TEXTURE_BORDER_COLOR) {
9133 n[4].ui = params[1];
9134 n[5].ui = params[2];
9135 n[6].ui = params[3];
9136 }
9137 else {
9138 n[4].ui = n[5].ui = n[6].ui = 0;
9139 }
9140 }
9141 if (ctx->ExecuteFlag) {
9142 CALL_SamplerParameterIuiv(ctx->Exec, (sampler, pname, params));
9143 }
9144 }
9145
9146 static void GLAPIENTRY
9147 save_WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
9148 {
9149 Node *n;
9150 GET_CURRENT_CONTEXT(ctx);
9151 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9152 n = alloc_instruction(ctx, OPCODE_WAIT_SYNC, 4);
9153 if (n) {
9154 union uint64_pair p;
9155 p.uint64 = timeout;
9156 n[1].bf = flags;
9157 n[2].ui = p.uint32[0];
9158 n[3].ui = p.uint32[1];
9159 save_pointer(&n[4], sync);
9160 }
9161 if (ctx->ExecuteFlag) {
9162 CALL_WaitSync(ctx->Exec, (sync, flags, timeout));
9163 }
9164 }
9165
9166
9167 /** GL_NV_conditional_render */
9168 static void GLAPIENTRY
9169 save_BeginConditionalRender(GLuint queryId, GLenum mode)
9170 {
9171 GET_CURRENT_CONTEXT(ctx);
9172 Node *n;
9173 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9174 n = alloc_instruction(ctx, OPCODE_BEGIN_CONDITIONAL_RENDER, 2);
9175 if (n) {
9176 n[1].i = queryId;
9177 n[2].e = mode;
9178 }
9179 if (ctx->ExecuteFlag) {
9180 CALL_BeginConditionalRender(ctx->Exec, (queryId, mode));
9181 }
9182 }
9183
9184 static void GLAPIENTRY
9185 save_EndConditionalRender(void)
9186 {
9187 GET_CURRENT_CONTEXT(ctx);
9188 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9189 alloc_instruction(ctx, OPCODE_END_CONDITIONAL_RENDER, 0);
9190 if (ctx->ExecuteFlag) {
9191 CALL_EndConditionalRender(ctx->Exec, ());
9192 }
9193 }
9194
9195 static void GLAPIENTRY
9196 save_UniformBlockBinding(GLuint prog, GLuint index, GLuint binding)
9197 {
9198 GET_CURRENT_CONTEXT(ctx);
9199 Node *n;
9200 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9201 n = alloc_instruction(ctx, OPCODE_UNIFORM_BLOCK_BINDING, 3);
9202 if (n) {
9203 n[1].ui = prog;
9204 n[2].ui = index;
9205 n[3].ui = binding;
9206 }
9207 if (ctx->ExecuteFlag) {
9208 CALL_UniformBlockBinding(ctx->Exec, (prog, index, binding));
9209 }
9210 }
9211
9212 static void GLAPIENTRY
9213 save_UniformSubroutinesuiv(GLenum shadertype, GLsizei count,
9214 const GLuint *indices)
9215 {
9216 GET_CURRENT_CONTEXT(ctx);
9217 Node *n;
9218 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9219 n = alloc_instruction(ctx, OPCODE_UNIFORM_SUBROUTINES, 2 + POINTER_DWORDS);
9220 if (n) {
9221 GLint *indices_copy = NULL;
9222
9223 if (count > 0)
9224 indices_copy = memdup(indices, sizeof(GLuint) * 4 * count);
9225 n[1].e = shadertype;
9226 n[2].si = count;
9227 save_pointer(&n[3], indices_copy);
9228 }
9229 if (ctx->ExecuteFlag) {
9230 CALL_UniformSubroutinesuiv(ctx->Exec, (shadertype, count, indices));
9231 }
9232 }
9233
9234 /** GL_EXT_window_rectangles */
9235 static void GLAPIENTRY
9236 save_WindowRectanglesEXT(GLenum mode, GLsizei count, const GLint *box)
9237 {
9238 GET_CURRENT_CONTEXT(ctx);
9239 Node *n;
9240 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9241 n = alloc_instruction(ctx, OPCODE_WINDOW_RECTANGLES, 2 + POINTER_DWORDS);
9242 if (n) {
9243 GLint *box_copy = NULL;
9244
9245 if (count > 0)
9246 box_copy = memdup(box, sizeof(GLint) * 4 * count);
9247 n[1].e = mode;
9248 n[2].si = count;
9249 save_pointer(&n[3], box_copy);
9250 }
9251 if (ctx->ExecuteFlag) {
9252 CALL_WindowRectanglesEXT(ctx->Exec, (mode, count, box));
9253 }
9254 }
9255
9256
9257 /** GL_NV_conservative_raster */
9258 static void GLAPIENTRY
9259 save_SubpixelPrecisionBiasNV(GLuint xbits, GLuint ybits)
9260 {
9261 GET_CURRENT_CONTEXT(ctx);
9262 Node *n;
9263 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9264 n = alloc_instruction(ctx, OPCODE_SUBPIXEL_PRECISION_BIAS, 2);
9265 if (n) {
9266 n[1].ui = xbits;
9267 n[2].ui = ybits;
9268 }
9269 if (ctx->ExecuteFlag) {
9270 CALL_SubpixelPrecisionBiasNV(ctx->Exec, (xbits, ybits));
9271 }
9272 }
9273
9274 /** GL_NV_conservative_raster_dilate */
9275 static void GLAPIENTRY
9276 save_ConservativeRasterParameterfNV(GLenum pname, GLfloat param)
9277 {
9278 GET_CURRENT_CONTEXT(ctx);
9279 Node *n;
9280 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9281 n = alloc_instruction(ctx, OPCODE_CONSERVATIVE_RASTER_PARAMETER_F, 2);
9282 if (n) {
9283 n[1].e = pname;
9284 n[2].f = param;
9285 }
9286 if (ctx->ExecuteFlag) {
9287 CALL_ConservativeRasterParameterfNV(ctx->Exec, (pname, param));
9288 }
9289 }
9290
9291 /** GL_NV_conservative_raster_pre_snap_triangles */
9292 static void GLAPIENTRY
9293 save_ConservativeRasterParameteriNV(GLenum pname, GLint param)
9294 {
9295 GET_CURRENT_CONTEXT(ctx);
9296 Node *n;
9297 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9298 n = alloc_instruction(ctx, OPCODE_CONSERVATIVE_RASTER_PARAMETER_I, 2);
9299 if (n) {
9300 n[1].e = pname;
9301 n[2].i = param;
9302 }
9303 if (ctx->ExecuteFlag) {
9304 CALL_ConservativeRasterParameteriNV(ctx->Exec, (pname, param));
9305 }
9306 }
9307
9308 /** GL_EXT_direct_state_access */
9309
9310 static void GLAPIENTRY
9311 save_MatrixLoadfEXT(GLenum matrixMode, const GLfloat *m)
9312 {
9313 GET_CURRENT_CONTEXT(ctx);
9314 Node *n;
9315 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9316 n = alloc_instruction(ctx, OPCODE_MATRIX_LOAD, 17);
9317 if (n) {
9318 n[1].e = matrixMode;
9319 for (unsigned i = 0; i < 16; i++) {
9320 n[2 + i].f = m[i];
9321 }
9322 }
9323 if (ctx->ExecuteFlag) {
9324 CALL_MatrixLoadfEXT(ctx->Exec, (matrixMode, m));
9325 }
9326 }
9327
9328 static void GLAPIENTRY
9329 save_MatrixLoaddEXT(GLenum matrixMode, const GLdouble *m)
9330 {
9331 GLfloat f[16];
9332 for (unsigned i = 0; i < 16; i++) {
9333 f[i] = (GLfloat) m[i];
9334 }
9335 save_MatrixLoadfEXT(matrixMode, f);
9336 }
9337
9338 static void GLAPIENTRY
9339 save_MatrixMultfEXT(GLenum matrixMode, const GLfloat * m)
9340 {
9341 GET_CURRENT_CONTEXT(ctx);
9342 Node *n;
9343 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9344 n = alloc_instruction(ctx, OPCODE_MATRIX_MULT, 17);
9345 if (n) {
9346 n[1].e = matrixMode;
9347 for (unsigned i = 0; i < 16; i++) {
9348 n[2 + i].f = m[i];
9349 }
9350 }
9351 if (ctx->ExecuteFlag) {
9352 CALL_MatrixMultfEXT(ctx->Exec, (matrixMode, m));
9353 }
9354 }
9355
9356 static void GLAPIENTRY
9357 save_MatrixMultdEXT(GLenum matrixMode, const GLdouble * m)
9358 {
9359 GLfloat f[16];
9360 for (unsigned i = 0; i < 16; i++) {
9361 f[i] = (GLfloat) m[i];
9362 }
9363 save_MatrixMultfEXT(matrixMode, f);
9364 }
9365
9366 static void GLAPIENTRY
9367 save_MatrixRotatefEXT(GLenum matrixMode, GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
9368 {
9369 GET_CURRENT_CONTEXT(ctx);
9370 Node *n;
9371 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9372 n = alloc_instruction(ctx, OPCODE_MATRIX_ROTATE, 5);
9373 if (n) {
9374 n[1].e = matrixMode;
9375 n[2].f = angle;
9376 n[3].f = x;
9377 n[4].f = y;
9378 n[5].f = z;
9379 }
9380 if (ctx->ExecuteFlag) {
9381 CALL_MatrixRotatefEXT(ctx->Exec, (matrixMode, angle, x, y, z));
9382 }
9383 }
9384
9385 static void GLAPIENTRY
9386 save_MatrixRotatedEXT(GLenum matrixMode, GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
9387 {
9388 save_MatrixRotatefEXT(matrixMode, (GLfloat) angle, (GLfloat) x, (GLfloat) y, (GLfloat) z);
9389 }
9390
9391 static void GLAPIENTRY
9392 save_MatrixScalefEXT(GLenum matrixMode, GLfloat x, GLfloat y, GLfloat z)
9393 {
9394 GET_CURRENT_CONTEXT(ctx);
9395 Node *n;
9396 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9397 n = alloc_instruction(ctx, OPCODE_MATRIX_SCALE, 4);
9398 if (n) {
9399 n[1].e = matrixMode;
9400 n[2].f = x;
9401 n[3].f = y;
9402 n[4].f = z;
9403 }
9404 if (ctx->ExecuteFlag) {
9405 CALL_MatrixScalefEXT(ctx->Exec, (matrixMode, x, y, z));
9406 }
9407 }
9408
9409 static void GLAPIENTRY
9410 save_MatrixScaledEXT(GLenum matrixMode, GLdouble x, GLdouble y, GLdouble z)
9411 {
9412 save_MatrixScalefEXT(matrixMode, (GLfloat) x, (GLfloat) y, (GLfloat) z);
9413 }
9414
9415 static void GLAPIENTRY
9416 save_MatrixTranslatefEXT(GLenum matrixMode, GLfloat x, GLfloat y, GLfloat z)
9417 {
9418 GET_CURRENT_CONTEXT(ctx);
9419 Node *n;
9420 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9421 n = alloc_instruction(ctx, OPCODE_MATRIX_TRANSLATE, 4);
9422 if (n) {
9423 n[1].e = matrixMode;
9424 n[2].f = x;
9425 n[3].f = y;
9426 n[4].f = z;
9427 }
9428 if (ctx->ExecuteFlag) {
9429 CALL_MatrixTranslatefEXT(ctx->Exec, (matrixMode, x, y, z));
9430 }
9431 }
9432
9433 static void GLAPIENTRY
9434 save_MatrixTranslatedEXT(GLenum matrixMode, GLdouble x, GLdouble y, GLdouble z)
9435 {
9436 save_MatrixTranslatefEXT(matrixMode, (GLfloat) x, (GLfloat) y, (GLfloat) z);
9437 }
9438
9439 static void GLAPIENTRY
9440 save_MatrixLoadIdentityEXT(GLenum matrixMode)
9441 {
9442 GET_CURRENT_CONTEXT(ctx);
9443 Node *n;
9444 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9445 n = alloc_instruction(ctx, OPCODE_MATRIX_LOAD_IDENTITY, 1);
9446 if (n) {
9447 n[1].e = matrixMode;
9448 }
9449 if (ctx->ExecuteFlag) {
9450 CALL_MatrixLoadIdentityEXT(ctx->Exec, (matrixMode));
9451 }
9452 }
9453
9454 static void GLAPIENTRY
9455 save_MatrixOrthoEXT(GLenum matrixMode, GLdouble left, GLdouble right,
9456 GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval)
9457 {
9458 GET_CURRENT_CONTEXT(ctx);
9459 Node *n;
9460 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9461 n = alloc_instruction(ctx, OPCODE_MATRIX_ORTHO, 7);
9462 if (n) {
9463 n[1].e = matrixMode;
9464 n[2].f = (GLfloat) left;
9465 n[3].f = (GLfloat) right;
9466 n[4].f = (GLfloat) bottom;
9467 n[5].f = (GLfloat) top;
9468 n[6].f = (GLfloat) nearval;
9469 n[7].f = (GLfloat) farval;
9470 }
9471 if (ctx->ExecuteFlag) {
9472 CALL_MatrixOrthoEXT(ctx->Exec, (matrixMode, left, right, bottom, top, nearval, farval));
9473 }
9474 }
9475
9476
9477 static void GLAPIENTRY
9478 save_MatrixFrustumEXT(GLenum matrixMode, GLdouble left, GLdouble right,
9479 GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval)
9480 {
9481 GET_CURRENT_CONTEXT(ctx);
9482 Node *n;
9483 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9484 n = alloc_instruction(ctx, OPCODE_MATRIX_FRUSTUM, 7);
9485 if (n) {
9486 n[1].e = matrixMode;
9487 n[2].f = (GLfloat) left;
9488 n[3].f = (GLfloat) right;
9489 n[4].f = (GLfloat) bottom;
9490 n[5].f = (GLfloat) top;
9491 n[6].f = (GLfloat) nearval;
9492 n[7].f = (GLfloat) farval;
9493 }
9494 if (ctx->ExecuteFlag) {
9495 CALL_MatrixFrustumEXT(ctx->Exec, (matrixMode, left, right, bottom, top, nearval, farval));
9496 }
9497 }
9498
9499 static void GLAPIENTRY
9500 save_MatrixPushEXT(GLenum matrixMode)
9501 {
9502 GET_CURRENT_CONTEXT(ctx);
9503 Node* n;
9504 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9505 n = alloc_instruction(ctx, OPCODE_MATRIX_PUSH, 1);
9506 if (n) {
9507 n[1].e = matrixMode;
9508 }
9509 if (ctx->ExecuteFlag) {
9510 CALL_MatrixPushEXT(ctx->Exec, (matrixMode));
9511 }
9512 }
9513
9514 static void GLAPIENTRY
9515 save_MatrixPopEXT(GLenum matrixMode)
9516 {
9517 GET_CURRENT_CONTEXT(ctx);
9518 Node* n;
9519 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9520 n = alloc_instruction(ctx, OPCODE_MATRIX_POP, 1);
9521 if (n) {
9522 n[1].e = matrixMode;
9523 }
9524 if (ctx->ExecuteFlag) {
9525 CALL_MatrixPopEXT(ctx->Exec, (matrixMode));
9526 }
9527 }
9528
9529 static void GLAPIENTRY
9530 save_MatrixLoadTransposefEXT(GLenum matrixMode, const GLfloat m[16])
9531 {
9532 GLfloat tm[16];
9533 _math_transposef(tm, m);
9534 save_MatrixLoadfEXT(matrixMode, tm);
9535 }
9536
9537 static void GLAPIENTRY
9538 save_MatrixLoadTransposedEXT(GLenum matrixMode, const GLdouble m[16])
9539 {
9540 GLfloat tm[16];
9541 _math_transposefd(tm, m);
9542 save_MatrixLoadfEXT(matrixMode, tm);
9543 }
9544
9545 static void GLAPIENTRY
9546 save_MatrixMultTransposefEXT(GLenum matrixMode, const GLfloat m[16])
9547 {
9548 GLfloat tm[16];
9549 _math_transposef(tm, m);
9550 save_MatrixMultfEXT(matrixMode, tm);
9551 }
9552
9553 static void GLAPIENTRY
9554 save_MatrixMultTransposedEXT(GLenum matrixMode, const GLdouble m[16])
9555 {
9556 GLfloat tm[16];
9557 _math_transposefd(tm, m);
9558 save_MatrixMultfEXT(matrixMode, tm);
9559 }
9560
9561 static void GLAPIENTRY
9562 save_TextureParameterfvEXT(GLuint texture, GLenum target, GLenum pname,
9563 const GLfloat *params)
9564 {
9565 GET_CURRENT_CONTEXT(ctx);
9566 Node *n;
9567 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9568 n = alloc_instruction(ctx, OPCODE_TEXTUREPARAMETER_F, 7);
9569 if (n) {
9570 n[1].ui = texture;
9571 n[2].e = target;
9572 n[3].e = pname;
9573 n[4].f = params[0];
9574 n[5].f = params[1];
9575 n[6].f = params[2];
9576 n[7].f = params[3];
9577 }
9578 if (ctx->ExecuteFlag) {
9579 CALL_TextureParameterfvEXT(ctx->Exec, (texture, target, pname, params));
9580 }
9581 }
9582
9583
9584 static void GLAPIENTRY
9585 save_TextureParameterfEXT(GLuint texture, GLenum target, GLenum pname, GLfloat param)
9586 {
9587 GLfloat parray[4];
9588 parray[0] = param;
9589 parray[1] = parray[2] = parray[3] = 0.0F;
9590 save_TextureParameterfvEXT(texture, target, pname, parray);
9591 }
9592
9593 static void GLAPIENTRY
9594 save_TextureParameterivEXT(GLuint texture, GLenum target, GLenum pname, const GLint *params)
9595 {
9596 GET_CURRENT_CONTEXT(ctx);
9597 Node *n;
9598 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9599 n = alloc_instruction(ctx, OPCODE_TEXTUREPARAMETER_I, 7);
9600 if (n) {
9601 n[1].ui = texture;
9602 n[2].e = target;
9603 n[3].e = pname;
9604 n[4].i = params[0];
9605 n[5].i = params[1];
9606 n[6].i = params[2];
9607 n[7].i = params[3];
9608 }
9609 if (ctx->ExecuteFlag) {
9610 CALL_TextureParameterivEXT(ctx->Exec, (texture, target, pname, params));
9611 }
9612 }
9613
9614 static void GLAPIENTRY
9615 save_TextureParameteriEXT(GLuint texture, GLenum target, GLenum pname, GLint param)
9616 {
9617 GLint fparam[4];
9618 fparam[0] = param;
9619 fparam[1] = fparam[2] = fparam[3] = 0;
9620 save_TextureParameterivEXT(texture, target, pname, fparam);
9621 }
9622
9623 static void GLAPIENTRY
9624 save_TextureParameterIivEXT(GLuint texture, GLenum target, GLenum pname, const GLint* params)
9625 {
9626 GET_CURRENT_CONTEXT(ctx);
9627 Node *n;
9628 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9629 n = alloc_instruction(ctx, OPCODE_TEXTUREPARAMETER_II, 7);
9630 if (n) {
9631 n[1].ui = texture;
9632 n[2].e = target;
9633 n[3].e = pname;
9634 n[4].i = params[0];
9635 n[5].i = params[1];
9636 n[6].i = params[2];
9637 n[7].i = params[3];
9638 }
9639 if (ctx->ExecuteFlag) {
9640 CALL_TextureParameterIivEXT(ctx->Exec, (texture, target, pname, params));
9641 }
9642 }
9643
9644 static void GLAPIENTRY
9645 save_TextureParameterIuivEXT(GLuint texture, GLenum target, GLenum pname, const GLuint* params)
9646 {
9647 GET_CURRENT_CONTEXT(ctx);
9648 Node *n;
9649 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9650 n = alloc_instruction(ctx, OPCODE_TEXTUREPARAMETER_IUI, 7);
9651 if (n) {
9652 n[1].ui = texture;
9653 n[2].e = target;
9654 n[3].e = pname;
9655 n[4].ui = params[0];
9656 n[5].ui = params[1];
9657 n[6].ui = params[2];
9658 n[7].ui = params[3];
9659 }
9660 if (ctx->ExecuteFlag) {
9661 CALL_TextureParameterIuivEXT(ctx->Exec, (texture, target, pname, params));
9662 }
9663 }
9664
9665
9666 static void GLAPIENTRY
9667 save_TextureImage1DEXT(GLuint texture, GLenum target,
9668 GLint level, GLint components,
9669 GLsizei width, GLint border,
9670 GLenum format, GLenum type, const GLvoid * pixels)
9671 {
9672 GET_CURRENT_CONTEXT(ctx);
9673 if (target == GL_PROXY_TEXTURE_1D) {
9674 /* don't compile, execute immediately */
9675 CALL_TextureImage1DEXT(ctx->Exec, (texture, target, level, components, width,
9676 border, format, type, pixels));
9677 }
9678 else {
9679 Node *n;
9680 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9681 n = alloc_instruction(ctx, OPCODE_TEXTURE_IMAGE1D, 8 + POINTER_DWORDS);
9682 if (n) {
9683 n[1].ui = texture;
9684 n[2].e = target;
9685 n[3].i = level;
9686 n[4].i = components;
9687 n[5].i = (GLint) width;
9688 n[6].i = border;
9689 n[7].e = format;
9690 n[8].e = type;
9691 save_pointer(&n[9],
9692 unpack_image(ctx, 1, width, 1, 1, format, type,
9693 pixels, &ctx->Unpack));
9694 }
9695 if (ctx->ExecuteFlag) {
9696 CALL_TextureImage1DEXT(ctx->Exec, (texture, target, level, components, width,
9697 border, format, type, pixels));
9698 }
9699 }
9700 }
9701
9702
9703 static void GLAPIENTRY
9704 save_TextureImage2DEXT(GLuint texture, GLenum target,
9705 GLint level, GLint components,
9706 GLsizei width, GLsizei height, GLint border,
9707 GLenum format, GLenum type, const GLvoid * pixels)
9708 {
9709 GET_CURRENT_CONTEXT(ctx);
9710 if (target == GL_PROXY_TEXTURE_2D) {
9711 /* don't compile, execute immediately */
9712 CALL_TextureImage2DEXT(ctx->Exec, (texture, target, level, components, width,
9713 height, border, format, type, pixels));
9714 }
9715 else {
9716 Node *n;
9717 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9718 n = alloc_instruction(ctx, OPCODE_TEXTURE_IMAGE2D, 9 + POINTER_DWORDS);
9719 if (n) {
9720 n[1].ui = texture;
9721 n[2].e = target;
9722 n[3].i = level;
9723 n[4].i = components;
9724 n[5].i = (GLint) width;
9725 n[6].i = (GLint) height;
9726 n[7].i = border;
9727 n[8].e = format;
9728 n[9].e = type;
9729 save_pointer(&n[10],
9730 unpack_image(ctx, 2, width, height, 1, format, type,
9731 pixels, &ctx->Unpack));
9732 }
9733 if (ctx->ExecuteFlag) {
9734 CALL_TextureImage2DEXT(ctx->Exec, (texture, target, level, components, width,
9735 height, border, format, type, pixels));
9736 }
9737 }
9738 }
9739
9740
9741 static void GLAPIENTRY
9742 save_TextureImage3DEXT(GLuint texture, GLenum target,
9743 GLint level, GLint internalFormat,
9744 GLsizei width, GLsizei height, GLsizei depth,
9745 GLint border,
9746 GLenum format, GLenum type, const GLvoid * pixels)
9747 {
9748 GET_CURRENT_CONTEXT(ctx);
9749 if (target == GL_PROXY_TEXTURE_3D) {
9750 /* don't compile, execute immediately */
9751 CALL_TextureImage3DEXT(ctx->Exec, (texture, target, level, internalFormat, width,
9752 height, depth, border, format, type,
9753 pixels));
9754 }
9755 else {
9756 Node *n;
9757 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9758 n = alloc_instruction(ctx, OPCODE_TEXTURE_IMAGE3D, 10 + POINTER_DWORDS);
9759 if (n) {
9760 n[1].ui = texture;
9761 n[2].e = target;
9762 n[3].i = level;
9763 n[4].i = (GLint) internalFormat;
9764 n[5].i = (GLint) width;
9765 n[6].i = (GLint) height;
9766 n[7].i = (GLint) depth;
9767 n[8].i = border;
9768 n[9].e = format;
9769 n[10].e = type;
9770 save_pointer(&n[11],
9771 unpack_image(ctx, 3, width, height, depth, format, type,
9772 pixels, &ctx->Unpack));
9773 }
9774 if (ctx->ExecuteFlag) {
9775 CALL_TextureImage3DEXT(ctx->Exec, (texture, target, level, internalFormat,
9776 width, height, depth, border, format,
9777 type, pixels));
9778 }
9779 }
9780 }
9781
9782
9783 static void GLAPIENTRY
9784 save_TextureSubImage1DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset,
9785 GLsizei width, GLenum format, GLenum type,
9786 const GLvoid * pixels)
9787 {
9788 GET_CURRENT_CONTEXT(ctx);
9789 Node *n;
9790
9791 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9792
9793 n = alloc_instruction(ctx, OPCODE_TEXTURE_SUB_IMAGE1D, 7 + POINTER_DWORDS);
9794 if (n) {
9795 n[1].ui = texture;
9796 n[2].e = target;
9797 n[3].i = level;
9798 n[4].i = xoffset;
9799 n[5].i = (GLint) width;
9800 n[6].e = format;
9801 n[7].e = type;
9802 save_pointer(&n[8],
9803 unpack_image(ctx, 1, width, 1, 1, format, type,
9804 pixels, &ctx->Unpack));
9805 }
9806 if (ctx->ExecuteFlag) {
9807 CALL_TextureSubImage1DEXT(ctx->Exec, (texture, target, level, xoffset, width,
9808 format, type, pixels));
9809 }
9810 }
9811
9812
9813 static void GLAPIENTRY
9814 save_TextureSubImage2DEXT(GLuint texture, GLenum target, GLint level,
9815 GLint xoffset, GLint yoffset,
9816 GLsizei width, GLsizei height,
9817 GLenum format, GLenum type, const GLvoid * pixels)
9818 {
9819 GET_CURRENT_CONTEXT(ctx);
9820 Node *n;
9821
9822 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9823
9824 n = alloc_instruction(ctx, OPCODE_TEXTURE_SUB_IMAGE2D, 9 + POINTER_DWORDS);
9825 if (n) {
9826 n[1].ui = texture;
9827 n[2].e = target;
9828 n[3].i = level;
9829 n[4].i = xoffset;
9830 n[5].i = yoffset;
9831 n[6].i = (GLint) width;
9832 n[7].i = (GLint) height;
9833 n[8].e = format;
9834 n[9].e = type;
9835 save_pointer(&n[10],
9836 unpack_image(ctx, 2, width, height, 1, format, type,
9837 pixels, &ctx->Unpack));
9838 }
9839 if (ctx->ExecuteFlag) {
9840 CALL_TextureSubImage2DEXT(ctx->Exec, (texture, target, level, xoffset, yoffset,
9841 width, height, format, type, pixels));
9842 }
9843 }
9844
9845
9846 static void GLAPIENTRY
9847 save_TextureSubImage3DEXT(GLuint texture, GLenum target, GLint level,
9848 GLint xoffset, GLint yoffset, GLint zoffset,
9849 GLsizei width, GLsizei height, GLsizei depth,
9850 GLenum format, GLenum type, const GLvoid * pixels)
9851 {
9852 GET_CURRENT_CONTEXT(ctx);
9853 Node *n;
9854
9855 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9856
9857 n = alloc_instruction(ctx, OPCODE_TEXTURE_SUB_IMAGE3D, 11 + POINTER_DWORDS);
9858 if (n) {
9859 n[1].ui = texture;
9860 n[2].e = target;
9861 n[3].i = level;
9862 n[4].i = xoffset;
9863 n[5].i = yoffset;
9864 n[6].i = zoffset;
9865 n[7].i = (GLint) width;
9866 n[8].i = (GLint) height;
9867 n[9].i = (GLint) depth;
9868 n[10].e = format;
9869 n[11].e = type;
9870 save_pointer(&n[12],
9871 unpack_image(ctx, 3, width, height, depth, format, type,
9872 pixels, &ctx->Unpack));
9873 }
9874 if (ctx->ExecuteFlag) {
9875 CALL_TextureSubImage3DEXT(ctx->Exec, (texture, target, level,
9876 xoffset, yoffset, zoffset,
9877 width, height, depth, format, type,
9878 pixels));
9879 }
9880 }
9881
9882 static void GLAPIENTRY
9883 save_CopyTextureImage1DEXT(GLuint texture, GLenum target, GLint level,
9884 GLenum internalformat, GLint x, GLint y,
9885 GLsizei width, GLint border)
9886 {
9887 GET_CURRENT_CONTEXT(ctx);
9888 Node *n;
9889 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9890 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_IMAGE1D, 8);
9891 if (n) {
9892 n[1].ui = texture;
9893 n[2].e = target;
9894 n[3].i = level;
9895 n[4].e = internalformat;
9896 n[5].i = x;
9897 n[6].i = y;
9898 n[7].i = width;
9899 n[8].i = border;
9900 }
9901 if (ctx->ExecuteFlag) {
9902 CALL_CopyTextureImage1DEXT(ctx->Exec, (texture, target, level,
9903 internalformat, x, y,
9904 width, border));
9905 }
9906 }
9907
9908 static void GLAPIENTRY
9909 save_CopyTextureImage2DEXT(GLuint texture, GLenum target, GLint level,
9910 GLenum internalformat,
9911 GLint x, GLint y, GLsizei width,
9912 GLsizei height, GLint border)
9913 {
9914 GET_CURRENT_CONTEXT(ctx);
9915 Node *n;
9916 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9917 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_IMAGE2D, 9);
9918 if (n) {
9919 n[1].ui = texture;
9920 n[2].e = target;
9921 n[3].i = level;
9922 n[4].e = internalformat;
9923 n[5].i = x;
9924 n[6].i = y;
9925 n[7].i = width;
9926 n[8].i = height;
9927 n[9].i = border;
9928 }
9929 if (ctx->ExecuteFlag) {
9930 CALL_CopyTextureImage2DEXT(ctx->Exec, (texture, target, level,
9931 internalformat, x, y,
9932 width, height, border));
9933 }
9934 }
9935
9936 static void GLAPIENTRY
9937 save_CopyTextureSubImage1DEXT(GLuint texture, GLenum target, GLint level,
9938 GLint xoffset, GLint x, GLint y, GLsizei width)
9939 {
9940 GET_CURRENT_CONTEXT(ctx);
9941 Node *n;
9942 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9943 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_SUB_IMAGE1D, 7);
9944 if (n) {
9945 n[1].ui = texture;
9946 n[2].e = target;
9947 n[3].i = level;
9948 n[4].i = xoffset;
9949 n[5].i = x;
9950 n[6].i = y;
9951 n[7].i = width;
9952 }
9953 if (ctx->ExecuteFlag) {
9954 CALL_CopyTextureSubImage1DEXT(ctx->Exec,
9955 (texture, target, level, xoffset, x, y, width));
9956 }
9957 }
9958
9959 static void GLAPIENTRY
9960 save_CopyTextureSubImage2DEXT(GLuint texture, GLenum target, GLint level,
9961 GLint xoffset, GLint yoffset,
9962 GLint x, GLint y, GLsizei width, GLint height)
9963 {
9964 GET_CURRENT_CONTEXT(ctx);
9965 Node *n;
9966 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9967 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_SUB_IMAGE2D, 9);
9968 if (n) {
9969 n[1].ui = texture;
9970 n[2].e = target;
9971 n[3].i = level;
9972 n[4].i = xoffset;
9973 n[5].i = yoffset;
9974 n[6].i = x;
9975 n[7].i = y;
9976 n[8].i = width;
9977 n[9].i = height;
9978 }
9979 if (ctx->ExecuteFlag) {
9980 CALL_CopyTextureSubImage2DEXT(ctx->Exec, (texture, target, level,
9981 xoffset, yoffset,
9982 x, y, width, height));
9983 }
9984 }
9985
9986
9987 static void GLAPIENTRY
9988 save_CopyTextureSubImage3DEXT(GLuint texture, GLenum target, GLint level,
9989 GLint xoffset, GLint yoffset, GLint zoffset,
9990 GLint x, GLint y, GLsizei width, GLint height)
9991 {
9992 GET_CURRENT_CONTEXT(ctx);
9993 Node *n;
9994 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9995 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_SUB_IMAGE3D, 10);
9996 if (n) {
9997 n[1].ui = texture;
9998 n[2].e = target;
9999 n[3].i = level;
10000 n[4].i = xoffset;
10001 n[5].i = yoffset;
10002 n[6].i = zoffset;
10003 n[7].i = x;
10004 n[8].i = y;
10005 n[9].i = width;
10006 n[10].i = height;
10007 }
10008 if (ctx->ExecuteFlag) {
10009 CALL_CopyTextureSubImage3DEXT(ctx->Exec, (texture, target, level,
10010 xoffset, yoffset, zoffset,
10011 x, y, width, height));
10012 }
10013 }
10014
10015
10016 static void GLAPIENTRY
10017 save_BindMultiTextureEXT(GLenum texunit, GLenum target, GLuint texture)
10018 {
10019 GET_CURRENT_CONTEXT(ctx);
10020 Node *n;
10021 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10022 n = alloc_instruction(ctx, OPCODE_BIND_MULTITEXTURE, 3);
10023 if (n) {
10024 n[1].e = texunit;
10025 n[2].e = target;
10026 n[3].ui = texture;
10027 }
10028 if (ctx->ExecuteFlag) {
10029 CALL_BindMultiTextureEXT(ctx->Exec, (texunit, target, texture));
10030 }
10031 }
10032
10033
10034 static void GLAPIENTRY
10035 save_MultiTexParameterfvEXT(GLenum texunit, GLenum target, GLenum pname,
10036 const GLfloat *params)
10037 {
10038 GET_CURRENT_CONTEXT(ctx);
10039 Node *n;
10040 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10041 n = alloc_instruction(ctx, OPCODE_MULTITEXPARAMETER_F, 7);
10042 if (n) {
10043 n[1].e = texunit;
10044 n[2].e = target;
10045 n[3].e = pname;
10046 n[4].f = params[0];
10047 n[5].f = params[1];
10048 n[6].f = params[2];
10049 n[7].f = params[3];
10050 }
10051 if (ctx->ExecuteFlag) {
10052 CALL_MultiTexParameterfvEXT(ctx->Exec, (texunit, target, pname, params));
10053 }
10054 }
10055
10056
10057 static void GLAPIENTRY
10058 save_MultiTexParameterfEXT(GLenum texunit, GLenum target, GLenum pname, GLfloat param)
10059 {
10060 GLfloat parray[4];
10061 parray[0] = param;
10062 parray[1] = parray[2] = parray[3] = 0.0F;
10063 save_MultiTexParameterfvEXT(texunit, target, pname, parray);
10064 }
10065
10066 static void GLAPIENTRY
10067 save_MultiTexParameterivEXT(GLenum texunit, GLenum target, GLenum pname, const GLint *params)
10068 {
10069 GET_CURRENT_CONTEXT(ctx);
10070 Node *n;
10071 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10072 n = alloc_instruction(ctx, OPCODE_MULTITEXPARAMETER_I, 7);
10073 if (n) {
10074 n[1].e = texunit;
10075 n[2].e = target;
10076 n[3].e = pname;
10077 n[4].i = params[0];
10078 n[5].i = params[1];
10079 n[6].i = params[2];
10080 n[7].i = params[3];
10081 }
10082 if (ctx->ExecuteFlag) {
10083 CALL_MultiTexParameterivEXT(ctx->Exec, (texunit, target, pname, params));
10084 }
10085 }
10086
10087 static void GLAPIENTRY
10088 save_MultiTexParameterIivEXT(GLenum texunit, GLenum target, GLenum pname, const GLint *params)
10089 {
10090 GET_CURRENT_CONTEXT(ctx);
10091 Node *n;
10092 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10093 n = alloc_instruction(ctx, OPCODE_MULTITEXPARAMETER_II, 7);
10094 if (n) {
10095 n[1].e = texunit;
10096 n[2].e = target;
10097 n[3].e = pname;
10098 n[4].i = params[0];
10099 n[5].i = params[1];
10100 n[6].i = params[2];
10101 n[7].i = params[3];
10102 }
10103 if (ctx->ExecuteFlag) {
10104 CALL_MultiTexParameterIivEXT(ctx->Exec, (texunit, target, pname, params));
10105 }
10106 }
10107
10108 static void GLAPIENTRY
10109 save_MultiTexParameterIuivEXT(GLenum texunit, GLenum target, GLenum pname, const GLuint *params)
10110 {
10111 GET_CURRENT_CONTEXT(ctx);
10112 Node *n;
10113 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10114 n = alloc_instruction(ctx, OPCODE_MULTITEXPARAMETER_IUI, 7);
10115 if (n) {
10116 n[1].e = texunit;
10117 n[2].e = target;
10118 n[3].e = pname;
10119 n[4].ui = params[0];
10120 n[5].ui = params[1];
10121 n[6].ui = params[2];
10122 n[7].ui = params[3];
10123 }
10124 if (ctx->ExecuteFlag) {
10125 CALL_MultiTexParameterIuivEXT(ctx->Exec, (texunit, target, pname, params));
10126 }
10127 }
10128
10129 static void GLAPIENTRY
10130 save_MultiTexParameteriEXT(GLenum texunit, GLenum target, GLenum pname, GLint param)
10131 {
10132 GLint fparam[4];
10133 fparam[0] = param;
10134 fparam[1] = fparam[2] = fparam[3] = 0;
10135 save_MultiTexParameterivEXT(texunit, target, pname, fparam);
10136 }
10137
10138
10139 static void GLAPIENTRY
10140 save_MultiTexImage1DEXT(GLenum texunit, GLenum target,
10141 GLint level, GLint components,
10142 GLsizei width, GLint border,
10143 GLenum format, GLenum type, const GLvoid * pixels)
10144 {
10145 GET_CURRENT_CONTEXT(ctx);
10146 if (target == GL_PROXY_TEXTURE_1D) {
10147 /* don't compile, execute immediately */
10148 CALL_MultiTexImage1DEXT(ctx->Exec, (texunit, target, level, components, width,
10149 border, format, type, pixels));
10150 }
10151 else {
10152 Node *n;
10153 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10154 n = alloc_instruction(ctx, OPCODE_MULTITEX_IMAGE1D, 8 + POINTER_DWORDS);
10155 if (n) {
10156 n[1].e = texunit;
10157 n[2].e = target;
10158 n[3].i = level;
10159 n[4].i = components;
10160 n[5].i = (GLint) width;
10161 n[6].i = border;
10162 n[7].e = format;
10163 n[8].e = type;
10164 save_pointer(&n[9],
10165 unpack_image(ctx, 1, width, 1, 1, format, type,
10166 pixels, &ctx->Unpack));
10167 }
10168 if (ctx->ExecuteFlag) {
10169 CALL_MultiTexImage1DEXT(ctx->Exec, (texunit, target, level, components, width,
10170 border, format, type, pixels));
10171 }
10172 }
10173 }
10174
10175
10176 static void GLAPIENTRY
10177 save_MultiTexImage2DEXT(GLenum texunit, GLenum target,
10178 GLint level, GLint components,
10179 GLsizei width, GLsizei height, GLint border,
10180 GLenum format, GLenum type, const GLvoid * pixels)
10181 {
10182 GET_CURRENT_CONTEXT(ctx);
10183 if (target == GL_PROXY_TEXTURE_2D) {
10184 /* don't compile, execute immediately */
10185 CALL_MultiTexImage2DEXT(ctx->Exec, (texunit, target, level, components, width,
10186 height, border, format, type, pixels));
10187 }
10188 else {
10189 Node *n;
10190 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10191 n = alloc_instruction(ctx, OPCODE_MULTITEX_IMAGE2D, 9 + POINTER_DWORDS);
10192 if (n) {
10193 n[1].e = texunit;
10194 n[2].e = target;
10195 n[3].i = level;
10196 n[4].i = components;
10197 n[5].i = (GLint) width;
10198 n[6].i = (GLint) height;
10199 n[7].i = border;
10200 n[8].e = format;
10201 n[9].e = type;
10202 save_pointer(&n[10],
10203 unpack_image(ctx, 2, width, height, 1, format, type,
10204 pixels, &ctx->Unpack));
10205 }
10206 if (ctx->ExecuteFlag) {
10207 CALL_MultiTexImage2DEXT(ctx->Exec, (texunit, target, level, components, width,
10208 height, border, format, type, pixels));
10209 }
10210 }
10211 }
10212
10213
10214 static void GLAPIENTRY
10215 save_MultiTexImage3DEXT(GLenum texunit, GLenum target,
10216 GLint level, GLint internalFormat,
10217 GLsizei width, GLsizei height, GLsizei depth,
10218 GLint border,
10219 GLenum format, GLenum type, const GLvoid * pixels)
10220 {
10221 GET_CURRENT_CONTEXT(ctx);
10222 if (target == GL_PROXY_TEXTURE_3D) {
10223 /* don't compile, execute immediately */
10224 CALL_MultiTexImage3DEXT(ctx->Exec, (texunit, target, level, internalFormat, width,
10225 height, depth, border, format, type,
10226 pixels));
10227 }
10228 else {
10229 Node *n;
10230 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10231 n = alloc_instruction(ctx, OPCODE_MULTITEX_IMAGE3D, 10 + POINTER_DWORDS);
10232 if (n) {
10233 n[1].e = texunit;
10234 n[2].e = target;
10235 n[3].i = level;
10236 n[4].i = (GLint) internalFormat;
10237 n[5].i = (GLint) width;
10238 n[6].i = (GLint) height;
10239 n[7].i = (GLint) depth;
10240 n[8].i = border;
10241 n[9].e = format;
10242 n[10].e = type;
10243 save_pointer(&n[11],
10244 unpack_image(ctx, 3, width, height, depth, format, type,
10245 pixels, &ctx->Unpack));
10246 }
10247 if (ctx->ExecuteFlag) {
10248 CALL_MultiTexImage3DEXT(ctx->Exec, (texunit, target, level, internalFormat,
10249 width, height, depth, border, format,
10250 type, pixels));
10251 }
10252 }
10253 }
10254
10255
10256 static void GLAPIENTRY
10257 save_MultiTexSubImage1DEXT(GLenum texunit, GLenum target, GLint level, GLint xoffset,
10258 GLsizei width, GLenum format, GLenum type,
10259 const GLvoid * pixels)
10260 {
10261 GET_CURRENT_CONTEXT(ctx);
10262 Node *n;
10263
10264 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10265
10266 n = alloc_instruction(ctx, OPCODE_MULTITEX_SUB_IMAGE1D, 7 + POINTER_DWORDS);
10267 if (n) {
10268 n[1].e = texunit;
10269 n[2].e = target;
10270 n[3].i = level;
10271 n[4].i = xoffset;
10272 n[5].i = (GLint) width;
10273 n[6].e = format;
10274 n[7].e = type;
10275 save_pointer(&n[8],
10276 unpack_image(ctx, 1, width, 1, 1, format, type,
10277 pixels, &ctx->Unpack));
10278 }
10279 if (ctx->ExecuteFlag) {
10280 CALL_MultiTexSubImage1DEXT(ctx->Exec, (texunit, target, level, xoffset, width,
10281 format, type, pixels));
10282 }
10283 }
10284
10285
10286 static void GLAPIENTRY
10287 save_MultiTexSubImage2DEXT(GLenum texunit, GLenum target, GLint level,
10288 GLint xoffset, GLint yoffset,
10289 GLsizei width, GLsizei height,
10290 GLenum format, GLenum type, const GLvoid * pixels)
10291 {
10292 GET_CURRENT_CONTEXT(ctx);
10293 Node *n;
10294
10295 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10296
10297 n = alloc_instruction(ctx, OPCODE_MULTITEX_SUB_IMAGE2D, 9 + POINTER_DWORDS);
10298 if (n) {
10299 n[1].e = texunit;
10300 n[2].e = target;
10301 n[3].i = level;
10302 n[4].i = xoffset;
10303 n[5].i = yoffset;
10304 n[6].i = (GLint) width;
10305 n[7].i = (GLint) height;
10306 n[8].e = format;
10307 n[9].e = type;
10308 save_pointer(&n[10],
10309 unpack_image(ctx, 2, width, height, 1, format, type,
10310 pixels, &ctx->Unpack));
10311 }
10312 if (ctx->ExecuteFlag) {
10313 CALL_MultiTexSubImage2DEXT(ctx->Exec, (texunit, target, level, xoffset, yoffset,
10314 width, height, format, type, pixels));
10315 }
10316 }
10317
10318
10319 static void GLAPIENTRY
10320 save_MultiTexSubImage3DEXT(GLenum texunit, GLenum target, GLint level,
10321 GLint xoffset, GLint yoffset, GLint zoffset,
10322 GLsizei width, GLsizei height, GLsizei depth,
10323 GLenum format, GLenum type, const GLvoid * pixels)
10324 {
10325 GET_CURRENT_CONTEXT(ctx);
10326 Node *n;
10327
10328 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10329
10330 n = alloc_instruction(ctx, OPCODE_MULTITEX_SUB_IMAGE3D, 11 + POINTER_DWORDS);
10331 if (n) {
10332 n[1].e = texunit;
10333 n[2].e = target;
10334 n[3].i = level;
10335 n[4].i = xoffset;
10336 n[5].i = yoffset;
10337 n[6].i = zoffset;
10338 n[7].i = (GLint) width;
10339 n[8].i = (GLint) height;
10340 n[9].i = (GLint) depth;
10341 n[10].e = format;
10342 n[11].e = type;
10343 save_pointer(&n[12],
10344 unpack_image(ctx, 3, width, height, depth, format, type,
10345 pixels, &ctx->Unpack));
10346 }
10347 if (ctx->ExecuteFlag) {
10348 CALL_MultiTexSubImage3DEXT(ctx->Exec, (texunit, target, level,
10349 xoffset, yoffset, zoffset,
10350 width, height, depth, format, type,
10351 pixels));
10352 }
10353 }
10354
10355
10356 static void GLAPIENTRY
10357 save_CopyMultiTexImage1DEXT(GLenum texunit, GLenum target, GLint level,
10358 GLenum internalformat, GLint x, GLint y,
10359 GLsizei width, GLint border)
10360 {
10361 GET_CURRENT_CONTEXT(ctx);
10362 Node *n;
10363 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10364 n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_IMAGE1D, 8);
10365 if (n) {
10366 n[1].e = texunit;
10367 n[2].e = target;
10368 n[3].i = level;
10369 n[4].e = internalformat;
10370 n[5].i = x;
10371 n[6].i = y;
10372 n[7].i = width;
10373 n[8].i = border;
10374 }
10375 if (ctx->ExecuteFlag) {
10376 CALL_CopyMultiTexImage1DEXT(ctx->Exec, (texunit, target, level,
10377 internalformat, x, y,
10378 width, border));
10379 }
10380 }
10381
10382
10383 static void GLAPIENTRY
10384 save_CopyMultiTexImage2DEXT(GLenum texunit, GLenum target, GLint level,
10385 GLenum internalformat,
10386 GLint x, GLint y, GLsizei width,
10387 GLsizei height, GLint border)
10388 {
10389 GET_CURRENT_CONTEXT(ctx);
10390 Node *n;
10391 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10392 n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_IMAGE2D, 9);
10393 if (n) {
10394 n[1].e = texunit;
10395 n[2].e = target;
10396 n[3].i = level;
10397 n[4].e = internalformat;
10398 n[5].i = x;
10399 n[6].i = y;
10400 n[7].i = width;
10401 n[8].i = height;
10402 n[9].i = border;
10403 }
10404 if (ctx->ExecuteFlag) {
10405 CALL_CopyMultiTexImage2DEXT(ctx->Exec, (texunit, target, level,
10406 internalformat, x, y,
10407 width, height, border));
10408 }
10409 }
10410
10411
10412 static void GLAPIENTRY
10413 save_CopyMultiTexSubImage1DEXT(GLenum texunit, GLenum target, GLint level,
10414 GLint xoffset, GLint x, GLint y, GLsizei width)
10415 {
10416 GET_CURRENT_CONTEXT(ctx);
10417 Node *n;
10418 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10419 n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_SUB_IMAGE1D, 7);
10420 if (n) {
10421 n[1].e = texunit;
10422 n[2].e = target;
10423 n[3].i = level;
10424 n[4].i = xoffset;
10425 n[5].i = x;
10426 n[6].i = y;
10427 n[7].i = width;
10428 }
10429 if (ctx->ExecuteFlag) {
10430 CALL_CopyMultiTexSubImage1DEXT(ctx->Exec,
10431 (texunit, target, level, xoffset, x, y, width));
10432 }
10433 }
10434
10435
10436 static void GLAPIENTRY
10437 save_CopyMultiTexSubImage2DEXT(GLenum texunit, GLenum target, GLint level,
10438 GLint xoffset, GLint yoffset,
10439 GLint x, GLint y, GLsizei width, GLint height)
10440 {
10441 GET_CURRENT_CONTEXT(ctx);
10442 Node *n;
10443 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10444 n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_SUB_IMAGE2D, 9);
10445 if (n) {
10446 n[1].e = texunit;
10447 n[2].e = target;
10448 n[3].i = level;
10449 n[4].i = xoffset;
10450 n[5].i = yoffset;
10451 n[6].i = x;
10452 n[7].i = y;
10453 n[8].i = width;
10454 n[9].i = height;
10455 }
10456 if (ctx->ExecuteFlag) {
10457 CALL_CopyMultiTexSubImage2DEXT(ctx->Exec, (texunit, target, level,
10458 xoffset, yoffset,
10459 x, y, width, height));
10460 }
10461 }
10462
10463
10464 static void GLAPIENTRY
10465 save_CopyMultiTexSubImage3DEXT(GLenum texunit, GLenum target, GLint level,
10466 GLint xoffset, GLint yoffset, GLint zoffset,
10467 GLint x, GLint y, GLsizei width, GLint height)
10468 {
10469 GET_CURRENT_CONTEXT(ctx);
10470 Node *n;
10471 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10472 n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_SUB_IMAGE3D, 10);
10473 if (n) {
10474 n[1].e = texunit;
10475 n[2].e = target;
10476 n[3].i = level;
10477 n[4].i = xoffset;
10478 n[5].i = yoffset;
10479 n[6].i = zoffset;
10480 n[7].i = x;
10481 n[8].i = y;
10482 n[9].i = width;
10483 n[10].i = height;
10484 }
10485 if (ctx->ExecuteFlag) {
10486 CALL_CopyMultiTexSubImage3DEXT(ctx->Exec, (texunit, target, level,
10487 xoffset, yoffset, zoffset,
10488 x, y, width, height));
10489 }
10490 }
10491
10492
10493 static void GLAPIENTRY
10494 save_MultiTexEnvfvEXT(GLenum texunit, GLenum target, GLenum pname, const GLfloat *params)
10495 {
10496 GET_CURRENT_CONTEXT(ctx);
10497 Node *n;
10498 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10499 n = alloc_instruction(ctx, OPCODE_MULTITEXENV, 7);
10500 if (n) {
10501 n[1].e = texunit;
10502 n[2].e = target;
10503 n[3].e = pname;
10504 if (pname == GL_TEXTURE_ENV_COLOR) {
10505 n[4].f = params[0];
10506 n[5].f = params[1];
10507 n[6].f = params[2];
10508 n[7].f = params[3];
10509 }
10510 else {
10511 n[4].f = params[0];
10512 n[5].f = n[6].f = n[7].f = 0.0F;
10513 }
10514 }
10515 if (ctx->ExecuteFlag) {
10516 CALL_MultiTexEnvfvEXT(ctx->Exec, (texunit, target, pname, params));
10517 }
10518 }
10519
10520
10521 static void GLAPIENTRY
10522 save_MultiTexEnvfEXT(GLenum texunit, GLenum target, GLenum pname, GLfloat param)
10523 {
10524 GLfloat parray[4];
10525 parray[0] = (GLfloat) param;
10526 parray[1] = parray[2] = parray[3] = 0.0F;
10527 save_MultiTexEnvfvEXT(texunit, target, pname, parray);
10528 }
10529
10530
10531 static void GLAPIENTRY
10532 save_MultiTexEnviEXT(GLenum texunit, GLenum target, GLenum pname, GLint param)
10533 {
10534 GLfloat p[4];
10535 p[0] = (GLfloat) param;
10536 p[1] = p[2] = p[3] = 0.0F;
10537 save_MultiTexEnvfvEXT(texunit, target, pname, p);
10538 }
10539
10540
10541 static void GLAPIENTRY
10542 save_MultiTexEnvivEXT(GLenum texunit, GLenum target, GLenum pname, const GLint * param)
10543 {
10544 GLfloat p[4];
10545 if (pname == GL_TEXTURE_ENV_COLOR) {
10546 p[0] = INT_TO_FLOAT(param[0]);
10547 p[1] = INT_TO_FLOAT(param[1]);
10548 p[2] = INT_TO_FLOAT(param[2]);
10549 p[3] = INT_TO_FLOAT(param[3]);
10550 }
10551 else {
10552 p[0] = (GLfloat) param[0];
10553 p[1] = p[2] = p[3] = 0.0F;
10554 }
10555 save_MultiTexEnvfvEXT(texunit, target, pname, p);
10556 }
10557
10558
10559 static void GLAPIENTRY
10560 save_CompressedTextureImage1DEXT(GLuint texture, GLenum target, GLint level,
10561 GLenum internalFormat, GLsizei width,
10562 GLint border, GLsizei imageSize,
10563 const GLvoid * data)
10564 {
10565 GET_CURRENT_CONTEXT(ctx);
10566 if (target == GL_PROXY_TEXTURE_1D) {
10567 /* don't compile, execute immediately */
10568 CALL_CompressedTextureImage1DEXT(ctx->Exec, (texture, target, level,
10569 internalFormat, width,
10570 border, imageSize,
10571 data));
10572 }
10573 else {
10574 Node *n;
10575 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10576
10577 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_IMAGE_1D,
10578 7 + POINTER_DWORDS);
10579 if (n) {
10580 n[1].ui = texture;
10581 n[2].e = target;
10582 n[3].i = level;
10583 n[4].e = internalFormat;
10584 n[5].i = (GLint) width;
10585 n[6].i = border;
10586 n[7].i = imageSize;
10587 save_pointer(&n[8],
10588 copy_data(data, imageSize, "glCompressedTextureImage1DEXT"));
10589 }
10590 if (ctx->ExecuteFlag) {
10591 CALL_CompressedTextureImage1DEXT(ctx->Exec,
10592 (texture, target, level, internalFormat,
10593 width, border, imageSize, data));
10594 }
10595 }
10596 }
10597
10598
10599 static void GLAPIENTRY
10600 save_CompressedTextureImage2DEXT(GLuint texture, GLenum target, GLint level,
10601 GLenum internalFormat, GLsizei width,
10602 GLsizei height, GLint border, GLsizei imageSize,
10603 const GLvoid * data)
10604 {
10605 GET_CURRENT_CONTEXT(ctx);
10606 if (target == GL_PROXY_TEXTURE_2D) {
10607 /* don't compile, execute immediately */
10608 CALL_CompressedTextureImage2DEXT(ctx->Exec, (texture, target, level,
10609 internalFormat, width, height,
10610 border, imageSize, data));
10611 }
10612 else {
10613 Node *n;
10614 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10615
10616 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_IMAGE_2D,
10617 8 + POINTER_DWORDS);
10618 if (n) {
10619 n[1].ui = texture;
10620 n[2].e = target;
10621 n[3].i = level;
10622 n[4].e = internalFormat;
10623 n[5].i = (GLint) width;
10624 n[6].i = (GLint) height;
10625 n[7].i = border;
10626 n[8].i = imageSize;
10627 save_pointer(&n[9],
10628 copy_data(data, imageSize, "glCompressedTextureImage2DEXT"));
10629 }
10630 if (ctx->ExecuteFlag) {
10631 CALL_CompressedTextureImage2DEXT(ctx->Exec,
10632 (texture, target, level, internalFormat,
10633 width, height, border, imageSize, data));
10634 }
10635 }
10636 }
10637
10638
10639 static void GLAPIENTRY
10640 save_CompressedTextureImage3DEXT(GLuint texture, GLenum target, GLint level,
10641 GLenum internalFormat, GLsizei width,
10642 GLsizei height, GLsizei depth, GLint border,
10643 GLsizei imageSize, const GLvoid * data)
10644 {
10645 GET_CURRENT_CONTEXT(ctx);
10646 if (target == GL_PROXY_TEXTURE_3D) {
10647 /* don't compile, execute immediately */
10648 CALL_CompressedTextureImage3DEXT(ctx->Exec, (texture, target, level,
10649 internalFormat, width,
10650 height, depth, border,
10651 imageSize, data));
10652 }
10653 else {
10654 Node *n;
10655 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10656
10657 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_IMAGE_3D,
10658 9 + POINTER_DWORDS);
10659 if (n) {
10660 n[1].ui = texture;
10661 n[2].e = target;
10662 n[3].i = level;
10663 n[4].e = internalFormat;
10664 n[5].i = (GLint) width;
10665 n[6].i = (GLint) height;
10666 n[7].i = (GLint) depth;
10667 n[8].i = border;
10668 n[9].i = imageSize;
10669 save_pointer(&n[10],
10670 copy_data(data, imageSize, "glCompressedTextureImage3DEXT"));
10671 }
10672 if (ctx->ExecuteFlag) {
10673 CALL_CompressedTextureImage3DEXT(ctx->Exec,
10674 (texture, target, level, internalFormat,
10675 width, height, depth, border, imageSize,
10676 data));
10677 }
10678 }
10679 }
10680
10681
10682 static void GLAPIENTRY
10683 save_CompressedTextureSubImage1DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset,
10684 GLsizei width, GLenum format,
10685 GLsizei imageSize, const GLvoid * data)
10686 {
10687 Node *n;
10688 GET_CURRENT_CONTEXT(ctx);
10689 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10690
10691 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_1D,
10692 7 + POINTER_DWORDS);
10693 if (n) {
10694 n[1].ui = texture;
10695 n[2].e = target;
10696 n[3].i = level;
10697 n[4].i = xoffset;
10698 n[5].i = (GLint) width;
10699 n[6].e = format;
10700 n[7].i = imageSize;
10701 save_pointer(&n[8],
10702 copy_data(data, imageSize, "glCompressedTextureSubImage1DEXT"));
10703 }
10704 if (ctx->ExecuteFlag) {
10705 CALL_CompressedTextureSubImage1DEXT(ctx->Exec, (texture, target, level, xoffset,
10706 width, format, imageSize, data));
10707 }
10708 }
10709
10710
10711 static void GLAPIENTRY
10712 save_CompressedTextureSubImage2DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset,
10713 GLint yoffset, GLsizei width, GLsizei height,
10714 GLenum format, GLsizei imageSize,
10715 const GLvoid * data)
10716 {
10717 Node *n;
10718 GET_CURRENT_CONTEXT(ctx);
10719 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10720
10721 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_2D,
10722 9 + POINTER_DWORDS);
10723 if (n) {
10724 n[1].ui = texture;
10725 n[2].e = target;
10726 n[3].i = level;
10727 n[4].i = xoffset;
10728 n[5].i = yoffset;
10729 n[6].i = (GLint) width;
10730 n[7].i = (GLint) height;
10731 n[8].e = format;
10732 n[9].i = imageSize;
10733 save_pointer(&n[10],
10734 copy_data(data, imageSize, "glCompressedTextureSubImage2DEXT"));
10735 }
10736 if (ctx->ExecuteFlag) {
10737 CALL_CompressedTextureSubImage2DEXT(ctx->Exec,
10738 (texture, target, level, xoffset, yoffset,
10739 width, height, format, imageSize, data));
10740 }
10741 }
10742
10743
10744 static void GLAPIENTRY
10745 save_CompressedTextureSubImage3DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset,
10746 GLint yoffset, GLint zoffset, GLsizei width,
10747 GLsizei height, GLsizei depth, GLenum format,
10748 GLsizei imageSize, const GLvoid * data)
10749 {
10750 Node *n;
10751 GET_CURRENT_CONTEXT(ctx);
10752 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10753
10754 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_3D,
10755 11 + POINTER_DWORDS);
10756 if (n) {
10757 n[1].ui = texture;
10758 n[2].e = target;
10759 n[3].i = level;
10760 n[4].i = xoffset;
10761 n[5].i = yoffset;
10762 n[6].i = zoffset;
10763 n[7].i = (GLint) width;
10764 n[8].i = (GLint) height;
10765 n[9].i = (GLint) depth;
10766 n[10].e = format;
10767 n[11].i = imageSize;
10768 save_pointer(&n[12],
10769 copy_data(data, imageSize, "glCompressedTextureSubImage3DEXT"));
10770 }
10771 if (ctx->ExecuteFlag) {
10772 CALL_CompressedTextureSubImage3DEXT(ctx->Exec,
10773 (texture, target, level, xoffset, yoffset,
10774 zoffset, width, height, depth, format,
10775 imageSize, data));
10776 }
10777 }
10778
10779
10780 static void GLAPIENTRY
10781 save_CompressedMultiTexImage1DEXT(GLenum texunit, GLenum target, GLint level,
10782 GLenum internalFormat, GLsizei width,
10783 GLint border, GLsizei imageSize,
10784 const GLvoid * data)
10785 {
10786 GET_CURRENT_CONTEXT(ctx);
10787 if (target == GL_PROXY_TEXTURE_1D) {
10788 /* don't compile, execute immediately */
10789 CALL_CompressedMultiTexImage1DEXT(ctx->Exec, (texunit, target, level,
10790 internalFormat, width,
10791 border, imageSize,
10792 data));
10793 }
10794 else {
10795 Node *n;
10796 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10797
10798 n = alloc_instruction(ctx, OPCODE_COMPRESSED_MULTITEX_IMAGE_1D,
10799 7 + POINTER_DWORDS);
10800 if (n) {
10801 n[1].e = texunit;
10802 n[2].e = target;
10803 n[3].i = level;
10804 n[4].e = internalFormat;
10805 n[5].i = (GLint) width;
10806 n[6].i = border;
10807 n[7].i = imageSize;
10808 save_pointer(&n[8],
10809 copy_data(data, imageSize, "glCompressedMultiTexImage1DEXT"));
10810 }
10811 if (ctx->ExecuteFlag) {
10812 CALL_CompressedMultiTexImage1DEXT(ctx->Exec,
10813 (texunit, target, level, internalFormat,
10814 width, border, imageSize, data));
10815 }
10816 }
10817 }
10818
10819
10820 static void GLAPIENTRY
10821 save_CompressedMultiTexImage2DEXT(GLenum texunit, GLenum target, GLint level,
10822 GLenum internalFormat, GLsizei width,
10823 GLsizei height, GLint border, GLsizei imageSize,
10824 const GLvoid * data)
10825 {
10826 GET_CURRENT_CONTEXT(ctx);
10827 if (target == GL_PROXY_TEXTURE_2D) {
10828 /* don't compile, execute immediately */
10829 CALL_CompressedMultiTexImage2DEXT(ctx->Exec, (texunit, target, level,
10830 internalFormat, width, height,
10831 border, imageSize, data));
10832 }
10833 else {
10834 Node *n;
10835 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10836
10837 n = alloc_instruction(ctx, OPCODE_COMPRESSED_MULTITEX_IMAGE_2D,
10838 8 + POINTER_DWORDS);
10839 if (n) {
10840 n[1].e = texunit;
10841 n[2].e = target;
10842 n[3].i = level;
10843 n[4].e = internalFormat;
10844 n[5].i = (GLint) width;
10845 n[6].i = (GLint) height;
10846 n[7].i = border;
10847 n[8].i = imageSize;
10848 save_pointer(&n[9],
10849 copy_data(data, imageSize, "glCompressedMultiTexImage2DEXT"));
10850 }
10851 if (ctx->ExecuteFlag) {
10852 CALL_CompressedMultiTexImage2DEXT(ctx->Exec,
10853 (texunit, target, level, internalFormat,
10854 width, height, border, imageSize, data));
10855 }
10856 }
10857 }
10858
10859
10860 static void GLAPIENTRY
10861 save_CompressedMultiTexImage3DEXT(GLenum texunit, GLenum target, GLint level,
10862 GLenum internalFormat, GLsizei width,
10863 GLsizei height, GLsizei depth, GLint border,
10864 GLsizei imageSize, const GLvoid * data)
10865 {
10866 GET_CURRENT_CONTEXT(ctx);
10867 if (target == GL_PROXY_TEXTURE_3D) {
10868 /* don't compile, execute immediately */
10869 CALL_CompressedMultiTexImage3DEXT(ctx->Exec, (texunit, target, level,
10870 internalFormat, width,
10871 height, depth, border,
10872 imageSize, data));
10873 }
10874 else {
10875 Node *n;
10876 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10877
10878 n = alloc_instruction(ctx, OPCODE_COMPRESSED_MULTITEX_IMAGE_3D,
10879 9 + POINTER_DWORDS);
10880 if (n) {
10881 n[1].e = texunit;
10882 n[2].e = target;
10883 n[3].i = level;
10884 n[4].e = internalFormat;
10885 n[5].i = (GLint) width;
10886 n[6].i = (GLint) height;
10887 n[7].i = (GLint) depth;
10888 n[8].i = border;
10889 n[9].i = imageSize;
10890 save_pointer(&n[10],
10891 copy_data(data, imageSize, "glCompressedMultiTexImage3DEXT"));
10892 }
10893 if (ctx->ExecuteFlag) {
10894 CALL_CompressedMultiTexImage3DEXT(ctx->Exec,
10895 (texunit, target, level, internalFormat,
10896 width, height, depth, border, imageSize,
10897 data));
10898 }
10899 }
10900 }
10901
10902
10903 static void GLAPIENTRY
10904 save_CompressedMultiTexSubImage1DEXT(GLenum texunit, GLenum target, GLint level, GLint xoffset,
10905 GLsizei width, GLenum format,
10906 GLsizei imageSize, const GLvoid * data)
10907 {
10908 Node *n;
10909 GET_CURRENT_CONTEXT(ctx);
10910 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10911
10912 n = alloc_instruction(ctx, OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_1D,
10913 7 + POINTER_DWORDS);
10914 if (n) {
10915 n[1].e = texunit;
10916 n[2].e = target;
10917 n[3].i = level;
10918 n[4].i = xoffset;
10919 n[5].i = (GLint) width;
10920 n[6].e = format;
10921 n[7].i = imageSize;
10922 save_pointer(&n[8],
10923 copy_data(data, imageSize, "glCompressedMultiTexSubImage1DEXT"));
10924 }
10925 if (ctx->ExecuteFlag) {
10926 CALL_CompressedMultiTexSubImage1DEXT(ctx->Exec, (texunit, target, level, xoffset,
10927 width, format, imageSize, data));
10928 }
10929 }
10930
10931
10932 static void GLAPIENTRY
10933 save_CompressedMultiTexSubImage2DEXT(GLenum texunit, GLenum target, GLint level, GLint xoffset,
10934 GLint yoffset, GLsizei width, GLsizei height,
10935 GLenum format, GLsizei imageSize,
10936 const GLvoid * data)
10937 {
10938 Node *n;
10939 GET_CURRENT_CONTEXT(ctx);
10940 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10941
10942 n = alloc_instruction(ctx, OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_2D,
10943 9 + POINTER_DWORDS);
10944 if (n) {
10945 n[1].e = texunit;
10946 n[2].e = target;
10947 n[3].i = level;
10948 n[4].i = xoffset;
10949 n[5].i = yoffset;
10950 n[6].i = (GLint) width;
10951 n[7].i = (GLint) height;
10952 n[8].e = format;
10953 n[9].i = imageSize;
10954 save_pointer(&n[10],
10955 copy_data(data, imageSize, "glCompressedMultiTexSubImage2DEXT"));
10956 }
10957 if (ctx->ExecuteFlag) {
10958 CALL_CompressedMultiTexSubImage2DEXT(ctx->Exec,
10959 (texunit, target, level, xoffset, yoffset,
10960 width, height, format, imageSize, data));
10961 }
10962 }
10963
10964
10965 static void GLAPIENTRY
10966 save_CompressedMultiTexSubImage3DEXT(GLenum texunit, GLenum target, GLint level, GLint xoffset,
10967 GLint yoffset, GLint zoffset, GLsizei width,
10968 GLsizei height, GLsizei depth, GLenum format,
10969 GLsizei imageSize, const GLvoid * data)
10970 {
10971 Node *n;
10972 GET_CURRENT_CONTEXT(ctx);
10973 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10974
10975 n = alloc_instruction(ctx, OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_3D,
10976 11 + POINTER_DWORDS);
10977 if (n) {
10978 n[1].e = texunit;
10979 n[2].e = target;
10980 n[3].i = level;
10981 n[4].i = xoffset;
10982 n[5].i = yoffset;
10983 n[6].i = zoffset;
10984 n[7].i = (GLint) width;
10985 n[8].i = (GLint) height;
10986 n[9].i = (GLint) depth;
10987 n[10].e = format;
10988 n[11].i = imageSize;
10989 save_pointer(&n[12],
10990 copy_data(data, imageSize, "glCompressedMultiTexSubImage3DEXT"));
10991 }
10992 if (ctx->ExecuteFlag) {
10993 CALL_CompressedMultiTexSubImage3DEXT(ctx->Exec,
10994 (texunit, target, level, xoffset, yoffset,
10995 zoffset, width, height, depth, format,
10996 imageSize, data));
10997 }
10998 }
10999
11000
11001 static void GLAPIENTRY
11002 save_NamedProgramStringEXT(GLuint program, GLenum target, GLenum format, GLsizei len,
11003 const GLvoid * string)
11004 {
11005 GET_CURRENT_CONTEXT(ctx);
11006 Node *n;
11007
11008 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
11009
11010 n = alloc_instruction(ctx, OPCODE_NAMED_PROGRAM_STRING, 4 + POINTER_DWORDS);
11011 if (n) {
11012 GLubyte *programCopy = malloc(len);
11013 if (!programCopy) {
11014 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glNamedProgramStringEXT");
11015 return;
11016 }
11017 memcpy(programCopy, string, len);
11018 n[1].ui = program;
11019 n[2].e = target;
11020 n[3].e = format;
11021 n[4].i = len;
11022 save_pointer(&n[5], programCopy);
11023 }
11024 if (ctx->ExecuteFlag) {
11025 CALL_NamedProgramStringEXT(ctx->Exec, (program, target, format, len, string));
11026 }
11027 }
11028
11029
11030 static void GLAPIENTRY
11031 save_NamedProgramLocalParameter4fEXT(GLuint program, GLenum target, GLuint index,
11032 GLfloat x, GLfloat y, GLfloat z, GLfloat w)
11033 {
11034 GET_CURRENT_CONTEXT(ctx);
11035 Node *n;
11036 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
11037 n = alloc_instruction(ctx, OPCODE_NAMED_PROGRAM_LOCAL_PARAMETER, 7);
11038 if (n) {
11039 n[1].ui = program;
11040 n[2].e = target;
11041 n[3].ui = index;
11042 n[4].f = x;
11043 n[5].f = y;
11044 n[6].f = z;
11045 n[7].f = w;
11046 }
11047 if (ctx->ExecuteFlag) {
11048 CALL_NamedProgramLocalParameter4fEXT(ctx->Exec, (program, target, index, x, y, z, w));
11049 }
11050 }
11051
11052
11053 static void GLAPIENTRY
11054 save_NamedProgramLocalParameter4fvEXT(GLuint program, GLenum target, GLuint index,
11055 const GLfloat *params)
11056 {
11057 save_NamedProgramLocalParameter4fEXT(program, target, index, params[0],
11058 params[1], params[2], params[3]);
11059 }
11060
11061
11062 static void GLAPIENTRY
11063 save_NamedProgramLocalParameter4dEXT(GLuint program, GLenum target, GLuint index,
11064 GLdouble x, GLdouble y,
11065 GLdouble z, GLdouble w)
11066 {
11067 save_NamedProgramLocalParameter4fEXT(program, target, index, (GLfloat) x,
11068 (GLfloat) y, (GLfloat) z, (GLfloat) w);
11069 }
11070
11071
11072 static void GLAPIENTRY
11073 save_NamedProgramLocalParameter4dvEXT(GLuint program, GLenum target, GLuint index,
11074 const GLdouble *params)
11075 {
11076 save_NamedProgramLocalParameter4fEXT(program, target, index, (GLfloat) params[0],
11077 (GLfloat) params[1], (GLfloat) params[2],
11078 (GLfloat) params[3]);
11079 }
11080
11081
11082 /**
11083 * Save an error-generating command into display list.
11084 *
11085 * KW: Will appear in the list before the vertex buffer containing the
11086 * command that provoked the error. I don't see this as a problem.
11087 */
11088 static void
11089 save_error(struct gl_context *ctx, GLenum error, const char *s)
11090 {
11091 Node *n;
11092 n = alloc_instruction(ctx, OPCODE_ERROR, 1 + POINTER_DWORDS);
11093 if (n) {
11094 n[1].e = error;
11095 save_pointer(&n[2], (void *) s);
11096 /* note: the data/string here doesn't have to be freed in
11097 * _mesa_delete_list() since the string is never dynamically
11098 * allocated.
11099 */
11100 }
11101 }
11102
11103
11104 /**
11105 * Compile an error into current display list.
11106 */
11107 void
11108 _mesa_compile_error(struct gl_context *ctx, GLenum error, const char *s)
11109 {
11110 if (ctx->CompileFlag)
11111 save_error(ctx, error, s);
11112 if (ctx->ExecuteFlag)
11113 _mesa_error(ctx, error, "%s", s);
11114 }
11115
11116
11117 /**
11118 * Test if ID names a display list.
11119 */
11120 static GLboolean
11121 islist(struct gl_context *ctx, GLuint list)
11122 {
11123 if (list > 0 && _mesa_lookup_list(ctx, list)) {
11124 return GL_TRUE;
11125 }
11126 else {
11127 return GL_FALSE;
11128 }
11129 }
11130
11131
11132
11133 /**********************************************************************/
11134 /* Display list execution */
11135 /**********************************************************************/
11136
11137
11138 /*
11139 * Execute a display list. Note that the ListBase offset must have already
11140 * been added before calling this function. I.e. the list argument is
11141 * the absolute list number, not relative to ListBase.
11142 * \param list - display list number
11143 */
11144 static void
11145 execute_list(struct gl_context *ctx, GLuint list)
11146 {
11147 struct gl_display_list *dlist;
11148 Node *n;
11149 GLboolean done;
11150
11151 if (list == 0 || !islist(ctx, list))
11152 return;
11153
11154 if (ctx->ListState.CallDepth == MAX_LIST_NESTING) {
11155 /* raise an error? */
11156 return;
11157 }
11158
11159 dlist = _mesa_lookup_list(ctx, list);
11160 if (!dlist)
11161 return;
11162
11163 ctx->ListState.CallDepth++;
11164
11165 vbo_save_BeginCallList(ctx, dlist);
11166
11167 n = dlist->Head;
11168
11169 done = GL_FALSE;
11170 while (!done) {
11171 const OpCode opcode = n[0].opcode;
11172
11173 if (is_ext_opcode(opcode)) {
11174 n += ext_opcode_execute(ctx, n);
11175 }
11176 else {
11177 switch (opcode) {
11178 case OPCODE_ERROR:
11179 _mesa_error(ctx, n[1].e, "%s", (const char *) get_pointer(&n[2]));
11180 break;
11181 case OPCODE_ACCUM:
11182 CALL_Accum(ctx->Exec, (n[1].e, n[2].f));
11183 break;
11184 case OPCODE_ALPHA_FUNC:
11185 CALL_AlphaFunc(ctx->Exec, (n[1].e, n[2].f));
11186 break;
11187 case OPCODE_BIND_TEXTURE:
11188 CALL_BindTexture(ctx->Exec, (n[1].e, n[2].ui));
11189 break;
11190 case OPCODE_BITMAP:
11191 {
11192 const struct gl_pixelstore_attrib save = ctx->Unpack;
11193 ctx->Unpack = ctx->DefaultPacking;
11194 CALL_Bitmap(ctx->Exec, ((GLsizei) n[1].i, (GLsizei) n[2].i,
11195 n[3].f, n[4].f, n[5].f, n[6].f,
11196 get_pointer(&n[7])));
11197 ctx->Unpack = save; /* restore */
11198 }
11199 break;
11200 case OPCODE_BLEND_COLOR:
11201 CALL_BlendColor(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
11202 break;
11203 case OPCODE_BLEND_EQUATION:
11204 CALL_BlendEquation(ctx->Exec, (n[1].e));
11205 break;
11206 case OPCODE_BLEND_EQUATION_SEPARATE:
11207 CALL_BlendEquationSeparate(ctx->Exec, (n[1].e, n[2].e));
11208 break;
11209 case OPCODE_BLEND_FUNC_SEPARATE:
11210 CALL_BlendFuncSeparate(ctx->Exec,
11211 (n[1].e, n[2].e, n[3].e, n[4].e));
11212 break;
11213
11214 case OPCODE_BLEND_FUNC_I:
11215 /* GL_ARB_draw_buffers_blend */
11216 CALL_BlendFunciARB(ctx->Exec, (n[1].ui, n[2].e, n[3].e));
11217 break;
11218 case OPCODE_BLEND_FUNC_SEPARATE_I:
11219 /* GL_ARB_draw_buffers_blend */
11220 CALL_BlendFuncSeparateiARB(ctx->Exec, (n[1].ui, n[2].e, n[3].e,
11221 n[4].e, n[5].e));
11222 break;
11223 case OPCODE_BLEND_EQUATION_I:
11224 /* GL_ARB_draw_buffers_blend */
11225 CALL_BlendEquationiARB(ctx->Exec, (n[1].ui, n[2].e));
11226 break;
11227 case OPCODE_BLEND_EQUATION_SEPARATE_I:
11228 /* GL_ARB_draw_buffers_blend */
11229 CALL_BlendEquationSeparateiARB(ctx->Exec,
11230 (n[1].ui, n[2].e, n[3].e));
11231 break;
11232
11233 case OPCODE_CALL_LIST:
11234 /* Generated by glCallList(), don't add ListBase */
11235 if (ctx->ListState.CallDepth < MAX_LIST_NESTING) {
11236 execute_list(ctx, n[1].ui);
11237 }
11238 break;
11239 case OPCODE_CALL_LISTS:
11240 if (ctx->ListState.CallDepth < MAX_LIST_NESTING) {
11241 CALL_CallLists(ctx->Exec, (n[1].i, n[2].e, get_pointer(&n[3])));
11242 }
11243 break;
11244 case OPCODE_CLEAR:
11245 CALL_Clear(ctx->Exec, (n[1].bf));
11246 break;
11247 case OPCODE_CLEAR_BUFFER_IV:
11248 {
11249 GLint value[4];
11250 value[0] = n[3].i;
11251 value[1] = n[4].i;
11252 value[2] = n[5].i;
11253 value[3] = n[6].i;
11254 CALL_ClearBufferiv(ctx->Exec, (n[1].e, n[2].i, value));
11255 }
11256 break;
11257 case OPCODE_CLEAR_BUFFER_UIV:
11258 {
11259 GLuint value[4];
11260 value[0] = n[3].ui;
11261 value[1] = n[4].ui;
11262 value[2] = n[5].ui;
11263 value[3] = n[6].ui;
11264 CALL_ClearBufferuiv(ctx->Exec, (n[1].e, n[2].i, value));
11265 }
11266 break;
11267 case OPCODE_CLEAR_BUFFER_FV:
11268 {
11269 GLfloat value[4];
11270 value[0] = n[3].f;
11271 value[1] = n[4].f;
11272 value[2] = n[5].f;
11273 value[3] = n[6].f;
11274 CALL_ClearBufferfv(ctx->Exec, (n[1].e, n[2].i, value));
11275 }
11276 break;
11277 case OPCODE_CLEAR_BUFFER_FI:
11278 CALL_ClearBufferfi(ctx->Exec, (n[1].e, n[2].i, n[3].f, n[4].i));
11279 break;
11280 case OPCODE_CLEAR_COLOR:
11281 CALL_ClearColor(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
11282 break;
11283 case OPCODE_CLEAR_ACCUM:
11284 CALL_ClearAccum(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
11285 break;
11286 case OPCODE_CLEAR_DEPTH:
11287 CALL_ClearDepth(ctx->Exec, ((GLclampd) n[1].f));
11288 break;
11289 case OPCODE_CLEAR_INDEX:
11290 CALL_ClearIndex(ctx->Exec, ((GLfloat) n[1].ui));
11291 break;
11292 case OPCODE_CLEAR_STENCIL:
11293 CALL_ClearStencil(ctx->Exec, (n[1].i));
11294 break;
11295 case OPCODE_CLIP_PLANE:
11296 {
11297 GLdouble eq[4];
11298 eq[0] = n[2].f;
11299 eq[1] = n[3].f;
11300 eq[2] = n[4].f;
11301 eq[3] = n[5].f;
11302 CALL_ClipPlane(ctx->Exec, (n[1].e, eq));
11303 }
11304 break;
11305 case OPCODE_COLOR_MASK:
11306 CALL_ColorMask(ctx->Exec, (n[1].b, n[2].b, n[3].b, n[4].b));
11307 break;
11308 case OPCODE_COLOR_MASK_INDEXED:
11309 CALL_ColorMaski(ctx->Exec, (n[1].ui, n[2].b, n[3].b,
11310 n[4].b, n[5].b));
11311 break;
11312 case OPCODE_COLOR_MATERIAL:
11313 CALL_ColorMaterial(ctx->Exec, (n[1].e, n[2].e));
11314 break;
11315 case OPCODE_COPY_PIXELS:
11316 CALL_CopyPixels(ctx->Exec, (n[1].i, n[2].i,
11317 (GLsizei) n[3].i, (GLsizei) n[4].i,
11318 n[5].e));
11319 break;
11320 case OPCODE_COPY_TEX_IMAGE1D:
11321 CALL_CopyTexImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].e, n[4].i,
11322 n[5].i, n[6].i, n[7].i));
11323 break;
11324 case OPCODE_COPY_TEX_IMAGE2D:
11325 CALL_CopyTexImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].e, n[4].i,
11326 n[5].i, n[6].i, n[7].i, n[8].i));
11327 break;
11328 case OPCODE_COPY_TEX_SUB_IMAGE1D:
11329 CALL_CopyTexSubImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
11330 n[4].i, n[5].i, n[6].i));
11331 break;
11332 case OPCODE_COPY_TEX_SUB_IMAGE2D:
11333 CALL_CopyTexSubImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
11334 n[4].i, n[5].i, n[6].i, n[7].i,
11335 n[8].i));
11336 break;
11337 case OPCODE_COPY_TEX_SUB_IMAGE3D:
11338 CALL_CopyTexSubImage3D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
11339 n[4].i, n[5].i, n[6].i, n[7].i,
11340 n[8].i, n[9].i));
11341 break;
11342 case OPCODE_CULL_FACE:
11343 CALL_CullFace(ctx->Exec, (n[1].e));
11344 break;
11345 case OPCODE_DEPTH_FUNC:
11346 CALL_DepthFunc(ctx->Exec, (n[1].e));
11347 break;
11348 case OPCODE_DEPTH_MASK:
11349 CALL_DepthMask(ctx->Exec, (n[1].b));
11350 break;
11351 case OPCODE_DEPTH_RANGE:
11352 CALL_DepthRange(ctx->Exec,
11353 ((GLclampd) n[1].f, (GLclampd) n[2].f));
11354 break;
11355 case OPCODE_DISABLE:
11356 CALL_Disable(ctx->Exec, (n[1].e));
11357 break;
11358 case OPCODE_DISABLE_INDEXED:
11359 CALL_Disablei(ctx->Exec, (n[1].ui, n[2].e));
11360 break;
11361 case OPCODE_DRAW_BUFFER:
11362 CALL_DrawBuffer(ctx->Exec, (n[1].e));
11363 break;
11364 case OPCODE_DRAW_PIXELS:
11365 {
11366 const struct gl_pixelstore_attrib save = ctx->Unpack;
11367 ctx->Unpack = ctx->DefaultPacking;
11368 CALL_DrawPixels(ctx->Exec, (n[1].i, n[2].i, n[3].e, n[4].e,
11369 get_pointer(&n[5])));
11370 ctx->Unpack = save; /* restore */
11371 }
11372 break;
11373 case OPCODE_ENABLE:
11374 CALL_Enable(ctx->Exec, (n[1].e));
11375 break;
11376 case OPCODE_ENABLE_INDEXED:
11377 CALL_Enablei(ctx->Exec, (n[1].ui, n[2].e));
11378 break;
11379 case OPCODE_EVALMESH1:
11380 CALL_EvalMesh1(ctx->Exec, (n[1].e, n[2].i, n[3].i));
11381 break;
11382 case OPCODE_EVALMESH2:
11383 CALL_EvalMesh2(ctx->Exec,
11384 (n[1].e, n[2].i, n[3].i, n[4].i, n[5].i));
11385 break;
11386 case OPCODE_FOG:
11387 {
11388 GLfloat p[4];
11389 p[0] = n[2].f;
11390 p[1] = n[3].f;
11391 p[2] = n[4].f;
11392 p[3] = n[5].f;
11393 CALL_Fogfv(ctx->Exec, (n[1].e, p));
11394 }
11395 break;
11396 case OPCODE_FRONT_FACE:
11397 CALL_FrontFace(ctx->Exec, (n[1].e));
11398 break;
11399 case OPCODE_FRUSTUM:
11400 CALL_Frustum(ctx->Exec,
11401 (n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f));
11402 break;
11403 case OPCODE_HINT:
11404 CALL_Hint(ctx->Exec, (n[1].e, n[2].e));
11405 break;
11406 case OPCODE_INDEX_MASK:
11407 CALL_IndexMask(ctx->Exec, (n[1].ui));
11408 break;
11409 case OPCODE_INIT_NAMES:
11410 CALL_InitNames(ctx->Exec, ());
11411 break;
11412 case OPCODE_LIGHT:
11413 {
11414 GLfloat p[4];
11415 p[0] = n[3].f;
11416 p[1] = n[4].f;
11417 p[2] = n[5].f;
11418 p[3] = n[6].f;
11419 CALL_Lightfv(ctx->Exec, (n[1].e, n[2].e, p));
11420 }
11421 break;
11422 case OPCODE_LIGHT_MODEL:
11423 {
11424 GLfloat p[4];
11425 p[0] = n[2].f;
11426 p[1] = n[3].f;
11427 p[2] = n[4].f;
11428 p[3] = n[5].f;
11429 CALL_LightModelfv(ctx->Exec, (n[1].e, p));
11430 }
11431 break;
11432 case OPCODE_LINE_STIPPLE:
11433 CALL_LineStipple(ctx->Exec, (n[1].i, n[2].us));
11434 break;
11435 case OPCODE_LINE_WIDTH:
11436 CALL_LineWidth(ctx->Exec, (n[1].f));
11437 break;
11438 case OPCODE_LIST_BASE:
11439 CALL_ListBase(ctx->Exec, (n[1].ui));
11440 break;
11441 case OPCODE_LOAD_IDENTITY:
11442 CALL_LoadIdentity(ctx->Exec, ());
11443 break;
11444 case OPCODE_LOAD_MATRIX:
11445 STATIC_ASSERT(sizeof(Node) == sizeof(GLfloat));
11446 CALL_LoadMatrixf(ctx->Exec, (&n[1].f));
11447 break;
11448 case OPCODE_LOAD_NAME:
11449 CALL_LoadName(ctx->Exec, (n[1].ui));
11450 break;
11451 case OPCODE_LOGIC_OP:
11452 CALL_LogicOp(ctx->Exec, (n[1].e));
11453 break;
11454 case OPCODE_MAP1:
11455 {
11456 GLenum target = n[1].e;
11457 GLint ustride = _mesa_evaluator_components(target);
11458 GLint uorder = n[5].i;
11459 GLfloat u1 = n[2].f;
11460 GLfloat u2 = n[3].f;
11461 CALL_Map1f(ctx->Exec, (target, u1, u2, ustride, uorder,
11462 (GLfloat *) get_pointer(&n[6])));
11463 }
11464 break;
11465 case OPCODE_MAP2:
11466 {
11467 GLenum target = n[1].e;
11468 GLfloat u1 = n[2].f;
11469 GLfloat u2 = n[3].f;
11470 GLfloat v1 = n[4].f;
11471 GLfloat v2 = n[5].f;
11472 GLint ustride = n[6].i;
11473 GLint vstride = n[7].i;
11474 GLint uorder = n[8].i;
11475 GLint vorder = n[9].i;
11476 CALL_Map2f(ctx->Exec, (target, u1, u2, ustride, uorder,
11477 v1, v2, vstride, vorder,
11478 (GLfloat *) get_pointer(&n[10])));
11479 }
11480 break;
11481 case OPCODE_MAPGRID1:
11482 CALL_MapGrid1f(ctx->Exec, (n[1].i, n[2].f, n[3].f));
11483 break;
11484 case OPCODE_MAPGRID2:
11485 CALL_MapGrid2f(ctx->Exec,
11486 (n[1].i, n[2].f, n[3].f, n[4].i, n[5].f, n[6].f));
11487 break;
11488 case OPCODE_MATRIX_MODE:
11489 CALL_MatrixMode(ctx->Exec, (n[1].e));
11490 break;
11491 case OPCODE_MULT_MATRIX:
11492 CALL_MultMatrixf(ctx->Exec, (&n[1].f));
11493 break;
11494 case OPCODE_ORTHO:
11495 CALL_Ortho(ctx->Exec,
11496 (n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f));
11497 break;
11498 case OPCODE_PASSTHROUGH:
11499 CALL_PassThrough(ctx->Exec, (n[1].f));
11500 break;
11501 case OPCODE_PATCH_PARAMETER_I:
11502 CALL_PatchParameteri(ctx->Exec, (n[1].e, n[2].i));
11503 break;
11504 case OPCODE_PATCH_PARAMETER_FV_INNER:
11505 {
11506 GLfloat params[2];
11507 params[0] = n[2].f;
11508 params[1] = n[3].f;
11509 CALL_PatchParameterfv(ctx->Exec, (n[1].e, params));
11510 }
11511 break;
11512 case OPCODE_PATCH_PARAMETER_FV_OUTER:
11513 {
11514 GLfloat params[4];
11515 params[0] = n[2].f;
11516 params[1] = n[3].f;
11517 params[2] = n[4].f;
11518 params[3] = n[5].f;
11519 CALL_PatchParameterfv(ctx->Exec, (n[1].e, params));
11520 }
11521 break;
11522 case OPCODE_PIXEL_MAP:
11523 CALL_PixelMapfv(ctx->Exec,
11524 (n[1].e, n[2].i, get_pointer(&n[3])));
11525 break;
11526 case OPCODE_PIXEL_TRANSFER:
11527 CALL_PixelTransferf(ctx->Exec, (n[1].e, n[2].f));
11528 break;
11529 case OPCODE_PIXEL_ZOOM:
11530 CALL_PixelZoom(ctx->Exec, (n[1].f, n[2].f));
11531 break;
11532 case OPCODE_POINT_SIZE:
11533 CALL_PointSize(ctx->Exec, (n[1].f));
11534 break;
11535 case OPCODE_POINT_PARAMETERS:
11536 {
11537 GLfloat params[3];
11538 params[0] = n[2].f;
11539 params[1] = n[3].f;
11540 params[2] = n[4].f;
11541 CALL_PointParameterfv(ctx->Exec, (n[1].e, params));
11542 }
11543 break;
11544 case OPCODE_POLYGON_MODE:
11545 CALL_PolygonMode(ctx->Exec, (n[1].e, n[2].e));
11546 break;
11547 case OPCODE_POLYGON_STIPPLE:
11548 {
11549 const struct gl_pixelstore_attrib save = ctx->Unpack;
11550 ctx->Unpack = ctx->DefaultPacking;
11551 CALL_PolygonStipple(ctx->Exec, (get_pointer(&n[1])));
11552 ctx->Unpack = save; /* restore */
11553 }
11554 break;
11555 case OPCODE_POLYGON_OFFSET:
11556 CALL_PolygonOffset(ctx->Exec, (n[1].f, n[2].f));
11557 break;
11558 case OPCODE_POLYGON_OFFSET_CLAMP:
11559 CALL_PolygonOffsetClampEXT(ctx->Exec, (n[1].f, n[2].f, n[3].f));
11560 break;
11561 case OPCODE_POP_ATTRIB:
11562 CALL_PopAttrib(ctx->Exec, ());
11563 break;
11564 case OPCODE_POP_MATRIX:
11565 CALL_PopMatrix(ctx->Exec, ());
11566 break;
11567 case OPCODE_POP_NAME:
11568 CALL_PopName(ctx->Exec, ());
11569 break;
11570 case OPCODE_PRIORITIZE_TEXTURE:
11571 CALL_PrioritizeTextures(ctx->Exec, (1, &n[1].ui, &n[2].f));
11572 break;
11573 case OPCODE_PUSH_ATTRIB:
11574 CALL_PushAttrib(ctx->Exec, (n[1].bf));
11575 break;
11576 case OPCODE_PUSH_MATRIX:
11577 CALL_PushMatrix(ctx->Exec, ());
11578 break;
11579 case OPCODE_PUSH_NAME:
11580 CALL_PushName(ctx->Exec, (n[1].ui));
11581 break;
11582 case OPCODE_RASTER_POS:
11583 CALL_RasterPos4f(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
11584 break;
11585 case OPCODE_READ_BUFFER:
11586 CALL_ReadBuffer(ctx->Exec, (n[1].e));
11587 break;
11588 case OPCODE_ROTATE:
11589 CALL_Rotatef(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
11590 break;
11591 case OPCODE_SCALE:
11592 CALL_Scalef(ctx->Exec, (n[1].f, n[2].f, n[3].f));
11593 break;
11594 case OPCODE_SCISSOR:
11595 CALL_Scissor(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
11596 break;
11597 case OPCODE_SHADE_MODEL:
11598 CALL_ShadeModel(ctx->Exec, (n[1].e));
11599 break;
11600 case OPCODE_PROVOKING_VERTEX:
11601 CALL_ProvokingVertex(ctx->Exec, (n[1].e));
11602 break;
11603 case OPCODE_STENCIL_FUNC:
11604 CALL_StencilFunc(ctx->Exec, (n[1].e, n[2].i, n[3].ui));
11605 break;
11606 case OPCODE_STENCIL_MASK:
11607 CALL_StencilMask(ctx->Exec, (n[1].ui));
11608 break;
11609 case OPCODE_STENCIL_OP:
11610 CALL_StencilOp(ctx->Exec, (n[1].e, n[2].e, n[3].e));
11611 break;
11612 case OPCODE_STENCIL_FUNC_SEPARATE:
11613 CALL_StencilFuncSeparate(ctx->Exec,
11614 (n[1].e, n[2].e, n[3].i, n[4].ui));
11615 break;
11616 case OPCODE_STENCIL_MASK_SEPARATE:
11617 CALL_StencilMaskSeparate(ctx->Exec, (n[1].e, n[2].ui));
11618 break;
11619 case OPCODE_STENCIL_OP_SEPARATE:
11620 CALL_StencilOpSeparate(ctx->Exec,
11621 (n[1].e, n[2].e, n[3].e, n[4].e));
11622 break;
11623 case OPCODE_TEXENV:
11624 {
11625 GLfloat params[4];
11626 params[0] = n[3].f;
11627 params[1] = n[4].f;
11628 params[2] = n[5].f;
11629 params[3] = n[6].f;
11630 CALL_TexEnvfv(ctx->Exec, (n[1].e, n[2].e, params));
11631 }
11632 break;
11633 case OPCODE_TEXGEN:
11634 {
11635 GLfloat params[4];
11636 params[0] = n[3].f;
11637 params[1] = n[4].f;
11638 params[2] = n[5].f;
11639 params[3] = n[6].f;
11640 CALL_TexGenfv(ctx->Exec, (n[1].e, n[2].e, params));
11641 }
11642 break;
11643 case OPCODE_TEXPARAMETER:
11644 {
11645 GLfloat params[4];
11646 params[0] = n[3].f;
11647 params[1] = n[4].f;
11648 params[2] = n[5].f;
11649 params[3] = n[6].f;
11650 CALL_TexParameterfv(ctx->Exec, (n[1].e, n[2].e, params));
11651 }
11652 break;
11653 case OPCODE_TEX_IMAGE1D:
11654 {
11655 const struct gl_pixelstore_attrib save = ctx->Unpack;
11656 ctx->Unpack = ctx->DefaultPacking;
11657 CALL_TexImage1D(ctx->Exec, (n[1].e, /* target */
11658 n[2].i, /* level */
11659 n[3].i, /* components */
11660 n[4].i, /* width */
11661 n[5].e, /* border */
11662 n[6].e, /* format */
11663 n[7].e, /* type */
11664 get_pointer(&n[8])));
11665 ctx->Unpack = save; /* restore */
11666 }
11667 break;
11668 case OPCODE_TEX_IMAGE2D:
11669 {
11670 const struct gl_pixelstore_attrib save = ctx->Unpack;
11671 ctx->Unpack = ctx->DefaultPacking;
11672 CALL_TexImage2D(ctx->Exec, (n[1].e, /* target */
11673 n[2].i, /* level */
11674 n[3].i, /* components */
11675 n[4].i, /* width */
11676 n[5].i, /* height */
11677 n[6].e, /* border */
11678 n[7].e, /* format */
11679 n[8].e, /* type */
11680 get_pointer(&n[9])));
11681 ctx->Unpack = save; /* restore */
11682 }
11683 break;
11684 case OPCODE_TEX_IMAGE3D:
11685 {
11686 const struct gl_pixelstore_attrib save = ctx->Unpack;
11687 ctx->Unpack = ctx->DefaultPacking;
11688 CALL_TexImage3D(ctx->Exec, (n[1].e, /* target */
11689 n[2].i, /* level */
11690 n[3].i, /* components */
11691 n[4].i, /* width */
11692 n[5].i, /* height */
11693 n[6].i, /* depth */
11694 n[7].e, /* border */
11695 n[8].e, /* format */
11696 n[9].e, /* type */
11697 get_pointer(&n[10])));
11698 ctx->Unpack = save; /* restore */
11699 }
11700 break;
11701 case OPCODE_TEX_SUB_IMAGE1D:
11702 {
11703 const struct gl_pixelstore_attrib save = ctx->Unpack;
11704 ctx->Unpack = ctx->DefaultPacking;
11705 CALL_TexSubImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
11706 n[4].i, n[5].e,
11707 n[6].e, get_pointer(&n[7])));
11708 ctx->Unpack = save; /* restore */
11709 }
11710 break;
11711 case OPCODE_TEX_SUB_IMAGE2D:
11712 {
11713 const struct gl_pixelstore_attrib save = ctx->Unpack;
11714 ctx->Unpack = ctx->DefaultPacking;
11715 CALL_TexSubImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
11716 n[4].i, n[5].e,
11717 n[6].i, n[7].e, n[8].e,
11718 get_pointer(&n[9])));
11719 ctx->Unpack = save; /* restore */
11720 }
11721 break;
11722 case OPCODE_TEX_SUB_IMAGE3D:
11723 {
11724 const struct gl_pixelstore_attrib save = ctx->Unpack;
11725 ctx->Unpack = ctx->DefaultPacking;
11726 CALL_TexSubImage3D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
11727 n[4].i, n[5].i, n[6].i, n[7].i,
11728 n[8].i, n[9].e, n[10].e,
11729 get_pointer(&n[11])));
11730 ctx->Unpack = save; /* restore */
11731 }
11732 break;
11733 case OPCODE_TRANSLATE:
11734 CALL_Translatef(ctx->Exec, (n[1].f, n[2].f, n[3].f));
11735 break;
11736 case OPCODE_VIEWPORT:
11737 CALL_Viewport(ctx->Exec, (n[1].i, n[2].i,
11738 (GLsizei) n[3].i, (GLsizei) n[4].i));
11739 break;
11740 case OPCODE_WINDOW_POS:
11741 CALL_WindowPos4fMESA(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
11742 break;
11743 case OPCODE_VIEWPORT_ARRAY_V:
11744 CALL_ViewportArrayv(ctx->Exec, (n[1].ui, n[2].si,
11745 get_pointer(&n[3])));
11746 break;
11747 case OPCODE_VIEWPORT_INDEXED_F:
11748 CALL_ViewportIndexedf(ctx->Exec, (n[1].ui, n[2].f, n[3].f, n[4].f,
11749 n[5].f));
11750 break;
11751 case OPCODE_VIEWPORT_INDEXED_FV: {
11752 GLfloat v[4];
11753 v[0] = n[2].f;
11754 v[1] = n[3].f;
11755 v[2] = n[4].f;
11756 v[3] = n[5].f;
11757 CALL_ViewportIndexedfv(ctx->Exec, (n[1].ui, v));
11758 break;
11759 }
11760 case OPCODE_SCISSOR_ARRAY_V:
11761 CALL_ScissorArrayv(ctx->Exec, (n[1].ui, n[2].si,
11762 get_pointer(&n[3])));
11763 break;
11764 case OPCODE_SCISSOR_INDEXED:
11765 CALL_ScissorIndexed(ctx->Exec, (n[1].ui, n[2].i, n[3].i, n[4].si,
11766 n[5].si));
11767 break;
11768 case OPCODE_SCISSOR_INDEXED_V: {
11769 GLint v[4];
11770 v[0] = n[2].i;
11771 v[1] = n[3].i;
11772 v[2] = n[4].si;
11773 v[3] = n[5].si;
11774 CALL_ScissorIndexedv(ctx->Exec, (n[1].ui, v));
11775 break;
11776 }
11777 case OPCODE_DEPTH_ARRAY_V:
11778 CALL_DepthRangeArrayv(ctx->Exec, (n[1].ui, n[2].si,
11779 get_pointer(&n[3])));
11780 break;
11781 case OPCODE_DEPTH_INDEXED:
11782 CALL_DepthRangeIndexed(ctx->Exec, (n[1].ui, n[2].f, n[3].f));
11783 break;
11784 case OPCODE_ACTIVE_TEXTURE: /* GL_ARB_multitexture */
11785 CALL_ActiveTexture(ctx->Exec, (n[1].e));
11786 break;
11787 case OPCODE_COMPRESSED_TEX_IMAGE_1D: /* GL_ARB_texture_compression */
11788 CALL_CompressedTexImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].e,
11789 n[4].i, n[5].i, n[6].i,
11790 get_pointer(&n[7])));
11791 break;
11792 case OPCODE_COMPRESSED_TEX_IMAGE_2D: /* GL_ARB_texture_compression */
11793 CALL_CompressedTexImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].e,
11794 n[4].i, n[5].i, n[6].i,
11795 n[7].i, get_pointer(&n[8])));
11796 break;
11797 case OPCODE_COMPRESSED_TEX_IMAGE_3D: /* GL_ARB_texture_compression */
11798 CALL_CompressedTexImage3D(ctx->Exec, (n[1].e, n[2].i, n[3].e,
11799 n[4].i, n[5].i, n[6].i,
11800 n[7].i, n[8].i,
11801 get_pointer(&n[9])));
11802 break;
11803 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D: /* GL_ARB_texture_compress */
11804 CALL_CompressedTexSubImage1D(ctx->Exec,
11805 (n[1].e, n[2].i, n[3].i, n[4].i,
11806 n[5].e, n[6].i,
11807 get_pointer(&n[7])));
11808 break;
11809 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D: /* GL_ARB_texture_compress */
11810 CALL_CompressedTexSubImage2D(ctx->Exec,
11811 (n[1].e, n[2].i, n[3].i, n[4].i,
11812 n[5].i, n[6].i, n[7].e, n[8].i,
11813 get_pointer(&n[9])));
11814 break;
11815 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D: /* GL_ARB_texture_compress */
11816 CALL_CompressedTexSubImage3D(ctx->Exec,
11817 (n[1].e, n[2].i, n[3].i, n[4].i,
11818 n[5].i, n[6].i, n[7].i, n[8].i,
11819 n[9].e, n[10].i,
11820 get_pointer(&n[11])));
11821 break;
11822 case OPCODE_SAMPLE_COVERAGE: /* GL_ARB_multisample */
11823 CALL_SampleCoverage(ctx->Exec, (n[1].f, n[2].b));
11824 break;
11825 case OPCODE_WINDOW_POS_ARB: /* GL_ARB_window_pos */
11826 CALL_WindowPos3f(ctx->Exec, (n[1].f, n[2].f, n[3].f));
11827 break;
11828 case OPCODE_BIND_PROGRAM_ARB: /* GL_ARB_vertex_program */
11829 CALL_BindProgramARB(ctx->Exec, (n[1].e, n[2].ui));
11830 break;
11831 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB:
11832 CALL_ProgramLocalParameter4fARB(ctx->Exec,
11833 (n[1].e, n[2].ui, n[3].f, n[4].f,
11834 n[5].f, n[6].f));
11835 break;
11836 case OPCODE_ACTIVE_STENCIL_FACE_EXT:
11837 CALL_ActiveStencilFaceEXT(ctx->Exec, (n[1].e));
11838 break;
11839 case OPCODE_DEPTH_BOUNDS_EXT:
11840 CALL_DepthBoundsEXT(ctx->Exec, (n[1].f, n[2].f));
11841 break;
11842 case OPCODE_PROGRAM_STRING_ARB:
11843 CALL_ProgramStringARB(ctx->Exec,
11844 (n[1].e, n[2].e, n[3].i,
11845 get_pointer(&n[4])));
11846 break;
11847 case OPCODE_PROGRAM_ENV_PARAMETER_ARB:
11848 CALL_ProgramEnvParameter4fARB(ctx->Exec, (n[1].e, n[2].ui, n[3].f,
11849 n[4].f, n[5].f,
11850 n[6].f));
11851 break;
11852 case OPCODE_BEGIN_QUERY_ARB:
11853 CALL_BeginQuery(ctx->Exec, (n[1].e, n[2].ui));
11854 break;
11855 case OPCODE_END_QUERY_ARB:
11856 CALL_EndQuery(ctx->Exec, (n[1].e));
11857 break;
11858 case OPCODE_QUERY_COUNTER:
11859 CALL_QueryCounter(ctx->Exec, (n[1].ui, n[2].e));
11860 break;
11861 case OPCODE_BEGIN_QUERY_INDEXED:
11862 CALL_BeginQueryIndexed(ctx->Exec, (n[1].e, n[2].ui, n[3].ui));
11863 break;
11864 case OPCODE_END_QUERY_INDEXED:
11865 CALL_EndQueryIndexed(ctx->Exec, (n[1].e, n[2].ui));
11866 break;
11867 case OPCODE_DRAW_BUFFERS_ARB:
11868 {
11869 GLenum buffers[MAX_DRAW_BUFFERS];
11870 GLint i, count = MIN2(n[1].i, MAX_DRAW_BUFFERS);
11871 for (i = 0; i < count; i++)
11872 buffers[i] = n[2 + i].e;
11873 CALL_DrawBuffers(ctx->Exec, (n[1].i, buffers));
11874 }
11875 break;
11876 case OPCODE_BLIT_FRAMEBUFFER:
11877 CALL_BlitFramebuffer(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i,
11878 n[5].i, n[6].i, n[7].i, n[8].i,
11879 n[9].i, n[10].e));
11880 break;
11881 case OPCODE_PRIMITIVE_RESTART_NV:
11882 CALL_PrimitiveRestartNV(ctx->Exec, ());
11883 break;
11884
11885 case OPCODE_USE_PROGRAM:
11886 CALL_UseProgram(ctx->Exec, (n[1].ui));
11887 break;
11888 case OPCODE_UNIFORM_1F:
11889 CALL_Uniform1f(ctx->Exec, (n[1].i, n[2].f));
11890 break;
11891 case OPCODE_UNIFORM_2F:
11892 CALL_Uniform2f(ctx->Exec, (n[1].i, n[2].f, n[3].f));
11893 break;
11894 case OPCODE_UNIFORM_3F:
11895 CALL_Uniform3f(ctx->Exec, (n[1].i, n[2].f, n[3].f, n[4].f));
11896 break;
11897 case OPCODE_UNIFORM_4F:
11898 CALL_Uniform4f(ctx->Exec,
11899 (n[1].i, n[2].f, n[3].f, n[4].f, n[5].f));
11900 break;
11901 case OPCODE_UNIFORM_1FV:
11902 CALL_Uniform1fv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11903 break;
11904 case OPCODE_UNIFORM_2FV:
11905 CALL_Uniform2fv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11906 break;
11907 case OPCODE_UNIFORM_3FV:
11908 CALL_Uniform3fv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11909 break;
11910 case OPCODE_UNIFORM_4FV:
11911 CALL_Uniform4fv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11912 break;
11913 case OPCODE_UNIFORM_1D: {
11914 union float64_pair x;
11915
11916 x.uint32[0] = n[2].ui;
11917 x.uint32[1] = n[3].ui;
11918
11919 CALL_Uniform1d(ctx->Exec, (n[1].i, x.d));
11920 break;
11921 }
11922 case OPCODE_UNIFORM_2D: {
11923 union float64_pair x;
11924 union float64_pair y;
11925
11926 x.uint32[0] = n[2].ui;
11927 x.uint32[1] = n[3].ui;
11928 y.uint32[0] = n[4].ui;
11929 y.uint32[1] = n[5].ui;
11930
11931 CALL_Uniform2d(ctx->Exec, (n[1].i, x.d, y.d));
11932 break;
11933 }
11934 case OPCODE_UNIFORM_3D: {
11935 union float64_pair x;
11936 union float64_pair y;
11937 union float64_pair z;
11938
11939 x.uint32[0] = n[2].ui;
11940 x.uint32[1] = n[3].ui;
11941 y.uint32[0] = n[4].ui;
11942 y.uint32[1] = n[5].ui;
11943 z.uint32[0] = n[6].ui;
11944 z.uint32[1] = n[7].ui;
11945
11946 CALL_Uniform3d(ctx->Exec, (n[1].i, x.d, y.d, z.d));
11947 break;
11948 }
11949 case OPCODE_UNIFORM_4D: {
11950 union float64_pair x;
11951 union float64_pair y;
11952 union float64_pair z;
11953 union float64_pair w;
11954
11955 x.uint32[0] = n[2].ui;
11956 x.uint32[1] = n[3].ui;
11957 y.uint32[0] = n[4].ui;
11958 y.uint32[1] = n[5].ui;
11959 z.uint32[0] = n[6].ui;
11960 z.uint32[1] = n[7].ui;
11961 w.uint32[0] = n[8].ui;
11962 w.uint32[1] = n[9].ui;
11963
11964 CALL_Uniform4d(ctx->Exec, (n[1].i, x.d, y.d, z.d, w.d));
11965 break;
11966 }
11967 case OPCODE_UNIFORM_1DV:
11968 CALL_Uniform1dv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11969 break;
11970 case OPCODE_UNIFORM_2DV:
11971 CALL_Uniform2dv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11972 break;
11973 case OPCODE_UNIFORM_3DV:
11974 CALL_Uniform3dv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11975 break;
11976 case OPCODE_UNIFORM_4DV:
11977 CALL_Uniform4dv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11978 break;
11979 case OPCODE_UNIFORM_1I:
11980 CALL_Uniform1i(ctx->Exec, (n[1].i, n[2].i));
11981 break;
11982 case OPCODE_UNIFORM_2I:
11983 CALL_Uniform2i(ctx->Exec, (n[1].i, n[2].i, n[3].i));
11984 break;
11985 case OPCODE_UNIFORM_3I:
11986 CALL_Uniform3i(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
11987 break;
11988 case OPCODE_UNIFORM_4I:
11989 CALL_Uniform4i(ctx->Exec,
11990 (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
11991 break;
11992 case OPCODE_UNIFORM_1IV:
11993 CALL_Uniform1iv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11994 break;
11995 case OPCODE_UNIFORM_2IV:
11996 CALL_Uniform2iv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11997 break;
11998 case OPCODE_UNIFORM_3IV:
11999 CALL_Uniform3iv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12000 break;
12001 case OPCODE_UNIFORM_4IV:
12002 CALL_Uniform4iv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12003 break;
12004 case OPCODE_UNIFORM_1UI:
12005 CALL_Uniform1ui(ctx->Exec, (n[1].i, n[2].i));
12006 break;
12007 case OPCODE_UNIFORM_2UI:
12008 CALL_Uniform2ui(ctx->Exec, (n[1].i, n[2].i, n[3].i));
12009 break;
12010 case OPCODE_UNIFORM_3UI:
12011 CALL_Uniform3ui(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
12012 break;
12013 case OPCODE_UNIFORM_4UI:
12014 CALL_Uniform4ui(ctx->Exec,
12015 (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
12016 break;
12017 case OPCODE_UNIFORM_1UIV:
12018 CALL_Uniform1uiv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12019 break;
12020 case OPCODE_UNIFORM_2UIV:
12021 CALL_Uniform2uiv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12022 break;
12023 case OPCODE_UNIFORM_3UIV:
12024 CALL_Uniform3uiv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12025 break;
12026 case OPCODE_UNIFORM_4UIV:
12027 CALL_Uniform4uiv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12028 break;
12029 case OPCODE_UNIFORM_MATRIX22:
12030 CALL_UniformMatrix2fv(ctx->Exec,
12031 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12032 break;
12033 case OPCODE_UNIFORM_MATRIX33:
12034 CALL_UniformMatrix3fv(ctx->Exec,
12035 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12036 break;
12037 case OPCODE_UNIFORM_MATRIX44:
12038 CALL_UniformMatrix4fv(ctx->Exec,
12039 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12040 break;
12041 case OPCODE_UNIFORM_MATRIX23:
12042 CALL_UniformMatrix2x3fv(ctx->Exec,
12043 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12044 break;
12045 case OPCODE_UNIFORM_MATRIX32:
12046 CALL_UniformMatrix3x2fv(ctx->Exec,
12047 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12048 break;
12049 case OPCODE_UNIFORM_MATRIX24:
12050 CALL_UniformMatrix2x4fv(ctx->Exec,
12051 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12052 break;
12053 case OPCODE_UNIFORM_MATRIX42:
12054 CALL_UniformMatrix4x2fv(ctx->Exec,
12055 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12056 break;
12057 case OPCODE_UNIFORM_MATRIX34:
12058 CALL_UniformMatrix3x4fv(ctx->Exec,
12059 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12060 break;
12061 case OPCODE_UNIFORM_MATRIX43:
12062 CALL_UniformMatrix4x3fv(ctx->Exec,
12063 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12064 break;
12065 case OPCODE_UNIFORM_MATRIX22D:
12066 CALL_UniformMatrix2dv(ctx->Exec,
12067 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12068 break;
12069 case OPCODE_UNIFORM_MATRIX33D:
12070 CALL_UniformMatrix3dv(ctx->Exec,
12071 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12072 break;
12073 case OPCODE_UNIFORM_MATRIX44D:
12074 CALL_UniformMatrix4dv(ctx->Exec,
12075 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12076 break;
12077 case OPCODE_UNIFORM_MATRIX23D:
12078 CALL_UniformMatrix2x3dv(ctx->Exec,
12079 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12080 break;
12081 case OPCODE_UNIFORM_MATRIX32D:
12082 CALL_UniformMatrix3x2dv(ctx->Exec,
12083 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12084 break;
12085 case OPCODE_UNIFORM_MATRIX24D:
12086 CALL_UniformMatrix2x4dv(ctx->Exec,
12087 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12088 break;
12089 case OPCODE_UNIFORM_MATRIX42D:
12090 CALL_UniformMatrix4x2dv(ctx->Exec,
12091 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12092 break;
12093 case OPCODE_UNIFORM_MATRIX34D:
12094 CALL_UniformMatrix3x4dv(ctx->Exec,
12095 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12096 break;
12097 case OPCODE_UNIFORM_MATRIX43D:
12098 CALL_UniformMatrix4x3dv(ctx->Exec,
12099 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12100 break;
12101
12102 case OPCODE_USE_PROGRAM_STAGES:
12103 CALL_UseProgramStages(ctx->Exec, (n[1].ui, n[2].ui, n[3].ui));
12104 break;
12105 case OPCODE_PROGRAM_UNIFORM_1F:
12106 CALL_ProgramUniform1f(ctx->Exec, (n[1].ui, n[2].i, n[3].f));
12107 break;
12108 case OPCODE_PROGRAM_UNIFORM_2F:
12109 CALL_ProgramUniform2f(ctx->Exec, (n[1].ui, n[2].i, n[3].f, n[4].f));
12110 break;
12111 case OPCODE_PROGRAM_UNIFORM_3F:
12112 CALL_ProgramUniform3f(ctx->Exec, (n[1].ui, n[2].i,
12113 n[3].f, n[4].f, n[5].f));
12114 break;
12115 case OPCODE_PROGRAM_UNIFORM_4F:
12116 CALL_ProgramUniform4f(ctx->Exec, (n[1].ui, n[2].i,
12117 n[3].f, n[4].f, n[5].f, n[6].f));
12118 break;
12119 case OPCODE_PROGRAM_UNIFORM_1FV:
12120 CALL_ProgramUniform1fv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12121 get_pointer(&n[4])));
12122 break;
12123 case OPCODE_PROGRAM_UNIFORM_2FV:
12124 CALL_ProgramUniform2fv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12125 get_pointer(&n[4])));
12126 break;
12127 case OPCODE_PROGRAM_UNIFORM_3FV:
12128 CALL_ProgramUniform3fv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12129 get_pointer(&n[4])));
12130 break;
12131 case OPCODE_PROGRAM_UNIFORM_4FV:
12132 CALL_ProgramUniform4fv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12133 get_pointer(&n[4])));
12134 break;
12135 case OPCODE_PROGRAM_UNIFORM_1D: {
12136 union float64_pair x;
12137
12138 x.uint32[0] = n[3].ui;
12139 x.uint32[1] = n[4].ui;
12140
12141 CALL_ProgramUniform1d(ctx->Exec, (n[1].ui, n[2].i, x.d));
12142 break;
12143 }
12144 case OPCODE_PROGRAM_UNIFORM_2D: {
12145 union float64_pair x;
12146 union float64_pair y;
12147
12148 x.uint32[0] = n[3].ui;
12149 x.uint32[1] = n[4].ui;
12150 y.uint32[0] = n[5].ui;
12151 y.uint32[1] = n[6].ui;
12152
12153 CALL_ProgramUniform2d(ctx->Exec, (n[1].ui, n[2].i, x.d, y.d));
12154 break;
12155 }
12156 case OPCODE_PROGRAM_UNIFORM_3D: {
12157 union float64_pair x;
12158 union float64_pair y;
12159 union float64_pair z;
12160
12161 x.uint32[0] = n[3].ui;
12162 x.uint32[1] = n[4].ui;
12163 y.uint32[0] = n[5].ui;
12164 y.uint32[1] = n[6].ui;
12165 z.uint32[0] = n[7].ui;
12166 z.uint32[1] = n[8].ui;
12167
12168 CALL_ProgramUniform3d(ctx->Exec, (n[1].ui, n[2].i,
12169 x.d, y.d, z.d));
12170 break;
12171 }
12172 case OPCODE_PROGRAM_UNIFORM_4D: {
12173 union float64_pair x;
12174 union float64_pair y;
12175 union float64_pair z;
12176 union float64_pair w;
12177
12178 x.uint32[0] = n[3].ui;
12179 x.uint32[1] = n[4].ui;
12180 y.uint32[0] = n[5].ui;
12181 y.uint32[1] = n[6].ui;
12182 z.uint32[0] = n[7].ui;
12183 z.uint32[1] = n[8].ui;
12184 w.uint32[0] = n[9].ui;
12185 w.uint32[1] = n[10].ui;
12186
12187 CALL_ProgramUniform4d(ctx->Exec, (n[1].ui, n[2].i,
12188 x.d, y.d, z.d, w.d));
12189 break;
12190 }
12191 case OPCODE_PROGRAM_UNIFORM_1DV:
12192 CALL_ProgramUniform1dv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12193 get_pointer(&n[4])));
12194 break;
12195 case OPCODE_PROGRAM_UNIFORM_2DV:
12196 CALL_ProgramUniform2dv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12197 get_pointer(&n[4])));
12198 break;
12199 case OPCODE_PROGRAM_UNIFORM_3DV:
12200 CALL_ProgramUniform3dv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12201 get_pointer(&n[4])));
12202 break;
12203 case OPCODE_PROGRAM_UNIFORM_4DV:
12204 CALL_ProgramUniform4dv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12205 get_pointer(&n[4])));
12206 break;
12207 case OPCODE_PROGRAM_UNIFORM_1I:
12208 CALL_ProgramUniform1i(ctx->Exec, (n[1].ui, n[2].i, n[3].i));
12209 break;
12210 case OPCODE_PROGRAM_UNIFORM_2I:
12211 CALL_ProgramUniform2i(ctx->Exec, (n[1].ui, n[2].i, n[3].i, n[4].i));
12212 break;
12213 case OPCODE_PROGRAM_UNIFORM_3I:
12214 CALL_ProgramUniform3i(ctx->Exec, (n[1].ui, n[2].i,
12215 n[3].i, n[4].i, n[5].i));
12216 break;
12217 case OPCODE_PROGRAM_UNIFORM_4I:
12218 CALL_ProgramUniform4i(ctx->Exec, (n[1].ui, n[2].i,
12219 n[3].i, n[4].i, n[5].i, n[6].i));
12220 break;
12221 case OPCODE_PROGRAM_UNIFORM_1IV:
12222 CALL_ProgramUniform1iv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12223 get_pointer(&n[4])));
12224 break;
12225 case OPCODE_PROGRAM_UNIFORM_2IV:
12226 CALL_ProgramUniform2iv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12227 get_pointer(&n[4])));
12228 break;
12229 case OPCODE_PROGRAM_UNIFORM_3IV:
12230 CALL_ProgramUniform3iv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12231 get_pointer(&n[4])));
12232 break;
12233 case OPCODE_PROGRAM_UNIFORM_4IV:
12234 CALL_ProgramUniform4iv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12235 get_pointer(&n[4])));
12236 break;
12237 case OPCODE_PROGRAM_UNIFORM_1UI:
12238 CALL_ProgramUniform1ui(ctx->Exec, (n[1].ui, n[2].i, n[3].ui));
12239 break;
12240 case OPCODE_PROGRAM_UNIFORM_2UI:
12241 CALL_ProgramUniform2ui(ctx->Exec, (n[1].ui, n[2].i,
12242 n[3].ui, n[4].ui));
12243 break;
12244 case OPCODE_PROGRAM_UNIFORM_3UI:
12245 CALL_ProgramUniform3ui(ctx->Exec, (n[1].ui, n[2].i,
12246 n[3].ui, n[4].ui, n[5].ui));
12247 break;
12248 case OPCODE_PROGRAM_UNIFORM_4UI:
12249 CALL_ProgramUniform4ui(ctx->Exec, (n[1].ui, n[2].i,
12250 n[3].ui,
12251 n[4].ui, n[5].ui, n[6].ui));
12252 break;
12253 case OPCODE_PROGRAM_UNIFORM_1UIV:
12254 CALL_ProgramUniform1uiv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12255 get_pointer(&n[4])));
12256 break;
12257 case OPCODE_PROGRAM_UNIFORM_2UIV:
12258 CALL_ProgramUniform2uiv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12259 get_pointer(&n[4])));
12260 break;
12261 case OPCODE_PROGRAM_UNIFORM_3UIV:
12262 CALL_ProgramUniform3uiv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12263 get_pointer(&n[4])));
12264 break;
12265 case OPCODE_PROGRAM_UNIFORM_4UIV:
12266 CALL_ProgramUniform4uiv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12267 get_pointer(&n[4])));
12268 break;
12269 case OPCODE_PROGRAM_UNIFORM_MATRIX22F:
12270 CALL_ProgramUniformMatrix2fv(ctx->Exec,
12271 (n[1].ui, n[2].i, n[3].i, n[4].b,
12272 get_pointer(&n[5])));
12273 break;
12274 case OPCODE_PROGRAM_UNIFORM_MATRIX23F:
12275 CALL_ProgramUniformMatrix2x3fv(ctx->Exec,
12276 (n[1].ui, n[2].i, n[3].i, n[4].b,
12277 get_pointer(&n[5])));
12278 break;
12279 case OPCODE_PROGRAM_UNIFORM_MATRIX24F:
12280 CALL_ProgramUniformMatrix2x4fv(ctx->Exec,
12281 (n[1].ui, n[2].i, n[3].i, n[4].b,
12282 get_pointer(&n[5])));
12283 break;
12284 case OPCODE_PROGRAM_UNIFORM_MATRIX32F:
12285 CALL_ProgramUniformMatrix3x2fv(ctx->Exec,
12286 (n[1].ui, n[2].i, n[3].i, n[4].b,
12287 get_pointer(&n[5])));
12288 break;
12289 case OPCODE_PROGRAM_UNIFORM_MATRIX33F:
12290 CALL_ProgramUniformMatrix3fv(ctx->Exec,
12291 (n[1].ui, n[2].i, n[3].i, n[4].b,
12292 get_pointer(&n[5])));
12293 break;
12294 case OPCODE_PROGRAM_UNIFORM_MATRIX34F:
12295 CALL_ProgramUniformMatrix3x4fv(ctx->Exec,
12296 (n[1].ui, n[2].i, n[3].i, n[4].b,
12297 get_pointer(&n[5])));
12298 break;
12299 case OPCODE_PROGRAM_UNIFORM_MATRIX42F:
12300 CALL_ProgramUniformMatrix4x2fv(ctx->Exec,
12301 (n[1].ui, n[2].i, n[3].i, n[4].b,
12302 get_pointer(&n[5])));
12303 break;
12304 case OPCODE_PROGRAM_UNIFORM_MATRIX43F:
12305 CALL_ProgramUniformMatrix4x3fv(ctx->Exec,
12306 (n[1].ui, n[2].i, n[3].i, n[4].b,
12307 get_pointer(&n[5])));
12308 break;
12309 case OPCODE_PROGRAM_UNIFORM_MATRIX44F:
12310 CALL_ProgramUniformMatrix4fv(ctx->Exec,
12311 (n[1].ui, n[2].i, n[3].i, n[4].b,
12312 get_pointer(&n[5])));
12313 break;
12314 case OPCODE_PROGRAM_UNIFORM_MATRIX22D:
12315 CALL_ProgramUniformMatrix2dv(ctx->Exec,
12316 (n[1].ui, n[2].i, n[3].i, n[4].b,
12317 get_pointer(&n[5])));
12318 break;
12319 case OPCODE_PROGRAM_UNIFORM_MATRIX23D:
12320 CALL_ProgramUniformMatrix2x3dv(ctx->Exec,
12321 (n[1].ui, n[2].i, n[3].i, n[4].b,
12322 get_pointer(&n[5])));
12323 break;
12324 case OPCODE_PROGRAM_UNIFORM_MATRIX24D:
12325 CALL_ProgramUniformMatrix2x4dv(ctx->Exec,
12326 (n[1].ui, n[2].i, n[3].i, n[4].b,
12327 get_pointer(&n[5])));
12328 break;
12329 case OPCODE_PROGRAM_UNIFORM_MATRIX32D:
12330 CALL_ProgramUniformMatrix3x2dv(ctx->Exec,
12331 (n[1].ui, n[2].i, n[3].i, n[4].b,
12332 get_pointer(&n[5])));
12333 break;
12334 case OPCODE_PROGRAM_UNIFORM_MATRIX33D:
12335 CALL_ProgramUniformMatrix3dv(ctx->Exec,
12336 (n[1].ui, n[2].i, n[3].i, n[4].b,
12337 get_pointer(&n[5])));
12338 break;
12339 case OPCODE_PROGRAM_UNIFORM_MATRIX34D:
12340 CALL_ProgramUniformMatrix3x4dv(ctx->Exec,
12341 (n[1].ui, n[2].i, n[3].i, n[4].b,
12342 get_pointer(&n[5])));
12343 break;
12344 case OPCODE_PROGRAM_UNIFORM_MATRIX42D:
12345 CALL_ProgramUniformMatrix4x2dv(ctx->Exec,
12346 (n[1].ui, n[2].i, n[3].i, n[4].b,
12347 get_pointer(&n[5])));
12348 break;
12349 case OPCODE_PROGRAM_UNIFORM_MATRIX43D:
12350 CALL_ProgramUniformMatrix4x3dv(ctx->Exec,
12351 (n[1].ui, n[2].i, n[3].i, n[4].b,
12352 get_pointer(&n[5])));
12353 break;
12354 case OPCODE_PROGRAM_UNIFORM_MATRIX44D:
12355 CALL_ProgramUniformMatrix4dv(ctx->Exec,
12356 (n[1].ui, n[2].i, n[3].i, n[4].b,
12357 get_pointer(&n[5])));
12358 break;
12359
12360 case OPCODE_CLIP_CONTROL:
12361 CALL_ClipControl(ctx->Exec, (n[1].e, n[2].e));
12362 break;
12363
12364 case OPCODE_CLAMP_COLOR:
12365 CALL_ClampColor(ctx->Exec, (n[1].e, n[2].e));
12366 break;
12367
12368 case OPCODE_BIND_FRAGMENT_SHADER_ATI:
12369 CALL_BindFragmentShaderATI(ctx->Exec, (n[1].i));
12370 break;
12371 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI:
12372 CALL_SetFragmentShaderConstantATI(ctx->Exec, (n[1].ui, &n[2].f));
12373 break;
12374 case OPCODE_ATTR_1F_NV:
12375 CALL_VertexAttrib1fNV(ctx->Exec, (n[1].e, n[2].f));
12376 break;
12377 case OPCODE_ATTR_2F_NV:
12378 CALL_VertexAttrib2fvNV(ctx->Exec, (n[1].e, &n[2].f));
12379 break;
12380 case OPCODE_ATTR_3F_NV:
12381 CALL_VertexAttrib3fvNV(ctx->Exec, (n[1].e, &n[2].f));
12382 break;
12383 case OPCODE_ATTR_4F_NV:
12384 CALL_VertexAttrib4fvNV(ctx->Exec, (n[1].e, &n[2].f));
12385 break;
12386 case OPCODE_ATTR_1F_ARB:
12387 CALL_VertexAttrib1fARB(ctx->Exec, (n[1].e, n[2].f));
12388 break;
12389 case OPCODE_ATTR_2F_ARB:
12390 CALL_VertexAttrib2fvARB(ctx->Exec, (n[1].e, &n[2].f));
12391 break;
12392 case OPCODE_ATTR_3F_ARB:
12393 CALL_VertexAttrib3fvARB(ctx->Exec, (n[1].e, &n[2].f));
12394 break;
12395 case OPCODE_ATTR_4F_ARB:
12396 CALL_VertexAttrib4fvARB(ctx->Exec, (n[1].e, &n[2].f));
12397 break;
12398 case OPCODE_ATTR_1D: {
12399 GLdouble *d = (GLdouble *) &n[2];
12400 CALL_VertexAttribL1d(ctx->Exec, (n[1].ui, *d));
12401 break;
12402 }
12403 case OPCODE_ATTR_2D: {
12404 GLdouble *d = (GLdouble *) &n[2];
12405 CALL_VertexAttribL2dv(ctx->Exec, (n[1].ui, d));
12406 break;
12407 }
12408 case OPCODE_ATTR_3D: {
12409 GLdouble *d = (GLdouble *) &n[2];
12410 CALL_VertexAttribL3dv(ctx->Exec, (n[1].ui, d));
12411 break;
12412 }
12413 case OPCODE_ATTR_4D: {
12414 GLdouble *d = (GLdouble *) &n[2];
12415 CALL_VertexAttribL4dv(ctx->Exec, (n[1].ui, d));
12416 break;
12417 }
12418 case OPCODE_MATERIAL:
12419 CALL_Materialfv(ctx->Exec, (n[1].e, n[2].e, &n[3].f));
12420 break;
12421 case OPCODE_BEGIN:
12422 CALL_Begin(ctx->Exec, (n[1].e));
12423 break;
12424 case OPCODE_END:
12425 CALL_End(ctx->Exec, ());
12426 break;
12427 case OPCODE_RECTF:
12428 CALL_Rectf(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
12429 break;
12430 case OPCODE_EVAL_C1:
12431 CALL_EvalCoord1f(ctx->Exec, (n[1].f));
12432 break;
12433 case OPCODE_EVAL_C2:
12434 CALL_EvalCoord2f(ctx->Exec, (n[1].f, n[2].f));
12435 break;
12436 case OPCODE_EVAL_P1:
12437 CALL_EvalPoint1(ctx->Exec, (n[1].i));
12438 break;
12439 case OPCODE_EVAL_P2:
12440 CALL_EvalPoint2(ctx->Exec, (n[1].i, n[2].i));
12441 break;
12442
12443 /* GL_EXT_texture_integer */
12444 case OPCODE_CLEARCOLOR_I:
12445 CALL_ClearColorIiEXT(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
12446 break;
12447 case OPCODE_CLEARCOLOR_UI:
12448 CALL_ClearColorIuiEXT(ctx->Exec,
12449 (n[1].ui, n[2].ui, n[3].ui, n[4].ui));
12450 break;
12451 case OPCODE_TEXPARAMETER_I:
12452 {
12453 GLint params[4];
12454 params[0] = n[3].i;
12455 params[1] = n[4].i;
12456 params[2] = n[5].i;
12457 params[3] = n[6].i;
12458 CALL_TexParameterIiv(ctx->Exec, (n[1].e, n[2].e, params));
12459 }
12460 break;
12461 case OPCODE_TEXPARAMETER_UI:
12462 {
12463 GLuint params[4];
12464 params[0] = n[3].ui;
12465 params[1] = n[4].ui;
12466 params[2] = n[5].ui;
12467 params[3] = n[6].ui;
12468 CALL_TexParameterIuiv(ctx->Exec, (n[1].e, n[2].e, params));
12469 }
12470 break;
12471
12472 case OPCODE_VERTEX_ATTRIB_DIVISOR:
12473 /* GL_ARB_instanced_arrays */
12474 CALL_VertexAttribDivisor(ctx->Exec, (n[1].ui, n[2].ui));
12475 break;
12476
12477 case OPCODE_TEXTURE_BARRIER_NV:
12478 CALL_TextureBarrierNV(ctx->Exec, ());
12479 break;
12480
12481 /* GL_EXT/ARB_transform_feedback */
12482 case OPCODE_BEGIN_TRANSFORM_FEEDBACK:
12483 CALL_BeginTransformFeedback(ctx->Exec, (n[1].e));
12484 break;
12485 case OPCODE_END_TRANSFORM_FEEDBACK:
12486 CALL_EndTransformFeedback(ctx->Exec, ());
12487 break;
12488 case OPCODE_BIND_TRANSFORM_FEEDBACK:
12489 CALL_BindTransformFeedback(ctx->Exec, (n[1].e, n[2].ui));
12490 break;
12491 case OPCODE_PAUSE_TRANSFORM_FEEDBACK:
12492 CALL_PauseTransformFeedback(ctx->Exec, ());
12493 break;
12494 case OPCODE_RESUME_TRANSFORM_FEEDBACK:
12495 CALL_ResumeTransformFeedback(ctx->Exec, ());
12496 break;
12497 case OPCODE_DRAW_TRANSFORM_FEEDBACK:
12498 CALL_DrawTransformFeedback(ctx->Exec, (n[1].e, n[2].ui));
12499 break;
12500 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM:
12501 CALL_DrawTransformFeedbackStream(ctx->Exec,
12502 (n[1].e, n[2].ui, n[3].ui));
12503 break;
12504 case OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED:
12505 CALL_DrawTransformFeedbackInstanced(ctx->Exec,
12506 (n[1].e, n[2].ui, n[3].si));
12507 break;
12508 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED:
12509 CALL_DrawTransformFeedbackStreamInstanced(ctx->Exec,
12510 (n[1].e, n[2].ui, n[3].ui, n[4].si));
12511 break;
12512
12513
12514 case OPCODE_BIND_SAMPLER:
12515 CALL_BindSampler(ctx->Exec, (n[1].ui, n[2].ui));
12516 break;
12517 case OPCODE_SAMPLER_PARAMETERIV:
12518 {
12519 GLint params[4];
12520 params[0] = n[3].i;
12521 params[1] = n[4].i;
12522 params[2] = n[5].i;
12523 params[3] = n[6].i;
12524 CALL_SamplerParameteriv(ctx->Exec, (n[1].ui, n[2].e, params));
12525 }
12526 break;
12527 case OPCODE_SAMPLER_PARAMETERFV:
12528 {
12529 GLfloat params[4];
12530 params[0] = n[3].f;
12531 params[1] = n[4].f;
12532 params[2] = n[5].f;
12533 params[3] = n[6].f;
12534 CALL_SamplerParameterfv(ctx->Exec, (n[1].ui, n[2].e, params));
12535 }
12536 break;
12537 case OPCODE_SAMPLER_PARAMETERIIV:
12538 {
12539 GLint params[4];
12540 params[0] = n[3].i;
12541 params[1] = n[4].i;
12542 params[2] = n[5].i;
12543 params[3] = n[6].i;
12544 CALL_SamplerParameterIiv(ctx->Exec, (n[1].ui, n[2].e, params));
12545 }
12546 break;
12547 case OPCODE_SAMPLER_PARAMETERUIV:
12548 {
12549 GLuint params[4];
12550 params[0] = n[3].ui;
12551 params[1] = n[4].ui;
12552 params[2] = n[5].ui;
12553 params[3] = n[6].ui;
12554 CALL_SamplerParameterIuiv(ctx->Exec, (n[1].ui, n[2].e, params));
12555 }
12556 break;
12557
12558 /* ARB_compute_shader */
12559 case OPCODE_DISPATCH_COMPUTE:
12560 CALL_DispatchCompute(ctx->Exec, (n[1].ui, n[2].ui, n[3].ui));
12561 break;
12562
12563 /* GL_ARB_sync */
12564 case OPCODE_WAIT_SYNC:
12565 {
12566 union uint64_pair p;
12567 p.uint32[0] = n[2].ui;
12568 p.uint32[1] = n[3].ui;
12569 CALL_WaitSync(ctx->Exec,
12570 (get_pointer(&n[4]), n[1].bf, p.uint64));
12571 }
12572 break;
12573
12574 /* GL_NV_conditional_render */
12575 case OPCODE_BEGIN_CONDITIONAL_RENDER:
12576 CALL_BeginConditionalRender(ctx->Exec, (n[1].i, n[2].e));
12577 break;
12578 case OPCODE_END_CONDITIONAL_RENDER:
12579 CALL_EndConditionalRender(ctx->Exec, ());
12580 break;
12581
12582 case OPCODE_UNIFORM_BLOCK_BINDING:
12583 CALL_UniformBlockBinding(ctx->Exec, (n[1].ui, n[2].ui, n[3].ui));
12584 break;
12585
12586 case OPCODE_UNIFORM_SUBROUTINES:
12587 CALL_UniformSubroutinesuiv(ctx->Exec, (n[1].e, n[2].si,
12588 get_pointer(&n[3])));
12589 break;
12590
12591 /* GL_EXT_window_rectangles */
12592 case OPCODE_WINDOW_RECTANGLES:
12593 CALL_WindowRectanglesEXT(
12594 ctx->Exec, (n[1].e, n[2].si, get_pointer(&n[3])));
12595 break;
12596
12597 /* GL_NV_conservative_raster */
12598 case OPCODE_SUBPIXEL_PRECISION_BIAS:
12599 CALL_SubpixelPrecisionBiasNV(ctx->Exec, (n[1].ui, n[2].ui));
12600 break;
12601
12602 /* GL_NV_conservative_raster_dilate */
12603 case OPCODE_CONSERVATIVE_RASTER_PARAMETER_F:
12604 CALL_ConservativeRasterParameterfNV(ctx->Exec, (n[1].e, n[2].f));
12605 break;
12606
12607 /* GL_NV_conservative_raster_pre_snap_triangles */
12608 case OPCODE_CONSERVATIVE_RASTER_PARAMETER_I:
12609 CALL_ConservativeRasterParameteriNV(ctx->Exec, (n[1].e, n[2].i));
12610 break;
12611
12612 /* GL_EXT_direct_state_access */
12613 case OPCODE_MATRIX_LOAD:
12614 CALL_MatrixLoadfEXT(ctx->Exec, (n[1].e, &n[2].f));
12615 break;
12616 case OPCODE_MATRIX_MULT:
12617 CALL_MatrixMultfEXT(ctx->Exec, (n[1].e, &n[2].f));
12618 break;
12619 case OPCODE_MATRIX_ROTATE:
12620 CALL_MatrixRotatefEXT(ctx->Exec, (n[1].e, n[2].f, n[3].f, n[4].f, n[5].f));
12621 break;
12622 case OPCODE_MATRIX_SCALE:
12623 CALL_MatrixScalefEXT(ctx->Exec, (n[1].e, n[2].f, n[3].f, n[4].f));
12624 break;
12625 case OPCODE_MATRIX_TRANSLATE:
12626 CALL_MatrixTranslatefEXT(ctx->Exec, (n[1].e, n[2].f, n[3].f, n[4].f));
12627 break;
12628 case OPCODE_MATRIX_LOAD_IDENTITY:
12629 CALL_MatrixLoadIdentityEXT(ctx->Exec, (n[1].e));
12630 break;
12631 case OPCODE_MATRIX_ORTHO:
12632 CALL_MatrixOrthoEXT(ctx->Exec, (n[1].e,
12633 n[2].f, n[3].f, n[4].f,
12634 n[5].f, n[6].f, n[7].f));
12635 break;
12636 case OPCODE_MATRIX_FRUSTUM:
12637 CALL_MatrixFrustumEXT(ctx->Exec, (n[1].e,
12638 n[2].f, n[3].f, n[4].f,
12639 n[5].f, n[6].f, n[7].f));
12640 break;
12641 case OPCODE_MATRIX_PUSH:
12642 CALL_MatrixPushEXT(ctx->Exec, (n[1].e));
12643 break;
12644 case OPCODE_MATRIX_POP:
12645 CALL_MatrixPopEXT(ctx->Exec, (n[1].e));
12646 break;
12647 case OPCODE_TEXTUREPARAMETER_F:
12648 {
12649 GLfloat params[4];
12650 params[0] = n[4].f;
12651 params[1] = n[5].f;
12652 params[2] = n[6].f;
12653 params[3] = n[7].f;
12654 CALL_TextureParameterfvEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].e, params));
12655 }
12656 break;
12657 case OPCODE_TEXTUREPARAMETER_I:
12658 {
12659 GLint params[4];
12660 params[0] = n[4].i;
12661 params[1] = n[5].i;
12662 params[2] = n[6].i;
12663 params[3] = n[7].i;
12664 CALL_TextureParameterivEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].e, params));
12665 }
12666 break;
12667 case OPCODE_TEXTUREPARAMETER_II:
12668 {
12669 GLint params[4];
12670 params[0] = n[4].i;
12671 params[1] = n[5].i;
12672 params[2] = n[6].i;
12673 params[3] = n[7].i;
12674 CALL_TextureParameterIivEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].e, params));
12675 }
12676 break;
12677 case OPCODE_TEXTUREPARAMETER_IUI:
12678 {
12679 GLuint params[4];
12680 params[0] = n[4].ui;
12681 params[1] = n[5].ui;
12682 params[2] = n[6].ui;
12683 params[3] = n[7].ui;
12684 CALL_TextureParameterIuivEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].e, params));
12685 }
12686 break;
12687 case OPCODE_TEXTURE_IMAGE1D:
12688 {
12689 const struct gl_pixelstore_attrib save = ctx->Unpack;
12690 ctx->Unpack = ctx->DefaultPacking;
12691 CALL_TextureImage1DEXT(ctx->Exec, (n[1].ui, /* texture */
12692 n[2].e, /* target */
12693 n[3].i, /* level */
12694 n[4].i, /* components */
12695 n[5].i, /* width */
12696 n[6].e, /* border */
12697 n[7].e, /* format */
12698 n[8].e, /* type */
12699 get_pointer(&n[9])));
12700 ctx->Unpack = save; /* restore */
12701 }
12702 break;
12703 case OPCODE_TEXTURE_IMAGE2D:
12704 {
12705 const struct gl_pixelstore_attrib save = ctx->Unpack;
12706 ctx->Unpack = ctx->DefaultPacking;
12707 CALL_TextureImage2DEXT(ctx->Exec, (n[1].ui, /* texture */
12708 n[2].e, /* target */
12709 n[3].i, /* level */
12710 n[4].i, /* components */
12711 n[5].i, /* width */
12712 n[6].i, /* height */
12713 n[7].e, /* border */
12714 n[8].e, /* format */
12715 n[9].e, /* type */
12716 get_pointer(&n[10])));
12717 ctx->Unpack = save; /* restore */
12718 }
12719 break;
12720 case OPCODE_TEXTURE_IMAGE3D:
12721 {
12722 const struct gl_pixelstore_attrib save = ctx->Unpack;
12723 ctx->Unpack = ctx->DefaultPacking;
12724 CALL_TextureImage3DEXT(ctx->Exec, (n[1].ui, /* texture */
12725 n[2].e, /* target */
12726 n[3].i, /* level */
12727 n[4].i, /* components */
12728 n[5].i, /* width */
12729 n[6].i, /* height */
12730 n[7].i, /* depth */
12731 n[8].e, /* border */
12732 n[9].e, /* format */
12733 n[10].e, /* type */
12734 get_pointer(&n[11])));
12735 ctx->Unpack = save; /* restore */
12736 }
12737 break;
12738 case OPCODE_TEXTURE_SUB_IMAGE1D:
12739 {
12740 const struct gl_pixelstore_attrib save = ctx->Unpack;
12741 ctx->Unpack = ctx->DefaultPacking;
12742 CALL_TextureSubImage1DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
12743 n[4].i, n[5].i, n[6].e,
12744 n[7].e, get_pointer(&n[8])));
12745 ctx->Unpack = save; /* restore */
12746 }
12747 break;
12748 case OPCODE_TEXTURE_SUB_IMAGE2D:
12749 {
12750 const struct gl_pixelstore_attrib save = ctx->Unpack;
12751 ctx->Unpack = ctx->DefaultPacking;
12752 CALL_TextureSubImage2DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
12753 n[4].i, n[5].i, n[6].e,
12754 n[7].i, n[8].e, n[9].e,
12755 get_pointer(&n[10])));
12756 ctx->Unpack = save;
12757 }
12758 break;
12759 case OPCODE_TEXTURE_SUB_IMAGE3D:
12760 {
12761 const struct gl_pixelstore_attrib save = ctx->Unpack;
12762 ctx->Unpack = ctx->DefaultPacking;
12763 CALL_TextureSubImage3DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
12764 n[4].i, n[5].i, n[6].i,
12765 n[7].i, n[8].i, n[9].i,
12766 n[10].e, n[11].e,
12767 get_pointer(&n[12])));
12768 ctx->Unpack = save; /* restore */
12769 }
12770 break;
12771 case OPCODE_COPY_TEXTURE_IMAGE1D:
12772 CALL_CopyTextureImage1DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
12773 n[4].e, n[5].i, n[6].i,
12774 n[7].i, n[8].i));
12775 break;
12776 case OPCODE_COPY_TEXTURE_IMAGE2D:
12777 CALL_CopyTextureImage2DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
12778 n[4].e, n[5].i, n[6].i,
12779 n[7].i, n[8].i, n[9].i));
12780 break;
12781 case OPCODE_COPY_TEXTURE_SUB_IMAGE1D:
12782 CALL_CopyTextureSubImage1DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
12783 n[4].i, n[5].i, n[6].i,
12784 n[7].i));
12785 break;
12786 case OPCODE_COPY_TEXTURE_SUB_IMAGE2D:
12787 CALL_CopyTextureSubImage2DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
12788 n[4].i, n[5].i, n[6].i,
12789 n[7].i, n[8].i, n[9].i));
12790 break;
12791 case OPCODE_COPY_TEXTURE_SUB_IMAGE3D:
12792 CALL_CopyTextureSubImage3DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
12793 n[4].i, n[5].i, n[6].i,
12794 n[7].i, n[8].i, n[9].i,
12795 n[10].i));
12796 break;
12797 case OPCODE_BIND_MULTITEXTURE:
12798 CALL_BindMultiTextureEXT(ctx->Exec, (n[1].e, n[2].e, n[3].ui));
12799 break;
12800 case OPCODE_MULTITEXPARAMETER_F:
12801 {
12802 GLfloat params[4];
12803 params[0] = n[4].f;
12804 params[1] = n[5].f;
12805 params[2] = n[6].f;
12806 params[3] = n[7].f;
12807 CALL_MultiTexParameterfvEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, params));
12808 }
12809 break;
12810 case OPCODE_MULTITEXPARAMETER_I:
12811 {
12812 GLint params[4];
12813 params[0] = n[4].i;
12814 params[1] = n[5].i;
12815 params[2] = n[6].i;
12816 params[3] = n[7].i;
12817 CALL_MultiTexParameterivEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, params));
12818 }
12819 break;
12820 case OPCODE_MULTITEXPARAMETER_II:
12821 {
12822 GLint params[4];
12823 params[0] = n[4].i;
12824 params[1] = n[5].i;
12825 params[2] = n[6].i;
12826 params[3] = n[7].i;
12827 CALL_MultiTexParameterIivEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, params));
12828 }
12829 break;
12830 case OPCODE_MULTITEXPARAMETER_IUI:
12831 {
12832 GLuint params[4];
12833 params[0] = n[4].ui;
12834 params[1] = n[5].ui;
12835 params[2] = n[6].ui;
12836 params[3] = n[7].ui;
12837 CALL_MultiTexParameterIuivEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, params));
12838 }
12839 break;
12840 case OPCODE_MULTITEX_IMAGE1D:
12841 {
12842 const struct gl_pixelstore_attrib save = ctx->Unpack;
12843 ctx->Unpack = ctx->DefaultPacking;
12844 CALL_MultiTexImage1DEXT(ctx->Exec, (n[1].e, /* texture */
12845 n[2].e, /* target */
12846 n[3].i, /* level */
12847 n[4].i, /* components */
12848 n[5].i, /* width */
12849 n[6].e, /* border */
12850 n[7].e, /* format */
12851 n[8].e, /* type */
12852 get_pointer(&n[9])));
12853 ctx->Unpack = save; /* restore */
12854 }
12855 break;
12856 case OPCODE_MULTITEX_IMAGE2D:
12857 {
12858 const struct gl_pixelstore_attrib save = ctx->Unpack;
12859 ctx->Unpack = ctx->DefaultPacking;
12860 CALL_MultiTexImage2DEXT(ctx->Exec, (n[1].e, /* texture */
12861 n[2].e, /* target */
12862 n[3].i, /* level */
12863 n[4].i, /* components */
12864 n[5].i, /* width */
12865 n[6].i, /* height */
12866 n[7].e, /* border */
12867 n[8].e, /* format */
12868 n[9].e, /* type */
12869 get_pointer(&n[10])));
12870 ctx->Unpack = save; /* restore */
12871 }
12872 break;
12873 case OPCODE_MULTITEX_IMAGE3D:
12874 {
12875 const struct gl_pixelstore_attrib save = ctx->Unpack;
12876 ctx->Unpack = ctx->DefaultPacking;
12877 CALL_MultiTexImage3DEXT(ctx->Exec, (n[1].e, /* texture */
12878 n[2].e, /* target */
12879 n[3].i, /* level */
12880 n[4].i, /* components */
12881 n[5].i, /* width */
12882 n[6].i, /* height */
12883 n[7].i, /* depth */
12884 n[8].e, /* border */
12885 n[9].e, /* format */
12886 n[10].e, /* type */
12887 get_pointer(&n[11])));
12888 ctx->Unpack = save; /* restore */
12889 }
12890 break;
12891 case OPCODE_MULTITEX_SUB_IMAGE1D:
12892 {
12893 const struct gl_pixelstore_attrib save = ctx->Unpack;
12894 ctx->Unpack = ctx->DefaultPacking;
12895 CALL_MultiTexSubImage1DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
12896 n[4].i, n[5].i, n[6].e,
12897 n[7].e, get_pointer(&n[8])));
12898 ctx->Unpack = save; /* restore */
12899 }
12900 break;
12901 case OPCODE_MULTITEX_SUB_IMAGE2D:
12902 {
12903 const struct gl_pixelstore_attrib save = ctx->Unpack;
12904 ctx->Unpack = ctx->DefaultPacking;
12905 CALL_MultiTexSubImage2DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
12906 n[4].i, n[5].i, n[6].e,
12907 n[7].i, n[8].e, n[9].e,
12908 get_pointer(&n[10])));
12909 ctx->Unpack = save; /* restore */
12910 }
12911 break;
12912 case OPCODE_MULTITEX_SUB_IMAGE3D:
12913 {
12914 const struct gl_pixelstore_attrib save = ctx->Unpack;
12915 ctx->Unpack = ctx->DefaultPacking;
12916 CALL_MultiTexSubImage3DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
12917 n[4].i, n[5].i, n[6].i,
12918 n[7].i, n[8].i, n[9].i,
12919 n[10].e, n[11].e,
12920 get_pointer(&n[12])));
12921 ctx->Unpack = save; /* restore */
12922 }
12923 break;
12924 case OPCODE_COPY_MULTITEX_IMAGE1D:
12925 CALL_CopyMultiTexImage1DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
12926 n[4].e, n[5].i, n[6].i,
12927 n[7].i, n[8].i));
12928 break;
12929 case OPCODE_COPY_MULTITEX_IMAGE2D:
12930 CALL_CopyMultiTexImage2DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
12931 n[4].e, n[5].i, n[6].i,
12932 n[7].i, n[8].i, n[9].i));
12933 break;
12934 case OPCODE_COPY_MULTITEX_SUB_IMAGE1D:
12935 CALL_CopyMultiTexSubImage1DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
12936 n[4].i, n[5].i, n[6].i,
12937 n[7].i));
12938 break;
12939 case OPCODE_COPY_MULTITEX_SUB_IMAGE2D:
12940 CALL_CopyMultiTexSubImage2DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
12941 n[4].i, n[5].i, n[6].i,
12942 n[7].i, n[8].i, n[9].i));
12943 break;
12944 case OPCODE_COPY_MULTITEX_SUB_IMAGE3D:
12945 CALL_CopyMultiTexSubImage3DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
12946 n[4].i, n[5].i, n[6].i,
12947 n[7].i, n[8].i, n[9].i,
12948 n[10].i));
12949 break;
12950 case OPCODE_MULTITEXENV:
12951 {
12952 GLfloat params[4];
12953 params[0] = n[4].f;
12954 params[1] = n[5].f;
12955 params[2] = n[6].f;
12956 params[3] = n[7].f;
12957 CALL_MultiTexEnvfvEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, params));
12958 }
12959 break;
12960 case OPCODE_COMPRESSED_TEXTURE_IMAGE_1D:
12961 CALL_CompressedTextureImage1DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
12962 n[4].e, n[5].i, n[6].i,
12963 n[7].i, get_pointer(&n[8])));
12964 break;
12965 case OPCODE_COMPRESSED_TEXTURE_IMAGE_2D:
12966 CALL_CompressedTextureImage2DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
12967 n[4].e, n[5].i, n[6].i,
12968 n[7].i, n[8].i,
12969 get_pointer(&n[9])));
12970 break;
12971 case OPCODE_COMPRESSED_TEXTURE_IMAGE_3D:
12972 CALL_CompressedTextureImage3DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
12973 n[4].e, n[5].i, n[6].i,
12974 n[7].i, n[8].i, n[9].i,
12975 get_pointer(&n[10])));
12976 break;
12977 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_1D:
12978 CALL_CompressedTextureSubImage1DEXT(ctx->Exec,
12979 (n[1].ui, n[2].e, n[3].i, n[4].i,
12980 n[5].i, n[6].e, n[7].i,
12981 get_pointer(&n[8])));
12982 break;
12983 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_2D:
12984 CALL_CompressedTextureSubImage2DEXT(ctx->Exec,
12985 (n[1].ui, n[2].e, n[3].i, n[4].i,
12986 n[5].i, n[6].i, n[7].i, n[8].e,
12987 n[9].i, get_pointer(&n[10])));
12988 break;
12989 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_3D:
12990 CALL_CompressedTextureSubImage3DEXT(ctx->Exec,
12991 (n[1].ui, n[2].e, n[3].i, n[4].i,
12992 n[5].i, n[6].i, n[7].i, n[8].i,
12993 n[9].i, n[10].e, n[11].i,
12994 get_pointer(&n[12])));
12995 break;
12996 case OPCODE_COMPRESSED_MULTITEX_IMAGE_1D:
12997 CALL_CompressedMultiTexImage1DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
12998 n[4].e, n[5].i, n[6].i,
12999 n[7].i, get_pointer(&n[8])));
13000 break;
13001 case OPCODE_COMPRESSED_MULTITEX_IMAGE_2D:
13002 CALL_CompressedMultiTexImage2DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13003 n[4].e, n[5].i, n[6].i,
13004 n[7].i, n[8].i,
13005 get_pointer(&n[9])));
13006 break;
13007 case OPCODE_COMPRESSED_MULTITEX_IMAGE_3D:
13008 CALL_CompressedMultiTexImage3DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13009 n[4].e, n[5].i, n[6].i,
13010 n[7].i, n[8].i, n[9].i,
13011 get_pointer(&n[10])));
13012 break;
13013 case OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_1D:
13014 CALL_CompressedMultiTexSubImage1DEXT(ctx->Exec,
13015 (n[1].e, n[2].e, n[3].i, n[4].i,
13016 n[5].i, n[6].e, n[7].i,
13017 get_pointer(&n[8])));
13018 break;
13019 case OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_2D:
13020 CALL_CompressedMultiTexSubImage2DEXT(ctx->Exec,
13021 (n[1].e, n[2].e, n[3].i, n[4].i,
13022 n[5].i, n[6].i, n[7].i, n[8].e,
13023 n[9].i, get_pointer(&n[10])));
13024 break;
13025 case OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_3D:
13026 CALL_CompressedMultiTexSubImage3DEXT(ctx->Exec,
13027 (n[1].e, n[2].e, n[3].i, n[4].i,
13028 n[5].i, n[6].i, n[7].i, n[8].i,
13029 n[9].i, n[10].e, n[11].i,
13030 get_pointer(&n[12])));
13031 break;
13032 case OPCODE_NAMED_PROGRAM_STRING:
13033 CALL_NamedProgramStringEXT(ctx->Exec,
13034 (n[1].ui, n[2].e, n[3].e, n[4].i,
13035 get_pointer(&n[5])));
13036 break;
13037 case OPCODE_NAMED_PROGRAM_LOCAL_PARAMETER:
13038 CALL_NamedProgramLocalParameter4fEXT(ctx->Exec,
13039 (n[1].ui, n[2].e, n[3].ui, n[4].f,
13040 n[5].f, n[6].f, n[7].f));
13041 break;
13042
13043 case OPCODE_CONTINUE:
13044 n = (Node *) get_pointer(&n[1]);
13045 break;
13046 case OPCODE_NOP:
13047 /* no-op */
13048 break;
13049 case OPCODE_END_OF_LIST:
13050 done = GL_TRUE;
13051 break;
13052 default:
13053 {
13054 char msg[1000];
13055 _mesa_snprintf(msg, sizeof(msg), "Error in execute_list: opcode=%d",
13056 (int) opcode);
13057 _mesa_problem(ctx, "%s", msg);
13058 }
13059 done = GL_TRUE;
13060 }
13061
13062 /* increment n to point to next compiled command */
13063 if (opcode != OPCODE_CONTINUE) {
13064 assert(InstSize[opcode] > 0);
13065 n += InstSize[opcode];
13066 }
13067 }
13068 }
13069
13070 vbo_save_EndCallList(ctx);
13071
13072 ctx->ListState.CallDepth--;
13073 }
13074
13075
13076
13077 /**********************************************************************/
13078 /* GL functions */
13079 /**********************************************************************/
13080
13081 /**
13082 * Test if a display list number is valid.
13083 */
13084 GLboolean GLAPIENTRY
13085 _mesa_IsList(GLuint list)
13086 {
13087 GET_CURRENT_CONTEXT(ctx);
13088 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
13089 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
13090 return islist(ctx, list);
13091 }
13092
13093
13094 /**
13095 * Delete a sequence of consecutive display lists.
13096 */
13097 void GLAPIENTRY
13098 _mesa_DeleteLists(GLuint list, GLsizei range)
13099 {
13100 GET_CURRENT_CONTEXT(ctx);
13101 GLuint i;
13102 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
13103 ASSERT_OUTSIDE_BEGIN_END(ctx);
13104
13105 if (range < 0) {
13106 _mesa_error(ctx, GL_INVALID_VALUE, "glDeleteLists");
13107 return;
13108 }
13109
13110 if (range > 1) {
13111 /* We may be deleting a set of bitmap lists. See if there's a
13112 * bitmap atlas to free.
13113 */
13114 struct gl_bitmap_atlas *atlas = lookup_bitmap_atlas(ctx, list);
13115 if (atlas) {
13116 _mesa_delete_bitmap_atlas(ctx, atlas);
13117 _mesa_HashRemove(ctx->Shared->BitmapAtlas, list);
13118 }
13119 }
13120
13121 for (i = list; i < list + range; i++) {
13122 destroy_list(ctx, i);
13123 }
13124 }
13125
13126
13127 /**
13128 * Return a display list number, n, such that lists n through n+range-1
13129 * are free.
13130 */
13131 GLuint GLAPIENTRY
13132 _mesa_GenLists(GLsizei range)
13133 {
13134 GET_CURRENT_CONTEXT(ctx);
13135 GLuint base;
13136 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
13137 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
13138
13139 if (range < 0) {
13140 _mesa_error(ctx, GL_INVALID_VALUE, "glGenLists");
13141 return 0;
13142 }
13143 if (range == 0) {
13144 return 0;
13145 }
13146
13147 /*
13148 * Make this an atomic operation
13149 */
13150 _mesa_HashLockMutex(ctx->Shared->DisplayList);
13151
13152 base = _mesa_HashFindFreeKeyBlock(ctx->Shared->DisplayList, range);
13153 if (base) {
13154 /* reserve the list IDs by with empty/dummy lists */
13155 GLint i;
13156 for (i = 0; i < range; i++) {
13157 _mesa_HashInsertLocked(ctx->Shared->DisplayList, base + i,
13158 make_list(base + i, 1));
13159 }
13160 }
13161
13162 if (USE_BITMAP_ATLAS &&
13163 range > 16 &&
13164 ctx->Driver.DrawAtlasBitmaps) {
13165 /* "range > 16" is a rough heuristic to guess when glGenLists might be
13166 * used to allocate display lists for glXUseXFont or wglUseFontBitmaps.
13167 * Create the empty atlas now.
13168 */
13169 struct gl_bitmap_atlas *atlas = lookup_bitmap_atlas(ctx, base);
13170 if (!atlas) {
13171 atlas = alloc_bitmap_atlas(ctx, base);
13172 }
13173 if (atlas) {
13174 /* Atlas _should_ be new/empty now, but clobbering is OK */
13175 assert(atlas->numBitmaps == 0);
13176 atlas->numBitmaps = range;
13177 }
13178 }
13179
13180 _mesa_HashUnlockMutex(ctx->Shared->DisplayList);
13181
13182 return base;
13183 }
13184
13185
13186 /**
13187 * Begin a new display list.
13188 */
13189 void GLAPIENTRY
13190 _mesa_NewList(GLuint name, GLenum mode)
13191 {
13192 GET_CURRENT_CONTEXT(ctx);
13193
13194 FLUSH_CURRENT(ctx, 0); /* must be called before assert */
13195 ASSERT_OUTSIDE_BEGIN_END(ctx);
13196
13197 if (MESA_VERBOSE & VERBOSE_API)
13198 _mesa_debug(ctx, "glNewList %u %s\n", name,
13199 _mesa_enum_to_string(mode));
13200
13201 if (name == 0) {
13202 _mesa_error(ctx, GL_INVALID_VALUE, "glNewList");
13203 return;
13204 }
13205
13206 if (mode != GL_COMPILE && mode != GL_COMPILE_AND_EXECUTE) {
13207 _mesa_error(ctx, GL_INVALID_ENUM, "glNewList");
13208 return;
13209 }
13210
13211 if (ctx->ListState.CurrentList) {
13212 /* already compiling a display list */
13213 _mesa_error(ctx, GL_INVALID_OPERATION, "glNewList");
13214 return;
13215 }
13216
13217 ctx->CompileFlag = GL_TRUE;
13218 ctx->ExecuteFlag = (mode == GL_COMPILE_AND_EXECUTE);
13219
13220 /* Reset accumulated list state */
13221 invalidate_saved_current_state( ctx );
13222
13223 /* Allocate new display list */
13224 ctx->ListState.CurrentList = make_list(name, BLOCK_SIZE);
13225 ctx->ListState.CurrentBlock = ctx->ListState.CurrentList->Head;
13226 ctx->ListState.CurrentPos = 0;
13227
13228 vbo_save_NewList(ctx, name, mode);
13229
13230 ctx->CurrentServerDispatch = ctx->Save;
13231 _glapi_set_dispatch(ctx->CurrentServerDispatch);
13232 if (ctx->MarshalExec == NULL) {
13233 ctx->CurrentClientDispatch = ctx->CurrentServerDispatch;
13234 }
13235 }
13236
13237
13238 /**
13239 * End definition of current display list.
13240 */
13241 void GLAPIENTRY
13242 _mesa_EndList(void)
13243 {
13244 GET_CURRENT_CONTEXT(ctx);
13245 SAVE_FLUSH_VERTICES(ctx);
13246 FLUSH_VERTICES(ctx, 0);
13247
13248 if (MESA_VERBOSE & VERBOSE_API)
13249 _mesa_debug(ctx, "glEndList\n");
13250
13251 if (ctx->ExecuteFlag && _mesa_inside_dlist_begin_end(ctx)) {
13252 _mesa_error(ctx, GL_INVALID_OPERATION,
13253 "glEndList() called inside glBegin/End");
13254 }
13255
13256 /* Check that a list is under construction */
13257 if (!ctx->ListState.CurrentList) {
13258 _mesa_error(ctx, GL_INVALID_OPERATION, "glEndList");
13259 return;
13260 }
13261
13262 /* Call before emitting END_OF_LIST, in case the driver wants to
13263 * emit opcodes itself.
13264 */
13265 vbo_save_EndList(ctx);
13266
13267 (void) alloc_instruction(ctx, OPCODE_END_OF_LIST, 0);
13268
13269 trim_list(ctx);
13270
13271 /* Destroy old list, if any */
13272 destroy_list(ctx, ctx->ListState.CurrentList->Name);
13273
13274 /* Install the new list */
13275 _mesa_HashInsert(ctx->Shared->DisplayList,
13276 ctx->ListState.CurrentList->Name,
13277 ctx->ListState.CurrentList);
13278
13279
13280 if (MESA_VERBOSE & VERBOSE_DISPLAY_LIST)
13281 mesa_print_display_list(ctx->ListState.CurrentList->Name);
13282
13283 ctx->ListState.CurrentList = NULL;
13284 ctx->ListState.CurrentBlock = NULL;
13285 ctx->ListState.CurrentPos = 0;
13286 ctx->ExecuteFlag = GL_TRUE;
13287 ctx->CompileFlag = GL_FALSE;
13288
13289 ctx->CurrentServerDispatch = ctx->Exec;
13290 _glapi_set_dispatch(ctx->CurrentServerDispatch);
13291 if (ctx->MarshalExec == NULL) {
13292 ctx->CurrentClientDispatch = ctx->CurrentServerDispatch;
13293 }
13294 }
13295
13296
13297 void GLAPIENTRY
13298 _mesa_CallList(GLuint list)
13299 {
13300 GLboolean save_compile_flag;
13301 GET_CURRENT_CONTEXT(ctx);
13302 FLUSH_CURRENT(ctx, 0);
13303
13304 if (MESA_VERBOSE & VERBOSE_API)
13305 _mesa_debug(ctx, "glCallList %d\n", list);
13306
13307 if (list == 0) {
13308 _mesa_error(ctx, GL_INVALID_VALUE, "glCallList(list==0)");
13309 return;
13310 }
13311
13312 if (0)
13313 mesa_print_display_list( list );
13314
13315 /* VERY IMPORTANT: Save the CompileFlag status, turn it off,
13316 * execute the display list, and restore the CompileFlag.
13317 */
13318 save_compile_flag = ctx->CompileFlag;
13319 if (save_compile_flag) {
13320 ctx->CompileFlag = GL_FALSE;
13321 }
13322
13323 execute_list(ctx, list);
13324 ctx->CompileFlag = save_compile_flag;
13325
13326 /* also restore API function pointers to point to "save" versions */
13327 if (save_compile_flag) {
13328 ctx->CurrentServerDispatch = ctx->Save;
13329 _glapi_set_dispatch(ctx->CurrentServerDispatch);
13330 if (ctx->MarshalExec == NULL) {
13331 ctx->CurrentClientDispatch = ctx->CurrentServerDispatch;
13332 }
13333 }
13334 }
13335
13336
13337 /**
13338 * Try to execute a glCallLists() command where the display lists contain
13339 * glBitmap commands with a texture atlas.
13340 * \return true for success, false otherwise
13341 */
13342 static bool
13343 render_bitmap_atlas(struct gl_context *ctx, GLsizei n, GLenum type,
13344 const void *lists)
13345 {
13346 struct gl_bitmap_atlas *atlas;
13347 int i;
13348
13349 if (!USE_BITMAP_ATLAS ||
13350 !ctx->Current.RasterPosValid ||
13351 ctx->List.ListBase == 0 ||
13352 type != GL_UNSIGNED_BYTE ||
13353 !ctx->Driver.DrawAtlasBitmaps) {
13354 /* unsupported */
13355 return false;
13356 }
13357
13358 atlas = lookup_bitmap_atlas(ctx, ctx->List.ListBase);
13359
13360 if (!atlas) {
13361 /* Even if glGenLists wasn't called, we can still try to create
13362 * the atlas now.
13363 */
13364 atlas = alloc_bitmap_atlas(ctx, ctx->List.ListBase);
13365 }
13366
13367 if (atlas && !atlas->complete && !atlas->incomplete) {
13368 /* Try to build the bitmap atlas now.
13369 * If the atlas was created in glGenLists, we'll have recorded the
13370 * number of lists (bitmaps). Otherwise, take a guess at 256.
13371 */
13372 if (atlas->numBitmaps == 0)
13373 atlas->numBitmaps = 256;
13374 build_bitmap_atlas(ctx, atlas, ctx->List.ListBase);
13375 }
13376
13377 if (!atlas || !atlas->complete) {
13378 return false;
13379 }
13380
13381 /* check that all display list IDs are in the atlas */
13382 for (i = 0; i < n; i++) {
13383 const GLubyte *ids = (const GLubyte *) lists;
13384
13385 if (ids[i] >= atlas->numBitmaps) {
13386 return false;
13387 }
13388 }
13389
13390 ctx->Driver.DrawAtlasBitmaps(ctx, atlas, n, (const GLubyte *) lists);
13391
13392 return true;
13393 }
13394
13395
13396 /**
13397 * Execute glCallLists: call multiple display lists.
13398 */
13399 void GLAPIENTRY
13400 _mesa_CallLists(GLsizei n, GLenum type, const GLvoid * lists)
13401 {
13402 GET_CURRENT_CONTEXT(ctx);
13403 GLint i;
13404 GLboolean save_compile_flag;
13405
13406 if (MESA_VERBOSE & VERBOSE_API)
13407 _mesa_debug(ctx, "glCallLists %d\n", n);
13408
13409 switch (type) {
13410 case GL_BYTE:
13411 case GL_UNSIGNED_BYTE:
13412 case GL_SHORT:
13413 case GL_UNSIGNED_SHORT:
13414 case GL_INT:
13415 case GL_UNSIGNED_INT:
13416 case GL_FLOAT:
13417 case GL_2_BYTES:
13418 case GL_3_BYTES:
13419 case GL_4_BYTES:
13420 /* OK */
13421 break;
13422 default:
13423 _mesa_error(ctx, GL_INVALID_ENUM, "glCallLists(type)");
13424 return;
13425 }
13426
13427 if (n < 0) {
13428 _mesa_error(ctx, GL_INVALID_VALUE, "glCallLists(n < 0)");
13429 return;
13430 } else if (n == 0 || lists == NULL) {
13431 /* nothing to do */
13432 return;
13433 }
13434
13435 if (render_bitmap_atlas(ctx, n, type, lists)) {
13436 return;
13437 }
13438
13439 /* Save the CompileFlag status, turn it off, execute display list,
13440 * and restore the CompileFlag.
13441 */
13442 save_compile_flag = ctx->CompileFlag;
13443 ctx->CompileFlag = GL_FALSE;
13444
13445 for (i = 0; i < n; i++) {
13446 GLuint list = (GLuint) (ctx->List.ListBase + translate_id(i, type, lists));
13447 execute_list(ctx, list);
13448 }
13449
13450 ctx->CompileFlag = save_compile_flag;
13451
13452 /* also restore API function pointers to point to "save" versions */
13453 if (save_compile_flag) {
13454 ctx->CurrentServerDispatch = ctx->Save;
13455 _glapi_set_dispatch(ctx->CurrentServerDispatch);
13456 if (ctx->MarshalExec == NULL) {
13457 ctx->CurrentClientDispatch = ctx->CurrentServerDispatch;
13458 }
13459 }
13460 }
13461
13462
13463 /**
13464 * Set the offset added to list numbers in glCallLists.
13465 */
13466 void GLAPIENTRY
13467 _mesa_ListBase(GLuint base)
13468 {
13469 GET_CURRENT_CONTEXT(ctx);
13470 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
13471 ASSERT_OUTSIDE_BEGIN_END(ctx);
13472 ctx->List.ListBase = base;
13473 }
13474
13475 /**
13476 * Setup the given dispatch table to point to Mesa's display list
13477 * building functions.
13478 *
13479 * This does not include any of the tnl functions - they are
13480 * initialized from _mesa_init_api_defaults and from the active vtxfmt
13481 * struct.
13482 */
13483 void
13484 _mesa_initialize_save_table(const struct gl_context *ctx)
13485 {
13486 struct _glapi_table *table = ctx->Save;
13487 int numEntries = MAX2(_gloffset_COUNT, _glapi_get_dispatch_table_size());
13488
13489 /* Initially populate the dispatch table with the contents of the
13490 * normal-execution dispatch table. This lets us skip populating functions
13491 * that should be called directly instead of compiled into display lists.
13492 */
13493 memcpy(table, ctx->Exec, numEntries * sizeof(_glapi_proc));
13494
13495 _mesa_loopback_init_api_table(ctx, table);
13496
13497 /* VBO functions */
13498 vbo_initialize_save_dispatch(ctx, table);
13499
13500 /* GL 1.0 */
13501 SET_Accum(table, save_Accum);
13502 SET_AlphaFunc(table, save_AlphaFunc);
13503 SET_Bitmap(table, save_Bitmap);
13504 SET_BlendFunc(table, save_BlendFunc);
13505 SET_CallList(table, save_CallList);
13506 SET_CallLists(table, save_CallLists);
13507 SET_Clear(table, save_Clear);
13508 SET_ClearAccum(table, save_ClearAccum);
13509 SET_ClearColor(table, save_ClearColor);
13510 SET_ClearDepth(table, save_ClearDepth);
13511 SET_ClearIndex(table, save_ClearIndex);
13512 SET_ClearStencil(table, save_ClearStencil);
13513 SET_ClipPlane(table, save_ClipPlane);
13514 SET_ColorMask(table, save_ColorMask);
13515 SET_ColorMaski(table, save_ColorMaskIndexed);
13516 SET_ColorMaterial(table, save_ColorMaterial);
13517 SET_CopyPixels(table, save_CopyPixels);
13518 SET_CullFace(table, save_CullFace);
13519 SET_DepthFunc(table, save_DepthFunc);
13520 SET_DepthMask(table, save_DepthMask);
13521 SET_DepthRange(table, save_DepthRange);
13522 SET_Disable(table, save_Disable);
13523 SET_Disablei(table, save_DisableIndexed);
13524 SET_DrawBuffer(table, save_DrawBuffer);
13525 SET_DrawPixels(table, save_DrawPixels);
13526 SET_Enable(table, save_Enable);
13527 SET_Enablei(table, save_EnableIndexed);
13528 SET_EvalMesh1(table, save_EvalMesh1);
13529 SET_EvalMesh2(table, save_EvalMesh2);
13530 SET_Fogf(table, save_Fogf);
13531 SET_Fogfv(table, save_Fogfv);
13532 SET_Fogi(table, save_Fogi);
13533 SET_Fogiv(table, save_Fogiv);
13534 SET_FrontFace(table, save_FrontFace);
13535 SET_Frustum(table, save_Frustum);
13536 SET_Hint(table, save_Hint);
13537 SET_IndexMask(table, save_IndexMask);
13538 SET_InitNames(table, save_InitNames);
13539 SET_LightModelf(table, save_LightModelf);
13540 SET_LightModelfv(table, save_LightModelfv);
13541 SET_LightModeli(table, save_LightModeli);
13542 SET_LightModeliv(table, save_LightModeliv);
13543 SET_Lightf(table, save_Lightf);
13544 SET_Lightfv(table, save_Lightfv);
13545 SET_Lighti(table, save_Lighti);
13546 SET_Lightiv(table, save_Lightiv);
13547 SET_LineStipple(table, save_LineStipple);
13548 SET_LineWidth(table, save_LineWidth);
13549 SET_ListBase(table, save_ListBase);
13550 SET_LoadIdentity(table, save_LoadIdentity);
13551 SET_LoadMatrixd(table, save_LoadMatrixd);
13552 SET_LoadMatrixf(table, save_LoadMatrixf);
13553 SET_LoadName(table, save_LoadName);
13554 SET_LogicOp(table, save_LogicOp);
13555 SET_Map1d(table, save_Map1d);
13556 SET_Map1f(table, save_Map1f);
13557 SET_Map2d(table, save_Map2d);
13558 SET_Map2f(table, save_Map2f);
13559 SET_MapGrid1d(table, save_MapGrid1d);
13560 SET_MapGrid1f(table, save_MapGrid1f);
13561 SET_MapGrid2d(table, save_MapGrid2d);
13562 SET_MapGrid2f(table, save_MapGrid2f);
13563 SET_MatrixMode(table, save_MatrixMode);
13564 SET_MultMatrixd(table, save_MultMatrixd);
13565 SET_MultMatrixf(table, save_MultMatrixf);
13566 SET_NewList(table, save_NewList);
13567 SET_Ortho(table, save_Ortho);
13568 SET_PassThrough(table, save_PassThrough);
13569 SET_PixelMapfv(table, save_PixelMapfv);
13570 SET_PixelMapuiv(table, save_PixelMapuiv);
13571 SET_PixelMapusv(table, save_PixelMapusv);
13572 SET_PixelTransferf(table, save_PixelTransferf);
13573 SET_PixelTransferi(table, save_PixelTransferi);
13574 SET_PixelZoom(table, save_PixelZoom);
13575 SET_PointSize(table, save_PointSize);
13576 SET_PolygonMode(table, save_PolygonMode);
13577 SET_PolygonOffset(table, save_PolygonOffset);
13578 SET_PolygonStipple(table, save_PolygonStipple);
13579 SET_PopAttrib(table, save_PopAttrib);
13580 SET_PopMatrix(table, save_PopMatrix);
13581 SET_PopName(table, save_PopName);
13582 SET_PushAttrib(table, save_PushAttrib);
13583 SET_PushMatrix(table, save_PushMatrix);
13584 SET_PushName(table, save_PushName);
13585 SET_RasterPos2d(table, save_RasterPos2d);
13586 SET_RasterPos2dv(table, save_RasterPos2dv);
13587 SET_RasterPos2f(table, save_RasterPos2f);
13588 SET_RasterPos2fv(table, save_RasterPos2fv);
13589 SET_RasterPos2i(table, save_RasterPos2i);
13590 SET_RasterPos2iv(table, save_RasterPos2iv);
13591 SET_RasterPos2s(table, save_RasterPos2s);
13592 SET_RasterPos2sv(table, save_RasterPos2sv);
13593 SET_RasterPos3d(table, save_RasterPos3d);
13594 SET_RasterPos3dv(table, save_RasterPos3dv);
13595 SET_RasterPos3f(table, save_RasterPos3f);
13596 SET_RasterPos3fv(table, save_RasterPos3fv);
13597 SET_RasterPos3i(table, save_RasterPos3i);
13598 SET_RasterPos3iv(table, save_RasterPos3iv);
13599 SET_RasterPos3s(table, save_RasterPos3s);
13600 SET_RasterPos3sv(table, save_RasterPos3sv);
13601 SET_RasterPos4d(table, save_RasterPos4d);
13602 SET_RasterPos4dv(table, save_RasterPos4dv);
13603 SET_RasterPos4f(table, save_RasterPos4f);
13604 SET_RasterPos4fv(table, save_RasterPos4fv);
13605 SET_RasterPos4i(table, save_RasterPos4i);
13606 SET_RasterPos4iv(table, save_RasterPos4iv);
13607 SET_RasterPos4s(table, save_RasterPos4s);
13608 SET_RasterPos4sv(table, save_RasterPos4sv);
13609 SET_ReadBuffer(table, save_ReadBuffer);
13610 SET_Rectf(table, save_Rectf);
13611 SET_Rotated(table, save_Rotated);
13612 SET_Rotatef(table, save_Rotatef);
13613 SET_Scaled(table, save_Scaled);
13614 SET_Scalef(table, save_Scalef);
13615 SET_Scissor(table, save_Scissor);
13616 SET_ShadeModel(table, save_ShadeModel);
13617 SET_StencilFunc(table, save_StencilFunc);
13618 SET_StencilMask(table, save_StencilMask);
13619 SET_StencilOp(table, save_StencilOp);
13620 SET_TexEnvf(table, save_TexEnvf);
13621 SET_TexEnvfv(table, save_TexEnvfv);
13622 SET_TexEnvi(table, save_TexEnvi);
13623 SET_TexEnviv(table, save_TexEnviv);
13624 SET_TexGend(table, save_TexGend);
13625 SET_TexGendv(table, save_TexGendv);
13626 SET_TexGenf(table, save_TexGenf);
13627 SET_TexGenfv(table, save_TexGenfv);
13628 SET_TexGeni(table, save_TexGeni);
13629 SET_TexGeniv(table, save_TexGeniv);
13630 SET_TexImage1D(table, save_TexImage1D);
13631 SET_TexImage2D(table, save_TexImage2D);
13632 SET_TexParameterf(table, save_TexParameterf);
13633 SET_TexParameterfv(table, save_TexParameterfv);
13634 SET_TexParameteri(table, save_TexParameteri);
13635 SET_TexParameteriv(table, save_TexParameteriv);
13636 SET_Translated(table, save_Translated);
13637 SET_Translatef(table, save_Translatef);
13638 SET_Viewport(table, save_Viewport);
13639
13640 /* GL 1.1 */
13641 SET_BindTexture(table, save_BindTexture);
13642 SET_CopyTexImage1D(table, save_CopyTexImage1D);
13643 SET_CopyTexImage2D(table, save_CopyTexImage2D);
13644 SET_CopyTexSubImage1D(table, save_CopyTexSubImage1D);
13645 SET_CopyTexSubImage2D(table, save_CopyTexSubImage2D);
13646 SET_PrioritizeTextures(table, save_PrioritizeTextures);
13647 SET_TexSubImage1D(table, save_TexSubImage1D);
13648 SET_TexSubImage2D(table, save_TexSubImage2D);
13649
13650 /* GL 1.2 */
13651 SET_CopyTexSubImage3D(table, save_CopyTexSubImage3D);
13652 SET_TexImage3D(table, save_TexImage3D);
13653 SET_TexSubImage3D(table, save_TexSubImage3D);
13654
13655 /* GL 2.0 */
13656 SET_StencilFuncSeparate(table, save_StencilFuncSeparate);
13657 SET_StencilMaskSeparate(table, save_StencilMaskSeparate);
13658 SET_StencilOpSeparate(table, save_StencilOpSeparate);
13659
13660 /* ATI_separate_stencil */
13661 SET_StencilFuncSeparateATI(table, save_StencilFuncSeparateATI);
13662
13663 /* GL_ARB_imaging */
13664 /* Not all are supported */
13665 SET_BlendColor(table, save_BlendColor);
13666 SET_BlendEquation(table, save_BlendEquation);
13667
13668 /* 2. GL_EXT_blend_color */
13669 #if 0
13670 SET_BlendColorEXT(table, save_BlendColorEXT);
13671 #endif
13672
13673 /* 6. GL_EXT_texture3d */
13674 #if 0
13675 SET_CopyTexSubImage3DEXT(table, save_CopyTexSubImage3D);
13676 SET_TexImage3DEXT(table, save_TexImage3DEXT);
13677 SET_TexSubImage3DEXT(table, save_TexSubImage3D);
13678 #endif
13679
13680 /* 37. GL_EXT_blend_minmax */
13681 #if 0
13682 SET_BlendEquationEXT(table, save_BlendEquationEXT);
13683 #endif
13684
13685 /* 54. GL_EXT_point_parameters */
13686 SET_PointParameterf(table, save_PointParameterfEXT);
13687 SET_PointParameterfv(table, save_PointParameterfvEXT);
13688
13689 /* 91. GL_ARB_tessellation_shader */
13690 SET_PatchParameteri(table, save_PatchParameteri);
13691 SET_PatchParameterfv(table, save_PatchParameterfv);
13692
13693 /* 100. ARB_viewport_array */
13694 SET_ViewportArrayv(table, save_ViewportArrayv);
13695 SET_ViewportIndexedf(table, save_ViewportIndexedf);
13696 SET_ViewportIndexedfv(table, save_ViewportIndexedfv);
13697 SET_ScissorArrayv(table, save_ScissorArrayv);
13698 SET_ScissorIndexed(table, save_ScissorIndexed);
13699 SET_ScissorIndexedv(table, save_ScissorIndexedv);
13700 SET_DepthRangeArrayv(table, save_DepthRangeArrayv);
13701 SET_DepthRangeIndexed(table, save_DepthRangeIndexed);
13702
13703 /* 122. ARB_compute_shader */
13704 SET_DispatchCompute(table, save_DispatchCompute);
13705 SET_DispatchComputeIndirect(table, save_DispatchComputeIndirect);
13706
13707 /* 173. GL_EXT_blend_func_separate */
13708 SET_BlendFuncSeparate(table, save_BlendFuncSeparateEXT);
13709
13710 /* 197. GL_MESA_window_pos */
13711 SET_WindowPos2d(table, save_WindowPos2dMESA);
13712 SET_WindowPos2dv(table, save_WindowPos2dvMESA);
13713 SET_WindowPos2f(table, save_WindowPos2fMESA);
13714 SET_WindowPos2fv(table, save_WindowPos2fvMESA);
13715 SET_WindowPos2i(table, save_WindowPos2iMESA);
13716 SET_WindowPos2iv(table, save_WindowPos2ivMESA);
13717 SET_WindowPos2s(table, save_WindowPos2sMESA);
13718 SET_WindowPos2sv(table, save_WindowPos2svMESA);
13719 SET_WindowPos3d(table, save_WindowPos3dMESA);
13720 SET_WindowPos3dv(table, save_WindowPos3dvMESA);
13721 SET_WindowPos3f(table, save_WindowPos3fMESA);
13722 SET_WindowPos3fv(table, save_WindowPos3fvMESA);
13723 SET_WindowPos3i(table, save_WindowPos3iMESA);
13724 SET_WindowPos3iv(table, save_WindowPos3ivMESA);
13725 SET_WindowPos3s(table, save_WindowPos3sMESA);
13726 SET_WindowPos3sv(table, save_WindowPos3svMESA);
13727 SET_WindowPos4dMESA(table, save_WindowPos4dMESA);
13728 SET_WindowPos4dvMESA(table, save_WindowPos4dvMESA);
13729 SET_WindowPos4fMESA(table, save_WindowPos4fMESA);
13730 SET_WindowPos4fvMESA(table, save_WindowPos4fvMESA);
13731 SET_WindowPos4iMESA(table, save_WindowPos4iMESA);
13732 SET_WindowPos4ivMESA(table, save_WindowPos4ivMESA);
13733 SET_WindowPos4sMESA(table, save_WindowPos4sMESA);
13734 SET_WindowPos4svMESA(table, save_WindowPos4svMESA);
13735
13736 /* 245. GL_ATI_fragment_shader */
13737 SET_BindFragmentShaderATI(table, save_BindFragmentShaderATI);
13738 SET_SetFragmentShaderConstantATI(table, save_SetFragmentShaderConstantATI);
13739
13740 /* 262. GL_NV_point_sprite */
13741 SET_PointParameteri(table, save_PointParameteriNV);
13742 SET_PointParameteriv(table, save_PointParameterivNV);
13743
13744 /* 268. GL_EXT_stencil_two_side */
13745 SET_ActiveStencilFaceEXT(table, save_ActiveStencilFaceEXT);
13746
13747 /* ???. GL_EXT_depth_bounds_test */
13748 SET_DepthBoundsEXT(table, save_DepthBoundsEXT);
13749
13750 /* ARB 1. GL_ARB_multitexture */
13751 SET_ActiveTexture(table, save_ActiveTextureARB);
13752
13753 /* ARB 3. GL_ARB_transpose_matrix */
13754 SET_LoadTransposeMatrixd(table, save_LoadTransposeMatrixdARB);
13755 SET_LoadTransposeMatrixf(table, save_LoadTransposeMatrixfARB);
13756 SET_MultTransposeMatrixd(table, save_MultTransposeMatrixdARB);
13757 SET_MultTransposeMatrixf(table, save_MultTransposeMatrixfARB);
13758
13759 /* ARB 5. GL_ARB_multisample */
13760 SET_SampleCoverage(table, save_SampleCoverageARB);
13761
13762 /* ARB 12. GL_ARB_texture_compression */
13763 SET_CompressedTexImage3D(table, save_CompressedTexImage3DARB);
13764 SET_CompressedTexImage2D(table, save_CompressedTexImage2DARB);
13765 SET_CompressedTexImage1D(table, save_CompressedTexImage1DARB);
13766 SET_CompressedTexSubImage3D(table, save_CompressedTexSubImage3DARB);
13767 SET_CompressedTexSubImage2D(table, save_CompressedTexSubImage2DARB);
13768 SET_CompressedTexSubImage1D(table, save_CompressedTexSubImage1DARB);
13769
13770 /* ARB 14. GL_ARB_point_parameters */
13771 /* aliased with EXT_point_parameters functions */
13772
13773 /* ARB 25. GL_ARB_window_pos */
13774 /* aliased with MESA_window_pos functions */
13775
13776 /* ARB 26. GL_ARB_vertex_program */
13777 /* ARB 27. GL_ARB_fragment_program */
13778 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
13779 SET_ProgramStringARB(table, save_ProgramStringARB);
13780 SET_BindProgramARB(table, save_BindProgramARB);
13781 SET_ProgramEnvParameter4dARB(table, save_ProgramEnvParameter4dARB);
13782 SET_ProgramEnvParameter4dvARB(table, save_ProgramEnvParameter4dvARB);
13783 SET_ProgramEnvParameter4fARB(table, save_ProgramEnvParameter4fARB);
13784 SET_ProgramEnvParameter4fvARB(table, save_ProgramEnvParameter4fvARB);
13785 SET_ProgramLocalParameter4dARB(table, save_ProgramLocalParameter4dARB);
13786 SET_ProgramLocalParameter4dvARB(table, save_ProgramLocalParameter4dvARB);
13787 SET_ProgramLocalParameter4fARB(table, save_ProgramLocalParameter4fARB);
13788 SET_ProgramLocalParameter4fvARB(table, save_ProgramLocalParameter4fvARB);
13789
13790 SET_BeginQuery(table, save_BeginQueryARB);
13791 SET_EndQuery(table, save_EndQueryARB);
13792 SET_QueryCounter(table, save_QueryCounter);
13793
13794 SET_DrawBuffers(table, save_DrawBuffersARB);
13795
13796 SET_BlitFramebuffer(table, save_BlitFramebufferEXT);
13797
13798 SET_UseProgram(table, save_UseProgram);
13799 SET_Uniform1f(table, save_Uniform1fARB);
13800 SET_Uniform2f(table, save_Uniform2fARB);
13801 SET_Uniform3f(table, save_Uniform3fARB);
13802 SET_Uniform4f(table, save_Uniform4fARB);
13803 SET_Uniform1fv(table, save_Uniform1fvARB);
13804 SET_Uniform2fv(table, save_Uniform2fvARB);
13805 SET_Uniform3fv(table, save_Uniform3fvARB);
13806 SET_Uniform4fv(table, save_Uniform4fvARB);
13807 SET_Uniform1i(table, save_Uniform1iARB);
13808 SET_Uniform2i(table, save_Uniform2iARB);
13809 SET_Uniform3i(table, save_Uniform3iARB);
13810 SET_Uniform4i(table, save_Uniform4iARB);
13811 SET_Uniform1iv(table, save_Uniform1ivARB);
13812 SET_Uniform2iv(table, save_Uniform2ivARB);
13813 SET_Uniform3iv(table, save_Uniform3ivARB);
13814 SET_Uniform4iv(table, save_Uniform4ivARB);
13815 SET_UniformMatrix2fv(table, save_UniformMatrix2fvARB);
13816 SET_UniformMatrix3fv(table, save_UniformMatrix3fvARB);
13817 SET_UniformMatrix4fv(table, save_UniformMatrix4fvARB);
13818 SET_UniformMatrix2x3fv(table, save_UniformMatrix2x3fv);
13819 SET_UniformMatrix3x2fv(table, save_UniformMatrix3x2fv);
13820 SET_UniformMatrix2x4fv(table, save_UniformMatrix2x4fv);
13821 SET_UniformMatrix4x2fv(table, save_UniformMatrix4x2fv);
13822 SET_UniformMatrix3x4fv(table, save_UniformMatrix3x4fv);
13823 SET_UniformMatrix4x3fv(table, save_UniformMatrix4x3fv);
13824
13825 /* 299. GL_EXT_blend_equation_separate */
13826 SET_BlendEquationSeparate(table, save_BlendEquationSeparateEXT);
13827
13828 /* GL_EXT_gpu_program_parameters */
13829 SET_ProgramEnvParameters4fvEXT(table, save_ProgramEnvParameters4fvEXT);
13830 SET_ProgramLocalParameters4fvEXT(table, save_ProgramLocalParameters4fvEXT);
13831
13832 /* 364. GL_EXT_provoking_vertex */
13833 SET_ProvokingVertex(table, save_ProvokingVertexEXT);
13834
13835 /* GL_EXT_texture_integer */
13836 SET_ClearColorIiEXT(table, save_ClearColorIi);
13837 SET_ClearColorIuiEXT(table, save_ClearColorIui);
13838 SET_TexParameterIiv(table, save_TexParameterIiv);
13839 SET_TexParameterIuiv(table, save_TexParameterIuiv);
13840
13841 /* GL_ARB_clip_control */
13842 SET_ClipControl(table, save_ClipControl);
13843
13844 /* GL_ARB_color_buffer_float */
13845 SET_ClampColor(table, save_ClampColorARB);
13846
13847 /* GL 3.0 */
13848 SET_ClearBufferiv(table, save_ClearBufferiv);
13849 SET_ClearBufferuiv(table, save_ClearBufferuiv);
13850 SET_ClearBufferfv(table, save_ClearBufferfv);
13851 SET_ClearBufferfi(table, save_ClearBufferfi);
13852 SET_Uniform1ui(table, save_Uniform1ui);
13853 SET_Uniform2ui(table, save_Uniform2ui);
13854 SET_Uniform3ui(table, save_Uniform3ui);
13855 SET_Uniform4ui(table, save_Uniform4ui);
13856 SET_Uniform1uiv(table, save_Uniform1uiv);
13857 SET_Uniform2uiv(table, save_Uniform2uiv);
13858 SET_Uniform3uiv(table, save_Uniform3uiv);
13859 SET_Uniform4uiv(table, save_Uniform4uiv);
13860
13861 /* GL_ARB_gpu_shader_fp64 */
13862 SET_Uniform1d(table, save_Uniform1d);
13863 SET_Uniform2d(table, save_Uniform2d);
13864 SET_Uniform3d(table, save_Uniform3d);
13865 SET_Uniform4d(table, save_Uniform4d);
13866 SET_Uniform1dv(table, save_Uniform1dv);
13867 SET_Uniform2dv(table, save_Uniform2dv);
13868 SET_Uniform3dv(table, save_Uniform3dv);
13869 SET_Uniform4dv(table, save_Uniform4dv);
13870 SET_UniformMatrix2dv(table, save_UniformMatrix2dv);
13871 SET_UniformMatrix3dv(table, save_UniformMatrix3dv);
13872 SET_UniformMatrix4dv(table, save_UniformMatrix4dv);
13873 SET_UniformMatrix2x3dv(table, save_UniformMatrix2x3dv);
13874 SET_UniformMatrix3x2dv(table, save_UniformMatrix3x2dv);
13875 SET_UniformMatrix2x4dv(table, save_UniformMatrix2x4dv);
13876 SET_UniformMatrix4x2dv(table, save_UniformMatrix4x2dv);
13877 SET_UniformMatrix3x4dv(table, save_UniformMatrix3x4dv);
13878 SET_UniformMatrix4x3dv(table, save_UniformMatrix4x3dv);
13879
13880 /* These are: */
13881 SET_BeginTransformFeedback(table, save_BeginTransformFeedback);
13882 SET_EndTransformFeedback(table, save_EndTransformFeedback);
13883 SET_BindTransformFeedback(table, save_BindTransformFeedback);
13884 SET_PauseTransformFeedback(table, save_PauseTransformFeedback);
13885 SET_ResumeTransformFeedback(table, save_ResumeTransformFeedback);
13886 SET_DrawTransformFeedback(table, save_DrawTransformFeedback);
13887 SET_DrawTransformFeedbackStream(table, save_DrawTransformFeedbackStream);
13888 SET_DrawTransformFeedbackInstanced(table,
13889 save_DrawTransformFeedbackInstanced);
13890 SET_DrawTransformFeedbackStreamInstanced(table,
13891 save_DrawTransformFeedbackStreamInstanced);
13892 SET_BeginQueryIndexed(table, save_BeginQueryIndexed);
13893 SET_EndQueryIndexed(table, save_EndQueryIndexed);
13894
13895 /* GL_ARB_instanced_arrays */
13896 SET_VertexAttribDivisor(table, save_VertexAttribDivisor);
13897
13898 /* GL_NV_texture_barrier */
13899 SET_TextureBarrierNV(table, save_TextureBarrierNV);
13900
13901 SET_BindSampler(table, save_BindSampler);
13902 SET_SamplerParameteri(table, save_SamplerParameteri);
13903 SET_SamplerParameterf(table, save_SamplerParameterf);
13904 SET_SamplerParameteriv(table, save_SamplerParameteriv);
13905 SET_SamplerParameterfv(table, save_SamplerParameterfv);
13906 SET_SamplerParameterIiv(table, save_SamplerParameterIiv);
13907 SET_SamplerParameterIuiv(table, save_SamplerParameterIuiv);
13908
13909 /* GL_ARB_draw_buffer_blend */
13910 SET_BlendFunciARB(table, save_BlendFunci);
13911 SET_BlendFuncSeparateiARB(table, save_BlendFuncSeparatei);
13912 SET_BlendEquationiARB(table, save_BlendEquationi);
13913 SET_BlendEquationSeparateiARB(table, save_BlendEquationSeparatei);
13914
13915 /* GL_NV_conditional_render */
13916 SET_BeginConditionalRender(table, save_BeginConditionalRender);
13917 SET_EndConditionalRender(table, save_EndConditionalRender);
13918
13919 /* GL_ARB_sync */
13920 SET_WaitSync(table, save_WaitSync);
13921
13922 /* GL_ARB_uniform_buffer_object */
13923 SET_UniformBlockBinding(table, save_UniformBlockBinding);
13924
13925 /* GL_ARB_shader_subroutines */
13926 SET_UniformSubroutinesuiv(table, save_UniformSubroutinesuiv);
13927
13928 /* GL_ARB_draw_instanced */
13929 SET_DrawArraysInstancedARB(table, save_DrawArraysInstancedARB);
13930 SET_DrawElementsInstancedARB(table, save_DrawElementsInstancedARB);
13931
13932 /* GL_ARB_draw_elements_base_vertex */
13933 SET_DrawElementsInstancedBaseVertex(table, save_DrawElementsInstancedBaseVertexARB);
13934
13935 /* GL_ARB_base_instance */
13936 SET_DrawArraysInstancedBaseInstance(table, save_DrawArraysInstancedBaseInstance);
13937 SET_DrawElementsInstancedBaseInstance(table, save_DrawElementsInstancedBaseInstance);
13938 SET_DrawElementsInstancedBaseVertexBaseInstance(table, save_DrawElementsInstancedBaseVertexBaseInstance);
13939
13940 /* GL_ARB_draw_indirect / GL_ARB_multi_draw_indirect */
13941 SET_DrawArraysIndirect(table, save_DrawArraysIndirect);
13942 SET_DrawElementsIndirect(table, save_DrawElementsIndirect);
13943 SET_MultiDrawArraysIndirect(table, save_MultiDrawArraysIndirect);
13944 SET_MultiDrawElementsIndirect(table, save_MultiDrawElementsIndirect);
13945
13946 /* OpenGL 4.2 / GL_ARB_separate_shader_objects */
13947 SET_UseProgramStages(table, save_UseProgramStages);
13948 SET_ProgramUniform1f(table, save_ProgramUniform1f);
13949 SET_ProgramUniform2f(table, save_ProgramUniform2f);
13950 SET_ProgramUniform3f(table, save_ProgramUniform3f);
13951 SET_ProgramUniform4f(table, save_ProgramUniform4f);
13952 SET_ProgramUniform1fv(table, save_ProgramUniform1fv);
13953 SET_ProgramUniform2fv(table, save_ProgramUniform2fv);
13954 SET_ProgramUniform3fv(table, save_ProgramUniform3fv);
13955 SET_ProgramUniform4fv(table, save_ProgramUniform4fv);
13956 SET_ProgramUniform1d(table, save_ProgramUniform1d);
13957 SET_ProgramUniform2d(table, save_ProgramUniform2d);
13958 SET_ProgramUniform3d(table, save_ProgramUniform3d);
13959 SET_ProgramUniform4d(table, save_ProgramUniform4d);
13960 SET_ProgramUniform1dv(table, save_ProgramUniform1dv);
13961 SET_ProgramUniform2dv(table, save_ProgramUniform2dv);
13962 SET_ProgramUniform3dv(table, save_ProgramUniform3dv);
13963 SET_ProgramUniform4dv(table, save_ProgramUniform4dv);
13964 SET_ProgramUniform1i(table, save_ProgramUniform1i);
13965 SET_ProgramUniform2i(table, save_ProgramUniform2i);
13966 SET_ProgramUniform3i(table, save_ProgramUniform3i);
13967 SET_ProgramUniform4i(table, save_ProgramUniform4i);
13968 SET_ProgramUniform1iv(table, save_ProgramUniform1iv);
13969 SET_ProgramUniform2iv(table, save_ProgramUniform2iv);
13970 SET_ProgramUniform3iv(table, save_ProgramUniform3iv);
13971 SET_ProgramUniform4iv(table, save_ProgramUniform4iv);
13972 SET_ProgramUniform1ui(table, save_ProgramUniform1ui);
13973 SET_ProgramUniform2ui(table, save_ProgramUniform2ui);
13974 SET_ProgramUniform3ui(table, save_ProgramUniform3ui);
13975 SET_ProgramUniform4ui(table, save_ProgramUniform4ui);
13976 SET_ProgramUniform1uiv(table, save_ProgramUniform1uiv);
13977 SET_ProgramUniform2uiv(table, save_ProgramUniform2uiv);
13978 SET_ProgramUniform3uiv(table, save_ProgramUniform3uiv);
13979 SET_ProgramUniform4uiv(table, save_ProgramUniform4uiv);
13980 SET_ProgramUniformMatrix2fv(table, save_ProgramUniformMatrix2fv);
13981 SET_ProgramUniformMatrix3fv(table, save_ProgramUniformMatrix3fv);
13982 SET_ProgramUniformMatrix4fv(table, save_ProgramUniformMatrix4fv);
13983 SET_ProgramUniformMatrix2x3fv(table, save_ProgramUniformMatrix2x3fv);
13984 SET_ProgramUniformMatrix3x2fv(table, save_ProgramUniformMatrix3x2fv);
13985 SET_ProgramUniformMatrix2x4fv(table, save_ProgramUniformMatrix2x4fv);
13986 SET_ProgramUniformMatrix4x2fv(table, save_ProgramUniformMatrix4x2fv);
13987 SET_ProgramUniformMatrix3x4fv(table, save_ProgramUniformMatrix3x4fv);
13988 SET_ProgramUniformMatrix4x3fv(table, save_ProgramUniformMatrix4x3fv);
13989 SET_ProgramUniformMatrix2dv(table, save_ProgramUniformMatrix2dv);
13990 SET_ProgramUniformMatrix3dv(table, save_ProgramUniformMatrix3dv);
13991 SET_ProgramUniformMatrix4dv(table, save_ProgramUniformMatrix4dv);
13992 SET_ProgramUniformMatrix2x3dv(table, save_ProgramUniformMatrix2x3dv);
13993 SET_ProgramUniformMatrix3x2dv(table, save_ProgramUniformMatrix3x2dv);
13994 SET_ProgramUniformMatrix2x4dv(table, save_ProgramUniformMatrix2x4dv);
13995 SET_ProgramUniformMatrix4x2dv(table, save_ProgramUniformMatrix4x2dv);
13996 SET_ProgramUniformMatrix3x4dv(table, save_ProgramUniformMatrix3x4dv);
13997 SET_ProgramUniformMatrix4x3dv(table, save_ProgramUniformMatrix4x3dv);
13998
13999 /* GL_{ARB,EXT}_polygon_offset_clamp */
14000 SET_PolygonOffsetClampEXT(table, save_PolygonOffsetClampEXT);
14001
14002 /* GL_EXT_window_rectangles */
14003 SET_WindowRectanglesEXT(table, save_WindowRectanglesEXT);
14004
14005 /* GL_NV_conservative_raster */
14006 SET_SubpixelPrecisionBiasNV(table, save_SubpixelPrecisionBiasNV);
14007
14008 /* GL_NV_conservative_raster_dilate */
14009 SET_ConservativeRasterParameterfNV(table, save_ConservativeRasterParameterfNV);
14010
14011 /* GL_NV_conservative_raster_pre_snap_triangles */
14012 SET_ConservativeRasterParameteriNV(table, save_ConservativeRasterParameteriNV);
14013
14014 /* GL_EXT_direct_state_access */
14015 SET_MatrixLoadfEXT(table, save_MatrixLoadfEXT);
14016 SET_MatrixLoaddEXT(table, save_MatrixLoaddEXT);
14017 SET_MatrixMultfEXT(table, save_MatrixMultfEXT);
14018 SET_MatrixMultdEXT(table, save_MatrixMultdEXT);
14019 SET_MatrixRotatefEXT(table, save_MatrixRotatefEXT);
14020 SET_MatrixRotatedEXT(table, save_MatrixRotatedEXT);
14021 SET_MatrixScalefEXT(table, save_MatrixScalefEXT);
14022 SET_MatrixScaledEXT(table, save_MatrixScaledEXT);
14023 SET_MatrixTranslatefEXT(table, save_MatrixTranslatefEXT);
14024 SET_MatrixTranslatedEXT(table, save_MatrixTranslatedEXT);
14025 SET_MatrixLoadIdentityEXT(table, save_MatrixLoadIdentityEXT);
14026 SET_MatrixOrthoEXT(table, save_MatrixOrthoEXT);
14027 SET_MatrixFrustumEXT(table, save_MatrixFrustumEXT);
14028 SET_MatrixPushEXT(table, save_MatrixPushEXT);
14029 SET_MatrixPopEXT(table, save_MatrixPopEXT);
14030 SET_MatrixLoadTransposefEXT(table, save_MatrixLoadTransposefEXT);
14031 SET_MatrixLoadTransposedEXT(table, save_MatrixLoadTransposedEXT);
14032 SET_MatrixMultTransposefEXT(table, save_MatrixMultTransposefEXT);
14033 SET_MatrixMultTransposedEXT(table, save_MatrixMultTransposedEXT);
14034 SET_TextureParameteriEXT(table, save_TextureParameteriEXT);
14035 SET_TextureParameterivEXT(table, save_TextureParameterivEXT);
14036 SET_TextureParameterfEXT(table, save_TextureParameterfEXT);
14037 SET_TextureParameterfvEXT(table, save_TextureParameterfvEXT);
14038 SET_TextureParameterIivEXT(table, save_TextureParameterIivEXT);
14039 SET_TextureParameterIuivEXT(table, save_TextureParameterIuivEXT);
14040 SET_TextureImage1DEXT(table, save_TextureImage1DEXT);
14041 SET_TextureImage2DEXT(table, save_TextureImage2DEXT);
14042 SET_TextureImage3DEXT(table, save_TextureImage3DEXT);
14043 SET_TextureSubImage1DEXT(table, save_TextureSubImage1DEXT);
14044 SET_TextureSubImage2DEXT(table, save_TextureSubImage2DEXT);
14045 SET_TextureSubImage3DEXT(table, save_TextureSubImage3DEXT);
14046 SET_CopyTextureImage1DEXT(table, save_CopyTextureImage1DEXT);
14047 SET_CopyTextureImage2DEXT(table, save_CopyTextureImage2DEXT);
14048 SET_CopyTextureSubImage1DEXT(table, save_CopyTextureSubImage1DEXT);
14049 SET_CopyTextureSubImage2DEXT(table, save_CopyTextureSubImage2DEXT);
14050 SET_CopyTextureSubImage3DEXT(table, save_CopyTextureSubImage3DEXT);
14051 SET_BindMultiTextureEXT(table, save_BindMultiTextureEXT);
14052 SET_MultiTexParameteriEXT(table, save_MultiTexParameteriEXT);
14053 SET_MultiTexParameterivEXT(table, save_MultiTexParameterivEXT);
14054 SET_MultiTexParameterIivEXT(table, save_MultiTexParameterIivEXT);
14055 SET_MultiTexParameterIuivEXT(table, save_MultiTexParameterIuivEXT);
14056 SET_MultiTexParameterfEXT(table, save_MultiTexParameterfEXT);
14057 SET_MultiTexParameterfvEXT(table, save_MultiTexParameterfvEXT);
14058 SET_MultiTexImage1DEXT(table, save_MultiTexImage1DEXT);
14059 SET_MultiTexImage2DEXT(table, save_MultiTexImage2DEXT);
14060 SET_MultiTexImage3DEXT(table, save_MultiTexImage3DEXT);
14061 SET_MultiTexSubImage1DEXT(table, save_MultiTexSubImage1DEXT);
14062 SET_MultiTexSubImage2DEXT(table, save_MultiTexSubImage2DEXT);
14063 SET_MultiTexSubImage3DEXT(table, save_MultiTexSubImage3DEXT);
14064 SET_CopyMultiTexImage1DEXT(table, save_CopyMultiTexImage1DEXT);
14065 SET_CopyMultiTexImage2DEXT(table, save_CopyMultiTexImage2DEXT);
14066 SET_CopyMultiTexSubImage1DEXT(table, save_CopyMultiTexSubImage1DEXT);
14067 SET_CopyMultiTexSubImage2DEXT(table, save_CopyMultiTexSubImage2DEXT);
14068 SET_CopyMultiTexSubImage3DEXT(table, save_CopyMultiTexSubImage3DEXT);
14069 SET_MultiTexEnvfEXT(table, save_MultiTexEnvfEXT);
14070 SET_MultiTexEnvfvEXT(table, save_MultiTexEnvfvEXT);
14071 SET_MultiTexEnviEXT(table, save_MultiTexEnviEXT);
14072 SET_MultiTexEnvivEXT(table, save_MultiTexEnvivEXT);
14073 SET_CompressedTextureImage1DEXT(table, save_CompressedTextureImage1DEXT);
14074 SET_CompressedTextureImage2DEXT(table, save_CompressedTextureImage2DEXT);
14075 SET_CompressedTextureImage3DEXT(table, save_CompressedTextureImage3DEXT);
14076 SET_CompressedTextureSubImage1DEXT(table, save_CompressedTextureSubImage1DEXT);
14077 SET_CompressedTextureSubImage2DEXT(table, save_CompressedTextureSubImage2DEXT);
14078 SET_CompressedTextureSubImage3DEXT(table, save_CompressedTextureSubImage3DEXT);
14079 SET_CompressedMultiTexImage1DEXT(table, save_CompressedMultiTexImage1DEXT);
14080 SET_CompressedMultiTexImage2DEXT(table, save_CompressedMultiTexImage2DEXT);
14081 SET_CompressedMultiTexImage3DEXT(table, save_CompressedMultiTexImage3DEXT);
14082 SET_CompressedMultiTexSubImage1DEXT(table, save_CompressedMultiTexSubImage1DEXT);
14083 SET_CompressedMultiTexSubImage2DEXT(table, save_CompressedMultiTexSubImage2DEXT);
14084 SET_CompressedMultiTexSubImage3DEXT(table, save_CompressedMultiTexSubImage3DEXT);
14085 SET_NamedProgramStringEXT(table, save_NamedProgramStringEXT);
14086 SET_NamedProgramLocalParameter4dEXT(table, save_NamedProgramLocalParameter4dEXT);
14087 SET_NamedProgramLocalParameter4dvEXT(table, save_NamedProgramLocalParameter4dvEXT);
14088 SET_NamedProgramLocalParameter4fEXT(table, save_NamedProgramLocalParameter4fEXT);
14089 SET_NamedProgramLocalParameter4fvEXT(table, save_NamedProgramLocalParameter4fvEXT);
14090 }
14091
14092
14093
14094 static const char *
14095 enum_string(GLenum k)
14096 {
14097 return _mesa_enum_to_string(k);
14098 }
14099
14100
14101 /**
14102 * Print the commands in a display list. For debugging only.
14103 * TODO: many commands aren't handled yet.
14104 * \param fname filename to write display list to. If null, use stdout.
14105 */
14106 static void GLAPIENTRY
14107 print_list(struct gl_context *ctx, GLuint list, const char *fname)
14108 {
14109 struct gl_display_list *dlist;
14110 Node *n;
14111 GLboolean done;
14112 FILE *f = stdout;
14113
14114 if (fname) {
14115 f = fopen(fname, "w");
14116 if (!f)
14117 return;
14118 }
14119
14120 if (!islist(ctx, list)) {
14121 fprintf(f, "%u is not a display list ID\n", list);
14122 goto out;
14123 }
14124
14125 dlist = _mesa_lookup_list(ctx, list);
14126 if (!dlist) {
14127 goto out;
14128 }
14129
14130 n = dlist->Head;
14131
14132 fprintf(f, "START-LIST %u, address %p\n", list, (void *) n);
14133
14134 done = n ? GL_FALSE : GL_TRUE;
14135 while (!done) {
14136 const OpCode opcode = n[0].opcode;
14137
14138 if (is_ext_opcode(opcode)) {
14139 n += ext_opcode_print(ctx, n, f);
14140 }
14141 else {
14142 switch (opcode) {
14143 case OPCODE_ACCUM:
14144 fprintf(f, "Accum %s %g\n", enum_string(n[1].e), n[2].f);
14145 break;
14146 case OPCODE_ACTIVE_TEXTURE:
14147 fprintf(f, "ActiveTexture(%s)\n", enum_string(n[1].e));
14148 break;
14149 case OPCODE_BITMAP:
14150 fprintf(f, "Bitmap %d %d %g %g %g %g %p\n", n[1].i, n[2].i,
14151 n[3].f, n[4].f, n[5].f, n[6].f,
14152 get_pointer(&n[7]));
14153 break;
14154 case OPCODE_BLEND_COLOR:
14155 fprintf(f, "BlendColor %f, %f, %f, %f\n",
14156 n[1].f, n[2].f, n[3].f, n[4].f);
14157 break;
14158 case OPCODE_BLEND_EQUATION:
14159 fprintf(f, "BlendEquation %s\n",
14160 enum_string(n[1].e));
14161 break;
14162 case OPCODE_BLEND_EQUATION_SEPARATE:
14163 fprintf(f, "BlendEquationSeparate %s, %s\n",
14164 enum_string(n[1].e),
14165 enum_string(n[2].e));
14166 break;
14167 case OPCODE_BLEND_FUNC_SEPARATE:
14168 fprintf(f, "BlendFuncSeparate %s, %s, %s, %s\n",
14169 enum_string(n[1].e),
14170 enum_string(n[2].e),
14171 enum_string(n[3].e),
14172 enum_string(n[4].e));
14173 break;
14174 case OPCODE_BLEND_EQUATION_I:
14175 fprintf(f, "BlendEquationi %u, %s\n",
14176 n[1].ui, enum_string(n[2].e));
14177 break;
14178 case OPCODE_BLEND_EQUATION_SEPARATE_I:
14179 fprintf(f, "BlendEquationSeparatei %u, %s, %s\n",
14180 n[1].ui, enum_string(n[2].e), enum_string(n[3].e));
14181 break;
14182 case OPCODE_BLEND_FUNC_I:
14183 fprintf(f, "BlendFunci %u, %s, %s\n",
14184 n[1].ui, enum_string(n[2].e), enum_string(n[3].e));
14185 break;
14186 case OPCODE_BLEND_FUNC_SEPARATE_I:
14187 fprintf(f, "BlendFuncSeparatei %u, %s, %s, %s, %s\n",
14188 n[1].ui,
14189 enum_string(n[2].e),
14190 enum_string(n[3].e),
14191 enum_string(n[4].e),
14192 enum_string(n[5].e));
14193 break;
14194 case OPCODE_CALL_LIST:
14195 fprintf(f, "CallList %d\n", (int) n[1].ui);
14196 break;
14197 case OPCODE_CALL_LISTS:
14198 fprintf(f, "CallLists %d, %s\n", n[1].i, enum_string(n[1].e));
14199 break;
14200 case OPCODE_DISABLE:
14201 fprintf(f, "Disable %s\n", enum_string(n[1].e));
14202 break;
14203 case OPCODE_ENABLE:
14204 fprintf(f, "Enable %s\n", enum_string(n[1].e));
14205 break;
14206 case OPCODE_FRUSTUM:
14207 fprintf(f, "Frustum %g %g %g %g %g %g\n",
14208 n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f);
14209 break;
14210 case OPCODE_LINE_STIPPLE:
14211 fprintf(f, "LineStipple %d %x\n", n[1].i, (int) n[2].us);
14212 break;
14213 case OPCODE_LINE_WIDTH:
14214 fprintf(f, "LineWidth %f\n", n[1].f);
14215 break;
14216 case OPCODE_LOAD_IDENTITY:
14217 fprintf(f, "LoadIdentity\n");
14218 break;
14219 case OPCODE_LOAD_MATRIX:
14220 fprintf(f, "LoadMatrix\n");
14221 fprintf(f, " %8f %8f %8f %8f\n",
14222 n[1].f, n[5].f, n[9].f, n[13].f);
14223 fprintf(f, " %8f %8f %8f %8f\n",
14224 n[2].f, n[6].f, n[10].f, n[14].f);
14225 fprintf(f, " %8f %8f %8f %8f\n",
14226 n[3].f, n[7].f, n[11].f, n[15].f);
14227 fprintf(f, " %8f %8f %8f %8f\n",
14228 n[4].f, n[8].f, n[12].f, n[16].f);
14229 break;
14230 case OPCODE_MULT_MATRIX:
14231 fprintf(f, "MultMatrix (or Rotate)\n");
14232 fprintf(f, " %8f %8f %8f %8f\n",
14233 n[1].f, n[5].f, n[9].f, n[13].f);
14234 fprintf(f, " %8f %8f %8f %8f\n",
14235 n[2].f, n[6].f, n[10].f, n[14].f);
14236 fprintf(f, " %8f %8f %8f %8f\n",
14237 n[3].f, n[7].f, n[11].f, n[15].f);
14238 fprintf(f, " %8f %8f %8f %8f\n",
14239 n[4].f, n[8].f, n[12].f, n[16].f);
14240 break;
14241 case OPCODE_ORTHO:
14242 fprintf(f, "Ortho %g %g %g %g %g %g\n",
14243 n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f);
14244 break;
14245 case OPCODE_POINT_SIZE:
14246 fprintf(f, "PointSize %f\n", n[1].f);
14247 break;
14248 case OPCODE_POP_ATTRIB:
14249 fprintf(f, "PopAttrib\n");
14250 break;
14251 case OPCODE_POP_MATRIX:
14252 fprintf(f, "PopMatrix\n");
14253 break;
14254 case OPCODE_POP_NAME:
14255 fprintf(f, "PopName\n");
14256 break;
14257 case OPCODE_PUSH_ATTRIB:
14258 fprintf(f, "PushAttrib %x\n", n[1].bf);
14259 break;
14260 case OPCODE_PUSH_MATRIX:
14261 fprintf(f, "PushMatrix\n");
14262 break;
14263 case OPCODE_PUSH_NAME:
14264 fprintf(f, "PushName %d\n", (int) n[1].ui);
14265 break;
14266 case OPCODE_RASTER_POS:
14267 fprintf(f, "RasterPos %g %g %g %g\n",
14268 n[1].f, n[2].f, n[3].f, n[4].f);
14269 break;
14270 case OPCODE_ROTATE:
14271 fprintf(f, "Rotate %g %g %g %g\n",
14272 n[1].f, n[2].f, n[3].f, n[4].f);
14273 break;
14274 case OPCODE_SCALE:
14275 fprintf(f, "Scale %g %g %g\n", n[1].f, n[2].f, n[3].f);
14276 break;
14277 case OPCODE_TRANSLATE:
14278 fprintf(f, "Translate %g %g %g\n", n[1].f, n[2].f, n[3].f);
14279 break;
14280 case OPCODE_BIND_TEXTURE:
14281 fprintf(f, "BindTexture %s %d\n",
14282 _mesa_enum_to_string(n[1].ui), n[2].ui);
14283 break;
14284 case OPCODE_SHADE_MODEL:
14285 fprintf(f, "ShadeModel %s\n", _mesa_enum_to_string(n[1].ui));
14286 break;
14287 case OPCODE_MAP1:
14288 fprintf(f, "Map1 %s %.3f %.3f %d %d\n",
14289 _mesa_enum_to_string(n[1].ui),
14290 n[2].f, n[3].f, n[4].i, n[5].i);
14291 break;
14292 case OPCODE_MAP2:
14293 fprintf(f, "Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
14294 _mesa_enum_to_string(n[1].ui),
14295 n[2].f, n[3].f, n[4].f, n[5].f,
14296 n[6].i, n[7].i, n[8].i, n[9].i);
14297 break;
14298 case OPCODE_MAPGRID1:
14299 fprintf(f, "MapGrid1 %d %.3f %.3f\n", n[1].i, n[2].f, n[3].f);
14300 break;
14301 case OPCODE_MAPGRID2:
14302 fprintf(f, "MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
14303 n[1].i, n[2].f, n[3].f, n[4].i, n[5].f, n[6].f);
14304 break;
14305 case OPCODE_EVALMESH1:
14306 fprintf(f, "EvalMesh1 %d %d\n", n[1].i, n[2].i);
14307 break;
14308 case OPCODE_EVALMESH2:
14309 fprintf(f, "EvalMesh2 %d %d %d %d\n",
14310 n[1].i, n[2].i, n[3].i, n[4].i);
14311 break;
14312
14313 case OPCODE_ATTR_1F_NV:
14314 fprintf(f, "ATTR_1F_NV attr %d: %f\n", n[1].i, n[2].f);
14315 break;
14316 case OPCODE_ATTR_2F_NV:
14317 fprintf(f, "ATTR_2F_NV attr %d: %f %f\n",
14318 n[1].i, n[2].f, n[3].f);
14319 break;
14320 case OPCODE_ATTR_3F_NV:
14321 fprintf(f, "ATTR_3F_NV attr %d: %f %f %f\n",
14322 n[1].i, n[2].f, n[3].f, n[4].f);
14323 break;
14324 case OPCODE_ATTR_4F_NV:
14325 fprintf(f, "ATTR_4F_NV attr %d: %f %f %f %f\n",
14326 n[1].i, n[2].f, n[3].f, n[4].f, n[5].f);
14327 break;
14328 case OPCODE_ATTR_1F_ARB:
14329 fprintf(f, "ATTR_1F_ARB attr %d: %f\n", n[1].i, n[2].f);
14330 break;
14331 case OPCODE_ATTR_2F_ARB:
14332 fprintf(f, "ATTR_2F_ARB attr %d: %f %f\n",
14333 n[1].i, n[2].f, n[3].f);
14334 break;
14335 case OPCODE_ATTR_3F_ARB:
14336 fprintf(f, "ATTR_3F_ARB attr %d: %f %f %f\n",
14337 n[1].i, n[2].f, n[3].f, n[4].f);
14338 break;
14339 case OPCODE_ATTR_4F_ARB:
14340 fprintf(f, "ATTR_4F_ARB attr %d: %f %f %f %f\n",
14341 n[1].i, n[2].f, n[3].f, n[4].f, n[5].f);
14342 break;
14343
14344 case OPCODE_MATERIAL:
14345 fprintf(f, "MATERIAL %x %x: %f %f %f %f\n",
14346 n[1].i, n[2].i, n[3].f, n[4].f, n[5].f, n[6].f);
14347 break;
14348 case OPCODE_BEGIN:
14349 fprintf(f, "BEGIN %x\n", n[1].i);
14350 break;
14351 case OPCODE_END:
14352 fprintf(f, "END\n");
14353 break;
14354 case OPCODE_RECTF:
14355 fprintf(f, "RECTF %f %f %f %f\n", n[1].f, n[2].f, n[3].f,
14356 n[4].f);
14357 break;
14358 case OPCODE_EVAL_C1:
14359 fprintf(f, "EVAL_C1 %f\n", n[1].f);
14360 break;
14361 case OPCODE_EVAL_C2:
14362 fprintf(f, "EVAL_C2 %f %f\n", n[1].f, n[2].f);
14363 break;
14364 case OPCODE_EVAL_P1:
14365 fprintf(f, "EVAL_P1 %d\n", n[1].i);
14366 break;
14367 case OPCODE_EVAL_P2:
14368 fprintf(f, "EVAL_P2 %d %d\n", n[1].i, n[2].i);
14369 break;
14370
14371 case OPCODE_PROVOKING_VERTEX:
14372 fprintf(f, "ProvokingVertex %s\n",
14373 _mesa_enum_to_string(n[1].ui));
14374 break;
14375
14376 /*
14377 * meta opcodes/commands
14378 */
14379 case OPCODE_ERROR:
14380 fprintf(f, "Error: %s %s\n", enum_string(n[1].e),
14381 (const char *) get_pointer(&n[2]));
14382 break;
14383 case OPCODE_CONTINUE:
14384 fprintf(f, "DISPLAY-LIST-CONTINUE\n");
14385 n = (Node *) get_pointer(&n[1]);
14386 break;
14387 case OPCODE_NOP:
14388 fprintf(f, "NOP\n");
14389 break;
14390 case OPCODE_END_OF_LIST:
14391 fprintf(f, "END-LIST %u\n", list);
14392 done = GL_TRUE;
14393 break;
14394 default:
14395 if (opcode < 0 || opcode > OPCODE_END_OF_LIST) {
14396 printf
14397 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
14398 opcode, (void *) n);
14399 goto out;
14400 }
14401 else {
14402 fprintf(f, "command %d, %u operands\n", opcode,
14403 InstSize[opcode]);
14404 }
14405 }
14406 /* increment n to point to next compiled command */
14407 if (opcode != OPCODE_CONTINUE) {
14408 assert(InstSize[opcode] > 0);
14409 n += InstSize[opcode];
14410 }
14411 }
14412 }
14413
14414 out:
14415 fflush(f);
14416 if (fname)
14417 fclose(f);
14418 }
14419
14420
14421
14422 /**
14423 * Clients may call this function to help debug display list problems.
14424 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
14425 * changed, or break in the future without notice.
14426 */
14427 void
14428 mesa_print_display_list(GLuint list)
14429 {
14430 GET_CURRENT_CONTEXT(ctx);
14431 print_list(ctx, list, NULL);
14432 }
14433
14434
14435 /**********************************************************************/
14436 /***** Initialization *****/
14437 /**********************************************************************/
14438
14439 static void
14440 save_vtxfmt_init(GLvertexformat * vfmt)
14441 {
14442 vfmt->ArrayElement = _ae_ArrayElement;
14443
14444 vfmt->Begin = save_Begin;
14445
14446 vfmt->CallList = save_CallList;
14447 vfmt->CallLists = save_CallLists;
14448
14449 vfmt->Color3f = save_Color3f;
14450 vfmt->Color3fv = save_Color3fv;
14451 vfmt->Color4f = save_Color4f;
14452 vfmt->Color4fv = save_Color4fv;
14453 vfmt->EdgeFlag = save_EdgeFlag;
14454 vfmt->End = save_End;
14455
14456 vfmt->EvalCoord1f = save_EvalCoord1f;
14457 vfmt->EvalCoord1fv = save_EvalCoord1fv;
14458 vfmt->EvalCoord2f = save_EvalCoord2f;
14459 vfmt->EvalCoord2fv = save_EvalCoord2fv;
14460 vfmt->EvalPoint1 = save_EvalPoint1;
14461 vfmt->EvalPoint2 = save_EvalPoint2;
14462
14463 vfmt->FogCoordfEXT = save_FogCoordfEXT;
14464 vfmt->FogCoordfvEXT = save_FogCoordfvEXT;
14465 vfmt->Indexf = save_Indexf;
14466 vfmt->Indexfv = save_Indexfv;
14467 vfmt->Materialfv = save_Materialfv;
14468 vfmt->MultiTexCoord1fARB = save_MultiTexCoord1f;
14469 vfmt->MultiTexCoord1fvARB = save_MultiTexCoord1fv;
14470 vfmt->MultiTexCoord2fARB = save_MultiTexCoord2f;
14471 vfmt->MultiTexCoord2fvARB = save_MultiTexCoord2fv;
14472 vfmt->MultiTexCoord3fARB = save_MultiTexCoord3f;
14473 vfmt->MultiTexCoord3fvARB = save_MultiTexCoord3fv;
14474 vfmt->MultiTexCoord4fARB = save_MultiTexCoord4f;
14475 vfmt->MultiTexCoord4fvARB = save_MultiTexCoord4fv;
14476 vfmt->Normal3f = save_Normal3f;
14477 vfmt->Normal3fv = save_Normal3fv;
14478 vfmt->SecondaryColor3fEXT = save_SecondaryColor3fEXT;
14479 vfmt->SecondaryColor3fvEXT = save_SecondaryColor3fvEXT;
14480 vfmt->TexCoord1f = save_TexCoord1f;
14481 vfmt->TexCoord1fv = save_TexCoord1fv;
14482 vfmt->TexCoord2f = save_TexCoord2f;
14483 vfmt->TexCoord2fv = save_TexCoord2fv;
14484 vfmt->TexCoord3f = save_TexCoord3f;
14485 vfmt->TexCoord3fv = save_TexCoord3fv;
14486 vfmt->TexCoord4f = save_TexCoord4f;
14487 vfmt->TexCoord4fv = save_TexCoord4fv;
14488 vfmt->Vertex2f = save_Vertex2f;
14489 vfmt->Vertex2fv = save_Vertex2fv;
14490 vfmt->Vertex3f = save_Vertex3f;
14491 vfmt->Vertex3fv = save_Vertex3fv;
14492 vfmt->Vertex4f = save_Vertex4f;
14493 vfmt->Vertex4fv = save_Vertex4fv;
14494 vfmt->VertexAttrib1fARB = save_VertexAttrib1fARB;
14495 vfmt->VertexAttrib1fvARB = save_VertexAttrib1fvARB;
14496 vfmt->VertexAttrib2fARB = save_VertexAttrib2fARB;
14497 vfmt->VertexAttrib2fvARB = save_VertexAttrib2fvARB;
14498 vfmt->VertexAttrib3fARB = save_VertexAttrib3fARB;
14499 vfmt->VertexAttrib3fvARB = save_VertexAttrib3fvARB;
14500 vfmt->VertexAttrib4fARB = save_VertexAttrib4fARB;
14501 vfmt->VertexAttrib4fvARB = save_VertexAttrib4fvARB;
14502 vfmt->VertexAttribL1d = save_VertexAttribL1d;
14503 vfmt->VertexAttribL1dv = save_VertexAttribL1dv;
14504 vfmt->VertexAttribL2d = save_VertexAttribL2d;
14505 vfmt->VertexAttribL2dv = save_VertexAttribL2dv;
14506 vfmt->VertexAttribL3d = save_VertexAttribL3d;
14507 vfmt->VertexAttribL3dv = save_VertexAttribL3dv;
14508 vfmt->VertexAttribL4d = save_VertexAttribL4d;
14509 vfmt->VertexAttribL4dv = save_VertexAttribL4dv;
14510
14511 vfmt->PrimitiveRestartNV = save_PrimitiveRestartNV;
14512 }
14513
14514
14515 void
14516 _mesa_install_dlist_vtxfmt(struct _glapi_table *disp,
14517 const GLvertexformat *vfmt)
14518 {
14519 SET_CallList(disp, vfmt->CallList);
14520 SET_CallLists(disp, vfmt->CallLists);
14521 }
14522
14523
14524 /**
14525 * Initialize display list state for given context.
14526 */
14527 void
14528 _mesa_init_display_list(struct gl_context *ctx)
14529 {
14530 static GLboolean tableInitialized = GL_FALSE;
14531
14532 /* zero-out the instruction size table, just once */
14533 if (!tableInitialized) {
14534 memset(InstSize, 0, sizeof(InstSize));
14535 tableInitialized = GL_TRUE;
14536 }
14537
14538 /* extension info */
14539 ctx->ListExt = CALLOC_STRUCT(gl_list_extensions);
14540
14541 /* Display list */
14542 ctx->ListState.CallDepth = 0;
14543 ctx->ExecuteFlag = GL_TRUE;
14544 ctx->CompileFlag = GL_FALSE;
14545 ctx->ListState.CurrentBlock = NULL;
14546 ctx->ListState.CurrentPos = 0;
14547
14548 /* Display List group */
14549 ctx->List.ListBase = 0;
14550
14551 save_vtxfmt_init(&ctx->ListState.ListVtxfmt);
14552
14553 InstSize[OPCODE_NOP] = 1;
14554 }
14555
14556
14557 void
14558 _mesa_free_display_list_data(struct gl_context *ctx)
14559 {
14560 free(ctx->ListExt);
14561 ctx->ListExt = NULL;
14562 }