revert 213 commits (to 56092) from the last month. 10 still need work to resolve...
[AROS.git] / workbench / libs / mesa / src / mesa / main / dlist.c
blob9ff2af3af0b627785baa55c7854a79a49d3fbbb8
1 /*
2 * Mesa 3-D graphics library
3 * Version: 7.7
5 * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
6 * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the "Software"),
10 * to deal in the Software without restriction, including without limitation
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
15 * The above copyright notice and this permission notice shall be included
16 * in all copies or substantial portions of the Software.
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
22 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 /**
28 * \file dlist.c
29 * Display lists management functions.
32 #include "glheader.h"
33 #include "imports.h"
34 #include "api_arrayelt.h"
35 #include "api_exec.h"
36 #include "api_loopback.h"
37 #if FEATURE_ATI_fragment_shader
38 #include "atifragshader.h"
39 #endif
40 #include "config.h"
41 #include "mfeatures.h"
42 #if FEATURE_ARB_vertex_buffer_object
43 #include "bufferobj.h"
44 #endif
45 #include "arrayobj.h"
46 #include "context.h"
47 #include "dlist.h"
48 #include "enums.h"
49 #include "eval.h"
50 #include "framebuffer.h"
51 #include "glapi/glapi.h"
52 #include "hash.h"
53 #include "image.h"
54 #include "light.h"
55 #include "macros.h"
56 #include "pack.h"
57 #include "pbo.h"
58 #include "queryobj.h"
59 #include "samplerobj.h"
60 #include "shaderapi.h"
61 #include "syncobj.h"
62 #include "teximage.h"
63 #include "mtypes.h"
64 #include "varray.h"
65 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
66 #include "arbprogram.h"
67 #endif
68 #if FEATURE_NV_vertex_program || FEATURE_NV_fragment_program
69 #include "nvprogram.h"
70 #endif
72 #include "math/m_matrix.h"
74 #include "main/dispatch.h"
78 /**
79 * Other parts of Mesa (such as the VBO module) can plug into the display
80 * list system. This structure describes new display list instructions.
82 struct gl_list_instruction
84 GLuint Size;
85 void (*Execute)( struct gl_context *ctx, void *data );
86 void (*Destroy)( struct gl_context *ctx, void *data );
87 void (*Print)( struct gl_context *ctx, void *data );
91 #define MAX_DLIST_EXT_OPCODES 16
93 /**
94 * Used by device drivers to hook new commands into display lists.
96 struct gl_list_extensions
98 struct gl_list_instruction Opcode[MAX_DLIST_EXT_OPCODES];
99 GLuint NumOpcodes;
105 * Flush vertices.
107 * \param ctx GL context.
109 * Checks if dd_function_table::SaveNeedFlush is marked to flush
110 * stored (save) vertices, and calls
111 * dd_function_table::SaveFlushVertices if so.
113 #define SAVE_FLUSH_VERTICES(ctx) \
114 do { \
115 if (ctx->Driver.SaveNeedFlush) \
116 ctx->Driver.SaveFlushVertices(ctx); \
117 } while (0)
121 * Macro to assert that the API call was made outside the
122 * glBegin()/glEnd() pair, with return value.
124 * \param ctx GL context.
125 * \param retval value to return value in case the assertion fails.
127 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval) \
128 do { \
129 if (ctx->Driver.CurrentSavePrimitive <= GL_POLYGON || \
130 ctx->Driver.CurrentSavePrimitive == PRIM_INSIDE_UNKNOWN_PRIM) { \
131 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \
132 return retval; \
134 } while (0)
137 * Macro to assert that the API call was made outside the
138 * glBegin()/glEnd() pair.
140 * \param ctx GL context.
142 #define ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx) \
143 do { \
144 if (ctx->Driver.CurrentSavePrimitive <= GL_POLYGON || \
145 ctx->Driver.CurrentSavePrimitive == PRIM_INSIDE_UNKNOWN_PRIM) { \
146 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \
147 return; \
149 } while (0)
152 * Macro to assert that the API call was made outside the
153 * glBegin()/glEnd() pair and flush the vertices.
155 * \param ctx GL context.
157 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx) \
158 do { \
159 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx); \
160 SAVE_FLUSH_VERTICES(ctx); \
161 } while (0)
164 * Macro to assert that the API call was made outside the
165 * glBegin()/glEnd() pair and flush the vertices, with return value.
167 * \param ctx GL context.
168 * \param retval value to return value in case the assertion fails.
170 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval)\
171 do { \
172 ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval); \
173 SAVE_FLUSH_VERTICES(ctx); \
174 } while (0)
179 * Display list opcodes.
181 * The fact that these identifiers are assigned consecutive
182 * integer values starting at 0 is very important, see InstSize array usage)
184 typedef enum
186 OPCODE_INVALID = -1, /* Force signed enum */
187 OPCODE_ACCUM,
188 OPCODE_ALPHA_FUNC,
189 OPCODE_BIND_TEXTURE,
190 OPCODE_BITMAP,
191 OPCODE_BLEND_COLOR,
192 OPCODE_BLEND_EQUATION,
193 OPCODE_BLEND_EQUATION_SEPARATE,
194 OPCODE_BLEND_FUNC_SEPARATE,
196 OPCODE_BLEND_EQUATION_I,
197 OPCODE_BLEND_EQUATION_SEPARATE_I,
198 OPCODE_BLEND_FUNC_I,
199 OPCODE_BLEND_FUNC_SEPARATE_I,
201 OPCODE_CALL_LIST,
202 OPCODE_CALL_LIST_OFFSET,
203 OPCODE_CLEAR,
204 OPCODE_CLEAR_ACCUM,
205 OPCODE_CLEAR_COLOR,
206 OPCODE_CLEAR_DEPTH,
207 OPCODE_CLEAR_INDEX,
208 OPCODE_CLEAR_STENCIL,
209 OPCODE_CLEAR_BUFFER_IV,
210 OPCODE_CLEAR_BUFFER_UIV,
211 OPCODE_CLEAR_BUFFER_FV,
212 OPCODE_CLEAR_BUFFER_FI,
213 OPCODE_CLIP_PLANE,
214 OPCODE_COLOR_MASK,
215 OPCODE_COLOR_MASK_INDEXED,
216 OPCODE_COLOR_MATERIAL,
217 OPCODE_COLOR_TABLE,
218 OPCODE_COLOR_TABLE_PARAMETER_FV,
219 OPCODE_COLOR_TABLE_PARAMETER_IV,
220 OPCODE_COLOR_SUB_TABLE,
221 OPCODE_CONVOLUTION_FILTER_1D,
222 OPCODE_CONVOLUTION_FILTER_2D,
223 OPCODE_CONVOLUTION_PARAMETER_I,
224 OPCODE_CONVOLUTION_PARAMETER_IV,
225 OPCODE_CONVOLUTION_PARAMETER_F,
226 OPCODE_CONVOLUTION_PARAMETER_FV,
227 OPCODE_COPY_COLOR_SUB_TABLE,
228 OPCODE_COPY_COLOR_TABLE,
229 OPCODE_COPY_PIXELS,
230 OPCODE_COPY_TEX_IMAGE1D,
231 OPCODE_COPY_TEX_IMAGE2D,
232 OPCODE_COPY_TEX_SUB_IMAGE1D,
233 OPCODE_COPY_TEX_SUB_IMAGE2D,
234 OPCODE_COPY_TEX_SUB_IMAGE3D,
235 OPCODE_CULL_FACE,
236 OPCODE_DEPTH_FUNC,
237 OPCODE_DEPTH_MASK,
238 OPCODE_DEPTH_RANGE,
239 OPCODE_DISABLE,
240 OPCODE_DISABLE_INDEXED,
241 OPCODE_DRAW_BUFFER,
242 OPCODE_DRAW_PIXELS,
243 OPCODE_ENABLE,
244 OPCODE_ENABLE_INDEXED,
245 OPCODE_EVALMESH1,
246 OPCODE_EVALMESH2,
247 OPCODE_FOG,
248 OPCODE_FRONT_FACE,
249 OPCODE_FRUSTUM,
250 OPCODE_HINT,
251 OPCODE_HISTOGRAM,
252 OPCODE_INDEX_MASK,
253 OPCODE_INIT_NAMES,
254 OPCODE_LIGHT,
255 OPCODE_LIGHT_MODEL,
256 OPCODE_LINE_STIPPLE,
257 OPCODE_LINE_WIDTH,
258 OPCODE_LIST_BASE,
259 OPCODE_LOAD_IDENTITY,
260 OPCODE_LOAD_MATRIX,
261 OPCODE_LOAD_NAME,
262 OPCODE_LOGIC_OP,
263 OPCODE_MAP1,
264 OPCODE_MAP2,
265 OPCODE_MAPGRID1,
266 OPCODE_MAPGRID2,
267 OPCODE_MATRIX_MODE,
268 OPCODE_MIN_MAX,
269 OPCODE_MULT_MATRIX,
270 OPCODE_ORTHO,
271 OPCODE_PASSTHROUGH,
272 OPCODE_PIXEL_MAP,
273 OPCODE_PIXEL_TRANSFER,
274 OPCODE_PIXEL_ZOOM,
275 OPCODE_POINT_SIZE,
276 OPCODE_POINT_PARAMETERS,
277 OPCODE_POLYGON_MODE,
278 OPCODE_POLYGON_STIPPLE,
279 OPCODE_POLYGON_OFFSET,
280 OPCODE_POP_ATTRIB,
281 OPCODE_POP_MATRIX,
282 OPCODE_POP_NAME,
283 OPCODE_PRIORITIZE_TEXTURE,
284 OPCODE_PUSH_ATTRIB,
285 OPCODE_PUSH_MATRIX,
286 OPCODE_PUSH_NAME,
287 OPCODE_RASTER_POS,
288 OPCODE_READ_BUFFER,
289 OPCODE_RESET_HISTOGRAM,
290 OPCODE_RESET_MIN_MAX,
291 OPCODE_ROTATE,
292 OPCODE_SCALE,
293 OPCODE_SCISSOR,
294 OPCODE_SELECT_TEXTURE_SGIS,
295 OPCODE_SELECT_TEXTURE_COORD_SET,
296 OPCODE_SHADE_MODEL,
297 OPCODE_STENCIL_FUNC,
298 OPCODE_STENCIL_MASK,
299 OPCODE_STENCIL_OP,
300 OPCODE_TEXENV,
301 OPCODE_TEXGEN,
302 OPCODE_TEXPARAMETER,
303 OPCODE_TEX_IMAGE1D,
304 OPCODE_TEX_IMAGE2D,
305 OPCODE_TEX_IMAGE3D,
306 OPCODE_TEX_SUB_IMAGE1D,
307 OPCODE_TEX_SUB_IMAGE2D,
308 OPCODE_TEX_SUB_IMAGE3D,
309 OPCODE_TRANSLATE,
310 OPCODE_VIEWPORT,
311 OPCODE_WINDOW_POS,
312 /* GL_ARB_multitexture */
313 OPCODE_ACTIVE_TEXTURE,
314 /* GL_ARB_texture_compression */
315 OPCODE_COMPRESSED_TEX_IMAGE_1D,
316 OPCODE_COMPRESSED_TEX_IMAGE_2D,
317 OPCODE_COMPRESSED_TEX_IMAGE_3D,
318 OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D,
319 OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D,
320 OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D,
321 /* GL_ARB_multisample */
322 OPCODE_SAMPLE_COVERAGE,
323 /* GL_ARB_window_pos */
324 OPCODE_WINDOW_POS_ARB,
325 /* GL_NV_vertex_program */
326 OPCODE_BIND_PROGRAM_NV,
327 OPCODE_EXECUTE_PROGRAM_NV,
328 OPCODE_REQUEST_RESIDENT_PROGRAMS_NV,
329 OPCODE_LOAD_PROGRAM_NV,
330 OPCODE_TRACK_MATRIX_NV,
331 /* GL_NV_fragment_program */
332 OPCODE_PROGRAM_LOCAL_PARAMETER_ARB,
333 OPCODE_PROGRAM_NAMED_PARAMETER_NV,
334 /* GL_EXT_stencil_two_side */
335 OPCODE_ACTIVE_STENCIL_FACE_EXT,
336 /* GL_EXT_depth_bounds_test */
337 OPCODE_DEPTH_BOUNDS_EXT,
338 /* GL_ARB_vertex/fragment_program */
339 OPCODE_PROGRAM_STRING_ARB,
340 OPCODE_PROGRAM_ENV_PARAMETER_ARB,
341 /* GL_ARB_occlusion_query */
342 OPCODE_BEGIN_QUERY_ARB,
343 OPCODE_END_QUERY_ARB,
344 /* GL_ARB_draw_buffers */
345 OPCODE_DRAW_BUFFERS_ARB,
346 /* GL_ATI_fragment_shader */
347 OPCODE_TEX_BUMP_PARAMETER_ATI,
348 /* GL_ATI_fragment_shader */
349 OPCODE_BIND_FRAGMENT_SHADER_ATI,
350 OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI,
351 /* OpenGL 2.0 */
352 OPCODE_STENCIL_FUNC_SEPARATE,
353 OPCODE_STENCIL_OP_SEPARATE,
354 OPCODE_STENCIL_MASK_SEPARATE,
356 /* GL_ARB_shader_objects */
357 OPCODE_USE_PROGRAM,
358 OPCODE_UNIFORM_1F,
359 OPCODE_UNIFORM_2F,
360 OPCODE_UNIFORM_3F,
361 OPCODE_UNIFORM_4F,
362 OPCODE_UNIFORM_1FV,
363 OPCODE_UNIFORM_2FV,
364 OPCODE_UNIFORM_3FV,
365 OPCODE_UNIFORM_4FV,
366 OPCODE_UNIFORM_1I,
367 OPCODE_UNIFORM_2I,
368 OPCODE_UNIFORM_3I,
369 OPCODE_UNIFORM_4I,
370 OPCODE_UNIFORM_1IV,
371 OPCODE_UNIFORM_2IV,
372 OPCODE_UNIFORM_3IV,
373 OPCODE_UNIFORM_4IV,
374 OPCODE_UNIFORM_MATRIX22,
375 OPCODE_UNIFORM_MATRIX33,
376 OPCODE_UNIFORM_MATRIX44,
377 OPCODE_UNIFORM_MATRIX23,
378 OPCODE_UNIFORM_MATRIX32,
379 OPCODE_UNIFORM_MATRIX24,
380 OPCODE_UNIFORM_MATRIX42,
381 OPCODE_UNIFORM_MATRIX34,
382 OPCODE_UNIFORM_MATRIX43,
384 /* OpenGL 3.0 */
385 OPCODE_UNIFORM_1UI,
386 OPCODE_UNIFORM_2UI,
387 OPCODE_UNIFORM_3UI,
388 OPCODE_UNIFORM_4UI,
389 OPCODE_UNIFORM_1UIV,
390 OPCODE_UNIFORM_2UIV,
391 OPCODE_UNIFORM_3UIV,
392 OPCODE_UNIFORM_4UIV,
394 /* GL_ARB_color_buffer_float */
395 OPCODE_CLAMP_COLOR,
397 /* GL_EXT_framebuffer_blit */
398 OPCODE_BLIT_FRAMEBUFFER,
400 /* Vertex attributes -- fallback for when optimized display
401 * list build isn't active.
403 OPCODE_ATTR_1F_NV,
404 OPCODE_ATTR_2F_NV,
405 OPCODE_ATTR_3F_NV,
406 OPCODE_ATTR_4F_NV,
407 OPCODE_ATTR_1F_ARB,
408 OPCODE_ATTR_2F_ARB,
409 OPCODE_ATTR_3F_ARB,
410 OPCODE_ATTR_4F_ARB,
411 OPCODE_MATERIAL,
412 OPCODE_BEGIN,
413 OPCODE_END,
414 OPCODE_RECTF,
415 OPCODE_EVAL_C1,
416 OPCODE_EVAL_C2,
417 OPCODE_EVAL_P1,
418 OPCODE_EVAL_P2,
420 /* GL_EXT_provoking_vertex */
421 OPCODE_PROVOKING_VERTEX,
423 /* GL_EXT_transform_feedback */
424 OPCODE_BEGIN_TRANSFORM_FEEDBACK,
425 OPCODE_END_TRANSFORM_FEEDBACK,
426 OPCODE_BIND_TRANSFORM_FEEDBACK,
427 OPCODE_PAUSE_TRANSFORM_FEEDBACK,
428 OPCODE_RESUME_TRANSFORM_FEEDBACK,
429 OPCODE_DRAW_TRANSFORM_FEEDBACK,
431 /* GL_EXT_texture_integer */
432 OPCODE_CLEARCOLOR_I,
433 OPCODE_CLEARCOLOR_UI,
434 OPCODE_TEXPARAMETER_I,
435 OPCODE_TEXPARAMETER_UI,
437 /* GL_EXT_separate_shader_objects */
438 OPCODE_ACTIVE_PROGRAM_EXT,
439 OPCODE_USE_SHADER_PROGRAM_EXT,
441 /* GL_ARB_instanced_arrays */
442 OPCODE_VERTEX_ATTRIB_DIVISOR,
444 /* GL_NV_texture_barrier */
445 OPCODE_TEXTURE_BARRIER_NV,
447 /* GL_ARB_sampler_object */
448 OPCODE_BIND_SAMPLER,
449 OPCODE_SAMPLER_PARAMETERIV,
450 OPCODE_SAMPLER_PARAMETERFV,
451 OPCODE_SAMPLER_PARAMETERIIV,
452 OPCODE_SAMPLER_PARAMETERUIV,
454 /* GL_ARB_geometry_shader4 */
455 OPCODE_PROGRAM_PARAMETERI,
456 OPCODE_FRAMEBUFFER_TEXTURE,
457 OPCODE_FRAMEBUFFER_TEXTURE_FACE,
459 /* GL_ARB_sync */
460 OPCODE_WAIT_SYNC,
462 /* The following three are meta instructions */
463 OPCODE_ERROR, /* raise compiled-in error */
464 OPCODE_CONTINUE,
465 OPCODE_END_OF_LIST,
466 OPCODE_EXT_0
467 } OpCode;
472 * Display list node.
474 * Display list instructions are stored as sequences of "nodes". Nodes
475 * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
476 * are linked together with a pointer.
478 * Each instruction in the display list is stored as a sequence of
479 * contiguous nodes in memory.
480 * Each node is the union of a variety of data types.
482 union gl_dlist_node
484 OpCode opcode;
485 GLboolean b;
486 GLbitfield bf;
487 GLubyte ub;
488 GLshort s;
489 GLushort us;
490 GLint i;
491 GLuint ui;
492 GLenum e;
493 GLfloat f;
494 GLvoid *data;
495 void *next; /* If prev node's opcode==OPCODE_CONTINUE */
499 typedef union gl_dlist_node Node;
503 * Used to store a 64-bit uint in a pair of "Nodes" for the sake of 32-bit
504 * environment. In 64-bit env, sizeof(Node)==8 anyway.
506 union uint64_pair
508 GLuint64 uint64;
509 GLuint uint32[2];
514 * How many nodes to allocate at a time.
516 * \note Reduced now that we hold vertices etc. elsewhere.
518 #define BLOCK_SIZE 256
523 * Number of nodes of storage needed for each instruction.
524 * Sizes for dynamically allocated opcodes are stored in the context struct.
526 static GLuint InstSize[OPCODE_END_OF_LIST + 1];
529 #if FEATURE_dlist
532 void mesa_print_display_list(GLuint list);
535 /**********************************************************************/
536 /***** Private *****/
537 /**********************************************************************/
541 * Make an empty display list. This is used by glGenLists() to
542 * reserve display list IDs.
544 static struct gl_display_list *
545 make_list(GLuint name, GLuint count)
547 struct gl_display_list *dlist = CALLOC_STRUCT(gl_display_list);
548 dlist->Name = name;
549 dlist->Head = (Node *) malloc(sizeof(Node) * count);
550 dlist->Head[0].opcode = OPCODE_END_OF_LIST;
551 return dlist;
556 * Lookup function to just encapsulate casting.
558 static INLINE struct gl_display_list *
559 lookup_list(struct gl_context *ctx, GLuint list)
561 return (struct gl_display_list *)
562 _mesa_HashLookup(ctx->Shared->DisplayList, list);
566 /** Is the given opcode an extension code? */
567 static INLINE GLboolean
568 is_ext_opcode(OpCode opcode)
570 return (opcode >= OPCODE_EXT_0);
574 /** Destroy an extended opcode instruction */
575 static GLint
576 ext_opcode_destroy(struct gl_context *ctx, Node *node)
578 const GLint i = node[0].opcode - OPCODE_EXT_0;
579 GLint step;
580 ctx->ListExt->Opcode[i].Destroy(ctx, &node[1]);
581 step = ctx->ListExt->Opcode[i].Size;
582 return step;
586 /** Execute an extended opcode instruction */
587 static GLint
588 ext_opcode_execute(struct gl_context *ctx, Node *node)
590 const GLint i = node[0].opcode - OPCODE_EXT_0;
591 GLint step;
592 ctx->ListExt->Opcode[i].Execute(ctx, &node[1]);
593 step = ctx->ListExt->Opcode[i].Size;
594 return step;
598 /** Print an extended opcode instruction */
599 static GLint
600 ext_opcode_print(struct gl_context *ctx, Node *node)
602 const GLint i = node[0].opcode - OPCODE_EXT_0;
603 GLint step;
604 ctx->ListExt->Opcode[i].Print(ctx, &node[1]);
605 step = ctx->ListExt->Opcode[i].Size;
606 return step;
611 * Delete the named display list, but don't remove from hash table.
612 * \param dlist - display list pointer
614 void
615 _mesa_delete_list(struct gl_context *ctx, struct gl_display_list *dlist)
617 Node *n, *block;
618 GLboolean done;
620 n = block = dlist->Head;
622 done = block ? GL_FALSE : GL_TRUE;
623 while (!done) {
624 const OpCode opcode = n[0].opcode;
626 /* check for extension opcodes first */
627 if (is_ext_opcode(opcode)) {
628 n += ext_opcode_destroy(ctx, n);
630 else {
631 switch (opcode) {
632 /* for some commands, we need to free malloc'd memory */
633 case OPCODE_MAP1:
634 free(n[6].data);
635 n += InstSize[n[0].opcode];
636 break;
637 case OPCODE_MAP2:
638 free(n[10].data);
639 n += InstSize[n[0].opcode];
640 break;
641 case OPCODE_DRAW_PIXELS:
642 free(n[5].data);
643 n += InstSize[n[0].opcode];
644 break;
645 case OPCODE_BITMAP:
646 free(n[7].data);
647 n += InstSize[n[0].opcode];
648 break;
649 case OPCODE_COLOR_TABLE:
650 free(n[6].data);
651 n += InstSize[n[0].opcode];
652 break;
653 case OPCODE_COLOR_SUB_TABLE:
654 free(n[6].data);
655 n += InstSize[n[0].opcode];
656 break;
657 case OPCODE_CONVOLUTION_FILTER_1D:
658 free(n[6].data);
659 n += InstSize[n[0].opcode];
660 break;
661 case OPCODE_CONVOLUTION_FILTER_2D:
662 free(n[7].data);
663 n += InstSize[n[0].opcode];
664 break;
665 case OPCODE_POLYGON_STIPPLE:
666 free(n[1].data);
667 n += InstSize[n[0].opcode];
668 break;
669 case OPCODE_TEX_IMAGE1D:
670 free(n[8].data);
671 n += InstSize[n[0].opcode];
672 break;
673 case OPCODE_TEX_IMAGE2D:
674 free(n[9].data);
675 n += InstSize[n[0].opcode];
676 break;
677 case OPCODE_TEX_IMAGE3D:
678 free(n[10].data);
679 n += InstSize[n[0].opcode];
680 break;
681 case OPCODE_TEX_SUB_IMAGE1D:
682 free(n[7].data);
683 n += InstSize[n[0].opcode];
684 break;
685 case OPCODE_TEX_SUB_IMAGE2D:
686 free(n[9].data);
687 n += InstSize[n[0].opcode];
688 break;
689 case OPCODE_TEX_SUB_IMAGE3D:
690 free(n[11].data);
691 n += InstSize[n[0].opcode];
692 break;
693 case OPCODE_COMPRESSED_TEX_IMAGE_1D:
694 free(n[7].data);
695 n += InstSize[n[0].opcode];
696 break;
697 case OPCODE_COMPRESSED_TEX_IMAGE_2D:
698 free(n[8].data);
699 n += InstSize[n[0].opcode];
700 break;
701 case OPCODE_COMPRESSED_TEX_IMAGE_3D:
702 free(n[9].data);
703 n += InstSize[n[0].opcode];
704 break;
705 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D:
706 free(n[7].data);
707 n += InstSize[n[0].opcode];
708 break;
709 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D:
710 free(n[9].data);
711 n += InstSize[n[0].opcode];
712 break;
713 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D:
714 free(n[11].data);
715 n += InstSize[n[0].opcode];
716 break;
717 #if FEATURE_NV_vertex_program
718 case OPCODE_LOAD_PROGRAM_NV:
719 free(n[4].data); /* program string */
720 n += InstSize[n[0].opcode];
721 break;
722 case OPCODE_REQUEST_RESIDENT_PROGRAMS_NV:
723 free(n[2].data); /* array of program ids */
724 n += InstSize[n[0].opcode];
725 break;
726 #endif
727 #if FEATURE_NV_fragment_program
728 case OPCODE_PROGRAM_NAMED_PARAMETER_NV:
729 free(n[3].data); /* parameter name */
730 n += InstSize[n[0].opcode];
731 break;
732 #endif
733 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
734 case OPCODE_PROGRAM_STRING_ARB:
735 free(n[4].data); /* program string */
736 n += InstSize[n[0].opcode];
737 break;
738 #endif
739 case OPCODE_UNIFORM_1FV:
740 case OPCODE_UNIFORM_2FV:
741 case OPCODE_UNIFORM_3FV:
742 case OPCODE_UNIFORM_4FV:
743 case OPCODE_UNIFORM_1IV:
744 case OPCODE_UNIFORM_2IV:
745 case OPCODE_UNIFORM_3IV:
746 case OPCODE_UNIFORM_4IV:
747 case OPCODE_UNIFORM_1UIV:
748 case OPCODE_UNIFORM_2UIV:
749 case OPCODE_UNIFORM_3UIV:
750 case OPCODE_UNIFORM_4UIV:
751 free(n[3].data);
752 n += InstSize[n[0].opcode];
753 break;
754 case OPCODE_UNIFORM_MATRIX22:
755 case OPCODE_UNIFORM_MATRIX33:
756 case OPCODE_UNIFORM_MATRIX44:
757 case OPCODE_UNIFORM_MATRIX24:
758 case OPCODE_UNIFORM_MATRIX42:
759 case OPCODE_UNIFORM_MATRIX23:
760 case OPCODE_UNIFORM_MATRIX32:
761 case OPCODE_UNIFORM_MATRIX34:
762 case OPCODE_UNIFORM_MATRIX43:
763 free(n[4].data);
764 n += InstSize[n[0].opcode];
765 break;
767 case OPCODE_CONTINUE:
768 n = (Node *) n[1].next;
769 free(block);
770 block = n;
771 break;
772 case OPCODE_END_OF_LIST:
773 free(block);
774 done = GL_TRUE;
775 break;
776 default:
777 /* Most frequent case */
778 n += InstSize[n[0].opcode];
779 break;
784 free(dlist);
789 * Destroy a display list and remove from hash table.
790 * \param list - display list number
792 static void
793 destroy_list(struct gl_context *ctx, GLuint list)
795 struct gl_display_list *dlist;
797 if (list == 0)
798 return;
800 dlist = lookup_list(ctx, list);
801 if (!dlist)
802 return;
804 _mesa_delete_list(ctx, dlist);
805 _mesa_HashRemove(ctx->Shared->DisplayList, list);
810 * Translate the nth element of list from <type> to GLint.
812 static GLint
813 translate_id(GLsizei n, GLenum type, const GLvoid * list)
815 GLbyte *bptr;
816 GLubyte *ubptr;
817 GLshort *sptr;
818 GLushort *usptr;
819 GLint *iptr;
820 GLuint *uiptr;
821 GLfloat *fptr;
823 switch (type) {
824 case GL_BYTE:
825 bptr = (GLbyte *) list;
826 return (GLint) bptr[n];
827 case GL_UNSIGNED_BYTE:
828 ubptr = (GLubyte *) list;
829 return (GLint) ubptr[n];
830 case GL_SHORT:
831 sptr = (GLshort *) list;
832 return (GLint) sptr[n];
833 case GL_UNSIGNED_SHORT:
834 usptr = (GLushort *) list;
835 return (GLint) usptr[n];
836 case GL_INT:
837 iptr = (GLint *) list;
838 return iptr[n];
839 case GL_UNSIGNED_INT:
840 uiptr = (GLuint *) list;
841 return (GLint) uiptr[n];
842 case GL_FLOAT:
843 fptr = (GLfloat *) list;
844 return (GLint) FLOORF(fptr[n]);
845 case GL_2_BYTES:
846 ubptr = ((GLubyte *) list) + 2 * n;
847 return (GLint) ubptr[0] * 256
848 + (GLint) ubptr[1];
849 case GL_3_BYTES:
850 ubptr = ((GLubyte *) list) + 3 * n;
851 return (GLint) ubptr[0] * 65536
852 + (GLint) ubptr[1] * 256
853 + (GLint) ubptr[2];
854 case GL_4_BYTES:
855 ubptr = ((GLubyte *) list) + 4 * n;
856 return (GLint) ubptr[0] * 16777216
857 + (GLint) ubptr[1] * 65536
858 + (GLint) ubptr[2] * 256
859 + (GLint) ubptr[3];
860 default:
861 return 0;
868 /**********************************************************************/
869 /***** Public *****/
870 /**********************************************************************/
873 * Wrapper for _mesa_unpack_image() that handles pixel buffer objects.
874 * If we run out of memory, GL_OUT_OF_MEMORY will be recorded.
876 static GLvoid *
877 unpack_image(struct gl_context *ctx, GLuint dimensions,
878 GLsizei width, GLsizei height, GLsizei depth,
879 GLenum format, GLenum type, const GLvoid * pixels,
880 const struct gl_pixelstore_attrib *unpack)
882 if (!_mesa_is_bufferobj(unpack->BufferObj)) {
883 /* no PBO */
884 GLvoid *image = _mesa_unpack_image(dimensions, width, height, depth,
885 format, type, pixels, unpack);
886 if (pixels && !image) {
887 _mesa_error(ctx, GL_OUT_OF_MEMORY, "display list construction");
889 return image;
891 else if (_mesa_validate_pbo_access(dimensions, unpack, width, height,
892 depth, format, type, INT_MAX, pixels)) {
893 const GLubyte *map, *src;
894 GLvoid *image;
896 map = (GLubyte *)
897 ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT,
898 GL_READ_ONLY_ARB, unpack->BufferObj);
899 if (!map) {
900 /* unable to map src buffer! */
901 _mesa_error(ctx, GL_INVALID_OPERATION, "unable to map PBO");
902 return NULL;
905 src = ADD_POINTERS(map, pixels);
906 image = _mesa_unpack_image(dimensions, width, height, depth,
907 format, type, src, unpack);
909 ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT,
910 unpack->BufferObj);
912 if (!image) {
913 _mesa_error(ctx, GL_OUT_OF_MEMORY, "display list construction");
915 return image;
917 /* bad access! */
918 return NULL;
923 * Allocate space for a display list instruction (opcode + payload space).
924 * \param opcode the instruction opcode (OPCODE_* value)
925 * \param bytes instruction payload size (not counting opcode)
926 * \return pointer to allocated memory (the opcode space)
928 static Node *
929 dlist_alloc(struct gl_context *ctx, OpCode opcode, GLuint bytes)
931 const GLuint numNodes = 1 + (bytes + sizeof(Node) - 1) / sizeof(Node);
932 Node *n;
934 if (opcode < (GLuint) OPCODE_EXT_0) {
935 if (InstSize[opcode] == 0) {
936 /* save instruction size now */
937 InstSize[opcode] = numNodes;
939 else {
940 /* make sure instruction size agrees */
941 ASSERT(numNodes == InstSize[opcode]);
945 if (ctx->ListState.CurrentPos + numNodes + 2 > BLOCK_SIZE) {
946 /* This block is full. Allocate a new block and chain to it */
947 Node *newblock;
948 n = ctx->ListState.CurrentBlock + ctx->ListState.CurrentPos;
949 n[0].opcode = OPCODE_CONTINUE;
950 newblock = (Node *) malloc(sizeof(Node) * BLOCK_SIZE);
951 if (!newblock) {
952 _mesa_error(ctx, GL_OUT_OF_MEMORY, "Building display list");
953 return NULL;
955 n[1].next = (Node *) newblock;
956 ctx->ListState.CurrentBlock = newblock;
957 ctx->ListState.CurrentPos = 0;
960 n = ctx->ListState.CurrentBlock + ctx->ListState.CurrentPos;
961 ctx->ListState.CurrentPos += numNodes;
963 n[0].opcode = opcode;
965 return n;
971 * Allocate space for a display list instruction. Used by callers outside
972 * this file for things like VBO vertex data.
974 * \param opcode the instruction opcode (OPCODE_* value)
975 * \param bytes instruction size in bytes, not counting opcode.
976 * \return pointer to the usable data area (not including the internal
977 * opcode).
979 void *
980 _mesa_dlist_alloc(struct gl_context *ctx, GLuint opcode, GLuint bytes)
982 Node *n = dlist_alloc(ctx, (OpCode) opcode, bytes);
983 if (n)
984 return n + 1; /* return pointer to payload area, after opcode */
985 else
986 return NULL;
991 * This function allows modules and drivers to get their own opcodes
992 * for extending display list functionality.
993 * \param ctx the rendering context
994 * \param size number of bytes for storing the new display list command
995 * \param execute function to execute the new display list command
996 * \param destroy function to destroy the new display list command
997 * \param print function to print the new display list command
998 * \return the new opcode number or -1 if error
1000 GLint
1001 _mesa_dlist_alloc_opcode(struct gl_context *ctx,
1002 GLuint size,
1003 void (*execute) (struct gl_context *, void *),
1004 void (*destroy) (struct gl_context *, void *),
1005 void (*print) (struct gl_context *, void *))
1007 if (ctx->ListExt->NumOpcodes < MAX_DLIST_EXT_OPCODES) {
1008 const GLuint i = ctx->ListExt->NumOpcodes++;
1009 ctx->ListExt->Opcode[i].Size =
1010 1 + (size + sizeof(Node) - 1) / sizeof(Node);
1011 ctx->ListExt->Opcode[i].Execute = execute;
1012 ctx->ListExt->Opcode[i].Destroy = destroy;
1013 ctx->ListExt->Opcode[i].Print = print;
1014 return i + OPCODE_EXT_0;
1016 return -1;
1021 * Allocate space for a display list instruction. The space is basically
1022 * an array of Nodes where node[0] holds the opcode, node[1] is the first
1023 * function parameter, node[2] is the second parameter, etc.
1025 * \param opcode one of OPCODE_x
1026 * \param nparams number of function parameters
1027 * \return pointer to start of instruction space
1029 static INLINE Node *
1030 alloc_instruction(struct gl_context *ctx, OpCode opcode, GLuint nparams)
1032 return dlist_alloc(ctx, opcode, nparams * sizeof(Node));
1038 * Display List compilation functions
1040 static void GLAPIENTRY
1041 save_Accum(GLenum op, GLfloat value)
1043 GET_CURRENT_CONTEXT(ctx);
1044 Node *n;
1045 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1046 n = alloc_instruction(ctx, OPCODE_ACCUM, 2);
1047 if (n) {
1048 n[1].e = op;
1049 n[2].f = value;
1051 if (ctx->ExecuteFlag) {
1052 CALL_Accum(ctx->Exec, (op, value));
1057 static void GLAPIENTRY
1058 save_AlphaFunc(GLenum func, GLclampf ref)
1060 GET_CURRENT_CONTEXT(ctx);
1061 Node *n;
1062 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1063 n = alloc_instruction(ctx, OPCODE_ALPHA_FUNC, 2);
1064 if (n) {
1065 n[1].e = func;
1066 n[2].f = (GLfloat) ref;
1068 if (ctx->ExecuteFlag) {
1069 CALL_AlphaFunc(ctx->Exec, (func, ref));
1074 static void GLAPIENTRY
1075 save_BindTexture(GLenum target, GLuint texture)
1077 GET_CURRENT_CONTEXT(ctx);
1078 Node *n;
1079 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1080 n = alloc_instruction(ctx, OPCODE_BIND_TEXTURE, 2);
1081 if (n) {
1082 n[1].e = target;
1083 n[2].ui = texture;
1085 if (ctx->ExecuteFlag) {
1086 CALL_BindTexture(ctx->Exec, (target, texture));
1091 static void GLAPIENTRY
1092 save_Bitmap(GLsizei width, GLsizei height,
1093 GLfloat xorig, GLfloat yorig,
1094 GLfloat xmove, GLfloat ymove, const GLubyte * pixels)
1096 GET_CURRENT_CONTEXT(ctx);
1097 Node *n;
1098 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1099 n = alloc_instruction(ctx, OPCODE_BITMAP, 7);
1100 if (n) {
1101 n[1].i = (GLint) width;
1102 n[2].i = (GLint) height;
1103 n[3].f = xorig;
1104 n[4].f = yorig;
1105 n[5].f = xmove;
1106 n[6].f = ymove;
1107 n[7].data = _mesa_unpack_bitmap(width, height, pixels, &ctx->Unpack);
1109 if (ctx->ExecuteFlag) {
1110 CALL_Bitmap(ctx->Exec, (width, height,
1111 xorig, yorig, xmove, ymove, pixels));
1116 static void GLAPIENTRY
1117 save_BlendEquation(GLenum mode)
1119 GET_CURRENT_CONTEXT(ctx);
1120 Node *n;
1121 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1122 n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION, 1);
1123 if (n) {
1124 n[1].e = mode;
1126 if (ctx->ExecuteFlag) {
1127 CALL_BlendEquation(ctx->Exec, (mode));
1132 static void GLAPIENTRY
1133 save_BlendEquationSeparateEXT(GLenum modeRGB, GLenum modeA)
1135 GET_CURRENT_CONTEXT(ctx);
1136 Node *n;
1137 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1138 n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION_SEPARATE, 2);
1139 if (n) {
1140 n[1].e = modeRGB;
1141 n[2].e = modeA;
1143 if (ctx->ExecuteFlag) {
1144 CALL_BlendEquationSeparateEXT(ctx->Exec, (modeRGB, modeA));
1149 static void GLAPIENTRY
1150 save_BlendFuncSeparateEXT(GLenum sfactorRGB, GLenum dfactorRGB,
1151 GLenum sfactorA, GLenum dfactorA)
1153 GET_CURRENT_CONTEXT(ctx);
1154 Node *n;
1155 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1156 n = alloc_instruction(ctx, OPCODE_BLEND_FUNC_SEPARATE, 4);
1157 if (n) {
1158 n[1].e = sfactorRGB;
1159 n[2].e = dfactorRGB;
1160 n[3].e = sfactorA;
1161 n[4].e = dfactorA;
1163 if (ctx->ExecuteFlag) {
1164 CALL_BlendFuncSeparateEXT(ctx->Exec,
1165 (sfactorRGB, dfactorRGB, sfactorA, dfactorA));
1170 static void GLAPIENTRY
1171 save_BlendFunc(GLenum srcfactor, GLenum dstfactor)
1173 save_BlendFuncSeparateEXT(srcfactor, dstfactor, srcfactor, dstfactor);
1177 static void GLAPIENTRY
1178 save_BlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
1180 GET_CURRENT_CONTEXT(ctx);
1181 Node *n;
1182 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1183 n = alloc_instruction(ctx, OPCODE_BLEND_COLOR, 4);
1184 if (n) {
1185 n[1].f = red;
1186 n[2].f = green;
1187 n[3].f = blue;
1188 n[4].f = alpha;
1190 if (ctx->ExecuteFlag) {
1191 CALL_BlendColor(ctx->Exec, (red, green, blue, alpha));
1195 /* GL_ARB_draw_buffers_blend */
1196 static void GLAPIENTRY
1197 save_BlendFuncSeparatei(GLuint buf, GLenum sfactorRGB, GLenum dfactorRGB,
1198 GLenum sfactorA, GLenum dfactorA)
1200 GET_CURRENT_CONTEXT(ctx);
1201 Node *n;
1202 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1203 n = alloc_instruction(ctx, OPCODE_BLEND_FUNC_SEPARATE_I, 5);
1204 if (n) {
1205 n[1].ui = buf;
1206 n[2].e = sfactorRGB;
1207 n[3].e = dfactorRGB;
1208 n[4].e = sfactorA;
1209 n[5].e = dfactorA;
1211 if (ctx->ExecuteFlag) {
1212 CALL_BlendFuncSeparateiARB(ctx->Exec, (buf, sfactorRGB, dfactorRGB,
1213 sfactorA, dfactorA));
1217 /* GL_ARB_draw_buffers_blend */
1218 static void GLAPIENTRY
1219 save_BlendFunci(GLuint buf, GLenum sfactor, GLenum dfactor)
1221 GET_CURRENT_CONTEXT(ctx);
1222 Node *n;
1223 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1224 n = alloc_instruction(ctx, OPCODE_BLEND_FUNC_SEPARATE_I, 3);
1225 if (n) {
1226 n[1].ui = buf;
1227 n[2].e = sfactor;
1228 n[3].e = dfactor;
1230 if (ctx->ExecuteFlag) {
1231 CALL_BlendFunciARB(ctx->Exec, (buf, sfactor, dfactor));
1235 /* GL_ARB_draw_buffers_blend */
1236 static void GLAPIENTRY
1237 save_BlendEquationi(GLuint buf, GLenum mode)
1239 GET_CURRENT_CONTEXT(ctx);
1240 Node *n;
1241 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1242 n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION_I, 2);
1243 if (n) {
1244 n[1].ui = buf;
1245 n[2].e = mode;
1247 if (ctx->ExecuteFlag) {
1248 CALL_BlendEquationiARB(ctx->Exec, (buf, mode));
1252 /* GL_ARB_draw_buffers_blend */
1253 static void GLAPIENTRY
1254 save_BlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeA)
1256 GET_CURRENT_CONTEXT(ctx);
1257 Node *n;
1258 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1259 n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION_SEPARATE_I, 3);
1260 if (n) {
1261 n[1].ui = buf;
1262 n[2].e = modeRGB;
1263 n[3].e = modeA;
1265 if (ctx->ExecuteFlag) {
1266 CALL_BlendEquationSeparateiARB(ctx->Exec, (buf, modeRGB, modeA));
1271 static void invalidate_saved_current_state( struct gl_context *ctx )
1273 GLint i;
1275 for (i = 0; i < VERT_ATTRIB_MAX; i++)
1276 ctx->ListState.ActiveAttribSize[i] = 0;
1278 for (i = 0; i < MAT_ATTRIB_MAX; i++)
1279 ctx->ListState.ActiveMaterialSize[i] = 0;
1281 memset(&ctx->ListState.Current, 0, sizeof ctx->ListState.Current);
1283 ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN;
1286 static void GLAPIENTRY
1287 save_CallList(GLuint list)
1289 GET_CURRENT_CONTEXT(ctx);
1290 Node *n;
1291 SAVE_FLUSH_VERTICES(ctx);
1293 n = alloc_instruction(ctx, OPCODE_CALL_LIST, 1);
1294 if (n) {
1295 n[1].ui = list;
1298 /* After this, we don't know what state we're in. Invalidate all
1299 * cached information previously gathered:
1301 invalidate_saved_current_state( ctx );
1303 if (ctx->ExecuteFlag) {
1304 _mesa_CallList(list);
1309 static void GLAPIENTRY
1310 save_CallLists(GLsizei num, GLenum type, const GLvoid * lists)
1312 GET_CURRENT_CONTEXT(ctx);
1313 GLint i;
1314 GLboolean typeErrorFlag;
1316 SAVE_FLUSH_VERTICES(ctx);
1318 switch (type) {
1319 case GL_BYTE:
1320 case GL_UNSIGNED_BYTE:
1321 case GL_SHORT:
1322 case GL_UNSIGNED_SHORT:
1323 case GL_INT:
1324 case GL_UNSIGNED_INT:
1325 case GL_FLOAT:
1326 case GL_2_BYTES:
1327 case GL_3_BYTES:
1328 case GL_4_BYTES:
1329 typeErrorFlag = GL_FALSE;
1330 break;
1331 default:
1332 typeErrorFlag = GL_TRUE;
1335 for (i = 0; i < num; i++) {
1336 GLint list = translate_id(i, type, lists);
1337 Node *n = alloc_instruction(ctx, OPCODE_CALL_LIST_OFFSET, 2);
1338 if (n) {
1339 n[1].i = list;
1340 n[2].b = typeErrorFlag;
1344 /* After this, we don't know what state we're in. Invalidate all
1345 * cached information previously gathered:
1347 invalidate_saved_current_state( ctx );
1349 if (ctx->ExecuteFlag) {
1350 CALL_CallLists(ctx->Exec, (num, type, lists));
1355 static void GLAPIENTRY
1356 save_Clear(GLbitfield mask)
1358 GET_CURRENT_CONTEXT(ctx);
1359 Node *n;
1360 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1361 n = alloc_instruction(ctx, OPCODE_CLEAR, 1);
1362 if (n) {
1363 n[1].bf = mask;
1365 if (ctx->ExecuteFlag) {
1366 CALL_Clear(ctx->Exec, (mask));
1371 static void GLAPIENTRY
1372 save_ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value)
1374 GET_CURRENT_CONTEXT(ctx);
1375 Node *n;
1376 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1377 n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_IV, 6);
1378 if (n) {
1379 n[1].e = buffer;
1380 n[2].i = drawbuffer;
1381 n[3].i = value[0];
1382 if (buffer == GL_COLOR) {
1383 n[4].i = value[1];
1384 n[5].i = value[2];
1385 n[6].i = value[3];
1387 else {
1388 n[4].i = 0;
1389 n[5].i = 0;
1390 n[6].i = 0;
1393 if (ctx->ExecuteFlag) {
1394 /*CALL_ClearBufferiv(ctx->Exec, (buffer, drawbuffer, value));*/
1399 static void GLAPIENTRY
1400 save_ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value)
1402 GET_CURRENT_CONTEXT(ctx);
1403 Node *n;
1404 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1405 n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_UIV, 6);
1406 if (n) {
1407 n[1].e = buffer;
1408 n[2].i = drawbuffer;
1409 n[3].ui = value[0];
1410 if (buffer == GL_COLOR) {
1411 n[4].ui = value[1];
1412 n[5].ui = value[2];
1413 n[6].ui = value[3];
1415 else {
1416 n[4].ui = 0;
1417 n[5].ui = 0;
1418 n[6].ui = 0;
1421 if (ctx->ExecuteFlag) {
1422 /*CALL_ClearBufferuiv(ctx->Exec, (buffer, drawbuffer, value));*/
1427 static void GLAPIENTRY
1428 save_ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
1430 GET_CURRENT_CONTEXT(ctx);
1431 Node *n;
1432 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1433 n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_FV, 6);
1434 if (n) {
1435 n[1].e = buffer;
1436 n[2].i = drawbuffer;
1437 n[3].f = value[0];
1438 if (buffer == GL_COLOR) {
1439 n[4].f = value[1];
1440 n[5].f = value[2];
1441 n[6].f = value[3];
1443 else {
1444 n[4].f = 0.0F;
1445 n[5].f = 0.0F;
1446 n[6].f = 0.0F;
1449 if (ctx->ExecuteFlag) {
1450 /*CALL_ClearBufferuiv(ctx->Exec, (buffer, drawbuffer, value));*/
1455 static void GLAPIENTRY
1456 save_ClearBufferfi(GLenum buffer, GLint drawbuffer,
1457 GLfloat depth, GLint stencil)
1459 GET_CURRENT_CONTEXT(ctx);
1460 Node *n;
1461 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1462 n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_FI, 4);
1463 if (n) {
1464 n[1].e = buffer;
1465 n[2].i = drawbuffer;
1466 n[3].f = depth;
1467 n[4].i = stencil;
1469 if (ctx->ExecuteFlag) {
1470 /*CALL_ClearBufferfi(ctx->Exec, (buffer, drawbuffer, depth, stencil));*/
1475 static void GLAPIENTRY
1476 save_ClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
1478 GET_CURRENT_CONTEXT(ctx);
1479 Node *n;
1480 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1481 n = alloc_instruction(ctx, OPCODE_CLEAR_ACCUM, 4);
1482 if (n) {
1483 n[1].f = red;
1484 n[2].f = green;
1485 n[3].f = blue;
1486 n[4].f = alpha;
1488 if (ctx->ExecuteFlag) {
1489 CALL_ClearAccum(ctx->Exec, (red, green, blue, alpha));
1494 static void GLAPIENTRY
1495 save_ClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
1497 GET_CURRENT_CONTEXT(ctx);
1498 Node *n;
1499 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1500 n = alloc_instruction(ctx, OPCODE_CLEAR_COLOR, 4);
1501 if (n) {
1502 n[1].f = red;
1503 n[2].f = green;
1504 n[3].f = blue;
1505 n[4].f = alpha;
1507 if (ctx->ExecuteFlag) {
1508 CALL_ClearColor(ctx->Exec, (red, green, blue, alpha));
1513 static void GLAPIENTRY
1514 save_ClearDepth(GLclampd depth)
1516 GET_CURRENT_CONTEXT(ctx);
1517 Node *n;
1518 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1519 n = alloc_instruction(ctx, OPCODE_CLEAR_DEPTH, 1);
1520 if (n) {
1521 n[1].f = (GLfloat) depth;
1523 if (ctx->ExecuteFlag) {
1524 CALL_ClearDepth(ctx->Exec, (depth));
1529 static void GLAPIENTRY
1530 save_ClearIndex(GLfloat c)
1532 GET_CURRENT_CONTEXT(ctx);
1533 Node *n;
1534 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1535 n = alloc_instruction(ctx, OPCODE_CLEAR_INDEX, 1);
1536 if (n) {
1537 n[1].f = c;
1539 if (ctx->ExecuteFlag) {
1540 CALL_ClearIndex(ctx->Exec, (c));
1545 static void GLAPIENTRY
1546 save_ClearStencil(GLint s)
1548 GET_CURRENT_CONTEXT(ctx);
1549 Node *n;
1550 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1551 n = alloc_instruction(ctx, OPCODE_CLEAR_STENCIL, 1);
1552 if (n) {
1553 n[1].i = s;
1555 if (ctx->ExecuteFlag) {
1556 CALL_ClearStencil(ctx->Exec, (s));
1561 static void GLAPIENTRY
1562 save_ClipPlane(GLenum plane, const GLdouble * equ)
1564 GET_CURRENT_CONTEXT(ctx);
1565 Node *n;
1566 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1567 n = alloc_instruction(ctx, OPCODE_CLIP_PLANE, 5);
1568 if (n) {
1569 n[1].e = plane;
1570 n[2].f = (GLfloat) equ[0];
1571 n[3].f = (GLfloat) equ[1];
1572 n[4].f = (GLfloat) equ[2];
1573 n[5].f = (GLfloat) equ[3];
1575 if (ctx->ExecuteFlag) {
1576 CALL_ClipPlane(ctx->Exec, (plane, equ));
1582 static void GLAPIENTRY
1583 save_ColorMask(GLboolean red, GLboolean green,
1584 GLboolean blue, GLboolean alpha)
1586 GET_CURRENT_CONTEXT(ctx);
1587 Node *n;
1588 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1589 n = alloc_instruction(ctx, OPCODE_COLOR_MASK, 4);
1590 if (n) {
1591 n[1].b = red;
1592 n[2].b = green;
1593 n[3].b = blue;
1594 n[4].b = alpha;
1596 if (ctx->ExecuteFlag) {
1597 CALL_ColorMask(ctx->Exec, (red, green, blue, alpha));
1602 static void GLAPIENTRY
1603 save_ColorMaskIndexed(GLuint buf, GLboolean red, GLboolean green,
1604 GLboolean blue, GLboolean alpha)
1606 GET_CURRENT_CONTEXT(ctx);
1607 Node *n;
1608 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1609 n = alloc_instruction(ctx, OPCODE_COLOR_MASK_INDEXED, 5);
1610 if (n) {
1611 n[1].ui = buf;
1612 n[2].b = red;
1613 n[3].b = green;
1614 n[4].b = blue;
1615 n[5].b = alpha;
1617 if (ctx->ExecuteFlag) {
1618 /*CALL_ColorMaskIndexedEXT(ctx->Exec, (buf, red, green, blue, alpha));*/
1623 static void GLAPIENTRY
1624 save_ColorMaterial(GLenum face, GLenum mode)
1626 GET_CURRENT_CONTEXT(ctx);
1627 Node *n;
1628 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1630 n = alloc_instruction(ctx, OPCODE_COLOR_MATERIAL, 2);
1631 if (n) {
1632 n[1].e = face;
1633 n[2].e = mode;
1635 if (ctx->ExecuteFlag) {
1636 CALL_ColorMaterial(ctx->Exec, (face, mode));
1641 static void GLAPIENTRY
1642 save_ColorTable(GLenum target, GLenum internalFormat,
1643 GLsizei width, GLenum format, GLenum type,
1644 const GLvoid * table)
1646 GET_CURRENT_CONTEXT(ctx);
1647 if (_mesa_is_proxy_texture(target)) {
1648 /* execute immediately */
1649 CALL_ColorTable(ctx->Exec, (target, internalFormat, width,
1650 format, type, table));
1652 else {
1653 Node *n;
1654 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1655 n = alloc_instruction(ctx, OPCODE_COLOR_TABLE, 6);
1656 if (n) {
1657 n[1].e = target;
1658 n[2].e = internalFormat;
1659 n[3].i = width;
1660 n[4].e = format;
1661 n[5].e = type;
1662 n[6].data = unpack_image(ctx, 1, width, 1, 1, format, type, table,
1663 &ctx->Unpack);
1665 if (ctx->ExecuteFlag) {
1666 CALL_ColorTable(ctx->Exec, (target, internalFormat, width,
1667 format, type, table));
1674 static void GLAPIENTRY
1675 save_ColorTableParameterfv(GLenum target, GLenum pname,
1676 const GLfloat *params)
1678 GET_CURRENT_CONTEXT(ctx);
1679 Node *n;
1681 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1683 n = alloc_instruction(ctx, OPCODE_COLOR_TABLE_PARAMETER_FV, 6);
1684 if (n) {
1685 n[1].e = target;
1686 n[2].e = pname;
1687 n[3].f = params[0];
1688 if (pname == GL_COLOR_TABLE_SGI ||
1689 pname == GL_POST_CONVOLUTION_COLOR_TABLE_SGI ||
1690 pname == GL_TEXTURE_COLOR_TABLE_SGI) {
1691 n[4].f = params[1];
1692 n[5].f = params[2];
1693 n[6].f = params[3];
1697 if (ctx->ExecuteFlag) {
1698 CALL_ColorTableParameterfv(ctx->Exec, (target, pname, params));
1703 static void GLAPIENTRY
1704 save_ColorTableParameteriv(GLenum target, GLenum pname, const GLint *params)
1706 GET_CURRENT_CONTEXT(ctx);
1707 Node *n;
1709 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1711 n = alloc_instruction(ctx, OPCODE_COLOR_TABLE_PARAMETER_IV, 6);
1712 if (n) {
1713 n[1].e = target;
1714 n[2].e = pname;
1715 n[3].i = params[0];
1716 if (pname == GL_COLOR_TABLE_SGI ||
1717 pname == GL_POST_CONVOLUTION_COLOR_TABLE_SGI ||
1718 pname == GL_TEXTURE_COLOR_TABLE_SGI) {
1719 n[4].i = params[1];
1720 n[5].i = params[2];
1721 n[6].i = params[3];
1725 if (ctx->ExecuteFlag) {
1726 CALL_ColorTableParameteriv(ctx->Exec, (target, pname, params));
1732 static void GLAPIENTRY
1733 save_ColorSubTable(GLenum target, GLsizei start, GLsizei count,
1734 GLenum format, GLenum type, const GLvoid * table)
1736 GET_CURRENT_CONTEXT(ctx);
1737 Node *n;
1738 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1739 n = alloc_instruction(ctx, OPCODE_COLOR_SUB_TABLE, 6);
1740 if (n) {
1741 n[1].e = target;
1742 n[2].i = start;
1743 n[3].i = count;
1744 n[4].e = format;
1745 n[5].e = type;
1746 n[6].data = unpack_image(ctx, 1, count, 1, 1, format, type, table,
1747 &ctx->Unpack);
1749 if (ctx->ExecuteFlag) {
1750 CALL_ColorSubTable(ctx->Exec,
1751 (target, start, count, format, type, table));
1756 static void GLAPIENTRY
1757 save_CopyColorSubTable(GLenum target, GLsizei start,
1758 GLint x, GLint y, GLsizei width)
1760 GET_CURRENT_CONTEXT(ctx);
1761 Node *n;
1763 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1764 n = alloc_instruction(ctx, OPCODE_COPY_COLOR_SUB_TABLE, 5);
1765 if (n) {
1766 n[1].e = target;
1767 n[2].i = start;
1768 n[3].i = x;
1769 n[4].i = y;
1770 n[5].i = width;
1772 if (ctx->ExecuteFlag) {
1773 CALL_CopyColorSubTable(ctx->Exec, (target, start, x, y, width));
1778 static void GLAPIENTRY
1779 save_CopyColorTable(GLenum target, GLenum internalformat,
1780 GLint x, GLint y, GLsizei width)
1782 GET_CURRENT_CONTEXT(ctx);
1783 Node *n;
1785 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1786 n = alloc_instruction(ctx, OPCODE_COPY_COLOR_TABLE, 5);
1787 if (n) {
1788 n[1].e = target;
1789 n[2].e = internalformat;
1790 n[3].i = x;
1791 n[4].i = y;
1792 n[5].i = width;
1794 if (ctx->ExecuteFlag) {
1795 CALL_CopyColorTable(ctx->Exec, (target, internalformat, x, y, width));
1800 static void GLAPIENTRY
1801 save_ConvolutionFilter1D(GLenum target, GLenum internalFormat, GLsizei width,
1802 GLenum format, GLenum type, const GLvoid * filter)
1804 GET_CURRENT_CONTEXT(ctx);
1805 Node *n;
1807 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1809 n = alloc_instruction(ctx, OPCODE_CONVOLUTION_FILTER_1D, 6);
1810 if (n) {
1811 n[1].e = target;
1812 n[2].e = internalFormat;
1813 n[3].i = width;
1814 n[4].e = format;
1815 n[5].e = type;
1816 n[6].data = unpack_image(ctx, 1, width, 1, 1, format, type, filter,
1817 &ctx->Unpack);
1819 if (ctx->ExecuteFlag) {
1820 CALL_ConvolutionFilter1D(ctx->Exec, (target, internalFormat, width,
1821 format, type, filter));
1826 static void GLAPIENTRY
1827 save_ConvolutionFilter2D(GLenum target, GLenum internalFormat,
1828 GLsizei width, GLsizei height, GLenum format,
1829 GLenum type, const GLvoid * filter)
1831 GET_CURRENT_CONTEXT(ctx);
1832 Node *n;
1834 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1836 n = alloc_instruction(ctx, OPCODE_CONVOLUTION_FILTER_2D, 7);
1837 if (n) {
1838 n[1].e = target;
1839 n[2].e = internalFormat;
1840 n[3].i = width;
1841 n[4].i = height;
1842 n[5].e = format;
1843 n[6].e = type;
1844 n[7].data = unpack_image(ctx, 2, width, height, 1, format, type, filter,
1845 &ctx->Unpack);
1847 if (ctx->ExecuteFlag) {
1848 CALL_ConvolutionFilter2D(ctx->Exec,
1849 (target, internalFormat, width, height, format,
1850 type, filter));
1855 static void GLAPIENTRY
1856 save_ConvolutionParameteri(GLenum target, GLenum pname, GLint param)
1858 GET_CURRENT_CONTEXT(ctx);
1859 Node *n;
1860 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1861 n = alloc_instruction(ctx, OPCODE_CONVOLUTION_PARAMETER_I, 3);
1862 if (n) {
1863 n[1].e = target;
1864 n[2].e = pname;
1865 n[3].i = param;
1867 if (ctx->ExecuteFlag) {
1868 CALL_ConvolutionParameteri(ctx->Exec, (target, pname, param));
1873 static void GLAPIENTRY
1874 save_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params)
1876 GET_CURRENT_CONTEXT(ctx);
1877 Node *n;
1878 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1879 n = alloc_instruction(ctx, OPCODE_CONVOLUTION_PARAMETER_IV, 6);
1880 if (n) {
1881 n[1].e = target;
1882 n[2].e = pname;
1883 n[3].i = params[0];
1884 if (pname == GL_CONVOLUTION_BORDER_COLOR ||
1885 pname == GL_CONVOLUTION_FILTER_SCALE ||
1886 pname == GL_CONVOLUTION_FILTER_BIAS) {
1887 n[4].i = params[1];
1888 n[5].i = params[2];
1889 n[6].i = params[3];
1891 else {
1892 n[4].i = n[5].i = n[6].i = 0;
1895 if (ctx->ExecuteFlag) {
1896 CALL_ConvolutionParameteriv(ctx->Exec, (target, pname, params));
1901 static void GLAPIENTRY
1902 save_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat param)
1904 GET_CURRENT_CONTEXT(ctx);
1905 Node *n;
1906 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1907 n = alloc_instruction(ctx, OPCODE_CONVOLUTION_PARAMETER_F, 3);
1908 if (n) {
1909 n[1].e = target;
1910 n[2].e = pname;
1911 n[3].f = param;
1913 if (ctx->ExecuteFlag) {
1914 CALL_ConvolutionParameterf(ctx->Exec, (target, pname, param));
1919 static void GLAPIENTRY
1920 save_ConvolutionParameterfv(GLenum target, GLenum pname,
1921 const GLfloat *params)
1923 GET_CURRENT_CONTEXT(ctx);
1924 Node *n;
1925 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1926 n = alloc_instruction(ctx, OPCODE_CONVOLUTION_PARAMETER_FV, 6);
1927 if (n) {
1928 n[1].e = target;
1929 n[2].e = pname;
1930 n[3].f = params[0];
1931 if (pname == GL_CONVOLUTION_BORDER_COLOR ||
1932 pname == GL_CONVOLUTION_FILTER_SCALE ||
1933 pname == GL_CONVOLUTION_FILTER_BIAS) {
1934 n[4].f = params[1];
1935 n[5].f = params[2];
1936 n[6].f = params[3];
1938 else {
1939 n[4].f = n[5].f = n[6].f = 0.0F;
1942 if (ctx->ExecuteFlag) {
1943 CALL_ConvolutionParameterfv(ctx->Exec, (target, pname, params));
1948 static void GLAPIENTRY
1949 save_CopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type)
1951 GET_CURRENT_CONTEXT(ctx);
1952 Node *n;
1953 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1954 n = alloc_instruction(ctx, OPCODE_COPY_PIXELS, 5);
1955 if (n) {
1956 n[1].i = x;
1957 n[2].i = y;
1958 n[3].i = (GLint) width;
1959 n[4].i = (GLint) height;
1960 n[5].e = type;
1962 if (ctx->ExecuteFlag) {
1963 CALL_CopyPixels(ctx->Exec, (x, y, width, height, type));
1969 static void GLAPIENTRY
1970 save_CopyTexImage1D(GLenum target, GLint level, GLenum internalformat,
1971 GLint x, GLint y, GLsizei width, GLint border)
1973 GET_CURRENT_CONTEXT(ctx);
1974 Node *n;
1975 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1976 n = alloc_instruction(ctx, OPCODE_COPY_TEX_IMAGE1D, 7);
1977 if (n) {
1978 n[1].e = target;
1979 n[2].i = level;
1980 n[3].e = internalformat;
1981 n[4].i = x;
1982 n[5].i = y;
1983 n[6].i = width;
1984 n[7].i = border;
1986 if (ctx->ExecuteFlag) {
1987 CALL_CopyTexImage1D(ctx->Exec, (target, level, internalformat,
1988 x, y, width, border));
1993 static void GLAPIENTRY
1994 save_CopyTexImage2D(GLenum target, GLint level,
1995 GLenum internalformat,
1996 GLint x, GLint y, GLsizei width,
1997 GLsizei height, GLint border)
1999 GET_CURRENT_CONTEXT(ctx);
2000 Node *n;
2001 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2002 n = alloc_instruction(ctx, OPCODE_COPY_TEX_IMAGE2D, 8);
2003 if (n) {
2004 n[1].e = target;
2005 n[2].i = level;
2006 n[3].e = internalformat;
2007 n[4].i = x;
2008 n[5].i = y;
2009 n[6].i = width;
2010 n[7].i = height;
2011 n[8].i = border;
2013 if (ctx->ExecuteFlag) {
2014 CALL_CopyTexImage2D(ctx->Exec, (target, level, internalformat,
2015 x, y, width, height, border));
2021 static void GLAPIENTRY
2022 save_CopyTexSubImage1D(GLenum target, GLint level,
2023 GLint xoffset, GLint x, GLint y, GLsizei width)
2025 GET_CURRENT_CONTEXT(ctx);
2026 Node *n;
2027 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2028 n = alloc_instruction(ctx, OPCODE_COPY_TEX_SUB_IMAGE1D, 6);
2029 if (n) {
2030 n[1].e = target;
2031 n[2].i = level;
2032 n[3].i = xoffset;
2033 n[4].i = x;
2034 n[5].i = y;
2035 n[6].i = width;
2037 if (ctx->ExecuteFlag) {
2038 CALL_CopyTexSubImage1D(ctx->Exec,
2039 (target, level, xoffset, x, y, width));
2044 static void GLAPIENTRY
2045 save_CopyTexSubImage2D(GLenum target, GLint level,
2046 GLint xoffset, GLint yoffset,
2047 GLint x, GLint y, GLsizei width, GLint height)
2049 GET_CURRENT_CONTEXT(ctx);
2050 Node *n;
2051 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2052 n = alloc_instruction(ctx, OPCODE_COPY_TEX_SUB_IMAGE2D, 8);
2053 if (n) {
2054 n[1].e = target;
2055 n[2].i = level;
2056 n[3].i = xoffset;
2057 n[4].i = yoffset;
2058 n[5].i = x;
2059 n[6].i = y;
2060 n[7].i = width;
2061 n[8].i = height;
2063 if (ctx->ExecuteFlag) {
2064 CALL_CopyTexSubImage2D(ctx->Exec, (target, level, xoffset, yoffset,
2065 x, y, width, height));
2070 static void GLAPIENTRY
2071 save_CopyTexSubImage3D(GLenum target, GLint level,
2072 GLint xoffset, GLint yoffset, GLint zoffset,
2073 GLint x, GLint y, GLsizei width, GLint height)
2075 GET_CURRENT_CONTEXT(ctx);
2076 Node *n;
2077 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2078 n = alloc_instruction(ctx, OPCODE_COPY_TEX_SUB_IMAGE3D, 9);
2079 if (n) {
2080 n[1].e = target;
2081 n[2].i = level;
2082 n[3].i = xoffset;
2083 n[4].i = yoffset;
2084 n[5].i = zoffset;
2085 n[6].i = x;
2086 n[7].i = y;
2087 n[8].i = width;
2088 n[9].i = height;
2090 if (ctx->ExecuteFlag) {
2091 CALL_CopyTexSubImage3D(ctx->Exec, (target, level,
2092 xoffset, yoffset, zoffset,
2093 x, y, width, height));
2098 static void GLAPIENTRY
2099 save_CullFace(GLenum mode)
2101 GET_CURRENT_CONTEXT(ctx);
2102 Node *n;
2103 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2104 n = alloc_instruction(ctx, OPCODE_CULL_FACE, 1);
2105 if (n) {
2106 n[1].e = mode;
2108 if (ctx->ExecuteFlag) {
2109 CALL_CullFace(ctx->Exec, (mode));
2114 static void GLAPIENTRY
2115 save_DepthFunc(GLenum func)
2117 GET_CURRENT_CONTEXT(ctx);
2118 Node *n;
2119 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2120 n = alloc_instruction(ctx, OPCODE_DEPTH_FUNC, 1);
2121 if (n) {
2122 n[1].e = func;
2124 if (ctx->ExecuteFlag) {
2125 CALL_DepthFunc(ctx->Exec, (func));
2130 static void GLAPIENTRY
2131 save_DepthMask(GLboolean mask)
2133 GET_CURRENT_CONTEXT(ctx);
2134 Node *n;
2135 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2136 n = alloc_instruction(ctx, OPCODE_DEPTH_MASK, 1);
2137 if (n) {
2138 n[1].b = mask;
2140 if (ctx->ExecuteFlag) {
2141 CALL_DepthMask(ctx->Exec, (mask));
2146 static void GLAPIENTRY
2147 save_DepthRange(GLclampd nearval, GLclampd farval)
2149 GET_CURRENT_CONTEXT(ctx);
2150 Node *n;
2151 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2152 n = alloc_instruction(ctx, OPCODE_DEPTH_RANGE, 2);
2153 if (n) {
2154 n[1].f = (GLfloat) nearval;
2155 n[2].f = (GLfloat) farval;
2157 if (ctx->ExecuteFlag) {
2158 CALL_DepthRange(ctx->Exec, (nearval, farval));
2163 static void GLAPIENTRY
2164 save_Disable(GLenum cap)
2166 GET_CURRENT_CONTEXT(ctx);
2167 Node *n;
2168 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2169 n = alloc_instruction(ctx, OPCODE_DISABLE, 1);
2170 if (n) {
2171 n[1].e = cap;
2173 if (ctx->ExecuteFlag) {
2174 CALL_Disable(ctx->Exec, (cap));
2179 static void GLAPIENTRY
2180 save_DisableIndexed(GLuint index, GLenum cap)
2182 GET_CURRENT_CONTEXT(ctx);
2183 Node *n;
2184 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2185 n = alloc_instruction(ctx, OPCODE_DISABLE_INDEXED, 2);
2186 if (n) {
2187 n[1].ui = index;
2188 n[2].e = cap;
2190 if (ctx->ExecuteFlag) {
2191 CALL_DisableIndexedEXT(ctx->Exec, (index, cap));
2196 static void GLAPIENTRY
2197 save_DrawBuffer(GLenum mode)
2199 GET_CURRENT_CONTEXT(ctx);
2200 Node *n;
2201 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2202 n = alloc_instruction(ctx, OPCODE_DRAW_BUFFER, 1);
2203 if (n) {
2204 n[1].e = mode;
2206 if (ctx->ExecuteFlag) {
2207 CALL_DrawBuffer(ctx->Exec, (mode));
2212 static void GLAPIENTRY
2213 save_DrawPixels(GLsizei width, GLsizei height,
2214 GLenum format, GLenum type, const GLvoid * pixels)
2216 GET_CURRENT_CONTEXT(ctx);
2217 Node *n;
2219 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2221 n = alloc_instruction(ctx, OPCODE_DRAW_PIXELS, 5);
2222 if (n) {
2223 n[1].i = width;
2224 n[2].i = height;
2225 n[3].e = format;
2226 n[4].e = type;
2227 n[5].data = unpack_image(ctx, 2, width, height, 1, format, type,
2228 pixels, &ctx->Unpack);
2230 if (ctx->ExecuteFlag) {
2231 CALL_DrawPixels(ctx->Exec, (width, height, format, type, pixels));
2237 static void GLAPIENTRY
2238 save_Enable(GLenum cap)
2240 GET_CURRENT_CONTEXT(ctx);
2241 Node *n;
2242 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2243 n = alloc_instruction(ctx, OPCODE_ENABLE, 1);
2244 if (n) {
2245 n[1].e = cap;
2247 if (ctx->ExecuteFlag) {
2248 CALL_Enable(ctx->Exec, (cap));
2254 static void GLAPIENTRY
2255 save_EnableIndexed(GLuint index, GLenum cap)
2257 GET_CURRENT_CONTEXT(ctx);
2258 Node *n;
2259 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2260 n = alloc_instruction(ctx, OPCODE_ENABLE_INDEXED, 2);
2261 if (n) {
2262 n[1].ui = index;
2263 n[2].e = cap;
2265 if (ctx->ExecuteFlag) {
2266 CALL_EnableIndexedEXT(ctx->Exec, (index, cap));
2272 static void GLAPIENTRY
2273 save_EvalMesh1(GLenum mode, GLint i1, GLint i2)
2275 GET_CURRENT_CONTEXT(ctx);
2276 Node *n;
2277 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2278 n = alloc_instruction(ctx, OPCODE_EVALMESH1, 3);
2279 if (n) {
2280 n[1].e = mode;
2281 n[2].i = i1;
2282 n[3].i = i2;
2284 if (ctx->ExecuteFlag) {
2285 CALL_EvalMesh1(ctx->Exec, (mode, i1, i2));
2290 static void GLAPIENTRY
2291 save_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)
2293 GET_CURRENT_CONTEXT(ctx);
2294 Node *n;
2295 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2296 n = alloc_instruction(ctx, OPCODE_EVALMESH2, 5);
2297 if (n) {
2298 n[1].e = mode;
2299 n[2].i = i1;
2300 n[3].i = i2;
2301 n[4].i = j1;
2302 n[5].i = j2;
2304 if (ctx->ExecuteFlag) {
2305 CALL_EvalMesh2(ctx->Exec, (mode, i1, i2, j1, j2));
2312 static void GLAPIENTRY
2313 save_Fogfv(GLenum pname, const GLfloat *params)
2315 GET_CURRENT_CONTEXT(ctx);
2316 Node *n;
2317 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2318 n = alloc_instruction(ctx, OPCODE_FOG, 5);
2319 if (n) {
2320 n[1].e = pname;
2321 n[2].f = params[0];
2322 n[3].f = params[1];
2323 n[4].f = params[2];
2324 n[5].f = params[3];
2326 if (ctx->ExecuteFlag) {
2327 CALL_Fogfv(ctx->Exec, (pname, params));
2332 static void GLAPIENTRY
2333 save_Fogf(GLenum pname, GLfloat param)
2335 GLfloat parray[4];
2336 parray[0] = param;
2337 parray[1] = parray[2] = parray[3] = 0.0F;
2338 save_Fogfv(pname, parray);
2342 static void GLAPIENTRY
2343 save_Fogiv(GLenum pname, const GLint *params)
2345 GLfloat p[4];
2346 switch (pname) {
2347 case GL_FOG_MODE:
2348 case GL_FOG_DENSITY:
2349 case GL_FOG_START:
2350 case GL_FOG_END:
2351 case GL_FOG_INDEX:
2352 p[0] = (GLfloat) *params;
2353 p[1] = 0.0f;
2354 p[2] = 0.0f;
2355 p[3] = 0.0f;
2356 break;
2357 case GL_FOG_COLOR:
2358 p[0] = INT_TO_FLOAT(params[0]);
2359 p[1] = INT_TO_FLOAT(params[1]);
2360 p[2] = INT_TO_FLOAT(params[2]);
2361 p[3] = INT_TO_FLOAT(params[3]);
2362 break;
2363 default:
2364 /* Error will be caught later in gl_Fogfv */
2365 ASSIGN_4V(p, 0.0F, 0.0F, 0.0F, 0.0F);
2367 save_Fogfv(pname, p);
2371 static void GLAPIENTRY
2372 save_Fogi(GLenum pname, GLint param)
2374 GLint parray[4];
2375 parray[0] = param;
2376 parray[1] = parray[2] = parray[3] = 0;
2377 save_Fogiv(pname, parray);
2381 static void GLAPIENTRY
2382 save_FrontFace(GLenum mode)
2384 GET_CURRENT_CONTEXT(ctx);
2385 Node *n;
2386 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2387 n = alloc_instruction(ctx, OPCODE_FRONT_FACE, 1);
2388 if (n) {
2389 n[1].e = mode;
2391 if (ctx->ExecuteFlag) {
2392 CALL_FrontFace(ctx->Exec, (mode));
2397 static void GLAPIENTRY
2398 save_Frustum(GLdouble left, GLdouble right,
2399 GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval)
2401 GET_CURRENT_CONTEXT(ctx);
2402 Node *n;
2403 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2404 n = alloc_instruction(ctx, OPCODE_FRUSTUM, 6);
2405 if (n) {
2406 n[1].f = (GLfloat) left;
2407 n[2].f = (GLfloat) right;
2408 n[3].f = (GLfloat) bottom;
2409 n[4].f = (GLfloat) top;
2410 n[5].f = (GLfloat) nearval;
2411 n[6].f = (GLfloat) farval;
2413 if (ctx->ExecuteFlag) {
2414 CALL_Frustum(ctx->Exec, (left, right, bottom, top, nearval, farval));
2419 static void GLAPIENTRY
2420 save_Hint(GLenum target, GLenum mode)
2422 GET_CURRENT_CONTEXT(ctx);
2423 Node *n;
2424 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2425 n = alloc_instruction(ctx, OPCODE_HINT, 2);
2426 if (n) {
2427 n[1].e = target;
2428 n[2].e = mode;
2430 if (ctx->ExecuteFlag) {
2431 CALL_Hint(ctx->Exec, (target, mode));
2436 static void GLAPIENTRY
2437 save_Histogram(GLenum target, GLsizei width, GLenum internalFormat,
2438 GLboolean sink)
2440 GET_CURRENT_CONTEXT(ctx);
2441 Node *n;
2443 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2444 n = alloc_instruction(ctx, OPCODE_HISTOGRAM, 4);
2445 if (n) {
2446 n[1].e = target;
2447 n[2].i = width;
2448 n[3].e = internalFormat;
2449 n[4].b = sink;
2451 if (ctx->ExecuteFlag) {
2452 CALL_Histogram(ctx->Exec, (target, width, internalFormat, sink));
2457 static void GLAPIENTRY
2458 save_IndexMask(GLuint mask)
2460 GET_CURRENT_CONTEXT(ctx);
2461 Node *n;
2462 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2463 n = alloc_instruction(ctx, OPCODE_INDEX_MASK, 1);
2464 if (n) {
2465 n[1].ui = mask;
2467 if (ctx->ExecuteFlag) {
2468 CALL_IndexMask(ctx->Exec, (mask));
2473 static void GLAPIENTRY
2474 save_InitNames(void)
2476 GET_CURRENT_CONTEXT(ctx);
2477 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2478 (void) alloc_instruction(ctx, OPCODE_INIT_NAMES, 0);
2479 if (ctx->ExecuteFlag) {
2480 CALL_InitNames(ctx->Exec, ());
2485 static void GLAPIENTRY
2486 save_Lightfv(GLenum light, GLenum pname, const GLfloat *params)
2488 GET_CURRENT_CONTEXT(ctx);
2489 Node *n;
2490 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2491 n = alloc_instruction(ctx, OPCODE_LIGHT, 6);
2492 if (n) {
2493 GLint i, nParams;
2494 n[1].e = light;
2495 n[2].e = pname;
2496 switch (pname) {
2497 case GL_AMBIENT:
2498 nParams = 4;
2499 break;
2500 case GL_DIFFUSE:
2501 nParams = 4;
2502 break;
2503 case GL_SPECULAR:
2504 nParams = 4;
2505 break;
2506 case GL_POSITION:
2507 nParams = 4;
2508 break;
2509 case GL_SPOT_DIRECTION:
2510 nParams = 3;
2511 break;
2512 case GL_SPOT_EXPONENT:
2513 nParams = 1;
2514 break;
2515 case GL_SPOT_CUTOFF:
2516 nParams = 1;
2517 break;
2518 case GL_CONSTANT_ATTENUATION:
2519 nParams = 1;
2520 break;
2521 case GL_LINEAR_ATTENUATION:
2522 nParams = 1;
2523 break;
2524 case GL_QUADRATIC_ATTENUATION:
2525 nParams = 1;
2526 break;
2527 default:
2528 nParams = 0;
2530 for (i = 0; i < nParams; i++) {
2531 n[3 + i].f = params[i];
2534 if (ctx->ExecuteFlag) {
2535 CALL_Lightfv(ctx->Exec, (light, pname, params));
2540 static void GLAPIENTRY
2541 save_Lightf(GLenum light, GLenum pname, GLfloat param)
2543 GLfloat parray[4];
2544 parray[0] = param;
2545 parray[1] = parray[2] = parray[3] = 0.0F;
2546 save_Lightfv(light, pname, parray);
2550 static void GLAPIENTRY
2551 save_Lightiv(GLenum light, GLenum pname, const GLint *params)
2553 GLfloat fparam[4];
2554 switch (pname) {
2555 case GL_AMBIENT:
2556 case GL_DIFFUSE:
2557 case GL_SPECULAR:
2558 fparam[0] = INT_TO_FLOAT(params[0]);
2559 fparam[1] = INT_TO_FLOAT(params[1]);
2560 fparam[2] = INT_TO_FLOAT(params[2]);
2561 fparam[3] = INT_TO_FLOAT(params[3]);
2562 break;
2563 case GL_POSITION:
2564 fparam[0] = (GLfloat) params[0];
2565 fparam[1] = (GLfloat) params[1];
2566 fparam[2] = (GLfloat) params[2];
2567 fparam[3] = (GLfloat) params[3];
2568 break;
2569 case GL_SPOT_DIRECTION:
2570 fparam[0] = (GLfloat) params[0];
2571 fparam[1] = (GLfloat) params[1];
2572 fparam[2] = (GLfloat) params[2];
2573 break;
2574 case GL_SPOT_EXPONENT:
2575 case GL_SPOT_CUTOFF:
2576 case GL_CONSTANT_ATTENUATION:
2577 case GL_LINEAR_ATTENUATION:
2578 case GL_QUADRATIC_ATTENUATION:
2579 fparam[0] = (GLfloat) params[0];
2580 break;
2581 default:
2582 /* error will be caught later in gl_Lightfv */
2585 save_Lightfv(light, pname, fparam);
2589 static void GLAPIENTRY
2590 save_Lighti(GLenum light, GLenum pname, GLint param)
2592 GLint parray[4];
2593 parray[0] = param;
2594 parray[1] = parray[2] = parray[3] = 0;
2595 save_Lightiv(light, pname, parray);
2599 static void GLAPIENTRY
2600 save_LightModelfv(GLenum pname, const GLfloat *params)
2602 GET_CURRENT_CONTEXT(ctx);
2603 Node *n;
2604 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2605 n = alloc_instruction(ctx, OPCODE_LIGHT_MODEL, 5);
2606 if (n) {
2607 n[1].e = pname;
2608 n[2].f = params[0];
2609 n[3].f = params[1];
2610 n[4].f = params[2];
2611 n[5].f = params[3];
2613 if (ctx->ExecuteFlag) {
2614 CALL_LightModelfv(ctx->Exec, (pname, params));
2619 static void GLAPIENTRY
2620 save_LightModelf(GLenum pname, GLfloat param)
2622 GLfloat parray[4];
2623 parray[0] = param;
2624 parray[1] = parray[2] = parray[3] = 0.0F;
2625 save_LightModelfv(pname, parray);
2629 static void GLAPIENTRY
2630 save_LightModeliv(GLenum pname, const GLint *params)
2632 GLfloat fparam[4];
2633 switch (pname) {
2634 case GL_LIGHT_MODEL_AMBIENT:
2635 fparam[0] = INT_TO_FLOAT(params[0]);
2636 fparam[1] = INT_TO_FLOAT(params[1]);
2637 fparam[2] = INT_TO_FLOAT(params[2]);
2638 fparam[3] = INT_TO_FLOAT(params[3]);
2639 break;
2640 case GL_LIGHT_MODEL_LOCAL_VIEWER:
2641 case GL_LIGHT_MODEL_TWO_SIDE:
2642 case GL_LIGHT_MODEL_COLOR_CONTROL:
2643 fparam[0] = (GLfloat) params[0];
2644 fparam[1] = 0.0F;
2645 fparam[2] = 0.0F;
2646 fparam[3] = 0.0F;
2647 break;
2648 default:
2649 /* Error will be caught later in gl_LightModelfv */
2650 ASSIGN_4V(fparam, 0.0F, 0.0F, 0.0F, 0.0F);
2652 save_LightModelfv(pname, fparam);
2656 static void GLAPIENTRY
2657 save_LightModeli(GLenum pname, GLint param)
2659 GLint parray[4];
2660 parray[0] = param;
2661 parray[1] = parray[2] = parray[3] = 0;
2662 save_LightModeliv(pname, parray);
2666 static void GLAPIENTRY
2667 save_LineStipple(GLint factor, GLushort pattern)
2669 GET_CURRENT_CONTEXT(ctx);
2670 Node *n;
2671 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2672 n = alloc_instruction(ctx, OPCODE_LINE_STIPPLE, 2);
2673 if (n) {
2674 n[1].i = factor;
2675 n[2].us = pattern;
2677 if (ctx->ExecuteFlag) {
2678 CALL_LineStipple(ctx->Exec, (factor, pattern));
2683 static void GLAPIENTRY
2684 save_LineWidth(GLfloat width)
2686 GET_CURRENT_CONTEXT(ctx);
2687 Node *n;
2688 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2689 n = alloc_instruction(ctx, OPCODE_LINE_WIDTH, 1);
2690 if (n) {
2691 n[1].f = width;
2693 if (ctx->ExecuteFlag) {
2694 CALL_LineWidth(ctx->Exec, (width));
2699 static void GLAPIENTRY
2700 save_ListBase(GLuint base)
2702 GET_CURRENT_CONTEXT(ctx);
2703 Node *n;
2704 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2705 n = alloc_instruction(ctx, OPCODE_LIST_BASE, 1);
2706 if (n) {
2707 n[1].ui = base;
2709 if (ctx->ExecuteFlag) {
2710 CALL_ListBase(ctx->Exec, (base));
2715 static void GLAPIENTRY
2716 save_LoadIdentity(void)
2718 GET_CURRENT_CONTEXT(ctx);
2719 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2720 (void) alloc_instruction(ctx, OPCODE_LOAD_IDENTITY, 0);
2721 if (ctx->ExecuteFlag) {
2722 CALL_LoadIdentity(ctx->Exec, ());
2727 static void GLAPIENTRY
2728 save_LoadMatrixf(const GLfloat * m)
2730 GET_CURRENT_CONTEXT(ctx);
2731 Node *n;
2732 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2733 n = alloc_instruction(ctx, OPCODE_LOAD_MATRIX, 16);
2734 if (n) {
2735 GLuint i;
2736 for (i = 0; i < 16; i++) {
2737 n[1 + i].f = m[i];
2740 if (ctx->ExecuteFlag) {
2741 CALL_LoadMatrixf(ctx->Exec, (m));
2746 static void GLAPIENTRY
2747 save_LoadMatrixd(const GLdouble * m)
2749 GLfloat f[16];
2750 GLint i;
2751 for (i = 0; i < 16; i++) {
2752 f[i] = (GLfloat) m[i];
2754 save_LoadMatrixf(f);
2758 static void GLAPIENTRY
2759 save_LoadName(GLuint name)
2761 GET_CURRENT_CONTEXT(ctx);
2762 Node *n;
2763 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2764 n = alloc_instruction(ctx, OPCODE_LOAD_NAME, 1);
2765 if (n) {
2766 n[1].ui = name;
2768 if (ctx->ExecuteFlag) {
2769 CALL_LoadName(ctx->Exec, (name));
2774 static void GLAPIENTRY
2775 save_LogicOp(GLenum opcode)
2777 GET_CURRENT_CONTEXT(ctx);
2778 Node *n;
2779 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2780 n = alloc_instruction(ctx, OPCODE_LOGIC_OP, 1);
2781 if (n) {
2782 n[1].e = opcode;
2784 if (ctx->ExecuteFlag) {
2785 CALL_LogicOp(ctx->Exec, (opcode));
2790 static void GLAPIENTRY
2791 save_Map1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride,
2792 GLint order, const GLdouble * points)
2794 GET_CURRENT_CONTEXT(ctx);
2795 Node *n;
2796 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2797 n = alloc_instruction(ctx, OPCODE_MAP1, 6);
2798 if (n) {
2799 GLfloat *pnts = _mesa_copy_map_points1d(target, stride, order, points);
2800 n[1].e = target;
2801 n[2].f = (GLfloat) u1;
2802 n[3].f = (GLfloat) u2;
2803 n[4].i = _mesa_evaluator_components(target); /* stride */
2804 n[5].i = order;
2805 n[6].data = (void *) pnts;
2807 if (ctx->ExecuteFlag) {
2808 CALL_Map1d(ctx->Exec, (target, u1, u2, stride, order, points));
2812 static void GLAPIENTRY
2813 save_Map1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride,
2814 GLint order, const GLfloat * points)
2816 GET_CURRENT_CONTEXT(ctx);
2817 Node *n;
2818 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2819 n = alloc_instruction(ctx, OPCODE_MAP1, 6);
2820 if (n) {
2821 GLfloat *pnts = _mesa_copy_map_points1f(target, stride, order, points);
2822 n[1].e = target;
2823 n[2].f = u1;
2824 n[3].f = u2;
2825 n[4].i = _mesa_evaluator_components(target); /* stride */
2826 n[5].i = order;
2827 n[6].data = (void *) pnts;
2829 if (ctx->ExecuteFlag) {
2830 CALL_Map1f(ctx->Exec, (target, u1, u2, stride, order, points));
2835 static void GLAPIENTRY
2836 save_Map2d(GLenum target,
2837 GLdouble u1, GLdouble u2, GLint ustride, GLint uorder,
2838 GLdouble v1, GLdouble v2, GLint vstride, GLint vorder,
2839 const GLdouble * points)
2841 GET_CURRENT_CONTEXT(ctx);
2842 Node *n;
2843 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2844 n = alloc_instruction(ctx, OPCODE_MAP2, 10);
2845 if (n) {
2846 GLfloat *pnts = _mesa_copy_map_points2d(target, ustride, uorder,
2847 vstride, vorder, points);
2848 n[1].e = target;
2849 n[2].f = (GLfloat) u1;
2850 n[3].f = (GLfloat) u2;
2851 n[4].f = (GLfloat) v1;
2852 n[5].f = (GLfloat) v2;
2853 /* XXX verify these strides are correct */
2854 n[6].i = _mesa_evaluator_components(target) * vorder; /*ustride */
2855 n[7].i = _mesa_evaluator_components(target); /*vstride */
2856 n[8].i = uorder;
2857 n[9].i = vorder;
2858 n[10].data = (void *) pnts;
2860 if (ctx->ExecuteFlag) {
2861 CALL_Map2d(ctx->Exec, (target,
2862 u1, u2, ustride, uorder,
2863 v1, v2, vstride, vorder, points));
2868 static void GLAPIENTRY
2869 save_Map2f(GLenum target,
2870 GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
2871 GLfloat v1, GLfloat v2, GLint vstride, GLint vorder,
2872 const GLfloat * points)
2874 GET_CURRENT_CONTEXT(ctx);
2875 Node *n;
2876 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2877 n = alloc_instruction(ctx, OPCODE_MAP2, 10);
2878 if (n) {
2879 GLfloat *pnts = _mesa_copy_map_points2f(target, ustride, uorder,
2880 vstride, vorder, points);
2881 n[1].e = target;
2882 n[2].f = u1;
2883 n[3].f = u2;
2884 n[4].f = v1;
2885 n[5].f = v2;
2886 /* XXX verify these strides are correct */
2887 n[6].i = _mesa_evaluator_components(target) * vorder; /*ustride */
2888 n[7].i = _mesa_evaluator_components(target); /*vstride */
2889 n[8].i = uorder;
2890 n[9].i = vorder;
2891 n[10].data = (void *) pnts;
2893 if (ctx->ExecuteFlag) {
2894 CALL_Map2f(ctx->Exec, (target, u1, u2, ustride, uorder,
2895 v1, v2, vstride, vorder, points));
2900 static void GLAPIENTRY
2901 save_MapGrid1f(GLint un, GLfloat u1, GLfloat u2)
2903 GET_CURRENT_CONTEXT(ctx);
2904 Node *n;
2905 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2906 n = alloc_instruction(ctx, OPCODE_MAPGRID1, 3);
2907 if (n) {
2908 n[1].i = un;
2909 n[2].f = u1;
2910 n[3].f = u2;
2912 if (ctx->ExecuteFlag) {
2913 CALL_MapGrid1f(ctx->Exec, (un, u1, u2));
2918 static void GLAPIENTRY
2919 save_MapGrid1d(GLint un, GLdouble u1, GLdouble u2)
2921 save_MapGrid1f(un, (GLfloat) u1, (GLfloat) u2);
2925 static void GLAPIENTRY
2926 save_MapGrid2f(GLint un, GLfloat u1, GLfloat u2,
2927 GLint vn, GLfloat v1, GLfloat v2)
2929 GET_CURRENT_CONTEXT(ctx);
2930 Node *n;
2931 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2932 n = alloc_instruction(ctx, OPCODE_MAPGRID2, 6);
2933 if (n) {
2934 n[1].i = un;
2935 n[2].f = u1;
2936 n[3].f = u2;
2937 n[4].i = vn;
2938 n[5].f = v1;
2939 n[6].f = v2;
2941 if (ctx->ExecuteFlag) {
2942 CALL_MapGrid2f(ctx->Exec, (un, u1, u2, vn, v1, v2));
2948 static void GLAPIENTRY
2949 save_MapGrid2d(GLint un, GLdouble u1, GLdouble u2,
2950 GLint vn, GLdouble v1, GLdouble v2)
2952 save_MapGrid2f(un, (GLfloat) u1, (GLfloat) u2,
2953 vn, (GLfloat) v1, (GLfloat) v2);
2957 static void GLAPIENTRY
2958 save_MatrixMode(GLenum mode)
2960 GET_CURRENT_CONTEXT(ctx);
2961 Node *n;
2962 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2963 n = alloc_instruction(ctx, OPCODE_MATRIX_MODE, 1);
2964 if (n) {
2965 n[1].e = mode;
2967 if (ctx->ExecuteFlag) {
2968 CALL_MatrixMode(ctx->Exec, (mode));
2973 static void GLAPIENTRY
2974 save_Minmax(GLenum target, GLenum internalFormat, GLboolean sink)
2976 GET_CURRENT_CONTEXT(ctx);
2977 Node *n;
2979 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2980 n = alloc_instruction(ctx, OPCODE_MIN_MAX, 3);
2981 if (n) {
2982 n[1].e = target;
2983 n[2].e = internalFormat;
2984 n[3].b = sink;
2986 if (ctx->ExecuteFlag) {
2987 CALL_Minmax(ctx->Exec, (target, internalFormat, sink));
2992 static void GLAPIENTRY
2993 save_MultMatrixf(const GLfloat * m)
2995 GET_CURRENT_CONTEXT(ctx);
2996 Node *n;
2997 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2998 n = alloc_instruction(ctx, OPCODE_MULT_MATRIX, 16);
2999 if (n) {
3000 GLuint i;
3001 for (i = 0; i < 16; i++) {
3002 n[1 + i].f = m[i];
3005 if (ctx->ExecuteFlag) {
3006 CALL_MultMatrixf(ctx->Exec, (m));
3011 static void GLAPIENTRY
3012 save_MultMatrixd(const GLdouble * m)
3014 GLfloat f[16];
3015 GLint i;
3016 for (i = 0; i < 16; i++) {
3017 f[i] = (GLfloat) m[i];
3019 save_MultMatrixf(f);
3023 static void GLAPIENTRY
3024 save_NewList(GLuint name, GLenum mode)
3026 GET_CURRENT_CONTEXT(ctx);
3027 /* It's an error to call this function while building a display list */
3028 _mesa_error(ctx, GL_INVALID_OPERATION, "glNewList");
3029 (void) name;
3030 (void) mode;
3035 static void GLAPIENTRY
3036 save_Ortho(GLdouble left, GLdouble right,
3037 GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval)
3039 GET_CURRENT_CONTEXT(ctx);
3040 Node *n;
3041 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3042 n = alloc_instruction(ctx, OPCODE_ORTHO, 6);
3043 if (n) {
3044 n[1].f = (GLfloat) left;
3045 n[2].f = (GLfloat) right;
3046 n[3].f = (GLfloat) bottom;
3047 n[4].f = (GLfloat) top;
3048 n[5].f = (GLfloat) nearval;
3049 n[6].f = (GLfloat) farval;
3051 if (ctx->ExecuteFlag) {
3052 CALL_Ortho(ctx->Exec, (left, right, bottom, top, nearval, farval));
3057 static void GLAPIENTRY
3058 save_PixelMapfv(GLenum map, GLint mapsize, const GLfloat *values)
3060 GET_CURRENT_CONTEXT(ctx);
3061 Node *n;
3062 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3063 n = alloc_instruction(ctx, OPCODE_PIXEL_MAP, 3);
3064 if (n) {
3065 n[1].e = map;
3066 n[2].i = mapsize;
3067 n[3].data = (void *) malloc(mapsize * sizeof(GLfloat));
3068 memcpy(n[3].data, (void *) values, mapsize * sizeof(GLfloat));
3070 if (ctx->ExecuteFlag) {
3071 CALL_PixelMapfv(ctx->Exec, (map, mapsize, values));
3076 static void GLAPIENTRY
3077 save_PixelMapuiv(GLenum map, GLint mapsize, const GLuint *values)
3079 GLfloat fvalues[MAX_PIXEL_MAP_TABLE];
3080 GLint i;
3081 if (map == GL_PIXEL_MAP_I_TO_I || map == GL_PIXEL_MAP_S_TO_S) {
3082 for (i = 0; i < mapsize; i++) {
3083 fvalues[i] = (GLfloat) values[i];
3086 else {
3087 for (i = 0; i < mapsize; i++) {
3088 fvalues[i] = UINT_TO_FLOAT(values[i]);
3091 save_PixelMapfv(map, mapsize, fvalues);
3095 static void GLAPIENTRY
3096 save_PixelMapusv(GLenum map, GLint mapsize, const GLushort *values)
3098 GLfloat fvalues[MAX_PIXEL_MAP_TABLE];
3099 GLint i;
3100 if (map == GL_PIXEL_MAP_I_TO_I || map == GL_PIXEL_MAP_S_TO_S) {
3101 for (i = 0; i < mapsize; i++) {
3102 fvalues[i] = (GLfloat) values[i];
3105 else {
3106 for (i = 0; i < mapsize; i++) {
3107 fvalues[i] = USHORT_TO_FLOAT(values[i]);
3110 save_PixelMapfv(map, mapsize, fvalues);
3114 static void GLAPIENTRY
3115 save_PixelTransferf(GLenum pname, GLfloat param)
3117 GET_CURRENT_CONTEXT(ctx);
3118 Node *n;
3119 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3120 n = alloc_instruction(ctx, OPCODE_PIXEL_TRANSFER, 2);
3121 if (n) {
3122 n[1].e = pname;
3123 n[2].f = param;
3125 if (ctx->ExecuteFlag) {
3126 CALL_PixelTransferf(ctx->Exec, (pname, param));
3131 static void GLAPIENTRY
3132 save_PixelTransferi(GLenum pname, GLint param)
3134 save_PixelTransferf(pname, (GLfloat) param);
3138 static void GLAPIENTRY
3139 save_PixelZoom(GLfloat xfactor, GLfloat yfactor)
3141 GET_CURRENT_CONTEXT(ctx);
3142 Node *n;
3143 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3144 n = alloc_instruction(ctx, OPCODE_PIXEL_ZOOM, 2);
3145 if (n) {
3146 n[1].f = xfactor;
3147 n[2].f = yfactor;
3149 if (ctx->ExecuteFlag) {
3150 CALL_PixelZoom(ctx->Exec, (xfactor, yfactor));
3155 static void GLAPIENTRY
3156 save_PointParameterfvEXT(GLenum pname, const GLfloat *params)
3158 GET_CURRENT_CONTEXT(ctx);
3159 Node *n;
3160 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3161 n = alloc_instruction(ctx, OPCODE_POINT_PARAMETERS, 4);
3162 if (n) {
3163 n[1].e = pname;
3164 n[2].f = params[0];
3165 n[3].f = params[1];
3166 n[4].f = params[2];
3168 if (ctx->ExecuteFlag) {
3169 CALL_PointParameterfvEXT(ctx->Exec, (pname, params));
3174 static void GLAPIENTRY
3175 save_PointParameterfEXT(GLenum pname, GLfloat param)
3177 GLfloat parray[3];
3178 parray[0] = param;
3179 parray[1] = parray[2] = 0.0F;
3180 save_PointParameterfvEXT(pname, parray);
3183 static void GLAPIENTRY
3184 save_PointParameteriNV(GLenum pname, GLint param)
3186 GLfloat parray[3];
3187 parray[0] = (GLfloat) param;
3188 parray[1] = parray[2] = 0.0F;
3189 save_PointParameterfvEXT(pname, parray);
3192 static void GLAPIENTRY
3193 save_PointParameterivNV(GLenum pname, const GLint * param)
3195 GLfloat parray[3];
3196 parray[0] = (GLfloat) param[0];
3197 parray[1] = parray[2] = 0.0F;
3198 save_PointParameterfvEXT(pname, parray);
3202 static void GLAPIENTRY
3203 save_PointSize(GLfloat size)
3205 GET_CURRENT_CONTEXT(ctx);
3206 Node *n;
3207 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3208 n = alloc_instruction(ctx, OPCODE_POINT_SIZE, 1);
3209 if (n) {
3210 n[1].f = size;
3212 if (ctx->ExecuteFlag) {
3213 CALL_PointSize(ctx->Exec, (size));
3218 static void GLAPIENTRY
3219 save_PolygonMode(GLenum face, GLenum mode)
3221 GET_CURRENT_CONTEXT(ctx);
3222 Node *n;
3223 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3224 n = alloc_instruction(ctx, OPCODE_POLYGON_MODE, 2);
3225 if (n) {
3226 n[1].e = face;
3227 n[2].e = mode;
3229 if (ctx->ExecuteFlag) {
3230 CALL_PolygonMode(ctx->Exec, (face, mode));
3235 static void GLAPIENTRY
3236 save_PolygonStipple(const GLubyte * pattern)
3238 GET_CURRENT_CONTEXT(ctx);
3239 Node *n;
3241 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3243 n = alloc_instruction(ctx, OPCODE_POLYGON_STIPPLE, 1);
3244 if (n) {
3245 n[1].data = unpack_image(ctx, 2, 32, 32, 1, GL_COLOR_INDEX, GL_BITMAP,
3246 pattern, &ctx->Unpack);
3248 if (ctx->ExecuteFlag) {
3249 CALL_PolygonStipple(ctx->Exec, ((GLubyte *) pattern));
3254 static void GLAPIENTRY
3255 save_PolygonOffset(GLfloat factor, GLfloat units)
3257 GET_CURRENT_CONTEXT(ctx);
3258 Node *n;
3259 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3260 n = alloc_instruction(ctx, OPCODE_POLYGON_OFFSET, 2);
3261 if (n) {
3262 n[1].f = factor;
3263 n[2].f = units;
3265 if (ctx->ExecuteFlag) {
3266 CALL_PolygonOffset(ctx->Exec, (factor, units));
3271 static void GLAPIENTRY
3272 save_PolygonOffsetEXT(GLfloat factor, GLfloat bias)
3274 GET_CURRENT_CONTEXT(ctx);
3275 /* XXX mult by DepthMaxF here??? */
3276 save_PolygonOffset(factor, ctx->DrawBuffer->_DepthMaxF * bias);
3280 static void GLAPIENTRY
3281 save_PopAttrib(void)
3283 GET_CURRENT_CONTEXT(ctx);
3284 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3285 (void) alloc_instruction(ctx, OPCODE_POP_ATTRIB, 0);
3286 if (ctx->ExecuteFlag) {
3287 CALL_PopAttrib(ctx->Exec, ());
3292 static void GLAPIENTRY
3293 save_PopMatrix(void)
3295 GET_CURRENT_CONTEXT(ctx);
3296 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3297 (void) alloc_instruction(ctx, OPCODE_POP_MATRIX, 0);
3298 if (ctx->ExecuteFlag) {
3299 CALL_PopMatrix(ctx->Exec, ());
3304 static void GLAPIENTRY
3305 save_PopName(void)
3307 GET_CURRENT_CONTEXT(ctx);
3308 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3309 (void) alloc_instruction(ctx, OPCODE_POP_NAME, 0);
3310 if (ctx->ExecuteFlag) {
3311 CALL_PopName(ctx->Exec, ());
3316 static void GLAPIENTRY
3317 save_PrioritizeTextures(GLsizei num, const GLuint * textures,
3318 const GLclampf * priorities)
3320 GET_CURRENT_CONTEXT(ctx);
3321 GLint i;
3322 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3324 for (i = 0; i < num; i++) {
3325 Node *n;
3326 n = alloc_instruction(ctx, OPCODE_PRIORITIZE_TEXTURE, 2);
3327 if (n) {
3328 n[1].ui = textures[i];
3329 n[2].f = priorities[i];
3332 if (ctx->ExecuteFlag) {
3333 CALL_PrioritizeTextures(ctx->Exec, (num, textures, priorities));
3338 static void GLAPIENTRY
3339 save_PushAttrib(GLbitfield mask)
3341 GET_CURRENT_CONTEXT(ctx);
3342 Node *n;
3343 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3344 n = alloc_instruction(ctx, OPCODE_PUSH_ATTRIB, 1);
3345 if (n) {
3346 n[1].bf = mask;
3348 if (ctx->ExecuteFlag) {
3349 CALL_PushAttrib(ctx->Exec, (mask));
3354 static void GLAPIENTRY
3355 save_PushMatrix(void)
3357 GET_CURRENT_CONTEXT(ctx);
3358 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3359 (void) alloc_instruction(ctx, OPCODE_PUSH_MATRIX, 0);
3360 if (ctx->ExecuteFlag) {
3361 CALL_PushMatrix(ctx->Exec, ());
3366 static void GLAPIENTRY
3367 save_PushName(GLuint name)
3369 GET_CURRENT_CONTEXT(ctx);
3370 Node *n;
3371 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3372 n = alloc_instruction(ctx, OPCODE_PUSH_NAME, 1);
3373 if (n) {
3374 n[1].ui = name;
3376 if (ctx->ExecuteFlag) {
3377 CALL_PushName(ctx->Exec, (name));
3382 static void GLAPIENTRY
3383 save_RasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
3385 GET_CURRENT_CONTEXT(ctx);
3386 Node *n;
3387 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3388 n = alloc_instruction(ctx, OPCODE_RASTER_POS, 4);
3389 if (n) {
3390 n[1].f = x;
3391 n[2].f = y;
3392 n[3].f = z;
3393 n[4].f = w;
3395 if (ctx->ExecuteFlag) {
3396 CALL_RasterPos4f(ctx->Exec, (x, y, z, w));
3400 static void GLAPIENTRY
3401 save_RasterPos2d(GLdouble x, GLdouble y)
3403 save_RasterPos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
3406 static void GLAPIENTRY
3407 save_RasterPos2f(GLfloat x, GLfloat y)
3409 save_RasterPos4f(x, y, 0.0F, 1.0F);
3412 static void GLAPIENTRY
3413 save_RasterPos2i(GLint x, GLint y)
3415 save_RasterPos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
3418 static void GLAPIENTRY
3419 save_RasterPos2s(GLshort x, GLshort y)
3421 save_RasterPos4f(x, y, 0.0F, 1.0F);
3424 static void GLAPIENTRY
3425 save_RasterPos3d(GLdouble x, GLdouble y, GLdouble z)
3427 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
3430 static void GLAPIENTRY
3431 save_RasterPos3f(GLfloat x, GLfloat y, GLfloat z)
3433 save_RasterPos4f(x, y, z, 1.0F);
3436 static void GLAPIENTRY
3437 save_RasterPos3i(GLint x, GLint y, GLint z)
3439 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
3442 static void GLAPIENTRY
3443 save_RasterPos3s(GLshort x, GLshort y, GLshort z)
3445 save_RasterPos4f(x, y, z, 1.0F);
3448 static void GLAPIENTRY
3449 save_RasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
3451 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
3454 static void GLAPIENTRY
3455 save_RasterPos4i(GLint x, GLint y, GLint z, GLint w)
3457 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
3460 static void GLAPIENTRY
3461 save_RasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w)
3463 save_RasterPos4f(x, y, z, w);
3466 static void GLAPIENTRY
3467 save_RasterPos2dv(const GLdouble * v)
3469 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
3472 static void GLAPIENTRY
3473 save_RasterPos2fv(const GLfloat * v)
3475 save_RasterPos4f(v[0], v[1], 0.0F, 1.0F);
3478 static void GLAPIENTRY
3479 save_RasterPos2iv(const GLint * v)
3481 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
3484 static void GLAPIENTRY
3485 save_RasterPos2sv(const GLshort * v)
3487 save_RasterPos4f(v[0], v[1], 0.0F, 1.0F);
3490 static void GLAPIENTRY
3491 save_RasterPos3dv(const GLdouble * v)
3493 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
3496 static void GLAPIENTRY
3497 save_RasterPos3fv(const GLfloat * v)
3499 save_RasterPos4f(v[0], v[1], v[2], 1.0F);
3502 static void GLAPIENTRY
3503 save_RasterPos3iv(const GLint * v)
3505 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
3508 static void GLAPIENTRY
3509 save_RasterPos3sv(const GLshort * v)
3511 save_RasterPos4f(v[0], v[1], v[2], 1.0F);
3514 static void GLAPIENTRY
3515 save_RasterPos4dv(const GLdouble * v)
3517 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1],
3518 (GLfloat) v[2], (GLfloat) v[3]);
3521 static void GLAPIENTRY
3522 save_RasterPos4fv(const GLfloat * v)
3524 save_RasterPos4f(v[0], v[1], v[2], v[3]);
3527 static void GLAPIENTRY
3528 save_RasterPos4iv(const GLint * v)
3530 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1],
3531 (GLfloat) v[2], (GLfloat) v[3]);
3534 static void GLAPIENTRY
3535 save_RasterPos4sv(const GLshort * v)
3537 save_RasterPos4f(v[0], v[1], v[2], v[3]);
3541 static void GLAPIENTRY
3542 save_PassThrough(GLfloat token)
3544 GET_CURRENT_CONTEXT(ctx);
3545 Node *n;
3546 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3547 n = alloc_instruction(ctx, OPCODE_PASSTHROUGH, 1);
3548 if (n) {
3549 n[1].f = token;
3551 if (ctx->ExecuteFlag) {
3552 CALL_PassThrough(ctx->Exec, (token));
3557 static void GLAPIENTRY
3558 save_ReadBuffer(GLenum mode)
3560 GET_CURRENT_CONTEXT(ctx);
3561 Node *n;
3562 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3563 n = alloc_instruction(ctx, OPCODE_READ_BUFFER, 1);
3564 if (n) {
3565 n[1].e = mode;
3567 if (ctx->ExecuteFlag) {
3568 CALL_ReadBuffer(ctx->Exec, (mode));
3573 static void GLAPIENTRY
3574 save_ResetHistogram(GLenum target)
3576 GET_CURRENT_CONTEXT(ctx);
3577 Node *n;
3578 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3579 n = alloc_instruction(ctx, OPCODE_RESET_HISTOGRAM, 1);
3580 if (n) {
3581 n[1].e = target;
3583 if (ctx->ExecuteFlag) {
3584 CALL_ResetHistogram(ctx->Exec, (target));
3589 static void GLAPIENTRY
3590 save_ResetMinmax(GLenum target)
3592 GET_CURRENT_CONTEXT(ctx);
3593 Node *n;
3594 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3595 n = alloc_instruction(ctx, OPCODE_RESET_MIN_MAX, 1);
3596 if (n) {
3597 n[1].e = target;
3599 if (ctx->ExecuteFlag) {
3600 CALL_ResetMinmax(ctx->Exec, (target));
3605 static void GLAPIENTRY
3606 save_Rotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
3608 GET_CURRENT_CONTEXT(ctx);
3609 Node *n;
3610 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3611 n = alloc_instruction(ctx, OPCODE_ROTATE, 4);
3612 if (n) {
3613 n[1].f = angle;
3614 n[2].f = x;
3615 n[3].f = y;
3616 n[4].f = z;
3618 if (ctx->ExecuteFlag) {
3619 CALL_Rotatef(ctx->Exec, (angle, x, y, z));
3624 static void GLAPIENTRY
3625 save_Rotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
3627 save_Rotatef((GLfloat) angle, (GLfloat) x, (GLfloat) y, (GLfloat) z);
3631 static void GLAPIENTRY
3632 save_Scalef(GLfloat x, GLfloat y, GLfloat z)
3634 GET_CURRENT_CONTEXT(ctx);
3635 Node *n;
3636 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3637 n = alloc_instruction(ctx, OPCODE_SCALE, 3);
3638 if (n) {
3639 n[1].f = x;
3640 n[2].f = y;
3641 n[3].f = z;
3643 if (ctx->ExecuteFlag) {
3644 CALL_Scalef(ctx->Exec, (x, y, z));
3649 static void GLAPIENTRY
3650 save_Scaled(GLdouble x, GLdouble y, GLdouble z)
3652 save_Scalef((GLfloat) x, (GLfloat) y, (GLfloat) z);
3656 static void GLAPIENTRY
3657 save_Scissor(GLint x, GLint y, GLsizei width, GLsizei height)
3659 GET_CURRENT_CONTEXT(ctx);
3660 Node *n;
3661 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3662 n = alloc_instruction(ctx, OPCODE_SCISSOR, 4);
3663 if (n) {
3664 n[1].i = x;
3665 n[2].i = y;
3666 n[3].i = width;
3667 n[4].i = height;
3669 if (ctx->ExecuteFlag) {
3670 CALL_Scissor(ctx->Exec, (x, y, width, height));
3675 static void GLAPIENTRY
3676 save_ShadeModel(GLenum mode)
3678 GET_CURRENT_CONTEXT(ctx);
3679 Node *n;
3680 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx);
3682 if (ctx->ExecuteFlag) {
3683 CALL_ShadeModel(ctx->Exec, (mode));
3686 if (ctx->ListState.Current.ShadeModel == mode)
3687 return;
3689 SAVE_FLUSH_VERTICES(ctx);
3691 /* Only save the value if we know the statechange will take effect:
3693 if (ctx->Driver.CurrentSavePrimitive == PRIM_OUTSIDE_BEGIN_END)
3694 ctx->ListState.Current.ShadeModel = mode;
3696 n = alloc_instruction(ctx, OPCODE_SHADE_MODEL, 1);
3697 if (n) {
3698 n[1].e = mode;
3703 static void GLAPIENTRY
3704 save_StencilFunc(GLenum func, GLint ref, GLuint mask)
3706 GET_CURRENT_CONTEXT(ctx);
3707 Node *n;
3708 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3709 n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC, 3);
3710 if (n) {
3711 n[1].e = func;
3712 n[2].i = ref;
3713 n[3].ui = mask;
3715 if (ctx->ExecuteFlag) {
3716 CALL_StencilFunc(ctx->Exec, (func, ref, mask));
3721 static void GLAPIENTRY
3722 save_StencilMask(GLuint mask)
3724 GET_CURRENT_CONTEXT(ctx);
3725 Node *n;
3726 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3727 n = alloc_instruction(ctx, OPCODE_STENCIL_MASK, 1);
3728 if (n) {
3729 n[1].ui = mask;
3731 if (ctx->ExecuteFlag) {
3732 CALL_StencilMask(ctx->Exec, (mask));
3737 static void GLAPIENTRY
3738 save_StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
3740 GET_CURRENT_CONTEXT(ctx);
3741 Node *n;
3742 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3743 n = alloc_instruction(ctx, OPCODE_STENCIL_OP, 3);
3744 if (n) {
3745 n[1].e = fail;
3746 n[2].e = zfail;
3747 n[3].e = zpass;
3749 if (ctx->ExecuteFlag) {
3750 CALL_StencilOp(ctx->Exec, (fail, zfail, zpass));
3755 static void GLAPIENTRY
3756 save_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
3758 GET_CURRENT_CONTEXT(ctx);
3759 Node *n;
3760 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3761 n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4);
3762 if (n) {
3763 n[1].e = face;
3764 n[2].e = func;
3765 n[3].i = ref;
3766 n[4].ui = mask;
3768 if (ctx->ExecuteFlag) {
3769 CALL_StencilFuncSeparate(ctx->Exec, (face, func, ref, mask));
3774 static void GLAPIENTRY
3775 save_StencilFuncSeparateATI(GLenum frontfunc, GLenum backfunc, GLint ref,
3776 GLuint mask)
3778 GET_CURRENT_CONTEXT(ctx);
3779 Node *n;
3780 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3781 /* GL_FRONT */
3782 n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4);
3783 if (n) {
3784 n[1].e = GL_FRONT;
3785 n[2].e = frontfunc;
3786 n[3].i = ref;
3787 n[4].ui = mask;
3789 /* GL_BACK */
3790 n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4);
3791 if (n) {
3792 n[1].e = GL_BACK;
3793 n[2].e = backfunc;
3794 n[3].i = ref;
3795 n[4].ui = mask;
3797 if (ctx->ExecuteFlag) {
3798 CALL_StencilFuncSeparate(ctx->Exec, (GL_FRONT, frontfunc, ref, mask));
3799 CALL_StencilFuncSeparate(ctx->Exec, (GL_BACK, backfunc, ref, mask));
3804 static void GLAPIENTRY
3805 save_StencilMaskSeparate(GLenum face, GLuint mask)
3807 GET_CURRENT_CONTEXT(ctx);
3808 Node *n;
3809 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3810 n = alloc_instruction(ctx, OPCODE_STENCIL_MASK_SEPARATE, 2);
3811 if (n) {
3812 n[1].e = face;
3813 n[2].ui = mask;
3815 if (ctx->ExecuteFlag) {
3816 CALL_StencilMaskSeparate(ctx->Exec, (face, mask));
3821 static void GLAPIENTRY
3822 save_StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
3824 GET_CURRENT_CONTEXT(ctx);
3825 Node *n;
3826 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3827 n = alloc_instruction(ctx, OPCODE_STENCIL_OP_SEPARATE, 4);
3828 if (n) {
3829 n[1].e = face;
3830 n[2].e = fail;
3831 n[3].e = zfail;
3832 n[4].e = zpass;
3834 if (ctx->ExecuteFlag) {
3835 CALL_StencilOpSeparate(ctx->Exec, (face, fail, zfail, zpass));
3840 static void GLAPIENTRY
3841 save_TexEnvfv(GLenum target, GLenum pname, const GLfloat *params)
3843 GET_CURRENT_CONTEXT(ctx);
3844 Node *n;
3845 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3846 n = alloc_instruction(ctx, OPCODE_TEXENV, 6);
3847 if (n) {
3848 n[1].e = target;
3849 n[2].e = pname;
3850 if (pname == GL_TEXTURE_ENV_COLOR) {
3851 n[3].f = params[0];
3852 n[4].f = params[1];
3853 n[5].f = params[2];
3854 n[6].f = params[3];
3856 else {
3857 n[3].f = params[0];
3858 n[4].f = n[5].f = n[6].f = 0.0F;
3861 if (ctx->ExecuteFlag) {
3862 CALL_TexEnvfv(ctx->Exec, (target, pname, params));
3867 static void GLAPIENTRY
3868 save_TexEnvf(GLenum target, GLenum pname, GLfloat param)
3870 GLfloat parray[4];
3871 parray[0] = (GLfloat) param;
3872 parray[1] = parray[2] = parray[3] = 0.0F;
3873 save_TexEnvfv(target, pname, parray);
3877 static void GLAPIENTRY
3878 save_TexEnvi(GLenum target, GLenum pname, GLint param)
3880 GLfloat p[4];
3881 p[0] = (GLfloat) param;
3882 p[1] = p[2] = p[3] = 0.0F;
3883 save_TexEnvfv(target, pname, p);
3887 static void GLAPIENTRY
3888 save_TexEnviv(GLenum target, GLenum pname, const GLint * param)
3890 GLfloat p[4];
3891 if (pname == GL_TEXTURE_ENV_COLOR) {
3892 p[0] = INT_TO_FLOAT(param[0]);
3893 p[1] = INT_TO_FLOAT(param[1]);
3894 p[2] = INT_TO_FLOAT(param[2]);
3895 p[3] = INT_TO_FLOAT(param[3]);
3897 else {
3898 p[0] = (GLfloat) param[0];
3899 p[1] = p[2] = p[3] = 0.0F;
3901 save_TexEnvfv(target, pname, p);
3905 static void GLAPIENTRY
3906 save_TexGenfv(GLenum coord, GLenum pname, const GLfloat *params)
3908 GET_CURRENT_CONTEXT(ctx);
3909 Node *n;
3910 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3911 n = alloc_instruction(ctx, OPCODE_TEXGEN, 6);
3912 if (n) {
3913 n[1].e = coord;
3914 n[2].e = pname;
3915 n[3].f = params[0];
3916 n[4].f = params[1];
3917 n[5].f = params[2];
3918 n[6].f = params[3];
3920 if (ctx->ExecuteFlag) {
3921 CALL_TexGenfv(ctx->Exec, (coord, pname, params));
3926 static void GLAPIENTRY
3927 save_TexGeniv(GLenum coord, GLenum pname, const GLint *params)
3929 GLfloat p[4];
3930 p[0] = (GLfloat) params[0];
3931 p[1] = (GLfloat) params[1];
3932 p[2] = (GLfloat) params[2];
3933 p[3] = (GLfloat) params[3];
3934 save_TexGenfv(coord, pname, p);
3938 static void GLAPIENTRY
3939 save_TexGend(GLenum coord, GLenum pname, GLdouble param)
3941 GLfloat parray[4];
3942 parray[0] = (GLfloat) param;
3943 parray[1] = parray[2] = parray[3] = 0.0F;
3944 save_TexGenfv(coord, pname, parray);
3948 static void GLAPIENTRY
3949 save_TexGendv(GLenum coord, GLenum pname, const GLdouble *params)
3951 GLfloat p[4];
3952 p[0] = (GLfloat) params[0];
3953 p[1] = (GLfloat) params[1];
3954 p[2] = (GLfloat) params[2];
3955 p[3] = (GLfloat) params[3];
3956 save_TexGenfv(coord, pname, p);
3960 static void GLAPIENTRY
3961 save_TexGenf(GLenum coord, GLenum pname, GLfloat param)
3963 GLfloat parray[4];
3964 parray[0] = param;
3965 parray[1] = parray[2] = parray[3] = 0.0F;
3966 save_TexGenfv(coord, pname, parray);
3970 static void GLAPIENTRY
3971 save_TexGeni(GLenum coord, GLenum pname, GLint param)
3973 GLint parray[4];
3974 parray[0] = param;
3975 parray[1] = parray[2] = parray[3] = 0;
3976 save_TexGeniv(coord, pname, parray);
3980 static void GLAPIENTRY
3981 save_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
3983 GET_CURRENT_CONTEXT(ctx);
3984 Node *n;
3985 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3986 n = alloc_instruction(ctx, OPCODE_TEXPARAMETER, 6);
3987 if (n) {
3988 n[1].e = target;
3989 n[2].e = pname;
3990 n[3].f = params[0];
3991 n[4].f = params[1];
3992 n[5].f = params[2];
3993 n[6].f = params[3];
3995 if (ctx->ExecuteFlag) {
3996 CALL_TexParameterfv(ctx->Exec, (target, pname, params));
4001 static void GLAPIENTRY
4002 save_TexParameterf(GLenum target, GLenum pname, GLfloat param)
4004 GLfloat parray[4];
4005 parray[0] = param;
4006 parray[1] = parray[2] = parray[3] = 0.0F;
4007 save_TexParameterfv(target, pname, parray);
4011 static void GLAPIENTRY
4012 save_TexParameteri(GLenum target, GLenum pname, GLint param)
4014 GLfloat fparam[4];
4015 fparam[0] = (GLfloat) param;
4016 fparam[1] = fparam[2] = fparam[3] = 0.0F;
4017 save_TexParameterfv(target, pname, fparam);
4021 static void GLAPIENTRY
4022 save_TexParameteriv(GLenum target, GLenum pname, const GLint *params)
4024 GLfloat fparam[4];
4025 fparam[0] = (GLfloat) params[0];
4026 fparam[1] = fparam[2] = fparam[3] = 0.0F;
4027 save_TexParameterfv(target, pname, fparam);
4031 static void GLAPIENTRY
4032 save_TexImage1D(GLenum target,
4033 GLint level, GLint components,
4034 GLsizei width, GLint border,
4035 GLenum format, GLenum type, const GLvoid * pixels)
4037 GET_CURRENT_CONTEXT(ctx);
4038 if (target == GL_PROXY_TEXTURE_1D) {
4039 /* don't compile, execute immediately */
4040 CALL_TexImage1D(ctx->Exec, (target, level, components, width,
4041 border, format, type, pixels));
4043 else {
4044 Node *n;
4045 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4046 n = alloc_instruction(ctx, OPCODE_TEX_IMAGE1D, 8);
4047 if (n) {
4048 n[1].e = target;
4049 n[2].i = level;
4050 n[3].i = components;
4051 n[4].i = (GLint) width;
4052 n[5].i = border;
4053 n[6].e = format;
4054 n[7].e = type;
4055 n[8].data = unpack_image(ctx, 1, width, 1, 1, format, type,
4056 pixels, &ctx->Unpack);
4058 if (ctx->ExecuteFlag) {
4059 CALL_TexImage1D(ctx->Exec, (target, level, components, width,
4060 border, format, type, pixels));
4066 static void GLAPIENTRY
4067 save_TexImage2D(GLenum target,
4068 GLint level, GLint components,
4069 GLsizei width, GLsizei height, GLint border,
4070 GLenum format, GLenum type, const GLvoid * pixels)
4072 GET_CURRENT_CONTEXT(ctx);
4073 if (target == GL_PROXY_TEXTURE_2D) {
4074 /* don't compile, execute immediately */
4075 CALL_TexImage2D(ctx->Exec, (target, level, components, width,
4076 height, border, format, type, pixels));
4078 else {
4079 Node *n;
4080 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4081 n = alloc_instruction(ctx, OPCODE_TEX_IMAGE2D, 9);
4082 if (n) {
4083 n[1].e = target;
4084 n[2].i = level;
4085 n[3].i = components;
4086 n[4].i = (GLint) width;
4087 n[5].i = (GLint) height;
4088 n[6].i = border;
4089 n[7].e = format;
4090 n[8].e = type;
4091 n[9].data = unpack_image(ctx, 2, width, height, 1, format, type,
4092 pixels, &ctx->Unpack);
4094 if (ctx->ExecuteFlag) {
4095 CALL_TexImage2D(ctx->Exec, (target, level, components, width,
4096 height, border, format, type, pixels));
4102 static void GLAPIENTRY
4103 save_TexImage3D(GLenum target,
4104 GLint level, GLint internalFormat,
4105 GLsizei width, GLsizei height, GLsizei depth,
4106 GLint border,
4107 GLenum format, GLenum type, const GLvoid * pixels)
4109 GET_CURRENT_CONTEXT(ctx);
4110 if (target == GL_PROXY_TEXTURE_3D) {
4111 /* don't compile, execute immediately */
4112 CALL_TexImage3D(ctx->Exec, (target, level, internalFormat, width,
4113 height, depth, border, format, type,
4114 pixels));
4116 else {
4117 Node *n;
4118 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4119 n = alloc_instruction(ctx, OPCODE_TEX_IMAGE3D, 10);
4120 if (n) {
4121 n[1].e = target;
4122 n[2].i = level;
4123 n[3].i = (GLint) internalFormat;
4124 n[4].i = (GLint) width;
4125 n[5].i = (GLint) height;
4126 n[6].i = (GLint) depth;
4127 n[7].i = border;
4128 n[8].e = format;
4129 n[9].e = type;
4130 n[10].data = unpack_image(ctx, 3, width, height, depth, format, type,
4131 pixels, &ctx->Unpack);
4133 if (ctx->ExecuteFlag) {
4134 CALL_TexImage3D(ctx->Exec, (target, level, internalFormat, width,
4135 height, depth, border, format, type,
4136 pixels));
4142 static void GLAPIENTRY
4143 save_TexSubImage1D(GLenum target, GLint level, GLint xoffset,
4144 GLsizei width, GLenum format, GLenum type,
4145 const GLvoid * pixels)
4147 GET_CURRENT_CONTEXT(ctx);
4148 Node *n;
4150 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4152 n = alloc_instruction(ctx, OPCODE_TEX_SUB_IMAGE1D, 7);
4153 if (n) {
4154 n[1].e = target;
4155 n[2].i = level;
4156 n[3].i = xoffset;
4157 n[4].i = (GLint) width;
4158 n[5].e = format;
4159 n[6].e = type;
4160 n[7].data = unpack_image(ctx, 1, width, 1, 1, format, type,
4161 pixels, &ctx->Unpack);
4163 if (ctx->ExecuteFlag) {
4164 CALL_TexSubImage1D(ctx->Exec, (target, level, xoffset, width,
4165 format, type, pixels));
4170 static void GLAPIENTRY
4171 save_TexSubImage2D(GLenum target, GLint level,
4172 GLint xoffset, GLint yoffset,
4173 GLsizei width, GLsizei height,
4174 GLenum format, GLenum type, const GLvoid * pixels)
4176 GET_CURRENT_CONTEXT(ctx);
4177 Node *n;
4179 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4181 n = alloc_instruction(ctx, OPCODE_TEX_SUB_IMAGE2D, 9);
4182 if (n) {
4183 n[1].e = target;
4184 n[2].i = level;
4185 n[3].i = xoffset;
4186 n[4].i = yoffset;
4187 n[5].i = (GLint) width;
4188 n[6].i = (GLint) height;
4189 n[7].e = format;
4190 n[8].e = type;
4191 n[9].data = unpack_image(ctx, 2, width, height, 1, format, type,
4192 pixels, &ctx->Unpack);
4194 if (ctx->ExecuteFlag) {
4195 CALL_TexSubImage2D(ctx->Exec, (target, level, xoffset, yoffset,
4196 width, height, format, type, pixels));
4201 static void GLAPIENTRY
4202 save_TexSubImage3D(GLenum target, GLint level,
4203 GLint xoffset, GLint yoffset, GLint zoffset,
4204 GLsizei width, GLsizei height, GLsizei depth,
4205 GLenum format, GLenum type, const GLvoid * pixels)
4207 GET_CURRENT_CONTEXT(ctx);
4208 Node *n;
4210 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4212 n = alloc_instruction(ctx, OPCODE_TEX_SUB_IMAGE3D, 11);
4213 if (n) {
4214 n[1].e = target;
4215 n[2].i = level;
4216 n[3].i = xoffset;
4217 n[4].i = yoffset;
4218 n[5].i = zoffset;
4219 n[6].i = (GLint) width;
4220 n[7].i = (GLint) height;
4221 n[8].i = (GLint) depth;
4222 n[9].e = format;
4223 n[10].e = type;
4224 n[11].data = unpack_image(ctx, 3, width, height, depth, format, type,
4225 pixels, &ctx->Unpack);
4227 if (ctx->ExecuteFlag) {
4228 CALL_TexSubImage3D(ctx->Exec, (target, level,
4229 xoffset, yoffset, zoffset,
4230 width, height, depth, format, type,
4231 pixels));
4236 static void GLAPIENTRY
4237 save_Translatef(GLfloat x, GLfloat y, GLfloat z)
4239 GET_CURRENT_CONTEXT(ctx);
4240 Node *n;
4241 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4242 n = alloc_instruction(ctx, OPCODE_TRANSLATE, 3);
4243 if (n) {
4244 n[1].f = x;
4245 n[2].f = y;
4246 n[3].f = z;
4248 if (ctx->ExecuteFlag) {
4249 CALL_Translatef(ctx->Exec, (x, y, z));
4254 static void GLAPIENTRY
4255 save_Translated(GLdouble x, GLdouble y, GLdouble z)
4257 save_Translatef((GLfloat) x, (GLfloat) y, (GLfloat) z);
4262 static void GLAPIENTRY
4263 save_Viewport(GLint x, GLint y, GLsizei width, GLsizei height)
4265 GET_CURRENT_CONTEXT(ctx);
4266 Node *n;
4267 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4268 n = alloc_instruction(ctx, OPCODE_VIEWPORT, 4);
4269 if (n) {
4270 n[1].i = x;
4271 n[2].i = y;
4272 n[3].i = (GLint) width;
4273 n[4].i = (GLint) height;
4275 if (ctx->ExecuteFlag) {
4276 CALL_Viewport(ctx->Exec, (x, y, width, height));
4281 static void GLAPIENTRY
4282 save_WindowPos4fMESA(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
4284 GET_CURRENT_CONTEXT(ctx);
4285 Node *n;
4286 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4287 n = alloc_instruction(ctx, OPCODE_WINDOW_POS, 4);
4288 if (n) {
4289 n[1].f = x;
4290 n[2].f = y;
4291 n[3].f = z;
4292 n[4].f = w;
4294 if (ctx->ExecuteFlag) {
4295 CALL_WindowPos4fMESA(ctx->Exec, (x, y, z, w));
4299 static void GLAPIENTRY
4300 save_WindowPos2dMESA(GLdouble x, GLdouble y)
4302 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
4305 static void GLAPIENTRY
4306 save_WindowPos2fMESA(GLfloat x, GLfloat y)
4308 save_WindowPos4fMESA(x, y, 0.0F, 1.0F);
4311 static void GLAPIENTRY
4312 save_WindowPos2iMESA(GLint x, GLint y)
4314 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
4317 static void GLAPIENTRY
4318 save_WindowPos2sMESA(GLshort x, GLshort y)
4320 save_WindowPos4fMESA(x, y, 0.0F, 1.0F);
4323 static void GLAPIENTRY
4324 save_WindowPos3dMESA(GLdouble x, GLdouble y, GLdouble z)
4326 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
4329 static void GLAPIENTRY
4330 save_WindowPos3fMESA(GLfloat x, GLfloat y, GLfloat z)
4332 save_WindowPos4fMESA(x, y, z, 1.0F);
4335 static void GLAPIENTRY
4336 save_WindowPos3iMESA(GLint x, GLint y, GLint z)
4338 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
4341 static void GLAPIENTRY
4342 save_WindowPos3sMESA(GLshort x, GLshort y, GLshort z)
4344 save_WindowPos4fMESA(x, y, z, 1.0F);
4347 static void GLAPIENTRY
4348 save_WindowPos4dMESA(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
4350 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
4353 static void GLAPIENTRY
4354 save_WindowPos4iMESA(GLint x, GLint y, GLint z, GLint w)
4356 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
4359 static void GLAPIENTRY
4360 save_WindowPos4sMESA(GLshort x, GLshort y, GLshort z, GLshort w)
4362 save_WindowPos4fMESA(x, y, z, w);
4365 static void GLAPIENTRY
4366 save_WindowPos2dvMESA(const GLdouble * v)
4368 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
4371 static void GLAPIENTRY
4372 save_WindowPos2fvMESA(const GLfloat * v)
4374 save_WindowPos4fMESA(v[0], v[1], 0.0F, 1.0F);
4377 static void GLAPIENTRY
4378 save_WindowPos2ivMESA(const GLint * v)
4380 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
4383 static void GLAPIENTRY
4384 save_WindowPos2svMESA(const GLshort * v)
4386 save_WindowPos4fMESA(v[0], v[1], 0.0F, 1.0F);
4389 static void GLAPIENTRY
4390 save_WindowPos3dvMESA(const GLdouble * v)
4392 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
4395 static void GLAPIENTRY
4396 save_WindowPos3fvMESA(const GLfloat * v)
4398 save_WindowPos4fMESA(v[0], v[1], v[2], 1.0F);
4401 static void GLAPIENTRY
4402 save_WindowPos3ivMESA(const GLint * v)
4404 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
4407 static void GLAPIENTRY
4408 save_WindowPos3svMESA(const GLshort * v)
4410 save_WindowPos4fMESA(v[0], v[1], v[2], 1.0F);
4413 static void GLAPIENTRY
4414 save_WindowPos4dvMESA(const GLdouble * v)
4416 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1],
4417 (GLfloat) v[2], (GLfloat) v[3]);
4420 static void GLAPIENTRY
4421 save_WindowPos4fvMESA(const GLfloat * v)
4423 save_WindowPos4fMESA(v[0], v[1], v[2], v[3]);
4426 static void GLAPIENTRY
4427 save_WindowPos4ivMESA(const GLint * v)
4429 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1],
4430 (GLfloat) v[2], (GLfloat) v[3]);
4433 static void GLAPIENTRY
4434 save_WindowPos4svMESA(const GLshort * v)
4436 save_WindowPos4fMESA(v[0], v[1], v[2], v[3]);
4441 /* GL_ARB_multitexture */
4442 static void GLAPIENTRY
4443 save_ActiveTextureARB(GLenum target)
4445 GET_CURRENT_CONTEXT(ctx);
4446 Node *n;
4447 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4448 n = alloc_instruction(ctx, OPCODE_ACTIVE_TEXTURE, 1);
4449 if (n) {
4450 n[1].e = target;
4452 if (ctx->ExecuteFlag) {
4453 CALL_ActiveTextureARB(ctx->Exec, (target));
4458 /* GL_ARB_transpose_matrix */
4460 static void GLAPIENTRY
4461 save_LoadTransposeMatrixdARB(const GLdouble m[16])
4463 GLfloat tm[16];
4464 _math_transposefd(tm, m);
4465 save_LoadMatrixf(tm);
4469 static void GLAPIENTRY
4470 save_LoadTransposeMatrixfARB(const GLfloat m[16])
4472 GLfloat tm[16];
4473 _math_transposef(tm, m);
4474 save_LoadMatrixf(tm);
4478 static void GLAPIENTRY
4479 save_MultTransposeMatrixdARB(const GLdouble m[16])
4481 GLfloat tm[16];
4482 _math_transposefd(tm, m);
4483 save_MultMatrixf(tm);
4487 static void GLAPIENTRY
4488 save_MultTransposeMatrixfARB(const GLfloat m[16])
4490 GLfloat tm[16];
4491 _math_transposef(tm, m);
4492 save_MultMatrixf(tm);
4496 /* GL_ARB_texture_compression */
4497 static void GLAPIENTRY
4498 save_CompressedTexImage1DARB(GLenum target, GLint level,
4499 GLenum internalFormat, GLsizei width,
4500 GLint border, GLsizei imageSize,
4501 const GLvoid * data)
4503 GET_CURRENT_CONTEXT(ctx);
4504 if (target == GL_PROXY_TEXTURE_1D) {
4505 /* don't compile, execute immediately */
4506 CALL_CompressedTexImage1DARB(ctx->Exec, (target, level, internalFormat,
4507 width, border, imageSize,
4508 data));
4510 else {
4511 Node *n;
4512 GLvoid *image;
4513 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4514 /* make copy of image */
4515 image = malloc(imageSize);
4516 if (!image) {
4517 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage1DARB");
4518 return;
4520 memcpy(image, data, imageSize);
4521 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_1D, 7);
4522 if (n) {
4523 n[1].e = target;
4524 n[2].i = level;
4525 n[3].e = internalFormat;
4526 n[4].i = (GLint) width;
4527 n[5].i = border;
4528 n[6].i = imageSize;
4529 n[7].data = image;
4531 else if (image) {
4532 free(image);
4534 if (ctx->ExecuteFlag) {
4535 CALL_CompressedTexImage1DARB(ctx->Exec,
4536 (target, level, internalFormat, width,
4537 border, imageSize, data));
4543 static void GLAPIENTRY
4544 save_CompressedTexImage2DARB(GLenum target, GLint level,
4545 GLenum internalFormat, GLsizei width,
4546 GLsizei height, GLint border, GLsizei imageSize,
4547 const GLvoid * data)
4549 GET_CURRENT_CONTEXT(ctx);
4550 if (target == GL_PROXY_TEXTURE_2D) {
4551 /* don't compile, execute immediately */
4552 CALL_CompressedTexImage2DARB(ctx->Exec, (target, level, internalFormat,
4553 width, height, border,
4554 imageSize, data));
4556 else {
4557 Node *n;
4558 GLvoid *image;
4559 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4560 /* make copy of image */
4561 image = malloc(imageSize);
4562 if (!image) {
4563 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2DARB");
4564 return;
4566 memcpy(image, data, imageSize);
4567 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_2D, 8);
4568 if (n) {
4569 n[1].e = target;
4570 n[2].i = level;
4571 n[3].e = internalFormat;
4572 n[4].i = (GLint) width;
4573 n[5].i = (GLint) height;
4574 n[6].i = border;
4575 n[7].i = imageSize;
4576 n[8].data = image;
4578 else if (image) {
4579 free(image);
4581 if (ctx->ExecuteFlag) {
4582 CALL_CompressedTexImage2DARB(ctx->Exec,
4583 (target, level, internalFormat, width,
4584 height, border, imageSize, data));
4590 static void GLAPIENTRY
4591 save_CompressedTexImage3DARB(GLenum target, GLint level,
4592 GLenum internalFormat, GLsizei width,
4593 GLsizei height, GLsizei depth, GLint border,
4594 GLsizei imageSize, const GLvoid * data)
4596 GET_CURRENT_CONTEXT(ctx);
4597 if (target == GL_PROXY_TEXTURE_3D) {
4598 /* don't compile, execute immediately */
4599 CALL_CompressedTexImage3DARB(ctx->Exec, (target, level, internalFormat,
4600 width, height, depth, border,
4601 imageSize, data));
4603 else {
4604 Node *n;
4605 GLvoid *image;
4606 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4607 /* make copy of image */
4608 image = malloc(imageSize);
4609 if (!image) {
4610 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage3DARB");
4611 return;
4613 memcpy(image, data, imageSize);
4614 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_3D, 9);
4615 if (n) {
4616 n[1].e = target;
4617 n[2].i = level;
4618 n[3].e = internalFormat;
4619 n[4].i = (GLint) width;
4620 n[5].i = (GLint) height;
4621 n[6].i = (GLint) depth;
4622 n[7].i = border;
4623 n[8].i = imageSize;
4624 n[9].data = image;
4626 else if (image) {
4627 free(image);
4629 if (ctx->ExecuteFlag) {
4630 CALL_CompressedTexImage3DARB(ctx->Exec,
4631 (target, level, internalFormat, width,
4632 height, depth, border, imageSize,
4633 data));
4639 static void GLAPIENTRY
4640 save_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset,
4641 GLsizei width, GLenum format,
4642 GLsizei imageSize, const GLvoid * data)
4644 Node *n;
4645 GLvoid *image;
4647 GET_CURRENT_CONTEXT(ctx);
4648 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4650 /* make copy of image */
4651 image = malloc(imageSize);
4652 if (!image) {
4653 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage1DARB");
4654 return;
4656 memcpy(image, data, imageSize);
4657 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D, 7);
4658 if (n) {
4659 n[1].e = target;
4660 n[2].i = level;
4661 n[3].i = xoffset;
4662 n[4].i = (GLint) width;
4663 n[5].e = format;
4664 n[6].i = imageSize;
4665 n[7].data = image;
4667 else if (image) {
4668 free(image);
4670 if (ctx->ExecuteFlag) {
4671 CALL_CompressedTexSubImage1DARB(ctx->Exec, (target, level, xoffset,
4672 width, format, imageSize,
4673 data));
4678 static void GLAPIENTRY
4679 save_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset,
4680 GLint yoffset, GLsizei width, GLsizei height,
4681 GLenum format, GLsizei imageSize,
4682 const GLvoid * data)
4684 Node *n;
4685 GLvoid *image;
4687 GET_CURRENT_CONTEXT(ctx);
4688 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4690 /* make copy of image */
4691 image = malloc(imageSize);
4692 if (!image) {
4693 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage2DARB");
4694 return;
4696 memcpy(image, data, imageSize);
4697 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D, 9);
4698 if (n) {
4699 n[1].e = target;
4700 n[2].i = level;
4701 n[3].i = xoffset;
4702 n[4].i = yoffset;
4703 n[5].i = (GLint) width;
4704 n[6].i = (GLint) height;
4705 n[7].e = format;
4706 n[8].i = imageSize;
4707 n[9].data = image;
4709 else if (image) {
4710 free(image);
4712 if (ctx->ExecuteFlag) {
4713 CALL_CompressedTexSubImage2DARB(ctx->Exec,
4714 (target, level, xoffset, yoffset, width,
4715 height, format, imageSize, data));
4720 static void GLAPIENTRY
4721 save_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset,
4722 GLint yoffset, GLint zoffset, GLsizei width,
4723 GLsizei height, GLsizei depth, GLenum format,
4724 GLsizei imageSize, const GLvoid * data)
4726 Node *n;
4727 GLvoid *image;
4729 GET_CURRENT_CONTEXT(ctx);
4730 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4732 /* make copy of image */
4733 image = malloc(imageSize);
4734 if (!image) {
4735 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage3DARB");
4736 return;
4738 memcpy(image, data, imageSize);
4739 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D, 11);
4740 if (n) {
4741 n[1].e = target;
4742 n[2].i = level;
4743 n[3].i = xoffset;
4744 n[4].i = yoffset;
4745 n[5].i = zoffset;
4746 n[6].i = (GLint) width;
4747 n[7].i = (GLint) height;
4748 n[8].i = (GLint) depth;
4749 n[9].e = format;
4750 n[10].i = imageSize;
4751 n[11].data = image;
4753 else if (image) {
4754 free(image);
4756 if (ctx->ExecuteFlag) {
4757 CALL_CompressedTexSubImage3DARB(ctx->Exec,
4758 (target, level, xoffset, yoffset,
4759 zoffset, width, height, depth, format,
4760 imageSize, data));
4765 /* GL_ARB_multisample */
4766 static void GLAPIENTRY
4767 save_SampleCoverageARB(GLclampf value, GLboolean invert)
4769 GET_CURRENT_CONTEXT(ctx);
4770 Node *n;
4771 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4772 n = alloc_instruction(ctx, OPCODE_SAMPLE_COVERAGE, 2);
4773 if (n) {
4774 n[1].f = value;
4775 n[2].b = invert;
4777 if (ctx->ExecuteFlag) {
4778 CALL_SampleCoverageARB(ctx->Exec, (value, invert));
4784 * GL_NV_vertex_program
4786 #if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
4787 static void GLAPIENTRY
4788 save_BindProgramNV(GLenum target, GLuint id)
4790 GET_CURRENT_CONTEXT(ctx);
4791 Node *n;
4792 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4793 n = alloc_instruction(ctx, OPCODE_BIND_PROGRAM_NV, 2);
4794 if (n) {
4795 n[1].e = target;
4796 n[2].ui = id;
4798 if (ctx->ExecuteFlag) {
4799 CALL_BindProgramNV(ctx->Exec, (target, id));
4803 static void GLAPIENTRY
4804 save_ProgramEnvParameter4fARB(GLenum target, GLuint index,
4805 GLfloat x, GLfloat y, GLfloat z, GLfloat w)
4807 GET_CURRENT_CONTEXT(ctx);
4808 Node *n;
4809 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4810 n = alloc_instruction(ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6);
4811 if (n) {
4812 n[1].e = target;
4813 n[2].ui = index;
4814 n[3].f = x;
4815 n[4].f = y;
4816 n[5].f = z;
4817 n[6].f = w;
4819 if (ctx->ExecuteFlag) {
4820 CALL_ProgramEnvParameter4fARB(ctx->Exec, (target, index, x, y, z, w));
4825 static void GLAPIENTRY
4826 save_ProgramEnvParameter4fvARB(GLenum target, GLuint index,
4827 const GLfloat *params)
4829 save_ProgramEnvParameter4fARB(target, index, params[0], params[1],
4830 params[2], params[3]);
4834 static void GLAPIENTRY
4835 save_ProgramEnvParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
4836 const GLfloat * params)
4838 GET_CURRENT_CONTEXT(ctx);
4839 Node *n;
4840 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4842 if (count > 0) {
4843 GLint i;
4844 const GLfloat * p = params;
4846 for (i = 0 ; i < count ; i++) {
4847 n = alloc_instruction(ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6);
4848 if (n) {
4849 n[1].e = target;
4850 n[2].ui = index;
4851 n[3].f = p[0];
4852 n[4].f = p[1];
4853 n[5].f = p[2];
4854 n[6].f = p[3];
4855 p += 4;
4860 if (ctx->ExecuteFlag) {
4861 CALL_ProgramEnvParameters4fvEXT(ctx->Exec, (target, index, count, params));
4866 static void GLAPIENTRY
4867 save_ProgramEnvParameter4dARB(GLenum target, GLuint index,
4868 GLdouble x, GLdouble y, GLdouble z, GLdouble w)
4870 save_ProgramEnvParameter4fARB(target, index,
4871 (GLfloat) x,
4872 (GLfloat) y, (GLfloat) z, (GLfloat) w);
4876 static void GLAPIENTRY
4877 save_ProgramEnvParameter4dvARB(GLenum target, GLuint index,
4878 const GLdouble *params)
4880 save_ProgramEnvParameter4fARB(target, index,
4881 (GLfloat) params[0],
4882 (GLfloat) params[1],
4883 (GLfloat) params[2], (GLfloat) params[3]);
4886 #endif /* FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program || FEATURE_NV_vertex_program */
4888 #if FEATURE_NV_vertex_program
4889 static void GLAPIENTRY
4890 save_ExecuteProgramNV(GLenum target, GLuint id, const GLfloat *params)
4892 GET_CURRENT_CONTEXT(ctx);
4893 Node *n;
4894 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4895 n = alloc_instruction(ctx, OPCODE_EXECUTE_PROGRAM_NV, 6);
4896 if (n) {
4897 n[1].e = target;
4898 n[2].ui = id;
4899 n[3].f = params[0];
4900 n[4].f = params[1];
4901 n[5].f = params[2];
4902 n[6].f = params[3];
4904 if (ctx->ExecuteFlag) {
4905 CALL_ExecuteProgramNV(ctx->Exec, (target, id, params));
4910 static void GLAPIENTRY
4911 save_ProgramParameters4dvNV(GLenum target, GLuint index,
4912 GLsizei num, const GLdouble *params)
4914 GLint i;
4915 for (i = 0; i < num; i++) {
4916 save_ProgramEnvParameter4dvARB(target, index + i, params + 4 * i);
4921 static void GLAPIENTRY
4922 save_ProgramParameters4fvNV(GLenum target, GLuint index,
4923 GLsizei num, const GLfloat *params)
4925 GLint i;
4926 for (i = 0; i < num; i++) {
4927 save_ProgramEnvParameter4fvARB(target, index + i, params + 4 * i);
4932 static void GLAPIENTRY
4933 save_LoadProgramNV(GLenum target, GLuint id, GLsizei len,
4934 const GLubyte * program)
4936 GET_CURRENT_CONTEXT(ctx);
4937 Node *n;
4939 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4941 n = alloc_instruction(ctx, OPCODE_LOAD_PROGRAM_NV, 4);
4942 if (n) {
4943 GLubyte *programCopy = (GLubyte *) malloc(len);
4944 if (!programCopy) {
4945 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV");
4946 return;
4948 memcpy(programCopy, program, len);
4949 n[1].e = target;
4950 n[2].ui = id;
4951 n[3].i = len;
4952 n[4].data = programCopy;
4954 if (ctx->ExecuteFlag) {
4955 CALL_LoadProgramNV(ctx->Exec, (target, id, len, program));
4960 static void GLAPIENTRY
4961 save_RequestResidentProgramsNV(GLsizei num, const GLuint * ids)
4963 GET_CURRENT_CONTEXT(ctx);
4964 Node *n;
4966 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4968 n = alloc_instruction(ctx, OPCODE_TRACK_MATRIX_NV, 2);
4969 if (n) {
4970 GLuint *idCopy = (GLuint *) malloc(num * sizeof(GLuint));
4971 if (!idCopy) {
4972 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glRequestResidentProgramsNV");
4973 return;
4975 memcpy(idCopy, ids, num * sizeof(GLuint));
4976 n[1].i = num;
4977 n[2].data = idCopy;
4979 if (ctx->ExecuteFlag) {
4980 CALL_RequestResidentProgramsNV(ctx->Exec, (num, ids));
4985 static void GLAPIENTRY
4986 save_TrackMatrixNV(GLenum target, GLuint address,
4987 GLenum matrix, GLenum transform)
4989 GET_CURRENT_CONTEXT(ctx);
4990 Node *n;
4991 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4992 n = alloc_instruction(ctx, OPCODE_TRACK_MATRIX_NV, 4);
4993 if (n) {
4994 n[1].e = target;
4995 n[2].ui = address;
4996 n[3].e = matrix;
4997 n[4].e = transform;
4999 if (ctx->ExecuteFlag) {
5000 CALL_TrackMatrixNV(ctx->Exec, (target, address, matrix, transform));
5003 #endif /* FEATURE_NV_vertex_program */
5007 * GL_NV_fragment_program
5009 #if FEATURE_NV_fragment_program
5010 static void GLAPIENTRY
5011 save_ProgramLocalParameter4fARB(GLenum target, GLuint index,
5012 GLfloat x, GLfloat y, GLfloat z, GLfloat w)
5014 GET_CURRENT_CONTEXT(ctx);
5015 Node *n;
5016 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5017 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5018 if (n) {
5019 n[1].e = target;
5020 n[2].ui = index;
5021 n[3].f = x;
5022 n[4].f = y;
5023 n[5].f = z;
5024 n[6].f = w;
5026 if (ctx->ExecuteFlag) {
5027 CALL_ProgramLocalParameter4fARB(ctx->Exec, (target, index, x, y, z, w));
5032 static void GLAPIENTRY
5033 save_ProgramLocalParameter4fvARB(GLenum target, GLuint index,
5034 const GLfloat *params)
5036 GET_CURRENT_CONTEXT(ctx);
5037 Node *n;
5038 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5039 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5040 if (n) {
5041 n[1].e = target;
5042 n[2].ui = index;
5043 n[3].f = params[0];
5044 n[4].f = params[1];
5045 n[5].f = params[2];
5046 n[6].f = params[3];
5048 if (ctx->ExecuteFlag) {
5049 CALL_ProgramLocalParameter4fvARB(ctx->Exec, (target, index, params));
5054 static void GLAPIENTRY
5055 save_ProgramLocalParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
5056 const GLfloat *params)
5058 GET_CURRENT_CONTEXT(ctx);
5059 Node *n;
5060 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5062 if (count > 0) {
5063 GLint i;
5064 const GLfloat * p = params;
5066 for (i = 0 ; i < count ; i++) {
5067 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5068 if (n) {
5069 n[1].e = target;
5070 n[2].ui = index;
5071 n[3].f = p[0];
5072 n[4].f = p[1];
5073 n[5].f = p[2];
5074 n[6].f = p[3];
5075 p += 4;
5080 if (ctx->ExecuteFlag) {
5081 CALL_ProgramLocalParameters4fvEXT(ctx->Exec, (target, index, count, params));
5086 static void GLAPIENTRY
5087 save_ProgramLocalParameter4dARB(GLenum target, GLuint index,
5088 GLdouble x, GLdouble y,
5089 GLdouble z, GLdouble w)
5091 GET_CURRENT_CONTEXT(ctx);
5092 Node *n;
5093 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5094 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5095 if (n) {
5096 n[1].e = target;
5097 n[2].ui = index;
5098 n[3].f = (GLfloat) x;
5099 n[4].f = (GLfloat) y;
5100 n[5].f = (GLfloat) z;
5101 n[6].f = (GLfloat) w;
5103 if (ctx->ExecuteFlag) {
5104 CALL_ProgramLocalParameter4dARB(ctx->Exec, (target, index, x, y, z, w));
5109 static void GLAPIENTRY
5110 save_ProgramLocalParameter4dvARB(GLenum target, GLuint index,
5111 const GLdouble *params)
5113 GET_CURRENT_CONTEXT(ctx);
5114 Node *n;
5115 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5116 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5117 if (n) {
5118 n[1].e = target;
5119 n[2].ui = index;
5120 n[3].f = (GLfloat) params[0];
5121 n[4].f = (GLfloat) params[1];
5122 n[5].f = (GLfloat) params[2];
5123 n[6].f = (GLfloat) params[3];
5125 if (ctx->ExecuteFlag) {
5126 CALL_ProgramLocalParameter4dvARB(ctx->Exec, (target, index, params));
5130 static void GLAPIENTRY
5131 save_ProgramNamedParameter4fNV(GLuint id, GLsizei len, const GLubyte * name,
5132 GLfloat x, GLfloat y, GLfloat z, GLfloat w)
5134 GET_CURRENT_CONTEXT(ctx);
5135 Node *n;
5137 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5139 n = alloc_instruction(ctx, OPCODE_PROGRAM_NAMED_PARAMETER_NV, 6);
5140 if (n) {
5141 GLubyte *nameCopy = (GLubyte *) malloc(len);
5142 if (!nameCopy) {
5143 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramNamedParameter4fNV");
5144 return;
5146 memcpy(nameCopy, name, len);
5147 n[1].ui = id;
5148 n[2].i = len;
5149 n[3].data = nameCopy;
5150 n[4].f = x;
5151 n[5].f = y;
5152 n[6].f = z;
5153 n[7].f = w;
5155 if (ctx->ExecuteFlag) {
5156 CALL_ProgramNamedParameter4fNV(ctx->Exec, (id, len, name, x, y, z, w));
5161 static void GLAPIENTRY
5162 save_ProgramNamedParameter4fvNV(GLuint id, GLsizei len, const GLubyte * name,
5163 const float v[])
5165 save_ProgramNamedParameter4fNV(id, len, name, v[0], v[1], v[2], v[3]);
5169 static void GLAPIENTRY
5170 save_ProgramNamedParameter4dNV(GLuint id, GLsizei len, const GLubyte * name,
5171 GLdouble x, GLdouble y, GLdouble z, GLdouble w)
5173 save_ProgramNamedParameter4fNV(id, len, name, (GLfloat) x, (GLfloat) y,
5174 (GLfloat) z, (GLfloat) w);
5178 static void GLAPIENTRY
5179 save_ProgramNamedParameter4dvNV(GLuint id, GLsizei len, const GLubyte * name,
5180 const double v[])
5182 save_ProgramNamedParameter4fNV(id, len, name, (GLfloat) v[0],
5183 (GLfloat) v[1], (GLfloat) v[2],
5184 (GLfloat) v[3]);
5187 #endif /* FEATURE_NV_fragment_program */
5191 /* GL_EXT_stencil_two_side */
5192 static void GLAPIENTRY
5193 save_ActiveStencilFaceEXT(GLenum face)
5195 GET_CURRENT_CONTEXT(ctx);
5196 Node *n;
5197 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5198 n = alloc_instruction(ctx, OPCODE_ACTIVE_STENCIL_FACE_EXT, 1);
5199 if (n) {
5200 n[1].e = face;
5202 if (ctx->ExecuteFlag) {
5203 CALL_ActiveStencilFaceEXT(ctx->Exec, (face));
5208 /* GL_EXT_depth_bounds_test */
5209 static void GLAPIENTRY
5210 save_DepthBoundsEXT(GLclampd zmin, GLclampd zmax)
5212 GET_CURRENT_CONTEXT(ctx);
5213 Node *n;
5214 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5215 n = alloc_instruction(ctx, OPCODE_DEPTH_BOUNDS_EXT, 2);
5216 if (n) {
5217 n[1].f = (GLfloat) zmin;
5218 n[2].f = (GLfloat) zmax;
5220 if (ctx->ExecuteFlag) {
5221 CALL_DepthBoundsEXT(ctx->Exec, (zmin, zmax));
5227 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
5229 static void GLAPIENTRY
5230 save_ProgramStringARB(GLenum target, GLenum format, GLsizei len,
5231 const GLvoid * string)
5233 GET_CURRENT_CONTEXT(ctx);
5234 Node *n;
5236 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5238 n = alloc_instruction(ctx, OPCODE_PROGRAM_STRING_ARB, 4);
5239 if (n) {
5240 GLubyte *programCopy = (GLubyte *) malloc(len);
5241 if (!programCopy) {
5242 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramStringARB");
5243 return;
5245 memcpy(programCopy, string, len);
5246 n[1].e = target;
5247 n[2].e = format;
5248 n[3].i = len;
5249 n[4].data = programCopy;
5251 if (ctx->ExecuteFlag) {
5252 CALL_ProgramStringARB(ctx->Exec, (target, format, len, string));
5256 #endif /* FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program */
5259 #if FEATURE_queryobj
5261 static void GLAPIENTRY
5262 save_BeginQueryARB(GLenum target, GLuint id)
5264 GET_CURRENT_CONTEXT(ctx);
5265 Node *n;
5266 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5267 n = alloc_instruction(ctx, OPCODE_BEGIN_QUERY_ARB, 2);
5268 if (n) {
5269 n[1].e = target;
5270 n[2].ui = id;
5272 if (ctx->ExecuteFlag) {
5273 CALL_BeginQueryARB(ctx->Exec, (target, id));
5278 static void GLAPIENTRY
5279 save_EndQueryARB(GLenum target)
5281 GET_CURRENT_CONTEXT(ctx);
5282 Node *n;
5283 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5284 n = alloc_instruction(ctx, OPCODE_END_QUERY_ARB, 1);
5285 if (n) {
5286 n[1].e = target;
5288 if (ctx->ExecuteFlag) {
5289 CALL_EndQueryARB(ctx->Exec, (target));
5293 #endif /* FEATURE_queryobj */
5296 static void GLAPIENTRY
5297 save_DrawBuffersARB(GLsizei count, const GLenum * buffers)
5299 GET_CURRENT_CONTEXT(ctx);
5300 Node *n;
5301 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5302 n = alloc_instruction(ctx, OPCODE_DRAW_BUFFERS_ARB, 1 + MAX_DRAW_BUFFERS);
5303 if (n) {
5304 GLint i;
5305 n[1].i = count;
5306 if (count > MAX_DRAW_BUFFERS)
5307 count = MAX_DRAW_BUFFERS;
5308 for (i = 0; i < count; i++) {
5309 n[2 + i].e = buffers[i];
5312 if (ctx->ExecuteFlag) {
5313 CALL_DrawBuffersARB(ctx->Exec, (count, buffers));
5317 static void GLAPIENTRY
5318 save_TexBumpParameterfvATI(GLenum pname, const GLfloat *param)
5320 GET_CURRENT_CONTEXT(ctx);
5321 Node *n;
5323 n = alloc_instruction(ctx, OPCODE_TEX_BUMP_PARAMETER_ATI, 5);
5324 if (n) {
5325 n[1].ui = pname;
5326 n[2].f = param[0];
5327 n[3].f = param[1];
5328 n[4].f = param[2];
5329 n[5].f = param[3];
5331 if (ctx->ExecuteFlag) {
5332 CALL_TexBumpParameterfvATI(ctx->Exec, (pname, param));
5336 static void GLAPIENTRY
5337 save_TexBumpParameterivATI(GLenum pname, const GLint *param)
5339 GLfloat p[4];
5340 p[0] = INT_TO_FLOAT(param[0]);
5341 p[1] = INT_TO_FLOAT(param[1]);
5342 p[2] = INT_TO_FLOAT(param[2]);
5343 p[3] = INT_TO_FLOAT(param[3]);
5344 save_TexBumpParameterfvATI(pname, p);
5347 #if FEATURE_ATI_fragment_shader
5348 static void GLAPIENTRY
5349 save_BindFragmentShaderATI(GLuint id)
5351 GET_CURRENT_CONTEXT(ctx);
5352 Node *n;
5354 n = alloc_instruction(ctx, OPCODE_BIND_FRAGMENT_SHADER_ATI, 1);
5355 if (n) {
5356 n[1].ui = id;
5358 if (ctx->ExecuteFlag) {
5359 CALL_BindFragmentShaderATI(ctx->Exec, (id));
5363 static void GLAPIENTRY
5364 save_SetFragmentShaderConstantATI(GLuint dst, const GLfloat *value)
5366 GET_CURRENT_CONTEXT(ctx);
5367 Node *n;
5369 n = alloc_instruction(ctx, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI, 5);
5370 if (n) {
5371 n[1].ui = dst;
5372 n[2].f = value[0];
5373 n[3].f = value[1];
5374 n[4].f = value[2];
5375 n[5].f = value[3];
5377 if (ctx->ExecuteFlag) {
5378 CALL_SetFragmentShaderConstantATI(ctx->Exec, (dst, value));
5381 #endif
5383 static void GLAPIENTRY
5384 save_Attr1fNV(GLenum attr, GLfloat x)
5386 GET_CURRENT_CONTEXT(ctx);
5387 Node *n;
5388 SAVE_FLUSH_VERTICES(ctx);
5389 n = alloc_instruction(ctx, OPCODE_ATTR_1F_NV, 2);
5390 if (n) {
5391 n[1].e = attr;
5392 n[2].f = x;
5395 ASSERT(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5396 ctx->ListState.ActiveAttribSize[attr] = 1;
5397 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, 0, 0, 1);
5399 if (ctx->ExecuteFlag) {
5400 CALL_VertexAttrib1fNV(ctx->Exec, (attr, x));
5404 static void GLAPIENTRY
5405 save_Attr2fNV(GLenum attr, GLfloat x, GLfloat y)
5407 GET_CURRENT_CONTEXT(ctx);
5408 Node *n;
5409 SAVE_FLUSH_VERTICES(ctx);
5410 n = alloc_instruction(ctx, OPCODE_ATTR_2F_NV, 3);
5411 if (n) {
5412 n[1].e = attr;
5413 n[2].f = x;
5414 n[3].f = y;
5417 ASSERT(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5418 ctx->ListState.ActiveAttribSize[attr] = 2;
5419 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, 0, 1);
5421 if (ctx->ExecuteFlag) {
5422 CALL_VertexAttrib2fNV(ctx->Exec, (attr, x, y));
5426 static void GLAPIENTRY
5427 save_Attr3fNV(GLenum attr, GLfloat x, GLfloat y, GLfloat z)
5429 GET_CURRENT_CONTEXT(ctx);
5430 Node *n;
5431 SAVE_FLUSH_VERTICES(ctx);
5432 n = alloc_instruction(ctx, OPCODE_ATTR_3F_NV, 4);
5433 if (n) {
5434 n[1].e = attr;
5435 n[2].f = x;
5436 n[3].f = y;
5437 n[4].f = z;
5440 ASSERT(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5441 ctx->ListState.ActiveAttribSize[attr] = 3;
5442 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, 1);
5444 if (ctx->ExecuteFlag) {
5445 CALL_VertexAttrib3fNV(ctx->Exec, (attr, x, y, z));
5449 static void GLAPIENTRY
5450 save_Attr4fNV(GLenum attr, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
5452 GET_CURRENT_CONTEXT(ctx);
5453 Node *n;
5454 SAVE_FLUSH_VERTICES(ctx);
5455 n = alloc_instruction(ctx, OPCODE_ATTR_4F_NV, 5);
5456 if (n) {
5457 n[1].e = attr;
5458 n[2].f = x;
5459 n[3].f = y;
5460 n[4].f = z;
5461 n[5].f = w;
5464 ASSERT(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5465 ctx->ListState.ActiveAttribSize[attr] = 4;
5466 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, w);
5468 if (ctx->ExecuteFlag) {
5469 CALL_VertexAttrib4fNV(ctx->Exec, (attr, x, y, z, w));
5474 static void GLAPIENTRY
5475 save_Attr1fARB(GLenum attr, GLfloat x)
5477 GET_CURRENT_CONTEXT(ctx);
5478 Node *n;
5479 SAVE_FLUSH_VERTICES(ctx);
5480 n = alloc_instruction(ctx, OPCODE_ATTR_1F_ARB, 2);
5481 if (n) {
5482 n[1].e = attr;
5483 n[2].f = x;
5486 ASSERT(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5487 ctx->ListState.ActiveAttribSize[attr] = 1;
5488 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, 0, 0, 1);
5490 if (ctx->ExecuteFlag) {
5491 CALL_VertexAttrib1fARB(ctx->Exec, (attr, x));
5495 static void GLAPIENTRY
5496 save_Attr2fARB(GLenum attr, GLfloat x, GLfloat y)
5498 GET_CURRENT_CONTEXT(ctx);
5499 Node *n;
5500 SAVE_FLUSH_VERTICES(ctx);
5501 n = alloc_instruction(ctx, OPCODE_ATTR_2F_ARB, 3);
5502 if (n) {
5503 n[1].e = attr;
5504 n[2].f = x;
5505 n[3].f = y;
5508 ASSERT(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5509 ctx->ListState.ActiveAttribSize[attr] = 2;
5510 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, 0, 1);
5512 if (ctx->ExecuteFlag) {
5513 CALL_VertexAttrib2fARB(ctx->Exec, (attr, x, y));
5517 static void GLAPIENTRY
5518 save_Attr3fARB(GLenum attr, GLfloat x, GLfloat y, GLfloat z)
5520 GET_CURRENT_CONTEXT(ctx);
5521 Node *n;
5522 SAVE_FLUSH_VERTICES(ctx);
5523 n = alloc_instruction(ctx, OPCODE_ATTR_3F_ARB, 4);
5524 if (n) {
5525 n[1].e = attr;
5526 n[2].f = x;
5527 n[3].f = y;
5528 n[4].f = z;
5531 ASSERT(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5532 ctx->ListState.ActiveAttribSize[attr] = 3;
5533 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, 1);
5535 if (ctx->ExecuteFlag) {
5536 CALL_VertexAttrib3fARB(ctx->Exec, (attr, x, y, z));
5540 static void GLAPIENTRY
5541 save_Attr4fARB(GLenum attr, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
5543 GET_CURRENT_CONTEXT(ctx);
5544 Node *n;
5545 SAVE_FLUSH_VERTICES(ctx);
5546 n = alloc_instruction(ctx, OPCODE_ATTR_4F_ARB, 5);
5547 if (n) {
5548 n[1].e = attr;
5549 n[2].f = x;
5550 n[3].f = y;
5551 n[4].f = z;
5552 n[5].f = w;
5555 ASSERT(attr < MAX_VERTEX_GENERIC_ATTRIBS);
5556 ctx->ListState.ActiveAttribSize[attr] = 4;
5557 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, w);
5559 if (ctx->ExecuteFlag) {
5560 CALL_VertexAttrib4fARB(ctx->Exec, (attr, x, y, z, w));
5565 static void GLAPIENTRY
5566 save_EvalCoord1f(GLfloat x)
5568 GET_CURRENT_CONTEXT(ctx);
5569 Node *n;
5570 SAVE_FLUSH_VERTICES(ctx);
5571 n = alloc_instruction(ctx, OPCODE_EVAL_C1, 1);
5572 if (n) {
5573 n[1].f = x;
5575 if (ctx->ExecuteFlag) {
5576 CALL_EvalCoord1f(ctx->Exec, (x));
5580 static void GLAPIENTRY
5581 save_EvalCoord1fv(const GLfloat * v)
5583 save_EvalCoord1f(v[0]);
5586 static void GLAPIENTRY
5587 save_EvalCoord2f(GLfloat x, GLfloat y)
5589 GET_CURRENT_CONTEXT(ctx);
5590 Node *n;
5591 SAVE_FLUSH_VERTICES(ctx);
5592 n = alloc_instruction(ctx, OPCODE_EVAL_C2, 2);
5593 if (n) {
5594 n[1].f = x;
5595 n[2].f = y;
5597 if (ctx->ExecuteFlag) {
5598 CALL_EvalCoord2f(ctx->Exec, (x, y));
5602 static void GLAPIENTRY
5603 save_EvalCoord2fv(const GLfloat * v)
5605 save_EvalCoord2f(v[0], v[1]);
5609 static void GLAPIENTRY
5610 save_EvalPoint1(GLint x)
5612 GET_CURRENT_CONTEXT(ctx);
5613 Node *n;
5614 SAVE_FLUSH_VERTICES(ctx);
5615 n = alloc_instruction(ctx, OPCODE_EVAL_P1, 1);
5616 if (n) {
5617 n[1].i = x;
5619 if (ctx->ExecuteFlag) {
5620 CALL_EvalPoint1(ctx->Exec, (x));
5624 static void GLAPIENTRY
5625 save_EvalPoint2(GLint x, GLint y)
5627 GET_CURRENT_CONTEXT(ctx);
5628 Node *n;
5629 SAVE_FLUSH_VERTICES(ctx);
5630 n = alloc_instruction(ctx, OPCODE_EVAL_P2, 2);
5631 if (n) {
5632 n[1].i = x;
5633 n[2].i = y;
5635 if (ctx->ExecuteFlag) {
5636 CALL_EvalPoint2(ctx->Exec, (x, y));
5640 static void GLAPIENTRY
5641 save_Indexf(GLfloat x)
5643 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX, x);
5646 static void GLAPIENTRY
5647 save_Indexfv(const GLfloat * v)
5649 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX, v[0]);
5652 static void GLAPIENTRY
5653 save_EdgeFlag(GLboolean x)
5655 save_Attr1fNV(VERT_ATTRIB_EDGEFLAG, x ? (GLfloat)1.0 : (GLfloat)0.0);
5658 static INLINE GLboolean compare4fv( const GLfloat *a,
5659 const GLfloat *b,
5660 GLuint count )
5662 return memcmp( a, b, count * sizeof(GLfloat) ) == 0;
5666 static void GLAPIENTRY
5667 save_Materialfv(GLenum face, GLenum pname, const GLfloat * param)
5669 GET_CURRENT_CONTEXT(ctx);
5670 Node *n;
5671 int args, i;
5672 GLuint bitmask;
5674 switch (face) {
5675 case GL_BACK:
5676 case GL_FRONT:
5677 case GL_FRONT_AND_BACK:
5678 break;
5679 default:
5680 _mesa_compile_error(ctx, GL_INVALID_ENUM, "material(face)");
5681 return;
5684 switch (pname) {
5685 case GL_EMISSION:
5686 case GL_AMBIENT:
5687 case GL_DIFFUSE:
5688 case GL_SPECULAR:
5689 case GL_AMBIENT_AND_DIFFUSE:
5690 args = 4;
5691 break;
5692 case GL_SHININESS:
5693 args = 1;
5694 break;
5695 case GL_COLOR_INDEXES:
5696 args = 3;
5697 break;
5698 default:
5699 _mesa_compile_error(ctx, GL_INVALID_ENUM, "material(pname)");
5700 return;
5703 if (ctx->ExecuteFlag) {
5704 CALL_Materialfv(ctx->Exec, (face, pname, param));
5707 bitmask = _mesa_material_bitmask(ctx, face, pname, ~0, NULL);
5709 /* Try to eliminate redundant statechanges. Because it is legal to
5710 * call glMaterial even inside begin/end calls, don't need to worry
5711 * about ctx->Driver.CurrentSavePrimitive here.
5713 for (i = 0; i < MAT_ATTRIB_MAX; i++) {
5714 if (bitmask & (1 << i)) {
5715 if (ctx->ListState.ActiveMaterialSize[i] == args &&
5716 compare4fv(ctx->ListState.CurrentMaterial[i], param, args)) {
5717 bitmask &= ~(1 << i);
5719 else {
5720 ctx->ListState.ActiveMaterialSize[i] = args;
5721 COPY_SZ_4V(ctx->ListState.CurrentMaterial[i], args, param);
5726 /* If this call has effect, return early:
5728 if (bitmask == 0)
5729 return;
5731 SAVE_FLUSH_VERTICES(ctx);
5733 n = alloc_instruction(ctx, OPCODE_MATERIAL, 6);
5734 if (n) {
5735 n[1].e = face;
5736 n[2].e = pname;
5737 for (i = 0; i < args; i++)
5738 n[3 + i].f = param[i];
5742 static void GLAPIENTRY
5743 save_Begin(GLenum mode)
5745 GET_CURRENT_CONTEXT(ctx);
5746 Node *n;
5747 GLboolean error = GL_FALSE;
5749 if ( /*mode < GL_POINTS || */ mode > GL_POLYGON) {
5750 _mesa_compile_error(ctx, GL_INVALID_ENUM, "Begin (mode)");
5751 error = GL_TRUE;
5753 else if (ctx->Driver.CurrentSavePrimitive == PRIM_UNKNOWN) {
5754 /* Typically the first begin. This may raise an error on
5755 * playback, depending on whether CallList is issued from inside
5756 * a begin/end or not.
5758 ctx->Driver.CurrentSavePrimitive = PRIM_INSIDE_UNKNOWN_PRIM;
5760 else if (ctx->Driver.CurrentSavePrimitive == PRIM_OUTSIDE_BEGIN_END) {
5761 ctx->Driver.CurrentSavePrimitive = mode;
5763 else {
5764 _mesa_compile_error(ctx, GL_INVALID_OPERATION, "recursive begin");
5765 error = GL_TRUE;
5768 if (!error) {
5769 /* Give the driver an opportunity to hook in an optimized
5770 * display list compiler.
5772 if (ctx->Driver.NotifySaveBegin(ctx, mode))
5773 return;
5775 SAVE_FLUSH_VERTICES(ctx);
5776 n = alloc_instruction(ctx, OPCODE_BEGIN, 1);
5777 if (n) {
5778 n[1].e = mode;
5782 if (ctx->ExecuteFlag) {
5783 CALL_Begin(ctx->Exec, (mode));
5787 static void GLAPIENTRY
5788 save_End(void)
5790 GET_CURRENT_CONTEXT(ctx);
5791 SAVE_FLUSH_VERTICES(ctx);
5792 (void) alloc_instruction(ctx, OPCODE_END, 0);
5793 ctx->Driver.CurrentSavePrimitive = PRIM_OUTSIDE_BEGIN_END;
5794 if (ctx->ExecuteFlag) {
5795 CALL_End(ctx->Exec, ());
5799 static void GLAPIENTRY
5800 save_Rectf(GLfloat a, GLfloat b, GLfloat c, GLfloat d)
5802 GET_CURRENT_CONTEXT(ctx);
5803 Node *n;
5804 SAVE_FLUSH_VERTICES(ctx);
5805 n = alloc_instruction(ctx, OPCODE_RECTF, 4);
5806 if (n) {
5807 n[1].f = a;
5808 n[2].f = b;
5809 n[3].f = c;
5810 n[4].f = d;
5812 if (ctx->ExecuteFlag) {
5813 CALL_Rectf(ctx->Exec, (a, b, c, d));
5818 static void GLAPIENTRY
5819 save_Vertex2f(GLfloat x, GLfloat y)
5821 save_Attr2fNV(VERT_ATTRIB_POS, x, y);
5824 static void GLAPIENTRY
5825 save_Vertex2fv(const GLfloat * v)
5827 save_Attr2fNV(VERT_ATTRIB_POS, v[0], v[1]);
5830 static void GLAPIENTRY
5831 save_Vertex3f(GLfloat x, GLfloat y, GLfloat z)
5833 save_Attr3fNV(VERT_ATTRIB_POS, x, y, z);
5836 static void GLAPIENTRY
5837 save_Vertex3fv(const GLfloat * v)
5839 save_Attr3fNV(VERT_ATTRIB_POS, v[0], v[1], v[2]);
5842 static void GLAPIENTRY
5843 save_Vertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
5845 save_Attr4fNV(VERT_ATTRIB_POS, x, y, z, w);
5848 static void GLAPIENTRY
5849 save_Vertex4fv(const GLfloat * v)
5851 save_Attr4fNV(VERT_ATTRIB_POS, v[0], v[1], v[2], v[3]);
5854 static void GLAPIENTRY
5855 save_TexCoord1f(GLfloat x)
5857 save_Attr1fNV(VERT_ATTRIB_TEX0, x);
5860 static void GLAPIENTRY
5861 save_TexCoord1fv(const GLfloat * v)
5863 save_Attr1fNV(VERT_ATTRIB_TEX0, v[0]);
5866 static void GLAPIENTRY
5867 save_TexCoord2f(GLfloat x, GLfloat y)
5869 save_Attr2fNV(VERT_ATTRIB_TEX0, x, y);
5872 static void GLAPIENTRY
5873 save_TexCoord2fv(const GLfloat * v)
5875 save_Attr2fNV(VERT_ATTRIB_TEX0, v[0], v[1]);
5878 static void GLAPIENTRY
5879 save_TexCoord3f(GLfloat x, GLfloat y, GLfloat z)
5881 save_Attr3fNV(VERT_ATTRIB_TEX0, x, y, z);
5884 static void GLAPIENTRY
5885 save_TexCoord3fv(const GLfloat * v)
5887 save_Attr3fNV(VERT_ATTRIB_TEX0, v[0], v[1], v[2]);
5890 static void GLAPIENTRY
5891 save_TexCoord4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
5893 save_Attr4fNV(VERT_ATTRIB_TEX0, x, y, z, w);
5896 static void GLAPIENTRY
5897 save_TexCoord4fv(const GLfloat * v)
5899 save_Attr4fNV(VERT_ATTRIB_TEX0, v[0], v[1], v[2], v[3]);
5902 static void GLAPIENTRY
5903 save_Normal3f(GLfloat x, GLfloat y, GLfloat z)
5905 save_Attr3fNV(VERT_ATTRIB_NORMAL, x, y, z);
5908 static void GLAPIENTRY
5909 save_Normal3fv(const GLfloat * v)
5911 save_Attr3fNV(VERT_ATTRIB_NORMAL, v[0], v[1], v[2]);
5914 static void GLAPIENTRY
5915 save_FogCoordfEXT(GLfloat x)
5917 save_Attr1fNV(VERT_ATTRIB_FOG, x);
5920 static void GLAPIENTRY
5921 save_FogCoordfvEXT(const GLfloat * v)
5923 save_Attr1fNV(VERT_ATTRIB_FOG, v[0]);
5926 static void GLAPIENTRY
5927 save_Color3f(GLfloat x, GLfloat y, GLfloat z)
5929 save_Attr3fNV(VERT_ATTRIB_COLOR0, x, y, z);
5932 static void GLAPIENTRY
5933 save_Color3fv(const GLfloat * v)
5935 save_Attr3fNV(VERT_ATTRIB_COLOR0, v[0], v[1], v[2]);
5938 static void GLAPIENTRY
5939 save_Color4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
5941 save_Attr4fNV(VERT_ATTRIB_COLOR0, x, y, z, w);
5944 static void GLAPIENTRY
5945 save_Color4fv(const GLfloat * v)
5947 save_Attr4fNV(VERT_ATTRIB_COLOR0, v[0], v[1], v[2], v[3]);
5950 static void GLAPIENTRY
5951 save_SecondaryColor3fEXT(GLfloat x, GLfloat y, GLfloat z)
5953 save_Attr3fNV(VERT_ATTRIB_COLOR1, x, y, z);
5956 static void GLAPIENTRY
5957 save_SecondaryColor3fvEXT(const GLfloat * v)
5959 save_Attr3fNV(VERT_ATTRIB_COLOR1, v[0], v[1], v[2]);
5963 /* Just call the respective ATTR for texcoord
5965 static void GLAPIENTRY
5966 save_MultiTexCoord1f(GLenum target, GLfloat x)
5968 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
5969 save_Attr1fNV(attr, x);
5972 static void GLAPIENTRY
5973 save_MultiTexCoord1fv(GLenum target, const GLfloat * v)
5975 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
5976 save_Attr1fNV(attr, v[0]);
5979 static void GLAPIENTRY
5980 save_MultiTexCoord2f(GLenum target, GLfloat x, GLfloat y)
5982 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
5983 save_Attr2fNV(attr, x, y);
5986 static void GLAPIENTRY
5987 save_MultiTexCoord2fv(GLenum target, const GLfloat * v)
5989 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
5990 save_Attr2fNV(attr, v[0], v[1]);
5993 static void GLAPIENTRY
5994 save_MultiTexCoord3f(GLenum target, GLfloat x, GLfloat y, GLfloat z)
5996 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
5997 save_Attr3fNV(attr, x, y, z);
6000 static void GLAPIENTRY
6001 save_MultiTexCoord3fv(GLenum target, const GLfloat * v)
6003 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6004 save_Attr3fNV(attr, v[0], v[1], v[2]);
6007 static void GLAPIENTRY
6008 save_MultiTexCoord4f(GLenum target, GLfloat x, GLfloat y,
6009 GLfloat z, GLfloat w)
6011 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6012 save_Attr4fNV(attr, x, y, z, w);
6015 static void GLAPIENTRY
6016 save_MultiTexCoord4fv(GLenum target, const GLfloat * v)
6018 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
6019 save_Attr4fNV(attr, v[0], v[1], v[2], v[3]);
6024 * Record a GL_INVALID_VALUE error when a invalid vertex attribute
6025 * index is found.
6027 static void
6028 index_error(void)
6030 GET_CURRENT_CONTEXT(ctx);
6031 _mesa_error(ctx, GL_INVALID_VALUE, "VertexAttribf(index)");
6035 /* First level for NV_vertex_program:
6037 * Check for errors at compile time?.
6039 static void GLAPIENTRY
6040 save_VertexAttrib1fNV(GLuint index, GLfloat x)
6042 if (index < MAX_NV_VERTEX_PROGRAM_INPUTS)
6043 save_Attr1fNV(index, x);
6044 else
6045 index_error();
6048 static void GLAPIENTRY
6049 save_VertexAttrib1fvNV(GLuint index, const GLfloat * v)
6051 if (index < MAX_NV_VERTEX_PROGRAM_INPUTS)
6052 save_Attr1fNV(index, v[0]);
6053 else
6054 index_error();
6057 static void GLAPIENTRY
6058 save_VertexAttrib2fNV(GLuint index, GLfloat x, GLfloat y)
6060 if (index < MAX_NV_VERTEX_PROGRAM_INPUTS)
6061 save_Attr2fNV(index, x, y);
6062 else
6063 index_error();
6066 static void GLAPIENTRY
6067 save_VertexAttrib2fvNV(GLuint index, const GLfloat * v)
6069 if (index < MAX_NV_VERTEX_PROGRAM_INPUTS)
6070 save_Attr2fNV(index, v[0], v[1]);
6071 else
6072 index_error();
6075 static void GLAPIENTRY
6076 save_VertexAttrib3fNV(GLuint index, GLfloat x, GLfloat y, GLfloat z)
6078 if (index < MAX_NV_VERTEX_PROGRAM_INPUTS)
6079 save_Attr3fNV(index, x, y, z);
6080 else
6081 index_error();
6084 static void GLAPIENTRY
6085 save_VertexAttrib3fvNV(GLuint index, const GLfloat * v)
6087 if (index < MAX_NV_VERTEX_PROGRAM_INPUTS)
6088 save_Attr3fNV(index, v[0], v[1], v[2]);
6089 else
6090 index_error();
6093 static void GLAPIENTRY
6094 save_VertexAttrib4fNV(GLuint index, GLfloat x, GLfloat y,
6095 GLfloat z, GLfloat w)
6097 if (index < MAX_NV_VERTEX_PROGRAM_INPUTS)
6098 save_Attr4fNV(index, x, y, z, w);
6099 else
6100 index_error();
6103 static void GLAPIENTRY
6104 save_VertexAttrib4fvNV(GLuint index, const GLfloat * v)
6106 if (index < MAX_NV_VERTEX_PROGRAM_INPUTS)
6107 save_Attr4fNV(index, v[0], v[1], v[2], v[3]);
6108 else
6109 index_error();
6115 static void GLAPIENTRY
6116 save_VertexAttrib1fARB(GLuint index, GLfloat x)
6118 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6119 save_Attr1fARB(index, x);
6120 else
6121 index_error();
6124 static void GLAPIENTRY
6125 save_VertexAttrib1fvARB(GLuint index, const GLfloat * v)
6127 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6128 save_Attr1fARB(index, v[0]);
6129 else
6130 index_error();
6133 static void GLAPIENTRY
6134 save_VertexAttrib2fARB(GLuint index, GLfloat x, GLfloat y)
6136 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6137 save_Attr2fARB(index, x, y);
6138 else
6139 index_error();
6142 static void GLAPIENTRY
6143 save_VertexAttrib2fvARB(GLuint index, const GLfloat * v)
6145 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6146 save_Attr2fARB(index, v[0], v[1]);
6147 else
6148 index_error();
6151 static void GLAPIENTRY
6152 save_VertexAttrib3fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z)
6154 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6155 save_Attr3fARB(index, x, y, z);
6156 else
6157 index_error();
6160 static void GLAPIENTRY
6161 save_VertexAttrib3fvARB(GLuint index, const GLfloat * v)
6163 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6164 save_Attr3fARB(index, v[0], v[1], v[2]);
6165 else
6166 index_error();
6169 static void GLAPIENTRY
6170 save_VertexAttrib4fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z,
6171 GLfloat w)
6173 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6174 save_Attr4fARB(index, x, y, z, w);
6175 else
6176 index_error();
6179 static void GLAPIENTRY
6180 save_VertexAttrib4fvARB(GLuint index, const GLfloat * v)
6182 if (index < MAX_VERTEX_GENERIC_ATTRIBS)
6183 save_Attr4fARB(index, v[0], v[1], v[2], v[3]);
6184 else
6185 index_error();
6189 /* GL_ARB_shader_objects, GL_ARB_vertex/fragment_shader */
6191 static void GLAPIENTRY
6192 exec_BindAttribLocationARB(GLuint program, GLuint index, const GLchar *name)
6194 GET_CURRENT_CONTEXT(ctx);
6195 FLUSH_VERTICES(ctx, 0);
6196 CALL_BindAttribLocationARB(ctx->Exec, (program, index, name));
6199 static GLint GLAPIENTRY
6200 exec_GetAttribLocationARB(GLuint program, const GLchar *name)
6202 GET_CURRENT_CONTEXT(ctx);
6203 FLUSH_VERTICES(ctx, 0);
6204 return CALL_GetAttribLocationARB(ctx->Exec, (program, name));
6207 static GLint GLAPIENTRY
6208 exec_GetUniformLocationARB(GLuint program, const GLchar *name)
6210 GET_CURRENT_CONTEXT(ctx);
6211 FLUSH_VERTICES(ctx, 0);
6212 return CALL_GetUniformLocationARB(ctx->Exec, (program, name));
6214 /* XXX more shader functions needed here */
6217 #if FEATURE_EXT_framebuffer_blit
6218 static void GLAPIENTRY
6219 save_BlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
6220 GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
6221 GLbitfield mask, GLenum filter)
6223 GET_CURRENT_CONTEXT(ctx);
6224 Node *n;
6225 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6226 n = alloc_instruction(ctx, OPCODE_BLIT_FRAMEBUFFER, 10);
6227 if (n) {
6228 n[1].i = srcX0;
6229 n[2].i = srcY0;
6230 n[3].i = srcX1;
6231 n[4].i = srcY1;
6232 n[5].i = dstX0;
6233 n[6].i = dstY0;
6234 n[7].i = dstX1;
6235 n[8].i = dstY1;
6236 n[9].i = mask;
6237 n[10].e = filter;
6239 if (ctx->ExecuteFlag) {
6240 CALL_BlitFramebufferEXT(ctx->Exec, (srcX0, srcY0, srcX1, srcY1,
6241 dstX0, dstY0, dstX1, dstY1,
6242 mask, filter));
6245 #endif
6248 /** GL_EXT_provoking_vertex */
6249 static void GLAPIENTRY
6250 save_ProvokingVertexEXT(GLenum mode)
6252 GET_CURRENT_CONTEXT(ctx);
6253 Node *n;
6254 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6255 n = alloc_instruction(ctx, OPCODE_PROVOKING_VERTEX, 1);
6256 if (n) {
6257 n[1].e = mode;
6259 if (ctx->ExecuteFlag) {
6260 /*CALL_ProvokingVertexEXT(ctx->Exec, (mode));*/
6261 _mesa_ProvokingVertexEXT(mode);
6266 /** GL_EXT_transform_feedback */
6267 static void GLAPIENTRY
6268 save_BeginTransformFeedback(GLenum mode)
6270 GET_CURRENT_CONTEXT(ctx);
6271 Node *n;
6272 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6273 n = alloc_instruction(ctx, OPCODE_BEGIN_TRANSFORM_FEEDBACK, 1);
6274 if (n) {
6275 n[1].e = mode;
6277 if (ctx->ExecuteFlag) {
6278 CALL_BeginTransformFeedbackEXT(ctx->Exec, (mode));
6283 /** GL_EXT_transform_feedback */
6284 static void GLAPIENTRY
6285 save_EndTransformFeedback(void)
6287 GET_CURRENT_CONTEXT(ctx);
6288 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6289 (void) alloc_instruction(ctx, OPCODE_END_TRANSFORM_FEEDBACK, 0);
6290 if (ctx->ExecuteFlag) {
6291 CALL_EndTransformFeedbackEXT(ctx->Exec, ());
6295 static void GLAPIENTRY
6296 save_TransformFeedbackVaryings(GLuint program, GLsizei count,
6297 const GLchar **varyings, GLenum bufferMode)
6299 GET_CURRENT_CONTEXT(ctx);
6300 _mesa_problem(ctx,
6301 "glTransformFeedbackVarying() display list support not done");
6304 static void GLAPIENTRY
6305 save_BindTransformFeedback(GLenum target, GLuint name)
6307 GET_CURRENT_CONTEXT(ctx);
6308 Node *n;
6309 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6310 n = alloc_instruction(ctx, OPCODE_BIND_TRANSFORM_FEEDBACK, 2);
6311 if (n) {
6312 n[1].e = target;
6313 n[2].ui = name;
6315 if (ctx->ExecuteFlag) {
6316 CALL_BindTransformFeedback(ctx->Exec, (target, name));
6320 static void GLAPIENTRY
6321 save_PauseTransformFeedback(void)
6323 GET_CURRENT_CONTEXT(ctx);
6324 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6325 (void) alloc_instruction(ctx, OPCODE_PAUSE_TRANSFORM_FEEDBACK, 0);
6326 if (ctx->ExecuteFlag) {
6327 CALL_PauseTransformFeedback(ctx->Exec, ());
6331 static void GLAPIENTRY
6332 save_ResumeTransformFeedback(void)
6334 GET_CURRENT_CONTEXT(ctx);
6335 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6336 (void) alloc_instruction(ctx, OPCODE_RESUME_TRANSFORM_FEEDBACK, 0);
6337 if (ctx->ExecuteFlag) {
6338 CALL_ResumeTransformFeedback(ctx->Exec, ());
6342 static void GLAPIENTRY
6343 save_DrawTransformFeedback(GLenum mode, GLuint name)
6345 GET_CURRENT_CONTEXT(ctx);
6346 Node *n;
6347 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6348 n = alloc_instruction(ctx, OPCODE_DRAW_TRANSFORM_FEEDBACK, 2);
6349 if (n) {
6350 n[1].e = mode;
6351 n[2].ui = name;
6353 if (ctx->ExecuteFlag) {
6354 CALL_DrawTransformFeedback(ctx->Exec, (mode, name));
6359 /* aka UseProgram() */
6360 static void GLAPIENTRY
6361 save_UseProgramObjectARB(GLhandleARB program)
6363 GET_CURRENT_CONTEXT(ctx);
6364 Node *n;
6365 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6366 n = alloc_instruction(ctx, OPCODE_USE_PROGRAM, 1);
6367 if (n) {
6368 n[1].ui = program;
6370 if (ctx->ExecuteFlag) {
6371 CALL_UseProgramObjectARB(ctx->Exec, (program));
6376 static void GLAPIENTRY
6377 save_Uniform1fARB(GLint location, GLfloat x)
6379 GET_CURRENT_CONTEXT(ctx);
6380 Node *n;
6381 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6382 n = alloc_instruction(ctx, OPCODE_UNIFORM_1F, 2);
6383 if (n) {
6384 n[1].i = location;
6385 n[2].f = x;
6387 if (ctx->ExecuteFlag) {
6388 CALL_Uniform1fARB(ctx->Exec, (location, x));
6393 static void GLAPIENTRY
6394 save_Uniform2fARB(GLint location, GLfloat x, GLfloat y)
6396 GET_CURRENT_CONTEXT(ctx);
6397 Node *n;
6398 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6399 n = alloc_instruction(ctx, OPCODE_UNIFORM_2F, 3);
6400 if (n) {
6401 n[1].i = location;
6402 n[2].f = x;
6403 n[3].f = y;
6405 if (ctx->ExecuteFlag) {
6406 CALL_Uniform2fARB(ctx->Exec, (location, x, y));
6411 static void GLAPIENTRY
6412 save_Uniform3fARB(GLint location, GLfloat x, GLfloat y, GLfloat z)
6414 GET_CURRENT_CONTEXT(ctx);
6415 Node *n;
6416 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6417 n = alloc_instruction(ctx, OPCODE_UNIFORM_3F, 4);
6418 if (n) {
6419 n[1].i = location;
6420 n[2].f = x;
6421 n[3].f = y;
6422 n[4].f = z;
6424 if (ctx->ExecuteFlag) {
6425 CALL_Uniform3fARB(ctx->Exec, (location, x, y, z));
6430 static void GLAPIENTRY
6431 save_Uniform4fARB(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
6433 GET_CURRENT_CONTEXT(ctx);
6434 Node *n;
6435 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6436 n = alloc_instruction(ctx, OPCODE_UNIFORM_4F, 5);
6437 if (n) {
6438 n[1].i = location;
6439 n[2].f = x;
6440 n[3].f = y;
6441 n[4].f = z;
6442 n[5].f = w;
6444 if (ctx->ExecuteFlag) {
6445 CALL_Uniform4fARB(ctx->Exec, (location, x, y, z, w));
6450 /** Return copy of memory */
6451 static void *
6452 memdup(const void *src, GLsizei bytes)
6454 void *b = bytes >= 0 ? malloc(bytes) : NULL;
6455 if (b)
6456 memcpy(b, src, bytes);
6457 return b;
6461 static void GLAPIENTRY
6462 save_Uniform1fvARB(GLint location, GLsizei count, const GLfloat *v)
6464 GET_CURRENT_CONTEXT(ctx);
6465 Node *n;
6466 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6467 n = alloc_instruction(ctx, OPCODE_UNIFORM_1FV, 3);
6468 if (n) {
6469 n[1].i = location;
6470 n[2].i = count;
6471 n[3].data = memdup(v, count * 1 * sizeof(GLfloat));
6473 if (ctx->ExecuteFlag) {
6474 CALL_Uniform1fvARB(ctx->Exec, (location, count, v));
6478 static void GLAPIENTRY
6479 save_Uniform2fvARB(GLint location, GLsizei count, const GLfloat *v)
6481 GET_CURRENT_CONTEXT(ctx);
6482 Node *n;
6483 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6484 n = alloc_instruction(ctx, OPCODE_UNIFORM_2FV, 3);
6485 if (n) {
6486 n[1].i = location;
6487 n[2].i = count;
6488 n[3].data = memdup(v, count * 2 * sizeof(GLfloat));
6490 if (ctx->ExecuteFlag) {
6491 CALL_Uniform2fvARB(ctx->Exec, (location, count, v));
6495 static void GLAPIENTRY
6496 save_Uniform3fvARB(GLint location, GLsizei count, const GLfloat *v)
6498 GET_CURRENT_CONTEXT(ctx);
6499 Node *n;
6500 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6501 n = alloc_instruction(ctx, OPCODE_UNIFORM_3FV, 3);
6502 if (n) {
6503 n[1].i = location;
6504 n[2].i = count;
6505 n[3].data = memdup(v, count * 3 * sizeof(GLfloat));
6507 if (ctx->ExecuteFlag) {
6508 CALL_Uniform3fvARB(ctx->Exec, (location, count, v));
6512 static void GLAPIENTRY
6513 save_Uniform4fvARB(GLint location, GLsizei count, const GLfloat *v)
6515 GET_CURRENT_CONTEXT(ctx);
6516 Node *n;
6517 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6518 n = alloc_instruction(ctx, OPCODE_UNIFORM_4FV, 3);
6519 if (n) {
6520 n[1].i = location;
6521 n[2].i = count;
6522 n[3].data = memdup(v, count * 4 * sizeof(GLfloat));
6524 if (ctx->ExecuteFlag) {
6525 CALL_Uniform4fvARB(ctx->Exec, (location, count, v));
6530 static void GLAPIENTRY
6531 save_Uniform1iARB(GLint location, GLint x)
6533 GET_CURRENT_CONTEXT(ctx);
6534 Node *n;
6535 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6536 n = alloc_instruction(ctx, OPCODE_UNIFORM_1I, 2);
6537 if (n) {
6538 n[1].i = location;
6539 n[2].i = x;
6541 if (ctx->ExecuteFlag) {
6542 CALL_Uniform1iARB(ctx->Exec, (location, x));
6546 static void GLAPIENTRY
6547 save_Uniform2iARB(GLint location, GLint x, GLint y)
6549 GET_CURRENT_CONTEXT(ctx);
6550 Node *n;
6551 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6552 n = alloc_instruction(ctx, OPCODE_UNIFORM_2I, 3);
6553 if (n) {
6554 n[1].i = location;
6555 n[2].i = x;
6556 n[3].i = y;
6558 if (ctx->ExecuteFlag) {
6559 CALL_Uniform2iARB(ctx->Exec, (location, x, y));
6563 static void GLAPIENTRY
6564 save_Uniform3iARB(GLint location, GLint x, GLint y, GLint z)
6566 GET_CURRENT_CONTEXT(ctx);
6567 Node *n;
6568 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6569 n = alloc_instruction(ctx, OPCODE_UNIFORM_3I, 4);
6570 if (n) {
6571 n[1].i = location;
6572 n[2].i = x;
6573 n[3].i = y;
6574 n[4].i = z;
6576 if (ctx->ExecuteFlag) {
6577 CALL_Uniform3iARB(ctx->Exec, (location, x, y, z));
6581 static void GLAPIENTRY
6582 save_Uniform4iARB(GLint location, GLint x, GLint y, GLint z, GLint w)
6584 GET_CURRENT_CONTEXT(ctx);
6585 Node *n;
6586 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6587 n = alloc_instruction(ctx, OPCODE_UNIFORM_4I, 5);
6588 if (n) {
6589 n[1].i = location;
6590 n[2].i = x;
6591 n[3].i = y;
6592 n[4].i = z;
6593 n[5].i = w;
6595 if (ctx->ExecuteFlag) {
6596 CALL_Uniform4iARB(ctx->Exec, (location, x, y, z, w));
6602 static void GLAPIENTRY
6603 save_Uniform1ivARB(GLint location, GLsizei count, const GLint *v)
6605 GET_CURRENT_CONTEXT(ctx);
6606 Node *n;
6607 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6608 n = alloc_instruction(ctx, OPCODE_UNIFORM_1IV, 3);
6609 if (n) {
6610 n[1].i = location;
6611 n[2].i = count;
6612 n[3].data = memdup(v, count * 1 * sizeof(GLint));
6614 if (ctx->ExecuteFlag) {
6615 CALL_Uniform1ivARB(ctx->Exec, (location, count, v));
6619 static void GLAPIENTRY
6620 save_Uniform2ivARB(GLint location, GLsizei count, const GLint *v)
6622 GET_CURRENT_CONTEXT(ctx);
6623 Node *n;
6624 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6625 n = alloc_instruction(ctx, OPCODE_UNIFORM_2IV, 3);
6626 if (n) {
6627 n[1].i = location;
6628 n[2].i = count;
6629 n[3].data = memdup(v, count * 2 * sizeof(GLint));
6631 if (ctx->ExecuteFlag) {
6632 CALL_Uniform2ivARB(ctx->Exec, (location, count, v));
6636 static void GLAPIENTRY
6637 save_Uniform3ivARB(GLint location, GLsizei count, const GLint *v)
6639 GET_CURRENT_CONTEXT(ctx);
6640 Node *n;
6641 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6642 n = alloc_instruction(ctx, OPCODE_UNIFORM_3IV, 3);
6643 if (n) {
6644 n[1].i = location;
6645 n[2].i = count;
6646 n[3].data = memdup(v, count * 3 * sizeof(GLint));
6648 if (ctx->ExecuteFlag) {
6649 CALL_Uniform3ivARB(ctx->Exec, (location, count, v));
6653 static void GLAPIENTRY
6654 save_Uniform4ivARB(GLint location, GLsizei count, const GLint *v)
6656 GET_CURRENT_CONTEXT(ctx);
6657 Node *n;
6658 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6659 n = alloc_instruction(ctx, OPCODE_UNIFORM_4IV, 3);
6660 if (n) {
6661 n[1].i = location;
6662 n[2].i = count;
6663 n[3].data = memdup(v, count * 4 * sizeof(GLfloat));
6665 if (ctx->ExecuteFlag) {
6666 CALL_Uniform4ivARB(ctx->Exec, (location, count, v));
6672 static void GLAPIENTRY
6673 save_Uniform1ui(GLint location, GLuint x)
6675 GET_CURRENT_CONTEXT(ctx);
6676 Node *n;
6677 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6678 n = alloc_instruction(ctx, OPCODE_UNIFORM_1UI, 2);
6679 if (n) {
6680 n[1].i = location;
6681 n[2].i = x;
6683 if (ctx->ExecuteFlag) {
6684 /*CALL_Uniform1ui(ctx->Exec, (location, x));*/
6688 static void GLAPIENTRY
6689 save_Uniform2ui(GLint location, GLuint x, GLuint y)
6691 GET_CURRENT_CONTEXT(ctx);
6692 Node *n;
6693 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6694 n = alloc_instruction(ctx, OPCODE_UNIFORM_2UI, 3);
6695 if (n) {
6696 n[1].i = location;
6697 n[2].i = x;
6698 n[3].i = y;
6700 if (ctx->ExecuteFlag) {
6701 /*CALL_Uniform2ui(ctx->Exec, (location, x, y));*/
6705 static void GLAPIENTRY
6706 save_Uniform3ui(GLint location, GLuint x, GLuint y, GLuint z)
6708 GET_CURRENT_CONTEXT(ctx);
6709 Node *n;
6710 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6711 n = alloc_instruction(ctx, OPCODE_UNIFORM_3UI, 4);
6712 if (n) {
6713 n[1].i = location;
6714 n[2].i = x;
6715 n[3].i = y;
6716 n[4].i = z;
6718 if (ctx->ExecuteFlag) {
6719 /*CALL_Uniform3ui(ctx->Exec, (location, x, y, z));*/
6723 static void GLAPIENTRY
6724 save_Uniform4ui(GLint location, GLuint x, GLuint y, GLuint z, GLuint w)
6726 GET_CURRENT_CONTEXT(ctx);
6727 Node *n;
6728 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6729 n = alloc_instruction(ctx, OPCODE_UNIFORM_4UI, 5);
6730 if (n) {
6731 n[1].i = location;
6732 n[2].i = x;
6733 n[3].i = y;
6734 n[4].i = z;
6735 n[5].i = w;
6737 if (ctx->ExecuteFlag) {
6738 /*CALL_Uniform4ui(ctx->Exec, (location, x, y, z, w));*/
6744 static void GLAPIENTRY
6745 save_Uniform1uiv(GLint location, GLsizei count, const GLuint *v)
6747 GET_CURRENT_CONTEXT(ctx);
6748 Node *n;
6749 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6750 n = alloc_instruction(ctx, OPCODE_UNIFORM_1UIV, 3);
6751 if (n) {
6752 n[1].i = location;
6753 n[2].i = count;
6754 n[3].data = memdup(v, count * 1 * sizeof(*v));
6756 if (ctx->ExecuteFlag) {
6757 /*CALL_Uniform1uiv(ctx->Exec, (location, count, v));*/
6761 static void GLAPIENTRY
6762 save_Uniform2uiv(GLint location, GLsizei count, const GLuint *v)
6764 GET_CURRENT_CONTEXT(ctx);
6765 Node *n;
6766 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6767 n = alloc_instruction(ctx, OPCODE_UNIFORM_2UIV, 3);
6768 if (n) {
6769 n[1].i = location;
6770 n[2].i = count;
6771 n[3].data = memdup(v, count * 2 * sizeof(*v));
6773 if (ctx->ExecuteFlag) {
6774 /*CALL_Uniform2uiv(ctx->Exec, (location, count, v));*/
6778 static void GLAPIENTRY
6779 save_Uniform3uiv(GLint location, GLsizei count, const GLuint *v)
6781 GET_CURRENT_CONTEXT(ctx);
6782 Node *n;
6783 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6784 n = alloc_instruction(ctx, OPCODE_UNIFORM_3UIV, 3);
6785 if (n) {
6786 n[1].i = location;
6787 n[2].i = count;
6788 n[3].data = memdup(v, count * 3 * sizeof(*v));
6790 if (ctx->ExecuteFlag) {
6791 /*CALL_Uniform3uiv(ctx->Exec, (location, count, v));*/
6795 static void GLAPIENTRY
6796 save_Uniform4uiv(GLint location, GLsizei count, const GLuint *v)
6798 GET_CURRENT_CONTEXT(ctx);
6799 Node *n;
6800 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6801 n = alloc_instruction(ctx, OPCODE_UNIFORM_4UIV, 3);
6802 if (n) {
6803 n[1].i = location;
6804 n[2].i = count;
6805 n[3].data = memdup(v, count * 4 * sizeof(*v));
6807 if (ctx->ExecuteFlag) {
6808 /*CALL_Uniform4uiv(ctx->Exec, (location, count, v));*/
6814 static void GLAPIENTRY
6815 save_UniformMatrix2fvARB(GLint location, GLsizei count, GLboolean transpose,
6816 const GLfloat *m)
6818 GET_CURRENT_CONTEXT(ctx);
6819 Node *n;
6820 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6821 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX22, 4);
6822 if (n) {
6823 n[1].i = location;
6824 n[2].i = count;
6825 n[3].b = transpose;
6826 n[4].data = memdup(m, count * 2 * 2 * sizeof(GLfloat));
6828 if (ctx->ExecuteFlag) {
6829 CALL_UniformMatrix2fvARB(ctx->Exec, (location, count, transpose, m));
6833 static void GLAPIENTRY
6834 save_UniformMatrix3fvARB(GLint location, GLsizei count, GLboolean transpose,
6835 const GLfloat *m)
6837 GET_CURRENT_CONTEXT(ctx);
6838 Node *n;
6839 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6840 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX33, 4);
6841 if (n) {
6842 n[1].i = location;
6843 n[2].i = count;
6844 n[3].b = transpose;
6845 n[4].data = memdup(m, count * 3 * 3 * sizeof(GLfloat));
6847 if (ctx->ExecuteFlag) {
6848 CALL_UniformMatrix3fvARB(ctx->Exec, (location, count, transpose, m));
6852 static void GLAPIENTRY
6853 save_UniformMatrix4fvARB(GLint location, GLsizei count, GLboolean transpose,
6854 const GLfloat *m)
6856 GET_CURRENT_CONTEXT(ctx);
6857 Node *n;
6858 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6859 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX44, 4);
6860 if (n) {
6861 n[1].i = location;
6862 n[2].i = count;
6863 n[3].b = transpose;
6864 n[4].data = memdup(m, count * 4 * 4 * sizeof(GLfloat));
6866 if (ctx->ExecuteFlag) {
6867 CALL_UniformMatrix4fvARB(ctx->Exec, (location, count, transpose, m));
6872 static void GLAPIENTRY
6873 save_UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose,
6874 const GLfloat *m)
6876 GET_CURRENT_CONTEXT(ctx);
6877 Node *n;
6878 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6879 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX23, 4);
6880 if (n) {
6881 n[1].i = location;
6882 n[2].i = count;
6883 n[3].b = transpose;
6884 n[4].data = memdup(m, count * 2 * 3 * sizeof(GLfloat));
6886 if (ctx->ExecuteFlag) {
6887 CALL_UniformMatrix2x3fv(ctx->Exec, (location, count, transpose, m));
6891 static void GLAPIENTRY
6892 save_UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose,
6893 const GLfloat *m)
6895 GET_CURRENT_CONTEXT(ctx);
6896 Node *n;
6897 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6898 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX32, 4);
6899 if (n) {
6900 n[1].i = location;
6901 n[2].i = count;
6902 n[3].b = transpose;
6903 n[4].data = memdup(m, count * 3 * 2 * sizeof(GLfloat));
6905 if (ctx->ExecuteFlag) {
6906 CALL_UniformMatrix3x2fv(ctx->Exec, (location, count, transpose, m));
6911 static void GLAPIENTRY
6912 save_UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose,
6913 const GLfloat *m)
6915 GET_CURRENT_CONTEXT(ctx);
6916 Node *n;
6917 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6918 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX24, 4);
6919 if (n) {
6920 n[1].i = location;
6921 n[2].i = count;
6922 n[3].b = transpose;
6923 n[4].data = memdup(m, count * 2 * 4 * sizeof(GLfloat));
6925 if (ctx->ExecuteFlag) {
6926 CALL_UniformMatrix2x4fv(ctx->Exec, (location, count, transpose, m));
6930 static void GLAPIENTRY
6931 save_UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose,
6932 const GLfloat *m)
6934 GET_CURRENT_CONTEXT(ctx);
6935 Node *n;
6936 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6937 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX42, 4);
6938 if (n) {
6939 n[1].i = location;
6940 n[2].i = count;
6941 n[3].b = transpose;
6942 n[4].data = memdup(m, count * 4 * 2 * sizeof(GLfloat));
6944 if (ctx->ExecuteFlag) {
6945 CALL_UniformMatrix4x2fv(ctx->Exec, (location, count, transpose, m));
6950 static void GLAPIENTRY
6951 save_UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose,
6952 const GLfloat *m)
6954 GET_CURRENT_CONTEXT(ctx);
6955 Node *n;
6956 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6957 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX34, 4);
6958 if (n) {
6959 n[1].i = location;
6960 n[2].i = count;
6961 n[3].b = transpose;
6962 n[4].data = memdup(m, count * 3 * 4 * sizeof(GLfloat));
6964 if (ctx->ExecuteFlag) {
6965 CALL_UniformMatrix3x4fv(ctx->Exec, (location, count, transpose, m));
6969 static void GLAPIENTRY
6970 save_UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose,
6971 const GLfloat *m)
6973 GET_CURRENT_CONTEXT(ctx);
6974 Node *n;
6975 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6976 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX43, 4);
6977 if (n) {
6978 n[1].i = location;
6979 n[2].i = count;
6980 n[3].b = transpose;
6981 n[4].data = memdup(m, count * 4 * 3 * sizeof(GLfloat));
6983 if (ctx->ExecuteFlag) {
6984 CALL_UniformMatrix4x3fv(ctx->Exec, (location, count, transpose, m));
6988 static void GLAPIENTRY
6989 save_ClampColorARB(GLenum target, GLenum clamp)
6991 GET_CURRENT_CONTEXT(ctx);
6992 Node *n;
6993 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6994 n = alloc_instruction(ctx, OPCODE_CLAMP_COLOR, 2);
6995 if (n) {
6996 n[1].e = target;
6997 n[2].e = clamp;
6999 if (ctx->ExecuteFlag) {
7000 CALL_ClampColorARB(ctx->Exec, (target, clamp));
7004 static void GLAPIENTRY
7005 save_UseShaderProgramEXT(GLenum type, GLuint program)
7007 GET_CURRENT_CONTEXT(ctx);
7008 Node *n;
7009 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7010 n = alloc_instruction(ctx, OPCODE_USE_SHADER_PROGRAM_EXT, 2);
7011 if (n) {
7012 n[1].ui = type;
7013 n[2].ui = program;
7015 if (ctx->ExecuteFlag) {
7016 CALL_UseShaderProgramEXT(ctx->Exec, (type, program));
7020 static void GLAPIENTRY
7021 save_ActiveProgramEXT(GLuint program)
7023 GET_CURRENT_CONTEXT(ctx);
7024 Node *n;
7025 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7026 n = alloc_instruction(ctx, OPCODE_ACTIVE_PROGRAM_EXT, 1);
7027 if (n) {
7028 n[1].ui = program;
7030 if (ctx->ExecuteFlag) {
7031 CALL_ActiveProgramEXT(ctx->Exec, (program));
7035 /** GL_EXT_texture_integer */
7036 static void GLAPIENTRY
7037 save_ClearColorIi(GLint red, GLint green, GLint blue, GLint alpha)
7039 GET_CURRENT_CONTEXT(ctx);
7040 Node *n;
7041 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7042 n = alloc_instruction(ctx, OPCODE_CLEARCOLOR_I, 4);
7043 if (n) {
7044 n[1].i = red;
7045 n[2].i = green;
7046 n[3].i = blue;
7047 n[4].i = alpha;
7049 if (ctx->ExecuteFlag) {
7050 CALL_ClearColorIiEXT(ctx->Exec, (red, green, blue, alpha));
7054 /** GL_EXT_texture_integer */
7055 static void GLAPIENTRY
7056 save_ClearColorIui(GLuint red, GLuint green, GLuint blue, GLuint alpha)
7058 GET_CURRENT_CONTEXT(ctx);
7059 Node *n;
7060 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7061 n = alloc_instruction(ctx, OPCODE_CLEARCOLOR_UI, 4);
7062 if (n) {
7063 n[1].ui = red;
7064 n[2].ui = green;
7065 n[3].ui = blue;
7066 n[4].ui = alpha;
7068 if (ctx->ExecuteFlag) {
7069 CALL_ClearColorIuiEXT(ctx->Exec, (red, green, blue, alpha));
7073 /** GL_EXT_texture_integer */
7074 static void GLAPIENTRY
7075 save_TexParameterIiv(GLenum target, GLenum pname, const GLint *params)
7077 GET_CURRENT_CONTEXT(ctx);
7078 Node *n;
7079 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7080 n = alloc_instruction(ctx, OPCODE_TEXPARAMETER_I, 6);
7081 if (n) {
7082 n[1].e = target;
7083 n[2].e = pname;
7084 n[3].i = params[0];
7085 n[4].i = params[1];
7086 n[5].i = params[2];
7087 n[6].i = params[3];
7089 if (ctx->ExecuteFlag) {
7090 CALL_TexParameterIivEXT(ctx->Exec, (target, pname, params));
7094 /** GL_EXT_texture_integer */
7095 static void GLAPIENTRY
7096 save_TexParameterIuiv(GLenum target, GLenum pname, const GLuint *params)
7098 GET_CURRENT_CONTEXT(ctx);
7099 Node *n;
7100 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7101 n = alloc_instruction(ctx, OPCODE_TEXPARAMETER_UI, 6);
7102 if (n) {
7103 n[1].e = target;
7104 n[2].e = pname;
7105 n[3].ui = params[0];
7106 n[4].ui = params[1];
7107 n[5].ui = params[2];
7108 n[6].ui = params[3];
7110 if (ctx->ExecuteFlag) {
7111 CALL_TexParameterIuivEXT(ctx->Exec, (target, pname, params));
7115 /** GL_EXT_texture_integer */
7116 static void GLAPIENTRY
7117 exec_GetTexParameterIiv(GLenum target, GLenum pname, GLint *params)
7119 GET_CURRENT_CONTEXT(ctx);
7120 FLUSH_VERTICES(ctx, 0);
7121 CALL_GetTexParameterIivEXT(ctx->Exec, (target, pname, params));
7124 /** GL_EXT_texture_integer */
7125 static void GLAPIENTRY
7126 exec_GetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params)
7128 GET_CURRENT_CONTEXT(ctx);
7129 FLUSH_VERTICES(ctx, 0);
7130 CALL_GetTexParameterIuivEXT(ctx->Exec, (target, pname, params));
7134 /* GL_ARB_instanced_arrays */
7135 static void GLAPIENTRY
7136 save_VertexAttribDivisor(GLuint index, GLuint divisor)
7138 GET_CURRENT_CONTEXT(ctx);
7139 Node *n;
7140 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7141 n = alloc_instruction(ctx, OPCODE_VERTEX_ATTRIB_DIVISOR, 2);
7142 if (n) {
7143 n[1].ui = index;
7144 n[2].ui = divisor;
7146 if (ctx->ExecuteFlag) {
7147 CALL_VertexAttribDivisorARB(ctx->Exec, (index, divisor));
7152 /* GL_NV_texture_barrier */
7153 static void GLAPIENTRY
7154 save_TextureBarrierNV(void)
7156 GET_CURRENT_CONTEXT(ctx);
7157 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7158 alloc_instruction(ctx, OPCODE_TEXTURE_BARRIER_NV, 0);
7159 if (ctx->ExecuteFlag) {
7160 CALL_TextureBarrierNV(ctx->Exec, ());
7165 /* GL_ARB_sampler_objects */
7166 static void GLAPIENTRY
7167 save_BindSampler(GLuint unit, GLuint sampler)
7169 Node *n;
7170 GET_CURRENT_CONTEXT(ctx);
7171 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7172 n = alloc_instruction(ctx, OPCODE_BIND_SAMPLER, 2);
7173 if (n) {
7174 n[1].ui = unit;
7175 n[2].ui = sampler;
7177 if (ctx->ExecuteFlag) {
7178 CALL_BindSampler(ctx->Exec, (unit, sampler));
7182 static void GLAPIENTRY
7183 save_SamplerParameteriv(GLuint sampler, GLenum pname, const GLint *params)
7185 Node *n;
7186 GET_CURRENT_CONTEXT(ctx);
7187 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7188 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERIV, 6);
7189 if (n) {
7190 n[1].ui = sampler;
7191 n[2].e = pname;
7192 n[3].i = params[0];
7193 if (pname == GL_TEXTURE_BORDER_COLOR) {
7194 n[4].i = params[1];
7195 n[5].i = params[2];
7196 n[6].i = params[3];
7198 else {
7199 n[4].i = n[5].i = n[6].i = 0;
7202 if (ctx->ExecuteFlag) {
7203 CALL_SamplerParameteriv(ctx->Exec, (sampler, pname, params));
7207 static void GLAPIENTRY
7208 save_SamplerParameteri(GLuint sampler, GLenum pname, GLint param)
7210 save_SamplerParameteriv(sampler, pname, &param);
7213 static void GLAPIENTRY
7214 save_SamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *params)
7216 Node *n;
7217 GET_CURRENT_CONTEXT(ctx);
7218 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7219 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERFV, 6);
7220 if (n) {
7221 n[1].ui = sampler;
7222 n[2].e = pname;
7223 n[3].f = params[0];
7224 if (pname == GL_TEXTURE_BORDER_COLOR) {
7225 n[4].f = params[1];
7226 n[5].f = params[2];
7227 n[6].f = params[3];
7229 else {
7230 n[4].f = n[5].f = n[6].f = 0.0F;
7233 if (ctx->ExecuteFlag) {
7234 CALL_SamplerParameterfv(ctx->Exec, (sampler, pname, params));
7238 static void GLAPIENTRY
7239 save_SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
7241 save_SamplerParameterfv(sampler, pname, &param);
7244 static void GLAPIENTRY
7245 save_SamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *params)
7247 Node *n;
7248 GET_CURRENT_CONTEXT(ctx);
7249 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7250 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERIIV, 6);
7251 if (n) {
7252 n[1].ui = sampler;
7253 n[2].e = pname;
7254 n[3].i = params[0];
7255 if (pname == GL_TEXTURE_BORDER_COLOR) {
7256 n[4].i = params[1];
7257 n[5].i = params[2];
7258 n[6].i = params[3];
7260 else {
7261 n[4].i = n[5].i = n[6].i = 0;
7264 if (ctx->ExecuteFlag) {
7265 CALL_SamplerParameterIiv(ctx->Exec, (sampler, pname, params));
7269 static void GLAPIENTRY
7270 save_SamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *params)
7272 Node *n;
7273 GET_CURRENT_CONTEXT(ctx);
7274 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7275 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERUIV, 6);
7276 if (n) {
7277 n[1].ui = sampler;
7278 n[2].e = pname;
7279 n[3].ui = params[0];
7280 if (pname == GL_TEXTURE_BORDER_COLOR) {
7281 n[4].ui = params[1];
7282 n[5].ui = params[2];
7283 n[6].ui = params[3];
7285 else {
7286 n[4].ui = n[5].ui = n[6].ui = 0;
7289 if (ctx->ExecuteFlag) {
7290 CALL_SamplerParameterIuiv(ctx->Exec, (sampler, pname, params));
7294 /* GL_ARB_geometry_shader4 */
7295 static void GLAPIENTRY
7296 save_ProgramParameteri(GLuint program, GLenum pname, GLint value)
7298 Node *n;
7299 GET_CURRENT_CONTEXT(ctx);
7300 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7301 n = alloc_instruction(ctx, OPCODE_PROGRAM_PARAMETERI, 3);
7302 if (n) {
7303 n[1].ui = program;
7304 n[2].e = pname;
7305 n[3].i = value;
7307 if (ctx->ExecuteFlag) {
7308 CALL_ProgramParameteriARB(ctx->Exec, (program, pname, value));
7312 static void GLAPIENTRY
7313 save_FramebufferTexture(GLenum target, GLenum attachment,
7314 GLuint texture, GLint level)
7316 Node *n;
7317 GET_CURRENT_CONTEXT(ctx);
7318 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7319 n = alloc_instruction(ctx, OPCODE_FRAMEBUFFER_TEXTURE, 4);
7320 if (n) {
7321 n[1].e = target;
7322 n[2].e = attachment;
7323 n[3].ui = texture;
7324 n[4].i = level;
7326 if (ctx->ExecuteFlag) {
7327 CALL_FramebufferTextureARB(ctx->Exec, (target, attachment, texture, level));
7331 static void GLAPIENTRY
7332 save_FramebufferTextureFace(GLenum target, GLenum attachment,
7333 GLuint texture, GLint level, GLenum face)
7335 Node *n;
7336 GET_CURRENT_CONTEXT(ctx);
7337 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7338 n = alloc_instruction(ctx, OPCODE_FRAMEBUFFER_TEXTURE_FACE, 5);
7339 if (n) {
7340 n[1].e = target;
7341 n[2].e = attachment;
7342 n[3].ui = texture;
7343 n[4].i = level;
7344 n[5].e = face;
7346 if (ctx->ExecuteFlag) {
7347 CALL_FramebufferTextureFaceARB(ctx->Exec, (target, attachment, texture,
7348 level, face));
7354 static void GLAPIENTRY
7355 save_WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
7357 Node *n;
7358 GET_CURRENT_CONTEXT(ctx);
7359 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7360 n = alloc_instruction(ctx, OPCODE_WAIT_SYNC, 4);
7361 if (n) {
7362 union uint64_pair p;
7363 p.uint64 = timeout;
7364 n[1].data = sync;
7365 n[2].e = flags;
7366 n[3].ui = p.uint32[0];
7367 n[4].ui = p.uint32[1];
7369 if (ctx->ExecuteFlag) {
7370 CALL_WaitSync(ctx->Exec, (sync, flags, timeout));
7376 * Save an error-generating command into display list.
7378 * KW: Will appear in the list before the vertex buffer containing the
7379 * command that provoked the error. I don't see this as a problem.
7381 static void
7382 save_error(struct gl_context *ctx, GLenum error, const char *s)
7384 Node *n;
7385 n = alloc_instruction(ctx, OPCODE_ERROR, 2);
7386 if (n) {
7387 n[1].e = error;
7388 n[2].data = (void *) s;
7394 * Compile an error into current display list.
7396 void
7397 _mesa_compile_error(struct gl_context *ctx, GLenum error, const char *s)
7399 if (ctx->CompileFlag)
7400 save_error(ctx, error, s);
7401 if (ctx->ExecuteFlag)
7402 _mesa_error(ctx, error, "%s", s);
7407 * Test if ID names a display list.
7409 static GLboolean
7410 islist(struct gl_context *ctx, GLuint list)
7412 if (list > 0 && lookup_list(ctx, list)) {
7413 return GL_TRUE;
7415 else {
7416 return GL_FALSE;
7422 /**********************************************************************/
7423 /* Display list execution */
7424 /**********************************************************************/
7428 * Execute a display list. Note that the ListBase offset must have already
7429 * been added before calling this function. I.e. the list argument is
7430 * the absolute list number, not relative to ListBase.
7431 * \param list - display list number
7433 static void
7434 execute_list(struct gl_context *ctx, GLuint list)
7436 struct gl_display_list *dlist;
7437 Node *n;
7438 GLboolean done;
7440 if (list == 0 || !islist(ctx, list))
7441 return;
7443 if (ctx->ListState.CallDepth == MAX_LIST_NESTING) {
7444 /* raise an error? */
7445 return;
7448 dlist = lookup_list(ctx, list);
7449 if (!dlist)
7450 return;
7452 ctx->ListState.CallDepth++;
7454 if (ctx->Driver.BeginCallList)
7455 ctx->Driver.BeginCallList(ctx, dlist);
7457 n = dlist->Head;
7459 done = GL_FALSE;
7460 while (!done) {
7461 const OpCode opcode = n[0].opcode;
7463 if (is_ext_opcode(opcode)) {
7464 n += ext_opcode_execute(ctx, n);
7466 else {
7467 switch (opcode) {
7468 case OPCODE_ERROR:
7469 _mesa_error(ctx, n[1].e, "%s", (const char *) n[2].data);
7470 break;
7471 case OPCODE_ACCUM:
7472 CALL_Accum(ctx->Exec, (n[1].e, n[2].f));
7473 break;
7474 case OPCODE_ALPHA_FUNC:
7475 CALL_AlphaFunc(ctx->Exec, (n[1].e, n[2].f));
7476 break;
7477 case OPCODE_BIND_TEXTURE:
7478 CALL_BindTexture(ctx->Exec, (n[1].e, n[2].ui));
7479 break;
7480 case OPCODE_BITMAP:
7482 const struct gl_pixelstore_attrib save = ctx->Unpack;
7483 ctx->Unpack = ctx->DefaultPacking;
7484 CALL_Bitmap(ctx->Exec, ((GLsizei) n[1].i, (GLsizei) n[2].i,
7485 n[3].f, n[4].f, n[5].f, n[6].f,
7486 (const GLubyte *) n[7].data));
7487 ctx->Unpack = save; /* restore */
7489 break;
7490 case OPCODE_BLEND_COLOR:
7491 CALL_BlendColor(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
7492 break;
7493 case OPCODE_BLEND_EQUATION:
7494 CALL_BlendEquation(ctx->Exec, (n[1].e));
7495 break;
7496 case OPCODE_BLEND_EQUATION_SEPARATE:
7497 CALL_BlendEquationSeparateEXT(ctx->Exec, (n[1].e, n[2].e));
7498 break;
7499 case OPCODE_BLEND_FUNC_SEPARATE:
7500 CALL_BlendFuncSeparateEXT(ctx->Exec,
7501 (n[1].e, n[2].e, n[3].e, n[4].e));
7502 break;
7504 case OPCODE_BLEND_FUNC_I:
7505 /* GL_ARB_draw_buffers_blend */
7506 CALL_BlendFunciARB(ctx->Exec, (n[1].ui, n[2].e, n[3].e));
7507 break;
7508 case OPCODE_BLEND_FUNC_SEPARATE_I:
7509 /* GL_ARB_draw_buffers_blend */
7510 CALL_BlendFuncSeparateiARB(ctx->Exec, (n[1].ui, n[2].e, n[3].e,
7511 n[4].e, n[5].e));
7512 break;
7513 case OPCODE_BLEND_EQUATION_I:
7514 /* GL_ARB_draw_buffers_blend */
7515 CALL_BlendEquationiARB(ctx->Exec, (n[1].ui, n[2].e));
7516 break;
7517 case OPCODE_BLEND_EQUATION_SEPARATE_I:
7518 /* GL_ARB_draw_buffers_blend */
7519 CALL_BlendEquationSeparateiARB(ctx->Exec,
7520 (n[1].ui, n[2].e, n[3].e));
7521 break;
7523 case OPCODE_CALL_LIST:
7524 /* Generated by glCallList(), don't add ListBase */
7525 if (ctx->ListState.CallDepth < MAX_LIST_NESTING) {
7526 execute_list(ctx, n[1].ui);
7528 break;
7529 case OPCODE_CALL_LIST_OFFSET:
7530 /* Generated by glCallLists() so we must add ListBase */
7531 if (n[2].b) {
7532 /* user specified a bad data type at compile time */
7533 _mesa_error(ctx, GL_INVALID_ENUM, "glCallLists(type)");
7535 else if (ctx->ListState.CallDepth < MAX_LIST_NESTING) {
7536 GLuint list = (GLuint) (ctx->List.ListBase + n[1].i);
7537 execute_list(ctx, list);
7539 break;
7540 case OPCODE_CLEAR:
7541 CALL_Clear(ctx->Exec, (n[1].bf));
7542 break;
7543 case OPCODE_CLEAR_BUFFER_IV:
7544 #if 0 /* unused */
7546 GLint value[4];
7547 value[0] = n[3].i;
7548 value[1] = n[4].i;
7549 value[2] = n[5].i;
7550 value[3] = n[6].i;
7551 /*CALL_ClearBufferiv(ctx->Exec, (n[1].e, n[2].i, value));*/
7553 #endif
7554 break;
7555 case OPCODE_CLEAR_BUFFER_UIV:
7556 #if 0 /* unused */
7558 GLuint value[4];
7559 value[0] = n[3].ui;
7560 value[1] = n[4].ui;
7561 value[2] = n[5].ui;
7562 value[3] = n[6].ui;
7563 /*CALL_ClearBufferiv(ctx->Exec, (n[1].e, n[2].i, value));*/
7565 #endif
7566 break;
7567 case OPCODE_CLEAR_BUFFER_FV:
7568 #if 0 /* unused */
7570 GLfloat value[4];
7571 value[0] = n[3].f;
7572 value[1] = n[4].f;
7573 value[2] = n[5].f;
7574 value[3] = n[6].f;
7575 /*CALL_ClearBufferfv(ctx->Exec, (n[1].e, n[2].i, value));*/
7577 #endif
7578 break;
7579 case OPCODE_CLEAR_BUFFER_FI:
7580 /*CALL_ClearBufferfi(ctx->Exec, (n[1].e, n[2].i, n[3].f, n[4].i));*/
7581 break;
7582 case OPCODE_CLEAR_COLOR:
7583 CALL_ClearColor(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
7584 break;
7585 case OPCODE_CLEAR_ACCUM:
7586 CALL_ClearAccum(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
7587 break;
7588 case OPCODE_CLEAR_DEPTH:
7589 CALL_ClearDepth(ctx->Exec, ((GLclampd) n[1].f));
7590 break;
7591 case OPCODE_CLEAR_INDEX:
7592 CALL_ClearIndex(ctx->Exec, ((GLfloat) n[1].ui));
7593 break;
7594 case OPCODE_CLEAR_STENCIL:
7595 CALL_ClearStencil(ctx->Exec, (n[1].i));
7596 break;
7597 case OPCODE_CLIP_PLANE:
7599 GLdouble eq[4];
7600 eq[0] = n[2].f;
7601 eq[1] = n[3].f;
7602 eq[2] = n[4].f;
7603 eq[3] = n[5].f;
7604 CALL_ClipPlane(ctx->Exec, (n[1].e, eq));
7606 break;
7607 case OPCODE_COLOR_MASK:
7608 CALL_ColorMask(ctx->Exec, (n[1].b, n[2].b, n[3].b, n[4].b));
7609 break;
7610 case OPCODE_COLOR_MASK_INDEXED:
7611 CALL_ColorMaskIndexedEXT(ctx->Exec, (n[1].ui, n[2].b, n[3].b,
7612 n[4].b, n[5].b));
7613 break;
7614 case OPCODE_COLOR_MATERIAL:
7615 CALL_ColorMaterial(ctx->Exec, (n[1].e, n[2].e));
7616 break;
7617 case OPCODE_COLOR_TABLE:
7619 const struct gl_pixelstore_attrib save = ctx->Unpack;
7620 ctx->Unpack = ctx->DefaultPacking;
7621 CALL_ColorTable(ctx->Exec, (n[1].e, n[2].e, n[3].i, n[4].e,
7622 n[5].e, n[6].data));
7623 ctx->Unpack = save; /* restore */
7625 break;
7626 case OPCODE_COLOR_TABLE_PARAMETER_FV:
7628 GLfloat params[4];
7629 params[0] = n[3].f;
7630 params[1] = n[4].f;
7631 params[2] = n[5].f;
7632 params[3] = n[6].f;
7633 CALL_ColorTableParameterfv(ctx->Exec,
7634 (n[1].e, n[2].e, params));
7636 break;
7637 case OPCODE_COLOR_TABLE_PARAMETER_IV:
7639 GLint params[4];
7640 params[0] = n[3].i;
7641 params[1] = n[4].i;
7642 params[2] = n[5].i;
7643 params[3] = n[6].i;
7644 CALL_ColorTableParameteriv(ctx->Exec,
7645 (n[1].e, n[2].e, params));
7647 break;
7648 case OPCODE_COLOR_SUB_TABLE:
7650 const struct gl_pixelstore_attrib save = ctx->Unpack;
7651 ctx->Unpack = ctx->DefaultPacking;
7652 CALL_ColorSubTable(ctx->Exec, (n[1].e, n[2].i, n[3].i,
7653 n[4].e, n[5].e, n[6].data));
7654 ctx->Unpack = save; /* restore */
7656 break;
7657 case OPCODE_CONVOLUTION_FILTER_1D:
7659 const struct gl_pixelstore_attrib save = ctx->Unpack;
7660 ctx->Unpack = ctx->DefaultPacking;
7661 CALL_ConvolutionFilter1D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
7662 n[4].e, n[5].e,
7663 n[6].data));
7664 ctx->Unpack = save; /* restore */
7666 break;
7667 case OPCODE_CONVOLUTION_FILTER_2D:
7669 const struct gl_pixelstore_attrib save = ctx->Unpack;
7670 ctx->Unpack = ctx->DefaultPacking;
7671 CALL_ConvolutionFilter2D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
7672 n[4].i, n[5].e, n[6].e,
7673 n[7].data));
7674 ctx->Unpack = save; /* restore */
7676 break;
7677 case OPCODE_CONVOLUTION_PARAMETER_I:
7678 CALL_ConvolutionParameteri(ctx->Exec, (n[1].e, n[2].e, n[3].i));
7679 break;
7680 case OPCODE_CONVOLUTION_PARAMETER_IV:
7682 GLint params[4];
7683 params[0] = n[3].i;
7684 params[1] = n[4].i;
7685 params[2] = n[5].i;
7686 params[3] = n[6].i;
7687 CALL_ConvolutionParameteriv(ctx->Exec,
7688 (n[1].e, n[2].e, params));
7690 break;
7691 case OPCODE_CONVOLUTION_PARAMETER_F:
7692 CALL_ConvolutionParameterf(ctx->Exec, (n[1].e, n[2].e, n[3].f));
7693 break;
7694 case OPCODE_CONVOLUTION_PARAMETER_FV:
7696 GLfloat params[4];
7697 params[0] = n[3].f;
7698 params[1] = n[4].f;
7699 params[2] = n[5].f;
7700 params[3] = n[6].f;
7701 CALL_ConvolutionParameterfv(ctx->Exec,
7702 (n[1].e, n[2].e, params));
7704 break;
7705 case OPCODE_COPY_COLOR_SUB_TABLE:
7706 CALL_CopyColorSubTable(ctx->Exec, (n[1].e, n[2].i,
7707 n[3].i, n[4].i, n[5].i));
7708 break;
7709 case OPCODE_COPY_COLOR_TABLE:
7710 CALL_CopyColorSubTable(ctx->Exec, (n[1].e, n[2].i,
7711 n[3].i, n[4].i, n[5].i));
7712 break;
7713 case OPCODE_COPY_PIXELS:
7714 CALL_CopyPixels(ctx->Exec, (n[1].i, n[2].i,
7715 (GLsizei) n[3].i, (GLsizei) n[4].i,
7716 n[5].e));
7717 break;
7718 case OPCODE_COPY_TEX_IMAGE1D:
7719 CALL_CopyTexImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].e, n[4].i,
7720 n[5].i, n[6].i, n[7].i));
7721 break;
7722 case OPCODE_COPY_TEX_IMAGE2D:
7723 CALL_CopyTexImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].e, n[4].i,
7724 n[5].i, n[6].i, n[7].i, n[8].i));
7725 break;
7726 case OPCODE_COPY_TEX_SUB_IMAGE1D:
7727 CALL_CopyTexSubImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
7728 n[4].i, n[5].i, n[6].i));
7729 break;
7730 case OPCODE_COPY_TEX_SUB_IMAGE2D:
7731 CALL_CopyTexSubImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
7732 n[4].i, n[5].i, n[6].i, n[7].i,
7733 n[8].i));
7734 break;
7735 case OPCODE_COPY_TEX_SUB_IMAGE3D:
7736 CALL_CopyTexSubImage3D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
7737 n[4].i, n[5].i, n[6].i, n[7].i,
7738 n[8].i, n[9].i));
7739 break;
7740 case OPCODE_CULL_FACE:
7741 CALL_CullFace(ctx->Exec, (n[1].e));
7742 break;
7743 case OPCODE_DEPTH_FUNC:
7744 CALL_DepthFunc(ctx->Exec, (n[1].e));
7745 break;
7746 case OPCODE_DEPTH_MASK:
7747 CALL_DepthMask(ctx->Exec, (n[1].b));
7748 break;
7749 case OPCODE_DEPTH_RANGE:
7750 CALL_DepthRange(ctx->Exec,
7751 ((GLclampd) n[1].f, (GLclampd) n[2].f));
7752 break;
7753 case OPCODE_DISABLE:
7754 CALL_Disable(ctx->Exec, (n[1].e));
7755 break;
7756 case OPCODE_DISABLE_INDEXED:
7757 CALL_DisableIndexedEXT(ctx->Exec, (n[1].ui, n[2].e));
7758 break;
7759 case OPCODE_DRAW_BUFFER:
7760 CALL_DrawBuffer(ctx->Exec, (n[1].e));
7761 break;
7762 case OPCODE_DRAW_PIXELS:
7764 const struct gl_pixelstore_attrib save = ctx->Unpack;
7765 ctx->Unpack = ctx->DefaultPacking;
7766 CALL_DrawPixels(ctx->Exec, (n[1].i, n[2].i, n[3].e, n[4].e,
7767 n[5].data));
7768 ctx->Unpack = save; /* restore */
7770 break;
7771 case OPCODE_ENABLE:
7772 CALL_Enable(ctx->Exec, (n[1].e));
7773 break;
7774 case OPCODE_ENABLE_INDEXED:
7775 CALL_EnableIndexedEXT(ctx->Exec, (n[1].ui, n[2].e));
7776 break;
7777 case OPCODE_EVALMESH1:
7778 CALL_EvalMesh1(ctx->Exec, (n[1].e, n[2].i, n[3].i));
7779 break;
7780 case OPCODE_EVALMESH2:
7781 CALL_EvalMesh2(ctx->Exec,
7782 (n[1].e, n[2].i, n[3].i, n[4].i, n[5].i));
7783 break;
7784 case OPCODE_FOG:
7786 GLfloat p[4];
7787 p[0] = n[2].f;
7788 p[1] = n[3].f;
7789 p[2] = n[4].f;
7790 p[3] = n[5].f;
7791 CALL_Fogfv(ctx->Exec, (n[1].e, p));
7793 break;
7794 case OPCODE_FRONT_FACE:
7795 CALL_FrontFace(ctx->Exec, (n[1].e));
7796 break;
7797 case OPCODE_FRUSTUM:
7798 CALL_Frustum(ctx->Exec,
7799 (n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f));
7800 break;
7801 case OPCODE_HINT:
7802 CALL_Hint(ctx->Exec, (n[1].e, n[2].e));
7803 break;
7804 case OPCODE_HISTOGRAM:
7805 CALL_Histogram(ctx->Exec, (n[1].e, n[2].i, n[3].e, n[4].b));
7806 break;
7807 case OPCODE_INDEX_MASK:
7808 CALL_IndexMask(ctx->Exec, (n[1].ui));
7809 break;
7810 case OPCODE_INIT_NAMES:
7811 CALL_InitNames(ctx->Exec, ());
7812 break;
7813 case OPCODE_LIGHT:
7815 GLfloat p[4];
7816 p[0] = n[3].f;
7817 p[1] = n[4].f;
7818 p[2] = n[5].f;
7819 p[3] = n[6].f;
7820 CALL_Lightfv(ctx->Exec, (n[1].e, n[2].e, p));
7822 break;
7823 case OPCODE_LIGHT_MODEL:
7825 GLfloat p[4];
7826 p[0] = n[2].f;
7827 p[1] = n[3].f;
7828 p[2] = n[4].f;
7829 p[3] = n[5].f;
7830 CALL_LightModelfv(ctx->Exec, (n[1].e, p));
7832 break;
7833 case OPCODE_LINE_STIPPLE:
7834 CALL_LineStipple(ctx->Exec, (n[1].i, n[2].us));
7835 break;
7836 case OPCODE_LINE_WIDTH:
7837 CALL_LineWidth(ctx->Exec, (n[1].f));
7838 break;
7839 case OPCODE_LIST_BASE:
7840 CALL_ListBase(ctx->Exec, (n[1].ui));
7841 break;
7842 case OPCODE_LOAD_IDENTITY:
7843 CALL_LoadIdentity(ctx->Exec, ());
7844 break;
7845 case OPCODE_LOAD_MATRIX:
7846 if (sizeof(Node) == sizeof(GLfloat)) {
7847 CALL_LoadMatrixf(ctx->Exec, (&n[1].f));
7849 else {
7850 GLfloat m[16];
7851 GLuint i;
7852 for (i = 0; i < 16; i++) {
7853 m[i] = n[1 + i].f;
7855 CALL_LoadMatrixf(ctx->Exec, (m));
7857 break;
7858 case OPCODE_LOAD_NAME:
7859 CALL_LoadName(ctx->Exec, (n[1].ui));
7860 break;
7861 case OPCODE_LOGIC_OP:
7862 CALL_LogicOp(ctx->Exec, (n[1].e));
7863 break;
7864 case OPCODE_MAP1:
7866 GLenum target = n[1].e;
7867 GLint ustride = _mesa_evaluator_components(target);
7868 GLint uorder = n[5].i;
7869 GLfloat u1 = n[2].f;
7870 GLfloat u2 = n[3].f;
7871 CALL_Map1f(ctx->Exec, (target, u1, u2, ustride, uorder,
7872 (GLfloat *) n[6].data));
7874 break;
7875 case OPCODE_MAP2:
7877 GLenum target = n[1].e;
7878 GLfloat u1 = n[2].f;
7879 GLfloat u2 = n[3].f;
7880 GLfloat v1 = n[4].f;
7881 GLfloat v2 = n[5].f;
7882 GLint ustride = n[6].i;
7883 GLint vstride = n[7].i;
7884 GLint uorder = n[8].i;
7885 GLint vorder = n[9].i;
7886 CALL_Map2f(ctx->Exec, (target, u1, u2, ustride, uorder,
7887 v1, v2, vstride, vorder,
7888 (GLfloat *) n[10].data));
7890 break;
7891 case OPCODE_MAPGRID1:
7892 CALL_MapGrid1f(ctx->Exec, (n[1].i, n[2].f, n[3].f));
7893 break;
7894 case OPCODE_MAPGRID2:
7895 CALL_MapGrid2f(ctx->Exec,
7896 (n[1].i, n[2].f, n[3].f, n[4].i, n[5].f, n[6].f));
7897 break;
7898 case OPCODE_MATRIX_MODE:
7899 CALL_MatrixMode(ctx->Exec, (n[1].e));
7900 break;
7901 case OPCODE_MIN_MAX:
7902 CALL_Minmax(ctx->Exec, (n[1].e, n[2].e, n[3].b));
7903 break;
7904 case OPCODE_MULT_MATRIX:
7905 if (sizeof(Node) == sizeof(GLfloat)) {
7906 CALL_MultMatrixf(ctx->Exec, (&n[1].f));
7908 else {
7909 GLfloat m[16];
7910 GLuint i;
7911 for (i = 0; i < 16; i++) {
7912 m[i] = n[1 + i].f;
7914 CALL_MultMatrixf(ctx->Exec, (m));
7916 break;
7917 case OPCODE_ORTHO:
7918 CALL_Ortho(ctx->Exec,
7919 (n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f));
7920 break;
7921 case OPCODE_PASSTHROUGH:
7922 CALL_PassThrough(ctx->Exec, (n[1].f));
7923 break;
7924 case OPCODE_PIXEL_MAP:
7925 CALL_PixelMapfv(ctx->Exec,
7926 (n[1].e, n[2].i, (GLfloat *) n[3].data));
7927 break;
7928 case OPCODE_PIXEL_TRANSFER:
7929 CALL_PixelTransferf(ctx->Exec, (n[1].e, n[2].f));
7930 break;
7931 case OPCODE_PIXEL_ZOOM:
7932 CALL_PixelZoom(ctx->Exec, (n[1].f, n[2].f));
7933 break;
7934 case OPCODE_POINT_SIZE:
7935 CALL_PointSize(ctx->Exec, (n[1].f));
7936 break;
7937 case OPCODE_POINT_PARAMETERS:
7939 GLfloat params[3];
7940 params[0] = n[2].f;
7941 params[1] = n[3].f;
7942 params[2] = n[4].f;
7943 CALL_PointParameterfvEXT(ctx->Exec, (n[1].e, params));
7945 break;
7946 case OPCODE_POLYGON_MODE:
7947 CALL_PolygonMode(ctx->Exec, (n[1].e, n[2].e));
7948 break;
7949 case OPCODE_POLYGON_STIPPLE:
7951 const struct gl_pixelstore_attrib save = ctx->Unpack;
7952 ctx->Unpack = ctx->DefaultPacking;
7953 CALL_PolygonStipple(ctx->Exec, ((GLubyte *) n[1].data));
7954 ctx->Unpack = save; /* restore */
7956 break;
7957 case OPCODE_POLYGON_OFFSET:
7958 CALL_PolygonOffset(ctx->Exec, (n[1].f, n[2].f));
7959 break;
7960 case OPCODE_POP_ATTRIB:
7961 CALL_PopAttrib(ctx->Exec, ());
7962 break;
7963 case OPCODE_POP_MATRIX:
7964 CALL_PopMatrix(ctx->Exec, ());
7965 break;
7966 case OPCODE_POP_NAME:
7967 CALL_PopName(ctx->Exec, ());
7968 break;
7969 case OPCODE_PRIORITIZE_TEXTURE:
7970 CALL_PrioritizeTextures(ctx->Exec, (1, &n[1].ui, &n[2].f));
7971 break;
7972 case OPCODE_PUSH_ATTRIB:
7973 CALL_PushAttrib(ctx->Exec, (n[1].bf));
7974 break;
7975 case OPCODE_PUSH_MATRIX:
7976 CALL_PushMatrix(ctx->Exec, ());
7977 break;
7978 case OPCODE_PUSH_NAME:
7979 CALL_PushName(ctx->Exec, (n[1].ui));
7980 break;
7981 case OPCODE_RASTER_POS:
7982 CALL_RasterPos4f(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
7983 break;
7984 case OPCODE_READ_BUFFER:
7985 CALL_ReadBuffer(ctx->Exec, (n[1].e));
7986 break;
7987 case OPCODE_RESET_HISTOGRAM:
7988 CALL_ResetHistogram(ctx->Exec, (n[1].e));
7989 break;
7990 case OPCODE_RESET_MIN_MAX:
7991 CALL_ResetMinmax(ctx->Exec, (n[1].e));
7992 break;
7993 case OPCODE_ROTATE:
7994 CALL_Rotatef(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
7995 break;
7996 case OPCODE_SCALE:
7997 CALL_Scalef(ctx->Exec, (n[1].f, n[2].f, n[3].f));
7998 break;
7999 case OPCODE_SCISSOR:
8000 CALL_Scissor(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
8001 break;
8002 case OPCODE_SHADE_MODEL:
8003 CALL_ShadeModel(ctx->Exec, (n[1].e));
8004 break;
8005 case OPCODE_PROVOKING_VERTEX:
8006 CALL_ProvokingVertexEXT(ctx->Exec, (n[1].e));
8007 break;
8008 case OPCODE_STENCIL_FUNC:
8009 CALL_StencilFunc(ctx->Exec, (n[1].e, n[2].i, n[3].ui));
8010 break;
8011 case OPCODE_STENCIL_MASK:
8012 CALL_StencilMask(ctx->Exec, (n[1].ui));
8013 break;
8014 case OPCODE_STENCIL_OP:
8015 CALL_StencilOp(ctx->Exec, (n[1].e, n[2].e, n[3].e));
8016 break;
8017 case OPCODE_STENCIL_FUNC_SEPARATE:
8018 CALL_StencilFuncSeparate(ctx->Exec,
8019 (n[1].e, n[2].e, n[3].i, n[4].ui));
8020 break;
8021 case OPCODE_STENCIL_MASK_SEPARATE:
8022 CALL_StencilMaskSeparate(ctx->Exec, (n[1].e, n[2].ui));
8023 break;
8024 case OPCODE_STENCIL_OP_SEPARATE:
8025 CALL_StencilOpSeparate(ctx->Exec,
8026 (n[1].e, n[2].e, n[3].e, n[4].e));
8027 break;
8028 case OPCODE_TEXENV:
8030 GLfloat params[4];
8031 params[0] = n[3].f;
8032 params[1] = n[4].f;
8033 params[2] = n[5].f;
8034 params[3] = n[6].f;
8035 CALL_TexEnvfv(ctx->Exec, (n[1].e, n[2].e, params));
8037 break;
8038 case OPCODE_TEXGEN:
8040 GLfloat params[4];
8041 params[0] = n[3].f;
8042 params[1] = n[4].f;
8043 params[2] = n[5].f;
8044 params[3] = n[6].f;
8045 CALL_TexGenfv(ctx->Exec, (n[1].e, n[2].e, params));
8047 break;
8048 case OPCODE_TEXPARAMETER:
8050 GLfloat params[4];
8051 params[0] = n[3].f;
8052 params[1] = n[4].f;
8053 params[2] = n[5].f;
8054 params[3] = n[6].f;
8055 CALL_TexParameterfv(ctx->Exec, (n[1].e, n[2].e, params));
8057 break;
8058 case OPCODE_TEX_IMAGE1D:
8060 const struct gl_pixelstore_attrib save = ctx->Unpack;
8061 ctx->Unpack = ctx->DefaultPacking;
8062 CALL_TexImage1D(ctx->Exec, (n[1].e, /* target */
8063 n[2].i, /* level */
8064 n[3].i, /* components */
8065 n[4].i, /* width */
8066 n[5].e, /* border */
8067 n[6].e, /* format */
8068 n[7].e, /* type */
8069 n[8].data));
8070 ctx->Unpack = save; /* restore */
8072 break;
8073 case OPCODE_TEX_IMAGE2D:
8075 const struct gl_pixelstore_attrib save = ctx->Unpack;
8076 ctx->Unpack = ctx->DefaultPacking;
8077 CALL_TexImage2D(ctx->Exec, (n[1].e, /* target */
8078 n[2].i, /* level */
8079 n[3].i, /* components */
8080 n[4].i, /* width */
8081 n[5].i, /* height */
8082 n[6].e, /* border */
8083 n[7].e, /* format */
8084 n[8].e, /* type */
8085 n[9].data));
8086 ctx->Unpack = save; /* restore */
8088 break;
8089 case OPCODE_TEX_IMAGE3D:
8091 const struct gl_pixelstore_attrib save = ctx->Unpack;
8092 ctx->Unpack = ctx->DefaultPacking;
8093 CALL_TexImage3D(ctx->Exec, (n[1].e, /* target */
8094 n[2].i, /* level */
8095 n[3].i, /* components */
8096 n[4].i, /* width */
8097 n[5].i, /* height */
8098 n[6].i, /* depth */
8099 n[7].e, /* border */
8100 n[8].e, /* format */
8101 n[9].e, /* type */
8102 n[10].data));
8103 ctx->Unpack = save; /* restore */
8105 break;
8106 case OPCODE_TEX_SUB_IMAGE1D:
8108 const struct gl_pixelstore_attrib save = ctx->Unpack;
8109 ctx->Unpack = ctx->DefaultPacking;
8110 CALL_TexSubImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
8111 n[4].i, n[5].e,
8112 n[6].e, n[7].data));
8113 ctx->Unpack = save; /* restore */
8115 break;
8116 case OPCODE_TEX_SUB_IMAGE2D:
8118 const struct gl_pixelstore_attrib save = ctx->Unpack;
8119 ctx->Unpack = ctx->DefaultPacking;
8120 CALL_TexSubImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
8121 n[4].i, n[5].e,
8122 n[6].i, n[7].e, n[8].e,
8123 n[9].data));
8124 ctx->Unpack = save; /* restore */
8126 break;
8127 case OPCODE_TEX_SUB_IMAGE3D:
8129 const struct gl_pixelstore_attrib save = ctx->Unpack;
8130 ctx->Unpack = ctx->DefaultPacking;
8131 CALL_TexSubImage3D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
8132 n[4].i, n[5].i, n[6].i, n[7].i,
8133 n[8].i, n[9].e, n[10].e,
8134 n[11].data));
8135 ctx->Unpack = save; /* restore */
8137 break;
8138 case OPCODE_TRANSLATE:
8139 CALL_Translatef(ctx->Exec, (n[1].f, n[2].f, n[3].f));
8140 break;
8141 case OPCODE_VIEWPORT:
8142 CALL_Viewport(ctx->Exec, (n[1].i, n[2].i,
8143 (GLsizei) n[3].i, (GLsizei) n[4].i));
8144 break;
8145 case OPCODE_WINDOW_POS:
8146 CALL_WindowPos4fMESA(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
8147 break;
8148 case OPCODE_ACTIVE_TEXTURE: /* GL_ARB_multitexture */
8149 CALL_ActiveTextureARB(ctx->Exec, (n[1].e));
8150 break;
8151 case OPCODE_COMPRESSED_TEX_IMAGE_1D: /* GL_ARB_texture_compression */
8152 CALL_CompressedTexImage1DARB(ctx->Exec, (n[1].e, n[2].i, n[3].e,
8153 n[4].i, n[5].i, n[6].i,
8154 n[7].data));
8155 break;
8156 case OPCODE_COMPRESSED_TEX_IMAGE_2D: /* GL_ARB_texture_compression */
8157 CALL_CompressedTexImage2DARB(ctx->Exec, (n[1].e, n[2].i, n[3].e,
8158 n[4].i, n[5].i, n[6].i,
8159 n[7].i, n[8].data));
8160 break;
8161 case OPCODE_COMPRESSED_TEX_IMAGE_3D: /* GL_ARB_texture_compression */
8162 CALL_CompressedTexImage3DARB(ctx->Exec, (n[1].e, n[2].i, n[3].e,
8163 n[4].i, n[5].i, n[6].i,
8164 n[7].i, n[8].i,
8165 n[9].data));
8166 break;
8167 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D: /* GL_ARB_texture_compress */
8168 CALL_CompressedTexSubImage1DARB(ctx->Exec,
8169 (n[1].e, n[2].i, n[3].i, n[4].i,
8170 n[5].e, n[6].i, n[7].data));
8171 break;
8172 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D: /* GL_ARB_texture_compress */
8173 CALL_CompressedTexSubImage2DARB(ctx->Exec,
8174 (n[1].e, n[2].i, n[3].i, n[4].i,
8175 n[5].i, n[6].i, n[7].e, n[8].i,
8176 n[9].data));
8177 break;
8178 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D: /* GL_ARB_texture_compress */
8179 CALL_CompressedTexSubImage3DARB(ctx->Exec,
8180 (n[1].e, n[2].i, n[3].i, n[4].i,
8181 n[5].i, n[6].i, n[7].i, n[8].i,
8182 n[9].e, n[10].i, n[11].data));
8183 break;
8184 case OPCODE_SAMPLE_COVERAGE: /* GL_ARB_multisample */
8185 CALL_SampleCoverageARB(ctx->Exec, (n[1].f, n[2].b));
8186 break;
8187 case OPCODE_WINDOW_POS_ARB: /* GL_ARB_window_pos */
8188 CALL_WindowPos3fMESA(ctx->Exec, (n[1].f, n[2].f, n[3].f));
8189 break;
8190 #if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
8191 case OPCODE_BIND_PROGRAM_NV: /* GL_NV_vertex_program */
8192 CALL_BindProgramNV(ctx->Exec, (n[1].e, n[2].ui));
8193 break;
8194 #endif
8195 #if FEATURE_NV_vertex_program
8196 case OPCODE_EXECUTE_PROGRAM_NV:
8198 GLfloat v[4];
8199 v[0] = n[3].f;
8200 v[1] = n[4].f;
8201 v[2] = n[5].f;
8202 v[3] = n[6].f;
8203 CALL_ExecuteProgramNV(ctx->Exec, (n[1].e, n[2].ui, v));
8205 break;
8206 case OPCODE_REQUEST_RESIDENT_PROGRAMS_NV:
8207 CALL_RequestResidentProgramsNV(ctx->Exec, (n[1].ui,
8208 (GLuint *) n[2].data));
8209 break;
8210 case OPCODE_LOAD_PROGRAM_NV:
8211 CALL_LoadProgramNV(ctx->Exec, (n[1].e, n[2].ui, n[3].i,
8212 (const GLubyte *) n[4].data));
8213 break;
8214 case OPCODE_TRACK_MATRIX_NV:
8215 CALL_TrackMatrixNV(ctx->Exec, (n[1].e, n[2].ui, n[3].e, n[4].e));
8216 break;
8217 #endif
8219 #if FEATURE_NV_fragment_program
8220 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB:
8221 CALL_ProgramLocalParameter4fARB(ctx->Exec,
8222 (n[1].e, n[2].ui, n[3].f, n[4].f,
8223 n[5].f, n[6].f));
8224 break;
8225 case OPCODE_PROGRAM_NAMED_PARAMETER_NV:
8226 CALL_ProgramNamedParameter4fNV(ctx->Exec, (n[1].ui, n[2].i,
8227 (const GLubyte *) n[3].
8228 data, n[4].f, n[5].f,
8229 n[6].f, n[7].f));
8230 break;
8231 #endif
8233 case OPCODE_ACTIVE_STENCIL_FACE_EXT:
8234 CALL_ActiveStencilFaceEXT(ctx->Exec, (n[1].e));
8235 break;
8236 case OPCODE_DEPTH_BOUNDS_EXT:
8237 CALL_DepthBoundsEXT(ctx->Exec, (n[1].f, n[2].f));
8238 break;
8239 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
8240 case OPCODE_PROGRAM_STRING_ARB:
8241 CALL_ProgramStringARB(ctx->Exec,
8242 (n[1].e, n[2].e, n[3].i, n[4].data));
8243 break;
8244 #endif
8245 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program || FEATURE_NV_vertex_program
8246 case OPCODE_PROGRAM_ENV_PARAMETER_ARB:
8247 CALL_ProgramEnvParameter4fARB(ctx->Exec, (n[1].e, n[2].ui, n[3].f,
8248 n[4].f, n[5].f,
8249 n[6].f));
8250 break;
8251 #endif
8252 #if FEATURE_queryobj
8253 case OPCODE_BEGIN_QUERY_ARB:
8254 CALL_BeginQueryARB(ctx->Exec, (n[1].e, n[2].ui));
8255 break;
8256 case OPCODE_END_QUERY_ARB:
8257 CALL_EndQueryARB(ctx->Exec, (n[1].e));
8258 break;
8259 #endif
8260 case OPCODE_DRAW_BUFFERS_ARB:
8262 GLenum buffers[MAX_DRAW_BUFFERS];
8263 GLint i, count = MIN2(n[1].i, MAX_DRAW_BUFFERS);
8264 for (i = 0; i < count; i++)
8265 buffers[i] = n[2 + i].e;
8266 CALL_DrawBuffersARB(ctx->Exec, (n[1].i, buffers));
8268 break;
8269 #if FEATURE_EXT_framebuffer_blit
8270 case OPCODE_BLIT_FRAMEBUFFER:
8271 CALL_BlitFramebufferEXT(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i,
8272 n[5].i, n[6].i, n[7].i, n[8].i,
8273 n[9].i, n[10].e));
8274 break;
8275 #endif
8277 case OPCODE_USE_PROGRAM:
8278 CALL_UseProgramObjectARB(ctx->Exec, (n[1].ui));
8279 break;
8280 case OPCODE_USE_SHADER_PROGRAM_EXT:
8281 CALL_UseShaderProgramEXT(ctx->Exec, (n[1].ui, n[2].ui));
8282 break;
8283 case OPCODE_ACTIVE_PROGRAM_EXT:
8284 CALL_ActiveProgramEXT(ctx->Exec, (n[1].ui));
8285 break;
8286 case OPCODE_UNIFORM_1F:
8287 CALL_Uniform1fARB(ctx->Exec, (n[1].i, n[2].f));
8288 break;
8289 case OPCODE_UNIFORM_2F:
8290 CALL_Uniform2fARB(ctx->Exec, (n[1].i, n[2].f, n[3].f));
8291 break;
8292 case OPCODE_UNIFORM_3F:
8293 CALL_Uniform3fARB(ctx->Exec, (n[1].i, n[2].f, n[3].f, n[4].f));
8294 break;
8295 case OPCODE_UNIFORM_4F:
8296 CALL_Uniform4fARB(ctx->Exec,
8297 (n[1].i, n[2].f, n[3].f, n[4].f, n[5].f));
8298 break;
8299 case OPCODE_UNIFORM_1FV:
8300 CALL_Uniform1fvARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));
8301 break;
8302 case OPCODE_UNIFORM_2FV:
8303 CALL_Uniform2fvARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));
8304 break;
8305 case OPCODE_UNIFORM_3FV:
8306 CALL_Uniform3fvARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));
8307 break;
8308 case OPCODE_UNIFORM_4FV:
8309 CALL_Uniform4fvARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));
8310 break;
8311 case OPCODE_UNIFORM_1I:
8312 CALL_Uniform1iARB(ctx->Exec, (n[1].i, n[2].i));
8313 break;
8314 case OPCODE_UNIFORM_2I:
8315 CALL_Uniform2iARB(ctx->Exec, (n[1].i, n[2].i, n[3].i));
8316 break;
8317 case OPCODE_UNIFORM_3I:
8318 CALL_Uniform3iARB(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
8319 break;
8320 case OPCODE_UNIFORM_4I:
8321 CALL_Uniform4iARB(ctx->Exec,
8322 (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
8323 break;
8324 case OPCODE_UNIFORM_1IV:
8325 CALL_Uniform1ivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));
8326 break;
8327 case OPCODE_UNIFORM_2IV:
8328 CALL_Uniform2ivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));
8329 break;
8330 case OPCODE_UNIFORM_3IV:
8331 CALL_Uniform3ivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));
8332 break;
8333 case OPCODE_UNIFORM_4IV:
8334 CALL_Uniform4ivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));
8335 break;
8336 case OPCODE_UNIFORM_1UI:
8337 /*CALL_Uniform1uiARB(ctx->Exec, (n[1].i, n[2].i));*/
8338 break;
8339 case OPCODE_UNIFORM_2UI:
8340 /*CALL_Uniform2uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i));*/
8341 break;
8342 case OPCODE_UNIFORM_3UI:
8343 /*CALL_Uniform3uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));*/
8344 break;
8345 case OPCODE_UNIFORM_4UI:
8346 /*CALL_Uniform4uiARB(ctx->Exec,
8347 (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
8349 break;
8350 case OPCODE_UNIFORM_1UIV:
8351 /*CALL_Uniform1uivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));*/
8352 break;
8353 case OPCODE_UNIFORM_2UIV:
8354 /*CALL_Uniform2uivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));*/
8355 break;
8356 case OPCODE_UNIFORM_3UIV:
8357 /*CALL_Uniform3uivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));*/
8358 break;
8359 case OPCODE_UNIFORM_4UIV:
8360 /*CALL_Uniform4uivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));*/
8361 break;
8362 case OPCODE_UNIFORM_MATRIX22:
8363 CALL_UniformMatrix2fvARB(ctx->Exec,
8364 (n[1].i, n[2].i, n[3].b, n[4].data));
8365 break;
8366 case OPCODE_UNIFORM_MATRIX33:
8367 CALL_UniformMatrix3fvARB(ctx->Exec,
8368 (n[1].i, n[2].i, n[3].b, n[4].data));
8369 break;
8370 case OPCODE_UNIFORM_MATRIX44:
8371 CALL_UniformMatrix4fvARB(ctx->Exec,
8372 (n[1].i, n[2].i, n[3].b, n[4].data));
8373 break;
8374 case OPCODE_UNIFORM_MATRIX23:
8375 CALL_UniformMatrix2x3fv(ctx->Exec,
8376 (n[1].i, n[2].i, n[3].b, n[4].data));
8377 break;
8378 case OPCODE_UNIFORM_MATRIX32:
8379 CALL_UniformMatrix3x2fv(ctx->Exec,
8380 (n[1].i, n[2].i, n[3].b, n[4].data));
8381 break;
8382 case OPCODE_UNIFORM_MATRIX24:
8383 CALL_UniformMatrix2x4fv(ctx->Exec,
8384 (n[1].i, n[2].i, n[3].b, n[4].data));
8385 break;
8386 case OPCODE_UNIFORM_MATRIX42:
8387 CALL_UniformMatrix4x2fv(ctx->Exec,
8388 (n[1].i, n[2].i, n[3].b, n[4].data));
8389 break;
8390 case OPCODE_UNIFORM_MATRIX34:
8391 CALL_UniformMatrix3x4fv(ctx->Exec,
8392 (n[1].i, n[2].i, n[3].b, n[4].data));
8393 break;
8394 case OPCODE_UNIFORM_MATRIX43:
8395 CALL_UniformMatrix4x3fv(ctx->Exec,
8396 (n[1].i, n[2].i, n[3].b, n[4].data));
8397 break;
8399 case OPCODE_CLAMP_COLOR:
8400 CALL_ClampColorARB(ctx->Exec, (n[1].e, n[2].e));
8401 break;
8403 case OPCODE_TEX_BUMP_PARAMETER_ATI:
8405 GLfloat values[4];
8406 GLuint i, pname = n[1].ui;
8408 for (i = 0; i < 4; i++)
8409 values[i] = n[1 + i].f;
8410 CALL_TexBumpParameterfvATI(ctx->Exec, (pname, values));
8412 break;
8413 #if FEATURE_ATI_fragment_shader
8414 case OPCODE_BIND_FRAGMENT_SHADER_ATI:
8415 CALL_BindFragmentShaderATI(ctx->Exec, (n[1].i));
8416 break;
8417 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI:
8419 GLfloat values[4];
8420 GLuint i, dst = n[1].ui;
8422 for (i = 0; i < 4; i++)
8423 values[i] = n[1 + i].f;
8424 CALL_SetFragmentShaderConstantATI(ctx->Exec, (dst, values));
8426 break;
8427 #endif
8428 case OPCODE_ATTR_1F_NV:
8429 CALL_VertexAttrib1fNV(ctx->Exec, (n[1].e, n[2].f));
8430 break;
8431 case OPCODE_ATTR_2F_NV:
8432 /* Really shouldn't have to do this - the Node structure
8433 * is convenient, but it would be better to store the data
8434 * packed appropriately so that it can be sent directly
8435 * on. With x86_64 becoming common, this will start to
8436 * matter more.
8438 if (sizeof(Node) == sizeof(GLfloat))
8439 CALL_VertexAttrib2fvNV(ctx->Exec, (n[1].e, &n[2].f));
8440 else
8441 CALL_VertexAttrib2fNV(ctx->Exec, (n[1].e, n[2].f, n[3].f));
8442 break;
8443 case OPCODE_ATTR_3F_NV:
8444 if (sizeof(Node) == sizeof(GLfloat))
8445 CALL_VertexAttrib3fvNV(ctx->Exec, (n[1].e, &n[2].f));
8446 else
8447 CALL_VertexAttrib3fNV(ctx->Exec, (n[1].e, n[2].f, n[3].f,
8448 n[4].f));
8449 break;
8450 case OPCODE_ATTR_4F_NV:
8451 if (sizeof(Node) == sizeof(GLfloat))
8452 CALL_VertexAttrib4fvNV(ctx->Exec, (n[1].e, &n[2].f));
8453 else
8454 CALL_VertexAttrib4fNV(ctx->Exec, (n[1].e, n[2].f, n[3].f,
8455 n[4].f, n[5].f));
8456 break;
8457 case OPCODE_ATTR_1F_ARB:
8458 CALL_VertexAttrib1fARB(ctx->Exec, (n[1].e, n[2].f));
8459 break;
8460 case OPCODE_ATTR_2F_ARB:
8461 /* Really shouldn't have to do this - the Node structure
8462 * is convenient, but it would be better to store the data
8463 * packed appropriately so that it can be sent directly
8464 * on. With x86_64 becoming common, this will start to
8465 * matter more.
8467 if (sizeof(Node) == sizeof(GLfloat))
8468 CALL_VertexAttrib2fvARB(ctx->Exec, (n[1].e, &n[2].f));
8469 else
8470 CALL_VertexAttrib2fARB(ctx->Exec, (n[1].e, n[2].f, n[3].f));
8471 break;
8472 case OPCODE_ATTR_3F_ARB:
8473 if (sizeof(Node) == sizeof(GLfloat))
8474 CALL_VertexAttrib3fvARB(ctx->Exec, (n[1].e, &n[2].f));
8475 else
8476 CALL_VertexAttrib3fARB(ctx->Exec, (n[1].e, n[2].f, n[3].f,
8477 n[4].f));
8478 break;
8479 case OPCODE_ATTR_4F_ARB:
8480 if (sizeof(Node) == sizeof(GLfloat))
8481 CALL_VertexAttrib4fvARB(ctx->Exec, (n[1].e, &n[2].f));
8482 else
8483 CALL_VertexAttrib4fARB(ctx->Exec, (n[1].e, n[2].f, n[3].f,
8484 n[4].f, n[5].f));
8485 break;
8486 case OPCODE_MATERIAL:
8487 if (sizeof(Node) == sizeof(GLfloat))
8488 CALL_Materialfv(ctx->Exec, (n[1].e, n[2].e, &n[3].f));
8489 else {
8490 GLfloat f[4];
8491 f[0] = n[3].f;
8492 f[1] = n[4].f;
8493 f[2] = n[5].f;
8494 f[3] = n[6].f;
8495 CALL_Materialfv(ctx->Exec, (n[1].e, n[2].e, f));
8497 break;
8498 case OPCODE_BEGIN:
8499 CALL_Begin(ctx->Exec, (n[1].e));
8500 break;
8501 case OPCODE_END:
8502 CALL_End(ctx->Exec, ());
8503 break;
8504 case OPCODE_RECTF:
8505 CALL_Rectf(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
8506 break;
8507 case OPCODE_EVAL_C1:
8508 CALL_EvalCoord1f(ctx->Exec, (n[1].f));
8509 break;
8510 case OPCODE_EVAL_C2:
8511 CALL_EvalCoord2f(ctx->Exec, (n[1].f, n[2].f));
8512 break;
8513 case OPCODE_EVAL_P1:
8514 CALL_EvalPoint1(ctx->Exec, (n[1].i));
8515 break;
8516 case OPCODE_EVAL_P2:
8517 CALL_EvalPoint2(ctx->Exec, (n[1].i, n[2].i));
8518 break;
8520 /* GL_EXT_texture_integer */
8521 case OPCODE_CLEARCOLOR_I:
8522 CALL_ClearColorIiEXT(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
8523 break;
8524 case OPCODE_CLEARCOLOR_UI:
8525 CALL_ClearColorIuiEXT(ctx->Exec,
8526 (n[1].ui, n[2].ui, n[3].ui, n[4].ui));
8527 break;
8528 case OPCODE_TEXPARAMETER_I:
8530 GLint params[4];
8531 params[0] = n[3].i;
8532 params[1] = n[4].i;
8533 params[2] = n[5].i;
8534 params[3] = n[6].i;
8535 CALL_TexParameterIivEXT(ctx->Exec, (n[1].e, n[2].e, params));
8537 break;
8538 case OPCODE_TEXPARAMETER_UI:
8540 GLuint params[4];
8541 params[0] = n[3].ui;
8542 params[1] = n[4].ui;
8543 params[2] = n[5].ui;
8544 params[3] = n[6].ui;
8545 CALL_TexParameterIuivEXT(ctx->Exec, (n[1].e, n[2].e, params));
8547 break;
8549 case OPCODE_VERTEX_ATTRIB_DIVISOR:
8550 /* GL_ARB_instanced_arrays */
8551 CALL_VertexAttribDivisorARB(ctx->Exec, (n[1].ui, n[2].ui));
8552 break;
8554 case OPCODE_TEXTURE_BARRIER_NV:
8555 CALL_TextureBarrierNV(ctx->Exec, ());
8556 break;
8558 /* GL_EXT/ARB_transform_feedback */
8559 case OPCODE_BEGIN_TRANSFORM_FEEDBACK:
8560 CALL_BeginTransformFeedbackEXT(ctx->Exec, (n[1].e));
8561 break;
8562 case OPCODE_END_TRANSFORM_FEEDBACK:
8563 CALL_EndTransformFeedbackEXT(ctx->Exec, ());
8564 break;
8565 case OPCODE_BIND_TRANSFORM_FEEDBACK:
8566 CALL_BindTransformFeedback(ctx->Exec, (n[1].e, n[2].ui));
8567 break;
8568 case OPCODE_PAUSE_TRANSFORM_FEEDBACK:
8569 CALL_PauseTransformFeedback(ctx->Exec, ());
8570 break;
8571 case OPCODE_RESUME_TRANSFORM_FEEDBACK:
8572 CALL_ResumeTransformFeedback(ctx->Exec, ());
8573 break;
8574 case OPCODE_DRAW_TRANSFORM_FEEDBACK:
8575 CALL_DrawTransformFeedback(ctx->Exec, (n[1].e, n[2].ui));
8576 break;
8579 case OPCODE_BIND_SAMPLER:
8580 CALL_BindSampler(ctx->Exec, (n[1].ui, n[2].ui));
8581 break;
8582 case OPCODE_SAMPLER_PARAMETERIV:
8584 GLint params[4];
8585 params[0] = n[3].i;
8586 params[1] = n[4].i;
8587 params[2] = n[5].i;
8588 params[3] = n[6].i;
8589 CALL_SamplerParameteriv(ctx->Exec, (n[1].ui, n[2].e, params));
8591 break;
8592 case OPCODE_SAMPLER_PARAMETERFV:
8594 GLfloat params[4];
8595 params[0] = n[3].f;
8596 params[1] = n[4].f;
8597 params[2] = n[5].f;
8598 params[3] = n[6].f;
8599 CALL_SamplerParameterfv(ctx->Exec, (n[1].ui, n[2].e, params));
8601 break;
8602 case OPCODE_SAMPLER_PARAMETERIIV:
8604 GLint params[4];
8605 params[0] = n[3].i;
8606 params[1] = n[4].i;
8607 params[2] = n[5].i;
8608 params[3] = n[6].i;
8609 CALL_SamplerParameterIiv(ctx->Exec, (n[1].ui, n[2].e, params));
8611 break;
8612 case OPCODE_SAMPLER_PARAMETERUIV:
8614 GLuint params[4];
8615 params[0] = n[3].ui;
8616 params[1] = n[4].ui;
8617 params[2] = n[5].ui;
8618 params[3] = n[6].ui;
8619 CALL_SamplerParameterIuiv(ctx->Exec, (n[1].ui, n[2].e, params));
8621 break;
8623 /* GL_ARB_geometry_shader4 */
8624 case OPCODE_PROGRAM_PARAMETERI:
8625 CALL_ProgramParameteriARB(ctx->Exec, (n[1].ui, n[2].e, n[3].i));
8626 break;
8627 case OPCODE_FRAMEBUFFER_TEXTURE:
8628 CALL_FramebufferTextureARB(ctx->Exec, (n[1].e, n[2].e,
8629 n[3].ui, n[4].i));
8630 break;
8631 case OPCODE_FRAMEBUFFER_TEXTURE_FACE:
8632 CALL_FramebufferTextureFaceARB(ctx->Exec, (n[1].e, n[2].e,
8633 n[3].ui, n[4].i, n[5].e));
8634 break;
8636 /* GL_ARB_sync */
8637 case OPCODE_WAIT_SYNC:
8639 union uint64_pair p;
8640 p.uint32[0] = n[3].ui;
8641 p.uint32[1] = n[4].ui;
8642 CALL_WaitSync(ctx->Exec, (n[1].data, n[2].bf, p.uint64));
8644 break;
8646 case OPCODE_CONTINUE:
8647 n = (Node *) n[1].next;
8648 break;
8649 case OPCODE_END_OF_LIST:
8650 done = GL_TRUE;
8651 break;
8652 default:
8654 char msg[1000];
8655 _mesa_snprintf(msg, sizeof(msg), "Error in execute_list: opcode=%d",
8656 (int) opcode);
8657 _mesa_problem(ctx, "%s", msg);
8659 done = GL_TRUE;
8662 /* increment n to point to next compiled command */
8663 if (opcode != OPCODE_CONTINUE) {
8664 n += InstSize[opcode];
8669 if (ctx->Driver.EndCallList)
8670 ctx->Driver.EndCallList(ctx);
8672 ctx->ListState.CallDepth--;
8677 /**********************************************************************/
8678 /* GL functions */
8679 /**********************************************************************/
8682 * Test if a display list number is valid.
8684 static GLboolean GLAPIENTRY
8685 _mesa_IsList(GLuint list)
8687 GET_CURRENT_CONTEXT(ctx);
8688 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
8689 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
8690 return islist(ctx, list);
8695 * Delete a sequence of consecutive display lists.
8697 static void GLAPIENTRY
8698 _mesa_DeleteLists(GLuint list, GLsizei range)
8700 GET_CURRENT_CONTEXT(ctx);
8701 GLuint i;
8702 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
8703 ASSERT_OUTSIDE_BEGIN_END(ctx);
8705 if (range < 0) {
8706 _mesa_error(ctx, GL_INVALID_VALUE, "glDeleteLists");
8707 return;
8709 for (i = list; i < list + range; i++) {
8710 destroy_list(ctx, i);
8716 * Return a display list number, n, such that lists n through n+range-1
8717 * are free.
8719 static GLuint GLAPIENTRY
8720 _mesa_GenLists(GLsizei range)
8722 GET_CURRENT_CONTEXT(ctx);
8723 GLuint base;
8724 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
8725 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
8727 if (range < 0) {
8728 _mesa_error(ctx, GL_INVALID_VALUE, "glGenLists");
8729 return 0;
8731 if (range == 0) {
8732 return 0;
8736 * Make this an atomic operation
8738 _glthread_LOCK_MUTEX(ctx->Shared->Mutex);
8740 base = _mesa_HashFindFreeKeyBlock(ctx->Shared->DisplayList, range);
8741 if (base) {
8742 /* reserve the list IDs by with empty/dummy lists */
8743 GLint i;
8744 for (i = 0; i < range; i++) {
8745 _mesa_HashInsert(ctx->Shared->DisplayList, base + i,
8746 make_list(base + i, 1));
8750 _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
8752 return base;
8757 * Begin a new display list.
8759 static void GLAPIENTRY
8760 _mesa_NewList(GLuint name, GLenum mode)
8762 GET_CURRENT_CONTEXT(ctx);
8764 FLUSH_CURRENT(ctx, 0); /* must be called before assert */
8765 ASSERT_OUTSIDE_BEGIN_END(ctx);
8767 if (MESA_VERBOSE & VERBOSE_API)
8768 _mesa_debug(ctx, "glNewList %u %s\n", name,
8769 _mesa_lookup_enum_by_nr(mode));
8771 if (name == 0) {
8772 _mesa_error(ctx, GL_INVALID_VALUE, "glNewList");
8773 return;
8776 if (mode != GL_COMPILE && mode != GL_COMPILE_AND_EXECUTE) {
8777 _mesa_error(ctx, GL_INVALID_ENUM, "glNewList");
8778 return;
8781 if (ctx->ListState.CurrentList) {
8782 /* already compiling a display list */
8783 _mesa_error(ctx, GL_INVALID_OPERATION, "glNewList");
8784 return;
8787 ctx->CompileFlag = GL_TRUE;
8788 ctx->ExecuteFlag = (mode == GL_COMPILE_AND_EXECUTE);
8790 /* Reset acumulated list state:
8792 invalidate_saved_current_state( ctx );
8794 /* Allocate new display list */
8795 ctx->ListState.CurrentList = make_list(name, BLOCK_SIZE);
8796 ctx->ListState.CurrentBlock = ctx->ListState.CurrentList->Head;
8797 ctx->ListState.CurrentPos = 0;
8799 ctx->Driver.NewList(ctx, name, mode);
8801 ctx->CurrentDispatch = ctx->Save;
8802 _glapi_set_dispatch(ctx->CurrentDispatch);
8807 * End definition of current display list.
8809 static void GLAPIENTRY
8810 _mesa_EndList(void)
8812 GET_CURRENT_CONTEXT(ctx);
8813 SAVE_FLUSH_VERTICES(ctx);
8814 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
8816 if (MESA_VERBOSE & VERBOSE_API)
8817 _mesa_debug(ctx, "glEndList\n");
8819 /* Check that a list is under construction */
8820 if (!ctx->ListState.CurrentList) {
8821 _mesa_error(ctx, GL_INVALID_OPERATION, "glEndList");
8822 return;
8825 /* Call before emitting END_OF_LIST, in case the driver wants to
8826 * emit opcodes itself.
8828 ctx->Driver.EndList(ctx);
8830 (void) alloc_instruction(ctx, OPCODE_END_OF_LIST, 0);
8832 /* Destroy old list, if any */
8833 destroy_list(ctx, ctx->ListState.CurrentList->Name);
8835 /* Install the new list */
8836 _mesa_HashInsert(ctx->Shared->DisplayList,
8837 ctx->ListState.CurrentList->Name,
8838 ctx->ListState.CurrentList);
8841 if (MESA_VERBOSE & VERBOSE_DISPLAY_LIST)
8842 mesa_print_display_list(ctx->ListState.CurrentList->Name);
8844 ctx->ListState.CurrentList = NULL;
8845 ctx->ExecuteFlag = GL_TRUE;
8846 ctx->CompileFlag = GL_FALSE;
8848 ctx->CurrentDispatch = ctx->Exec;
8849 _glapi_set_dispatch(ctx->CurrentDispatch);
8853 void GLAPIENTRY
8854 _mesa_CallList(GLuint list)
8856 GLboolean save_compile_flag;
8857 GET_CURRENT_CONTEXT(ctx);
8858 FLUSH_CURRENT(ctx, 0);
8860 if (MESA_VERBOSE & VERBOSE_API)
8861 _mesa_debug(ctx, "glCallList %d\n", list);
8863 if (list == 0) {
8864 _mesa_error(ctx, GL_INVALID_VALUE, "glCallList(list==0)");
8865 return;
8868 if (0)
8869 mesa_print_display_list( list );
8871 /* VERY IMPORTANT: Save the CompileFlag status, turn it off,
8872 * execute the display list, and restore the CompileFlag.
8874 save_compile_flag = ctx->CompileFlag;
8875 if (save_compile_flag) {
8876 ctx->CompileFlag = GL_FALSE;
8879 execute_list(ctx, list);
8880 ctx->CompileFlag = save_compile_flag;
8882 /* also restore API function pointers to point to "save" versions */
8883 if (save_compile_flag) {
8884 ctx->CurrentDispatch = ctx->Save;
8885 _glapi_set_dispatch(ctx->CurrentDispatch);
8891 * Execute glCallLists: call multiple display lists.
8893 void GLAPIENTRY
8894 _mesa_CallLists(GLsizei n, GLenum type, const GLvoid * lists)
8896 GET_CURRENT_CONTEXT(ctx);
8897 GLint i;
8898 GLboolean save_compile_flag;
8900 if (MESA_VERBOSE & VERBOSE_API)
8901 _mesa_debug(ctx, "glCallLists %d\n", n);
8903 switch (type) {
8904 case GL_BYTE:
8905 case GL_UNSIGNED_BYTE:
8906 case GL_SHORT:
8907 case GL_UNSIGNED_SHORT:
8908 case GL_INT:
8909 case GL_UNSIGNED_INT:
8910 case GL_FLOAT:
8911 case GL_2_BYTES:
8912 case GL_3_BYTES:
8913 case GL_4_BYTES:
8914 /* OK */
8915 break;
8916 default:
8917 _mesa_error(ctx, GL_INVALID_ENUM, "glCallLists(type)");
8918 return;
8921 /* Save the CompileFlag status, turn it off, execute display list,
8922 * and restore the CompileFlag.
8924 save_compile_flag = ctx->CompileFlag;
8925 ctx->CompileFlag = GL_FALSE;
8927 for (i = 0; i < n; i++) {
8928 GLuint list = (GLuint) (ctx->List.ListBase + translate_id(i, type, lists));
8929 execute_list(ctx, list);
8932 ctx->CompileFlag = save_compile_flag;
8934 /* also restore API function pointers to point to "save" versions */
8935 if (save_compile_flag) {
8936 ctx->CurrentDispatch = ctx->Save;
8937 _glapi_set_dispatch(ctx->CurrentDispatch);
8943 * Set the offset added to list numbers in glCallLists.
8945 static void GLAPIENTRY
8946 _mesa_ListBase(GLuint base)
8948 GET_CURRENT_CONTEXT(ctx);
8949 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
8950 ASSERT_OUTSIDE_BEGIN_END(ctx);
8951 ctx->List.ListBase = base;
8955 /* Can no longer assume ctx->Exec->Func is equal to _mesa_Func.
8957 static void GLAPIENTRY
8958 exec_Finish(void)
8960 GET_CURRENT_CONTEXT(ctx);
8961 FLUSH_VERTICES(ctx, 0);
8962 CALL_Finish(ctx->Exec, ());
8965 static void GLAPIENTRY
8966 exec_Flush(void)
8968 GET_CURRENT_CONTEXT(ctx);
8969 FLUSH_VERTICES(ctx, 0);
8970 CALL_Flush(ctx->Exec, ());
8973 static void GLAPIENTRY
8974 exec_GetBooleanv(GLenum pname, GLboolean *params)
8976 GET_CURRENT_CONTEXT(ctx);
8977 FLUSH_VERTICES(ctx, 0);
8978 CALL_GetBooleanv(ctx->Exec, (pname, params));
8981 static void GLAPIENTRY
8982 exec_GetClipPlane(GLenum plane, GLdouble * equation)
8984 GET_CURRENT_CONTEXT(ctx);
8985 FLUSH_VERTICES(ctx, 0);
8986 CALL_GetClipPlane(ctx->Exec, (plane, equation));
8989 static void GLAPIENTRY
8990 exec_GetDoublev(GLenum pname, GLdouble *params)
8992 GET_CURRENT_CONTEXT(ctx);
8993 FLUSH_VERTICES(ctx, 0);
8994 CALL_GetDoublev(ctx->Exec, (pname, params));
8997 static GLenum GLAPIENTRY
8998 exec_GetError(void)
9000 GET_CURRENT_CONTEXT(ctx);
9001 FLUSH_VERTICES(ctx, 0);
9002 return CALL_GetError(ctx->Exec, ());
9005 static void GLAPIENTRY
9006 exec_GetFloatv(GLenum pname, GLfloat *params)
9008 GET_CURRENT_CONTEXT(ctx);
9009 FLUSH_VERTICES(ctx, 0);
9010 CALL_GetFloatv(ctx->Exec, (pname, params));
9013 static void GLAPIENTRY
9014 exec_GetIntegerv(GLenum pname, GLint *params)
9016 GET_CURRENT_CONTEXT(ctx);
9017 FLUSH_VERTICES(ctx, 0);
9018 CALL_GetIntegerv(ctx->Exec, (pname, params));
9021 static void GLAPIENTRY
9022 exec_GetLightfv(GLenum light, GLenum pname, GLfloat *params)
9024 GET_CURRENT_CONTEXT(ctx);
9025 FLUSH_VERTICES(ctx, 0);
9026 CALL_GetLightfv(ctx->Exec, (light, pname, params));
9029 static void GLAPIENTRY
9030 exec_GetLightiv(GLenum light, GLenum pname, GLint *params)
9032 GET_CURRENT_CONTEXT(ctx);
9033 FLUSH_VERTICES(ctx, 0);
9034 CALL_GetLightiv(ctx->Exec, (light, pname, params));
9037 static void GLAPIENTRY
9038 exec_GetMapdv(GLenum target, GLenum query, GLdouble * v)
9040 GET_CURRENT_CONTEXT(ctx);
9041 FLUSH_VERTICES(ctx, 0);
9042 CALL_GetMapdv(ctx->Exec, (target, query, v));
9045 static void GLAPIENTRY
9046 exec_GetMapfv(GLenum target, GLenum query, GLfloat * v)
9048 GET_CURRENT_CONTEXT(ctx);
9049 FLUSH_VERTICES(ctx, 0);
9050 CALL_GetMapfv(ctx->Exec, (target, query, v));
9053 static void GLAPIENTRY
9054 exec_GetMapiv(GLenum target, GLenum query, GLint * v)
9056 GET_CURRENT_CONTEXT(ctx);
9057 FLUSH_VERTICES(ctx, 0);
9058 CALL_GetMapiv(ctx->Exec, (target, query, v));
9061 static void GLAPIENTRY
9062 exec_GetMaterialfv(GLenum face, GLenum pname, GLfloat *params)
9064 GET_CURRENT_CONTEXT(ctx);
9065 FLUSH_VERTICES(ctx, 0);
9066 CALL_GetMaterialfv(ctx->Exec, (face, pname, params));
9069 static void GLAPIENTRY
9070 exec_GetMaterialiv(GLenum face, GLenum pname, GLint *params)
9072 GET_CURRENT_CONTEXT(ctx);
9073 FLUSH_VERTICES(ctx, 0);
9074 CALL_GetMaterialiv(ctx->Exec, (face, pname, params));
9077 static void GLAPIENTRY
9078 exec_GetPixelMapfv(GLenum map, GLfloat *values)
9080 GET_CURRENT_CONTEXT(ctx);
9081 FLUSH_VERTICES(ctx, 0);
9082 CALL_GetPixelMapfv(ctx->Exec, (map, values));
9085 static void GLAPIENTRY
9086 exec_GetPixelMapuiv(GLenum map, GLuint *values)
9088 GET_CURRENT_CONTEXT(ctx);
9089 FLUSH_VERTICES(ctx, 0);
9090 CALL_GetPixelMapuiv(ctx->Exec, (map, values));
9093 static void GLAPIENTRY
9094 exec_GetPixelMapusv(GLenum map, GLushort *values)
9096 GET_CURRENT_CONTEXT(ctx);
9097 FLUSH_VERTICES(ctx, 0);
9098 CALL_GetPixelMapusv(ctx->Exec, (map, values));
9101 static void GLAPIENTRY
9102 exec_GetPolygonStipple(GLubyte * dest)
9104 GET_CURRENT_CONTEXT(ctx);
9105 FLUSH_VERTICES(ctx, 0);
9106 CALL_GetPolygonStipple(ctx->Exec, (dest));
9109 static const GLubyte *GLAPIENTRY
9110 exec_GetString(GLenum name)
9112 GET_CURRENT_CONTEXT(ctx);
9113 FLUSH_VERTICES(ctx, 0);
9114 return CALL_GetString(ctx->Exec, (name));
9117 static void GLAPIENTRY
9118 exec_GetTexEnvfv(GLenum target, GLenum pname, GLfloat *params)
9120 GET_CURRENT_CONTEXT(ctx);
9121 FLUSH_VERTICES(ctx, 0);
9122 CALL_GetTexEnvfv(ctx->Exec, (target, pname, params));
9125 static void GLAPIENTRY
9126 exec_GetTexEnviv(GLenum target, GLenum pname, GLint *params)
9128 GET_CURRENT_CONTEXT(ctx);
9129 FLUSH_VERTICES(ctx, 0);
9130 CALL_GetTexEnviv(ctx->Exec, (target, pname, params));
9133 static void GLAPIENTRY
9134 exec_GetTexGendv(GLenum coord, GLenum pname, GLdouble *params)
9136 GET_CURRENT_CONTEXT(ctx);
9137 FLUSH_VERTICES(ctx, 0);
9138 CALL_GetTexGendv(ctx->Exec, (coord, pname, params));
9141 static void GLAPIENTRY
9142 exec_GetTexGenfv(GLenum coord, GLenum pname, GLfloat *params)
9144 GET_CURRENT_CONTEXT(ctx);
9145 FLUSH_VERTICES(ctx, 0);
9146 CALL_GetTexGenfv(ctx->Exec, (coord, pname, params));
9149 static void GLAPIENTRY
9150 exec_GetTexGeniv(GLenum coord, GLenum pname, GLint *params)
9152 GET_CURRENT_CONTEXT(ctx);
9153 FLUSH_VERTICES(ctx, 0);
9154 CALL_GetTexGeniv(ctx->Exec, (coord, pname, params));
9157 static void GLAPIENTRY
9158 exec_GetTexImage(GLenum target, GLint level, GLenum format,
9159 GLenum type, GLvoid * pixels)
9161 GET_CURRENT_CONTEXT(ctx);
9162 FLUSH_VERTICES(ctx, 0);
9163 CALL_GetTexImage(ctx->Exec, (target, level, format, type, pixels));
9166 static void GLAPIENTRY
9167 exec_GetTexLevelParameterfv(GLenum target, GLint level,
9168 GLenum pname, GLfloat *params)
9170 GET_CURRENT_CONTEXT(ctx);
9171 FLUSH_VERTICES(ctx, 0);
9172 CALL_GetTexLevelParameterfv(ctx->Exec, (target, level, pname, params));
9175 static void GLAPIENTRY
9176 exec_GetTexLevelParameteriv(GLenum target, GLint level,
9177 GLenum pname, GLint *params)
9179 GET_CURRENT_CONTEXT(ctx);
9180 FLUSH_VERTICES(ctx, 0);
9181 CALL_GetTexLevelParameteriv(ctx->Exec, (target, level, pname, params));
9184 static void GLAPIENTRY
9185 exec_GetTexParameterfv(GLenum target, GLenum pname, GLfloat *params)
9187 GET_CURRENT_CONTEXT(ctx);
9188 FLUSH_VERTICES(ctx, 0);
9189 CALL_GetTexParameterfv(ctx->Exec, (target, pname, params));
9192 static void GLAPIENTRY
9193 exec_GetTexParameteriv(GLenum target, GLenum pname, GLint *params)
9195 GET_CURRENT_CONTEXT(ctx);
9196 FLUSH_VERTICES(ctx, 0);
9197 CALL_GetTexParameteriv(ctx->Exec, (target, pname, params));
9200 static GLboolean GLAPIENTRY
9201 exec_IsEnabled(GLenum cap)
9203 GET_CURRENT_CONTEXT(ctx);
9204 FLUSH_VERTICES(ctx, 0);
9205 return CALL_IsEnabled(ctx->Exec, (cap));
9208 static void GLAPIENTRY
9209 exec_PixelStoref(GLenum pname, GLfloat param)
9211 GET_CURRENT_CONTEXT(ctx);
9212 FLUSH_VERTICES(ctx, 0);
9213 CALL_PixelStoref(ctx->Exec, (pname, param));
9216 static void GLAPIENTRY
9217 exec_PixelStorei(GLenum pname, GLint param)
9219 GET_CURRENT_CONTEXT(ctx);
9220 FLUSH_VERTICES(ctx, 0);
9221 CALL_PixelStorei(ctx->Exec, (pname, param));
9224 static void GLAPIENTRY
9225 exec_ReadPixels(GLint x, GLint y, GLsizei width, GLsizei height,
9226 GLenum format, GLenum type, GLvoid * pixels)
9228 GET_CURRENT_CONTEXT(ctx);
9229 FLUSH_VERTICES(ctx, 0);
9230 CALL_ReadPixels(ctx->Exec, (x, y, width, height, format, type, pixels));
9233 static GLint GLAPIENTRY
9234 exec_RenderMode(GLenum mode)
9236 GET_CURRENT_CONTEXT(ctx);
9237 FLUSH_VERTICES(ctx, 0);
9238 return CALL_RenderMode(ctx->Exec, (mode));
9241 static void GLAPIENTRY
9242 exec_FeedbackBuffer(GLsizei size, GLenum type, GLfloat * buffer)
9244 GET_CURRENT_CONTEXT(ctx);
9245 FLUSH_VERTICES(ctx, 0);
9246 CALL_FeedbackBuffer(ctx->Exec, (size, type, buffer));
9249 static void GLAPIENTRY
9250 exec_SelectBuffer(GLsizei size, GLuint * buffer)
9252 GET_CURRENT_CONTEXT(ctx);
9253 FLUSH_VERTICES(ctx, 0);
9254 CALL_SelectBuffer(ctx->Exec, (size, buffer));
9257 static GLboolean GLAPIENTRY
9258 exec_AreTexturesResident(GLsizei n, const GLuint * texName,
9259 GLboolean * residences)
9261 GET_CURRENT_CONTEXT(ctx);
9262 FLUSH_VERTICES(ctx, 0);
9263 return CALL_AreTexturesResident(ctx->Exec, (n, texName, residences));
9266 static void GLAPIENTRY
9267 exec_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
9269 GET_CURRENT_CONTEXT(ctx);
9270 FLUSH_VERTICES(ctx, 0);
9271 CALL_ColorPointer(ctx->Exec, (size, type, stride, ptr));
9274 static void GLAPIENTRY
9275 exec_DeleteTextures(GLsizei n, const GLuint * texName)
9277 GET_CURRENT_CONTEXT(ctx);
9278 FLUSH_VERTICES(ctx, 0);
9279 CALL_DeleteTextures(ctx->Exec, (n, texName));
9282 static void GLAPIENTRY
9283 exec_DisableClientState(GLenum cap)
9285 GET_CURRENT_CONTEXT(ctx);
9286 FLUSH_VERTICES(ctx, 0);
9287 CALL_DisableClientState(ctx->Exec, (cap));
9290 static void GLAPIENTRY
9291 exec_EdgeFlagPointer(GLsizei stride, const GLvoid * vptr)
9293 GET_CURRENT_CONTEXT(ctx);
9294 FLUSH_VERTICES(ctx, 0);
9295 CALL_EdgeFlagPointer(ctx->Exec, (stride, vptr));
9298 static void GLAPIENTRY
9299 exec_EnableClientState(GLenum cap)
9301 GET_CURRENT_CONTEXT(ctx);
9302 FLUSH_VERTICES(ctx, 0);
9303 CALL_EnableClientState(ctx->Exec, (cap));
9306 static void GLAPIENTRY
9307 exec_GenTextures(GLsizei n, GLuint * texName)
9309 GET_CURRENT_CONTEXT(ctx);
9310 FLUSH_VERTICES(ctx, 0);
9311 CALL_GenTextures(ctx->Exec, (n, texName));
9314 static void GLAPIENTRY
9315 exec_GetPointerv(GLenum pname, GLvoid **params)
9317 GET_CURRENT_CONTEXT(ctx);
9318 FLUSH_VERTICES(ctx, 0);
9319 CALL_GetPointerv(ctx->Exec, (pname, params));
9322 static void GLAPIENTRY
9323 exec_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr)
9325 GET_CURRENT_CONTEXT(ctx);
9326 FLUSH_VERTICES(ctx, 0);
9327 CALL_IndexPointer(ctx->Exec, (type, stride, ptr));
9330 static void GLAPIENTRY
9331 exec_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid * pointer)
9333 GET_CURRENT_CONTEXT(ctx);
9334 FLUSH_VERTICES(ctx, 0);
9335 CALL_InterleavedArrays(ctx->Exec, (format, stride, pointer));
9338 static GLboolean GLAPIENTRY
9339 exec_IsTexture(GLuint texture)
9341 GET_CURRENT_CONTEXT(ctx);
9342 FLUSH_VERTICES(ctx, 0);
9343 return CALL_IsTexture(ctx->Exec, (texture));
9346 static void GLAPIENTRY
9347 exec_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr)
9349 GET_CURRENT_CONTEXT(ctx);
9350 FLUSH_VERTICES(ctx, 0);
9351 CALL_NormalPointer(ctx->Exec, (type, stride, ptr));
9354 static void GLAPIENTRY
9355 exec_PopClientAttrib(void)
9357 GET_CURRENT_CONTEXT(ctx);
9358 FLUSH_VERTICES(ctx, 0);
9359 CALL_PopClientAttrib(ctx->Exec, ());
9362 static void GLAPIENTRY
9363 exec_PushClientAttrib(GLbitfield mask)
9365 GET_CURRENT_CONTEXT(ctx);
9366 FLUSH_VERTICES(ctx, 0);
9367 CALL_PushClientAttrib(ctx->Exec, (mask));
9370 static void GLAPIENTRY
9371 exec_TexCoordPointer(GLint size, GLenum type, GLsizei stride,
9372 const GLvoid *ptr)
9374 GET_CURRENT_CONTEXT(ctx);
9375 FLUSH_VERTICES(ctx, 0);
9376 CALL_TexCoordPointer(ctx->Exec, (size, type, stride, ptr));
9379 static void GLAPIENTRY
9380 exec_GetCompressedTexImageARB(GLenum target, GLint level, GLvoid * img)
9382 GET_CURRENT_CONTEXT(ctx);
9383 FLUSH_VERTICES(ctx, 0);
9384 CALL_GetCompressedTexImageARB(ctx->Exec, (target, level, img));
9387 static void GLAPIENTRY
9388 exec_VertexPointer(GLint size, GLenum type, GLsizei stride,
9389 const GLvoid *ptr)
9391 GET_CURRENT_CONTEXT(ctx);
9392 FLUSH_VERTICES(ctx, 0);
9393 CALL_VertexPointer(ctx->Exec, (size, type, stride, ptr));
9396 static void GLAPIENTRY
9397 exec_CopyConvolutionFilter1D(GLenum target, GLenum internalFormat,
9398 GLint x, GLint y, GLsizei width)
9400 GET_CURRENT_CONTEXT(ctx);
9401 FLUSH_VERTICES(ctx, 0);
9402 CALL_CopyConvolutionFilter1D(ctx->Exec,
9403 (target, internalFormat, x, y, width));
9406 static void GLAPIENTRY
9407 exec_CopyConvolutionFilter2D(GLenum target, GLenum internalFormat,
9408 GLint x, GLint y, GLsizei width, GLsizei height)
9410 GET_CURRENT_CONTEXT(ctx);
9411 FLUSH_VERTICES(ctx, 0);
9412 CALL_CopyConvolutionFilter2D(ctx->Exec,
9413 (target, internalFormat, x, y, width,
9414 height));
9417 static void GLAPIENTRY
9418 exec_GetColorTable(GLenum target, GLenum format, GLenum type, GLvoid * data)
9420 GET_CURRENT_CONTEXT(ctx);
9421 FLUSH_VERTICES(ctx, 0);
9422 CALL_GetColorTable(ctx->Exec, (target, format, type, data));
9425 static void GLAPIENTRY
9426 exec_GetColorTableParameterfv(GLenum target, GLenum pname, GLfloat *params)
9428 GET_CURRENT_CONTEXT(ctx);
9429 FLUSH_VERTICES(ctx, 0);
9430 CALL_GetColorTableParameterfv(ctx->Exec, (target, pname, params));
9433 static void GLAPIENTRY
9434 exec_GetColorTableParameteriv(GLenum target, GLenum pname, GLint *params)
9436 GET_CURRENT_CONTEXT(ctx);
9437 FLUSH_VERTICES(ctx, 0);
9438 CALL_GetColorTableParameteriv(ctx->Exec, (target, pname, params));
9441 static void GLAPIENTRY
9442 exec_GetConvolutionFilter(GLenum target, GLenum format, GLenum type,
9443 GLvoid * image)
9445 GET_CURRENT_CONTEXT(ctx);
9446 FLUSH_VERTICES(ctx, 0);
9447 CALL_GetConvolutionFilter(ctx->Exec, (target, format, type, image));
9450 static void GLAPIENTRY
9451 exec_GetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params)
9453 GET_CURRENT_CONTEXT(ctx);
9454 FLUSH_VERTICES(ctx, 0);
9455 CALL_GetConvolutionParameterfv(ctx->Exec, (target, pname, params));
9458 static void GLAPIENTRY
9459 exec_GetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params)
9461 GET_CURRENT_CONTEXT(ctx);
9462 FLUSH_VERTICES(ctx, 0);
9463 CALL_GetConvolutionParameteriv(ctx->Exec, (target, pname, params));
9466 static void GLAPIENTRY
9467 exec_GetHistogram(GLenum target, GLboolean reset, GLenum format,
9468 GLenum type, GLvoid *values)
9470 GET_CURRENT_CONTEXT(ctx);
9471 FLUSH_VERTICES(ctx, 0);
9472 CALL_GetHistogram(ctx->Exec, (target, reset, format, type, values));
9475 static void GLAPIENTRY
9476 exec_GetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params)
9478 GET_CURRENT_CONTEXT(ctx);
9479 FLUSH_VERTICES(ctx, 0);
9480 CALL_GetHistogramParameterfv(ctx->Exec, (target, pname, params));
9483 static void GLAPIENTRY
9484 exec_GetHistogramParameteriv(GLenum target, GLenum pname, GLint *params)
9486 GET_CURRENT_CONTEXT(ctx);
9487 FLUSH_VERTICES(ctx, 0);
9488 CALL_GetHistogramParameteriv(ctx->Exec, (target, pname, params));
9491 static void GLAPIENTRY
9492 exec_GetMinmax(GLenum target, GLboolean reset, GLenum format,
9493 GLenum type, GLvoid *values)
9495 GET_CURRENT_CONTEXT(ctx);
9496 FLUSH_VERTICES(ctx, 0);
9497 CALL_GetMinmax(ctx->Exec, (target, reset, format, type, values));
9500 static void GLAPIENTRY
9501 exec_GetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params)
9503 GET_CURRENT_CONTEXT(ctx);
9504 FLUSH_VERTICES(ctx, 0);
9505 CALL_GetMinmaxParameterfv(ctx->Exec, (target, pname, params));
9508 static void GLAPIENTRY
9509 exec_GetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params)
9511 GET_CURRENT_CONTEXT(ctx);
9512 FLUSH_VERTICES(ctx, 0);
9513 CALL_GetMinmaxParameteriv(ctx->Exec, (target, pname, params));
9516 static void GLAPIENTRY
9517 exec_GetSeparableFilter(GLenum target, GLenum format, GLenum type,
9518 GLvoid *row, GLvoid *column, GLvoid *span)
9520 GET_CURRENT_CONTEXT(ctx);
9521 FLUSH_VERTICES(ctx, 0);
9522 CALL_GetSeparableFilter(ctx->Exec,
9523 (target, format, type, row, column, span));
9526 static void GLAPIENTRY
9527 exec_SeparableFilter2D(GLenum target, GLenum internalFormat,
9528 GLsizei width, GLsizei height, GLenum format,
9529 GLenum type, const GLvoid *row, const GLvoid *column)
9531 GET_CURRENT_CONTEXT(ctx);
9532 FLUSH_VERTICES(ctx, 0);
9533 CALL_SeparableFilter2D(ctx->Exec,
9534 (target, internalFormat, width, height, format,
9535 type, row, column));
9538 static void GLAPIENTRY
9539 exec_ColorPointerEXT(GLint size, GLenum type, GLsizei stride,
9540 GLsizei count, const GLvoid *ptr)
9542 GET_CURRENT_CONTEXT(ctx);
9543 FLUSH_VERTICES(ctx, 0);
9544 CALL_ColorPointerEXT(ctx->Exec, (size, type, stride, count, ptr));
9547 static void GLAPIENTRY
9548 exec_EdgeFlagPointerEXT(GLsizei stride, GLsizei count, const GLboolean *ptr)
9550 GET_CURRENT_CONTEXT(ctx);
9551 FLUSH_VERTICES(ctx, 0);
9552 CALL_EdgeFlagPointerEXT(ctx->Exec, (stride, count, ptr));
9555 static void GLAPIENTRY
9556 exec_IndexPointerEXT(GLenum type, GLsizei stride, GLsizei count,
9557 const GLvoid *ptr)
9559 GET_CURRENT_CONTEXT(ctx);
9560 FLUSH_VERTICES(ctx, 0);
9561 CALL_IndexPointerEXT(ctx->Exec, (type, stride, count, ptr));
9564 static void GLAPIENTRY
9565 exec_NormalPointerEXT(GLenum type, GLsizei stride, GLsizei count,
9566 const GLvoid *ptr)
9568 GET_CURRENT_CONTEXT(ctx);
9569 FLUSH_VERTICES(ctx, 0);
9570 CALL_NormalPointerEXT(ctx->Exec, (type, stride, count, ptr));
9573 static void GLAPIENTRY
9574 exec_TexCoordPointerEXT(GLint size, GLenum type, GLsizei stride,
9575 GLsizei count, const GLvoid *ptr)
9577 GET_CURRENT_CONTEXT(ctx);
9578 FLUSH_VERTICES(ctx, 0);
9579 CALL_TexCoordPointerEXT(ctx->Exec, (size, type, stride, count, ptr));
9582 static void GLAPIENTRY
9583 exec_VertexPointerEXT(GLint size, GLenum type, GLsizei stride,
9584 GLsizei count, const GLvoid *ptr)
9586 GET_CURRENT_CONTEXT(ctx);
9587 FLUSH_VERTICES(ctx, 0);
9588 CALL_VertexPointerEXT(ctx->Exec, (size, type, stride, count, ptr));
9591 static void GLAPIENTRY
9592 exec_LockArraysEXT(GLint first, GLsizei count)
9594 GET_CURRENT_CONTEXT(ctx);
9595 FLUSH_VERTICES(ctx, 0);
9596 CALL_LockArraysEXT(ctx->Exec, (first, count));
9599 static void GLAPIENTRY
9600 exec_UnlockArraysEXT(void)
9602 GET_CURRENT_CONTEXT(ctx);
9603 FLUSH_VERTICES(ctx, 0);
9604 CALL_UnlockArraysEXT(ctx->Exec, ());
9607 static void GLAPIENTRY
9608 exec_ClientActiveTextureARB(GLenum target)
9610 GET_CURRENT_CONTEXT(ctx);
9611 FLUSH_VERTICES(ctx, 0);
9612 CALL_ClientActiveTextureARB(ctx->Exec, (target));
9615 static void GLAPIENTRY
9616 exec_SecondaryColorPointerEXT(GLint size, GLenum type,
9617 GLsizei stride, const GLvoid *ptr)
9619 GET_CURRENT_CONTEXT(ctx);
9620 FLUSH_VERTICES(ctx, 0);
9621 CALL_SecondaryColorPointerEXT(ctx->Exec, (size, type, stride, ptr));
9624 static void GLAPIENTRY
9625 exec_FogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *ptr)
9627 GET_CURRENT_CONTEXT(ctx);
9628 FLUSH_VERTICES(ctx, 0);
9629 CALL_FogCoordPointerEXT(ctx->Exec, (type, stride, ptr));
9632 /* GL_EXT_multi_draw_arrays */
9633 static void GLAPIENTRY
9634 exec_MultiDrawArraysEXT(GLenum mode, const GLint *first,
9635 const GLsizei *count, GLsizei primcount)
9637 GET_CURRENT_CONTEXT(ctx);
9638 FLUSH_VERTICES(ctx, 0);
9639 CALL_MultiDrawArraysEXT(ctx->Exec, (mode, first, count, primcount));
9642 /* GL_IBM_multimode_draw_arrays */
9643 static void GLAPIENTRY
9644 exec_MultiModeDrawArraysIBM(const GLenum * mode, const GLint * first,
9645 const GLsizei * count, GLsizei primcount,
9646 GLint modestride)
9648 GET_CURRENT_CONTEXT(ctx);
9649 FLUSH_VERTICES(ctx, 0);
9650 CALL_MultiModeDrawArraysIBM(ctx->Exec,
9651 (mode, first, count, primcount, modestride));
9654 /* GL_IBM_multimode_draw_arrays */
9655 static void GLAPIENTRY
9656 exec_MultiModeDrawElementsIBM(const GLenum * mode,
9657 const GLsizei * count,
9658 GLenum type,
9659 const GLvoid * const *indices,
9660 GLsizei primcount, GLint modestride)
9662 GET_CURRENT_CONTEXT(ctx);
9663 FLUSH_VERTICES(ctx, 0);
9664 CALL_MultiModeDrawElementsIBM(ctx->Exec,
9665 (mode, count, type, indices, primcount,
9666 modestride));
9672 * Setup the given dispatch table to point to Mesa's display list
9673 * building functions.
9675 * This does not include any of the tnl functions - they are
9676 * initialized from _mesa_init_api_defaults and from the active vtxfmt
9677 * struct.
9679 struct _glapi_table *
9680 _mesa_create_save_table(void)
9682 struct _glapi_table *table;
9684 table = _mesa_alloc_dispatch_table(_gloffset_COUNT);
9685 if (table == NULL)
9686 return NULL;
9688 _mesa_loopback_init_api_table(table);
9690 /* GL 1.0 */
9691 SET_Accum(table, save_Accum);
9692 SET_AlphaFunc(table, save_AlphaFunc);
9693 SET_Bitmap(table, save_Bitmap);
9694 SET_BlendFunc(table, save_BlendFunc);
9695 SET_CallList(table, save_CallList);
9696 SET_CallLists(table, save_CallLists);
9697 SET_Clear(table, save_Clear);
9698 SET_ClearAccum(table, save_ClearAccum);
9699 SET_ClearColor(table, save_ClearColor);
9700 SET_ClearDepth(table, save_ClearDepth);
9701 SET_ClearIndex(table, save_ClearIndex);
9702 SET_ClearStencil(table, save_ClearStencil);
9703 SET_ClipPlane(table, save_ClipPlane);
9704 SET_ColorMask(table, save_ColorMask);
9705 SET_ColorMaskIndexedEXT(table, save_ColorMaskIndexed);
9706 SET_ColorMaterial(table, save_ColorMaterial);
9707 SET_CopyPixels(table, save_CopyPixels);
9708 SET_CullFace(table, save_CullFace);
9709 SET_DeleteLists(table, _mesa_DeleteLists);
9710 SET_DepthFunc(table, save_DepthFunc);
9711 SET_DepthMask(table, save_DepthMask);
9712 SET_DepthRange(table, save_DepthRange);
9713 SET_Disable(table, save_Disable);
9714 SET_DisableIndexedEXT(table, save_DisableIndexed);
9715 SET_DrawBuffer(table, save_DrawBuffer);
9716 SET_DrawPixels(table, save_DrawPixels);
9717 SET_Enable(table, save_Enable);
9718 SET_EnableIndexedEXT(table, save_EnableIndexed);
9719 SET_EndList(table, _mesa_EndList);
9720 SET_EvalMesh1(table, save_EvalMesh1);
9721 SET_EvalMesh2(table, save_EvalMesh2);
9722 SET_Finish(table, exec_Finish);
9723 SET_Flush(table, exec_Flush);
9724 SET_Fogf(table, save_Fogf);
9725 SET_Fogfv(table, save_Fogfv);
9726 SET_Fogi(table, save_Fogi);
9727 SET_Fogiv(table, save_Fogiv);
9728 SET_FrontFace(table, save_FrontFace);
9729 SET_Frustum(table, save_Frustum);
9730 SET_GenLists(table, _mesa_GenLists);
9731 SET_GetBooleanv(table, exec_GetBooleanv);
9732 SET_GetClipPlane(table, exec_GetClipPlane);
9733 SET_GetDoublev(table, exec_GetDoublev);
9734 SET_GetError(table, exec_GetError);
9735 SET_GetFloatv(table, exec_GetFloatv);
9736 SET_GetIntegerv(table, exec_GetIntegerv);
9737 SET_GetLightfv(table, exec_GetLightfv);
9738 SET_GetLightiv(table, exec_GetLightiv);
9739 SET_GetMapdv(table, exec_GetMapdv);
9740 SET_GetMapfv(table, exec_GetMapfv);
9741 SET_GetMapiv(table, exec_GetMapiv);
9742 SET_GetMaterialfv(table, exec_GetMaterialfv);
9743 SET_GetMaterialiv(table, exec_GetMaterialiv);
9744 SET_GetPixelMapfv(table, exec_GetPixelMapfv);
9745 SET_GetPixelMapuiv(table, exec_GetPixelMapuiv);
9746 SET_GetPixelMapusv(table, exec_GetPixelMapusv);
9747 SET_GetPolygonStipple(table, exec_GetPolygonStipple);
9748 SET_GetString(table, exec_GetString);
9749 SET_GetTexEnvfv(table, exec_GetTexEnvfv);
9750 SET_GetTexEnviv(table, exec_GetTexEnviv);
9751 SET_GetTexGendv(table, exec_GetTexGendv);
9752 SET_GetTexGenfv(table, exec_GetTexGenfv);
9753 SET_GetTexGeniv(table, exec_GetTexGeniv);
9754 SET_GetTexImage(table, exec_GetTexImage);
9755 SET_GetTexLevelParameterfv(table, exec_GetTexLevelParameterfv);
9756 SET_GetTexLevelParameteriv(table, exec_GetTexLevelParameteriv);
9757 SET_GetTexParameterfv(table, exec_GetTexParameterfv);
9758 SET_GetTexParameteriv(table, exec_GetTexParameteriv);
9759 SET_Hint(table, save_Hint);
9760 SET_IndexMask(table, save_IndexMask);
9761 SET_InitNames(table, save_InitNames);
9762 SET_IsEnabled(table, exec_IsEnabled);
9763 SET_IsList(table, _mesa_IsList);
9764 SET_LightModelf(table, save_LightModelf);
9765 SET_LightModelfv(table, save_LightModelfv);
9766 SET_LightModeli(table, save_LightModeli);
9767 SET_LightModeliv(table, save_LightModeliv);
9768 SET_Lightf(table, save_Lightf);
9769 SET_Lightfv(table, save_Lightfv);
9770 SET_Lighti(table, save_Lighti);
9771 SET_Lightiv(table, save_Lightiv);
9772 SET_LineStipple(table, save_LineStipple);
9773 SET_LineWidth(table, save_LineWidth);
9774 SET_ListBase(table, save_ListBase);
9775 SET_LoadIdentity(table, save_LoadIdentity);
9776 SET_LoadMatrixd(table, save_LoadMatrixd);
9777 SET_LoadMatrixf(table, save_LoadMatrixf);
9778 SET_LoadName(table, save_LoadName);
9779 SET_LogicOp(table, save_LogicOp);
9780 SET_Map1d(table, save_Map1d);
9781 SET_Map1f(table, save_Map1f);
9782 SET_Map2d(table, save_Map2d);
9783 SET_Map2f(table, save_Map2f);
9784 SET_MapGrid1d(table, save_MapGrid1d);
9785 SET_MapGrid1f(table, save_MapGrid1f);
9786 SET_MapGrid2d(table, save_MapGrid2d);
9787 SET_MapGrid2f(table, save_MapGrid2f);
9788 SET_MatrixMode(table, save_MatrixMode);
9789 SET_MultMatrixd(table, save_MultMatrixd);
9790 SET_MultMatrixf(table, save_MultMatrixf);
9791 SET_NewList(table, save_NewList);
9792 SET_Ortho(table, save_Ortho);
9793 SET_PassThrough(table, save_PassThrough);
9794 SET_PixelMapfv(table, save_PixelMapfv);
9795 SET_PixelMapuiv(table, save_PixelMapuiv);
9796 SET_PixelMapusv(table, save_PixelMapusv);
9797 SET_PixelStoref(table, exec_PixelStoref);
9798 SET_PixelStorei(table, exec_PixelStorei);
9799 SET_PixelTransferf(table, save_PixelTransferf);
9800 SET_PixelTransferi(table, save_PixelTransferi);
9801 SET_PixelZoom(table, save_PixelZoom);
9802 SET_PointSize(table, save_PointSize);
9803 SET_PolygonMode(table, save_PolygonMode);
9804 SET_PolygonOffset(table, save_PolygonOffset);
9805 SET_PolygonStipple(table, save_PolygonStipple);
9806 SET_PopAttrib(table, save_PopAttrib);
9807 SET_PopMatrix(table, save_PopMatrix);
9808 SET_PopName(table, save_PopName);
9809 SET_PushAttrib(table, save_PushAttrib);
9810 SET_PushMatrix(table, save_PushMatrix);
9811 SET_PushName(table, save_PushName);
9812 SET_RasterPos2d(table, save_RasterPos2d);
9813 SET_RasterPos2dv(table, save_RasterPos2dv);
9814 SET_RasterPos2f(table, save_RasterPos2f);
9815 SET_RasterPos2fv(table, save_RasterPos2fv);
9816 SET_RasterPos2i(table, save_RasterPos2i);
9817 SET_RasterPos2iv(table, save_RasterPos2iv);
9818 SET_RasterPos2s(table, save_RasterPos2s);
9819 SET_RasterPos2sv(table, save_RasterPos2sv);
9820 SET_RasterPos3d(table, save_RasterPos3d);
9821 SET_RasterPos3dv(table, save_RasterPos3dv);
9822 SET_RasterPos3f(table, save_RasterPos3f);
9823 SET_RasterPos3fv(table, save_RasterPos3fv);
9824 SET_RasterPos3i(table, save_RasterPos3i);
9825 SET_RasterPos3iv(table, save_RasterPos3iv);
9826 SET_RasterPos3s(table, save_RasterPos3s);
9827 SET_RasterPos3sv(table, save_RasterPos3sv);
9828 SET_RasterPos4d(table, save_RasterPos4d);
9829 SET_RasterPos4dv(table, save_RasterPos4dv);
9830 SET_RasterPos4f(table, save_RasterPos4f);
9831 SET_RasterPos4fv(table, save_RasterPos4fv);
9832 SET_RasterPos4i(table, save_RasterPos4i);
9833 SET_RasterPos4iv(table, save_RasterPos4iv);
9834 SET_RasterPos4s(table, save_RasterPos4s);
9835 SET_RasterPos4sv(table, save_RasterPos4sv);
9836 SET_ReadBuffer(table, save_ReadBuffer);
9837 SET_ReadPixels(table, exec_ReadPixels);
9838 SET_RenderMode(table, exec_RenderMode);
9839 SET_Rotated(table, save_Rotated);
9840 SET_Rotatef(table, save_Rotatef);
9841 SET_Scaled(table, save_Scaled);
9842 SET_Scalef(table, save_Scalef);
9843 SET_Scissor(table, save_Scissor);
9844 SET_FeedbackBuffer(table, exec_FeedbackBuffer);
9845 SET_SelectBuffer(table, exec_SelectBuffer);
9846 SET_ShadeModel(table, save_ShadeModel);
9847 SET_StencilFunc(table, save_StencilFunc);
9848 SET_StencilMask(table, save_StencilMask);
9849 SET_StencilOp(table, save_StencilOp);
9850 SET_TexEnvf(table, save_TexEnvf);
9851 SET_TexEnvfv(table, save_TexEnvfv);
9852 SET_TexEnvi(table, save_TexEnvi);
9853 SET_TexEnviv(table, save_TexEnviv);
9854 SET_TexGend(table, save_TexGend);
9855 SET_TexGendv(table, save_TexGendv);
9856 SET_TexGenf(table, save_TexGenf);
9857 SET_TexGenfv(table, save_TexGenfv);
9858 SET_TexGeni(table, save_TexGeni);
9859 SET_TexGeniv(table, save_TexGeniv);
9860 SET_TexImage1D(table, save_TexImage1D);
9861 SET_TexImage2D(table, save_TexImage2D);
9862 SET_TexParameterf(table, save_TexParameterf);
9863 SET_TexParameterfv(table, save_TexParameterfv);
9864 SET_TexParameteri(table, save_TexParameteri);
9865 SET_TexParameteriv(table, save_TexParameteriv);
9866 SET_Translated(table, save_Translated);
9867 SET_Translatef(table, save_Translatef);
9868 SET_Viewport(table, save_Viewport);
9870 /* GL 1.1 */
9871 SET_AreTexturesResident(table, exec_AreTexturesResident);
9872 SET_BindTexture(table, save_BindTexture);
9873 SET_ColorPointer(table, exec_ColorPointer);
9874 SET_CopyTexImage1D(table, save_CopyTexImage1D);
9875 SET_CopyTexImage2D(table, save_CopyTexImage2D);
9876 SET_CopyTexSubImage1D(table, save_CopyTexSubImage1D);
9877 SET_CopyTexSubImage2D(table, save_CopyTexSubImage2D);
9878 SET_DeleteTextures(table, exec_DeleteTextures);
9879 SET_DisableClientState(table, exec_DisableClientState);
9880 SET_EdgeFlagPointer(table, exec_EdgeFlagPointer);
9881 SET_EnableClientState(table, exec_EnableClientState);
9882 SET_GenTextures(table, exec_GenTextures);
9883 SET_GetPointerv(table, exec_GetPointerv);
9884 SET_IndexPointer(table, exec_IndexPointer);
9885 SET_InterleavedArrays(table, exec_InterleavedArrays);
9886 SET_IsTexture(table, exec_IsTexture);
9887 SET_NormalPointer(table, exec_NormalPointer);
9888 SET_PopClientAttrib(table, exec_PopClientAttrib);
9889 SET_PrioritizeTextures(table, save_PrioritizeTextures);
9890 SET_PushClientAttrib(table, exec_PushClientAttrib);
9891 SET_TexCoordPointer(table, exec_TexCoordPointer);
9892 SET_TexSubImage1D(table, save_TexSubImage1D);
9893 SET_TexSubImage2D(table, save_TexSubImage2D);
9894 SET_VertexPointer(table, exec_VertexPointer);
9896 /* GL 1.2 */
9897 SET_CopyTexSubImage3D(table, save_CopyTexSubImage3D);
9898 SET_TexImage3D(table, save_TexImage3D);
9899 SET_TexSubImage3D(table, save_TexSubImage3D);
9901 /* GL 2.0 */
9902 SET_StencilFuncSeparate(table, save_StencilFuncSeparate);
9903 SET_StencilMaskSeparate(table, save_StencilMaskSeparate);
9904 SET_StencilOpSeparate(table, save_StencilOpSeparate);
9906 /* ATI_separate_stencil */
9907 SET_StencilFuncSeparateATI(table, save_StencilFuncSeparateATI);
9909 /* GL_ARB_imaging */
9910 /* Not all are supported */
9911 SET_BlendColor(table, save_BlendColor);
9912 SET_BlendEquation(table, save_BlendEquation);
9913 SET_ColorSubTable(table, save_ColorSubTable);
9914 SET_ColorTable(table, save_ColorTable);
9915 SET_ColorTableParameterfv(table, save_ColorTableParameterfv);
9916 SET_ColorTableParameteriv(table, save_ColorTableParameteriv);
9917 SET_ConvolutionFilter1D(table, save_ConvolutionFilter1D);
9918 SET_ConvolutionFilter2D(table, save_ConvolutionFilter2D);
9919 SET_ConvolutionParameterf(table, save_ConvolutionParameterf);
9920 SET_ConvolutionParameterfv(table, save_ConvolutionParameterfv);
9921 SET_ConvolutionParameteri(table, save_ConvolutionParameteri);
9922 SET_ConvolutionParameteriv(table, save_ConvolutionParameteriv);
9923 SET_CopyColorSubTable(table, save_CopyColorSubTable);
9924 SET_CopyColorTable(table, save_CopyColorTable);
9925 SET_CopyConvolutionFilter1D(table, exec_CopyConvolutionFilter1D);
9926 SET_CopyConvolutionFilter2D(table, exec_CopyConvolutionFilter2D);
9927 SET_GetColorTable(table, exec_GetColorTable);
9928 SET_GetColorTableParameterfv(table, exec_GetColorTableParameterfv);
9929 SET_GetColorTableParameteriv(table, exec_GetColorTableParameteriv);
9930 SET_GetConvolutionFilter(table, exec_GetConvolutionFilter);
9931 SET_GetConvolutionParameterfv(table, exec_GetConvolutionParameterfv);
9932 SET_GetConvolutionParameteriv(table, exec_GetConvolutionParameteriv);
9933 SET_GetHistogram(table, exec_GetHistogram);
9934 SET_GetHistogramParameterfv(table, exec_GetHistogramParameterfv);
9935 SET_GetHistogramParameteriv(table, exec_GetHistogramParameteriv);
9936 SET_GetMinmax(table, exec_GetMinmax);
9937 SET_GetMinmaxParameterfv(table, exec_GetMinmaxParameterfv);
9938 SET_GetMinmaxParameteriv(table, exec_GetMinmaxParameteriv);
9939 SET_GetSeparableFilter(table, exec_GetSeparableFilter);
9940 SET_Histogram(table, save_Histogram);
9941 SET_Minmax(table, save_Minmax);
9942 SET_ResetHistogram(table, save_ResetHistogram);
9943 SET_ResetMinmax(table, save_ResetMinmax);
9944 SET_SeparableFilter2D(table, exec_SeparableFilter2D);
9946 /* 2. GL_EXT_blend_color */
9947 #if 0
9948 SET_BlendColorEXT(table, save_BlendColorEXT);
9949 #endif
9951 /* 3. GL_EXT_polygon_offset */
9952 SET_PolygonOffsetEXT(table, save_PolygonOffsetEXT);
9954 /* 6. GL_EXT_texture3d */
9955 #if 0
9956 SET_CopyTexSubImage3DEXT(table, save_CopyTexSubImage3D);
9957 SET_TexImage3DEXT(table, save_TexImage3DEXT);
9958 SET_TexSubImage3DEXT(table, save_TexSubImage3D);
9959 #endif
9961 /* 14. GL_SGI_color_table */
9962 #if 0
9963 SET_ColorTableSGI(table, save_ColorTable);
9964 SET_ColorSubTableSGI(table, save_ColorSubTable);
9965 SET_GetColorTableSGI(table, exec_GetColorTable);
9966 SET_GetColorTableParameterfvSGI(table, exec_GetColorTableParameterfv);
9967 SET_GetColorTableParameterivSGI(table, exec_GetColorTableParameteriv);
9968 #endif
9970 /* 30. GL_EXT_vertex_array */
9971 SET_ColorPointerEXT(table, exec_ColorPointerEXT);
9972 SET_EdgeFlagPointerEXT(table, exec_EdgeFlagPointerEXT);
9973 SET_IndexPointerEXT(table, exec_IndexPointerEXT);
9974 SET_NormalPointerEXT(table, exec_NormalPointerEXT);
9975 SET_TexCoordPointerEXT(table, exec_TexCoordPointerEXT);
9976 SET_VertexPointerEXT(table, exec_VertexPointerEXT);
9978 /* 37. GL_EXT_blend_minmax */
9979 #if 0
9980 SET_BlendEquationEXT(table, save_BlendEquationEXT);
9981 #endif
9983 /* 54. GL_EXT_point_parameters */
9984 SET_PointParameterfEXT(table, save_PointParameterfEXT);
9985 SET_PointParameterfvEXT(table, save_PointParameterfvEXT);
9987 /* 97. GL_EXT_compiled_vertex_array */
9988 SET_LockArraysEXT(table, exec_LockArraysEXT);
9989 SET_UnlockArraysEXT(table, exec_UnlockArraysEXT);
9991 /* 145. GL_EXT_secondary_color */
9992 SET_SecondaryColorPointerEXT(table, exec_SecondaryColorPointerEXT);
9994 /* 148. GL_EXT_multi_draw_arrays */
9995 SET_MultiDrawArraysEXT(table, exec_MultiDrawArraysEXT);
9997 /* 149. GL_EXT_fog_coord */
9998 SET_FogCoordPointerEXT(table, exec_FogCoordPointerEXT);
10000 /* 173. GL_EXT_blend_func_separate */
10001 SET_BlendFuncSeparateEXT(table, save_BlendFuncSeparateEXT);
10003 /* 196. GL_MESA_resize_buffers */
10004 SET_ResizeBuffersMESA(table, _mesa_ResizeBuffersMESA);
10006 /* 197. GL_MESA_window_pos */
10007 SET_WindowPos2dMESA(table, save_WindowPos2dMESA);
10008 SET_WindowPos2dvMESA(table, save_WindowPos2dvMESA);
10009 SET_WindowPos2fMESA(table, save_WindowPos2fMESA);
10010 SET_WindowPos2fvMESA(table, save_WindowPos2fvMESA);
10011 SET_WindowPos2iMESA(table, save_WindowPos2iMESA);
10012 SET_WindowPos2ivMESA(table, save_WindowPos2ivMESA);
10013 SET_WindowPos2sMESA(table, save_WindowPos2sMESA);
10014 SET_WindowPos2svMESA(table, save_WindowPos2svMESA);
10015 SET_WindowPos3dMESA(table, save_WindowPos3dMESA);
10016 SET_WindowPos3dvMESA(table, save_WindowPos3dvMESA);
10017 SET_WindowPos3fMESA(table, save_WindowPos3fMESA);
10018 SET_WindowPos3fvMESA(table, save_WindowPos3fvMESA);
10019 SET_WindowPos3iMESA(table, save_WindowPos3iMESA);
10020 SET_WindowPos3ivMESA(table, save_WindowPos3ivMESA);
10021 SET_WindowPos3sMESA(table, save_WindowPos3sMESA);
10022 SET_WindowPos3svMESA(table, save_WindowPos3svMESA);
10023 SET_WindowPos4dMESA(table, save_WindowPos4dMESA);
10024 SET_WindowPos4dvMESA(table, save_WindowPos4dvMESA);
10025 SET_WindowPos4fMESA(table, save_WindowPos4fMESA);
10026 SET_WindowPos4fvMESA(table, save_WindowPos4fvMESA);
10027 SET_WindowPos4iMESA(table, save_WindowPos4iMESA);
10028 SET_WindowPos4ivMESA(table, save_WindowPos4ivMESA);
10029 SET_WindowPos4sMESA(table, save_WindowPos4sMESA);
10030 SET_WindowPos4svMESA(table, save_WindowPos4svMESA);
10032 /* 200. GL_IBM_multimode_draw_arrays */
10033 SET_MultiModeDrawArraysIBM(table, exec_MultiModeDrawArraysIBM);
10034 SET_MultiModeDrawElementsIBM(table, exec_MultiModeDrawElementsIBM);
10036 #if FEATURE_NV_vertex_program
10037 /* 233. GL_NV_vertex_program */
10038 /* The following commands DO NOT go into display lists:
10039 * AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV,
10040 * VertexAttribPointerNV, GetProgram*, GetVertexAttrib*
10042 SET_BindProgramNV(table, save_BindProgramNV);
10043 SET_DeleteProgramsNV(table, _mesa_DeletePrograms);
10044 SET_ExecuteProgramNV(table, save_ExecuteProgramNV);
10045 SET_GenProgramsNV(table, _mesa_GenPrograms);
10046 SET_AreProgramsResidentNV(table, _mesa_AreProgramsResidentNV);
10047 SET_RequestResidentProgramsNV(table, save_RequestResidentProgramsNV);
10048 SET_GetProgramParameterfvNV(table, _mesa_GetProgramParameterfvNV);
10049 SET_GetProgramParameterdvNV(table, _mesa_GetProgramParameterdvNV);
10050 SET_GetProgramivNV(table, _mesa_GetProgramivNV);
10051 SET_GetProgramStringNV(table, _mesa_GetProgramStringNV);
10052 SET_GetTrackMatrixivNV(table, _mesa_GetTrackMatrixivNV);
10053 SET_GetVertexAttribdvNV(table, _mesa_GetVertexAttribdvNV);
10054 SET_GetVertexAttribfvNV(table, _mesa_GetVertexAttribfvNV);
10055 SET_GetVertexAttribivNV(table, _mesa_GetVertexAttribivNV);
10056 SET_GetVertexAttribPointervNV(table, _mesa_GetVertexAttribPointervNV);
10057 SET_IsProgramNV(table, _mesa_IsProgramARB);
10058 SET_LoadProgramNV(table, save_LoadProgramNV);
10059 SET_ProgramEnvParameter4dARB(table, save_ProgramEnvParameter4dARB);
10060 SET_ProgramEnvParameter4dvARB(table, save_ProgramEnvParameter4dvARB);
10061 SET_ProgramEnvParameter4fARB(table, save_ProgramEnvParameter4fARB);
10062 SET_ProgramEnvParameter4fvARB(table, save_ProgramEnvParameter4fvARB);
10063 SET_ProgramParameters4dvNV(table, save_ProgramParameters4dvNV);
10064 SET_ProgramParameters4fvNV(table, save_ProgramParameters4fvNV);
10065 SET_TrackMatrixNV(table, save_TrackMatrixNV);
10066 SET_VertexAttribPointerNV(table, _mesa_VertexAttribPointerNV);
10067 #endif
10069 /* 244. GL_ATI_envmap_bumpmap */
10070 SET_TexBumpParameterivATI(table, save_TexBumpParameterivATI);
10071 SET_TexBumpParameterfvATI(table, save_TexBumpParameterfvATI);
10073 /* 245. GL_ATI_fragment_shader */
10074 #if FEATURE_ATI_fragment_shader
10075 SET_BindFragmentShaderATI(table, save_BindFragmentShaderATI);
10076 SET_SetFragmentShaderConstantATI(table, save_SetFragmentShaderConstantATI);
10077 #endif
10079 /* 282. GL_NV_fragment_program */
10080 #if FEATURE_NV_fragment_program
10081 SET_ProgramNamedParameter4fNV(table, save_ProgramNamedParameter4fNV);
10082 SET_ProgramNamedParameter4dNV(table, save_ProgramNamedParameter4dNV);
10083 SET_ProgramNamedParameter4fvNV(table, save_ProgramNamedParameter4fvNV);
10084 SET_ProgramNamedParameter4dvNV(table, save_ProgramNamedParameter4dvNV);
10085 SET_GetProgramNamedParameterfvNV(table,
10086 _mesa_GetProgramNamedParameterfvNV);
10087 SET_GetProgramNamedParameterdvNV(table,
10088 _mesa_GetProgramNamedParameterdvNV);
10089 SET_ProgramLocalParameter4dARB(table, save_ProgramLocalParameter4dARB);
10090 SET_ProgramLocalParameter4dvARB(table, save_ProgramLocalParameter4dvARB);
10091 SET_ProgramLocalParameter4fARB(table, save_ProgramLocalParameter4fARB);
10092 SET_ProgramLocalParameter4fvARB(table, save_ProgramLocalParameter4fvARB);
10093 SET_GetProgramLocalParameterdvARB(table,
10094 _mesa_GetProgramLocalParameterdvARB);
10095 SET_GetProgramLocalParameterfvARB(table,
10096 _mesa_GetProgramLocalParameterfvARB);
10097 #endif
10099 /* 262. GL_NV_point_sprite */
10100 SET_PointParameteriNV(table, save_PointParameteriNV);
10101 SET_PointParameterivNV(table, save_PointParameterivNV);
10103 /* 268. GL_EXT_stencil_two_side */
10104 SET_ActiveStencilFaceEXT(table, save_ActiveStencilFaceEXT);
10106 /* 273. GL_APPLE_vertex_array_object */
10107 SET_BindVertexArrayAPPLE(table, _mesa_BindVertexArrayAPPLE);
10108 SET_DeleteVertexArraysAPPLE(table, _mesa_DeleteVertexArraysAPPLE);
10109 SET_GenVertexArraysAPPLE(table, _mesa_GenVertexArraysAPPLE);
10110 SET_IsVertexArrayAPPLE(table, _mesa_IsVertexArrayAPPLE);
10112 /* GL_ARB_vertex_array_object */
10113 SET_BindVertexArray(table, _mesa_BindVertexArray);
10114 SET_GenVertexArrays(table, _mesa_GenVertexArrays);
10116 /* ???. GL_EXT_depth_bounds_test */
10117 SET_DepthBoundsEXT(table, save_DepthBoundsEXT);
10119 /* ARB 1. GL_ARB_multitexture */
10120 SET_ActiveTextureARB(table, save_ActiveTextureARB);
10121 SET_ClientActiveTextureARB(table, exec_ClientActiveTextureARB);
10123 /* ARB 3. GL_ARB_transpose_matrix */
10124 SET_LoadTransposeMatrixdARB(table, save_LoadTransposeMatrixdARB);
10125 SET_LoadTransposeMatrixfARB(table, save_LoadTransposeMatrixfARB);
10126 SET_MultTransposeMatrixdARB(table, save_MultTransposeMatrixdARB);
10127 SET_MultTransposeMatrixfARB(table, save_MultTransposeMatrixfARB);
10129 /* ARB 5. GL_ARB_multisample */
10130 SET_SampleCoverageARB(table, save_SampleCoverageARB);
10132 /* ARB 12. GL_ARB_texture_compression */
10133 SET_CompressedTexImage3DARB(table, save_CompressedTexImage3DARB);
10134 SET_CompressedTexImage2DARB(table, save_CompressedTexImage2DARB);
10135 SET_CompressedTexImage1DARB(table, save_CompressedTexImage1DARB);
10136 SET_CompressedTexSubImage3DARB(table, save_CompressedTexSubImage3DARB);
10137 SET_CompressedTexSubImage2DARB(table, save_CompressedTexSubImage2DARB);
10138 SET_CompressedTexSubImage1DARB(table, save_CompressedTexSubImage1DARB);
10139 SET_GetCompressedTexImageARB(table, exec_GetCompressedTexImageARB);
10141 /* ARB 14. GL_ARB_point_parameters */
10142 /* aliased with EXT_point_parameters functions */
10144 /* ARB 25. GL_ARB_window_pos */
10145 /* aliased with MESA_window_pos functions */
10147 /* ARB 26. GL_ARB_vertex_program */
10148 /* ARB 27. GL_ARB_fragment_program */
10149 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
10150 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
10151 SET_VertexAttribPointerARB(table, _mesa_VertexAttribPointerARB);
10152 SET_EnableVertexAttribArrayARB(table, _mesa_EnableVertexAttribArrayARB);
10153 SET_DisableVertexAttribArrayARB(table, _mesa_DisableVertexAttribArrayARB);
10154 SET_ProgramStringARB(table, save_ProgramStringARB);
10155 SET_BindProgramNV(table, save_BindProgramNV);
10156 SET_DeleteProgramsNV(table, _mesa_DeletePrograms);
10157 SET_GenProgramsNV(table, _mesa_GenPrograms);
10158 SET_IsProgramNV(table, _mesa_IsProgramARB);
10159 SET_GetVertexAttribdvARB(table, _mesa_GetVertexAttribdvARB);
10160 SET_GetVertexAttribfvARB(table, _mesa_GetVertexAttribfvARB);
10161 SET_GetVertexAttribivARB(table, _mesa_GetVertexAttribivARB);
10162 SET_GetVertexAttribPointervNV(table, _mesa_GetVertexAttribPointervNV);
10163 SET_ProgramEnvParameter4dARB(table, save_ProgramEnvParameter4dARB);
10164 SET_ProgramEnvParameter4dvARB(table, save_ProgramEnvParameter4dvARB);
10165 SET_ProgramEnvParameter4fARB(table, save_ProgramEnvParameter4fARB);
10166 SET_ProgramEnvParameter4fvARB(table, save_ProgramEnvParameter4fvARB);
10167 SET_ProgramLocalParameter4dARB(table, save_ProgramLocalParameter4dARB);
10168 SET_ProgramLocalParameter4dvARB(table, save_ProgramLocalParameter4dvARB);
10169 SET_ProgramLocalParameter4fARB(table, save_ProgramLocalParameter4fARB);
10170 SET_ProgramLocalParameter4fvARB(table, save_ProgramLocalParameter4fvARB);
10171 SET_GetProgramEnvParameterdvARB(table, _mesa_GetProgramEnvParameterdvARB);
10172 SET_GetProgramEnvParameterfvARB(table, _mesa_GetProgramEnvParameterfvARB);
10173 SET_GetProgramLocalParameterdvARB(table,
10174 _mesa_GetProgramLocalParameterdvARB);
10175 SET_GetProgramLocalParameterfvARB(table,
10176 _mesa_GetProgramLocalParameterfvARB);
10177 SET_GetProgramivARB(table, _mesa_GetProgramivARB);
10178 SET_GetProgramStringARB(table, _mesa_GetProgramStringARB);
10179 #endif
10181 /* ARB 28. GL_ARB_vertex_buffer_object */
10182 #if FEATURE_ARB_vertex_buffer_object
10183 /* None of the extension's functions get compiled */
10184 SET_BindBufferARB(table, _mesa_BindBufferARB);
10185 SET_BufferDataARB(table, _mesa_BufferDataARB);
10186 SET_BufferSubDataARB(table, _mesa_BufferSubDataARB);
10187 SET_DeleteBuffersARB(table, _mesa_DeleteBuffersARB);
10188 SET_GenBuffersARB(table, _mesa_GenBuffersARB);
10189 SET_GetBufferParameterivARB(table, _mesa_GetBufferParameterivARB);
10190 SET_GetBufferPointervARB(table, _mesa_GetBufferPointervARB);
10191 SET_GetBufferSubDataARB(table, _mesa_GetBufferSubDataARB);
10192 SET_IsBufferARB(table, _mesa_IsBufferARB);
10193 SET_MapBufferARB(table, _mesa_MapBufferARB);
10194 SET_UnmapBufferARB(table, _mesa_UnmapBufferARB);
10195 #endif
10197 #if FEATURE_queryobj
10198 _mesa_init_queryobj_dispatch(table); /* glGetQuery, etc */
10199 SET_BeginQueryARB(table, save_BeginQueryARB);
10200 SET_EndQueryARB(table, save_EndQueryARB);
10201 #endif
10203 SET_DrawBuffersARB(table, save_DrawBuffersARB);
10205 #if FEATURE_EXT_framebuffer_blit
10206 SET_BlitFramebufferEXT(table, save_BlitFramebufferEXT);
10207 #endif
10209 /* GL_ARB_shader_objects */
10210 _mesa_init_shader_dispatch(table); /* Plug in glCreate/Delete/Get, etc */
10211 SET_UseProgramObjectARB(table, save_UseProgramObjectARB);
10212 SET_Uniform1fARB(table, save_Uniform1fARB);
10213 SET_Uniform2fARB(table, save_Uniform2fARB);
10214 SET_Uniform3fARB(table, save_Uniform3fARB);
10215 SET_Uniform4fARB(table, save_Uniform4fARB);
10216 SET_Uniform1fvARB(table, save_Uniform1fvARB);
10217 SET_Uniform2fvARB(table, save_Uniform2fvARB);
10218 SET_Uniform3fvARB(table, save_Uniform3fvARB);
10219 SET_Uniform4fvARB(table, save_Uniform4fvARB);
10220 SET_Uniform1iARB(table, save_Uniform1iARB);
10221 SET_Uniform2iARB(table, save_Uniform2iARB);
10222 SET_Uniform3iARB(table, save_Uniform3iARB);
10223 SET_Uniform4iARB(table, save_Uniform4iARB);
10224 SET_Uniform1ivARB(table, save_Uniform1ivARB);
10225 SET_Uniform2ivARB(table, save_Uniform2ivARB);
10226 SET_Uniform3ivARB(table, save_Uniform3ivARB);
10227 SET_Uniform4ivARB(table, save_Uniform4ivARB);
10228 SET_UniformMatrix2fvARB(table, save_UniformMatrix2fvARB);
10229 SET_UniformMatrix3fvARB(table, save_UniformMatrix3fvARB);
10230 SET_UniformMatrix4fvARB(table, save_UniformMatrix4fvARB);
10231 SET_UniformMatrix2x3fv(table, save_UniformMatrix2x3fv);
10232 SET_UniformMatrix3x2fv(table, save_UniformMatrix3x2fv);
10233 SET_UniformMatrix2x4fv(table, save_UniformMatrix2x4fv);
10234 SET_UniformMatrix4x2fv(table, save_UniformMatrix4x2fv);
10235 SET_UniformMatrix3x4fv(table, save_UniformMatrix3x4fv);
10236 SET_UniformMatrix4x3fv(table, save_UniformMatrix4x3fv);
10238 /* ARB 30/31/32. GL_ARB_shader_objects, GL_ARB_vertex/fragment_shader */
10239 SET_BindAttribLocationARB(table, exec_BindAttribLocationARB);
10240 SET_GetAttribLocationARB(table, exec_GetAttribLocationARB);
10241 SET_GetUniformLocationARB(table, exec_GetUniformLocationARB);
10242 /* XXX additional functions need to be implemented here! */
10244 /* 299. GL_EXT_blend_equation_separate */
10245 SET_BlendEquationSeparateEXT(table, save_BlendEquationSeparateEXT);
10247 /* GL_EXT_gpu_program_parameters */
10248 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
10249 SET_ProgramEnvParameters4fvEXT(table, save_ProgramEnvParameters4fvEXT);
10250 SET_ProgramLocalParameters4fvEXT(table, save_ProgramLocalParameters4fvEXT);
10251 #endif
10253 /* ARB 50. GL_ARB_map_buffer_range */
10254 #if FEATURE_ARB_map_buffer_range
10255 SET_MapBufferRange(table, _mesa_MapBufferRange); /* no dlist save */
10256 SET_FlushMappedBufferRange(table, _mesa_FlushMappedBufferRange); /* no dl */
10257 #endif
10259 /* ARB 59. GL_ARB_copy_buffer */
10260 SET_CopyBufferSubData(table, _mesa_CopyBufferSubData); /* no dlist save */
10262 /* 364. GL_EXT_provoking_vertex */
10263 SET_ProvokingVertexEXT(table, save_ProvokingVertexEXT);
10265 /* 371. GL_APPLE_object_purgeable */
10266 #if FEATURE_APPLE_object_purgeable
10267 SET_ObjectPurgeableAPPLE(table, _mesa_ObjectPurgeableAPPLE);
10268 SET_ObjectUnpurgeableAPPLE(table, _mesa_ObjectUnpurgeableAPPLE);
10269 SET_GetObjectParameterivAPPLE(table, _mesa_GetObjectParameterivAPPLE);
10270 #endif
10272 /* GL_EXT_texture_integer */
10273 SET_ClearColorIiEXT(table, save_ClearColorIi);
10274 SET_ClearColorIuiEXT(table, save_ClearColorIui);
10275 SET_TexParameterIivEXT(table, save_TexParameterIiv);
10276 SET_TexParameterIuivEXT(table, save_TexParameterIuiv);
10277 SET_GetTexParameterIivEXT(table, exec_GetTexParameterIiv);
10278 SET_GetTexParameterIuivEXT(table, exec_GetTexParameterIuiv);
10280 /* 377. GL_EXT_separate_shader_objects */
10281 SET_UseShaderProgramEXT(table, save_UseShaderProgramEXT);
10282 SET_ActiveProgramEXT(table, save_ActiveProgramEXT);
10284 /* GL_ARB_color_buffer_float */
10285 SET_ClampColorARB(table, save_ClampColorARB);
10286 SET_ClampColor(table, save_ClampColorARB);
10288 /* GL 3.0 */
10289 SET_ClearBufferiv(table, save_ClearBufferiv);
10290 SET_ClearBufferuiv(table, save_ClearBufferuiv);
10291 SET_ClearBufferfv(table, save_ClearBufferfv);
10292 SET_ClearBufferfi(table, save_ClearBufferfi);
10293 #if 0
10294 SET_Uniform1ui(table, save_Uniform1ui);
10295 SET_Uniform2ui(table, save_Uniform2ui);
10296 SET_Uniform3ui(table, save_Uniform3ui);
10297 SET_Uniform4ui(table, save_Uniform4ui);
10298 SET_Uniform1uiv(table, save_Uniform1uiv);
10299 SET_Uniform2uiv(table, save_Uniform2uiv);
10300 SET_Uniform3uiv(table, save_Uniform3uiv);
10301 SET_Uniform4uiv(table, save_Uniform4uiv);
10302 #else
10303 (void) save_Uniform1ui;
10304 (void) save_Uniform2ui;
10305 (void) save_Uniform3ui;
10306 (void) save_Uniform4ui;
10307 (void) save_Uniform1uiv;
10308 (void) save_Uniform2uiv;
10309 (void) save_Uniform3uiv;
10310 (void) save_Uniform4uiv;
10311 #endif
10313 #if FEATURE_EXT_transform_feedback
10314 SET_BeginTransformFeedbackEXT(table, save_BeginTransformFeedback);
10315 SET_EndTransformFeedbackEXT(table, save_EndTransformFeedback);
10316 SET_TransformFeedbackVaryingsEXT(table, save_TransformFeedbackVaryings);
10317 SET_BindTransformFeedback(table, save_BindTransformFeedback);
10318 SET_PauseTransformFeedback(table, save_PauseTransformFeedback);
10319 SET_ResumeTransformFeedback(table, save_ResumeTransformFeedback);
10320 SET_DrawTransformFeedback(table, save_DrawTransformFeedback);
10321 #endif
10323 /* GL_ARB_instanced_arrays */
10324 SET_VertexAttribDivisorARB(table, save_VertexAttribDivisor);
10326 /* GL_NV_texture_barrier */
10327 SET_TextureBarrierNV(table, save_TextureBarrierNV);
10329 /* GL_ARB_sampler_objects */
10330 _mesa_init_sampler_object_dispatch(table); /* plug in Gen/Get/etc functions */
10331 SET_BindSampler(table, save_BindSampler);
10332 SET_SamplerParameteri(table, save_SamplerParameteri);
10333 SET_SamplerParameterf(table, save_SamplerParameterf);
10334 SET_SamplerParameteriv(table, save_SamplerParameteriv);
10335 SET_SamplerParameterfv(table, save_SamplerParameterfv);
10336 SET_SamplerParameterIiv(table, save_SamplerParameterIiv);
10337 SET_SamplerParameterIuiv(table, save_SamplerParameterIuiv);
10339 /* GL_ARB_draw_buffer_blend */
10340 SET_BlendFunciARB(table, save_BlendFunci);
10341 SET_BlendFuncSeparateiARB(table, save_BlendFuncSeparatei);
10342 SET_BlendEquationiARB(table, save_BlendEquationi);
10343 SET_BlendEquationSeparateiARB(table, save_BlendEquationSeparatei);
10345 /* GL_ARB_geometry_shader4 */
10346 SET_ProgramParameteriARB(table, save_ProgramParameteri);
10347 SET_FramebufferTextureARB(table, save_FramebufferTexture);
10348 SET_FramebufferTextureFaceARB(table, save_FramebufferTextureFace);
10350 /* GL_ARB_sync */
10351 _mesa_init_sync_dispatch(table);
10352 SET_WaitSync(table, save_WaitSync);
10354 return table;
10359 static const char *
10360 enum_string(GLenum k)
10362 return _mesa_lookup_enum_by_nr(k);
10367 * Print the commands in a display list. For debugging only.
10368 * TODO: many commands aren't handled yet.
10370 static void GLAPIENTRY
10371 print_list(struct gl_context *ctx, GLuint list)
10373 struct gl_display_list *dlist;
10374 Node *n;
10375 GLboolean done;
10377 if (!islist(ctx, list)) {
10378 printf("%u is not a display list ID\n", list);
10379 return;
10382 dlist = lookup_list(ctx, list);
10383 if (!dlist)
10384 return;
10386 n = dlist->Head;
10388 printf("START-LIST %u, address %p\n", list, (void *) n);
10390 done = n ? GL_FALSE : GL_TRUE;
10391 while (!done) {
10392 const OpCode opcode = n[0].opcode;
10394 if (is_ext_opcode(opcode)) {
10395 n += ext_opcode_print(ctx, n);
10397 else {
10398 switch (opcode) {
10399 case OPCODE_ACCUM:
10400 printf("Accum %s %g\n", enum_string(n[1].e), n[2].f);
10401 break;
10402 case OPCODE_BITMAP:
10403 printf("Bitmap %d %d %g %g %g %g %p\n", n[1].i, n[2].i,
10404 n[3].f, n[4].f, n[5].f, n[6].f, (void *) n[7].data);
10405 break;
10406 case OPCODE_CALL_LIST:
10407 printf("CallList %d\n", (int) n[1].ui);
10408 break;
10409 case OPCODE_CALL_LIST_OFFSET:
10410 printf("CallList %d + offset %u = %u\n", (int) n[1].ui,
10411 ctx->List.ListBase, ctx->List.ListBase + n[1].ui);
10412 break;
10413 case OPCODE_COLOR_TABLE_PARAMETER_FV:
10414 printf("ColorTableParameterfv %s %s %f %f %f %f\n",
10415 enum_string(n[1].e), enum_string(n[2].e),
10416 n[3].f, n[4].f, n[5].f, n[6].f);
10417 break;
10418 case OPCODE_COLOR_TABLE_PARAMETER_IV:
10419 printf("ColorTableParameteriv %s %s %d %d %d %d\n",
10420 enum_string(n[1].e), enum_string(n[2].e),
10421 n[3].i, n[4].i, n[5].i, n[6].i);
10422 break;
10423 case OPCODE_DISABLE:
10424 printf("Disable %s\n", enum_string(n[1].e));
10425 break;
10426 case OPCODE_ENABLE:
10427 printf("Enable %s\n", enum_string(n[1].e));
10428 break;
10429 case OPCODE_FRUSTUM:
10430 printf("Frustum %g %g %g %g %g %g\n",
10431 n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f);
10432 break;
10433 case OPCODE_LINE_STIPPLE:
10434 printf("LineStipple %d %x\n", n[1].i, (int) n[2].us);
10435 break;
10436 case OPCODE_LOAD_IDENTITY:
10437 printf("LoadIdentity\n");
10438 break;
10439 case OPCODE_LOAD_MATRIX:
10440 printf("LoadMatrix\n");
10441 printf(" %8f %8f %8f %8f\n",
10442 n[1].f, n[5].f, n[9].f, n[13].f);
10443 printf(" %8f %8f %8f %8f\n",
10444 n[2].f, n[6].f, n[10].f, n[14].f);
10445 printf(" %8f %8f %8f %8f\n",
10446 n[3].f, n[7].f, n[11].f, n[15].f);
10447 printf(" %8f %8f %8f %8f\n",
10448 n[4].f, n[8].f, n[12].f, n[16].f);
10449 break;
10450 case OPCODE_MULT_MATRIX:
10451 printf("MultMatrix (or Rotate)\n");
10452 printf(" %8f %8f %8f %8f\n",
10453 n[1].f, n[5].f, n[9].f, n[13].f);
10454 printf(" %8f %8f %8f %8f\n",
10455 n[2].f, n[6].f, n[10].f, n[14].f);
10456 printf(" %8f %8f %8f %8f\n",
10457 n[3].f, n[7].f, n[11].f, n[15].f);
10458 printf(" %8f %8f %8f %8f\n",
10459 n[4].f, n[8].f, n[12].f, n[16].f);
10460 break;
10461 case OPCODE_ORTHO:
10462 printf("Ortho %g %g %g %g %g %g\n",
10463 n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f);
10464 break;
10465 case OPCODE_POP_ATTRIB:
10466 printf("PopAttrib\n");
10467 break;
10468 case OPCODE_POP_MATRIX:
10469 printf("PopMatrix\n");
10470 break;
10471 case OPCODE_POP_NAME:
10472 printf("PopName\n");
10473 break;
10474 case OPCODE_PUSH_ATTRIB:
10475 printf("PushAttrib %x\n", n[1].bf);
10476 break;
10477 case OPCODE_PUSH_MATRIX:
10478 printf("PushMatrix\n");
10479 break;
10480 case OPCODE_PUSH_NAME:
10481 printf("PushName %d\n", (int) n[1].ui);
10482 break;
10483 case OPCODE_RASTER_POS:
10484 printf("RasterPos %g %g %g %g\n",
10485 n[1].f, n[2].f, n[3].f, n[4].f);
10486 break;
10487 case OPCODE_ROTATE:
10488 printf("Rotate %g %g %g %g\n",
10489 n[1].f, n[2].f, n[3].f, n[4].f);
10490 break;
10491 case OPCODE_SCALE:
10492 printf("Scale %g %g %g\n", n[1].f, n[2].f, n[3].f);
10493 break;
10494 case OPCODE_TRANSLATE:
10495 printf("Translate %g %g %g\n", n[1].f, n[2].f, n[3].f);
10496 break;
10497 case OPCODE_BIND_TEXTURE:
10498 printf("BindTexture %s %d\n",
10499 _mesa_lookup_enum_by_nr(n[1].ui), n[2].ui);
10500 break;
10501 case OPCODE_SHADE_MODEL:
10502 printf("ShadeModel %s\n", _mesa_lookup_enum_by_nr(n[1].ui));
10503 break;
10504 case OPCODE_MAP1:
10505 printf("Map1 %s %.3f %.3f %d %d\n",
10506 _mesa_lookup_enum_by_nr(n[1].ui),
10507 n[2].f, n[3].f, n[4].i, n[5].i);
10508 break;
10509 case OPCODE_MAP2:
10510 printf("Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
10511 _mesa_lookup_enum_by_nr(n[1].ui),
10512 n[2].f, n[3].f, n[4].f, n[5].f,
10513 n[6].i, n[7].i, n[8].i, n[9].i);
10514 break;
10515 case OPCODE_MAPGRID1:
10516 printf("MapGrid1 %d %.3f %.3f\n", n[1].i, n[2].f, n[3].f);
10517 break;
10518 case OPCODE_MAPGRID2:
10519 printf("MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
10520 n[1].i, n[2].f, n[3].f, n[4].i, n[5].f, n[6].f);
10521 break;
10522 case OPCODE_EVALMESH1:
10523 printf("EvalMesh1 %d %d\n", n[1].i, n[2].i);
10524 break;
10525 case OPCODE_EVALMESH2:
10526 printf("EvalMesh2 %d %d %d %d\n",
10527 n[1].i, n[2].i, n[3].i, n[4].i);
10528 break;
10530 case OPCODE_ATTR_1F_NV:
10531 printf("ATTR_1F_NV attr %d: %f\n", n[1].i, n[2].f);
10532 break;
10533 case OPCODE_ATTR_2F_NV:
10534 printf("ATTR_2F_NV attr %d: %f %f\n",
10535 n[1].i, n[2].f, n[3].f);
10536 break;
10537 case OPCODE_ATTR_3F_NV:
10538 printf("ATTR_3F_NV attr %d: %f %f %f\n",
10539 n[1].i, n[2].f, n[3].f, n[4].f);
10540 break;
10541 case OPCODE_ATTR_4F_NV:
10542 printf("ATTR_4F_NV attr %d: %f %f %f %f\n",
10543 n[1].i, n[2].f, n[3].f, n[4].f, n[5].f);
10544 break;
10545 case OPCODE_ATTR_1F_ARB:
10546 printf("ATTR_1F_ARB attr %d: %f\n", n[1].i, n[2].f);
10547 break;
10548 case OPCODE_ATTR_2F_ARB:
10549 printf("ATTR_2F_ARB attr %d: %f %f\n",
10550 n[1].i, n[2].f, n[3].f);
10551 break;
10552 case OPCODE_ATTR_3F_ARB:
10553 printf("ATTR_3F_ARB attr %d: %f %f %f\n",
10554 n[1].i, n[2].f, n[3].f, n[4].f);
10555 break;
10556 case OPCODE_ATTR_4F_ARB:
10557 printf("ATTR_4F_ARB attr %d: %f %f %f %f\n",
10558 n[1].i, n[2].f, n[3].f, n[4].f, n[5].f);
10559 break;
10561 case OPCODE_MATERIAL:
10562 printf("MATERIAL %x %x: %f %f %f %f\n",
10563 n[1].i, n[2].i, n[3].f, n[4].f, n[5].f, n[6].f);
10564 break;
10565 case OPCODE_BEGIN:
10566 printf("BEGIN %x\n", n[1].i);
10567 break;
10568 case OPCODE_END:
10569 printf("END\n");
10570 break;
10571 case OPCODE_RECTF:
10572 printf("RECTF %f %f %f %f\n", n[1].f, n[2].f, n[3].f,
10573 n[4].f);
10574 break;
10575 case OPCODE_EVAL_C1:
10576 printf("EVAL_C1 %f\n", n[1].f);
10577 break;
10578 case OPCODE_EVAL_C2:
10579 printf("EVAL_C2 %f %f\n", n[1].f, n[2].f);
10580 break;
10581 case OPCODE_EVAL_P1:
10582 printf("EVAL_P1 %d\n", n[1].i);
10583 break;
10584 case OPCODE_EVAL_P2:
10585 printf("EVAL_P2 %d %d\n", n[1].i, n[2].i);
10586 break;
10588 case OPCODE_PROVOKING_VERTEX:
10589 printf("ProvokingVertex %s\n",
10590 _mesa_lookup_enum_by_nr(n[1].ui));
10591 break;
10594 * meta opcodes/commands
10596 case OPCODE_ERROR:
10597 printf("Error: %s %s\n",
10598 enum_string(n[1].e), (const char *) n[2].data);
10599 break;
10600 case OPCODE_CONTINUE:
10601 printf("DISPLAY-LIST-CONTINUE\n");
10602 n = (Node *) n[1].next;
10603 break;
10604 case OPCODE_END_OF_LIST:
10605 printf("END-LIST %u\n", list);
10606 done = GL_TRUE;
10607 break;
10608 default:
10609 if (opcode < 0 || opcode > OPCODE_END_OF_LIST) {
10610 printf
10611 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
10612 opcode, (void *) n);
10613 return;
10615 else {
10616 printf("command %d, %u operands\n", opcode,
10617 InstSize[opcode]);
10620 /* increment n to point to next compiled command */
10621 if (opcode != OPCODE_CONTINUE) {
10622 n += InstSize[opcode];
10631 * Clients may call this function to help debug display list problems.
10632 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
10633 * changed, or break in the future without notice.
10635 void
10636 mesa_print_display_list(GLuint list)
10638 GET_CURRENT_CONTEXT(ctx);
10639 print_list(ctx, list);
10643 /**********************************************************************/
10644 /***** Initialization *****/
10645 /**********************************************************************/
10647 void
10648 _mesa_save_vtxfmt_init(GLvertexformat * vfmt)
10650 _MESA_INIT_ARRAYELT_VTXFMT(vfmt, _ae_);
10652 vfmt->Begin = save_Begin;
10654 _MESA_INIT_DLIST_VTXFMT(vfmt, save_);
10656 vfmt->Color3f = save_Color3f;
10657 vfmt->Color3fv = save_Color3fv;
10658 vfmt->Color4f = save_Color4f;
10659 vfmt->Color4fv = save_Color4fv;
10660 vfmt->EdgeFlag = save_EdgeFlag;
10661 vfmt->End = save_End;
10663 _MESA_INIT_EVAL_VTXFMT(vfmt, save_);
10665 vfmt->FogCoordfEXT = save_FogCoordfEXT;
10666 vfmt->FogCoordfvEXT = save_FogCoordfvEXT;
10667 vfmt->Indexf = save_Indexf;
10668 vfmt->Indexfv = save_Indexfv;
10669 vfmt->Materialfv = save_Materialfv;
10670 vfmt->MultiTexCoord1fARB = save_MultiTexCoord1f;
10671 vfmt->MultiTexCoord1fvARB = save_MultiTexCoord1fv;
10672 vfmt->MultiTexCoord2fARB = save_MultiTexCoord2f;
10673 vfmt->MultiTexCoord2fvARB = save_MultiTexCoord2fv;
10674 vfmt->MultiTexCoord3fARB = save_MultiTexCoord3f;
10675 vfmt->MultiTexCoord3fvARB = save_MultiTexCoord3fv;
10676 vfmt->MultiTexCoord4fARB = save_MultiTexCoord4f;
10677 vfmt->MultiTexCoord4fvARB = save_MultiTexCoord4fv;
10678 vfmt->Normal3f = save_Normal3f;
10679 vfmt->Normal3fv = save_Normal3fv;
10680 vfmt->SecondaryColor3fEXT = save_SecondaryColor3fEXT;
10681 vfmt->SecondaryColor3fvEXT = save_SecondaryColor3fvEXT;
10682 vfmt->TexCoord1f = save_TexCoord1f;
10683 vfmt->TexCoord1fv = save_TexCoord1fv;
10684 vfmt->TexCoord2f = save_TexCoord2f;
10685 vfmt->TexCoord2fv = save_TexCoord2fv;
10686 vfmt->TexCoord3f = save_TexCoord3f;
10687 vfmt->TexCoord3fv = save_TexCoord3fv;
10688 vfmt->TexCoord4f = save_TexCoord4f;
10689 vfmt->TexCoord4fv = save_TexCoord4fv;
10690 vfmt->Vertex2f = save_Vertex2f;
10691 vfmt->Vertex2fv = save_Vertex2fv;
10692 vfmt->Vertex3f = save_Vertex3f;
10693 vfmt->Vertex3fv = save_Vertex3fv;
10694 vfmt->Vertex4f = save_Vertex4f;
10695 vfmt->Vertex4fv = save_Vertex4fv;
10696 vfmt->VertexAttrib1fNV = save_VertexAttrib1fNV;
10697 vfmt->VertexAttrib1fvNV = save_VertexAttrib1fvNV;
10698 vfmt->VertexAttrib2fNV = save_VertexAttrib2fNV;
10699 vfmt->VertexAttrib2fvNV = save_VertexAttrib2fvNV;
10700 vfmt->VertexAttrib3fNV = save_VertexAttrib3fNV;
10701 vfmt->VertexAttrib3fvNV = save_VertexAttrib3fvNV;
10702 vfmt->VertexAttrib4fNV = save_VertexAttrib4fNV;
10703 vfmt->VertexAttrib4fvNV = save_VertexAttrib4fvNV;
10704 vfmt->VertexAttrib1fARB = save_VertexAttrib1fARB;
10705 vfmt->VertexAttrib1fvARB = save_VertexAttrib1fvARB;
10706 vfmt->VertexAttrib2fARB = save_VertexAttrib2fARB;
10707 vfmt->VertexAttrib2fvARB = save_VertexAttrib2fvARB;
10708 vfmt->VertexAttrib3fARB = save_VertexAttrib3fARB;
10709 vfmt->VertexAttrib3fvARB = save_VertexAttrib3fvARB;
10710 vfmt->VertexAttrib4fARB = save_VertexAttrib4fARB;
10711 vfmt->VertexAttrib4fvARB = save_VertexAttrib4fvARB;
10713 vfmt->Rectf = save_Rectf;
10715 /* The driver is required to implement these as
10716 * 1) They can probably do a better job.
10717 * 2) A lot of new mechanisms would have to be added to this module
10718 * to support it. That code would probably never get used,
10719 * because of (1).
10721 #if 0
10722 vfmt->DrawArrays = 0;
10723 vfmt->DrawElements = 0;
10724 vfmt->DrawRangeElements = 0;
10725 vfmt->MultiDrawElemementsEXT = 0;
10726 vfmt->DrawElementsBaseVertex = 0;
10727 vfmt->DrawRangeElementsBaseVertex = 0;
10728 vfmt->MultiDrawElemementsBaseVertex = 0;
10729 #endif
10733 void
10734 _mesa_install_dlist_vtxfmt(struct _glapi_table *disp,
10735 const GLvertexformat *vfmt)
10737 SET_CallList(disp, vfmt->CallList);
10738 SET_CallLists(disp, vfmt->CallLists);
10742 void _mesa_init_dlist_dispatch(struct _glapi_table *disp)
10744 SET_CallList(disp, _mesa_CallList);
10745 SET_CallLists(disp, _mesa_CallLists);
10747 SET_DeleteLists(disp, _mesa_DeleteLists);
10748 SET_EndList(disp, _mesa_EndList);
10749 SET_GenLists(disp, _mesa_GenLists);
10750 SET_IsList(disp, _mesa_IsList);
10751 SET_ListBase(disp, _mesa_ListBase);
10752 SET_NewList(disp, _mesa_NewList);
10756 #endif /* FEATURE_dlist */
10760 * Initialize display list state for given context.
10762 void
10763 _mesa_init_display_list(struct gl_context *ctx)
10765 static GLboolean tableInitialized = GL_FALSE;
10767 /* zero-out the instruction size table, just once */
10768 if (!tableInitialized) {
10769 memset(InstSize, 0, sizeof(InstSize));
10770 tableInitialized = GL_TRUE;
10773 /* extension info */
10774 ctx->ListExt = CALLOC_STRUCT(gl_list_extensions);
10776 /* Display list */
10777 ctx->ListState.CallDepth = 0;
10778 ctx->ExecuteFlag = GL_TRUE;
10779 ctx->CompileFlag = GL_FALSE;
10780 ctx->ListState.CurrentBlock = NULL;
10781 ctx->ListState.CurrentPos = 0;
10783 /* Display List group */
10784 ctx->List.ListBase = 0;
10786 #if FEATURE_dlist
10787 _mesa_save_vtxfmt_init(&ctx->ListState.ListVtxfmt);
10788 #endif
10792 void
10793 _mesa_free_display_list_data(struct gl_context *ctx)
10795 free(ctx->ListExt);
10796 ctx->ListExt = NULL;