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 "api_save.h"
33 #include "api_arrayelt.h"
34 #include "draw_validate.h"
35 #include "arrayobj.h"
36 #include "enums.h"
37 #include "eval.h"
38 #include "hash.h"
39 #include "image.h"
40 #include "light.h"
41 #include "pack.h"
42 #include "pbo.h"
43 #include "teximage.h"
44 #include "texobj.h"
45 #include "varray.h"
46 #include "glthread_marshal.h"
47
48 #include "main/dispatch.h"
49
50 #include "vbo/vbo_save.h"
51 #include "util/u_inlines.h"
52 #include "util/u_memory.h"
53 #include "api_exec_decl.h"
54
55 #include "state_tracker/st_cb_texture.h"
56 #include "state_tracker/st_cb_bitmap.h"
57
58 #define USE_BITMAP_ATLAS 1
59
60 static bool
61 _mesa_glthread_should_execute_list(struct gl_context *ctx,
62 struct gl_display_list *dlist);
63
64 /**
65 * Flush vertices.
66 *
67 * \param ctx GL context.
68 *
69 * Checks if dd_function_table::SaveNeedFlush is marked to flush
70 * stored (save) vertices, and calls vbo_save_SaveFlushVertices if so.
71 */
72 #define SAVE_FLUSH_VERTICES(ctx) \
73 do { \
74 if (ctx->Driver.SaveNeedFlush) \
75 vbo_save_SaveFlushVertices(ctx); \
76 } while (0)
77
78
79 /**
80 * Macro to assert that the API call was made outside the
81 * glBegin()/glEnd() pair, with return value.
82 *
83 * \param ctx GL context.
84 * \param retval value to return value in case the assertion fails.
85 */
86 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval) \
87 do { \
88 if (ctx->Driver.CurrentSavePrimitive <= PRIM_MAX) { \
89 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glBegin/End" ); \
90 return retval; \
91 } \
92 } while (0)
93
94 /**
95 * Macro to assert that the API call was made outside the
96 * glBegin()/glEnd() pair.
97 *
98 * \param ctx GL context.
99 */
100 #define ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx) \
101 do { \
102 if (ctx->Driver.CurrentSavePrimitive <= PRIM_MAX) { \
103 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glBegin/End" ); \
104 return; \
105 } \
106 } while (0)
107
108 /**
109 * Macro to assert that the API call was made outside the
110 * glBegin()/glEnd() pair and flush the vertices.
111 *
112 * \param ctx GL context.
113 */
114 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx) \
115 do { \
116 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx); \
117 SAVE_FLUSH_VERTICES(ctx); \
118 } while (0)
119
120 /**
121 * Macro to assert that the API call was made outside the
122 * glBegin()/glEnd() pair and flush the vertices, with return value.
123 *
124 * \param ctx GL context.
125 * \param retval value to return value in case the assertion fails.
126 */
127 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval) \
128 do { \
129 ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval); \
130 SAVE_FLUSH_VERTICES(ctx); \
131 } while (0)
132
133
134 /**
135 * Display list opcodes.
136 */
137 typedef enum
138 {
139 OPCODE_INVALID = -1, /* Force signed enum */
140 OPCODE_ACCUM,
141 OPCODE_ALPHA_FUNC,
142 OPCODE_BIND_TEXTURE,
143 OPCODE_BITMAP,
144 OPCODE_BLEND_COLOR,
145 OPCODE_BLEND_EQUATION,
146 OPCODE_BLEND_EQUATION_SEPARATE,
147 OPCODE_BLEND_FUNC_SEPARATE,
148
149 OPCODE_BLEND_EQUATION_I,
150 OPCODE_BLEND_EQUATION_SEPARATE_I,
151 OPCODE_BLEND_FUNC_I,
152 OPCODE_BLEND_FUNC_SEPARATE_I,
153
154 OPCODE_CALL_LIST,
155 OPCODE_CALL_LISTS,
156 OPCODE_CLEAR,
157 OPCODE_CLEAR_ACCUM,
158 OPCODE_CLEAR_COLOR,
159 OPCODE_CLEAR_DEPTH,
160 OPCODE_CLEAR_INDEX,
161 OPCODE_CLEAR_STENCIL,
162 OPCODE_CLEAR_BUFFER_IV,
163 OPCODE_CLEAR_BUFFER_UIV,
164 OPCODE_CLEAR_BUFFER_FV,
165 OPCODE_CLEAR_BUFFER_FI,
166 OPCODE_CLIP_PLANE,
167 OPCODE_COLOR_MASK,
168 OPCODE_COLOR_MASK_INDEXED,
169 OPCODE_COLOR_MATERIAL,
170 OPCODE_COPY_PIXELS,
171 OPCODE_COPY_TEX_IMAGE1D,
172 OPCODE_COPY_TEX_IMAGE2D,
173 OPCODE_COPY_TEX_SUB_IMAGE1D,
174 OPCODE_COPY_TEX_SUB_IMAGE2D,
175 OPCODE_COPY_TEX_SUB_IMAGE3D,
176 OPCODE_CULL_FACE,
177 OPCODE_DEPTH_FUNC,
178 OPCODE_DEPTH_MASK,
179 OPCODE_DEPTH_RANGE,
180 OPCODE_DISABLE,
181 OPCODE_DISABLE_INDEXED,
182 OPCODE_DRAW_BUFFER,
183 OPCODE_DRAW_PIXELS,
184 OPCODE_ENABLE,
185 OPCODE_ENABLE_INDEXED,
186 OPCODE_EVALMESH1,
187 OPCODE_EVALMESH2,
188 OPCODE_FOG,
189 OPCODE_FRONT_FACE,
190 OPCODE_FRUSTUM,
191 OPCODE_HINT,
192 OPCODE_INDEX_MASK,
193 OPCODE_INIT_NAMES,
194 OPCODE_LIGHT,
195 OPCODE_LIGHT_MODEL,
196 OPCODE_LINE_STIPPLE,
197 OPCODE_LINE_WIDTH,
198 OPCODE_LIST_BASE,
199 OPCODE_LOAD_IDENTITY,
200 OPCODE_LOAD_MATRIX,
201 OPCODE_LOAD_NAME,
202 OPCODE_LOGIC_OP,
203 OPCODE_MAP1,
204 OPCODE_MAP2,
205 OPCODE_MAPGRID1,
206 OPCODE_MAPGRID2,
207 OPCODE_MATRIX_MODE,
208 OPCODE_MULT_MATRIX,
209 OPCODE_ORTHO,
210 OPCODE_PASSTHROUGH,
211 OPCODE_PIXEL_MAP,
212 OPCODE_PIXEL_TRANSFER,
213 OPCODE_PIXEL_ZOOM,
214 OPCODE_POINT_SIZE,
215 OPCODE_POINT_PARAMETERS,
216 OPCODE_POLYGON_MODE,
217 OPCODE_POLYGON_STIPPLE,
218 OPCODE_POLYGON_OFFSET,
219 OPCODE_POP_ATTRIB,
220 OPCODE_POP_MATRIX,
221 OPCODE_POP_NAME,
222 OPCODE_PRIORITIZE_TEXTURE,
223 OPCODE_PUSH_ATTRIB,
224 OPCODE_PUSH_MATRIX,
225 OPCODE_PUSH_NAME,
226 OPCODE_RASTER_POS,
227 OPCODE_READ_BUFFER,
228 OPCODE_ROTATE,
229 OPCODE_SCALE,
230 OPCODE_SCISSOR,
231 OPCODE_SELECT_TEXTURE_SGIS,
232 OPCODE_SELECT_TEXTURE_COORD_SET,
233 OPCODE_SHADE_MODEL,
234 OPCODE_STENCIL_FUNC,
235 OPCODE_STENCIL_MASK,
236 OPCODE_STENCIL_OP,
237 OPCODE_TEXENV,
238 OPCODE_TEXGEN,
239 OPCODE_TEXPARAMETER,
240 OPCODE_TEX_IMAGE1D,
241 OPCODE_TEX_IMAGE2D,
242 OPCODE_TEX_IMAGE3D,
243 OPCODE_TEX_SUB_IMAGE1D,
244 OPCODE_TEX_SUB_IMAGE2D,
245 OPCODE_TEX_SUB_IMAGE3D,
246 OPCODE_TRANSLATE,
247 OPCODE_VIEWPORT,
248 OPCODE_WINDOW_POS,
249 /* ARB_viewport_array */
250 OPCODE_VIEWPORT_ARRAY_V,
251 OPCODE_VIEWPORT_INDEXED_F,
252 OPCODE_VIEWPORT_INDEXED_FV,
253 OPCODE_SCISSOR_ARRAY_V,
254 OPCODE_SCISSOR_INDEXED,
255 OPCODE_SCISSOR_INDEXED_V,
256 OPCODE_DEPTH_ARRAY_V,
257 OPCODE_DEPTH_INDEXED,
258 /* GL_ARB_multitexture */
259 OPCODE_ACTIVE_TEXTURE,
260 /* GL_ARB_texture_compression */
261 OPCODE_COMPRESSED_TEX_IMAGE_1D,
262 OPCODE_COMPRESSED_TEX_IMAGE_2D,
263 OPCODE_COMPRESSED_TEX_IMAGE_3D,
264 OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D,
265 OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D,
266 OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D,
267 /* GL_ARB_multisample */
268 OPCODE_SAMPLE_COVERAGE,
269 /* GL_ARB_window_pos */
270 OPCODE_WINDOW_POS_ARB,
271 /* GL_ARB_vertex_program */
272 OPCODE_BIND_PROGRAM_ARB,
273 OPCODE_PROGRAM_LOCAL_PARAMETER_ARB,
274 /* GL_EXT_stencil_two_side */
275 OPCODE_ACTIVE_STENCIL_FACE_EXT,
276 /* GL_EXT_depth_bounds_test */
277 OPCODE_DEPTH_BOUNDS_EXT,
278 /* GL_ARB_vertex/fragment_program */
279 OPCODE_PROGRAM_STRING_ARB,
280 OPCODE_PROGRAM_ENV_PARAMETER_ARB,
281 /* GL_ARB_occlusion_query */
282 OPCODE_BEGIN_QUERY_ARB,
283 OPCODE_END_QUERY_ARB,
284 /* GL_ARB_draw_buffers */
285 OPCODE_DRAW_BUFFERS_ARB,
286 /* GL_ATI_fragment_shader */
287 OPCODE_BIND_FRAGMENT_SHADER_ATI,
288 OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI,
289 /* OpenGL 2.0 */
290 OPCODE_STENCIL_FUNC_SEPARATE,
291 OPCODE_STENCIL_OP_SEPARATE,
292 OPCODE_STENCIL_MASK_SEPARATE,
293 /* GL_NV_primitive_restart */
294 OPCODE_PRIMITIVE_RESTART_NV,
295 /* GL_ARB_shader_objects */
296 OPCODE_USE_PROGRAM,
297 OPCODE_UNIFORM_1F,
298 OPCODE_UNIFORM_2F,
299 OPCODE_UNIFORM_3F,
300 OPCODE_UNIFORM_4F,
301 OPCODE_UNIFORM_1FV,
302 OPCODE_UNIFORM_2FV,
303 OPCODE_UNIFORM_3FV,
304 OPCODE_UNIFORM_4FV,
305 OPCODE_UNIFORM_1I,
306 OPCODE_UNIFORM_2I,
307 OPCODE_UNIFORM_3I,
308 OPCODE_UNIFORM_4I,
309 OPCODE_UNIFORM_1IV,
310 OPCODE_UNIFORM_2IV,
311 OPCODE_UNIFORM_3IV,
312 OPCODE_UNIFORM_4IV,
313 OPCODE_UNIFORM_MATRIX22,
314 OPCODE_UNIFORM_MATRIX33,
315 OPCODE_UNIFORM_MATRIX44,
316 OPCODE_UNIFORM_MATRIX23,
317 OPCODE_UNIFORM_MATRIX32,
318 OPCODE_UNIFORM_MATRIX24,
319 OPCODE_UNIFORM_MATRIX42,
320 OPCODE_UNIFORM_MATRIX34,
321 OPCODE_UNIFORM_MATRIX43,
322
323 /* OpenGL 3.0 */
324 OPCODE_UNIFORM_1UI,
325 OPCODE_UNIFORM_2UI,
326 OPCODE_UNIFORM_3UI,
327 OPCODE_UNIFORM_4UI,
328 OPCODE_UNIFORM_1UIV,
329 OPCODE_UNIFORM_2UIV,
330 OPCODE_UNIFORM_3UIV,
331 OPCODE_UNIFORM_4UIV,
332
333 /* GL_ARB_gpu_shader_fp64 */
334 OPCODE_UNIFORM_1D,
335 OPCODE_UNIFORM_2D,
336 OPCODE_UNIFORM_3D,
337 OPCODE_UNIFORM_4D,
338 OPCODE_UNIFORM_1DV,
339 OPCODE_UNIFORM_2DV,
340 OPCODE_UNIFORM_3DV,
341 OPCODE_UNIFORM_4DV,
342 OPCODE_UNIFORM_MATRIX22D,
343 OPCODE_UNIFORM_MATRIX33D,
344 OPCODE_UNIFORM_MATRIX44D,
345 OPCODE_UNIFORM_MATRIX23D,
346 OPCODE_UNIFORM_MATRIX32D,
347 OPCODE_UNIFORM_MATRIX24D,
348 OPCODE_UNIFORM_MATRIX42D,
349 OPCODE_UNIFORM_MATRIX34D,
350 OPCODE_UNIFORM_MATRIX43D,
351
352 /* GL_ARB_gpu_shader_int64 */
353 OPCODE_UNIFORM_1I64,
354 OPCODE_UNIFORM_2I64,
355 OPCODE_UNIFORM_3I64,
356 OPCODE_UNIFORM_4I64,
357 OPCODE_UNIFORM_1I64V,
358 OPCODE_UNIFORM_2I64V,
359 OPCODE_UNIFORM_3I64V,
360 OPCODE_UNIFORM_4I64V,
361 OPCODE_UNIFORM_1UI64,
362 OPCODE_UNIFORM_2UI64,
363 OPCODE_UNIFORM_3UI64,
364 OPCODE_UNIFORM_4UI64,
365 OPCODE_UNIFORM_1UI64V,
366 OPCODE_UNIFORM_2UI64V,
367 OPCODE_UNIFORM_3UI64V,
368 OPCODE_UNIFORM_4UI64V,
369 OPCODE_PROGRAM_UNIFORM_1I64,
370 OPCODE_PROGRAM_UNIFORM_2I64,
371 OPCODE_PROGRAM_UNIFORM_3I64,
372 OPCODE_PROGRAM_UNIFORM_4I64,
373 OPCODE_PROGRAM_UNIFORM_1I64V,
374 OPCODE_PROGRAM_UNIFORM_2I64V,
375 OPCODE_PROGRAM_UNIFORM_3I64V,
376 OPCODE_PROGRAM_UNIFORM_4I64V,
377 OPCODE_PROGRAM_UNIFORM_1UI64,
378 OPCODE_PROGRAM_UNIFORM_2UI64,
379 OPCODE_PROGRAM_UNIFORM_3UI64,
380 OPCODE_PROGRAM_UNIFORM_4UI64,
381 OPCODE_PROGRAM_UNIFORM_1UI64V,
382 OPCODE_PROGRAM_UNIFORM_2UI64V,
383 OPCODE_PROGRAM_UNIFORM_3UI64V,
384 OPCODE_PROGRAM_UNIFORM_4UI64V,
385
386 /* OpenGL 4.0 / GL_ARB_tessellation_shader */
387 OPCODE_PATCH_PARAMETER_I,
388 OPCODE_PATCH_PARAMETER_FV_INNER,
389 OPCODE_PATCH_PARAMETER_FV_OUTER,
390
391 /* OpenGL 4.2 / GL_ARB_separate_shader_objects */
392 OPCODE_USE_PROGRAM_STAGES,
393 OPCODE_PROGRAM_UNIFORM_1F,
394 OPCODE_PROGRAM_UNIFORM_2F,
395 OPCODE_PROGRAM_UNIFORM_3F,
396 OPCODE_PROGRAM_UNIFORM_4F,
397 OPCODE_PROGRAM_UNIFORM_1FV,
398 OPCODE_PROGRAM_UNIFORM_2FV,
399 OPCODE_PROGRAM_UNIFORM_3FV,
400 OPCODE_PROGRAM_UNIFORM_4FV,
401 OPCODE_PROGRAM_UNIFORM_1D,
402 OPCODE_PROGRAM_UNIFORM_2D,
403 OPCODE_PROGRAM_UNIFORM_3D,
404 OPCODE_PROGRAM_UNIFORM_4D,
405 OPCODE_PROGRAM_UNIFORM_1DV,
406 OPCODE_PROGRAM_UNIFORM_2DV,
407 OPCODE_PROGRAM_UNIFORM_3DV,
408 OPCODE_PROGRAM_UNIFORM_4DV,
409 OPCODE_PROGRAM_UNIFORM_1I,
410 OPCODE_PROGRAM_UNIFORM_2I,
411 OPCODE_PROGRAM_UNIFORM_3I,
412 OPCODE_PROGRAM_UNIFORM_4I,
413 OPCODE_PROGRAM_UNIFORM_1IV,
414 OPCODE_PROGRAM_UNIFORM_2IV,
415 OPCODE_PROGRAM_UNIFORM_3IV,
416 OPCODE_PROGRAM_UNIFORM_4IV,
417 OPCODE_PROGRAM_UNIFORM_1UI,
418 OPCODE_PROGRAM_UNIFORM_2UI,
419 OPCODE_PROGRAM_UNIFORM_3UI,
420 OPCODE_PROGRAM_UNIFORM_4UI,
421 OPCODE_PROGRAM_UNIFORM_1UIV,
422 OPCODE_PROGRAM_UNIFORM_2UIV,
423 OPCODE_PROGRAM_UNIFORM_3UIV,
424 OPCODE_PROGRAM_UNIFORM_4UIV,
425 OPCODE_PROGRAM_UNIFORM_MATRIX22F,
426 OPCODE_PROGRAM_UNIFORM_MATRIX33F,
427 OPCODE_PROGRAM_UNIFORM_MATRIX44F,
428 OPCODE_PROGRAM_UNIFORM_MATRIX23F,
429 OPCODE_PROGRAM_UNIFORM_MATRIX32F,
430 OPCODE_PROGRAM_UNIFORM_MATRIX24F,
431 OPCODE_PROGRAM_UNIFORM_MATRIX42F,
432 OPCODE_PROGRAM_UNIFORM_MATRIX34F,
433 OPCODE_PROGRAM_UNIFORM_MATRIX43F,
434 OPCODE_PROGRAM_UNIFORM_MATRIX22D,
435 OPCODE_PROGRAM_UNIFORM_MATRIX33D,
436 OPCODE_PROGRAM_UNIFORM_MATRIX44D,
437 OPCODE_PROGRAM_UNIFORM_MATRIX23D,
438 OPCODE_PROGRAM_UNIFORM_MATRIX32D,
439 OPCODE_PROGRAM_UNIFORM_MATRIX24D,
440 OPCODE_PROGRAM_UNIFORM_MATRIX42D,
441 OPCODE_PROGRAM_UNIFORM_MATRIX34D,
442 OPCODE_PROGRAM_UNIFORM_MATRIX43D,
443
444 /* GL_ARB_clip_control */
445 OPCODE_CLIP_CONTROL,
446
447 /* GL_ARB_color_buffer_float */
448 OPCODE_CLAMP_COLOR,
449
450 /* GL_EXT_framebuffer_blit */
451 OPCODE_BLIT_FRAMEBUFFER,
452
453 /* Vertex attributes -- fallback for when optimized display
454 * list build isn't active.
455 */
456 OPCODE_ATTR_1F_NV,
457 OPCODE_ATTR_2F_NV,
458 OPCODE_ATTR_3F_NV,
459 OPCODE_ATTR_4F_NV,
460 OPCODE_ATTR_1F_ARB,
461 OPCODE_ATTR_2F_ARB,
462 OPCODE_ATTR_3F_ARB,
463 OPCODE_ATTR_4F_ARB,
464 OPCODE_ATTR_1I,
465 OPCODE_ATTR_2I,
466 OPCODE_ATTR_3I,
467 OPCODE_ATTR_4I,
468 OPCODE_ATTR_1D,
469 OPCODE_ATTR_2D,
470 OPCODE_ATTR_3D,
471 OPCODE_ATTR_4D,
472 OPCODE_ATTR_1UI64,
473 OPCODE_MATERIAL,
474 OPCODE_BEGIN,
475 OPCODE_END,
476 OPCODE_EVAL_C1,
477 OPCODE_EVAL_C2,
478 OPCODE_EVAL_P1,
479 OPCODE_EVAL_P2,
480
481 /* GL_EXT_provoking_vertex */
482 OPCODE_PROVOKING_VERTEX,
483
484 /* GL_EXT_transform_feedback */
485 OPCODE_BEGIN_TRANSFORM_FEEDBACK,
486 OPCODE_END_TRANSFORM_FEEDBACK,
487 OPCODE_BIND_TRANSFORM_FEEDBACK,
488 OPCODE_PAUSE_TRANSFORM_FEEDBACK,
489 OPCODE_RESUME_TRANSFORM_FEEDBACK,
490 OPCODE_DRAW_TRANSFORM_FEEDBACK,
491
492 /* GL_EXT_texture_integer */
493 OPCODE_CLEARCOLOR_I,
494 OPCODE_CLEARCOLOR_UI,
495 OPCODE_TEXPARAMETER_I,
496 OPCODE_TEXPARAMETER_UI,
497
498 /* GL_ARB_instanced_arrays */
499 OPCODE_VERTEX_ATTRIB_DIVISOR,
500
501 /* GL_NV_texture_barrier */
502 OPCODE_TEXTURE_BARRIER_NV,
503
504 /* GL_ARB_sampler_object */
505 OPCODE_BIND_SAMPLER,
506 OPCODE_SAMPLER_PARAMETERIV,
507 OPCODE_SAMPLER_PARAMETERFV,
508 OPCODE_SAMPLER_PARAMETERIIV,
509 OPCODE_SAMPLER_PARAMETERUIV,
510
511 /* ARB_compute_shader */
512 OPCODE_DISPATCH_COMPUTE,
513
514 /* GL_ARB_sync */
515 OPCODE_WAIT_SYNC,
516
517 /* GL_NV_conditional_render */
518 OPCODE_BEGIN_CONDITIONAL_RENDER,
519 OPCODE_END_CONDITIONAL_RENDER,
520
521 /* ARB_timer_query */
522 OPCODE_QUERY_COUNTER,
523
524 /* ARB_transform_feedback3 */
525 OPCODE_BEGIN_QUERY_INDEXED,
526 OPCODE_END_QUERY_INDEXED,
527 OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM,
528
529 /* ARB_transform_feedback_instanced */
530 OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED,
531 OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED,
532
533 /* ARB_uniform_buffer_object */
534 OPCODE_UNIFORM_BLOCK_BINDING,
535
536 /* ARB_shader_subroutines */
537 OPCODE_UNIFORM_SUBROUTINES,
538
539 /* EXT_polygon_offset_clamp */
540 OPCODE_POLYGON_OFFSET_CLAMP,
541
542 /* EXT_window_rectangles */
543 OPCODE_WINDOW_RECTANGLES,
544
545 /* NV_conservative_raster */
546 OPCODE_SUBPIXEL_PRECISION_BIAS,
547
548 /* NV_conservative_raster_dilate */
549 OPCODE_CONSERVATIVE_RASTER_PARAMETER_F,
550
551 /* NV_conservative_raster_pre_snap_triangles */
552 OPCODE_CONSERVATIVE_RASTER_PARAMETER_I,
553
554 /* EXT_direct_state_access */
555 OPCODE_MATRIX_LOAD,
556 OPCODE_MATRIX_MULT,
557 OPCODE_MATRIX_ROTATE,
558 OPCODE_MATRIX_SCALE,
559 OPCODE_MATRIX_TRANSLATE,
560 OPCODE_MATRIX_LOAD_IDENTITY,
561 OPCODE_MATRIX_ORTHO,
562 OPCODE_MATRIX_FRUSTUM,
563 OPCODE_MATRIX_PUSH,
564 OPCODE_MATRIX_POP,
565 OPCODE_TEXTUREPARAMETER_F,
566 OPCODE_TEXTUREPARAMETER_I,
567 OPCODE_TEXTUREPARAMETER_II,
568 OPCODE_TEXTUREPARAMETER_IUI,
569 OPCODE_TEXTURE_IMAGE1D,
570 OPCODE_TEXTURE_IMAGE2D,
571 OPCODE_TEXTURE_IMAGE3D,
572 OPCODE_TEXTURE_SUB_IMAGE1D,
573 OPCODE_TEXTURE_SUB_IMAGE2D,
574 OPCODE_TEXTURE_SUB_IMAGE3D,
575 OPCODE_COPY_TEXTURE_IMAGE1D,
576 OPCODE_COPY_TEXTURE_IMAGE2D,
577 OPCODE_COPY_TEXTURE_SUB_IMAGE1D,
578 OPCODE_COPY_TEXTURE_SUB_IMAGE2D,
579 OPCODE_COPY_TEXTURE_SUB_IMAGE3D,
580 OPCODE_BIND_MULTITEXTURE,
581 OPCODE_MULTITEXPARAMETER_F,
582 OPCODE_MULTITEXPARAMETER_I,
583 OPCODE_MULTITEXPARAMETER_II,
584 OPCODE_MULTITEXPARAMETER_IUI,
585 OPCODE_MULTITEX_IMAGE1D,
586 OPCODE_MULTITEX_IMAGE2D,
587 OPCODE_MULTITEX_IMAGE3D,
588 OPCODE_MULTITEX_SUB_IMAGE1D,
589 OPCODE_MULTITEX_SUB_IMAGE2D,
590 OPCODE_MULTITEX_SUB_IMAGE3D,
591 OPCODE_COPY_MULTITEX_IMAGE1D,
592 OPCODE_COPY_MULTITEX_IMAGE2D,
593 OPCODE_COPY_MULTITEX_SUB_IMAGE1D,
594 OPCODE_COPY_MULTITEX_SUB_IMAGE2D,
595 OPCODE_COPY_MULTITEX_SUB_IMAGE3D,
596 OPCODE_MULTITEXENV,
597 OPCODE_COMPRESSED_TEXTURE_IMAGE_1D,
598 OPCODE_COMPRESSED_TEXTURE_IMAGE_2D,
599 OPCODE_COMPRESSED_TEXTURE_IMAGE_3D,
600 OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_1D,
601 OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_2D,
602 OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_3D,
603 OPCODE_COMPRESSED_MULTITEX_IMAGE_1D,
604 OPCODE_COMPRESSED_MULTITEX_IMAGE_2D,
605 OPCODE_COMPRESSED_MULTITEX_IMAGE_3D,
606 OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_1D,
607 OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_2D,
608 OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_3D,
609 OPCODE_NAMED_PROGRAM_STRING,
610 OPCODE_NAMED_PROGRAM_LOCAL_PARAMETER,
611
612 /* GL_ARB_ES3_2_compatibility */
613 OPCODE_PRIMITIVE_BOUNDING_BOX,
614
615 OPCODE_VERTEX_LIST,
616 OPCODE_VERTEX_LIST_LOOPBACK,
617 OPCODE_VERTEX_LIST_COPY_CURRENT,
618
619 /* The following three are meta instructions */
620 OPCODE_ERROR, /* raise compiled-in error */
621 OPCODE_CONTINUE,
622 OPCODE_END_OF_LIST
623 } OpCode;
624
625
626 typedef union gl_dlist_node Node;
627
628
629 /** How many 4-byte dwords to store a pointer */
630 #define POINTER_DWORDS (sizeof(void *) / 4)
631
632 /* We want to keep sizeof(union gl_dlist_node) == 4 to minimize
633 * space for display lists. The following types and functions are
634 * used to help store 4- and 8-byte pointers in 1 or 2 dlist_nodes.
635 */
636 union pointer
637 {
638 void *ptr;
639 GLuint dwords[POINTER_DWORDS];
640 };
641
642
643 /**
644 * Save a 4 or 8-byte pointer at dest (and dest+1).
645 */
646 static inline void
save_pointer(Node * dest,void * src)647 save_pointer(Node *dest, void *src)
648 {
649 union pointer p;
650 unsigned i;
651
652 STATIC_ASSERT(POINTER_DWORDS == 1 || POINTER_DWORDS == 2);
653 STATIC_ASSERT(sizeof(Node) == 4);
654
655 p.ptr = src;
656
657 for (i = 0; i < POINTER_DWORDS; i++)
658 dest[i].ui = p.dwords[i];
659 }
660
661
662 /**
663 * Retrieve a 4 or 8-byte pointer from node (node+1).
664 */
665 static inline void *
get_pointer(const Node * node)666 get_pointer(const Node *node)
667 {
668 union pointer p;
669 unsigned i;
670
671 for (i = 0; i < POINTER_DWORDS; i++)
672 p.dwords[i] = node[i].ui;
673
674 return p.ptr;
675 }
676
677
678 /**
679 * Used to store a 64-bit uint in a pair of "Nodes" for the sake of 32-bit
680 * environment.
681 */
682 union uint64_pair
683 {
684 GLuint64 uint64;
685 GLuint uint32[2];
686 };
687
688
689 union float64_pair
690 {
691 GLdouble d;
692 GLuint uint32[2];
693 };
694
695 union int64_pair
696 {
697 GLint64 int64;
698 GLint int32[2];
699 };
700
701 #define ASSIGN_DOUBLE_TO_NODES(n, idx, value) \
702 do { \
703 union float64_pair tmp; \
704 tmp.d = value; \
705 n[idx].ui = tmp.uint32[0]; \
706 n[idx+1].ui = tmp.uint32[1]; \
707 } while (0)
708
709 #define ASSIGN_UINT64_TO_NODES(n, idx, value) \
710 do { \
711 union uint64_pair tmp; \
712 tmp.uint64 = value; \
713 n[idx].ui = tmp.uint32[0]; \
714 n[idx+1].ui = tmp.uint32[1]; \
715 } while (0)
716
717 #define ASSIGN_INT64_TO_NODES(n, idx, value) \
718 do { \
719 union int64_pair tmp; \
720 tmp.int64 = value; \
721 n[idx].i = tmp.int32[0]; \
722 n[idx+1].i = tmp.int32[1]; \
723 } while (0)
724
725 /**
726 * How many nodes to allocate at a time. Note that bulk vertex data
727 * from glBegin/glVertex/glEnd primitives will typically wind up in
728 * a VBO, and not directly in the display list itself.
729 */
730 #define BLOCK_SIZE 256
731
732
733 void mesa_print_display_list(GLuint list);
734
735
736 /**
737 * Called by display list code when a display list is being deleted.
738 */
739 static void
vbo_destroy_vertex_list(struct gl_context * ctx,struct vbo_save_vertex_list * node)740 vbo_destroy_vertex_list(struct gl_context *ctx, struct vbo_save_vertex_list *node)
741 {
742 for (gl_vertex_processing_mode mode = VP_MODE_FF; mode < VP_MODE_MAX; ++mode) {
743 _mesa_reference_vao(ctx, &node->cold->VAO[mode], NULL);
744 if (node->private_refcount[mode]) {
745 assert(node->private_refcount[mode] > 0);
746 p_atomic_add(&node->state[mode]->reference.count,
747 -node->private_refcount[mode]);
748 }
749 pipe_vertex_state_reference(&node->state[mode], NULL);
750 }
751
752 if (node->modes) {
753 free(node->modes);
754 free(node->start_counts);
755 }
756
757 _mesa_reference_buffer_object(ctx, &node->cold->ib.obj, NULL);
758 free(node->cold->current_data);
759 node->cold->current_data = NULL;
760
761 free(node->cold->prims);
762 free(node->cold);
763 }
764
765 static void
vbo_print_vertex_list(struct gl_context * ctx,struct vbo_save_vertex_list * node,OpCode op,FILE * f)766 vbo_print_vertex_list(struct gl_context *ctx, struct vbo_save_vertex_list *node, OpCode op, FILE *f)
767 {
768 GLuint i;
769 struct gl_buffer_object *buffer = node->cold->VAO[0]->BufferBinding[0].BufferObj;
770 const GLuint vertex_size = _vbo_save_get_stride(node)/sizeof(GLfloat);
771 (void) ctx;
772
773 const char *label[] = {
774 "VBO-VERTEX-LIST", "VBO-VERTEX-LIST-LOOPBACK", "VBO-VERTEX-LIST-COPY-CURRENT"
775 };
776
777 fprintf(f, "%s, %u vertices, %d primitives, %d vertsize, "
778 "buffer %p\n",
779 label[op - OPCODE_VERTEX_LIST],
780 node->cold->vertex_count, node->cold->prim_count, vertex_size,
781 buffer);
782
783 for (i = 0; i < node->cold->prim_count; i++) {
784 struct _mesa_prim *prim = &node->cold->prims[i];
785 fprintf(f, " prim %d: %s %d..%d %s %s\n",
786 i,
787 _mesa_lookup_prim_by_nr(prim->mode),
788 prim->start,
789 prim->start + prim->count,
790 (prim->begin) ? "BEGIN" : "(wrap)",
791 (prim->end) ? "END" : "(wrap)");
792 }
793 }
794
795
796 static inline
get_list_head(struct gl_context * ctx,struct gl_display_list * dlist)797 Node *get_list_head(struct gl_context *ctx, struct gl_display_list *dlist)
798 {
799 return dlist->small_list ?
800 &ctx->Shared->small_dlist_store.ptr[dlist->start] :
801 dlist->Head;
802 }
803
804
805 /**
806 * Does the given display list only contain a single glBitmap call?
807 */
808 static bool
is_bitmap_list(struct gl_context * ctx,struct gl_display_list * dlist)809 is_bitmap_list(struct gl_context *ctx, struct gl_display_list *dlist)
810 {
811 Node *n = get_list_head(ctx, dlist);
812 if (n[0].opcode == OPCODE_BITMAP) {
813 n += n[0].InstSize;
814 if (n[0].opcode == OPCODE_END_OF_LIST)
815 return true;
816 }
817 return false;
818 }
819
820
821 /**
822 * Is the given display list an empty list?
823 */
824 static bool
is_empty_list(struct gl_context * ctx,struct gl_display_list * dlist)825 is_empty_list(struct gl_context *ctx, struct gl_display_list *dlist)
826 {
827 Node *n = get_list_head(ctx, dlist);
828 return n[0].opcode == OPCODE_END_OF_LIST;
829 }
830
831
832 /**
833 * Delete/free a gl_bitmap_atlas. Called during context tear-down.
834 */
835 void
_mesa_delete_bitmap_atlas(struct gl_context * ctx,struct gl_bitmap_atlas * atlas)836 _mesa_delete_bitmap_atlas(struct gl_context *ctx, struct gl_bitmap_atlas *atlas)
837 {
838 if (atlas->texObj) {
839 _mesa_delete_texture_object(ctx, atlas->texObj);
840 }
841 free(atlas->glyphs);
842 free(atlas);
843 }
844
845
846 /**
847 * Lookup a gl_bitmap_atlas by listBase ID.
848 */
849 static struct gl_bitmap_atlas *
lookup_bitmap_atlas(struct gl_context * ctx,GLuint listBase)850 lookup_bitmap_atlas(struct gl_context *ctx, GLuint listBase)
851 {
852 struct gl_bitmap_atlas *atlas;
853
854 assert(listBase > 0);
855 atlas = _mesa_HashLookup(ctx->Shared->BitmapAtlas, listBase);
856 return atlas;
857 }
858
859
860 /**
861 * Create new bitmap atlas and insert into hash table.
862 */
863 static struct gl_bitmap_atlas *
alloc_bitmap_atlas(struct gl_context * ctx,GLuint listBase,bool isGenName)864 alloc_bitmap_atlas(struct gl_context *ctx, GLuint listBase, bool isGenName)
865 {
866 struct gl_bitmap_atlas *atlas;
867
868 assert(listBase > 0);
869 assert(_mesa_HashLookup(ctx->Shared->BitmapAtlas, listBase) == NULL);
870
871 atlas = calloc(1, sizeof(*atlas));
872 if (atlas) {
873 _mesa_HashInsert(ctx->Shared->BitmapAtlas, listBase, atlas, isGenName);
874 atlas->Id = listBase;
875 }
876
877 return atlas;
878 }
879
880
881 /**
882 * Try to build a bitmap atlas. This involves examining a sequence of
883 * display lists which contain glBitmap commands and putting the bitmap
884 * images into a texture map (the atlas).
885 * If we succeed, gl_bitmap_atlas::complete will be set to true.
886 * If we fail, gl_bitmap_atlas::incomplete will be set to true.
887 */
888 static void
build_bitmap_atlas(struct gl_context * ctx,struct gl_bitmap_atlas * atlas,GLuint listBase)889 build_bitmap_atlas(struct gl_context *ctx, struct gl_bitmap_atlas *atlas,
890 GLuint listBase)
891 {
892 unsigned i, row_height = 0, xpos = 0, ypos = 0;
893 GLubyte *map;
894 GLint map_stride;
895
896 assert(atlas);
897 assert(!atlas->complete);
898 assert(atlas->numBitmaps > 0);
899
900 /* We use a rectangle texture (non-normalized coords) for the atlas */
901 assert(ctx->Extensions.NV_texture_rectangle);
902 assert(ctx->Const.MaxTextureRectSize >= 1024);
903
904 atlas->texWidth = 1024;
905 atlas->texHeight = 0; /* determined below */
906
907 atlas->glyphs = malloc(atlas->numBitmaps * sizeof(atlas->glyphs[0]));
908 if (!atlas->glyphs) {
909 /* give up */
910 atlas->incomplete = true;
911 return;
912 }
913
914 /* Loop over the display lists. They should all contain a single glBitmap
915 * call. If not, bail out. Also, compute the position and sizes of each
916 * bitmap in the atlas to determine the texture atlas size.
917 */
918 for (i = 0; i < atlas->numBitmaps; i++) {
919 struct gl_display_list *list = _mesa_lookup_list(ctx, listBase + i, true);
920 const Node *n;
921 struct gl_bitmap_glyph *g = &atlas->glyphs[i];
922 unsigned bitmap_width, bitmap_height;
923 float bitmap_xmove, bitmap_ymove, bitmap_xorig, bitmap_yorig;
924
925 if (!list || is_empty_list(ctx, list)) {
926 /* stop here */
927 atlas->numBitmaps = i;
928 break;
929 }
930
931 if (!is_bitmap_list(ctx, list)) {
932 /* This list does not contain exactly one glBitmap command. Give up. */
933 atlas->incomplete = true;
934 return;
935 }
936
937 /* get bitmap info from the display list command */
938 n = get_list_head(ctx, list);
939 assert(n[0].opcode == OPCODE_BITMAP);
940 bitmap_width = n[1].i;
941 bitmap_height = n[2].i;
942 bitmap_xorig = n[3].f;
943 bitmap_yorig = n[4].f;
944 bitmap_xmove = n[5].f;
945 bitmap_ymove = n[6].f;
946
947 if (xpos + bitmap_width > atlas->texWidth) {
948 /* advance to the next row of the texture */
949 xpos = 0;
950 ypos += row_height;
951 row_height = 0;
952 }
953
954 /* save the bitmap's position in the atlas */
955 g->x = xpos;
956 g->y = ypos;
957 g->w = bitmap_width;
958 g->h = bitmap_height;
959 g->xorig = bitmap_xorig;
960 g->yorig = bitmap_yorig;
961 g->xmove = bitmap_xmove;
962 g->ymove = bitmap_ymove;
963
964 xpos += bitmap_width;
965
966 /* keep track of tallest bitmap in the row */
967 row_height = MAX2(row_height, bitmap_height);
968 }
969
970 /* Now we know the texture height */
971 atlas->texHeight = ypos + row_height;
972
973 if (atlas->texHeight == 0) {
974 /* no glyphs found, give up */
975 goto fail;
976 }
977 else if (atlas->texHeight > ctx->Const.MaxTextureRectSize) {
978 /* too large, give up */
979 goto fail;
980 }
981
982 /* Create atlas texture (texture ID is irrelevant) */
983 atlas->texObj = _mesa_new_texture_object(ctx, 999, GL_TEXTURE_RECTANGLE);
984 if (!atlas->texObj) {
985 goto out_of_memory;
986 }
987
988 atlas->texObj->Sampler.Attrib.MinFilter = GL_NEAREST;
989 atlas->texObj->Sampler.Attrib.MagFilter = GL_NEAREST;
990 atlas->texObj->Sampler.Attrib.state.min_img_filter = PIPE_TEX_FILTER_NEAREST;
991 atlas->texObj->Sampler.Attrib.state.min_mip_filter = PIPE_TEX_MIPFILTER_NONE;
992 atlas->texObj->Sampler.Attrib.state.mag_img_filter = PIPE_TEX_FILTER_NEAREST;
993 atlas->texObj->Attrib.MaxLevel = 0;
994 atlas->texObj->Immutable = GL_TRUE;
995
996 atlas->texImage = _mesa_get_tex_image(ctx, atlas->texObj,
997 GL_TEXTURE_RECTANGLE, 0);
998 if (!atlas->texImage) {
999 goto out_of_memory;
1000 }
1001
1002 if (ctx->Const.BitmapUsesRed)
1003 _mesa_init_teximage_fields(ctx, atlas->texImage,
1004 atlas->texWidth, atlas->texHeight, 1, 0,
1005 GL_RED, MESA_FORMAT_R_UNORM8);
1006 else
1007 _mesa_init_teximage_fields(ctx, atlas->texImage,
1008 atlas->texWidth, atlas->texHeight, 1, 0,
1009 GL_ALPHA, MESA_FORMAT_A_UNORM8);
1010
1011 /* alloc image storage */
1012 if (!st_AllocTextureImageBuffer(ctx, atlas->texImage)) {
1013 goto out_of_memory;
1014 }
1015
1016 /* map teximage, load with bitmap glyphs */
1017 st_MapTextureImage(ctx, atlas->texImage, 0,
1018 0, 0, atlas->texWidth, atlas->texHeight,
1019 GL_MAP_WRITE_BIT, &map, &map_stride);
1020 if (!map) {
1021 goto out_of_memory;
1022 }
1023
1024 /* Background/clear pixels are 0xff, foreground/set pixels are 0x0 */
1025 memset(map, 0xff, map_stride * atlas->texHeight);
1026
1027 for (i = 0; i < atlas->numBitmaps; i++) {
1028 struct gl_display_list *list = _mesa_lookup_list(ctx, listBase + i, true);
1029 const Node *n = get_list_head(ctx, list);
1030
1031 assert(n[0].opcode == OPCODE_BITMAP ||
1032 n[0].opcode == OPCODE_END_OF_LIST);
1033
1034 if (n[0].opcode == OPCODE_BITMAP) {
1035 unsigned bitmap_width = n[1].i;
1036 unsigned bitmap_height = n[2].i;
1037 unsigned xpos = atlas->glyphs[i].x;
1038 unsigned ypos = atlas->glyphs[i].y;
1039 const void *bitmap_image = get_pointer(&n[7]);
1040
1041 assert(atlas->glyphs[i].w == bitmap_width);
1042 assert(atlas->glyphs[i].h == bitmap_height);
1043
1044 /* put the bitmap image into the texture image */
1045 _mesa_expand_bitmap(bitmap_width, bitmap_height,
1046 &ctx->DefaultPacking, bitmap_image,
1047 map + map_stride * ypos + xpos, /* dest addr */
1048 map_stride, 0x0);
1049 }
1050 }
1051
1052 st_UnmapTextureImage(ctx, atlas->texImage, 0);
1053
1054 atlas->complete = true;
1055
1056 return;
1057
1058 out_of_memory:
1059 _mesa_error(ctx, GL_OUT_OF_MEMORY, "Display list bitmap atlas");
1060 fail:
1061 if (atlas->texObj) {
1062 _mesa_delete_texture_object(ctx, atlas->texObj);
1063 }
1064 free(atlas->glyphs);
1065 atlas->glyphs = NULL;
1066 atlas->incomplete = true;
1067 }
1068
1069
1070 /**
1071 * Allocate a gl_display_list object with an initial block of storage.
1072 * \param count how many display list nodes/tokens to allocate
1073 */
1074 static struct gl_display_list *
make_list(GLuint name,GLuint count)1075 make_list(GLuint name, GLuint count)
1076 {
1077 struct gl_display_list *dlist = CALLOC_STRUCT(gl_display_list);
1078 dlist->Name = name;
1079 dlist->Head = malloc(sizeof(Node) * count);
1080 dlist->Head[0].opcode = OPCODE_END_OF_LIST;
1081 return dlist;
1082 }
1083
1084
1085 /**
1086 * Lookup function to just encapsulate casting.
1087 */
1088 struct gl_display_list *
_mesa_lookup_list(struct gl_context * ctx,GLuint list,bool locked)1089 _mesa_lookup_list(struct gl_context *ctx, GLuint list, bool locked)
1090 {
1091 return (struct gl_display_list *)
1092 _mesa_HashLookupMaybeLocked(ctx->Shared->DisplayList, list, locked);
1093 }
1094
1095
1096 /**
1097 * Delete the named display list, but don't remove from hash table.
1098 * \param dlist - display list pointer
1099 */
1100 void
_mesa_delete_list(struct gl_context * ctx,struct gl_display_list * dlist)1101 _mesa_delete_list(struct gl_context *ctx, struct gl_display_list *dlist)
1102 {
1103 Node *n, *block;
1104
1105 n = block = get_list_head(ctx, dlist);
1106
1107 if (!n) {
1108 free(dlist->Label);
1109 FREE(dlist);
1110 return;
1111 }
1112
1113 while (1) {
1114 const OpCode opcode = n[0].opcode;
1115
1116 switch (opcode) {
1117 /* for some commands, we need to free malloc'd memory */
1118 case OPCODE_MAP1:
1119 free(get_pointer(&n[6]));
1120 break;
1121 case OPCODE_MAP2:
1122 free(get_pointer(&n[10]));
1123 break;
1124 case OPCODE_CALL_LISTS:
1125 free(get_pointer(&n[3]));
1126 break;
1127 case OPCODE_DRAW_PIXELS:
1128 free(get_pointer(&n[5]));
1129 break;
1130 case OPCODE_BITMAP:
1131 free(get_pointer(&n[7]));
1132 break;
1133 case OPCODE_POLYGON_STIPPLE:
1134 free(get_pointer(&n[1]));
1135 break;
1136 case OPCODE_TEX_IMAGE1D:
1137 free(get_pointer(&n[8]));
1138 break;
1139 case OPCODE_TEX_IMAGE2D:
1140 free(get_pointer(&n[9]));
1141 break;
1142 case OPCODE_TEX_IMAGE3D:
1143 free(get_pointer(&n[10]));
1144 break;
1145 case OPCODE_TEX_SUB_IMAGE1D:
1146 free(get_pointer(&n[7]));
1147 break;
1148 case OPCODE_TEX_SUB_IMAGE2D:
1149 free(get_pointer(&n[9]));
1150 break;
1151 case OPCODE_TEX_SUB_IMAGE3D:
1152 free(get_pointer(&n[11]));
1153 break;
1154 case OPCODE_COMPRESSED_TEX_IMAGE_1D:
1155 free(get_pointer(&n[7]));
1156 break;
1157 case OPCODE_COMPRESSED_TEX_IMAGE_2D:
1158 free(get_pointer(&n[8]));
1159 break;
1160 case OPCODE_COMPRESSED_TEX_IMAGE_3D:
1161 free(get_pointer(&n[9]));
1162 break;
1163 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D:
1164 free(get_pointer(&n[7]));
1165 break;
1166 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D:
1167 free(get_pointer(&n[9]));
1168 break;
1169 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D:
1170 free(get_pointer(&n[11]));
1171 break;
1172 case OPCODE_PROGRAM_STRING_ARB:
1173 free(get_pointer(&n[4])); /* program string */
1174 break;
1175 case OPCODE_UNIFORM_1FV:
1176 case OPCODE_UNIFORM_2FV:
1177 case OPCODE_UNIFORM_3FV:
1178 case OPCODE_UNIFORM_4FV:
1179 case OPCODE_UNIFORM_1DV:
1180 case OPCODE_UNIFORM_2DV:
1181 case OPCODE_UNIFORM_3DV:
1182 case OPCODE_UNIFORM_4DV:
1183 case OPCODE_UNIFORM_1IV:
1184 case OPCODE_UNIFORM_2IV:
1185 case OPCODE_UNIFORM_3IV:
1186 case OPCODE_UNIFORM_4IV:
1187 case OPCODE_UNIFORM_1UIV:
1188 case OPCODE_UNIFORM_2UIV:
1189 case OPCODE_UNIFORM_3UIV:
1190 case OPCODE_UNIFORM_4UIV:
1191 case OPCODE_UNIFORM_1I64V:
1192 case OPCODE_UNIFORM_2I64V:
1193 case OPCODE_UNIFORM_3I64V:
1194 case OPCODE_UNIFORM_4I64V:
1195 case OPCODE_UNIFORM_1UI64V:
1196 case OPCODE_UNIFORM_2UI64V:
1197 case OPCODE_UNIFORM_3UI64V:
1198 case OPCODE_UNIFORM_4UI64V:
1199 free(get_pointer(&n[3]));
1200 break;
1201 case OPCODE_UNIFORM_MATRIX22:
1202 case OPCODE_UNIFORM_MATRIX33:
1203 case OPCODE_UNIFORM_MATRIX44:
1204 case OPCODE_UNIFORM_MATRIX24:
1205 case OPCODE_UNIFORM_MATRIX42:
1206 case OPCODE_UNIFORM_MATRIX23:
1207 case OPCODE_UNIFORM_MATRIX32:
1208 case OPCODE_UNIFORM_MATRIX34:
1209 case OPCODE_UNIFORM_MATRIX43:
1210 case OPCODE_UNIFORM_MATRIX22D:
1211 case OPCODE_UNIFORM_MATRIX33D:
1212 case OPCODE_UNIFORM_MATRIX44D:
1213 case OPCODE_UNIFORM_MATRIX24D:
1214 case OPCODE_UNIFORM_MATRIX42D:
1215 case OPCODE_UNIFORM_MATRIX23D:
1216 case OPCODE_UNIFORM_MATRIX32D:
1217 case OPCODE_UNIFORM_MATRIX34D:
1218 case OPCODE_UNIFORM_MATRIX43D:
1219 free(get_pointer(&n[4]));
1220 break;
1221 case OPCODE_PROGRAM_UNIFORM_1FV:
1222 case OPCODE_PROGRAM_UNIFORM_2FV:
1223 case OPCODE_PROGRAM_UNIFORM_3FV:
1224 case OPCODE_PROGRAM_UNIFORM_4FV:
1225 case OPCODE_PROGRAM_UNIFORM_1DV:
1226 case OPCODE_PROGRAM_UNIFORM_2DV:
1227 case OPCODE_PROGRAM_UNIFORM_3DV:
1228 case OPCODE_PROGRAM_UNIFORM_4DV:
1229 case OPCODE_PROGRAM_UNIFORM_1IV:
1230 case OPCODE_PROGRAM_UNIFORM_2IV:
1231 case OPCODE_PROGRAM_UNIFORM_3IV:
1232 case OPCODE_PROGRAM_UNIFORM_4IV:
1233 case OPCODE_PROGRAM_UNIFORM_1UIV:
1234 case OPCODE_PROGRAM_UNIFORM_2UIV:
1235 case OPCODE_PROGRAM_UNIFORM_3UIV:
1236 case OPCODE_PROGRAM_UNIFORM_4UIV:
1237 case OPCODE_PROGRAM_UNIFORM_1I64V:
1238 case OPCODE_PROGRAM_UNIFORM_2I64V:
1239 case OPCODE_PROGRAM_UNIFORM_3I64V:
1240 case OPCODE_PROGRAM_UNIFORM_4I64V:
1241 case OPCODE_PROGRAM_UNIFORM_1UI64V:
1242 case OPCODE_PROGRAM_UNIFORM_2UI64V:
1243 case OPCODE_PROGRAM_UNIFORM_3UI64V:
1244 case OPCODE_PROGRAM_UNIFORM_4UI64V:
1245 free(get_pointer(&n[4]));
1246 break;
1247 case OPCODE_PROGRAM_UNIFORM_MATRIX22F:
1248 case OPCODE_PROGRAM_UNIFORM_MATRIX33F:
1249 case OPCODE_PROGRAM_UNIFORM_MATRIX44F:
1250 case OPCODE_PROGRAM_UNIFORM_MATRIX24F:
1251 case OPCODE_PROGRAM_UNIFORM_MATRIX42F:
1252 case OPCODE_PROGRAM_UNIFORM_MATRIX23F:
1253 case OPCODE_PROGRAM_UNIFORM_MATRIX32F:
1254 case OPCODE_PROGRAM_UNIFORM_MATRIX34F:
1255 case OPCODE_PROGRAM_UNIFORM_MATRIX43F:
1256 case OPCODE_PROGRAM_UNIFORM_MATRIX22D:
1257 case OPCODE_PROGRAM_UNIFORM_MATRIX33D:
1258 case OPCODE_PROGRAM_UNIFORM_MATRIX44D:
1259 case OPCODE_PROGRAM_UNIFORM_MATRIX24D:
1260 case OPCODE_PROGRAM_UNIFORM_MATRIX42D:
1261 case OPCODE_PROGRAM_UNIFORM_MATRIX23D:
1262 case OPCODE_PROGRAM_UNIFORM_MATRIX32D:
1263 case OPCODE_PROGRAM_UNIFORM_MATRIX34D:
1264 case OPCODE_PROGRAM_UNIFORM_MATRIX43D:
1265 free(get_pointer(&n[5]));
1266 break;
1267 case OPCODE_PIXEL_MAP:
1268 free(get_pointer(&n[3]));
1269 break;
1270 case OPCODE_VIEWPORT_ARRAY_V:
1271 case OPCODE_SCISSOR_ARRAY_V:
1272 case OPCODE_DEPTH_ARRAY_V:
1273 case OPCODE_UNIFORM_SUBROUTINES:
1274 case OPCODE_WINDOW_RECTANGLES:
1275 free(get_pointer(&n[3]));
1276 break;
1277 case OPCODE_TEXTURE_IMAGE1D:
1278 case OPCODE_MULTITEX_IMAGE1D:
1279 free(get_pointer(&n[9]));
1280 break;
1281 case OPCODE_TEXTURE_IMAGE2D:
1282 case OPCODE_MULTITEX_IMAGE2D:
1283 free(get_pointer(&n[10]));
1284 break;
1285 case OPCODE_TEXTURE_IMAGE3D:
1286 case OPCODE_MULTITEX_IMAGE3D:
1287 free(get_pointer(&n[11]));
1288 break;
1289 case OPCODE_TEXTURE_SUB_IMAGE1D:
1290 case OPCODE_MULTITEX_SUB_IMAGE1D:
1291 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_1D:
1292 case OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_1D:
1293 free(get_pointer(&n[8]));
1294 break;
1295 case OPCODE_TEXTURE_SUB_IMAGE2D:
1296 case OPCODE_MULTITEX_SUB_IMAGE2D:
1297 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_2D:
1298 case OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_2D:
1299 free(get_pointer(&n[10]));
1300 break;
1301 case OPCODE_TEXTURE_SUB_IMAGE3D:
1302 case OPCODE_MULTITEX_SUB_IMAGE3D:
1303 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_3D:
1304 case OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_3D:
1305 free(get_pointer(&n[12]));
1306 break;
1307 case OPCODE_COMPRESSED_TEXTURE_IMAGE_1D:
1308 case OPCODE_COMPRESSED_MULTITEX_IMAGE_1D:
1309 free(get_pointer(&n[8]));
1310 break;
1311 case OPCODE_COMPRESSED_TEXTURE_IMAGE_2D:
1312 case OPCODE_COMPRESSED_MULTITEX_IMAGE_2D:
1313 free(get_pointer(&n[9]));
1314 break;
1315 case OPCODE_COMPRESSED_TEXTURE_IMAGE_3D:
1316 case OPCODE_COMPRESSED_MULTITEX_IMAGE_3D:
1317 free(get_pointer(&n[10]));
1318 break;
1319 case OPCODE_NAMED_PROGRAM_STRING:
1320 free(get_pointer(&n[5]));
1321 break;
1322 case OPCODE_VERTEX_LIST:
1323 case OPCODE_VERTEX_LIST_LOOPBACK:
1324 case OPCODE_VERTEX_LIST_COPY_CURRENT:
1325 vbo_destroy_vertex_list(ctx, (struct vbo_save_vertex_list *) &n[0]);
1326 break;
1327 case OPCODE_CONTINUE:
1328 n = (Node *) get_pointer(&n[1]);
1329 assert (!dlist->small_list);
1330 free(block);
1331 block = n;
1332 continue;
1333 case OPCODE_END_OF_LIST:
1334 if (dlist->small_list) {
1335 unsigned start = dlist->start;
1336 for (int i = 0; i < dlist->count; i++) {
1337 util_idalloc_free(&ctx->Shared->small_dlist_store.free_idx,
1338 start + i);
1339 }
1340 } else {
1341 free(block);
1342 }
1343 free(dlist->Label);
1344 free(dlist);
1345 return;
1346 default:
1347 /* just increment 'n' pointer, below */
1348 ;
1349 }
1350
1351 assert(n[0].InstSize > 0);
1352 n += n[0].InstSize;
1353 }
1354 }
1355
1356
1357 /**
1358 * Called by _mesa_HashWalk() to check if a display list which is being
1359 * deleted belongs to a bitmap texture atlas.
1360 */
1361 static void
check_atlas_for_deleted_list(void * data,void * userData)1362 check_atlas_for_deleted_list(void *data, void *userData)
1363 {
1364 struct gl_bitmap_atlas *atlas = (struct gl_bitmap_atlas *) data;
1365 GLuint list_id = *((GLuint *) userData); /* the list being deleted */
1366 const GLuint atlas_id = atlas->Id;
1367
1368 /* See if the list_id falls in the range contained in this texture atlas */
1369 if (atlas->complete &&
1370 list_id >= atlas_id &&
1371 list_id < atlas_id + atlas->numBitmaps) {
1372 /* Mark the atlas as incomplete so it doesn't get used. But don't
1373 * delete it yet since we don't want to try to recreate it in the next
1374 * glCallLists.
1375 */
1376 atlas->complete = false;
1377 atlas->incomplete = true;
1378 }
1379 }
1380
1381
1382 /**
1383 * Destroy a display list and remove from hash table.
1384 * \param list - display list number
1385 */
1386 static void
destroy_list(struct gl_context * ctx,GLuint list)1387 destroy_list(struct gl_context *ctx, GLuint list)
1388 {
1389 struct gl_display_list *dlist;
1390
1391 if (list == 0)
1392 return;
1393
1394 dlist = _mesa_lookup_list(ctx, list, true);
1395 if (!dlist)
1396 return;
1397
1398 if (is_bitmap_list(ctx, dlist)) {
1399 /* If we're destroying a simple glBitmap display list, there's a
1400 * chance that we're destroying a bitmap image that's in a texture
1401 * atlas. Examine all atlases to see if that's the case. There's
1402 * usually few (if any) atlases so this isn't expensive.
1403 */
1404 _mesa_HashWalk(ctx->Shared->BitmapAtlas,
1405 check_atlas_for_deleted_list, &list);
1406 }
1407
1408 _mesa_delete_list(ctx, dlist);
1409 _mesa_HashRemoveLocked(ctx->Shared->DisplayList, list);
1410 }
1411
1412
1413 /**
1414 * Wrapper for _mesa_unpack_image/bitmap() that handles pixel buffer objects.
1415 * If width < 0 or height < 0 or format or type are invalid we'll just
1416 * return NULL. We will not generate an error since OpenGL command
1417 * arguments aren't error-checked until the command is actually executed
1418 * (not when they're compiled).
1419 * But if we run out of memory, GL_OUT_OF_MEMORY will be recorded.
1420 */
1421 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)1422 unpack_image(struct gl_context *ctx, GLuint dimensions,
1423 GLsizei width, GLsizei height, GLsizei depth,
1424 GLenum format, GLenum type, const GLvoid * pixels,
1425 const struct gl_pixelstore_attrib *unpack)
1426 {
1427 if (width <= 0 || height <= 0) {
1428 return NULL;
1429 }
1430
1431 if (_mesa_bytes_per_pixel(format, type) < 0) {
1432 /* bad format and/or type */
1433 return NULL;
1434 }
1435
1436 if (!unpack->BufferObj) {
1437 /* no PBO */
1438 GLvoid *image;
1439
1440 image = _mesa_unpack_image(dimensions, width, height, depth,
1441 format, type, pixels, unpack);
1442 if (pixels && !image) {
1443 _mesa_error(ctx, GL_OUT_OF_MEMORY, "display list construction");
1444 }
1445 return image;
1446 }
1447 else if (_mesa_validate_pbo_access(dimensions, unpack, width, height,
1448 depth, format, type, INT_MAX, pixels)) {
1449 const GLubyte *map, *src;
1450 GLvoid *image;
1451
1452 map = (GLubyte *)
1453 _mesa_bufferobj_map_range(ctx, 0, unpack->BufferObj->Size,
1454 GL_MAP_READ_BIT, unpack->BufferObj,
1455 MAP_INTERNAL);
1456 if (!map) {
1457 /* unable to map src buffer! */
1458 _mesa_error(ctx, GL_INVALID_OPERATION, "unable to map PBO");
1459 return NULL;
1460 }
1461
1462 src = ADD_POINTERS(map, pixels);
1463 image = _mesa_unpack_image(dimensions, width, height, depth,
1464 format, type, src, unpack);
1465
1466 _mesa_bufferobj_unmap(ctx, unpack->BufferObj, MAP_INTERNAL);
1467
1468 if (!image) {
1469 _mesa_error(ctx, GL_OUT_OF_MEMORY, "display list construction");
1470 }
1471 return image;
1472 }
1473
1474 /* bad access! */
1475 _mesa_error(ctx, GL_INVALID_OPERATION, "invalid PBO access");
1476 return NULL;
1477 }
1478
1479
1480 /** Return copy of memory */
1481 static void *
memdup(const void * src,GLsizei bytes)1482 memdup(const void *src, GLsizei bytes)
1483 {
1484 void *b = bytes >= 0 ? malloc(bytes) : NULL;
1485 if (b)
1486 memcpy(b, src, bytes);
1487 return b;
1488 }
1489
1490
1491 /**
1492 * Allocate space for a display list instruction (opcode + payload space).
1493 * \param opcode the instruction opcode (OPCODE_* value)
1494 * \param bytes instruction payload size (not counting opcode)
1495 * \param align8 does the payload need to be 8-byte aligned?
1496 * This is only relevant in 64-bit environments.
1497 * \return pointer to allocated memory (the payload will be at pointer+1)
1498 */
1499 static Node *
dlist_alloc(struct gl_context * ctx,OpCode opcode,GLuint bytes,bool align8)1500 dlist_alloc(struct gl_context *ctx, OpCode opcode, GLuint bytes, bool align8)
1501 {
1502 const GLuint numNodes = 1 + (bytes + sizeof(Node) - 1) / sizeof(Node);
1503 const GLuint contNodes = 1 + POINTER_DWORDS; /* size of continue info */
1504
1505 assert(bytes <= BLOCK_SIZE * sizeof(Node));
1506
1507 /* If this node needs to start on an 8-byte boundary, pad the last node. */
1508 if (sizeof(void *) == 8 && align8 &&
1509 ctx->ListState.CurrentPos % 2 == 1) {
1510 Node *last = ctx->ListState.CurrentBlock + ctx->ListState.CurrentPos -
1511 ctx->ListState.LastInstSize;
1512 last->InstSize++;
1513 ctx->ListState.CurrentPos++;
1514 }
1515
1516 if (ctx->ListState.CurrentPos + numNodes + contNodes > BLOCK_SIZE) {
1517 /* This block is full. Allocate a new block and chain to it */
1518 Node *newblock;
1519 Node *n = ctx->ListState.CurrentBlock + ctx->ListState.CurrentPos;
1520 n[0].opcode = OPCODE_CONTINUE;
1521 newblock = malloc(sizeof(Node) * BLOCK_SIZE);
1522 if (!newblock) {
1523 _mesa_error(ctx, GL_OUT_OF_MEMORY, "Building display list");
1524 return NULL;
1525 }
1526
1527 /* a fresh block should be 8-byte aligned on 64-bit systems */
1528 assert(((GLintptr) newblock) % sizeof(void *) == 0);
1529
1530 save_pointer(&n[1], newblock);
1531 ctx->ListState.CurrentBlock = newblock;
1532 ctx->ListState.CurrentPos = 0;
1533 }
1534
1535 Node *n = ctx->ListState.CurrentBlock + ctx->ListState.CurrentPos;
1536 ctx->ListState.CurrentPos += numNodes;
1537
1538 n[0].opcode = opcode;
1539 n[0].InstSize = numNodes;
1540 ctx->ListState.LastInstSize = numNodes;
1541
1542 return n;
1543 }
1544
1545
1546 void *
_mesa_dlist_alloc_vertex_list(struct gl_context * ctx,bool copy_to_current)1547 _mesa_dlist_alloc_vertex_list(struct gl_context *ctx, bool copy_to_current)
1548 {
1549 Node *n = dlist_alloc(ctx,
1550 copy_to_current ? OPCODE_VERTEX_LIST_COPY_CURRENT :
1551 OPCODE_VERTEX_LIST,
1552 sizeof(struct vbo_save_vertex_list) - sizeof(Node),
1553 true);
1554 if (!n)
1555 return NULL;
1556
1557 /* Clear all nodes except the header */
1558 memset(n + 1, 0, sizeof(struct vbo_save_vertex_list) - sizeof(Node));
1559 return n;
1560 }
1561
1562
1563 /**
1564 * Allocate space for a display list instruction. The space is basically
1565 * an array of Nodes where node[0] holds the opcode, node[1] is the first
1566 * function parameter, node[2] is the second parameter, etc.
1567 *
1568 * \param opcode one of OPCODE_x
1569 * \param nparams number of function parameters
1570 * \return pointer to start of instruction space
1571 */
1572 static inline Node *
alloc_instruction(struct gl_context * ctx,OpCode opcode,GLuint nparams)1573 alloc_instruction(struct gl_context *ctx, OpCode opcode, GLuint nparams)
1574 {
1575 return dlist_alloc(ctx, opcode, nparams * sizeof(Node), false);
1576 }
1577
1578
1579 /*
1580 * Display List compilation functions
1581 */
1582 void GLAPIENTRY
save_Accum(GLenum op,GLfloat value)1583 save_Accum(GLenum op, GLfloat value)
1584 {
1585 GET_CURRENT_CONTEXT(ctx);
1586 Node *n;
1587 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1588 n = alloc_instruction(ctx, OPCODE_ACCUM, 2);
1589 if (n) {
1590 n[1].e = op;
1591 n[2].f = value;
1592 }
1593 if (ctx->ExecuteFlag) {
1594 CALL_Accum(ctx->Exec, (op, value));
1595 }
1596 }
1597
1598
1599 void GLAPIENTRY
save_AlphaFunc(GLenum func,GLclampf ref)1600 save_AlphaFunc(GLenum func, GLclampf ref)
1601 {
1602 GET_CURRENT_CONTEXT(ctx);
1603 Node *n;
1604 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1605 n = alloc_instruction(ctx, OPCODE_ALPHA_FUNC, 2);
1606 if (n) {
1607 n[1].e = func;
1608 n[2].f = (GLfloat) ref;
1609 }
1610 if (ctx->ExecuteFlag) {
1611 CALL_AlphaFunc(ctx->Exec, (func, ref));
1612 }
1613 }
1614
1615
1616 void GLAPIENTRY
save_BindTexture(GLenum target,GLuint texture)1617 save_BindTexture(GLenum target, GLuint texture)
1618 {
1619 GET_CURRENT_CONTEXT(ctx);
1620 Node *n;
1621 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1622 n = alloc_instruction(ctx, OPCODE_BIND_TEXTURE, 2);
1623 if (n) {
1624 n[1].e = target;
1625 n[2].ui = texture;
1626 }
1627 if (ctx->ExecuteFlag) {
1628 CALL_BindTexture(ctx->Exec, (target, texture));
1629 }
1630 }
1631
1632
1633 void GLAPIENTRY
save_Bitmap(GLsizei width,GLsizei height,GLfloat xorig,GLfloat yorig,GLfloat xmove,GLfloat ymove,const GLubyte * pixels)1634 save_Bitmap(GLsizei width, GLsizei height,
1635 GLfloat xorig, GLfloat yorig,
1636 GLfloat xmove, GLfloat ymove, const GLubyte * pixels)
1637 {
1638 GET_CURRENT_CONTEXT(ctx);
1639 Node *n;
1640 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1641 n = alloc_instruction(ctx, OPCODE_BITMAP, 6 + POINTER_DWORDS);
1642 if (n) {
1643 n[1].i = (GLint) width;
1644 n[2].i = (GLint) height;
1645 n[3].f = xorig;
1646 n[4].f = yorig;
1647 n[5].f = xmove;
1648 n[6].f = ymove;
1649 save_pointer(&n[7],
1650 unpack_image(ctx, 2, width, height, 1, GL_COLOR_INDEX,
1651 GL_BITMAP, pixels, &ctx->Unpack));
1652 }
1653 if (ctx->ExecuteFlag) {
1654 CALL_Bitmap(ctx->Exec, (width, height,
1655 xorig, yorig, xmove, ymove, pixels));
1656 }
1657 }
1658
1659
1660 void GLAPIENTRY
save_BlendEquation(GLenum mode)1661 save_BlendEquation(GLenum mode)
1662 {
1663 GET_CURRENT_CONTEXT(ctx);
1664 Node *n;
1665 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1666 n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION, 1);
1667 if (n) {
1668 n[1].e = mode;
1669 }
1670 if (ctx->ExecuteFlag) {
1671 CALL_BlendEquation(ctx->Exec, (mode));
1672 }
1673 }
1674
1675
1676 void GLAPIENTRY
save_BlendEquationSeparate(GLenum modeRGB,GLenum modeA)1677 save_BlendEquationSeparate(GLenum modeRGB, GLenum modeA)
1678 {
1679 GET_CURRENT_CONTEXT(ctx);
1680 Node *n;
1681 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1682 n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION_SEPARATE, 2);
1683 if (n) {
1684 n[1].e = modeRGB;
1685 n[2].e = modeA;
1686 }
1687 if (ctx->ExecuteFlag) {
1688 CALL_BlendEquationSeparate(ctx->Exec, (modeRGB, modeA));
1689 }
1690 }
1691
1692
1693 void GLAPIENTRY
save_BlendFuncSeparate(GLenum sfactorRGB,GLenum dfactorRGB,GLenum sfactorA,GLenum dfactorA)1694 save_BlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB,
1695 GLenum sfactorA, GLenum dfactorA)
1696 {
1697 GET_CURRENT_CONTEXT(ctx);
1698 Node *n;
1699 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1700 n = alloc_instruction(ctx, OPCODE_BLEND_FUNC_SEPARATE, 4);
1701 if (n) {
1702 n[1].e = sfactorRGB;
1703 n[2].e = dfactorRGB;
1704 n[3].e = sfactorA;
1705 n[4].e = dfactorA;
1706 }
1707 if (ctx->ExecuteFlag) {
1708 CALL_BlendFuncSeparate(ctx->Exec,
1709 (sfactorRGB, dfactorRGB, sfactorA, dfactorA));
1710 }
1711 }
1712
1713
1714 void GLAPIENTRY
save_BlendFunc(GLenum srcfactor,GLenum dstfactor)1715 save_BlendFunc(GLenum srcfactor, GLenum dstfactor)
1716 {
1717 save_BlendFuncSeparate(srcfactor, dstfactor, srcfactor, dstfactor);
1718 }
1719
1720
1721 void GLAPIENTRY
save_BlendColor(GLfloat red,GLfloat green,GLfloat blue,GLfloat alpha)1722 save_BlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
1723 {
1724 GET_CURRENT_CONTEXT(ctx);
1725 Node *n;
1726 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1727 n = alloc_instruction(ctx, OPCODE_BLEND_COLOR, 4);
1728 if (n) {
1729 n[1].f = red;
1730 n[2].f = green;
1731 n[3].f = blue;
1732 n[4].f = alpha;
1733 }
1734 if (ctx->ExecuteFlag) {
1735 CALL_BlendColor(ctx->Exec, (red, green, blue, alpha));
1736 }
1737 }
1738
1739 /* GL_ARB_draw_buffers_blend */
1740 void GLAPIENTRY
save_BlendFuncSeparateiARB(GLuint buf,GLenum sfactorRGB,GLenum dfactorRGB,GLenum sfactorA,GLenum dfactorA)1741 save_BlendFuncSeparateiARB(GLuint buf, GLenum sfactorRGB, GLenum dfactorRGB,
1742 GLenum sfactorA, GLenum dfactorA)
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_FUNC_SEPARATE_I, 5);
1748 if (n) {
1749 n[1].ui = buf;
1750 n[2].e = sfactorRGB;
1751 n[3].e = dfactorRGB;
1752 n[4].e = sfactorA;
1753 n[5].e = dfactorA;
1754 }
1755 if (ctx->ExecuteFlag) {
1756 CALL_BlendFuncSeparateiARB(ctx->Exec, (buf, sfactorRGB, dfactorRGB,
1757 sfactorA, dfactorA));
1758 }
1759 }
1760
1761 /* GL_ARB_draw_buffers_blend */
1762 void GLAPIENTRY
save_BlendFunciARB(GLuint buf,GLenum sfactor,GLenum dfactor)1763 save_BlendFunciARB(GLuint buf, GLenum sfactor, GLenum dfactor)
1764 {
1765 GET_CURRENT_CONTEXT(ctx);
1766 Node *n;
1767 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1768 n = alloc_instruction(ctx, OPCODE_BLEND_FUNC_I, 3);
1769 if (n) {
1770 n[1].ui = buf;
1771 n[2].e = sfactor;
1772 n[3].e = dfactor;
1773 }
1774 if (ctx->ExecuteFlag) {
1775 CALL_BlendFunciARB(ctx->Exec, (buf, sfactor, dfactor));
1776 }
1777 }
1778
1779 /* GL_ARB_draw_buffers_blend */
1780 void GLAPIENTRY
save_BlendEquationiARB(GLuint buf,GLenum mode)1781 save_BlendEquationiARB(GLuint buf, GLenum mode)
1782 {
1783 GET_CURRENT_CONTEXT(ctx);
1784 Node *n;
1785 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1786 n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION_I, 2);
1787 if (n) {
1788 n[1].ui = buf;
1789 n[2].e = mode;
1790 }
1791 if (ctx->ExecuteFlag) {
1792 CALL_BlendEquationiARB(ctx->Exec, (buf, mode));
1793 }
1794 }
1795
1796 /* GL_ARB_draw_buffers_blend */
1797 void GLAPIENTRY
save_BlendEquationSeparateiARB(GLuint buf,GLenum modeRGB,GLenum modeA)1798 save_BlendEquationSeparateiARB(GLuint buf, GLenum modeRGB, GLenum modeA)
1799 {
1800 GET_CURRENT_CONTEXT(ctx);
1801 Node *n;
1802 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1803 n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION_SEPARATE_I, 3);
1804 if (n) {
1805 n[1].ui = buf;
1806 n[2].e = modeRGB;
1807 n[3].e = modeA;
1808 }
1809 if (ctx->ExecuteFlag) {
1810 CALL_BlendEquationSeparateiARB(ctx->Exec, (buf, modeRGB, modeA));
1811 }
1812 }
1813
1814
1815 /* GL_ARB_draw_instanced. */
1816 void GLAPIENTRY
save_DrawArraysInstancedARB(UNUSED GLenum mode,UNUSED GLint first,UNUSED GLsizei count,UNUSED GLsizei primcount)1817 save_DrawArraysInstancedARB(UNUSED GLenum mode,
1818 UNUSED GLint first,
1819 UNUSED GLsizei count,
1820 UNUSED GLsizei primcount)
1821 {
1822 GET_CURRENT_CONTEXT(ctx);
1823 _mesa_error(ctx, GL_INVALID_OPERATION,
1824 "glDrawArraysInstanced() during display list compile");
1825 }
1826
1827 void GLAPIENTRY
save_DrawElementsInstancedARB(UNUSED GLenum mode,UNUSED GLsizei count,UNUSED GLenum type,UNUSED const GLvoid * indices,UNUSED GLsizei primcount)1828 save_DrawElementsInstancedARB(UNUSED GLenum mode,
1829 UNUSED GLsizei count,
1830 UNUSED GLenum type,
1831 UNUSED const GLvoid *indices,
1832 UNUSED GLsizei primcount)
1833 {
1834 GET_CURRENT_CONTEXT(ctx);
1835 _mesa_error(ctx, GL_INVALID_OPERATION,
1836 "glDrawElementsInstanced() during display list compile");
1837 }
1838
1839 void GLAPIENTRY
save_DrawElementsInstancedBaseVertex(UNUSED GLenum mode,UNUSED GLsizei count,UNUSED GLenum type,UNUSED const GLvoid * indices,UNUSED GLsizei primcount,UNUSED GLint basevertex)1840 save_DrawElementsInstancedBaseVertex(UNUSED GLenum mode,
1841 UNUSED GLsizei count,
1842 UNUSED GLenum type,
1843 UNUSED const GLvoid *indices,
1844 UNUSED GLsizei primcount,
1845 UNUSED GLint basevertex)
1846 {
1847 GET_CURRENT_CONTEXT(ctx);
1848 _mesa_error(ctx, GL_INVALID_OPERATION,
1849 "glDrawElementsInstancedBaseVertex() during display list compile");
1850 }
1851
1852 /* GL_ARB_base_instance. */
1853 void GLAPIENTRY
save_DrawArraysInstancedBaseInstance(UNUSED GLenum mode,UNUSED GLint first,UNUSED GLsizei count,UNUSED GLsizei primcount,UNUSED GLuint baseinstance)1854 save_DrawArraysInstancedBaseInstance(UNUSED GLenum mode,
1855 UNUSED GLint first,
1856 UNUSED GLsizei count,
1857 UNUSED GLsizei primcount,
1858 UNUSED GLuint baseinstance)
1859 {
1860 GET_CURRENT_CONTEXT(ctx);
1861 _mesa_error(ctx, GL_INVALID_OPERATION,
1862 "glDrawArraysInstancedBaseInstance() during display list compile");
1863 }
1864
1865 void GLAPIENTRY
save_DrawElementsInstancedBaseInstance(UNUSED GLenum mode,UNUSED GLsizei count,UNUSED GLenum type,UNUSED const void * indices,UNUSED GLsizei primcount,UNUSED GLuint baseinstance)1866 save_DrawElementsInstancedBaseInstance(UNUSED GLenum mode,
1867 UNUSED GLsizei count,
1868 UNUSED GLenum type,
1869 UNUSED const void *indices,
1870 UNUSED GLsizei primcount,
1871 UNUSED GLuint baseinstance)
1872 {
1873 GET_CURRENT_CONTEXT(ctx);
1874 _mesa_error(ctx, GL_INVALID_OPERATION,
1875 "glDrawElementsInstancedBaseInstance() during display list compile");
1876 }
1877
1878 void GLAPIENTRY
save_DrawElementsInstancedBaseVertexBaseInstance(UNUSED GLenum mode,UNUSED GLsizei count,UNUSED GLenum type,UNUSED const void * indices,UNUSED GLsizei primcount,UNUSED GLint basevertex,UNUSED GLuint baseinstance)1879 save_DrawElementsInstancedBaseVertexBaseInstance(UNUSED GLenum mode,
1880 UNUSED GLsizei count,
1881 UNUSED GLenum type,
1882 UNUSED const void *indices,
1883 UNUSED GLsizei primcount,
1884 UNUSED GLint basevertex,
1885 UNUSED GLuint baseinstance)
1886 {
1887 GET_CURRENT_CONTEXT(ctx);
1888 _mesa_error(ctx, GL_INVALID_OPERATION,
1889 "glDrawElementsInstancedBaseVertexBaseInstance() during display list compile");
1890 }
1891
1892 void GLAPIENTRY
save_DrawArraysIndirect(UNUSED GLenum mode,UNUSED const void * indirect)1893 save_DrawArraysIndirect(UNUSED GLenum mode,
1894 UNUSED const void *indirect)
1895 {
1896 GET_CURRENT_CONTEXT(ctx);
1897 _mesa_error(ctx, GL_INVALID_OPERATION,
1898 "glDrawArraysIndirect() during display list compile");
1899 }
1900
1901 void GLAPIENTRY
save_DrawElementsIndirect(UNUSED GLenum mode,UNUSED GLenum type,UNUSED const void * indirect)1902 save_DrawElementsIndirect(UNUSED GLenum mode,
1903 UNUSED GLenum type,
1904 UNUSED const void *indirect)
1905 {
1906 GET_CURRENT_CONTEXT(ctx);
1907 _mesa_error(ctx, GL_INVALID_OPERATION,
1908 "glDrawElementsIndirect() during display list compile");
1909 }
1910
1911 void GLAPIENTRY
save_MultiDrawArraysIndirect(UNUSED GLenum mode,UNUSED const void * indirect,UNUSED GLsizei primcount,UNUSED GLsizei stride)1912 save_MultiDrawArraysIndirect(UNUSED GLenum mode,
1913 UNUSED const void *indirect,
1914 UNUSED GLsizei primcount,
1915 UNUSED GLsizei stride)
1916 {
1917 GET_CURRENT_CONTEXT(ctx);
1918 _mesa_error(ctx, GL_INVALID_OPERATION,
1919 "glMultiDrawArraysIndirect() during display list compile");
1920 }
1921
1922 void GLAPIENTRY
save_MultiDrawElementsIndirect(UNUSED GLenum mode,UNUSED GLenum type,UNUSED const void * indirect,UNUSED GLsizei primcount,UNUSED GLsizei stride)1923 save_MultiDrawElementsIndirect(UNUSED GLenum mode,
1924 UNUSED GLenum type,
1925 UNUSED const void *indirect,
1926 UNUSED GLsizei primcount,
1927 UNUSED GLsizei stride)
1928 {
1929 GET_CURRENT_CONTEXT(ctx);
1930 _mesa_error(ctx, GL_INVALID_OPERATION,
1931 "glMultiDrawElementsIndirect() during display list compile");
1932 }
1933
1934 /**
1935 * While building a display list we cache some OpenGL state.
1936 * Under some circumstances we need to invalidate that state (immediately
1937 * when we start compiling a list, or after glCallList(s)).
1938 */
1939 static void
invalidate_saved_current_state(struct gl_context * ctx)1940 invalidate_saved_current_state(struct gl_context *ctx)
1941 {
1942 GLint i;
1943
1944 for (i = 0; i < VERT_ATTRIB_MAX; i++)
1945 ctx->ListState.ActiveAttribSize[i] = 0;
1946
1947 for (i = 0; i < MAT_ATTRIB_MAX; i++)
1948 ctx->ListState.ActiveMaterialSize[i] = 0;
1949
1950 /* Loopback usage applies recursively, so remember this state */
1951 bool use_loopback = ctx->ListState.Current.UseLoopback;
1952 memset(&ctx->ListState.Current, 0, sizeof ctx->ListState.Current);
1953 ctx->ListState.Current.UseLoopback = use_loopback;
1954
1955 ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN;
1956 }
1957
1958
1959 static void GLAPIENTRY
save_CallList(GLuint list)1960 save_CallList(GLuint list)
1961 {
1962 GET_CURRENT_CONTEXT(ctx);
1963 Node *n;
1964 SAVE_FLUSH_VERTICES(ctx);
1965
1966 n = alloc_instruction(ctx, OPCODE_CALL_LIST, 1);
1967 if (n) {
1968 n[1].ui = list;
1969 }
1970
1971 /* After this, we don't know what state we're in. Invalidate all
1972 * cached information previously gathered:
1973 */
1974 invalidate_saved_current_state( ctx );
1975
1976 if (ctx->ExecuteFlag) {
1977 _mesa_CallList(list);
1978 }
1979 }
1980
1981
1982 static void GLAPIENTRY
save_CallLists(GLsizei num,GLenum type,const GLvoid * lists)1983 save_CallLists(GLsizei num, GLenum type, const GLvoid * lists)
1984 {
1985 GET_CURRENT_CONTEXT(ctx);
1986 unsigned type_size;
1987 Node *n;
1988 void *lists_copy;
1989
1990 SAVE_FLUSH_VERTICES(ctx);
1991
1992 switch (type) {
1993 case GL_BYTE:
1994 case GL_UNSIGNED_BYTE:
1995 type_size = 1;
1996 break;
1997 case GL_SHORT:
1998 case GL_UNSIGNED_SHORT:
1999 case GL_2_BYTES:
2000 type_size = 2;
2001 break;
2002 case GL_3_BYTES:
2003 type_size = 3;
2004 break;
2005 case GL_INT:
2006 case GL_UNSIGNED_INT:
2007 case GL_FLOAT:
2008 case GL_4_BYTES:
2009 type_size = 4;
2010 break;
2011 default:
2012 type_size = 0;
2013 }
2014
2015 if (num > 0 && type_size > 0) {
2016 /* create a copy of the array of list IDs to save in the display list */
2017 lists_copy = memdup(lists, num * type_size);
2018 } else {
2019 lists_copy = NULL;
2020 }
2021
2022 n = alloc_instruction(ctx, OPCODE_CALL_LISTS, 2 + POINTER_DWORDS);
2023 if (n) {
2024 n[1].i = num;
2025 n[2].e = type;
2026 save_pointer(&n[3], lists_copy);
2027 }
2028
2029 /* After this, we don't know what state we're in. Invalidate all
2030 * cached information previously gathered:
2031 */
2032 invalidate_saved_current_state( ctx );
2033
2034 if (ctx->ExecuteFlag) {
2035 CALL_CallLists(ctx->Exec, (num, type, lists));
2036 }
2037 }
2038
2039
2040 void GLAPIENTRY
save_Clear(GLbitfield mask)2041 save_Clear(GLbitfield mask)
2042 {
2043 GET_CURRENT_CONTEXT(ctx);
2044 Node *n;
2045 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2046 n = alloc_instruction(ctx, OPCODE_CLEAR, 1);
2047 if (n) {
2048 n[1].bf = mask;
2049 }
2050 if (ctx->ExecuteFlag) {
2051 CALL_Clear(ctx->Exec, (mask));
2052 }
2053 }
2054
2055
2056 void GLAPIENTRY
save_ClearBufferiv(GLenum buffer,GLint drawbuffer,const GLint * value)2057 save_ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value)
2058 {
2059 GET_CURRENT_CONTEXT(ctx);
2060 Node *n;
2061 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2062 n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_IV, 6);
2063 if (n) {
2064 n[1].e = buffer;
2065 n[2].i = drawbuffer;
2066 n[3].i = value[0];
2067 if (buffer == GL_COLOR) {
2068 n[4].i = value[1];
2069 n[5].i = value[2];
2070 n[6].i = value[3];
2071 }
2072 else {
2073 n[4].i = 0;
2074 n[5].i = 0;
2075 n[6].i = 0;
2076 }
2077 }
2078 if (ctx->ExecuteFlag) {
2079 CALL_ClearBufferiv(ctx->Exec, (buffer, drawbuffer, value));
2080 }
2081 }
2082
2083
2084 void GLAPIENTRY
save_ClearBufferuiv(GLenum buffer,GLint drawbuffer,const GLuint * value)2085 save_ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value)
2086 {
2087 GET_CURRENT_CONTEXT(ctx);
2088 Node *n;
2089 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2090 n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_UIV, 6);
2091 if (n) {
2092 n[1].e = buffer;
2093 n[2].i = drawbuffer;
2094 n[3].ui = value[0];
2095 if (buffer == GL_COLOR) {
2096 n[4].ui = value[1];
2097 n[5].ui = value[2];
2098 n[6].ui = value[3];
2099 }
2100 else {
2101 n[4].ui = 0;
2102 n[5].ui = 0;
2103 n[6].ui = 0;
2104 }
2105 }
2106 if (ctx->ExecuteFlag) {
2107 CALL_ClearBufferuiv(ctx->Exec, (buffer, drawbuffer, value));
2108 }
2109 }
2110
2111
2112 void GLAPIENTRY
save_ClearBufferfv(GLenum buffer,GLint drawbuffer,const GLfloat * value)2113 save_ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
2114 {
2115 GET_CURRENT_CONTEXT(ctx);
2116 Node *n;
2117 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2118 n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_FV, 6);
2119 if (n) {
2120 n[1].e = buffer;
2121 n[2].i = drawbuffer;
2122 n[3].f = value[0];
2123 if (buffer == GL_COLOR) {
2124 n[4].f = value[1];
2125 n[5].f = value[2];
2126 n[6].f = value[3];
2127 }
2128 else {
2129 n[4].f = 0.0F;
2130 n[5].f = 0.0F;
2131 n[6].f = 0.0F;
2132 }
2133 }
2134 if (ctx->ExecuteFlag) {
2135 CALL_ClearBufferfv(ctx->Exec, (buffer, drawbuffer, value));
2136 }
2137 }
2138
2139
2140 void GLAPIENTRY
save_ClearBufferfi(GLenum buffer,GLint drawbuffer,GLfloat depth,GLint stencil)2141 save_ClearBufferfi(GLenum buffer, GLint drawbuffer,
2142 GLfloat depth, GLint stencil)
2143 {
2144 GET_CURRENT_CONTEXT(ctx);
2145 Node *n;
2146 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2147 n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_FI, 4);
2148 if (n) {
2149 n[1].e = buffer;
2150 n[2].i = drawbuffer;
2151 n[3].f = depth;
2152 n[4].i = stencil;
2153 }
2154 if (ctx->ExecuteFlag) {
2155 CALL_ClearBufferfi(ctx->Exec, (buffer, drawbuffer, depth, stencil));
2156 }
2157 }
2158
2159
2160 void GLAPIENTRY
save_ClearAccum(GLfloat red,GLfloat green,GLfloat blue,GLfloat alpha)2161 save_ClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
2162 {
2163 GET_CURRENT_CONTEXT(ctx);
2164 Node *n;
2165 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2166 n = alloc_instruction(ctx, OPCODE_CLEAR_ACCUM, 4);
2167 if (n) {
2168 n[1].f = red;
2169 n[2].f = green;
2170 n[3].f = blue;
2171 n[4].f = alpha;
2172 }
2173 if (ctx->ExecuteFlag) {
2174 CALL_ClearAccum(ctx->Exec, (red, green, blue, alpha));
2175 }
2176 }
2177
2178
2179 void GLAPIENTRY
save_ClearColor(GLclampf red,GLclampf green,GLclampf blue,GLclampf alpha)2180 save_ClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
2181 {
2182 GET_CURRENT_CONTEXT(ctx);
2183 Node *n;
2184 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2185 n = alloc_instruction(ctx, OPCODE_CLEAR_COLOR, 4);
2186 if (n) {
2187 n[1].f = red;
2188 n[2].f = green;
2189 n[3].f = blue;
2190 n[4].f = alpha;
2191 }
2192 if (ctx->ExecuteFlag) {
2193 CALL_ClearColor(ctx->Exec, (red, green, blue, alpha));
2194 }
2195 }
2196
2197
2198 void GLAPIENTRY
save_ClearDepth(GLclampd depth)2199 save_ClearDepth(GLclampd depth)
2200 {
2201 GET_CURRENT_CONTEXT(ctx);
2202 Node *n;
2203 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2204 n = alloc_instruction(ctx, OPCODE_CLEAR_DEPTH, 1);
2205 if (n) {
2206 n[1].f = (GLfloat) depth;
2207 }
2208 if (ctx->ExecuteFlag) {
2209 CALL_ClearDepth(ctx->Exec, (depth));
2210 }
2211 }
2212
2213
2214 void GLAPIENTRY
save_ClearIndex(GLfloat c)2215 save_ClearIndex(GLfloat c)
2216 {
2217 GET_CURRENT_CONTEXT(ctx);
2218 Node *n;
2219 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2220 n = alloc_instruction(ctx, OPCODE_CLEAR_INDEX, 1);
2221 if (n) {
2222 n[1].f = c;
2223 }
2224 if (ctx->ExecuteFlag) {
2225 CALL_ClearIndex(ctx->Exec, (c));
2226 }
2227 }
2228
2229
2230 void GLAPIENTRY
save_ClearStencil(GLint s)2231 save_ClearStencil(GLint s)
2232 {
2233 GET_CURRENT_CONTEXT(ctx);
2234 Node *n;
2235 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2236 n = alloc_instruction(ctx, OPCODE_CLEAR_STENCIL, 1);
2237 if (n) {
2238 n[1].i = s;
2239 }
2240 if (ctx->ExecuteFlag) {
2241 CALL_ClearStencil(ctx->Exec, (s));
2242 }
2243 }
2244
2245
2246 void GLAPIENTRY
save_ClipPlane(GLenum plane,const GLdouble * equ)2247 save_ClipPlane(GLenum plane, const GLdouble * equ)
2248 {
2249 GET_CURRENT_CONTEXT(ctx);
2250 Node *n;
2251 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2252 n = alloc_instruction(ctx, OPCODE_CLIP_PLANE, 5);
2253 if (n) {
2254 n[1].e = plane;
2255 n[2].f = (GLfloat) equ[0];
2256 n[3].f = (GLfloat) equ[1];
2257 n[4].f = (GLfloat) equ[2];
2258 n[5].f = (GLfloat) equ[3];
2259 }
2260 if (ctx->ExecuteFlag) {
2261 CALL_ClipPlane(ctx->Exec, (plane, equ));
2262 }
2263 }
2264
2265
2266
2267 void GLAPIENTRY
save_ColorMask(GLboolean red,GLboolean green,GLboolean blue,GLboolean alpha)2268 save_ColorMask(GLboolean red, GLboolean green,
2269 GLboolean blue, GLboolean alpha)
2270 {
2271 GET_CURRENT_CONTEXT(ctx);
2272 Node *n;
2273 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2274 n = alloc_instruction(ctx, OPCODE_COLOR_MASK, 4);
2275 if (n) {
2276 n[1].b = red;
2277 n[2].b = green;
2278 n[3].b = blue;
2279 n[4].b = alpha;
2280 }
2281 if (ctx->ExecuteFlag) {
2282 CALL_ColorMask(ctx->Exec, (red, green, blue, alpha));
2283 }
2284 }
2285
2286
2287 void GLAPIENTRY
save_ColorMaski(GLuint buf,GLboolean red,GLboolean green,GLboolean blue,GLboolean alpha)2288 save_ColorMaski(GLuint buf, GLboolean red, GLboolean green,
2289 GLboolean blue, GLboolean alpha)
2290 {
2291 GET_CURRENT_CONTEXT(ctx);
2292 Node *n;
2293 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2294 n = alloc_instruction(ctx, OPCODE_COLOR_MASK_INDEXED, 5);
2295 if (n) {
2296 n[1].ui = buf;
2297 n[2].b = red;
2298 n[3].b = green;
2299 n[4].b = blue;
2300 n[5].b = alpha;
2301 }
2302 if (ctx->ExecuteFlag) {
2303 /*CALL_ColorMaski(ctx->Exec, (buf, red, green, blue, alpha));*/
2304 }
2305 }
2306
2307
2308 void GLAPIENTRY
save_ColorMaterial(GLenum face,GLenum mode)2309 save_ColorMaterial(GLenum face, GLenum mode)
2310 {
2311 GET_CURRENT_CONTEXT(ctx);
2312 Node *n;
2313 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2314
2315 n = alloc_instruction(ctx, OPCODE_COLOR_MATERIAL, 2);
2316 if (n) {
2317 n[1].e = face;
2318 n[2].e = mode;
2319 }
2320 if (ctx->ExecuteFlag) {
2321 CALL_ColorMaterial(ctx->Exec, (face, mode));
2322 }
2323 }
2324
2325
2326 void GLAPIENTRY
save_CopyPixels(GLint x,GLint y,GLsizei width,GLsizei height,GLenum type)2327 save_CopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type)
2328 {
2329 GET_CURRENT_CONTEXT(ctx);
2330 Node *n;
2331 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2332 n = alloc_instruction(ctx, OPCODE_COPY_PIXELS, 5);
2333 if (n) {
2334 n[1].i = x;
2335 n[2].i = y;
2336 n[3].i = (GLint) width;
2337 n[4].i = (GLint) height;
2338 n[5].e = type;
2339 }
2340 if (ctx->ExecuteFlag) {
2341 CALL_CopyPixels(ctx->Exec, (x, y, width, height, type));
2342 }
2343 }
2344
2345
2346
2347 void GLAPIENTRY
save_CopyTexImage1D(GLenum target,GLint level,GLenum internalformat,GLint x,GLint y,GLsizei width,GLint border)2348 save_CopyTexImage1D(GLenum target, GLint level, GLenum internalformat,
2349 GLint x, GLint y, GLsizei width, GLint border)
2350 {
2351 GET_CURRENT_CONTEXT(ctx);
2352 Node *n;
2353 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2354 n = alloc_instruction(ctx, OPCODE_COPY_TEX_IMAGE1D, 7);
2355 if (n) {
2356 n[1].e = target;
2357 n[2].i = level;
2358 n[3].e = internalformat;
2359 n[4].i = x;
2360 n[5].i = y;
2361 n[6].i = width;
2362 n[7].i = border;
2363 }
2364 if (ctx->ExecuteFlag) {
2365 CALL_CopyTexImage1D(ctx->Exec, (target, level, internalformat,
2366 x, y, width, border));
2367 }
2368 }
2369
2370
2371 void GLAPIENTRY
save_CopyTexImage2D(GLenum target,GLint level,GLenum internalformat,GLint x,GLint y,GLsizei width,GLsizei height,GLint border)2372 save_CopyTexImage2D(GLenum target, GLint level,
2373 GLenum internalformat,
2374 GLint x, GLint y, GLsizei width,
2375 GLsizei height, GLint border)
2376 {
2377 GET_CURRENT_CONTEXT(ctx);
2378 Node *n;
2379 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2380 n = alloc_instruction(ctx, OPCODE_COPY_TEX_IMAGE2D, 8);
2381 if (n) {
2382 n[1].e = target;
2383 n[2].i = level;
2384 n[3].e = internalformat;
2385 n[4].i = x;
2386 n[5].i = y;
2387 n[6].i = width;
2388 n[7].i = height;
2389 n[8].i = border;
2390 }
2391 if (ctx->ExecuteFlag) {
2392 CALL_CopyTexImage2D(ctx->Exec, (target, level, internalformat,
2393 x, y, width, height, border));
2394 }
2395 }
2396
2397
2398
2399 void GLAPIENTRY
save_CopyTexSubImage1D(GLenum target,GLint level,GLint xoffset,GLint x,GLint y,GLsizei width)2400 save_CopyTexSubImage1D(GLenum target, GLint level,
2401 GLint xoffset, GLint x, GLint y, GLsizei width)
2402 {
2403 GET_CURRENT_CONTEXT(ctx);
2404 Node *n;
2405 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2406 n = alloc_instruction(ctx, OPCODE_COPY_TEX_SUB_IMAGE1D, 6);
2407 if (n) {
2408 n[1].e = target;
2409 n[2].i = level;
2410 n[3].i = xoffset;
2411 n[4].i = x;
2412 n[5].i = y;
2413 n[6].i = width;
2414 }
2415 if (ctx->ExecuteFlag) {
2416 CALL_CopyTexSubImage1D(ctx->Exec,
2417 (target, level, xoffset, x, y, width));
2418 }
2419 }
2420
2421
2422 void GLAPIENTRY
save_CopyTexSubImage2D(GLenum target,GLint level,GLint xoffset,GLint yoffset,GLint x,GLint y,GLsizei width,GLint height)2423 save_CopyTexSubImage2D(GLenum target, GLint level,
2424 GLint xoffset, GLint yoffset,
2425 GLint x, GLint y, GLsizei width, GLint height)
2426 {
2427 GET_CURRENT_CONTEXT(ctx);
2428 Node *n;
2429 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2430 n = alloc_instruction(ctx, OPCODE_COPY_TEX_SUB_IMAGE2D, 8);
2431 if (n) {
2432 n[1].e = target;
2433 n[2].i = level;
2434 n[3].i = xoffset;
2435 n[4].i = yoffset;
2436 n[5].i = x;
2437 n[6].i = y;
2438 n[7].i = width;
2439 n[8].i = height;
2440 }
2441 if (ctx->ExecuteFlag) {
2442 CALL_CopyTexSubImage2D(ctx->Exec, (target, level, xoffset, yoffset,
2443 x, y, width, height));
2444 }
2445 }
2446
2447
2448 void GLAPIENTRY
save_CopyTexSubImage3D(GLenum target,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLint x,GLint y,GLsizei width,GLint height)2449 save_CopyTexSubImage3D(GLenum target, GLint level,
2450 GLint xoffset, GLint yoffset, GLint zoffset,
2451 GLint x, GLint y, GLsizei width, GLint height)
2452 {
2453 GET_CURRENT_CONTEXT(ctx);
2454 Node *n;
2455 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2456 n = alloc_instruction(ctx, OPCODE_COPY_TEX_SUB_IMAGE3D, 9);
2457 if (n) {
2458 n[1].e = target;
2459 n[2].i = level;
2460 n[3].i = xoffset;
2461 n[4].i = yoffset;
2462 n[5].i = zoffset;
2463 n[6].i = x;
2464 n[7].i = y;
2465 n[8].i = width;
2466 n[9].i = height;
2467 }
2468 if (ctx->ExecuteFlag) {
2469 CALL_CopyTexSubImage3D(ctx->Exec, (target, level,
2470 xoffset, yoffset, zoffset,
2471 x, y, width, height));
2472 }
2473 }
2474
2475
2476 void GLAPIENTRY
save_CullFace(GLenum mode)2477 save_CullFace(GLenum mode)
2478 {
2479 GET_CURRENT_CONTEXT(ctx);
2480 Node *n;
2481 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2482 n = alloc_instruction(ctx, OPCODE_CULL_FACE, 1);
2483 if (n) {
2484 n[1].e = mode;
2485 }
2486 if (ctx->ExecuteFlag) {
2487 CALL_CullFace(ctx->Exec, (mode));
2488 }
2489 }
2490
2491
2492 void GLAPIENTRY
save_DepthFunc(GLenum func)2493 save_DepthFunc(GLenum func)
2494 {
2495 GET_CURRENT_CONTEXT(ctx);
2496 Node *n;
2497 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2498 n = alloc_instruction(ctx, OPCODE_DEPTH_FUNC, 1);
2499 if (n) {
2500 n[1].e = func;
2501 }
2502 if (ctx->ExecuteFlag) {
2503 CALL_DepthFunc(ctx->Exec, (func));
2504 }
2505 }
2506
2507
2508 void GLAPIENTRY
save_DepthMask(GLboolean mask)2509 save_DepthMask(GLboolean mask)
2510 {
2511 GET_CURRENT_CONTEXT(ctx);
2512 Node *n;
2513 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2514 n = alloc_instruction(ctx, OPCODE_DEPTH_MASK, 1);
2515 if (n) {
2516 n[1].b = mask;
2517 }
2518 if (ctx->ExecuteFlag) {
2519 CALL_DepthMask(ctx->Exec, (mask));
2520 }
2521 }
2522
2523
2524 void GLAPIENTRY
save_DepthRange(GLclampd nearval,GLclampd farval)2525 save_DepthRange(GLclampd nearval, GLclampd farval)
2526 {
2527 GET_CURRENT_CONTEXT(ctx);
2528 Node *n;
2529 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2530 n = alloc_instruction(ctx, OPCODE_DEPTH_RANGE, 2);
2531 if (n) {
2532 n[1].f = (GLfloat) nearval;
2533 n[2].f = (GLfloat) farval;
2534 }
2535 if (ctx->ExecuteFlag) {
2536 CALL_DepthRange(ctx->Exec, (nearval, farval));
2537 }
2538 }
2539
2540
2541 void GLAPIENTRY
save_Disable(GLenum cap)2542 save_Disable(GLenum cap)
2543 {
2544 GET_CURRENT_CONTEXT(ctx);
2545 Node *n;
2546 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2547 n = alloc_instruction(ctx, OPCODE_DISABLE, 1);
2548 if (n) {
2549 n[1].e = cap;
2550 }
2551 if (ctx->ExecuteFlag) {
2552 CALL_Disable(ctx->Exec, (cap));
2553 }
2554 }
2555
2556
2557 void GLAPIENTRY
save_Disablei(GLuint index,GLenum cap)2558 save_Disablei(GLuint index, GLenum cap)
2559 {
2560 GET_CURRENT_CONTEXT(ctx);
2561 Node *n;
2562 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2563 n = alloc_instruction(ctx, OPCODE_DISABLE_INDEXED, 2);
2564 if (n) {
2565 n[1].ui = index;
2566 n[2].e = cap;
2567 }
2568 if (ctx->ExecuteFlag) {
2569 CALL_Disablei(ctx->Exec, (index, cap));
2570 }
2571 }
2572
2573
2574 void GLAPIENTRY
save_DrawBuffer(GLenum mode)2575 save_DrawBuffer(GLenum mode)
2576 {
2577 GET_CURRENT_CONTEXT(ctx);
2578 Node *n;
2579 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2580 n = alloc_instruction(ctx, OPCODE_DRAW_BUFFER, 1);
2581 if (n) {
2582 n[1].e = mode;
2583 }
2584 if (ctx->ExecuteFlag) {
2585 CALL_DrawBuffer(ctx->Exec, (mode));
2586 }
2587 }
2588
2589
2590 void GLAPIENTRY
save_DrawPixels(GLsizei width,GLsizei height,GLenum format,GLenum type,const GLvoid * pixels)2591 save_DrawPixels(GLsizei width, GLsizei height,
2592 GLenum format, GLenum type, const GLvoid * pixels)
2593 {
2594 GET_CURRENT_CONTEXT(ctx);
2595 Node *n;
2596
2597 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2598
2599 n = alloc_instruction(ctx, OPCODE_DRAW_PIXELS, 4 + POINTER_DWORDS);
2600 if (n) {
2601 n[1].i = width;
2602 n[2].i = height;
2603 n[3].e = format;
2604 n[4].e = type;
2605 save_pointer(&n[5],
2606 unpack_image(ctx, 2, width, height, 1, format, type,
2607 pixels, &ctx->Unpack));
2608 }
2609 if (ctx->ExecuteFlag) {
2610 CALL_DrawPixels(ctx->Exec, (width, height, format, type, pixels));
2611 }
2612 }
2613
2614
2615
2616 void GLAPIENTRY
save_Enable(GLenum cap)2617 save_Enable(GLenum cap)
2618 {
2619 GET_CURRENT_CONTEXT(ctx);
2620 Node *n;
2621 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2622 n = alloc_instruction(ctx, OPCODE_ENABLE, 1);
2623 if (n) {
2624 n[1].e = cap;
2625 }
2626 if (ctx->ExecuteFlag) {
2627 CALL_Enable(ctx->Exec, (cap));
2628 }
2629 }
2630
2631
2632
2633 void GLAPIENTRY
save_Enablei(GLuint index,GLenum cap)2634 save_Enablei(GLuint index, GLenum cap)
2635 {
2636 GET_CURRENT_CONTEXT(ctx);
2637 Node *n;
2638 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2639 n = alloc_instruction(ctx, OPCODE_ENABLE_INDEXED, 2);
2640 if (n) {
2641 n[1].ui = index;
2642 n[2].e = cap;
2643 }
2644 if (ctx->ExecuteFlag) {
2645 CALL_Enablei(ctx->Exec, (index, cap));
2646 }
2647 }
2648
2649
2650
2651 void GLAPIENTRY
save_EvalMesh1(GLenum mode,GLint i1,GLint i2)2652 save_EvalMesh1(GLenum mode, GLint i1, GLint i2)
2653 {
2654 GET_CURRENT_CONTEXT(ctx);
2655 Node *n;
2656 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2657 n = alloc_instruction(ctx, OPCODE_EVALMESH1, 3);
2658 if (n) {
2659 n[1].e = mode;
2660 n[2].i = i1;
2661 n[3].i = i2;
2662 }
2663 if (ctx->ExecuteFlag) {
2664 CALL_EvalMesh1(ctx->Exec, (mode, i1, i2));
2665 }
2666 }
2667
2668
2669 void GLAPIENTRY
save_EvalMesh2(GLenum mode,GLint i1,GLint i2,GLint j1,GLint j2)2670 save_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)
2671 {
2672 GET_CURRENT_CONTEXT(ctx);
2673 Node *n;
2674 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2675 n = alloc_instruction(ctx, OPCODE_EVALMESH2, 5);
2676 if (n) {
2677 n[1].e = mode;
2678 n[2].i = i1;
2679 n[3].i = i2;
2680 n[4].i = j1;
2681 n[5].i = j2;
2682 }
2683 if (ctx->ExecuteFlag) {
2684 CALL_EvalMesh2(ctx->Exec, (mode, i1, i2, j1, j2));
2685 }
2686 }
2687
2688
2689
2690
2691 void GLAPIENTRY
save_Fogfv(GLenum pname,const GLfloat * params)2692 save_Fogfv(GLenum pname, const GLfloat *params)
2693 {
2694 GET_CURRENT_CONTEXT(ctx);
2695 Node *n;
2696 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2697 n = alloc_instruction(ctx, OPCODE_FOG, 5);
2698 if (n) {
2699 n[1].e = pname;
2700 n[2].f = params[0];
2701 n[3].f = params[1];
2702 n[4].f = params[2];
2703 n[5].f = params[3];
2704 }
2705 if (ctx->ExecuteFlag) {
2706 CALL_Fogfv(ctx->Exec, (pname, params));
2707 }
2708 }
2709
2710
2711 void GLAPIENTRY
save_Fogf(GLenum pname,GLfloat param)2712 save_Fogf(GLenum pname, GLfloat param)
2713 {
2714 GLfloat parray[4];
2715 parray[0] = param;
2716 parray[1] = parray[2] = parray[3] = 0.0F;
2717 save_Fogfv(pname, parray);
2718 }
2719
2720
2721 void GLAPIENTRY
save_Fogiv(GLenum pname,const GLint * params)2722 save_Fogiv(GLenum pname, const GLint *params)
2723 {
2724 GLfloat p[4];
2725 switch (pname) {
2726 case GL_FOG_MODE:
2727 case GL_FOG_DENSITY:
2728 case GL_FOG_START:
2729 case GL_FOG_END:
2730 case GL_FOG_INDEX:
2731 case GL_FOG_COORDINATE_SOURCE:
2732 p[0] = (GLfloat) *params;
2733 p[1] = 0.0f;
2734 p[2] = 0.0f;
2735 p[3] = 0.0f;
2736 break;
2737 case GL_FOG_COLOR:
2738 p[0] = INT_TO_FLOAT(params[0]);
2739 p[1] = INT_TO_FLOAT(params[1]);
2740 p[2] = INT_TO_FLOAT(params[2]);
2741 p[3] = INT_TO_FLOAT(params[3]);
2742 break;
2743 default:
2744 /* Error will be caught later in gl_Fogfv */
2745 ASSIGN_4V(p, 0.0F, 0.0F, 0.0F, 0.0F);
2746 }
2747 save_Fogfv(pname, p);
2748 }
2749
2750
2751 void GLAPIENTRY
save_Fogi(GLenum pname,GLint param)2752 save_Fogi(GLenum pname, GLint param)
2753 {
2754 GLint parray[4];
2755 parray[0] = param;
2756 parray[1] = parray[2] = parray[3] = 0;
2757 save_Fogiv(pname, parray);
2758 }
2759
2760
2761 void GLAPIENTRY
save_FrontFace(GLenum mode)2762 save_FrontFace(GLenum mode)
2763 {
2764 GET_CURRENT_CONTEXT(ctx);
2765 Node *n;
2766 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2767 n = alloc_instruction(ctx, OPCODE_FRONT_FACE, 1);
2768 if (n) {
2769 n[1].e = mode;
2770 }
2771 if (ctx->ExecuteFlag) {
2772 CALL_FrontFace(ctx->Exec, (mode));
2773 }
2774 }
2775
2776
2777 void GLAPIENTRY
save_Frustum(GLdouble left,GLdouble right,GLdouble bottom,GLdouble top,GLdouble nearval,GLdouble farval)2778 save_Frustum(GLdouble left, GLdouble right,
2779 GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval)
2780 {
2781 GET_CURRENT_CONTEXT(ctx);
2782 Node *n;
2783 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2784 n = alloc_instruction(ctx, OPCODE_FRUSTUM, 6);
2785 if (n) {
2786 n[1].f = (GLfloat) left;
2787 n[2].f = (GLfloat) right;
2788 n[3].f = (GLfloat) bottom;
2789 n[4].f = (GLfloat) top;
2790 n[5].f = (GLfloat) nearval;
2791 n[6].f = (GLfloat) farval;
2792 }
2793 if (ctx->ExecuteFlag) {
2794 CALL_Frustum(ctx->Exec, (left, right, bottom, top, nearval, farval));
2795 }
2796 }
2797
2798
2799 void GLAPIENTRY
save_Hint(GLenum target,GLenum mode)2800 save_Hint(GLenum target, GLenum mode)
2801 {
2802 GET_CURRENT_CONTEXT(ctx);
2803 Node *n;
2804 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2805 n = alloc_instruction(ctx, OPCODE_HINT, 2);
2806 if (n) {
2807 n[1].e = target;
2808 n[2].e = mode;
2809 }
2810 if (ctx->ExecuteFlag) {
2811 CALL_Hint(ctx->Exec, (target, mode));
2812 }
2813 }
2814
2815
2816 void GLAPIENTRY
save_IndexMask(GLuint mask)2817 save_IndexMask(GLuint mask)
2818 {
2819 GET_CURRENT_CONTEXT(ctx);
2820 Node *n;
2821 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2822 n = alloc_instruction(ctx, OPCODE_INDEX_MASK, 1);
2823 if (n) {
2824 n[1].ui = mask;
2825 }
2826 if (ctx->ExecuteFlag) {
2827 CALL_IndexMask(ctx->Exec, (mask));
2828 }
2829 }
2830
2831
2832 void GLAPIENTRY
save_InitNames(void)2833 save_InitNames(void)
2834 {
2835 GET_CURRENT_CONTEXT(ctx);
2836 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2837 (void) alloc_instruction(ctx, OPCODE_INIT_NAMES, 0);
2838 if (ctx->ExecuteFlag) {
2839 CALL_InitNames(ctx->Exec, ());
2840 }
2841 }
2842
2843
2844 void GLAPIENTRY
save_Lightfv(GLenum light,GLenum pname,const GLfloat * params)2845 save_Lightfv(GLenum light, GLenum pname, const GLfloat *params)
2846 {
2847 GET_CURRENT_CONTEXT(ctx);
2848 Node *n;
2849 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2850 n = alloc_instruction(ctx, OPCODE_LIGHT, 6);
2851 if (n) {
2852 GLint i, nParams;
2853 n[1].e = light;
2854 n[2].e = pname;
2855 switch (pname) {
2856 case GL_AMBIENT:
2857 nParams = 4;
2858 break;
2859 case GL_DIFFUSE:
2860 nParams = 4;
2861 break;
2862 case GL_SPECULAR:
2863 nParams = 4;
2864 break;
2865 case GL_POSITION:
2866 nParams = 4;
2867 break;
2868 case GL_SPOT_DIRECTION:
2869 nParams = 3;
2870 break;
2871 case GL_SPOT_EXPONENT:
2872 nParams = 1;
2873 break;
2874 case GL_SPOT_CUTOFF:
2875 nParams = 1;
2876 break;
2877 case GL_CONSTANT_ATTENUATION:
2878 nParams = 1;
2879 break;
2880 case GL_LINEAR_ATTENUATION:
2881 nParams = 1;
2882 break;
2883 case GL_QUADRATIC_ATTENUATION:
2884 nParams = 1;
2885 break;
2886 default:
2887 nParams = 0;
2888 }
2889 for (i = 0; i < nParams; i++) {
2890 n[3 + i].f = params[i];
2891 }
2892 }
2893 if (ctx->ExecuteFlag) {
2894 CALL_Lightfv(ctx->Exec, (light, pname, params));
2895 }
2896 }
2897
2898
2899 void GLAPIENTRY
save_Lightf(GLenum light,GLenum pname,GLfloat param)2900 save_Lightf(GLenum light, GLenum pname, GLfloat param)
2901 {
2902 GLfloat parray[4];
2903 parray[0] = param;
2904 parray[1] = parray[2] = parray[3] = 0.0F;
2905 save_Lightfv(light, pname, parray);
2906 }
2907
2908
2909 void GLAPIENTRY
save_Lightiv(GLenum light,GLenum pname,const GLint * params)2910 save_Lightiv(GLenum light, GLenum pname, const GLint *params)
2911 {
2912 GLfloat fparam[4];
2913 switch (pname) {
2914 case GL_AMBIENT:
2915 case GL_DIFFUSE:
2916 case GL_SPECULAR:
2917 fparam[0] = INT_TO_FLOAT(params[0]);
2918 fparam[1] = INT_TO_FLOAT(params[1]);
2919 fparam[2] = INT_TO_FLOAT(params[2]);
2920 fparam[3] = INT_TO_FLOAT(params[3]);
2921 break;
2922 case GL_POSITION:
2923 fparam[0] = (GLfloat) params[0];
2924 fparam[1] = (GLfloat) params[1];
2925 fparam[2] = (GLfloat) params[2];
2926 fparam[3] = (GLfloat) params[3];
2927 break;
2928 case GL_SPOT_DIRECTION:
2929 fparam[0] = (GLfloat) params[0];
2930 fparam[1] = (GLfloat) params[1];
2931 fparam[2] = (GLfloat) params[2];
2932 break;
2933 case GL_SPOT_EXPONENT:
2934 case GL_SPOT_CUTOFF:
2935 case GL_CONSTANT_ATTENUATION:
2936 case GL_LINEAR_ATTENUATION:
2937 case GL_QUADRATIC_ATTENUATION:
2938 fparam[0] = (GLfloat) params[0];
2939 break;
2940 default:
2941 /* error will be caught later in gl_Lightfv */
2942 ;
2943 }
2944 save_Lightfv(light, pname, fparam);
2945 }
2946
2947
2948 void GLAPIENTRY
save_Lighti(GLenum light,GLenum pname,GLint param)2949 save_Lighti(GLenum light, GLenum pname, GLint param)
2950 {
2951 GLint parray[4];
2952 parray[0] = param;
2953 parray[1] = parray[2] = parray[3] = 0;
2954 save_Lightiv(light, pname, parray);
2955 }
2956
2957
2958 void GLAPIENTRY
save_LightModelfv(GLenum pname,const GLfloat * params)2959 save_LightModelfv(GLenum pname, const GLfloat *params)
2960 {
2961 GET_CURRENT_CONTEXT(ctx);
2962 Node *n;
2963 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2964 n = alloc_instruction(ctx, OPCODE_LIGHT_MODEL, 5);
2965 if (n) {
2966 n[1].e = pname;
2967 n[2].f = params[0];
2968 n[3].f = params[1];
2969 n[4].f = params[2];
2970 n[5].f = params[3];
2971 }
2972 if (ctx->ExecuteFlag) {
2973 CALL_LightModelfv(ctx->Exec, (pname, params));
2974 }
2975 }
2976
2977
2978 void GLAPIENTRY
save_LightModelf(GLenum pname,GLfloat param)2979 save_LightModelf(GLenum pname, GLfloat param)
2980 {
2981 GLfloat parray[4];
2982 parray[0] = param;
2983 parray[1] = parray[2] = parray[3] = 0.0F;
2984 save_LightModelfv(pname, parray);
2985 }
2986
2987
2988 void GLAPIENTRY
save_LightModeliv(GLenum pname,const GLint * params)2989 save_LightModeliv(GLenum pname, const GLint *params)
2990 {
2991 GLfloat fparam[4];
2992 switch (pname) {
2993 case GL_LIGHT_MODEL_AMBIENT:
2994 fparam[0] = INT_TO_FLOAT(params[0]);
2995 fparam[1] = INT_TO_FLOAT(params[1]);
2996 fparam[2] = INT_TO_FLOAT(params[2]);
2997 fparam[3] = INT_TO_FLOAT(params[3]);
2998 break;
2999 case GL_LIGHT_MODEL_LOCAL_VIEWER:
3000 case GL_LIGHT_MODEL_TWO_SIDE:
3001 case GL_LIGHT_MODEL_COLOR_CONTROL:
3002 fparam[0] = (GLfloat) params[0];
3003 fparam[1] = 0.0F;
3004 fparam[2] = 0.0F;
3005 fparam[3] = 0.0F;
3006 break;
3007 default:
3008 /* Error will be caught later in gl_LightModelfv */
3009 ASSIGN_4V(fparam, 0.0F, 0.0F, 0.0F, 0.0F);
3010 }
3011 save_LightModelfv(pname, fparam);
3012 }
3013
3014
3015 void GLAPIENTRY
save_LightModeli(GLenum pname,GLint param)3016 save_LightModeli(GLenum pname, GLint param)
3017 {
3018 GLint parray[4];
3019 parray[0] = param;
3020 parray[1] = parray[2] = parray[3] = 0;
3021 save_LightModeliv(pname, parray);
3022 }
3023
3024
3025 void GLAPIENTRY
save_LineStipple(GLint factor,GLushort pattern)3026 save_LineStipple(GLint factor, GLushort pattern)
3027 {
3028 GET_CURRENT_CONTEXT(ctx);
3029 Node *n;
3030 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3031 n = alloc_instruction(ctx, OPCODE_LINE_STIPPLE, 2);
3032 if (n) {
3033 n[1].i = factor;
3034 n[2].us = pattern;
3035 }
3036 if (ctx->ExecuteFlag) {
3037 CALL_LineStipple(ctx->Exec, (factor, pattern));
3038 }
3039 }
3040
3041
3042 void GLAPIENTRY
save_LineWidth(GLfloat width)3043 save_LineWidth(GLfloat width)
3044 {
3045 GET_CURRENT_CONTEXT(ctx);
3046 Node *n;
3047 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3048 n = alloc_instruction(ctx, OPCODE_LINE_WIDTH, 1);
3049 if (n) {
3050 n[1].f = width;
3051 }
3052 if (ctx->ExecuteFlag) {
3053 CALL_LineWidth(ctx->Exec, (width));
3054 }
3055 }
3056
3057
3058 void GLAPIENTRY
save_ListBase(GLuint base)3059 save_ListBase(GLuint base)
3060 {
3061 GET_CURRENT_CONTEXT(ctx);
3062 Node *n;
3063 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3064 n = alloc_instruction(ctx, OPCODE_LIST_BASE, 1);
3065 if (n) {
3066 n[1].ui = base;
3067 }
3068 if (ctx->ExecuteFlag) {
3069 CALL_ListBase(ctx->Exec, (base));
3070 }
3071 }
3072
3073
3074 void GLAPIENTRY
save_LoadIdentity(void)3075 save_LoadIdentity(void)
3076 {
3077 GET_CURRENT_CONTEXT(ctx);
3078 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3079 (void) alloc_instruction(ctx, OPCODE_LOAD_IDENTITY, 0);
3080 if (ctx->ExecuteFlag) {
3081 CALL_LoadIdentity(ctx->Exec, ());
3082 }
3083 }
3084
3085
3086 void GLAPIENTRY
save_LoadMatrixf(const GLfloat * m)3087 save_LoadMatrixf(const GLfloat * m)
3088 {
3089 GET_CURRENT_CONTEXT(ctx);
3090 Node *n;
3091 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3092 n = alloc_instruction(ctx, OPCODE_LOAD_MATRIX, 16);
3093 if (n) {
3094 GLuint i;
3095 for (i = 0; i < 16; i++) {
3096 n[1 + i].f = m[i];
3097 }
3098 }
3099 if (ctx->ExecuteFlag) {
3100 CALL_LoadMatrixf(ctx->Exec, (m));
3101 }
3102 }
3103
3104
3105 void GLAPIENTRY
save_LoadMatrixd(const GLdouble * m)3106 save_LoadMatrixd(const GLdouble * m)
3107 {
3108 GLfloat f[16];
3109 GLint i;
3110 for (i = 0; i < 16; i++) {
3111 f[i] = (GLfloat) m[i];
3112 }
3113 save_LoadMatrixf(f);
3114 }
3115
3116
3117 void GLAPIENTRY
save_LoadName(GLuint name)3118 save_LoadName(GLuint name)
3119 {
3120 GET_CURRENT_CONTEXT(ctx);
3121 Node *n;
3122 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3123 n = alloc_instruction(ctx, OPCODE_LOAD_NAME, 1);
3124 if (n) {
3125 n[1].ui = name;
3126 }
3127 if (ctx->ExecuteFlag) {
3128 CALL_LoadName(ctx->Exec, (name));
3129 }
3130 }
3131
3132
3133 void GLAPIENTRY
save_LogicOp(GLenum opcode)3134 save_LogicOp(GLenum opcode)
3135 {
3136 GET_CURRENT_CONTEXT(ctx);
3137 Node *n;
3138 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3139 n = alloc_instruction(ctx, OPCODE_LOGIC_OP, 1);
3140 if (n) {
3141 n[1].e = opcode;
3142 }
3143 if (ctx->ExecuteFlag) {
3144 CALL_LogicOp(ctx->Exec, (opcode));
3145 }
3146 }
3147
3148
3149 void GLAPIENTRY
save_Map1d(GLenum target,GLdouble u1,GLdouble u2,GLint stride,GLint order,const GLdouble * points)3150 save_Map1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride,
3151 GLint order, const GLdouble * points)
3152 {
3153 GET_CURRENT_CONTEXT(ctx);
3154 Node *n;
3155 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3156 n = alloc_instruction(ctx, OPCODE_MAP1, 5 + POINTER_DWORDS);
3157 if (n) {
3158 GLfloat *pnts = _mesa_copy_map_points1d(target, stride, order, points);
3159 n[1].e = target;
3160 n[2].f = (GLfloat) u1;
3161 n[3].f = (GLfloat) u2;
3162 n[4].i = _mesa_evaluator_components(target); /* stride */
3163 n[5].i = order;
3164 save_pointer(&n[6], pnts);
3165 }
3166 if (ctx->ExecuteFlag) {
3167 CALL_Map1d(ctx->Exec, (target, u1, u2, stride, order, points));
3168 }
3169 }
3170
3171 void GLAPIENTRY
save_Map1f(GLenum target,GLfloat u1,GLfloat u2,GLint stride,GLint order,const GLfloat * points)3172 save_Map1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride,
3173 GLint order, const GLfloat * points)
3174 {
3175 GET_CURRENT_CONTEXT(ctx);
3176 Node *n;
3177 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3178 n = alloc_instruction(ctx, OPCODE_MAP1, 5 + POINTER_DWORDS);
3179 if (n) {
3180 GLfloat *pnts = _mesa_copy_map_points1f(target, stride, order, points);
3181 n[1].e = target;
3182 n[2].f = u1;
3183 n[3].f = u2;
3184 n[4].i = _mesa_evaluator_components(target); /* stride */
3185 n[5].i = order;
3186 save_pointer(&n[6], pnts);
3187 }
3188 if (ctx->ExecuteFlag) {
3189 CALL_Map1f(ctx->Exec, (target, u1, u2, stride, order, points));
3190 }
3191 }
3192
3193
3194 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)3195 save_Map2d(GLenum target,
3196 GLdouble u1, GLdouble u2, GLint ustride, GLint uorder,
3197 GLdouble v1, GLdouble v2, GLint vstride, GLint vorder,
3198 const GLdouble * points)
3199 {
3200 GET_CURRENT_CONTEXT(ctx);
3201 Node *n;
3202 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3203 n = alloc_instruction(ctx, OPCODE_MAP2, 9 + POINTER_DWORDS);
3204 if (n) {
3205 GLfloat *pnts = _mesa_copy_map_points2d(target, ustride, uorder,
3206 vstride, vorder, points);
3207 n[1].e = target;
3208 n[2].f = (GLfloat) u1;
3209 n[3].f = (GLfloat) u2;
3210 n[4].f = (GLfloat) v1;
3211 n[5].f = (GLfloat) v2;
3212 /* XXX verify these strides are correct */
3213 n[6].i = _mesa_evaluator_components(target) * vorder; /*ustride */
3214 n[7].i = _mesa_evaluator_components(target); /*vstride */
3215 n[8].i = uorder;
3216 n[9].i = vorder;
3217 save_pointer(&n[10], pnts);
3218 }
3219 if (ctx->ExecuteFlag) {
3220 CALL_Map2d(ctx->Exec, (target,
3221 u1, u2, ustride, uorder,
3222 v1, v2, vstride, vorder, points));
3223 }
3224 }
3225
3226
3227 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)3228 save_Map2f(GLenum target,
3229 GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
3230 GLfloat v1, GLfloat v2, GLint vstride, GLint vorder,
3231 const GLfloat * points)
3232 {
3233 GET_CURRENT_CONTEXT(ctx);
3234 Node *n;
3235 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3236 n = alloc_instruction(ctx, OPCODE_MAP2, 9 + POINTER_DWORDS);
3237 if (n) {
3238 GLfloat *pnts = _mesa_copy_map_points2f(target, ustride, uorder,
3239 vstride, vorder, points);
3240 n[1].e = target;
3241 n[2].f = u1;
3242 n[3].f = u2;
3243 n[4].f = v1;
3244 n[5].f = v2;
3245 /* XXX verify these strides are correct */
3246 n[6].i = _mesa_evaluator_components(target) * vorder; /*ustride */
3247 n[7].i = _mesa_evaluator_components(target); /*vstride */
3248 n[8].i = uorder;
3249 n[9].i = vorder;
3250 save_pointer(&n[10], pnts);
3251 }
3252 if (ctx->ExecuteFlag) {
3253 CALL_Map2f(ctx->Exec, (target, u1, u2, ustride, uorder,
3254 v1, v2, vstride, vorder, points));
3255 }
3256 }
3257
3258
3259 void GLAPIENTRY
save_MapGrid1f(GLint un,GLfloat u1,GLfloat u2)3260 save_MapGrid1f(GLint un, GLfloat u1, GLfloat u2)
3261 {
3262 GET_CURRENT_CONTEXT(ctx);
3263 Node *n;
3264 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3265 n = alloc_instruction(ctx, OPCODE_MAPGRID1, 3);
3266 if (n) {
3267 n[1].i = un;
3268 n[2].f = u1;
3269 n[3].f = u2;
3270 }
3271 if (ctx->ExecuteFlag) {
3272 CALL_MapGrid1f(ctx->Exec, (un, u1, u2));
3273 }
3274 }
3275
3276
3277 void GLAPIENTRY
save_MapGrid1d(GLint un,GLdouble u1,GLdouble u2)3278 save_MapGrid1d(GLint un, GLdouble u1, GLdouble u2)
3279 {
3280 save_MapGrid1f(un, (GLfloat) u1, (GLfloat) u2);
3281 }
3282
3283
3284 void GLAPIENTRY
save_MapGrid2f(GLint un,GLfloat u1,GLfloat u2,GLint vn,GLfloat v1,GLfloat v2)3285 save_MapGrid2f(GLint un, GLfloat u1, GLfloat u2,
3286 GLint vn, GLfloat v1, GLfloat v2)
3287 {
3288 GET_CURRENT_CONTEXT(ctx);
3289 Node *n;
3290 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3291 n = alloc_instruction(ctx, OPCODE_MAPGRID2, 6);
3292 if (n) {
3293 n[1].i = un;
3294 n[2].f = u1;
3295 n[3].f = u2;
3296 n[4].i = vn;
3297 n[5].f = v1;
3298 n[6].f = v2;
3299 }
3300 if (ctx->ExecuteFlag) {
3301 CALL_MapGrid2f(ctx->Exec, (un, u1, u2, vn, v1, v2));
3302 }
3303 }
3304
3305
3306
3307 void GLAPIENTRY
save_MapGrid2d(GLint un,GLdouble u1,GLdouble u2,GLint vn,GLdouble v1,GLdouble v2)3308 save_MapGrid2d(GLint un, GLdouble u1, GLdouble u2,
3309 GLint vn, GLdouble v1, GLdouble v2)
3310 {
3311 save_MapGrid2f(un, (GLfloat) u1, (GLfloat) u2,
3312 vn, (GLfloat) v1, (GLfloat) v2);
3313 }
3314
3315
3316 void GLAPIENTRY
save_MatrixMode(GLenum mode)3317 save_MatrixMode(GLenum mode)
3318 {
3319 GET_CURRENT_CONTEXT(ctx);
3320 Node *n;
3321 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3322 n = alloc_instruction(ctx, OPCODE_MATRIX_MODE, 1);
3323 if (n) {
3324 n[1].e = mode;
3325 }
3326 if (ctx->ExecuteFlag) {
3327 CALL_MatrixMode(ctx->Exec, (mode));
3328 }
3329 }
3330
3331
3332 void GLAPIENTRY
save_MultMatrixf(const GLfloat * m)3333 save_MultMatrixf(const GLfloat * m)
3334 {
3335 GET_CURRENT_CONTEXT(ctx);
3336 Node *n;
3337 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3338 n = alloc_instruction(ctx, OPCODE_MULT_MATRIX, 16);
3339 if (n) {
3340 GLuint i;
3341 for (i = 0; i < 16; i++) {
3342 n[1 + i].f = m[i];
3343 }
3344 }
3345 if (ctx->ExecuteFlag) {
3346 CALL_MultMatrixf(ctx->Exec, (m));
3347 }
3348 }
3349
3350
3351 void GLAPIENTRY
save_MultMatrixd(const GLdouble * m)3352 save_MultMatrixd(const GLdouble * m)
3353 {
3354 GLfloat f[16];
3355 GLint i;
3356 for (i = 0; i < 16; i++) {
3357 f[i] = (GLfloat) m[i];
3358 }
3359 save_MultMatrixf(f);
3360 }
3361
3362
3363 void GLAPIENTRY
save_NewList(GLuint name,GLenum mode)3364 save_NewList(GLuint name, GLenum mode)
3365 {
3366 GET_CURRENT_CONTEXT(ctx);
3367 /* It's an error to call this function while building a display list */
3368 _mesa_error(ctx, GL_INVALID_OPERATION, "glNewList");
3369 (void) name;
3370 (void) mode;
3371 }
3372
3373
3374
3375 void GLAPIENTRY
save_Ortho(GLdouble left,GLdouble right,GLdouble bottom,GLdouble top,GLdouble nearval,GLdouble farval)3376 save_Ortho(GLdouble left, GLdouble right,
3377 GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval)
3378 {
3379 GET_CURRENT_CONTEXT(ctx);
3380 Node *n;
3381 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3382 n = alloc_instruction(ctx, OPCODE_ORTHO, 6);
3383 if (n) {
3384 n[1].f = (GLfloat) left;
3385 n[2].f = (GLfloat) right;
3386 n[3].f = (GLfloat) bottom;
3387 n[4].f = (GLfloat) top;
3388 n[5].f = (GLfloat) nearval;
3389 n[6].f = (GLfloat) farval;
3390 }
3391 if (ctx->ExecuteFlag) {
3392 CALL_Ortho(ctx->Exec, (left, right, bottom, top, nearval, farval));
3393 }
3394 }
3395
3396
3397 void GLAPIENTRY
save_PatchParameteri(GLenum pname,const GLint value)3398 save_PatchParameteri(GLenum pname, const GLint value)
3399 {
3400 GET_CURRENT_CONTEXT(ctx);
3401 Node *n;
3402 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3403 n = alloc_instruction(ctx, OPCODE_PATCH_PARAMETER_I, 2);
3404 if (n) {
3405 n[1].e = pname;
3406 n[2].i = value;
3407 }
3408 if (ctx->ExecuteFlag) {
3409 CALL_PatchParameteri(ctx->Exec, (pname, value));
3410 }
3411 }
3412
3413
3414 void GLAPIENTRY
save_PatchParameterfv(GLenum pname,const GLfloat * params)3415 save_PatchParameterfv(GLenum pname, const GLfloat *params)
3416 {
3417 GET_CURRENT_CONTEXT(ctx);
3418 Node *n;
3419 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3420
3421 if (pname == GL_PATCH_DEFAULT_OUTER_LEVEL) {
3422 n = alloc_instruction(ctx, OPCODE_PATCH_PARAMETER_FV_OUTER, 5);
3423 } else {
3424 assert(pname == GL_PATCH_DEFAULT_INNER_LEVEL);
3425 n = alloc_instruction(ctx, OPCODE_PATCH_PARAMETER_FV_INNER, 3);
3426 }
3427 if (n) {
3428 n[1].e = pname;
3429 if (pname == GL_PATCH_DEFAULT_OUTER_LEVEL) {
3430 n[2].f = params[0];
3431 n[3].f = params[1];
3432 n[4].f = params[2];
3433 n[5].f = params[3];
3434 } else {
3435 n[2].f = params[0];
3436 n[3].f = params[1];
3437 }
3438 }
3439 if (ctx->ExecuteFlag) {
3440 CALL_PatchParameterfv(ctx->Exec, (pname, params));
3441 }
3442 }
3443
3444
3445 void GLAPIENTRY
save_PixelMapfv(GLenum map,GLint mapsize,const GLfloat * values)3446 save_PixelMapfv(GLenum map, GLint mapsize, const GLfloat *values)
3447 {
3448 GET_CURRENT_CONTEXT(ctx);
3449 Node *n;
3450 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3451 n = alloc_instruction(ctx, OPCODE_PIXEL_MAP, 2 + POINTER_DWORDS);
3452 if (n) {
3453 n[1].e = map;
3454 n[2].i = mapsize;
3455 save_pointer(&n[3], memdup(values, mapsize * sizeof(GLfloat)));
3456 }
3457 if (ctx->ExecuteFlag) {
3458 CALL_PixelMapfv(ctx->Exec, (map, mapsize, values));
3459 }
3460 }
3461
3462
3463 void GLAPIENTRY
save_PixelMapuiv(GLenum map,GLint mapsize,const GLuint * values)3464 save_PixelMapuiv(GLenum map, GLint mapsize, const GLuint *values)
3465 {
3466 GLfloat fvalues[MAX_PIXEL_MAP_TABLE];
3467 GLint i;
3468 if (map == GL_PIXEL_MAP_I_TO_I || map == GL_PIXEL_MAP_S_TO_S) {
3469 for (i = 0; i < mapsize; i++) {
3470 fvalues[i] = (GLfloat) values[i];
3471 }
3472 }
3473 else {
3474 for (i = 0; i < mapsize; i++) {
3475 fvalues[i] = UINT_TO_FLOAT(values[i]);
3476 }
3477 }
3478 save_PixelMapfv(map, mapsize, fvalues);
3479 }
3480
3481
3482 void GLAPIENTRY
save_PixelMapusv(GLenum map,GLint mapsize,const GLushort * values)3483 save_PixelMapusv(GLenum map, GLint mapsize, const GLushort *values)
3484 {
3485 GLfloat fvalues[MAX_PIXEL_MAP_TABLE];
3486 GLint i;
3487 if (map == GL_PIXEL_MAP_I_TO_I || map == GL_PIXEL_MAP_S_TO_S) {
3488 for (i = 0; i < mapsize; i++) {
3489 fvalues[i] = (GLfloat) values[i];
3490 }
3491 }
3492 else {
3493 for (i = 0; i < mapsize; i++) {
3494 fvalues[i] = USHORT_TO_FLOAT(values[i]);
3495 }
3496 }
3497 save_PixelMapfv(map, mapsize, fvalues);
3498 }
3499
3500
3501 void GLAPIENTRY
save_PixelTransferf(GLenum pname,GLfloat param)3502 save_PixelTransferf(GLenum pname, GLfloat param)
3503 {
3504 GET_CURRENT_CONTEXT(ctx);
3505 Node *n;
3506 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3507 n = alloc_instruction(ctx, OPCODE_PIXEL_TRANSFER, 2);
3508 if (n) {
3509 n[1].e = pname;
3510 n[2].f = param;
3511 }
3512 if (ctx->ExecuteFlag) {
3513 CALL_PixelTransferf(ctx->Exec, (pname, param));
3514 }
3515 }
3516
3517
3518 void GLAPIENTRY
save_PixelTransferi(GLenum pname,GLint param)3519 save_PixelTransferi(GLenum pname, GLint param)
3520 {
3521 save_PixelTransferf(pname, (GLfloat) param);
3522 }
3523
3524
3525 void GLAPIENTRY
save_PixelZoom(GLfloat xfactor,GLfloat yfactor)3526 save_PixelZoom(GLfloat xfactor, GLfloat yfactor)
3527 {
3528 GET_CURRENT_CONTEXT(ctx);
3529 Node *n;
3530 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3531 n = alloc_instruction(ctx, OPCODE_PIXEL_ZOOM, 2);
3532 if (n) {
3533 n[1].f = xfactor;
3534 n[2].f = yfactor;
3535 }
3536 if (ctx->ExecuteFlag) {
3537 CALL_PixelZoom(ctx->Exec, (xfactor, yfactor));
3538 }
3539 }
3540
3541
3542 void GLAPIENTRY
save_PointParameterfv(GLenum pname,const GLfloat * params)3543 save_PointParameterfv(GLenum pname, const GLfloat *params)
3544 {
3545 GET_CURRENT_CONTEXT(ctx);
3546 Node *n;
3547 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3548 n = alloc_instruction(ctx, OPCODE_POINT_PARAMETERS, 4);
3549 if (n) {
3550 n[1].e = pname;
3551 n[2].f = params[0];
3552 n[3].f = params[1];
3553 n[4].f = params[2];
3554 }
3555 if (ctx->ExecuteFlag) {
3556 CALL_PointParameterfv(ctx->Exec, (pname, params));
3557 }
3558 }
3559
3560
3561 void GLAPIENTRY
save_PointParameterf(GLenum pname,GLfloat param)3562 save_PointParameterf(GLenum pname, GLfloat param)
3563 {
3564 GLfloat parray[3];
3565 parray[0] = param;
3566 parray[1] = parray[2] = 0.0F;
3567 save_PointParameterfv(pname, parray);
3568 }
3569
3570 void GLAPIENTRY
save_PointParameteri(GLenum pname,GLint param)3571 save_PointParameteri(GLenum pname, GLint param)
3572 {
3573 GLfloat parray[3];
3574 parray[0] = (GLfloat) param;
3575 parray[1] = parray[2] = 0.0F;
3576 save_PointParameterfv(pname, parray);
3577 }
3578
3579 void GLAPIENTRY
save_PointParameteriv(GLenum pname,const GLint * param)3580 save_PointParameteriv(GLenum pname, const GLint * param)
3581 {
3582 GLfloat parray[3];
3583 parray[0] = (GLfloat) param[0];
3584 parray[1] = parray[2] = 0.0F;
3585 save_PointParameterfv(pname, parray);
3586 }
3587
3588
3589 void GLAPIENTRY
save_PointSize(GLfloat size)3590 save_PointSize(GLfloat size)
3591 {
3592 GET_CURRENT_CONTEXT(ctx);
3593 Node *n;
3594 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3595 n = alloc_instruction(ctx, OPCODE_POINT_SIZE, 1);
3596 if (n) {
3597 n[1].f = size;
3598 }
3599 if (ctx->ExecuteFlag) {
3600 CALL_PointSize(ctx->Exec, (size));
3601 }
3602 }
3603
3604
3605 void GLAPIENTRY
save_PolygonMode(GLenum face,GLenum mode)3606 save_PolygonMode(GLenum face, GLenum mode)
3607 {
3608 GET_CURRENT_CONTEXT(ctx);
3609 Node *n;
3610 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3611 n = alloc_instruction(ctx, OPCODE_POLYGON_MODE, 2);
3612 if (n) {
3613 n[1].e = face;
3614 n[2].e = mode;
3615 }
3616 if (ctx->ExecuteFlag) {
3617 CALL_PolygonMode(ctx->Exec, (face, mode));
3618 }
3619 }
3620
3621
3622 void GLAPIENTRY
save_PolygonStipple(const GLubyte * pattern)3623 save_PolygonStipple(const GLubyte * pattern)
3624 {
3625 GET_CURRENT_CONTEXT(ctx);
3626 Node *n;
3627
3628 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3629
3630 n = alloc_instruction(ctx, OPCODE_POLYGON_STIPPLE, POINTER_DWORDS);
3631 if (n) {
3632 save_pointer(&n[1],
3633 unpack_image(ctx, 2, 32, 32, 1, GL_COLOR_INDEX, GL_BITMAP,
3634 pattern, &ctx->Unpack));
3635 }
3636 if (ctx->ExecuteFlag) {
3637 CALL_PolygonStipple(ctx->Exec, ((GLubyte *) pattern));
3638 }
3639 }
3640
3641
3642 void GLAPIENTRY
save_PolygonOffset(GLfloat factor,GLfloat units)3643 save_PolygonOffset(GLfloat factor, GLfloat units)
3644 {
3645 GET_CURRENT_CONTEXT(ctx);
3646 Node *n;
3647 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3648 n = alloc_instruction(ctx, OPCODE_POLYGON_OFFSET, 2);
3649 if (n) {
3650 n[1].f = factor;
3651 n[2].f = units;
3652 }
3653 if (ctx->ExecuteFlag) {
3654 CALL_PolygonOffset(ctx->Exec, (factor, units));
3655 }
3656 }
3657
3658
3659 void GLAPIENTRY
save_PolygonOffsetClampEXT(GLfloat factor,GLfloat units,GLfloat clamp)3660 save_PolygonOffsetClampEXT(GLfloat factor, GLfloat units, GLfloat clamp)
3661 {
3662 GET_CURRENT_CONTEXT(ctx);
3663 Node *n;
3664 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3665 n = alloc_instruction(ctx, OPCODE_POLYGON_OFFSET_CLAMP, 3);
3666 if (n) {
3667 n[1].f = factor;
3668 n[2].f = units;
3669 n[3].f = clamp;
3670 }
3671 if (ctx->ExecuteFlag) {
3672 CALL_PolygonOffsetClampEXT(ctx->Exec, (factor, units, clamp));
3673 }
3674 }
3675
3676 void GLAPIENTRY
save_PopAttrib(void)3677 save_PopAttrib(void)
3678 {
3679 GET_CURRENT_CONTEXT(ctx);
3680 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3681 (void) alloc_instruction(ctx, OPCODE_POP_ATTRIB, 0);
3682 if (ctx->ExecuteFlag) {
3683 CALL_PopAttrib(ctx->Exec, ());
3684 }
3685 }
3686
3687
3688 void GLAPIENTRY
save_PopMatrix(void)3689 save_PopMatrix(void)
3690 {
3691 GET_CURRENT_CONTEXT(ctx);
3692 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3693 (void) alloc_instruction(ctx, OPCODE_POP_MATRIX, 0);
3694 if (ctx->ExecuteFlag) {
3695 CALL_PopMatrix(ctx->Exec, ());
3696 }
3697 }
3698
3699
3700 void GLAPIENTRY
save_PopName(void)3701 save_PopName(void)
3702 {
3703 GET_CURRENT_CONTEXT(ctx);
3704 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3705 (void) alloc_instruction(ctx, OPCODE_POP_NAME, 0);
3706 if (ctx->ExecuteFlag) {
3707 CALL_PopName(ctx->Exec, ());
3708 }
3709 }
3710
3711
3712 void GLAPIENTRY
save_PrioritizeTextures(GLsizei num,const GLuint * textures,const GLclampf * priorities)3713 save_PrioritizeTextures(GLsizei num, const GLuint * textures,
3714 const GLclampf * priorities)
3715 {
3716 GET_CURRENT_CONTEXT(ctx);
3717 GLint i;
3718 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3719
3720 for (i = 0; i < num; i++) {
3721 Node *n;
3722 n = alloc_instruction(ctx, OPCODE_PRIORITIZE_TEXTURE, 2);
3723 if (n) {
3724 n[1].ui = textures[i];
3725 n[2].f = priorities[i];
3726 }
3727 }
3728 if (ctx->ExecuteFlag) {
3729 CALL_PrioritizeTextures(ctx->Exec, (num, textures, priorities));
3730 }
3731 }
3732
3733
3734 void GLAPIENTRY
save_PushAttrib(GLbitfield mask)3735 save_PushAttrib(GLbitfield mask)
3736 {
3737 GET_CURRENT_CONTEXT(ctx);
3738 Node *n;
3739 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3740 n = alloc_instruction(ctx, OPCODE_PUSH_ATTRIB, 1);
3741 if (n) {
3742 n[1].bf = mask;
3743 }
3744 if (ctx->ExecuteFlag) {
3745 CALL_PushAttrib(ctx->Exec, (mask));
3746 }
3747 }
3748
3749
3750 void GLAPIENTRY
save_PushMatrix(void)3751 save_PushMatrix(void)
3752 {
3753 GET_CURRENT_CONTEXT(ctx);
3754 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3755 (void) alloc_instruction(ctx, OPCODE_PUSH_MATRIX, 0);
3756 if (ctx->ExecuteFlag) {
3757 CALL_PushMatrix(ctx->Exec, ());
3758 }
3759 }
3760
3761
3762 void GLAPIENTRY
save_PushName(GLuint name)3763 save_PushName(GLuint name)
3764 {
3765 GET_CURRENT_CONTEXT(ctx);
3766 Node *n;
3767 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3768 n = alloc_instruction(ctx, OPCODE_PUSH_NAME, 1);
3769 if (n) {
3770 n[1].ui = name;
3771 }
3772 if (ctx->ExecuteFlag) {
3773 CALL_PushName(ctx->Exec, (name));
3774 }
3775 }
3776
3777
3778 void GLAPIENTRY
save_RasterPos4f(GLfloat x,GLfloat y,GLfloat z,GLfloat w)3779 save_RasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
3780 {
3781 GET_CURRENT_CONTEXT(ctx);
3782 Node *n;
3783 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3784 n = alloc_instruction(ctx, OPCODE_RASTER_POS, 4);
3785 if (n) {
3786 n[1].f = x;
3787 n[2].f = y;
3788 n[3].f = z;
3789 n[4].f = w;
3790 }
3791 if (ctx->ExecuteFlag) {
3792 CALL_RasterPos4f(ctx->Exec, (x, y, z, w));
3793 }
3794 }
3795
3796 void GLAPIENTRY
save_RasterPos2d(GLdouble x,GLdouble y)3797 save_RasterPos2d(GLdouble x, GLdouble y)
3798 {
3799 save_RasterPos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
3800 }
3801
3802 void GLAPIENTRY
save_RasterPos2f(GLfloat x,GLfloat y)3803 save_RasterPos2f(GLfloat x, GLfloat y)
3804 {
3805 save_RasterPos4f(x, y, 0.0F, 1.0F);
3806 }
3807
3808 void GLAPIENTRY
save_RasterPos2i(GLint x,GLint y)3809 save_RasterPos2i(GLint x, GLint y)
3810 {
3811 save_RasterPos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
3812 }
3813
3814 void GLAPIENTRY
save_RasterPos2s(GLshort x,GLshort y)3815 save_RasterPos2s(GLshort x, GLshort y)
3816 {
3817 save_RasterPos4f(x, y, 0.0F, 1.0F);
3818 }
3819
3820 void GLAPIENTRY
save_RasterPos3d(GLdouble x,GLdouble y,GLdouble z)3821 save_RasterPos3d(GLdouble x, GLdouble y, GLdouble z)
3822 {
3823 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
3824 }
3825
3826 void GLAPIENTRY
save_RasterPos3f(GLfloat x,GLfloat y,GLfloat z)3827 save_RasterPos3f(GLfloat x, GLfloat y, GLfloat z)
3828 {
3829 save_RasterPos4f(x, y, z, 1.0F);
3830 }
3831
3832 void GLAPIENTRY
save_RasterPos3i(GLint x,GLint y,GLint z)3833 save_RasterPos3i(GLint x, GLint y, GLint z)
3834 {
3835 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
3836 }
3837
3838 void GLAPIENTRY
save_RasterPos3s(GLshort x,GLshort y,GLshort z)3839 save_RasterPos3s(GLshort x, GLshort y, GLshort z)
3840 {
3841 save_RasterPos4f(x, y, z, 1.0F);
3842 }
3843
3844 void GLAPIENTRY
save_RasterPos4d(GLdouble x,GLdouble y,GLdouble z,GLdouble w)3845 save_RasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
3846 {
3847 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
3848 }
3849
3850 void GLAPIENTRY
save_RasterPos4i(GLint x,GLint y,GLint z,GLint w)3851 save_RasterPos4i(GLint x, GLint y, GLint z, GLint w)
3852 {
3853 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
3854 }
3855
3856 void GLAPIENTRY
save_RasterPos4s(GLshort x,GLshort y,GLshort z,GLshort w)3857 save_RasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w)
3858 {
3859 save_RasterPos4f(x, y, z, w);
3860 }
3861
3862 void GLAPIENTRY
save_RasterPos2dv(const GLdouble * v)3863 save_RasterPos2dv(const GLdouble * v)
3864 {
3865 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
3866 }
3867
3868 void GLAPIENTRY
save_RasterPos2fv(const GLfloat * v)3869 save_RasterPos2fv(const GLfloat * v)
3870 {
3871 save_RasterPos4f(v[0], v[1], 0.0F, 1.0F);
3872 }
3873
3874 void GLAPIENTRY
save_RasterPos2iv(const GLint * v)3875 save_RasterPos2iv(const GLint * v)
3876 {
3877 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
3878 }
3879
3880 void GLAPIENTRY
save_RasterPos2sv(const GLshort * v)3881 save_RasterPos2sv(const GLshort * v)
3882 {
3883 save_RasterPos4f(v[0], v[1], 0.0F, 1.0F);
3884 }
3885
3886 void GLAPIENTRY
save_RasterPos3dv(const GLdouble * v)3887 save_RasterPos3dv(const GLdouble * v)
3888 {
3889 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
3890 }
3891
3892 void GLAPIENTRY
save_RasterPos3fv(const GLfloat * v)3893 save_RasterPos3fv(const GLfloat * v)
3894 {
3895 save_RasterPos4f(v[0], v[1], v[2], 1.0F);
3896 }
3897
3898 void GLAPIENTRY
save_RasterPos3iv(const GLint * v)3899 save_RasterPos3iv(const GLint * v)
3900 {
3901 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
3902 }
3903
3904 void GLAPIENTRY
save_RasterPos3sv(const GLshort * v)3905 save_RasterPos3sv(const GLshort * v)
3906 {
3907 save_RasterPos4f(v[0], v[1], v[2], 1.0F);
3908 }
3909
3910 void GLAPIENTRY
save_RasterPos4dv(const GLdouble * v)3911 save_RasterPos4dv(const GLdouble * v)
3912 {
3913 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1],
3914 (GLfloat) v[2], (GLfloat) v[3]);
3915 }
3916
3917 void GLAPIENTRY
save_RasterPos4fv(const GLfloat * v)3918 save_RasterPos4fv(const GLfloat * v)
3919 {
3920 save_RasterPos4f(v[0], v[1], v[2], v[3]);
3921 }
3922
3923 void GLAPIENTRY
save_RasterPos4iv(const GLint * v)3924 save_RasterPos4iv(const GLint * v)
3925 {
3926 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1],
3927 (GLfloat) v[2], (GLfloat) v[3]);
3928 }
3929
3930 void GLAPIENTRY
save_RasterPos4sv(const GLshort * v)3931 save_RasterPos4sv(const GLshort * v)
3932 {
3933 save_RasterPos4f(v[0], v[1], v[2], v[3]);
3934 }
3935
3936
3937 void GLAPIENTRY
save_PassThrough(GLfloat token)3938 save_PassThrough(GLfloat token)
3939 {
3940 GET_CURRENT_CONTEXT(ctx);
3941 Node *n;
3942 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3943 n = alloc_instruction(ctx, OPCODE_PASSTHROUGH, 1);
3944 if (n) {
3945 n[1].f = token;
3946 }
3947 if (ctx->ExecuteFlag) {
3948 CALL_PassThrough(ctx->Exec, (token));
3949 }
3950 }
3951
3952
3953 void GLAPIENTRY
save_ReadBuffer(GLenum mode)3954 save_ReadBuffer(GLenum mode)
3955 {
3956 GET_CURRENT_CONTEXT(ctx);
3957 Node *n;
3958 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3959 n = alloc_instruction(ctx, OPCODE_READ_BUFFER, 1);
3960 if (n) {
3961 n[1].e = mode;
3962 }
3963 if (ctx->ExecuteFlag) {
3964 CALL_ReadBuffer(ctx->Exec, (mode));
3965 }
3966 }
3967
3968
3969 void GLAPIENTRY
save_Rotatef(GLfloat angle,GLfloat x,GLfloat y,GLfloat z)3970 save_Rotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
3971 {
3972 GET_CURRENT_CONTEXT(ctx);
3973 Node *n;
3974 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3975 n = alloc_instruction(ctx, OPCODE_ROTATE, 4);
3976 if (n) {
3977 n[1].f = angle;
3978 n[2].f = x;
3979 n[3].f = y;
3980 n[4].f = z;
3981 }
3982 if (ctx->ExecuteFlag) {
3983 CALL_Rotatef(ctx->Exec, (angle, x, y, z));
3984 }
3985 }
3986
3987
3988 void GLAPIENTRY
save_Rotated(GLdouble angle,GLdouble x,GLdouble y,GLdouble z)3989 save_Rotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
3990 {
3991 save_Rotatef((GLfloat) angle, (GLfloat) x, (GLfloat) y, (GLfloat) z);
3992 }
3993
3994
3995 void GLAPIENTRY
save_Scalef(GLfloat x,GLfloat y,GLfloat z)3996 save_Scalef(GLfloat x, GLfloat y, GLfloat z)
3997 {
3998 GET_CURRENT_CONTEXT(ctx);
3999 Node *n;
4000 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4001 n = alloc_instruction(ctx, OPCODE_SCALE, 3);
4002 if (n) {
4003 n[1].f = x;
4004 n[2].f = y;
4005 n[3].f = z;
4006 }
4007 if (ctx->ExecuteFlag) {
4008 CALL_Scalef(ctx->Exec, (x, y, z));
4009 }
4010 }
4011
4012
4013 void GLAPIENTRY
save_Scaled(GLdouble x,GLdouble y,GLdouble z)4014 save_Scaled(GLdouble x, GLdouble y, GLdouble z)
4015 {
4016 save_Scalef((GLfloat) x, (GLfloat) y, (GLfloat) z);
4017 }
4018
4019
4020 void GLAPIENTRY
save_Scissor(GLint x,GLint y,GLsizei width,GLsizei height)4021 save_Scissor(GLint x, GLint y, GLsizei width, GLsizei height)
4022 {
4023 GET_CURRENT_CONTEXT(ctx);
4024 Node *n;
4025 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4026 n = alloc_instruction(ctx, OPCODE_SCISSOR, 4);
4027 if (n) {
4028 n[1].i = x;
4029 n[2].i = y;
4030 n[3].i = width;
4031 n[4].i = height;
4032 }
4033 if (ctx->ExecuteFlag) {
4034 CALL_Scissor(ctx->Exec, (x, y, width, height));
4035 }
4036 }
4037
4038
4039 void GLAPIENTRY
save_ShadeModel(GLenum mode)4040 save_ShadeModel(GLenum mode)
4041 {
4042 GET_CURRENT_CONTEXT(ctx);
4043 Node *n;
4044 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx);
4045
4046 if (ctx->ExecuteFlag) {
4047 CALL_ShadeModel(ctx->Exec, (mode));
4048 }
4049
4050 /* Don't compile this call if it's a no-op.
4051 * By avoiding this state change we have a better chance of
4052 * coalescing subsequent drawing commands into one batch.
4053 */
4054 if (ctx->ListState.Current.ShadeModel == mode)
4055 return;
4056
4057 SAVE_FLUSH_VERTICES(ctx);
4058
4059 ctx->ListState.Current.ShadeModel = mode;
4060
4061 n = alloc_instruction(ctx, OPCODE_SHADE_MODEL, 1);
4062 if (n) {
4063 n[1].e = mode;
4064 }
4065 }
4066
4067
4068 void GLAPIENTRY
save_StencilFunc(GLenum func,GLint ref,GLuint mask)4069 save_StencilFunc(GLenum func, GLint ref, GLuint mask)
4070 {
4071 GET_CURRENT_CONTEXT(ctx);
4072 Node *n;
4073 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4074 n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC, 3);
4075 if (n) {
4076 n[1].e = func;
4077 n[2].i = ref;
4078 n[3].ui = mask;
4079 }
4080 if (ctx->ExecuteFlag) {
4081 CALL_StencilFunc(ctx->Exec, (func, ref, mask));
4082 }
4083 }
4084
4085
4086 void GLAPIENTRY
save_StencilMask(GLuint mask)4087 save_StencilMask(GLuint mask)
4088 {
4089 GET_CURRENT_CONTEXT(ctx);
4090 Node *n;
4091 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4092 n = alloc_instruction(ctx, OPCODE_STENCIL_MASK, 1);
4093 if (n) {
4094 n[1].ui = mask;
4095 }
4096 if (ctx->ExecuteFlag) {
4097 CALL_StencilMask(ctx->Exec, (mask));
4098 }
4099 }
4100
4101
4102 void GLAPIENTRY
save_StencilOp(GLenum fail,GLenum zfail,GLenum zpass)4103 save_StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
4104 {
4105 GET_CURRENT_CONTEXT(ctx);
4106 Node *n;
4107 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4108 n = alloc_instruction(ctx, OPCODE_STENCIL_OP, 3);
4109 if (n) {
4110 n[1].e = fail;
4111 n[2].e = zfail;
4112 n[3].e = zpass;
4113 }
4114 if (ctx->ExecuteFlag) {
4115 CALL_StencilOp(ctx->Exec, (fail, zfail, zpass));
4116 }
4117 }
4118
4119
4120 void GLAPIENTRY
save_StencilFuncSeparate(GLenum face,GLenum func,GLint ref,GLuint mask)4121 save_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
4122 {
4123 GET_CURRENT_CONTEXT(ctx);
4124 Node *n;
4125 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4126 n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4);
4127 if (n) {
4128 n[1].e = face;
4129 n[2].e = func;
4130 n[3].i = ref;
4131 n[4].ui = mask;
4132 }
4133 if (ctx->ExecuteFlag) {
4134 CALL_StencilFuncSeparate(ctx->Exec, (face, func, ref, mask));
4135 }
4136 }
4137
4138
4139 void GLAPIENTRY
save_StencilFuncSeparateATI(GLenum frontfunc,GLenum backfunc,GLint ref,GLuint mask)4140 save_StencilFuncSeparateATI(GLenum frontfunc, GLenum backfunc, GLint ref,
4141 GLuint mask)
4142 {
4143 GET_CURRENT_CONTEXT(ctx);
4144 Node *n;
4145 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4146 /* GL_FRONT */
4147 n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4);
4148 if (n) {
4149 n[1].e = GL_FRONT;
4150 n[2].e = frontfunc;
4151 n[3].i = ref;
4152 n[4].ui = mask;
4153 }
4154 /* GL_BACK */
4155 n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4);
4156 if (n) {
4157 n[1].e = GL_BACK;
4158 n[2].e = backfunc;
4159 n[3].i = ref;
4160 n[4].ui = mask;
4161 }
4162 if (ctx->ExecuteFlag) {
4163 CALL_StencilFuncSeparate(ctx->Exec, (GL_FRONT, frontfunc, ref, mask));
4164 CALL_StencilFuncSeparate(ctx->Exec, (GL_BACK, backfunc, ref, mask));
4165 }
4166 }
4167
4168
4169 void GLAPIENTRY
save_StencilMaskSeparate(GLenum face,GLuint mask)4170 save_StencilMaskSeparate(GLenum face, GLuint mask)
4171 {
4172 GET_CURRENT_CONTEXT(ctx);
4173 Node *n;
4174 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4175 n = alloc_instruction(ctx, OPCODE_STENCIL_MASK_SEPARATE, 2);
4176 if (n) {
4177 n[1].e = face;
4178 n[2].ui = mask;
4179 }
4180 if (ctx->ExecuteFlag) {
4181 CALL_StencilMaskSeparate(ctx->Exec, (face, mask));
4182 }
4183 }
4184
4185
4186 void GLAPIENTRY
save_StencilOpSeparate(GLenum face,GLenum fail,GLenum zfail,GLenum zpass)4187 save_StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
4188 {
4189 GET_CURRENT_CONTEXT(ctx);
4190 Node *n;
4191 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4192 n = alloc_instruction(ctx, OPCODE_STENCIL_OP_SEPARATE, 4);
4193 if (n) {
4194 n[1].e = face;
4195 n[2].e = fail;
4196 n[3].e = zfail;
4197 n[4].e = zpass;
4198 }
4199 if (ctx->ExecuteFlag) {
4200 CALL_StencilOpSeparate(ctx->Exec, (face, fail, zfail, zpass));
4201 }
4202 }
4203
4204
4205 void GLAPIENTRY
save_TexEnvfv(GLenum target,GLenum pname,const GLfloat * params)4206 save_TexEnvfv(GLenum target, GLenum pname, const GLfloat *params)
4207 {
4208 GET_CURRENT_CONTEXT(ctx);
4209 Node *n;
4210 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4211 n = alloc_instruction(ctx, OPCODE_TEXENV, 6);
4212 if (n) {
4213 n[1].e = target;
4214 n[2].e = pname;
4215 if (pname == GL_TEXTURE_ENV_COLOR) {
4216 n[3].f = params[0];
4217 n[4].f = params[1];
4218 n[5].f = params[2];
4219 n[6].f = params[3];
4220 }
4221 else {
4222 n[3].f = params[0];
4223 n[4].f = n[5].f = n[6].f = 0.0F;
4224 }
4225 }
4226 if (ctx->ExecuteFlag) {
4227 CALL_TexEnvfv(ctx->Exec, (target, pname, params));
4228 }
4229 }
4230
4231
4232 void GLAPIENTRY
save_TexEnvf(GLenum target,GLenum pname,GLfloat param)4233 save_TexEnvf(GLenum target, GLenum pname, GLfloat param)
4234 {
4235 GLfloat parray[4];
4236 parray[0] = (GLfloat) param;
4237 parray[1] = parray[2] = parray[3] = 0.0F;
4238 save_TexEnvfv(target, pname, parray);
4239 }
4240
4241
4242 void GLAPIENTRY
save_TexEnvi(GLenum target,GLenum pname,GLint param)4243 save_TexEnvi(GLenum target, GLenum pname, GLint param)
4244 {
4245 GLfloat p[4];
4246 p[0] = (GLfloat) param;
4247 p[1] = p[2] = p[3] = 0.0F;
4248 save_TexEnvfv(target, pname, p);
4249 }
4250
4251
4252 void GLAPIENTRY
save_TexEnviv(GLenum target,GLenum pname,const GLint * param)4253 save_TexEnviv(GLenum target, GLenum pname, const GLint * param)
4254 {
4255 GLfloat p[4];
4256 if (pname == GL_TEXTURE_ENV_COLOR) {
4257 p[0] = INT_TO_FLOAT(param[0]);
4258 p[1] = INT_TO_FLOAT(param[1]);
4259 p[2] = INT_TO_FLOAT(param[2]);
4260 p[3] = INT_TO_FLOAT(param[3]);
4261 }
4262 else {
4263 p[0] = (GLfloat) param[0];
4264 p[1] = p[2] = p[3] = 0.0F;
4265 }
4266 save_TexEnvfv(target, pname, p);
4267 }
4268
4269
4270 void GLAPIENTRY
save_TexGenfv(GLenum coord,GLenum pname,const GLfloat * params)4271 save_TexGenfv(GLenum coord, GLenum pname, const GLfloat *params)
4272 {
4273 GET_CURRENT_CONTEXT(ctx);
4274 Node *n;
4275 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4276 n = alloc_instruction(ctx, OPCODE_TEXGEN, 6);
4277 if (n) {
4278 n[1].e = coord;
4279 n[2].e = pname;
4280 n[3].f = params[0];
4281 n[4].f = params[1];
4282 n[5].f = params[2];
4283 n[6].f = params[3];
4284 }
4285 if (ctx->ExecuteFlag) {
4286 CALL_TexGenfv(ctx->Exec, (coord, pname, params));
4287 }
4288 }
4289
4290
4291 void GLAPIENTRY
save_TexGeniv(GLenum coord,GLenum pname,const GLint * params)4292 save_TexGeniv(GLenum coord, GLenum pname, const GLint *params)
4293 {
4294 GLfloat p[4];
4295 p[0] = (GLfloat) params[0];
4296 p[1] = (GLfloat) params[1];
4297 p[2] = (GLfloat) params[2];
4298 p[3] = (GLfloat) params[3];
4299 save_TexGenfv(coord, pname, p);
4300 }
4301
4302
4303 void GLAPIENTRY
save_TexGend(GLenum coord,GLenum pname,GLdouble param)4304 save_TexGend(GLenum coord, GLenum pname, GLdouble param)
4305 {
4306 GLfloat parray[4];
4307 parray[0] = (GLfloat) param;
4308 parray[1] = parray[2] = parray[3] = 0.0F;
4309 save_TexGenfv(coord, pname, parray);
4310 }
4311
4312
4313 void GLAPIENTRY
save_TexGendv(GLenum coord,GLenum pname,const GLdouble * params)4314 save_TexGendv(GLenum coord, GLenum pname, const GLdouble *params)
4315 {
4316 GLfloat p[4];
4317 p[0] = (GLfloat) params[0];
4318 p[1] = (GLfloat) params[1];
4319 p[2] = (GLfloat) params[2];
4320 p[3] = (GLfloat) params[3];
4321 save_TexGenfv(coord, pname, p);
4322 }
4323
4324
4325 void GLAPIENTRY
save_TexGenf(GLenum coord,GLenum pname,GLfloat param)4326 save_TexGenf(GLenum coord, GLenum pname, GLfloat param)
4327 {
4328 GLfloat parray[4];
4329 parray[0] = param;
4330 parray[1] = parray[2] = parray[3] = 0.0F;
4331 save_TexGenfv(coord, pname, parray);
4332 }
4333
4334
4335 void GLAPIENTRY
save_TexGeni(GLenum coord,GLenum pname,GLint param)4336 save_TexGeni(GLenum coord, GLenum pname, GLint param)
4337 {
4338 GLint parray[4];
4339 parray[0] = param;
4340 parray[1] = parray[2] = parray[3] = 0;
4341 save_TexGeniv(coord, pname, parray);
4342 }
4343
4344
4345 void GLAPIENTRY
save_TexParameterfv(GLenum target,GLenum pname,const GLfloat * params)4346 save_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
4347 {
4348 GET_CURRENT_CONTEXT(ctx);
4349 Node *n;
4350 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4351 n = alloc_instruction(ctx, OPCODE_TEXPARAMETER, 6);
4352 if (n) {
4353 n[1].e = target;
4354 n[2].e = pname;
4355 n[3].f = params[0];
4356 n[4].f = params[1];
4357 n[5].f = params[2];
4358 n[6].f = params[3];
4359 }
4360 if (ctx->ExecuteFlag) {
4361 CALL_TexParameterfv(ctx->Exec, (target, pname, params));
4362 }
4363 }
4364
4365
4366 void GLAPIENTRY
save_TexParameterf(GLenum target,GLenum pname,GLfloat param)4367 save_TexParameterf(GLenum target, GLenum pname, GLfloat param)
4368 {
4369 GLfloat parray[4];
4370 parray[0] = param;
4371 parray[1] = parray[2] = parray[3] = 0.0F;
4372 save_TexParameterfv(target, pname, parray);
4373 }
4374
4375
4376 void GLAPIENTRY
save_TexParameteri(GLenum target,GLenum pname,GLint param)4377 save_TexParameteri(GLenum target, GLenum pname, GLint param)
4378 {
4379 GLfloat fparam[4];
4380 fparam[0] = (GLfloat) param;
4381 fparam[1] = fparam[2] = fparam[3] = 0.0F;
4382 save_TexParameterfv(target, pname, fparam);
4383 }
4384
4385
4386 void GLAPIENTRY
save_TexParameteriv(GLenum target,GLenum pname,const GLint * params)4387 save_TexParameteriv(GLenum target, GLenum pname, const GLint *params)
4388 {
4389 GLfloat fparam[4];
4390 fparam[0] = (GLfloat) params[0];
4391 fparam[1] = fparam[2] = fparam[3] = 0.0F;
4392 save_TexParameterfv(target, pname, fparam);
4393 }
4394
4395
4396 void GLAPIENTRY
save_TexImage1D(GLenum target,GLint level,GLint components,GLsizei width,GLint border,GLenum format,GLenum type,const GLvoid * pixels)4397 save_TexImage1D(GLenum target,
4398 GLint level, GLint components,
4399 GLsizei width, GLint border,
4400 GLenum format, GLenum type, const GLvoid * pixels)
4401 {
4402 GET_CURRENT_CONTEXT(ctx);
4403 if (target == GL_PROXY_TEXTURE_1D) {
4404 /* don't compile, execute immediately */
4405 CALL_TexImage1D(ctx->Exec, (target, level, components, width,
4406 border, format, type, pixels));
4407 }
4408 else {
4409 Node *n;
4410 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4411 n = alloc_instruction(ctx, OPCODE_TEX_IMAGE1D, 7 + POINTER_DWORDS);
4412 if (n) {
4413 n[1].e = target;
4414 n[2].i = level;
4415 n[3].i = components;
4416 n[4].i = (GLint) width;
4417 n[5].i = border;
4418 n[6].e = format;
4419 n[7].e = type;
4420 save_pointer(&n[8],
4421 unpack_image(ctx, 1, width, 1, 1, format, type,
4422 pixels, &ctx->Unpack));
4423 }
4424 if (ctx->ExecuteFlag) {
4425 CALL_TexImage1D(ctx->Exec, (target, level, components, width,
4426 border, format, type, pixels));
4427 }
4428 }
4429 }
4430
4431
4432 void GLAPIENTRY
save_TexImage2D(GLenum target,GLint level,GLint components,GLsizei width,GLsizei height,GLint border,GLenum format,GLenum type,const GLvoid * pixels)4433 save_TexImage2D(GLenum target,
4434 GLint level, GLint components,
4435 GLsizei width, GLsizei height, GLint border,
4436 GLenum format, GLenum type, const GLvoid * pixels)
4437 {
4438 GET_CURRENT_CONTEXT(ctx);
4439 if (target == GL_PROXY_TEXTURE_2D) {
4440 /* don't compile, execute immediately */
4441 CALL_TexImage2D(ctx->Exec, (target, level, components, width,
4442 height, border, format, type, pixels));
4443 }
4444 else {
4445 Node *n;
4446 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4447 n = alloc_instruction(ctx, OPCODE_TEX_IMAGE2D, 8 + POINTER_DWORDS);
4448 if (n) {
4449 n[1].e = target;
4450 n[2].i = level;
4451 n[3].i = components;
4452 n[4].i = (GLint) width;
4453 n[5].i = (GLint) height;
4454 n[6].i = border;
4455 n[7].e = format;
4456 n[8].e = type;
4457 save_pointer(&n[9],
4458 unpack_image(ctx, 2, width, height, 1, format, type,
4459 pixels, &ctx->Unpack));
4460 }
4461 if (ctx->ExecuteFlag) {
4462 CALL_TexImage2D(ctx->Exec, (target, level, components, width,
4463 height, border, format, type, pixels));
4464 }
4465 }
4466 }
4467
4468
4469 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)4470 save_TexImage3D(GLenum target,
4471 GLint level, GLint internalFormat,
4472 GLsizei width, GLsizei height, GLsizei depth,
4473 GLint border,
4474 GLenum format, GLenum type, const GLvoid * pixels)
4475 {
4476 GET_CURRENT_CONTEXT(ctx);
4477 if (target == GL_PROXY_TEXTURE_3D) {
4478 /* don't compile, execute immediately */
4479 CALL_TexImage3D(ctx->Exec, (target, level, internalFormat, width,
4480 height, depth, border, format, type,
4481 pixels));
4482 }
4483 else {
4484 Node *n;
4485 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4486 n = alloc_instruction(ctx, OPCODE_TEX_IMAGE3D, 9 + POINTER_DWORDS);
4487 if (n) {
4488 n[1].e = target;
4489 n[2].i = level;
4490 n[3].i = (GLint) internalFormat;
4491 n[4].i = (GLint) width;
4492 n[5].i = (GLint) height;
4493 n[6].i = (GLint) depth;
4494 n[7].i = border;
4495 n[8].e = format;
4496 n[9].e = type;
4497 save_pointer(&n[10],
4498 unpack_image(ctx, 3, width, height, depth, format, type,
4499 pixels, &ctx->Unpack));
4500 }
4501 if (ctx->ExecuteFlag) {
4502 CALL_TexImage3D(ctx->Exec, (target, level, internalFormat, width,
4503 height, depth, border, format, type,
4504 pixels));
4505 }
4506 }
4507 }
4508
4509
4510 void GLAPIENTRY
save_TexSubImage1D(GLenum target,GLint level,GLint xoffset,GLsizei width,GLenum format,GLenum type,const GLvoid * pixels)4511 save_TexSubImage1D(GLenum target, GLint level, GLint xoffset,
4512 GLsizei width, GLenum format, GLenum type,
4513 const GLvoid * pixels)
4514 {
4515 GET_CURRENT_CONTEXT(ctx);
4516 Node *n;
4517
4518 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4519
4520 n = alloc_instruction(ctx, OPCODE_TEX_SUB_IMAGE1D, 6 + POINTER_DWORDS);
4521 if (n) {
4522 n[1].e = target;
4523 n[2].i = level;
4524 n[3].i = xoffset;
4525 n[4].i = (GLint) width;
4526 n[5].e = format;
4527 n[6].e = type;
4528 save_pointer(&n[7],
4529 unpack_image(ctx, 1, width, 1, 1, format, type,
4530 pixels, &ctx->Unpack));
4531 }
4532 if (ctx->ExecuteFlag) {
4533 CALL_TexSubImage1D(ctx->Exec, (target, level, xoffset, width,
4534 format, type, pixels));
4535 }
4536 }
4537
4538
4539 void GLAPIENTRY
save_TexSubImage2D(GLenum target,GLint level,GLint xoffset,GLint yoffset,GLsizei width,GLsizei height,GLenum format,GLenum type,const GLvoid * pixels)4540 save_TexSubImage2D(GLenum target, GLint level,
4541 GLint xoffset, GLint yoffset,
4542 GLsizei width, GLsizei height,
4543 GLenum format, GLenum type, const GLvoid * pixels)
4544 {
4545 GET_CURRENT_CONTEXT(ctx);
4546 Node *n;
4547
4548 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4549
4550 n = alloc_instruction(ctx, OPCODE_TEX_SUB_IMAGE2D, 8 + POINTER_DWORDS);
4551 if (n) {
4552 n[1].e = target;
4553 n[2].i = level;
4554 n[3].i = xoffset;
4555 n[4].i = yoffset;
4556 n[5].i = (GLint) width;
4557 n[6].i = (GLint) height;
4558 n[7].e = format;
4559 n[8].e = type;
4560 save_pointer(&n[9],
4561 unpack_image(ctx, 2, width, height, 1, format, type,
4562 pixels, &ctx->Unpack));
4563 }
4564 if (ctx->ExecuteFlag) {
4565 CALL_TexSubImage2D(ctx->Exec, (target, level, xoffset, yoffset,
4566 width, height, format, type, pixels));
4567 }
4568 }
4569
4570
4571 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)4572 save_TexSubImage3D(GLenum target, GLint level,
4573 GLint xoffset, GLint yoffset, GLint zoffset,
4574 GLsizei width, GLsizei height, GLsizei depth,
4575 GLenum format, GLenum type, const GLvoid * pixels)
4576 {
4577 GET_CURRENT_CONTEXT(ctx);
4578 Node *n;
4579
4580 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4581
4582 n = alloc_instruction(ctx, OPCODE_TEX_SUB_IMAGE3D, 10 + POINTER_DWORDS);
4583 if (n) {
4584 n[1].e = target;
4585 n[2].i = level;
4586 n[3].i = xoffset;
4587 n[4].i = yoffset;
4588 n[5].i = zoffset;
4589 n[6].i = (GLint) width;
4590 n[7].i = (GLint) height;
4591 n[8].i = (GLint) depth;
4592 n[9].e = format;
4593 n[10].e = type;
4594 save_pointer(&n[11],
4595 unpack_image(ctx, 3, width, height, depth, format, type,
4596 pixels, &ctx->Unpack));
4597 }
4598 if (ctx->ExecuteFlag) {
4599 CALL_TexSubImage3D(ctx->Exec, (target, level,
4600 xoffset, yoffset, zoffset,
4601 width, height, depth, format, type,
4602 pixels));
4603 }
4604 }
4605
4606
4607 void GLAPIENTRY
save_Translatef(GLfloat x,GLfloat y,GLfloat z)4608 save_Translatef(GLfloat x, GLfloat y, GLfloat z)
4609 {
4610 GET_CURRENT_CONTEXT(ctx);
4611 Node *n;
4612 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4613 n = alloc_instruction(ctx, OPCODE_TRANSLATE, 3);
4614 if (n) {
4615 n[1].f = x;
4616 n[2].f = y;
4617 n[3].f = z;
4618 }
4619 if (ctx->ExecuteFlag) {
4620 CALL_Translatef(ctx->Exec, (x, y, z));
4621 }
4622 }
4623
4624
4625 void GLAPIENTRY
save_Translated(GLdouble x,GLdouble y,GLdouble z)4626 save_Translated(GLdouble x, GLdouble y, GLdouble z)
4627 {
4628 save_Translatef((GLfloat) x, (GLfloat) y, (GLfloat) z);
4629 }
4630
4631
4632
4633 void GLAPIENTRY
save_Viewport(GLint x,GLint y,GLsizei width,GLsizei height)4634 save_Viewport(GLint x, GLint y, GLsizei width, GLsizei height)
4635 {
4636 GET_CURRENT_CONTEXT(ctx);
4637 Node *n;
4638 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4639 n = alloc_instruction(ctx, OPCODE_VIEWPORT, 4);
4640 if (n) {
4641 n[1].i = x;
4642 n[2].i = y;
4643 n[3].i = (GLint) width;
4644 n[4].i = (GLint) height;
4645 }
4646 if (ctx->ExecuteFlag) {
4647 CALL_Viewport(ctx->Exec, (x, y, width, height));
4648 }
4649 }
4650
4651 void GLAPIENTRY
save_ViewportIndexedf(GLuint index,GLfloat x,GLfloat y,GLfloat width,GLfloat height)4652 save_ViewportIndexedf(GLuint index, GLfloat x, GLfloat y, GLfloat width,
4653 GLfloat height)
4654 {
4655 GET_CURRENT_CONTEXT(ctx);
4656 Node *n;
4657 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4658 n = alloc_instruction(ctx, OPCODE_VIEWPORT_INDEXED_F, 5);
4659 if (n) {
4660 n[1].ui = index;
4661 n[2].f = x;
4662 n[3].f = y;
4663 n[4].f = width;
4664 n[5].f = height;
4665 }
4666 if (ctx->ExecuteFlag) {
4667 CALL_ViewportIndexedf(ctx->Exec, (index, x, y, width, height));
4668 }
4669 }
4670
4671 void GLAPIENTRY
save_ViewportIndexedfv(GLuint index,const GLfloat * v)4672 save_ViewportIndexedfv(GLuint index, const GLfloat *v)
4673 {
4674 GET_CURRENT_CONTEXT(ctx);
4675 Node *n;
4676 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4677 n = alloc_instruction(ctx, OPCODE_VIEWPORT_INDEXED_FV, 5);
4678 if (n) {
4679 n[1].ui = index;
4680 n[2].f = v[0];
4681 n[3].f = v[1];
4682 n[4].f = v[2];
4683 n[5].f = v[3];
4684 }
4685 if (ctx->ExecuteFlag) {
4686 CALL_ViewportIndexedfv(ctx->Exec, (index, v));
4687 }
4688 }
4689
4690 void GLAPIENTRY
save_ViewportArrayv(GLuint first,GLsizei count,const GLfloat * v)4691 save_ViewportArrayv(GLuint first, GLsizei count, const GLfloat *v)
4692 {
4693 GET_CURRENT_CONTEXT(ctx);
4694 Node *n;
4695 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4696 n = alloc_instruction(ctx, OPCODE_VIEWPORT_ARRAY_V, 2 + POINTER_DWORDS);
4697 if (n) {
4698 n[1].ui = first;
4699 n[2].si = count;
4700 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLfloat)));
4701 }
4702 if (ctx->ExecuteFlag) {
4703 CALL_ViewportArrayv(ctx->Exec, (first, count, v));
4704 }
4705 }
4706
4707 void GLAPIENTRY
save_ScissorIndexed(GLuint index,GLint left,GLint bottom,GLsizei width,GLsizei height)4708 save_ScissorIndexed(GLuint index, GLint left, GLint bottom, GLsizei width,
4709 GLsizei height)
4710 {
4711 GET_CURRENT_CONTEXT(ctx);
4712 Node *n;
4713 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4714 n = alloc_instruction(ctx, OPCODE_SCISSOR_INDEXED, 5);
4715 if (n) {
4716 n[1].ui = index;
4717 n[2].i = left;
4718 n[3].i = bottom;
4719 n[4].si = width;
4720 n[5].si = height;
4721 }
4722 if (ctx->ExecuteFlag) {
4723 CALL_ScissorIndexed(ctx->Exec, (index, left, bottom, width, height));
4724 }
4725 }
4726
4727 void GLAPIENTRY
save_ScissorIndexedv(GLuint index,const GLint * v)4728 save_ScissorIndexedv(GLuint index, const GLint *v)
4729 {
4730 GET_CURRENT_CONTEXT(ctx);
4731 Node *n;
4732 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4733 n = alloc_instruction(ctx, OPCODE_SCISSOR_INDEXED_V, 5);
4734 if (n) {
4735 n[1].ui = index;
4736 n[2].i = v[0];
4737 n[3].i = v[1];
4738 n[4].si = v[2];
4739 n[5].si = v[3];
4740 }
4741 if (ctx->ExecuteFlag) {
4742 CALL_ScissorIndexedv(ctx->Exec, (index, v));
4743 }
4744 }
4745
4746 void GLAPIENTRY
save_ScissorArrayv(GLuint first,GLsizei count,const GLint * v)4747 save_ScissorArrayv(GLuint first, GLsizei count, const GLint *v)
4748 {
4749 GET_CURRENT_CONTEXT(ctx);
4750 Node *n;
4751 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4752 n = alloc_instruction(ctx, OPCODE_SCISSOR_ARRAY_V, 2 + POINTER_DWORDS);
4753 if (n) {
4754 n[1].ui = first;
4755 n[2].si = count;
4756 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLint)));
4757 }
4758 if (ctx->ExecuteFlag) {
4759 CALL_ScissorArrayv(ctx->Exec, (first, count, v));
4760 }
4761 }
4762
4763 void GLAPIENTRY
save_DepthRangeIndexed(GLuint index,GLclampd n,GLclampd f)4764 save_DepthRangeIndexed(GLuint index, GLclampd n, GLclampd f)
4765 {
4766 GET_CURRENT_CONTEXT(ctx);
4767 Node *node;
4768 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4769 node = alloc_instruction(ctx, OPCODE_DEPTH_INDEXED, 3);
4770 if (node) {
4771 node[1].ui = index;
4772 /* Mesa stores these as floats internally so we deliberately convert
4773 * them to a float here.
4774 */
4775 node[2].f = n;
4776 node[3].f = f;
4777 }
4778 if (ctx->ExecuteFlag) {
4779 CALL_DepthRangeIndexed(ctx->Exec, (index, n, f));
4780 }
4781 }
4782
4783 void GLAPIENTRY
save_DepthRangeArrayv(GLuint first,GLsizei count,const GLclampd * v)4784 save_DepthRangeArrayv(GLuint first, GLsizei count, const GLclampd *v)
4785 {
4786 GET_CURRENT_CONTEXT(ctx);
4787 Node *n;
4788 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4789 n = alloc_instruction(ctx, OPCODE_DEPTH_ARRAY_V, 2 + POINTER_DWORDS);
4790 if (n) {
4791 n[1].ui = first;
4792 n[2].si = count;
4793 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLclampd)));
4794 }
4795 if (ctx->ExecuteFlag) {
4796 CALL_DepthRangeArrayv(ctx->Exec, (first, count, v));
4797 }
4798 }
4799
4800 void GLAPIENTRY
save_WindowPos4fMESA(GLfloat x,GLfloat y,GLfloat z,GLfloat w)4801 save_WindowPos4fMESA(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
4802 {
4803 GET_CURRENT_CONTEXT(ctx);
4804 Node *n;
4805 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4806 n = alloc_instruction(ctx, OPCODE_WINDOW_POS, 4);
4807 if (n) {
4808 n[1].f = x;
4809 n[2].f = y;
4810 n[3].f = z;
4811 n[4].f = w;
4812 }
4813 if (ctx->ExecuteFlag) {
4814 CALL_WindowPos4fMESA(ctx->Exec, (x, y, z, w));
4815 }
4816 }
4817
4818 void GLAPIENTRY
save_WindowPos2d(GLdouble x,GLdouble y)4819 save_WindowPos2d(GLdouble x, GLdouble y)
4820 {
4821 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
4822 }
4823
4824 void GLAPIENTRY
save_WindowPos2f(GLfloat x,GLfloat y)4825 save_WindowPos2f(GLfloat x, GLfloat y)
4826 {
4827 save_WindowPos4fMESA(x, y, 0.0F, 1.0F);
4828 }
4829
4830 void GLAPIENTRY
save_WindowPos2i(GLint x,GLint y)4831 save_WindowPos2i(GLint x, GLint y)
4832 {
4833 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
4834 }
4835
4836 void GLAPIENTRY
save_WindowPos2s(GLshort x,GLshort y)4837 save_WindowPos2s(GLshort x, GLshort y)
4838 {
4839 save_WindowPos4fMESA(x, y, 0.0F, 1.0F);
4840 }
4841
4842 void GLAPIENTRY
save_WindowPos3d(GLdouble x,GLdouble y,GLdouble z)4843 save_WindowPos3d(GLdouble x, GLdouble y, GLdouble z)
4844 {
4845 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
4846 }
4847
4848 void GLAPIENTRY
save_WindowPos3f(GLfloat x,GLfloat y,GLfloat z)4849 save_WindowPos3f(GLfloat x, GLfloat y, GLfloat z)
4850 {
4851 save_WindowPos4fMESA(x, y, z, 1.0F);
4852 }
4853
4854 void GLAPIENTRY
save_WindowPos3i(GLint x,GLint y,GLint z)4855 save_WindowPos3i(GLint x, GLint y, GLint z)
4856 {
4857 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
4858 }
4859
4860 void GLAPIENTRY
save_WindowPos3s(GLshort x,GLshort y,GLshort z)4861 save_WindowPos3s(GLshort x, GLshort y, GLshort z)
4862 {
4863 save_WindowPos4fMESA(x, y, z, 1.0F);
4864 }
4865
4866 void GLAPIENTRY
save_WindowPos4dMESA(GLdouble x,GLdouble y,GLdouble z,GLdouble w)4867 save_WindowPos4dMESA(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
4868 {
4869 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
4870 }
4871
4872 void GLAPIENTRY
save_WindowPos4iMESA(GLint x,GLint y,GLint z,GLint w)4873 save_WindowPos4iMESA(GLint x, GLint y, GLint z, GLint w)
4874 {
4875 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
4876 }
4877
4878 void GLAPIENTRY
save_WindowPos4sMESA(GLshort x,GLshort y,GLshort z,GLshort w)4879 save_WindowPos4sMESA(GLshort x, GLshort y, GLshort z, GLshort w)
4880 {
4881 save_WindowPos4fMESA(x, y, z, w);
4882 }
4883
4884 void GLAPIENTRY
save_WindowPos2dv(const GLdouble * v)4885 save_WindowPos2dv(const GLdouble * v)
4886 {
4887 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
4888 }
4889
4890 void GLAPIENTRY
save_WindowPos2fv(const GLfloat * v)4891 save_WindowPos2fv(const GLfloat * v)
4892 {
4893 save_WindowPos4fMESA(v[0], v[1], 0.0F, 1.0F);
4894 }
4895
4896 void GLAPIENTRY
save_WindowPos2iv(const GLint * v)4897 save_WindowPos2iv(const GLint * v)
4898 {
4899 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
4900 }
4901
4902 void GLAPIENTRY
save_WindowPos2sv(const GLshort * v)4903 save_WindowPos2sv(const GLshort * v)
4904 {
4905 save_WindowPos4fMESA(v[0], v[1], 0.0F, 1.0F);
4906 }
4907
4908 void GLAPIENTRY
save_WindowPos3dv(const GLdouble * v)4909 save_WindowPos3dv(const GLdouble * v)
4910 {
4911 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
4912 }
4913
4914 void GLAPIENTRY
save_WindowPos3fv(const GLfloat * v)4915 save_WindowPos3fv(const GLfloat * v)
4916 {
4917 save_WindowPos4fMESA(v[0], v[1], v[2], 1.0F);
4918 }
4919
4920 void GLAPIENTRY
save_WindowPos3iv(const GLint * v)4921 save_WindowPos3iv(const GLint * v)
4922 {
4923 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
4924 }
4925
4926 void GLAPIENTRY
save_WindowPos3sv(const GLshort * v)4927 save_WindowPos3sv(const GLshort * v)
4928 {
4929 save_WindowPos4fMESA(v[0], v[1], v[2], 1.0F);
4930 }
4931
4932 void GLAPIENTRY
save_WindowPos4dvMESA(const GLdouble * v)4933 save_WindowPos4dvMESA(const GLdouble * v)
4934 {
4935 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1],
4936 (GLfloat) v[2], (GLfloat) v[3]);
4937 }
4938
4939 void GLAPIENTRY
save_WindowPos4fvMESA(const GLfloat * v)4940 save_WindowPos4fvMESA(const GLfloat * v)
4941 {
4942 save_WindowPos4fMESA(v[0], v[1], v[2], v[3]);
4943 }
4944
4945 void GLAPIENTRY
save_WindowPos4ivMESA(const GLint * v)4946 save_WindowPos4ivMESA(const GLint * v)
4947 {
4948 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1],
4949 (GLfloat) v[2], (GLfloat) v[3]);
4950 }
4951
4952 void GLAPIENTRY
save_WindowPos4svMESA(const GLshort * v)4953 save_WindowPos4svMESA(const GLshort * v)
4954 {
4955 save_WindowPos4fMESA(v[0], v[1], v[2], v[3]);
4956 }
4957
4958
4959
4960 /* GL_ARB_multitexture */
4961 void GLAPIENTRY
save_ActiveTexture(GLenum target)4962 save_ActiveTexture(GLenum target)
4963 {
4964 GET_CURRENT_CONTEXT(ctx);
4965 Node *n;
4966 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4967 n = alloc_instruction(ctx, OPCODE_ACTIVE_TEXTURE, 1);
4968 if (n) {
4969 n[1].e = target;
4970 }
4971 if (ctx->ExecuteFlag) {
4972 CALL_ActiveTexture(ctx->Exec, (target));
4973 }
4974 }
4975
4976
4977 /* GL_ARB_transpose_matrix */
4978
4979 void GLAPIENTRY
save_LoadTransposeMatrixd(const GLdouble * m)4980 save_LoadTransposeMatrixd(const GLdouble *m)
4981 {
4982 GLfloat tm[16];
4983 _math_transposefd(tm, m);
4984 save_LoadMatrixf(tm);
4985 }
4986
4987
4988 void GLAPIENTRY
save_LoadTransposeMatrixf(const GLfloat * m)4989 save_LoadTransposeMatrixf(const GLfloat *m)
4990 {
4991 GLfloat tm[16];
4992 _math_transposef(tm, m);
4993 save_LoadMatrixf(tm);
4994 }
4995
4996
4997 void GLAPIENTRY
save_MultTransposeMatrixd(const GLdouble * m)4998 save_MultTransposeMatrixd(const GLdouble *m)
4999 {
5000 GLfloat tm[16];
5001 _math_transposefd(tm, m);
5002 save_MultMatrixf(tm);
5003 }
5004
5005
5006 void GLAPIENTRY
save_MultTransposeMatrixf(const GLfloat * m)5007 save_MultTransposeMatrixf(const GLfloat *m)
5008 {
5009 GLfloat tm[16];
5010 _math_transposef(tm, m);
5011 save_MultMatrixf(tm);
5012 }
5013
copy_data(const GLvoid * data,GLsizei size,const char * func)5014 static GLvoid *copy_data(const GLvoid *data, GLsizei size, const char *func)
5015 {
5016 GET_CURRENT_CONTEXT(ctx);
5017 GLvoid *image;
5018
5019 if (!data)
5020 return NULL;
5021
5022 image = malloc(size);
5023 if (!image) {
5024 _mesa_error(ctx, GL_OUT_OF_MEMORY, "%s", func);
5025 return NULL;
5026 }
5027 memcpy(image, data, size);
5028
5029 return image;
5030 }
5031
5032
5033 /* GL_ARB_texture_compression */
5034 void GLAPIENTRY
save_CompressedTexImage1D(GLenum target,GLint level,GLenum internalFormat,GLsizei width,GLint border,GLsizei imageSize,const GLvoid * data)5035 save_CompressedTexImage1D(GLenum target, GLint level,
5036 GLenum internalFormat, GLsizei width,
5037 GLint border, GLsizei imageSize,
5038 const GLvoid * data)
5039 {
5040 GET_CURRENT_CONTEXT(ctx);
5041 if (target == GL_PROXY_TEXTURE_1D) {
5042 /* don't compile, execute immediately */
5043 CALL_CompressedTexImage1D(ctx->Exec, (target, level, internalFormat,
5044 width, border, imageSize,
5045 data));
5046 }
5047 else {
5048 Node *n;
5049 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5050
5051 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_1D,
5052 6 + POINTER_DWORDS);
5053 if (n) {
5054 n[1].e = target;
5055 n[2].i = level;
5056 n[3].e = internalFormat;
5057 n[4].i = (GLint) width;
5058 n[5].i = border;
5059 n[6].i = imageSize;
5060 save_pointer(&n[7],
5061 copy_data(data, imageSize, "glCompressedTexImage1DARB"));
5062 }
5063 if (ctx->ExecuteFlag) {
5064 CALL_CompressedTexImage1D(ctx->Exec,
5065 (target, level, internalFormat, width,
5066 border, imageSize, data));
5067 }
5068 }
5069 }
5070
5071
5072 void GLAPIENTRY
save_CompressedTexImage2D(GLenum target,GLint level,GLenum internalFormat,GLsizei width,GLsizei height,GLint border,GLsizei imageSize,const GLvoid * data)5073 save_CompressedTexImage2D(GLenum target, GLint level,
5074 GLenum internalFormat, GLsizei width,
5075 GLsizei height, GLint border, GLsizei imageSize,
5076 const GLvoid * data)
5077 {
5078 GET_CURRENT_CONTEXT(ctx);
5079 if (target == GL_PROXY_TEXTURE_2D) {
5080 /* don't compile, execute immediately */
5081 CALL_CompressedTexImage2D(ctx->Exec, (target, level, internalFormat,
5082 width, height, border,
5083 imageSize, data));
5084 }
5085 else {
5086 Node *n;
5087 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5088
5089 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_2D,
5090 7 + POINTER_DWORDS);
5091 if (n) {
5092 n[1].e = target;
5093 n[2].i = level;
5094 n[3].e = internalFormat;
5095 n[4].i = (GLint) width;
5096 n[5].i = (GLint) height;
5097 n[6].i = border;
5098 n[7].i = imageSize;
5099 save_pointer(&n[8],
5100 copy_data(data, imageSize, "glCompressedTexImage2DARB"));
5101 }
5102 if (ctx->ExecuteFlag) {
5103 CALL_CompressedTexImage2D(ctx->Exec,
5104 (target, level, internalFormat, width,
5105 height, border, imageSize, data));
5106 }
5107 }
5108 }
5109
5110
5111 void GLAPIENTRY
save_CompressedTexImage3D(GLenum target,GLint level,GLenum internalFormat,GLsizei width,GLsizei height,GLsizei depth,GLint border,GLsizei imageSize,const GLvoid * data)5112 save_CompressedTexImage3D(GLenum target, GLint level,
5113 GLenum internalFormat, GLsizei width,
5114 GLsizei height, GLsizei depth, GLint border,
5115 GLsizei imageSize, const GLvoid * data)
5116 {
5117 GET_CURRENT_CONTEXT(ctx);
5118 if (target == GL_PROXY_TEXTURE_3D) {
5119 /* don't compile, execute immediately */
5120 CALL_CompressedTexImage3D(ctx->Exec, (target, level, internalFormat,
5121 width, height, depth, border,
5122 imageSize, data));
5123 }
5124 else {
5125 Node *n;
5126 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5127
5128 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_3D,
5129 8 + POINTER_DWORDS);
5130 if (n) {
5131 n[1].e = target;
5132 n[2].i = level;
5133 n[3].e = internalFormat;
5134 n[4].i = (GLint) width;
5135 n[5].i = (GLint) height;
5136 n[6].i = (GLint) depth;
5137 n[7].i = border;
5138 n[8].i = imageSize;
5139 save_pointer(&n[9],
5140 copy_data(data, imageSize, "glCompressedTexImage3DARB"));
5141 }
5142 if (ctx->ExecuteFlag) {
5143 CALL_CompressedTexImage3D(ctx->Exec,
5144 (target, level, internalFormat, width,
5145 height, depth, border, imageSize,
5146 data));
5147 }
5148 }
5149 }
5150
5151
5152 void GLAPIENTRY
save_CompressedTexSubImage1D(GLenum target,GLint level,GLint xoffset,GLsizei width,GLenum format,GLsizei imageSize,const GLvoid * data)5153 save_CompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset,
5154 GLsizei width, GLenum format,
5155 GLsizei imageSize, const GLvoid * data)
5156 {
5157 Node *n;
5158 GET_CURRENT_CONTEXT(ctx);
5159 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5160
5161 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D,
5162 6 + POINTER_DWORDS);
5163 if (n) {
5164 n[1].e = target;
5165 n[2].i = level;
5166 n[3].i = xoffset;
5167 n[4].i = (GLint) width;
5168 n[5].e = format;
5169 n[6].i = imageSize;
5170 save_pointer(&n[7],
5171 copy_data(data, imageSize, "glCompressedTexSubImage1DARB"));
5172 }
5173 if (ctx->ExecuteFlag) {
5174 CALL_CompressedTexSubImage1D(ctx->Exec, (target, level, xoffset,
5175 width, format, imageSize,
5176 data));
5177 }
5178 }
5179
5180
5181 void GLAPIENTRY
save_CompressedTexSubImage2D(GLenum target,GLint level,GLint xoffset,GLint yoffset,GLsizei width,GLsizei height,GLenum format,GLsizei imageSize,const GLvoid * data)5182 save_CompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset,
5183 GLint yoffset, GLsizei width, GLsizei height,
5184 GLenum format, GLsizei imageSize,
5185 const GLvoid * data)
5186 {
5187 Node *n;
5188 GET_CURRENT_CONTEXT(ctx);
5189 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5190
5191 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D,
5192 8 + POINTER_DWORDS);
5193 if (n) {
5194 n[1].e = target;
5195 n[2].i = level;
5196 n[3].i = xoffset;
5197 n[4].i = yoffset;
5198 n[5].i = (GLint) width;
5199 n[6].i = (GLint) height;
5200 n[7].e = format;
5201 n[8].i = imageSize;
5202 save_pointer(&n[9],
5203 copy_data(data, imageSize, "glCompressedTexSubImage2DARB"));
5204 }
5205 if (ctx->ExecuteFlag) {
5206 CALL_CompressedTexSubImage2D(ctx->Exec,
5207 (target, level, xoffset, yoffset, width,
5208 height, format, imageSize, data));
5209 }
5210 }
5211
5212
5213 void GLAPIENTRY
save_CompressedTexSubImage3D(GLenum target,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLsizei width,GLsizei height,GLsizei depth,GLenum format,GLsizei imageSize,const GLvoid * data)5214 save_CompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset,
5215 GLint yoffset, GLint zoffset, GLsizei width,
5216 GLsizei height, GLsizei depth, GLenum format,
5217 GLsizei imageSize, const GLvoid * data)
5218 {
5219 Node *n;
5220 GET_CURRENT_CONTEXT(ctx);
5221 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5222
5223 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D,
5224 10 + POINTER_DWORDS);
5225 if (n) {
5226 n[1].e = target;
5227 n[2].i = level;
5228 n[3].i = xoffset;
5229 n[4].i = yoffset;
5230 n[5].i = zoffset;
5231 n[6].i = (GLint) width;
5232 n[7].i = (GLint) height;
5233 n[8].i = (GLint) depth;
5234 n[9].e = format;
5235 n[10].i = imageSize;
5236 save_pointer(&n[11],
5237 copy_data(data, imageSize, "glCompressedTexSubImage3DARB"));
5238 }
5239 if (ctx->ExecuteFlag) {
5240 CALL_CompressedTexSubImage3D(ctx->Exec,
5241 (target, level, xoffset, yoffset,
5242 zoffset, width, height, depth, format,
5243 imageSize, data));
5244 }
5245 }
5246
5247
5248 /* GL_ARB_multisample */
5249 void GLAPIENTRY
save_SampleCoverage(GLclampf value,GLboolean invert)5250 save_SampleCoverage(GLclampf value, GLboolean invert)
5251 {
5252 GET_CURRENT_CONTEXT(ctx);
5253 Node *n;
5254 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5255 n = alloc_instruction(ctx, OPCODE_SAMPLE_COVERAGE, 2);
5256 if (n) {
5257 n[1].f = value;
5258 n[2].b = invert;
5259 }
5260 if (ctx->ExecuteFlag) {
5261 CALL_SampleCoverage(ctx->Exec, (value, invert));
5262 }
5263 }
5264
5265
5266 /*
5267 * GL_ARB_vertex_program
5268 */
5269 void GLAPIENTRY
save_BindProgramARB(GLenum target,GLuint id)5270 save_BindProgramARB(GLenum target, GLuint id)
5271 {
5272 GET_CURRENT_CONTEXT(ctx);
5273 Node *n;
5274 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5275 n = alloc_instruction(ctx, OPCODE_BIND_PROGRAM_ARB, 2);
5276 if (n) {
5277 n[1].e = target;
5278 n[2].ui = id;
5279 }
5280 if (ctx->ExecuteFlag) {
5281 CALL_BindProgramARB(ctx->Exec, (target, id));
5282 }
5283 }
5284
5285 void GLAPIENTRY
save_ProgramEnvParameter4fARB(GLenum target,GLuint index,GLfloat x,GLfloat y,GLfloat z,GLfloat w)5286 save_ProgramEnvParameter4fARB(GLenum target, GLuint index,
5287 GLfloat x, GLfloat y, GLfloat z, GLfloat w)
5288 {
5289 GET_CURRENT_CONTEXT(ctx);
5290 Node *n;
5291 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5292 n = alloc_instruction(ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6);
5293 if (n) {
5294 n[1].e = target;
5295 n[2].ui = index;
5296 n[3].f = x;
5297 n[4].f = y;
5298 n[5].f = z;
5299 n[6].f = w;
5300 }
5301 if (ctx->ExecuteFlag) {
5302 CALL_ProgramEnvParameter4fARB(ctx->Exec, (target, index, x, y, z, w));
5303 }
5304 }
5305
5306
5307 void GLAPIENTRY
save_ProgramEnvParameter4fvARB(GLenum target,GLuint index,const GLfloat * params)5308 save_ProgramEnvParameter4fvARB(GLenum target, GLuint index,
5309 const GLfloat *params)
5310 {
5311 save_ProgramEnvParameter4fARB(target, index, params[0], params[1],
5312 params[2], params[3]);
5313 }
5314
5315
5316 void GLAPIENTRY
save_ProgramEnvParameters4fvEXT(GLenum target,GLuint index,GLsizei count,const GLfloat * params)5317 save_ProgramEnvParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
5318 const GLfloat * params)
5319 {
5320 GET_CURRENT_CONTEXT(ctx);
5321 Node *n;
5322 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5323
5324 if (count > 0) {
5325 GLint i;
5326 const GLfloat * p = params;
5327
5328 for (i = 0 ; i < count ; i++) {
5329 n = alloc_instruction(ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6);
5330 if (n) {
5331 n[1].e = target;
5332 n[2].ui = index;
5333 n[3].f = p[0];
5334 n[4].f = p[1];
5335 n[5].f = p[2];
5336 n[6].f = p[3];
5337 p += 4;
5338 }
5339 }
5340 }
5341
5342 if (ctx->ExecuteFlag) {
5343 CALL_ProgramEnvParameters4fvEXT(ctx->Exec, (target, index, count, params));
5344 }
5345 }
5346
5347
5348 void GLAPIENTRY
save_ProgramEnvParameter4dARB(GLenum target,GLuint index,GLdouble x,GLdouble y,GLdouble z,GLdouble w)5349 save_ProgramEnvParameter4dARB(GLenum target, GLuint index,
5350 GLdouble x, GLdouble y, GLdouble z, GLdouble w)
5351 {
5352 save_ProgramEnvParameter4fARB(target, index,
5353 (GLfloat) x,
5354 (GLfloat) y, (GLfloat) z, (GLfloat) w);
5355 }
5356
5357
5358 void GLAPIENTRY
save_ProgramEnvParameter4dvARB(GLenum target,GLuint index,const GLdouble * params)5359 save_ProgramEnvParameter4dvARB(GLenum target, GLuint index,
5360 const GLdouble *params)
5361 {
5362 save_ProgramEnvParameter4fARB(target, index,
5363 (GLfloat) params[0],
5364 (GLfloat) params[1],
5365 (GLfloat) params[2], (GLfloat) params[3]);
5366 }
5367
5368
5369 void GLAPIENTRY
save_ProgramLocalParameter4fARB(GLenum target,GLuint index,GLfloat x,GLfloat y,GLfloat z,GLfloat w)5370 save_ProgramLocalParameter4fARB(GLenum target, GLuint index,
5371 GLfloat x, GLfloat y, GLfloat z, GLfloat w)
5372 {
5373 GET_CURRENT_CONTEXT(ctx);
5374 Node *n;
5375 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5376 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5377 if (n) {
5378 n[1].e = target;
5379 n[2].ui = index;
5380 n[3].f = x;
5381 n[4].f = y;
5382 n[5].f = z;
5383 n[6].f = w;
5384 }
5385 if (ctx->ExecuteFlag) {
5386 CALL_ProgramLocalParameter4fARB(ctx->Exec, (target, index, x, y, z, w));
5387 }
5388 }
5389
5390
5391 void GLAPIENTRY
save_ProgramLocalParameter4fvARB(GLenum target,GLuint index,const GLfloat * params)5392 save_ProgramLocalParameter4fvARB(GLenum target, GLuint index,
5393 const GLfloat *params)
5394 {
5395 GET_CURRENT_CONTEXT(ctx);
5396 Node *n;
5397 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5398 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5399 if (n) {
5400 n[1].e = target;
5401 n[2].ui = index;
5402 n[3].f = params[0];
5403 n[4].f = params[1];
5404 n[5].f = params[2];
5405 n[6].f = params[3];
5406 }
5407 if (ctx->ExecuteFlag) {
5408 CALL_ProgramLocalParameter4fvARB(ctx->Exec, (target, index, params));
5409 }
5410 }
5411
5412
5413 void GLAPIENTRY
save_ProgramLocalParameters4fvEXT(GLenum target,GLuint index,GLsizei count,const GLfloat * params)5414 save_ProgramLocalParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
5415 const GLfloat *params)
5416 {
5417 GET_CURRENT_CONTEXT(ctx);
5418 Node *n;
5419 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5420
5421 if (count > 0) {
5422 GLint i;
5423 const GLfloat * p = params;
5424
5425 for (i = 0 ; i < count ; i++) {
5426 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5427 if (n) {
5428 n[1].e = target;
5429 n[2].ui = index;
5430 n[3].f = p[0];
5431 n[4].f = p[1];
5432 n[5].f = p[2];
5433 n[6].f = p[3];
5434 p += 4;
5435 }
5436 }
5437 }
5438
5439 if (ctx->ExecuteFlag) {
5440 CALL_ProgramLocalParameters4fvEXT(ctx->Exec, (target, index, count, params));
5441 }
5442 }
5443
5444
5445 void GLAPIENTRY
save_ProgramLocalParameter4dARB(GLenum target,GLuint index,GLdouble x,GLdouble y,GLdouble z,GLdouble w)5446 save_ProgramLocalParameter4dARB(GLenum target, GLuint index,
5447 GLdouble x, GLdouble y,
5448 GLdouble z, GLdouble w)
5449 {
5450 GET_CURRENT_CONTEXT(ctx);
5451 Node *n;
5452 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5453 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5454 if (n) {
5455 n[1].e = target;
5456 n[2].ui = index;
5457 n[3].f = (GLfloat) x;
5458 n[4].f = (GLfloat) y;
5459 n[5].f = (GLfloat) z;
5460 n[6].f = (GLfloat) w;
5461 }
5462 if (ctx->ExecuteFlag) {
5463 CALL_ProgramLocalParameter4dARB(ctx->Exec, (target, index, x, y, z, w));
5464 }
5465 }
5466
5467
5468 void GLAPIENTRY
save_ProgramLocalParameter4dvARB(GLenum target,GLuint index,const GLdouble * params)5469 save_ProgramLocalParameter4dvARB(GLenum target, GLuint index,
5470 const GLdouble *params)
5471 {
5472 GET_CURRENT_CONTEXT(ctx);
5473 Node *n;
5474 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5475 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5476 if (n) {
5477 n[1].e = target;
5478 n[2].ui = index;
5479 n[3].f = (GLfloat) params[0];
5480 n[4].f = (GLfloat) params[1];
5481 n[5].f = (GLfloat) params[2];
5482 n[6].f = (GLfloat) params[3];
5483 }
5484 if (ctx->ExecuteFlag) {
5485 CALL_ProgramLocalParameter4dvARB(ctx->Exec, (target, index, params));
5486 }
5487 }
5488
5489
5490 /* GL_EXT_stencil_two_side */
5491 void GLAPIENTRY
save_ActiveStencilFaceEXT(GLenum face)5492 save_ActiveStencilFaceEXT(GLenum face)
5493 {
5494 GET_CURRENT_CONTEXT(ctx);
5495 Node *n;
5496 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5497 n = alloc_instruction(ctx, OPCODE_ACTIVE_STENCIL_FACE_EXT, 1);
5498 if (n) {
5499 n[1].e = face;
5500 }
5501 if (ctx->ExecuteFlag) {
5502 CALL_ActiveStencilFaceEXT(ctx->Exec, (face));
5503 }
5504 }
5505
5506
5507 /* GL_EXT_depth_bounds_test */
5508 void GLAPIENTRY
save_DepthBoundsEXT(GLclampd zmin,GLclampd zmax)5509 save_DepthBoundsEXT(GLclampd zmin, GLclampd zmax)
5510 {
5511 GET_CURRENT_CONTEXT(ctx);
5512 Node *n;
5513 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5514 n = alloc_instruction(ctx, OPCODE_DEPTH_BOUNDS_EXT, 2);
5515 if (n) {
5516 n[1].f = (GLfloat) zmin;
5517 n[2].f = (GLfloat) zmax;
5518 }
5519 if (ctx->ExecuteFlag) {
5520 CALL_DepthBoundsEXT(ctx->Exec, (zmin, zmax));
5521 }
5522 }
5523
5524
5525
5526 void GLAPIENTRY
save_ProgramStringARB(GLenum target,GLenum format,GLsizei len,const GLvoid * string)5527 save_ProgramStringARB(GLenum target, GLenum format, GLsizei len,
5528 const GLvoid * string)
5529 {
5530 GET_CURRENT_CONTEXT(ctx);
5531 Node *n;
5532
5533 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5534
5535 n = alloc_instruction(ctx, OPCODE_PROGRAM_STRING_ARB, 3 + POINTER_DWORDS);
5536 if (n) {
5537 GLubyte *programCopy = malloc(len);
5538 if (!programCopy) {
5539 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramStringARB");
5540 return;
5541 }
5542 memcpy(programCopy, string, len);
5543 n[1].e = target;
5544 n[2].e = format;
5545 n[3].i = len;
5546 save_pointer(&n[4], programCopy);
5547 }
5548 if (ctx->ExecuteFlag) {
5549 CALL_ProgramStringARB(ctx->Exec, (target, format, len, string));
5550 }
5551 }
5552
5553
5554 void GLAPIENTRY
save_BeginQuery(GLenum target,GLuint id)5555 save_BeginQuery(GLenum target, GLuint id)
5556 {
5557 GET_CURRENT_CONTEXT(ctx);
5558 Node *n;
5559 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5560 n = alloc_instruction(ctx, OPCODE_BEGIN_QUERY_ARB, 2);
5561 if (n) {
5562 n[1].e = target;
5563 n[2].ui = id;
5564 }
5565 if (ctx->ExecuteFlag) {
5566 CALL_BeginQuery(ctx->Exec, (target, id));
5567 }
5568 }
5569
5570 void GLAPIENTRY
save_EndQuery(GLenum target)5571 save_EndQuery(GLenum target)
5572 {
5573 GET_CURRENT_CONTEXT(ctx);
5574 Node *n;
5575 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5576 n = alloc_instruction(ctx, OPCODE_END_QUERY_ARB, 1);
5577 if (n) {
5578 n[1].e = target;
5579 }
5580 if (ctx->ExecuteFlag) {
5581 CALL_EndQuery(ctx->Exec, (target));
5582 }
5583 }
5584
5585 void GLAPIENTRY
save_QueryCounter(GLuint id,GLenum target)5586 save_QueryCounter(GLuint id, GLenum target)
5587 {
5588 GET_CURRENT_CONTEXT(ctx);
5589 Node *n;
5590 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5591 n = alloc_instruction(ctx, OPCODE_QUERY_COUNTER, 2);
5592 if (n) {
5593 n[1].ui = id;
5594 n[2].e = target;
5595 }
5596 if (ctx->ExecuteFlag) {
5597 CALL_QueryCounter(ctx->Exec, (id, target));
5598 }
5599 }
5600
5601 void GLAPIENTRY
save_BeginQueryIndexed(GLenum target,GLuint index,GLuint id)5602 save_BeginQueryIndexed(GLenum target, GLuint index, GLuint id)
5603 {
5604 GET_CURRENT_CONTEXT(ctx);
5605 Node *n;
5606 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5607 n = alloc_instruction(ctx, OPCODE_BEGIN_QUERY_INDEXED, 3);
5608 if (n) {
5609 n[1].e = target;
5610 n[2].ui = index;
5611 n[3].ui = id;
5612 }
5613 if (ctx->ExecuteFlag) {
5614 CALL_BeginQueryIndexed(ctx->Exec, (target, index, id));
5615 }
5616 }
5617
5618 void GLAPIENTRY
save_EndQueryIndexed(GLenum target,GLuint index)5619 save_EndQueryIndexed(GLenum target, GLuint index)
5620 {
5621 GET_CURRENT_CONTEXT(ctx);
5622 Node *n;
5623 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5624 n = alloc_instruction(ctx, OPCODE_END_QUERY_INDEXED, 2);
5625 if (n) {
5626 n[1].e = target;
5627 n[2].ui = index;
5628 }
5629 if (ctx->ExecuteFlag) {
5630 CALL_EndQueryIndexed(ctx->Exec, (target, index));
5631 }
5632 }
5633
5634
5635 void GLAPIENTRY
save_DrawBuffers(GLsizei count,const GLenum * buffers)5636 save_DrawBuffers(GLsizei count, const GLenum * buffers)
5637 {
5638 GET_CURRENT_CONTEXT(ctx);
5639 Node *n;
5640 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5641 n = alloc_instruction(ctx, OPCODE_DRAW_BUFFERS_ARB, 1 + MAX_DRAW_BUFFERS);
5642 if (n) {
5643 GLint i;
5644 n[1].i = count;
5645 if (count > MAX_DRAW_BUFFERS)
5646 count = MAX_DRAW_BUFFERS;
5647 for (i = 0; i < count; i++) {
5648 n[2 + i].e = buffers[i];
5649 }
5650 }
5651 if (ctx->ExecuteFlag) {
5652 CALL_DrawBuffers(ctx->Exec, (count, buffers));
5653 }
5654 }
5655
5656 void GLAPIENTRY
save_BindFragmentShaderATI(GLuint id)5657 save_BindFragmentShaderATI(GLuint id)
5658 {
5659 GET_CURRENT_CONTEXT(ctx);
5660 Node *n;
5661
5662 n = alloc_instruction(ctx, OPCODE_BIND_FRAGMENT_SHADER_ATI, 1);
5663 if (n) {
5664 n[1].ui = id;
5665 }
5666 if (ctx->ExecuteFlag) {
5667 CALL_BindFragmentShaderATI(ctx->Exec, (id));
5668 }
5669 }
5670
5671 void GLAPIENTRY
save_SetFragmentShaderConstantATI(GLuint dst,const GLfloat * value)5672 save_SetFragmentShaderConstantATI(GLuint dst, const GLfloat *value)
5673 {
5674 GET_CURRENT_CONTEXT(ctx);
5675 Node *n;
5676
5677 n = alloc_instruction(ctx, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI, 5);
5678 if (n) {
5679 n[1].ui = dst;
5680 n[2].f = value[0];
5681 n[3].f = value[1];
5682 n[4].f = value[2];
5683 n[5].f = value[3];
5684 }
5685 if (ctx->ExecuteFlag) {
5686 CALL_SetFragmentShaderConstantATI(ctx->Exec, (dst, value));
5687 }
5688 }
5689
5690 static void GLAPIENTRY
save_EvalCoord1f(GLfloat x)5691 save_EvalCoord1f(GLfloat x)
5692 {
5693 GET_CURRENT_CONTEXT(ctx);
5694 Node *n;
5695 SAVE_FLUSH_VERTICES(ctx);
5696 n = alloc_instruction(ctx, OPCODE_EVAL_C1, 1);
5697 if (n) {
5698 n[1].f = x;
5699 }
5700 if (ctx->ExecuteFlag) {
5701 CALL_EvalCoord1f(ctx->Exec, (x));
5702 }
5703 }
5704
5705 static void GLAPIENTRY
save_EvalCoord1fv(const GLfloat * v)5706 save_EvalCoord1fv(const GLfloat * v)
5707 {
5708 save_EvalCoord1f(v[0]);
5709 }
5710
5711 static void GLAPIENTRY
save_EvalCoord2f(GLfloat x,GLfloat y)5712 save_EvalCoord2f(GLfloat x, GLfloat y)
5713 {
5714 GET_CURRENT_CONTEXT(ctx);
5715 Node *n;
5716 SAVE_FLUSH_VERTICES(ctx);
5717 n = alloc_instruction(ctx, OPCODE_EVAL_C2, 2);
5718 if (n) {
5719 n[1].f = x;
5720 n[2].f = y;
5721 }
5722 if (ctx->ExecuteFlag) {
5723 CALL_EvalCoord2f(ctx->Exec, (x, y));
5724 }
5725 }
5726
5727 static void GLAPIENTRY
save_EvalCoord2fv(const GLfloat * v)5728 save_EvalCoord2fv(const GLfloat * v)
5729 {
5730 save_EvalCoord2f(v[0], v[1]);
5731 }
5732
5733
5734 static void GLAPIENTRY
save_EvalPoint1(GLint x)5735 save_EvalPoint1(GLint x)
5736 {
5737 GET_CURRENT_CONTEXT(ctx);
5738 Node *n;
5739 SAVE_FLUSH_VERTICES(ctx);
5740 n = alloc_instruction(ctx, OPCODE_EVAL_P1, 1);
5741 if (n) {
5742 n[1].i = x;
5743 }
5744 if (ctx->ExecuteFlag) {
5745 CALL_EvalPoint1(ctx->Exec, (x));
5746 }
5747 }
5748
5749 static void GLAPIENTRY
save_EvalPoint2(GLint x,GLint y)5750 save_EvalPoint2(GLint x, GLint y)
5751 {
5752 GET_CURRENT_CONTEXT(ctx);
5753 Node *n;
5754 SAVE_FLUSH_VERTICES(ctx);
5755 n = alloc_instruction(ctx, OPCODE_EVAL_P2, 2);
5756 if (n) {
5757 n[1].i = x;
5758 n[2].i = y;
5759 }
5760 if (ctx->ExecuteFlag) {
5761 CALL_EvalPoint2(ctx->Exec, (x, y));
5762 }
5763 }
5764
5765
5766 /**
5767 * Compare 'count' elements of vectors 'a' and 'b'.
5768 * \return GL_TRUE if equal, GL_FALSE if different.
5769 */
5770 static inline GLboolean
compare_vec(const GLfloat * a,const GLfloat * b,GLuint count)5771 compare_vec(const GLfloat *a, const GLfloat *b, GLuint count)
5772 {
5773 return memcmp( a, b, count * sizeof(GLfloat) ) == 0;
5774 }
5775
5776
5777 /**
5778 * This glMaterial function is used for glMaterial calls that are outside
5779 * a glBegin/End pair. For glMaterial inside glBegin/End, see the VBO code.
5780 */
5781 static void GLAPIENTRY
save_Materialfv(GLenum face,GLenum pname,const GLfloat * param)5782 save_Materialfv(GLenum face, GLenum pname, const GLfloat * param)
5783 {
5784 GET_CURRENT_CONTEXT(ctx);
5785 Node *n;
5786 int args, i;
5787 GLuint bitmask;
5788
5789 switch (face) {
5790 case GL_BACK:
5791 case GL_FRONT:
5792 case GL_FRONT_AND_BACK:
5793 break;
5794 default:
5795 _mesa_compile_error(ctx, GL_INVALID_ENUM, "glMaterial(face)");
5796 return;
5797 }
5798
5799 switch (pname) {
5800 case GL_EMISSION:
5801 case GL_AMBIENT:
5802 case GL_DIFFUSE:
5803 case GL_SPECULAR:
5804 case GL_AMBIENT_AND_DIFFUSE:
5805 args = 4;
5806 break;
5807 case GL_SHININESS:
5808 args = 1;
5809 break;
5810 case GL_COLOR_INDEXES:
5811 args = 3;
5812 break;
5813 default:
5814 _mesa_compile_error(ctx, GL_INVALID_ENUM, "glMaterial(pname)");
5815 return;
5816 }
5817
5818 if (ctx->ExecuteFlag) {
5819 CALL_Materialfv(ctx->Exec, (face, pname, param));
5820 }
5821
5822 bitmask = _mesa_material_bitmask(ctx, face, pname, ~0, NULL);
5823
5824 /* Try to eliminate redundant statechanges. Because it is legal to
5825 * call glMaterial even inside begin/end calls, don't need to worry
5826 * about ctx->Driver.CurrentSavePrimitive here.
5827 */
5828 for (i = 0; i < MAT_ATTRIB_MAX; i++) {
5829 if (bitmask & (1 << i)) {
5830 if (ctx->ListState.ActiveMaterialSize[i] == args &&
5831 compare_vec(ctx->ListState.CurrentMaterial[i], param, args)) {
5832 /* no change in material value */
5833 bitmask &= ~(1 << i);
5834 }
5835 else {
5836 ctx->ListState.ActiveMaterialSize[i] = args;
5837 COPY_SZ_4V(ctx->ListState.CurrentMaterial[i], args, param);
5838 }
5839 }
5840 }
5841
5842 /* If this call has no effect, return early */
5843 if (bitmask == 0)
5844 return;
5845
5846 SAVE_FLUSH_VERTICES(ctx);
5847
5848 n = alloc_instruction(ctx, OPCODE_MATERIAL, 6);
5849 if (n) {
5850 n[1].e = face;
5851 n[2].e = pname;
5852 for (i = 0; i < args; i++)
5853 n[3 + i].f = param[i];
5854 }
5855 }
5856
5857 static void GLAPIENTRY
save_Begin(GLenum mode)5858 save_Begin(GLenum mode)
5859 {
5860 GET_CURRENT_CONTEXT(ctx);
5861
5862 if (!_mesa_is_valid_prim_mode(ctx, mode)) {
5863 /* compile this error into the display list */
5864 _mesa_compile_error(ctx, GL_INVALID_ENUM, "glBegin(mode)");
5865 }
5866 else if (_mesa_inside_dlist_begin_end(ctx)) {
5867 /* compile this error into the display list */
5868 _mesa_compile_error(ctx, GL_INVALID_OPERATION, "recursive glBegin");
5869 }
5870 else {
5871 ctx->Driver.CurrentSavePrimitive = mode;
5872
5873 vbo_save_NotifyBegin(ctx, mode, false);
5874 }
5875 }
5876
5877 static void GLAPIENTRY
save_End(void)5878 save_End(void)
5879 {
5880 GET_CURRENT_CONTEXT(ctx);
5881 SAVE_FLUSH_VERTICES(ctx);
5882 (void) alloc_instruction(ctx, OPCODE_END, 0);
5883 ctx->Driver.CurrentSavePrimitive = PRIM_OUTSIDE_BEGIN_END;
5884 if (ctx->ExecuteFlag) {
5885 CALL_End(ctx->Exec, ());
5886 }
5887 }
5888
5889 static void GLAPIENTRY
save_PrimitiveRestartNV(void)5890 save_PrimitiveRestartNV(void)
5891 {
5892 /* Note: this is used when outside a glBegin/End pair in a display list */
5893 GET_CURRENT_CONTEXT(ctx);
5894 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5895 (void) alloc_instruction(ctx, OPCODE_PRIMITIVE_RESTART_NV, 0);
5896 if (ctx->ExecuteFlag) {
5897 CALL_PrimitiveRestartNV(ctx->Exec, ());
5898 }
5899 }
5900
5901
5902 void GLAPIENTRY
save_BlitFramebuffer(GLint srcX0,GLint srcY0,GLint srcX1,GLint srcY1,GLint dstX0,GLint dstY0,GLint dstX1,GLint dstY1,GLbitfield mask,GLenum filter)5903 save_BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
5904 GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
5905 GLbitfield mask, GLenum filter)
5906 {
5907 GET_CURRENT_CONTEXT(ctx);
5908 Node *n;
5909 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5910 n = alloc_instruction(ctx, OPCODE_BLIT_FRAMEBUFFER, 10);
5911 if (n) {
5912 n[1].i = srcX0;
5913 n[2].i = srcY0;
5914 n[3].i = srcX1;
5915 n[4].i = srcY1;
5916 n[5].i = dstX0;
5917 n[6].i = dstY0;
5918 n[7].i = dstX1;
5919 n[8].i = dstY1;
5920 n[9].i = mask;
5921 n[10].e = filter;
5922 }
5923 if (ctx->ExecuteFlag) {
5924 CALL_BlitFramebuffer(ctx->Exec, (srcX0, srcY0, srcX1, srcY1,
5925 dstX0, dstY0, dstX1, dstY1,
5926 mask, filter));
5927 }
5928 }
5929
5930
5931 /** GL_EXT_provoking_vertex */
5932 void GLAPIENTRY
save_ProvokingVertex(GLenum mode)5933 save_ProvokingVertex(GLenum mode)
5934 {
5935 GET_CURRENT_CONTEXT(ctx);
5936 Node *n;
5937 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5938 n = alloc_instruction(ctx, OPCODE_PROVOKING_VERTEX, 1);
5939 if (n) {
5940 n[1].e = mode;
5941 }
5942 if (ctx->ExecuteFlag) {
5943 /*CALL_ProvokingVertex(ctx->Exec, (mode));*/
5944 _mesa_ProvokingVertex(mode);
5945 }
5946 }
5947
5948
5949 /** GL_EXT_transform_feedback */
5950 void GLAPIENTRY
save_BeginTransformFeedback(GLenum mode)5951 save_BeginTransformFeedback(GLenum mode)
5952 {
5953 GET_CURRENT_CONTEXT(ctx);
5954 Node *n;
5955 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5956 n = alloc_instruction(ctx, OPCODE_BEGIN_TRANSFORM_FEEDBACK, 1);
5957 if (n) {
5958 n[1].e = mode;
5959 }
5960 if (ctx->ExecuteFlag) {
5961 CALL_BeginTransformFeedback(ctx->Exec, (mode));
5962 }
5963 }
5964
5965
5966 /** GL_EXT_transform_feedback */
5967 void GLAPIENTRY
save_EndTransformFeedback(void)5968 save_EndTransformFeedback(void)
5969 {
5970 GET_CURRENT_CONTEXT(ctx);
5971 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5972 (void) alloc_instruction(ctx, OPCODE_END_TRANSFORM_FEEDBACK, 0);
5973 if (ctx->ExecuteFlag) {
5974 CALL_EndTransformFeedback(ctx->Exec, ());
5975 }
5976 }
5977
5978 void GLAPIENTRY
save_BindTransformFeedback(GLenum target,GLuint name)5979 save_BindTransformFeedback(GLenum target, GLuint name)
5980 {
5981 GET_CURRENT_CONTEXT(ctx);
5982 Node *n;
5983 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5984 n = alloc_instruction(ctx, OPCODE_BIND_TRANSFORM_FEEDBACK, 2);
5985 if (n) {
5986 n[1].e = target;
5987 n[2].ui = name;
5988 }
5989 if (ctx->ExecuteFlag) {
5990 CALL_BindTransformFeedback(ctx->Exec, (target, name));
5991 }
5992 }
5993
5994 void GLAPIENTRY
save_PauseTransformFeedback(void)5995 save_PauseTransformFeedback(void)
5996 {
5997 GET_CURRENT_CONTEXT(ctx);
5998 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5999 (void) alloc_instruction(ctx, OPCODE_PAUSE_TRANSFORM_FEEDBACK, 0);
6000 if (ctx->ExecuteFlag) {
6001 CALL_PauseTransformFeedback(ctx->Exec, ());
6002 }
6003 }
6004
6005 void GLAPIENTRY
save_ResumeTransformFeedback(void)6006 save_ResumeTransformFeedback(void)
6007 {
6008 GET_CURRENT_CONTEXT(ctx);
6009 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6010 (void) alloc_instruction(ctx, OPCODE_RESUME_TRANSFORM_FEEDBACK, 0);
6011 if (ctx->ExecuteFlag) {
6012 CALL_ResumeTransformFeedback(ctx->Exec, ());
6013 }
6014 }
6015
6016 void GLAPIENTRY
save_DrawTransformFeedback(GLenum mode,GLuint name)6017 save_DrawTransformFeedback(GLenum mode, GLuint name)
6018 {
6019 GET_CURRENT_CONTEXT(ctx);
6020 Node *n;
6021 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6022 n = alloc_instruction(ctx, OPCODE_DRAW_TRANSFORM_FEEDBACK, 2);
6023 if (n) {
6024 n[1].e = mode;
6025 n[2].ui = name;
6026 }
6027 if (ctx->ExecuteFlag) {
6028 CALL_DrawTransformFeedback(ctx->Exec, (mode, name));
6029 }
6030 }
6031
6032 void GLAPIENTRY
save_DrawTransformFeedbackStream(GLenum mode,GLuint name,GLuint stream)6033 save_DrawTransformFeedbackStream(GLenum mode, GLuint name, GLuint stream)
6034 {
6035 GET_CURRENT_CONTEXT(ctx);
6036 Node *n;
6037 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6038 n = alloc_instruction(ctx, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM, 3);
6039 if (n) {
6040 n[1].e = mode;
6041 n[2].ui = name;
6042 n[3].ui = stream;
6043 }
6044 if (ctx->ExecuteFlag) {
6045 CALL_DrawTransformFeedbackStream(ctx->Exec, (mode, name, stream));
6046 }
6047 }
6048
6049 void GLAPIENTRY
save_DrawTransformFeedbackInstanced(GLenum mode,GLuint name,GLsizei primcount)6050 save_DrawTransformFeedbackInstanced(GLenum mode, GLuint name,
6051 GLsizei primcount)
6052 {
6053 GET_CURRENT_CONTEXT(ctx);
6054 Node *n;
6055 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6056 n = alloc_instruction(ctx, OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED, 3);
6057 if (n) {
6058 n[1].e = mode;
6059 n[2].ui = name;
6060 n[3].si = primcount;
6061 }
6062 if (ctx->ExecuteFlag) {
6063 CALL_DrawTransformFeedbackInstanced(ctx->Exec, (mode, name, primcount));
6064 }
6065 }
6066
6067 void GLAPIENTRY
save_DrawTransformFeedbackStreamInstanced(GLenum mode,GLuint name,GLuint stream,GLsizei primcount)6068 save_DrawTransformFeedbackStreamInstanced(GLenum mode, GLuint name,
6069 GLuint stream, GLsizei primcount)
6070 {
6071 GET_CURRENT_CONTEXT(ctx);
6072 Node *n;
6073 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6074 n = alloc_instruction(ctx, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED, 4);
6075 if (n) {
6076 n[1].e = mode;
6077 n[2].ui = name;
6078 n[3].ui = stream;
6079 n[4].si = primcount;
6080 }
6081 if (ctx->ExecuteFlag) {
6082 CALL_DrawTransformFeedbackStreamInstanced(ctx->Exec, (mode, name, stream,
6083 primcount));
6084 }
6085 }
6086
6087 void GLAPIENTRY
save_DispatchCompute(GLuint num_groups_x,GLuint num_groups_y,GLuint num_groups_z)6088 save_DispatchCompute(GLuint num_groups_x, GLuint num_groups_y,
6089 GLuint num_groups_z)
6090 {
6091 GET_CURRENT_CONTEXT(ctx);
6092 Node *n;
6093 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6094 n = alloc_instruction(ctx, OPCODE_DISPATCH_COMPUTE, 3);
6095 if (n) {
6096 n[1].ui = num_groups_x;
6097 n[2].ui = num_groups_y;
6098 n[3].ui = num_groups_z;
6099 }
6100 if (ctx->ExecuteFlag) {
6101 CALL_DispatchCompute(ctx->Exec, (num_groups_x, num_groups_y,
6102 num_groups_z));
6103 }
6104 }
6105
6106 void GLAPIENTRY
save_DispatchComputeIndirect(GLintptr indirect)6107 save_DispatchComputeIndirect(GLintptr indirect)
6108 {
6109 GET_CURRENT_CONTEXT(ctx);
6110 _mesa_error(ctx, GL_INVALID_OPERATION,
6111 "glDispatchComputeIndirect() during display list compile");
6112 }
6113
6114 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)6115 save_Attr32bit(struct gl_context *ctx, unsigned attr, unsigned size,
6116 GLenum type, uint32_t x, uint32_t y, uint32_t z, uint32_t w)
6117 {
6118 Node *n;
6119 SAVE_FLUSH_VERTICES(ctx);
6120 unsigned base_op;
6121 unsigned index = attr;
6122
6123 /* We don't care about GL_INT vs GL_UNSIGNED_INT. The idea is to get W=1
6124 * right for 3 or lower number of components, so only distinguish between
6125 * FLOAT and INT.
6126 */
6127 if (type == GL_FLOAT) {
6128 if (VERT_BIT(attr) & VERT_BIT_GENERIC_ALL) {
6129 base_op = OPCODE_ATTR_1F_ARB;
6130 attr -= VERT_ATTRIB_GENERIC0;
6131 } else {
6132 base_op = OPCODE_ATTR_1F_NV;
6133 }
6134 } else {
6135 base_op = OPCODE_ATTR_1I;
6136 attr -= VERT_ATTRIB_GENERIC0;
6137 }
6138
6139 n = alloc_instruction(ctx, base_op + size - 1, 1 + size);
6140 if (n) {
6141 n[1].ui = attr;
6142 n[2].ui = x;
6143 if (size >= 2) n[3].ui = y;
6144 if (size >= 3) n[4].ui = z;
6145 if (size >= 4) n[5].ui = w;
6146 }
6147
6148 ctx->ListState.ActiveAttribSize[index] = size;
6149 ASSIGN_4V(ctx->ListState.CurrentAttrib[index], x, y, z, w);
6150
6151 if (ctx->ExecuteFlag) {
6152 if (type == GL_FLOAT) {
6153 if (base_op == OPCODE_ATTR_1F_NV) {
6154 if (size == 4)
6155 CALL_VertexAttrib4fNV(ctx->Exec, (attr, uif(x), uif(y), uif(z), uif(w)));
6156 else if (size == 3)
6157 CALL_VertexAttrib3fNV(ctx->Exec, (attr, uif(x), uif(y), uif(z)));
6158 else if (size == 2)
6159 CALL_VertexAttrib2fNV(ctx->Exec, (attr, uif(x), uif(y)));
6160 else
6161 CALL_VertexAttrib1fNV(ctx->Exec, (attr, uif(x)));
6162 } else {
6163 if (size == 4)
6164 CALL_VertexAttrib4fARB(ctx->Exec, (attr, uif(x), uif(y), uif(z), uif(w)));
6165 else if (size == 3)
6166 CALL_VertexAttrib3fARB(ctx->Exec, (attr, uif(x), uif(y), uif(z)));
6167 else if (size == 2)
6168 CALL_VertexAttrib2fARB(ctx->Exec, (attr, uif(x), uif(y)));
6169 else
6170 CALL_VertexAttrib1fARB(ctx->Exec, (attr, uif(x)));
6171 }
6172 } else {
6173 if (size == 4)
6174 CALL_VertexAttribI4iEXT(ctx->Exec, (attr, x, y, z, w));
6175 else if (size == 3)
6176 CALL_VertexAttribI3iEXT(ctx->Exec, (attr, x, y, z));
6177 else if (size == 2)
6178 CALL_VertexAttribI2iEXT(ctx->Exec, (attr, x, y));
6179 else
6180 CALL_VertexAttribI1iEXT(ctx->Exec, (attr, x));
6181 }
6182 }
6183 }
6184
6185 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)6186 save_Attr64bit(struct gl_context *ctx, unsigned attr, unsigned size,
6187 GLenum type, uint64_t x, uint64_t y, uint64_t z, uint64_t w)
6188 {
6189 Node *n;
6190 SAVE_FLUSH_VERTICES(ctx);
6191 unsigned base_op;
6192 unsigned index = attr;
6193
6194 if (type == GL_DOUBLE) {
6195 base_op = OPCODE_ATTR_1D;
6196 } else {
6197 base_op = OPCODE_ATTR_1UI64;
6198 assert(size == 1);
6199 }
6200
6201 attr -= VERT_ATTRIB_GENERIC0;
6202 n = alloc_instruction(ctx, base_op + size - 1, 1 + size * 2);
6203 if (n) {
6204 n[1].ui = attr;
6205 ASSIGN_UINT64_TO_NODES(n, 2, x);
6206 if (size >= 2) ASSIGN_UINT64_TO_NODES(n, 4, y);
6207 if (size >= 3) ASSIGN_UINT64_TO_NODES(n, 6, z);
6208 if (size >= 4) ASSIGN_UINT64_TO_NODES(n, 8, w);
6209 }
6210
6211 ctx->ListState.ActiveAttribSize[index] = size;
6212 memcpy(ctx->ListState.CurrentAttrib[index], &n[2], size * sizeof(uint64_t));
6213
6214 if (ctx->ExecuteFlag) {
6215 uint64_t v[] = {x, y, z, w};
6216 if (type == GL_DOUBLE) {
6217 if (size == 4)
6218 CALL_VertexAttribL4dv(ctx->Exec, (attr, (GLdouble*)v));
6219 else if (size == 3)
6220 CALL_VertexAttribL3dv(ctx->Exec, (attr, (GLdouble*)v));
6221 else if (size == 2)
6222 CALL_VertexAttribL2dv(ctx->Exec, (attr, (GLdouble*)v));
6223 else
6224 CALL_VertexAttribL1d(ctx->Exec, (attr, UINT64_AS_DOUBLE(x)));
6225 } else {
6226 CALL_VertexAttribL1ui64ARB(ctx->Exec, (attr, x));
6227 }
6228 }
6229 }
6230
6231 /**
6232 * If index=0, does glVertexAttrib*() alias glVertex() to emit a vertex?
6233 * It depends on a few things, including whether we're inside or outside
6234 * of glBegin/glEnd.
6235 */
6236 static inline bool
is_vertex_position(const struct gl_context * ctx,GLuint index)6237 is_vertex_position(const struct gl_context *ctx, GLuint index)
6238 {
6239 return (index == 0 &&
6240 _mesa_attr_zero_aliases_vertex(ctx) &&
6241 _mesa_inside_dlist_begin_end(ctx));
6242 }
6243
6244 /**
6245 * This macro is used to implement all the glVertex, glColor, glTexCoord,
6246 * glVertexAttrib, etc functions.
6247 * \param A VBO_ATTRIB_x attribute index
6248 * \param N attribute size (1..4)
6249 * \param T type (GL_FLOAT, GL_DOUBLE, GL_INT, GL_UNSIGNED_INT)
6250 * \param C cast type (uint32_t or uint64_t)
6251 * \param V0, V1, v2, V3 attribute value
6252 */
6253 #define ATTR_UNION(A, N, T, C, V0, V1, V2, V3) \
6254 do { \
6255 if (sizeof(C) == 4) { \
6256 save_Attr32bit(ctx, A, N, T, V0, V1, V2, V3); \
6257 } else { \
6258 save_Attr64bit(ctx, A, N, T, V0, V1, V2, V3); \
6259 } \
6260 } while (0)
6261
6262 #undef ERROR
6263 #define ERROR(err) _mesa_error(ctx, err, __func__)
6264 #define TAG(x) save_##x
6265
6266 #define VBO_ATTRIB_POS VERT_ATTRIB_POS
6267 #define VBO_ATTRIB_NORMAL VERT_ATTRIB_NORMAL
6268 #define VBO_ATTRIB_COLOR0 VERT_ATTRIB_COLOR0
6269 #define VBO_ATTRIB_COLOR1 VERT_ATTRIB_COLOR1
6270 #define VBO_ATTRIB_FOG VERT_ATTRIB_FOG
6271 #define VBO_ATTRIB_COLOR_INDEX VERT_ATTRIB_COLOR_INDEX
6272 #define VBO_ATTRIB_EDGEFLAG VERT_ATTRIB_EDGEFLAG
6273 #define VBO_ATTRIB_TEX0 VERT_ATTRIB_TEX0
6274 #define VBO_ATTRIB_GENERIC0 VERT_ATTRIB_GENERIC0
6275 #define VBO_ATTRIB_MAX VERT_ATTRIB_MAX
6276
6277 #include "vbo/vbo_attrib_tmp.h"
6278
6279 void GLAPIENTRY
save_UseProgram(GLuint program)6280 save_UseProgram(GLuint program)
6281 {
6282 GET_CURRENT_CONTEXT(ctx);
6283 Node *n;
6284 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6285 n = alloc_instruction(ctx, OPCODE_USE_PROGRAM, 1);
6286 if (n) {
6287 n[1].ui = program;
6288 }
6289 if (ctx->ExecuteFlag) {
6290 CALL_UseProgram(ctx->Exec, (program));
6291 }
6292 }
6293
6294
6295 void GLAPIENTRY
save_Uniform1f(GLint location,GLfloat x)6296 save_Uniform1f(GLint location, GLfloat x)
6297 {
6298 GET_CURRENT_CONTEXT(ctx);
6299 Node *n;
6300 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6301 n = alloc_instruction(ctx, OPCODE_UNIFORM_1F, 2);
6302 if (n) {
6303 n[1].i = location;
6304 n[2].f = x;
6305 }
6306 if (ctx->ExecuteFlag) {
6307 CALL_Uniform1f(ctx->Exec, (location, x));
6308 }
6309 }
6310
6311
6312 void GLAPIENTRY
save_Uniform2f(GLint location,GLfloat x,GLfloat y)6313 save_Uniform2f(GLint location, GLfloat x, GLfloat y)
6314 {
6315 GET_CURRENT_CONTEXT(ctx);
6316 Node *n;
6317 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6318 n = alloc_instruction(ctx, OPCODE_UNIFORM_2F, 3);
6319 if (n) {
6320 n[1].i = location;
6321 n[2].f = x;
6322 n[3].f = y;
6323 }
6324 if (ctx->ExecuteFlag) {
6325 CALL_Uniform2f(ctx->Exec, (location, x, y));
6326 }
6327 }
6328
6329
6330 void GLAPIENTRY
save_Uniform3f(GLint location,GLfloat x,GLfloat y,GLfloat z)6331 save_Uniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z)
6332 {
6333 GET_CURRENT_CONTEXT(ctx);
6334 Node *n;
6335 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6336 n = alloc_instruction(ctx, OPCODE_UNIFORM_3F, 4);
6337 if (n) {
6338 n[1].i = location;
6339 n[2].f = x;
6340 n[3].f = y;
6341 n[4].f = z;
6342 }
6343 if (ctx->ExecuteFlag) {
6344 CALL_Uniform3f(ctx->Exec, (location, x, y, z));
6345 }
6346 }
6347
6348
6349 void GLAPIENTRY
save_Uniform4f(GLint location,GLfloat x,GLfloat y,GLfloat z,GLfloat w)6350 save_Uniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
6351 {
6352 GET_CURRENT_CONTEXT(ctx);
6353 Node *n;
6354 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6355 n = alloc_instruction(ctx, OPCODE_UNIFORM_4F, 5);
6356 if (n) {
6357 n[1].i = location;
6358 n[2].f = x;
6359 n[3].f = y;
6360 n[4].f = z;
6361 n[5].f = w;
6362 }
6363 if (ctx->ExecuteFlag) {
6364 CALL_Uniform4f(ctx->Exec, (location, x, y, z, w));
6365 }
6366 }
6367
6368
6369 void GLAPIENTRY
save_Uniform1fv(GLint location,GLsizei count,const GLfloat * v)6370 save_Uniform1fv(GLint location, GLsizei count, const GLfloat *v)
6371 {
6372 GET_CURRENT_CONTEXT(ctx);
6373 Node *n;
6374 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6375 n = alloc_instruction(ctx, OPCODE_UNIFORM_1FV, 2 + POINTER_DWORDS);
6376 if (n) {
6377 n[1].i = location;
6378 n[2].i = count;
6379 save_pointer(&n[3], memdup(v, count * 1 * sizeof(GLfloat)));
6380 }
6381 if (ctx->ExecuteFlag) {
6382 CALL_Uniform1fv(ctx->Exec, (location, count, v));
6383 }
6384 }
6385
6386 void GLAPIENTRY
save_Uniform2fv(GLint location,GLsizei count,const GLfloat * v)6387 save_Uniform2fv(GLint location, GLsizei count, const GLfloat *v)
6388 {
6389 GET_CURRENT_CONTEXT(ctx);
6390 Node *n;
6391 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6392 n = alloc_instruction(ctx, OPCODE_UNIFORM_2FV, 2 + POINTER_DWORDS);
6393 if (n) {
6394 n[1].i = location;
6395 n[2].i = count;
6396 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLfloat)));
6397 }
6398 if (ctx->ExecuteFlag) {
6399 CALL_Uniform2fv(ctx->Exec, (location, count, v));
6400 }
6401 }
6402
6403 void GLAPIENTRY
save_Uniform3fv(GLint location,GLsizei count,const GLfloat * v)6404 save_Uniform3fv(GLint location, GLsizei count, const GLfloat *v)
6405 {
6406 GET_CURRENT_CONTEXT(ctx);
6407 Node *n;
6408 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6409 n = alloc_instruction(ctx, OPCODE_UNIFORM_3FV, 2 + POINTER_DWORDS);
6410 if (n) {
6411 n[1].i = location;
6412 n[2].i = count;
6413 save_pointer(&n[3], memdup(v, count * 3 * sizeof(GLfloat)));
6414 }
6415 if (ctx->ExecuteFlag) {
6416 CALL_Uniform3fv(ctx->Exec, (location, count, v));
6417 }
6418 }
6419
6420 void GLAPIENTRY
save_Uniform4fv(GLint location,GLsizei count,const GLfloat * v)6421 save_Uniform4fv(GLint location, GLsizei count, const GLfloat *v)
6422 {
6423 GET_CURRENT_CONTEXT(ctx);
6424 Node *n;
6425 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6426 n = alloc_instruction(ctx, OPCODE_UNIFORM_4FV, 2 + POINTER_DWORDS);
6427 if (n) {
6428 n[1].i = location;
6429 n[2].i = count;
6430 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLfloat)));
6431 }
6432 if (ctx->ExecuteFlag) {
6433 CALL_Uniform4fv(ctx->Exec, (location, count, v));
6434 }
6435 }
6436
6437
6438 void GLAPIENTRY
save_Uniform1d(GLint location,GLdouble x)6439 save_Uniform1d(GLint location, GLdouble x)
6440 {
6441 GET_CURRENT_CONTEXT(ctx);
6442 Node *n;
6443 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6444 n = alloc_instruction(ctx, OPCODE_UNIFORM_1D, 3);
6445 if (n) {
6446 n[1].i = location;
6447 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
6448 }
6449 if (ctx->ExecuteFlag) {
6450 CALL_Uniform1d(ctx->Exec, (location, x));
6451 }
6452 }
6453
6454
6455 void GLAPIENTRY
save_Uniform2d(GLint location,GLdouble x,GLdouble y)6456 save_Uniform2d(GLint location, GLdouble x, GLdouble y)
6457 {
6458 GET_CURRENT_CONTEXT(ctx);
6459 Node *n;
6460 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6461 n = alloc_instruction(ctx, OPCODE_UNIFORM_2D, 5);
6462 if (n) {
6463 n[1].i = location;
6464 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
6465 ASSIGN_DOUBLE_TO_NODES(n, 4, y);
6466 }
6467 if (ctx->ExecuteFlag) {
6468 CALL_Uniform2d(ctx->Exec, (location, x, y));
6469 }
6470 }
6471
6472
6473 void GLAPIENTRY
save_Uniform3d(GLint location,GLdouble x,GLdouble y,GLdouble z)6474 save_Uniform3d(GLint location, GLdouble x, GLdouble y, GLdouble z)
6475 {
6476 GET_CURRENT_CONTEXT(ctx);
6477 Node *n;
6478 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6479 n = alloc_instruction(ctx, OPCODE_UNIFORM_3D, 7);
6480 if (n) {
6481 n[1].i = location;
6482 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
6483 ASSIGN_DOUBLE_TO_NODES(n, 4, y);
6484 ASSIGN_DOUBLE_TO_NODES(n, 6, z);
6485 }
6486 if (ctx->ExecuteFlag) {
6487 CALL_Uniform3d(ctx->Exec, (location, x, y, z));
6488 }
6489 }
6490
6491
6492 void GLAPIENTRY
save_Uniform4d(GLint location,GLdouble x,GLdouble y,GLdouble z,GLdouble w)6493 save_Uniform4d(GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
6494 {
6495 GET_CURRENT_CONTEXT(ctx);
6496 Node *n;
6497 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6498 n = alloc_instruction(ctx, OPCODE_UNIFORM_4D, 9);
6499 if (n) {
6500 n[1].i = location;
6501 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
6502 ASSIGN_DOUBLE_TO_NODES(n, 4, y);
6503 ASSIGN_DOUBLE_TO_NODES(n, 6, z);
6504 ASSIGN_DOUBLE_TO_NODES(n, 8, w);
6505 }
6506 if (ctx->ExecuteFlag) {
6507 CALL_Uniform4d(ctx->Exec, (location, x, y, z, w));
6508 }
6509 }
6510
6511
6512 void GLAPIENTRY
save_Uniform1dv(GLint location,GLsizei count,const GLdouble * v)6513 save_Uniform1dv(GLint location, GLsizei count, const GLdouble *v)
6514 {
6515 GET_CURRENT_CONTEXT(ctx);
6516 Node *n;
6517 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6518 n = alloc_instruction(ctx, OPCODE_UNIFORM_1DV, 2 + POINTER_DWORDS);
6519 if (n) {
6520 n[1].i = location;
6521 n[2].i = count;
6522 save_pointer(&n[3], memdup(v, count * 1 * sizeof(GLdouble)));
6523 }
6524 if (ctx->ExecuteFlag) {
6525 CALL_Uniform1dv(ctx->Exec, (location, count, v));
6526 }
6527 }
6528
6529
6530 void GLAPIENTRY
save_Uniform2dv(GLint location,GLsizei count,const GLdouble * v)6531 save_Uniform2dv(GLint location, GLsizei count, const GLdouble *v)
6532 {
6533 GET_CURRENT_CONTEXT(ctx);
6534 Node *n;
6535 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6536 n = alloc_instruction(ctx, OPCODE_UNIFORM_2DV, 2 + POINTER_DWORDS);
6537 if (n) {
6538 n[1].i = location;
6539 n[2].i = count;
6540 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLdouble)));
6541 }
6542 if (ctx->ExecuteFlag) {
6543 CALL_Uniform2dv(ctx->Exec, (location, count, v));
6544 }
6545 }
6546
6547
6548 void GLAPIENTRY
save_Uniform3dv(GLint location,GLsizei count,const GLdouble * v)6549 save_Uniform3dv(GLint location, GLsizei count, const GLdouble *v)
6550 {
6551 GET_CURRENT_CONTEXT(ctx);
6552 Node *n;
6553 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6554 n = alloc_instruction(ctx, OPCODE_UNIFORM_3DV, 2 + POINTER_DWORDS);
6555 if (n) {
6556 n[1].i = location;
6557 n[2].i = count;
6558 save_pointer(&n[3], memdup(v, count * 3 * sizeof(GLdouble)));
6559 }
6560 if (ctx->ExecuteFlag) {
6561 CALL_Uniform3dv(ctx->Exec, (location, count, v));
6562 }
6563 }
6564
6565
6566 void GLAPIENTRY
save_Uniform4dv(GLint location,GLsizei count,const GLdouble * v)6567 save_Uniform4dv(GLint location, GLsizei count, const GLdouble *v)
6568 {
6569 GET_CURRENT_CONTEXT(ctx);
6570 Node *n;
6571 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6572 n = alloc_instruction(ctx, OPCODE_UNIFORM_4DV, 2 + POINTER_DWORDS);
6573 if (n) {
6574 n[1].i = location;
6575 n[2].i = count;
6576 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLdouble)));
6577 }
6578 if (ctx->ExecuteFlag) {
6579 CALL_Uniform4dv(ctx->Exec, (location, count, v));
6580 }
6581 }
6582
6583
6584 void GLAPIENTRY
save_Uniform1i(GLint location,GLint x)6585 save_Uniform1i(GLint location, GLint x)
6586 {
6587 GET_CURRENT_CONTEXT(ctx);
6588 Node *n;
6589 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6590 n = alloc_instruction(ctx, OPCODE_UNIFORM_1I, 2);
6591 if (n) {
6592 n[1].i = location;
6593 n[2].i = x;
6594 }
6595 if (ctx->ExecuteFlag) {
6596 CALL_Uniform1i(ctx->Exec, (location, x));
6597 }
6598 }
6599
6600 void GLAPIENTRY
save_Uniform2i(GLint location,GLint x,GLint y)6601 save_Uniform2i(GLint location, GLint x, GLint y)
6602 {
6603 GET_CURRENT_CONTEXT(ctx);
6604 Node *n;
6605 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6606 n = alloc_instruction(ctx, OPCODE_UNIFORM_2I, 3);
6607 if (n) {
6608 n[1].i = location;
6609 n[2].i = x;
6610 n[3].i = y;
6611 }
6612 if (ctx->ExecuteFlag) {
6613 CALL_Uniform2i(ctx->Exec, (location, x, y));
6614 }
6615 }
6616
6617 void GLAPIENTRY
save_Uniform3i(GLint location,GLint x,GLint y,GLint z)6618 save_Uniform3i(GLint location, GLint x, GLint y, GLint z)
6619 {
6620 GET_CURRENT_CONTEXT(ctx);
6621 Node *n;
6622 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6623 n = alloc_instruction(ctx, OPCODE_UNIFORM_3I, 4);
6624 if (n) {
6625 n[1].i = location;
6626 n[2].i = x;
6627 n[3].i = y;
6628 n[4].i = z;
6629 }
6630 if (ctx->ExecuteFlag) {
6631 CALL_Uniform3i(ctx->Exec, (location, x, y, z));
6632 }
6633 }
6634
6635 void GLAPIENTRY
save_Uniform4i(GLint location,GLint x,GLint y,GLint z,GLint w)6636 save_Uniform4i(GLint location, GLint x, GLint y, GLint z, GLint w)
6637 {
6638 GET_CURRENT_CONTEXT(ctx);
6639 Node *n;
6640 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6641 n = alloc_instruction(ctx, OPCODE_UNIFORM_4I, 5);
6642 if (n) {
6643 n[1].i = location;
6644 n[2].i = x;
6645 n[3].i = y;
6646 n[4].i = z;
6647 n[5].i = w;
6648 }
6649 if (ctx->ExecuteFlag) {
6650 CALL_Uniform4i(ctx->Exec, (location, x, y, z, w));
6651 }
6652 }
6653
6654
6655
6656 void GLAPIENTRY
save_Uniform1iv(GLint location,GLsizei count,const GLint * v)6657 save_Uniform1iv(GLint location, GLsizei count, const GLint *v)
6658 {
6659 GET_CURRENT_CONTEXT(ctx);
6660 Node *n;
6661 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6662 n = alloc_instruction(ctx, OPCODE_UNIFORM_1IV, 2 + POINTER_DWORDS);
6663 if (n) {
6664 n[1].i = location;
6665 n[2].i = count;
6666 save_pointer(&n[3], memdup(v, count * 1 * sizeof(GLint)));
6667 }
6668 if (ctx->ExecuteFlag) {
6669 CALL_Uniform1iv(ctx->Exec, (location, count, v));
6670 }
6671 }
6672
6673 void GLAPIENTRY
save_Uniform2iv(GLint location,GLsizei count,const GLint * v)6674 save_Uniform2iv(GLint location, GLsizei count, const GLint *v)
6675 {
6676 GET_CURRENT_CONTEXT(ctx);
6677 Node *n;
6678 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6679 n = alloc_instruction(ctx, OPCODE_UNIFORM_2IV, 2 + POINTER_DWORDS);
6680 if (n) {
6681 n[1].i = location;
6682 n[2].i = count;
6683 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLint)));
6684 }
6685 if (ctx->ExecuteFlag) {
6686 CALL_Uniform2iv(ctx->Exec, (location, count, v));
6687 }
6688 }
6689
6690 void GLAPIENTRY
save_Uniform3iv(GLint location,GLsizei count,const GLint * v)6691 save_Uniform3iv(GLint location, GLsizei count, const GLint *v)
6692 {
6693 GET_CURRENT_CONTEXT(ctx);
6694 Node *n;
6695 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6696 n = alloc_instruction(ctx, OPCODE_UNIFORM_3IV, 2 + POINTER_DWORDS);
6697 if (n) {
6698 n[1].i = location;
6699 n[2].i = count;
6700 save_pointer(&n[3], memdup(v, count * 3 * sizeof(GLint)));
6701 }
6702 if (ctx->ExecuteFlag) {
6703 CALL_Uniform3iv(ctx->Exec, (location, count, v));
6704 }
6705 }
6706
6707 void GLAPIENTRY
save_Uniform4iv(GLint location,GLsizei count,const GLint * v)6708 save_Uniform4iv(GLint location, GLsizei count, const GLint *v)
6709 {
6710 GET_CURRENT_CONTEXT(ctx);
6711 Node *n;
6712 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6713 n = alloc_instruction(ctx, OPCODE_UNIFORM_4IV, 2 + POINTER_DWORDS);
6714 if (n) {
6715 n[1].i = location;
6716 n[2].i = count;
6717 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLfloat)));
6718 }
6719 if (ctx->ExecuteFlag) {
6720 CALL_Uniform4iv(ctx->Exec, (location, count, v));
6721 }
6722 }
6723
6724
6725
6726 void GLAPIENTRY
save_Uniform1ui(GLint location,GLuint x)6727 save_Uniform1ui(GLint location, GLuint x)
6728 {
6729 GET_CURRENT_CONTEXT(ctx);
6730 Node *n;
6731 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6732 n = alloc_instruction(ctx, OPCODE_UNIFORM_1UI, 2);
6733 if (n) {
6734 n[1].i = location;
6735 n[2].i = x;
6736 }
6737 if (ctx->ExecuteFlag) {
6738 CALL_Uniform1ui(ctx->Exec, (location, x));
6739 }
6740 }
6741
6742 void GLAPIENTRY
save_Uniform2ui(GLint location,GLuint x,GLuint y)6743 save_Uniform2ui(GLint location, GLuint x, GLuint y)
6744 {
6745 GET_CURRENT_CONTEXT(ctx);
6746 Node *n;
6747 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6748 n = alloc_instruction(ctx, OPCODE_UNIFORM_2UI, 3);
6749 if (n) {
6750 n[1].i = location;
6751 n[2].i = x;
6752 n[3].i = y;
6753 }
6754 if (ctx->ExecuteFlag) {
6755 CALL_Uniform2ui(ctx->Exec, (location, x, y));
6756 }
6757 }
6758
6759 void GLAPIENTRY
save_Uniform3ui(GLint location,GLuint x,GLuint y,GLuint z)6760 save_Uniform3ui(GLint location, GLuint x, GLuint y, GLuint z)
6761 {
6762 GET_CURRENT_CONTEXT(ctx);
6763 Node *n;
6764 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6765 n = alloc_instruction(ctx, OPCODE_UNIFORM_3UI, 4);
6766 if (n) {
6767 n[1].i = location;
6768 n[2].i = x;
6769 n[3].i = y;
6770 n[4].i = z;
6771 }
6772 if (ctx->ExecuteFlag) {
6773 CALL_Uniform3ui(ctx->Exec, (location, x, y, z));
6774 }
6775 }
6776
6777 void GLAPIENTRY
save_Uniform4ui(GLint location,GLuint x,GLuint y,GLuint z,GLuint w)6778 save_Uniform4ui(GLint location, GLuint x, GLuint y, GLuint z, GLuint w)
6779 {
6780 GET_CURRENT_CONTEXT(ctx);
6781 Node *n;
6782 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6783 n = alloc_instruction(ctx, OPCODE_UNIFORM_4UI, 5);
6784 if (n) {
6785 n[1].i = location;
6786 n[2].i = x;
6787 n[3].i = y;
6788 n[4].i = z;
6789 n[5].i = w;
6790 }
6791 if (ctx->ExecuteFlag) {
6792 CALL_Uniform4ui(ctx->Exec, (location, x, y, z, w));
6793 }
6794 }
6795
6796
6797
6798 void GLAPIENTRY
save_Uniform1uiv(GLint location,GLsizei count,const GLuint * v)6799 save_Uniform1uiv(GLint location, GLsizei count, const GLuint *v)
6800 {
6801 GET_CURRENT_CONTEXT(ctx);
6802 Node *n;
6803 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6804 n = alloc_instruction(ctx, OPCODE_UNIFORM_1UIV, 2 + POINTER_DWORDS);
6805 if (n) {
6806 n[1].i = location;
6807 n[2].i = count;
6808 save_pointer(&n[3], memdup(v, count * 1 * sizeof(*v)));
6809 }
6810 if (ctx->ExecuteFlag) {
6811 CALL_Uniform1uiv(ctx->Exec, (location, count, v));
6812 }
6813 }
6814
6815 void GLAPIENTRY
save_Uniform2uiv(GLint location,GLsizei count,const GLuint * v)6816 save_Uniform2uiv(GLint location, GLsizei count, const GLuint *v)
6817 {
6818 GET_CURRENT_CONTEXT(ctx);
6819 Node *n;
6820 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6821 n = alloc_instruction(ctx, OPCODE_UNIFORM_2UIV, 2 + POINTER_DWORDS);
6822 if (n) {
6823 n[1].i = location;
6824 n[2].i = count;
6825 save_pointer(&n[3], memdup(v, count * 2 * sizeof(*v)));
6826 }
6827 if (ctx->ExecuteFlag) {
6828 CALL_Uniform2uiv(ctx->Exec, (location, count, v));
6829 }
6830 }
6831
6832 void GLAPIENTRY
save_Uniform3uiv(GLint location,GLsizei count,const GLuint * v)6833 save_Uniform3uiv(GLint location, GLsizei count, const GLuint *v)
6834 {
6835 GET_CURRENT_CONTEXT(ctx);
6836 Node *n;
6837 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6838 n = alloc_instruction(ctx, OPCODE_UNIFORM_3UIV, 2 + POINTER_DWORDS);
6839 if (n) {
6840 n[1].i = location;
6841 n[2].i = count;
6842 save_pointer(&n[3], memdup(v, count * 3 * sizeof(*v)));
6843 }
6844 if (ctx->ExecuteFlag) {
6845 CALL_Uniform3uiv(ctx->Exec, (location, count, v));
6846 }
6847 }
6848
6849 void GLAPIENTRY
save_Uniform4uiv(GLint location,GLsizei count,const GLuint * v)6850 save_Uniform4uiv(GLint location, GLsizei count, const GLuint *v)
6851 {
6852 GET_CURRENT_CONTEXT(ctx);
6853 Node *n;
6854 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6855 n = alloc_instruction(ctx, OPCODE_UNIFORM_4UIV, 2 + POINTER_DWORDS);
6856 if (n) {
6857 n[1].i = location;
6858 n[2].i = count;
6859 save_pointer(&n[3], memdup(v, count * 4 * sizeof(*v)));
6860 }
6861 if (ctx->ExecuteFlag) {
6862 CALL_Uniform4uiv(ctx->Exec, (location, count, v));
6863 }
6864 }
6865
6866
6867
6868 void GLAPIENTRY
save_UniformMatrix2fv(GLint location,GLsizei count,GLboolean transpose,const GLfloat * m)6869 save_UniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose,
6870 const GLfloat *m)
6871 {
6872 GET_CURRENT_CONTEXT(ctx);
6873 Node *n;
6874 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6875 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX22, 3 + POINTER_DWORDS);
6876 if (n) {
6877 n[1].i = location;
6878 n[2].i = count;
6879 n[3].b = transpose;
6880 save_pointer(&n[4], memdup(m, count * 2 * 2 * sizeof(GLfloat)));
6881 }
6882 if (ctx->ExecuteFlag) {
6883 CALL_UniformMatrix2fv(ctx->Exec, (location, count, transpose, m));
6884 }
6885 }
6886
6887 void GLAPIENTRY
save_UniformMatrix3fv(GLint location,GLsizei count,GLboolean transpose,const GLfloat * m)6888 save_UniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose,
6889 const GLfloat *m)
6890 {
6891 GET_CURRENT_CONTEXT(ctx);
6892 Node *n;
6893 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6894 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX33, 3 + POINTER_DWORDS);
6895 if (n) {
6896 n[1].i = location;
6897 n[2].i = count;
6898 n[3].b = transpose;
6899 save_pointer(&n[4], memdup(m, count * 3 * 3 * sizeof(GLfloat)));
6900 }
6901 if (ctx->ExecuteFlag) {
6902 CALL_UniformMatrix3fv(ctx->Exec, (location, count, transpose, m));
6903 }
6904 }
6905
6906 void GLAPIENTRY
save_UniformMatrix4fv(GLint location,GLsizei count,GLboolean transpose,const GLfloat * m)6907 save_UniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose,
6908 const GLfloat *m)
6909 {
6910 GET_CURRENT_CONTEXT(ctx);
6911 Node *n;
6912 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6913 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX44, 3 + POINTER_DWORDS);
6914 if (n) {
6915 n[1].i = location;
6916 n[2].i = count;
6917 n[3].b = transpose;
6918 save_pointer(&n[4], memdup(m, count * 4 * 4 * sizeof(GLfloat)));
6919 }
6920 if (ctx->ExecuteFlag) {
6921 CALL_UniformMatrix4fv(ctx->Exec, (location, count, transpose, m));
6922 }
6923 }
6924
6925
6926 void GLAPIENTRY
save_UniformMatrix2x3fv(GLint location,GLsizei count,GLboolean transpose,const GLfloat * m)6927 save_UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose,
6928 const GLfloat *m)
6929 {
6930 GET_CURRENT_CONTEXT(ctx);
6931 Node *n;
6932 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6933 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX23, 3 + POINTER_DWORDS);
6934 if (n) {
6935 n[1].i = location;
6936 n[2].i = count;
6937 n[3].b = transpose;
6938 save_pointer(&n[4], memdup(m, count * 2 * 3 * sizeof(GLfloat)));
6939 }
6940 if (ctx->ExecuteFlag) {
6941 CALL_UniformMatrix2x3fv(ctx->Exec, (location, count, transpose, m));
6942 }
6943 }
6944
6945 void GLAPIENTRY
save_UniformMatrix3x2fv(GLint location,GLsizei count,GLboolean transpose,const GLfloat * m)6946 save_UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose,
6947 const GLfloat *m)
6948 {
6949 GET_CURRENT_CONTEXT(ctx);
6950 Node *n;
6951 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6952 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX32, 3 + POINTER_DWORDS);
6953 if (n) {
6954 n[1].i = location;
6955 n[2].i = count;
6956 n[3].b = transpose;
6957 save_pointer(&n[4], memdup(m, count * 3 * 2 * sizeof(GLfloat)));
6958 }
6959 if (ctx->ExecuteFlag) {
6960 CALL_UniformMatrix3x2fv(ctx->Exec, (location, count, transpose, m));
6961 }
6962 }
6963
6964
6965 void GLAPIENTRY
save_UniformMatrix2x4fv(GLint location,GLsizei count,GLboolean transpose,const GLfloat * m)6966 save_UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose,
6967 const GLfloat *m)
6968 {
6969 GET_CURRENT_CONTEXT(ctx);
6970 Node *n;
6971 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6972 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX24, 3 + POINTER_DWORDS);
6973 if (n) {
6974 n[1].i = location;
6975 n[2].i = count;
6976 n[3].b = transpose;
6977 save_pointer(&n[4], memdup(m, count * 2 * 4 * sizeof(GLfloat)));
6978 }
6979 if (ctx->ExecuteFlag) {
6980 CALL_UniformMatrix2x4fv(ctx->Exec, (location, count, transpose, m));
6981 }
6982 }
6983
6984 void GLAPIENTRY
save_UniformMatrix4x2fv(GLint location,GLsizei count,GLboolean transpose,const GLfloat * m)6985 save_UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose,
6986 const GLfloat *m)
6987 {
6988 GET_CURRENT_CONTEXT(ctx);
6989 Node *n;
6990 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6991 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX42, 3 + POINTER_DWORDS);
6992 if (n) {
6993 n[1].i = location;
6994 n[2].i = count;
6995 n[3].b = transpose;
6996 save_pointer(&n[4], memdup(m, count * 4 * 2 * sizeof(GLfloat)));
6997 }
6998 if (ctx->ExecuteFlag) {
6999 CALL_UniformMatrix4x2fv(ctx->Exec, (location, count, transpose, m));
7000 }
7001 }
7002
7003
7004 void GLAPIENTRY
save_UniformMatrix3x4fv(GLint location,GLsizei count,GLboolean transpose,const GLfloat * m)7005 save_UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose,
7006 const GLfloat *m)
7007 {
7008 GET_CURRENT_CONTEXT(ctx);
7009 Node *n;
7010 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7011 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX34, 3 + POINTER_DWORDS);
7012 if (n) {
7013 n[1].i = location;
7014 n[2].i = count;
7015 n[3].b = transpose;
7016 save_pointer(&n[4], memdup(m, count * 3 * 4 * sizeof(GLfloat)));
7017 }
7018 if (ctx->ExecuteFlag) {
7019 CALL_UniformMatrix3x4fv(ctx->Exec, (location, count, transpose, m));
7020 }
7021 }
7022
7023 void GLAPIENTRY
save_UniformMatrix4x3fv(GLint location,GLsizei count,GLboolean transpose,const GLfloat * m)7024 save_UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose,
7025 const GLfloat *m)
7026 {
7027 GET_CURRENT_CONTEXT(ctx);
7028 Node *n;
7029 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7030 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX43, 3 + POINTER_DWORDS);
7031 if (n) {
7032 n[1].i = location;
7033 n[2].i = count;
7034 n[3].b = transpose;
7035 save_pointer(&n[4], memdup(m, count * 4 * 3 * sizeof(GLfloat)));
7036 }
7037 if (ctx->ExecuteFlag) {
7038 CALL_UniformMatrix4x3fv(ctx->Exec, (location, count, transpose, m));
7039 }
7040 }
7041
7042
7043 void GLAPIENTRY
save_UniformMatrix2dv(GLint location,GLsizei count,GLboolean transpose,const GLdouble * m)7044 save_UniformMatrix2dv(GLint location, GLsizei count, GLboolean transpose,
7045 const GLdouble *m)
7046 {
7047 GET_CURRENT_CONTEXT(ctx);
7048 Node *n;
7049 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7050 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX22D, 3 + POINTER_DWORDS);
7051 if (n) {
7052 n[1].i = location;
7053 n[2].i = count;
7054 n[3].b = transpose;
7055 save_pointer(&n[4], memdup(m, count * 2 * 2 * sizeof(GLdouble)));
7056 }
7057 if (ctx->ExecuteFlag) {
7058 CALL_UniformMatrix2dv(ctx->Exec, (location, count, transpose, m));
7059 }
7060 }
7061
7062 void GLAPIENTRY
save_UniformMatrix3dv(GLint location,GLsizei count,GLboolean transpose,const GLdouble * m)7063 save_UniformMatrix3dv(GLint location, GLsizei count, GLboolean transpose,
7064 const GLdouble *m)
7065 {
7066 GET_CURRENT_CONTEXT(ctx);
7067 Node *n;
7068 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7069 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX33D, 3 + POINTER_DWORDS);
7070 if (n) {
7071 n[1].i = location;
7072 n[2].i = count;
7073 n[3].b = transpose;
7074 save_pointer(&n[4], memdup(m, count * 3 * 3 * sizeof(GLdouble)));
7075 }
7076 if (ctx->ExecuteFlag) {
7077 CALL_UniformMatrix3dv(ctx->Exec, (location, count, transpose, m));
7078 }
7079 }
7080
7081 void GLAPIENTRY
save_UniformMatrix4dv(GLint location,GLsizei count,GLboolean transpose,const GLdouble * m)7082 save_UniformMatrix4dv(GLint location, GLsizei count, GLboolean transpose,
7083 const GLdouble *m)
7084 {
7085 GET_CURRENT_CONTEXT(ctx);
7086 Node *n;
7087 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7088 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX44D, 3 + POINTER_DWORDS);
7089 if (n) {
7090 n[1].i = location;
7091 n[2].i = count;
7092 n[3].b = transpose;
7093 save_pointer(&n[4], memdup(m, count * 4 * 4 * sizeof(GLdouble)));
7094 }
7095 if (ctx->ExecuteFlag) {
7096 CALL_UniformMatrix4dv(ctx->Exec, (location, count, transpose, m));
7097 }
7098 }
7099
7100
7101 void GLAPIENTRY
save_UniformMatrix2x3dv(GLint location,GLsizei count,GLboolean transpose,const GLdouble * m)7102 save_UniformMatrix2x3dv(GLint location, GLsizei count, GLboolean transpose,
7103 const GLdouble *m)
7104 {
7105 GET_CURRENT_CONTEXT(ctx);
7106 Node *n;
7107 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7108 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX23D, 3 + POINTER_DWORDS);
7109 if (n) {
7110 n[1].i = location;
7111 n[2].i = count;
7112 n[3].b = transpose;
7113 save_pointer(&n[4], memdup(m, count * 2 * 3 * sizeof(GLdouble)));
7114 }
7115 if (ctx->ExecuteFlag) {
7116 CALL_UniformMatrix2x3dv(ctx->Exec, (location, count, transpose, m));
7117 }
7118 }
7119
7120
7121 void GLAPIENTRY
save_UniformMatrix3x2dv(GLint location,GLsizei count,GLboolean transpose,const GLdouble * m)7122 save_UniformMatrix3x2dv(GLint location, GLsizei count, GLboolean transpose,
7123 const GLdouble *m)
7124 {
7125 GET_CURRENT_CONTEXT(ctx);
7126 Node *n;
7127 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7128 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX32D, 3 + POINTER_DWORDS);
7129 if (n) {
7130 n[1].i = location;
7131 n[2].i = count;
7132 n[3].b = transpose;
7133 save_pointer(&n[4], memdup(m, count * 3 * 2 * sizeof(GLdouble)));
7134 }
7135 if (ctx->ExecuteFlag) {
7136 CALL_UniformMatrix3x2dv(ctx->Exec, (location, count, transpose, m));
7137 }
7138 }
7139
7140
7141 void GLAPIENTRY
save_UniformMatrix2x4dv(GLint location,GLsizei count,GLboolean transpose,const GLdouble * m)7142 save_UniformMatrix2x4dv(GLint location, GLsizei count, GLboolean transpose,
7143 const GLdouble *m)
7144 {
7145 GET_CURRENT_CONTEXT(ctx);
7146 Node *n;
7147 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7148 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX24D, 3 + POINTER_DWORDS);
7149 if (n) {
7150 n[1].i = location;
7151 n[2].i = count;
7152 n[3].b = transpose;
7153 save_pointer(&n[4], memdup(m, count * 2 * 4 * sizeof(GLdouble)));
7154 }
7155 if (ctx->ExecuteFlag) {
7156 CALL_UniformMatrix2x4dv(ctx->Exec, (location, count, transpose, m));
7157 }
7158 }
7159
7160 void GLAPIENTRY
save_UniformMatrix4x2dv(GLint location,GLsizei count,GLboolean transpose,const GLdouble * m)7161 save_UniformMatrix4x2dv(GLint location, GLsizei count, GLboolean transpose,
7162 const GLdouble *m)
7163 {
7164 GET_CURRENT_CONTEXT(ctx);
7165 Node *n;
7166 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7167 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX42D, 3 + POINTER_DWORDS);
7168 if (n) {
7169 n[1].i = location;
7170 n[2].i = count;
7171 n[3].b = transpose;
7172 save_pointer(&n[4], memdup(m, count * 4 * 2 * sizeof(GLdouble)));
7173 }
7174 if (ctx->ExecuteFlag) {
7175 CALL_UniformMatrix4x2dv(ctx->Exec, (location, count, transpose, m));
7176 }
7177 }
7178
7179
7180 void GLAPIENTRY
save_UniformMatrix3x4dv(GLint location,GLsizei count,GLboolean transpose,const GLdouble * m)7181 save_UniformMatrix3x4dv(GLint location, GLsizei count, GLboolean transpose,
7182 const GLdouble *m)
7183 {
7184 GET_CURRENT_CONTEXT(ctx);
7185 Node *n;
7186 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7187 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX34D, 3 + POINTER_DWORDS);
7188 if (n) {
7189 n[1].i = location;
7190 n[2].i = count;
7191 n[3].b = transpose;
7192 save_pointer(&n[4], memdup(m, count * 3 * 4 * sizeof(GLdouble)));
7193 }
7194 if (ctx->ExecuteFlag) {
7195 CALL_UniformMatrix3x4dv(ctx->Exec, (location, count, transpose, m));
7196 }
7197 }
7198
7199
7200 void GLAPIENTRY
save_UniformMatrix4x3dv(GLint location,GLsizei count,GLboolean transpose,const GLdouble * m)7201 save_UniformMatrix4x3dv(GLint location, GLsizei count, GLboolean transpose,
7202 const GLdouble *m)
7203 {
7204 GET_CURRENT_CONTEXT(ctx);
7205 Node *n;
7206 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7207 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX43D, 3 + POINTER_DWORDS);
7208 if (n) {
7209 n[1].i = location;
7210 n[2].i = count;
7211 n[3].b = transpose;
7212 save_pointer(&n[4], memdup(m, count * 4 * 3 * sizeof(GLdouble)));
7213 }
7214 if (ctx->ExecuteFlag) {
7215 CALL_UniformMatrix4x3dv(ctx->Exec, (location, count, transpose, m));
7216 }
7217 }
7218
7219 void GLAPIENTRY
save_Uniform1i64ARB(GLint location,GLint64 x)7220 save_Uniform1i64ARB(GLint location, GLint64 x)
7221 {
7222 GET_CURRENT_CONTEXT(ctx);
7223 Node *n;
7224 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7225 n = alloc_instruction(ctx, OPCODE_UNIFORM_1I64, 3);
7226 if (n) {
7227 n[1].i = location;
7228 ASSIGN_INT64_TO_NODES(n, 2, x);
7229 }
7230 if (ctx->ExecuteFlag) {
7231 CALL_Uniform1i64ARB(ctx->Exec, (location, x));
7232 }
7233 }
7234
7235 void GLAPIENTRY
save_Uniform2i64ARB(GLint location,GLint64 x,GLint64 y)7236 save_Uniform2i64ARB(GLint location, GLint64 x, GLint64 y)
7237 {
7238 GET_CURRENT_CONTEXT(ctx);
7239 Node *n;
7240 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7241 n = alloc_instruction(ctx, OPCODE_UNIFORM_2I64, 5);
7242 if (n) {
7243 n[1].i = location;
7244 ASSIGN_INT64_TO_NODES(n, 2, x);
7245 ASSIGN_INT64_TO_NODES(n, 4, y);
7246 }
7247 if (ctx->ExecuteFlag) {
7248 CALL_Uniform2i64ARB(ctx->Exec, (location, x, y));
7249 }
7250 }
7251
7252 void GLAPIENTRY
save_Uniform3i64ARB(GLint location,GLint64 x,GLint64 y,GLint64 z)7253 save_Uniform3i64ARB(GLint location, GLint64 x, GLint64 y, GLint64 z)
7254 {
7255 GET_CURRENT_CONTEXT(ctx);
7256 Node *n;
7257 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7258 n = alloc_instruction(ctx, OPCODE_UNIFORM_3I64, 7);
7259 if (n) {
7260 n[1].i = location;
7261 ASSIGN_INT64_TO_NODES(n, 2, x);
7262 ASSIGN_INT64_TO_NODES(n, 4, y);
7263 ASSIGN_INT64_TO_NODES(n, 6, z);
7264 }
7265 if (ctx->ExecuteFlag) {
7266 CALL_Uniform3i64ARB(ctx->Exec, (location, x, y, z));
7267 }
7268 }
7269
7270 void GLAPIENTRY
save_Uniform4i64ARB(GLint location,GLint64 x,GLint64 y,GLint64 z,GLint64 w)7271 save_Uniform4i64ARB(GLint location, GLint64 x, GLint64 y, GLint64 z, GLint64 w)
7272 {
7273 GET_CURRENT_CONTEXT(ctx);
7274 Node *n;
7275 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7276 n = alloc_instruction(ctx, OPCODE_UNIFORM_4I64, 9);
7277 if (n) {
7278 n[1].i = location;
7279 ASSIGN_INT64_TO_NODES(n, 2, x);
7280 ASSIGN_INT64_TO_NODES(n, 4, y);
7281 ASSIGN_INT64_TO_NODES(n, 6, z);
7282 ASSIGN_INT64_TO_NODES(n, 8, w);
7283 }
7284 if (ctx->ExecuteFlag) {
7285 CALL_Uniform4i64ARB(ctx->Exec, (location, x, y, z, w));
7286 }
7287 }
7288
7289 void GLAPIENTRY
save_Uniform1i64vARB(GLint location,GLsizei count,const GLint64 * v)7290 save_Uniform1i64vARB(GLint location, GLsizei count, const GLint64 *v)
7291 {
7292 GET_CURRENT_CONTEXT(ctx);
7293 Node *n;
7294 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7295 n = alloc_instruction(ctx, OPCODE_UNIFORM_1I64V, 2 + POINTER_DWORDS);
7296 if (n) {
7297 n[1].i = location;
7298 n[2].i = count;
7299 save_pointer(&n[3], memdup(v, count * 1 * sizeof(GLint64)));
7300 }
7301 if (ctx->ExecuteFlag) {
7302 CALL_Uniform1i64vARB(ctx->Exec, (location, count, v));
7303 }
7304 }
7305
7306 void GLAPIENTRY
save_Uniform2i64vARB(GLint location,GLsizei count,const GLint64 * v)7307 save_Uniform2i64vARB(GLint location, GLsizei count, const GLint64 *v)
7308 {
7309 GET_CURRENT_CONTEXT(ctx);
7310 Node *n;
7311 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7312 n = alloc_instruction(ctx, OPCODE_UNIFORM_2I64V, 2 + POINTER_DWORDS);
7313 if (n) {
7314 n[1].i = location;
7315 n[2].i = count;
7316 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLint64)));
7317 }
7318 if (ctx->ExecuteFlag) {
7319 CALL_Uniform2i64vARB(ctx->Exec, (location, count, v));
7320 }
7321 }
7322
7323 void GLAPIENTRY
save_Uniform3i64vARB(GLint location,GLsizei count,const GLint64 * v)7324 save_Uniform3i64vARB(GLint location, GLsizei count, const GLint64 *v)
7325 {
7326 GET_CURRENT_CONTEXT(ctx);
7327 Node *n;
7328 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7329 n = alloc_instruction(ctx, OPCODE_UNIFORM_3I64V, 2 + POINTER_DWORDS);
7330 if (n) {
7331 n[1].i = location;
7332 n[2].i = count;
7333 save_pointer(&n[3], memdup(v, count * 3 * sizeof(GLint64)));
7334 }
7335 if (ctx->ExecuteFlag) {
7336 CALL_Uniform3i64vARB(ctx->Exec, (location, count, v));
7337 }
7338 }
7339
7340 void GLAPIENTRY
save_Uniform4i64vARB(GLint location,GLsizei count,const GLint64 * v)7341 save_Uniform4i64vARB(GLint location, GLsizei count, const GLint64 *v)
7342 {
7343 GET_CURRENT_CONTEXT(ctx);
7344 Node *n;
7345 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7346 n = alloc_instruction(ctx, OPCODE_UNIFORM_4I64V, 2 + POINTER_DWORDS);
7347 if (n) {
7348 n[1].i = location;
7349 n[2].i = count;
7350 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLint64)));
7351 }
7352 if (ctx->ExecuteFlag) {
7353 CALL_Uniform4i64vARB(ctx->Exec, (location, count, v));
7354 }
7355 }
7356
7357 void GLAPIENTRY
save_Uniform1ui64ARB(GLint location,GLuint64 x)7358 save_Uniform1ui64ARB(GLint location, GLuint64 x)
7359 {
7360 GET_CURRENT_CONTEXT(ctx);
7361 Node *n;
7362 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7363 n = alloc_instruction(ctx, OPCODE_UNIFORM_1UI64, 3);
7364 if (n) {
7365 n[1].i = location;
7366 ASSIGN_UINT64_TO_NODES(n, 2, x);
7367 }
7368 if (ctx->ExecuteFlag) {
7369 CALL_Uniform1ui64ARB(ctx->Exec, (location, x));
7370 }
7371 }
7372
7373 void GLAPIENTRY
save_Uniform2ui64ARB(GLint location,GLuint64 x,GLuint64 y)7374 save_Uniform2ui64ARB(GLint location, GLuint64 x, GLuint64 y)
7375 {
7376 GET_CURRENT_CONTEXT(ctx);
7377 Node *n;
7378 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7379 n = alloc_instruction(ctx, OPCODE_UNIFORM_2UI64, 5);
7380 if (n) {
7381 n[1].i = location;
7382 ASSIGN_UINT64_TO_NODES(n, 2, x);
7383 ASSIGN_UINT64_TO_NODES(n, 4, y);
7384 }
7385 if (ctx->ExecuteFlag) {
7386 CALL_Uniform2ui64ARB(ctx->Exec, (location, x, y));
7387 }
7388 }
7389
7390 void GLAPIENTRY
save_Uniform3ui64ARB(GLint location,GLuint64 x,GLuint64 y,GLuint64 z)7391 save_Uniform3ui64ARB(GLint location, GLuint64 x, GLuint64 y, GLuint64 z)
7392 {
7393 GET_CURRENT_CONTEXT(ctx);
7394 Node *n;
7395 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7396 n = alloc_instruction(ctx, OPCODE_UNIFORM_3UI64, 7);
7397 if (n) {
7398 n[1].i = location;
7399 ASSIGN_UINT64_TO_NODES(n, 2, x);
7400 ASSIGN_UINT64_TO_NODES(n, 4, y);
7401 ASSIGN_UINT64_TO_NODES(n, 6, z);
7402 }
7403 if (ctx->ExecuteFlag) {
7404 CALL_Uniform3ui64ARB(ctx->Exec, (location, x, y, z));
7405 }
7406 }
7407
7408 void GLAPIENTRY
save_Uniform4ui64ARB(GLint location,GLuint64 x,GLuint64 y,GLuint64 z,GLuint64 w)7409 save_Uniform4ui64ARB(GLint location, GLuint64 x, GLuint64 y, GLuint64 z, GLuint64 w)
7410 {
7411 GET_CURRENT_CONTEXT(ctx);
7412 Node *n;
7413 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7414 n = alloc_instruction(ctx, OPCODE_UNIFORM_4UI64, 9);
7415 if (n) {
7416 n[1].i = location;
7417 ASSIGN_UINT64_TO_NODES(n, 2, x);
7418 ASSIGN_UINT64_TO_NODES(n, 4, y);
7419 ASSIGN_UINT64_TO_NODES(n, 6, z);
7420 ASSIGN_UINT64_TO_NODES(n, 8, w);
7421 }
7422 if (ctx->ExecuteFlag) {
7423 CALL_Uniform4ui64ARB(ctx->Exec, (location, x, y, z, w));
7424 }
7425 }
7426
7427 void GLAPIENTRY
save_Uniform1ui64vARB(GLint location,GLsizei count,const GLuint64 * v)7428 save_Uniform1ui64vARB(GLint location, GLsizei count, const GLuint64 *v)
7429 {
7430 GET_CURRENT_CONTEXT(ctx);
7431 Node *n;
7432 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7433 n = alloc_instruction(ctx, OPCODE_UNIFORM_1UI64V, 2 + POINTER_DWORDS);
7434 if (n) {
7435 n[1].i = location;
7436 n[2].i = count;
7437 save_pointer(&n[3], memdup(v, count * 1 * sizeof(GLuint64)));
7438 }
7439 if (ctx->ExecuteFlag) {
7440 CALL_Uniform1ui64vARB(ctx->Exec, (location, count, v));
7441 }
7442 }
7443
7444 void GLAPIENTRY
save_Uniform2ui64vARB(GLint location,GLsizei count,const GLuint64 * v)7445 save_Uniform2ui64vARB(GLint location, GLsizei count, const GLuint64 *v)
7446 {
7447 GET_CURRENT_CONTEXT(ctx);
7448 Node *n;
7449 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7450 n = alloc_instruction(ctx, OPCODE_UNIFORM_2UI64V, 2 + POINTER_DWORDS);
7451 if (n) {
7452 n[1].i = location;
7453 n[2].i = count;
7454 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLuint64)));
7455 }
7456 if (ctx->ExecuteFlag) {
7457 CALL_Uniform2ui64vARB(ctx->Exec, (location, count, v));
7458 }
7459 }
7460
7461 void GLAPIENTRY
save_Uniform3ui64vARB(GLint location,GLsizei count,const GLuint64 * v)7462 save_Uniform3ui64vARB(GLint location, GLsizei count, const GLuint64 *v)
7463 {
7464 GET_CURRENT_CONTEXT(ctx);
7465 Node *n;
7466 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7467 n = alloc_instruction(ctx, OPCODE_UNIFORM_3UI64V, 2 + POINTER_DWORDS);
7468 if (n) {
7469 n[1].i = location;
7470 n[2].i = count;
7471 save_pointer(&n[3], memdup(v, count * 3 * sizeof(GLuint64)));
7472 }
7473 if (ctx->ExecuteFlag) {
7474 CALL_Uniform3ui64vARB(ctx->Exec, (location, count, v));
7475 }
7476 }
7477
7478 void GLAPIENTRY
save_Uniform4ui64vARB(GLint location,GLsizei count,const GLuint64 * v)7479 save_Uniform4ui64vARB(GLint location, GLsizei count, const GLuint64 *v)
7480 {
7481 GET_CURRENT_CONTEXT(ctx);
7482 Node *n;
7483 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7484 n = alloc_instruction(ctx, OPCODE_UNIFORM_4UI64V, 2 + POINTER_DWORDS);
7485 if (n) {
7486 n[1].i = location;
7487 n[2].i = count;
7488 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLuint64)));
7489 }
7490 if (ctx->ExecuteFlag) {
7491 CALL_Uniform4ui64vARB(ctx->Exec, (location, count, v));
7492 }
7493 }
7494
7495 void GLAPIENTRY
save_ProgramUniform1i64ARB(GLuint program,GLint location,GLint64 x)7496 save_ProgramUniform1i64ARB(GLuint program, GLint location, GLint64 x)
7497 {
7498 GET_CURRENT_CONTEXT(ctx);
7499 Node *n;
7500 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7501 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1I64, 4);
7502 if (n) {
7503 n[1].ui = program;
7504 n[2].i = location;
7505 ASSIGN_INT64_TO_NODES(n, 3, x);
7506 }
7507 if (ctx->ExecuteFlag) {
7508 CALL_ProgramUniform1i64ARB(ctx->Exec, (program, location, x));
7509 }
7510 }
7511
7512 void GLAPIENTRY
save_ProgramUniform2i64ARB(GLuint program,GLint location,GLint64 x,GLint64 y)7513 save_ProgramUniform2i64ARB(GLuint program, GLint location, GLint64 x,
7514 GLint64 y)
7515 {
7516 GET_CURRENT_CONTEXT(ctx);
7517 Node *n;
7518 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7519 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2I64, 6);
7520 if (n) {
7521 n[1].ui = program;
7522 n[2].i = location;
7523 ASSIGN_INT64_TO_NODES(n, 3, x);
7524 ASSIGN_INT64_TO_NODES(n, 5, y);
7525 }
7526 if (ctx->ExecuteFlag) {
7527 CALL_ProgramUniform2i64ARB(ctx->Exec, (program, location, x, y));
7528 }
7529 }
7530
7531 void GLAPIENTRY
save_ProgramUniform3i64ARB(GLuint program,GLint location,GLint64 x,GLint64 y,GLint64 z)7532 save_ProgramUniform3i64ARB(GLuint program, GLint location, GLint64 x,
7533 GLint64 y, GLint64 z)
7534 {
7535 GET_CURRENT_CONTEXT(ctx);
7536 Node *n;
7537 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7538 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3I64, 8);
7539 if (n) {
7540 n[1].ui = program;
7541 n[2].i = location;
7542 ASSIGN_INT64_TO_NODES(n, 3, x);
7543 ASSIGN_INT64_TO_NODES(n, 5, y);
7544 ASSIGN_INT64_TO_NODES(n, 7, z);
7545 }
7546 if (ctx->ExecuteFlag) {
7547 CALL_ProgramUniform3i64ARB(ctx->Exec, (program, location, x, y, z));
7548 }
7549 }
7550
7551 void GLAPIENTRY
save_ProgramUniform4i64ARB(GLuint program,GLint location,GLint64 x,GLint64 y,GLint64 z,GLint64 w)7552 save_ProgramUniform4i64ARB(GLuint program, GLint location, GLint64 x,
7553 GLint64 y, GLint64 z, GLint64 w)
7554 {
7555 GET_CURRENT_CONTEXT(ctx);
7556 Node *n;
7557 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7558 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4I64, 10);
7559 if (n) {
7560 n[1].ui = program;
7561 n[2].i = location;
7562 ASSIGN_INT64_TO_NODES(n, 3, x);
7563 ASSIGN_INT64_TO_NODES(n, 5, y);
7564 ASSIGN_INT64_TO_NODES(n, 7, z);
7565 ASSIGN_INT64_TO_NODES(n, 9, w);
7566 }
7567 if (ctx->ExecuteFlag) {
7568 CALL_ProgramUniform4i64ARB(ctx->Exec, (program, location, x, y, z, w));
7569 }
7570 }
7571
7572 void GLAPIENTRY
save_ProgramUniform1i64vARB(GLuint program,GLint location,GLsizei count,const GLint64 * v)7573 save_ProgramUniform1i64vARB(GLuint program, GLint location, GLsizei count,
7574 const GLint64 *v)
7575 {
7576 GET_CURRENT_CONTEXT(ctx);
7577 Node *n;
7578 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7579 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1I64V, 3 + POINTER_DWORDS);
7580 if (n) {
7581 n[1].ui = program;
7582 n[2].i = location;
7583 n[3].i = count;
7584 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLint64)));
7585 }
7586 if (ctx->ExecuteFlag) {
7587 CALL_ProgramUniform1i64vARB(ctx->Exec, (program, location, count, v));
7588 }
7589 }
7590
7591 void GLAPIENTRY
save_ProgramUniform2i64vARB(GLuint program,GLint location,GLsizei count,const GLint64 * v)7592 save_ProgramUniform2i64vARB(GLuint program, GLint location, GLsizei count,
7593 const GLint64 *v)
7594 {
7595 GET_CURRENT_CONTEXT(ctx);
7596 Node *n;
7597 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7598 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2I64V, 3 + POINTER_DWORDS);
7599 if (n) {
7600 n[1].ui = program;
7601 n[2].i = location;
7602 n[3].i = count;
7603 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLint64)));
7604 }
7605 if (ctx->ExecuteFlag) {
7606 CALL_ProgramUniform2i64vARB(ctx->Exec, (program, location, count, v));
7607 }
7608 }
7609
7610 void GLAPIENTRY
save_ProgramUniform3i64vARB(GLuint program,GLint location,GLsizei count,const GLint64 * v)7611 save_ProgramUniform3i64vARB(GLuint program, GLint location, GLsizei count,
7612 const GLint64 *v)
7613 {
7614 GET_CURRENT_CONTEXT(ctx);
7615 Node *n;
7616 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7617 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3I64V, 3 + POINTER_DWORDS);
7618 if (n) {
7619 n[1].ui = program;
7620 n[2].i = location;
7621 n[3].i = count;
7622 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLint64)));
7623 }
7624 if (ctx->ExecuteFlag) {
7625 CALL_ProgramUniform3i64vARB(ctx->Exec, (program, location, count, v));
7626 }
7627 }
7628
7629 void GLAPIENTRY
save_ProgramUniform4i64vARB(GLuint program,GLint location,GLsizei count,const GLint64 * v)7630 save_ProgramUniform4i64vARB(GLuint program, GLint location, GLsizei count,
7631 const GLint64 *v)
7632 {
7633 GET_CURRENT_CONTEXT(ctx);
7634 Node *n;
7635 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7636 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4I64V, 3 + POINTER_DWORDS);
7637 if (n) {
7638 n[1].ui = program;
7639 n[2].i = location;
7640 n[3].i = count;
7641 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLint64)));
7642 }
7643 if (ctx->ExecuteFlag) {
7644 CALL_ProgramUniform4i64vARB(ctx->Exec, (program, location, count, v));
7645 }
7646 }
7647
7648 void GLAPIENTRY
save_ProgramUniform1ui64ARB(GLuint program,GLint location,GLuint64 x)7649 save_ProgramUniform1ui64ARB(GLuint program, GLint location, GLuint64 x)
7650 {
7651 GET_CURRENT_CONTEXT(ctx);
7652 Node *n;
7653 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7654 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1UI64, 4);
7655 if (n) {
7656 n[1].ui = program;
7657 n[2].i = location;
7658 ASSIGN_UINT64_TO_NODES(n, 3, x);
7659 }
7660 if (ctx->ExecuteFlag) {
7661 CALL_ProgramUniform1ui64ARB(ctx->Exec, (program, location, x));
7662 }
7663 }
7664
7665 void GLAPIENTRY
save_ProgramUniform2ui64ARB(GLuint program,GLint location,GLuint64 x,GLuint64 y)7666 save_ProgramUniform2ui64ARB(GLuint program, GLint location, GLuint64 x,
7667 GLuint64 y)
7668 {
7669 GET_CURRENT_CONTEXT(ctx);
7670 Node *n;
7671 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7672 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2UI64, 6);
7673 if (n) {
7674 n[1].ui = program;
7675 n[2].i = location;
7676 ASSIGN_UINT64_TO_NODES(n, 3, x);
7677 ASSIGN_UINT64_TO_NODES(n, 5, y);
7678 }
7679 if (ctx->ExecuteFlag) {
7680 CALL_ProgramUniform2ui64ARB(ctx->Exec, (program, location, x, y));
7681 }
7682 }
7683
7684 void GLAPIENTRY
save_ProgramUniform3ui64ARB(GLuint program,GLint location,GLuint64 x,GLuint64 y,GLuint64 z)7685 save_ProgramUniform3ui64ARB(GLuint program, GLint location, GLuint64 x,
7686 GLuint64 y, GLuint64 z)
7687 {
7688 GET_CURRENT_CONTEXT(ctx);
7689 Node *n;
7690 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7691 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3UI64, 8);
7692 if (n) {
7693 n[1].ui = program;
7694 n[2].i = location;
7695 ASSIGN_UINT64_TO_NODES(n, 3, x);
7696 ASSIGN_UINT64_TO_NODES(n, 5, y);
7697 ASSIGN_UINT64_TO_NODES(n, 7, z);
7698 }
7699 if (ctx->ExecuteFlag) {
7700 CALL_ProgramUniform3ui64ARB(ctx->Exec, (program, location, x, y, z));
7701 }
7702 }
7703
7704 void GLAPIENTRY
save_ProgramUniform4ui64ARB(GLuint program,GLint location,GLuint64 x,GLuint64 y,GLuint64 z,GLuint64 w)7705 save_ProgramUniform4ui64ARB(GLuint program, GLint location, GLuint64 x,
7706 GLuint64 y, GLuint64 z, GLuint64 w)
7707 {
7708 GET_CURRENT_CONTEXT(ctx);
7709 Node *n;
7710 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7711 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4UI64, 10);
7712 if (n) {
7713 n[1].ui = program;
7714 n[2].i = location;
7715 ASSIGN_UINT64_TO_NODES(n, 3, x);
7716 ASSIGN_UINT64_TO_NODES(n, 5, y);
7717 ASSIGN_UINT64_TO_NODES(n, 7, z);
7718 ASSIGN_UINT64_TO_NODES(n, 9, w);
7719 }
7720 if (ctx->ExecuteFlag) {
7721 CALL_ProgramUniform4i64ARB(ctx->Exec, (program, location, x, y, z, w));
7722 }
7723 }
7724
7725 void GLAPIENTRY
save_ProgramUniform1ui64vARB(GLuint program,GLint location,GLsizei count,const GLuint64 * v)7726 save_ProgramUniform1ui64vARB(GLuint program, GLint location, GLsizei count,
7727 const GLuint64 *v)
7728 {
7729 GET_CURRENT_CONTEXT(ctx);
7730 Node *n;
7731 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7732 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1UI64V,
7733 3 + POINTER_DWORDS);
7734 if (n) {
7735 n[1].ui = program;
7736 n[2].i = location;
7737 n[3].i = count;
7738 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLuint64)));
7739 }
7740 if (ctx->ExecuteFlag) {
7741 CALL_ProgramUniform1ui64vARB(ctx->Exec, (program, location, count, v));
7742 }
7743 }
7744
7745 void GLAPIENTRY
save_ProgramUniform2ui64vARB(GLuint program,GLint location,GLsizei count,const GLuint64 * v)7746 save_ProgramUniform2ui64vARB(GLuint program, GLint location, GLsizei count,
7747 const GLuint64 *v)
7748 {
7749 GET_CURRENT_CONTEXT(ctx);
7750 Node *n;
7751 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7752 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2UI64V,
7753 3 + POINTER_DWORDS);
7754 if (n) {
7755 n[1].ui = program;
7756 n[2].i = location;
7757 n[3].i = count;
7758 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLuint64)));
7759 }
7760 if (ctx->ExecuteFlag) {
7761 CALL_ProgramUniform2ui64vARB(ctx->Exec, (program, location, count, v));
7762 }
7763 }
7764
7765 void GLAPIENTRY
save_ProgramUniform3ui64vARB(GLuint program,GLint location,GLsizei count,const GLuint64 * v)7766 save_ProgramUniform3ui64vARB(GLuint program, GLint location, GLsizei count,
7767 const GLuint64 *v)
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_3UI64V,
7773 3 + POINTER_DWORDS);
7774 if (n) {
7775 n[1].ui = program;
7776 n[2].i = location;
7777 n[3].i = count;
7778 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLuint64)));
7779 }
7780 if (ctx->ExecuteFlag) {
7781 CALL_ProgramUniform3ui64vARB(ctx->Exec, (program, location, count, v));
7782 }
7783 }
7784
7785 void GLAPIENTRY
save_ProgramUniform4ui64vARB(GLuint program,GLint location,GLsizei count,const GLuint64 * v)7786 save_ProgramUniform4ui64vARB(GLuint program, GLint location, GLsizei count,
7787 const GLuint64 *v)
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_4UI64V,
7793 3 + POINTER_DWORDS);
7794 if (n) {
7795 n[1].ui = program;
7796 n[2].i = location;
7797 n[3].i = count;
7798 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLuint64)));
7799 }
7800 if (ctx->ExecuteFlag) {
7801 CALL_ProgramUniform4ui64vARB(ctx->Exec, (program, location, count, v));
7802 }
7803 }
7804
7805
7806 void GLAPIENTRY
save_UseProgramStages(GLuint pipeline,GLbitfield stages,GLuint program)7807 save_UseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program)
7808 {
7809 GET_CURRENT_CONTEXT(ctx);
7810 Node *n;
7811 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7812 n = alloc_instruction(ctx, OPCODE_USE_PROGRAM_STAGES, 3);
7813 if (n) {
7814 n[1].ui = pipeline;
7815 n[2].ui = stages;
7816 n[3].ui = program;
7817 }
7818 if (ctx->ExecuteFlag) {
7819 CALL_UseProgramStages(ctx->Exec, (pipeline, stages, program));
7820 }
7821 }
7822
7823 void GLAPIENTRY
save_ProgramUniform1f(GLuint program,GLint location,GLfloat x)7824 save_ProgramUniform1f(GLuint program, GLint location, GLfloat x)
7825 {
7826 GET_CURRENT_CONTEXT(ctx);
7827 Node *n;
7828 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7829 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1F, 3);
7830 if (n) {
7831 n[1].ui = program;
7832 n[2].i = location;
7833 n[3].f = x;
7834 }
7835 if (ctx->ExecuteFlag) {
7836 CALL_ProgramUniform1f(ctx->Exec, (program, location, x));
7837 }
7838 }
7839
7840 void GLAPIENTRY
save_ProgramUniform2f(GLuint program,GLint location,GLfloat x,GLfloat y)7841 save_ProgramUniform2f(GLuint program, GLint location, GLfloat x, GLfloat y)
7842 {
7843 GET_CURRENT_CONTEXT(ctx);
7844 Node *n;
7845 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7846 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2F, 4);
7847 if (n) {
7848 n[1].ui = program;
7849 n[2].i = location;
7850 n[3].f = x;
7851 n[4].f = y;
7852 }
7853 if (ctx->ExecuteFlag) {
7854 CALL_ProgramUniform2f(ctx->Exec, (program, location, x, y));
7855 }
7856 }
7857
7858 void GLAPIENTRY
save_ProgramUniform3f(GLuint program,GLint location,GLfloat x,GLfloat y,GLfloat z)7859 save_ProgramUniform3f(GLuint program, GLint location,
7860 GLfloat x, GLfloat y, GLfloat z)
7861 {
7862 GET_CURRENT_CONTEXT(ctx);
7863 Node *n;
7864 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7865 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3F, 5);
7866 if (n) {
7867 n[1].ui = program;
7868 n[2].i = location;
7869 n[3].f = x;
7870 n[4].f = y;
7871 n[5].f = z;
7872 }
7873 if (ctx->ExecuteFlag) {
7874 CALL_ProgramUniform3f(ctx->Exec, (program, location, x, y, z));
7875 }
7876 }
7877
7878 void GLAPIENTRY
save_ProgramUniform4f(GLuint program,GLint location,GLfloat x,GLfloat y,GLfloat z,GLfloat w)7879 save_ProgramUniform4f(GLuint program, GLint location,
7880 GLfloat x, GLfloat y, GLfloat z, GLfloat w)
7881 {
7882 GET_CURRENT_CONTEXT(ctx);
7883 Node *n;
7884 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7885 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4F, 6);
7886 if (n) {
7887 n[1].ui = program;
7888 n[2].i = location;
7889 n[3].f = x;
7890 n[4].f = y;
7891 n[5].f = z;
7892 n[6].f = w;
7893 }
7894 if (ctx->ExecuteFlag) {
7895 CALL_ProgramUniform4f(ctx->Exec, (program, location, x, y, z, w));
7896 }
7897 }
7898
7899 void GLAPIENTRY
save_ProgramUniform1fv(GLuint program,GLint location,GLsizei count,const GLfloat * v)7900 save_ProgramUniform1fv(GLuint program, GLint location, GLsizei count,
7901 const GLfloat *v)
7902 {
7903 GET_CURRENT_CONTEXT(ctx);
7904 Node *n;
7905 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7906 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1FV, 3 + POINTER_DWORDS);
7907 if (n) {
7908 n[1].ui = program;
7909 n[2].i = location;
7910 n[3].i = count;
7911 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLfloat)));
7912 }
7913 if (ctx->ExecuteFlag) {
7914 CALL_ProgramUniform1fv(ctx->Exec, (program, location, count, v));
7915 }
7916 }
7917
7918 void GLAPIENTRY
save_ProgramUniform2fv(GLuint program,GLint location,GLsizei count,const GLfloat * v)7919 save_ProgramUniform2fv(GLuint program, GLint location, GLsizei count,
7920 const GLfloat *v)
7921 {
7922 GET_CURRENT_CONTEXT(ctx);
7923 Node *n;
7924 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7925 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2FV, 3 + POINTER_DWORDS);
7926 if (n) {
7927 n[1].ui = program;
7928 n[2].i = location;
7929 n[3].i = count;
7930 save_pointer(&n[4], memdup(v, count * 2 * sizeof(GLfloat)));
7931 }
7932 if (ctx->ExecuteFlag) {
7933 CALL_ProgramUniform2fv(ctx->Exec, (program, location, count, v));
7934 }
7935 }
7936
7937 void GLAPIENTRY
save_ProgramUniform3fv(GLuint program,GLint location,GLsizei count,const GLfloat * v)7938 save_ProgramUniform3fv(GLuint program, GLint location, GLsizei count,
7939 const GLfloat *v)
7940 {
7941 GET_CURRENT_CONTEXT(ctx);
7942 Node *n;
7943 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7944 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3FV, 3 + POINTER_DWORDS);
7945 if (n) {
7946 n[1].ui = program;
7947 n[2].i = location;
7948 n[3].i = count;
7949 save_pointer(&n[4], memdup(v, count * 3 * sizeof(GLfloat)));
7950 }
7951 if (ctx->ExecuteFlag) {
7952 CALL_ProgramUniform3fv(ctx->Exec, (program, location, count, v));
7953 }
7954 }
7955
7956 void GLAPIENTRY
save_ProgramUniform4fv(GLuint program,GLint location,GLsizei count,const GLfloat * v)7957 save_ProgramUniform4fv(GLuint program, GLint location, GLsizei count,
7958 const GLfloat *v)
7959 {
7960 GET_CURRENT_CONTEXT(ctx);
7961 Node *n;
7962 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7963 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4FV, 3 + POINTER_DWORDS);
7964 if (n) {
7965 n[1].ui = program;
7966 n[2].i = location;
7967 n[3].i = count;
7968 save_pointer(&n[4], memdup(v, count * 4 * sizeof(GLfloat)));
7969 }
7970 if (ctx->ExecuteFlag) {
7971 CALL_ProgramUniform4fv(ctx->Exec, (program, location, count, v));
7972 }
7973 }
7974
7975 void GLAPIENTRY
save_ProgramUniform1d(GLuint program,GLint location,GLdouble x)7976 save_ProgramUniform1d(GLuint program, GLint location, GLdouble x)
7977 {
7978 GET_CURRENT_CONTEXT(ctx);
7979 Node *n;
7980 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7981 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1D, 4);
7982 if (n) {
7983 n[1].ui = program;
7984 n[2].i = location;
7985 ASSIGN_DOUBLE_TO_NODES(n, 3, x);
7986 }
7987 if (ctx->ExecuteFlag) {
7988 CALL_ProgramUniform1d(ctx->Exec, (program, location, x));
7989 }
7990 }
7991
7992 void GLAPIENTRY
save_ProgramUniform2d(GLuint program,GLint location,GLdouble x,GLdouble y)7993 save_ProgramUniform2d(GLuint program, GLint location, GLdouble x, GLdouble y)
7994 {
7995 GET_CURRENT_CONTEXT(ctx);
7996 Node *n;
7997 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7998 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2D, 6);
7999 if (n) {
8000 n[1].ui = program;
8001 n[2].i = location;
8002 ASSIGN_DOUBLE_TO_NODES(n, 3, x);
8003 ASSIGN_DOUBLE_TO_NODES(n, 5, y);
8004 }
8005 if (ctx->ExecuteFlag) {
8006 CALL_ProgramUniform2d(ctx->Exec, (program, location, x, y));
8007 }
8008 }
8009
8010 void GLAPIENTRY
save_ProgramUniform3d(GLuint program,GLint location,GLdouble x,GLdouble y,GLdouble z)8011 save_ProgramUniform3d(GLuint program, GLint location,
8012 GLdouble x, GLdouble y, GLdouble z)
8013 {
8014 GET_CURRENT_CONTEXT(ctx);
8015 Node *n;
8016 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8017 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3D, 8);
8018 if (n) {
8019 n[1].ui = program;
8020 n[2].i = location;
8021 ASSIGN_DOUBLE_TO_NODES(n, 3, x);
8022 ASSIGN_DOUBLE_TO_NODES(n, 5, y);
8023 ASSIGN_DOUBLE_TO_NODES(n, 7, z);
8024 }
8025 if (ctx->ExecuteFlag) {
8026 CALL_ProgramUniform3d(ctx->Exec, (program, location, x, y, z));
8027 }
8028 }
8029
8030 void GLAPIENTRY
save_ProgramUniform4d(GLuint program,GLint location,GLdouble x,GLdouble y,GLdouble z,GLdouble w)8031 save_ProgramUniform4d(GLuint program, GLint location,
8032 GLdouble x, GLdouble y, GLdouble z, GLdouble w)
8033 {
8034 GET_CURRENT_CONTEXT(ctx);
8035 Node *n;
8036 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8037 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4D, 10);
8038 if (n) {
8039 n[1].ui = program;
8040 n[2].i = location;
8041 ASSIGN_DOUBLE_TO_NODES(n, 3, x);
8042 ASSIGN_DOUBLE_TO_NODES(n, 5, y);
8043 ASSIGN_DOUBLE_TO_NODES(n, 7, z);
8044 ASSIGN_DOUBLE_TO_NODES(n, 9, w);
8045 }
8046 if (ctx->ExecuteFlag) {
8047 CALL_ProgramUniform4d(ctx->Exec, (program, location, x, y, z, w));
8048 }
8049 }
8050
8051 void GLAPIENTRY
save_ProgramUniform1dv(GLuint program,GLint location,GLsizei count,const GLdouble * v)8052 save_ProgramUniform1dv(GLuint program, GLint location, GLsizei count,
8053 const GLdouble *v)
8054 {
8055 GET_CURRENT_CONTEXT(ctx);
8056 Node *n;
8057 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8058 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1DV, 3 + POINTER_DWORDS);
8059 if (n) {
8060 n[1].ui = program;
8061 n[2].i = location;
8062 n[3].i = count;
8063 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLdouble)));
8064 }
8065 if (ctx->ExecuteFlag) {
8066 CALL_ProgramUniform1dv(ctx->Exec, (program, location, count, v));
8067 }
8068 }
8069
8070 void GLAPIENTRY
save_ProgramUniform2dv(GLuint program,GLint location,GLsizei count,const GLdouble * v)8071 save_ProgramUniform2dv(GLuint program, GLint location, GLsizei count,
8072 const GLdouble *v)
8073 {
8074 GET_CURRENT_CONTEXT(ctx);
8075 Node *n;
8076 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8077 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2DV, 3 + POINTER_DWORDS);
8078 if (n) {
8079 n[1].ui = program;
8080 n[2].i = location;
8081 n[3].i = count;
8082 save_pointer(&n[4], memdup(v, count * 2 * sizeof(GLdouble)));
8083 }
8084 if (ctx->ExecuteFlag) {
8085 CALL_ProgramUniform2dv(ctx->Exec, (program, location, count, v));
8086 }
8087 }
8088
8089 void GLAPIENTRY
save_ProgramUniform3dv(GLuint program,GLint location,GLsizei count,const GLdouble * v)8090 save_ProgramUniform3dv(GLuint program, GLint location, GLsizei count,
8091 const GLdouble *v)
8092 {
8093 GET_CURRENT_CONTEXT(ctx);
8094 Node *n;
8095 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8096 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3DV, 3 + POINTER_DWORDS);
8097 if (n) {
8098 n[1].ui = program;
8099 n[2].i = location;
8100 n[3].i = count;
8101 save_pointer(&n[4], memdup(v, count * 3 * sizeof(GLdouble)));
8102 }
8103 if (ctx->ExecuteFlag) {
8104 CALL_ProgramUniform3dv(ctx->Exec, (program, location, count, v));
8105 }
8106 }
8107
8108 void GLAPIENTRY
save_ProgramUniform4dv(GLuint program,GLint location,GLsizei count,const GLdouble * v)8109 save_ProgramUniform4dv(GLuint program, GLint location, GLsizei count,
8110 const GLdouble *v)
8111 {
8112 GET_CURRENT_CONTEXT(ctx);
8113 Node *n;
8114 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8115 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4DV, 3 + POINTER_DWORDS);
8116 if (n) {
8117 n[1].ui = program;
8118 n[2].i = location;
8119 n[3].i = count;
8120 save_pointer(&n[4], memdup(v, count * 4 * sizeof(GLdouble)));
8121 }
8122 if (ctx->ExecuteFlag) {
8123 CALL_ProgramUniform4dv(ctx->Exec, (program, location, count, v));
8124 }
8125 }
8126
8127 void GLAPIENTRY
save_ProgramUniform1i(GLuint program,GLint location,GLint x)8128 save_ProgramUniform1i(GLuint program, GLint location, GLint x)
8129 {
8130 GET_CURRENT_CONTEXT(ctx);
8131 Node *n;
8132 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8133 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1I, 3);
8134 if (n) {
8135 n[1].ui = program;
8136 n[2].i = location;
8137 n[3].i = x;
8138 }
8139 if (ctx->ExecuteFlag) {
8140 CALL_ProgramUniform1i(ctx->Exec, (program, location, x));
8141 }
8142 }
8143
8144 void GLAPIENTRY
save_ProgramUniform2i(GLuint program,GLint location,GLint x,GLint y)8145 save_ProgramUniform2i(GLuint program, GLint location, GLint x, GLint y)
8146 {
8147 GET_CURRENT_CONTEXT(ctx);
8148 Node *n;
8149 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8150 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2I, 4);
8151 if (n) {
8152 n[1].ui = program;
8153 n[2].i = location;
8154 n[3].i = x;
8155 n[4].i = y;
8156 }
8157 if (ctx->ExecuteFlag) {
8158 CALL_ProgramUniform2i(ctx->Exec, (program, location, x, y));
8159 }
8160 }
8161
8162 void GLAPIENTRY
save_ProgramUniform3i(GLuint program,GLint location,GLint x,GLint y,GLint z)8163 save_ProgramUniform3i(GLuint program, GLint location,
8164 GLint x, GLint y, GLint z)
8165 {
8166 GET_CURRENT_CONTEXT(ctx);
8167 Node *n;
8168 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8169 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3I, 5);
8170 if (n) {
8171 n[1].ui = program;
8172 n[2].i = location;
8173 n[3].i = x;
8174 n[4].i = y;
8175 n[5].i = z;
8176 }
8177 if (ctx->ExecuteFlag) {
8178 CALL_ProgramUniform3i(ctx->Exec, (program, location, x, y, z));
8179 }
8180 }
8181
8182 void GLAPIENTRY
save_ProgramUniform4i(GLuint program,GLint location,GLint x,GLint y,GLint z,GLint w)8183 save_ProgramUniform4i(GLuint program, GLint location,
8184 GLint x, GLint y, GLint z, GLint w)
8185 {
8186 GET_CURRENT_CONTEXT(ctx);
8187 Node *n;
8188 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8189 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4I, 6);
8190 if (n) {
8191 n[1].ui = program;
8192 n[2].i = location;
8193 n[3].i = x;
8194 n[4].i = y;
8195 n[5].i = z;
8196 n[6].i = w;
8197 }
8198 if (ctx->ExecuteFlag) {
8199 CALL_ProgramUniform4i(ctx->Exec, (program, location, x, y, z, w));
8200 }
8201 }
8202
8203 void GLAPIENTRY
save_ProgramUniform1iv(GLuint program,GLint location,GLsizei count,const GLint * v)8204 save_ProgramUniform1iv(GLuint program, GLint location, GLsizei count,
8205 const GLint *v)
8206 {
8207 GET_CURRENT_CONTEXT(ctx);
8208 Node *n;
8209 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8210 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1IV, 3 + POINTER_DWORDS);
8211 if (n) {
8212 n[1].ui = program;
8213 n[2].i = location;
8214 n[3].i = count;
8215 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLint)));
8216 }
8217 if (ctx->ExecuteFlag) {
8218 CALL_ProgramUniform1iv(ctx->Exec, (program, location, count, v));
8219 }
8220 }
8221
8222 void GLAPIENTRY
save_ProgramUniform2iv(GLuint program,GLint location,GLsizei count,const GLint * v)8223 save_ProgramUniform2iv(GLuint program, GLint location, GLsizei count,
8224 const GLint *v)
8225 {
8226 GET_CURRENT_CONTEXT(ctx);
8227 Node *n;
8228 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8229 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2IV, 3 + POINTER_DWORDS);
8230 if (n) {
8231 n[1].ui = program;
8232 n[2].i = location;
8233 n[3].i = count;
8234 save_pointer(&n[4], memdup(v, count * 2 * sizeof(GLint)));
8235 }
8236 if (ctx->ExecuteFlag) {
8237 CALL_ProgramUniform2iv(ctx->Exec, (program, location, count, v));
8238 }
8239 }
8240
8241 void GLAPIENTRY
save_ProgramUniform3iv(GLuint program,GLint location,GLsizei count,const GLint * v)8242 save_ProgramUniform3iv(GLuint program, GLint location, GLsizei count,
8243 const GLint *v)
8244 {
8245 GET_CURRENT_CONTEXT(ctx);
8246 Node *n;
8247 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8248 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3IV, 3 + POINTER_DWORDS);
8249 if (n) {
8250 n[1].ui = program;
8251 n[2].i = location;
8252 n[3].i = count;
8253 save_pointer(&n[4], memdup(v, count * 3 * sizeof(GLint)));
8254 }
8255 if (ctx->ExecuteFlag) {
8256 CALL_ProgramUniform3iv(ctx->Exec, (program, location, count, v));
8257 }
8258 }
8259
8260 void GLAPIENTRY
save_ProgramUniform4iv(GLuint program,GLint location,GLsizei count,const GLint * v)8261 save_ProgramUniform4iv(GLuint program, GLint location, GLsizei count,
8262 const GLint *v)
8263 {
8264 GET_CURRENT_CONTEXT(ctx);
8265 Node *n;
8266 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8267 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4IV, 3 + POINTER_DWORDS);
8268 if (n) {
8269 n[1].ui = program;
8270 n[2].i = location;
8271 n[3].i = count;
8272 save_pointer(&n[4], memdup(v, count * 4 * sizeof(GLint)));
8273 }
8274 if (ctx->ExecuteFlag) {
8275 CALL_ProgramUniform4iv(ctx->Exec, (program, location, count, v));
8276 }
8277 }
8278
8279 void GLAPIENTRY
save_ProgramUniform1ui(GLuint program,GLint location,GLuint x)8280 save_ProgramUniform1ui(GLuint program, GLint location, GLuint x)
8281 {
8282 GET_CURRENT_CONTEXT(ctx);
8283 Node *n;
8284 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8285 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1UI, 3);
8286 if (n) {
8287 n[1].ui = program;
8288 n[2].i = location;
8289 n[3].ui = x;
8290 }
8291 if (ctx->ExecuteFlag) {
8292 CALL_ProgramUniform1ui(ctx->Exec, (program, location, x));
8293 }
8294 }
8295
8296 void GLAPIENTRY
save_ProgramUniform2ui(GLuint program,GLint location,GLuint x,GLuint y)8297 save_ProgramUniform2ui(GLuint program, GLint location, GLuint x, GLuint y)
8298 {
8299 GET_CURRENT_CONTEXT(ctx);
8300 Node *n;
8301 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8302 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2UI, 4);
8303 if (n) {
8304 n[1].ui = program;
8305 n[2].i = location;
8306 n[3].ui = x;
8307 n[4].ui = y;
8308 }
8309 if (ctx->ExecuteFlag) {
8310 CALL_ProgramUniform2ui(ctx->Exec, (program, location, x, y));
8311 }
8312 }
8313
8314 void GLAPIENTRY
save_ProgramUniform3ui(GLuint program,GLint location,GLuint x,GLuint y,GLuint z)8315 save_ProgramUniform3ui(GLuint program, GLint location,
8316 GLuint x, GLuint y, GLuint z)
8317 {
8318 GET_CURRENT_CONTEXT(ctx);
8319 Node *n;
8320 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8321 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3UI, 5);
8322 if (n) {
8323 n[1].ui = program;
8324 n[2].i = location;
8325 n[3].ui = x;
8326 n[4].ui = y;
8327 n[5].ui = z;
8328 }
8329 if (ctx->ExecuteFlag) {
8330 CALL_ProgramUniform3ui(ctx->Exec, (program, location, x, y, z));
8331 }
8332 }
8333
8334 void GLAPIENTRY
save_ProgramUniform4ui(GLuint program,GLint location,GLuint x,GLuint y,GLuint z,GLuint w)8335 save_ProgramUniform4ui(GLuint program, GLint location,
8336 GLuint x, GLuint y, GLuint z, GLuint w)
8337 {
8338 GET_CURRENT_CONTEXT(ctx);
8339 Node *n;
8340 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8341 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4UI, 6);
8342 if (n) {
8343 n[1].ui = program;
8344 n[2].i = location;
8345 n[3].ui = x;
8346 n[4].ui = y;
8347 n[5].ui = z;
8348 n[6].ui = w;
8349 }
8350 if (ctx->ExecuteFlag) {
8351 CALL_ProgramUniform4ui(ctx->Exec, (program, location, x, y, z, w));
8352 }
8353 }
8354
8355 void GLAPIENTRY
save_ProgramUniform1uiv(GLuint program,GLint location,GLsizei count,const GLuint * v)8356 save_ProgramUniform1uiv(GLuint program, GLint location, GLsizei count,
8357 const GLuint *v)
8358 {
8359 GET_CURRENT_CONTEXT(ctx);
8360 Node *n;
8361 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8362 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1UIV, 3 + POINTER_DWORDS);
8363 if (n) {
8364 n[1].ui = program;
8365 n[2].i = location;
8366 n[3].i = count;
8367 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLuint)));
8368 }
8369 if (ctx->ExecuteFlag) {
8370 CALL_ProgramUniform1uiv(ctx->Exec, (program, location, count, v));
8371 }
8372 }
8373
8374 void GLAPIENTRY
save_ProgramUniform2uiv(GLuint program,GLint location,GLsizei count,const GLuint * v)8375 save_ProgramUniform2uiv(GLuint program, GLint location, GLsizei count,
8376 const GLuint *v)
8377 {
8378 GET_CURRENT_CONTEXT(ctx);
8379 Node *n;
8380 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8381 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2UIV, 3 + POINTER_DWORDS);
8382 if (n) {
8383 n[1].ui = program;
8384 n[2].i = location;
8385 n[3].i = count;
8386 save_pointer(&n[4], memdup(v, count * 2 * sizeof(GLuint)));
8387 }
8388 if (ctx->ExecuteFlag) {
8389 CALL_ProgramUniform2uiv(ctx->Exec, (program, location, count, v));
8390 }
8391 }
8392
8393 void GLAPIENTRY
save_ProgramUniform3uiv(GLuint program,GLint location,GLsizei count,const GLuint * v)8394 save_ProgramUniform3uiv(GLuint program, GLint location, GLsizei count,
8395 const GLuint *v)
8396 {
8397 GET_CURRENT_CONTEXT(ctx);
8398 Node *n;
8399 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8400 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3UIV, 3 + POINTER_DWORDS);
8401 if (n) {
8402 n[1].ui = program;
8403 n[2].i = location;
8404 n[3].i = count;
8405 save_pointer(&n[4], memdup(v, count * 3 * sizeof(GLuint)));
8406 }
8407 if (ctx->ExecuteFlag) {
8408 CALL_ProgramUniform3uiv(ctx->Exec, (program, location, count, v));
8409 }
8410 }
8411
8412 void GLAPIENTRY
save_ProgramUniform4uiv(GLuint program,GLint location,GLsizei count,const GLuint * v)8413 save_ProgramUniform4uiv(GLuint program, GLint location, GLsizei count,
8414 const GLuint *v)
8415 {
8416 GET_CURRENT_CONTEXT(ctx);
8417 Node *n;
8418 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8419 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4UIV, 3 + POINTER_DWORDS);
8420 if (n) {
8421 n[1].ui = program;
8422 n[2].i = location;
8423 n[3].i = count;
8424 save_pointer(&n[4], memdup(v, count * 4 * sizeof(GLuint)));
8425 }
8426 if (ctx->ExecuteFlag) {
8427 CALL_ProgramUniform4uiv(ctx->Exec, (program, location, count, v));
8428 }
8429 }
8430
8431 void GLAPIENTRY
save_ProgramUniformMatrix2fv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * v)8432 save_ProgramUniformMatrix2fv(GLuint program, GLint location, GLsizei count,
8433 GLboolean transpose, const GLfloat *v)
8434 {
8435 GET_CURRENT_CONTEXT(ctx);
8436 Node *n;
8437 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8438 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX22F,
8439 4 + POINTER_DWORDS);
8440 if (n) {
8441 n[1].ui = program;
8442 n[2].i = location;
8443 n[3].i = count;
8444 n[4].b = transpose;
8445 save_pointer(&n[5], memdup(v, count * 2 * 2 * sizeof(GLfloat)));
8446 }
8447 if (ctx->ExecuteFlag) {
8448 CALL_ProgramUniformMatrix2fv(ctx->Exec,
8449 (program, location, count, transpose, v));
8450 }
8451 }
8452
8453 void GLAPIENTRY
save_ProgramUniformMatrix2x3fv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * v)8454 save_ProgramUniformMatrix2x3fv(GLuint program, GLint location, GLsizei count,
8455 GLboolean transpose, const GLfloat *v)
8456 {
8457 GET_CURRENT_CONTEXT(ctx);
8458 Node *n;
8459 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8460 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX23F,
8461 4 + POINTER_DWORDS);
8462 if (n) {
8463 n[1].ui = program;
8464 n[2].i = location;
8465 n[3].i = count;
8466 n[4].b = transpose;
8467 save_pointer(&n[5], memdup(v, count * 2 * 3 * sizeof(GLfloat)));
8468 }
8469 if (ctx->ExecuteFlag) {
8470 CALL_ProgramUniformMatrix2x3fv(ctx->Exec,
8471 (program, location, count, transpose, v));
8472 }
8473 }
8474
8475 void GLAPIENTRY
save_ProgramUniformMatrix2x4fv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * v)8476 save_ProgramUniformMatrix2x4fv(GLuint program, GLint location, GLsizei count,
8477 GLboolean transpose, const GLfloat *v)
8478 {
8479 GET_CURRENT_CONTEXT(ctx);
8480 Node *n;
8481 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8482 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX24F,
8483 4 + POINTER_DWORDS);
8484 if (n) {
8485 n[1].ui = program;
8486 n[2].i = location;
8487 n[3].i = count;
8488 n[4].b = transpose;
8489 save_pointer(&n[5], memdup(v, count * 2 * 4 * sizeof(GLfloat)));
8490 }
8491 if (ctx->ExecuteFlag) {
8492 CALL_ProgramUniformMatrix2x4fv(ctx->Exec,
8493 (program, location, count, transpose, v));
8494 }
8495 }
8496
8497 void GLAPIENTRY
save_ProgramUniformMatrix3x2fv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * v)8498 save_ProgramUniformMatrix3x2fv(GLuint program, GLint location, GLsizei count,
8499 GLboolean transpose, const GLfloat *v)
8500 {
8501 GET_CURRENT_CONTEXT(ctx);
8502 Node *n;
8503 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8504 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX32F,
8505 4 + POINTER_DWORDS);
8506 if (n) {
8507 n[1].ui = program;
8508 n[2].i = location;
8509 n[3].i = count;
8510 n[4].b = transpose;
8511 save_pointer(&n[5], memdup(v, count * 3 * 2 * sizeof(GLfloat)));
8512 }
8513 if (ctx->ExecuteFlag) {
8514 CALL_ProgramUniformMatrix3x2fv(ctx->Exec,
8515 (program, location, count, transpose, v));
8516 }
8517 }
8518
8519 void GLAPIENTRY
save_ProgramUniformMatrix3fv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * v)8520 save_ProgramUniformMatrix3fv(GLuint program, GLint location, GLsizei count,
8521 GLboolean transpose, const GLfloat *v)
8522 {
8523 GET_CURRENT_CONTEXT(ctx);
8524 Node *n;
8525 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8526 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX33F,
8527 4 + POINTER_DWORDS);
8528 if (n) {
8529 n[1].ui = program;
8530 n[2].i = location;
8531 n[3].i = count;
8532 n[4].b = transpose;
8533 save_pointer(&n[5], memdup(v, count * 3 * 3 * sizeof(GLfloat)));
8534 }
8535 if (ctx->ExecuteFlag) {
8536 CALL_ProgramUniformMatrix3fv(ctx->Exec,
8537 (program, location, count, transpose, v));
8538 }
8539 }
8540
8541 void GLAPIENTRY
save_ProgramUniformMatrix3x4fv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * v)8542 save_ProgramUniformMatrix3x4fv(GLuint program, GLint location, GLsizei count,
8543 GLboolean transpose, const GLfloat *v)
8544 {
8545 GET_CURRENT_CONTEXT(ctx);
8546 Node *n;
8547 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8548 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX34F,
8549 4 + POINTER_DWORDS);
8550 if (n) {
8551 n[1].ui = program;
8552 n[2].i = location;
8553 n[3].i = count;
8554 n[4].b = transpose;
8555 save_pointer(&n[5], memdup(v, count * 3 * 4 * sizeof(GLfloat)));
8556 }
8557 if (ctx->ExecuteFlag) {
8558 CALL_ProgramUniformMatrix3x4fv(ctx->Exec,
8559 (program, location, count, transpose, v));
8560 }
8561 }
8562
8563 void GLAPIENTRY
save_ProgramUniformMatrix4x2fv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * v)8564 save_ProgramUniformMatrix4x2fv(GLuint program, GLint location, GLsizei count,
8565 GLboolean transpose, const GLfloat *v)
8566 {
8567 GET_CURRENT_CONTEXT(ctx);
8568 Node *n;
8569 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8570 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX42F,
8571 4 + POINTER_DWORDS);
8572 if (n) {
8573 n[1].ui = program;
8574 n[2].i = location;
8575 n[3].i = count;
8576 n[4].b = transpose;
8577 save_pointer(&n[5], memdup(v, count * 4 * 2 * sizeof(GLfloat)));
8578 }
8579 if (ctx->ExecuteFlag) {
8580 CALL_ProgramUniformMatrix4x2fv(ctx->Exec,
8581 (program, location, count, transpose, v));
8582 }
8583 }
8584
8585 void GLAPIENTRY
save_ProgramUniformMatrix4x3fv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * v)8586 save_ProgramUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count,
8587 GLboolean transpose, const GLfloat *v)
8588 {
8589 GET_CURRENT_CONTEXT(ctx);
8590 Node *n;
8591 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8592 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX43F,
8593 4 + POINTER_DWORDS);
8594 if (n) {
8595 n[1].ui = program;
8596 n[2].i = location;
8597 n[3].i = count;
8598 n[4].b = transpose;
8599 save_pointer(&n[5], memdup(v, count * 4 * 3 * sizeof(GLfloat)));
8600 }
8601 if (ctx->ExecuteFlag) {
8602 CALL_ProgramUniformMatrix4x3fv(ctx->Exec,
8603 (program, location, count, transpose, v));
8604 }
8605 }
8606
8607 void GLAPIENTRY
save_ProgramUniformMatrix4fv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * v)8608 save_ProgramUniformMatrix4fv(GLuint program, GLint location, GLsizei count,
8609 GLboolean transpose, const GLfloat *v)
8610 {
8611 GET_CURRENT_CONTEXT(ctx);
8612 Node *n;
8613 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8614 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX44F,
8615 4 + POINTER_DWORDS);
8616 if (n) {
8617 n[1].ui = program;
8618 n[2].i = location;
8619 n[3].i = count;
8620 n[4].b = transpose;
8621 save_pointer(&n[5], memdup(v, count * 4 * 4 * sizeof(GLfloat)));
8622 }
8623 if (ctx->ExecuteFlag) {
8624 CALL_ProgramUniformMatrix4fv(ctx->Exec,
8625 (program, location, count, transpose, v));
8626 }
8627 }
8628
8629 void GLAPIENTRY
save_ProgramUniformMatrix2dv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLdouble * v)8630 save_ProgramUniformMatrix2dv(GLuint program, GLint location, GLsizei count,
8631 GLboolean transpose, const GLdouble *v)
8632 {
8633 GET_CURRENT_CONTEXT(ctx);
8634 Node *n;
8635 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8636 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX22D,
8637 4 + POINTER_DWORDS);
8638 if (n) {
8639 n[1].ui = program;
8640 n[2].i = location;
8641 n[3].i = count;
8642 n[4].b = transpose;
8643 save_pointer(&n[5], memdup(v, count * 2 * 2 * sizeof(GLdouble)));
8644 }
8645 if (ctx->ExecuteFlag) {
8646 CALL_ProgramUniformMatrix2dv(ctx->Exec,
8647 (program, location, count, transpose, v));
8648 }
8649 }
8650
8651 void GLAPIENTRY
save_ProgramUniformMatrix2x3dv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLdouble * v)8652 save_ProgramUniformMatrix2x3dv(GLuint program, GLint location, GLsizei count,
8653 GLboolean transpose, const GLdouble *v)
8654 {
8655 GET_CURRENT_CONTEXT(ctx);
8656 Node *n;
8657 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8658 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX23D,
8659 4 + POINTER_DWORDS);
8660 if (n) {
8661 n[1].ui = program;
8662 n[2].i = location;
8663 n[3].i = count;
8664 n[4].b = transpose;
8665 save_pointer(&n[5], memdup(v, count * 2 * 3 * sizeof(GLdouble)));
8666 }
8667 if (ctx->ExecuteFlag) {
8668 CALL_ProgramUniformMatrix2x3dv(ctx->Exec,
8669 (program, location, count, transpose, v));
8670 }
8671 }
8672
8673 void GLAPIENTRY
save_ProgramUniformMatrix2x4dv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLdouble * v)8674 save_ProgramUniformMatrix2x4dv(GLuint program, GLint location, GLsizei count,
8675 GLboolean transpose, const GLdouble *v)
8676 {
8677 GET_CURRENT_CONTEXT(ctx);
8678 Node *n;
8679 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8680 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX24D,
8681 4 + POINTER_DWORDS);
8682 if (n) {
8683 n[1].ui = program;
8684 n[2].i = location;
8685 n[3].i = count;
8686 n[4].b = transpose;
8687 save_pointer(&n[5], memdup(v, count * 2 * 4 * sizeof(GLdouble)));
8688 }
8689 if (ctx->ExecuteFlag) {
8690 CALL_ProgramUniformMatrix2x4dv(ctx->Exec,
8691 (program, location, count, transpose, v));
8692 }
8693 }
8694
8695 void GLAPIENTRY
save_ProgramUniformMatrix3x2dv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLdouble * v)8696 save_ProgramUniformMatrix3x2dv(GLuint program, GLint location, GLsizei count,
8697 GLboolean transpose, const GLdouble *v)
8698 {
8699 GET_CURRENT_CONTEXT(ctx);
8700 Node *n;
8701 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8702 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX32D,
8703 4 + POINTER_DWORDS);
8704 if (n) {
8705 n[1].ui = program;
8706 n[2].i = location;
8707 n[3].i = count;
8708 n[4].b = transpose;
8709 save_pointer(&n[5], memdup(v, count * 3 * 2 * sizeof(GLdouble)));
8710 }
8711 if (ctx->ExecuteFlag) {
8712 CALL_ProgramUniformMatrix3x2dv(ctx->Exec,
8713 (program, location, count, transpose, v));
8714 }
8715 }
8716
8717 void GLAPIENTRY
save_ProgramUniformMatrix3dv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLdouble * v)8718 save_ProgramUniformMatrix3dv(GLuint program, GLint location, GLsizei count,
8719 GLboolean transpose, const GLdouble *v)
8720 {
8721 GET_CURRENT_CONTEXT(ctx);
8722 Node *n;
8723 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8724 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX33D,
8725 4 + POINTER_DWORDS);
8726 if (n) {
8727 n[1].ui = program;
8728 n[2].i = location;
8729 n[3].i = count;
8730 n[4].b = transpose;
8731 save_pointer(&n[5], memdup(v, count * 3 * 3 * sizeof(GLdouble)));
8732 }
8733 if (ctx->ExecuteFlag) {
8734 CALL_ProgramUniformMatrix3dv(ctx->Exec,
8735 (program, location, count, transpose, v));
8736 }
8737 }
8738
8739 void GLAPIENTRY
save_ProgramUniformMatrix3x4dv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLdouble * v)8740 save_ProgramUniformMatrix3x4dv(GLuint program, GLint location, GLsizei count,
8741 GLboolean transpose, const GLdouble *v)
8742 {
8743 GET_CURRENT_CONTEXT(ctx);
8744 Node *n;
8745 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8746 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX34D,
8747 4 + POINTER_DWORDS);
8748 if (n) {
8749 n[1].ui = program;
8750 n[2].i = location;
8751 n[3].i = count;
8752 n[4].b = transpose;
8753 save_pointer(&n[5], memdup(v, count * 3 * 4 * sizeof(GLdouble)));
8754 }
8755 if (ctx->ExecuteFlag) {
8756 CALL_ProgramUniformMatrix3x4dv(ctx->Exec,
8757 (program, location, count, transpose, v));
8758 }
8759 }
8760
8761 void GLAPIENTRY
save_ProgramUniformMatrix4x2dv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLdouble * v)8762 save_ProgramUniformMatrix4x2dv(GLuint program, GLint location, GLsizei count,
8763 GLboolean transpose, const GLdouble *v)
8764 {
8765 GET_CURRENT_CONTEXT(ctx);
8766 Node *n;
8767 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8768 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX42D,
8769 4 + POINTER_DWORDS);
8770 if (n) {
8771 n[1].ui = program;
8772 n[2].i = location;
8773 n[3].i = count;
8774 n[4].b = transpose;
8775 save_pointer(&n[5], memdup(v, count * 4 * 2 * sizeof(GLdouble)));
8776 }
8777 if (ctx->ExecuteFlag) {
8778 CALL_ProgramUniformMatrix4x2dv(ctx->Exec,
8779 (program, location, count, transpose, v));
8780 }
8781 }
8782
8783 void GLAPIENTRY
save_ProgramUniformMatrix4x3dv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLdouble * v)8784 save_ProgramUniformMatrix4x3dv(GLuint program, GLint location, GLsizei count,
8785 GLboolean transpose, const GLdouble *v)
8786 {
8787 GET_CURRENT_CONTEXT(ctx);
8788 Node *n;
8789 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8790 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX43D,
8791 4 + POINTER_DWORDS);
8792 if (n) {
8793 n[1].ui = program;
8794 n[2].i = location;
8795 n[3].i = count;
8796 n[4].b = transpose;
8797 save_pointer(&n[5], memdup(v, count * 4 * 3 * sizeof(GLdouble)));
8798 }
8799 if (ctx->ExecuteFlag) {
8800 CALL_ProgramUniformMatrix4x3dv(ctx->Exec,
8801 (program, location, count, transpose, v));
8802 }
8803 }
8804
8805 void GLAPIENTRY
save_ProgramUniformMatrix4dv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLdouble * v)8806 save_ProgramUniformMatrix4dv(GLuint program, GLint location, GLsizei count,
8807 GLboolean transpose, const GLdouble *v)
8808 {
8809 GET_CURRENT_CONTEXT(ctx);
8810 Node *n;
8811 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8812 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX44D,
8813 4 + POINTER_DWORDS);
8814 if (n) {
8815 n[1].ui = program;
8816 n[2].i = location;
8817 n[3].i = count;
8818 n[4].b = transpose;
8819 save_pointer(&n[5], memdup(v, count * 4 * 4 * sizeof(GLdouble)));
8820 }
8821 if (ctx->ExecuteFlag) {
8822 CALL_ProgramUniformMatrix4dv(ctx->Exec,
8823 (program, location, count, transpose, v));
8824 }
8825 }
8826
8827 void GLAPIENTRY
save_ClipControl(GLenum origin,GLenum depth)8828 save_ClipControl(GLenum origin, GLenum depth)
8829 {
8830 GET_CURRENT_CONTEXT(ctx);
8831 Node *n;
8832 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8833 n = alloc_instruction(ctx, OPCODE_CLIP_CONTROL, 2);
8834 if (n) {
8835 n[1].e = origin;
8836 n[2].e = depth;
8837 }
8838 if (ctx->ExecuteFlag) {
8839 CALL_ClipControl(ctx->Exec, (origin, depth));
8840 }
8841 }
8842
8843 void GLAPIENTRY
save_ClampColor(GLenum target,GLenum clamp)8844 save_ClampColor(GLenum target, GLenum clamp)
8845 {
8846 GET_CURRENT_CONTEXT(ctx);
8847 Node *n;
8848 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8849 n = alloc_instruction(ctx, OPCODE_CLAMP_COLOR, 2);
8850 if (n) {
8851 n[1].e = target;
8852 n[2].e = clamp;
8853 }
8854 if (ctx->ExecuteFlag) {
8855 CALL_ClampColor(ctx->Exec, (target, clamp));
8856 }
8857 }
8858
8859 /** GL_EXT_texture_integer */
8860 void GLAPIENTRY
save_ClearColorIiEXT(GLint red,GLint green,GLint blue,GLint alpha)8861 save_ClearColorIiEXT(GLint red, GLint green, GLint blue, GLint alpha)
8862 {
8863 GET_CURRENT_CONTEXT(ctx);
8864 Node *n;
8865 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8866 n = alloc_instruction(ctx, OPCODE_CLEARCOLOR_I, 4);
8867 if (n) {
8868 n[1].i = red;
8869 n[2].i = green;
8870 n[3].i = blue;
8871 n[4].i = alpha;
8872 }
8873 if (ctx->ExecuteFlag) {
8874 CALL_ClearColorIiEXT(ctx->Exec, (red, green, blue, alpha));
8875 }
8876 }
8877
8878 /** GL_EXT_texture_integer */
8879 void GLAPIENTRY
save_ClearColorIuiEXT(GLuint red,GLuint green,GLuint blue,GLuint alpha)8880 save_ClearColorIuiEXT(GLuint red, GLuint green, GLuint blue, GLuint alpha)
8881 {
8882 GET_CURRENT_CONTEXT(ctx);
8883 Node *n;
8884 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8885 n = alloc_instruction(ctx, OPCODE_CLEARCOLOR_UI, 4);
8886 if (n) {
8887 n[1].ui = red;
8888 n[2].ui = green;
8889 n[3].ui = blue;
8890 n[4].ui = alpha;
8891 }
8892 if (ctx->ExecuteFlag) {
8893 CALL_ClearColorIuiEXT(ctx->Exec, (red, green, blue, alpha));
8894 }
8895 }
8896
8897 /** GL_EXT_texture_integer */
8898 void GLAPIENTRY
save_TexParameterIiv(GLenum target,GLenum pname,const GLint * params)8899 save_TexParameterIiv(GLenum target, GLenum pname, const GLint *params)
8900 {
8901 GET_CURRENT_CONTEXT(ctx);
8902 Node *n;
8903 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8904 n = alloc_instruction(ctx, OPCODE_TEXPARAMETER_I, 6);
8905 if (n) {
8906 n[1].e = target;
8907 n[2].e = pname;
8908 n[3].i = params[0];
8909 n[4].i = params[1];
8910 n[5].i = params[2];
8911 n[6].i = params[3];
8912 }
8913 if (ctx->ExecuteFlag) {
8914 CALL_TexParameterIiv(ctx->Exec, (target, pname, params));
8915 }
8916 }
8917
8918 /** GL_EXT_texture_integer */
8919 void GLAPIENTRY
save_TexParameterIuiv(GLenum target,GLenum pname,const GLuint * params)8920 save_TexParameterIuiv(GLenum target, GLenum pname, const GLuint *params)
8921 {
8922 GET_CURRENT_CONTEXT(ctx);
8923 Node *n;
8924 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8925 n = alloc_instruction(ctx, OPCODE_TEXPARAMETER_UI, 6);
8926 if (n) {
8927 n[1].e = target;
8928 n[2].e = pname;
8929 n[3].ui = params[0];
8930 n[4].ui = params[1];
8931 n[5].ui = params[2];
8932 n[6].ui = params[3];
8933 }
8934 if (ctx->ExecuteFlag) {
8935 CALL_TexParameterIuiv(ctx->Exec, (target, pname, params));
8936 }
8937 }
8938
8939 /* GL_ARB_instanced_arrays */
8940 void GLAPIENTRY
save_VertexAttribDivisor(GLuint index,GLuint divisor)8941 save_VertexAttribDivisor(GLuint index, GLuint divisor)
8942 {
8943 GET_CURRENT_CONTEXT(ctx);
8944 Node *n;
8945 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8946 n = alloc_instruction(ctx, OPCODE_VERTEX_ATTRIB_DIVISOR, 2);
8947 if (n) {
8948 n[1].ui = index;
8949 n[2].ui = divisor;
8950 }
8951 if (ctx->ExecuteFlag) {
8952 CALL_VertexAttribDivisor(ctx->Exec, (index, divisor));
8953 }
8954 }
8955
8956
8957 /* GL_NV_texture_barrier */
8958 void GLAPIENTRY
save_TextureBarrierNV(void)8959 save_TextureBarrierNV(void)
8960 {
8961 GET_CURRENT_CONTEXT(ctx);
8962 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8963 alloc_instruction(ctx, OPCODE_TEXTURE_BARRIER_NV, 0);
8964 if (ctx->ExecuteFlag) {
8965 CALL_TextureBarrierNV(ctx->Exec, ());
8966 }
8967 }
8968
8969
8970 /* GL_ARB_sampler_objects */
8971 void GLAPIENTRY
save_BindSampler(GLuint unit,GLuint sampler)8972 save_BindSampler(GLuint unit, GLuint sampler)
8973 {
8974 Node *n;
8975 GET_CURRENT_CONTEXT(ctx);
8976 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8977 n = alloc_instruction(ctx, OPCODE_BIND_SAMPLER, 2);
8978 if (n) {
8979 n[1].ui = unit;
8980 n[2].ui = sampler;
8981 }
8982 if (ctx->ExecuteFlag) {
8983 CALL_BindSampler(ctx->Exec, (unit, sampler));
8984 }
8985 }
8986
8987 void GLAPIENTRY
save_SamplerParameteriv(GLuint sampler,GLenum pname,const GLint * params)8988 save_SamplerParameteriv(GLuint sampler, GLenum pname, const GLint *params)
8989 {
8990 Node *n;
8991 GET_CURRENT_CONTEXT(ctx);
8992 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8993 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERIV, 6);
8994 if (n) {
8995 n[1].ui = sampler;
8996 n[2].e = pname;
8997 n[3].i = params[0];
8998 if (pname == GL_TEXTURE_BORDER_COLOR) {
8999 n[4].i = params[1];
9000 n[5].i = params[2];
9001 n[6].i = params[3];
9002 }
9003 else {
9004 n[4].i = n[5].i = n[6].i = 0;
9005 }
9006 }
9007 if (ctx->ExecuteFlag) {
9008 CALL_SamplerParameteriv(ctx->Exec, (sampler, pname, params));
9009 }
9010 }
9011
9012 void GLAPIENTRY
save_SamplerParameteri(GLuint sampler,GLenum pname,GLint param)9013 save_SamplerParameteri(GLuint sampler, GLenum pname, GLint param)
9014 {
9015 GLint parray[4];
9016 parray[0] = param;
9017 parray[1] = parray[2] = parray[3] = 0;
9018 save_SamplerParameteriv(sampler, pname, parray);
9019 }
9020
9021 void GLAPIENTRY
save_SamplerParameterfv(GLuint sampler,GLenum pname,const GLfloat * params)9022 save_SamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *params)
9023 {
9024 Node *n;
9025 GET_CURRENT_CONTEXT(ctx);
9026 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9027 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERFV, 6);
9028 if (n) {
9029 n[1].ui = sampler;
9030 n[2].e = pname;
9031 n[3].f = params[0];
9032 if (pname == GL_TEXTURE_BORDER_COLOR) {
9033 n[4].f = params[1];
9034 n[5].f = params[2];
9035 n[6].f = params[3];
9036 }
9037 else {
9038 n[4].f = n[5].f = n[6].f = 0.0F;
9039 }
9040 }
9041 if (ctx->ExecuteFlag) {
9042 CALL_SamplerParameterfv(ctx->Exec, (sampler, pname, params));
9043 }
9044 }
9045
9046 void GLAPIENTRY
save_SamplerParameterf(GLuint sampler,GLenum pname,GLfloat param)9047 save_SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
9048 {
9049 GLfloat parray[4];
9050 parray[0] = param;
9051 parray[1] = parray[2] = parray[3] = 0.0F;
9052 save_SamplerParameterfv(sampler, pname, parray);
9053 }
9054
9055 void GLAPIENTRY
save_SamplerParameterIiv(GLuint sampler,GLenum pname,const GLint * params)9056 save_SamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *params)
9057 {
9058 Node *n;
9059 GET_CURRENT_CONTEXT(ctx);
9060 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9061 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERIIV, 6);
9062 if (n) {
9063 n[1].ui = sampler;
9064 n[2].e = pname;
9065 n[3].i = params[0];
9066 if (pname == GL_TEXTURE_BORDER_COLOR) {
9067 n[4].i = params[1];
9068 n[5].i = params[2];
9069 n[6].i = params[3];
9070 }
9071 else {
9072 n[4].i = n[5].i = n[6].i = 0;
9073 }
9074 }
9075 if (ctx->ExecuteFlag) {
9076 CALL_SamplerParameterIiv(ctx->Exec, (sampler, pname, params));
9077 }
9078 }
9079
9080 void GLAPIENTRY
save_SamplerParameterIuiv(GLuint sampler,GLenum pname,const GLuint * params)9081 save_SamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *params)
9082 {
9083 Node *n;
9084 GET_CURRENT_CONTEXT(ctx);
9085 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9086 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERUIV, 6);
9087 if (n) {
9088 n[1].ui = sampler;
9089 n[2].e = pname;
9090 n[3].ui = params[0];
9091 if (pname == GL_TEXTURE_BORDER_COLOR) {
9092 n[4].ui = params[1];
9093 n[5].ui = params[2];
9094 n[6].ui = params[3];
9095 }
9096 else {
9097 n[4].ui = n[5].ui = n[6].ui = 0;
9098 }
9099 }
9100 if (ctx->ExecuteFlag) {
9101 CALL_SamplerParameterIuiv(ctx->Exec, (sampler, pname, params));
9102 }
9103 }
9104
9105 void GLAPIENTRY
save_WaitSync(GLsync sync,GLbitfield flags,GLuint64 timeout)9106 save_WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
9107 {
9108 Node *n;
9109 GET_CURRENT_CONTEXT(ctx);
9110 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9111 n = alloc_instruction(ctx, OPCODE_WAIT_SYNC, 4);
9112 if (n) {
9113 union uint64_pair p;
9114 p.uint64 = timeout;
9115 n[1].bf = flags;
9116 n[2].ui = p.uint32[0];
9117 n[3].ui = p.uint32[1];
9118 save_pointer(&n[4], sync);
9119 }
9120 if (ctx->ExecuteFlag) {
9121 CALL_WaitSync(ctx->Exec, (sync, flags, timeout));
9122 }
9123 }
9124
9125
9126 /** GL_NV_conditional_render */
9127 void GLAPIENTRY
save_BeginConditionalRender(GLuint queryId,GLenum mode)9128 save_BeginConditionalRender(GLuint queryId, GLenum mode)
9129 {
9130 GET_CURRENT_CONTEXT(ctx);
9131 Node *n;
9132 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9133 n = alloc_instruction(ctx, OPCODE_BEGIN_CONDITIONAL_RENDER, 2);
9134 if (n) {
9135 n[1].i = queryId;
9136 n[2].e = mode;
9137 }
9138 if (ctx->ExecuteFlag) {
9139 CALL_BeginConditionalRender(ctx->Exec, (queryId, mode));
9140 }
9141 }
9142
9143 void GLAPIENTRY
save_EndConditionalRender(void)9144 save_EndConditionalRender(void)
9145 {
9146 GET_CURRENT_CONTEXT(ctx);
9147 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9148 alloc_instruction(ctx, OPCODE_END_CONDITIONAL_RENDER, 0);
9149 if (ctx->ExecuteFlag) {
9150 CALL_EndConditionalRender(ctx->Exec, ());
9151 }
9152 }
9153
9154 void GLAPIENTRY
save_UniformBlockBinding(GLuint prog,GLuint index,GLuint binding)9155 save_UniformBlockBinding(GLuint prog, GLuint index, GLuint binding)
9156 {
9157 GET_CURRENT_CONTEXT(ctx);
9158 Node *n;
9159 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9160 n = alloc_instruction(ctx, OPCODE_UNIFORM_BLOCK_BINDING, 3);
9161 if (n) {
9162 n[1].ui = prog;
9163 n[2].ui = index;
9164 n[3].ui = binding;
9165 }
9166 if (ctx->ExecuteFlag) {
9167 CALL_UniformBlockBinding(ctx->Exec, (prog, index, binding));
9168 }
9169 }
9170
9171 void GLAPIENTRY
save_UniformSubroutinesuiv(GLenum shadertype,GLsizei count,const GLuint * indices)9172 save_UniformSubroutinesuiv(GLenum shadertype, GLsizei count,
9173 const GLuint *indices)
9174 {
9175 GET_CURRENT_CONTEXT(ctx);
9176 Node *n;
9177 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9178 n = alloc_instruction(ctx, OPCODE_UNIFORM_SUBROUTINES, 2 + POINTER_DWORDS);
9179 if (n) {
9180 GLint *indices_copy = NULL;
9181
9182 if (count > 0)
9183 indices_copy = memdup(indices, sizeof(GLuint) * 4 * count);
9184 n[1].e = shadertype;
9185 n[2].si = count;
9186 save_pointer(&n[3], indices_copy);
9187 }
9188 if (ctx->ExecuteFlag) {
9189 CALL_UniformSubroutinesuiv(ctx->Exec, (shadertype, count, indices));
9190 }
9191 }
9192
9193 /** GL_EXT_window_rectangles */
9194 void GLAPIENTRY
save_WindowRectanglesEXT(GLenum mode,GLsizei count,const GLint * box)9195 save_WindowRectanglesEXT(GLenum mode, GLsizei count, const GLint *box)
9196 {
9197 GET_CURRENT_CONTEXT(ctx);
9198 Node *n;
9199 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9200 n = alloc_instruction(ctx, OPCODE_WINDOW_RECTANGLES, 2 + POINTER_DWORDS);
9201 if (n) {
9202 GLint *box_copy = NULL;
9203
9204 if (count > 0)
9205 box_copy = memdup(box, sizeof(GLint) * 4 * count);
9206 n[1].e = mode;
9207 n[2].si = count;
9208 save_pointer(&n[3], box_copy);
9209 }
9210 if (ctx->ExecuteFlag) {
9211 CALL_WindowRectanglesEXT(ctx->Exec, (mode, count, box));
9212 }
9213 }
9214
9215
9216 /** GL_NV_conservative_raster */
9217 void GLAPIENTRY
save_SubpixelPrecisionBiasNV(GLuint xbits,GLuint ybits)9218 save_SubpixelPrecisionBiasNV(GLuint xbits, GLuint ybits)
9219 {
9220 GET_CURRENT_CONTEXT(ctx);
9221 Node *n;
9222 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9223 n = alloc_instruction(ctx, OPCODE_SUBPIXEL_PRECISION_BIAS, 2);
9224 if (n) {
9225 n[1].ui = xbits;
9226 n[2].ui = ybits;
9227 }
9228 if (ctx->ExecuteFlag) {
9229 CALL_SubpixelPrecisionBiasNV(ctx->Exec, (xbits, ybits));
9230 }
9231 }
9232
9233 /** GL_NV_conservative_raster_dilate */
9234 void GLAPIENTRY
save_ConservativeRasterParameterfNV(GLenum pname,GLfloat param)9235 save_ConservativeRasterParameterfNV(GLenum pname, GLfloat param)
9236 {
9237 GET_CURRENT_CONTEXT(ctx);
9238 Node *n;
9239 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9240 n = alloc_instruction(ctx, OPCODE_CONSERVATIVE_RASTER_PARAMETER_F, 2);
9241 if (n) {
9242 n[1].e = pname;
9243 n[2].f = param;
9244 }
9245 if (ctx->ExecuteFlag) {
9246 CALL_ConservativeRasterParameterfNV(ctx->Exec, (pname, param));
9247 }
9248 }
9249
9250 /** GL_NV_conservative_raster_pre_snap_triangles */
9251 void GLAPIENTRY
save_ConservativeRasterParameteriNV(GLenum pname,GLint param)9252 save_ConservativeRasterParameteriNV(GLenum pname, GLint param)
9253 {
9254 GET_CURRENT_CONTEXT(ctx);
9255 Node *n;
9256 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9257 n = alloc_instruction(ctx, OPCODE_CONSERVATIVE_RASTER_PARAMETER_I, 2);
9258 if (n) {
9259 n[1].e = pname;
9260 n[2].i = param;
9261 }
9262 if (ctx->ExecuteFlag) {
9263 CALL_ConservativeRasterParameteriNV(ctx->Exec, (pname, param));
9264 }
9265 }
9266
9267 /** GL_EXT_direct_state_access */
9268
9269 void GLAPIENTRY
save_MatrixLoadfEXT(GLenum matrixMode,const GLfloat * m)9270 save_MatrixLoadfEXT(GLenum matrixMode, const GLfloat *m)
9271 {
9272 GET_CURRENT_CONTEXT(ctx);
9273 Node *n;
9274 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9275 n = alloc_instruction(ctx, OPCODE_MATRIX_LOAD, 17);
9276 if (n) {
9277 n[1].e = matrixMode;
9278 for (unsigned i = 0; i < 16; i++) {
9279 n[2 + i].f = m[i];
9280 }
9281 }
9282 if (ctx->ExecuteFlag) {
9283 CALL_MatrixLoadfEXT(ctx->Exec, (matrixMode, m));
9284 }
9285 }
9286
9287 void GLAPIENTRY
save_MatrixLoaddEXT(GLenum matrixMode,const GLdouble * m)9288 save_MatrixLoaddEXT(GLenum matrixMode, const GLdouble *m)
9289 {
9290 GLfloat f[16];
9291 for (unsigned i = 0; i < 16; i++) {
9292 f[i] = (GLfloat) m[i];
9293 }
9294 save_MatrixLoadfEXT(matrixMode, f);
9295 }
9296
9297 void GLAPIENTRY
save_MatrixMultfEXT(GLenum matrixMode,const GLfloat * m)9298 save_MatrixMultfEXT(GLenum matrixMode, const GLfloat * m)
9299 {
9300 GET_CURRENT_CONTEXT(ctx);
9301 Node *n;
9302 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9303 n = alloc_instruction(ctx, OPCODE_MATRIX_MULT, 17);
9304 if (n) {
9305 n[1].e = matrixMode;
9306 for (unsigned i = 0; i < 16; i++) {
9307 n[2 + i].f = m[i];
9308 }
9309 }
9310 if (ctx->ExecuteFlag) {
9311 CALL_MatrixMultfEXT(ctx->Exec, (matrixMode, m));
9312 }
9313 }
9314
9315 void GLAPIENTRY
save_MatrixMultdEXT(GLenum matrixMode,const GLdouble * m)9316 save_MatrixMultdEXT(GLenum matrixMode, const GLdouble * m)
9317 {
9318 GLfloat f[16];
9319 for (unsigned i = 0; i < 16; i++) {
9320 f[i] = (GLfloat) m[i];
9321 }
9322 save_MatrixMultfEXT(matrixMode, f);
9323 }
9324
9325 void GLAPIENTRY
save_MatrixRotatefEXT(GLenum matrixMode,GLfloat angle,GLfloat x,GLfloat y,GLfloat z)9326 save_MatrixRotatefEXT(GLenum matrixMode, GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
9327 {
9328 GET_CURRENT_CONTEXT(ctx);
9329 Node *n;
9330 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9331 n = alloc_instruction(ctx, OPCODE_MATRIX_ROTATE, 5);
9332 if (n) {
9333 n[1].e = matrixMode;
9334 n[2].f = angle;
9335 n[3].f = x;
9336 n[4].f = y;
9337 n[5].f = z;
9338 }
9339 if (ctx->ExecuteFlag) {
9340 CALL_MatrixRotatefEXT(ctx->Exec, (matrixMode, angle, x, y, z));
9341 }
9342 }
9343
9344 void GLAPIENTRY
save_MatrixRotatedEXT(GLenum matrixMode,GLdouble angle,GLdouble x,GLdouble y,GLdouble z)9345 save_MatrixRotatedEXT(GLenum matrixMode, GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
9346 {
9347 save_MatrixRotatefEXT(matrixMode, (GLfloat) angle, (GLfloat) x, (GLfloat) y, (GLfloat) z);
9348 }
9349
9350 void GLAPIENTRY
save_MatrixScalefEXT(GLenum matrixMode,GLfloat x,GLfloat y,GLfloat z)9351 save_MatrixScalefEXT(GLenum matrixMode, GLfloat x, GLfloat y, GLfloat z)
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_SCALE, 4);
9357 if (n) {
9358 n[1].e = matrixMode;
9359 n[2].f = x;
9360 n[3].f = y;
9361 n[4].f = z;
9362 }
9363 if (ctx->ExecuteFlag) {
9364 CALL_MatrixScalefEXT(ctx->Exec, (matrixMode, x, y, z));
9365 }
9366 }
9367
9368 void GLAPIENTRY
save_MatrixScaledEXT(GLenum matrixMode,GLdouble x,GLdouble y,GLdouble z)9369 save_MatrixScaledEXT(GLenum matrixMode, GLdouble x, GLdouble y, GLdouble z)
9370 {
9371 save_MatrixScalefEXT(matrixMode, (GLfloat) x, (GLfloat) y, (GLfloat) z);
9372 }
9373
9374 void GLAPIENTRY
save_MatrixTranslatefEXT(GLenum matrixMode,GLfloat x,GLfloat y,GLfloat z)9375 save_MatrixTranslatefEXT(GLenum matrixMode, GLfloat x, GLfloat y, GLfloat z)
9376 {
9377 GET_CURRENT_CONTEXT(ctx);
9378 Node *n;
9379 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9380 n = alloc_instruction(ctx, OPCODE_MATRIX_TRANSLATE, 4);
9381 if (n) {
9382 n[1].e = matrixMode;
9383 n[2].f = x;
9384 n[3].f = y;
9385 n[4].f = z;
9386 }
9387 if (ctx->ExecuteFlag) {
9388 CALL_MatrixTranslatefEXT(ctx->Exec, (matrixMode, x, y, z));
9389 }
9390 }
9391
9392 void GLAPIENTRY
save_MatrixTranslatedEXT(GLenum matrixMode,GLdouble x,GLdouble y,GLdouble z)9393 save_MatrixTranslatedEXT(GLenum matrixMode, GLdouble x, GLdouble y, GLdouble z)
9394 {
9395 save_MatrixTranslatefEXT(matrixMode, (GLfloat) x, (GLfloat) y, (GLfloat) z);
9396 }
9397
9398 void GLAPIENTRY
save_MatrixLoadIdentityEXT(GLenum matrixMode)9399 save_MatrixLoadIdentityEXT(GLenum matrixMode)
9400 {
9401 GET_CURRENT_CONTEXT(ctx);
9402 Node *n;
9403 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9404 n = alloc_instruction(ctx, OPCODE_MATRIX_LOAD_IDENTITY, 1);
9405 if (n) {
9406 n[1].e = matrixMode;
9407 }
9408 if (ctx->ExecuteFlag) {
9409 CALL_MatrixLoadIdentityEXT(ctx->Exec, (matrixMode));
9410 }
9411 }
9412
9413 void GLAPIENTRY
save_MatrixOrthoEXT(GLenum matrixMode,GLdouble left,GLdouble right,GLdouble bottom,GLdouble top,GLdouble nearval,GLdouble farval)9414 save_MatrixOrthoEXT(GLenum matrixMode, GLdouble left, GLdouble right,
9415 GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval)
9416 {
9417 GET_CURRENT_CONTEXT(ctx);
9418 Node *n;
9419 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9420 n = alloc_instruction(ctx, OPCODE_MATRIX_ORTHO, 7);
9421 if (n) {
9422 n[1].e = matrixMode;
9423 n[2].f = (GLfloat) left;
9424 n[3].f = (GLfloat) right;
9425 n[4].f = (GLfloat) bottom;
9426 n[5].f = (GLfloat) top;
9427 n[6].f = (GLfloat) nearval;
9428 n[7].f = (GLfloat) farval;
9429 }
9430 if (ctx->ExecuteFlag) {
9431 CALL_MatrixOrthoEXT(ctx->Exec, (matrixMode, left, right, bottom, top, nearval, farval));
9432 }
9433 }
9434
9435
9436 void GLAPIENTRY
save_MatrixFrustumEXT(GLenum matrixMode,GLdouble left,GLdouble right,GLdouble bottom,GLdouble top,GLdouble nearval,GLdouble farval)9437 save_MatrixFrustumEXT(GLenum matrixMode, GLdouble left, GLdouble right,
9438 GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval)
9439 {
9440 GET_CURRENT_CONTEXT(ctx);
9441 Node *n;
9442 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9443 n = alloc_instruction(ctx, OPCODE_MATRIX_FRUSTUM, 7);
9444 if (n) {
9445 n[1].e = matrixMode;
9446 n[2].f = (GLfloat) left;
9447 n[3].f = (GLfloat) right;
9448 n[4].f = (GLfloat) bottom;
9449 n[5].f = (GLfloat) top;
9450 n[6].f = (GLfloat) nearval;
9451 n[7].f = (GLfloat) farval;
9452 }
9453 if (ctx->ExecuteFlag) {
9454 CALL_MatrixFrustumEXT(ctx->Exec, (matrixMode, left, right, bottom, top, nearval, farval));
9455 }
9456 }
9457
9458 void GLAPIENTRY
save_MatrixPushEXT(GLenum matrixMode)9459 save_MatrixPushEXT(GLenum matrixMode)
9460 {
9461 GET_CURRENT_CONTEXT(ctx);
9462 Node* n;
9463 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9464 n = alloc_instruction(ctx, OPCODE_MATRIX_PUSH, 1);
9465 if (n) {
9466 n[1].e = matrixMode;
9467 }
9468 if (ctx->ExecuteFlag) {
9469 CALL_MatrixPushEXT(ctx->Exec, (matrixMode));
9470 }
9471 }
9472
9473 void GLAPIENTRY
save_MatrixPopEXT(GLenum matrixMode)9474 save_MatrixPopEXT(GLenum matrixMode)
9475 {
9476 GET_CURRENT_CONTEXT(ctx);
9477 Node* n;
9478 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9479 n = alloc_instruction(ctx, OPCODE_MATRIX_POP, 1);
9480 if (n) {
9481 n[1].e = matrixMode;
9482 }
9483 if (ctx->ExecuteFlag) {
9484 CALL_MatrixPopEXT(ctx->Exec, (matrixMode));
9485 }
9486 }
9487
9488 void GLAPIENTRY
save_MatrixLoadTransposefEXT(GLenum matrixMode,const GLfloat * m)9489 save_MatrixLoadTransposefEXT(GLenum matrixMode, const GLfloat *m)
9490 {
9491 GLfloat tm[16];
9492 _math_transposef(tm, m);
9493 save_MatrixLoadfEXT(matrixMode, tm);
9494 }
9495
9496 void GLAPIENTRY
save_MatrixLoadTransposedEXT(GLenum matrixMode,const GLdouble * m)9497 save_MatrixLoadTransposedEXT(GLenum matrixMode, const GLdouble *m)
9498 {
9499 GLfloat tm[16];
9500 _math_transposefd(tm, m);
9501 save_MatrixLoadfEXT(matrixMode, tm);
9502 }
9503
9504 void GLAPIENTRY
save_MatrixMultTransposefEXT(GLenum matrixMode,const GLfloat * m)9505 save_MatrixMultTransposefEXT(GLenum matrixMode, const GLfloat *m)
9506 {
9507 GLfloat tm[16];
9508 _math_transposef(tm, m);
9509 save_MatrixMultfEXT(matrixMode, tm);
9510 }
9511
9512 void GLAPIENTRY
save_MatrixMultTransposedEXT(GLenum matrixMode,const GLdouble * m)9513 save_MatrixMultTransposedEXT(GLenum matrixMode, const GLdouble *m)
9514 {
9515 GLfloat tm[16];
9516 _math_transposefd(tm, m);
9517 save_MatrixMultfEXT(matrixMode, tm);
9518 }
9519
9520 void GLAPIENTRY
save_TextureParameterfvEXT(GLuint texture,GLenum target,GLenum pname,const GLfloat * params)9521 save_TextureParameterfvEXT(GLuint texture, GLenum target, GLenum pname,
9522 const GLfloat *params)
9523 {
9524 GET_CURRENT_CONTEXT(ctx);
9525 Node *n;
9526 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9527 n = alloc_instruction(ctx, OPCODE_TEXTUREPARAMETER_F, 7);
9528 if (n) {
9529 n[1].ui = texture;
9530 n[2].e = target;
9531 n[3].e = pname;
9532 n[4].f = params[0];
9533 n[5].f = params[1];
9534 n[6].f = params[2];
9535 n[7].f = params[3];
9536 }
9537 if (ctx->ExecuteFlag) {
9538 CALL_TextureParameterfvEXT(ctx->Exec, (texture, target, pname, params));
9539 }
9540 }
9541
9542
9543 void GLAPIENTRY
save_TextureParameterfEXT(GLuint texture,GLenum target,GLenum pname,GLfloat param)9544 save_TextureParameterfEXT(GLuint texture, GLenum target, GLenum pname, GLfloat param)
9545 {
9546 GLfloat parray[4];
9547 parray[0] = param;
9548 parray[1] = parray[2] = parray[3] = 0.0F;
9549 save_TextureParameterfvEXT(texture, target, pname, parray);
9550 }
9551
9552 void GLAPIENTRY
save_TextureParameterivEXT(GLuint texture,GLenum target,GLenum pname,const GLint * params)9553 save_TextureParameterivEXT(GLuint texture, GLenum target, GLenum pname, const GLint *params)
9554 {
9555 GET_CURRENT_CONTEXT(ctx);
9556 Node *n;
9557 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9558 n = alloc_instruction(ctx, OPCODE_TEXTUREPARAMETER_I, 7);
9559 if (n) {
9560 n[1].ui = texture;
9561 n[2].e = target;
9562 n[3].e = pname;
9563 n[4].i = params[0];
9564 n[5].i = params[1];
9565 n[6].i = params[2];
9566 n[7].i = params[3];
9567 }
9568 if (ctx->ExecuteFlag) {
9569 CALL_TextureParameterivEXT(ctx->Exec, (texture, target, pname, params));
9570 }
9571 }
9572
9573 void GLAPIENTRY
save_TextureParameteriEXT(GLuint texture,GLenum target,GLenum pname,GLint param)9574 save_TextureParameteriEXT(GLuint texture, GLenum target, GLenum pname, GLint param)
9575 {
9576 GLint fparam[4];
9577 fparam[0] = param;
9578 fparam[1] = fparam[2] = fparam[3] = 0;
9579 save_TextureParameterivEXT(texture, target, pname, fparam);
9580 }
9581
9582 void GLAPIENTRY
save_TextureParameterIivEXT(GLuint texture,GLenum target,GLenum pname,const GLint * params)9583 save_TextureParameterIivEXT(GLuint texture, GLenum target, GLenum pname, const GLint* params)
9584 {
9585 GET_CURRENT_CONTEXT(ctx);
9586 Node *n;
9587 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9588 n = alloc_instruction(ctx, OPCODE_TEXTUREPARAMETER_II, 7);
9589 if (n) {
9590 n[1].ui = texture;
9591 n[2].e = target;
9592 n[3].e = pname;
9593 n[4].i = params[0];
9594 n[5].i = params[1];
9595 n[6].i = params[2];
9596 n[7].i = params[3];
9597 }
9598 if (ctx->ExecuteFlag) {
9599 CALL_TextureParameterIivEXT(ctx->Exec, (texture, target, pname, params));
9600 }
9601 }
9602
9603 void GLAPIENTRY
save_TextureParameterIuivEXT(GLuint texture,GLenum target,GLenum pname,const GLuint * params)9604 save_TextureParameterIuivEXT(GLuint texture, GLenum target, GLenum pname, const GLuint* params)
9605 {
9606 GET_CURRENT_CONTEXT(ctx);
9607 Node *n;
9608 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9609 n = alloc_instruction(ctx, OPCODE_TEXTUREPARAMETER_IUI, 7);
9610 if (n) {
9611 n[1].ui = texture;
9612 n[2].e = target;
9613 n[3].e = pname;
9614 n[4].ui = params[0];
9615 n[5].ui = params[1];
9616 n[6].ui = params[2];
9617 n[7].ui = params[3];
9618 }
9619 if (ctx->ExecuteFlag) {
9620 CALL_TextureParameterIuivEXT(ctx->Exec, (texture, target, pname, params));
9621 }
9622 }
9623
9624
9625 void GLAPIENTRY
save_TextureImage1DEXT(GLuint texture,GLenum target,GLint level,GLint components,GLsizei width,GLint border,GLenum format,GLenum type,const GLvoid * pixels)9626 save_TextureImage1DEXT(GLuint texture, GLenum target,
9627 GLint level, GLint components,
9628 GLsizei width, GLint border,
9629 GLenum format, GLenum type, const GLvoid * pixels)
9630 {
9631 GET_CURRENT_CONTEXT(ctx);
9632 if (target == GL_PROXY_TEXTURE_1D) {
9633 /* don't compile, execute immediately */
9634 CALL_TextureImage1DEXT(ctx->Exec, (texture, target, level, components, width,
9635 border, format, type, pixels));
9636 }
9637 else {
9638 Node *n;
9639 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9640 n = alloc_instruction(ctx, OPCODE_TEXTURE_IMAGE1D, 8 + POINTER_DWORDS);
9641 if (n) {
9642 n[1].ui = texture;
9643 n[2].e = target;
9644 n[3].i = level;
9645 n[4].i = components;
9646 n[5].i = (GLint) width;
9647 n[6].i = border;
9648 n[7].e = format;
9649 n[8].e = type;
9650 save_pointer(&n[9],
9651 unpack_image(ctx, 1, width, 1, 1, format, type,
9652 pixels, &ctx->Unpack));
9653 }
9654 if (ctx->ExecuteFlag) {
9655 CALL_TextureImage1DEXT(ctx->Exec, (texture, target, level, components, width,
9656 border, format, type, pixels));
9657 }
9658 }
9659 }
9660
9661
9662 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)9663 save_TextureImage2DEXT(GLuint texture, GLenum target,
9664 GLint level, GLint components,
9665 GLsizei width, GLsizei height, GLint border,
9666 GLenum format, GLenum type, const GLvoid * pixels)
9667 {
9668 GET_CURRENT_CONTEXT(ctx);
9669 if (target == GL_PROXY_TEXTURE_2D) {
9670 /* don't compile, execute immediately */
9671 CALL_TextureImage2DEXT(ctx->Exec, (texture, target, level, components, width,
9672 height, border, format, type, pixels));
9673 }
9674 else {
9675 Node *n;
9676 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9677 n = alloc_instruction(ctx, OPCODE_TEXTURE_IMAGE2D, 9 + POINTER_DWORDS);
9678 if (n) {
9679 n[1].ui = texture;
9680 n[2].e = target;
9681 n[3].i = level;
9682 n[4].i = components;
9683 n[5].i = (GLint) width;
9684 n[6].i = (GLint) height;
9685 n[7].i = border;
9686 n[8].e = format;
9687 n[9].e = type;
9688 save_pointer(&n[10],
9689 unpack_image(ctx, 2, width, height, 1, format, type,
9690 pixels, &ctx->Unpack));
9691 }
9692 if (ctx->ExecuteFlag) {
9693 CALL_TextureImage2DEXT(ctx->Exec, (texture, target, level, components, width,
9694 height, border, format, type, pixels));
9695 }
9696 }
9697 }
9698
9699
9700 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)9701 save_TextureImage3DEXT(GLuint texture, GLenum target,
9702 GLint level, GLint internalFormat,
9703 GLsizei width, GLsizei height, GLsizei depth,
9704 GLint border,
9705 GLenum format, GLenum type, const GLvoid * pixels)
9706 {
9707 GET_CURRENT_CONTEXT(ctx);
9708 if (target == GL_PROXY_TEXTURE_3D) {
9709 /* don't compile, execute immediately */
9710 CALL_TextureImage3DEXT(ctx->Exec, (texture, target, level, internalFormat, width,
9711 height, depth, border, format, type,
9712 pixels));
9713 }
9714 else {
9715 Node *n;
9716 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9717 n = alloc_instruction(ctx, OPCODE_TEXTURE_IMAGE3D, 10 + POINTER_DWORDS);
9718 if (n) {
9719 n[1].ui = texture;
9720 n[2].e = target;
9721 n[3].i = level;
9722 n[4].i = (GLint) internalFormat;
9723 n[5].i = (GLint) width;
9724 n[6].i = (GLint) height;
9725 n[7].i = (GLint) depth;
9726 n[8].i = border;
9727 n[9].e = format;
9728 n[10].e = type;
9729 save_pointer(&n[11],
9730 unpack_image(ctx, 3, width, height, depth, format, type,
9731 pixels, &ctx->Unpack));
9732 }
9733 if (ctx->ExecuteFlag) {
9734 CALL_TextureImage3DEXT(ctx->Exec, (texture, target, level, internalFormat,
9735 width, height, depth, border, format,
9736 type, pixels));
9737 }
9738 }
9739 }
9740
9741
9742 void GLAPIENTRY
save_TextureSubImage1DEXT(GLuint texture,GLenum target,GLint level,GLint xoffset,GLsizei width,GLenum format,GLenum type,const GLvoid * pixels)9743 save_TextureSubImage1DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset,
9744 GLsizei width, GLenum format, GLenum type,
9745 const GLvoid * pixels)
9746 {
9747 GET_CURRENT_CONTEXT(ctx);
9748 Node *n;
9749
9750 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9751
9752 n = alloc_instruction(ctx, OPCODE_TEXTURE_SUB_IMAGE1D, 7 + POINTER_DWORDS);
9753 if (n) {
9754 n[1].ui = texture;
9755 n[2].e = target;
9756 n[3].i = level;
9757 n[4].i = xoffset;
9758 n[5].i = (GLint) width;
9759 n[6].e = format;
9760 n[7].e = type;
9761 save_pointer(&n[8],
9762 unpack_image(ctx, 1, width, 1, 1, format, type,
9763 pixels, &ctx->Unpack));
9764 }
9765 if (ctx->ExecuteFlag) {
9766 CALL_TextureSubImage1DEXT(ctx->Exec, (texture, target, level, xoffset, width,
9767 format, type, pixels));
9768 }
9769 }
9770
9771
9772 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)9773 save_TextureSubImage2DEXT(GLuint texture, GLenum target, GLint level,
9774 GLint xoffset, GLint yoffset,
9775 GLsizei width, GLsizei height,
9776 GLenum format, GLenum type, const GLvoid * pixels)
9777 {
9778 GET_CURRENT_CONTEXT(ctx);
9779 Node *n;
9780
9781 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9782
9783 n = alloc_instruction(ctx, OPCODE_TEXTURE_SUB_IMAGE2D, 9 + POINTER_DWORDS);
9784 if (n) {
9785 n[1].ui = texture;
9786 n[2].e = target;
9787 n[3].i = level;
9788 n[4].i = xoffset;
9789 n[5].i = yoffset;
9790 n[6].i = (GLint) width;
9791 n[7].i = (GLint) height;
9792 n[8].e = format;
9793 n[9].e = type;
9794 save_pointer(&n[10],
9795 unpack_image(ctx, 2, width, height, 1, format, type,
9796 pixels, &ctx->Unpack));
9797 }
9798 if (ctx->ExecuteFlag) {
9799 CALL_TextureSubImage2DEXT(ctx->Exec, (texture, target, level, xoffset, yoffset,
9800 width, height, format, type, pixels));
9801 }
9802 }
9803
9804
9805 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)9806 save_TextureSubImage3DEXT(GLuint texture, GLenum target, GLint level,
9807 GLint xoffset, GLint yoffset, GLint zoffset,
9808 GLsizei width, GLsizei height, GLsizei depth,
9809 GLenum format, GLenum type, const GLvoid * pixels)
9810 {
9811 GET_CURRENT_CONTEXT(ctx);
9812 Node *n;
9813
9814 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9815
9816 n = alloc_instruction(ctx, OPCODE_TEXTURE_SUB_IMAGE3D, 11 + POINTER_DWORDS);
9817 if (n) {
9818 n[1].ui = texture;
9819 n[2].e = target;
9820 n[3].i = level;
9821 n[4].i = xoffset;
9822 n[5].i = yoffset;
9823 n[6].i = zoffset;
9824 n[7].i = (GLint) width;
9825 n[8].i = (GLint) height;
9826 n[9].i = (GLint) depth;
9827 n[10].e = format;
9828 n[11].e = type;
9829 save_pointer(&n[12],
9830 unpack_image(ctx, 3, width, height, depth, format, type,
9831 pixels, &ctx->Unpack));
9832 }
9833 if (ctx->ExecuteFlag) {
9834 CALL_TextureSubImage3DEXT(ctx->Exec, (texture, target, level,
9835 xoffset, yoffset, zoffset,
9836 width, height, depth, format, type,
9837 pixels));
9838 }
9839 }
9840
9841 void GLAPIENTRY
save_CopyTextureImage1DEXT(GLuint texture,GLenum target,GLint level,GLenum internalformat,GLint x,GLint y,GLsizei width,GLint border)9842 save_CopyTextureImage1DEXT(GLuint texture, GLenum target, GLint level,
9843 GLenum internalformat, GLint x, GLint y,
9844 GLsizei width, GLint border)
9845 {
9846 GET_CURRENT_CONTEXT(ctx);
9847 Node *n;
9848 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9849 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_IMAGE1D, 8);
9850 if (n) {
9851 n[1].ui = texture;
9852 n[2].e = target;
9853 n[3].i = level;
9854 n[4].e = internalformat;
9855 n[5].i = x;
9856 n[6].i = y;
9857 n[7].i = width;
9858 n[8].i = border;
9859 }
9860 if (ctx->ExecuteFlag) {
9861 CALL_CopyTextureImage1DEXT(ctx->Exec, (texture, target, level,
9862 internalformat, x, y,
9863 width, border));
9864 }
9865 }
9866
9867 void GLAPIENTRY
save_CopyTextureImage2DEXT(GLuint texture,GLenum target,GLint level,GLenum internalformat,GLint x,GLint y,GLsizei width,GLsizei height,GLint border)9868 save_CopyTextureImage2DEXT(GLuint texture, GLenum target, GLint level,
9869 GLenum internalformat,
9870 GLint x, GLint y, GLsizei width,
9871 GLsizei height, GLint border)
9872 {
9873 GET_CURRENT_CONTEXT(ctx);
9874 Node *n;
9875 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9876 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_IMAGE2D, 9);
9877 if (n) {
9878 n[1].ui = texture;
9879 n[2].e = target;
9880 n[3].i = level;
9881 n[4].e = internalformat;
9882 n[5].i = x;
9883 n[6].i = y;
9884 n[7].i = width;
9885 n[8].i = height;
9886 n[9].i = border;
9887 }
9888 if (ctx->ExecuteFlag) {
9889 CALL_CopyTextureImage2DEXT(ctx->Exec, (texture, target, level,
9890 internalformat, x, y,
9891 width, height, border));
9892 }
9893 }
9894
9895 void GLAPIENTRY
save_CopyTextureSubImage1DEXT(GLuint texture,GLenum target,GLint level,GLint xoffset,GLint x,GLint y,GLsizei width)9896 save_CopyTextureSubImage1DEXT(GLuint texture, GLenum target, GLint level,
9897 GLint xoffset, GLint x, GLint y, GLsizei width)
9898 {
9899 GET_CURRENT_CONTEXT(ctx);
9900 Node *n;
9901 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9902 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_SUB_IMAGE1D, 7);
9903 if (n) {
9904 n[1].ui = texture;
9905 n[2].e = target;
9906 n[3].i = level;
9907 n[4].i = xoffset;
9908 n[5].i = x;
9909 n[6].i = y;
9910 n[7].i = width;
9911 }
9912 if (ctx->ExecuteFlag) {
9913 CALL_CopyTextureSubImage1DEXT(ctx->Exec,
9914 (texture, target, level, xoffset, x, y, width));
9915 }
9916 }
9917
9918 void GLAPIENTRY
save_CopyTextureSubImage2DEXT(GLuint texture,GLenum target,GLint level,GLint xoffset,GLint yoffset,GLint x,GLint y,GLsizei width,GLint height)9919 save_CopyTextureSubImage2DEXT(GLuint texture, GLenum target, GLint level,
9920 GLint xoffset, GLint yoffset,
9921 GLint x, GLint y, GLsizei width, GLint height)
9922 {
9923 GET_CURRENT_CONTEXT(ctx);
9924 Node *n;
9925 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9926 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_SUB_IMAGE2D, 9);
9927 if (n) {
9928 n[1].ui = texture;
9929 n[2].e = target;
9930 n[3].i = level;
9931 n[4].i = xoffset;
9932 n[5].i = yoffset;
9933 n[6].i = x;
9934 n[7].i = y;
9935 n[8].i = width;
9936 n[9].i = height;
9937 }
9938 if (ctx->ExecuteFlag) {
9939 CALL_CopyTextureSubImage2DEXT(ctx->Exec, (texture, target, level,
9940 xoffset, yoffset,
9941 x, y, width, height));
9942 }
9943 }
9944
9945
9946 void GLAPIENTRY
save_CopyTextureSubImage3DEXT(GLuint texture,GLenum target,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLint x,GLint y,GLsizei width,GLint height)9947 save_CopyTextureSubImage3DEXT(GLuint texture, GLenum target, GLint level,
9948 GLint xoffset, GLint yoffset, GLint zoffset,
9949 GLint x, GLint y, GLsizei width, GLint height)
9950 {
9951 GET_CURRENT_CONTEXT(ctx);
9952 Node *n;
9953 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9954 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_SUB_IMAGE3D, 10);
9955 if (n) {
9956 n[1].ui = texture;
9957 n[2].e = target;
9958 n[3].i = level;
9959 n[4].i = xoffset;
9960 n[5].i = yoffset;
9961 n[6].i = zoffset;
9962 n[7].i = x;
9963 n[8].i = y;
9964 n[9].i = width;
9965 n[10].i = height;
9966 }
9967 if (ctx->ExecuteFlag) {
9968 CALL_CopyTextureSubImage3DEXT(ctx->Exec, (texture, target, level,
9969 xoffset, yoffset, zoffset,
9970 x, y, width, height));
9971 }
9972 }
9973
9974
9975 void GLAPIENTRY
save_BindMultiTextureEXT(GLenum texunit,GLenum target,GLuint texture)9976 save_BindMultiTextureEXT(GLenum texunit, GLenum target, GLuint texture)
9977 {
9978 GET_CURRENT_CONTEXT(ctx);
9979 Node *n;
9980 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9981 n = alloc_instruction(ctx, OPCODE_BIND_MULTITEXTURE, 3);
9982 if (n) {
9983 n[1].e = texunit;
9984 n[2].e = target;
9985 n[3].ui = texture;
9986 }
9987 if (ctx->ExecuteFlag) {
9988 CALL_BindMultiTextureEXT(ctx->Exec, (texunit, target, texture));
9989 }
9990 }
9991
9992
9993 void GLAPIENTRY
save_MultiTexParameterfvEXT(GLenum texunit,GLenum target,GLenum pname,const GLfloat * params)9994 save_MultiTexParameterfvEXT(GLenum texunit, GLenum target, GLenum pname,
9995 const GLfloat *params)
9996 {
9997 GET_CURRENT_CONTEXT(ctx);
9998 Node *n;
9999 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10000 n = alloc_instruction(ctx, OPCODE_MULTITEXPARAMETER_F, 7);
10001 if (n) {
10002 n[1].e = texunit;
10003 n[2].e = target;
10004 n[3].e = pname;
10005 n[4].f = params[0];
10006 n[5].f = params[1];
10007 n[6].f = params[2];
10008 n[7].f = params[3];
10009 }
10010 if (ctx->ExecuteFlag) {
10011 CALL_MultiTexParameterfvEXT(ctx->Exec, (texunit, target, pname, params));
10012 }
10013 }
10014
10015
10016 void GLAPIENTRY
save_MultiTexParameterfEXT(GLenum texunit,GLenum target,GLenum pname,GLfloat param)10017 save_MultiTexParameterfEXT(GLenum texunit, GLenum target, GLenum pname, GLfloat param)
10018 {
10019 GLfloat parray[4];
10020 parray[0] = param;
10021 parray[1] = parray[2] = parray[3] = 0.0F;
10022 save_MultiTexParameterfvEXT(texunit, target, pname, parray);
10023 }
10024
10025 void GLAPIENTRY
save_MultiTexParameterivEXT(GLenum texunit,GLenum target,GLenum pname,const GLint * params)10026 save_MultiTexParameterivEXT(GLenum texunit, GLenum target, GLenum pname, const GLint *params)
10027 {
10028 GET_CURRENT_CONTEXT(ctx);
10029 Node *n;
10030 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10031 n = alloc_instruction(ctx, OPCODE_MULTITEXPARAMETER_I, 7);
10032 if (n) {
10033 n[1].e = texunit;
10034 n[2].e = target;
10035 n[3].e = pname;
10036 n[4].i = params[0];
10037 n[5].i = params[1];
10038 n[6].i = params[2];
10039 n[7].i = params[3];
10040 }
10041 if (ctx->ExecuteFlag) {
10042 CALL_MultiTexParameterivEXT(ctx->Exec, (texunit, target, pname, params));
10043 }
10044 }
10045
10046 void GLAPIENTRY
save_MultiTexParameterIivEXT(GLenum texunit,GLenum target,GLenum pname,const GLint * params)10047 save_MultiTexParameterIivEXT(GLenum texunit, GLenum target, GLenum pname, const GLint *params)
10048 {
10049 GET_CURRENT_CONTEXT(ctx);
10050 Node *n;
10051 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10052 n = alloc_instruction(ctx, OPCODE_MULTITEXPARAMETER_II, 7);
10053 if (n) {
10054 n[1].e = texunit;
10055 n[2].e = target;
10056 n[3].e = pname;
10057 n[4].i = params[0];
10058 n[5].i = params[1];
10059 n[6].i = params[2];
10060 n[7].i = params[3];
10061 }
10062 if (ctx->ExecuteFlag) {
10063 CALL_MultiTexParameterIivEXT(ctx->Exec, (texunit, target, pname, params));
10064 }
10065 }
10066
10067 void GLAPIENTRY
save_MultiTexParameterIuivEXT(GLenum texunit,GLenum target,GLenum pname,const GLuint * params)10068 save_MultiTexParameterIuivEXT(GLenum texunit, GLenum target, GLenum pname, const GLuint *params)
10069 {
10070 GET_CURRENT_CONTEXT(ctx);
10071 Node *n;
10072 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10073 n = alloc_instruction(ctx, OPCODE_MULTITEXPARAMETER_IUI, 7);
10074 if (n) {
10075 n[1].e = texunit;
10076 n[2].e = target;
10077 n[3].e = pname;
10078 n[4].ui = params[0];
10079 n[5].ui = params[1];
10080 n[6].ui = params[2];
10081 n[7].ui = params[3];
10082 }
10083 if (ctx->ExecuteFlag) {
10084 CALL_MultiTexParameterIuivEXT(ctx->Exec, (texunit, target, pname, params));
10085 }
10086 }
10087
10088 void GLAPIENTRY
save_MultiTexParameteriEXT(GLenum texunit,GLenum target,GLenum pname,GLint param)10089 save_MultiTexParameteriEXT(GLenum texunit, GLenum target, GLenum pname, GLint param)
10090 {
10091 GLint fparam[4];
10092 fparam[0] = param;
10093 fparam[1] = fparam[2] = fparam[3] = 0;
10094 save_MultiTexParameterivEXT(texunit, target, pname, fparam);
10095 }
10096
10097
10098 void GLAPIENTRY
save_MultiTexImage1DEXT(GLenum texunit,GLenum target,GLint level,GLint components,GLsizei width,GLint border,GLenum format,GLenum type,const GLvoid * pixels)10099 save_MultiTexImage1DEXT(GLenum texunit, GLenum target,
10100 GLint level, GLint components,
10101 GLsizei width, GLint border,
10102 GLenum format, GLenum type, const GLvoid * pixels)
10103 {
10104 GET_CURRENT_CONTEXT(ctx);
10105 if (target == GL_PROXY_TEXTURE_1D) {
10106 /* don't compile, execute immediately */
10107 CALL_MultiTexImage1DEXT(ctx->Exec, (texunit, target, level, components, width,
10108 border, format, type, pixels));
10109 }
10110 else {
10111 Node *n;
10112 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10113 n = alloc_instruction(ctx, OPCODE_MULTITEX_IMAGE1D, 8 + POINTER_DWORDS);
10114 if (n) {
10115 n[1].e = texunit;
10116 n[2].e = target;
10117 n[3].i = level;
10118 n[4].i = components;
10119 n[5].i = (GLint) width;
10120 n[6].i = border;
10121 n[7].e = format;
10122 n[8].e = type;
10123 save_pointer(&n[9],
10124 unpack_image(ctx, 1, width, 1, 1, format, type,
10125 pixels, &ctx->Unpack));
10126 }
10127 if (ctx->ExecuteFlag) {
10128 CALL_MultiTexImage1DEXT(ctx->Exec, (texunit, target, level, components, width,
10129 border, format, type, pixels));
10130 }
10131 }
10132 }
10133
10134
10135 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)10136 save_MultiTexImage2DEXT(GLenum texunit, GLenum target,
10137 GLint level, GLint components,
10138 GLsizei width, GLsizei height, GLint border,
10139 GLenum format, GLenum type, const GLvoid * pixels)
10140 {
10141 GET_CURRENT_CONTEXT(ctx);
10142 if (target == GL_PROXY_TEXTURE_2D) {
10143 /* don't compile, execute immediately */
10144 CALL_MultiTexImage2DEXT(ctx->Exec, (texunit, target, level, components, width,
10145 height, border, format, type, pixels));
10146 }
10147 else {
10148 Node *n;
10149 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10150 n = alloc_instruction(ctx, OPCODE_MULTITEX_IMAGE2D, 9 + POINTER_DWORDS);
10151 if (n) {
10152 n[1].e = texunit;
10153 n[2].e = target;
10154 n[3].i = level;
10155 n[4].i = components;
10156 n[5].i = (GLint) width;
10157 n[6].i = (GLint) height;
10158 n[7].i = border;
10159 n[8].e = format;
10160 n[9].e = type;
10161 save_pointer(&n[10],
10162 unpack_image(ctx, 2, width, height, 1, format, type,
10163 pixels, &ctx->Unpack));
10164 }
10165 if (ctx->ExecuteFlag) {
10166 CALL_MultiTexImage2DEXT(ctx->Exec, (texunit, target, level, components, width,
10167 height, border, format, type, pixels));
10168 }
10169 }
10170 }
10171
10172
10173 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)10174 save_MultiTexImage3DEXT(GLenum texunit, GLenum target,
10175 GLint level, GLint internalFormat,
10176 GLsizei width, GLsizei height, GLsizei depth,
10177 GLint border,
10178 GLenum format, GLenum type, const GLvoid * pixels)
10179 {
10180 GET_CURRENT_CONTEXT(ctx);
10181 if (target == GL_PROXY_TEXTURE_3D) {
10182 /* don't compile, execute immediately */
10183 CALL_MultiTexImage3DEXT(ctx->Exec, (texunit, target, level, internalFormat, width,
10184 height, depth, border, format, type,
10185 pixels));
10186 }
10187 else {
10188 Node *n;
10189 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10190 n = alloc_instruction(ctx, OPCODE_MULTITEX_IMAGE3D, 10 + POINTER_DWORDS);
10191 if (n) {
10192 n[1].e = texunit;
10193 n[2].e = target;
10194 n[3].i = level;
10195 n[4].i = (GLint) internalFormat;
10196 n[5].i = (GLint) width;
10197 n[6].i = (GLint) height;
10198 n[7].i = (GLint) depth;
10199 n[8].i = border;
10200 n[9].e = format;
10201 n[10].e = type;
10202 save_pointer(&n[11],
10203 unpack_image(ctx, 3, width, height, depth, format, type,
10204 pixels, &ctx->Unpack));
10205 }
10206 if (ctx->ExecuteFlag) {
10207 CALL_MultiTexImage3DEXT(ctx->Exec, (texunit, target, level, internalFormat,
10208 width, height, depth, border, format,
10209 type, pixels));
10210 }
10211 }
10212 }
10213
10214
10215 void GLAPIENTRY
save_MultiTexSubImage1DEXT(GLenum texunit,GLenum target,GLint level,GLint xoffset,GLsizei width,GLenum format,GLenum type,const GLvoid * pixels)10216 save_MultiTexSubImage1DEXT(GLenum texunit, GLenum target, GLint level, GLint xoffset,
10217 GLsizei width, GLenum format, GLenum type,
10218 const GLvoid * pixels)
10219 {
10220 GET_CURRENT_CONTEXT(ctx);
10221 Node *n;
10222
10223 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10224
10225 n = alloc_instruction(ctx, OPCODE_MULTITEX_SUB_IMAGE1D, 7 + POINTER_DWORDS);
10226 if (n) {
10227 n[1].e = texunit;
10228 n[2].e = target;
10229 n[3].i = level;
10230 n[4].i = xoffset;
10231 n[5].i = (GLint) width;
10232 n[6].e = format;
10233 n[7].e = type;
10234 save_pointer(&n[8],
10235 unpack_image(ctx, 1, width, 1, 1, format, type,
10236 pixels, &ctx->Unpack));
10237 }
10238 if (ctx->ExecuteFlag) {
10239 CALL_MultiTexSubImage1DEXT(ctx->Exec, (texunit, target, level, xoffset, width,
10240 format, type, pixels));
10241 }
10242 }
10243
10244
10245 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)10246 save_MultiTexSubImage2DEXT(GLenum texunit, GLenum target, GLint level,
10247 GLint xoffset, GLint yoffset,
10248 GLsizei width, GLsizei height,
10249 GLenum format, GLenum type, const GLvoid * pixels)
10250 {
10251 GET_CURRENT_CONTEXT(ctx);
10252 Node *n;
10253
10254 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10255
10256 n = alloc_instruction(ctx, OPCODE_MULTITEX_SUB_IMAGE2D, 9 + POINTER_DWORDS);
10257 if (n) {
10258 n[1].e = texunit;
10259 n[2].e = target;
10260 n[3].i = level;
10261 n[4].i = xoffset;
10262 n[5].i = yoffset;
10263 n[6].i = (GLint) width;
10264 n[7].i = (GLint) height;
10265 n[8].e = format;
10266 n[9].e = type;
10267 save_pointer(&n[10],
10268 unpack_image(ctx, 2, width, height, 1, format, type,
10269 pixels, &ctx->Unpack));
10270 }
10271 if (ctx->ExecuteFlag) {
10272 CALL_MultiTexSubImage2DEXT(ctx->Exec, (texunit, target, level, xoffset, yoffset,
10273 width, height, format, type, pixels));
10274 }
10275 }
10276
10277
10278 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)10279 save_MultiTexSubImage3DEXT(GLenum texunit, GLenum target, GLint level,
10280 GLint xoffset, GLint yoffset, GLint zoffset,
10281 GLsizei width, GLsizei height, GLsizei depth,
10282 GLenum format, GLenum type, const GLvoid * pixels)
10283 {
10284 GET_CURRENT_CONTEXT(ctx);
10285 Node *n;
10286
10287 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10288
10289 n = alloc_instruction(ctx, OPCODE_MULTITEX_SUB_IMAGE3D, 11 + POINTER_DWORDS);
10290 if (n) {
10291 n[1].e = texunit;
10292 n[2].e = target;
10293 n[3].i = level;
10294 n[4].i = xoffset;
10295 n[5].i = yoffset;
10296 n[6].i = zoffset;
10297 n[7].i = (GLint) width;
10298 n[8].i = (GLint) height;
10299 n[9].i = (GLint) depth;
10300 n[10].e = format;
10301 n[11].e = type;
10302 save_pointer(&n[12],
10303 unpack_image(ctx, 3, width, height, depth, format, type,
10304 pixels, &ctx->Unpack));
10305 }
10306 if (ctx->ExecuteFlag) {
10307 CALL_MultiTexSubImage3DEXT(ctx->Exec, (texunit, target, level,
10308 xoffset, yoffset, zoffset,
10309 width, height, depth, format, type,
10310 pixels));
10311 }
10312 }
10313
10314
10315 void GLAPIENTRY
save_CopyMultiTexImage1DEXT(GLenum texunit,GLenum target,GLint level,GLenum internalformat,GLint x,GLint y,GLsizei width,GLint border)10316 save_CopyMultiTexImage1DEXT(GLenum texunit, GLenum target, GLint level,
10317 GLenum internalformat, GLint x, GLint y,
10318 GLsizei width, GLint border)
10319 {
10320 GET_CURRENT_CONTEXT(ctx);
10321 Node *n;
10322 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10323 n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_IMAGE1D, 8);
10324 if (n) {
10325 n[1].e = texunit;
10326 n[2].e = target;
10327 n[3].i = level;
10328 n[4].e = internalformat;
10329 n[5].i = x;
10330 n[6].i = y;
10331 n[7].i = width;
10332 n[8].i = border;
10333 }
10334 if (ctx->ExecuteFlag) {
10335 CALL_CopyMultiTexImage1DEXT(ctx->Exec, (texunit, target, level,
10336 internalformat, x, y,
10337 width, border));
10338 }
10339 }
10340
10341
10342 void GLAPIENTRY
save_CopyMultiTexImage2DEXT(GLenum texunit,GLenum target,GLint level,GLenum internalformat,GLint x,GLint y,GLsizei width,GLsizei height,GLint border)10343 save_CopyMultiTexImage2DEXT(GLenum texunit, GLenum target, GLint level,
10344 GLenum internalformat,
10345 GLint x, GLint y, GLsizei width,
10346 GLsizei height, GLint border)
10347 {
10348 GET_CURRENT_CONTEXT(ctx);
10349 Node *n;
10350 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10351 n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_IMAGE2D, 9);
10352 if (n) {
10353 n[1].e = texunit;
10354 n[2].e = target;
10355 n[3].i = level;
10356 n[4].e = internalformat;
10357 n[5].i = x;
10358 n[6].i = y;
10359 n[7].i = width;
10360 n[8].i = height;
10361 n[9].i = border;
10362 }
10363 if (ctx->ExecuteFlag) {
10364 CALL_CopyMultiTexImage2DEXT(ctx->Exec, (texunit, target, level,
10365 internalformat, x, y,
10366 width, height, border));
10367 }
10368 }
10369
10370
10371 void GLAPIENTRY
save_CopyMultiTexSubImage1DEXT(GLenum texunit,GLenum target,GLint level,GLint xoffset,GLint x,GLint y,GLsizei width)10372 save_CopyMultiTexSubImage1DEXT(GLenum texunit, GLenum target, GLint level,
10373 GLint xoffset, GLint x, GLint y, GLsizei width)
10374 {
10375 GET_CURRENT_CONTEXT(ctx);
10376 Node *n;
10377 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10378 n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_SUB_IMAGE1D, 7);
10379 if (n) {
10380 n[1].e = texunit;
10381 n[2].e = target;
10382 n[3].i = level;
10383 n[4].i = xoffset;
10384 n[5].i = x;
10385 n[6].i = y;
10386 n[7].i = width;
10387 }
10388 if (ctx->ExecuteFlag) {
10389 CALL_CopyMultiTexSubImage1DEXT(ctx->Exec,
10390 (texunit, target, level, xoffset, x, y, width));
10391 }
10392 }
10393
10394
10395 void GLAPIENTRY
save_CopyMultiTexSubImage2DEXT(GLenum texunit,GLenum target,GLint level,GLint xoffset,GLint yoffset,GLint x,GLint y,GLsizei width,GLint height)10396 save_CopyMultiTexSubImage2DEXT(GLenum texunit, GLenum target, GLint level,
10397 GLint xoffset, GLint yoffset,
10398 GLint x, GLint y, GLsizei width, GLint height)
10399 {
10400 GET_CURRENT_CONTEXT(ctx);
10401 Node *n;
10402 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10403 n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_SUB_IMAGE2D, 9);
10404 if (n) {
10405 n[1].e = texunit;
10406 n[2].e = target;
10407 n[3].i = level;
10408 n[4].i = xoffset;
10409 n[5].i = yoffset;
10410 n[6].i = x;
10411 n[7].i = y;
10412 n[8].i = width;
10413 n[9].i = height;
10414 }
10415 if (ctx->ExecuteFlag) {
10416 CALL_CopyMultiTexSubImage2DEXT(ctx->Exec, (texunit, target, level,
10417 xoffset, yoffset,
10418 x, y, width, height));
10419 }
10420 }
10421
10422
10423 void GLAPIENTRY
save_CopyMultiTexSubImage3DEXT(GLenum texunit,GLenum target,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLint x,GLint y,GLsizei width,GLint height)10424 save_CopyMultiTexSubImage3DEXT(GLenum texunit, GLenum target, GLint level,
10425 GLint xoffset, GLint yoffset, GLint zoffset,
10426 GLint x, GLint y, GLsizei width, GLint height)
10427 {
10428 GET_CURRENT_CONTEXT(ctx);
10429 Node *n;
10430 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10431 n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_SUB_IMAGE3D, 10);
10432 if (n) {
10433 n[1].e = texunit;
10434 n[2].e = target;
10435 n[3].i = level;
10436 n[4].i = xoffset;
10437 n[5].i = yoffset;
10438 n[6].i = zoffset;
10439 n[7].i = x;
10440 n[8].i = y;
10441 n[9].i = width;
10442 n[10].i = height;
10443 }
10444 if (ctx->ExecuteFlag) {
10445 CALL_CopyMultiTexSubImage3DEXT(ctx->Exec, (texunit, target, level,
10446 xoffset, yoffset, zoffset,
10447 x, y, width, height));
10448 }
10449 }
10450
10451
10452 void GLAPIENTRY
save_MultiTexEnvfvEXT(GLenum texunit,GLenum target,GLenum pname,const GLfloat * params)10453 save_MultiTexEnvfvEXT(GLenum texunit, GLenum target, GLenum pname, const GLfloat *params)
10454 {
10455 GET_CURRENT_CONTEXT(ctx);
10456 Node *n;
10457 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10458 n = alloc_instruction(ctx, OPCODE_MULTITEXENV, 7);
10459 if (n) {
10460 n[1].e = texunit;
10461 n[2].e = target;
10462 n[3].e = pname;
10463 if (pname == GL_TEXTURE_ENV_COLOR) {
10464 n[4].f = params[0];
10465 n[5].f = params[1];
10466 n[6].f = params[2];
10467 n[7].f = params[3];
10468 }
10469 else {
10470 n[4].f = params[0];
10471 n[5].f = n[6].f = n[7].f = 0.0F;
10472 }
10473 }
10474 if (ctx->ExecuteFlag) {
10475 CALL_MultiTexEnvfvEXT(ctx->Exec, (texunit, target, pname, params));
10476 }
10477 }
10478
10479
10480 void GLAPIENTRY
save_MultiTexEnvfEXT(GLenum texunit,GLenum target,GLenum pname,GLfloat param)10481 save_MultiTexEnvfEXT(GLenum texunit, GLenum target, GLenum pname, GLfloat param)
10482 {
10483 GLfloat parray[4];
10484 parray[0] = (GLfloat) param;
10485 parray[1] = parray[2] = parray[3] = 0.0F;
10486 save_MultiTexEnvfvEXT(texunit, target, pname, parray);
10487 }
10488
10489
10490 void GLAPIENTRY
save_MultiTexEnviEXT(GLenum texunit,GLenum target,GLenum pname,GLint param)10491 save_MultiTexEnviEXT(GLenum texunit, GLenum target, GLenum pname, GLint param)
10492 {
10493 GLfloat p[4];
10494 p[0] = (GLfloat) param;
10495 p[1] = p[2] = p[3] = 0.0F;
10496 save_MultiTexEnvfvEXT(texunit, target, pname, p);
10497 }
10498
10499
10500 void GLAPIENTRY
save_MultiTexEnvivEXT(GLenum texunit,GLenum target,GLenum pname,const GLint * param)10501 save_MultiTexEnvivEXT(GLenum texunit, GLenum target, GLenum pname, const GLint * param)
10502 {
10503 GLfloat p[4];
10504 if (pname == GL_TEXTURE_ENV_COLOR) {
10505 p[0] = INT_TO_FLOAT(param[0]);
10506 p[1] = INT_TO_FLOAT(param[1]);
10507 p[2] = INT_TO_FLOAT(param[2]);
10508 p[3] = INT_TO_FLOAT(param[3]);
10509 }
10510 else {
10511 p[0] = (GLfloat) param[0];
10512 p[1] = p[2] = p[3] = 0.0F;
10513 }
10514 save_MultiTexEnvfvEXT(texunit, target, pname, p);
10515 }
10516
10517
10518 void GLAPIENTRY
save_CompressedTextureImage1DEXT(GLuint texture,GLenum target,GLint level,GLenum internalFormat,GLsizei width,GLint border,GLsizei imageSize,const GLvoid * data)10519 save_CompressedTextureImage1DEXT(GLuint texture, GLenum target, GLint level,
10520 GLenum internalFormat, GLsizei width,
10521 GLint border, GLsizei imageSize,
10522 const GLvoid * data)
10523 {
10524 GET_CURRENT_CONTEXT(ctx);
10525 if (target == GL_PROXY_TEXTURE_1D) {
10526 /* don't compile, execute immediately */
10527 CALL_CompressedTextureImage1DEXT(ctx->Exec, (texture, target, level,
10528 internalFormat, width,
10529 border, imageSize,
10530 data));
10531 }
10532 else {
10533 Node *n;
10534 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10535
10536 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_IMAGE_1D,
10537 7 + POINTER_DWORDS);
10538 if (n) {
10539 n[1].ui = texture;
10540 n[2].e = target;
10541 n[3].i = level;
10542 n[4].e = internalFormat;
10543 n[5].i = (GLint) width;
10544 n[6].i = border;
10545 n[7].i = imageSize;
10546 save_pointer(&n[8],
10547 copy_data(data, imageSize, "glCompressedTextureImage1DEXT"));
10548 }
10549 if (ctx->ExecuteFlag) {
10550 CALL_CompressedTextureImage1DEXT(ctx->Exec,
10551 (texture, target, level, internalFormat,
10552 width, border, imageSize, data));
10553 }
10554 }
10555 }
10556
10557
10558 void GLAPIENTRY
save_CompressedTextureImage2DEXT(GLuint texture,GLenum target,GLint level,GLenum internalFormat,GLsizei width,GLsizei height,GLint border,GLsizei imageSize,const GLvoid * data)10559 save_CompressedTextureImage2DEXT(GLuint texture, GLenum target, GLint level,
10560 GLenum internalFormat, GLsizei width,
10561 GLsizei height, GLint border, GLsizei imageSize,
10562 const GLvoid * data)
10563 {
10564 GET_CURRENT_CONTEXT(ctx);
10565 if (target == GL_PROXY_TEXTURE_2D) {
10566 /* don't compile, execute immediately */
10567 CALL_CompressedTextureImage2DEXT(ctx->Exec, (texture, target, level,
10568 internalFormat, width, height,
10569 border, imageSize, data));
10570 }
10571 else {
10572 Node *n;
10573 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10574
10575 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_IMAGE_2D,
10576 8 + POINTER_DWORDS);
10577 if (n) {
10578 n[1].ui = texture;
10579 n[2].e = target;
10580 n[3].i = level;
10581 n[4].e = internalFormat;
10582 n[5].i = (GLint) width;
10583 n[6].i = (GLint) height;
10584 n[7].i = border;
10585 n[8].i = imageSize;
10586 save_pointer(&n[9],
10587 copy_data(data, imageSize, "glCompressedTextureImage2DEXT"));
10588 }
10589 if (ctx->ExecuteFlag) {
10590 CALL_CompressedTextureImage2DEXT(ctx->Exec,
10591 (texture, target, level, internalFormat,
10592 width, height, border, imageSize, data));
10593 }
10594 }
10595 }
10596
10597
10598 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)10599 save_CompressedTextureImage3DEXT(GLuint texture, GLenum target, GLint level,
10600 GLenum internalFormat, GLsizei width,
10601 GLsizei height, GLsizei depth, GLint border,
10602 GLsizei imageSize, const GLvoid * data)
10603 {
10604 GET_CURRENT_CONTEXT(ctx);
10605 if (target == GL_PROXY_TEXTURE_3D) {
10606 /* don't compile, execute immediately */
10607 CALL_CompressedTextureImage3DEXT(ctx->Exec, (texture, target, level,
10608 internalFormat, width,
10609 height, depth, border,
10610 imageSize, data));
10611 }
10612 else {
10613 Node *n;
10614 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10615
10616 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_IMAGE_3D,
10617 9 + POINTER_DWORDS);
10618 if (n) {
10619 n[1].ui = texture;
10620 n[2].e = target;
10621 n[3].i = level;
10622 n[4].e = internalFormat;
10623 n[5].i = (GLint) width;
10624 n[6].i = (GLint) height;
10625 n[7].i = (GLint) depth;
10626 n[8].i = border;
10627 n[9].i = imageSize;
10628 save_pointer(&n[10],
10629 copy_data(data, imageSize, "glCompressedTextureImage3DEXT"));
10630 }
10631 if (ctx->ExecuteFlag) {
10632 CALL_CompressedTextureImage3DEXT(ctx->Exec,
10633 (texture, target, level, internalFormat,
10634 width, height, depth, border, imageSize,
10635 data));
10636 }
10637 }
10638 }
10639
10640
10641 void GLAPIENTRY
save_CompressedTextureSubImage1DEXT(GLuint texture,GLenum target,GLint level,GLint xoffset,GLsizei width,GLenum format,GLsizei imageSize,const GLvoid * data)10642 save_CompressedTextureSubImage1DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset,
10643 GLsizei width, GLenum format,
10644 GLsizei imageSize, const GLvoid * data)
10645 {
10646 Node *n;
10647 GET_CURRENT_CONTEXT(ctx);
10648 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10649
10650 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_1D,
10651 7 + POINTER_DWORDS);
10652 if (n) {
10653 n[1].ui = texture;
10654 n[2].e = target;
10655 n[3].i = level;
10656 n[4].i = xoffset;
10657 n[5].i = (GLint) width;
10658 n[6].e = format;
10659 n[7].i = imageSize;
10660 save_pointer(&n[8],
10661 copy_data(data, imageSize, "glCompressedTextureSubImage1DEXT"));
10662 }
10663 if (ctx->ExecuteFlag) {
10664 CALL_CompressedTextureSubImage1DEXT(ctx->Exec, (texture, target, level, xoffset,
10665 width, format, imageSize, data));
10666 }
10667 }
10668
10669
10670 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)10671 save_CompressedTextureSubImage2DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset,
10672 GLint yoffset, GLsizei width, GLsizei height,
10673 GLenum format, GLsizei imageSize,
10674 const GLvoid * data)
10675 {
10676 Node *n;
10677 GET_CURRENT_CONTEXT(ctx);
10678 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10679
10680 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_2D,
10681 9 + POINTER_DWORDS);
10682 if (n) {
10683 n[1].ui = texture;
10684 n[2].e = target;
10685 n[3].i = level;
10686 n[4].i = xoffset;
10687 n[5].i = yoffset;
10688 n[6].i = (GLint) width;
10689 n[7].i = (GLint) height;
10690 n[8].e = format;
10691 n[9].i = imageSize;
10692 save_pointer(&n[10],
10693 copy_data(data, imageSize, "glCompressedTextureSubImage2DEXT"));
10694 }
10695 if (ctx->ExecuteFlag) {
10696 CALL_CompressedTextureSubImage2DEXT(ctx->Exec,
10697 (texture, target, level, xoffset, yoffset,
10698 width, height, format, imageSize, data));
10699 }
10700 }
10701
10702
10703 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)10704 save_CompressedTextureSubImage3DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset,
10705 GLint yoffset, GLint zoffset, GLsizei width,
10706 GLsizei height, GLsizei depth, GLenum format,
10707 GLsizei imageSize, const GLvoid * data)
10708 {
10709 Node *n;
10710 GET_CURRENT_CONTEXT(ctx);
10711 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10712
10713 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_3D,
10714 11 + POINTER_DWORDS);
10715 if (n) {
10716 n[1].ui = texture;
10717 n[2].e = target;
10718 n[3].i = level;
10719 n[4].i = xoffset;
10720 n[5].i = yoffset;
10721 n[6].i = zoffset;
10722 n[7].i = (GLint) width;
10723 n[8].i = (GLint) height;
10724 n[9].i = (GLint) depth;
10725 n[10].e = format;
10726 n[11].i = imageSize;
10727 save_pointer(&n[12],
10728 copy_data(data, imageSize, "glCompressedTextureSubImage3DEXT"));
10729 }
10730 if (ctx->ExecuteFlag) {
10731 CALL_CompressedTextureSubImage3DEXT(ctx->Exec,
10732 (texture, target, level, xoffset, yoffset,
10733 zoffset, width, height, depth, format,
10734 imageSize, data));
10735 }
10736 }
10737
10738
10739 void GLAPIENTRY
save_CompressedMultiTexImage1DEXT(GLenum texunit,GLenum target,GLint level,GLenum internalFormat,GLsizei width,GLint border,GLsizei imageSize,const GLvoid * data)10740 save_CompressedMultiTexImage1DEXT(GLenum texunit, GLenum target, GLint level,
10741 GLenum internalFormat, GLsizei width,
10742 GLint border, GLsizei imageSize,
10743 const GLvoid * data)
10744 {
10745 GET_CURRENT_CONTEXT(ctx);
10746 if (target == GL_PROXY_TEXTURE_1D) {
10747 /* don't compile, execute immediately */
10748 CALL_CompressedMultiTexImage1DEXT(ctx->Exec, (texunit, target, level,
10749 internalFormat, width,
10750 border, imageSize,
10751 data));
10752 }
10753 else {
10754 Node *n;
10755 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10756
10757 n = alloc_instruction(ctx, OPCODE_COMPRESSED_MULTITEX_IMAGE_1D,
10758 7 + POINTER_DWORDS);
10759 if (n) {
10760 n[1].e = texunit;
10761 n[2].e = target;
10762 n[3].i = level;
10763 n[4].e = internalFormat;
10764 n[5].i = (GLint) width;
10765 n[6].i = border;
10766 n[7].i = imageSize;
10767 save_pointer(&n[8],
10768 copy_data(data, imageSize, "glCompressedMultiTexImage1DEXT"));
10769 }
10770 if (ctx->ExecuteFlag) {
10771 CALL_CompressedMultiTexImage1DEXT(ctx->Exec,
10772 (texunit, target, level, internalFormat,
10773 width, border, imageSize, data));
10774 }
10775 }
10776 }
10777
10778
10779 void GLAPIENTRY
save_CompressedMultiTexImage2DEXT(GLenum texunit,GLenum target,GLint level,GLenum internalFormat,GLsizei width,GLsizei height,GLint border,GLsizei imageSize,const GLvoid * data)10780 save_CompressedMultiTexImage2DEXT(GLenum texunit, GLenum target, GLint level,
10781 GLenum internalFormat, GLsizei width,
10782 GLsizei height, GLint border, GLsizei imageSize,
10783 const GLvoid * data)
10784 {
10785 GET_CURRENT_CONTEXT(ctx);
10786 if (target == GL_PROXY_TEXTURE_2D) {
10787 /* don't compile, execute immediately */
10788 CALL_CompressedMultiTexImage2DEXT(ctx->Exec, (texunit, target, level,
10789 internalFormat, width, height,
10790 border, imageSize, data));
10791 }
10792 else {
10793 Node *n;
10794 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10795
10796 n = alloc_instruction(ctx, OPCODE_COMPRESSED_MULTITEX_IMAGE_2D,
10797 8 + POINTER_DWORDS);
10798 if (n) {
10799 n[1].e = texunit;
10800 n[2].e = target;
10801 n[3].i = level;
10802 n[4].e = internalFormat;
10803 n[5].i = (GLint) width;
10804 n[6].i = (GLint) height;
10805 n[7].i = border;
10806 n[8].i = imageSize;
10807 save_pointer(&n[9],
10808 copy_data(data, imageSize, "glCompressedMultiTexImage2DEXT"));
10809 }
10810 if (ctx->ExecuteFlag) {
10811 CALL_CompressedMultiTexImage2DEXT(ctx->Exec,
10812 (texunit, target, level, internalFormat,
10813 width, height, border, imageSize, data));
10814 }
10815 }
10816 }
10817
10818
10819 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)10820 save_CompressedMultiTexImage3DEXT(GLenum texunit, GLenum target, GLint level,
10821 GLenum internalFormat, GLsizei width,
10822 GLsizei height, GLsizei depth, GLint border,
10823 GLsizei imageSize, const GLvoid * data)
10824 {
10825 GET_CURRENT_CONTEXT(ctx);
10826 if (target == GL_PROXY_TEXTURE_3D) {
10827 /* don't compile, execute immediately */
10828 CALL_CompressedMultiTexImage3DEXT(ctx->Exec, (texunit, target, level,
10829 internalFormat, width,
10830 height, depth, border,
10831 imageSize, data));
10832 }
10833 else {
10834 Node *n;
10835 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10836
10837 n = alloc_instruction(ctx, OPCODE_COMPRESSED_MULTITEX_IMAGE_3D,
10838 9 + POINTER_DWORDS);
10839 if (n) {
10840 n[1].e = texunit;
10841 n[2].e = target;
10842 n[3].i = level;
10843 n[4].e = internalFormat;
10844 n[5].i = (GLint) width;
10845 n[6].i = (GLint) height;
10846 n[7].i = (GLint) depth;
10847 n[8].i = border;
10848 n[9].i = imageSize;
10849 save_pointer(&n[10],
10850 copy_data(data, imageSize, "glCompressedMultiTexImage3DEXT"));
10851 }
10852 if (ctx->ExecuteFlag) {
10853 CALL_CompressedMultiTexImage3DEXT(ctx->Exec,
10854 (texunit, target, level, internalFormat,
10855 width, height, depth, border, imageSize,
10856 data));
10857 }
10858 }
10859 }
10860
10861
10862 void GLAPIENTRY
save_CompressedMultiTexSubImage1DEXT(GLenum texunit,GLenum target,GLint level,GLint xoffset,GLsizei width,GLenum format,GLsizei imageSize,const GLvoid * data)10863 save_CompressedMultiTexSubImage1DEXT(GLenum texunit, GLenum target, GLint level, GLint xoffset,
10864 GLsizei width, GLenum format,
10865 GLsizei imageSize, const GLvoid * data)
10866 {
10867 Node *n;
10868 GET_CURRENT_CONTEXT(ctx);
10869 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10870
10871 n = alloc_instruction(ctx, OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_1D,
10872 7 + POINTER_DWORDS);
10873 if (n) {
10874 n[1].e = texunit;
10875 n[2].e = target;
10876 n[3].i = level;
10877 n[4].i = xoffset;
10878 n[5].i = (GLint) width;
10879 n[6].e = format;
10880 n[7].i = imageSize;
10881 save_pointer(&n[8],
10882 copy_data(data, imageSize, "glCompressedMultiTexSubImage1DEXT"));
10883 }
10884 if (ctx->ExecuteFlag) {
10885 CALL_CompressedMultiTexSubImage1DEXT(ctx->Exec, (texunit, target, level, xoffset,
10886 width, format, imageSize, data));
10887 }
10888 }
10889
10890
10891 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)10892 save_CompressedMultiTexSubImage2DEXT(GLenum texunit, GLenum target, GLint level, GLint xoffset,
10893 GLint yoffset, GLsizei width, GLsizei height,
10894 GLenum format, GLsizei imageSize,
10895 const GLvoid * data)
10896 {
10897 Node *n;
10898 GET_CURRENT_CONTEXT(ctx);
10899 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10900
10901 n = alloc_instruction(ctx, OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_2D,
10902 9 + POINTER_DWORDS);
10903 if (n) {
10904 n[1].e = texunit;
10905 n[2].e = target;
10906 n[3].i = level;
10907 n[4].i = xoffset;
10908 n[5].i = yoffset;
10909 n[6].i = (GLint) width;
10910 n[7].i = (GLint) height;
10911 n[8].e = format;
10912 n[9].i = imageSize;
10913 save_pointer(&n[10],
10914 copy_data(data, imageSize, "glCompressedMultiTexSubImage2DEXT"));
10915 }
10916 if (ctx->ExecuteFlag) {
10917 CALL_CompressedMultiTexSubImage2DEXT(ctx->Exec,
10918 (texunit, target, level, xoffset, yoffset,
10919 width, height, format, imageSize, data));
10920 }
10921 }
10922
10923
10924 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)10925 save_CompressedMultiTexSubImage3DEXT(GLenum texunit, GLenum target, GLint level, GLint xoffset,
10926 GLint yoffset, GLint zoffset, GLsizei width,
10927 GLsizei height, GLsizei depth, GLenum format,
10928 GLsizei imageSize, const GLvoid * data)
10929 {
10930 Node *n;
10931 GET_CURRENT_CONTEXT(ctx);
10932 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10933
10934 n = alloc_instruction(ctx, OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_3D,
10935 11 + POINTER_DWORDS);
10936 if (n) {
10937 n[1].e = texunit;
10938 n[2].e = target;
10939 n[3].i = level;
10940 n[4].i = xoffset;
10941 n[5].i = yoffset;
10942 n[6].i = zoffset;
10943 n[7].i = (GLint) width;
10944 n[8].i = (GLint) height;
10945 n[9].i = (GLint) depth;
10946 n[10].e = format;
10947 n[11].i = imageSize;
10948 save_pointer(&n[12],
10949 copy_data(data, imageSize, "glCompressedMultiTexSubImage3DEXT"));
10950 }
10951 if (ctx->ExecuteFlag) {
10952 CALL_CompressedMultiTexSubImage3DEXT(ctx->Exec,
10953 (texunit, target, level, xoffset, yoffset,
10954 zoffset, width, height, depth, format,
10955 imageSize, data));
10956 }
10957 }
10958
10959
10960 void GLAPIENTRY
save_NamedProgramStringEXT(GLuint program,GLenum target,GLenum format,GLsizei len,const GLvoid * string)10961 save_NamedProgramStringEXT(GLuint program, GLenum target, GLenum format, GLsizei len,
10962 const GLvoid * string)
10963 {
10964 GET_CURRENT_CONTEXT(ctx);
10965 Node *n;
10966
10967 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10968
10969 n = alloc_instruction(ctx, OPCODE_NAMED_PROGRAM_STRING, 4 + POINTER_DWORDS);
10970 if (n) {
10971 GLubyte *programCopy = malloc(len);
10972 if (!programCopy) {
10973 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glNamedProgramStringEXT");
10974 return;
10975 }
10976 memcpy(programCopy, string, len);
10977 n[1].ui = program;
10978 n[2].e = target;
10979 n[3].e = format;
10980 n[4].i = len;
10981 save_pointer(&n[5], programCopy);
10982 }
10983 if (ctx->ExecuteFlag) {
10984 CALL_NamedProgramStringEXT(ctx->Exec, (program, target, format, len, string));
10985 }
10986 }
10987
10988
10989 void GLAPIENTRY
save_NamedProgramLocalParameter4fEXT(GLuint program,GLenum target,GLuint index,GLfloat x,GLfloat y,GLfloat z,GLfloat w)10990 save_NamedProgramLocalParameter4fEXT(GLuint program, GLenum target, GLuint index,
10991 GLfloat x, GLfloat y, GLfloat z, GLfloat w)
10992 {
10993 GET_CURRENT_CONTEXT(ctx);
10994 Node *n;
10995 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10996 n = alloc_instruction(ctx, OPCODE_NAMED_PROGRAM_LOCAL_PARAMETER, 7);
10997 if (n) {
10998 n[1].ui = program;
10999 n[2].e = target;
11000 n[3].ui = index;
11001 n[4].f = x;
11002 n[5].f = y;
11003 n[6].f = z;
11004 n[7].f = w;
11005 }
11006 if (ctx->ExecuteFlag) {
11007 CALL_NamedProgramLocalParameter4fEXT(ctx->Exec, (program, target, index, x, y, z, w));
11008 }
11009 }
11010
11011
11012 void GLAPIENTRY
save_NamedProgramLocalParameter4fvEXT(GLuint program,GLenum target,GLuint index,const GLfloat * params)11013 save_NamedProgramLocalParameter4fvEXT(GLuint program, GLenum target, GLuint index,
11014 const GLfloat *params)
11015 {
11016 save_NamedProgramLocalParameter4fEXT(program, target, index, params[0],
11017 params[1], params[2], params[3]);
11018 }
11019
11020
11021 void GLAPIENTRY
save_NamedProgramLocalParameter4dEXT(GLuint program,GLenum target,GLuint index,GLdouble x,GLdouble y,GLdouble z,GLdouble w)11022 save_NamedProgramLocalParameter4dEXT(GLuint program, GLenum target, GLuint index,
11023 GLdouble x, GLdouble y,
11024 GLdouble z, GLdouble w)
11025 {
11026 save_NamedProgramLocalParameter4fEXT(program, target, index, (GLfloat) x,
11027 (GLfloat) y, (GLfloat) z, (GLfloat) w);
11028 }
11029
11030
11031 void GLAPIENTRY
save_NamedProgramLocalParameter4dvEXT(GLuint program,GLenum target,GLuint index,const GLdouble * params)11032 save_NamedProgramLocalParameter4dvEXT(GLuint program, GLenum target, GLuint index,
11033 const GLdouble *params)
11034 {
11035 save_NamedProgramLocalParameter4fEXT(program, target, index, (GLfloat) params[0],
11036 (GLfloat) params[1], (GLfloat) params[2],
11037 (GLfloat) params[3]);
11038 }
11039
11040 void GLAPIENTRY
save_PrimitiveBoundingBox(float minX,float minY,float minZ,float minW,float maxX,float maxY,float maxZ,float maxW)11041 save_PrimitiveBoundingBox(float minX, float minY, float minZ, float minW,
11042 float maxX, float maxY, float maxZ, float maxW)
11043 {
11044 GET_CURRENT_CONTEXT(ctx);
11045 Node *n;
11046 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
11047 n = alloc_instruction(ctx, OPCODE_PRIMITIVE_BOUNDING_BOX, 8);
11048 if (n) {
11049 n[1].f = minX;
11050 n[2].f = minY;
11051 n[3].f = minZ;
11052 n[4].f = minW;
11053 n[5].f = maxX;
11054 n[6].f = maxY;
11055 n[7].f = maxZ;
11056 n[8].f = maxW;
11057 }
11058 if (ctx->ExecuteFlag) {
11059 CALL_PrimitiveBoundingBox(ctx->Exec, (minX, minY, minZ, minW,
11060 maxX, maxY, maxZ, maxW));
11061 }
11062 }
11063
11064 /**
11065 * Save an error-generating command into display list.
11066 *
11067 * KW: Will appear in the list before the vertex buffer containing the
11068 * command that provoked the error. I don't see this as a problem.
11069 */
11070 static void
save_error(struct gl_context * ctx,GLenum error,const char * s)11071 save_error(struct gl_context *ctx, GLenum error, const char *s)
11072 {
11073 Node *n;
11074 n = alloc_instruction(ctx, OPCODE_ERROR, 1 + POINTER_DWORDS);
11075 if (n) {
11076 n[1].e = error;
11077 save_pointer(&n[2], (void *) s);
11078 /* note: the data/string here doesn't have to be freed in
11079 * _mesa_delete_list() since the string is never dynamically
11080 * allocated.
11081 */
11082 }
11083 }
11084
11085
11086 /**
11087 * Compile an error into current display list.
11088 */
11089 void
_mesa_compile_error(struct gl_context * ctx,GLenum error,const char * s)11090 _mesa_compile_error(struct gl_context *ctx, GLenum error, const char *s)
11091 {
11092 if (ctx->CompileFlag)
11093 save_error(ctx, error, s);
11094 if (ctx->ExecuteFlag)
11095 _mesa_error(ctx, error, "%s", s);
11096 }
11097
11098
11099 /**
11100 * Test if ID names a display list.
11101 */
11102 bool
_mesa_get_list(struct gl_context * ctx,GLuint list,struct gl_display_list ** dlist,bool locked)11103 _mesa_get_list(struct gl_context *ctx, GLuint list,
11104 struct gl_display_list **dlist,
11105 bool locked)
11106 {
11107 struct gl_display_list * dl =
11108 list > 0 ? _mesa_lookup_list(ctx, list, locked) : NULL;
11109
11110 if (dlist)
11111 *dlist = dl;
11112
11113 return dl != NULL;
11114 }
11115
11116
11117
11118 /**********************************************************************/
11119 /* Display list execution */
11120 /**********************************************************************/
11121
11122
11123 /*
11124 * Execute a display list. Note that the ListBase offset must have already
11125 * been added before calling this function. I.e. the list argument is
11126 * the absolute list number, not relative to ListBase.
11127 * Must be called with ctx->Shared->DisplayList locked.
11128 * \param list - display list number
11129 */
11130 static void
execute_list(struct gl_context * ctx,GLuint list)11131 execute_list(struct gl_context *ctx, GLuint list)
11132 {
11133 struct gl_display_list *dlist;
11134 Node *n;
11135
11136 if (list == 0 || !_mesa_get_list(ctx, list, &dlist, true))
11137 return;
11138
11139 n = get_list_head(ctx, dlist);
11140
11141 while (1) {
11142 const OpCode opcode = n[0].opcode;
11143
11144 switch (opcode) {
11145 case OPCODE_ERROR:
11146 _mesa_error(ctx, n[1].e, "%s", (const char *) get_pointer(&n[2]));
11147 break;
11148 case OPCODE_ACCUM:
11149 CALL_Accum(ctx->Exec, (n[1].e, n[2].f));
11150 break;
11151 case OPCODE_ALPHA_FUNC:
11152 CALL_AlphaFunc(ctx->Exec, (n[1].e, n[2].f));
11153 break;
11154 case OPCODE_BIND_TEXTURE:
11155 CALL_BindTexture(ctx->Exec, (n[1].e, n[2].ui));
11156 break;
11157 case OPCODE_BITMAP:
11158 {
11159 const struct gl_pixelstore_attrib save = ctx->Unpack;
11160 ctx->Unpack = ctx->DefaultPacking;
11161 CALL_Bitmap(ctx->Exec, ((GLsizei) n[1].i, (GLsizei) n[2].i,
11162 n[3].f, n[4].f, n[5].f, n[6].f,
11163 get_pointer(&n[7])));
11164 ctx->Unpack = save; /* restore */
11165 }
11166 break;
11167 case OPCODE_BLEND_COLOR:
11168 CALL_BlendColor(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
11169 break;
11170 case OPCODE_BLEND_EQUATION:
11171 CALL_BlendEquation(ctx->Exec, (n[1].e));
11172 break;
11173 case OPCODE_BLEND_EQUATION_SEPARATE:
11174 CALL_BlendEquationSeparate(ctx->Exec, (n[1].e, n[2].e));
11175 break;
11176 case OPCODE_BLEND_FUNC_SEPARATE:
11177 CALL_BlendFuncSeparate(ctx->Exec,
11178 (n[1].e, n[2].e, n[3].e, n[4].e));
11179 break;
11180
11181 case OPCODE_BLEND_FUNC_I:
11182 /* GL_ARB_draw_buffers_blend */
11183 CALL_BlendFunciARB(ctx->Exec, (n[1].ui, n[2].e, n[3].e));
11184 break;
11185 case OPCODE_BLEND_FUNC_SEPARATE_I:
11186 /* GL_ARB_draw_buffers_blend */
11187 CALL_BlendFuncSeparateiARB(ctx->Exec, (n[1].ui, n[2].e, n[3].e,
11188 n[4].e, n[5].e));
11189 break;
11190 case OPCODE_BLEND_EQUATION_I:
11191 /* GL_ARB_draw_buffers_blend */
11192 CALL_BlendEquationiARB(ctx->Exec, (n[1].ui, n[2].e));
11193 break;
11194 case OPCODE_BLEND_EQUATION_SEPARATE_I:
11195 /* GL_ARB_draw_buffers_blend */
11196 CALL_BlendEquationSeparateiARB(ctx->Exec,
11197 (n[1].ui, n[2].e, n[3].e));
11198 break;
11199
11200 case OPCODE_CALL_LIST:
11201 /* Generated by glCallList(), don't add ListBase */
11202 if (ctx->ListState.CallDepth < MAX_LIST_NESTING) {
11203 ctx->ListState.CallDepth++;
11204 execute_list(ctx, n[1].ui);
11205 ctx->ListState.CallDepth--;
11206 }
11207 break;
11208 case OPCODE_CALL_LISTS:
11209 if (ctx->ListState.CallDepth < MAX_LIST_NESTING) {
11210 ctx->ListState.CallDepth++;
11211 _mesa_HashUnlockMutex(ctx->Shared->DisplayList);
11212 CALL_CallLists(ctx->Exec, (n[1].i, n[2].e, get_pointer(&n[3])));
11213 _mesa_HashLockMutex(ctx->Shared->DisplayList);
11214 ctx->ListState.CallDepth--;
11215 }
11216 break;
11217 case OPCODE_CLEAR:
11218 CALL_Clear(ctx->Exec, (n[1].bf));
11219 break;
11220 case OPCODE_CLEAR_BUFFER_IV:
11221 {
11222 GLint value[4];
11223 value[0] = n[3].i;
11224 value[1] = n[4].i;
11225 value[2] = n[5].i;
11226 value[3] = n[6].i;
11227 CALL_ClearBufferiv(ctx->Exec, (n[1].e, n[2].i, value));
11228 }
11229 break;
11230 case OPCODE_CLEAR_BUFFER_UIV:
11231 {
11232 GLuint value[4];
11233 value[0] = n[3].ui;
11234 value[1] = n[4].ui;
11235 value[2] = n[5].ui;
11236 value[3] = n[6].ui;
11237 CALL_ClearBufferuiv(ctx->Exec, (n[1].e, n[2].i, value));
11238 }
11239 break;
11240 case OPCODE_CLEAR_BUFFER_FV:
11241 {
11242 GLfloat value[4];
11243 value[0] = n[3].f;
11244 value[1] = n[4].f;
11245 value[2] = n[5].f;
11246 value[3] = n[6].f;
11247 CALL_ClearBufferfv(ctx->Exec, (n[1].e, n[2].i, value));
11248 }
11249 break;
11250 case OPCODE_CLEAR_BUFFER_FI:
11251 CALL_ClearBufferfi(ctx->Exec, (n[1].e, n[2].i, n[3].f, n[4].i));
11252 break;
11253 case OPCODE_CLEAR_COLOR:
11254 CALL_ClearColor(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
11255 break;
11256 case OPCODE_CLEAR_ACCUM:
11257 CALL_ClearAccum(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
11258 break;
11259 case OPCODE_CLEAR_DEPTH:
11260 CALL_ClearDepth(ctx->Exec, ((GLclampd) n[1].f));
11261 break;
11262 case OPCODE_CLEAR_INDEX:
11263 CALL_ClearIndex(ctx->Exec, ((GLfloat) n[1].ui));
11264 break;
11265 case OPCODE_CLEAR_STENCIL:
11266 CALL_ClearStencil(ctx->Exec, (n[1].i));
11267 break;
11268 case OPCODE_CLIP_PLANE:
11269 {
11270 GLdouble eq[4];
11271 eq[0] = n[2].f;
11272 eq[1] = n[3].f;
11273 eq[2] = n[4].f;
11274 eq[3] = n[5].f;
11275 CALL_ClipPlane(ctx->Exec, (n[1].e, eq));
11276 }
11277 break;
11278 case OPCODE_COLOR_MASK:
11279 CALL_ColorMask(ctx->Exec, (n[1].b, n[2].b, n[3].b, n[4].b));
11280 break;
11281 case OPCODE_COLOR_MASK_INDEXED:
11282 CALL_ColorMaski(ctx->Exec, (n[1].ui, n[2].b, n[3].b,
11283 n[4].b, n[5].b));
11284 break;
11285 case OPCODE_COLOR_MATERIAL:
11286 CALL_ColorMaterial(ctx->Exec, (n[1].e, n[2].e));
11287 break;
11288 case OPCODE_COPY_PIXELS:
11289 CALL_CopyPixels(ctx->Exec, (n[1].i, n[2].i,
11290 (GLsizei) n[3].i, (GLsizei) n[4].i,
11291 n[5].e));
11292 break;
11293 case OPCODE_COPY_TEX_IMAGE1D:
11294 CALL_CopyTexImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].e, n[4].i,
11295 n[5].i, n[6].i, n[7].i));
11296 break;
11297 case OPCODE_COPY_TEX_IMAGE2D:
11298 CALL_CopyTexImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].e, n[4].i,
11299 n[5].i, n[6].i, n[7].i, n[8].i));
11300 break;
11301 case OPCODE_COPY_TEX_SUB_IMAGE1D:
11302 CALL_CopyTexSubImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
11303 n[4].i, n[5].i, n[6].i));
11304 break;
11305 case OPCODE_COPY_TEX_SUB_IMAGE2D:
11306 CALL_CopyTexSubImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
11307 n[4].i, n[5].i, n[6].i, n[7].i,
11308 n[8].i));
11309 break;
11310 case OPCODE_COPY_TEX_SUB_IMAGE3D:
11311 CALL_CopyTexSubImage3D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
11312 n[4].i, n[5].i, n[6].i, n[7].i,
11313 n[8].i, n[9].i));
11314 break;
11315 case OPCODE_CULL_FACE:
11316 CALL_CullFace(ctx->Exec, (n[1].e));
11317 break;
11318 case OPCODE_DEPTH_FUNC:
11319 CALL_DepthFunc(ctx->Exec, (n[1].e));
11320 break;
11321 case OPCODE_DEPTH_MASK:
11322 CALL_DepthMask(ctx->Exec, (n[1].b));
11323 break;
11324 case OPCODE_DEPTH_RANGE:
11325 CALL_DepthRange(ctx->Exec,
11326 ((GLclampd) n[1].f, (GLclampd) n[2].f));
11327 break;
11328 case OPCODE_DISABLE:
11329 CALL_Disable(ctx->Exec, (n[1].e));
11330 break;
11331 case OPCODE_DISABLE_INDEXED:
11332 CALL_Disablei(ctx->Exec, (n[1].ui, n[2].e));
11333 break;
11334 case OPCODE_DRAW_BUFFER:
11335 CALL_DrawBuffer(ctx->Exec, (n[1].e));
11336 break;
11337 case OPCODE_DRAW_PIXELS:
11338 {
11339 const struct gl_pixelstore_attrib save = ctx->Unpack;
11340 ctx->Unpack = ctx->DefaultPacking;
11341 CALL_DrawPixels(ctx->Exec, (n[1].i, n[2].i, n[3].e, n[4].e,
11342 get_pointer(&n[5])));
11343 ctx->Unpack = save; /* restore */
11344 }
11345 break;
11346 case OPCODE_ENABLE:
11347 CALL_Enable(ctx->Exec, (n[1].e));
11348 break;
11349 case OPCODE_ENABLE_INDEXED:
11350 CALL_Enablei(ctx->Exec, (n[1].ui, n[2].e));
11351 break;
11352 case OPCODE_EVALMESH1:
11353 CALL_EvalMesh1(ctx->Exec, (n[1].e, n[2].i, n[3].i));
11354 break;
11355 case OPCODE_EVALMESH2:
11356 CALL_EvalMesh2(ctx->Exec,
11357 (n[1].e, n[2].i, n[3].i, n[4].i, n[5].i));
11358 break;
11359 case OPCODE_FOG:
11360 {
11361 GLfloat p[4];
11362 p[0] = n[2].f;
11363 p[1] = n[3].f;
11364 p[2] = n[4].f;
11365 p[3] = n[5].f;
11366 CALL_Fogfv(ctx->Exec, (n[1].e, p));
11367 }
11368 break;
11369 case OPCODE_FRONT_FACE:
11370 CALL_FrontFace(ctx->Exec, (n[1].e));
11371 break;
11372 case OPCODE_FRUSTUM:
11373 CALL_Frustum(ctx->Exec,
11374 (n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f));
11375 break;
11376 case OPCODE_HINT:
11377 CALL_Hint(ctx->Exec, (n[1].e, n[2].e));
11378 break;
11379 case OPCODE_INDEX_MASK:
11380 CALL_IndexMask(ctx->Exec, (n[1].ui));
11381 break;
11382 case OPCODE_INIT_NAMES:
11383 CALL_InitNames(ctx->Exec, ());
11384 break;
11385 case OPCODE_LIGHT:
11386 {
11387 GLfloat p[4];
11388 p[0] = n[3].f;
11389 p[1] = n[4].f;
11390 p[2] = n[5].f;
11391 p[3] = n[6].f;
11392 CALL_Lightfv(ctx->Exec, (n[1].e, n[2].e, p));
11393 }
11394 break;
11395 case OPCODE_LIGHT_MODEL:
11396 {
11397 GLfloat p[4];
11398 p[0] = n[2].f;
11399 p[1] = n[3].f;
11400 p[2] = n[4].f;
11401 p[3] = n[5].f;
11402 CALL_LightModelfv(ctx->Exec, (n[1].e, p));
11403 }
11404 break;
11405 case OPCODE_LINE_STIPPLE:
11406 CALL_LineStipple(ctx->Exec, (n[1].i, n[2].us));
11407 break;
11408 case OPCODE_LINE_WIDTH:
11409 CALL_LineWidth(ctx->Exec, (n[1].f));
11410 break;
11411 case OPCODE_LIST_BASE:
11412 CALL_ListBase(ctx->Exec, (n[1].ui));
11413 break;
11414 case OPCODE_LOAD_IDENTITY:
11415 CALL_LoadIdentity(ctx->Exec, ());
11416 break;
11417 case OPCODE_LOAD_MATRIX:
11418 STATIC_ASSERT(sizeof(Node) == sizeof(GLfloat));
11419 CALL_LoadMatrixf(ctx->Exec, (&n[1].f));
11420 break;
11421 case OPCODE_LOAD_NAME:
11422 CALL_LoadName(ctx->Exec, (n[1].ui));
11423 break;
11424 case OPCODE_LOGIC_OP:
11425 CALL_LogicOp(ctx->Exec, (n[1].e));
11426 break;
11427 case OPCODE_MAP1:
11428 {
11429 GLenum target = n[1].e;
11430 GLint ustride = _mesa_evaluator_components(target);
11431 GLint uorder = n[5].i;
11432 GLfloat u1 = n[2].f;
11433 GLfloat u2 = n[3].f;
11434 CALL_Map1f(ctx->Exec, (target, u1, u2, ustride, uorder,
11435 (GLfloat *) get_pointer(&n[6])));
11436 }
11437 break;
11438 case OPCODE_MAP2:
11439 {
11440 GLenum target = n[1].e;
11441 GLfloat u1 = n[2].f;
11442 GLfloat u2 = n[3].f;
11443 GLfloat v1 = n[4].f;
11444 GLfloat v2 = n[5].f;
11445 GLint ustride = n[6].i;
11446 GLint vstride = n[7].i;
11447 GLint uorder = n[8].i;
11448 GLint vorder = n[9].i;
11449 CALL_Map2f(ctx->Exec, (target, u1, u2, ustride, uorder,
11450 v1, v2, vstride, vorder,
11451 (GLfloat *) get_pointer(&n[10])));
11452 }
11453 break;
11454 case OPCODE_MAPGRID1:
11455 CALL_MapGrid1f(ctx->Exec, (n[1].i, n[2].f, n[3].f));
11456 break;
11457 case OPCODE_MAPGRID2:
11458 CALL_MapGrid2f(ctx->Exec,
11459 (n[1].i, n[2].f, n[3].f, n[4].i, n[5].f, n[6].f));
11460 break;
11461 case OPCODE_MATRIX_MODE:
11462 CALL_MatrixMode(ctx->Exec, (n[1].e));
11463 break;
11464 case OPCODE_MULT_MATRIX:
11465 CALL_MultMatrixf(ctx->Exec, (&n[1].f));
11466 break;
11467 case OPCODE_ORTHO:
11468 CALL_Ortho(ctx->Exec,
11469 (n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f));
11470 break;
11471 case OPCODE_PASSTHROUGH:
11472 CALL_PassThrough(ctx->Exec, (n[1].f));
11473 break;
11474 case OPCODE_PATCH_PARAMETER_I:
11475 CALL_PatchParameteri(ctx->Exec, (n[1].e, n[2].i));
11476 break;
11477 case OPCODE_PATCH_PARAMETER_FV_INNER:
11478 {
11479 GLfloat params[2];
11480 params[0] = n[2].f;
11481 params[1] = n[3].f;
11482 CALL_PatchParameterfv(ctx->Exec, (n[1].e, params));
11483 }
11484 break;
11485 case OPCODE_PATCH_PARAMETER_FV_OUTER:
11486 {
11487 GLfloat params[4];
11488 params[0] = n[2].f;
11489 params[1] = n[3].f;
11490 params[2] = n[4].f;
11491 params[3] = n[5].f;
11492 CALL_PatchParameterfv(ctx->Exec, (n[1].e, params));
11493 }
11494 break;
11495 case OPCODE_PIXEL_MAP:
11496 CALL_PixelMapfv(ctx->Exec,
11497 (n[1].e, n[2].i, get_pointer(&n[3])));
11498 break;
11499 case OPCODE_PIXEL_TRANSFER:
11500 CALL_PixelTransferf(ctx->Exec, (n[1].e, n[2].f));
11501 break;
11502 case OPCODE_PIXEL_ZOOM:
11503 CALL_PixelZoom(ctx->Exec, (n[1].f, n[2].f));
11504 break;
11505 case OPCODE_POINT_SIZE:
11506 CALL_PointSize(ctx->Exec, (n[1].f));
11507 break;
11508 case OPCODE_POINT_PARAMETERS:
11509 {
11510 GLfloat params[3];
11511 params[0] = n[2].f;
11512 params[1] = n[3].f;
11513 params[2] = n[4].f;
11514 CALL_PointParameterfv(ctx->Exec, (n[1].e, params));
11515 }
11516 break;
11517 case OPCODE_POLYGON_MODE:
11518 CALL_PolygonMode(ctx->Exec, (n[1].e, n[2].e));
11519 break;
11520 case OPCODE_POLYGON_STIPPLE:
11521 {
11522 const struct gl_pixelstore_attrib save = ctx->Unpack;
11523 ctx->Unpack = ctx->DefaultPacking;
11524 CALL_PolygonStipple(ctx->Exec, (get_pointer(&n[1])));
11525 ctx->Unpack = save; /* restore */
11526 }
11527 break;
11528 case OPCODE_POLYGON_OFFSET:
11529 CALL_PolygonOffset(ctx->Exec, (n[1].f, n[2].f));
11530 break;
11531 case OPCODE_POLYGON_OFFSET_CLAMP:
11532 CALL_PolygonOffsetClampEXT(ctx->Exec, (n[1].f, n[2].f, n[3].f));
11533 break;
11534 case OPCODE_POP_ATTRIB:
11535 CALL_PopAttrib(ctx->Exec, ());
11536 break;
11537 case OPCODE_POP_MATRIX:
11538 CALL_PopMatrix(ctx->Exec, ());
11539 break;
11540 case OPCODE_POP_NAME:
11541 CALL_PopName(ctx->Exec, ());
11542 break;
11543 case OPCODE_PRIORITIZE_TEXTURE:
11544 CALL_PrioritizeTextures(ctx->Exec, (1, &n[1].ui, &n[2].f));
11545 break;
11546 case OPCODE_PUSH_ATTRIB:
11547 CALL_PushAttrib(ctx->Exec, (n[1].bf));
11548 break;
11549 case OPCODE_PUSH_MATRIX:
11550 CALL_PushMatrix(ctx->Exec, ());
11551 break;
11552 case OPCODE_PUSH_NAME:
11553 CALL_PushName(ctx->Exec, (n[1].ui));
11554 break;
11555 case OPCODE_RASTER_POS:
11556 CALL_RasterPos4f(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
11557 break;
11558 case OPCODE_READ_BUFFER:
11559 CALL_ReadBuffer(ctx->Exec, (n[1].e));
11560 break;
11561 case OPCODE_ROTATE:
11562 CALL_Rotatef(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
11563 break;
11564 case OPCODE_SCALE:
11565 CALL_Scalef(ctx->Exec, (n[1].f, n[2].f, n[3].f));
11566 break;
11567 case OPCODE_SCISSOR:
11568 CALL_Scissor(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
11569 break;
11570 case OPCODE_SHADE_MODEL:
11571 CALL_ShadeModel(ctx->Exec, (n[1].e));
11572 break;
11573 case OPCODE_PROVOKING_VERTEX:
11574 CALL_ProvokingVertex(ctx->Exec, (n[1].e));
11575 break;
11576 case OPCODE_STENCIL_FUNC:
11577 CALL_StencilFunc(ctx->Exec, (n[1].e, n[2].i, n[3].ui));
11578 break;
11579 case OPCODE_STENCIL_MASK:
11580 CALL_StencilMask(ctx->Exec, (n[1].ui));
11581 break;
11582 case OPCODE_STENCIL_OP:
11583 CALL_StencilOp(ctx->Exec, (n[1].e, n[2].e, n[3].e));
11584 break;
11585 case OPCODE_STENCIL_FUNC_SEPARATE:
11586 CALL_StencilFuncSeparate(ctx->Exec,
11587 (n[1].e, n[2].e, n[3].i, n[4].ui));
11588 break;
11589 case OPCODE_STENCIL_MASK_SEPARATE:
11590 CALL_StencilMaskSeparate(ctx->Exec, (n[1].e, n[2].ui));
11591 break;
11592 case OPCODE_STENCIL_OP_SEPARATE:
11593 CALL_StencilOpSeparate(ctx->Exec,
11594 (n[1].e, n[2].e, n[3].e, n[4].e));
11595 break;
11596 case OPCODE_TEXENV:
11597 {
11598 GLfloat params[4];
11599 params[0] = n[3].f;
11600 params[1] = n[4].f;
11601 params[2] = n[5].f;
11602 params[3] = n[6].f;
11603 CALL_TexEnvfv(ctx->Exec, (n[1].e, n[2].e, params));
11604 }
11605 break;
11606 case OPCODE_TEXGEN:
11607 {
11608 GLfloat params[4];
11609 params[0] = n[3].f;
11610 params[1] = n[4].f;
11611 params[2] = n[5].f;
11612 params[3] = n[6].f;
11613 CALL_TexGenfv(ctx->Exec, (n[1].e, n[2].e, params));
11614 }
11615 break;
11616 case OPCODE_TEXPARAMETER:
11617 {
11618 GLfloat params[4];
11619 params[0] = n[3].f;
11620 params[1] = n[4].f;
11621 params[2] = n[5].f;
11622 params[3] = n[6].f;
11623 CALL_TexParameterfv(ctx->Exec, (n[1].e, n[2].e, params));
11624 }
11625 break;
11626 case OPCODE_TEX_IMAGE1D:
11627 {
11628 const struct gl_pixelstore_attrib save = ctx->Unpack;
11629 ctx->Unpack = ctx->DefaultPacking;
11630 CALL_TexImage1D(ctx->Exec, (n[1].e, /* target */
11631 n[2].i, /* level */
11632 n[3].i, /* components */
11633 n[4].i, /* width */
11634 n[5].e, /* border */
11635 n[6].e, /* format */
11636 n[7].e, /* type */
11637 get_pointer(&n[8])));
11638 ctx->Unpack = save; /* restore */
11639 }
11640 break;
11641 case OPCODE_TEX_IMAGE2D:
11642 {
11643 const struct gl_pixelstore_attrib save = ctx->Unpack;
11644 ctx->Unpack = ctx->DefaultPacking;
11645 CALL_TexImage2D(ctx->Exec, (n[1].e, /* target */
11646 n[2].i, /* level */
11647 n[3].i, /* components */
11648 n[4].i, /* width */
11649 n[5].i, /* height */
11650 n[6].e, /* border */
11651 n[7].e, /* format */
11652 n[8].e, /* type */
11653 get_pointer(&n[9])));
11654 ctx->Unpack = save; /* restore */
11655 }
11656 break;
11657 case OPCODE_TEX_IMAGE3D:
11658 {
11659 const struct gl_pixelstore_attrib save = ctx->Unpack;
11660 ctx->Unpack = ctx->DefaultPacking;
11661 CALL_TexImage3D(ctx->Exec, (n[1].e, /* target */
11662 n[2].i, /* level */
11663 n[3].i, /* components */
11664 n[4].i, /* width */
11665 n[5].i, /* height */
11666 n[6].i, /* depth */
11667 n[7].e, /* border */
11668 n[8].e, /* format */
11669 n[9].e, /* type */
11670 get_pointer(&n[10])));
11671 ctx->Unpack = save; /* restore */
11672 }
11673 break;
11674 case OPCODE_TEX_SUB_IMAGE1D:
11675 {
11676 const struct gl_pixelstore_attrib save = ctx->Unpack;
11677 ctx->Unpack = ctx->DefaultPacking;
11678 CALL_TexSubImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
11679 n[4].i, n[5].e,
11680 n[6].e, get_pointer(&n[7])));
11681 ctx->Unpack = save; /* restore */
11682 }
11683 break;
11684 case OPCODE_TEX_SUB_IMAGE2D:
11685 {
11686 const struct gl_pixelstore_attrib save = ctx->Unpack;
11687 ctx->Unpack = ctx->DefaultPacking;
11688 CALL_TexSubImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
11689 n[4].i, n[5].e,
11690 n[6].i, n[7].e, n[8].e,
11691 get_pointer(&n[9])));
11692 ctx->Unpack = save; /* restore */
11693 }
11694 break;
11695 case OPCODE_TEX_SUB_IMAGE3D:
11696 {
11697 const struct gl_pixelstore_attrib save = ctx->Unpack;
11698 ctx->Unpack = ctx->DefaultPacking;
11699 CALL_TexSubImage3D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
11700 n[4].i, n[5].i, n[6].i, n[7].i,
11701 n[8].i, n[9].e, n[10].e,
11702 get_pointer(&n[11])));
11703 ctx->Unpack = save; /* restore */
11704 }
11705 break;
11706 case OPCODE_TRANSLATE:
11707 CALL_Translatef(ctx->Exec, (n[1].f, n[2].f, n[3].f));
11708 break;
11709 case OPCODE_VIEWPORT:
11710 CALL_Viewport(ctx->Exec, (n[1].i, n[2].i,
11711 (GLsizei) n[3].i, (GLsizei) n[4].i));
11712 break;
11713 case OPCODE_WINDOW_POS:
11714 CALL_WindowPos4fMESA(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
11715 break;
11716 case OPCODE_VIEWPORT_ARRAY_V:
11717 CALL_ViewportArrayv(ctx->Exec, (n[1].ui, n[2].si,
11718 get_pointer(&n[3])));
11719 break;
11720 case OPCODE_VIEWPORT_INDEXED_F:
11721 CALL_ViewportIndexedf(ctx->Exec, (n[1].ui, n[2].f, n[3].f, n[4].f,
11722 n[5].f));
11723 break;
11724 case OPCODE_VIEWPORT_INDEXED_FV: {
11725 GLfloat v[4];
11726 v[0] = n[2].f;
11727 v[1] = n[3].f;
11728 v[2] = n[4].f;
11729 v[3] = n[5].f;
11730 CALL_ViewportIndexedfv(ctx->Exec, (n[1].ui, v));
11731 break;
11732 }
11733 case OPCODE_SCISSOR_ARRAY_V:
11734 CALL_ScissorArrayv(ctx->Exec, (n[1].ui, n[2].si,
11735 get_pointer(&n[3])));
11736 break;
11737 case OPCODE_SCISSOR_INDEXED:
11738 CALL_ScissorIndexed(ctx->Exec, (n[1].ui, n[2].i, n[3].i, n[4].si,
11739 n[5].si));
11740 break;
11741 case OPCODE_SCISSOR_INDEXED_V: {
11742 GLint v[4];
11743 v[0] = n[2].i;
11744 v[1] = n[3].i;
11745 v[2] = n[4].si;
11746 v[3] = n[5].si;
11747 CALL_ScissorIndexedv(ctx->Exec, (n[1].ui, v));
11748 break;
11749 }
11750 case OPCODE_DEPTH_ARRAY_V:
11751 CALL_DepthRangeArrayv(ctx->Exec, (n[1].ui, n[2].si,
11752 get_pointer(&n[3])));
11753 break;
11754 case OPCODE_DEPTH_INDEXED:
11755 CALL_DepthRangeIndexed(ctx->Exec, (n[1].ui, n[2].f, n[3].f));
11756 break;
11757 case OPCODE_ACTIVE_TEXTURE: /* GL_ARB_multitexture */
11758 CALL_ActiveTexture(ctx->Exec, (n[1].e));
11759 break;
11760 case OPCODE_COMPRESSED_TEX_IMAGE_1D: /* GL_ARB_texture_compression */
11761 CALL_CompressedTexImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].e,
11762 n[4].i, n[5].i, n[6].i,
11763 get_pointer(&n[7])));
11764 break;
11765 case OPCODE_COMPRESSED_TEX_IMAGE_2D: /* GL_ARB_texture_compression */
11766 CALL_CompressedTexImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].e,
11767 n[4].i, n[5].i, n[6].i,
11768 n[7].i, get_pointer(&n[8])));
11769 break;
11770 case OPCODE_COMPRESSED_TEX_IMAGE_3D: /* GL_ARB_texture_compression */
11771 CALL_CompressedTexImage3D(ctx->Exec, (n[1].e, n[2].i, n[3].e,
11772 n[4].i, n[5].i, n[6].i,
11773 n[7].i, n[8].i,
11774 get_pointer(&n[9])));
11775 break;
11776 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D: /* GL_ARB_texture_compress */
11777 CALL_CompressedTexSubImage1D(ctx->Exec,
11778 (n[1].e, n[2].i, n[3].i, n[4].i,
11779 n[5].e, n[6].i,
11780 get_pointer(&n[7])));
11781 break;
11782 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D: /* GL_ARB_texture_compress */
11783 CALL_CompressedTexSubImage2D(ctx->Exec,
11784 (n[1].e, n[2].i, n[3].i, n[4].i,
11785 n[5].i, n[6].i, n[7].e, n[8].i,
11786 get_pointer(&n[9])));
11787 break;
11788 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D: /* GL_ARB_texture_compress */
11789 CALL_CompressedTexSubImage3D(ctx->Exec,
11790 (n[1].e, n[2].i, n[3].i, n[4].i,
11791 n[5].i, n[6].i, n[7].i, n[8].i,
11792 n[9].e, n[10].i,
11793 get_pointer(&n[11])));
11794 break;
11795 case OPCODE_SAMPLE_COVERAGE: /* GL_ARB_multisample */
11796 CALL_SampleCoverage(ctx->Exec, (n[1].f, n[2].b));
11797 break;
11798 case OPCODE_WINDOW_POS_ARB: /* GL_ARB_window_pos */
11799 CALL_WindowPos3f(ctx->Exec, (n[1].f, n[2].f, n[3].f));
11800 break;
11801 case OPCODE_BIND_PROGRAM_ARB: /* GL_ARB_vertex_program */
11802 CALL_BindProgramARB(ctx->Exec, (n[1].e, n[2].ui));
11803 break;
11804 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB:
11805 CALL_ProgramLocalParameter4fARB(ctx->Exec,
11806 (n[1].e, n[2].ui, n[3].f, n[4].f,
11807 n[5].f, n[6].f));
11808 break;
11809 case OPCODE_ACTIVE_STENCIL_FACE_EXT:
11810 CALL_ActiveStencilFaceEXT(ctx->Exec, (n[1].e));
11811 break;
11812 case OPCODE_DEPTH_BOUNDS_EXT:
11813 CALL_DepthBoundsEXT(ctx->Exec, (n[1].f, n[2].f));
11814 break;
11815 case OPCODE_PROGRAM_STRING_ARB:
11816 CALL_ProgramStringARB(ctx->Exec,
11817 (n[1].e, n[2].e, n[3].i,
11818 get_pointer(&n[4])));
11819 break;
11820 case OPCODE_PROGRAM_ENV_PARAMETER_ARB:
11821 CALL_ProgramEnvParameter4fARB(ctx->Exec, (n[1].e, n[2].ui, n[3].f,
11822 n[4].f, n[5].f,
11823 n[6].f));
11824 break;
11825 case OPCODE_BEGIN_QUERY_ARB:
11826 CALL_BeginQuery(ctx->Exec, (n[1].e, n[2].ui));
11827 break;
11828 case OPCODE_END_QUERY_ARB:
11829 CALL_EndQuery(ctx->Exec, (n[1].e));
11830 break;
11831 case OPCODE_QUERY_COUNTER:
11832 CALL_QueryCounter(ctx->Exec, (n[1].ui, n[2].e));
11833 break;
11834 case OPCODE_BEGIN_QUERY_INDEXED:
11835 CALL_BeginQueryIndexed(ctx->Exec, (n[1].e, n[2].ui, n[3].ui));
11836 break;
11837 case OPCODE_END_QUERY_INDEXED:
11838 CALL_EndQueryIndexed(ctx->Exec, (n[1].e, n[2].ui));
11839 break;
11840 case OPCODE_DRAW_BUFFERS_ARB:
11841 {
11842 GLenum buffers[MAX_DRAW_BUFFERS];
11843 GLint i, count = MIN2(n[1].i, MAX_DRAW_BUFFERS);
11844 for (i = 0; i < count; i++)
11845 buffers[i] = n[2 + i].e;
11846 CALL_DrawBuffers(ctx->Exec, (n[1].i, buffers));
11847 }
11848 break;
11849 case OPCODE_BLIT_FRAMEBUFFER:
11850 CALL_BlitFramebuffer(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i,
11851 n[5].i, n[6].i, n[7].i, n[8].i,
11852 n[9].i, n[10].e));
11853 break;
11854 case OPCODE_PRIMITIVE_RESTART_NV:
11855 CALL_PrimitiveRestartNV(ctx->Exec, ());
11856 break;
11857
11858 case OPCODE_USE_PROGRAM:
11859 CALL_UseProgram(ctx->Exec, (n[1].ui));
11860 break;
11861 case OPCODE_UNIFORM_1F:
11862 CALL_Uniform1f(ctx->Exec, (n[1].i, n[2].f));
11863 break;
11864 case OPCODE_UNIFORM_2F:
11865 CALL_Uniform2f(ctx->Exec, (n[1].i, n[2].f, n[3].f));
11866 break;
11867 case OPCODE_UNIFORM_3F:
11868 CALL_Uniform3f(ctx->Exec, (n[1].i, n[2].f, n[3].f, n[4].f));
11869 break;
11870 case OPCODE_UNIFORM_4F:
11871 CALL_Uniform4f(ctx->Exec,
11872 (n[1].i, n[2].f, n[3].f, n[4].f, n[5].f));
11873 break;
11874 case OPCODE_UNIFORM_1FV:
11875 CALL_Uniform1fv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11876 break;
11877 case OPCODE_UNIFORM_2FV:
11878 CALL_Uniform2fv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11879 break;
11880 case OPCODE_UNIFORM_3FV:
11881 CALL_Uniform3fv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11882 break;
11883 case OPCODE_UNIFORM_4FV:
11884 CALL_Uniform4fv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11885 break;
11886 case OPCODE_UNIFORM_1D: {
11887 union float64_pair x;
11888
11889 x.uint32[0] = n[2].ui;
11890 x.uint32[1] = n[3].ui;
11891
11892 CALL_Uniform1d(ctx->Exec, (n[1].i, x.d));
11893 break;
11894 }
11895 case OPCODE_UNIFORM_2D: {
11896 union float64_pair x;
11897 union float64_pair y;
11898
11899 x.uint32[0] = n[2].ui;
11900 x.uint32[1] = n[3].ui;
11901 y.uint32[0] = n[4].ui;
11902 y.uint32[1] = n[5].ui;
11903
11904 CALL_Uniform2d(ctx->Exec, (n[1].i, x.d, y.d));
11905 break;
11906 }
11907 case OPCODE_UNIFORM_3D: {
11908 union float64_pair x;
11909 union float64_pair y;
11910 union float64_pair z;
11911
11912 x.uint32[0] = n[2].ui;
11913 x.uint32[1] = n[3].ui;
11914 y.uint32[0] = n[4].ui;
11915 y.uint32[1] = n[5].ui;
11916 z.uint32[0] = n[6].ui;
11917 z.uint32[1] = n[7].ui;
11918
11919 CALL_Uniform3d(ctx->Exec, (n[1].i, x.d, y.d, z.d));
11920 break;
11921 }
11922 case OPCODE_UNIFORM_4D: {
11923 union float64_pair x;
11924 union float64_pair y;
11925 union float64_pair z;
11926 union float64_pair w;
11927
11928 x.uint32[0] = n[2].ui;
11929 x.uint32[1] = n[3].ui;
11930 y.uint32[0] = n[4].ui;
11931 y.uint32[1] = n[5].ui;
11932 z.uint32[0] = n[6].ui;
11933 z.uint32[1] = n[7].ui;
11934 w.uint32[0] = n[8].ui;
11935 w.uint32[1] = n[9].ui;
11936
11937 CALL_Uniform4d(ctx->Exec, (n[1].i, x.d, y.d, z.d, w.d));
11938 break;
11939 }
11940 case OPCODE_UNIFORM_1DV:
11941 CALL_Uniform1dv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11942 break;
11943 case OPCODE_UNIFORM_2DV:
11944 CALL_Uniform2dv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11945 break;
11946 case OPCODE_UNIFORM_3DV:
11947 CALL_Uniform3dv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11948 break;
11949 case OPCODE_UNIFORM_4DV:
11950 CALL_Uniform4dv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11951 break;
11952 case OPCODE_UNIFORM_1I:
11953 CALL_Uniform1i(ctx->Exec, (n[1].i, n[2].i));
11954 break;
11955 case OPCODE_UNIFORM_2I:
11956 CALL_Uniform2i(ctx->Exec, (n[1].i, n[2].i, n[3].i));
11957 break;
11958 case OPCODE_UNIFORM_3I:
11959 CALL_Uniform3i(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
11960 break;
11961 case OPCODE_UNIFORM_4I:
11962 CALL_Uniform4i(ctx->Exec,
11963 (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
11964 break;
11965 case OPCODE_UNIFORM_1IV:
11966 CALL_Uniform1iv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11967 break;
11968 case OPCODE_UNIFORM_2IV:
11969 CALL_Uniform2iv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11970 break;
11971 case OPCODE_UNIFORM_3IV:
11972 CALL_Uniform3iv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11973 break;
11974 case OPCODE_UNIFORM_4IV:
11975 CALL_Uniform4iv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11976 break;
11977 case OPCODE_UNIFORM_1UI:
11978 CALL_Uniform1ui(ctx->Exec, (n[1].i, n[2].i));
11979 break;
11980 case OPCODE_UNIFORM_2UI:
11981 CALL_Uniform2ui(ctx->Exec, (n[1].i, n[2].i, n[3].i));
11982 break;
11983 case OPCODE_UNIFORM_3UI:
11984 CALL_Uniform3ui(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
11985 break;
11986 case OPCODE_UNIFORM_4UI:
11987 CALL_Uniform4ui(ctx->Exec,
11988 (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
11989 break;
11990 case OPCODE_UNIFORM_1UIV:
11991 CALL_Uniform1uiv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11992 break;
11993 case OPCODE_UNIFORM_2UIV:
11994 CALL_Uniform2uiv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11995 break;
11996 case OPCODE_UNIFORM_3UIV:
11997 CALL_Uniform3uiv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
11998 break;
11999 case OPCODE_UNIFORM_4UIV:
12000 CALL_Uniform4uiv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12001 break;
12002 case OPCODE_UNIFORM_MATRIX22:
12003 CALL_UniformMatrix2fv(ctx->Exec,
12004 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12005 break;
12006 case OPCODE_UNIFORM_MATRIX33:
12007 CALL_UniformMatrix3fv(ctx->Exec,
12008 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12009 break;
12010 case OPCODE_UNIFORM_MATRIX44:
12011 CALL_UniformMatrix4fv(ctx->Exec,
12012 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12013 break;
12014 case OPCODE_UNIFORM_MATRIX23:
12015 CALL_UniformMatrix2x3fv(ctx->Exec,
12016 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12017 break;
12018 case OPCODE_UNIFORM_MATRIX32:
12019 CALL_UniformMatrix3x2fv(ctx->Exec,
12020 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12021 break;
12022 case OPCODE_UNIFORM_MATRIX24:
12023 CALL_UniformMatrix2x4fv(ctx->Exec,
12024 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12025 break;
12026 case OPCODE_UNIFORM_MATRIX42:
12027 CALL_UniformMatrix4x2fv(ctx->Exec,
12028 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12029 break;
12030 case OPCODE_UNIFORM_MATRIX34:
12031 CALL_UniformMatrix3x4fv(ctx->Exec,
12032 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12033 break;
12034 case OPCODE_UNIFORM_MATRIX43:
12035 CALL_UniformMatrix4x3fv(ctx->Exec,
12036 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12037 break;
12038 case OPCODE_UNIFORM_MATRIX22D:
12039 CALL_UniformMatrix2dv(ctx->Exec,
12040 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12041 break;
12042 case OPCODE_UNIFORM_MATRIX33D:
12043 CALL_UniformMatrix3dv(ctx->Exec,
12044 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12045 break;
12046 case OPCODE_UNIFORM_MATRIX44D:
12047 CALL_UniformMatrix4dv(ctx->Exec,
12048 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12049 break;
12050 case OPCODE_UNIFORM_MATRIX23D:
12051 CALL_UniformMatrix2x3dv(ctx->Exec,
12052 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12053 break;
12054 case OPCODE_UNIFORM_MATRIX32D:
12055 CALL_UniformMatrix3x2dv(ctx->Exec,
12056 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12057 break;
12058 case OPCODE_UNIFORM_MATRIX24D:
12059 CALL_UniformMatrix2x4dv(ctx->Exec,
12060 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12061 break;
12062 case OPCODE_UNIFORM_MATRIX42D:
12063 CALL_UniformMatrix4x2dv(ctx->Exec,
12064 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12065 break;
12066 case OPCODE_UNIFORM_MATRIX34D:
12067 CALL_UniformMatrix3x4dv(ctx->Exec,
12068 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12069 break;
12070 case OPCODE_UNIFORM_MATRIX43D:
12071 CALL_UniformMatrix4x3dv(ctx->Exec,
12072 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12073 break;
12074
12075 case OPCODE_UNIFORM_1I64: {
12076 union int64_pair x;
12077
12078 x.int32[0] = n[2].i;
12079 x.int32[1] = n[3].i;
12080
12081 CALL_Uniform1i64ARB(ctx->Exec, (n[1].i, x.int64));
12082 break;
12083 }
12084 case OPCODE_UNIFORM_2I64: {
12085 union int64_pair x;
12086 union int64_pair y;
12087
12088 x.int32[0] = n[2].i;
12089 x.int32[1] = n[3].i;
12090 y.int32[0] = n[4].i;
12091 y.int32[1] = n[5].i;
12092
12093 CALL_Uniform2i64ARB(ctx->Exec, (n[1].i, x.int64, y.int64));
12094 break;
12095 }
12096 case OPCODE_UNIFORM_3I64: {
12097 union int64_pair x;
12098 union int64_pair y;
12099 union int64_pair z;
12100
12101 x.int32[0] = n[2].i;
12102 x.int32[1] = n[3].i;
12103 y.int32[0] = n[4].i;
12104 y.int32[1] = n[5].i;
12105 z.int32[0] = n[6].i;
12106 z.int32[1] = n[7].i;
12107
12108
12109 CALL_Uniform3i64ARB(ctx->Exec, (n[1].i, x.int64, y.int64, z.int64));
12110 break;
12111 }
12112 case OPCODE_UNIFORM_4I64: {
12113 union int64_pair x;
12114 union int64_pair y;
12115 union int64_pair z;
12116 union int64_pair w;
12117
12118 x.int32[0] = n[2].i;
12119 x.int32[1] = n[3].i;
12120 y.int32[0] = n[4].i;
12121 y.int32[1] = n[5].i;
12122 z.int32[0] = n[6].i;
12123 z.int32[1] = n[7].i;
12124 w.int32[0] = n[8].i;
12125 w.int32[1] = n[9].i;
12126
12127 CALL_Uniform4i64ARB(ctx->Exec, (n[1].i, x.int64, y.int64, z.int64, w.int64));
12128 break;
12129 }
12130 case OPCODE_UNIFORM_1I64V:
12131 CALL_Uniform1i64vARB(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12132 break;
12133 case OPCODE_UNIFORM_2I64V:
12134 CALL_Uniform2i64vARB(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12135 break;
12136 case OPCODE_UNIFORM_3I64V:
12137 CALL_Uniform3i64vARB(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12138 break;
12139 case OPCODE_UNIFORM_4I64V:
12140 CALL_Uniform4i64vARB(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12141 break;
12142 case OPCODE_UNIFORM_1UI64: {
12143 union uint64_pair x;
12144
12145 x.uint32[0] = n[2].ui;
12146 x.uint32[1] = n[3].ui;
12147
12148 CALL_Uniform1ui64ARB(ctx->Exec, (n[1].i, x.uint64));
12149 break;
12150 }
12151 case OPCODE_UNIFORM_2UI64: {
12152 union uint64_pair x;
12153 union uint64_pair y;
12154
12155 x.uint32[0] = n[2].ui;
12156 x.uint32[1] = n[3].ui;
12157 y.uint32[0] = n[4].ui;
12158 y.uint32[1] = n[5].ui;
12159
12160 CALL_Uniform2ui64ARB(ctx->Exec, (n[1].i, x.uint64, y.uint64));
12161 break;
12162 }
12163 case OPCODE_UNIFORM_3UI64: {
12164 union uint64_pair x;
12165 union uint64_pair y;
12166 union uint64_pair z;
12167
12168 x.uint32[0] = n[2].ui;
12169 x.uint32[1] = n[3].ui;
12170 y.uint32[0] = n[4].ui;
12171 y.uint32[1] = n[5].ui;
12172 z.uint32[0] = n[6].ui;
12173 z.uint32[1] = n[7].ui;
12174
12175
12176 CALL_Uniform3ui64ARB(ctx->Exec, (n[1].i, x.uint64, y.uint64,
12177 z.uint64));
12178 break;
12179 }
12180 case OPCODE_UNIFORM_4UI64: {
12181 union uint64_pair x;
12182 union uint64_pair y;
12183 union uint64_pair z;
12184 union uint64_pair w;
12185
12186 x.uint32[0] = n[2].ui;
12187 x.uint32[1] = n[3].ui;
12188 y.uint32[0] = n[4].ui;
12189 y.uint32[1] = n[5].ui;
12190 z.uint32[0] = n[6].ui;
12191 z.uint32[1] = n[7].ui;
12192 w.uint32[0] = n[8].ui;
12193 w.uint32[1] = n[9].ui;
12194
12195 CALL_Uniform4ui64ARB(ctx->Exec, (n[1].i, x.uint64, y.uint64,
12196 z.uint64, w.uint64));
12197 break;
12198 }
12199 case OPCODE_UNIFORM_1UI64V:
12200 CALL_Uniform1ui64vARB(ctx->Exec, (n[1].i, n[2].i,
12201 get_pointer(&n[3])));
12202 break;
12203 case OPCODE_UNIFORM_2UI64V:
12204 CALL_Uniform2ui64vARB(ctx->Exec, (n[1].i, n[2].i,
12205 get_pointer(&n[3])));
12206 break;
12207 case OPCODE_UNIFORM_3UI64V:
12208 CALL_Uniform3ui64vARB(ctx->Exec, (n[1].i, n[2].i,
12209 get_pointer(&n[3])));
12210 break;
12211 case OPCODE_UNIFORM_4UI64V:
12212 CALL_Uniform4ui64vARB(ctx->Exec, (n[1].i, n[2].i,
12213 get_pointer(&n[3])));
12214 break;
12215
12216 case OPCODE_PROGRAM_UNIFORM_1I64: {
12217 union int64_pair x;
12218
12219 x.int32[0] = n[3].i;
12220 x.int32[1] = n[4].i;
12221
12222 CALL_ProgramUniform1i64ARB(ctx->Exec, (n[1].ui, n[2].i, x.int64));
12223 break;
12224 }
12225 case OPCODE_PROGRAM_UNIFORM_2I64: {
12226 union int64_pair x;
12227 union int64_pair y;
12228
12229 x.int32[0] = n[3].i;
12230 x.int32[1] = n[4].i;
12231 y.int32[0] = n[5].i;
12232 y.int32[1] = n[6].i;
12233
12234 CALL_ProgramUniform2i64ARB(ctx->Exec, (n[1].ui, n[2].i, x.int64,
12235 y.int64));
12236 break;
12237 }
12238 case OPCODE_PROGRAM_UNIFORM_3I64: {
12239 union int64_pair x;
12240 union int64_pair y;
12241 union int64_pair z;
12242
12243 x.int32[0] = n[3].i;
12244 x.int32[1] = n[4].i;
12245 y.int32[0] = n[5].i;
12246 y.int32[1] = n[6].i;
12247 z.int32[0] = n[7].i;
12248 z.int32[1] = n[8].i;
12249
12250 CALL_ProgramUniform3i64ARB(ctx->Exec, (n[1].ui, n[2].i, x.int64,
12251 y.int64, z.int64));
12252 break;
12253 }
12254 case OPCODE_PROGRAM_UNIFORM_4I64: {
12255 union int64_pair x;
12256 union int64_pair y;
12257 union int64_pair z;
12258 union int64_pair w;
12259
12260 x.int32[0] = n[3].i;
12261 x.int32[1] = n[4].i;
12262 y.int32[0] = n[5].i;
12263 y.int32[1] = n[6].i;
12264 z.int32[0] = n[7].i;
12265 z.int32[1] = n[8].i;
12266 w.int32[0] = n[9].i;
12267 w.int32[1] = n[10].i;
12268
12269 CALL_ProgramUniform4i64ARB(ctx->Exec, (n[1].ui, n[2].i, x.int64,
12270 y.int64, z.int64, w.int64));
12271 break;
12272 }
12273 case OPCODE_PROGRAM_UNIFORM_1I64V:
12274 CALL_ProgramUniform1i64vARB(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12275 get_pointer(&n[4])));
12276 break;
12277 case OPCODE_PROGRAM_UNIFORM_2I64V:
12278 CALL_ProgramUniform2i64vARB(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12279 get_pointer(&n[4])));
12280 break;
12281 case OPCODE_PROGRAM_UNIFORM_3I64V:
12282 CALL_ProgramUniform3i64vARB(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12283 get_pointer(&n[4])));
12284 break;
12285 case OPCODE_PROGRAM_UNIFORM_4I64V:
12286 CALL_ProgramUniform4i64vARB(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12287 get_pointer(&n[4])));
12288 break;
12289 case OPCODE_PROGRAM_UNIFORM_1UI64: {
12290 union uint64_pair x;
12291
12292 x.uint32[0] = n[3].ui;
12293 x.uint32[1] = n[4].ui;
12294
12295 CALL_ProgramUniform1i64ARB(ctx->Exec, (n[1].ui, n[2].i, x.uint64));
12296 break;
12297 }
12298 case OPCODE_PROGRAM_UNIFORM_2UI64: {
12299 union uint64_pair x;
12300 union uint64_pair y;
12301
12302 x.uint32[0] = n[3].ui;
12303 x.uint32[1] = n[4].ui;
12304 y.uint32[0] = n[5].ui;
12305 y.uint32[1] = n[6].ui;
12306
12307 CALL_ProgramUniform2ui64ARB(ctx->Exec, (n[1].ui, n[2].i, x.uint64,
12308 y.uint64));
12309 break;
12310 }
12311 case OPCODE_PROGRAM_UNIFORM_3UI64: {
12312 union uint64_pair x;
12313 union uint64_pair y;
12314 union uint64_pair z;
12315
12316 x.uint32[0] = n[3].ui;
12317 x.uint32[1] = n[4].ui;
12318 y.uint32[0] = n[5].ui;
12319 y.uint32[1] = n[6].ui;
12320 z.uint32[0] = n[7].ui;
12321 z.uint32[1] = n[8].ui;
12322
12323 CALL_ProgramUniform3ui64ARB(ctx->Exec, (n[1].ui, n[2].i, x.uint64,
12324 y.uint64, z.uint64));
12325 break;
12326 }
12327 case OPCODE_PROGRAM_UNIFORM_4UI64: {
12328 union uint64_pair x;
12329 union uint64_pair y;
12330 union uint64_pair z;
12331 union uint64_pair w;
12332
12333 x.uint32[0] = n[3].ui;
12334 x.uint32[1] = n[4].ui;
12335 y.uint32[0] = n[5].ui;
12336 y.uint32[1] = n[6].ui;
12337 z.uint32[0] = n[7].ui;
12338 z.uint32[1] = n[8].ui;
12339 w.uint32[0] = n[9].ui;
12340 w.uint32[1] = n[10].ui;
12341
12342 CALL_ProgramUniform4ui64ARB(ctx->Exec, (n[1].ui, n[2].i, x.uint64,
12343 y.uint64, z.uint64, w.uint64));
12344 break;
12345 }
12346 case OPCODE_PROGRAM_UNIFORM_1UI64V:
12347 CALL_ProgramUniform1ui64vARB(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12348 get_pointer(&n[4])));
12349 break;
12350 case OPCODE_PROGRAM_UNIFORM_2UI64V:
12351 CALL_ProgramUniform2ui64vARB(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12352 get_pointer(&n[4])));
12353 break;
12354 case OPCODE_PROGRAM_UNIFORM_3UI64V:
12355 CALL_ProgramUniform3ui64vARB(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12356 get_pointer(&n[4])));
12357 break;
12358 case OPCODE_PROGRAM_UNIFORM_4UI64V:
12359 CALL_ProgramUniform4ui64vARB(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12360 get_pointer(&n[4])));
12361 break;
12362
12363 case OPCODE_USE_PROGRAM_STAGES:
12364 CALL_UseProgramStages(ctx->Exec, (n[1].ui, n[2].ui, n[3].ui));
12365 break;
12366 case OPCODE_PROGRAM_UNIFORM_1F:
12367 CALL_ProgramUniform1f(ctx->Exec, (n[1].ui, n[2].i, n[3].f));
12368 break;
12369 case OPCODE_PROGRAM_UNIFORM_2F:
12370 CALL_ProgramUniform2f(ctx->Exec, (n[1].ui, n[2].i, n[3].f, n[4].f));
12371 break;
12372 case OPCODE_PROGRAM_UNIFORM_3F:
12373 CALL_ProgramUniform3f(ctx->Exec, (n[1].ui, n[2].i,
12374 n[3].f, n[4].f, n[5].f));
12375 break;
12376 case OPCODE_PROGRAM_UNIFORM_4F:
12377 CALL_ProgramUniform4f(ctx->Exec, (n[1].ui, n[2].i,
12378 n[3].f, n[4].f, n[5].f, n[6].f));
12379 break;
12380 case OPCODE_PROGRAM_UNIFORM_1FV:
12381 CALL_ProgramUniform1fv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12382 get_pointer(&n[4])));
12383 break;
12384 case OPCODE_PROGRAM_UNIFORM_2FV:
12385 CALL_ProgramUniform2fv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12386 get_pointer(&n[4])));
12387 break;
12388 case OPCODE_PROGRAM_UNIFORM_3FV:
12389 CALL_ProgramUniform3fv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12390 get_pointer(&n[4])));
12391 break;
12392 case OPCODE_PROGRAM_UNIFORM_4FV:
12393 CALL_ProgramUniform4fv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12394 get_pointer(&n[4])));
12395 break;
12396 case OPCODE_PROGRAM_UNIFORM_1D: {
12397 union float64_pair x;
12398
12399 x.uint32[0] = n[3].ui;
12400 x.uint32[1] = n[4].ui;
12401
12402 CALL_ProgramUniform1d(ctx->Exec, (n[1].ui, n[2].i, x.d));
12403 break;
12404 }
12405 case OPCODE_PROGRAM_UNIFORM_2D: {
12406 union float64_pair x;
12407 union float64_pair y;
12408
12409 x.uint32[0] = n[3].ui;
12410 x.uint32[1] = n[4].ui;
12411 y.uint32[0] = n[5].ui;
12412 y.uint32[1] = n[6].ui;
12413
12414 CALL_ProgramUniform2d(ctx->Exec, (n[1].ui, n[2].i, x.d, y.d));
12415 break;
12416 }
12417 case OPCODE_PROGRAM_UNIFORM_3D: {
12418 union float64_pair x;
12419 union float64_pair y;
12420 union float64_pair z;
12421
12422 x.uint32[0] = n[3].ui;
12423 x.uint32[1] = n[4].ui;
12424 y.uint32[0] = n[5].ui;
12425 y.uint32[1] = n[6].ui;
12426 z.uint32[0] = n[7].ui;
12427 z.uint32[1] = n[8].ui;
12428
12429 CALL_ProgramUniform3d(ctx->Exec, (n[1].ui, n[2].i,
12430 x.d, y.d, z.d));
12431 break;
12432 }
12433 case OPCODE_PROGRAM_UNIFORM_4D: {
12434 union float64_pair x;
12435 union float64_pair y;
12436 union float64_pair z;
12437 union float64_pair w;
12438
12439 x.uint32[0] = n[3].ui;
12440 x.uint32[1] = n[4].ui;
12441 y.uint32[0] = n[5].ui;
12442 y.uint32[1] = n[6].ui;
12443 z.uint32[0] = n[7].ui;
12444 z.uint32[1] = n[8].ui;
12445 w.uint32[0] = n[9].ui;
12446 w.uint32[1] = n[10].ui;
12447
12448 CALL_ProgramUniform4d(ctx->Exec, (n[1].ui, n[2].i,
12449 x.d, y.d, z.d, w.d));
12450 break;
12451 }
12452 case OPCODE_PROGRAM_UNIFORM_1DV:
12453 CALL_ProgramUniform1dv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12454 get_pointer(&n[4])));
12455 break;
12456 case OPCODE_PROGRAM_UNIFORM_2DV:
12457 CALL_ProgramUniform2dv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12458 get_pointer(&n[4])));
12459 break;
12460 case OPCODE_PROGRAM_UNIFORM_3DV:
12461 CALL_ProgramUniform3dv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12462 get_pointer(&n[4])));
12463 break;
12464 case OPCODE_PROGRAM_UNIFORM_4DV:
12465 CALL_ProgramUniform4dv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12466 get_pointer(&n[4])));
12467 break;
12468 case OPCODE_PROGRAM_UNIFORM_1I:
12469 CALL_ProgramUniform1i(ctx->Exec, (n[1].ui, n[2].i, n[3].i));
12470 break;
12471 case OPCODE_PROGRAM_UNIFORM_2I:
12472 CALL_ProgramUniform2i(ctx->Exec, (n[1].ui, n[2].i, n[3].i, n[4].i));
12473 break;
12474 case OPCODE_PROGRAM_UNIFORM_3I:
12475 CALL_ProgramUniform3i(ctx->Exec, (n[1].ui, n[2].i,
12476 n[3].i, n[4].i, n[5].i));
12477 break;
12478 case OPCODE_PROGRAM_UNIFORM_4I:
12479 CALL_ProgramUniform4i(ctx->Exec, (n[1].ui, n[2].i,
12480 n[3].i, n[4].i, n[5].i, n[6].i));
12481 break;
12482 case OPCODE_PROGRAM_UNIFORM_1IV:
12483 CALL_ProgramUniform1iv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12484 get_pointer(&n[4])));
12485 break;
12486 case OPCODE_PROGRAM_UNIFORM_2IV:
12487 CALL_ProgramUniform2iv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12488 get_pointer(&n[4])));
12489 break;
12490 case OPCODE_PROGRAM_UNIFORM_3IV:
12491 CALL_ProgramUniform3iv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12492 get_pointer(&n[4])));
12493 break;
12494 case OPCODE_PROGRAM_UNIFORM_4IV:
12495 CALL_ProgramUniform4iv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12496 get_pointer(&n[4])));
12497 break;
12498 case OPCODE_PROGRAM_UNIFORM_1UI:
12499 CALL_ProgramUniform1ui(ctx->Exec, (n[1].ui, n[2].i, n[3].ui));
12500 break;
12501 case OPCODE_PROGRAM_UNIFORM_2UI:
12502 CALL_ProgramUniform2ui(ctx->Exec, (n[1].ui, n[2].i,
12503 n[3].ui, n[4].ui));
12504 break;
12505 case OPCODE_PROGRAM_UNIFORM_3UI:
12506 CALL_ProgramUniform3ui(ctx->Exec, (n[1].ui, n[2].i,
12507 n[3].ui, n[4].ui, n[5].ui));
12508 break;
12509 case OPCODE_PROGRAM_UNIFORM_4UI:
12510 CALL_ProgramUniform4ui(ctx->Exec, (n[1].ui, n[2].i,
12511 n[3].ui,
12512 n[4].ui, n[5].ui, n[6].ui));
12513 break;
12514 case OPCODE_PROGRAM_UNIFORM_1UIV:
12515 CALL_ProgramUniform1uiv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12516 get_pointer(&n[4])));
12517 break;
12518 case OPCODE_PROGRAM_UNIFORM_2UIV:
12519 CALL_ProgramUniform2uiv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12520 get_pointer(&n[4])));
12521 break;
12522 case OPCODE_PROGRAM_UNIFORM_3UIV:
12523 CALL_ProgramUniform3uiv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12524 get_pointer(&n[4])));
12525 break;
12526 case OPCODE_PROGRAM_UNIFORM_4UIV:
12527 CALL_ProgramUniform4uiv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12528 get_pointer(&n[4])));
12529 break;
12530 case OPCODE_PROGRAM_UNIFORM_MATRIX22F:
12531 CALL_ProgramUniformMatrix2fv(ctx->Exec,
12532 (n[1].ui, n[2].i, n[3].i, n[4].b,
12533 get_pointer(&n[5])));
12534 break;
12535 case OPCODE_PROGRAM_UNIFORM_MATRIX23F:
12536 CALL_ProgramUniformMatrix2x3fv(ctx->Exec,
12537 (n[1].ui, n[2].i, n[3].i, n[4].b,
12538 get_pointer(&n[5])));
12539 break;
12540 case OPCODE_PROGRAM_UNIFORM_MATRIX24F:
12541 CALL_ProgramUniformMatrix2x4fv(ctx->Exec,
12542 (n[1].ui, n[2].i, n[3].i, n[4].b,
12543 get_pointer(&n[5])));
12544 break;
12545 case OPCODE_PROGRAM_UNIFORM_MATRIX32F:
12546 CALL_ProgramUniformMatrix3x2fv(ctx->Exec,
12547 (n[1].ui, n[2].i, n[3].i, n[4].b,
12548 get_pointer(&n[5])));
12549 break;
12550 case OPCODE_PROGRAM_UNIFORM_MATRIX33F:
12551 CALL_ProgramUniformMatrix3fv(ctx->Exec,
12552 (n[1].ui, n[2].i, n[3].i, n[4].b,
12553 get_pointer(&n[5])));
12554 break;
12555 case OPCODE_PROGRAM_UNIFORM_MATRIX34F:
12556 CALL_ProgramUniformMatrix3x4fv(ctx->Exec,
12557 (n[1].ui, n[2].i, n[3].i, n[4].b,
12558 get_pointer(&n[5])));
12559 break;
12560 case OPCODE_PROGRAM_UNIFORM_MATRIX42F:
12561 CALL_ProgramUniformMatrix4x2fv(ctx->Exec,
12562 (n[1].ui, n[2].i, n[3].i, n[4].b,
12563 get_pointer(&n[5])));
12564 break;
12565 case OPCODE_PROGRAM_UNIFORM_MATRIX43F:
12566 CALL_ProgramUniformMatrix4x3fv(ctx->Exec,
12567 (n[1].ui, n[2].i, n[3].i, n[4].b,
12568 get_pointer(&n[5])));
12569 break;
12570 case OPCODE_PROGRAM_UNIFORM_MATRIX44F:
12571 CALL_ProgramUniformMatrix4fv(ctx->Exec,
12572 (n[1].ui, n[2].i, n[3].i, n[4].b,
12573 get_pointer(&n[5])));
12574 break;
12575 case OPCODE_PROGRAM_UNIFORM_MATRIX22D:
12576 CALL_ProgramUniformMatrix2dv(ctx->Exec,
12577 (n[1].ui, n[2].i, n[3].i, n[4].b,
12578 get_pointer(&n[5])));
12579 break;
12580 case OPCODE_PROGRAM_UNIFORM_MATRIX23D:
12581 CALL_ProgramUniformMatrix2x3dv(ctx->Exec,
12582 (n[1].ui, n[2].i, n[3].i, n[4].b,
12583 get_pointer(&n[5])));
12584 break;
12585 case OPCODE_PROGRAM_UNIFORM_MATRIX24D:
12586 CALL_ProgramUniformMatrix2x4dv(ctx->Exec,
12587 (n[1].ui, n[2].i, n[3].i, n[4].b,
12588 get_pointer(&n[5])));
12589 break;
12590 case OPCODE_PROGRAM_UNIFORM_MATRIX32D:
12591 CALL_ProgramUniformMatrix3x2dv(ctx->Exec,
12592 (n[1].ui, n[2].i, n[3].i, n[4].b,
12593 get_pointer(&n[5])));
12594 break;
12595 case OPCODE_PROGRAM_UNIFORM_MATRIX33D:
12596 CALL_ProgramUniformMatrix3dv(ctx->Exec,
12597 (n[1].ui, n[2].i, n[3].i, n[4].b,
12598 get_pointer(&n[5])));
12599 break;
12600 case OPCODE_PROGRAM_UNIFORM_MATRIX34D:
12601 CALL_ProgramUniformMatrix3x4dv(ctx->Exec,
12602 (n[1].ui, n[2].i, n[3].i, n[4].b,
12603 get_pointer(&n[5])));
12604 break;
12605 case OPCODE_PROGRAM_UNIFORM_MATRIX42D:
12606 CALL_ProgramUniformMatrix4x2dv(ctx->Exec,
12607 (n[1].ui, n[2].i, n[3].i, n[4].b,
12608 get_pointer(&n[5])));
12609 break;
12610 case OPCODE_PROGRAM_UNIFORM_MATRIX43D:
12611 CALL_ProgramUniformMatrix4x3dv(ctx->Exec,
12612 (n[1].ui, n[2].i, n[3].i, n[4].b,
12613 get_pointer(&n[5])));
12614 break;
12615 case OPCODE_PROGRAM_UNIFORM_MATRIX44D:
12616 CALL_ProgramUniformMatrix4dv(ctx->Exec,
12617 (n[1].ui, n[2].i, n[3].i, n[4].b,
12618 get_pointer(&n[5])));
12619 break;
12620
12621 case OPCODE_CLIP_CONTROL:
12622 CALL_ClipControl(ctx->Exec, (n[1].e, n[2].e));
12623 break;
12624
12625 case OPCODE_CLAMP_COLOR:
12626 CALL_ClampColor(ctx->Exec, (n[1].e, n[2].e));
12627 break;
12628
12629 case OPCODE_BIND_FRAGMENT_SHADER_ATI:
12630 CALL_BindFragmentShaderATI(ctx->Exec, (n[1].i));
12631 break;
12632 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI:
12633 CALL_SetFragmentShaderConstantATI(ctx->Exec, (n[1].ui, &n[2].f));
12634 break;
12635 case OPCODE_ATTR_1F_NV:
12636 CALL_VertexAttrib1fNV(ctx->Exec, (n[1].e, n[2].f));
12637 break;
12638 case OPCODE_ATTR_2F_NV:
12639 CALL_VertexAttrib2fvNV(ctx->Exec, (n[1].e, &n[2].f));
12640 break;
12641 case OPCODE_ATTR_3F_NV:
12642 CALL_VertexAttrib3fvNV(ctx->Exec, (n[1].e, &n[2].f));
12643 break;
12644 case OPCODE_ATTR_4F_NV:
12645 CALL_VertexAttrib4fvNV(ctx->Exec, (n[1].e, &n[2].f));
12646 break;
12647 case OPCODE_ATTR_1F_ARB:
12648 CALL_VertexAttrib1fARB(ctx->Exec, (n[1].e, n[2].f));
12649 break;
12650 case OPCODE_ATTR_2F_ARB:
12651 CALL_VertexAttrib2fvARB(ctx->Exec, (n[1].e, &n[2].f));
12652 break;
12653 case OPCODE_ATTR_3F_ARB:
12654 CALL_VertexAttrib3fvARB(ctx->Exec, (n[1].e, &n[2].f));
12655 break;
12656 case OPCODE_ATTR_4F_ARB:
12657 CALL_VertexAttrib4fvARB(ctx->Exec, (n[1].e, &n[2].f));
12658 break;
12659 case OPCODE_ATTR_1I:
12660 CALL_VertexAttribI1iEXT(ctx->Exec, (n[1].e, n[2].i));
12661 break;
12662 case OPCODE_ATTR_2I:
12663 CALL_VertexAttribI2ivEXT(ctx->Exec, (n[1].e, &n[2].i));
12664 break;
12665 case OPCODE_ATTR_3I:
12666 CALL_VertexAttribI3ivEXT(ctx->Exec, (n[1].e, &n[2].i));
12667 break;
12668 case OPCODE_ATTR_4I:
12669 CALL_VertexAttribI4ivEXT(ctx->Exec, (n[1].e, &n[2].i));
12670 break;
12671 case OPCODE_ATTR_1D: {
12672 GLdouble *d = (GLdouble *) &n[2];
12673 CALL_VertexAttribL1d(ctx->Exec, (n[1].ui, *d));
12674 break;
12675 }
12676 case OPCODE_ATTR_2D: {
12677 GLdouble *d = (GLdouble *) &n[2];
12678 CALL_VertexAttribL2dv(ctx->Exec, (n[1].ui, d));
12679 break;
12680 }
12681 case OPCODE_ATTR_3D: {
12682 GLdouble *d = (GLdouble *) &n[2];
12683 CALL_VertexAttribL3dv(ctx->Exec, (n[1].ui, d));
12684 break;
12685 }
12686 case OPCODE_ATTR_4D: {
12687 GLdouble *d = (GLdouble *) &n[2];
12688 CALL_VertexAttribL4dv(ctx->Exec, (n[1].ui, d));
12689 break;
12690 }
12691 case OPCODE_ATTR_1UI64: {
12692 uint64_t *ui64 = (uint64_t *) &n[2];
12693 CALL_VertexAttribL1ui64ARB(ctx->Exec, (n[1].ui, *ui64));
12694 break;
12695 }
12696 case OPCODE_MATERIAL:
12697 CALL_Materialfv(ctx->Exec, (n[1].e, n[2].e, &n[3].f));
12698 break;
12699 case OPCODE_BEGIN:
12700 CALL_Begin(ctx->Exec, (n[1].e));
12701 break;
12702 case OPCODE_END:
12703 CALL_End(ctx->Exec, ());
12704 break;
12705 case OPCODE_EVAL_C1:
12706 CALL_EvalCoord1f(ctx->Exec, (n[1].f));
12707 break;
12708 case OPCODE_EVAL_C2:
12709 CALL_EvalCoord2f(ctx->Exec, (n[1].f, n[2].f));
12710 break;
12711 case OPCODE_EVAL_P1:
12712 CALL_EvalPoint1(ctx->Exec, (n[1].i));
12713 break;
12714 case OPCODE_EVAL_P2:
12715 CALL_EvalPoint2(ctx->Exec, (n[1].i, n[2].i));
12716 break;
12717
12718 /* GL_EXT_texture_integer */
12719 case OPCODE_CLEARCOLOR_I:
12720 CALL_ClearColorIiEXT(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
12721 break;
12722 case OPCODE_CLEARCOLOR_UI:
12723 CALL_ClearColorIuiEXT(ctx->Exec,
12724 (n[1].ui, n[2].ui, n[3].ui, n[4].ui));
12725 break;
12726 case OPCODE_TEXPARAMETER_I:
12727 {
12728 GLint params[4];
12729 params[0] = n[3].i;
12730 params[1] = n[4].i;
12731 params[2] = n[5].i;
12732 params[3] = n[6].i;
12733 CALL_TexParameterIiv(ctx->Exec, (n[1].e, n[2].e, params));
12734 }
12735 break;
12736 case OPCODE_TEXPARAMETER_UI:
12737 {
12738 GLuint params[4];
12739 params[0] = n[3].ui;
12740 params[1] = n[4].ui;
12741 params[2] = n[5].ui;
12742 params[3] = n[6].ui;
12743 CALL_TexParameterIuiv(ctx->Exec, (n[1].e, n[2].e, params));
12744 }
12745 break;
12746
12747 case OPCODE_VERTEX_ATTRIB_DIVISOR:
12748 /* GL_ARB_instanced_arrays */
12749 CALL_VertexAttribDivisor(ctx->Exec, (n[1].ui, n[2].ui));
12750 break;
12751
12752 case OPCODE_TEXTURE_BARRIER_NV:
12753 CALL_TextureBarrierNV(ctx->Exec, ());
12754 break;
12755
12756 /* GL_EXT/ARB_transform_feedback */
12757 case OPCODE_BEGIN_TRANSFORM_FEEDBACK:
12758 CALL_BeginTransformFeedback(ctx->Exec, (n[1].e));
12759 break;
12760 case OPCODE_END_TRANSFORM_FEEDBACK:
12761 CALL_EndTransformFeedback(ctx->Exec, ());
12762 break;
12763 case OPCODE_BIND_TRANSFORM_FEEDBACK:
12764 CALL_BindTransformFeedback(ctx->Exec, (n[1].e, n[2].ui));
12765 break;
12766 case OPCODE_PAUSE_TRANSFORM_FEEDBACK:
12767 CALL_PauseTransformFeedback(ctx->Exec, ());
12768 break;
12769 case OPCODE_RESUME_TRANSFORM_FEEDBACK:
12770 CALL_ResumeTransformFeedback(ctx->Exec, ());
12771 break;
12772 case OPCODE_DRAW_TRANSFORM_FEEDBACK:
12773 CALL_DrawTransformFeedback(ctx->Exec, (n[1].e, n[2].ui));
12774 break;
12775 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM:
12776 CALL_DrawTransformFeedbackStream(ctx->Exec,
12777 (n[1].e, n[2].ui, n[3].ui));
12778 break;
12779 case OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED:
12780 CALL_DrawTransformFeedbackInstanced(ctx->Exec,
12781 (n[1].e, n[2].ui, n[3].si));
12782 break;
12783 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED:
12784 CALL_DrawTransformFeedbackStreamInstanced(ctx->Exec,
12785 (n[1].e, n[2].ui, n[3].ui, n[4].si));
12786 break;
12787
12788
12789 case OPCODE_BIND_SAMPLER:
12790 CALL_BindSampler(ctx->Exec, (n[1].ui, n[2].ui));
12791 break;
12792 case OPCODE_SAMPLER_PARAMETERIV:
12793 {
12794 GLint params[4];
12795 params[0] = n[3].i;
12796 params[1] = n[4].i;
12797 params[2] = n[5].i;
12798 params[3] = n[6].i;
12799 CALL_SamplerParameteriv(ctx->Exec, (n[1].ui, n[2].e, params));
12800 }
12801 break;
12802 case OPCODE_SAMPLER_PARAMETERFV:
12803 {
12804 GLfloat params[4];
12805 params[0] = n[3].f;
12806 params[1] = n[4].f;
12807 params[2] = n[5].f;
12808 params[3] = n[6].f;
12809 CALL_SamplerParameterfv(ctx->Exec, (n[1].ui, n[2].e, params));
12810 }
12811 break;
12812 case OPCODE_SAMPLER_PARAMETERIIV:
12813 {
12814 GLint params[4];
12815 params[0] = n[3].i;
12816 params[1] = n[4].i;
12817 params[2] = n[5].i;
12818 params[3] = n[6].i;
12819 CALL_SamplerParameterIiv(ctx->Exec, (n[1].ui, n[2].e, params));
12820 }
12821 break;
12822 case OPCODE_SAMPLER_PARAMETERUIV:
12823 {
12824 GLuint params[4];
12825 params[0] = n[3].ui;
12826 params[1] = n[4].ui;
12827 params[2] = n[5].ui;
12828 params[3] = n[6].ui;
12829 CALL_SamplerParameterIuiv(ctx->Exec, (n[1].ui, n[2].e, params));
12830 }
12831 break;
12832
12833 /* ARB_compute_shader */
12834 case OPCODE_DISPATCH_COMPUTE:
12835 CALL_DispatchCompute(ctx->Exec, (n[1].ui, n[2].ui, n[3].ui));
12836 break;
12837
12838 /* GL_ARB_sync */
12839 case OPCODE_WAIT_SYNC:
12840 {
12841 union uint64_pair p;
12842 p.uint32[0] = n[2].ui;
12843 p.uint32[1] = n[3].ui;
12844 CALL_WaitSync(ctx->Exec,
12845 (get_pointer(&n[4]), n[1].bf, p.uint64));
12846 }
12847 break;
12848
12849 /* GL_NV_conditional_render */
12850 case OPCODE_BEGIN_CONDITIONAL_RENDER:
12851 CALL_BeginConditionalRender(ctx->Exec, (n[1].i, n[2].e));
12852 break;
12853 case OPCODE_END_CONDITIONAL_RENDER:
12854 CALL_EndConditionalRender(ctx->Exec, ());
12855 break;
12856
12857 case OPCODE_UNIFORM_BLOCK_BINDING:
12858 CALL_UniformBlockBinding(ctx->Exec, (n[1].ui, n[2].ui, n[3].ui));
12859 break;
12860
12861 case OPCODE_UNIFORM_SUBROUTINES:
12862 CALL_UniformSubroutinesuiv(ctx->Exec, (n[1].e, n[2].si,
12863 get_pointer(&n[3])));
12864 break;
12865
12866 /* GL_EXT_window_rectangles */
12867 case OPCODE_WINDOW_RECTANGLES:
12868 CALL_WindowRectanglesEXT(
12869 ctx->Exec, (n[1].e, n[2].si, get_pointer(&n[3])));
12870 break;
12871
12872 /* GL_NV_conservative_raster */
12873 case OPCODE_SUBPIXEL_PRECISION_BIAS:
12874 CALL_SubpixelPrecisionBiasNV(ctx->Exec, (n[1].ui, n[2].ui));
12875 break;
12876
12877 /* GL_NV_conservative_raster_dilate */
12878 case OPCODE_CONSERVATIVE_RASTER_PARAMETER_F:
12879 CALL_ConservativeRasterParameterfNV(ctx->Exec, (n[1].e, n[2].f));
12880 break;
12881
12882 /* GL_NV_conservative_raster_pre_snap_triangles */
12883 case OPCODE_CONSERVATIVE_RASTER_PARAMETER_I:
12884 CALL_ConservativeRasterParameteriNV(ctx->Exec, (n[1].e, n[2].i));
12885 break;
12886
12887 /* GL_EXT_direct_state_access */
12888 case OPCODE_MATRIX_LOAD:
12889 CALL_MatrixLoadfEXT(ctx->Exec, (n[1].e, &n[2].f));
12890 break;
12891 case OPCODE_MATRIX_MULT:
12892 CALL_MatrixMultfEXT(ctx->Exec, (n[1].e, &n[2].f));
12893 break;
12894 case OPCODE_MATRIX_ROTATE:
12895 CALL_MatrixRotatefEXT(ctx->Exec, (n[1].e, n[2].f, n[3].f, n[4].f, n[5].f));
12896 break;
12897 case OPCODE_MATRIX_SCALE:
12898 CALL_MatrixScalefEXT(ctx->Exec, (n[1].e, n[2].f, n[3].f, n[4].f));
12899 break;
12900 case OPCODE_MATRIX_TRANSLATE:
12901 CALL_MatrixTranslatefEXT(ctx->Exec, (n[1].e, n[2].f, n[3].f, n[4].f));
12902 break;
12903 case OPCODE_MATRIX_LOAD_IDENTITY:
12904 CALL_MatrixLoadIdentityEXT(ctx->Exec, (n[1].e));
12905 break;
12906 case OPCODE_MATRIX_ORTHO:
12907 CALL_MatrixOrthoEXT(ctx->Exec, (n[1].e,
12908 n[2].f, n[3].f, n[4].f,
12909 n[5].f, n[6].f, n[7].f));
12910 break;
12911 case OPCODE_MATRIX_FRUSTUM:
12912 CALL_MatrixFrustumEXT(ctx->Exec, (n[1].e,
12913 n[2].f, n[3].f, n[4].f,
12914 n[5].f, n[6].f, n[7].f));
12915 break;
12916 case OPCODE_MATRIX_PUSH:
12917 CALL_MatrixPushEXT(ctx->Exec, (n[1].e));
12918 break;
12919 case OPCODE_MATRIX_POP:
12920 CALL_MatrixPopEXT(ctx->Exec, (n[1].e));
12921 break;
12922 case OPCODE_TEXTUREPARAMETER_F:
12923 {
12924 GLfloat params[4];
12925 params[0] = n[4].f;
12926 params[1] = n[5].f;
12927 params[2] = n[6].f;
12928 params[3] = n[7].f;
12929 CALL_TextureParameterfvEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].e, params));
12930 }
12931 break;
12932 case OPCODE_TEXTUREPARAMETER_I:
12933 {
12934 GLint params[4];
12935 params[0] = n[4].i;
12936 params[1] = n[5].i;
12937 params[2] = n[6].i;
12938 params[3] = n[7].i;
12939 CALL_TextureParameterivEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].e, params));
12940 }
12941 break;
12942 case OPCODE_TEXTUREPARAMETER_II:
12943 {
12944 GLint params[4];
12945 params[0] = n[4].i;
12946 params[1] = n[5].i;
12947 params[2] = n[6].i;
12948 params[3] = n[7].i;
12949 CALL_TextureParameterIivEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].e, params));
12950 }
12951 break;
12952 case OPCODE_TEXTUREPARAMETER_IUI:
12953 {
12954 GLuint params[4];
12955 params[0] = n[4].ui;
12956 params[1] = n[5].ui;
12957 params[2] = n[6].ui;
12958 params[3] = n[7].ui;
12959 CALL_TextureParameterIuivEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].e, params));
12960 }
12961 break;
12962 case OPCODE_TEXTURE_IMAGE1D:
12963 {
12964 const struct gl_pixelstore_attrib save = ctx->Unpack;
12965 ctx->Unpack = ctx->DefaultPacking;
12966 CALL_TextureImage1DEXT(ctx->Exec, (n[1].ui, /* texture */
12967 n[2].e, /* target */
12968 n[3].i, /* level */
12969 n[4].i, /* components */
12970 n[5].i, /* width */
12971 n[6].e, /* border */
12972 n[7].e, /* format */
12973 n[8].e, /* type */
12974 get_pointer(&n[9])));
12975 ctx->Unpack = save; /* restore */
12976 }
12977 break;
12978 case OPCODE_TEXTURE_IMAGE2D:
12979 {
12980 const struct gl_pixelstore_attrib save = ctx->Unpack;
12981 ctx->Unpack = ctx->DefaultPacking;
12982 CALL_TextureImage2DEXT(ctx->Exec, (n[1].ui, /* texture */
12983 n[2].e, /* target */
12984 n[3].i, /* level */
12985 n[4].i, /* components */
12986 n[5].i, /* width */
12987 n[6].i, /* height */
12988 n[7].e, /* border */
12989 n[8].e, /* format */
12990 n[9].e, /* type */
12991 get_pointer(&n[10])));
12992 ctx->Unpack = save; /* restore */
12993 }
12994 break;
12995 case OPCODE_TEXTURE_IMAGE3D:
12996 {
12997 const struct gl_pixelstore_attrib save = ctx->Unpack;
12998 ctx->Unpack = ctx->DefaultPacking;
12999 CALL_TextureImage3DEXT(ctx->Exec, (n[1].ui, /* texture */
13000 n[2].e, /* target */
13001 n[3].i, /* level */
13002 n[4].i, /* components */
13003 n[5].i, /* width */
13004 n[6].i, /* height */
13005 n[7].i, /* depth */
13006 n[8].e, /* border */
13007 n[9].e, /* format */
13008 n[10].e, /* type */
13009 get_pointer(&n[11])));
13010 ctx->Unpack = save; /* restore */
13011 }
13012 break;
13013 case OPCODE_TEXTURE_SUB_IMAGE1D:
13014 {
13015 const struct gl_pixelstore_attrib save = ctx->Unpack;
13016 ctx->Unpack = ctx->DefaultPacking;
13017 CALL_TextureSubImage1DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13018 n[4].i, n[5].i, n[6].e,
13019 n[7].e, get_pointer(&n[8])));
13020 ctx->Unpack = save; /* restore */
13021 }
13022 break;
13023 case OPCODE_TEXTURE_SUB_IMAGE2D:
13024 {
13025 const struct gl_pixelstore_attrib save = ctx->Unpack;
13026 ctx->Unpack = ctx->DefaultPacking;
13027 CALL_TextureSubImage2DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13028 n[4].i, n[5].i, n[6].e,
13029 n[7].i, n[8].e, n[9].e,
13030 get_pointer(&n[10])));
13031 ctx->Unpack = save;
13032 }
13033 break;
13034 case OPCODE_TEXTURE_SUB_IMAGE3D:
13035 {
13036 const struct gl_pixelstore_attrib save = ctx->Unpack;
13037 ctx->Unpack = ctx->DefaultPacking;
13038 CALL_TextureSubImage3DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13039 n[4].i, n[5].i, n[6].i,
13040 n[7].i, n[8].i, n[9].i,
13041 n[10].e, n[11].e,
13042 get_pointer(&n[12])));
13043 ctx->Unpack = save; /* restore */
13044 }
13045 break;
13046 case OPCODE_COPY_TEXTURE_IMAGE1D:
13047 CALL_CopyTextureImage1DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13048 n[4].e, n[5].i, n[6].i,
13049 n[7].i, n[8].i));
13050 break;
13051 case OPCODE_COPY_TEXTURE_IMAGE2D:
13052 CALL_CopyTextureImage2DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13053 n[4].e, n[5].i, n[6].i,
13054 n[7].i, n[8].i, n[9].i));
13055 break;
13056 case OPCODE_COPY_TEXTURE_SUB_IMAGE1D:
13057 CALL_CopyTextureSubImage1DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13058 n[4].i, n[5].i, n[6].i,
13059 n[7].i));
13060 break;
13061 case OPCODE_COPY_TEXTURE_SUB_IMAGE2D:
13062 CALL_CopyTextureSubImage2DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13063 n[4].i, n[5].i, n[6].i,
13064 n[7].i, n[8].i, n[9].i));
13065 break;
13066 case OPCODE_COPY_TEXTURE_SUB_IMAGE3D:
13067 CALL_CopyTextureSubImage3DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13068 n[4].i, n[5].i, n[6].i,
13069 n[7].i, n[8].i, n[9].i,
13070 n[10].i));
13071 break;
13072 case OPCODE_BIND_MULTITEXTURE:
13073 CALL_BindMultiTextureEXT(ctx->Exec, (n[1].e, n[2].e, n[3].ui));
13074 break;
13075 case OPCODE_MULTITEXPARAMETER_F:
13076 {
13077 GLfloat params[4];
13078 params[0] = n[4].f;
13079 params[1] = n[5].f;
13080 params[2] = n[6].f;
13081 params[3] = n[7].f;
13082 CALL_MultiTexParameterfvEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, params));
13083 }
13084 break;
13085 case OPCODE_MULTITEXPARAMETER_I:
13086 {
13087 GLint params[4];
13088 params[0] = n[4].i;
13089 params[1] = n[5].i;
13090 params[2] = n[6].i;
13091 params[3] = n[7].i;
13092 CALL_MultiTexParameterivEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, params));
13093 }
13094 break;
13095 case OPCODE_MULTITEXPARAMETER_II:
13096 {
13097 GLint params[4];
13098 params[0] = n[4].i;
13099 params[1] = n[5].i;
13100 params[2] = n[6].i;
13101 params[3] = n[7].i;
13102 CALL_MultiTexParameterIivEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, params));
13103 }
13104 break;
13105 case OPCODE_MULTITEXPARAMETER_IUI:
13106 {
13107 GLuint params[4];
13108 params[0] = n[4].ui;
13109 params[1] = n[5].ui;
13110 params[2] = n[6].ui;
13111 params[3] = n[7].ui;
13112 CALL_MultiTexParameterIuivEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, params));
13113 }
13114 break;
13115 case OPCODE_MULTITEX_IMAGE1D:
13116 {
13117 const struct gl_pixelstore_attrib save = ctx->Unpack;
13118 ctx->Unpack = ctx->DefaultPacking;
13119 CALL_MultiTexImage1DEXT(ctx->Exec, (n[1].e, /* texture */
13120 n[2].e, /* target */
13121 n[3].i, /* level */
13122 n[4].i, /* components */
13123 n[5].i, /* width */
13124 n[6].e, /* border */
13125 n[7].e, /* format */
13126 n[8].e, /* type */
13127 get_pointer(&n[9])));
13128 ctx->Unpack = save; /* restore */
13129 }
13130 break;
13131 case OPCODE_MULTITEX_IMAGE2D:
13132 {
13133 const struct gl_pixelstore_attrib save = ctx->Unpack;
13134 ctx->Unpack = ctx->DefaultPacking;
13135 CALL_MultiTexImage2DEXT(ctx->Exec, (n[1].e, /* texture */
13136 n[2].e, /* target */
13137 n[3].i, /* level */
13138 n[4].i, /* components */
13139 n[5].i, /* width */
13140 n[6].i, /* height */
13141 n[7].e, /* border */
13142 n[8].e, /* format */
13143 n[9].e, /* type */
13144 get_pointer(&n[10])));
13145 ctx->Unpack = save; /* restore */
13146 }
13147 break;
13148 case OPCODE_MULTITEX_IMAGE3D:
13149 {
13150 const struct gl_pixelstore_attrib save = ctx->Unpack;
13151 ctx->Unpack = ctx->DefaultPacking;
13152 CALL_MultiTexImage3DEXT(ctx->Exec, (n[1].e, /* texture */
13153 n[2].e, /* target */
13154 n[3].i, /* level */
13155 n[4].i, /* components */
13156 n[5].i, /* width */
13157 n[6].i, /* height */
13158 n[7].i, /* depth */
13159 n[8].e, /* border */
13160 n[9].e, /* format */
13161 n[10].e, /* type */
13162 get_pointer(&n[11])));
13163 ctx->Unpack = save; /* restore */
13164 }
13165 break;
13166 case OPCODE_MULTITEX_SUB_IMAGE1D:
13167 {
13168 const struct gl_pixelstore_attrib save = ctx->Unpack;
13169 ctx->Unpack = ctx->DefaultPacking;
13170 CALL_MultiTexSubImage1DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13171 n[4].i, n[5].i, n[6].e,
13172 n[7].e, get_pointer(&n[8])));
13173 ctx->Unpack = save; /* restore */
13174 }
13175 break;
13176 case OPCODE_MULTITEX_SUB_IMAGE2D:
13177 {
13178 const struct gl_pixelstore_attrib save = ctx->Unpack;
13179 ctx->Unpack = ctx->DefaultPacking;
13180 CALL_MultiTexSubImage2DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13181 n[4].i, n[5].i, n[6].e,
13182 n[7].i, n[8].e, n[9].e,
13183 get_pointer(&n[10])));
13184 ctx->Unpack = save; /* restore */
13185 }
13186 break;
13187 case OPCODE_MULTITEX_SUB_IMAGE3D:
13188 {
13189 const struct gl_pixelstore_attrib save = ctx->Unpack;
13190 ctx->Unpack = ctx->DefaultPacking;
13191 CALL_MultiTexSubImage3DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13192 n[4].i, n[5].i, n[6].i,
13193 n[7].i, n[8].i, n[9].i,
13194 n[10].e, n[11].e,
13195 get_pointer(&n[12])));
13196 ctx->Unpack = save; /* restore */
13197 }
13198 break;
13199 case OPCODE_COPY_MULTITEX_IMAGE1D:
13200 CALL_CopyMultiTexImage1DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13201 n[4].e, n[5].i, n[6].i,
13202 n[7].i, n[8].i));
13203 break;
13204 case OPCODE_COPY_MULTITEX_IMAGE2D:
13205 CALL_CopyMultiTexImage2DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13206 n[4].e, n[5].i, n[6].i,
13207 n[7].i, n[8].i, n[9].i));
13208 break;
13209 case OPCODE_COPY_MULTITEX_SUB_IMAGE1D:
13210 CALL_CopyMultiTexSubImage1DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13211 n[4].i, n[5].i, n[6].i,
13212 n[7].i));
13213 break;
13214 case OPCODE_COPY_MULTITEX_SUB_IMAGE2D:
13215 CALL_CopyMultiTexSubImage2DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13216 n[4].i, n[5].i, n[6].i,
13217 n[7].i, n[8].i, n[9].i));
13218 break;
13219 case OPCODE_COPY_MULTITEX_SUB_IMAGE3D:
13220 CALL_CopyMultiTexSubImage3DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13221 n[4].i, n[5].i, n[6].i,
13222 n[7].i, n[8].i, n[9].i,
13223 n[10].i));
13224 break;
13225 case OPCODE_MULTITEXENV:
13226 {
13227 GLfloat params[4];
13228 params[0] = n[4].f;
13229 params[1] = n[5].f;
13230 params[2] = n[6].f;
13231 params[3] = n[7].f;
13232 CALL_MultiTexEnvfvEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, params));
13233 }
13234 break;
13235 case OPCODE_COMPRESSED_TEXTURE_IMAGE_1D:
13236 CALL_CompressedTextureImage1DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13237 n[4].e, n[5].i, n[6].i,
13238 n[7].i, get_pointer(&n[8])));
13239 break;
13240 case OPCODE_COMPRESSED_TEXTURE_IMAGE_2D:
13241 CALL_CompressedTextureImage2DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13242 n[4].e, n[5].i, n[6].i,
13243 n[7].i, n[8].i,
13244 get_pointer(&n[9])));
13245 break;
13246 case OPCODE_COMPRESSED_TEXTURE_IMAGE_3D:
13247 CALL_CompressedTextureImage3DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13248 n[4].e, n[5].i, n[6].i,
13249 n[7].i, n[8].i, n[9].i,
13250 get_pointer(&n[10])));
13251 break;
13252 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_1D:
13253 CALL_CompressedTextureSubImage1DEXT(ctx->Exec,
13254 (n[1].ui, n[2].e, n[3].i, n[4].i,
13255 n[5].i, n[6].e, n[7].i,
13256 get_pointer(&n[8])));
13257 break;
13258 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_2D:
13259 CALL_CompressedTextureSubImage2DEXT(ctx->Exec,
13260 (n[1].ui, n[2].e, n[3].i, n[4].i,
13261 n[5].i, n[6].i, n[7].i, n[8].e,
13262 n[9].i, get_pointer(&n[10])));
13263 break;
13264 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_3D:
13265 CALL_CompressedTextureSubImage3DEXT(ctx->Exec,
13266 (n[1].ui, n[2].e, n[3].i, n[4].i,
13267 n[5].i, n[6].i, n[7].i, n[8].i,
13268 n[9].i, n[10].e, n[11].i,
13269 get_pointer(&n[12])));
13270 break;
13271 case OPCODE_COMPRESSED_MULTITEX_IMAGE_1D:
13272 CALL_CompressedMultiTexImage1DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13273 n[4].e, n[5].i, n[6].i,
13274 n[7].i, get_pointer(&n[8])));
13275 break;
13276 case OPCODE_COMPRESSED_MULTITEX_IMAGE_2D:
13277 CALL_CompressedMultiTexImage2DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13278 n[4].e, n[5].i, n[6].i,
13279 n[7].i, n[8].i,
13280 get_pointer(&n[9])));
13281 break;
13282 case OPCODE_COMPRESSED_MULTITEX_IMAGE_3D:
13283 CALL_CompressedMultiTexImage3DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13284 n[4].e, n[5].i, n[6].i,
13285 n[7].i, n[8].i, n[9].i,
13286 get_pointer(&n[10])));
13287 break;
13288 case OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_1D:
13289 CALL_CompressedMultiTexSubImage1DEXT(ctx->Exec,
13290 (n[1].e, n[2].e, n[3].i, n[4].i,
13291 n[5].i, n[6].e, n[7].i,
13292 get_pointer(&n[8])));
13293 break;
13294 case OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_2D:
13295 CALL_CompressedMultiTexSubImage2DEXT(ctx->Exec,
13296 (n[1].e, n[2].e, n[3].i, n[4].i,
13297 n[5].i, n[6].i, n[7].i, n[8].e,
13298 n[9].i, get_pointer(&n[10])));
13299 break;
13300 case OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_3D:
13301 CALL_CompressedMultiTexSubImage3DEXT(ctx->Exec,
13302 (n[1].e, n[2].e, n[3].i, n[4].i,
13303 n[5].i, n[6].i, n[7].i, n[8].i,
13304 n[9].i, n[10].e, n[11].i,
13305 get_pointer(&n[12])));
13306 break;
13307 case OPCODE_NAMED_PROGRAM_STRING:
13308 CALL_NamedProgramStringEXT(ctx->Exec,
13309 (n[1].ui, n[2].e, n[3].e, n[4].i,
13310 get_pointer(&n[5])));
13311 break;
13312 case OPCODE_NAMED_PROGRAM_LOCAL_PARAMETER:
13313 CALL_NamedProgramLocalParameter4fEXT(ctx->Exec,
13314 (n[1].ui, n[2].e, n[3].ui, n[4].f,
13315 n[5].f, n[6].f, n[7].f));
13316 break;
13317
13318 case OPCODE_PRIMITIVE_BOUNDING_BOX:
13319 CALL_PrimitiveBoundingBox(ctx->Exec,
13320 (n[1].f, n[2].f, n[3].f, n[4].f,
13321 n[5].f, n[6].f, n[7].f, n[8].f));
13322 break;
13323 case OPCODE_VERTEX_LIST:
13324 vbo_save_playback_vertex_list(ctx, &n[0], false);
13325 break;
13326
13327 case OPCODE_VERTEX_LIST_COPY_CURRENT:
13328 vbo_save_playback_vertex_list(ctx, &n[0], true);
13329 break;
13330
13331 case OPCODE_VERTEX_LIST_LOOPBACK:
13332 vbo_save_playback_vertex_list_loopback(ctx, &n[0]);
13333 break;
13334
13335 case OPCODE_CONTINUE:
13336 n = (Node *) get_pointer(&n[1]);
13337 continue;
13338 default:
13339 {
13340 char msg[1000];
13341 snprintf(msg, sizeof(msg), "Error in execute_list: opcode=%d",
13342 (int) opcode);
13343 _mesa_problem(ctx, "%s", msg);
13344 }
13345 FALLTHROUGH;
13346 case OPCODE_END_OF_LIST:
13347 return;
13348 }
13349
13350 /* increment n to point to next compiled command */
13351 assert(n[0].InstSize > 0);
13352 n += n[0].InstSize;
13353 }
13354 }
13355
13356
13357
13358 /**********************************************************************/
13359 /* GL functions */
13360 /**********************************************************************/
13361
13362 /**
13363 * Test if a display list number is valid.
13364 */
13365 GLboolean GLAPIENTRY
_mesa_IsList(GLuint list)13366 _mesa_IsList(GLuint list)
13367 {
13368 GET_CURRENT_CONTEXT(ctx);
13369 FLUSH_VERTICES(ctx, 0, 0); /* must be called before assert */
13370 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
13371 return _mesa_get_list(ctx, list, NULL, false);
13372 }
13373
13374
13375 /**
13376 * Delete a sequence of consecutive display lists.
13377 */
13378 void GLAPIENTRY
_mesa_DeleteLists(GLuint list,GLsizei range)13379 _mesa_DeleteLists(GLuint list, GLsizei range)
13380 {
13381 GET_CURRENT_CONTEXT(ctx);
13382 GLuint i;
13383 FLUSH_VERTICES(ctx, 0, 0); /* must be called before assert */
13384 ASSERT_OUTSIDE_BEGIN_END(ctx);
13385
13386 if (range < 0) {
13387 _mesa_error(ctx, GL_INVALID_VALUE, "glDeleteLists");
13388 return;
13389 }
13390
13391 if (range > 1) {
13392 /* We may be deleting a set of bitmap lists. See if there's a
13393 * bitmap atlas to free.
13394 */
13395 struct gl_bitmap_atlas *atlas = lookup_bitmap_atlas(ctx, list);
13396 if (atlas) {
13397 _mesa_delete_bitmap_atlas(ctx, atlas);
13398 _mesa_HashRemove(ctx->Shared->BitmapAtlas, list);
13399 }
13400 }
13401
13402 _mesa_HashLockMutex(ctx->Shared->DisplayList);
13403 for (i = list; i < list + range; i++) {
13404 destroy_list(ctx, i);
13405 }
13406 _mesa_HashUnlockMutex(ctx->Shared->DisplayList);
13407 }
13408
13409
13410 /**
13411 * Return a display list number, n, such that lists n through n+range-1
13412 * are free.
13413 */
13414 GLuint GLAPIENTRY
_mesa_GenLists(GLsizei range)13415 _mesa_GenLists(GLsizei range)
13416 {
13417 GET_CURRENT_CONTEXT(ctx);
13418 GLuint base;
13419 FLUSH_VERTICES(ctx, 0, 0); /* must be called before assert */
13420 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
13421
13422 if (range < 0) {
13423 _mesa_error(ctx, GL_INVALID_VALUE, "glGenLists");
13424 return 0;
13425 }
13426 if (range == 0) {
13427 return 0;
13428 }
13429
13430 /*
13431 * Make this an atomic operation
13432 */
13433 _mesa_HashLockMutex(ctx->Shared->DisplayList);
13434
13435 base = _mesa_HashFindFreeKeyBlock(ctx->Shared->DisplayList, range);
13436 if (base) {
13437 /* reserve the list IDs by with empty/dummy lists */
13438 GLint i;
13439 for (i = 0; i < range; i++) {
13440 _mesa_HashInsertLocked(ctx->Shared->DisplayList, base + i,
13441 make_list(base + i, 1), true);
13442 }
13443 }
13444
13445 if (USE_BITMAP_ATLAS &&
13446 range > 16) {
13447 /* "range > 16" is a rough heuristic to guess when glGenLists might be
13448 * used to allocate display lists for glXUseXFont or wglUseFontBitmaps.
13449 * Create the empty atlas now.
13450 */
13451 struct gl_bitmap_atlas *atlas = lookup_bitmap_atlas(ctx, base);
13452 if (!atlas) {
13453 atlas = alloc_bitmap_atlas(ctx, base, true);
13454 }
13455 if (atlas) {
13456 /* Atlas _should_ be new/empty now, but clobbering is OK */
13457 assert(atlas->numBitmaps == 0);
13458 atlas->numBitmaps = range;
13459 }
13460 }
13461
13462 _mesa_HashUnlockMutex(ctx->Shared->DisplayList);
13463
13464 return base;
13465 }
13466
13467
13468 /**
13469 * Begin a new display list.
13470 */
13471 void GLAPIENTRY
_mesa_NewList(GLuint name,GLenum mode)13472 _mesa_NewList(GLuint name, GLenum mode)
13473 {
13474 GET_CURRENT_CONTEXT(ctx);
13475
13476 FLUSH_CURRENT(ctx, 0); /* must be called before assert */
13477 ASSERT_OUTSIDE_BEGIN_END(ctx);
13478
13479 if (MESA_VERBOSE & VERBOSE_API)
13480 _mesa_debug(ctx, "glNewList %u %s\n", name,
13481 _mesa_enum_to_string(mode));
13482
13483 if (name == 0) {
13484 _mesa_error(ctx, GL_INVALID_VALUE, "glNewList");
13485 return;
13486 }
13487
13488 if (mode != GL_COMPILE && mode != GL_COMPILE_AND_EXECUTE) {
13489 _mesa_error(ctx, GL_INVALID_ENUM, "glNewList");
13490 return;
13491 }
13492
13493 if (ctx->ListState.CurrentList) {
13494 /* already compiling a display list */
13495 _mesa_error(ctx, GL_INVALID_OPERATION, "glNewList");
13496 return;
13497 }
13498
13499 ctx->CompileFlag = GL_TRUE;
13500 ctx->ExecuteFlag = (mode == GL_COMPILE_AND_EXECUTE);
13501
13502 /* Reset accumulated list state */
13503 invalidate_saved_current_state( ctx );
13504
13505 /* Allocate new display list */
13506 ctx->ListState.CurrentList = make_list(name, BLOCK_SIZE);
13507 ctx->ListState.CurrentBlock = ctx->ListState.CurrentList->Head;
13508 ctx->ListState.CurrentPos = 0;
13509 ctx->ListState.LastInstSize = 0;
13510 ctx->ListState.Current.UseLoopback = false;
13511
13512 vbo_save_NewList(ctx, name, mode);
13513
13514 ctx->CurrentServerDispatch = ctx->Save;
13515 _glapi_set_dispatch(ctx->CurrentServerDispatch);
13516 if (!ctx->GLThread.enabled) {
13517 ctx->CurrentClientDispatch = ctx->CurrentServerDispatch;
13518 }
13519 }
13520
13521
13522 /**
13523 * Walk all the opcode from a given list, recursively if OPCODE_CALL_LIST(S) is used,
13524 * and replace OPCODE_VERTEX_LIST[_COPY_CURRENT] occurences by OPCODE_VERTEX_LIST_LOOPBACK.
13525 */
13526 static void
replace_op_vertex_list_recursively(struct gl_context * ctx,struct gl_display_list * dlist)13527 replace_op_vertex_list_recursively(struct gl_context *ctx, struct gl_display_list *dlist)
13528 {
13529 Node *n = get_list_head(ctx, dlist);
13530 while (true) {
13531 const OpCode opcode = n[0].opcode;
13532 switch (opcode) {
13533 case OPCODE_VERTEX_LIST:
13534 case OPCODE_VERTEX_LIST_COPY_CURRENT:
13535 n[0].opcode = OPCODE_VERTEX_LIST_LOOPBACK;
13536 break;
13537 case OPCODE_CONTINUE:
13538 n = (Node *)get_pointer(&n[1]);
13539 continue;
13540 case OPCODE_CALL_LIST:
13541 replace_op_vertex_list_recursively(ctx, _mesa_lookup_list(ctx, (int)n[1].ui, true));
13542 break;
13543 case OPCODE_CALL_LISTS: {
13544 GLbyte *bptr;
13545 GLubyte *ubptr;
13546 GLshort *sptr;
13547 GLushort *usptr;
13548 GLint *iptr;
13549 GLuint *uiptr;
13550 GLfloat *fptr;
13551 switch(n[2].e) {
13552 case GL_BYTE:
13553 bptr = (GLbyte *) get_pointer(&n[3]);
13554 for (unsigned i = 0; i < n[1].i; i++)
13555 replace_op_vertex_list_recursively(ctx, _mesa_lookup_list(ctx, (int)bptr[i], true));
13556 break;
13557 case GL_UNSIGNED_BYTE:
13558 ubptr = (GLubyte *) get_pointer(&n[3]);
13559 for (unsigned i = 0; i < n[1].i; i++)
13560 replace_op_vertex_list_recursively(ctx, _mesa_lookup_list(ctx, (int)ubptr[i], true));
13561 break;
13562 case GL_SHORT:
13563 sptr = (GLshort *) get_pointer(&n[3]);
13564 for (unsigned i = 0; i < n[1].i; i++)
13565 replace_op_vertex_list_recursively(ctx, _mesa_lookup_list(ctx, (int)sptr[i], true));
13566 break;
13567 case GL_UNSIGNED_SHORT:
13568 usptr = (GLushort *) get_pointer(&n[3]);
13569 for (unsigned i = 0; i < n[1].i; i++)
13570 replace_op_vertex_list_recursively(ctx, _mesa_lookup_list(ctx, (int)usptr[i], true));
13571 break;
13572 case GL_INT:
13573 iptr = (GLint *) get_pointer(&n[3]);
13574 for (unsigned i = 0; i < n[1].i; i++)
13575 replace_op_vertex_list_recursively(ctx, _mesa_lookup_list(ctx, (int)iptr[i], true));
13576 break;
13577 case GL_UNSIGNED_INT:
13578 uiptr = (GLuint *) get_pointer(&n[3]);
13579 for (unsigned i = 0; i < n[1].i; i++)
13580 replace_op_vertex_list_recursively(ctx, _mesa_lookup_list(ctx, (int)uiptr[i], true));
13581 break;
13582 case GL_FLOAT:
13583 fptr = (GLfloat *) get_pointer(&n[3]);
13584 for (unsigned i = 0; i < n[1].i; i++)
13585 replace_op_vertex_list_recursively(ctx, _mesa_lookup_list(ctx, (int)fptr[i], true));
13586 break;
13587 case GL_2_BYTES:
13588 ubptr = (GLubyte *) get_pointer(&n[3]);
13589 for (unsigned i = 0; i < n[1].i; i++) {
13590 replace_op_vertex_list_recursively(ctx,
13591 _mesa_lookup_list(ctx, (int)ubptr[2 * i] * 256 +
13592 (int)ubptr[2 * i + 1], true));
13593 }
13594 break;
13595 case GL_3_BYTES:
13596 ubptr = (GLubyte *) get_pointer(&n[3]);
13597 for (unsigned i = 0; i < n[1].i; i++) {
13598 replace_op_vertex_list_recursively(ctx,
13599 _mesa_lookup_list(ctx, (int)ubptr[3 * i] * 65536 +
13600 (int)ubptr[3 * i + 1] * 256 +
13601 (int)ubptr[3 * i + 2], true));
13602 }
13603 break;
13604 case GL_4_BYTES:
13605 ubptr = (GLubyte *) get_pointer(&n[3]);
13606 for (unsigned i = 0; i < n[1].i; i++) {
13607 replace_op_vertex_list_recursively(ctx,
13608 _mesa_lookup_list(ctx, (int)ubptr[4 * i] * 16777216 +
13609 (int)ubptr[4 * i + 1] * 65536 +
13610 (int)ubptr[4 * i + 2] * 256 +
13611 (int)ubptr[4 * i + 3], true));
13612 }
13613 break;
13614 }
13615 break;
13616 }
13617 case OPCODE_END_OF_LIST:
13618 return;
13619 default:
13620 break;
13621 }
13622 n += n[0].InstSize;
13623 }
13624 }
13625
13626
13627 /**
13628 * End definition of current display list.
13629 */
13630 void GLAPIENTRY
_mesa_EndList(void)13631 _mesa_EndList(void)
13632 {
13633 GET_CURRENT_CONTEXT(ctx);
13634 SAVE_FLUSH_VERTICES(ctx);
13635 FLUSH_VERTICES(ctx, 0, 0);
13636
13637 if (MESA_VERBOSE & VERBOSE_API)
13638 _mesa_debug(ctx, "glEndList\n");
13639
13640 if (ctx->ExecuteFlag && _mesa_inside_dlist_begin_end(ctx)) {
13641 _mesa_error(ctx, GL_INVALID_OPERATION,
13642 "glEndList() called inside glBegin/End");
13643 }
13644
13645 /* Check that a list is under construction */
13646 if (!ctx->ListState.CurrentList) {
13647 _mesa_error(ctx, GL_INVALID_OPERATION, "glEndList");
13648 return;
13649 }
13650
13651 /* Call before emitting END_OF_LIST, in case the driver wants to
13652 * emit opcodes itself.
13653 */
13654 vbo_save_EndList(ctx);
13655
13656 (void) alloc_instruction(ctx, OPCODE_END_OF_LIST, 0);
13657
13658 _mesa_HashLockMutex(ctx->Shared->DisplayList);
13659
13660 if (ctx->ListState.Current.UseLoopback)
13661 replace_op_vertex_list_recursively(ctx, ctx->ListState.CurrentList);
13662
13663 struct gl_dlist_state *list = &ctx->ListState;
13664 list->CurrentList->execute_glthread =
13665 _mesa_glthread_should_execute_list(ctx, list->CurrentList);
13666 ctx->Shared->DisplayListsAffectGLThread |= list->CurrentList->execute_glthread;
13667
13668 if ((list->CurrentList->Head == list->CurrentBlock) &&
13669 (list->CurrentPos < BLOCK_SIZE)) {
13670 /* This list has a low number of commands. Instead of storing them in a malloc-ed block
13671 * of memory (list->CurrentBlock), we store them in ctx->Shared->small_dlist_store.ptr.
13672 * This reduces cache misses in execute_list on successive lists since their commands
13673 * are now stored in the same array instead of being scattered in memory.
13674 */
13675 list->CurrentList->small_list = true;
13676 unsigned start;
13677
13678 if (ctx->Shared->small_dlist_store.size == 0) {
13679 util_idalloc_init(&ctx->Shared->small_dlist_store.free_idx, MAX2(1, list->CurrentPos));
13680 }
13681
13682 start = util_idalloc_alloc_range(&ctx->Shared->small_dlist_store.free_idx, list->CurrentPos);
13683
13684 if ((start + list->CurrentPos) > ctx->Shared->small_dlist_store.size) {
13685 ctx->Shared->small_dlist_store.size =
13686 ctx->Shared->small_dlist_store.free_idx.num_elements * 32;
13687 ctx->Shared->small_dlist_store.ptr = realloc(
13688 ctx->Shared->small_dlist_store.ptr,
13689 ctx->Shared->small_dlist_store.size * sizeof(Node));
13690 }
13691 list->CurrentList->start = start;
13692 list->CurrentList->count = list->CurrentPos;
13693
13694 memcpy(&ctx->Shared->small_dlist_store.ptr[start],
13695 list->CurrentBlock,
13696 list->CurrentList->count * sizeof(Node));
13697
13698 assert (ctx->Shared->small_dlist_store.ptr[start + list->CurrentList->count - 1].opcode == OPCODE_END_OF_LIST);
13699
13700 free(list->CurrentBlock);
13701 } else {
13702 /* Keep the mallocated storage */
13703 list->CurrentList->small_list = false;
13704 }
13705
13706 /* Destroy old list, if any */
13707 destroy_list(ctx, ctx->ListState.CurrentList->Name);
13708
13709 /* Install the new list */
13710 _mesa_HashInsertLocked(ctx->Shared->DisplayList,
13711 ctx->ListState.CurrentList->Name,
13712 ctx->ListState.CurrentList, true);
13713
13714 if (MESA_VERBOSE & VERBOSE_DISPLAY_LIST)
13715 mesa_print_display_list(ctx->ListState.CurrentList->Name);
13716
13717 _mesa_HashUnlockMutex(ctx->Shared->DisplayList);
13718
13719 ctx->ListState.CurrentList = NULL;
13720 ctx->ListState.CurrentBlock = NULL;
13721 ctx->ListState.CurrentPos = 0;
13722 ctx->ListState.LastInstSize = 0;
13723 ctx->ExecuteFlag = GL_TRUE;
13724 ctx->CompileFlag = GL_FALSE;
13725
13726 ctx->CurrentServerDispatch = ctx->Exec;
13727 _glapi_set_dispatch(ctx->CurrentServerDispatch);
13728 if (!ctx->GLThread.enabled) {
13729 ctx->CurrentClientDispatch = ctx->CurrentServerDispatch;
13730 }
13731 }
13732
13733
13734 void GLAPIENTRY
_mesa_CallList(GLuint list)13735 _mesa_CallList(GLuint list)
13736 {
13737 GLboolean save_compile_flag;
13738 GET_CURRENT_CONTEXT(ctx);
13739 FLUSH_CURRENT(ctx, 0);
13740
13741 if (MESA_VERBOSE & VERBOSE_API)
13742 _mesa_debug(ctx, "glCallList %d\n", list);
13743
13744 if (list == 0) {
13745 _mesa_error(ctx, GL_INVALID_VALUE, "glCallList(list==0)");
13746 return;
13747 }
13748
13749 if (0)
13750 mesa_print_display_list( list );
13751
13752 /* Save the CompileFlag status, turn it off, execute the display list,
13753 * and restore the CompileFlag. This is needed for GL_COMPILE_AND_EXECUTE
13754 * because the call is already recorded and we just need to execute it.
13755 */
13756 save_compile_flag = ctx->CompileFlag;
13757 if (save_compile_flag) {
13758 ctx->CompileFlag = GL_FALSE;
13759 }
13760
13761 _mesa_HashLockMutex(ctx->Shared->DisplayList);
13762 execute_list(ctx, list);
13763 _mesa_HashUnlockMutex(ctx->Shared->DisplayList);
13764 ctx->CompileFlag = save_compile_flag;
13765
13766 /* also restore API function pointers to point to "save" versions */
13767 if (save_compile_flag) {
13768 ctx->CurrentServerDispatch = ctx->Save;
13769 _glapi_set_dispatch(ctx->CurrentServerDispatch);
13770 if (!ctx->GLThread.enabled) {
13771 ctx->CurrentClientDispatch = ctx->CurrentServerDispatch;
13772 }
13773 }
13774 }
13775
13776
13777 /**
13778 * Try to execute a glCallLists() command where the display lists contain
13779 * glBitmap commands with a texture atlas.
13780 * \return true for success, false otherwise
13781 */
13782 static bool
render_bitmap_atlas(struct gl_context * ctx,GLsizei n,GLenum type,const void * lists)13783 render_bitmap_atlas(struct gl_context *ctx, GLsizei n, GLenum type,
13784 const void *lists)
13785 {
13786 struct gl_bitmap_atlas *atlas;
13787 int i;
13788
13789 if (!USE_BITMAP_ATLAS ||
13790 !ctx->Current.RasterPosValid ||
13791 ctx->List.ListBase == 0 ||
13792 type != GL_UNSIGNED_BYTE) {
13793 /* unsupported */
13794 return false;
13795 }
13796
13797 atlas = lookup_bitmap_atlas(ctx, ctx->List.ListBase);
13798
13799 if (!atlas) {
13800 /* Even if glGenLists wasn't called, we can still try to create
13801 * the atlas now.
13802 */
13803 atlas = alloc_bitmap_atlas(ctx, ctx->List.ListBase, false);
13804 }
13805
13806 if (atlas && !atlas->complete && !atlas->incomplete) {
13807 /* Try to build the bitmap atlas now.
13808 * If the atlas was created in glGenLists, we'll have recorded the
13809 * number of lists (bitmaps). Otherwise, take a guess at 256.
13810 */
13811 if (atlas->numBitmaps == 0)
13812 atlas->numBitmaps = 256;
13813 build_bitmap_atlas(ctx, atlas, ctx->List.ListBase);
13814 }
13815
13816 if (!atlas || !atlas->complete) {
13817 return false;
13818 }
13819
13820 /* check that all display list IDs are in the atlas */
13821 for (i = 0; i < n; i++) {
13822 const GLubyte *ids = (const GLubyte *) lists;
13823
13824 if (ids[i] >= atlas->numBitmaps) {
13825 return false;
13826 }
13827 }
13828
13829 st_DrawAtlasBitmaps(ctx, atlas, n, (const GLubyte *) lists);
13830
13831 return true;
13832 }
13833
13834
13835 /**
13836 * Execute glCallLists: call multiple display lists.
13837 */
13838 void GLAPIENTRY
_mesa_CallLists(GLsizei n,GLenum type,const GLvoid * lists)13839 _mesa_CallLists(GLsizei n, GLenum type, const GLvoid * lists)
13840 {
13841 GET_CURRENT_CONTEXT(ctx);
13842 GLboolean save_compile_flag;
13843
13844 if (MESA_VERBOSE & VERBOSE_API)
13845 _mesa_debug(ctx, "glCallLists %d\n", n);
13846
13847 if (type < GL_BYTE || type > GL_4_BYTES) {
13848 _mesa_error(ctx, GL_INVALID_ENUM, "glCallLists(type)");
13849 return;
13850 }
13851
13852 if (n < 0) {
13853 _mesa_error(ctx, GL_INVALID_VALUE, "glCallLists(n < 0)");
13854 return;
13855 } else if (n == 0 || lists == NULL) {
13856 /* nothing to do */
13857 return;
13858 }
13859
13860 if (render_bitmap_atlas(ctx, n, type, lists)) {
13861 return;
13862 }
13863
13864 /* Save the CompileFlag status, turn it off, execute the display lists,
13865 * and restore the CompileFlag. This is needed for GL_COMPILE_AND_EXECUTE
13866 * because the call is already recorded and we just need to execute it.
13867 */
13868 save_compile_flag = ctx->CompileFlag;
13869 ctx->CompileFlag = GL_FALSE;
13870
13871 GLbyte *bptr;
13872 GLubyte *ubptr;
13873 GLshort *sptr;
13874 GLushort *usptr;
13875 GLint *iptr;
13876 GLuint *uiptr;
13877 GLfloat *fptr;
13878
13879 GLuint base = ctx->List.ListBase;
13880
13881 _mesa_HashLockMutex(ctx->Shared->DisplayList);
13882
13883 /* A loop inside a switch is faster than a switch inside a loop. */
13884 switch (type) {
13885 case GL_BYTE:
13886 bptr = (GLbyte *) lists;
13887 for (unsigned i = 0; i < n; i++)
13888 execute_list(ctx, base + (int)bptr[i]);
13889 break;
13890 case GL_UNSIGNED_BYTE:
13891 ubptr = (GLubyte *) lists;
13892 for (unsigned i = 0; i < n; i++)
13893 execute_list(ctx, base + (int)ubptr[i]);
13894 break;
13895 case GL_SHORT:
13896 sptr = (GLshort *) lists;
13897 for (unsigned i = 0; i < n; i++)
13898 execute_list(ctx, base + (int)sptr[i]);
13899 break;
13900 case GL_UNSIGNED_SHORT:
13901 usptr = (GLushort *) lists;
13902 for (unsigned i = 0; i < n; i++)
13903 execute_list(ctx, base + (int)usptr[i]);
13904 break;
13905 case GL_INT:
13906 iptr = (GLint *) lists;
13907 for (unsigned i = 0; i < n; i++)
13908 execute_list(ctx, base + (int)iptr[i]);
13909 break;
13910 case GL_UNSIGNED_INT:
13911 uiptr = (GLuint *) lists;
13912 for (unsigned i = 0; i < n; i++)
13913 execute_list(ctx, base + (int)uiptr[i]);
13914 break;
13915 case GL_FLOAT:
13916 fptr = (GLfloat *) lists;
13917 for (unsigned i = 0; i < n; i++)
13918 execute_list(ctx, base + (int)fptr[i]);
13919 break;
13920 case GL_2_BYTES:
13921 ubptr = (GLubyte *) lists;
13922 for (unsigned i = 0; i < n; i++) {
13923 execute_list(ctx, base +
13924 (int)ubptr[2 * i] * 256 +
13925 (int)ubptr[2 * i + 1]);
13926 }
13927 break;
13928 case GL_3_BYTES:
13929 ubptr = (GLubyte *) lists;
13930 for (unsigned i = 0; i < n; i++) {
13931 execute_list(ctx, base +
13932 (int)ubptr[3 * i] * 65536 +
13933 (int)ubptr[3 * i + 1] * 256 +
13934 (int)ubptr[3 * i + 2]);
13935 }
13936 break;
13937 case GL_4_BYTES:
13938 ubptr = (GLubyte *) lists;
13939 for (unsigned i = 0; i < n; i++) {
13940 execute_list(ctx, base +
13941 (int)ubptr[4 * i] * 16777216 +
13942 (int)ubptr[4 * i + 1] * 65536 +
13943 (int)ubptr[4 * i + 2] * 256 +
13944 (int)ubptr[4 * i + 3]);
13945 }
13946 break;
13947 }
13948
13949 _mesa_HashUnlockMutex(ctx->Shared->DisplayList);
13950 ctx->CompileFlag = save_compile_flag;
13951
13952 /* also restore API function pointers to point to "save" versions */
13953 if (save_compile_flag) {
13954 ctx->CurrentServerDispatch = ctx->Save;
13955 _glapi_set_dispatch(ctx->CurrentServerDispatch);
13956 if (!ctx->GLThread.enabled) {
13957 ctx->CurrentClientDispatch = ctx->CurrentServerDispatch;
13958 }
13959 }
13960 }
13961
13962
13963 /**
13964 * Set the offset added to list numbers in glCallLists.
13965 */
13966 void GLAPIENTRY
_mesa_ListBase(GLuint base)13967 _mesa_ListBase(GLuint base)
13968 {
13969 GET_CURRENT_CONTEXT(ctx);
13970 FLUSH_VERTICES(ctx, 0, GL_LIST_BIT); /* must be called before assert */
13971 ASSERT_OUTSIDE_BEGIN_END(ctx);
13972 ctx->List.ListBase = base;
13973 }
13974
13975 /**
13976 * Setup the given dispatch table to point to Mesa's display list
13977 * building functions.
13978 *
13979 * This does not include any of the tnl functions - they are
13980 * initialized from _mesa_init_api_defaults and from the active vtxfmt
13981 * struct.
13982 */
13983 void
_mesa_initialize_save_table(const struct gl_context * ctx)13984 _mesa_initialize_save_table(const struct gl_context *ctx)
13985 {
13986 struct _glapi_table *table = ctx->Save;
13987 int numEntries = MAX2(_gloffset_COUNT, _glapi_get_dispatch_table_size());
13988
13989 /* Initially populate the dispatch table with the contents of the
13990 * normal-execution dispatch table. This lets us skip populating functions
13991 * that should be called directly instead of compiled into display lists.
13992 */
13993 memcpy(table, ctx->Exec, numEntries * sizeof(_glapi_proc));
13994
13995 #include "api_save_init.h"
13996 }
13997
13998
13999
14000 static const char *
enum_string(GLenum k)14001 enum_string(GLenum k)
14002 {
14003 return _mesa_enum_to_string(k);
14004 }
14005
14006
14007 /**
14008 * Print the commands in a display list. For debugging only.
14009 * TODO: many commands aren't handled yet.
14010 * \param fname filename to write display list to. If null, use stdout.
14011 */
14012 static void
print_list(struct gl_context * ctx,GLuint list,const char * fname)14013 print_list(struct gl_context *ctx, GLuint list, const char *fname)
14014 {
14015 struct gl_display_list *dlist;
14016 Node *n;
14017 FILE *f = stdout;
14018
14019 if (fname) {
14020 f = fopen(fname, "w");
14021 if (!f)
14022 return;
14023 }
14024
14025 if (!_mesa_get_list(ctx, list, &dlist, true)) {
14026 fprintf(f, "%u is not a display list ID\n", list);
14027 fflush(f);
14028 if (fname)
14029 fclose(f);
14030 return;
14031 }
14032
14033 n = get_list_head(ctx, dlist);
14034
14035 fprintf(f, "START-LIST %u, address %p\n", list, (void *) n);
14036
14037 while (1) {
14038 const OpCode opcode = n[0].opcode;
14039
14040 switch (opcode) {
14041 case OPCODE_ACCUM:
14042 fprintf(f, "Accum %s %g\n", enum_string(n[1].e), n[2].f);
14043 break;
14044 case OPCODE_ACTIVE_TEXTURE:
14045 fprintf(f, "ActiveTexture(%s)\n", enum_string(n[1].e));
14046 break;
14047 case OPCODE_BITMAP:
14048 fprintf(f, "Bitmap %d %d %g %g %g %g %p\n", n[1].i, n[2].i,
14049 n[3].f, n[4].f, n[5].f, n[6].f,
14050 get_pointer(&n[7]));
14051 break;
14052 case OPCODE_BLEND_COLOR:
14053 fprintf(f, "BlendColor %f, %f, %f, %f\n",
14054 n[1].f, n[2].f, n[3].f, n[4].f);
14055 break;
14056 case OPCODE_BLEND_EQUATION:
14057 fprintf(f, "BlendEquation %s\n",
14058 enum_string(n[1].e));
14059 break;
14060 case OPCODE_BLEND_EQUATION_SEPARATE:
14061 fprintf(f, "BlendEquationSeparate %s, %s\n",
14062 enum_string(n[1].e),
14063 enum_string(n[2].e));
14064 break;
14065 case OPCODE_BLEND_FUNC_SEPARATE:
14066 fprintf(f, "BlendFuncSeparate %s, %s, %s, %s\n",
14067 enum_string(n[1].e),
14068 enum_string(n[2].e),
14069 enum_string(n[3].e),
14070 enum_string(n[4].e));
14071 break;
14072 case OPCODE_BLEND_EQUATION_I:
14073 fprintf(f, "BlendEquationi %u, %s\n",
14074 n[1].ui, enum_string(n[2].e));
14075 break;
14076 case OPCODE_BLEND_EQUATION_SEPARATE_I:
14077 fprintf(f, "BlendEquationSeparatei %u, %s, %s\n",
14078 n[1].ui, enum_string(n[2].e), enum_string(n[3].e));
14079 break;
14080 case OPCODE_BLEND_FUNC_I:
14081 fprintf(f, "BlendFunci %u, %s, %s\n",
14082 n[1].ui, enum_string(n[2].e), enum_string(n[3].e));
14083 break;
14084 case OPCODE_BLEND_FUNC_SEPARATE_I:
14085 fprintf(f, "BlendFuncSeparatei %u, %s, %s, %s, %s\n",
14086 n[1].ui,
14087 enum_string(n[2].e),
14088 enum_string(n[3].e),
14089 enum_string(n[4].e),
14090 enum_string(n[5].e));
14091 break;
14092 case OPCODE_CALL_LIST:
14093 fprintf(f, "CallList %d\n", (int) n[1].ui);
14094 break;
14095 case OPCODE_CALL_LISTS:
14096 fprintf(f, "CallLists %d, %s\n", n[1].i, enum_string(n[1].e));
14097 break;
14098 case OPCODE_DISABLE:
14099 fprintf(f, "Disable %s\n", enum_string(n[1].e));
14100 break;
14101 case OPCODE_ENABLE:
14102 fprintf(f, "Enable %s\n", enum_string(n[1].e));
14103 break;
14104 case OPCODE_FRUSTUM:
14105 fprintf(f, "Frustum %g %g %g %g %g %g\n",
14106 n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f);
14107 break;
14108 case OPCODE_LINE_STIPPLE:
14109 fprintf(f, "LineStipple %d %x\n", n[1].i, (int) n[2].us);
14110 break;
14111 case OPCODE_LINE_WIDTH:
14112 fprintf(f, "LineWidth %f\n", n[1].f);
14113 break;
14114 case OPCODE_LOAD_IDENTITY:
14115 fprintf(f, "LoadIdentity\n");
14116 break;
14117 case OPCODE_LOAD_MATRIX:
14118 fprintf(f, "LoadMatrix\n");
14119 fprintf(f, " %8f %8f %8f %8f\n",
14120 n[1].f, n[5].f, n[9].f, n[13].f);
14121 fprintf(f, " %8f %8f %8f %8f\n",
14122 n[2].f, n[6].f, n[10].f, n[14].f);
14123 fprintf(f, " %8f %8f %8f %8f\n",
14124 n[3].f, n[7].f, n[11].f, n[15].f);
14125 fprintf(f, " %8f %8f %8f %8f\n",
14126 n[4].f, n[8].f, n[12].f, n[16].f);
14127 break;
14128 case OPCODE_MULT_MATRIX:
14129 fprintf(f, "MultMatrix (or Rotate)\n");
14130 fprintf(f, " %8f %8f %8f %8f\n",
14131 n[1].f, n[5].f, n[9].f, n[13].f);
14132 fprintf(f, " %8f %8f %8f %8f\n",
14133 n[2].f, n[6].f, n[10].f, n[14].f);
14134 fprintf(f, " %8f %8f %8f %8f\n",
14135 n[3].f, n[7].f, n[11].f, n[15].f);
14136 fprintf(f, " %8f %8f %8f %8f\n",
14137 n[4].f, n[8].f, n[12].f, n[16].f);
14138 break;
14139 case OPCODE_ORTHO:
14140 fprintf(f, "Ortho %g %g %g %g %g %g\n",
14141 n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f);
14142 break;
14143 case OPCODE_POINT_SIZE:
14144 fprintf(f, "PointSize %f\n", n[1].f);
14145 break;
14146 case OPCODE_POP_ATTRIB:
14147 fprintf(f, "PopAttrib\n");
14148 break;
14149 case OPCODE_POP_MATRIX:
14150 fprintf(f, "PopMatrix\n");
14151 break;
14152 case OPCODE_POP_NAME:
14153 fprintf(f, "PopName\n");
14154 break;
14155 case OPCODE_PUSH_ATTRIB:
14156 fprintf(f, "PushAttrib %x\n", n[1].bf);
14157 break;
14158 case OPCODE_PUSH_MATRIX:
14159 fprintf(f, "PushMatrix\n");
14160 break;
14161 case OPCODE_PUSH_NAME:
14162 fprintf(f, "PushName %d\n", (int) n[1].ui);
14163 break;
14164 case OPCODE_RASTER_POS:
14165 fprintf(f, "RasterPos %g %g %g %g\n",
14166 n[1].f, n[2].f, n[3].f, n[4].f);
14167 break;
14168 case OPCODE_ROTATE:
14169 fprintf(f, "Rotate %g %g %g %g\n",
14170 n[1].f, n[2].f, n[3].f, n[4].f);
14171 break;
14172 case OPCODE_SCALE:
14173 fprintf(f, "Scale %g %g %g\n", n[1].f, n[2].f, n[3].f);
14174 break;
14175 case OPCODE_TRANSLATE:
14176 fprintf(f, "Translate %g %g %g\n", n[1].f, n[2].f, n[3].f);
14177 break;
14178 case OPCODE_BIND_TEXTURE:
14179 fprintf(f, "BindTexture %s %d\n",
14180 _mesa_enum_to_string(n[1].ui), n[2].ui);
14181 break;
14182 case OPCODE_SHADE_MODEL:
14183 fprintf(f, "ShadeModel %s\n", _mesa_enum_to_string(n[1].ui));
14184 break;
14185 case OPCODE_MAP1:
14186 fprintf(f, "Map1 %s %.3f %.3f %d %d\n",
14187 _mesa_enum_to_string(n[1].ui),
14188 n[2].f, n[3].f, n[4].i, n[5].i);
14189 break;
14190 case OPCODE_MAP2:
14191 fprintf(f, "Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
14192 _mesa_enum_to_string(n[1].ui),
14193 n[2].f, n[3].f, n[4].f, n[5].f,
14194 n[6].i, n[7].i, n[8].i, n[9].i);
14195 break;
14196 case OPCODE_MAPGRID1:
14197 fprintf(f, "MapGrid1 %d %.3f %.3f\n", n[1].i, n[2].f, n[3].f);
14198 break;
14199 case OPCODE_MAPGRID2:
14200 fprintf(f, "MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
14201 n[1].i, n[2].f, n[3].f, n[4].i, n[5].f, n[6].f);
14202 break;
14203 case OPCODE_EVALMESH1:
14204 fprintf(f, "EvalMesh1 %d %d\n", n[1].i, n[2].i);
14205 break;
14206 case OPCODE_EVALMESH2:
14207 fprintf(f, "EvalMesh2 %d %d %d %d\n",
14208 n[1].i, n[2].i, n[3].i, n[4].i);
14209 break;
14210
14211 case OPCODE_ATTR_1F_NV:
14212 fprintf(f, "ATTR_1F_NV attr %d: %f\n", n[1].i, n[2].f);
14213 break;
14214 case OPCODE_ATTR_2F_NV:
14215 fprintf(f, "ATTR_2F_NV attr %d: %f %f\n",
14216 n[1].i, n[2].f, n[3].f);
14217 break;
14218 case OPCODE_ATTR_3F_NV:
14219 fprintf(f, "ATTR_3F_NV attr %d: %f %f %f\n",
14220 n[1].i, n[2].f, n[3].f, n[4].f);
14221 break;
14222 case OPCODE_ATTR_4F_NV:
14223 fprintf(f, "ATTR_4F_NV attr %d: %f %f %f %f\n",
14224 n[1].i, n[2].f, n[3].f, n[4].f, n[5].f);
14225 break;
14226 case OPCODE_ATTR_1F_ARB:
14227 fprintf(f, "ATTR_1F_ARB attr %d: %f\n", n[1].i, n[2].f);
14228 break;
14229 case OPCODE_ATTR_2F_ARB:
14230 fprintf(f, "ATTR_2F_ARB attr %d: %f %f\n",
14231 n[1].i, n[2].f, n[3].f);
14232 break;
14233 case OPCODE_ATTR_3F_ARB:
14234 fprintf(f, "ATTR_3F_ARB attr %d: %f %f %f\n",
14235 n[1].i, n[2].f, n[3].f, n[4].f);
14236 break;
14237 case OPCODE_ATTR_4F_ARB:
14238 fprintf(f, "ATTR_4F_ARB attr %d: %f %f %f %f\n",
14239 n[1].i, n[2].f, n[3].f, n[4].f, n[5].f);
14240 break;
14241
14242 case OPCODE_MATERIAL:
14243 fprintf(f, "MATERIAL %x %x: %f %f %f %f\n",
14244 n[1].i, n[2].i, n[3].f, n[4].f, n[5].f, n[6].f);
14245 break;
14246 case OPCODE_BEGIN:
14247 fprintf(f, "BEGIN %x\n", n[1].i);
14248 break;
14249 case OPCODE_END:
14250 fprintf(f, "END\n");
14251 break;
14252 case OPCODE_EVAL_C1:
14253 fprintf(f, "EVAL_C1 %f\n", n[1].f);
14254 break;
14255 case OPCODE_EVAL_C2:
14256 fprintf(f, "EVAL_C2 %f %f\n", n[1].f, n[2].f);
14257 break;
14258 case OPCODE_EVAL_P1:
14259 fprintf(f, "EVAL_P1 %d\n", n[1].i);
14260 break;
14261 case OPCODE_EVAL_P2:
14262 fprintf(f, "EVAL_P2 %d %d\n", n[1].i, n[2].i);
14263 break;
14264
14265 case OPCODE_PROVOKING_VERTEX:
14266 fprintf(f, "ProvokingVertex %s\n",
14267 _mesa_enum_to_string(n[1].ui));
14268 break;
14269
14270 /*
14271 * meta opcodes/commands
14272 */
14273 case OPCODE_ERROR:
14274 fprintf(f, "Error: %s %s\n", enum_string(n[1].e),
14275 (const char *) get_pointer(&n[2]));
14276 break;
14277 case OPCODE_CONTINUE:
14278 fprintf(f, "DISPLAY-LIST-CONTINUE\n");
14279 n = (Node *) get_pointer(&n[1]);
14280 continue;
14281 case OPCODE_VERTEX_LIST:
14282 case OPCODE_VERTEX_LIST_LOOPBACK:
14283 case OPCODE_VERTEX_LIST_COPY_CURRENT:
14284 vbo_print_vertex_list(ctx, (struct vbo_save_vertex_list *) &n[0], opcode, f);
14285 break;
14286 default:
14287 if (opcode < 0 || opcode > OPCODE_END_OF_LIST) {
14288 printf
14289 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
14290 opcode, (void *) n);
14291 } else {
14292 fprintf(f, "command %d, %u operands\n", opcode,
14293 n[0].InstSize);
14294 break;
14295 }
14296 FALLTHROUGH;
14297 case OPCODE_END_OF_LIST:
14298 fprintf(f, "END-LIST %u\n", list);
14299 fflush(f);
14300 if (fname)
14301 fclose(f);
14302 return;
14303 }
14304
14305 /* increment n to point to next compiled command */
14306 assert(n[0].InstSize > 0);
14307 n += n[0].InstSize;
14308 }
14309 }
14310
14311
14312 void
_mesa_glthread_execute_list(struct gl_context * ctx,GLuint list)14313 _mesa_glthread_execute_list(struct gl_context *ctx, GLuint list)
14314 {
14315 struct gl_display_list *dlist;
14316
14317 if (list == 0 ||
14318 !_mesa_get_list(ctx, list, &dlist, true) ||
14319 !dlist->execute_glthread)
14320 return;
14321
14322 Node *n = get_list_head(ctx, dlist);
14323
14324 while (1) {
14325 const OpCode opcode = n[0].opcode;
14326
14327 switch (opcode) {
14328 case OPCODE_CALL_LIST:
14329 /* Generated by glCallList(), don't add ListBase */
14330 if (ctx->GLThread.ListCallDepth < MAX_LIST_NESTING) {
14331 ctx->GLThread.ListCallDepth++;
14332 _mesa_glthread_execute_list(ctx, n[1].ui);
14333 ctx->GLThread.ListCallDepth--;
14334 }
14335 break;
14336 case OPCODE_CALL_LISTS:
14337 if (ctx->GLThread.ListCallDepth < MAX_LIST_NESTING) {
14338 ctx->GLThread.ListCallDepth++;
14339 _mesa_glthread_CallLists(ctx, n[1].i, n[2].e, get_pointer(&n[3]));
14340 ctx->GLThread.ListCallDepth--;
14341 }
14342 break;
14343 case OPCODE_DISABLE:
14344 _mesa_glthread_Disable(ctx, n[1].e);
14345 break;
14346 case OPCODE_ENABLE:
14347 _mesa_glthread_Enable(ctx, n[1].e);
14348 break;
14349 case OPCODE_LIST_BASE:
14350 _mesa_glthread_ListBase(ctx, n[1].ui);
14351 break;
14352 case OPCODE_MATRIX_MODE:
14353 _mesa_glthread_MatrixMode(ctx, n[1].e);
14354 break;
14355 case OPCODE_POP_ATTRIB:
14356 _mesa_glthread_PopAttrib(ctx);
14357 break;
14358 case OPCODE_POP_MATRIX:
14359 _mesa_glthread_PopMatrix(ctx);
14360 break;
14361 case OPCODE_PUSH_ATTRIB:
14362 _mesa_glthread_PushAttrib(ctx, n[1].bf);
14363 break;
14364 case OPCODE_PUSH_MATRIX:
14365 _mesa_glthread_PushMatrix(ctx);
14366 break;
14367 case OPCODE_ACTIVE_TEXTURE: /* GL_ARB_multitexture */
14368 _mesa_glthread_ActiveTexture(ctx, n[1].e);
14369 break;
14370 case OPCODE_MATRIX_PUSH:
14371 _mesa_glthread_MatrixPushEXT(ctx, n[1].e);
14372 break;
14373 case OPCODE_MATRIX_POP:
14374 _mesa_glthread_MatrixPopEXT(ctx, n[1].e);
14375 break;
14376 case OPCODE_CONTINUE:
14377 n = (Node *)get_pointer(&n[1]);
14378 continue;
14379 case OPCODE_END_OF_LIST:
14380 ctx->GLThread.ListCallDepth--;
14381 return;
14382 default:
14383 /* ignore */
14384 break;
14385 }
14386
14387 /* increment n to point to next compiled command */
14388 assert(n[0].InstSize > 0);
14389 n += n[0].InstSize;
14390 }
14391 }
14392
14393 static bool
_mesa_glthread_should_execute_list(struct gl_context * ctx,struct gl_display_list * dlist)14394 _mesa_glthread_should_execute_list(struct gl_context *ctx,
14395 struct gl_display_list *dlist)
14396 {
14397 Node *n = get_list_head(ctx, dlist);
14398
14399 while (1) {
14400 const OpCode opcode = n[0].opcode;
14401
14402 switch (opcode) {
14403 case OPCODE_CALL_LIST:
14404 case OPCODE_CALL_LISTS:
14405 case OPCODE_DISABLE:
14406 case OPCODE_ENABLE:
14407 case OPCODE_LIST_BASE:
14408 case OPCODE_MATRIX_MODE:
14409 case OPCODE_POP_ATTRIB:
14410 case OPCODE_POP_MATRIX:
14411 case OPCODE_PUSH_ATTRIB:
14412 case OPCODE_PUSH_MATRIX:
14413 case OPCODE_ACTIVE_TEXTURE: /* GL_ARB_multitexture */
14414 case OPCODE_MATRIX_PUSH:
14415 case OPCODE_MATRIX_POP:
14416 return true;
14417 case OPCODE_CONTINUE:
14418 n = (Node *)get_pointer(&n[1]);
14419 continue;
14420 case OPCODE_END_OF_LIST:
14421 return false;
14422 default:
14423 /* ignore */
14424 break;
14425 }
14426
14427 /* increment n to point to next compiled command */
14428 assert(n[0].InstSize > 0);
14429 n += n[0].InstSize;
14430 }
14431 return false;
14432 }
14433
14434
14435 /**
14436 * Clients may call this function to help debug display list problems.
14437 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
14438 * changed, or break in the future without notice.
14439 */
14440 void
mesa_print_display_list(GLuint list)14441 mesa_print_display_list(GLuint list)
14442 {
14443 GET_CURRENT_CONTEXT(ctx);
14444 print_list(ctx, list, NULL);
14445 }
14446
14447
14448 /**********************************************************************/
14449 /***** Initialization *****/
14450 /**********************************************************************/
14451
14452 /**
14453 * Initialize display list state for given context.
14454 */
14455 void
_mesa_init_display_list(struct gl_context * ctx)14456 _mesa_init_display_list(struct gl_context *ctx)
14457 {
14458 /* Display list */
14459 ctx->ListState.CallDepth = 1;
14460 ctx->ExecuteFlag = GL_TRUE;
14461 ctx->CompileFlag = GL_FALSE;
14462 ctx->ListState.CurrentBlock = NULL;
14463 ctx->ListState.CurrentPos = 0;
14464 ctx->ListState.LastInstSize = 0;
14465
14466 /* Display List group */
14467 ctx->List.ListBase = 0;
14468 }
14469
14470
14471 void
_mesa_install_save_vtxfmt(struct gl_context * ctx)14472 _mesa_install_save_vtxfmt(struct gl_context *ctx)
14473 {
14474 struct _glapi_table *tab = ctx->Save;
14475 assert(ctx->API == API_OPENGL_COMPAT);
14476
14477 #define NAME_AE(x) _mesa_##x
14478 #define NAME_CALLLIST(x) save_##x
14479 #define NAME(x) save_##x
14480 #define NAME_ES(x) save_##x
14481
14482 #include "api_vtxfmt_init.h"
14483 }
14484