mesa: drop some p_compiler.h types
[mesa.git] / src / mesa / main / dlist.c
1 /*
2 * Mesa 3-D graphics library
3 *
4 * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
5 * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 * OTHER DEALINGS IN THE SOFTWARE.
24 */
25
26
27 /**
28 * \file dlist.c
29 * Display lists management functions.
30 */
31
32 #include "c99_math.h"
33 #include "glheader.h"
34 #include "imports.h"
35 #include "api_arrayelt.h"
36 #include "api_exec.h"
37 #include "api_loopback.h"
38 #include "draw_validate.h"
39 #include "atifragshader.h"
40 #include "config.h"
41 #include "bufferobj.h"
42 #include "arrayobj.h"
43 #include "context.h"
44 #include "dlist.h"
45 #include "enums.h"
46 #include "eval.h"
47 #include "fbobject.h"
48 #include "framebuffer.h"
49 #include "glapi/glapi.h"
50 #include "glformats.h"
51 #include "hash.h"
52 #include "image.h"
53 #include "light.h"
54 #include "macros.h"
55 #include "pack.h"
56 #include "pbo.h"
57 #include "queryobj.h"
58 #include "samplerobj.h"
59 #include "shaderapi.h"
60 #include "syncobj.h"
61 #include "teximage.h"
62 #include "texstorage.h"
63 #include "mtypes.h"
64 #include "varray.h"
65 #include "arbprogram.h"
66 #include "transformfeedback.h"
67
68 #include "math/m_matrix.h"
69
70 #include "main/dispatch.h"
71
72 #include "vbo/vbo.h"
73
74
75 #define USE_BITMAP_ATLAS 1
76
77
78
79 /**
80 * Other parts of Mesa (such as the VBO module) can plug into the display
81 * list system. This structure describes new display list instructions.
82 */
83 struct gl_list_instruction
84 {
85 GLuint Size;
86 void (*Execute)( struct gl_context *ctx, void *data );
87 void (*Destroy)( struct gl_context *ctx, void *data );
88 void (*Print)( struct gl_context *ctx, void *data, FILE *f );
89 };
90
91
92 #define MAX_DLIST_EXT_OPCODES 16
93
94 /**
95 * Used by device drivers to hook new commands into display lists.
96 */
97 struct gl_list_extensions
98 {
99 struct gl_list_instruction Opcode[MAX_DLIST_EXT_OPCODES];
100 GLuint NumOpcodes;
101 };
102
103
104
105 /**
106 * Flush vertices.
107 *
108 * \param ctx GL context.
109 *
110 * Checks if dd_function_table::SaveNeedFlush is marked to flush
111 * stored (save) vertices, and calls vbo_save_SaveFlushVertices if so.
112 */
113 #define SAVE_FLUSH_VERTICES(ctx) \
114 do { \
115 if (ctx->Driver.SaveNeedFlush) \
116 vbo_save_SaveFlushVertices(ctx); \
117 } while (0)
118
119
120 /**
121 * Macro to assert that the API call was made outside the
122 * glBegin()/glEnd() pair, with return value.
123 *
124 * \param ctx GL context.
125 * \param retval value to return value in case the assertion fails.
126 */
127 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval) \
128 do { \
129 if (ctx->Driver.CurrentSavePrimitive <= PRIM_MAX) { \
130 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glBegin/End" ); \
131 return retval; \
132 } \
133 } while (0)
134
135 /**
136 * Macro to assert that the API call was made outside the
137 * glBegin()/glEnd() pair.
138 *
139 * \param ctx GL context.
140 */
141 #define ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx) \
142 do { \
143 if (ctx->Driver.CurrentSavePrimitive <= PRIM_MAX) { \
144 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glBegin/End" ); \
145 return; \
146 } \
147 } while (0)
148
149 /**
150 * Macro to assert that the API call was made outside the
151 * glBegin()/glEnd() pair and flush the vertices.
152 *
153 * \param ctx GL context.
154 */
155 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx) \
156 do { \
157 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx); \
158 SAVE_FLUSH_VERTICES(ctx); \
159 } while (0)
160
161 /**
162 * Macro to assert that the API call was made outside the
163 * glBegin()/glEnd() pair and flush the vertices, with return value.
164 *
165 * \param ctx GL context.
166 * \param retval value to return value in case the assertion fails.
167 */
168 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval) \
169 do { \
170 ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval); \
171 SAVE_FLUSH_VERTICES(ctx); \
172 } while (0)
173
174
175 /**
176 * Display list opcodes.
177 *
178 * The fact that these identifiers are assigned consecutive
179 * integer values starting at 0 is very important, see InstSize array usage)
180 */
181 typedef enum
182 {
183 OPCODE_INVALID = -1, /* Force signed enum */
184 OPCODE_ACCUM,
185 OPCODE_ALPHA_FUNC,
186 OPCODE_BIND_TEXTURE,
187 OPCODE_BITMAP,
188 OPCODE_BLEND_COLOR,
189 OPCODE_BLEND_EQUATION,
190 OPCODE_BLEND_EQUATION_SEPARATE,
191 OPCODE_BLEND_FUNC_SEPARATE,
192
193 OPCODE_BLEND_EQUATION_I,
194 OPCODE_BLEND_EQUATION_SEPARATE_I,
195 OPCODE_BLEND_FUNC_I,
196 OPCODE_BLEND_FUNC_SEPARATE_I,
197
198 OPCODE_CALL_LIST,
199 OPCODE_CALL_LISTS,
200 OPCODE_CLEAR,
201 OPCODE_CLEAR_ACCUM,
202 OPCODE_CLEAR_COLOR,
203 OPCODE_CLEAR_DEPTH,
204 OPCODE_CLEAR_INDEX,
205 OPCODE_CLEAR_STENCIL,
206 OPCODE_CLEAR_BUFFER_IV,
207 OPCODE_CLEAR_BUFFER_UIV,
208 OPCODE_CLEAR_BUFFER_FV,
209 OPCODE_CLEAR_BUFFER_FI,
210 OPCODE_CLIP_PLANE,
211 OPCODE_COLOR_MASK,
212 OPCODE_COLOR_MASK_INDEXED,
213 OPCODE_COLOR_MATERIAL,
214 OPCODE_COPY_PIXELS,
215 OPCODE_COPY_TEX_IMAGE1D,
216 OPCODE_COPY_TEX_IMAGE2D,
217 OPCODE_COPY_TEX_SUB_IMAGE1D,
218 OPCODE_COPY_TEX_SUB_IMAGE2D,
219 OPCODE_COPY_TEX_SUB_IMAGE3D,
220 OPCODE_CULL_FACE,
221 OPCODE_DEPTH_FUNC,
222 OPCODE_DEPTH_MASK,
223 OPCODE_DEPTH_RANGE,
224 OPCODE_DISABLE,
225 OPCODE_DISABLE_INDEXED,
226 OPCODE_DRAW_BUFFER,
227 OPCODE_DRAW_PIXELS,
228 OPCODE_ENABLE,
229 OPCODE_ENABLE_INDEXED,
230 OPCODE_EVALMESH1,
231 OPCODE_EVALMESH2,
232 OPCODE_FOG,
233 OPCODE_FRONT_FACE,
234 OPCODE_FRUSTUM,
235 OPCODE_HINT,
236 OPCODE_INDEX_MASK,
237 OPCODE_INIT_NAMES,
238 OPCODE_LIGHT,
239 OPCODE_LIGHT_MODEL,
240 OPCODE_LINE_STIPPLE,
241 OPCODE_LINE_WIDTH,
242 OPCODE_LIST_BASE,
243 OPCODE_LOAD_IDENTITY,
244 OPCODE_LOAD_MATRIX,
245 OPCODE_LOAD_NAME,
246 OPCODE_LOGIC_OP,
247 OPCODE_MAP1,
248 OPCODE_MAP2,
249 OPCODE_MAPGRID1,
250 OPCODE_MAPGRID2,
251 OPCODE_MATRIX_MODE,
252 OPCODE_MULT_MATRIX,
253 OPCODE_ORTHO,
254 OPCODE_PASSTHROUGH,
255 OPCODE_PIXEL_MAP,
256 OPCODE_PIXEL_TRANSFER,
257 OPCODE_PIXEL_ZOOM,
258 OPCODE_POINT_SIZE,
259 OPCODE_POINT_PARAMETERS,
260 OPCODE_POLYGON_MODE,
261 OPCODE_POLYGON_STIPPLE,
262 OPCODE_POLYGON_OFFSET,
263 OPCODE_POP_ATTRIB,
264 OPCODE_POP_MATRIX,
265 OPCODE_POP_NAME,
266 OPCODE_PRIORITIZE_TEXTURE,
267 OPCODE_PUSH_ATTRIB,
268 OPCODE_PUSH_MATRIX,
269 OPCODE_PUSH_NAME,
270 OPCODE_RASTER_POS,
271 OPCODE_READ_BUFFER,
272 OPCODE_ROTATE,
273 OPCODE_SCALE,
274 OPCODE_SCISSOR,
275 OPCODE_SELECT_TEXTURE_SGIS,
276 OPCODE_SELECT_TEXTURE_COORD_SET,
277 OPCODE_SHADE_MODEL,
278 OPCODE_STENCIL_FUNC,
279 OPCODE_STENCIL_MASK,
280 OPCODE_STENCIL_OP,
281 OPCODE_TEXENV,
282 OPCODE_TEXGEN,
283 OPCODE_TEXPARAMETER,
284 OPCODE_TEX_IMAGE1D,
285 OPCODE_TEX_IMAGE2D,
286 OPCODE_TEX_IMAGE3D,
287 OPCODE_TEX_SUB_IMAGE1D,
288 OPCODE_TEX_SUB_IMAGE2D,
289 OPCODE_TEX_SUB_IMAGE3D,
290 OPCODE_TRANSLATE,
291 OPCODE_VIEWPORT,
292 OPCODE_WINDOW_POS,
293 /* ARB_viewport_array */
294 OPCODE_VIEWPORT_ARRAY_V,
295 OPCODE_VIEWPORT_INDEXED_F,
296 OPCODE_VIEWPORT_INDEXED_FV,
297 OPCODE_SCISSOR_ARRAY_V,
298 OPCODE_SCISSOR_INDEXED,
299 OPCODE_SCISSOR_INDEXED_V,
300 OPCODE_DEPTH_ARRAY_V,
301 OPCODE_DEPTH_INDEXED,
302 /* GL_ARB_multitexture */
303 OPCODE_ACTIVE_TEXTURE,
304 /* GL_ARB_texture_compression */
305 OPCODE_COMPRESSED_TEX_IMAGE_1D,
306 OPCODE_COMPRESSED_TEX_IMAGE_2D,
307 OPCODE_COMPRESSED_TEX_IMAGE_3D,
308 OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D,
309 OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D,
310 OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D,
311 /* GL_ARB_multisample */
312 OPCODE_SAMPLE_COVERAGE,
313 /* GL_ARB_window_pos */
314 OPCODE_WINDOW_POS_ARB,
315 /* GL_ARB_vertex_program */
316 OPCODE_BIND_PROGRAM_ARB,
317 OPCODE_PROGRAM_LOCAL_PARAMETER_ARB,
318 /* GL_EXT_stencil_two_side */
319 OPCODE_ACTIVE_STENCIL_FACE_EXT,
320 /* GL_EXT_depth_bounds_test */
321 OPCODE_DEPTH_BOUNDS_EXT,
322 /* GL_ARB_vertex/fragment_program */
323 OPCODE_PROGRAM_STRING_ARB,
324 OPCODE_PROGRAM_ENV_PARAMETER_ARB,
325 /* GL_ARB_occlusion_query */
326 OPCODE_BEGIN_QUERY_ARB,
327 OPCODE_END_QUERY_ARB,
328 /* GL_ARB_draw_buffers */
329 OPCODE_DRAW_BUFFERS_ARB,
330 /* GL_ATI_fragment_shader */
331 OPCODE_BIND_FRAGMENT_SHADER_ATI,
332 OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI,
333 /* OpenGL 2.0 */
334 OPCODE_STENCIL_FUNC_SEPARATE,
335 OPCODE_STENCIL_OP_SEPARATE,
336 OPCODE_STENCIL_MASK_SEPARATE,
337 /* GL_NV_primitive_restart */
338 OPCODE_PRIMITIVE_RESTART_NV,
339 /* GL_ARB_shader_objects */
340 OPCODE_USE_PROGRAM,
341 OPCODE_UNIFORM_1F,
342 OPCODE_UNIFORM_2F,
343 OPCODE_UNIFORM_3F,
344 OPCODE_UNIFORM_4F,
345 OPCODE_UNIFORM_1FV,
346 OPCODE_UNIFORM_2FV,
347 OPCODE_UNIFORM_3FV,
348 OPCODE_UNIFORM_4FV,
349 OPCODE_UNIFORM_1I,
350 OPCODE_UNIFORM_2I,
351 OPCODE_UNIFORM_3I,
352 OPCODE_UNIFORM_4I,
353 OPCODE_UNIFORM_1IV,
354 OPCODE_UNIFORM_2IV,
355 OPCODE_UNIFORM_3IV,
356 OPCODE_UNIFORM_4IV,
357 OPCODE_UNIFORM_MATRIX22,
358 OPCODE_UNIFORM_MATRIX33,
359 OPCODE_UNIFORM_MATRIX44,
360 OPCODE_UNIFORM_MATRIX23,
361 OPCODE_UNIFORM_MATRIX32,
362 OPCODE_UNIFORM_MATRIX24,
363 OPCODE_UNIFORM_MATRIX42,
364 OPCODE_UNIFORM_MATRIX34,
365 OPCODE_UNIFORM_MATRIX43,
366
367 /* OpenGL 3.0 */
368 OPCODE_UNIFORM_1UI,
369 OPCODE_UNIFORM_2UI,
370 OPCODE_UNIFORM_3UI,
371 OPCODE_UNIFORM_4UI,
372 OPCODE_UNIFORM_1UIV,
373 OPCODE_UNIFORM_2UIV,
374 OPCODE_UNIFORM_3UIV,
375 OPCODE_UNIFORM_4UIV,
376
377 /* GL_ARB_gpu_shader_fp64 */
378 OPCODE_UNIFORM_1D,
379 OPCODE_UNIFORM_2D,
380 OPCODE_UNIFORM_3D,
381 OPCODE_UNIFORM_4D,
382 OPCODE_UNIFORM_1DV,
383 OPCODE_UNIFORM_2DV,
384 OPCODE_UNIFORM_3DV,
385 OPCODE_UNIFORM_4DV,
386 OPCODE_UNIFORM_MATRIX22D,
387 OPCODE_UNIFORM_MATRIX33D,
388 OPCODE_UNIFORM_MATRIX44D,
389 OPCODE_UNIFORM_MATRIX23D,
390 OPCODE_UNIFORM_MATRIX32D,
391 OPCODE_UNIFORM_MATRIX24D,
392 OPCODE_UNIFORM_MATRIX42D,
393 OPCODE_UNIFORM_MATRIX34D,
394 OPCODE_UNIFORM_MATRIX43D,
395
396 /* OpenGL 4.0 / GL_ARB_tessellation_shader */
397 OPCODE_PATCH_PARAMETER_I,
398 OPCODE_PATCH_PARAMETER_FV_INNER,
399 OPCODE_PATCH_PARAMETER_FV_OUTER,
400
401 /* OpenGL 4.2 / GL_ARB_separate_shader_objects */
402 OPCODE_USE_PROGRAM_STAGES,
403 OPCODE_PROGRAM_UNIFORM_1F,
404 OPCODE_PROGRAM_UNIFORM_2F,
405 OPCODE_PROGRAM_UNIFORM_3F,
406 OPCODE_PROGRAM_UNIFORM_4F,
407 OPCODE_PROGRAM_UNIFORM_1FV,
408 OPCODE_PROGRAM_UNIFORM_2FV,
409 OPCODE_PROGRAM_UNIFORM_3FV,
410 OPCODE_PROGRAM_UNIFORM_4FV,
411 OPCODE_PROGRAM_UNIFORM_1D,
412 OPCODE_PROGRAM_UNIFORM_2D,
413 OPCODE_PROGRAM_UNIFORM_3D,
414 OPCODE_PROGRAM_UNIFORM_4D,
415 OPCODE_PROGRAM_UNIFORM_1DV,
416 OPCODE_PROGRAM_UNIFORM_2DV,
417 OPCODE_PROGRAM_UNIFORM_3DV,
418 OPCODE_PROGRAM_UNIFORM_4DV,
419 OPCODE_PROGRAM_UNIFORM_1I,
420 OPCODE_PROGRAM_UNIFORM_2I,
421 OPCODE_PROGRAM_UNIFORM_3I,
422 OPCODE_PROGRAM_UNIFORM_4I,
423 OPCODE_PROGRAM_UNIFORM_1IV,
424 OPCODE_PROGRAM_UNIFORM_2IV,
425 OPCODE_PROGRAM_UNIFORM_3IV,
426 OPCODE_PROGRAM_UNIFORM_4IV,
427 OPCODE_PROGRAM_UNIFORM_1UI,
428 OPCODE_PROGRAM_UNIFORM_2UI,
429 OPCODE_PROGRAM_UNIFORM_3UI,
430 OPCODE_PROGRAM_UNIFORM_4UI,
431 OPCODE_PROGRAM_UNIFORM_1UIV,
432 OPCODE_PROGRAM_UNIFORM_2UIV,
433 OPCODE_PROGRAM_UNIFORM_3UIV,
434 OPCODE_PROGRAM_UNIFORM_4UIV,
435 OPCODE_PROGRAM_UNIFORM_MATRIX22F,
436 OPCODE_PROGRAM_UNIFORM_MATRIX33F,
437 OPCODE_PROGRAM_UNIFORM_MATRIX44F,
438 OPCODE_PROGRAM_UNIFORM_MATRIX23F,
439 OPCODE_PROGRAM_UNIFORM_MATRIX32F,
440 OPCODE_PROGRAM_UNIFORM_MATRIX24F,
441 OPCODE_PROGRAM_UNIFORM_MATRIX42F,
442 OPCODE_PROGRAM_UNIFORM_MATRIX34F,
443 OPCODE_PROGRAM_UNIFORM_MATRIX43F,
444 OPCODE_PROGRAM_UNIFORM_MATRIX22D,
445 OPCODE_PROGRAM_UNIFORM_MATRIX33D,
446 OPCODE_PROGRAM_UNIFORM_MATRIX44D,
447 OPCODE_PROGRAM_UNIFORM_MATRIX23D,
448 OPCODE_PROGRAM_UNIFORM_MATRIX32D,
449 OPCODE_PROGRAM_UNIFORM_MATRIX24D,
450 OPCODE_PROGRAM_UNIFORM_MATRIX42D,
451 OPCODE_PROGRAM_UNIFORM_MATRIX34D,
452 OPCODE_PROGRAM_UNIFORM_MATRIX43D,
453
454 /* GL_ARB_clip_control */
455 OPCODE_CLIP_CONTROL,
456
457 /* GL_ARB_color_buffer_float */
458 OPCODE_CLAMP_COLOR,
459
460 /* GL_EXT_framebuffer_blit */
461 OPCODE_BLIT_FRAMEBUFFER,
462
463 /* Vertex attributes -- fallback for when optimized display
464 * list build isn't active.
465 */
466 OPCODE_ATTR_1F_NV,
467 OPCODE_ATTR_2F_NV,
468 OPCODE_ATTR_3F_NV,
469 OPCODE_ATTR_4F_NV,
470 OPCODE_ATTR_1F_ARB,
471 OPCODE_ATTR_2F_ARB,
472 OPCODE_ATTR_3F_ARB,
473 OPCODE_ATTR_4F_ARB,
474 OPCODE_ATTR_1D,
475 OPCODE_ATTR_2D,
476 OPCODE_ATTR_3D,
477 OPCODE_ATTR_4D,
478 OPCODE_MATERIAL,
479 OPCODE_BEGIN,
480 OPCODE_END,
481 OPCODE_RECTF,
482 OPCODE_EVAL_C1,
483 OPCODE_EVAL_C2,
484 OPCODE_EVAL_P1,
485 OPCODE_EVAL_P2,
486
487 /* GL_EXT_provoking_vertex */
488 OPCODE_PROVOKING_VERTEX,
489
490 /* GL_EXT_transform_feedback */
491 OPCODE_BEGIN_TRANSFORM_FEEDBACK,
492 OPCODE_END_TRANSFORM_FEEDBACK,
493 OPCODE_BIND_TRANSFORM_FEEDBACK,
494 OPCODE_PAUSE_TRANSFORM_FEEDBACK,
495 OPCODE_RESUME_TRANSFORM_FEEDBACK,
496 OPCODE_DRAW_TRANSFORM_FEEDBACK,
497
498 /* GL_EXT_texture_integer */
499 OPCODE_CLEARCOLOR_I,
500 OPCODE_CLEARCOLOR_UI,
501 OPCODE_TEXPARAMETER_I,
502 OPCODE_TEXPARAMETER_UI,
503
504 /* GL_ARB_instanced_arrays */
505 OPCODE_VERTEX_ATTRIB_DIVISOR,
506
507 /* GL_NV_texture_barrier */
508 OPCODE_TEXTURE_BARRIER_NV,
509
510 /* GL_ARB_sampler_object */
511 OPCODE_BIND_SAMPLER,
512 OPCODE_SAMPLER_PARAMETERIV,
513 OPCODE_SAMPLER_PARAMETERFV,
514 OPCODE_SAMPLER_PARAMETERIIV,
515 OPCODE_SAMPLER_PARAMETERUIV,
516
517 /* ARB_compute_shader */
518 OPCODE_DISPATCH_COMPUTE,
519
520 /* GL_ARB_sync */
521 OPCODE_WAIT_SYNC,
522
523 /* GL_NV_conditional_render */
524 OPCODE_BEGIN_CONDITIONAL_RENDER,
525 OPCODE_END_CONDITIONAL_RENDER,
526
527 /* ARB_timer_query */
528 OPCODE_QUERY_COUNTER,
529
530 /* ARB_transform_feedback3 */
531 OPCODE_BEGIN_QUERY_INDEXED,
532 OPCODE_END_QUERY_INDEXED,
533 OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM,
534
535 /* ARB_transform_feedback_instanced */
536 OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED,
537 OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED,
538
539 /* ARB_uniform_buffer_object */
540 OPCODE_UNIFORM_BLOCK_BINDING,
541
542 /* ARB_shader_subroutines */
543 OPCODE_UNIFORM_SUBROUTINES,
544
545 /* EXT_polygon_offset_clamp */
546 OPCODE_POLYGON_OFFSET_CLAMP,
547
548 /* EXT_window_rectangles */
549 OPCODE_WINDOW_RECTANGLES,
550
551 /* NV_conservative_raster */
552 OPCODE_SUBPIXEL_PRECISION_BIAS,
553
554 /* NV_conservative_raster_dilate */
555 OPCODE_CONSERVATIVE_RASTER_PARAMETER_F,
556
557 /* NV_conservative_raster_pre_snap_triangles */
558 OPCODE_CONSERVATIVE_RASTER_PARAMETER_I,
559
560 /* EXT_direct_state_access */
561 OPCODE_MATRIX_LOAD,
562 OPCODE_MATRIX_MULT,
563 OPCODE_MATRIX_ROTATE,
564 OPCODE_MATRIX_SCALE,
565 OPCODE_MATRIX_TRANSLATE,
566 OPCODE_MATRIX_LOAD_IDENTITY,
567 OPCODE_MATRIX_ORTHO,
568 OPCODE_MATRIX_FRUSTUM,
569 OPCODE_MATRIX_PUSH,
570 OPCODE_MATRIX_POP,
571 OPCODE_TEXTUREPARAMETER_F,
572 OPCODE_TEXTUREPARAMETER_I,
573 OPCODE_TEXTURE_IMAGE1D,
574 OPCODE_TEXTURE_IMAGE2D,
575 OPCODE_TEXTURE_IMAGE3D,
576 OPCODE_TEXTURE_SUB_IMAGE1D,
577 OPCODE_TEXTURE_SUB_IMAGE2D,
578 OPCODE_TEXTURE_SUB_IMAGE3D,
579 OPCODE_COPY_TEXTURE_IMAGE1D,
580 OPCODE_COPY_TEXTURE_IMAGE2D,
581 OPCODE_COPY_TEXTURE_SUB_IMAGE1D,
582 OPCODE_COPY_TEXTURE_SUB_IMAGE2D,
583 OPCODE_COPY_TEXTURE_SUB_IMAGE3D,
584 OPCODE_BIND_MULTITEXTURE,
585 OPCODE_MULTITEXPARAMETER_F,
586 OPCODE_MULTITEXPARAMETER_I,
587 OPCODE_MULTITEX_IMAGE1D,
588 OPCODE_MULTITEX_IMAGE2D,
589 OPCODE_MULTITEX_IMAGE3D,
590 OPCODE_MULTITEX_SUB_IMAGE1D,
591 OPCODE_MULTITEX_SUB_IMAGE2D,
592 OPCODE_MULTITEX_SUB_IMAGE3D,
593 OPCODE_COPY_MULTITEX_IMAGE1D,
594 OPCODE_COPY_MULTITEX_IMAGE2D,
595 OPCODE_COPY_MULTITEX_SUB_IMAGE1D,
596 OPCODE_COPY_MULTITEX_SUB_IMAGE2D,
597 OPCODE_COPY_MULTITEX_SUB_IMAGE3D,
598 OPCODE_MULTITEXENV,
599 OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_2D,
600
601 /* The following three are meta instructions */
602 OPCODE_ERROR, /* raise compiled-in error */
603 OPCODE_CONTINUE,
604 OPCODE_NOP, /* No-op (used for 8-byte alignment */
605 OPCODE_END_OF_LIST,
606 OPCODE_EXT_0
607 } OpCode;
608
609
610
611 /**
612 * Display list node.
613 *
614 * Display list instructions are stored as sequences of "nodes". Nodes
615 * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
616 * are linked together with a pointer.
617 *
618 * Each instruction in the display list is stored as a sequence of
619 * contiguous nodes in memory.
620 * Each node is the union of a variety of data types.
621 *
622 * Note, all of these members should be 4 bytes in size or less for the
623 * sake of compact display lists. We store 8-byte pointers in a pair of
624 * these nodes using the save/get_pointer() functions below.
625 */
626 union gl_dlist_node
627 {
628 OpCode opcode;
629 GLboolean b;
630 GLbitfield bf;
631 GLubyte ub;
632 GLshort s;
633 GLushort us;
634 GLint i;
635 GLuint ui;
636 GLenum e;
637 GLfloat f;
638 GLsizei si;
639 };
640
641
642 typedef union gl_dlist_node Node;
643
644
645 /** How many 4-byte dwords to store a pointer */
646 #define POINTER_DWORDS (sizeof(void *) / 4)
647
648 /* We want to keep sizeof(union gl_dlist_node) == 4 to minimize
649 * space for display lists. The following types and functions are
650 * used to help store 4- and 8-byte pointers in 1 or 2 dlist_nodes.
651 */
652 union pointer
653 {
654 void *ptr;
655 GLuint dwords[POINTER_DWORDS];
656 };
657
658
659 /**
660 * Save a 4 or 8-byte pointer at dest (and dest+1).
661 */
662 static inline void
663 save_pointer(Node *dest, void *src)
664 {
665 union pointer p;
666 unsigned i;
667
668 STATIC_ASSERT(POINTER_DWORDS == 1 || POINTER_DWORDS == 2);
669 STATIC_ASSERT(sizeof(Node) == 4);
670
671 p.ptr = src;
672
673 for (i = 0; i < POINTER_DWORDS; i++)
674 dest[i].ui = p.dwords[i];
675 }
676
677
678 /**
679 * Retrieve a 4 or 8-byte pointer from node (node+1).
680 */
681 static inline void *
682 get_pointer(const Node *node)
683 {
684 union pointer p;
685 unsigned i;
686
687 for (i = 0; i < POINTER_DWORDS; i++)
688 p.dwords[i] = node[i].ui;
689
690 return p.ptr;
691 }
692
693
694 /**
695 * Used to store a 64-bit uint in a pair of "Nodes" for the sake of 32-bit
696 * environment.
697 */
698 union uint64_pair
699 {
700 GLuint64 uint64;
701 GLuint uint32[2];
702 };
703
704
705 union float64_pair
706 {
707 GLdouble d;
708 GLuint uint32[2];
709 };
710
711
712 #define ASSIGN_DOUBLE_TO_NODES(n, idx, value) \
713 do { \
714 union float64_pair tmp; \
715 tmp.d = value; \
716 n[idx].ui = tmp.uint32[0]; \
717 n[idx+1].ui = tmp.uint32[1]; \
718 } while (0)
719
720
721 /**
722 * How many nodes to allocate at a time. Note that bulk vertex data
723 * from glBegin/glVertex/glEnd primitives will typically wind up in
724 * a VBO, and not directly in the display list itself.
725 */
726 #define BLOCK_SIZE 256
727
728
729
730 /**
731 * Number of nodes of storage needed for each instruction.
732 * Sizes for dynamically allocated opcodes are stored in the context struct.
733 */
734 static GLuint InstSize[OPCODE_END_OF_LIST + 1];
735
736
737 void mesa_print_display_list(GLuint list);
738
739
740 /**
741 * Does the given display list only contain a single glBitmap call?
742 */
743 static bool
744 is_bitmap_list(const struct gl_display_list *dlist)
745 {
746 const Node *n = dlist->Head;
747 if (n[0].opcode == OPCODE_BITMAP) {
748 n += InstSize[OPCODE_BITMAP];
749 if (n[0].opcode == OPCODE_END_OF_LIST)
750 return true;
751 }
752 return false;
753 }
754
755
756 /**
757 * Is the given display list an empty list?
758 */
759 static bool
760 is_empty_list(const struct gl_display_list *dlist)
761 {
762 const Node *n = dlist->Head;
763 return n[0].opcode == OPCODE_END_OF_LIST;
764 }
765
766
767 /**
768 * Delete/free a gl_bitmap_atlas. Called during context tear-down.
769 */
770 void
771 _mesa_delete_bitmap_atlas(struct gl_context *ctx, struct gl_bitmap_atlas *atlas)
772 {
773 if (atlas->texObj) {
774 ctx->Driver.DeleteTexture(ctx, atlas->texObj);
775 }
776 free(atlas->glyphs);
777 free(atlas);
778 }
779
780
781 /**
782 * Lookup a gl_bitmap_atlas by listBase ID.
783 */
784 static struct gl_bitmap_atlas *
785 lookup_bitmap_atlas(struct gl_context *ctx, GLuint listBase)
786 {
787 struct gl_bitmap_atlas *atlas;
788
789 assert(listBase > 0);
790 atlas = _mesa_HashLookup(ctx->Shared->BitmapAtlas, listBase);
791 return atlas;
792 }
793
794
795 /**
796 * Create new bitmap atlas and insert into hash table.
797 */
798 static struct gl_bitmap_atlas *
799 alloc_bitmap_atlas(struct gl_context *ctx, GLuint listBase)
800 {
801 struct gl_bitmap_atlas *atlas;
802
803 assert(listBase > 0);
804 assert(_mesa_HashLookup(ctx->Shared->BitmapAtlas, listBase) == NULL);
805
806 atlas = calloc(1, sizeof(*atlas));
807 if (atlas) {
808 _mesa_HashInsert(ctx->Shared->BitmapAtlas, listBase, atlas);
809 }
810
811 return atlas;
812 }
813
814
815 /**
816 * Try to build a bitmap atlas. This involves examining a sequence of
817 * display lists which contain glBitmap commands and putting the bitmap
818 * images into a texture map (the atlas).
819 * If we succeed, gl_bitmap_atlas::complete will be set to true.
820 * If we fail, gl_bitmap_atlas::incomplete will be set to true.
821 */
822 static void
823 build_bitmap_atlas(struct gl_context *ctx, struct gl_bitmap_atlas *atlas,
824 GLuint listBase)
825 {
826 unsigned i, row_height = 0, xpos = 0, ypos = 0;
827 GLubyte *map;
828 GLint map_stride;
829
830 assert(atlas);
831 assert(!atlas->complete);
832 assert(atlas->numBitmaps > 0);
833
834 /* We use a rectangle texture (non-normalized coords) for the atlas */
835 assert(ctx->Extensions.NV_texture_rectangle);
836 assert(ctx->Const.MaxTextureRectSize >= 1024);
837
838 atlas->texWidth = 1024;
839 atlas->texHeight = 0; /* determined below */
840
841 atlas->glyphs = malloc(atlas->numBitmaps * sizeof(atlas->glyphs[0]));
842 if (!atlas->glyphs) {
843 /* give up */
844 atlas->incomplete = true;
845 return;
846 }
847
848 /* Loop over the display lists. They should all contain a single glBitmap
849 * call. If not, bail out. Also, compute the position and sizes of each
850 * bitmap in the atlas to determine the texture atlas size.
851 */
852 for (i = 0; i < atlas->numBitmaps; i++) {
853 const struct gl_display_list *list = _mesa_lookup_list(ctx, listBase + i);
854 const Node *n;
855 struct gl_bitmap_glyph *g = &atlas->glyphs[i];
856 unsigned bitmap_width, bitmap_height;
857 float bitmap_xmove, bitmap_ymove, bitmap_xorig, bitmap_yorig;
858
859 if (!list || is_empty_list(list)) {
860 /* stop here */
861 atlas->numBitmaps = i;
862 break;
863 }
864
865 if (!is_bitmap_list(list)) {
866 /* This list does not contain exactly one glBitmap command. Give up. */
867 atlas->incomplete = true;
868 return;
869 }
870
871 /* get bitmap info from the display list command */
872 n = list->Head;
873 assert(n[0].opcode == OPCODE_BITMAP);
874 bitmap_width = n[1].i;
875 bitmap_height = n[2].i;
876 bitmap_xorig = n[3].f;
877 bitmap_yorig = n[4].f;
878 bitmap_xmove = n[5].f;
879 bitmap_ymove = n[6].f;
880
881 if (xpos + bitmap_width > atlas->texWidth) {
882 /* advance to the next row of the texture */
883 xpos = 0;
884 ypos += row_height;
885 row_height = 0;
886 }
887
888 /* save the bitmap's position in the atlas */
889 g->x = xpos;
890 g->y = ypos;
891 g->w = bitmap_width;
892 g->h = bitmap_height;
893 g->xorig = bitmap_xorig;
894 g->yorig = bitmap_yorig;
895 g->xmove = bitmap_xmove;
896 g->ymove = bitmap_ymove;
897
898 xpos += bitmap_width;
899
900 /* keep track of tallest bitmap in the row */
901 row_height = MAX2(row_height, bitmap_height);
902 }
903
904 /* Now we know the texture height */
905 atlas->texHeight = ypos + row_height;
906
907 if (atlas->texHeight == 0) {
908 /* no glyphs found, give up */
909 goto fail;
910 }
911 else if (atlas->texHeight > ctx->Const.MaxTextureRectSize) {
912 /* too large, give up */
913 goto fail;
914 }
915
916 /* Create atlas texture (texture ID is irrelevant) */
917 atlas->texObj = ctx->Driver.NewTextureObject(ctx, 999, GL_TEXTURE_RECTANGLE);
918 if (!atlas->texObj) {
919 goto out_of_memory;
920 }
921
922 atlas->texObj->Sampler.MinFilter = GL_NEAREST;
923 atlas->texObj->Sampler.MagFilter = GL_NEAREST;
924 atlas->texObj->MaxLevel = 0;
925 atlas->texObj->Immutable = GL_TRUE;
926
927 atlas->texImage = _mesa_get_tex_image(ctx, atlas->texObj,
928 GL_TEXTURE_RECTANGLE, 0);
929 if (!atlas->texImage) {
930 goto out_of_memory;
931 }
932
933 _mesa_init_teximage_fields(ctx, atlas->texImage,
934 atlas->texWidth, atlas->texHeight, 1, 0,
935 GL_ALPHA, MESA_FORMAT_A_UNORM8);
936
937 /* alloc image storage */
938 if (!ctx->Driver.AllocTextureImageBuffer(ctx, atlas->texImage)) {
939 goto out_of_memory;
940 }
941
942 /* map teximage, load with bitmap glyphs */
943 ctx->Driver.MapTextureImage(ctx, atlas->texImage, 0,
944 0, 0, atlas->texWidth, atlas->texHeight,
945 GL_MAP_WRITE_BIT, &map, &map_stride);
946 if (!map) {
947 goto out_of_memory;
948 }
949
950 /* Background/clear pixels are 0xff, foreground/set pixels are 0x0 */
951 memset(map, 0xff, map_stride * atlas->texHeight);
952
953 for (i = 0; i < atlas->numBitmaps; i++) {
954 const struct gl_display_list *list = _mesa_lookup_list(ctx, listBase + i);
955 const Node *n = list->Head;
956
957 assert(n[0].opcode == OPCODE_BITMAP ||
958 n[0].opcode == OPCODE_END_OF_LIST);
959
960 if (n[0].opcode == OPCODE_BITMAP) {
961 unsigned bitmap_width = n[1].i;
962 unsigned bitmap_height = n[2].i;
963 unsigned xpos = atlas->glyphs[i].x;
964 unsigned ypos = atlas->glyphs[i].y;
965 const void *bitmap_image = get_pointer(&n[7]);
966
967 assert(atlas->glyphs[i].w == bitmap_width);
968 assert(atlas->glyphs[i].h == bitmap_height);
969
970 /* put the bitmap image into the texture image */
971 _mesa_expand_bitmap(bitmap_width, bitmap_height,
972 &ctx->DefaultPacking, bitmap_image,
973 map + map_stride * ypos + xpos, /* dest addr */
974 map_stride, 0x0);
975 }
976 }
977
978 ctx->Driver.UnmapTextureImage(ctx, atlas->texImage, 0);
979
980 atlas->complete = true;
981
982 return;
983
984 out_of_memory:
985 _mesa_error(ctx, GL_OUT_OF_MEMORY, "Display list bitmap atlas");
986 fail:
987 if (atlas->texObj) {
988 ctx->Driver.DeleteTexture(ctx, atlas->texObj);
989 }
990 free(atlas->glyphs);
991 atlas->glyphs = NULL;
992 atlas->incomplete = true;
993 }
994
995
996 /**
997 * Allocate a gl_display_list object with an initial block of storage.
998 * \param count how many display list nodes/tokens to allocate
999 */
1000 static struct gl_display_list *
1001 make_list(GLuint name, GLuint count)
1002 {
1003 struct gl_display_list *dlist = CALLOC_STRUCT(gl_display_list);
1004 dlist->Name = name;
1005 dlist->Head = malloc(sizeof(Node) * count);
1006 dlist->Head[0].opcode = OPCODE_END_OF_LIST;
1007 /* All InstSize[] entries must be non-zero */
1008 InstSize[OPCODE_END_OF_LIST] = 1;
1009 return dlist;
1010 }
1011
1012
1013 /**
1014 * Lookup function to just encapsulate casting.
1015 */
1016 struct gl_display_list *
1017 _mesa_lookup_list(struct gl_context *ctx, GLuint list)
1018 {
1019 return (struct gl_display_list *)
1020 _mesa_HashLookup(ctx->Shared->DisplayList, list);
1021 }
1022
1023
1024 /** Is the given opcode an extension code? */
1025 static inline GLboolean
1026 is_ext_opcode(OpCode opcode)
1027 {
1028 return (opcode >= OPCODE_EXT_0);
1029 }
1030
1031
1032 /** Destroy an extended opcode instruction */
1033 static GLint
1034 ext_opcode_destroy(struct gl_context *ctx, Node *node)
1035 {
1036 const GLint i = node[0].opcode - OPCODE_EXT_0;
1037 GLint step;
1038 ctx->ListExt->Opcode[i].Destroy(ctx, &node[1]);
1039 step = ctx->ListExt->Opcode[i].Size;
1040 return step;
1041 }
1042
1043
1044 /** Execute an extended opcode instruction */
1045 static GLint
1046 ext_opcode_execute(struct gl_context *ctx, Node *node)
1047 {
1048 const GLint i = node[0].opcode - OPCODE_EXT_0;
1049 GLint step;
1050 ctx->ListExt->Opcode[i].Execute(ctx, &node[1]);
1051 step = ctx->ListExt->Opcode[i].Size;
1052 return step;
1053 }
1054
1055
1056 /** Print an extended opcode instruction */
1057 static GLint
1058 ext_opcode_print(struct gl_context *ctx, Node *node, FILE *f)
1059 {
1060 const GLint i = node[0].opcode - OPCODE_EXT_0;
1061 GLint step;
1062 ctx->ListExt->Opcode[i].Print(ctx, &node[1], f);
1063 step = ctx->ListExt->Opcode[i].Size;
1064 return step;
1065 }
1066
1067
1068 /**
1069 * Delete the named display list, but don't remove from hash table.
1070 * \param dlist - display list pointer
1071 */
1072 void
1073 _mesa_delete_list(struct gl_context *ctx, struct gl_display_list *dlist)
1074 {
1075 Node *n, *block;
1076 GLboolean done;
1077
1078 n = block = dlist->Head;
1079
1080 done = block ? GL_FALSE : GL_TRUE;
1081 while (!done) {
1082 const OpCode opcode = n[0].opcode;
1083
1084 /* check for extension opcodes first */
1085 if (is_ext_opcode(opcode)) {
1086 n += ext_opcode_destroy(ctx, n);
1087 }
1088 else {
1089 switch (opcode) {
1090 /* for some commands, we need to free malloc'd memory */
1091 case OPCODE_MAP1:
1092 free(get_pointer(&n[6]));
1093 break;
1094 case OPCODE_MAP2:
1095 free(get_pointer(&n[10]));
1096 break;
1097 case OPCODE_CALL_LISTS:
1098 free(get_pointer(&n[3]));
1099 break;
1100 case OPCODE_DRAW_PIXELS:
1101 free(get_pointer(&n[5]));
1102 break;
1103 case OPCODE_BITMAP:
1104 free(get_pointer(&n[7]));
1105 break;
1106 case OPCODE_POLYGON_STIPPLE:
1107 free(get_pointer(&n[1]));
1108 break;
1109 case OPCODE_TEX_IMAGE1D:
1110 free(get_pointer(&n[8]));
1111 break;
1112 case OPCODE_TEX_IMAGE2D:
1113 free(get_pointer(&n[9]));
1114 break;
1115 case OPCODE_TEX_IMAGE3D:
1116 free(get_pointer(&n[10]));
1117 break;
1118 case OPCODE_TEX_SUB_IMAGE1D:
1119 free(get_pointer(&n[7]));
1120 break;
1121 case OPCODE_TEX_SUB_IMAGE2D:
1122 free(get_pointer(&n[9]));
1123 break;
1124 case OPCODE_TEX_SUB_IMAGE3D:
1125 free(get_pointer(&n[11]));
1126 break;
1127 case OPCODE_COMPRESSED_TEX_IMAGE_1D:
1128 free(get_pointer(&n[7]));
1129 break;
1130 case OPCODE_COMPRESSED_TEX_IMAGE_2D:
1131 free(get_pointer(&n[8]));
1132 break;
1133 case OPCODE_COMPRESSED_TEX_IMAGE_3D:
1134 free(get_pointer(&n[9]));
1135 break;
1136 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D:
1137 free(get_pointer(&n[7]));
1138 break;
1139 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D:
1140 free(get_pointer(&n[9]));
1141 break;
1142 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D:
1143 free(get_pointer(&n[11]));
1144 break;
1145 case OPCODE_PROGRAM_STRING_ARB:
1146 free(get_pointer(&n[4])); /* program string */
1147 break;
1148 case OPCODE_UNIFORM_1FV:
1149 case OPCODE_UNIFORM_2FV:
1150 case OPCODE_UNIFORM_3FV:
1151 case OPCODE_UNIFORM_4FV:
1152 case OPCODE_UNIFORM_1DV:
1153 case OPCODE_UNIFORM_2DV:
1154 case OPCODE_UNIFORM_3DV:
1155 case OPCODE_UNIFORM_4DV:
1156 case OPCODE_UNIFORM_1IV:
1157 case OPCODE_UNIFORM_2IV:
1158 case OPCODE_UNIFORM_3IV:
1159 case OPCODE_UNIFORM_4IV:
1160 case OPCODE_UNIFORM_1UIV:
1161 case OPCODE_UNIFORM_2UIV:
1162 case OPCODE_UNIFORM_3UIV:
1163 case OPCODE_UNIFORM_4UIV:
1164 free(get_pointer(&n[3]));
1165 break;
1166 case OPCODE_UNIFORM_MATRIX22:
1167 case OPCODE_UNIFORM_MATRIX33:
1168 case OPCODE_UNIFORM_MATRIX44:
1169 case OPCODE_UNIFORM_MATRIX24:
1170 case OPCODE_UNIFORM_MATRIX42:
1171 case OPCODE_UNIFORM_MATRIX23:
1172 case OPCODE_UNIFORM_MATRIX32:
1173 case OPCODE_UNIFORM_MATRIX34:
1174 case OPCODE_UNIFORM_MATRIX43:
1175 case OPCODE_UNIFORM_MATRIX22D:
1176 case OPCODE_UNIFORM_MATRIX33D:
1177 case OPCODE_UNIFORM_MATRIX44D:
1178 case OPCODE_UNIFORM_MATRIX24D:
1179 case OPCODE_UNIFORM_MATRIX42D:
1180 case OPCODE_UNIFORM_MATRIX23D:
1181 case OPCODE_UNIFORM_MATRIX32D:
1182 case OPCODE_UNIFORM_MATRIX34D:
1183 case OPCODE_UNIFORM_MATRIX43D:
1184 free(get_pointer(&n[4]));
1185 break;
1186 case OPCODE_PROGRAM_UNIFORM_1FV:
1187 case OPCODE_PROGRAM_UNIFORM_2FV:
1188 case OPCODE_PROGRAM_UNIFORM_3FV:
1189 case OPCODE_PROGRAM_UNIFORM_4FV:
1190 case OPCODE_PROGRAM_UNIFORM_1DV:
1191 case OPCODE_PROGRAM_UNIFORM_2DV:
1192 case OPCODE_PROGRAM_UNIFORM_3DV:
1193 case OPCODE_PROGRAM_UNIFORM_4DV:
1194 case OPCODE_PROGRAM_UNIFORM_1IV:
1195 case OPCODE_PROGRAM_UNIFORM_2IV:
1196 case OPCODE_PROGRAM_UNIFORM_3IV:
1197 case OPCODE_PROGRAM_UNIFORM_4IV:
1198 case OPCODE_PROGRAM_UNIFORM_1UIV:
1199 case OPCODE_PROGRAM_UNIFORM_2UIV:
1200 case OPCODE_PROGRAM_UNIFORM_3UIV:
1201 case OPCODE_PROGRAM_UNIFORM_4UIV:
1202 free(get_pointer(&n[4]));
1203 break;
1204 case OPCODE_PROGRAM_UNIFORM_MATRIX22F:
1205 case OPCODE_PROGRAM_UNIFORM_MATRIX33F:
1206 case OPCODE_PROGRAM_UNIFORM_MATRIX44F:
1207 case OPCODE_PROGRAM_UNIFORM_MATRIX24F:
1208 case OPCODE_PROGRAM_UNIFORM_MATRIX42F:
1209 case OPCODE_PROGRAM_UNIFORM_MATRIX23F:
1210 case OPCODE_PROGRAM_UNIFORM_MATRIX32F:
1211 case OPCODE_PROGRAM_UNIFORM_MATRIX34F:
1212 case OPCODE_PROGRAM_UNIFORM_MATRIX43F:
1213 case OPCODE_PROGRAM_UNIFORM_MATRIX22D:
1214 case OPCODE_PROGRAM_UNIFORM_MATRIX33D:
1215 case OPCODE_PROGRAM_UNIFORM_MATRIX44D:
1216 case OPCODE_PROGRAM_UNIFORM_MATRIX24D:
1217 case OPCODE_PROGRAM_UNIFORM_MATRIX42D:
1218 case OPCODE_PROGRAM_UNIFORM_MATRIX23D:
1219 case OPCODE_PROGRAM_UNIFORM_MATRIX32D:
1220 case OPCODE_PROGRAM_UNIFORM_MATRIX34D:
1221 case OPCODE_PROGRAM_UNIFORM_MATRIX43D:
1222 free(get_pointer(&n[5]));
1223 break;
1224 case OPCODE_PIXEL_MAP:
1225 free(get_pointer(&n[3]));
1226 break;
1227 case OPCODE_VIEWPORT_ARRAY_V:
1228 case OPCODE_SCISSOR_ARRAY_V:
1229 case OPCODE_DEPTH_ARRAY_V:
1230 case OPCODE_UNIFORM_SUBROUTINES:
1231 case OPCODE_WINDOW_RECTANGLES:
1232 free(get_pointer(&n[3]));
1233 break;
1234 case OPCODE_TEXTURE_IMAGE1D:
1235 case OPCODE_MULTITEX_IMAGE1D:
1236 free(get_pointer(&n[9]));
1237 break;
1238 case OPCODE_TEXTURE_IMAGE2D:
1239 case OPCODE_MULTITEX_IMAGE2D:
1240 free(get_pointer(&n[10]));
1241 break;
1242 case OPCODE_TEXTURE_IMAGE3D:
1243 case OPCODE_MULTITEX_IMAGE3D:
1244 free(get_pointer(&n[11]));
1245 break;
1246 case OPCODE_TEXTURE_SUB_IMAGE1D:
1247 case OPCODE_MULTITEX_SUB_IMAGE1D:
1248 free(get_pointer(&n[8]));
1249 break;
1250 case OPCODE_TEXTURE_SUB_IMAGE2D:
1251 case OPCODE_MULTITEX_SUB_IMAGE2D:
1252 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_2D:
1253 free(get_pointer(&n[10]));
1254 break;
1255 case OPCODE_TEXTURE_SUB_IMAGE3D:
1256 case OPCODE_MULTITEX_SUB_IMAGE3D:
1257 free(get_pointer(&n[12]));
1258 break;
1259 case OPCODE_CONTINUE:
1260 n = (Node *) get_pointer(&n[1]);
1261 free(block);
1262 block = n;
1263 break;
1264 case OPCODE_END_OF_LIST:
1265 free(block);
1266 done = GL_TRUE;
1267 break;
1268 default:
1269 /* just increment 'n' pointer, below */
1270 ;
1271 }
1272
1273 if (opcode != OPCODE_CONTINUE) {
1274 assert(InstSize[opcode] > 0);
1275 n += InstSize[opcode];
1276 }
1277 }
1278 }
1279
1280 free(dlist->Label);
1281 free(dlist);
1282 }
1283
1284
1285 /**
1286 * Called by _mesa_HashWalk() to check if a display list which is being
1287 * deleted belongs to a bitmap texture atlas.
1288 */
1289 static void
1290 check_atlas_for_deleted_list(GLuint atlas_id, void *data, void *userData)
1291 {
1292 struct gl_bitmap_atlas *atlas = (struct gl_bitmap_atlas *) data;
1293 GLuint list_id = *((GLuint *) userData); /* the list being deleted */
1294
1295 /* See if the list_id falls in the range contained in this texture atlas */
1296 if (atlas->complete &&
1297 list_id >= atlas_id &&
1298 list_id < atlas_id + atlas->numBitmaps) {
1299 /* Mark the atlas as incomplete so it doesn't get used. But don't
1300 * delete it yet since we don't want to try to recreate it in the next
1301 * glCallLists.
1302 */
1303 atlas->complete = false;
1304 atlas->incomplete = true;
1305 }
1306 }
1307
1308
1309 /**
1310 * Destroy a display list and remove from hash table.
1311 * \param list - display list number
1312 */
1313 static void
1314 destroy_list(struct gl_context *ctx, GLuint list)
1315 {
1316 struct gl_display_list *dlist;
1317
1318 if (list == 0)
1319 return;
1320
1321 dlist = _mesa_lookup_list(ctx, list);
1322 if (!dlist)
1323 return;
1324
1325 if (is_bitmap_list(dlist)) {
1326 /* If we're destroying a simple glBitmap display list, there's a
1327 * chance that we're destroying a bitmap image that's in a texture
1328 * atlas. Examine all atlases to see if that's the case. There's
1329 * usually few (if any) atlases so this isn't expensive.
1330 */
1331 _mesa_HashWalk(ctx->Shared->BitmapAtlas,
1332 check_atlas_for_deleted_list, &list);
1333 }
1334
1335 _mesa_delete_list(ctx, dlist);
1336 _mesa_HashRemove(ctx->Shared->DisplayList, list);
1337 }
1338
1339
1340 /*
1341 * Translate the nth element of list from <type> to GLint.
1342 */
1343 static GLint
1344 translate_id(GLsizei n, GLenum type, const GLvoid * list)
1345 {
1346 GLbyte *bptr;
1347 GLubyte *ubptr;
1348 GLshort *sptr;
1349 GLushort *usptr;
1350 GLint *iptr;
1351 GLuint *uiptr;
1352 GLfloat *fptr;
1353
1354 switch (type) {
1355 case GL_BYTE:
1356 bptr = (GLbyte *) list;
1357 return (GLint) bptr[n];
1358 case GL_UNSIGNED_BYTE:
1359 ubptr = (GLubyte *) list;
1360 return (GLint) ubptr[n];
1361 case GL_SHORT:
1362 sptr = (GLshort *) list;
1363 return (GLint) sptr[n];
1364 case GL_UNSIGNED_SHORT:
1365 usptr = (GLushort *) list;
1366 return (GLint) usptr[n];
1367 case GL_INT:
1368 iptr = (GLint *) list;
1369 return iptr[n];
1370 case GL_UNSIGNED_INT:
1371 uiptr = (GLuint *) list;
1372 return (GLint) uiptr[n];
1373 case GL_FLOAT:
1374 fptr = (GLfloat *) list;
1375 return (GLint) floorf(fptr[n]);
1376 case GL_2_BYTES:
1377 ubptr = ((GLubyte *) list) + 2 * n;
1378 return (GLint) ubptr[0] * 256
1379 + (GLint) ubptr[1];
1380 case GL_3_BYTES:
1381 ubptr = ((GLubyte *) list) + 3 * n;
1382 return (GLint) ubptr[0] * 65536
1383 + (GLint) ubptr[1] * 256
1384 + (GLint) ubptr[2];
1385 case GL_4_BYTES:
1386 ubptr = ((GLubyte *) list) + 4 * n;
1387 return (GLint) ubptr[0] * 16777216
1388 + (GLint) ubptr[1] * 65536
1389 + (GLint) ubptr[2] * 256
1390 + (GLint) ubptr[3];
1391 default:
1392 return 0;
1393 }
1394 }
1395
1396
1397 /**
1398 * Wrapper for _mesa_unpack_image/bitmap() that handles pixel buffer objects.
1399 * If width < 0 or height < 0 or format or type are invalid we'll just
1400 * return NULL. We will not generate an error since OpenGL command
1401 * arguments aren't error-checked until the command is actually executed
1402 * (not when they're compiled).
1403 * But if we run out of memory, GL_OUT_OF_MEMORY will be recorded.
1404 */
1405 static GLvoid *
1406 unpack_image(struct gl_context *ctx, GLuint dimensions,
1407 GLsizei width, GLsizei height, GLsizei depth,
1408 GLenum format, GLenum type, const GLvoid * pixels,
1409 const struct gl_pixelstore_attrib *unpack)
1410 {
1411 if (width <= 0 || height <= 0) {
1412 return NULL;
1413 }
1414
1415 if (_mesa_bytes_per_pixel(format, type) < 0) {
1416 /* bad format and/or type */
1417 return NULL;
1418 }
1419
1420 if (!_mesa_is_bufferobj(unpack->BufferObj)) {
1421 /* no PBO */
1422 GLvoid *image;
1423
1424 image = _mesa_unpack_image(dimensions, width, height, depth,
1425 format, type, pixels, unpack);
1426 if (pixels && !image) {
1427 _mesa_error(ctx, GL_OUT_OF_MEMORY, "display list construction");
1428 }
1429 return image;
1430 }
1431 else if (_mesa_validate_pbo_access(dimensions, unpack, width, height,
1432 depth, format, type, INT_MAX, pixels)) {
1433 const GLubyte *map, *src;
1434 GLvoid *image;
1435
1436 map = (GLubyte *)
1437 ctx->Driver.MapBufferRange(ctx, 0, unpack->BufferObj->Size,
1438 GL_MAP_READ_BIT, unpack->BufferObj,
1439 MAP_INTERNAL);
1440 if (!map) {
1441 /* unable to map src buffer! */
1442 _mesa_error(ctx, GL_INVALID_OPERATION, "unable to map PBO");
1443 return NULL;
1444 }
1445
1446 src = ADD_POINTERS(map, pixels);
1447 image = _mesa_unpack_image(dimensions, width, height, depth,
1448 format, type, src, unpack);
1449
1450 ctx->Driver.UnmapBuffer(ctx, unpack->BufferObj, MAP_INTERNAL);
1451
1452 if (!image) {
1453 _mesa_error(ctx, GL_OUT_OF_MEMORY, "display list construction");
1454 }
1455 return image;
1456 }
1457
1458 /* bad access! */
1459 _mesa_error(ctx, GL_INVALID_OPERATION, "invalid PBO access");
1460 return NULL;
1461 }
1462
1463
1464 /** Return copy of memory */
1465 static void *
1466 memdup(const void *src, GLsizei bytes)
1467 {
1468 void *b = bytes >= 0 ? malloc(bytes) : NULL;
1469 if (b)
1470 memcpy(b, src, bytes);
1471 return b;
1472 }
1473
1474
1475 /**
1476 * Allocate space for a display list instruction (opcode + payload space).
1477 * \param opcode the instruction opcode (OPCODE_* value)
1478 * \param bytes instruction payload size (not counting opcode)
1479 * \param align8 does the payload need to be 8-byte aligned?
1480 * This is only relevant in 64-bit environments.
1481 * \return pointer to allocated memory (the payload will be at pointer+1)
1482 */
1483 static Node *
1484 dlist_alloc(struct gl_context *ctx, OpCode opcode, GLuint bytes, bool align8)
1485 {
1486 const GLuint numNodes = 1 + (bytes + sizeof(Node) - 1) / sizeof(Node);
1487 const GLuint contNodes = 1 + POINTER_DWORDS; /* size of continue info */
1488 GLuint nopNode;
1489 Node *n;
1490
1491 assert(bytes <= BLOCK_SIZE * sizeof(Node));
1492
1493 if (opcode < OPCODE_EXT_0) {
1494 if (InstSize[opcode] == 0) {
1495 /* save instruction size now */
1496 InstSize[opcode] = numNodes;
1497 }
1498 else {
1499 /* make sure instruction size agrees */
1500 assert(numNodes == InstSize[opcode]);
1501 }
1502 }
1503
1504 if (sizeof(void *) > sizeof(Node) && align8
1505 && ctx->ListState.CurrentPos % 2 == 0) {
1506 /* The opcode would get placed at node[0] and the payload would start
1507 * at node[1]. But the payload needs to be at an even offset (8-byte
1508 * multiple).
1509 */
1510 nopNode = 1;
1511 }
1512 else {
1513 nopNode = 0;
1514 }
1515
1516 if (ctx->ListState.CurrentPos + nopNode + numNodes + contNodes
1517 > BLOCK_SIZE) {
1518 /* This block is full. Allocate a new block and chain to it */
1519 Node *newblock;
1520 n = ctx->ListState.CurrentBlock + ctx->ListState.CurrentPos;
1521 n[0].opcode = OPCODE_CONTINUE;
1522 newblock = malloc(sizeof(Node) * BLOCK_SIZE);
1523 if (!newblock) {
1524 _mesa_error(ctx, GL_OUT_OF_MEMORY, "Building display list");
1525 return NULL;
1526 }
1527
1528 /* a fresh block should be 8-byte aligned on 64-bit systems */
1529 assert(((GLintptr) newblock) % sizeof(void *) == 0);
1530
1531 save_pointer(&n[1], newblock);
1532 ctx->ListState.CurrentBlock = newblock;
1533 ctx->ListState.CurrentPos = 0;
1534
1535 /* Display list nodes are always 4 bytes. If we need 8-byte alignment
1536 * we have to insert a NOP so that the payload of the real opcode lands
1537 * on an even location:
1538 * node[0] = OPCODE_NOP
1539 * node[1] = OPCODE_x;
1540 * node[2] = start of payload
1541 */
1542 nopNode = sizeof(void *) > sizeof(Node) && align8;
1543 }
1544
1545 n = ctx->ListState.CurrentBlock + ctx->ListState.CurrentPos;
1546 if (nopNode) {
1547 assert(ctx->ListState.CurrentPos % 2 == 0); /* even value */
1548 n[0].opcode = OPCODE_NOP;
1549 n++;
1550 /* The "real" opcode will now be at an odd location and the payload
1551 * will be at an even location.
1552 */
1553 }
1554 ctx->ListState.CurrentPos += nopNode + numNodes;
1555
1556 n[0].opcode = opcode;
1557
1558 return n;
1559 }
1560
1561
1562
1563 /**
1564 * Allocate space for a display list instruction. Used by callers outside
1565 * this file for things like VBO vertex data.
1566 *
1567 * \param opcode the instruction opcode (OPCODE_* value)
1568 * \param bytes instruction size in bytes, not counting opcode.
1569 * \return pointer to the usable data area (not including the internal
1570 * opcode).
1571 */
1572 void *
1573 _mesa_dlist_alloc(struct gl_context *ctx, GLuint opcode, GLuint bytes)
1574 {
1575 Node *n = dlist_alloc(ctx, (OpCode) opcode, bytes, false);
1576 if (n)
1577 return n + 1; /* return pointer to payload area, after opcode */
1578 else
1579 return NULL;
1580 }
1581
1582
1583 /**
1584 * Same as _mesa_dlist_alloc(), but return a pointer which is 8-byte
1585 * aligned in 64-bit environments, 4-byte aligned otherwise.
1586 */
1587 void *
1588 _mesa_dlist_alloc_aligned(struct gl_context *ctx, GLuint opcode, GLuint bytes)
1589 {
1590 Node *n = dlist_alloc(ctx, (OpCode) opcode, bytes, true);
1591 if (n)
1592 return n + 1; /* return pointer to payload area, after opcode */
1593 else
1594 return NULL;
1595 }
1596
1597
1598 /**
1599 * This function allows modules and drivers to get their own opcodes
1600 * for extending display list functionality.
1601 * \param ctx the rendering context
1602 * \param size number of bytes for storing the new display list command
1603 * \param execute function to execute the new display list command
1604 * \param destroy function to destroy the new display list command
1605 * \param print function to print the new display list command
1606 * \return the new opcode number or -1 if error
1607 */
1608 GLint
1609 _mesa_dlist_alloc_opcode(struct gl_context *ctx,
1610 GLuint size,
1611 void (*execute) (struct gl_context *, void *),
1612 void (*destroy) (struct gl_context *, void *),
1613 void (*print) (struct gl_context *, void *, FILE *))
1614 {
1615 if (ctx->ListExt->NumOpcodes < MAX_DLIST_EXT_OPCODES) {
1616 const GLuint i = ctx->ListExt->NumOpcodes++;
1617 ctx->ListExt->Opcode[i].Size =
1618 1 + (size + sizeof(Node) - 1) / sizeof(Node);
1619 ctx->ListExt->Opcode[i].Execute = execute;
1620 ctx->ListExt->Opcode[i].Destroy = destroy;
1621 ctx->ListExt->Opcode[i].Print = print;
1622 return i + OPCODE_EXT_0;
1623 }
1624 return -1;
1625 }
1626
1627
1628 /**
1629 * Allocate space for a display list instruction. The space is basically
1630 * an array of Nodes where node[0] holds the opcode, node[1] is the first
1631 * function parameter, node[2] is the second parameter, etc.
1632 *
1633 * \param opcode one of OPCODE_x
1634 * \param nparams number of function parameters
1635 * \return pointer to start of instruction space
1636 */
1637 static inline Node *
1638 alloc_instruction(struct gl_context *ctx, OpCode opcode, GLuint nparams)
1639 {
1640 return dlist_alloc(ctx, opcode, nparams * sizeof(Node), false);
1641 }
1642
1643
1644 /**
1645 * Called by EndList to try to reduce memory used for the list.
1646 */
1647 static void
1648 trim_list(struct gl_context *ctx)
1649 {
1650 /* If the list we're ending only has one allocated block of nodes/tokens
1651 * and its size isn't a full block size, realloc the block to use less
1652 * memory. This is important for apps that create many small display
1653 * lists and apps that use glXUseXFont (many lists each containing one
1654 * glBitmap call).
1655 * Note: we currently only trim display lists that allocated one block
1656 * of tokens. That hits the short list case which is what we're mainly
1657 * concerned with. Trimming longer lists would involve traversing the
1658 * linked list of blocks.
1659 */
1660 struct gl_dlist_state *list = &ctx->ListState;
1661
1662 if ((list->CurrentList->Head == list->CurrentBlock) &&
1663 (list->CurrentPos < BLOCK_SIZE)) {
1664 /* There's only one block and it's not full, so realloc */
1665 GLuint newSize = list->CurrentPos * sizeof(Node);
1666 list->CurrentList->Head =
1667 list->CurrentBlock = realloc(list->CurrentBlock, newSize);
1668 if (!list->CurrentBlock) {
1669 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glEndList");
1670 }
1671 }
1672 }
1673
1674
1675
1676 /*
1677 * Display List compilation functions
1678 */
1679 static void GLAPIENTRY
1680 save_Accum(GLenum op, GLfloat value)
1681 {
1682 GET_CURRENT_CONTEXT(ctx);
1683 Node *n;
1684 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1685 n = alloc_instruction(ctx, OPCODE_ACCUM, 2);
1686 if (n) {
1687 n[1].e = op;
1688 n[2].f = value;
1689 }
1690 if (ctx->ExecuteFlag) {
1691 CALL_Accum(ctx->Exec, (op, value));
1692 }
1693 }
1694
1695
1696 static void GLAPIENTRY
1697 save_AlphaFunc(GLenum func, GLclampf ref)
1698 {
1699 GET_CURRENT_CONTEXT(ctx);
1700 Node *n;
1701 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1702 n = alloc_instruction(ctx, OPCODE_ALPHA_FUNC, 2);
1703 if (n) {
1704 n[1].e = func;
1705 n[2].f = (GLfloat) ref;
1706 }
1707 if (ctx->ExecuteFlag) {
1708 CALL_AlphaFunc(ctx->Exec, (func, ref));
1709 }
1710 }
1711
1712
1713 static void GLAPIENTRY
1714 save_BindTexture(GLenum target, GLuint texture)
1715 {
1716 GET_CURRENT_CONTEXT(ctx);
1717 Node *n;
1718 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1719 n = alloc_instruction(ctx, OPCODE_BIND_TEXTURE, 2);
1720 if (n) {
1721 n[1].e = target;
1722 n[2].ui = texture;
1723 }
1724 if (ctx->ExecuteFlag) {
1725 CALL_BindTexture(ctx->Exec, (target, texture));
1726 }
1727 }
1728
1729
1730 static void GLAPIENTRY
1731 save_Bitmap(GLsizei width, GLsizei height,
1732 GLfloat xorig, GLfloat yorig,
1733 GLfloat xmove, GLfloat ymove, const GLubyte * pixels)
1734 {
1735 GET_CURRENT_CONTEXT(ctx);
1736 Node *n;
1737 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1738 n = alloc_instruction(ctx, OPCODE_BITMAP, 6 + POINTER_DWORDS);
1739 if (n) {
1740 n[1].i = (GLint) width;
1741 n[2].i = (GLint) height;
1742 n[3].f = xorig;
1743 n[4].f = yorig;
1744 n[5].f = xmove;
1745 n[6].f = ymove;
1746 save_pointer(&n[7],
1747 unpack_image(ctx, 2, width, height, 1, GL_COLOR_INDEX,
1748 GL_BITMAP, pixels, &ctx->Unpack));
1749 }
1750 if (ctx->ExecuteFlag) {
1751 CALL_Bitmap(ctx->Exec, (width, height,
1752 xorig, yorig, xmove, ymove, pixels));
1753 }
1754 }
1755
1756
1757 static void GLAPIENTRY
1758 save_BlendEquation(GLenum mode)
1759 {
1760 GET_CURRENT_CONTEXT(ctx);
1761 Node *n;
1762 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1763 n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION, 1);
1764 if (n) {
1765 n[1].e = mode;
1766 }
1767 if (ctx->ExecuteFlag) {
1768 CALL_BlendEquation(ctx->Exec, (mode));
1769 }
1770 }
1771
1772
1773 static void GLAPIENTRY
1774 save_BlendEquationSeparateEXT(GLenum modeRGB, GLenum modeA)
1775 {
1776 GET_CURRENT_CONTEXT(ctx);
1777 Node *n;
1778 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1779 n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION_SEPARATE, 2);
1780 if (n) {
1781 n[1].e = modeRGB;
1782 n[2].e = modeA;
1783 }
1784 if (ctx->ExecuteFlag) {
1785 CALL_BlendEquationSeparate(ctx->Exec, (modeRGB, modeA));
1786 }
1787 }
1788
1789
1790 static void GLAPIENTRY
1791 save_BlendFuncSeparateEXT(GLenum sfactorRGB, GLenum dfactorRGB,
1792 GLenum sfactorA, GLenum dfactorA)
1793 {
1794 GET_CURRENT_CONTEXT(ctx);
1795 Node *n;
1796 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1797 n = alloc_instruction(ctx, OPCODE_BLEND_FUNC_SEPARATE, 4);
1798 if (n) {
1799 n[1].e = sfactorRGB;
1800 n[2].e = dfactorRGB;
1801 n[3].e = sfactorA;
1802 n[4].e = dfactorA;
1803 }
1804 if (ctx->ExecuteFlag) {
1805 CALL_BlendFuncSeparate(ctx->Exec,
1806 (sfactorRGB, dfactorRGB, sfactorA, dfactorA));
1807 }
1808 }
1809
1810
1811 static void GLAPIENTRY
1812 save_BlendFunc(GLenum srcfactor, GLenum dstfactor)
1813 {
1814 save_BlendFuncSeparateEXT(srcfactor, dstfactor, srcfactor, dstfactor);
1815 }
1816
1817
1818 static void GLAPIENTRY
1819 save_BlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
1820 {
1821 GET_CURRENT_CONTEXT(ctx);
1822 Node *n;
1823 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1824 n = alloc_instruction(ctx, OPCODE_BLEND_COLOR, 4);
1825 if (n) {
1826 n[1].f = red;
1827 n[2].f = green;
1828 n[3].f = blue;
1829 n[4].f = alpha;
1830 }
1831 if (ctx->ExecuteFlag) {
1832 CALL_BlendColor(ctx->Exec, (red, green, blue, alpha));
1833 }
1834 }
1835
1836 /* GL_ARB_draw_buffers_blend */
1837 static void GLAPIENTRY
1838 save_BlendFuncSeparatei(GLuint buf, GLenum sfactorRGB, GLenum dfactorRGB,
1839 GLenum sfactorA, GLenum dfactorA)
1840 {
1841 GET_CURRENT_CONTEXT(ctx);
1842 Node *n;
1843 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1844 n = alloc_instruction(ctx, OPCODE_BLEND_FUNC_SEPARATE_I, 5);
1845 if (n) {
1846 n[1].ui = buf;
1847 n[2].e = sfactorRGB;
1848 n[3].e = dfactorRGB;
1849 n[4].e = sfactorA;
1850 n[5].e = dfactorA;
1851 }
1852 if (ctx->ExecuteFlag) {
1853 CALL_BlendFuncSeparateiARB(ctx->Exec, (buf, sfactorRGB, dfactorRGB,
1854 sfactorA, dfactorA));
1855 }
1856 }
1857
1858 /* GL_ARB_draw_buffers_blend */
1859 static void GLAPIENTRY
1860 save_BlendFunci(GLuint buf, GLenum sfactor, GLenum dfactor)
1861 {
1862 GET_CURRENT_CONTEXT(ctx);
1863 Node *n;
1864 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1865 n = alloc_instruction(ctx, OPCODE_BLEND_FUNC_I, 3);
1866 if (n) {
1867 n[1].ui = buf;
1868 n[2].e = sfactor;
1869 n[3].e = dfactor;
1870 }
1871 if (ctx->ExecuteFlag) {
1872 CALL_BlendFunciARB(ctx->Exec, (buf, sfactor, dfactor));
1873 }
1874 }
1875
1876 /* GL_ARB_draw_buffers_blend */
1877 static void GLAPIENTRY
1878 save_BlendEquationi(GLuint buf, GLenum mode)
1879 {
1880 GET_CURRENT_CONTEXT(ctx);
1881 Node *n;
1882 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1883 n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION_I, 2);
1884 if (n) {
1885 n[1].ui = buf;
1886 n[2].e = mode;
1887 }
1888 if (ctx->ExecuteFlag) {
1889 CALL_BlendEquationiARB(ctx->Exec, (buf, mode));
1890 }
1891 }
1892
1893 /* GL_ARB_draw_buffers_blend */
1894 static void GLAPIENTRY
1895 save_BlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeA)
1896 {
1897 GET_CURRENT_CONTEXT(ctx);
1898 Node *n;
1899 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1900 n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION_SEPARATE_I, 3);
1901 if (n) {
1902 n[1].ui = buf;
1903 n[2].e = modeRGB;
1904 n[3].e = modeA;
1905 }
1906 if (ctx->ExecuteFlag) {
1907 CALL_BlendEquationSeparateiARB(ctx->Exec, (buf, modeRGB, modeA));
1908 }
1909 }
1910
1911
1912 /* GL_ARB_draw_instanced. */
1913 static void GLAPIENTRY
1914 save_DrawArraysInstancedARB(UNUSED GLenum mode,
1915 UNUSED GLint first,
1916 UNUSED GLsizei count,
1917 UNUSED GLsizei primcount)
1918 {
1919 GET_CURRENT_CONTEXT(ctx);
1920 _mesa_error(ctx, GL_INVALID_OPERATION,
1921 "glDrawArraysInstanced() during display list compile");
1922 }
1923
1924 static void GLAPIENTRY
1925 save_DrawElementsInstancedARB(UNUSED GLenum mode,
1926 UNUSED GLsizei count,
1927 UNUSED GLenum type,
1928 UNUSED const GLvoid *indices,
1929 UNUSED GLsizei primcount)
1930 {
1931 GET_CURRENT_CONTEXT(ctx);
1932 _mesa_error(ctx, GL_INVALID_OPERATION,
1933 "glDrawElementsInstanced() during display list compile");
1934 }
1935
1936 static void GLAPIENTRY
1937 save_DrawElementsInstancedBaseVertexARB(UNUSED GLenum mode,
1938 UNUSED GLsizei count,
1939 UNUSED GLenum type,
1940 UNUSED const GLvoid *indices,
1941 UNUSED GLsizei primcount,
1942 UNUSED GLint basevertex)
1943 {
1944 GET_CURRENT_CONTEXT(ctx);
1945 _mesa_error(ctx, GL_INVALID_OPERATION,
1946 "glDrawElementsInstancedBaseVertex() during display list compile");
1947 }
1948
1949 /* GL_ARB_base_instance. */
1950 static void GLAPIENTRY
1951 save_DrawArraysInstancedBaseInstance(UNUSED GLenum mode,
1952 UNUSED GLint first,
1953 UNUSED GLsizei count,
1954 UNUSED GLsizei primcount,
1955 UNUSED GLuint baseinstance)
1956 {
1957 GET_CURRENT_CONTEXT(ctx);
1958 _mesa_error(ctx, GL_INVALID_OPERATION,
1959 "glDrawArraysInstancedBaseInstance() during display list compile");
1960 }
1961
1962 static void APIENTRY
1963 save_DrawElementsInstancedBaseInstance(UNUSED GLenum mode,
1964 UNUSED GLsizei count,
1965 UNUSED GLenum type,
1966 UNUSED const void *indices,
1967 UNUSED GLsizei primcount,
1968 UNUSED GLuint baseinstance)
1969 {
1970 GET_CURRENT_CONTEXT(ctx);
1971 _mesa_error(ctx, GL_INVALID_OPERATION,
1972 "glDrawElementsInstancedBaseInstance() during display list compile");
1973 }
1974
1975 static void APIENTRY
1976 save_DrawElementsInstancedBaseVertexBaseInstance(UNUSED GLenum mode,
1977 UNUSED GLsizei count,
1978 UNUSED GLenum type,
1979 UNUSED const void *indices,
1980 UNUSED GLsizei primcount,
1981 UNUSED GLint basevertex,
1982 UNUSED GLuint baseinstance)
1983 {
1984 GET_CURRENT_CONTEXT(ctx);
1985 _mesa_error(ctx, GL_INVALID_OPERATION,
1986 "glDrawElementsInstancedBaseVertexBaseInstance() during display list compile");
1987 }
1988
1989 static void APIENTRY
1990 save_DrawArraysIndirect(UNUSED GLenum mode,
1991 UNUSED const void *indirect)
1992 {
1993 GET_CURRENT_CONTEXT(ctx);
1994 _mesa_error(ctx, GL_INVALID_OPERATION,
1995 "glDrawArraysIndirect() during display list compile");
1996 }
1997
1998 static void APIENTRY
1999 save_DrawElementsIndirect(UNUSED GLenum mode,
2000 UNUSED GLenum type,
2001 UNUSED const void *indirect)
2002 {
2003 GET_CURRENT_CONTEXT(ctx);
2004 _mesa_error(ctx, GL_INVALID_OPERATION,
2005 "glDrawElementsIndirect() during display list compile");
2006 }
2007
2008 static void APIENTRY
2009 save_MultiDrawArraysIndirect(UNUSED GLenum mode,
2010 UNUSED const void *indirect,
2011 UNUSED GLsizei primcount,
2012 UNUSED GLsizei stride)
2013 {
2014 GET_CURRENT_CONTEXT(ctx);
2015 _mesa_error(ctx, GL_INVALID_OPERATION,
2016 "glMultiDrawArraysIndirect() during display list compile");
2017 }
2018
2019 static void APIENTRY
2020 save_MultiDrawElementsIndirect(UNUSED GLenum mode,
2021 UNUSED GLenum type,
2022 UNUSED const void *indirect,
2023 UNUSED GLsizei primcount,
2024 UNUSED GLsizei stride)
2025 {
2026 GET_CURRENT_CONTEXT(ctx);
2027 _mesa_error(ctx, GL_INVALID_OPERATION,
2028 "glMultiDrawElementsIndirect() during display list compile");
2029 }
2030
2031 /**
2032 * While building a display list we cache some OpenGL state.
2033 * Under some circumstances we need to invalidate that state (immediately
2034 * when we start compiling a list, or after glCallList(s)).
2035 */
2036 static void
2037 invalidate_saved_current_state(struct gl_context *ctx)
2038 {
2039 GLint i;
2040
2041 for (i = 0; i < VERT_ATTRIB_MAX; i++)
2042 ctx->ListState.ActiveAttribSize[i] = 0;
2043
2044 for (i = 0; i < MAT_ATTRIB_MAX; i++)
2045 ctx->ListState.ActiveMaterialSize[i] = 0;
2046
2047 memset(&ctx->ListState.Current, 0, sizeof ctx->ListState.Current);
2048
2049 ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN;
2050 }
2051
2052
2053 static void GLAPIENTRY
2054 save_CallList(GLuint list)
2055 {
2056 GET_CURRENT_CONTEXT(ctx);
2057 Node *n;
2058 SAVE_FLUSH_VERTICES(ctx);
2059
2060 n = alloc_instruction(ctx, OPCODE_CALL_LIST, 1);
2061 if (n) {
2062 n[1].ui = list;
2063 }
2064
2065 /* After this, we don't know what state we're in. Invalidate all
2066 * cached information previously gathered:
2067 */
2068 invalidate_saved_current_state( ctx );
2069
2070 if (ctx->ExecuteFlag) {
2071 _mesa_CallList(list);
2072 }
2073 }
2074
2075
2076 static void GLAPIENTRY
2077 save_CallLists(GLsizei num, GLenum type, const GLvoid * lists)
2078 {
2079 GET_CURRENT_CONTEXT(ctx);
2080 unsigned type_size;
2081 Node *n;
2082 void *lists_copy;
2083
2084 SAVE_FLUSH_VERTICES(ctx);
2085
2086 switch (type) {
2087 case GL_BYTE:
2088 case GL_UNSIGNED_BYTE:
2089 type_size = 1;
2090 break;
2091 case GL_SHORT:
2092 case GL_UNSIGNED_SHORT:
2093 case GL_2_BYTES:
2094 type_size = 2;
2095 break;
2096 case GL_3_BYTES:
2097 type_size = 3;
2098 break;
2099 case GL_INT:
2100 case GL_UNSIGNED_INT:
2101 case GL_FLOAT:
2102 case GL_4_BYTES:
2103 type_size = 4;
2104 break;
2105 default:
2106 type_size = 0;
2107 }
2108
2109 if (num > 0 && type_size > 0) {
2110 /* create a copy of the array of list IDs to save in the display list */
2111 lists_copy = memdup(lists, num * type_size);
2112 } else {
2113 lists_copy = NULL;
2114 }
2115
2116 n = alloc_instruction(ctx, OPCODE_CALL_LISTS, 2 + POINTER_DWORDS);
2117 if (n) {
2118 n[1].i = num;
2119 n[2].e = type;
2120 save_pointer(&n[3], lists_copy);
2121 }
2122
2123 /* After this, we don't know what state we're in. Invalidate all
2124 * cached information previously gathered:
2125 */
2126 invalidate_saved_current_state( ctx );
2127
2128 if (ctx->ExecuteFlag) {
2129 CALL_CallLists(ctx->Exec, (num, type, lists));
2130 }
2131 }
2132
2133
2134 static void GLAPIENTRY
2135 save_Clear(GLbitfield mask)
2136 {
2137 GET_CURRENT_CONTEXT(ctx);
2138 Node *n;
2139 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2140 n = alloc_instruction(ctx, OPCODE_CLEAR, 1);
2141 if (n) {
2142 n[1].bf = mask;
2143 }
2144 if (ctx->ExecuteFlag) {
2145 CALL_Clear(ctx->Exec, (mask));
2146 }
2147 }
2148
2149
2150 static void GLAPIENTRY
2151 save_ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value)
2152 {
2153 GET_CURRENT_CONTEXT(ctx);
2154 Node *n;
2155 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2156 n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_IV, 6);
2157 if (n) {
2158 n[1].e = buffer;
2159 n[2].i = drawbuffer;
2160 n[3].i = value[0];
2161 if (buffer == GL_COLOR) {
2162 n[4].i = value[1];
2163 n[5].i = value[2];
2164 n[6].i = value[3];
2165 }
2166 else {
2167 n[4].i = 0;
2168 n[5].i = 0;
2169 n[6].i = 0;
2170 }
2171 }
2172 if (ctx->ExecuteFlag) {
2173 CALL_ClearBufferiv(ctx->Exec, (buffer, drawbuffer, value));
2174 }
2175 }
2176
2177
2178 static void GLAPIENTRY
2179 save_ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value)
2180 {
2181 GET_CURRENT_CONTEXT(ctx);
2182 Node *n;
2183 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2184 n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_UIV, 6);
2185 if (n) {
2186 n[1].e = buffer;
2187 n[2].i = drawbuffer;
2188 n[3].ui = value[0];
2189 if (buffer == GL_COLOR) {
2190 n[4].ui = value[1];
2191 n[5].ui = value[2];
2192 n[6].ui = value[3];
2193 }
2194 else {
2195 n[4].ui = 0;
2196 n[5].ui = 0;
2197 n[6].ui = 0;
2198 }
2199 }
2200 if (ctx->ExecuteFlag) {
2201 CALL_ClearBufferuiv(ctx->Exec, (buffer, drawbuffer, value));
2202 }
2203 }
2204
2205
2206 static void GLAPIENTRY
2207 save_ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
2208 {
2209 GET_CURRENT_CONTEXT(ctx);
2210 Node *n;
2211 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2212 n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_FV, 6);
2213 if (n) {
2214 n[1].e = buffer;
2215 n[2].i = drawbuffer;
2216 n[3].f = value[0];
2217 if (buffer == GL_COLOR) {
2218 n[4].f = value[1];
2219 n[5].f = value[2];
2220 n[6].f = value[3];
2221 }
2222 else {
2223 n[4].f = 0.0F;
2224 n[5].f = 0.0F;
2225 n[6].f = 0.0F;
2226 }
2227 }
2228 if (ctx->ExecuteFlag) {
2229 CALL_ClearBufferfv(ctx->Exec, (buffer, drawbuffer, value));
2230 }
2231 }
2232
2233
2234 static void GLAPIENTRY
2235 save_ClearBufferfi(GLenum buffer, GLint drawbuffer,
2236 GLfloat depth, GLint stencil)
2237 {
2238 GET_CURRENT_CONTEXT(ctx);
2239 Node *n;
2240 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2241 n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_FI, 4);
2242 if (n) {
2243 n[1].e = buffer;
2244 n[2].i = drawbuffer;
2245 n[3].f = depth;
2246 n[4].i = stencil;
2247 }
2248 if (ctx->ExecuteFlag) {
2249 CALL_ClearBufferfi(ctx->Exec, (buffer, drawbuffer, depth, stencil));
2250 }
2251 }
2252
2253
2254 static void GLAPIENTRY
2255 save_ClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
2256 {
2257 GET_CURRENT_CONTEXT(ctx);
2258 Node *n;
2259 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2260 n = alloc_instruction(ctx, OPCODE_CLEAR_ACCUM, 4);
2261 if (n) {
2262 n[1].f = red;
2263 n[2].f = green;
2264 n[3].f = blue;
2265 n[4].f = alpha;
2266 }
2267 if (ctx->ExecuteFlag) {
2268 CALL_ClearAccum(ctx->Exec, (red, green, blue, alpha));
2269 }
2270 }
2271
2272
2273 static void GLAPIENTRY
2274 save_ClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
2275 {
2276 GET_CURRENT_CONTEXT(ctx);
2277 Node *n;
2278 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2279 n = alloc_instruction(ctx, OPCODE_CLEAR_COLOR, 4);
2280 if (n) {
2281 n[1].f = red;
2282 n[2].f = green;
2283 n[3].f = blue;
2284 n[4].f = alpha;
2285 }
2286 if (ctx->ExecuteFlag) {
2287 CALL_ClearColor(ctx->Exec, (red, green, blue, alpha));
2288 }
2289 }
2290
2291
2292 static void GLAPIENTRY
2293 save_ClearDepth(GLclampd depth)
2294 {
2295 GET_CURRENT_CONTEXT(ctx);
2296 Node *n;
2297 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2298 n = alloc_instruction(ctx, OPCODE_CLEAR_DEPTH, 1);
2299 if (n) {
2300 n[1].f = (GLfloat) depth;
2301 }
2302 if (ctx->ExecuteFlag) {
2303 CALL_ClearDepth(ctx->Exec, (depth));
2304 }
2305 }
2306
2307
2308 static void GLAPIENTRY
2309 save_ClearIndex(GLfloat c)
2310 {
2311 GET_CURRENT_CONTEXT(ctx);
2312 Node *n;
2313 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2314 n = alloc_instruction(ctx, OPCODE_CLEAR_INDEX, 1);
2315 if (n) {
2316 n[1].f = c;
2317 }
2318 if (ctx->ExecuteFlag) {
2319 CALL_ClearIndex(ctx->Exec, (c));
2320 }
2321 }
2322
2323
2324 static void GLAPIENTRY
2325 save_ClearStencil(GLint s)
2326 {
2327 GET_CURRENT_CONTEXT(ctx);
2328 Node *n;
2329 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2330 n = alloc_instruction(ctx, OPCODE_CLEAR_STENCIL, 1);
2331 if (n) {
2332 n[1].i = s;
2333 }
2334 if (ctx->ExecuteFlag) {
2335 CALL_ClearStencil(ctx->Exec, (s));
2336 }
2337 }
2338
2339
2340 static void GLAPIENTRY
2341 save_ClipPlane(GLenum plane, const GLdouble * equ)
2342 {
2343 GET_CURRENT_CONTEXT(ctx);
2344 Node *n;
2345 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2346 n = alloc_instruction(ctx, OPCODE_CLIP_PLANE, 5);
2347 if (n) {
2348 n[1].e = plane;
2349 n[2].f = (GLfloat) equ[0];
2350 n[3].f = (GLfloat) equ[1];
2351 n[4].f = (GLfloat) equ[2];
2352 n[5].f = (GLfloat) equ[3];
2353 }
2354 if (ctx->ExecuteFlag) {
2355 CALL_ClipPlane(ctx->Exec, (plane, equ));
2356 }
2357 }
2358
2359
2360
2361 static void GLAPIENTRY
2362 save_ColorMask(GLboolean red, GLboolean green,
2363 GLboolean blue, GLboolean alpha)
2364 {
2365 GET_CURRENT_CONTEXT(ctx);
2366 Node *n;
2367 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2368 n = alloc_instruction(ctx, OPCODE_COLOR_MASK, 4);
2369 if (n) {
2370 n[1].b = red;
2371 n[2].b = green;
2372 n[3].b = blue;
2373 n[4].b = alpha;
2374 }
2375 if (ctx->ExecuteFlag) {
2376 CALL_ColorMask(ctx->Exec, (red, green, blue, alpha));
2377 }
2378 }
2379
2380
2381 static void GLAPIENTRY
2382 save_ColorMaskIndexed(GLuint buf, GLboolean red, GLboolean green,
2383 GLboolean blue, GLboolean alpha)
2384 {
2385 GET_CURRENT_CONTEXT(ctx);
2386 Node *n;
2387 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2388 n = alloc_instruction(ctx, OPCODE_COLOR_MASK_INDEXED, 5);
2389 if (n) {
2390 n[1].ui = buf;
2391 n[2].b = red;
2392 n[3].b = green;
2393 n[4].b = blue;
2394 n[5].b = alpha;
2395 }
2396 if (ctx->ExecuteFlag) {
2397 /*CALL_ColorMaski(ctx->Exec, (buf, red, green, blue, alpha));*/
2398 }
2399 }
2400
2401
2402 static void GLAPIENTRY
2403 save_ColorMaterial(GLenum face, GLenum mode)
2404 {
2405 GET_CURRENT_CONTEXT(ctx);
2406 Node *n;
2407 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2408
2409 n = alloc_instruction(ctx, OPCODE_COLOR_MATERIAL, 2);
2410 if (n) {
2411 n[1].e = face;
2412 n[2].e = mode;
2413 }
2414 if (ctx->ExecuteFlag) {
2415 CALL_ColorMaterial(ctx->Exec, (face, mode));
2416 }
2417 }
2418
2419
2420 static void GLAPIENTRY
2421 save_CopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type)
2422 {
2423 GET_CURRENT_CONTEXT(ctx);
2424 Node *n;
2425 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2426 n = alloc_instruction(ctx, OPCODE_COPY_PIXELS, 5);
2427 if (n) {
2428 n[1].i = x;
2429 n[2].i = y;
2430 n[3].i = (GLint) width;
2431 n[4].i = (GLint) height;
2432 n[5].e = type;
2433 }
2434 if (ctx->ExecuteFlag) {
2435 CALL_CopyPixels(ctx->Exec, (x, y, width, height, type));
2436 }
2437 }
2438
2439
2440
2441 static void GLAPIENTRY
2442 save_CopyTexImage1D(GLenum target, GLint level, GLenum internalformat,
2443 GLint x, GLint y, GLsizei width, GLint border)
2444 {
2445 GET_CURRENT_CONTEXT(ctx);
2446 Node *n;
2447 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2448 n = alloc_instruction(ctx, OPCODE_COPY_TEX_IMAGE1D, 7);
2449 if (n) {
2450 n[1].e = target;
2451 n[2].i = level;
2452 n[3].e = internalformat;
2453 n[4].i = x;
2454 n[5].i = y;
2455 n[6].i = width;
2456 n[7].i = border;
2457 }
2458 if (ctx->ExecuteFlag) {
2459 CALL_CopyTexImage1D(ctx->Exec, (target, level, internalformat,
2460 x, y, width, border));
2461 }
2462 }
2463
2464
2465 static void GLAPIENTRY
2466 save_CopyTexImage2D(GLenum target, GLint level,
2467 GLenum internalformat,
2468 GLint x, GLint y, GLsizei width,
2469 GLsizei height, GLint border)
2470 {
2471 GET_CURRENT_CONTEXT(ctx);
2472 Node *n;
2473 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2474 n = alloc_instruction(ctx, OPCODE_COPY_TEX_IMAGE2D, 8);
2475 if (n) {
2476 n[1].e = target;
2477 n[2].i = level;
2478 n[3].e = internalformat;
2479 n[4].i = x;
2480 n[5].i = y;
2481 n[6].i = width;
2482 n[7].i = height;
2483 n[8].i = border;
2484 }
2485 if (ctx->ExecuteFlag) {
2486 CALL_CopyTexImage2D(ctx->Exec, (target, level, internalformat,
2487 x, y, width, height, border));
2488 }
2489 }
2490
2491
2492
2493 static void GLAPIENTRY
2494 save_CopyTexSubImage1D(GLenum target, GLint level,
2495 GLint xoffset, GLint x, GLint y, GLsizei width)
2496 {
2497 GET_CURRENT_CONTEXT(ctx);
2498 Node *n;
2499 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2500 n = alloc_instruction(ctx, OPCODE_COPY_TEX_SUB_IMAGE1D, 6);
2501 if (n) {
2502 n[1].e = target;
2503 n[2].i = level;
2504 n[3].i = xoffset;
2505 n[4].i = x;
2506 n[5].i = y;
2507 n[6].i = width;
2508 }
2509 if (ctx->ExecuteFlag) {
2510 CALL_CopyTexSubImage1D(ctx->Exec,
2511 (target, level, xoffset, x, y, width));
2512 }
2513 }
2514
2515
2516 static void GLAPIENTRY
2517 save_CopyTexSubImage2D(GLenum target, GLint level,
2518 GLint xoffset, GLint yoffset,
2519 GLint x, GLint y, GLsizei width, GLint height)
2520 {
2521 GET_CURRENT_CONTEXT(ctx);
2522 Node *n;
2523 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2524 n = alloc_instruction(ctx, OPCODE_COPY_TEX_SUB_IMAGE2D, 8);
2525 if (n) {
2526 n[1].e = target;
2527 n[2].i = level;
2528 n[3].i = xoffset;
2529 n[4].i = yoffset;
2530 n[5].i = x;
2531 n[6].i = y;
2532 n[7].i = width;
2533 n[8].i = height;
2534 }
2535 if (ctx->ExecuteFlag) {
2536 CALL_CopyTexSubImage2D(ctx->Exec, (target, level, xoffset, yoffset,
2537 x, y, width, height));
2538 }
2539 }
2540
2541
2542 static void GLAPIENTRY
2543 save_CopyTexSubImage3D(GLenum target, GLint level,
2544 GLint xoffset, GLint yoffset, GLint zoffset,
2545 GLint x, GLint y, GLsizei width, GLint height)
2546 {
2547 GET_CURRENT_CONTEXT(ctx);
2548 Node *n;
2549 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2550 n = alloc_instruction(ctx, OPCODE_COPY_TEX_SUB_IMAGE3D, 9);
2551 if (n) {
2552 n[1].e = target;
2553 n[2].i = level;
2554 n[3].i = xoffset;
2555 n[4].i = yoffset;
2556 n[5].i = zoffset;
2557 n[6].i = x;
2558 n[7].i = y;
2559 n[8].i = width;
2560 n[9].i = height;
2561 }
2562 if (ctx->ExecuteFlag) {
2563 CALL_CopyTexSubImage3D(ctx->Exec, (target, level,
2564 xoffset, yoffset, zoffset,
2565 x, y, width, height));
2566 }
2567 }
2568
2569
2570 static void GLAPIENTRY
2571 save_CullFace(GLenum mode)
2572 {
2573 GET_CURRENT_CONTEXT(ctx);
2574 Node *n;
2575 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2576 n = alloc_instruction(ctx, OPCODE_CULL_FACE, 1);
2577 if (n) {
2578 n[1].e = mode;
2579 }
2580 if (ctx->ExecuteFlag) {
2581 CALL_CullFace(ctx->Exec, (mode));
2582 }
2583 }
2584
2585
2586 static void GLAPIENTRY
2587 save_DepthFunc(GLenum func)
2588 {
2589 GET_CURRENT_CONTEXT(ctx);
2590 Node *n;
2591 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2592 n = alloc_instruction(ctx, OPCODE_DEPTH_FUNC, 1);
2593 if (n) {
2594 n[1].e = func;
2595 }
2596 if (ctx->ExecuteFlag) {
2597 CALL_DepthFunc(ctx->Exec, (func));
2598 }
2599 }
2600
2601
2602 static void GLAPIENTRY
2603 save_DepthMask(GLboolean mask)
2604 {
2605 GET_CURRENT_CONTEXT(ctx);
2606 Node *n;
2607 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2608 n = alloc_instruction(ctx, OPCODE_DEPTH_MASK, 1);
2609 if (n) {
2610 n[1].b = mask;
2611 }
2612 if (ctx->ExecuteFlag) {
2613 CALL_DepthMask(ctx->Exec, (mask));
2614 }
2615 }
2616
2617
2618 static void GLAPIENTRY
2619 save_DepthRange(GLclampd nearval, GLclampd farval)
2620 {
2621 GET_CURRENT_CONTEXT(ctx);
2622 Node *n;
2623 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2624 n = alloc_instruction(ctx, OPCODE_DEPTH_RANGE, 2);
2625 if (n) {
2626 n[1].f = (GLfloat) nearval;
2627 n[2].f = (GLfloat) farval;
2628 }
2629 if (ctx->ExecuteFlag) {
2630 CALL_DepthRange(ctx->Exec, (nearval, farval));
2631 }
2632 }
2633
2634
2635 static void GLAPIENTRY
2636 save_Disable(GLenum cap)
2637 {
2638 GET_CURRENT_CONTEXT(ctx);
2639 Node *n;
2640 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2641 n = alloc_instruction(ctx, OPCODE_DISABLE, 1);
2642 if (n) {
2643 n[1].e = cap;
2644 }
2645 if (ctx->ExecuteFlag) {
2646 CALL_Disable(ctx->Exec, (cap));
2647 }
2648 }
2649
2650
2651 static void GLAPIENTRY
2652 save_DisableIndexed(GLuint index, GLenum cap)
2653 {
2654 GET_CURRENT_CONTEXT(ctx);
2655 Node *n;
2656 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2657 n = alloc_instruction(ctx, OPCODE_DISABLE_INDEXED, 2);
2658 if (n) {
2659 n[1].ui = index;
2660 n[2].e = cap;
2661 }
2662 if (ctx->ExecuteFlag) {
2663 CALL_Disablei(ctx->Exec, (index, cap));
2664 }
2665 }
2666
2667
2668 static void GLAPIENTRY
2669 save_DrawBuffer(GLenum mode)
2670 {
2671 GET_CURRENT_CONTEXT(ctx);
2672 Node *n;
2673 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2674 n = alloc_instruction(ctx, OPCODE_DRAW_BUFFER, 1);
2675 if (n) {
2676 n[1].e = mode;
2677 }
2678 if (ctx->ExecuteFlag) {
2679 CALL_DrawBuffer(ctx->Exec, (mode));
2680 }
2681 }
2682
2683
2684 static void GLAPIENTRY
2685 save_DrawPixels(GLsizei width, GLsizei height,
2686 GLenum format, GLenum type, const GLvoid * pixels)
2687 {
2688 GET_CURRENT_CONTEXT(ctx);
2689 Node *n;
2690
2691 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2692
2693 n = alloc_instruction(ctx, OPCODE_DRAW_PIXELS, 4 + POINTER_DWORDS);
2694 if (n) {
2695 n[1].i = width;
2696 n[2].i = height;
2697 n[3].e = format;
2698 n[4].e = type;
2699 save_pointer(&n[5],
2700 unpack_image(ctx, 2, width, height, 1, format, type,
2701 pixels, &ctx->Unpack));
2702 }
2703 if (ctx->ExecuteFlag) {
2704 CALL_DrawPixels(ctx->Exec, (width, height, format, type, pixels));
2705 }
2706 }
2707
2708
2709
2710 static void GLAPIENTRY
2711 save_Enable(GLenum cap)
2712 {
2713 GET_CURRENT_CONTEXT(ctx);
2714 Node *n;
2715 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2716 n = alloc_instruction(ctx, OPCODE_ENABLE, 1);
2717 if (n) {
2718 n[1].e = cap;
2719 }
2720 if (ctx->ExecuteFlag) {
2721 CALL_Enable(ctx->Exec, (cap));
2722 }
2723 }
2724
2725
2726
2727 static void GLAPIENTRY
2728 save_EnableIndexed(GLuint index, GLenum cap)
2729 {
2730 GET_CURRENT_CONTEXT(ctx);
2731 Node *n;
2732 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2733 n = alloc_instruction(ctx, OPCODE_ENABLE_INDEXED, 2);
2734 if (n) {
2735 n[1].ui = index;
2736 n[2].e = cap;
2737 }
2738 if (ctx->ExecuteFlag) {
2739 CALL_Enablei(ctx->Exec, (index, cap));
2740 }
2741 }
2742
2743
2744
2745 static void GLAPIENTRY
2746 save_EvalMesh1(GLenum mode, GLint i1, GLint i2)
2747 {
2748 GET_CURRENT_CONTEXT(ctx);
2749 Node *n;
2750 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2751 n = alloc_instruction(ctx, OPCODE_EVALMESH1, 3);
2752 if (n) {
2753 n[1].e = mode;
2754 n[2].i = i1;
2755 n[3].i = i2;
2756 }
2757 if (ctx->ExecuteFlag) {
2758 CALL_EvalMesh1(ctx->Exec, (mode, i1, i2));
2759 }
2760 }
2761
2762
2763 static void GLAPIENTRY
2764 save_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)
2765 {
2766 GET_CURRENT_CONTEXT(ctx);
2767 Node *n;
2768 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2769 n = alloc_instruction(ctx, OPCODE_EVALMESH2, 5);
2770 if (n) {
2771 n[1].e = mode;
2772 n[2].i = i1;
2773 n[3].i = i2;
2774 n[4].i = j1;
2775 n[5].i = j2;
2776 }
2777 if (ctx->ExecuteFlag) {
2778 CALL_EvalMesh2(ctx->Exec, (mode, i1, i2, j1, j2));
2779 }
2780 }
2781
2782
2783
2784
2785 static void GLAPIENTRY
2786 save_Fogfv(GLenum pname, const GLfloat *params)
2787 {
2788 GET_CURRENT_CONTEXT(ctx);
2789 Node *n;
2790 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2791 n = alloc_instruction(ctx, OPCODE_FOG, 5);
2792 if (n) {
2793 n[1].e = pname;
2794 n[2].f = params[0];
2795 n[3].f = params[1];
2796 n[4].f = params[2];
2797 n[5].f = params[3];
2798 }
2799 if (ctx->ExecuteFlag) {
2800 CALL_Fogfv(ctx->Exec, (pname, params));
2801 }
2802 }
2803
2804
2805 static void GLAPIENTRY
2806 save_Fogf(GLenum pname, GLfloat param)
2807 {
2808 GLfloat parray[4];
2809 parray[0] = param;
2810 parray[1] = parray[2] = parray[3] = 0.0F;
2811 save_Fogfv(pname, parray);
2812 }
2813
2814
2815 static void GLAPIENTRY
2816 save_Fogiv(GLenum pname, const GLint *params)
2817 {
2818 GLfloat p[4];
2819 switch (pname) {
2820 case GL_FOG_MODE:
2821 case GL_FOG_DENSITY:
2822 case GL_FOG_START:
2823 case GL_FOG_END:
2824 case GL_FOG_INDEX:
2825 case GL_FOG_COORDINATE_SOURCE:
2826 p[0] = (GLfloat) *params;
2827 p[1] = 0.0f;
2828 p[2] = 0.0f;
2829 p[3] = 0.0f;
2830 break;
2831 case GL_FOG_COLOR:
2832 p[0] = INT_TO_FLOAT(params[0]);
2833 p[1] = INT_TO_FLOAT(params[1]);
2834 p[2] = INT_TO_FLOAT(params[2]);
2835 p[3] = INT_TO_FLOAT(params[3]);
2836 break;
2837 default:
2838 /* Error will be caught later in gl_Fogfv */
2839 ASSIGN_4V(p, 0.0F, 0.0F, 0.0F, 0.0F);
2840 }
2841 save_Fogfv(pname, p);
2842 }
2843
2844
2845 static void GLAPIENTRY
2846 save_Fogi(GLenum pname, GLint param)
2847 {
2848 GLint parray[4];
2849 parray[0] = param;
2850 parray[1] = parray[2] = parray[3] = 0;
2851 save_Fogiv(pname, parray);
2852 }
2853
2854
2855 static void GLAPIENTRY
2856 save_FrontFace(GLenum mode)
2857 {
2858 GET_CURRENT_CONTEXT(ctx);
2859 Node *n;
2860 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2861 n = alloc_instruction(ctx, OPCODE_FRONT_FACE, 1);
2862 if (n) {
2863 n[1].e = mode;
2864 }
2865 if (ctx->ExecuteFlag) {
2866 CALL_FrontFace(ctx->Exec, (mode));
2867 }
2868 }
2869
2870
2871 static void GLAPIENTRY
2872 save_Frustum(GLdouble left, GLdouble right,
2873 GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval)
2874 {
2875 GET_CURRENT_CONTEXT(ctx);
2876 Node *n;
2877 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2878 n = alloc_instruction(ctx, OPCODE_FRUSTUM, 6);
2879 if (n) {
2880 n[1].f = (GLfloat) left;
2881 n[2].f = (GLfloat) right;
2882 n[3].f = (GLfloat) bottom;
2883 n[4].f = (GLfloat) top;
2884 n[5].f = (GLfloat) nearval;
2885 n[6].f = (GLfloat) farval;
2886 }
2887 if (ctx->ExecuteFlag) {
2888 CALL_Frustum(ctx->Exec, (left, right, bottom, top, nearval, farval));
2889 }
2890 }
2891
2892
2893 static void GLAPIENTRY
2894 save_Hint(GLenum target, GLenum mode)
2895 {
2896 GET_CURRENT_CONTEXT(ctx);
2897 Node *n;
2898 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2899 n = alloc_instruction(ctx, OPCODE_HINT, 2);
2900 if (n) {
2901 n[1].e = target;
2902 n[2].e = mode;
2903 }
2904 if (ctx->ExecuteFlag) {
2905 CALL_Hint(ctx->Exec, (target, mode));
2906 }
2907 }
2908
2909
2910 static void GLAPIENTRY
2911 save_IndexMask(GLuint mask)
2912 {
2913 GET_CURRENT_CONTEXT(ctx);
2914 Node *n;
2915 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2916 n = alloc_instruction(ctx, OPCODE_INDEX_MASK, 1);
2917 if (n) {
2918 n[1].ui = mask;
2919 }
2920 if (ctx->ExecuteFlag) {
2921 CALL_IndexMask(ctx->Exec, (mask));
2922 }
2923 }
2924
2925
2926 static void GLAPIENTRY
2927 save_InitNames(void)
2928 {
2929 GET_CURRENT_CONTEXT(ctx);
2930 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2931 (void) alloc_instruction(ctx, OPCODE_INIT_NAMES, 0);
2932 if (ctx->ExecuteFlag) {
2933 CALL_InitNames(ctx->Exec, ());
2934 }
2935 }
2936
2937
2938 static void GLAPIENTRY
2939 save_Lightfv(GLenum light, GLenum pname, const GLfloat *params)
2940 {
2941 GET_CURRENT_CONTEXT(ctx);
2942 Node *n;
2943 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2944 n = alloc_instruction(ctx, OPCODE_LIGHT, 6);
2945 if (n) {
2946 GLint i, nParams;
2947 n[1].e = light;
2948 n[2].e = pname;
2949 switch (pname) {
2950 case GL_AMBIENT:
2951 nParams = 4;
2952 break;
2953 case GL_DIFFUSE:
2954 nParams = 4;
2955 break;
2956 case GL_SPECULAR:
2957 nParams = 4;
2958 break;
2959 case GL_POSITION:
2960 nParams = 4;
2961 break;
2962 case GL_SPOT_DIRECTION:
2963 nParams = 3;
2964 break;
2965 case GL_SPOT_EXPONENT:
2966 nParams = 1;
2967 break;
2968 case GL_SPOT_CUTOFF:
2969 nParams = 1;
2970 break;
2971 case GL_CONSTANT_ATTENUATION:
2972 nParams = 1;
2973 break;
2974 case GL_LINEAR_ATTENUATION:
2975 nParams = 1;
2976 break;
2977 case GL_QUADRATIC_ATTENUATION:
2978 nParams = 1;
2979 break;
2980 default:
2981 nParams = 0;
2982 }
2983 for (i = 0; i < nParams; i++) {
2984 n[3 + i].f = params[i];
2985 }
2986 }
2987 if (ctx->ExecuteFlag) {
2988 CALL_Lightfv(ctx->Exec, (light, pname, params));
2989 }
2990 }
2991
2992
2993 static void GLAPIENTRY
2994 save_Lightf(GLenum light, GLenum pname, GLfloat param)
2995 {
2996 GLfloat parray[4];
2997 parray[0] = param;
2998 parray[1] = parray[2] = parray[3] = 0.0F;
2999 save_Lightfv(light, pname, parray);
3000 }
3001
3002
3003 static void GLAPIENTRY
3004 save_Lightiv(GLenum light, GLenum pname, const GLint *params)
3005 {
3006 GLfloat fparam[4];
3007 switch (pname) {
3008 case GL_AMBIENT:
3009 case GL_DIFFUSE:
3010 case GL_SPECULAR:
3011 fparam[0] = INT_TO_FLOAT(params[0]);
3012 fparam[1] = INT_TO_FLOAT(params[1]);
3013 fparam[2] = INT_TO_FLOAT(params[2]);
3014 fparam[3] = INT_TO_FLOAT(params[3]);
3015 break;
3016 case GL_POSITION:
3017 fparam[0] = (GLfloat) params[0];
3018 fparam[1] = (GLfloat) params[1];
3019 fparam[2] = (GLfloat) params[2];
3020 fparam[3] = (GLfloat) params[3];
3021 break;
3022 case GL_SPOT_DIRECTION:
3023 fparam[0] = (GLfloat) params[0];
3024 fparam[1] = (GLfloat) params[1];
3025 fparam[2] = (GLfloat) params[2];
3026 break;
3027 case GL_SPOT_EXPONENT:
3028 case GL_SPOT_CUTOFF:
3029 case GL_CONSTANT_ATTENUATION:
3030 case GL_LINEAR_ATTENUATION:
3031 case GL_QUADRATIC_ATTENUATION:
3032 fparam[0] = (GLfloat) params[0];
3033 break;
3034 default:
3035 /* error will be caught later in gl_Lightfv */
3036 ;
3037 }
3038 save_Lightfv(light, pname, fparam);
3039 }
3040
3041
3042 static void GLAPIENTRY
3043 save_Lighti(GLenum light, GLenum pname, GLint param)
3044 {
3045 GLint parray[4];
3046 parray[0] = param;
3047 parray[1] = parray[2] = parray[3] = 0;
3048 save_Lightiv(light, pname, parray);
3049 }
3050
3051
3052 static void GLAPIENTRY
3053 save_LightModelfv(GLenum pname, const GLfloat *params)
3054 {
3055 GET_CURRENT_CONTEXT(ctx);
3056 Node *n;
3057 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3058 n = alloc_instruction(ctx, OPCODE_LIGHT_MODEL, 5);
3059 if (n) {
3060 n[1].e = pname;
3061 n[2].f = params[0];
3062 n[3].f = params[1];
3063 n[4].f = params[2];
3064 n[5].f = params[3];
3065 }
3066 if (ctx->ExecuteFlag) {
3067 CALL_LightModelfv(ctx->Exec, (pname, params));
3068 }
3069 }
3070
3071
3072 static void GLAPIENTRY
3073 save_LightModelf(GLenum pname, GLfloat param)
3074 {
3075 GLfloat parray[4];
3076 parray[0] = param;
3077 parray[1] = parray[2] = parray[3] = 0.0F;
3078 save_LightModelfv(pname, parray);
3079 }
3080
3081
3082 static void GLAPIENTRY
3083 save_LightModeliv(GLenum pname, const GLint *params)
3084 {
3085 GLfloat fparam[4];
3086 switch (pname) {
3087 case GL_LIGHT_MODEL_AMBIENT:
3088 fparam[0] = INT_TO_FLOAT(params[0]);
3089 fparam[1] = INT_TO_FLOAT(params[1]);
3090 fparam[2] = INT_TO_FLOAT(params[2]);
3091 fparam[3] = INT_TO_FLOAT(params[3]);
3092 break;
3093 case GL_LIGHT_MODEL_LOCAL_VIEWER:
3094 case GL_LIGHT_MODEL_TWO_SIDE:
3095 case GL_LIGHT_MODEL_COLOR_CONTROL:
3096 fparam[0] = (GLfloat) params[0];
3097 fparam[1] = 0.0F;
3098 fparam[2] = 0.0F;
3099 fparam[3] = 0.0F;
3100 break;
3101 default:
3102 /* Error will be caught later in gl_LightModelfv */
3103 ASSIGN_4V(fparam, 0.0F, 0.0F, 0.0F, 0.0F);
3104 }
3105 save_LightModelfv(pname, fparam);
3106 }
3107
3108
3109 static void GLAPIENTRY
3110 save_LightModeli(GLenum pname, GLint param)
3111 {
3112 GLint parray[4];
3113 parray[0] = param;
3114 parray[1] = parray[2] = parray[3] = 0;
3115 save_LightModeliv(pname, parray);
3116 }
3117
3118
3119 static void GLAPIENTRY
3120 save_LineStipple(GLint factor, GLushort pattern)
3121 {
3122 GET_CURRENT_CONTEXT(ctx);
3123 Node *n;
3124 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3125 n = alloc_instruction(ctx, OPCODE_LINE_STIPPLE, 2);
3126 if (n) {
3127 n[1].i = factor;
3128 n[2].us = pattern;
3129 }
3130 if (ctx->ExecuteFlag) {
3131 CALL_LineStipple(ctx->Exec, (factor, pattern));
3132 }
3133 }
3134
3135
3136 static void GLAPIENTRY
3137 save_LineWidth(GLfloat width)
3138 {
3139 GET_CURRENT_CONTEXT(ctx);
3140 Node *n;
3141 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3142 n = alloc_instruction(ctx, OPCODE_LINE_WIDTH, 1);
3143 if (n) {
3144 n[1].f = width;
3145 }
3146 if (ctx->ExecuteFlag) {
3147 CALL_LineWidth(ctx->Exec, (width));
3148 }
3149 }
3150
3151
3152 static void GLAPIENTRY
3153 save_ListBase(GLuint base)
3154 {
3155 GET_CURRENT_CONTEXT(ctx);
3156 Node *n;
3157 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3158 n = alloc_instruction(ctx, OPCODE_LIST_BASE, 1);
3159 if (n) {
3160 n[1].ui = base;
3161 }
3162 if (ctx->ExecuteFlag) {
3163 CALL_ListBase(ctx->Exec, (base));
3164 }
3165 }
3166
3167
3168 static void GLAPIENTRY
3169 save_LoadIdentity(void)
3170 {
3171 GET_CURRENT_CONTEXT(ctx);
3172 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3173 (void) alloc_instruction(ctx, OPCODE_LOAD_IDENTITY, 0);
3174 if (ctx->ExecuteFlag) {
3175 CALL_LoadIdentity(ctx->Exec, ());
3176 }
3177 }
3178
3179
3180 static void GLAPIENTRY
3181 save_LoadMatrixf(const GLfloat * m)
3182 {
3183 GET_CURRENT_CONTEXT(ctx);
3184 Node *n;
3185 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3186 n = alloc_instruction(ctx, OPCODE_LOAD_MATRIX, 16);
3187 if (n) {
3188 GLuint i;
3189 for (i = 0; i < 16; i++) {
3190 n[1 + i].f = m[i];
3191 }
3192 }
3193 if (ctx->ExecuteFlag) {
3194 CALL_LoadMatrixf(ctx->Exec, (m));
3195 }
3196 }
3197
3198
3199 static void GLAPIENTRY
3200 save_LoadMatrixd(const GLdouble * m)
3201 {
3202 GLfloat f[16];
3203 GLint i;
3204 for (i = 0; i < 16; i++) {
3205 f[i] = (GLfloat) m[i];
3206 }
3207 save_LoadMatrixf(f);
3208 }
3209
3210
3211 static void GLAPIENTRY
3212 save_LoadName(GLuint name)
3213 {
3214 GET_CURRENT_CONTEXT(ctx);
3215 Node *n;
3216 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3217 n = alloc_instruction(ctx, OPCODE_LOAD_NAME, 1);
3218 if (n) {
3219 n[1].ui = name;
3220 }
3221 if (ctx->ExecuteFlag) {
3222 CALL_LoadName(ctx->Exec, (name));
3223 }
3224 }
3225
3226
3227 static void GLAPIENTRY
3228 save_LogicOp(GLenum opcode)
3229 {
3230 GET_CURRENT_CONTEXT(ctx);
3231 Node *n;
3232 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3233 n = alloc_instruction(ctx, OPCODE_LOGIC_OP, 1);
3234 if (n) {
3235 n[1].e = opcode;
3236 }
3237 if (ctx->ExecuteFlag) {
3238 CALL_LogicOp(ctx->Exec, (opcode));
3239 }
3240 }
3241
3242
3243 static void GLAPIENTRY
3244 save_Map1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride,
3245 GLint order, const GLdouble * points)
3246 {
3247 GET_CURRENT_CONTEXT(ctx);
3248 Node *n;
3249 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3250 n = alloc_instruction(ctx, OPCODE_MAP1, 5 + POINTER_DWORDS);
3251 if (n) {
3252 GLfloat *pnts = _mesa_copy_map_points1d(target, stride, order, points);
3253 n[1].e = target;
3254 n[2].f = (GLfloat) u1;
3255 n[3].f = (GLfloat) u2;
3256 n[4].i = _mesa_evaluator_components(target); /* stride */
3257 n[5].i = order;
3258 save_pointer(&n[6], pnts);
3259 }
3260 if (ctx->ExecuteFlag) {
3261 CALL_Map1d(ctx->Exec, (target, u1, u2, stride, order, points));
3262 }
3263 }
3264
3265 static void GLAPIENTRY
3266 save_Map1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride,
3267 GLint order, const GLfloat * points)
3268 {
3269 GET_CURRENT_CONTEXT(ctx);
3270 Node *n;
3271 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3272 n = alloc_instruction(ctx, OPCODE_MAP1, 5 + POINTER_DWORDS);
3273 if (n) {
3274 GLfloat *pnts = _mesa_copy_map_points1f(target, stride, order, points);
3275 n[1].e = target;
3276 n[2].f = u1;
3277 n[3].f = u2;
3278 n[4].i = _mesa_evaluator_components(target); /* stride */
3279 n[5].i = order;
3280 save_pointer(&n[6], pnts);
3281 }
3282 if (ctx->ExecuteFlag) {
3283 CALL_Map1f(ctx->Exec, (target, u1, u2, stride, order, points));
3284 }
3285 }
3286
3287
3288 static void GLAPIENTRY
3289 save_Map2d(GLenum target,
3290 GLdouble u1, GLdouble u2, GLint ustride, GLint uorder,
3291 GLdouble v1, GLdouble v2, GLint vstride, GLint vorder,
3292 const GLdouble * points)
3293 {
3294 GET_CURRENT_CONTEXT(ctx);
3295 Node *n;
3296 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3297 n = alloc_instruction(ctx, OPCODE_MAP2, 9 + POINTER_DWORDS);
3298 if (n) {
3299 GLfloat *pnts = _mesa_copy_map_points2d(target, ustride, uorder,
3300 vstride, vorder, points);
3301 n[1].e = target;
3302 n[2].f = (GLfloat) u1;
3303 n[3].f = (GLfloat) u2;
3304 n[4].f = (GLfloat) v1;
3305 n[5].f = (GLfloat) v2;
3306 /* XXX verify these strides are correct */
3307 n[6].i = _mesa_evaluator_components(target) * vorder; /*ustride */
3308 n[7].i = _mesa_evaluator_components(target); /*vstride */
3309 n[8].i = uorder;
3310 n[9].i = vorder;
3311 save_pointer(&n[10], pnts);
3312 }
3313 if (ctx->ExecuteFlag) {
3314 CALL_Map2d(ctx->Exec, (target,
3315 u1, u2, ustride, uorder,
3316 v1, v2, vstride, vorder, points));
3317 }
3318 }
3319
3320
3321 static void GLAPIENTRY
3322 save_Map2f(GLenum target,
3323 GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
3324 GLfloat v1, GLfloat v2, GLint vstride, GLint vorder,
3325 const GLfloat * points)
3326 {
3327 GET_CURRENT_CONTEXT(ctx);
3328 Node *n;
3329 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3330 n = alloc_instruction(ctx, OPCODE_MAP2, 9 + POINTER_DWORDS);
3331 if (n) {
3332 GLfloat *pnts = _mesa_copy_map_points2f(target, ustride, uorder,
3333 vstride, vorder, points);
3334 n[1].e = target;
3335 n[2].f = u1;
3336 n[3].f = u2;
3337 n[4].f = v1;
3338 n[5].f = v2;
3339 /* XXX verify these strides are correct */
3340 n[6].i = _mesa_evaluator_components(target) * vorder; /*ustride */
3341 n[7].i = _mesa_evaluator_components(target); /*vstride */
3342 n[8].i = uorder;
3343 n[9].i = vorder;
3344 save_pointer(&n[10], pnts);
3345 }
3346 if (ctx->ExecuteFlag) {
3347 CALL_Map2f(ctx->Exec, (target, u1, u2, ustride, uorder,
3348 v1, v2, vstride, vorder, points));
3349 }
3350 }
3351
3352
3353 static void GLAPIENTRY
3354 save_MapGrid1f(GLint un, GLfloat u1, GLfloat u2)
3355 {
3356 GET_CURRENT_CONTEXT(ctx);
3357 Node *n;
3358 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3359 n = alloc_instruction(ctx, OPCODE_MAPGRID1, 3);
3360 if (n) {
3361 n[1].i = un;
3362 n[2].f = u1;
3363 n[3].f = u2;
3364 }
3365 if (ctx->ExecuteFlag) {
3366 CALL_MapGrid1f(ctx->Exec, (un, u1, u2));
3367 }
3368 }
3369
3370
3371 static void GLAPIENTRY
3372 save_MapGrid1d(GLint un, GLdouble u1, GLdouble u2)
3373 {
3374 save_MapGrid1f(un, (GLfloat) u1, (GLfloat) u2);
3375 }
3376
3377
3378 static void GLAPIENTRY
3379 save_MapGrid2f(GLint un, GLfloat u1, GLfloat u2,
3380 GLint vn, GLfloat v1, GLfloat v2)
3381 {
3382 GET_CURRENT_CONTEXT(ctx);
3383 Node *n;
3384 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3385 n = alloc_instruction(ctx, OPCODE_MAPGRID2, 6);
3386 if (n) {
3387 n[1].i = un;
3388 n[2].f = u1;
3389 n[3].f = u2;
3390 n[4].i = vn;
3391 n[5].f = v1;
3392 n[6].f = v2;
3393 }
3394 if (ctx->ExecuteFlag) {
3395 CALL_MapGrid2f(ctx->Exec, (un, u1, u2, vn, v1, v2));
3396 }
3397 }
3398
3399
3400
3401 static void GLAPIENTRY
3402 save_MapGrid2d(GLint un, GLdouble u1, GLdouble u2,
3403 GLint vn, GLdouble v1, GLdouble v2)
3404 {
3405 save_MapGrid2f(un, (GLfloat) u1, (GLfloat) u2,
3406 vn, (GLfloat) v1, (GLfloat) v2);
3407 }
3408
3409
3410 static void GLAPIENTRY
3411 save_MatrixMode(GLenum mode)
3412 {
3413 GET_CURRENT_CONTEXT(ctx);
3414 Node *n;
3415 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3416 n = alloc_instruction(ctx, OPCODE_MATRIX_MODE, 1);
3417 if (n) {
3418 n[1].e = mode;
3419 }
3420 if (ctx->ExecuteFlag) {
3421 CALL_MatrixMode(ctx->Exec, (mode));
3422 }
3423 }
3424
3425
3426 static void GLAPIENTRY
3427 save_MultMatrixf(const GLfloat * m)
3428 {
3429 GET_CURRENT_CONTEXT(ctx);
3430 Node *n;
3431 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3432 n = alloc_instruction(ctx, OPCODE_MULT_MATRIX, 16);
3433 if (n) {
3434 GLuint i;
3435 for (i = 0; i < 16; i++) {
3436 n[1 + i].f = m[i];
3437 }
3438 }
3439 if (ctx->ExecuteFlag) {
3440 CALL_MultMatrixf(ctx->Exec, (m));
3441 }
3442 }
3443
3444
3445 static void GLAPIENTRY
3446 save_MultMatrixd(const GLdouble * m)
3447 {
3448 GLfloat f[16];
3449 GLint i;
3450 for (i = 0; i < 16; i++) {
3451 f[i] = (GLfloat) m[i];
3452 }
3453 save_MultMatrixf(f);
3454 }
3455
3456
3457 static void GLAPIENTRY
3458 save_NewList(GLuint name, GLenum mode)
3459 {
3460 GET_CURRENT_CONTEXT(ctx);
3461 /* It's an error to call this function while building a display list */
3462 _mesa_error(ctx, GL_INVALID_OPERATION, "glNewList");
3463 (void) name;
3464 (void) mode;
3465 }
3466
3467
3468
3469 static void GLAPIENTRY
3470 save_Ortho(GLdouble left, GLdouble right,
3471 GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval)
3472 {
3473 GET_CURRENT_CONTEXT(ctx);
3474 Node *n;
3475 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3476 n = alloc_instruction(ctx, OPCODE_ORTHO, 6);
3477 if (n) {
3478 n[1].f = (GLfloat) left;
3479 n[2].f = (GLfloat) right;
3480 n[3].f = (GLfloat) bottom;
3481 n[4].f = (GLfloat) top;
3482 n[5].f = (GLfloat) nearval;
3483 n[6].f = (GLfloat) farval;
3484 }
3485 if (ctx->ExecuteFlag) {
3486 CALL_Ortho(ctx->Exec, (left, right, bottom, top, nearval, farval));
3487 }
3488 }
3489
3490
3491 static void GLAPIENTRY
3492 save_PatchParameteri(GLenum pname, const GLint value)
3493 {
3494 GET_CURRENT_CONTEXT(ctx);
3495 Node *n;
3496 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3497 n = alloc_instruction(ctx, OPCODE_PATCH_PARAMETER_I, 2);
3498 if (n) {
3499 n[1].e = pname;
3500 n[2].i = value;
3501 }
3502 if (ctx->ExecuteFlag) {
3503 CALL_PatchParameteri(ctx->Exec, (pname, value));
3504 }
3505 }
3506
3507
3508 static void GLAPIENTRY
3509 save_PatchParameterfv(GLenum pname, const GLfloat *params)
3510 {
3511 GET_CURRENT_CONTEXT(ctx);
3512 Node *n;
3513 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3514
3515 if (pname == GL_PATCH_DEFAULT_OUTER_LEVEL) {
3516 n = alloc_instruction(ctx, OPCODE_PATCH_PARAMETER_FV_OUTER, 5);
3517 } else {
3518 assert(pname == GL_PATCH_DEFAULT_INNER_LEVEL);
3519 n = alloc_instruction(ctx, OPCODE_PATCH_PARAMETER_FV_INNER, 3);
3520 }
3521 if (n) {
3522 n[1].e = pname;
3523 if (pname == GL_PATCH_DEFAULT_OUTER_LEVEL) {
3524 n[2].f = params[0];
3525 n[3].f = params[1];
3526 n[4].f = params[2];
3527 n[5].f = params[3];
3528 } else {
3529 n[2].f = params[0];
3530 n[3].f = params[1];
3531 }
3532 }
3533 if (ctx->ExecuteFlag) {
3534 CALL_PatchParameterfv(ctx->Exec, (pname, params));
3535 }
3536 }
3537
3538
3539 static void GLAPIENTRY
3540 save_PixelMapfv(GLenum map, GLint mapsize, const GLfloat *values)
3541 {
3542 GET_CURRENT_CONTEXT(ctx);
3543 Node *n;
3544 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3545 n = alloc_instruction(ctx, OPCODE_PIXEL_MAP, 2 + POINTER_DWORDS);
3546 if (n) {
3547 n[1].e = map;
3548 n[2].i = mapsize;
3549 save_pointer(&n[3], memdup(values, mapsize * sizeof(GLfloat)));
3550 }
3551 if (ctx->ExecuteFlag) {
3552 CALL_PixelMapfv(ctx->Exec, (map, mapsize, values));
3553 }
3554 }
3555
3556
3557 static void GLAPIENTRY
3558 save_PixelMapuiv(GLenum map, GLint mapsize, const GLuint *values)
3559 {
3560 GLfloat fvalues[MAX_PIXEL_MAP_TABLE];
3561 GLint i;
3562 if (map == GL_PIXEL_MAP_I_TO_I || map == GL_PIXEL_MAP_S_TO_S) {
3563 for (i = 0; i < mapsize; i++) {
3564 fvalues[i] = (GLfloat) values[i];
3565 }
3566 }
3567 else {
3568 for (i = 0; i < mapsize; i++) {
3569 fvalues[i] = UINT_TO_FLOAT(values[i]);
3570 }
3571 }
3572 save_PixelMapfv(map, mapsize, fvalues);
3573 }
3574
3575
3576 static void GLAPIENTRY
3577 save_PixelMapusv(GLenum map, GLint mapsize, const GLushort *values)
3578 {
3579 GLfloat fvalues[MAX_PIXEL_MAP_TABLE];
3580 GLint i;
3581 if (map == GL_PIXEL_MAP_I_TO_I || map == GL_PIXEL_MAP_S_TO_S) {
3582 for (i = 0; i < mapsize; i++) {
3583 fvalues[i] = (GLfloat) values[i];
3584 }
3585 }
3586 else {
3587 for (i = 0; i < mapsize; i++) {
3588 fvalues[i] = USHORT_TO_FLOAT(values[i]);
3589 }
3590 }
3591 save_PixelMapfv(map, mapsize, fvalues);
3592 }
3593
3594
3595 static void GLAPIENTRY
3596 save_PixelTransferf(GLenum pname, GLfloat param)
3597 {
3598 GET_CURRENT_CONTEXT(ctx);
3599 Node *n;
3600 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3601 n = alloc_instruction(ctx, OPCODE_PIXEL_TRANSFER, 2);
3602 if (n) {
3603 n[1].e = pname;
3604 n[2].f = param;
3605 }
3606 if (ctx->ExecuteFlag) {
3607 CALL_PixelTransferf(ctx->Exec, (pname, param));
3608 }
3609 }
3610
3611
3612 static void GLAPIENTRY
3613 save_PixelTransferi(GLenum pname, GLint param)
3614 {
3615 save_PixelTransferf(pname, (GLfloat) param);
3616 }
3617
3618
3619 static void GLAPIENTRY
3620 save_PixelZoom(GLfloat xfactor, GLfloat yfactor)
3621 {
3622 GET_CURRENT_CONTEXT(ctx);
3623 Node *n;
3624 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3625 n = alloc_instruction(ctx, OPCODE_PIXEL_ZOOM, 2);
3626 if (n) {
3627 n[1].f = xfactor;
3628 n[2].f = yfactor;
3629 }
3630 if (ctx->ExecuteFlag) {
3631 CALL_PixelZoom(ctx->Exec, (xfactor, yfactor));
3632 }
3633 }
3634
3635
3636 static void GLAPIENTRY
3637 save_PointParameterfvEXT(GLenum pname, const GLfloat *params)
3638 {
3639 GET_CURRENT_CONTEXT(ctx);
3640 Node *n;
3641 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3642 n = alloc_instruction(ctx, OPCODE_POINT_PARAMETERS, 4);
3643 if (n) {
3644 n[1].e = pname;
3645 n[2].f = params[0];
3646 n[3].f = params[1];
3647 n[4].f = params[2];
3648 }
3649 if (ctx->ExecuteFlag) {
3650 CALL_PointParameterfv(ctx->Exec, (pname, params));
3651 }
3652 }
3653
3654
3655 static void GLAPIENTRY
3656 save_PointParameterfEXT(GLenum pname, GLfloat param)
3657 {
3658 GLfloat parray[3];
3659 parray[0] = param;
3660 parray[1] = parray[2] = 0.0F;
3661 save_PointParameterfvEXT(pname, parray);
3662 }
3663
3664 static void GLAPIENTRY
3665 save_PointParameteriNV(GLenum pname, GLint param)
3666 {
3667 GLfloat parray[3];
3668 parray[0] = (GLfloat) param;
3669 parray[1] = parray[2] = 0.0F;
3670 save_PointParameterfvEXT(pname, parray);
3671 }
3672
3673 static void GLAPIENTRY
3674 save_PointParameterivNV(GLenum pname, const GLint * param)
3675 {
3676 GLfloat parray[3];
3677 parray[0] = (GLfloat) param[0];
3678 parray[1] = parray[2] = 0.0F;
3679 save_PointParameterfvEXT(pname, parray);
3680 }
3681
3682
3683 static void GLAPIENTRY
3684 save_PointSize(GLfloat size)
3685 {
3686 GET_CURRENT_CONTEXT(ctx);
3687 Node *n;
3688 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3689 n = alloc_instruction(ctx, OPCODE_POINT_SIZE, 1);
3690 if (n) {
3691 n[1].f = size;
3692 }
3693 if (ctx->ExecuteFlag) {
3694 CALL_PointSize(ctx->Exec, (size));
3695 }
3696 }
3697
3698
3699 static void GLAPIENTRY
3700 save_PolygonMode(GLenum face, GLenum mode)
3701 {
3702 GET_CURRENT_CONTEXT(ctx);
3703 Node *n;
3704 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3705 n = alloc_instruction(ctx, OPCODE_POLYGON_MODE, 2);
3706 if (n) {
3707 n[1].e = face;
3708 n[2].e = mode;
3709 }
3710 if (ctx->ExecuteFlag) {
3711 CALL_PolygonMode(ctx->Exec, (face, mode));
3712 }
3713 }
3714
3715
3716 static void GLAPIENTRY
3717 save_PolygonStipple(const GLubyte * pattern)
3718 {
3719 GET_CURRENT_CONTEXT(ctx);
3720 Node *n;
3721
3722 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3723
3724 n = alloc_instruction(ctx, OPCODE_POLYGON_STIPPLE, POINTER_DWORDS);
3725 if (n) {
3726 save_pointer(&n[1],
3727 unpack_image(ctx, 2, 32, 32, 1, GL_COLOR_INDEX, GL_BITMAP,
3728 pattern, &ctx->Unpack));
3729 }
3730 if (ctx->ExecuteFlag) {
3731 CALL_PolygonStipple(ctx->Exec, ((GLubyte *) pattern));
3732 }
3733 }
3734
3735
3736 static void GLAPIENTRY
3737 save_PolygonOffset(GLfloat factor, GLfloat units)
3738 {
3739 GET_CURRENT_CONTEXT(ctx);
3740 Node *n;
3741 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3742 n = alloc_instruction(ctx, OPCODE_POLYGON_OFFSET, 2);
3743 if (n) {
3744 n[1].f = factor;
3745 n[2].f = units;
3746 }
3747 if (ctx->ExecuteFlag) {
3748 CALL_PolygonOffset(ctx->Exec, (factor, units));
3749 }
3750 }
3751
3752
3753 static void GLAPIENTRY
3754 save_PolygonOffsetClampEXT(GLfloat factor, GLfloat units, GLfloat clamp)
3755 {
3756 GET_CURRENT_CONTEXT(ctx);
3757 Node *n;
3758 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3759 n = alloc_instruction(ctx, OPCODE_POLYGON_OFFSET_CLAMP, 3);
3760 if (n) {
3761 n[1].f = factor;
3762 n[2].f = units;
3763 n[3].f = clamp;
3764 }
3765 if (ctx->ExecuteFlag) {
3766 CALL_PolygonOffsetClampEXT(ctx->Exec, (factor, units, clamp));
3767 }
3768 }
3769
3770 static void GLAPIENTRY
3771 save_PopAttrib(void)
3772 {
3773 GET_CURRENT_CONTEXT(ctx);
3774 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3775 (void) alloc_instruction(ctx, OPCODE_POP_ATTRIB, 0);
3776 if (ctx->ExecuteFlag) {
3777 CALL_PopAttrib(ctx->Exec, ());
3778 }
3779 }
3780
3781
3782 static void GLAPIENTRY
3783 save_PopMatrix(void)
3784 {
3785 GET_CURRENT_CONTEXT(ctx);
3786 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3787 (void) alloc_instruction(ctx, OPCODE_POP_MATRIX, 0);
3788 if (ctx->ExecuteFlag) {
3789 CALL_PopMatrix(ctx->Exec, ());
3790 }
3791 }
3792
3793
3794 static void GLAPIENTRY
3795 save_PopName(void)
3796 {
3797 GET_CURRENT_CONTEXT(ctx);
3798 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3799 (void) alloc_instruction(ctx, OPCODE_POP_NAME, 0);
3800 if (ctx->ExecuteFlag) {
3801 CALL_PopName(ctx->Exec, ());
3802 }
3803 }
3804
3805
3806 static void GLAPIENTRY
3807 save_PrioritizeTextures(GLsizei num, const GLuint * textures,
3808 const GLclampf * priorities)
3809 {
3810 GET_CURRENT_CONTEXT(ctx);
3811 GLint i;
3812 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3813
3814 for (i = 0; i < num; i++) {
3815 Node *n;
3816 n = alloc_instruction(ctx, OPCODE_PRIORITIZE_TEXTURE, 2);
3817 if (n) {
3818 n[1].ui = textures[i];
3819 n[2].f = priorities[i];
3820 }
3821 }
3822 if (ctx->ExecuteFlag) {
3823 CALL_PrioritizeTextures(ctx->Exec, (num, textures, priorities));
3824 }
3825 }
3826
3827
3828 static void GLAPIENTRY
3829 save_PushAttrib(GLbitfield mask)
3830 {
3831 GET_CURRENT_CONTEXT(ctx);
3832 Node *n;
3833 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3834 n = alloc_instruction(ctx, OPCODE_PUSH_ATTRIB, 1);
3835 if (n) {
3836 n[1].bf = mask;
3837 }
3838 if (ctx->ExecuteFlag) {
3839 CALL_PushAttrib(ctx->Exec, (mask));
3840 }
3841 }
3842
3843
3844 static void GLAPIENTRY
3845 save_PushMatrix(void)
3846 {
3847 GET_CURRENT_CONTEXT(ctx);
3848 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3849 (void) alloc_instruction(ctx, OPCODE_PUSH_MATRIX, 0);
3850 if (ctx->ExecuteFlag) {
3851 CALL_PushMatrix(ctx->Exec, ());
3852 }
3853 }
3854
3855
3856 static void GLAPIENTRY
3857 save_PushName(GLuint name)
3858 {
3859 GET_CURRENT_CONTEXT(ctx);
3860 Node *n;
3861 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3862 n = alloc_instruction(ctx, OPCODE_PUSH_NAME, 1);
3863 if (n) {
3864 n[1].ui = name;
3865 }
3866 if (ctx->ExecuteFlag) {
3867 CALL_PushName(ctx->Exec, (name));
3868 }
3869 }
3870
3871
3872 static void GLAPIENTRY
3873 save_RasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
3874 {
3875 GET_CURRENT_CONTEXT(ctx);
3876 Node *n;
3877 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3878 n = alloc_instruction(ctx, OPCODE_RASTER_POS, 4);
3879 if (n) {
3880 n[1].f = x;
3881 n[2].f = y;
3882 n[3].f = z;
3883 n[4].f = w;
3884 }
3885 if (ctx->ExecuteFlag) {
3886 CALL_RasterPos4f(ctx->Exec, (x, y, z, w));
3887 }
3888 }
3889
3890 static void GLAPIENTRY
3891 save_RasterPos2d(GLdouble x, GLdouble y)
3892 {
3893 save_RasterPos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
3894 }
3895
3896 static void GLAPIENTRY
3897 save_RasterPos2f(GLfloat x, GLfloat y)
3898 {
3899 save_RasterPos4f(x, y, 0.0F, 1.0F);
3900 }
3901
3902 static void GLAPIENTRY
3903 save_RasterPos2i(GLint x, GLint y)
3904 {
3905 save_RasterPos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
3906 }
3907
3908 static void GLAPIENTRY
3909 save_RasterPos2s(GLshort x, GLshort y)
3910 {
3911 save_RasterPos4f(x, y, 0.0F, 1.0F);
3912 }
3913
3914 static void GLAPIENTRY
3915 save_RasterPos3d(GLdouble x, GLdouble y, GLdouble z)
3916 {
3917 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
3918 }
3919
3920 static void GLAPIENTRY
3921 save_RasterPos3f(GLfloat x, GLfloat y, GLfloat z)
3922 {
3923 save_RasterPos4f(x, y, z, 1.0F);
3924 }
3925
3926 static void GLAPIENTRY
3927 save_RasterPos3i(GLint x, GLint y, GLint z)
3928 {
3929 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
3930 }
3931
3932 static void GLAPIENTRY
3933 save_RasterPos3s(GLshort x, GLshort y, GLshort z)
3934 {
3935 save_RasterPos4f(x, y, z, 1.0F);
3936 }
3937
3938 static void GLAPIENTRY
3939 save_RasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
3940 {
3941 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
3942 }
3943
3944 static void GLAPIENTRY
3945 save_RasterPos4i(GLint x, GLint y, GLint z, GLint w)
3946 {
3947 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
3948 }
3949
3950 static void GLAPIENTRY
3951 save_RasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w)
3952 {
3953 save_RasterPos4f(x, y, z, w);
3954 }
3955
3956 static void GLAPIENTRY
3957 save_RasterPos2dv(const GLdouble * v)
3958 {
3959 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
3960 }
3961
3962 static void GLAPIENTRY
3963 save_RasterPos2fv(const GLfloat * v)
3964 {
3965 save_RasterPos4f(v[0], v[1], 0.0F, 1.0F);
3966 }
3967
3968 static void GLAPIENTRY
3969 save_RasterPos2iv(const GLint * v)
3970 {
3971 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
3972 }
3973
3974 static void GLAPIENTRY
3975 save_RasterPos2sv(const GLshort * v)
3976 {
3977 save_RasterPos4f(v[0], v[1], 0.0F, 1.0F);
3978 }
3979
3980 static void GLAPIENTRY
3981 save_RasterPos3dv(const GLdouble * v)
3982 {
3983 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
3984 }
3985
3986 static void GLAPIENTRY
3987 save_RasterPos3fv(const GLfloat * v)
3988 {
3989 save_RasterPos4f(v[0], v[1], v[2], 1.0F);
3990 }
3991
3992 static void GLAPIENTRY
3993 save_RasterPos3iv(const GLint * v)
3994 {
3995 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
3996 }
3997
3998 static void GLAPIENTRY
3999 save_RasterPos3sv(const GLshort * v)
4000 {
4001 save_RasterPos4f(v[0], v[1], v[2], 1.0F);
4002 }
4003
4004 static void GLAPIENTRY
4005 save_RasterPos4dv(const GLdouble * v)
4006 {
4007 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1],
4008 (GLfloat) v[2], (GLfloat) v[3]);
4009 }
4010
4011 static void GLAPIENTRY
4012 save_RasterPos4fv(const GLfloat * v)
4013 {
4014 save_RasterPos4f(v[0], v[1], v[2], v[3]);
4015 }
4016
4017 static void GLAPIENTRY
4018 save_RasterPos4iv(const GLint * v)
4019 {
4020 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1],
4021 (GLfloat) v[2], (GLfloat) v[3]);
4022 }
4023
4024 static void GLAPIENTRY
4025 save_RasterPos4sv(const GLshort * v)
4026 {
4027 save_RasterPos4f(v[0], v[1], v[2], v[3]);
4028 }
4029
4030
4031 static void GLAPIENTRY
4032 save_PassThrough(GLfloat token)
4033 {
4034 GET_CURRENT_CONTEXT(ctx);
4035 Node *n;
4036 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4037 n = alloc_instruction(ctx, OPCODE_PASSTHROUGH, 1);
4038 if (n) {
4039 n[1].f = token;
4040 }
4041 if (ctx->ExecuteFlag) {
4042 CALL_PassThrough(ctx->Exec, (token));
4043 }
4044 }
4045
4046
4047 static void GLAPIENTRY
4048 save_ReadBuffer(GLenum mode)
4049 {
4050 GET_CURRENT_CONTEXT(ctx);
4051 Node *n;
4052 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4053 n = alloc_instruction(ctx, OPCODE_READ_BUFFER, 1);
4054 if (n) {
4055 n[1].e = mode;
4056 }
4057 if (ctx->ExecuteFlag) {
4058 CALL_ReadBuffer(ctx->Exec, (mode));
4059 }
4060 }
4061
4062
4063 static void GLAPIENTRY
4064 save_Rotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
4065 {
4066 GET_CURRENT_CONTEXT(ctx);
4067 Node *n;
4068 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4069 n = alloc_instruction(ctx, OPCODE_ROTATE, 4);
4070 if (n) {
4071 n[1].f = angle;
4072 n[2].f = x;
4073 n[3].f = y;
4074 n[4].f = z;
4075 }
4076 if (ctx->ExecuteFlag) {
4077 CALL_Rotatef(ctx->Exec, (angle, x, y, z));
4078 }
4079 }
4080
4081
4082 static void GLAPIENTRY
4083 save_Rotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
4084 {
4085 save_Rotatef((GLfloat) angle, (GLfloat) x, (GLfloat) y, (GLfloat) z);
4086 }
4087
4088
4089 static void GLAPIENTRY
4090 save_Scalef(GLfloat x, GLfloat y, GLfloat z)
4091 {
4092 GET_CURRENT_CONTEXT(ctx);
4093 Node *n;
4094 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4095 n = alloc_instruction(ctx, OPCODE_SCALE, 3);
4096 if (n) {
4097 n[1].f = x;
4098 n[2].f = y;
4099 n[3].f = z;
4100 }
4101 if (ctx->ExecuteFlag) {
4102 CALL_Scalef(ctx->Exec, (x, y, z));
4103 }
4104 }
4105
4106
4107 static void GLAPIENTRY
4108 save_Scaled(GLdouble x, GLdouble y, GLdouble z)
4109 {
4110 save_Scalef((GLfloat) x, (GLfloat) y, (GLfloat) z);
4111 }
4112
4113
4114 static void GLAPIENTRY
4115 save_Scissor(GLint x, GLint y, GLsizei width, GLsizei height)
4116 {
4117 GET_CURRENT_CONTEXT(ctx);
4118 Node *n;
4119 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4120 n = alloc_instruction(ctx, OPCODE_SCISSOR, 4);
4121 if (n) {
4122 n[1].i = x;
4123 n[2].i = y;
4124 n[3].i = width;
4125 n[4].i = height;
4126 }
4127 if (ctx->ExecuteFlag) {
4128 CALL_Scissor(ctx->Exec, (x, y, width, height));
4129 }
4130 }
4131
4132
4133 static void GLAPIENTRY
4134 save_ShadeModel(GLenum mode)
4135 {
4136 GET_CURRENT_CONTEXT(ctx);
4137 Node *n;
4138 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx);
4139
4140 if (ctx->ExecuteFlag) {
4141 CALL_ShadeModel(ctx->Exec, (mode));
4142 }
4143
4144 /* Don't compile this call if it's a no-op.
4145 * By avoiding this state change we have a better chance of
4146 * coalescing subsequent drawing commands into one batch.
4147 */
4148 if (ctx->ListState.Current.ShadeModel == mode)
4149 return;
4150
4151 SAVE_FLUSH_VERTICES(ctx);
4152
4153 ctx->ListState.Current.ShadeModel = mode;
4154
4155 n = alloc_instruction(ctx, OPCODE_SHADE_MODEL, 1);
4156 if (n) {
4157 n[1].e = mode;
4158 }
4159 }
4160
4161
4162 static void GLAPIENTRY
4163 save_StencilFunc(GLenum func, GLint ref, GLuint mask)
4164 {
4165 GET_CURRENT_CONTEXT(ctx);
4166 Node *n;
4167 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4168 n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC, 3);
4169 if (n) {
4170 n[1].e = func;
4171 n[2].i = ref;
4172 n[3].ui = mask;
4173 }
4174 if (ctx->ExecuteFlag) {
4175 CALL_StencilFunc(ctx->Exec, (func, ref, mask));
4176 }
4177 }
4178
4179
4180 static void GLAPIENTRY
4181 save_StencilMask(GLuint mask)
4182 {
4183 GET_CURRENT_CONTEXT(ctx);
4184 Node *n;
4185 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4186 n = alloc_instruction(ctx, OPCODE_STENCIL_MASK, 1);
4187 if (n) {
4188 n[1].ui = mask;
4189 }
4190 if (ctx->ExecuteFlag) {
4191 CALL_StencilMask(ctx->Exec, (mask));
4192 }
4193 }
4194
4195
4196 static void GLAPIENTRY
4197 save_StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
4198 {
4199 GET_CURRENT_CONTEXT(ctx);
4200 Node *n;
4201 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4202 n = alloc_instruction(ctx, OPCODE_STENCIL_OP, 3);
4203 if (n) {
4204 n[1].e = fail;
4205 n[2].e = zfail;
4206 n[3].e = zpass;
4207 }
4208 if (ctx->ExecuteFlag) {
4209 CALL_StencilOp(ctx->Exec, (fail, zfail, zpass));
4210 }
4211 }
4212
4213
4214 static void GLAPIENTRY
4215 save_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
4216 {
4217 GET_CURRENT_CONTEXT(ctx);
4218 Node *n;
4219 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4220 n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4);
4221 if (n) {
4222 n[1].e = face;
4223 n[2].e = func;
4224 n[3].i = ref;
4225 n[4].ui = mask;
4226 }
4227 if (ctx->ExecuteFlag) {
4228 CALL_StencilFuncSeparate(ctx->Exec, (face, func, ref, mask));
4229 }
4230 }
4231
4232
4233 static void GLAPIENTRY
4234 save_StencilFuncSeparateATI(GLenum frontfunc, GLenum backfunc, GLint ref,
4235 GLuint mask)
4236 {
4237 GET_CURRENT_CONTEXT(ctx);
4238 Node *n;
4239 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4240 /* GL_FRONT */
4241 n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4);
4242 if (n) {
4243 n[1].e = GL_FRONT;
4244 n[2].e = frontfunc;
4245 n[3].i = ref;
4246 n[4].ui = mask;
4247 }
4248 /* GL_BACK */
4249 n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4);
4250 if (n) {
4251 n[1].e = GL_BACK;
4252 n[2].e = backfunc;
4253 n[3].i = ref;
4254 n[4].ui = mask;
4255 }
4256 if (ctx->ExecuteFlag) {
4257 CALL_StencilFuncSeparate(ctx->Exec, (GL_FRONT, frontfunc, ref, mask));
4258 CALL_StencilFuncSeparate(ctx->Exec, (GL_BACK, backfunc, ref, mask));
4259 }
4260 }
4261
4262
4263 static void GLAPIENTRY
4264 save_StencilMaskSeparate(GLenum face, GLuint mask)
4265 {
4266 GET_CURRENT_CONTEXT(ctx);
4267 Node *n;
4268 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4269 n = alloc_instruction(ctx, OPCODE_STENCIL_MASK_SEPARATE, 2);
4270 if (n) {
4271 n[1].e = face;
4272 n[2].ui = mask;
4273 }
4274 if (ctx->ExecuteFlag) {
4275 CALL_StencilMaskSeparate(ctx->Exec, (face, mask));
4276 }
4277 }
4278
4279
4280 static void GLAPIENTRY
4281 save_StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
4282 {
4283 GET_CURRENT_CONTEXT(ctx);
4284 Node *n;
4285 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4286 n = alloc_instruction(ctx, OPCODE_STENCIL_OP_SEPARATE, 4);
4287 if (n) {
4288 n[1].e = face;
4289 n[2].e = fail;
4290 n[3].e = zfail;
4291 n[4].e = zpass;
4292 }
4293 if (ctx->ExecuteFlag) {
4294 CALL_StencilOpSeparate(ctx->Exec, (face, fail, zfail, zpass));
4295 }
4296 }
4297
4298
4299 static void GLAPIENTRY
4300 save_TexEnvfv(GLenum target, GLenum pname, const GLfloat *params)
4301 {
4302 GET_CURRENT_CONTEXT(ctx);
4303 Node *n;
4304 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4305 n = alloc_instruction(ctx, OPCODE_TEXENV, 6);
4306 if (n) {
4307 n[1].e = target;
4308 n[2].e = pname;
4309 if (pname == GL_TEXTURE_ENV_COLOR) {
4310 n[3].f = params[0];
4311 n[4].f = params[1];
4312 n[5].f = params[2];
4313 n[6].f = params[3];
4314 }
4315 else {
4316 n[3].f = params[0];
4317 n[4].f = n[5].f = n[6].f = 0.0F;
4318 }
4319 }
4320 if (ctx->ExecuteFlag) {
4321 CALL_TexEnvfv(ctx->Exec, (target, pname, params));
4322 }
4323 }
4324
4325
4326 static void GLAPIENTRY
4327 save_TexEnvf(GLenum target, GLenum pname, GLfloat param)
4328 {
4329 GLfloat parray[4];
4330 parray[0] = (GLfloat) param;
4331 parray[1] = parray[2] = parray[3] = 0.0F;
4332 save_TexEnvfv(target, pname, parray);
4333 }
4334
4335
4336 static void GLAPIENTRY
4337 save_TexEnvi(GLenum target, GLenum pname, GLint param)
4338 {
4339 GLfloat p[4];
4340 p[0] = (GLfloat) param;
4341 p[1] = p[2] = p[3] = 0.0F;
4342 save_TexEnvfv(target, pname, p);
4343 }
4344
4345
4346 static void GLAPIENTRY
4347 save_TexEnviv(GLenum target, GLenum pname, const GLint * param)
4348 {
4349 GLfloat p[4];
4350 if (pname == GL_TEXTURE_ENV_COLOR) {
4351 p[0] = INT_TO_FLOAT(param[0]);
4352 p[1] = INT_TO_FLOAT(param[1]);
4353 p[2] = INT_TO_FLOAT(param[2]);
4354 p[3] = INT_TO_FLOAT(param[3]);
4355 }
4356 else {
4357 p[0] = (GLfloat) param[0];
4358 p[1] = p[2] = p[3] = 0.0F;
4359 }
4360 save_TexEnvfv(target, pname, p);
4361 }
4362
4363
4364 static void GLAPIENTRY
4365 save_TexGenfv(GLenum coord, GLenum pname, const GLfloat *params)
4366 {
4367 GET_CURRENT_CONTEXT(ctx);
4368 Node *n;
4369 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4370 n = alloc_instruction(ctx, OPCODE_TEXGEN, 6);
4371 if (n) {
4372 n[1].e = coord;
4373 n[2].e = pname;
4374 n[3].f = params[0];
4375 n[4].f = params[1];
4376 n[5].f = params[2];
4377 n[6].f = params[3];
4378 }
4379 if (ctx->ExecuteFlag) {
4380 CALL_TexGenfv(ctx->Exec, (coord, pname, params));
4381 }
4382 }
4383
4384
4385 static void GLAPIENTRY
4386 save_TexGeniv(GLenum coord, GLenum pname, const GLint *params)
4387 {
4388 GLfloat p[4];
4389 p[0] = (GLfloat) params[0];
4390 p[1] = (GLfloat) params[1];
4391 p[2] = (GLfloat) params[2];
4392 p[3] = (GLfloat) params[3];
4393 save_TexGenfv(coord, pname, p);
4394 }
4395
4396
4397 static void GLAPIENTRY
4398 save_TexGend(GLenum coord, GLenum pname, GLdouble param)
4399 {
4400 GLfloat parray[4];
4401 parray[0] = (GLfloat) param;
4402 parray[1] = parray[2] = parray[3] = 0.0F;
4403 save_TexGenfv(coord, pname, parray);
4404 }
4405
4406
4407 static void GLAPIENTRY
4408 save_TexGendv(GLenum coord, GLenum pname, const GLdouble *params)
4409 {
4410 GLfloat p[4];
4411 p[0] = (GLfloat) params[0];
4412 p[1] = (GLfloat) params[1];
4413 p[2] = (GLfloat) params[2];
4414 p[3] = (GLfloat) params[3];
4415 save_TexGenfv(coord, pname, p);
4416 }
4417
4418
4419 static void GLAPIENTRY
4420 save_TexGenf(GLenum coord, GLenum pname, GLfloat param)
4421 {
4422 GLfloat parray[4];
4423 parray[0] = param;
4424 parray[1] = parray[2] = parray[3] = 0.0F;
4425 save_TexGenfv(coord, pname, parray);
4426 }
4427
4428
4429 static void GLAPIENTRY
4430 save_TexGeni(GLenum coord, GLenum pname, GLint param)
4431 {
4432 GLint parray[4];
4433 parray[0] = param;
4434 parray[1] = parray[2] = parray[3] = 0;
4435 save_TexGeniv(coord, pname, parray);
4436 }
4437
4438
4439 static void GLAPIENTRY
4440 save_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
4441 {
4442 GET_CURRENT_CONTEXT(ctx);
4443 Node *n;
4444 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4445 n = alloc_instruction(ctx, OPCODE_TEXPARAMETER, 6);
4446 if (n) {
4447 n[1].e = target;
4448 n[2].e = pname;
4449 n[3].f = params[0];
4450 n[4].f = params[1];
4451 n[5].f = params[2];
4452 n[6].f = params[3];
4453 }
4454 if (ctx->ExecuteFlag) {
4455 CALL_TexParameterfv(ctx->Exec, (target, pname, params));
4456 }
4457 }
4458
4459
4460 static void GLAPIENTRY
4461 save_TexParameterf(GLenum target, GLenum pname, GLfloat param)
4462 {
4463 GLfloat parray[4];
4464 parray[0] = param;
4465 parray[1] = parray[2] = parray[3] = 0.0F;
4466 save_TexParameterfv(target, pname, parray);
4467 }
4468
4469
4470 static void GLAPIENTRY
4471 save_TexParameteri(GLenum target, GLenum pname, GLint param)
4472 {
4473 GLfloat fparam[4];
4474 fparam[0] = (GLfloat) param;
4475 fparam[1] = fparam[2] = fparam[3] = 0.0F;
4476 save_TexParameterfv(target, pname, fparam);
4477 }
4478
4479
4480 static void GLAPIENTRY
4481 save_TexParameteriv(GLenum target, GLenum pname, const GLint *params)
4482 {
4483 GLfloat fparam[4];
4484 fparam[0] = (GLfloat) params[0];
4485 fparam[1] = fparam[2] = fparam[3] = 0.0F;
4486 save_TexParameterfv(target, pname, fparam);
4487 }
4488
4489
4490 static void GLAPIENTRY
4491 save_TexImage1D(GLenum target,
4492 GLint level, GLint components,
4493 GLsizei width, GLint border,
4494 GLenum format, GLenum type, const GLvoid * pixels)
4495 {
4496 GET_CURRENT_CONTEXT(ctx);
4497 if (target == GL_PROXY_TEXTURE_1D) {
4498 /* don't compile, execute immediately */
4499 CALL_TexImage1D(ctx->Exec, (target, level, components, width,
4500 border, format, type, pixels));
4501 }
4502 else {
4503 Node *n;
4504 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4505 n = alloc_instruction(ctx, OPCODE_TEX_IMAGE1D, 7 + POINTER_DWORDS);
4506 if (n) {
4507 n[1].e = target;
4508 n[2].i = level;
4509 n[3].i = components;
4510 n[4].i = (GLint) width;
4511 n[5].i = border;
4512 n[6].e = format;
4513 n[7].e = type;
4514 save_pointer(&n[8],
4515 unpack_image(ctx, 1, width, 1, 1, format, type,
4516 pixels, &ctx->Unpack));
4517 }
4518 if (ctx->ExecuteFlag) {
4519 CALL_TexImage1D(ctx->Exec, (target, level, components, width,
4520 border, format, type, pixels));
4521 }
4522 }
4523 }
4524
4525
4526 static void GLAPIENTRY
4527 save_TexImage2D(GLenum target,
4528 GLint level, GLint components,
4529 GLsizei width, GLsizei height, GLint border,
4530 GLenum format, GLenum type, const GLvoid * pixels)
4531 {
4532 GET_CURRENT_CONTEXT(ctx);
4533 if (target == GL_PROXY_TEXTURE_2D) {
4534 /* don't compile, execute immediately */
4535 CALL_TexImage2D(ctx->Exec, (target, level, components, width,
4536 height, border, format, type, pixels));
4537 }
4538 else {
4539 Node *n;
4540 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4541 n = alloc_instruction(ctx, OPCODE_TEX_IMAGE2D, 8 + POINTER_DWORDS);
4542 if (n) {
4543 n[1].e = target;
4544 n[2].i = level;
4545 n[3].i = components;
4546 n[4].i = (GLint) width;
4547 n[5].i = (GLint) height;
4548 n[6].i = border;
4549 n[7].e = format;
4550 n[8].e = type;
4551 save_pointer(&n[9],
4552 unpack_image(ctx, 2, width, height, 1, format, type,
4553 pixels, &ctx->Unpack));
4554 }
4555 if (ctx->ExecuteFlag) {
4556 CALL_TexImage2D(ctx->Exec, (target, level, components, width,
4557 height, border, format, type, pixels));
4558 }
4559 }
4560 }
4561
4562
4563 static void GLAPIENTRY
4564 save_TexImage3D(GLenum target,
4565 GLint level, GLint internalFormat,
4566 GLsizei width, GLsizei height, GLsizei depth,
4567 GLint border,
4568 GLenum format, GLenum type, const GLvoid * pixels)
4569 {
4570 GET_CURRENT_CONTEXT(ctx);
4571 if (target == GL_PROXY_TEXTURE_3D) {
4572 /* don't compile, execute immediately */
4573 CALL_TexImage3D(ctx->Exec, (target, level, internalFormat, width,
4574 height, depth, border, format, type,
4575 pixels));
4576 }
4577 else {
4578 Node *n;
4579 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4580 n = alloc_instruction(ctx, OPCODE_TEX_IMAGE3D, 9 + POINTER_DWORDS);
4581 if (n) {
4582 n[1].e = target;
4583 n[2].i = level;
4584 n[3].i = (GLint) internalFormat;
4585 n[4].i = (GLint) width;
4586 n[5].i = (GLint) height;
4587 n[6].i = (GLint) depth;
4588 n[7].i = border;
4589 n[8].e = format;
4590 n[9].e = type;
4591 save_pointer(&n[10],
4592 unpack_image(ctx, 3, width, height, depth, format, type,
4593 pixels, &ctx->Unpack));
4594 }
4595 if (ctx->ExecuteFlag) {
4596 CALL_TexImage3D(ctx->Exec, (target, level, internalFormat, width,
4597 height, depth, border, format, type,
4598 pixels));
4599 }
4600 }
4601 }
4602
4603
4604 static void GLAPIENTRY
4605 save_TexSubImage1D(GLenum target, GLint level, GLint xoffset,
4606 GLsizei width, GLenum format, GLenum type,
4607 const GLvoid * pixels)
4608 {
4609 GET_CURRENT_CONTEXT(ctx);
4610 Node *n;
4611
4612 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4613
4614 n = alloc_instruction(ctx, OPCODE_TEX_SUB_IMAGE1D, 6 + POINTER_DWORDS);
4615 if (n) {
4616 n[1].e = target;
4617 n[2].i = level;
4618 n[3].i = xoffset;
4619 n[4].i = (GLint) width;
4620 n[5].e = format;
4621 n[6].e = type;
4622 save_pointer(&n[7],
4623 unpack_image(ctx, 1, width, 1, 1, format, type,
4624 pixels, &ctx->Unpack));
4625 }
4626 if (ctx->ExecuteFlag) {
4627 CALL_TexSubImage1D(ctx->Exec, (target, level, xoffset, width,
4628 format, type, pixels));
4629 }
4630 }
4631
4632
4633 static void GLAPIENTRY
4634 save_TexSubImage2D(GLenum target, GLint level,
4635 GLint xoffset, GLint yoffset,
4636 GLsizei width, GLsizei height,
4637 GLenum format, GLenum type, const GLvoid * pixels)
4638 {
4639 GET_CURRENT_CONTEXT(ctx);
4640 Node *n;
4641
4642 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4643
4644 n = alloc_instruction(ctx, OPCODE_TEX_SUB_IMAGE2D, 8 + POINTER_DWORDS);
4645 if (n) {
4646 n[1].e = target;
4647 n[2].i = level;
4648 n[3].i = xoffset;
4649 n[4].i = yoffset;
4650 n[5].i = (GLint) width;
4651 n[6].i = (GLint) height;
4652 n[7].e = format;
4653 n[8].e = type;
4654 save_pointer(&n[9],
4655 unpack_image(ctx, 2, width, height, 1, format, type,
4656 pixels, &ctx->Unpack));
4657 }
4658 if (ctx->ExecuteFlag) {
4659 CALL_TexSubImage2D(ctx->Exec, (target, level, xoffset, yoffset,
4660 width, height, format, type, pixels));
4661 }
4662 }
4663
4664
4665 static void GLAPIENTRY
4666 save_TexSubImage3D(GLenum target, GLint level,
4667 GLint xoffset, GLint yoffset, GLint zoffset,
4668 GLsizei width, GLsizei height, GLsizei depth,
4669 GLenum format, GLenum type, const GLvoid * pixels)
4670 {
4671 GET_CURRENT_CONTEXT(ctx);
4672 Node *n;
4673
4674 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4675
4676 n = alloc_instruction(ctx, OPCODE_TEX_SUB_IMAGE3D, 10 + POINTER_DWORDS);
4677 if (n) {
4678 n[1].e = target;
4679 n[2].i = level;
4680 n[3].i = xoffset;
4681 n[4].i = yoffset;
4682 n[5].i = zoffset;
4683 n[6].i = (GLint) width;
4684 n[7].i = (GLint) height;
4685 n[8].i = (GLint) depth;
4686 n[9].e = format;
4687 n[10].e = type;
4688 save_pointer(&n[11],
4689 unpack_image(ctx, 3, width, height, depth, format, type,
4690 pixels, &ctx->Unpack));
4691 }
4692 if (ctx->ExecuteFlag) {
4693 CALL_TexSubImage3D(ctx->Exec, (target, level,
4694 xoffset, yoffset, zoffset,
4695 width, height, depth, format, type,
4696 pixels));
4697 }
4698 }
4699
4700
4701 static void GLAPIENTRY
4702 save_Translatef(GLfloat x, GLfloat y, GLfloat z)
4703 {
4704 GET_CURRENT_CONTEXT(ctx);
4705 Node *n;
4706 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4707 n = alloc_instruction(ctx, OPCODE_TRANSLATE, 3);
4708 if (n) {
4709 n[1].f = x;
4710 n[2].f = y;
4711 n[3].f = z;
4712 }
4713 if (ctx->ExecuteFlag) {
4714 CALL_Translatef(ctx->Exec, (x, y, z));
4715 }
4716 }
4717
4718
4719 static void GLAPIENTRY
4720 save_Translated(GLdouble x, GLdouble y, GLdouble z)
4721 {
4722 save_Translatef((GLfloat) x, (GLfloat) y, (GLfloat) z);
4723 }
4724
4725
4726
4727 static void GLAPIENTRY
4728 save_Viewport(GLint x, GLint y, GLsizei width, GLsizei height)
4729 {
4730 GET_CURRENT_CONTEXT(ctx);
4731 Node *n;
4732 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4733 n = alloc_instruction(ctx, OPCODE_VIEWPORT, 4);
4734 if (n) {
4735 n[1].i = x;
4736 n[2].i = y;
4737 n[3].i = (GLint) width;
4738 n[4].i = (GLint) height;
4739 }
4740 if (ctx->ExecuteFlag) {
4741 CALL_Viewport(ctx->Exec, (x, y, width, height));
4742 }
4743 }
4744
4745 static void GLAPIENTRY
4746 save_ViewportIndexedf(GLuint index, GLfloat x, GLfloat y, GLfloat width,
4747 GLfloat height)
4748 {
4749 GET_CURRENT_CONTEXT(ctx);
4750 Node *n;
4751 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4752 n = alloc_instruction(ctx, OPCODE_VIEWPORT_INDEXED_F, 5);
4753 if (n) {
4754 n[1].ui = index;
4755 n[2].f = x;
4756 n[3].f = y;
4757 n[4].f = width;
4758 n[5].f = height;
4759 }
4760 if (ctx->ExecuteFlag) {
4761 CALL_ViewportIndexedf(ctx->Exec, (index, x, y, width, height));
4762 }
4763 }
4764
4765 static void GLAPIENTRY
4766 save_ViewportIndexedfv(GLuint index, const GLfloat *v)
4767 {
4768 GET_CURRENT_CONTEXT(ctx);
4769 Node *n;
4770 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4771 n = alloc_instruction(ctx, OPCODE_VIEWPORT_INDEXED_FV, 5);
4772 if (n) {
4773 n[1].ui = index;
4774 n[2].f = v[0];
4775 n[3].f = v[1];
4776 n[4].f = v[2];
4777 n[5].f = v[3];
4778 }
4779 if (ctx->ExecuteFlag) {
4780 CALL_ViewportIndexedfv(ctx->Exec, (index, v));
4781 }
4782 }
4783
4784 static void GLAPIENTRY
4785 save_ViewportArrayv(GLuint first, GLsizei count, const GLfloat *v)
4786 {
4787 GET_CURRENT_CONTEXT(ctx);
4788 Node *n;
4789 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4790 n = alloc_instruction(ctx, OPCODE_VIEWPORT_ARRAY_V, 2 + POINTER_DWORDS);
4791 if (n) {
4792 n[1].ui = first;
4793 n[2].si = count;
4794 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLfloat)));
4795 }
4796 if (ctx->ExecuteFlag) {
4797 CALL_ViewportArrayv(ctx->Exec, (first, count, v));
4798 }
4799 }
4800
4801 static void GLAPIENTRY
4802 save_ScissorIndexed(GLuint index, GLint left, GLint bottom, GLsizei width,
4803 GLsizei height)
4804 {
4805 GET_CURRENT_CONTEXT(ctx);
4806 Node *n;
4807 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4808 n = alloc_instruction(ctx, OPCODE_SCISSOR_INDEXED, 5);
4809 if (n) {
4810 n[1].ui = index;
4811 n[2].i = left;
4812 n[3].i = bottom;
4813 n[4].si = width;
4814 n[5].si = height;
4815 }
4816 if (ctx->ExecuteFlag) {
4817 CALL_ScissorIndexed(ctx->Exec, (index, left, bottom, width, height));
4818 }
4819 }
4820
4821 static void GLAPIENTRY
4822 save_ScissorIndexedv(GLuint index, const GLint *v)
4823 {
4824 GET_CURRENT_CONTEXT(ctx);
4825 Node *n;
4826 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4827 n = alloc_instruction(ctx, OPCODE_SCISSOR_INDEXED_V, 5);
4828 if (n) {
4829 n[1].ui = index;
4830 n[2].i = v[0];
4831 n[3].i = v[1];
4832 n[4].si = v[2];
4833 n[5].si = v[3];
4834 }
4835 if (ctx->ExecuteFlag) {
4836 CALL_ScissorIndexedv(ctx->Exec, (index, v));
4837 }
4838 }
4839
4840 static void GLAPIENTRY
4841 save_ScissorArrayv(GLuint first, GLsizei count, const GLint *v)
4842 {
4843 GET_CURRENT_CONTEXT(ctx);
4844 Node *n;
4845 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4846 n = alloc_instruction(ctx, OPCODE_SCISSOR_ARRAY_V, 2 + POINTER_DWORDS);
4847 if (n) {
4848 n[1].ui = first;
4849 n[2].si = count;
4850 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLint)));
4851 }
4852 if (ctx->ExecuteFlag) {
4853 CALL_ScissorArrayv(ctx->Exec, (first, count, v));
4854 }
4855 }
4856
4857 static void GLAPIENTRY
4858 save_DepthRangeIndexed(GLuint index, GLclampd n, GLclampd f)
4859 {
4860 GET_CURRENT_CONTEXT(ctx);
4861 Node *node;
4862 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4863 node = alloc_instruction(ctx, OPCODE_DEPTH_INDEXED, 3);
4864 if (node) {
4865 node[1].ui = index;
4866 /* Mesa stores these as floats internally so we deliberately convert
4867 * them to a float here.
4868 */
4869 node[2].f = n;
4870 node[3].f = f;
4871 }
4872 if (ctx->ExecuteFlag) {
4873 CALL_DepthRangeIndexed(ctx->Exec, (index, n, f));
4874 }
4875 }
4876
4877 static void GLAPIENTRY
4878 save_DepthRangeArrayv(GLuint first, GLsizei count, const GLclampd *v)
4879 {
4880 GET_CURRENT_CONTEXT(ctx);
4881 Node *n;
4882 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4883 n = alloc_instruction(ctx, OPCODE_DEPTH_ARRAY_V, 2 + POINTER_DWORDS);
4884 if (n) {
4885 n[1].ui = first;
4886 n[2].si = count;
4887 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLclampd)));
4888 }
4889 if (ctx->ExecuteFlag) {
4890 CALL_DepthRangeArrayv(ctx->Exec, (first, count, v));
4891 }
4892 }
4893
4894 static void GLAPIENTRY
4895 save_WindowPos4fMESA(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
4896 {
4897 GET_CURRENT_CONTEXT(ctx);
4898 Node *n;
4899 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4900 n = alloc_instruction(ctx, OPCODE_WINDOW_POS, 4);
4901 if (n) {
4902 n[1].f = x;
4903 n[2].f = y;
4904 n[3].f = z;
4905 n[4].f = w;
4906 }
4907 if (ctx->ExecuteFlag) {
4908 CALL_WindowPos4fMESA(ctx->Exec, (x, y, z, w));
4909 }
4910 }
4911
4912 static void GLAPIENTRY
4913 save_WindowPos2dMESA(GLdouble x, GLdouble y)
4914 {
4915 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
4916 }
4917
4918 static void GLAPIENTRY
4919 save_WindowPos2fMESA(GLfloat x, GLfloat y)
4920 {
4921 save_WindowPos4fMESA(x, y, 0.0F, 1.0F);
4922 }
4923
4924 static void GLAPIENTRY
4925 save_WindowPos2iMESA(GLint x, GLint y)
4926 {
4927 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
4928 }
4929
4930 static void GLAPIENTRY
4931 save_WindowPos2sMESA(GLshort x, GLshort y)
4932 {
4933 save_WindowPos4fMESA(x, y, 0.0F, 1.0F);
4934 }
4935
4936 static void GLAPIENTRY
4937 save_WindowPos3dMESA(GLdouble x, GLdouble y, GLdouble z)
4938 {
4939 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
4940 }
4941
4942 static void GLAPIENTRY
4943 save_WindowPos3fMESA(GLfloat x, GLfloat y, GLfloat z)
4944 {
4945 save_WindowPos4fMESA(x, y, z, 1.0F);
4946 }
4947
4948 static void GLAPIENTRY
4949 save_WindowPos3iMESA(GLint x, GLint y, GLint z)
4950 {
4951 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
4952 }
4953
4954 static void GLAPIENTRY
4955 save_WindowPos3sMESA(GLshort x, GLshort y, GLshort z)
4956 {
4957 save_WindowPos4fMESA(x, y, z, 1.0F);
4958 }
4959
4960 static void GLAPIENTRY
4961 save_WindowPos4dMESA(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
4962 {
4963 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
4964 }
4965
4966 static void GLAPIENTRY
4967 save_WindowPos4iMESA(GLint x, GLint y, GLint z, GLint w)
4968 {
4969 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
4970 }
4971
4972 static void GLAPIENTRY
4973 save_WindowPos4sMESA(GLshort x, GLshort y, GLshort z, GLshort w)
4974 {
4975 save_WindowPos4fMESA(x, y, z, w);
4976 }
4977
4978 static void GLAPIENTRY
4979 save_WindowPos2dvMESA(const GLdouble * v)
4980 {
4981 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
4982 }
4983
4984 static void GLAPIENTRY
4985 save_WindowPos2fvMESA(const GLfloat * v)
4986 {
4987 save_WindowPos4fMESA(v[0], v[1], 0.0F, 1.0F);
4988 }
4989
4990 static void GLAPIENTRY
4991 save_WindowPos2ivMESA(const GLint * v)
4992 {
4993 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
4994 }
4995
4996 static void GLAPIENTRY
4997 save_WindowPos2svMESA(const GLshort * v)
4998 {
4999 save_WindowPos4fMESA(v[0], v[1], 0.0F, 1.0F);
5000 }
5001
5002 static void GLAPIENTRY
5003 save_WindowPos3dvMESA(const GLdouble * v)
5004 {
5005 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
5006 }
5007
5008 static void GLAPIENTRY
5009 save_WindowPos3fvMESA(const GLfloat * v)
5010 {
5011 save_WindowPos4fMESA(v[0], v[1], v[2], 1.0F);
5012 }
5013
5014 static void GLAPIENTRY
5015 save_WindowPos3ivMESA(const GLint * v)
5016 {
5017 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
5018 }
5019
5020 static void GLAPIENTRY
5021 save_WindowPos3svMESA(const GLshort * v)
5022 {
5023 save_WindowPos4fMESA(v[0], v[1], v[2], 1.0F);
5024 }
5025
5026 static void GLAPIENTRY
5027 save_WindowPos4dvMESA(const GLdouble * v)
5028 {
5029 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1],
5030 (GLfloat) v[2], (GLfloat) v[3]);
5031 }
5032
5033 static void GLAPIENTRY
5034 save_WindowPos4fvMESA(const GLfloat * v)
5035 {
5036 save_WindowPos4fMESA(v[0], v[1], v[2], v[3]);
5037 }
5038
5039 static void GLAPIENTRY
5040 save_WindowPos4ivMESA(const GLint * v)
5041 {
5042 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1],
5043 (GLfloat) v[2], (GLfloat) v[3]);
5044 }
5045
5046 static void GLAPIENTRY
5047 save_WindowPos4svMESA(const GLshort * v)
5048 {
5049 save_WindowPos4fMESA(v[0], v[1], v[2], v[3]);
5050 }
5051
5052
5053
5054 /* GL_ARB_multitexture */
5055 static void GLAPIENTRY
5056 save_ActiveTextureARB(GLenum target)
5057 {
5058 GET_CURRENT_CONTEXT(ctx);
5059 Node *n;
5060 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5061 n = alloc_instruction(ctx, OPCODE_ACTIVE_TEXTURE, 1);
5062 if (n) {
5063 n[1].e = target;
5064 }
5065 if (ctx->ExecuteFlag) {
5066 CALL_ActiveTexture(ctx->Exec, (target));
5067 }
5068 }
5069
5070
5071 /* GL_ARB_transpose_matrix */
5072
5073 static void GLAPIENTRY
5074 save_LoadTransposeMatrixdARB(const GLdouble m[16])
5075 {
5076 GLfloat tm[16];
5077 _math_transposefd(tm, m);
5078 save_LoadMatrixf(tm);
5079 }
5080
5081
5082 static void GLAPIENTRY
5083 save_LoadTransposeMatrixfARB(const GLfloat m[16])
5084 {
5085 GLfloat tm[16];
5086 _math_transposef(tm, m);
5087 save_LoadMatrixf(tm);
5088 }
5089
5090
5091 static void GLAPIENTRY
5092 save_MultTransposeMatrixdARB(const GLdouble m[16])
5093 {
5094 GLfloat tm[16];
5095 _math_transposefd(tm, m);
5096 save_MultMatrixf(tm);
5097 }
5098
5099
5100 static void GLAPIENTRY
5101 save_MultTransposeMatrixfARB(const GLfloat m[16])
5102 {
5103 GLfloat tm[16];
5104 _math_transposef(tm, m);
5105 save_MultMatrixf(tm);
5106 }
5107
5108 static GLvoid *copy_data(const GLvoid *data, GLsizei size, const char *func)
5109 {
5110 GET_CURRENT_CONTEXT(ctx);
5111 GLvoid *image;
5112
5113 if (!data)
5114 return NULL;
5115
5116 image = malloc(size);
5117 if (!image) {
5118 _mesa_error(ctx, GL_OUT_OF_MEMORY, "%s", func);
5119 return NULL;
5120 }
5121 memcpy(image, data, size);
5122
5123 return image;
5124 }
5125
5126
5127 /* GL_ARB_texture_compression */
5128 static void GLAPIENTRY
5129 save_CompressedTexImage1DARB(GLenum target, GLint level,
5130 GLenum internalFormat, GLsizei width,
5131 GLint border, GLsizei imageSize,
5132 const GLvoid * data)
5133 {
5134 GET_CURRENT_CONTEXT(ctx);
5135 if (target == GL_PROXY_TEXTURE_1D) {
5136 /* don't compile, execute immediately */
5137 CALL_CompressedTexImage1D(ctx->Exec, (target, level, internalFormat,
5138 width, border, imageSize,
5139 data));
5140 }
5141 else {
5142 Node *n;
5143 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5144
5145 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_1D,
5146 6 + POINTER_DWORDS);
5147 if (n) {
5148 n[1].e = target;
5149 n[2].i = level;
5150 n[3].e = internalFormat;
5151 n[4].i = (GLint) width;
5152 n[5].i = border;
5153 n[6].i = imageSize;
5154 save_pointer(&n[7],
5155 copy_data(data, imageSize, "glCompressedTexImage1DARB"));
5156 }
5157 if (ctx->ExecuteFlag) {
5158 CALL_CompressedTexImage1D(ctx->Exec,
5159 (target, level, internalFormat, width,
5160 border, imageSize, data));
5161 }
5162 }
5163 }
5164
5165
5166 static void GLAPIENTRY
5167 save_CompressedTexImage2DARB(GLenum target, GLint level,
5168 GLenum internalFormat, GLsizei width,
5169 GLsizei height, GLint border, GLsizei imageSize,
5170 const GLvoid * data)
5171 {
5172 GET_CURRENT_CONTEXT(ctx);
5173 if (target == GL_PROXY_TEXTURE_2D) {
5174 /* don't compile, execute immediately */
5175 CALL_CompressedTexImage2D(ctx->Exec, (target, level, internalFormat,
5176 width, height, border,
5177 imageSize, data));
5178 }
5179 else {
5180 Node *n;
5181 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5182
5183 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_2D,
5184 7 + POINTER_DWORDS);
5185 if (n) {
5186 n[1].e = target;
5187 n[2].i = level;
5188 n[3].e = internalFormat;
5189 n[4].i = (GLint) width;
5190 n[5].i = (GLint) height;
5191 n[6].i = border;
5192 n[7].i = imageSize;
5193 save_pointer(&n[8],
5194 copy_data(data, imageSize, "glCompressedTexImage2DARB"));
5195 }
5196 if (ctx->ExecuteFlag) {
5197 CALL_CompressedTexImage2D(ctx->Exec,
5198 (target, level, internalFormat, width,
5199 height, border, imageSize, data));
5200 }
5201 }
5202 }
5203
5204
5205 static void GLAPIENTRY
5206 save_CompressedTexImage3DARB(GLenum target, GLint level,
5207 GLenum internalFormat, GLsizei width,
5208 GLsizei height, GLsizei depth, GLint border,
5209 GLsizei imageSize, const GLvoid * data)
5210 {
5211 GET_CURRENT_CONTEXT(ctx);
5212 if (target == GL_PROXY_TEXTURE_3D) {
5213 /* don't compile, execute immediately */
5214 CALL_CompressedTexImage3D(ctx->Exec, (target, level, internalFormat,
5215 width, height, depth, border,
5216 imageSize, data));
5217 }
5218 else {
5219 Node *n;
5220 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5221
5222 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_3D,
5223 8 + POINTER_DWORDS);
5224 if (n) {
5225 n[1].e = target;
5226 n[2].i = level;
5227 n[3].e = internalFormat;
5228 n[4].i = (GLint) width;
5229 n[5].i = (GLint) height;
5230 n[6].i = (GLint) depth;
5231 n[7].i = border;
5232 n[8].i = imageSize;
5233 save_pointer(&n[9],
5234 copy_data(data, imageSize, "glCompressedTexImage3DARB"));
5235 }
5236 if (ctx->ExecuteFlag) {
5237 CALL_CompressedTexImage3D(ctx->Exec,
5238 (target, level, internalFormat, width,
5239 height, depth, border, imageSize,
5240 data));
5241 }
5242 }
5243 }
5244
5245
5246 static void GLAPIENTRY
5247 save_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset,
5248 GLsizei width, GLenum format,
5249 GLsizei imageSize, const GLvoid * data)
5250 {
5251 Node *n;
5252 GET_CURRENT_CONTEXT(ctx);
5253 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5254
5255 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D,
5256 6 + POINTER_DWORDS);
5257 if (n) {
5258 n[1].e = target;
5259 n[2].i = level;
5260 n[3].i = xoffset;
5261 n[4].i = (GLint) width;
5262 n[5].e = format;
5263 n[6].i = imageSize;
5264 save_pointer(&n[7],
5265 copy_data(data, imageSize, "glCompressedTexSubImage1DARB"));
5266 }
5267 if (ctx->ExecuteFlag) {
5268 CALL_CompressedTexSubImage1D(ctx->Exec, (target, level, xoffset,
5269 width, format, imageSize,
5270 data));
5271 }
5272 }
5273
5274
5275 static void GLAPIENTRY
5276 save_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset,
5277 GLint yoffset, GLsizei width, GLsizei height,
5278 GLenum format, GLsizei imageSize,
5279 const GLvoid * data)
5280 {
5281 Node *n;
5282 GET_CURRENT_CONTEXT(ctx);
5283 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5284
5285 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D,
5286 8 + POINTER_DWORDS);
5287 if (n) {
5288 n[1].e = target;
5289 n[2].i = level;
5290 n[3].i = xoffset;
5291 n[4].i = yoffset;
5292 n[5].i = (GLint) width;
5293 n[6].i = (GLint) height;
5294 n[7].e = format;
5295 n[8].i = imageSize;
5296 save_pointer(&n[9],
5297 copy_data(data, imageSize, "glCompressedTexSubImage2DARB"));
5298 }
5299 if (ctx->ExecuteFlag) {
5300 CALL_CompressedTexSubImage2D(ctx->Exec,
5301 (target, level, xoffset, yoffset, width,
5302 height, format, imageSize, data));
5303 }
5304 }
5305
5306
5307 static void GLAPIENTRY
5308 save_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset,
5309 GLint yoffset, GLint zoffset, GLsizei width,
5310 GLsizei height, GLsizei depth, GLenum format,
5311 GLsizei imageSize, const GLvoid * data)
5312 {
5313 Node *n;
5314 GET_CURRENT_CONTEXT(ctx);
5315 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5316
5317 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D,
5318 10 + POINTER_DWORDS);
5319 if (n) {
5320 n[1].e = target;
5321 n[2].i = level;
5322 n[3].i = xoffset;
5323 n[4].i = yoffset;
5324 n[5].i = zoffset;
5325 n[6].i = (GLint) width;
5326 n[7].i = (GLint) height;
5327 n[8].i = (GLint) depth;
5328 n[9].e = format;
5329 n[10].i = imageSize;
5330 save_pointer(&n[11],
5331 copy_data(data, imageSize, "glCompressedTexSubImage3DARB"));
5332 }
5333 if (ctx->ExecuteFlag) {
5334 CALL_CompressedTexSubImage3D(ctx->Exec,
5335 (target, level, xoffset, yoffset,
5336 zoffset, width, height, depth, format,
5337 imageSize, data));
5338 }
5339 }
5340
5341
5342 /* GL_ARB_multisample */
5343 static void GLAPIENTRY
5344 save_SampleCoverageARB(GLclampf value, GLboolean invert)
5345 {
5346 GET_CURRENT_CONTEXT(ctx);
5347 Node *n;
5348 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5349 n = alloc_instruction(ctx, OPCODE_SAMPLE_COVERAGE, 2);
5350 if (n) {
5351 n[1].f = value;
5352 n[2].b = invert;
5353 }
5354 if (ctx->ExecuteFlag) {
5355 CALL_SampleCoverage(ctx->Exec, (value, invert));
5356 }
5357 }
5358
5359
5360 /*
5361 * GL_ARB_vertex_program
5362 */
5363 static void GLAPIENTRY
5364 save_BindProgramARB(GLenum target, GLuint id)
5365 {
5366 GET_CURRENT_CONTEXT(ctx);
5367 Node *n;
5368 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5369 n = alloc_instruction(ctx, OPCODE_BIND_PROGRAM_ARB, 2);
5370 if (n) {
5371 n[1].e = target;
5372 n[2].ui = id;
5373 }
5374 if (ctx->ExecuteFlag) {
5375 CALL_BindProgramARB(ctx->Exec, (target, id));
5376 }
5377 }
5378
5379 static void GLAPIENTRY
5380 save_ProgramEnvParameter4fARB(GLenum target, GLuint index,
5381 GLfloat x, GLfloat y, GLfloat z, GLfloat w)
5382 {
5383 GET_CURRENT_CONTEXT(ctx);
5384 Node *n;
5385 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5386 n = alloc_instruction(ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6);
5387 if (n) {
5388 n[1].e = target;
5389 n[2].ui = index;
5390 n[3].f = x;
5391 n[4].f = y;
5392 n[5].f = z;
5393 n[6].f = w;
5394 }
5395 if (ctx->ExecuteFlag) {
5396 CALL_ProgramEnvParameter4fARB(ctx->Exec, (target, index, x, y, z, w));
5397 }
5398 }
5399
5400
5401 static void GLAPIENTRY
5402 save_ProgramEnvParameter4fvARB(GLenum target, GLuint index,
5403 const GLfloat *params)
5404 {
5405 save_ProgramEnvParameter4fARB(target, index, params[0], params[1],
5406 params[2], params[3]);
5407 }
5408
5409
5410 static void GLAPIENTRY
5411 save_ProgramEnvParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
5412 const GLfloat * params)
5413 {
5414 GET_CURRENT_CONTEXT(ctx);
5415 Node *n;
5416 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5417
5418 if (count > 0) {
5419 GLint i;
5420 const GLfloat * p = params;
5421
5422 for (i = 0 ; i < count ; i++) {
5423 n = alloc_instruction(ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6);
5424 if (n) {
5425 n[1].e = target;
5426 n[2].ui = index;
5427 n[3].f = p[0];
5428 n[4].f = p[1];
5429 n[5].f = p[2];
5430 n[6].f = p[3];
5431 p += 4;
5432 }
5433 }
5434 }
5435
5436 if (ctx->ExecuteFlag) {
5437 CALL_ProgramEnvParameters4fvEXT(ctx->Exec, (target, index, count, params));
5438 }
5439 }
5440
5441
5442 static void GLAPIENTRY
5443 save_ProgramEnvParameter4dARB(GLenum target, GLuint index,
5444 GLdouble x, GLdouble y, GLdouble z, GLdouble w)
5445 {
5446 save_ProgramEnvParameter4fARB(target, index,
5447 (GLfloat) x,
5448 (GLfloat) y, (GLfloat) z, (GLfloat) w);
5449 }
5450
5451
5452 static void GLAPIENTRY
5453 save_ProgramEnvParameter4dvARB(GLenum target, GLuint index,
5454 const GLdouble *params)
5455 {
5456 save_ProgramEnvParameter4fARB(target, index,
5457 (GLfloat) params[0],
5458 (GLfloat) params[1],
5459 (GLfloat) params[2], (GLfloat) params[3]);
5460 }
5461
5462
5463 static void GLAPIENTRY
5464 save_ProgramLocalParameter4fARB(GLenum target, GLuint index,
5465 GLfloat x, GLfloat y, GLfloat z, GLfloat w)
5466 {
5467 GET_CURRENT_CONTEXT(ctx);
5468 Node *n;
5469 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5470 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5471 if (n) {
5472 n[1].e = target;
5473 n[2].ui = index;
5474 n[3].f = x;
5475 n[4].f = y;
5476 n[5].f = z;
5477 n[6].f = w;
5478 }
5479 if (ctx->ExecuteFlag) {
5480 CALL_ProgramLocalParameter4fARB(ctx->Exec, (target, index, x, y, z, w));
5481 }
5482 }
5483
5484
5485 static void GLAPIENTRY
5486 save_ProgramLocalParameter4fvARB(GLenum target, GLuint index,
5487 const GLfloat *params)
5488 {
5489 GET_CURRENT_CONTEXT(ctx);
5490 Node *n;
5491 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5492 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5493 if (n) {
5494 n[1].e = target;
5495 n[2].ui = index;
5496 n[3].f = params[0];
5497 n[4].f = params[1];
5498 n[5].f = params[2];
5499 n[6].f = params[3];
5500 }
5501 if (ctx->ExecuteFlag) {
5502 CALL_ProgramLocalParameter4fvARB(ctx->Exec, (target, index, params));
5503 }
5504 }
5505
5506
5507 static void GLAPIENTRY
5508 save_ProgramLocalParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
5509 const GLfloat *params)
5510 {
5511 GET_CURRENT_CONTEXT(ctx);
5512 Node *n;
5513 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5514
5515 if (count > 0) {
5516 GLint i;
5517 const GLfloat * p = params;
5518
5519 for (i = 0 ; i < count ; i++) {
5520 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5521 if (n) {
5522 n[1].e = target;
5523 n[2].ui = index;
5524 n[3].f = p[0];
5525 n[4].f = p[1];
5526 n[5].f = p[2];
5527 n[6].f = p[3];
5528 p += 4;
5529 }
5530 }
5531 }
5532
5533 if (ctx->ExecuteFlag) {
5534 CALL_ProgramLocalParameters4fvEXT(ctx->Exec, (target, index, count, params));
5535 }
5536 }
5537
5538
5539 static void GLAPIENTRY
5540 save_ProgramLocalParameter4dARB(GLenum target, GLuint index,
5541 GLdouble x, GLdouble y,
5542 GLdouble z, GLdouble w)
5543 {
5544 GET_CURRENT_CONTEXT(ctx);
5545 Node *n;
5546 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5547 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5548 if (n) {
5549 n[1].e = target;
5550 n[2].ui = index;
5551 n[3].f = (GLfloat) x;
5552 n[4].f = (GLfloat) y;
5553 n[5].f = (GLfloat) z;
5554 n[6].f = (GLfloat) w;
5555 }
5556 if (ctx->ExecuteFlag) {
5557 CALL_ProgramLocalParameter4dARB(ctx->Exec, (target, index, x, y, z, w));
5558 }
5559 }
5560
5561
5562 static void GLAPIENTRY
5563 save_ProgramLocalParameter4dvARB(GLenum target, GLuint index,
5564 const GLdouble *params)
5565 {
5566 GET_CURRENT_CONTEXT(ctx);
5567 Node *n;
5568 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5569 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5570 if (n) {
5571 n[1].e = target;
5572 n[2].ui = index;
5573 n[3].f = (GLfloat) params[0];
5574 n[4].f = (GLfloat) params[1];
5575 n[5].f = (GLfloat) params[2];
5576 n[6].f = (GLfloat) params[3];
5577 }
5578 if (ctx->ExecuteFlag) {
5579 CALL_ProgramLocalParameter4dvARB(ctx->Exec, (target, index, params));
5580 }
5581 }
5582
5583
5584 /* GL_EXT_stencil_two_side */
5585 static void GLAPIENTRY
5586 save_ActiveStencilFaceEXT(GLenum face)
5587 {
5588 GET_CURRENT_CONTEXT(ctx);
5589 Node *n;
5590 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5591 n = alloc_instruction(ctx, OPCODE_ACTIVE_STENCIL_FACE_EXT, 1);
5592 if (n) {
5593 n[1].e = face;
5594 }
5595 if (ctx->ExecuteFlag) {
5596 CALL_ActiveStencilFaceEXT(ctx->Exec, (face));
5597 }
5598 }
5599
5600
5601 /* GL_EXT_depth_bounds_test */
5602 static void GLAPIENTRY
5603 save_DepthBoundsEXT(GLclampd zmin, GLclampd zmax)
5604 {
5605 GET_CURRENT_CONTEXT(ctx);
5606 Node *n;
5607 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5608 n = alloc_instruction(ctx, OPCODE_DEPTH_BOUNDS_EXT, 2);
5609 if (n) {
5610 n[1].f = (GLfloat) zmin;
5611 n[2].f = (GLfloat) zmax;
5612 }
5613 if (ctx->ExecuteFlag) {
5614 CALL_DepthBoundsEXT(ctx->Exec, (zmin, zmax));
5615 }
5616 }
5617
5618
5619
5620 static void GLAPIENTRY
5621 save_ProgramStringARB(GLenum target, GLenum format, GLsizei len,
5622 const GLvoid * string)
5623 {
5624 GET_CURRENT_CONTEXT(ctx);
5625 Node *n;
5626
5627 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5628
5629 n = alloc_instruction(ctx, OPCODE_PROGRAM_STRING_ARB, 3 + POINTER_DWORDS);
5630 if (n) {
5631 GLubyte *programCopy = malloc(len);
5632 if (!programCopy) {
5633 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramStringARB");
5634 return;
5635 }
5636 memcpy(programCopy, string, len);
5637 n[1].e = target;
5638 n[2].e = format;
5639 n[3].i = len;
5640 save_pointer(&n[4], programCopy);
5641 }
5642 if (ctx->ExecuteFlag) {
5643 CALL_ProgramStringARB(ctx->Exec, (target, format, len, string));
5644 }
5645 }
5646
5647
5648 static void GLAPIENTRY
5649 save_BeginQueryARB(GLenum target, GLuint id)
5650 {
5651 GET_CURRENT_CONTEXT(ctx);
5652 Node *n;
5653 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5654 n = alloc_instruction(ctx, OPCODE_BEGIN_QUERY_ARB, 2);
5655 if (n) {
5656 n[1].e = target;
5657 n[2].ui = id;
5658 }
5659 if (ctx->ExecuteFlag) {
5660 CALL_BeginQuery(ctx->Exec, (target, id));
5661 }
5662 }
5663
5664 static void GLAPIENTRY
5665 save_EndQueryARB(GLenum target)
5666 {
5667 GET_CURRENT_CONTEXT(ctx);
5668 Node *n;
5669 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5670 n = alloc_instruction(ctx, OPCODE_END_QUERY_ARB, 1);
5671 if (n) {
5672 n[1].e = target;
5673 }
5674 if (ctx->ExecuteFlag) {
5675 CALL_EndQuery(ctx->Exec, (target));
5676 }
5677 }
5678
5679 static void GLAPIENTRY
5680 save_QueryCounter(GLuint id, GLenum target)
5681 {
5682 GET_CURRENT_CONTEXT(ctx);
5683 Node *n;
5684 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5685 n = alloc_instruction(ctx, OPCODE_QUERY_COUNTER, 2);
5686 if (n) {
5687 n[1].ui = id;
5688 n[2].e = target;
5689 }
5690 if (ctx->ExecuteFlag) {
5691 CALL_QueryCounter(ctx->Exec, (id, target));
5692 }
5693 }
5694
5695 static void GLAPIENTRY
5696 save_BeginQueryIndexed(GLenum target, GLuint index, GLuint id)
5697 {
5698 GET_CURRENT_CONTEXT(ctx);
5699 Node *n;
5700 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5701 n = alloc_instruction(ctx, OPCODE_BEGIN_QUERY_INDEXED, 3);
5702 if (n) {
5703 n[1].e = target;
5704 n[2].ui = index;
5705 n[3].ui = id;
5706 }
5707 if (ctx->ExecuteFlag) {
5708 CALL_BeginQueryIndexed(ctx->Exec, (target, index, id));
5709 }
5710 }
5711
5712 static void GLAPIENTRY
5713 save_EndQueryIndexed(GLenum target, GLuint index)
5714 {
5715 GET_CURRENT_CONTEXT(ctx);
5716 Node *n;
5717 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5718 n = alloc_instruction(ctx, OPCODE_END_QUERY_INDEXED, 2);
5719 if (n) {
5720 n[1].e = target;
5721 n[2].ui = index;
5722 }
5723 if (ctx->ExecuteFlag) {
5724 CALL_EndQueryIndexed(ctx->Exec, (target, index));
5725 }
5726 }
5727
5728
5729 static void GLAPIENTRY
5730 save_DrawBuffersARB(GLsizei count, const GLenum * buffers)
5731 {
5732 GET_CURRENT_CONTEXT(ctx);
5733 Node *n;
5734 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5735 n = alloc_instruction(ctx, OPCODE_DRAW_BUFFERS_ARB, 1 + MAX_DRAW_BUFFERS);
5736 if (n) {
5737 GLint i;
5738 n[1].i = count;
5739 if (count > MAX_DRAW_BUFFERS)
5740 count = MAX_DRAW_BUFFERS;
5741 for (i = 0; i < count; i++) {
5742 n[2 + i].e = buffers[i];
5743 }
5744 }
5745 if (ctx->ExecuteFlag) {
5746 CALL_DrawBuffers(ctx->Exec, (count, buffers));
5747 }
5748 }
5749
5750 static void GLAPIENTRY
5751 save_BindFragmentShaderATI(GLuint id)
5752 {
5753 GET_CURRENT_CONTEXT(ctx);
5754 Node *n;
5755
5756 n = alloc_instruction(ctx, OPCODE_BIND_FRAGMENT_SHADER_ATI, 1);
5757 if (n) {
5758 n[1].ui = id;
5759 }
5760 if (ctx->ExecuteFlag) {
5761 CALL_BindFragmentShaderATI(ctx->Exec, (id));
5762 }
5763 }
5764
5765 static void GLAPIENTRY
5766 save_SetFragmentShaderConstantATI(GLuint dst, const GLfloat *value)
5767 {
5768 GET_CURRENT_CONTEXT(ctx);
5769 Node *n;
5770
5771 n = alloc_instruction(ctx, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI, 5);
5772 if (n) {
5773 n[1].ui = dst;
5774 n[2].f = value[0];
5775 n[3].f = value[1];
5776 n[4].f = value[2];
5777 n[5].f = value[3];
5778 }
5779 if (ctx->ExecuteFlag) {
5780 CALL_SetFragmentShaderConstantATI(ctx->Exec, (dst, value));
5781 }
5782 }
5783
5784 static void GLAPIENTRY
5785 save_Attr1fNV(GLenum attr, GLfloat x)
5786 {
5787 GET_CURRENT_CONTEXT(ctx);
5788 Node *n;
5789 SAVE_FLUSH_VERTICES(ctx);
5790 n = alloc_instruction(ctx, OPCODE_ATTR_1F_NV, 2);
5791 if (n) {
5792 n[1].e = attr;
5793 n[2].f = x;
5794 }
5795
5796 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5797 ctx->ListState.ActiveAttribSize[attr] = 1;
5798 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, 0, 0, 1);
5799
5800 if (ctx->ExecuteFlag) {
5801 CALL_VertexAttrib1fNV(ctx->Exec, (attr, x));
5802 }
5803 }
5804
5805 static void GLAPIENTRY
5806 save_Attr2fNV(GLenum attr, GLfloat x, GLfloat y)
5807 {
5808 GET_CURRENT_CONTEXT(ctx);
5809 Node *n;
5810 SAVE_FLUSH_VERTICES(ctx);
5811 n = alloc_instruction(ctx, OPCODE_ATTR_2F_NV, 3);
5812 if (n) {
5813 n[1].e = attr;
5814 n[2].f = x;
5815 n[3].f = y;
5816 }
5817
5818 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5819 ctx->ListState.ActiveAttribSize[attr] = 2;
5820 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, 0, 1);
5821
5822 if (ctx->ExecuteFlag) {
5823 CALL_VertexAttrib2fNV(ctx->Exec, (attr, x, y));
5824 }
5825 }
5826
5827 static void GLAPIENTRY
5828 save_Attr3fNV(GLenum attr, GLfloat x, GLfloat y, GLfloat z)
5829 {
5830 GET_CURRENT_CONTEXT(ctx);
5831 Node *n;
5832 SAVE_FLUSH_VERTICES(ctx);
5833 n = alloc_instruction(ctx, OPCODE_ATTR_3F_NV, 4);
5834 if (n) {
5835 n[1].e = attr;
5836 n[2].f = x;
5837 n[3].f = y;
5838 n[4].f = z;
5839 }
5840
5841 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5842 ctx->ListState.ActiveAttribSize[attr] = 3;
5843 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, 1);
5844
5845 if (ctx->ExecuteFlag) {
5846 CALL_VertexAttrib3fNV(ctx->Exec, (attr, x, y, z));
5847 }
5848 }
5849
5850 static void GLAPIENTRY
5851 save_Attr4fNV(GLenum attr, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
5852 {
5853 GET_CURRENT_CONTEXT(ctx);
5854 Node *n;
5855 SAVE_FLUSH_VERTICES(ctx);
5856 n = alloc_instruction(ctx, OPCODE_ATTR_4F_NV, 5);
5857 if (n) {
5858 n[1].e = attr;
5859 n[2].f = x;
5860 n[3].f = y;
5861 n[4].f = z;
5862 n[5].f = w;
5863 }
5864
5865 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5866 ctx->ListState.ActiveAttribSize[attr] = 4;
5867 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, w);
5868
5869 if (ctx->ExecuteFlag) {
5870 CALL_VertexAttrib4fNV(ctx->Exec, (attr, x, y, z, w));
5871 }
5872 }
5873
5874
5875 static void GLAPIENTRY
5876 save_Attr1fARB(GLenum attr, GLfloat x)
5877 {
5878 GET_CURRENT_CONTEXT(ctx);
5879 Node *n;
5880 SAVE_FLUSH_VERTICES(ctx);
5881 n = alloc_instruction(ctx, OPCODE_ATTR_1F_ARB, 2);
5882 if (n) {
5883 n[1].e = attr;
5884 n[2].f = x;
5885 }
5886
5887 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5888 ctx->ListState.ActiveAttribSize[attr] = 1;
5889 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, 0, 0, 1);
5890
5891 if (ctx->ExecuteFlag) {
5892 CALL_VertexAttrib1fARB(ctx->Exec, (attr, x));
5893 }
5894 }
5895
5896 static void GLAPIENTRY
5897 save_Attr2fARB(GLenum attr, GLfloat x, GLfloat y)
5898 {
5899 GET_CURRENT_CONTEXT(ctx);
5900 Node *n;
5901 SAVE_FLUSH_VERTICES(ctx);
5902 n = alloc_instruction(ctx, OPCODE_ATTR_2F_ARB, 3);
5903 if (n) {
5904 n[1].e = attr;
5905 n[2].f = x;
5906 n[3].f = y;
5907 }
5908
5909 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5910 ctx->ListState.ActiveAttribSize[attr] = 2;
5911 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, 0, 1);
5912
5913 if (ctx->ExecuteFlag) {
5914 CALL_VertexAttrib2fARB(ctx->Exec, (attr, x, y));
5915 }
5916 }
5917
5918 static void GLAPIENTRY
5919 save_Attr3fARB(GLenum attr, GLfloat x, GLfloat y, GLfloat z)
5920 {
5921 GET_CURRENT_CONTEXT(ctx);
5922 Node *n;
5923 SAVE_FLUSH_VERTICES(ctx);
5924 n = alloc_instruction(ctx, OPCODE_ATTR_3F_ARB, 4);
5925 if (n) {
5926 n[1].e = attr;
5927 n[2].f = x;
5928 n[3].f = y;
5929 n[4].f = z;
5930 }
5931
5932 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5933 ctx->ListState.ActiveAttribSize[attr] = 3;
5934 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, 1);
5935
5936 if (ctx->ExecuteFlag) {
5937 CALL_VertexAttrib3fARB(ctx->Exec, (attr, x, y, z));
5938 }
5939 }
5940
5941 static void GLAPIENTRY
5942 save_Attr4fARB(GLenum attr, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
5943 {
5944 GET_CURRENT_CONTEXT(ctx);
5945 Node *n;
5946 SAVE_FLUSH_VERTICES(ctx);
5947 n = alloc_instruction(ctx, OPCODE_ATTR_4F_ARB, 5);
5948 if (n) {
5949 n[1].e = attr;
5950 n[2].f = x;
5951 n[3].f = y;
5952 n[4].f = z;
5953 n[5].f = w;
5954 }
5955
5956 assert(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5957 ctx->ListState.ActiveAttribSize[attr] = 4;
5958 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, w);
5959
5960 if (ctx->ExecuteFlag) {
5961 CALL_VertexAttrib4fARB(ctx->Exec, (attr, x, y, z, w));
5962 }
5963 }
5964
5965
5966 static void GLAPIENTRY
5967 save_EvalCoord1f(GLfloat x)
5968 {
5969 GET_CURRENT_CONTEXT(ctx);
5970 Node *n;
5971 SAVE_FLUSH_VERTICES(ctx);
5972 n = alloc_instruction(ctx, OPCODE_EVAL_C1, 1);
5973 if (n) {
5974 n[1].f = x;
5975 }
5976 if (ctx->ExecuteFlag) {
5977 CALL_EvalCoord1f(ctx->Exec, (x));
5978 }
5979 }
5980
5981 static void GLAPIENTRY
5982 save_EvalCoord1fv(const GLfloat * v)
5983 {
5984 save_EvalCoord1f(v[0]);
5985 }
5986
5987 static void GLAPIENTRY
5988 save_EvalCoord2f(GLfloat x, GLfloat y)
5989 {
5990 GET_CURRENT_CONTEXT(ctx);
5991 Node *n;
5992 SAVE_FLUSH_VERTICES(ctx);
5993 n = alloc_instruction(ctx, OPCODE_EVAL_C2, 2);
5994 if (n) {
5995 n[1].f = x;
5996 n[2].f = y;
5997 }
5998 if (ctx->ExecuteFlag) {
5999 CALL_EvalCoord2f(ctx->Exec, (x, y));
6000 }
6001 }
6002
6003 static void GLAPIENTRY
6004 save_EvalCoord2fv(const GLfloat * v)
6005 {
6006 save_EvalCoord2f(v[0], v[1]);
6007 }
6008
6009
6010 static void GLAPIENTRY
6011 save_EvalPoint1(GLint x)
6012 {
6013 GET_CURRENT_CONTEXT(ctx);
6014 Node *n;
6015 SAVE_FLUSH_VERTICES(ctx);
6016 n = alloc_instruction(ctx, OPCODE_EVAL_P1, 1);
6017 if (n) {
6018 n[1].i = x;
6019 }
6020 if (ctx->ExecuteFlag) {
6021 CALL_EvalPoint1(ctx->Exec, (x));
6022 }
6023 }
6024
6025 static void GLAPIENTRY
6026 save_EvalPoint2(GLint x, GLint y)
6027 {
6028 GET_CURRENT_CONTEXT(ctx);
6029 Node *n;
6030 SAVE_FLUSH_VERTICES(ctx);
6031 n = alloc_instruction(ctx, OPCODE_EVAL_P2, 2);
6032 if (n) {
6033 n[1].i = x;
6034 n[2].i = y;
6035 }
6036 if (ctx->ExecuteFlag) {
6037 CALL_EvalPoint2(ctx->Exec, (x, y));
6038 }
6039 }
6040
6041 static void GLAPIENTRY
6042 save_Indexf(GLfloat x)
6043 {
6044 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX, x);
6045 }
6046
6047 static void GLAPIENTRY
6048 save_Indexfv(const GLfloat * v)
6049 {
6050 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX, v[0]);
6051 }
6052
6053 static void GLAPIENTRY
6054 save_EdgeFlag(GLboolean x)
6055 {
6056 save_Attr1fNV(VERT_ATTRIB_EDGEFLAG, x ? 1.0f : 0.0f);
6057 }
6058
6059
6060 /**
6061 * Compare 'count' elements of vectors 'a' and 'b'.
6062 * \return GL_TRUE if equal, GL_FALSE if different.
6063 */
6064 static inline GLboolean
6065 compare_vec(const GLfloat *a, const GLfloat *b, GLuint count)
6066 {
6067 return memcmp( a, b, count * sizeof(GLfloat) ) == 0;
6068 }
6069
6070
6071 /**
6072 * This glMaterial function is used for glMaterial calls that are outside
6073 * a glBegin/End pair. For glMaterial inside glBegin/End, see the VBO code.
6074 */
6075 static void GLAPIENTRY
6076 save_Materialfv(GLenum face, GLenum pname, const GLfloat * param)
6077 {
6078 GET_CURRENT_CONTEXT(ctx);
6079 Node *n;
6080 int args, i;
6081 GLuint bitmask;
6082
6083 switch (face) {
6084 case GL_BACK:
6085 case GL_FRONT:
6086 case GL_FRONT_AND_BACK:
6087 break;
6088 default:
6089 _mesa_compile_error(ctx, GL_INVALID_ENUM, "glMaterial(face)");
6090 return;
6091 }
6092
6093 switch (pname) {
6094 case GL_EMISSION:
6095 case GL_AMBIENT:
6096 case GL_DIFFUSE:
6097 case GL_SPECULAR:
6098 case GL_AMBIENT_AND_DIFFUSE:
6099 args = 4;
6100 break;
6101 case GL_SHININESS:
6102 args = 1;
6103 break;
6104 case GL_COLOR_INDEXES:
6105 args = 3;
6106 break;
6107 default:
6108 _mesa_compile_error(ctx, GL_INVALID_ENUM, "glMaterial(pname)");
6109 return;
6110 }
6111
6112 if (ctx->ExecuteFlag) {
6113 CALL_Materialfv(ctx->Exec, (face, pname, param));
6114 }
6115
6116 bitmask = _mesa_material_bitmask(ctx, face, pname, ~0, NULL);
6117
6118 /* Try to eliminate redundant statechanges. Because it is legal to
6119 * call glMaterial even inside begin/end calls, don't need to worry
6120 * about ctx->Driver.CurrentSavePrimitive here.
6121 */
6122 for (i = 0; i < MAT_ATTRIB_MAX; i++) {
6123 if (bitmask & (1 << i)) {
6124 if (ctx->ListState.ActiveMaterialSize[i] == args &&
6125 compare_vec(ctx->ListState.CurrentMaterial[i], param, args)) {
6126 /* no change in material value */
6127 bitmask &= ~(1 << i);
6128 }
6129 else {
6130 ctx->ListState.ActiveMaterialSize[i] = args;
6131 COPY_SZ_4V(ctx->ListState.CurrentMaterial[i], args, param);
6132 }
6133 }
6134 }
6135
6136 /* If this call has no effect, return early */
6137 if (bitmask == 0)
6138 return;
6139
6140 SAVE_FLUSH_VERTICES(ctx);
6141
6142 n = alloc_instruction(ctx, OPCODE_MATERIAL, 6);
6143 if (n) {
6144 n[1].e = face;
6145 n[2].e = pname;
6146 for (i = 0; i < args; i++)
6147 n[3 + i].f = param[i];
6148 }
6149 }
6150
6151 static void GLAPIENTRY
6152 save_Begin(GLenum mode)
6153 {
6154 GET_CURRENT_CONTEXT(ctx);
6155
6156 if (!_mesa_is_valid_prim_mode(ctx, mode)) {
6157 /* compile this error into the display list */
6158 _mesa_compile_error(ctx, GL_INVALID_ENUM, "glBegin(mode)");
6159 }
6160 else if (_mesa_inside_dlist_begin_end(ctx)) {
6161 /* compile this error into the display list */
6162 _mesa_compile_error(ctx, GL_INVALID_OPERATION, "recursive glBegin");
6163 }
6164 else {
6165 ctx->Driver.CurrentSavePrimitive = mode;
6166
6167 vbo_save_NotifyBegin(ctx, mode, false);
6168 }
6169 }
6170
6171 static void GLAPIENTRY
6172 save_End(void)
6173 {
6174 GET_CURRENT_CONTEXT(ctx);
6175 SAVE_FLUSH_VERTICES(ctx);
6176 (void) alloc_instruction(ctx, OPCODE_END, 0);
6177 ctx->Driver.CurrentSavePrimitive = PRIM_OUTSIDE_BEGIN_END;
6178 if (ctx->ExecuteFlag) {
6179 CALL_End(ctx->Exec, ());
6180 }
6181 }
6182
6183 static void GLAPIENTRY
6184 save_Rectf(GLfloat a, GLfloat b, GLfloat c, GLfloat d)
6185 {
6186 GET_CURRENT_CONTEXT(ctx);
6187 Node *n;
6188 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6189 n = alloc_instruction(ctx, OPCODE_RECTF, 4);
6190 if (n) {
6191 n[1].f = a;
6192 n[2].f = b;
6193 n[3].f = c;
6194 n[4].f = d;
6195 }
6196 if (ctx->ExecuteFlag) {
6197 CALL_Rectf(ctx->Exec, (a, b, c, d));
6198 }
6199 }
6200
6201
6202 static void GLAPIENTRY
6203 save_Vertex2f(GLfloat x, GLfloat y)
6204 {
6205 save_Attr2fNV(VERT_ATTRIB_POS, x, y);
6206 }
6207
6208 static void GLAPIENTRY
6209 save_Vertex2fv(const GLfloat * v)
6210 {
6211 save_Attr2fNV(VERT_ATTRIB_POS, v[0], v[1]);
6212 }
6213
6214 static void GLAPIENTRY
6215 save_Vertex3f(GLfloat x, GLfloat y, GLfloat z)
6216 {
6217 save_Attr3fNV(VERT_ATTRIB_POS, x, y, z);
6218 }
6219
6220 static void GLAPIENTRY
6221 save_Vertex3fv(const GLfloat * v)
6222 {
6223 save_Attr3fNV(VERT_ATTRIB_POS, v[0], v[1], v[2]);
6224 }
6225
6226 static void GLAPIENTRY
6227 save_Vertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
6228 {
6229 save_Attr4fNV(VERT_ATTRIB_POS, x, y, z, w);
6230 }
6231
6232 static void GLAPIENTRY
6233 save_Vertex4fv(const GLfloat * v)
6234 {
6235 save_Attr4fNV(VERT_ATTRIB_POS, v[0], v[1], v[2], v[3]);
6236 }
6237
6238 static void GLAPIENTRY
6239 save_TexCoord1f(GLfloat x)
6240 {
6241 save_Attr1fNV(VERT_ATTRIB_TEX0, x);
6242 }
6243
6244 static void GLAPIENTRY
6245 save_TexCoord1fv(const GLfloat * v)
6246 {
6247 save_Attr1fNV(VERT_ATTRIB_TEX0, v[0]);
6248 }
6249
6250 static void GLAPIENTRY
6251 save_TexCoord2f(GLfloat x, GLfloat y)
6252 {
6253 save_Attr2fNV(VERT_ATTRIB_TEX0, x, y);
6254 }
6255
6256 static void GLAPIENTRY
6257 save_TexCoord2fv(const GLfloat * v)
6258 {
6259 save_Attr2fNV(VERT_ATTRIB_TEX0, v[0], v[1]);
6260 }
6261
6262 static void GLAPIENTRY
6263 save_TexCoord3f(GLfloat x, GLfloat y, GLfloat z)
6264 {
6265 save_Attr3fNV(VERT_ATTRIB_TEX0, x, y, z);
6266 }
6267
6268 static void GLAPIENTRY
6269 save_TexCoord3fv(const GLfloat * v)
6270 {
6271 save_Attr3fNV(VERT_ATTRIB_TEX0, v[0], v[1], v[2]);
6272 }
6273
6274 static void GLAPIENTRY
6275 save_TexCoord4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
6276 {
6277 save_Attr4fNV(VERT_ATTRIB_TEX0, x, y, z, w);
6278 }
6279
6280 static void GLAPIENTRY
6281 save_TexCoord4fv(const GLfloat * v)
6282 {
6283 save_Attr4fNV(VERT_ATTRIB_TEX0, v[0], v[1], v[2], v[3]);
6284 }
6285
6286 static void GLAPIENTRY
6287 save_Normal3f(GLfloat x, GLfloat y, GLfloat z)
6288 {
6289 save_Attr3fNV(VERT_ATTRIB_NORMAL, x, y, z);
6290 }
6291
6292 static void GLAPIENTRY
6293 save_Normal3fv(const GLfloat * v)
6294 {
6295 save_Attr3fNV(VERT_ATTRIB_NORMAL, v[0], v[1], v[2]);
6296 }
6297
6298 static void GLAPIENTRY
6299 save_FogCoordfEXT(GLfloat x)
6300 {
6301 save_Attr1fNV(VERT_ATTRIB_FOG, x);
6302 }
6303
6304 static void GLAPIENTRY
6305 save_FogCoordfvEXT(const GLfloat * v)
6306 {
6307 save_Attr1fNV(VERT_ATTRIB_FOG, v[0]);
6308 }
6309
6310 static void GLAPIENTRY
6311 save_Color3f(GLfloat x, GLfloat y, GLfloat z)
6312 {
6313 save_Attr3fNV(VERT_ATTRIB_COLOR0, x, y, z);
6314 }
6315
6316 static void GLAPIENTRY
6317 save_Color3fv(const GLfloat * v)
6318 {
6319 save_Attr3fNV(VERT_ATTRIB_COLOR0, v[0], v[1], v[2]);
6320 }
6321
6322 static void GLAPIENTRY
6323 save_Color4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
6324 {
6325 save_Attr4fNV(VERT_ATTRIB_COLOR0, x, y, z, w);
6326 }
6327
6328 static void GLAPIENTRY
6329 save_Color4fv(const GLfloat * v)
6330 {
6331 save_Attr4fNV(VERT_ATTRIB_COLOR0, v[0], v[1], v[2], v[3]);
6332 }
6333
6334 static void GLAPIENTRY
6335 save_SecondaryColor3fEXT(GLfloat x, GLfloat y, GLfloat z)
6336 {
6337 save_Attr3fNV(VERT_ATTRIB_COLOR1, x, y, z);
6338 }
6339
6340 static void GLAPIENTRY
6341 save_SecondaryColor3fvEXT(const GLfloat * v)
6342 {
6343 save_Attr3fNV(VERT_ATTRIB_COLOR1, v[0], v[1], v[2]);
6344 }
6345
6346
6347 /* Just call the respective ATTR for texcoord
6348 */
6349 static void GLAPIENTRY
6350 save_MultiTexCoord1f(GLenum target, GLfloat x)
6351 {
6352 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6353 save_Attr1fNV(attr, x);
6354 }
6355
6356 static void GLAPIENTRY
6357 save_MultiTexCoord1fv(GLenum target, const GLfloat * v)
6358 {
6359 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6360 save_Attr1fNV(attr, v[0]);
6361 }
6362
6363 static void GLAPIENTRY
6364 save_MultiTexCoord2f(GLenum target, GLfloat x, GLfloat y)
6365 {
6366 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6367 save_Attr2fNV(attr, x, y);
6368 }
6369
6370 static void GLAPIENTRY
6371 save_MultiTexCoord2fv(GLenum target, const GLfloat * v)
6372 {
6373 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6374 save_Attr2fNV(attr, v[0], v[1]);
6375 }
6376
6377 static void GLAPIENTRY
6378 save_MultiTexCoord3f(GLenum target, GLfloat x, GLfloat y, GLfloat z)
6379 {
6380 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6381 save_Attr3fNV(attr, x, y, z);
6382 }
6383
6384 static void GLAPIENTRY
6385 save_MultiTexCoord3fv(GLenum target, const GLfloat * v)
6386 {
6387 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6388 save_Attr3fNV(attr, v[0], v[1], v[2]);
6389 }
6390
6391 static void GLAPIENTRY
6392 save_MultiTexCoord4f(GLenum target, GLfloat x, GLfloat y,
6393 GLfloat z, GLfloat w)
6394 {
6395 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6396 save_Attr4fNV(attr, x, y, z, w);
6397 }
6398
6399 static void GLAPIENTRY
6400 save_MultiTexCoord4fv(GLenum target, const GLfloat * v)
6401 {
6402 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6403 save_Attr4fNV(attr, v[0], v[1], v[2], v[3]);
6404 }
6405
6406
6407 /**
6408 * Record a GL_INVALID_VALUE error when an invalid vertex attribute
6409 * index is found.
6410 */
6411 static void
6412 index_error(void)
6413 {
6414 GET_CURRENT_CONTEXT(ctx);
6415 _mesa_error(ctx, GL_INVALID_VALUE, "VertexAttribf(index)");
6416 }
6417
6418
6419
6420 static void GLAPIENTRY
6421 save_VertexAttrib1fARB(GLuint index, GLfloat x)
6422 {
6423 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6424 save_Attr1fARB(index, x);
6425 else
6426 index_error();
6427 }
6428
6429 static void GLAPIENTRY
6430 save_VertexAttrib1fvARB(GLuint index, const GLfloat * v)
6431 {
6432 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6433 save_Attr1fARB(index, v[0]);
6434 else
6435 index_error();
6436 }
6437
6438 static void GLAPIENTRY
6439 save_VertexAttrib2fARB(GLuint index, GLfloat x, GLfloat y)
6440 {
6441 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6442 save_Attr2fARB(index, x, y);
6443 else
6444 index_error();
6445 }
6446
6447 static void GLAPIENTRY
6448 save_VertexAttrib2fvARB(GLuint index, const GLfloat * v)
6449 {
6450 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6451 save_Attr2fARB(index, v[0], v[1]);
6452 else
6453 index_error();
6454 }
6455
6456 static void GLAPIENTRY
6457 save_VertexAttrib3fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z)
6458 {
6459 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6460 save_Attr3fARB(index, x, y, z);
6461 else
6462 index_error();
6463 }
6464
6465 static void GLAPIENTRY
6466 save_VertexAttrib3fvARB(GLuint index, const GLfloat * v)
6467 {
6468 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6469 save_Attr3fARB(index, v[0], v[1], v[2]);
6470 else
6471 index_error();
6472 }
6473
6474 static void GLAPIENTRY
6475 save_VertexAttrib4fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z,
6476 GLfloat w)
6477 {
6478 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6479 save_Attr4fARB(index, x, y, z, w);
6480 else
6481 index_error();
6482 }
6483
6484 static void GLAPIENTRY
6485 save_VertexAttrib4fvARB(GLuint index, const GLfloat * v)
6486 {
6487 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6488 save_Attr4fARB(index, v[0], v[1], v[2], v[3]);
6489 else
6490 index_error();
6491 }
6492
6493 static void GLAPIENTRY
6494 save_VertexAttribL1d(GLuint index, GLdouble x)
6495 {
6496 GET_CURRENT_CONTEXT(ctx);
6497
6498 if (index < MAX_VERTEX_GENERIC_ATTRIBS) {
6499 Node *n;
6500 SAVE_FLUSH_VERTICES(ctx);
6501 n = alloc_instruction(ctx, OPCODE_ATTR_1D, 3);
6502 if (n) {
6503 n[1].ui = index;
6504 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
6505 }
6506
6507 ctx->ListState.ActiveAttribSize[index] = 1;
6508 memcpy(ctx->ListState.CurrentAttrib[index], &n[2], sizeof(GLdouble));
6509
6510 if (ctx->ExecuteFlag) {
6511 CALL_VertexAttribL1d(ctx->Exec, (index, x));
6512 }
6513 } else {
6514 index_error();
6515 }
6516 }
6517
6518 static void GLAPIENTRY
6519 save_VertexAttribL1dv(GLuint index, const GLdouble *v)
6520 {
6521 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6522 save_VertexAttribL1d(index, v[0]);
6523 else
6524 index_error();
6525 }
6526
6527 static void GLAPIENTRY
6528 save_VertexAttribL2d(GLuint index, GLdouble x, GLdouble y)
6529 {
6530 GET_CURRENT_CONTEXT(ctx);
6531
6532 if (index < MAX_VERTEX_GENERIC_ATTRIBS) {
6533 Node *n;
6534 SAVE_FLUSH_VERTICES(ctx);
6535 n = alloc_instruction(ctx, OPCODE_ATTR_2D, 5);
6536 if (n) {
6537 n[1].ui = index;
6538 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
6539 ASSIGN_DOUBLE_TO_NODES(n, 4, y);
6540 }
6541
6542 ctx->ListState.ActiveAttribSize[index] = 2;
6543 memcpy(ctx->ListState.CurrentAttrib[index], &n[2],
6544 2 * sizeof(GLdouble));
6545
6546 if (ctx->ExecuteFlag) {
6547 CALL_VertexAttribL2d(ctx->Exec, (index, x, y));
6548 }
6549 } else {
6550 index_error();
6551 }
6552 }
6553
6554 static void GLAPIENTRY
6555 save_VertexAttribL2dv(GLuint index, const GLdouble *v)
6556 {
6557 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6558 save_VertexAttribL2d(index, v[0], v[1]);
6559 else
6560 index_error();
6561 }
6562
6563 static void GLAPIENTRY
6564 save_VertexAttribL3d(GLuint index, GLdouble x, GLdouble y, GLdouble z)
6565 {
6566 GET_CURRENT_CONTEXT(ctx);
6567
6568 if (index < MAX_VERTEX_GENERIC_ATTRIBS) {
6569 Node *n;
6570 SAVE_FLUSH_VERTICES(ctx);
6571 n = alloc_instruction(ctx, OPCODE_ATTR_3D, 7);
6572 if (n) {
6573 n[1].ui = index;
6574 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
6575 ASSIGN_DOUBLE_TO_NODES(n, 4, y);
6576 ASSIGN_DOUBLE_TO_NODES(n, 6, z);
6577 }
6578
6579 ctx->ListState.ActiveAttribSize[index] = 3;
6580 memcpy(ctx->ListState.CurrentAttrib[index], &n[2],
6581 3 * sizeof(GLdouble));
6582
6583 if (ctx->ExecuteFlag) {
6584 CALL_VertexAttribL3d(ctx->Exec, (index, x, y, z));
6585 }
6586 } else {
6587 index_error();
6588 }
6589 }
6590
6591 static void GLAPIENTRY
6592 save_VertexAttribL3dv(GLuint index, const GLdouble *v)
6593 {
6594 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6595 save_VertexAttribL3d(index, v[0], v[1], v[2]);
6596 else
6597 index_error();
6598 }
6599
6600 static void GLAPIENTRY
6601 save_VertexAttribL4d(GLuint index, GLdouble x, GLdouble y, GLdouble z,
6602 GLdouble w)
6603 {
6604 GET_CURRENT_CONTEXT(ctx);
6605
6606 if (index < MAX_VERTEX_GENERIC_ATTRIBS) {
6607 Node *n;
6608 SAVE_FLUSH_VERTICES(ctx);
6609 n = alloc_instruction(ctx, OPCODE_ATTR_4D, 9);
6610 if (n) {
6611 n[1].ui = index;
6612 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
6613 ASSIGN_DOUBLE_TO_NODES(n, 4, y);
6614 ASSIGN_DOUBLE_TO_NODES(n, 6, z);
6615 ASSIGN_DOUBLE_TO_NODES(n, 8, w);
6616 }
6617
6618 ctx->ListState.ActiveAttribSize[index] = 4;
6619 memcpy(ctx->ListState.CurrentAttrib[index], &n[2],
6620 4 * sizeof(GLdouble));
6621
6622 if (ctx->ExecuteFlag) {
6623 CALL_VertexAttribL4d(ctx->Exec, (index, x, y, z, w));
6624 }
6625 } else {
6626 index_error();
6627 }
6628 }
6629
6630 static void GLAPIENTRY
6631 save_VertexAttribL4dv(GLuint index, const GLdouble *v)
6632 {
6633 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6634 save_VertexAttribL4d(index, v[0], v[1], v[2], v[3]);
6635 else
6636 index_error();
6637 }
6638
6639 static void GLAPIENTRY
6640 save_PrimitiveRestartNV(void)
6641 {
6642 /* Note: this is used when outside a glBegin/End pair in a display list */
6643 GET_CURRENT_CONTEXT(ctx);
6644 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6645 (void) alloc_instruction(ctx, OPCODE_PRIMITIVE_RESTART_NV, 0);
6646 if (ctx->ExecuteFlag) {
6647 CALL_PrimitiveRestartNV(ctx->Exec, ());
6648 }
6649 }
6650
6651
6652 static void GLAPIENTRY
6653 save_BlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
6654 GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
6655 GLbitfield mask, GLenum filter)
6656 {
6657 GET_CURRENT_CONTEXT(ctx);
6658 Node *n;
6659 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6660 n = alloc_instruction(ctx, OPCODE_BLIT_FRAMEBUFFER, 10);
6661 if (n) {
6662 n[1].i = srcX0;
6663 n[2].i = srcY0;
6664 n[3].i = srcX1;
6665 n[4].i = srcY1;
6666 n[5].i = dstX0;
6667 n[6].i = dstY0;
6668 n[7].i = dstX1;
6669 n[8].i = dstY1;
6670 n[9].i = mask;
6671 n[10].e = filter;
6672 }
6673 if (ctx->ExecuteFlag) {
6674 CALL_BlitFramebuffer(ctx->Exec, (srcX0, srcY0, srcX1, srcY1,
6675 dstX0, dstY0, dstX1, dstY1,
6676 mask, filter));
6677 }
6678 }
6679
6680
6681 /** GL_EXT_provoking_vertex */
6682 static void GLAPIENTRY
6683 save_ProvokingVertexEXT(GLenum mode)
6684 {
6685 GET_CURRENT_CONTEXT(ctx);
6686 Node *n;
6687 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6688 n = alloc_instruction(ctx, OPCODE_PROVOKING_VERTEX, 1);
6689 if (n) {
6690 n[1].e = mode;
6691 }
6692 if (ctx->ExecuteFlag) {
6693 /*CALL_ProvokingVertex(ctx->Exec, (mode));*/
6694 _mesa_ProvokingVertex(mode);
6695 }
6696 }
6697
6698
6699 /** GL_EXT_transform_feedback */
6700 static void GLAPIENTRY
6701 save_BeginTransformFeedback(GLenum mode)
6702 {
6703 GET_CURRENT_CONTEXT(ctx);
6704 Node *n;
6705 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6706 n = alloc_instruction(ctx, OPCODE_BEGIN_TRANSFORM_FEEDBACK, 1);
6707 if (n) {
6708 n[1].e = mode;
6709 }
6710 if (ctx->ExecuteFlag) {
6711 CALL_BeginTransformFeedback(ctx->Exec, (mode));
6712 }
6713 }
6714
6715
6716 /** GL_EXT_transform_feedback */
6717 static void GLAPIENTRY
6718 save_EndTransformFeedback(void)
6719 {
6720 GET_CURRENT_CONTEXT(ctx);
6721 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6722 (void) alloc_instruction(ctx, OPCODE_END_TRANSFORM_FEEDBACK, 0);
6723 if (ctx->ExecuteFlag) {
6724 CALL_EndTransformFeedback(ctx->Exec, ());
6725 }
6726 }
6727
6728 static void GLAPIENTRY
6729 save_BindTransformFeedback(GLenum target, GLuint name)
6730 {
6731 GET_CURRENT_CONTEXT(ctx);
6732 Node *n;
6733 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6734 n = alloc_instruction(ctx, OPCODE_BIND_TRANSFORM_FEEDBACK, 2);
6735 if (n) {
6736 n[1].e = target;
6737 n[2].ui = name;
6738 }
6739 if (ctx->ExecuteFlag) {
6740 CALL_BindTransformFeedback(ctx->Exec, (target, name));
6741 }
6742 }
6743
6744 static void GLAPIENTRY
6745 save_PauseTransformFeedback(void)
6746 {
6747 GET_CURRENT_CONTEXT(ctx);
6748 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6749 (void) alloc_instruction(ctx, OPCODE_PAUSE_TRANSFORM_FEEDBACK, 0);
6750 if (ctx->ExecuteFlag) {
6751 CALL_PauseTransformFeedback(ctx->Exec, ());
6752 }
6753 }
6754
6755 static void GLAPIENTRY
6756 save_ResumeTransformFeedback(void)
6757 {
6758 GET_CURRENT_CONTEXT(ctx);
6759 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6760 (void) alloc_instruction(ctx, OPCODE_RESUME_TRANSFORM_FEEDBACK, 0);
6761 if (ctx->ExecuteFlag) {
6762 CALL_ResumeTransformFeedback(ctx->Exec, ());
6763 }
6764 }
6765
6766 static void GLAPIENTRY
6767 save_DrawTransformFeedback(GLenum mode, GLuint name)
6768 {
6769 GET_CURRENT_CONTEXT(ctx);
6770 Node *n;
6771 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6772 n = alloc_instruction(ctx, OPCODE_DRAW_TRANSFORM_FEEDBACK, 2);
6773 if (n) {
6774 n[1].e = mode;
6775 n[2].ui = name;
6776 }
6777 if (ctx->ExecuteFlag) {
6778 CALL_DrawTransformFeedback(ctx->Exec, (mode, name));
6779 }
6780 }
6781
6782 static void GLAPIENTRY
6783 save_DrawTransformFeedbackStream(GLenum mode, GLuint name, GLuint stream)
6784 {
6785 GET_CURRENT_CONTEXT(ctx);
6786 Node *n;
6787 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6788 n = alloc_instruction(ctx, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM, 3);
6789 if (n) {
6790 n[1].e = mode;
6791 n[2].ui = name;
6792 n[3].ui = stream;
6793 }
6794 if (ctx->ExecuteFlag) {
6795 CALL_DrawTransformFeedbackStream(ctx->Exec, (mode, name, stream));
6796 }
6797 }
6798
6799 static void GLAPIENTRY
6800 save_DrawTransformFeedbackInstanced(GLenum mode, GLuint name,
6801 GLsizei primcount)
6802 {
6803 GET_CURRENT_CONTEXT(ctx);
6804 Node *n;
6805 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6806 n = alloc_instruction(ctx, OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED, 3);
6807 if (n) {
6808 n[1].e = mode;
6809 n[2].ui = name;
6810 n[3].si = primcount;
6811 }
6812 if (ctx->ExecuteFlag) {
6813 CALL_DrawTransformFeedbackInstanced(ctx->Exec, (mode, name, primcount));
6814 }
6815 }
6816
6817 static void GLAPIENTRY
6818 save_DrawTransformFeedbackStreamInstanced(GLenum mode, GLuint name,
6819 GLuint stream, GLsizei primcount)
6820 {
6821 GET_CURRENT_CONTEXT(ctx);
6822 Node *n;
6823 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6824 n = alloc_instruction(ctx, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED, 4);
6825 if (n) {
6826 n[1].e = mode;
6827 n[2].ui = name;
6828 n[3].ui = stream;
6829 n[4].si = primcount;
6830 }
6831 if (ctx->ExecuteFlag) {
6832 CALL_DrawTransformFeedbackStreamInstanced(ctx->Exec, (mode, name, stream,
6833 primcount));
6834 }
6835 }
6836
6837 static void GLAPIENTRY
6838 save_DispatchCompute(GLuint num_groups_x, GLuint num_groups_y,
6839 GLuint num_groups_z)
6840 {
6841 GET_CURRENT_CONTEXT(ctx);
6842 Node *n;
6843 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6844 n = alloc_instruction(ctx, OPCODE_DISPATCH_COMPUTE, 3);
6845 if (n) {
6846 n[1].ui = num_groups_x;
6847 n[2].ui = num_groups_y;
6848 n[3].ui = num_groups_z;
6849 }
6850 if (ctx->ExecuteFlag) {
6851 CALL_DispatchCompute(ctx->Exec, (num_groups_x, num_groups_y,
6852 num_groups_z));
6853 }
6854 }
6855
6856 static void GLAPIENTRY
6857 save_DispatchComputeIndirect(GLintptr indirect)
6858 {
6859 GET_CURRENT_CONTEXT(ctx);
6860 _mesa_error(ctx, GL_INVALID_OPERATION,
6861 "glDispatchComputeIndirect() during display list compile");
6862 }
6863
6864 static void GLAPIENTRY
6865 save_UseProgram(GLuint program)
6866 {
6867 GET_CURRENT_CONTEXT(ctx);
6868 Node *n;
6869 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6870 n = alloc_instruction(ctx, OPCODE_USE_PROGRAM, 1);
6871 if (n) {
6872 n[1].ui = program;
6873 }
6874 if (ctx->ExecuteFlag) {
6875 CALL_UseProgram(ctx->Exec, (program));
6876 }
6877 }
6878
6879
6880 static void GLAPIENTRY
6881 save_Uniform1fARB(GLint location, GLfloat x)
6882 {
6883 GET_CURRENT_CONTEXT(ctx);
6884 Node *n;
6885 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6886 n = alloc_instruction(ctx, OPCODE_UNIFORM_1F, 2);
6887 if (n) {
6888 n[1].i = location;
6889 n[2].f = x;
6890 }
6891 if (ctx->ExecuteFlag) {
6892 CALL_Uniform1f(ctx->Exec, (location, x));
6893 }
6894 }
6895
6896
6897 static void GLAPIENTRY
6898 save_Uniform2fARB(GLint location, GLfloat x, GLfloat y)
6899 {
6900 GET_CURRENT_CONTEXT(ctx);
6901 Node *n;
6902 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6903 n = alloc_instruction(ctx, OPCODE_UNIFORM_2F, 3);
6904 if (n) {
6905 n[1].i = location;
6906 n[2].f = x;
6907 n[3].f = y;
6908 }
6909 if (ctx->ExecuteFlag) {
6910 CALL_Uniform2f(ctx->Exec, (location, x, y));
6911 }
6912 }
6913
6914
6915 static void GLAPIENTRY
6916 save_Uniform3fARB(GLint location, GLfloat x, GLfloat y, GLfloat z)
6917 {
6918 GET_CURRENT_CONTEXT(ctx);
6919 Node *n;
6920 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6921 n = alloc_instruction(ctx, OPCODE_UNIFORM_3F, 4);
6922 if (n) {
6923 n[1].i = location;
6924 n[2].f = x;
6925 n[3].f = y;
6926 n[4].f = z;
6927 }
6928 if (ctx->ExecuteFlag) {
6929 CALL_Uniform3f(ctx->Exec, (location, x, y, z));
6930 }
6931 }
6932
6933
6934 static void GLAPIENTRY
6935 save_Uniform4fARB(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
6936 {
6937 GET_CURRENT_CONTEXT(ctx);
6938 Node *n;
6939 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6940 n = alloc_instruction(ctx, OPCODE_UNIFORM_4F, 5);
6941 if (n) {
6942 n[1].i = location;
6943 n[2].f = x;
6944 n[3].f = y;
6945 n[4].f = z;
6946 n[5].f = w;
6947 }
6948 if (ctx->ExecuteFlag) {
6949 CALL_Uniform4f(ctx->Exec, (location, x, y, z, w));
6950 }
6951 }
6952
6953
6954 static void GLAPIENTRY
6955 save_Uniform1fvARB(GLint location, GLsizei count, const GLfloat *v)
6956 {
6957 GET_CURRENT_CONTEXT(ctx);
6958 Node *n;
6959 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6960 n = alloc_instruction(ctx, OPCODE_UNIFORM_1FV, 2 + POINTER_DWORDS);
6961 if (n) {
6962 n[1].i = location;
6963 n[2].i = count;
6964 save_pointer(&n[3], memdup(v, count * 1 * sizeof(GLfloat)));
6965 }
6966 if (ctx->ExecuteFlag) {
6967 CALL_Uniform1fv(ctx->Exec, (location, count, v));
6968 }
6969 }
6970
6971 static void GLAPIENTRY
6972 save_Uniform2fvARB(GLint location, GLsizei count, const GLfloat *v)
6973 {
6974 GET_CURRENT_CONTEXT(ctx);
6975 Node *n;
6976 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6977 n = alloc_instruction(ctx, OPCODE_UNIFORM_2FV, 2 + POINTER_DWORDS);
6978 if (n) {
6979 n[1].i = location;
6980 n[2].i = count;
6981 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLfloat)));
6982 }
6983 if (ctx->ExecuteFlag) {
6984 CALL_Uniform2fv(ctx->Exec, (location, count, v));
6985 }
6986 }
6987
6988 static void GLAPIENTRY
6989 save_Uniform3fvARB(GLint location, GLsizei count, const GLfloat *v)
6990 {
6991 GET_CURRENT_CONTEXT(ctx);
6992 Node *n;
6993 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6994 n = alloc_instruction(ctx, OPCODE_UNIFORM_3FV, 2 + POINTER_DWORDS);
6995 if (n) {
6996 n[1].i = location;
6997 n[2].i = count;
6998 save_pointer(&n[3], memdup(v, count * 3 * sizeof(GLfloat)));
6999 }
7000 if (ctx->ExecuteFlag) {
7001 CALL_Uniform3fv(ctx->Exec, (location, count, v));
7002 }
7003 }
7004
7005 static void GLAPIENTRY
7006 save_Uniform4fvARB(GLint location, GLsizei count, const GLfloat *v)
7007 {
7008 GET_CURRENT_CONTEXT(ctx);
7009 Node *n;
7010 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7011 n = alloc_instruction(ctx, OPCODE_UNIFORM_4FV, 2 + POINTER_DWORDS);
7012 if (n) {
7013 n[1].i = location;
7014 n[2].i = count;
7015 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLfloat)));
7016 }
7017 if (ctx->ExecuteFlag) {
7018 CALL_Uniform4fv(ctx->Exec, (location, count, v));
7019 }
7020 }
7021
7022
7023 static void GLAPIENTRY
7024 save_Uniform1d(GLint location, GLdouble x)
7025 {
7026 GET_CURRENT_CONTEXT(ctx);
7027 Node *n;
7028 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7029 n = alloc_instruction(ctx, OPCODE_UNIFORM_1D, 3);
7030 if (n) {
7031 n[1].i = location;
7032 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
7033 }
7034 if (ctx->ExecuteFlag) {
7035 CALL_Uniform1d(ctx->Exec, (location, x));
7036 }
7037 }
7038
7039
7040 static void GLAPIENTRY
7041 save_Uniform2d(GLint location, GLdouble x, GLdouble y)
7042 {
7043 GET_CURRENT_CONTEXT(ctx);
7044 Node *n;
7045 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7046 n = alloc_instruction(ctx, OPCODE_UNIFORM_2D, 5);
7047 if (n) {
7048 n[1].i = location;
7049 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
7050 ASSIGN_DOUBLE_TO_NODES(n, 4, y);
7051 }
7052 if (ctx->ExecuteFlag) {
7053 CALL_Uniform2d(ctx->Exec, (location, x, y));
7054 }
7055 }
7056
7057
7058 static void GLAPIENTRY
7059 save_Uniform3d(GLint location, GLdouble x, GLdouble y, GLdouble z)
7060 {
7061 GET_CURRENT_CONTEXT(ctx);
7062 Node *n;
7063 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7064 n = alloc_instruction(ctx, OPCODE_UNIFORM_3D, 7);
7065 if (n) {
7066 n[1].i = location;
7067 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
7068 ASSIGN_DOUBLE_TO_NODES(n, 4, y);
7069 ASSIGN_DOUBLE_TO_NODES(n, 6, z);
7070 }
7071 if (ctx->ExecuteFlag) {
7072 CALL_Uniform3d(ctx->Exec, (location, x, y, z));
7073 }
7074 }
7075
7076
7077 static void GLAPIENTRY
7078 save_Uniform4d(GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
7079 {
7080 GET_CURRENT_CONTEXT(ctx);
7081 Node *n;
7082 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7083 n = alloc_instruction(ctx, OPCODE_UNIFORM_4D, 9);
7084 if (n) {
7085 n[1].i = location;
7086 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
7087 ASSIGN_DOUBLE_TO_NODES(n, 4, y);
7088 ASSIGN_DOUBLE_TO_NODES(n, 6, z);
7089 ASSIGN_DOUBLE_TO_NODES(n, 8, w);
7090 }
7091 if (ctx->ExecuteFlag) {
7092 CALL_Uniform4d(ctx->Exec, (location, x, y, z, w));
7093 }
7094 }
7095
7096
7097 static void GLAPIENTRY
7098 save_Uniform1dv(GLint location, GLsizei count, const GLdouble *v)
7099 {
7100 GET_CURRENT_CONTEXT(ctx);
7101 Node *n;
7102 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7103 n = alloc_instruction(ctx, OPCODE_UNIFORM_1DV, 2 + POINTER_DWORDS);
7104 if (n) {
7105 n[1].i = location;
7106 n[2].i = count;
7107 save_pointer(&n[3], memdup(v, count * 1 * sizeof(GLdouble)));
7108 }
7109 if (ctx->ExecuteFlag) {
7110 CALL_Uniform1dv(ctx->Exec, (location, count, v));
7111 }
7112 }
7113
7114
7115 static void GLAPIENTRY
7116 save_Uniform2dv(GLint location, GLsizei count, const GLdouble *v)
7117 {
7118 GET_CURRENT_CONTEXT(ctx);
7119 Node *n;
7120 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7121 n = alloc_instruction(ctx, OPCODE_UNIFORM_2DV, 2 + POINTER_DWORDS);
7122 if (n) {
7123 n[1].i = location;
7124 n[2].i = count;
7125 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLdouble)));
7126 }
7127 if (ctx->ExecuteFlag) {
7128 CALL_Uniform2dv(ctx->Exec, (location, count, v));
7129 }
7130 }
7131
7132
7133 static void GLAPIENTRY
7134 save_Uniform3dv(GLint location, GLsizei count, const GLdouble *v)
7135 {
7136 GET_CURRENT_CONTEXT(ctx);
7137 Node *n;
7138 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7139 n = alloc_instruction(ctx, OPCODE_UNIFORM_3DV, 2 + POINTER_DWORDS);
7140 if (n) {
7141 n[1].i = location;
7142 n[2].i = count;
7143 save_pointer(&n[3], memdup(v, count * 3 * sizeof(GLdouble)));
7144 }
7145 if (ctx->ExecuteFlag) {
7146 CALL_Uniform3dv(ctx->Exec, (location, count, v));
7147 }
7148 }
7149
7150
7151 static void GLAPIENTRY
7152 save_Uniform4dv(GLint location, GLsizei count, const GLdouble *v)
7153 {
7154 GET_CURRENT_CONTEXT(ctx);
7155 Node *n;
7156 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7157 n = alloc_instruction(ctx, OPCODE_UNIFORM_4DV, 2 + POINTER_DWORDS);
7158 if (n) {
7159 n[1].i = location;
7160 n[2].i = count;
7161 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLdouble)));
7162 }
7163 if (ctx->ExecuteFlag) {
7164 CALL_Uniform4dv(ctx->Exec, (location, count, v));
7165 }
7166 }
7167
7168
7169 static void GLAPIENTRY
7170 save_Uniform1iARB(GLint location, GLint x)
7171 {
7172 GET_CURRENT_CONTEXT(ctx);
7173 Node *n;
7174 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7175 n = alloc_instruction(ctx, OPCODE_UNIFORM_1I, 2);
7176 if (n) {
7177 n[1].i = location;
7178 n[2].i = x;
7179 }
7180 if (ctx->ExecuteFlag) {
7181 CALL_Uniform1i(ctx->Exec, (location, x));
7182 }
7183 }
7184
7185 static void GLAPIENTRY
7186 save_Uniform2iARB(GLint location, GLint x, GLint y)
7187 {
7188 GET_CURRENT_CONTEXT(ctx);
7189 Node *n;
7190 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7191 n = alloc_instruction(ctx, OPCODE_UNIFORM_2I, 3);
7192 if (n) {
7193 n[1].i = location;
7194 n[2].i = x;
7195 n[3].i = y;
7196 }
7197 if (ctx->ExecuteFlag) {
7198 CALL_Uniform2i(ctx->Exec, (location, x, y));
7199 }
7200 }
7201
7202 static void GLAPIENTRY
7203 save_Uniform3iARB(GLint location, GLint x, GLint y, GLint z)
7204 {
7205 GET_CURRENT_CONTEXT(ctx);
7206 Node *n;
7207 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7208 n = alloc_instruction(ctx, OPCODE_UNIFORM_3I, 4);
7209 if (n) {
7210 n[1].i = location;
7211 n[2].i = x;
7212 n[3].i = y;
7213 n[4].i = z;
7214 }
7215 if (ctx->ExecuteFlag) {
7216 CALL_Uniform3i(ctx->Exec, (location, x, y, z));
7217 }
7218 }
7219
7220 static void GLAPIENTRY
7221 save_Uniform4iARB(GLint location, GLint x, GLint y, GLint z, GLint w)
7222 {
7223 GET_CURRENT_CONTEXT(ctx);
7224 Node *n;
7225 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7226 n = alloc_instruction(ctx, OPCODE_UNIFORM_4I, 5);
7227 if (n) {
7228 n[1].i = location;
7229 n[2].i = x;
7230 n[3].i = y;
7231 n[4].i = z;
7232 n[5].i = w;
7233 }
7234 if (ctx->ExecuteFlag) {
7235 CALL_Uniform4i(ctx->Exec, (location, x, y, z, w));
7236 }
7237 }
7238
7239
7240
7241 static void GLAPIENTRY
7242 save_Uniform1ivARB(GLint location, GLsizei count, const GLint *v)
7243 {
7244 GET_CURRENT_CONTEXT(ctx);
7245 Node *n;
7246 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7247 n = alloc_instruction(ctx, OPCODE_UNIFORM_1IV, 2 + POINTER_DWORDS);
7248 if (n) {
7249 n[1].i = location;
7250 n[2].i = count;
7251 save_pointer(&n[3], memdup(v, count * 1 * sizeof(GLint)));
7252 }
7253 if (ctx->ExecuteFlag) {
7254 CALL_Uniform1iv(ctx->Exec, (location, count, v));
7255 }
7256 }
7257
7258 static void GLAPIENTRY
7259 save_Uniform2ivARB(GLint location, GLsizei count, const GLint *v)
7260 {
7261 GET_CURRENT_CONTEXT(ctx);
7262 Node *n;
7263 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7264 n = alloc_instruction(ctx, OPCODE_UNIFORM_2IV, 2 + POINTER_DWORDS);
7265 if (n) {
7266 n[1].i = location;
7267 n[2].i = count;
7268 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLint)));
7269 }
7270 if (ctx->ExecuteFlag) {
7271 CALL_Uniform2iv(ctx->Exec, (location, count, v));
7272 }
7273 }
7274
7275 static void GLAPIENTRY
7276 save_Uniform3ivARB(GLint location, GLsizei count, const GLint *v)
7277 {
7278 GET_CURRENT_CONTEXT(ctx);
7279 Node *n;
7280 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7281 n = alloc_instruction(ctx, OPCODE_UNIFORM_3IV, 2 + POINTER_DWORDS);
7282 if (n) {
7283 n[1].i = location;
7284 n[2].i = count;
7285 save_pointer(&n[3], memdup(v, count * 3 * sizeof(GLint)));
7286 }
7287 if (ctx->ExecuteFlag) {
7288 CALL_Uniform3iv(ctx->Exec, (location, count, v));
7289 }
7290 }
7291
7292 static void GLAPIENTRY
7293 save_Uniform4ivARB(GLint location, GLsizei count, const GLint *v)
7294 {
7295 GET_CURRENT_CONTEXT(ctx);
7296 Node *n;
7297 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7298 n = alloc_instruction(ctx, OPCODE_UNIFORM_4IV, 2 + POINTER_DWORDS);
7299 if (n) {
7300 n[1].i = location;
7301 n[2].i = count;
7302 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLfloat)));
7303 }
7304 if (ctx->ExecuteFlag) {
7305 CALL_Uniform4iv(ctx->Exec, (location, count, v));
7306 }
7307 }
7308
7309
7310
7311 static void GLAPIENTRY
7312 save_Uniform1ui(GLint location, GLuint x)
7313 {
7314 GET_CURRENT_CONTEXT(ctx);
7315 Node *n;
7316 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7317 n = alloc_instruction(ctx, OPCODE_UNIFORM_1UI, 2);
7318 if (n) {
7319 n[1].i = location;
7320 n[2].i = x;
7321 }
7322 if (ctx->ExecuteFlag) {
7323 CALL_Uniform1ui(ctx->Exec, (location, x));
7324 }
7325 }
7326
7327 static void GLAPIENTRY
7328 save_Uniform2ui(GLint location, GLuint x, GLuint y)
7329 {
7330 GET_CURRENT_CONTEXT(ctx);
7331 Node *n;
7332 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7333 n = alloc_instruction(ctx, OPCODE_UNIFORM_2UI, 3);
7334 if (n) {
7335 n[1].i = location;
7336 n[2].i = x;
7337 n[3].i = y;
7338 }
7339 if (ctx->ExecuteFlag) {
7340 CALL_Uniform2ui(ctx->Exec, (location, x, y));
7341 }
7342 }
7343
7344 static void GLAPIENTRY
7345 save_Uniform3ui(GLint location, GLuint x, GLuint y, GLuint z)
7346 {
7347 GET_CURRENT_CONTEXT(ctx);
7348 Node *n;
7349 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7350 n = alloc_instruction(ctx, OPCODE_UNIFORM_3UI, 4);
7351 if (n) {
7352 n[1].i = location;
7353 n[2].i = x;
7354 n[3].i = y;
7355 n[4].i = z;
7356 }
7357 if (ctx->ExecuteFlag) {
7358 CALL_Uniform3ui(ctx->Exec, (location, x, y, z));
7359 }
7360 }
7361
7362 static void GLAPIENTRY
7363 save_Uniform4ui(GLint location, GLuint x, GLuint y, GLuint z, GLuint w)
7364 {
7365 GET_CURRENT_CONTEXT(ctx);
7366 Node *n;
7367 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7368 n = alloc_instruction(ctx, OPCODE_UNIFORM_4UI, 5);
7369 if (n) {
7370 n[1].i = location;
7371 n[2].i = x;
7372 n[3].i = y;
7373 n[4].i = z;
7374 n[5].i = w;
7375 }
7376 if (ctx->ExecuteFlag) {
7377 CALL_Uniform4ui(ctx->Exec, (location, x, y, z, w));
7378 }
7379 }
7380
7381
7382
7383 static void GLAPIENTRY
7384 save_Uniform1uiv(GLint location, GLsizei count, const GLuint *v)
7385 {
7386 GET_CURRENT_CONTEXT(ctx);
7387 Node *n;
7388 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7389 n = alloc_instruction(ctx, OPCODE_UNIFORM_1UIV, 2 + POINTER_DWORDS);
7390 if (n) {
7391 n[1].i = location;
7392 n[2].i = count;
7393 save_pointer(&n[3], memdup(v, count * 1 * sizeof(*v)));
7394 }
7395 if (ctx->ExecuteFlag) {
7396 CALL_Uniform1uiv(ctx->Exec, (location, count, v));
7397 }
7398 }
7399
7400 static void GLAPIENTRY
7401 save_Uniform2uiv(GLint location, GLsizei count, const GLuint *v)
7402 {
7403 GET_CURRENT_CONTEXT(ctx);
7404 Node *n;
7405 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7406 n = alloc_instruction(ctx, OPCODE_UNIFORM_2UIV, 2 + POINTER_DWORDS);
7407 if (n) {
7408 n[1].i = location;
7409 n[2].i = count;
7410 save_pointer(&n[3], memdup(v, count * 2 * sizeof(*v)));
7411 }
7412 if (ctx->ExecuteFlag) {
7413 CALL_Uniform2uiv(ctx->Exec, (location, count, v));
7414 }
7415 }
7416
7417 static void GLAPIENTRY
7418 save_Uniform3uiv(GLint location, GLsizei count, const GLuint *v)
7419 {
7420 GET_CURRENT_CONTEXT(ctx);
7421 Node *n;
7422 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7423 n = alloc_instruction(ctx, OPCODE_UNIFORM_3UIV, 2 + POINTER_DWORDS);
7424 if (n) {
7425 n[1].i = location;
7426 n[2].i = count;
7427 save_pointer(&n[3], memdup(v, count * 3 * sizeof(*v)));
7428 }
7429 if (ctx->ExecuteFlag) {
7430 CALL_Uniform3uiv(ctx->Exec, (location, count, v));
7431 }
7432 }
7433
7434 static void GLAPIENTRY
7435 save_Uniform4uiv(GLint location, GLsizei count, const GLuint *v)
7436 {
7437 GET_CURRENT_CONTEXT(ctx);
7438 Node *n;
7439 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7440 n = alloc_instruction(ctx, OPCODE_UNIFORM_4UIV, 2 + POINTER_DWORDS);
7441 if (n) {
7442 n[1].i = location;
7443 n[2].i = count;
7444 save_pointer(&n[3], memdup(v, count * 4 * sizeof(*v)));
7445 }
7446 if (ctx->ExecuteFlag) {
7447 CALL_Uniform4uiv(ctx->Exec, (location, count, v));
7448 }
7449 }
7450
7451
7452
7453 static void GLAPIENTRY
7454 save_UniformMatrix2fvARB(GLint location, GLsizei count, GLboolean transpose,
7455 const GLfloat *m)
7456 {
7457 GET_CURRENT_CONTEXT(ctx);
7458 Node *n;
7459 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7460 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX22, 3 + POINTER_DWORDS);
7461 if (n) {
7462 n[1].i = location;
7463 n[2].i = count;
7464 n[3].b = transpose;
7465 save_pointer(&n[4], memdup(m, count * 2 * 2 * sizeof(GLfloat)));
7466 }
7467 if (ctx->ExecuteFlag) {
7468 CALL_UniformMatrix2fv(ctx->Exec, (location, count, transpose, m));
7469 }
7470 }
7471
7472 static void GLAPIENTRY
7473 save_UniformMatrix3fvARB(GLint location, GLsizei count, GLboolean transpose,
7474 const GLfloat *m)
7475 {
7476 GET_CURRENT_CONTEXT(ctx);
7477 Node *n;
7478 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7479 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX33, 3 + POINTER_DWORDS);
7480 if (n) {
7481 n[1].i = location;
7482 n[2].i = count;
7483 n[3].b = transpose;
7484 save_pointer(&n[4], memdup(m, count * 3 * 3 * sizeof(GLfloat)));
7485 }
7486 if (ctx->ExecuteFlag) {
7487 CALL_UniformMatrix3fv(ctx->Exec, (location, count, transpose, m));
7488 }
7489 }
7490
7491 static void GLAPIENTRY
7492 save_UniformMatrix4fvARB(GLint location, GLsizei count, GLboolean transpose,
7493 const GLfloat *m)
7494 {
7495 GET_CURRENT_CONTEXT(ctx);
7496 Node *n;
7497 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7498 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX44, 3 + POINTER_DWORDS);
7499 if (n) {
7500 n[1].i = location;
7501 n[2].i = count;
7502 n[3].b = transpose;
7503 save_pointer(&n[4], memdup(m, count * 4 * 4 * sizeof(GLfloat)));
7504 }
7505 if (ctx->ExecuteFlag) {
7506 CALL_UniformMatrix4fv(ctx->Exec, (location, count, transpose, m));
7507 }
7508 }
7509
7510
7511 static void GLAPIENTRY
7512 save_UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose,
7513 const GLfloat *m)
7514 {
7515 GET_CURRENT_CONTEXT(ctx);
7516 Node *n;
7517 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7518 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX23, 3 + POINTER_DWORDS);
7519 if (n) {
7520 n[1].i = location;
7521 n[2].i = count;
7522 n[3].b = transpose;
7523 save_pointer(&n[4], memdup(m, count * 2 * 3 * sizeof(GLfloat)));
7524 }
7525 if (ctx->ExecuteFlag) {
7526 CALL_UniformMatrix2x3fv(ctx->Exec, (location, count, transpose, m));
7527 }
7528 }
7529
7530 static void GLAPIENTRY
7531 save_UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose,
7532 const GLfloat *m)
7533 {
7534 GET_CURRENT_CONTEXT(ctx);
7535 Node *n;
7536 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7537 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX32, 3 + POINTER_DWORDS);
7538 if (n) {
7539 n[1].i = location;
7540 n[2].i = count;
7541 n[3].b = transpose;
7542 save_pointer(&n[4], memdup(m, count * 3 * 2 * sizeof(GLfloat)));
7543 }
7544 if (ctx->ExecuteFlag) {
7545 CALL_UniformMatrix3x2fv(ctx->Exec, (location, count, transpose, m));
7546 }
7547 }
7548
7549
7550 static void GLAPIENTRY
7551 save_UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose,
7552 const GLfloat *m)
7553 {
7554 GET_CURRENT_CONTEXT(ctx);
7555 Node *n;
7556 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7557 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX24, 3 + POINTER_DWORDS);
7558 if (n) {
7559 n[1].i = location;
7560 n[2].i = count;
7561 n[3].b = transpose;
7562 save_pointer(&n[4], memdup(m, count * 2 * 4 * sizeof(GLfloat)));
7563 }
7564 if (ctx->ExecuteFlag) {
7565 CALL_UniformMatrix2x4fv(ctx->Exec, (location, count, transpose, m));
7566 }
7567 }
7568
7569 static void GLAPIENTRY
7570 save_UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose,
7571 const GLfloat *m)
7572 {
7573 GET_CURRENT_CONTEXT(ctx);
7574 Node *n;
7575 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7576 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX42, 3 + POINTER_DWORDS);
7577 if (n) {
7578 n[1].i = location;
7579 n[2].i = count;
7580 n[3].b = transpose;
7581 save_pointer(&n[4], memdup(m, count * 4 * 2 * sizeof(GLfloat)));
7582 }
7583 if (ctx->ExecuteFlag) {
7584 CALL_UniformMatrix4x2fv(ctx->Exec, (location, count, transpose, m));
7585 }
7586 }
7587
7588
7589 static void GLAPIENTRY
7590 save_UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose,
7591 const GLfloat *m)
7592 {
7593 GET_CURRENT_CONTEXT(ctx);
7594 Node *n;
7595 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7596 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX34, 3 + POINTER_DWORDS);
7597 if (n) {
7598 n[1].i = location;
7599 n[2].i = count;
7600 n[3].b = transpose;
7601 save_pointer(&n[4], memdup(m, count * 3 * 4 * sizeof(GLfloat)));
7602 }
7603 if (ctx->ExecuteFlag) {
7604 CALL_UniformMatrix3x4fv(ctx->Exec, (location, count, transpose, m));
7605 }
7606 }
7607
7608 static void GLAPIENTRY
7609 save_UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose,
7610 const GLfloat *m)
7611 {
7612 GET_CURRENT_CONTEXT(ctx);
7613 Node *n;
7614 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7615 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX43, 3 + POINTER_DWORDS);
7616 if (n) {
7617 n[1].i = location;
7618 n[2].i = count;
7619 n[3].b = transpose;
7620 save_pointer(&n[4], memdup(m, count * 4 * 3 * sizeof(GLfloat)));
7621 }
7622 if (ctx->ExecuteFlag) {
7623 CALL_UniformMatrix4x3fv(ctx->Exec, (location, count, transpose, m));
7624 }
7625 }
7626
7627
7628 static void GLAPIENTRY
7629 save_UniformMatrix2dv(GLint location, GLsizei count, GLboolean transpose,
7630 const GLdouble *m)
7631 {
7632 GET_CURRENT_CONTEXT(ctx);
7633 Node *n;
7634 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7635 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX22D, 3 + POINTER_DWORDS);
7636 if (n) {
7637 n[1].i = location;
7638 n[2].i = count;
7639 n[3].b = transpose;
7640 save_pointer(&n[4], memdup(m, count * 2 * 2 * sizeof(GLdouble)));
7641 }
7642 if (ctx->ExecuteFlag) {
7643 CALL_UniformMatrix2dv(ctx->Exec, (location, count, transpose, m));
7644 }
7645 }
7646
7647 static void GLAPIENTRY
7648 save_UniformMatrix3dv(GLint location, GLsizei count, GLboolean transpose,
7649 const GLdouble *m)
7650 {
7651 GET_CURRENT_CONTEXT(ctx);
7652 Node *n;
7653 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7654 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX33D, 3 + POINTER_DWORDS);
7655 if (n) {
7656 n[1].i = location;
7657 n[2].i = count;
7658 n[3].b = transpose;
7659 save_pointer(&n[4], memdup(m, count * 3 * 3 * sizeof(GLdouble)));
7660 }
7661 if (ctx->ExecuteFlag) {
7662 CALL_UniformMatrix3dv(ctx->Exec, (location, count, transpose, m));
7663 }
7664 }
7665
7666 static void GLAPIENTRY
7667 save_UniformMatrix4dv(GLint location, GLsizei count, GLboolean transpose,
7668 const GLdouble *m)
7669 {
7670 GET_CURRENT_CONTEXT(ctx);
7671 Node *n;
7672 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7673 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX44D, 3 + POINTER_DWORDS);
7674 if (n) {
7675 n[1].i = location;
7676 n[2].i = count;
7677 n[3].b = transpose;
7678 save_pointer(&n[4], memdup(m, count * 4 * 4 * sizeof(GLdouble)));
7679 }
7680 if (ctx->ExecuteFlag) {
7681 CALL_UniformMatrix4dv(ctx->Exec, (location, count, transpose, m));
7682 }
7683 }
7684
7685
7686 static void GLAPIENTRY
7687 save_UniformMatrix2x3dv(GLint location, GLsizei count, GLboolean transpose,
7688 const GLdouble *m)
7689 {
7690 GET_CURRENT_CONTEXT(ctx);
7691 Node *n;
7692 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7693 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX23D, 3 + POINTER_DWORDS);
7694 if (n) {
7695 n[1].i = location;
7696 n[2].i = count;
7697 n[3].b = transpose;
7698 save_pointer(&n[4], memdup(m, count * 2 * 3 * sizeof(GLdouble)));
7699 }
7700 if (ctx->ExecuteFlag) {
7701 CALL_UniformMatrix2x3dv(ctx->Exec, (location, count, transpose, m));
7702 }
7703 }
7704
7705
7706 static void GLAPIENTRY
7707 save_UniformMatrix3x2dv(GLint location, GLsizei count, GLboolean transpose,
7708 const GLdouble *m)
7709 {
7710 GET_CURRENT_CONTEXT(ctx);
7711 Node *n;
7712 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7713 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX32D, 3 + POINTER_DWORDS);
7714 if (n) {
7715 n[1].i = location;
7716 n[2].i = count;
7717 n[3].b = transpose;
7718 save_pointer(&n[4], memdup(m, count * 3 * 2 * sizeof(GLdouble)));
7719 }
7720 if (ctx->ExecuteFlag) {
7721 CALL_UniformMatrix3x2dv(ctx->Exec, (location, count, transpose, m));
7722 }
7723 }
7724
7725
7726 static void GLAPIENTRY
7727 save_UniformMatrix2x4dv(GLint location, GLsizei count, GLboolean transpose,
7728 const GLdouble *m)
7729 {
7730 GET_CURRENT_CONTEXT(ctx);
7731 Node *n;
7732 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7733 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX24D, 3 + POINTER_DWORDS);
7734 if (n) {
7735 n[1].i = location;
7736 n[2].i = count;
7737 n[3].b = transpose;
7738 save_pointer(&n[4], memdup(m, count * 2 * 4 * sizeof(GLdouble)));
7739 }
7740 if (ctx->ExecuteFlag) {
7741 CALL_UniformMatrix2x4dv(ctx->Exec, (location, count, transpose, m));
7742 }
7743 }
7744
7745 static void GLAPIENTRY
7746 save_UniformMatrix4x2dv(GLint location, GLsizei count, GLboolean transpose,
7747 const GLdouble *m)
7748 {
7749 GET_CURRENT_CONTEXT(ctx);
7750 Node *n;
7751 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7752 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX42D, 3 + POINTER_DWORDS);
7753 if (n) {
7754 n[1].i = location;
7755 n[2].i = count;
7756 n[3].b = transpose;
7757 save_pointer(&n[4], memdup(m, count * 4 * 2 * sizeof(GLdouble)));
7758 }
7759 if (ctx->ExecuteFlag) {
7760 CALL_UniformMatrix4x2dv(ctx->Exec, (location, count, transpose, m));
7761 }
7762 }
7763
7764
7765 static void GLAPIENTRY
7766 save_UniformMatrix3x4dv(GLint location, GLsizei count, GLboolean transpose,
7767 const GLdouble *m)
7768 {
7769 GET_CURRENT_CONTEXT(ctx);
7770 Node *n;
7771 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7772 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX34D, 3 + POINTER_DWORDS);
7773 if (n) {
7774 n[1].i = location;
7775 n[2].i = count;
7776 n[3].b = transpose;
7777 save_pointer(&n[4], memdup(m, count * 3 * 4 * sizeof(GLdouble)));
7778 }
7779 if (ctx->ExecuteFlag) {
7780 CALL_UniformMatrix3x4dv(ctx->Exec, (location, count, transpose, m));
7781 }
7782 }
7783
7784
7785 static void GLAPIENTRY
7786 save_UniformMatrix4x3dv(GLint location, GLsizei count, GLboolean transpose,
7787 const GLdouble *m)
7788 {
7789 GET_CURRENT_CONTEXT(ctx);
7790 Node *n;
7791 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7792 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX43D, 3 + POINTER_DWORDS);
7793 if (n) {
7794 n[1].i = location;
7795 n[2].i = count;
7796 n[3].b = transpose;
7797 save_pointer(&n[4], memdup(m, count * 4 * 3 * sizeof(GLdouble)));
7798 }
7799 if (ctx->ExecuteFlag) {
7800 CALL_UniformMatrix4x3dv(ctx->Exec, (location, count, transpose, m));
7801 }
7802 }
7803
7804
7805 static void GLAPIENTRY
7806 save_UseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program)
7807 {
7808 GET_CURRENT_CONTEXT(ctx);
7809 Node *n;
7810 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7811 n = alloc_instruction(ctx, OPCODE_USE_PROGRAM_STAGES, 3);
7812 if (n) {
7813 n[1].ui = pipeline;
7814 n[2].ui = stages;
7815 n[3].ui = program;
7816 }
7817 if (ctx->ExecuteFlag) {
7818 CALL_UseProgramStages(ctx->Exec, (pipeline, stages, program));
7819 }
7820 }
7821
7822 static void GLAPIENTRY
7823 save_ProgramUniform1f(GLuint program, GLint location, GLfloat x)
7824 {
7825 GET_CURRENT_CONTEXT(ctx);
7826 Node *n;
7827 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7828 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1F, 3);
7829 if (n) {
7830 n[1].ui = program;
7831 n[2].i = location;
7832 n[3].f = x;
7833 }
7834 if (ctx->ExecuteFlag) {
7835 CALL_ProgramUniform1f(ctx->Exec, (program, location, x));
7836 }
7837 }
7838
7839 static void GLAPIENTRY
7840 save_ProgramUniform2f(GLuint program, GLint location, GLfloat x, GLfloat y)
7841 {
7842 GET_CURRENT_CONTEXT(ctx);
7843 Node *n;
7844 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7845 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2F, 4);
7846 if (n) {
7847 n[1].ui = program;
7848 n[2].i = location;
7849 n[3].f = x;
7850 n[4].f = y;
7851 }
7852 if (ctx->ExecuteFlag) {
7853 CALL_ProgramUniform2f(ctx->Exec, (program, location, x, y));
7854 }
7855 }
7856
7857 static void GLAPIENTRY
7858 save_ProgramUniform3f(GLuint program, GLint location,
7859 GLfloat x, GLfloat y, GLfloat z)
7860 {
7861 GET_CURRENT_CONTEXT(ctx);
7862 Node *n;
7863 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7864 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3F, 5);
7865 if (n) {
7866 n[1].ui = program;
7867 n[2].i = location;
7868 n[3].f = x;
7869 n[4].f = y;
7870 n[5].f = z;
7871 }
7872 if (ctx->ExecuteFlag) {
7873 CALL_ProgramUniform3f(ctx->Exec, (program, location, x, y, z));
7874 }
7875 }
7876
7877 static void GLAPIENTRY
7878 save_ProgramUniform4f(GLuint program, GLint location,
7879 GLfloat x, GLfloat y, GLfloat z, GLfloat w)
7880 {
7881 GET_CURRENT_CONTEXT(ctx);
7882 Node *n;
7883 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7884 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4F, 6);
7885 if (n) {
7886 n[1].ui = program;
7887 n[2].i = location;
7888 n[3].f = x;
7889 n[4].f = y;
7890 n[5].f = z;
7891 n[6].f = w;
7892 }
7893 if (ctx->ExecuteFlag) {
7894 CALL_ProgramUniform4f(ctx->Exec, (program, location, x, y, z, w));
7895 }
7896 }
7897
7898 static void GLAPIENTRY
7899 save_ProgramUniform1fv(GLuint program, GLint location, GLsizei count,
7900 const GLfloat *v)
7901 {
7902 GET_CURRENT_CONTEXT(ctx);
7903 Node *n;
7904 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7905 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1FV, 3 + POINTER_DWORDS);
7906 if (n) {
7907 n[1].ui = program;
7908 n[2].i = location;
7909 n[3].i = count;
7910 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLfloat)));
7911 }
7912 if (ctx->ExecuteFlag) {
7913 CALL_ProgramUniform1fv(ctx->Exec, (program, location, count, v));
7914 }
7915 }
7916
7917 static void GLAPIENTRY
7918 save_ProgramUniform2fv(GLuint program, GLint location, GLsizei count,
7919 const GLfloat *v)
7920 {
7921 GET_CURRENT_CONTEXT(ctx);
7922 Node *n;
7923 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7924 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2FV, 3 + POINTER_DWORDS);
7925 if (n) {
7926 n[1].ui = program;
7927 n[2].i = location;
7928 n[3].i = count;
7929 save_pointer(&n[4], memdup(v, count * 2 * sizeof(GLfloat)));
7930 }
7931 if (ctx->ExecuteFlag) {
7932 CALL_ProgramUniform2fv(ctx->Exec, (program, location, count, v));
7933 }
7934 }
7935
7936 static void GLAPIENTRY
7937 save_ProgramUniform3fv(GLuint program, GLint location, GLsizei count,
7938 const GLfloat *v)
7939 {
7940 GET_CURRENT_CONTEXT(ctx);
7941 Node *n;
7942 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7943 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3FV, 3 + POINTER_DWORDS);
7944 if (n) {
7945 n[1].ui = program;
7946 n[2].i = location;
7947 n[3].i = count;
7948 save_pointer(&n[4], memdup(v, count * 3 * sizeof(GLfloat)));
7949 }
7950 if (ctx->ExecuteFlag) {
7951 CALL_ProgramUniform3fv(ctx->Exec, (program, location, count, v));
7952 }
7953 }
7954
7955 static void GLAPIENTRY
7956 save_ProgramUniform4fv(GLuint program, GLint location, GLsizei count,
7957 const GLfloat *v)
7958 {
7959 GET_CURRENT_CONTEXT(ctx);
7960 Node *n;
7961 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7962 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4FV, 3 + POINTER_DWORDS);
7963 if (n) {
7964 n[1].ui = program;
7965 n[2].i = location;
7966 n[3].i = count;
7967 save_pointer(&n[4], memdup(v, count * 4 * sizeof(GLfloat)));
7968 }
7969 if (ctx->ExecuteFlag) {
7970 CALL_ProgramUniform4fv(ctx->Exec, (program, location, count, v));
7971 }
7972 }
7973
7974 static void GLAPIENTRY
7975 save_ProgramUniform1d(GLuint program, GLint location, GLdouble x)
7976 {
7977 GET_CURRENT_CONTEXT(ctx);
7978 Node *n;
7979 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7980 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1D, 4);
7981 if (n) {
7982 n[1].ui = program;
7983 n[2].i = location;
7984 ASSIGN_DOUBLE_TO_NODES(n, 3, x);
7985 }
7986 if (ctx->ExecuteFlag) {
7987 CALL_ProgramUniform1d(ctx->Exec, (program, location, x));
7988 }
7989 }
7990
7991 static void GLAPIENTRY
7992 save_ProgramUniform2d(GLuint program, GLint location, GLdouble x, GLdouble y)
7993 {
7994 GET_CURRENT_CONTEXT(ctx);
7995 Node *n;
7996 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7997 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2D, 6);
7998 if (n) {
7999 n[1].ui = program;
8000 n[2].i = location;
8001 ASSIGN_DOUBLE_TO_NODES(n, 3, x);
8002 ASSIGN_DOUBLE_TO_NODES(n, 5, y);
8003 }
8004 if (ctx->ExecuteFlag) {
8005 CALL_ProgramUniform2d(ctx->Exec, (program, location, x, y));
8006 }
8007 }
8008
8009 static void GLAPIENTRY
8010 save_ProgramUniform3d(GLuint program, GLint location,
8011 GLdouble x, GLdouble y, GLdouble z)
8012 {
8013 GET_CURRENT_CONTEXT(ctx);
8014 Node *n;
8015 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8016 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3D, 8);
8017 if (n) {
8018 n[1].ui = program;
8019 n[2].i = location;
8020 ASSIGN_DOUBLE_TO_NODES(n, 3, x);
8021 ASSIGN_DOUBLE_TO_NODES(n, 5, y);
8022 ASSIGN_DOUBLE_TO_NODES(n, 7, z);
8023 }
8024 if (ctx->ExecuteFlag) {
8025 CALL_ProgramUniform3d(ctx->Exec, (program, location, x, y, z));
8026 }
8027 }
8028
8029 static void GLAPIENTRY
8030 save_ProgramUniform4d(GLuint program, GLint location,
8031 GLdouble x, GLdouble y, GLdouble z, GLdouble w)
8032 {
8033 GET_CURRENT_CONTEXT(ctx);
8034 Node *n;
8035 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8036 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4D, 10);
8037 if (n) {
8038 n[1].ui = program;
8039 n[2].i = location;
8040 ASSIGN_DOUBLE_TO_NODES(n, 3, x);
8041 ASSIGN_DOUBLE_TO_NODES(n, 5, y);
8042 ASSIGN_DOUBLE_TO_NODES(n, 7, z);
8043 ASSIGN_DOUBLE_TO_NODES(n, 9, w);
8044 }
8045 if (ctx->ExecuteFlag) {
8046 CALL_ProgramUniform4d(ctx->Exec, (program, location, x, y, z, w));
8047 }
8048 }
8049
8050 static void GLAPIENTRY
8051 save_ProgramUniform1dv(GLuint program, GLint location, GLsizei count,
8052 const GLdouble *v)
8053 {
8054 GET_CURRENT_CONTEXT(ctx);
8055 Node *n;
8056 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8057 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1DV, 3 + POINTER_DWORDS);
8058 if (n) {
8059 n[1].ui = program;
8060 n[2].i = location;
8061 n[3].i = count;
8062 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLdouble)));
8063 }
8064 if (ctx->ExecuteFlag) {
8065 CALL_ProgramUniform1dv(ctx->Exec, (program, location, count, v));
8066 }
8067 }
8068
8069 static void GLAPIENTRY
8070 save_ProgramUniform2dv(GLuint program, GLint location, GLsizei count,
8071 const GLdouble *v)
8072 {
8073 GET_CURRENT_CONTEXT(ctx);
8074 Node *n;
8075 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8076 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2DV, 3 + POINTER_DWORDS);
8077 if (n) {
8078 n[1].ui = program;
8079 n[2].i = location;
8080 n[3].i = count;
8081 save_pointer(&n[4], memdup(v, count * 2 * sizeof(GLdouble)));
8082 }
8083 if (ctx->ExecuteFlag) {
8084 CALL_ProgramUniform2dv(ctx->Exec, (program, location, count, v));
8085 }
8086 }
8087
8088 static void GLAPIENTRY
8089 save_ProgramUniform3dv(GLuint program, GLint location, GLsizei count,
8090 const GLdouble *v)
8091 {
8092 GET_CURRENT_CONTEXT(ctx);
8093 Node *n;
8094 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8095 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3DV, 3 + POINTER_DWORDS);
8096 if (n) {
8097 n[1].ui = program;
8098 n[2].i = location;
8099 n[3].i = count;
8100 save_pointer(&n[4], memdup(v, count * 3 * sizeof(GLdouble)));
8101 }
8102 if (ctx->ExecuteFlag) {
8103 CALL_ProgramUniform3dv(ctx->Exec, (program, location, count, v));
8104 }
8105 }
8106
8107 static void GLAPIENTRY
8108 save_ProgramUniform4dv(GLuint program, GLint location, GLsizei count,
8109 const GLdouble *v)
8110 {
8111 GET_CURRENT_CONTEXT(ctx);
8112 Node *n;
8113 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8114 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4DV, 3 + POINTER_DWORDS);
8115 if (n) {
8116 n[1].ui = program;
8117 n[2].i = location;
8118 n[3].i = count;
8119 save_pointer(&n[4], memdup(v, count * 4 * sizeof(GLdouble)));
8120 }
8121 if (ctx->ExecuteFlag) {
8122 CALL_ProgramUniform4dv(ctx->Exec, (program, location, count, v));
8123 }
8124 }
8125
8126 static void GLAPIENTRY
8127 save_ProgramUniform1i(GLuint program, GLint location, GLint x)
8128 {
8129 GET_CURRENT_CONTEXT(ctx);
8130 Node *n;
8131 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8132 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1I, 3);
8133 if (n) {
8134 n[1].ui = program;
8135 n[2].i = location;
8136 n[3].i = x;
8137 }
8138 if (ctx->ExecuteFlag) {
8139 CALL_ProgramUniform1i(ctx->Exec, (program, location, x));
8140 }
8141 }
8142
8143 static void GLAPIENTRY
8144 save_ProgramUniform2i(GLuint program, GLint location, GLint x, GLint y)
8145 {
8146 GET_CURRENT_CONTEXT(ctx);
8147 Node *n;
8148 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8149 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2I, 4);
8150 if (n) {
8151 n[1].ui = program;
8152 n[2].i = location;
8153 n[3].i = x;
8154 n[4].i = y;
8155 }
8156 if (ctx->ExecuteFlag) {
8157 CALL_ProgramUniform2i(ctx->Exec, (program, location, x, y));
8158 }
8159 }
8160
8161 static void GLAPIENTRY
8162 save_ProgramUniform3i(GLuint program, GLint location,
8163 GLint x, GLint y, GLint z)
8164 {
8165 GET_CURRENT_CONTEXT(ctx);
8166 Node *n;
8167 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8168 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3I, 5);
8169 if (n) {
8170 n[1].ui = program;
8171 n[2].i = location;
8172 n[3].i = x;
8173 n[4].i = y;
8174 n[5].i = z;
8175 }
8176 if (ctx->ExecuteFlag) {
8177 CALL_ProgramUniform3i(ctx->Exec, (program, location, x, y, z));
8178 }
8179 }
8180
8181 static void GLAPIENTRY
8182 save_ProgramUniform4i(GLuint program, GLint location,
8183 GLint x, GLint y, GLint z, GLint w)
8184 {
8185 GET_CURRENT_CONTEXT(ctx);
8186 Node *n;
8187 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8188 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4I, 6);
8189 if (n) {
8190 n[1].ui = program;
8191 n[2].i = location;
8192 n[3].i = x;
8193 n[4].i = y;
8194 n[5].i = z;
8195 n[6].i = w;
8196 }
8197 if (ctx->ExecuteFlag) {
8198 CALL_ProgramUniform4i(ctx->Exec, (program, location, x, y, z, w));
8199 }
8200 }
8201
8202 static void GLAPIENTRY
8203 save_ProgramUniform1iv(GLuint program, GLint location, GLsizei count,
8204 const GLint *v)
8205 {
8206 GET_CURRENT_CONTEXT(ctx);
8207 Node *n;
8208 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8209 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1IV, 3 + POINTER_DWORDS);
8210 if (n) {
8211 n[1].ui = program;
8212 n[2].i = location;
8213 n[3].i = count;
8214 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLint)));
8215 }
8216 if (ctx->ExecuteFlag) {
8217 CALL_ProgramUniform1iv(ctx->Exec, (program, location, count, v));
8218 }
8219 }
8220
8221 static void GLAPIENTRY
8222 save_ProgramUniform2iv(GLuint program, GLint location, GLsizei count,
8223 const GLint *v)
8224 {
8225 GET_CURRENT_CONTEXT(ctx);
8226 Node *n;
8227 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8228 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2IV, 3 + POINTER_DWORDS);
8229 if (n) {
8230 n[1].ui = program;
8231 n[2].i = location;
8232 n[3].i = count;
8233 save_pointer(&n[4], memdup(v, count * 2 * sizeof(GLint)));
8234 }
8235 if (ctx->ExecuteFlag) {
8236 CALL_ProgramUniform2iv(ctx->Exec, (program, location, count, v));
8237 }
8238 }
8239
8240 static void GLAPIENTRY
8241 save_ProgramUniform3iv(GLuint program, GLint location, GLsizei count,
8242 const GLint *v)
8243 {
8244 GET_CURRENT_CONTEXT(ctx);
8245 Node *n;
8246 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8247 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3IV, 3 + POINTER_DWORDS);
8248 if (n) {
8249 n[1].ui = program;
8250 n[2].i = location;
8251 n[3].i = count;
8252 save_pointer(&n[4], memdup(v, count * 3 * sizeof(GLint)));
8253 }
8254 if (ctx->ExecuteFlag) {
8255 CALL_ProgramUniform3iv(ctx->Exec, (program, location, count, v));
8256 }
8257 }
8258
8259 static void GLAPIENTRY
8260 save_ProgramUniform4iv(GLuint program, GLint location, GLsizei count,
8261 const GLint *v)
8262 {
8263 GET_CURRENT_CONTEXT(ctx);
8264 Node *n;
8265 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8266 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4IV, 3 + POINTER_DWORDS);
8267 if (n) {
8268 n[1].ui = program;
8269 n[2].i = location;
8270 n[3].i = count;
8271 save_pointer(&n[4], memdup(v, count * 4 * sizeof(GLint)));
8272 }
8273 if (ctx->ExecuteFlag) {
8274 CALL_ProgramUniform4iv(ctx->Exec, (program, location, count, v));
8275 }
8276 }
8277
8278 static void GLAPIENTRY
8279 save_ProgramUniform1ui(GLuint program, GLint location, GLuint x)
8280 {
8281 GET_CURRENT_CONTEXT(ctx);
8282 Node *n;
8283 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8284 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1UI, 3);
8285 if (n) {
8286 n[1].ui = program;
8287 n[2].i = location;
8288 n[3].ui = x;
8289 }
8290 if (ctx->ExecuteFlag) {
8291 CALL_ProgramUniform1ui(ctx->Exec, (program, location, x));
8292 }
8293 }
8294
8295 static void GLAPIENTRY
8296 save_ProgramUniform2ui(GLuint program, GLint location, GLuint x, GLuint y)
8297 {
8298 GET_CURRENT_CONTEXT(ctx);
8299 Node *n;
8300 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8301 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2UI, 4);
8302 if (n) {
8303 n[1].ui = program;
8304 n[2].i = location;
8305 n[3].ui = x;
8306 n[4].ui = y;
8307 }
8308 if (ctx->ExecuteFlag) {
8309 CALL_ProgramUniform2ui(ctx->Exec, (program, location, x, y));
8310 }
8311 }
8312
8313 static void GLAPIENTRY
8314 save_ProgramUniform3ui(GLuint program, GLint location,
8315 GLuint x, GLuint y, GLuint z)
8316 {
8317 GET_CURRENT_CONTEXT(ctx);
8318 Node *n;
8319 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8320 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3UI, 5);
8321 if (n) {
8322 n[1].ui = program;
8323 n[2].i = location;
8324 n[3].ui = x;
8325 n[4].ui = y;
8326 n[5].ui = z;
8327 }
8328 if (ctx->ExecuteFlag) {
8329 CALL_ProgramUniform3ui(ctx->Exec, (program, location, x, y, z));
8330 }
8331 }
8332
8333 static void GLAPIENTRY
8334 save_ProgramUniform4ui(GLuint program, GLint location,
8335 GLuint x, GLuint y, GLuint z, GLuint w)
8336 {
8337 GET_CURRENT_CONTEXT(ctx);
8338 Node *n;
8339 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8340 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4UI, 6);
8341 if (n) {
8342 n[1].ui = program;
8343 n[2].i = location;
8344 n[3].ui = x;
8345 n[4].ui = y;
8346 n[5].ui = z;
8347 n[6].ui = w;
8348 }
8349 if (ctx->ExecuteFlag) {
8350 CALL_ProgramUniform4ui(ctx->Exec, (program, location, x, y, z, w));
8351 }
8352 }
8353
8354 static void GLAPIENTRY
8355 save_ProgramUniform1uiv(GLuint program, GLint location, GLsizei count,
8356 const GLuint *v)
8357 {
8358 GET_CURRENT_CONTEXT(ctx);
8359 Node *n;
8360 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8361 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1UIV, 3 + POINTER_DWORDS);
8362 if (n) {
8363 n[1].ui = program;
8364 n[2].i = location;
8365 n[3].i = count;
8366 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLuint)));
8367 }
8368 if (ctx->ExecuteFlag) {
8369 CALL_ProgramUniform1uiv(ctx->Exec, (program, location, count, v));
8370 }
8371 }
8372
8373 static void GLAPIENTRY
8374 save_ProgramUniform2uiv(GLuint program, GLint location, GLsizei count,
8375 const GLuint *v)
8376 {
8377 GET_CURRENT_CONTEXT(ctx);
8378 Node *n;
8379 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8380 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2UIV, 3 + POINTER_DWORDS);
8381 if (n) {
8382 n[1].ui = program;
8383 n[2].i = location;
8384 n[3].i = count;
8385 save_pointer(&n[4], memdup(v, count * 2 * sizeof(GLuint)));
8386 }
8387 if (ctx->ExecuteFlag) {
8388 CALL_ProgramUniform2uiv(ctx->Exec, (program, location, count, v));
8389 }
8390 }
8391
8392 static void GLAPIENTRY
8393 save_ProgramUniform3uiv(GLuint program, GLint location, GLsizei count,
8394 const GLuint *v)
8395 {
8396 GET_CURRENT_CONTEXT(ctx);
8397 Node *n;
8398 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8399 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3UIV, 3 + POINTER_DWORDS);
8400 if (n) {
8401 n[1].ui = program;
8402 n[2].i = location;
8403 n[3].i = count;
8404 save_pointer(&n[4], memdup(v, count * 3 * sizeof(GLuint)));
8405 }
8406 if (ctx->ExecuteFlag) {
8407 CALL_ProgramUniform3uiv(ctx->Exec, (program, location, count, v));
8408 }
8409 }
8410
8411 static void GLAPIENTRY
8412 save_ProgramUniform4uiv(GLuint program, GLint location, GLsizei count,
8413 const GLuint *v)
8414 {
8415 GET_CURRENT_CONTEXT(ctx);
8416 Node *n;
8417 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8418 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4UIV, 3 + POINTER_DWORDS);
8419 if (n) {
8420 n[1].ui = program;
8421 n[2].i = location;
8422 n[3].i = count;
8423 save_pointer(&n[4], memdup(v, count * 4 * sizeof(GLuint)));
8424 }
8425 if (ctx->ExecuteFlag) {
8426 CALL_ProgramUniform4uiv(ctx->Exec, (program, location, count, v));
8427 }
8428 }
8429
8430 static void GLAPIENTRY
8431 save_ProgramUniformMatrix2fv(GLuint program, GLint location, GLsizei count,
8432 GLboolean transpose, const GLfloat *v)
8433 {
8434 GET_CURRENT_CONTEXT(ctx);
8435 Node *n;
8436 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8437 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX22F,
8438 4 + POINTER_DWORDS);
8439 if (n) {
8440 n[1].ui = program;
8441 n[2].i = location;
8442 n[3].i = count;
8443 n[4].b = transpose;
8444 save_pointer(&n[5], memdup(v, count * 2 * 2 * sizeof(GLfloat)));
8445 }
8446 if (ctx->ExecuteFlag) {
8447 CALL_ProgramUniformMatrix2fv(ctx->Exec,
8448 (program, location, count, transpose, v));
8449 }
8450 }
8451
8452 static void GLAPIENTRY
8453 save_ProgramUniformMatrix2x3fv(GLuint program, GLint location, GLsizei count,
8454 GLboolean transpose, const GLfloat *v)
8455 {
8456 GET_CURRENT_CONTEXT(ctx);
8457 Node *n;
8458 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8459 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX23F,
8460 4 + POINTER_DWORDS);
8461 if (n) {
8462 n[1].ui = program;
8463 n[2].i = location;
8464 n[3].i = count;
8465 n[4].b = transpose;
8466 save_pointer(&n[5], memdup(v, count * 2 * 3 * sizeof(GLfloat)));
8467 }
8468 if (ctx->ExecuteFlag) {
8469 CALL_ProgramUniformMatrix2x3fv(ctx->Exec,
8470 (program, location, count, transpose, v));
8471 }
8472 }
8473
8474 static void GLAPIENTRY
8475 save_ProgramUniformMatrix2x4fv(GLuint program, GLint location, GLsizei count,
8476 GLboolean transpose, const GLfloat *v)
8477 {
8478 GET_CURRENT_CONTEXT(ctx);
8479 Node *n;
8480 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8481 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX24F,
8482 4 + POINTER_DWORDS);
8483 if (n) {
8484 n[1].ui = program;
8485 n[2].i = location;
8486 n[3].i = count;
8487 n[4].b = transpose;
8488 save_pointer(&n[5], memdup(v, count * 2 * 4 * sizeof(GLfloat)));
8489 }
8490 if (ctx->ExecuteFlag) {
8491 CALL_ProgramUniformMatrix2x4fv(ctx->Exec,
8492 (program, location, count, transpose, v));
8493 }
8494 }
8495
8496 static void GLAPIENTRY
8497 save_ProgramUniformMatrix3x2fv(GLuint program, GLint location, GLsizei count,
8498 GLboolean transpose, const GLfloat *v)
8499 {
8500 GET_CURRENT_CONTEXT(ctx);
8501 Node *n;
8502 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8503 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX32F,
8504 4 + POINTER_DWORDS);
8505 if (n) {
8506 n[1].ui = program;
8507 n[2].i = location;
8508 n[3].i = count;
8509 n[4].b = transpose;
8510 save_pointer(&n[5], memdup(v, count * 3 * 2 * sizeof(GLfloat)));
8511 }
8512 if (ctx->ExecuteFlag) {
8513 CALL_ProgramUniformMatrix3x2fv(ctx->Exec,
8514 (program, location, count, transpose, v));
8515 }
8516 }
8517
8518 static void GLAPIENTRY
8519 save_ProgramUniformMatrix3fv(GLuint program, GLint location, GLsizei count,
8520 GLboolean transpose, const GLfloat *v)
8521 {
8522 GET_CURRENT_CONTEXT(ctx);
8523 Node *n;
8524 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8525 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX33F,
8526 4 + POINTER_DWORDS);
8527 if (n) {
8528 n[1].ui = program;
8529 n[2].i = location;
8530 n[3].i = count;
8531 n[4].b = transpose;
8532 save_pointer(&n[5], memdup(v, count * 3 * 3 * sizeof(GLfloat)));
8533 }
8534 if (ctx->ExecuteFlag) {
8535 CALL_ProgramUniformMatrix3fv(ctx->Exec,
8536 (program, location, count, transpose, v));
8537 }
8538 }
8539
8540 static void GLAPIENTRY
8541 save_ProgramUniformMatrix3x4fv(GLuint program, GLint location, GLsizei count,
8542 GLboolean transpose, const GLfloat *v)
8543 {
8544 GET_CURRENT_CONTEXT(ctx);
8545 Node *n;
8546 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8547 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX34F,
8548 4 + POINTER_DWORDS);
8549 if (n) {
8550 n[1].ui = program;
8551 n[2].i = location;
8552 n[3].i = count;
8553 n[4].b = transpose;
8554 save_pointer(&n[5], memdup(v, count * 3 * 4 * sizeof(GLfloat)));
8555 }
8556 if (ctx->ExecuteFlag) {
8557 CALL_ProgramUniformMatrix3x4fv(ctx->Exec,
8558 (program, location, count, transpose, v));
8559 }
8560 }
8561
8562 static void GLAPIENTRY
8563 save_ProgramUniformMatrix4x2fv(GLuint program, GLint location, GLsizei count,
8564 GLboolean transpose, const GLfloat *v)
8565 {
8566 GET_CURRENT_CONTEXT(ctx);
8567 Node *n;
8568 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8569 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX42F,
8570 4 + POINTER_DWORDS);
8571 if (n) {
8572 n[1].ui = program;
8573 n[2].i = location;
8574 n[3].i = count;
8575 n[4].b = transpose;
8576 save_pointer(&n[5], memdup(v, count * 4 * 2 * sizeof(GLfloat)));
8577 }
8578 if (ctx->ExecuteFlag) {
8579 CALL_ProgramUniformMatrix4x2fv(ctx->Exec,
8580 (program, location, count, transpose, v));
8581 }
8582 }
8583
8584 static void GLAPIENTRY
8585 save_ProgramUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count,
8586 GLboolean transpose, const GLfloat *v)
8587 {
8588 GET_CURRENT_CONTEXT(ctx);
8589 Node *n;
8590 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8591 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX43F,
8592 4 + POINTER_DWORDS);
8593 if (n) {
8594 n[1].ui = program;
8595 n[2].i = location;
8596 n[3].i = count;
8597 n[4].b = transpose;
8598 save_pointer(&n[5], memdup(v, count * 4 * 3 * sizeof(GLfloat)));
8599 }
8600 if (ctx->ExecuteFlag) {
8601 CALL_ProgramUniformMatrix4x3fv(ctx->Exec,
8602 (program, location, count, transpose, v));
8603 }
8604 }
8605
8606 static void GLAPIENTRY
8607 save_ProgramUniformMatrix4fv(GLuint program, GLint location, GLsizei count,
8608 GLboolean transpose, const GLfloat *v)
8609 {
8610 GET_CURRENT_CONTEXT(ctx);
8611 Node *n;
8612 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8613 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX44F,
8614 4 + POINTER_DWORDS);
8615 if (n) {
8616 n[1].ui = program;
8617 n[2].i = location;
8618 n[3].i = count;
8619 n[4].b = transpose;
8620 save_pointer(&n[5], memdup(v, count * 4 * 4 * sizeof(GLfloat)));
8621 }
8622 if (ctx->ExecuteFlag) {
8623 CALL_ProgramUniformMatrix4fv(ctx->Exec,
8624 (program, location, count, transpose, v));
8625 }
8626 }
8627
8628 static void GLAPIENTRY
8629 save_ProgramUniformMatrix2dv(GLuint program, GLint location, GLsizei count,
8630 GLboolean transpose, const GLdouble *v)
8631 {
8632 GET_CURRENT_CONTEXT(ctx);
8633 Node *n;
8634 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8635 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX22D,
8636 4 + POINTER_DWORDS);
8637 if (n) {
8638 n[1].ui = program;
8639 n[2].i = location;
8640 n[3].i = count;
8641 n[4].b = transpose;
8642 save_pointer(&n[5], memdup(v, count * 2 * 2 * sizeof(GLdouble)));
8643 }
8644 if (ctx->ExecuteFlag) {
8645 CALL_ProgramUniformMatrix2dv(ctx->Exec,
8646 (program, location, count, transpose, v));
8647 }
8648 }
8649
8650 static void GLAPIENTRY
8651 save_ProgramUniformMatrix2x3dv(GLuint program, GLint location, GLsizei count,
8652 GLboolean transpose, const GLdouble *v)
8653 {
8654 GET_CURRENT_CONTEXT(ctx);
8655 Node *n;
8656 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8657 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX23D,
8658 4 + POINTER_DWORDS);
8659 if (n) {
8660 n[1].ui = program;
8661 n[2].i = location;
8662 n[3].i = count;
8663 n[4].b = transpose;
8664 save_pointer(&n[5], memdup(v, count * 2 * 3 * sizeof(GLdouble)));
8665 }
8666 if (ctx->ExecuteFlag) {
8667 CALL_ProgramUniformMatrix2x3dv(ctx->Exec,
8668 (program, location, count, transpose, v));
8669 }
8670 }
8671
8672 static void GLAPIENTRY
8673 save_ProgramUniformMatrix2x4dv(GLuint program, GLint location, GLsizei count,
8674 GLboolean transpose, const GLdouble *v)
8675 {
8676 GET_CURRENT_CONTEXT(ctx);
8677 Node *n;
8678 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8679 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX24D,
8680 4 + POINTER_DWORDS);
8681 if (n) {
8682 n[1].ui = program;
8683 n[2].i = location;
8684 n[3].i = count;
8685 n[4].b = transpose;
8686 save_pointer(&n[5], memdup(v, count * 2 * 4 * sizeof(GLdouble)));
8687 }
8688 if (ctx->ExecuteFlag) {
8689 CALL_ProgramUniformMatrix2x4dv(ctx->Exec,
8690 (program, location, count, transpose, v));
8691 }
8692 }
8693
8694 static void GLAPIENTRY
8695 save_ProgramUniformMatrix3x2dv(GLuint program, GLint location, GLsizei count,
8696 GLboolean transpose, const GLdouble *v)
8697 {
8698 GET_CURRENT_CONTEXT(ctx);
8699 Node *n;
8700 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8701 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX32D,
8702 4 + POINTER_DWORDS);
8703 if (n) {
8704 n[1].ui = program;
8705 n[2].i = location;
8706 n[3].i = count;
8707 n[4].b = transpose;
8708 save_pointer(&n[5], memdup(v, count * 3 * 2 * sizeof(GLdouble)));
8709 }
8710 if (ctx->ExecuteFlag) {
8711 CALL_ProgramUniformMatrix3x2dv(ctx->Exec,
8712 (program, location, count, transpose, v));
8713 }
8714 }
8715
8716 static void GLAPIENTRY
8717 save_ProgramUniformMatrix3dv(GLuint program, GLint location, GLsizei count,
8718 GLboolean transpose, const GLdouble *v)
8719 {
8720 GET_CURRENT_CONTEXT(ctx);
8721 Node *n;
8722 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8723 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX33D,
8724 4 + POINTER_DWORDS);
8725 if (n) {
8726 n[1].ui = program;
8727 n[2].i = location;
8728 n[3].i = count;
8729 n[4].b = transpose;
8730 save_pointer(&n[5], memdup(v, count * 3 * 3 * sizeof(GLdouble)));
8731 }
8732 if (ctx->ExecuteFlag) {
8733 CALL_ProgramUniformMatrix3dv(ctx->Exec,
8734 (program, location, count, transpose, v));
8735 }
8736 }
8737
8738 static void GLAPIENTRY
8739 save_ProgramUniformMatrix3x4dv(GLuint program, GLint location, GLsizei count,
8740 GLboolean transpose, const GLdouble *v)
8741 {
8742 GET_CURRENT_CONTEXT(ctx);
8743 Node *n;
8744 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8745 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX34D,
8746 4 + POINTER_DWORDS);
8747 if (n) {
8748 n[1].ui = program;
8749 n[2].i = location;
8750 n[3].i = count;
8751 n[4].b = transpose;
8752 save_pointer(&n[5], memdup(v, count * 3 * 4 * sizeof(GLdouble)));
8753 }
8754 if (ctx->ExecuteFlag) {
8755 CALL_ProgramUniformMatrix3x4dv(ctx->Exec,
8756 (program, location, count, transpose, v));
8757 }
8758 }
8759
8760 static void GLAPIENTRY
8761 save_ProgramUniformMatrix4x2dv(GLuint program, GLint location, GLsizei count,
8762 GLboolean transpose, const GLdouble *v)
8763 {
8764 GET_CURRENT_CONTEXT(ctx);
8765 Node *n;
8766 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8767 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX42D,
8768 4 + POINTER_DWORDS);
8769 if (n) {
8770 n[1].ui = program;
8771 n[2].i = location;
8772 n[3].i = count;
8773 n[4].b = transpose;
8774 save_pointer(&n[5], memdup(v, count * 4 * 2 * sizeof(GLdouble)));
8775 }
8776 if (ctx->ExecuteFlag) {
8777 CALL_ProgramUniformMatrix4x2dv(ctx->Exec,
8778 (program, location, count, transpose, v));
8779 }
8780 }
8781
8782 static void GLAPIENTRY
8783 save_ProgramUniformMatrix4x3dv(GLuint program, GLint location, GLsizei count,
8784 GLboolean transpose, const GLdouble *v)
8785 {
8786 GET_CURRENT_CONTEXT(ctx);
8787 Node *n;
8788 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8789 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX43D,
8790 4 + POINTER_DWORDS);
8791 if (n) {
8792 n[1].ui = program;
8793 n[2].i = location;
8794 n[3].i = count;
8795 n[4].b = transpose;
8796 save_pointer(&n[5], memdup(v, count * 4 * 3 * sizeof(GLdouble)));
8797 }
8798 if (ctx->ExecuteFlag) {
8799 CALL_ProgramUniformMatrix4x3dv(ctx->Exec,
8800 (program, location, count, transpose, v));
8801 }
8802 }
8803
8804 static void GLAPIENTRY
8805 save_ProgramUniformMatrix4dv(GLuint program, GLint location, GLsizei count,
8806 GLboolean transpose, const GLdouble *v)
8807 {
8808 GET_CURRENT_CONTEXT(ctx);
8809 Node *n;
8810 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8811 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX44D,
8812 4 + POINTER_DWORDS);
8813 if (n) {
8814 n[1].ui = program;
8815 n[2].i = location;
8816 n[3].i = count;
8817 n[4].b = transpose;
8818 save_pointer(&n[5], memdup(v, count * 4 * 4 * sizeof(GLdouble)));
8819 }
8820 if (ctx->ExecuteFlag) {
8821 CALL_ProgramUniformMatrix4dv(ctx->Exec,
8822 (program, location, count, transpose, v));
8823 }
8824 }
8825
8826 static void GLAPIENTRY
8827 save_ClipControl(GLenum origin, GLenum depth)
8828 {
8829 GET_CURRENT_CONTEXT(ctx);
8830 Node *n;
8831 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8832 n = alloc_instruction(ctx, OPCODE_CLIP_CONTROL, 2);
8833 if (n) {
8834 n[1].e = origin;
8835 n[2].e = depth;
8836 }
8837 if (ctx->ExecuteFlag) {
8838 CALL_ClipControl(ctx->Exec, (origin, depth));
8839 }
8840 }
8841
8842 static void GLAPIENTRY
8843 save_ClampColorARB(GLenum target, GLenum clamp)
8844 {
8845 GET_CURRENT_CONTEXT(ctx);
8846 Node *n;
8847 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8848 n = alloc_instruction(ctx, OPCODE_CLAMP_COLOR, 2);
8849 if (n) {
8850 n[1].e = target;
8851 n[2].e = clamp;
8852 }
8853 if (ctx->ExecuteFlag) {
8854 CALL_ClampColor(ctx->Exec, (target, clamp));
8855 }
8856 }
8857
8858 /** GL_EXT_texture_integer */
8859 static void GLAPIENTRY
8860 save_ClearColorIi(GLint red, GLint green, GLint blue, GLint alpha)
8861 {
8862 GET_CURRENT_CONTEXT(ctx);
8863 Node *n;
8864 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8865 n = alloc_instruction(ctx, OPCODE_CLEARCOLOR_I, 4);
8866 if (n) {
8867 n[1].i = red;
8868 n[2].i = green;
8869 n[3].i = blue;
8870 n[4].i = alpha;
8871 }
8872 if (ctx->ExecuteFlag) {
8873 CALL_ClearColorIiEXT(ctx->Exec, (red, green, blue, alpha));
8874 }
8875 }
8876
8877 /** GL_EXT_texture_integer */
8878 static void GLAPIENTRY
8879 save_ClearColorIui(GLuint red, GLuint green, GLuint blue, GLuint alpha)
8880 {
8881 GET_CURRENT_CONTEXT(ctx);
8882 Node *n;
8883 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8884 n = alloc_instruction(ctx, OPCODE_CLEARCOLOR_UI, 4);
8885 if (n) {
8886 n[1].ui = red;
8887 n[2].ui = green;
8888 n[3].ui = blue;
8889 n[4].ui = alpha;
8890 }
8891 if (ctx->ExecuteFlag) {
8892 CALL_ClearColorIuiEXT(ctx->Exec, (red, green, blue, alpha));
8893 }
8894 }
8895
8896 /** GL_EXT_texture_integer */
8897 static void GLAPIENTRY
8898 save_TexParameterIiv(GLenum target, GLenum pname, const GLint *params)
8899 {
8900 GET_CURRENT_CONTEXT(ctx);
8901 Node *n;
8902 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8903 n = alloc_instruction(ctx, OPCODE_TEXPARAMETER_I, 6);
8904 if (n) {
8905 n[1].e = target;
8906 n[2].e = pname;
8907 n[3].i = params[0];
8908 n[4].i = params[1];
8909 n[5].i = params[2];
8910 n[6].i = params[3];
8911 }
8912 if (ctx->ExecuteFlag) {
8913 CALL_TexParameterIiv(ctx->Exec, (target, pname, params));
8914 }
8915 }
8916
8917 /** GL_EXT_texture_integer */
8918 static void GLAPIENTRY
8919 save_TexParameterIuiv(GLenum target, GLenum pname, const GLuint *params)
8920 {
8921 GET_CURRENT_CONTEXT(ctx);
8922 Node *n;
8923 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8924 n = alloc_instruction(ctx, OPCODE_TEXPARAMETER_UI, 6);
8925 if (n) {
8926 n[1].e = target;
8927 n[2].e = pname;
8928 n[3].ui = params[0];
8929 n[4].ui = params[1];
8930 n[5].ui = params[2];
8931 n[6].ui = params[3];
8932 }
8933 if (ctx->ExecuteFlag) {
8934 CALL_TexParameterIuiv(ctx->Exec, (target, pname, params));
8935 }
8936 }
8937
8938 /* GL_ARB_instanced_arrays */
8939 static void GLAPIENTRY
8940 save_VertexAttribDivisor(GLuint index, GLuint divisor)
8941 {
8942 GET_CURRENT_CONTEXT(ctx);
8943 Node *n;
8944 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8945 n = alloc_instruction(ctx, OPCODE_VERTEX_ATTRIB_DIVISOR, 2);
8946 if (n) {
8947 n[1].ui = index;
8948 n[2].ui = divisor;
8949 }
8950 if (ctx->ExecuteFlag) {
8951 CALL_VertexAttribDivisor(ctx->Exec, (index, divisor));
8952 }
8953 }
8954
8955
8956 /* GL_NV_texture_barrier */
8957 static void GLAPIENTRY
8958 save_TextureBarrierNV(void)
8959 {
8960 GET_CURRENT_CONTEXT(ctx);
8961 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8962 alloc_instruction(ctx, OPCODE_TEXTURE_BARRIER_NV, 0);
8963 if (ctx->ExecuteFlag) {
8964 CALL_TextureBarrierNV(ctx->Exec, ());
8965 }
8966 }
8967
8968
8969 /* GL_ARB_sampler_objects */
8970 static void GLAPIENTRY
8971 save_BindSampler(GLuint unit, GLuint sampler)
8972 {
8973 Node *n;
8974 GET_CURRENT_CONTEXT(ctx);
8975 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8976 n = alloc_instruction(ctx, OPCODE_BIND_SAMPLER, 2);
8977 if (n) {
8978 n[1].ui = unit;
8979 n[2].ui = sampler;
8980 }
8981 if (ctx->ExecuteFlag) {
8982 CALL_BindSampler(ctx->Exec, (unit, sampler));
8983 }
8984 }
8985
8986 static void GLAPIENTRY
8987 save_SamplerParameteriv(GLuint sampler, GLenum pname, const GLint *params)
8988 {
8989 Node *n;
8990 GET_CURRENT_CONTEXT(ctx);
8991 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8992 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERIV, 6);
8993 if (n) {
8994 n[1].ui = sampler;
8995 n[2].e = pname;
8996 n[3].i = params[0];
8997 if (pname == GL_TEXTURE_BORDER_COLOR) {
8998 n[4].i = params[1];
8999 n[5].i = params[2];
9000 n[6].i = params[3];
9001 }
9002 else {
9003 n[4].i = n[5].i = n[6].i = 0;
9004 }
9005 }
9006 if (ctx->ExecuteFlag) {
9007 CALL_SamplerParameteriv(ctx->Exec, (sampler, pname, params));
9008 }
9009 }
9010
9011 static void GLAPIENTRY
9012 save_SamplerParameteri(GLuint sampler, GLenum pname, GLint param)
9013 {
9014 GLint parray[4];
9015 parray[0] = param;
9016 parray[1] = parray[2] = parray[3] = 0;
9017 save_SamplerParameteriv(sampler, pname, parray);
9018 }
9019
9020 static void GLAPIENTRY
9021 save_SamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *params)
9022 {
9023 Node *n;
9024 GET_CURRENT_CONTEXT(ctx);
9025 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9026 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERFV, 6);
9027 if (n) {
9028 n[1].ui = sampler;
9029 n[2].e = pname;
9030 n[3].f = params[0];
9031 if (pname == GL_TEXTURE_BORDER_COLOR) {
9032 n[4].f = params[1];
9033 n[5].f = params[2];
9034 n[6].f = params[3];
9035 }
9036 else {
9037 n[4].f = n[5].f = n[6].f = 0.0F;
9038 }
9039 }
9040 if (ctx->ExecuteFlag) {
9041 CALL_SamplerParameterfv(ctx->Exec, (sampler, pname, params));
9042 }
9043 }
9044
9045 static void GLAPIENTRY
9046 save_SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
9047 {
9048 GLfloat parray[4];
9049 parray[0] = param;
9050 parray[1] = parray[2] = parray[3] = 0.0F;
9051 save_SamplerParameterfv(sampler, pname, parray);
9052 }
9053
9054 static void GLAPIENTRY
9055 save_SamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *params)
9056 {
9057 Node *n;
9058 GET_CURRENT_CONTEXT(ctx);
9059 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9060 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERIIV, 6);
9061 if (n) {
9062 n[1].ui = sampler;
9063 n[2].e = pname;
9064 n[3].i = params[0];
9065 if (pname == GL_TEXTURE_BORDER_COLOR) {
9066 n[4].i = params[1];
9067 n[5].i = params[2];
9068 n[6].i = params[3];
9069 }
9070 else {
9071 n[4].i = n[5].i = n[6].i = 0;
9072 }
9073 }
9074 if (ctx->ExecuteFlag) {
9075 CALL_SamplerParameterIiv(ctx->Exec, (sampler, pname, params));
9076 }
9077 }
9078
9079 static void GLAPIENTRY
9080 save_SamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *params)
9081 {
9082 Node *n;
9083 GET_CURRENT_CONTEXT(ctx);
9084 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9085 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERUIV, 6);
9086 if (n) {
9087 n[1].ui = sampler;
9088 n[2].e = pname;
9089 n[3].ui = params[0];
9090 if (pname == GL_TEXTURE_BORDER_COLOR) {
9091 n[4].ui = params[1];
9092 n[5].ui = params[2];
9093 n[6].ui = params[3];
9094 }
9095 else {
9096 n[4].ui = n[5].ui = n[6].ui = 0;
9097 }
9098 }
9099 if (ctx->ExecuteFlag) {
9100 CALL_SamplerParameterIuiv(ctx->Exec, (sampler, pname, params));
9101 }
9102 }
9103
9104 static void GLAPIENTRY
9105 save_WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
9106 {
9107 Node *n;
9108 GET_CURRENT_CONTEXT(ctx);
9109 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9110 n = alloc_instruction(ctx, OPCODE_WAIT_SYNC, 4);
9111 if (n) {
9112 union uint64_pair p;
9113 p.uint64 = timeout;
9114 n[1].bf = flags;
9115 n[2].ui = p.uint32[0];
9116 n[3].ui = p.uint32[1];
9117 save_pointer(&n[4], sync);
9118 }
9119 if (ctx->ExecuteFlag) {
9120 CALL_WaitSync(ctx->Exec, (sync, flags, timeout));
9121 }
9122 }
9123
9124
9125 /** GL_NV_conditional_render */
9126 static void GLAPIENTRY
9127 save_BeginConditionalRender(GLuint queryId, GLenum mode)
9128 {
9129 GET_CURRENT_CONTEXT(ctx);
9130 Node *n;
9131 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9132 n = alloc_instruction(ctx, OPCODE_BEGIN_CONDITIONAL_RENDER, 2);
9133 if (n) {
9134 n[1].i = queryId;
9135 n[2].e = mode;
9136 }
9137 if (ctx->ExecuteFlag) {
9138 CALL_BeginConditionalRender(ctx->Exec, (queryId, mode));
9139 }
9140 }
9141
9142 static void GLAPIENTRY
9143 save_EndConditionalRender(void)
9144 {
9145 GET_CURRENT_CONTEXT(ctx);
9146 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9147 alloc_instruction(ctx, OPCODE_END_CONDITIONAL_RENDER, 0);
9148 if (ctx->ExecuteFlag) {
9149 CALL_EndConditionalRender(ctx->Exec, ());
9150 }
9151 }
9152
9153 static void GLAPIENTRY
9154 save_UniformBlockBinding(GLuint prog, GLuint index, GLuint binding)
9155 {
9156 GET_CURRENT_CONTEXT(ctx);
9157 Node *n;
9158 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9159 n = alloc_instruction(ctx, OPCODE_UNIFORM_BLOCK_BINDING, 3);
9160 if (n) {
9161 n[1].ui = prog;
9162 n[2].ui = index;
9163 n[3].ui = binding;
9164 }
9165 if (ctx->ExecuteFlag) {
9166 CALL_UniformBlockBinding(ctx->Exec, (prog, index, binding));
9167 }
9168 }
9169
9170 static void GLAPIENTRY
9171 save_UniformSubroutinesuiv(GLenum shadertype, GLsizei count,
9172 const GLuint *indices)
9173 {
9174 GET_CURRENT_CONTEXT(ctx);
9175 Node *n;
9176 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9177 n = alloc_instruction(ctx, OPCODE_UNIFORM_SUBROUTINES, 2 + POINTER_DWORDS);
9178 if (n) {
9179 GLint *indices_copy = NULL;
9180
9181 if (count > 0)
9182 indices_copy = memdup(indices, sizeof(GLuint) * 4 * count);
9183 n[1].e = shadertype;
9184 n[2].si = count;
9185 save_pointer(&n[3], indices_copy);
9186 }
9187 if (ctx->ExecuteFlag) {
9188 CALL_UniformSubroutinesuiv(ctx->Exec, (shadertype, count, indices));
9189 }
9190 }
9191
9192 /** GL_EXT_window_rectangles */
9193 static void GLAPIENTRY
9194 save_WindowRectanglesEXT(GLenum mode, GLsizei count, const GLint *box)
9195 {
9196 GET_CURRENT_CONTEXT(ctx);
9197 Node *n;
9198 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9199 n = alloc_instruction(ctx, OPCODE_WINDOW_RECTANGLES, 2 + POINTER_DWORDS);
9200 if (n) {
9201 GLint *box_copy = NULL;
9202
9203 if (count > 0)
9204 box_copy = memdup(box, sizeof(GLint) * 4 * count);
9205 n[1].e = mode;
9206 n[2].si = count;
9207 save_pointer(&n[3], box_copy);
9208 }
9209 if (ctx->ExecuteFlag) {
9210 CALL_WindowRectanglesEXT(ctx->Exec, (mode, count, box));
9211 }
9212 }
9213
9214
9215 /** GL_NV_conservative_raster */
9216 static void GLAPIENTRY
9217 save_SubpixelPrecisionBiasNV(GLuint xbits, GLuint ybits)
9218 {
9219 GET_CURRENT_CONTEXT(ctx);
9220 Node *n;
9221 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9222 n = alloc_instruction(ctx, OPCODE_SUBPIXEL_PRECISION_BIAS, 2);
9223 if (n) {
9224 n[1].ui = xbits;
9225 n[2].ui = ybits;
9226 }
9227 if (ctx->ExecuteFlag) {
9228 CALL_SubpixelPrecisionBiasNV(ctx->Exec, (xbits, ybits));
9229 }
9230 }
9231
9232 /** GL_NV_conservative_raster_dilate */
9233 static void GLAPIENTRY
9234 save_ConservativeRasterParameterfNV(GLenum pname, GLfloat param)
9235 {
9236 GET_CURRENT_CONTEXT(ctx);
9237 Node *n;
9238 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9239 n = alloc_instruction(ctx, OPCODE_CONSERVATIVE_RASTER_PARAMETER_F, 2);
9240 if (n) {
9241 n[1].e = pname;
9242 n[2].f = param;
9243 }
9244 if (ctx->ExecuteFlag) {
9245 CALL_ConservativeRasterParameterfNV(ctx->Exec, (pname, param));
9246 }
9247 }
9248
9249 /** GL_NV_conservative_raster_pre_snap_triangles */
9250 static void GLAPIENTRY
9251 save_ConservativeRasterParameteriNV(GLenum pname, GLint param)
9252 {
9253 GET_CURRENT_CONTEXT(ctx);
9254 Node *n;
9255 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9256 n = alloc_instruction(ctx, OPCODE_CONSERVATIVE_RASTER_PARAMETER_I, 2);
9257 if (n) {
9258 n[1].e = pname;
9259 n[2].i = param;
9260 }
9261 if (ctx->ExecuteFlag) {
9262 CALL_ConservativeRasterParameteriNV(ctx->Exec, (pname, param));
9263 }
9264 }
9265
9266 /** GL_EXT_direct_state_access */
9267
9268 static void GLAPIENTRY
9269 save_MatrixLoadfEXT(GLenum matrixMode, const GLfloat *m)
9270 {
9271 GET_CURRENT_CONTEXT(ctx);
9272 Node *n;
9273 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9274 n = alloc_instruction(ctx, OPCODE_MATRIX_LOAD, 17);
9275 if (n) {
9276 n[1].e = matrixMode;
9277 for (unsigned i = 0; i < 16; i++) {
9278 n[2 + i].f = m[i];
9279 }
9280 }
9281 if (ctx->ExecuteFlag) {
9282 CALL_MatrixLoadfEXT(ctx->Exec, (matrixMode, m));
9283 }
9284 }
9285
9286 static void GLAPIENTRY
9287 save_MatrixLoaddEXT(GLenum matrixMode, const GLdouble *m)
9288 {
9289 GLfloat f[16];
9290 for (unsigned i = 0; i < 16; i++) {
9291 f[i] = (GLfloat) m[i];
9292 }
9293 save_MatrixLoadfEXT(matrixMode, f);
9294 }
9295
9296 static void GLAPIENTRY
9297 save_MatrixMultfEXT(GLenum matrixMode, const GLfloat * m)
9298 {
9299 GET_CURRENT_CONTEXT(ctx);
9300 Node *n;
9301 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9302 n = alloc_instruction(ctx, OPCODE_MATRIX_MULT, 17);
9303 if (n) {
9304 n[1].e = matrixMode;
9305 for (unsigned i = 0; i < 16; i++) {
9306 n[2 + i].f = m[i];
9307 }
9308 }
9309 if (ctx->ExecuteFlag) {
9310 CALL_MatrixMultfEXT(ctx->Exec, (matrixMode, m));
9311 }
9312 }
9313
9314 static void GLAPIENTRY
9315 save_MatrixMultdEXT(GLenum matrixMode, const GLdouble * m)
9316 {
9317 GLfloat f[16];
9318 for (unsigned i = 0; i < 16; i++) {
9319 f[i] = (GLfloat) m[i];
9320 }
9321 save_MatrixMultfEXT(matrixMode, f);
9322 }
9323
9324 static void GLAPIENTRY
9325 save_MatrixRotatefEXT(GLenum matrixMode, GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
9326 {
9327 GET_CURRENT_CONTEXT(ctx);
9328 Node *n;
9329 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9330 n = alloc_instruction(ctx, OPCODE_MATRIX_ROTATE, 5);
9331 if (n) {
9332 n[1].e = matrixMode;
9333 n[2].f = angle;
9334 n[3].f = x;
9335 n[4].f = y;
9336 n[5].f = z;
9337 }
9338 if (ctx->ExecuteFlag) {
9339 CALL_MatrixRotatefEXT(ctx->Exec, (matrixMode, angle, x, y, z));
9340 }
9341 }
9342
9343 static void GLAPIENTRY
9344 save_MatrixRotatedEXT(GLenum matrixMode, GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
9345 {
9346 save_MatrixRotatefEXT(matrixMode, (GLfloat) angle, (GLfloat) x, (GLfloat) y, (GLfloat) z);
9347 }
9348
9349 static void GLAPIENTRY
9350 save_MatrixScalefEXT(GLenum matrixMode, GLfloat x, GLfloat y, GLfloat z)
9351 {
9352 GET_CURRENT_CONTEXT(ctx);
9353 Node *n;
9354 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9355 n = alloc_instruction(ctx, OPCODE_MATRIX_SCALE, 4);
9356 if (n) {
9357 n[1].e = matrixMode;
9358 n[2].f = x;
9359 n[3].f = y;
9360 n[4].f = z;
9361 }
9362 if (ctx->ExecuteFlag) {
9363 CALL_MatrixScalefEXT(ctx->Exec, (matrixMode, x, y, z));
9364 }
9365 }
9366
9367 static void GLAPIENTRY
9368 save_MatrixScaledEXT(GLenum matrixMode, GLdouble x, GLdouble y, GLdouble z)
9369 {
9370 save_MatrixScalefEXT(matrixMode, (GLfloat) x, (GLfloat) y, (GLfloat) z);
9371 }
9372
9373 static void GLAPIENTRY
9374 save_MatrixTranslatefEXT(GLenum matrixMode, GLfloat x, GLfloat y, GLfloat z)
9375 {
9376 GET_CURRENT_CONTEXT(ctx);
9377 Node *n;
9378 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9379 n = alloc_instruction(ctx, OPCODE_MATRIX_TRANSLATE, 4);
9380 if (n) {
9381 n[1].e = matrixMode;
9382 n[2].f = x;
9383 n[3].f = y;
9384 n[4].f = z;
9385 }
9386 if (ctx->ExecuteFlag) {
9387 CALL_MatrixTranslatefEXT(ctx->Exec, (matrixMode, x, y, z));
9388 }
9389 }
9390
9391 static void GLAPIENTRY
9392 save_MatrixTranslatedEXT(GLenum matrixMode, GLdouble x, GLdouble y, GLdouble z)
9393 {
9394 save_MatrixTranslatefEXT(matrixMode, (GLfloat) x, (GLfloat) y, (GLfloat) z);
9395 }
9396
9397 static void GLAPIENTRY
9398 save_MatrixLoadIdentityEXT(GLenum matrixMode)
9399 {
9400 GET_CURRENT_CONTEXT(ctx);
9401 Node *n;
9402 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9403 n = alloc_instruction(ctx, OPCODE_MATRIX_LOAD_IDENTITY, 1);
9404 if (n) {
9405 n[1].e = matrixMode;
9406 }
9407 if (ctx->ExecuteFlag) {
9408 CALL_MatrixLoadIdentityEXT(ctx->Exec, (matrixMode));
9409 }
9410 }
9411
9412 static void GLAPIENTRY
9413 save_MatrixOrthoEXT(GLenum matrixMode, GLdouble left, GLdouble right,
9414 GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval)
9415 {
9416 GET_CURRENT_CONTEXT(ctx);
9417 Node *n;
9418 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9419 n = alloc_instruction(ctx, OPCODE_MATRIX_ORTHO, 7);
9420 if (n) {
9421 n[1].e = matrixMode;
9422 n[2].f = (GLfloat) left;
9423 n[3].f = (GLfloat) right;
9424 n[4].f = (GLfloat) bottom;
9425 n[5].f = (GLfloat) top;
9426 n[6].f = (GLfloat) nearval;
9427 n[7].f = (GLfloat) farval;
9428 }
9429 if (ctx->ExecuteFlag) {
9430 CALL_MatrixOrthoEXT(ctx->Exec, (matrixMode, left, right, bottom, top, nearval, farval));
9431 }
9432 }
9433
9434
9435 static void GLAPIENTRY
9436 save_MatrixFrustumEXT(GLenum matrixMode, GLdouble left, GLdouble right,
9437 GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval)
9438 {
9439 GET_CURRENT_CONTEXT(ctx);
9440 Node *n;
9441 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9442 n = alloc_instruction(ctx, OPCODE_MATRIX_FRUSTUM, 7);
9443 if (n) {
9444 n[1].e = matrixMode;
9445 n[2].f = (GLfloat) left;
9446 n[3].f = (GLfloat) right;
9447 n[4].f = (GLfloat) bottom;
9448 n[5].f = (GLfloat) top;
9449 n[6].f = (GLfloat) nearval;
9450 n[7].f = (GLfloat) farval;
9451 }
9452 if (ctx->ExecuteFlag) {
9453 CALL_MatrixFrustumEXT(ctx->Exec, (matrixMode, left, right, bottom, top, nearval, farval));
9454 }
9455 }
9456
9457 static void GLAPIENTRY
9458 save_MatrixPushEXT(GLenum matrixMode)
9459 {
9460 GET_CURRENT_CONTEXT(ctx);
9461 Node* n;
9462 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9463 n = alloc_instruction(ctx, OPCODE_MATRIX_PUSH, 1);
9464 if (n) {
9465 n[1].e = matrixMode;
9466 }
9467 if (ctx->ExecuteFlag) {
9468 CALL_MatrixPushEXT(ctx->Exec, (matrixMode));
9469 }
9470 }
9471
9472 static void GLAPIENTRY
9473 save_MatrixPopEXT(GLenum matrixMode)
9474 {
9475 GET_CURRENT_CONTEXT(ctx);
9476 Node* n;
9477 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9478 n = alloc_instruction(ctx, OPCODE_MATRIX_POP, 1);
9479 if (n) {
9480 n[1].e = matrixMode;
9481 }
9482 if (ctx->ExecuteFlag) {
9483 CALL_MatrixPopEXT(ctx->Exec, (matrixMode));
9484 }
9485 }
9486
9487 static void GLAPIENTRY
9488 save_MatrixLoadTransposefEXT(GLenum matrixMode, const GLfloat m[16])
9489 {
9490 GLfloat tm[16];
9491 _math_transposef(tm, m);
9492 save_MatrixLoadfEXT(matrixMode, tm);
9493 }
9494
9495 static void GLAPIENTRY
9496 save_MatrixLoadTransposedEXT(GLenum matrixMode, const GLdouble m[16])
9497 {
9498 GLfloat tm[16];
9499 _math_transposefd(tm, m);
9500 save_MatrixLoadfEXT(matrixMode, tm);
9501 }
9502
9503 static void GLAPIENTRY
9504 save_MatrixMultTransposefEXT(GLenum matrixMode, const GLfloat m[16])
9505 {
9506 GLfloat tm[16];
9507 _math_transposef(tm, m);
9508 save_MatrixMultfEXT(matrixMode, tm);
9509 }
9510
9511 static void GLAPIENTRY
9512 save_MatrixMultTransposedEXT(GLenum matrixMode, const GLdouble m[16])
9513 {
9514 GLfloat tm[16];
9515 _math_transposefd(tm, m);
9516 save_MatrixMultfEXT(matrixMode, tm);
9517 }
9518
9519 static void GLAPIENTRY
9520 save_TextureParameterfvEXT(GLuint texture, GLenum target, GLenum pname,
9521 const GLfloat *params)
9522 {
9523 GET_CURRENT_CONTEXT(ctx);
9524 Node *n;
9525 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9526 n = alloc_instruction(ctx, OPCODE_TEXTUREPARAMETER_F, 7);
9527 if (n) {
9528 n[1].ui = texture;
9529 n[2].e = target;
9530 n[3].e = pname;
9531 n[4].f = params[0];
9532 n[5].f = params[1];
9533 n[6].f = params[2];
9534 n[7].f = params[3];
9535 }
9536 if (ctx->ExecuteFlag) {
9537 CALL_TextureParameterfvEXT(ctx->Exec, (texture, target, pname, params));
9538 }
9539 }
9540
9541
9542 static void GLAPIENTRY
9543 save_TextureParameterfEXT(GLuint texture, GLenum target, GLenum pname, GLfloat param)
9544 {
9545 GLfloat parray[4];
9546 parray[0] = param;
9547 parray[1] = parray[2] = parray[3] = 0.0F;
9548 save_TextureParameterfvEXT(texture, target, pname, parray);
9549 }
9550
9551 static void GLAPIENTRY
9552 save_TextureParameterivEXT(GLuint texture, GLenum target, GLenum pname, const GLint *params)
9553 {
9554 GET_CURRENT_CONTEXT(ctx);
9555 Node *n;
9556 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9557 n = alloc_instruction(ctx, OPCODE_TEXTUREPARAMETER_I, 7);
9558 if (n) {
9559 n[1].ui = texture;
9560 n[2].e = target;
9561 n[3].e = pname;
9562 n[4].i = params[0];
9563 n[5].i = params[1];
9564 n[6].i = params[2];
9565 n[7].i = params[3];
9566 }
9567 if (ctx->ExecuteFlag) {
9568 CALL_TextureParameterivEXT(ctx->Exec, (texture, target, pname, params));
9569 }
9570 }
9571
9572 static void GLAPIENTRY
9573 save_TextureParameteriEXT(GLuint texture, GLenum target, GLenum pname, GLint param)
9574 {
9575 GLint fparam[4];
9576 fparam[0] = param;
9577 fparam[1] = fparam[2] = fparam[3] = 0;
9578 save_TextureParameterivEXT(texture, target, pname, fparam);
9579 }
9580
9581 static void GLAPIENTRY
9582 save_TextureImage1DEXT(GLuint texture, GLenum target,
9583 GLint level, GLint components,
9584 GLsizei width, GLint border,
9585 GLenum format, GLenum type, const GLvoid * pixels)
9586 {
9587 GET_CURRENT_CONTEXT(ctx);
9588 if (target == GL_PROXY_TEXTURE_1D) {
9589 /* don't compile, execute immediately */
9590 CALL_TextureImage1DEXT(ctx->Exec, (texture, target, level, components, width,
9591 border, format, type, pixels));
9592 }
9593 else {
9594 Node *n;
9595 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9596 n = alloc_instruction(ctx, OPCODE_TEXTURE_IMAGE1D, 8 + POINTER_DWORDS);
9597 if (n) {
9598 n[1].ui = texture;
9599 n[2].e = target;
9600 n[3].i = level;
9601 n[4].i = components;
9602 n[5].i = (GLint) width;
9603 n[6].i = border;
9604 n[7].e = format;
9605 n[8].e = type;
9606 save_pointer(&n[9],
9607 unpack_image(ctx, 1, width, 1, 1, format, type,
9608 pixels, &ctx->Unpack));
9609 }
9610 if (ctx->ExecuteFlag) {
9611 CALL_TextureImage1DEXT(ctx->Exec, (texture, target, level, components, width,
9612 border, format, type, pixels));
9613 }
9614 }
9615 }
9616
9617
9618 static void GLAPIENTRY
9619 save_TextureImage2DEXT(GLuint texture, GLenum target,
9620 GLint level, GLint components,
9621 GLsizei width, GLsizei height, GLint border,
9622 GLenum format, GLenum type, const GLvoid * pixels)
9623 {
9624 GET_CURRENT_CONTEXT(ctx);
9625 if (target == GL_PROXY_TEXTURE_2D) {
9626 /* don't compile, execute immediately */
9627 CALL_TextureImage2DEXT(ctx->Exec, (texture, target, level, components, width,
9628 height, border, format, type, pixels));
9629 }
9630 else {
9631 Node *n;
9632 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9633 n = alloc_instruction(ctx, OPCODE_TEXTURE_IMAGE2D, 9 + POINTER_DWORDS);
9634 if (n) {
9635 n[1].ui = texture;
9636 n[2].e = target;
9637 n[3].i = level;
9638 n[4].i = components;
9639 n[5].i = (GLint) width;
9640 n[6].i = (GLint) height;
9641 n[7].i = border;
9642 n[8].e = format;
9643 n[9].e = type;
9644 save_pointer(&n[10],
9645 unpack_image(ctx, 2, width, height, 1, format, type,
9646 pixels, &ctx->Unpack));
9647 }
9648 if (ctx->ExecuteFlag) {
9649 CALL_TextureImage2DEXT(ctx->Exec, (texture, target, level, components, width,
9650 height, border, format, type, pixels));
9651 }
9652 }
9653 }
9654
9655
9656 static void GLAPIENTRY
9657 save_TextureImage3DEXT(GLuint texture, GLenum target,
9658 GLint level, GLint internalFormat,
9659 GLsizei width, GLsizei height, GLsizei depth,
9660 GLint border,
9661 GLenum format, GLenum type, const GLvoid * pixels)
9662 {
9663 GET_CURRENT_CONTEXT(ctx);
9664 if (target == GL_PROXY_TEXTURE_3D) {
9665 /* don't compile, execute immediately */
9666 CALL_TextureImage3DEXT(ctx->Exec, (texture, target, level, internalFormat, width,
9667 height, depth, border, format, type,
9668 pixels));
9669 }
9670 else {
9671 Node *n;
9672 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9673 n = alloc_instruction(ctx, OPCODE_TEXTURE_IMAGE3D, 10 + POINTER_DWORDS);
9674 if (n) {
9675 n[1].ui = texture;
9676 n[2].e = target;
9677 n[3].i = level;
9678 n[4].i = (GLint) internalFormat;
9679 n[5].i = (GLint) width;
9680 n[6].i = (GLint) height;
9681 n[7].i = (GLint) depth;
9682 n[8].i = border;
9683 n[9].e = format;
9684 n[10].e = type;
9685 save_pointer(&n[11],
9686 unpack_image(ctx, 3, width, height, depth, format, type,
9687 pixels, &ctx->Unpack));
9688 }
9689 if (ctx->ExecuteFlag) {
9690 CALL_TextureImage3DEXT(ctx->Exec, (texture, target, level, internalFormat,
9691 width, height, depth, border, format,
9692 type, pixels));
9693 }
9694 }
9695 }
9696
9697
9698 static void GLAPIENTRY
9699 save_TextureSubImage1DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset,
9700 GLsizei width, GLenum format, GLenum type,
9701 const GLvoid * pixels)
9702 {
9703 GET_CURRENT_CONTEXT(ctx);
9704 Node *n;
9705
9706 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9707
9708 n = alloc_instruction(ctx, OPCODE_TEXTURE_SUB_IMAGE1D, 7 + POINTER_DWORDS);
9709 if (n) {
9710 n[1].ui = texture;
9711 n[2].e = target;
9712 n[3].i = level;
9713 n[4].i = xoffset;
9714 n[5].i = (GLint) width;
9715 n[6].e = format;
9716 n[7].e = type;
9717 save_pointer(&n[8],
9718 unpack_image(ctx, 1, width, 1, 1, format, type,
9719 pixels, &ctx->Unpack));
9720 }
9721 if (ctx->ExecuteFlag) {
9722 CALL_TextureSubImage1DEXT(ctx->Exec, (texture, target, level, xoffset, width,
9723 format, type, pixels));
9724 }
9725 }
9726
9727
9728 static void GLAPIENTRY
9729 save_TextureSubImage2DEXT(GLuint texture, GLenum target, GLint level,
9730 GLint xoffset, GLint yoffset,
9731 GLsizei width, GLsizei height,
9732 GLenum format, GLenum type, const GLvoid * pixels)
9733 {
9734 GET_CURRENT_CONTEXT(ctx);
9735 Node *n;
9736
9737 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9738
9739 n = alloc_instruction(ctx, OPCODE_TEXTURE_SUB_IMAGE2D, 9 + POINTER_DWORDS);
9740 if (n) {
9741 n[1].ui = texture;
9742 n[2].e = target;
9743 n[3].i = level;
9744 n[4].i = xoffset;
9745 n[5].i = yoffset;
9746 n[6].i = (GLint) width;
9747 n[7].i = (GLint) height;
9748 n[8].e = format;
9749 n[9].e = type;
9750 save_pointer(&n[10],
9751 unpack_image(ctx, 2, width, height, 1, format, type,
9752 pixels, &ctx->Unpack));
9753 }
9754 if (ctx->ExecuteFlag) {
9755 CALL_TextureSubImage2DEXT(ctx->Exec, (texture, target, level, xoffset, yoffset,
9756 width, height, format, type, pixels));
9757 }
9758 }
9759
9760
9761 static void GLAPIENTRY
9762 save_TextureSubImage3DEXT(GLuint texture, GLenum target, GLint level,
9763 GLint xoffset, GLint yoffset, GLint zoffset,
9764 GLsizei width, GLsizei height, GLsizei depth,
9765 GLenum format, GLenum type, const GLvoid * pixels)
9766 {
9767 GET_CURRENT_CONTEXT(ctx);
9768 Node *n;
9769
9770 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9771
9772 n = alloc_instruction(ctx, OPCODE_TEXTURE_SUB_IMAGE3D, 11 + POINTER_DWORDS);
9773 if (n) {
9774 n[1].ui = texture;
9775 n[2].e = target;
9776 n[3].i = level;
9777 n[4].i = xoffset;
9778 n[5].i = yoffset;
9779 n[6].i = zoffset;
9780 n[7].i = (GLint) width;
9781 n[8].i = (GLint) height;
9782 n[9].i = (GLint) depth;
9783 n[10].e = format;
9784 n[11].e = type;
9785 save_pointer(&n[12],
9786 unpack_image(ctx, 3, width, height, depth, format, type,
9787 pixels, &ctx->Unpack));
9788 }
9789 if (ctx->ExecuteFlag) {
9790 CALL_TextureSubImage3DEXT(ctx->Exec, (texture, target, level,
9791 xoffset, yoffset, zoffset,
9792 width, height, depth, format, type,
9793 pixels));
9794 }
9795 }
9796
9797 static void GLAPIENTRY
9798 save_CopyTextureImage1DEXT(GLuint texture, GLenum target, GLint level,
9799 GLenum internalformat, GLint x, GLint y,
9800 GLsizei width, GLint border)
9801 {
9802 GET_CURRENT_CONTEXT(ctx);
9803 Node *n;
9804 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9805 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_IMAGE1D, 8);
9806 if (n) {
9807 n[1].ui = texture;
9808 n[2].e = target;
9809 n[3].i = level;
9810 n[4].e = internalformat;
9811 n[5].i = x;
9812 n[6].i = y;
9813 n[7].i = width;
9814 n[8].i = border;
9815 }
9816 if (ctx->ExecuteFlag) {
9817 CALL_CopyTextureImage1DEXT(ctx->Exec, (texture, target, level,
9818 internalformat, x, y,
9819 width, border));
9820 }
9821 }
9822
9823 static void GLAPIENTRY
9824 save_CopyTextureImage2DEXT(GLuint texture, GLenum target, GLint level,
9825 GLenum internalformat,
9826 GLint x, GLint y, GLsizei width,
9827 GLsizei height, GLint border)
9828 {
9829 GET_CURRENT_CONTEXT(ctx);
9830 Node *n;
9831 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9832 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_IMAGE2D, 9);
9833 if (n) {
9834 n[1].ui = texture;
9835 n[2].e = target;
9836 n[3].i = level;
9837 n[4].e = internalformat;
9838 n[5].i = x;
9839 n[6].i = y;
9840 n[7].i = width;
9841 n[8].i = height;
9842 n[9].i = border;
9843 }
9844 if (ctx->ExecuteFlag) {
9845 CALL_CopyTextureImage2DEXT(ctx->Exec, (texture, target, level,
9846 internalformat, x, y,
9847 width, height, border));
9848 }
9849 }
9850
9851 static void GLAPIENTRY
9852 save_CopyTextureSubImage1DEXT(GLuint texture, GLenum target, GLint level,
9853 GLint xoffset, GLint x, GLint y, GLsizei width)
9854 {
9855 GET_CURRENT_CONTEXT(ctx);
9856 Node *n;
9857 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9858 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_SUB_IMAGE1D, 7);
9859 if (n) {
9860 n[1].ui = texture;
9861 n[2].e = target;
9862 n[3].i = level;
9863 n[4].i = xoffset;
9864 n[5].i = x;
9865 n[6].i = y;
9866 n[7].i = width;
9867 }
9868 if (ctx->ExecuteFlag) {
9869 CALL_CopyTextureSubImage1DEXT(ctx->Exec,
9870 (texture, target, level, xoffset, x, y, width));
9871 }
9872 }
9873
9874 static void GLAPIENTRY
9875 save_CopyTextureSubImage2DEXT(GLuint texture, GLenum target, GLint level,
9876 GLint xoffset, GLint yoffset,
9877 GLint x, GLint y, GLsizei width, GLint height)
9878 {
9879 GET_CURRENT_CONTEXT(ctx);
9880 Node *n;
9881 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9882 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_SUB_IMAGE2D, 9);
9883 if (n) {
9884 n[1].ui = texture;
9885 n[2].e = target;
9886 n[3].i = level;
9887 n[4].i = xoffset;
9888 n[5].i = yoffset;
9889 n[6].i = x;
9890 n[7].i = y;
9891 n[8].i = width;
9892 n[9].i = height;
9893 }
9894 if (ctx->ExecuteFlag) {
9895 CALL_CopyTextureSubImage2DEXT(ctx->Exec, (texture, target, level,
9896 xoffset, yoffset,
9897 x, y, width, height));
9898 }
9899 }
9900
9901
9902 static void GLAPIENTRY
9903 save_CopyTextureSubImage3DEXT(GLuint texture, GLenum target, GLint level,
9904 GLint xoffset, GLint yoffset, GLint zoffset,
9905 GLint x, GLint y, GLsizei width, GLint height)
9906 {
9907 GET_CURRENT_CONTEXT(ctx);
9908 Node *n;
9909 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9910 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_SUB_IMAGE3D, 10);
9911 if (n) {
9912 n[1].ui = texture;
9913 n[2].e = target;
9914 n[3].i = level;
9915 n[4].i = xoffset;
9916 n[5].i = yoffset;
9917 n[6].i = zoffset;
9918 n[7].i = x;
9919 n[8].i = y;
9920 n[9].i = width;
9921 n[10].i = height;
9922 }
9923 if (ctx->ExecuteFlag) {
9924 CALL_CopyTextureSubImage3DEXT(ctx->Exec, (texture, target, level,
9925 xoffset, yoffset, zoffset,
9926 x, y, width, height));
9927 }
9928 }
9929
9930
9931 static void GLAPIENTRY
9932 save_BindMultiTextureEXT(GLenum texunit, GLenum target, GLuint texture)
9933 {
9934 GET_CURRENT_CONTEXT(ctx);
9935 Node *n;
9936 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9937 n = alloc_instruction(ctx, OPCODE_BIND_MULTITEXTURE, 3);
9938 if (n) {
9939 n[1].e = texunit;
9940 n[2].e = target;
9941 n[3].ui = texture;
9942 }
9943 if (ctx->ExecuteFlag) {
9944 CALL_BindMultiTextureEXT(ctx->Exec, (texunit, target, texture));
9945 }
9946 }
9947
9948
9949 static void GLAPIENTRY
9950 save_MultiTexParameterfvEXT(GLenum texunit, GLenum target, GLenum pname,
9951 const GLfloat *params)
9952 {
9953 GET_CURRENT_CONTEXT(ctx);
9954 Node *n;
9955 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9956 n = alloc_instruction(ctx, OPCODE_MULTITEXPARAMETER_F, 7);
9957 if (n) {
9958 n[1].e = texunit;
9959 n[2].e = target;
9960 n[3].e = pname;
9961 n[4].f = params[0];
9962 n[5].f = params[1];
9963 n[6].f = params[2];
9964 n[7].f = params[3];
9965 }
9966 if (ctx->ExecuteFlag) {
9967 CALL_MultiTexParameterfvEXT(ctx->Exec, (texunit, target, pname, params));
9968 }
9969 }
9970
9971
9972 static void GLAPIENTRY
9973 save_MultiTexParameterfEXT(GLenum texunit, GLenum target, GLenum pname, GLfloat param)
9974 {
9975 GLfloat parray[4];
9976 parray[0] = param;
9977 parray[1] = parray[2] = parray[3] = 0.0F;
9978 save_MultiTexParameterfvEXT(texunit, target, pname, parray);
9979 }
9980
9981 static void GLAPIENTRY
9982 save_MultiTexParameterivEXT(GLenum texunit, GLenum target, GLenum pname, const GLint *params)
9983 {
9984 GET_CURRENT_CONTEXT(ctx);
9985 Node *n;
9986 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9987 n = alloc_instruction(ctx, OPCODE_MULTITEXPARAMETER_I, 7);
9988 if (n) {
9989 n[1].e = texunit;
9990 n[2].e = target;
9991 n[3].e = pname;
9992 n[4].i = params[0];
9993 n[5].i = params[1];
9994 n[6].i = params[2];
9995 n[7].i = params[3];
9996 }
9997 if (ctx->ExecuteFlag) {
9998 CALL_MultiTexParameterivEXT(ctx->Exec, (texunit, target, pname, params));
9999 }
10000 }
10001
10002 static void GLAPIENTRY
10003 save_MultiTexParameteriEXT(GLenum texunit, GLenum target, GLenum pname, GLint param)
10004 {
10005 GLint fparam[4];
10006 fparam[0] = param;
10007 fparam[1] = fparam[2] = fparam[3] = 0;
10008 save_MultiTexParameterivEXT(texunit, target, pname, fparam);
10009 }
10010
10011
10012 static void GLAPIENTRY
10013 save_MultiTexImage1DEXT(GLenum texunit, GLenum target,
10014 GLint level, GLint components,
10015 GLsizei width, GLint border,
10016 GLenum format, GLenum type, const GLvoid * pixels)
10017 {
10018 GET_CURRENT_CONTEXT(ctx);
10019 if (target == GL_PROXY_TEXTURE_1D) {
10020 /* don't compile, execute immediately */
10021 CALL_MultiTexImage1DEXT(ctx->Exec, (texunit, target, level, components, width,
10022 border, format, type, pixels));
10023 }
10024 else {
10025 Node *n;
10026 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10027 n = alloc_instruction(ctx, OPCODE_MULTITEX_IMAGE1D, 8 + POINTER_DWORDS);
10028 if (n) {
10029 n[1].e = texunit;
10030 n[2].e = target;
10031 n[3].i = level;
10032 n[4].i = components;
10033 n[5].i = (GLint) width;
10034 n[6].i = border;
10035 n[7].e = format;
10036 n[8].e = type;
10037 save_pointer(&n[9],
10038 unpack_image(ctx, 1, width, 1, 1, format, type,
10039 pixels, &ctx->Unpack));
10040 }
10041 if (ctx->ExecuteFlag) {
10042 CALL_MultiTexImage1DEXT(ctx->Exec, (texunit, target, level, components, width,
10043 border, format, type, pixels));
10044 }
10045 }
10046 }
10047
10048
10049 static void GLAPIENTRY
10050 save_MultiTexImage2DEXT(GLenum texunit, GLenum target,
10051 GLint level, GLint components,
10052 GLsizei width, GLsizei height, GLint border,
10053 GLenum format, GLenum type, const GLvoid * pixels)
10054 {
10055 GET_CURRENT_CONTEXT(ctx);
10056 if (target == GL_PROXY_TEXTURE_2D) {
10057 /* don't compile, execute immediately */
10058 CALL_MultiTexImage2DEXT(ctx->Exec, (texunit, target, level, components, width,
10059 height, border, format, type, pixels));
10060 }
10061 else {
10062 Node *n;
10063 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10064 n = alloc_instruction(ctx, OPCODE_MULTITEX_IMAGE2D, 9 + POINTER_DWORDS);
10065 if (n) {
10066 n[1].e = texunit;
10067 n[2].e = target;
10068 n[3].i = level;
10069 n[4].i = components;
10070 n[5].i = (GLint) width;
10071 n[6].i = (GLint) height;
10072 n[7].i = border;
10073 n[8].e = format;
10074 n[9].e = type;
10075 save_pointer(&n[10],
10076 unpack_image(ctx, 2, width, height, 1, format, type,
10077 pixels, &ctx->Unpack));
10078 }
10079 if (ctx->ExecuteFlag) {
10080 CALL_MultiTexImage2DEXT(ctx->Exec, (texunit, target, level, components, width,
10081 height, border, format, type, pixels));
10082 }
10083 }
10084 }
10085
10086
10087 static void GLAPIENTRY
10088 save_MultiTexImage3DEXT(GLenum texunit, GLenum target,
10089 GLint level, GLint internalFormat,
10090 GLsizei width, GLsizei height, GLsizei depth,
10091 GLint border,
10092 GLenum format, GLenum type, const GLvoid * pixels)
10093 {
10094 GET_CURRENT_CONTEXT(ctx);
10095 if (target == GL_PROXY_TEXTURE_3D) {
10096 /* don't compile, execute immediately */
10097 CALL_MultiTexImage3DEXT(ctx->Exec, (texunit, target, level, internalFormat, width,
10098 height, depth, border, format, type,
10099 pixels));
10100 }
10101 else {
10102 Node *n;
10103 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10104 n = alloc_instruction(ctx, OPCODE_MULTITEX_IMAGE3D, 10 + POINTER_DWORDS);
10105 if (n) {
10106 n[1].e = texunit;
10107 n[2].e = target;
10108 n[3].i = level;
10109 n[4].i = (GLint) internalFormat;
10110 n[5].i = (GLint) width;
10111 n[6].i = (GLint) height;
10112 n[7].i = (GLint) depth;
10113 n[8].i = border;
10114 n[9].e = format;
10115 n[10].e = type;
10116 save_pointer(&n[11],
10117 unpack_image(ctx, 3, width, height, depth, format, type,
10118 pixels, &ctx->Unpack));
10119 }
10120 if (ctx->ExecuteFlag) {
10121 CALL_MultiTexImage3DEXT(ctx->Exec, (texunit, target, level, internalFormat,
10122 width, height, depth, border, format,
10123 type, pixels));
10124 }
10125 }
10126 }
10127
10128
10129 static void GLAPIENTRY
10130 save_MultiTexSubImage1DEXT(GLenum texunit, GLenum target, GLint level, GLint xoffset,
10131 GLsizei width, GLenum format, GLenum type,
10132 const GLvoid * pixels)
10133 {
10134 GET_CURRENT_CONTEXT(ctx);
10135 Node *n;
10136
10137 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10138
10139 n = alloc_instruction(ctx, OPCODE_MULTITEX_SUB_IMAGE1D, 7 + POINTER_DWORDS);
10140 if (n) {
10141 n[1].e = texunit;
10142 n[2].e = target;
10143 n[3].i = level;
10144 n[4].i = xoffset;
10145 n[5].i = (GLint) width;
10146 n[6].e = format;
10147 n[7].e = type;
10148 save_pointer(&n[8],
10149 unpack_image(ctx, 1, width, 1, 1, format, type,
10150 pixels, &ctx->Unpack));
10151 }
10152 if (ctx->ExecuteFlag) {
10153 CALL_MultiTexSubImage1DEXT(ctx->Exec, (texunit, target, level, xoffset, width,
10154 format, type, pixels));
10155 }
10156 }
10157
10158
10159 static void GLAPIENTRY
10160 save_MultiTexSubImage2DEXT(GLenum texunit, GLenum target, GLint level,
10161 GLint xoffset, GLint yoffset,
10162 GLsizei width, GLsizei height,
10163 GLenum format, GLenum type, const GLvoid * pixels)
10164 {
10165 GET_CURRENT_CONTEXT(ctx);
10166 Node *n;
10167
10168 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10169
10170 n = alloc_instruction(ctx, OPCODE_MULTITEX_SUB_IMAGE2D, 9 + POINTER_DWORDS);
10171 if (n) {
10172 n[1].e = texunit;
10173 n[2].e = target;
10174 n[3].i = level;
10175 n[4].i = xoffset;
10176 n[5].i = yoffset;
10177 n[6].i = (GLint) width;
10178 n[7].i = (GLint) height;
10179 n[8].e = format;
10180 n[9].e = type;
10181 save_pointer(&n[10],
10182 unpack_image(ctx, 2, width, height, 1, format, type,
10183 pixels, &ctx->Unpack));
10184 }
10185 if (ctx->ExecuteFlag) {
10186 CALL_MultiTexSubImage2DEXT(ctx->Exec, (texunit, target, level, xoffset, yoffset,
10187 width, height, format, type, pixels));
10188 }
10189 }
10190
10191
10192 static void GLAPIENTRY
10193 save_MultiTexSubImage3DEXT(GLenum texunit, GLenum target, GLint level,
10194 GLint xoffset, GLint yoffset, GLint zoffset,
10195 GLsizei width, GLsizei height, GLsizei depth,
10196 GLenum format, GLenum type, const GLvoid * pixels)
10197 {
10198 GET_CURRENT_CONTEXT(ctx);
10199 Node *n;
10200
10201 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10202
10203 n = alloc_instruction(ctx, OPCODE_MULTITEX_SUB_IMAGE3D, 11 + POINTER_DWORDS);
10204 if (n) {
10205 n[1].e = texunit;
10206 n[2].e = target;
10207 n[3].i = level;
10208 n[4].i = xoffset;
10209 n[5].i = yoffset;
10210 n[6].i = zoffset;
10211 n[7].i = (GLint) width;
10212 n[8].i = (GLint) height;
10213 n[9].i = (GLint) depth;
10214 n[10].e = format;
10215 n[11].e = type;
10216 save_pointer(&n[12],
10217 unpack_image(ctx, 3, width, height, depth, format, type,
10218 pixels, &ctx->Unpack));
10219 }
10220 if (ctx->ExecuteFlag) {
10221 CALL_MultiTexSubImage3DEXT(ctx->Exec, (texunit, target, level,
10222 xoffset, yoffset, zoffset,
10223 width, height, depth, format, type,
10224 pixels));
10225 }
10226 }
10227
10228
10229 static void GLAPIENTRY
10230 save_CopyMultiTexImage1DEXT(GLenum texunit, GLenum target, GLint level,
10231 GLenum internalformat, GLint x, GLint y,
10232 GLsizei width, GLint border)
10233 {
10234 GET_CURRENT_CONTEXT(ctx);
10235 Node *n;
10236 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10237 n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_IMAGE1D, 8);
10238 if (n) {
10239 n[1].e = texunit;
10240 n[2].e = target;
10241 n[3].i = level;
10242 n[4].e = internalformat;
10243 n[5].i = x;
10244 n[6].i = y;
10245 n[7].i = width;
10246 n[8].i = border;
10247 }
10248 if (ctx->ExecuteFlag) {
10249 CALL_CopyMultiTexImage1DEXT(ctx->Exec, (texunit, target, level,
10250 internalformat, x, y,
10251 width, border));
10252 }
10253 }
10254
10255
10256 static void GLAPIENTRY
10257 save_CopyMultiTexImage2DEXT(GLenum texunit, GLenum target, GLint level,
10258 GLenum internalformat,
10259 GLint x, GLint y, GLsizei width,
10260 GLsizei height, GLint border)
10261 {
10262 GET_CURRENT_CONTEXT(ctx);
10263 Node *n;
10264 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10265 n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_IMAGE2D, 9);
10266 if (n) {
10267 n[1].e = texunit;
10268 n[2].e = target;
10269 n[3].i = level;
10270 n[4].e = internalformat;
10271 n[5].i = x;
10272 n[6].i = y;
10273 n[7].i = width;
10274 n[8].i = height;
10275 n[9].i = border;
10276 }
10277 if (ctx->ExecuteFlag) {
10278 CALL_CopyMultiTexImage2DEXT(ctx->Exec, (texunit, target, level,
10279 internalformat, x, y,
10280 width, height, border));
10281 }
10282 }
10283
10284
10285 static void GLAPIENTRY
10286 save_CopyMultiTexSubImage1DEXT(GLenum texunit, GLenum target, GLint level,
10287 GLint xoffset, GLint x, GLint y, GLsizei width)
10288 {
10289 GET_CURRENT_CONTEXT(ctx);
10290 Node *n;
10291 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10292 n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_SUB_IMAGE1D, 7);
10293 if (n) {
10294 n[1].e = texunit;
10295 n[2].e = target;
10296 n[3].i = level;
10297 n[4].i = xoffset;
10298 n[5].i = x;
10299 n[6].i = y;
10300 n[7].i = width;
10301 }
10302 if (ctx->ExecuteFlag) {
10303 CALL_CopyMultiTexSubImage1DEXT(ctx->Exec,
10304 (texunit, target, level, xoffset, x, y, width));
10305 }
10306 }
10307
10308
10309 static void GLAPIENTRY
10310 save_CopyMultiTexSubImage2DEXT(GLenum texunit, GLenum target, GLint level,
10311 GLint xoffset, GLint yoffset,
10312 GLint x, GLint y, GLsizei width, GLint height)
10313 {
10314 GET_CURRENT_CONTEXT(ctx);
10315 Node *n;
10316 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10317 n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_SUB_IMAGE2D, 9);
10318 if (n) {
10319 n[1].e = texunit;
10320 n[2].e = target;
10321 n[3].i = level;
10322 n[4].i = xoffset;
10323 n[5].i = yoffset;
10324 n[6].i = x;
10325 n[7].i = y;
10326 n[8].i = width;
10327 n[9].i = height;
10328 }
10329 if (ctx->ExecuteFlag) {
10330 CALL_CopyMultiTexSubImage2DEXT(ctx->Exec, (texunit, target, level,
10331 xoffset, yoffset,
10332 x, y, width, height));
10333 }
10334 }
10335
10336
10337 static void GLAPIENTRY
10338 save_CopyMultiTexSubImage3DEXT(GLenum texunit, GLenum target, GLint level,
10339 GLint xoffset, GLint yoffset, GLint zoffset,
10340 GLint x, GLint y, GLsizei width, GLint height)
10341 {
10342 GET_CURRENT_CONTEXT(ctx);
10343 Node *n;
10344 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10345 n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_SUB_IMAGE3D, 10);
10346 if (n) {
10347 n[1].e = texunit;
10348 n[2].e = target;
10349 n[3].i = level;
10350 n[4].i = xoffset;
10351 n[5].i = yoffset;
10352 n[6].i = zoffset;
10353 n[7].i = x;
10354 n[8].i = y;
10355 n[9].i = width;
10356 n[10].i = height;
10357 }
10358 if (ctx->ExecuteFlag) {
10359 CALL_CopyMultiTexSubImage3DEXT(ctx->Exec, (texunit, target, level,
10360 xoffset, yoffset, zoffset,
10361 x, y, width, height));
10362 }
10363 }
10364
10365
10366 static void GLAPIENTRY
10367 save_MultiTexEnvfvEXT(GLenum texunit, GLenum target, GLenum pname, const GLfloat *params)
10368 {
10369 GET_CURRENT_CONTEXT(ctx);
10370 Node *n;
10371 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10372 n = alloc_instruction(ctx, OPCODE_MULTITEXENV, 7);
10373 if (n) {
10374 n[1].e = texunit;
10375 n[2].e = target;
10376 n[3].e = pname;
10377 if (pname == GL_TEXTURE_ENV_COLOR) {
10378 n[4].f = params[0];
10379 n[5].f = params[1];
10380 n[6].f = params[2];
10381 n[7].f = params[3];
10382 }
10383 else {
10384 n[4].f = params[0];
10385 n[5].f = n[6].f = n[7].f = 0.0F;
10386 }
10387 }
10388 if (ctx->ExecuteFlag) {
10389 CALL_MultiTexEnvfvEXT(ctx->Exec, (texunit, target, pname, params));
10390 }
10391 }
10392
10393
10394 static void GLAPIENTRY
10395 save_MultiTexEnvfEXT(GLenum texunit, GLenum target, GLenum pname, GLfloat param)
10396 {
10397 GLfloat parray[4];
10398 parray[0] = (GLfloat) param;
10399 parray[1] = parray[2] = parray[3] = 0.0F;
10400 save_MultiTexEnvfvEXT(texunit, target, pname, parray);
10401 }
10402
10403
10404 static void GLAPIENTRY
10405 save_MultiTexEnviEXT(GLenum texunit, GLenum target, GLenum pname, GLint param)
10406 {
10407 GLfloat p[4];
10408 p[0] = (GLfloat) param;
10409 p[1] = p[2] = p[3] = 0.0F;
10410 save_MultiTexEnvfvEXT(texunit, target, pname, p);
10411 }
10412
10413
10414 static void GLAPIENTRY
10415 save_MultiTexEnvivEXT(GLenum texunit, GLenum target, GLenum pname, const GLint * param)
10416 {
10417 GLfloat p[4];
10418 if (pname == GL_TEXTURE_ENV_COLOR) {
10419 p[0] = INT_TO_FLOAT(param[0]);
10420 p[1] = INT_TO_FLOAT(param[1]);
10421 p[2] = INT_TO_FLOAT(param[2]);
10422 p[3] = INT_TO_FLOAT(param[3]);
10423 }
10424 else {
10425 p[0] = (GLfloat) param[0];
10426 p[1] = p[2] = p[3] = 0.0F;
10427 }
10428 save_MultiTexEnvfvEXT(texunit, target, pname, p);
10429 }
10430
10431
10432 static void GLAPIENTRY
10433 save_CompressedTextureSubImage2DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset,
10434 GLint yoffset, GLsizei width, GLsizei height,
10435 GLenum format, GLsizei imageSize,
10436 const GLvoid * data)
10437 {
10438 Node *n;
10439 GET_CURRENT_CONTEXT(ctx);
10440 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10441
10442 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_2D,
10443 9 + POINTER_DWORDS);
10444 if (n) {
10445 n[1].ui = texture;
10446 n[2].e = target;
10447 n[3].i = level;
10448 n[4].i = xoffset;
10449 n[5].i = yoffset;
10450 n[6].i = (GLint) width;
10451 n[7].i = (GLint) height;
10452 n[8].e = format;
10453 n[9].i = imageSize;
10454 save_pointer(&n[10],
10455 copy_data(data, imageSize, "glCompressedTextureSubImage2DEXT"));
10456 }
10457 if (ctx->ExecuteFlag) {
10458 CALL_CompressedTextureSubImage2DEXT(ctx->Exec,
10459 (texture, target, level, xoffset, yoffset,
10460 width, height, format, imageSize, data));
10461 }
10462 }
10463
10464
10465 /**
10466 * Save an error-generating command into display list.
10467 *
10468 * KW: Will appear in the list before the vertex buffer containing the
10469 * command that provoked the error. I don't see this as a problem.
10470 */
10471 static void
10472 save_error(struct gl_context *ctx, GLenum error, const char *s)
10473 {
10474 Node *n;
10475 n = alloc_instruction(ctx, OPCODE_ERROR, 1 + POINTER_DWORDS);
10476 if (n) {
10477 n[1].e = error;
10478 save_pointer(&n[2], (void *) s);
10479 /* note: the data/string here doesn't have to be freed in
10480 * _mesa_delete_list() since the string is never dynamically
10481 * allocated.
10482 */
10483 }
10484 }
10485
10486
10487 /**
10488 * Compile an error into current display list.
10489 */
10490 void
10491 _mesa_compile_error(struct gl_context *ctx, GLenum error, const char *s)
10492 {
10493 if (ctx->CompileFlag)
10494 save_error(ctx, error, s);
10495 if (ctx->ExecuteFlag)
10496 _mesa_error(ctx, error, "%s", s);
10497 }
10498
10499
10500 /**
10501 * Test if ID names a display list.
10502 */
10503 static GLboolean
10504 islist(struct gl_context *ctx, GLuint list)
10505 {
10506 if (list > 0 && _mesa_lookup_list(ctx, list)) {
10507 return GL_TRUE;
10508 }
10509 else {
10510 return GL_FALSE;
10511 }
10512 }
10513
10514
10515
10516 /**********************************************************************/
10517 /* Display list execution */
10518 /**********************************************************************/
10519
10520
10521 /*
10522 * Execute a display list. Note that the ListBase offset must have already
10523 * been added before calling this function. I.e. the list argument is
10524 * the absolute list number, not relative to ListBase.
10525 * \param list - display list number
10526 */
10527 static void
10528 execute_list(struct gl_context *ctx, GLuint list)
10529 {
10530 struct gl_display_list *dlist;
10531 Node *n;
10532 GLboolean done;
10533
10534 if (list == 0 || !islist(ctx, list))
10535 return;
10536
10537 if (ctx->ListState.CallDepth == MAX_LIST_NESTING) {
10538 /* raise an error? */
10539 return;
10540 }
10541
10542 dlist = _mesa_lookup_list(ctx, list);
10543 if (!dlist)
10544 return;
10545
10546 ctx->ListState.CallDepth++;
10547
10548 vbo_save_BeginCallList(ctx, dlist);
10549
10550 n = dlist->Head;
10551
10552 done = GL_FALSE;
10553 while (!done) {
10554 const OpCode opcode = n[0].opcode;
10555
10556 if (is_ext_opcode(opcode)) {
10557 n += ext_opcode_execute(ctx, n);
10558 }
10559 else {
10560 switch (opcode) {
10561 case OPCODE_ERROR:
10562 _mesa_error(ctx, n[1].e, "%s", (const char *) get_pointer(&n[2]));
10563 break;
10564 case OPCODE_ACCUM:
10565 CALL_Accum(ctx->Exec, (n[1].e, n[2].f));
10566 break;
10567 case OPCODE_ALPHA_FUNC:
10568 CALL_AlphaFunc(ctx->Exec, (n[1].e, n[2].f));
10569 break;
10570 case OPCODE_BIND_TEXTURE:
10571 CALL_BindTexture(ctx->Exec, (n[1].e, n[2].ui));
10572 break;
10573 case OPCODE_BITMAP:
10574 {
10575 const struct gl_pixelstore_attrib save = ctx->Unpack;
10576 ctx->Unpack = ctx->DefaultPacking;
10577 CALL_Bitmap(ctx->Exec, ((GLsizei) n[1].i, (GLsizei) n[2].i,
10578 n[3].f, n[4].f, n[5].f, n[6].f,
10579 get_pointer(&n[7])));
10580 ctx->Unpack = save; /* restore */
10581 }
10582 break;
10583 case OPCODE_BLEND_COLOR:
10584 CALL_BlendColor(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
10585 break;
10586 case OPCODE_BLEND_EQUATION:
10587 CALL_BlendEquation(ctx->Exec, (n[1].e));
10588 break;
10589 case OPCODE_BLEND_EQUATION_SEPARATE:
10590 CALL_BlendEquationSeparate(ctx->Exec, (n[1].e, n[2].e));
10591 break;
10592 case OPCODE_BLEND_FUNC_SEPARATE:
10593 CALL_BlendFuncSeparate(ctx->Exec,
10594 (n[1].e, n[2].e, n[3].e, n[4].e));
10595 break;
10596
10597 case OPCODE_BLEND_FUNC_I:
10598 /* GL_ARB_draw_buffers_blend */
10599 CALL_BlendFunciARB(ctx->Exec, (n[1].ui, n[2].e, n[3].e));
10600 break;
10601 case OPCODE_BLEND_FUNC_SEPARATE_I:
10602 /* GL_ARB_draw_buffers_blend */
10603 CALL_BlendFuncSeparateiARB(ctx->Exec, (n[1].ui, n[2].e, n[3].e,
10604 n[4].e, n[5].e));
10605 break;
10606 case OPCODE_BLEND_EQUATION_I:
10607 /* GL_ARB_draw_buffers_blend */
10608 CALL_BlendEquationiARB(ctx->Exec, (n[1].ui, n[2].e));
10609 break;
10610 case OPCODE_BLEND_EQUATION_SEPARATE_I:
10611 /* GL_ARB_draw_buffers_blend */
10612 CALL_BlendEquationSeparateiARB(ctx->Exec,
10613 (n[1].ui, n[2].e, n[3].e));
10614 break;
10615
10616 case OPCODE_CALL_LIST:
10617 /* Generated by glCallList(), don't add ListBase */
10618 if (ctx->ListState.CallDepth < MAX_LIST_NESTING) {
10619 execute_list(ctx, n[1].ui);
10620 }
10621 break;
10622 case OPCODE_CALL_LISTS:
10623 if (ctx->ListState.CallDepth < MAX_LIST_NESTING) {
10624 CALL_CallLists(ctx->Exec, (n[1].i, n[2].e, get_pointer(&n[3])));
10625 }
10626 break;
10627 case OPCODE_CLEAR:
10628 CALL_Clear(ctx->Exec, (n[1].bf));
10629 break;
10630 case OPCODE_CLEAR_BUFFER_IV:
10631 {
10632 GLint value[4];
10633 value[0] = n[3].i;
10634 value[1] = n[4].i;
10635 value[2] = n[5].i;
10636 value[3] = n[6].i;
10637 CALL_ClearBufferiv(ctx->Exec, (n[1].e, n[2].i, value));
10638 }
10639 break;
10640 case OPCODE_CLEAR_BUFFER_UIV:
10641 {
10642 GLuint value[4];
10643 value[0] = n[3].ui;
10644 value[1] = n[4].ui;
10645 value[2] = n[5].ui;
10646 value[3] = n[6].ui;
10647 CALL_ClearBufferuiv(ctx->Exec, (n[1].e, n[2].i, value));
10648 }
10649 break;
10650 case OPCODE_CLEAR_BUFFER_FV:
10651 {
10652 GLfloat value[4];
10653 value[0] = n[3].f;
10654 value[1] = n[4].f;
10655 value[2] = n[5].f;
10656 value[3] = n[6].f;
10657 CALL_ClearBufferfv(ctx->Exec, (n[1].e, n[2].i, value));
10658 }
10659 break;
10660 case OPCODE_CLEAR_BUFFER_FI:
10661 CALL_ClearBufferfi(ctx->Exec, (n[1].e, n[2].i, n[3].f, n[4].i));
10662 break;
10663 case OPCODE_CLEAR_COLOR:
10664 CALL_ClearColor(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
10665 break;
10666 case OPCODE_CLEAR_ACCUM:
10667 CALL_ClearAccum(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
10668 break;
10669 case OPCODE_CLEAR_DEPTH:
10670 CALL_ClearDepth(ctx->Exec, ((GLclampd) n[1].f));
10671 break;
10672 case OPCODE_CLEAR_INDEX:
10673 CALL_ClearIndex(ctx->Exec, ((GLfloat) n[1].ui));
10674 break;
10675 case OPCODE_CLEAR_STENCIL:
10676 CALL_ClearStencil(ctx->Exec, (n[1].i));
10677 break;
10678 case OPCODE_CLIP_PLANE:
10679 {
10680 GLdouble eq[4];
10681 eq[0] = n[2].f;
10682 eq[1] = n[3].f;
10683 eq[2] = n[4].f;
10684 eq[3] = n[5].f;
10685 CALL_ClipPlane(ctx->Exec, (n[1].e, eq));
10686 }
10687 break;
10688 case OPCODE_COLOR_MASK:
10689 CALL_ColorMask(ctx->Exec, (n[1].b, n[2].b, n[3].b, n[4].b));
10690 break;
10691 case OPCODE_COLOR_MASK_INDEXED:
10692 CALL_ColorMaski(ctx->Exec, (n[1].ui, n[2].b, n[3].b,
10693 n[4].b, n[5].b));
10694 break;
10695 case OPCODE_COLOR_MATERIAL:
10696 CALL_ColorMaterial(ctx->Exec, (n[1].e, n[2].e));
10697 break;
10698 case OPCODE_COPY_PIXELS:
10699 CALL_CopyPixels(ctx->Exec, (n[1].i, n[2].i,
10700 (GLsizei) n[3].i, (GLsizei) n[4].i,
10701 n[5].e));
10702 break;
10703 case OPCODE_COPY_TEX_IMAGE1D:
10704 CALL_CopyTexImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].e, n[4].i,
10705 n[5].i, n[6].i, n[7].i));
10706 break;
10707 case OPCODE_COPY_TEX_IMAGE2D:
10708 CALL_CopyTexImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].e, n[4].i,
10709 n[5].i, n[6].i, n[7].i, n[8].i));
10710 break;
10711 case OPCODE_COPY_TEX_SUB_IMAGE1D:
10712 CALL_CopyTexSubImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
10713 n[4].i, n[5].i, n[6].i));
10714 break;
10715 case OPCODE_COPY_TEX_SUB_IMAGE2D:
10716 CALL_CopyTexSubImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
10717 n[4].i, n[5].i, n[6].i, n[7].i,
10718 n[8].i));
10719 break;
10720 case OPCODE_COPY_TEX_SUB_IMAGE3D:
10721 CALL_CopyTexSubImage3D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
10722 n[4].i, n[5].i, n[6].i, n[7].i,
10723 n[8].i, n[9].i));
10724 break;
10725 case OPCODE_CULL_FACE:
10726 CALL_CullFace(ctx->Exec, (n[1].e));
10727 break;
10728 case OPCODE_DEPTH_FUNC:
10729 CALL_DepthFunc(ctx->Exec, (n[1].e));
10730 break;
10731 case OPCODE_DEPTH_MASK:
10732 CALL_DepthMask(ctx->Exec, (n[1].b));
10733 break;
10734 case OPCODE_DEPTH_RANGE:
10735 CALL_DepthRange(ctx->Exec,
10736 ((GLclampd) n[1].f, (GLclampd) n[2].f));
10737 break;
10738 case OPCODE_DISABLE:
10739 CALL_Disable(ctx->Exec, (n[1].e));
10740 break;
10741 case OPCODE_DISABLE_INDEXED:
10742 CALL_Disablei(ctx->Exec, (n[1].ui, n[2].e));
10743 break;
10744 case OPCODE_DRAW_BUFFER:
10745 CALL_DrawBuffer(ctx->Exec, (n[1].e));
10746 break;
10747 case OPCODE_DRAW_PIXELS:
10748 {
10749 const struct gl_pixelstore_attrib save = ctx->Unpack;
10750 ctx->Unpack = ctx->DefaultPacking;
10751 CALL_DrawPixels(ctx->Exec, (n[1].i, n[2].i, n[3].e, n[4].e,
10752 get_pointer(&n[5])));
10753 ctx->Unpack = save; /* restore */
10754 }
10755 break;
10756 case OPCODE_ENABLE:
10757 CALL_Enable(ctx->Exec, (n[1].e));
10758 break;
10759 case OPCODE_ENABLE_INDEXED:
10760 CALL_Enablei(ctx->Exec, (n[1].ui, n[2].e));
10761 break;
10762 case OPCODE_EVALMESH1:
10763 CALL_EvalMesh1(ctx->Exec, (n[1].e, n[2].i, n[3].i));
10764 break;
10765 case OPCODE_EVALMESH2:
10766 CALL_EvalMesh2(ctx->Exec,
10767 (n[1].e, n[2].i, n[3].i, n[4].i, n[5].i));
10768 break;
10769 case OPCODE_FOG:
10770 {
10771 GLfloat p[4];
10772 p[0] = n[2].f;
10773 p[1] = n[3].f;
10774 p[2] = n[4].f;
10775 p[3] = n[5].f;
10776 CALL_Fogfv(ctx->Exec, (n[1].e, p));
10777 }
10778 break;
10779 case OPCODE_FRONT_FACE:
10780 CALL_FrontFace(ctx->Exec, (n[1].e));
10781 break;
10782 case OPCODE_FRUSTUM:
10783 CALL_Frustum(ctx->Exec,
10784 (n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f));
10785 break;
10786 case OPCODE_HINT:
10787 CALL_Hint(ctx->Exec, (n[1].e, n[2].e));
10788 break;
10789 case OPCODE_INDEX_MASK:
10790 CALL_IndexMask(ctx->Exec, (n[1].ui));
10791 break;
10792 case OPCODE_INIT_NAMES:
10793 CALL_InitNames(ctx->Exec, ());
10794 break;
10795 case OPCODE_LIGHT:
10796 {
10797 GLfloat p[4];
10798 p[0] = n[3].f;
10799 p[1] = n[4].f;
10800 p[2] = n[5].f;
10801 p[3] = n[6].f;
10802 CALL_Lightfv(ctx->Exec, (n[1].e, n[2].e, p));
10803 }
10804 break;
10805 case OPCODE_LIGHT_MODEL:
10806 {
10807 GLfloat p[4];
10808 p[0] = n[2].f;
10809 p[1] = n[3].f;
10810 p[2] = n[4].f;
10811 p[3] = n[5].f;
10812 CALL_LightModelfv(ctx->Exec, (n[1].e, p));
10813 }
10814 break;
10815 case OPCODE_LINE_STIPPLE:
10816 CALL_LineStipple(ctx->Exec, (n[1].i, n[2].us));
10817 break;
10818 case OPCODE_LINE_WIDTH:
10819 CALL_LineWidth(ctx->Exec, (n[1].f));
10820 break;
10821 case OPCODE_LIST_BASE:
10822 CALL_ListBase(ctx->Exec, (n[1].ui));
10823 break;
10824 case OPCODE_LOAD_IDENTITY:
10825 CALL_LoadIdentity(ctx->Exec, ());
10826 break;
10827 case OPCODE_LOAD_MATRIX:
10828 STATIC_ASSERT(sizeof(Node) == sizeof(GLfloat));
10829 CALL_LoadMatrixf(ctx->Exec, (&n[1].f));
10830 break;
10831 case OPCODE_LOAD_NAME:
10832 CALL_LoadName(ctx->Exec, (n[1].ui));
10833 break;
10834 case OPCODE_LOGIC_OP:
10835 CALL_LogicOp(ctx->Exec, (n[1].e));
10836 break;
10837 case OPCODE_MAP1:
10838 {
10839 GLenum target = n[1].e;
10840 GLint ustride = _mesa_evaluator_components(target);
10841 GLint uorder = n[5].i;
10842 GLfloat u1 = n[2].f;
10843 GLfloat u2 = n[3].f;
10844 CALL_Map1f(ctx->Exec, (target, u1, u2, ustride, uorder,
10845 (GLfloat *) get_pointer(&n[6])));
10846 }
10847 break;
10848 case OPCODE_MAP2:
10849 {
10850 GLenum target = n[1].e;
10851 GLfloat u1 = n[2].f;
10852 GLfloat u2 = n[3].f;
10853 GLfloat v1 = n[4].f;
10854 GLfloat v2 = n[5].f;
10855 GLint ustride = n[6].i;
10856 GLint vstride = n[7].i;
10857 GLint uorder = n[8].i;
10858 GLint vorder = n[9].i;
10859 CALL_Map2f(ctx->Exec, (target, u1, u2, ustride, uorder,
10860 v1, v2, vstride, vorder,
10861 (GLfloat *) get_pointer(&n[10])));
10862 }
10863 break;
10864 case OPCODE_MAPGRID1:
10865 CALL_MapGrid1f(ctx->Exec, (n[1].i, n[2].f, n[3].f));
10866 break;
10867 case OPCODE_MAPGRID2:
10868 CALL_MapGrid2f(ctx->Exec,
10869 (n[1].i, n[2].f, n[3].f, n[4].i, n[5].f, n[6].f));
10870 break;
10871 case OPCODE_MATRIX_MODE:
10872 CALL_MatrixMode(ctx->Exec, (n[1].e));
10873 break;
10874 case OPCODE_MULT_MATRIX:
10875 CALL_MultMatrixf(ctx->Exec, (&n[1].f));
10876 break;
10877 case OPCODE_ORTHO:
10878 CALL_Ortho(ctx->Exec,
10879 (n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f));
10880 break;
10881 case OPCODE_PASSTHROUGH:
10882 CALL_PassThrough(ctx->Exec, (n[1].f));
10883 break;
10884 case OPCODE_PATCH_PARAMETER_I:
10885 CALL_PatchParameteri(ctx->Exec, (n[1].e, n[2].i));
10886 break;
10887 case OPCODE_PATCH_PARAMETER_FV_INNER:
10888 {
10889 GLfloat params[2];
10890 params[0] = n[2].f;
10891 params[1] = n[3].f;
10892 CALL_PatchParameterfv(ctx->Exec, (n[1].e, params));
10893 }
10894 break;
10895 case OPCODE_PATCH_PARAMETER_FV_OUTER:
10896 {
10897 GLfloat params[4];
10898 params[0] = n[2].f;
10899 params[1] = n[3].f;
10900 params[2] = n[4].f;
10901 params[3] = n[5].f;
10902 CALL_PatchParameterfv(ctx->Exec, (n[1].e, params));
10903 }
10904 break;
10905 case OPCODE_PIXEL_MAP:
10906 CALL_PixelMapfv(ctx->Exec,
10907 (n[1].e, n[2].i, get_pointer(&n[3])));
10908 break;
10909 case OPCODE_PIXEL_TRANSFER:
10910 CALL_PixelTransferf(ctx->Exec, (n[1].e, n[2].f));
10911 break;
10912 case OPCODE_PIXEL_ZOOM:
10913 CALL_PixelZoom(ctx->Exec, (n[1].f, n[2].f));
10914 break;
10915 case OPCODE_POINT_SIZE:
10916 CALL_PointSize(ctx->Exec, (n[1].f));
10917 break;
10918 case OPCODE_POINT_PARAMETERS:
10919 {
10920 GLfloat params[3];
10921 params[0] = n[2].f;
10922 params[1] = n[3].f;
10923 params[2] = n[4].f;
10924 CALL_PointParameterfv(ctx->Exec, (n[1].e, params));
10925 }
10926 break;
10927 case OPCODE_POLYGON_MODE:
10928 CALL_PolygonMode(ctx->Exec, (n[1].e, n[2].e));
10929 break;
10930 case OPCODE_POLYGON_STIPPLE:
10931 {
10932 const struct gl_pixelstore_attrib save = ctx->Unpack;
10933 ctx->Unpack = ctx->DefaultPacking;
10934 CALL_PolygonStipple(ctx->Exec, (get_pointer(&n[1])));
10935 ctx->Unpack = save; /* restore */
10936 }
10937 break;
10938 case OPCODE_POLYGON_OFFSET:
10939 CALL_PolygonOffset(ctx->Exec, (n[1].f, n[2].f));
10940 break;
10941 case OPCODE_POLYGON_OFFSET_CLAMP:
10942 CALL_PolygonOffsetClampEXT(ctx->Exec, (n[1].f, n[2].f, n[3].f));
10943 break;
10944 case OPCODE_POP_ATTRIB:
10945 CALL_PopAttrib(ctx->Exec, ());
10946 break;
10947 case OPCODE_POP_MATRIX:
10948 CALL_PopMatrix(ctx->Exec, ());
10949 break;
10950 case OPCODE_POP_NAME:
10951 CALL_PopName(ctx->Exec, ());
10952 break;
10953 case OPCODE_PRIORITIZE_TEXTURE:
10954 CALL_PrioritizeTextures(ctx->Exec, (1, &n[1].ui, &n[2].f));
10955 break;
10956 case OPCODE_PUSH_ATTRIB:
10957 CALL_PushAttrib(ctx->Exec, (n[1].bf));
10958 break;
10959 case OPCODE_PUSH_MATRIX:
10960 CALL_PushMatrix(ctx->Exec, ());
10961 break;
10962 case OPCODE_PUSH_NAME:
10963 CALL_PushName(ctx->Exec, (n[1].ui));
10964 break;
10965 case OPCODE_RASTER_POS:
10966 CALL_RasterPos4f(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
10967 break;
10968 case OPCODE_READ_BUFFER:
10969 CALL_ReadBuffer(ctx->Exec, (n[1].e));
10970 break;
10971 case OPCODE_ROTATE:
10972 CALL_Rotatef(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
10973 break;
10974 case OPCODE_SCALE:
10975 CALL_Scalef(ctx->Exec, (n[1].f, n[2].f, n[3].f));
10976 break;
10977 case OPCODE_SCISSOR:
10978 CALL_Scissor(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
10979 break;
10980 case OPCODE_SHADE_MODEL:
10981 CALL_ShadeModel(ctx->Exec, (n[1].e));
10982 break;
10983 case OPCODE_PROVOKING_VERTEX:
10984 CALL_ProvokingVertex(ctx->Exec, (n[1].e));
10985 break;
10986 case OPCODE_STENCIL_FUNC:
10987 CALL_StencilFunc(ctx->Exec, (n[1].e, n[2].i, n[3].ui));
10988 break;
10989 case OPCODE_STENCIL_MASK:
10990 CALL_StencilMask(ctx->Exec, (n[1].ui));
10991 break;
10992 case OPCODE_STENCIL_OP:
10993 CALL_StencilOp(ctx->Exec, (n[1].e, n[2].e, n[3].e));
10994 break;
10995 case OPCODE_STENCIL_FUNC_SEPARATE:
10996 CALL_StencilFuncSeparate(ctx->Exec,
10997 (n[1].e, n[2].e, n[3].i, n[4].ui));
10998 break;
10999 case OPCODE_STENCIL_MASK_SEPARATE:
11000 CALL_StencilMaskSeparate(ctx->Exec, (n[1].e, n[2].ui));
11001 break;
11002 case OPCODE_STENCIL_OP_SEPARATE:
11003 CALL_StencilOpSeparate(ctx->Exec,
11004 (n[1].e, n[2].e, n[3].e, n[4].e));
11005 break;
11006 case OPCODE_TEXENV:
11007 {
11008 GLfloat params[4];
11009 params[0] = n[3].f;
11010 params[1] = n[4].f;
11011 params[2] = n[5].f;
11012 params[3] = n[6].f;
11013 CALL_TexEnvfv(ctx->Exec, (n[1].e, n[2].e, params));
11014 }
11015 break;
11016 case OPCODE_TEXGEN:
11017 {
11018 GLfloat params[4];
11019 params[0] = n[3].f;
11020 params[1] = n[4].f;
11021 params[2] = n[5].f;
11022 params[3] = n[6].f;
11023 CALL_TexGenfv(ctx->Exec, (n[1].e, n[2].e, params));
11024 }
11025 break;
11026 case OPCODE_TEXPARAMETER:
11027 {
11028 GLfloat params[4];
11029 params[0] = n[3].f;
11030 params[1] = n[4].f;
11031 params[2] = n[5].f;
11032 params[3] = n[6].f;
11033 CALL_TexParameterfv(ctx->Exec, (n[1].e, n[2].e, params));
11034 }
11035 break;
11036 case OPCODE_TEX_IMAGE1D:
11037 {
11038 const struct gl_pixelstore_attrib save = ctx->Unpack;
11039 ctx->Unpack = ctx->DefaultPacking;
11040 CALL_TexImage1D(ctx->Exec, (n[1].e, /* target */
11041 n[2].i, /* level */
11042 n[3].i, /* components */
11043 n[4].i, /* width */
11044 n[5].e, /* border */
11045 n[6].e, /* format */
11046 n[7].e, /* type */
11047 get_pointer(&n[8])));
11048 ctx->Unpack = save; /* restore */
11049 }
11050 break;
11051 case OPCODE_TEX_IMAGE2D:
11052 {
11053 const struct gl_pixelstore_attrib save = ctx->Unpack;
11054 ctx->Unpack = ctx->DefaultPacking;
11055 CALL_TexImage2D(ctx->Exec, (n[1].e, /* target */
11056 n[2].i, /* level */
11057 n[3].i, /* components */
11058 n[4].i, /* width */
11059 n[5].i, /* height */
11060 n[6].e, /* border */
11061 n[7].e, /* format */
11062 n[8].e, /* type */
11063 get_pointer(&n[9])));
11064 ctx->Unpack = save; /* restore */
11065 }
11066 break;
11067 case OPCODE_TEX_IMAGE3D:
11068 {
11069 const struct gl_pixelstore_attrib save = ctx->Unpack;
11070 ctx->Unpack = ctx->DefaultPacking;
11071 CALL_TexImage3D(ctx->Exec, (n[1].e, /* target */
11072 n[2].i, /* level */
11073 n[3].i, /* components */
11074 n[4].i, /* width */
11075 n[5].i, /* height */
11076 n[6].i, /* depth */
11077 n[7].e, /* border */
11078 n[8].e, /* format */
11079 n[9].e, /* type */
11080 get_pointer(&n[10])));
11081 ctx->Unpack = save; /* restore */
11082 }
11083 break;
11084 case OPCODE_TEX_SUB_IMAGE1D:
11085 {
11086 const struct gl_pixelstore_attrib save = ctx->Unpack;
11087 ctx->Unpack = ctx->DefaultPacking;
11088 CALL_TexSubImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
11089 n[4].i, n[5].e,
11090 n[6].e, get_pointer(&n[7])));
11091 ctx->Unpack = save; /* restore */
11092 }
11093 break;
11094 case OPCODE_TEX_SUB_IMAGE2D:
11095 {
11096 const struct gl_pixelstore_attrib save = ctx->Unpack;
11097 ctx->Unpack = ctx->DefaultPacking;
11098 CALL_TexSubImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
11099 n[4].i, n[5].e,
11100 n[6].i, n[7].e, n[8].e,
11101 get_pointer(&n[9])));
11102 ctx->Unpack = save; /* restore */
11103 }
11104 break;
11105 case OPCODE_TEX_SUB_IMAGE3D:
11106 {
11107 const struct gl_pixelstore_attrib save = ctx->Unpack;
11108 ctx->Unpack = ctx->DefaultPacking;
11109 CALL_TexSubImage3D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
11110 n[4].i, n[5].i, n[6].i, n[7].i,
11111 n[8].i, n[9].e, n[10].e,
11112 get_pointer(&n[11])));
11113 ctx->Unpack = save; /* restore */
11114 }
11115 break;
11116 case OPCODE_TRANSLATE:
11117 CALL_Translatef(ctx->Exec, (n[1].f, n[2].f, n[3].f));
11118 break;
11119 case OPCODE_VIEWPORT:
11120 CALL_Viewport(ctx->Exec, (n[1].i, n[2].i,
11121 (GLsizei) n[3].i, (GLsizei) n[4].i));
11122 break;
11123 case OPCODE_WINDOW_POS:
11124 CALL_WindowPos4fMESA(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
11125 break;
11126 case OPCODE_VIEWPORT_ARRAY_V:
11127 CALL_ViewportArrayv(ctx->Exec, (n[1].ui, n[2].si,
11128 get_pointer(&n[3])));
11129 break;
11130 case OPCODE_VIEWPORT_INDEXED_F:
11131 CALL_ViewportIndexedf(ctx->Exec, (n[1].ui, n[2].f, n[3].f, n[4].f,
11132 n[5].f));
11133 break;
11134 case OPCODE_VIEWPORT_INDEXED_FV: {
11135 GLfloat v[4];
11136 v[0] = n[2].f;
11137 v[1] = n[3].f;
11138 v[2] = n[4].f;
11139 v[3] = n[5].f;
11140 CALL_ViewportIndexedfv(ctx->Exec, (n[1].ui, v));
11141 break;
11142 }
11143 case OPCODE_SCISSOR_ARRAY_V:
11144 CALL_ScissorArrayv(ctx->Exec, (n[1].ui, n[2].si,
11145 get_pointer(&n[3])));
11146 break;
11147 case OPCODE_SCISSOR_INDEXED:
11148 CALL_ScissorIndexed(ctx->Exec, (n[1].ui, n[2].i, n[3].i, n[4].si,
11149 n[5].si));
11150 break;
11151 case OPCODE_SCISSOR_INDEXED_V: {
11152 GLint v[4];
11153 v[0] = n[2].i;
11154 v[1] = n[3].i;
11155 v[2] = n[4].si;
11156 v[3] = n[5].si;
11157 CALL_ScissorIndexedv(ctx->Exec, (n[1].ui, v));
11158 break;
11159 }
11160 case OPCODE_DEPTH_ARRAY_V:
11161 CALL_DepthRangeArrayv(ctx->Exec, (n[1].ui, n[2].si,
11162 get_pointer(&n[3])));
11163 break;
11164 case OPCODE_DEPTH_INDEXED:
11165 CALL_DepthRangeIndexed(ctx->Exec, (n[1].ui, n[2].f, n[3].f));
11166 break;
11167 case OPCODE_ACTIVE_TEXTURE: /* GL_ARB_multitexture */
11168 CALL_ActiveTexture(ctx->Exec, (n[1].e));
11169 break;
11170 case OPCODE_COMPRESSED_TEX_IMAGE_1D: /* GL_ARB_texture_compression */
11171 CALL_CompressedTexImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].e,
11172 n[4].i, n[5].i, n[6].i,
11173 get_pointer(&n[7])));
11174 break;
11175 case OPCODE_COMPRESSED_TEX_IMAGE_2D: /* GL_ARB_texture_compression */
11176 CALL_CompressedTexImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].e,
11177 n[4].i, n[5].i, n[6].i,
11178 n[7].i, get_pointer(&n[8])));
11179 break;
11180 case OPCODE_COMPRESSED_TEX_IMAGE_3D: /* GL_ARB_texture_compression */
11181 CALL_CompressedTexImage3D(ctx->Exec, (n[1].e, n[2].i, n[3].e,
11182 n[4].i, n[5].i, n[6].i,
11183 n[7].i, n[8].i,
11184 get_pointer(&n[9])));
11185 break;
11186 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D: /* GL_ARB_texture_compress */
11187 CALL_CompressedTexSubImage1D(ctx->Exec,
11188 (n[1].e, n[2].i, n[3].i, n[4].i,
11189 n[5].e, n[6].i,
11190 get_pointer(&n[7])));
11191 break;
11192 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D: /* GL_ARB_texture_compress */
11193 CALL_CompressedTexSubImage2D(ctx->Exec,
11194 (n[1].e, n[2].i, n[3].i, n[4].i,
11195 n[5].i, n[6].i, n[7].e, n[8].i,
11196 get_pointer(&n[9])));
11197 break;
11198 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D: /* GL_ARB_texture_compress */
11199 CALL_CompressedTexSubImage3D(ctx->Exec,
11200 (n[1].e, n[2].i, n[3].i, n[4].i,
11201 n[5].i, n[6].i, n[7].i, n[8].i,
11202 n[9].e, n[10].i,
11203 get_pointer(&n[11])));
11204 break;
11205 case OPCODE_SAMPLE_COVERAGE: /* GL_ARB_multisample */
11206 CALL_SampleCoverage(ctx->Exec, (n[1].f, n[2].b));
11207 break;
11208 case OPCODE_WINDOW_POS_ARB: /* GL_ARB_window_pos */
11209 CALL_WindowPos3f(ctx->Exec, (n[1].f, n[2].f, n[3].f));
11210 break;
11211 case OPCODE_BIND_PROGRAM_ARB: /* GL_ARB_vertex_program */
11212 CALL_BindProgramARB(ctx->Exec, (n[1].e, n[2].ui));
11213 break;
11214 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB:
11215 CALL_ProgramLocalParameter4fARB(ctx->Exec,
11216 (n[1].e, n[2].ui, n[3].f, n[4].f,
11217 n[5].f, n[6].f));
11218 break;
11219 case OPCODE_ACTIVE_STENCIL_FACE_EXT:
11220 CALL_ActiveStencilFaceEXT(ctx->Exec, (n[1].e));
11221 break;
11222 case OPCODE_DEPTH_BOUNDS_EXT:
11223 CALL_DepthBoundsEXT(ctx->Exec, (n[1].f, n[2].f));
11224 break;
11225 case OPCODE_PROGRAM_STRING_ARB:
11226 CALL_ProgramStringARB(ctx->Exec,
11227 (n[1].e, n[2].e, n[3].i,
11228 get_pointer(&n[4])));
11229 break;
11230 case OPCODE_PROGRAM_ENV_PARAMETER_ARB:
11231 CALL_ProgramEnvParameter4fARB(ctx->Exec, (n[1].e, n[2].ui, n[3].f,
11232 n[4].f, n[5].f,
11233 n[6].f));
11234 break;
11235 case OPCODE_BEGIN_QUERY_ARB:
11236 CALL_BeginQuery(ctx->Exec, (n[1].e, n[2].ui));
11237 break;
11238 case OPCODE_END_QUERY_ARB:
11239 CALL_EndQuery(ctx->Exec, (n[1].e));
11240 break;
11241 case OPCODE_QUERY_COUNTER:
11242 CALL_QueryCounter(ctx->Exec, (n[1].ui, n[2].e));
11243 break;
11244 case OPCODE_BEGIN_QUERY_INDEXED:
11245 CALL_BeginQueryIndexed(ctx->Exec, (n[1].e, n[2].ui, n[3].ui));
11246 break;
11247 case OPCODE_END_QUERY_INDEXED:
11248 CALL_EndQueryIndexed(ctx->Exec, (n[1].e, n[2].ui));
11249 break;
11250 case OPCODE_DRAW_BUFFERS_ARB:
11251 {
11252 GLenum buffers[MAX_DRAW_BUFFERS];
11253 GLint i, count = MIN2(n[1].i, MAX_DRAW_BUFFERS);
11254 for (i = 0; i < count; i++)
11255 buffers[i] = n[2 + i].e;
11256 CALL_DrawBuffers(ctx->Exec, (n[1].i, buffers));
11257 }
11258 break;
11259 case OPCODE_BLIT_FRAMEBUFFER:
11260 CALL_BlitFramebuffer(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i,
11261 n[5].i, n[6].i, n[7].i, n[8].i,
11262 n[9].i, n[10].e));
11263 break;
11264 case OPCODE_PRIMITIVE_RESTART_NV:
11265 CALL_PrimitiveRestartNV(ctx->Exec, ());
11266 break;
11267
11268 case OPCODE_USE_PROGRAM:
11269 CALL_UseProgram(ctx->Exec, (n[1].ui));
11270 break;
11271 case OPCODE_UNIFORM_1F:
11272 CALL_Uniform1f(ctx->Exec, (n[1].i, n[2].f));
11273 break;
11274 case OPCODE_UNIFORM_2F:
11275 CALL_Uniform2f(ctx->Exec, (n[1].i, n[2].f, n[3].f));
11276 break;
11277 case OPCODE_UNIFORM_3F:
11278 CALL_Uniform3f(ctx->Exec, (n[1].i, n[2].f, n[3].f, n[4].f));
11279 break;
11280 case OPCODE_UNIFORM_4F:
11281 CALL_Uniform4f(ctx->Exec,
11282 (n[1].i, n[2].f, n[3].f, n[4].f, n[5].f));
11283 break;
11284 case OPCODE_UNIFORM_1FV:
11285 CALL_Uniform1fv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11286 break;
11287 case OPCODE_UNIFORM_2FV:
11288 CALL_Uniform2fv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11289 break;
11290 case OPCODE_UNIFORM_3FV:
11291 CALL_Uniform3fv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11292 break;
11293 case OPCODE_UNIFORM_4FV:
11294 CALL_Uniform4fv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11295 break;
11296 case OPCODE_UNIFORM_1D: {
11297 union float64_pair x;
11298
11299 x.uint32[0] = n[2].ui;
11300 x.uint32[1] = n[3].ui;
11301
11302 CALL_Uniform1d(ctx->Exec, (n[1].i, x.d));
11303 break;
11304 }
11305 case OPCODE_UNIFORM_2D: {
11306 union float64_pair x;
11307 union float64_pair y;
11308
11309 x.uint32[0] = n[2].ui;
11310 x.uint32[1] = n[3].ui;
11311 y.uint32[0] = n[4].ui;
11312 y.uint32[1] = n[5].ui;
11313
11314 CALL_Uniform2d(ctx->Exec, (n[1].i, x.d, y.d));
11315 break;
11316 }
11317 case OPCODE_UNIFORM_3D: {
11318 union float64_pair x;
11319 union float64_pair y;
11320 union float64_pair z;
11321
11322 x.uint32[0] = n[2].ui;
11323 x.uint32[1] = n[3].ui;
11324 y.uint32[0] = n[4].ui;
11325 y.uint32[1] = n[5].ui;
11326 z.uint32[0] = n[6].ui;
11327 z.uint32[1] = n[7].ui;
11328
11329 CALL_Uniform3d(ctx->Exec, (n[1].i, x.d, y.d, z.d));
11330 break;
11331 }
11332 case OPCODE_UNIFORM_4D: {
11333 union float64_pair x;
11334 union float64_pair y;
11335 union float64_pair z;
11336 union float64_pair w;
11337
11338 x.uint32[0] = n[2].ui;
11339 x.uint32[1] = n[3].ui;
11340 y.uint32[0] = n[4].ui;
11341 y.uint32[1] = n[5].ui;
11342 z.uint32[0] = n[6].ui;
11343 z.uint32[1] = n[7].ui;
11344 w.uint32[0] = n[8].ui;
11345 w.uint32[1] = n[9].ui;
11346
11347 CALL_Uniform4d(ctx->Exec, (n[1].i, x.d, y.d, z.d, w.d));
11348 break;
11349 }
11350 case OPCODE_UNIFORM_1DV:
11351 CALL_Uniform1dv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11352 break;
11353 case OPCODE_UNIFORM_2DV:
11354 CALL_Uniform2dv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11355 break;
11356 case OPCODE_UNIFORM_3DV:
11357 CALL_Uniform3dv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11358 break;
11359 case OPCODE_UNIFORM_4DV:
11360 CALL_Uniform4dv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11361 break;
11362 case OPCODE_UNIFORM_1I:
11363 CALL_Uniform1i(ctx->Exec, (n[1].i, n[2].i));
11364 break;
11365 case OPCODE_UNIFORM_2I:
11366 CALL_Uniform2i(ctx->Exec, (n[1].i, n[2].i, n[3].i));
11367 break;
11368 case OPCODE_UNIFORM_3I:
11369 CALL_Uniform3i(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
11370 break;
11371 case OPCODE_UNIFORM_4I:
11372 CALL_Uniform4i(ctx->Exec,
11373 (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
11374 break;
11375 case OPCODE_UNIFORM_1IV:
11376 CALL_Uniform1iv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11377 break;
11378 case OPCODE_UNIFORM_2IV:
11379 CALL_Uniform2iv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11380 break;
11381 case OPCODE_UNIFORM_3IV:
11382 CALL_Uniform3iv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11383 break;
11384 case OPCODE_UNIFORM_4IV:
11385 CALL_Uniform4iv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11386 break;
11387 case OPCODE_UNIFORM_1UI:
11388 CALL_Uniform1ui(ctx->Exec, (n[1].i, n[2].i));
11389 break;
11390 case OPCODE_UNIFORM_2UI:
11391 CALL_Uniform2ui(ctx->Exec, (n[1].i, n[2].i, n[3].i));
11392 break;
11393 case OPCODE_UNIFORM_3UI:
11394 CALL_Uniform3ui(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
11395 break;
11396 case OPCODE_UNIFORM_4UI:
11397 CALL_Uniform4ui(ctx->Exec,
11398 (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
11399 break;
11400 case OPCODE_UNIFORM_1UIV:
11401 CALL_Uniform1uiv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11402 break;
11403 case OPCODE_UNIFORM_2UIV:
11404 CALL_Uniform2uiv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11405 break;
11406 case OPCODE_UNIFORM_3UIV:
11407 CALL_Uniform3uiv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11408 break;
11409 case OPCODE_UNIFORM_4UIV:
11410 CALL_Uniform4uiv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11411 break;
11412 case OPCODE_UNIFORM_MATRIX22:
11413 CALL_UniformMatrix2fv(ctx->Exec,
11414 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11415 break;
11416 case OPCODE_UNIFORM_MATRIX33:
11417 CALL_UniformMatrix3fv(ctx->Exec,
11418 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11419 break;
11420 case OPCODE_UNIFORM_MATRIX44:
11421 CALL_UniformMatrix4fv(ctx->Exec,
11422 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11423 break;
11424 case OPCODE_UNIFORM_MATRIX23:
11425 CALL_UniformMatrix2x3fv(ctx->Exec,
11426 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11427 break;
11428 case OPCODE_UNIFORM_MATRIX32:
11429 CALL_UniformMatrix3x2fv(ctx->Exec,
11430 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11431 break;
11432 case OPCODE_UNIFORM_MATRIX24:
11433 CALL_UniformMatrix2x4fv(ctx->Exec,
11434 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11435 break;
11436 case OPCODE_UNIFORM_MATRIX42:
11437 CALL_UniformMatrix4x2fv(ctx->Exec,
11438 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11439 break;
11440 case OPCODE_UNIFORM_MATRIX34:
11441 CALL_UniformMatrix3x4fv(ctx->Exec,
11442 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11443 break;
11444 case OPCODE_UNIFORM_MATRIX43:
11445 CALL_UniformMatrix4x3fv(ctx->Exec,
11446 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11447 break;
11448 case OPCODE_UNIFORM_MATRIX22D:
11449 CALL_UniformMatrix2dv(ctx->Exec,
11450 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11451 break;
11452 case OPCODE_UNIFORM_MATRIX33D:
11453 CALL_UniformMatrix3dv(ctx->Exec,
11454 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11455 break;
11456 case OPCODE_UNIFORM_MATRIX44D:
11457 CALL_UniformMatrix4dv(ctx->Exec,
11458 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11459 break;
11460 case OPCODE_UNIFORM_MATRIX23D:
11461 CALL_UniformMatrix2x3dv(ctx->Exec,
11462 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11463 break;
11464 case OPCODE_UNIFORM_MATRIX32D:
11465 CALL_UniformMatrix3x2dv(ctx->Exec,
11466 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11467 break;
11468 case OPCODE_UNIFORM_MATRIX24D:
11469 CALL_UniformMatrix2x4dv(ctx->Exec,
11470 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11471 break;
11472 case OPCODE_UNIFORM_MATRIX42D:
11473 CALL_UniformMatrix4x2dv(ctx->Exec,
11474 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11475 break;
11476 case OPCODE_UNIFORM_MATRIX34D:
11477 CALL_UniformMatrix3x4dv(ctx->Exec,
11478 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11479 break;
11480 case OPCODE_UNIFORM_MATRIX43D:
11481 CALL_UniformMatrix4x3dv(ctx->Exec,
11482 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
11483 break;
11484
11485 case OPCODE_USE_PROGRAM_STAGES:
11486 CALL_UseProgramStages(ctx->Exec, (n[1].ui, n[2].ui, n[3].ui));
11487 break;
11488 case OPCODE_PROGRAM_UNIFORM_1F:
11489 CALL_ProgramUniform1f(ctx->Exec, (n[1].ui, n[2].i, n[3].f));
11490 break;
11491 case OPCODE_PROGRAM_UNIFORM_2F:
11492 CALL_ProgramUniform2f(ctx->Exec, (n[1].ui, n[2].i, n[3].f, n[4].f));
11493 break;
11494 case OPCODE_PROGRAM_UNIFORM_3F:
11495 CALL_ProgramUniform3f(ctx->Exec, (n[1].ui, n[2].i,
11496 n[3].f, n[4].f, n[5].f));
11497 break;
11498 case OPCODE_PROGRAM_UNIFORM_4F:
11499 CALL_ProgramUniform4f(ctx->Exec, (n[1].ui, n[2].i,
11500 n[3].f, n[4].f, n[5].f, n[6].f));
11501 break;
11502 case OPCODE_PROGRAM_UNIFORM_1FV:
11503 CALL_ProgramUniform1fv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11504 get_pointer(&n[4])));
11505 break;
11506 case OPCODE_PROGRAM_UNIFORM_2FV:
11507 CALL_ProgramUniform2fv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11508 get_pointer(&n[4])));
11509 break;
11510 case OPCODE_PROGRAM_UNIFORM_3FV:
11511 CALL_ProgramUniform3fv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11512 get_pointer(&n[4])));
11513 break;
11514 case OPCODE_PROGRAM_UNIFORM_4FV:
11515 CALL_ProgramUniform4fv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11516 get_pointer(&n[4])));
11517 break;
11518 case OPCODE_PROGRAM_UNIFORM_1D: {
11519 union float64_pair x;
11520
11521 x.uint32[0] = n[3].ui;
11522 x.uint32[1] = n[4].ui;
11523
11524 CALL_ProgramUniform1d(ctx->Exec, (n[1].ui, n[2].i, x.d));
11525 break;
11526 }
11527 case OPCODE_PROGRAM_UNIFORM_2D: {
11528 union float64_pair x;
11529 union float64_pair y;
11530
11531 x.uint32[0] = n[3].ui;
11532 x.uint32[1] = n[4].ui;
11533 y.uint32[0] = n[5].ui;
11534 y.uint32[1] = n[6].ui;
11535
11536 CALL_ProgramUniform2d(ctx->Exec, (n[1].ui, n[2].i, x.d, y.d));
11537 break;
11538 }
11539 case OPCODE_PROGRAM_UNIFORM_3D: {
11540 union float64_pair x;
11541 union float64_pair y;
11542 union float64_pair z;
11543
11544 x.uint32[0] = n[3].ui;
11545 x.uint32[1] = n[4].ui;
11546 y.uint32[0] = n[5].ui;
11547 y.uint32[1] = n[6].ui;
11548 z.uint32[0] = n[7].ui;
11549 z.uint32[1] = n[8].ui;
11550
11551 CALL_ProgramUniform3d(ctx->Exec, (n[1].ui, n[2].i,
11552 x.d, y.d, z.d));
11553 break;
11554 }
11555 case OPCODE_PROGRAM_UNIFORM_4D: {
11556 union float64_pair x;
11557 union float64_pair y;
11558 union float64_pair z;
11559 union float64_pair w;
11560
11561 x.uint32[0] = n[3].ui;
11562 x.uint32[1] = n[4].ui;
11563 y.uint32[0] = n[5].ui;
11564 y.uint32[1] = n[6].ui;
11565 z.uint32[0] = n[7].ui;
11566 z.uint32[1] = n[8].ui;
11567 w.uint32[0] = n[9].ui;
11568 w.uint32[1] = n[10].ui;
11569
11570 CALL_ProgramUniform4d(ctx->Exec, (n[1].ui, n[2].i,
11571 x.d, y.d, z.d, w.d));
11572 break;
11573 }
11574 case OPCODE_PROGRAM_UNIFORM_1DV:
11575 CALL_ProgramUniform1dv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11576 get_pointer(&n[4])));
11577 break;
11578 case OPCODE_PROGRAM_UNIFORM_2DV:
11579 CALL_ProgramUniform2dv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11580 get_pointer(&n[4])));
11581 break;
11582 case OPCODE_PROGRAM_UNIFORM_3DV:
11583 CALL_ProgramUniform3dv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11584 get_pointer(&n[4])));
11585 break;
11586 case OPCODE_PROGRAM_UNIFORM_4DV:
11587 CALL_ProgramUniform4dv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11588 get_pointer(&n[4])));
11589 break;
11590 case OPCODE_PROGRAM_UNIFORM_1I:
11591 CALL_ProgramUniform1i(ctx->Exec, (n[1].ui, n[2].i, n[3].i));
11592 break;
11593 case OPCODE_PROGRAM_UNIFORM_2I:
11594 CALL_ProgramUniform2i(ctx->Exec, (n[1].ui, n[2].i, n[3].i, n[4].i));
11595 break;
11596 case OPCODE_PROGRAM_UNIFORM_3I:
11597 CALL_ProgramUniform3i(ctx->Exec, (n[1].ui, n[2].i,
11598 n[3].i, n[4].i, n[5].i));
11599 break;
11600 case OPCODE_PROGRAM_UNIFORM_4I:
11601 CALL_ProgramUniform4i(ctx->Exec, (n[1].ui, n[2].i,
11602 n[3].i, n[4].i, n[5].i, n[6].i));
11603 break;
11604 case OPCODE_PROGRAM_UNIFORM_1IV:
11605 CALL_ProgramUniform1iv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11606 get_pointer(&n[4])));
11607 break;
11608 case OPCODE_PROGRAM_UNIFORM_2IV:
11609 CALL_ProgramUniform2iv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11610 get_pointer(&n[4])));
11611 break;
11612 case OPCODE_PROGRAM_UNIFORM_3IV:
11613 CALL_ProgramUniform3iv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11614 get_pointer(&n[4])));
11615 break;
11616 case OPCODE_PROGRAM_UNIFORM_4IV:
11617 CALL_ProgramUniform4iv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11618 get_pointer(&n[4])));
11619 break;
11620 case OPCODE_PROGRAM_UNIFORM_1UI:
11621 CALL_ProgramUniform1ui(ctx->Exec, (n[1].ui, n[2].i, n[3].ui));
11622 break;
11623 case OPCODE_PROGRAM_UNIFORM_2UI:
11624 CALL_ProgramUniform2ui(ctx->Exec, (n[1].ui, n[2].i,
11625 n[3].ui, n[4].ui));
11626 break;
11627 case OPCODE_PROGRAM_UNIFORM_3UI:
11628 CALL_ProgramUniform3ui(ctx->Exec, (n[1].ui, n[2].i,
11629 n[3].ui, n[4].ui, n[5].ui));
11630 break;
11631 case OPCODE_PROGRAM_UNIFORM_4UI:
11632 CALL_ProgramUniform4ui(ctx->Exec, (n[1].ui, n[2].i,
11633 n[3].ui,
11634 n[4].ui, n[5].ui, n[6].ui));
11635 break;
11636 case OPCODE_PROGRAM_UNIFORM_1UIV:
11637 CALL_ProgramUniform1uiv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11638 get_pointer(&n[4])));
11639 break;
11640 case OPCODE_PROGRAM_UNIFORM_2UIV:
11641 CALL_ProgramUniform2uiv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11642 get_pointer(&n[4])));
11643 break;
11644 case OPCODE_PROGRAM_UNIFORM_3UIV:
11645 CALL_ProgramUniform3uiv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11646 get_pointer(&n[4])));
11647 break;
11648 case OPCODE_PROGRAM_UNIFORM_4UIV:
11649 CALL_ProgramUniform4uiv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
11650 get_pointer(&n[4])));
11651 break;
11652 case OPCODE_PROGRAM_UNIFORM_MATRIX22F:
11653 CALL_ProgramUniformMatrix2fv(ctx->Exec,
11654 (n[1].ui, n[2].i, n[3].i, n[4].b,
11655 get_pointer(&n[5])));
11656 break;
11657 case OPCODE_PROGRAM_UNIFORM_MATRIX23F:
11658 CALL_ProgramUniformMatrix2x3fv(ctx->Exec,
11659 (n[1].ui, n[2].i, n[3].i, n[4].b,
11660 get_pointer(&n[5])));
11661 break;
11662 case OPCODE_PROGRAM_UNIFORM_MATRIX24F:
11663 CALL_ProgramUniformMatrix2x4fv(ctx->Exec,
11664 (n[1].ui, n[2].i, n[3].i, n[4].b,
11665 get_pointer(&n[5])));
11666 break;
11667 case OPCODE_PROGRAM_UNIFORM_MATRIX32F:
11668 CALL_ProgramUniformMatrix3x2fv(ctx->Exec,
11669 (n[1].ui, n[2].i, n[3].i, n[4].b,
11670 get_pointer(&n[5])));
11671 break;
11672 case OPCODE_PROGRAM_UNIFORM_MATRIX33F:
11673 CALL_ProgramUniformMatrix3fv(ctx->Exec,
11674 (n[1].ui, n[2].i, n[3].i, n[4].b,
11675 get_pointer(&n[5])));
11676 break;
11677 case OPCODE_PROGRAM_UNIFORM_MATRIX34F:
11678 CALL_ProgramUniformMatrix3x4fv(ctx->Exec,
11679 (n[1].ui, n[2].i, n[3].i, n[4].b,
11680 get_pointer(&n[5])));
11681 break;
11682 case OPCODE_PROGRAM_UNIFORM_MATRIX42F:
11683 CALL_ProgramUniformMatrix4x2fv(ctx->Exec,
11684 (n[1].ui, n[2].i, n[3].i, n[4].b,
11685 get_pointer(&n[5])));
11686 break;
11687 case OPCODE_PROGRAM_UNIFORM_MATRIX43F:
11688 CALL_ProgramUniformMatrix4x3fv(ctx->Exec,
11689 (n[1].ui, n[2].i, n[3].i, n[4].b,
11690 get_pointer(&n[5])));
11691 break;
11692 case OPCODE_PROGRAM_UNIFORM_MATRIX44F:
11693 CALL_ProgramUniformMatrix4fv(ctx->Exec,
11694 (n[1].ui, n[2].i, n[3].i, n[4].b,
11695 get_pointer(&n[5])));
11696 break;
11697 case OPCODE_PROGRAM_UNIFORM_MATRIX22D:
11698 CALL_ProgramUniformMatrix2dv(ctx->Exec,
11699 (n[1].ui, n[2].i, n[3].i, n[4].b,
11700 get_pointer(&n[5])));
11701 break;
11702 case OPCODE_PROGRAM_UNIFORM_MATRIX23D:
11703 CALL_ProgramUniformMatrix2x3dv(ctx->Exec,
11704 (n[1].ui, n[2].i, n[3].i, n[4].b,
11705 get_pointer(&n[5])));
11706 break;
11707 case OPCODE_PROGRAM_UNIFORM_MATRIX24D:
11708 CALL_ProgramUniformMatrix2x4dv(ctx->Exec,
11709 (n[1].ui, n[2].i, n[3].i, n[4].b,
11710 get_pointer(&n[5])));
11711 break;
11712 case OPCODE_PROGRAM_UNIFORM_MATRIX32D:
11713 CALL_ProgramUniformMatrix3x2dv(ctx->Exec,
11714 (n[1].ui, n[2].i, n[3].i, n[4].b,
11715 get_pointer(&n[5])));
11716 break;
11717 case OPCODE_PROGRAM_UNIFORM_MATRIX33D:
11718 CALL_ProgramUniformMatrix3dv(ctx->Exec,
11719 (n[1].ui, n[2].i, n[3].i, n[4].b,
11720 get_pointer(&n[5])));
11721 break;
11722 case OPCODE_PROGRAM_UNIFORM_MATRIX34D:
11723 CALL_ProgramUniformMatrix3x4dv(ctx->Exec,
11724 (n[1].ui, n[2].i, n[3].i, n[4].b,
11725 get_pointer(&n[5])));
11726 break;
11727 case OPCODE_PROGRAM_UNIFORM_MATRIX42D:
11728 CALL_ProgramUniformMatrix4x2dv(ctx->Exec,
11729 (n[1].ui, n[2].i, n[3].i, n[4].b,
11730 get_pointer(&n[5])));
11731 break;
11732 case OPCODE_PROGRAM_UNIFORM_MATRIX43D:
11733 CALL_ProgramUniformMatrix4x3dv(ctx->Exec,
11734 (n[1].ui, n[2].i, n[3].i, n[4].b,
11735 get_pointer(&n[5])));
11736 break;
11737 case OPCODE_PROGRAM_UNIFORM_MATRIX44D:
11738 CALL_ProgramUniformMatrix4dv(ctx->Exec,
11739 (n[1].ui, n[2].i, n[3].i, n[4].b,
11740 get_pointer(&n[5])));
11741 break;
11742
11743 case OPCODE_CLIP_CONTROL:
11744 CALL_ClipControl(ctx->Exec, (n[1].e, n[2].e));
11745 break;
11746
11747 case OPCODE_CLAMP_COLOR:
11748 CALL_ClampColor(ctx->Exec, (n[1].e, n[2].e));
11749 break;
11750
11751 case OPCODE_BIND_FRAGMENT_SHADER_ATI:
11752 CALL_BindFragmentShaderATI(ctx->Exec, (n[1].i));
11753 break;
11754 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI:
11755 CALL_SetFragmentShaderConstantATI(ctx->Exec, (n[1].ui, &n[2].f));
11756 break;
11757 case OPCODE_ATTR_1F_NV:
11758 CALL_VertexAttrib1fNV(ctx->Exec, (n[1].e, n[2].f));
11759 break;
11760 case OPCODE_ATTR_2F_NV:
11761 CALL_VertexAttrib2fvNV(ctx->Exec, (n[1].e, &n[2].f));
11762 break;
11763 case OPCODE_ATTR_3F_NV:
11764 CALL_VertexAttrib3fvNV(ctx->Exec, (n[1].e, &n[2].f));
11765 break;
11766 case OPCODE_ATTR_4F_NV:
11767 CALL_VertexAttrib4fvNV(ctx->Exec, (n[1].e, &n[2].f));
11768 break;
11769 case OPCODE_ATTR_1F_ARB:
11770 CALL_VertexAttrib1fARB(ctx->Exec, (n[1].e, n[2].f));
11771 break;
11772 case OPCODE_ATTR_2F_ARB:
11773 CALL_VertexAttrib2fvARB(ctx->Exec, (n[1].e, &n[2].f));
11774 break;
11775 case OPCODE_ATTR_3F_ARB:
11776 CALL_VertexAttrib3fvARB(ctx->Exec, (n[1].e, &n[2].f));
11777 break;
11778 case OPCODE_ATTR_4F_ARB:
11779 CALL_VertexAttrib4fvARB(ctx->Exec, (n[1].e, &n[2].f));
11780 break;
11781 case OPCODE_ATTR_1D: {
11782 GLdouble *d = (GLdouble *) &n[2];
11783 CALL_VertexAttribL1d(ctx->Exec, (n[1].ui, *d));
11784 break;
11785 }
11786 case OPCODE_ATTR_2D: {
11787 GLdouble *d = (GLdouble *) &n[2];
11788 CALL_VertexAttribL2dv(ctx->Exec, (n[1].ui, d));
11789 break;
11790 }
11791 case OPCODE_ATTR_3D: {
11792 GLdouble *d = (GLdouble *) &n[2];
11793 CALL_VertexAttribL3dv(ctx->Exec, (n[1].ui, d));
11794 break;
11795 }
11796 case OPCODE_ATTR_4D: {
11797 GLdouble *d = (GLdouble *) &n[2];
11798 CALL_VertexAttribL4dv(ctx->Exec, (n[1].ui, d));
11799 break;
11800 }
11801 case OPCODE_MATERIAL:
11802 CALL_Materialfv(ctx->Exec, (n[1].e, n[2].e, &n[3].f));
11803 break;
11804 case OPCODE_BEGIN:
11805 CALL_Begin(ctx->Exec, (n[1].e));
11806 break;
11807 case OPCODE_END:
11808 CALL_End(ctx->Exec, ());
11809 break;
11810 case OPCODE_RECTF:
11811 CALL_Rectf(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
11812 break;
11813 case OPCODE_EVAL_C1:
11814 CALL_EvalCoord1f(ctx->Exec, (n[1].f));
11815 break;
11816 case OPCODE_EVAL_C2:
11817 CALL_EvalCoord2f(ctx->Exec, (n[1].f, n[2].f));
11818 break;
11819 case OPCODE_EVAL_P1:
11820 CALL_EvalPoint1(ctx->Exec, (n[1].i));
11821 break;
11822 case OPCODE_EVAL_P2:
11823 CALL_EvalPoint2(ctx->Exec, (n[1].i, n[2].i));
11824 break;
11825
11826 /* GL_EXT_texture_integer */
11827 case OPCODE_CLEARCOLOR_I:
11828 CALL_ClearColorIiEXT(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
11829 break;
11830 case OPCODE_CLEARCOLOR_UI:
11831 CALL_ClearColorIuiEXT(ctx->Exec,
11832 (n[1].ui, n[2].ui, n[3].ui, n[4].ui));
11833 break;
11834 case OPCODE_TEXPARAMETER_I:
11835 {
11836 GLint params[4];
11837 params[0] = n[3].i;
11838 params[1] = n[4].i;
11839 params[2] = n[5].i;
11840 params[3] = n[6].i;
11841 CALL_TexParameterIiv(ctx->Exec, (n[1].e, n[2].e, params));
11842 }
11843 break;
11844 case OPCODE_TEXPARAMETER_UI:
11845 {
11846 GLuint params[4];
11847 params[0] = n[3].ui;
11848 params[1] = n[4].ui;
11849 params[2] = n[5].ui;
11850 params[3] = n[6].ui;
11851 CALL_TexParameterIuiv(ctx->Exec, (n[1].e, n[2].e, params));
11852 }
11853 break;
11854
11855 case OPCODE_VERTEX_ATTRIB_DIVISOR:
11856 /* GL_ARB_instanced_arrays */
11857 CALL_VertexAttribDivisor(ctx->Exec, (n[1].ui, n[2].ui));
11858 break;
11859
11860 case OPCODE_TEXTURE_BARRIER_NV:
11861 CALL_TextureBarrierNV(ctx->Exec, ());
11862 break;
11863
11864 /* GL_EXT/ARB_transform_feedback */
11865 case OPCODE_BEGIN_TRANSFORM_FEEDBACK:
11866 CALL_BeginTransformFeedback(ctx->Exec, (n[1].e));
11867 break;
11868 case OPCODE_END_TRANSFORM_FEEDBACK:
11869 CALL_EndTransformFeedback(ctx->Exec, ());
11870 break;
11871 case OPCODE_BIND_TRANSFORM_FEEDBACK:
11872 CALL_BindTransformFeedback(ctx->Exec, (n[1].e, n[2].ui));
11873 break;
11874 case OPCODE_PAUSE_TRANSFORM_FEEDBACK:
11875 CALL_PauseTransformFeedback(ctx->Exec, ());
11876 break;
11877 case OPCODE_RESUME_TRANSFORM_FEEDBACK:
11878 CALL_ResumeTransformFeedback(ctx->Exec, ());
11879 break;
11880 case OPCODE_DRAW_TRANSFORM_FEEDBACK:
11881 CALL_DrawTransformFeedback(ctx->Exec, (n[1].e, n[2].ui));
11882 break;
11883 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM:
11884 CALL_DrawTransformFeedbackStream(ctx->Exec,
11885 (n[1].e, n[2].ui, n[3].ui));
11886 break;
11887 case OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED:
11888 CALL_DrawTransformFeedbackInstanced(ctx->Exec,
11889 (n[1].e, n[2].ui, n[3].si));
11890 break;
11891 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED:
11892 CALL_DrawTransformFeedbackStreamInstanced(ctx->Exec,
11893 (n[1].e, n[2].ui, n[3].ui, n[4].si));
11894 break;
11895
11896
11897 case OPCODE_BIND_SAMPLER:
11898 CALL_BindSampler(ctx->Exec, (n[1].ui, n[2].ui));
11899 break;
11900 case OPCODE_SAMPLER_PARAMETERIV:
11901 {
11902 GLint params[4];
11903 params[0] = n[3].i;
11904 params[1] = n[4].i;
11905 params[2] = n[5].i;
11906 params[3] = n[6].i;
11907 CALL_SamplerParameteriv(ctx->Exec, (n[1].ui, n[2].e, params));
11908 }
11909 break;
11910 case OPCODE_SAMPLER_PARAMETERFV:
11911 {
11912 GLfloat params[4];
11913 params[0] = n[3].f;
11914 params[1] = n[4].f;
11915 params[2] = n[5].f;
11916 params[3] = n[6].f;
11917 CALL_SamplerParameterfv(ctx->Exec, (n[1].ui, n[2].e, params));
11918 }
11919 break;
11920 case OPCODE_SAMPLER_PARAMETERIIV:
11921 {
11922 GLint params[4];
11923 params[0] = n[3].i;
11924 params[1] = n[4].i;
11925 params[2] = n[5].i;
11926 params[3] = n[6].i;
11927 CALL_SamplerParameterIiv(ctx->Exec, (n[1].ui, n[2].e, params));
11928 }
11929 break;
11930 case OPCODE_SAMPLER_PARAMETERUIV:
11931 {
11932 GLuint params[4];
11933 params[0] = n[3].ui;
11934 params[1] = n[4].ui;
11935 params[2] = n[5].ui;
11936 params[3] = n[6].ui;
11937 CALL_SamplerParameterIuiv(ctx->Exec, (n[1].ui, n[2].e, params));
11938 }
11939 break;
11940
11941 /* ARB_compute_shader */
11942 case OPCODE_DISPATCH_COMPUTE:
11943 CALL_DispatchCompute(ctx->Exec, (n[1].ui, n[2].ui, n[3].ui));
11944 break;
11945
11946 /* GL_ARB_sync */
11947 case OPCODE_WAIT_SYNC:
11948 {
11949 union uint64_pair p;
11950 p.uint32[0] = n[2].ui;
11951 p.uint32[1] = n[3].ui;
11952 CALL_WaitSync(ctx->Exec,
11953 (get_pointer(&n[4]), n[1].bf, p.uint64));
11954 }
11955 break;
11956
11957 /* GL_NV_conditional_render */
11958 case OPCODE_BEGIN_CONDITIONAL_RENDER:
11959 CALL_BeginConditionalRender(ctx->Exec, (n[1].i, n[2].e));
11960 break;
11961 case OPCODE_END_CONDITIONAL_RENDER:
11962 CALL_EndConditionalRender(ctx->Exec, ());
11963 break;
11964
11965 case OPCODE_UNIFORM_BLOCK_BINDING:
11966 CALL_UniformBlockBinding(ctx->Exec, (n[1].ui, n[2].ui, n[3].ui));
11967 break;
11968
11969 case OPCODE_UNIFORM_SUBROUTINES:
11970 CALL_UniformSubroutinesuiv(ctx->Exec, (n[1].e, n[2].si,
11971 get_pointer(&n[3])));
11972 break;
11973
11974 /* GL_EXT_window_rectangles */
11975 case OPCODE_WINDOW_RECTANGLES:
11976 CALL_WindowRectanglesEXT(
11977 ctx->Exec, (n[1].e, n[2].si, get_pointer(&n[3])));
11978 break;
11979
11980 /* GL_NV_conservative_raster */
11981 case OPCODE_SUBPIXEL_PRECISION_BIAS:
11982 CALL_SubpixelPrecisionBiasNV(ctx->Exec, (n[1].ui, n[2].ui));
11983 break;
11984
11985 /* GL_NV_conservative_raster_dilate */
11986 case OPCODE_CONSERVATIVE_RASTER_PARAMETER_F:
11987 CALL_ConservativeRasterParameterfNV(ctx->Exec, (n[1].e, n[2].f));
11988 break;
11989
11990 /* GL_NV_conservative_raster_pre_snap_triangles */
11991 case OPCODE_CONSERVATIVE_RASTER_PARAMETER_I:
11992 CALL_ConservativeRasterParameteriNV(ctx->Exec, (n[1].e, n[2].i));
11993 break;
11994
11995 /* GL_EXT_direct_state_access */
11996 case OPCODE_MATRIX_LOAD:
11997 CALL_MatrixLoadfEXT(ctx->Exec, (n[1].e, &n[2].f));
11998 break;
11999 case OPCODE_MATRIX_MULT:
12000 CALL_MatrixMultfEXT(ctx->Exec, (n[1].e, &n[2].f));
12001 break;
12002 case OPCODE_MATRIX_ROTATE:
12003 CALL_MatrixRotatefEXT(ctx->Exec, (n[1].e, n[2].f, n[3].f, n[4].f, n[5].f));
12004 break;
12005 case OPCODE_MATRIX_SCALE:
12006 CALL_MatrixScalefEXT(ctx->Exec, (n[1].e, n[2].f, n[3].f, n[4].f));
12007 break;
12008 case OPCODE_MATRIX_TRANSLATE:
12009 CALL_MatrixTranslatefEXT(ctx->Exec, (n[1].e, n[2].f, n[3].f, n[4].f));
12010 break;
12011 case OPCODE_MATRIX_LOAD_IDENTITY:
12012 CALL_MatrixLoadIdentityEXT(ctx->Exec, (n[1].e));
12013 break;
12014 case OPCODE_MATRIX_ORTHO:
12015 CALL_MatrixOrthoEXT(ctx->Exec, (n[1].e,
12016 n[2].f, n[3].f, n[4].f,
12017 n[5].f, n[6].f, n[7].f));
12018 break;
12019 case OPCODE_MATRIX_FRUSTUM:
12020 CALL_MatrixFrustumEXT(ctx->Exec, (n[1].e,
12021 n[2].f, n[3].f, n[4].f,
12022 n[5].f, n[6].f, n[7].f));
12023 break;
12024 case OPCODE_MATRIX_PUSH:
12025 CALL_MatrixPushEXT(ctx->Exec, (n[1].e));
12026 break;
12027 case OPCODE_MATRIX_POP:
12028 CALL_MatrixPopEXT(ctx->Exec, (n[1].e));
12029 break;
12030 case OPCODE_TEXTUREPARAMETER_F:
12031 {
12032 GLfloat params[4];
12033 params[0] = n[4].f;
12034 params[1] = n[5].f;
12035 params[2] = n[6].f;
12036 params[3] = n[7].f;
12037 CALL_TextureParameterfvEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].e, params));
12038 }
12039 break;
12040 case OPCODE_TEXTUREPARAMETER_I:
12041 {
12042 GLint params[4];
12043 params[0] = n[4].i;
12044 params[1] = n[5].i;
12045 params[2] = n[6].i;
12046 params[3] = n[7].i;
12047 CALL_TextureParameterivEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].e, params));
12048 }
12049 break;
12050 case OPCODE_TEXTURE_IMAGE1D:
12051 {
12052 const struct gl_pixelstore_attrib save = ctx->Unpack;
12053 ctx->Unpack = ctx->DefaultPacking;
12054 CALL_TextureImage1DEXT(ctx->Exec, (n[1].ui, /* texture */
12055 n[2].e, /* target */
12056 n[3].i, /* level */
12057 n[4].i, /* components */
12058 n[5].i, /* width */
12059 n[6].e, /* border */
12060 n[7].e, /* format */
12061 n[8].e, /* type */
12062 get_pointer(&n[9])));
12063 ctx->Unpack = save; /* restore */
12064 }
12065 break;
12066 case OPCODE_TEXTURE_IMAGE2D:
12067 {
12068 const struct gl_pixelstore_attrib save = ctx->Unpack;
12069 ctx->Unpack = ctx->DefaultPacking;
12070 CALL_TextureImage2DEXT(ctx->Exec, (n[1].ui, /* texture */
12071 n[2].e, /* target */
12072 n[3].i, /* level */
12073 n[4].i, /* components */
12074 n[5].i, /* width */
12075 n[6].i, /* height */
12076 n[7].e, /* border */
12077 n[8].e, /* format */
12078 n[9].e, /* type */
12079 get_pointer(&n[10])));
12080 ctx->Unpack = save; /* restore */
12081 }
12082 break;
12083 case OPCODE_TEXTURE_IMAGE3D:
12084 {
12085 const struct gl_pixelstore_attrib save = ctx->Unpack;
12086 ctx->Unpack = ctx->DefaultPacking;
12087 CALL_TextureImage3DEXT(ctx->Exec, (n[1].ui, /* texture */
12088 n[2].e, /* target */
12089 n[3].i, /* level */
12090 n[4].i, /* components */
12091 n[5].i, /* width */
12092 n[6].i, /* height */
12093 n[7].i, /* depth */
12094 n[8].e, /* border */
12095 n[9].e, /* format */
12096 n[10].e, /* type */
12097 get_pointer(&n[11])));
12098 ctx->Unpack = save; /* restore */
12099 }
12100 break;
12101 case OPCODE_TEXTURE_SUB_IMAGE1D:
12102 {
12103 const struct gl_pixelstore_attrib save = ctx->Unpack;
12104 ctx->Unpack = ctx->DefaultPacking;
12105 CALL_TextureSubImage1DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
12106 n[4].i, n[5].i, n[6].e,
12107 n[7].e, get_pointer(&n[8])));
12108 ctx->Unpack = save; /* restore */
12109 }
12110 break;
12111 case OPCODE_TEXTURE_SUB_IMAGE2D:
12112 {
12113 const struct gl_pixelstore_attrib save = ctx->Unpack;
12114 ctx->Unpack = ctx->DefaultPacking;
12115 CALL_TextureSubImage2DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
12116 n[4].i, n[5].i, n[6].e,
12117 n[7].i, n[8].e, n[9].e,
12118 get_pointer(&n[10])));
12119 ctx->Unpack = save;
12120 }
12121 break;
12122 case OPCODE_TEXTURE_SUB_IMAGE3D:
12123 {
12124 const struct gl_pixelstore_attrib save = ctx->Unpack;
12125 ctx->Unpack = ctx->DefaultPacking;
12126 CALL_TextureSubImage3DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
12127 n[4].i, n[5].i, n[6].i,
12128 n[7].i, n[8].i, n[9].i,
12129 n[10].e, n[11].e,
12130 get_pointer(&n[12])));
12131 ctx->Unpack = save; /* restore */
12132 }
12133 break;
12134 case OPCODE_COPY_TEXTURE_IMAGE1D:
12135 CALL_CopyTextureImage1DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
12136 n[4].e, n[5].i, n[6].i,
12137 n[7].i, n[8].i));
12138 break;
12139 case OPCODE_COPY_TEXTURE_IMAGE2D:
12140 CALL_CopyTextureImage2DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
12141 n[4].e, n[5].i, n[6].i,
12142 n[7].i, n[8].i, n[9].i));
12143 break;
12144 case OPCODE_COPY_TEXTURE_SUB_IMAGE1D:
12145 CALL_CopyTextureSubImage1DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
12146 n[4].i, n[5].i, n[6].i,
12147 n[7].i));
12148 break;
12149 case OPCODE_COPY_TEXTURE_SUB_IMAGE2D:
12150 CALL_CopyTextureSubImage2DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
12151 n[4].i, n[5].i, n[6].i,
12152 n[7].i, n[8].i, n[9].i));
12153 break;
12154 case OPCODE_COPY_TEXTURE_SUB_IMAGE3D:
12155 CALL_CopyTextureSubImage3DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
12156 n[4].i, n[5].i, n[6].i,
12157 n[7].i, n[8].i, n[9].i,
12158 n[10].i));
12159 break;
12160 case OPCODE_BIND_MULTITEXTURE:
12161 CALL_BindMultiTextureEXT(ctx->Exec, (n[1].e, n[2].e, n[3].ui));
12162 break;
12163 case OPCODE_MULTITEXPARAMETER_F:
12164 {
12165 GLfloat params[4];
12166 params[0] = n[4].f;
12167 params[1] = n[5].f;
12168 params[2] = n[6].f;
12169 params[3] = n[7].f;
12170 CALL_MultiTexParameterfvEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, params));
12171 }
12172 break;
12173 case OPCODE_MULTITEXPARAMETER_I:
12174 {
12175 GLint params[4];
12176 params[0] = n[4].i;
12177 params[1] = n[5].i;
12178 params[2] = n[6].i;
12179 params[3] = n[7].i;
12180 CALL_MultiTexParameterivEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, params));
12181 }
12182 break;
12183 case OPCODE_MULTITEX_IMAGE1D:
12184 {
12185 const struct gl_pixelstore_attrib save = ctx->Unpack;
12186 ctx->Unpack = ctx->DefaultPacking;
12187 CALL_MultiTexImage1DEXT(ctx->Exec, (n[1].e, /* texture */
12188 n[2].e, /* target */
12189 n[3].i, /* level */
12190 n[4].i, /* components */
12191 n[5].i, /* width */
12192 n[6].e, /* border */
12193 n[7].e, /* format */
12194 n[8].e, /* type */
12195 get_pointer(&n[9])));
12196 ctx->Unpack = save; /* restore */
12197 }
12198 break;
12199 case OPCODE_MULTITEX_IMAGE2D:
12200 {
12201 const struct gl_pixelstore_attrib save = ctx->Unpack;
12202 ctx->Unpack = ctx->DefaultPacking;
12203 CALL_MultiTexImage2DEXT(ctx->Exec, (n[1].e, /* texture */
12204 n[2].e, /* target */
12205 n[3].i, /* level */
12206 n[4].i, /* components */
12207 n[5].i, /* width */
12208 n[6].i, /* height */
12209 n[7].e, /* border */
12210 n[8].e, /* format */
12211 n[9].e, /* type */
12212 get_pointer(&n[10])));
12213 ctx->Unpack = save; /* restore */
12214 }
12215 break;
12216 case OPCODE_MULTITEX_IMAGE3D:
12217 {
12218 const struct gl_pixelstore_attrib save = ctx->Unpack;
12219 ctx->Unpack = ctx->DefaultPacking;
12220 CALL_MultiTexImage3DEXT(ctx->Exec, (n[1].e, /* texture */
12221 n[2].e, /* target */
12222 n[3].i, /* level */
12223 n[4].i, /* components */
12224 n[5].i, /* width */
12225 n[6].i, /* height */
12226 n[7].i, /* depth */
12227 n[8].e, /* border */
12228 n[9].e, /* format */
12229 n[10].e, /* type */
12230 get_pointer(&n[11])));
12231 ctx->Unpack = save; /* restore */
12232 }
12233 break;
12234 case OPCODE_MULTITEX_SUB_IMAGE1D:
12235 {
12236 const struct gl_pixelstore_attrib save = ctx->Unpack;
12237 ctx->Unpack = ctx->DefaultPacking;
12238 CALL_MultiTexSubImage1DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
12239 n[4].i, n[5].i, n[6].e,
12240 n[7].e, get_pointer(&n[8])));
12241 ctx->Unpack = save; /* restore */
12242 }
12243 break;
12244 case OPCODE_MULTITEX_SUB_IMAGE2D:
12245 {
12246 const struct gl_pixelstore_attrib save = ctx->Unpack;
12247 ctx->Unpack = ctx->DefaultPacking;
12248 CALL_MultiTexSubImage2DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
12249 n[4].i, n[5].i, n[6].e,
12250 n[7].i, n[8].e, n[9].e,
12251 get_pointer(&n[10])));
12252 ctx->Unpack = save; /* restore */
12253 }
12254 break;
12255 case OPCODE_MULTITEX_SUB_IMAGE3D:
12256 {
12257 const struct gl_pixelstore_attrib save = ctx->Unpack;
12258 ctx->Unpack = ctx->DefaultPacking;
12259 CALL_MultiTexSubImage3DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
12260 n[4].i, n[5].i, n[6].i,
12261 n[7].i, n[8].i, n[9].i,
12262 n[10].e, n[11].e,
12263 get_pointer(&n[12])));
12264 ctx->Unpack = save; /* restore */
12265 }
12266 break;
12267 case OPCODE_COPY_MULTITEX_IMAGE1D:
12268 CALL_CopyMultiTexImage1DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
12269 n[4].e, n[5].i, n[6].i,
12270 n[7].i, n[8].i));
12271 break;
12272 case OPCODE_COPY_MULTITEX_IMAGE2D:
12273 CALL_CopyMultiTexImage2DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
12274 n[4].e, n[5].i, n[6].i,
12275 n[7].i, n[8].i, n[9].i));
12276 break;
12277 case OPCODE_COPY_MULTITEX_SUB_IMAGE1D:
12278 CALL_CopyMultiTexSubImage1DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
12279 n[4].i, n[5].i, n[6].i,
12280 n[7].i));
12281 break;
12282 case OPCODE_COPY_MULTITEX_SUB_IMAGE2D:
12283 CALL_CopyMultiTexSubImage2DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
12284 n[4].i, n[5].i, n[6].i,
12285 n[7].i, n[8].i, n[9].i));
12286 break;
12287 case OPCODE_COPY_MULTITEX_SUB_IMAGE3D:
12288 CALL_CopyMultiTexSubImage3DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
12289 n[4].i, n[5].i, n[6].i,
12290 n[7].i, n[8].i, n[9].i,
12291 n[10].i));
12292 break;
12293 case OPCODE_MULTITEXENV:
12294 {
12295 GLfloat params[4];
12296 params[0] = n[4].f;
12297 params[1] = n[5].f;
12298 params[2] = n[6].f;
12299 params[3] = n[7].f;
12300 CALL_MultiTexEnvfvEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, params));
12301 }
12302 break;
12303 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_2D:
12304 CALL_CompressedTextureSubImage2DEXT(ctx->Exec,
12305 (n[1].ui, n[2].e, n[3].i, n[4].i,
12306 n[5].i, n[6].i, n[7].i, n[8].e,
12307 n[9].i, get_pointer(&n[10])));
12308 break;
12309
12310 case OPCODE_CONTINUE:
12311 n = (Node *) get_pointer(&n[1]);
12312 break;
12313 case OPCODE_NOP:
12314 /* no-op */
12315 break;
12316 case OPCODE_END_OF_LIST:
12317 done = GL_TRUE;
12318 break;
12319 default:
12320 {
12321 char msg[1000];
12322 _mesa_snprintf(msg, sizeof(msg), "Error in execute_list: opcode=%d",
12323 (int) opcode);
12324 _mesa_problem(ctx, "%s", msg);
12325 }
12326 done = GL_TRUE;
12327 }
12328
12329 /* increment n to point to next compiled command */
12330 if (opcode != OPCODE_CONTINUE) {
12331 assert(InstSize[opcode] > 0);
12332 n += InstSize[opcode];
12333 }
12334 }
12335 }
12336
12337 vbo_save_EndCallList(ctx);
12338
12339 ctx->ListState.CallDepth--;
12340 }
12341
12342
12343
12344 /**********************************************************************/
12345 /* GL functions */
12346 /**********************************************************************/
12347
12348 /**
12349 * Test if a display list number is valid.
12350 */
12351 GLboolean GLAPIENTRY
12352 _mesa_IsList(GLuint list)
12353 {
12354 GET_CURRENT_CONTEXT(ctx);
12355 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
12356 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
12357 return islist(ctx, list);
12358 }
12359
12360
12361 /**
12362 * Delete a sequence of consecutive display lists.
12363 */
12364 void GLAPIENTRY
12365 _mesa_DeleteLists(GLuint list, GLsizei range)
12366 {
12367 GET_CURRENT_CONTEXT(ctx);
12368 GLuint i;
12369 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
12370 ASSERT_OUTSIDE_BEGIN_END(ctx);
12371
12372 if (range < 0) {
12373 _mesa_error(ctx, GL_INVALID_VALUE, "glDeleteLists");
12374 return;
12375 }
12376
12377 if (range > 1) {
12378 /* We may be deleting a set of bitmap lists. See if there's a
12379 * bitmap atlas to free.
12380 */
12381 struct gl_bitmap_atlas *atlas = lookup_bitmap_atlas(ctx, list);
12382 if (atlas) {
12383 _mesa_delete_bitmap_atlas(ctx, atlas);
12384 _mesa_HashRemove(ctx->Shared->BitmapAtlas, list);
12385 }
12386 }
12387
12388 for (i = list; i < list + range; i++) {
12389 destroy_list(ctx, i);
12390 }
12391 }
12392
12393
12394 /**
12395 * Return a display list number, n, such that lists n through n+range-1
12396 * are free.
12397 */
12398 GLuint GLAPIENTRY
12399 _mesa_GenLists(GLsizei range)
12400 {
12401 GET_CURRENT_CONTEXT(ctx);
12402 GLuint base;
12403 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
12404 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
12405
12406 if (range < 0) {
12407 _mesa_error(ctx, GL_INVALID_VALUE, "glGenLists");
12408 return 0;
12409 }
12410 if (range == 0) {
12411 return 0;
12412 }
12413
12414 /*
12415 * Make this an atomic operation
12416 */
12417 _mesa_HashLockMutex(ctx->Shared->DisplayList);
12418
12419 base = _mesa_HashFindFreeKeyBlock(ctx->Shared->DisplayList, range);
12420 if (base) {
12421 /* reserve the list IDs by with empty/dummy lists */
12422 GLint i;
12423 for (i = 0; i < range; i++) {
12424 _mesa_HashInsertLocked(ctx->Shared->DisplayList, base + i,
12425 make_list(base + i, 1));
12426 }
12427 }
12428
12429 if (USE_BITMAP_ATLAS &&
12430 range > 16 &&
12431 ctx->Driver.DrawAtlasBitmaps) {
12432 /* "range > 16" is a rough heuristic to guess when glGenLists might be
12433 * used to allocate display lists for glXUseXFont or wglUseFontBitmaps.
12434 * Create the empty atlas now.
12435 */
12436 struct gl_bitmap_atlas *atlas = lookup_bitmap_atlas(ctx, base);
12437 if (!atlas) {
12438 atlas = alloc_bitmap_atlas(ctx, base);
12439 }
12440 if (atlas) {
12441 /* Atlas _should_ be new/empty now, but clobbering is OK */
12442 assert(atlas->numBitmaps == 0);
12443 atlas->numBitmaps = range;
12444 }
12445 }
12446
12447 _mesa_HashUnlockMutex(ctx->Shared->DisplayList);
12448
12449 return base;
12450 }
12451
12452
12453 /**
12454 * Begin a new display list.
12455 */
12456 void GLAPIENTRY
12457 _mesa_NewList(GLuint name, GLenum mode)
12458 {
12459 GET_CURRENT_CONTEXT(ctx);
12460
12461 FLUSH_CURRENT(ctx, 0); /* must be called before assert */
12462 ASSERT_OUTSIDE_BEGIN_END(ctx);
12463
12464 if (MESA_VERBOSE & VERBOSE_API)
12465 _mesa_debug(ctx, "glNewList %u %s\n", name,
12466 _mesa_enum_to_string(mode));
12467
12468 if (name == 0) {
12469 _mesa_error(ctx, GL_INVALID_VALUE, "glNewList");
12470 return;
12471 }
12472
12473 if (mode != GL_COMPILE && mode != GL_COMPILE_AND_EXECUTE) {
12474 _mesa_error(ctx, GL_INVALID_ENUM, "glNewList");
12475 return;
12476 }
12477
12478 if (ctx->ListState.CurrentList) {
12479 /* already compiling a display list */
12480 _mesa_error(ctx, GL_INVALID_OPERATION, "glNewList");
12481 return;
12482 }
12483
12484 ctx->CompileFlag = GL_TRUE;
12485 ctx->ExecuteFlag = (mode == GL_COMPILE_AND_EXECUTE);
12486
12487 /* Reset accumulated list state */
12488 invalidate_saved_current_state( ctx );
12489
12490 /* Allocate new display list */
12491 ctx->ListState.CurrentList = make_list(name, BLOCK_SIZE);
12492 ctx->ListState.CurrentBlock = ctx->ListState.CurrentList->Head;
12493 ctx->ListState.CurrentPos = 0;
12494
12495 vbo_save_NewList(ctx, name, mode);
12496
12497 ctx->CurrentServerDispatch = ctx->Save;
12498 _glapi_set_dispatch(ctx->CurrentServerDispatch);
12499 if (ctx->MarshalExec == NULL) {
12500 ctx->CurrentClientDispatch = ctx->CurrentServerDispatch;
12501 }
12502 }
12503
12504
12505 /**
12506 * End definition of current display list.
12507 */
12508 void GLAPIENTRY
12509 _mesa_EndList(void)
12510 {
12511 GET_CURRENT_CONTEXT(ctx);
12512 SAVE_FLUSH_VERTICES(ctx);
12513 FLUSH_VERTICES(ctx, 0);
12514
12515 if (MESA_VERBOSE & VERBOSE_API)
12516 _mesa_debug(ctx, "glEndList\n");
12517
12518 if (ctx->ExecuteFlag && _mesa_inside_dlist_begin_end(ctx)) {
12519 _mesa_error(ctx, GL_INVALID_OPERATION,
12520 "glEndList() called inside glBegin/End");
12521 }
12522
12523 /* Check that a list is under construction */
12524 if (!ctx->ListState.CurrentList) {
12525 _mesa_error(ctx, GL_INVALID_OPERATION, "glEndList");
12526 return;
12527 }
12528
12529 /* Call before emitting END_OF_LIST, in case the driver wants to
12530 * emit opcodes itself.
12531 */
12532 vbo_save_EndList(ctx);
12533
12534 (void) alloc_instruction(ctx, OPCODE_END_OF_LIST, 0);
12535
12536 trim_list(ctx);
12537
12538 /* Destroy old list, if any */
12539 destroy_list(ctx, ctx->ListState.CurrentList->Name);
12540
12541 /* Install the new list */
12542 _mesa_HashInsert(ctx->Shared->DisplayList,
12543 ctx->ListState.CurrentList->Name,
12544 ctx->ListState.CurrentList);
12545
12546
12547 if (MESA_VERBOSE & VERBOSE_DISPLAY_LIST)
12548 mesa_print_display_list(ctx->ListState.CurrentList->Name);
12549
12550 ctx->ListState.CurrentList = NULL;
12551 ctx->ListState.CurrentBlock = NULL;
12552 ctx->ListState.CurrentPos = 0;
12553 ctx->ExecuteFlag = GL_TRUE;
12554 ctx->CompileFlag = GL_FALSE;
12555
12556 ctx->CurrentServerDispatch = ctx->Exec;
12557 _glapi_set_dispatch(ctx->CurrentServerDispatch);
12558 if (ctx->MarshalExec == NULL) {
12559 ctx->CurrentClientDispatch = ctx->CurrentServerDispatch;
12560 }
12561 }
12562
12563
12564 void GLAPIENTRY
12565 _mesa_CallList(GLuint list)
12566 {
12567 GLboolean save_compile_flag;
12568 GET_CURRENT_CONTEXT(ctx);
12569 FLUSH_CURRENT(ctx, 0);
12570
12571 if (MESA_VERBOSE & VERBOSE_API)
12572 _mesa_debug(ctx, "glCallList %d\n", list);
12573
12574 if (list == 0) {
12575 _mesa_error(ctx, GL_INVALID_VALUE, "glCallList(list==0)");
12576 return;
12577 }
12578
12579 if (0)
12580 mesa_print_display_list( list );
12581
12582 /* VERY IMPORTANT: Save the CompileFlag status, turn it off,
12583 * execute the display list, and restore the CompileFlag.
12584 */
12585 save_compile_flag = ctx->CompileFlag;
12586 if (save_compile_flag) {
12587 ctx->CompileFlag = GL_FALSE;
12588 }
12589
12590 execute_list(ctx, list);
12591 ctx->CompileFlag = save_compile_flag;
12592
12593 /* also restore API function pointers to point to "save" versions */
12594 if (save_compile_flag) {
12595 ctx->CurrentServerDispatch = ctx->Save;
12596 _glapi_set_dispatch(ctx->CurrentServerDispatch);
12597 if (ctx->MarshalExec == NULL) {
12598 ctx->CurrentClientDispatch = ctx->CurrentServerDispatch;
12599 }
12600 }
12601 }
12602
12603
12604 /**
12605 * Try to execute a glCallLists() command where the display lists contain
12606 * glBitmap commands with a texture atlas.
12607 * \return true for success, false otherwise
12608 */
12609 static bool
12610 render_bitmap_atlas(struct gl_context *ctx, GLsizei n, GLenum type,
12611 const void *lists)
12612 {
12613 struct gl_bitmap_atlas *atlas;
12614 int i;
12615
12616 if (!USE_BITMAP_ATLAS ||
12617 !ctx->Current.RasterPosValid ||
12618 ctx->List.ListBase == 0 ||
12619 type != GL_UNSIGNED_BYTE ||
12620 !ctx->Driver.DrawAtlasBitmaps) {
12621 /* unsupported */
12622 return false;
12623 }
12624
12625 atlas = lookup_bitmap_atlas(ctx, ctx->List.ListBase);
12626
12627 if (!atlas) {
12628 /* Even if glGenLists wasn't called, we can still try to create
12629 * the atlas now.
12630 */
12631 atlas = alloc_bitmap_atlas(ctx, ctx->List.ListBase);
12632 }
12633
12634 if (atlas && !atlas->complete && !atlas->incomplete) {
12635 /* Try to build the bitmap atlas now.
12636 * If the atlas was created in glGenLists, we'll have recorded the
12637 * number of lists (bitmaps). Otherwise, take a guess at 256.
12638 */
12639 if (atlas->numBitmaps == 0)
12640 atlas->numBitmaps = 256;
12641 build_bitmap_atlas(ctx, atlas, ctx->List.ListBase);
12642 }
12643
12644 if (!atlas || !atlas->complete) {
12645 return false;
12646 }
12647
12648 /* check that all display list IDs are in the atlas */
12649 for (i = 0; i < n; i++) {
12650 const GLubyte *ids = (const GLubyte *) lists;
12651
12652 if (ids[i] >= atlas->numBitmaps) {
12653 return false;
12654 }
12655 }
12656
12657 ctx->Driver.DrawAtlasBitmaps(ctx, atlas, n, (const GLubyte *) lists);
12658
12659 return true;
12660 }
12661
12662
12663 /**
12664 * Execute glCallLists: call multiple display lists.
12665 */
12666 void GLAPIENTRY
12667 _mesa_CallLists(GLsizei n, GLenum type, const GLvoid * lists)
12668 {
12669 GET_CURRENT_CONTEXT(ctx);
12670 GLint i;
12671 GLboolean save_compile_flag;
12672
12673 if (MESA_VERBOSE & VERBOSE_API)
12674 _mesa_debug(ctx, "glCallLists %d\n", n);
12675
12676 switch (type) {
12677 case GL_BYTE:
12678 case GL_UNSIGNED_BYTE:
12679 case GL_SHORT:
12680 case GL_UNSIGNED_SHORT:
12681 case GL_INT:
12682 case GL_UNSIGNED_INT:
12683 case GL_FLOAT:
12684 case GL_2_BYTES:
12685 case GL_3_BYTES:
12686 case GL_4_BYTES:
12687 /* OK */
12688 break;
12689 default:
12690 _mesa_error(ctx, GL_INVALID_ENUM, "glCallLists(type)");
12691 return;
12692 }
12693
12694 if (n < 0) {
12695 _mesa_error(ctx, GL_INVALID_VALUE, "glCallLists(n < 0)");
12696 return;
12697 } else if (n == 0 || lists == NULL) {
12698 /* nothing to do */
12699 return;
12700 }
12701
12702 if (render_bitmap_atlas(ctx, n, type, lists)) {
12703 return;
12704 }
12705
12706 /* Save the CompileFlag status, turn it off, execute display list,
12707 * and restore the CompileFlag.
12708 */
12709 save_compile_flag = ctx->CompileFlag;
12710 ctx->CompileFlag = GL_FALSE;
12711
12712 for (i = 0; i < n; i++) {
12713 GLuint list = (GLuint) (ctx->List.ListBase + translate_id(i, type, lists));
12714 execute_list(ctx, list);
12715 }
12716
12717 ctx->CompileFlag = save_compile_flag;
12718
12719 /* also restore API function pointers to point to "save" versions */
12720 if (save_compile_flag) {
12721 ctx->CurrentServerDispatch = ctx->Save;
12722 _glapi_set_dispatch(ctx->CurrentServerDispatch);
12723 if (ctx->MarshalExec == NULL) {
12724 ctx->CurrentClientDispatch = ctx->CurrentServerDispatch;
12725 }
12726 }
12727 }
12728
12729
12730 /**
12731 * Set the offset added to list numbers in glCallLists.
12732 */
12733 void GLAPIENTRY
12734 _mesa_ListBase(GLuint base)
12735 {
12736 GET_CURRENT_CONTEXT(ctx);
12737 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
12738 ASSERT_OUTSIDE_BEGIN_END(ctx);
12739 ctx->List.ListBase = base;
12740 }
12741
12742 /**
12743 * Setup the given dispatch table to point to Mesa's display list
12744 * building functions.
12745 *
12746 * This does not include any of the tnl functions - they are
12747 * initialized from _mesa_init_api_defaults and from the active vtxfmt
12748 * struct.
12749 */
12750 void
12751 _mesa_initialize_save_table(const struct gl_context *ctx)
12752 {
12753 struct _glapi_table *table = ctx->Save;
12754 int numEntries = MAX2(_gloffset_COUNT, _glapi_get_dispatch_table_size());
12755
12756 /* Initially populate the dispatch table with the contents of the
12757 * normal-execution dispatch table. This lets us skip populating functions
12758 * that should be called directly instead of compiled into display lists.
12759 */
12760 memcpy(table, ctx->Exec, numEntries * sizeof(_glapi_proc));
12761
12762 _mesa_loopback_init_api_table(ctx, table);
12763
12764 /* VBO functions */
12765 vbo_initialize_save_dispatch(ctx, table);
12766
12767 /* GL 1.0 */
12768 SET_Accum(table, save_Accum);
12769 SET_AlphaFunc(table, save_AlphaFunc);
12770 SET_Bitmap(table, save_Bitmap);
12771 SET_BlendFunc(table, save_BlendFunc);
12772 SET_CallList(table, save_CallList);
12773 SET_CallLists(table, save_CallLists);
12774 SET_Clear(table, save_Clear);
12775 SET_ClearAccum(table, save_ClearAccum);
12776 SET_ClearColor(table, save_ClearColor);
12777 SET_ClearDepth(table, save_ClearDepth);
12778 SET_ClearIndex(table, save_ClearIndex);
12779 SET_ClearStencil(table, save_ClearStencil);
12780 SET_ClipPlane(table, save_ClipPlane);
12781 SET_ColorMask(table, save_ColorMask);
12782 SET_ColorMaski(table, save_ColorMaskIndexed);
12783 SET_ColorMaterial(table, save_ColorMaterial);
12784 SET_CopyPixels(table, save_CopyPixels);
12785 SET_CullFace(table, save_CullFace);
12786 SET_DepthFunc(table, save_DepthFunc);
12787 SET_DepthMask(table, save_DepthMask);
12788 SET_DepthRange(table, save_DepthRange);
12789 SET_Disable(table, save_Disable);
12790 SET_Disablei(table, save_DisableIndexed);
12791 SET_DrawBuffer(table, save_DrawBuffer);
12792 SET_DrawPixels(table, save_DrawPixels);
12793 SET_Enable(table, save_Enable);
12794 SET_Enablei(table, save_EnableIndexed);
12795 SET_EvalMesh1(table, save_EvalMesh1);
12796 SET_EvalMesh2(table, save_EvalMesh2);
12797 SET_Fogf(table, save_Fogf);
12798 SET_Fogfv(table, save_Fogfv);
12799 SET_Fogi(table, save_Fogi);
12800 SET_Fogiv(table, save_Fogiv);
12801 SET_FrontFace(table, save_FrontFace);
12802 SET_Frustum(table, save_Frustum);
12803 SET_Hint(table, save_Hint);
12804 SET_IndexMask(table, save_IndexMask);
12805 SET_InitNames(table, save_InitNames);
12806 SET_LightModelf(table, save_LightModelf);
12807 SET_LightModelfv(table, save_LightModelfv);
12808 SET_LightModeli(table, save_LightModeli);
12809 SET_LightModeliv(table, save_LightModeliv);
12810 SET_Lightf(table, save_Lightf);
12811 SET_Lightfv(table, save_Lightfv);
12812 SET_Lighti(table, save_Lighti);
12813 SET_Lightiv(table, save_Lightiv);
12814 SET_LineStipple(table, save_LineStipple);
12815 SET_LineWidth(table, save_LineWidth);
12816 SET_ListBase(table, save_ListBase);
12817 SET_LoadIdentity(table, save_LoadIdentity);
12818 SET_LoadMatrixd(table, save_LoadMatrixd);
12819 SET_LoadMatrixf(table, save_LoadMatrixf);
12820 SET_LoadName(table, save_LoadName);
12821 SET_LogicOp(table, save_LogicOp);
12822 SET_Map1d(table, save_Map1d);
12823 SET_Map1f(table, save_Map1f);
12824 SET_Map2d(table, save_Map2d);
12825 SET_Map2f(table, save_Map2f);
12826 SET_MapGrid1d(table, save_MapGrid1d);
12827 SET_MapGrid1f(table, save_MapGrid1f);
12828 SET_MapGrid2d(table, save_MapGrid2d);
12829 SET_MapGrid2f(table, save_MapGrid2f);
12830 SET_MatrixMode(table, save_MatrixMode);
12831 SET_MultMatrixd(table, save_MultMatrixd);
12832 SET_MultMatrixf(table, save_MultMatrixf);
12833 SET_NewList(table, save_NewList);
12834 SET_Ortho(table, save_Ortho);
12835 SET_PassThrough(table, save_PassThrough);
12836 SET_PixelMapfv(table, save_PixelMapfv);
12837 SET_PixelMapuiv(table, save_PixelMapuiv);
12838 SET_PixelMapusv(table, save_PixelMapusv);
12839 SET_PixelTransferf(table, save_PixelTransferf);
12840 SET_PixelTransferi(table, save_PixelTransferi);
12841 SET_PixelZoom(table, save_PixelZoom);
12842 SET_PointSize(table, save_PointSize);
12843 SET_PolygonMode(table, save_PolygonMode);
12844 SET_PolygonOffset(table, save_PolygonOffset);
12845 SET_PolygonStipple(table, save_PolygonStipple);
12846 SET_PopAttrib(table, save_PopAttrib);
12847 SET_PopMatrix(table, save_PopMatrix);
12848 SET_PopName(table, save_PopName);
12849 SET_PushAttrib(table, save_PushAttrib);
12850 SET_PushMatrix(table, save_PushMatrix);
12851 SET_PushName(table, save_PushName);
12852 SET_RasterPos2d(table, save_RasterPos2d);
12853 SET_RasterPos2dv(table, save_RasterPos2dv);
12854 SET_RasterPos2f(table, save_RasterPos2f);
12855 SET_RasterPos2fv(table, save_RasterPos2fv);
12856 SET_RasterPos2i(table, save_RasterPos2i);
12857 SET_RasterPos2iv(table, save_RasterPos2iv);
12858 SET_RasterPos2s(table, save_RasterPos2s);
12859 SET_RasterPos2sv(table, save_RasterPos2sv);
12860 SET_RasterPos3d(table, save_RasterPos3d);
12861 SET_RasterPos3dv(table, save_RasterPos3dv);
12862 SET_RasterPos3f(table, save_RasterPos3f);
12863 SET_RasterPos3fv(table, save_RasterPos3fv);
12864 SET_RasterPos3i(table, save_RasterPos3i);
12865 SET_RasterPos3iv(table, save_RasterPos3iv);
12866 SET_RasterPos3s(table, save_RasterPos3s);
12867 SET_RasterPos3sv(table, save_RasterPos3sv);
12868 SET_RasterPos4d(table, save_RasterPos4d);
12869 SET_RasterPos4dv(table, save_RasterPos4dv);
12870 SET_RasterPos4f(table, save_RasterPos4f);
12871 SET_RasterPos4fv(table, save_RasterPos4fv);
12872 SET_RasterPos4i(table, save_RasterPos4i);
12873 SET_RasterPos4iv(table, save_RasterPos4iv);
12874 SET_RasterPos4s(table, save_RasterPos4s);
12875 SET_RasterPos4sv(table, save_RasterPos4sv);
12876 SET_ReadBuffer(table, save_ReadBuffer);
12877 SET_Rectf(table, save_Rectf);
12878 SET_Rotated(table, save_Rotated);
12879 SET_Rotatef(table, save_Rotatef);
12880 SET_Scaled(table, save_Scaled);
12881 SET_Scalef(table, save_Scalef);
12882 SET_Scissor(table, save_Scissor);
12883 SET_ShadeModel(table, save_ShadeModel);
12884 SET_StencilFunc(table, save_StencilFunc);
12885 SET_StencilMask(table, save_StencilMask);
12886 SET_StencilOp(table, save_StencilOp);
12887 SET_TexEnvf(table, save_TexEnvf);
12888 SET_TexEnvfv(table, save_TexEnvfv);
12889 SET_TexEnvi(table, save_TexEnvi);
12890 SET_TexEnviv(table, save_TexEnviv);
12891 SET_TexGend(table, save_TexGend);
12892 SET_TexGendv(table, save_TexGendv);
12893 SET_TexGenf(table, save_TexGenf);
12894 SET_TexGenfv(table, save_TexGenfv);
12895 SET_TexGeni(table, save_TexGeni);
12896 SET_TexGeniv(table, save_TexGeniv);
12897 SET_TexImage1D(table, save_TexImage1D);
12898 SET_TexImage2D(table, save_TexImage2D);
12899 SET_TexParameterf(table, save_TexParameterf);
12900 SET_TexParameterfv(table, save_TexParameterfv);
12901 SET_TexParameteri(table, save_TexParameteri);
12902 SET_TexParameteriv(table, save_TexParameteriv);
12903 SET_Translated(table, save_Translated);
12904 SET_Translatef(table, save_Translatef);
12905 SET_Viewport(table, save_Viewport);
12906
12907 /* GL 1.1 */
12908 SET_BindTexture(table, save_BindTexture);
12909 SET_CopyTexImage1D(table, save_CopyTexImage1D);
12910 SET_CopyTexImage2D(table, save_CopyTexImage2D);
12911 SET_CopyTexSubImage1D(table, save_CopyTexSubImage1D);
12912 SET_CopyTexSubImage2D(table, save_CopyTexSubImage2D);
12913 SET_PrioritizeTextures(table, save_PrioritizeTextures);
12914 SET_TexSubImage1D(table, save_TexSubImage1D);
12915 SET_TexSubImage2D(table, save_TexSubImage2D);
12916
12917 /* GL 1.2 */
12918 SET_CopyTexSubImage3D(table, save_CopyTexSubImage3D);
12919 SET_TexImage3D(table, save_TexImage3D);
12920 SET_TexSubImage3D(table, save_TexSubImage3D);
12921
12922 /* GL 2.0 */
12923 SET_StencilFuncSeparate(table, save_StencilFuncSeparate);
12924 SET_StencilMaskSeparate(table, save_StencilMaskSeparate);
12925 SET_StencilOpSeparate(table, save_StencilOpSeparate);
12926
12927 /* ATI_separate_stencil */
12928 SET_StencilFuncSeparateATI(table, save_StencilFuncSeparateATI);
12929
12930 /* GL_ARB_imaging */
12931 /* Not all are supported */
12932 SET_BlendColor(table, save_BlendColor);
12933 SET_BlendEquation(table, save_BlendEquation);
12934
12935 /* 2. GL_EXT_blend_color */
12936 #if 0
12937 SET_BlendColorEXT(table, save_BlendColorEXT);
12938 #endif
12939
12940 /* 6. GL_EXT_texture3d */
12941 #if 0
12942 SET_CopyTexSubImage3DEXT(table, save_CopyTexSubImage3D);
12943 SET_TexImage3DEXT(table, save_TexImage3DEXT);
12944 SET_TexSubImage3DEXT(table, save_TexSubImage3D);
12945 #endif
12946
12947 /* 37. GL_EXT_blend_minmax */
12948 #if 0
12949 SET_BlendEquationEXT(table, save_BlendEquationEXT);
12950 #endif
12951
12952 /* 54. GL_EXT_point_parameters */
12953 SET_PointParameterf(table, save_PointParameterfEXT);
12954 SET_PointParameterfv(table, save_PointParameterfvEXT);
12955
12956 /* 91. GL_ARB_tessellation_shader */
12957 SET_PatchParameteri(table, save_PatchParameteri);
12958 SET_PatchParameterfv(table, save_PatchParameterfv);
12959
12960 /* 100. ARB_viewport_array */
12961 SET_ViewportArrayv(table, save_ViewportArrayv);
12962 SET_ViewportIndexedf(table, save_ViewportIndexedf);
12963 SET_ViewportIndexedfv(table, save_ViewportIndexedfv);
12964 SET_ScissorArrayv(table, save_ScissorArrayv);
12965 SET_ScissorIndexed(table, save_ScissorIndexed);
12966 SET_ScissorIndexedv(table, save_ScissorIndexedv);
12967 SET_DepthRangeArrayv(table, save_DepthRangeArrayv);
12968 SET_DepthRangeIndexed(table, save_DepthRangeIndexed);
12969
12970 /* 122. ARB_compute_shader */
12971 SET_DispatchCompute(table, save_DispatchCompute);
12972 SET_DispatchComputeIndirect(table, save_DispatchComputeIndirect);
12973
12974 /* 173. GL_EXT_blend_func_separate */
12975 SET_BlendFuncSeparate(table, save_BlendFuncSeparateEXT);
12976
12977 /* 197. GL_MESA_window_pos */
12978 SET_WindowPos2d(table, save_WindowPos2dMESA);
12979 SET_WindowPos2dv(table, save_WindowPos2dvMESA);
12980 SET_WindowPos2f(table, save_WindowPos2fMESA);
12981 SET_WindowPos2fv(table, save_WindowPos2fvMESA);
12982 SET_WindowPos2i(table, save_WindowPos2iMESA);
12983 SET_WindowPos2iv(table, save_WindowPos2ivMESA);
12984 SET_WindowPos2s(table, save_WindowPos2sMESA);
12985 SET_WindowPos2sv(table, save_WindowPos2svMESA);
12986 SET_WindowPos3d(table, save_WindowPos3dMESA);
12987 SET_WindowPos3dv(table, save_WindowPos3dvMESA);
12988 SET_WindowPos3f(table, save_WindowPos3fMESA);
12989 SET_WindowPos3fv(table, save_WindowPos3fvMESA);
12990 SET_WindowPos3i(table, save_WindowPos3iMESA);
12991 SET_WindowPos3iv(table, save_WindowPos3ivMESA);
12992 SET_WindowPos3s(table, save_WindowPos3sMESA);
12993 SET_WindowPos3sv(table, save_WindowPos3svMESA);
12994 SET_WindowPos4dMESA(table, save_WindowPos4dMESA);
12995 SET_WindowPos4dvMESA(table, save_WindowPos4dvMESA);
12996 SET_WindowPos4fMESA(table, save_WindowPos4fMESA);
12997 SET_WindowPos4fvMESA(table, save_WindowPos4fvMESA);
12998 SET_WindowPos4iMESA(table, save_WindowPos4iMESA);
12999 SET_WindowPos4ivMESA(table, save_WindowPos4ivMESA);
13000 SET_WindowPos4sMESA(table, save_WindowPos4sMESA);
13001 SET_WindowPos4svMESA(table, save_WindowPos4svMESA);
13002
13003 /* 245. GL_ATI_fragment_shader */
13004 SET_BindFragmentShaderATI(table, save_BindFragmentShaderATI);
13005 SET_SetFragmentShaderConstantATI(table, save_SetFragmentShaderConstantATI);
13006
13007 /* 262. GL_NV_point_sprite */
13008 SET_PointParameteri(table, save_PointParameteriNV);
13009 SET_PointParameteriv(table, save_PointParameterivNV);
13010
13011 /* 268. GL_EXT_stencil_two_side */
13012 SET_ActiveStencilFaceEXT(table, save_ActiveStencilFaceEXT);
13013
13014 /* ???. GL_EXT_depth_bounds_test */
13015 SET_DepthBoundsEXT(table, save_DepthBoundsEXT);
13016
13017 /* ARB 1. GL_ARB_multitexture */
13018 SET_ActiveTexture(table, save_ActiveTextureARB);
13019
13020 /* ARB 3. GL_ARB_transpose_matrix */
13021 SET_LoadTransposeMatrixd(table, save_LoadTransposeMatrixdARB);
13022 SET_LoadTransposeMatrixf(table, save_LoadTransposeMatrixfARB);
13023 SET_MultTransposeMatrixd(table, save_MultTransposeMatrixdARB);
13024 SET_MultTransposeMatrixf(table, save_MultTransposeMatrixfARB);
13025
13026 /* ARB 5. GL_ARB_multisample */
13027 SET_SampleCoverage(table, save_SampleCoverageARB);
13028
13029 /* ARB 12. GL_ARB_texture_compression */
13030 SET_CompressedTexImage3D(table, save_CompressedTexImage3DARB);
13031 SET_CompressedTexImage2D(table, save_CompressedTexImage2DARB);
13032 SET_CompressedTexImage1D(table, save_CompressedTexImage1DARB);
13033 SET_CompressedTexSubImage3D(table, save_CompressedTexSubImage3DARB);
13034 SET_CompressedTexSubImage2D(table, save_CompressedTexSubImage2DARB);
13035 SET_CompressedTexSubImage1D(table, save_CompressedTexSubImage1DARB);
13036
13037 /* ARB 14. GL_ARB_point_parameters */
13038 /* aliased with EXT_point_parameters functions */
13039
13040 /* ARB 25. GL_ARB_window_pos */
13041 /* aliased with MESA_window_pos functions */
13042
13043 /* ARB 26. GL_ARB_vertex_program */
13044 /* ARB 27. GL_ARB_fragment_program */
13045 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
13046 SET_ProgramStringARB(table, save_ProgramStringARB);
13047 SET_BindProgramARB(table, save_BindProgramARB);
13048 SET_ProgramEnvParameter4dARB(table, save_ProgramEnvParameter4dARB);
13049 SET_ProgramEnvParameter4dvARB(table, save_ProgramEnvParameter4dvARB);
13050 SET_ProgramEnvParameter4fARB(table, save_ProgramEnvParameter4fARB);
13051 SET_ProgramEnvParameter4fvARB(table, save_ProgramEnvParameter4fvARB);
13052 SET_ProgramLocalParameter4dARB(table, save_ProgramLocalParameter4dARB);
13053 SET_ProgramLocalParameter4dvARB(table, save_ProgramLocalParameter4dvARB);
13054 SET_ProgramLocalParameter4fARB(table, save_ProgramLocalParameter4fARB);
13055 SET_ProgramLocalParameter4fvARB(table, save_ProgramLocalParameter4fvARB);
13056
13057 SET_BeginQuery(table, save_BeginQueryARB);
13058 SET_EndQuery(table, save_EndQueryARB);
13059 SET_QueryCounter(table, save_QueryCounter);
13060
13061 SET_DrawBuffers(table, save_DrawBuffersARB);
13062
13063 SET_BlitFramebuffer(table, save_BlitFramebufferEXT);
13064
13065 SET_UseProgram(table, save_UseProgram);
13066 SET_Uniform1f(table, save_Uniform1fARB);
13067 SET_Uniform2f(table, save_Uniform2fARB);
13068 SET_Uniform3f(table, save_Uniform3fARB);
13069 SET_Uniform4f(table, save_Uniform4fARB);
13070 SET_Uniform1fv(table, save_Uniform1fvARB);
13071 SET_Uniform2fv(table, save_Uniform2fvARB);
13072 SET_Uniform3fv(table, save_Uniform3fvARB);
13073 SET_Uniform4fv(table, save_Uniform4fvARB);
13074 SET_Uniform1i(table, save_Uniform1iARB);
13075 SET_Uniform2i(table, save_Uniform2iARB);
13076 SET_Uniform3i(table, save_Uniform3iARB);
13077 SET_Uniform4i(table, save_Uniform4iARB);
13078 SET_Uniform1iv(table, save_Uniform1ivARB);
13079 SET_Uniform2iv(table, save_Uniform2ivARB);
13080 SET_Uniform3iv(table, save_Uniform3ivARB);
13081 SET_Uniform4iv(table, save_Uniform4ivARB);
13082 SET_UniformMatrix2fv(table, save_UniformMatrix2fvARB);
13083 SET_UniformMatrix3fv(table, save_UniformMatrix3fvARB);
13084 SET_UniformMatrix4fv(table, save_UniformMatrix4fvARB);
13085 SET_UniformMatrix2x3fv(table, save_UniformMatrix2x3fv);
13086 SET_UniformMatrix3x2fv(table, save_UniformMatrix3x2fv);
13087 SET_UniformMatrix2x4fv(table, save_UniformMatrix2x4fv);
13088 SET_UniformMatrix4x2fv(table, save_UniformMatrix4x2fv);
13089 SET_UniformMatrix3x4fv(table, save_UniformMatrix3x4fv);
13090 SET_UniformMatrix4x3fv(table, save_UniformMatrix4x3fv);
13091
13092 /* 299. GL_EXT_blend_equation_separate */
13093 SET_BlendEquationSeparate(table, save_BlendEquationSeparateEXT);
13094
13095 /* GL_EXT_gpu_program_parameters */
13096 SET_ProgramEnvParameters4fvEXT(table, save_ProgramEnvParameters4fvEXT);
13097 SET_ProgramLocalParameters4fvEXT(table, save_ProgramLocalParameters4fvEXT);
13098
13099 /* 364. GL_EXT_provoking_vertex */
13100 SET_ProvokingVertex(table, save_ProvokingVertexEXT);
13101
13102 /* GL_EXT_texture_integer */
13103 SET_ClearColorIiEXT(table, save_ClearColorIi);
13104 SET_ClearColorIuiEXT(table, save_ClearColorIui);
13105 SET_TexParameterIiv(table, save_TexParameterIiv);
13106 SET_TexParameterIuiv(table, save_TexParameterIuiv);
13107
13108 /* GL_ARB_clip_control */
13109 SET_ClipControl(table, save_ClipControl);
13110
13111 /* GL_ARB_color_buffer_float */
13112 SET_ClampColor(table, save_ClampColorARB);
13113
13114 /* GL 3.0 */
13115 SET_ClearBufferiv(table, save_ClearBufferiv);
13116 SET_ClearBufferuiv(table, save_ClearBufferuiv);
13117 SET_ClearBufferfv(table, save_ClearBufferfv);
13118 SET_ClearBufferfi(table, save_ClearBufferfi);
13119 SET_Uniform1ui(table, save_Uniform1ui);
13120 SET_Uniform2ui(table, save_Uniform2ui);
13121 SET_Uniform3ui(table, save_Uniform3ui);
13122 SET_Uniform4ui(table, save_Uniform4ui);
13123 SET_Uniform1uiv(table, save_Uniform1uiv);
13124 SET_Uniform2uiv(table, save_Uniform2uiv);
13125 SET_Uniform3uiv(table, save_Uniform3uiv);
13126 SET_Uniform4uiv(table, save_Uniform4uiv);
13127
13128 /* GL_ARB_gpu_shader_fp64 */
13129 SET_Uniform1d(table, save_Uniform1d);
13130 SET_Uniform2d(table, save_Uniform2d);
13131 SET_Uniform3d(table, save_Uniform3d);
13132 SET_Uniform4d(table, save_Uniform4d);
13133 SET_Uniform1dv(table, save_Uniform1dv);
13134 SET_Uniform2dv(table, save_Uniform2dv);
13135 SET_Uniform3dv(table, save_Uniform3dv);
13136 SET_Uniform4dv(table, save_Uniform4dv);
13137 SET_UniformMatrix2dv(table, save_UniformMatrix2dv);
13138 SET_UniformMatrix3dv(table, save_UniformMatrix3dv);
13139 SET_UniformMatrix4dv(table, save_UniformMatrix4dv);
13140 SET_UniformMatrix2x3dv(table, save_UniformMatrix2x3dv);
13141 SET_UniformMatrix3x2dv(table, save_UniformMatrix3x2dv);
13142 SET_UniformMatrix2x4dv(table, save_UniformMatrix2x4dv);
13143 SET_UniformMatrix4x2dv(table, save_UniformMatrix4x2dv);
13144 SET_UniformMatrix3x4dv(table, save_UniformMatrix3x4dv);
13145 SET_UniformMatrix4x3dv(table, save_UniformMatrix4x3dv);
13146
13147 /* These are: */
13148 SET_BeginTransformFeedback(table, save_BeginTransformFeedback);
13149 SET_EndTransformFeedback(table, save_EndTransformFeedback);
13150 SET_BindTransformFeedback(table, save_BindTransformFeedback);
13151 SET_PauseTransformFeedback(table, save_PauseTransformFeedback);
13152 SET_ResumeTransformFeedback(table, save_ResumeTransformFeedback);
13153 SET_DrawTransformFeedback(table, save_DrawTransformFeedback);
13154 SET_DrawTransformFeedbackStream(table, save_DrawTransformFeedbackStream);
13155 SET_DrawTransformFeedbackInstanced(table,
13156 save_DrawTransformFeedbackInstanced);
13157 SET_DrawTransformFeedbackStreamInstanced(table,
13158 save_DrawTransformFeedbackStreamInstanced);
13159 SET_BeginQueryIndexed(table, save_BeginQueryIndexed);
13160 SET_EndQueryIndexed(table, save_EndQueryIndexed);
13161
13162 /* GL_ARB_instanced_arrays */
13163 SET_VertexAttribDivisor(table, save_VertexAttribDivisor);
13164
13165 /* GL_NV_texture_barrier */
13166 SET_TextureBarrierNV(table, save_TextureBarrierNV);
13167
13168 SET_BindSampler(table, save_BindSampler);
13169 SET_SamplerParameteri(table, save_SamplerParameteri);
13170 SET_SamplerParameterf(table, save_SamplerParameterf);
13171 SET_SamplerParameteriv(table, save_SamplerParameteriv);
13172 SET_SamplerParameterfv(table, save_SamplerParameterfv);
13173 SET_SamplerParameterIiv(table, save_SamplerParameterIiv);
13174 SET_SamplerParameterIuiv(table, save_SamplerParameterIuiv);
13175
13176 /* GL_ARB_draw_buffer_blend */
13177 SET_BlendFunciARB(table, save_BlendFunci);
13178 SET_BlendFuncSeparateiARB(table, save_BlendFuncSeparatei);
13179 SET_BlendEquationiARB(table, save_BlendEquationi);
13180 SET_BlendEquationSeparateiARB(table, save_BlendEquationSeparatei);
13181
13182 /* GL_NV_conditional_render */
13183 SET_BeginConditionalRender(table, save_BeginConditionalRender);
13184 SET_EndConditionalRender(table, save_EndConditionalRender);
13185
13186 /* GL_ARB_sync */
13187 SET_WaitSync(table, save_WaitSync);
13188
13189 /* GL_ARB_uniform_buffer_object */
13190 SET_UniformBlockBinding(table, save_UniformBlockBinding);
13191
13192 /* GL_ARB_shader_subroutines */
13193 SET_UniformSubroutinesuiv(table, save_UniformSubroutinesuiv);
13194
13195 /* GL_ARB_draw_instanced */
13196 SET_DrawArraysInstancedARB(table, save_DrawArraysInstancedARB);
13197 SET_DrawElementsInstancedARB(table, save_DrawElementsInstancedARB);
13198
13199 /* GL_ARB_draw_elements_base_vertex */
13200 SET_DrawElementsInstancedBaseVertex(table, save_DrawElementsInstancedBaseVertexARB);
13201
13202 /* GL_ARB_base_instance */
13203 SET_DrawArraysInstancedBaseInstance(table, save_DrawArraysInstancedBaseInstance);
13204 SET_DrawElementsInstancedBaseInstance(table, save_DrawElementsInstancedBaseInstance);
13205 SET_DrawElementsInstancedBaseVertexBaseInstance(table, save_DrawElementsInstancedBaseVertexBaseInstance);
13206
13207 /* GL_ARB_draw_indirect / GL_ARB_multi_draw_indirect */
13208 SET_DrawArraysIndirect(table, save_DrawArraysIndirect);
13209 SET_DrawElementsIndirect(table, save_DrawElementsIndirect);
13210 SET_MultiDrawArraysIndirect(table, save_MultiDrawArraysIndirect);
13211 SET_MultiDrawElementsIndirect(table, save_MultiDrawElementsIndirect);
13212
13213 /* OpenGL 4.2 / GL_ARB_separate_shader_objects */
13214 SET_UseProgramStages(table, save_UseProgramStages);
13215 SET_ProgramUniform1f(table, save_ProgramUniform1f);
13216 SET_ProgramUniform2f(table, save_ProgramUniform2f);
13217 SET_ProgramUniform3f(table, save_ProgramUniform3f);
13218 SET_ProgramUniform4f(table, save_ProgramUniform4f);
13219 SET_ProgramUniform1fv(table, save_ProgramUniform1fv);
13220 SET_ProgramUniform2fv(table, save_ProgramUniform2fv);
13221 SET_ProgramUniform3fv(table, save_ProgramUniform3fv);
13222 SET_ProgramUniform4fv(table, save_ProgramUniform4fv);
13223 SET_ProgramUniform1d(table, save_ProgramUniform1d);
13224 SET_ProgramUniform2d(table, save_ProgramUniform2d);
13225 SET_ProgramUniform3d(table, save_ProgramUniform3d);
13226 SET_ProgramUniform4d(table, save_ProgramUniform4d);
13227 SET_ProgramUniform1dv(table, save_ProgramUniform1dv);
13228 SET_ProgramUniform2dv(table, save_ProgramUniform2dv);
13229 SET_ProgramUniform3dv(table, save_ProgramUniform3dv);
13230 SET_ProgramUniform4dv(table, save_ProgramUniform4dv);
13231 SET_ProgramUniform1i(table, save_ProgramUniform1i);
13232 SET_ProgramUniform2i(table, save_ProgramUniform2i);
13233 SET_ProgramUniform3i(table, save_ProgramUniform3i);
13234 SET_ProgramUniform4i(table, save_ProgramUniform4i);
13235 SET_ProgramUniform1iv(table, save_ProgramUniform1iv);
13236 SET_ProgramUniform2iv(table, save_ProgramUniform2iv);
13237 SET_ProgramUniform3iv(table, save_ProgramUniform3iv);
13238 SET_ProgramUniform4iv(table, save_ProgramUniform4iv);
13239 SET_ProgramUniform1ui(table, save_ProgramUniform1ui);
13240 SET_ProgramUniform2ui(table, save_ProgramUniform2ui);
13241 SET_ProgramUniform3ui(table, save_ProgramUniform3ui);
13242 SET_ProgramUniform4ui(table, save_ProgramUniform4ui);
13243 SET_ProgramUniform1uiv(table, save_ProgramUniform1uiv);
13244 SET_ProgramUniform2uiv(table, save_ProgramUniform2uiv);
13245 SET_ProgramUniform3uiv(table, save_ProgramUniform3uiv);
13246 SET_ProgramUniform4uiv(table, save_ProgramUniform4uiv);
13247 SET_ProgramUniformMatrix2fv(table, save_ProgramUniformMatrix2fv);
13248 SET_ProgramUniformMatrix3fv(table, save_ProgramUniformMatrix3fv);
13249 SET_ProgramUniformMatrix4fv(table, save_ProgramUniformMatrix4fv);
13250 SET_ProgramUniformMatrix2x3fv(table, save_ProgramUniformMatrix2x3fv);
13251 SET_ProgramUniformMatrix3x2fv(table, save_ProgramUniformMatrix3x2fv);
13252 SET_ProgramUniformMatrix2x4fv(table, save_ProgramUniformMatrix2x4fv);
13253 SET_ProgramUniformMatrix4x2fv(table, save_ProgramUniformMatrix4x2fv);
13254 SET_ProgramUniformMatrix3x4fv(table, save_ProgramUniformMatrix3x4fv);
13255 SET_ProgramUniformMatrix4x3fv(table, save_ProgramUniformMatrix4x3fv);
13256 SET_ProgramUniformMatrix2dv(table, save_ProgramUniformMatrix2dv);
13257 SET_ProgramUniformMatrix3dv(table, save_ProgramUniformMatrix3dv);
13258 SET_ProgramUniformMatrix4dv(table, save_ProgramUniformMatrix4dv);
13259 SET_ProgramUniformMatrix2x3dv(table, save_ProgramUniformMatrix2x3dv);
13260 SET_ProgramUniformMatrix3x2dv(table, save_ProgramUniformMatrix3x2dv);
13261 SET_ProgramUniformMatrix2x4dv(table, save_ProgramUniformMatrix2x4dv);
13262 SET_ProgramUniformMatrix4x2dv(table, save_ProgramUniformMatrix4x2dv);
13263 SET_ProgramUniformMatrix3x4dv(table, save_ProgramUniformMatrix3x4dv);
13264 SET_ProgramUniformMatrix4x3dv(table, save_ProgramUniformMatrix4x3dv);
13265
13266 /* GL_{ARB,EXT}_polygon_offset_clamp */
13267 SET_PolygonOffsetClampEXT(table, save_PolygonOffsetClampEXT);
13268
13269 /* GL_EXT_window_rectangles */
13270 SET_WindowRectanglesEXT(table, save_WindowRectanglesEXT);
13271
13272 /* GL_NV_conservative_raster */
13273 SET_SubpixelPrecisionBiasNV(table, save_SubpixelPrecisionBiasNV);
13274
13275 /* GL_NV_conservative_raster_dilate */
13276 SET_ConservativeRasterParameterfNV(table, save_ConservativeRasterParameterfNV);
13277
13278 /* GL_NV_conservative_raster_pre_snap_triangles */
13279 SET_ConservativeRasterParameteriNV(table, save_ConservativeRasterParameteriNV);
13280
13281 /* GL_EXT_direct_state_access */
13282 SET_MatrixLoadfEXT(table, save_MatrixLoadfEXT);
13283 SET_MatrixLoaddEXT(table, save_MatrixLoaddEXT);
13284 SET_MatrixMultfEXT(table, save_MatrixMultfEXT);
13285 SET_MatrixMultdEXT(table, save_MatrixMultdEXT);
13286 SET_MatrixRotatefEXT(table, save_MatrixRotatefEXT);
13287 SET_MatrixRotatedEXT(table, save_MatrixRotatedEXT);
13288 SET_MatrixScalefEXT(table, save_MatrixScalefEXT);
13289 SET_MatrixScaledEXT(table, save_MatrixScaledEXT);
13290 SET_MatrixTranslatefEXT(table, save_MatrixTranslatefEXT);
13291 SET_MatrixTranslatedEXT(table, save_MatrixTranslatedEXT);
13292 SET_MatrixLoadIdentityEXT(table, save_MatrixLoadIdentityEXT);
13293 SET_MatrixOrthoEXT(table, save_MatrixOrthoEXT);
13294 SET_MatrixFrustumEXT(table, save_MatrixFrustumEXT);
13295 SET_MatrixPushEXT(table, save_MatrixPushEXT);
13296 SET_MatrixPopEXT(table, save_MatrixPopEXT);
13297 SET_MatrixLoadTransposefEXT(table, save_MatrixLoadTransposefEXT);
13298 SET_MatrixLoadTransposedEXT(table, save_MatrixLoadTransposedEXT);
13299 SET_MatrixMultTransposefEXT(table, save_MatrixMultTransposefEXT);
13300 SET_MatrixMultTransposedEXT(table, save_MatrixMultTransposedEXT);
13301 SET_TextureParameteriEXT(table, save_TextureParameteriEXT);
13302 SET_TextureParameterivEXT(table, save_TextureParameterivEXT);
13303 SET_TextureParameterfEXT(table, save_TextureParameterfEXT);
13304 SET_TextureParameterfvEXT(table, save_TextureParameterfvEXT);
13305 SET_TextureImage1DEXT(table, save_TextureImage1DEXT);
13306 SET_TextureImage2DEXT(table, save_TextureImage2DEXT);
13307 SET_TextureImage3DEXT(table, save_TextureImage3DEXT);
13308 SET_TextureSubImage1DEXT(table, save_TextureSubImage1DEXT);
13309 SET_TextureSubImage2DEXT(table, save_TextureSubImage2DEXT);
13310 SET_TextureSubImage3DEXT(table, save_TextureSubImage3DEXT);
13311 SET_CopyTextureImage1DEXT(table, save_CopyTextureImage1DEXT);
13312 SET_CopyTextureImage2DEXT(table, save_CopyTextureImage2DEXT);
13313 SET_CopyTextureSubImage1DEXT(table, save_CopyTextureSubImage1DEXT);
13314 SET_CopyTextureSubImage2DEXT(table, save_CopyTextureSubImage2DEXT);
13315 SET_CopyTextureSubImage3DEXT(table, save_CopyTextureSubImage3DEXT);
13316 SET_BindMultiTextureEXT(table, save_BindMultiTextureEXT);
13317 SET_MultiTexParameteriEXT(table, save_MultiTexParameteriEXT);
13318 SET_MultiTexParameterivEXT(table, save_MultiTexParameterivEXT);
13319 SET_MultiTexParameterfEXT(table, save_MultiTexParameterfEXT);
13320 SET_MultiTexParameterfvEXT(table, save_MultiTexParameterfvEXT);
13321 SET_MultiTexImage1DEXT(table, save_MultiTexImage1DEXT);
13322 SET_MultiTexImage2DEXT(table, save_MultiTexImage2DEXT);
13323 SET_MultiTexImage3DEXT(table, save_MultiTexImage3DEXT);
13324 SET_MultiTexSubImage1DEXT(table, save_MultiTexSubImage1DEXT);
13325 SET_MultiTexSubImage2DEXT(table, save_MultiTexSubImage2DEXT);
13326 SET_MultiTexSubImage3DEXT(table, save_MultiTexSubImage3DEXT);
13327 SET_CopyMultiTexImage1DEXT(table, save_CopyMultiTexImage1DEXT);
13328 SET_CopyMultiTexImage2DEXT(table, save_CopyMultiTexImage2DEXT);
13329 SET_CopyMultiTexSubImage1DEXT(table, save_CopyMultiTexSubImage1DEXT);
13330 SET_CopyMultiTexSubImage2DEXT(table, save_CopyMultiTexSubImage2DEXT);
13331 SET_CopyMultiTexSubImage3DEXT(table, save_CopyMultiTexSubImage3DEXT);
13332 SET_MultiTexEnvfEXT(table, save_MultiTexEnvfEXT);
13333 SET_MultiTexEnvfvEXT(table, save_MultiTexEnvfvEXT);
13334 SET_MultiTexEnviEXT(table, save_MultiTexEnviEXT);
13335 SET_MultiTexEnvivEXT(table, save_MultiTexEnvivEXT);
13336 SET_CompressedTextureSubImage2DEXT(table, save_CompressedTextureSubImage2DEXT);
13337 }
13338
13339
13340
13341 static const char *
13342 enum_string(GLenum k)
13343 {
13344 return _mesa_enum_to_string(k);
13345 }
13346
13347
13348 /**
13349 * Print the commands in a display list. For debugging only.
13350 * TODO: many commands aren't handled yet.
13351 * \param fname filename to write display list to. If null, use stdout.
13352 */
13353 static void GLAPIENTRY
13354 print_list(struct gl_context *ctx, GLuint list, const char *fname)
13355 {
13356 struct gl_display_list *dlist;
13357 Node *n;
13358 GLboolean done;
13359 FILE *f = stdout;
13360
13361 if (fname) {
13362 f = fopen(fname, "w");
13363 if (!f)
13364 return;
13365 }
13366
13367 if (!islist(ctx, list)) {
13368 fprintf(f, "%u is not a display list ID\n", list);
13369 goto out;
13370 }
13371
13372 dlist = _mesa_lookup_list(ctx, list);
13373 if (!dlist) {
13374 goto out;
13375 }
13376
13377 n = dlist->Head;
13378
13379 fprintf(f, "START-LIST %u, address %p\n", list, (void *) n);
13380
13381 done = n ? GL_FALSE : GL_TRUE;
13382 while (!done) {
13383 const OpCode opcode = n[0].opcode;
13384
13385 if (is_ext_opcode(opcode)) {
13386 n += ext_opcode_print(ctx, n, f);
13387 }
13388 else {
13389 switch (opcode) {
13390 case OPCODE_ACCUM:
13391 fprintf(f, "Accum %s %g\n", enum_string(n[1].e), n[2].f);
13392 break;
13393 case OPCODE_ACTIVE_TEXTURE:
13394 fprintf(f, "ActiveTexture(%s)\n", enum_string(n[1].e));
13395 break;
13396 case OPCODE_BITMAP:
13397 fprintf(f, "Bitmap %d %d %g %g %g %g %p\n", n[1].i, n[2].i,
13398 n[3].f, n[4].f, n[5].f, n[6].f,
13399 get_pointer(&n[7]));
13400 break;
13401 case OPCODE_BLEND_COLOR:
13402 fprintf(f, "BlendColor %f, %f, %f, %f\n",
13403 n[1].f, n[2].f, n[3].f, n[4].f);
13404 break;
13405 case OPCODE_BLEND_EQUATION:
13406 fprintf(f, "BlendEquation %s\n",
13407 enum_string(n[1].e));
13408 break;
13409 case OPCODE_BLEND_EQUATION_SEPARATE:
13410 fprintf(f, "BlendEquationSeparate %s, %s\n",
13411 enum_string(n[1].e),
13412 enum_string(n[2].e));
13413 break;
13414 case OPCODE_BLEND_FUNC_SEPARATE:
13415 fprintf(f, "BlendFuncSeparate %s, %s, %s, %s\n",
13416 enum_string(n[1].e),
13417 enum_string(n[2].e),
13418 enum_string(n[3].e),
13419 enum_string(n[4].e));
13420 break;
13421 case OPCODE_BLEND_EQUATION_I:
13422 fprintf(f, "BlendEquationi %u, %s\n",
13423 n[1].ui, enum_string(n[2].e));
13424 break;
13425 case OPCODE_BLEND_EQUATION_SEPARATE_I:
13426 fprintf(f, "BlendEquationSeparatei %u, %s, %s\n",
13427 n[1].ui, enum_string(n[2].e), enum_string(n[3].e));
13428 break;
13429 case OPCODE_BLEND_FUNC_I:
13430 fprintf(f, "BlendFunci %u, %s, %s\n",
13431 n[1].ui, enum_string(n[2].e), enum_string(n[3].e));
13432 break;
13433 case OPCODE_BLEND_FUNC_SEPARATE_I:
13434 fprintf(f, "BlendFuncSeparatei %u, %s, %s, %s, %s\n",
13435 n[1].ui,
13436 enum_string(n[2].e),
13437 enum_string(n[3].e),
13438 enum_string(n[4].e),
13439 enum_string(n[5].e));
13440 break;
13441 case OPCODE_CALL_LIST:
13442 fprintf(f, "CallList %d\n", (int) n[1].ui);
13443 break;
13444 case OPCODE_CALL_LISTS:
13445 fprintf(f, "CallLists %d, %s\n", n[1].i, enum_string(n[1].e));
13446 break;
13447 case OPCODE_DISABLE:
13448 fprintf(f, "Disable %s\n", enum_string(n[1].e));
13449 break;
13450 case OPCODE_ENABLE:
13451 fprintf(f, "Enable %s\n", enum_string(n[1].e));
13452 break;
13453 case OPCODE_FRUSTUM:
13454 fprintf(f, "Frustum %g %g %g %g %g %g\n",
13455 n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f);
13456 break;
13457 case OPCODE_LINE_STIPPLE:
13458 fprintf(f, "LineStipple %d %x\n", n[1].i, (int) n[2].us);
13459 break;
13460 case OPCODE_LINE_WIDTH:
13461 fprintf(f, "LineWidth %f\n", n[1].f);
13462 break;
13463 case OPCODE_LOAD_IDENTITY:
13464 fprintf(f, "LoadIdentity\n");
13465 break;
13466 case OPCODE_LOAD_MATRIX:
13467 fprintf(f, "LoadMatrix\n");
13468 fprintf(f, " %8f %8f %8f %8f\n",
13469 n[1].f, n[5].f, n[9].f, n[13].f);
13470 fprintf(f, " %8f %8f %8f %8f\n",
13471 n[2].f, n[6].f, n[10].f, n[14].f);
13472 fprintf(f, " %8f %8f %8f %8f\n",
13473 n[3].f, n[7].f, n[11].f, n[15].f);
13474 fprintf(f, " %8f %8f %8f %8f\n",
13475 n[4].f, n[8].f, n[12].f, n[16].f);
13476 break;
13477 case OPCODE_MULT_MATRIX:
13478 fprintf(f, "MultMatrix (or Rotate)\n");
13479 fprintf(f, " %8f %8f %8f %8f\n",
13480 n[1].f, n[5].f, n[9].f, n[13].f);
13481 fprintf(f, " %8f %8f %8f %8f\n",
13482 n[2].f, n[6].f, n[10].f, n[14].f);
13483 fprintf(f, " %8f %8f %8f %8f\n",
13484 n[3].f, n[7].f, n[11].f, n[15].f);
13485 fprintf(f, " %8f %8f %8f %8f\n",
13486 n[4].f, n[8].f, n[12].f, n[16].f);
13487 break;
13488 case OPCODE_ORTHO:
13489 fprintf(f, "Ortho %g %g %g %g %g %g\n",
13490 n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f);
13491 break;
13492 case OPCODE_POINT_SIZE:
13493 fprintf(f, "PointSize %f\n", n[1].f);
13494 break;
13495 case OPCODE_POP_ATTRIB:
13496 fprintf(f, "PopAttrib\n");
13497 break;
13498 case OPCODE_POP_MATRIX:
13499 fprintf(f, "PopMatrix\n");
13500 break;
13501 case OPCODE_POP_NAME:
13502 fprintf(f, "PopName\n");
13503 break;
13504 case OPCODE_PUSH_ATTRIB:
13505 fprintf(f, "PushAttrib %x\n", n[1].bf);
13506 break;
13507 case OPCODE_PUSH_MATRIX:
13508 fprintf(f, "PushMatrix\n");
13509 break;
13510 case OPCODE_PUSH_NAME:
13511 fprintf(f, "PushName %d\n", (int) n[1].ui);
13512 break;
13513 case OPCODE_RASTER_POS:
13514 fprintf(f, "RasterPos %g %g %g %g\n",
13515 n[1].f, n[2].f, n[3].f, n[4].f);
13516 break;
13517 case OPCODE_ROTATE:
13518 fprintf(f, "Rotate %g %g %g %g\n",
13519 n[1].f, n[2].f, n[3].f, n[4].f);
13520 break;
13521 case OPCODE_SCALE:
13522 fprintf(f, "Scale %g %g %g\n", n[1].f, n[2].f, n[3].f);
13523 break;
13524 case OPCODE_TRANSLATE:
13525 fprintf(f, "Translate %g %g %g\n", n[1].f, n[2].f, n[3].f);
13526 break;
13527 case OPCODE_BIND_TEXTURE:
13528 fprintf(f, "BindTexture %s %d\n",
13529 _mesa_enum_to_string(n[1].ui), n[2].ui);
13530 break;
13531 case OPCODE_SHADE_MODEL:
13532 fprintf(f, "ShadeModel %s\n", _mesa_enum_to_string(n[1].ui));
13533 break;
13534 case OPCODE_MAP1:
13535 fprintf(f, "Map1 %s %.3f %.3f %d %d\n",
13536 _mesa_enum_to_string(n[1].ui),
13537 n[2].f, n[3].f, n[4].i, n[5].i);
13538 break;
13539 case OPCODE_MAP2:
13540 fprintf(f, "Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
13541 _mesa_enum_to_string(n[1].ui),
13542 n[2].f, n[3].f, n[4].f, n[5].f,
13543 n[6].i, n[7].i, n[8].i, n[9].i);
13544 break;
13545 case OPCODE_MAPGRID1:
13546 fprintf(f, "MapGrid1 %d %.3f %.3f\n", n[1].i, n[2].f, n[3].f);
13547 break;
13548 case OPCODE_MAPGRID2:
13549 fprintf(f, "MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
13550 n[1].i, n[2].f, n[3].f, n[4].i, n[5].f, n[6].f);
13551 break;
13552 case OPCODE_EVALMESH1:
13553 fprintf(f, "EvalMesh1 %d %d\n", n[1].i, n[2].i);
13554 break;
13555 case OPCODE_EVALMESH2:
13556 fprintf(f, "EvalMesh2 %d %d %d %d\n",
13557 n[1].i, n[2].i, n[3].i, n[4].i);
13558 break;
13559
13560 case OPCODE_ATTR_1F_NV:
13561 fprintf(f, "ATTR_1F_NV attr %d: %f\n", n[1].i, n[2].f);
13562 break;
13563 case OPCODE_ATTR_2F_NV:
13564 fprintf(f, "ATTR_2F_NV attr %d: %f %f\n",
13565 n[1].i, n[2].f, n[3].f);
13566 break;
13567 case OPCODE_ATTR_3F_NV:
13568 fprintf(f, "ATTR_3F_NV attr %d: %f %f %f\n",
13569 n[1].i, n[2].f, n[3].f, n[4].f);
13570 break;
13571 case OPCODE_ATTR_4F_NV:
13572 fprintf(f, "ATTR_4F_NV attr %d: %f %f %f %f\n",
13573 n[1].i, n[2].f, n[3].f, n[4].f, n[5].f);
13574 break;
13575 case OPCODE_ATTR_1F_ARB:
13576 fprintf(f, "ATTR_1F_ARB attr %d: %f\n", n[1].i, n[2].f);
13577 break;
13578 case OPCODE_ATTR_2F_ARB:
13579 fprintf(f, "ATTR_2F_ARB attr %d: %f %f\n",
13580 n[1].i, n[2].f, n[3].f);
13581 break;
13582 case OPCODE_ATTR_3F_ARB:
13583 fprintf(f, "ATTR_3F_ARB attr %d: %f %f %f\n",
13584 n[1].i, n[2].f, n[3].f, n[4].f);
13585 break;
13586 case OPCODE_ATTR_4F_ARB:
13587 fprintf(f, "ATTR_4F_ARB attr %d: %f %f %f %f\n",
13588 n[1].i, n[2].f, n[3].f, n[4].f, n[5].f);
13589 break;
13590
13591 case OPCODE_MATERIAL:
13592 fprintf(f, "MATERIAL %x %x: %f %f %f %f\n",
13593 n[1].i, n[2].i, n[3].f, n[4].f, n[5].f, n[6].f);
13594 break;
13595 case OPCODE_BEGIN:
13596 fprintf(f, "BEGIN %x\n", n[1].i);
13597 break;
13598 case OPCODE_END:
13599 fprintf(f, "END\n");
13600 break;
13601 case OPCODE_RECTF:
13602 fprintf(f, "RECTF %f %f %f %f\n", n[1].f, n[2].f, n[3].f,
13603 n[4].f);
13604 break;
13605 case OPCODE_EVAL_C1:
13606 fprintf(f, "EVAL_C1 %f\n", n[1].f);
13607 break;
13608 case OPCODE_EVAL_C2:
13609 fprintf(f, "EVAL_C2 %f %f\n", n[1].f, n[2].f);
13610 break;
13611 case OPCODE_EVAL_P1:
13612 fprintf(f, "EVAL_P1 %d\n", n[1].i);
13613 break;
13614 case OPCODE_EVAL_P2:
13615 fprintf(f, "EVAL_P2 %d %d\n", n[1].i, n[2].i);
13616 break;
13617
13618 case OPCODE_PROVOKING_VERTEX:
13619 fprintf(f, "ProvokingVertex %s\n",
13620 _mesa_enum_to_string(n[1].ui));
13621 break;
13622
13623 /*
13624 * meta opcodes/commands
13625 */
13626 case OPCODE_ERROR:
13627 fprintf(f, "Error: %s %s\n", enum_string(n[1].e),
13628 (const char *) get_pointer(&n[2]));
13629 break;
13630 case OPCODE_CONTINUE:
13631 fprintf(f, "DISPLAY-LIST-CONTINUE\n");
13632 n = (Node *) get_pointer(&n[1]);
13633 break;
13634 case OPCODE_NOP:
13635 fprintf(f, "NOP\n");
13636 break;
13637 case OPCODE_END_OF_LIST:
13638 fprintf(f, "END-LIST %u\n", list);
13639 done = GL_TRUE;
13640 break;
13641 default:
13642 if (opcode < 0 || opcode > OPCODE_END_OF_LIST) {
13643 printf
13644 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
13645 opcode, (void *) n);
13646 goto out;
13647 }
13648 else {
13649 fprintf(f, "command %d, %u operands\n", opcode,
13650 InstSize[opcode]);
13651 }
13652 }
13653 /* increment n to point to next compiled command */
13654 if (opcode != OPCODE_CONTINUE) {
13655 assert(InstSize[opcode] > 0);
13656 n += InstSize[opcode];
13657 }
13658 }
13659 }
13660
13661 out:
13662 fflush(f);
13663 if (fname)
13664 fclose(f);
13665 }
13666
13667
13668
13669 /**
13670 * Clients may call this function to help debug display list problems.
13671 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
13672 * changed, or break in the future without notice.
13673 */
13674 void
13675 mesa_print_display_list(GLuint list)
13676 {
13677 GET_CURRENT_CONTEXT(ctx);
13678 print_list(ctx, list, NULL);
13679 }
13680
13681
13682 /**********************************************************************/
13683 /***** Initialization *****/
13684 /**********************************************************************/
13685
13686 static void
13687 save_vtxfmt_init(GLvertexformat * vfmt)
13688 {
13689 vfmt->ArrayElement = _ae_ArrayElement;
13690
13691 vfmt->Begin = save_Begin;
13692
13693 vfmt->CallList = save_CallList;
13694 vfmt->CallLists = save_CallLists;
13695
13696 vfmt->Color3f = save_Color3f;
13697 vfmt->Color3fv = save_Color3fv;
13698 vfmt->Color4f = save_Color4f;
13699 vfmt->Color4fv = save_Color4fv;
13700 vfmt->EdgeFlag = save_EdgeFlag;
13701 vfmt->End = save_End;
13702
13703 vfmt->EvalCoord1f = save_EvalCoord1f;
13704 vfmt->EvalCoord1fv = save_EvalCoord1fv;
13705 vfmt->EvalCoord2f = save_EvalCoord2f;
13706 vfmt->EvalCoord2fv = save_EvalCoord2fv;
13707 vfmt->EvalPoint1 = save_EvalPoint1;
13708 vfmt->EvalPoint2 = save_EvalPoint2;
13709
13710 vfmt->FogCoordfEXT = save_FogCoordfEXT;
13711 vfmt->FogCoordfvEXT = save_FogCoordfvEXT;
13712 vfmt->Indexf = save_Indexf;
13713 vfmt->Indexfv = save_Indexfv;
13714 vfmt->Materialfv = save_Materialfv;
13715 vfmt->MultiTexCoord1fARB = save_MultiTexCoord1f;
13716 vfmt->MultiTexCoord1fvARB = save_MultiTexCoord1fv;
13717 vfmt->MultiTexCoord2fARB = save_MultiTexCoord2f;
13718 vfmt->MultiTexCoord2fvARB = save_MultiTexCoord2fv;
13719 vfmt->MultiTexCoord3fARB = save_MultiTexCoord3f;
13720 vfmt->MultiTexCoord3fvARB = save_MultiTexCoord3fv;
13721 vfmt->MultiTexCoord4fARB = save_MultiTexCoord4f;
13722 vfmt->MultiTexCoord4fvARB = save_MultiTexCoord4fv;
13723 vfmt->Normal3f = save_Normal3f;
13724 vfmt->Normal3fv = save_Normal3fv;
13725 vfmt->SecondaryColor3fEXT = save_SecondaryColor3fEXT;
13726 vfmt->SecondaryColor3fvEXT = save_SecondaryColor3fvEXT;
13727 vfmt->TexCoord1f = save_TexCoord1f;
13728 vfmt->TexCoord1fv = save_TexCoord1fv;
13729 vfmt->TexCoord2f = save_TexCoord2f;
13730 vfmt->TexCoord2fv = save_TexCoord2fv;
13731 vfmt->TexCoord3f = save_TexCoord3f;
13732 vfmt->TexCoord3fv = save_TexCoord3fv;
13733 vfmt->TexCoord4f = save_TexCoord4f;
13734 vfmt->TexCoord4fv = save_TexCoord4fv;
13735 vfmt->Vertex2f = save_Vertex2f;
13736 vfmt->Vertex2fv = save_Vertex2fv;
13737 vfmt->Vertex3f = save_Vertex3f;
13738 vfmt->Vertex3fv = save_Vertex3fv;
13739 vfmt->Vertex4f = save_Vertex4f;
13740 vfmt->Vertex4fv = save_Vertex4fv;
13741 vfmt->VertexAttrib1fARB = save_VertexAttrib1fARB;
13742 vfmt->VertexAttrib1fvARB = save_VertexAttrib1fvARB;
13743 vfmt->VertexAttrib2fARB = save_VertexAttrib2fARB;
13744 vfmt->VertexAttrib2fvARB = save_VertexAttrib2fvARB;
13745 vfmt->VertexAttrib3fARB = save_VertexAttrib3fARB;
13746 vfmt->VertexAttrib3fvARB = save_VertexAttrib3fvARB;
13747 vfmt->VertexAttrib4fARB = save_VertexAttrib4fARB;
13748 vfmt->VertexAttrib4fvARB = save_VertexAttrib4fvARB;
13749 vfmt->VertexAttribL1d = save_VertexAttribL1d;
13750 vfmt->VertexAttribL1dv = save_VertexAttribL1dv;
13751 vfmt->VertexAttribL2d = save_VertexAttribL2d;
13752 vfmt->VertexAttribL2dv = save_VertexAttribL2dv;
13753 vfmt->VertexAttribL3d = save_VertexAttribL3d;
13754 vfmt->VertexAttribL3dv = save_VertexAttribL3dv;
13755 vfmt->VertexAttribL4d = save_VertexAttribL4d;
13756 vfmt->VertexAttribL4dv = save_VertexAttribL4dv;
13757
13758 vfmt->PrimitiveRestartNV = save_PrimitiveRestartNV;
13759 }
13760
13761
13762 void
13763 _mesa_install_dlist_vtxfmt(struct _glapi_table *disp,
13764 const GLvertexformat *vfmt)
13765 {
13766 SET_CallList(disp, vfmt->CallList);
13767 SET_CallLists(disp, vfmt->CallLists);
13768 }
13769
13770
13771 /**
13772 * Initialize display list state for given context.
13773 */
13774 void
13775 _mesa_init_display_list(struct gl_context *ctx)
13776 {
13777 static GLboolean tableInitialized = GL_FALSE;
13778
13779 /* zero-out the instruction size table, just once */
13780 if (!tableInitialized) {
13781 memset(InstSize, 0, sizeof(InstSize));
13782 tableInitialized = GL_TRUE;
13783 }
13784
13785 /* extension info */
13786 ctx->ListExt = CALLOC_STRUCT(gl_list_extensions);
13787
13788 /* Display list */
13789 ctx->ListState.CallDepth = 0;
13790 ctx->ExecuteFlag = GL_TRUE;
13791 ctx->CompileFlag = GL_FALSE;
13792 ctx->ListState.CurrentBlock = NULL;
13793 ctx->ListState.CurrentPos = 0;
13794
13795 /* Display List group */
13796 ctx->List.ListBase = 0;
13797
13798 save_vtxfmt_init(&ctx->ListState.ListVtxfmt);
13799
13800 InstSize[OPCODE_NOP] = 1;
13801 }
13802
13803
13804 void
13805 _mesa_free_display_list_data(struct gl_context *ctx)
13806 {
13807 free(ctx->ListExt);
13808 ctx->ListExt = NULL;
13809 }