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
35 #include "api_arrayelt.h"
36 #include "api_exec.h"
37 #include "draw_validate.h"
38 #include "atifragshader.h"
39 #include "config.h"
40 #include "bufferobj.h"
41 #include "arrayobj.h"
42 #include "context.h"
43 #include "dlist.h"
44 #include "enums.h"
45 #include "eval.h"
46 #include "fbobject.h"
47 #include "framebuffer.h"
48 #include "glapi/glapi.h"
49 #include "glformats.h"
50 #include "hash.h"
51 #include "image.h"
52 #include "light.h"
53 #include "macros.h"
54 #include "pack.h"
55 #include "pbo.h"
56 #include "queryobj.h"
57 #include "samplerobj.h"
58 #include "shaderapi.h"
59 #include "syncobj.h"
60 #include "teximage.h"
61 #include "texstorage.h"
62 #include "mtypes.h"
63 #include "varray.h"
64 #include "arbprogram.h"
65 #include "transformfeedback.h"
66 #include "glthread_marshal.h"
67
68 #include "math/m_matrix.h"
69
70 #include "main/dispatch.h"
71
72 #include "vbo/vbo.h"
73 #include "vbo/vbo_util.h"
74 #include "vbo/vbo_save.h"
75 #include "util/format_r11g11b10f.h"
76 #include "util/u_inlines.h"
77 #include "util/u_memory.h"
78
79 #define USE_BITMAP_ATLAS 1
80
81 /**
82 * Flush vertices.
83 *
84 * \param ctx GL context.
85 *
86 * Checks if dd_function_table::SaveNeedFlush is marked to flush
87 * stored (save) vertices, and calls vbo_save_SaveFlushVertices if so.
88 */
89 #define SAVE_FLUSH_VERTICES(ctx) \
90 do { \
91 if (ctx->Driver.SaveNeedFlush) \
92 vbo_save_SaveFlushVertices(ctx); \
93 } while (0)
94
95
96 /**
97 * Macro to assert that the API call was made outside the
98 * glBegin()/glEnd() pair, with return value.
99 *
100 * \param ctx GL context.
101 * \param retval value to return value in case the assertion fails.
102 */
103 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval) \
104 do { \
105 if (ctx->Driver.CurrentSavePrimitive <= PRIM_MAX) { \
106 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glBegin/End" ); \
107 return retval; \
108 } \
109 } while (0)
110
111 /**
112 * Macro to assert that the API call was made outside the
113 * glBegin()/glEnd() pair.
114 *
115 * \param ctx GL context.
116 */
117 #define ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx) \
118 do { \
119 if (ctx->Driver.CurrentSavePrimitive <= PRIM_MAX) { \
120 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glBegin/End" ); \
121 return; \
122 } \
123 } while (0)
124
125 /**
126 * Macro to assert that the API call was made outside the
127 * glBegin()/glEnd() pair and flush the vertices.
128 *
129 * \param ctx GL context.
130 */
131 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx) \
132 do { \
133 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx); \
134 SAVE_FLUSH_VERTICES(ctx); \
135 } while (0)
136
137 /**
138 * Macro to assert that the API call was made outside the
139 * glBegin()/glEnd() pair and flush the vertices, with return value.
140 *
141 * \param ctx GL context.
142 * \param retval value to return value in case the assertion fails.
143 */
144 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval) \
145 do { \
146 ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval); \
147 SAVE_FLUSH_VERTICES(ctx); \
148 } while (0)
149
150
151 /**
152 * Display list opcodes.
153 */
154 typedef enum
155 {
156 OPCODE_INVALID = -1, /* Force signed enum */
157 OPCODE_ACCUM,
158 OPCODE_ALPHA_FUNC,
159 OPCODE_BIND_TEXTURE,
160 OPCODE_BITMAP,
161 OPCODE_BLEND_COLOR,
162 OPCODE_BLEND_EQUATION,
163 OPCODE_BLEND_EQUATION_SEPARATE,
164 OPCODE_BLEND_FUNC_SEPARATE,
165
166 OPCODE_BLEND_EQUATION_I,
167 OPCODE_BLEND_EQUATION_SEPARATE_I,
168 OPCODE_BLEND_FUNC_I,
169 OPCODE_BLEND_FUNC_SEPARATE_I,
170
171 OPCODE_CALL_LIST,
172 OPCODE_CALL_LISTS,
173 OPCODE_CLEAR,
174 OPCODE_CLEAR_ACCUM,
175 OPCODE_CLEAR_COLOR,
176 OPCODE_CLEAR_DEPTH,
177 OPCODE_CLEAR_INDEX,
178 OPCODE_CLEAR_STENCIL,
179 OPCODE_CLEAR_BUFFER_IV,
180 OPCODE_CLEAR_BUFFER_UIV,
181 OPCODE_CLEAR_BUFFER_FV,
182 OPCODE_CLEAR_BUFFER_FI,
183 OPCODE_CLIP_PLANE,
184 OPCODE_COLOR_MASK,
185 OPCODE_COLOR_MASK_INDEXED,
186 OPCODE_COLOR_MATERIAL,
187 OPCODE_COPY_PIXELS,
188 OPCODE_COPY_TEX_IMAGE1D,
189 OPCODE_COPY_TEX_IMAGE2D,
190 OPCODE_COPY_TEX_SUB_IMAGE1D,
191 OPCODE_COPY_TEX_SUB_IMAGE2D,
192 OPCODE_COPY_TEX_SUB_IMAGE3D,
193 OPCODE_CULL_FACE,
194 OPCODE_DEPTH_FUNC,
195 OPCODE_DEPTH_MASK,
196 OPCODE_DEPTH_RANGE,
197 OPCODE_DISABLE,
198 OPCODE_DISABLE_INDEXED,
199 OPCODE_DRAW_BUFFER,
200 OPCODE_DRAW_PIXELS,
201 OPCODE_ENABLE,
202 OPCODE_ENABLE_INDEXED,
203 OPCODE_EVALMESH1,
204 OPCODE_EVALMESH2,
205 OPCODE_FOG,
206 OPCODE_FRONT_FACE,
207 OPCODE_FRUSTUM,
208 OPCODE_HINT,
209 OPCODE_INDEX_MASK,
210 OPCODE_INIT_NAMES,
211 OPCODE_LIGHT,
212 OPCODE_LIGHT_MODEL,
213 OPCODE_LINE_STIPPLE,
214 OPCODE_LINE_WIDTH,
215 OPCODE_LIST_BASE,
216 OPCODE_LOAD_IDENTITY,
217 OPCODE_LOAD_MATRIX,
218 OPCODE_LOAD_NAME,
219 OPCODE_LOGIC_OP,
220 OPCODE_MAP1,
221 OPCODE_MAP2,
222 OPCODE_MAPGRID1,
223 OPCODE_MAPGRID2,
224 OPCODE_MATRIX_MODE,
225 OPCODE_MULT_MATRIX,
226 OPCODE_ORTHO,
227 OPCODE_PASSTHROUGH,
228 OPCODE_PIXEL_MAP,
229 OPCODE_PIXEL_TRANSFER,
230 OPCODE_PIXEL_ZOOM,
231 OPCODE_POINT_SIZE,
232 OPCODE_POINT_PARAMETERS,
233 OPCODE_POLYGON_MODE,
234 OPCODE_POLYGON_STIPPLE,
235 OPCODE_POLYGON_OFFSET,
236 OPCODE_POP_ATTRIB,
237 OPCODE_POP_MATRIX,
238 OPCODE_POP_NAME,
239 OPCODE_PRIORITIZE_TEXTURE,
240 OPCODE_PUSH_ATTRIB,
241 OPCODE_PUSH_MATRIX,
242 OPCODE_PUSH_NAME,
243 OPCODE_RASTER_POS,
244 OPCODE_READ_BUFFER,
245 OPCODE_ROTATE,
246 OPCODE_SCALE,
247 OPCODE_SCISSOR,
248 OPCODE_SELECT_TEXTURE_SGIS,
249 OPCODE_SELECT_TEXTURE_COORD_SET,
250 OPCODE_SHADE_MODEL,
251 OPCODE_STENCIL_FUNC,
252 OPCODE_STENCIL_MASK,
253 OPCODE_STENCIL_OP,
254 OPCODE_TEXENV,
255 OPCODE_TEXGEN,
256 OPCODE_TEXPARAMETER,
257 OPCODE_TEX_IMAGE1D,
258 OPCODE_TEX_IMAGE2D,
259 OPCODE_TEX_IMAGE3D,
260 OPCODE_TEX_SUB_IMAGE1D,
261 OPCODE_TEX_SUB_IMAGE2D,
262 OPCODE_TEX_SUB_IMAGE3D,
263 OPCODE_TRANSLATE,
264 OPCODE_VIEWPORT,
265 OPCODE_WINDOW_POS,
266 /* ARB_viewport_array */
267 OPCODE_VIEWPORT_ARRAY_V,
268 OPCODE_VIEWPORT_INDEXED_F,
269 OPCODE_VIEWPORT_INDEXED_FV,
270 OPCODE_SCISSOR_ARRAY_V,
271 OPCODE_SCISSOR_INDEXED,
272 OPCODE_SCISSOR_INDEXED_V,
273 OPCODE_DEPTH_ARRAY_V,
274 OPCODE_DEPTH_INDEXED,
275 /* GL_ARB_multitexture */
276 OPCODE_ACTIVE_TEXTURE,
277 /* GL_ARB_texture_compression */
278 OPCODE_COMPRESSED_TEX_IMAGE_1D,
279 OPCODE_COMPRESSED_TEX_IMAGE_2D,
280 OPCODE_COMPRESSED_TEX_IMAGE_3D,
281 OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D,
282 OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D,
283 OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D,
284 /* GL_ARB_multisample */
285 OPCODE_SAMPLE_COVERAGE,
286 /* GL_ARB_window_pos */
287 OPCODE_WINDOW_POS_ARB,
288 /* GL_ARB_vertex_program */
289 OPCODE_BIND_PROGRAM_ARB,
290 OPCODE_PROGRAM_LOCAL_PARAMETER_ARB,
291 /* GL_EXT_stencil_two_side */
292 OPCODE_ACTIVE_STENCIL_FACE_EXT,
293 /* GL_EXT_depth_bounds_test */
294 OPCODE_DEPTH_BOUNDS_EXT,
295 /* GL_ARB_vertex/fragment_program */
296 OPCODE_PROGRAM_STRING_ARB,
297 OPCODE_PROGRAM_ENV_PARAMETER_ARB,
298 /* GL_ARB_occlusion_query */
299 OPCODE_BEGIN_QUERY_ARB,
300 OPCODE_END_QUERY_ARB,
301 /* GL_ARB_draw_buffers */
302 OPCODE_DRAW_BUFFERS_ARB,
303 /* GL_ATI_fragment_shader */
304 OPCODE_BIND_FRAGMENT_SHADER_ATI,
305 OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI,
306 /* OpenGL 2.0 */
307 OPCODE_STENCIL_FUNC_SEPARATE,
308 OPCODE_STENCIL_OP_SEPARATE,
309 OPCODE_STENCIL_MASK_SEPARATE,
310 /* GL_NV_primitive_restart */
311 OPCODE_PRIMITIVE_RESTART_NV,
312 /* GL_ARB_shader_objects */
313 OPCODE_USE_PROGRAM,
314 OPCODE_UNIFORM_1F,
315 OPCODE_UNIFORM_2F,
316 OPCODE_UNIFORM_3F,
317 OPCODE_UNIFORM_4F,
318 OPCODE_UNIFORM_1FV,
319 OPCODE_UNIFORM_2FV,
320 OPCODE_UNIFORM_3FV,
321 OPCODE_UNIFORM_4FV,
322 OPCODE_UNIFORM_1I,
323 OPCODE_UNIFORM_2I,
324 OPCODE_UNIFORM_3I,
325 OPCODE_UNIFORM_4I,
326 OPCODE_UNIFORM_1IV,
327 OPCODE_UNIFORM_2IV,
328 OPCODE_UNIFORM_3IV,
329 OPCODE_UNIFORM_4IV,
330 OPCODE_UNIFORM_MATRIX22,
331 OPCODE_UNIFORM_MATRIX33,
332 OPCODE_UNIFORM_MATRIX44,
333 OPCODE_UNIFORM_MATRIX23,
334 OPCODE_UNIFORM_MATRIX32,
335 OPCODE_UNIFORM_MATRIX24,
336 OPCODE_UNIFORM_MATRIX42,
337 OPCODE_UNIFORM_MATRIX34,
338 OPCODE_UNIFORM_MATRIX43,
339
340 /* OpenGL 3.0 */
341 OPCODE_UNIFORM_1UI,
342 OPCODE_UNIFORM_2UI,
343 OPCODE_UNIFORM_3UI,
344 OPCODE_UNIFORM_4UI,
345 OPCODE_UNIFORM_1UIV,
346 OPCODE_UNIFORM_2UIV,
347 OPCODE_UNIFORM_3UIV,
348 OPCODE_UNIFORM_4UIV,
349
350 /* GL_ARB_gpu_shader_fp64 */
351 OPCODE_UNIFORM_1D,
352 OPCODE_UNIFORM_2D,
353 OPCODE_UNIFORM_3D,
354 OPCODE_UNIFORM_4D,
355 OPCODE_UNIFORM_1DV,
356 OPCODE_UNIFORM_2DV,
357 OPCODE_UNIFORM_3DV,
358 OPCODE_UNIFORM_4DV,
359 OPCODE_UNIFORM_MATRIX22D,
360 OPCODE_UNIFORM_MATRIX33D,
361 OPCODE_UNIFORM_MATRIX44D,
362 OPCODE_UNIFORM_MATRIX23D,
363 OPCODE_UNIFORM_MATRIX32D,
364 OPCODE_UNIFORM_MATRIX24D,
365 OPCODE_UNIFORM_MATRIX42D,
366 OPCODE_UNIFORM_MATRIX34D,
367 OPCODE_UNIFORM_MATRIX43D,
368
369 /* GL_ARB_gpu_shader_int64 */
370 OPCODE_UNIFORM_1I64,
371 OPCODE_UNIFORM_2I64,
372 OPCODE_UNIFORM_3I64,
373 OPCODE_UNIFORM_4I64,
374 OPCODE_UNIFORM_1I64V,
375 OPCODE_UNIFORM_2I64V,
376 OPCODE_UNIFORM_3I64V,
377 OPCODE_UNIFORM_4I64V,
378 OPCODE_UNIFORM_1UI64,
379 OPCODE_UNIFORM_2UI64,
380 OPCODE_UNIFORM_3UI64,
381 OPCODE_UNIFORM_4UI64,
382 OPCODE_UNIFORM_1UI64V,
383 OPCODE_UNIFORM_2UI64V,
384 OPCODE_UNIFORM_3UI64V,
385 OPCODE_UNIFORM_4UI64V,
386 OPCODE_PROGRAM_UNIFORM_1I64,
387 OPCODE_PROGRAM_UNIFORM_2I64,
388 OPCODE_PROGRAM_UNIFORM_3I64,
389 OPCODE_PROGRAM_UNIFORM_4I64,
390 OPCODE_PROGRAM_UNIFORM_1I64V,
391 OPCODE_PROGRAM_UNIFORM_2I64V,
392 OPCODE_PROGRAM_UNIFORM_3I64V,
393 OPCODE_PROGRAM_UNIFORM_4I64V,
394 OPCODE_PROGRAM_UNIFORM_1UI64,
395 OPCODE_PROGRAM_UNIFORM_2UI64,
396 OPCODE_PROGRAM_UNIFORM_3UI64,
397 OPCODE_PROGRAM_UNIFORM_4UI64,
398 OPCODE_PROGRAM_UNIFORM_1UI64V,
399 OPCODE_PROGRAM_UNIFORM_2UI64V,
400 OPCODE_PROGRAM_UNIFORM_3UI64V,
401 OPCODE_PROGRAM_UNIFORM_4UI64V,
402
403 /* OpenGL 4.0 / GL_ARB_tessellation_shader */
404 OPCODE_PATCH_PARAMETER_I,
405 OPCODE_PATCH_PARAMETER_FV_INNER,
406 OPCODE_PATCH_PARAMETER_FV_OUTER,
407
408 /* OpenGL 4.2 / GL_ARB_separate_shader_objects */
409 OPCODE_USE_PROGRAM_STAGES,
410 OPCODE_PROGRAM_UNIFORM_1F,
411 OPCODE_PROGRAM_UNIFORM_2F,
412 OPCODE_PROGRAM_UNIFORM_3F,
413 OPCODE_PROGRAM_UNIFORM_4F,
414 OPCODE_PROGRAM_UNIFORM_1FV,
415 OPCODE_PROGRAM_UNIFORM_2FV,
416 OPCODE_PROGRAM_UNIFORM_3FV,
417 OPCODE_PROGRAM_UNIFORM_4FV,
418 OPCODE_PROGRAM_UNIFORM_1D,
419 OPCODE_PROGRAM_UNIFORM_2D,
420 OPCODE_PROGRAM_UNIFORM_3D,
421 OPCODE_PROGRAM_UNIFORM_4D,
422 OPCODE_PROGRAM_UNIFORM_1DV,
423 OPCODE_PROGRAM_UNIFORM_2DV,
424 OPCODE_PROGRAM_UNIFORM_3DV,
425 OPCODE_PROGRAM_UNIFORM_4DV,
426 OPCODE_PROGRAM_UNIFORM_1I,
427 OPCODE_PROGRAM_UNIFORM_2I,
428 OPCODE_PROGRAM_UNIFORM_3I,
429 OPCODE_PROGRAM_UNIFORM_4I,
430 OPCODE_PROGRAM_UNIFORM_1IV,
431 OPCODE_PROGRAM_UNIFORM_2IV,
432 OPCODE_PROGRAM_UNIFORM_3IV,
433 OPCODE_PROGRAM_UNIFORM_4IV,
434 OPCODE_PROGRAM_UNIFORM_1UI,
435 OPCODE_PROGRAM_UNIFORM_2UI,
436 OPCODE_PROGRAM_UNIFORM_3UI,
437 OPCODE_PROGRAM_UNIFORM_4UI,
438 OPCODE_PROGRAM_UNIFORM_1UIV,
439 OPCODE_PROGRAM_UNIFORM_2UIV,
440 OPCODE_PROGRAM_UNIFORM_3UIV,
441 OPCODE_PROGRAM_UNIFORM_4UIV,
442 OPCODE_PROGRAM_UNIFORM_MATRIX22F,
443 OPCODE_PROGRAM_UNIFORM_MATRIX33F,
444 OPCODE_PROGRAM_UNIFORM_MATRIX44F,
445 OPCODE_PROGRAM_UNIFORM_MATRIX23F,
446 OPCODE_PROGRAM_UNIFORM_MATRIX32F,
447 OPCODE_PROGRAM_UNIFORM_MATRIX24F,
448 OPCODE_PROGRAM_UNIFORM_MATRIX42F,
449 OPCODE_PROGRAM_UNIFORM_MATRIX34F,
450 OPCODE_PROGRAM_UNIFORM_MATRIX43F,
451 OPCODE_PROGRAM_UNIFORM_MATRIX22D,
452 OPCODE_PROGRAM_UNIFORM_MATRIX33D,
453 OPCODE_PROGRAM_UNIFORM_MATRIX44D,
454 OPCODE_PROGRAM_UNIFORM_MATRIX23D,
455 OPCODE_PROGRAM_UNIFORM_MATRIX32D,
456 OPCODE_PROGRAM_UNIFORM_MATRIX24D,
457 OPCODE_PROGRAM_UNIFORM_MATRIX42D,
458 OPCODE_PROGRAM_UNIFORM_MATRIX34D,
459 OPCODE_PROGRAM_UNIFORM_MATRIX43D,
460
461 /* GL_ARB_clip_control */
462 OPCODE_CLIP_CONTROL,
463
464 /* GL_ARB_color_buffer_float */
465 OPCODE_CLAMP_COLOR,
466
467 /* GL_EXT_framebuffer_blit */
468 OPCODE_BLIT_FRAMEBUFFER,
469
470 /* Vertex attributes -- fallback for when optimized display
471 * list build isn't active.
472 */
473 OPCODE_ATTR_1F_NV,
474 OPCODE_ATTR_2F_NV,
475 OPCODE_ATTR_3F_NV,
476 OPCODE_ATTR_4F_NV,
477 OPCODE_ATTR_1F_ARB,
478 OPCODE_ATTR_2F_ARB,
479 OPCODE_ATTR_3F_ARB,
480 OPCODE_ATTR_4F_ARB,
481 OPCODE_ATTR_1I,
482 OPCODE_ATTR_2I,
483 OPCODE_ATTR_3I,
484 OPCODE_ATTR_4I,
485 OPCODE_ATTR_1D,
486 OPCODE_ATTR_2D,
487 OPCODE_ATTR_3D,
488 OPCODE_ATTR_4D,
489 OPCODE_ATTR_1UI64,
490 OPCODE_MATERIAL,
491 OPCODE_BEGIN,
492 OPCODE_END,
493 OPCODE_EVAL_C1,
494 OPCODE_EVAL_C2,
495 OPCODE_EVAL_P1,
496 OPCODE_EVAL_P2,
497
498 /* GL_EXT_provoking_vertex */
499 OPCODE_PROVOKING_VERTEX,
500
501 /* GL_EXT_transform_feedback */
502 OPCODE_BEGIN_TRANSFORM_FEEDBACK,
503 OPCODE_END_TRANSFORM_FEEDBACK,
504 OPCODE_BIND_TRANSFORM_FEEDBACK,
505 OPCODE_PAUSE_TRANSFORM_FEEDBACK,
506 OPCODE_RESUME_TRANSFORM_FEEDBACK,
507 OPCODE_DRAW_TRANSFORM_FEEDBACK,
508
509 /* GL_EXT_texture_integer */
510 OPCODE_CLEARCOLOR_I,
511 OPCODE_CLEARCOLOR_UI,
512 OPCODE_TEXPARAMETER_I,
513 OPCODE_TEXPARAMETER_UI,
514
515 /* GL_ARB_instanced_arrays */
516 OPCODE_VERTEX_ATTRIB_DIVISOR,
517
518 /* GL_NV_texture_barrier */
519 OPCODE_TEXTURE_BARRIER_NV,
520
521 /* GL_ARB_sampler_object */
522 OPCODE_BIND_SAMPLER,
523 OPCODE_SAMPLER_PARAMETERIV,
524 OPCODE_SAMPLER_PARAMETERFV,
525 OPCODE_SAMPLER_PARAMETERIIV,
526 OPCODE_SAMPLER_PARAMETERUIV,
527
528 /* ARB_compute_shader */
529 OPCODE_DISPATCH_COMPUTE,
530
531 /* GL_ARB_sync */
532 OPCODE_WAIT_SYNC,
533
534 /* GL_NV_conditional_render */
535 OPCODE_BEGIN_CONDITIONAL_RENDER,
536 OPCODE_END_CONDITIONAL_RENDER,
537
538 /* ARB_timer_query */
539 OPCODE_QUERY_COUNTER,
540
541 /* ARB_transform_feedback3 */
542 OPCODE_BEGIN_QUERY_INDEXED,
543 OPCODE_END_QUERY_INDEXED,
544 OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM,
545
546 /* ARB_transform_feedback_instanced */
547 OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED,
548 OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED,
549
550 /* ARB_uniform_buffer_object */
551 OPCODE_UNIFORM_BLOCK_BINDING,
552
553 /* ARB_shader_subroutines */
554 OPCODE_UNIFORM_SUBROUTINES,
555
556 /* EXT_polygon_offset_clamp */
557 OPCODE_POLYGON_OFFSET_CLAMP,
558
559 /* EXT_window_rectangles */
560 OPCODE_WINDOW_RECTANGLES,
561
562 /* NV_conservative_raster */
563 OPCODE_SUBPIXEL_PRECISION_BIAS,
564
565 /* NV_conservative_raster_dilate */
566 OPCODE_CONSERVATIVE_RASTER_PARAMETER_F,
567
568 /* NV_conservative_raster_pre_snap_triangles */
569 OPCODE_CONSERVATIVE_RASTER_PARAMETER_I,
570
571 /* EXT_direct_state_access */
572 OPCODE_MATRIX_LOAD,
573 OPCODE_MATRIX_MULT,
574 OPCODE_MATRIX_ROTATE,
575 OPCODE_MATRIX_SCALE,
576 OPCODE_MATRIX_TRANSLATE,
577 OPCODE_MATRIX_LOAD_IDENTITY,
578 OPCODE_MATRIX_ORTHO,
579 OPCODE_MATRIX_FRUSTUM,
580 OPCODE_MATRIX_PUSH,
581 OPCODE_MATRIX_POP,
582 OPCODE_TEXTUREPARAMETER_F,
583 OPCODE_TEXTUREPARAMETER_I,
584 OPCODE_TEXTUREPARAMETER_II,
585 OPCODE_TEXTUREPARAMETER_IUI,
586 OPCODE_TEXTURE_IMAGE1D,
587 OPCODE_TEXTURE_IMAGE2D,
588 OPCODE_TEXTURE_IMAGE3D,
589 OPCODE_TEXTURE_SUB_IMAGE1D,
590 OPCODE_TEXTURE_SUB_IMAGE2D,
591 OPCODE_TEXTURE_SUB_IMAGE3D,
592 OPCODE_COPY_TEXTURE_IMAGE1D,
593 OPCODE_COPY_TEXTURE_IMAGE2D,
594 OPCODE_COPY_TEXTURE_SUB_IMAGE1D,
595 OPCODE_COPY_TEXTURE_SUB_IMAGE2D,
596 OPCODE_COPY_TEXTURE_SUB_IMAGE3D,
597 OPCODE_BIND_MULTITEXTURE,
598 OPCODE_MULTITEXPARAMETER_F,
599 OPCODE_MULTITEXPARAMETER_I,
600 OPCODE_MULTITEXPARAMETER_II,
601 OPCODE_MULTITEXPARAMETER_IUI,
602 OPCODE_MULTITEX_IMAGE1D,
603 OPCODE_MULTITEX_IMAGE2D,
604 OPCODE_MULTITEX_IMAGE3D,
605 OPCODE_MULTITEX_SUB_IMAGE1D,
606 OPCODE_MULTITEX_SUB_IMAGE2D,
607 OPCODE_MULTITEX_SUB_IMAGE3D,
608 OPCODE_COPY_MULTITEX_IMAGE1D,
609 OPCODE_COPY_MULTITEX_IMAGE2D,
610 OPCODE_COPY_MULTITEX_SUB_IMAGE1D,
611 OPCODE_COPY_MULTITEX_SUB_IMAGE2D,
612 OPCODE_COPY_MULTITEX_SUB_IMAGE3D,
613 OPCODE_MULTITEXENV,
614 OPCODE_COMPRESSED_TEXTURE_IMAGE_1D,
615 OPCODE_COMPRESSED_TEXTURE_IMAGE_2D,
616 OPCODE_COMPRESSED_TEXTURE_IMAGE_3D,
617 OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_1D,
618 OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_2D,
619 OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_3D,
620 OPCODE_COMPRESSED_MULTITEX_IMAGE_1D,
621 OPCODE_COMPRESSED_MULTITEX_IMAGE_2D,
622 OPCODE_COMPRESSED_MULTITEX_IMAGE_3D,
623 OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_1D,
624 OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_2D,
625 OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_3D,
626 OPCODE_NAMED_PROGRAM_STRING,
627 OPCODE_NAMED_PROGRAM_LOCAL_PARAMETER,
628
629 /* GL_ARB_ES3_2_compatibility */
630 OPCODE_PRIMITIVE_BOUNDING_BOX,
631
632 OPCODE_VERTEX_LIST,
633 OPCODE_VERTEX_LIST_LOOPBACK,
634 OPCODE_VERTEX_LIST_COPY_CURRENT,
635
636 /* The following three are meta instructions */
637 OPCODE_ERROR, /* raise compiled-in error */
638 OPCODE_CONTINUE,
639 OPCODE_NOP, /* No-op (used for 8-byte alignment */
640 OPCODE_END_OF_LIST
641 } OpCode;
642
643
644
645 /**
646 * Display list node.
647 *
648 * Display list instructions are stored as sequences of "nodes". Nodes
649 * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
650 * are linked together with a pointer.
651 *
652 * Each instruction in the display list is stored as a sequence of
653 * contiguous nodes in memory.
654 * Each node is the union of a variety of data types.
655 *
656 * Note, all of these members should be 4 bytes in size or less for the
657 * sake of compact display lists. We store 8-byte pointers in a pair of
658 * these nodes using the save/get_pointer() functions below.
659 */
660 union gl_dlist_node
661 {
662 struct {
663 #if !DETECT_OS_WINDOWS
664 OpCode opcode:16;
665 #else
666 /* sizeof(Node) is 8 with MSVC/mingw, so use an explicit 16 bits type. */
667 uint16_t opcode;
668 #endif
669 uint16_t InstSize;
670 };
671 GLboolean b;
672 GLbitfield bf;
673 GLubyte ub;
674 GLshort s;
675 GLushort us;
676 GLint i;
677 GLuint ui;
678 GLenum e;
679 GLfloat f;
680 GLsizei si;
681 };
682
683
684 typedef union gl_dlist_node Node;
685
686
687 /** How many 4-byte dwords to store a pointer */
688 #define POINTER_DWORDS (sizeof(void *) / 4)
689
690 /* We want to keep sizeof(union gl_dlist_node) == 4 to minimize
691 * space for display lists. The following types and functions are
692 * used to help store 4- and 8-byte pointers in 1 or 2 dlist_nodes.
693 */
694 union pointer
695 {
696 void *ptr;
697 GLuint dwords[POINTER_DWORDS];
698 };
699
700
701 /**
702 * Save a 4 or 8-byte pointer at dest (and dest+1).
703 */
704 static inline void
save_pointer(Node * dest,void * src)705 save_pointer(Node *dest, void *src)
706 {
707 union pointer p;
708 unsigned i;
709
710 STATIC_ASSERT(POINTER_DWORDS == 1 || POINTER_DWORDS == 2);
711 STATIC_ASSERT(sizeof(Node) == 4);
712
713 p.ptr = src;
714
715 for (i = 0; i < POINTER_DWORDS; i++)
716 dest[i].ui = p.dwords[i];
717 }
718
719
720 /**
721 * Retrieve a 4 or 8-byte pointer from node (node+1).
722 */
723 static inline void *
get_pointer(const Node * node)724 get_pointer(const Node *node)
725 {
726 union pointer p;
727 unsigned i;
728
729 for (i = 0; i < POINTER_DWORDS; i++)
730 p.dwords[i] = node[i].ui;
731
732 return p.ptr;
733 }
734
735
736 /**
737 * Used to store a 64-bit uint in a pair of "Nodes" for the sake of 32-bit
738 * environment.
739 */
740 union uint64_pair
741 {
742 GLuint64 uint64;
743 GLuint uint32[2];
744 };
745
746
747 union float64_pair
748 {
749 GLdouble d;
750 GLuint uint32[2];
751 };
752
753 union int64_pair
754 {
755 GLint64 int64;
756 GLint int32[2];
757 };
758
759 #define ASSIGN_DOUBLE_TO_NODES(n, idx, value) \
760 do { \
761 union float64_pair tmp; \
762 tmp.d = value; \
763 n[idx].ui = tmp.uint32[0]; \
764 n[idx+1].ui = tmp.uint32[1]; \
765 } while (0)
766
767 #define ASSIGN_UINT64_TO_NODES(n, idx, value) \
768 do { \
769 union uint64_pair tmp; \
770 tmp.uint64 = value; \
771 n[idx].ui = tmp.uint32[0]; \
772 n[idx+1].ui = tmp.uint32[1]; \
773 } while (0)
774
775 #define ASSIGN_INT64_TO_NODES(n, idx, value) \
776 do { \
777 union int64_pair tmp; \
778 tmp.int64 = value; \
779 n[idx].i = tmp.int32[0]; \
780 n[idx+1].i = tmp.int32[1]; \
781 } while (0)
782
783 /**
784 * How many nodes to allocate at a time. Note that bulk vertex data
785 * from glBegin/glVertex/glEnd primitives will typically wind up in
786 * a VBO, and not directly in the display list itself.
787 */
788 #define BLOCK_SIZE 256
789
790
791 void mesa_print_display_list(GLuint list);
792
793
794 /**
795 * Called by display list code when a display list is being deleted.
796 */
797 static void
vbo_destroy_vertex_list(struct gl_context * ctx,struct vbo_save_vertex_list * node)798 vbo_destroy_vertex_list(struct gl_context *ctx, struct vbo_save_vertex_list *node)
799 {
800 for (gl_vertex_processing_mode mode = VP_MODE_FF; mode < VP_MODE_MAX; ++mode) {
801 _mesa_reference_vao(ctx, &node->VAO[mode], NULL);
802 if (node->merged.gallium.private_refcount[mode]) {
803 assert(node->merged.gallium.private_refcount[mode] > 0);
804 p_atomic_add(&node->merged.gallium.state[mode]->reference.count,
805 -node->merged.gallium.private_refcount[mode]);
806 }
807 pipe_vertex_state_reference(&node->merged.gallium.state[mode], NULL);
808 }
809
810 if (node->merged.mode) {
811 free(node->merged.mode);
812 free(node->merged.start_counts);
813 }
814
815 _mesa_reference_buffer_object(ctx, &node->cold->ib.obj, NULL);
816 free(node->cold->current_data);
817 node->cold->current_data = NULL;
818
819 free(node->cold);
820 }
821
822 static void
vbo_print_vertex_list(struct gl_context * ctx,struct vbo_save_vertex_list * node,OpCode op,FILE * f)823 vbo_print_vertex_list(struct gl_context *ctx, struct vbo_save_vertex_list *node, OpCode op, FILE *f)
824 {
825 GLuint i;
826 struct gl_buffer_object *buffer = node->VAO[0]->BufferBinding[0].BufferObj;
827 const GLuint vertex_size = _vbo_save_get_stride(node)/sizeof(GLfloat);
828 (void) ctx;
829
830 const char *label[] = {
831 "VBO-VERTEX-LIST", "VBO-VERTEX-LIST-LOOPBACK", "VBO-VERTEX-LIST-COPY-CURRENT"
832 };
833
834 fprintf(f, "%s, %u vertices, %d primitives, %d vertsize, "
835 "buffer %p\n",
836 label[op - OPCODE_VERTEX_LIST],
837 node->cold->vertex_count, node->cold->prim_count, vertex_size,
838 buffer);
839
840 for (i = 0; i < node->cold->prim_count; i++) {
841 struct _mesa_prim *prim = &node->cold->prims[i];
842 fprintf(f, " prim %d: %s %d..%d %s %s\n",
843 i,
844 _mesa_lookup_prim_by_nr(prim->mode),
845 prim->start,
846 prim->start + prim->count,
847 (prim->begin) ? "BEGIN" : "(wrap)",
848 (prim->end) ? "END" : "(wrap)");
849 }
850 }
851
852
853 static inline
get_list_head(struct gl_context * ctx,struct gl_display_list * dlist)854 Node *get_list_head(struct gl_context *ctx, struct gl_display_list *dlist)
855 {
856 return dlist->small_list ?
857 &ctx->Shared->small_dlist_store.ptr[dlist->start] :
858 dlist->Head;
859 }
860
861
862 /**
863 * Does the given display list only contain a single glBitmap call?
864 */
865 static bool
is_bitmap_list(struct gl_context * ctx,struct gl_display_list * dlist)866 is_bitmap_list(struct gl_context *ctx, struct gl_display_list *dlist)
867 {
868 Node *n = get_list_head(ctx, dlist);
869 if (n[0].opcode == OPCODE_BITMAP) {
870 n += n[0].InstSize;
871 if (n[0].opcode == OPCODE_END_OF_LIST)
872 return true;
873 }
874 return false;
875 }
876
877
878 /**
879 * Is the given display list an empty list?
880 */
881 static bool
is_empty_list(struct gl_context * ctx,struct gl_display_list * dlist)882 is_empty_list(struct gl_context *ctx, struct gl_display_list *dlist)
883 {
884 Node *n = get_list_head(ctx, dlist);
885 return n[0].opcode == OPCODE_END_OF_LIST;
886 }
887
888
889 /**
890 * Delete/free a gl_bitmap_atlas. Called during context tear-down.
891 */
892 void
_mesa_delete_bitmap_atlas(struct gl_context * ctx,struct gl_bitmap_atlas * atlas)893 _mesa_delete_bitmap_atlas(struct gl_context *ctx, struct gl_bitmap_atlas *atlas)
894 {
895 if (atlas->texObj) {
896 ctx->Driver.DeleteTexture(ctx, atlas->texObj);
897 }
898 free(atlas->glyphs);
899 free(atlas);
900 }
901
902
903 /**
904 * Lookup a gl_bitmap_atlas by listBase ID.
905 */
906 static struct gl_bitmap_atlas *
lookup_bitmap_atlas(struct gl_context * ctx,GLuint listBase)907 lookup_bitmap_atlas(struct gl_context *ctx, GLuint listBase)
908 {
909 struct gl_bitmap_atlas *atlas;
910
911 assert(listBase > 0);
912 atlas = _mesa_HashLookup(ctx->Shared->BitmapAtlas, listBase);
913 return atlas;
914 }
915
916
917 /**
918 * Create new bitmap atlas and insert into hash table.
919 */
920 static struct gl_bitmap_atlas *
alloc_bitmap_atlas(struct gl_context * ctx,GLuint listBase,bool isGenName)921 alloc_bitmap_atlas(struct gl_context *ctx, GLuint listBase, bool isGenName)
922 {
923 struct gl_bitmap_atlas *atlas;
924
925 assert(listBase > 0);
926 assert(_mesa_HashLookup(ctx->Shared->BitmapAtlas, listBase) == NULL);
927
928 atlas = calloc(1, sizeof(*atlas));
929 if (atlas) {
930 _mesa_HashInsert(ctx->Shared->BitmapAtlas, listBase, atlas, isGenName);
931 atlas->Id = listBase;
932 }
933
934 return atlas;
935 }
936
937
938 /**
939 * Try to build a bitmap atlas. This involves examining a sequence of
940 * display lists which contain glBitmap commands and putting the bitmap
941 * images into a texture map (the atlas).
942 * If we succeed, gl_bitmap_atlas::complete will be set to true.
943 * If we fail, gl_bitmap_atlas::incomplete will be set to true.
944 */
945 static void
build_bitmap_atlas(struct gl_context * ctx,struct gl_bitmap_atlas * atlas,GLuint listBase)946 build_bitmap_atlas(struct gl_context *ctx, struct gl_bitmap_atlas *atlas,
947 GLuint listBase)
948 {
949 unsigned i, row_height = 0, xpos = 0, ypos = 0;
950 GLubyte *map;
951 GLint map_stride;
952
953 assert(atlas);
954 assert(!atlas->complete);
955 assert(atlas->numBitmaps > 0);
956
957 /* We use a rectangle texture (non-normalized coords) for the atlas */
958 assert(ctx->Extensions.NV_texture_rectangle);
959 assert(ctx->Const.MaxTextureRectSize >= 1024);
960
961 atlas->texWidth = 1024;
962 atlas->texHeight = 0; /* determined below */
963
964 atlas->glyphs = malloc(atlas->numBitmaps * sizeof(atlas->glyphs[0]));
965 if (!atlas->glyphs) {
966 /* give up */
967 atlas->incomplete = true;
968 return;
969 }
970
971 /* Loop over the display lists. They should all contain a single glBitmap
972 * call. If not, bail out. Also, compute the position and sizes of each
973 * bitmap in the atlas to determine the texture atlas size.
974 */
975 for (i = 0; i < atlas->numBitmaps; i++) {
976 struct gl_display_list *list = _mesa_lookup_list(ctx, listBase + i, true);
977 const Node *n;
978 struct gl_bitmap_glyph *g = &atlas->glyphs[i];
979 unsigned bitmap_width, bitmap_height;
980 float bitmap_xmove, bitmap_ymove, bitmap_xorig, bitmap_yorig;
981
982 if (!list || is_empty_list(ctx, list)) {
983 /* stop here */
984 atlas->numBitmaps = i;
985 break;
986 }
987
988 if (!is_bitmap_list(ctx, list)) {
989 /* This list does not contain exactly one glBitmap command. Give up. */
990 atlas->incomplete = true;
991 return;
992 }
993
994 /* get bitmap info from the display list command */
995 n = get_list_head(ctx, list);
996 assert(n[0].opcode == OPCODE_BITMAP);
997 bitmap_width = n[1].i;
998 bitmap_height = n[2].i;
999 bitmap_xorig = n[3].f;
1000 bitmap_yorig = n[4].f;
1001 bitmap_xmove = n[5].f;
1002 bitmap_ymove = n[6].f;
1003
1004 if (xpos + bitmap_width > atlas->texWidth) {
1005 /* advance to the next row of the texture */
1006 xpos = 0;
1007 ypos += row_height;
1008 row_height = 0;
1009 }
1010
1011 /* save the bitmap's position in the atlas */
1012 g->x = xpos;
1013 g->y = ypos;
1014 g->w = bitmap_width;
1015 g->h = bitmap_height;
1016 g->xorig = bitmap_xorig;
1017 g->yorig = bitmap_yorig;
1018 g->xmove = bitmap_xmove;
1019 g->ymove = bitmap_ymove;
1020
1021 xpos += bitmap_width;
1022
1023 /* keep track of tallest bitmap in the row */
1024 row_height = MAX2(row_height, bitmap_height);
1025 }
1026
1027 /* Now we know the texture height */
1028 atlas->texHeight = ypos + row_height;
1029
1030 if (atlas->texHeight == 0) {
1031 /* no glyphs found, give up */
1032 goto fail;
1033 }
1034 else if (atlas->texHeight > ctx->Const.MaxTextureRectSize) {
1035 /* too large, give up */
1036 goto fail;
1037 }
1038
1039 /* Create atlas texture (texture ID is irrelevant) */
1040 atlas->texObj = ctx->Driver.NewTextureObject(ctx, 999, GL_TEXTURE_RECTANGLE);
1041 if (!atlas->texObj) {
1042 goto out_of_memory;
1043 }
1044
1045 atlas->texObj->Sampler.Attrib.MinFilter = GL_NEAREST;
1046 atlas->texObj->Sampler.Attrib.MagFilter = GL_NEAREST;
1047 atlas->texObj->Sampler.Attrib.state.min_img_filter = PIPE_TEX_FILTER_NEAREST;
1048 atlas->texObj->Sampler.Attrib.state.min_mip_filter = PIPE_TEX_MIPFILTER_NONE;
1049 atlas->texObj->Sampler.Attrib.state.mag_img_filter = PIPE_TEX_FILTER_NEAREST;
1050 atlas->texObj->Attrib.MaxLevel = 0;
1051 atlas->texObj->Immutable = GL_TRUE;
1052
1053 atlas->texImage = _mesa_get_tex_image(ctx, atlas->texObj,
1054 GL_TEXTURE_RECTANGLE, 0);
1055 if (!atlas->texImage) {
1056 goto out_of_memory;
1057 }
1058
1059 if (ctx->Const.BitmapUsesRed)
1060 _mesa_init_teximage_fields(ctx, atlas->texImage,
1061 atlas->texWidth, atlas->texHeight, 1, 0,
1062 GL_RED, MESA_FORMAT_R_UNORM8);
1063 else
1064 _mesa_init_teximage_fields(ctx, atlas->texImage,
1065 atlas->texWidth, atlas->texHeight, 1, 0,
1066 GL_ALPHA, MESA_FORMAT_A_UNORM8);
1067
1068 /* alloc image storage */
1069 if (!ctx->Driver.AllocTextureImageBuffer(ctx, atlas->texImage)) {
1070 goto out_of_memory;
1071 }
1072
1073 /* map teximage, load with bitmap glyphs */
1074 ctx->Driver.MapTextureImage(ctx, atlas->texImage, 0,
1075 0, 0, atlas->texWidth, atlas->texHeight,
1076 GL_MAP_WRITE_BIT, &map, &map_stride);
1077 if (!map) {
1078 goto out_of_memory;
1079 }
1080
1081 /* Background/clear pixels are 0xff, foreground/set pixels are 0x0 */
1082 memset(map, 0xff, map_stride * atlas->texHeight);
1083
1084 for (i = 0; i < atlas->numBitmaps; i++) {
1085 struct gl_display_list *list = _mesa_lookup_list(ctx, listBase + i, true);
1086 const Node *n = get_list_head(ctx, list);
1087
1088 assert(n[0].opcode == OPCODE_BITMAP ||
1089 n[0].opcode == OPCODE_END_OF_LIST);
1090
1091 if (n[0].opcode == OPCODE_BITMAP) {
1092 unsigned bitmap_width = n[1].i;
1093 unsigned bitmap_height = n[2].i;
1094 unsigned xpos = atlas->glyphs[i].x;
1095 unsigned ypos = atlas->glyphs[i].y;
1096 const void *bitmap_image = get_pointer(&n[7]);
1097
1098 assert(atlas->glyphs[i].w == bitmap_width);
1099 assert(atlas->glyphs[i].h == bitmap_height);
1100
1101 /* put the bitmap image into the texture image */
1102 _mesa_expand_bitmap(bitmap_width, bitmap_height,
1103 &ctx->DefaultPacking, bitmap_image,
1104 map + map_stride * ypos + xpos, /* dest addr */
1105 map_stride, 0x0);
1106 }
1107 }
1108
1109 ctx->Driver.UnmapTextureImage(ctx, atlas->texImage, 0);
1110
1111 atlas->complete = true;
1112
1113 return;
1114
1115 out_of_memory:
1116 _mesa_error(ctx, GL_OUT_OF_MEMORY, "Display list bitmap atlas");
1117 fail:
1118 if (atlas->texObj) {
1119 ctx->Driver.DeleteTexture(ctx, atlas->texObj);
1120 }
1121 free(atlas->glyphs);
1122 atlas->glyphs = NULL;
1123 atlas->incomplete = true;
1124 }
1125
1126
1127 /**
1128 * Allocate a gl_display_list object with an initial block of storage.
1129 * \param count how many display list nodes/tokens to allocate
1130 */
1131 static struct gl_display_list *
make_list(GLuint name,GLuint count)1132 make_list(GLuint name, GLuint count)
1133 {
1134 struct gl_display_list *dlist = CALLOC_STRUCT(gl_display_list);
1135 dlist->Name = name;
1136 dlist->Head = malloc(sizeof(Node) * count);
1137 dlist->Head[0].opcode = OPCODE_END_OF_LIST;
1138 return dlist;
1139 }
1140
1141
1142 /**
1143 * Lookup function to just encapsulate casting.
1144 */
1145 struct gl_display_list *
_mesa_lookup_list(struct gl_context * ctx,GLuint list,bool locked)1146 _mesa_lookup_list(struct gl_context *ctx, GLuint list, bool locked)
1147 {
1148 return (struct gl_display_list *)
1149 _mesa_HashLookupMaybeLocked(ctx->Shared->DisplayList, list, locked);
1150 }
1151
1152
1153 /**
1154 * Delete the named display list, but don't remove from hash table.
1155 * \param dlist - display list pointer
1156 */
1157 void
_mesa_delete_list(struct gl_context * ctx,struct gl_display_list * dlist)1158 _mesa_delete_list(struct gl_context *ctx, struct gl_display_list *dlist)
1159 {
1160 Node *n, *block;
1161
1162 n = block = get_list_head(ctx, dlist);
1163
1164 if (!n) {
1165 free(dlist->Label);
1166 free(dlist);
1167 return;
1168 }
1169
1170 while (1) {
1171 const OpCode opcode = n[0].opcode;
1172
1173 switch (opcode) {
1174 /* for some commands, we need to free malloc'd memory */
1175 case OPCODE_MAP1:
1176 free(get_pointer(&n[6]));
1177 break;
1178 case OPCODE_MAP2:
1179 free(get_pointer(&n[10]));
1180 break;
1181 case OPCODE_CALL_LISTS:
1182 free(get_pointer(&n[3]));
1183 break;
1184 case OPCODE_DRAW_PIXELS:
1185 free(get_pointer(&n[5]));
1186 break;
1187 case OPCODE_BITMAP:
1188 free(get_pointer(&n[7]));
1189 break;
1190 case OPCODE_POLYGON_STIPPLE:
1191 free(get_pointer(&n[1]));
1192 break;
1193 case OPCODE_TEX_IMAGE1D:
1194 free(get_pointer(&n[8]));
1195 break;
1196 case OPCODE_TEX_IMAGE2D:
1197 free(get_pointer(&n[9]));
1198 break;
1199 case OPCODE_TEX_IMAGE3D:
1200 free(get_pointer(&n[10]));
1201 break;
1202 case OPCODE_TEX_SUB_IMAGE1D:
1203 free(get_pointer(&n[7]));
1204 break;
1205 case OPCODE_TEX_SUB_IMAGE2D:
1206 free(get_pointer(&n[9]));
1207 break;
1208 case OPCODE_TEX_SUB_IMAGE3D:
1209 free(get_pointer(&n[11]));
1210 break;
1211 case OPCODE_COMPRESSED_TEX_IMAGE_1D:
1212 free(get_pointer(&n[7]));
1213 break;
1214 case OPCODE_COMPRESSED_TEX_IMAGE_2D:
1215 free(get_pointer(&n[8]));
1216 break;
1217 case OPCODE_COMPRESSED_TEX_IMAGE_3D:
1218 free(get_pointer(&n[9]));
1219 break;
1220 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D:
1221 free(get_pointer(&n[7]));
1222 break;
1223 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D:
1224 free(get_pointer(&n[9]));
1225 break;
1226 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D:
1227 free(get_pointer(&n[11]));
1228 break;
1229 case OPCODE_PROGRAM_STRING_ARB:
1230 free(get_pointer(&n[4])); /* program string */
1231 break;
1232 case OPCODE_UNIFORM_1FV:
1233 case OPCODE_UNIFORM_2FV:
1234 case OPCODE_UNIFORM_3FV:
1235 case OPCODE_UNIFORM_4FV:
1236 case OPCODE_UNIFORM_1DV:
1237 case OPCODE_UNIFORM_2DV:
1238 case OPCODE_UNIFORM_3DV:
1239 case OPCODE_UNIFORM_4DV:
1240 case OPCODE_UNIFORM_1IV:
1241 case OPCODE_UNIFORM_2IV:
1242 case OPCODE_UNIFORM_3IV:
1243 case OPCODE_UNIFORM_4IV:
1244 case OPCODE_UNIFORM_1UIV:
1245 case OPCODE_UNIFORM_2UIV:
1246 case OPCODE_UNIFORM_3UIV:
1247 case OPCODE_UNIFORM_4UIV:
1248 case OPCODE_UNIFORM_1I64V:
1249 case OPCODE_UNIFORM_2I64V:
1250 case OPCODE_UNIFORM_3I64V:
1251 case OPCODE_UNIFORM_4I64V:
1252 case OPCODE_UNIFORM_1UI64V:
1253 case OPCODE_UNIFORM_2UI64V:
1254 case OPCODE_UNIFORM_3UI64V:
1255 case OPCODE_UNIFORM_4UI64V:
1256 free(get_pointer(&n[3]));
1257 break;
1258 case OPCODE_UNIFORM_MATRIX22:
1259 case OPCODE_UNIFORM_MATRIX33:
1260 case OPCODE_UNIFORM_MATRIX44:
1261 case OPCODE_UNIFORM_MATRIX24:
1262 case OPCODE_UNIFORM_MATRIX42:
1263 case OPCODE_UNIFORM_MATRIX23:
1264 case OPCODE_UNIFORM_MATRIX32:
1265 case OPCODE_UNIFORM_MATRIX34:
1266 case OPCODE_UNIFORM_MATRIX43:
1267 case OPCODE_UNIFORM_MATRIX22D:
1268 case OPCODE_UNIFORM_MATRIX33D:
1269 case OPCODE_UNIFORM_MATRIX44D:
1270 case OPCODE_UNIFORM_MATRIX24D:
1271 case OPCODE_UNIFORM_MATRIX42D:
1272 case OPCODE_UNIFORM_MATRIX23D:
1273 case OPCODE_UNIFORM_MATRIX32D:
1274 case OPCODE_UNIFORM_MATRIX34D:
1275 case OPCODE_UNIFORM_MATRIX43D:
1276 free(get_pointer(&n[4]));
1277 break;
1278 case OPCODE_PROGRAM_UNIFORM_1FV:
1279 case OPCODE_PROGRAM_UNIFORM_2FV:
1280 case OPCODE_PROGRAM_UNIFORM_3FV:
1281 case OPCODE_PROGRAM_UNIFORM_4FV:
1282 case OPCODE_PROGRAM_UNIFORM_1DV:
1283 case OPCODE_PROGRAM_UNIFORM_2DV:
1284 case OPCODE_PROGRAM_UNIFORM_3DV:
1285 case OPCODE_PROGRAM_UNIFORM_4DV:
1286 case OPCODE_PROGRAM_UNIFORM_1IV:
1287 case OPCODE_PROGRAM_UNIFORM_2IV:
1288 case OPCODE_PROGRAM_UNIFORM_3IV:
1289 case OPCODE_PROGRAM_UNIFORM_4IV:
1290 case OPCODE_PROGRAM_UNIFORM_1UIV:
1291 case OPCODE_PROGRAM_UNIFORM_2UIV:
1292 case OPCODE_PROGRAM_UNIFORM_3UIV:
1293 case OPCODE_PROGRAM_UNIFORM_4UIV:
1294 case OPCODE_PROGRAM_UNIFORM_1I64V:
1295 case OPCODE_PROGRAM_UNIFORM_2I64V:
1296 case OPCODE_PROGRAM_UNIFORM_3I64V:
1297 case OPCODE_PROGRAM_UNIFORM_4I64V:
1298 case OPCODE_PROGRAM_UNIFORM_1UI64V:
1299 case OPCODE_PROGRAM_UNIFORM_2UI64V:
1300 case OPCODE_PROGRAM_UNIFORM_3UI64V:
1301 case OPCODE_PROGRAM_UNIFORM_4UI64V:
1302 free(get_pointer(&n[4]));
1303 break;
1304 case OPCODE_PROGRAM_UNIFORM_MATRIX22F:
1305 case OPCODE_PROGRAM_UNIFORM_MATRIX33F:
1306 case OPCODE_PROGRAM_UNIFORM_MATRIX44F:
1307 case OPCODE_PROGRAM_UNIFORM_MATRIX24F:
1308 case OPCODE_PROGRAM_UNIFORM_MATRIX42F:
1309 case OPCODE_PROGRAM_UNIFORM_MATRIX23F:
1310 case OPCODE_PROGRAM_UNIFORM_MATRIX32F:
1311 case OPCODE_PROGRAM_UNIFORM_MATRIX34F:
1312 case OPCODE_PROGRAM_UNIFORM_MATRIX43F:
1313 case OPCODE_PROGRAM_UNIFORM_MATRIX22D:
1314 case OPCODE_PROGRAM_UNIFORM_MATRIX33D:
1315 case OPCODE_PROGRAM_UNIFORM_MATRIX44D:
1316 case OPCODE_PROGRAM_UNIFORM_MATRIX24D:
1317 case OPCODE_PROGRAM_UNIFORM_MATRIX42D:
1318 case OPCODE_PROGRAM_UNIFORM_MATRIX23D:
1319 case OPCODE_PROGRAM_UNIFORM_MATRIX32D:
1320 case OPCODE_PROGRAM_UNIFORM_MATRIX34D:
1321 case OPCODE_PROGRAM_UNIFORM_MATRIX43D:
1322 free(get_pointer(&n[5]));
1323 break;
1324 case OPCODE_PIXEL_MAP:
1325 free(get_pointer(&n[3]));
1326 break;
1327 case OPCODE_VIEWPORT_ARRAY_V:
1328 case OPCODE_SCISSOR_ARRAY_V:
1329 case OPCODE_DEPTH_ARRAY_V:
1330 case OPCODE_UNIFORM_SUBROUTINES:
1331 case OPCODE_WINDOW_RECTANGLES:
1332 free(get_pointer(&n[3]));
1333 break;
1334 case OPCODE_TEXTURE_IMAGE1D:
1335 case OPCODE_MULTITEX_IMAGE1D:
1336 free(get_pointer(&n[9]));
1337 break;
1338 case OPCODE_TEXTURE_IMAGE2D:
1339 case OPCODE_MULTITEX_IMAGE2D:
1340 free(get_pointer(&n[10]));
1341 break;
1342 case OPCODE_TEXTURE_IMAGE3D:
1343 case OPCODE_MULTITEX_IMAGE3D:
1344 free(get_pointer(&n[11]));
1345 break;
1346 case OPCODE_TEXTURE_SUB_IMAGE1D:
1347 case OPCODE_MULTITEX_SUB_IMAGE1D:
1348 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_1D:
1349 case OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_1D:
1350 free(get_pointer(&n[8]));
1351 break;
1352 case OPCODE_TEXTURE_SUB_IMAGE2D:
1353 case OPCODE_MULTITEX_SUB_IMAGE2D:
1354 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_2D:
1355 case OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_2D:
1356 free(get_pointer(&n[10]));
1357 break;
1358 case OPCODE_TEXTURE_SUB_IMAGE3D:
1359 case OPCODE_MULTITEX_SUB_IMAGE3D:
1360 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_3D:
1361 case OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_3D:
1362 free(get_pointer(&n[12]));
1363 break;
1364 case OPCODE_COMPRESSED_TEXTURE_IMAGE_1D:
1365 case OPCODE_COMPRESSED_MULTITEX_IMAGE_1D:
1366 free(get_pointer(&n[8]));
1367 break;
1368 case OPCODE_COMPRESSED_TEXTURE_IMAGE_2D:
1369 case OPCODE_COMPRESSED_MULTITEX_IMAGE_2D:
1370 free(get_pointer(&n[9]));
1371 break;
1372 case OPCODE_COMPRESSED_TEXTURE_IMAGE_3D:
1373 case OPCODE_COMPRESSED_MULTITEX_IMAGE_3D:
1374 free(get_pointer(&n[10]));
1375 break;
1376 case OPCODE_NAMED_PROGRAM_STRING:
1377 free(get_pointer(&n[5]));
1378 break;
1379 case OPCODE_VERTEX_LIST:
1380 case OPCODE_VERTEX_LIST_LOOPBACK:
1381 case OPCODE_VERTEX_LIST_COPY_CURRENT:
1382 vbo_destroy_vertex_list(ctx, (struct vbo_save_vertex_list *) &n[1]);
1383 break;
1384 case OPCODE_CONTINUE:
1385 n = (Node *) get_pointer(&n[1]);
1386 assert (!dlist->small_list);
1387 free(block);
1388 block = n;
1389 continue;
1390 case OPCODE_END_OF_LIST:
1391 if (dlist->small_list) {
1392 unsigned start = dlist->begins_with_a_nop ? dlist->start - 1 :
1393 dlist->start;
1394 for (int i = 0; i < dlist->count; i++) {
1395 util_idalloc_free(&ctx->Shared->small_dlist_store.free_idx,
1396 start + i);
1397 }
1398 } else {
1399 free(block);
1400 }
1401 free(dlist->Label);
1402 free(dlist);
1403 return;
1404 default:
1405 /* just increment 'n' pointer, below */
1406 ;
1407 }
1408
1409 assert(n[0].InstSize > 0);
1410 n += n[0].InstSize;
1411 }
1412 }
1413
1414
1415 /**
1416 * Called by _mesa_HashWalk() to check if a display list which is being
1417 * deleted belongs to a bitmap texture atlas.
1418 */
1419 static void
check_atlas_for_deleted_list(void * data,void * userData)1420 check_atlas_for_deleted_list(void *data, void *userData)
1421 {
1422 struct gl_bitmap_atlas *atlas = (struct gl_bitmap_atlas *) data;
1423 GLuint list_id = *((GLuint *) userData); /* the list being deleted */
1424 const GLuint atlas_id = atlas->Id;
1425
1426 /* See if the list_id falls in the range contained in this texture atlas */
1427 if (atlas->complete &&
1428 list_id >= atlas_id &&
1429 list_id < atlas_id + atlas->numBitmaps) {
1430 /* Mark the atlas as incomplete so it doesn't get used. But don't
1431 * delete it yet since we don't want to try to recreate it in the next
1432 * glCallLists.
1433 */
1434 atlas->complete = false;
1435 atlas->incomplete = true;
1436 }
1437 }
1438
1439
1440 /**
1441 * Destroy a display list and remove from hash table.
1442 * \param list - display list number
1443 */
1444 static void
destroy_list(struct gl_context * ctx,GLuint list)1445 destroy_list(struct gl_context *ctx, GLuint list)
1446 {
1447 struct gl_display_list *dlist;
1448
1449 if (list == 0)
1450 return;
1451
1452 dlist = _mesa_lookup_list(ctx, list, false);
1453 if (!dlist)
1454 return;
1455
1456 if (is_bitmap_list(ctx, dlist)) {
1457 /* If we're destroying a simple glBitmap display list, there's a
1458 * chance that we're destroying a bitmap image that's in a texture
1459 * atlas. Examine all atlases to see if that's the case. There's
1460 * usually few (if any) atlases so this isn't expensive.
1461 */
1462 _mesa_HashWalk(ctx->Shared->BitmapAtlas,
1463 check_atlas_for_deleted_list, &list);
1464 }
1465
1466 _mesa_HashLockMutex(ctx->Shared->DisplayList);
1467 _mesa_delete_list(ctx, dlist);
1468 _mesa_HashRemoveLocked(ctx->Shared->DisplayList, list);
1469 _mesa_HashUnlockMutex(ctx->Shared->DisplayList);
1470 }
1471
1472
1473 /**
1474 * Wrapper for _mesa_unpack_image/bitmap() that handles pixel buffer objects.
1475 * If width < 0 or height < 0 or format or type are invalid we'll just
1476 * return NULL. We will not generate an error since OpenGL command
1477 * arguments aren't error-checked until the command is actually executed
1478 * (not when they're compiled).
1479 * But if we run out of memory, GL_OUT_OF_MEMORY will be recorded.
1480 */
1481 static GLvoid *
unpack_image(struct gl_context * ctx,GLuint dimensions,GLsizei width,GLsizei height,GLsizei depth,GLenum format,GLenum type,const GLvoid * pixels,const struct gl_pixelstore_attrib * unpack)1482 unpack_image(struct gl_context *ctx, GLuint dimensions,
1483 GLsizei width, GLsizei height, GLsizei depth,
1484 GLenum format, GLenum type, const GLvoid * pixels,
1485 const struct gl_pixelstore_attrib *unpack)
1486 {
1487 if (width <= 0 || height <= 0) {
1488 return NULL;
1489 }
1490
1491 if (_mesa_bytes_per_pixel(format, type) < 0) {
1492 /* bad format and/or type */
1493 return NULL;
1494 }
1495
1496 if (!unpack->BufferObj) {
1497 /* no PBO */
1498 GLvoid *image;
1499
1500 image = _mesa_unpack_image(dimensions, width, height, depth,
1501 format, type, pixels, unpack);
1502 if (pixels && !image) {
1503 _mesa_error(ctx, GL_OUT_OF_MEMORY, "display list construction");
1504 }
1505 return image;
1506 }
1507 else if (_mesa_validate_pbo_access(dimensions, unpack, width, height,
1508 depth, format, type, INT_MAX, pixels)) {
1509 const GLubyte *map, *src;
1510 GLvoid *image;
1511
1512 map = (GLubyte *)
1513 ctx->Driver.MapBufferRange(ctx, 0, unpack->BufferObj->Size,
1514 GL_MAP_READ_BIT, unpack->BufferObj,
1515 MAP_INTERNAL);
1516 if (!map) {
1517 /* unable to map src buffer! */
1518 _mesa_error(ctx, GL_INVALID_OPERATION, "unable to map PBO");
1519 return NULL;
1520 }
1521
1522 src = ADD_POINTERS(map, pixels);
1523 image = _mesa_unpack_image(dimensions, width, height, depth,
1524 format, type, src, unpack);
1525
1526 ctx->Driver.UnmapBuffer(ctx, unpack->BufferObj, MAP_INTERNAL);
1527
1528 if (!image) {
1529 _mesa_error(ctx, GL_OUT_OF_MEMORY, "display list construction");
1530 }
1531 return image;
1532 }
1533
1534 /* bad access! */
1535 _mesa_error(ctx, GL_INVALID_OPERATION, "invalid PBO access");
1536 return NULL;
1537 }
1538
1539
1540 /** Return copy of memory */
1541 static void *
memdup(const void * src,GLsizei bytes)1542 memdup(const void *src, GLsizei bytes)
1543 {
1544 void *b = bytes >= 0 ? malloc(bytes) : NULL;
1545 if (b)
1546 memcpy(b, src, bytes);
1547 return b;
1548 }
1549
1550
1551 /**
1552 * Allocate space for a display list instruction (opcode + payload space).
1553 * \param opcode the instruction opcode (OPCODE_* value)
1554 * \param bytes instruction payload size (not counting opcode)
1555 * \param align8 does the payload need to be 8-byte aligned?
1556 * This is only relevant in 64-bit environments.
1557 * \return pointer to allocated memory (the payload will be at pointer+1)
1558 */
1559 static Node *
dlist_alloc(struct gl_context * ctx,OpCode opcode,GLuint bytes,bool align8)1560 dlist_alloc(struct gl_context *ctx, OpCode opcode, GLuint bytes, bool align8)
1561 {
1562 const GLuint numNodes = 1 + (bytes + sizeof(Node) - 1) / sizeof(Node);
1563 const GLuint contNodes = 1 + POINTER_DWORDS; /* size of continue info */
1564 GLuint nopNode;
1565 Node *n;
1566
1567 assert(bytes <= BLOCK_SIZE * sizeof(Node));
1568
1569 if (sizeof(void *) > sizeof(Node) && align8
1570 && ctx->ListState.CurrentPos % 2 == 0) {
1571 /* The opcode would get placed at node[0] and the payload would start
1572 * at node[1]. But the payload needs to be at an even offset (8-byte
1573 * multiple).
1574 */
1575 nopNode = 1;
1576 }
1577 else {
1578 nopNode = 0;
1579 }
1580
1581 if (ctx->ListState.CurrentPos + nopNode + numNodes + contNodes
1582 > BLOCK_SIZE) {
1583 /* This block is full. Allocate a new block and chain to it */
1584 Node *newblock;
1585 n = ctx->ListState.CurrentBlock + ctx->ListState.CurrentPos;
1586 n[0].opcode = OPCODE_CONTINUE;
1587 newblock = malloc(sizeof(Node) * BLOCK_SIZE);
1588 if (!newblock) {
1589 _mesa_error(ctx, GL_OUT_OF_MEMORY, "Building display list");
1590 return NULL;
1591 }
1592
1593 /* a fresh block should be 8-byte aligned on 64-bit systems */
1594 assert(((GLintptr) newblock) % sizeof(void *) == 0);
1595
1596 save_pointer(&n[1], newblock);
1597 ctx->ListState.CurrentBlock = newblock;
1598 ctx->ListState.CurrentPos = 0;
1599
1600 /* Display list nodes are always 4 bytes. If we need 8-byte alignment
1601 * we have to insert a NOP so that the payload of the real opcode lands
1602 * on an even location:
1603 * node[0] = OPCODE_NOP
1604 * node[1] = OPCODE_x;
1605 * node[2] = start of payload
1606 */
1607 nopNode = sizeof(void *) > sizeof(Node) && align8;
1608 }
1609
1610 n = ctx->ListState.CurrentBlock + ctx->ListState.CurrentPos;
1611 if (nopNode) {
1612 assert(ctx->ListState.CurrentPos % 2 == 0); /* even value */
1613 n[0].opcode = OPCODE_NOP;
1614 n[0].InstSize = 1;
1615 n++;
1616 /* The "real" opcode will now be at an odd location and the payload
1617 * will be at an even location.
1618 */
1619 }
1620 ctx->ListState.CurrentPos += nopNode + numNodes;
1621
1622 n[0].opcode = opcode;
1623 n[0].InstSize = numNodes;
1624
1625 return n;
1626 }
1627
1628
1629 void *
_mesa_dlist_alloc_vertex_list(struct gl_context * ctx,bool copy_to_current)1630 _mesa_dlist_alloc_vertex_list(struct gl_context *ctx, bool copy_to_current)
1631 {
1632 Node *n = dlist_alloc(ctx,
1633 copy_to_current ? OPCODE_VERTEX_LIST_COPY_CURRENT :
1634 OPCODE_VERTEX_LIST,
1635 sizeof(struct vbo_save_vertex_list),
1636 true);
1637 if (n)
1638 return n + 1; /* return pointer to payload area, after opcode */
1639 else
1640 return NULL;
1641 }
1642
1643
1644 /**
1645 * Allocate space for a display list instruction. The space is basically
1646 * an array of Nodes where node[0] holds the opcode, node[1] is the first
1647 * function parameter, node[2] is the second parameter, etc.
1648 *
1649 * \param opcode one of OPCODE_x
1650 * \param nparams number of function parameters
1651 * \return pointer to start of instruction space
1652 */
1653 static inline Node *
alloc_instruction(struct gl_context * ctx,OpCode opcode,GLuint nparams)1654 alloc_instruction(struct gl_context *ctx, OpCode opcode, GLuint nparams)
1655 {
1656 return dlist_alloc(ctx, opcode, nparams * sizeof(Node), false);
1657 }
1658
1659
1660 /*
1661 * Display List compilation functions
1662 */
1663 static void GLAPIENTRY
save_Accum(GLenum op,GLfloat value)1664 save_Accum(GLenum op, GLfloat value)
1665 {
1666 GET_CURRENT_CONTEXT(ctx);
1667 Node *n;
1668 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1669 n = alloc_instruction(ctx, OPCODE_ACCUM, 2);
1670 if (n) {
1671 n[1].e = op;
1672 n[2].f = value;
1673 }
1674 if (ctx->ExecuteFlag) {
1675 CALL_Accum(ctx->Exec, (op, value));
1676 }
1677 }
1678
1679
1680 static void GLAPIENTRY
save_AlphaFunc(GLenum func,GLclampf ref)1681 save_AlphaFunc(GLenum func, GLclampf ref)
1682 {
1683 GET_CURRENT_CONTEXT(ctx);
1684 Node *n;
1685 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1686 n = alloc_instruction(ctx, OPCODE_ALPHA_FUNC, 2);
1687 if (n) {
1688 n[1].e = func;
1689 n[2].f = (GLfloat) ref;
1690 }
1691 if (ctx->ExecuteFlag) {
1692 CALL_AlphaFunc(ctx->Exec, (func, ref));
1693 }
1694 }
1695
1696
1697 static void GLAPIENTRY
save_BindTexture(GLenum target,GLuint texture)1698 save_BindTexture(GLenum target, GLuint texture)
1699 {
1700 GET_CURRENT_CONTEXT(ctx);
1701 Node *n;
1702 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1703 n = alloc_instruction(ctx, OPCODE_BIND_TEXTURE, 2);
1704 if (n) {
1705 n[1].e = target;
1706 n[2].ui = texture;
1707 }
1708 if (ctx->ExecuteFlag) {
1709 CALL_BindTexture(ctx->Exec, (target, texture));
1710 }
1711 }
1712
1713
1714 static void GLAPIENTRY
save_Bitmap(GLsizei width,GLsizei height,GLfloat xorig,GLfloat yorig,GLfloat xmove,GLfloat ymove,const GLubyte * pixels)1715 save_Bitmap(GLsizei width, GLsizei height,
1716 GLfloat xorig, GLfloat yorig,
1717 GLfloat xmove, GLfloat ymove, const GLubyte * pixels)
1718 {
1719 GET_CURRENT_CONTEXT(ctx);
1720 Node *n;
1721 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1722 n = alloc_instruction(ctx, OPCODE_BITMAP, 6 + POINTER_DWORDS);
1723 if (n) {
1724 n[1].i = (GLint) width;
1725 n[2].i = (GLint) height;
1726 n[3].f = xorig;
1727 n[4].f = yorig;
1728 n[5].f = xmove;
1729 n[6].f = ymove;
1730 save_pointer(&n[7],
1731 unpack_image(ctx, 2, width, height, 1, GL_COLOR_INDEX,
1732 GL_BITMAP, pixels, &ctx->Unpack));
1733 }
1734 if (ctx->ExecuteFlag) {
1735 CALL_Bitmap(ctx->Exec, (width, height,
1736 xorig, yorig, xmove, ymove, pixels));
1737 }
1738 }
1739
1740
1741 static void GLAPIENTRY
save_BlendEquation(GLenum mode)1742 save_BlendEquation(GLenum mode)
1743 {
1744 GET_CURRENT_CONTEXT(ctx);
1745 Node *n;
1746 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1747 n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION, 1);
1748 if (n) {
1749 n[1].e = mode;
1750 }
1751 if (ctx->ExecuteFlag) {
1752 CALL_BlendEquation(ctx->Exec, (mode));
1753 }
1754 }
1755
1756
1757 static void GLAPIENTRY
save_BlendEquationSeparateEXT(GLenum modeRGB,GLenum modeA)1758 save_BlendEquationSeparateEXT(GLenum modeRGB, GLenum modeA)
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_SEPARATE, 2);
1764 if (n) {
1765 n[1].e = modeRGB;
1766 n[2].e = modeA;
1767 }
1768 if (ctx->ExecuteFlag) {
1769 CALL_BlendEquationSeparate(ctx->Exec, (modeRGB, modeA));
1770 }
1771 }
1772
1773
1774 static void GLAPIENTRY
save_BlendFuncSeparateEXT(GLenum sfactorRGB,GLenum dfactorRGB,GLenum sfactorA,GLenum dfactorA)1775 save_BlendFuncSeparateEXT(GLenum sfactorRGB, GLenum dfactorRGB,
1776 GLenum sfactorA, GLenum dfactorA)
1777 {
1778 GET_CURRENT_CONTEXT(ctx);
1779 Node *n;
1780 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1781 n = alloc_instruction(ctx, OPCODE_BLEND_FUNC_SEPARATE, 4);
1782 if (n) {
1783 n[1].e = sfactorRGB;
1784 n[2].e = dfactorRGB;
1785 n[3].e = sfactorA;
1786 n[4].e = dfactorA;
1787 }
1788 if (ctx->ExecuteFlag) {
1789 CALL_BlendFuncSeparate(ctx->Exec,
1790 (sfactorRGB, dfactorRGB, sfactorA, dfactorA));
1791 }
1792 }
1793
1794
1795 static void GLAPIENTRY
save_BlendFunc(GLenum srcfactor,GLenum dstfactor)1796 save_BlendFunc(GLenum srcfactor, GLenum dstfactor)
1797 {
1798 save_BlendFuncSeparateEXT(srcfactor, dstfactor, srcfactor, dstfactor);
1799 }
1800
1801
1802 static void GLAPIENTRY
save_BlendColor(GLfloat red,GLfloat green,GLfloat blue,GLfloat alpha)1803 save_BlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
1804 {
1805 GET_CURRENT_CONTEXT(ctx);
1806 Node *n;
1807 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1808 n = alloc_instruction(ctx, OPCODE_BLEND_COLOR, 4);
1809 if (n) {
1810 n[1].f = red;
1811 n[2].f = green;
1812 n[3].f = blue;
1813 n[4].f = alpha;
1814 }
1815 if (ctx->ExecuteFlag) {
1816 CALL_BlendColor(ctx->Exec, (red, green, blue, alpha));
1817 }
1818 }
1819
1820 /* GL_ARB_draw_buffers_blend */
1821 static void GLAPIENTRY
save_BlendFuncSeparatei(GLuint buf,GLenum sfactorRGB,GLenum dfactorRGB,GLenum sfactorA,GLenum dfactorA)1822 save_BlendFuncSeparatei(GLuint buf, GLenum sfactorRGB, GLenum dfactorRGB,
1823 GLenum sfactorA, GLenum dfactorA)
1824 {
1825 GET_CURRENT_CONTEXT(ctx);
1826 Node *n;
1827 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1828 n = alloc_instruction(ctx, OPCODE_BLEND_FUNC_SEPARATE_I, 5);
1829 if (n) {
1830 n[1].ui = buf;
1831 n[2].e = sfactorRGB;
1832 n[3].e = dfactorRGB;
1833 n[4].e = sfactorA;
1834 n[5].e = dfactorA;
1835 }
1836 if (ctx->ExecuteFlag) {
1837 CALL_BlendFuncSeparateiARB(ctx->Exec, (buf, sfactorRGB, dfactorRGB,
1838 sfactorA, dfactorA));
1839 }
1840 }
1841
1842 /* GL_ARB_draw_buffers_blend */
1843 static void GLAPIENTRY
save_BlendFunci(GLuint buf,GLenum sfactor,GLenum dfactor)1844 save_BlendFunci(GLuint buf, GLenum sfactor, GLenum dfactor)
1845 {
1846 GET_CURRENT_CONTEXT(ctx);
1847 Node *n;
1848 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1849 n = alloc_instruction(ctx, OPCODE_BLEND_FUNC_I, 3);
1850 if (n) {
1851 n[1].ui = buf;
1852 n[2].e = sfactor;
1853 n[3].e = dfactor;
1854 }
1855 if (ctx->ExecuteFlag) {
1856 CALL_BlendFunciARB(ctx->Exec, (buf, sfactor, dfactor));
1857 }
1858 }
1859
1860 /* GL_ARB_draw_buffers_blend */
1861 static void GLAPIENTRY
save_BlendEquationi(GLuint buf,GLenum mode)1862 save_BlendEquationi(GLuint buf, GLenum mode)
1863 {
1864 GET_CURRENT_CONTEXT(ctx);
1865 Node *n;
1866 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1867 n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION_I, 2);
1868 if (n) {
1869 n[1].ui = buf;
1870 n[2].e = mode;
1871 }
1872 if (ctx->ExecuteFlag) {
1873 CALL_BlendEquationiARB(ctx->Exec, (buf, mode));
1874 }
1875 }
1876
1877 /* GL_ARB_draw_buffers_blend */
1878 static void GLAPIENTRY
save_BlendEquationSeparatei(GLuint buf,GLenum modeRGB,GLenum modeA)1879 save_BlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeA)
1880 {
1881 GET_CURRENT_CONTEXT(ctx);
1882 Node *n;
1883 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1884 n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION_SEPARATE_I, 3);
1885 if (n) {
1886 n[1].ui = buf;
1887 n[2].e = modeRGB;
1888 n[3].e = modeA;
1889 }
1890 if (ctx->ExecuteFlag) {
1891 CALL_BlendEquationSeparateiARB(ctx->Exec, (buf, modeRGB, modeA));
1892 }
1893 }
1894
1895
1896 /* GL_ARB_draw_instanced. */
1897 static void GLAPIENTRY
save_DrawArraysInstancedARB(UNUSED GLenum mode,UNUSED GLint first,UNUSED GLsizei count,UNUSED GLsizei primcount)1898 save_DrawArraysInstancedARB(UNUSED GLenum mode,
1899 UNUSED GLint first,
1900 UNUSED GLsizei count,
1901 UNUSED GLsizei primcount)
1902 {
1903 GET_CURRENT_CONTEXT(ctx);
1904 _mesa_error(ctx, GL_INVALID_OPERATION,
1905 "glDrawArraysInstanced() during display list compile");
1906 }
1907
1908 static void GLAPIENTRY
save_DrawElementsInstancedARB(UNUSED GLenum mode,UNUSED GLsizei count,UNUSED GLenum type,UNUSED const GLvoid * indices,UNUSED GLsizei primcount)1909 save_DrawElementsInstancedARB(UNUSED GLenum mode,
1910 UNUSED GLsizei count,
1911 UNUSED GLenum type,
1912 UNUSED const GLvoid *indices,
1913 UNUSED GLsizei primcount)
1914 {
1915 GET_CURRENT_CONTEXT(ctx);
1916 _mesa_error(ctx, GL_INVALID_OPERATION,
1917 "glDrawElementsInstanced() during display list compile");
1918 }
1919
1920 static void GLAPIENTRY
save_DrawElementsInstancedBaseVertexARB(UNUSED GLenum mode,UNUSED GLsizei count,UNUSED GLenum type,UNUSED const GLvoid * indices,UNUSED GLsizei primcount,UNUSED GLint basevertex)1921 save_DrawElementsInstancedBaseVertexARB(UNUSED GLenum mode,
1922 UNUSED GLsizei count,
1923 UNUSED GLenum type,
1924 UNUSED const GLvoid *indices,
1925 UNUSED GLsizei primcount,
1926 UNUSED GLint basevertex)
1927 {
1928 GET_CURRENT_CONTEXT(ctx);
1929 _mesa_error(ctx, GL_INVALID_OPERATION,
1930 "glDrawElementsInstancedBaseVertex() during display list compile");
1931 }
1932
1933 /* GL_ARB_base_instance. */
1934 static void GLAPIENTRY
save_DrawArraysInstancedBaseInstance(UNUSED GLenum mode,UNUSED GLint first,UNUSED GLsizei count,UNUSED GLsizei primcount,UNUSED GLuint baseinstance)1935 save_DrawArraysInstancedBaseInstance(UNUSED GLenum mode,
1936 UNUSED GLint first,
1937 UNUSED GLsizei count,
1938 UNUSED GLsizei primcount,
1939 UNUSED GLuint baseinstance)
1940 {
1941 GET_CURRENT_CONTEXT(ctx);
1942 _mesa_error(ctx, GL_INVALID_OPERATION,
1943 "glDrawArraysInstancedBaseInstance() during display list compile");
1944 }
1945
1946 static void APIENTRY
save_DrawElementsInstancedBaseInstance(UNUSED GLenum mode,UNUSED GLsizei count,UNUSED GLenum type,UNUSED const void * indices,UNUSED GLsizei primcount,UNUSED GLuint baseinstance)1947 save_DrawElementsInstancedBaseInstance(UNUSED GLenum mode,
1948 UNUSED GLsizei count,
1949 UNUSED GLenum type,
1950 UNUSED const void *indices,
1951 UNUSED GLsizei primcount,
1952 UNUSED GLuint baseinstance)
1953 {
1954 GET_CURRENT_CONTEXT(ctx);
1955 _mesa_error(ctx, GL_INVALID_OPERATION,
1956 "glDrawElementsInstancedBaseInstance() during display list compile");
1957 }
1958
1959 static void APIENTRY
save_DrawElementsInstancedBaseVertexBaseInstance(UNUSED GLenum mode,UNUSED GLsizei count,UNUSED GLenum type,UNUSED const void * indices,UNUSED GLsizei primcount,UNUSED GLint basevertex,UNUSED GLuint baseinstance)1960 save_DrawElementsInstancedBaseVertexBaseInstance(UNUSED GLenum mode,
1961 UNUSED GLsizei count,
1962 UNUSED GLenum type,
1963 UNUSED const void *indices,
1964 UNUSED GLsizei primcount,
1965 UNUSED GLint basevertex,
1966 UNUSED GLuint baseinstance)
1967 {
1968 GET_CURRENT_CONTEXT(ctx);
1969 _mesa_error(ctx, GL_INVALID_OPERATION,
1970 "glDrawElementsInstancedBaseVertexBaseInstance() during display list compile");
1971 }
1972
1973 static void APIENTRY
save_DrawArraysIndirect(UNUSED GLenum mode,UNUSED const void * indirect)1974 save_DrawArraysIndirect(UNUSED GLenum mode,
1975 UNUSED const void *indirect)
1976 {
1977 GET_CURRENT_CONTEXT(ctx);
1978 _mesa_error(ctx, GL_INVALID_OPERATION,
1979 "glDrawArraysIndirect() during display list compile");
1980 }
1981
1982 static void APIENTRY
save_DrawElementsIndirect(UNUSED GLenum mode,UNUSED GLenum type,UNUSED const void * indirect)1983 save_DrawElementsIndirect(UNUSED GLenum mode,
1984 UNUSED GLenum type,
1985 UNUSED const void *indirect)
1986 {
1987 GET_CURRENT_CONTEXT(ctx);
1988 _mesa_error(ctx, GL_INVALID_OPERATION,
1989 "glDrawElementsIndirect() during display list compile");
1990 }
1991
1992 static void APIENTRY
save_MultiDrawArraysIndirect(UNUSED GLenum mode,UNUSED const void * indirect,UNUSED GLsizei primcount,UNUSED GLsizei stride)1993 save_MultiDrawArraysIndirect(UNUSED GLenum mode,
1994 UNUSED const void *indirect,
1995 UNUSED GLsizei primcount,
1996 UNUSED GLsizei stride)
1997 {
1998 GET_CURRENT_CONTEXT(ctx);
1999 _mesa_error(ctx, GL_INVALID_OPERATION,
2000 "glMultiDrawArraysIndirect() during display list compile");
2001 }
2002
2003 static void APIENTRY
save_MultiDrawElementsIndirect(UNUSED GLenum mode,UNUSED GLenum type,UNUSED const void * indirect,UNUSED GLsizei primcount,UNUSED GLsizei stride)2004 save_MultiDrawElementsIndirect(UNUSED GLenum mode,
2005 UNUSED GLenum type,
2006 UNUSED const void *indirect,
2007 UNUSED GLsizei primcount,
2008 UNUSED GLsizei stride)
2009 {
2010 GET_CURRENT_CONTEXT(ctx);
2011 _mesa_error(ctx, GL_INVALID_OPERATION,
2012 "glMultiDrawElementsIndirect() during display list compile");
2013 }
2014
2015 /**
2016 * While building a display list we cache some OpenGL state.
2017 * Under some circumstances we need to invalidate that state (immediately
2018 * when we start compiling a list, or after glCallList(s)).
2019 */
2020 static void
invalidate_saved_current_state(struct gl_context * ctx)2021 invalidate_saved_current_state(struct gl_context *ctx)
2022 {
2023 GLint i;
2024
2025 for (i = 0; i < VERT_ATTRIB_MAX; i++)
2026 ctx->ListState.ActiveAttribSize[i] = 0;
2027
2028 for (i = 0; i < MAT_ATTRIB_MAX; i++)
2029 ctx->ListState.ActiveMaterialSize[i] = 0;
2030
2031 /* Loopback usage applies recursively, so remember this state */
2032 bool use_loopback = ctx->ListState.Current.UseLoopback;
2033 memset(&ctx->ListState.Current, 0, sizeof ctx->ListState.Current);
2034 ctx->ListState.Current.UseLoopback = use_loopback;
2035
2036 ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN;
2037 }
2038
2039
2040 static void GLAPIENTRY
save_CallList(GLuint list)2041 save_CallList(GLuint list)
2042 {
2043 GET_CURRENT_CONTEXT(ctx);
2044 Node *n;
2045 SAVE_FLUSH_VERTICES(ctx);
2046
2047 n = alloc_instruction(ctx, OPCODE_CALL_LIST, 1);
2048 if (n) {
2049 n[1].ui = list;
2050 }
2051
2052 /* After this, we don't know what state we're in. Invalidate all
2053 * cached information previously gathered:
2054 */
2055 invalidate_saved_current_state( ctx );
2056
2057 if (ctx->ExecuteFlag) {
2058 _mesa_CallList(list);
2059 }
2060 }
2061
2062
2063 static void GLAPIENTRY
save_CallLists(GLsizei num,GLenum type,const GLvoid * lists)2064 save_CallLists(GLsizei num, GLenum type, const GLvoid * lists)
2065 {
2066 GET_CURRENT_CONTEXT(ctx);
2067 unsigned type_size;
2068 Node *n;
2069 void *lists_copy;
2070
2071 SAVE_FLUSH_VERTICES(ctx);
2072
2073 switch (type) {
2074 case GL_BYTE:
2075 case GL_UNSIGNED_BYTE:
2076 type_size = 1;
2077 break;
2078 case GL_SHORT:
2079 case GL_UNSIGNED_SHORT:
2080 case GL_2_BYTES:
2081 type_size = 2;
2082 break;
2083 case GL_3_BYTES:
2084 type_size = 3;
2085 break;
2086 case GL_INT:
2087 case GL_UNSIGNED_INT:
2088 case GL_FLOAT:
2089 case GL_4_BYTES:
2090 type_size = 4;
2091 break;
2092 default:
2093 type_size = 0;
2094 }
2095
2096 if (num > 0 && type_size > 0) {
2097 /* create a copy of the array of list IDs to save in the display list */
2098 lists_copy = memdup(lists, num * type_size);
2099 } else {
2100 lists_copy = NULL;
2101 }
2102
2103 n = alloc_instruction(ctx, OPCODE_CALL_LISTS, 2 + POINTER_DWORDS);
2104 if (n) {
2105 n[1].i = num;
2106 n[2].e = type;
2107 save_pointer(&n[3], lists_copy);
2108 }
2109
2110 /* After this, we don't know what state we're in. Invalidate all
2111 * cached information previously gathered:
2112 */
2113 invalidate_saved_current_state( ctx );
2114
2115 if (ctx->ExecuteFlag) {
2116 CALL_CallLists(ctx->Exec, (num, type, lists));
2117 }
2118 }
2119
2120
2121 static void GLAPIENTRY
save_Clear(GLbitfield mask)2122 save_Clear(GLbitfield mask)
2123 {
2124 GET_CURRENT_CONTEXT(ctx);
2125 Node *n;
2126 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2127 n = alloc_instruction(ctx, OPCODE_CLEAR, 1);
2128 if (n) {
2129 n[1].bf = mask;
2130 }
2131 if (ctx->ExecuteFlag) {
2132 CALL_Clear(ctx->Exec, (mask));
2133 }
2134 }
2135
2136
2137 static void GLAPIENTRY
save_ClearBufferiv(GLenum buffer,GLint drawbuffer,const GLint * value)2138 save_ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value)
2139 {
2140 GET_CURRENT_CONTEXT(ctx);
2141 Node *n;
2142 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2143 n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_IV, 6);
2144 if (n) {
2145 n[1].e = buffer;
2146 n[2].i = drawbuffer;
2147 n[3].i = value[0];
2148 if (buffer == GL_COLOR) {
2149 n[4].i = value[1];
2150 n[5].i = value[2];
2151 n[6].i = value[3];
2152 }
2153 else {
2154 n[4].i = 0;
2155 n[5].i = 0;
2156 n[6].i = 0;
2157 }
2158 }
2159 if (ctx->ExecuteFlag) {
2160 CALL_ClearBufferiv(ctx->Exec, (buffer, drawbuffer, value));
2161 }
2162 }
2163
2164
2165 static void GLAPIENTRY
save_ClearBufferuiv(GLenum buffer,GLint drawbuffer,const GLuint * value)2166 save_ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value)
2167 {
2168 GET_CURRENT_CONTEXT(ctx);
2169 Node *n;
2170 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2171 n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_UIV, 6);
2172 if (n) {
2173 n[1].e = buffer;
2174 n[2].i = drawbuffer;
2175 n[3].ui = value[0];
2176 if (buffer == GL_COLOR) {
2177 n[4].ui = value[1];
2178 n[5].ui = value[2];
2179 n[6].ui = value[3];
2180 }
2181 else {
2182 n[4].ui = 0;
2183 n[5].ui = 0;
2184 n[6].ui = 0;
2185 }
2186 }
2187 if (ctx->ExecuteFlag) {
2188 CALL_ClearBufferuiv(ctx->Exec, (buffer, drawbuffer, value));
2189 }
2190 }
2191
2192
2193 static void GLAPIENTRY
save_ClearBufferfv(GLenum buffer,GLint drawbuffer,const GLfloat * value)2194 save_ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
2195 {
2196 GET_CURRENT_CONTEXT(ctx);
2197 Node *n;
2198 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2199 n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_FV, 6);
2200 if (n) {
2201 n[1].e = buffer;
2202 n[2].i = drawbuffer;
2203 n[3].f = value[0];
2204 if (buffer == GL_COLOR) {
2205 n[4].f = value[1];
2206 n[5].f = value[2];
2207 n[6].f = value[3];
2208 }
2209 else {
2210 n[4].f = 0.0F;
2211 n[5].f = 0.0F;
2212 n[6].f = 0.0F;
2213 }
2214 }
2215 if (ctx->ExecuteFlag) {
2216 CALL_ClearBufferfv(ctx->Exec, (buffer, drawbuffer, value));
2217 }
2218 }
2219
2220
2221 static void GLAPIENTRY
save_ClearBufferfi(GLenum buffer,GLint drawbuffer,GLfloat depth,GLint stencil)2222 save_ClearBufferfi(GLenum buffer, GLint drawbuffer,
2223 GLfloat depth, GLint stencil)
2224 {
2225 GET_CURRENT_CONTEXT(ctx);
2226 Node *n;
2227 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2228 n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_FI, 4);
2229 if (n) {
2230 n[1].e = buffer;
2231 n[2].i = drawbuffer;
2232 n[3].f = depth;
2233 n[4].i = stencil;
2234 }
2235 if (ctx->ExecuteFlag) {
2236 CALL_ClearBufferfi(ctx->Exec, (buffer, drawbuffer, depth, stencil));
2237 }
2238 }
2239
2240
2241 static void GLAPIENTRY
save_ClearAccum(GLfloat red,GLfloat green,GLfloat blue,GLfloat alpha)2242 save_ClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
2243 {
2244 GET_CURRENT_CONTEXT(ctx);
2245 Node *n;
2246 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2247 n = alloc_instruction(ctx, OPCODE_CLEAR_ACCUM, 4);
2248 if (n) {
2249 n[1].f = red;
2250 n[2].f = green;
2251 n[3].f = blue;
2252 n[4].f = alpha;
2253 }
2254 if (ctx->ExecuteFlag) {
2255 CALL_ClearAccum(ctx->Exec, (red, green, blue, alpha));
2256 }
2257 }
2258
2259
2260 static void GLAPIENTRY
save_ClearColor(GLclampf red,GLclampf green,GLclampf blue,GLclampf alpha)2261 save_ClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
2262 {
2263 GET_CURRENT_CONTEXT(ctx);
2264 Node *n;
2265 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2266 n = alloc_instruction(ctx, OPCODE_CLEAR_COLOR, 4);
2267 if (n) {
2268 n[1].f = red;
2269 n[2].f = green;
2270 n[3].f = blue;
2271 n[4].f = alpha;
2272 }
2273 if (ctx->ExecuteFlag) {
2274 CALL_ClearColor(ctx->Exec, (red, green, blue, alpha));
2275 }
2276 }
2277
2278
2279 static void GLAPIENTRY
save_ClearDepth(GLclampd depth)2280 save_ClearDepth(GLclampd depth)
2281 {
2282 GET_CURRENT_CONTEXT(ctx);
2283 Node *n;
2284 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2285 n = alloc_instruction(ctx, OPCODE_CLEAR_DEPTH, 1);
2286 if (n) {
2287 n[1].f = (GLfloat) depth;
2288 }
2289 if (ctx->ExecuteFlag) {
2290 CALL_ClearDepth(ctx->Exec, (depth));
2291 }
2292 }
2293
2294
2295 static void GLAPIENTRY
save_ClearIndex(GLfloat c)2296 save_ClearIndex(GLfloat c)
2297 {
2298 GET_CURRENT_CONTEXT(ctx);
2299 Node *n;
2300 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2301 n = alloc_instruction(ctx, OPCODE_CLEAR_INDEX, 1);
2302 if (n) {
2303 n[1].f = c;
2304 }
2305 if (ctx->ExecuteFlag) {
2306 CALL_ClearIndex(ctx->Exec, (c));
2307 }
2308 }
2309
2310
2311 static void GLAPIENTRY
save_ClearStencil(GLint s)2312 save_ClearStencil(GLint s)
2313 {
2314 GET_CURRENT_CONTEXT(ctx);
2315 Node *n;
2316 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2317 n = alloc_instruction(ctx, OPCODE_CLEAR_STENCIL, 1);
2318 if (n) {
2319 n[1].i = s;
2320 }
2321 if (ctx->ExecuteFlag) {
2322 CALL_ClearStencil(ctx->Exec, (s));
2323 }
2324 }
2325
2326
2327 static void GLAPIENTRY
save_ClipPlane(GLenum plane,const GLdouble * equ)2328 save_ClipPlane(GLenum plane, const GLdouble * equ)
2329 {
2330 GET_CURRENT_CONTEXT(ctx);
2331 Node *n;
2332 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2333 n = alloc_instruction(ctx, OPCODE_CLIP_PLANE, 5);
2334 if (n) {
2335 n[1].e = plane;
2336 n[2].f = (GLfloat) equ[0];
2337 n[3].f = (GLfloat) equ[1];
2338 n[4].f = (GLfloat) equ[2];
2339 n[5].f = (GLfloat) equ[3];
2340 }
2341 if (ctx->ExecuteFlag) {
2342 CALL_ClipPlane(ctx->Exec, (plane, equ));
2343 }
2344 }
2345
2346
2347
2348 static void GLAPIENTRY
save_ColorMask(GLboolean red,GLboolean green,GLboolean blue,GLboolean alpha)2349 save_ColorMask(GLboolean red, GLboolean green,
2350 GLboolean blue, GLboolean alpha)
2351 {
2352 GET_CURRENT_CONTEXT(ctx);
2353 Node *n;
2354 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2355 n = alloc_instruction(ctx, OPCODE_COLOR_MASK, 4);
2356 if (n) {
2357 n[1].b = red;
2358 n[2].b = green;
2359 n[3].b = blue;
2360 n[4].b = alpha;
2361 }
2362 if (ctx->ExecuteFlag) {
2363 CALL_ColorMask(ctx->Exec, (red, green, blue, alpha));
2364 }
2365 }
2366
2367
2368 static void GLAPIENTRY
save_ColorMaskIndexed(GLuint buf,GLboolean red,GLboolean green,GLboolean blue,GLboolean alpha)2369 save_ColorMaskIndexed(GLuint buf, GLboolean red, GLboolean green,
2370 GLboolean blue, GLboolean alpha)
2371 {
2372 GET_CURRENT_CONTEXT(ctx);
2373 Node *n;
2374 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2375 n = alloc_instruction(ctx, OPCODE_COLOR_MASK_INDEXED, 5);
2376 if (n) {
2377 n[1].ui = buf;
2378 n[2].b = red;
2379 n[3].b = green;
2380 n[4].b = blue;
2381 n[5].b = alpha;
2382 }
2383 if (ctx->ExecuteFlag) {
2384 /*CALL_ColorMaski(ctx->Exec, (buf, red, green, blue, alpha));*/
2385 }
2386 }
2387
2388
2389 static void GLAPIENTRY
save_ColorMaterial(GLenum face,GLenum mode)2390 save_ColorMaterial(GLenum face, GLenum mode)
2391 {
2392 GET_CURRENT_CONTEXT(ctx);
2393 Node *n;
2394 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2395
2396 n = alloc_instruction(ctx, OPCODE_COLOR_MATERIAL, 2);
2397 if (n) {
2398 n[1].e = face;
2399 n[2].e = mode;
2400 }
2401 if (ctx->ExecuteFlag) {
2402 CALL_ColorMaterial(ctx->Exec, (face, mode));
2403 }
2404 }
2405
2406
2407 static void GLAPIENTRY
save_CopyPixels(GLint x,GLint y,GLsizei width,GLsizei height,GLenum type)2408 save_CopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type)
2409 {
2410 GET_CURRENT_CONTEXT(ctx);
2411 Node *n;
2412 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2413 n = alloc_instruction(ctx, OPCODE_COPY_PIXELS, 5);
2414 if (n) {
2415 n[1].i = x;
2416 n[2].i = y;
2417 n[3].i = (GLint) width;
2418 n[4].i = (GLint) height;
2419 n[5].e = type;
2420 }
2421 if (ctx->ExecuteFlag) {
2422 CALL_CopyPixels(ctx->Exec, (x, y, width, height, type));
2423 }
2424 }
2425
2426
2427
2428 static void GLAPIENTRY
save_CopyTexImage1D(GLenum target,GLint level,GLenum internalformat,GLint x,GLint y,GLsizei width,GLint border)2429 save_CopyTexImage1D(GLenum target, GLint level, GLenum internalformat,
2430 GLint x, GLint y, GLsizei width, GLint border)
2431 {
2432 GET_CURRENT_CONTEXT(ctx);
2433 Node *n;
2434 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2435 n = alloc_instruction(ctx, OPCODE_COPY_TEX_IMAGE1D, 7);
2436 if (n) {
2437 n[1].e = target;
2438 n[2].i = level;
2439 n[3].e = internalformat;
2440 n[4].i = x;
2441 n[5].i = y;
2442 n[6].i = width;
2443 n[7].i = border;
2444 }
2445 if (ctx->ExecuteFlag) {
2446 CALL_CopyTexImage1D(ctx->Exec, (target, level, internalformat,
2447 x, y, width, border));
2448 }
2449 }
2450
2451
2452 static void GLAPIENTRY
save_CopyTexImage2D(GLenum target,GLint level,GLenum internalformat,GLint x,GLint y,GLsizei width,GLsizei height,GLint border)2453 save_CopyTexImage2D(GLenum target, GLint level,
2454 GLenum internalformat,
2455 GLint x, GLint y, GLsizei width,
2456 GLsizei height, GLint border)
2457 {
2458 GET_CURRENT_CONTEXT(ctx);
2459 Node *n;
2460 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2461 n = alloc_instruction(ctx, OPCODE_COPY_TEX_IMAGE2D, 8);
2462 if (n) {
2463 n[1].e = target;
2464 n[2].i = level;
2465 n[3].e = internalformat;
2466 n[4].i = x;
2467 n[5].i = y;
2468 n[6].i = width;
2469 n[7].i = height;
2470 n[8].i = border;
2471 }
2472 if (ctx->ExecuteFlag) {
2473 CALL_CopyTexImage2D(ctx->Exec, (target, level, internalformat,
2474 x, y, width, height, border));
2475 }
2476 }
2477
2478
2479
2480 static void GLAPIENTRY
save_CopyTexSubImage1D(GLenum target,GLint level,GLint xoffset,GLint x,GLint y,GLsizei width)2481 save_CopyTexSubImage1D(GLenum target, GLint level,
2482 GLint xoffset, GLint x, GLint y, GLsizei width)
2483 {
2484 GET_CURRENT_CONTEXT(ctx);
2485 Node *n;
2486 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2487 n = alloc_instruction(ctx, OPCODE_COPY_TEX_SUB_IMAGE1D, 6);
2488 if (n) {
2489 n[1].e = target;
2490 n[2].i = level;
2491 n[3].i = xoffset;
2492 n[4].i = x;
2493 n[5].i = y;
2494 n[6].i = width;
2495 }
2496 if (ctx->ExecuteFlag) {
2497 CALL_CopyTexSubImage1D(ctx->Exec,
2498 (target, level, xoffset, x, y, width));
2499 }
2500 }
2501
2502
2503 static void GLAPIENTRY
save_CopyTexSubImage2D(GLenum target,GLint level,GLint xoffset,GLint yoffset,GLint x,GLint y,GLsizei width,GLint height)2504 save_CopyTexSubImage2D(GLenum target, GLint level,
2505 GLint xoffset, GLint yoffset,
2506 GLint x, GLint y, GLsizei width, GLint height)
2507 {
2508 GET_CURRENT_CONTEXT(ctx);
2509 Node *n;
2510 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2511 n = alloc_instruction(ctx, OPCODE_COPY_TEX_SUB_IMAGE2D, 8);
2512 if (n) {
2513 n[1].e = target;
2514 n[2].i = level;
2515 n[3].i = xoffset;
2516 n[4].i = yoffset;
2517 n[5].i = x;
2518 n[6].i = y;
2519 n[7].i = width;
2520 n[8].i = height;
2521 }
2522 if (ctx->ExecuteFlag) {
2523 CALL_CopyTexSubImage2D(ctx->Exec, (target, level, xoffset, yoffset,
2524 x, y, width, height));
2525 }
2526 }
2527
2528
2529 static void GLAPIENTRY
save_CopyTexSubImage3D(GLenum target,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLint x,GLint y,GLsizei width,GLint height)2530 save_CopyTexSubImage3D(GLenum target, GLint level,
2531 GLint xoffset, GLint yoffset, GLint zoffset,
2532 GLint x, GLint y, GLsizei width, GLint height)
2533 {
2534 GET_CURRENT_CONTEXT(ctx);
2535 Node *n;
2536 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2537 n = alloc_instruction(ctx, OPCODE_COPY_TEX_SUB_IMAGE3D, 9);
2538 if (n) {
2539 n[1].e = target;
2540 n[2].i = level;
2541 n[3].i = xoffset;
2542 n[4].i = yoffset;
2543 n[5].i = zoffset;
2544 n[6].i = x;
2545 n[7].i = y;
2546 n[8].i = width;
2547 n[9].i = height;
2548 }
2549 if (ctx->ExecuteFlag) {
2550 CALL_CopyTexSubImage3D(ctx->Exec, (target, level,
2551 xoffset, yoffset, zoffset,
2552 x, y, width, height));
2553 }
2554 }
2555
2556
2557 static void GLAPIENTRY
save_CullFace(GLenum mode)2558 save_CullFace(GLenum mode)
2559 {
2560 GET_CURRENT_CONTEXT(ctx);
2561 Node *n;
2562 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2563 n = alloc_instruction(ctx, OPCODE_CULL_FACE, 1);
2564 if (n) {
2565 n[1].e = mode;
2566 }
2567 if (ctx->ExecuteFlag) {
2568 CALL_CullFace(ctx->Exec, (mode));
2569 }
2570 }
2571
2572
2573 static void GLAPIENTRY
save_DepthFunc(GLenum func)2574 save_DepthFunc(GLenum func)
2575 {
2576 GET_CURRENT_CONTEXT(ctx);
2577 Node *n;
2578 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2579 n = alloc_instruction(ctx, OPCODE_DEPTH_FUNC, 1);
2580 if (n) {
2581 n[1].e = func;
2582 }
2583 if (ctx->ExecuteFlag) {
2584 CALL_DepthFunc(ctx->Exec, (func));
2585 }
2586 }
2587
2588
2589 static void GLAPIENTRY
save_DepthMask(GLboolean mask)2590 save_DepthMask(GLboolean mask)
2591 {
2592 GET_CURRENT_CONTEXT(ctx);
2593 Node *n;
2594 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2595 n = alloc_instruction(ctx, OPCODE_DEPTH_MASK, 1);
2596 if (n) {
2597 n[1].b = mask;
2598 }
2599 if (ctx->ExecuteFlag) {
2600 CALL_DepthMask(ctx->Exec, (mask));
2601 }
2602 }
2603
2604
2605 static void GLAPIENTRY
save_DepthRange(GLclampd nearval,GLclampd farval)2606 save_DepthRange(GLclampd nearval, GLclampd farval)
2607 {
2608 GET_CURRENT_CONTEXT(ctx);
2609 Node *n;
2610 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2611 n = alloc_instruction(ctx, OPCODE_DEPTH_RANGE, 2);
2612 if (n) {
2613 n[1].f = (GLfloat) nearval;
2614 n[2].f = (GLfloat) farval;
2615 }
2616 if (ctx->ExecuteFlag) {
2617 CALL_DepthRange(ctx->Exec, (nearval, farval));
2618 }
2619 }
2620
2621
2622 static void GLAPIENTRY
save_Disable(GLenum cap)2623 save_Disable(GLenum cap)
2624 {
2625 GET_CURRENT_CONTEXT(ctx);
2626 Node *n;
2627 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2628 n = alloc_instruction(ctx, OPCODE_DISABLE, 1);
2629 if (n) {
2630 n[1].e = cap;
2631 }
2632 if (ctx->ExecuteFlag) {
2633 CALL_Disable(ctx->Exec, (cap));
2634 }
2635 }
2636
2637
2638 static void GLAPIENTRY
save_DisableIndexed(GLuint index,GLenum cap)2639 save_DisableIndexed(GLuint index, GLenum cap)
2640 {
2641 GET_CURRENT_CONTEXT(ctx);
2642 Node *n;
2643 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2644 n = alloc_instruction(ctx, OPCODE_DISABLE_INDEXED, 2);
2645 if (n) {
2646 n[1].ui = index;
2647 n[2].e = cap;
2648 }
2649 if (ctx->ExecuteFlag) {
2650 CALL_Disablei(ctx->Exec, (index, cap));
2651 }
2652 }
2653
2654
2655 static void GLAPIENTRY
save_DrawBuffer(GLenum mode)2656 save_DrawBuffer(GLenum mode)
2657 {
2658 GET_CURRENT_CONTEXT(ctx);
2659 Node *n;
2660 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2661 n = alloc_instruction(ctx, OPCODE_DRAW_BUFFER, 1);
2662 if (n) {
2663 n[1].e = mode;
2664 }
2665 if (ctx->ExecuteFlag) {
2666 CALL_DrawBuffer(ctx->Exec, (mode));
2667 }
2668 }
2669
2670
2671 static void GLAPIENTRY
save_DrawPixels(GLsizei width,GLsizei height,GLenum format,GLenum type,const GLvoid * pixels)2672 save_DrawPixels(GLsizei width, GLsizei height,
2673 GLenum format, GLenum type, const GLvoid * pixels)
2674 {
2675 GET_CURRENT_CONTEXT(ctx);
2676 Node *n;
2677
2678 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2679
2680 n = alloc_instruction(ctx, OPCODE_DRAW_PIXELS, 4 + POINTER_DWORDS);
2681 if (n) {
2682 n[1].i = width;
2683 n[2].i = height;
2684 n[3].e = format;
2685 n[4].e = type;
2686 save_pointer(&n[5],
2687 unpack_image(ctx, 2, width, height, 1, format, type,
2688 pixels, &ctx->Unpack));
2689 }
2690 if (ctx->ExecuteFlag) {
2691 CALL_DrawPixels(ctx->Exec, (width, height, format, type, pixels));
2692 }
2693 }
2694
2695
2696
2697 static void GLAPIENTRY
save_Enable(GLenum cap)2698 save_Enable(GLenum cap)
2699 {
2700 GET_CURRENT_CONTEXT(ctx);
2701 Node *n;
2702 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2703 n = alloc_instruction(ctx, OPCODE_ENABLE, 1);
2704 if (n) {
2705 n[1].e = cap;
2706 }
2707 if (ctx->ExecuteFlag) {
2708 CALL_Enable(ctx->Exec, (cap));
2709 }
2710 }
2711
2712
2713
2714 static void GLAPIENTRY
save_EnableIndexed(GLuint index,GLenum cap)2715 save_EnableIndexed(GLuint index, GLenum cap)
2716 {
2717 GET_CURRENT_CONTEXT(ctx);
2718 Node *n;
2719 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2720 n = alloc_instruction(ctx, OPCODE_ENABLE_INDEXED, 2);
2721 if (n) {
2722 n[1].ui = index;
2723 n[2].e = cap;
2724 }
2725 if (ctx->ExecuteFlag) {
2726 CALL_Enablei(ctx->Exec, (index, cap));
2727 }
2728 }
2729
2730
2731
2732 static void GLAPIENTRY
save_EvalMesh1(GLenum mode,GLint i1,GLint i2)2733 save_EvalMesh1(GLenum mode, GLint i1, GLint i2)
2734 {
2735 GET_CURRENT_CONTEXT(ctx);
2736 Node *n;
2737 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2738 n = alloc_instruction(ctx, OPCODE_EVALMESH1, 3);
2739 if (n) {
2740 n[1].e = mode;
2741 n[2].i = i1;
2742 n[3].i = i2;
2743 }
2744 if (ctx->ExecuteFlag) {
2745 CALL_EvalMesh1(ctx->Exec, (mode, i1, i2));
2746 }
2747 }
2748
2749
2750 static void GLAPIENTRY
save_EvalMesh2(GLenum mode,GLint i1,GLint i2,GLint j1,GLint j2)2751 save_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)
2752 {
2753 GET_CURRENT_CONTEXT(ctx);
2754 Node *n;
2755 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2756 n = alloc_instruction(ctx, OPCODE_EVALMESH2, 5);
2757 if (n) {
2758 n[1].e = mode;
2759 n[2].i = i1;
2760 n[3].i = i2;
2761 n[4].i = j1;
2762 n[5].i = j2;
2763 }
2764 if (ctx->ExecuteFlag) {
2765 CALL_EvalMesh2(ctx->Exec, (mode, i1, i2, j1, j2));
2766 }
2767 }
2768
2769
2770
2771
2772 static void GLAPIENTRY
save_Fogfv(GLenum pname,const GLfloat * params)2773 save_Fogfv(GLenum pname, const GLfloat *params)
2774 {
2775 GET_CURRENT_CONTEXT(ctx);
2776 Node *n;
2777 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2778 n = alloc_instruction(ctx, OPCODE_FOG, 5);
2779 if (n) {
2780 n[1].e = pname;
2781 n[2].f = params[0];
2782 n[3].f = params[1];
2783 n[4].f = params[2];
2784 n[5].f = params[3];
2785 }
2786 if (ctx->ExecuteFlag) {
2787 CALL_Fogfv(ctx->Exec, (pname, params));
2788 }
2789 }
2790
2791
2792 static void GLAPIENTRY
save_Fogf(GLenum pname,GLfloat param)2793 save_Fogf(GLenum pname, GLfloat param)
2794 {
2795 GLfloat parray[4];
2796 parray[0] = param;
2797 parray[1] = parray[2] = parray[3] = 0.0F;
2798 save_Fogfv(pname, parray);
2799 }
2800
2801
2802 static void GLAPIENTRY
save_Fogiv(GLenum pname,const GLint * params)2803 save_Fogiv(GLenum pname, const GLint *params)
2804 {
2805 GLfloat p[4];
2806 switch (pname) {
2807 case GL_FOG_MODE:
2808 case GL_FOG_DENSITY:
2809 case GL_FOG_START:
2810 case GL_FOG_END:
2811 case GL_FOG_INDEX:
2812 case GL_FOG_COORDINATE_SOURCE:
2813 p[0] = (GLfloat) *params;
2814 p[1] = 0.0f;
2815 p[2] = 0.0f;
2816 p[3] = 0.0f;
2817 break;
2818 case GL_FOG_COLOR:
2819 p[0] = INT_TO_FLOAT(params[0]);
2820 p[1] = INT_TO_FLOAT(params[1]);
2821 p[2] = INT_TO_FLOAT(params[2]);
2822 p[3] = INT_TO_FLOAT(params[3]);
2823 break;
2824 default:
2825 /* Error will be caught later in gl_Fogfv */
2826 ASSIGN_4V(p, 0.0F, 0.0F, 0.0F, 0.0F);
2827 }
2828 save_Fogfv(pname, p);
2829 }
2830
2831
2832 static void GLAPIENTRY
save_Fogi(GLenum pname,GLint param)2833 save_Fogi(GLenum pname, GLint param)
2834 {
2835 GLint parray[4];
2836 parray[0] = param;
2837 parray[1] = parray[2] = parray[3] = 0;
2838 save_Fogiv(pname, parray);
2839 }
2840
2841
2842 static void GLAPIENTRY
save_FrontFace(GLenum mode)2843 save_FrontFace(GLenum mode)
2844 {
2845 GET_CURRENT_CONTEXT(ctx);
2846 Node *n;
2847 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2848 n = alloc_instruction(ctx, OPCODE_FRONT_FACE, 1);
2849 if (n) {
2850 n[1].e = mode;
2851 }
2852 if (ctx->ExecuteFlag) {
2853 CALL_FrontFace(ctx->Exec, (mode));
2854 }
2855 }
2856
2857
2858 static void GLAPIENTRY
save_Frustum(GLdouble left,GLdouble right,GLdouble bottom,GLdouble top,GLdouble nearval,GLdouble farval)2859 save_Frustum(GLdouble left, GLdouble right,
2860 GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval)
2861 {
2862 GET_CURRENT_CONTEXT(ctx);
2863 Node *n;
2864 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2865 n = alloc_instruction(ctx, OPCODE_FRUSTUM, 6);
2866 if (n) {
2867 n[1].f = (GLfloat) left;
2868 n[2].f = (GLfloat) right;
2869 n[3].f = (GLfloat) bottom;
2870 n[4].f = (GLfloat) top;
2871 n[5].f = (GLfloat) nearval;
2872 n[6].f = (GLfloat) farval;
2873 }
2874 if (ctx->ExecuteFlag) {
2875 CALL_Frustum(ctx->Exec, (left, right, bottom, top, nearval, farval));
2876 }
2877 }
2878
2879
2880 static void GLAPIENTRY
save_Hint(GLenum target,GLenum mode)2881 save_Hint(GLenum target, GLenum mode)
2882 {
2883 GET_CURRENT_CONTEXT(ctx);
2884 Node *n;
2885 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2886 n = alloc_instruction(ctx, OPCODE_HINT, 2);
2887 if (n) {
2888 n[1].e = target;
2889 n[2].e = mode;
2890 }
2891 if (ctx->ExecuteFlag) {
2892 CALL_Hint(ctx->Exec, (target, mode));
2893 }
2894 }
2895
2896
2897 static void GLAPIENTRY
save_IndexMask(GLuint mask)2898 save_IndexMask(GLuint mask)
2899 {
2900 GET_CURRENT_CONTEXT(ctx);
2901 Node *n;
2902 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2903 n = alloc_instruction(ctx, OPCODE_INDEX_MASK, 1);
2904 if (n) {
2905 n[1].ui = mask;
2906 }
2907 if (ctx->ExecuteFlag) {
2908 CALL_IndexMask(ctx->Exec, (mask));
2909 }
2910 }
2911
2912
2913 static void GLAPIENTRY
save_InitNames(void)2914 save_InitNames(void)
2915 {
2916 GET_CURRENT_CONTEXT(ctx);
2917 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2918 (void) alloc_instruction(ctx, OPCODE_INIT_NAMES, 0);
2919 if (ctx->ExecuteFlag) {
2920 CALL_InitNames(ctx->Exec, ());
2921 }
2922 }
2923
2924
2925 static void GLAPIENTRY
save_Lightfv(GLenum light,GLenum pname,const GLfloat * params)2926 save_Lightfv(GLenum light, GLenum pname, const GLfloat *params)
2927 {
2928 GET_CURRENT_CONTEXT(ctx);
2929 Node *n;
2930 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2931 n = alloc_instruction(ctx, OPCODE_LIGHT, 6);
2932 if (n) {
2933 GLint i, nParams;
2934 n[1].e = light;
2935 n[2].e = pname;
2936 switch (pname) {
2937 case GL_AMBIENT:
2938 nParams = 4;
2939 break;
2940 case GL_DIFFUSE:
2941 nParams = 4;
2942 break;
2943 case GL_SPECULAR:
2944 nParams = 4;
2945 break;
2946 case GL_POSITION:
2947 nParams = 4;
2948 break;
2949 case GL_SPOT_DIRECTION:
2950 nParams = 3;
2951 break;
2952 case GL_SPOT_EXPONENT:
2953 nParams = 1;
2954 break;
2955 case GL_SPOT_CUTOFF:
2956 nParams = 1;
2957 break;
2958 case GL_CONSTANT_ATTENUATION:
2959 nParams = 1;
2960 break;
2961 case GL_LINEAR_ATTENUATION:
2962 nParams = 1;
2963 break;
2964 case GL_QUADRATIC_ATTENUATION:
2965 nParams = 1;
2966 break;
2967 default:
2968 nParams = 0;
2969 }
2970 for (i = 0; i < nParams; i++) {
2971 n[3 + i].f = params[i];
2972 }
2973 }
2974 if (ctx->ExecuteFlag) {
2975 CALL_Lightfv(ctx->Exec, (light, pname, params));
2976 }
2977 }
2978
2979
2980 static void GLAPIENTRY
save_Lightf(GLenum light,GLenum pname,GLfloat param)2981 save_Lightf(GLenum light, GLenum pname, GLfloat param)
2982 {
2983 GLfloat parray[4];
2984 parray[0] = param;
2985 parray[1] = parray[2] = parray[3] = 0.0F;
2986 save_Lightfv(light, pname, parray);
2987 }
2988
2989
2990 static void GLAPIENTRY
save_Lightiv(GLenum light,GLenum pname,const GLint * params)2991 save_Lightiv(GLenum light, GLenum pname, const GLint *params)
2992 {
2993 GLfloat fparam[4];
2994 switch (pname) {
2995 case GL_AMBIENT:
2996 case GL_DIFFUSE:
2997 case GL_SPECULAR:
2998 fparam[0] = INT_TO_FLOAT(params[0]);
2999 fparam[1] = INT_TO_FLOAT(params[1]);
3000 fparam[2] = INT_TO_FLOAT(params[2]);
3001 fparam[3] = INT_TO_FLOAT(params[3]);
3002 break;
3003 case GL_POSITION:
3004 fparam[0] = (GLfloat) params[0];
3005 fparam[1] = (GLfloat) params[1];
3006 fparam[2] = (GLfloat) params[2];
3007 fparam[3] = (GLfloat) params[3];
3008 break;
3009 case GL_SPOT_DIRECTION:
3010 fparam[0] = (GLfloat) params[0];
3011 fparam[1] = (GLfloat) params[1];
3012 fparam[2] = (GLfloat) params[2];
3013 break;
3014 case GL_SPOT_EXPONENT:
3015 case GL_SPOT_CUTOFF:
3016 case GL_CONSTANT_ATTENUATION:
3017 case GL_LINEAR_ATTENUATION:
3018 case GL_QUADRATIC_ATTENUATION:
3019 fparam[0] = (GLfloat) params[0];
3020 break;
3021 default:
3022 /* error will be caught later in gl_Lightfv */
3023 ;
3024 }
3025 save_Lightfv(light, pname, fparam);
3026 }
3027
3028
3029 static void GLAPIENTRY
save_Lighti(GLenum light,GLenum pname,GLint param)3030 save_Lighti(GLenum light, GLenum pname, GLint param)
3031 {
3032 GLint parray[4];
3033 parray[0] = param;
3034 parray[1] = parray[2] = parray[3] = 0;
3035 save_Lightiv(light, pname, parray);
3036 }
3037
3038
3039 static void GLAPIENTRY
save_LightModelfv(GLenum pname,const GLfloat * params)3040 save_LightModelfv(GLenum pname, const GLfloat *params)
3041 {
3042 GET_CURRENT_CONTEXT(ctx);
3043 Node *n;
3044 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3045 n = alloc_instruction(ctx, OPCODE_LIGHT_MODEL, 5);
3046 if (n) {
3047 n[1].e = pname;
3048 n[2].f = params[0];
3049 n[3].f = params[1];
3050 n[4].f = params[2];
3051 n[5].f = params[3];
3052 }
3053 if (ctx->ExecuteFlag) {
3054 CALL_LightModelfv(ctx->Exec, (pname, params));
3055 }
3056 }
3057
3058
3059 static void GLAPIENTRY
save_LightModelf(GLenum pname,GLfloat param)3060 save_LightModelf(GLenum pname, GLfloat param)
3061 {
3062 GLfloat parray[4];
3063 parray[0] = param;
3064 parray[1] = parray[2] = parray[3] = 0.0F;
3065 save_LightModelfv(pname, parray);
3066 }
3067
3068
3069 static void GLAPIENTRY
save_LightModeliv(GLenum pname,const GLint * params)3070 save_LightModeliv(GLenum pname, const GLint *params)
3071 {
3072 GLfloat fparam[4];
3073 switch (pname) {
3074 case GL_LIGHT_MODEL_AMBIENT:
3075 fparam[0] = INT_TO_FLOAT(params[0]);
3076 fparam[1] = INT_TO_FLOAT(params[1]);
3077 fparam[2] = INT_TO_FLOAT(params[2]);
3078 fparam[3] = INT_TO_FLOAT(params[3]);
3079 break;
3080 case GL_LIGHT_MODEL_LOCAL_VIEWER:
3081 case GL_LIGHT_MODEL_TWO_SIDE:
3082 case GL_LIGHT_MODEL_COLOR_CONTROL:
3083 fparam[0] = (GLfloat) params[0];
3084 fparam[1] = 0.0F;
3085 fparam[2] = 0.0F;
3086 fparam[3] = 0.0F;
3087 break;
3088 default:
3089 /* Error will be caught later in gl_LightModelfv */
3090 ASSIGN_4V(fparam, 0.0F, 0.0F, 0.0F, 0.0F);
3091 }
3092 save_LightModelfv(pname, fparam);
3093 }
3094
3095
3096 static void GLAPIENTRY
save_LightModeli(GLenum pname,GLint param)3097 save_LightModeli(GLenum pname, GLint param)
3098 {
3099 GLint parray[4];
3100 parray[0] = param;
3101 parray[1] = parray[2] = parray[3] = 0;
3102 save_LightModeliv(pname, parray);
3103 }
3104
3105
3106 static void GLAPIENTRY
save_LineStipple(GLint factor,GLushort pattern)3107 save_LineStipple(GLint factor, GLushort pattern)
3108 {
3109 GET_CURRENT_CONTEXT(ctx);
3110 Node *n;
3111 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3112 n = alloc_instruction(ctx, OPCODE_LINE_STIPPLE, 2);
3113 if (n) {
3114 n[1].i = factor;
3115 n[2].us = pattern;
3116 }
3117 if (ctx->ExecuteFlag) {
3118 CALL_LineStipple(ctx->Exec, (factor, pattern));
3119 }
3120 }
3121
3122
3123 static void GLAPIENTRY
save_LineWidth(GLfloat width)3124 save_LineWidth(GLfloat width)
3125 {
3126 GET_CURRENT_CONTEXT(ctx);
3127 Node *n;
3128 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3129 n = alloc_instruction(ctx, OPCODE_LINE_WIDTH, 1);
3130 if (n) {
3131 n[1].f = width;
3132 }
3133 if (ctx->ExecuteFlag) {
3134 CALL_LineWidth(ctx->Exec, (width));
3135 }
3136 }
3137
3138
3139 static void GLAPIENTRY
save_ListBase(GLuint base)3140 save_ListBase(GLuint base)
3141 {
3142 GET_CURRENT_CONTEXT(ctx);
3143 Node *n;
3144 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3145 n = alloc_instruction(ctx, OPCODE_LIST_BASE, 1);
3146 if (n) {
3147 n[1].ui = base;
3148 }
3149 if (ctx->ExecuteFlag) {
3150 CALL_ListBase(ctx->Exec, (base));
3151 }
3152 }
3153
3154
3155 static void GLAPIENTRY
save_LoadIdentity(void)3156 save_LoadIdentity(void)
3157 {
3158 GET_CURRENT_CONTEXT(ctx);
3159 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3160 (void) alloc_instruction(ctx, OPCODE_LOAD_IDENTITY, 0);
3161 if (ctx->ExecuteFlag) {
3162 CALL_LoadIdentity(ctx->Exec, ());
3163 }
3164 }
3165
3166
3167 static void GLAPIENTRY
save_LoadMatrixf(const GLfloat * m)3168 save_LoadMatrixf(const GLfloat * m)
3169 {
3170 GET_CURRENT_CONTEXT(ctx);
3171 Node *n;
3172 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3173 n = alloc_instruction(ctx, OPCODE_LOAD_MATRIX, 16);
3174 if (n) {
3175 GLuint i;
3176 for (i = 0; i < 16; i++) {
3177 n[1 + i].f = m[i];
3178 }
3179 }
3180 if (ctx->ExecuteFlag) {
3181 CALL_LoadMatrixf(ctx->Exec, (m));
3182 }
3183 }
3184
3185
3186 static void GLAPIENTRY
save_LoadMatrixd(const GLdouble * m)3187 save_LoadMatrixd(const GLdouble * m)
3188 {
3189 GLfloat f[16];
3190 GLint i;
3191 for (i = 0; i < 16; i++) {
3192 f[i] = (GLfloat) m[i];
3193 }
3194 save_LoadMatrixf(f);
3195 }
3196
3197
3198 static void GLAPIENTRY
save_LoadName(GLuint name)3199 save_LoadName(GLuint name)
3200 {
3201 GET_CURRENT_CONTEXT(ctx);
3202 Node *n;
3203 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3204 n = alloc_instruction(ctx, OPCODE_LOAD_NAME, 1);
3205 if (n) {
3206 n[1].ui = name;
3207 }
3208 if (ctx->ExecuteFlag) {
3209 CALL_LoadName(ctx->Exec, (name));
3210 }
3211 }
3212
3213
3214 static void GLAPIENTRY
save_LogicOp(GLenum opcode)3215 save_LogicOp(GLenum opcode)
3216 {
3217 GET_CURRENT_CONTEXT(ctx);
3218 Node *n;
3219 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3220 n = alloc_instruction(ctx, OPCODE_LOGIC_OP, 1);
3221 if (n) {
3222 n[1].e = opcode;
3223 }
3224 if (ctx->ExecuteFlag) {
3225 CALL_LogicOp(ctx->Exec, (opcode));
3226 }
3227 }
3228
3229
3230 static void GLAPIENTRY
save_Map1d(GLenum target,GLdouble u1,GLdouble u2,GLint stride,GLint order,const GLdouble * points)3231 save_Map1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride,
3232 GLint order, const GLdouble * points)
3233 {
3234 GET_CURRENT_CONTEXT(ctx);
3235 Node *n;
3236 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3237 n = alloc_instruction(ctx, OPCODE_MAP1, 5 + POINTER_DWORDS);
3238 if (n) {
3239 GLfloat *pnts = _mesa_copy_map_points1d(target, stride, order, points);
3240 n[1].e = target;
3241 n[2].f = (GLfloat) u1;
3242 n[3].f = (GLfloat) u2;
3243 n[4].i = _mesa_evaluator_components(target); /* stride */
3244 n[5].i = order;
3245 save_pointer(&n[6], pnts);
3246 }
3247 if (ctx->ExecuteFlag) {
3248 CALL_Map1d(ctx->Exec, (target, u1, u2, stride, order, points));
3249 }
3250 }
3251
3252 static void GLAPIENTRY
save_Map1f(GLenum target,GLfloat u1,GLfloat u2,GLint stride,GLint order,const GLfloat * points)3253 save_Map1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride,
3254 GLint order, const GLfloat * points)
3255 {
3256 GET_CURRENT_CONTEXT(ctx);
3257 Node *n;
3258 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3259 n = alloc_instruction(ctx, OPCODE_MAP1, 5 + POINTER_DWORDS);
3260 if (n) {
3261 GLfloat *pnts = _mesa_copy_map_points1f(target, stride, order, points);
3262 n[1].e = target;
3263 n[2].f = u1;
3264 n[3].f = u2;
3265 n[4].i = _mesa_evaluator_components(target); /* stride */
3266 n[5].i = order;
3267 save_pointer(&n[6], pnts);
3268 }
3269 if (ctx->ExecuteFlag) {
3270 CALL_Map1f(ctx->Exec, (target, u1, u2, stride, order, points));
3271 }
3272 }
3273
3274
3275 static void GLAPIENTRY
save_Map2d(GLenum target,GLdouble u1,GLdouble u2,GLint ustride,GLint uorder,GLdouble v1,GLdouble v2,GLint vstride,GLint vorder,const GLdouble * points)3276 save_Map2d(GLenum target,
3277 GLdouble u1, GLdouble u2, GLint ustride, GLint uorder,
3278 GLdouble v1, GLdouble v2, GLint vstride, GLint vorder,
3279 const GLdouble * points)
3280 {
3281 GET_CURRENT_CONTEXT(ctx);
3282 Node *n;
3283 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3284 n = alloc_instruction(ctx, OPCODE_MAP2, 9 + POINTER_DWORDS);
3285 if (n) {
3286 GLfloat *pnts = _mesa_copy_map_points2d(target, ustride, uorder,
3287 vstride, vorder, points);
3288 n[1].e = target;
3289 n[2].f = (GLfloat) u1;
3290 n[3].f = (GLfloat) u2;
3291 n[4].f = (GLfloat) v1;
3292 n[5].f = (GLfloat) v2;
3293 /* XXX verify these strides are correct */
3294 n[6].i = _mesa_evaluator_components(target) * vorder; /*ustride */
3295 n[7].i = _mesa_evaluator_components(target); /*vstride */
3296 n[8].i = uorder;
3297 n[9].i = vorder;
3298 save_pointer(&n[10], pnts);
3299 }
3300 if (ctx->ExecuteFlag) {
3301 CALL_Map2d(ctx->Exec, (target,
3302 u1, u2, ustride, uorder,
3303 v1, v2, vstride, vorder, points));
3304 }
3305 }
3306
3307
3308 static void GLAPIENTRY
save_Map2f(GLenum target,GLfloat u1,GLfloat u2,GLint ustride,GLint uorder,GLfloat v1,GLfloat v2,GLint vstride,GLint vorder,const GLfloat * points)3309 save_Map2f(GLenum target,
3310 GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
3311 GLfloat v1, GLfloat v2, GLint vstride, GLint vorder,
3312 const GLfloat * points)
3313 {
3314 GET_CURRENT_CONTEXT(ctx);
3315 Node *n;
3316 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3317 n = alloc_instruction(ctx, OPCODE_MAP2, 9 + POINTER_DWORDS);
3318 if (n) {
3319 GLfloat *pnts = _mesa_copy_map_points2f(target, ustride, uorder,
3320 vstride, vorder, points);
3321 n[1].e = target;
3322 n[2].f = u1;
3323 n[3].f = u2;
3324 n[4].f = v1;
3325 n[5].f = v2;
3326 /* XXX verify these strides are correct */
3327 n[6].i = _mesa_evaluator_components(target) * vorder; /*ustride */
3328 n[7].i = _mesa_evaluator_components(target); /*vstride */
3329 n[8].i = uorder;
3330 n[9].i = vorder;
3331 save_pointer(&n[10], pnts);
3332 }
3333 if (ctx->ExecuteFlag) {
3334 CALL_Map2f(ctx->Exec, (target, u1, u2, ustride, uorder,
3335 v1, v2, vstride, vorder, points));
3336 }
3337 }
3338
3339
3340 static void GLAPIENTRY
save_MapGrid1f(GLint un,GLfloat u1,GLfloat u2)3341 save_MapGrid1f(GLint un, GLfloat u1, GLfloat u2)
3342 {
3343 GET_CURRENT_CONTEXT(ctx);
3344 Node *n;
3345 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3346 n = alloc_instruction(ctx, OPCODE_MAPGRID1, 3);
3347 if (n) {
3348 n[1].i = un;
3349 n[2].f = u1;
3350 n[3].f = u2;
3351 }
3352 if (ctx->ExecuteFlag) {
3353 CALL_MapGrid1f(ctx->Exec, (un, u1, u2));
3354 }
3355 }
3356
3357
3358 static void GLAPIENTRY
save_MapGrid1d(GLint un,GLdouble u1,GLdouble u2)3359 save_MapGrid1d(GLint un, GLdouble u1, GLdouble u2)
3360 {
3361 save_MapGrid1f(un, (GLfloat) u1, (GLfloat) u2);
3362 }
3363
3364
3365 static void GLAPIENTRY
save_MapGrid2f(GLint un,GLfloat u1,GLfloat u2,GLint vn,GLfloat v1,GLfloat v2)3366 save_MapGrid2f(GLint un, GLfloat u1, GLfloat u2,
3367 GLint vn, GLfloat v1, GLfloat v2)
3368 {
3369 GET_CURRENT_CONTEXT(ctx);
3370 Node *n;
3371 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3372 n = alloc_instruction(ctx, OPCODE_MAPGRID2, 6);
3373 if (n) {
3374 n[1].i = un;
3375 n[2].f = u1;
3376 n[3].f = u2;
3377 n[4].i = vn;
3378 n[5].f = v1;
3379 n[6].f = v2;
3380 }
3381 if (ctx->ExecuteFlag) {
3382 CALL_MapGrid2f(ctx->Exec, (un, u1, u2, vn, v1, v2));
3383 }
3384 }
3385
3386
3387
3388 static void GLAPIENTRY
save_MapGrid2d(GLint un,GLdouble u1,GLdouble u2,GLint vn,GLdouble v1,GLdouble v2)3389 save_MapGrid2d(GLint un, GLdouble u1, GLdouble u2,
3390 GLint vn, GLdouble v1, GLdouble v2)
3391 {
3392 save_MapGrid2f(un, (GLfloat) u1, (GLfloat) u2,
3393 vn, (GLfloat) v1, (GLfloat) v2);
3394 }
3395
3396
3397 static void GLAPIENTRY
save_MatrixMode(GLenum mode)3398 save_MatrixMode(GLenum mode)
3399 {
3400 GET_CURRENT_CONTEXT(ctx);
3401 Node *n;
3402 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3403 n = alloc_instruction(ctx, OPCODE_MATRIX_MODE, 1);
3404 if (n) {
3405 n[1].e = mode;
3406 }
3407 if (ctx->ExecuteFlag) {
3408 CALL_MatrixMode(ctx->Exec, (mode));
3409 }
3410 }
3411
3412
3413 static void GLAPIENTRY
save_MultMatrixf(const GLfloat * m)3414 save_MultMatrixf(const GLfloat * m)
3415 {
3416 GET_CURRENT_CONTEXT(ctx);
3417 Node *n;
3418 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3419 n = alloc_instruction(ctx, OPCODE_MULT_MATRIX, 16);
3420 if (n) {
3421 GLuint i;
3422 for (i = 0; i < 16; i++) {
3423 n[1 + i].f = m[i];
3424 }
3425 }
3426 if (ctx->ExecuteFlag) {
3427 CALL_MultMatrixf(ctx->Exec, (m));
3428 }
3429 }
3430
3431
3432 static void GLAPIENTRY
save_MultMatrixd(const GLdouble * m)3433 save_MultMatrixd(const GLdouble * m)
3434 {
3435 GLfloat f[16];
3436 GLint i;
3437 for (i = 0; i < 16; i++) {
3438 f[i] = (GLfloat) m[i];
3439 }
3440 save_MultMatrixf(f);
3441 }
3442
3443
3444 static void GLAPIENTRY
save_NewList(GLuint name,GLenum mode)3445 save_NewList(GLuint name, GLenum mode)
3446 {
3447 GET_CURRENT_CONTEXT(ctx);
3448 /* It's an error to call this function while building a display list */
3449 _mesa_error(ctx, GL_INVALID_OPERATION, "glNewList");
3450 (void) name;
3451 (void) mode;
3452 }
3453
3454
3455
3456 static void GLAPIENTRY
save_Ortho(GLdouble left,GLdouble right,GLdouble bottom,GLdouble top,GLdouble nearval,GLdouble farval)3457 save_Ortho(GLdouble left, GLdouble right,
3458 GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval)
3459 {
3460 GET_CURRENT_CONTEXT(ctx);
3461 Node *n;
3462 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3463 n = alloc_instruction(ctx, OPCODE_ORTHO, 6);
3464 if (n) {
3465 n[1].f = (GLfloat) left;
3466 n[2].f = (GLfloat) right;
3467 n[3].f = (GLfloat) bottom;
3468 n[4].f = (GLfloat) top;
3469 n[5].f = (GLfloat) nearval;
3470 n[6].f = (GLfloat) farval;
3471 }
3472 if (ctx->ExecuteFlag) {
3473 CALL_Ortho(ctx->Exec, (left, right, bottom, top, nearval, farval));
3474 }
3475 }
3476
3477
3478 static void GLAPIENTRY
save_PatchParameteri(GLenum pname,const GLint value)3479 save_PatchParameteri(GLenum pname, const GLint value)
3480 {
3481 GET_CURRENT_CONTEXT(ctx);
3482 Node *n;
3483 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3484 n = alloc_instruction(ctx, OPCODE_PATCH_PARAMETER_I, 2);
3485 if (n) {
3486 n[1].e = pname;
3487 n[2].i = value;
3488 }
3489 if (ctx->ExecuteFlag) {
3490 CALL_PatchParameteri(ctx->Exec, (pname, value));
3491 }
3492 }
3493
3494
3495 static void GLAPIENTRY
save_PatchParameterfv(GLenum pname,const GLfloat * params)3496 save_PatchParameterfv(GLenum pname, const GLfloat *params)
3497 {
3498 GET_CURRENT_CONTEXT(ctx);
3499 Node *n;
3500 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3501
3502 if (pname == GL_PATCH_DEFAULT_OUTER_LEVEL) {
3503 n = alloc_instruction(ctx, OPCODE_PATCH_PARAMETER_FV_OUTER, 5);
3504 } else {
3505 assert(pname == GL_PATCH_DEFAULT_INNER_LEVEL);
3506 n = alloc_instruction(ctx, OPCODE_PATCH_PARAMETER_FV_INNER, 3);
3507 }
3508 if (n) {
3509 n[1].e = pname;
3510 if (pname == GL_PATCH_DEFAULT_OUTER_LEVEL) {
3511 n[2].f = params[0];
3512 n[3].f = params[1];
3513 n[4].f = params[2];
3514 n[5].f = params[3];
3515 } else {
3516 n[2].f = params[0];
3517 n[3].f = params[1];
3518 }
3519 }
3520 if (ctx->ExecuteFlag) {
3521 CALL_PatchParameterfv(ctx->Exec, (pname, params));
3522 }
3523 }
3524
3525
3526 static void GLAPIENTRY
save_PixelMapfv(GLenum map,GLint mapsize,const GLfloat * values)3527 save_PixelMapfv(GLenum map, GLint mapsize, const GLfloat *values)
3528 {
3529 GET_CURRENT_CONTEXT(ctx);
3530 Node *n;
3531 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3532 n = alloc_instruction(ctx, OPCODE_PIXEL_MAP, 2 + POINTER_DWORDS);
3533 if (n) {
3534 n[1].e = map;
3535 n[2].i = mapsize;
3536 save_pointer(&n[3], memdup(values, mapsize * sizeof(GLfloat)));
3537 }
3538 if (ctx->ExecuteFlag) {
3539 CALL_PixelMapfv(ctx->Exec, (map, mapsize, values));
3540 }
3541 }
3542
3543
3544 static void GLAPIENTRY
save_PixelMapuiv(GLenum map,GLint mapsize,const GLuint * values)3545 save_PixelMapuiv(GLenum map, GLint mapsize, const GLuint *values)
3546 {
3547 GLfloat fvalues[MAX_PIXEL_MAP_TABLE];
3548 GLint i;
3549 if (map == GL_PIXEL_MAP_I_TO_I || map == GL_PIXEL_MAP_S_TO_S) {
3550 for (i = 0; i < mapsize; i++) {
3551 fvalues[i] = (GLfloat) values[i];
3552 }
3553 }
3554 else {
3555 for (i = 0; i < mapsize; i++) {
3556 fvalues[i] = UINT_TO_FLOAT(values[i]);
3557 }
3558 }
3559 save_PixelMapfv(map, mapsize, fvalues);
3560 }
3561
3562
3563 static void GLAPIENTRY
save_PixelMapusv(GLenum map,GLint mapsize,const GLushort * values)3564 save_PixelMapusv(GLenum map, GLint mapsize, const GLushort *values)
3565 {
3566 GLfloat fvalues[MAX_PIXEL_MAP_TABLE];
3567 GLint i;
3568 if (map == GL_PIXEL_MAP_I_TO_I || map == GL_PIXEL_MAP_S_TO_S) {
3569 for (i = 0; i < mapsize; i++) {
3570 fvalues[i] = (GLfloat) values[i];
3571 }
3572 }
3573 else {
3574 for (i = 0; i < mapsize; i++) {
3575 fvalues[i] = USHORT_TO_FLOAT(values[i]);
3576 }
3577 }
3578 save_PixelMapfv(map, mapsize, fvalues);
3579 }
3580
3581
3582 static void GLAPIENTRY
save_PixelTransferf(GLenum pname,GLfloat param)3583 save_PixelTransferf(GLenum pname, GLfloat param)
3584 {
3585 GET_CURRENT_CONTEXT(ctx);
3586 Node *n;
3587 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3588 n = alloc_instruction(ctx, OPCODE_PIXEL_TRANSFER, 2);
3589 if (n) {
3590 n[1].e = pname;
3591 n[2].f = param;
3592 }
3593 if (ctx->ExecuteFlag) {
3594 CALL_PixelTransferf(ctx->Exec, (pname, param));
3595 }
3596 }
3597
3598
3599 static void GLAPIENTRY
save_PixelTransferi(GLenum pname,GLint param)3600 save_PixelTransferi(GLenum pname, GLint param)
3601 {
3602 save_PixelTransferf(pname, (GLfloat) param);
3603 }
3604
3605
3606 static void GLAPIENTRY
save_PixelZoom(GLfloat xfactor,GLfloat yfactor)3607 save_PixelZoom(GLfloat xfactor, GLfloat yfactor)
3608 {
3609 GET_CURRENT_CONTEXT(ctx);
3610 Node *n;
3611 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3612 n = alloc_instruction(ctx, OPCODE_PIXEL_ZOOM, 2);
3613 if (n) {
3614 n[1].f = xfactor;
3615 n[2].f = yfactor;
3616 }
3617 if (ctx->ExecuteFlag) {
3618 CALL_PixelZoom(ctx->Exec, (xfactor, yfactor));
3619 }
3620 }
3621
3622
3623 static void GLAPIENTRY
save_PointParameterfvEXT(GLenum pname,const GLfloat * params)3624 save_PointParameterfvEXT(GLenum pname, const GLfloat *params)
3625 {
3626 GET_CURRENT_CONTEXT(ctx);
3627 Node *n;
3628 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3629 n = alloc_instruction(ctx, OPCODE_POINT_PARAMETERS, 4);
3630 if (n) {
3631 n[1].e = pname;
3632 n[2].f = params[0];
3633 n[3].f = params[1];
3634 n[4].f = params[2];
3635 }
3636 if (ctx->ExecuteFlag) {
3637 CALL_PointParameterfv(ctx->Exec, (pname, params));
3638 }
3639 }
3640
3641
3642 static void GLAPIENTRY
save_PointParameterfEXT(GLenum pname,GLfloat param)3643 save_PointParameterfEXT(GLenum pname, GLfloat param)
3644 {
3645 GLfloat parray[3];
3646 parray[0] = param;
3647 parray[1] = parray[2] = 0.0F;
3648 save_PointParameterfvEXT(pname, parray);
3649 }
3650
3651 static void GLAPIENTRY
save_PointParameteri(GLenum pname,GLint param)3652 save_PointParameteri(GLenum pname, GLint param)
3653 {
3654 GLfloat parray[3];
3655 parray[0] = (GLfloat) param;
3656 parray[1] = parray[2] = 0.0F;
3657 save_PointParameterfvEXT(pname, parray);
3658 }
3659
3660 static void GLAPIENTRY
save_PointParameteriv(GLenum pname,const GLint * param)3661 save_PointParameteriv(GLenum pname, const GLint * param)
3662 {
3663 GLfloat parray[3];
3664 parray[0] = (GLfloat) param[0];
3665 parray[1] = parray[2] = 0.0F;
3666 save_PointParameterfvEXT(pname, parray);
3667 }
3668
3669
3670 static void GLAPIENTRY
save_PointSize(GLfloat size)3671 save_PointSize(GLfloat size)
3672 {
3673 GET_CURRENT_CONTEXT(ctx);
3674 Node *n;
3675 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3676 n = alloc_instruction(ctx, OPCODE_POINT_SIZE, 1);
3677 if (n) {
3678 n[1].f = size;
3679 }
3680 if (ctx->ExecuteFlag) {
3681 CALL_PointSize(ctx->Exec, (size));
3682 }
3683 }
3684
3685
3686 static void GLAPIENTRY
save_PolygonMode(GLenum face,GLenum mode)3687 save_PolygonMode(GLenum face, GLenum mode)
3688 {
3689 GET_CURRENT_CONTEXT(ctx);
3690 Node *n;
3691 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3692 n = alloc_instruction(ctx, OPCODE_POLYGON_MODE, 2);
3693 if (n) {
3694 n[1].e = face;
3695 n[2].e = mode;
3696 }
3697 if (ctx->ExecuteFlag) {
3698 CALL_PolygonMode(ctx->Exec, (face, mode));
3699 }
3700 }
3701
3702
3703 static void GLAPIENTRY
save_PolygonStipple(const GLubyte * pattern)3704 save_PolygonStipple(const GLubyte * pattern)
3705 {
3706 GET_CURRENT_CONTEXT(ctx);
3707 Node *n;
3708
3709 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3710
3711 n = alloc_instruction(ctx, OPCODE_POLYGON_STIPPLE, POINTER_DWORDS);
3712 if (n) {
3713 save_pointer(&n[1],
3714 unpack_image(ctx, 2, 32, 32, 1, GL_COLOR_INDEX, GL_BITMAP,
3715 pattern, &ctx->Unpack));
3716 }
3717 if (ctx->ExecuteFlag) {
3718 CALL_PolygonStipple(ctx->Exec, ((GLubyte *) pattern));
3719 }
3720 }
3721
3722
3723 static void GLAPIENTRY
save_PolygonOffset(GLfloat factor,GLfloat units)3724 save_PolygonOffset(GLfloat factor, GLfloat units)
3725 {
3726 GET_CURRENT_CONTEXT(ctx);
3727 Node *n;
3728 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3729 n = alloc_instruction(ctx, OPCODE_POLYGON_OFFSET, 2);
3730 if (n) {
3731 n[1].f = factor;
3732 n[2].f = units;
3733 }
3734 if (ctx->ExecuteFlag) {
3735 CALL_PolygonOffset(ctx->Exec, (factor, units));
3736 }
3737 }
3738
3739
3740 static void GLAPIENTRY
save_PolygonOffsetClampEXT(GLfloat factor,GLfloat units,GLfloat clamp)3741 save_PolygonOffsetClampEXT(GLfloat factor, GLfloat units, GLfloat clamp)
3742 {
3743 GET_CURRENT_CONTEXT(ctx);
3744 Node *n;
3745 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3746 n = alloc_instruction(ctx, OPCODE_POLYGON_OFFSET_CLAMP, 3);
3747 if (n) {
3748 n[1].f = factor;
3749 n[2].f = units;
3750 n[3].f = clamp;
3751 }
3752 if (ctx->ExecuteFlag) {
3753 CALL_PolygonOffsetClampEXT(ctx->Exec, (factor, units, clamp));
3754 }
3755 }
3756
3757 static void GLAPIENTRY
save_PopAttrib(void)3758 save_PopAttrib(void)
3759 {
3760 GET_CURRENT_CONTEXT(ctx);
3761 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3762 (void) alloc_instruction(ctx, OPCODE_POP_ATTRIB, 0);
3763 if (ctx->ExecuteFlag) {
3764 CALL_PopAttrib(ctx->Exec, ());
3765 }
3766 }
3767
3768
3769 static void GLAPIENTRY
save_PopMatrix(void)3770 save_PopMatrix(void)
3771 {
3772 GET_CURRENT_CONTEXT(ctx);
3773 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3774 (void) alloc_instruction(ctx, OPCODE_POP_MATRIX, 0);
3775 if (ctx->ExecuteFlag) {
3776 CALL_PopMatrix(ctx->Exec, ());
3777 }
3778 }
3779
3780
3781 static void GLAPIENTRY
save_PopName(void)3782 save_PopName(void)
3783 {
3784 GET_CURRENT_CONTEXT(ctx);
3785 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3786 (void) alloc_instruction(ctx, OPCODE_POP_NAME, 0);
3787 if (ctx->ExecuteFlag) {
3788 CALL_PopName(ctx->Exec, ());
3789 }
3790 }
3791
3792
3793 static void GLAPIENTRY
save_PrioritizeTextures(GLsizei num,const GLuint * textures,const GLclampf * priorities)3794 save_PrioritizeTextures(GLsizei num, const GLuint * textures,
3795 const GLclampf * priorities)
3796 {
3797 GET_CURRENT_CONTEXT(ctx);
3798 GLint i;
3799 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3800
3801 for (i = 0; i < num; i++) {
3802 Node *n;
3803 n = alloc_instruction(ctx, OPCODE_PRIORITIZE_TEXTURE, 2);
3804 if (n) {
3805 n[1].ui = textures[i];
3806 n[2].f = priorities[i];
3807 }
3808 }
3809 if (ctx->ExecuteFlag) {
3810 CALL_PrioritizeTextures(ctx->Exec, (num, textures, priorities));
3811 }
3812 }
3813
3814
3815 static void GLAPIENTRY
save_PushAttrib(GLbitfield mask)3816 save_PushAttrib(GLbitfield mask)
3817 {
3818 GET_CURRENT_CONTEXT(ctx);
3819 Node *n;
3820 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3821 n = alloc_instruction(ctx, OPCODE_PUSH_ATTRIB, 1);
3822 if (n) {
3823 n[1].bf = mask;
3824 }
3825 if (ctx->ExecuteFlag) {
3826 CALL_PushAttrib(ctx->Exec, (mask));
3827 }
3828 }
3829
3830
3831 static void GLAPIENTRY
save_PushMatrix(void)3832 save_PushMatrix(void)
3833 {
3834 GET_CURRENT_CONTEXT(ctx);
3835 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3836 (void) alloc_instruction(ctx, OPCODE_PUSH_MATRIX, 0);
3837 if (ctx->ExecuteFlag) {
3838 CALL_PushMatrix(ctx->Exec, ());
3839 }
3840 }
3841
3842
3843 static void GLAPIENTRY
save_PushName(GLuint name)3844 save_PushName(GLuint name)
3845 {
3846 GET_CURRENT_CONTEXT(ctx);
3847 Node *n;
3848 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3849 n = alloc_instruction(ctx, OPCODE_PUSH_NAME, 1);
3850 if (n) {
3851 n[1].ui = name;
3852 }
3853 if (ctx->ExecuteFlag) {
3854 CALL_PushName(ctx->Exec, (name));
3855 }
3856 }
3857
3858
3859 static void GLAPIENTRY
save_RasterPos4f(GLfloat x,GLfloat y,GLfloat z,GLfloat w)3860 save_RasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
3861 {
3862 GET_CURRENT_CONTEXT(ctx);
3863 Node *n;
3864 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3865 n = alloc_instruction(ctx, OPCODE_RASTER_POS, 4);
3866 if (n) {
3867 n[1].f = x;
3868 n[2].f = y;
3869 n[3].f = z;
3870 n[4].f = w;
3871 }
3872 if (ctx->ExecuteFlag) {
3873 CALL_RasterPos4f(ctx->Exec, (x, y, z, w));
3874 }
3875 }
3876
3877 static void GLAPIENTRY
save_RasterPos2d(GLdouble x,GLdouble y)3878 save_RasterPos2d(GLdouble x, GLdouble y)
3879 {
3880 save_RasterPos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
3881 }
3882
3883 static void GLAPIENTRY
save_RasterPos2f(GLfloat x,GLfloat y)3884 save_RasterPos2f(GLfloat x, GLfloat y)
3885 {
3886 save_RasterPos4f(x, y, 0.0F, 1.0F);
3887 }
3888
3889 static void GLAPIENTRY
save_RasterPos2i(GLint x,GLint y)3890 save_RasterPos2i(GLint x, GLint y)
3891 {
3892 save_RasterPos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
3893 }
3894
3895 static void GLAPIENTRY
save_RasterPos2s(GLshort x,GLshort y)3896 save_RasterPos2s(GLshort x, GLshort y)
3897 {
3898 save_RasterPos4f(x, y, 0.0F, 1.0F);
3899 }
3900
3901 static void GLAPIENTRY
save_RasterPos3d(GLdouble x,GLdouble y,GLdouble z)3902 save_RasterPos3d(GLdouble x, GLdouble y, GLdouble z)
3903 {
3904 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
3905 }
3906
3907 static void GLAPIENTRY
save_RasterPos3f(GLfloat x,GLfloat y,GLfloat z)3908 save_RasterPos3f(GLfloat x, GLfloat y, GLfloat z)
3909 {
3910 save_RasterPos4f(x, y, z, 1.0F);
3911 }
3912
3913 static void GLAPIENTRY
save_RasterPos3i(GLint x,GLint y,GLint z)3914 save_RasterPos3i(GLint x, GLint y, GLint z)
3915 {
3916 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
3917 }
3918
3919 static void GLAPIENTRY
save_RasterPos3s(GLshort x,GLshort y,GLshort z)3920 save_RasterPos3s(GLshort x, GLshort y, GLshort z)
3921 {
3922 save_RasterPos4f(x, y, z, 1.0F);
3923 }
3924
3925 static void GLAPIENTRY
save_RasterPos4d(GLdouble x,GLdouble y,GLdouble z,GLdouble w)3926 save_RasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
3927 {
3928 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
3929 }
3930
3931 static void GLAPIENTRY
save_RasterPos4i(GLint x,GLint y,GLint z,GLint w)3932 save_RasterPos4i(GLint x, GLint y, GLint z, GLint w)
3933 {
3934 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
3935 }
3936
3937 static void GLAPIENTRY
save_RasterPos4s(GLshort x,GLshort y,GLshort z,GLshort w)3938 save_RasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w)
3939 {
3940 save_RasterPos4f(x, y, z, w);
3941 }
3942
3943 static void GLAPIENTRY
save_RasterPos2dv(const GLdouble * v)3944 save_RasterPos2dv(const GLdouble * v)
3945 {
3946 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
3947 }
3948
3949 static void GLAPIENTRY
save_RasterPos2fv(const GLfloat * v)3950 save_RasterPos2fv(const GLfloat * v)
3951 {
3952 save_RasterPos4f(v[0], v[1], 0.0F, 1.0F);
3953 }
3954
3955 static void GLAPIENTRY
save_RasterPos2iv(const GLint * v)3956 save_RasterPos2iv(const GLint * v)
3957 {
3958 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
3959 }
3960
3961 static void GLAPIENTRY
save_RasterPos2sv(const GLshort * v)3962 save_RasterPos2sv(const GLshort * v)
3963 {
3964 save_RasterPos4f(v[0], v[1], 0.0F, 1.0F);
3965 }
3966
3967 static void GLAPIENTRY
save_RasterPos3dv(const GLdouble * v)3968 save_RasterPos3dv(const GLdouble * v)
3969 {
3970 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
3971 }
3972
3973 static void GLAPIENTRY
save_RasterPos3fv(const GLfloat * v)3974 save_RasterPos3fv(const GLfloat * v)
3975 {
3976 save_RasterPos4f(v[0], v[1], v[2], 1.0F);
3977 }
3978
3979 static void GLAPIENTRY
save_RasterPos3iv(const GLint * v)3980 save_RasterPos3iv(const GLint * v)
3981 {
3982 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
3983 }
3984
3985 static void GLAPIENTRY
save_RasterPos3sv(const GLshort * v)3986 save_RasterPos3sv(const GLshort * v)
3987 {
3988 save_RasterPos4f(v[0], v[1], v[2], 1.0F);
3989 }
3990
3991 static void GLAPIENTRY
save_RasterPos4dv(const GLdouble * v)3992 save_RasterPos4dv(const GLdouble * v)
3993 {
3994 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1],
3995 (GLfloat) v[2], (GLfloat) v[3]);
3996 }
3997
3998 static void GLAPIENTRY
save_RasterPos4fv(const GLfloat * v)3999 save_RasterPos4fv(const GLfloat * v)
4000 {
4001 save_RasterPos4f(v[0], v[1], v[2], v[3]);
4002 }
4003
4004 static void GLAPIENTRY
save_RasterPos4iv(const GLint * v)4005 save_RasterPos4iv(const GLint * v)
4006 {
4007 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1],
4008 (GLfloat) v[2], (GLfloat) v[3]);
4009 }
4010
4011 static void GLAPIENTRY
save_RasterPos4sv(const GLshort * v)4012 save_RasterPos4sv(const GLshort * v)
4013 {
4014 save_RasterPos4f(v[0], v[1], v[2], v[3]);
4015 }
4016
4017
4018 static void GLAPIENTRY
save_PassThrough(GLfloat token)4019 save_PassThrough(GLfloat token)
4020 {
4021 GET_CURRENT_CONTEXT(ctx);
4022 Node *n;
4023 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4024 n = alloc_instruction(ctx, OPCODE_PASSTHROUGH, 1);
4025 if (n) {
4026 n[1].f = token;
4027 }
4028 if (ctx->ExecuteFlag) {
4029 CALL_PassThrough(ctx->Exec, (token));
4030 }
4031 }
4032
4033
4034 static void GLAPIENTRY
save_ReadBuffer(GLenum mode)4035 save_ReadBuffer(GLenum mode)
4036 {
4037 GET_CURRENT_CONTEXT(ctx);
4038 Node *n;
4039 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4040 n = alloc_instruction(ctx, OPCODE_READ_BUFFER, 1);
4041 if (n) {
4042 n[1].e = mode;
4043 }
4044 if (ctx->ExecuteFlag) {
4045 CALL_ReadBuffer(ctx->Exec, (mode));
4046 }
4047 }
4048
4049
4050 static void GLAPIENTRY
save_Rotatef(GLfloat angle,GLfloat x,GLfloat y,GLfloat z)4051 save_Rotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
4052 {
4053 GET_CURRENT_CONTEXT(ctx);
4054 Node *n;
4055 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4056 n = alloc_instruction(ctx, OPCODE_ROTATE, 4);
4057 if (n) {
4058 n[1].f = angle;
4059 n[2].f = x;
4060 n[3].f = y;
4061 n[4].f = z;
4062 }
4063 if (ctx->ExecuteFlag) {
4064 CALL_Rotatef(ctx->Exec, (angle, x, y, z));
4065 }
4066 }
4067
4068
4069 static void GLAPIENTRY
save_Rotated(GLdouble angle,GLdouble x,GLdouble y,GLdouble z)4070 save_Rotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
4071 {
4072 save_Rotatef((GLfloat) angle, (GLfloat) x, (GLfloat) y, (GLfloat) z);
4073 }
4074
4075
4076 static void GLAPIENTRY
save_Scalef(GLfloat x,GLfloat y,GLfloat z)4077 save_Scalef(GLfloat x, GLfloat y, GLfloat z)
4078 {
4079 GET_CURRENT_CONTEXT(ctx);
4080 Node *n;
4081 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4082 n = alloc_instruction(ctx, OPCODE_SCALE, 3);
4083 if (n) {
4084 n[1].f = x;
4085 n[2].f = y;
4086 n[3].f = z;
4087 }
4088 if (ctx->ExecuteFlag) {
4089 CALL_Scalef(ctx->Exec, (x, y, z));
4090 }
4091 }
4092
4093
4094 static void GLAPIENTRY
save_Scaled(GLdouble x,GLdouble y,GLdouble z)4095 save_Scaled(GLdouble x, GLdouble y, GLdouble z)
4096 {
4097 save_Scalef((GLfloat) x, (GLfloat) y, (GLfloat) z);
4098 }
4099
4100
4101 static void GLAPIENTRY
save_Scissor(GLint x,GLint y,GLsizei width,GLsizei height)4102 save_Scissor(GLint x, GLint y, GLsizei width, GLsizei height)
4103 {
4104 GET_CURRENT_CONTEXT(ctx);
4105 Node *n;
4106 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4107 n = alloc_instruction(ctx, OPCODE_SCISSOR, 4);
4108 if (n) {
4109 n[1].i = x;
4110 n[2].i = y;
4111 n[3].i = width;
4112 n[4].i = height;
4113 }
4114 if (ctx->ExecuteFlag) {
4115 CALL_Scissor(ctx->Exec, (x, y, width, height));
4116 }
4117 }
4118
4119
4120 static void GLAPIENTRY
save_ShadeModel(GLenum mode)4121 save_ShadeModel(GLenum mode)
4122 {
4123 GET_CURRENT_CONTEXT(ctx);
4124 Node *n;
4125 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx);
4126
4127 if (ctx->ExecuteFlag) {
4128 CALL_ShadeModel(ctx->Exec, (mode));
4129 }
4130
4131 /* Don't compile this call if it's a no-op.
4132 * By avoiding this state change we have a better chance of
4133 * coalescing subsequent drawing commands into one batch.
4134 */
4135 if (ctx->ListState.Current.ShadeModel == mode)
4136 return;
4137
4138 SAVE_FLUSH_VERTICES(ctx);
4139
4140 ctx->ListState.Current.ShadeModel = mode;
4141
4142 n = alloc_instruction(ctx, OPCODE_SHADE_MODEL, 1);
4143 if (n) {
4144 n[1].e = mode;
4145 }
4146 }
4147
4148
4149 static void GLAPIENTRY
save_StencilFunc(GLenum func,GLint ref,GLuint mask)4150 save_StencilFunc(GLenum func, GLint ref, GLuint mask)
4151 {
4152 GET_CURRENT_CONTEXT(ctx);
4153 Node *n;
4154 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4155 n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC, 3);
4156 if (n) {
4157 n[1].e = func;
4158 n[2].i = ref;
4159 n[3].ui = mask;
4160 }
4161 if (ctx->ExecuteFlag) {
4162 CALL_StencilFunc(ctx->Exec, (func, ref, mask));
4163 }
4164 }
4165
4166
4167 static void GLAPIENTRY
save_StencilMask(GLuint mask)4168 save_StencilMask(GLuint mask)
4169 {
4170 GET_CURRENT_CONTEXT(ctx);
4171 Node *n;
4172 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4173 n = alloc_instruction(ctx, OPCODE_STENCIL_MASK, 1);
4174 if (n) {
4175 n[1].ui = mask;
4176 }
4177 if (ctx->ExecuteFlag) {
4178 CALL_StencilMask(ctx->Exec, (mask));
4179 }
4180 }
4181
4182
4183 static void GLAPIENTRY
save_StencilOp(GLenum fail,GLenum zfail,GLenum zpass)4184 save_StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
4185 {
4186 GET_CURRENT_CONTEXT(ctx);
4187 Node *n;
4188 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4189 n = alloc_instruction(ctx, OPCODE_STENCIL_OP, 3);
4190 if (n) {
4191 n[1].e = fail;
4192 n[2].e = zfail;
4193 n[3].e = zpass;
4194 }
4195 if (ctx->ExecuteFlag) {
4196 CALL_StencilOp(ctx->Exec, (fail, zfail, zpass));
4197 }
4198 }
4199
4200
4201 static void GLAPIENTRY
save_StencilFuncSeparate(GLenum face,GLenum func,GLint ref,GLuint mask)4202 save_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
4203 {
4204 GET_CURRENT_CONTEXT(ctx);
4205 Node *n;
4206 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4207 n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4);
4208 if (n) {
4209 n[1].e = face;
4210 n[2].e = func;
4211 n[3].i = ref;
4212 n[4].ui = mask;
4213 }
4214 if (ctx->ExecuteFlag) {
4215 CALL_StencilFuncSeparate(ctx->Exec, (face, func, ref, mask));
4216 }
4217 }
4218
4219
4220 static void GLAPIENTRY
save_StencilFuncSeparateATI(GLenum frontfunc,GLenum backfunc,GLint ref,GLuint mask)4221 save_StencilFuncSeparateATI(GLenum frontfunc, GLenum backfunc, GLint ref,
4222 GLuint mask)
4223 {
4224 GET_CURRENT_CONTEXT(ctx);
4225 Node *n;
4226 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4227 /* GL_FRONT */
4228 n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4);
4229 if (n) {
4230 n[1].e = GL_FRONT;
4231 n[2].e = frontfunc;
4232 n[3].i = ref;
4233 n[4].ui = mask;
4234 }
4235 /* GL_BACK */
4236 n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4);
4237 if (n) {
4238 n[1].e = GL_BACK;
4239 n[2].e = backfunc;
4240 n[3].i = ref;
4241 n[4].ui = mask;
4242 }
4243 if (ctx->ExecuteFlag) {
4244 CALL_StencilFuncSeparate(ctx->Exec, (GL_FRONT, frontfunc, ref, mask));
4245 CALL_StencilFuncSeparate(ctx->Exec, (GL_BACK, backfunc, ref, mask));
4246 }
4247 }
4248
4249
4250 static void GLAPIENTRY
save_StencilMaskSeparate(GLenum face,GLuint mask)4251 save_StencilMaskSeparate(GLenum face, GLuint mask)
4252 {
4253 GET_CURRENT_CONTEXT(ctx);
4254 Node *n;
4255 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4256 n = alloc_instruction(ctx, OPCODE_STENCIL_MASK_SEPARATE, 2);
4257 if (n) {
4258 n[1].e = face;
4259 n[2].ui = mask;
4260 }
4261 if (ctx->ExecuteFlag) {
4262 CALL_StencilMaskSeparate(ctx->Exec, (face, mask));
4263 }
4264 }
4265
4266
4267 static void GLAPIENTRY
save_StencilOpSeparate(GLenum face,GLenum fail,GLenum zfail,GLenum zpass)4268 save_StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
4269 {
4270 GET_CURRENT_CONTEXT(ctx);
4271 Node *n;
4272 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4273 n = alloc_instruction(ctx, OPCODE_STENCIL_OP_SEPARATE, 4);
4274 if (n) {
4275 n[1].e = face;
4276 n[2].e = fail;
4277 n[3].e = zfail;
4278 n[4].e = zpass;
4279 }
4280 if (ctx->ExecuteFlag) {
4281 CALL_StencilOpSeparate(ctx->Exec, (face, fail, zfail, zpass));
4282 }
4283 }
4284
4285
4286 static void GLAPIENTRY
save_TexEnvfv(GLenum target,GLenum pname,const GLfloat * params)4287 save_TexEnvfv(GLenum target, GLenum pname, const GLfloat *params)
4288 {
4289 GET_CURRENT_CONTEXT(ctx);
4290 Node *n;
4291 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4292 n = alloc_instruction(ctx, OPCODE_TEXENV, 6);
4293 if (n) {
4294 n[1].e = target;
4295 n[2].e = pname;
4296 if (pname == GL_TEXTURE_ENV_COLOR) {
4297 n[3].f = params[0];
4298 n[4].f = params[1];
4299 n[5].f = params[2];
4300 n[6].f = params[3];
4301 }
4302 else {
4303 n[3].f = params[0];
4304 n[4].f = n[5].f = n[6].f = 0.0F;
4305 }
4306 }
4307 if (ctx->ExecuteFlag) {
4308 CALL_TexEnvfv(ctx->Exec, (target, pname, params));
4309 }
4310 }
4311
4312
4313 static void GLAPIENTRY
save_TexEnvf(GLenum target,GLenum pname,GLfloat param)4314 save_TexEnvf(GLenum target, GLenum pname, GLfloat param)
4315 {
4316 GLfloat parray[4];
4317 parray[0] = (GLfloat) param;
4318 parray[1] = parray[2] = parray[3] = 0.0F;
4319 save_TexEnvfv(target, pname, parray);
4320 }
4321
4322
4323 static void GLAPIENTRY
save_TexEnvi(GLenum target,GLenum pname,GLint param)4324 save_TexEnvi(GLenum target, GLenum pname, GLint param)
4325 {
4326 GLfloat p[4];
4327 p[0] = (GLfloat) param;
4328 p[1] = p[2] = p[3] = 0.0F;
4329 save_TexEnvfv(target, pname, p);
4330 }
4331
4332
4333 static void GLAPIENTRY
save_TexEnviv(GLenum target,GLenum pname,const GLint * param)4334 save_TexEnviv(GLenum target, GLenum pname, const GLint * param)
4335 {
4336 GLfloat p[4];
4337 if (pname == GL_TEXTURE_ENV_COLOR) {
4338 p[0] = INT_TO_FLOAT(param[0]);
4339 p[1] = INT_TO_FLOAT(param[1]);
4340 p[2] = INT_TO_FLOAT(param[2]);
4341 p[3] = INT_TO_FLOAT(param[3]);
4342 }
4343 else {
4344 p[0] = (GLfloat) param[0];
4345 p[1] = p[2] = p[3] = 0.0F;
4346 }
4347 save_TexEnvfv(target, pname, p);
4348 }
4349
4350
4351 static void GLAPIENTRY
save_TexGenfv(GLenum coord,GLenum pname,const GLfloat * params)4352 save_TexGenfv(GLenum coord, GLenum pname, const GLfloat *params)
4353 {
4354 GET_CURRENT_CONTEXT(ctx);
4355 Node *n;
4356 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4357 n = alloc_instruction(ctx, OPCODE_TEXGEN, 6);
4358 if (n) {
4359 n[1].e = coord;
4360 n[2].e = pname;
4361 n[3].f = params[0];
4362 n[4].f = params[1];
4363 n[5].f = params[2];
4364 n[6].f = params[3];
4365 }
4366 if (ctx->ExecuteFlag) {
4367 CALL_TexGenfv(ctx->Exec, (coord, pname, params));
4368 }
4369 }
4370
4371
4372 static void GLAPIENTRY
save_TexGeniv(GLenum coord,GLenum pname,const GLint * params)4373 save_TexGeniv(GLenum coord, GLenum pname, const GLint *params)
4374 {
4375 GLfloat p[4];
4376 p[0] = (GLfloat) params[0];
4377 p[1] = (GLfloat) params[1];
4378 p[2] = (GLfloat) params[2];
4379 p[3] = (GLfloat) params[3];
4380 save_TexGenfv(coord, pname, p);
4381 }
4382
4383
4384 static void GLAPIENTRY
save_TexGend(GLenum coord,GLenum pname,GLdouble param)4385 save_TexGend(GLenum coord, GLenum pname, GLdouble param)
4386 {
4387 GLfloat parray[4];
4388 parray[0] = (GLfloat) param;
4389 parray[1] = parray[2] = parray[3] = 0.0F;
4390 save_TexGenfv(coord, pname, parray);
4391 }
4392
4393
4394 static void GLAPIENTRY
save_TexGendv(GLenum coord,GLenum pname,const GLdouble * params)4395 save_TexGendv(GLenum coord, GLenum pname, const GLdouble *params)
4396 {
4397 GLfloat p[4];
4398 p[0] = (GLfloat) params[0];
4399 p[1] = (GLfloat) params[1];
4400 p[2] = (GLfloat) params[2];
4401 p[3] = (GLfloat) params[3];
4402 save_TexGenfv(coord, pname, p);
4403 }
4404
4405
4406 static void GLAPIENTRY
save_TexGenf(GLenum coord,GLenum pname,GLfloat param)4407 save_TexGenf(GLenum coord, GLenum pname, GLfloat param)
4408 {
4409 GLfloat parray[4];
4410 parray[0] = param;
4411 parray[1] = parray[2] = parray[3] = 0.0F;
4412 save_TexGenfv(coord, pname, parray);
4413 }
4414
4415
4416 static void GLAPIENTRY
save_TexGeni(GLenum coord,GLenum pname,GLint param)4417 save_TexGeni(GLenum coord, GLenum pname, GLint param)
4418 {
4419 GLint parray[4];
4420 parray[0] = param;
4421 parray[1] = parray[2] = parray[3] = 0;
4422 save_TexGeniv(coord, pname, parray);
4423 }
4424
4425
4426 static void GLAPIENTRY
save_TexParameterfv(GLenum target,GLenum pname,const GLfloat * params)4427 save_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
4428 {
4429 GET_CURRENT_CONTEXT(ctx);
4430 Node *n;
4431 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4432 n = alloc_instruction(ctx, OPCODE_TEXPARAMETER, 6);
4433 if (n) {
4434 n[1].e = target;
4435 n[2].e = pname;
4436 n[3].f = params[0];
4437 n[4].f = params[1];
4438 n[5].f = params[2];
4439 n[6].f = params[3];
4440 }
4441 if (ctx->ExecuteFlag) {
4442 CALL_TexParameterfv(ctx->Exec, (target, pname, params));
4443 }
4444 }
4445
4446
4447 static void GLAPIENTRY
save_TexParameterf(GLenum target,GLenum pname,GLfloat param)4448 save_TexParameterf(GLenum target, GLenum pname, GLfloat param)
4449 {
4450 GLfloat parray[4];
4451 parray[0] = param;
4452 parray[1] = parray[2] = parray[3] = 0.0F;
4453 save_TexParameterfv(target, pname, parray);
4454 }
4455
4456
4457 static void GLAPIENTRY
save_TexParameteri(GLenum target,GLenum pname,GLint param)4458 save_TexParameteri(GLenum target, GLenum pname, GLint param)
4459 {
4460 GLfloat fparam[4];
4461 fparam[0] = (GLfloat) param;
4462 fparam[1] = fparam[2] = fparam[3] = 0.0F;
4463 save_TexParameterfv(target, pname, fparam);
4464 }
4465
4466
4467 static void GLAPIENTRY
save_TexParameteriv(GLenum target,GLenum pname,const GLint * params)4468 save_TexParameteriv(GLenum target, GLenum pname, const GLint *params)
4469 {
4470 GLfloat fparam[4];
4471 fparam[0] = (GLfloat) params[0];
4472 fparam[1] = fparam[2] = fparam[3] = 0.0F;
4473 save_TexParameterfv(target, pname, fparam);
4474 }
4475
4476
4477 static void GLAPIENTRY
save_TexImage1D(GLenum target,GLint level,GLint components,GLsizei width,GLint border,GLenum format,GLenum type,const GLvoid * pixels)4478 save_TexImage1D(GLenum target,
4479 GLint level, GLint components,
4480 GLsizei width, GLint border,
4481 GLenum format, GLenum type, const GLvoid * pixels)
4482 {
4483 GET_CURRENT_CONTEXT(ctx);
4484 if (target == GL_PROXY_TEXTURE_1D) {
4485 /* don't compile, execute immediately */
4486 CALL_TexImage1D(ctx->Exec, (target, level, components, width,
4487 border, format, type, pixels));
4488 }
4489 else {
4490 Node *n;
4491 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4492 n = alloc_instruction(ctx, OPCODE_TEX_IMAGE1D, 7 + POINTER_DWORDS);
4493 if (n) {
4494 n[1].e = target;
4495 n[2].i = level;
4496 n[3].i = components;
4497 n[4].i = (GLint) width;
4498 n[5].i = border;
4499 n[6].e = format;
4500 n[7].e = type;
4501 save_pointer(&n[8],
4502 unpack_image(ctx, 1, width, 1, 1, format, type,
4503 pixels, &ctx->Unpack));
4504 }
4505 if (ctx->ExecuteFlag) {
4506 CALL_TexImage1D(ctx->Exec, (target, level, components, width,
4507 border, format, type, pixels));
4508 }
4509 }
4510 }
4511
4512
4513 static void GLAPIENTRY
save_TexImage2D(GLenum target,GLint level,GLint components,GLsizei width,GLsizei height,GLint border,GLenum format,GLenum type,const GLvoid * pixels)4514 save_TexImage2D(GLenum target,
4515 GLint level, GLint components,
4516 GLsizei width, GLsizei height, GLint border,
4517 GLenum format, GLenum type, const GLvoid * pixels)
4518 {
4519 GET_CURRENT_CONTEXT(ctx);
4520 if (target == GL_PROXY_TEXTURE_2D) {
4521 /* don't compile, execute immediately */
4522 CALL_TexImage2D(ctx->Exec, (target, level, components, width,
4523 height, border, format, type, pixels));
4524 }
4525 else {
4526 Node *n;
4527 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4528 n = alloc_instruction(ctx, OPCODE_TEX_IMAGE2D, 8 + POINTER_DWORDS);
4529 if (n) {
4530 n[1].e = target;
4531 n[2].i = level;
4532 n[3].i = components;
4533 n[4].i = (GLint) width;
4534 n[5].i = (GLint) height;
4535 n[6].i = border;
4536 n[7].e = format;
4537 n[8].e = type;
4538 save_pointer(&n[9],
4539 unpack_image(ctx, 2, width, height, 1, format, type,
4540 pixels, &ctx->Unpack));
4541 }
4542 if (ctx->ExecuteFlag) {
4543 CALL_TexImage2D(ctx->Exec, (target, level, components, width,
4544 height, border, format, type, pixels));
4545 }
4546 }
4547 }
4548
4549
4550 static void GLAPIENTRY
save_TexImage3D(GLenum target,GLint level,GLint internalFormat,GLsizei width,GLsizei height,GLsizei depth,GLint border,GLenum format,GLenum type,const GLvoid * pixels)4551 save_TexImage3D(GLenum target,
4552 GLint level, GLint internalFormat,
4553 GLsizei width, GLsizei height, GLsizei depth,
4554 GLint border,
4555 GLenum format, GLenum type, const GLvoid * pixels)
4556 {
4557 GET_CURRENT_CONTEXT(ctx);
4558 if (target == GL_PROXY_TEXTURE_3D) {
4559 /* don't compile, execute immediately */
4560 CALL_TexImage3D(ctx->Exec, (target, level, internalFormat, width,
4561 height, depth, border, format, type,
4562 pixels));
4563 }
4564 else {
4565 Node *n;
4566 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4567 n = alloc_instruction(ctx, OPCODE_TEX_IMAGE3D, 9 + POINTER_DWORDS);
4568 if (n) {
4569 n[1].e = target;
4570 n[2].i = level;
4571 n[3].i = (GLint) internalFormat;
4572 n[4].i = (GLint) width;
4573 n[5].i = (GLint) height;
4574 n[6].i = (GLint) depth;
4575 n[7].i = border;
4576 n[8].e = format;
4577 n[9].e = type;
4578 save_pointer(&n[10],
4579 unpack_image(ctx, 3, width, height, depth, format, type,
4580 pixels, &ctx->Unpack));
4581 }
4582 if (ctx->ExecuteFlag) {
4583 CALL_TexImage3D(ctx->Exec, (target, level, internalFormat, width,
4584 height, depth, border, format, type,
4585 pixels));
4586 }
4587 }
4588 }
4589
4590
4591 static void GLAPIENTRY
save_TexSubImage1D(GLenum target,GLint level,GLint xoffset,GLsizei width,GLenum format,GLenum type,const GLvoid * pixels)4592 save_TexSubImage1D(GLenum target, GLint level, GLint xoffset,
4593 GLsizei width, GLenum format, GLenum type,
4594 const GLvoid * pixels)
4595 {
4596 GET_CURRENT_CONTEXT(ctx);
4597 Node *n;
4598
4599 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4600
4601 n = alloc_instruction(ctx, OPCODE_TEX_SUB_IMAGE1D, 6 + POINTER_DWORDS);
4602 if (n) {
4603 n[1].e = target;
4604 n[2].i = level;
4605 n[3].i = xoffset;
4606 n[4].i = (GLint) width;
4607 n[5].e = format;
4608 n[6].e = type;
4609 save_pointer(&n[7],
4610 unpack_image(ctx, 1, width, 1, 1, format, type,
4611 pixels, &ctx->Unpack));
4612 }
4613 if (ctx->ExecuteFlag) {
4614 CALL_TexSubImage1D(ctx->Exec, (target, level, xoffset, width,
4615 format, type, pixels));
4616 }
4617 }
4618
4619
4620 static void GLAPIENTRY
save_TexSubImage2D(GLenum target,GLint level,GLint xoffset,GLint yoffset,GLsizei width,GLsizei height,GLenum format,GLenum type,const GLvoid * pixels)4621 save_TexSubImage2D(GLenum target, GLint level,
4622 GLint xoffset, GLint yoffset,
4623 GLsizei width, GLsizei height,
4624 GLenum format, GLenum type, const GLvoid * pixels)
4625 {
4626 GET_CURRENT_CONTEXT(ctx);
4627 Node *n;
4628
4629 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4630
4631 n = alloc_instruction(ctx, OPCODE_TEX_SUB_IMAGE2D, 8 + POINTER_DWORDS);
4632 if (n) {
4633 n[1].e = target;
4634 n[2].i = level;
4635 n[3].i = xoffset;
4636 n[4].i = yoffset;
4637 n[5].i = (GLint) width;
4638 n[6].i = (GLint) height;
4639 n[7].e = format;
4640 n[8].e = type;
4641 save_pointer(&n[9],
4642 unpack_image(ctx, 2, width, height, 1, format, type,
4643 pixels, &ctx->Unpack));
4644 }
4645 if (ctx->ExecuteFlag) {
4646 CALL_TexSubImage2D(ctx->Exec, (target, level, xoffset, yoffset,
4647 width, height, format, type, pixels));
4648 }
4649 }
4650
4651
4652 static void GLAPIENTRY
save_TexSubImage3D(GLenum target,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLsizei width,GLsizei height,GLsizei depth,GLenum format,GLenum type,const GLvoid * pixels)4653 save_TexSubImage3D(GLenum target, GLint level,
4654 GLint xoffset, GLint yoffset, GLint zoffset,
4655 GLsizei width, GLsizei height, GLsizei depth,
4656 GLenum format, GLenum type, const GLvoid * pixels)
4657 {
4658 GET_CURRENT_CONTEXT(ctx);
4659 Node *n;
4660
4661 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4662
4663 n = alloc_instruction(ctx, OPCODE_TEX_SUB_IMAGE3D, 10 + POINTER_DWORDS);
4664 if (n) {
4665 n[1].e = target;
4666 n[2].i = level;
4667 n[3].i = xoffset;
4668 n[4].i = yoffset;
4669 n[5].i = zoffset;
4670 n[6].i = (GLint) width;
4671 n[7].i = (GLint) height;
4672 n[8].i = (GLint) depth;
4673 n[9].e = format;
4674 n[10].e = type;
4675 save_pointer(&n[11],
4676 unpack_image(ctx, 3, width, height, depth, format, type,
4677 pixels, &ctx->Unpack));
4678 }
4679 if (ctx->ExecuteFlag) {
4680 CALL_TexSubImage3D(ctx->Exec, (target, level,
4681 xoffset, yoffset, zoffset,
4682 width, height, depth, format, type,
4683 pixels));
4684 }
4685 }
4686
4687
4688 static void GLAPIENTRY
save_Translatef(GLfloat x,GLfloat y,GLfloat z)4689 save_Translatef(GLfloat x, GLfloat y, GLfloat z)
4690 {
4691 GET_CURRENT_CONTEXT(ctx);
4692 Node *n;
4693 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4694 n = alloc_instruction(ctx, OPCODE_TRANSLATE, 3);
4695 if (n) {
4696 n[1].f = x;
4697 n[2].f = y;
4698 n[3].f = z;
4699 }
4700 if (ctx->ExecuteFlag) {
4701 CALL_Translatef(ctx->Exec, (x, y, z));
4702 }
4703 }
4704
4705
4706 static void GLAPIENTRY
save_Translated(GLdouble x,GLdouble y,GLdouble z)4707 save_Translated(GLdouble x, GLdouble y, GLdouble z)
4708 {
4709 save_Translatef((GLfloat) x, (GLfloat) y, (GLfloat) z);
4710 }
4711
4712
4713
4714 static void GLAPIENTRY
save_Viewport(GLint x,GLint y,GLsizei width,GLsizei height)4715 save_Viewport(GLint x, GLint y, GLsizei width, GLsizei height)
4716 {
4717 GET_CURRENT_CONTEXT(ctx);
4718 Node *n;
4719 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4720 n = alloc_instruction(ctx, OPCODE_VIEWPORT, 4);
4721 if (n) {
4722 n[1].i = x;
4723 n[2].i = y;
4724 n[3].i = (GLint) width;
4725 n[4].i = (GLint) height;
4726 }
4727 if (ctx->ExecuteFlag) {
4728 CALL_Viewport(ctx->Exec, (x, y, width, height));
4729 }
4730 }
4731
4732 static void GLAPIENTRY
save_ViewportIndexedf(GLuint index,GLfloat x,GLfloat y,GLfloat width,GLfloat height)4733 save_ViewportIndexedf(GLuint index, GLfloat x, GLfloat y, GLfloat width,
4734 GLfloat height)
4735 {
4736 GET_CURRENT_CONTEXT(ctx);
4737 Node *n;
4738 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4739 n = alloc_instruction(ctx, OPCODE_VIEWPORT_INDEXED_F, 5);
4740 if (n) {
4741 n[1].ui = index;
4742 n[2].f = x;
4743 n[3].f = y;
4744 n[4].f = width;
4745 n[5].f = height;
4746 }
4747 if (ctx->ExecuteFlag) {
4748 CALL_ViewportIndexedf(ctx->Exec, (index, x, y, width, height));
4749 }
4750 }
4751
4752 static void GLAPIENTRY
save_ViewportIndexedfv(GLuint index,const GLfloat * v)4753 save_ViewportIndexedfv(GLuint index, const GLfloat *v)
4754 {
4755 GET_CURRENT_CONTEXT(ctx);
4756 Node *n;
4757 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4758 n = alloc_instruction(ctx, OPCODE_VIEWPORT_INDEXED_FV, 5);
4759 if (n) {
4760 n[1].ui = index;
4761 n[2].f = v[0];
4762 n[3].f = v[1];
4763 n[4].f = v[2];
4764 n[5].f = v[3];
4765 }
4766 if (ctx->ExecuteFlag) {
4767 CALL_ViewportIndexedfv(ctx->Exec, (index, v));
4768 }
4769 }
4770
4771 static void GLAPIENTRY
save_ViewportArrayv(GLuint first,GLsizei count,const GLfloat * v)4772 save_ViewportArrayv(GLuint first, GLsizei count, const GLfloat *v)
4773 {
4774 GET_CURRENT_CONTEXT(ctx);
4775 Node *n;
4776 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4777 n = alloc_instruction(ctx, OPCODE_VIEWPORT_ARRAY_V, 2 + POINTER_DWORDS);
4778 if (n) {
4779 n[1].ui = first;
4780 n[2].si = count;
4781 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLfloat)));
4782 }
4783 if (ctx->ExecuteFlag) {
4784 CALL_ViewportArrayv(ctx->Exec, (first, count, v));
4785 }
4786 }
4787
4788 static void GLAPIENTRY
save_ScissorIndexed(GLuint index,GLint left,GLint bottom,GLsizei width,GLsizei height)4789 save_ScissorIndexed(GLuint index, GLint left, GLint bottom, GLsizei width,
4790 GLsizei height)
4791 {
4792 GET_CURRENT_CONTEXT(ctx);
4793 Node *n;
4794 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4795 n = alloc_instruction(ctx, OPCODE_SCISSOR_INDEXED, 5);
4796 if (n) {
4797 n[1].ui = index;
4798 n[2].i = left;
4799 n[3].i = bottom;
4800 n[4].si = width;
4801 n[5].si = height;
4802 }
4803 if (ctx->ExecuteFlag) {
4804 CALL_ScissorIndexed(ctx->Exec, (index, left, bottom, width, height));
4805 }
4806 }
4807
4808 static void GLAPIENTRY
save_ScissorIndexedv(GLuint index,const GLint * v)4809 save_ScissorIndexedv(GLuint index, const GLint *v)
4810 {
4811 GET_CURRENT_CONTEXT(ctx);
4812 Node *n;
4813 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4814 n = alloc_instruction(ctx, OPCODE_SCISSOR_INDEXED_V, 5);
4815 if (n) {
4816 n[1].ui = index;
4817 n[2].i = v[0];
4818 n[3].i = v[1];
4819 n[4].si = v[2];
4820 n[5].si = v[3];
4821 }
4822 if (ctx->ExecuteFlag) {
4823 CALL_ScissorIndexedv(ctx->Exec, (index, v));
4824 }
4825 }
4826
4827 static void GLAPIENTRY
save_ScissorArrayv(GLuint first,GLsizei count,const GLint * v)4828 save_ScissorArrayv(GLuint first, GLsizei count, const GLint *v)
4829 {
4830 GET_CURRENT_CONTEXT(ctx);
4831 Node *n;
4832 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4833 n = alloc_instruction(ctx, OPCODE_SCISSOR_ARRAY_V, 2 + POINTER_DWORDS);
4834 if (n) {
4835 n[1].ui = first;
4836 n[2].si = count;
4837 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLint)));
4838 }
4839 if (ctx->ExecuteFlag) {
4840 CALL_ScissorArrayv(ctx->Exec, (first, count, v));
4841 }
4842 }
4843
4844 static void GLAPIENTRY
save_DepthRangeIndexed(GLuint index,GLclampd n,GLclampd f)4845 save_DepthRangeIndexed(GLuint index, GLclampd n, GLclampd f)
4846 {
4847 GET_CURRENT_CONTEXT(ctx);
4848 Node *node;
4849 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4850 node = alloc_instruction(ctx, OPCODE_DEPTH_INDEXED, 3);
4851 if (node) {
4852 node[1].ui = index;
4853 /* Mesa stores these as floats internally so we deliberately convert
4854 * them to a float here.
4855 */
4856 node[2].f = n;
4857 node[3].f = f;
4858 }
4859 if (ctx->ExecuteFlag) {
4860 CALL_DepthRangeIndexed(ctx->Exec, (index, n, f));
4861 }
4862 }
4863
4864 static void GLAPIENTRY
save_DepthRangeArrayv(GLuint first,GLsizei count,const GLclampd * v)4865 save_DepthRangeArrayv(GLuint first, GLsizei count, const GLclampd *v)
4866 {
4867 GET_CURRENT_CONTEXT(ctx);
4868 Node *n;
4869 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4870 n = alloc_instruction(ctx, OPCODE_DEPTH_ARRAY_V, 2 + POINTER_DWORDS);
4871 if (n) {
4872 n[1].ui = first;
4873 n[2].si = count;
4874 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLclampd)));
4875 }
4876 if (ctx->ExecuteFlag) {
4877 CALL_DepthRangeArrayv(ctx->Exec, (first, count, v));
4878 }
4879 }
4880
4881 static void GLAPIENTRY
save_WindowPos4fMESA(GLfloat x,GLfloat y,GLfloat z,GLfloat w)4882 save_WindowPos4fMESA(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
4883 {
4884 GET_CURRENT_CONTEXT(ctx);
4885 Node *n;
4886 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4887 n = alloc_instruction(ctx, OPCODE_WINDOW_POS, 4);
4888 if (n) {
4889 n[1].f = x;
4890 n[2].f = y;
4891 n[3].f = z;
4892 n[4].f = w;
4893 }
4894 if (ctx->ExecuteFlag) {
4895 CALL_WindowPos4fMESA(ctx->Exec, (x, y, z, w));
4896 }
4897 }
4898
4899 static void GLAPIENTRY
save_WindowPos2dMESA(GLdouble x,GLdouble y)4900 save_WindowPos2dMESA(GLdouble x, GLdouble y)
4901 {
4902 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
4903 }
4904
4905 static void GLAPIENTRY
save_WindowPos2fMESA(GLfloat x,GLfloat y)4906 save_WindowPos2fMESA(GLfloat x, GLfloat y)
4907 {
4908 save_WindowPos4fMESA(x, y, 0.0F, 1.0F);
4909 }
4910
4911 static void GLAPIENTRY
save_WindowPos2iMESA(GLint x,GLint y)4912 save_WindowPos2iMESA(GLint x, GLint y)
4913 {
4914 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
4915 }
4916
4917 static void GLAPIENTRY
save_WindowPos2sMESA(GLshort x,GLshort y)4918 save_WindowPos2sMESA(GLshort x, GLshort y)
4919 {
4920 save_WindowPos4fMESA(x, y, 0.0F, 1.0F);
4921 }
4922
4923 static void GLAPIENTRY
save_WindowPos3dMESA(GLdouble x,GLdouble y,GLdouble z)4924 save_WindowPos3dMESA(GLdouble x, GLdouble y, GLdouble z)
4925 {
4926 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
4927 }
4928
4929 static void GLAPIENTRY
save_WindowPos3fMESA(GLfloat x,GLfloat y,GLfloat z)4930 save_WindowPos3fMESA(GLfloat x, GLfloat y, GLfloat z)
4931 {
4932 save_WindowPos4fMESA(x, y, z, 1.0F);
4933 }
4934
4935 static void GLAPIENTRY
save_WindowPos3iMESA(GLint x,GLint y,GLint z)4936 save_WindowPos3iMESA(GLint x, GLint y, GLint z)
4937 {
4938 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
4939 }
4940
4941 static void GLAPIENTRY
save_WindowPos3sMESA(GLshort x,GLshort y,GLshort z)4942 save_WindowPos3sMESA(GLshort x, GLshort y, GLshort z)
4943 {
4944 save_WindowPos4fMESA(x, y, z, 1.0F);
4945 }
4946
4947 static void GLAPIENTRY
save_WindowPos4dMESA(GLdouble x,GLdouble y,GLdouble z,GLdouble w)4948 save_WindowPos4dMESA(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
4949 {
4950 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
4951 }
4952
4953 static void GLAPIENTRY
save_WindowPos4iMESA(GLint x,GLint y,GLint z,GLint w)4954 save_WindowPos4iMESA(GLint x, GLint y, GLint z, GLint w)
4955 {
4956 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
4957 }
4958
4959 static void GLAPIENTRY
save_WindowPos4sMESA(GLshort x,GLshort y,GLshort z,GLshort w)4960 save_WindowPos4sMESA(GLshort x, GLshort y, GLshort z, GLshort w)
4961 {
4962 save_WindowPos4fMESA(x, y, z, w);
4963 }
4964
4965 static void GLAPIENTRY
save_WindowPos2dvMESA(const GLdouble * v)4966 save_WindowPos2dvMESA(const GLdouble * v)
4967 {
4968 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
4969 }
4970
4971 static void GLAPIENTRY
save_WindowPos2fvMESA(const GLfloat * v)4972 save_WindowPos2fvMESA(const GLfloat * v)
4973 {
4974 save_WindowPos4fMESA(v[0], v[1], 0.0F, 1.0F);
4975 }
4976
4977 static void GLAPIENTRY
save_WindowPos2ivMESA(const GLint * v)4978 save_WindowPos2ivMESA(const GLint * v)
4979 {
4980 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
4981 }
4982
4983 static void GLAPIENTRY
save_WindowPos2svMESA(const GLshort * v)4984 save_WindowPos2svMESA(const GLshort * v)
4985 {
4986 save_WindowPos4fMESA(v[0], v[1], 0.0F, 1.0F);
4987 }
4988
4989 static void GLAPIENTRY
save_WindowPos3dvMESA(const GLdouble * v)4990 save_WindowPos3dvMESA(const GLdouble * v)
4991 {
4992 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
4993 }
4994
4995 static void GLAPIENTRY
save_WindowPos3fvMESA(const GLfloat * v)4996 save_WindowPos3fvMESA(const GLfloat * v)
4997 {
4998 save_WindowPos4fMESA(v[0], v[1], v[2], 1.0F);
4999 }
5000
5001 static void GLAPIENTRY
save_WindowPos3ivMESA(const GLint * v)5002 save_WindowPos3ivMESA(const GLint * v)
5003 {
5004 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
5005 }
5006
5007 static void GLAPIENTRY
save_WindowPos3svMESA(const GLshort * v)5008 save_WindowPos3svMESA(const GLshort * v)
5009 {
5010 save_WindowPos4fMESA(v[0], v[1], v[2], 1.0F);
5011 }
5012
5013 static void GLAPIENTRY
save_WindowPos4dvMESA(const GLdouble * v)5014 save_WindowPos4dvMESA(const GLdouble * v)
5015 {
5016 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1],
5017 (GLfloat) v[2], (GLfloat) v[3]);
5018 }
5019
5020 static void GLAPIENTRY
save_WindowPos4fvMESA(const GLfloat * v)5021 save_WindowPos4fvMESA(const GLfloat * v)
5022 {
5023 save_WindowPos4fMESA(v[0], v[1], v[2], v[3]);
5024 }
5025
5026 static void GLAPIENTRY
save_WindowPos4ivMESA(const GLint * v)5027 save_WindowPos4ivMESA(const GLint * v)
5028 {
5029 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1],
5030 (GLfloat) v[2], (GLfloat) v[3]);
5031 }
5032
5033 static void GLAPIENTRY
save_WindowPos4svMESA(const GLshort * v)5034 save_WindowPos4svMESA(const GLshort * v)
5035 {
5036 save_WindowPos4fMESA(v[0], v[1], v[2], v[3]);
5037 }
5038
5039
5040
5041 /* GL_ARB_multitexture */
5042 static void GLAPIENTRY
save_ActiveTextureARB(GLenum target)5043 save_ActiveTextureARB(GLenum target)
5044 {
5045 GET_CURRENT_CONTEXT(ctx);
5046 Node *n;
5047 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5048 n = alloc_instruction(ctx, OPCODE_ACTIVE_TEXTURE, 1);
5049 if (n) {
5050 n[1].e = target;
5051 }
5052 if (ctx->ExecuteFlag) {
5053 CALL_ActiveTexture(ctx->Exec, (target));
5054 }
5055 }
5056
5057
5058 /* GL_ARB_transpose_matrix */
5059
5060 static void GLAPIENTRY
save_LoadTransposeMatrixdARB(const GLdouble m[16])5061 save_LoadTransposeMatrixdARB(const GLdouble m[16])
5062 {
5063 GLfloat tm[16];
5064 _math_transposefd(tm, m);
5065 save_LoadMatrixf(tm);
5066 }
5067
5068
5069 static void GLAPIENTRY
save_LoadTransposeMatrixfARB(const GLfloat m[16])5070 save_LoadTransposeMatrixfARB(const GLfloat m[16])
5071 {
5072 GLfloat tm[16];
5073 _math_transposef(tm, m);
5074 save_LoadMatrixf(tm);
5075 }
5076
5077
5078 static void GLAPIENTRY
save_MultTransposeMatrixdARB(const GLdouble m[16])5079 save_MultTransposeMatrixdARB(const GLdouble m[16])
5080 {
5081 GLfloat tm[16];
5082 _math_transposefd(tm, m);
5083 save_MultMatrixf(tm);
5084 }
5085
5086
5087 static void GLAPIENTRY
save_MultTransposeMatrixfARB(const GLfloat m[16])5088 save_MultTransposeMatrixfARB(const GLfloat m[16])
5089 {
5090 GLfloat tm[16];
5091 _math_transposef(tm, m);
5092 save_MultMatrixf(tm);
5093 }
5094
copy_data(const GLvoid * data,GLsizei size,const char * func)5095 static GLvoid *copy_data(const GLvoid *data, GLsizei size, const char *func)
5096 {
5097 GET_CURRENT_CONTEXT(ctx);
5098 GLvoid *image;
5099
5100 if (!data)
5101 return NULL;
5102
5103 image = malloc(size);
5104 if (!image) {
5105 _mesa_error(ctx, GL_OUT_OF_MEMORY, "%s", func);
5106 return NULL;
5107 }
5108 memcpy(image, data, size);
5109
5110 return image;
5111 }
5112
5113
5114 /* GL_ARB_texture_compression */
5115 static void GLAPIENTRY
save_CompressedTexImage1DARB(GLenum target,GLint level,GLenum internalFormat,GLsizei width,GLint border,GLsizei imageSize,const GLvoid * data)5116 save_CompressedTexImage1DARB(GLenum target, GLint level,
5117 GLenum internalFormat, GLsizei width,
5118 GLint border, GLsizei imageSize,
5119 const GLvoid * data)
5120 {
5121 GET_CURRENT_CONTEXT(ctx);
5122 if (target == GL_PROXY_TEXTURE_1D) {
5123 /* don't compile, execute immediately */
5124 CALL_CompressedTexImage1D(ctx->Exec, (target, level, internalFormat,
5125 width, border, imageSize,
5126 data));
5127 }
5128 else {
5129 Node *n;
5130 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5131
5132 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_1D,
5133 6 + POINTER_DWORDS);
5134 if (n) {
5135 n[1].e = target;
5136 n[2].i = level;
5137 n[3].e = internalFormat;
5138 n[4].i = (GLint) width;
5139 n[5].i = border;
5140 n[6].i = imageSize;
5141 save_pointer(&n[7],
5142 copy_data(data, imageSize, "glCompressedTexImage1DARB"));
5143 }
5144 if (ctx->ExecuteFlag) {
5145 CALL_CompressedTexImage1D(ctx->Exec,
5146 (target, level, internalFormat, width,
5147 border, imageSize, data));
5148 }
5149 }
5150 }
5151
5152
5153 static void GLAPIENTRY
save_CompressedTexImage2DARB(GLenum target,GLint level,GLenum internalFormat,GLsizei width,GLsizei height,GLint border,GLsizei imageSize,const GLvoid * data)5154 save_CompressedTexImage2DARB(GLenum target, GLint level,
5155 GLenum internalFormat, GLsizei width,
5156 GLsizei height, GLint border, GLsizei imageSize,
5157 const GLvoid * data)
5158 {
5159 GET_CURRENT_CONTEXT(ctx);
5160 if (target == GL_PROXY_TEXTURE_2D) {
5161 /* don't compile, execute immediately */
5162 CALL_CompressedTexImage2D(ctx->Exec, (target, level, internalFormat,
5163 width, height, border,
5164 imageSize, data));
5165 }
5166 else {
5167 Node *n;
5168 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5169
5170 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_2D,
5171 7 + POINTER_DWORDS);
5172 if (n) {
5173 n[1].e = target;
5174 n[2].i = level;
5175 n[3].e = internalFormat;
5176 n[4].i = (GLint) width;
5177 n[5].i = (GLint) height;
5178 n[6].i = border;
5179 n[7].i = imageSize;
5180 save_pointer(&n[8],
5181 copy_data(data, imageSize, "glCompressedTexImage2DARB"));
5182 }
5183 if (ctx->ExecuteFlag) {
5184 CALL_CompressedTexImage2D(ctx->Exec,
5185 (target, level, internalFormat, width,
5186 height, border, imageSize, data));
5187 }
5188 }
5189 }
5190
5191
5192 static void GLAPIENTRY
save_CompressedTexImage3DARB(GLenum target,GLint level,GLenum internalFormat,GLsizei width,GLsizei height,GLsizei depth,GLint border,GLsizei imageSize,const GLvoid * data)5193 save_CompressedTexImage3DARB(GLenum target, GLint level,
5194 GLenum internalFormat, GLsizei width,
5195 GLsizei height, GLsizei depth, GLint border,
5196 GLsizei imageSize, const GLvoid * data)
5197 {
5198 GET_CURRENT_CONTEXT(ctx);
5199 if (target == GL_PROXY_TEXTURE_3D) {
5200 /* don't compile, execute immediately */
5201 CALL_CompressedTexImage3D(ctx->Exec, (target, level, internalFormat,
5202 width, height, depth, border,
5203 imageSize, data));
5204 }
5205 else {
5206 Node *n;
5207 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5208
5209 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_3D,
5210 8 + POINTER_DWORDS);
5211 if (n) {
5212 n[1].e = target;
5213 n[2].i = level;
5214 n[3].e = internalFormat;
5215 n[4].i = (GLint) width;
5216 n[5].i = (GLint) height;
5217 n[6].i = (GLint) depth;
5218 n[7].i = border;
5219 n[8].i = imageSize;
5220 save_pointer(&n[9],
5221 copy_data(data, imageSize, "glCompressedTexImage3DARB"));
5222 }
5223 if (ctx->ExecuteFlag) {
5224 CALL_CompressedTexImage3D(ctx->Exec,
5225 (target, level, internalFormat, width,
5226 height, depth, border, imageSize,
5227 data));
5228 }
5229 }
5230 }
5231
5232
5233 static void GLAPIENTRY
save_CompressedTexSubImage1DARB(GLenum target,GLint level,GLint xoffset,GLsizei width,GLenum format,GLsizei imageSize,const GLvoid * data)5234 save_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset,
5235 GLsizei width, GLenum format,
5236 GLsizei imageSize, const GLvoid * data)
5237 {
5238 Node *n;
5239 GET_CURRENT_CONTEXT(ctx);
5240 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5241
5242 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D,
5243 6 + POINTER_DWORDS);
5244 if (n) {
5245 n[1].e = target;
5246 n[2].i = level;
5247 n[3].i = xoffset;
5248 n[4].i = (GLint) width;
5249 n[5].e = format;
5250 n[6].i = imageSize;
5251 save_pointer(&n[7],
5252 copy_data(data, imageSize, "glCompressedTexSubImage1DARB"));
5253 }
5254 if (ctx->ExecuteFlag) {
5255 CALL_CompressedTexSubImage1D(ctx->Exec, (target, level, xoffset,
5256 width, format, imageSize,
5257 data));
5258 }
5259 }
5260
5261
5262 static void GLAPIENTRY
save_CompressedTexSubImage2DARB(GLenum target,GLint level,GLint xoffset,GLint yoffset,GLsizei width,GLsizei height,GLenum format,GLsizei imageSize,const GLvoid * data)5263 save_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset,
5264 GLint yoffset, GLsizei width, GLsizei height,
5265 GLenum format, GLsizei imageSize,
5266 const GLvoid * data)
5267 {
5268 Node *n;
5269 GET_CURRENT_CONTEXT(ctx);
5270 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5271
5272 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D,
5273 8 + POINTER_DWORDS);
5274 if (n) {
5275 n[1].e = target;
5276 n[2].i = level;
5277 n[3].i = xoffset;
5278 n[4].i = yoffset;
5279 n[5].i = (GLint) width;
5280 n[6].i = (GLint) height;
5281 n[7].e = format;
5282 n[8].i = imageSize;
5283 save_pointer(&n[9],
5284 copy_data(data, imageSize, "glCompressedTexSubImage2DARB"));
5285 }
5286 if (ctx->ExecuteFlag) {
5287 CALL_CompressedTexSubImage2D(ctx->Exec,
5288 (target, level, xoffset, yoffset, width,
5289 height, format, imageSize, data));
5290 }
5291 }
5292
5293
5294 static void GLAPIENTRY
save_CompressedTexSubImage3DARB(GLenum target,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLsizei width,GLsizei height,GLsizei depth,GLenum format,GLsizei imageSize,const GLvoid * data)5295 save_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset,
5296 GLint yoffset, GLint zoffset, GLsizei width,
5297 GLsizei height, GLsizei depth, GLenum format,
5298 GLsizei imageSize, const GLvoid * data)
5299 {
5300 Node *n;
5301 GET_CURRENT_CONTEXT(ctx);
5302 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5303
5304 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D,
5305 10 + POINTER_DWORDS);
5306 if (n) {
5307 n[1].e = target;
5308 n[2].i = level;
5309 n[3].i = xoffset;
5310 n[4].i = yoffset;
5311 n[5].i = zoffset;
5312 n[6].i = (GLint) width;
5313 n[7].i = (GLint) height;
5314 n[8].i = (GLint) depth;
5315 n[9].e = format;
5316 n[10].i = imageSize;
5317 save_pointer(&n[11],
5318 copy_data(data, imageSize, "glCompressedTexSubImage3DARB"));
5319 }
5320 if (ctx->ExecuteFlag) {
5321 CALL_CompressedTexSubImage3D(ctx->Exec,
5322 (target, level, xoffset, yoffset,
5323 zoffset, width, height, depth, format,
5324 imageSize, data));
5325 }
5326 }
5327
5328
5329 /* GL_ARB_multisample */
5330 static void GLAPIENTRY
save_SampleCoverageARB(GLclampf value,GLboolean invert)5331 save_SampleCoverageARB(GLclampf value, GLboolean invert)
5332 {
5333 GET_CURRENT_CONTEXT(ctx);
5334 Node *n;
5335 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5336 n = alloc_instruction(ctx, OPCODE_SAMPLE_COVERAGE, 2);
5337 if (n) {
5338 n[1].f = value;
5339 n[2].b = invert;
5340 }
5341 if (ctx->ExecuteFlag) {
5342 CALL_SampleCoverage(ctx->Exec, (value, invert));
5343 }
5344 }
5345
5346
5347 /*
5348 * GL_ARB_vertex_program
5349 */
5350 static void GLAPIENTRY
save_BindProgramARB(GLenum target,GLuint id)5351 save_BindProgramARB(GLenum target, GLuint id)
5352 {
5353 GET_CURRENT_CONTEXT(ctx);
5354 Node *n;
5355 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5356 n = alloc_instruction(ctx, OPCODE_BIND_PROGRAM_ARB, 2);
5357 if (n) {
5358 n[1].e = target;
5359 n[2].ui = id;
5360 }
5361 if (ctx->ExecuteFlag) {
5362 CALL_BindProgramARB(ctx->Exec, (target, id));
5363 }
5364 }
5365
5366 static void GLAPIENTRY
save_ProgramEnvParameter4fARB(GLenum target,GLuint index,GLfloat x,GLfloat y,GLfloat z,GLfloat w)5367 save_ProgramEnvParameter4fARB(GLenum target, GLuint index,
5368 GLfloat x, GLfloat y, GLfloat z, GLfloat w)
5369 {
5370 GET_CURRENT_CONTEXT(ctx);
5371 Node *n;
5372 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5373 n = alloc_instruction(ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6);
5374 if (n) {
5375 n[1].e = target;
5376 n[2].ui = index;
5377 n[3].f = x;
5378 n[4].f = y;
5379 n[5].f = z;
5380 n[6].f = w;
5381 }
5382 if (ctx->ExecuteFlag) {
5383 CALL_ProgramEnvParameter4fARB(ctx->Exec, (target, index, x, y, z, w));
5384 }
5385 }
5386
5387
5388 static void GLAPIENTRY
save_ProgramEnvParameter4fvARB(GLenum target,GLuint index,const GLfloat * params)5389 save_ProgramEnvParameter4fvARB(GLenum target, GLuint index,
5390 const GLfloat *params)
5391 {
5392 save_ProgramEnvParameter4fARB(target, index, params[0], params[1],
5393 params[2], params[3]);
5394 }
5395
5396
5397 static void GLAPIENTRY
save_ProgramEnvParameters4fvEXT(GLenum target,GLuint index,GLsizei count,const GLfloat * params)5398 save_ProgramEnvParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
5399 const GLfloat * params)
5400 {
5401 GET_CURRENT_CONTEXT(ctx);
5402 Node *n;
5403 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5404
5405 if (count > 0) {
5406 GLint i;
5407 const GLfloat * p = params;
5408
5409 for (i = 0 ; i < count ; i++) {
5410 n = alloc_instruction(ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6);
5411 if (n) {
5412 n[1].e = target;
5413 n[2].ui = index;
5414 n[3].f = p[0];
5415 n[4].f = p[1];
5416 n[5].f = p[2];
5417 n[6].f = p[3];
5418 p += 4;
5419 }
5420 }
5421 }
5422
5423 if (ctx->ExecuteFlag) {
5424 CALL_ProgramEnvParameters4fvEXT(ctx->Exec, (target, index, count, params));
5425 }
5426 }
5427
5428
5429 static void GLAPIENTRY
save_ProgramEnvParameter4dARB(GLenum target,GLuint index,GLdouble x,GLdouble y,GLdouble z,GLdouble w)5430 save_ProgramEnvParameter4dARB(GLenum target, GLuint index,
5431 GLdouble x, GLdouble y, GLdouble z, GLdouble w)
5432 {
5433 save_ProgramEnvParameter4fARB(target, index,
5434 (GLfloat) x,
5435 (GLfloat) y, (GLfloat) z, (GLfloat) w);
5436 }
5437
5438
5439 static void GLAPIENTRY
save_ProgramEnvParameter4dvARB(GLenum target,GLuint index,const GLdouble * params)5440 save_ProgramEnvParameter4dvARB(GLenum target, GLuint index,
5441 const GLdouble *params)
5442 {
5443 save_ProgramEnvParameter4fARB(target, index,
5444 (GLfloat) params[0],
5445 (GLfloat) params[1],
5446 (GLfloat) params[2], (GLfloat) params[3]);
5447 }
5448
5449
5450 static void GLAPIENTRY
save_ProgramLocalParameter4fARB(GLenum target,GLuint index,GLfloat x,GLfloat y,GLfloat z,GLfloat w)5451 save_ProgramLocalParameter4fARB(GLenum target, GLuint index,
5452 GLfloat x, GLfloat y, GLfloat z, GLfloat w)
5453 {
5454 GET_CURRENT_CONTEXT(ctx);
5455 Node *n;
5456 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5457 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5458 if (n) {
5459 n[1].e = target;
5460 n[2].ui = index;
5461 n[3].f = x;
5462 n[4].f = y;
5463 n[5].f = z;
5464 n[6].f = w;
5465 }
5466 if (ctx->ExecuteFlag) {
5467 CALL_ProgramLocalParameter4fARB(ctx->Exec, (target, index, x, y, z, w));
5468 }
5469 }
5470
5471
5472 static void GLAPIENTRY
save_ProgramLocalParameter4fvARB(GLenum target,GLuint index,const GLfloat * params)5473 save_ProgramLocalParameter4fvARB(GLenum target, GLuint index,
5474 const GLfloat *params)
5475 {
5476 GET_CURRENT_CONTEXT(ctx);
5477 Node *n;
5478 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5479 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5480 if (n) {
5481 n[1].e = target;
5482 n[2].ui = index;
5483 n[3].f = params[0];
5484 n[4].f = params[1];
5485 n[5].f = params[2];
5486 n[6].f = params[3];
5487 }
5488 if (ctx->ExecuteFlag) {
5489 CALL_ProgramLocalParameter4fvARB(ctx->Exec, (target, index, params));
5490 }
5491 }
5492
5493
5494 static void GLAPIENTRY
save_ProgramLocalParameters4fvEXT(GLenum target,GLuint index,GLsizei count,const GLfloat * params)5495 save_ProgramLocalParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
5496 const GLfloat *params)
5497 {
5498 GET_CURRENT_CONTEXT(ctx);
5499 Node *n;
5500 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5501
5502 if (count > 0) {
5503 GLint i;
5504 const GLfloat * p = params;
5505
5506 for (i = 0 ; i < count ; i++) {
5507 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5508 if (n) {
5509 n[1].e = target;
5510 n[2].ui = index;
5511 n[3].f = p[0];
5512 n[4].f = p[1];
5513 n[5].f = p[2];
5514 n[6].f = p[3];
5515 p += 4;
5516 }
5517 }
5518 }
5519
5520 if (ctx->ExecuteFlag) {
5521 CALL_ProgramLocalParameters4fvEXT(ctx->Exec, (target, index, count, params));
5522 }
5523 }
5524
5525
5526 static void GLAPIENTRY
save_ProgramLocalParameter4dARB(GLenum target,GLuint index,GLdouble x,GLdouble y,GLdouble z,GLdouble w)5527 save_ProgramLocalParameter4dARB(GLenum target, GLuint index,
5528 GLdouble x, GLdouble y,
5529 GLdouble z, GLdouble w)
5530 {
5531 GET_CURRENT_CONTEXT(ctx);
5532 Node *n;
5533 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5534 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5535 if (n) {
5536 n[1].e = target;
5537 n[2].ui = index;
5538 n[3].f = (GLfloat) x;
5539 n[4].f = (GLfloat) y;
5540 n[5].f = (GLfloat) z;
5541 n[6].f = (GLfloat) w;
5542 }
5543 if (ctx->ExecuteFlag) {
5544 CALL_ProgramLocalParameter4dARB(ctx->Exec, (target, index, x, y, z, w));
5545 }
5546 }
5547
5548
5549 static void GLAPIENTRY
save_ProgramLocalParameter4dvARB(GLenum target,GLuint index,const GLdouble * params)5550 save_ProgramLocalParameter4dvARB(GLenum target, GLuint index,
5551 const GLdouble *params)
5552 {
5553 GET_CURRENT_CONTEXT(ctx);
5554 Node *n;
5555 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5556 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5557 if (n) {
5558 n[1].e = target;
5559 n[2].ui = index;
5560 n[3].f = (GLfloat) params[0];
5561 n[4].f = (GLfloat) params[1];
5562 n[5].f = (GLfloat) params[2];
5563 n[6].f = (GLfloat) params[3];
5564 }
5565 if (ctx->ExecuteFlag) {
5566 CALL_ProgramLocalParameter4dvARB(ctx->Exec, (target, index, params));
5567 }
5568 }
5569
5570
5571 /* GL_EXT_stencil_two_side */
5572 static void GLAPIENTRY
save_ActiveStencilFaceEXT(GLenum face)5573 save_ActiveStencilFaceEXT(GLenum face)
5574 {
5575 GET_CURRENT_CONTEXT(ctx);
5576 Node *n;
5577 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5578 n = alloc_instruction(ctx, OPCODE_ACTIVE_STENCIL_FACE_EXT, 1);
5579 if (n) {
5580 n[1].e = face;
5581 }
5582 if (ctx->ExecuteFlag) {
5583 CALL_ActiveStencilFaceEXT(ctx->Exec, (face));
5584 }
5585 }
5586
5587
5588 /* GL_EXT_depth_bounds_test */
5589 static void GLAPIENTRY
save_DepthBoundsEXT(GLclampd zmin,GLclampd zmax)5590 save_DepthBoundsEXT(GLclampd zmin, GLclampd zmax)
5591 {
5592 GET_CURRENT_CONTEXT(ctx);
5593 Node *n;
5594 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5595 n = alloc_instruction(ctx, OPCODE_DEPTH_BOUNDS_EXT, 2);
5596 if (n) {
5597 n[1].f = (GLfloat) zmin;
5598 n[2].f = (GLfloat) zmax;
5599 }
5600 if (ctx->ExecuteFlag) {
5601 CALL_DepthBoundsEXT(ctx->Exec, (zmin, zmax));
5602 }
5603 }
5604
5605
5606
5607 static void GLAPIENTRY
save_ProgramStringARB(GLenum target,GLenum format,GLsizei len,const GLvoid * string)5608 save_ProgramStringARB(GLenum target, GLenum format, GLsizei len,
5609 const GLvoid * string)
5610 {
5611 GET_CURRENT_CONTEXT(ctx);
5612 Node *n;
5613
5614 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5615
5616 n = alloc_instruction(ctx, OPCODE_PROGRAM_STRING_ARB, 3 + POINTER_DWORDS);
5617 if (n) {
5618 GLubyte *programCopy = malloc(len);
5619 if (!programCopy) {
5620 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramStringARB");
5621 return;
5622 }
5623 memcpy(programCopy, string, len);
5624 n[1].e = target;
5625 n[2].e = format;
5626 n[3].i = len;
5627 save_pointer(&n[4], programCopy);
5628 }
5629 if (ctx->ExecuteFlag) {
5630 CALL_ProgramStringARB(ctx->Exec, (target, format, len, string));
5631 }
5632 }
5633
5634
5635 static void GLAPIENTRY
save_BeginQueryARB(GLenum target,GLuint id)5636 save_BeginQueryARB(GLenum target, GLuint id)
5637 {
5638 GET_CURRENT_CONTEXT(ctx);
5639 Node *n;
5640 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5641 n = alloc_instruction(ctx, OPCODE_BEGIN_QUERY_ARB, 2);
5642 if (n) {
5643 n[1].e = target;
5644 n[2].ui = id;
5645 }
5646 if (ctx->ExecuteFlag) {
5647 CALL_BeginQuery(ctx->Exec, (target, id));
5648 }
5649 }
5650
5651 static void GLAPIENTRY
save_EndQueryARB(GLenum target)5652 save_EndQueryARB(GLenum target)
5653 {
5654 GET_CURRENT_CONTEXT(ctx);
5655 Node *n;
5656 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5657 n = alloc_instruction(ctx, OPCODE_END_QUERY_ARB, 1);
5658 if (n) {
5659 n[1].e = target;
5660 }
5661 if (ctx->ExecuteFlag) {
5662 CALL_EndQuery(ctx->Exec, (target));
5663 }
5664 }
5665
5666 static void GLAPIENTRY
save_QueryCounter(GLuint id,GLenum target)5667 save_QueryCounter(GLuint id, GLenum target)
5668 {
5669 GET_CURRENT_CONTEXT(ctx);
5670 Node *n;
5671 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5672 n = alloc_instruction(ctx, OPCODE_QUERY_COUNTER, 2);
5673 if (n) {
5674 n[1].ui = id;
5675 n[2].e = target;
5676 }
5677 if (ctx->ExecuteFlag) {
5678 CALL_QueryCounter(ctx->Exec, (id, target));
5679 }
5680 }
5681
5682 static void GLAPIENTRY
save_BeginQueryIndexed(GLenum target,GLuint index,GLuint id)5683 save_BeginQueryIndexed(GLenum target, GLuint index, GLuint id)
5684 {
5685 GET_CURRENT_CONTEXT(ctx);
5686 Node *n;
5687 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5688 n = alloc_instruction(ctx, OPCODE_BEGIN_QUERY_INDEXED, 3);
5689 if (n) {
5690 n[1].e = target;
5691 n[2].ui = index;
5692 n[3].ui = id;
5693 }
5694 if (ctx->ExecuteFlag) {
5695 CALL_BeginQueryIndexed(ctx->Exec, (target, index, id));
5696 }
5697 }
5698
5699 static void GLAPIENTRY
save_EndQueryIndexed(GLenum target,GLuint index)5700 save_EndQueryIndexed(GLenum target, GLuint index)
5701 {
5702 GET_CURRENT_CONTEXT(ctx);
5703 Node *n;
5704 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5705 n = alloc_instruction(ctx, OPCODE_END_QUERY_INDEXED, 2);
5706 if (n) {
5707 n[1].e = target;
5708 n[2].ui = index;
5709 }
5710 if (ctx->ExecuteFlag) {
5711 CALL_EndQueryIndexed(ctx->Exec, (target, index));
5712 }
5713 }
5714
5715
5716 static void GLAPIENTRY
save_DrawBuffersARB(GLsizei count,const GLenum * buffers)5717 save_DrawBuffersARB(GLsizei count, const GLenum * buffers)
5718 {
5719 GET_CURRENT_CONTEXT(ctx);
5720 Node *n;
5721 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5722 n = alloc_instruction(ctx, OPCODE_DRAW_BUFFERS_ARB, 1 + MAX_DRAW_BUFFERS);
5723 if (n) {
5724 GLint i;
5725 n[1].i = count;
5726 if (count > MAX_DRAW_BUFFERS)
5727 count = MAX_DRAW_BUFFERS;
5728 for (i = 0; i < count; i++) {
5729 n[2 + i].e = buffers[i];
5730 }
5731 }
5732 if (ctx->ExecuteFlag) {
5733 CALL_DrawBuffers(ctx->Exec, (count, buffers));
5734 }
5735 }
5736
5737 static void GLAPIENTRY
save_BindFragmentShaderATI(GLuint id)5738 save_BindFragmentShaderATI(GLuint id)
5739 {
5740 GET_CURRENT_CONTEXT(ctx);
5741 Node *n;
5742
5743 n = alloc_instruction(ctx, OPCODE_BIND_FRAGMENT_SHADER_ATI, 1);
5744 if (n) {
5745 n[1].ui = id;
5746 }
5747 if (ctx->ExecuteFlag) {
5748 CALL_BindFragmentShaderATI(ctx->Exec, (id));
5749 }
5750 }
5751
5752 static void GLAPIENTRY
save_SetFragmentShaderConstantATI(GLuint dst,const GLfloat * value)5753 save_SetFragmentShaderConstantATI(GLuint dst, const GLfloat *value)
5754 {
5755 GET_CURRENT_CONTEXT(ctx);
5756 Node *n;
5757
5758 n = alloc_instruction(ctx, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI, 5);
5759 if (n) {
5760 n[1].ui = dst;
5761 n[2].f = value[0];
5762 n[3].f = value[1];
5763 n[4].f = value[2];
5764 n[5].f = value[3];
5765 }
5766 if (ctx->ExecuteFlag) {
5767 CALL_SetFragmentShaderConstantATI(ctx->Exec, (dst, value));
5768 }
5769 }
5770
5771 static void GLAPIENTRY
save_EvalCoord1f(GLfloat x)5772 save_EvalCoord1f(GLfloat x)
5773 {
5774 GET_CURRENT_CONTEXT(ctx);
5775 Node *n;
5776 SAVE_FLUSH_VERTICES(ctx);
5777 n = alloc_instruction(ctx, OPCODE_EVAL_C1, 1);
5778 if (n) {
5779 n[1].f = x;
5780 }
5781 if (ctx->ExecuteFlag) {
5782 CALL_EvalCoord1f(ctx->Exec, (x));
5783 }
5784 }
5785
5786 static void GLAPIENTRY
save_EvalCoord1fv(const GLfloat * v)5787 save_EvalCoord1fv(const GLfloat * v)
5788 {
5789 save_EvalCoord1f(v[0]);
5790 }
5791
5792 static void GLAPIENTRY
save_EvalCoord2f(GLfloat x,GLfloat y)5793 save_EvalCoord2f(GLfloat x, GLfloat y)
5794 {
5795 GET_CURRENT_CONTEXT(ctx);
5796 Node *n;
5797 SAVE_FLUSH_VERTICES(ctx);
5798 n = alloc_instruction(ctx, OPCODE_EVAL_C2, 2);
5799 if (n) {
5800 n[1].f = x;
5801 n[2].f = y;
5802 }
5803 if (ctx->ExecuteFlag) {
5804 CALL_EvalCoord2f(ctx->Exec, (x, y));
5805 }
5806 }
5807
5808 static void GLAPIENTRY
save_EvalCoord2fv(const GLfloat * v)5809 save_EvalCoord2fv(const GLfloat * v)
5810 {
5811 save_EvalCoord2f(v[0], v[1]);
5812 }
5813
5814
5815 static void GLAPIENTRY
save_EvalPoint1(GLint x)5816 save_EvalPoint1(GLint x)
5817 {
5818 GET_CURRENT_CONTEXT(ctx);
5819 Node *n;
5820 SAVE_FLUSH_VERTICES(ctx);
5821 n = alloc_instruction(ctx, OPCODE_EVAL_P1, 1);
5822 if (n) {
5823 n[1].i = x;
5824 }
5825 if (ctx->ExecuteFlag) {
5826 CALL_EvalPoint1(ctx->Exec, (x));
5827 }
5828 }
5829
5830 static void GLAPIENTRY
save_EvalPoint2(GLint x,GLint y)5831 save_EvalPoint2(GLint x, GLint y)
5832 {
5833 GET_CURRENT_CONTEXT(ctx);
5834 Node *n;
5835 SAVE_FLUSH_VERTICES(ctx);
5836 n = alloc_instruction(ctx, OPCODE_EVAL_P2, 2);
5837 if (n) {
5838 n[1].i = x;
5839 n[2].i = y;
5840 }
5841 if (ctx->ExecuteFlag) {
5842 CALL_EvalPoint2(ctx->Exec, (x, y));
5843 }
5844 }
5845
5846
5847 /**
5848 * Compare 'count' elements of vectors 'a' and 'b'.
5849 * \return GL_TRUE if equal, GL_FALSE if different.
5850 */
5851 static inline GLboolean
compare_vec(const GLfloat * a,const GLfloat * b,GLuint count)5852 compare_vec(const GLfloat *a, const GLfloat *b, GLuint count)
5853 {
5854 return memcmp( a, b, count * sizeof(GLfloat) ) == 0;
5855 }
5856
5857
5858 /**
5859 * This glMaterial function is used for glMaterial calls that are outside
5860 * a glBegin/End pair. For glMaterial inside glBegin/End, see the VBO code.
5861 */
5862 static void GLAPIENTRY
save_Materialfv(GLenum face,GLenum pname,const GLfloat * param)5863 save_Materialfv(GLenum face, GLenum pname, const GLfloat * param)
5864 {
5865 GET_CURRENT_CONTEXT(ctx);
5866 Node *n;
5867 int args, i;
5868 GLuint bitmask;
5869
5870 switch (face) {
5871 case GL_BACK:
5872 case GL_FRONT:
5873 case GL_FRONT_AND_BACK:
5874 break;
5875 default:
5876 _mesa_compile_error(ctx, GL_INVALID_ENUM, "glMaterial(face)");
5877 return;
5878 }
5879
5880 switch (pname) {
5881 case GL_EMISSION:
5882 case GL_AMBIENT:
5883 case GL_DIFFUSE:
5884 case GL_SPECULAR:
5885 case GL_AMBIENT_AND_DIFFUSE:
5886 args = 4;
5887 break;
5888 case GL_SHININESS:
5889 args = 1;
5890 break;
5891 case GL_COLOR_INDEXES:
5892 args = 3;
5893 break;
5894 default:
5895 _mesa_compile_error(ctx, GL_INVALID_ENUM, "glMaterial(pname)");
5896 return;
5897 }
5898
5899 if (ctx->ExecuteFlag) {
5900 CALL_Materialfv(ctx->Exec, (face, pname, param));
5901 }
5902
5903 bitmask = _mesa_material_bitmask(ctx, face, pname, ~0, NULL);
5904
5905 /* Try to eliminate redundant statechanges. Because it is legal to
5906 * call glMaterial even inside begin/end calls, don't need to worry
5907 * about ctx->Driver.CurrentSavePrimitive here.
5908 */
5909 for (i = 0; i < MAT_ATTRIB_MAX; i++) {
5910 if (bitmask & (1 << i)) {
5911 if (ctx->ListState.ActiveMaterialSize[i] == args &&
5912 compare_vec(ctx->ListState.CurrentMaterial[i], param, args)) {
5913 /* no change in material value */
5914 bitmask &= ~(1 << i);
5915 }
5916 else {
5917 ctx->ListState.ActiveMaterialSize[i] = args;
5918 COPY_SZ_4V(ctx->ListState.CurrentMaterial[i], args, param);
5919 }
5920 }
5921 }
5922
5923 /* If this call has no effect, return early */
5924 if (bitmask == 0)
5925 return;
5926
5927 SAVE_FLUSH_VERTICES(ctx);
5928
5929 n = alloc_instruction(ctx, OPCODE_MATERIAL, 6);
5930 if (n) {
5931 n[1].e = face;
5932 n[2].e = pname;
5933 for (i = 0; i < args; i++)
5934 n[3 + i].f = param[i];
5935 }
5936 }
5937
5938 static void GLAPIENTRY
save_Begin(GLenum mode)5939 save_Begin(GLenum mode)
5940 {
5941 GET_CURRENT_CONTEXT(ctx);
5942
5943 if (!_mesa_is_valid_prim_mode(ctx, mode)) {
5944 /* compile this error into the display list */
5945 _mesa_compile_error(ctx, GL_INVALID_ENUM, "glBegin(mode)");
5946 }
5947 else if (_mesa_inside_dlist_begin_end(ctx)) {
5948 /* compile this error into the display list */
5949 _mesa_compile_error(ctx, GL_INVALID_OPERATION, "recursive glBegin");
5950 }
5951 else {
5952 ctx->Driver.CurrentSavePrimitive = mode;
5953
5954 vbo_save_NotifyBegin(ctx, mode, false);
5955 }
5956 }
5957
5958 static void GLAPIENTRY
save_End(void)5959 save_End(void)
5960 {
5961 GET_CURRENT_CONTEXT(ctx);
5962 SAVE_FLUSH_VERTICES(ctx);
5963 (void) alloc_instruction(ctx, OPCODE_END, 0);
5964 ctx->Driver.CurrentSavePrimitive = PRIM_OUTSIDE_BEGIN_END;
5965 if (ctx->ExecuteFlag) {
5966 CALL_End(ctx->Exec, ());
5967 }
5968 }
5969
5970 static void GLAPIENTRY
save_PrimitiveRestartNV(void)5971 save_PrimitiveRestartNV(void)
5972 {
5973 /* Note: this is used when outside a glBegin/End pair in a display list */
5974 GET_CURRENT_CONTEXT(ctx);
5975 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5976 (void) alloc_instruction(ctx, OPCODE_PRIMITIVE_RESTART_NV, 0);
5977 if (ctx->ExecuteFlag) {
5978 CALL_PrimitiveRestartNV(ctx->Exec, ());
5979 }
5980 }
5981
5982
5983 static void GLAPIENTRY
save_BlitFramebufferEXT(GLint srcX0,GLint srcY0,GLint srcX1,GLint srcY1,GLint dstX0,GLint dstY0,GLint dstX1,GLint dstY1,GLbitfield mask,GLenum filter)5984 save_BlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
5985 GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
5986 GLbitfield mask, GLenum filter)
5987 {
5988 GET_CURRENT_CONTEXT(ctx);
5989 Node *n;
5990 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5991 n = alloc_instruction(ctx, OPCODE_BLIT_FRAMEBUFFER, 10);
5992 if (n) {
5993 n[1].i = srcX0;
5994 n[2].i = srcY0;
5995 n[3].i = srcX1;
5996 n[4].i = srcY1;
5997 n[5].i = dstX0;
5998 n[6].i = dstY0;
5999 n[7].i = dstX1;
6000 n[8].i = dstY1;
6001 n[9].i = mask;
6002 n[10].e = filter;
6003 }
6004 if (ctx->ExecuteFlag) {
6005 CALL_BlitFramebuffer(ctx->Exec, (srcX0, srcY0, srcX1, srcY1,
6006 dstX0, dstY0, dstX1, dstY1,
6007 mask, filter));
6008 }
6009 }
6010
6011
6012 /** GL_EXT_provoking_vertex */
6013 static void GLAPIENTRY
save_ProvokingVertexEXT(GLenum mode)6014 save_ProvokingVertexEXT(GLenum mode)
6015 {
6016 GET_CURRENT_CONTEXT(ctx);
6017 Node *n;
6018 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6019 n = alloc_instruction(ctx, OPCODE_PROVOKING_VERTEX, 1);
6020 if (n) {
6021 n[1].e = mode;
6022 }
6023 if (ctx->ExecuteFlag) {
6024 /*CALL_ProvokingVertex(ctx->Exec, (mode));*/
6025 _mesa_ProvokingVertex(mode);
6026 }
6027 }
6028
6029
6030 /** GL_EXT_transform_feedback */
6031 static void GLAPIENTRY
save_BeginTransformFeedback(GLenum mode)6032 save_BeginTransformFeedback(GLenum mode)
6033 {
6034 GET_CURRENT_CONTEXT(ctx);
6035 Node *n;
6036 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6037 n = alloc_instruction(ctx, OPCODE_BEGIN_TRANSFORM_FEEDBACK, 1);
6038 if (n) {
6039 n[1].e = mode;
6040 }
6041 if (ctx->ExecuteFlag) {
6042 CALL_BeginTransformFeedback(ctx->Exec, (mode));
6043 }
6044 }
6045
6046
6047 /** GL_EXT_transform_feedback */
6048 static void GLAPIENTRY
save_EndTransformFeedback(void)6049 save_EndTransformFeedback(void)
6050 {
6051 GET_CURRENT_CONTEXT(ctx);
6052 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6053 (void) alloc_instruction(ctx, OPCODE_END_TRANSFORM_FEEDBACK, 0);
6054 if (ctx->ExecuteFlag) {
6055 CALL_EndTransformFeedback(ctx->Exec, ());
6056 }
6057 }
6058
6059 static void GLAPIENTRY
save_BindTransformFeedback(GLenum target,GLuint name)6060 save_BindTransformFeedback(GLenum target, GLuint name)
6061 {
6062 GET_CURRENT_CONTEXT(ctx);
6063 Node *n;
6064 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6065 n = alloc_instruction(ctx, OPCODE_BIND_TRANSFORM_FEEDBACK, 2);
6066 if (n) {
6067 n[1].e = target;
6068 n[2].ui = name;
6069 }
6070 if (ctx->ExecuteFlag) {
6071 CALL_BindTransformFeedback(ctx->Exec, (target, name));
6072 }
6073 }
6074
6075 static void GLAPIENTRY
save_PauseTransformFeedback(void)6076 save_PauseTransformFeedback(void)
6077 {
6078 GET_CURRENT_CONTEXT(ctx);
6079 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6080 (void) alloc_instruction(ctx, OPCODE_PAUSE_TRANSFORM_FEEDBACK, 0);
6081 if (ctx->ExecuteFlag) {
6082 CALL_PauseTransformFeedback(ctx->Exec, ());
6083 }
6084 }
6085
6086 static void GLAPIENTRY
save_ResumeTransformFeedback(void)6087 save_ResumeTransformFeedback(void)
6088 {
6089 GET_CURRENT_CONTEXT(ctx);
6090 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6091 (void) alloc_instruction(ctx, OPCODE_RESUME_TRANSFORM_FEEDBACK, 0);
6092 if (ctx->ExecuteFlag) {
6093 CALL_ResumeTransformFeedback(ctx->Exec, ());
6094 }
6095 }
6096
6097 static void GLAPIENTRY
save_DrawTransformFeedback(GLenum mode,GLuint name)6098 save_DrawTransformFeedback(GLenum mode, GLuint name)
6099 {
6100 GET_CURRENT_CONTEXT(ctx);
6101 Node *n;
6102 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6103 n = alloc_instruction(ctx, OPCODE_DRAW_TRANSFORM_FEEDBACK, 2);
6104 if (n) {
6105 n[1].e = mode;
6106 n[2].ui = name;
6107 }
6108 if (ctx->ExecuteFlag) {
6109 CALL_DrawTransformFeedback(ctx->Exec, (mode, name));
6110 }
6111 }
6112
6113 static void GLAPIENTRY
save_DrawTransformFeedbackStream(GLenum mode,GLuint name,GLuint stream)6114 save_DrawTransformFeedbackStream(GLenum mode, GLuint name, GLuint stream)
6115 {
6116 GET_CURRENT_CONTEXT(ctx);
6117 Node *n;
6118 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6119 n = alloc_instruction(ctx, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM, 3);
6120 if (n) {
6121 n[1].e = mode;
6122 n[2].ui = name;
6123 n[3].ui = stream;
6124 }
6125 if (ctx->ExecuteFlag) {
6126 CALL_DrawTransformFeedbackStream(ctx->Exec, (mode, name, stream));
6127 }
6128 }
6129
6130 static void GLAPIENTRY
save_DrawTransformFeedbackInstanced(GLenum mode,GLuint name,GLsizei primcount)6131 save_DrawTransformFeedbackInstanced(GLenum mode, GLuint name,
6132 GLsizei primcount)
6133 {
6134 GET_CURRENT_CONTEXT(ctx);
6135 Node *n;
6136 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6137 n = alloc_instruction(ctx, OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED, 3);
6138 if (n) {
6139 n[1].e = mode;
6140 n[2].ui = name;
6141 n[3].si = primcount;
6142 }
6143 if (ctx->ExecuteFlag) {
6144 CALL_DrawTransformFeedbackInstanced(ctx->Exec, (mode, name, primcount));
6145 }
6146 }
6147
6148 static void GLAPIENTRY
save_DrawTransformFeedbackStreamInstanced(GLenum mode,GLuint name,GLuint stream,GLsizei primcount)6149 save_DrawTransformFeedbackStreamInstanced(GLenum mode, GLuint name,
6150 GLuint stream, GLsizei primcount)
6151 {
6152 GET_CURRENT_CONTEXT(ctx);
6153 Node *n;
6154 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6155 n = alloc_instruction(ctx, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED, 4);
6156 if (n) {
6157 n[1].e = mode;
6158 n[2].ui = name;
6159 n[3].ui = stream;
6160 n[4].si = primcount;
6161 }
6162 if (ctx->ExecuteFlag) {
6163 CALL_DrawTransformFeedbackStreamInstanced(ctx->Exec, (mode, name, stream,
6164 primcount));
6165 }
6166 }
6167
6168 static void GLAPIENTRY
save_DispatchCompute(GLuint num_groups_x,GLuint num_groups_y,GLuint num_groups_z)6169 save_DispatchCompute(GLuint num_groups_x, GLuint num_groups_y,
6170 GLuint num_groups_z)
6171 {
6172 GET_CURRENT_CONTEXT(ctx);
6173 Node *n;
6174 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6175 n = alloc_instruction(ctx, OPCODE_DISPATCH_COMPUTE, 3);
6176 if (n) {
6177 n[1].ui = num_groups_x;
6178 n[2].ui = num_groups_y;
6179 n[3].ui = num_groups_z;
6180 }
6181 if (ctx->ExecuteFlag) {
6182 CALL_DispatchCompute(ctx->Exec, (num_groups_x, num_groups_y,
6183 num_groups_z));
6184 }
6185 }
6186
6187 static void GLAPIENTRY
save_DispatchComputeIndirect(GLintptr indirect)6188 save_DispatchComputeIndirect(GLintptr indirect)
6189 {
6190 GET_CURRENT_CONTEXT(ctx);
6191 _mesa_error(ctx, GL_INVALID_OPERATION,
6192 "glDispatchComputeIndirect() during display list compile");
6193 }
6194
6195 static void ALWAYS_INLINE
save_Attr32bit(struct gl_context * ctx,unsigned attr,unsigned size,GLenum type,uint32_t x,uint32_t y,uint32_t z,uint32_t w)6196 save_Attr32bit(struct gl_context *ctx, unsigned attr, unsigned size,
6197 GLenum type, uint32_t x, uint32_t y, uint32_t z, uint32_t w)
6198 {
6199 Node *n;
6200 SAVE_FLUSH_VERTICES(ctx);
6201 unsigned base_op;
6202 unsigned index = attr;
6203
6204 /* We don't care about GL_INT vs GL_UNSIGNED_INT. The idea is to get W=1
6205 * right for 3 or lower number of components, so only distinguish between
6206 * FLOAT and INT.
6207 */
6208 if (type == GL_FLOAT) {
6209 if (VERT_BIT(attr) & VERT_BIT_GENERIC_ALL) {
6210 base_op = OPCODE_ATTR_1F_ARB;
6211 attr -= VERT_ATTRIB_GENERIC0;
6212 } else {
6213 base_op = OPCODE_ATTR_1F_NV;
6214 }
6215 } else {
6216 base_op = OPCODE_ATTR_1I;
6217 attr -= VERT_ATTRIB_GENERIC0;
6218 }
6219
6220 n = alloc_instruction(ctx, base_op + size - 1, 1 + size);
6221 if (n) {
6222 n[1].ui = attr;
6223 n[2].ui = x;
6224 if (size >= 2) n[3].ui = y;
6225 if (size >= 3) n[4].ui = z;
6226 if (size >= 4) n[5].ui = w;
6227 }
6228
6229 ctx->ListState.ActiveAttribSize[index] = size;
6230 ASSIGN_4V(ctx->ListState.CurrentAttrib[index], x, y, z, w);
6231
6232 if (ctx->ExecuteFlag) {
6233 if (type == GL_FLOAT) {
6234 if (base_op == OPCODE_ATTR_1F_NV) {
6235 if (size == 4)
6236 CALL_VertexAttrib4fNV(ctx->Exec, (attr, uif(x), uif(y), uif(z), uif(w)));
6237 else if (size == 3)
6238 CALL_VertexAttrib3fNV(ctx->Exec, (attr, uif(x), uif(y), uif(z)));
6239 else if (size == 2)
6240 CALL_VertexAttrib2fNV(ctx->Exec, (attr, uif(x), uif(y)));
6241 else
6242 CALL_VertexAttrib1fNV(ctx->Exec, (attr, uif(x)));
6243 } else {
6244 if (size == 4)
6245 CALL_VertexAttrib4fARB(ctx->Exec, (attr, uif(x), uif(y), uif(z), uif(w)));
6246 else if (size == 3)
6247 CALL_VertexAttrib3fARB(ctx->Exec, (attr, uif(x), uif(y), uif(z)));
6248 else if (size == 2)
6249 CALL_VertexAttrib2fARB(ctx->Exec, (attr, uif(x), uif(y)));
6250 else
6251 CALL_VertexAttrib1fARB(ctx->Exec, (attr, uif(x)));
6252 }
6253 } else {
6254 if (size == 4)
6255 CALL_VertexAttribI4iEXT(ctx->Exec, (attr, x, y, z, w));
6256 else if (size == 3)
6257 CALL_VertexAttribI3iEXT(ctx->Exec, (attr, x, y, z));
6258 else if (size == 2)
6259 CALL_VertexAttribI2iEXT(ctx->Exec, (attr, x, y));
6260 else
6261 CALL_VertexAttribI1iEXT(ctx->Exec, (attr, x));
6262 }
6263 }
6264 }
6265
6266 static void ALWAYS_INLINE
save_Attr64bit(struct gl_context * ctx,unsigned attr,unsigned size,GLenum type,uint64_t x,uint64_t y,uint64_t z,uint64_t w)6267 save_Attr64bit(struct gl_context *ctx, unsigned attr, unsigned size,
6268 GLenum type, uint64_t x, uint64_t y, uint64_t z, uint64_t w)
6269 {
6270 Node *n;
6271 SAVE_FLUSH_VERTICES(ctx);
6272 unsigned base_op;
6273 unsigned index = attr;
6274
6275 if (type == GL_DOUBLE) {
6276 base_op = OPCODE_ATTR_1D;
6277 } else {
6278 base_op = OPCODE_ATTR_1UI64;
6279 assert(size == 1);
6280 }
6281
6282 attr -= VERT_ATTRIB_GENERIC0;
6283 n = alloc_instruction(ctx, base_op + size - 1, 1 + size * 2);
6284 if (n) {
6285 n[1].ui = attr;
6286 ASSIGN_UINT64_TO_NODES(n, 2, x);
6287 if (size >= 2) ASSIGN_UINT64_TO_NODES(n, 4, y);
6288 if (size >= 3) ASSIGN_UINT64_TO_NODES(n, 6, z);
6289 if (size >= 4) ASSIGN_UINT64_TO_NODES(n, 8, w);
6290 }
6291
6292 ctx->ListState.ActiveAttribSize[index] = size;
6293 memcpy(ctx->ListState.CurrentAttrib[index], &n[2], size * sizeof(uint64_t));
6294
6295 if (ctx->ExecuteFlag) {
6296 uint64_t v[] = {x, y, z, w};
6297 if (type == GL_DOUBLE) {
6298 if (size == 4)
6299 CALL_VertexAttribL4dv(ctx->Exec, (attr, (GLdouble*)v));
6300 else if (size == 3)
6301 CALL_VertexAttribL3dv(ctx->Exec, (attr, (GLdouble*)v));
6302 else if (size == 2)
6303 CALL_VertexAttribL2dv(ctx->Exec, (attr, (GLdouble*)v));
6304 else
6305 CALL_VertexAttribL1d(ctx->Exec, (attr, UINT64_AS_DOUBLE(x)));
6306 } else {
6307 CALL_VertexAttribL1ui64ARB(ctx->Exec, (attr, x));
6308 }
6309 }
6310 }
6311
6312 /**
6313 * If index=0, does glVertexAttrib*() alias glVertex() to emit a vertex?
6314 * It depends on a few things, including whether we're inside or outside
6315 * of glBegin/glEnd.
6316 */
6317 static inline bool
is_vertex_position(const struct gl_context * ctx,GLuint index)6318 is_vertex_position(const struct gl_context *ctx, GLuint index)
6319 {
6320 return (index == 0 &&
6321 _mesa_attr_zero_aliases_vertex(ctx) &&
6322 _mesa_inside_dlist_begin_end(ctx));
6323 }
6324
6325 /**
6326 * This macro is used to implement all the glVertex, glColor, glTexCoord,
6327 * glVertexAttrib, etc functions.
6328 * \param A VBO_ATTRIB_x attribute index
6329 * \param N attribute size (1..4)
6330 * \param T type (GL_FLOAT, GL_DOUBLE, GL_INT, GL_UNSIGNED_INT)
6331 * \param C cast type (uint32_t or uint64_t)
6332 * \param V0, V1, v2, V3 attribute value
6333 */
6334 #define ATTR_UNION(A, N, T, C, V0, V1, V2, V3) \
6335 do { \
6336 if (sizeof(C) == 4) { \
6337 save_Attr32bit(ctx, A, N, T, V0, V1, V2, V3); \
6338 } else { \
6339 save_Attr64bit(ctx, A, N, T, V0, V1, V2, V3); \
6340 } \
6341 } while (0)
6342
6343 #undef ERROR
6344 #define ERROR(err) _mesa_error(ctx, err, __func__)
6345 #define TAG(x) save_##x
6346
6347 #define VBO_ATTRIB_POS VERT_ATTRIB_POS
6348 #define VBO_ATTRIB_NORMAL VERT_ATTRIB_NORMAL
6349 #define VBO_ATTRIB_COLOR0 VERT_ATTRIB_COLOR0
6350 #define VBO_ATTRIB_COLOR1 VERT_ATTRIB_COLOR1
6351 #define VBO_ATTRIB_FOG VERT_ATTRIB_FOG
6352 #define VBO_ATTRIB_COLOR_INDEX VERT_ATTRIB_COLOR_INDEX
6353 #define VBO_ATTRIB_EDGEFLAG VERT_ATTRIB_EDGEFLAG
6354 #define VBO_ATTRIB_TEX0 VERT_ATTRIB_TEX0
6355 #define VBO_ATTRIB_GENERIC0 VERT_ATTRIB_GENERIC0
6356 #define VBO_ATTRIB_MAX VERT_ATTRIB_MAX
6357
6358 #include "vbo/vbo_attrib_tmp.h"
6359
6360 static void GLAPIENTRY
save_UseProgram(GLuint program)6361 save_UseProgram(GLuint program)
6362 {
6363 GET_CURRENT_CONTEXT(ctx);
6364 Node *n;
6365 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6366 n = alloc_instruction(ctx, OPCODE_USE_PROGRAM, 1);
6367 if (n) {
6368 n[1].ui = program;
6369 }
6370 if (ctx->ExecuteFlag) {
6371 CALL_UseProgram(ctx->Exec, (program));
6372 }
6373 }
6374
6375
6376 static void GLAPIENTRY
save_Uniform1fARB(GLint location,GLfloat x)6377 save_Uniform1fARB(GLint location, GLfloat x)
6378 {
6379 GET_CURRENT_CONTEXT(ctx);
6380 Node *n;
6381 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6382 n = alloc_instruction(ctx, OPCODE_UNIFORM_1F, 2);
6383 if (n) {
6384 n[1].i = location;
6385 n[2].f = x;
6386 }
6387 if (ctx->ExecuteFlag) {
6388 CALL_Uniform1f(ctx->Exec, (location, x));
6389 }
6390 }
6391
6392
6393 static void GLAPIENTRY
save_Uniform2fARB(GLint location,GLfloat x,GLfloat y)6394 save_Uniform2fARB(GLint location, GLfloat x, GLfloat y)
6395 {
6396 GET_CURRENT_CONTEXT(ctx);
6397 Node *n;
6398 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6399 n = alloc_instruction(ctx, OPCODE_UNIFORM_2F, 3);
6400 if (n) {
6401 n[1].i = location;
6402 n[2].f = x;
6403 n[3].f = y;
6404 }
6405 if (ctx->ExecuteFlag) {
6406 CALL_Uniform2f(ctx->Exec, (location, x, y));
6407 }
6408 }
6409
6410
6411 static void GLAPIENTRY
save_Uniform3fARB(GLint location,GLfloat x,GLfloat y,GLfloat z)6412 save_Uniform3fARB(GLint location, GLfloat x, GLfloat y, GLfloat z)
6413 {
6414 GET_CURRENT_CONTEXT(ctx);
6415 Node *n;
6416 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6417 n = alloc_instruction(ctx, OPCODE_UNIFORM_3F, 4);
6418 if (n) {
6419 n[1].i = location;
6420 n[2].f = x;
6421 n[3].f = y;
6422 n[4].f = z;
6423 }
6424 if (ctx->ExecuteFlag) {
6425 CALL_Uniform3f(ctx->Exec, (location, x, y, z));
6426 }
6427 }
6428
6429
6430 static void GLAPIENTRY
save_Uniform4fARB(GLint location,GLfloat x,GLfloat y,GLfloat z,GLfloat w)6431 save_Uniform4fARB(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
6432 {
6433 GET_CURRENT_CONTEXT(ctx);
6434 Node *n;
6435 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6436 n = alloc_instruction(ctx, OPCODE_UNIFORM_4F, 5);
6437 if (n) {
6438 n[1].i = location;
6439 n[2].f = x;
6440 n[3].f = y;
6441 n[4].f = z;
6442 n[5].f = w;
6443 }
6444 if (ctx->ExecuteFlag) {
6445 CALL_Uniform4f(ctx->Exec, (location, x, y, z, w));
6446 }
6447 }
6448
6449
6450 static void GLAPIENTRY
save_Uniform1fvARB(GLint location,GLsizei count,const GLfloat * v)6451 save_Uniform1fvARB(GLint location, GLsizei count, const GLfloat *v)
6452 {
6453 GET_CURRENT_CONTEXT(ctx);
6454 Node *n;
6455 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6456 n = alloc_instruction(ctx, OPCODE_UNIFORM_1FV, 2 + POINTER_DWORDS);
6457 if (n) {
6458 n[1].i = location;
6459 n[2].i = count;
6460 save_pointer(&n[3], memdup(v, count * 1 * sizeof(GLfloat)));
6461 }
6462 if (ctx->ExecuteFlag) {
6463 CALL_Uniform1fv(ctx->Exec, (location, count, v));
6464 }
6465 }
6466
6467 static void GLAPIENTRY
save_Uniform2fvARB(GLint location,GLsizei count,const GLfloat * v)6468 save_Uniform2fvARB(GLint location, GLsizei count, const GLfloat *v)
6469 {
6470 GET_CURRENT_CONTEXT(ctx);
6471 Node *n;
6472 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6473 n = alloc_instruction(ctx, OPCODE_UNIFORM_2FV, 2 + POINTER_DWORDS);
6474 if (n) {
6475 n[1].i = location;
6476 n[2].i = count;
6477 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLfloat)));
6478 }
6479 if (ctx->ExecuteFlag) {
6480 CALL_Uniform2fv(ctx->Exec, (location, count, v));
6481 }
6482 }
6483
6484 static void GLAPIENTRY
save_Uniform3fvARB(GLint location,GLsizei count,const GLfloat * v)6485 save_Uniform3fvARB(GLint location, GLsizei count, const GLfloat *v)
6486 {
6487 GET_CURRENT_CONTEXT(ctx);
6488 Node *n;
6489 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6490 n = alloc_instruction(ctx, OPCODE_UNIFORM_3FV, 2 + POINTER_DWORDS);
6491 if (n) {
6492 n[1].i = location;
6493 n[2].i = count;
6494 save_pointer(&n[3], memdup(v, count * 3 * sizeof(GLfloat)));
6495 }
6496 if (ctx->ExecuteFlag) {
6497 CALL_Uniform3fv(ctx->Exec, (location, count, v));
6498 }
6499 }
6500
6501 static void GLAPIENTRY
save_Uniform4fvARB(GLint location,GLsizei count,const GLfloat * v)6502 save_Uniform4fvARB(GLint location, GLsizei count, const GLfloat *v)
6503 {
6504 GET_CURRENT_CONTEXT(ctx);
6505 Node *n;
6506 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6507 n = alloc_instruction(ctx, OPCODE_UNIFORM_4FV, 2 + POINTER_DWORDS);
6508 if (n) {
6509 n[1].i = location;
6510 n[2].i = count;
6511 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLfloat)));
6512 }
6513 if (ctx->ExecuteFlag) {
6514 CALL_Uniform4fv(ctx->Exec, (location, count, v));
6515 }
6516 }
6517
6518
6519 static void GLAPIENTRY
save_Uniform1d(GLint location,GLdouble x)6520 save_Uniform1d(GLint location, GLdouble x)
6521 {
6522 GET_CURRENT_CONTEXT(ctx);
6523 Node *n;
6524 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6525 n = alloc_instruction(ctx, OPCODE_UNIFORM_1D, 3);
6526 if (n) {
6527 n[1].i = location;
6528 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
6529 }
6530 if (ctx->ExecuteFlag) {
6531 CALL_Uniform1d(ctx->Exec, (location, x));
6532 }
6533 }
6534
6535
6536 static void GLAPIENTRY
save_Uniform2d(GLint location,GLdouble x,GLdouble y)6537 save_Uniform2d(GLint location, GLdouble x, GLdouble y)
6538 {
6539 GET_CURRENT_CONTEXT(ctx);
6540 Node *n;
6541 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6542 n = alloc_instruction(ctx, OPCODE_UNIFORM_2D, 5);
6543 if (n) {
6544 n[1].i = location;
6545 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
6546 ASSIGN_DOUBLE_TO_NODES(n, 4, y);
6547 }
6548 if (ctx->ExecuteFlag) {
6549 CALL_Uniform2d(ctx->Exec, (location, x, y));
6550 }
6551 }
6552
6553
6554 static void GLAPIENTRY
save_Uniform3d(GLint location,GLdouble x,GLdouble y,GLdouble z)6555 save_Uniform3d(GLint location, GLdouble x, GLdouble y, GLdouble z)
6556 {
6557 GET_CURRENT_CONTEXT(ctx);
6558 Node *n;
6559 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6560 n = alloc_instruction(ctx, OPCODE_UNIFORM_3D, 7);
6561 if (n) {
6562 n[1].i = location;
6563 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
6564 ASSIGN_DOUBLE_TO_NODES(n, 4, y);
6565 ASSIGN_DOUBLE_TO_NODES(n, 6, z);
6566 }
6567 if (ctx->ExecuteFlag) {
6568 CALL_Uniform3d(ctx->Exec, (location, x, y, z));
6569 }
6570 }
6571
6572
6573 static void GLAPIENTRY
save_Uniform4d(GLint location,GLdouble x,GLdouble y,GLdouble z,GLdouble w)6574 save_Uniform4d(GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
6575 {
6576 GET_CURRENT_CONTEXT(ctx);
6577 Node *n;
6578 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6579 n = alloc_instruction(ctx, OPCODE_UNIFORM_4D, 9);
6580 if (n) {
6581 n[1].i = location;
6582 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
6583 ASSIGN_DOUBLE_TO_NODES(n, 4, y);
6584 ASSIGN_DOUBLE_TO_NODES(n, 6, z);
6585 ASSIGN_DOUBLE_TO_NODES(n, 8, w);
6586 }
6587 if (ctx->ExecuteFlag) {
6588 CALL_Uniform4d(ctx->Exec, (location, x, y, z, w));
6589 }
6590 }
6591
6592
6593 static void GLAPIENTRY
save_Uniform1dv(GLint location,GLsizei count,const GLdouble * v)6594 save_Uniform1dv(GLint location, GLsizei count, const GLdouble *v)
6595 {
6596 GET_CURRENT_CONTEXT(ctx);
6597 Node *n;
6598 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6599 n = alloc_instruction(ctx, OPCODE_UNIFORM_1DV, 2 + POINTER_DWORDS);
6600 if (n) {
6601 n[1].i = location;
6602 n[2].i = count;
6603 save_pointer(&n[3], memdup(v, count * 1 * sizeof(GLdouble)));
6604 }
6605 if (ctx->ExecuteFlag) {
6606 CALL_Uniform1dv(ctx->Exec, (location, count, v));
6607 }
6608 }
6609
6610
6611 static void GLAPIENTRY
save_Uniform2dv(GLint location,GLsizei count,const GLdouble * v)6612 save_Uniform2dv(GLint location, GLsizei count, const GLdouble *v)
6613 {
6614 GET_CURRENT_CONTEXT(ctx);
6615 Node *n;
6616 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6617 n = alloc_instruction(ctx, OPCODE_UNIFORM_2DV, 2 + POINTER_DWORDS);
6618 if (n) {
6619 n[1].i = location;
6620 n[2].i = count;
6621 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLdouble)));
6622 }
6623 if (ctx->ExecuteFlag) {
6624 CALL_Uniform2dv(ctx->Exec, (location, count, v));
6625 }
6626 }
6627
6628
6629 static void GLAPIENTRY
save_Uniform3dv(GLint location,GLsizei count,const GLdouble * v)6630 save_Uniform3dv(GLint location, GLsizei count, const GLdouble *v)
6631 {
6632 GET_CURRENT_CONTEXT(ctx);
6633 Node *n;
6634 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6635 n = alloc_instruction(ctx, OPCODE_UNIFORM_3DV, 2 + POINTER_DWORDS);
6636 if (n) {
6637 n[1].i = location;
6638 n[2].i = count;
6639 save_pointer(&n[3], memdup(v, count * 3 * sizeof(GLdouble)));
6640 }
6641 if (ctx->ExecuteFlag) {
6642 CALL_Uniform3dv(ctx->Exec, (location, count, v));
6643 }
6644 }
6645
6646
6647 static void GLAPIENTRY
save_Uniform4dv(GLint location,GLsizei count,const GLdouble * v)6648 save_Uniform4dv(GLint location, GLsizei count, const GLdouble *v)
6649 {
6650 GET_CURRENT_CONTEXT(ctx);
6651 Node *n;
6652 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6653 n = alloc_instruction(ctx, OPCODE_UNIFORM_4DV, 2 + POINTER_DWORDS);
6654 if (n) {
6655 n[1].i = location;
6656 n[2].i = count;
6657 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLdouble)));
6658 }
6659 if (ctx->ExecuteFlag) {
6660 CALL_Uniform4dv(ctx->Exec, (location, count, v));
6661 }
6662 }
6663
6664
6665 static void GLAPIENTRY
save_Uniform1iARB(GLint location,GLint x)6666 save_Uniform1iARB(GLint location, GLint x)
6667 {
6668 GET_CURRENT_CONTEXT(ctx);
6669 Node *n;
6670 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6671 n = alloc_instruction(ctx, OPCODE_UNIFORM_1I, 2);
6672 if (n) {
6673 n[1].i = location;
6674 n[2].i = x;
6675 }
6676 if (ctx->ExecuteFlag) {
6677 CALL_Uniform1i(ctx->Exec, (location, x));
6678 }
6679 }
6680
6681 static void GLAPIENTRY
save_Uniform2iARB(GLint location,GLint x,GLint y)6682 save_Uniform2iARB(GLint location, GLint x, GLint y)
6683 {
6684 GET_CURRENT_CONTEXT(ctx);
6685 Node *n;
6686 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6687 n = alloc_instruction(ctx, OPCODE_UNIFORM_2I, 3);
6688 if (n) {
6689 n[1].i = location;
6690 n[2].i = x;
6691 n[3].i = y;
6692 }
6693 if (ctx->ExecuteFlag) {
6694 CALL_Uniform2i(ctx->Exec, (location, x, y));
6695 }
6696 }
6697
6698 static void GLAPIENTRY
save_Uniform3iARB(GLint location,GLint x,GLint y,GLint z)6699 save_Uniform3iARB(GLint location, GLint x, GLint y, GLint z)
6700 {
6701 GET_CURRENT_CONTEXT(ctx);
6702 Node *n;
6703 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6704 n = alloc_instruction(ctx, OPCODE_UNIFORM_3I, 4);
6705 if (n) {
6706 n[1].i = location;
6707 n[2].i = x;
6708 n[3].i = y;
6709 n[4].i = z;
6710 }
6711 if (ctx->ExecuteFlag) {
6712 CALL_Uniform3i(ctx->Exec, (location, x, y, z));
6713 }
6714 }
6715
6716 static void GLAPIENTRY
save_Uniform4iARB(GLint location,GLint x,GLint y,GLint z,GLint w)6717 save_Uniform4iARB(GLint location, GLint x, GLint y, GLint z, GLint w)
6718 {
6719 GET_CURRENT_CONTEXT(ctx);
6720 Node *n;
6721 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6722 n = alloc_instruction(ctx, OPCODE_UNIFORM_4I, 5);
6723 if (n) {
6724 n[1].i = location;
6725 n[2].i = x;
6726 n[3].i = y;
6727 n[4].i = z;
6728 n[5].i = w;
6729 }
6730 if (ctx->ExecuteFlag) {
6731 CALL_Uniform4i(ctx->Exec, (location, x, y, z, w));
6732 }
6733 }
6734
6735
6736
6737 static void GLAPIENTRY
save_Uniform1ivARB(GLint location,GLsizei count,const GLint * v)6738 save_Uniform1ivARB(GLint location, GLsizei count, const GLint *v)
6739 {
6740 GET_CURRENT_CONTEXT(ctx);
6741 Node *n;
6742 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6743 n = alloc_instruction(ctx, OPCODE_UNIFORM_1IV, 2 + POINTER_DWORDS);
6744 if (n) {
6745 n[1].i = location;
6746 n[2].i = count;
6747 save_pointer(&n[3], memdup(v, count * 1 * sizeof(GLint)));
6748 }
6749 if (ctx->ExecuteFlag) {
6750 CALL_Uniform1iv(ctx->Exec, (location, count, v));
6751 }
6752 }
6753
6754 static void GLAPIENTRY
save_Uniform2ivARB(GLint location,GLsizei count,const GLint * v)6755 save_Uniform2ivARB(GLint location, GLsizei count, const GLint *v)
6756 {
6757 GET_CURRENT_CONTEXT(ctx);
6758 Node *n;
6759 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6760 n = alloc_instruction(ctx, OPCODE_UNIFORM_2IV, 2 + POINTER_DWORDS);
6761 if (n) {
6762 n[1].i = location;
6763 n[2].i = count;
6764 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLint)));
6765 }
6766 if (ctx->ExecuteFlag) {
6767 CALL_Uniform2iv(ctx->Exec, (location, count, v));
6768 }
6769 }
6770
6771 static void GLAPIENTRY
save_Uniform3ivARB(GLint location,GLsizei count,const GLint * v)6772 save_Uniform3ivARB(GLint location, GLsizei count, const GLint *v)
6773 {
6774 GET_CURRENT_CONTEXT(ctx);
6775 Node *n;
6776 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6777 n = alloc_instruction(ctx, OPCODE_UNIFORM_3IV, 2 + POINTER_DWORDS);
6778 if (n) {
6779 n[1].i = location;
6780 n[2].i = count;
6781 save_pointer(&n[3], memdup(v, count * 3 * sizeof(GLint)));
6782 }
6783 if (ctx->ExecuteFlag) {
6784 CALL_Uniform3iv(ctx->Exec, (location, count, v));
6785 }
6786 }
6787
6788 static void GLAPIENTRY
save_Uniform4ivARB(GLint location,GLsizei count,const GLint * v)6789 save_Uniform4ivARB(GLint location, GLsizei count, const GLint *v)
6790 {
6791 GET_CURRENT_CONTEXT(ctx);
6792 Node *n;
6793 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6794 n = alloc_instruction(ctx, OPCODE_UNIFORM_4IV, 2 + POINTER_DWORDS);
6795 if (n) {
6796 n[1].i = location;
6797 n[2].i = count;
6798 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLfloat)));
6799 }
6800 if (ctx->ExecuteFlag) {
6801 CALL_Uniform4iv(ctx->Exec, (location, count, v));
6802 }
6803 }
6804
6805
6806
6807 static void GLAPIENTRY
save_Uniform1ui(GLint location,GLuint x)6808 save_Uniform1ui(GLint location, GLuint x)
6809 {
6810 GET_CURRENT_CONTEXT(ctx);
6811 Node *n;
6812 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6813 n = alloc_instruction(ctx, OPCODE_UNIFORM_1UI, 2);
6814 if (n) {
6815 n[1].i = location;
6816 n[2].i = x;
6817 }
6818 if (ctx->ExecuteFlag) {
6819 CALL_Uniform1ui(ctx->Exec, (location, x));
6820 }
6821 }
6822
6823 static void GLAPIENTRY
save_Uniform2ui(GLint location,GLuint x,GLuint y)6824 save_Uniform2ui(GLint location, GLuint x, GLuint y)
6825 {
6826 GET_CURRENT_CONTEXT(ctx);
6827 Node *n;
6828 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6829 n = alloc_instruction(ctx, OPCODE_UNIFORM_2UI, 3);
6830 if (n) {
6831 n[1].i = location;
6832 n[2].i = x;
6833 n[3].i = y;
6834 }
6835 if (ctx->ExecuteFlag) {
6836 CALL_Uniform2ui(ctx->Exec, (location, x, y));
6837 }
6838 }
6839
6840 static void GLAPIENTRY
save_Uniform3ui(GLint location,GLuint x,GLuint y,GLuint z)6841 save_Uniform3ui(GLint location, GLuint x, GLuint y, GLuint z)
6842 {
6843 GET_CURRENT_CONTEXT(ctx);
6844 Node *n;
6845 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6846 n = alloc_instruction(ctx, OPCODE_UNIFORM_3UI, 4);
6847 if (n) {
6848 n[1].i = location;
6849 n[2].i = x;
6850 n[3].i = y;
6851 n[4].i = z;
6852 }
6853 if (ctx->ExecuteFlag) {
6854 CALL_Uniform3ui(ctx->Exec, (location, x, y, z));
6855 }
6856 }
6857
6858 static void GLAPIENTRY
save_Uniform4ui(GLint location,GLuint x,GLuint y,GLuint z,GLuint w)6859 save_Uniform4ui(GLint location, GLuint x, GLuint y, GLuint z, GLuint w)
6860 {
6861 GET_CURRENT_CONTEXT(ctx);
6862 Node *n;
6863 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6864 n = alloc_instruction(ctx, OPCODE_UNIFORM_4UI, 5);
6865 if (n) {
6866 n[1].i = location;
6867 n[2].i = x;
6868 n[3].i = y;
6869 n[4].i = z;
6870 n[5].i = w;
6871 }
6872 if (ctx->ExecuteFlag) {
6873 CALL_Uniform4ui(ctx->Exec, (location, x, y, z, w));
6874 }
6875 }
6876
6877
6878
6879 static void GLAPIENTRY
save_Uniform1uiv(GLint location,GLsizei count,const GLuint * v)6880 save_Uniform1uiv(GLint location, GLsizei count, const GLuint *v)
6881 {
6882 GET_CURRENT_CONTEXT(ctx);
6883 Node *n;
6884 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6885 n = alloc_instruction(ctx, OPCODE_UNIFORM_1UIV, 2 + POINTER_DWORDS);
6886 if (n) {
6887 n[1].i = location;
6888 n[2].i = count;
6889 save_pointer(&n[3], memdup(v, count * 1 * sizeof(*v)));
6890 }
6891 if (ctx->ExecuteFlag) {
6892 CALL_Uniform1uiv(ctx->Exec, (location, count, v));
6893 }
6894 }
6895
6896 static void GLAPIENTRY
save_Uniform2uiv(GLint location,GLsizei count,const GLuint * v)6897 save_Uniform2uiv(GLint location, GLsizei count, const GLuint *v)
6898 {
6899 GET_CURRENT_CONTEXT(ctx);
6900 Node *n;
6901 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6902 n = alloc_instruction(ctx, OPCODE_UNIFORM_2UIV, 2 + POINTER_DWORDS);
6903 if (n) {
6904 n[1].i = location;
6905 n[2].i = count;
6906 save_pointer(&n[3], memdup(v, count * 2 * sizeof(*v)));
6907 }
6908 if (ctx->ExecuteFlag) {
6909 CALL_Uniform2uiv(ctx->Exec, (location, count, v));
6910 }
6911 }
6912
6913 static void GLAPIENTRY
save_Uniform3uiv(GLint location,GLsizei count,const GLuint * v)6914 save_Uniform3uiv(GLint location, GLsizei count, const GLuint *v)
6915 {
6916 GET_CURRENT_CONTEXT(ctx);
6917 Node *n;
6918 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6919 n = alloc_instruction(ctx, OPCODE_UNIFORM_3UIV, 2 + POINTER_DWORDS);
6920 if (n) {
6921 n[1].i = location;
6922 n[2].i = count;
6923 save_pointer(&n[3], memdup(v, count * 3 * sizeof(*v)));
6924 }
6925 if (ctx->ExecuteFlag) {
6926 CALL_Uniform3uiv(ctx->Exec, (location, count, v));
6927 }
6928 }
6929
6930 static void GLAPIENTRY
save_Uniform4uiv(GLint location,GLsizei count,const GLuint * v)6931 save_Uniform4uiv(GLint location, GLsizei count, const GLuint *v)
6932 {
6933 GET_CURRENT_CONTEXT(ctx);
6934 Node *n;
6935 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6936 n = alloc_instruction(ctx, OPCODE_UNIFORM_4UIV, 2 + POINTER_DWORDS);
6937 if (n) {
6938 n[1].i = location;
6939 n[2].i = count;
6940 save_pointer(&n[3], memdup(v, count * 4 * sizeof(*v)));
6941 }
6942 if (ctx->ExecuteFlag) {
6943 CALL_Uniform4uiv(ctx->Exec, (location, count, v));
6944 }
6945 }
6946
6947
6948
6949 static void GLAPIENTRY
save_UniformMatrix2fvARB(GLint location,GLsizei count,GLboolean transpose,const GLfloat * m)6950 save_UniformMatrix2fvARB(GLint location, GLsizei count, GLboolean transpose,
6951 const GLfloat *m)
6952 {
6953 GET_CURRENT_CONTEXT(ctx);
6954 Node *n;
6955 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6956 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX22, 3 + POINTER_DWORDS);
6957 if (n) {
6958 n[1].i = location;
6959 n[2].i = count;
6960 n[3].b = transpose;
6961 save_pointer(&n[4], memdup(m, count * 2 * 2 * sizeof(GLfloat)));
6962 }
6963 if (ctx->ExecuteFlag) {
6964 CALL_UniformMatrix2fv(ctx->Exec, (location, count, transpose, m));
6965 }
6966 }
6967
6968 static void GLAPIENTRY
save_UniformMatrix3fvARB(GLint location,GLsizei count,GLboolean transpose,const GLfloat * m)6969 save_UniformMatrix3fvARB(GLint location, GLsizei count, GLboolean transpose,
6970 const GLfloat *m)
6971 {
6972 GET_CURRENT_CONTEXT(ctx);
6973 Node *n;
6974 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6975 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX33, 3 + POINTER_DWORDS);
6976 if (n) {
6977 n[1].i = location;
6978 n[2].i = count;
6979 n[3].b = transpose;
6980 save_pointer(&n[4], memdup(m, count * 3 * 3 * sizeof(GLfloat)));
6981 }
6982 if (ctx->ExecuteFlag) {
6983 CALL_UniformMatrix3fv(ctx->Exec, (location, count, transpose, m));
6984 }
6985 }
6986
6987 static void GLAPIENTRY
save_UniformMatrix4fvARB(GLint location,GLsizei count,GLboolean transpose,const GLfloat * m)6988 save_UniformMatrix4fvARB(GLint location, GLsizei count, GLboolean transpose,
6989 const GLfloat *m)
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_MATRIX44, 3 + POINTER_DWORDS);
6995 if (n) {
6996 n[1].i = location;
6997 n[2].i = count;
6998 n[3].b = transpose;
6999 save_pointer(&n[4], memdup(m, count * 4 * 4 * sizeof(GLfloat)));
7000 }
7001 if (ctx->ExecuteFlag) {
7002 CALL_UniformMatrix4fv(ctx->Exec, (location, count, transpose, m));
7003 }
7004 }
7005
7006
7007 static void GLAPIENTRY
save_UniformMatrix2x3fv(GLint location,GLsizei count,GLboolean transpose,const GLfloat * m)7008 save_UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose,
7009 const GLfloat *m)
7010 {
7011 GET_CURRENT_CONTEXT(ctx);
7012 Node *n;
7013 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7014 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX23, 3 + POINTER_DWORDS);
7015 if (n) {
7016 n[1].i = location;
7017 n[2].i = count;
7018 n[3].b = transpose;
7019 save_pointer(&n[4], memdup(m, count * 2 * 3 * sizeof(GLfloat)));
7020 }
7021 if (ctx->ExecuteFlag) {
7022 CALL_UniformMatrix2x3fv(ctx->Exec, (location, count, transpose, m));
7023 }
7024 }
7025
7026 static void GLAPIENTRY
save_UniformMatrix3x2fv(GLint location,GLsizei count,GLboolean transpose,const GLfloat * m)7027 save_UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose,
7028 const GLfloat *m)
7029 {
7030 GET_CURRENT_CONTEXT(ctx);
7031 Node *n;
7032 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7033 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX32, 3 + POINTER_DWORDS);
7034 if (n) {
7035 n[1].i = location;
7036 n[2].i = count;
7037 n[3].b = transpose;
7038 save_pointer(&n[4], memdup(m, count * 3 * 2 * sizeof(GLfloat)));
7039 }
7040 if (ctx->ExecuteFlag) {
7041 CALL_UniformMatrix3x2fv(ctx->Exec, (location, count, transpose, m));
7042 }
7043 }
7044
7045
7046 static void GLAPIENTRY
save_UniformMatrix2x4fv(GLint location,GLsizei count,GLboolean transpose,const GLfloat * m)7047 save_UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose,
7048 const GLfloat *m)
7049 {
7050 GET_CURRENT_CONTEXT(ctx);
7051 Node *n;
7052 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7053 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX24, 3 + POINTER_DWORDS);
7054 if (n) {
7055 n[1].i = location;
7056 n[2].i = count;
7057 n[3].b = transpose;
7058 save_pointer(&n[4], memdup(m, count * 2 * 4 * sizeof(GLfloat)));
7059 }
7060 if (ctx->ExecuteFlag) {
7061 CALL_UniformMatrix2x4fv(ctx->Exec, (location, count, transpose, m));
7062 }
7063 }
7064
7065 static void GLAPIENTRY
save_UniformMatrix4x2fv(GLint location,GLsizei count,GLboolean transpose,const GLfloat * m)7066 save_UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose,
7067 const GLfloat *m)
7068 {
7069 GET_CURRENT_CONTEXT(ctx);
7070 Node *n;
7071 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7072 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX42, 3 + POINTER_DWORDS);
7073 if (n) {
7074 n[1].i = location;
7075 n[2].i = count;
7076 n[3].b = transpose;
7077 save_pointer(&n[4], memdup(m, count * 4 * 2 * sizeof(GLfloat)));
7078 }
7079 if (ctx->ExecuteFlag) {
7080 CALL_UniformMatrix4x2fv(ctx->Exec, (location, count, transpose, m));
7081 }
7082 }
7083
7084
7085 static void GLAPIENTRY
save_UniformMatrix3x4fv(GLint location,GLsizei count,GLboolean transpose,const GLfloat * m)7086 save_UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose,
7087 const GLfloat *m)
7088 {
7089 GET_CURRENT_CONTEXT(ctx);
7090 Node *n;
7091 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7092 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX34, 3 + POINTER_DWORDS);
7093 if (n) {
7094 n[1].i = location;
7095 n[2].i = count;
7096 n[3].b = transpose;
7097 save_pointer(&n[4], memdup(m, count * 3 * 4 * sizeof(GLfloat)));
7098 }
7099 if (ctx->ExecuteFlag) {
7100 CALL_UniformMatrix3x4fv(ctx->Exec, (location, count, transpose, m));
7101 }
7102 }
7103
7104 static void GLAPIENTRY
save_UniformMatrix4x3fv(GLint location,GLsizei count,GLboolean transpose,const GLfloat * m)7105 save_UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose,
7106 const GLfloat *m)
7107 {
7108 GET_CURRENT_CONTEXT(ctx);
7109 Node *n;
7110 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7111 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX43, 3 + POINTER_DWORDS);
7112 if (n) {
7113 n[1].i = location;
7114 n[2].i = count;
7115 n[3].b = transpose;
7116 save_pointer(&n[4], memdup(m, count * 4 * 3 * sizeof(GLfloat)));
7117 }
7118 if (ctx->ExecuteFlag) {
7119 CALL_UniformMatrix4x3fv(ctx->Exec, (location, count, transpose, m));
7120 }
7121 }
7122
7123
7124 static void GLAPIENTRY
save_UniformMatrix2dv(GLint location,GLsizei count,GLboolean transpose,const GLdouble * m)7125 save_UniformMatrix2dv(GLint location, GLsizei count, GLboolean transpose,
7126 const GLdouble *m)
7127 {
7128 GET_CURRENT_CONTEXT(ctx);
7129 Node *n;
7130 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7131 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX22D, 3 + POINTER_DWORDS);
7132 if (n) {
7133 n[1].i = location;
7134 n[2].i = count;
7135 n[3].b = transpose;
7136 save_pointer(&n[4], memdup(m, count * 2 * 2 * sizeof(GLdouble)));
7137 }
7138 if (ctx->ExecuteFlag) {
7139 CALL_UniformMatrix2dv(ctx->Exec, (location, count, transpose, m));
7140 }
7141 }
7142
7143 static void GLAPIENTRY
save_UniformMatrix3dv(GLint location,GLsizei count,GLboolean transpose,const GLdouble * m)7144 save_UniformMatrix3dv(GLint location, GLsizei count, GLboolean transpose,
7145 const GLdouble *m)
7146 {
7147 GET_CURRENT_CONTEXT(ctx);
7148 Node *n;
7149 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7150 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX33D, 3 + POINTER_DWORDS);
7151 if (n) {
7152 n[1].i = location;
7153 n[2].i = count;
7154 n[3].b = transpose;
7155 save_pointer(&n[4], memdup(m, count * 3 * 3 * sizeof(GLdouble)));
7156 }
7157 if (ctx->ExecuteFlag) {
7158 CALL_UniformMatrix3dv(ctx->Exec, (location, count, transpose, m));
7159 }
7160 }
7161
7162 static void GLAPIENTRY
save_UniformMatrix4dv(GLint location,GLsizei count,GLboolean transpose,const GLdouble * m)7163 save_UniformMatrix4dv(GLint location, GLsizei count, GLboolean transpose,
7164 const GLdouble *m)
7165 {
7166 GET_CURRENT_CONTEXT(ctx);
7167 Node *n;
7168 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7169 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX44D, 3 + POINTER_DWORDS);
7170 if (n) {
7171 n[1].i = location;
7172 n[2].i = count;
7173 n[3].b = transpose;
7174 save_pointer(&n[4], memdup(m, count * 4 * 4 * sizeof(GLdouble)));
7175 }
7176 if (ctx->ExecuteFlag) {
7177 CALL_UniformMatrix4dv(ctx->Exec, (location, count, transpose, m));
7178 }
7179 }
7180
7181
7182 static void GLAPIENTRY
save_UniformMatrix2x3dv(GLint location,GLsizei count,GLboolean transpose,const GLdouble * m)7183 save_UniformMatrix2x3dv(GLint location, GLsizei count, GLboolean transpose,
7184 const GLdouble *m)
7185 {
7186 GET_CURRENT_CONTEXT(ctx);
7187 Node *n;
7188 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7189 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX23D, 3 + POINTER_DWORDS);
7190 if (n) {
7191 n[1].i = location;
7192 n[2].i = count;
7193 n[3].b = transpose;
7194 save_pointer(&n[4], memdup(m, count * 2 * 3 * sizeof(GLdouble)));
7195 }
7196 if (ctx->ExecuteFlag) {
7197 CALL_UniformMatrix2x3dv(ctx->Exec, (location, count, transpose, m));
7198 }
7199 }
7200
7201
7202 static void GLAPIENTRY
save_UniformMatrix3x2dv(GLint location,GLsizei count,GLboolean transpose,const GLdouble * m)7203 save_UniformMatrix3x2dv(GLint location, GLsizei count, GLboolean transpose,
7204 const GLdouble *m)
7205 {
7206 GET_CURRENT_CONTEXT(ctx);
7207 Node *n;
7208 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7209 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX32D, 3 + POINTER_DWORDS);
7210 if (n) {
7211 n[1].i = location;
7212 n[2].i = count;
7213 n[3].b = transpose;
7214 save_pointer(&n[4], memdup(m, count * 3 * 2 * sizeof(GLdouble)));
7215 }
7216 if (ctx->ExecuteFlag) {
7217 CALL_UniformMatrix3x2dv(ctx->Exec, (location, count, transpose, m));
7218 }
7219 }
7220
7221
7222 static void GLAPIENTRY
save_UniformMatrix2x4dv(GLint location,GLsizei count,GLboolean transpose,const GLdouble * m)7223 save_UniformMatrix2x4dv(GLint location, GLsizei count, GLboolean transpose,
7224 const GLdouble *m)
7225 {
7226 GET_CURRENT_CONTEXT(ctx);
7227 Node *n;
7228 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7229 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX24D, 3 + POINTER_DWORDS);
7230 if (n) {
7231 n[1].i = location;
7232 n[2].i = count;
7233 n[3].b = transpose;
7234 save_pointer(&n[4], memdup(m, count * 2 * 4 * sizeof(GLdouble)));
7235 }
7236 if (ctx->ExecuteFlag) {
7237 CALL_UniformMatrix2x4dv(ctx->Exec, (location, count, transpose, m));
7238 }
7239 }
7240
7241 static void GLAPIENTRY
save_UniformMatrix4x2dv(GLint location,GLsizei count,GLboolean transpose,const GLdouble * m)7242 save_UniformMatrix4x2dv(GLint location, GLsizei count, GLboolean transpose,
7243 const GLdouble *m)
7244 {
7245 GET_CURRENT_CONTEXT(ctx);
7246 Node *n;
7247 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7248 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX42D, 3 + POINTER_DWORDS);
7249 if (n) {
7250 n[1].i = location;
7251 n[2].i = count;
7252 n[3].b = transpose;
7253 save_pointer(&n[4], memdup(m, count * 4 * 2 * sizeof(GLdouble)));
7254 }
7255 if (ctx->ExecuteFlag) {
7256 CALL_UniformMatrix4x2dv(ctx->Exec, (location, count, transpose, m));
7257 }
7258 }
7259
7260
7261 static void GLAPIENTRY
save_UniformMatrix3x4dv(GLint location,GLsizei count,GLboolean transpose,const GLdouble * m)7262 save_UniformMatrix3x4dv(GLint location, GLsizei count, GLboolean transpose,
7263 const GLdouble *m)
7264 {
7265 GET_CURRENT_CONTEXT(ctx);
7266 Node *n;
7267 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7268 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX34D, 3 + POINTER_DWORDS);
7269 if (n) {
7270 n[1].i = location;
7271 n[2].i = count;
7272 n[3].b = transpose;
7273 save_pointer(&n[4], memdup(m, count * 3 * 4 * sizeof(GLdouble)));
7274 }
7275 if (ctx->ExecuteFlag) {
7276 CALL_UniformMatrix3x4dv(ctx->Exec, (location, count, transpose, m));
7277 }
7278 }
7279
7280
7281 static void GLAPIENTRY
save_UniformMatrix4x3dv(GLint location,GLsizei count,GLboolean transpose,const GLdouble * m)7282 save_UniformMatrix4x3dv(GLint location, GLsizei count, GLboolean transpose,
7283 const GLdouble *m)
7284 {
7285 GET_CURRENT_CONTEXT(ctx);
7286 Node *n;
7287 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7288 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX43D, 3 + POINTER_DWORDS);
7289 if (n) {
7290 n[1].i = location;
7291 n[2].i = count;
7292 n[3].b = transpose;
7293 save_pointer(&n[4], memdup(m, count * 4 * 3 * sizeof(GLdouble)));
7294 }
7295 if (ctx->ExecuteFlag) {
7296 CALL_UniformMatrix4x3dv(ctx->Exec, (location, count, transpose, m));
7297 }
7298 }
7299
7300 static void GLAPIENTRY
save_Uniform1i64ARB(GLint location,GLint64 x)7301 save_Uniform1i64ARB(GLint location, GLint64 x)
7302 {
7303 GET_CURRENT_CONTEXT(ctx);
7304 Node *n;
7305 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7306 n = alloc_instruction(ctx, OPCODE_UNIFORM_1I64, 3);
7307 if (n) {
7308 n[1].i = location;
7309 ASSIGN_INT64_TO_NODES(n, 2, x);
7310 }
7311 if (ctx->ExecuteFlag) {
7312 CALL_Uniform1i64ARB(ctx->Exec, (location, x));
7313 }
7314 }
7315
7316 static void GLAPIENTRY
save_Uniform2i64ARB(GLint location,GLint64 x,GLint64 y)7317 save_Uniform2i64ARB(GLint location, GLint64 x, GLint64 y)
7318 {
7319 GET_CURRENT_CONTEXT(ctx);
7320 Node *n;
7321 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7322 n = alloc_instruction(ctx, OPCODE_UNIFORM_2I64, 5);
7323 if (n) {
7324 n[1].i = location;
7325 ASSIGN_INT64_TO_NODES(n, 2, x);
7326 ASSIGN_INT64_TO_NODES(n, 4, y);
7327 }
7328 if (ctx->ExecuteFlag) {
7329 CALL_Uniform2i64ARB(ctx->Exec, (location, x, y));
7330 }
7331 }
7332
7333 static void GLAPIENTRY
save_Uniform3i64ARB(GLint location,GLint64 x,GLint64 y,GLint64 z)7334 save_Uniform3i64ARB(GLint location, GLint64 x, GLint64 y, GLint64 z)
7335 {
7336 GET_CURRENT_CONTEXT(ctx);
7337 Node *n;
7338 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7339 n = alloc_instruction(ctx, OPCODE_UNIFORM_3I64, 7);
7340 if (n) {
7341 n[1].i = location;
7342 ASSIGN_INT64_TO_NODES(n, 2, x);
7343 ASSIGN_INT64_TO_NODES(n, 4, y);
7344 ASSIGN_INT64_TO_NODES(n, 6, z);
7345 }
7346 if (ctx->ExecuteFlag) {
7347 CALL_Uniform3i64ARB(ctx->Exec, (location, x, y, z));
7348 }
7349 }
7350
7351 static void GLAPIENTRY
save_Uniform4i64ARB(GLint location,GLint64 x,GLint64 y,GLint64 z,GLint64 w)7352 save_Uniform4i64ARB(GLint location, GLint64 x, GLint64 y, GLint64 z, GLint64 w)
7353 {
7354 GET_CURRENT_CONTEXT(ctx);
7355 Node *n;
7356 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7357 n = alloc_instruction(ctx, OPCODE_UNIFORM_4I64, 9);
7358 if (n) {
7359 n[1].i = location;
7360 ASSIGN_INT64_TO_NODES(n, 2, x);
7361 ASSIGN_INT64_TO_NODES(n, 4, y);
7362 ASSIGN_INT64_TO_NODES(n, 6, z);
7363 ASSIGN_INT64_TO_NODES(n, 8, w);
7364 }
7365 if (ctx->ExecuteFlag) {
7366 CALL_Uniform4i64ARB(ctx->Exec, (location, x, y, z, w));
7367 }
7368 }
7369
7370 static void GLAPIENTRY
save_Uniform1i64vARB(GLint location,GLsizei count,const GLint64 * v)7371 save_Uniform1i64vARB(GLint location, GLsizei count, const GLint64 *v)
7372 {
7373 GET_CURRENT_CONTEXT(ctx);
7374 Node *n;
7375 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7376 n = alloc_instruction(ctx, OPCODE_UNIFORM_1I64V, 2 + POINTER_DWORDS);
7377 if (n) {
7378 n[1].i = location;
7379 n[2].i = count;
7380 save_pointer(&n[3], memdup(v, count * 1 * sizeof(GLint64)));
7381 }
7382 if (ctx->ExecuteFlag) {
7383 CALL_Uniform1i64vARB(ctx->Exec, (location, count, v));
7384 }
7385 }
7386
7387 static void GLAPIENTRY
save_Uniform2i64vARB(GLint location,GLsizei count,const GLint64 * v)7388 save_Uniform2i64vARB(GLint location, GLsizei count, const GLint64 *v)
7389 {
7390 GET_CURRENT_CONTEXT(ctx);
7391 Node *n;
7392 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7393 n = alloc_instruction(ctx, OPCODE_UNIFORM_2I64V, 2 + POINTER_DWORDS);
7394 if (n) {
7395 n[1].i = location;
7396 n[2].i = count;
7397 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLint64)));
7398 }
7399 if (ctx->ExecuteFlag) {
7400 CALL_Uniform2i64vARB(ctx->Exec, (location, count, v));
7401 }
7402 }
7403
7404 static void GLAPIENTRY
save_Uniform3i64vARB(GLint location,GLsizei count,const GLint64 * v)7405 save_Uniform3i64vARB(GLint location, GLsizei count, const GLint64 *v)
7406 {
7407 GET_CURRENT_CONTEXT(ctx);
7408 Node *n;
7409 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7410 n = alloc_instruction(ctx, OPCODE_UNIFORM_3I64V, 2 + POINTER_DWORDS);
7411 if (n) {
7412 n[1].i = location;
7413 n[2].i = count;
7414 save_pointer(&n[3], memdup(v, count * 3 * sizeof(GLint64)));
7415 }
7416 if (ctx->ExecuteFlag) {
7417 CALL_Uniform3i64vARB(ctx->Exec, (location, count, v));
7418 }
7419 }
7420
7421 static void GLAPIENTRY
save_Uniform4i64vARB(GLint location,GLsizei count,const GLint64 * v)7422 save_Uniform4i64vARB(GLint location, GLsizei count, const GLint64 *v)
7423 {
7424 GET_CURRENT_CONTEXT(ctx);
7425 Node *n;
7426 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7427 n = alloc_instruction(ctx, OPCODE_UNIFORM_4I64V, 2 + POINTER_DWORDS);
7428 if (n) {
7429 n[1].i = location;
7430 n[2].i = count;
7431 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLint64)));
7432 }
7433 if (ctx->ExecuteFlag) {
7434 CALL_Uniform4i64vARB(ctx->Exec, (location, count, v));
7435 }
7436 }
7437
7438 static void GLAPIENTRY
save_Uniform1ui64ARB(GLint location,GLuint64 x)7439 save_Uniform1ui64ARB(GLint location, GLuint64 x)
7440 {
7441 GET_CURRENT_CONTEXT(ctx);
7442 Node *n;
7443 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7444 n = alloc_instruction(ctx, OPCODE_UNIFORM_1UI64, 3);
7445 if (n) {
7446 n[1].i = location;
7447 ASSIGN_UINT64_TO_NODES(n, 2, x);
7448 }
7449 if (ctx->ExecuteFlag) {
7450 CALL_Uniform1ui64ARB(ctx->Exec, (location, x));
7451 }
7452 }
7453
7454 static void GLAPIENTRY
save_Uniform2ui64ARB(GLint location,GLuint64 x,GLuint64 y)7455 save_Uniform2ui64ARB(GLint location, GLuint64 x, GLuint64 y)
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_2UI64, 5);
7461 if (n) {
7462 n[1].i = location;
7463 ASSIGN_UINT64_TO_NODES(n, 2, x);
7464 ASSIGN_UINT64_TO_NODES(n, 4, y);
7465 }
7466 if (ctx->ExecuteFlag) {
7467 CALL_Uniform2ui64ARB(ctx->Exec, (location, x, y));
7468 }
7469 }
7470
7471 static void GLAPIENTRY
save_Uniform3ui64ARB(GLint location,GLuint64 x,GLuint64 y,GLuint64 z)7472 save_Uniform3ui64ARB(GLint location, GLuint64 x, GLuint64 y, GLuint64 z)
7473 {
7474 GET_CURRENT_CONTEXT(ctx);
7475 Node *n;
7476 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7477 n = alloc_instruction(ctx, OPCODE_UNIFORM_3UI64, 7);
7478 if (n) {
7479 n[1].i = location;
7480 ASSIGN_UINT64_TO_NODES(n, 2, x);
7481 ASSIGN_UINT64_TO_NODES(n, 4, y);
7482 ASSIGN_UINT64_TO_NODES(n, 6, z);
7483 }
7484 if (ctx->ExecuteFlag) {
7485 CALL_Uniform3ui64ARB(ctx->Exec, (location, x, y, z));
7486 }
7487 }
7488
7489 static void GLAPIENTRY
save_Uniform4ui64ARB(GLint location,GLuint64 x,GLuint64 y,GLuint64 z,GLuint64 w)7490 save_Uniform4ui64ARB(GLint location, GLuint64 x, GLuint64 y, GLuint64 z, GLuint64 w)
7491 {
7492 GET_CURRENT_CONTEXT(ctx);
7493 Node *n;
7494 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7495 n = alloc_instruction(ctx, OPCODE_UNIFORM_4UI64, 9);
7496 if (n) {
7497 n[1].i = location;
7498 ASSIGN_UINT64_TO_NODES(n, 2, x);
7499 ASSIGN_UINT64_TO_NODES(n, 4, y);
7500 ASSIGN_UINT64_TO_NODES(n, 6, z);
7501 ASSIGN_UINT64_TO_NODES(n, 8, w);
7502 }
7503 if (ctx->ExecuteFlag) {
7504 CALL_Uniform4ui64ARB(ctx->Exec, (location, x, y, z, w));
7505 }
7506 }
7507
7508 static void GLAPIENTRY
save_Uniform1ui64vARB(GLint location,GLsizei count,const GLuint64 * v)7509 save_Uniform1ui64vARB(GLint location, GLsizei count, const GLuint64 *v)
7510 {
7511 GET_CURRENT_CONTEXT(ctx);
7512 Node *n;
7513 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7514 n = alloc_instruction(ctx, OPCODE_UNIFORM_1UI64V, 2 + POINTER_DWORDS);
7515 if (n) {
7516 n[1].i = location;
7517 n[2].i = count;
7518 save_pointer(&n[3], memdup(v, count * 1 * sizeof(GLuint64)));
7519 }
7520 if (ctx->ExecuteFlag) {
7521 CALL_Uniform1ui64vARB(ctx->Exec, (location, count, v));
7522 }
7523 }
7524
7525 static void GLAPIENTRY
save_Uniform2ui64vARB(GLint location,GLsizei count,const GLuint64 * v)7526 save_Uniform2ui64vARB(GLint location, GLsizei count, const GLuint64 *v)
7527 {
7528 GET_CURRENT_CONTEXT(ctx);
7529 Node *n;
7530 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7531 n = alloc_instruction(ctx, OPCODE_UNIFORM_2UI64V, 2 + POINTER_DWORDS);
7532 if (n) {
7533 n[1].i = location;
7534 n[2].i = count;
7535 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLuint64)));
7536 }
7537 if (ctx->ExecuteFlag) {
7538 CALL_Uniform2ui64vARB(ctx->Exec, (location, count, v));
7539 }
7540 }
7541
7542 static void GLAPIENTRY
save_Uniform3ui64vARB(GLint location,GLsizei count,const GLuint64 * v)7543 save_Uniform3ui64vARB(GLint location, GLsizei count, const GLuint64 *v)
7544 {
7545 GET_CURRENT_CONTEXT(ctx);
7546 Node *n;
7547 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7548 n = alloc_instruction(ctx, OPCODE_UNIFORM_3UI64V, 2 + POINTER_DWORDS);
7549 if (n) {
7550 n[1].i = location;
7551 n[2].i = count;
7552 save_pointer(&n[3], memdup(v, count * 3 * sizeof(GLuint64)));
7553 }
7554 if (ctx->ExecuteFlag) {
7555 CALL_Uniform3ui64vARB(ctx->Exec, (location, count, v));
7556 }
7557 }
7558
7559 static void GLAPIENTRY
save_Uniform4ui64vARB(GLint location,GLsizei count,const GLuint64 * v)7560 save_Uniform4ui64vARB(GLint location, GLsizei count, const GLuint64 *v)
7561 {
7562 GET_CURRENT_CONTEXT(ctx);
7563 Node *n;
7564 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7565 n = alloc_instruction(ctx, OPCODE_UNIFORM_4UI64V, 2 + POINTER_DWORDS);
7566 if (n) {
7567 n[1].i = location;
7568 n[2].i = count;
7569 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLuint64)));
7570 }
7571 if (ctx->ExecuteFlag) {
7572 CALL_Uniform4ui64vARB(ctx->Exec, (location, count, v));
7573 }
7574 }
7575
7576 static void GLAPIENTRY
save_ProgramUniform1i64ARB(GLuint program,GLint location,GLint64 x)7577 save_ProgramUniform1i64ARB(GLuint program, GLint location, GLint64 x)
7578 {
7579 GET_CURRENT_CONTEXT(ctx);
7580 Node *n;
7581 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7582 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1I64, 4);
7583 if (n) {
7584 n[1].ui = program;
7585 n[2].i = location;
7586 ASSIGN_INT64_TO_NODES(n, 3, x);
7587 }
7588 if (ctx->ExecuteFlag) {
7589 CALL_ProgramUniform1i64ARB(ctx->Exec, (program, location, x));
7590 }
7591 }
7592
7593 static void GLAPIENTRY
save_ProgramUniform2i64ARB(GLuint program,GLint location,GLint64 x,GLint64 y)7594 save_ProgramUniform2i64ARB(GLuint program, GLint location, GLint64 x,
7595 GLint64 y)
7596 {
7597 GET_CURRENT_CONTEXT(ctx);
7598 Node *n;
7599 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7600 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2I64, 6);
7601 if (n) {
7602 n[1].ui = program;
7603 n[2].i = location;
7604 ASSIGN_INT64_TO_NODES(n, 3, x);
7605 ASSIGN_INT64_TO_NODES(n, 5, y);
7606 }
7607 if (ctx->ExecuteFlag) {
7608 CALL_ProgramUniform2i64ARB(ctx->Exec, (program, location, x, y));
7609 }
7610 }
7611
7612 static void GLAPIENTRY
save_ProgramUniform3i64ARB(GLuint program,GLint location,GLint64 x,GLint64 y,GLint64 z)7613 save_ProgramUniform3i64ARB(GLuint program, GLint location, GLint64 x,
7614 GLint64 y, GLint64 z)
7615 {
7616 GET_CURRENT_CONTEXT(ctx);
7617 Node *n;
7618 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7619 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3I64, 8);
7620 if (n) {
7621 n[1].ui = program;
7622 n[2].i = location;
7623 ASSIGN_INT64_TO_NODES(n, 3, x);
7624 ASSIGN_INT64_TO_NODES(n, 5, y);
7625 ASSIGN_INT64_TO_NODES(n, 7, z);
7626 }
7627 if (ctx->ExecuteFlag) {
7628 CALL_ProgramUniform3i64ARB(ctx->Exec, (program, location, x, y, z));
7629 }
7630 }
7631
7632 static void GLAPIENTRY
save_ProgramUniform4i64ARB(GLuint program,GLint location,GLint64 x,GLint64 y,GLint64 z,GLint64 w)7633 save_ProgramUniform4i64ARB(GLuint program, GLint location, GLint64 x,
7634 GLint64 y, GLint64 z, GLint64 w)
7635 {
7636 GET_CURRENT_CONTEXT(ctx);
7637 Node *n;
7638 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7639 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4I64, 10);
7640 if (n) {
7641 n[1].ui = program;
7642 n[2].i = location;
7643 ASSIGN_INT64_TO_NODES(n, 3, x);
7644 ASSIGN_INT64_TO_NODES(n, 5, y);
7645 ASSIGN_INT64_TO_NODES(n, 7, z);
7646 ASSIGN_INT64_TO_NODES(n, 9, w);
7647 }
7648 if (ctx->ExecuteFlag) {
7649 CALL_ProgramUniform4i64ARB(ctx->Exec, (program, location, x, y, z, w));
7650 }
7651 }
7652
7653 static void GLAPIENTRY
save_ProgramUniform1i64vARB(GLuint program,GLint location,GLsizei count,const GLint64 * v)7654 save_ProgramUniform1i64vARB(GLuint program, GLint location, GLsizei count,
7655 const GLint64 *v)
7656 {
7657 GET_CURRENT_CONTEXT(ctx);
7658 Node *n;
7659 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7660 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1I64V, 3 + POINTER_DWORDS);
7661 if (n) {
7662 n[1].ui = program;
7663 n[2].i = location;
7664 n[3].i = count;
7665 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLint64)));
7666 }
7667 if (ctx->ExecuteFlag) {
7668 CALL_ProgramUniform1i64vARB(ctx->Exec, (program, location, count, v));
7669 }
7670 }
7671
7672 static void GLAPIENTRY
save_ProgramUniform2i64vARB(GLuint program,GLint location,GLsizei count,const GLint64 * v)7673 save_ProgramUniform2i64vARB(GLuint program, GLint location, GLsizei count,
7674 const GLint64 *v)
7675 {
7676 GET_CURRENT_CONTEXT(ctx);
7677 Node *n;
7678 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7679 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2I64V, 3 + POINTER_DWORDS);
7680 if (n) {
7681 n[1].ui = program;
7682 n[2].i = location;
7683 n[3].i = count;
7684 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLint64)));
7685 }
7686 if (ctx->ExecuteFlag) {
7687 CALL_ProgramUniform2i64vARB(ctx->Exec, (program, location, count, v));
7688 }
7689 }
7690
7691 static void GLAPIENTRY
save_ProgramUniform3i64vARB(GLuint program,GLint location,GLsizei count,const GLint64 * v)7692 save_ProgramUniform3i64vARB(GLuint program, GLint location, GLsizei count,
7693 const GLint64 *v)
7694 {
7695 GET_CURRENT_CONTEXT(ctx);
7696 Node *n;
7697 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7698 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3I64V, 3 + POINTER_DWORDS);
7699 if (n) {
7700 n[1].ui = program;
7701 n[2].i = location;
7702 n[3].i = count;
7703 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLint64)));
7704 }
7705 if (ctx->ExecuteFlag) {
7706 CALL_ProgramUniform3i64vARB(ctx->Exec, (program, location, count, v));
7707 }
7708 }
7709
7710 static void GLAPIENTRY
save_ProgramUniform4i64vARB(GLuint program,GLint location,GLsizei count,const GLint64 * v)7711 save_ProgramUniform4i64vARB(GLuint program, GLint location, GLsizei count,
7712 const GLint64 *v)
7713 {
7714 GET_CURRENT_CONTEXT(ctx);
7715 Node *n;
7716 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7717 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4I64V, 3 + POINTER_DWORDS);
7718 if (n) {
7719 n[1].ui = program;
7720 n[2].i = location;
7721 n[3].i = count;
7722 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLint64)));
7723 }
7724 if (ctx->ExecuteFlag) {
7725 CALL_ProgramUniform4i64vARB(ctx->Exec, (program, location, count, v));
7726 }
7727 }
7728
7729 static void GLAPIENTRY
save_ProgramUniform1ui64ARB(GLuint program,GLint location,GLuint64 x)7730 save_ProgramUniform1ui64ARB(GLuint program, GLint location, GLuint64 x)
7731 {
7732 GET_CURRENT_CONTEXT(ctx);
7733 Node *n;
7734 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7735 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1UI64, 4);
7736 if (n) {
7737 n[1].ui = program;
7738 n[2].i = location;
7739 ASSIGN_UINT64_TO_NODES(n, 3, x);
7740 }
7741 if (ctx->ExecuteFlag) {
7742 CALL_ProgramUniform1ui64ARB(ctx->Exec, (program, location, x));
7743 }
7744 }
7745
7746 static void GLAPIENTRY
save_ProgramUniform2ui64ARB(GLuint program,GLint location,GLuint64 x,GLuint64 y)7747 save_ProgramUniform2ui64ARB(GLuint program, GLint location, GLuint64 x,
7748 GLuint64 y)
7749 {
7750 GET_CURRENT_CONTEXT(ctx);
7751 Node *n;
7752 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7753 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2UI64, 6);
7754 if (n) {
7755 n[1].ui = program;
7756 n[2].i = location;
7757 ASSIGN_UINT64_TO_NODES(n, 3, x);
7758 ASSIGN_UINT64_TO_NODES(n, 5, y);
7759 }
7760 if (ctx->ExecuteFlag) {
7761 CALL_ProgramUniform2ui64ARB(ctx->Exec, (program, location, x, y));
7762 }
7763 }
7764
7765 static void GLAPIENTRY
save_ProgramUniform3ui64ARB(GLuint program,GLint location,GLuint64 x,GLuint64 y,GLuint64 z)7766 save_ProgramUniform3ui64ARB(GLuint program, GLint location, GLuint64 x,
7767 GLuint64 y, GLuint64 z)
7768 {
7769 GET_CURRENT_CONTEXT(ctx);
7770 Node *n;
7771 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7772 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3UI64, 8);
7773 if (n) {
7774 n[1].ui = program;
7775 n[2].i = location;
7776 ASSIGN_UINT64_TO_NODES(n, 3, x);
7777 ASSIGN_UINT64_TO_NODES(n, 5, y);
7778 ASSIGN_UINT64_TO_NODES(n, 7, z);
7779 }
7780 if (ctx->ExecuteFlag) {
7781 CALL_ProgramUniform3ui64ARB(ctx->Exec, (program, location, x, y, z));
7782 }
7783 }
7784
7785 static void GLAPIENTRY
save_ProgramUniform4ui64ARB(GLuint program,GLint location,GLuint64 x,GLuint64 y,GLuint64 z,GLuint64 w)7786 save_ProgramUniform4ui64ARB(GLuint program, GLint location, GLuint64 x,
7787 GLuint64 y, GLuint64 z, GLuint64 w)
7788 {
7789 GET_CURRENT_CONTEXT(ctx);
7790 Node *n;
7791 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7792 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4UI64, 10);
7793 if (n) {
7794 n[1].ui = program;
7795 n[2].i = location;
7796 ASSIGN_UINT64_TO_NODES(n, 3, x);
7797 ASSIGN_UINT64_TO_NODES(n, 5, y);
7798 ASSIGN_UINT64_TO_NODES(n, 7, z);
7799 ASSIGN_UINT64_TO_NODES(n, 9, w);
7800 }
7801 if (ctx->ExecuteFlag) {
7802 CALL_ProgramUniform4i64ARB(ctx->Exec, (program, location, x, y, z, w));
7803 }
7804 }
7805
7806 static void GLAPIENTRY
save_ProgramUniform1ui64vARB(GLuint program,GLint location,GLsizei count,const GLuint64 * v)7807 save_ProgramUniform1ui64vARB(GLuint program, GLint location, GLsizei count,
7808 const GLuint64 *v)
7809 {
7810 GET_CURRENT_CONTEXT(ctx);
7811 Node *n;
7812 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7813 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1UI64V,
7814 3 + POINTER_DWORDS);
7815 if (n) {
7816 n[1].ui = program;
7817 n[2].i = location;
7818 n[3].i = count;
7819 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLuint64)));
7820 }
7821 if (ctx->ExecuteFlag) {
7822 CALL_ProgramUniform1ui64vARB(ctx->Exec, (program, location, count, v));
7823 }
7824 }
7825
7826 static void GLAPIENTRY
save_ProgramUniform2ui64vARB(GLuint program,GLint location,GLsizei count,const GLuint64 * v)7827 save_ProgramUniform2ui64vARB(GLuint program, GLint location, GLsizei count,
7828 const GLuint64 *v)
7829 {
7830 GET_CURRENT_CONTEXT(ctx);
7831 Node *n;
7832 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7833 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2UI64V,
7834 3 + POINTER_DWORDS);
7835 if (n) {
7836 n[1].ui = program;
7837 n[2].i = location;
7838 n[3].i = count;
7839 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLuint64)));
7840 }
7841 if (ctx->ExecuteFlag) {
7842 CALL_ProgramUniform2ui64vARB(ctx->Exec, (program, location, count, v));
7843 }
7844 }
7845
7846 static void GLAPIENTRY
save_ProgramUniform3ui64vARB(GLuint program,GLint location,GLsizei count,const GLuint64 * v)7847 save_ProgramUniform3ui64vARB(GLuint program, GLint location, GLsizei count,
7848 const GLuint64 *v)
7849 {
7850 GET_CURRENT_CONTEXT(ctx);
7851 Node *n;
7852 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7853 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3UI64V,
7854 3 + POINTER_DWORDS);
7855 if (n) {
7856 n[1].ui = program;
7857 n[2].i = location;
7858 n[3].i = count;
7859 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLuint64)));
7860 }
7861 if (ctx->ExecuteFlag) {
7862 CALL_ProgramUniform3ui64vARB(ctx->Exec, (program, location, count, v));
7863 }
7864 }
7865
7866 static void GLAPIENTRY
save_ProgramUniform4ui64vARB(GLuint program,GLint location,GLsizei count,const GLuint64 * v)7867 save_ProgramUniform4ui64vARB(GLuint program, GLint location, GLsizei count,
7868 const GLuint64 *v)
7869 {
7870 GET_CURRENT_CONTEXT(ctx);
7871 Node *n;
7872 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7873 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4UI64V,
7874 3 + POINTER_DWORDS);
7875 if (n) {
7876 n[1].ui = program;
7877 n[2].i = location;
7878 n[3].i = count;
7879 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLuint64)));
7880 }
7881 if (ctx->ExecuteFlag) {
7882 CALL_ProgramUniform4ui64vARB(ctx->Exec, (program, location, count, v));
7883 }
7884 }
7885
7886
7887 static void GLAPIENTRY
save_UseProgramStages(GLuint pipeline,GLbitfield stages,GLuint program)7888 save_UseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program)
7889 {
7890 GET_CURRENT_CONTEXT(ctx);
7891 Node *n;
7892 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7893 n = alloc_instruction(ctx, OPCODE_USE_PROGRAM_STAGES, 3);
7894 if (n) {
7895 n[1].ui = pipeline;
7896 n[2].ui = stages;
7897 n[3].ui = program;
7898 }
7899 if (ctx->ExecuteFlag) {
7900 CALL_UseProgramStages(ctx->Exec, (pipeline, stages, program));
7901 }
7902 }
7903
7904 static void GLAPIENTRY
save_ProgramUniform1f(GLuint program,GLint location,GLfloat x)7905 save_ProgramUniform1f(GLuint program, GLint location, GLfloat x)
7906 {
7907 GET_CURRENT_CONTEXT(ctx);
7908 Node *n;
7909 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7910 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1F, 3);
7911 if (n) {
7912 n[1].ui = program;
7913 n[2].i = location;
7914 n[3].f = x;
7915 }
7916 if (ctx->ExecuteFlag) {
7917 CALL_ProgramUniform1f(ctx->Exec, (program, location, x));
7918 }
7919 }
7920
7921 static void GLAPIENTRY
save_ProgramUniform2f(GLuint program,GLint location,GLfloat x,GLfloat y)7922 save_ProgramUniform2f(GLuint program, GLint location, GLfloat x, GLfloat y)
7923 {
7924 GET_CURRENT_CONTEXT(ctx);
7925 Node *n;
7926 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7927 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2F, 4);
7928 if (n) {
7929 n[1].ui = program;
7930 n[2].i = location;
7931 n[3].f = x;
7932 n[4].f = y;
7933 }
7934 if (ctx->ExecuteFlag) {
7935 CALL_ProgramUniform2f(ctx->Exec, (program, location, x, y));
7936 }
7937 }
7938
7939 static void GLAPIENTRY
save_ProgramUniform3f(GLuint program,GLint location,GLfloat x,GLfloat y,GLfloat z)7940 save_ProgramUniform3f(GLuint program, GLint location,
7941 GLfloat x, GLfloat y, GLfloat z)
7942 {
7943 GET_CURRENT_CONTEXT(ctx);
7944 Node *n;
7945 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7946 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3F, 5);
7947 if (n) {
7948 n[1].ui = program;
7949 n[2].i = location;
7950 n[3].f = x;
7951 n[4].f = y;
7952 n[5].f = z;
7953 }
7954 if (ctx->ExecuteFlag) {
7955 CALL_ProgramUniform3f(ctx->Exec, (program, location, x, y, z));
7956 }
7957 }
7958
7959 static void GLAPIENTRY
save_ProgramUniform4f(GLuint program,GLint location,GLfloat x,GLfloat y,GLfloat z,GLfloat w)7960 save_ProgramUniform4f(GLuint program, GLint location,
7961 GLfloat x, GLfloat y, GLfloat z, GLfloat w)
7962 {
7963 GET_CURRENT_CONTEXT(ctx);
7964 Node *n;
7965 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7966 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4F, 6);
7967 if (n) {
7968 n[1].ui = program;
7969 n[2].i = location;
7970 n[3].f = x;
7971 n[4].f = y;
7972 n[5].f = z;
7973 n[6].f = w;
7974 }
7975 if (ctx->ExecuteFlag) {
7976 CALL_ProgramUniform4f(ctx->Exec, (program, location, x, y, z, w));
7977 }
7978 }
7979
7980 static void GLAPIENTRY
save_ProgramUniform1fv(GLuint program,GLint location,GLsizei count,const GLfloat * v)7981 save_ProgramUniform1fv(GLuint program, GLint location, GLsizei count,
7982 const GLfloat *v)
7983 {
7984 GET_CURRENT_CONTEXT(ctx);
7985 Node *n;
7986 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7987 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1FV, 3 + POINTER_DWORDS);
7988 if (n) {
7989 n[1].ui = program;
7990 n[2].i = location;
7991 n[3].i = count;
7992 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLfloat)));
7993 }
7994 if (ctx->ExecuteFlag) {
7995 CALL_ProgramUniform1fv(ctx->Exec, (program, location, count, v));
7996 }
7997 }
7998
7999 static void GLAPIENTRY
save_ProgramUniform2fv(GLuint program,GLint location,GLsizei count,const GLfloat * v)8000 save_ProgramUniform2fv(GLuint program, GLint location, GLsizei count,
8001 const GLfloat *v)
8002 {
8003 GET_CURRENT_CONTEXT(ctx);
8004 Node *n;
8005 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8006 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2FV, 3 + POINTER_DWORDS);
8007 if (n) {
8008 n[1].ui = program;
8009 n[2].i = location;
8010 n[3].i = count;
8011 save_pointer(&n[4], memdup(v, count * 2 * sizeof(GLfloat)));
8012 }
8013 if (ctx->ExecuteFlag) {
8014 CALL_ProgramUniform2fv(ctx->Exec, (program, location, count, v));
8015 }
8016 }
8017
8018 static void GLAPIENTRY
save_ProgramUniform3fv(GLuint program,GLint location,GLsizei count,const GLfloat * v)8019 save_ProgramUniform3fv(GLuint program, GLint location, GLsizei count,
8020 const GLfloat *v)
8021 {
8022 GET_CURRENT_CONTEXT(ctx);
8023 Node *n;
8024 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8025 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3FV, 3 + POINTER_DWORDS);
8026 if (n) {
8027 n[1].ui = program;
8028 n[2].i = location;
8029 n[3].i = count;
8030 save_pointer(&n[4], memdup(v, count * 3 * sizeof(GLfloat)));
8031 }
8032 if (ctx->ExecuteFlag) {
8033 CALL_ProgramUniform3fv(ctx->Exec, (program, location, count, v));
8034 }
8035 }
8036
8037 static void GLAPIENTRY
save_ProgramUniform4fv(GLuint program,GLint location,GLsizei count,const GLfloat * v)8038 save_ProgramUniform4fv(GLuint program, GLint location, GLsizei count,
8039 const GLfloat *v)
8040 {
8041 GET_CURRENT_CONTEXT(ctx);
8042 Node *n;
8043 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8044 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4FV, 3 + POINTER_DWORDS);
8045 if (n) {
8046 n[1].ui = program;
8047 n[2].i = location;
8048 n[3].i = count;
8049 save_pointer(&n[4], memdup(v, count * 4 * sizeof(GLfloat)));
8050 }
8051 if (ctx->ExecuteFlag) {
8052 CALL_ProgramUniform4fv(ctx->Exec, (program, location, count, v));
8053 }
8054 }
8055
8056 static void GLAPIENTRY
save_ProgramUniform1d(GLuint program,GLint location,GLdouble x)8057 save_ProgramUniform1d(GLuint program, GLint location, GLdouble x)
8058 {
8059 GET_CURRENT_CONTEXT(ctx);
8060 Node *n;
8061 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8062 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1D, 4);
8063 if (n) {
8064 n[1].ui = program;
8065 n[2].i = location;
8066 ASSIGN_DOUBLE_TO_NODES(n, 3, x);
8067 }
8068 if (ctx->ExecuteFlag) {
8069 CALL_ProgramUniform1d(ctx->Exec, (program, location, x));
8070 }
8071 }
8072
8073 static void GLAPIENTRY
save_ProgramUniform2d(GLuint program,GLint location,GLdouble x,GLdouble y)8074 save_ProgramUniform2d(GLuint program, GLint location, GLdouble x, GLdouble y)
8075 {
8076 GET_CURRENT_CONTEXT(ctx);
8077 Node *n;
8078 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8079 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2D, 6);
8080 if (n) {
8081 n[1].ui = program;
8082 n[2].i = location;
8083 ASSIGN_DOUBLE_TO_NODES(n, 3, x);
8084 ASSIGN_DOUBLE_TO_NODES(n, 5, y);
8085 }
8086 if (ctx->ExecuteFlag) {
8087 CALL_ProgramUniform2d(ctx->Exec, (program, location, x, y));
8088 }
8089 }
8090
8091 static void GLAPIENTRY
save_ProgramUniform3d(GLuint program,GLint location,GLdouble x,GLdouble y,GLdouble z)8092 save_ProgramUniform3d(GLuint program, GLint location,
8093 GLdouble x, GLdouble y, GLdouble z)
8094 {
8095 GET_CURRENT_CONTEXT(ctx);
8096 Node *n;
8097 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8098 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3D, 8);
8099 if (n) {
8100 n[1].ui = program;
8101 n[2].i = location;
8102 ASSIGN_DOUBLE_TO_NODES(n, 3, x);
8103 ASSIGN_DOUBLE_TO_NODES(n, 5, y);
8104 ASSIGN_DOUBLE_TO_NODES(n, 7, z);
8105 }
8106 if (ctx->ExecuteFlag) {
8107 CALL_ProgramUniform3d(ctx->Exec, (program, location, x, y, z));
8108 }
8109 }
8110
8111 static void GLAPIENTRY
save_ProgramUniform4d(GLuint program,GLint location,GLdouble x,GLdouble y,GLdouble z,GLdouble w)8112 save_ProgramUniform4d(GLuint program, GLint location,
8113 GLdouble x, GLdouble y, GLdouble z, GLdouble w)
8114 {
8115 GET_CURRENT_CONTEXT(ctx);
8116 Node *n;
8117 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8118 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4D, 10);
8119 if (n) {
8120 n[1].ui = program;
8121 n[2].i = location;
8122 ASSIGN_DOUBLE_TO_NODES(n, 3, x);
8123 ASSIGN_DOUBLE_TO_NODES(n, 5, y);
8124 ASSIGN_DOUBLE_TO_NODES(n, 7, z);
8125 ASSIGN_DOUBLE_TO_NODES(n, 9, w);
8126 }
8127 if (ctx->ExecuteFlag) {
8128 CALL_ProgramUniform4d(ctx->Exec, (program, location, x, y, z, w));
8129 }
8130 }
8131
8132 static void GLAPIENTRY
save_ProgramUniform1dv(GLuint program,GLint location,GLsizei count,const GLdouble * v)8133 save_ProgramUniform1dv(GLuint program, GLint location, GLsizei count,
8134 const GLdouble *v)
8135 {
8136 GET_CURRENT_CONTEXT(ctx);
8137 Node *n;
8138 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8139 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1DV, 3 + POINTER_DWORDS);
8140 if (n) {
8141 n[1].ui = program;
8142 n[2].i = location;
8143 n[3].i = count;
8144 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLdouble)));
8145 }
8146 if (ctx->ExecuteFlag) {
8147 CALL_ProgramUniform1dv(ctx->Exec, (program, location, count, v));
8148 }
8149 }
8150
8151 static void GLAPIENTRY
save_ProgramUniform2dv(GLuint program,GLint location,GLsizei count,const GLdouble * v)8152 save_ProgramUniform2dv(GLuint program, GLint location, GLsizei count,
8153 const GLdouble *v)
8154 {
8155 GET_CURRENT_CONTEXT(ctx);
8156 Node *n;
8157 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8158 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2DV, 3 + POINTER_DWORDS);
8159 if (n) {
8160 n[1].ui = program;
8161 n[2].i = location;
8162 n[3].i = count;
8163 save_pointer(&n[4], memdup(v, count * 2 * sizeof(GLdouble)));
8164 }
8165 if (ctx->ExecuteFlag) {
8166 CALL_ProgramUniform2dv(ctx->Exec, (program, location, count, v));
8167 }
8168 }
8169
8170 static void GLAPIENTRY
save_ProgramUniform3dv(GLuint program,GLint location,GLsizei count,const GLdouble * v)8171 save_ProgramUniform3dv(GLuint program, GLint location, GLsizei count,
8172 const GLdouble *v)
8173 {
8174 GET_CURRENT_CONTEXT(ctx);
8175 Node *n;
8176 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8177 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3DV, 3 + POINTER_DWORDS);
8178 if (n) {
8179 n[1].ui = program;
8180 n[2].i = location;
8181 n[3].i = count;
8182 save_pointer(&n[4], memdup(v, count * 3 * sizeof(GLdouble)));
8183 }
8184 if (ctx->ExecuteFlag) {
8185 CALL_ProgramUniform3dv(ctx->Exec, (program, location, count, v));
8186 }
8187 }
8188
8189 static void GLAPIENTRY
save_ProgramUniform4dv(GLuint program,GLint location,GLsizei count,const GLdouble * v)8190 save_ProgramUniform4dv(GLuint program, GLint location, GLsizei count,
8191 const GLdouble *v)
8192 {
8193 GET_CURRENT_CONTEXT(ctx);
8194 Node *n;
8195 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8196 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4DV, 3 + POINTER_DWORDS);
8197 if (n) {
8198 n[1].ui = program;
8199 n[2].i = location;
8200 n[3].i = count;
8201 save_pointer(&n[4], memdup(v, count * 4 * sizeof(GLdouble)));
8202 }
8203 if (ctx->ExecuteFlag) {
8204 CALL_ProgramUniform4dv(ctx->Exec, (program, location, count, v));
8205 }
8206 }
8207
8208 static void GLAPIENTRY
save_ProgramUniform1i(GLuint program,GLint location,GLint x)8209 save_ProgramUniform1i(GLuint program, GLint location, GLint x)
8210 {
8211 GET_CURRENT_CONTEXT(ctx);
8212 Node *n;
8213 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8214 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1I, 3);
8215 if (n) {
8216 n[1].ui = program;
8217 n[2].i = location;
8218 n[3].i = x;
8219 }
8220 if (ctx->ExecuteFlag) {
8221 CALL_ProgramUniform1i(ctx->Exec, (program, location, x));
8222 }
8223 }
8224
8225 static void GLAPIENTRY
save_ProgramUniform2i(GLuint program,GLint location,GLint x,GLint y)8226 save_ProgramUniform2i(GLuint program, GLint location, GLint x, GLint y)
8227 {
8228 GET_CURRENT_CONTEXT(ctx);
8229 Node *n;
8230 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8231 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2I, 4);
8232 if (n) {
8233 n[1].ui = program;
8234 n[2].i = location;
8235 n[3].i = x;
8236 n[4].i = y;
8237 }
8238 if (ctx->ExecuteFlag) {
8239 CALL_ProgramUniform2i(ctx->Exec, (program, location, x, y));
8240 }
8241 }
8242
8243 static void GLAPIENTRY
save_ProgramUniform3i(GLuint program,GLint location,GLint x,GLint y,GLint z)8244 save_ProgramUniform3i(GLuint program, GLint location,
8245 GLint x, GLint y, GLint z)
8246 {
8247 GET_CURRENT_CONTEXT(ctx);
8248 Node *n;
8249 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8250 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3I, 5);
8251 if (n) {
8252 n[1].ui = program;
8253 n[2].i = location;
8254 n[3].i = x;
8255 n[4].i = y;
8256 n[5].i = z;
8257 }
8258 if (ctx->ExecuteFlag) {
8259 CALL_ProgramUniform3i(ctx->Exec, (program, location, x, y, z));
8260 }
8261 }
8262
8263 static void GLAPIENTRY
save_ProgramUniform4i(GLuint program,GLint location,GLint x,GLint y,GLint z,GLint w)8264 save_ProgramUniform4i(GLuint program, GLint location,
8265 GLint x, GLint y, GLint z, GLint w)
8266 {
8267 GET_CURRENT_CONTEXT(ctx);
8268 Node *n;
8269 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8270 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4I, 6);
8271 if (n) {
8272 n[1].ui = program;
8273 n[2].i = location;
8274 n[3].i = x;
8275 n[4].i = y;
8276 n[5].i = z;
8277 n[6].i = w;
8278 }
8279 if (ctx->ExecuteFlag) {
8280 CALL_ProgramUniform4i(ctx->Exec, (program, location, x, y, z, w));
8281 }
8282 }
8283
8284 static void GLAPIENTRY
save_ProgramUniform1iv(GLuint program,GLint location,GLsizei count,const GLint * v)8285 save_ProgramUniform1iv(GLuint program, GLint location, GLsizei count,
8286 const GLint *v)
8287 {
8288 GET_CURRENT_CONTEXT(ctx);
8289 Node *n;
8290 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8291 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1IV, 3 + POINTER_DWORDS);
8292 if (n) {
8293 n[1].ui = program;
8294 n[2].i = location;
8295 n[3].i = count;
8296 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLint)));
8297 }
8298 if (ctx->ExecuteFlag) {
8299 CALL_ProgramUniform1iv(ctx->Exec, (program, location, count, v));
8300 }
8301 }
8302
8303 static void GLAPIENTRY
save_ProgramUniform2iv(GLuint program,GLint location,GLsizei count,const GLint * v)8304 save_ProgramUniform2iv(GLuint program, GLint location, GLsizei count,
8305 const GLint *v)
8306 {
8307 GET_CURRENT_CONTEXT(ctx);
8308 Node *n;
8309 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8310 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2IV, 3 + POINTER_DWORDS);
8311 if (n) {
8312 n[1].ui = program;
8313 n[2].i = location;
8314 n[3].i = count;
8315 save_pointer(&n[4], memdup(v, count * 2 * sizeof(GLint)));
8316 }
8317 if (ctx->ExecuteFlag) {
8318 CALL_ProgramUniform2iv(ctx->Exec, (program, location, count, v));
8319 }
8320 }
8321
8322 static void GLAPIENTRY
save_ProgramUniform3iv(GLuint program,GLint location,GLsizei count,const GLint * v)8323 save_ProgramUniform3iv(GLuint program, GLint location, GLsizei count,
8324 const GLint *v)
8325 {
8326 GET_CURRENT_CONTEXT(ctx);
8327 Node *n;
8328 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8329 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3IV, 3 + POINTER_DWORDS);
8330 if (n) {
8331 n[1].ui = program;
8332 n[2].i = location;
8333 n[3].i = count;
8334 save_pointer(&n[4], memdup(v, count * 3 * sizeof(GLint)));
8335 }
8336 if (ctx->ExecuteFlag) {
8337 CALL_ProgramUniform3iv(ctx->Exec, (program, location, count, v));
8338 }
8339 }
8340
8341 static void GLAPIENTRY
save_ProgramUniform4iv(GLuint program,GLint location,GLsizei count,const GLint * v)8342 save_ProgramUniform4iv(GLuint program, GLint location, GLsizei count,
8343 const GLint *v)
8344 {
8345 GET_CURRENT_CONTEXT(ctx);
8346 Node *n;
8347 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8348 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4IV, 3 + POINTER_DWORDS);
8349 if (n) {
8350 n[1].ui = program;
8351 n[2].i = location;
8352 n[3].i = count;
8353 save_pointer(&n[4], memdup(v, count * 4 * sizeof(GLint)));
8354 }
8355 if (ctx->ExecuteFlag) {
8356 CALL_ProgramUniform4iv(ctx->Exec, (program, location, count, v));
8357 }
8358 }
8359
8360 static void GLAPIENTRY
save_ProgramUniform1ui(GLuint program,GLint location,GLuint x)8361 save_ProgramUniform1ui(GLuint program, GLint location, GLuint x)
8362 {
8363 GET_CURRENT_CONTEXT(ctx);
8364 Node *n;
8365 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8366 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1UI, 3);
8367 if (n) {
8368 n[1].ui = program;
8369 n[2].i = location;
8370 n[3].ui = x;
8371 }
8372 if (ctx->ExecuteFlag) {
8373 CALL_ProgramUniform1ui(ctx->Exec, (program, location, x));
8374 }
8375 }
8376
8377 static void GLAPIENTRY
save_ProgramUniform2ui(GLuint program,GLint location,GLuint x,GLuint y)8378 save_ProgramUniform2ui(GLuint program, GLint location, GLuint x, GLuint y)
8379 {
8380 GET_CURRENT_CONTEXT(ctx);
8381 Node *n;
8382 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8383 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2UI, 4);
8384 if (n) {
8385 n[1].ui = program;
8386 n[2].i = location;
8387 n[3].ui = x;
8388 n[4].ui = y;
8389 }
8390 if (ctx->ExecuteFlag) {
8391 CALL_ProgramUniform2ui(ctx->Exec, (program, location, x, y));
8392 }
8393 }
8394
8395 static void GLAPIENTRY
save_ProgramUniform3ui(GLuint program,GLint location,GLuint x,GLuint y,GLuint z)8396 save_ProgramUniform3ui(GLuint program, GLint location,
8397 GLuint x, GLuint y, GLuint z)
8398 {
8399 GET_CURRENT_CONTEXT(ctx);
8400 Node *n;
8401 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8402 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3UI, 5);
8403 if (n) {
8404 n[1].ui = program;
8405 n[2].i = location;
8406 n[3].ui = x;
8407 n[4].ui = y;
8408 n[5].ui = z;
8409 }
8410 if (ctx->ExecuteFlag) {
8411 CALL_ProgramUniform3ui(ctx->Exec, (program, location, x, y, z));
8412 }
8413 }
8414
8415 static void GLAPIENTRY
save_ProgramUniform4ui(GLuint program,GLint location,GLuint x,GLuint y,GLuint z,GLuint w)8416 save_ProgramUniform4ui(GLuint program, GLint location,
8417 GLuint x, GLuint y, GLuint z, GLuint w)
8418 {
8419 GET_CURRENT_CONTEXT(ctx);
8420 Node *n;
8421 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8422 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4UI, 6);
8423 if (n) {
8424 n[1].ui = program;
8425 n[2].i = location;
8426 n[3].ui = x;
8427 n[4].ui = y;
8428 n[5].ui = z;
8429 n[6].ui = w;
8430 }
8431 if (ctx->ExecuteFlag) {
8432 CALL_ProgramUniform4ui(ctx->Exec, (program, location, x, y, z, w));
8433 }
8434 }
8435
8436 static void GLAPIENTRY
save_ProgramUniform1uiv(GLuint program,GLint location,GLsizei count,const GLuint * v)8437 save_ProgramUniform1uiv(GLuint program, GLint location, GLsizei count,
8438 const GLuint *v)
8439 {
8440 GET_CURRENT_CONTEXT(ctx);
8441 Node *n;
8442 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8443 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1UIV, 3 + POINTER_DWORDS);
8444 if (n) {
8445 n[1].ui = program;
8446 n[2].i = location;
8447 n[3].i = count;
8448 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLuint)));
8449 }
8450 if (ctx->ExecuteFlag) {
8451 CALL_ProgramUniform1uiv(ctx->Exec, (program, location, count, v));
8452 }
8453 }
8454
8455 static void GLAPIENTRY
save_ProgramUniform2uiv(GLuint program,GLint location,GLsizei count,const GLuint * v)8456 save_ProgramUniform2uiv(GLuint program, GLint location, GLsizei count,
8457 const GLuint *v)
8458 {
8459 GET_CURRENT_CONTEXT(ctx);
8460 Node *n;
8461 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8462 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2UIV, 3 + POINTER_DWORDS);
8463 if (n) {
8464 n[1].ui = program;
8465 n[2].i = location;
8466 n[3].i = count;
8467 save_pointer(&n[4], memdup(v, count * 2 * sizeof(GLuint)));
8468 }
8469 if (ctx->ExecuteFlag) {
8470 CALL_ProgramUniform2uiv(ctx->Exec, (program, location, count, v));
8471 }
8472 }
8473
8474 static void GLAPIENTRY
save_ProgramUniform3uiv(GLuint program,GLint location,GLsizei count,const GLuint * v)8475 save_ProgramUniform3uiv(GLuint program, GLint location, GLsizei count,
8476 const GLuint *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_3UIV, 3 + POINTER_DWORDS);
8482 if (n) {
8483 n[1].ui = program;
8484 n[2].i = location;
8485 n[3].i = count;
8486 save_pointer(&n[4], memdup(v, count * 3 * sizeof(GLuint)));
8487 }
8488 if (ctx->ExecuteFlag) {
8489 CALL_ProgramUniform3uiv(ctx->Exec, (program, location, count, v));
8490 }
8491 }
8492
8493 static void GLAPIENTRY
save_ProgramUniform4uiv(GLuint program,GLint location,GLsizei count,const GLuint * v)8494 save_ProgramUniform4uiv(GLuint program, GLint location, GLsizei count,
8495 const GLuint *v)
8496 {
8497 GET_CURRENT_CONTEXT(ctx);
8498 Node *n;
8499 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8500 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4UIV, 3 + POINTER_DWORDS);
8501 if (n) {
8502 n[1].ui = program;
8503 n[2].i = location;
8504 n[3].i = count;
8505 save_pointer(&n[4], memdup(v, count * 4 * sizeof(GLuint)));
8506 }
8507 if (ctx->ExecuteFlag) {
8508 CALL_ProgramUniform4uiv(ctx->Exec, (program, location, count, v));
8509 }
8510 }
8511
8512 static void GLAPIENTRY
save_ProgramUniformMatrix2fv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * v)8513 save_ProgramUniformMatrix2fv(GLuint program, GLint location, GLsizei count,
8514 GLboolean transpose, const GLfloat *v)
8515 {
8516 GET_CURRENT_CONTEXT(ctx);
8517 Node *n;
8518 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8519 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX22F,
8520 4 + POINTER_DWORDS);
8521 if (n) {
8522 n[1].ui = program;
8523 n[2].i = location;
8524 n[3].i = count;
8525 n[4].b = transpose;
8526 save_pointer(&n[5], memdup(v, count * 2 * 2 * sizeof(GLfloat)));
8527 }
8528 if (ctx->ExecuteFlag) {
8529 CALL_ProgramUniformMatrix2fv(ctx->Exec,
8530 (program, location, count, transpose, v));
8531 }
8532 }
8533
8534 static void GLAPIENTRY
save_ProgramUniformMatrix2x3fv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * v)8535 save_ProgramUniformMatrix2x3fv(GLuint program, GLint location, GLsizei count,
8536 GLboolean transpose, const GLfloat *v)
8537 {
8538 GET_CURRENT_CONTEXT(ctx);
8539 Node *n;
8540 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8541 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX23F,
8542 4 + POINTER_DWORDS);
8543 if (n) {
8544 n[1].ui = program;
8545 n[2].i = location;
8546 n[3].i = count;
8547 n[4].b = transpose;
8548 save_pointer(&n[5], memdup(v, count * 2 * 3 * sizeof(GLfloat)));
8549 }
8550 if (ctx->ExecuteFlag) {
8551 CALL_ProgramUniformMatrix2x3fv(ctx->Exec,
8552 (program, location, count, transpose, v));
8553 }
8554 }
8555
8556 static void GLAPIENTRY
save_ProgramUniformMatrix2x4fv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * v)8557 save_ProgramUniformMatrix2x4fv(GLuint program, GLint location, GLsizei count,
8558 GLboolean transpose, const GLfloat *v)
8559 {
8560 GET_CURRENT_CONTEXT(ctx);
8561 Node *n;
8562 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8563 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX24F,
8564 4 + POINTER_DWORDS);
8565 if (n) {
8566 n[1].ui = program;
8567 n[2].i = location;
8568 n[3].i = count;
8569 n[4].b = transpose;
8570 save_pointer(&n[5], memdup(v, count * 2 * 4 * sizeof(GLfloat)));
8571 }
8572 if (ctx->ExecuteFlag) {
8573 CALL_ProgramUniformMatrix2x4fv(ctx->Exec,
8574 (program, location, count, transpose, v));
8575 }
8576 }
8577
8578 static void GLAPIENTRY
save_ProgramUniformMatrix3x2fv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * v)8579 save_ProgramUniformMatrix3x2fv(GLuint program, GLint location, GLsizei count,
8580 GLboolean transpose, const GLfloat *v)
8581 {
8582 GET_CURRENT_CONTEXT(ctx);
8583 Node *n;
8584 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8585 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX32F,
8586 4 + POINTER_DWORDS);
8587 if (n) {
8588 n[1].ui = program;
8589 n[2].i = location;
8590 n[3].i = count;
8591 n[4].b = transpose;
8592 save_pointer(&n[5], memdup(v, count * 3 * 2 * sizeof(GLfloat)));
8593 }
8594 if (ctx->ExecuteFlag) {
8595 CALL_ProgramUniformMatrix3x2fv(ctx->Exec,
8596 (program, location, count, transpose, v));
8597 }
8598 }
8599
8600 static void GLAPIENTRY
save_ProgramUniformMatrix3fv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * v)8601 save_ProgramUniformMatrix3fv(GLuint program, GLint location, GLsizei count,
8602 GLboolean transpose, const GLfloat *v)
8603 {
8604 GET_CURRENT_CONTEXT(ctx);
8605 Node *n;
8606 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8607 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX33F,
8608 4 + POINTER_DWORDS);
8609 if (n) {
8610 n[1].ui = program;
8611 n[2].i = location;
8612 n[3].i = count;
8613 n[4].b = transpose;
8614 save_pointer(&n[5], memdup(v, count * 3 * 3 * sizeof(GLfloat)));
8615 }
8616 if (ctx->ExecuteFlag) {
8617 CALL_ProgramUniformMatrix3fv(ctx->Exec,
8618 (program, location, count, transpose, v));
8619 }
8620 }
8621
8622 static void GLAPIENTRY
save_ProgramUniformMatrix3x4fv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * v)8623 save_ProgramUniformMatrix3x4fv(GLuint program, GLint location, GLsizei count,
8624 GLboolean transpose, const GLfloat *v)
8625 {
8626 GET_CURRENT_CONTEXT(ctx);
8627 Node *n;
8628 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8629 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX34F,
8630 4 + POINTER_DWORDS);
8631 if (n) {
8632 n[1].ui = program;
8633 n[2].i = location;
8634 n[3].i = count;
8635 n[4].b = transpose;
8636 save_pointer(&n[5], memdup(v, count * 3 * 4 * sizeof(GLfloat)));
8637 }
8638 if (ctx->ExecuteFlag) {
8639 CALL_ProgramUniformMatrix3x4fv(ctx->Exec,
8640 (program, location, count, transpose, v));
8641 }
8642 }
8643
8644 static void GLAPIENTRY
save_ProgramUniformMatrix4x2fv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * v)8645 save_ProgramUniformMatrix4x2fv(GLuint program, GLint location, GLsizei count,
8646 GLboolean transpose, const GLfloat *v)
8647 {
8648 GET_CURRENT_CONTEXT(ctx);
8649 Node *n;
8650 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8651 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX42F,
8652 4 + POINTER_DWORDS);
8653 if (n) {
8654 n[1].ui = program;
8655 n[2].i = location;
8656 n[3].i = count;
8657 n[4].b = transpose;
8658 save_pointer(&n[5], memdup(v, count * 4 * 2 * sizeof(GLfloat)));
8659 }
8660 if (ctx->ExecuteFlag) {
8661 CALL_ProgramUniformMatrix4x2fv(ctx->Exec,
8662 (program, location, count, transpose, v));
8663 }
8664 }
8665
8666 static void GLAPIENTRY
save_ProgramUniformMatrix4x3fv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * v)8667 save_ProgramUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count,
8668 GLboolean transpose, const GLfloat *v)
8669 {
8670 GET_CURRENT_CONTEXT(ctx);
8671 Node *n;
8672 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8673 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX43F,
8674 4 + POINTER_DWORDS);
8675 if (n) {
8676 n[1].ui = program;
8677 n[2].i = location;
8678 n[3].i = count;
8679 n[4].b = transpose;
8680 save_pointer(&n[5], memdup(v, count * 4 * 3 * sizeof(GLfloat)));
8681 }
8682 if (ctx->ExecuteFlag) {
8683 CALL_ProgramUniformMatrix4x3fv(ctx->Exec,
8684 (program, location, count, transpose, v));
8685 }
8686 }
8687
8688 static void GLAPIENTRY
save_ProgramUniformMatrix4fv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * v)8689 save_ProgramUniformMatrix4fv(GLuint program, GLint location, GLsizei count,
8690 GLboolean transpose, const GLfloat *v)
8691 {
8692 GET_CURRENT_CONTEXT(ctx);
8693 Node *n;
8694 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8695 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX44F,
8696 4 + POINTER_DWORDS);
8697 if (n) {
8698 n[1].ui = program;
8699 n[2].i = location;
8700 n[3].i = count;
8701 n[4].b = transpose;
8702 save_pointer(&n[5], memdup(v, count * 4 * 4 * sizeof(GLfloat)));
8703 }
8704 if (ctx->ExecuteFlag) {
8705 CALL_ProgramUniformMatrix4fv(ctx->Exec,
8706 (program, location, count, transpose, v));
8707 }
8708 }
8709
8710 static void GLAPIENTRY
save_ProgramUniformMatrix2dv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLdouble * v)8711 save_ProgramUniformMatrix2dv(GLuint program, GLint location, GLsizei count,
8712 GLboolean transpose, const GLdouble *v)
8713 {
8714 GET_CURRENT_CONTEXT(ctx);
8715 Node *n;
8716 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8717 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX22D,
8718 4 + POINTER_DWORDS);
8719 if (n) {
8720 n[1].ui = program;
8721 n[2].i = location;
8722 n[3].i = count;
8723 n[4].b = transpose;
8724 save_pointer(&n[5], memdup(v, count * 2 * 2 * sizeof(GLdouble)));
8725 }
8726 if (ctx->ExecuteFlag) {
8727 CALL_ProgramUniformMatrix2dv(ctx->Exec,
8728 (program, location, count, transpose, v));
8729 }
8730 }
8731
8732 static void GLAPIENTRY
save_ProgramUniformMatrix2x3dv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLdouble * v)8733 save_ProgramUniformMatrix2x3dv(GLuint program, GLint location, GLsizei count,
8734 GLboolean transpose, const GLdouble *v)
8735 {
8736 GET_CURRENT_CONTEXT(ctx);
8737 Node *n;
8738 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8739 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX23D,
8740 4 + POINTER_DWORDS);
8741 if (n) {
8742 n[1].ui = program;
8743 n[2].i = location;
8744 n[3].i = count;
8745 n[4].b = transpose;
8746 save_pointer(&n[5], memdup(v, count * 2 * 3 * sizeof(GLdouble)));
8747 }
8748 if (ctx->ExecuteFlag) {
8749 CALL_ProgramUniformMatrix2x3dv(ctx->Exec,
8750 (program, location, count, transpose, v));
8751 }
8752 }
8753
8754 static void GLAPIENTRY
save_ProgramUniformMatrix2x4dv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLdouble * v)8755 save_ProgramUniformMatrix2x4dv(GLuint program, GLint location, GLsizei count,
8756 GLboolean transpose, const GLdouble *v)
8757 {
8758 GET_CURRENT_CONTEXT(ctx);
8759 Node *n;
8760 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8761 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX24D,
8762 4 + POINTER_DWORDS);
8763 if (n) {
8764 n[1].ui = program;
8765 n[2].i = location;
8766 n[3].i = count;
8767 n[4].b = transpose;
8768 save_pointer(&n[5], memdup(v, count * 2 * 4 * sizeof(GLdouble)));
8769 }
8770 if (ctx->ExecuteFlag) {
8771 CALL_ProgramUniformMatrix2x4dv(ctx->Exec,
8772 (program, location, count, transpose, v));
8773 }
8774 }
8775
8776 static void GLAPIENTRY
save_ProgramUniformMatrix3x2dv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLdouble * v)8777 save_ProgramUniformMatrix3x2dv(GLuint program, GLint location, GLsizei count,
8778 GLboolean transpose, const GLdouble *v)
8779 {
8780 GET_CURRENT_CONTEXT(ctx);
8781 Node *n;
8782 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8783 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX32D,
8784 4 + POINTER_DWORDS);
8785 if (n) {
8786 n[1].ui = program;
8787 n[2].i = location;
8788 n[3].i = count;
8789 n[4].b = transpose;
8790 save_pointer(&n[5], memdup(v, count * 3 * 2 * sizeof(GLdouble)));
8791 }
8792 if (ctx->ExecuteFlag) {
8793 CALL_ProgramUniformMatrix3x2dv(ctx->Exec,
8794 (program, location, count, transpose, v));
8795 }
8796 }
8797
8798 static void GLAPIENTRY
save_ProgramUniformMatrix3dv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLdouble * v)8799 save_ProgramUniformMatrix3dv(GLuint program, GLint location, GLsizei count,
8800 GLboolean transpose, const GLdouble *v)
8801 {
8802 GET_CURRENT_CONTEXT(ctx);
8803 Node *n;
8804 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8805 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX33D,
8806 4 + POINTER_DWORDS);
8807 if (n) {
8808 n[1].ui = program;
8809 n[2].i = location;
8810 n[3].i = count;
8811 n[4].b = transpose;
8812 save_pointer(&n[5], memdup(v, count * 3 * 3 * sizeof(GLdouble)));
8813 }
8814 if (ctx->ExecuteFlag) {
8815 CALL_ProgramUniformMatrix3dv(ctx->Exec,
8816 (program, location, count, transpose, v));
8817 }
8818 }
8819
8820 static void GLAPIENTRY
save_ProgramUniformMatrix3x4dv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLdouble * v)8821 save_ProgramUniformMatrix3x4dv(GLuint program, GLint location, GLsizei count,
8822 GLboolean transpose, const GLdouble *v)
8823 {
8824 GET_CURRENT_CONTEXT(ctx);
8825 Node *n;
8826 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8827 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX34D,
8828 4 + POINTER_DWORDS);
8829 if (n) {
8830 n[1].ui = program;
8831 n[2].i = location;
8832 n[3].i = count;
8833 n[4].b = transpose;
8834 save_pointer(&n[5], memdup(v, count * 3 * 4 * sizeof(GLdouble)));
8835 }
8836 if (ctx->ExecuteFlag) {
8837 CALL_ProgramUniformMatrix3x4dv(ctx->Exec,
8838 (program, location, count, transpose, v));
8839 }
8840 }
8841
8842 static void GLAPIENTRY
save_ProgramUniformMatrix4x2dv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLdouble * v)8843 save_ProgramUniformMatrix4x2dv(GLuint program, GLint location, GLsizei count,
8844 GLboolean transpose, const GLdouble *v)
8845 {
8846 GET_CURRENT_CONTEXT(ctx);
8847 Node *n;
8848 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8849 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX42D,
8850 4 + POINTER_DWORDS);
8851 if (n) {
8852 n[1].ui = program;
8853 n[2].i = location;
8854 n[3].i = count;
8855 n[4].b = transpose;
8856 save_pointer(&n[5], memdup(v, count * 4 * 2 * sizeof(GLdouble)));
8857 }
8858 if (ctx->ExecuteFlag) {
8859 CALL_ProgramUniformMatrix4x2dv(ctx->Exec,
8860 (program, location, count, transpose, v));
8861 }
8862 }
8863
8864 static void GLAPIENTRY
save_ProgramUniformMatrix4x3dv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLdouble * v)8865 save_ProgramUniformMatrix4x3dv(GLuint program, GLint location, GLsizei count,
8866 GLboolean transpose, const GLdouble *v)
8867 {
8868 GET_CURRENT_CONTEXT(ctx);
8869 Node *n;
8870 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8871 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX43D,
8872 4 + POINTER_DWORDS);
8873 if (n) {
8874 n[1].ui = program;
8875 n[2].i = location;
8876 n[3].i = count;
8877 n[4].b = transpose;
8878 save_pointer(&n[5], memdup(v, count * 4 * 3 * sizeof(GLdouble)));
8879 }
8880 if (ctx->ExecuteFlag) {
8881 CALL_ProgramUniformMatrix4x3dv(ctx->Exec,
8882 (program, location, count, transpose, v));
8883 }
8884 }
8885
8886 static void GLAPIENTRY
save_ProgramUniformMatrix4dv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLdouble * v)8887 save_ProgramUniformMatrix4dv(GLuint program, GLint location, GLsizei count,
8888 GLboolean transpose, const GLdouble *v)
8889 {
8890 GET_CURRENT_CONTEXT(ctx);
8891 Node *n;
8892 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8893 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX44D,
8894 4 + POINTER_DWORDS);
8895 if (n) {
8896 n[1].ui = program;
8897 n[2].i = location;
8898 n[3].i = count;
8899 n[4].b = transpose;
8900 save_pointer(&n[5], memdup(v, count * 4 * 4 * sizeof(GLdouble)));
8901 }
8902 if (ctx->ExecuteFlag) {
8903 CALL_ProgramUniformMatrix4dv(ctx->Exec,
8904 (program, location, count, transpose, v));
8905 }
8906 }
8907
8908 static void GLAPIENTRY
save_ClipControl(GLenum origin,GLenum depth)8909 save_ClipControl(GLenum origin, GLenum depth)
8910 {
8911 GET_CURRENT_CONTEXT(ctx);
8912 Node *n;
8913 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8914 n = alloc_instruction(ctx, OPCODE_CLIP_CONTROL, 2);
8915 if (n) {
8916 n[1].e = origin;
8917 n[2].e = depth;
8918 }
8919 if (ctx->ExecuteFlag) {
8920 CALL_ClipControl(ctx->Exec, (origin, depth));
8921 }
8922 }
8923
8924 static void GLAPIENTRY
save_ClampColorARB(GLenum target,GLenum clamp)8925 save_ClampColorARB(GLenum target, GLenum clamp)
8926 {
8927 GET_CURRENT_CONTEXT(ctx);
8928 Node *n;
8929 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8930 n = alloc_instruction(ctx, OPCODE_CLAMP_COLOR, 2);
8931 if (n) {
8932 n[1].e = target;
8933 n[2].e = clamp;
8934 }
8935 if (ctx->ExecuteFlag) {
8936 CALL_ClampColor(ctx->Exec, (target, clamp));
8937 }
8938 }
8939
8940 /** GL_EXT_texture_integer */
8941 static void GLAPIENTRY
save_ClearColorIi(GLint red,GLint green,GLint blue,GLint alpha)8942 save_ClearColorIi(GLint red, GLint green, GLint blue, GLint alpha)
8943 {
8944 GET_CURRENT_CONTEXT(ctx);
8945 Node *n;
8946 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8947 n = alloc_instruction(ctx, OPCODE_CLEARCOLOR_I, 4);
8948 if (n) {
8949 n[1].i = red;
8950 n[2].i = green;
8951 n[3].i = blue;
8952 n[4].i = alpha;
8953 }
8954 if (ctx->ExecuteFlag) {
8955 CALL_ClearColorIiEXT(ctx->Exec, (red, green, blue, alpha));
8956 }
8957 }
8958
8959 /** GL_EXT_texture_integer */
8960 static void GLAPIENTRY
save_ClearColorIui(GLuint red,GLuint green,GLuint blue,GLuint alpha)8961 save_ClearColorIui(GLuint red, GLuint green, GLuint blue, GLuint alpha)
8962 {
8963 GET_CURRENT_CONTEXT(ctx);
8964 Node *n;
8965 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8966 n = alloc_instruction(ctx, OPCODE_CLEARCOLOR_UI, 4);
8967 if (n) {
8968 n[1].ui = red;
8969 n[2].ui = green;
8970 n[3].ui = blue;
8971 n[4].ui = alpha;
8972 }
8973 if (ctx->ExecuteFlag) {
8974 CALL_ClearColorIuiEXT(ctx->Exec, (red, green, blue, alpha));
8975 }
8976 }
8977
8978 /** GL_EXT_texture_integer */
8979 static void GLAPIENTRY
save_TexParameterIiv(GLenum target,GLenum pname,const GLint * params)8980 save_TexParameterIiv(GLenum target, GLenum pname, const GLint *params)
8981 {
8982 GET_CURRENT_CONTEXT(ctx);
8983 Node *n;
8984 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8985 n = alloc_instruction(ctx, OPCODE_TEXPARAMETER_I, 6);
8986 if (n) {
8987 n[1].e = target;
8988 n[2].e = pname;
8989 n[3].i = params[0];
8990 n[4].i = params[1];
8991 n[5].i = params[2];
8992 n[6].i = params[3];
8993 }
8994 if (ctx->ExecuteFlag) {
8995 CALL_TexParameterIiv(ctx->Exec, (target, pname, params));
8996 }
8997 }
8998
8999 /** GL_EXT_texture_integer */
9000 static void GLAPIENTRY
save_TexParameterIuiv(GLenum target,GLenum pname,const GLuint * params)9001 save_TexParameterIuiv(GLenum target, GLenum pname, const GLuint *params)
9002 {
9003 GET_CURRENT_CONTEXT(ctx);
9004 Node *n;
9005 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9006 n = alloc_instruction(ctx, OPCODE_TEXPARAMETER_UI, 6);
9007 if (n) {
9008 n[1].e = target;
9009 n[2].e = pname;
9010 n[3].ui = params[0];
9011 n[4].ui = params[1];
9012 n[5].ui = params[2];
9013 n[6].ui = params[3];
9014 }
9015 if (ctx->ExecuteFlag) {
9016 CALL_TexParameterIuiv(ctx->Exec, (target, pname, params));
9017 }
9018 }
9019
9020 /* GL_ARB_instanced_arrays */
9021 static void GLAPIENTRY
save_VertexAttribDivisor(GLuint index,GLuint divisor)9022 save_VertexAttribDivisor(GLuint index, GLuint divisor)
9023 {
9024 GET_CURRENT_CONTEXT(ctx);
9025 Node *n;
9026 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9027 n = alloc_instruction(ctx, OPCODE_VERTEX_ATTRIB_DIVISOR, 2);
9028 if (n) {
9029 n[1].ui = index;
9030 n[2].ui = divisor;
9031 }
9032 if (ctx->ExecuteFlag) {
9033 CALL_VertexAttribDivisor(ctx->Exec, (index, divisor));
9034 }
9035 }
9036
9037
9038 /* GL_NV_texture_barrier */
9039 static void GLAPIENTRY
save_TextureBarrierNV(void)9040 save_TextureBarrierNV(void)
9041 {
9042 GET_CURRENT_CONTEXT(ctx);
9043 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9044 alloc_instruction(ctx, OPCODE_TEXTURE_BARRIER_NV, 0);
9045 if (ctx->ExecuteFlag) {
9046 CALL_TextureBarrierNV(ctx->Exec, ());
9047 }
9048 }
9049
9050
9051 /* GL_ARB_sampler_objects */
9052 static void GLAPIENTRY
save_BindSampler(GLuint unit,GLuint sampler)9053 save_BindSampler(GLuint unit, GLuint sampler)
9054 {
9055 Node *n;
9056 GET_CURRENT_CONTEXT(ctx);
9057 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9058 n = alloc_instruction(ctx, OPCODE_BIND_SAMPLER, 2);
9059 if (n) {
9060 n[1].ui = unit;
9061 n[2].ui = sampler;
9062 }
9063 if (ctx->ExecuteFlag) {
9064 CALL_BindSampler(ctx->Exec, (unit, sampler));
9065 }
9066 }
9067
9068 static void GLAPIENTRY
save_SamplerParameteriv(GLuint sampler,GLenum pname,const GLint * params)9069 save_SamplerParameteriv(GLuint sampler, GLenum pname, const GLint *params)
9070 {
9071 Node *n;
9072 GET_CURRENT_CONTEXT(ctx);
9073 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9074 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERIV, 6);
9075 if (n) {
9076 n[1].ui = sampler;
9077 n[2].e = pname;
9078 n[3].i = params[0];
9079 if (pname == GL_TEXTURE_BORDER_COLOR) {
9080 n[4].i = params[1];
9081 n[5].i = params[2];
9082 n[6].i = params[3];
9083 }
9084 else {
9085 n[4].i = n[5].i = n[6].i = 0;
9086 }
9087 }
9088 if (ctx->ExecuteFlag) {
9089 CALL_SamplerParameteriv(ctx->Exec, (sampler, pname, params));
9090 }
9091 }
9092
9093 static void GLAPIENTRY
save_SamplerParameteri(GLuint sampler,GLenum pname,GLint param)9094 save_SamplerParameteri(GLuint sampler, GLenum pname, GLint param)
9095 {
9096 GLint parray[4];
9097 parray[0] = param;
9098 parray[1] = parray[2] = parray[3] = 0;
9099 save_SamplerParameteriv(sampler, pname, parray);
9100 }
9101
9102 static void GLAPIENTRY
save_SamplerParameterfv(GLuint sampler,GLenum pname,const GLfloat * params)9103 save_SamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *params)
9104 {
9105 Node *n;
9106 GET_CURRENT_CONTEXT(ctx);
9107 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9108 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERFV, 6);
9109 if (n) {
9110 n[1].ui = sampler;
9111 n[2].e = pname;
9112 n[3].f = params[0];
9113 if (pname == GL_TEXTURE_BORDER_COLOR) {
9114 n[4].f = params[1];
9115 n[5].f = params[2];
9116 n[6].f = params[3];
9117 }
9118 else {
9119 n[4].f = n[5].f = n[6].f = 0.0F;
9120 }
9121 }
9122 if (ctx->ExecuteFlag) {
9123 CALL_SamplerParameterfv(ctx->Exec, (sampler, pname, params));
9124 }
9125 }
9126
9127 static void GLAPIENTRY
save_SamplerParameterf(GLuint sampler,GLenum pname,GLfloat param)9128 save_SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
9129 {
9130 GLfloat parray[4];
9131 parray[0] = param;
9132 parray[1] = parray[2] = parray[3] = 0.0F;
9133 save_SamplerParameterfv(sampler, pname, parray);
9134 }
9135
9136 static void GLAPIENTRY
save_SamplerParameterIiv(GLuint sampler,GLenum pname,const GLint * params)9137 save_SamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *params)
9138 {
9139 Node *n;
9140 GET_CURRENT_CONTEXT(ctx);
9141 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9142 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERIIV, 6);
9143 if (n) {
9144 n[1].ui = sampler;
9145 n[2].e = pname;
9146 n[3].i = params[0];
9147 if (pname == GL_TEXTURE_BORDER_COLOR) {
9148 n[4].i = params[1];
9149 n[5].i = params[2];
9150 n[6].i = params[3];
9151 }
9152 else {
9153 n[4].i = n[5].i = n[6].i = 0;
9154 }
9155 }
9156 if (ctx->ExecuteFlag) {
9157 CALL_SamplerParameterIiv(ctx->Exec, (sampler, pname, params));
9158 }
9159 }
9160
9161 static void GLAPIENTRY
save_SamplerParameterIuiv(GLuint sampler,GLenum pname,const GLuint * params)9162 save_SamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *params)
9163 {
9164 Node *n;
9165 GET_CURRENT_CONTEXT(ctx);
9166 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9167 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERUIV, 6);
9168 if (n) {
9169 n[1].ui = sampler;
9170 n[2].e = pname;
9171 n[3].ui = params[0];
9172 if (pname == GL_TEXTURE_BORDER_COLOR) {
9173 n[4].ui = params[1];
9174 n[5].ui = params[2];
9175 n[6].ui = params[3];
9176 }
9177 else {
9178 n[4].ui = n[5].ui = n[6].ui = 0;
9179 }
9180 }
9181 if (ctx->ExecuteFlag) {
9182 CALL_SamplerParameterIuiv(ctx->Exec, (sampler, pname, params));
9183 }
9184 }
9185
9186 static void GLAPIENTRY
save_WaitSync(GLsync sync,GLbitfield flags,GLuint64 timeout)9187 save_WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
9188 {
9189 Node *n;
9190 GET_CURRENT_CONTEXT(ctx);
9191 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9192 n = alloc_instruction(ctx, OPCODE_WAIT_SYNC, 4);
9193 if (n) {
9194 union uint64_pair p;
9195 p.uint64 = timeout;
9196 n[1].bf = flags;
9197 n[2].ui = p.uint32[0];
9198 n[3].ui = p.uint32[1];
9199 save_pointer(&n[4], sync);
9200 }
9201 if (ctx->ExecuteFlag) {
9202 CALL_WaitSync(ctx->Exec, (sync, flags, timeout));
9203 }
9204 }
9205
9206
9207 /** GL_NV_conditional_render */
9208 static void GLAPIENTRY
save_BeginConditionalRender(GLuint queryId,GLenum mode)9209 save_BeginConditionalRender(GLuint queryId, GLenum mode)
9210 {
9211 GET_CURRENT_CONTEXT(ctx);
9212 Node *n;
9213 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9214 n = alloc_instruction(ctx, OPCODE_BEGIN_CONDITIONAL_RENDER, 2);
9215 if (n) {
9216 n[1].i = queryId;
9217 n[2].e = mode;
9218 }
9219 if (ctx->ExecuteFlag) {
9220 CALL_BeginConditionalRender(ctx->Exec, (queryId, mode));
9221 }
9222 }
9223
9224 static void GLAPIENTRY
save_EndConditionalRender(void)9225 save_EndConditionalRender(void)
9226 {
9227 GET_CURRENT_CONTEXT(ctx);
9228 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9229 alloc_instruction(ctx, OPCODE_END_CONDITIONAL_RENDER, 0);
9230 if (ctx->ExecuteFlag) {
9231 CALL_EndConditionalRender(ctx->Exec, ());
9232 }
9233 }
9234
9235 static void GLAPIENTRY
save_UniformBlockBinding(GLuint prog,GLuint index,GLuint binding)9236 save_UniformBlockBinding(GLuint prog, GLuint index, GLuint binding)
9237 {
9238 GET_CURRENT_CONTEXT(ctx);
9239 Node *n;
9240 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9241 n = alloc_instruction(ctx, OPCODE_UNIFORM_BLOCK_BINDING, 3);
9242 if (n) {
9243 n[1].ui = prog;
9244 n[2].ui = index;
9245 n[3].ui = binding;
9246 }
9247 if (ctx->ExecuteFlag) {
9248 CALL_UniformBlockBinding(ctx->Exec, (prog, index, binding));
9249 }
9250 }
9251
9252 static void GLAPIENTRY
save_UniformSubroutinesuiv(GLenum shadertype,GLsizei count,const GLuint * indices)9253 save_UniformSubroutinesuiv(GLenum shadertype, GLsizei count,
9254 const GLuint *indices)
9255 {
9256 GET_CURRENT_CONTEXT(ctx);
9257 Node *n;
9258 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9259 n = alloc_instruction(ctx, OPCODE_UNIFORM_SUBROUTINES, 2 + POINTER_DWORDS);
9260 if (n) {
9261 GLint *indices_copy = NULL;
9262
9263 if (count > 0)
9264 indices_copy = memdup(indices, sizeof(GLuint) * 4 * count);
9265 n[1].e = shadertype;
9266 n[2].si = count;
9267 save_pointer(&n[3], indices_copy);
9268 }
9269 if (ctx->ExecuteFlag) {
9270 CALL_UniformSubroutinesuiv(ctx->Exec, (shadertype, count, indices));
9271 }
9272 }
9273
9274 /** GL_EXT_window_rectangles */
9275 static void GLAPIENTRY
save_WindowRectanglesEXT(GLenum mode,GLsizei count,const GLint * box)9276 save_WindowRectanglesEXT(GLenum mode, GLsizei count, const GLint *box)
9277 {
9278 GET_CURRENT_CONTEXT(ctx);
9279 Node *n;
9280 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9281 n = alloc_instruction(ctx, OPCODE_WINDOW_RECTANGLES, 2 + POINTER_DWORDS);
9282 if (n) {
9283 GLint *box_copy = NULL;
9284
9285 if (count > 0)
9286 box_copy = memdup(box, sizeof(GLint) * 4 * count);
9287 n[1].e = mode;
9288 n[2].si = count;
9289 save_pointer(&n[3], box_copy);
9290 }
9291 if (ctx->ExecuteFlag) {
9292 CALL_WindowRectanglesEXT(ctx->Exec, (mode, count, box));
9293 }
9294 }
9295
9296
9297 /** GL_NV_conservative_raster */
9298 static void GLAPIENTRY
save_SubpixelPrecisionBiasNV(GLuint xbits,GLuint ybits)9299 save_SubpixelPrecisionBiasNV(GLuint xbits, GLuint ybits)
9300 {
9301 GET_CURRENT_CONTEXT(ctx);
9302 Node *n;
9303 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9304 n = alloc_instruction(ctx, OPCODE_SUBPIXEL_PRECISION_BIAS, 2);
9305 if (n) {
9306 n[1].ui = xbits;
9307 n[2].ui = ybits;
9308 }
9309 if (ctx->ExecuteFlag) {
9310 CALL_SubpixelPrecisionBiasNV(ctx->Exec, (xbits, ybits));
9311 }
9312 }
9313
9314 /** GL_NV_conservative_raster_dilate */
9315 static void GLAPIENTRY
save_ConservativeRasterParameterfNV(GLenum pname,GLfloat param)9316 save_ConservativeRasterParameterfNV(GLenum pname, GLfloat param)
9317 {
9318 GET_CURRENT_CONTEXT(ctx);
9319 Node *n;
9320 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9321 n = alloc_instruction(ctx, OPCODE_CONSERVATIVE_RASTER_PARAMETER_F, 2);
9322 if (n) {
9323 n[1].e = pname;
9324 n[2].f = param;
9325 }
9326 if (ctx->ExecuteFlag) {
9327 CALL_ConservativeRasterParameterfNV(ctx->Exec, (pname, param));
9328 }
9329 }
9330
9331 /** GL_NV_conservative_raster_pre_snap_triangles */
9332 static void GLAPIENTRY
save_ConservativeRasterParameteriNV(GLenum pname,GLint param)9333 save_ConservativeRasterParameteriNV(GLenum pname, GLint param)
9334 {
9335 GET_CURRENT_CONTEXT(ctx);
9336 Node *n;
9337 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9338 n = alloc_instruction(ctx, OPCODE_CONSERVATIVE_RASTER_PARAMETER_I, 2);
9339 if (n) {
9340 n[1].e = pname;
9341 n[2].i = param;
9342 }
9343 if (ctx->ExecuteFlag) {
9344 CALL_ConservativeRasterParameteriNV(ctx->Exec, (pname, param));
9345 }
9346 }
9347
9348 /** GL_EXT_direct_state_access */
9349
9350 static void GLAPIENTRY
save_MatrixLoadfEXT(GLenum matrixMode,const GLfloat * m)9351 save_MatrixLoadfEXT(GLenum matrixMode, const GLfloat *m)
9352 {
9353 GET_CURRENT_CONTEXT(ctx);
9354 Node *n;
9355 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9356 n = alloc_instruction(ctx, OPCODE_MATRIX_LOAD, 17);
9357 if (n) {
9358 n[1].e = matrixMode;
9359 for (unsigned i = 0; i < 16; i++) {
9360 n[2 + i].f = m[i];
9361 }
9362 }
9363 if (ctx->ExecuteFlag) {
9364 CALL_MatrixLoadfEXT(ctx->Exec, (matrixMode, m));
9365 }
9366 }
9367
9368 static void GLAPIENTRY
save_MatrixLoaddEXT(GLenum matrixMode,const GLdouble * m)9369 save_MatrixLoaddEXT(GLenum matrixMode, const GLdouble *m)
9370 {
9371 GLfloat f[16];
9372 for (unsigned i = 0; i < 16; i++) {
9373 f[i] = (GLfloat) m[i];
9374 }
9375 save_MatrixLoadfEXT(matrixMode, f);
9376 }
9377
9378 static void GLAPIENTRY
save_MatrixMultfEXT(GLenum matrixMode,const GLfloat * m)9379 save_MatrixMultfEXT(GLenum matrixMode, const GLfloat * m)
9380 {
9381 GET_CURRENT_CONTEXT(ctx);
9382 Node *n;
9383 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9384 n = alloc_instruction(ctx, OPCODE_MATRIX_MULT, 17);
9385 if (n) {
9386 n[1].e = matrixMode;
9387 for (unsigned i = 0; i < 16; i++) {
9388 n[2 + i].f = m[i];
9389 }
9390 }
9391 if (ctx->ExecuteFlag) {
9392 CALL_MatrixMultfEXT(ctx->Exec, (matrixMode, m));
9393 }
9394 }
9395
9396 static void GLAPIENTRY
save_MatrixMultdEXT(GLenum matrixMode,const GLdouble * m)9397 save_MatrixMultdEXT(GLenum matrixMode, const GLdouble * m)
9398 {
9399 GLfloat f[16];
9400 for (unsigned i = 0; i < 16; i++) {
9401 f[i] = (GLfloat) m[i];
9402 }
9403 save_MatrixMultfEXT(matrixMode, f);
9404 }
9405
9406 static void GLAPIENTRY
save_MatrixRotatefEXT(GLenum matrixMode,GLfloat angle,GLfloat x,GLfloat y,GLfloat z)9407 save_MatrixRotatefEXT(GLenum matrixMode, GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
9408 {
9409 GET_CURRENT_CONTEXT(ctx);
9410 Node *n;
9411 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9412 n = alloc_instruction(ctx, OPCODE_MATRIX_ROTATE, 5);
9413 if (n) {
9414 n[1].e = matrixMode;
9415 n[2].f = angle;
9416 n[3].f = x;
9417 n[4].f = y;
9418 n[5].f = z;
9419 }
9420 if (ctx->ExecuteFlag) {
9421 CALL_MatrixRotatefEXT(ctx->Exec, (matrixMode, angle, x, y, z));
9422 }
9423 }
9424
9425 static void GLAPIENTRY
save_MatrixRotatedEXT(GLenum matrixMode,GLdouble angle,GLdouble x,GLdouble y,GLdouble z)9426 save_MatrixRotatedEXT(GLenum matrixMode, GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
9427 {
9428 save_MatrixRotatefEXT(matrixMode, (GLfloat) angle, (GLfloat) x, (GLfloat) y, (GLfloat) z);
9429 }
9430
9431 static void GLAPIENTRY
save_MatrixScalefEXT(GLenum matrixMode,GLfloat x,GLfloat y,GLfloat z)9432 save_MatrixScalefEXT(GLenum matrixMode, GLfloat x, GLfloat y, GLfloat z)
9433 {
9434 GET_CURRENT_CONTEXT(ctx);
9435 Node *n;
9436 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9437 n = alloc_instruction(ctx, OPCODE_MATRIX_SCALE, 4);
9438 if (n) {
9439 n[1].e = matrixMode;
9440 n[2].f = x;
9441 n[3].f = y;
9442 n[4].f = z;
9443 }
9444 if (ctx->ExecuteFlag) {
9445 CALL_MatrixScalefEXT(ctx->Exec, (matrixMode, x, y, z));
9446 }
9447 }
9448
9449 static void GLAPIENTRY
save_MatrixScaledEXT(GLenum matrixMode,GLdouble x,GLdouble y,GLdouble z)9450 save_MatrixScaledEXT(GLenum matrixMode, GLdouble x, GLdouble y, GLdouble z)
9451 {
9452 save_MatrixScalefEXT(matrixMode, (GLfloat) x, (GLfloat) y, (GLfloat) z);
9453 }
9454
9455 static void GLAPIENTRY
save_MatrixTranslatefEXT(GLenum matrixMode,GLfloat x,GLfloat y,GLfloat z)9456 save_MatrixTranslatefEXT(GLenum matrixMode, GLfloat x, GLfloat y, GLfloat z)
9457 {
9458 GET_CURRENT_CONTEXT(ctx);
9459 Node *n;
9460 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9461 n = alloc_instruction(ctx, OPCODE_MATRIX_TRANSLATE, 4);
9462 if (n) {
9463 n[1].e = matrixMode;
9464 n[2].f = x;
9465 n[3].f = y;
9466 n[4].f = z;
9467 }
9468 if (ctx->ExecuteFlag) {
9469 CALL_MatrixTranslatefEXT(ctx->Exec, (matrixMode, x, y, z));
9470 }
9471 }
9472
9473 static void GLAPIENTRY
save_MatrixTranslatedEXT(GLenum matrixMode,GLdouble x,GLdouble y,GLdouble z)9474 save_MatrixTranslatedEXT(GLenum matrixMode, GLdouble x, GLdouble y, GLdouble z)
9475 {
9476 save_MatrixTranslatefEXT(matrixMode, (GLfloat) x, (GLfloat) y, (GLfloat) z);
9477 }
9478
9479 static void GLAPIENTRY
save_MatrixLoadIdentityEXT(GLenum matrixMode)9480 save_MatrixLoadIdentityEXT(GLenum matrixMode)
9481 {
9482 GET_CURRENT_CONTEXT(ctx);
9483 Node *n;
9484 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9485 n = alloc_instruction(ctx, OPCODE_MATRIX_LOAD_IDENTITY, 1);
9486 if (n) {
9487 n[1].e = matrixMode;
9488 }
9489 if (ctx->ExecuteFlag) {
9490 CALL_MatrixLoadIdentityEXT(ctx->Exec, (matrixMode));
9491 }
9492 }
9493
9494 static void GLAPIENTRY
save_MatrixOrthoEXT(GLenum matrixMode,GLdouble left,GLdouble right,GLdouble bottom,GLdouble top,GLdouble nearval,GLdouble farval)9495 save_MatrixOrthoEXT(GLenum matrixMode, GLdouble left, GLdouble right,
9496 GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval)
9497 {
9498 GET_CURRENT_CONTEXT(ctx);
9499 Node *n;
9500 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9501 n = alloc_instruction(ctx, OPCODE_MATRIX_ORTHO, 7);
9502 if (n) {
9503 n[1].e = matrixMode;
9504 n[2].f = (GLfloat) left;
9505 n[3].f = (GLfloat) right;
9506 n[4].f = (GLfloat) bottom;
9507 n[5].f = (GLfloat) top;
9508 n[6].f = (GLfloat) nearval;
9509 n[7].f = (GLfloat) farval;
9510 }
9511 if (ctx->ExecuteFlag) {
9512 CALL_MatrixOrthoEXT(ctx->Exec, (matrixMode, left, right, bottom, top, nearval, farval));
9513 }
9514 }
9515
9516
9517 static void GLAPIENTRY
save_MatrixFrustumEXT(GLenum matrixMode,GLdouble left,GLdouble right,GLdouble bottom,GLdouble top,GLdouble nearval,GLdouble farval)9518 save_MatrixFrustumEXT(GLenum matrixMode, GLdouble left, GLdouble right,
9519 GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval)
9520 {
9521 GET_CURRENT_CONTEXT(ctx);
9522 Node *n;
9523 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9524 n = alloc_instruction(ctx, OPCODE_MATRIX_FRUSTUM, 7);
9525 if (n) {
9526 n[1].e = matrixMode;
9527 n[2].f = (GLfloat) left;
9528 n[3].f = (GLfloat) right;
9529 n[4].f = (GLfloat) bottom;
9530 n[5].f = (GLfloat) top;
9531 n[6].f = (GLfloat) nearval;
9532 n[7].f = (GLfloat) farval;
9533 }
9534 if (ctx->ExecuteFlag) {
9535 CALL_MatrixFrustumEXT(ctx->Exec, (matrixMode, left, right, bottom, top, nearval, farval));
9536 }
9537 }
9538
9539 static void GLAPIENTRY
save_MatrixPushEXT(GLenum matrixMode)9540 save_MatrixPushEXT(GLenum matrixMode)
9541 {
9542 GET_CURRENT_CONTEXT(ctx);
9543 Node* n;
9544 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9545 n = alloc_instruction(ctx, OPCODE_MATRIX_PUSH, 1);
9546 if (n) {
9547 n[1].e = matrixMode;
9548 }
9549 if (ctx->ExecuteFlag) {
9550 CALL_MatrixPushEXT(ctx->Exec, (matrixMode));
9551 }
9552 }
9553
9554 static void GLAPIENTRY
save_MatrixPopEXT(GLenum matrixMode)9555 save_MatrixPopEXT(GLenum matrixMode)
9556 {
9557 GET_CURRENT_CONTEXT(ctx);
9558 Node* n;
9559 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9560 n = alloc_instruction(ctx, OPCODE_MATRIX_POP, 1);
9561 if (n) {
9562 n[1].e = matrixMode;
9563 }
9564 if (ctx->ExecuteFlag) {
9565 CALL_MatrixPopEXT(ctx->Exec, (matrixMode));
9566 }
9567 }
9568
9569 static void GLAPIENTRY
save_MatrixLoadTransposefEXT(GLenum matrixMode,const GLfloat m[16])9570 save_MatrixLoadTransposefEXT(GLenum matrixMode, const GLfloat m[16])
9571 {
9572 GLfloat tm[16];
9573 _math_transposef(tm, m);
9574 save_MatrixLoadfEXT(matrixMode, tm);
9575 }
9576
9577 static void GLAPIENTRY
save_MatrixLoadTransposedEXT(GLenum matrixMode,const GLdouble m[16])9578 save_MatrixLoadTransposedEXT(GLenum matrixMode, const GLdouble m[16])
9579 {
9580 GLfloat tm[16];
9581 _math_transposefd(tm, m);
9582 save_MatrixLoadfEXT(matrixMode, tm);
9583 }
9584
9585 static void GLAPIENTRY
save_MatrixMultTransposefEXT(GLenum matrixMode,const GLfloat m[16])9586 save_MatrixMultTransposefEXT(GLenum matrixMode, const GLfloat m[16])
9587 {
9588 GLfloat tm[16];
9589 _math_transposef(tm, m);
9590 save_MatrixMultfEXT(matrixMode, tm);
9591 }
9592
9593 static void GLAPIENTRY
save_MatrixMultTransposedEXT(GLenum matrixMode,const GLdouble m[16])9594 save_MatrixMultTransposedEXT(GLenum matrixMode, const GLdouble m[16])
9595 {
9596 GLfloat tm[16];
9597 _math_transposefd(tm, m);
9598 save_MatrixMultfEXT(matrixMode, tm);
9599 }
9600
9601 static void GLAPIENTRY
save_TextureParameterfvEXT(GLuint texture,GLenum target,GLenum pname,const GLfloat * params)9602 save_TextureParameterfvEXT(GLuint texture, GLenum target, GLenum pname,
9603 const GLfloat *params)
9604 {
9605 GET_CURRENT_CONTEXT(ctx);
9606 Node *n;
9607 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9608 n = alloc_instruction(ctx, OPCODE_TEXTUREPARAMETER_F, 7);
9609 if (n) {
9610 n[1].ui = texture;
9611 n[2].e = target;
9612 n[3].e = pname;
9613 n[4].f = params[0];
9614 n[5].f = params[1];
9615 n[6].f = params[2];
9616 n[7].f = params[3];
9617 }
9618 if (ctx->ExecuteFlag) {
9619 CALL_TextureParameterfvEXT(ctx->Exec, (texture, target, pname, params));
9620 }
9621 }
9622
9623
9624 static void GLAPIENTRY
save_TextureParameterfEXT(GLuint texture,GLenum target,GLenum pname,GLfloat param)9625 save_TextureParameterfEXT(GLuint texture, GLenum target, GLenum pname, GLfloat param)
9626 {
9627 GLfloat parray[4];
9628 parray[0] = param;
9629 parray[1] = parray[2] = parray[3] = 0.0F;
9630 save_TextureParameterfvEXT(texture, target, pname, parray);
9631 }
9632
9633 static void GLAPIENTRY
save_TextureParameterivEXT(GLuint texture,GLenum target,GLenum pname,const GLint * params)9634 save_TextureParameterivEXT(GLuint texture, GLenum target, GLenum pname, const GLint *params)
9635 {
9636 GET_CURRENT_CONTEXT(ctx);
9637 Node *n;
9638 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9639 n = alloc_instruction(ctx, OPCODE_TEXTUREPARAMETER_I, 7);
9640 if (n) {
9641 n[1].ui = texture;
9642 n[2].e = target;
9643 n[3].e = pname;
9644 n[4].i = params[0];
9645 n[5].i = params[1];
9646 n[6].i = params[2];
9647 n[7].i = params[3];
9648 }
9649 if (ctx->ExecuteFlag) {
9650 CALL_TextureParameterivEXT(ctx->Exec, (texture, target, pname, params));
9651 }
9652 }
9653
9654 static void GLAPIENTRY
save_TextureParameteriEXT(GLuint texture,GLenum target,GLenum pname,GLint param)9655 save_TextureParameteriEXT(GLuint texture, GLenum target, GLenum pname, GLint param)
9656 {
9657 GLint fparam[4];
9658 fparam[0] = param;
9659 fparam[1] = fparam[2] = fparam[3] = 0;
9660 save_TextureParameterivEXT(texture, target, pname, fparam);
9661 }
9662
9663 static void GLAPIENTRY
save_TextureParameterIivEXT(GLuint texture,GLenum target,GLenum pname,const GLint * params)9664 save_TextureParameterIivEXT(GLuint texture, GLenum target, GLenum pname, const GLint* params)
9665 {
9666 GET_CURRENT_CONTEXT(ctx);
9667 Node *n;
9668 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9669 n = alloc_instruction(ctx, OPCODE_TEXTUREPARAMETER_II, 7);
9670 if (n) {
9671 n[1].ui = texture;
9672 n[2].e = target;
9673 n[3].e = pname;
9674 n[4].i = params[0];
9675 n[5].i = params[1];
9676 n[6].i = params[2];
9677 n[7].i = params[3];
9678 }
9679 if (ctx->ExecuteFlag) {
9680 CALL_TextureParameterIivEXT(ctx->Exec, (texture, target, pname, params));
9681 }
9682 }
9683
9684 static void GLAPIENTRY
save_TextureParameterIuivEXT(GLuint texture,GLenum target,GLenum pname,const GLuint * params)9685 save_TextureParameterIuivEXT(GLuint texture, GLenum target, GLenum pname, const GLuint* params)
9686 {
9687 GET_CURRENT_CONTEXT(ctx);
9688 Node *n;
9689 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9690 n = alloc_instruction(ctx, OPCODE_TEXTUREPARAMETER_IUI, 7);
9691 if (n) {
9692 n[1].ui = texture;
9693 n[2].e = target;
9694 n[3].e = pname;
9695 n[4].ui = params[0];
9696 n[5].ui = params[1];
9697 n[6].ui = params[2];
9698 n[7].ui = params[3];
9699 }
9700 if (ctx->ExecuteFlag) {
9701 CALL_TextureParameterIuivEXT(ctx->Exec, (texture, target, pname, params));
9702 }
9703 }
9704
9705
9706 static void GLAPIENTRY
save_TextureImage1DEXT(GLuint texture,GLenum target,GLint level,GLint components,GLsizei width,GLint border,GLenum format,GLenum type,const GLvoid * pixels)9707 save_TextureImage1DEXT(GLuint texture, GLenum target,
9708 GLint level, GLint components,
9709 GLsizei width, GLint border,
9710 GLenum format, GLenum type, const GLvoid * pixels)
9711 {
9712 GET_CURRENT_CONTEXT(ctx);
9713 if (target == GL_PROXY_TEXTURE_1D) {
9714 /* don't compile, execute immediately */
9715 CALL_TextureImage1DEXT(ctx->Exec, (texture, target, level, components, width,
9716 border, format, type, pixels));
9717 }
9718 else {
9719 Node *n;
9720 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9721 n = alloc_instruction(ctx, OPCODE_TEXTURE_IMAGE1D, 8 + POINTER_DWORDS);
9722 if (n) {
9723 n[1].ui = texture;
9724 n[2].e = target;
9725 n[3].i = level;
9726 n[4].i = components;
9727 n[5].i = (GLint) width;
9728 n[6].i = border;
9729 n[7].e = format;
9730 n[8].e = type;
9731 save_pointer(&n[9],
9732 unpack_image(ctx, 1, width, 1, 1, format, type,
9733 pixels, &ctx->Unpack));
9734 }
9735 if (ctx->ExecuteFlag) {
9736 CALL_TextureImage1DEXT(ctx->Exec, (texture, target, level, components, width,
9737 border, format, type, pixels));
9738 }
9739 }
9740 }
9741
9742
9743 static void GLAPIENTRY
save_TextureImage2DEXT(GLuint texture,GLenum target,GLint level,GLint components,GLsizei width,GLsizei height,GLint border,GLenum format,GLenum type,const GLvoid * pixels)9744 save_TextureImage2DEXT(GLuint texture, GLenum target,
9745 GLint level, GLint components,
9746 GLsizei width, GLsizei height, GLint border,
9747 GLenum format, GLenum type, const GLvoid * pixels)
9748 {
9749 GET_CURRENT_CONTEXT(ctx);
9750 if (target == GL_PROXY_TEXTURE_2D) {
9751 /* don't compile, execute immediately */
9752 CALL_TextureImage2DEXT(ctx->Exec, (texture, target, level, components, width,
9753 height, border, format, type, pixels));
9754 }
9755 else {
9756 Node *n;
9757 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9758 n = alloc_instruction(ctx, OPCODE_TEXTURE_IMAGE2D, 9 + POINTER_DWORDS);
9759 if (n) {
9760 n[1].ui = texture;
9761 n[2].e = target;
9762 n[3].i = level;
9763 n[4].i = components;
9764 n[5].i = (GLint) width;
9765 n[6].i = (GLint) height;
9766 n[7].i = border;
9767 n[8].e = format;
9768 n[9].e = type;
9769 save_pointer(&n[10],
9770 unpack_image(ctx, 2, width, height, 1, format, type,
9771 pixels, &ctx->Unpack));
9772 }
9773 if (ctx->ExecuteFlag) {
9774 CALL_TextureImage2DEXT(ctx->Exec, (texture, target, level, components, width,
9775 height, border, format, type, pixels));
9776 }
9777 }
9778 }
9779
9780
9781 static void GLAPIENTRY
save_TextureImage3DEXT(GLuint texture,GLenum target,GLint level,GLint internalFormat,GLsizei width,GLsizei height,GLsizei depth,GLint border,GLenum format,GLenum type,const GLvoid * pixels)9782 save_TextureImage3DEXT(GLuint texture, GLenum target,
9783 GLint level, GLint internalFormat,
9784 GLsizei width, GLsizei height, GLsizei depth,
9785 GLint border,
9786 GLenum format, GLenum type, const GLvoid * pixels)
9787 {
9788 GET_CURRENT_CONTEXT(ctx);
9789 if (target == GL_PROXY_TEXTURE_3D) {
9790 /* don't compile, execute immediately */
9791 CALL_TextureImage3DEXT(ctx->Exec, (texture, target, level, internalFormat, width,
9792 height, depth, border, format, type,
9793 pixels));
9794 }
9795 else {
9796 Node *n;
9797 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9798 n = alloc_instruction(ctx, OPCODE_TEXTURE_IMAGE3D, 10 + POINTER_DWORDS);
9799 if (n) {
9800 n[1].ui = texture;
9801 n[2].e = target;
9802 n[3].i = level;
9803 n[4].i = (GLint) internalFormat;
9804 n[5].i = (GLint) width;
9805 n[6].i = (GLint) height;
9806 n[7].i = (GLint) depth;
9807 n[8].i = border;
9808 n[9].e = format;
9809 n[10].e = type;
9810 save_pointer(&n[11],
9811 unpack_image(ctx, 3, width, height, depth, format, type,
9812 pixels, &ctx->Unpack));
9813 }
9814 if (ctx->ExecuteFlag) {
9815 CALL_TextureImage3DEXT(ctx->Exec, (texture, target, level, internalFormat,
9816 width, height, depth, border, format,
9817 type, pixels));
9818 }
9819 }
9820 }
9821
9822
9823 static void GLAPIENTRY
save_TextureSubImage1DEXT(GLuint texture,GLenum target,GLint level,GLint xoffset,GLsizei width,GLenum format,GLenum type,const GLvoid * pixels)9824 save_TextureSubImage1DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset,
9825 GLsizei width, GLenum format, GLenum type,
9826 const GLvoid * pixels)
9827 {
9828 GET_CURRENT_CONTEXT(ctx);
9829 Node *n;
9830
9831 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9832
9833 n = alloc_instruction(ctx, OPCODE_TEXTURE_SUB_IMAGE1D, 7 + POINTER_DWORDS);
9834 if (n) {
9835 n[1].ui = texture;
9836 n[2].e = target;
9837 n[3].i = level;
9838 n[4].i = xoffset;
9839 n[5].i = (GLint) width;
9840 n[6].e = format;
9841 n[7].e = type;
9842 save_pointer(&n[8],
9843 unpack_image(ctx, 1, width, 1, 1, format, type,
9844 pixels, &ctx->Unpack));
9845 }
9846 if (ctx->ExecuteFlag) {
9847 CALL_TextureSubImage1DEXT(ctx->Exec, (texture, target, level, xoffset, width,
9848 format, type, pixels));
9849 }
9850 }
9851
9852
9853 static void GLAPIENTRY
save_TextureSubImage2DEXT(GLuint texture,GLenum target,GLint level,GLint xoffset,GLint yoffset,GLsizei width,GLsizei height,GLenum format,GLenum type,const GLvoid * pixels)9854 save_TextureSubImage2DEXT(GLuint texture, GLenum target, GLint level,
9855 GLint xoffset, GLint yoffset,
9856 GLsizei width, GLsizei height,
9857 GLenum format, GLenum type, const GLvoid * pixels)
9858 {
9859 GET_CURRENT_CONTEXT(ctx);
9860 Node *n;
9861
9862 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9863
9864 n = alloc_instruction(ctx, OPCODE_TEXTURE_SUB_IMAGE2D, 9 + POINTER_DWORDS);
9865 if (n) {
9866 n[1].ui = texture;
9867 n[2].e = target;
9868 n[3].i = level;
9869 n[4].i = xoffset;
9870 n[5].i = yoffset;
9871 n[6].i = (GLint) width;
9872 n[7].i = (GLint) height;
9873 n[8].e = format;
9874 n[9].e = type;
9875 save_pointer(&n[10],
9876 unpack_image(ctx, 2, width, height, 1, format, type,
9877 pixels, &ctx->Unpack));
9878 }
9879 if (ctx->ExecuteFlag) {
9880 CALL_TextureSubImage2DEXT(ctx->Exec, (texture, target, level, xoffset, yoffset,
9881 width, height, format, type, pixels));
9882 }
9883 }
9884
9885
9886 static void GLAPIENTRY
save_TextureSubImage3DEXT(GLuint texture,GLenum target,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLsizei width,GLsizei height,GLsizei depth,GLenum format,GLenum type,const GLvoid * pixels)9887 save_TextureSubImage3DEXT(GLuint texture, GLenum target, GLint level,
9888 GLint xoffset, GLint yoffset, GLint zoffset,
9889 GLsizei width, GLsizei height, GLsizei depth,
9890 GLenum format, GLenum type, const GLvoid * pixels)
9891 {
9892 GET_CURRENT_CONTEXT(ctx);
9893 Node *n;
9894
9895 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9896
9897 n = alloc_instruction(ctx, OPCODE_TEXTURE_SUB_IMAGE3D, 11 + POINTER_DWORDS);
9898 if (n) {
9899 n[1].ui = texture;
9900 n[2].e = target;
9901 n[3].i = level;
9902 n[4].i = xoffset;
9903 n[5].i = yoffset;
9904 n[6].i = zoffset;
9905 n[7].i = (GLint) width;
9906 n[8].i = (GLint) height;
9907 n[9].i = (GLint) depth;
9908 n[10].e = format;
9909 n[11].e = type;
9910 save_pointer(&n[12],
9911 unpack_image(ctx, 3, width, height, depth, format, type,
9912 pixels, &ctx->Unpack));
9913 }
9914 if (ctx->ExecuteFlag) {
9915 CALL_TextureSubImage3DEXT(ctx->Exec, (texture, target, level,
9916 xoffset, yoffset, zoffset,
9917 width, height, depth, format, type,
9918 pixels));
9919 }
9920 }
9921
9922 static void GLAPIENTRY
save_CopyTextureImage1DEXT(GLuint texture,GLenum target,GLint level,GLenum internalformat,GLint x,GLint y,GLsizei width,GLint border)9923 save_CopyTextureImage1DEXT(GLuint texture, GLenum target, GLint level,
9924 GLenum internalformat, GLint x, GLint y,
9925 GLsizei width, GLint border)
9926 {
9927 GET_CURRENT_CONTEXT(ctx);
9928 Node *n;
9929 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9930 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_IMAGE1D, 8);
9931 if (n) {
9932 n[1].ui = texture;
9933 n[2].e = target;
9934 n[3].i = level;
9935 n[4].e = internalformat;
9936 n[5].i = x;
9937 n[6].i = y;
9938 n[7].i = width;
9939 n[8].i = border;
9940 }
9941 if (ctx->ExecuteFlag) {
9942 CALL_CopyTextureImage1DEXT(ctx->Exec, (texture, target, level,
9943 internalformat, x, y,
9944 width, border));
9945 }
9946 }
9947
9948 static void GLAPIENTRY
save_CopyTextureImage2DEXT(GLuint texture,GLenum target,GLint level,GLenum internalformat,GLint x,GLint y,GLsizei width,GLsizei height,GLint border)9949 save_CopyTextureImage2DEXT(GLuint texture, GLenum target, GLint level,
9950 GLenum internalformat,
9951 GLint x, GLint y, GLsizei width,
9952 GLsizei height, GLint border)
9953 {
9954 GET_CURRENT_CONTEXT(ctx);
9955 Node *n;
9956 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9957 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_IMAGE2D, 9);
9958 if (n) {
9959 n[1].ui = texture;
9960 n[2].e = target;
9961 n[3].i = level;
9962 n[4].e = internalformat;
9963 n[5].i = x;
9964 n[6].i = y;
9965 n[7].i = width;
9966 n[8].i = height;
9967 n[9].i = border;
9968 }
9969 if (ctx->ExecuteFlag) {
9970 CALL_CopyTextureImage2DEXT(ctx->Exec, (texture, target, level,
9971 internalformat, x, y,
9972 width, height, border));
9973 }
9974 }
9975
9976 static void GLAPIENTRY
save_CopyTextureSubImage1DEXT(GLuint texture,GLenum target,GLint level,GLint xoffset,GLint x,GLint y,GLsizei width)9977 save_CopyTextureSubImage1DEXT(GLuint texture, GLenum target, GLint level,
9978 GLint xoffset, GLint x, GLint y, GLsizei width)
9979 {
9980 GET_CURRENT_CONTEXT(ctx);
9981 Node *n;
9982 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9983 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_SUB_IMAGE1D, 7);
9984 if (n) {
9985 n[1].ui = texture;
9986 n[2].e = target;
9987 n[3].i = level;
9988 n[4].i = xoffset;
9989 n[5].i = x;
9990 n[6].i = y;
9991 n[7].i = width;
9992 }
9993 if (ctx->ExecuteFlag) {
9994 CALL_CopyTextureSubImage1DEXT(ctx->Exec,
9995 (texture, target, level, xoffset, x, y, width));
9996 }
9997 }
9998
9999 static void GLAPIENTRY
save_CopyTextureSubImage2DEXT(GLuint texture,GLenum target,GLint level,GLint xoffset,GLint yoffset,GLint x,GLint y,GLsizei width,GLint height)10000 save_CopyTextureSubImage2DEXT(GLuint texture, GLenum target, GLint level,
10001 GLint xoffset, GLint yoffset,
10002 GLint x, GLint y, GLsizei width, GLint height)
10003 {
10004 GET_CURRENT_CONTEXT(ctx);
10005 Node *n;
10006 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10007 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_SUB_IMAGE2D, 9);
10008 if (n) {
10009 n[1].ui = texture;
10010 n[2].e = target;
10011 n[3].i = level;
10012 n[4].i = xoffset;
10013 n[5].i = yoffset;
10014 n[6].i = x;
10015 n[7].i = y;
10016 n[8].i = width;
10017 n[9].i = height;
10018 }
10019 if (ctx->ExecuteFlag) {
10020 CALL_CopyTextureSubImage2DEXT(ctx->Exec, (texture, target, level,
10021 xoffset, yoffset,
10022 x, y, width, height));
10023 }
10024 }
10025
10026
10027 static void GLAPIENTRY
save_CopyTextureSubImage3DEXT(GLuint texture,GLenum target,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLint x,GLint y,GLsizei width,GLint height)10028 save_CopyTextureSubImage3DEXT(GLuint texture, GLenum target, GLint level,
10029 GLint xoffset, GLint yoffset, GLint zoffset,
10030 GLint x, GLint y, GLsizei width, GLint height)
10031 {
10032 GET_CURRENT_CONTEXT(ctx);
10033 Node *n;
10034 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10035 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_SUB_IMAGE3D, 10);
10036 if (n) {
10037 n[1].ui = texture;
10038 n[2].e = target;
10039 n[3].i = level;
10040 n[4].i = xoffset;
10041 n[5].i = yoffset;
10042 n[6].i = zoffset;
10043 n[7].i = x;
10044 n[8].i = y;
10045 n[9].i = width;
10046 n[10].i = height;
10047 }
10048 if (ctx->ExecuteFlag) {
10049 CALL_CopyTextureSubImage3DEXT(ctx->Exec, (texture, target, level,
10050 xoffset, yoffset, zoffset,
10051 x, y, width, height));
10052 }
10053 }
10054
10055
10056 static void GLAPIENTRY
save_BindMultiTextureEXT(GLenum texunit,GLenum target,GLuint texture)10057 save_BindMultiTextureEXT(GLenum texunit, GLenum target, GLuint texture)
10058 {
10059 GET_CURRENT_CONTEXT(ctx);
10060 Node *n;
10061 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10062 n = alloc_instruction(ctx, OPCODE_BIND_MULTITEXTURE, 3);
10063 if (n) {
10064 n[1].e = texunit;
10065 n[2].e = target;
10066 n[3].ui = texture;
10067 }
10068 if (ctx->ExecuteFlag) {
10069 CALL_BindMultiTextureEXT(ctx->Exec, (texunit, target, texture));
10070 }
10071 }
10072
10073
10074 static void GLAPIENTRY
save_MultiTexParameterfvEXT(GLenum texunit,GLenum target,GLenum pname,const GLfloat * params)10075 save_MultiTexParameterfvEXT(GLenum texunit, GLenum target, GLenum pname,
10076 const GLfloat *params)
10077 {
10078 GET_CURRENT_CONTEXT(ctx);
10079 Node *n;
10080 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10081 n = alloc_instruction(ctx, OPCODE_MULTITEXPARAMETER_F, 7);
10082 if (n) {
10083 n[1].e = texunit;
10084 n[2].e = target;
10085 n[3].e = pname;
10086 n[4].f = params[0];
10087 n[5].f = params[1];
10088 n[6].f = params[2];
10089 n[7].f = params[3];
10090 }
10091 if (ctx->ExecuteFlag) {
10092 CALL_MultiTexParameterfvEXT(ctx->Exec, (texunit, target, pname, params));
10093 }
10094 }
10095
10096
10097 static void GLAPIENTRY
save_MultiTexParameterfEXT(GLenum texunit,GLenum target,GLenum pname,GLfloat param)10098 save_MultiTexParameterfEXT(GLenum texunit, GLenum target, GLenum pname, GLfloat param)
10099 {
10100 GLfloat parray[4];
10101 parray[0] = param;
10102 parray[1] = parray[2] = parray[3] = 0.0F;
10103 save_MultiTexParameterfvEXT(texunit, target, pname, parray);
10104 }
10105
10106 static void GLAPIENTRY
save_MultiTexParameterivEXT(GLenum texunit,GLenum target,GLenum pname,const GLint * params)10107 save_MultiTexParameterivEXT(GLenum texunit, GLenum target, GLenum pname, const GLint *params)
10108 {
10109 GET_CURRENT_CONTEXT(ctx);
10110 Node *n;
10111 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10112 n = alloc_instruction(ctx, OPCODE_MULTITEXPARAMETER_I, 7);
10113 if (n) {
10114 n[1].e = texunit;
10115 n[2].e = target;
10116 n[3].e = pname;
10117 n[4].i = params[0];
10118 n[5].i = params[1];
10119 n[6].i = params[2];
10120 n[7].i = params[3];
10121 }
10122 if (ctx->ExecuteFlag) {
10123 CALL_MultiTexParameterivEXT(ctx->Exec, (texunit, target, pname, params));
10124 }
10125 }
10126
10127 static void GLAPIENTRY
save_MultiTexParameterIivEXT(GLenum texunit,GLenum target,GLenum pname,const GLint * params)10128 save_MultiTexParameterIivEXT(GLenum texunit, GLenum target, GLenum pname, const GLint *params)
10129 {
10130 GET_CURRENT_CONTEXT(ctx);
10131 Node *n;
10132 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10133 n = alloc_instruction(ctx, OPCODE_MULTITEXPARAMETER_II, 7);
10134 if (n) {
10135 n[1].e = texunit;
10136 n[2].e = target;
10137 n[3].e = pname;
10138 n[4].i = params[0];
10139 n[5].i = params[1];
10140 n[6].i = params[2];
10141 n[7].i = params[3];
10142 }
10143 if (ctx->ExecuteFlag) {
10144 CALL_MultiTexParameterIivEXT(ctx->Exec, (texunit, target, pname, params));
10145 }
10146 }
10147
10148 static void GLAPIENTRY
save_MultiTexParameterIuivEXT(GLenum texunit,GLenum target,GLenum pname,const GLuint * params)10149 save_MultiTexParameterIuivEXT(GLenum texunit, GLenum target, GLenum pname, const GLuint *params)
10150 {
10151 GET_CURRENT_CONTEXT(ctx);
10152 Node *n;
10153 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10154 n = alloc_instruction(ctx, OPCODE_MULTITEXPARAMETER_IUI, 7);
10155 if (n) {
10156 n[1].e = texunit;
10157 n[2].e = target;
10158 n[3].e = pname;
10159 n[4].ui = params[0];
10160 n[5].ui = params[1];
10161 n[6].ui = params[2];
10162 n[7].ui = params[3];
10163 }
10164 if (ctx->ExecuteFlag) {
10165 CALL_MultiTexParameterIuivEXT(ctx->Exec, (texunit, target, pname, params));
10166 }
10167 }
10168
10169 static void GLAPIENTRY
save_MultiTexParameteriEXT(GLenum texunit,GLenum target,GLenum pname,GLint param)10170 save_MultiTexParameteriEXT(GLenum texunit, GLenum target, GLenum pname, GLint param)
10171 {
10172 GLint fparam[4];
10173 fparam[0] = param;
10174 fparam[1] = fparam[2] = fparam[3] = 0;
10175 save_MultiTexParameterivEXT(texunit, target, pname, fparam);
10176 }
10177
10178
10179 static void GLAPIENTRY
save_MultiTexImage1DEXT(GLenum texunit,GLenum target,GLint level,GLint components,GLsizei width,GLint border,GLenum format,GLenum type,const GLvoid * pixels)10180 save_MultiTexImage1DEXT(GLenum texunit, GLenum target,
10181 GLint level, GLint components,
10182 GLsizei width, GLint border,
10183 GLenum format, GLenum type, const GLvoid * pixels)
10184 {
10185 GET_CURRENT_CONTEXT(ctx);
10186 if (target == GL_PROXY_TEXTURE_1D) {
10187 /* don't compile, execute immediately */
10188 CALL_MultiTexImage1DEXT(ctx->Exec, (texunit, target, level, components, width,
10189 border, format, type, pixels));
10190 }
10191 else {
10192 Node *n;
10193 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10194 n = alloc_instruction(ctx, OPCODE_MULTITEX_IMAGE1D, 8 + POINTER_DWORDS);
10195 if (n) {
10196 n[1].e = texunit;
10197 n[2].e = target;
10198 n[3].i = level;
10199 n[4].i = components;
10200 n[5].i = (GLint) width;
10201 n[6].i = border;
10202 n[7].e = format;
10203 n[8].e = type;
10204 save_pointer(&n[9],
10205 unpack_image(ctx, 1, width, 1, 1, format, type,
10206 pixels, &ctx->Unpack));
10207 }
10208 if (ctx->ExecuteFlag) {
10209 CALL_MultiTexImage1DEXT(ctx->Exec, (texunit, target, level, components, width,
10210 border, format, type, pixels));
10211 }
10212 }
10213 }
10214
10215
10216 static void GLAPIENTRY
save_MultiTexImage2DEXT(GLenum texunit,GLenum target,GLint level,GLint components,GLsizei width,GLsizei height,GLint border,GLenum format,GLenum type,const GLvoid * pixels)10217 save_MultiTexImage2DEXT(GLenum texunit, GLenum target,
10218 GLint level, GLint components,
10219 GLsizei width, GLsizei height, GLint border,
10220 GLenum format, GLenum type, const GLvoid * pixels)
10221 {
10222 GET_CURRENT_CONTEXT(ctx);
10223 if (target == GL_PROXY_TEXTURE_2D) {
10224 /* don't compile, execute immediately */
10225 CALL_MultiTexImage2DEXT(ctx->Exec, (texunit, target, level, components, width,
10226 height, border, format, type, pixels));
10227 }
10228 else {
10229 Node *n;
10230 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10231 n = alloc_instruction(ctx, OPCODE_MULTITEX_IMAGE2D, 9 + POINTER_DWORDS);
10232 if (n) {
10233 n[1].e = texunit;
10234 n[2].e = target;
10235 n[3].i = level;
10236 n[4].i = components;
10237 n[5].i = (GLint) width;
10238 n[6].i = (GLint) height;
10239 n[7].i = border;
10240 n[8].e = format;
10241 n[9].e = type;
10242 save_pointer(&n[10],
10243 unpack_image(ctx, 2, width, height, 1, format, type,
10244 pixels, &ctx->Unpack));
10245 }
10246 if (ctx->ExecuteFlag) {
10247 CALL_MultiTexImage2DEXT(ctx->Exec, (texunit, target, level, components, width,
10248 height, border, format, type, pixels));
10249 }
10250 }
10251 }
10252
10253
10254 static void GLAPIENTRY
save_MultiTexImage3DEXT(GLenum texunit,GLenum target,GLint level,GLint internalFormat,GLsizei width,GLsizei height,GLsizei depth,GLint border,GLenum format,GLenum type,const GLvoid * pixels)10255 save_MultiTexImage3DEXT(GLenum texunit, GLenum target,
10256 GLint level, GLint internalFormat,
10257 GLsizei width, GLsizei height, GLsizei depth,
10258 GLint border,
10259 GLenum format, GLenum type, const GLvoid * pixels)
10260 {
10261 GET_CURRENT_CONTEXT(ctx);
10262 if (target == GL_PROXY_TEXTURE_3D) {
10263 /* don't compile, execute immediately */
10264 CALL_MultiTexImage3DEXT(ctx->Exec, (texunit, target, level, internalFormat, width,
10265 height, depth, border, format, type,
10266 pixels));
10267 }
10268 else {
10269 Node *n;
10270 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10271 n = alloc_instruction(ctx, OPCODE_MULTITEX_IMAGE3D, 10 + POINTER_DWORDS);
10272 if (n) {
10273 n[1].e = texunit;
10274 n[2].e = target;
10275 n[3].i = level;
10276 n[4].i = (GLint) internalFormat;
10277 n[5].i = (GLint) width;
10278 n[6].i = (GLint) height;
10279 n[7].i = (GLint) depth;
10280 n[8].i = border;
10281 n[9].e = format;
10282 n[10].e = type;
10283 save_pointer(&n[11],
10284 unpack_image(ctx, 3, width, height, depth, format, type,
10285 pixels, &ctx->Unpack));
10286 }
10287 if (ctx->ExecuteFlag) {
10288 CALL_MultiTexImage3DEXT(ctx->Exec, (texunit, target, level, internalFormat,
10289 width, height, depth, border, format,
10290 type, pixels));
10291 }
10292 }
10293 }
10294
10295
10296 static void GLAPIENTRY
save_MultiTexSubImage1DEXT(GLenum texunit,GLenum target,GLint level,GLint xoffset,GLsizei width,GLenum format,GLenum type,const GLvoid * pixels)10297 save_MultiTexSubImage1DEXT(GLenum texunit, GLenum target, GLint level, GLint xoffset,
10298 GLsizei width, GLenum format, GLenum type,
10299 const GLvoid * pixels)
10300 {
10301 GET_CURRENT_CONTEXT(ctx);
10302 Node *n;
10303
10304 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10305
10306 n = alloc_instruction(ctx, OPCODE_MULTITEX_SUB_IMAGE1D, 7 + POINTER_DWORDS);
10307 if (n) {
10308 n[1].e = texunit;
10309 n[2].e = target;
10310 n[3].i = level;
10311 n[4].i = xoffset;
10312 n[5].i = (GLint) width;
10313 n[6].e = format;
10314 n[7].e = type;
10315 save_pointer(&n[8],
10316 unpack_image(ctx, 1, width, 1, 1, format, type,
10317 pixels, &ctx->Unpack));
10318 }
10319 if (ctx->ExecuteFlag) {
10320 CALL_MultiTexSubImage1DEXT(ctx->Exec, (texunit, target, level, xoffset, width,
10321 format, type, pixels));
10322 }
10323 }
10324
10325
10326 static void GLAPIENTRY
save_MultiTexSubImage2DEXT(GLenum texunit,GLenum target,GLint level,GLint xoffset,GLint yoffset,GLsizei width,GLsizei height,GLenum format,GLenum type,const GLvoid * pixels)10327 save_MultiTexSubImage2DEXT(GLenum texunit, GLenum target, GLint level,
10328 GLint xoffset, GLint yoffset,
10329 GLsizei width, GLsizei height,
10330 GLenum format, GLenum type, const GLvoid * pixels)
10331 {
10332 GET_CURRENT_CONTEXT(ctx);
10333 Node *n;
10334
10335 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10336
10337 n = alloc_instruction(ctx, OPCODE_MULTITEX_SUB_IMAGE2D, 9 + POINTER_DWORDS);
10338 if (n) {
10339 n[1].e = texunit;
10340 n[2].e = target;
10341 n[3].i = level;
10342 n[4].i = xoffset;
10343 n[5].i = yoffset;
10344 n[6].i = (GLint) width;
10345 n[7].i = (GLint) height;
10346 n[8].e = format;
10347 n[9].e = type;
10348 save_pointer(&n[10],
10349 unpack_image(ctx, 2, width, height, 1, format, type,
10350 pixels, &ctx->Unpack));
10351 }
10352 if (ctx->ExecuteFlag) {
10353 CALL_MultiTexSubImage2DEXT(ctx->Exec, (texunit, target, level, xoffset, yoffset,
10354 width, height, format, type, pixels));
10355 }
10356 }
10357
10358
10359 static void GLAPIENTRY
save_MultiTexSubImage3DEXT(GLenum texunit,GLenum target,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLsizei width,GLsizei height,GLsizei depth,GLenum format,GLenum type,const GLvoid * pixels)10360 save_MultiTexSubImage3DEXT(GLenum texunit, GLenum target, GLint level,
10361 GLint xoffset, GLint yoffset, GLint zoffset,
10362 GLsizei width, GLsizei height, GLsizei depth,
10363 GLenum format, GLenum type, const GLvoid * pixels)
10364 {
10365 GET_CURRENT_CONTEXT(ctx);
10366 Node *n;
10367
10368 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10369
10370 n = alloc_instruction(ctx, OPCODE_MULTITEX_SUB_IMAGE3D, 11 + POINTER_DWORDS);
10371 if (n) {
10372 n[1].e = texunit;
10373 n[2].e = target;
10374 n[3].i = level;
10375 n[4].i = xoffset;
10376 n[5].i = yoffset;
10377 n[6].i = zoffset;
10378 n[7].i = (GLint) width;
10379 n[8].i = (GLint) height;
10380 n[9].i = (GLint) depth;
10381 n[10].e = format;
10382 n[11].e = type;
10383 save_pointer(&n[12],
10384 unpack_image(ctx, 3, width, height, depth, format, type,
10385 pixels, &ctx->Unpack));
10386 }
10387 if (ctx->ExecuteFlag) {
10388 CALL_MultiTexSubImage3DEXT(ctx->Exec, (texunit, target, level,
10389 xoffset, yoffset, zoffset,
10390 width, height, depth, format, type,
10391 pixels));
10392 }
10393 }
10394
10395
10396 static void GLAPIENTRY
save_CopyMultiTexImage1DEXT(GLenum texunit,GLenum target,GLint level,GLenum internalformat,GLint x,GLint y,GLsizei width,GLint border)10397 save_CopyMultiTexImage1DEXT(GLenum texunit, GLenum target, GLint level,
10398 GLenum internalformat, GLint x, GLint y,
10399 GLsizei width, GLint border)
10400 {
10401 GET_CURRENT_CONTEXT(ctx);
10402 Node *n;
10403 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10404 n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_IMAGE1D, 8);
10405 if (n) {
10406 n[1].e = texunit;
10407 n[2].e = target;
10408 n[3].i = level;
10409 n[4].e = internalformat;
10410 n[5].i = x;
10411 n[6].i = y;
10412 n[7].i = width;
10413 n[8].i = border;
10414 }
10415 if (ctx->ExecuteFlag) {
10416 CALL_CopyMultiTexImage1DEXT(ctx->Exec, (texunit, target, level,
10417 internalformat, x, y,
10418 width, border));
10419 }
10420 }
10421
10422
10423 static void GLAPIENTRY
save_CopyMultiTexImage2DEXT(GLenum texunit,GLenum target,GLint level,GLenum internalformat,GLint x,GLint y,GLsizei width,GLsizei height,GLint border)10424 save_CopyMultiTexImage2DEXT(GLenum texunit, GLenum target, GLint level,
10425 GLenum internalformat,
10426 GLint x, GLint y, GLsizei width,
10427 GLsizei height, GLint border)
10428 {
10429 GET_CURRENT_CONTEXT(ctx);
10430 Node *n;
10431 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10432 n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_IMAGE2D, 9);
10433 if (n) {
10434 n[1].e = texunit;
10435 n[2].e = target;
10436 n[3].i = level;
10437 n[4].e = internalformat;
10438 n[5].i = x;
10439 n[6].i = y;
10440 n[7].i = width;
10441 n[8].i = height;
10442 n[9].i = border;
10443 }
10444 if (ctx->ExecuteFlag) {
10445 CALL_CopyMultiTexImage2DEXT(ctx->Exec, (texunit, target, level,
10446 internalformat, x, y,
10447 width, height, border));
10448 }
10449 }
10450
10451
10452 static void GLAPIENTRY
save_CopyMultiTexSubImage1DEXT(GLenum texunit,GLenum target,GLint level,GLint xoffset,GLint x,GLint y,GLsizei width)10453 save_CopyMultiTexSubImage1DEXT(GLenum texunit, GLenum target, GLint level,
10454 GLint xoffset, GLint x, GLint y, GLsizei width)
10455 {
10456 GET_CURRENT_CONTEXT(ctx);
10457 Node *n;
10458 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10459 n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_SUB_IMAGE1D, 7);
10460 if (n) {
10461 n[1].e = texunit;
10462 n[2].e = target;
10463 n[3].i = level;
10464 n[4].i = xoffset;
10465 n[5].i = x;
10466 n[6].i = y;
10467 n[7].i = width;
10468 }
10469 if (ctx->ExecuteFlag) {
10470 CALL_CopyMultiTexSubImage1DEXT(ctx->Exec,
10471 (texunit, target, level, xoffset, x, y, width));
10472 }
10473 }
10474
10475
10476 static void GLAPIENTRY
save_CopyMultiTexSubImage2DEXT(GLenum texunit,GLenum target,GLint level,GLint xoffset,GLint yoffset,GLint x,GLint y,GLsizei width,GLint height)10477 save_CopyMultiTexSubImage2DEXT(GLenum texunit, GLenum target, GLint level,
10478 GLint xoffset, GLint yoffset,
10479 GLint x, GLint y, GLsizei width, GLint height)
10480 {
10481 GET_CURRENT_CONTEXT(ctx);
10482 Node *n;
10483 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10484 n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_SUB_IMAGE2D, 9);
10485 if (n) {
10486 n[1].e = texunit;
10487 n[2].e = target;
10488 n[3].i = level;
10489 n[4].i = xoffset;
10490 n[5].i = yoffset;
10491 n[6].i = x;
10492 n[7].i = y;
10493 n[8].i = width;
10494 n[9].i = height;
10495 }
10496 if (ctx->ExecuteFlag) {
10497 CALL_CopyMultiTexSubImage2DEXT(ctx->Exec, (texunit, target, level,
10498 xoffset, yoffset,
10499 x, y, width, height));
10500 }
10501 }
10502
10503
10504 static void GLAPIENTRY
save_CopyMultiTexSubImage3DEXT(GLenum texunit,GLenum target,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLint x,GLint y,GLsizei width,GLint height)10505 save_CopyMultiTexSubImage3DEXT(GLenum texunit, GLenum target, GLint level,
10506 GLint xoffset, GLint yoffset, GLint zoffset,
10507 GLint x, GLint y, GLsizei width, GLint height)
10508 {
10509 GET_CURRENT_CONTEXT(ctx);
10510 Node *n;
10511 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10512 n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_SUB_IMAGE3D, 10);
10513 if (n) {
10514 n[1].e = texunit;
10515 n[2].e = target;
10516 n[3].i = level;
10517 n[4].i = xoffset;
10518 n[5].i = yoffset;
10519 n[6].i = zoffset;
10520 n[7].i = x;
10521 n[8].i = y;
10522 n[9].i = width;
10523 n[10].i = height;
10524 }
10525 if (ctx->ExecuteFlag) {
10526 CALL_CopyMultiTexSubImage3DEXT(ctx->Exec, (texunit, target, level,
10527 xoffset, yoffset, zoffset,
10528 x, y, width, height));
10529 }
10530 }
10531
10532
10533 static void GLAPIENTRY
save_MultiTexEnvfvEXT(GLenum texunit,GLenum target,GLenum pname,const GLfloat * params)10534 save_MultiTexEnvfvEXT(GLenum texunit, GLenum target, GLenum pname, const GLfloat *params)
10535 {
10536 GET_CURRENT_CONTEXT(ctx);
10537 Node *n;
10538 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10539 n = alloc_instruction(ctx, OPCODE_MULTITEXENV, 7);
10540 if (n) {
10541 n[1].e = texunit;
10542 n[2].e = target;
10543 n[3].e = pname;
10544 if (pname == GL_TEXTURE_ENV_COLOR) {
10545 n[4].f = params[0];
10546 n[5].f = params[1];
10547 n[6].f = params[2];
10548 n[7].f = params[3];
10549 }
10550 else {
10551 n[4].f = params[0];
10552 n[5].f = n[6].f = n[7].f = 0.0F;
10553 }
10554 }
10555 if (ctx->ExecuteFlag) {
10556 CALL_MultiTexEnvfvEXT(ctx->Exec, (texunit, target, pname, params));
10557 }
10558 }
10559
10560
10561 static void GLAPIENTRY
save_MultiTexEnvfEXT(GLenum texunit,GLenum target,GLenum pname,GLfloat param)10562 save_MultiTexEnvfEXT(GLenum texunit, GLenum target, GLenum pname, GLfloat param)
10563 {
10564 GLfloat parray[4];
10565 parray[0] = (GLfloat) param;
10566 parray[1] = parray[2] = parray[3] = 0.0F;
10567 save_MultiTexEnvfvEXT(texunit, target, pname, parray);
10568 }
10569
10570
10571 static void GLAPIENTRY
save_MultiTexEnviEXT(GLenum texunit,GLenum target,GLenum pname,GLint param)10572 save_MultiTexEnviEXT(GLenum texunit, GLenum target, GLenum pname, GLint param)
10573 {
10574 GLfloat p[4];
10575 p[0] = (GLfloat) param;
10576 p[1] = p[2] = p[3] = 0.0F;
10577 save_MultiTexEnvfvEXT(texunit, target, pname, p);
10578 }
10579
10580
10581 static void GLAPIENTRY
save_MultiTexEnvivEXT(GLenum texunit,GLenum target,GLenum pname,const GLint * param)10582 save_MultiTexEnvivEXT(GLenum texunit, GLenum target, GLenum pname, const GLint * param)
10583 {
10584 GLfloat p[4];
10585 if (pname == GL_TEXTURE_ENV_COLOR) {
10586 p[0] = INT_TO_FLOAT(param[0]);
10587 p[1] = INT_TO_FLOAT(param[1]);
10588 p[2] = INT_TO_FLOAT(param[2]);
10589 p[3] = INT_TO_FLOAT(param[3]);
10590 }
10591 else {
10592 p[0] = (GLfloat) param[0];
10593 p[1] = p[2] = p[3] = 0.0F;
10594 }
10595 save_MultiTexEnvfvEXT(texunit, target, pname, p);
10596 }
10597
10598
10599 static void GLAPIENTRY
save_CompressedTextureImage1DEXT(GLuint texture,GLenum target,GLint level,GLenum internalFormat,GLsizei width,GLint border,GLsizei imageSize,const GLvoid * data)10600 save_CompressedTextureImage1DEXT(GLuint texture, GLenum target, GLint level,
10601 GLenum internalFormat, GLsizei width,
10602 GLint border, GLsizei imageSize,
10603 const GLvoid * data)
10604 {
10605 GET_CURRENT_CONTEXT(ctx);
10606 if (target == GL_PROXY_TEXTURE_1D) {
10607 /* don't compile, execute immediately */
10608 CALL_CompressedTextureImage1DEXT(ctx->Exec, (texture, target, level,
10609 internalFormat, width,
10610 border, imageSize,
10611 data));
10612 }
10613 else {
10614 Node *n;
10615 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10616
10617 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_IMAGE_1D,
10618 7 + POINTER_DWORDS);
10619 if (n) {
10620 n[1].ui = texture;
10621 n[2].e = target;
10622 n[3].i = level;
10623 n[4].e = internalFormat;
10624 n[5].i = (GLint) width;
10625 n[6].i = border;
10626 n[7].i = imageSize;
10627 save_pointer(&n[8],
10628 copy_data(data, imageSize, "glCompressedTextureImage1DEXT"));
10629 }
10630 if (ctx->ExecuteFlag) {
10631 CALL_CompressedTextureImage1DEXT(ctx->Exec,
10632 (texture, target, level, internalFormat,
10633 width, border, imageSize, data));
10634 }
10635 }
10636 }
10637
10638
10639 static void GLAPIENTRY
save_CompressedTextureImage2DEXT(GLuint texture,GLenum target,GLint level,GLenum internalFormat,GLsizei width,GLsizei height,GLint border,GLsizei imageSize,const GLvoid * data)10640 save_CompressedTextureImage2DEXT(GLuint texture, GLenum target, GLint level,
10641 GLenum internalFormat, GLsizei width,
10642 GLsizei height, GLint border, GLsizei imageSize,
10643 const GLvoid * data)
10644 {
10645 GET_CURRENT_CONTEXT(ctx);
10646 if (target == GL_PROXY_TEXTURE_2D) {
10647 /* don't compile, execute immediately */
10648 CALL_CompressedTextureImage2DEXT(ctx->Exec, (texture, target, level,
10649 internalFormat, width, height,
10650 border, imageSize, data));
10651 }
10652 else {
10653 Node *n;
10654 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10655
10656 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_IMAGE_2D,
10657 8 + POINTER_DWORDS);
10658 if (n) {
10659 n[1].ui = texture;
10660 n[2].e = target;
10661 n[3].i = level;
10662 n[4].e = internalFormat;
10663 n[5].i = (GLint) width;
10664 n[6].i = (GLint) height;
10665 n[7].i = border;
10666 n[8].i = imageSize;
10667 save_pointer(&n[9],
10668 copy_data(data, imageSize, "glCompressedTextureImage2DEXT"));
10669 }
10670 if (ctx->ExecuteFlag) {
10671 CALL_CompressedTextureImage2DEXT(ctx->Exec,
10672 (texture, target, level, internalFormat,
10673 width, height, border, imageSize, data));
10674 }
10675 }
10676 }
10677
10678
10679 static void GLAPIENTRY
save_CompressedTextureImage3DEXT(GLuint texture,GLenum target,GLint level,GLenum internalFormat,GLsizei width,GLsizei height,GLsizei depth,GLint border,GLsizei imageSize,const GLvoid * data)10680 save_CompressedTextureImage3DEXT(GLuint texture, GLenum target, GLint level,
10681 GLenum internalFormat, GLsizei width,
10682 GLsizei height, GLsizei depth, GLint border,
10683 GLsizei imageSize, const GLvoid * data)
10684 {
10685 GET_CURRENT_CONTEXT(ctx);
10686 if (target == GL_PROXY_TEXTURE_3D) {
10687 /* don't compile, execute immediately */
10688 CALL_CompressedTextureImage3DEXT(ctx->Exec, (texture, target, level,
10689 internalFormat, width,
10690 height, depth, border,
10691 imageSize, data));
10692 }
10693 else {
10694 Node *n;
10695 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10696
10697 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_IMAGE_3D,
10698 9 + POINTER_DWORDS);
10699 if (n) {
10700 n[1].ui = texture;
10701 n[2].e = target;
10702 n[3].i = level;
10703 n[4].e = internalFormat;
10704 n[5].i = (GLint) width;
10705 n[6].i = (GLint) height;
10706 n[7].i = (GLint) depth;
10707 n[8].i = border;
10708 n[9].i = imageSize;
10709 save_pointer(&n[10],
10710 copy_data(data, imageSize, "glCompressedTextureImage3DEXT"));
10711 }
10712 if (ctx->ExecuteFlag) {
10713 CALL_CompressedTextureImage3DEXT(ctx->Exec,
10714 (texture, target, level, internalFormat,
10715 width, height, depth, border, imageSize,
10716 data));
10717 }
10718 }
10719 }
10720
10721
10722 static void GLAPIENTRY
save_CompressedTextureSubImage1DEXT(GLuint texture,GLenum target,GLint level,GLint xoffset,GLsizei width,GLenum format,GLsizei imageSize,const GLvoid * data)10723 save_CompressedTextureSubImage1DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset,
10724 GLsizei width, GLenum format,
10725 GLsizei imageSize, const GLvoid * data)
10726 {
10727 Node *n;
10728 GET_CURRENT_CONTEXT(ctx);
10729 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10730
10731 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_1D,
10732 7 + POINTER_DWORDS);
10733 if (n) {
10734 n[1].ui = texture;
10735 n[2].e = target;
10736 n[3].i = level;
10737 n[4].i = xoffset;
10738 n[5].i = (GLint) width;
10739 n[6].e = format;
10740 n[7].i = imageSize;
10741 save_pointer(&n[8],
10742 copy_data(data, imageSize, "glCompressedTextureSubImage1DEXT"));
10743 }
10744 if (ctx->ExecuteFlag) {
10745 CALL_CompressedTextureSubImage1DEXT(ctx->Exec, (texture, target, level, xoffset,
10746 width, format, imageSize, data));
10747 }
10748 }
10749
10750
10751 static void GLAPIENTRY
save_CompressedTextureSubImage2DEXT(GLuint texture,GLenum target,GLint level,GLint xoffset,GLint yoffset,GLsizei width,GLsizei height,GLenum format,GLsizei imageSize,const GLvoid * data)10752 save_CompressedTextureSubImage2DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset,
10753 GLint yoffset, GLsizei width, GLsizei height,
10754 GLenum format, GLsizei imageSize,
10755 const GLvoid * data)
10756 {
10757 Node *n;
10758 GET_CURRENT_CONTEXT(ctx);
10759 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10760
10761 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_2D,
10762 9 + POINTER_DWORDS);
10763 if (n) {
10764 n[1].ui = texture;
10765 n[2].e = target;
10766 n[3].i = level;
10767 n[4].i = xoffset;
10768 n[5].i = yoffset;
10769 n[6].i = (GLint) width;
10770 n[7].i = (GLint) height;
10771 n[8].e = format;
10772 n[9].i = imageSize;
10773 save_pointer(&n[10],
10774 copy_data(data, imageSize, "glCompressedTextureSubImage2DEXT"));
10775 }
10776 if (ctx->ExecuteFlag) {
10777 CALL_CompressedTextureSubImage2DEXT(ctx->Exec,
10778 (texture, target, level, xoffset, yoffset,
10779 width, height, format, imageSize, data));
10780 }
10781 }
10782
10783
10784 static void GLAPIENTRY
save_CompressedTextureSubImage3DEXT(GLuint texture,GLenum target,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLsizei width,GLsizei height,GLsizei depth,GLenum format,GLsizei imageSize,const GLvoid * data)10785 save_CompressedTextureSubImage3DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset,
10786 GLint yoffset, GLint zoffset, GLsizei width,
10787 GLsizei height, GLsizei depth, GLenum format,
10788 GLsizei imageSize, const GLvoid * data)
10789 {
10790 Node *n;
10791 GET_CURRENT_CONTEXT(ctx);
10792 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10793
10794 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_3D,
10795 11 + POINTER_DWORDS);
10796 if (n) {
10797 n[1].ui = texture;
10798 n[2].e = target;
10799 n[3].i = level;
10800 n[4].i = xoffset;
10801 n[5].i = yoffset;
10802 n[6].i = zoffset;
10803 n[7].i = (GLint) width;
10804 n[8].i = (GLint) height;
10805 n[9].i = (GLint) depth;
10806 n[10].e = format;
10807 n[11].i = imageSize;
10808 save_pointer(&n[12],
10809 copy_data(data, imageSize, "glCompressedTextureSubImage3DEXT"));
10810 }
10811 if (ctx->ExecuteFlag) {
10812 CALL_CompressedTextureSubImage3DEXT(ctx->Exec,
10813 (texture, target, level, xoffset, yoffset,
10814 zoffset, width, height, depth, format,
10815 imageSize, data));
10816 }
10817 }
10818
10819
10820 static void GLAPIENTRY
save_CompressedMultiTexImage1DEXT(GLenum texunit,GLenum target,GLint level,GLenum internalFormat,GLsizei width,GLint border,GLsizei imageSize,const GLvoid * data)10821 save_CompressedMultiTexImage1DEXT(GLenum texunit, GLenum target, GLint level,
10822 GLenum internalFormat, GLsizei width,
10823 GLint border, GLsizei imageSize,
10824 const GLvoid * data)
10825 {
10826 GET_CURRENT_CONTEXT(ctx);
10827 if (target == GL_PROXY_TEXTURE_1D) {
10828 /* don't compile, execute immediately */
10829 CALL_CompressedMultiTexImage1DEXT(ctx->Exec, (texunit, target, level,
10830 internalFormat, width,
10831 border, imageSize,
10832 data));
10833 }
10834 else {
10835 Node *n;
10836 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10837
10838 n = alloc_instruction(ctx, OPCODE_COMPRESSED_MULTITEX_IMAGE_1D,
10839 7 + POINTER_DWORDS);
10840 if (n) {
10841 n[1].e = texunit;
10842 n[2].e = target;
10843 n[3].i = level;
10844 n[4].e = internalFormat;
10845 n[5].i = (GLint) width;
10846 n[6].i = border;
10847 n[7].i = imageSize;
10848 save_pointer(&n[8],
10849 copy_data(data, imageSize, "glCompressedMultiTexImage1DEXT"));
10850 }
10851 if (ctx->ExecuteFlag) {
10852 CALL_CompressedMultiTexImage1DEXT(ctx->Exec,
10853 (texunit, target, level, internalFormat,
10854 width, border, imageSize, data));
10855 }
10856 }
10857 }
10858
10859
10860 static void GLAPIENTRY
save_CompressedMultiTexImage2DEXT(GLenum texunit,GLenum target,GLint level,GLenum internalFormat,GLsizei width,GLsizei height,GLint border,GLsizei imageSize,const GLvoid * data)10861 save_CompressedMultiTexImage2DEXT(GLenum texunit, GLenum target, GLint level,
10862 GLenum internalFormat, GLsizei width,
10863 GLsizei height, GLint border, GLsizei imageSize,
10864 const GLvoid * data)
10865 {
10866 GET_CURRENT_CONTEXT(ctx);
10867 if (target == GL_PROXY_TEXTURE_2D) {
10868 /* don't compile, execute immediately */
10869 CALL_CompressedMultiTexImage2DEXT(ctx->Exec, (texunit, target, level,
10870 internalFormat, width, height,
10871 border, imageSize, data));
10872 }
10873 else {
10874 Node *n;
10875 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10876
10877 n = alloc_instruction(ctx, OPCODE_COMPRESSED_MULTITEX_IMAGE_2D,
10878 8 + POINTER_DWORDS);
10879 if (n) {
10880 n[1].e = texunit;
10881 n[2].e = target;
10882 n[3].i = level;
10883 n[4].e = internalFormat;
10884 n[5].i = (GLint) width;
10885 n[6].i = (GLint) height;
10886 n[7].i = border;
10887 n[8].i = imageSize;
10888 save_pointer(&n[9],
10889 copy_data(data, imageSize, "glCompressedMultiTexImage2DEXT"));
10890 }
10891 if (ctx->ExecuteFlag) {
10892 CALL_CompressedMultiTexImage2DEXT(ctx->Exec,
10893 (texunit, target, level, internalFormat,
10894 width, height, border, imageSize, data));
10895 }
10896 }
10897 }
10898
10899
10900 static void GLAPIENTRY
save_CompressedMultiTexImage3DEXT(GLenum texunit,GLenum target,GLint level,GLenum internalFormat,GLsizei width,GLsizei height,GLsizei depth,GLint border,GLsizei imageSize,const GLvoid * data)10901 save_CompressedMultiTexImage3DEXT(GLenum texunit, GLenum target, GLint level,
10902 GLenum internalFormat, GLsizei width,
10903 GLsizei height, GLsizei depth, GLint border,
10904 GLsizei imageSize, const GLvoid * data)
10905 {
10906 GET_CURRENT_CONTEXT(ctx);
10907 if (target == GL_PROXY_TEXTURE_3D) {
10908 /* don't compile, execute immediately */
10909 CALL_CompressedMultiTexImage3DEXT(ctx->Exec, (texunit, target, level,
10910 internalFormat, width,
10911 height, depth, border,
10912 imageSize, data));
10913 }
10914 else {
10915 Node *n;
10916 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10917
10918 n = alloc_instruction(ctx, OPCODE_COMPRESSED_MULTITEX_IMAGE_3D,
10919 9 + POINTER_DWORDS);
10920 if (n) {
10921 n[1].e = texunit;
10922 n[2].e = target;
10923 n[3].i = level;
10924 n[4].e = internalFormat;
10925 n[5].i = (GLint) width;
10926 n[6].i = (GLint) height;
10927 n[7].i = (GLint) depth;
10928 n[8].i = border;
10929 n[9].i = imageSize;
10930 save_pointer(&n[10],
10931 copy_data(data, imageSize, "glCompressedMultiTexImage3DEXT"));
10932 }
10933 if (ctx->ExecuteFlag) {
10934 CALL_CompressedMultiTexImage3DEXT(ctx->Exec,
10935 (texunit, target, level, internalFormat,
10936 width, height, depth, border, imageSize,
10937 data));
10938 }
10939 }
10940 }
10941
10942
10943 static void GLAPIENTRY
save_CompressedMultiTexSubImage1DEXT(GLenum texunit,GLenum target,GLint level,GLint xoffset,GLsizei width,GLenum format,GLsizei imageSize,const GLvoid * data)10944 save_CompressedMultiTexSubImage1DEXT(GLenum texunit, GLenum target, GLint level, GLint xoffset,
10945 GLsizei width, GLenum format,
10946 GLsizei imageSize, const GLvoid * data)
10947 {
10948 Node *n;
10949 GET_CURRENT_CONTEXT(ctx);
10950 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10951
10952 n = alloc_instruction(ctx, OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_1D,
10953 7 + POINTER_DWORDS);
10954 if (n) {
10955 n[1].e = texunit;
10956 n[2].e = target;
10957 n[3].i = level;
10958 n[4].i = xoffset;
10959 n[5].i = (GLint) width;
10960 n[6].e = format;
10961 n[7].i = imageSize;
10962 save_pointer(&n[8],
10963 copy_data(data, imageSize, "glCompressedMultiTexSubImage1DEXT"));
10964 }
10965 if (ctx->ExecuteFlag) {
10966 CALL_CompressedMultiTexSubImage1DEXT(ctx->Exec, (texunit, target, level, xoffset,
10967 width, format, imageSize, data));
10968 }
10969 }
10970
10971
10972 static void GLAPIENTRY
save_CompressedMultiTexSubImage2DEXT(GLenum texunit,GLenum target,GLint level,GLint xoffset,GLint yoffset,GLsizei width,GLsizei height,GLenum format,GLsizei imageSize,const GLvoid * data)10973 save_CompressedMultiTexSubImage2DEXT(GLenum texunit, GLenum target, GLint level, GLint xoffset,
10974 GLint yoffset, GLsizei width, GLsizei height,
10975 GLenum format, GLsizei imageSize,
10976 const GLvoid * data)
10977 {
10978 Node *n;
10979 GET_CURRENT_CONTEXT(ctx);
10980 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10981
10982 n = alloc_instruction(ctx, OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_2D,
10983 9 + POINTER_DWORDS);
10984 if (n) {
10985 n[1].e = texunit;
10986 n[2].e = target;
10987 n[3].i = level;
10988 n[4].i = xoffset;
10989 n[5].i = yoffset;
10990 n[6].i = (GLint) width;
10991 n[7].i = (GLint) height;
10992 n[8].e = format;
10993 n[9].i = imageSize;
10994 save_pointer(&n[10],
10995 copy_data(data, imageSize, "glCompressedMultiTexSubImage2DEXT"));
10996 }
10997 if (ctx->ExecuteFlag) {
10998 CALL_CompressedMultiTexSubImage2DEXT(ctx->Exec,
10999 (texunit, target, level, xoffset, yoffset,
11000 width, height, format, imageSize, data));
11001 }
11002 }
11003
11004
11005 static void GLAPIENTRY
save_CompressedMultiTexSubImage3DEXT(GLenum texunit,GLenum target,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLsizei width,GLsizei height,GLsizei depth,GLenum format,GLsizei imageSize,const GLvoid * data)11006 save_CompressedMultiTexSubImage3DEXT(GLenum texunit, GLenum target, GLint level, GLint xoffset,
11007 GLint yoffset, GLint zoffset, GLsizei width,
11008 GLsizei height, GLsizei depth, GLenum format,
11009 GLsizei imageSize, const GLvoid * data)
11010 {
11011 Node *n;
11012 GET_CURRENT_CONTEXT(ctx);
11013 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
11014
11015 n = alloc_instruction(ctx, OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_3D,
11016 11 + POINTER_DWORDS);
11017 if (n) {
11018 n[1].e = texunit;
11019 n[2].e = target;
11020 n[3].i = level;
11021 n[4].i = xoffset;
11022 n[5].i = yoffset;
11023 n[6].i = zoffset;
11024 n[7].i = (GLint) width;
11025 n[8].i = (GLint) height;
11026 n[9].i = (GLint) depth;
11027 n[10].e = format;
11028 n[11].i = imageSize;
11029 save_pointer(&n[12],
11030 copy_data(data, imageSize, "glCompressedMultiTexSubImage3DEXT"));
11031 }
11032 if (ctx->ExecuteFlag) {
11033 CALL_CompressedMultiTexSubImage3DEXT(ctx->Exec,
11034 (texunit, target, level, xoffset, yoffset,
11035 zoffset, width, height, depth, format,
11036 imageSize, data));
11037 }
11038 }
11039
11040
11041 static void GLAPIENTRY
save_NamedProgramStringEXT(GLuint program,GLenum target,GLenum format,GLsizei len,const GLvoid * string)11042 save_NamedProgramStringEXT(GLuint program, GLenum target, GLenum format, GLsizei len,
11043 const GLvoid * string)
11044 {
11045 GET_CURRENT_CONTEXT(ctx);
11046 Node *n;
11047
11048 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
11049
11050 n = alloc_instruction(ctx, OPCODE_NAMED_PROGRAM_STRING, 4 + POINTER_DWORDS);
11051 if (n) {
11052 GLubyte *programCopy = malloc(len);
11053 if (!programCopy) {
11054 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glNamedProgramStringEXT");
11055 return;
11056 }
11057 memcpy(programCopy, string, len);
11058 n[1].ui = program;
11059 n[2].e = target;
11060 n[3].e = format;
11061 n[4].i = len;
11062 save_pointer(&n[5], programCopy);
11063 }
11064 if (ctx->ExecuteFlag) {
11065 CALL_NamedProgramStringEXT(ctx->Exec, (program, target, format, len, string));
11066 }
11067 }
11068
11069
11070 static void GLAPIENTRY
save_NamedProgramLocalParameter4fEXT(GLuint program,GLenum target,GLuint index,GLfloat x,GLfloat y,GLfloat z,GLfloat w)11071 save_NamedProgramLocalParameter4fEXT(GLuint program, GLenum target, GLuint index,
11072 GLfloat x, GLfloat y, GLfloat z, GLfloat w)
11073 {
11074 GET_CURRENT_CONTEXT(ctx);
11075 Node *n;
11076 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
11077 n = alloc_instruction(ctx, OPCODE_NAMED_PROGRAM_LOCAL_PARAMETER, 7);
11078 if (n) {
11079 n[1].ui = program;
11080 n[2].e = target;
11081 n[3].ui = index;
11082 n[4].f = x;
11083 n[5].f = y;
11084 n[6].f = z;
11085 n[7].f = w;
11086 }
11087 if (ctx->ExecuteFlag) {
11088 CALL_NamedProgramLocalParameter4fEXT(ctx->Exec, (program, target, index, x, y, z, w));
11089 }
11090 }
11091
11092
11093 static void GLAPIENTRY
save_NamedProgramLocalParameter4fvEXT(GLuint program,GLenum target,GLuint index,const GLfloat * params)11094 save_NamedProgramLocalParameter4fvEXT(GLuint program, GLenum target, GLuint index,
11095 const GLfloat *params)
11096 {
11097 save_NamedProgramLocalParameter4fEXT(program, target, index, params[0],
11098 params[1], params[2], params[3]);
11099 }
11100
11101
11102 static void GLAPIENTRY
save_NamedProgramLocalParameter4dEXT(GLuint program,GLenum target,GLuint index,GLdouble x,GLdouble y,GLdouble z,GLdouble w)11103 save_NamedProgramLocalParameter4dEXT(GLuint program, GLenum target, GLuint index,
11104 GLdouble x, GLdouble y,
11105 GLdouble z, GLdouble w)
11106 {
11107 save_NamedProgramLocalParameter4fEXT(program, target, index, (GLfloat) x,
11108 (GLfloat) y, (GLfloat) z, (GLfloat) w);
11109 }
11110
11111
11112 static void GLAPIENTRY
save_NamedProgramLocalParameter4dvEXT(GLuint program,GLenum target,GLuint index,const GLdouble * params)11113 save_NamedProgramLocalParameter4dvEXT(GLuint program, GLenum target, GLuint index,
11114 const GLdouble *params)
11115 {
11116 save_NamedProgramLocalParameter4fEXT(program, target, index, (GLfloat) params[0],
11117 (GLfloat) params[1], (GLfloat) params[2],
11118 (GLfloat) params[3]);
11119 }
11120
11121 static void GLAPIENTRY
save_PrimitiveBoundingBox(float minX,float minY,float minZ,float minW,float maxX,float maxY,float maxZ,float maxW)11122 save_PrimitiveBoundingBox(float minX, float minY, float minZ, float minW,
11123 float maxX, float maxY, float maxZ, float maxW)
11124 {
11125 GET_CURRENT_CONTEXT(ctx);
11126 Node *n;
11127 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
11128 n = alloc_instruction(ctx, OPCODE_PRIMITIVE_BOUNDING_BOX, 8);
11129 if (n) {
11130 n[1].f = minX;
11131 n[2].f = minY;
11132 n[3].f = minZ;
11133 n[4].f = minW;
11134 n[5].f = maxX;
11135 n[6].f = maxY;
11136 n[7].f = maxZ;
11137 n[8].f = maxW;
11138 }
11139 if (ctx->ExecuteFlag) {
11140 CALL_PrimitiveBoundingBox(ctx->Exec, (minX, minY, minZ, minW,
11141 maxX, maxY, maxZ, maxW));
11142 }
11143 }
11144
11145 /**
11146 * Save an error-generating command into display list.
11147 *
11148 * KW: Will appear in the list before the vertex buffer containing the
11149 * command that provoked the error. I don't see this as a problem.
11150 */
11151 static void
save_error(struct gl_context * ctx,GLenum error,const char * s)11152 save_error(struct gl_context *ctx, GLenum error, const char *s)
11153 {
11154 Node *n;
11155 n = alloc_instruction(ctx, OPCODE_ERROR, 1 + POINTER_DWORDS);
11156 if (n) {
11157 n[1].e = error;
11158 save_pointer(&n[2], (void *) s);
11159 /* note: the data/string here doesn't have to be freed in
11160 * _mesa_delete_list() since the string is never dynamically
11161 * allocated.
11162 */
11163 }
11164 }
11165
11166
11167 /**
11168 * Compile an error into current display list.
11169 */
11170 void
_mesa_compile_error(struct gl_context * ctx,GLenum error,const char * s)11171 _mesa_compile_error(struct gl_context *ctx, GLenum error, const char *s)
11172 {
11173 if (ctx->CompileFlag)
11174 save_error(ctx, error, s);
11175 if (ctx->ExecuteFlag)
11176 _mesa_error(ctx, error, "%s", s);
11177 }
11178
11179
11180 /**
11181 * Test if ID names a display list.
11182 */
11183 bool
_mesa_get_list(struct gl_context * ctx,GLuint list,struct gl_display_list ** dlist,bool locked)11184 _mesa_get_list(struct gl_context *ctx, GLuint list,
11185 struct gl_display_list **dlist,
11186 bool locked)
11187 {
11188 struct gl_display_list * dl =
11189 list > 0 ? _mesa_lookup_list(ctx, list, locked) : NULL;
11190
11191 if (dlist)
11192 *dlist = dl;
11193
11194 return dl != NULL;
11195 }
11196
11197
11198
11199 /**********************************************************************/
11200 /* Display list execution */
11201 /**********************************************************************/
11202
11203
11204 /*
11205 * Execute a display list. Note that the ListBase offset must have already
11206 * been added before calling this function. I.e. the list argument is
11207 * the absolute list number, not relative to ListBase.
11208 * Must be called with ctx->Shared->DisplayList locked.
11209 * \param list - display list number
11210 */
11211 static void
execute_list(struct gl_context * ctx,GLuint list)11212 execute_list(struct gl_context *ctx, GLuint list)
11213 {
11214 struct gl_display_list *dlist;
11215 Node *n;
11216
11217 if (list == 0 || !_mesa_get_list(ctx, list, &dlist, true))
11218 return;
11219
11220 n = get_list_head(ctx, dlist);
11221
11222 while (1) {
11223 const OpCode opcode = n[0].opcode;
11224
11225 switch (opcode) {
11226 case OPCODE_ERROR:
11227 _mesa_error(ctx, n[1].e, "%s", (const char *) get_pointer(&n[2]));
11228 break;
11229 case OPCODE_ACCUM:
11230 CALL_Accum(ctx->Exec, (n[1].e, n[2].f));
11231 break;
11232 case OPCODE_ALPHA_FUNC:
11233 CALL_AlphaFunc(ctx->Exec, (n[1].e, n[2].f));
11234 break;
11235 case OPCODE_BIND_TEXTURE:
11236 CALL_BindTexture(ctx->Exec, (n[1].e, n[2].ui));
11237 break;
11238 case OPCODE_BITMAP:
11239 {
11240 const struct gl_pixelstore_attrib save = ctx->Unpack;
11241 ctx->Unpack = ctx->DefaultPacking;
11242 CALL_Bitmap(ctx->Exec, ((GLsizei) n[1].i, (GLsizei) n[2].i,
11243 n[3].f, n[4].f, n[5].f, n[6].f,
11244 get_pointer(&n[7])));
11245 ctx->Unpack = save; /* restore */
11246 }
11247 break;
11248 case OPCODE_BLEND_COLOR:
11249 CALL_BlendColor(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
11250 break;
11251 case OPCODE_BLEND_EQUATION:
11252 CALL_BlendEquation(ctx->Exec, (n[1].e));
11253 break;
11254 case OPCODE_BLEND_EQUATION_SEPARATE:
11255 CALL_BlendEquationSeparate(ctx->Exec, (n[1].e, n[2].e));
11256 break;
11257 case OPCODE_BLEND_FUNC_SEPARATE:
11258 CALL_BlendFuncSeparate(ctx->Exec,
11259 (n[1].e, n[2].e, n[3].e, n[4].e));
11260 break;
11261
11262 case OPCODE_BLEND_FUNC_I:
11263 /* GL_ARB_draw_buffers_blend */
11264 CALL_BlendFunciARB(ctx->Exec, (n[1].ui, n[2].e, n[3].e));
11265 break;
11266 case OPCODE_BLEND_FUNC_SEPARATE_I:
11267 /* GL_ARB_draw_buffers_blend */
11268 CALL_BlendFuncSeparateiARB(ctx->Exec, (n[1].ui, n[2].e, n[3].e,
11269 n[4].e, n[5].e));
11270 break;
11271 case OPCODE_BLEND_EQUATION_I:
11272 /* GL_ARB_draw_buffers_blend */
11273 CALL_BlendEquationiARB(ctx->Exec, (n[1].ui, n[2].e));
11274 break;
11275 case OPCODE_BLEND_EQUATION_SEPARATE_I:
11276 /* GL_ARB_draw_buffers_blend */
11277 CALL_BlendEquationSeparateiARB(ctx->Exec,
11278 (n[1].ui, n[2].e, n[3].e));
11279 break;
11280
11281 case OPCODE_CALL_LIST:
11282 /* Generated by glCallList(), don't add ListBase */
11283 if (ctx->ListState.CallDepth < MAX_LIST_NESTING) {
11284 ctx->ListState.CallDepth++;
11285 execute_list(ctx, n[1].ui);
11286 ctx->ListState.CallDepth--;
11287 }
11288 break;
11289 case OPCODE_CALL_LISTS:
11290 if (ctx->ListState.CallDepth < MAX_LIST_NESTING) {
11291 ctx->ListState.CallDepth++;
11292 _mesa_HashUnlockMutex(ctx->Shared->DisplayList);
11293 CALL_CallLists(ctx->Exec, (n[1].i, n[2].e, get_pointer(&n[3])));
11294 _mesa_HashLockMutex(ctx->Shared->DisplayList);
11295 ctx->ListState.CallDepth--;
11296 }
11297 break;
11298 case OPCODE_CLEAR:
11299 CALL_Clear(ctx->Exec, (n[1].bf));
11300 break;
11301 case OPCODE_CLEAR_BUFFER_IV:
11302 {
11303 GLint value[4];
11304 value[0] = n[3].i;
11305 value[1] = n[4].i;
11306 value[2] = n[5].i;
11307 value[3] = n[6].i;
11308 CALL_ClearBufferiv(ctx->Exec, (n[1].e, n[2].i, value));
11309 }
11310 break;
11311 case OPCODE_CLEAR_BUFFER_UIV:
11312 {
11313 GLuint value[4];
11314 value[0] = n[3].ui;
11315 value[1] = n[4].ui;
11316 value[2] = n[5].ui;
11317 value[3] = n[6].ui;
11318 CALL_ClearBufferuiv(ctx->Exec, (n[1].e, n[2].i, value));
11319 }
11320 break;
11321 case OPCODE_CLEAR_BUFFER_FV:
11322 {
11323 GLfloat value[4];
11324 value[0] = n[3].f;
11325 value[1] = n[4].f;
11326 value[2] = n[5].f;
11327 value[3] = n[6].f;
11328 CALL_ClearBufferfv(ctx->Exec, (n[1].e, n[2].i, value));
11329 }
11330 break;
11331 case OPCODE_CLEAR_BUFFER_FI:
11332 CALL_ClearBufferfi(ctx->Exec, (n[1].e, n[2].i, n[3].f, n[4].i));
11333 break;
11334 case OPCODE_CLEAR_COLOR:
11335 CALL_ClearColor(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
11336 break;
11337 case OPCODE_CLEAR_ACCUM:
11338 CALL_ClearAccum(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
11339 break;
11340 case OPCODE_CLEAR_DEPTH:
11341 CALL_ClearDepth(ctx->Exec, ((GLclampd) n[1].f));
11342 break;
11343 case OPCODE_CLEAR_INDEX:
11344 CALL_ClearIndex(ctx->Exec, ((GLfloat) n[1].ui));
11345 break;
11346 case OPCODE_CLEAR_STENCIL:
11347 CALL_ClearStencil(ctx->Exec, (n[1].i));
11348 break;
11349 case OPCODE_CLIP_PLANE:
11350 {
11351 GLdouble eq[4];
11352 eq[0] = n[2].f;
11353 eq[1] = n[3].f;
11354 eq[2] = n[4].f;
11355 eq[3] = n[5].f;
11356 CALL_ClipPlane(ctx->Exec, (n[1].e, eq));
11357 }
11358 break;
11359 case OPCODE_COLOR_MASK:
11360 CALL_ColorMask(ctx->Exec, (n[1].b, n[2].b, n[3].b, n[4].b));
11361 break;
11362 case OPCODE_COLOR_MASK_INDEXED:
11363 CALL_ColorMaski(ctx->Exec, (n[1].ui, n[2].b, n[3].b,
11364 n[4].b, n[5].b));
11365 break;
11366 case OPCODE_COLOR_MATERIAL:
11367 CALL_ColorMaterial(ctx->Exec, (n[1].e, n[2].e));
11368 break;
11369 case OPCODE_COPY_PIXELS:
11370 CALL_CopyPixels(ctx->Exec, (n[1].i, n[2].i,
11371 (GLsizei) n[3].i, (GLsizei) n[4].i,
11372 n[5].e));
11373 break;
11374 case OPCODE_COPY_TEX_IMAGE1D:
11375 CALL_CopyTexImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].e, n[4].i,
11376 n[5].i, n[6].i, n[7].i));
11377 break;
11378 case OPCODE_COPY_TEX_IMAGE2D:
11379 CALL_CopyTexImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].e, n[4].i,
11380 n[5].i, n[6].i, n[7].i, n[8].i));
11381 break;
11382 case OPCODE_COPY_TEX_SUB_IMAGE1D:
11383 CALL_CopyTexSubImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
11384 n[4].i, n[5].i, n[6].i));
11385 break;
11386 case OPCODE_COPY_TEX_SUB_IMAGE2D:
11387 CALL_CopyTexSubImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
11388 n[4].i, n[5].i, n[6].i, n[7].i,
11389 n[8].i));
11390 break;
11391 case OPCODE_COPY_TEX_SUB_IMAGE3D:
11392 CALL_CopyTexSubImage3D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
11393 n[4].i, n[5].i, n[6].i, n[7].i,
11394 n[8].i, n[9].i));
11395 break;
11396 case OPCODE_CULL_FACE:
11397 CALL_CullFace(ctx->Exec, (n[1].e));
11398 break;
11399 case OPCODE_DEPTH_FUNC:
11400 CALL_DepthFunc(ctx->Exec, (n[1].e));
11401 break;
11402 case OPCODE_DEPTH_MASK:
11403 CALL_DepthMask(ctx->Exec, (n[1].b));
11404 break;
11405 case OPCODE_DEPTH_RANGE:
11406 CALL_DepthRange(ctx->Exec,
11407 ((GLclampd) n[1].f, (GLclampd) n[2].f));
11408 break;
11409 case OPCODE_DISABLE:
11410 CALL_Disable(ctx->Exec, (n[1].e));
11411 break;
11412 case OPCODE_DISABLE_INDEXED:
11413 CALL_Disablei(ctx->Exec, (n[1].ui, n[2].e));
11414 break;
11415 case OPCODE_DRAW_BUFFER:
11416 CALL_DrawBuffer(ctx->Exec, (n[1].e));
11417 break;
11418 case OPCODE_DRAW_PIXELS:
11419 {
11420 const struct gl_pixelstore_attrib save = ctx->Unpack;
11421 ctx->Unpack = ctx->DefaultPacking;
11422 CALL_DrawPixels(ctx->Exec, (n[1].i, n[2].i, n[3].e, n[4].e,
11423 get_pointer(&n[5])));
11424 ctx->Unpack = save; /* restore */
11425 }
11426 break;
11427 case OPCODE_ENABLE:
11428 CALL_Enable(ctx->Exec, (n[1].e));
11429 break;
11430 case OPCODE_ENABLE_INDEXED:
11431 CALL_Enablei(ctx->Exec, (n[1].ui, n[2].e));
11432 break;
11433 case OPCODE_EVALMESH1:
11434 CALL_EvalMesh1(ctx->Exec, (n[1].e, n[2].i, n[3].i));
11435 break;
11436 case OPCODE_EVALMESH2:
11437 CALL_EvalMesh2(ctx->Exec,
11438 (n[1].e, n[2].i, n[3].i, n[4].i, n[5].i));
11439 break;
11440 case OPCODE_FOG:
11441 {
11442 GLfloat p[4];
11443 p[0] = n[2].f;
11444 p[1] = n[3].f;
11445 p[2] = n[4].f;
11446 p[3] = n[5].f;
11447 CALL_Fogfv(ctx->Exec, (n[1].e, p));
11448 }
11449 break;
11450 case OPCODE_FRONT_FACE:
11451 CALL_FrontFace(ctx->Exec, (n[1].e));
11452 break;
11453 case OPCODE_FRUSTUM:
11454 CALL_Frustum(ctx->Exec,
11455 (n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f));
11456 break;
11457 case OPCODE_HINT:
11458 CALL_Hint(ctx->Exec, (n[1].e, n[2].e));
11459 break;
11460 case OPCODE_INDEX_MASK:
11461 CALL_IndexMask(ctx->Exec, (n[1].ui));
11462 break;
11463 case OPCODE_INIT_NAMES:
11464 CALL_InitNames(ctx->Exec, ());
11465 break;
11466 case OPCODE_LIGHT:
11467 {
11468 GLfloat p[4];
11469 p[0] = n[3].f;
11470 p[1] = n[4].f;
11471 p[2] = n[5].f;
11472 p[3] = n[6].f;
11473 CALL_Lightfv(ctx->Exec, (n[1].e, n[2].e, p));
11474 }
11475 break;
11476 case OPCODE_LIGHT_MODEL:
11477 {
11478 GLfloat p[4];
11479 p[0] = n[2].f;
11480 p[1] = n[3].f;
11481 p[2] = n[4].f;
11482 p[3] = n[5].f;
11483 CALL_LightModelfv(ctx->Exec, (n[1].e, p));
11484 }
11485 break;
11486 case OPCODE_LINE_STIPPLE:
11487 CALL_LineStipple(ctx->Exec, (n[1].i, n[2].us));
11488 break;
11489 case OPCODE_LINE_WIDTH:
11490 CALL_LineWidth(ctx->Exec, (n[1].f));
11491 break;
11492 case OPCODE_LIST_BASE:
11493 CALL_ListBase(ctx->Exec, (n[1].ui));
11494 break;
11495 case OPCODE_LOAD_IDENTITY:
11496 CALL_LoadIdentity(ctx->Exec, ());
11497 break;
11498 case OPCODE_LOAD_MATRIX:
11499 STATIC_ASSERT(sizeof(Node) == sizeof(GLfloat));
11500 CALL_LoadMatrixf(ctx->Exec, (&n[1].f));
11501 break;
11502 case OPCODE_LOAD_NAME:
11503 CALL_LoadName(ctx->Exec, (n[1].ui));
11504 break;
11505 case OPCODE_LOGIC_OP:
11506 CALL_LogicOp(ctx->Exec, (n[1].e));
11507 break;
11508 case OPCODE_MAP1:
11509 {
11510 GLenum target = n[1].e;
11511 GLint ustride = _mesa_evaluator_components(target);
11512 GLint uorder = n[5].i;
11513 GLfloat u1 = n[2].f;
11514 GLfloat u2 = n[3].f;
11515 CALL_Map1f(ctx->Exec, (target, u1, u2, ustride, uorder,
11516 (GLfloat *) get_pointer(&n[6])));
11517 }
11518 break;
11519 case OPCODE_MAP2:
11520 {
11521 GLenum target = n[1].e;
11522 GLfloat u1 = n[2].f;
11523 GLfloat u2 = n[3].f;
11524 GLfloat v1 = n[4].f;
11525 GLfloat v2 = n[5].f;
11526 GLint ustride = n[6].i;
11527 GLint vstride = n[7].i;
11528 GLint uorder = n[8].i;
11529 GLint vorder = n[9].i;
11530 CALL_Map2f(ctx->Exec, (target, u1, u2, ustride, uorder,
11531 v1, v2, vstride, vorder,
11532 (GLfloat *) get_pointer(&n[10])));
11533 }
11534 break;
11535 case OPCODE_MAPGRID1:
11536 CALL_MapGrid1f(ctx->Exec, (n[1].i, n[2].f, n[3].f));
11537 break;
11538 case OPCODE_MAPGRID2:
11539 CALL_MapGrid2f(ctx->Exec,
11540 (n[1].i, n[2].f, n[3].f, n[4].i, n[5].f, n[6].f));
11541 break;
11542 case OPCODE_MATRIX_MODE:
11543 CALL_MatrixMode(ctx->Exec, (n[1].e));
11544 break;
11545 case OPCODE_MULT_MATRIX:
11546 CALL_MultMatrixf(ctx->Exec, (&n[1].f));
11547 break;
11548 case OPCODE_ORTHO:
11549 CALL_Ortho(ctx->Exec,
11550 (n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f));
11551 break;
11552 case OPCODE_PASSTHROUGH:
11553 CALL_PassThrough(ctx->Exec, (n[1].f));
11554 break;
11555 case OPCODE_PATCH_PARAMETER_I:
11556 CALL_PatchParameteri(ctx->Exec, (n[1].e, n[2].i));
11557 break;
11558 case OPCODE_PATCH_PARAMETER_FV_INNER:
11559 {
11560 GLfloat params[2];
11561 params[0] = n[2].f;
11562 params[1] = n[3].f;
11563 CALL_PatchParameterfv(ctx->Exec, (n[1].e, params));
11564 }
11565 break;
11566 case OPCODE_PATCH_PARAMETER_FV_OUTER:
11567 {
11568 GLfloat params[4];
11569 params[0] = n[2].f;
11570 params[1] = n[3].f;
11571 params[2] = n[4].f;
11572 params[3] = n[5].f;
11573 CALL_PatchParameterfv(ctx->Exec, (n[1].e, params));
11574 }
11575 break;
11576 case OPCODE_PIXEL_MAP:
11577 CALL_PixelMapfv(ctx->Exec,
11578 (n[1].e, n[2].i, get_pointer(&n[3])));
11579 break;
11580 case OPCODE_PIXEL_TRANSFER:
11581 CALL_PixelTransferf(ctx->Exec, (n[1].e, n[2].f));
11582 break;
11583 case OPCODE_PIXEL_ZOOM:
11584 CALL_PixelZoom(ctx->Exec, (n[1].f, n[2].f));
11585 break;
11586 case OPCODE_POINT_SIZE:
11587 CALL_PointSize(ctx->Exec, (n[1].f));
11588 break;
11589 case OPCODE_POINT_PARAMETERS:
11590 {
11591 GLfloat params[3];
11592 params[0] = n[2].f;
11593 params[1] = n[3].f;
11594 params[2] = n[4].f;
11595 CALL_PointParameterfv(ctx->Exec, (n[1].e, params));
11596 }
11597 break;
11598 case OPCODE_POLYGON_MODE:
11599 CALL_PolygonMode(ctx->Exec, (n[1].e, n[2].e));
11600 break;
11601 case OPCODE_POLYGON_STIPPLE:
11602 {
11603 const struct gl_pixelstore_attrib save = ctx->Unpack;
11604 ctx->Unpack = ctx->DefaultPacking;
11605 CALL_PolygonStipple(ctx->Exec, (get_pointer(&n[1])));
11606 ctx->Unpack = save; /* restore */
11607 }
11608 break;
11609 case OPCODE_POLYGON_OFFSET:
11610 CALL_PolygonOffset(ctx->Exec, (n[1].f, n[2].f));
11611 break;
11612 case OPCODE_POLYGON_OFFSET_CLAMP:
11613 CALL_PolygonOffsetClampEXT(ctx->Exec, (n[1].f, n[2].f, n[3].f));
11614 break;
11615 case OPCODE_POP_ATTRIB:
11616 CALL_PopAttrib(ctx->Exec, ());
11617 break;
11618 case OPCODE_POP_MATRIX:
11619 CALL_PopMatrix(ctx->Exec, ());
11620 break;
11621 case OPCODE_POP_NAME:
11622 CALL_PopName(ctx->Exec, ());
11623 break;
11624 case OPCODE_PRIORITIZE_TEXTURE:
11625 CALL_PrioritizeTextures(ctx->Exec, (1, &n[1].ui, &n[2].f));
11626 break;
11627 case OPCODE_PUSH_ATTRIB:
11628 CALL_PushAttrib(ctx->Exec, (n[1].bf));
11629 break;
11630 case OPCODE_PUSH_MATRIX:
11631 CALL_PushMatrix(ctx->Exec, ());
11632 break;
11633 case OPCODE_PUSH_NAME:
11634 CALL_PushName(ctx->Exec, (n[1].ui));
11635 break;
11636 case OPCODE_RASTER_POS:
11637 CALL_RasterPos4f(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
11638 break;
11639 case OPCODE_READ_BUFFER:
11640 CALL_ReadBuffer(ctx->Exec, (n[1].e));
11641 break;
11642 case OPCODE_ROTATE:
11643 CALL_Rotatef(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
11644 break;
11645 case OPCODE_SCALE:
11646 CALL_Scalef(ctx->Exec, (n[1].f, n[2].f, n[3].f));
11647 break;
11648 case OPCODE_SCISSOR:
11649 CALL_Scissor(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
11650 break;
11651 case OPCODE_SHADE_MODEL:
11652 CALL_ShadeModel(ctx->Exec, (n[1].e));
11653 break;
11654 case OPCODE_PROVOKING_VERTEX:
11655 CALL_ProvokingVertex(ctx->Exec, (n[1].e));
11656 break;
11657 case OPCODE_STENCIL_FUNC:
11658 CALL_StencilFunc(ctx->Exec, (n[1].e, n[2].i, n[3].ui));
11659 break;
11660 case OPCODE_STENCIL_MASK:
11661 CALL_StencilMask(ctx->Exec, (n[1].ui));
11662 break;
11663 case OPCODE_STENCIL_OP:
11664 CALL_StencilOp(ctx->Exec, (n[1].e, n[2].e, n[3].e));
11665 break;
11666 case OPCODE_STENCIL_FUNC_SEPARATE:
11667 CALL_StencilFuncSeparate(ctx->Exec,
11668 (n[1].e, n[2].e, n[3].i, n[4].ui));
11669 break;
11670 case OPCODE_STENCIL_MASK_SEPARATE:
11671 CALL_StencilMaskSeparate(ctx->Exec, (n[1].e, n[2].ui));
11672 break;
11673 case OPCODE_STENCIL_OP_SEPARATE:
11674 CALL_StencilOpSeparate(ctx->Exec,
11675 (n[1].e, n[2].e, n[3].e, n[4].e));
11676 break;
11677 case OPCODE_TEXENV:
11678 {
11679 GLfloat params[4];
11680 params[0] = n[3].f;
11681 params[1] = n[4].f;
11682 params[2] = n[5].f;
11683 params[3] = n[6].f;
11684 CALL_TexEnvfv(ctx->Exec, (n[1].e, n[2].e, params));
11685 }
11686 break;
11687 case OPCODE_TEXGEN:
11688 {
11689 GLfloat params[4];
11690 params[0] = n[3].f;
11691 params[1] = n[4].f;
11692 params[2] = n[5].f;
11693 params[3] = n[6].f;
11694 CALL_TexGenfv(ctx->Exec, (n[1].e, n[2].e, params));
11695 }
11696 break;
11697 case OPCODE_TEXPARAMETER:
11698 {
11699 GLfloat params[4];
11700 params[0] = n[3].f;
11701 params[1] = n[4].f;
11702 params[2] = n[5].f;
11703 params[3] = n[6].f;
11704 CALL_TexParameterfv(ctx->Exec, (n[1].e, n[2].e, params));
11705 }
11706 break;
11707 case OPCODE_TEX_IMAGE1D:
11708 {
11709 const struct gl_pixelstore_attrib save = ctx->Unpack;
11710 ctx->Unpack = ctx->DefaultPacking;
11711 CALL_TexImage1D(ctx->Exec, (n[1].e, /* target */
11712 n[2].i, /* level */
11713 n[3].i, /* components */
11714 n[4].i, /* width */
11715 n[5].e, /* border */
11716 n[6].e, /* format */
11717 n[7].e, /* type */
11718 get_pointer(&n[8])));
11719 ctx->Unpack = save; /* restore */
11720 }
11721 break;
11722 case OPCODE_TEX_IMAGE2D:
11723 {
11724 const struct gl_pixelstore_attrib save = ctx->Unpack;
11725 ctx->Unpack = ctx->DefaultPacking;
11726 CALL_TexImage2D(ctx->Exec, (n[1].e, /* target */
11727 n[2].i, /* level */
11728 n[3].i, /* components */
11729 n[4].i, /* width */
11730 n[5].i, /* height */
11731 n[6].e, /* border */
11732 n[7].e, /* format */
11733 n[8].e, /* type */
11734 get_pointer(&n[9])));
11735 ctx->Unpack = save; /* restore */
11736 }
11737 break;
11738 case OPCODE_TEX_IMAGE3D:
11739 {
11740 const struct gl_pixelstore_attrib save = ctx->Unpack;
11741 ctx->Unpack = ctx->DefaultPacking;
11742 CALL_TexImage3D(ctx->Exec, (n[1].e, /* target */
11743 n[2].i, /* level */
11744 n[3].i, /* components */
11745 n[4].i, /* width */
11746 n[5].i, /* height */
11747 n[6].i, /* depth */
11748 n[7].e, /* border */
11749 n[8].e, /* format */
11750 n[9].e, /* type */
11751 get_pointer(&n[10])));
11752 ctx->Unpack = save; /* restore */
11753 }
11754 break;
11755 case OPCODE_TEX_SUB_IMAGE1D:
11756 {
11757 const struct gl_pixelstore_attrib save = ctx->Unpack;
11758 ctx->Unpack = ctx->DefaultPacking;
11759 CALL_TexSubImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
11760 n[4].i, n[5].e,
11761 n[6].e, get_pointer(&n[7])));
11762 ctx->Unpack = save; /* restore */
11763 }
11764 break;
11765 case OPCODE_TEX_SUB_IMAGE2D:
11766 {
11767 const struct gl_pixelstore_attrib save = ctx->Unpack;
11768 ctx->Unpack = ctx->DefaultPacking;
11769 CALL_TexSubImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
11770 n[4].i, n[5].e,
11771 n[6].i, n[7].e, n[8].e,
11772 get_pointer(&n[9])));
11773 ctx->Unpack = save; /* restore */
11774 }
11775 break;
11776 case OPCODE_TEX_SUB_IMAGE3D:
11777 {
11778 const struct gl_pixelstore_attrib save = ctx->Unpack;
11779 ctx->Unpack = ctx->DefaultPacking;
11780 CALL_TexSubImage3D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
11781 n[4].i, n[5].i, n[6].i, n[7].i,
11782 n[8].i, n[9].e, n[10].e,
11783 get_pointer(&n[11])));
11784 ctx->Unpack = save; /* restore */
11785 }
11786 break;
11787 case OPCODE_TRANSLATE:
11788 CALL_Translatef(ctx->Exec, (n[1].f, n[2].f, n[3].f));
11789 break;
11790 case OPCODE_VIEWPORT:
11791 CALL_Viewport(ctx->Exec, (n[1].i, n[2].i,
11792 (GLsizei) n[3].i, (GLsizei) n[4].i));
11793 break;
11794 case OPCODE_WINDOW_POS:
11795 CALL_WindowPos4fMESA(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
11796 break;
11797 case OPCODE_VIEWPORT_ARRAY_V:
11798 CALL_ViewportArrayv(ctx->Exec, (n[1].ui, n[2].si,
11799 get_pointer(&n[3])));
11800 break;
11801 case OPCODE_VIEWPORT_INDEXED_F:
11802 CALL_ViewportIndexedf(ctx->Exec, (n[1].ui, n[2].f, n[3].f, n[4].f,
11803 n[5].f));
11804 break;
11805 case OPCODE_VIEWPORT_INDEXED_FV: {
11806 GLfloat v[4];
11807 v[0] = n[2].f;
11808 v[1] = n[3].f;
11809 v[2] = n[4].f;
11810 v[3] = n[5].f;
11811 CALL_ViewportIndexedfv(ctx->Exec, (n[1].ui, v));
11812 break;
11813 }
11814 case OPCODE_SCISSOR_ARRAY_V:
11815 CALL_ScissorArrayv(ctx->Exec, (n[1].ui, n[2].si,
11816 get_pointer(&n[3])));
11817 break;
11818 case OPCODE_SCISSOR_INDEXED:
11819 CALL_ScissorIndexed(ctx->Exec, (n[1].ui, n[2].i, n[3].i, n[4].si,
11820 n[5].si));
11821 break;
11822 case OPCODE_SCISSOR_INDEXED_V: {
11823 GLint v[4];
11824 v[0] = n[2].i;
11825 v[1] = n[3].i;
11826 v[2] = n[4].si;
11827 v[3] = n[5].si;
11828 CALL_ScissorIndexedv(ctx->Exec, (n[1].ui, v));
11829 break;
11830 }
11831 case OPCODE_DEPTH_ARRAY_V:
11832 CALL_DepthRangeArrayv(ctx->Exec, (n[1].ui, n[2].si,
11833 get_pointer(&n[3])));
11834 break;
11835 case OPCODE_DEPTH_INDEXED:
11836 CALL_DepthRangeIndexed(ctx->Exec, (n[1].ui, n[2].f, n[3].f));
11837 break;
11838 case OPCODE_ACTIVE_TEXTURE: /* GL_ARB_multitexture */
11839 CALL_ActiveTexture(ctx->Exec, (n[1].e));
11840 break;
11841 case OPCODE_COMPRESSED_TEX_IMAGE_1D: /* GL_ARB_texture_compression */
11842 CALL_CompressedTexImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].e,
11843 n[4].i, n[5].i, n[6].i,
11844 get_pointer(&n[7])));
11845 break;
11846 case OPCODE_COMPRESSED_TEX_IMAGE_2D: /* GL_ARB_texture_compression */
11847 CALL_CompressedTexImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].e,
11848 n[4].i, n[5].i, n[6].i,
11849 n[7].i, get_pointer(&n[8])));
11850 break;
11851 case OPCODE_COMPRESSED_TEX_IMAGE_3D: /* GL_ARB_texture_compression */
11852 CALL_CompressedTexImage3D(ctx->Exec, (n[1].e, n[2].i, n[3].e,
11853 n[4].i, n[5].i, n[6].i,
11854 n[7].i, n[8].i,
11855 get_pointer(&n[9])));
11856 break;
11857 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D: /* GL_ARB_texture_compress */
11858 CALL_CompressedTexSubImage1D(ctx->Exec,
11859 (n[1].e, n[2].i, n[3].i, n[4].i,
11860 n[5].e, n[6].i,
11861 get_pointer(&n[7])));
11862 break;
11863 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D: /* GL_ARB_texture_compress */
11864 CALL_CompressedTexSubImage2D(ctx->Exec,
11865 (n[1].e, n[2].i, n[3].i, n[4].i,
11866 n[5].i, n[6].i, n[7].e, n[8].i,
11867 get_pointer(&n[9])));
11868 break;
11869 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D: /* GL_ARB_texture_compress */
11870 CALL_CompressedTexSubImage3D(ctx->Exec,
11871 (n[1].e, n[2].i, n[3].i, n[4].i,
11872 n[5].i, n[6].i, n[7].i, n[8].i,
11873 n[9].e, n[10].i,
11874 get_pointer(&n[11])));
11875 break;
11876 case OPCODE_SAMPLE_COVERAGE: /* GL_ARB_multisample */
11877 CALL_SampleCoverage(ctx->Exec, (n[1].f, n[2].b));
11878 break;
11879 case OPCODE_WINDOW_POS_ARB: /* GL_ARB_window_pos */
11880 CALL_WindowPos3f(ctx->Exec, (n[1].f, n[2].f, n[3].f));
11881 break;
11882 case OPCODE_BIND_PROGRAM_ARB: /* GL_ARB_vertex_program */
11883 CALL_BindProgramARB(ctx->Exec, (n[1].e, n[2].ui));
11884 break;
11885 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB:
11886 CALL_ProgramLocalParameter4fARB(ctx->Exec,
11887 (n[1].e, n[2].ui, n[3].f, n[4].f,
11888 n[5].f, n[6].f));
11889 break;
11890 case OPCODE_ACTIVE_STENCIL_FACE_EXT:
11891 CALL_ActiveStencilFaceEXT(ctx->Exec, (n[1].e));
11892 break;
11893 case OPCODE_DEPTH_BOUNDS_EXT:
11894 CALL_DepthBoundsEXT(ctx->Exec, (n[1].f, n[2].f));
11895 break;
11896 case OPCODE_PROGRAM_STRING_ARB:
11897 CALL_ProgramStringARB(ctx->Exec,
11898 (n[1].e, n[2].e, n[3].i,
11899 get_pointer(&n[4])));
11900 break;
11901 case OPCODE_PROGRAM_ENV_PARAMETER_ARB:
11902 CALL_ProgramEnvParameter4fARB(ctx->Exec, (n[1].e, n[2].ui, n[3].f,
11903 n[4].f, n[5].f,
11904 n[6].f));
11905 break;
11906 case OPCODE_BEGIN_QUERY_ARB:
11907 CALL_BeginQuery(ctx->Exec, (n[1].e, n[2].ui));
11908 break;
11909 case OPCODE_END_QUERY_ARB:
11910 CALL_EndQuery(ctx->Exec, (n[1].e));
11911 break;
11912 case OPCODE_QUERY_COUNTER:
11913 CALL_QueryCounter(ctx->Exec, (n[1].ui, n[2].e));
11914 break;
11915 case OPCODE_BEGIN_QUERY_INDEXED:
11916 CALL_BeginQueryIndexed(ctx->Exec, (n[1].e, n[2].ui, n[3].ui));
11917 break;
11918 case OPCODE_END_QUERY_INDEXED:
11919 CALL_EndQueryIndexed(ctx->Exec, (n[1].e, n[2].ui));
11920 break;
11921 case OPCODE_DRAW_BUFFERS_ARB:
11922 {
11923 GLenum buffers[MAX_DRAW_BUFFERS];
11924 GLint i, count = MIN2(n[1].i, MAX_DRAW_BUFFERS);
11925 for (i = 0; i < count; i++)
11926 buffers[i] = n[2 + i].e;
11927 CALL_DrawBuffers(ctx->Exec, (n[1].i, buffers));
11928 }
11929 break;
11930 case OPCODE_BLIT_FRAMEBUFFER:
11931 CALL_BlitFramebuffer(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i,
11932 n[5].i, n[6].i, n[7].i, n[8].i,
11933 n[9].i, n[10].e));
11934 break;
11935 case OPCODE_PRIMITIVE_RESTART_NV:
11936 CALL_PrimitiveRestartNV(ctx->Exec, ());
11937 break;
11938
11939 case OPCODE_USE_PROGRAM:
11940 CALL_UseProgram(ctx->Exec, (n[1].ui));
11941 break;
11942 case OPCODE_UNIFORM_1F:
11943 CALL_Uniform1f(ctx->Exec, (n[1].i, n[2].f));
11944 break;
11945 case OPCODE_UNIFORM_2F:
11946 CALL_Uniform2f(ctx->Exec, (n[1].i, n[2].f, n[3].f));
11947 break;
11948 case OPCODE_UNIFORM_3F:
11949 CALL_Uniform3f(ctx->Exec, (n[1].i, n[2].f, n[3].f, n[4].f));
11950 break;
11951 case OPCODE_UNIFORM_4F:
11952 CALL_Uniform4f(ctx->Exec,
11953 (n[1].i, n[2].f, n[3].f, n[4].f, n[5].f));
11954 break;
11955 case OPCODE_UNIFORM_1FV:
11956 CALL_Uniform1fv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11957 break;
11958 case OPCODE_UNIFORM_2FV:
11959 CALL_Uniform2fv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11960 break;
11961 case OPCODE_UNIFORM_3FV:
11962 CALL_Uniform3fv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11963 break;
11964 case OPCODE_UNIFORM_4FV:
11965 CALL_Uniform4fv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11966 break;
11967 case OPCODE_UNIFORM_1D: {
11968 union float64_pair x;
11969
11970 x.uint32[0] = n[2].ui;
11971 x.uint32[1] = n[3].ui;
11972
11973 CALL_Uniform1d(ctx->Exec, (n[1].i, x.d));
11974 break;
11975 }
11976 case OPCODE_UNIFORM_2D: {
11977 union float64_pair x;
11978 union float64_pair y;
11979
11980 x.uint32[0] = n[2].ui;
11981 x.uint32[1] = n[3].ui;
11982 y.uint32[0] = n[4].ui;
11983 y.uint32[1] = n[5].ui;
11984
11985 CALL_Uniform2d(ctx->Exec, (n[1].i, x.d, y.d));
11986 break;
11987 }
11988 case OPCODE_UNIFORM_3D: {
11989 union float64_pair x;
11990 union float64_pair y;
11991 union float64_pair z;
11992
11993 x.uint32[0] = n[2].ui;
11994 x.uint32[1] = n[3].ui;
11995 y.uint32[0] = n[4].ui;
11996 y.uint32[1] = n[5].ui;
11997 z.uint32[0] = n[6].ui;
11998 z.uint32[1] = n[7].ui;
11999
12000 CALL_Uniform3d(ctx->Exec, (n[1].i, x.d, y.d, z.d));
12001 break;
12002 }
12003 case OPCODE_UNIFORM_4D: {
12004 union float64_pair x;
12005 union float64_pair y;
12006 union float64_pair z;
12007 union float64_pair w;
12008
12009 x.uint32[0] = n[2].ui;
12010 x.uint32[1] = n[3].ui;
12011 y.uint32[0] = n[4].ui;
12012 y.uint32[1] = n[5].ui;
12013 z.uint32[0] = n[6].ui;
12014 z.uint32[1] = n[7].ui;
12015 w.uint32[0] = n[8].ui;
12016 w.uint32[1] = n[9].ui;
12017
12018 CALL_Uniform4d(ctx->Exec, (n[1].i, x.d, y.d, z.d, w.d));
12019 break;
12020 }
12021 case OPCODE_UNIFORM_1DV:
12022 CALL_Uniform1dv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12023 break;
12024 case OPCODE_UNIFORM_2DV:
12025 CALL_Uniform2dv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12026 break;
12027 case OPCODE_UNIFORM_3DV:
12028 CALL_Uniform3dv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12029 break;
12030 case OPCODE_UNIFORM_4DV:
12031 CALL_Uniform4dv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12032 break;
12033 case OPCODE_UNIFORM_1I:
12034 CALL_Uniform1i(ctx->Exec, (n[1].i, n[2].i));
12035 break;
12036 case OPCODE_UNIFORM_2I:
12037 CALL_Uniform2i(ctx->Exec, (n[1].i, n[2].i, n[3].i));
12038 break;
12039 case OPCODE_UNIFORM_3I:
12040 CALL_Uniform3i(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
12041 break;
12042 case OPCODE_UNIFORM_4I:
12043 CALL_Uniform4i(ctx->Exec,
12044 (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
12045 break;
12046 case OPCODE_UNIFORM_1IV:
12047 CALL_Uniform1iv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12048 break;
12049 case OPCODE_UNIFORM_2IV:
12050 CALL_Uniform2iv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12051 break;
12052 case OPCODE_UNIFORM_3IV:
12053 CALL_Uniform3iv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12054 break;
12055 case OPCODE_UNIFORM_4IV:
12056 CALL_Uniform4iv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12057 break;
12058 case OPCODE_UNIFORM_1UI:
12059 CALL_Uniform1ui(ctx->Exec, (n[1].i, n[2].i));
12060 break;
12061 case OPCODE_UNIFORM_2UI:
12062 CALL_Uniform2ui(ctx->Exec, (n[1].i, n[2].i, n[3].i));
12063 break;
12064 case OPCODE_UNIFORM_3UI:
12065 CALL_Uniform3ui(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
12066 break;
12067 case OPCODE_UNIFORM_4UI:
12068 CALL_Uniform4ui(ctx->Exec,
12069 (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
12070 break;
12071 case OPCODE_UNIFORM_1UIV:
12072 CALL_Uniform1uiv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12073 break;
12074 case OPCODE_UNIFORM_2UIV:
12075 CALL_Uniform2uiv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12076 break;
12077 case OPCODE_UNIFORM_3UIV:
12078 CALL_Uniform3uiv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12079 break;
12080 case OPCODE_UNIFORM_4UIV:
12081 CALL_Uniform4uiv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12082 break;
12083 case OPCODE_UNIFORM_MATRIX22:
12084 CALL_UniformMatrix2fv(ctx->Exec,
12085 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12086 break;
12087 case OPCODE_UNIFORM_MATRIX33:
12088 CALL_UniformMatrix3fv(ctx->Exec,
12089 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12090 break;
12091 case OPCODE_UNIFORM_MATRIX44:
12092 CALL_UniformMatrix4fv(ctx->Exec,
12093 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12094 break;
12095 case OPCODE_UNIFORM_MATRIX23:
12096 CALL_UniformMatrix2x3fv(ctx->Exec,
12097 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12098 break;
12099 case OPCODE_UNIFORM_MATRIX32:
12100 CALL_UniformMatrix3x2fv(ctx->Exec,
12101 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12102 break;
12103 case OPCODE_UNIFORM_MATRIX24:
12104 CALL_UniformMatrix2x4fv(ctx->Exec,
12105 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12106 break;
12107 case OPCODE_UNIFORM_MATRIX42:
12108 CALL_UniformMatrix4x2fv(ctx->Exec,
12109 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12110 break;
12111 case OPCODE_UNIFORM_MATRIX34:
12112 CALL_UniformMatrix3x4fv(ctx->Exec,
12113 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12114 break;
12115 case OPCODE_UNIFORM_MATRIX43:
12116 CALL_UniformMatrix4x3fv(ctx->Exec,
12117 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12118 break;
12119 case OPCODE_UNIFORM_MATRIX22D:
12120 CALL_UniformMatrix2dv(ctx->Exec,
12121 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12122 break;
12123 case OPCODE_UNIFORM_MATRIX33D:
12124 CALL_UniformMatrix3dv(ctx->Exec,
12125 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12126 break;
12127 case OPCODE_UNIFORM_MATRIX44D:
12128 CALL_UniformMatrix4dv(ctx->Exec,
12129 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12130 break;
12131 case OPCODE_UNIFORM_MATRIX23D:
12132 CALL_UniformMatrix2x3dv(ctx->Exec,
12133 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12134 break;
12135 case OPCODE_UNIFORM_MATRIX32D:
12136 CALL_UniformMatrix3x2dv(ctx->Exec,
12137 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12138 break;
12139 case OPCODE_UNIFORM_MATRIX24D:
12140 CALL_UniformMatrix2x4dv(ctx->Exec,
12141 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12142 break;
12143 case OPCODE_UNIFORM_MATRIX42D:
12144 CALL_UniformMatrix4x2dv(ctx->Exec,
12145 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12146 break;
12147 case OPCODE_UNIFORM_MATRIX34D:
12148 CALL_UniformMatrix3x4dv(ctx->Exec,
12149 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12150 break;
12151 case OPCODE_UNIFORM_MATRIX43D:
12152 CALL_UniformMatrix4x3dv(ctx->Exec,
12153 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12154 break;
12155
12156 case OPCODE_UNIFORM_1I64: {
12157 union int64_pair x;
12158
12159 x.int32[0] = n[2].i;
12160 x.int32[1] = n[3].i;
12161
12162 CALL_Uniform1i64ARB(ctx->Exec, (n[1].i, x.int64));
12163 break;
12164 }
12165 case OPCODE_UNIFORM_2I64: {
12166 union int64_pair x;
12167 union int64_pair y;
12168
12169 x.int32[0] = n[2].i;
12170 x.int32[1] = n[3].i;
12171 y.int32[0] = n[4].i;
12172 y.int32[1] = n[5].i;
12173
12174 CALL_Uniform2i64ARB(ctx->Exec, (n[1].i, x.int64, y.int64));
12175 break;
12176 }
12177 case OPCODE_UNIFORM_3I64: {
12178 union int64_pair x;
12179 union int64_pair y;
12180 union int64_pair z;
12181
12182 x.int32[0] = n[2].i;
12183 x.int32[1] = n[3].i;
12184 y.int32[0] = n[4].i;
12185 y.int32[1] = n[5].i;
12186 z.int32[0] = n[6].i;
12187 z.int32[1] = n[7].i;
12188
12189
12190 CALL_Uniform3i64ARB(ctx->Exec, (n[1].i, x.int64, y.int64, z.int64));
12191 break;
12192 }
12193 case OPCODE_UNIFORM_4I64: {
12194 union int64_pair x;
12195 union int64_pair y;
12196 union int64_pair z;
12197 union int64_pair w;
12198
12199 x.int32[0] = n[2].i;
12200 x.int32[1] = n[3].i;
12201 y.int32[0] = n[4].i;
12202 y.int32[1] = n[5].i;
12203 z.int32[0] = n[6].i;
12204 z.int32[1] = n[7].i;
12205 w.int32[0] = n[8].i;
12206 w.int32[1] = n[9].i;
12207
12208 CALL_Uniform4i64ARB(ctx->Exec, (n[1].i, x.int64, y.int64, z.int64, w.int64));
12209 break;
12210 }
12211 case OPCODE_UNIFORM_1I64V:
12212 CALL_Uniform1i64vARB(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12213 break;
12214 case OPCODE_UNIFORM_2I64V:
12215 CALL_Uniform2i64vARB(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12216 break;
12217 case OPCODE_UNIFORM_3I64V:
12218 CALL_Uniform3i64vARB(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12219 break;
12220 case OPCODE_UNIFORM_4I64V:
12221 CALL_Uniform4i64vARB(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12222 break;
12223 case OPCODE_UNIFORM_1UI64: {
12224 union uint64_pair x;
12225
12226 x.uint32[0] = n[2].ui;
12227 x.uint32[1] = n[3].ui;
12228
12229 CALL_Uniform1ui64ARB(ctx->Exec, (n[1].i, x.uint64));
12230 break;
12231 }
12232 case OPCODE_UNIFORM_2UI64: {
12233 union uint64_pair x;
12234 union uint64_pair y;
12235
12236 x.uint32[0] = n[2].ui;
12237 x.uint32[1] = n[3].ui;
12238 y.uint32[0] = n[4].ui;
12239 y.uint32[1] = n[5].ui;
12240
12241 CALL_Uniform2ui64ARB(ctx->Exec, (n[1].i, x.uint64, y.uint64));
12242 break;
12243 }
12244 case OPCODE_UNIFORM_3UI64: {
12245 union uint64_pair x;
12246 union uint64_pair y;
12247 union uint64_pair z;
12248
12249 x.uint32[0] = n[2].ui;
12250 x.uint32[1] = n[3].ui;
12251 y.uint32[0] = n[4].ui;
12252 y.uint32[1] = n[5].ui;
12253 z.uint32[0] = n[6].ui;
12254 z.uint32[1] = n[7].ui;
12255
12256
12257 CALL_Uniform3ui64ARB(ctx->Exec, (n[1].i, x.uint64, y.uint64,
12258 z.uint64));
12259 break;
12260 }
12261 case OPCODE_UNIFORM_4UI64: {
12262 union uint64_pair x;
12263 union uint64_pair y;
12264 union uint64_pair z;
12265 union uint64_pair w;
12266
12267 x.uint32[0] = n[2].ui;
12268 x.uint32[1] = n[3].ui;
12269 y.uint32[0] = n[4].ui;
12270 y.uint32[1] = n[5].ui;
12271 z.uint32[0] = n[6].ui;
12272 z.uint32[1] = n[7].ui;
12273 w.uint32[0] = n[8].ui;
12274 w.uint32[1] = n[9].ui;
12275
12276 CALL_Uniform4ui64ARB(ctx->Exec, (n[1].i, x.uint64, y.uint64,
12277 z.uint64, w.uint64));
12278 break;
12279 }
12280 case OPCODE_UNIFORM_1UI64V:
12281 CALL_Uniform1ui64vARB(ctx->Exec, (n[1].i, n[2].i,
12282 get_pointer(&n[3])));
12283 break;
12284 case OPCODE_UNIFORM_2UI64V:
12285 CALL_Uniform2ui64vARB(ctx->Exec, (n[1].i, n[2].i,
12286 get_pointer(&n[3])));
12287 break;
12288 case OPCODE_UNIFORM_3UI64V:
12289 CALL_Uniform3ui64vARB(ctx->Exec, (n[1].i, n[2].i,
12290 get_pointer(&n[3])));
12291 break;
12292 case OPCODE_UNIFORM_4UI64V:
12293 CALL_Uniform4ui64vARB(ctx->Exec, (n[1].i, n[2].i,
12294 get_pointer(&n[3])));
12295 break;
12296
12297 case OPCODE_PROGRAM_UNIFORM_1I64: {
12298 union int64_pair x;
12299
12300 x.int32[0] = n[3].i;
12301 x.int32[1] = n[4].i;
12302
12303 CALL_ProgramUniform1i64ARB(ctx->Exec, (n[1].ui, n[2].i, x.int64));
12304 break;
12305 }
12306 case OPCODE_PROGRAM_UNIFORM_2I64: {
12307 union int64_pair x;
12308 union int64_pair y;
12309
12310 x.int32[0] = n[3].i;
12311 x.int32[1] = n[4].i;
12312 y.int32[0] = n[5].i;
12313 y.int32[1] = n[6].i;
12314
12315 CALL_ProgramUniform2i64ARB(ctx->Exec, (n[1].ui, n[2].i, x.int64,
12316 y.int64));
12317 break;
12318 }
12319 case OPCODE_PROGRAM_UNIFORM_3I64: {
12320 union int64_pair x;
12321 union int64_pair y;
12322 union int64_pair z;
12323
12324 x.int32[0] = n[3].i;
12325 x.int32[1] = n[4].i;
12326 y.int32[0] = n[5].i;
12327 y.int32[1] = n[6].i;
12328 z.int32[0] = n[7].i;
12329 z.int32[1] = n[8].i;
12330
12331 CALL_ProgramUniform3i64ARB(ctx->Exec, (n[1].ui, n[2].i, x.int64,
12332 y.int64, z.int64));
12333 break;
12334 }
12335 case OPCODE_PROGRAM_UNIFORM_4I64: {
12336 union int64_pair x;
12337 union int64_pair y;
12338 union int64_pair z;
12339 union int64_pair w;
12340
12341 x.int32[0] = n[3].i;
12342 x.int32[1] = n[4].i;
12343 y.int32[0] = n[5].i;
12344 y.int32[1] = n[6].i;
12345 z.int32[0] = n[7].i;
12346 z.int32[1] = n[8].i;
12347 w.int32[0] = n[9].i;
12348 w.int32[1] = n[10].i;
12349
12350 CALL_ProgramUniform4i64ARB(ctx->Exec, (n[1].ui, n[2].i, x.int64,
12351 y.int64, z.int64, w.int64));
12352 break;
12353 }
12354 case OPCODE_PROGRAM_UNIFORM_1I64V:
12355 CALL_ProgramUniform1i64vARB(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12356 get_pointer(&n[4])));
12357 break;
12358 case OPCODE_PROGRAM_UNIFORM_2I64V:
12359 CALL_ProgramUniform2i64vARB(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12360 get_pointer(&n[4])));
12361 break;
12362 case OPCODE_PROGRAM_UNIFORM_3I64V:
12363 CALL_ProgramUniform3i64vARB(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12364 get_pointer(&n[4])));
12365 break;
12366 case OPCODE_PROGRAM_UNIFORM_4I64V:
12367 CALL_ProgramUniform4i64vARB(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12368 get_pointer(&n[4])));
12369 break;
12370 case OPCODE_PROGRAM_UNIFORM_1UI64: {
12371 union uint64_pair x;
12372
12373 x.uint32[0] = n[3].ui;
12374 x.uint32[1] = n[4].ui;
12375
12376 CALL_ProgramUniform1i64ARB(ctx->Exec, (n[1].ui, n[2].i, x.uint64));
12377 break;
12378 }
12379 case OPCODE_PROGRAM_UNIFORM_2UI64: {
12380 union uint64_pair x;
12381 union uint64_pair y;
12382
12383 x.uint32[0] = n[3].ui;
12384 x.uint32[1] = n[4].ui;
12385 y.uint32[0] = n[5].ui;
12386 y.uint32[1] = n[6].ui;
12387
12388 CALL_ProgramUniform2ui64ARB(ctx->Exec, (n[1].ui, n[2].i, x.uint64,
12389 y.uint64));
12390 break;
12391 }
12392 case OPCODE_PROGRAM_UNIFORM_3UI64: {
12393 union uint64_pair x;
12394 union uint64_pair y;
12395 union uint64_pair z;
12396
12397 x.uint32[0] = n[3].ui;
12398 x.uint32[1] = n[4].ui;
12399 y.uint32[0] = n[5].ui;
12400 y.uint32[1] = n[6].ui;
12401 z.uint32[0] = n[7].ui;
12402 z.uint32[1] = n[8].ui;
12403
12404 CALL_ProgramUniform3ui64ARB(ctx->Exec, (n[1].ui, n[2].i, x.uint64,
12405 y.uint64, z.uint64));
12406 break;
12407 }
12408 case OPCODE_PROGRAM_UNIFORM_4UI64: {
12409 union uint64_pair x;
12410 union uint64_pair y;
12411 union uint64_pair z;
12412 union uint64_pair w;
12413
12414 x.uint32[0] = n[3].ui;
12415 x.uint32[1] = n[4].ui;
12416 y.uint32[0] = n[5].ui;
12417 y.uint32[1] = n[6].ui;
12418 z.uint32[0] = n[7].ui;
12419 z.uint32[1] = n[8].ui;
12420 w.uint32[0] = n[9].ui;
12421 w.uint32[1] = n[10].ui;
12422
12423 CALL_ProgramUniform4ui64ARB(ctx->Exec, (n[1].ui, n[2].i, x.uint64,
12424 y.uint64, z.uint64, w.uint64));
12425 break;
12426 }
12427 case OPCODE_PROGRAM_UNIFORM_1UI64V:
12428 CALL_ProgramUniform1ui64vARB(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12429 get_pointer(&n[4])));
12430 break;
12431 case OPCODE_PROGRAM_UNIFORM_2UI64V:
12432 CALL_ProgramUniform2ui64vARB(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12433 get_pointer(&n[4])));
12434 break;
12435 case OPCODE_PROGRAM_UNIFORM_3UI64V:
12436 CALL_ProgramUniform3ui64vARB(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12437 get_pointer(&n[4])));
12438 break;
12439 case OPCODE_PROGRAM_UNIFORM_4UI64V:
12440 CALL_ProgramUniform4ui64vARB(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12441 get_pointer(&n[4])));
12442 break;
12443
12444 case OPCODE_USE_PROGRAM_STAGES:
12445 CALL_UseProgramStages(ctx->Exec, (n[1].ui, n[2].ui, n[3].ui));
12446 break;
12447 case OPCODE_PROGRAM_UNIFORM_1F:
12448 CALL_ProgramUniform1f(ctx->Exec, (n[1].ui, n[2].i, n[3].f));
12449 break;
12450 case OPCODE_PROGRAM_UNIFORM_2F:
12451 CALL_ProgramUniform2f(ctx->Exec, (n[1].ui, n[2].i, n[3].f, n[4].f));
12452 break;
12453 case OPCODE_PROGRAM_UNIFORM_3F:
12454 CALL_ProgramUniform3f(ctx->Exec, (n[1].ui, n[2].i,
12455 n[3].f, n[4].f, n[5].f));
12456 break;
12457 case OPCODE_PROGRAM_UNIFORM_4F:
12458 CALL_ProgramUniform4f(ctx->Exec, (n[1].ui, n[2].i,
12459 n[3].f, n[4].f, n[5].f, n[6].f));
12460 break;
12461 case OPCODE_PROGRAM_UNIFORM_1FV:
12462 CALL_ProgramUniform1fv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12463 get_pointer(&n[4])));
12464 break;
12465 case OPCODE_PROGRAM_UNIFORM_2FV:
12466 CALL_ProgramUniform2fv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12467 get_pointer(&n[4])));
12468 break;
12469 case OPCODE_PROGRAM_UNIFORM_3FV:
12470 CALL_ProgramUniform3fv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12471 get_pointer(&n[4])));
12472 break;
12473 case OPCODE_PROGRAM_UNIFORM_4FV:
12474 CALL_ProgramUniform4fv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12475 get_pointer(&n[4])));
12476 break;
12477 case OPCODE_PROGRAM_UNIFORM_1D: {
12478 union float64_pair x;
12479
12480 x.uint32[0] = n[3].ui;
12481 x.uint32[1] = n[4].ui;
12482
12483 CALL_ProgramUniform1d(ctx->Exec, (n[1].ui, n[2].i, x.d));
12484 break;
12485 }
12486 case OPCODE_PROGRAM_UNIFORM_2D: {
12487 union float64_pair x;
12488 union float64_pair y;
12489
12490 x.uint32[0] = n[3].ui;
12491 x.uint32[1] = n[4].ui;
12492 y.uint32[0] = n[5].ui;
12493 y.uint32[1] = n[6].ui;
12494
12495 CALL_ProgramUniform2d(ctx->Exec, (n[1].ui, n[2].i, x.d, y.d));
12496 break;
12497 }
12498 case OPCODE_PROGRAM_UNIFORM_3D: {
12499 union float64_pair x;
12500 union float64_pair y;
12501 union float64_pair z;
12502
12503 x.uint32[0] = n[3].ui;
12504 x.uint32[1] = n[4].ui;
12505 y.uint32[0] = n[5].ui;
12506 y.uint32[1] = n[6].ui;
12507 z.uint32[0] = n[7].ui;
12508 z.uint32[1] = n[8].ui;
12509
12510 CALL_ProgramUniform3d(ctx->Exec, (n[1].ui, n[2].i,
12511 x.d, y.d, z.d));
12512 break;
12513 }
12514 case OPCODE_PROGRAM_UNIFORM_4D: {
12515 union float64_pair x;
12516 union float64_pair y;
12517 union float64_pair z;
12518 union float64_pair w;
12519
12520 x.uint32[0] = n[3].ui;
12521 x.uint32[1] = n[4].ui;
12522 y.uint32[0] = n[5].ui;
12523 y.uint32[1] = n[6].ui;
12524 z.uint32[0] = n[7].ui;
12525 z.uint32[1] = n[8].ui;
12526 w.uint32[0] = n[9].ui;
12527 w.uint32[1] = n[10].ui;
12528
12529 CALL_ProgramUniform4d(ctx->Exec, (n[1].ui, n[2].i,
12530 x.d, y.d, z.d, w.d));
12531 break;
12532 }
12533 case OPCODE_PROGRAM_UNIFORM_1DV:
12534 CALL_ProgramUniform1dv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12535 get_pointer(&n[4])));
12536 break;
12537 case OPCODE_PROGRAM_UNIFORM_2DV:
12538 CALL_ProgramUniform2dv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12539 get_pointer(&n[4])));
12540 break;
12541 case OPCODE_PROGRAM_UNIFORM_3DV:
12542 CALL_ProgramUniform3dv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12543 get_pointer(&n[4])));
12544 break;
12545 case OPCODE_PROGRAM_UNIFORM_4DV:
12546 CALL_ProgramUniform4dv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12547 get_pointer(&n[4])));
12548 break;
12549 case OPCODE_PROGRAM_UNIFORM_1I:
12550 CALL_ProgramUniform1i(ctx->Exec, (n[1].ui, n[2].i, n[3].i));
12551 break;
12552 case OPCODE_PROGRAM_UNIFORM_2I:
12553 CALL_ProgramUniform2i(ctx->Exec, (n[1].ui, n[2].i, n[3].i, n[4].i));
12554 break;
12555 case OPCODE_PROGRAM_UNIFORM_3I:
12556 CALL_ProgramUniform3i(ctx->Exec, (n[1].ui, n[2].i,
12557 n[3].i, n[4].i, n[5].i));
12558 break;
12559 case OPCODE_PROGRAM_UNIFORM_4I:
12560 CALL_ProgramUniform4i(ctx->Exec, (n[1].ui, n[2].i,
12561 n[3].i, n[4].i, n[5].i, n[6].i));
12562 break;
12563 case OPCODE_PROGRAM_UNIFORM_1IV:
12564 CALL_ProgramUniform1iv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12565 get_pointer(&n[4])));
12566 break;
12567 case OPCODE_PROGRAM_UNIFORM_2IV:
12568 CALL_ProgramUniform2iv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12569 get_pointer(&n[4])));
12570 break;
12571 case OPCODE_PROGRAM_UNIFORM_3IV:
12572 CALL_ProgramUniform3iv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12573 get_pointer(&n[4])));
12574 break;
12575 case OPCODE_PROGRAM_UNIFORM_4IV:
12576 CALL_ProgramUniform4iv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12577 get_pointer(&n[4])));
12578 break;
12579 case OPCODE_PROGRAM_UNIFORM_1UI:
12580 CALL_ProgramUniform1ui(ctx->Exec, (n[1].ui, n[2].i, n[3].ui));
12581 break;
12582 case OPCODE_PROGRAM_UNIFORM_2UI:
12583 CALL_ProgramUniform2ui(ctx->Exec, (n[1].ui, n[2].i,
12584 n[3].ui, n[4].ui));
12585 break;
12586 case OPCODE_PROGRAM_UNIFORM_3UI:
12587 CALL_ProgramUniform3ui(ctx->Exec, (n[1].ui, n[2].i,
12588 n[3].ui, n[4].ui, n[5].ui));
12589 break;
12590 case OPCODE_PROGRAM_UNIFORM_4UI:
12591 CALL_ProgramUniform4ui(ctx->Exec, (n[1].ui, n[2].i,
12592 n[3].ui,
12593 n[4].ui, n[5].ui, n[6].ui));
12594 break;
12595 case OPCODE_PROGRAM_UNIFORM_1UIV:
12596 CALL_ProgramUniform1uiv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12597 get_pointer(&n[4])));
12598 break;
12599 case OPCODE_PROGRAM_UNIFORM_2UIV:
12600 CALL_ProgramUniform2uiv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12601 get_pointer(&n[4])));
12602 break;
12603 case OPCODE_PROGRAM_UNIFORM_3UIV:
12604 CALL_ProgramUniform3uiv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12605 get_pointer(&n[4])));
12606 break;
12607 case OPCODE_PROGRAM_UNIFORM_4UIV:
12608 CALL_ProgramUniform4uiv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12609 get_pointer(&n[4])));
12610 break;
12611 case OPCODE_PROGRAM_UNIFORM_MATRIX22F:
12612 CALL_ProgramUniformMatrix2fv(ctx->Exec,
12613 (n[1].ui, n[2].i, n[3].i, n[4].b,
12614 get_pointer(&n[5])));
12615 break;
12616 case OPCODE_PROGRAM_UNIFORM_MATRIX23F:
12617 CALL_ProgramUniformMatrix2x3fv(ctx->Exec,
12618 (n[1].ui, n[2].i, n[3].i, n[4].b,
12619 get_pointer(&n[5])));
12620 break;
12621 case OPCODE_PROGRAM_UNIFORM_MATRIX24F:
12622 CALL_ProgramUniformMatrix2x4fv(ctx->Exec,
12623 (n[1].ui, n[2].i, n[3].i, n[4].b,
12624 get_pointer(&n[5])));
12625 break;
12626 case OPCODE_PROGRAM_UNIFORM_MATRIX32F:
12627 CALL_ProgramUniformMatrix3x2fv(ctx->Exec,
12628 (n[1].ui, n[2].i, n[3].i, n[4].b,
12629 get_pointer(&n[5])));
12630 break;
12631 case OPCODE_PROGRAM_UNIFORM_MATRIX33F:
12632 CALL_ProgramUniformMatrix3fv(ctx->Exec,
12633 (n[1].ui, n[2].i, n[3].i, n[4].b,
12634 get_pointer(&n[5])));
12635 break;
12636 case OPCODE_PROGRAM_UNIFORM_MATRIX34F:
12637 CALL_ProgramUniformMatrix3x4fv(ctx->Exec,
12638 (n[1].ui, n[2].i, n[3].i, n[4].b,
12639 get_pointer(&n[5])));
12640 break;
12641 case OPCODE_PROGRAM_UNIFORM_MATRIX42F:
12642 CALL_ProgramUniformMatrix4x2fv(ctx->Exec,
12643 (n[1].ui, n[2].i, n[3].i, n[4].b,
12644 get_pointer(&n[5])));
12645 break;
12646 case OPCODE_PROGRAM_UNIFORM_MATRIX43F:
12647 CALL_ProgramUniformMatrix4x3fv(ctx->Exec,
12648 (n[1].ui, n[2].i, n[3].i, n[4].b,
12649 get_pointer(&n[5])));
12650 break;
12651 case OPCODE_PROGRAM_UNIFORM_MATRIX44F:
12652 CALL_ProgramUniformMatrix4fv(ctx->Exec,
12653 (n[1].ui, n[2].i, n[3].i, n[4].b,
12654 get_pointer(&n[5])));
12655 break;
12656 case OPCODE_PROGRAM_UNIFORM_MATRIX22D:
12657 CALL_ProgramUniformMatrix2dv(ctx->Exec,
12658 (n[1].ui, n[2].i, n[3].i, n[4].b,
12659 get_pointer(&n[5])));
12660 break;
12661 case OPCODE_PROGRAM_UNIFORM_MATRIX23D:
12662 CALL_ProgramUniformMatrix2x3dv(ctx->Exec,
12663 (n[1].ui, n[2].i, n[3].i, n[4].b,
12664 get_pointer(&n[5])));
12665 break;
12666 case OPCODE_PROGRAM_UNIFORM_MATRIX24D:
12667 CALL_ProgramUniformMatrix2x4dv(ctx->Exec,
12668 (n[1].ui, n[2].i, n[3].i, n[4].b,
12669 get_pointer(&n[5])));
12670 break;
12671 case OPCODE_PROGRAM_UNIFORM_MATRIX32D:
12672 CALL_ProgramUniformMatrix3x2dv(ctx->Exec,
12673 (n[1].ui, n[2].i, n[3].i, n[4].b,
12674 get_pointer(&n[5])));
12675 break;
12676 case OPCODE_PROGRAM_UNIFORM_MATRIX33D:
12677 CALL_ProgramUniformMatrix3dv(ctx->Exec,
12678 (n[1].ui, n[2].i, n[3].i, n[4].b,
12679 get_pointer(&n[5])));
12680 break;
12681 case OPCODE_PROGRAM_UNIFORM_MATRIX34D:
12682 CALL_ProgramUniformMatrix3x4dv(ctx->Exec,
12683 (n[1].ui, n[2].i, n[3].i, n[4].b,
12684 get_pointer(&n[5])));
12685 break;
12686 case OPCODE_PROGRAM_UNIFORM_MATRIX42D:
12687 CALL_ProgramUniformMatrix4x2dv(ctx->Exec,
12688 (n[1].ui, n[2].i, n[3].i, n[4].b,
12689 get_pointer(&n[5])));
12690 break;
12691 case OPCODE_PROGRAM_UNIFORM_MATRIX43D:
12692 CALL_ProgramUniformMatrix4x3dv(ctx->Exec,
12693 (n[1].ui, n[2].i, n[3].i, n[4].b,
12694 get_pointer(&n[5])));
12695 break;
12696 case OPCODE_PROGRAM_UNIFORM_MATRIX44D:
12697 CALL_ProgramUniformMatrix4dv(ctx->Exec,
12698 (n[1].ui, n[2].i, n[3].i, n[4].b,
12699 get_pointer(&n[5])));
12700 break;
12701
12702 case OPCODE_CLIP_CONTROL:
12703 CALL_ClipControl(ctx->Exec, (n[1].e, n[2].e));
12704 break;
12705
12706 case OPCODE_CLAMP_COLOR:
12707 CALL_ClampColor(ctx->Exec, (n[1].e, n[2].e));
12708 break;
12709
12710 case OPCODE_BIND_FRAGMENT_SHADER_ATI:
12711 CALL_BindFragmentShaderATI(ctx->Exec, (n[1].i));
12712 break;
12713 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI:
12714 CALL_SetFragmentShaderConstantATI(ctx->Exec, (n[1].ui, &n[2].f));
12715 break;
12716 case OPCODE_ATTR_1F_NV:
12717 CALL_VertexAttrib1fNV(ctx->Exec, (n[1].e, n[2].f));
12718 break;
12719 case OPCODE_ATTR_2F_NV:
12720 CALL_VertexAttrib2fvNV(ctx->Exec, (n[1].e, &n[2].f));
12721 break;
12722 case OPCODE_ATTR_3F_NV:
12723 CALL_VertexAttrib3fvNV(ctx->Exec, (n[1].e, &n[2].f));
12724 break;
12725 case OPCODE_ATTR_4F_NV:
12726 CALL_VertexAttrib4fvNV(ctx->Exec, (n[1].e, &n[2].f));
12727 break;
12728 case OPCODE_ATTR_1F_ARB:
12729 CALL_VertexAttrib1fARB(ctx->Exec, (n[1].e, n[2].f));
12730 break;
12731 case OPCODE_ATTR_2F_ARB:
12732 CALL_VertexAttrib2fvARB(ctx->Exec, (n[1].e, &n[2].f));
12733 break;
12734 case OPCODE_ATTR_3F_ARB:
12735 CALL_VertexAttrib3fvARB(ctx->Exec, (n[1].e, &n[2].f));
12736 break;
12737 case OPCODE_ATTR_4F_ARB:
12738 CALL_VertexAttrib4fvARB(ctx->Exec, (n[1].e, &n[2].f));
12739 break;
12740 case OPCODE_ATTR_1I:
12741 CALL_VertexAttribI1iEXT(ctx->Exec, (n[1].e, n[2].i));
12742 break;
12743 case OPCODE_ATTR_2I:
12744 CALL_VertexAttribI2ivEXT(ctx->Exec, (n[1].e, &n[2].i));
12745 break;
12746 case OPCODE_ATTR_3I:
12747 CALL_VertexAttribI3ivEXT(ctx->Exec, (n[1].e, &n[2].i));
12748 break;
12749 case OPCODE_ATTR_4I:
12750 CALL_VertexAttribI4ivEXT(ctx->Exec, (n[1].e, &n[2].i));
12751 break;
12752 case OPCODE_ATTR_1D: {
12753 GLdouble *d = (GLdouble *) &n[2];
12754 CALL_VertexAttribL1d(ctx->Exec, (n[1].ui, *d));
12755 break;
12756 }
12757 case OPCODE_ATTR_2D: {
12758 GLdouble *d = (GLdouble *) &n[2];
12759 CALL_VertexAttribL2dv(ctx->Exec, (n[1].ui, d));
12760 break;
12761 }
12762 case OPCODE_ATTR_3D: {
12763 GLdouble *d = (GLdouble *) &n[2];
12764 CALL_VertexAttribL3dv(ctx->Exec, (n[1].ui, d));
12765 break;
12766 }
12767 case OPCODE_ATTR_4D: {
12768 GLdouble *d = (GLdouble *) &n[2];
12769 CALL_VertexAttribL4dv(ctx->Exec, (n[1].ui, d));
12770 break;
12771 }
12772 case OPCODE_ATTR_1UI64: {
12773 uint64_t *ui64 = (uint64_t *) &n[2];
12774 CALL_VertexAttribL1ui64ARB(ctx->Exec, (n[1].ui, *ui64));
12775 break;
12776 }
12777 case OPCODE_MATERIAL:
12778 CALL_Materialfv(ctx->Exec, (n[1].e, n[2].e, &n[3].f));
12779 break;
12780 case OPCODE_BEGIN:
12781 CALL_Begin(ctx->Exec, (n[1].e));
12782 break;
12783 case OPCODE_END:
12784 CALL_End(ctx->Exec, ());
12785 break;
12786 case OPCODE_EVAL_C1:
12787 CALL_EvalCoord1f(ctx->Exec, (n[1].f));
12788 break;
12789 case OPCODE_EVAL_C2:
12790 CALL_EvalCoord2f(ctx->Exec, (n[1].f, n[2].f));
12791 break;
12792 case OPCODE_EVAL_P1:
12793 CALL_EvalPoint1(ctx->Exec, (n[1].i));
12794 break;
12795 case OPCODE_EVAL_P2:
12796 CALL_EvalPoint2(ctx->Exec, (n[1].i, n[2].i));
12797 break;
12798
12799 /* GL_EXT_texture_integer */
12800 case OPCODE_CLEARCOLOR_I:
12801 CALL_ClearColorIiEXT(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
12802 break;
12803 case OPCODE_CLEARCOLOR_UI:
12804 CALL_ClearColorIuiEXT(ctx->Exec,
12805 (n[1].ui, n[2].ui, n[3].ui, n[4].ui));
12806 break;
12807 case OPCODE_TEXPARAMETER_I:
12808 {
12809 GLint params[4];
12810 params[0] = n[3].i;
12811 params[1] = n[4].i;
12812 params[2] = n[5].i;
12813 params[3] = n[6].i;
12814 CALL_TexParameterIiv(ctx->Exec, (n[1].e, n[2].e, params));
12815 }
12816 break;
12817 case OPCODE_TEXPARAMETER_UI:
12818 {
12819 GLuint params[4];
12820 params[0] = n[3].ui;
12821 params[1] = n[4].ui;
12822 params[2] = n[5].ui;
12823 params[3] = n[6].ui;
12824 CALL_TexParameterIuiv(ctx->Exec, (n[1].e, n[2].e, params));
12825 }
12826 break;
12827
12828 case OPCODE_VERTEX_ATTRIB_DIVISOR:
12829 /* GL_ARB_instanced_arrays */
12830 CALL_VertexAttribDivisor(ctx->Exec, (n[1].ui, n[2].ui));
12831 break;
12832
12833 case OPCODE_TEXTURE_BARRIER_NV:
12834 CALL_TextureBarrierNV(ctx->Exec, ());
12835 break;
12836
12837 /* GL_EXT/ARB_transform_feedback */
12838 case OPCODE_BEGIN_TRANSFORM_FEEDBACK:
12839 CALL_BeginTransformFeedback(ctx->Exec, (n[1].e));
12840 break;
12841 case OPCODE_END_TRANSFORM_FEEDBACK:
12842 CALL_EndTransformFeedback(ctx->Exec, ());
12843 break;
12844 case OPCODE_BIND_TRANSFORM_FEEDBACK:
12845 CALL_BindTransformFeedback(ctx->Exec, (n[1].e, n[2].ui));
12846 break;
12847 case OPCODE_PAUSE_TRANSFORM_FEEDBACK:
12848 CALL_PauseTransformFeedback(ctx->Exec, ());
12849 break;
12850 case OPCODE_RESUME_TRANSFORM_FEEDBACK:
12851 CALL_ResumeTransformFeedback(ctx->Exec, ());
12852 break;
12853 case OPCODE_DRAW_TRANSFORM_FEEDBACK:
12854 CALL_DrawTransformFeedback(ctx->Exec, (n[1].e, n[2].ui));
12855 break;
12856 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM:
12857 CALL_DrawTransformFeedbackStream(ctx->Exec,
12858 (n[1].e, n[2].ui, n[3].ui));
12859 break;
12860 case OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED:
12861 CALL_DrawTransformFeedbackInstanced(ctx->Exec,
12862 (n[1].e, n[2].ui, n[3].si));
12863 break;
12864 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED:
12865 CALL_DrawTransformFeedbackStreamInstanced(ctx->Exec,
12866 (n[1].e, n[2].ui, n[3].ui, n[4].si));
12867 break;
12868
12869
12870 case OPCODE_BIND_SAMPLER:
12871 CALL_BindSampler(ctx->Exec, (n[1].ui, n[2].ui));
12872 break;
12873 case OPCODE_SAMPLER_PARAMETERIV:
12874 {
12875 GLint params[4];
12876 params[0] = n[3].i;
12877 params[1] = n[4].i;
12878 params[2] = n[5].i;
12879 params[3] = n[6].i;
12880 CALL_SamplerParameteriv(ctx->Exec, (n[1].ui, n[2].e, params));
12881 }
12882 break;
12883 case OPCODE_SAMPLER_PARAMETERFV:
12884 {
12885 GLfloat params[4];
12886 params[0] = n[3].f;
12887 params[1] = n[4].f;
12888 params[2] = n[5].f;
12889 params[3] = n[6].f;
12890 CALL_SamplerParameterfv(ctx->Exec, (n[1].ui, n[2].e, params));
12891 }
12892 break;
12893 case OPCODE_SAMPLER_PARAMETERIIV:
12894 {
12895 GLint params[4];
12896 params[0] = n[3].i;
12897 params[1] = n[4].i;
12898 params[2] = n[5].i;
12899 params[3] = n[6].i;
12900 CALL_SamplerParameterIiv(ctx->Exec, (n[1].ui, n[2].e, params));
12901 }
12902 break;
12903 case OPCODE_SAMPLER_PARAMETERUIV:
12904 {
12905 GLuint params[4];
12906 params[0] = n[3].ui;
12907 params[1] = n[4].ui;
12908 params[2] = n[5].ui;
12909 params[3] = n[6].ui;
12910 CALL_SamplerParameterIuiv(ctx->Exec, (n[1].ui, n[2].e, params));
12911 }
12912 break;
12913
12914 /* ARB_compute_shader */
12915 case OPCODE_DISPATCH_COMPUTE:
12916 CALL_DispatchCompute(ctx->Exec, (n[1].ui, n[2].ui, n[3].ui));
12917 break;
12918
12919 /* GL_ARB_sync */
12920 case OPCODE_WAIT_SYNC:
12921 {
12922 union uint64_pair p;
12923 p.uint32[0] = n[2].ui;
12924 p.uint32[1] = n[3].ui;
12925 CALL_WaitSync(ctx->Exec,
12926 (get_pointer(&n[4]), n[1].bf, p.uint64));
12927 }
12928 break;
12929
12930 /* GL_NV_conditional_render */
12931 case OPCODE_BEGIN_CONDITIONAL_RENDER:
12932 CALL_BeginConditionalRender(ctx->Exec, (n[1].i, n[2].e));
12933 break;
12934 case OPCODE_END_CONDITIONAL_RENDER:
12935 CALL_EndConditionalRender(ctx->Exec, ());
12936 break;
12937
12938 case OPCODE_UNIFORM_BLOCK_BINDING:
12939 CALL_UniformBlockBinding(ctx->Exec, (n[1].ui, n[2].ui, n[3].ui));
12940 break;
12941
12942 case OPCODE_UNIFORM_SUBROUTINES:
12943 CALL_UniformSubroutinesuiv(ctx->Exec, (n[1].e, n[2].si,
12944 get_pointer(&n[3])));
12945 break;
12946
12947 /* GL_EXT_window_rectangles */
12948 case OPCODE_WINDOW_RECTANGLES:
12949 CALL_WindowRectanglesEXT(
12950 ctx->Exec, (n[1].e, n[2].si, get_pointer(&n[3])));
12951 break;
12952
12953 /* GL_NV_conservative_raster */
12954 case OPCODE_SUBPIXEL_PRECISION_BIAS:
12955 CALL_SubpixelPrecisionBiasNV(ctx->Exec, (n[1].ui, n[2].ui));
12956 break;
12957
12958 /* GL_NV_conservative_raster_dilate */
12959 case OPCODE_CONSERVATIVE_RASTER_PARAMETER_F:
12960 CALL_ConservativeRasterParameterfNV(ctx->Exec, (n[1].e, n[2].f));
12961 break;
12962
12963 /* GL_NV_conservative_raster_pre_snap_triangles */
12964 case OPCODE_CONSERVATIVE_RASTER_PARAMETER_I:
12965 CALL_ConservativeRasterParameteriNV(ctx->Exec, (n[1].e, n[2].i));
12966 break;
12967
12968 /* GL_EXT_direct_state_access */
12969 case OPCODE_MATRIX_LOAD:
12970 CALL_MatrixLoadfEXT(ctx->Exec, (n[1].e, &n[2].f));
12971 break;
12972 case OPCODE_MATRIX_MULT:
12973 CALL_MatrixMultfEXT(ctx->Exec, (n[1].e, &n[2].f));
12974 break;
12975 case OPCODE_MATRIX_ROTATE:
12976 CALL_MatrixRotatefEXT(ctx->Exec, (n[1].e, n[2].f, n[3].f, n[4].f, n[5].f));
12977 break;
12978 case OPCODE_MATRIX_SCALE:
12979 CALL_MatrixScalefEXT(ctx->Exec, (n[1].e, n[2].f, n[3].f, n[4].f));
12980 break;
12981 case OPCODE_MATRIX_TRANSLATE:
12982 CALL_MatrixTranslatefEXT(ctx->Exec, (n[1].e, n[2].f, n[3].f, n[4].f));
12983 break;
12984 case OPCODE_MATRIX_LOAD_IDENTITY:
12985 CALL_MatrixLoadIdentityEXT(ctx->Exec, (n[1].e));
12986 break;
12987 case OPCODE_MATRIX_ORTHO:
12988 CALL_MatrixOrthoEXT(ctx->Exec, (n[1].e,
12989 n[2].f, n[3].f, n[4].f,
12990 n[5].f, n[6].f, n[7].f));
12991 break;
12992 case OPCODE_MATRIX_FRUSTUM:
12993 CALL_MatrixFrustumEXT(ctx->Exec, (n[1].e,
12994 n[2].f, n[3].f, n[4].f,
12995 n[5].f, n[6].f, n[7].f));
12996 break;
12997 case OPCODE_MATRIX_PUSH:
12998 CALL_MatrixPushEXT(ctx->Exec, (n[1].e));
12999 break;
13000 case OPCODE_MATRIX_POP:
13001 CALL_MatrixPopEXT(ctx->Exec, (n[1].e));
13002 break;
13003 case OPCODE_TEXTUREPARAMETER_F:
13004 {
13005 GLfloat params[4];
13006 params[0] = n[4].f;
13007 params[1] = n[5].f;
13008 params[2] = n[6].f;
13009 params[3] = n[7].f;
13010 CALL_TextureParameterfvEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].e, params));
13011 }
13012 break;
13013 case OPCODE_TEXTUREPARAMETER_I:
13014 {
13015 GLint params[4];
13016 params[0] = n[4].i;
13017 params[1] = n[5].i;
13018 params[2] = n[6].i;
13019 params[3] = n[7].i;
13020 CALL_TextureParameterivEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].e, params));
13021 }
13022 break;
13023 case OPCODE_TEXTUREPARAMETER_II:
13024 {
13025 GLint params[4];
13026 params[0] = n[4].i;
13027 params[1] = n[5].i;
13028 params[2] = n[6].i;
13029 params[3] = n[7].i;
13030 CALL_TextureParameterIivEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].e, params));
13031 }
13032 break;
13033 case OPCODE_TEXTUREPARAMETER_IUI:
13034 {
13035 GLuint params[4];
13036 params[0] = n[4].ui;
13037 params[1] = n[5].ui;
13038 params[2] = n[6].ui;
13039 params[3] = n[7].ui;
13040 CALL_TextureParameterIuivEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].e, params));
13041 }
13042 break;
13043 case OPCODE_TEXTURE_IMAGE1D:
13044 {
13045 const struct gl_pixelstore_attrib save = ctx->Unpack;
13046 ctx->Unpack = ctx->DefaultPacking;
13047 CALL_TextureImage1DEXT(ctx->Exec, (n[1].ui, /* texture */
13048 n[2].e, /* target */
13049 n[3].i, /* level */
13050 n[4].i, /* components */
13051 n[5].i, /* width */
13052 n[6].e, /* border */
13053 n[7].e, /* format */
13054 n[8].e, /* type */
13055 get_pointer(&n[9])));
13056 ctx->Unpack = save; /* restore */
13057 }
13058 break;
13059 case OPCODE_TEXTURE_IMAGE2D:
13060 {
13061 const struct gl_pixelstore_attrib save = ctx->Unpack;
13062 ctx->Unpack = ctx->DefaultPacking;
13063 CALL_TextureImage2DEXT(ctx->Exec, (n[1].ui, /* texture */
13064 n[2].e, /* target */
13065 n[3].i, /* level */
13066 n[4].i, /* components */
13067 n[5].i, /* width */
13068 n[6].i, /* height */
13069 n[7].e, /* border */
13070 n[8].e, /* format */
13071 n[9].e, /* type */
13072 get_pointer(&n[10])));
13073 ctx->Unpack = save; /* restore */
13074 }
13075 break;
13076 case OPCODE_TEXTURE_IMAGE3D:
13077 {
13078 const struct gl_pixelstore_attrib save = ctx->Unpack;
13079 ctx->Unpack = ctx->DefaultPacking;
13080 CALL_TextureImage3DEXT(ctx->Exec, (n[1].ui, /* texture */
13081 n[2].e, /* target */
13082 n[3].i, /* level */
13083 n[4].i, /* components */
13084 n[5].i, /* width */
13085 n[6].i, /* height */
13086 n[7].i, /* depth */
13087 n[8].e, /* border */
13088 n[9].e, /* format */
13089 n[10].e, /* type */
13090 get_pointer(&n[11])));
13091 ctx->Unpack = save; /* restore */
13092 }
13093 break;
13094 case OPCODE_TEXTURE_SUB_IMAGE1D:
13095 {
13096 const struct gl_pixelstore_attrib save = ctx->Unpack;
13097 ctx->Unpack = ctx->DefaultPacking;
13098 CALL_TextureSubImage1DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13099 n[4].i, n[5].i, n[6].e,
13100 n[7].e, get_pointer(&n[8])));
13101 ctx->Unpack = save; /* restore */
13102 }
13103 break;
13104 case OPCODE_TEXTURE_SUB_IMAGE2D:
13105 {
13106 const struct gl_pixelstore_attrib save = ctx->Unpack;
13107 ctx->Unpack = ctx->DefaultPacking;
13108 CALL_TextureSubImage2DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13109 n[4].i, n[5].i, n[6].e,
13110 n[7].i, n[8].e, n[9].e,
13111 get_pointer(&n[10])));
13112 ctx->Unpack = save;
13113 }
13114 break;
13115 case OPCODE_TEXTURE_SUB_IMAGE3D:
13116 {
13117 const struct gl_pixelstore_attrib save = ctx->Unpack;
13118 ctx->Unpack = ctx->DefaultPacking;
13119 CALL_TextureSubImage3DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13120 n[4].i, n[5].i, n[6].i,
13121 n[7].i, n[8].i, n[9].i,
13122 n[10].e, n[11].e,
13123 get_pointer(&n[12])));
13124 ctx->Unpack = save; /* restore */
13125 }
13126 break;
13127 case OPCODE_COPY_TEXTURE_IMAGE1D:
13128 CALL_CopyTextureImage1DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13129 n[4].e, n[5].i, n[6].i,
13130 n[7].i, n[8].i));
13131 break;
13132 case OPCODE_COPY_TEXTURE_IMAGE2D:
13133 CALL_CopyTextureImage2DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13134 n[4].e, n[5].i, n[6].i,
13135 n[7].i, n[8].i, n[9].i));
13136 break;
13137 case OPCODE_COPY_TEXTURE_SUB_IMAGE1D:
13138 CALL_CopyTextureSubImage1DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13139 n[4].i, n[5].i, n[6].i,
13140 n[7].i));
13141 break;
13142 case OPCODE_COPY_TEXTURE_SUB_IMAGE2D:
13143 CALL_CopyTextureSubImage2DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13144 n[4].i, n[5].i, n[6].i,
13145 n[7].i, n[8].i, n[9].i));
13146 break;
13147 case OPCODE_COPY_TEXTURE_SUB_IMAGE3D:
13148 CALL_CopyTextureSubImage3DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13149 n[4].i, n[5].i, n[6].i,
13150 n[7].i, n[8].i, n[9].i,
13151 n[10].i));
13152 break;
13153 case OPCODE_BIND_MULTITEXTURE:
13154 CALL_BindMultiTextureEXT(ctx->Exec, (n[1].e, n[2].e, n[3].ui));
13155 break;
13156 case OPCODE_MULTITEXPARAMETER_F:
13157 {
13158 GLfloat params[4];
13159 params[0] = n[4].f;
13160 params[1] = n[5].f;
13161 params[2] = n[6].f;
13162 params[3] = n[7].f;
13163 CALL_MultiTexParameterfvEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, params));
13164 }
13165 break;
13166 case OPCODE_MULTITEXPARAMETER_I:
13167 {
13168 GLint params[4];
13169 params[0] = n[4].i;
13170 params[1] = n[5].i;
13171 params[2] = n[6].i;
13172 params[3] = n[7].i;
13173 CALL_MultiTexParameterivEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, params));
13174 }
13175 break;
13176 case OPCODE_MULTITEXPARAMETER_II:
13177 {
13178 GLint params[4];
13179 params[0] = n[4].i;
13180 params[1] = n[5].i;
13181 params[2] = n[6].i;
13182 params[3] = n[7].i;
13183 CALL_MultiTexParameterIivEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, params));
13184 }
13185 break;
13186 case OPCODE_MULTITEXPARAMETER_IUI:
13187 {
13188 GLuint params[4];
13189 params[0] = n[4].ui;
13190 params[1] = n[5].ui;
13191 params[2] = n[6].ui;
13192 params[3] = n[7].ui;
13193 CALL_MultiTexParameterIuivEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, params));
13194 }
13195 break;
13196 case OPCODE_MULTITEX_IMAGE1D:
13197 {
13198 const struct gl_pixelstore_attrib save = ctx->Unpack;
13199 ctx->Unpack = ctx->DefaultPacking;
13200 CALL_MultiTexImage1DEXT(ctx->Exec, (n[1].e, /* texture */
13201 n[2].e, /* target */
13202 n[3].i, /* level */
13203 n[4].i, /* components */
13204 n[5].i, /* width */
13205 n[6].e, /* border */
13206 n[7].e, /* format */
13207 n[8].e, /* type */
13208 get_pointer(&n[9])));
13209 ctx->Unpack = save; /* restore */
13210 }
13211 break;
13212 case OPCODE_MULTITEX_IMAGE2D:
13213 {
13214 const struct gl_pixelstore_attrib save = ctx->Unpack;
13215 ctx->Unpack = ctx->DefaultPacking;
13216 CALL_MultiTexImage2DEXT(ctx->Exec, (n[1].e, /* texture */
13217 n[2].e, /* target */
13218 n[3].i, /* level */
13219 n[4].i, /* components */
13220 n[5].i, /* width */
13221 n[6].i, /* height */
13222 n[7].e, /* border */
13223 n[8].e, /* format */
13224 n[9].e, /* type */
13225 get_pointer(&n[10])));
13226 ctx->Unpack = save; /* restore */
13227 }
13228 break;
13229 case OPCODE_MULTITEX_IMAGE3D:
13230 {
13231 const struct gl_pixelstore_attrib save = ctx->Unpack;
13232 ctx->Unpack = ctx->DefaultPacking;
13233 CALL_MultiTexImage3DEXT(ctx->Exec, (n[1].e, /* texture */
13234 n[2].e, /* target */
13235 n[3].i, /* level */
13236 n[4].i, /* components */
13237 n[5].i, /* width */
13238 n[6].i, /* height */
13239 n[7].i, /* depth */
13240 n[8].e, /* border */
13241 n[9].e, /* format */
13242 n[10].e, /* type */
13243 get_pointer(&n[11])));
13244 ctx->Unpack = save; /* restore */
13245 }
13246 break;
13247 case OPCODE_MULTITEX_SUB_IMAGE1D:
13248 {
13249 const struct gl_pixelstore_attrib save = ctx->Unpack;
13250 ctx->Unpack = ctx->DefaultPacking;
13251 CALL_MultiTexSubImage1DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13252 n[4].i, n[5].i, n[6].e,
13253 n[7].e, get_pointer(&n[8])));
13254 ctx->Unpack = save; /* restore */
13255 }
13256 break;
13257 case OPCODE_MULTITEX_SUB_IMAGE2D:
13258 {
13259 const struct gl_pixelstore_attrib save = ctx->Unpack;
13260 ctx->Unpack = ctx->DefaultPacking;
13261 CALL_MultiTexSubImage2DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13262 n[4].i, n[5].i, n[6].e,
13263 n[7].i, n[8].e, n[9].e,
13264 get_pointer(&n[10])));
13265 ctx->Unpack = save; /* restore */
13266 }
13267 break;
13268 case OPCODE_MULTITEX_SUB_IMAGE3D:
13269 {
13270 const struct gl_pixelstore_attrib save = ctx->Unpack;
13271 ctx->Unpack = ctx->DefaultPacking;
13272 CALL_MultiTexSubImage3DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13273 n[4].i, n[5].i, n[6].i,
13274 n[7].i, n[8].i, n[9].i,
13275 n[10].e, n[11].e,
13276 get_pointer(&n[12])));
13277 ctx->Unpack = save; /* restore */
13278 }
13279 break;
13280 case OPCODE_COPY_MULTITEX_IMAGE1D:
13281 CALL_CopyMultiTexImage1DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13282 n[4].e, n[5].i, n[6].i,
13283 n[7].i, n[8].i));
13284 break;
13285 case OPCODE_COPY_MULTITEX_IMAGE2D:
13286 CALL_CopyMultiTexImage2DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13287 n[4].e, n[5].i, n[6].i,
13288 n[7].i, n[8].i, n[9].i));
13289 break;
13290 case OPCODE_COPY_MULTITEX_SUB_IMAGE1D:
13291 CALL_CopyMultiTexSubImage1DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13292 n[4].i, n[5].i, n[6].i,
13293 n[7].i));
13294 break;
13295 case OPCODE_COPY_MULTITEX_SUB_IMAGE2D:
13296 CALL_CopyMultiTexSubImage2DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13297 n[4].i, n[5].i, n[6].i,
13298 n[7].i, n[8].i, n[9].i));
13299 break;
13300 case OPCODE_COPY_MULTITEX_SUB_IMAGE3D:
13301 CALL_CopyMultiTexSubImage3DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13302 n[4].i, n[5].i, n[6].i,
13303 n[7].i, n[8].i, n[9].i,
13304 n[10].i));
13305 break;
13306 case OPCODE_MULTITEXENV:
13307 {
13308 GLfloat params[4];
13309 params[0] = n[4].f;
13310 params[1] = n[5].f;
13311 params[2] = n[6].f;
13312 params[3] = n[7].f;
13313 CALL_MultiTexEnvfvEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, params));
13314 }
13315 break;
13316 case OPCODE_COMPRESSED_TEXTURE_IMAGE_1D:
13317 CALL_CompressedTextureImage1DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13318 n[4].e, n[5].i, n[6].i,
13319 n[7].i, get_pointer(&n[8])));
13320 break;
13321 case OPCODE_COMPRESSED_TEXTURE_IMAGE_2D:
13322 CALL_CompressedTextureImage2DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13323 n[4].e, n[5].i, n[6].i,
13324 n[7].i, n[8].i,
13325 get_pointer(&n[9])));
13326 break;
13327 case OPCODE_COMPRESSED_TEXTURE_IMAGE_3D:
13328 CALL_CompressedTextureImage3DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13329 n[4].e, n[5].i, n[6].i,
13330 n[7].i, n[8].i, n[9].i,
13331 get_pointer(&n[10])));
13332 break;
13333 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_1D:
13334 CALL_CompressedTextureSubImage1DEXT(ctx->Exec,
13335 (n[1].ui, n[2].e, n[3].i, n[4].i,
13336 n[5].i, n[6].e, n[7].i,
13337 get_pointer(&n[8])));
13338 break;
13339 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_2D:
13340 CALL_CompressedTextureSubImage2DEXT(ctx->Exec,
13341 (n[1].ui, n[2].e, n[3].i, n[4].i,
13342 n[5].i, n[6].i, n[7].i, n[8].e,
13343 n[9].i, get_pointer(&n[10])));
13344 break;
13345 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_3D:
13346 CALL_CompressedTextureSubImage3DEXT(ctx->Exec,
13347 (n[1].ui, n[2].e, n[3].i, n[4].i,
13348 n[5].i, n[6].i, n[7].i, n[8].i,
13349 n[9].i, n[10].e, n[11].i,
13350 get_pointer(&n[12])));
13351 break;
13352 case OPCODE_COMPRESSED_MULTITEX_IMAGE_1D:
13353 CALL_CompressedMultiTexImage1DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13354 n[4].e, n[5].i, n[6].i,
13355 n[7].i, get_pointer(&n[8])));
13356 break;
13357 case OPCODE_COMPRESSED_MULTITEX_IMAGE_2D:
13358 CALL_CompressedMultiTexImage2DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13359 n[4].e, n[5].i, n[6].i,
13360 n[7].i, n[8].i,
13361 get_pointer(&n[9])));
13362 break;
13363 case OPCODE_COMPRESSED_MULTITEX_IMAGE_3D:
13364 CALL_CompressedMultiTexImage3DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13365 n[4].e, n[5].i, n[6].i,
13366 n[7].i, n[8].i, n[9].i,
13367 get_pointer(&n[10])));
13368 break;
13369 case OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_1D:
13370 CALL_CompressedMultiTexSubImage1DEXT(ctx->Exec,
13371 (n[1].e, n[2].e, n[3].i, n[4].i,
13372 n[5].i, n[6].e, n[7].i,
13373 get_pointer(&n[8])));
13374 break;
13375 case OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_2D:
13376 CALL_CompressedMultiTexSubImage2DEXT(ctx->Exec,
13377 (n[1].e, n[2].e, n[3].i, n[4].i,
13378 n[5].i, n[6].i, n[7].i, n[8].e,
13379 n[9].i, get_pointer(&n[10])));
13380 break;
13381 case OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_3D:
13382 CALL_CompressedMultiTexSubImage3DEXT(ctx->Exec,
13383 (n[1].e, n[2].e, n[3].i, n[4].i,
13384 n[5].i, n[6].i, n[7].i, n[8].i,
13385 n[9].i, n[10].e, n[11].i,
13386 get_pointer(&n[12])));
13387 break;
13388 case OPCODE_NAMED_PROGRAM_STRING:
13389 CALL_NamedProgramStringEXT(ctx->Exec,
13390 (n[1].ui, n[2].e, n[3].e, n[4].i,
13391 get_pointer(&n[5])));
13392 break;
13393 case OPCODE_NAMED_PROGRAM_LOCAL_PARAMETER:
13394 CALL_NamedProgramLocalParameter4fEXT(ctx->Exec,
13395 (n[1].ui, n[2].e, n[3].ui, n[4].f,
13396 n[5].f, n[6].f, n[7].f));
13397 break;
13398
13399 case OPCODE_PRIMITIVE_BOUNDING_BOX:
13400 CALL_PrimitiveBoundingBox(ctx->Exec,
13401 (n[1].f, n[2].f, n[3].f, n[4].f,
13402 n[5].f, n[6].f, n[7].f, n[8].f));
13403 break;
13404 case OPCODE_VERTEX_LIST:
13405 vbo_save_playback_vertex_list(ctx, &n[1], false);
13406 break;
13407
13408 case OPCODE_VERTEX_LIST_COPY_CURRENT:
13409 vbo_save_playback_vertex_list(ctx, &n[1], true);
13410 break;
13411
13412 case OPCODE_VERTEX_LIST_LOOPBACK:
13413 vbo_save_playback_vertex_list_loopback(ctx, &n[1]);
13414 break;
13415
13416 case OPCODE_CONTINUE:
13417 n = (Node *) get_pointer(&n[1]);
13418 continue;
13419 case OPCODE_NOP:
13420 /* no-op */
13421 break;
13422 default:
13423 {
13424 char msg[1000];
13425 snprintf(msg, sizeof(msg), "Error in execute_list: opcode=%d",
13426 (int) opcode);
13427 _mesa_problem(ctx, "%s", msg);
13428 }
13429 FALLTHROUGH;
13430 case OPCODE_END_OF_LIST:
13431 return;
13432 }
13433
13434 /* increment n to point to next compiled command */
13435 assert(n[0].InstSize > 0);
13436 n += n[0].InstSize;
13437 }
13438 }
13439
13440
13441
13442 /**********************************************************************/
13443 /* GL functions */
13444 /**********************************************************************/
13445
13446 /**
13447 * Test if a display list number is valid.
13448 */
13449 GLboolean GLAPIENTRY
_mesa_IsList(GLuint list)13450 _mesa_IsList(GLuint list)
13451 {
13452 GET_CURRENT_CONTEXT(ctx);
13453 FLUSH_VERTICES(ctx, 0, 0); /* must be called before assert */
13454 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
13455 return _mesa_get_list(ctx, list, NULL, false);
13456 }
13457
13458
13459 /**
13460 * Delete a sequence of consecutive display lists.
13461 */
13462 void GLAPIENTRY
_mesa_DeleteLists(GLuint list,GLsizei range)13463 _mesa_DeleteLists(GLuint list, GLsizei range)
13464 {
13465 GET_CURRENT_CONTEXT(ctx);
13466 GLuint i;
13467 FLUSH_VERTICES(ctx, 0, 0); /* must be called before assert */
13468 ASSERT_OUTSIDE_BEGIN_END(ctx);
13469
13470 if (range < 0) {
13471 _mesa_error(ctx, GL_INVALID_VALUE, "glDeleteLists");
13472 return;
13473 }
13474
13475 if (range > 1) {
13476 /* We may be deleting a set of bitmap lists. See if there's a
13477 * bitmap atlas to free.
13478 */
13479 struct gl_bitmap_atlas *atlas = lookup_bitmap_atlas(ctx, list);
13480 if (atlas) {
13481 _mesa_delete_bitmap_atlas(ctx, atlas);
13482 _mesa_HashRemove(ctx->Shared->BitmapAtlas, list);
13483 }
13484 }
13485
13486 for (i = list; i < list + range; i++) {
13487 destroy_list(ctx, i);
13488 }
13489 }
13490
13491
13492 /**
13493 * Return a display list number, n, such that lists n through n+range-1
13494 * are free.
13495 */
13496 GLuint GLAPIENTRY
_mesa_GenLists(GLsizei range)13497 _mesa_GenLists(GLsizei range)
13498 {
13499 GET_CURRENT_CONTEXT(ctx);
13500 GLuint base;
13501 FLUSH_VERTICES(ctx, 0, 0); /* must be called before assert */
13502 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
13503
13504 if (range < 0) {
13505 _mesa_error(ctx, GL_INVALID_VALUE, "glGenLists");
13506 return 0;
13507 }
13508 if (range == 0) {
13509 return 0;
13510 }
13511
13512 /*
13513 * Make this an atomic operation
13514 */
13515 _mesa_HashLockMutex(ctx->Shared->DisplayList);
13516
13517 base = _mesa_HashFindFreeKeyBlock(ctx->Shared->DisplayList, range);
13518 if (base) {
13519 /* reserve the list IDs by with empty/dummy lists */
13520 GLint i;
13521 for (i = 0; i < range; i++) {
13522 _mesa_HashInsertLocked(ctx->Shared->DisplayList, base + i,
13523 make_list(base + i, 1), true);
13524 }
13525 }
13526
13527 if (USE_BITMAP_ATLAS &&
13528 range > 16 &&
13529 ctx->Driver.DrawAtlasBitmaps) {
13530 /* "range > 16" is a rough heuristic to guess when glGenLists might be
13531 * used to allocate display lists for glXUseXFont or wglUseFontBitmaps.
13532 * Create the empty atlas now.
13533 */
13534 struct gl_bitmap_atlas *atlas = lookup_bitmap_atlas(ctx, base);
13535 if (!atlas) {
13536 atlas = alloc_bitmap_atlas(ctx, base, true);
13537 }
13538 if (atlas) {
13539 /* Atlas _should_ be new/empty now, but clobbering is OK */
13540 assert(atlas->numBitmaps == 0);
13541 atlas->numBitmaps = range;
13542 }
13543 }
13544
13545 _mesa_HashUnlockMutex(ctx->Shared->DisplayList);
13546
13547 return base;
13548 }
13549
13550
13551 /**
13552 * Begin a new display list.
13553 */
13554 void GLAPIENTRY
_mesa_NewList(GLuint name,GLenum mode)13555 _mesa_NewList(GLuint name, GLenum mode)
13556 {
13557 GET_CURRENT_CONTEXT(ctx);
13558
13559 FLUSH_CURRENT(ctx, 0); /* must be called before assert */
13560 ASSERT_OUTSIDE_BEGIN_END(ctx);
13561
13562 if (MESA_VERBOSE & VERBOSE_API)
13563 _mesa_debug(ctx, "glNewList %u %s\n", name,
13564 _mesa_enum_to_string(mode));
13565
13566 if (name == 0) {
13567 _mesa_error(ctx, GL_INVALID_VALUE, "glNewList");
13568 return;
13569 }
13570
13571 if (mode != GL_COMPILE && mode != GL_COMPILE_AND_EXECUTE) {
13572 _mesa_error(ctx, GL_INVALID_ENUM, "glNewList");
13573 return;
13574 }
13575
13576 if (ctx->ListState.CurrentList) {
13577 /* already compiling a display list */
13578 _mesa_error(ctx, GL_INVALID_OPERATION, "glNewList");
13579 return;
13580 }
13581
13582 ctx->CompileFlag = GL_TRUE;
13583 ctx->ExecuteFlag = (mode == GL_COMPILE_AND_EXECUTE);
13584
13585 /* Reset accumulated list state */
13586 invalidate_saved_current_state( ctx );
13587
13588 /* Allocate new display list */
13589 ctx->ListState.CurrentList = make_list(name, BLOCK_SIZE);
13590 ctx->ListState.CurrentBlock = ctx->ListState.CurrentList->Head;
13591 ctx->ListState.CurrentPos = 0;
13592 ctx->ListState.Current.UseLoopback = false;
13593
13594 vbo_save_NewList(ctx, name, mode);
13595
13596 ctx->CurrentServerDispatch = ctx->Save;
13597 _glapi_set_dispatch(ctx->CurrentServerDispatch);
13598 if (ctx->MarshalExec == NULL) {
13599 ctx->CurrentClientDispatch = ctx->CurrentServerDispatch;
13600 }
13601 }
13602
13603
13604 /**
13605 * Walk all the opcode from a given list, recursively if OPCODE_CALL_LIST(S) is used,
13606 * and replace OPCODE_VERTEX_LIST[_COPY_CURRENT] occurences by OPCODE_VERTEX_LIST_LOOPBACK.
13607 */
13608 static void
replace_op_vertex_list_recursively(struct gl_context * ctx,struct gl_display_list * dlist)13609 replace_op_vertex_list_recursively(struct gl_context *ctx, struct gl_display_list *dlist)
13610 {
13611 Node *n = get_list_head(ctx, dlist);
13612 while (true) {
13613 const OpCode opcode = n[0].opcode;
13614 switch (opcode) {
13615 case OPCODE_VERTEX_LIST:
13616 case OPCODE_VERTEX_LIST_COPY_CURRENT:
13617 n[0].opcode = OPCODE_VERTEX_LIST_LOOPBACK;
13618 break;
13619 case OPCODE_CONTINUE:
13620 n = (Node *)get_pointer(&n[1]);
13621 continue;
13622 case OPCODE_CALL_LIST:
13623 replace_op_vertex_list_recursively(ctx, _mesa_lookup_list(ctx, (int)n[1].ui, true));
13624 break;
13625 case OPCODE_CALL_LISTS: {
13626 GLbyte *bptr;
13627 GLubyte *ubptr;
13628 GLshort *sptr;
13629 GLushort *usptr;
13630 GLint *iptr;
13631 GLuint *uiptr;
13632 GLfloat *fptr;
13633 switch(n[2].e) {
13634 case GL_BYTE:
13635 bptr = (GLbyte *) get_pointer(&n[3]);
13636 for (unsigned i = 0; i < n[1].i; i++)
13637 replace_op_vertex_list_recursively(ctx, _mesa_lookup_list(ctx, (int)bptr[i], true));
13638 break;
13639 case GL_UNSIGNED_BYTE:
13640 ubptr = (GLubyte *) get_pointer(&n[3]);
13641 for (unsigned i = 0; i < n[1].i; i++)
13642 replace_op_vertex_list_recursively(ctx, _mesa_lookup_list(ctx, (int)ubptr[i], true));
13643 break;
13644 case GL_SHORT:
13645 sptr = (GLshort *) get_pointer(&n[3]);
13646 for (unsigned i = 0; i < n[1].i; i++)
13647 replace_op_vertex_list_recursively(ctx, _mesa_lookup_list(ctx, (int)sptr[i], true));
13648 break;
13649 case GL_UNSIGNED_SHORT:
13650 usptr = (GLushort *) get_pointer(&n[3]);
13651 for (unsigned i = 0; i < n[1].i; i++)
13652 replace_op_vertex_list_recursively(ctx, _mesa_lookup_list(ctx, (int)usptr[i], true));
13653 break;
13654 case GL_INT:
13655 iptr = (GLint *) get_pointer(&n[3]);
13656 for (unsigned i = 0; i < n[1].i; i++)
13657 replace_op_vertex_list_recursively(ctx, _mesa_lookup_list(ctx, (int)iptr[i], true));
13658 break;
13659 case GL_UNSIGNED_INT:
13660 uiptr = (GLuint *) get_pointer(&n[3]);
13661 for (unsigned i = 0; i < n[1].i; i++)
13662 replace_op_vertex_list_recursively(ctx, _mesa_lookup_list(ctx, (int)uiptr[i], true));
13663 break;
13664 case GL_FLOAT:
13665 fptr = (GLfloat *) get_pointer(&n[3]);
13666 for (unsigned i = 0; i < n[1].i; i++)
13667 replace_op_vertex_list_recursively(ctx, _mesa_lookup_list(ctx, (int)fptr[i], true));
13668 break;
13669 case GL_2_BYTES:
13670 ubptr = (GLubyte *) get_pointer(&n[3]);
13671 for (unsigned i = 0; i < n[1].i; i++) {
13672 replace_op_vertex_list_recursively(ctx,
13673 _mesa_lookup_list(ctx, (int)ubptr[2 * i] * 256 +
13674 (int)ubptr[2 * i + 1], true));
13675 }
13676 break;
13677 case GL_3_BYTES:
13678 ubptr = (GLubyte *) get_pointer(&n[3]);
13679 for (unsigned i = 0; i < n[1].i; i++) {
13680 replace_op_vertex_list_recursively(ctx,
13681 _mesa_lookup_list(ctx, (int)ubptr[3 * i] * 65536 +
13682 (int)ubptr[3 * i + 1] * 256 +
13683 (int)ubptr[3 * i + 2], true));
13684 }
13685 break;
13686 case GL_4_BYTES:
13687 ubptr = (GLubyte *) get_pointer(&n[3]);
13688 for (unsigned i = 0; i < n[1].i; i++) {
13689 replace_op_vertex_list_recursively(ctx,
13690 _mesa_lookup_list(ctx, (int)ubptr[4 * i] * 16777216 +
13691 (int)ubptr[4 * i + 1] * 65536 +
13692 (int)ubptr[4 * i + 2] * 256 +
13693 (int)ubptr[4 * i + 3], true));
13694 }
13695 break;
13696 }
13697 break;
13698 }
13699 case OPCODE_END_OF_LIST:
13700 return;
13701 default:
13702 break;
13703 }
13704 n += n[0].InstSize;
13705 }
13706 }
13707
13708
13709 /**
13710 * End definition of current display list.
13711 */
13712 void GLAPIENTRY
_mesa_EndList(void)13713 _mesa_EndList(void)
13714 {
13715 GET_CURRENT_CONTEXT(ctx);
13716 SAVE_FLUSH_VERTICES(ctx);
13717 FLUSH_VERTICES(ctx, 0, 0);
13718
13719 if (MESA_VERBOSE & VERBOSE_API)
13720 _mesa_debug(ctx, "glEndList\n");
13721
13722 if (ctx->ExecuteFlag && _mesa_inside_dlist_begin_end(ctx)) {
13723 _mesa_error(ctx, GL_INVALID_OPERATION,
13724 "glEndList() called inside glBegin/End");
13725 }
13726
13727 /* Check that a list is under construction */
13728 if (!ctx->ListState.CurrentList) {
13729 _mesa_error(ctx, GL_INVALID_OPERATION, "glEndList");
13730 return;
13731 }
13732
13733 /* Call before emitting END_OF_LIST, in case the driver wants to
13734 * emit opcodes itself.
13735 */
13736 vbo_save_EndList(ctx);
13737
13738 (void) alloc_instruction(ctx, OPCODE_END_OF_LIST, 0);
13739
13740 _mesa_HashLockMutex(ctx->Shared->DisplayList);
13741
13742 if (ctx->ListState.Current.UseLoopback)
13743 replace_op_vertex_list_recursively(ctx, ctx->ListState.CurrentList);
13744
13745 struct gl_dlist_state *list = &ctx->ListState;
13746
13747 if ((list->CurrentList->Head == list->CurrentBlock) &&
13748 (list->CurrentPos < BLOCK_SIZE)) {
13749 /* This list has a low number of commands. Instead of storing them in a malloc-ed block
13750 * of memory (list->CurrentBlock), we store them in ctx->Shared->small_dlist_store.ptr.
13751 * This reduces cache misses in execute_list on successive lists since their commands
13752 * are now stored in the same array instead of being scattered in memory.
13753 */
13754 list->CurrentList->small_list = true;
13755 unsigned start;
13756
13757 if (ctx->Shared->small_dlist_store.size == 0) {
13758 util_idalloc_init(&ctx->Shared->small_dlist_store.free_idx, MAX2(1, list->CurrentPos));
13759 }
13760
13761 start = util_idalloc_alloc_range(&ctx->Shared->small_dlist_store.free_idx, list->CurrentPos);
13762
13763 if ((start + list->CurrentPos) > ctx->Shared->small_dlist_store.size) {
13764 ctx->Shared->small_dlist_store.size =
13765 ctx->Shared->small_dlist_store.free_idx.num_elements * 32;
13766 ctx->Shared->small_dlist_store.ptr = realloc(
13767 ctx->Shared->small_dlist_store.ptr,
13768 ctx->Shared->small_dlist_store.size * sizeof(Node));
13769 }
13770 list->CurrentList->start = start;
13771 list->CurrentList->count = list->CurrentPos;
13772
13773 memcpy(&ctx->Shared->small_dlist_store.ptr[start],
13774 list->CurrentBlock,
13775 list->CurrentList->count * sizeof(Node));
13776
13777 assert (ctx->Shared->small_dlist_store.ptr[start + list->CurrentList->count - 1].opcode == OPCODE_END_OF_LIST);
13778
13779 /* If the first opcode is a NOP, adjust start */
13780 if (ctx->Shared->small_dlist_store.ptr[start].opcode == OPCODE_NOP) {
13781 list->CurrentList->start++;
13782 list->CurrentList->begins_with_a_nop = true;
13783 } else {
13784 list->CurrentList->begins_with_a_nop = false;
13785 }
13786
13787 free(list->CurrentBlock);
13788 } else {
13789 /* Keep the mallocated storage */
13790 list->CurrentList->small_list = false;
13791 list->CurrentList->begins_with_a_nop = false;
13792 }
13793
13794 _mesa_HashUnlockMutex(ctx->Shared->DisplayList);
13795
13796 /* Destroy old list, if any */
13797 destroy_list(ctx, ctx->ListState.CurrentList->Name);
13798
13799 /* Install the new list */
13800 _mesa_HashInsertLocked(ctx->Shared->DisplayList,
13801 ctx->ListState.CurrentList->Name,
13802 ctx->ListState.CurrentList, true);
13803
13804
13805 if (MESA_VERBOSE & VERBOSE_DISPLAY_LIST)
13806 mesa_print_display_list(ctx->ListState.CurrentList->Name);
13807
13808 ctx->ListState.CurrentList = NULL;
13809 ctx->ListState.CurrentBlock = NULL;
13810 ctx->ListState.CurrentPos = 0;
13811 ctx->ExecuteFlag = GL_TRUE;
13812 ctx->CompileFlag = GL_FALSE;
13813
13814 ctx->CurrentServerDispatch = ctx->Exec;
13815 _glapi_set_dispatch(ctx->CurrentServerDispatch);
13816 if (ctx->MarshalExec == NULL) {
13817 ctx->CurrentClientDispatch = ctx->CurrentServerDispatch;
13818 }
13819 }
13820
13821
13822 void GLAPIENTRY
_mesa_CallList(GLuint list)13823 _mesa_CallList(GLuint list)
13824 {
13825 GLboolean save_compile_flag;
13826 GET_CURRENT_CONTEXT(ctx);
13827 FLUSH_CURRENT(ctx, 0);
13828
13829 if (MESA_VERBOSE & VERBOSE_API)
13830 _mesa_debug(ctx, "glCallList %d\n", list);
13831
13832 if (list == 0) {
13833 _mesa_error(ctx, GL_INVALID_VALUE, "glCallList(list==0)");
13834 return;
13835 }
13836
13837 if (0)
13838 mesa_print_display_list( list );
13839
13840 /* Save the CompileFlag status, turn it off, execute the display list,
13841 * and restore the CompileFlag. This is needed for GL_COMPILE_AND_EXECUTE
13842 * because the call is already recorded and we just need to execute it.
13843 */
13844 save_compile_flag = ctx->CompileFlag;
13845 if (save_compile_flag) {
13846 ctx->CompileFlag = GL_FALSE;
13847 }
13848
13849 _mesa_HashLockMutex(ctx->Shared->DisplayList);
13850 execute_list(ctx, list);
13851 _mesa_HashUnlockMutex(ctx->Shared->DisplayList);
13852 ctx->CompileFlag = save_compile_flag;
13853
13854 /* also restore API function pointers to point to "save" versions */
13855 if (save_compile_flag) {
13856 ctx->CurrentServerDispatch = ctx->Save;
13857 _glapi_set_dispatch(ctx->CurrentServerDispatch);
13858 if (ctx->MarshalExec == NULL) {
13859 ctx->CurrentClientDispatch = ctx->CurrentServerDispatch;
13860 }
13861 }
13862 }
13863
13864
13865 /**
13866 * Try to execute a glCallLists() command where the display lists contain
13867 * glBitmap commands with a texture atlas.
13868 * \return true for success, false otherwise
13869 */
13870 static bool
render_bitmap_atlas(struct gl_context * ctx,GLsizei n,GLenum type,const void * lists)13871 render_bitmap_atlas(struct gl_context *ctx, GLsizei n, GLenum type,
13872 const void *lists)
13873 {
13874 struct gl_bitmap_atlas *atlas;
13875 int i;
13876
13877 if (!USE_BITMAP_ATLAS ||
13878 !ctx->Current.RasterPosValid ||
13879 ctx->List.ListBase == 0 ||
13880 type != GL_UNSIGNED_BYTE ||
13881 !ctx->Driver.DrawAtlasBitmaps) {
13882 /* unsupported */
13883 return false;
13884 }
13885
13886 atlas = lookup_bitmap_atlas(ctx, ctx->List.ListBase);
13887
13888 if (!atlas) {
13889 /* Even if glGenLists wasn't called, we can still try to create
13890 * the atlas now.
13891 */
13892 atlas = alloc_bitmap_atlas(ctx, ctx->List.ListBase, false);
13893 }
13894
13895 if (atlas && !atlas->complete && !atlas->incomplete) {
13896 /* Try to build the bitmap atlas now.
13897 * If the atlas was created in glGenLists, we'll have recorded the
13898 * number of lists (bitmaps). Otherwise, take a guess at 256.
13899 */
13900 if (atlas->numBitmaps == 0)
13901 atlas->numBitmaps = 256;
13902 build_bitmap_atlas(ctx, atlas, ctx->List.ListBase);
13903 }
13904
13905 if (!atlas || !atlas->complete) {
13906 return false;
13907 }
13908
13909 /* check that all display list IDs are in the atlas */
13910 for (i = 0; i < n; i++) {
13911 const GLubyte *ids = (const GLubyte *) lists;
13912
13913 if (ids[i] >= atlas->numBitmaps) {
13914 return false;
13915 }
13916 }
13917
13918 ctx->Driver.DrawAtlasBitmaps(ctx, atlas, n, (const GLubyte *) lists);
13919
13920 return true;
13921 }
13922
13923
13924 /**
13925 * Execute glCallLists: call multiple display lists.
13926 */
13927 void GLAPIENTRY
_mesa_CallLists(GLsizei n,GLenum type,const GLvoid * lists)13928 _mesa_CallLists(GLsizei n, GLenum type, const GLvoid * lists)
13929 {
13930 GET_CURRENT_CONTEXT(ctx);
13931 GLboolean save_compile_flag;
13932
13933 if (MESA_VERBOSE & VERBOSE_API)
13934 _mesa_debug(ctx, "glCallLists %d\n", n);
13935
13936 if (type < GL_BYTE || type > GL_4_BYTES) {
13937 _mesa_error(ctx, GL_INVALID_ENUM, "glCallLists(type)");
13938 return;
13939 }
13940
13941 if (n < 0) {
13942 _mesa_error(ctx, GL_INVALID_VALUE, "glCallLists(n < 0)");
13943 return;
13944 } else if (n == 0 || lists == NULL) {
13945 /* nothing to do */
13946 return;
13947 }
13948
13949 if (render_bitmap_atlas(ctx, n, type, lists)) {
13950 return;
13951 }
13952
13953 /* Save the CompileFlag status, turn it off, execute the display lists,
13954 * and restore the CompileFlag. This is needed for GL_COMPILE_AND_EXECUTE
13955 * because the call is already recorded and we just need to execute it.
13956 */
13957 save_compile_flag = ctx->CompileFlag;
13958 ctx->CompileFlag = GL_FALSE;
13959
13960 GLbyte *bptr;
13961 GLubyte *ubptr;
13962 GLshort *sptr;
13963 GLushort *usptr;
13964 GLint *iptr;
13965 GLuint *uiptr;
13966 GLfloat *fptr;
13967
13968 GLuint base = ctx->List.ListBase;
13969
13970 _mesa_HashLockMutex(ctx->Shared->DisplayList);
13971
13972 /* A loop inside a switch is faster than a switch inside a loop. */
13973 switch (type) {
13974 case GL_BYTE:
13975 bptr = (GLbyte *) lists;
13976 for (unsigned i = 0; i < n; i++)
13977 execute_list(ctx, base + (int)bptr[i]);
13978 break;
13979 case GL_UNSIGNED_BYTE:
13980 ubptr = (GLubyte *) lists;
13981 for (unsigned i = 0; i < n; i++)
13982 execute_list(ctx, base + (int)ubptr[i]);
13983 break;
13984 case GL_SHORT:
13985 sptr = (GLshort *) lists;
13986 for (unsigned i = 0; i < n; i++)
13987 execute_list(ctx, base + (int)sptr[i]);
13988 break;
13989 case GL_UNSIGNED_SHORT:
13990 usptr = (GLushort *) lists;
13991 for (unsigned i = 0; i < n; i++)
13992 execute_list(ctx, base + (int)usptr[i]);
13993 break;
13994 case GL_INT:
13995 iptr = (GLint *) lists;
13996 for (unsigned i = 0; i < n; i++)
13997 execute_list(ctx, base + (int)iptr[i]);
13998 break;
13999 case GL_UNSIGNED_INT:
14000 uiptr = (GLuint *) lists;
14001 for (unsigned i = 0; i < n; i++)
14002 execute_list(ctx, base + (int)uiptr[i]);
14003 break;
14004 case GL_FLOAT:
14005 fptr = (GLfloat *) lists;
14006 for (unsigned i = 0; i < n; i++)
14007 execute_list(ctx, base + (int)fptr[i]);
14008 break;
14009 case GL_2_BYTES:
14010 ubptr = (GLubyte *) lists;
14011 for (unsigned i = 0; i < n; i++) {
14012 execute_list(ctx, base +
14013 (int)ubptr[2 * i] * 256 +
14014 (int)ubptr[2 * i + 1]);
14015 }
14016 break;
14017 case GL_3_BYTES:
14018 ubptr = (GLubyte *) lists;
14019 for (unsigned i = 0; i < n; i++) {
14020 execute_list(ctx, base +
14021 (int)ubptr[3 * i] * 65536 +
14022 (int)ubptr[3 * i + 1] * 256 +
14023 (int)ubptr[3 * i + 2]);
14024 }
14025 break;
14026 case GL_4_BYTES:
14027 ubptr = (GLubyte *) lists;
14028 for (unsigned i = 0; i < n; i++) {
14029 execute_list(ctx, base +
14030 (int)ubptr[4 * i] * 16777216 +
14031 (int)ubptr[4 * i + 1] * 65536 +
14032 (int)ubptr[4 * i + 2] * 256 +
14033 (int)ubptr[4 * i + 3]);
14034 }
14035 break;
14036 }
14037
14038 _mesa_HashUnlockMutex(ctx->Shared->DisplayList);
14039 ctx->CompileFlag = save_compile_flag;
14040
14041 /* also restore API function pointers to point to "save" versions */
14042 if (save_compile_flag) {
14043 ctx->CurrentServerDispatch = ctx->Save;
14044 _glapi_set_dispatch(ctx->CurrentServerDispatch);
14045 if (ctx->MarshalExec == NULL) {
14046 ctx->CurrentClientDispatch = ctx->CurrentServerDispatch;
14047 }
14048 }
14049 }
14050
14051
14052 /**
14053 * Set the offset added to list numbers in glCallLists.
14054 */
14055 void GLAPIENTRY
_mesa_ListBase(GLuint base)14056 _mesa_ListBase(GLuint base)
14057 {
14058 GET_CURRENT_CONTEXT(ctx);
14059 FLUSH_VERTICES(ctx, 0, GL_LIST_BIT); /* must be called before assert */
14060 ASSERT_OUTSIDE_BEGIN_END(ctx);
14061 ctx->List.ListBase = base;
14062 }
14063
14064 /**
14065 * Setup the given dispatch table to point to Mesa's display list
14066 * building functions.
14067 *
14068 * This does not include any of the tnl functions - they are
14069 * initialized from _mesa_init_api_defaults and from the active vtxfmt
14070 * struct.
14071 */
14072 void
_mesa_initialize_save_table(const struct gl_context * ctx)14073 _mesa_initialize_save_table(const struct gl_context *ctx)
14074 {
14075 struct _glapi_table *table = ctx->Save;
14076 int numEntries = MAX2(_gloffset_COUNT, _glapi_get_dispatch_table_size());
14077
14078 /* Initially populate the dispatch table with the contents of the
14079 * normal-execution dispatch table. This lets us skip populating functions
14080 * that should be called directly instead of compiled into display lists.
14081 */
14082 memcpy(table, ctx->Exec, numEntries * sizeof(_glapi_proc));
14083
14084 /* VBO functions */
14085 vbo_initialize_save_dispatch(ctx, table);
14086
14087 /* GL 1.0 */
14088 SET_Accum(table, save_Accum);
14089 SET_AlphaFunc(table, save_AlphaFunc);
14090 SET_Bitmap(table, save_Bitmap);
14091 SET_BlendFunc(table, save_BlendFunc);
14092 SET_CallList(table, save_CallList);
14093 SET_CallLists(table, save_CallLists);
14094 SET_Clear(table, save_Clear);
14095 SET_ClearAccum(table, save_ClearAccum);
14096 SET_ClearColor(table, save_ClearColor);
14097 SET_ClearDepth(table, save_ClearDepth);
14098 SET_ClearIndex(table, save_ClearIndex);
14099 SET_ClearStencil(table, save_ClearStencil);
14100 SET_ClipPlane(table, save_ClipPlane);
14101 SET_ColorMask(table, save_ColorMask);
14102 SET_ColorMaski(table, save_ColorMaskIndexed);
14103 SET_ColorMaterial(table, save_ColorMaterial);
14104 SET_CopyPixels(table, save_CopyPixels);
14105 SET_CullFace(table, save_CullFace);
14106 SET_DepthFunc(table, save_DepthFunc);
14107 SET_DepthMask(table, save_DepthMask);
14108 SET_DepthRange(table, save_DepthRange);
14109 SET_Disable(table, save_Disable);
14110 SET_Disablei(table, save_DisableIndexed);
14111 SET_DrawBuffer(table, save_DrawBuffer);
14112 SET_DrawPixels(table, save_DrawPixels);
14113 SET_Enable(table, save_Enable);
14114 SET_Enablei(table, save_EnableIndexed);
14115 SET_EvalMesh1(table, save_EvalMesh1);
14116 SET_EvalMesh2(table, save_EvalMesh2);
14117 SET_Fogf(table, save_Fogf);
14118 SET_Fogfv(table, save_Fogfv);
14119 SET_Fogi(table, save_Fogi);
14120 SET_Fogiv(table, save_Fogiv);
14121 SET_FrontFace(table, save_FrontFace);
14122 SET_Frustum(table, save_Frustum);
14123 SET_Hint(table, save_Hint);
14124 SET_IndexMask(table, save_IndexMask);
14125 SET_InitNames(table, save_InitNames);
14126 SET_LightModelf(table, save_LightModelf);
14127 SET_LightModelfv(table, save_LightModelfv);
14128 SET_LightModeli(table, save_LightModeli);
14129 SET_LightModeliv(table, save_LightModeliv);
14130 SET_Lightf(table, save_Lightf);
14131 SET_Lightfv(table, save_Lightfv);
14132 SET_Lighti(table, save_Lighti);
14133 SET_Lightiv(table, save_Lightiv);
14134 SET_LineStipple(table, save_LineStipple);
14135 SET_LineWidth(table, save_LineWidth);
14136 SET_ListBase(table, save_ListBase);
14137 SET_LoadIdentity(table, save_LoadIdentity);
14138 SET_LoadMatrixd(table, save_LoadMatrixd);
14139 SET_LoadMatrixf(table, save_LoadMatrixf);
14140 SET_LoadName(table, save_LoadName);
14141 SET_LogicOp(table, save_LogicOp);
14142 SET_Map1d(table, save_Map1d);
14143 SET_Map1f(table, save_Map1f);
14144 SET_Map2d(table, save_Map2d);
14145 SET_Map2f(table, save_Map2f);
14146 SET_MapGrid1d(table, save_MapGrid1d);
14147 SET_MapGrid1f(table, save_MapGrid1f);
14148 SET_MapGrid2d(table, save_MapGrid2d);
14149 SET_MapGrid2f(table, save_MapGrid2f);
14150 SET_MatrixMode(table, save_MatrixMode);
14151 SET_MultMatrixd(table, save_MultMatrixd);
14152 SET_MultMatrixf(table, save_MultMatrixf);
14153 SET_NewList(table, save_NewList);
14154 SET_Ortho(table, save_Ortho);
14155 SET_PassThrough(table, save_PassThrough);
14156 SET_PixelMapfv(table, save_PixelMapfv);
14157 SET_PixelMapuiv(table, save_PixelMapuiv);
14158 SET_PixelMapusv(table, save_PixelMapusv);
14159 SET_PixelTransferf(table, save_PixelTransferf);
14160 SET_PixelTransferi(table, save_PixelTransferi);
14161 SET_PixelZoom(table, save_PixelZoom);
14162 SET_PointSize(table, save_PointSize);
14163 SET_PolygonMode(table, save_PolygonMode);
14164 SET_PolygonOffset(table, save_PolygonOffset);
14165 SET_PolygonStipple(table, save_PolygonStipple);
14166 SET_PopAttrib(table, save_PopAttrib);
14167 SET_PopMatrix(table, save_PopMatrix);
14168 SET_PopName(table, save_PopName);
14169 SET_PushAttrib(table, save_PushAttrib);
14170 SET_PushMatrix(table, save_PushMatrix);
14171 SET_PushName(table, save_PushName);
14172 SET_RasterPos2d(table, save_RasterPos2d);
14173 SET_RasterPos2dv(table, save_RasterPos2dv);
14174 SET_RasterPos2f(table, save_RasterPos2f);
14175 SET_RasterPos2fv(table, save_RasterPos2fv);
14176 SET_RasterPos2i(table, save_RasterPos2i);
14177 SET_RasterPos2iv(table, save_RasterPos2iv);
14178 SET_RasterPos2s(table, save_RasterPos2s);
14179 SET_RasterPos2sv(table, save_RasterPos2sv);
14180 SET_RasterPos3d(table, save_RasterPos3d);
14181 SET_RasterPos3dv(table, save_RasterPos3dv);
14182 SET_RasterPos3f(table, save_RasterPos3f);
14183 SET_RasterPos3fv(table, save_RasterPos3fv);
14184 SET_RasterPos3i(table, save_RasterPos3i);
14185 SET_RasterPos3iv(table, save_RasterPos3iv);
14186 SET_RasterPos3s(table, save_RasterPos3s);
14187 SET_RasterPos3sv(table, save_RasterPos3sv);
14188 SET_RasterPos4d(table, save_RasterPos4d);
14189 SET_RasterPos4dv(table, save_RasterPos4dv);
14190 SET_RasterPos4f(table, save_RasterPos4f);
14191 SET_RasterPos4fv(table, save_RasterPos4fv);
14192 SET_RasterPos4i(table, save_RasterPos4i);
14193 SET_RasterPos4iv(table, save_RasterPos4iv);
14194 SET_RasterPos4s(table, save_RasterPos4s);
14195 SET_RasterPos4sv(table, save_RasterPos4sv);
14196 SET_ReadBuffer(table, save_ReadBuffer);
14197 SET_Rotated(table, save_Rotated);
14198 SET_Rotatef(table, save_Rotatef);
14199 SET_Scaled(table, save_Scaled);
14200 SET_Scalef(table, save_Scalef);
14201 SET_Scissor(table, save_Scissor);
14202 SET_ShadeModel(table, save_ShadeModel);
14203 SET_StencilFunc(table, save_StencilFunc);
14204 SET_StencilMask(table, save_StencilMask);
14205 SET_StencilOp(table, save_StencilOp);
14206 SET_TexEnvf(table, save_TexEnvf);
14207 SET_TexEnvfv(table, save_TexEnvfv);
14208 SET_TexEnvi(table, save_TexEnvi);
14209 SET_TexEnviv(table, save_TexEnviv);
14210 SET_TexGend(table, save_TexGend);
14211 SET_TexGendv(table, save_TexGendv);
14212 SET_TexGenf(table, save_TexGenf);
14213 SET_TexGenfv(table, save_TexGenfv);
14214 SET_TexGeni(table, save_TexGeni);
14215 SET_TexGeniv(table, save_TexGeniv);
14216 SET_TexImage1D(table, save_TexImage1D);
14217 SET_TexImage2D(table, save_TexImage2D);
14218 SET_TexParameterf(table, save_TexParameterf);
14219 SET_TexParameterfv(table, save_TexParameterfv);
14220 SET_TexParameteri(table, save_TexParameteri);
14221 SET_TexParameteriv(table, save_TexParameteriv);
14222 SET_Translated(table, save_Translated);
14223 SET_Translatef(table, save_Translatef);
14224 SET_Viewport(table, save_Viewport);
14225
14226 /* GL 1.1 */
14227 SET_BindTexture(table, save_BindTexture);
14228 SET_CopyTexImage1D(table, save_CopyTexImage1D);
14229 SET_CopyTexImage2D(table, save_CopyTexImage2D);
14230 SET_CopyTexSubImage1D(table, save_CopyTexSubImage1D);
14231 SET_CopyTexSubImage2D(table, save_CopyTexSubImage2D);
14232 SET_PrioritizeTextures(table, save_PrioritizeTextures);
14233 SET_TexSubImage1D(table, save_TexSubImage1D);
14234 SET_TexSubImage2D(table, save_TexSubImage2D);
14235
14236 /* GL 1.2 */
14237 SET_CopyTexSubImage3D(table, save_CopyTexSubImage3D);
14238 SET_TexImage3D(table, save_TexImage3D);
14239 SET_TexSubImage3D(table, save_TexSubImage3D);
14240
14241 /* GL 2.0 */
14242 SET_StencilFuncSeparate(table, save_StencilFuncSeparate);
14243 SET_StencilMaskSeparate(table, save_StencilMaskSeparate);
14244 SET_StencilOpSeparate(table, save_StencilOpSeparate);
14245
14246 /* ATI_separate_stencil */
14247 SET_StencilFuncSeparateATI(table, save_StencilFuncSeparateATI);
14248
14249 /* GL_ARB_imaging */
14250 /* Not all are supported */
14251 SET_BlendColor(table, save_BlendColor);
14252 SET_BlendEquation(table, save_BlendEquation);
14253
14254 /* 2. GL_EXT_blend_color */
14255 #if 0
14256 SET_BlendColorEXT(table, save_BlendColorEXT);
14257 #endif
14258
14259 /* 6. GL_EXT_texture3d */
14260 #if 0
14261 SET_CopyTexSubImage3DEXT(table, save_CopyTexSubImage3D);
14262 SET_TexImage3DEXT(table, save_TexImage3DEXT);
14263 SET_TexSubImage3DEXT(table, save_TexSubImage3D);
14264 #endif
14265
14266 /* 37. GL_EXT_blend_minmax */
14267 #if 0
14268 SET_BlendEquationEXT(table, save_BlendEquationEXT);
14269 #endif
14270
14271 /* 54. GL_EXT_point_parameters */
14272 SET_PointParameterf(table, save_PointParameterfEXT);
14273 SET_PointParameterfv(table, save_PointParameterfvEXT);
14274
14275 /* 91. GL_ARB_tessellation_shader */
14276 SET_PatchParameteri(table, save_PatchParameteri);
14277 SET_PatchParameterfv(table, save_PatchParameterfv);
14278
14279 /* 100. ARB_viewport_array */
14280 SET_ViewportArrayv(table, save_ViewportArrayv);
14281 SET_ViewportIndexedf(table, save_ViewportIndexedf);
14282 SET_ViewportIndexedfv(table, save_ViewportIndexedfv);
14283 SET_ScissorArrayv(table, save_ScissorArrayv);
14284 SET_ScissorIndexed(table, save_ScissorIndexed);
14285 SET_ScissorIndexedv(table, save_ScissorIndexedv);
14286 SET_DepthRangeArrayv(table, save_DepthRangeArrayv);
14287 SET_DepthRangeIndexed(table, save_DepthRangeIndexed);
14288
14289 /* 122. ARB_compute_shader */
14290 SET_DispatchCompute(table, save_DispatchCompute);
14291 SET_DispatchComputeIndirect(table, save_DispatchComputeIndirect);
14292
14293 /* 173. GL_EXT_blend_func_separate */
14294 SET_BlendFuncSeparate(table, save_BlendFuncSeparateEXT);
14295
14296 /* 197. GL_MESA_window_pos */
14297 SET_WindowPos2d(table, save_WindowPos2dMESA);
14298 SET_WindowPos2dv(table, save_WindowPos2dvMESA);
14299 SET_WindowPos2f(table, save_WindowPos2fMESA);
14300 SET_WindowPos2fv(table, save_WindowPos2fvMESA);
14301 SET_WindowPos2i(table, save_WindowPos2iMESA);
14302 SET_WindowPos2iv(table, save_WindowPos2ivMESA);
14303 SET_WindowPos2s(table, save_WindowPos2sMESA);
14304 SET_WindowPos2sv(table, save_WindowPos2svMESA);
14305 SET_WindowPos3d(table, save_WindowPos3dMESA);
14306 SET_WindowPos3dv(table, save_WindowPos3dvMESA);
14307 SET_WindowPos3f(table, save_WindowPos3fMESA);
14308 SET_WindowPos3fv(table, save_WindowPos3fvMESA);
14309 SET_WindowPos3i(table, save_WindowPos3iMESA);
14310 SET_WindowPos3iv(table, save_WindowPos3ivMESA);
14311 SET_WindowPos3s(table, save_WindowPos3sMESA);
14312 SET_WindowPos3sv(table, save_WindowPos3svMESA);
14313 SET_WindowPos4dMESA(table, save_WindowPos4dMESA);
14314 SET_WindowPos4dvMESA(table, save_WindowPos4dvMESA);
14315 SET_WindowPos4fMESA(table, save_WindowPos4fMESA);
14316 SET_WindowPos4fvMESA(table, save_WindowPos4fvMESA);
14317 SET_WindowPos4iMESA(table, save_WindowPos4iMESA);
14318 SET_WindowPos4ivMESA(table, save_WindowPos4ivMESA);
14319 SET_WindowPos4sMESA(table, save_WindowPos4sMESA);
14320 SET_WindowPos4svMESA(table, save_WindowPos4svMESA);
14321
14322 /* 245. GL_ATI_fragment_shader */
14323 SET_BindFragmentShaderATI(table, save_BindFragmentShaderATI);
14324 SET_SetFragmentShaderConstantATI(table, save_SetFragmentShaderConstantATI);
14325
14326 /* 262. GL_ARB_point_sprite */
14327 SET_PointParameteri(table, save_PointParameteri);
14328 SET_PointParameteriv(table, save_PointParameteriv);
14329
14330 /* 268. GL_EXT_stencil_two_side */
14331 SET_ActiveStencilFaceEXT(table, save_ActiveStencilFaceEXT);
14332
14333 /* ???. GL_EXT_depth_bounds_test */
14334 SET_DepthBoundsEXT(table, save_DepthBoundsEXT);
14335
14336 /* ARB 1. GL_ARB_multitexture */
14337 SET_ActiveTexture(table, save_ActiveTextureARB);
14338
14339 /* ARB 3. GL_ARB_transpose_matrix */
14340 SET_LoadTransposeMatrixd(table, save_LoadTransposeMatrixdARB);
14341 SET_LoadTransposeMatrixf(table, save_LoadTransposeMatrixfARB);
14342 SET_MultTransposeMatrixd(table, save_MultTransposeMatrixdARB);
14343 SET_MultTransposeMatrixf(table, save_MultTransposeMatrixfARB);
14344
14345 /* ARB 5. GL_ARB_multisample */
14346 SET_SampleCoverage(table, save_SampleCoverageARB);
14347
14348 /* ARB 12. GL_ARB_texture_compression */
14349 SET_CompressedTexImage3D(table, save_CompressedTexImage3DARB);
14350 SET_CompressedTexImage2D(table, save_CompressedTexImage2DARB);
14351 SET_CompressedTexImage1D(table, save_CompressedTexImage1DARB);
14352 SET_CompressedTexSubImage3D(table, save_CompressedTexSubImage3DARB);
14353 SET_CompressedTexSubImage2D(table, save_CompressedTexSubImage2DARB);
14354 SET_CompressedTexSubImage1D(table, save_CompressedTexSubImage1DARB);
14355
14356 /* ARB 14. GL_ARB_point_parameters */
14357 /* aliased with EXT_point_parameters functions */
14358
14359 /* ARB 25. GL_ARB_window_pos */
14360 /* aliased with MESA_window_pos functions */
14361
14362 /* ARB 26. GL_ARB_vertex_program */
14363 /* ARB 27. GL_ARB_fragment_program */
14364 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
14365 SET_ProgramStringARB(table, save_ProgramStringARB);
14366 SET_BindProgramARB(table, save_BindProgramARB);
14367 SET_ProgramEnvParameter4dARB(table, save_ProgramEnvParameter4dARB);
14368 SET_ProgramEnvParameter4dvARB(table, save_ProgramEnvParameter4dvARB);
14369 SET_ProgramEnvParameter4fARB(table, save_ProgramEnvParameter4fARB);
14370 SET_ProgramEnvParameter4fvARB(table, save_ProgramEnvParameter4fvARB);
14371 SET_ProgramLocalParameter4dARB(table, save_ProgramLocalParameter4dARB);
14372 SET_ProgramLocalParameter4dvARB(table, save_ProgramLocalParameter4dvARB);
14373 SET_ProgramLocalParameter4fARB(table, save_ProgramLocalParameter4fARB);
14374 SET_ProgramLocalParameter4fvARB(table, save_ProgramLocalParameter4fvARB);
14375
14376 SET_BeginQuery(table, save_BeginQueryARB);
14377 SET_EndQuery(table, save_EndQueryARB);
14378 SET_QueryCounter(table, save_QueryCounter);
14379
14380 SET_DrawBuffers(table, save_DrawBuffersARB);
14381
14382 SET_BlitFramebuffer(table, save_BlitFramebufferEXT);
14383
14384 SET_UseProgram(table, save_UseProgram);
14385 SET_Uniform1f(table, save_Uniform1fARB);
14386 SET_Uniform2f(table, save_Uniform2fARB);
14387 SET_Uniform3f(table, save_Uniform3fARB);
14388 SET_Uniform4f(table, save_Uniform4fARB);
14389 SET_Uniform1fv(table, save_Uniform1fvARB);
14390 SET_Uniform2fv(table, save_Uniform2fvARB);
14391 SET_Uniform3fv(table, save_Uniform3fvARB);
14392 SET_Uniform4fv(table, save_Uniform4fvARB);
14393 SET_Uniform1i(table, save_Uniform1iARB);
14394 SET_Uniform2i(table, save_Uniform2iARB);
14395 SET_Uniform3i(table, save_Uniform3iARB);
14396 SET_Uniform4i(table, save_Uniform4iARB);
14397 SET_Uniform1iv(table, save_Uniform1ivARB);
14398 SET_Uniform2iv(table, save_Uniform2ivARB);
14399 SET_Uniform3iv(table, save_Uniform3ivARB);
14400 SET_Uniform4iv(table, save_Uniform4ivARB);
14401 SET_UniformMatrix2fv(table, save_UniformMatrix2fvARB);
14402 SET_UniformMatrix3fv(table, save_UniformMatrix3fvARB);
14403 SET_UniformMatrix4fv(table, save_UniformMatrix4fvARB);
14404 SET_UniformMatrix2x3fv(table, save_UniformMatrix2x3fv);
14405 SET_UniformMatrix3x2fv(table, save_UniformMatrix3x2fv);
14406 SET_UniformMatrix2x4fv(table, save_UniformMatrix2x4fv);
14407 SET_UniformMatrix4x2fv(table, save_UniformMatrix4x2fv);
14408 SET_UniformMatrix3x4fv(table, save_UniformMatrix3x4fv);
14409 SET_UniformMatrix4x3fv(table, save_UniformMatrix4x3fv);
14410
14411 /* 299. GL_EXT_blend_equation_separate */
14412 SET_BlendEquationSeparate(table, save_BlendEquationSeparateEXT);
14413
14414 /* GL_EXT_gpu_program_parameters */
14415 SET_ProgramEnvParameters4fvEXT(table, save_ProgramEnvParameters4fvEXT);
14416 SET_ProgramLocalParameters4fvEXT(table, save_ProgramLocalParameters4fvEXT);
14417
14418 /* 364. GL_EXT_provoking_vertex */
14419 SET_ProvokingVertex(table, save_ProvokingVertexEXT);
14420
14421 /* GL_EXT_texture_integer */
14422 SET_ClearColorIiEXT(table, save_ClearColorIi);
14423 SET_ClearColorIuiEXT(table, save_ClearColorIui);
14424 SET_TexParameterIiv(table, save_TexParameterIiv);
14425 SET_TexParameterIuiv(table, save_TexParameterIuiv);
14426
14427 /* GL_ARB_clip_control */
14428 SET_ClipControl(table, save_ClipControl);
14429
14430 /* GL_ARB_color_buffer_float */
14431 SET_ClampColor(table, save_ClampColorARB);
14432
14433 /* GL 3.0 */
14434 SET_ClearBufferiv(table, save_ClearBufferiv);
14435 SET_ClearBufferuiv(table, save_ClearBufferuiv);
14436 SET_ClearBufferfv(table, save_ClearBufferfv);
14437 SET_ClearBufferfi(table, save_ClearBufferfi);
14438 SET_Uniform1ui(table, save_Uniform1ui);
14439 SET_Uniform2ui(table, save_Uniform2ui);
14440 SET_Uniform3ui(table, save_Uniform3ui);
14441 SET_Uniform4ui(table, save_Uniform4ui);
14442 SET_Uniform1uiv(table, save_Uniform1uiv);
14443 SET_Uniform2uiv(table, save_Uniform2uiv);
14444 SET_Uniform3uiv(table, save_Uniform3uiv);
14445 SET_Uniform4uiv(table, save_Uniform4uiv);
14446
14447 /* GL_ARB_gpu_shader_fp64 */
14448 SET_Uniform1d(table, save_Uniform1d);
14449 SET_Uniform2d(table, save_Uniform2d);
14450 SET_Uniform3d(table, save_Uniform3d);
14451 SET_Uniform4d(table, save_Uniform4d);
14452 SET_Uniform1dv(table, save_Uniform1dv);
14453 SET_Uniform2dv(table, save_Uniform2dv);
14454 SET_Uniform3dv(table, save_Uniform3dv);
14455 SET_Uniform4dv(table, save_Uniform4dv);
14456 SET_UniformMatrix2dv(table, save_UniformMatrix2dv);
14457 SET_UniformMatrix3dv(table, save_UniformMatrix3dv);
14458 SET_UniformMatrix4dv(table, save_UniformMatrix4dv);
14459 SET_UniformMatrix2x3dv(table, save_UniformMatrix2x3dv);
14460 SET_UniformMatrix3x2dv(table, save_UniformMatrix3x2dv);
14461 SET_UniformMatrix2x4dv(table, save_UniformMatrix2x4dv);
14462 SET_UniformMatrix4x2dv(table, save_UniformMatrix4x2dv);
14463 SET_UniformMatrix3x4dv(table, save_UniformMatrix3x4dv);
14464 SET_UniformMatrix4x3dv(table, save_UniformMatrix4x3dv);
14465
14466 /* GL_ARB_gpu_shader_int64 */
14467 SET_Uniform1i64ARB(table, save_Uniform1i64ARB);
14468 SET_Uniform2i64ARB(table, save_Uniform2i64ARB);
14469 SET_Uniform3i64ARB(table, save_Uniform3i64ARB);
14470 SET_Uniform4i64ARB(table, save_Uniform4i64ARB);
14471 SET_Uniform1i64vARB(table, save_Uniform1i64vARB);
14472 SET_Uniform2i64vARB(table, save_Uniform2i64vARB);
14473 SET_Uniform3i64vARB(table, save_Uniform3i64vARB);
14474 SET_Uniform4i64vARB(table, save_Uniform4i64vARB);
14475 SET_Uniform1ui64ARB(table, save_Uniform1ui64ARB);
14476 SET_Uniform2ui64ARB(table, save_Uniform2ui64ARB);
14477 SET_Uniform3ui64ARB(table, save_Uniform3ui64ARB);
14478 SET_Uniform4ui64ARB(table, save_Uniform4ui64ARB);
14479 SET_Uniform1ui64vARB(table, save_Uniform1ui64vARB);
14480 SET_Uniform2ui64vARB(table, save_Uniform2ui64vARB);
14481 SET_Uniform3ui64vARB(table, save_Uniform3ui64vARB);
14482 SET_Uniform4ui64vARB(table, save_Uniform4ui64vARB);
14483
14484 SET_ProgramUniform1i64ARB(table, save_ProgramUniform1i64ARB);
14485 SET_ProgramUniform2i64ARB(table, save_ProgramUniform2i64ARB);
14486 SET_ProgramUniform3i64ARB(table, save_ProgramUniform3i64ARB);
14487 SET_ProgramUniform4i64ARB(table, save_ProgramUniform4i64ARB);
14488 SET_ProgramUniform1i64vARB(table, save_ProgramUniform1i64vARB);
14489 SET_ProgramUniform2i64vARB(table, save_ProgramUniform2i64vARB);
14490 SET_ProgramUniform3i64vARB(table, save_ProgramUniform3i64vARB);
14491 SET_ProgramUniform4i64vARB(table, save_ProgramUniform4i64vARB);
14492 SET_ProgramUniform1ui64ARB(table, save_ProgramUniform1ui64ARB);
14493 SET_ProgramUniform2ui64ARB(table, save_ProgramUniform2ui64ARB);
14494 SET_ProgramUniform3ui64ARB(table, save_ProgramUniform3ui64ARB);
14495 SET_ProgramUniform4ui64ARB(table, save_ProgramUniform4ui64ARB);
14496 SET_ProgramUniform1ui64vARB(table, save_ProgramUniform1ui64vARB);
14497 SET_ProgramUniform2ui64vARB(table, save_ProgramUniform2ui64vARB);
14498 SET_ProgramUniform3ui64vARB(table, save_ProgramUniform3ui64vARB);
14499 SET_ProgramUniform4ui64vARB(table, save_ProgramUniform4ui64vARB);
14500
14501 /* These are: */
14502 SET_BeginTransformFeedback(table, save_BeginTransformFeedback);
14503 SET_EndTransformFeedback(table, save_EndTransformFeedback);
14504 SET_BindTransformFeedback(table, save_BindTransformFeedback);
14505 SET_PauseTransformFeedback(table, save_PauseTransformFeedback);
14506 SET_ResumeTransformFeedback(table, save_ResumeTransformFeedback);
14507 SET_DrawTransformFeedback(table, save_DrawTransformFeedback);
14508 SET_DrawTransformFeedbackStream(table, save_DrawTransformFeedbackStream);
14509 SET_DrawTransformFeedbackInstanced(table,
14510 save_DrawTransformFeedbackInstanced);
14511 SET_DrawTransformFeedbackStreamInstanced(table,
14512 save_DrawTransformFeedbackStreamInstanced);
14513 SET_BeginQueryIndexed(table, save_BeginQueryIndexed);
14514 SET_EndQueryIndexed(table, save_EndQueryIndexed);
14515
14516 /* GL_ARB_instanced_arrays */
14517 SET_VertexAttribDivisor(table, save_VertexAttribDivisor);
14518
14519 /* GL_NV_texture_barrier */
14520 SET_TextureBarrierNV(table, save_TextureBarrierNV);
14521
14522 SET_BindSampler(table, save_BindSampler);
14523 SET_SamplerParameteri(table, save_SamplerParameteri);
14524 SET_SamplerParameterf(table, save_SamplerParameterf);
14525 SET_SamplerParameteriv(table, save_SamplerParameteriv);
14526 SET_SamplerParameterfv(table, save_SamplerParameterfv);
14527 SET_SamplerParameterIiv(table, save_SamplerParameterIiv);
14528 SET_SamplerParameterIuiv(table, save_SamplerParameterIuiv);
14529
14530 /* GL_ARB_draw_buffer_blend */
14531 SET_BlendFunciARB(table, save_BlendFunci);
14532 SET_BlendFuncSeparateiARB(table, save_BlendFuncSeparatei);
14533 SET_BlendEquationiARB(table, save_BlendEquationi);
14534 SET_BlendEquationSeparateiARB(table, save_BlendEquationSeparatei);
14535
14536 /* GL_NV_conditional_render */
14537 SET_BeginConditionalRender(table, save_BeginConditionalRender);
14538 SET_EndConditionalRender(table, save_EndConditionalRender);
14539
14540 /* GL_ARB_sync */
14541 SET_WaitSync(table, save_WaitSync);
14542
14543 /* GL_ARB_uniform_buffer_object */
14544 SET_UniformBlockBinding(table, save_UniformBlockBinding);
14545
14546 /* GL_ARB_shader_subroutines */
14547 SET_UniformSubroutinesuiv(table, save_UniformSubroutinesuiv);
14548
14549 /* GL_ARB_draw_instanced */
14550 SET_DrawArraysInstancedARB(table, save_DrawArraysInstancedARB);
14551 SET_DrawElementsInstancedARB(table, save_DrawElementsInstancedARB);
14552
14553 /* GL_ARB_draw_elements_base_vertex */
14554 SET_DrawElementsInstancedBaseVertex(table, save_DrawElementsInstancedBaseVertexARB);
14555
14556 /* GL_ARB_base_instance */
14557 SET_DrawArraysInstancedBaseInstance(table, save_DrawArraysInstancedBaseInstance);
14558 SET_DrawElementsInstancedBaseInstance(table, save_DrawElementsInstancedBaseInstance);
14559 SET_DrawElementsInstancedBaseVertexBaseInstance(table, save_DrawElementsInstancedBaseVertexBaseInstance);
14560
14561 /* GL_ARB_draw_indirect / GL_ARB_multi_draw_indirect */
14562 SET_DrawArraysIndirect(table, save_DrawArraysIndirect);
14563 SET_DrawElementsIndirect(table, save_DrawElementsIndirect);
14564 SET_MultiDrawArraysIndirect(table, save_MultiDrawArraysIndirect);
14565 SET_MultiDrawElementsIndirect(table, save_MultiDrawElementsIndirect);
14566
14567 /* OpenGL 4.2 / GL_ARB_separate_shader_objects */
14568 SET_UseProgramStages(table, save_UseProgramStages);
14569 SET_ProgramUniform1f(table, save_ProgramUniform1f);
14570 SET_ProgramUniform2f(table, save_ProgramUniform2f);
14571 SET_ProgramUniform3f(table, save_ProgramUniform3f);
14572 SET_ProgramUniform4f(table, save_ProgramUniform4f);
14573 SET_ProgramUniform1fv(table, save_ProgramUniform1fv);
14574 SET_ProgramUniform2fv(table, save_ProgramUniform2fv);
14575 SET_ProgramUniform3fv(table, save_ProgramUniform3fv);
14576 SET_ProgramUniform4fv(table, save_ProgramUniform4fv);
14577 SET_ProgramUniform1d(table, save_ProgramUniform1d);
14578 SET_ProgramUniform2d(table, save_ProgramUniform2d);
14579 SET_ProgramUniform3d(table, save_ProgramUniform3d);
14580 SET_ProgramUniform4d(table, save_ProgramUniform4d);
14581 SET_ProgramUniform1dv(table, save_ProgramUniform1dv);
14582 SET_ProgramUniform2dv(table, save_ProgramUniform2dv);
14583 SET_ProgramUniform3dv(table, save_ProgramUniform3dv);
14584 SET_ProgramUniform4dv(table, save_ProgramUniform4dv);
14585 SET_ProgramUniform1i(table, save_ProgramUniform1i);
14586 SET_ProgramUniform2i(table, save_ProgramUniform2i);
14587 SET_ProgramUniform3i(table, save_ProgramUniform3i);
14588 SET_ProgramUniform4i(table, save_ProgramUniform4i);
14589 SET_ProgramUniform1iv(table, save_ProgramUniform1iv);
14590 SET_ProgramUniform2iv(table, save_ProgramUniform2iv);
14591 SET_ProgramUniform3iv(table, save_ProgramUniform3iv);
14592 SET_ProgramUniform4iv(table, save_ProgramUniform4iv);
14593 SET_ProgramUniform1ui(table, save_ProgramUniform1ui);
14594 SET_ProgramUniform2ui(table, save_ProgramUniform2ui);
14595 SET_ProgramUniform3ui(table, save_ProgramUniform3ui);
14596 SET_ProgramUniform4ui(table, save_ProgramUniform4ui);
14597 SET_ProgramUniform1uiv(table, save_ProgramUniform1uiv);
14598 SET_ProgramUniform2uiv(table, save_ProgramUniform2uiv);
14599 SET_ProgramUniform3uiv(table, save_ProgramUniform3uiv);
14600 SET_ProgramUniform4uiv(table, save_ProgramUniform4uiv);
14601 SET_ProgramUniformMatrix2fv(table, save_ProgramUniformMatrix2fv);
14602 SET_ProgramUniformMatrix3fv(table, save_ProgramUniformMatrix3fv);
14603 SET_ProgramUniformMatrix4fv(table, save_ProgramUniformMatrix4fv);
14604 SET_ProgramUniformMatrix2x3fv(table, save_ProgramUniformMatrix2x3fv);
14605 SET_ProgramUniformMatrix3x2fv(table, save_ProgramUniformMatrix3x2fv);
14606 SET_ProgramUniformMatrix2x4fv(table, save_ProgramUniformMatrix2x4fv);
14607 SET_ProgramUniformMatrix4x2fv(table, save_ProgramUniformMatrix4x2fv);
14608 SET_ProgramUniformMatrix3x4fv(table, save_ProgramUniformMatrix3x4fv);
14609 SET_ProgramUniformMatrix4x3fv(table, save_ProgramUniformMatrix4x3fv);
14610 SET_ProgramUniformMatrix2dv(table, save_ProgramUniformMatrix2dv);
14611 SET_ProgramUniformMatrix3dv(table, save_ProgramUniformMatrix3dv);
14612 SET_ProgramUniformMatrix4dv(table, save_ProgramUniformMatrix4dv);
14613 SET_ProgramUniformMatrix2x3dv(table, save_ProgramUniformMatrix2x3dv);
14614 SET_ProgramUniformMatrix3x2dv(table, save_ProgramUniformMatrix3x2dv);
14615 SET_ProgramUniformMatrix2x4dv(table, save_ProgramUniformMatrix2x4dv);
14616 SET_ProgramUniformMatrix4x2dv(table, save_ProgramUniformMatrix4x2dv);
14617 SET_ProgramUniformMatrix3x4dv(table, save_ProgramUniformMatrix3x4dv);
14618 SET_ProgramUniformMatrix4x3dv(table, save_ProgramUniformMatrix4x3dv);
14619
14620 /* GL_{ARB,EXT}_polygon_offset_clamp */
14621 SET_PolygonOffsetClampEXT(table, save_PolygonOffsetClampEXT);
14622
14623 /* GL_EXT_window_rectangles */
14624 SET_WindowRectanglesEXT(table, save_WindowRectanglesEXT);
14625
14626 /* GL_NV_conservative_raster */
14627 SET_SubpixelPrecisionBiasNV(table, save_SubpixelPrecisionBiasNV);
14628
14629 /* GL_NV_conservative_raster_dilate */
14630 SET_ConservativeRasterParameterfNV(table, save_ConservativeRasterParameterfNV);
14631
14632 /* GL_NV_conservative_raster_pre_snap_triangles */
14633 SET_ConservativeRasterParameteriNV(table, save_ConservativeRasterParameteriNV);
14634
14635 /* GL_EXT_direct_state_access */
14636 SET_MatrixLoadfEXT(table, save_MatrixLoadfEXT);
14637 SET_MatrixLoaddEXT(table, save_MatrixLoaddEXT);
14638 SET_MatrixMultfEXT(table, save_MatrixMultfEXT);
14639 SET_MatrixMultdEXT(table, save_MatrixMultdEXT);
14640 SET_MatrixRotatefEXT(table, save_MatrixRotatefEXT);
14641 SET_MatrixRotatedEXT(table, save_MatrixRotatedEXT);
14642 SET_MatrixScalefEXT(table, save_MatrixScalefEXT);
14643 SET_MatrixScaledEXT(table, save_MatrixScaledEXT);
14644 SET_MatrixTranslatefEXT(table, save_MatrixTranslatefEXT);
14645 SET_MatrixTranslatedEXT(table, save_MatrixTranslatedEXT);
14646 SET_MatrixLoadIdentityEXT(table, save_MatrixLoadIdentityEXT);
14647 SET_MatrixOrthoEXT(table, save_MatrixOrthoEXT);
14648 SET_MatrixFrustumEXT(table, save_MatrixFrustumEXT);
14649 SET_MatrixPushEXT(table, save_MatrixPushEXT);
14650 SET_MatrixPopEXT(table, save_MatrixPopEXT);
14651 SET_MatrixLoadTransposefEXT(table, save_MatrixLoadTransposefEXT);
14652 SET_MatrixLoadTransposedEXT(table, save_MatrixLoadTransposedEXT);
14653 SET_MatrixMultTransposefEXT(table, save_MatrixMultTransposefEXT);
14654 SET_MatrixMultTransposedEXT(table, save_MatrixMultTransposedEXT);
14655 SET_TextureParameteriEXT(table, save_TextureParameteriEXT);
14656 SET_TextureParameterivEXT(table, save_TextureParameterivEXT);
14657 SET_TextureParameterfEXT(table, save_TextureParameterfEXT);
14658 SET_TextureParameterfvEXT(table, save_TextureParameterfvEXT);
14659 SET_TextureParameterIivEXT(table, save_TextureParameterIivEXT);
14660 SET_TextureParameterIuivEXT(table, save_TextureParameterIuivEXT);
14661 SET_TextureImage1DEXT(table, save_TextureImage1DEXT);
14662 SET_TextureImage2DEXT(table, save_TextureImage2DEXT);
14663 SET_TextureImage3DEXT(table, save_TextureImage3DEXT);
14664 SET_TextureSubImage1DEXT(table, save_TextureSubImage1DEXT);
14665 SET_TextureSubImage2DEXT(table, save_TextureSubImage2DEXT);
14666 SET_TextureSubImage3DEXT(table, save_TextureSubImage3DEXT);
14667 SET_CopyTextureImage1DEXT(table, save_CopyTextureImage1DEXT);
14668 SET_CopyTextureImage2DEXT(table, save_CopyTextureImage2DEXT);
14669 SET_CopyTextureSubImage1DEXT(table, save_CopyTextureSubImage1DEXT);
14670 SET_CopyTextureSubImage2DEXT(table, save_CopyTextureSubImage2DEXT);
14671 SET_CopyTextureSubImage3DEXT(table, save_CopyTextureSubImage3DEXT);
14672 SET_BindMultiTextureEXT(table, save_BindMultiTextureEXT);
14673 SET_MultiTexParameteriEXT(table, save_MultiTexParameteriEXT);
14674 SET_MultiTexParameterivEXT(table, save_MultiTexParameterivEXT);
14675 SET_MultiTexParameterIivEXT(table, save_MultiTexParameterIivEXT);
14676 SET_MultiTexParameterIuivEXT(table, save_MultiTexParameterIuivEXT);
14677 SET_MultiTexParameterfEXT(table, save_MultiTexParameterfEXT);
14678 SET_MultiTexParameterfvEXT(table, save_MultiTexParameterfvEXT);
14679 SET_MultiTexImage1DEXT(table, save_MultiTexImage1DEXT);
14680 SET_MultiTexImage2DEXT(table, save_MultiTexImage2DEXT);
14681 SET_MultiTexImage3DEXT(table, save_MultiTexImage3DEXT);
14682 SET_MultiTexSubImage1DEXT(table, save_MultiTexSubImage1DEXT);
14683 SET_MultiTexSubImage2DEXT(table, save_MultiTexSubImage2DEXT);
14684 SET_MultiTexSubImage3DEXT(table, save_MultiTexSubImage3DEXT);
14685 SET_CopyMultiTexImage1DEXT(table, save_CopyMultiTexImage1DEXT);
14686 SET_CopyMultiTexImage2DEXT(table, save_CopyMultiTexImage2DEXT);
14687 SET_CopyMultiTexSubImage1DEXT(table, save_CopyMultiTexSubImage1DEXT);
14688 SET_CopyMultiTexSubImage2DEXT(table, save_CopyMultiTexSubImage2DEXT);
14689 SET_CopyMultiTexSubImage3DEXT(table, save_CopyMultiTexSubImage3DEXT);
14690 SET_MultiTexEnvfEXT(table, save_MultiTexEnvfEXT);
14691 SET_MultiTexEnvfvEXT(table, save_MultiTexEnvfvEXT);
14692 SET_MultiTexEnviEXT(table, save_MultiTexEnviEXT);
14693 SET_MultiTexEnvivEXT(table, save_MultiTexEnvivEXT);
14694 SET_CompressedTextureImage1DEXT(table, save_CompressedTextureImage1DEXT);
14695 SET_CompressedTextureImage2DEXT(table, save_CompressedTextureImage2DEXT);
14696 SET_CompressedTextureImage3DEXT(table, save_CompressedTextureImage3DEXT);
14697 SET_CompressedTextureSubImage1DEXT(table, save_CompressedTextureSubImage1DEXT);
14698 SET_CompressedTextureSubImage2DEXT(table, save_CompressedTextureSubImage2DEXT);
14699 SET_CompressedTextureSubImage3DEXT(table, save_CompressedTextureSubImage3DEXT);
14700 SET_CompressedMultiTexImage1DEXT(table, save_CompressedMultiTexImage1DEXT);
14701 SET_CompressedMultiTexImage2DEXT(table, save_CompressedMultiTexImage2DEXT);
14702 SET_CompressedMultiTexImage3DEXT(table, save_CompressedMultiTexImage3DEXT);
14703 SET_CompressedMultiTexSubImage1DEXT(table, save_CompressedMultiTexSubImage1DEXT);
14704 SET_CompressedMultiTexSubImage2DEXT(table, save_CompressedMultiTexSubImage2DEXT);
14705 SET_CompressedMultiTexSubImage3DEXT(table, save_CompressedMultiTexSubImage3DEXT);
14706 SET_NamedProgramStringEXT(table, save_NamedProgramStringEXT);
14707 SET_NamedProgramLocalParameter4dEXT(table, save_NamedProgramLocalParameter4dEXT);
14708 SET_NamedProgramLocalParameter4dvEXT(table, save_NamedProgramLocalParameter4dvEXT);
14709 SET_NamedProgramLocalParameter4fEXT(table, save_NamedProgramLocalParameter4fEXT);
14710 SET_NamedProgramLocalParameter4fvEXT(table, save_NamedProgramLocalParameter4fvEXT);
14711
14712 /* GL_ARB_ES3_2_compatibility */
14713 SET_PrimitiveBoundingBox(table, save_PrimitiveBoundingBox);
14714 }
14715
14716
14717
14718 static const char *
enum_string(GLenum k)14719 enum_string(GLenum k)
14720 {
14721 return _mesa_enum_to_string(k);
14722 }
14723
14724
14725 /**
14726 * Print the commands in a display list. For debugging only.
14727 * TODO: many commands aren't handled yet.
14728 * \param fname filename to write display list to. If null, use stdout.
14729 */
14730 static void GLAPIENTRY
print_list(struct gl_context * ctx,GLuint list,const char * fname)14731 print_list(struct gl_context *ctx, GLuint list, const char *fname)
14732 {
14733 struct gl_display_list *dlist;
14734 Node *n;
14735 FILE *f = stdout;
14736
14737 if (fname) {
14738 f = fopen(fname, "w");
14739 if (!f)
14740 return;
14741 }
14742
14743 if (!_mesa_get_list(ctx, list, &dlist, true)) {
14744 fprintf(f, "%u is not a display list ID\n", list);
14745 fflush(f);
14746 if (fname)
14747 fclose(f);
14748 return;
14749 }
14750
14751 n = get_list_head(ctx, dlist);
14752
14753 fprintf(f, "START-LIST %u, address %p\n", list, (void *) n);
14754
14755 while (1) {
14756 const OpCode opcode = n[0].opcode;
14757
14758 switch (opcode) {
14759 case OPCODE_ACCUM:
14760 fprintf(f, "Accum %s %g\n", enum_string(n[1].e), n[2].f);
14761 break;
14762 case OPCODE_ACTIVE_TEXTURE:
14763 fprintf(f, "ActiveTexture(%s)\n", enum_string(n[1].e));
14764 break;
14765 case OPCODE_BITMAP:
14766 fprintf(f, "Bitmap %d %d %g %g %g %g %p\n", n[1].i, n[2].i,
14767 n[3].f, n[4].f, n[5].f, n[6].f,
14768 get_pointer(&n[7]));
14769 break;
14770 case OPCODE_BLEND_COLOR:
14771 fprintf(f, "BlendColor %f, %f, %f, %f\n",
14772 n[1].f, n[2].f, n[3].f, n[4].f);
14773 break;
14774 case OPCODE_BLEND_EQUATION:
14775 fprintf(f, "BlendEquation %s\n",
14776 enum_string(n[1].e));
14777 break;
14778 case OPCODE_BLEND_EQUATION_SEPARATE:
14779 fprintf(f, "BlendEquationSeparate %s, %s\n",
14780 enum_string(n[1].e),
14781 enum_string(n[2].e));
14782 break;
14783 case OPCODE_BLEND_FUNC_SEPARATE:
14784 fprintf(f, "BlendFuncSeparate %s, %s, %s, %s\n",
14785 enum_string(n[1].e),
14786 enum_string(n[2].e),
14787 enum_string(n[3].e),
14788 enum_string(n[4].e));
14789 break;
14790 case OPCODE_BLEND_EQUATION_I:
14791 fprintf(f, "BlendEquationi %u, %s\n",
14792 n[1].ui, enum_string(n[2].e));
14793 break;
14794 case OPCODE_BLEND_EQUATION_SEPARATE_I:
14795 fprintf(f, "BlendEquationSeparatei %u, %s, %s\n",
14796 n[1].ui, enum_string(n[2].e), enum_string(n[3].e));
14797 break;
14798 case OPCODE_BLEND_FUNC_I:
14799 fprintf(f, "BlendFunci %u, %s, %s\n",
14800 n[1].ui, enum_string(n[2].e), enum_string(n[3].e));
14801 break;
14802 case OPCODE_BLEND_FUNC_SEPARATE_I:
14803 fprintf(f, "BlendFuncSeparatei %u, %s, %s, %s, %s\n",
14804 n[1].ui,
14805 enum_string(n[2].e),
14806 enum_string(n[3].e),
14807 enum_string(n[4].e),
14808 enum_string(n[5].e));
14809 break;
14810 case OPCODE_CALL_LIST:
14811 fprintf(f, "CallList %d\n", (int) n[1].ui);
14812 break;
14813 case OPCODE_CALL_LISTS:
14814 fprintf(f, "CallLists %d, %s\n", n[1].i, enum_string(n[1].e));
14815 break;
14816 case OPCODE_DISABLE:
14817 fprintf(f, "Disable %s\n", enum_string(n[1].e));
14818 break;
14819 case OPCODE_ENABLE:
14820 fprintf(f, "Enable %s\n", enum_string(n[1].e));
14821 break;
14822 case OPCODE_FRUSTUM:
14823 fprintf(f, "Frustum %g %g %g %g %g %g\n",
14824 n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f);
14825 break;
14826 case OPCODE_LINE_STIPPLE:
14827 fprintf(f, "LineStipple %d %x\n", n[1].i, (int) n[2].us);
14828 break;
14829 case OPCODE_LINE_WIDTH:
14830 fprintf(f, "LineWidth %f\n", n[1].f);
14831 break;
14832 case OPCODE_LOAD_IDENTITY:
14833 fprintf(f, "LoadIdentity\n");
14834 break;
14835 case OPCODE_LOAD_MATRIX:
14836 fprintf(f, "LoadMatrix\n");
14837 fprintf(f, " %8f %8f %8f %8f\n",
14838 n[1].f, n[5].f, n[9].f, n[13].f);
14839 fprintf(f, " %8f %8f %8f %8f\n",
14840 n[2].f, n[6].f, n[10].f, n[14].f);
14841 fprintf(f, " %8f %8f %8f %8f\n",
14842 n[3].f, n[7].f, n[11].f, n[15].f);
14843 fprintf(f, " %8f %8f %8f %8f\n",
14844 n[4].f, n[8].f, n[12].f, n[16].f);
14845 break;
14846 case OPCODE_MULT_MATRIX:
14847 fprintf(f, "MultMatrix (or Rotate)\n");
14848 fprintf(f, " %8f %8f %8f %8f\n",
14849 n[1].f, n[5].f, n[9].f, n[13].f);
14850 fprintf(f, " %8f %8f %8f %8f\n",
14851 n[2].f, n[6].f, n[10].f, n[14].f);
14852 fprintf(f, " %8f %8f %8f %8f\n",
14853 n[3].f, n[7].f, n[11].f, n[15].f);
14854 fprintf(f, " %8f %8f %8f %8f\n",
14855 n[4].f, n[8].f, n[12].f, n[16].f);
14856 break;
14857 case OPCODE_ORTHO:
14858 fprintf(f, "Ortho %g %g %g %g %g %g\n",
14859 n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f);
14860 break;
14861 case OPCODE_POINT_SIZE:
14862 fprintf(f, "PointSize %f\n", n[1].f);
14863 break;
14864 case OPCODE_POP_ATTRIB:
14865 fprintf(f, "PopAttrib\n");
14866 break;
14867 case OPCODE_POP_MATRIX:
14868 fprintf(f, "PopMatrix\n");
14869 break;
14870 case OPCODE_POP_NAME:
14871 fprintf(f, "PopName\n");
14872 break;
14873 case OPCODE_PUSH_ATTRIB:
14874 fprintf(f, "PushAttrib %x\n", n[1].bf);
14875 break;
14876 case OPCODE_PUSH_MATRIX:
14877 fprintf(f, "PushMatrix\n");
14878 break;
14879 case OPCODE_PUSH_NAME:
14880 fprintf(f, "PushName %d\n", (int) n[1].ui);
14881 break;
14882 case OPCODE_RASTER_POS:
14883 fprintf(f, "RasterPos %g %g %g %g\n",
14884 n[1].f, n[2].f, n[3].f, n[4].f);
14885 break;
14886 case OPCODE_ROTATE:
14887 fprintf(f, "Rotate %g %g %g %g\n",
14888 n[1].f, n[2].f, n[3].f, n[4].f);
14889 break;
14890 case OPCODE_SCALE:
14891 fprintf(f, "Scale %g %g %g\n", n[1].f, n[2].f, n[3].f);
14892 break;
14893 case OPCODE_TRANSLATE:
14894 fprintf(f, "Translate %g %g %g\n", n[1].f, n[2].f, n[3].f);
14895 break;
14896 case OPCODE_BIND_TEXTURE:
14897 fprintf(f, "BindTexture %s %d\n",
14898 _mesa_enum_to_string(n[1].ui), n[2].ui);
14899 break;
14900 case OPCODE_SHADE_MODEL:
14901 fprintf(f, "ShadeModel %s\n", _mesa_enum_to_string(n[1].ui));
14902 break;
14903 case OPCODE_MAP1:
14904 fprintf(f, "Map1 %s %.3f %.3f %d %d\n",
14905 _mesa_enum_to_string(n[1].ui),
14906 n[2].f, n[3].f, n[4].i, n[5].i);
14907 break;
14908 case OPCODE_MAP2:
14909 fprintf(f, "Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
14910 _mesa_enum_to_string(n[1].ui),
14911 n[2].f, n[3].f, n[4].f, n[5].f,
14912 n[6].i, n[7].i, n[8].i, n[9].i);
14913 break;
14914 case OPCODE_MAPGRID1:
14915 fprintf(f, "MapGrid1 %d %.3f %.3f\n", n[1].i, n[2].f, n[3].f);
14916 break;
14917 case OPCODE_MAPGRID2:
14918 fprintf(f, "MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
14919 n[1].i, n[2].f, n[3].f, n[4].i, n[5].f, n[6].f);
14920 break;
14921 case OPCODE_EVALMESH1:
14922 fprintf(f, "EvalMesh1 %d %d\n", n[1].i, n[2].i);
14923 break;
14924 case OPCODE_EVALMESH2:
14925 fprintf(f, "EvalMesh2 %d %d %d %d\n",
14926 n[1].i, n[2].i, n[3].i, n[4].i);
14927 break;
14928
14929 case OPCODE_ATTR_1F_NV:
14930 fprintf(f, "ATTR_1F_NV attr %d: %f\n", n[1].i, n[2].f);
14931 break;
14932 case OPCODE_ATTR_2F_NV:
14933 fprintf(f, "ATTR_2F_NV attr %d: %f %f\n",
14934 n[1].i, n[2].f, n[3].f);
14935 break;
14936 case OPCODE_ATTR_3F_NV:
14937 fprintf(f, "ATTR_3F_NV attr %d: %f %f %f\n",
14938 n[1].i, n[2].f, n[3].f, n[4].f);
14939 break;
14940 case OPCODE_ATTR_4F_NV:
14941 fprintf(f, "ATTR_4F_NV attr %d: %f %f %f %f\n",
14942 n[1].i, n[2].f, n[3].f, n[4].f, n[5].f);
14943 break;
14944 case OPCODE_ATTR_1F_ARB:
14945 fprintf(f, "ATTR_1F_ARB attr %d: %f\n", n[1].i, n[2].f);
14946 break;
14947 case OPCODE_ATTR_2F_ARB:
14948 fprintf(f, "ATTR_2F_ARB attr %d: %f %f\n",
14949 n[1].i, n[2].f, n[3].f);
14950 break;
14951 case OPCODE_ATTR_3F_ARB:
14952 fprintf(f, "ATTR_3F_ARB attr %d: %f %f %f\n",
14953 n[1].i, n[2].f, n[3].f, n[4].f);
14954 break;
14955 case OPCODE_ATTR_4F_ARB:
14956 fprintf(f, "ATTR_4F_ARB attr %d: %f %f %f %f\n",
14957 n[1].i, n[2].f, n[3].f, n[4].f, n[5].f);
14958 break;
14959
14960 case OPCODE_MATERIAL:
14961 fprintf(f, "MATERIAL %x %x: %f %f %f %f\n",
14962 n[1].i, n[2].i, n[3].f, n[4].f, n[5].f, n[6].f);
14963 break;
14964 case OPCODE_BEGIN:
14965 fprintf(f, "BEGIN %x\n", n[1].i);
14966 break;
14967 case OPCODE_END:
14968 fprintf(f, "END\n");
14969 break;
14970 case OPCODE_EVAL_C1:
14971 fprintf(f, "EVAL_C1 %f\n", n[1].f);
14972 break;
14973 case OPCODE_EVAL_C2:
14974 fprintf(f, "EVAL_C2 %f %f\n", n[1].f, n[2].f);
14975 break;
14976 case OPCODE_EVAL_P1:
14977 fprintf(f, "EVAL_P1 %d\n", n[1].i);
14978 break;
14979 case OPCODE_EVAL_P2:
14980 fprintf(f, "EVAL_P2 %d %d\n", n[1].i, n[2].i);
14981 break;
14982
14983 case OPCODE_PROVOKING_VERTEX:
14984 fprintf(f, "ProvokingVertex %s\n",
14985 _mesa_enum_to_string(n[1].ui));
14986 break;
14987
14988 /*
14989 * meta opcodes/commands
14990 */
14991 case OPCODE_ERROR:
14992 fprintf(f, "Error: %s %s\n", enum_string(n[1].e),
14993 (const char *) get_pointer(&n[2]));
14994 break;
14995 case OPCODE_CONTINUE:
14996 fprintf(f, "DISPLAY-LIST-CONTINUE\n");
14997 n = (Node *) get_pointer(&n[1]);
14998 continue;
14999 case OPCODE_NOP:
15000 fprintf(f, "NOP\n");
15001 break;
15002 case OPCODE_VERTEX_LIST:
15003 case OPCODE_VERTEX_LIST_LOOPBACK:
15004 case OPCODE_VERTEX_LIST_COPY_CURRENT:
15005 vbo_print_vertex_list(ctx, (struct vbo_save_vertex_list *) &n[1], opcode, f);
15006 break;
15007 default:
15008 if (opcode < 0 || opcode > OPCODE_END_OF_LIST) {
15009 printf
15010 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
15011 opcode, (void *) n);
15012 } else {
15013 fprintf(f, "command %d, %u operands\n", opcode,
15014 n[0].InstSize);
15015 break;
15016 }
15017 FALLTHROUGH;
15018 case OPCODE_END_OF_LIST:
15019 fprintf(f, "END-LIST %u\n", list);
15020 fflush(f);
15021 if (fname)
15022 fclose(f);
15023 return;
15024 }
15025
15026 /* increment n to point to next compiled command */
15027 assert(n[0].InstSize > 0);
15028 n += n[0].InstSize;
15029 }
15030 }
15031
15032
15033 void
_mesa_glthread_execute_list(struct gl_context * ctx,GLuint list)15034 _mesa_glthread_execute_list(struct gl_context *ctx, GLuint list)
15035 {
15036 struct gl_display_list *dlist;
15037
15038 if (list == 0 ||
15039 !_mesa_get_list(ctx, list, &dlist, true))
15040 return;
15041
15042 Node *n = get_list_head(ctx, dlist);
15043
15044 while (1) {
15045 const OpCode opcode = n[0].opcode;
15046
15047 switch (opcode) {
15048 case OPCODE_CALL_LIST:
15049 /* Generated by glCallList(), don't add ListBase */
15050 if (ctx->GLThread.ListCallDepth < MAX_LIST_NESTING) {
15051 ctx->GLThread.ListCallDepth++;
15052 _mesa_glthread_execute_list(ctx, n[1].ui);
15053 ctx->GLThread.ListCallDepth--;
15054 }
15055 break;
15056 case OPCODE_CALL_LISTS:
15057 if (ctx->GLThread.ListCallDepth < MAX_LIST_NESTING) {
15058 ctx->GLThread.ListCallDepth++;
15059 _mesa_glthread_CallLists(ctx, n[1].i, n[2].e, get_pointer(&n[3]));
15060 ctx->GLThread.ListCallDepth--;
15061 }
15062 break;
15063 case OPCODE_DISABLE:
15064 _mesa_glthread_Disable(ctx, n[1].e);
15065 break;
15066 case OPCODE_ENABLE:
15067 _mesa_glthread_Enable(ctx, n[1].e);
15068 break;
15069 case OPCODE_LIST_BASE:
15070 _mesa_glthread_ListBase(ctx, n[1].ui);
15071 break;
15072 case OPCODE_MATRIX_MODE:
15073 _mesa_glthread_MatrixMode(ctx, n[1].e);
15074 break;
15075 case OPCODE_POP_ATTRIB:
15076 _mesa_glthread_PopAttrib(ctx);
15077 break;
15078 case OPCODE_POP_MATRIX:
15079 _mesa_glthread_PopMatrix(ctx);
15080 break;
15081 case OPCODE_PUSH_ATTRIB:
15082 _mesa_glthread_PushAttrib(ctx, n[1].bf);
15083 break;
15084 case OPCODE_PUSH_MATRIX:
15085 _mesa_glthread_PushMatrix(ctx);
15086 break;
15087 case OPCODE_ACTIVE_TEXTURE: /* GL_ARB_multitexture */
15088 _mesa_glthread_ActiveTexture(ctx, n[1].e);
15089 break;
15090 case OPCODE_MATRIX_PUSH:
15091 _mesa_glthread_MatrixPushEXT(ctx, n[1].e);
15092 break;
15093 case OPCODE_MATRIX_POP:
15094 _mesa_glthread_MatrixPopEXT(ctx, n[1].e);
15095 break;
15096 case OPCODE_CONTINUE:
15097 n = (Node *)get_pointer(&n[1]);
15098 continue;
15099 case OPCODE_END_OF_LIST:
15100 ctx->GLThread.ListCallDepth--;
15101 return;
15102 default:
15103 /* ignore */
15104 break;
15105 }
15106
15107 /* increment n to point to next compiled command */
15108 assert(n[0].InstSize > 0);
15109 n += n[0].InstSize;
15110 }
15111 }
15112
15113
15114 /**
15115 * Clients may call this function to help debug display list problems.
15116 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
15117 * changed, or break in the future without notice.
15118 */
15119 void
mesa_print_display_list(GLuint list)15120 mesa_print_display_list(GLuint list)
15121 {
15122 GET_CURRENT_CONTEXT(ctx);
15123 print_list(ctx, list, NULL);
15124 }
15125
15126
15127 /**********************************************************************/
15128 /***** Initialization *****/
15129 /**********************************************************************/
15130
15131 void
_mesa_install_dlist_vtxfmt(struct _glapi_table * disp,const GLvertexformat * vfmt)15132 _mesa_install_dlist_vtxfmt(struct _glapi_table *disp,
15133 const GLvertexformat *vfmt)
15134 {
15135 SET_CallList(disp, vfmt->CallList);
15136 SET_CallLists(disp, vfmt->CallLists);
15137 }
15138
15139
15140 /**
15141 * Initialize display list state for given context.
15142 */
15143 void
_mesa_init_display_list(struct gl_context * ctx)15144 _mesa_init_display_list(struct gl_context *ctx)
15145 {
15146 GLvertexformat *vfmt = &ctx->ListState.ListVtxfmt;
15147
15148 /* Display list */
15149 ctx->ListState.CallDepth = 1;
15150 ctx->ExecuteFlag = GL_TRUE;
15151 ctx->CompileFlag = GL_FALSE;
15152 ctx->ListState.CurrentBlock = NULL;
15153 ctx->ListState.CurrentPos = 0;
15154
15155 /* Display List group */
15156 ctx->List.ListBase = 0;
15157
15158 #define NAME_AE(x) _ae_##x
15159 #define NAME_CALLLIST(x) save_##x
15160 #define NAME(x) save_##x
15161 #define NAME_ES(x) save_##x##ARB
15162
15163 #include "vbo/vbo_init_tmp.h"
15164 }
15165