2 * Mesa 3-D graphics library
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.
29 * Display lists management functions.
34 #include "api_arrayelt.h"
35 #include "api_loopback.h"
37 #include "mfeatures.h"
41 #if FEATURE_ARB_vertex_buffer_object
42 #include "bufferobj.h"
54 #include "extensions.h"
56 #include "framebuffer.h"
58 #include "glapi/glapi.h"
60 #include "histogram.h"
78 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
79 #include "shader/arbprogram.h"
80 #include "shader/program.h"
82 #if FEATURE_NV_vertex_program || FEATURE_NV_fragment_program
83 #include "shader/nvprogram.h"
84 #include "shader/program.h"
86 #if FEATURE_ATI_fragment_shader
87 #include "shader/atifragshader.h"
90 #include "math/m_matrix.h"
92 #include "glapi/dispatch.h"
97 * Other parts of Mesa (such as the VBO module) can plug into the display
98 * list system. This structure describes new display list instructions.
100 struct gl_list_instruction
103 void (*Execute
)( GLcontext
*ctx
, void *data
);
104 void (*Destroy
)( GLcontext
*ctx
, void *data
);
105 void (*Print
)( GLcontext
*ctx
, void *data
);
109 #define MAX_DLIST_EXT_OPCODES 16
112 * Used by device drivers to hook new commands into display lists.
114 struct gl_list_extensions
116 struct gl_list_instruction Opcode
[MAX_DLIST_EXT_OPCODES
];
125 * \param ctx GL context.
127 * Checks if dd_function_table::SaveNeedFlush is marked to flush
128 * stored (save) vertices, and calls
129 * dd_function_table::SaveFlushVertices if so.
131 #define SAVE_FLUSH_VERTICES(ctx) \
133 if (ctx->Driver.SaveNeedFlush) \
134 ctx->Driver.SaveFlushVertices(ctx); \
139 * Macro to assert that the API call was made outside the
140 * glBegin()/glEnd() pair, with return value.
142 * \param ctx GL context.
143 * \param retval value to return value in case the assertion fails.
145 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval) \
147 if (ctx->Driver.CurrentSavePrimitive <= GL_POLYGON || \
148 ctx->Driver.CurrentSavePrimitive == PRIM_INSIDE_UNKNOWN_PRIM) { \
149 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \
155 * Macro to assert that the API call was made outside the
156 * glBegin()/glEnd() pair.
158 * \param ctx GL context.
160 #define ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx) \
162 if (ctx->Driver.CurrentSavePrimitive <= GL_POLYGON || \
163 ctx->Driver.CurrentSavePrimitive == PRIM_INSIDE_UNKNOWN_PRIM) { \
164 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \
170 * Macro to assert that the API call was made outside the
171 * glBegin()/glEnd() pair and flush the vertices.
173 * \param ctx GL context.
175 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx) \
177 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx); \
178 SAVE_FLUSH_VERTICES(ctx); \
182 * Macro to assert that the API call was made outside the
183 * glBegin()/glEnd() pair and flush the vertices, with return value.
185 * \param ctx GL context.
186 * \param retval value to return value in case the assertion fails.
188 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval)\
190 ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval); \
191 SAVE_FLUSH_VERTICES(ctx); \
197 * Display list opcodes.
199 * The fact that these identifiers are assigned consecutive
200 * integer values starting at 0 is very important, see InstSize array usage)
204 OPCODE_INVALID
= -1, /* Force signed enum */
210 OPCODE_BLEND_EQUATION
,
211 OPCODE_BLEND_EQUATION_SEPARATE
,
212 OPCODE_BLEND_FUNC_SEPARATE
,
214 OPCODE_CALL_LIST_OFFSET
,
220 OPCODE_CLEAR_STENCIL
,
223 OPCODE_COLOR_MATERIAL
,
225 OPCODE_COLOR_TABLE_PARAMETER_FV
,
226 OPCODE_COLOR_TABLE_PARAMETER_IV
,
227 OPCODE_COLOR_SUB_TABLE
,
228 OPCODE_CONVOLUTION_FILTER_1D
,
229 OPCODE_CONVOLUTION_FILTER_2D
,
230 OPCODE_CONVOLUTION_PARAMETER_I
,
231 OPCODE_CONVOLUTION_PARAMETER_IV
,
232 OPCODE_CONVOLUTION_PARAMETER_F
,
233 OPCODE_CONVOLUTION_PARAMETER_FV
,
234 OPCODE_COPY_COLOR_SUB_TABLE
,
235 OPCODE_COPY_COLOR_TABLE
,
237 OPCODE_COPY_TEX_IMAGE1D
,
238 OPCODE_COPY_TEX_IMAGE2D
,
239 OPCODE_COPY_TEX_SUB_IMAGE1D
,
240 OPCODE_COPY_TEX_SUB_IMAGE2D
,
241 OPCODE_COPY_TEX_SUB_IMAGE3D
,
264 OPCODE_LOAD_IDENTITY
,
278 OPCODE_PIXEL_TRANSFER
,
281 OPCODE_POINT_PARAMETERS
,
283 OPCODE_POLYGON_STIPPLE
,
284 OPCODE_POLYGON_OFFSET
,
288 OPCODE_PRIORITIZE_TEXTURE
,
294 OPCODE_RESET_HISTOGRAM
,
295 OPCODE_RESET_MIN_MAX
,
299 OPCODE_SELECT_TEXTURE_SGIS
,
300 OPCODE_SELECT_TEXTURE_COORD_SET
,
311 OPCODE_TEX_SUB_IMAGE1D
,
312 OPCODE_TEX_SUB_IMAGE2D
,
313 OPCODE_TEX_SUB_IMAGE3D
,
317 /* GL_ARB_multitexture */
318 OPCODE_ACTIVE_TEXTURE
,
319 /* GL_ARB_texture_compression */
320 OPCODE_COMPRESSED_TEX_IMAGE_1D
,
321 OPCODE_COMPRESSED_TEX_IMAGE_2D
,
322 OPCODE_COMPRESSED_TEX_IMAGE_3D
,
323 OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
,
324 OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
,
325 OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
,
326 /* GL_ARB_multisample */
327 OPCODE_SAMPLE_COVERAGE
,
328 /* GL_ARB_window_pos */
329 OPCODE_WINDOW_POS_ARB
,
330 /* GL_NV_vertex_program */
331 OPCODE_BIND_PROGRAM_NV
,
332 OPCODE_EXECUTE_PROGRAM_NV
,
333 OPCODE_REQUEST_RESIDENT_PROGRAMS_NV
,
334 OPCODE_LOAD_PROGRAM_NV
,
335 OPCODE_TRACK_MATRIX_NV
,
336 /* GL_NV_fragment_program */
337 OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
,
338 OPCODE_PROGRAM_NAMED_PARAMETER_NV
,
339 /* GL_EXT_stencil_two_side */
340 OPCODE_ACTIVE_STENCIL_FACE_EXT
,
341 /* GL_EXT_depth_bounds_test */
342 OPCODE_DEPTH_BOUNDS_EXT
,
343 /* GL_ARB_vertex/fragment_program */
344 OPCODE_PROGRAM_STRING_ARB
,
345 OPCODE_PROGRAM_ENV_PARAMETER_ARB
,
346 /* GL_ARB_occlusion_query */
347 OPCODE_BEGIN_QUERY_ARB
,
348 OPCODE_END_QUERY_ARB
,
349 /* GL_ARB_draw_buffers */
350 OPCODE_DRAW_BUFFERS_ARB
,
351 /* GL_ATI_fragment_shader */
352 OPCODE_TEX_BUMP_PARAMETER_ATI
,
353 /* GL_ATI_fragment_shader */
354 OPCODE_BIND_FRAGMENT_SHADER_ATI
,
355 OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
,
357 OPCODE_STENCIL_FUNC_SEPARATE
,
358 OPCODE_STENCIL_OP_SEPARATE
,
359 OPCODE_STENCIL_MASK_SEPARATE
,
361 /* GL_ARB_shader_objects */
379 OPCODE_UNIFORM_MATRIX22
,
380 OPCODE_UNIFORM_MATRIX33
,
381 OPCODE_UNIFORM_MATRIX44
,
382 OPCODE_UNIFORM_MATRIX23
,
383 OPCODE_UNIFORM_MATRIX32
,
384 OPCODE_UNIFORM_MATRIX24
,
385 OPCODE_UNIFORM_MATRIX42
,
386 OPCODE_UNIFORM_MATRIX34
,
387 OPCODE_UNIFORM_MATRIX43
,
389 /* GL_EXT_framebuffer_blit */
390 OPCODE_BLIT_FRAMEBUFFER
,
392 /* Vertex attributes -- fallback for when optimized display
393 * list build isn't active.
412 /* GL_EXT_provoking_vertex */
413 OPCODE_PROVOKING_VERTEX
,
415 /* The following three are meta instructions */
416 OPCODE_ERROR
, /* raise compiled-in error */
427 * Display list instructions are stored as sequences of "nodes". Nodes
428 * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
429 * are linked together with a pointer.
431 * Each instruction in the display list is stored as a sequence of
432 * contiguous nodes in memory.
433 * Each node is the union of a variety of data types.
448 void *next
; /* If prev node's opcode==OPCODE_CONTINUE */
452 typedef union gl_dlist_node Node
;
456 * How many nodes to allocate at a time.
458 * \note Reduced now that we hold vertices etc. elsewhere.
460 #define BLOCK_SIZE 256
465 * Number of nodes of storage needed for each instruction.
466 * Sizes for dynamically allocated opcodes are stored in the context struct.
468 static GLuint InstSize
[OPCODE_END_OF_LIST
+ 1];
474 void mesa_print_display_list(GLuint list
);
477 /**********************************************************************/
478 /***** Private *****/
479 /**********************************************************************/
483 * Make an empty display list. This is used by glGenLists() to
484 * reserve display list IDs.
486 static struct gl_display_list
*
487 make_list(GLuint name
, GLuint count
)
489 struct gl_display_list
*dlist
= CALLOC_STRUCT(gl_display_list
);
491 dlist
->Head
= (Node
*) _mesa_malloc(sizeof(Node
) * count
);
492 dlist
->Head
[0].opcode
= OPCODE_END_OF_LIST
;
498 * Lookup function to just encapsulate casting.
500 static INLINE
struct gl_display_list
*
501 lookup_list(GLcontext
*ctx
, GLuint list
)
503 return (struct gl_display_list
*)
504 _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
508 /** Is the given opcode an extension code? */
509 static INLINE GLboolean
510 is_ext_opcode(OpCode opcode
)
512 return (opcode
>= OPCODE_EXT_0
);
516 /** Destroy an extended opcode instruction */
518 ext_opcode_destroy(GLcontext
*ctx
, Node
*node
)
520 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
522 ctx
->ListExt
->Opcode
[i
].Destroy(ctx
, &node
[1]);
523 step
= ctx
->ListExt
->Opcode
[i
].Size
;
528 /** Execute an extended opcode instruction */
530 ext_opcode_execute(GLcontext
*ctx
, Node
*node
)
532 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
534 ctx
->ListExt
->Opcode
[i
].Execute(ctx
, &node
[1]);
535 step
= ctx
->ListExt
->Opcode
[i
].Size
;
540 /** Print an extended opcode instruction */
542 ext_opcode_print(GLcontext
*ctx
, Node
*node
)
544 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
546 ctx
->ListExt
->Opcode
[i
].Print(ctx
, &node
[1]);
547 step
= ctx
->ListExt
->Opcode
[i
].Size
;
553 * Delete the named display list, but don't remove from hash table.
554 * \param dlist - display list pointer
557 _mesa_delete_list(GLcontext
*ctx
, struct gl_display_list
*dlist
)
562 n
= block
= dlist
->Head
;
564 done
= block
? GL_FALSE
: GL_TRUE
;
566 const OpCode opcode
= n
[0].opcode
;
568 /* check for extension opcodes first */
569 if (is_ext_opcode(opcode
)) {
570 n
+= ext_opcode_destroy(ctx
, n
);
574 /* for some commands, we need to free malloc'd memory */
576 _mesa_free(n
[6].data
);
577 n
+= InstSize
[n
[0].opcode
];
580 _mesa_free(n
[10].data
);
581 n
+= InstSize
[n
[0].opcode
];
583 case OPCODE_DRAW_PIXELS
:
584 _mesa_free(n
[5].data
);
585 n
+= InstSize
[n
[0].opcode
];
588 _mesa_free(n
[7].data
);
589 n
+= InstSize
[n
[0].opcode
];
591 case OPCODE_COLOR_TABLE
:
592 _mesa_free(n
[6].data
);
593 n
+= InstSize
[n
[0].opcode
];
595 case OPCODE_COLOR_SUB_TABLE
:
596 _mesa_free(n
[6].data
);
597 n
+= InstSize
[n
[0].opcode
];
599 case OPCODE_CONVOLUTION_FILTER_1D
:
600 _mesa_free(n
[6].data
);
601 n
+= InstSize
[n
[0].opcode
];
603 case OPCODE_CONVOLUTION_FILTER_2D
:
604 _mesa_free(n
[7].data
);
605 n
+= InstSize
[n
[0].opcode
];
607 case OPCODE_POLYGON_STIPPLE
:
608 _mesa_free(n
[1].data
);
609 n
+= InstSize
[n
[0].opcode
];
611 case OPCODE_TEX_IMAGE1D
:
612 _mesa_free(n
[8].data
);
613 n
+= InstSize
[n
[0].opcode
];
615 case OPCODE_TEX_IMAGE2D
:
616 _mesa_free(n
[9].data
);
617 n
+= InstSize
[n
[0].opcode
];
619 case OPCODE_TEX_IMAGE3D
:
620 _mesa_free(n
[10].data
);
621 n
+= InstSize
[n
[0].opcode
];
623 case OPCODE_TEX_SUB_IMAGE1D
:
624 _mesa_free(n
[7].data
);
625 n
+= InstSize
[n
[0].opcode
];
627 case OPCODE_TEX_SUB_IMAGE2D
:
628 _mesa_free(n
[9].data
);
629 n
+= InstSize
[n
[0].opcode
];
631 case OPCODE_TEX_SUB_IMAGE3D
:
632 _mesa_free(n
[11].data
);
633 n
+= InstSize
[n
[0].opcode
];
635 case OPCODE_COMPRESSED_TEX_IMAGE_1D
:
636 _mesa_free(n
[7].data
);
637 n
+= InstSize
[n
[0].opcode
];
639 case OPCODE_COMPRESSED_TEX_IMAGE_2D
:
640 _mesa_free(n
[8].data
);
641 n
+= InstSize
[n
[0].opcode
];
643 case OPCODE_COMPRESSED_TEX_IMAGE_3D
:
644 _mesa_free(n
[9].data
);
645 n
+= InstSize
[n
[0].opcode
];
647 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
:
648 _mesa_free(n
[7].data
);
649 n
+= InstSize
[n
[0].opcode
];
651 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
:
652 _mesa_free(n
[9].data
);
653 n
+= InstSize
[n
[0].opcode
];
655 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
:
656 _mesa_free(n
[11].data
);
657 n
+= InstSize
[n
[0].opcode
];
659 #if FEATURE_NV_vertex_program
660 case OPCODE_LOAD_PROGRAM_NV
:
661 _mesa_free(n
[4].data
); /* program string */
662 n
+= InstSize
[n
[0].opcode
];
664 case OPCODE_REQUEST_RESIDENT_PROGRAMS_NV
:
665 _mesa_free(n
[2].data
); /* array of program ids */
666 n
+= InstSize
[n
[0].opcode
];
669 #if FEATURE_NV_fragment_program
670 case OPCODE_PROGRAM_NAMED_PARAMETER_NV
:
671 _mesa_free(n
[3].data
); /* parameter name */
672 n
+= InstSize
[n
[0].opcode
];
675 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
676 case OPCODE_PROGRAM_STRING_ARB
:
677 _mesa_free(n
[4].data
); /* program string */
678 n
+= InstSize
[n
[0].opcode
];
681 case OPCODE_UNIFORM_1FV
:
682 case OPCODE_UNIFORM_2FV
:
683 case OPCODE_UNIFORM_3FV
:
684 case OPCODE_UNIFORM_4FV
:
685 case OPCODE_UNIFORM_1IV
:
686 case OPCODE_UNIFORM_2IV
:
687 case OPCODE_UNIFORM_3IV
:
688 case OPCODE_UNIFORM_4IV
:
689 _mesa_free(n
[3].data
);
690 n
+= InstSize
[n
[0].opcode
];
692 case OPCODE_UNIFORM_MATRIX22
:
693 case OPCODE_UNIFORM_MATRIX33
:
694 case OPCODE_UNIFORM_MATRIX44
:
695 case OPCODE_UNIFORM_MATRIX24
:
696 case OPCODE_UNIFORM_MATRIX42
:
697 case OPCODE_UNIFORM_MATRIX23
:
698 case OPCODE_UNIFORM_MATRIX32
:
699 case OPCODE_UNIFORM_MATRIX34
:
700 case OPCODE_UNIFORM_MATRIX43
:
701 _mesa_free(n
[4].data
);
702 n
+= InstSize
[n
[0].opcode
];
705 case OPCODE_CONTINUE
:
706 n
= (Node
*) n
[1].next
;
710 case OPCODE_END_OF_LIST
:
715 /* Most frequent case */
716 n
+= InstSize
[n
[0].opcode
];
727 * Destroy a display list and remove from hash table.
728 * \param list - display list number
731 destroy_list(GLcontext
*ctx
, GLuint list
)
733 struct gl_display_list
*dlist
;
738 dlist
= lookup_list(ctx
, list
);
742 _mesa_delete_list(ctx
, dlist
);
743 _mesa_HashRemove(ctx
->Shared
->DisplayList
, list
);
748 * Translate the nth element of list from <type> to GLint.
751 translate_id(GLsizei n
, GLenum type
, const GLvoid
* list
)
763 bptr
= (GLbyte
*) list
;
764 return (GLint
) bptr
[n
];
765 case GL_UNSIGNED_BYTE
:
766 ubptr
= (GLubyte
*) list
;
767 return (GLint
) ubptr
[n
];
769 sptr
= (GLshort
*) list
;
770 return (GLint
) sptr
[n
];
771 case GL_UNSIGNED_SHORT
:
772 usptr
= (GLushort
*) list
;
773 return (GLint
) usptr
[n
];
775 iptr
= (GLint
*) list
;
777 case GL_UNSIGNED_INT
:
778 uiptr
= (GLuint
*) list
;
779 return (GLint
) uiptr
[n
];
781 fptr
= (GLfloat
*) list
;
782 return (GLint
) FLOORF(fptr
[n
]);
784 ubptr
= ((GLubyte
*) list
) + 2 * n
;
785 return (GLint
) ubptr
[0] * 256
788 ubptr
= ((GLubyte
*) list
) + 3 * n
;
789 return (GLint
) ubptr
[0] * 65536
790 + (GLint
) ubptr
[1] * 256
793 ubptr
= ((GLubyte
*) list
) + 4 * n
;
794 return (GLint
) ubptr
[0] * 16777216
795 + (GLint
) ubptr
[1] * 65536
796 + (GLint
) ubptr
[2] * 256
806 /**********************************************************************/
808 /**********************************************************************/
811 * Wrapper for _mesa_unpack_image() that handles pixel buffer objects.
812 * If we run out of memory, GL_OUT_OF_MEMORY will be recorded.
815 unpack_image(GLcontext
*ctx
, GLuint dimensions
,
816 GLsizei width
, GLsizei height
, GLsizei depth
,
817 GLenum format
, GLenum type
, const GLvoid
* pixels
,
818 const struct gl_pixelstore_attrib
*unpack
)
820 if (!_mesa_is_bufferobj(unpack
->BufferObj
)) {
822 GLvoid
*image
= _mesa_unpack_image(dimensions
, width
, height
, depth
,
823 format
, type
, pixels
, unpack
);
824 if (pixels
&& !image
) {
825 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "display list construction");
829 else if (_mesa_validate_pbo_access(dimensions
, unpack
, width
, height
, depth
,
830 format
, type
, pixels
)) {
831 const GLubyte
*map
, *src
;
835 ctx
->Driver
.MapBuffer(ctx
, GL_PIXEL_UNPACK_BUFFER_EXT
,
836 GL_READ_ONLY_ARB
, unpack
->BufferObj
);
838 /* unable to map src buffer! */
839 _mesa_error(ctx
, GL_INVALID_OPERATION
, "unable to map PBO");
843 src
= ADD_POINTERS(map
, pixels
);
844 image
= _mesa_unpack_image(dimensions
, width
, height
, depth
,
845 format
, type
, src
, unpack
);
847 ctx
->Driver
.UnmapBuffer(ctx
, GL_PIXEL_UNPACK_BUFFER_EXT
,
851 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "display list construction");
861 * Allocate space for a display list instruction (opcode + payload space).
862 * \param opcode the instruction opcode (OPCODE_* value)
863 * \param bytes instruction payload size (not counting opcode)
864 * \return pointer to allocated memory (the opcode space)
867 dlist_alloc(GLcontext
*ctx
, OpCode opcode
, GLuint bytes
)
869 const GLuint numNodes
= 1 + (bytes
+ sizeof(Node
) - 1) / sizeof(Node
);
872 if (opcode
< (GLuint
) OPCODE_EXT_0
) {
873 if (InstSize
[opcode
] == 0) {
874 /* save instruction size now */
875 InstSize
[opcode
] = numNodes
;
878 /* make sure instruction size agrees */
879 ASSERT(numNodes
== InstSize
[opcode
]);
883 if (ctx
->ListState
.CurrentPos
+ numNodes
+ 2 > BLOCK_SIZE
) {
884 /* This block is full. Allocate a new block and chain to it */
886 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
887 n
[0].opcode
= OPCODE_CONTINUE
;
888 newblock
= (Node
*) _mesa_malloc(sizeof(Node
) * BLOCK_SIZE
);
890 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "Building display list");
893 n
[1].next
= (Node
*) newblock
;
894 ctx
->ListState
.CurrentBlock
= newblock
;
895 ctx
->ListState
.CurrentPos
= 0;
898 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
899 ctx
->ListState
.CurrentPos
+= numNodes
;
901 n
[0].opcode
= opcode
;
909 * Allocate space for a display list instruction. Used by callers outside
910 * this file for things like VBO vertex data.
912 * \param opcode the instruction opcode (OPCODE_* value)
913 * \param bytes instruction size in bytes, not counting opcode.
914 * \return pointer to the usable data area (not including the internal
918 _mesa_dlist_alloc(GLcontext
*ctx
, GLuint opcode
, GLuint bytes
)
920 Node
*n
= dlist_alloc(ctx
, (OpCode
) opcode
, bytes
);
922 return n
+ 1; /* return pointer to payload area, after opcode */
929 * This function allows modules and drivers to get their own opcodes
930 * for extending display list functionality.
931 * \param ctx the rendering context
932 * \param size number of bytes for storing the new display list command
933 * \param execute function to execute the new display list command
934 * \param destroy function to destroy the new display list command
935 * \param print function to print the new display list command
936 * \return the new opcode number or -1 if error
939 _mesa_dlist_alloc_opcode(GLcontext
*ctx
,
941 void (*execute
) (GLcontext
*, void *),
942 void (*destroy
) (GLcontext
*, void *),
943 void (*print
) (GLcontext
*, void *))
945 if (ctx
->ListExt
->NumOpcodes
< MAX_DLIST_EXT_OPCODES
) {
946 const GLuint i
= ctx
->ListExt
->NumOpcodes
++;
947 ctx
->ListExt
->Opcode
[i
].Size
=
948 1 + (size
+ sizeof(Node
) - 1) / sizeof(Node
);
949 ctx
->ListExt
->Opcode
[i
].Execute
= execute
;
950 ctx
->ListExt
->Opcode
[i
].Destroy
= destroy
;
951 ctx
->ListExt
->Opcode
[i
].Print
= print
;
952 return i
+ OPCODE_EXT_0
;
959 * Allocate space for a display list instruction. The space is basically
960 * an array of Nodes where node[0] holds the opcode, node[1] is the first
961 * function parameter, node[2] is the second parameter, etc.
963 * \param opcode one of OPCODE_x
964 * \param nparams number of function parameters
965 * \return pointer to start of instruction space
968 alloc_instruction(GLcontext
*ctx
, OpCode opcode
, GLuint nparams
)
970 return dlist_alloc(ctx
, opcode
, nparams
* sizeof(Node
));
976 * Display List compilation functions
978 static void GLAPIENTRY
979 save_Accum(GLenum op
, GLfloat value
)
981 GET_CURRENT_CONTEXT(ctx
);
983 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
984 n
= alloc_instruction(ctx
, OPCODE_ACCUM
, 2);
989 if (ctx
->ExecuteFlag
) {
990 CALL_Accum(ctx
->Exec
, (op
, value
));
995 static void GLAPIENTRY
996 save_AlphaFunc(GLenum func
, GLclampf ref
)
998 GET_CURRENT_CONTEXT(ctx
);
1000 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1001 n
= alloc_instruction(ctx
, OPCODE_ALPHA_FUNC
, 2);
1004 n
[2].f
= (GLfloat
) ref
;
1006 if (ctx
->ExecuteFlag
) {
1007 CALL_AlphaFunc(ctx
->Exec
, (func
, ref
));
1012 static void GLAPIENTRY
1013 save_BindTexture(GLenum target
, GLuint texture
)
1015 GET_CURRENT_CONTEXT(ctx
);
1017 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1018 n
= alloc_instruction(ctx
, OPCODE_BIND_TEXTURE
, 2);
1023 if (ctx
->ExecuteFlag
) {
1024 CALL_BindTexture(ctx
->Exec
, (target
, texture
));
1029 static void GLAPIENTRY
1030 save_Bitmap(GLsizei width
, GLsizei height
,
1031 GLfloat xorig
, GLfloat yorig
,
1032 GLfloat xmove
, GLfloat ymove
, const GLubyte
* pixels
)
1034 GET_CURRENT_CONTEXT(ctx
);
1036 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1037 n
= alloc_instruction(ctx
, OPCODE_BITMAP
, 7);
1039 n
[1].i
= (GLint
) width
;
1040 n
[2].i
= (GLint
) height
;
1045 n
[7].data
= _mesa_unpack_bitmap(width
, height
, pixels
, &ctx
->Unpack
);
1047 if (ctx
->ExecuteFlag
) {
1048 CALL_Bitmap(ctx
->Exec
, (width
, height
,
1049 xorig
, yorig
, xmove
, ymove
, pixels
));
1054 static void GLAPIENTRY
1055 save_BlendEquation(GLenum mode
)
1057 GET_CURRENT_CONTEXT(ctx
);
1059 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1060 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION
, 1);
1064 if (ctx
->ExecuteFlag
) {
1065 CALL_BlendEquation(ctx
->Exec
, (mode
));
1070 static void GLAPIENTRY
1071 save_BlendEquationSeparateEXT(GLenum modeRGB
, GLenum modeA
)
1073 GET_CURRENT_CONTEXT(ctx
);
1075 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1076 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_SEPARATE
, 2);
1081 if (ctx
->ExecuteFlag
) {
1082 CALL_BlendEquationSeparateEXT(ctx
->Exec
, (modeRGB
, modeA
));
1087 static void GLAPIENTRY
1088 save_BlendFuncSeparateEXT(GLenum sfactorRGB
, GLenum dfactorRGB
,
1089 GLenum sfactorA
, GLenum dfactorA
)
1091 GET_CURRENT_CONTEXT(ctx
);
1093 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1094 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE
, 4);
1096 n
[1].e
= sfactorRGB
;
1097 n
[2].e
= dfactorRGB
;
1101 if (ctx
->ExecuteFlag
) {
1102 CALL_BlendFuncSeparateEXT(ctx
->Exec
,
1103 (sfactorRGB
, dfactorRGB
, sfactorA
, dfactorA
));
1108 static void GLAPIENTRY
1109 save_BlendFunc(GLenum srcfactor
, GLenum dstfactor
)
1111 save_BlendFuncSeparateEXT(srcfactor
, dstfactor
, srcfactor
, dstfactor
);
1115 static void GLAPIENTRY
1116 save_BlendColor(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
1118 GET_CURRENT_CONTEXT(ctx
);
1120 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1121 n
= alloc_instruction(ctx
, OPCODE_BLEND_COLOR
, 4);
1128 if (ctx
->ExecuteFlag
) {
1129 CALL_BlendColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
1133 static void invalidate_saved_current_state( GLcontext
*ctx
)
1137 for (i
= 0; i
< VERT_ATTRIB_MAX
; i
++)
1138 ctx
->ListState
.ActiveAttribSize
[i
] = 0;
1140 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++)
1141 ctx
->ListState
.ActiveMaterialSize
[i
] = 0;
1143 memset(&ctx
->ListState
.Current
, 0, sizeof ctx
->ListState
.Current
);
1145 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
1148 static void GLAPIENTRY
1149 save_CallList(GLuint list
)
1151 GET_CURRENT_CONTEXT(ctx
);
1153 SAVE_FLUSH_VERTICES(ctx
);
1155 n
= alloc_instruction(ctx
, OPCODE_CALL_LIST
, 1);
1160 /* After this, we don't know what state we're in. Invalidate all
1161 * cached information previously gathered:
1163 invalidate_saved_current_state( ctx
);
1165 if (ctx
->ExecuteFlag
) {
1166 _mesa_CallList(list
);
1171 static void GLAPIENTRY
1172 save_CallLists(GLsizei num
, GLenum type
, const GLvoid
* lists
)
1174 GET_CURRENT_CONTEXT(ctx
);
1176 GLboolean typeErrorFlag
;
1178 SAVE_FLUSH_VERTICES(ctx
);
1182 case GL_UNSIGNED_BYTE
:
1184 case GL_UNSIGNED_SHORT
:
1186 case GL_UNSIGNED_INT
:
1191 typeErrorFlag
= GL_FALSE
;
1194 typeErrorFlag
= GL_TRUE
;
1197 for (i
= 0; i
< num
; i
++) {
1198 GLint list
= translate_id(i
, type
, lists
);
1199 Node
*n
= alloc_instruction(ctx
, OPCODE_CALL_LIST_OFFSET
, 2);
1202 n
[2].b
= typeErrorFlag
;
1206 /* After this, we don't know what state we're in. Invalidate all
1207 * cached information previously gathered:
1209 invalidate_saved_current_state( ctx
);
1211 if (ctx
->ExecuteFlag
) {
1212 CALL_CallLists(ctx
->Exec
, (num
, type
, lists
));
1217 static void GLAPIENTRY
1218 save_Clear(GLbitfield mask
)
1220 GET_CURRENT_CONTEXT(ctx
);
1222 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1223 n
= alloc_instruction(ctx
, OPCODE_CLEAR
, 1);
1227 if (ctx
->ExecuteFlag
) {
1228 CALL_Clear(ctx
->Exec
, (mask
));
1233 static void GLAPIENTRY
1234 save_ClearAccum(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
1236 GET_CURRENT_CONTEXT(ctx
);
1238 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1239 n
= alloc_instruction(ctx
, OPCODE_CLEAR_ACCUM
, 4);
1246 if (ctx
->ExecuteFlag
) {
1247 CALL_ClearAccum(ctx
->Exec
, (red
, green
, blue
, alpha
));
1252 static void GLAPIENTRY
1253 save_ClearColor(GLclampf red
, GLclampf green
, GLclampf blue
, GLclampf alpha
)
1255 GET_CURRENT_CONTEXT(ctx
);
1257 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1258 n
= alloc_instruction(ctx
, OPCODE_CLEAR_COLOR
, 4);
1265 if (ctx
->ExecuteFlag
) {
1266 CALL_ClearColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
1271 static void GLAPIENTRY
1272 save_ClearDepth(GLclampd depth
)
1274 GET_CURRENT_CONTEXT(ctx
);
1276 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1277 n
= alloc_instruction(ctx
, OPCODE_CLEAR_DEPTH
, 1);
1279 n
[1].f
= (GLfloat
) depth
;
1281 if (ctx
->ExecuteFlag
) {
1282 CALL_ClearDepth(ctx
->Exec
, (depth
));
1287 static void GLAPIENTRY
1288 save_ClearIndex(GLfloat c
)
1290 GET_CURRENT_CONTEXT(ctx
);
1292 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1293 n
= alloc_instruction(ctx
, OPCODE_CLEAR_INDEX
, 1);
1297 if (ctx
->ExecuteFlag
) {
1298 CALL_ClearIndex(ctx
->Exec
, (c
));
1303 static void GLAPIENTRY
1304 save_ClearStencil(GLint s
)
1306 GET_CURRENT_CONTEXT(ctx
);
1308 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1309 n
= alloc_instruction(ctx
, OPCODE_CLEAR_STENCIL
, 1);
1313 if (ctx
->ExecuteFlag
) {
1314 CALL_ClearStencil(ctx
->Exec
, (s
));
1319 static void GLAPIENTRY
1320 save_ClipPlane(GLenum plane
, const GLdouble
* equ
)
1322 GET_CURRENT_CONTEXT(ctx
);
1324 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1325 n
= alloc_instruction(ctx
, OPCODE_CLIP_PLANE
, 5);
1328 n
[2].f
= (GLfloat
) equ
[0];
1329 n
[3].f
= (GLfloat
) equ
[1];
1330 n
[4].f
= (GLfloat
) equ
[2];
1331 n
[5].f
= (GLfloat
) equ
[3];
1333 if (ctx
->ExecuteFlag
) {
1334 CALL_ClipPlane(ctx
->Exec
, (plane
, equ
));
1340 static void GLAPIENTRY
1341 save_ColorMask(GLboolean red
, GLboolean green
,
1342 GLboolean blue
, GLboolean alpha
)
1344 GET_CURRENT_CONTEXT(ctx
);
1346 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1347 n
= alloc_instruction(ctx
, OPCODE_COLOR_MASK
, 4);
1354 if (ctx
->ExecuteFlag
) {
1355 CALL_ColorMask(ctx
->Exec
, (red
, green
, blue
, alpha
));
1360 static void GLAPIENTRY
1361 save_ColorMaterial(GLenum face
, GLenum mode
)
1363 GET_CURRENT_CONTEXT(ctx
);
1365 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1367 n
= alloc_instruction(ctx
, OPCODE_COLOR_MATERIAL
, 2);
1372 if (ctx
->ExecuteFlag
) {
1373 CALL_ColorMaterial(ctx
->Exec
, (face
, mode
));
1378 static void GLAPIENTRY
1379 save_ColorTable(GLenum target
, GLenum internalFormat
,
1380 GLsizei width
, GLenum format
, GLenum type
,
1381 const GLvoid
* table
)
1383 GET_CURRENT_CONTEXT(ctx
);
1384 if (_mesa_is_proxy_texture(target
)) {
1385 /* execute immediately */
1386 CALL_ColorTable(ctx
->Exec
, (target
, internalFormat
, width
,
1387 format
, type
, table
));
1391 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1392 n
= alloc_instruction(ctx
, OPCODE_COLOR_TABLE
, 6);
1395 n
[2].e
= internalFormat
;
1399 n
[6].data
= unpack_image(ctx
, 1, width
, 1, 1, format
, type
, table
,
1402 if (ctx
->ExecuteFlag
) {
1403 CALL_ColorTable(ctx
->Exec
, (target
, internalFormat
, width
,
1404 format
, type
, table
));
1411 static void GLAPIENTRY
1412 save_ColorTableParameterfv(GLenum target
, GLenum pname
,
1413 const GLfloat
*params
)
1415 GET_CURRENT_CONTEXT(ctx
);
1418 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1420 n
= alloc_instruction(ctx
, OPCODE_COLOR_TABLE_PARAMETER_FV
, 6);
1425 if (pname
== GL_COLOR_TABLE_SGI
||
1426 pname
== GL_POST_CONVOLUTION_COLOR_TABLE_SGI
||
1427 pname
== GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI
||
1428 pname
== GL_TEXTURE_COLOR_TABLE_SGI
) {
1435 if (ctx
->ExecuteFlag
) {
1436 CALL_ColorTableParameterfv(ctx
->Exec
, (target
, pname
, params
));
1441 static void GLAPIENTRY
1442 save_ColorTableParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
1444 GET_CURRENT_CONTEXT(ctx
);
1447 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1449 n
= alloc_instruction(ctx
, OPCODE_COLOR_TABLE_PARAMETER_IV
, 6);
1454 if (pname
== GL_COLOR_TABLE_SGI
||
1455 pname
== GL_POST_CONVOLUTION_COLOR_TABLE_SGI
||
1456 pname
== GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI
||
1457 pname
== GL_TEXTURE_COLOR_TABLE_SGI
) {
1464 if (ctx
->ExecuteFlag
) {
1465 CALL_ColorTableParameteriv(ctx
->Exec
, (target
, pname
, params
));
1471 static void GLAPIENTRY
1472 save_ColorSubTable(GLenum target
, GLsizei start
, GLsizei count
,
1473 GLenum format
, GLenum type
, const GLvoid
* table
)
1475 GET_CURRENT_CONTEXT(ctx
);
1477 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1478 n
= alloc_instruction(ctx
, OPCODE_COLOR_SUB_TABLE
, 6);
1485 n
[6].data
= unpack_image(ctx
, 1, count
, 1, 1, format
, type
, table
,
1488 if (ctx
->ExecuteFlag
) {
1489 CALL_ColorSubTable(ctx
->Exec
,
1490 (target
, start
, count
, format
, type
, table
));
1495 static void GLAPIENTRY
1496 save_CopyColorSubTable(GLenum target
, GLsizei start
,
1497 GLint x
, GLint y
, GLsizei width
)
1499 GET_CURRENT_CONTEXT(ctx
);
1502 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1503 n
= alloc_instruction(ctx
, OPCODE_COPY_COLOR_SUB_TABLE
, 5);
1511 if (ctx
->ExecuteFlag
) {
1512 CALL_CopyColorSubTable(ctx
->Exec
, (target
, start
, x
, y
, width
));
1517 static void GLAPIENTRY
1518 save_CopyColorTable(GLenum target
, GLenum internalformat
,
1519 GLint x
, GLint y
, GLsizei width
)
1521 GET_CURRENT_CONTEXT(ctx
);
1524 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1525 n
= alloc_instruction(ctx
, OPCODE_COPY_COLOR_TABLE
, 5);
1528 n
[2].e
= internalformat
;
1533 if (ctx
->ExecuteFlag
) {
1534 CALL_CopyColorTable(ctx
->Exec
, (target
, internalformat
, x
, y
, width
));
1539 static void GLAPIENTRY
1540 save_ConvolutionFilter1D(GLenum target
, GLenum internalFormat
, GLsizei width
,
1541 GLenum format
, GLenum type
, const GLvoid
* filter
)
1543 GET_CURRENT_CONTEXT(ctx
);
1546 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1548 n
= alloc_instruction(ctx
, OPCODE_CONVOLUTION_FILTER_1D
, 6);
1551 n
[2].e
= internalFormat
;
1555 n
[6].data
= unpack_image(ctx
, 1, width
, 1, 1, format
, type
, filter
,
1558 if (ctx
->ExecuteFlag
) {
1559 CALL_ConvolutionFilter1D(ctx
->Exec
, (target
, internalFormat
, width
,
1560 format
, type
, filter
));
1565 static void GLAPIENTRY
1566 save_ConvolutionFilter2D(GLenum target
, GLenum internalFormat
,
1567 GLsizei width
, GLsizei height
, GLenum format
,
1568 GLenum type
, const GLvoid
* filter
)
1570 GET_CURRENT_CONTEXT(ctx
);
1573 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1575 n
= alloc_instruction(ctx
, OPCODE_CONVOLUTION_FILTER_2D
, 7);
1578 n
[2].e
= internalFormat
;
1583 n
[7].data
= unpack_image(ctx
, 2, width
, height
, 1, format
, type
, filter
,
1586 if (ctx
->ExecuteFlag
) {
1587 CALL_ConvolutionFilter2D(ctx
->Exec
,
1588 (target
, internalFormat
, width
, height
, format
,
1594 static void GLAPIENTRY
1595 save_ConvolutionParameteri(GLenum target
, GLenum pname
, GLint param
)
1597 GET_CURRENT_CONTEXT(ctx
);
1599 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1600 n
= alloc_instruction(ctx
, OPCODE_CONVOLUTION_PARAMETER_I
, 3);
1606 if (ctx
->ExecuteFlag
) {
1607 CALL_ConvolutionParameteri(ctx
->Exec
, (target
, pname
, param
));
1612 static void GLAPIENTRY
1613 save_ConvolutionParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
1615 GET_CURRENT_CONTEXT(ctx
);
1617 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1618 n
= alloc_instruction(ctx
, OPCODE_CONVOLUTION_PARAMETER_IV
, 6);
1623 if (pname
== GL_CONVOLUTION_BORDER_COLOR
||
1624 pname
== GL_CONVOLUTION_FILTER_SCALE
||
1625 pname
== GL_CONVOLUTION_FILTER_BIAS
) {
1631 n
[4].i
= n
[5].i
= n
[6].i
= 0;
1634 if (ctx
->ExecuteFlag
) {
1635 CALL_ConvolutionParameteriv(ctx
->Exec
, (target
, pname
, params
));
1640 static void GLAPIENTRY
1641 save_ConvolutionParameterf(GLenum target
, GLenum pname
, GLfloat param
)
1643 GET_CURRENT_CONTEXT(ctx
);
1645 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1646 n
= alloc_instruction(ctx
, OPCODE_CONVOLUTION_PARAMETER_F
, 3);
1652 if (ctx
->ExecuteFlag
) {
1653 CALL_ConvolutionParameterf(ctx
->Exec
, (target
, pname
, param
));
1658 static void GLAPIENTRY
1659 save_ConvolutionParameterfv(GLenum target
, GLenum pname
,
1660 const GLfloat
*params
)
1662 GET_CURRENT_CONTEXT(ctx
);
1664 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1665 n
= alloc_instruction(ctx
, OPCODE_CONVOLUTION_PARAMETER_FV
, 6);
1670 if (pname
== GL_CONVOLUTION_BORDER_COLOR
||
1671 pname
== GL_CONVOLUTION_FILTER_SCALE
||
1672 pname
== GL_CONVOLUTION_FILTER_BIAS
) {
1678 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
1681 if (ctx
->ExecuteFlag
) {
1682 CALL_ConvolutionParameterfv(ctx
->Exec
, (target
, pname
, params
));
1687 static void GLAPIENTRY
1688 save_CopyPixels(GLint x
, GLint y
, GLsizei width
, GLsizei height
, GLenum type
)
1690 GET_CURRENT_CONTEXT(ctx
);
1692 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1693 n
= alloc_instruction(ctx
, OPCODE_COPY_PIXELS
, 5);
1697 n
[3].i
= (GLint
) width
;
1698 n
[4].i
= (GLint
) height
;
1701 if (ctx
->ExecuteFlag
) {
1702 CALL_CopyPixels(ctx
->Exec
, (x
, y
, width
, height
, type
));
1708 static void GLAPIENTRY
1709 save_CopyTexImage1D(GLenum target
, GLint level
, GLenum internalformat
,
1710 GLint x
, GLint y
, GLsizei width
, GLint border
)
1712 GET_CURRENT_CONTEXT(ctx
);
1714 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1715 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_IMAGE1D
, 7);
1719 n
[3].e
= internalformat
;
1725 if (ctx
->ExecuteFlag
) {
1726 CALL_CopyTexImage1D(ctx
->Exec
, (target
, level
, internalformat
,
1727 x
, y
, width
, border
));
1732 static void GLAPIENTRY
1733 save_CopyTexImage2D(GLenum target
, GLint level
,
1734 GLenum internalformat
,
1735 GLint x
, GLint y
, GLsizei width
,
1736 GLsizei height
, GLint border
)
1738 GET_CURRENT_CONTEXT(ctx
);
1740 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1741 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_IMAGE2D
, 8);
1745 n
[3].e
= internalformat
;
1752 if (ctx
->ExecuteFlag
) {
1753 CALL_CopyTexImage2D(ctx
->Exec
, (target
, level
, internalformat
,
1754 x
, y
, width
, height
, border
));
1760 static void GLAPIENTRY
1761 save_CopyTexSubImage1D(GLenum target
, GLint level
,
1762 GLint xoffset
, GLint x
, GLint y
, GLsizei width
)
1764 GET_CURRENT_CONTEXT(ctx
);
1766 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1767 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE1D
, 6);
1776 if (ctx
->ExecuteFlag
) {
1777 CALL_CopyTexSubImage1D(ctx
->Exec
,
1778 (target
, level
, xoffset
, x
, y
, width
));
1783 static void GLAPIENTRY
1784 save_CopyTexSubImage2D(GLenum target
, GLint level
,
1785 GLint xoffset
, GLint yoffset
,
1786 GLint x
, GLint y
, GLsizei width
, GLint height
)
1788 GET_CURRENT_CONTEXT(ctx
);
1790 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1791 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE2D
, 8);
1802 if (ctx
->ExecuteFlag
) {
1803 CALL_CopyTexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
1804 x
, y
, width
, height
));
1809 static void GLAPIENTRY
1810 save_CopyTexSubImage3D(GLenum target
, GLint level
,
1811 GLint xoffset
, GLint yoffset
, GLint zoffset
,
1812 GLint x
, GLint y
, GLsizei width
, GLint height
)
1814 GET_CURRENT_CONTEXT(ctx
);
1816 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1817 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE3D
, 9);
1829 if (ctx
->ExecuteFlag
) {
1830 CALL_CopyTexSubImage3D(ctx
->Exec
, (target
, level
,
1831 xoffset
, yoffset
, zoffset
,
1832 x
, y
, width
, height
));
1837 static void GLAPIENTRY
1838 save_CullFace(GLenum mode
)
1840 GET_CURRENT_CONTEXT(ctx
);
1842 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1843 n
= alloc_instruction(ctx
, OPCODE_CULL_FACE
, 1);
1847 if (ctx
->ExecuteFlag
) {
1848 CALL_CullFace(ctx
->Exec
, (mode
));
1853 static void GLAPIENTRY
1854 save_DepthFunc(GLenum func
)
1856 GET_CURRENT_CONTEXT(ctx
);
1858 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1859 n
= alloc_instruction(ctx
, OPCODE_DEPTH_FUNC
, 1);
1863 if (ctx
->ExecuteFlag
) {
1864 CALL_DepthFunc(ctx
->Exec
, (func
));
1869 static void GLAPIENTRY
1870 save_DepthMask(GLboolean mask
)
1872 GET_CURRENT_CONTEXT(ctx
);
1874 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1875 n
= alloc_instruction(ctx
, OPCODE_DEPTH_MASK
, 1);
1879 if (ctx
->ExecuteFlag
) {
1880 CALL_DepthMask(ctx
->Exec
, (mask
));
1885 static void GLAPIENTRY
1886 save_DepthRange(GLclampd nearval
, GLclampd farval
)
1888 GET_CURRENT_CONTEXT(ctx
);
1890 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1891 n
= alloc_instruction(ctx
, OPCODE_DEPTH_RANGE
, 2);
1893 n
[1].f
= (GLfloat
) nearval
;
1894 n
[2].f
= (GLfloat
) farval
;
1896 if (ctx
->ExecuteFlag
) {
1897 CALL_DepthRange(ctx
->Exec
, (nearval
, farval
));
1902 static void GLAPIENTRY
1903 save_Disable(GLenum cap
)
1905 GET_CURRENT_CONTEXT(ctx
);
1907 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1908 n
= alloc_instruction(ctx
, OPCODE_DISABLE
, 1);
1912 if (ctx
->ExecuteFlag
) {
1913 CALL_Disable(ctx
->Exec
, (cap
));
1918 static void GLAPIENTRY
1919 save_DrawBuffer(GLenum mode
)
1921 GET_CURRENT_CONTEXT(ctx
);
1923 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1924 n
= alloc_instruction(ctx
, OPCODE_DRAW_BUFFER
, 1);
1928 if (ctx
->ExecuteFlag
) {
1929 CALL_DrawBuffer(ctx
->Exec
, (mode
));
1934 static void GLAPIENTRY
1935 save_DrawPixels(GLsizei width
, GLsizei height
,
1936 GLenum format
, GLenum type
, const GLvoid
* pixels
)
1938 GET_CURRENT_CONTEXT(ctx
);
1941 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1943 n
= alloc_instruction(ctx
, OPCODE_DRAW_PIXELS
, 5);
1949 n
[5].data
= unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
1950 pixels
, &ctx
->Unpack
);
1952 if (ctx
->ExecuteFlag
) {
1953 CALL_DrawPixels(ctx
->Exec
, (width
, height
, format
, type
, pixels
));
1959 static void GLAPIENTRY
1960 save_Enable(GLenum cap
)
1962 GET_CURRENT_CONTEXT(ctx
);
1964 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1965 n
= alloc_instruction(ctx
, OPCODE_ENABLE
, 1);
1969 if (ctx
->ExecuteFlag
) {
1970 CALL_Enable(ctx
->Exec
, (cap
));
1976 static void GLAPIENTRY
1977 save_EvalMesh1(GLenum mode
, GLint i1
, GLint i2
)
1979 GET_CURRENT_CONTEXT(ctx
);
1981 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1982 n
= alloc_instruction(ctx
, OPCODE_EVALMESH1
, 3);
1988 if (ctx
->ExecuteFlag
) {
1989 CALL_EvalMesh1(ctx
->Exec
, (mode
, i1
, i2
));
1994 static void GLAPIENTRY
1995 save_EvalMesh2(GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
1997 GET_CURRENT_CONTEXT(ctx
);
1999 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2000 n
= alloc_instruction(ctx
, OPCODE_EVALMESH2
, 5);
2008 if (ctx
->ExecuteFlag
) {
2009 CALL_EvalMesh2(ctx
->Exec
, (mode
, i1
, i2
, j1
, j2
));
2016 static void GLAPIENTRY
2017 save_Fogfv(GLenum pname
, const GLfloat
*params
)
2019 GET_CURRENT_CONTEXT(ctx
);
2021 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2022 n
= alloc_instruction(ctx
, OPCODE_FOG
, 5);
2030 if (ctx
->ExecuteFlag
) {
2031 CALL_Fogfv(ctx
->Exec
, (pname
, params
));
2036 static void GLAPIENTRY
2037 save_Fogf(GLenum pname
, GLfloat param
)
2041 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2042 save_Fogfv(pname
, parray
);
2046 static void GLAPIENTRY
2047 save_Fogiv(GLenum pname
, const GLint
*params
)
2052 case GL_FOG_DENSITY
:
2056 p
[0] = (GLfloat
) *params
;
2062 p
[0] = INT_TO_FLOAT(params
[0]);
2063 p
[1] = INT_TO_FLOAT(params
[1]);
2064 p
[2] = INT_TO_FLOAT(params
[2]);
2065 p
[3] = INT_TO_FLOAT(params
[3]);
2068 /* Error will be caught later in gl_Fogfv */
2069 ASSIGN_4V(p
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
2071 save_Fogfv(pname
, p
);
2075 static void GLAPIENTRY
2076 save_Fogi(GLenum pname
, GLint param
)
2080 parray
[1] = parray
[2] = parray
[3] = 0;
2081 save_Fogiv(pname
, parray
);
2085 static void GLAPIENTRY
2086 save_FrontFace(GLenum mode
)
2088 GET_CURRENT_CONTEXT(ctx
);
2090 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2091 n
= alloc_instruction(ctx
, OPCODE_FRONT_FACE
, 1);
2095 if (ctx
->ExecuteFlag
) {
2096 CALL_FrontFace(ctx
->Exec
, (mode
));
2101 static void GLAPIENTRY
2102 save_Frustum(GLdouble left
, GLdouble right
,
2103 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
2105 GET_CURRENT_CONTEXT(ctx
);
2107 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2108 n
= alloc_instruction(ctx
, OPCODE_FRUSTUM
, 6);
2110 n
[1].f
= (GLfloat
) left
;
2111 n
[2].f
= (GLfloat
) right
;
2112 n
[3].f
= (GLfloat
) bottom
;
2113 n
[4].f
= (GLfloat
) top
;
2114 n
[5].f
= (GLfloat
) nearval
;
2115 n
[6].f
= (GLfloat
) farval
;
2117 if (ctx
->ExecuteFlag
) {
2118 CALL_Frustum(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
2123 static void GLAPIENTRY
2124 save_Hint(GLenum target
, GLenum mode
)
2126 GET_CURRENT_CONTEXT(ctx
);
2128 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2129 n
= alloc_instruction(ctx
, OPCODE_HINT
, 2);
2134 if (ctx
->ExecuteFlag
) {
2135 CALL_Hint(ctx
->Exec
, (target
, mode
));
2140 static void GLAPIENTRY
2141 save_Histogram(GLenum target
, GLsizei width
, GLenum internalFormat
,
2144 GET_CURRENT_CONTEXT(ctx
);
2147 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2148 n
= alloc_instruction(ctx
, OPCODE_HISTOGRAM
, 4);
2152 n
[3].e
= internalFormat
;
2155 if (ctx
->ExecuteFlag
) {
2156 CALL_Histogram(ctx
->Exec
, (target
, width
, internalFormat
, sink
));
2161 static void GLAPIENTRY
2162 save_IndexMask(GLuint mask
)
2164 GET_CURRENT_CONTEXT(ctx
);
2166 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2167 n
= alloc_instruction(ctx
, OPCODE_INDEX_MASK
, 1);
2171 if (ctx
->ExecuteFlag
) {
2172 CALL_IndexMask(ctx
->Exec
, (mask
));
2177 static void GLAPIENTRY
2178 save_InitNames(void)
2180 GET_CURRENT_CONTEXT(ctx
);
2181 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2182 (void) alloc_instruction(ctx
, OPCODE_INIT_NAMES
, 0);
2183 if (ctx
->ExecuteFlag
) {
2184 CALL_InitNames(ctx
->Exec
, ());
2189 static void GLAPIENTRY
2190 save_Lightfv(GLenum light
, GLenum pname
, const GLfloat
*params
)
2192 GET_CURRENT_CONTEXT(ctx
);
2194 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2195 n
= alloc_instruction(ctx
, OPCODE_LIGHT
, 6);
2213 case GL_SPOT_DIRECTION
:
2216 case GL_SPOT_EXPONENT
:
2219 case GL_SPOT_CUTOFF
:
2222 case GL_CONSTANT_ATTENUATION
:
2225 case GL_LINEAR_ATTENUATION
:
2228 case GL_QUADRATIC_ATTENUATION
:
2234 for (i
= 0; i
< nParams
; i
++) {
2235 n
[3 + i
].f
= params
[i
];
2238 if (ctx
->ExecuteFlag
) {
2239 CALL_Lightfv(ctx
->Exec
, (light
, pname
, params
));
2244 static void GLAPIENTRY
2245 save_Lightf(GLenum light
, GLenum pname
, GLfloat param
)
2249 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2250 save_Lightfv(light
, pname
, parray
);
2254 static void GLAPIENTRY
2255 save_Lightiv(GLenum light
, GLenum pname
, const GLint
*params
)
2262 fparam
[0] = INT_TO_FLOAT(params
[0]);
2263 fparam
[1] = INT_TO_FLOAT(params
[1]);
2264 fparam
[2] = INT_TO_FLOAT(params
[2]);
2265 fparam
[3] = INT_TO_FLOAT(params
[3]);
2268 fparam
[0] = (GLfloat
) params
[0];
2269 fparam
[1] = (GLfloat
) params
[1];
2270 fparam
[2] = (GLfloat
) params
[2];
2271 fparam
[3] = (GLfloat
) params
[3];
2273 case GL_SPOT_DIRECTION
:
2274 fparam
[0] = (GLfloat
) params
[0];
2275 fparam
[1] = (GLfloat
) params
[1];
2276 fparam
[2] = (GLfloat
) params
[2];
2278 case GL_SPOT_EXPONENT
:
2279 case GL_SPOT_CUTOFF
:
2280 case GL_CONSTANT_ATTENUATION
:
2281 case GL_LINEAR_ATTENUATION
:
2282 case GL_QUADRATIC_ATTENUATION
:
2283 fparam
[0] = (GLfloat
) params
[0];
2286 /* error will be caught later in gl_Lightfv */
2289 save_Lightfv(light
, pname
, fparam
);
2293 static void GLAPIENTRY
2294 save_Lighti(GLenum light
, GLenum pname
, GLint param
)
2298 parray
[1] = parray
[2] = parray
[3] = 0;
2299 save_Lightiv(light
, pname
, parray
);
2303 static void GLAPIENTRY
2304 save_LightModelfv(GLenum pname
, const GLfloat
*params
)
2306 GET_CURRENT_CONTEXT(ctx
);
2308 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2309 n
= alloc_instruction(ctx
, OPCODE_LIGHT_MODEL
, 5);
2317 if (ctx
->ExecuteFlag
) {
2318 CALL_LightModelfv(ctx
->Exec
, (pname
, params
));
2323 static void GLAPIENTRY
2324 save_LightModelf(GLenum pname
, GLfloat param
)
2328 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2329 save_LightModelfv(pname
, parray
);
2333 static void GLAPIENTRY
2334 save_LightModeliv(GLenum pname
, const GLint
*params
)
2338 case GL_LIGHT_MODEL_AMBIENT
:
2339 fparam
[0] = INT_TO_FLOAT(params
[0]);
2340 fparam
[1] = INT_TO_FLOAT(params
[1]);
2341 fparam
[2] = INT_TO_FLOAT(params
[2]);
2342 fparam
[3] = INT_TO_FLOAT(params
[3]);
2344 case GL_LIGHT_MODEL_LOCAL_VIEWER
:
2345 case GL_LIGHT_MODEL_TWO_SIDE
:
2346 case GL_LIGHT_MODEL_COLOR_CONTROL
:
2347 fparam
[0] = (GLfloat
) params
[0];
2353 /* Error will be caught later in gl_LightModelfv */
2354 ASSIGN_4V(fparam
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
2356 save_LightModelfv(pname
, fparam
);
2360 static void GLAPIENTRY
2361 save_LightModeli(GLenum pname
, GLint param
)
2365 parray
[1] = parray
[2] = parray
[3] = 0;
2366 save_LightModeliv(pname
, parray
);
2370 static void GLAPIENTRY
2371 save_LineStipple(GLint factor
, GLushort pattern
)
2373 GET_CURRENT_CONTEXT(ctx
);
2375 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2376 n
= alloc_instruction(ctx
, OPCODE_LINE_STIPPLE
, 2);
2381 if (ctx
->ExecuteFlag
) {
2382 CALL_LineStipple(ctx
->Exec
, (factor
, pattern
));
2387 static void GLAPIENTRY
2388 save_LineWidth(GLfloat width
)
2390 GET_CURRENT_CONTEXT(ctx
);
2392 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2393 n
= alloc_instruction(ctx
, OPCODE_LINE_WIDTH
, 1);
2397 if (ctx
->ExecuteFlag
) {
2398 CALL_LineWidth(ctx
->Exec
, (width
));
2403 static void GLAPIENTRY
2404 save_ListBase(GLuint base
)
2406 GET_CURRENT_CONTEXT(ctx
);
2408 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2409 n
= alloc_instruction(ctx
, OPCODE_LIST_BASE
, 1);
2413 if (ctx
->ExecuteFlag
) {
2414 CALL_ListBase(ctx
->Exec
, (base
));
2419 static void GLAPIENTRY
2420 save_LoadIdentity(void)
2422 GET_CURRENT_CONTEXT(ctx
);
2423 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2424 (void) alloc_instruction(ctx
, OPCODE_LOAD_IDENTITY
, 0);
2425 if (ctx
->ExecuteFlag
) {
2426 CALL_LoadIdentity(ctx
->Exec
, ());
2431 static void GLAPIENTRY
2432 save_LoadMatrixf(const GLfloat
* m
)
2434 GET_CURRENT_CONTEXT(ctx
);
2436 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2437 n
= alloc_instruction(ctx
, OPCODE_LOAD_MATRIX
, 16);
2440 for (i
= 0; i
< 16; i
++) {
2444 if (ctx
->ExecuteFlag
) {
2445 CALL_LoadMatrixf(ctx
->Exec
, (m
));
2450 static void GLAPIENTRY
2451 save_LoadMatrixd(const GLdouble
* m
)
2455 for (i
= 0; i
< 16; i
++) {
2456 f
[i
] = (GLfloat
) m
[i
];
2458 save_LoadMatrixf(f
);
2462 static void GLAPIENTRY
2463 save_LoadName(GLuint name
)
2465 GET_CURRENT_CONTEXT(ctx
);
2467 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2468 n
= alloc_instruction(ctx
, OPCODE_LOAD_NAME
, 1);
2472 if (ctx
->ExecuteFlag
) {
2473 CALL_LoadName(ctx
->Exec
, (name
));
2478 static void GLAPIENTRY
2479 save_LogicOp(GLenum opcode
)
2481 GET_CURRENT_CONTEXT(ctx
);
2483 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2484 n
= alloc_instruction(ctx
, OPCODE_LOGIC_OP
, 1);
2488 if (ctx
->ExecuteFlag
) {
2489 CALL_LogicOp(ctx
->Exec
, (opcode
));
2494 static void GLAPIENTRY
2495 save_Map1d(GLenum target
, GLdouble u1
, GLdouble u2
, GLint stride
,
2496 GLint order
, const GLdouble
* points
)
2498 GET_CURRENT_CONTEXT(ctx
);
2500 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2501 n
= alloc_instruction(ctx
, OPCODE_MAP1
, 6);
2503 GLfloat
*pnts
= _mesa_copy_map_points1d(target
, stride
, order
, points
);
2505 n
[2].f
= (GLfloat
) u1
;
2506 n
[3].f
= (GLfloat
) u2
;
2507 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2509 n
[6].data
= (void *) pnts
;
2511 if (ctx
->ExecuteFlag
) {
2512 CALL_Map1d(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2516 static void GLAPIENTRY
2517 save_Map1f(GLenum target
, GLfloat u1
, GLfloat u2
, GLint stride
,
2518 GLint order
, const GLfloat
* points
)
2520 GET_CURRENT_CONTEXT(ctx
);
2522 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2523 n
= alloc_instruction(ctx
, OPCODE_MAP1
, 6);
2525 GLfloat
*pnts
= _mesa_copy_map_points1f(target
, stride
, order
, points
);
2529 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2531 n
[6].data
= (void *) pnts
;
2533 if (ctx
->ExecuteFlag
) {
2534 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2539 static void GLAPIENTRY
2540 save_Map2d(GLenum target
,
2541 GLdouble u1
, GLdouble u2
, GLint ustride
, GLint uorder
,
2542 GLdouble v1
, GLdouble v2
, GLint vstride
, GLint vorder
,
2543 const GLdouble
* points
)
2545 GET_CURRENT_CONTEXT(ctx
);
2547 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2548 n
= alloc_instruction(ctx
, OPCODE_MAP2
, 10);
2550 GLfloat
*pnts
= _mesa_copy_map_points2d(target
, ustride
, uorder
,
2551 vstride
, vorder
, points
);
2553 n
[2].f
= (GLfloat
) u1
;
2554 n
[3].f
= (GLfloat
) u2
;
2555 n
[4].f
= (GLfloat
) v1
;
2556 n
[5].f
= (GLfloat
) v2
;
2557 /* XXX verify these strides are correct */
2558 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2559 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2562 n
[10].data
= (void *) pnts
;
2564 if (ctx
->ExecuteFlag
) {
2565 CALL_Map2d(ctx
->Exec
, (target
,
2566 u1
, u2
, ustride
, uorder
,
2567 v1
, v2
, vstride
, vorder
, points
));
2572 static void GLAPIENTRY
2573 save_Map2f(GLenum target
,
2574 GLfloat u1
, GLfloat u2
, GLint ustride
, GLint uorder
,
2575 GLfloat v1
, GLfloat v2
, GLint vstride
, GLint vorder
,
2576 const GLfloat
* points
)
2578 GET_CURRENT_CONTEXT(ctx
);
2580 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2581 n
= alloc_instruction(ctx
, OPCODE_MAP2
, 10);
2583 GLfloat
*pnts
= _mesa_copy_map_points2f(target
, ustride
, uorder
,
2584 vstride
, vorder
, points
);
2590 /* XXX verify these strides are correct */
2591 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2592 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2595 n
[10].data
= (void *) pnts
;
2597 if (ctx
->ExecuteFlag
) {
2598 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
2599 v1
, v2
, vstride
, vorder
, points
));
2604 static void GLAPIENTRY
2605 save_MapGrid1f(GLint un
, GLfloat u1
, GLfloat u2
)
2607 GET_CURRENT_CONTEXT(ctx
);
2609 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2610 n
= alloc_instruction(ctx
, OPCODE_MAPGRID1
, 3);
2616 if (ctx
->ExecuteFlag
) {
2617 CALL_MapGrid1f(ctx
->Exec
, (un
, u1
, u2
));
2622 static void GLAPIENTRY
2623 save_MapGrid1d(GLint un
, GLdouble u1
, GLdouble u2
)
2625 save_MapGrid1f(un
, (GLfloat
) u1
, (GLfloat
) u2
);
2629 static void GLAPIENTRY
2630 save_MapGrid2f(GLint un
, GLfloat u1
, GLfloat u2
,
2631 GLint vn
, GLfloat v1
, GLfloat v2
)
2633 GET_CURRENT_CONTEXT(ctx
);
2635 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2636 n
= alloc_instruction(ctx
, OPCODE_MAPGRID2
, 6);
2645 if (ctx
->ExecuteFlag
) {
2646 CALL_MapGrid2f(ctx
->Exec
, (un
, u1
, u2
, vn
, v1
, v2
));
2652 static void GLAPIENTRY
2653 save_MapGrid2d(GLint un
, GLdouble u1
, GLdouble u2
,
2654 GLint vn
, GLdouble v1
, GLdouble v2
)
2656 save_MapGrid2f(un
, (GLfloat
) u1
, (GLfloat
) u2
,
2657 vn
, (GLfloat
) v1
, (GLfloat
) v2
);
2661 static void GLAPIENTRY
2662 save_MatrixMode(GLenum mode
)
2664 GET_CURRENT_CONTEXT(ctx
);
2666 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2667 n
= alloc_instruction(ctx
, OPCODE_MATRIX_MODE
, 1);
2671 if (ctx
->ExecuteFlag
) {
2672 CALL_MatrixMode(ctx
->Exec
, (mode
));
2677 static void GLAPIENTRY
2678 save_Minmax(GLenum target
, GLenum internalFormat
, GLboolean sink
)
2680 GET_CURRENT_CONTEXT(ctx
);
2683 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2684 n
= alloc_instruction(ctx
, OPCODE_MIN_MAX
, 3);
2687 n
[2].e
= internalFormat
;
2690 if (ctx
->ExecuteFlag
) {
2691 CALL_Minmax(ctx
->Exec
, (target
, internalFormat
, sink
));
2696 static void GLAPIENTRY
2697 save_MultMatrixf(const GLfloat
* m
)
2699 GET_CURRENT_CONTEXT(ctx
);
2701 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2702 n
= alloc_instruction(ctx
, OPCODE_MULT_MATRIX
, 16);
2705 for (i
= 0; i
< 16; i
++) {
2709 if (ctx
->ExecuteFlag
) {
2710 CALL_MultMatrixf(ctx
->Exec
, (m
));
2715 static void GLAPIENTRY
2716 save_MultMatrixd(const GLdouble
* m
)
2720 for (i
= 0; i
< 16; i
++) {
2721 f
[i
] = (GLfloat
) m
[i
];
2723 save_MultMatrixf(f
);
2727 static void GLAPIENTRY
2728 save_NewList(GLuint name
, GLenum mode
)
2730 GET_CURRENT_CONTEXT(ctx
);
2731 /* It's an error to call this function while building a display list */
2732 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
2739 static void GLAPIENTRY
2740 save_Ortho(GLdouble left
, GLdouble right
,
2741 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
2743 GET_CURRENT_CONTEXT(ctx
);
2745 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2746 n
= alloc_instruction(ctx
, OPCODE_ORTHO
, 6);
2748 n
[1].f
= (GLfloat
) left
;
2749 n
[2].f
= (GLfloat
) right
;
2750 n
[3].f
= (GLfloat
) bottom
;
2751 n
[4].f
= (GLfloat
) top
;
2752 n
[5].f
= (GLfloat
) nearval
;
2753 n
[6].f
= (GLfloat
) farval
;
2755 if (ctx
->ExecuteFlag
) {
2756 CALL_Ortho(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
2761 static void GLAPIENTRY
2762 save_PixelMapfv(GLenum map
, GLint mapsize
, const GLfloat
*values
)
2764 GET_CURRENT_CONTEXT(ctx
);
2766 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2767 n
= alloc_instruction(ctx
, OPCODE_PIXEL_MAP
, 3);
2771 n
[3].data
= (void *) _mesa_malloc(mapsize
* sizeof(GLfloat
));
2772 MEMCPY(n
[3].data
, (void *) values
, mapsize
* sizeof(GLfloat
));
2774 if (ctx
->ExecuteFlag
) {
2775 CALL_PixelMapfv(ctx
->Exec
, (map
, mapsize
, values
));
2780 static void GLAPIENTRY
2781 save_PixelMapuiv(GLenum map
, GLint mapsize
, const GLuint
*values
)
2783 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2785 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
2786 for (i
= 0; i
< mapsize
; i
++) {
2787 fvalues
[i
] = (GLfloat
) values
[i
];
2791 for (i
= 0; i
< mapsize
; i
++) {
2792 fvalues
[i
] = UINT_TO_FLOAT(values
[i
]);
2795 save_PixelMapfv(map
, mapsize
, fvalues
);
2799 static void GLAPIENTRY
2800 save_PixelMapusv(GLenum map
, GLint mapsize
, const GLushort
*values
)
2802 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2804 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
2805 for (i
= 0; i
< mapsize
; i
++) {
2806 fvalues
[i
] = (GLfloat
) values
[i
];
2810 for (i
= 0; i
< mapsize
; i
++) {
2811 fvalues
[i
] = USHORT_TO_FLOAT(values
[i
]);
2814 save_PixelMapfv(map
, mapsize
, fvalues
);
2818 static void GLAPIENTRY
2819 save_PixelTransferf(GLenum pname
, GLfloat param
)
2821 GET_CURRENT_CONTEXT(ctx
);
2823 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2824 n
= alloc_instruction(ctx
, OPCODE_PIXEL_TRANSFER
, 2);
2829 if (ctx
->ExecuteFlag
) {
2830 CALL_PixelTransferf(ctx
->Exec
, (pname
, param
));
2835 static void GLAPIENTRY
2836 save_PixelTransferi(GLenum pname
, GLint param
)
2838 save_PixelTransferf(pname
, (GLfloat
) param
);
2842 static void GLAPIENTRY
2843 save_PixelZoom(GLfloat xfactor
, GLfloat yfactor
)
2845 GET_CURRENT_CONTEXT(ctx
);
2847 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2848 n
= alloc_instruction(ctx
, OPCODE_PIXEL_ZOOM
, 2);
2853 if (ctx
->ExecuteFlag
) {
2854 CALL_PixelZoom(ctx
->Exec
, (xfactor
, yfactor
));
2859 static void GLAPIENTRY
2860 save_PointParameterfvEXT(GLenum pname
, const GLfloat
*params
)
2862 GET_CURRENT_CONTEXT(ctx
);
2864 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2865 n
= alloc_instruction(ctx
, OPCODE_POINT_PARAMETERS
, 4);
2872 if (ctx
->ExecuteFlag
) {
2873 CALL_PointParameterfvEXT(ctx
->Exec
, (pname
, params
));
2878 static void GLAPIENTRY
2879 save_PointParameterfEXT(GLenum pname
, GLfloat param
)
2883 parray
[1] = parray
[2] = 0.0F
;
2884 save_PointParameterfvEXT(pname
, parray
);
2887 static void GLAPIENTRY
2888 save_PointParameteriNV(GLenum pname
, GLint param
)
2891 parray
[0] = (GLfloat
) param
;
2892 parray
[1] = parray
[2] = 0.0F
;
2893 save_PointParameterfvEXT(pname
, parray
);
2896 static void GLAPIENTRY
2897 save_PointParameterivNV(GLenum pname
, const GLint
* param
)
2900 parray
[0] = (GLfloat
) param
[0];
2901 parray
[1] = parray
[2] = 0.0F
;
2902 save_PointParameterfvEXT(pname
, parray
);
2906 static void GLAPIENTRY
2907 save_PointSize(GLfloat size
)
2909 GET_CURRENT_CONTEXT(ctx
);
2911 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2912 n
= alloc_instruction(ctx
, OPCODE_POINT_SIZE
, 1);
2916 if (ctx
->ExecuteFlag
) {
2917 CALL_PointSize(ctx
->Exec
, (size
));
2922 static void GLAPIENTRY
2923 save_PolygonMode(GLenum face
, GLenum mode
)
2925 GET_CURRENT_CONTEXT(ctx
);
2927 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2928 n
= alloc_instruction(ctx
, OPCODE_POLYGON_MODE
, 2);
2933 if (ctx
->ExecuteFlag
) {
2934 CALL_PolygonMode(ctx
->Exec
, (face
, mode
));
2939 static void GLAPIENTRY
2940 save_PolygonStipple(const GLubyte
* pattern
)
2942 GET_CURRENT_CONTEXT(ctx
);
2945 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2947 n
= alloc_instruction(ctx
, OPCODE_POLYGON_STIPPLE
, 1);
2949 n
[1].data
= unpack_image(ctx
, 2, 32, 32, 1, GL_COLOR_INDEX
, GL_BITMAP
,
2950 pattern
, &ctx
->Unpack
);
2952 if (ctx
->ExecuteFlag
) {
2953 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) pattern
));
2958 static void GLAPIENTRY
2959 save_PolygonOffset(GLfloat factor
, GLfloat units
)
2961 GET_CURRENT_CONTEXT(ctx
);
2963 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2964 n
= alloc_instruction(ctx
, OPCODE_POLYGON_OFFSET
, 2);
2969 if (ctx
->ExecuteFlag
) {
2970 CALL_PolygonOffset(ctx
->Exec
, (factor
, units
));
2975 static void GLAPIENTRY
2976 save_PolygonOffsetEXT(GLfloat factor
, GLfloat bias
)
2978 GET_CURRENT_CONTEXT(ctx
);
2979 /* XXX mult by DepthMaxF here??? */
2980 save_PolygonOffset(factor
, ctx
->DrawBuffer
->_DepthMaxF
* bias
);
2984 static void GLAPIENTRY
2985 save_PopAttrib(void)
2987 GET_CURRENT_CONTEXT(ctx
);
2988 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2989 (void) alloc_instruction(ctx
, OPCODE_POP_ATTRIB
, 0);
2990 if (ctx
->ExecuteFlag
) {
2991 CALL_PopAttrib(ctx
->Exec
, ());
2996 static void GLAPIENTRY
2997 save_PopMatrix(void)
2999 GET_CURRENT_CONTEXT(ctx
);
3000 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3001 (void) alloc_instruction(ctx
, OPCODE_POP_MATRIX
, 0);
3002 if (ctx
->ExecuteFlag
) {
3003 CALL_PopMatrix(ctx
->Exec
, ());
3008 static void GLAPIENTRY
3011 GET_CURRENT_CONTEXT(ctx
);
3012 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3013 (void) alloc_instruction(ctx
, OPCODE_POP_NAME
, 0);
3014 if (ctx
->ExecuteFlag
) {
3015 CALL_PopName(ctx
->Exec
, ());
3020 static void GLAPIENTRY
3021 save_PrioritizeTextures(GLsizei num
, const GLuint
* textures
,
3022 const GLclampf
* priorities
)
3024 GET_CURRENT_CONTEXT(ctx
);
3026 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3028 for (i
= 0; i
< num
; i
++) {
3030 n
= alloc_instruction(ctx
, OPCODE_PRIORITIZE_TEXTURE
, 2);
3032 n
[1].ui
= textures
[i
];
3033 n
[2].f
= priorities
[i
];
3036 if (ctx
->ExecuteFlag
) {
3037 CALL_PrioritizeTextures(ctx
->Exec
, (num
, textures
, priorities
));
3042 static void GLAPIENTRY
3043 save_PushAttrib(GLbitfield mask
)
3045 GET_CURRENT_CONTEXT(ctx
);
3047 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3048 n
= alloc_instruction(ctx
, OPCODE_PUSH_ATTRIB
, 1);
3052 if (ctx
->ExecuteFlag
) {
3053 CALL_PushAttrib(ctx
->Exec
, (mask
));
3058 static void GLAPIENTRY
3059 save_PushMatrix(void)
3061 GET_CURRENT_CONTEXT(ctx
);
3062 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3063 (void) alloc_instruction(ctx
, OPCODE_PUSH_MATRIX
, 0);
3064 if (ctx
->ExecuteFlag
) {
3065 CALL_PushMatrix(ctx
->Exec
, ());
3070 static void GLAPIENTRY
3071 save_PushName(GLuint name
)
3073 GET_CURRENT_CONTEXT(ctx
);
3075 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3076 n
= alloc_instruction(ctx
, OPCODE_PUSH_NAME
, 1);
3080 if (ctx
->ExecuteFlag
) {
3081 CALL_PushName(ctx
->Exec
, (name
));
3086 static void GLAPIENTRY
3087 save_RasterPos4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3089 GET_CURRENT_CONTEXT(ctx
);
3091 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3092 n
= alloc_instruction(ctx
, OPCODE_RASTER_POS
, 4);
3099 if (ctx
->ExecuteFlag
) {
3100 CALL_RasterPos4f(ctx
->Exec
, (x
, y
, z
, w
));
3104 static void GLAPIENTRY
3105 save_RasterPos2d(GLdouble x
, GLdouble y
)
3107 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3110 static void GLAPIENTRY
3111 save_RasterPos2f(GLfloat x
, GLfloat y
)
3113 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
3116 static void GLAPIENTRY
3117 save_RasterPos2i(GLint x
, GLint y
)
3119 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3122 static void GLAPIENTRY
3123 save_RasterPos2s(GLshort x
, GLshort y
)
3125 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
3128 static void GLAPIENTRY
3129 save_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
3131 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3134 static void GLAPIENTRY
3135 save_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
3137 save_RasterPos4f(x
, y
, z
, 1.0F
);
3140 static void GLAPIENTRY
3141 save_RasterPos3i(GLint x
, GLint y
, GLint z
)
3143 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3146 static void GLAPIENTRY
3147 save_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
3149 save_RasterPos4f(x
, y
, z
, 1.0F
);
3152 static void GLAPIENTRY
3153 save_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3155 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3158 static void GLAPIENTRY
3159 save_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
3161 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3164 static void GLAPIENTRY
3165 save_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
3167 save_RasterPos4f(x
, y
, z
, w
);
3170 static void GLAPIENTRY
3171 save_RasterPos2dv(const GLdouble
* v
)
3173 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3176 static void GLAPIENTRY
3177 save_RasterPos2fv(const GLfloat
* v
)
3179 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3182 static void GLAPIENTRY
3183 save_RasterPos2iv(const GLint
* v
)
3185 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3188 static void GLAPIENTRY
3189 save_RasterPos2sv(const GLshort
* v
)
3191 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3194 static void GLAPIENTRY
3195 save_RasterPos3dv(const GLdouble
* v
)
3197 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3200 static void GLAPIENTRY
3201 save_RasterPos3fv(const GLfloat
* v
)
3203 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3206 static void GLAPIENTRY
3207 save_RasterPos3iv(const GLint
* v
)
3209 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3212 static void GLAPIENTRY
3213 save_RasterPos3sv(const GLshort
* v
)
3215 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3218 static void GLAPIENTRY
3219 save_RasterPos4dv(const GLdouble
* v
)
3221 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3222 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3225 static void GLAPIENTRY
3226 save_RasterPos4fv(const GLfloat
* v
)
3228 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3231 static void GLAPIENTRY
3232 save_RasterPos4iv(const GLint
* v
)
3234 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3235 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3238 static void GLAPIENTRY
3239 save_RasterPos4sv(const GLshort
* v
)
3241 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3245 static void GLAPIENTRY
3246 save_PassThrough(GLfloat token
)
3248 GET_CURRENT_CONTEXT(ctx
);
3250 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3251 n
= alloc_instruction(ctx
, OPCODE_PASSTHROUGH
, 1);
3255 if (ctx
->ExecuteFlag
) {
3256 CALL_PassThrough(ctx
->Exec
, (token
));
3261 static void GLAPIENTRY
3262 save_ReadBuffer(GLenum mode
)
3264 GET_CURRENT_CONTEXT(ctx
);
3266 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3267 n
= alloc_instruction(ctx
, OPCODE_READ_BUFFER
, 1);
3271 if (ctx
->ExecuteFlag
) {
3272 CALL_ReadBuffer(ctx
->Exec
, (mode
));
3277 static void GLAPIENTRY
3278 save_ResetHistogram(GLenum target
)
3280 GET_CURRENT_CONTEXT(ctx
);
3282 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3283 n
= alloc_instruction(ctx
, OPCODE_RESET_HISTOGRAM
, 1);
3287 if (ctx
->ExecuteFlag
) {
3288 CALL_ResetHistogram(ctx
->Exec
, (target
));
3293 static void GLAPIENTRY
3294 save_ResetMinmax(GLenum target
)
3296 GET_CURRENT_CONTEXT(ctx
);
3298 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3299 n
= alloc_instruction(ctx
, OPCODE_RESET_MIN_MAX
, 1);
3303 if (ctx
->ExecuteFlag
) {
3304 CALL_ResetMinmax(ctx
->Exec
, (target
));
3309 static void GLAPIENTRY
3310 save_Rotatef(GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
3312 GET_CURRENT_CONTEXT(ctx
);
3314 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3315 n
= alloc_instruction(ctx
, OPCODE_ROTATE
, 4);
3322 if (ctx
->ExecuteFlag
) {
3323 CALL_Rotatef(ctx
->Exec
, (angle
, x
, y
, z
));
3328 static void GLAPIENTRY
3329 save_Rotated(GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
3331 save_Rotatef((GLfloat
) angle
, (GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3335 static void GLAPIENTRY
3336 save_Scalef(GLfloat x
, GLfloat y
, GLfloat z
)
3338 GET_CURRENT_CONTEXT(ctx
);
3340 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3341 n
= alloc_instruction(ctx
, OPCODE_SCALE
, 3);
3347 if (ctx
->ExecuteFlag
) {
3348 CALL_Scalef(ctx
->Exec
, (x
, y
, z
));
3353 static void GLAPIENTRY
3354 save_Scaled(GLdouble x
, GLdouble y
, GLdouble z
)
3356 save_Scalef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3360 static void GLAPIENTRY
3361 save_Scissor(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3363 GET_CURRENT_CONTEXT(ctx
);
3365 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3366 n
= alloc_instruction(ctx
, OPCODE_SCISSOR
, 4);
3373 if (ctx
->ExecuteFlag
) {
3374 CALL_Scissor(ctx
->Exec
, (x
, y
, width
, height
));
3379 static void GLAPIENTRY
3380 save_ShadeModel(GLenum mode
)
3382 GET_CURRENT_CONTEXT(ctx
);
3384 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx
);
3386 if (ctx
->ExecuteFlag
) {
3387 CALL_ShadeModel(ctx
->Exec
, (mode
));
3390 if (ctx
->ListState
.Current
.ShadeModel
== mode
)
3393 SAVE_FLUSH_VERTICES(ctx
);
3395 /* Only save the value if we know the statechange will take effect:
3397 if (ctx
->Driver
.CurrentSavePrimitive
== PRIM_OUTSIDE_BEGIN_END
)
3398 ctx
->ListState
.Current
.ShadeModel
= mode
;
3400 n
= alloc_instruction(ctx
, OPCODE_SHADE_MODEL
, 1);
3407 static void GLAPIENTRY
3408 save_StencilFunc(GLenum func
, GLint ref
, GLuint mask
)
3410 GET_CURRENT_CONTEXT(ctx
);
3412 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3413 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC
, 3);
3419 if (ctx
->ExecuteFlag
) {
3420 CALL_StencilFunc(ctx
->Exec
, (func
, ref
, mask
));
3425 static void GLAPIENTRY
3426 save_StencilMask(GLuint mask
)
3428 GET_CURRENT_CONTEXT(ctx
);
3430 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3431 n
= alloc_instruction(ctx
, OPCODE_STENCIL_MASK
, 1);
3435 if (ctx
->ExecuteFlag
) {
3436 CALL_StencilMask(ctx
->Exec
, (mask
));
3441 static void GLAPIENTRY
3442 save_StencilOp(GLenum fail
, GLenum zfail
, GLenum zpass
)
3444 GET_CURRENT_CONTEXT(ctx
);
3446 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3447 n
= alloc_instruction(ctx
, OPCODE_STENCIL_OP
, 3);
3453 if (ctx
->ExecuteFlag
) {
3454 CALL_StencilOp(ctx
->Exec
, (fail
, zfail
, zpass
));
3459 static void GLAPIENTRY
3460 save_StencilFuncSeparate(GLenum face
, GLenum func
, GLint ref
, GLuint mask
)
3462 GET_CURRENT_CONTEXT(ctx
);
3464 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3465 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3472 if (ctx
->ExecuteFlag
) {
3473 CALL_StencilFuncSeparate(ctx
->Exec
, (face
, func
, ref
, mask
));
3478 static void GLAPIENTRY
3479 save_StencilFuncSeparateATI(GLenum frontfunc
, GLenum backfunc
, GLint ref
,
3482 GET_CURRENT_CONTEXT(ctx
);
3484 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3486 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3494 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3501 if (ctx
->ExecuteFlag
) {
3502 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_FRONT
, frontfunc
, ref
, mask
));
3503 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_BACK
, backfunc
, ref
, mask
));
3508 static void GLAPIENTRY
3509 save_StencilMaskSeparate(GLenum face
, GLuint mask
)
3511 GET_CURRENT_CONTEXT(ctx
);
3513 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3514 n
= alloc_instruction(ctx
, OPCODE_STENCIL_MASK_SEPARATE
, 2);
3519 if (ctx
->ExecuteFlag
) {
3520 CALL_StencilMaskSeparate(ctx
->Exec
, (face
, mask
));
3525 static void GLAPIENTRY
3526 save_StencilOpSeparate(GLenum face
, GLenum fail
, GLenum zfail
, GLenum zpass
)
3528 GET_CURRENT_CONTEXT(ctx
);
3530 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3531 n
= alloc_instruction(ctx
, OPCODE_STENCIL_OP_SEPARATE
, 4);
3538 if (ctx
->ExecuteFlag
) {
3539 CALL_StencilOpSeparate(ctx
->Exec
, (face
, fail
, zfail
, zpass
));
3544 static void GLAPIENTRY
3545 save_TexEnvfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3547 GET_CURRENT_CONTEXT(ctx
);
3549 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3550 n
= alloc_instruction(ctx
, OPCODE_TEXENV
, 6);
3554 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3562 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
3565 if (ctx
->ExecuteFlag
) {
3566 CALL_TexEnvfv(ctx
->Exec
, (target
, pname
, params
));
3571 static void GLAPIENTRY
3572 save_TexEnvf(GLenum target
, GLenum pname
, GLfloat param
)
3575 parray
[0] = (GLfloat
) param
;
3576 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3577 save_TexEnvfv(target
, pname
, parray
);
3581 static void GLAPIENTRY
3582 save_TexEnvi(GLenum target
, GLenum pname
, GLint param
)
3585 p
[0] = (GLfloat
) param
;
3586 p
[1] = p
[2] = p
[3] = 0.0;
3587 save_TexEnvfv(target
, pname
, p
);
3591 static void GLAPIENTRY
3592 save_TexEnviv(GLenum target
, GLenum pname
, const GLint
* param
)
3595 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3596 p
[0] = INT_TO_FLOAT(param
[0]);
3597 p
[1] = INT_TO_FLOAT(param
[1]);
3598 p
[2] = INT_TO_FLOAT(param
[2]);
3599 p
[3] = INT_TO_FLOAT(param
[3]);
3602 p
[0] = (GLfloat
) param
[0];
3603 p
[1] = p
[2] = p
[3] = 0.0F
;
3605 save_TexEnvfv(target
, pname
, p
);
3609 static void GLAPIENTRY
3610 save_TexGenfv(GLenum coord
, GLenum pname
, const GLfloat
*params
)
3612 GET_CURRENT_CONTEXT(ctx
);
3614 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3615 n
= alloc_instruction(ctx
, OPCODE_TEXGEN
, 6);
3624 if (ctx
->ExecuteFlag
) {
3625 CALL_TexGenfv(ctx
->Exec
, (coord
, pname
, params
));
3630 static void GLAPIENTRY
3631 save_TexGeniv(GLenum coord
, GLenum pname
, const GLint
*params
)
3634 p
[0] = (GLfloat
) params
[0];
3635 p
[1] = (GLfloat
) params
[1];
3636 p
[2] = (GLfloat
) params
[2];
3637 p
[3] = (GLfloat
) params
[3];
3638 save_TexGenfv(coord
, pname
, p
);
3642 static void GLAPIENTRY
3643 save_TexGend(GLenum coord
, GLenum pname
, GLdouble param
)
3646 parray
[0] = (GLfloat
) param
;
3647 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3648 save_TexGenfv(coord
, pname
, parray
);
3652 static void GLAPIENTRY
3653 save_TexGendv(GLenum coord
, GLenum pname
, const GLdouble
*params
)
3656 p
[0] = (GLfloat
) params
[0];
3657 p
[1] = (GLfloat
) params
[1];
3658 p
[2] = (GLfloat
) params
[2];
3659 p
[3] = (GLfloat
) params
[3];
3660 save_TexGenfv(coord
, pname
, p
);
3664 static void GLAPIENTRY
3665 save_TexGenf(GLenum coord
, GLenum pname
, GLfloat param
)
3669 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3670 save_TexGenfv(coord
, pname
, parray
);
3674 static void GLAPIENTRY
3675 save_TexGeni(GLenum coord
, GLenum pname
, GLint param
)
3679 parray
[1] = parray
[2] = parray
[3] = 0;
3680 save_TexGeniv(coord
, pname
, parray
);
3684 static void GLAPIENTRY
3685 save_TexParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3687 GET_CURRENT_CONTEXT(ctx
);
3689 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3690 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER
, 6);
3699 if (ctx
->ExecuteFlag
) {
3700 CALL_TexParameterfv(ctx
->Exec
, (target
, pname
, params
));
3705 static void GLAPIENTRY
3706 save_TexParameterf(GLenum target
, GLenum pname
, GLfloat param
)
3710 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3711 save_TexParameterfv(target
, pname
, parray
);
3715 static void GLAPIENTRY
3716 save_TexParameteri(GLenum target
, GLenum pname
, GLint param
)
3719 fparam
[0] = (GLfloat
) param
;
3720 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
3721 save_TexParameterfv(target
, pname
, fparam
);
3725 static void GLAPIENTRY
3726 save_TexParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
3729 fparam
[0] = (GLfloat
) params
[0];
3730 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
3731 save_TexParameterfv(target
, pname
, fparam
);
3735 static void GLAPIENTRY
3736 save_TexImage1D(GLenum target
,
3737 GLint level
, GLint components
,
3738 GLsizei width
, GLint border
,
3739 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3741 GET_CURRENT_CONTEXT(ctx
);
3742 if (target
== GL_PROXY_TEXTURE_1D
) {
3743 /* don't compile, execute immediately */
3744 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
3745 border
, format
, type
, pixels
));
3749 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3750 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE1D
, 8);
3754 n
[3].i
= components
;
3755 n
[4].i
= (GLint
) width
;
3759 n
[8].data
= unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
3760 pixels
, &ctx
->Unpack
);
3762 if (ctx
->ExecuteFlag
) {
3763 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
3764 border
, format
, type
, pixels
));
3770 static void GLAPIENTRY
3771 save_TexImage2D(GLenum target
,
3772 GLint level
, GLint components
,
3773 GLsizei width
, GLsizei height
, GLint border
,
3774 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3776 GET_CURRENT_CONTEXT(ctx
);
3777 if (target
== GL_PROXY_TEXTURE_2D
) {
3778 /* don't compile, execute immediately */
3779 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
3780 height
, border
, format
, type
, pixels
));
3784 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3785 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE2D
, 9);
3789 n
[3].i
= components
;
3790 n
[4].i
= (GLint
) width
;
3791 n
[5].i
= (GLint
) height
;
3795 n
[9].data
= unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
3796 pixels
, &ctx
->Unpack
);
3798 if (ctx
->ExecuteFlag
) {
3799 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
3800 height
, border
, format
, type
, pixels
));
3806 static void GLAPIENTRY
3807 save_TexImage3D(GLenum target
,
3808 GLint level
, GLint internalFormat
,
3809 GLsizei width
, GLsizei height
, GLsizei depth
,
3811 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3813 GET_CURRENT_CONTEXT(ctx
);
3814 if (target
== GL_PROXY_TEXTURE_3D
) {
3815 /* don't compile, execute immediately */
3816 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
3817 height
, depth
, border
, format
, type
,
3822 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3823 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE3D
, 10);
3827 n
[3].i
= (GLint
) internalFormat
;
3828 n
[4].i
= (GLint
) width
;
3829 n
[5].i
= (GLint
) height
;
3830 n
[6].i
= (GLint
) depth
;
3834 n
[10].data
= unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
3835 pixels
, &ctx
->Unpack
);
3837 if (ctx
->ExecuteFlag
) {
3838 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
3839 height
, depth
, border
, format
, type
,
3846 static void GLAPIENTRY
3847 save_TexSubImage1D(GLenum target
, GLint level
, GLint xoffset
,
3848 GLsizei width
, GLenum format
, GLenum type
,
3849 const GLvoid
* pixels
)
3851 GET_CURRENT_CONTEXT(ctx
);
3854 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3856 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE1D
, 7);
3861 n
[4].i
= (GLint
) width
;
3864 n
[7].data
= unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
3865 pixels
, &ctx
->Unpack
);
3867 if (ctx
->ExecuteFlag
) {
3868 CALL_TexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
, width
,
3869 format
, type
, pixels
));
3874 static void GLAPIENTRY
3875 save_TexSubImage2D(GLenum target
, GLint level
,
3876 GLint xoffset
, GLint yoffset
,
3877 GLsizei width
, GLsizei height
,
3878 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3880 GET_CURRENT_CONTEXT(ctx
);
3883 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3885 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE2D
, 9);
3891 n
[5].i
= (GLint
) width
;
3892 n
[6].i
= (GLint
) height
;
3895 n
[9].data
= unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
3896 pixels
, &ctx
->Unpack
);
3898 if (ctx
->ExecuteFlag
) {
3899 CALL_TexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
3900 width
, height
, format
, type
, pixels
));
3905 static void GLAPIENTRY
3906 save_TexSubImage3D(GLenum target
, GLint level
,
3907 GLint xoffset
, GLint yoffset
, GLint zoffset
,
3908 GLsizei width
, GLsizei height
, GLsizei depth
,
3909 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3911 GET_CURRENT_CONTEXT(ctx
);
3914 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3916 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE3D
, 11);
3923 n
[6].i
= (GLint
) width
;
3924 n
[7].i
= (GLint
) height
;
3925 n
[8].i
= (GLint
) depth
;
3928 n
[11].data
= unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
3929 pixels
, &ctx
->Unpack
);
3931 if (ctx
->ExecuteFlag
) {
3932 CALL_TexSubImage3D(ctx
->Exec
, (target
, level
,
3933 xoffset
, yoffset
, zoffset
,
3934 width
, height
, depth
, format
, type
,
3940 static void GLAPIENTRY
3941 save_Translatef(GLfloat x
, GLfloat y
, GLfloat z
)
3943 GET_CURRENT_CONTEXT(ctx
);
3945 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3946 n
= alloc_instruction(ctx
, OPCODE_TRANSLATE
, 3);
3952 if (ctx
->ExecuteFlag
) {
3953 CALL_Translatef(ctx
->Exec
, (x
, y
, z
));
3958 static void GLAPIENTRY
3959 save_Translated(GLdouble x
, GLdouble y
, GLdouble z
)
3961 save_Translatef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3966 static void GLAPIENTRY
3967 save_Viewport(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3969 GET_CURRENT_CONTEXT(ctx
);
3971 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3972 n
= alloc_instruction(ctx
, OPCODE_VIEWPORT
, 4);
3976 n
[3].i
= (GLint
) width
;
3977 n
[4].i
= (GLint
) height
;
3979 if (ctx
->ExecuteFlag
) {
3980 CALL_Viewport(ctx
->Exec
, (x
, y
, width
, height
));
3985 static void GLAPIENTRY
3986 save_WindowPos4fMESA(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3988 GET_CURRENT_CONTEXT(ctx
);
3990 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3991 n
= alloc_instruction(ctx
, OPCODE_WINDOW_POS
, 4);
3998 if (ctx
->ExecuteFlag
) {
3999 CALL_WindowPos4fMESA(ctx
->Exec
, (x
, y
, z
, w
));
4003 static void GLAPIENTRY
4004 save_WindowPos2dMESA(GLdouble x
, GLdouble y
)
4006 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
4009 static void GLAPIENTRY
4010 save_WindowPos2fMESA(GLfloat x
, GLfloat y
)
4012 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
4015 static void GLAPIENTRY
4016 save_WindowPos2iMESA(GLint x
, GLint y
)
4018 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
4021 static void GLAPIENTRY
4022 save_WindowPos2sMESA(GLshort x
, GLshort y
)
4024 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
4027 static void GLAPIENTRY
4028 save_WindowPos3dMESA(GLdouble x
, GLdouble y
, GLdouble z
)
4030 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
4033 static void GLAPIENTRY
4034 save_WindowPos3fMESA(GLfloat x
, GLfloat y
, GLfloat z
)
4036 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
4039 static void GLAPIENTRY
4040 save_WindowPos3iMESA(GLint x
, GLint y
, GLint z
)
4042 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
4045 static void GLAPIENTRY
4046 save_WindowPos3sMESA(GLshort x
, GLshort y
, GLshort z
)
4048 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
4051 static void GLAPIENTRY
4052 save_WindowPos4dMESA(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4054 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4057 static void GLAPIENTRY
4058 save_WindowPos4iMESA(GLint x
, GLint y
, GLint z
, GLint w
)
4060 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4063 static void GLAPIENTRY
4064 save_WindowPos4sMESA(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
4066 save_WindowPos4fMESA(x
, y
, z
, w
);
4069 static void GLAPIENTRY
4070 save_WindowPos2dvMESA(const GLdouble
* v
)
4072 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
4075 static void GLAPIENTRY
4076 save_WindowPos2fvMESA(const GLfloat
* v
)
4078 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
4081 static void GLAPIENTRY
4082 save_WindowPos2ivMESA(const GLint
* v
)
4084 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
4087 static void GLAPIENTRY
4088 save_WindowPos2svMESA(const GLshort
* v
)
4090 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
4093 static void GLAPIENTRY
4094 save_WindowPos3dvMESA(const GLdouble
* v
)
4096 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
4099 static void GLAPIENTRY
4100 save_WindowPos3fvMESA(const GLfloat
* v
)
4102 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
4105 static void GLAPIENTRY
4106 save_WindowPos3ivMESA(const GLint
* v
)
4108 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
4111 static void GLAPIENTRY
4112 save_WindowPos3svMESA(const GLshort
* v
)
4114 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
4117 static void GLAPIENTRY
4118 save_WindowPos4dvMESA(const GLdouble
* v
)
4120 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
4121 (GLfloat
) v
[2], (GLfloat
) v
[3]);
4124 static void GLAPIENTRY
4125 save_WindowPos4fvMESA(const GLfloat
* v
)
4127 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
4130 static void GLAPIENTRY
4131 save_WindowPos4ivMESA(const GLint
* v
)
4133 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
4134 (GLfloat
) v
[2], (GLfloat
) v
[3]);
4137 static void GLAPIENTRY
4138 save_WindowPos4svMESA(const GLshort
* v
)
4140 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
4145 /* GL_ARB_multitexture */
4146 static void GLAPIENTRY
4147 save_ActiveTextureARB(GLenum target
)
4149 GET_CURRENT_CONTEXT(ctx
);
4151 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4152 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_TEXTURE
, 1);
4156 if (ctx
->ExecuteFlag
) {
4157 CALL_ActiveTextureARB(ctx
->Exec
, (target
));
4162 /* GL_ARB_transpose_matrix */
4164 static void GLAPIENTRY
4165 save_LoadTransposeMatrixdARB(const GLdouble m
[16])
4168 _math_transposefd(tm
, m
);
4169 save_LoadMatrixf(tm
);
4173 static void GLAPIENTRY
4174 save_LoadTransposeMatrixfARB(const GLfloat m
[16])
4177 _math_transposef(tm
, m
);
4178 save_LoadMatrixf(tm
);
4182 static void GLAPIENTRY
4183 save_MultTransposeMatrixdARB(const GLdouble m
[16])
4186 _math_transposefd(tm
, m
);
4187 save_MultMatrixf(tm
);
4191 static void GLAPIENTRY
4192 save_MultTransposeMatrixfARB(const GLfloat m
[16])
4195 _math_transposef(tm
, m
);
4196 save_MultMatrixf(tm
);
4200 /* GL_ARB_texture_compression */
4201 static void GLAPIENTRY
4202 save_CompressedTexImage1DARB(GLenum target
, GLint level
,
4203 GLenum internalFormat
, GLsizei width
,
4204 GLint border
, GLsizei imageSize
,
4205 const GLvoid
* data
)
4207 GET_CURRENT_CONTEXT(ctx
);
4208 if (target
== GL_PROXY_TEXTURE_1D
) {
4209 /* don't compile, execute immediately */
4210 CALL_CompressedTexImage1DARB(ctx
->Exec
, (target
, level
, internalFormat
,
4211 width
, border
, imageSize
,
4217 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4218 /* make copy of image */
4219 image
= _mesa_malloc(imageSize
);
4221 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage1DARB");
4224 MEMCPY(image
, data
, imageSize
);
4225 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_1D
, 7);
4229 n
[3].e
= internalFormat
;
4230 n
[4].i
= (GLint
) width
;
4238 if (ctx
->ExecuteFlag
) {
4239 CALL_CompressedTexImage1DARB(ctx
->Exec
,
4240 (target
, level
, internalFormat
, width
,
4241 border
, imageSize
, data
));
4247 static void GLAPIENTRY
4248 save_CompressedTexImage2DARB(GLenum target
, GLint level
,
4249 GLenum internalFormat
, GLsizei width
,
4250 GLsizei height
, GLint border
, GLsizei imageSize
,
4251 const GLvoid
* data
)
4253 GET_CURRENT_CONTEXT(ctx
);
4254 if (target
== GL_PROXY_TEXTURE_2D
) {
4255 /* don't compile, execute immediately */
4256 CALL_CompressedTexImage2DARB(ctx
->Exec
, (target
, level
, internalFormat
,
4257 width
, height
, border
,
4263 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4264 /* make copy of image */
4265 image
= _mesa_malloc(imageSize
);
4267 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage2DARB");
4270 MEMCPY(image
, data
, imageSize
);
4271 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_2D
, 8);
4275 n
[3].e
= internalFormat
;
4276 n
[4].i
= (GLint
) width
;
4277 n
[5].i
= (GLint
) height
;
4285 if (ctx
->ExecuteFlag
) {
4286 CALL_CompressedTexImage2DARB(ctx
->Exec
,
4287 (target
, level
, internalFormat
, width
,
4288 height
, border
, imageSize
, data
));
4294 static void GLAPIENTRY
4295 save_CompressedTexImage3DARB(GLenum target
, GLint level
,
4296 GLenum internalFormat
, GLsizei width
,
4297 GLsizei height
, GLsizei depth
, GLint border
,
4298 GLsizei imageSize
, const GLvoid
* data
)
4300 GET_CURRENT_CONTEXT(ctx
);
4301 if (target
== GL_PROXY_TEXTURE_3D
) {
4302 /* don't compile, execute immediately */
4303 CALL_CompressedTexImage3DARB(ctx
->Exec
, (target
, level
, internalFormat
,
4304 width
, height
, depth
, border
,
4310 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4311 /* make copy of image */
4312 image
= _mesa_malloc(imageSize
);
4314 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage3DARB");
4317 MEMCPY(image
, data
, imageSize
);
4318 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_3D
, 9);
4322 n
[3].e
= internalFormat
;
4323 n
[4].i
= (GLint
) width
;
4324 n
[5].i
= (GLint
) height
;
4325 n
[6].i
= (GLint
) depth
;
4333 if (ctx
->ExecuteFlag
) {
4334 CALL_CompressedTexImage3DARB(ctx
->Exec
,
4335 (target
, level
, internalFormat
, width
,
4336 height
, depth
, border
, imageSize
,
4343 static void GLAPIENTRY
4344 save_CompressedTexSubImage1DARB(GLenum target
, GLint level
, GLint xoffset
,
4345 GLsizei width
, GLenum format
,
4346 GLsizei imageSize
, const GLvoid
* data
)
4351 GET_CURRENT_CONTEXT(ctx
);
4352 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4354 /* make copy of image */
4355 image
= _mesa_malloc(imageSize
);
4357 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage1DARB");
4360 MEMCPY(image
, data
, imageSize
);
4361 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
, 7);
4366 n
[4].i
= (GLint
) width
;
4374 if (ctx
->ExecuteFlag
) {
4375 CALL_CompressedTexSubImage1DARB(ctx
->Exec
, (target
, level
, xoffset
,
4376 width
, format
, imageSize
,
4382 static void GLAPIENTRY
4383 save_CompressedTexSubImage2DARB(GLenum target
, GLint level
, GLint xoffset
,
4384 GLint yoffset
, GLsizei width
, GLsizei height
,
4385 GLenum format
, GLsizei imageSize
,
4386 const GLvoid
* data
)
4391 GET_CURRENT_CONTEXT(ctx
);
4392 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4394 /* make copy of image */
4395 image
= _mesa_malloc(imageSize
);
4397 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage2DARB");
4400 MEMCPY(image
, data
, imageSize
);
4401 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
, 9);
4407 n
[5].i
= (GLint
) width
;
4408 n
[6].i
= (GLint
) height
;
4416 if (ctx
->ExecuteFlag
) {
4417 CALL_CompressedTexSubImage2DARB(ctx
->Exec
,
4418 (target
, level
, xoffset
, yoffset
, width
,
4419 height
, format
, imageSize
, data
));
4424 static void GLAPIENTRY
4425 save_CompressedTexSubImage3DARB(GLenum target
, GLint level
, GLint xoffset
,
4426 GLint yoffset
, GLint zoffset
, GLsizei width
,
4427 GLsizei height
, GLsizei depth
, GLenum format
,
4428 GLsizei imageSize
, const GLvoid
* data
)
4433 GET_CURRENT_CONTEXT(ctx
);
4434 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4436 /* make copy of image */
4437 image
= _mesa_malloc(imageSize
);
4439 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage3DARB");
4442 MEMCPY(image
, data
, imageSize
);
4443 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
, 11);
4450 n
[6].i
= (GLint
) width
;
4451 n
[7].i
= (GLint
) height
;
4452 n
[8].i
= (GLint
) depth
;
4454 n
[10].i
= imageSize
;
4460 if (ctx
->ExecuteFlag
) {
4461 CALL_CompressedTexSubImage3DARB(ctx
->Exec
,
4462 (target
, level
, xoffset
, yoffset
,
4463 zoffset
, width
, height
, depth
, format
,
4469 /* GL_ARB_multisample */
4470 static void GLAPIENTRY
4471 save_SampleCoverageARB(GLclampf value
, GLboolean invert
)
4473 GET_CURRENT_CONTEXT(ctx
);
4475 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4476 n
= alloc_instruction(ctx
, OPCODE_SAMPLE_COVERAGE
, 2);
4481 if (ctx
->ExecuteFlag
) {
4482 CALL_SampleCoverageARB(ctx
->Exec
, (value
, invert
));
4488 * GL_NV_vertex_program
4490 #if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
4491 static void GLAPIENTRY
4492 save_BindProgramNV(GLenum target
, GLuint id
)
4494 GET_CURRENT_CONTEXT(ctx
);
4496 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4497 n
= alloc_instruction(ctx
, OPCODE_BIND_PROGRAM_NV
, 2);
4502 if (ctx
->ExecuteFlag
) {
4503 CALL_BindProgramNV(ctx
->Exec
, (target
, id
));
4507 static void GLAPIENTRY
4508 save_ProgramEnvParameter4fARB(GLenum target
, GLuint index
,
4509 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4511 GET_CURRENT_CONTEXT(ctx
);
4513 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4514 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4523 if (ctx
->ExecuteFlag
) {
4524 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4529 static void GLAPIENTRY
4530 save_ProgramEnvParameter4fvARB(GLenum target
, GLuint index
,
4531 const GLfloat
*params
)
4533 save_ProgramEnvParameter4fARB(target
, index
, params
[0], params
[1],
4534 params
[2], params
[3]);
4538 static void GLAPIENTRY
4539 save_ProgramEnvParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4540 const GLfloat
* params
)
4542 GET_CURRENT_CONTEXT(ctx
);
4544 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4548 const GLfloat
* p
= params
;
4550 for (i
= 0 ; i
< count
; i
++) {
4551 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4564 if (ctx
->ExecuteFlag
) {
4565 CALL_ProgramEnvParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4570 static void GLAPIENTRY
4571 save_ProgramEnvParameter4dARB(GLenum target
, GLuint index
,
4572 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4574 save_ProgramEnvParameter4fARB(target
, index
,
4576 (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4580 static void GLAPIENTRY
4581 save_ProgramEnvParameter4dvARB(GLenum target
, GLuint index
,
4582 const GLdouble
*params
)
4584 save_ProgramEnvParameter4fARB(target
, index
,
4585 (GLfloat
) params
[0],
4586 (GLfloat
) params
[1],
4587 (GLfloat
) params
[2], (GLfloat
) params
[3]);
4590 #endif /* FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program || FEATURE_NV_vertex_program */
4592 #if FEATURE_NV_vertex_program
4593 static void GLAPIENTRY
4594 save_ExecuteProgramNV(GLenum target
, GLuint id
, const GLfloat
*params
)
4596 GET_CURRENT_CONTEXT(ctx
);
4598 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4599 n
= alloc_instruction(ctx
, OPCODE_EXECUTE_PROGRAM_NV
, 6);
4608 if (ctx
->ExecuteFlag
) {
4609 CALL_ExecuteProgramNV(ctx
->Exec
, (target
, id
, params
));
4614 static void GLAPIENTRY
4615 save_ProgramParameters4dvNV(GLenum target
, GLuint index
,
4616 GLuint num
, const GLdouble
*params
)
4619 for (i
= 0; i
< num
; i
++) {
4620 save_ProgramEnvParameter4dvARB(target
, index
+ i
, params
+ 4 * i
);
4625 static void GLAPIENTRY
4626 save_ProgramParameters4fvNV(GLenum target
, GLuint index
,
4627 GLuint num
, const GLfloat
*params
)
4630 for (i
= 0; i
< num
; i
++) {
4631 save_ProgramEnvParameter4fvARB(target
, index
+ i
, params
+ 4 * i
);
4636 static void GLAPIENTRY
4637 save_LoadProgramNV(GLenum target
, GLuint id
, GLsizei len
,
4638 const GLubyte
* program
)
4640 GET_CURRENT_CONTEXT(ctx
);
4643 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4645 n
= alloc_instruction(ctx
, OPCODE_LOAD_PROGRAM_NV
, 4);
4647 GLubyte
*programCopy
= (GLubyte
*) _mesa_malloc(len
);
4649 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glLoadProgramNV");
4652 _mesa_memcpy(programCopy
, program
, len
);
4656 n
[4].data
= programCopy
;
4658 if (ctx
->ExecuteFlag
) {
4659 CALL_LoadProgramNV(ctx
->Exec
, (target
, id
, len
, program
));
4664 static void GLAPIENTRY
4665 save_RequestResidentProgramsNV(GLsizei num
, const GLuint
* ids
)
4667 GET_CURRENT_CONTEXT(ctx
);
4670 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4672 n
= alloc_instruction(ctx
, OPCODE_TRACK_MATRIX_NV
, 2);
4674 GLuint
*idCopy
= (GLuint
*) _mesa_malloc(num
* sizeof(GLuint
));
4676 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glRequestResidentProgramsNV");
4679 _mesa_memcpy(idCopy
, ids
, num
* sizeof(GLuint
));
4683 if (ctx
->ExecuteFlag
) {
4684 CALL_RequestResidentProgramsNV(ctx
->Exec
, (num
, ids
));
4689 static void GLAPIENTRY
4690 save_TrackMatrixNV(GLenum target
, GLuint address
,
4691 GLenum matrix
, GLenum transform
)
4693 GET_CURRENT_CONTEXT(ctx
);
4695 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4696 n
= alloc_instruction(ctx
, OPCODE_TRACK_MATRIX_NV
, 4);
4703 if (ctx
->ExecuteFlag
) {
4704 CALL_TrackMatrixNV(ctx
->Exec
, (target
, address
, matrix
, transform
));
4707 #endif /* FEATURE_NV_vertex_program */
4711 * GL_NV_fragment_program
4713 #if FEATURE_NV_fragment_program
4714 static void GLAPIENTRY
4715 save_ProgramLocalParameter4fARB(GLenum target
, GLuint index
,
4716 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4718 GET_CURRENT_CONTEXT(ctx
);
4720 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4721 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4730 if (ctx
->ExecuteFlag
) {
4731 CALL_ProgramLocalParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4736 static void GLAPIENTRY
4737 save_ProgramLocalParameter4fvARB(GLenum target
, GLuint index
,
4738 const GLfloat
*params
)
4740 GET_CURRENT_CONTEXT(ctx
);
4742 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4743 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4752 if (ctx
->ExecuteFlag
) {
4753 CALL_ProgramLocalParameter4fvARB(ctx
->Exec
, (target
, index
, params
));
4758 static void GLAPIENTRY
4759 save_ProgramLocalParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4760 const GLfloat
*params
)
4762 GET_CURRENT_CONTEXT(ctx
);
4764 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4768 const GLfloat
* p
= params
;
4770 for (i
= 0 ; i
< count
; i
++) {
4771 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4784 if (ctx
->ExecuteFlag
) {
4785 CALL_ProgramLocalParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4790 static void GLAPIENTRY
4791 save_ProgramLocalParameter4dARB(GLenum target
, GLuint index
,
4792 GLdouble x
, GLdouble y
,
4793 GLdouble z
, GLdouble w
)
4795 GET_CURRENT_CONTEXT(ctx
);
4797 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4798 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4802 n
[3].f
= (GLfloat
) x
;
4803 n
[4].f
= (GLfloat
) y
;
4804 n
[5].f
= (GLfloat
) z
;
4805 n
[6].f
= (GLfloat
) w
;
4807 if (ctx
->ExecuteFlag
) {
4808 CALL_ProgramLocalParameter4dARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4813 static void GLAPIENTRY
4814 save_ProgramLocalParameter4dvARB(GLenum target
, GLuint index
,
4815 const GLdouble
*params
)
4817 GET_CURRENT_CONTEXT(ctx
);
4819 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4820 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4824 n
[3].f
= (GLfloat
) params
[0];
4825 n
[4].f
= (GLfloat
) params
[1];
4826 n
[5].f
= (GLfloat
) params
[2];
4827 n
[6].f
= (GLfloat
) params
[3];
4829 if (ctx
->ExecuteFlag
) {
4830 CALL_ProgramLocalParameter4dvARB(ctx
->Exec
, (target
, index
, params
));
4834 static void GLAPIENTRY
4835 save_ProgramNamedParameter4fNV(GLuint id
, GLsizei len
, const GLubyte
* name
,
4836 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4838 GET_CURRENT_CONTEXT(ctx
);
4841 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4843 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_NAMED_PARAMETER_NV
, 6);
4845 GLubyte
*nameCopy
= (GLubyte
*) _mesa_malloc(len
);
4847 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramNamedParameter4fNV");
4850 _mesa_memcpy(nameCopy
, name
, len
);
4853 n
[3].data
= nameCopy
;
4859 if (ctx
->ExecuteFlag
) {
4860 CALL_ProgramNamedParameter4fNV(ctx
->Exec
, (id
, len
, name
, x
, y
, z
, w
));
4865 static void GLAPIENTRY
4866 save_ProgramNamedParameter4fvNV(GLuint id
, GLsizei len
, const GLubyte
* name
,
4869 save_ProgramNamedParameter4fNV(id
, len
, name
, v
[0], v
[1], v
[2], v
[3]);
4873 static void GLAPIENTRY
4874 save_ProgramNamedParameter4dNV(GLuint id
, GLsizei len
, const GLubyte
* name
,
4875 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4877 save_ProgramNamedParameter4fNV(id
, len
, name
, (GLfloat
) x
, (GLfloat
) y
,
4878 (GLfloat
) z
, (GLfloat
) w
);
4882 static void GLAPIENTRY
4883 save_ProgramNamedParameter4dvNV(GLuint id
, GLsizei len
, const GLubyte
* name
,
4886 save_ProgramNamedParameter4fNV(id
, len
, name
, (GLfloat
) v
[0],
4887 (GLfloat
) v
[1], (GLfloat
) v
[2],
4891 #endif /* FEATURE_NV_fragment_program */
4895 /* GL_EXT_stencil_two_side */
4896 static void GLAPIENTRY
4897 save_ActiveStencilFaceEXT(GLenum face
)
4899 GET_CURRENT_CONTEXT(ctx
);
4901 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4902 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_STENCIL_FACE_EXT
, 1);
4906 if (ctx
->ExecuteFlag
) {
4907 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (face
));
4912 /* GL_EXT_depth_bounds_test */
4913 static void GLAPIENTRY
4914 save_DepthBoundsEXT(GLclampd zmin
, GLclampd zmax
)
4916 GET_CURRENT_CONTEXT(ctx
);
4918 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4919 n
= alloc_instruction(ctx
, OPCODE_DEPTH_BOUNDS_EXT
, 2);
4921 n
[1].f
= (GLfloat
) zmin
;
4922 n
[2].f
= (GLfloat
) zmax
;
4924 if (ctx
->ExecuteFlag
) {
4925 CALL_DepthBoundsEXT(ctx
->Exec
, (zmin
, zmax
));
4931 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
4933 static void GLAPIENTRY
4934 save_ProgramStringARB(GLenum target
, GLenum format
, GLsizei len
,
4935 const GLvoid
* string
)
4937 GET_CURRENT_CONTEXT(ctx
);
4940 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4942 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_STRING_ARB
, 4);
4944 GLubyte
*programCopy
= (GLubyte
*) _mesa_malloc(len
);
4946 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramStringARB");
4949 _mesa_memcpy(programCopy
, string
, len
);
4953 n
[4].data
= programCopy
;
4955 if (ctx
->ExecuteFlag
) {
4956 CALL_ProgramStringARB(ctx
->Exec
, (target
, format
, len
, string
));
4960 #endif /* FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program */
4963 #if FEATURE_queryobj
4965 static void GLAPIENTRY
4966 save_BeginQueryARB(GLenum target
, GLuint id
)
4968 GET_CURRENT_CONTEXT(ctx
);
4970 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4971 n
= alloc_instruction(ctx
, OPCODE_BEGIN_QUERY_ARB
, 2);
4976 if (ctx
->ExecuteFlag
) {
4977 CALL_BeginQueryARB(ctx
->Exec
, (target
, id
));
4982 static void GLAPIENTRY
4983 save_EndQueryARB(GLenum target
)
4985 GET_CURRENT_CONTEXT(ctx
);
4987 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4988 n
= alloc_instruction(ctx
, OPCODE_END_QUERY_ARB
, 1);
4992 if (ctx
->ExecuteFlag
) {
4993 CALL_EndQueryARB(ctx
->Exec
, (target
));
4997 #endif /* FEATURE_queryobj */
5000 static void GLAPIENTRY
5001 save_DrawBuffersARB(GLsizei count
, const GLenum
* buffers
)
5003 GET_CURRENT_CONTEXT(ctx
);
5005 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5006 n
= alloc_instruction(ctx
, OPCODE_DRAW_BUFFERS_ARB
, 1 + MAX_DRAW_BUFFERS
);
5010 if (count
> MAX_DRAW_BUFFERS
)
5011 count
= MAX_DRAW_BUFFERS
;
5012 for (i
= 0; i
< count
; i
++) {
5013 n
[2 + i
].e
= buffers
[i
];
5016 if (ctx
->ExecuteFlag
) {
5017 CALL_DrawBuffersARB(ctx
->Exec
, (count
, buffers
));
5021 static void GLAPIENTRY
5022 save_TexBumpParameterfvATI(GLenum pname
, const GLfloat
*param
)
5024 GET_CURRENT_CONTEXT(ctx
);
5027 n
= alloc_instruction(ctx
, OPCODE_TEX_BUMP_PARAMETER_ATI
, 5);
5035 if (ctx
->ExecuteFlag
) {
5036 CALL_TexBumpParameterfvATI(ctx
->Exec
, (pname
, param
));
5040 static void GLAPIENTRY
5041 save_TexBumpParameterivATI(GLenum pname
, const GLint
*param
)
5044 p
[0] = INT_TO_FLOAT(param
[0]);
5045 p
[1] = INT_TO_FLOAT(param
[1]);
5046 p
[2] = INT_TO_FLOAT(param
[2]);
5047 p
[3] = INT_TO_FLOAT(param
[3]);
5048 save_TexBumpParameterfvATI(pname
, p
);
5051 #if FEATURE_ATI_fragment_shader
5052 static void GLAPIENTRY
5053 save_BindFragmentShaderATI(GLuint id
)
5055 GET_CURRENT_CONTEXT(ctx
);
5058 n
= alloc_instruction(ctx
, OPCODE_BIND_FRAGMENT_SHADER_ATI
, 1);
5062 if (ctx
->ExecuteFlag
) {
5063 CALL_BindFragmentShaderATI(ctx
->Exec
, (id
));
5067 static void GLAPIENTRY
5068 save_SetFragmentShaderConstantATI(GLuint dst
, const GLfloat
*value
)
5070 GET_CURRENT_CONTEXT(ctx
);
5073 n
= alloc_instruction(ctx
, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
, 5);
5081 if (ctx
->ExecuteFlag
) {
5082 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, value
));
5088 save_Attr1fNV(GLenum attr
, GLfloat x
)
5090 GET_CURRENT_CONTEXT(ctx
);
5092 SAVE_FLUSH_VERTICES(ctx
);
5093 n
= alloc_instruction(ctx
, OPCODE_ATTR_1F_NV
, 2);
5099 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5100 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
5101 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
5103 if (ctx
->ExecuteFlag
) {
5104 CALL_VertexAttrib1fNV(ctx
->Exec
, (attr
, x
));
5109 save_Attr2fNV(GLenum attr
, GLfloat x
, GLfloat y
)
5111 GET_CURRENT_CONTEXT(ctx
);
5113 SAVE_FLUSH_VERTICES(ctx
);
5114 n
= alloc_instruction(ctx
, OPCODE_ATTR_2F_NV
, 3);
5121 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5122 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
5123 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
5125 if (ctx
->ExecuteFlag
) {
5126 CALL_VertexAttrib2fNV(ctx
->Exec
, (attr
, x
, y
));
5131 save_Attr3fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
5133 GET_CURRENT_CONTEXT(ctx
);
5135 SAVE_FLUSH_VERTICES(ctx
);
5136 n
= alloc_instruction(ctx
, OPCODE_ATTR_3F_NV
, 4);
5144 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5145 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
5146 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
5148 if (ctx
->ExecuteFlag
) {
5149 CALL_VertexAttrib3fNV(ctx
->Exec
, (attr
, x
, y
, z
));
5154 save_Attr4fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5156 GET_CURRENT_CONTEXT(ctx
);
5158 SAVE_FLUSH_VERTICES(ctx
);
5159 n
= alloc_instruction(ctx
, OPCODE_ATTR_4F_NV
, 5);
5168 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5169 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5170 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5172 if (ctx
->ExecuteFlag
) {
5173 CALL_VertexAttrib4fNV(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5179 save_Attr1fARB(GLenum attr
, GLfloat x
)
5181 GET_CURRENT_CONTEXT(ctx
);
5183 SAVE_FLUSH_VERTICES(ctx
);
5184 n
= alloc_instruction(ctx
, OPCODE_ATTR_1F_ARB
, 2);
5190 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5191 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
5192 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
5194 if (ctx
->ExecuteFlag
) {
5195 CALL_VertexAttrib1fARB(ctx
->Exec
, (attr
, x
));
5200 save_Attr2fARB(GLenum attr
, GLfloat x
, GLfloat y
)
5202 GET_CURRENT_CONTEXT(ctx
);
5204 SAVE_FLUSH_VERTICES(ctx
);
5205 n
= alloc_instruction(ctx
, OPCODE_ATTR_2F_ARB
, 3);
5212 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5213 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
5214 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
5216 if (ctx
->ExecuteFlag
) {
5217 CALL_VertexAttrib2fARB(ctx
->Exec
, (attr
, x
, y
));
5222 save_Attr3fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
5224 GET_CURRENT_CONTEXT(ctx
);
5226 SAVE_FLUSH_VERTICES(ctx
);
5227 n
= alloc_instruction(ctx
, OPCODE_ATTR_3F_ARB
, 4);
5235 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5236 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
5237 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
5239 if (ctx
->ExecuteFlag
) {
5240 CALL_VertexAttrib3fARB(ctx
->Exec
, (attr
, x
, y
, z
));
5245 save_Attr4fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5247 GET_CURRENT_CONTEXT(ctx
);
5249 SAVE_FLUSH_VERTICES(ctx
);
5250 n
= alloc_instruction(ctx
, OPCODE_ATTR_4F_ARB
, 5);
5259 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5260 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5261 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5263 if (ctx
->ExecuteFlag
) {
5264 CALL_VertexAttrib4fARB(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5269 static void GLAPIENTRY
5270 save_EvalCoord1f(GLfloat x
)
5272 GET_CURRENT_CONTEXT(ctx
);
5274 SAVE_FLUSH_VERTICES(ctx
);
5275 n
= alloc_instruction(ctx
, OPCODE_EVAL_C1
, 1);
5279 if (ctx
->ExecuteFlag
) {
5280 CALL_EvalCoord1f(ctx
->Exec
, (x
));
5284 static void GLAPIENTRY
5285 save_EvalCoord1fv(const GLfloat
* v
)
5287 save_EvalCoord1f(v
[0]);
5290 static void GLAPIENTRY
5291 save_EvalCoord2f(GLfloat x
, GLfloat y
)
5293 GET_CURRENT_CONTEXT(ctx
);
5295 SAVE_FLUSH_VERTICES(ctx
);
5296 n
= alloc_instruction(ctx
, OPCODE_EVAL_C2
, 2);
5301 if (ctx
->ExecuteFlag
) {
5302 CALL_EvalCoord2f(ctx
->Exec
, (x
, y
));
5306 static void GLAPIENTRY
5307 save_EvalCoord2fv(const GLfloat
* v
)
5309 save_EvalCoord2f(v
[0], v
[1]);
5313 static void GLAPIENTRY
5314 save_EvalPoint1(GLint x
)
5316 GET_CURRENT_CONTEXT(ctx
);
5318 SAVE_FLUSH_VERTICES(ctx
);
5319 n
= alloc_instruction(ctx
, OPCODE_EVAL_P1
, 1);
5323 if (ctx
->ExecuteFlag
) {
5324 CALL_EvalPoint1(ctx
->Exec
, (x
));
5328 static void GLAPIENTRY
5329 save_EvalPoint2(GLint x
, GLint y
)
5331 GET_CURRENT_CONTEXT(ctx
);
5333 SAVE_FLUSH_VERTICES(ctx
);
5334 n
= alloc_instruction(ctx
, OPCODE_EVAL_P2
, 2);
5339 if (ctx
->ExecuteFlag
) {
5340 CALL_EvalPoint2(ctx
->Exec
, (x
, y
));
5344 static void GLAPIENTRY
5345 save_Indexf(GLfloat x
)
5347 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, x
);
5350 static void GLAPIENTRY
5351 save_Indexfv(const GLfloat
* v
)
5353 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, v
[0]);
5356 static void GLAPIENTRY
5357 save_EdgeFlag(GLboolean x
)
5359 save_Attr1fNV(VERT_ATTRIB_EDGEFLAG
, x
? (GLfloat
)1.0 : (GLfloat
)0.0);
5362 static INLINE GLboolean
compare4fv( const GLfloat
*a
,
5366 return memcmp( a
, b
, count
* sizeof(GLfloat
) ) == 0;
5370 static void GLAPIENTRY
5371 save_Materialfv(GLenum face
, GLenum pname
, const GLfloat
* param
)
5373 GET_CURRENT_CONTEXT(ctx
);
5381 case GL_FRONT_AND_BACK
:
5384 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "material(face)");
5393 case GL_AMBIENT_AND_DIFFUSE
:
5399 case GL_COLOR_INDEXES
:
5403 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "material(pname)");
5407 if (ctx
->ExecuteFlag
) {
5408 CALL_Materialfv(ctx
->Exec
, (face
, pname
, param
));
5411 bitmask
= _mesa_material_bitmask(ctx
, face
, pname
, ~0, NULL
);
5413 /* Try to eliminate redundant statechanges. Because it is legal to
5414 * call glMaterial even inside begin/end calls, don't need to worry
5415 * about ctx->Driver.CurrentSavePrimitive here.
5417 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++) {
5418 if (bitmask
& (1 << i
)) {
5419 if (ctx
->ListState
.ActiveMaterialSize
[i
] == args
&&
5420 compare4fv(ctx
->ListState
.CurrentMaterial
[i
], param
, args
)) {
5421 bitmask
&= ~(1 << i
);
5424 ctx
->ListState
.ActiveMaterialSize
[i
] = args
;
5425 COPY_SZ_4V(ctx
->ListState
.CurrentMaterial
[i
], args
, param
);
5430 /* If this call has effect, return early:
5435 SAVE_FLUSH_VERTICES(ctx
);
5437 n
= alloc_instruction(ctx
, OPCODE_MATERIAL
, 6);
5441 for (i
= 0; i
< args
; i
++)
5442 n
[3 + i
].f
= param
[i
];
5446 static void GLAPIENTRY
5447 save_Begin(GLenum mode
)
5449 GET_CURRENT_CONTEXT(ctx
);
5451 GLboolean error
= GL_FALSE
;
5453 if ( /*mode < GL_POINTS || */ mode
> GL_POLYGON
) {
5454 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "Begin (mode)");
5457 else if (ctx
->Driver
.CurrentSavePrimitive
== PRIM_UNKNOWN
) {
5458 /* Typically the first begin. This may raise an error on
5459 * playback, depending on whether CallList is issued from inside
5460 * a begin/end or not.
5462 ctx
->Driver
.CurrentSavePrimitive
= PRIM_INSIDE_UNKNOWN_PRIM
;
5464 else if (ctx
->Driver
.CurrentSavePrimitive
== PRIM_OUTSIDE_BEGIN_END
) {
5465 ctx
->Driver
.CurrentSavePrimitive
= mode
;
5468 _mesa_compile_error(ctx
, GL_INVALID_OPERATION
, "recursive begin");
5473 /* Give the driver an opportunity to hook in an optimized
5474 * display list compiler.
5476 if (ctx
->Driver
.NotifySaveBegin(ctx
, mode
))
5479 SAVE_FLUSH_VERTICES(ctx
);
5480 n
= alloc_instruction(ctx
, OPCODE_BEGIN
, 1);
5486 if (ctx
->ExecuteFlag
) {
5487 CALL_Begin(ctx
->Exec
, (mode
));
5491 static void GLAPIENTRY
5494 GET_CURRENT_CONTEXT(ctx
);
5495 SAVE_FLUSH_VERTICES(ctx
);
5496 (void) alloc_instruction(ctx
, OPCODE_END
, 0);
5497 ctx
->Driver
.CurrentSavePrimitive
= PRIM_OUTSIDE_BEGIN_END
;
5498 if (ctx
->ExecuteFlag
) {
5499 CALL_End(ctx
->Exec
, ());
5503 static void GLAPIENTRY
5504 save_Rectf(GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
5506 GET_CURRENT_CONTEXT(ctx
);
5508 SAVE_FLUSH_VERTICES(ctx
);
5509 n
= alloc_instruction(ctx
, OPCODE_RECTF
, 4);
5516 if (ctx
->ExecuteFlag
) {
5517 CALL_Rectf(ctx
->Exec
, (a
, b
, c
, d
));
5522 static void GLAPIENTRY
5523 save_Vertex2f(GLfloat x
, GLfloat y
)
5525 save_Attr2fNV(VERT_ATTRIB_POS
, x
, y
);
5528 static void GLAPIENTRY
5529 save_Vertex2fv(const GLfloat
* v
)
5531 save_Attr2fNV(VERT_ATTRIB_POS
, v
[0], v
[1]);
5534 static void GLAPIENTRY
5535 save_Vertex3f(GLfloat x
, GLfloat y
, GLfloat z
)
5537 save_Attr3fNV(VERT_ATTRIB_POS
, x
, y
, z
);
5540 static void GLAPIENTRY
5541 save_Vertex3fv(const GLfloat
* v
)
5543 save_Attr3fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2]);
5546 static void GLAPIENTRY
5547 save_Vertex4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5549 save_Attr4fNV(VERT_ATTRIB_POS
, x
, y
, z
, w
);
5552 static void GLAPIENTRY
5553 save_Vertex4fv(const GLfloat
* v
)
5555 save_Attr4fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2], v
[3]);
5558 static void GLAPIENTRY
5559 save_TexCoord1f(GLfloat x
)
5561 save_Attr1fNV(VERT_ATTRIB_TEX0
, x
);
5564 static void GLAPIENTRY
5565 save_TexCoord1fv(const GLfloat
* v
)
5567 save_Attr1fNV(VERT_ATTRIB_TEX0
, v
[0]);
5570 static void GLAPIENTRY
5571 save_TexCoord2f(GLfloat x
, GLfloat y
)
5573 save_Attr2fNV(VERT_ATTRIB_TEX0
, x
, y
);
5576 static void GLAPIENTRY
5577 save_TexCoord2fv(const GLfloat
* v
)
5579 save_Attr2fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1]);
5582 static void GLAPIENTRY
5583 save_TexCoord3f(GLfloat x
, GLfloat y
, GLfloat z
)
5585 save_Attr3fNV(VERT_ATTRIB_TEX0
, x
, y
, z
);
5588 static void GLAPIENTRY
5589 save_TexCoord3fv(const GLfloat
* v
)
5591 save_Attr3fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2]);
5594 static void GLAPIENTRY
5595 save_TexCoord4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5597 save_Attr4fNV(VERT_ATTRIB_TEX0
, x
, y
, z
, w
);
5600 static void GLAPIENTRY
5601 save_TexCoord4fv(const GLfloat
* v
)
5603 save_Attr4fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2], v
[3]);
5606 static void GLAPIENTRY
5607 save_Normal3f(GLfloat x
, GLfloat y
, GLfloat z
)
5609 save_Attr3fNV(VERT_ATTRIB_NORMAL
, x
, y
, z
);
5612 static void GLAPIENTRY
5613 save_Normal3fv(const GLfloat
* v
)
5615 save_Attr3fNV(VERT_ATTRIB_NORMAL
, v
[0], v
[1], v
[2]);
5618 static void GLAPIENTRY
5619 save_FogCoordfEXT(GLfloat x
)
5621 save_Attr1fNV(VERT_ATTRIB_FOG
, x
);
5624 static void GLAPIENTRY
5625 save_FogCoordfvEXT(const GLfloat
* v
)
5627 save_Attr1fNV(VERT_ATTRIB_FOG
, v
[0]);
5630 static void GLAPIENTRY
5631 save_Color3f(GLfloat x
, GLfloat y
, GLfloat z
)
5633 save_Attr3fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
);
5636 static void GLAPIENTRY
5637 save_Color3fv(const GLfloat
* v
)
5639 save_Attr3fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2]);
5642 static void GLAPIENTRY
5643 save_Color4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5645 save_Attr4fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
, w
);
5648 static void GLAPIENTRY
5649 save_Color4fv(const GLfloat
* v
)
5651 save_Attr4fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2], v
[3]);
5654 static void GLAPIENTRY
5655 save_SecondaryColor3fEXT(GLfloat x
, GLfloat y
, GLfloat z
)
5657 save_Attr3fNV(VERT_ATTRIB_COLOR1
, x
, y
, z
);
5660 static void GLAPIENTRY
5661 save_SecondaryColor3fvEXT(const GLfloat
* v
)
5663 save_Attr3fNV(VERT_ATTRIB_COLOR1
, v
[0], v
[1], v
[2]);
5667 /* Just call the respective ATTR for texcoord
5669 static void GLAPIENTRY
5670 save_MultiTexCoord1f(GLenum target
, GLfloat x
)
5672 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5673 save_Attr1fNV(attr
, x
);
5676 static void GLAPIENTRY
5677 save_MultiTexCoord1fv(GLenum target
, const GLfloat
* v
)
5679 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5680 save_Attr1fNV(attr
, v
[0]);
5683 static void GLAPIENTRY
5684 save_MultiTexCoord2f(GLenum target
, GLfloat x
, GLfloat y
)
5686 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5687 save_Attr2fNV(attr
, x
, y
);
5690 static void GLAPIENTRY
5691 save_MultiTexCoord2fv(GLenum target
, const GLfloat
* v
)
5693 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5694 save_Attr2fNV(attr
, v
[0], v
[1]);
5697 static void GLAPIENTRY
5698 save_MultiTexCoord3f(GLenum target
, GLfloat x
, GLfloat y
, GLfloat z
)
5700 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5701 save_Attr3fNV(attr
, x
, y
, z
);
5704 static void GLAPIENTRY
5705 save_MultiTexCoord3fv(GLenum target
, const GLfloat
* v
)
5707 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5708 save_Attr3fNV(attr
, v
[0], v
[1], v
[2]);
5711 static void GLAPIENTRY
5712 save_MultiTexCoord4f(GLenum target
, GLfloat x
, GLfloat y
,
5713 GLfloat z
, GLfloat w
)
5715 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5716 save_Attr4fNV(attr
, x
, y
, z
, w
);
5719 static void GLAPIENTRY
5720 save_MultiTexCoord4fv(GLenum target
, const GLfloat
* v
)
5722 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5723 save_Attr4fNV(attr
, v
[0], v
[1], v
[2], v
[3]);
5728 * Record a GL_INVALID_VALUE error when a invalid vertex attribute
5734 GET_CURRENT_CONTEXT(ctx
);
5735 _mesa_error(ctx
, GL_INVALID_VALUE
, "VertexAttribf(index)");
5739 /* First level for NV_vertex_program:
5741 * Check for errors at compile time?.
5743 static void GLAPIENTRY
5744 save_VertexAttrib1fNV(GLuint index
, GLfloat x
)
5746 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
)
5747 save_Attr1fNV(index
, x
);
5752 static void GLAPIENTRY
5753 save_VertexAttrib1fvNV(GLuint index
, const GLfloat
* v
)
5755 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
)
5756 save_Attr1fNV(index
, v
[0]);
5761 static void GLAPIENTRY
5762 save_VertexAttrib2fNV(GLuint index
, GLfloat x
, GLfloat y
)
5764 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
)
5765 save_Attr2fNV(index
, x
, y
);
5770 static void GLAPIENTRY
5771 save_VertexAttrib2fvNV(GLuint index
, const GLfloat
* v
)
5773 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
)
5774 save_Attr2fNV(index
, v
[0], v
[1]);
5779 static void GLAPIENTRY
5780 save_VertexAttrib3fNV(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
5782 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
)
5783 save_Attr3fNV(index
, x
, y
, z
);
5788 static void GLAPIENTRY
5789 save_VertexAttrib3fvNV(GLuint index
, const GLfloat
* v
)
5791 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
)
5792 save_Attr3fNV(index
, v
[0], v
[1], v
[2]);
5797 static void GLAPIENTRY
5798 save_VertexAttrib4fNV(GLuint index
, GLfloat x
, GLfloat y
,
5799 GLfloat z
, GLfloat w
)
5801 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
)
5802 save_Attr4fNV(index
, x
, y
, z
, w
);
5807 static void GLAPIENTRY
5808 save_VertexAttrib4fvNV(GLuint index
, const GLfloat
* v
)
5810 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
)
5811 save_Attr4fNV(index
, v
[0], v
[1], v
[2], v
[3]);
5819 static void GLAPIENTRY
5820 save_VertexAttrib1fARB(GLuint index
, GLfloat x
)
5822 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5823 save_Attr1fARB(index
, x
);
5828 static void GLAPIENTRY
5829 save_VertexAttrib1fvARB(GLuint index
, const GLfloat
* v
)
5831 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5832 save_Attr1fARB(index
, v
[0]);
5837 static void GLAPIENTRY
5838 save_VertexAttrib2fARB(GLuint index
, GLfloat x
, GLfloat y
)
5840 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5841 save_Attr2fARB(index
, x
, y
);
5846 static void GLAPIENTRY
5847 save_VertexAttrib2fvARB(GLuint index
, const GLfloat
* v
)
5849 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5850 save_Attr2fARB(index
, v
[0], v
[1]);
5855 static void GLAPIENTRY
5856 save_VertexAttrib3fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
5858 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5859 save_Attr3fARB(index
, x
, y
, z
);
5864 static void GLAPIENTRY
5865 save_VertexAttrib3fvARB(GLuint index
, const GLfloat
* v
)
5867 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5868 save_Attr3fARB(index
, v
[0], v
[1], v
[2]);
5873 static void GLAPIENTRY
5874 save_VertexAttrib4fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
,
5877 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5878 save_Attr4fARB(index
, x
, y
, z
, w
);
5883 static void GLAPIENTRY
5884 save_VertexAttrib4fvARB(GLuint index
, const GLfloat
* v
)
5886 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5887 save_Attr4fARB(index
, v
[0], v
[1], v
[2], v
[3]);
5893 /* GL_ARB_shader_objects, GL_ARB_vertex/fragment_shader */
5895 static void GLAPIENTRY
5896 exec_BindAttribLocationARB(GLuint program
, GLuint index
, const GLchar
*name
)
5898 GET_CURRENT_CONTEXT(ctx
);
5899 FLUSH_VERTICES(ctx
, 0);
5900 CALL_BindAttribLocationARB(ctx
->Exec
, (program
, index
, name
));
5903 static GLint GLAPIENTRY
5904 exec_GetAttribLocationARB(GLuint program
, const GLchar
*name
)
5906 GET_CURRENT_CONTEXT(ctx
);
5907 FLUSH_VERTICES(ctx
, 0);
5908 return CALL_GetAttribLocationARB(ctx
->Exec
, (program
, name
));
5910 /* XXX more shader functions needed here */
5914 #if FEATURE_EXT_framebuffer_blit
5915 static void GLAPIENTRY
5916 save_BlitFramebufferEXT(GLint srcX0
, GLint srcY0
, GLint srcX1
, GLint srcY1
,
5917 GLint dstX0
, GLint dstY0
, GLint dstX1
, GLint dstY1
,
5918 GLbitfield mask
, GLenum filter
)
5920 GET_CURRENT_CONTEXT(ctx
);
5922 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5923 n
= alloc_instruction(ctx
, OPCODE_BLIT_FRAMEBUFFER
, 10);
5936 if (ctx
->ExecuteFlag
) {
5937 CALL_BlitFramebufferEXT(ctx
->Exec
, (srcX0
, srcY0
, srcX1
, srcY1
,
5938 dstX0
, dstY0
, dstX1
, dstY1
,
5945 /** GL_EXT_provoking_vertex */
5946 static void GLAPIENTRY
5947 save_ProvokingVertexEXT(GLenum mode
)
5949 GET_CURRENT_CONTEXT(ctx
);
5951 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5952 n
= alloc_instruction(ctx
, OPCODE_PROVOKING_VERTEX
, 1);
5956 if (ctx
->ExecuteFlag
) {
5957 /*CALL_ProvokingVertexEXT(ctx->Exec, (mode));*/
5958 _mesa_ProvokingVertexEXT(mode
);
5963 /* aka UseProgram() */
5964 static void GLAPIENTRY
5965 save_UseProgramObjectARB(GLhandleARB program
)
5967 GET_CURRENT_CONTEXT(ctx
);
5969 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5970 n
= alloc_instruction(ctx
, OPCODE_USE_PROGRAM
, 1);
5974 if (ctx
->ExecuteFlag
) {
5975 CALL_UseProgramObjectARB(ctx
->Exec
, (program
));
5980 static void GLAPIENTRY
5981 save_Uniform1fARB(GLint location
, GLfloat x
)
5983 GET_CURRENT_CONTEXT(ctx
);
5985 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5986 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1F
, 2);
5991 if (ctx
->ExecuteFlag
) {
5992 CALL_Uniform1fARB(ctx
->Exec
, (location
, x
));
5997 static void GLAPIENTRY
5998 save_Uniform2fARB(GLint location
, GLfloat x
, GLfloat y
)
6000 GET_CURRENT_CONTEXT(ctx
);
6002 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6003 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2F
, 3);
6009 if (ctx
->ExecuteFlag
) {
6010 CALL_Uniform2fARB(ctx
->Exec
, (location
, x
, y
));
6015 static void GLAPIENTRY
6016 save_Uniform3fARB(GLint location
, GLfloat x
, GLfloat y
, GLfloat z
)
6018 GET_CURRENT_CONTEXT(ctx
);
6020 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6021 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3F
, 4);
6028 if (ctx
->ExecuteFlag
) {
6029 CALL_Uniform3fARB(ctx
->Exec
, (location
, x
, y
, z
));
6034 static void GLAPIENTRY
6035 save_Uniform4fARB(GLint location
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
6037 GET_CURRENT_CONTEXT(ctx
);
6039 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6040 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4F
, 5);
6048 if (ctx
->ExecuteFlag
) {
6049 CALL_Uniform4fARB(ctx
->Exec
, (location
, x
, y
, z
, w
));
6054 /** Return copy of memory */
6056 memdup(const void *src
, GLsizei bytes
)
6058 void *b
= bytes
>= 0 ? _mesa_malloc(bytes
) : NULL
;
6060 _mesa_memcpy(b
, src
, bytes
);
6065 static void GLAPIENTRY
6066 save_Uniform1fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6068 GET_CURRENT_CONTEXT(ctx
);
6070 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6071 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1FV
, 3);
6075 n
[3].data
= memdup(v
, count
* 1 * sizeof(GLfloat
));
6077 if (ctx
->ExecuteFlag
) {
6078 CALL_Uniform1fvARB(ctx
->Exec
, (location
, count
, v
));
6082 static void GLAPIENTRY
6083 save_Uniform2fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6085 GET_CURRENT_CONTEXT(ctx
);
6087 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6088 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2FV
, 3);
6092 n
[3].data
= memdup(v
, count
* 2 * sizeof(GLfloat
));
6094 if (ctx
->ExecuteFlag
) {
6095 CALL_Uniform2fvARB(ctx
->Exec
, (location
, count
, v
));
6099 static void GLAPIENTRY
6100 save_Uniform3fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6102 GET_CURRENT_CONTEXT(ctx
);
6104 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6105 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3FV
, 3);
6109 n
[3].data
= memdup(v
, count
* 3 * sizeof(GLfloat
));
6111 if (ctx
->ExecuteFlag
) {
6112 CALL_Uniform3fvARB(ctx
->Exec
, (location
, count
, v
));
6116 static void GLAPIENTRY
6117 save_Uniform4fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6119 GET_CURRENT_CONTEXT(ctx
);
6121 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6122 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4FV
, 3);
6126 n
[3].data
= memdup(v
, count
* 4 * sizeof(GLfloat
));
6128 if (ctx
->ExecuteFlag
) {
6129 CALL_Uniform4fvARB(ctx
->Exec
, (location
, count
, v
));
6134 static void GLAPIENTRY
6135 save_Uniform1iARB(GLint location
, GLint x
)
6137 GET_CURRENT_CONTEXT(ctx
);
6139 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6140 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1I
, 2);
6145 if (ctx
->ExecuteFlag
) {
6146 CALL_Uniform1iARB(ctx
->Exec
, (location
, x
));
6150 static void GLAPIENTRY
6151 save_Uniform2iARB(GLint location
, GLint x
, GLint y
)
6153 GET_CURRENT_CONTEXT(ctx
);
6155 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6156 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2I
, 3);
6162 if (ctx
->ExecuteFlag
) {
6163 CALL_Uniform2iARB(ctx
->Exec
, (location
, x
, y
));
6167 static void GLAPIENTRY
6168 save_Uniform3iARB(GLint location
, GLint x
, GLint y
, GLint z
)
6170 GET_CURRENT_CONTEXT(ctx
);
6172 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6173 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3I
, 4);
6180 if (ctx
->ExecuteFlag
) {
6181 CALL_Uniform3iARB(ctx
->Exec
, (location
, x
, y
, z
));
6185 static void GLAPIENTRY
6186 save_Uniform4iARB(GLint location
, GLint x
, GLint y
, GLint z
, GLint w
)
6188 GET_CURRENT_CONTEXT(ctx
);
6190 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6191 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4I
, 5);
6199 if (ctx
->ExecuteFlag
) {
6200 CALL_Uniform4iARB(ctx
->Exec
, (location
, x
, y
, z
, w
));
6206 static void GLAPIENTRY
6207 save_Uniform1ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6209 GET_CURRENT_CONTEXT(ctx
);
6211 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6212 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1IV
, 3);
6216 n
[3].data
= memdup(v
, count
* 1 * sizeof(GLint
));
6218 if (ctx
->ExecuteFlag
) {
6219 CALL_Uniform1ivARB(ctx
->Exec
, (location
, count
, v
));
6223 static void GLAPIENTRY
6224 save_Uniform2ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6226 GET_CURRENT_CONTEXT(ctx
);
6228 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6229 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2IV
, 3);
6233 n
[3].data
= memdup(v
, count
* 2 * sizeof(GLint
));
6235 if (ctx
->ExecuteFlag
) {
6236 CALL_Uniform2ivARB(ctx
->Exec
, (location
, count
, v
));
6240 static void GLAPIENTRY
6241 save_Uniform3ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6243 GET_CURRENT_CONTEXT(ctx
);
6245 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6246 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3IV
, 3);
6250 n
[3].data
= memdup(v
, count
* 3 * sizeof(GLint
));
6252 if (ctx
->ExecuteFlag
) {
6253 CALL_Uniform3ivARB(ctx
->Exec
, (location
, count
, v
));
6257 static void GLAPIENTRY
6258 save_Uniform4ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6260 GET_CURRENT_CONTEXT(ctx
);
6262 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6263 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4IV
, 3);
6267 n
[3].data
= memdup(v
, count
* 4 * sizeof(GLfloat
));
6269 if (ctx
->ExecuteFlag
) {
6270 CALL_Uniform4ivARB(ctx
->Exec
, (location
, count
, v
));
6275 static void GLAPIENTRY
6276 save_UniformMatrix2fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6279 GET_CURRENT_CONTEXT(ctx
);
6281 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6282 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX22
, 4);
6287 n
[4].data
= memdup(m
, count
* 2 * 2 * sizeof(GLfloat
));
6289 if (ctx
->ExecuteFlag
) {
6290 CALL_UniformMatrix2fvARB(ctx
->Exec
, (location
, count
, transpose
, m
));
6294 static void GLAPIENTRY
6295 save_UniformMatrix3fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6298 GET_CURRENT_CONTEXT(ctx
);
6300 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6301 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX33
, 4);
6306 n
[4].data
= memdup(m
, count
* 3 * 3 * sizeof(GLfloat
));
6308 if (ctx
->ExecuteFlag
) {
6309 CALL_UniformMatrix3fvARB(ctx
->Exec
, (location
, count
, transpose
, m
));
6313 static void GLAPIENTRY
6314 save_UniformMatrix4fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6317 GET_CURRENT_CONTEXT(ctx
);
6319 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6320 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX44
, 4);
6325 n
[4].data
= memdup(m
, count
* 4 * 4 * sizeof(GLfloat
));
6327 if (ctx
->ExecuteFlag
) {
6328 CALL_UniformMatrix4fvARB(ctx
->Exec
, (location
, count
, transpose
, m
));
6333 static void GLAPIENTRY
6334 save_UniformMatrix2x3fv(GLint location
, GLsizei count
, GLboolean transpose
,
6337 GET_CURRENT_CONTEXT(ctx
);
6339 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6340 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX23
, 4);
6345 n
[4].data
= memdup(m
, count
* 2 * 3 * sizeof(GLfloat
));
6347 if (ctx
->ExecuteFlag
) {
6348 CALL_UniformMatrix2x3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6352 static void GLAPIENTRY
6353 save_UniformMatrix3x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
6356 GET_CURRENT_CONTEXT(ctx
);
6358 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6359 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX32
, 4);
6364 n
[4].data
= memdup(m
, count
* 3 * 2 * sizeof(GLfloat
));
6366 if (ctx
->ExecuteFlag
) {
6367 CALL_UniformMatrix3x2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6372 static void GLAPIENTRY
6373 save_UniformMatrix2x4fv(GLint location
, GLsizei count
, GLboolean transpose
,
6376 GET_CURRENT_CONTEXT(ctx
);
6378 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6379 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX24
, 4);
6384 n
[4].data
= memdup(m
, count
* 2 * 4 * sizeof(GLfloat
));
6386 if (ctx
->ExecuteFlag
) {
6387 CALL_UniformMatrix2x4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6391 static void GLAPIENTRY
6392 save_UniformMatrix4x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
6395 GET_CURRENT_CONTEXT(ctx
);
6397 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6398 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX42
, 4);
6403 n
[4].data
= memdup(m
, count
* 4 * 2 * sizeof(GLfloat
));
6405 if (ctx
->ExecuteFlag
) {
6406 CALL_UniformMatrix4x2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6411 static void GLAPIENTRY
6412 save_UniformMatrix3x4fv(GLint location
, GLsizei count
, GLboolean transpose
,
6415 GET_CURRENT_CONTEXT(ctx
);
6417 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6418 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX34
, 4);
6423 n
[4].data
= memdup(m
, count
* 3 * 4 * sizeof(GLfloat
));
6425 if (ctx
->ExecuteFlag
) {
6426 CALL_UniformMatrix3x4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6430 static void GLAPIENTRY
6431 save_UniformMatrix4x3fv(GLint location
, GLsizei count
, GLboolean transpose
,
6434 GET_CURRENT_CONTEXT(ctx
);
6436 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6437 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX43
, 4);
6442 n
[4].data
= memdup(m
, count
* 4 * 3 * sizeof(GLfloat
));
6444 if (ctx
->ExecuteFlag
) {
6445 CALL_UniformMatrix4x3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6452 * Save an error-generating command into display list.
6454 * KW: Will appear in the list before the vertex buffer containing the
6455 * command that provoked the error. I don't see this as a problem.
6458 save_error(GLcontext
*ctx
, GLenum error
, const char *s
)
6461 n
= alloc_instruction(ctx
, OPCODE_ERROR
, 2);
6464 n
[2].data
= (void *) s
;
6470 * Compile an error into current display list.
6473 _mesa_compile_error(GLcontext
*ctx
, GLenum error
, const char *s
)
6475 if (ctx
->CompileFlag
)
6476 save_error(ctx
, error
, s
);
6477 if (ctx
->ExecuteFlag
)
6478 _mesa_error(ctx
, error
, s
);
6483 * Test if ID names a display list.
6486 islist(GLcontext
*ctx
, GLuint list
)
6488 if (list
> 0 && lookup_list(ctx
, list
)) {
6498 /**********************************************************************/
6499 /* Display list execution */
6500 /**********************************************************************/
6504 * Execute a display list. Note that the ListBase offset must have already
6505 * been added before calling this function. I.e. the list argument is
6506 * the absolute list number, not relative to ListBase.
6507 * \param list - display list number
6510 execute_list(GLcontext
*ctx
, GLuint list
)
6512 struct gl_display_list
*dlist
;
6516 if (list
== 0 || !islist(ctx
, list
))
6519 if (ctx
->ListState
.CallDepth
== MAX_LIST_NESTING
) {
6520 /* raise an error? */
6524 dlist
= lookup_list(ctx
, list
);
6528 ctx
->ListState
.CallDepth
++;
6530 if (ctx
->Driver
.BeginCallList
)
6531 ctx
->Driver
.BeginCallList(ctx
, dlist
);
6537 const OpCode opcode
= n
[0].opcode
;
6539 if (is_ext_opcode(opcode
)) {
6540 n
+= ext_opcode_execute(ctx
, n
);
6545 _mesa_error(ctx
, n
[1].e
, (const char *) n
[2].data
);
6548 CALL_Accum(ctx
->Exec
, (n
[1].e
, n
[2].f
));
6550 case OPCODE_ALPHA_FUNC
:
6551 CALL_AlphaFunc(ctx
->Exec
, (n
[1].e
, n
[2].f
));
6553 case OPCODE_BIND_TEXTURE
:
6554 CALL_BindTexture(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
6558 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6559 ctx
->Unpack
= ctx
->DefaultPacking
;
6560 CALL_Bitmap(ctx
->Exec
, ((GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
6561 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
6562 (const GLubyte
*) n
[7].data
));
6563 ctx
->Unpack
= save
; /* restore */
6566 case OPCODE_BLEND_COLOR
:
6567 CALL_BlendColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
6569 case OPCODE_BLEND_EQUATION
:
6570 CALL_BlendEquation(ctx
->Exec
, (n
[1].e
));
6572 case OPCODE_BLEND_EQUATION_SEPARATE
:
6573 CALL_BlendEquationSeparateEXT(ctx
->Exec
, (n
[1].e
, n
[2].e
));
6575 case OPCODE_BLEND_FUNC_SEPARATE
:
6576 CALL_BlendFuncSeparateEXT(ctx
->Exec
,
6577 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
6579 case OPCODE_CALL_LIST
:
6580 /* Generated by glCallList(), don't add ListBase */
6581 if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
6582 execute_list(ctx
, n
[1].ui
);
6585 case OPCODE_CALL_LIST_OFFSET
:
6586 /* Generated by glCallLists() so we must add ListBase */
6588 /* user specified a bad data type at compile time */
6589 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
6591 else if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
6592 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ n
[1].i
);
6593 execute_list(ctx
, list
);
6597 CALL_Clear(ctx
->Exec
, (n
[1].bf
));
6599 case OPCODE_CLEAR_COLOR
:
6600 CALL_ClearColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
6602 case OPCODE_CLEAR_ACCUM
:
6603 CALL_ClearAccum(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
6605 case OPCODE_CLEAR_DEPTH
:
6606 CALL_ClearDepth(ctx
->Exec
, ((GLclampd
) n
[1].f
));
6608 case OPCODE_CLEAR_INDEX
:
6609 CALL_ClearIndex(ctx
->Exec
, ((GLfloat
) n
[1].ui
));
6611 case OPCODE_CLEAR_STENCIL
:
6612 CALL_ClearStencil(ctx
->Exec
, (n
[1].i
));
6614 case OPCODE_CLIP_PLANE
:
6621 CALL_ClipPlane(ctx
->Exec
, (n
[1].e
, eq
));
6624 case OPCODE_COLOR_MASK
:
6625 CALL_ColorMask(ctx
->Exec
, (n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
));
6627 case OPCODE_COLOR_MATERIAL
:
6628 CALL_ColorMaterial(ctx
->Exec
, (n
[1].e
, n
[2].e
));
6630 case OPCODE_COLOR_TABLE
:
6632 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6633 ctx
->Unpack
= ctx
->DefaultPacking
;
6634 CALL_ColorTable(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].e
,
6635 n
[5].e
, n
[6].data
));
6636 ctx
->Unpack
= save
; /* restore */
6639 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
6646 CALL_ColorTableParameterfv(ctx
->Exec
,
6647 (n
[1].e
, n
[2].e
, params
));
6650 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
6657 CALL_ColorTableParameteriv(ctx
->Exec
,
6658 (n
[1].e
, n
[2].e
, params
));
6661 case OPCODE_COLOR_SUB_TABLE
:
6663 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6664 ctx
->Unpack
= ctx
->DefaultPacking
;
6665 CALL_ColorSubTable(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
6666 n
[4].e
, n
[5].e
, n
[6].data
));
6667 ctx
->Unpack
= save
; /* restore */
6670 case OPCODE_CONVOLUTION_FILTER_1D
:
6672 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6673 ctx
->Unpack
= ctx
->DefaultPacking
;
6674 CALL_ConvolutionFilter1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
6677 ctx
->Unpack
= save
; /* restore */
6680 case OPCODE_CONVOLUTION_FILTER_2D
:
6682 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6683 ctx
->Unpack
= ctx
->DefaultPacking
;
6684 CALL_ConvolutionFilter2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
6685 n
[4].i
, n
[5].e
, n
[6].e
,
6687 ctx
->Unpack
= save
; /* restore */
6690 case OPCODE_CONVOLUTION_PARAMETER_I
:
6691 CALL_ConvolutionParameteri(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].i
));
6693 case OPCODE_CONVOLUTION_PARAMETER_IV
:
6700 CALL_ConvolutionParameteriv(ctx
->Exec
,
6701 (n
[1].e
, n
[2].e
, params
));
6704 case OPCODE_CONVOLUTION_PARAMETER_F
:
6705 CALL_ConvolutionParameterf(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].f
));
6707 case OPCODE_CONVOLUTION_PARAMETER_FV
:
6714 CALL_ConvolutionParameterfv(ctx
->Exec
,
6715 (n
[1].e
, n
[2].e
, params
));
6718 case OPCODE_COPY_COLOR_SUB_TABLE
:
6719 CALL_CopyColorSubTable(ctx
->Exec
, (n
[1].e
, n
[2].i
,
6720 n
[3].i
, n
[4].i
, n
[5].i
));
6722 case OPCODE_COPY_COLOR_TABLE
:
6723 CALL_CopyColorSubTable(ctx
->Exec
, (n
[1].e
, n
[2].i
,
6724 n
[3].i
, n
[4].i
, n
[5].i
));
6726 case OPCODE_COPY_PIXELS
:
6727 CALL_CopyPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
,
6728 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
,
6731 case OPCODE_COPY_TEX_IMAGE1D
:
6732 CALL_CopyTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
6733 n
[5].i
, n
[6].i
, n
[7].i
));
6735 case OPCODE_COPY_TEX_IMAGE2D
:
6736 CALL_CopyTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
6737 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
));
6739 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
6740 CALL_CopyTexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
6741 n
[4].i
, n
[5].i
, n
[6].i
));
6743 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
6744 CALL_CopyTexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
6745 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
6748 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
6749 CALL_CopyTexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
6750 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
6753 case OPCODE_CULL_FACE
:
6754 CALL_CullFace(ctx
->Exec
, (n
[1].e
));
6756 case OPCODE_DEPTH_FUNC
:
6757 CALL_DepthFunc(ctx
->Exec
, (n
[1].e
));
6759 case OPCODE_DEPTH_MASK
:
6760 CALL_DepthMask(ctx
->Exec
, (n
[1].b
));
6762 case OPCODE_DEPTH_RANGE
:
6763 CALL_DepthRange(ctx
->Exec
,
6764 ((GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
));
6766 case OPCODE_DISABLE
:
6767 CALL_Disable(ctx
->Exec
, (n
[1].e
));
6769 case OPCODE_DRAW_BUFFER
:
6770 CALL_DrawBuffer(ctx
->Exec
, (n
[1].e
));
6772 case OPCODE_DRAW_PIXELS
:
6774 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6775 ctx
->Unpack
= ctx
->DefaultPacking
;
6776 CALL_DrawPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
6778 ctx
->Unpack
= save
; /* restore */
6782 CALL_Enable(ctx
->Exec
, (n
[1].e
));
6784 case OPCODE_EVALMESH1
:
6785 CALL_EvalMesh1(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
));
6787 case OPCODE_EVALMESH2
:
6788 CALL_EvalMesh2(ctx
->Exec
,
6789 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
6798 CALL_Fogfv(ctx
->Exec
, (n
[1].e
, p
));
6801 case OPCODE_FRONT_FACE
:
6802 CALL_FrontFace(ctx
->Exec
, (n
[1].e
));
6804 case OPCODE_FRUSTUM
:
6805 CALL_Frustum(ctx
->Exec
,
6806 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
6809 CALL_Hint(ctx
->Exec
, (n
[1].e
, n
[2].e
));
6811 case OPCODE_HISTOGRAM
:
6812 CALL_Histogram(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].b
));
6814 case OPCODE_INDEX_MASK
:
6815 CALL_IndexMask(ctx
->Exec
, (n
[1].ui
));
6817 case OPCODE_INIT_NAMES
:
6818 CALL_InitNames(ctx
->Exec
, ());
6827 CALL_Lightfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, p
));
6830 case OPCODE_LIGHT_MODEL
:
6837 CALL_LightModelfv(ctx
->Exec
, (n
[1].e
, p
));
6840 case OPCODE_LINE_STIPPLE
:
6841 CALL_LineStipple(ctx
->Exec
, (n
[1].i
, n
[2].us
));
6843 case OPCODE_LINE_WIDTH
:
6844 CALL_LineWidth(ctx
->Exec
, (n
[1].f
));
6846 case OPCODE_LIST_BASE
:
6847 CALL_ListBase(ctx
->Exec
, (n
[1].ui
));
6849 case OPCODE_LOAD_IDENTITY
:
6850 CALL_LoadIdentity(ctx
->Exec
, ());
6852 case OPCODE_LOAD_MATRIX
:
6853 if (sizeof(Node
) == sizeof(GLfloat
)) {
6854 CALL_LoadMatrixf(ctx
->Exec
, (&n
[1].f
));
6859 for (i
= 0; i
< 16; i
++) {
6862 CALL_LoadMatrixf(ctx
->Exec
, (m
));
6865 case OPCODE_LOAD_NAME
:
6866 CALL_LoadName(ctx
->Exec
, (n
[1].ui
));
6868 case OPCODE_LOGIC_OP
:
6869 CALL_LogicOp(ctx
->Exec
, (n
[1].e
));
6873 GLenum target
= n
[1].e
;
6874 GLint ustride
= _mesa_evaluator_components(target
);
6875 GLint uorder
= n
[5].i
;
6876 GLfloat u1
= n
[2].f
;
6877 GLfloat u2
= n
[3].f
;
6878 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
6879 (GLfloat
*) n
[6].data
));
6884 GLenum target
= n
[1].e
;
6885 GLfloat u1
= n
[2].f
;
6886 GLfloat u2
= n
[3].f
;
6887 GLfloat v1
= n
[4].f
;
6888 GLfloat v2
= n
[5].f
;
6889 GLint ustride
= n
[6].i
;
6890 GLint vstride
= n
[7].i
;
6891 GLint uorder
= n
[8].i
;
6892 GLint vorder
= n
[9].i
;
6893 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
6894 v1
, v2
, vstride
, vorder
,
6895 (GLfloat
*) n
[10].data
));
6898 case OPCODE_MAPGRID1
:
6899 CALL_MapGrid1f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
6901 case OPCODE_MAPGRID2
:
6902 CALL_MapGrid2f(ctx
->Exec
,
6903 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
));
6905 case OPCODE_MATRIX_MODE
:
6906 CALL_MatrixMode(ctx
->Exec
, (n
[1].e
));
6908 case OPCODE_MIN_MAX
:
6909 CALL_Minmax(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].b
));
6911 case OPCODE_MULT_MATRIX
:
6912 if (sizeof(Node
) == sizeof(GLfloat
)) {
6913 CALL_MultMatrixf(ctx
->Exec
, (&n
[1].f
));
6918 for (i
= 0; i
< 16; i
++) {
6921 CALL_MultMatrixf(ctx
->Exec
, (m
));
6925 CALL_Ortho(ctx
->Exec
,
6926 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
6928 case OPCODE_PASSTHROUGH
:
6929 CALL_PassThrough(ctx
->Exec
, (n
[1].f
));
6931 case OPCODE_PIXEL_MAP
:
6932 CALL_PixelMapfv(ctx
->Exec
,
6933 (n
[1].e
, n
[2].i
, (GLfloat
*) n
[3].data
));
6935 case OPCODE_PIXEL_TRANSFER
:
6936 CALL_PixelTransferf(ctx
->Exec
, (n
[1].e
, n
[2].f
));
6938 case OPCODE_PIXEL_ZOOM
:
6939 CALL_PixelZoom(ctx
->Exec
, (n
[1].f
, n
[2].f
));
6941 case OPCODE_POINT_SIZE
:
6942 CALL_PointSize(ctx
->Exec
, (n
[1].f
));
6944 case OPCODE_POINT_PARAMETERS
:
6950 CALL_PointParameterfvEXT(ctx
->Exec
, (n
[1].e
, params
));
6953 case OPCODE_POLYGON_MODE
:
6954 CALL_PolygonMode(ctx
->Exec
, (n
[1].e
, n
[2].e
));
6956 case OPCODE_POLYGON_STIPPLE
:
6958 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6959 ctx
->Unpack
= ctx
->DefaultPacking
;
6960 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) n
[1].data
));
6961 ctx
->Unpack
= save
; /* restore */
6964 case OPCODE_POLYGON_OFFSET
:
6965 CALL_PolygonOffset(ctx
->Exec
, (n
[1].f
, n
[2].f
));
6967 case OPCODE_POP_ATTRIB
:
6968 CALL_PopAttrib(ctx
->Exec
, ());
6970 case OPCODE_POP_MATRIX
:
6971 CALL_PopMatrix(ctx
->Exec
, ());
6973 case OPCODE_POP_NAME
:
6974 CALL_PopName(ctx
->Exec
, ());
6976 case OPCODE_PRIORITIZE_TEXTURE
:
6977 CALL_PrioritizeTextures(ctx
->Exec
, (1, &n
[1].ui
, &n
[2].f
));
6979 case OPCODE_PUSH_ATTRIB
:
6980 CALL_PushAttrib(ctx
->Exec
, (n
[1].bf
));
6982 case OPCODE_PUSH_MATRIX
:
6983 CALL_PushMatrix(ctx
->Exec
, ());
6985 case OPCODE_PUSH_NAME
:
6986 CALL_PushName(ctx
->Exec
, (n
[1].ui
));
6988 case OPCODE_RASTER_POS
:
6989 CALL_RasterPos4f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
6991 case OPCODE_READ_BUFFER
:
6992 CALL_ReadBuffer(ctx
->Exec
, (n
[1].e
));
6994 case OPCODE_RESET_HISTOGRAM
:
6995 CALL_ResetHistogram(ctx
->Exec
, (n
[1].e
));
6997 case OPCODE_RESET_MIN_MAX
:
6998 CALL_ResetMinmax(ctx
->Exec
, (n
[1].e
));
7001 CALL_Rotatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7004 CALL_Scalef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
7006 case OPCODE_SCISSOR
:
7007 CALL_Scissor(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
7009 case OPCODE_SHADE_MODEL
:
7010 CALL_ShadeModel(ctx
->Exec
, (n
[1].e
));
7012 case OPCODE_PROVOKING_VERTEX
:
7013 CALL_ProvokingVertexEXT(ctx
->Exec
, (n
[1].e
));
7015 case OPCODE_STENCIL_FUNC
:
7016 CALL_StencilFunc(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].ui
));
7018 case OPCODE_STENCIL_MASK
:
7019 CALL_StencilMask(ctx
->Exec
, (n
[1].ui
));
7021 case OPCODE_STENCIL_OP
:
7022 CALL_StencilOp(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].e
));
7024 case OPCODE_STENCIL_FUNC_SEPARATE
:
7025 CALL_StencilFuncSeparate(ctx
->Exec
,
7026 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].ui
));
7028 case OPCODE_STENCIL_MASK_SEPARATE
:
7029 CALL_StencilMaskSeparate(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7031 case OPCODE_STENCIL_OP_SEPARATE
:
7032 CALL_StencilOpSeparate(ctx
->Exec
,
7033 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
7042 CALL_TexEnvfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
7052 CALL_TexGenfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
7055 case OPCODE_TEXPARAMETER
:
7062 CALL_TexParameterfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
7065 case OPCODE_TEX_IMAGE1D
:
7067 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7068 ctx
->Unpack
= ctx
->DefaultPacking
;
7069 CALL_TexImage1D(ctx
->Exec
, (n
[1].e
, /* target */
7071 n
[3].i
, /* components */
7073 n
[5].e
, /* border */
7074 n
[6].e
, /* format */
7077 ctx
->Unpack
= save
; /* restore */
7080 case OPCODE_TEX_IMAGE2D
:
7082 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7083 ctx
->Unpack
= ctx
->DefaultPacking
;
7084 CALL_TexImage2D(ctx
->Exec
, (n
[1].e
, /* target */
7086 n
[3].i
, /* components */
7088 n
[5].i
, /* height */
7089 n
[6].e
, /* border */
7090 n
[7].e
, /* format */
7093 ctx
->Unpack
= save
; /* restore */
7096 case OPCODE_TEX_IMAGE3D
:
7098 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7099 ctx
->Unpack
= ctx
->DefaultPacking
;
7100 CALL_TexImage3D(ctx
->Exec
, (n
[1].e
, /* target */
7102 n
[3].i
, /* components */
7104 n
[5].i
, /* height */
7106 n
[7].e
, /* border */
7107 n
[8].e
, /* format */
7110 ctx
->Unpack
= save
; /* restore */
7113 case OPCODE_TEX_SUB_IMAGE1D
:
7115 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7116 ctx
->Unpack
= ctx
->DefaultPacking
;
7117 CALL_TexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7119 n
[6].e
, n
[7].data
));
7120 ctx
->Unpack
= save
; /* restore */
7123 case OPCODE_TEX_SUB_IMAGE2D
:
7125 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7126 ctx
->Unpack
= ctx
->DefaultPacking
;
7127 CALL_TexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7129 n
[6].i
, n
[7].e
, n
[8].e
,
7131 ctx
->Unpack
= save
; /* restore */
7134 case OPCODE_TEX_SUB_IMAGE3D
:
7136 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7137 ctx
->Unpack
= ctx
->DefaultPacking
;
7138 CALL_TexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7139 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
7140 n
[8].i
, n
[9].e
, n
[10].e
,
7142 ctx
->Unpack
= save
; /* restore */
7145 case OPCODE_TRANSLATE
:
7146 CALL_Translatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
7148 case OPCODE_VIEWPORT
:
7149 CALL_Viewport(ctx
->Exec
, (n
[1].i
, n
[2].i
,
7150 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
));
7152 case OPCODE_WINDOW_POS
:
7153 CALL_WindowPos4fMESA(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7155 case OPCODE_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
7156 CALL_ActiveTextureARB(ctx
->Exec
, (n
[1].e
));
7158 case OPCODE_COMPRESSED_TEX_IMAGE_1D
: /* GL_ARB_texture_compression */
7159 CALL_CompressedTexImage1DARB(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
7160 n
[4].i
, n
[5].i
, n
[6].i
,
7163 case OPCODE_COMPRESSED_TEX_IMAGE_2D
: /* GL_ARB_texture_compression */
7164 CALL_CompressedTexImage2DARB(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
7165 n
[4].i
, n
[5].i
, n
[6].i
,
7166 n
[7].i
, n
[8].data
));
7168 case OPCODE_COMPRESSED_TEX_IMAGE_3D
: /* GL_ARB_texture_compression */
7169 CALL_CompressedTexImage3DARB(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
7170 n
[4].i
, n
[5].i
, n
[6].i
,
7174 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
: /* GL_ARB_texture_compress */
7175 CALL_CompressedTexSubImage1DARB(ctx
->Exec
,
7176 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
7177 n
[5].e
, n
[6].i
, n
[7].data
));
7179 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
: /* GL_ARB_texture_compress */
7180 CALL_CompressedTexSubImage2DARB(ctx
->Exec
,
7181 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
7182 n
[5].i
, n
[6].i
, n
[7].e
, n
[8].i
,
7185 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
: /* GL_ARB_texture_compress */
7186 CALL_CompressedTexSubImage3DARB(ctx
->Exec
,
7187 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
7188 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
7189 n
[9].e
, n
[10].i
, n
[11].data
));
7191 case OPCODE_SAMPLE_COVERAGE
: /* GL_ARB_multisample */
7192 CALL_SampleCoverageARB(ctx
->Exec
, (n
[1].f
, n
[2].b
));
7194 case OPCODE_WINDOW_POS_ARB
: /* GL_ARB_window_pos */
7195 CALL_WindowPos3fMESA(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
7197 #if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
7198 case OPCODE_BIND_PROGRAM_NV
: /* GL_NV_vertex_program */
7199 CALL_BindProgramNV(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7202 #if FEATURE_NV_vertex_program
7203 case OPCODE_EXECUTE_PROGRAM_NV
:
7210 CALL_ExecuteProgramNV(ctx
->Exec
, (n
[1].e
, n
[2].ui
, v
));
7213 case OPCODE_REQUEST_RESIDENT_PROGRAMS_NV
:
7214 CALL_RequestResidentProgramsNV(ctx
->Exec
, (n
[1].ui
,
7215 (GLuint
*) n
[2].data
));
7217 case OPCODE_LOAD_PROGRAM_NV
:
7218 CALL_LoadProgramNV(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].i
,
7219 (const GLubyte
*) n
[4].data
));
7221 case OPCODE_TRACK_MATRIX_NV
:
7222 CALL_TrackMatrixNV(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].e
, n
[4].e
));
7226 #if FEATURE_NV_fragment_program
7227 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
:
7228 CALL_ProgramLocalParameter4fARB(ctx
->Exec
,
7229 (n
[1].e
, n
[2].ui
, n
[3].f
, n
[4].f
,
7232 case OPCODE_PROGRAM_NAMED_PARAMETER_NV
:
7233 CALL_ProgramNamedParameter4fNV(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
7234 (const GLubyte
*) n
[3].
7235 data
, n
[4].f
, n
[5].f
,
7240 case OPCODE_ACTIVE_STENCIL_FACE_EXT
:
7241 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (n
[1].e
));
7243 case OPCODE_DEPTH_BOUNDS_EXT
:
7244 CALL_DepthBoundsEXT(ctx
->Exec
, (n
[1].f
, n
[2].f
));
7246 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
7247 case OPCODE_PROGRAM_STRING_ARB
:
7248 CALL_ProgramStringARB(ctx
->Exec
,
7249 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].data
));
7252 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program || FEATURE_NV_vertex_program
7253 case OPCODE_PROGRAM_ENV_PARAMETER_ARB
:
7254 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].f
,
7259 #if FEATURE_queryobj
7260 case OPCODE_BEGIN_QUERY_ARB
:
7261 CALL_BeginQueryARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7263 case OPCODE_END_QUERY_ARB
:
7264 CALL_EndQueryARB(ctx
->Exec
, (n
[1].e
));
7267 case OPCODE_DRAW_BUFFERS_ARB
:
7269 GLenum buffers
[MAX_DRAW_BUFFERS
];
7270 GLint i
, count
= MIN2(n
[1].i
, MAX_DRAW_BUFFERS
);
7271 for (i
= 0; i
< count
; i
++)
7272 buffers
[i
] = n
[2 + i
].e
;
7273 CALL_DrawBuffersARB(ctx
->Exec
, (n
[1].i
, buffers
));
7276 #if FEATURE_EXT_framebuffer_blit
7277 case OPCODE_BLIT_FRAMEBUFFER
:
7278 CALL_BlitFramebufferEXT(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
,
7279 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
7284 case OPCODE_USE_PROGRAM
:
7285 CALL_UseProgramObjectARB(ctx
->Exec
, (n
[1].ui
));
7287 case OPCODE_UNIFORM_1F
:
7288 CALL_Uniform1fARB(ctx
->Exec
, (n
[1].i
, n
[2].f
));
7290 case OPCODE_UNIFORM_2F
:
7291 CALL_Uniform2fARB(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
7293 case OPCODE_UNIFORM_3F
:
7294 CALL_Uniform3fARB(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
));
7296 case OPCODE_UNIFORM_4F
:
7297 CALL_Uniform4fARB(ctx
->Exec
,
7298 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
));
7300 case OPCODE_UNIFORM_1FV
:
7301 CALL_Uniform1fvARB(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
7303 case OPCODE_UNIFORM_2FV
:
7304 CALL_Uniform2fvARB(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
7306 case OPCODE_UNIFORM_3FV
:
7307 CALL_Uniform3fvARB(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
7309 case OPCODE_UNIFORM_4FV
:
7310 CALL_Uniform4fvARB(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
7312 case OPCODE_UNIFORM_1I
:
7313 CALL_Uniform1iARB(ctx
->Exec
, (n
[1].i
, n
[2].i
));
7315 case OPCODE_UNIFORM_2I
:
7316 CALL_Uniform2iARB(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
));
7318 case OPCODE_UNIFORM_3I
:
7319 CALL_Uniform3iARB(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
7321 case OPCODE_UNIFORM_4I
:
7322 CALL_Uniform4iARB(ctx
->Exec
,
7323 (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
7325 case OPCODE_UNIFORM_1IV
:
7326 CALL_Uniform1ivARB(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
7328 case OPCODE_UNIFORM_2IV
:
7329 CALL_Uniform2ivARB(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
7331 case OPCODE_UNIFORM_3IV
:
7332 CALL_Uniform3ivARB(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
7334 case OPCODE_UNIFORM_4IV
:
7335 CALL_Uniform4ivARB(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
7338 case OPCODE_UNIFORM_MATRIX22
:
7339 CALL_UniformMatrix2fvARB(ctx
->Exec
,
7340 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
7342 case OPCODE_UNIFORM_MATRIX33
:
7343 CALL_UniformMatrix3fvARB(ctx
->Exec
,
7344 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
7346 case OPCODE_UNIFORM_MATRIX44
:
7347 CALL_UniformMatrix4fvARB(ctx
->Exec
,
7348 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
7350 case OPCODE_UNIFORM_MATRIX23
:
7351 CALL_UniformMatrix2x3fv(ctx
->Exec
,
7352 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
7354 case OPCODE_UNIFORM_MATRIX32
:
7355 CALL_UniformMatrix3x2fv(ctx
->Exec
,
7356 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
7358 case OPCODE_UNIFORM_MATRIX24
:
7359 CALL_UniformMatrix2x4fv(ctx
->Exec
,
7360 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
7362 case OPCODE_UNIFORM_MATRIX42
:
7363 CALL_UniformMatrix4x2fv(ctx
->Exec
,
7364 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
7366 case OPCODE_UNIFORM_MATRIX34
:
7367 CALL_UniformMatrix3x4fv(ctx
->Exec
,
7368 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
7370 case OPCODE_UNIFORM_MATRIX43
:
7371 CALL_UniformMatrix4x3fv(ctx
->Exec
,
7372 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
7375 case OPCODE_TEX_BUMP_PARAMETER_ATI
:
7378 GLuint i
, pname
= n
[1].ui
;
7380 for (i
= 0; i
< 4; i
++)
7381 values
[i
] = n
[1 + i
].f
;
7382 CALL_TexBumpParameterfvATI(ctx
->Exec
, (pname
, values
));
7385 #if FEATURE_ATI_fragment_shader
7386 case OPCODE_BIND_FRAGMENT_SHADER_ATI
:
7387 CALL_BindFragmentShaderATI(ctx
->Exec
, (n
[1].i
));
7389 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
:
7392 GLuint i
, dst
= n
[1].ui
;
7394 for (i
= 0; i
< 4; i
++)
7395 values
[i
] = n
[1 + i
].f
;
7396 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, values
));
7400 case OPCODE_ATTR_1F_NV
:
7401 CALL_VertexAttrib1fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7403 case OPCODE_ATTR_2F_NV
:
7404 /* Really shouldn't have to do this - the Node structure
7405 * is convenient, but it would be better to store the data
7406 * packed appropriately so that it can be sent directly
7407 * on. With x86_64 becoming common, this will start to
7410 if (sizeof(Node
) == sizeof(GLfloat
))
7411 CALL_VertexAttrib2fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
7413 CALL_VertexAttrib2fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
));
7415 case OPCODE_ATTR_3F_NV
:
7416 if (sizeof(Node
) == sizeof(GLfloat
))
7417 CALL_VertexAttrib3fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
7419 CALL_VertexAttrib3fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
7422 case OPCODE_ATTR_4F_NV
:
7423 if (sizeof(Node
) == sizeof(GLfloat
))
7424 CALL_VertexAttrib4fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
7426 CALL_VertexAttrib4fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
7429 case OPCODE_ATTR_1F_ARB
:
7430 CALL_VertexAttrib1fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7432 case OPCODE_ATTR_2F_ARB
:
7433 /* Really shouldn't have to do this - the Node structure
7434 * is convenient, but it would be better to store the data
7435 * packed appropriately so that it can be sent directly
7436 * on. With x86_64 becoming common, this will start to
7439 if (sizeof(Node
) == sizeof(GLfloat
))
7440 CALL_VertexAttrib2fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
7442 CALL_VertexAttrib2fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
));
7444 case OPCODE_ATTR_3F_ARB
:
7445 if (sizeof(Node
) == sizeof(GLfloat
))
7446 CALL_VertexAttrib3fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
7448 CALL_VertexAttrib3fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
7451 case OPCODE_ATTR_4F_ARB
:
7452 if (sizeof(Node
) == sizeof(GLfloat
))
7453 CALL_VertexAttrib4fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
7455 CALL_VertexAttrib4fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
7458 case OPCODE_MATERIAL
:
7459 if (sizeof(Node
) == sizeof(GLfloat
))
7460 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, &n
[3].f
));
7467 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, f
));
7471 CALL_Begin(ctx
->Exec
, (n
[1].e
));
7474 CALL_End(ctx
->Exec
, ());
7477 CALL_Rectf(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7479 case OPCODE_EVAL_C1
:
7480 CALL_EvalCoord1f(ctx
->Exec
, (n
[1].f
));
7482 case OPCODE_EVAL_C2
:
7483 CALL_EvalCoord2f(ctx
->Exec
, (n
[1].f
, n
[2].f
));
7485 case OPCODE_EVAL_P1
:
7486 CALL_EvalPoint1(ctx
->Exec
, (n
[1].i
));
7488 case OPCODE_EVAL_P2
:
7489 CALL_EvalPoint2(ctx
->Exec
, (n
[1].i
, n
[2].i
));
7492 case OPCODE_CONTINUE
:
7493 n
= (Node
*) n
[1].next
;
7495 case OPCODE_END_OF_LIST
:
7501 _mesa_sprintf(msg
, "Error in execute_list: opcode=%d",
7503 _mesa_problem(ctx
, msg
);
7508 /* increment n to point to next compiled command */
7509 if (opcode
!= OPCODE_CONTINUE
) {
7510 n
+= InstSize
[opcode
];
7515 if (ctx
->Driver
.EndCallList
)
7516 ctx
->Driver
.EndCallList(ctx
);
7518 ctx
->ListState
.CallDepth
--;
7523 /**********************************************************************/
7525 /**********************************************************************/
7528 * Test if a display list number is valid.
7530 static GLboolean GLAPIENTRY
7531 _mesa_IsList(GLuint list
)
7533 GET_CURRENT_CONTEXT(ctx
);
7534 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
7535 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
7536 return islist(ctx
, list
);
7541 * Delete a sequence of consecutive display lists.
7543 static void GLAPIENTRY
7544 _mesa_DeleteLists(GLuint list
, GLsizei range
)
7546 GET_CURRENT_CONTEXT(ctx
);
7548 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
7549 ASSERT_OUTSIDE_BEGIN_END(ctx
);
7552 _mesa_error(ctx
, GL_INVALID_VALUE
, "glDeleteLists");
7555 for (i
= list
; i
< list
+ range
; i
++) {
7556 destroy_list(ctx
, i
);
7562 * Return a display list number, n, such that lists n through n+range-1
7565 static GLuint GLAPIENTRY
7566 _mesa_GenLists(GLsizei range
)
7568 GET_CURRENT_CONTEXT(ctx
);
7570 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
7571 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, 0);
7574 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGenLists");
7582 * Make this an atomic operation
7584 _glthread_LOCK_MUTEX(ctx
->Shared
->Mutex
);
7586 base
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
7588 /* reserve the list IDs by with empty/dummy lists */
7590 for (i
= 0; i
< range
; i
++) {
7591 _mesa_HashInsert(ctx
->Shared
->DisplayList
, base
+ i
,
7592 make_list(base
+ i
, 1));
7596 _glthread_UNLOCK_MUTEX(ctx
->Shared
->Mutex
);
7603 * Begin a new display list.
7605 static void GLAPIENTRY
7606 _mesa_NewList(GLuint name
, GLenum mode
)
7608 GET_CURRENT_CONTEXT(ctx
);
7610 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
7611 ASSERT_OUTSIDE_BEGIN_END(ctx
);
7613 if (MESA_VERBOSE
& VERBOSE_API
)
7614 _mesa_debug(ctx
, "glNewList %u %s\n", name
,
7615 _mesa_lookup_enum_by_nr(mode
));
7618 _mesa_error(ctx
, GL_INVALID_VALUE
, "glNewList");
7622 if (mode
!= GL_COMPILE
&& mode
!= GL_COMPILE_AND_EXECUTE
) {
7623 _mesa_error(ctx
, GL_INVALID_ENUM
, "glNewList");
7627 if (ctx
->ListState
.CurrentList
) {
7628 /* already compiling a display list */
7629 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
7633 ctx
->CompileFlag
= GL_TRUE
;
7634 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
7636 /* Reset acumulated list state:
7638 invalidate_saved_current_state( ctx
);
7640 /* Allocate new display list */
7641 ctx
->ListState
.CurrentList
= make_list(name
, BLOCK_SIZE
);
7642 ctx
->ListState
.CurrentBlock
= ctx
->ListState
.CurrentList
->Head
;
7643 ctx
->ListState
.CurrentPos
= 0;
7645 ctx
->Driver
.NewList(ctx
, name
, mode
);
7647 ctx
->CurrentDispatch
= ctx
->Save
;
7648 _glapi_set_dispatch(ctx
->CurrentDispatch
);
7653 * End definition of current display list.
7655 static void GLAPIENTRY
7658 GET_CURRENT_CONTEXT(ctx
);
7659 SAVE_FLUSH_VERTICES(ctx
);
7660 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
7662 if (MESA_VERBOSE
& VERBOSE_API
)
7663 _mesa_debug(ctx
, "glEndList\n");
7665 /* Check that a list is under construction */
7666 if (!ctx
->ListState
.CurrentList
) {
7667 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glEndList");
7671 /* Call before emitting END_OF_LIST, in case the driver wants to
7672 * emit opcodes itself.
7674 ctx
->Driver
.EndList(ctx
);
7676 (void) alloc_instruction(ctx
, OPCODE_END_OF_LIST
, 0);
7678 /* Destroy old list, if any */
7679 destroy_list(ctx
, ctx
->ListState
.CurrentList
->Name
);
7681 /* Install the new list */
7682 _mesa_HashInsert(ctx
->Shared
->DisplayList
,
7683 ctx
->ListState
.CurrentList
->Name
,
7684 ctx
->ListState
.CurrentList
);
7687 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
7688 mesa_print_display_list(ctx
->ListState
.CurrentList
->Name
);
7690 ctx
->ListState
.CurrentList
= NULL
;
7691 ctx
->ExecuteFlag
= GL_TRUE
;
7692 ctx
->CompileFlag
= GL_FALSE
;
7694 ctx
->CurrentDispatch
= ctx
->Exec
;
7695 _glapi_set_dispatch(ctx
->CurrentDispatch
);
7700 _mesa_CallList(GLuint list
)
7702 GLboolean save_compile_flag
;
7703 GET_CURRENT_CONTEXT(ctx
);
7704 FLUSH_CURRENT(ctx
, 0);
7705 /* VERY IMPORTANT: Save the CompileFlag status, turn it off, */
7706 /* execute the display list, and restore the CompileFlag. */
7708 if (MESA_VERBOSE
& VERBOSE_API
)
7709 _mesa_debug(ctx
, "glCallList %d\n", list
);
7712 _mesa_error(ctx
, GL_INVALID_VALUE
, "glCallList(list==0)");
7716 /* mesa_print_display_list( list ); */
7718 save_compile_flag
= ctx
->CompileFlag
;
7719 if (save_compile_flag
) {
7720 ctx
->CompileFlag
= GL_FALSE
;
7723 execute_list(ctx
, list
);
7724 ctx
->CompileFlag
= save_compile_flag
;
7726 /* also restore API function pointers to point to "save" versions */
7727 if (save_compile_flag
) {
7728 ctx
->CurrentDispatch
= ctx
->Save
;
7729 _glapi_set_dispatch(ctx
->CurrentDispatch
);
7735 * Execute glCallLists: call multiple display lists.
7738 _mesa_CallLists(GLsizei n
, GLenum type
, const GLvoid
* lists
)
7740 GET_CURRENT_CONTEXT(ctx
);
7742 GLboolean save_compile_flag
;
7744 if (MESA_VERBOSE
& VERBOSE_API
)
7745 _mesa_debug(ctx
, "glCallLists %d\n", n
);
7749 case GL_UNSIGNED_BYTE
:
7751 case GL_UNSIGNED_SHORT
:
7753 case GL_UNSIGNED_INT
:
7761 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
7765 /* Save the CompileFlag status, turn it off, execute display list,
7766 * and restore the CompileFlag.
7768 save_compile_flag
= ctx
->CompileFlag
;
7769 ctx
->CompileFlag
= GL_FALSE
;
7771 for (i
= 0; i
< n
; i
++) {
7772 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ translate_id(i
, type
, lists
));
7773 execute_list(ctx
, list
);
7776 ctx
->CompileFlag
= save_compile_flag
;
7778 /* also restore API function pointers to point to "save" versions */
7779 if (save_compile_flag
) {
7780 ctx
->CurrentDispatch
= ctx
->Save
;
7781 _glapi_set_dispatch(ctx
->CurrentDispatch
);
7787 * Set the offset added to list numbers in glCallLists.
7789 static void GLAPIENTRY
7790 _mesa_ListBase(GLuint base
)
7792 GET_CURRENT_CONTEXT(ctx
);
7793 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
7794 ASSERT_OUTSIDE_BEGIN_END(ctx
);
7795 ctx
->List
.ListBase
= base
;
7799 /* Can no longer assume ctx->Exec->Func is equal to _mesa_Func.
7801 static void GLAPIENTRY
7804 GET_CURRENT_CONTEXT(ctx
);
7805 FLUSH_VERTICES(ctx
, 0);
7806 CALL_Finish(ctx
->Exec
, ());
7809 static void GLAPIENTRY
7812 GET_CURRENT_CONTEXT(ctx
);
7813 FLUSH_VERTICES(ctx
, 0);
7814 CALL_Flush(ctx
->Exec
, ());
7817 static void GLAPIENTRY
7818 exec_GetBooleanv(GLenum pname
, GLboolean
*params
)
7820 GET_CURRENT_CONTEXT(ctx
);
7821 FLUSH_VERTICES(ctx
, 0);
7822 CALL_GetBooleanv(ctx
->Exec
, (pname
, params
));
7825 static void GLAPIENTRY
7826 exec_GetClipPlane(GLenum plane
, GLdouble
* equation
)
7828 GET_CURRENT_CONTEXT(ctx
);
7829 FLUSH_VERTICES(ctx
, 0);
7830 CALL_GetClipPlane(ctx
->Exec
, (plane
, equation
));
7833 static void GLAPIENTRY
7834 exec_GetDoublev(GLenum pname
, GLdouble
*params
)
7836 GET_CURRENT_CONTEXT(ctx
);
7837 FLUSH_VERTICES(ctx
, 0);
7838 CALL_GetDoublev(ctx
->Exec
, (pname
, params
));
7841 static GLenum GLAPIENTRY
7844 GET_CURRENT_CONTEXT(ctx
);
7845 FLUSH_VERTICES(ctx
, 0);
7846 return CALL_GetError(ctx
->Exec
, ());
7849 static void GLAPIENTRY
7850 exec_GetFloatv(GLenum pname
, GLfloat
*params
)
7852 GET_CURRENT_CONTEXT(ctx
);
7853 FLUSH_VERTICES(ctx
, 0);
7854 CALL_GetFloatv(ctx
->Exec
, (pname
, params
));
7857 static void GLAPIENTRY
7858 exec_GetIntegerv(GLenum pname
, GLint
*params
)
7860 GET_CURRENT_CONTEXT(ctx
);
7861 FLUSH_VERTICES(ctx
, 0);
7862 CALL_GetIntegerv(ctx
->Exec
, (pname
, params
));
7865 static void GLAPIENTRY
7866 exec_GetLightfv(GLenum light
, GLenum pname
, GLfloat
*params
)
7868 GET_CURRENT_CONTEXT(ctx
);
7869 FLUSH_VERTICES(ctx
, 0);
7870 CALL_GetLightfv(ctx
->Exec
, (light
, pname
, params
));
7873 static void GLAPIENTRY
7874 exec_GetLightiv(GLenum light
, GLenum pname
, GLint
*params
)
7876 GET_CURRENT_CONTEXT(ctx
);
7877 FLUSH_VERTICES(ctx
, 0);
7878 CALL_GetLightiv(ctx
->Exec
, (light
, pname
, params
));
7881 static void GLAPIENTRY
7882 exec_GetMapdv(GLenum target
, GLenum query
, GLdouble
* v
)
7884 GET_CURRENT_CONTEXT(ctx
);
7885 FLUSH_VERTICES(ctx
, 0);
7886 CALL_GetMapdv(ctx
->Exec
, (target
, query
, v
));
7889 static void GLAPIENTRY
7890 exec_GetMapfv(GLenum target
, GLenum query
, GLfloat
* v
)
7892 GET_CURRENT_CONTEXT(ctx
);
7893 FLUSH_VERTICES(ctx
, 0);
7894 CALL_GetMapfv(ctx
->Exec
, (target
, query
, v
));
7897 static void GLAPIENTRY
7898 exec_GetMapiv(GLenum target
, GLenum query
, GLint
* v
)
7900 GET_CURRENT_CONTEXT(ctx
);
7901 FLUSH_VERTICES(ctx
, 0);
7902 CALL_GetMapiv(ctx
->Exec
, (target
, query
, v
));
7905 static void GLAPIENTRY
7906 exec_GetMaterialfv(GLenum face
, GLenum pname
, GLfloat
*params
)
7908 GET_CURRENT_CONTEXT(ctx
);
7909 FLUSH_VERTICES(ctx
, 0);
7910 CALL_GetMaterialfv(ctx
->Exec
, (face
, pname
, params
));
7913 static void GLAPIENTRY
7914 exec_GetMaterialiv(GLenum face
, GLenum pname
, GLint
*params
)
7916 GET_CURRENT_CONTEXT(ctx
);
7917 FLUSH_VERTICES(ctx
, 0);
7918 CALL_GetMaterialiv(ctx
->Exec
, (face
, pname
, params
));
7921 static void GLAPIENTRY
7922 exec_GetPixelMapfv(GLenum map
, GLfloat
*values
)
7924 GET_CURRENT_CONTEXT(ctx
);
7925 FLUSH_VERTICES(ctx
, 0);
7926 CALL_GetPixelMapfv(ctx
->Exec
, (map
, values
));
7929 static void GLAPIENTRY
7930 exec_GetPixelMapuiv(GLenum map
, GLuint
*values
)
7932 GET_CURRENT_CONTEXT(ctx
);
7933 FLUSH_VERTICES(ctx
, 0);
7934 CALL_GetPixelMapuiv(ctx
->Exec
, (map
, values
));
7937 static void GLAPIENTRY
7938 exec_GetPixelMapusv(GLenum map
, GLushort
*values
)
7940 GET_CURRENT_CONTEXT(ctx
);
7941 FLUSH_VERTICES(ctx
, 0);
7942 CALL_GetPixelMapusv(ctx
->Exec
, (map
, values
));
7945 static void GLAPIENTRY
7946 exec_GetPolygonStipple(GLubyte
* dest
)
7948 GET_CURRENT_CONTEXT(ctx
);
7949 FLUSH_VERTICES(ctx
, 0);
7950 CALL_GetPolygonStipple(ctx
->Exec
, (dest
));
7953 static const GLubyte
*GLAPIENTRY
7954 exec_GetString(GLenum name
)
7956 GET_CURRENT_CONTEXT(ctx
);
7957 FLUSH_VERTICES(ctx
, 0);
7958 return CALL_GetString(ctx
->Exec
, (name
));
7961 static void GLAPIENTRY
7962 exec_GetTexEnvfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7964 GET_CURRENT_CONTEXT(ctx
);
7965 FLUSH_VERTICES(ctx
, 0);
7966 CALL_GetTexEnvfv(ctx
->Exec
, (target
, pname
, params
));
7969 static void GLAPIENTRY
7970 exec_GetTexEnviv(GLenum target
, GLenum pname
, GLint
*params
)
7972 GET_CURRENT_CONTEXT(ctx
);
7973 FLUSH_VERTICES(ctx
, 0);
7974 CALL_GetTexEnviv(ctx
->Exec
, (target
, pname
, params
));
7977 static void GLAPIENTRY
7978 exec_GetTexGendv(GLenum coord
, GLenum pname
, GLdouble
*params
)
7980 GET_CURRENT_CONTEXT(ctx
);
7981 FLUSH_VERTICES(ctx
, 0);
7982 CALL_GetTexGendv(ctx
->Exec
, (coord
, pname
, params
));
7985 static void GLAPIENTRY
7986 exec_GetTexGenfv(GLenum coord
, GLenum pname
, GLfloat
*params
)
7988 GET_CURRENT_CONTEXT(ctx
);
7989 FLUSH_VERTICES(ctx
, 0);
7990 CALL_GetTexGenfv(ctx
->Exec
, (coord
, pname
, params
));
7993 static void GLAPIENTRY
7994 exec_GetTexGeniv(GLenum coord
, GLenum pname
, GLint
*params
)
7996 GET_CURRENT_CONTEXT(ctx
);
7997 FLUSH_VERTICES(ctx
, 0);
7998 CALL_GetTexGeniv(ctx
->Exec
, (coord
, pname
, params
));
8001 static void GLAPIENTRY
8002 exec_GetTexImage(GLenum target
, GLint level
, GLenum format
,
8003 GLenum type
, GLvoid
* pixels
)
8005 GET_CURRENT_CONTEXT(ctx
);
8006 FLUSH_VERTICES(ctx
, 0);
8007 CALL_GetTexImage(ctx
->Exec
, (target
, level
, format
, type
, pixels
));
8010 static void GLAPIENTRY
8011 exec_GetTexLevelParameterfv(GLenum target
, GLint level
,
8012 GLenum pname
, GLfloat
*params
)
8014 GET_CURRENT_CONTEXT(ctx
);
8015 FLUSH_VERTICES(ctx
, 0);
8016 CALL_GetTexLevelParameterfv(ctx
->Exec
, (target
, level
, pname
, params
));
8019 static void GLAPIENTRY
8020 exec_GetTexLevelParameteriv(GLenum target
, GLint level
,
8021 GLenum pname
, GLint
*params
)
8023 GET_CURRENT_CONTEXT(ctx
);
8024 FLUSH_VERTICES(ctx
, 0);
8025 CALL_GetTexLevelParameteriv(ctx
->Exec
, (target
, level
, pname
, params
));
8028 static void GLAPIENTRY
8029 exec_GetTexParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
8031 GET_CURRENT_CONTEXT(ctx
);
8032 FLUSH_VERTICES(ctx
, 0);
8033 CALL_GetTexParameterfv(ctx
->Exec
, (target
, pname
, params
));
8036 static void GLAPIENTRY
8037 exec_GetTexParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
8039 GET_CURRENT_CONTEXT(ctx
);
8040 FLUSH_VERTICES(ctx
, 0);
8041 CALL_GetTexParameteriv(ctx
->Exec
, (target
, pname
, params
));
8044 static GLboolean GLAPIENTRY
8045 exec_IsEnabled(GLenum cap
)
8047 GET_CURRENT_CONTEXT(ctx
);
8048 FLUSH_VERTICES(ctx
, 0);
8049 return CALL_IsEnabled(ctx
->Exec
, (cap
));
8052 static void GLAPIENTRY
8053 exec_PixelStoref(GLenum pname
, GLfloat param
)
8055 GET_CURRENT_CONTEXT(ctx
);
8056 FLUSH_VERTICES(ctx
, 0);
8057 CALL_PixelStoref(ctx
->Exec
, (pname
, param
));
8060 static void GLAPIENTRY
8061 exec_PixelStorei(GLenum pname
, GLint param
)
8063 GET_CURRENT_CONTEXT(ctx
);
8064 FLUSH_VERTICES(ctx
, 0);
8065 CALL_PixelStorei(ctx
->Exec
, (pname
, param
));
8068 static void GLAPIENTRY
8069 exec_ReadPixels(GLint x
, GLint y
, GLsizei width
, GLsizei height
,
8070 GLenum format
, GLenum type
, GLvoid
* pixels
)
8072 GET_CURRENT_CONTEXT(ctx
);
8073 FLUSH_VERTICES(ctx
, 0);
8074 CALL_ReadPixels(ctx
->Exec
, (x
, y
, width
, height
, format
, type
, pixels
));
8077 static GLint GLAPIENTRY
8078 exec_RenderMode(GLenum mode
)
8080 GET_CURRENT_CONTEXT(ctx
);
8081 FLUSH_VERTICES(ctx
, 0);
8082 return CALL_RenderMode(ctx
->Exec
, (mode
));
8085 static void GLAPIENTRY
8086 exec_FeedbackBuffer(GLsizei size
, GLenum type
, GLfloat
* buffer
)
8088 GET_CURRENT_CONTEXT(ctx
);
8089 FLUSH_VERTICES(ctx
, 0);
8090 CALL_FeedbackBuffer(ctx
->Exec
, (size
, type
, buffer
));
8093 static void GLAPIENTRY
8094 exec_SelectBuffer(GLsizei size
, GLuint
* buffer
)
8096 GET_CURRENT_CONTEXT(ctx
);
8097 FLUSH_VERTICES(ctx
, 0);
8098 CALL_SelectBuffer(ctx
->Exec
, (size
, buffer
));
8101 static GLboolean GLAPIENTRY
8102 exec_AreTexturesResident(GLsizei n
, const GLuint
* texName
,
8103 GLboolean
* residences
)
8105 GET_CURRENT_CONTEXT(ctx
);
8106 FLUSH_VERTICES(ctx
, 0);
8107 return CALL_AreTexturesResident(ctx
->Exec
, (n
, texName
, residences
));
8110 static void GLAPIENTRY
8111 exec_ColorPointer(GLint size
, GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
8113 GET_CURRENT_CONTEXT(ctx
);
8114 FLUSH_VERTICES(ctx
, 0);
8115 CALL_ColorPointer(ctx
->Exec
, (size
, type
, stride
, ptr
));
8118 static void GLAPIENTRY
8119 exec_DeleteTextures(GLsizei n
, const GLuint
* texName
)
8121 GET_CURRENT_CONTEXT(ctx
);
8122 FLUSH_VERTICES(ctx
, 0);
8123 CALL_DeleteTextures(ctx
->Exec
, (n
, texName
));
8126 static void GLAPIENTRY
8127 exec_DisableClientState(GLenum cap
)
8129 GET_CURRENT_CONTEXT(ctx
);
8130 FLUSH_VERTICES(ctx
, 0);
8131 CALL_DisableClientState(ctx
->Exec
, (cap
));
8134 static void GLAPIENTRY
8135 exec_EdgeFlagPointer(GLsizei stride
, const GLvoid
* vptr
)
8137 GET_CURRENT_CONTEXT(ctx
);
8138 FLUSH_VERTICES(ctx
, 0);
8139 CALL_EdgeFlagPointer(ctx
->Exec
, (stride
, vptr
));
8142 static void GLAPIENTRY
8143 exec_EnableClientState(GLenum cap
)
8145 GET_CURRENT_CONTEXT(ctx
);
8146 FLUSH_VERTICES(ctx
, 0);
8147 CALL_EnableClientState(ctx
->Exec
, (cap
));
8150 static void GLAPIENTRY
8151 exec_GenTextures(GLsizei n
, GLuint
* texName
)
8153 GET_CURRENT_CONTEXT(ctx
);
8154 FLUSH_VERTICES(ctx
, 0);
8155 CALL_GenTextures(ctx
->Exec
, (n
, texName
));
8158 static void GLAPIENTRY
8159 exec_GetPointerv(GLenum pname
, GLvoid
**params
)
8161 GET_CURRENT_CONTEXT(ctx
);
8162 FLUSH_VERTICES(ctx
, 0);
8163 CALL_GetPointerv(ctx
->Exec
, (pname
, params
));
8166 static void GLAPIENTRY
8167 exec_IndexPointer(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
8169 GET_CURRENT_CONTEXT(ctx
);
8170 FLUSH_VERTICES(ctx
, 0);
8171 CALL_IndexPointer(ctx
->Exec
, (type
, stride
, ptr
));
8174 static void GLAPIENTRY
8175 exec_InterleavedArrays(GLenum format
, GLsizei stride
, const GLvoid
* pointer
)
8177 GET_CURRENT_CONTEXT(ctx
);
8178 FLUSH_VERTICES(ctx
, 0);
8179 CALL_InterleavedArrays(ctx
->Exec
, (format
, stride
, pointer
));
8182 static GLboolean GLAPIENTRY
8183 exec_IsTexture(GLuint texture
)
8185 GET_CURRENT_CONTEXT(ctx
);
8186 FLUSH_VERTICES(ctx
, 0);
8187 return CALL_IsTexture(ctx
->Exec
, (texture
));
8190 static void GLAPIENTRY
8191 exec_NormalPointer(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
8193 GET_CURRENT_CONTEXT(ctx
);
8194 FLUSH_VERTICES(ctx
, 0);
8195 CALL_NormalPointer(ctx
->Exec
, (type
, stride
, ptr
));
8198 static void GLAPIENTRY
8199 exec_PopClientAttrib(void)
8201 GET_CURRENT_CONTEXT(ctx
);
8202 FLUSH_VERTICES(ctx
, 0);
8203 CALL_PopClientAttrib(ctx
->Exec
, ());
8206 static void GLAPIENTRY
8207 exec_PushClientAttrib(GLbitfield mask
)
8209 GET_CURRENT_CONTEXT(ctx
);
8210 FLUSH_VERTICES(ctx
, 0);
8211 CALL_PushClientAttrib(ctx
->Exec
, (mask
));
8214 static void GLAPIENTRY
8215 exec_TexCoordPointer(GLint size
, GLenum type
, GLsizei stride
,
8218 GET_CURRENT_CONTEXT(ctx
);
8219 FLUSH_VERTICES(ctx
, 0);
8220 CALL_TexCoordPointer(ctx
->Exec
, (size
, type
, stride
, ptr
));
8223 static void GLAPIENTRY
8224 exec_GetCompressedTexImageARB(GLenum target
, GLint level
, GLvoid
* img
)
8226 GET_CURRENT_CONTEXT(ctx
);
8227 FLUSH_VERTICES(ctx
, 0);
8228 CALL_GetCompressedTexImageARB(ctx
->Exec
, (target
, level
, img
));
8231 static void GLAPIENTRY
8232 exec_VertexPointer(GLint size
, GLenum type
, GLsizei stride
,
8235 GET_CURRENT_CONTEXT(ctx
);
8236 FLUSH_VERTICES(ctx
, 0);
8237 CALL_VertexPointer(ctx
->Exec
, (size
, type
, stride
, ptr
));
8240 static void GLAPIENTRY
8241 exec_CopyConvolutionFilter1D(GLenum target
, GLenum internalFormat
,
8242 GLint x
, GLint y
, GLsizei width
)
8244 GET_CURRENT_CONTEXT(ctx
);
8245 FLUSH_VERTICES(ctx
, 0);
8246 CALL_CopyConvolutionFilter1D(ctx
->Exec
,
8247 (target
, internalFormat
, x
, y
, width
));
8250 static void GLAPIENTRY
8251 exec_CopyConvolutionFilter2D(GLenum target
, GLenum internalFormat
,
8252 GLint x
, GLint y
, GLsizei width
, GLsizei height
)
8254 GET_CURRENT_CONTEXT(ctx
);
8255 FLUSH_VERTICES(ctx
, 0);
8256 CALL_CopyConvolutionFilter2D(ctx
->Exec
,
8257 (target
, internalFormat
, x
, y
, width
,
8261 static void GLAPIENTRY
8262 exec_GetColorTable(GLenum target
, GLenum format
, GLenum type
, GLvoid
* data
)
8264 GET_CURRENT_CONTEXT(ctx
);
8265 FLUSH_VERTICES(ctx
, 0);
8266 CALL_GetColorTable(ctx
->Exec
, (target
, format
, type
, data
));
8269 static void GLAPIENTRY
8270 exec_GetColorTableParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
8272 GET_CURRENT_CONTEXT(ctx
);
8273 FLUSH_VERTICES(ctx
, 0);
8274 CALL_GetColorTableParameterfv(ctx
->Exec
, (target
, pname
, params
));
8277 static void GLAPIENTRY
8278 exec_GetColorTableParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
8280 GET_CURRENT_CONTEXT(ctx
);
8281 FLUSH_VERTICES(ctx
, 0);
8282 CALL_GetColorTableParameteriv(ctx
->Exec
, (target
, pname
, params
));
8285 static void GLAPIENTRY
8286 exec_GetConvolutionFilter(GLenum target
, GLenum format
, GLenum type
,
8289 GET_CURRENT_CONTEXT(ctx
);
8290 FLUSH_VERTICES(ctx
, 0);
8291 CALL_GetConvolutionFilter(ctx
->Exec
, (target
, format
, type
, image
));
8294 static void GLAPIENTRY
8295 exec_GetConvolutionParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
8297 GET_CURRENT_CONTEXT(ctx
);
8298 FLUSH_VERTICES(ctx
, 0);
8299 CALL_GetConvolutionParameterfv(ctx
->Exec
, (target
, pname
, params
));
8302 static void GLAPIENTRY
8303 exec_GetConvolutionParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
8305 GET_CURRENT_CONTEXT(ctx
);
8306 FLUSH_VERTICES(ctx
, 0);
8307 CALL_GetConvolutionParameteriv(ctx
->Exec
, (target
, pname
, params
));
8310 static void GLAPIENTRY
8311 exec_GetHistogram(GLenum target
, GLboolean reset
, GLenum format
,
8312 GLenum type
, GLvoid
*values
)
8314 GET_CURRENT_CONTEXT(ctx
);
8315 FLUSH_VERTICES(ctx
, 0);
8316 CALL_GetHistogram(ctx
->Exec
, (target
, reset
, format
, type
, values
));
8319 static void GLAPIENTRY
8320 exec_GetHistogramParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
8322 GET_CURRENT_CONTEXT(ctx
);
8323 FLUSH_VERTICES(ctx
, 0);
8324 CALL_GetHistogramParameterfv(ctx
->Exec
, (target
, pname
, params
));
8327 static void GLAPIENTRY
8328 exec_GetHistogramParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
8330 GET_CURRENT_CONTEXT(ctx
);
8331 FLUSH_VERTICES(ctx
, 0);
8332 CALL_GetHistogramParameteriv(ctx
->Exec
, (target
, pname
, params
));
8335 static void GLAPIENTRY
8336 exec_GetMinmax(GLenum target
, GLboolean reset
, GLenum format
,
8337 GLenum type
, GLvoid
*values
)
8339 GET_CURRENT_CONTEXT(ctx
);
8340 FLUSH_VERTICES(ctx
, 0);
8341 CALL_GetMinmax(ctx
->Exec
, (target
, reset
, format
, type
, values
));
8344 static void GLAPIENTRY
8345 exec_GetMinmaxParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
8347 GET_CURRENT_CONTEXT(ctx
);
8348 FLUSH_VERTICES(ctx
, 0);
8349 CALL_GetMinmaxParameterfv(ctx
->Exec
, (target
, pname
, params
));
8352 static void GLAPIENTRY
8353 exec_GetMinmaxParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
8355 GET_CURRENT_CONTEXT(ctx
);
8356 FLUSH_VERTICES(ctx
, 0);
8357 CALL_GetMinmaxParameteriv(ctx
->Exec
, (target
, pname
, params
));
8360 static void GLAPIENTRY
8361 exec_GetSeparableFilter(GLenum target
, GLenum format
, GLenum type
,
8362 GLvoid
*row
, GLvoid
*column
, GLvoid
*span
)
8364 GET_CURRENT_CONTEXT(ctx
);
8365 FLUSH_VERTICES(ctx
, 0);
8366 CALL_GetSeparableFilter(ctx
->Exec
,
8367 (target
, format
, type
, row
, column
, span
));
8370 static void GLAPIENTRY
8371 exec_SeparableFilter2D(GLenum target
, GLenum internalFormat
,
8372 GLsizei width
, GLsizei height
, GLenum format
,
8373 GLenum type
, const GLvoid
*row
, const GLvoid
*column
)
8375 GET_CURRENT_CONTEXT(ctx
);
8376 FLUSH_VERTICES(ctx
, 0);
8377 CALL_SeparableFilter2D(ctx
->Exec
,
8378 (target
, internalFormat
, width
, height
, format
,
8379 type
, row
, column
));
8382 static void GLAPIENTRY
8383 exec_ColorPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
8384 GLsizei count
, const GLvoid
*ptr
)
8386 GET_CURRENT_CONTEXT(ctx
);
8387 FLUSH_VERTICES(ctx
, 0);
8388 CALL_ColorPointerEXT(ctx
->Exec
, (size
, type
, stride
, count
, ptr
));
8391 static void GLAPIENTRY
8392 exec_EdgeFlagPointerEXT(GLsizei stride
, GLsizei count
, const GLboolean
*ptr
)
8394 GET_CURRENT_CONTEXT(ctx
);
8395 FLUSH_VERTICES(ctx
, 0);
8396 CALL_EdgeFlagPointerEXT(ctx
->Exec
, (stride
, count
, ptr
));
8399 static void GLAPIENTRY
8400 exec_IndexPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
,
8403 GET_CURRENT_CONTEXT(ctx
);
8404 FLUSH_VERTICES(ctx
, 0);
8405 CALL_IndexPointerEXT(ctx
->Exec
, (type
, stride
, count
, ptr
));
8408 static void GLAPIENTRY
8409 exec_NormalPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
,
8412 GET_CURRENT_CONTEXT(ctx
);
8413 FLUSH_VERTICES(ctx
, 0);
8414 CALL_NormalPointerEXT(ctx
->Exec
, (type
, stride
, count
, ptr
));
8417 static void GLAPIENTRY
8418 exec_TexCoordPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
8419 GLsizei count
, const GLvoid
*ptr
)
8421 GET_CURRENT_CONTEXT(ctx
);
8422 FLUSH_VERTICES(ctx
, 0);
8423 CALL_TexCoordPointerEXT(ctx
->Exec
, (size
, type
, stride
, count
, ptr
));
8426 static void GLAPIENTRY
8427 exec_VertexPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
8428 GLsizei count
, const GLvoid
*ptr
)
8430 GET_CURRENT_CONTEXT(ctx
);
8431 FLUSH_VERTICES(ctx
, 0);
8432 CALL_VertexPointerEXT(ctx
->Exec
, (size
, type
, stride
, count
, ptr
));
8435 static void GLAPIENTRY
8436 exec_LockArraysEXT(GLint first
, GLsizei count
)
8438 GET_CURRENT_CONTEXT(ctx
);
8439 FLUSH_VERTICES(ctx
, 0);
8440 CALL_LockArraysEXT(ctx
->Exec
, (first
, count
));
8443 static void GLAPIENTRY
8444 exec_UnlockArraysEXT(void)
8446 GET_CURRENT_CONTEXT(ctx
);
8447 FLUSH_VERTICES(ctx
, 0);
8448 CALL_UnlockArraysEXT(ctx
->Exec
, ());
8451 static void GLAPIENTRY
8452 exec_ClientActiveTextureARB(GLenum target
)
8454 GET_CURRENT_CONTEXT(ctx
);
8455 FLUSH_VERTICES(ctx
, 0);
8456 CALL_ClientActiveTextureARB(ctx
->Exec
, (target
));
8459 static void GLAPIENTRY
8460 exec_SecondaryColorPointerEXT(GLint size
, GLenum type
,
8461 GLsizei stride
, const GLvoid
*ptr
)
8463 GET_CURRENT_CONTEXT(ctx
);
8464 FLUSH_VERTICES(ctx
, 0);
8465 CALL_SecondaryColorPointerEXT(ctx
->Exec
, (size
, type
, stride
, ptr
));
8468 static void GLAPIENTRY
8469 exec_FogCoordPointerEXT(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
8471 GET_CURRENT_CONTEXT(ctx
);
8472 FLUSH_VERTICES(ctx
, 0);
8473 CALL_FogCoordPointerEXT(ctx
->Exec
, (type
, stride
, ptr
));
8476 /* GL_EXT_multi_draw_arrays */
8477 static void GLAPIENTRY
8478 exec_MultiDrawArraysEXT(GLenum mode
, GLint
* first
,
8479 GLsizei
* count
, GLsizei primcount
)
8481 GET_CURRENT_CONTEXT(ctx
);
8482 FLUSH_VERTICES(ctx
, 0);
8483 CALL_MultiDrawArraysEXT(ctx
->Exec
, (mode
, first
, count
, primcount
));
8486 /* GL_IBM_multimode_draw_arrays */
8487 static void GLAPIENTRY
8488 exec_MultiModeDrawArraysIBM(const GLenum
* mode
, const GLint
* first
,
8489 const GLsizei
* count
, GLsizei primcount
,
8492 GET_CURRENT_CONTEXT(ctx
);
8493 FLUSH_VERTICES(ctx
, 0);
8494 CALL_MultiModeDrawArraysIBM(ctx
->Exec
,
8495 (mode
, first
, count
, primcount
, modestride
));
8498 /* GL_IBM_multimode_draw_arrays */
8499 static void GLAPIENTRY
8500 exec_MultiModeDrawElementsIBM(const GLenum
* mode
,
8501 const GLsizei
* count
,
8503 const GLvoid
* const *indices
,
8504 GLsizei primcount
, GLint modestride
)
8506 GET_CURRENT_CONTEXT(ctx
);
8507 FLUSH_VERTICES(ctx
, 0);
8508 CALL_MultiModeDrawElementsIBM(ctx
->Exec
,
8509 (mode
, count
, type
, indices
, primcount
,
8516 * Setup the given dispatch table to point to Mesa's display list
8517 * building functions.
8519 * This does not include any of the tnl functions - they are
8520 * initialized from _mesa_init_api_defaults and from the active vtxfmt
8524 _mesa_init_save_table(struct _glapi_table
*table
)
8526 _mesa_loopback_init_api_table(table
);
8529 SET_Accum(table
, save_Accum
);
8530 SET_AlphaFunc(table
, save_AlphaFunc
);
8531 SET_Bitmap(table
, save_Bitmap
);
8532 SET_BlendFunc(table
, save_BlendFunc
);
8533 SET_CallList(table
, save_CallList
);
8534 SET_CallLists(table
, save_CallLists
);
8535 SET_Clear(table
, save_Clear
);
8536 SET_ClearAccum(table
, save_ClearAccum
);
8537 SET_ClearColor(table
, save_ClearColor
);
8538 SET_ClearDepth(table
, save_ClearDepth
);
8539 SET_ClearIndex(table
, save_ClearIndex
);
8540 SET_ClearStencil(table
, save_ClearStencil
);
8541 SET_ClipPlane(table
, save_ClipPlane
);
8542 SET_ColorMask(table
, save_ColorMask
);
8543 SET_ColorMaterial(table
, save_ColorMaterial
);
8544 SET_CopyPixels(table
, save_CopyPixels
);
8545 SET_CullFace(table
, save_CullFace
);
8546 SET_DeleteLists(table
, _mesa_DeleteLists
);
8547 SET_DepthFunc(table
, save_DepthFunc
);
8548 SET_DepthMask(table
, save_DepthMask
);
8549 SET_DepthRange(table
, save_DepthRange
);
8550 SET_Disable(table
, save_Disable
);
8551 SET_DrawBuffer(table
, save_DrawBuffer
);
8552 SET_DrawPixels(table
, save_DrawPixels
);
8553 SET_Enable(table
, save_Enable
);
8554 SET_EndList(table
, _mesa_EndList
);
8555 SET_EvalMesh1(table
, save_EvalMesh1
);
8556 SET_EvalMesh2(table
, save_EvalMesh2
);
8557 SET_Finish(table
, exec_Finish
);
8558 SET_Flush(table
, exec_Flush
);
8559 SET_Fogf(table
, save_Fogf
);
8560 SET_Fogfv(table
, save_Fogfv
);
8561 SET_Fogi(table
, save_Fogi
);
8562 SET_Fogiv(table
, save_Fogiv
);
8563 SET_FrontFace(table
, save_FrontFace
);
8564 SET_Frustum(table
, save_Frustum
);
8565 SET_GenLists(table
, _mesa_GenLists
);
8566 SET_GetBooleanv(table
, exec_GetBooleanv
);
8567 SET_GetClipPlane(table
, exec_GetClipPlane
);
8568 SET_GetDoublev(table
, exec_GetDoublev
);
8569 SET_GetError(table
, exec_GetError
);
8570 SET_GetFloatv(table
, exec_GetFloatv
);
8571 SET_GetIntegerv(table
, exec_GetIntegerv
);
8572 SET_GetLightfv(table
, exec_GetLightfv
);
8573 SET_GetLightiv(table
, exec_GetLightiv
);
8574 SET_GetMapdv(table
, exec_GetMapdv
);
8575 SET_GetMapfv(table
, exec_GetMapfv
);
8576 SET_GetMapiv(table
, exec_GetMapiv
);
8577 SET_GetMaterialfv(table
, exec_GetMaterialfv
);
8578 SET_GetMaterialiv(table
, exec_GetMaterialiv
);
8579 SET_GetPixelMapfv(table
, exec_GetPixelMapfv
);
8580 SET_GetPixelMapuiv(table
, exec_GetPixelMapuiv
);
8581 SET_GetPixelMapusv(table
, exec_GetPixelMapusv
);
8582 SET_GetPolygonStipple(table
, exec_GetPolygonStipple
);
8583 SET_GetString(table
, exec_GetString
);
8584 SET_GetTexEnvfv(table
, exec_GetTexEnvfv
);
8585 SET_GetTexEnviv(table
, exec_GetTexEnviv
);
8586 SET_GetTexGendv(table
, exec_GetTexGendv
);
8587 SET_GetTexGenfv(table
, exec_GetTexGenfv
);
8588 SET_GetTexGeniv(table
, exec_GetTexGeniv
);
8589 SET_GetTexImage(table
, exec_GetTexImage
);
8590 SET_GetTexLevelParameterfv(table
, exec_GetTexLevelParameterfv
);
8591 SET_GetTexLevelParameteriv(table
, exec_GetTexLevelParameteriv
);
8592 SET_GetTexParameterfv(table
, exec_GetTexParameterfv
);
8593 SET_GetTexParameteriv(table
, exec_GetTexParameteriv
);
8594 SET_Hint(table
, save_Hint
);
8595 SET_IndexMask(table
, save_IndexMask
);
8596 SET_InitNames(table
, save_InitNames
);
8597 SET_IsEnabled(table
, exec_IsEnabled
);
8598 SET_IsList(table
, _mesa_IsList
);
8599 SET_LightModelf(table
, save_LightModelf
);
8600 SET_LightModelfv(table
, save_LightModelfv
);
8601 SET_LightModeli(table
, save_LightModeli
);
8602 SET_LightModeliv(table
, save_LightModeliv
);
8603 SET_Lightf(table
, save_Lightf
);
8604 SET_Lightfv(table
, save_Lightfv
);
8605 SET_Lighti(table
, save_Lighti
);
8606 SET_Lightiv(table
, save_Lightiv
);
8607 SET_LineStipple(table
, save_LineStipple
);
8608 SET_LineWidth(table
, save_LineWidth
);
8609 SET_ListBase(table
, save_ListBase
);
8610 SET_LoadIdentity(table
, save_LoadIdentity
);
8611 SET_LoadMatrixd(table
, save_LoadMatrixd
);
8612 SET_LoadMatrixf(table
, save_LoadMatrixf
);
8613 SET_LoadName(table
, save_LoadName
);
8614 SET_LogicOp(table
, save_LogicOp
);
8615 SET_Map1d(table
, save_Map1d
);
8616 SET_Map1f(table
, save_Map1f
);
8617 SET_Map2d(table
, save_Map2d
);
8618 SET_Map2f(table
, save_Map2f
);
8619 SET_MapGrid1d(table
, save_MapGrid1d
);
8620 SET_MapGrid1f(table
, save_MapGrid1f
);
8621 SET_MapGrid2d(table
, save_MapGrid2d
);
8622 SET_MapGrid2f(table
, save_MapGrid2f
);
8623 SET_MatrixMode(table
, save_MatrixMode
);
8624 SET_MultMatrixd(table
, save_MultMatrixd
);
8625 SET_MultMatrixf(table
, save_MultMatrixf
);
8626 SET_NewList(table
, save_NewList
);
8627 SET_Ortho(table
, save_Ortho
);
8628 SET_PassThrough(table
, save_PassThrough
);
8629 SET_PixelMapfv(table
, save_PixelMapfv
);
8630 SET_PixelMapuiv(table
, save_PixelMapuiv
);
8631 SET_PixelMapusv(table
, save_PixelMapusv
);
8632 SET_PixelStoref(table
, exec_PixelStoref
);
8633 SET_PixelStorei(table
, exec_PixelStorei
);
8634 SET_PixelTransferf(table
, save_PixelTransferf
);
8635 SET_PixelTransferi(table
, save_PixelTransferi
);
8636 SET_PixelZoom(table
, save_PixelZoom
);
8637 SET_PointSize(table
, save_PointSize
);
8638 SET_PolygonMode(table
, save_PolygonMode
);
8639 SET_PolygonOffset(table
, save_PolygonOffset
);
8640 SET_PolygonStipple(table
, save_PolygonStipple
);
8641 SET_PopAttrib(table
, save_PopAttrib
);
8642 SET_PopMatrix(table
, save_PopMatrix
);
8643 SET_PopName(table
, save_PopName
);
8644 SET_PushAttrib(table
, save_PushAttrib
);
8645 SET_PushMatrix(table
, save_PushMatrix
);
8646 SET_PushName(table
, save_PushName
);
8647 SET_RasterPos2d(table
, save_RasterPos2d
);
8648 SET_RasterPos2dv(table
, save_RasterPos2dv
);
8649 SET_RasterPos2f(table
, save_RasterPos2f
);
8650 SET_RasterPos2fv(table
, save_RasterPos2fv
);
8651 SET_RasterPos2i(table
, save_RasterPos2i
);
8652 SET_RasterPos2iv(table
, save_RasterPos2iv
);
8653 SET_RasterPos2s(table
, save_RasterPos2s
);
8654 SET_RasterPos2sv(table
, save_RasterPos2sv
);
8655 SET_RasterPos3d(table
, save_RasterPos3d
);
8656 SET_RasterPos3dv(table
, save_RasterPos3dv
);
8657 SET_RasterPos3f(table
, save_RasterPos3f
);
8658 SET_RasterPos3fv(table
, save_RasterPos3fv
);
8659 SET_RasterPos3i(table
, save_RasterPos3i
);
8660 SET_RasterPos3iv(table
, save_RasterPos3iv
);
8661 SET_RasterPos3s(table
, save_RasterPos3s
);
8662 SET_RasterPos3sv(table
, save_RasterPos3sv
);
8663 SET_RasterPos4d(table
, save_RasterPos4d
);
8664 SET_RasterPos4dv(table
, save_RasterPos4dv
);
8665 SET_RasterPos4f(table
, save_RasterPos4f
);
8666 SET_RasterPos4fv(table
, save_RasterPos4fv
);
8667 SET_RasterPos4i(table
, save_RasterPos4i
);
8668 SET_RasterPos4iv(table
, save_RasterPos4iv
);
8669 SET_RasterPos4s(table
, save_RasterPos4s
);
8670 SET_RasterPos4sv(table
, save_RasterPos4sv
);
8671 SET_ReadBuffer(table
, save_ReadBuffer
);
8672 SET_ReadPixels(table
, exec_ReadPixels
);
8673 SET_RenderMode(table
, exec_RenderMode
);
8674 SET_Rotated(table
, save_Rotated
);
8675 SET_Rotatef(table
, save_Rotatef
);
8676 SET_Scaled(table
, save_Scaled
);
8677 SET_Scalef(table
, save_Scalef
);
8678 SET_Scissor(table
, save_Scissor
);
8679 SET_FeedbackBuffer(table
, exec_FeedbackBuffer
);
8680 SET_SelectBuffer(table
, exec_SelectBuffer
);
8681 SET_ShadeModel(table
, save_ShadeModel
);
8682 SET_StencilFunc(table
, save_StencilFunc
);
8683 SET_StencilMask(table
, save_StencilMask
);
8684 SET_StencilOp(table
, save_StencilOp
);
8685 SET_TexEnvf(table
, save_TexEnvf
);
8686 SET_TexEnvfv(table
, save_TexEnvfv
);
8687 SET_TexEnvi(table
, save_TexEnvi
);
8688 SET_TexEnviv(table
, save_TexEnviv
);
8689 SET_TexGend(table
, save_TexGend
);
8690 SET_TexGendv(table
, save_TexGendv
);
8691 SET_TexGenf(table
, save_TexGenf
);
8692 SET_TexGenfv(table
, save_TexGenfv
);
8693 SET_TexGeni(table
, save_TexGeni
);
8694 SET_TexGeniv(table
, save_TexGeniv
);
8695 SET_TexImage1D(table
, save_TexImage1D
);
8696 SET_TexImage2D(table
, save_TexImage2D
);
8697 SET_TexParameterf(table
, save_TexParameterf
);
8698 SET_TexParameterfv(table
, save_TexParameterfv
);
8699 SET_TexParameteri(table
, save_TexParameteri
);
8700 SET_TexParameteriv(table
, save_TexParameteriv
);
8701 SET_Translated(table
, save_Translated
);
8702 SET_Translatef(table
, save_Translatef
);
8703 SET_Viewport(table
, save_Viewport
);
8706 SET_AreTexturesResident(table
, exec_AreTexturesResident
);
8707 SET_BindTexture(table
, save_BindTexture
);
8708 SET_ColorPointer(table
, exec_ColorPointer
);
8709 SET_CopyTexImage1D(table
, save_CopyTexImage1D
);
8710 SET_CopyTexImage2D(table
, save_CopyTexImage2D
);
8711 SET_CopyTexSubImage1D(table
, save_CopyTexSubImage1D
);
8712 SET_CopyTexSubImage2D(table
, save_CopyTexSubImage2D
);
8713 SET_DeleteTextures(table
, exec_DeleteTextures
);
8714 SET_DisableClientState(table
, exec_DisableClientState
);
8715 SET_EdgeFlagPointer(table
, exec_EdgeFlagPointer
);
8716 SET_EnableClientState(table
, exec_EnableClientState
);
8717 SET_GenTextures(table
, exec_GenTextures
);
8718 SET_GetPointerv(table
, exec_GetPointerv
);
8719 SET_IndexPointer(table
, exec_IndexPointer
);
8720 SET_InterleavedArrays(table
, exec_InterleavedArrays
);
8721 SET_IsTexture(table
, exec_IsTexture
);
8722 SET_NormalPointer(table
, exec_NormalPointer
);
8723 SET_PopClientAttrib(table
, exec_PopClientAttrib
);
8724 SET_PrioritizeTextures(table
, save_PrioritizeTextures
);
8725 SET_PushClientAttrib(table
, exec_PushClientAttrib
);
8726 SET_TexCoordPointer(table
, exec_TexCoordPointer
);
8727 SET_TexSubImage1D(table
, save_TexSubImage1D
);
8728 SET_TexSubImage2D(table
, save_TexSubImage2D
);
8729 SET_VertexPointer(table
, exec_VertexPointer
);
8732 SET_CopyTexSubImage3D(table
, save_CopyTexSubImage3D
);
8733 SET_TexImage3D(table
, save_TexImage3D
);
8734 SET_TexSubImage3D(table
, save_TexSubImage3D
);
8737 SET_StencilFuncSeparate(table
, save_StencilFuncSeparate
);
8738 SET_StencilMaskSeparate(table
, save_StencilMaskSeparate
);
8739 SET_StencilOpSeparate(table
, save_StencilOpSeparate
);
8741 /* ATI_separate_stencil */
8742 SET_StencilFuncSeparateATI(table
, save_StencilFuncSeparateATI
);
8744 /* GL_ARB_imaging */
8745 /* Not all are supported */
8746 SET_BlendColor(table
, save_BlendColor
);
8747 SET_BlendEquation(table
, save_BlendEquation
);
8748 SET_ColorSubTable(table
, save_ColorSubTable
);
8749 SET_ColorTable(table
, save_ColorTable
);
8750 SET_ColorTableParameterfv(table
, save_ColorTableParameterfv
);
8751 SET_ColorTableParameteriv(table
, save_ColorTableParameteriv
);
8752 SET_ConvolutionFilter1D(table
, save_ConvolutionFilter1D
);
8753 SET_ConvolutionFilter2D(table
, save_ConvolutionFilter2D
);
8754 SET_ConvolutionParameterf(table
, save_ConvolutionParameterf
);
8755 SET_ConvolutionParameterfv(table
, save_ConvolutionParameterfv
);
8756 SET_ConvolutionParameteri(table
, save_ConvolutionParameteri
);
8757 SET_ConvolutionParameteriv(table
, save_ConvolutionParameteriv
);
8758 SET_CopyColorSubTable(table
, save_CopyColorSubTable
);
8759 SET_CopyColorTable(table
, save_CopyColorTable
);
8760 SET_CopyConvolutionFilter1D(table
, exec_CopyConvolutionFilter1D
);
8761 SET_CopyConvolutionFilter2D(table
, exec_CopyConvolutionFilter2D
);
8762 SET_GetColorTable(table
, exec_GetColorTable
);
8763 SET_GetColorTableParameterfv(table
, exec_GetColorTableParameterfv
);
8764 SET_GetColorTableParameteriv(table
, exec_GetColorTableParameteriv
);
8765 SET_GetConvolutionFilter(table
, exec_GetConvolutionFilter
);
8766 SET_GetConvolutionParameterfv(table
, exec_GetConvolutionParameterfv
);
8767 SET_GetConvolutionParameteriv(table
, exec_GetConvolutionParameteriv
);
8768 SET_GetHistogram(table
, exec_GetHistogram
);
8769 SET_GetHistogramParameterfv(table
, exec_GetHistogramParameterfv
);
8770 SET_GetHistogramParameteriv(table
, exec_GetHistogramParameteriv
);
8771 SET_GetMinmax(table
, exec_GetMinmax
);
8772 SET_GetMinmaxParameterfv(table
, exec_GetMinmaxParameterfv
);
8773 SET_GetMinmaxParameteriv(table
, exec_GetMinmaxParameteriv
);
8774 SET_GetSeparableFilter(table
, exec_GetSeparableFilter
);
8775 SET_Histogram(table
, save_Histogram
);
8776 SET_Minmax(table
, save_Minmax
);
8777 SET_ResetHistogram(table
, save_ResetHistogram
);
8778 SET_ResetMinmax(table
, save_ResetMinmax
);
8779 SET_SeparableFilter2D(table
, exec_SeparableFilter2D
);
8781 /* 2. GL_EXT_blend_color */
8783 SET_BlendColorEXT(table
, save_BlendColorEXT
);
8786 /* 3. GL_EXT_polygon_offset */
8787 SET_PolygonOffsetEXT(table
, save_PolygonOffsetEXT
);
8789 /* 6. GL_EXT_texture3d */
8791 SET_CopyTexSubImage3DEXT(table
, save_CopyTexSubImage3D
);
8792 SET_TexImage3DEXT(table
, save_TexImage3DEXT
);
8793 SET_TexSubImage3DEXT(table
, save_TexSubImage3D
);
8796 /* 14. GL_SGI_color_table */
8798 SET_ColorTableSGI(table
, save_ColorTable
);
8799 SET_ColorSubTableSGI(table
, save_ColorSubTable
);
8800 SET_GetColorTableSGI(table
, exec_GetColorTable
);
8801 SET_GetColorTableParameterfvSGI(table
, exec_GetColorTableParameterfv
);
8802 SET_GetColorTableParameterivSGI(table
, exec_GetColorTableParameteriv
);
8805 /* 30. GL_EXT_vertex_array */
8806 SET_ColorPointerEXT(table
, exec_ColorPointerEXT
);
8807 SET_EdgeFlagPointerEXT(table
, exec_EdgeFlagPointerEXT
);
8808 SET_IndexPointerEXT(table
, exec_IndexPointerEXT
);
8809 SET_NormalPointerEXT(table
, exec_NormalPointerEXT
);
8810 SET_TexCoordPointerEXT(table
, exec_TexCoordPointerEXT
);
8811 SET_VertexPointerEXT(table
, exec_VertexPointerEXT
);
8813 /* 37. GL_EXT_blend_minmax */
8815 SET_BlendEquationEXT(table
, save_BlendEquationEXT
);
8818 /* 54. GL_EXT_point_parameters */
8819 SET_PointParameterfEXT(table
, save_PointParameterfEXT
);
8820 SET_PointParameterfvEXT(table
, save_PointParameterfvEXT
);
8822 /* 97. GL_EXT_compiled_vertex_array */
8823 SET_LockArraysEXT(table
, exec_LockArraysEXT
);
8824 SET_UnlockArraysEXT(table
, exec_UnlockArraysEXT
);
8826 /* 145. GL_EXT_secondary_color */
8827 SET_SecondaryColorPointerEXT(table
, exec_SecondaryColorPointerEXT
);
8829 /* 148. GL_EXT_multi_draw_arrays */
8830 SET_MultiDrawArraysEXT(table
, exec_MultiDrawArraysEXT
);
8832 /* 149. GL_EXT_fog_coord */
8833 SET_FogCoordPointerEXT(table
, exec_FogCoordPointerEXT
);
8835 /* 173. GL_EXT_blend_func_separate */
8836 SET_BlendFuncSeparateEXT(table
, save_BlendFuncSeparateEXT
);
8838 /* 196. GL_MESA_resize_buffers */
8839 SET_ResizeBuffersMESA(table
, _mesa_ResizeBuffersMESA
);
8841 /* 197. GL_MESA_window_pos */
8842 SET_WindowPos2dMESA(table
, save_WindowPos2dMESA
);
8843 SET_WindowPos2dvMESA(table
, save_WindowPos2dvMESA
);
8844 SET_WindowPos2fMESA(table
, save_WindowPos2fMESA
);
8845 SET_WindowPos2fvMESA(table
, save_WindowPos2fvMESA
);
8846 SET_WindowPos2iMESA(table
, save_WindowPos2iMESA
);
8847 SET_WindowPos2ivMESA(table
, save_WindowPos2ivMESA
);
8848 SET_WindowPos2sMESA(table
, save_WindowPos2sMESA
);
8849 SET_WindowPos2svMESA(table
, save_WindowPos2svMESA
);
8850 SET_WindowPos3dMESA(table
, save_WindowPos3dMESA
);
8851 SET_WindowPos3dvMESA(table
, save_WindowPos3dvMESA
);
8852 SET_WindowPos3fMESA(table
, save_WindowPos3fMESA
);
8853 SET_WindowPos3fvMESA(table
, save_WindowPos3fvMESA
);
8854 SET_WindowPos3iMESA(table
, save_WindowPos3iMESA
);
8855 SET_WindowPos3ivMESA(table
, save_WindowPos3ivMESA
);
8856 SET_WindowPos3sMESA(table
, save_WindowPos3sMESA
);
8857 SET_WindowPos3svMESA(table
, save_WindowPos3svMESA
);
8858 SET_WindowPos4dMESA(table
, save_WindowPos4dMESA
);
8859 SET_WindowPos4dvMESA(table
, save_WindowPos4dvMESA
);
8860 SET_WindowPos4fMESA(table
, save_WindowPos4fMESA
);
8861 SET_WindowPos4fvMESA(table
, save_WindowPos4fvMESA
);
8862 SET_WindowPos4iMESA(table
, save_WindowPos4iMESA
);
8863 SET_WindowPos4ivMESA(table
, save_WindowPos4ivMESA
);
8864 SET_WindowPos4sMESA(table
, save_WindowPos4sMESA
);
8865 SET_WindowPos4svMESA(table
, save_WindowPos4svMESA
);
8867 /* 200. GL_IBM_multimode_draw_arrays */
8868 SET_MultiModeDrawArraysIBM(table
, exec_MultiModeDrawArraysIBM
);
8869 SET_MultiModeDrawElementsIBM(table
, exec_MultiModeDrawElementsIBM
);
8871 #if FEATURE_NV_vertex_program
8872 /* 233. GL_NV_vertex_program */
8873 /* The following commands DO NOT go into display lists:
8874 * AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV,
8875 * VertexAttribPointerNV, GetProgram*, GetVertexAttrib*
8877 SET_BindProgramNV(table
, save_BindProgramNV
);
8878 SET_DeleteProgramsNV(table
, _mesa_DeletePrograms
);
8879 SET_ExecuteProgramNV(table
, save_ExecuteProgramNV
);
8880 SET_GenProgramsNV(table
, _mesa_GenPrograms
);
8881 SET_AreProgramsResidentNV(table
, _mesa_AreProgramsResidentNV
);
8882 SET_RequestResidentProgramsNV(table
, save_RequestResidentProgramsNV
);
8883 SET_GetProgramParameterfvNV(table
, _mesa_GetProgramParameterfvNV
);
8884 SET_GetProgramParameterdvNV(table
, _mesa_GetProgramParameterdvNV
);
8885 SET_GetProgramivNV(table
, _mesa_GetProgramivNV
);
8886 SET_GetProgramStringNV(table
, _mesa_GetProgramStringNV
);
8887 SET_GetTrackMatrixivNV(table
, _mesa_GetTrackMatrixivNV
);
8888 SET_GetVertexAttribdvNV(table
, _mesa_GetVertexAttribdvNV
);
8889 SET_GetVertexAttribfvNV(table
, _mesa_GetVertexAttribfvNV
);
8890 SET_GetVertexAttribivNV(table
, _mesa_GetVertexAttribivNV
);
8891 SET_GetVertexAttribPointervNV(table
, _mesa_GetVertexAttribPointervNV
);
8892 SET_IsProgramNV(table
, _mesa_IsProgramARB
);
8893 SET_LoadProgramNV(table
, save_LoadProgramNV
);
8894 SET_ProgramEnvParameter4dARB(table
, save_ProgramEnvParameter4dARB
);
8895 SET_ProgramEnvParameter4dvARB(table
, save_ProgramEnvParameter4dvARB
);
8896 SET_ProgramEnvParameter4fARB(table
, save_ProgramEnvParameter4fARB
);
8897 SET_ProgramEnvParameter4fvARB(table
, save_ProgramEnvParameter4fvARB
);
8898 SET_ProgramParameters4dvNV(table
, save_ProgramParameters4dvNV
);
8899 SET_ProgramParameters4fvNV(table
, save_ProgramParameters4fvNV
);
8900 SET_TrackMatrixNV(table
, save_TrackMatrixNV
);
8901 SET_VertexAttribPointerNV(table
, _mesa_VertexAttribPointerNV
);
8904 /* 244. GL_ATI_envmap_bumpmap */
8905 SET_TexBumpParameterivATI(table
, save_TexBumpParameterivATI
);
8906 SET_TexBumpParameterfvATI(table
, save_TexBumpParameterfvATI
);
8908 /* 245. GL_ATI_fragment_shader */
8909 #if FEATURE_ATI_fragment_shader
8910 SET_BindFragmentShaderATI(table
, save_BindFragmentShaderATI
);
8911 SET_SetFragmentShaderConstantATI(table
, save_SetFragmentShaderConstantATI
);
8914 /* 282. GL_NV_fragment_program */
8915 #if FEATURE_NV_fragment_program
8916 SET_ProgramNamedParameter4fNV(table
, save_ProgramNamedParameter4fNV
);
8917 SET_ProgramNamedParameter4dNV(table
, save_ProgramNamedParameter4dNV
);
8918 SET_ProgramNamedParameter4fvNV(table
, save_ProgramNamedParameter4fvNV
);
8919 SET_ProgramNamedParameter4dvNV(table
, save_ProgramNamedParameter4dvNV
);
8920 SET_GetProgramNamedParameterfvNV(table
,
8921 _mesa_GetProgramNamedParameterfvNV
);
8922 SET_GetProgramNamedParameterdvNV(table
,
8923 _mesa_GetProgramNamedParameterdvNV
);
8924 SET_ProgramLocalParameter4dARB(table
, save_ProgramLocalParameter4dARB
);
8925 SET_ProgramLocalParameter4dvARB(table
, save_ProgramLocalParameter4dvARB
);
8926 SET_ProgramLocalParameter4fARB(table
, save_ProgramLocalParameter4fARB
);
8927 SET_ProgramLocalParameter4fvARB(table
, save_ProgramLocalParameter4fvARB
);
8928 SET_GetProgramLocalParameterdvARB(table
,
8929 _mesa_GetProgramLocalParameterdvARB
);
8930 SET_GetProgramLocalParameterfvARB(table
,
8931 _mesa_GetProgramLocalParameterfvARB
);
8934 /* 262. GL_NV_point_sprite */
8935 SET_PointParameteriNV(table
, save_PointParameteriNV
);
8936 SET_PointParameterivNV(table
, save_PointParameterivNV
);
8938 /* 268. GL_EXT_stencil_two_side */
8939 SET_ActiveStencilFaceEXT(table
, save_ActiveStencilFaceEXT
);
8941 /* 273. GL_APPLE_vertex_array_object */
8942 SET_BindVertexArrayAPPLE(table
, _mesa_BindVertexArrayAPPLE
);
8943 SET_DeleteVertexArraysAPPLE(table
, _mesa_DeleteVertexArraysAPPLE
);
8944 SET_GenVertexArraysAPPLE(table
, _mesa_GenVertexArraysAPPLE
);
8945 SET_IsVertexArrayAPPLE(table
, _mesa_IsVertexArrayAPPLE
);
8947 /* ???. GL_EXT_depth_bounds_test */
8948 SET_DepthBoundsEXT(table
, save_DepthBoundsEXT
);
8950 /* ARB 1. GL_ARB_multitexture */
8951 SET_ActiveTextureARB(table
, save_ActiveTextureARB
);
8952 SET_ClientActiveTextureARB(table
, exec_ClientActiveTextureARB
);
8954 /* ARB 3. GL_ARB_transpose_matrix */
8955 SET_LoadTransposeMatrixdARB(table
, save_LoadTransposeMatrixdARB
);
8956 SET_LoadTransposeMatrixfARB(table
, save_LoadTransposeMatrixfARB
);
8957 SET_MultTransposeMatrixdARB(table
, save_MultTransposeMatrixdARB
);
8958 SET_MultTransposeMatrixfARB(table
, save_MultTransposeMatrixfARB
);
8960 /* ARB 5. GL_ARB_multisample */
8961 SET_SampleCoverageARB(table
, save_SampleCoverageARB
);
8963 /* ARB 12. GL_ARB_texture_compression */
8964 SET_CompressedTexImage3DARB(table
, save_CompressedTexImage3DARB
);
8965 SET_CompressedTexImage2DARB(table
, save_CompressedTexImage2DARB
);
8966 SET_CompressedTexImage1DARB(table
, save_CompressedTexImage1DARB
);
8967 SET_CompressedTexSubImage3DARB(table
, save_CompressedTexSubImage3DARB
);
8968 SET_CompressedTexSubImage2DARB(table
, save_CompressedTexSubImage2DARB
);
8969 SET_CompressedTexSubImage1DARB(table
, save_CompressedTexSubImage1DARB
);
8970 SET_GetCompressedTexImageARB(table
, exec_GetCompressedTexImageARB
);
8972 /* ARB 14. GL_ARB_point_parameters */
8973 /* aliased with EXT_point_parameters functions */
8975 /* ARB 25. GL_ARB_window_pos */
8976 /* aliased with MESA_window_pos functions */
8978 /* ARB 26. GL_ARB_vertex_program */
8979 /* ARB 27. GL_ARB_fragment_program */
8980 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
8981 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
8982 SET_VertexAttribPointerARB(table
, _mesa_VertexAttribPointerARB
);
8983 SET_EnableVertexAttribArrayARB(table
, _mesa_EnableVertexAttribArrayARB
);
8984 SET_DisableVertexAttribArrayARB(table
, _mesa_DisableVertexAttribArrayARB
);
8985 SET_ProgramStringARB(table
, save_ProgramStringARB
);
8986 SET_BindProgramNV(table
, save_BindProgramNV
);
8987 SET_DeleteProgramsNV(table
, _mesa_DeletePrograms
);
8988 SET_GenProgramsNV(table
, _mesa_GenPrograms
);
8989 SET_IsProgramNV(table
, _mesa_IsProgramARB
);
8990 SET_GetVertexAttribdvNV(table
, _mesa_GetVertexAttribdvNV
);
8991 SET_GetVertexAttribfvNV(table
, _mesa_GetVertexAttribfvNV
);
8992 SET_GetVertexAttribivNV(table
, _mesa_GetVertexAttribivNV
);
8993 SET_GetVertexAttribPointervNV(table
, _mesa_GetVertexAttribPointervNV
);
8994 SET_ProgramEnvParameter4dARB(table
, save_ProgramEnvParameter4dARB
);
8995 SET_ProgramEnvParameter4dvARB(table
, save_ProgramEnvParameter4dvARB
);
8996 SET_ProgramEnvParameter4fARB(table
, save_ProgramEnvParameter4fARB
);
8997 SET_ProgramEnvParameter4fvARB(table
, save_ProgramEnvParameter4fvARB
);
8998 SET_ProgramLocalParameter4dARB(table
, save_ProgramLocalParameter4dARB
);
8999 SET_ProgramLocalParameter4dvARB(table
, save_ProgramLocalParameter4dvARB
);
9000 SET_ProgramLocalParameter4fARB(table
, save_ProgramLocalParameter4fARB
);
9001 SET_ProgramLocalParameter4fvARB(table
, save_ProgramLocalParameter4fvARB
);
9002 SET_GetProgramEnvParameterdvARB(table
, _mesa_GetProgramEnvParameterdvARB
);
9003 SET_GetProgramEnvParameterfvARB(table
, _mesa_GetProgramEnvParameterfvARB
);
9004 SET_GetProgramLocalParameterdvARB(table
,
9005 _mesa_GetProgramLocalParameterdvARB
);
9006 SET_GetProgramLocalParameterfvARB(table
,
9007 _mesa_GetProgramLocalParameterfvARB
);
9008 SET_GetProgramivARB(table
, _mesa_GetProgramivARB
);
9009 SET_GetProgramStringARB(table
, _mesa_GetProgramStringARB
);
9012 /* ARB 28. GL_ARB_vertex_buffer_object */
9013 #if FEATURE_ARB_vertex_buffer_object
9014 /* None of the extension's functions get compiled */
9015 SET_BindBufferARB(table
, _mesa_BindBufferARB
);
9016 SET_BufferDataARB(table
, _mesa_BufferDataARB
);
9017 SET_BufferSubDataARB(table
, _mesa_BufferSubDataARB
);
9018 SET_DeleteBuffersARB(table
, _mesa_DeleteBuffersARB
);
9019 SET_GenBuffersARB(table
, _mesa_GenBuffersARB
);
9020 SET_GetBufferParameterivARB(table
, _mesa_GetBufferParameterivARB
);
9021 SET_GetBufferPointervARB(table
, _mesa_GetBufferPointervARB
);
9022 SET_GetBufferSubDataARB(table
, _mesa_GetBufferSubDataARB
);
9023 SET_IsBufferARB(table
, _mesa_IsBufferARB
);
9024 SET_MapBufferARB(table
, _mesa_MapBufferARB
);
9025 SET_UnmapBufferARB(table
, _mesa_UnmapBufferARB
);
9028 #if FEATURE_queryobj
9029 SET_BeginQueryARB(table
, save_BeginQueryARB
);
9030 SET_EndQueryARB(table
, save_EndQueryARB
);
9031 SET_GenQueriesARB(table
, _mesa_GenQueriesARB
);
9032 SET_DeleteQueriesARB(table
, _mesa_DeleteQueriesARB
);
9033 SET_IsQueryARB(table
, _mesa_IsQueryARB
);
9034 SET_GetQueryivARB(table
, _mesa_GetQueryivARB
);
9035 SET_GetQueryObjectivARB(table
, _mesa_GetQueryObjectivARB
);
9036 SET_GetQueryObjectuivARB(table
, _mesa_GetQueryObjectuivARB
);
9038 SET_DrawBuffersARB(table
, save_DrawBuffersARB
);
9040 #if FEATURE_EXT_framebuffer_blit
9041 SET_BlitFramebufferEXT(table
, save_BlitFramebufferEXT
);
9044 /* GL_ARB_shader_objects */
9045 SET_UseProgramObjectARB(table
, save_UseProgramObjectARB
);
9046 SET_Uniform1fARB(table
, save_Uniform1fARB
);
9047 SET_Uniform2fARB(table
, save_Uniform2fARB
);
9048 SET_Uniform3fARB(table
, save_Uniform3fARB
);
9049 SET_Uniform4fARB(table
, save_Uniform4fARB
);
9050 SET_Uniform1fvARB(table
, save_Uniform1fvARB
);
9051 SET_Uniform2fvARB(table
, save_Uniform2fvARB
);
9052 SET_Uniform3fvARB(table
, save_Uniform3fvARB
);
9053 SET_Uniform4fvARB(table
, save_Uniform4fvARB
);
9054 SET_Uniform1iARB(table
, save_Uniform1iARB
);
9055 SET_Uniform2iARB(table
, save_Uniform2iARB
);
9056 SET_Uniform3iARB(table
, save_Uniform3iARB
);
9057 SET_Uniform4iARB(table
, save_Uniform4iARB
);
9058 SET_Uniform1ivARB(table
, save_Uniform1ivARB
);
9059 SET_Uniform2ivARB(table
, save_Uniform2ivARB
);
9060 SET_Uniform3ivARB(table
, save_Uniform3ivARB
);
9061 SET_Uniform4ivARB(table
, save_Uniform4ivARB
);
9062 SET_UniformMatrix2fvARB(table
, save_UniformMatrix2fvARB
);
9063 SET_UniformMatrix3fvARB(table
, save_UniformMatrix3fvARB
);
9064 SET_UniformMatrix4fvARB(table
, save_UniformMatrix4fvARB
);
9065 SET_UniformMatrix2x3fv(table
, save_UniformMatrix2x3fv
);
9066 SET_UniformMatrix3x2fv(table
, save_UniformMatrix3x2fv
);
9067 SET_UniformMatrix2x4fv(table
, save_UniformMatrix2x4fv
);
9068 SET_UniformMatrix4x2fv(table
, save_UniformMatrix4x2fv
);
9069 SET_UniformMatrix3x4fv(table
, save_UniformMatrix3x4fv
);
9070 SET_UniformMatrix4x3fv(table
, save_UniformMatrix4x3fv
);
9072 /* ARB 30/31/32. GL_ARB_shader_objects, GL_ARB_vertex/fragment_shader */
9073 SET_BindAttribLocationARB(table
, exec_BindAttribLocationARB
);
9074 SET_GetAttribLocationARB(table
, exec_GetAttribLocationARB
);
9075 /* XXX additional functions need to be implemented here! */
9077 /* 299. GL_EXT_blend_equation_separate */
9078 SET_BlendEquationSeparateEXT(table
, save_BlendEquationSeparateEXT
);
9080 /* GL_EXT_gpu_program_parmaeters */
9081 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
9082 SET_ProgramEnvParameters4fvEXT(table
, save_ProgramEnvParameters4fvEXT
);
9083 SET_ProgramLocalParameters4fvEXT(table
, save_ProgramLocalParameters4fvEXT
);
9086 /* ARB 50. GL_ARB_map_buffer_range */
9087 #if FEATURE_ARB_map_buffer_range
9088 SET_MapBufferRange(table
, _mesa_MapBufferRange
); /* no dlist save */
9089 SET_FlushMappedBufferRange(table
, _mesa_FlushMappedBufferRange
); /* no dl */
9092 /* ARB 59. GL_ARB_copy_buffer */
9093 SET_CopyBufferSubData(table
, _mesa_CopyBufferSubData
); /* no dlist save */
9095 /* 364. GL_EXT_provoking_vertex */
9096 SET_ProvokingVertexEXT(table
, save_ProvokingVertexEXT
);
9102 enum_string(GLenum k
)
9104 return _mesa_lookup_enum_by_nr(k
);
9109 * Print the commands in a display list. For debugging only.
9110 * TODO: many commands aren't handled yet.
9112 static void GLAPIENTRY
9113 print_list(GLcontext
*ctx
, GLuint list
)
9115 struct gl_display_list
*dlist
;
9119 if (!islist(ctx
, list
)) {
9120 _mesa_printf("%u is not a display list ID\n", list
);
9124 dlist
= lookup_list(ctx
, list
);
9130 _mesa_printf("START-LIST %u, address %p\n", list
, (void *) n
);
9132 done
= n
? GL_FALSE
: GL_TRUE
;
9134 const OpCode opcode
= n
[0].opcode
;
9136 if (is_ext_opcode(opcode
)) {
9137 n
+= ext_opcode_print(ctx
, n
);
9142 _mesa_printf("Accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
9145 _mesa_printf("Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
9146 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
, (void *) n
[7].data
);
9148 case OPCODE_CALL_LIST
:
9149 _mesa_printf("CallList %d\n", (int) n
[1].ui
);
9151 case OPCODE_CALL_LIST_OFFSET
:
9152 _mesa_printf("CallList %d + offset %u = %u\n", (int) n
[1].ui
,
9153 ctx
->List
.ListBase
, ctx
->List
.ListBase
+ n
[1].ui
);
9155 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
9156 _mesa_printf("ColorTableParameterfv %s %s %f %f %f %f\n",
9157 enum_string(n
[1].e
), enum_string(n
[2].e
),
9158 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
9160 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
9161 _mesa_printf("ColorTableParameteriv %s %s %d %d %d %d\n",
9162 enum_string(n
[1].e
), enum_string(n
[2].e
),
9163 n
[3].i
, n
[4].i
, n
[5].i
, n
[6].i
);
9165 case OPCODE_DISABLE
:
9166 _mesa_printf("Disable %s\n", enum_string(n
[1].e
));
9169 _mesa_printf("Enable %s\n", enum_string(n
[1].e
));
9171 case OPCODE_FRUSTUM
:
9172 _mesa_printf("Frustum %g %g %g %g %g %g\n",
9173 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
9175 case OPCODE_LINE_STIPPLE
:
9176 _mesa_printf("LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
9178 case OPCODE_LOAD_IDENTITY
:
9179 _mesa_printf("LoadIdentity\n");
9181 case OPCODE_LOAD_MATRIX
:
9182 _mesa_printf("LoadMatrix\n");
9183 _mesa_printf(" %8f %8f %8f %8f\n",
9184 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
9185 _mesa_printf(" %8f %8f %8f %8f\n",
9186 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
9187 _mesa_printf(" %8f %8f %8f %8f\n",
9188 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
9189 _mesa_printf(" %8f %8f %8f %8f\n",
9190 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
9192 case OPCODE_MULT_MATRIX
:
9193 _mesa_printf("MultMatrix (or Rotate)\n");
9194 _mesa_printf(" %8f %8f %8f %8f\n",
9195 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
9196 _mesa_printf(" %8f %8f %8f %8f\n",
9197 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
9198 _mesa_printf(" %8f %8f %8f %8f\n",
9199 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
9200 _mesa_printf(" %8f %8f %8f %8f\n",
9201 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
9204 _mesa_printf("Ortho %g %g %g %g %g %g\n",
9205 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
9207 case OPCODE_POP_ATTRIB
:
9208 _mesa_printf("PopAttrib\n");
9210 case OPCODE_POP_MATRIX
:
9211 _mesa_printf("PopMatrix\n");
9213 case OPCODE_POP_NAME
:
9214 _mesa_printf("PopName\n");
9216 case OPCODE_PUSH_ATTRIB
:
9217 _mesa_printf("PushAttrib %x\n", n
[1].bf
);
9219 case OPCODE_PUSH_MATRIX
:
9220 _mesa_printf("PushMatrix\n");
9222 case OPCODE_PUSH_NAME
:
9223 _mesa_printf("PushName %d\n", (int) n
[1].ui
);
9225 case OPCODE_RASTER_POS
:
9226 _mesa_printf("RasterPos %g %g %g %g\n",
9227 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
9230 _mesa_printf("Rotate %g %g %g %g\n",
9231 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
9234 _mesa_printf("Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
9236 case OPCODE_TRANSLATE
:
9237 _mesa_printf("Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
9239 case OPCODE_BIND_TEXTURE
:
9240 _mesa_printf("BindTexture %s %d\n",
9241 _mesa_lookup_enum_by_nr(n
[1].ui
), n
[2].ui
);
9243 case OPCODE_SHADE_MODEL
:
9244 _mesa_printf("ShadeModel %s\n", _mesa_lookup_enum_by_nr(n
[1].ui
));
9247 _mesa_printf("Map1 %s %.3f %.3f %d %d\n",
9248 _mesa_lookup_enum_by_nr(n
[1].ui
),
9249 n
[2].f
, n
[3].f
, n
[4].i
, n
[5].i
);
9252 _mesa_printf("Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
9253 _mesa_lookup_enum_by_nr(n
[1].ui
),
9254 n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
,
9255 n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
9257 case OPCODE_MAPGRID1
:
9258 _mesa_printf("MapGrid1 %d %.3f %.3f\n", n
[1].i
, n
[2].f
, n
[3].f
);
9260 case OPCODE_MAPGRID2
:
9261 _mesa_printf("MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
9262 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
9264 case OPCODE_EVALMESH1
:
9265 _mesa_printf("EvalMesh1 %d %d\n", n
[1].i
, n
[2].i
);
9267 case OPCODE_EVALMESH2
:
9268 _mesa_printf("EvalMesh2 %d %d %d %d\n",
9269 n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
9272 case OPCODE_ATTR_1F_NV
:
9273 _mesa_printf("ATTR_1F_NV attr %d: %f\n", n
[1].i
, n
[2].f
);
9275 case OPCODE_ATTR_2F_NV
:
9276 _mesa_printf("ATTR_2F_NV attr %d: %f %f\n",
9277 n
[1].i
, n
[2].f
, n
[3].f
);
9279 case OPCODE_ATTR_3F_NV
:
9280 _mesa_printf("ATTR_3F_NV attr %d: %f %f %f\n",
9281 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
9283 case OPCODE_ATTR_4F_NV
:
9284 _mesa_printf("ATTR_4F_NV attr %d: %f %f %f %f\n",
9285 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
9287 case OPCODE_ATTR_1F_ARB
:
9288 _mesa_printf("ATTR_1F_ARB attr %d: %f\n", n
[1].i
, n
[2].f
);
9290 case OPCODE_ATTR_2F_ARB
:
9291 _mesa_printf("ATTR_2F_ARB attr %d: %f %f\n",
9292 n
[1].i
, n
[2].f
, n
[3].f
);
9294 case OPCODE_ATTR_3F_ARB
:
9295 _mesa_printf("ATTR_3F_ARB attr %d: %f %f %f\n",
9296 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
9298 case OPCODE_ATTR_4F_ARB
:
9299 _mesa_printf("ATTR_4F_ARB attr %d: %f %f %f %f\n",
9300 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
9303 case OPCODE_MATERIAL
:
9304 _mesa_printf("MATERIAL %x %x: %f %f %f %f\n",
9305 n
[1].i
, n
[2].i
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
9308 _mesa_printf("BEGIN %x\n", n
[1].i
);
9311 _mesa_printf("END\n");
9314 _mesa_printf("RECTF %f %f %f %f\n", n
[1].f
, n
[2].f
, n
[3].f
,
9317 case OPCODE_EVAL_C1
:
9318 _mesa_printf("EVAL_C1 %f\n", n
[1].f
);
9320 case OPCODE_EVAL_C2
:
9321 _mesa_printf("EVAL_C2 %f %f\n", n
[1].f
, n
[2].f
);
9323 case OPCODE_EVAL_P1
:
9324 _mesa_printf("EVAL_P1 %d\n", n
[1].i
);
9326 case OPCODE_EVAL_P2
:
9327 _mesa_printf("EVAL_P2 %d %d\n", n
[1].i
, n
[2].i
);
9330 case OPCODE_PROVOKING_VERTEX
:
9331 _mesa_printf("ProvokingVertex %s\n",
9332 _mesa_lookup_enum_by_nr(n
[1].ui
));
9336 * meta opcodes/commands
9339 _mesa_printf("Error: %s %s\n",
9340 enum_string(n
[1].e
), (const char *) n
[2].data
);
9342 case OPCODE_CONTINUE
:
9343 _mesa_printf("DISPLAY-LIST-CONTINUE\n");
9344 n
= (Node
*) n
[1].next
;
9346 case OPCODE_END_OF_LIST
:
9347 _mesa_printf("END-LIST %u\n", list
);
9351 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
9353 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
9354 opcode
, (void *) n
);
9358 _mesa_printf("command %d, %u operands\n", opcode
,
9362 /* increment n to point to next compiled command */
9363 if (opcode
!= OPCODE_CONTINUE
) {
9364 n
+= InstSize
[opcode
];
9373 * Clients may call this function to help debug display list problems.
9374 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
9375 * changed, or break in the future without notice.
9378 mesa_print_display_list(GLuint list
)
9380 GET_CURRENT_CONTEXT(ctx
);
9381 print_list(ctx
, list
);
9385 /**********************************************************************/
9386 /***** Initialization *****/
9387 /**********************************************************************/
9390 _mesa_save_vtxfmt_init(GLvertexformat
* vfmt
)
9392 _MESA_INIT_ARRAYELT_VTXFMT(vfmt
, _ae_
);
9394 vfmt
->Begin
= save_Begin
;
9396 _MESA_INIT_DLIST_VTXFMT(vfmt
, save_
);
9398 vfmt
->Color3f
= save_Color3f
;
9399 vfmt
->Color3fv
= save_Color3fv
;
9400 vfmt
->Color4f
= save_Color4f
;
9401 vfmt
->Color4fv
= save_Color4fv
;
9402 vfmt
->EdgeFlag
= save_EdgeFlag
;
9403 vfmt
->End
= save_End
;
9405 _MESA_INIT_EVAL_VTXFMT(vfmt
, save_
);
9407 vfmt
->FogCoordfEXT
= save_FogCoordfEXT
;
9408 vfmt
->FogCoordfvEXT
= save_FogCoordfvEXT
;
9409 vfmt
->Indexf
= save_Indexf
;
9410 vfmt
->Indexfv
= save_Indexfv
;
9411 vfmt
->Materialfv
= save_Materialfv
;
9412 vfmt
->MultiTexCoord1fARB
= save_MultiTexCoord1f
;
9413 vfmt
->MultiTexCoord1fvARB
= save_MultiTexCoord1fv
;
9414 vfmt
->MultiTexCoord2fARB
= save_MultiTexCoord2f
;
9415 vfmt
->MultiTexCoord2fvARB
= save_MultiTexCoord2fv
;
9416 vfmt
->MultiTexCoord3fARB
= save_MultiTexCoord3f
;
9417 vfmt
->MultiTexCoord3fvARB
= save_MultiTexCoord3fv
;
9418 vfmt
->MultiTexCoord4fARB
= save_MultiTexCoord4f
;
9419 vfmt
->MultiTexCoord4fvARB
= save_MultiTexCoord4fv
;
9420 vfmt
->Normal3f
= save_Normal3f
;
9421 vfmt
->Normal3fv
= save_Normal3fv
;
9422 vfmt
->SecondaryColor3fEXT
= save_SecondaryColor3fEXT
;
9423 vfmt
->SecondaryColor3fvEXT
= save_SecondaryColor3fvEXT
;
9424 vfmt
->TexCoord1f
= save_TexCoord1f
;
9425 vfmt
->TexCoord1fv
= save_TexCoord1fv
;
9426 vfmt
->TexCoord2f
= save_TexCoord2f
;
9427 vfmt
->TexCoord2fv
= save_TexCoord2fv
;
9428 vfmt
->TexCoord3f
= save_TexCoord3f
;
9429 vfmt
->TexCoord3fv
= save_TexCoord3fv
;
9430 vfmt
->TexCoord4f
= save_TexCoord4f
;
9431 vfmt
->TexCoord4fv
= save_TexCoord4fv
;
9432 vfmt
->Vertex2f
= save_Vertex2f
;
9433 vfmt
->Vertex2fv
= save_Vertex2fv
;
9434 vfmt
->Vertex3f
= save_Vertex3f
;
9435 vfmt
->Vertex3fv
= save_Vertex3fv
;
9436 vfmt
->Vertex4f
= save_Vertex4f
;
9437 vfmt
->Vertex4fv
= save_Vertex4fv
;
9438 vfmt
->VertexAttrib1fNV
= save_VertexAttrib1fNV
;
9439 vfmt
->VertexAttrib1fvNV
= save_VertexAttrib1fvNV
;
9440 vfmt
->VertexAttrib2fNV
= save_VertexAttrib2fNV
;
9441 vfmt
->VertexAttrib2fvNV
= save_VertexAttrib2fvNV
;
9442 vfmt
->VertexAttrib3fNV
= save_VertexAttrib3fNV
;
9443 vfmt
->VertexAttrib3fvNV
= save_VertexAttrib3fvNV
;
9444 vfmt
->VertexAttrib4fNV
= save_VertexAttrib4fNV
;
9445 vfmt
->VertexAttrib4fvNV
= save_VertexAttrib4fvNV
;
9446 vfmt
->VertexAttrib1fARB
= save_VertexAttrib1fARB
;
9447 vfmt
->VertexAttrib1fvARB
= save_VertexAttrib1fvARB
;
9448 vfmt
->VertexAttrib2fARB
= save_VertexAttrib2fARB
;
9449 vfmt
->VertexAttrib2fvARB
= save_VertexAttrib2fvARB
;
9450 vfmt
->VertexAttrib3fARB
= save_VertexAttrib3fARB
;
9451 vfmt
->VertexAttrib3fvARB
= save_VertexAttrib3fvARB
;
9452 vfmt
->VertexAttrib4fARB
= save_VertexAttrib4fARB
;
9453 vfmt
->VertexAttrib4fvARB
= save_VertexAttrib4fvARB
;
9455 vfmt
->Rectf
= save_Rectf
;
9457 /* The driver is required to implement these as
9458 * 1) They can probably do a better job.
9459 * 2) A lot of new mechanisms would have to be added to this module
9460 * to support it. That code would probably never get used,
9464 vfmt
->DrawArrays
= 0;
9465 vfmt
->DrawElements
= 0;
9466 vfmt
->DrawRangeElements
= 0;
9467 vfmt
->MultiDrawElemementsEXT
= 0;
9468 vfmt
->DrawElementsBaseVertex
= 0;
9469 vfmt
->DrawRangeElementsBaseVertex
= 0;
9470 vfmt
->MultiDrawElemementsBaseVertex
= 0;
9476 _mesa_install_dlist_vtxfmt(struct _glapi_table
*disp
,
9477 const GLvertexformat
*vfmt
)
9479 SET_CallList(disp
, vfmt
->CallList
);
9480 SET_CallLists(disp
, vfmt
->CallLists
);
9484 void _mesa_init_dlist_dispatch(struct _glapi_table
*disp
)
9486 SET_CallList(disp
, _mesa_CallList
);
9487 SET_CallLists(disp
, _mesa_CallLists
);
9489 SET_DeleteLists(disp
, _mesa_DeleteLists
);
9490 SET_EndList(disp
, _mesa_EndList
);
9491 SET_GenLists(disp
, _mesa_GenLists
);
9492 SET_IsList(disp
, _mesa_IsList
);
9493 SET_ListBase(disp
, _mesa_ListBase
);
9494 SET_NewList(disp
, _mesa_NewList
);
9498 #endif /* FEATURE_dlist */
9502 * Initialize display list state for given context.
9505 _mesa_init_display_list(GLcontext
*ctx
)
9507 static GLboolean tableInitialized
= GL_FALSE
;
9509 /* zero-out the instruction size table, just once */
9510 if (!tableInitialized
) {
9511 _mesa_bzero(InstSize
, sizeof(InstSize
));
9512 tableInitialized
= GL_TRUE
;
9515 /* extension info */
9516 ctx
->ListExt
= CALLOC_STRUCT(gl_list_extensions
);
9519 ctx
->ListState
.CallDepth
= 0;
9520 ctx
->ExecuteFlag
= GL_TRUE
;
9521 ctx
->CompileFlag
= GL_FALSE
;
9522 ctx
->ListState
.CurrentBlock
= NULL
;
9523 ctx
->ListState
.CurrentPos
= 0;
9525 /* Display List group */
9526 ctx
->List
.ListBase
= 0;
9529 _mesa_save_vtxfmt_init(&ctx
->ListState
.ListVtxfmt
);
9535 _mesa_free_display_list_data(GLcontext
*ctx
)
9538 ctx
->ListExt
= NULL
;