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"
36 #include "api_loopback.h"
37 #include "api_validate.h"
39 #include "mfeatures.h"
40 #include "bufferobj.h"
46 #include "framebuffer.h"
53 #include "texstorage.h"
57 #include "math/m_matrix.h"
59 #include "main/dispatch.h"
64 * Other parts of Mesa (such as the VBO module) can plug into the display
65 * list system. This structure describes new display list instructions.
67 struct gl_list_instruction
70 void (*Execute
)( struct gl_context
*ctx
, void *data
);
71 void (*Destroy
)( struct gl_context
*ctx
, void *data
);
72 void (*Print
)( struct gl_context
*ctx
, void *data
);
76 #define MAX_DLIST_EXT_OPCODES 16
79 * Used by device drivers to hook new commands into display lists.
81 struct gl_list_extensions
83 struct gl_list_instruction Opcode
[MAX_DLIST_EXT_OPCODES
];
92 * \param ctx GL context.
94 * Checks if dd_function_table::SaveNeedFlush is marked to flush
95 * stored (save) vertices, and calls
96 * dd_function_table::SaveFlushVertices if so.
98 #define SAVE_FLUSH_VERTICES(ctx) \
100 if (ctx->Driver.SaveNeedFlush) \
101 ctx->Driver.SaveFlushVertices(ctx); \
106 * Macro to assert that the API call was made outside the
107 * glBegin()/glEnd() pair, with return value.
109 * \param ctx GL context.
110 * \param retval value to return value in case the assertion fails.
112 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval) \
114 if (ctx->Driver.CurrentSavePrimitive <= GL_POLYGON || \
115 ctx->Driver.CurrentSavePrimitive == PRIM_INSIDE_UNKNOWN_PRIM) { \
116 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \
122 * Macro to assert that the API call was made outside the
123 * glBegin()/glEnd() pair.
125 * \param ctx GL context.
127 #define ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx) \
129 if (ctx->Driver.CurrentSavePrimitive <= GL_POLYGON || \
130 ctx->Driver.CurrentSavePrimitive == PRIM_INSIDE_UNKNOWN_PRIM) { \
131 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \
137 * Macro to assert that the API call was made outside the
138 * glBegin()/glEnd() pair and flush the vertices.
140 * \param ctx GL context.
142 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx) \
144 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx); \
145 SAVE_FLUSH_VERTICES(ctx); \
149 * Macro to assert that the API call was made outside the
150 * glBegin()/glEnd() pair and flush the vertices, with return value.
152 * \param ctx GL context.
153 * \param retval value to return value in case the assertion fails.
155 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval)\
157 ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval); \
158 SAVE_FLUSH_VERTICES(ctx); \
164 * Display list opcodes.
166 * The fact that these identifiers are assigned consecutive
167 * integer values starting at 0 is very important, see InstSize array usage)
171 OPCODE_INVALID
= -1, /* Force signed enum */
177 OPCODE_BLEND_EQUATION
,
178 OPCODE_BLEND_EQUATION_SEPARATE
,
179 OPCODE_BLEND_FUNC_SEPARATE
,
182 OPCODE_CALL_LIST_OFFSET
,
188 OPCODE_CLEAR_STENCIL
,
191 OPCODE_COLOR_MATERIAL
,
193 OPCODE_COLOR_TABLE_PARAMETER_FV
,
194 OPCODE_COLOR_TABLE_PARAMETER_IV
,
195 OPCODE_COLOR_SUB_TABLE
,
196 OPCODE_CONVOLUTION_FILTER_1D
,
197 OPCODE_CONVOLUTION_FILTER_2D
,
198 OPCODE_CONVOLUTION_PARAMETER_I
,
199 OPCODE_CONVOLUTION_PARAMETER_IV
,
200 OPCODE_CONVOLUTION_PARAMETER_F
,
201 OPCODE_CONVOLUTION_PARAMETER_FV
,
202 OPCODE_COPY_COLOR_SUB_TABLE
,
203 OPCODE_COPY_COLOR_TABLE
,
205 OPCODE_COPY_TEX_IMAGE1D
,
206 OPCODE_COPY_TEX_IMAGE2D
,
207 OPCODE_COPY_TEX_SUB_IMAGE1D
,
208 OPCODE_COPY_TEX_SUB_IMAGE2D
,
209 OPCODE_COPY_TEX_SUB_IMAGE3D
,
232 OPCODE_LOAD_IDENTITY
,
246 OPCODE_PIXEL_TRANSFER
,
249 OPCODE_POINT_PARAMETERS
,
251 OPCODE_POLYGON_STIPPLE
,
252 OPCODE_POLYGON_OFFSET
,
256 OPCODE_PRIORITIZE_TEXTURE
,
262 OPCODE_RESET_HISTOGRAM
,
263 OPCODE_RESET_MIN_MAX
,
267 OPCODE_SELECT_TEXTURE_SGIS
,
268 OPCODE_SELECT_TEXTURE_COORD_SET
,
279 OPCODE_TEX_SUB_IMAGE1D
,
280 OPCODE_TEX_SUB_IMAGE2D
,
281 OPCODE_TEX_SUB_IMAGE3D
,
285 /* GL_ARB_multisample */
286 OPCODE_SAMPLE_COVERAGE
,
287 /* GL_ARB_window_pos */
288 OPCODE_WINDOW_POS_ARB
,
289 /* GL_EXT_depth_bounds_test */
290 OPCODE_DEPTH_BOUNDS_EXT
,
292 /* Vertex attributes -- fallback for when optimized display
293 * list build isn't active.
308 /* GL_EXT_texture_integer */
310 OPCODE_CLEARCOLOR_UI
,
311 OPCODE_TEXPARAMETER_I
,
312 OPCODE_TEXPARAMETER_UI
,
314 /* GL_NV_texture_barrier */
315 OPCODE_TEXTURE_BARRIER_NV
,
317 /* The following three are meta instructions */
318 OPCODE_ERROR
, /* raise compiled-in error */
329 * Display list instructions are stored as sequences of "nodes". Nodes
330 * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
331 * are linked together with a pointer.
333 * Each instruction in the display list is stored as a sequence of
334 * contiguous nodes in memory.
335 * Each node is the union of a variety of data types.
350 void *next
; /* If prev node's opcode==OPCODE_CONTINUE */
354 typedef union gl_dlist_node Node
;
358 * Used to store a 64-bit uint in a pair of "Nodes" for the sake of 32-bit
359 * environment. In 64-bit env, sizeof(Node)==8 anyway.
369 * How many nodes to allocate at a time.
371 * \note Reduced now that we hold vertices etc. elsewhere.
373 #define BLOCK_SIZE 256
378 * Number of nodes of storage needed for each instruction.
379 * Sizes for dynamically allocated opcodes are stored in the context struct.
381 static GLuint InstSize
[OPCODE_END_OF_LIST
+ 1];
387 void mesa_print_display_list(GLuint list
);
390 /**********************************************************************/
391 /***** Private *****/
392 /**********************************************************************/
396 * Make an empty display list. This is used by glGenLists() to
397 * reserve display list IDs.
399 static struct gl_display_list
*
400 make_list(GLuint name
, GLuint count
)
402 struct gl_display_list
*dlist
= CALLOC_STRUCT(gl_display_list
);
404 dlist
->Head
= (Node
*) malloc(sizeof(Node
) * count
);
405 dlist
->Head
[0].opcode
= OPCODE_END_OF_LIST
;
411 * Lookup function to just encapsulate casting.
413 static inline struct gl_display_list
*
414 lookup_list(struct gl_context
*ctx
, GLuint list
)
416 return (struct gl_display_list
*)
417 _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
421 /** Is the given opcode an extension code? */
422 static inline GLboolean
423 is_ext_opcode(OpCode opcode
)
425 return (opcode
>= OPCODE_EXT_0
);
429 /** Destroy an extended opcode instruction */
431 ext_opcode_destroy(struct gl_context
*ctx
, Node
*node
)
433 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
435 ctx
->ListExt
->Opcode
[i
].Destroy(ctx
, &node
[1]);
436 step
= ctx
->ListExt
->Opcode
[i
].Size
;
441 /** Execute an extended opcode instruction */
443 ext_opcode_execute(struct gl_context
*ctx
, Node
*node
)
445 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
447 ctx
->ListExt
->Opcode
[i
].Execute(ctx
, &node
[1]);
448 step
= ctx
->ListExt
->Opcode
[i
].Size
;
453 /** Print an extended opcode instruction */
455 ext_opcode_print(struct gl_context
*ctx
, Node
*node
)
457 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
459 ctx
->ListExt
->Opcode
[i
].Print(ctx
, &node
[1]);
460 step
= ctx
->ListExt
->Opcode
[i
].Size
;
466 * Delete the named display list, but don't remove from hash table.
467 * \param dlist - display list pointer
470 _mesa_delete_list(struct gl_context
*ctx
, struct gl_display_list
*dlist
)
475 n
= block
= dlist
->Head
;
477 done
= block
? GL_FALSE
: GL_TRUE
;
479 const OpCode opcode
= n
[0].opcode
;
481 /* check for extension opcodes first */
482 if (is_ext_opcode(opcode
)) {
483 n
+= ext_opcode_destroy(ctx
, n
);
487 /* for some commands, we need to free malloc'd memory */
490 n
+= InstSize
[n
[0].opcode
];
494 n
+= InstSize
[n
[0].opcode
];
496 case OPCODE_DRAW_PIXELS
:
498 n
+= InstSize
[n
[0].opcode
];
502 n
+= InstSize
[n
[0].opcode
];
504 case OPCODE_COLOR_TABLE
:
506 n
+= InstSize
[n
[0].opcode
];
508 case OPCODE_COLOR_SUB_TABLE
:
510 n
+= InstSize
[n
[0].opcode
];
512 case OPCODE_CONVOLUTION_FILTER_1D
:
514 n
+= InstSize
[n
[0].opcode
];
516 case OPCODE_CONVOLUTION_FILTER_2D
:
518 n
+= InstSize
[n
[0].opcode
];
520 case OPCODE_POLYGON_STIPPLE
:
522 n
+= InstSize
[n
[0].opcode
];
524 case OPCODE_TEX_IMAGE1D
:
526 n
+= InstSize
[n
[0].opcode
];
528 case OPCODE_TEX_IMAGE2D
:
530 n
+= InstSize
[n
[0].opcode
];
532 case OPCODE_TEX_IMAGE3D
:
534 n
+= InstSize
[n
[0].opcode
];
536 case OPCODE_TEX_SUB_IMAGE1D
:
538 n
+= InstSize
[n
[0].opcode
];
540 case OPCODE_TEX_SUB_IMAGE2D
:
542 n
+= InstSize
[n
[0].opcode
];
544 case OPCODE_TEX_SUB_IMAGE3D
:
546 n
+= InstSize
[n
[0].opcode
];
548 case OPCODE_CONTINUE
:
549 n
= (Node
*) n
[1].next
;
553 case OPCODE_END_OF_LIST
:
558 /* Most frequent case */
559 n
+= InstSize
[n
[0].opcode
];
570 * Destroy a display list and remove from hash table.
571 * \param list - display list number
574 destroy_list(struct gl_context
*ctx
, GLuint list
)
576 struct gl_display_list
*dlist
;
581 dlist
= lookup_list(ctx
, list
);
585 _mesa_delete_list(ctx
, dlist
);
586 _mesa_HashRemove(ctx
->Shared
->DisplayList
, list
);
591 * Translate the nth element of list from <type> to GLint.
594 translate_id(GLsizei n
, GLenum type
, const GLvoid
* list
)
606 bptr
= (GLbyte
*) list
;
607 return (GLint
) bptr
[n
];
608 case GL_UNSIGNED_BYTE
:
609 ubptr
= (GLubyte
*) list
;
610 return (GLint
) ubptr
[n
];
612 sptr
= (GLshort
*) list
;
613 return (GLint
) sptr
[n
];
614 case GL_UNSIGNED_SHORT
:
615 usptr
= (GLushort
*) list
;
616 return (GLint
) usptr
[n
];
618 iptr
= (GLint
*) list
;
620 case GL_UNSIGNED_INT
:
621 uiptr
= (GLuint
*) list
;
622 return (GLint
) uiptr
[n
];
624 fptr
= (GLfloat
*) list
;
625 return (GLint
) FLOORF(fptr
[n
]);
627 ubptr
= ((GLubyte
*) list
) + 2 * n
;
628 return (GLint
) ubptr
[0] * 256
631 ubptr
= ((GLubyte
*) list
) + 3 * n
;
632 return (GLint
) ubptr
[0] * 65536
633 + (GLint
) ubptr
[1] * 256
636 ubptr
= ((GLubyte
*) list
) + 4 * n
;
637 return (GLint
) ubptr
[0] * 16777216
638 + (GLint
) ubptr
[1] * 65536
639 + (GLint
) ubptr
[2] * 256
649 /**********************************************************************/
651 /**********************************************************************/
654 * Wrapper for _mesa_unpack_image/bitmap() that handles pixel buffer objects.
655 * If width < 0 or height < 0 or format or type are invalid we'll just
656 * return NULL. We will not generate an error since OpenGL command
657 * arguments aren't error-checked until the command is actually executed
658 * (not when they're compiled).
659 * But if we run out of memory, GL_OUT_OF_MEMORY will be recorded.
662 unpack_image(struct gl_context
*ctx
, GLuint dimensions
,
663 GLsizei width
, GLsizei height
, GLsizei depth
,
664 GLenum format
, GLenum type
, const GLvoid
* pixels
,
665 const struct gl_pixelstore_attrib
*unpack
)
669 if (width
<= 0 || height
<= 0) {
673 if (_mesa_bytes_per_pixel(format
, type
) < 0) {
674 /* bad format and/or type */
678 if (type
== GL_BITMAP
)
679 image
= _mesa_unpack_bitmap(width
, height
, pixels
, unpack
);
681 image
= _mesa_unpack_image(dimensions
, width
, height
, depth
,
682 format
, type
, pixels
, unpack
);
683 if (pixels
&& !image
) {
684 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "display list construction");
690 * Allocate space for a display list instruction (opcode + payload space).
691 * \param opcode the instruction opcode (OPCODE_* value)
692 * \param bytes instruction payload size (not counting opcode)
693 * \return pointer to allocated memory (the opcode space)
696 dlist_alloc(struct gl_context
*ctx
, OpCode opcode
, GLuint bytes
)
698 const GLuint numNodes
= 1 + (bytes
+ sizeof(Node
) - 1) / sizeof(Node
);
701 if (opcode
< (GLuint
) OPCODE_EXT_0
) {
702 if (InstSize
[opcode
] == 0) {
703 /* save instruction size now */
704 InstSize
[opcode
] = numNodes
;
707 /* make sure instruction size agrees */
708 ASSERT(numNodes
== InstSize
[opcode
]);
712 if (ctx
->ListState
.CurrentPos
+ numNodes
+ 2 > BLOCK_SIZE
) {
713 /* This block is full. Allocate a new block and chain to it */
715 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
716 n
[0].opcode
= OPCODE_CONTINUE
;
717 newblock
= (Node
*) malloc(sizeof(Node
) * BLOCK_SIZE
);
719 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "Building display list");
722 n
[1].next
= (Node
*) newblock
;
723 ctx
->ListState
.CurrentBlock
= newblock
;
724 ctx
->ListState
.CurrentPos
= 0;
727 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
728 ctx
->ListState
.CurrentPos
+= numNodes
;
730 n
[0].opcode
= opcode
;
738 * Allocate space for a display list instruction. Used by callers outside
739 * this file for things like VBO vertex data.
741 * \param opcode the instruction opcode (OPCODE_* value)
742 * \param bytes instruction size in bytes, not counting opcode.
743 * \return pointer to the usable data area (not including the internal
747 _mesa_dlist_alloc(struct gl_context
*ctx
, GLuint opcode
, GLuint bytes
)
749 Node
*n
= dlist_alloc(ctx
, (OpCode
) opcode
, bytes
);
751 return n
+ 1; /* return pointer to payload area, after opcode */
758 * This function allows modules and drivers to get their own opcodes
759 * for extending display list functionality.
760 * \param ctx the rendering context
761 * \param size number of bytes for storing the new display list command
762 * \param execute function to execute the new display list command
763 * \param destroy function to destroy the new display list command
764 * \param print function to print the new display list command
765 * \return the new opcode number or -1 if error
768 _mesa_dlist_alloc_opcode(struct gl_context
*ctx
,
770 void (*execute
) (struct gl_context
*, void *),
771 void (*destroy
) (struct gl_context
*, void *),
772 void (*print
) (struct gl_context
*, void *))
774 if (ctx
->ListExt
->NumOpcodes
< MAX_DLIST_EXT_OPCODES
) {
775 const GLuint i
= ctx
->ListExt
->NumOpcodes
++;
776 ctx
->ListExt
->Opcode
[i
].Size
=
777 1 + (size
+ sizeof(Node
) - 1) / sizeof(Node
);
778 ctx
->ListExt
->Opcode
[i
].Execute
= execute
;
779 ctx
->ListExt
->Opcode
[i
].Destroy
= destroy
;
780 ctx
->ListExt
->Opcode
[i
].Print
= print
;
781 return i
+ OPCODE_EXT_0
;
788 * Allocate space for a display list instruction. The space is basically
789 * an array of Nodes where node[0] holds the opcode, node[1] is the first
790 * function parameter, node[2] is the second parameter, etc.
792 * \param opcode one of OPCODE_x
793 * \param nparams number of function parameters
794 * \return pointer to start of instruction space
797 alloc_instruction(struct gl_context
*ctx
, OpCode opcode
, GLuint nparams
)
799 return dlist_alloc(ctx
, opcode
, nparams
* sizeof(Node
));
805 * Display List compilation functions
807 static void GLAPIENTRY
808 save_Accum(GLenum op
, GLfloat value
)
810 GET_CURRENT_CONTEXT(ctx
);
812 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
813 n
= alloc_instruction(ctx
, OPCODE_ACCUM
, 2);
818 if (ctx
->ExecuteFlag
) {
819 CALL_Accum(ctx
->Exec
, (op
, value
));
824 static void GLAPIENTRY
825 save_AlphaFunc(GLenum func
, GLclampf ref
)
827 GET_CURRENT_CONTEXT(ctx
);
829 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
830 n
= alloc_instruction(ctx
, OPCODE_ALPHA_FUNC
, 2);
833 n
[2].f
= (GLfloat
) ref
;
835 if (ctx
->ExecuteFlag
) {
836 CALL_AlphaFunc(ctx
->Exec
, (func
, ref
));
841 static void GLAPIENTRY
842 save_BindTexture(GLenum target
, GLuint texture
)
844 GET_CURRENT_CONTEXT(ctx
);
846 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
847 n
= alloc_instruction(ctx
, OPCODE_BIND_TEXTURE
, 2);
852 if (ctx
->ExecuteFlag
) {
853 CALL_BindTexture(ctx
->Exec
, (target
, texture
));
858 static void GLAPIENTRY
859 save_Bitmap(GLsizei width
, GLsizei height
,
860 GLfloat xorig
, GLfloat yorig
,
861 GLfloat xmove
, GLfloat ymove
, const GLubyte
* pixels
)
863 GET_CURRENT_CONTEXT(ctx
);
865 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
866 n
= alloc_instruction(ctx
, OPCODE_BITMAP
, 7);
868 n
[1].i
= (GLint
) width
;
869 n
[2].i
= (GLint
) height
;
874 n
[7].data
= unpack_image(ctx
, 2, width
, height
, 1, GL_COLOR_INDEX
,
875 GL_BITMAP
, pixels
, &ctx
->Unpack
);
877 if (ctx
->ExecuteFlag
) {
878 CALL_Bitmap(ctx
->Exec
, (width
, height
,
879 xorig
, yorig
, xmove
, ymove
, pixels
));
884 static void GLAPIENTRY
885 save_BlendEquation(GLenum mode
)
887 GET_CURRENT_CONTEXT(ctx
);
889 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
890 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION
, 1);
894 if (ctx
->ExecuteFlag
) {
895 CALL_BlendEquation(ctx
->Exec
, (mode
));
900 static void GLAPIENTRY
901 save_BlendEquationSeparateEXT(GLenum modeRGB
, GLenum modeA
)
903 GET_CURRENT_CONTEXT(ctx
);
905 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
906 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_SEPARATE
, 2);
911 if (ctx
->ExecuteFlag
) {
912 CALL_BlendEquationSeparateEXT(ctx
->Exec
, (modeRGB
, modeA
));
917 static void GLAPIENTRY
918 save_BlendFuncSeparateEXT(GLenum sfactorRGB
, GLenum dfactorRGB
,
919 GLenum sfactorA
, GLenum dfactorA
)
921 GET_CURRENT_CONTEXT(ctx
);
923 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
924 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE
, 4);
931 if (ctx
->ExecuteFlag
) {
932 CALL_BlendFuncSeparateEXT(ctx
->Exec
,
933 (sfactorRGB
, dfactorRGB
, sfactorA
, dfactorA
));
938 static void GLAPIENTRY
939 save_BlendFunc(GLenum srcfactor
, GLenum dstfactor
)
941 save_BlendFuncSeparateEXT(srcfactor
, dstfactor
, srcfactor
, dstfactor
);
945 static void GLAPIENTRY
946 save_BlendColor(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
948 GET_CURRENT_CONTEXT(ctx
);
950 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
951 n
= alloc_instruction(ctx
, OPCODE_BLEND_COLOR
, 4);
958 if (ctx
->ExecuteFlag
) {
959 CALL_BlendColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
963 static void invalidate_saved_current_state( struct gl_context
*ctx
)
967 for (i
= 0; i
< VERT_ATTRIB_MAX
; i
++)
968 ctx
->ListState
.ActiveAttribSize
[i
] = 0;
970 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++)
971 ctx
->ListState
.ActiveMaterialSize
[i
] = 0;
973 memset(&ctx
->ListState
.Current
, 0, sizeof ctx
->ListState
.Current
);
975 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
978 static void GLAPIENTRY
979 save_CallList(GLuint list
)
981 GET_CURRENT_CONTEXT(ctx
);
983 SAVE_FLUSH_VERTICES(ctx
);
985 n
= alloc_instruction(ctx
, OPCODE_CALL_LIST
, 1);
990 /* After this, we don't know what state we're in. Invalidate all
991 * cached information previously gathered:
993 invalidate_saved_current_state( ctx
);
995 if (ctx
->ExecuteFlag
) {
996 _mesa_CallList(list
);
1001 static void GLAPIENTRY
1002 save_CallLists(GLsizei num
, GLenum type
, const GLvoid
* lists
)
1004 GET_CURRENT_CONTEXT(ctx
);
1006 GLboolean typeErrorFlag
;
1008 SAVE_FLUSH_VERTICES(ctx
);
1012 case GL_UNSIGNED_BYTE
:
1014 case GL_UNSIGNED_SHORT
:
1016 case GL_UNSIGNED_INT
:
1021 typeErrorFlag
= GL_FALSE
;
1024 typeErrorFlag
= GL_TRUE
;
1027 for (i
= 0; i
< num
; i
++) {
1028 GLint list
= translate_id(i
, type
, lists
);
1029 Node
*n
= alloc_instruction(ctx
, OPCODE_CALL_LIST_OFFSET
, 2);
1032 n
[2].b
= typeErrorFlag
;
1036 /* After this, we don't know what state we're in. Invalidate all
1037 * cached information previously gathered:
1039 invalidate_saved_current_state( ctx
);
1041 if (ctx
->ExecuteFlag
) {
1042 CALL_CallLists(ctx
->Exec
, (num
, type
, lists
));
1047 static void GLAPIENTRY
1048 save_Clear(GLbitfield mask
)
1050 GET_CURRENT_CONTEXT(ctx
);
1052 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1053 n
= alloc_instruction(ctx
, OPCODE_CLEAR
, 1);
1057 if (ctx
->ExecuteFlag
) {
1058 CALL_Clear(ctx
->Exec
, (mask
));
1063 static void GLAPIENTRY
1064 save_ClearAccum(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
1066 GET_CURRENT_CONTEXT(ctx
);
1068 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1069 n
= alloc_instruction(ctx
, OPCODE_CLEAR_ACCUM
, 4);
1076 if (ctx
->ExecuteFlag
) {
1077 CALL_ClearAccum(ctx
->Exec
, (red
, green
, blue
, alpha
));
1082 static void GLAPIENTRY
1083 save_ClearColor(GLclampf red
, GLclampf green
, GLclampf blue
, GLclampf alpha
)
1085 GET_CURRENT_CONTEXT(ctx
);
1087 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1088 n
= alloc_instruction(ctx
, OPCODE_CLEAR_COLOR
, 4);
1095 if (ctx
->ExecuteFlag
) {
1096 CALL_ClearColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
1101 static void GLAPIENTRY
1102 save_ClearDepth(GLclampd depth
)
1104 GET_CURRENT_CONTEXT(ctx
);
1106 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1107 n
= alloc_instruction(ctx
, OPCODE_CLEAR_DEPTH
, 1);
1109 n
[1].f
= (GLfloat
) depth
;
1111 if (ctx
->ExecuteFlag
) {
1112 CALL_ClearDepth(ctx
->Exec
, (depth
));
1117 static void GLAPIENTRY
1118 save_ClearIndex(GLfloat c
)
1120 GET_CURRENT_CONTEXT(ctx
);
1122 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1123 n
= alloc_instruction(ctx
, OPCODE_CLEAR_INDEX
, 1);
1127 if (ctx
->ExecuteFlag
) {
1128 CALL_ClearIndex(ctx
->Exec
, (c
));
1133 static void GLAPIENTRY
1134 save_ClearStencil(GLint s
)
1136 GET_CURRENT_CONTEXT(ctx
);
1138 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1139 n
= alloc_instruction(ctx
, OPCODE_CLEAR_STENCIL
, 1);
1143 if (ctx
->ExecuteFlag
) {
1144 CALL_ClearStencil(ctx
->Exec
, (s
));
1149 static void GLAPIENTRY
1150 save_ClipPlane(GLenum plane
, const GLdouble
* equ
)
1152 GET_CURRENT_CONTEXT(ctx
);
1154 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1155 n
= alloc_instruction(ctx
, OPCODE_CLIP_PLANE
, 5);
1158 n
[2].f
= (GLfloat
) equ
[0];
1159 n
[3].f
= (GLfloat
) equ
[1];
1160 n
[4].f
= (GLfloat
) equ
[2];
1161 n
[5].f
= (GLfloat
) equ
[3];
1163 if (ctx
->ExecuteFlag
) {
1164 CALL_ClipPlane(ctx
->Exec
, (plane
, equ
));
1170 static void GLAPIENTRY
1171 save_ColorMask(GLboolean red
, GLboolean green
,
1172 GLboolean blue
, GLboolean alpha
)
1174 GET_CURRENT_CONTEXT(ctx
);
1176 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1177 n
= alloc_instruction(ctx
, OPCODE_COLOR_MASK
, 4);
1184 if (ctx
->ExecuteFlag
) {
1185 CALL_ColorMask(ctx
->Exec
, (red
, green
, blue
, alpha
));
1190 static void GLAPIENTRY
1191 save_ColorMaterial(GLenum face
, GLenum mode
)
1193 GET_CURRENT_CONTEXT(ctx
);
1195 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1197 n
= alloc_instruction(ctx
, OPCODE_COLOR_MATERIAL
, 2);
1202 if (ctx
->ExecuteFlag
) {
1203 CALL_ColorMaterial(ctx
->Exec
, (face
, mode
));
1208 static void GLAPIENTRY
1209 save_ColorTable(GLenum target
, GLenum internalFormat
,
1210 GLsizei width
, GLenum format
, GLenum type
,
1211 const GLvoid
* table
)
1213 GET_CURRENT_CONTEXT(ctx
);
1214 if (_mesa_is_proxy_texture(target
)) {
1215 /* execute immediately */
1216 CALL_ColorTable(ctx
->Exec
, (target
, internalFormat
, width
,
1217 format
, type
, table
));
1221 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1222 n
= alloc_instruction(ctx
, OPCODE_COLOR_TABLE
, 6);
1225 n
[2].e
= internalFormat
;
1229 n
[6].data
= unpack_image(ctx
, 1, width
, 1, 1, format
, type
, table
,
1232 if (ctx
->ExecuteFlag
) {
1233 CALL_ColorTable(ctx
->Exec
, (target
, internalFormat
, width
,
1234 format
, type
, table
));
1241 static void GLAPIENTRY
1242 save_ColorTableParameterfv(GLenum target
, GLenum pname
,
1243 const GLfloat
*params
)
1245 GET_CURRENT_CONTEXT(ctx
);
1248 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1250 n
= alloc_instruction(ctx
, OPCODE_COLOR_TABLE_PARAMETER_FV
, 6);
1255 if (pname
== GL_COLOR_TABLE_SGI
||
1256 pname
== GL_POST_CONVOLUTION_COLOR_TABLE_SGI
||
1257 pname
== GL_TEXTURE_COLOR_TABLE_SGI
) {
1264 if (ctx
->ExecuteFlag
) {
1265 CALL_ColorTableParameterfv(ctx
->Exec
, (target
, pname
, params
));
1270 static void GLAPIENTRY
1271 save_ColorTableParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
1273 GET_CURRENT_CONTEXT(ctx
);
1276 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1278 n
= alloc_instruction(ctx
, OPCODE_COLOR_TABLE_PARAMETER_IV
, 6);
1283 if (pname
== GL_COLOR_TABLE_SGI
||
1284 pname
== GL_POST_CONVOLUTION_COLOR_TABLE_SGI
||
1285 pname
== GL_TEXTURE_COLOR_TABLE_SGI
) {
1292 if (ctx
->ExecuteFlag
) {
1293 CALL_ColorTableParameteriv(ctx
->Exec
, (target
, pname
, params
));
1299 static void GLAPIENTRY
1300 save_ColorSubTable(GLenum target
, GLsizei start
, GLsizei count
,
1301 GLenum format
, GLenum type
, const GLvoid
* table
)
1303 GET_CURRENT_CONTEXT(ctx
);
1305 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1306 n
= alloc_instruction(ctx
, OPCODE_COLOR_SUB_TABLE
, 6);
1313 n
[6].data
= unpack_image(ctx
, 1, count
, 1, 1, format
, type
, table
,
1316 if (ctx
->ExecuteFlag
) {
1317 CALL_ColorSubTable(ctx
->Exec
,
1318 (target
, start
, count
, format
, type
, table
));
1323 static void GLAPIENTRY
1324 save_CopyColorSubTable(GLenum target
, GLsizei start
,
1325 GLint x
, GLint y
, GLsizei width
)
1327 GET_CURRENT_CONTEXT(ctx
);
1330 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1331 n
= alloc_instruction(ctx
, OPCODE_COPY_COLOR_SUB_TABLE
, 5);
1339 if (ctx
->ExecuteFlag
) {
1340 CALL_CopyColorSubTable(ctx
->Exec
, (target
, start
, x
, y
, width
));
1345 static void GLAPIENTRY
1346 save_CopyColorTable(GLenum target
, GLenum internalformat
,
1347 GLint x
, GLint y
, GLsizei width
)
1349 GET_CURRENT_CONTEXT(ctx
);
1352 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1353 n
= alloc_instruction(ctx
, OPCODE_COPY_COLOR_TABLE
, 5);
1356 n
[2].e
= internalformat
;
1361 if (ctx
->ExecuteFlag
) {
1362 CALL_CopyColorTable(ctx
->Exec
, (target
, internalformat
, x
, y
, width
));
1367 static void GLAPIENTRY
1368 save_ConvolutionFilter1D(GLenum target
, GLenum internalFormat
, GLsizei width
,
1369 GLenum format
, GLenum type
, const GLvoid
* filter
)
1371 GET_CURRENT_CONTEXT(ctx
);
1374 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1376 n
= alloc_instruction(ctx
, OPCODE_CONVOLUTION_FILTER_1D
, 6);
1379 n
[2].e
= internalFormat
;
1383 n
[6].data
= unpack_image(ctx
, 1, width
, 1, 1, format
, type
, filter
,
1386 if (ctx
->ExecuteFlag
) {
1387 CALL_ConvolutionFilter1D(ctx
->Exec
, (target
, internalFormat
, width
,
1388 format
, type
, filter
));
1393 static void GLAPIENTRY
1394 save_ConvolutionFilter2D(GLenum target
, GLenum internalFormat
,
1395 GLsizei width
, GLsizei height
, GLenum format
,
1396 GLenum type
, const GLvoid
* filter
)
1398 GET_CURRENT_CONTEXT(ctx
);
1401 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1403 n
= alloc_instruction(ctx
, OPCODE_CONVOLUTION_FILTER_2D
, 7);
1406 n
[2].e
= internalFormat
;
1411 n
[7].data
= unpack_image(ctx
, 2, width
, height
, 1, format
, type
, filter
,
1414 if (ctx
->ExecuteFlag
) {
1415 CALL_ConvolutionFilter2D(ctx
->Exec
,
1416 (target
, internalFormat
, width
, height
, format
,
1422 static void GLAPIENTRY
1423 save_ConvolutionParameteri(GLenum target
, GLenum pname
, GLint param
)
1425 GET_CURRENT_CONTEXT(ctx
);
1427 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1428 n
= alloc_instruction(ctx
, OPCODE_CONVOLUTION_PARAMETER_I
, 3);
1434 if (ctx
->ExecuteFlag
) {
1435 CALL_ConvolutionParameteri(ctx
->Exec
, (target
, pname
, param
));
1440 static void GLAPIENTRY
1441 save_ConvolutionParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
1443 GET_CURRENT_CONTEXT(ctx
);
1445 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1446 n
= alloc_instruction(ctx
, OPCODE_CONVOLUTION_PARAMETER_IV
, 6);
1451 if (pname
== GL_CONVOLUTION_BORDER_COLOR
||
1452 pname
== GL_CONVOLUTION_FILTER_SCALE
||
1453 pname
== GL_CONVOLUTION_FILTER_BIAS
) {
1459 n
[4].i
= n
[5].i
= n
[6].i
= 0;
1462 if (ctx
->ExecuteFlag
) {
1463 CALL_ConvolutionParameteriv(ctx
->Exec
, (target
, pname
, params
));
1468 static void GLAPIENTRY
1469 save_ConvolutionParameterf(GLenum target
, GLenum pname
, GLfloat param
)
1471 GET_CURRENT_CONTEXT(ctx
);
1473 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1474 n
= alloc_instruction(ctx
, OPCODE_CONVOLUTION_PARAMETER_F
, 3);
1480 if (ctx
->ExecuteFlag
) {
1481 CALL_ConvolutionParameterf(ctx
->Exec
, (target
, pname
, param
));
1486 static void GLAPIENTRY
1487 save_ConvolutionParameterfv(GLenum target
, GLenum pname
,
1488 const GLfloat
*params
)
1490 GET_CURRENT_CONTEXT(ctx
);
1492 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1493 n
= alloc_instruction(ctx
, OPCODE_CONVOLUTION_PARAMETER_FV
, 6);
1498 if (pname
== GL_CONVOLUTION_BORDER_COLOR
||
1499 pname
== GL_CONVOLUTION_FILTER_SCALE
||
1500 pname
== GL_CONVOLUTION_FILTER_BIAS
) {
1506 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
1509 if (ctx
->ExecuteFlag
) {
1510 CALL_ConvolutionParameterfv(ctx
->Exec
, (target
, pname
, params
));
1515 static void GLAPIENTRY
1516 save_CopyPixels(GLint x
, GLint y
, GLsizei width
, GLsizei height
, GLenum type
)
1518 GET_CURRENT_CONTEXT(ctx
);
1520 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1521 n
= alloc_instruction(ctx
, OPCODE_COPY_PIXELS
, 5);
1525 n
[3].i
= (GLint
) width
;
1526 n
[4].i
= (GLint
) height
;
1529 if (ctx
->ExecuteFlag
) {
1530 CALL_CopyPixels(ctx
->Exec
, (x
, y
, width
, height
, type
));
1536 static void GLAPIENTRY
1537 save_CopyTexImage1D(GLenum target
, GLint level
, GLenum internalformat
,
1538 GLint x
, GLint y
, GLsizei width
, GLint border
)
1540 GET_CURRENT_CONTEXT(ctx
);
1542 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1543 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_IMAGE1D
, 7);
1547 n
[3].e
= internalformat
;
1553 if (ctx
->ExecuteFlag
) {
1554 CALL_CopyTexImage1D(ctx
->Exec
, (target
, level
, internalformat
,
1555 x
, y
, width
, border
));
1560 static void GLAPIENTRY
1561 save_CopyTexImage2D(GLenum target
, GLint level
,
1562 GLenum internalformat
,
1563 GLint x
, GLint y
, GLsizei width
,
1564 GLsizei height
, GLint border
)
1566 GET_CURRENT_CONTEXT(ctx
);
1568 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1569 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_IMAGE2D
, 8);
1573 n
[3].e
= internalformat
;
1580 if (ctx
->ExecuteFlag
) {
1581 CALL_CopyTexImage2D(ctx
->Exec
, (target
, level
, internalformat
,
1582 x
, y
, width
, height
, border
));
1588 static void GLAPIENTRY
1589 save_CopyTexSubImage1D(GLenum target
, GLint level
,
1590 GLint xoffset
, GLint x
, GLint y
, GLsizei width
)
1592 GET_CURRENT_CONTEXT(ctx
);
1594 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1595 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE1D
, 6);
1604 if (ctx
->ExecuteFlag
) {
1605 CALL_CopyTexSubImage1D(ctx
->Exec
,
1606 (target
, level
, xoffset
, x
, y
, width
));
1611 static void GLAPIENTRY
1612 save_CopyTexSubImage2D(GLenum target
, GLint level
,
1613 GLint xoffset
, GLint yoffset
,
1614 GLint x
, GLint y
, GLsizei width
, GLint height
)
1616 GET_CURRENT_CONTEXT(ctx
);
1618 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1619 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE2D
, 8);
1630 if (ctx
->ExecuteFlag
) {
1631 CALL_CopyTexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
1632 x
, y
, width
, height
));
1637 static void GLAPIENTRY
1638 save_CopyTexSubImage3D(GLenum target
, GLint level
,
1639 GLint xoffset
, GLint yoffset
, GLint zoffset
,
1640 GLint x
, GLint y
, GLsizei width
, GLint height
)
1642 GET_CURRENT_CONTEXT(ctx
);
1644 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1645 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE3D
, 9);
1657 if (ctx
->ExecuteFlag
) {
1658 CALL_CopyTexSubImage3D(ctx
->Exec
, (target
, level
,
1659 xoffset
, yoffset
, zoffset
,
1660 x
, y
, width
, height
));
1665 static void GLAPIENTRY
1666 save_CullFace(GLenum mode
)
1668 GET_CURRENT_CONTEXT(ctx
);
1670 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1671 n
= alloc_instruction(ctx
, OPCODE_CULL_FACE
, 1);
1675 if (ctx
->ExecuteFlag
) {
1676 CALL_CullFace(ctx
->Exec
, (mode
));
1681 static void GLAPIENTRY
1682 save_DepthFunc(GLenum func
)
1684 GET_CURRENT_CONTEXT(ctx
);
1686 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1687 n
= alloc_instruction(ctx
, OPCODE_DEPTH_FUNC
, 1);
1691 if (ctx
->ExecuteFlag
) {
1692 CALL_DepthFunc(ctx
->Exec
, (func
));
1697 static void GLAPIENTRY
1698 save_DepthMask(GLboolean mask
)
1700 GET_CURRENT_CONTEXT(ctx
);
1702 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1703 n
= alloc_instruction(ctx
, OPCODE_DEPTH_MASK
, 1);
1707 if (ctx
->ExecuteFlag
) {
1708 CALL_DepthMask(ctx
->Exec
, (mask
));
1713 static void GLAPIENTRY
1714 save_DepthRange(GLclampd nearval
, GLclampd farval
)
1716 GET_CURRENT_CONTEXT(ctx
);
1718 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1719 n
= alloc_instruction(ctx
, OPCODE_DEPTH_RANGE
, 2);
1721 n
[1].f
= (GLfloat
) nearval
;
1722 n
[2].f
= (GLfloat
) farval
;
1724 if (ctx
->ExecuteFlag
) {
1725 CALL_DepthRange(ctx
->Exec
, (nearval
, farval
));
1730 static void GLAPIENTRY
1731 save_Disable(GLenum cap
)
1733 GET_CURRENT_CONTEXT(ctx
);
1735 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1736 n
= alloc_instruction(ctx
, OPCODE_DISABLE
, 1);
1740 if (ctx
->ExecuteFlag
) {
1741 CALL_Disable(ctx
->Exec
, (cap
));
1746 static void GLAPIENTRY
1747 save_DrawBuffer(GLenum mode
)
1749 GET_CURRENT_CONTEXT(ctx
);
1751 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1752 n
= alloc_instruction(ctx
, OPCODE_DRAW_BUFFER
, 1);
1756 if (ctx
->ExecuteFlag
) {
1757 CALL_DrawBuffer(ctx
->Exec
, (mode
));
1762 static void GLAPIENTRY
1763 save_DrawPixels(GLsizei width
, GLsizei height
,
1764 GLenum format
, GLenum type
, const GLvoid
* pixels
)
1766 GET_CURRENT_CONTEXT(ctx
);
1769 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1771 n
= alloc_instruction(ctx
, OPCODE_DRAW_PIXELS
, 5);
1777 n
[5].data
= unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
1778 pixels
, &ctx
->Unpack
);
1780 if (ctx
->ExecuteFlag
) {
1781 CALL_DrawPixels(ctx
->Exec
, (width
, height
, format
, type
, pixels
));
1787 static void GLAPIENTRY
1788 save_Enable(GLenum cap
)
1790 GET_CURRENT_CONTEXT(ctx
);
1792 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1793 n
= alloc_instruction(ctx
, OPCODE_ENABLE
, 1);
1797 if (ctx
->ExecuteFlag
) {
1798 CALL_Enable(ctx
->Exec
, (cap
));
1804 static void GLAPIENTRY
1805 save_EvalMesh1(GLenum mode
, GLint i1
, GLint i2
)
1807 GET_CURRENT_CONTEXT(ctx
);
1809 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1810 n
= alloc_instruction(ctx
, OPCODE_EVALMESH1
, 3);
1816 if (ctx
->ExecuteFlag
) {
1817 CALL_EvalMesh1(ctx
->Exec
, (mode
, i1
, i2
));
1822 static void GLAPIENTRY
1823 save_EvalMesh2(GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
1825 GET_CURRENT_CONTEXT(ctx
);
1827 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1828 n
= alloc_instruction(ctx
, OPCODE_EVALMESH2
, 5);
1836 if (ctx
->ExecuteFlag
) {
1837 CALL_EvalMesh2(ctx
->Exec
, (mode
, i1
, i2
, j1
, j2
));
1844 static void GLAPIENTRY
1845 save_Fogfv(GLenum pname
, const GLfloat
*params
)
1847 GET_CURRENT_CONTEXT(ctx
);
1849 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1850 n
= alloc_instruction(ctx
, OPCODE_FOG
, 5);
1858 if (ctx
->ExecuteFlag
) {
1859 CALL_Fogfv(ctx
->Exec
, (pname
, params
));
1864 static void GLAPIENTRY
1865 save_Fogf(GLenum pname
, GLfloat param
)
1869 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
1870 save_Fogfv(pname
, parray
);
1874 static void GLAPIENTRY
1875 save_Fogiv(GLenum pname
, const GLint
*params
)
1880 case GL_FOG_DENSITY
:
1884 p
[0] = (GLfloat
) *params
;
1890 p
[0] = INT_TO_FLOAT(params
[0]);
1891 p
[1] = INT_TO_FLOAT(params
[1]);
1892 p
[2] = INT_TO_FLOAT(params
[2]);
1893 p
[3] = INT_TO_FLOAT(params
[3]);
1896 /* Error will be caught later in gl_Fogfv */
1897 ASSIGN_4V(p
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
1899 save_Fogfv(pname
, p
);
1903 static void GLAPIENTRY
1904 save_Fogi(GLenum pname
, GLint param
)
1908 parray
[1] = parray
[2] = parray
[3] = 0;
1909 save_Fogiv(pname
, parray
);
1913 static void GLAPIENTRY
1914 save_FrontFace(GLenum mode
)
1916 GET_CURRENT_CONTEXT(ctx
);
1918 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1919 n
= alloc_instruction(ctx
, OPCODE_FRONT_FACE
, 1);
1923 if (ctx
->ExecuteFlag
) {
1924 CALL_FrontFace(ctx
->Exec
, (mode
));
1929 static void GLAPIENTRY
1930 save_Frustum(GLdouble left
, GLdouble right
,
1931 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
1933 GET_CURRENT_CONTEXT(ctx
);
1935 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1936 n
= alloc_instruction(ctx
, OPCODE_FRUSTUM
, 6);
1938 n
[1].f
= (GLfloat
) left
;
1939 n
[2].f
= (GLfloat
) right
;
1940 n
[3].f
= (GLfloat
) bottom
;
1941 n
[4].f
= (GLfloat
) top
;
1942 n
[5].f
= (GLfloat
) nearval
;
1943 n
[6].f
= (GLfloat
) farval
;
1945 if (ctx
->ExecuteFlag
) {
1946 CALL_Frustum(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
1951 static void GLAPIENTRY
1952 save_Hint(GLenum target
, GLenum mode
)
1954 GET_CURRENT_CONTEXT(ctx
);
1956 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1957 n
= alloc_instruction(ctx
, OPCODE_HINT
, 2);
1962 if (ctx
->ExecuteFlag
) {
1963 CALL_Hint(ctx
->Exec
, (target
, mode
));
1968 static void GLAPIENTRY
1969 save_Histogram(GLenum target
, GLsizei width
, GLenum internalFormat
,
1972 GET_CURRENT_CONTEXT(ctx
);
1975 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1976 n
= alloc_instruction(ctx
, OPCODE_HISTOGRAM
, 4);
1980 n
[3].e
= internalFormat
;
1983 if (ctx
->ExecuteFlag
) {
1984 CALL_Histogram(ctx
->Exec
, (target
, width
, internalFormat
, sink
));
1989 static void GLAPIENTRY
1990 save_IndexMask(GLuint mask
)
1992 GET_CURRENT_CONTEXT(ctx
);
1994 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1995 n
= alloc_instruction(ctx
, OPCODE_INDEX_MASK
, 1);
1999 if (ctx
->ExecuteFlag
) {
2000 CALL_IndexMask(ctx
->Exec
, (mask
));
2005 static void GLAPIENTRY
2006 save_InitNames(void)
2008 GET_CURRENT_CONTEXT(ctx
);
2009 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2010 (void) alloc_instruction(ctx
, OPCODE_INIT_NAMES
, 0);
2011 if (ctx
->ExecuteFlag
) {
2012 CALL_InitNames(ctx
->Exec
, ());
2017 static void GLAPIENTRY
2018 save_Lightfv(GLenum light
, GLenum pname
, const GLfloat
*params
)
2020 GET_CURRENT_CONTEXT(ctx
);
2022 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2023 n
= alloc_instruction(ctx
, OPCODE_LIGHT
, 6);
2041 case GL_SPOT_DIRECTION
:
2044 case GL_SPOT_EXPONENT
:
2047 case GL_SPOT_CUTOFF
:
2050 case GL_CONSTANT_ATTENUATION
:
2053 case GL_LINEAR_ATTENUATION
:
2056 case GL_QUADRATIC_ATTENUATION
:
2062 for (i
= 0; i
< nParams
; i
++) {
2063 n
[3 + i
].f
= params
[i
];
2066 if (ctx
->ExecuteFlag
) {
2067 CALL_Lightfv(ctx
->Exec
, (light
, pname
, params
));
2072 static void GLAPIENTRY
2073 save_Lightf(GLenum light
, GLenum pname
, GLfloat param
)
2077 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2078 save_Lightfv(light
, pname
, parray
);
2082 static void GLAPIENTRY
2083 save_Lightiv(GLenum light
, GLenum pname
, const GLint
*params
)
2090 fparam
[0] = INT_TO_FLOAT(params
[0]);
2091 fparam
[1] = INT_TO_FLOAT(params
[1]);
2092 fparam
[2] = INT_TO_FLOAT(params
[2]);
2093 fparam
[3] = INT_TO_FLOAT(params
[3]);
2096 fparam
[0] = (GLfloat
) params
[0];
2097 fparam
[1] = (GLfloat
) params
[1];
2098 fparam
[2] = (GLfloat
) params
[2];
2099 fparam
[3] = (GLfloat
) params
[3];
2101 case GL_SPOT_DIRECTION
:
2102 fparam
[0] = (GLfloat
) params
[0];
2103 fparam
[1] = (GLfloat
) params
[1];
2104 fparam
[2] = (GLfloat
) params
[2];
2106 case GL_SPOT_EXPONENT
:
2107 case GL_SPOT_CUTOFF
:
2108 case GL_CONSTANT_ATTENUATION
:
2109 case GL_LINEAR_ATTENUATION
:
2110 case GL_QUADRATIC_ATTENUATION
:
2111 fparam
[0] = (GLfloat
) params
[0];
2114 /* error will be caught later in gl_Lightfv */
2117 save_Lightfv(light
, pname
, fparam
);
2121 static void GLAPIENTRY
2122 save_Lighti(GLenum light
, GLenum pname
, GLint param
)
2126 parray
[1] = parray
[2] = parray
[3] = 0;
2127 save_Lightiv(light
, pname
, parray
);
2131 static void GLAPIENTRY
2132 save_LightModelfv(GLenum pname
, const GLfloat
*params
)
2134 GET_CURRENT_CONTEXT(ctx
);
2136 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2137 n
= alloc_instruction(ctx
, OPCODE_LIGHT_MODEL
, 5);
2145 if (ctx
->ExecuteFlag
) {
2146 CALL_LightModelfv(ctx
->Exec
, (pname
, params
));
2151 static void GLAPIENTRY
2152 save_LightModelf(GLenum pname
, GLfloat param
)
2156 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2157 save_LightModelfv(pname
, parray
);
2161 static void GLAPIENTRY
2162 save_LightModeliv(GLenum pname
, const GLint
*params
)
2166 case GL_LIGHT_MODEL_AMBIENT
:
2167 fparam
[0] = INT_TO_FLOAT(params
[0]);
2168 fparam
[1] = INT_TO_FLOAT(params
[1]);
2169 fparam
[2] = INT_TO_FLOAT(params
[2]);
2170 fparam
[3] = INT_TO_FLOAT(params
[3]);
2172 case GL_LIGHT_MODEL_LOCAL_VIEWER
:
2173 case GL_LIGHT_MODEL_TWO_SIDE
:
2174 case GL_LIGHT_MODEL_COLOR_CONTROL
:
2175 fparam
[0] = (GLfloat
) params
[0];
2181 /* Error will be caught later in gl_LightModelfv */
2182 ASSIGN_4V(fparam
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
2184 save_LightModelfv(pname
, fparam
);
2188 static void GLAPIENTRY
2189 save_LightModeli(GLenum pname
, GLint param
)
2193 parray
[1] = parray
[2] = parray
[3] = 0;
2194 save_LightModeliv(pname
, parray
);
2198 static void GLAPIENTRY
2199 save_LineStipple(GLint factor
, GLushort pattern
)
2201 GET_CURRENT_CONTEXT(ctx
);
2203 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2204 n
= alloc_instruction(ctx
, OPCODE_LINE_STIPPLE
, 2);
2209 if (ctx
->ExecuteFlag
) {
2210 CALL_LineStipple(ctx
->Exec
, (factor
, pattern
));
2215 static void GLAPIENTRY
2216 save_LineWidth(GLfloat width
)
2218 GET_CURRENT_CONTEXT(ctx
);
2220 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2221 n
= alloc_instruction(ctx
, OPCODE_LINE_WIDTH
, 1);
2225 if (ctx
->ExecuteFlag
) {
2226 CALL_LineWidth(ctx
->Exec
, (width
));
2231 static void GLAPIENTRY
2232 save_ListBase(GLuint base
)
2234 GET_CURRENT_CONTEXT(ctx
);
2236 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2237 n
= alloc_instruction(ctx
, OPCODE_LIST_BASE
, 1);
2241 if (ctx
->ExecuteFlag
) {
2242 CALL_ListBase(ctx
->Exec
, (base
));
2247 static void GLAPIENTRY
2248 save_LoadIdentity(void)
2250 GET_CURRENT_CONTEXT(ctx
);
2251 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2252 (void) alloc_instruction(ctx
, OPCODE_LOAD_IDENTITY
, 0);
2253 if (ctx
->ExecuteFlag
) {
2254 CALL_LoadIdentity(ctx
->Exec
, ());
2259 static void GLAPIENTRY
2260 save_LoadMatrixf(const GLfloat
* m
)
2262 GET_CURRENT_CONTEXT(ctx
);
2264 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2265 n
= alloc_instruction(ctx
, OPCODE_LOAD_MATRIX
, 16);
2268 for (i
= 0; i
< 16; i
++) {
2272 if (ctx
->ExecuteFlag
) {
2273 CALL_LoadMatrixf(ctx
->Exec
, (m
));
2278 static void GLAPIENTRY
2279 save_LoadMatrixd(const GLdouble
* m
)
2283 for (i
= 0; i
< 16; i
++) {
2284 f
[i
] = (GLfloat
) m
[i
];
2286 save_LoadMatrixf(f
);
2290 static void GLAPIENTRY
2291 save_LoadName(GLuint name
)
2293 GET_CURRENT_CONTEXT(ctx
);
2295 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2296 n
= alloc_instruction(ctx
, OPCODE_LOAD_NAME
, 1);
2300 if (ctx
->ExecuteFlag
) {
2301 CALL_LoadName(ctx
->Exec
, (name
));
2306 static void GLAPIENTRY
2307 save_LogicOp(GLenum opcode
)
2309 GET_CURRENT_CONTEXT(ctx
);
2311 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2312 n
= alloc_instruction(ctx
, OPCODE_LOGIC_OP
, 1);
2316 if (ctx
->ExecuteFlag
) {
2317 CALL_LogicOp(ctx
->Exec
, (opcode
));
2322 static void GLAPIENTRY
2323 save_Map1d(GLenum target
, GLdouble u1
, GLdouble u2
, GLint stride
,
2324 GLint order
, const GLdouble
* points
)
2326 GET_CURRENT_CONTEXT(ctx
);
2328 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2329 n
= alloc_instruction(ctx
, OPCODE_MAP1
, 6);
2331 GLfloat
*pnts
= _mesa_copy_map_points1d(target
, stride
, order
, points
);
2333 n
[2].f
= (GLfloat
) u1
;
2334 n
[3].f
= (GLfloat
) u2
;
2335 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2337 n
[6].data
= (void *) pnts
;
2339 if (ctx
->ExecuteFlag
) {
2340 CALL_Map1d(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2344 static void GLAPIENTRY
2345 save_Map1f(GLenum target
, GLfloat u1
, GLfloat u2
, GLint stride
,
2346 GLint order
, const GLfloat
* points
)
2348 GET_CURRENT_CONTEXT(ctx
);
2350 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2351 n
= alloc_instruction(ctx
, OPCODE_MAP1
, 6);
2353 GLfloat
*pnts
= _mesa_copy_map_points1f(target
, stride
, order
, points
);
2357 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2359 n
[6].data
= (void *) pnts
;
2361 if (ctx
->ExecuteFlag
) {
2362 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2367 static void GLAPIENTRY
2368 save_Map2d(GLenum target
,
2369 GLdouble u1
, GLdouble u2
, GLint ustride
, GLint uorder
,
2370 GLdouble v1
, GLdouble v2
, GLint vstride
, GLint vorder
,
2371 const GLdouble
* points
)
2373 GET_CURRENT_CONTEXT(ctx
);
2375 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2376 n
= alloc_instruction(ctx
, OPCODE_MAP2
, 10);
2378 GLfloat
*pnts
= _mesa_copy_map_points2d(target
, ustride
, uorder
,
2379 vstride
, vorder
, points
);
2381 n
[2].f
= (GLfloat
) u1
;
2382 n
[3].f
= (GLfloat
) u2
;
2383 n
[4].f
= (GLfloat
) v1
;
2384 n
[5].f
= (GLfloat
) v2
;
2385 /* XXX verify these strides are correct */
2386 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2387 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2390 n
[10].data
= (void *) pnts
;
2392 if (ctx
->ExecuteFlag
) {
2393 CALL_Map2d(ctx
->Exec
, (target
,
2394 u1
, u2
, ustride
, uorder
,
2395 v1
, v2
, vstride
, vorder
, points
));
2400 static void GLAPIENTRY
2401 save_Map2f(GLenum target
,
2402 GLfloat u1
, GLfloat u2
, GLint ustride
, GLint uorder
,
2403 GLfloat v1
, GLfloat v2
, GLint vstride
, GLint vorder
,
2404 const GLfloat
* points
)
2406 GET_CURRENT_CONTEXT(ctx
);
2408 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2409 n
= alloc_instruction(ctx
, OPCODE_MAP2
, 10);
2411 GLfloat
*pnts
= _mesa_copy_map_points2f(target
, ustride
, uorder
,
2412 vstride
, vorder
, points
);
2418 /* XXX verify these strides are correct */
2419 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2420 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2423 n
[10].data
= (void *) pnts
;
2425 if (ctx
->ExecuteFlag
) {
2426 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
2427 v1
, v2
, vstride
, vorder
, points
));
2432 static void GLAPIENTRY
2433 save_MapGrid1f(GLint un
, GLfloat u1
, GLfloat u2
)
2435 GET_CURRENT_CONTEXT(ctx
);
2437 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2438 n
= alloc_instruction(ctx
, OPCODE_MAPGRID1
, 3);
2444 if (ctx
->ExecuteFlag
) {
2445 CALL_MapGrid1f(ctx
->Exec
, (un
, u1
, u2
));
2450 static void GLAPIENTRY
2451 save_MapGrid1d(GLint un
, GLdouble u1
, GLdouble u2
)
2453 save_MapGrid1f(un
, (GLfloat
) u1
, (GLfloat
) u2
);
2457 static void GLAPIENTRY
2458 save_MapGrid2f(GLint un
, GLfloat u1
, GLfloat u2
,
2459 GLint vn
, GLfloat v1
, GLfloat v2
)
2461 GET_CURRENT_CONTEXT(ctx
);
2463 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2464 n
= alloc_instruction(ctx
, OPCODE_MAPGRID2
, 6);
2473 if (ctx
->ExecuteFlag
) {
2474 CALL_MapGrid2f(ctx
->Exec
, (un
, u1
, u2
, vn
, v1
, v2
));
2480 static void GLAPIENTRY
2481 save_MapGrid2d(GLint un
, GLdouble u1
, GLdouble u2
,
2482 GLint vn
, GLdouble v1
, GLdouble v2
)
2484 save_MapGrid2f(un
, (GLfloat
) u1
, (GLfloat
) u2
,
2485 vn
, (GLfloat
) v1
, (GLfloat
) v2
);
2489 static void GLAPIENTRY
2490 save_MatrixMode(GLenum mode
)
2492 GET_CURRENT_CONTEXT(ctx
);
2494 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2495 n
= alloc_instruction(ctx
, OPCODE_MATRIX_MODE
, 1);
2499 if (ctx
->ExecuteFlag
) {
2500 CALL_MatrixMode(ctx
->Exec
, (mode
));
2505 static void GLAPIENTRY
2506 save_Minmax(GLenum target
, GLenum internalFormat
, GLboolean sink
)
2508 GET_CURRENT_CONTEXT(ctx
);
2511 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2512 n
= alloc_instruction(ctx
, OPCODE_MIN_MAX
, 3);
2515 n
[2].e
= internalFormat
;
2518 if (ctx
->ExecuteFlag
) {
2519 CALL_Minmax(ctx
->Exec
, (target
, internalFormat
, sink
));
2524 static void GLAPIENTRY
2525 save_MultMatrixf(const GLfloat
* m
)
2527 GET_CURRENT_CONTEXT(ctx
);
2529 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2530 n
= alloc_instruction(ctx
, OPCODE_MULT_MATRIX
, 16);
2533 for (i
= 0; i
< 16; i
++) {
2537 if (ctx
->ExecuteFlag
) {
2538 CALL_MultMatrixf(ctx
->Exec
, (m
));
2543 static void GLAPIENTRY
2544 save_MultMatrixd(const GLdouble
* m
)
2548 for (i
= 0; i
< 16; i
++) {
2549 f
[i
] = (GLfloat
) m
[i
];
2551 save_MultMatrixf(f
);
2555 static void GLAPIENTRY
2556 save_NewList(GLuint name
, GLenum mode
)
2558 GET_CURRENT_CONTEXT(ctx
);
2559 /* It's an error to call this function while building a display list */
2560 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
2567 static void GLAPIENTRY
2568 save_Ortho(GLdouble left
, GLdouble right
,
2569 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
2571 GET_CURRENT_CONTEXT(ctx
);
2573 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2574 n
= alloc_instruction(ctx
, OPCODE_ORTHO
, 6);
2576 n
[1].f
= (GLfloat
) left
;
2577 n
[2].f
= (GLfloat
) right
;
2578 n
[3].f
= (GLfloat
) bottom
;
2579 n
[4].f
= (GLfloat
) top
;
2580 n
[5].f
= (GLfloat
) nearval
;
2581 n
[6].f
= (GLfloat
) farval
;
2583 if (ctx
->ExecuteFlag
) {
2584 CALL_Ortho(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
2589 static void GLAPIENTRY
2590 save_PixelMapfv(GLenum map
, GLint mapsize
, const GLfloat
*values
)
2592 GET_CURRENT_CONTEXT(ctx
);
2594 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2595 n
= alloc_instruction(ctx
, OPCODE_PIXEL_MAP
, 3);
2599 n
[3].data
= (void *) malloc(mapsize
* sizeof(GLfloat
));
2600 memcpy(n
[3].data
, (void *) values
, mapsize
* sizeof(GLfloat
));
2602 if (ctx
->ExecuteFlag
) {
2603 CALL_PixelMapfv(ctx
->Exec
, (map
, mapsize
, values
));
2608 static void GLAPIENTRY
2609 save_PixelMapuiv(GLenum map
, GLint mapsize
, const GLuint
*values
)
2611 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2613 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
2614 for (i
= 0; i
< mapsize
; i
++) {
2615 fvalues
[i
] = (GLfloat
) values
[i
];
2619 for (i
= 0; i
< mapsize
; i
++) {
2620 fvalues
[i
] = UINT_TO_FLOAT(values
[i
]);
2623 save_PixelMapfv(map
, mapsize
, fvalues
);
2627 static void GLAPIENTRY
2628 save_PixelMapusv(GLenum map
, GLint mapsize
, const GLushort
*values
)
2630 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2632 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
2633 for (i
= 0; i
< mapsize
; i
++) {
2634 fvalues
[i
] = (GLfloat
) values
[i
];
2638 for (i
= 0; i
< mapsize
; i
++) {
2639 fvalues
[i
] = USHORT_TO_FLOAT(values
[i
]);
2642 save_PixelMapfv(map
, mapsize
, fvalues
);
2646 static void GLAPIENTRY
2647 save_PixelTransferf(GLenum pname
, GLfloat param
)
2649 GET_CURRENT_CONTEXT(ctx
);
2651 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2652 n
= alloc_instruction(ctx
, OPCODE_PIXEL_TRANSFER
, 2);
2657 if (ctx
->ExecuteFlag
) {
2658 CALL_PixelTransferf(ctx
->Exec
, (pname
, param
));
2663 static void GLAPIENTRY
2664 save_PixelTransferi(GLenum pname
, GLint param
)
2666 save_PixelTransferf(pname
, (GLfloat
) param
);
2670 static void GLAPIENTRY
2671 save_PixelZoom(GLfloat xfactor
, GLfloat yfactor
)
2673 GET_CURRENT_CONTEXT(ctx
);
2675 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2676 n
= alloc_instruction(ctx
, OPCODE_PIXEL_ZOOM
, 2);
2681 if (ctx
->ExecuteFlag
) {
2682 CALL_PixelZoom(ctx
->Exec
, (xfactor
, yfactor
));
2687 static void GLAPIENTRY
2688 save_PointParameterfvEXT(GLenum pname
, const GLfloat
*params
)
2690 GET_CURRENT_CONTEXT(ctx
);
2692 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2693 n
= alloc_instruction(ctx
, OPCODE_POINT_PARAMETERS
, 4);
2700 if (ctx
->ExecuteFlag
) {
2701 CALL_PointParameterfvEXT(ctx
->Exec
, (pname
, params
));
2706 static void GLAPIENTRY
2707 save_PointParameterfEXT(GLenum pname
, GLfloat param
)
2711 parray
[1] = parray
[2] = 0.0F
;
2712 save_PointParameterfvEXT(pname
, parray
);
2715 static void GLAPIENTRY
2716 save_PointParameteriNV(GLenum pname
, GLint param
)
2719 parray
[0] = (GLfloat
) param
;
2720 parray
[1] = parray
[2] = 0.0F
;
2721 save_PointParameterfvEXT(pname
, parray
);
2724 static void GLAPIENTRY
2725 save_PointParameterivNV(GLenum pname
, const GLint
* param
)
2728 parray
[0] = (GLfloat
) param
[0];
2729 parray
[1] = parray
[2] = 0.0F
;
2730 save_PointParameterfvEXT(pname
, parray
);
2734 static void GLAPIENTRY
2735 save_PointSize(GLfloat size
)
2737 GET_CURRENT_CONTEXT(ctx
);
2739 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2740 n
= alloc_instruction(ctx
, OPCODE_POINT_SIZE
, 1);
2744 if (ctx
->ExecuteFlag
) {
2745 CALL_PointSize(ctx
->Exec
, (size
));
2750 static void GLAPIENTRY
2751 save_PolygonMode(GLenum face
, GLenum mode
)
2753 GET_CURRENT_CONTEXT(ctx
);
2755 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2756 n
= alloc_instruction(ctx
, OPCODE_POLYGON_MODE
, 2);
2761 if (ctx
->ExecuteFlag
) {
2762 CALL_PolygonMode(ctx
->Exec
, (face
, mode
));
2767 static void GLAPIENTRY
2768 save_PolygonStipple(const GLubyte
* pattern
)
2770 GET_CURRENT_CONTEXT(ctx
);
2773 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2775 n
= alloc_instruction(ctx
, OPCODE_POLYGON_STIPPLE
, 1);
2777 n
[1].data
= unpack_image(ctx
, 2, 32, 32, 1, GL_COLOR_INDEX
, GL_BITMAP
,
2778 pattern
, &ctx
->Unpack
);
2780 if (ctx
->ExecuteFlag
) {
2781 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) pattern
));
2786 static void GLAPIENTRY
2787 save_PolygonOffset(GLfloat factor
, GLfloat units
)
2789 GET_CURRENT_CONTEXT(ctx
);
2791 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2792 n
= alloc_instruction(ctx
, OPCODE_POLYGON_OFFSET
, 2);
2797 if (ctx
->ExecuteFlag
) {
2798 CALL_PolygonOffset(ctx
->Exec
, (factor
, units
));
2803 static void GLAPIENTRY
2804 save_PolygonOffsetEXT(GLfloat factor
, GLfloat bias
)
2806 GET_CURRENT_CONTEXT(ctx
);
2807 /* XXX mult by DepthMaxF here??? */
2808 save_PolygonOffset(factor
, ctx
->DrawBuffer
->_DepthMaxF
* bias
);
2812 static void GLAPIENTRY
2813 save_PopAttrib(void)
2815 GET_CURRENT_CONTEXT(ctx
);
2816 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2817 (void) alloc_instruction(ctx
, OPCODE_POP_ATTRIB
, 0);
2818 if (ctx
->ExecuteFlag
) {
2819 CALL_PopAttrib(ctx
->Exec
, ());
2824 static void GLAPIENTRY
2825 save_PopMatrix(void)
2827 GET_CURRENT_CONTEXT(ctx
);
2828 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2829 (void) alloc_instruction(ctx
, OPCODE_POP_MATRIX
, 0);
2830 if (ctx
->ExecuteFlag
) {
2831 CALL_PopMatrix(ctx
->Exec
, ());
2836 static void GLAPIENTRY
2839 GET_CURRENT_CONTEXT(ctx
);
2840 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2841 (void) alloc_instruction(ctx
, OPCODE_POP_NAME
, 0);
2842 if (ctx
->ExecuteFlag
) {
2843 CALL_PopName(ctx
->Exec
, ());
2848 static void GLAPIENTRY
2849 save_PrioritizeTextures(GLsizei num
, const GLuint
* textures
,
2850 const GLclampf
* priorities
)
2852 GET_CURRENT_CONTEXT(ctx
);
2854 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2856 for (i
= 0; i
< num
; i
++) {
2858 n
= alloc_instruction(ctx
, OPCODE_PRIORITIZE_TEXTURE
, 2);
2860 n
[1].ui
= textures
[i
];
2861 n
[2].f
= priorities
[i
];
2864 if (ctx
->ExecuteFlag
) {
2865 CALL_PrioritizeTextures(ctx
->Exec
, (num
, textures
, priorities
));
2870 static void GLAPIENTRY
2871 save_PushAttrib(GLbitfield mask
)
2873 GET_CURRENT_CONTEXT(ctx
);
2875 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2876 n
= alloc_instruction(ctx
, OPCODE_PUSH_ATTRIB
, 1);
2880 if (ctx
->ExecuteFlag
) {
2881 CALL_PushAttrib(ctx
->Exec
, (mask
));
2886 static void GLAPIENTRY
2887 save_PushMatrix(void)
2889 GET_CURRENT_CONTEXT(ctx
);
2890 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2891 (void) alloc_instruction(ctx
, OPCODE_PUSH_MATRIX
, 0);
2892 if (ctx
->ExecuteFlag
) {
2893 CALL_PushMatrix(ctx
->Exec
, ());
2898 static void GLAPIENTRY
2899 save_PushName(GLuint name
)
2901 GET_CURRENT_CONTEXT(ctx
);
2903 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2904 n
= alloc_instruction(ctx
, OPCODE_PUSH_NAME
, 1);
2908 if (ctx
->ExecuteFlag
) {
2909 CALL_PushName(ctx
->Exec
, (name
));
2914 static void GLAPIENTRY
2915 save_RasterPos4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
2917 GET_CURRENT_CONTEXT(ctx
);
2919 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2920 n
= alloc_instruction(ctx
, OPCODE_RASTER_POS
, 4);
2927 if (ctx
->ExecuteFlag
) {
2928 CALL_RasterPos4f(ctx
->Exec
, (x
, y
, z
, w
));
2932 static void GLAPIENTRY
2933 save_RasterPos2d(GLdouble x
, GLdouble y
)
2935 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
2938 static void GLAPIENTRY
2939 save_RasterPos2f(GLfloat x
, GLfloat y
)
2941 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2944 static void GLAPIENTRY
2945 save_RasterPos2i(GLint x
, GLint y
)
2947 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
2950 static void GLAPIENTRY
2951 save_RasterPos2s(GLshort x
, GLshort y
)
2953 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2956 static void GLAPIENTRY
2957 save_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
2959 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
2962 static void GLAPIENTRY
2963 save_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
2965 save_RasterPos4f(x
, y
, z
, 1.0F
);
2968 static void GLAPIENTRY
2969 save_RasterPos3i(GLint x
, GLint y
, GLint z
)
2971 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
2974 static void GLAPIENTRY
2975 save_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
2977 save_RasterPos4f(x
, y
, z
, 1.0F
);
2980 static void GLAPIENTRY
2981 save_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
2983 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
2986 static void GLAPIENTRY
2987 save_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
2989 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
2992 static void GLAPIENTRY
2993 save_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
2995 save_RasterPos4f(x
, y
, z
, w
);
2998 static void GLAPIENTRY
2999 save_RasterPos2dv(const GLdouble
* v
)
3001 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3004 static void GLAPIENTRY
3005 save_RasterPos2fv(const GLfloat
* v
)
3007 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3010 static void GLAPIENTRY
3011 save_RasterPos2iv(const GLint
* v
)
3013 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3016 static void GLAPIENTRY
3017 save_RasterPos2sv(const GLshort
* v
)
3019 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3022 static void GLAPIENTRY
3023 save_RasterPos3dv(const GLdouble
* v
)
3025 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3028 static void GLAPIENTRY
3029 save_RasterPos3fv(const GLfloat
* v
)
3031 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3034 static void GLAPIENTRY
3035 save_RasterPos3iv(const GLint
* v
)
3037 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3040 static void GLAPIENTRY
3041 save_RasterPos3sv(const GLshort
* v
)
3043 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3046 static void GLAPIENTRY
3047 save_RasterPos4dv(const GLdouble
* v
)
3049 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3050 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3053 static void GLAPIENTRY
3054 save_RasterPos4fv(const GLfloat
* v
)
3056 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3059 static void GLAPIENTRY
3060 save_RasterPos4iv(const GLint
* v
)
3062 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3063 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3066 static void GLAPIENTRY
3067 save_RasterPos4sv(const GLshort
* v
)
3069 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3073 static void GLAPIENTRY
3074 save_PassThrough(GLfloat token
)
3076 GET_CURRENT_CONTEXT(ctx
);
3078 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3079 n
= alloc_instruction(ctx
, OPCODE_PASSTHROUGH
, 1);
3083 if (ctx
->ExecuteFlag
) {
3084 CALL_PassThrough(ctx
->Exec
, (token
));
3089 static void GLAPIENTRY
3090 save_ReadBuffer(GLenum mode
)
3092 GET_CURRENT_CONTEXT(ctx
);
3094 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3095 n
= alloc_instruction(ctx
, OPCODE_READ_BUFFER
, 1);
3099 if (ctx
->ExecuteFlag
) {
3100 CALL_ReadBuffer(ctx
->Exec
, (mode
));
3105 static void GLAPIENTRY
3106 save_ResetHistogram(GLenum target
)
3108 GET_CURRENT_CONTEXT(ctx
);
3110 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3111 n
= alloc_instruction(ctx
, OPCODE_RESET_HISTOGRAM
, 1);
3115 if (ctx
->ExecuteFlag
) {
3116 CALL_ResetHistogram(ctx
->Exec
, (target
));
3121 static void GLAPIENTRY
3122 save_ResetMinmax(GLenum target
)
3124 GET_CURRENT_CONTEXT(ctx
);
3126 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3127 n
= alloc_instruction(ctx
, OPCODE_RESET_MIN_MAX
, 1);
3131 if (ctx
->ExecuteFlag
) {
3132 CALL_ResetMinmax(ctx
->Exec
, (target
));
3137 static void GLAPIENTRY
3138 save_Rotatef(GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
3140 GET_CURRENT_CONTEXT(ctx
);
3142 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3143 n
= alloc_instruction(ctx
, OPCODE_ROTATE
, 4);
3150 if (ctx
->ExecuteFlag
) {
3151 CALL_Rotatef(ctx
->Exec
, (angle
, x
, y
, z
));
3156 static void GLAPIENTRY
3157 save_Rotated(GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
3159 save_Rotatef((GLfloat
) angle
, (GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3163 static void GLAPIENTRY
3164 save_Scalef(GLfloat x
, GLfloat y
, GLfloat z
)
3166 GET_CURRENT_CONTEXT(ctx
);
3168 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3169 n
= alloc_instruction(ctx
, OPCODE_SCALE
, 3);
3175 if (ctx
->ExecuteFlag
) {
3176 CALL_Scalef(ctx
->Exec
, (x
, y
, z
));
3181 static void GLAPIENTRY
3182 save_Scaled(GLdouble x
, GLdouble y
, GLdouble z
)
3184 save_Scalef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3188 static void GLAPIENTRY
3189 save_Scissor(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3191 GET_CURRENT_CONTEXT(ctx
);
3193 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3194 n
= alloc_instruction(ctx
, OPCODE_SCISSOR
, 4);
3201 if (ctx
->ExecuteFlag
) {
3202 CALL_Scissor(ctx
->Exec
, (x
, y
, width
, height
));
3207 static void GLAPIENTRY
3208 save_ShadeModel(GLenum mode
)
3210 GET_CURRENT_CONTEXT(ctx
);
3212 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx
);
3214 if (ctx
->ExecuteFlag
) {
3215 CALL_ShadeModel(ctx
->Exec
, (mode
));
3218 if (ctx
->ListState
.Current
.ShadeModel
== mode
)
3221 SAVE_FLUSH_VERTICES(ctx
);
3223 /* Only save the value if we know the statechange will take effect:
3225 if (ctx
->Driver
.CurrentSavePrimitive
== PRIM_OUTSIDE_BEGIN_END
)
3226 ctx
->ListState
.Current
.ShadeModel
= mode
;
3228 n
= alloc_instruction(ctx
, OPCODE_SHADE_MODEL
, 1);
3235 static void GLAPIENTRY
3236 save_StencilFunc(GLenum func
, GLint ref
, GLuint mask
)
3238 GET_CURRENT_CONTEXT(ctx
);
3240 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3241 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC
, 3);
3247 if (ctx
->ExecuteFlag
) {
3248 CALL_StencilFunc(ctx
->Exec
, (func
, ref
, mask
));
3253 static void GLAPIENTRY
3254 save_StencilMask(GLuint mask
)
3256 GET_CURRENT_CONTEXT(ctx
);
3258 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3259 n
= alloc_instruction(ctx
, OPCODE_STENCIL_MASK
, 1);
3263 if (ctx
->ExecuteFlag
) {
3264 CALL_StencilMask(ctx
->Exec
, (mask
));
3269 static void GLAPIENTRY
3270 save_StencilOp(GLenum fail
, GLenum zfail
, GLenum zpass
)
3272 GET_CURRENT_CONTEXT(ctx
);
3274 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3275 n
= alloc_instruction(ctx
, OPCODE_STENCIL_OP
, 3);
3281 if (ctx
->ExecuteFlag
) {
3282 CALL_StencilOp(ctx
->Exec
, (fail
, zfail
, zpass
));
3287 static void GLAPIENTRY
3288 save_TexEnvfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3290 GET_CURRENT_CONTEXT(ctx
);
3292 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3293 n
= alloc_instruction(ctx
, OPCODE_TEXENV
, 6);
3297 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3305 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
3308 if (ctx
->ExecuteFlag
) {
3309 CALL_TexEnvfv(ctx
->Exec
, (target
, pname
, params
));
3314 static void GLAPIENTRY
3315 save_TexEnvf(GLenum target
, GLenum pname
, GLfloat param
)
3318 parray
[0] = (GLfloat
) param
;
3319 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3320 save_TexEnvfv(target
, pname
, parray
);
3324 static void GLAPIENTRY
3325 save_TexEnvi(GLenum target
, GLenum pname
, GLint param
)
3328 p
[0] = (GLfloat
) param
;
3329 p
[1] = p
[2] = p
[3] = 0.0F
;
3330 save_TexEnvfv(target
, pname
, p
);
3334 static void GLAPIENTRY
3335 save_TexEnviv(GLenum target
, GLenum pname
, const GLint
* param
)
3338 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3339 p
[0] = INT_TO_FLOAT(param
[0]);
3340 p
[1] = INT_TO_FLOAT(param
[1]);
3341 p
[2] = INT_TO_FLOAT(param
[2]);
3342 p
[3] = INT_TO_FLOAT(param
[3]);
3345 p
[0] = (GLfloat
) param
[0];
3346 p
[1] = p
[2] = p
[3] = 0.0F
;
3348 save_TexEnvfv(target
, pname
, p
);
3352 static void GLAPIENTRY
3353 save_TexGenfv(GLenum coord
, GLenum pname
, const GLfloat
*params
)
3355 GET_CURRENT_CONTEXT(ctx
);
3357 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3358 n
= alloc_instruction(ctx
, OPCODE_TEXGEN
, 6);
3367 if (ctx
->ExecuteFlag
) {
3368 CALL_TexGenfv(ctx
->Exec
, (coord
, pname
, params
));
3373 static void GLAPIENTRY
3374 save_TexGeniv(GLenum coord
, GLenum pname
, const GLint
*params
)
3377 p
[0] = (GLfloat
) params
[0];
3378 p
[1] = (GLfloat
) params
[1];
3379 p
[2] = (GLfloat
) params
[2];
3380 p
[3] = (GLfloat
) params
[3];
3381 save_TexGenfv(coord
, pname
, p
);
3385 static void GLAPIENTRY
3386 save_TexGend(GLenum coord
, GLenum pname
, GLdouble param
)
3389 parray
[0] = (GLfloat
) param
;
3390 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3391 save_TexGenfv(coord
, pname
, parray
);
3395 static void GLAPIENTRY
3396 save_TexGendv(GLenum coord
, GLenum pname
, const GLdouble
*params
)
3399 p
[0] = (GLfloat
) params
[0];
3400 p
[1] = (GLfloat
) params
[1];
3401 p
[2] = (GLfloat
) params
[2];
3402 p
[3] = (GLfloat
) params
[3];
3403 save_TexGenfv(coord
, pname
, p
);
3407 static void GLAPIENTRY
3408 save_TexGenf(GLenum coord
, GLenum pname
, GLfloat param
)
3412 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3413 save_TexGenfv(coord
, pname
, parray
);
3417 static void GLAPIENTRY
3418 save_TexGeni(GLenum coord
, GLenum pname
, GLint param
)
3422 parray
[1] = parray
[2] = parray
[3] = 0;
3423 save_TexGeniv(coord
, pname
, parray
);
3427 static void GLAPIENTRY
3428 save_TexParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3430 GET_CURRENT_CONTEXT(ctx
);
3432 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3433 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER
, 6);
3442 if (ctx
->ExecuteFlag
) {
3443 CALL_TexParameterfv(ctx
->Exec
, (target
, pname
, params
));
3448 static void GLAPIENTRY
3449 save_TexParameterf(GLenum target
, GLenum pname
, GLfloat param
)
3453 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3454 save_TexParameterfv(target
, pname
, parray
);
3458 static void GLAPIENTRY
3459 save_TexParameteri(GLenum target
, GLenum pname
, GLint param
)
3462 fparam
[0] = (GLfloat
) param
;
3463 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
3464 save_TexParameterfv(target
, pname
, fparam
);
3468 static void GLAPIENTRY
3469 save_TexParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
3472 fparam
[0] = (GLfloat
) params
[0];
3473 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
3474 save_TexParameterfv(target
, pname
, fparam
);
3478 static void GLAPIENTRY
3479 save_TexImage1D(GLenum target
,
3480 GLint level
, GLint components
,
3481 GLsizei width
, GLint border
,
3482 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3484 GET_CURRENT_CONTEXT(ctx
);
3485 if (target
== GL_PROXY_TEXTURE_1D
) {
3486 /* don't compile, execute immediately */
3487 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
3488 border
, format
, type
, pixels
));
3492 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3493 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE1D
, 8);
3497 n
[3].i
= components
;
3498 n
[4].i
= (GLint
) width
;
3502 n
[8].data
= unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
3503 pixels
, &ctx
->Unpack
);
3505 if (ctx
->ExecuteFlag
) {
3506 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
3507 border
, format
, type
, pixels
));
3513 static void GLAPIENTRY
3514 save_TexImage2D(GLenum target
,
3515 GLint level
, GLint components
,
3516 GLsizei width
, GLsizei height
, GLint border
,
3517 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3519 GET_CURRENT_CONTEXT(ctx
);
3520 if (target
== GL_PROXY_TEXTURE_2D
) {
3521 /* don't compile, execute immediately */
3522 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
3523 height
, border
, format
, type
, pixels
));
3527 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3528 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE2D
, 9);
3532 n
[3].i
= components
;
3533 n
[4].i
= (GLint
) width
;
3534 n
[5].i
= (GLint
) height
;
3538 n
[9].data
= unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
3539 pixels
, &ctx
->Unpack
);
3541 if (ctx
->ExecuteFlag
) {
3542 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
3543 height
, border
, format
, type
, pixels
));
3549 static void GLAPIENTRY
3550 save_TexImage3D(GLenum target
,
3551 GLint level
, GLint internalFormat
,
3552 GLsizei width
, GLsizei height
, GLsizei depth
,
3554 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3556 GET_CURRENT_CONTEXT(ctx
);
3557 if (target
== GL_PROXY_TEXTURE_3D
) {
3558 /* don't compile, execute immediately */
3559 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
3560 height
, depth
, border
, format
, type
,
3565 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3566 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE3D
, 10);
3570 n
[3].i
= (GLint
) internalFormat
;
3571 n
[4].i
= (GLint
) width
;
3572 n
[5].i
= (GLint
) height
;
3573 n
[6].i
= (GLint
) depth
;
3577 n
[10].data
= unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
3578 pixels
, &ctx
->Unpack
);
3580 if (ctx
->ExecuteFlag
) {
3581 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
3582 height
, depth
, border
, format
, type
,
3589 static void GLAPIENTRY
3590 save_TexSubImage1D(GLenum target
, GLint level
, GLint xoffset
,
3591 GLsizei width
, GLenum format
, GLenum type
,
3592 const GLvoid
* pixels
)
3594 GET_CURRENT_CONTEXT(ctx
);
3597 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3599 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE1D
, 7);
3604 n
[4].i
= (GLint
) width
;
3607 n
[7].data
= unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
3608 pixels
, &ctx
->Unpack
);
3610 if (ctx
->ExecuteFlag
) {
3611 CALL_TexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
, width
,
3612 format
, type
, pixels
));
3617 static void GLAPIENTRY
3618 save_TexSubImage2D(GLenum target
, GLint level
,
3619 GLint xoffset
, GLint yoffset
,
3620 GLsizei width
, GLsizei height
,
3621 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3623 GET_CURRENT_CONTEXT(ctx
);
3626 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3628 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE2D
, 9);
3634 n
[5].i
= (GLint
) width
;
3635 n
[6].i
= (GLint
) height
;
3638 n
[9].data
= unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
3639 pixels
, &ctx
->Unpack
);
3641 if (ctx
->ExecuteFlag
) {
3642 CALL_TexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
3643 width
, height
, format
, type
, pixels
));
3648 static void GLAPIENTRY
3649 save_TexSubImage3D(GLenum target
, GLint level
,
3650 GLint xoffset
, GLint yoffset
, GLint zoffset
,
3651 GLsizei width
, GLsizei height
, GLsizei depth
,
3652 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3654 GET_CURRENT_CONTEXT(ctx
);
3657 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3659 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE3D
, 11);
3666 n
[6].i
= (GLint
) width
;
3667 n
[7].i
= (GLint
) height
;
3668 n
[8].i
= (GLint
) depth
;
3671 n
[11].data
= unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
3672 pixels
, &ctx
->Unpack
);
3674 if (ctx
->ExecuteFlag
) {
3675 CALL_TexSubImage3D(ctx
->Exec
, (target
, level
,
3676 xoffset
, yoffset
, zoffset
,
3677 width
, height
, depth
, format
, type
,
3683 static void GLAPIENTRY
3684 save_Translatef(GLfloat x
, GLfloat y
, GLfloat z
)
3686 GET_CURRENT_CONTEXT(ctx
);
3688 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3689 n
= alloc_instruction(ctx
, OPCODE_TRANSLATE
, 3);
3695 if (ctx
->ExecuteFlag
) {
3696 CALL_Translatef(ctx
->Exec
, (x
, y
, z
));
3701 static void GLAPIENTRY
3702 save_Translated(GLdouble x
, GLdouble y
, GLdouble z
)
3704 save_Translatef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3709 static void GLAPIENTRY
3710 save_Viewport(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3712 GET_CURRENT_CONTEXT(ctx
);
3714 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3715 n
= alloc_instruction(ctx
, OPCODE_VIEWPORT
, 4);
3719 n
[3].i
= (GLint
) width
;
3720 n
[4].i
= (GLint
) height
;
3722 if (ctx
->ExecuteFlag
) {
3723 CALL_Viewport(ctx
->Exec
, (x
, y
, width
, height
));
3728 static void GLAPIENTRY
3729 save_WindowPos4fMESA(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3731 GET_CURRENT_CONTEXT(ctx
);
3733 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3734 n
= alloc_instruction(ctx
, OPCODE_WINDOW_POS
, 4);
3741 if (ctx
->ExecuteFlag
) {
3742 CALL_WindowPos4fMESA(ctx
->Exec
, (x
, y
, z
, w
));
3746 static void GLAPIENTRY
3747 save_WindowPos2dMESA(GLdouble x
, GLdouble y
)
3749 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3752 static void GLAPIENTRY
3753 save_WindowPos2fMESA(GLfloat x
, GLfloat y
)
3755 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3758 static void GLAPIENTRY
3759 save_WindowPos2iMESA(GLint x
, GLint y
)
3761 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3764 static void GLAPIENTRY
3765 save_WindowPos2sMESA(GLshort x
, GLshort y
)
3767 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3770 static void GLAPIENTRY
3771 save_WindowPos3dMESA(GLdouble x
, GLdouble y
, GLdouble z
)
3773 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3776 static void GLAPIENTRY
3777 save_WindowPos3fMESA(GLfloat x
, GLfloat y
, GLfloat z
)
3779 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3782 static void GLAPIENTRY
3783 save_WindowPos3iMESA(GLint x
, GLint y
, GLint z
)
3785 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3788 static void GLAPIENTRY
3789 save_WindowPos3sMESA(GLshort x
, GLshort y
, GLshort z
)
3791 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3794 static void GLAPIENTRY
3795 save_WindowPos4dMESA(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3797 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3800 static void GLAPIENTRY
3801 save_WindowPos4iMESA(GLint x
, GLint y
, GLint z
, GLint w
)
3803 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3806 static void GLAPIENTRY
3807 save_WindowPos4sMESA(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
3809 save_WindowPos4fMESA(x
, y
, z
, w
);
3812 static void GLAPIENTRY
3813 save_WindowPos2dvMESA(const GLdouble
* v
)
3815 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3818 static void GLAPIENTRY
3819 save_WindowPos2fvMESA(const GLfloat
* v
)
3821 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3824 static void GLAPIENTRY
3825 save_WindowPos2ivMESA(const GLint
* v
)
3827 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3830 static void GLAPIENTRY
3831 save_WindowPos2svMESA(const GLshort
* v
)
3833 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3836 static void GLAPIENTRY
3837 save_WindowPos3dvMESA(const GLdouble
* v
)
3839 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3842 static void GLAPIENTRY
3843 save_WindowPos3fvMESA(const GLfloat
* v
)
3845 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3848 static void GLAPIENTRY
3849 save_WindowPos3ivMESA(const GLint
* v
)
3851 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3854 static void GLAPIENTRY
3855 save_WindowPos3svMESA(const GLshort
* v
)
3857 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3860 static void GLAPIENTRY
3861 save_WindowPos4dvMESA(const GLdouble
* v
)
3863 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
3864 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3867 static void GLAPIENTRY
3868 save_WindowPos4fvMESA(const GLfloat
* v
)
3870 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3873 static void GLAPIENTRY
3874 save_WindowPos4ivMESA(const GLint
* v
)
3876 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
3877 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3880 static void GLAPIENTRY
3881 save_WindowPos4svMESA(const GLshort
* v
)
3883 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3887 /* GL_ARB_transpose_matrix */
3889 static void GLAPIENTRY
3890 save_LoadTransposeMatrixdARB(const GLdouble m
[16])
3893 _math_transposefd(tm
, m
);
3894 save_LoadMatrixf(tm
);
3898 static void GLAPIENTRY
3899 save_LoadTransposeMatrixfARB(const GLfloat m
[16])
3902 _math_transposef(tm
, m
);
3903 save_LoadMatrixf(tm
);
3907 static void GLAPIENTRY
3908 save_MultTransposeMatrixdARB(const GLdouble m
[16])
3911 _math_transposefd(tm
, m
);
3912 save_MultMatrixf(tm
);
3916 static void GLAPIENTRY
3917 save_MultTransposeMatrixfARB(const GLfloat m
[16])
3920 _math_transposef(tm
, m
);
3921 save_MultMatrixf(tm
);
3925 /* GL_ARB_multisample */
3926 static void GLAPIENTRY
3927 save_SampleCoverageARB(GLclampf value
, GLboolean invert
)
3929 GET_CURRENT_CONTEXT(ctx
);
3931 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3932 n
= alloc_instruction(ctx
, OPCODE_SAMPLE_COVERAGE
, 2);
3937 if (ctx
->ExecuteFlag
) {
3938 CALL_SampleCoverageARB(ctx
->Exec
, (value
, invert
));
3944 * GL_NV_vertex_program
3947 #if FEATURE_NV_fragment_program
3948 static void GLAPIENTRY
3949 save_ProgramNamedParameter4fNV(GLuint id
, GLsizei len
, const GLubyte
* name
,
3950 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3952 GET_CURRENT_CONTEXT(ctx
);
3955 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3957 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_NAMED_PARAMETER_NV
, 6);
3959 GLubyte
*nameCopy
= (GLubyte
*) malloc(len
);
3961 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramNamedParameter4fNV");
3964 memcpy(nameCopy
, name
, len
);
3967 n
[3].data
= nameCopy
;
3973 if (ctx
->ExecuteFlag
) {
3974 CALL_ProgramNamedParameter4fNV(ctx
->Exec
, (id
, len
, name
, x
, y
, z
, w
));
3978 static void GLAPIENTRY
3979 save_ProgramNamedParameter4fvNV(GLuint id
, GLsizei len
, const GLubyte
* name
,
3982 save_ProgramNamedParameter4fNV(id
, len
, name
, v
[0], v
[1], v
[2], v
[3]);
3986 static void GLAPIENTRY
3987 save_ProgramNamedParameter4dNV(GLuint id
, GLsizei len
, const GLubyte
* name
,
3988 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3990 save_ProgramNamedParameter4fNV(id
, len
, name
, (GLfloat
) x
, (GLfloat
) y
,
3991 (GLfloat
) z
, (GLfloat
) w
);
3995 static void GLAPIENTRY
3996 save_ProgramNamedParameter4dvNV(GLuint id
, GLsizei len
, const GLubyte
* name
,
3999 save_ProgramNamedParameter4fNV(id
, len
, name
, (GLfloat
) v
[0],
4000 (GLfloat
) v
[1], (GLfloat
) v
[2],
4006 /* GL_EXT_depth_bounds_test */
4007 static void GLAPIENTRY
4008 save_DepthBoundsEXT(GLclampd zmin
, GLclampd zmax
)
4010 GET_CURRENT_CONTEXT(ctx
);
4012 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4013 n
= alloc_instruction(ctx
, OPCODE_DEPTH_BOUNDS_EXT
, 2);
4015 n
[1].f
= (GLfloat
) zmin
;
4016 n
[2].f
= (GLfloat
) zmax
;
4018 if (ctx
->ExecuteFlag
) {
4019 CALL_DepthBoundsEXT(ctx
->Exec
, (zmin
, zmax
));
4023 static void GLAPIENTRY
4024 save_Attr1fNV(GLenum attr
, GLfloat x
)
4026 GET_CURRENT_CONTEXT(ctx
);
4028 SAVE_FLUSH_VERTICES(ctx
);
4029 n
= alloc_instruction(ctx
, OPCODE_ATTR_1F_NV
, 2);
4035 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
4036 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
4037 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
4039 if (ctx
->ExecuteFlag
) {
4040 CALL_VertexAttrib1fNV(ctx
->Exec
, (attr
, x
));
4044 static void GLAPIENTRY
4045 save_Attr2fNV(GLenum attr
, GLfloat x
, GLfloat y
)
4047 GET_CURRENT_CONTEXT(ctx
);
4049 SAVE_FLUSH_VERTICES(ctx
);
4050 n
= alloc_instruction(ctx
, OPCODE_ATTR_2F_NV
, 3);
4057 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
4058 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
4059 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
4061 if (ctx
->ExecuteFlag
) {
4062 CALL_VertexAttrib2fNV(ctx
->Exec
, (attr
, x
, y
));
4066 static void GLAPIENTRY
4067 save_Attr3fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
4069 GET_CURRENT_CONTEXT(ctx
);
4071 SAVE_FLUSH_VERTICES(ctx
);
4072 n
= alloc_instruction(ctx
, OPCODE_ATTR_3F_NV
, 4);
4080 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
4081 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
4082 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
4084 if (ctx
->ExecuteFlag
) {
4085 CALL_VertexAttrib3fNV(ctx
->Exec
, (attr
, x
, y
, z
));
4089 static void GLAPIENTRY
4090 save_Attr4fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4092 GET_CURRENT_CONTEXT(ctx
);
4094 SAVE_FLUSH_VERTICES(ctx
);
4095 n
= alloc_instruction(ctx
, OPCODE_ATTR_4F_NV
, 5);
4104 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
4105 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
4106 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
4108 if (ctx
->ExecuteFlag
) {
4109 CALL_VertexAttrib4fNV(ctx
->Exec
, (attr
, x
, y
, z
, w
));
4113 static void GLAPIENTRY
4114 save_EvalCoord1f(GLfloat x
)
4116 GET_CURRENT_CONTEXT(ctx
);
4118 SAVE_FLUSH_VERTICES(ctx
);
4119 n
= alloc_instruction(ctx
, OPCODE_EVAL_C1
, 1);
4123 if (ctx
->ExecuteFlag
) {
4124 CALL_EvalCoord1f(ctx
->Exec
, (x
));
4128 static void GLAPIENTRY
4129 save_EvalCoord1fv(const GLfloat
* v
)
4131 save_EvalCoord1f(v
[0]);
4134 static void GLAPIENTRY
4135 save_EvalCoord2f(GLfloat x
, GLfloat y
)
4137 GET_CURRENT_CONTEXT(ctx
);
4139 SAVE_FLUSH_VERTICES(ctx
);
4140 n
= alloc_instruction(ctx
, OPCODE_EVAL_C2
, 2);
4145 if (ctx
->ExecuteFlag
) {
4146 CALL_EvalCoord2f(ctx
->Exec
, (x
, y
));
4150 static void GLAPIENTRY
4151 save_EvalCoord2fv(const GLfloat
* v
)
4153 save_EvalCoord2f(v
[0], v
[1]);
4157 static void GLAPIENTRY
4158 save_EvalPoint1(GLint x
)
4160 GET_CURRENT_CONTEXT(ctx
);
4162 SAVE_FLUSH_VERTICES(ctx
);
4163 n
= alloc_instruction(ctx
, OPCODE_EVAL_P1
, 1);
4167 if (ctx
->ExecuteFlag
) {
4168 CALL_EvalPoint1(ctx
->Exec
, (x
));
4172 static void GLAPIENTRY
4173 save_EvalPoint2(GLint x
, GLint y
)
4175 GET_CURRENT_CONTEXT(ctx
);
4177 SAVE_FLUSH_VERTICES(ctx
);
4178 n
= alloc_instruction(ctx
, OPCODE_EVAL_P2
, 2);
4183 if (ctx
->ExecuteFlag
) {
4184 CALL_EvalPoint2(ctx
->Exec
, (x
, y
));
4188 static void GLAPIENTRY
4189 save_Indexf(GLfloat x
)
4191 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, x
);
4194 static void GLAPIENTRY
4195 save_Indexfv(const GLfloat
* v
)
4197 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, v
[0]);
4200 static void GLAPIENTRY
4201 save_EdgeFlag(GLboolean x
)
4203 save_Attr1fNV(VERT_ATTRIB_EDGEFLAG
, x
? (GLfloat
)1.0 : (GLfloat
)0.0);
4206 static inline GLboolean
compare4fv( const GLfloat
*a
,
4210 return memcmp( a
, b
, count
* sizeof(GLfloat
) ) == 0;
4214 static void GLAPIENTRY
4215 save_Materialfv(GLenum face
, GLenum pname
, const GLfloat
* param
)
4217 GET_CURRENT_CONTEXT(ctx
);
4225 case GL_FRONT_AND_BACK
:
4228 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "material(face)");
4237 case GL_AMBIENT_AND_DIFFUSE
:
4243 case GL_COLOR_INDEXES
:
4247 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "material(pname)");
4251 if (ctx
->ExecuteFlag
) {
4252 CALL_Materialfv(ctx
->Exec
, (face
, pname
, param
));
4255 bitmask
= _mesa_material_bitmask(ctx
, face
, pname
, ~0, NULL
);
4257 /* Try to eliminate redundant statechanges. Because it is legal to
4258 * call glMaterial even inside begin/end calls, don't need to worry
4259 * about ctx->Driver.CurrentSavePrimitive here.
4261 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++) {
4262 if (bitmask
& (1 << i
)) {
4263 if (ctx
->ListState
.ActiveMaterialSize
[i
] == args
&&
4264 compare4fv(ctx
->ListState
.CurrentMaterial
[i
], param
, args
)) {
4265 bitmask
&= ~(1 << i
);
4268 ctx
->ListState
.ActiveMaterialSize
[i
] = args
;
4269 COPY_SZ_4V(ctx
->ListState
.CurrentMaterial
[i
], args
, param
);
4274 /* If this call has effect, return early:
4279 SAVE_FLUSH_VERTICES(ctx
);
4281 n
= alloc_instruction(ctx
, OPCODE_MATERIAL
, 6);
4285 for (i
= 0; i
< args
; i
++)
4286 n
[3 + i
].f
= param
[i
];
4290 static void GLAPIENTRY
4291 save_Begin(GLenum mode
)
4293 GET_CURRENT_CONTEXT(ctx
);
4295 GLboolean error
= GL_FALSE
;
4297 if (!_mesa_valid_prim_mode(ctx
, mode
)) {
4298 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glBegin(mode)");
4301 else if (ctx
->Driver
.CurrentSavePrimitive
== PRIM_UNKNOWN
) {
4302 /* Typically the first begin. This may raise an error on
4303 * playback, depending on whether CallList is issued from inside
4304 * a begin/end or not.
4306 ctx
->Driver
.CurrentSavePrimitive
= PRIM_INSIDE_UNKNOWN_PRIM
;
4308 else if (ctx
->Driver
.CurrentSavePrimitive
== PRIM_OUTSIDE_BEGIN_END
) {
4309 ctx
->Driver
.CurrentSavePrimitive
= mode
;
4312 _mesa_compile_error(ctx
, GL_INVALID_OPERATION
, "recursive begin");
4317 /* Give the driver an opportunity to hook in an optimized
4318 * display list compiler.
4320 if (ctx
->Driver
.NotifySaveBegin(ctx
, mode
))
4323 SAVE_FLUSH_VERTICES(ctx
);
4324 n
= alloc_instruction(ctx
, OPCODE_BEGIN
, 1);
4330 if (ctx
->ExecuteFlag
) {
4331 CALL_Begin(ctx
->Exec
, (mode
));
4335 static void GLAPIENTRY
4338 GET_CURRENT_CONTEXT(ctx
);
4339 SAVE_FLUSH_VERTICES(ctx
);
4340 (void) alloc_instruction(ctx
, OPCODE_END
, 0);
4341 ctx
->Driver
.CurrentSavePrimitive
= PRIM_OUTSIDE_BEGIN_END
;
4342 if (ctx
->ExecuteFlag
) {
4343 CALL_End(ctx
->Exec
, ());
4347 static void GLAPIENTRY
4348 save_Rectf(GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
4350 GET_CURRENT_CONTEXT(ctx
);
4352 SAVE_FLUSH_VERTICES(ctx
);
4353 n
= alloc_instruction(ctx
, OPCODE_RECTF
, 4);
4360 if (ctx
->ExecuteFlag
) {
4361 CALL_Rectf(ctx
->Exec
, (a
, b
, c
, d
));
4366 static void GLAPIENTRY
4367 save_Vertex2f(GLfloat x
, GLfloat y
)
4369 save_Attr2fNV(VERT_ATTRIB_POS
, x
, y
);
4372 static void GLAPIENTRY
4373 save_Vertex2fv(const GLfloat
* v
)
4375 save_Attr2fNV(VERT_ATTRIB_POS
, v
[0], v
[1]);
4378 static void GLAPIENTRY
4379 save_Vertex3f(GLfloat x
, GLfloat y
, GLfloat z
)
4381 save_Attr3fNV(VERT_ATTRIB_POS
, x
, y
, z
);
4384 static void GLAPIENTRY
4385 save_Vertex3fv(const GLfloat
* v
)
4387 save_Attr3fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2]);
4390 static void GLAPIENTRY
4391 save_Vertex4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4393 save_Attr4fNV(VERT_ATTRIB_POS
, x
, y
, z
, w
);
4396 static void GLAPIENTRY
4397 save_Vertex4fv(const GLfloat
* v
)
4399 save_Attr4fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2], v
[3]);
4402 static void GLAPIENTRY
4403 save_TexCoord1f(GLfloat x
)
4405 save_Attr1fNV(VERT_ATTRIB_TEX
, x
);
4408 static void GLAPIENTRY
4409 save_TexCoord1fv(const GLfloat
* v
)
4411 save_Attr1fNV(VERT_ATTRIB_TEX
, v
[0]);
4414 static void GLAPIENTRY
4415 save_TexCoord2f(GLfloat x
, GLfloat y
)
4417 save_Attr2fNV(VERT_ATTRIB_TEX
, x
, y
);
4420 static void GLAPIENTRY
4421 save_TexCoord2fv(const GLfloat
* v
)
4423 save_Attr2fNV(VERT_ATTRIB_TEX
, v
[0], v
[1]);
4426 static void GLAPIENTRY
4427 save_TexCoord3f(GLfloat x
, GLfloat y
, GLfloat z
)
4429 save_Attr3fNV(VERT_ATTRIB_TEX
, x
, y
, z
);
4432 static void GLAPIENTRY
4433 save_TexCoord3fv(const GLfloat
* v
)
4435 save_Attr3fNV(VERT_ATTRIB_TEX
, v
[0], v
[1], v
[2]);
4438 static void GLAPIENTRY
4439 save_TexCoord4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4441 save_Attr4fNV(VERT_ATTRIB_TEX
, x
, y
, z
, w
);
4444 static void GLAPIENTRY
4445 save_TexCoord4fv(const GLfloat
* v
)
4447 save_Attr4fNV(VERT_ATTRIB_TEX
, v
[0], v
[1], v
[2], v
[3]);
4450 static void GLAPIENTRY
4451 save_Normal3f(GLfloat x
, GLfloat y
, GLfloat z
)
4453 save_Attr3fNV(VERT_ATTRIB_NORMAL
, x
, y
, z
);
4456 static void GLAPIENTRY
4457 save_Normal3fv(const GLfloat
* v
)
4459 save_Attr3fNV(VERT_ATTRIB_NORMAL
, v
[0], v
[1], v
[2]);
4462 static void GLAPIENTRY
4463 save_FogCoordfEXT(GLfloat x
)
4465 save_Attr1fNV(VERT_ATTRIB_FOG
, x
);
4468 static void GLAPIENTRY
4469 save_FogCoordfvEXT(const GLfloat
* v
)
4471 save_Attr1fNV(VERT_ATTRIB_FOG
, v
[0]);
4474 static void GLAPIENTRY
4475 save_Color3f(GLfloat x
, GLfloat y
, GLfloat z
)
4477 save_Attr3fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
);
4480 static void GLAPIENTRY
4481 save_Color3fv(const GLfloat
* v
)
4483 save_Attr3fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2]);
4486 static void GLAPIENTRY
4487 save_Color4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4489 save_Attr4fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
, w
);
4492 static void GLAPIENTRY
4493 save_Color4fv(const GLfloat
* v
)
4495 save_Attr4fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2], v
[3]);
4498 static void GLAPIENTRY
4499 save_SecondaryColor3fEXT(GLfloat x
, GLfloat y
, GLfloat z
)
4501 save_Attr3fNV(VERT_ATTRIB_COLOR1
, x
, y
, z
);
4504 static void GLAPIENTRY
4505 save_SecondaryColor3fvEXT(const GLfloat
* v
)
4507 save_Attr3fNV(VERT_ATTRIB_COLOR1
, v
[0], v
[1], v
[2]);
4512 * Record a GL_INVALID_VALUE error when a invalid vertex attribute
4518 GET_CURRENT_CONTEXT(ctx
);
4519 _mesa_error(ctx
, GL_INVALID_VALUE
, "VertexAttribf(index)");
4523 /* First level for NV_vertex_program:
4525 * Check for errors at compile time?.
4527 static void GLAPIENTRY
4528 save_VertexAttrib1fNV(GLuint index
, GLfloat x
)
4530 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
)
4531 save_Attr1fNV(index
, x
);
4536 static void GLAPIENTRY
4537 save_VertexAttrib1fvNV(GLuint index
, const GLfloat
* v
)
4539 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
)
4540 save_Attr1fNV(index
, v
[0]);
4545 static void GLAPIENTRY
4546 save_VertexAttrib2fNV(GLuint index
, GLfloat x
, GLfloat y
)
4548 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
)
4549 save_Attr2fNV(index
, x
, y
);
4554 static void GLAPIENTRY
4555 save_VertexAttrib2fvNV(GLuint index
, const GLfloat
* v
)
4557 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
)
4558 save_Attr2fNV(index
, v
[0], v
[1]);
4563 static void GLAPIENTRY
4564 save_VertexAttrib3fNV(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
4566 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
)
4567 save_Attr3fNV(index
, x
, y
, z
);
4572 static void GLAPIENTRY
4573 save_VertexAttrib3fvNV(GLuint index
, const GLfloat
* v
)
4575 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
)
4576 save_Attr3fNV(index
, v
[0], v
[1], v
[2]);
4581 static void GLAPIENTRY
4582 save_VertexAttrib4fNV(GLuint index
, GLfloat x
, GLfloat y
,
4583 GLfloat z
, GLfloat w
)
4585 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
)
4586 save_Attr4fNV(index
, x
, y
, z
, w
);
4591 static void GLAPIENTRY
4592 save_VertexAttrib4fvNV(GLuint index
, const GLfloat
* v
)
4594 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
)
4595 save_Attr4fNV(index
, v
[0], v
[1], v
[2], v
[3]);
4601 /** GL_EXT_texture_integer */
4602 static void GLAPIENTRY
4603 save_ClearColorIi(GLint red
, GLint green
, GLint blue
, GLint alpha
)
4605 GET_CURRENT_CONTEXT(ctx
);
4607 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4608 n
= alloc_instruction(ctx
, OPCODE_CLEARCOLOR_I
, 4);
4615 if (ctx
->ExecuteFlag
) {
4616 CALL_ClearColorIiEXT(ctx
->Exec
, (red
, green
, blue
, alpha
));
4620 /** GL_EXT_texture_integer */
4621 static void GLAPIENTRY
4622 save_ClearColorIui(GLuint red
, GLuint green
, GLuint blue
, GLuint alpha
)
4624 GET_CURRENT_CONTEXT(ctx
);
4626 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4627 n
= alloc_instruction(ctx
, OPCODE_CLEARCOLOR_UI
, 4);
4634 if (ctx
->ExecuteFlag
) {
4635 CALL_ClearColorIuiEXT(ctx
->Exec
, (red
, green
, blue
, alpha
));
4639 /** GL_EXT_texture_integer */
4640 static void GLAPIENTRY
4641 save_TexParameterIiv(GLenum target
, GLenum pname
, const GLint
*params
)
4643 GET_CURRENT_CONTEXT(ctx
);
4645 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4646 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER_I
, 6);
4655 if (ctx
->ExecuteFlag
) {
4656 CALL_TexParameterIivEXT(ctx
->Exec
, (target
, pname
, params
));
4660 /** GL_EXT_texture_integer */
4661 static void GLAPIENTRY
4662 save_TexParameterIuiv(GLenum target
, GLenum pname
, const GLuint
*params
)
4664 GET_CURRENT_CONTEXT(ctx
);
4666 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4667 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER_UI
, 6);
4671 n
[3].ui
= params
[0];
4672 n
[4].ui
= params
[1];
4673 n
[5].ui
= params
[2];
4674 n
[6].ui
= params
[3];
4676 if (ctx
->ExecuteFlag
) {
4677 CALL_TexParameterIuivEXT(ctx
->Exec
, (target
, pname
, params
));
4681 /** GL_EXT_texture_integer */
4682 static void GLAPIENTRY
4683 exec_GetTexParameterIiv(GLenum target
, GLenum pname
, GLint
*params
)
4685 GET_CURRENT_CONTEXT(ctx
);
4686 FLUSH_VERTICES(ctx
, 0);
4687 CALL_GetTexParameterIivEXT(ctx
->Exec
, (target
, pname
, params
));
4690 /** GL_EXT_texture_integer */
4691 static void GLAPIENTRY
4692 exec_GetTexParameterIuiv(GLenum target
, GLenum pname
, GLuint
*params
)
4694 GET_CURRENT_CONTEXT(ctx
);
4695 FLUSH_VERTICES(ctx
, 0);
4696 CALL_GetTexParameterIuivEXT(ctx
->Exec
, (target
, pname
, params
));
4700 /* GL_NV_texture_barrier */
4701 static void GLAPIENTRY
4702 save_TextureBarrierNV(void)
4704 GET_CURRENT_CONTEXT(ctx
);
4705 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4706 alloc_instruction(ctx
, OPCODE_TEXTURE_BARRIER_NV
, 0);
4707 if (ctx
->ExecuteFlag
) {
4708 CALL_TextureBarrierNV(ctx
->Exec
, ());
4713 * Save an error-generating command into display list.
4715 * KW: Will appear in the list before the vertex buffer containing the
4716 * command that provoked the error. I don't see this as a problem.
4719 save_error(struct gl_context
*ctx
, GLenum error
, const char *s
)
4722 n
= alloc_instruction(ctx
, OPCODE_ERROR
, 2);
4725 n
[2].data
= (void *) s
;
4731 * Compile an error into current display list.
4734 _mesa_compile_error(struct gl_context
*ctx
, GLenum error
, const char *s
)
4736 if (ctx
->CompileFlag
)
4737 save_error(ctx
, error
, s
);
4738 if (ctx
->ExecuteFlag
)
4739 _mesa_error(ctx
, error
, "%s", s
);
4744 * Test if ID names a display list.
4747 islist(struct gl_context
*ctx
, GLuint list
)
4749 if (list
> 0 && lookup_list(ctx
, list
)) {
4759 /**********************************************************************/
4760 /* Display list execution */
4761 /**********************************************************************/
4765 * Execute a display list. Note that the ListBase offset must have already
4766 * been added before calling this function. I.e. the list argument is
4767 * the absolute list number, not relative to ListBase.
4768 * \param list - display list number
4771 execute_list(struct gl_context
*ctx
, GLuint list
)
4773 struct gl_display_list
*dlist
;
4777 if (list
== 0 || !islist(ctx
, list
))
4780 if (ctx
->ListState
.CallDepth
== MAX_LIST_NESTING
) {
4781 /* raise an error? */
4785 dlist
= lookup_list(ctx
, list
);
4789 ctx
->ListState
.CallDepth
++;
4791 if (ctx
->Driver
.BeginCallList
)
4792 ctx
->Driver
.BeginCallList(ctx
, dlist
);
4798 const OpCode opcode
= n
[0].opcode
;
4800 if (is_ext_opcode(opcode
)) {
4801 n
+= ext_opcode_execute(ctx
, n
);
4806 _mesa_error(ctx
, n
[1].e
, "%s", (const char *) n
[2].data
);
4809 CALL_Accum(ctx
->Exec
, (n
[1].e
, n
[2].f
));
4811 case OPCODE_ALPHA_FUNC
:
4812 CALL_AlphaFunc(ctx
->Exec
, (n
[1].e
, n
[2].f
));
4814 case OPCODE_BIND_TEXTURE
:
4815 CALL_BindTexture(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
4819 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4820 ctx
->Unpack
= ctx
->DefaultPacking
;
4821 CALL_Bitmap(ctx
->Exec
, ((GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
4822 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
4823 (const GLubyte
*) n
[7].data
));
4824 ctx
->Unpack
= save
; /* restore */
4827 case OPCODE_BLEND_COLOR
:
4828 CALL_BlendColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
4830 case OPCODE_BLEND_EQUATION
:
4831 CALL_BlendEquation(ctx
->Exec
, (n
[1].e
));
4833 case OPCODE_BLEND_EQUATION_SEPARATE
:
4834 CALL_BlendEquationSeparateEXT(ctx
->Exec
, (n
[1].e
, n
[2].e
));
4836 case OPCODE_BLEND_FUNC_SEPARATE
:
4837 CALL_BlendFuncSeparateEXT(ctx
->Exec
,
4838 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
4841 case OPCODE_CALL_LIST
:
4842 /* Generated by glCallList(), don't add ListBase */
4843 if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
4844 execute_list(ctx
, n
[1].ui
);
4847 case OPCODE_CALL_LIST_OFFSET
:
4848 /* Generated by glCallLists() so we must add ListBase */
4850 /* user specified a bad data type at compile time */
4851 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
4853 else if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
4854 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ n
[1].i
);
4855 execute_list(ctx
, list
);
4859 CALL_Clear(ctx
->Exec
, (n
[1].bf
));
4861 case OPCODE_CLEAR_COLOR
:
4862 CALL_ClearColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
4864 case OPCODE_CLEAR_ACCUM
:
4865 CALL_ClearAccum(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
4867 case OPCODE_CLEAR_DEPTH
:
4868 CALL_ClearDepth(ctx
->Exec
, ((GLclampd
) n
[1].f
));
4870 case OPCODE_CLEAR_INDEX
:
4871 CALL_ClearIndex(ctx
->Exec
, ((GLfloat
) n
[1].ui
));
4873 case OPCODE_CLEAR_STENCIL
:
4874 CALL_ClearStencil(ctx
->Exec
, (n
[1].i
));
4876 case OPCODE_CLIP_PLANE
:
4883 CALL_ClipPlane(ctx
->Exec
, (n
[1].e
, eq
));
4886 case OPCODE_COLOR_MASK
:
4887 CALL_ColorMask(ctx
->Exec
, (n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
));
4889 case OPCODE_COLOR_MATERIAL
:
4890 CALL_ColorMaterial(ctx
->Exec
, (n
[1].e
, n
[2].e
));
4892 case OPCODE_COLOR_TABLE
:
4894 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4895 ctx
->Unpack
= ctx
->DefaultPacking
;
4896 CALL_ColorTable(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].e
,
4897 n
[5].e
, n
[6].data
));
4898 ctx
->Unpack
= save
; /* restore */
4901 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
4908 CALL_ColorTableParameterfv(ctx
->Exec
,
4909 (n
[1].e
, n
[2].e
, params
));
4912 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
4919 CALL_ColorTableParameteriv(ctx
->Exec
,
4920 (n
[1].e
, n
[2].e
, params
));
4923 case OPCODE_COLOR_SUB_TABLE
:
4925 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4926 ctx
->Unpack
= ctx
->DefaultPacking
;
4927 CALL_ColorSubTable(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
4928 n
[4].e
, n
[5].e
, n
[6].data
));
4929 ctx
->Unpack
= save
; /* restore */
4932 case OPCODE_CONVOLUTION_FILTER_1D
:
4934 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4935 ctx
->Unpack
= ctx
->DefaultPacking
;
4936 CALL_ConvolutionFilter1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
4939 ctx
->Unpack
= save
; /* restore */
4942 case OPCODE_CONVOLUTION_FILTER_2D
:
4944 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4945 ctx
->Unpack
= ctx
->DefaultPacking
;
4946 CALL_ConvolutionFilter2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
4947 n
[4].i
, n
[5].e
, n
[6].e
,
4949 ctx
->Unpack
= save
; /* restore */
4952 case OPCODE_CONVOLUTION_PARAMETER_I
:
4953 CALL_ConvolutionParameteri(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].i
));
4955 case OPCODE_CONVOLUTION_PARAMETER_IV
:
4962 CALL_ConvolutionParameteriv(ctx
->Exec
,
4963 (n
[1].e
, n
[2].e
, params
));
4966 case OPCODE_CONVOLUTION_PARAMETER_F
:
4967 CALL_ConvolutionParameterf(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].f
));
4969 case OPCODE_CONVOLUTION_PARAMETER_FV
:
4976 CALL_ConvolutionParameterfv(ctx
->Exec
,
4977 (n
[1].e
, n
[2].e
, params
));
4980 case OPCODE_COPY_COLOR_SUB_TABLE
:
4981 CALL_CopyColorSubTable(ctx
->Exec
, (n
[1].e
, n
[2].i
,
4982 n
[3].i
, n
[4].i
, n
[5].i
));
4984 case OPCODE_COPY_COLOR_TABLE
:
4985 CALL_CopyColorSubTable(ctx
->Exec
, (n
[1].e
, n
[2].i
,
4986 n
[3].i
, n
[4].i
, n
[5].i
));
4988 case OPCODE_COPY_PIXELS
:
4989 CALL_CopyPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
,
4990 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
,
4993 case OPCODE_COPY_TEX_IMAGE1D
:
4994 CALL_CopyTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
4995 n
[5].i
, n
[6].i
, n
[7].i
));
4997 case OPCODE_COPY_TEX_IMAGE2D
:
4998 CALL_CopyTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
4999 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
));
5001 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
5002 CALL_CopyTexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5003 n
[4].i
, n
[5].i
, n
[6].i
));
5005 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
5006 CALL_CopyTexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5007 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
5010 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
5011 CALL_CopyTexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5012 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
5015 case OPCODE_CULL_FACE
:
5016 CALL_CullFace(ctx
->Exec
, (n
[1].e
));
5018 case OPCODE_DEPTH_FUNC
:
5019 CALL_DepthFunc(ctx
->Exec
, (n
[1].e
));
5021 case OPCODE_DEPTH_MASK
:
5022 CALL_DepthMask(ctx
->Exec
, (n
[1].b
));
5024 case OPCODE_DEPTH_RANGE
:
5025 CALL_DepthRange(ctx
->Exec
,
5026 ((GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
));
5028 case OPCODE_DISABLE
:
5029 CALL_Disable(ctx
->Exec
, (n
[1].e
));
5031 case OPCODE_DRAW_BUFFER
:
5032 CALL_DrawBuffer(ctx
->Exec
, (n
[1].e
));
5034 case OPCODE_DRAW_PIXELS
:
5036 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5037 ctx
->Unpack
= ctx
->DefaultPacking
;
5038 CALL_DrawPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
5040 ctx
->Unpack
= save
; /* restore */
5044 CALL_Enable(ctx
->Exec
, (n
[1].e
));
5046 case OPCODE_EVALMESH1
:
5047 CALL_EvalMesh1(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
));
5049 case OPCODE_EVALMESH2
:
5050 CALL_EvalMesh2(ctx
->Exec
,
5051 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
5060 CALL_Fogfv(ctx
->Exec
, (n
[1].e
, p
));
5063 case OPCODE_FRONT_FACE
:
5064 CALL_FrontFace(ctx
->Exec
, (n
[1].e
));
5066 case OPCODE_FRUSTUM
:
5067 CALL_Frustum(ctx
->Exec
,
5068 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
5071 CALL_Hint(ctx
->Exec
, (n
[1].e
, n
[2].e
));
5073 case OPCODE_HISTOGRAM
:
5074 CALL_Histogram(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].b
));
5076 case OPCODE_INDEX_MASK
:
5077 CALL_IndexMask(ctx
->Exec
, (n
[1].ui
));
5079 case OPCODE_INIT_NAMES
:
5080 CALL_InitNames(ctx
->Exec
, ());
5089 CALL_Lightfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, p
));
5092 case OPCODE_LIGHT_MODEL
:
5099 CALL_LightModelfv(ctx
->Exec
, (n
[1].e
, p
));
5102 case OPCODE_LINE_STIPPLE
:
5103 CALL_LineStipple(ctx
->Exec
, (n
[1].i
, n
[2].us
));
5105 case OPCODE_LINE_WIDTH
:
5106 CALL_LineWidth(ctx
->Exec
, (n
[1].f
));
5108 case OPCODE_LIST_BASE
:
5109 CALL_ListBase(ctx
->Exec
, (n
[1].ui
));
5111 case OPCODE_LOAD_IDENTITY
:
5112 CALL_LoadIdentity(ctx
->Exec
, ());
5114 case OPCODE_LOAD_MATRIX
:
5115 if (sizeof(Node
) == sizeof(GLfloat
)) {
5116 CALL_LoadMatrixf(ctx
->Exec
, (&n
[1].f
));
5121 for (i
= 0; i
< 16; i
++) {
5124 CALL_LoadMatrixf(ctx
->Exec
, (m
));
5127 case OPCODE_LOAD_NAME
:
5128 CALL_LoadName(ctx
->Exec
, (n
[1].ui
));
5130 case OPCODE_LOGIC_OP
:
5131 CALL_LogicOp(ctx
->Exec
, (n
[1].e
));
5135 GLenum target
= n
[1].e
;
5136 GLint ustride
= _mesa_evaluator_components(target
);
5137 GLint uorder
= n
[5].i
;
5138 GLfloat u1
= n
[2].f
;
5139 GLfloat u2
= n
[3].f
;
5140 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
5141 (GLfloat
*) n
[6].data
));
5146 GLenum target
= n
[1].e
;
5147 GLfloat u1
= n
[2].f
;
5148 GLfloat u2
= n
[3].f
;
5149 GLfloat v1
= n
[4].f
;
5150 GLfloat v2
= n
[5].f
;
5151 GLint ustride
= n
[6].i
;
5152 GLint vstride
= n
[7].i
;
5153 GLint uorder
= n
[8].i
;
5154 GLint vorder
= n
[9].i
;
5155 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
5156 v1
, v2
, vstride
, vorder
,
5157 (GLfloat
*) n
[10].data
));
5160 case OPCODE_MAPGRID1
:
5161 CALL_MapGrid1f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
5163 case OPCODE_MAPGRID2
:
5164 CALL_MapGrid2f(ctx
->Exec
,
5165 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
));
5167 case OPCODE_MATRIX_MODE
:
5168 CALL_MatrixMode(ctx
->Exec
, (n
[1].e
));
5170 case OPCODE_MIN_MAX
:
5171 CALL_Minmax(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].b
));
5173 case OPCODE_MULT_MATRIX
:
5174 if (sizeof(Node
) == sizeof(GLfloat
)) {
5175 CALL_MultMatrixf(ctx
->Exec
, (&n
[1].f
));
5180 for (i
= 0; i
< 16; i
++) {
5183 CALL_MultMatrixf(ctx
->Exec
, (m
));
5187 CALL_Ortho(ctx
->Exec
,
5188 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
5190 case OPCODE_PASSTHROUGH
:
5191 CALL_PassThrough(ctx
->Exec
, (n
[1].f
));
5193 case OPCODE_PIXEL_MAP
:
5194 CALL_PixelMapfv(ctx
->Exec
,
5195 (n
[1].e
, n
[2].i
, (GLfloat
*) n
[3].data
));
5197 case OPCODE_PIXEL_TRANSFER
:
5198 CALL_PixelTransferf(ctx
->Exec
, (n
[1].e
, n
[2].f
));
5200 case OPCODE_PIXEL_ZOOM
:
5201 CALL_PixelZoom(ctx
->Exec
, (n
[1].f
, n
[2].f
));
5203 case OPCODE_POINT_SIZE
:
5204 CALL_PointSize(ctx
->Exec
, (n
[1].f
));
5206 case OPCODE_POINT_PARAMETERS
:
5212 CALL_PointParameterfvEXT(ctx
->Exec
, (n
[1].e
, params
));
5215 case OPCODE_POLYGON_MODE
:
5216 CALL_PolygonMode(ctx
->Exec
, (n
[1].e
, n
[2].e
));
5218 case OPCODE_POLYGON_STIPPLE
:
5220 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5221 ctx
->Unpack
= ctx
->DefaultPacking
;
5222 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) n
[1].data
));
5223 ctx
->Unpack
= save
; /* restore */
5226 case OPCODE_POLYGON_OFFSET
:
5227 CALL_PolygonOffset(ctx
->Exec
, (n
[1].f
, n
[2].f
));
5229 case OPCODE_POP_ATTRIB
:
5230 CALL_PopAttrib(ctx
->Exec
, ());
5232 case OPCODE_POP_MATRIX
:
5233 CALL_PopMatrix(ctx
->Exec
, ());
5235 case OPCODE_POP_NAME
:
5236 CALL_PopName(ctx
->Exec
, ());
5238 case OPCODE_PRIORITIZE_TEXTURE
:
5239 CALL_PrioritizeTextures(ctx
->Exec
, (1, &n
[1].ui
, &n
[2].f
));
5241 case OPCODE_PUSH_ATTRIB
:
5242 CALL_PushAttrib(ctx
->Exec
, (n
[1].bf
));
5244 case OPCODE_PUSH_MATRIX
:
5245 CALL_PushMatrix(ctx
->Exec
, ());
5247 case OPCODE_PUSH_NAME
:
5248 CALL_PushName(ctx
->Exec
, (n
[1].ui
));
5250 case OPCODE_RASTER_POS
:
5251 CALL_RasterPos4f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
5253 case OPCODE_READ_BUFFER
:
5254 CALL_ReadBuffer(ctx
->Exec
, (n
[1].e
));
5256 case OPCODE_RESET_HISTOGRAM
:
5257 CALL_ResetHistogram(ctx
->Exec
, (n
[1].e
));
5259 case OPCODE_RESET_MIN_MAX
:
5260 CALL_ResetMinmax(ctx
->Exec
, (n
[1].e
));
5263 CALL_Rotatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
5266 CALL_Scalef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
5268 case OPCODE_SCISSOR
:
5269 CALL_Scissor(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
5271 case OPCODE_SHADE_MODEL
:
5272 CALL_ShadeModel(ctx
->Exec
, (n
[1].e
));
5274 case OPCODE_STENCIL_FUNC
:
5275 CALL_StencilFunc(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].ui
));
5277 case OPCODE_STENCIL_MASK
:
5278 CALL_StencilMask(ctx
->Exec
, (n
[1].ui
));
5280 case OPCODE_STENCIL_OP
:
5281 CALL_StencilOp(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].e
));
5290 CALL_TexEnvfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
5300 CALL_TexGenfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
5303 case OPCODE_TEXPARAMETER
:
5310 CALL_TexParameterfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
5313 case OPCODE_TEX_IMAGE1D
:
5315 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5316 ctx
->Unpack
= ctx
->DefaultPacking
;
5317 CALL_TexImage1D(ctx
->Exec
, (n
[1].e
, /* target */
5319 n
[3].i
, /* components */
5321 n
[5].e
, /* border */
5322 n
[6].e
, /* format */
5325 ctx
->Unpack
= save
; /* restore */
5328 case OPCODE_TEX_IMAGE2D
:
5330 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5331 ctx
->Unpack
= ctx
->DefaultPacking
;
5332 CALL_TexImage2D(ctx
->Exec
, (n
[1].e
, /* target */
5334 n
[3].i
, /* components */
5336 n
[5].i
, /* height */
5337 n
[6].e
, /* border */
5338 n
[7].e
, /* format */
5341 ctx
->Unpack
= save
; /* restore */
5344 case OPCODE_TEX_IMAGE3D
:
5346 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5347 ctx
->Unpack
= ctx
->DefaultPacking
;
5348 CALL_TexImage3D(ctx
->Exec
, (n
[1].e
, /* target */
5350 n
[3].i
, /* components */
5352 n
[5].i
, /* height */
5354 n
[7].e
, /* border */
5355 n
[8].e
, /* format */
5358 ctx
->Unpack
= save
; /* restore */
5361 case OPCODE_TEX_SUB_IMAGE1D
:
5363 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5364 ctx
->Unpack
= ctx
->DefaultPacking
;
5365 CALL_TexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5367 n
[6].e
, n
[7].data
));
5368 ctx
->Unpack
= save
; /* restore */
5371 case OPCODE_TEX_SUB_IMAGE2D
:
5373 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5374 ctx
->Unpack
= ctx
->DefaultPacking
;
5375 CALL_TexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5377 n
[6].i
, n
[7].e
, n
[8].e
,
5379 ctx
->Unpack
= save
; /* restore */
5382 case OPCODE_TEX_SUB_IMAGE3D
:
5384 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5385 ctx
->Unpack
= ctx
->DefaultPacking
;
5386 CALL_TexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5387 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
5388 n
[8].i
, n
[9].e
, n
[10].e
,
5390 ctx
->Unpack
= save
; /* restore */
5393 case OPCODE_TRANSLATE
:
5394 CALL_Translatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
5396 case OPCODE_VIEWPORT
:
5397 CALL_Viewport(ctx
->Exec
, (n
[1].i
, n
[2].i
,
5398 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
));
5400 case OPCODE_WINDOW_POS
:
5401 CALL_WindowPos4fMESA(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
5403 case OPCODE_SAMPLE_COVERAGE
: /* GL_ARB_multisample */
5404 CALL_SampleCoverageARB(ctx
->Exec
, (n
[1].f
, n
[2].b
));
5406 case OPCODE_WINDOW_POS_ARB
: /* GL_ARB_window_pos */
5407 CALL_WindowPos3fMESA(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
5409 #if FEATURE_NV_vertex_program
5410 case OPCODE_EXECUTE_PROGRAM_NV
:
5417 CALL_ExecuteProgramNV(ctx
->Exec
, (n
[1].e
, n
[2].ui
, v
));
5420 case OPCODE_REQUEST_RESIDENT_PROGRAMS_NV
:
5421 CALL_RequestResidentProgramsNV(ctx
->Exec
, (n
[1].ui
,
5422 (GLuint
*) n
[2].data
));
5424 case OPCODE_LOAD_PROGRAM_NV
:
5425 CALL_LoadProgramNV(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].i
,
5426 (const GLubyte
*) n
[4].data
));
5428 case OPCODE_TRACK_MATRIX_NV
:
5429 CALL_TrackMatrixNV(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].e
, n
[4].e
));
5433 #if FEATURE_NV_fragment_program
5434 case OPCODE_PROGRAM_NAMED_PARAMETER_NV
:
5435 CALL_ProgramNamedParameter4fNV(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
5436 (const GLubyte
*) n
[3].
5437 data
, n
[4].f
, n
[5].f
,
5442 case OPCODE_DEPTH_BOUNDS_EXT
:
5443 CALL_DepthBoundsEXT(ctx
->Exec
, (n
[1].f
, n
[2].f
));
5446 case OPCODE_ATTR_1F_NV
:
5447 CALL_VertexAttrib1fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
));
5449 case OPCODE_ATTR_2F_NV
:
5450 /* Really shouldn't have to do this - the Node structure
5451 * is convenient, but it would be better to store the data
5452 * packed appropriately so that it can be sent directly
5453 * on. With x86_64 becoming common, this will start to
5456 if (sizeof(Node
) == sizeof(GLfloat
))
5457 CALL_VertexAttrib2fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
5459 CALL_VertexAttrib2fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
));
5461 case OPCODE_ATTR_3F_NV
:
5462 if (sizeof(Node
) == sizeof(GLfloat
))
5463 CALL_VertexAttrib3fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
5465 CALL_VertexAttrib3fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
5468 case OPCODE_ATTR_4F_NV
:
5469 if (sizeof(Node
) == sizeof(GLfloat
))
5470 CALL_VertexAttrib4fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
5472 CALL_VertexAttrib4fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
5475 case OPCODE_MATERIAL
:
5482 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, f
));
5486 CALL_Begin(ctx
->Exec
, (n
[1].e
));
5489 CALL_End(ctx
->Exec
, ());
5492 CALL_Rectf(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
5494 case OPCODE_EVAL_C1
:
5495 CALL_EvalCoord1f(ctx
->Exec
, (n
[1].f
));
5497 case OPCODE_EVAL_C2
:
5498 CALL_EvalCoord2f(ctx
->Exec
, (n
[1].f
, n
[2].f
));
5500 case OPCODE_EVAL_P1
:
5501 CALL_EvalPoint1(ctx
->Exec
, (n
[1].i
));
5503 case OPCODE_EVAL_P2
:
5504 CALL_EvalPoint2(ctx
->Exec
, (n
[1].i
, n
[2].i
));
5507 /* GL_EXT_texture_integer */
5508 case OPCODE_CLEARCOLOR_I
:
5509 CALL_ClearColorIiEXT(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
5511 case OPCODE_CLEARCOLOR_UI
:
5512 CALL_ClearColorIuiEXT(ctx
->Exec
,
5513 (n
[1].ui
, n
[2].ui
, n
[3].ui
, n
[4].ui
));
5515 case OPCODE_TEXPARAMETER_I
:
5522 CALL_TexParameterIivEXT(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
5525 case OPCODE_TEXPARAMETER_UI
:
5528 params
[0] = n
[3].ui
;
5529 params
[1] = n
[4].ui
;
5530 params
[2] = n
[5].ui
;
5531 params
[3] = n
[6].ui
;
5532 CALL_TexParameterIuivEXT(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
5536 case OPCODE_TEXTURE_BARRIER_NV
:
5537 CALL_TextureBarrierNV(ctx
->Exec
, ());
5540 case OPCODE_CONTINUE
:
5541 n
= (Node
*) n
[1].next
;
5543 case OPCODE_END_OF_LIST
:
5549 _mesa_snprintf(msg
, sizeof(msg
), "Error in execute_list: opcode=%d",
5551 _mesa_problem(ctx
, "%s", msg
);
5556 /* increment n to point to next compiled command */
5557 if (opcode
!= OPCODE_CONTINUE
) {
5558 n
+= InstSize
[opcode
];
5563 if (ctx
->Driver
.EndCallList
)
5564 ctx
->Driver
.EndCallList(ctx
);
5566 ctx
->ListState
.CallDepth
--;
5571 /**********************************************************************/
5573 /**********************************************************************/
5576 * Test if a display list number is valid.
5578 static GLboolean GLAPIENTRY
5579 _mesa_IsList(GLuint list
)
5581 GET_CURRENT_CONTEXT(ctx
);
5582 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
5583 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
5584 return islist(ctx
, list
);
5589 * Delete a sequence of consecutive display lists.
5591 static void GLAPIENTRY
5592 _mesa_DeleteLists(GLuint list
, GLsizei range
)
5594 GET_CURRENT_CONTEXT(ctx
);
5596 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
5597 ASSERT_OUTSIDE_BEGIN_END(ctx
);
5600 _mesa_error(ctx
, GL_INVALID_VALUE
, "glDeleteLists");
5603 for (i
= list
; i
< list
+ range
; i
++) {
5604 destroy_list(ctx
, i
);
5610 * Return a display list number, n, such that lists n through n+range-1
5613 static GLuint GLAPIENTRY
5614 _mesa_GenLists(GLsizei range
)
5616 GET_CURRENT_CONTEXT(ctx
);
5618 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
5619 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, 0);
5622 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGenLists");
5630 * Make this an atomic operation
5632 _glthread_LOCK_MUTEX(ctx
->Shared
->Mutex
);
5634 base
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
5636 /* reserve the list IDs by with empty/dummy lists */
5638 for (i
= 0; i
< range
; i
++) {
5639 _mesa_HashInsert(ctx
->Shared
->DisplayList
, base
+ i
,
5640 make_list(base
+ i
, 1));
5644 _glthread_UNLOCK_MUTEX(ctx
->Shared
->Mutex
);
5651 * Begin a new display list.
5653 static void GLAPIENTRY
5654 _mesa_NewList(GLuint name
, GLenum mode
)
5656 GET_CURRENT_CONTEXT(ctx
);
5658 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
5659 ASSERT_OUTSIDE_BEGIN_END(ctx
);
5661 if (MESA_VERBOSE
& VERBOSE_API
)
5662 _mesa_debug(ctx
, "glNewList %u %s\n", name
,
5663 _mesa_lookup_enum_by_nr(mode
));
5666 _mesa_error(ctx
, GL_INVALID_VALUE
, "glNewList");
5670 if (mode
!= GL_COMPILE
&& mode
!= GL_COMPILE_AND_EXECUTE
) {
5671 _mesa_error(ctx
, GL_INVALID_ENUM
, "glNewList");
5675 if (ctx
->ListState
.CurrentList
) {
5676 /* already compiling a display list */
5677 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
5681 ctx
->CompileFlag
= GL_TRUE
;
5682 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
5684 /* Reset acumulated list state:
5686 invalidate_saved_current_state( ctx
);
5688 /* Allocate new display list */
5689 ctx
->ListState
.CurrentList
= make_list(name
, BLOCK_SIZE
);
5690 ctx
->ListState
.CurrentBlock
= ctx
->ListState
.CurrentList
->Head
;
5691 ctx
->ListState
.CurrentPos
= 0;
5693 ctx
->Driver
.NewList(ctx
, name
, mode
);
5695 ctx
->CurrentDispatch
= ctx
->Save
;
5696 _glapi_set_dispatch(ctx
->CurrentDispatch
);
5701 * End definition of current display list.
5703 static void GLAPIENTRY
5706 GET_CURRENT_CONTEXT(ctx
);
5707 SAVE_FLUSH_VERTICES(ctx
);
5708 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
5710 if (MESA_VERBOSE
& VERBOSE_API
)
5711 _mesa_debug(ctx
, "glEndList\n");
5713 /* Check that a list is under construction */
5714 if (!ctx
->ListState
.CurrentList
) {
5715 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glEndList");
5719 /* Call before emitting END_OF_LIST, in case the driver wants to
5720 * emit opcodes itself.
5722 ctx
->Driver
.EndList(ctx
);
5724 (void) alloc_instruction(ctx
, OPCODE_END_OF_LIST
, 0);
5726 /* Destroy old list, if any */
5727 destroy_list(ctx
, ctx
->ListState
.CurrentList
->Name
);
5729 /* Install the new list */
5730 _mesa_HashInsert(ctx
->Shared
->DisplayList
,
5731 ctx
->ListState
.CurrentList
->Name
,
5732 ctx
->ListState
.CurrentList
);
5735 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
5736 mesa_print_display_list(ctx
->ListState
.CurrentList
->Name
);
5738 ctx
->ListState
.CurrentList
= NULL
;
5739 ctx
->ExecuteFlag
= GL_TRUE
;
5740 ctx
->CompileFlag
= GL_FALSE
;
5742 ctx
->CurrentDispatch
= ctx
->Exec
;
5743 _glapi_set_dispatch(ctx
->CurrentDispatch
);
5748 _mesa_CallList(GLuint list
)
5750 GLboolean save_compile_flag
;
5751 GET_CURRENT_CONTEXT(ctx
);
5752 FLUSH_CURRENT(ctx
, 0);
5754 if (MESA_VERBOSE
& VERBOSE_API
)
5755 _mesa_debug(ctx
, "glCallList %d\n", list
);
5758 _mesa_error(ctx
, GL_INVALID_VALUE
, "glCallList(list==0)");
5763 mesa_print_display_list( list
);
5765 /* VERY IMPORTANT: Save the CompileFlag status, turn it off,
5766 * execute the display list, and restore the CompileFlag.
5768 save_compile_flag
= ctx
->CompileFlag
;
5769 if (save_compile_flag
) {
5770 ctx
->CompileFlag
= GL_FALSE
;
5773 execute_list(ctx
, list
);
5774 ctx
->CompileFlag
= save_compile_flag
;
5776 /* also restore API function pointers to point to "save" versions */
5777 if (save_compile_flag
) {
5778 ctx
->CurrentDispatch
= ctx
->Save
;
5779 _glapi_set_dispatch(ctx
->CurrentDispatch
);
5785 * Execute glCallLists: call multiple display lists.
5788 _mesa_CallLists(GLsizei n
, GLenum type
, const GLvoid
* lists
)
5790 GET_CURRENT_CONTEXT(ctx
);
5792 GLboolean save_compile_flag
;
5794 if (MESA_VERBOSE
& VERBOSE_API
)
5795 _mesa_debug(ctx
, "glCallLists %d\n", n
);
5799 case GL_UNSIGNED_BYTE
:
5801 case GL_UNSIGNED_SHORT
:
5803 case GL_UNSIGNED_INT
:
5811 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
5815 /* Save the CompileFlag status, turn it off, execute display list,
5816 * and restore the CompileFlag.
5818 save_compile_flag
= ctx
->CompileFlag
;
5819 ctx
->CompileFlag
= GL_FALSE
;
5821 for (i
= 0; i
< n
; i
++) {
5822 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ translate_id(i
, type
, lists
));
5823 execute_list(ctx
, list
);
5826 ctx
->CompileFlag
= save_compile_flag
;
5828 /* also restore API function pointers to point to "save" versions */
5829 if (save_compile_flag
) {
5830 ctx
->CurrentDispatch
= ctx
->Save
;
5831 _glapi_set_dispatch(ctx
->CurrentDispatch
);
5837 * Set the offset added to list numbers in glCallLists.
5839 static void GLAPIENTRY
5840 _mesa_ListBase(GLuint base
)
5842 GET_CURRENT_CONTEXT(ctx
);
5843 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
5844 ASSERT_OUTSIDE_BEGIN_END(ctx
);
5845 ctx
->List
.ListBase
= base
;
5849 /* Can no longer assume ctx->Exec->Func is equal to _mesa_Func.
5851 static void GLAPIENTRY
5854 GET_CURRENT_CONTEXT(ctx
);
5855 FLUSH_VERTICES(ctx
, 0);
5856 CALL_Finish(ctx
->Exec
, ());
5859 static void GLAPIENTRY
5862 GET_CURRENT_CONTEXT(ctx
);
5863 FLUSH_VERTICES(ctx
, 0);
5864 CALL_Flush(ctx
->Exec
, ());
5867 static void GLAPIENTRY
5868 exec_GetBooleanv(GLenum pname
, GLboolean
*params
)
5870 GET_CURRENT_CONTEXT(ctx
);
5871 FLUSH_VERTICES(ctx
, 0);
5872 CALL_GetBooleanv(ctx
->Exec
, (pname
, params
));
5875 static void GLAPIENTRY
5876 exec_GetClipPlane(GLenum plane
, GLdouble
* equation
)
5878 GET_CURRENT_CONTEXT(ctx
);
5879 FLUSH_VERTICES(ctx
, 0);
5880 CALL_GetClipPlane(ctx
->Exec
, (plane
, equation
));
5883 static void GLAPIENTRY
5884 exec_GetDoublev(GLenum pname
, GLdouble
*params
)
5886 GET_CURRENT_CONTEXT(ctx
);
5887 FLUSH_VERTICES(ctx
, 0);
5888 CALL_GetDoublev(ctx
->Exec
, (pname
, params
));
5891 static GLenum GLAPIENTRY
5894 GET_CURRENT_CONTEXT(ctx
);
5895 FLUSH_VERTICES(ctx
, 0);
5896 return CALL_GetError(ctx
->Exec
, ());
5899 static void GLAPIENTRY
5900 exec_GetFloatv(GLenum pname
, GLfloat
*params
)
5902 GET_CURRENT_CONTEXT(ctx
);
5903 FLUSH_VERTICES(ctx
, 0);
5904 CALL_GetFloatv(ctx
->Exec
, (pname
, params
));
5907 static void GLAPIENTRY
5908 exec_GetIntegerv(GLenum pname
, GLint
*params
)
5910 GET_CURRENT_CONTEXT(ctx
);
5911 FLUSH_VERTICES(ctx
, 0);
5912 CALL_GetIntegerv(ctx
->Exec
, (pname
, params
));
5915 static void GLAPIENTRY
5916 exec_GetLightfv(GLenum light
, GLenum pname
, GLfloat
*params
)
5918 GET_CURRENT_CONTEXT(ctx
);
5919 FLUSH_VERTICES(ctx
, 0);
5920 CALL_GetLightfv(ctx
->Exec
, (light
, pname
, params
));
5923 static void GLAPIENTRY
5924 exec_GetLightiv(GLenum light
, GLenum pname
, GLint
*params
)
5926 GET_CURRENT_CONTEXT(ctx
);
5927 FLUSH_VERTICES(ctx
, 0);
5928 CALL_GetLightiv(ctx
->Exec
, (light
, pname
, params
));
5931 static void GLAPIENTRY
5932 exec_GetMapdv(GLenum target
, GLenum query
, GLdouble
* v
)
5934 GET_CURRENT_CONTEXT(ctx
);
5935 FLUSH_VERTICES(ctx
, 0);
5936 CALL_GetMapdv(ctx
->Exec
, (target
, query
, v
));
5939 static void GLAPIENTRY
5940 exec_GetMapfv(GLenum target
, GLenum query
, GLfloat
* v
)
5942 GET_CURRENT_CONTEXT(ctx
);
5943 FLUSH_VERTICES(ctx
, 0);
5944 CALL_GetMapfv(ctx
->Exec
, (target
, query
, v
));
5947 static void GLAPIENTRY
5948 exec_GetMapiv(GLenum target
, GLenum query
, GLint
* v
)
5950 GET_CURRENT_CONTEXT(ctx
);
5951 FLUSH_VERTICES(ctx
, 0);
5952 CALL_GetMapiv(ctx
->Exec
, (target
, query
, v
));
5955 static void GLAPIENTRY
5956 exec_GetMaterialfv(GLenum face
, GLenum pname
, GLfloat
*params
)
5958 GET_CURRENT_CONTEXT(ctx
);
5959 FLUSH_VERTICES(ctx
, 0);
5960 CALL_GetMaterialfv(ctx
->Exec
, (face
, pname
, params
));
5963 static void GLAPIENTRY
5964 exec_GetMaterialiv(GLenum face
, GLenum pname
, GLint
*params
)
5966 GET_CURRENT_CONTEXT(ctx
);
5967 FLUSH_VERTICES(ctx
, 0);
5968 CALL_GetMaterialiv(ctx
->Exec
, (face
, pname
, params
));
5971 static void GLAPIENTRY
5972 exec_GetPixelMapfv(GLenum map
, GLfloat
*values
)
5974 GET_CURRENT_CONTEXT(ctx
);
5975 FLUSH_VERTICES(ctx
, 0);
5976 CALL_GetPixelMapfv(ctx
->Exec
, (map
, values
));
5979 static void GLAPIENTRY
5980 exec_GetPixelMapuiv(GLenum map
, GLuint
*values
)
5982 GET_CURRENT_CONTEXT(ctx
);
5983 FLUSH_VERTICES(ctx
, 0);
5984 CALL_GetPixelMapuiv(ctx
->Exec
, (map
, values
));
5987 static void GLAPIENTRY
5988 exec_GetPixelMapusv(GLenum map
, GLushort
*values
)
5990 GET_CURRENT_CONTEXT(ctx
);
5991 FLUSH_VERTICES(ctx
, 0);
5992 CALL_GetPixelMapusv(ctx
->Exec
, (map
, values
));
5995 static void GLAPIENTRY
5996 exec_GetPolygonStipple(GLubyte
* dest
)
5998 GET_CURRENT_CONTEXT(ctx
);
5999 FLUSH_VERTICES(ctx
, 0);
6000 CALL_GetPolygonStipple(ctx
->Exec
, (dest
));
6003 static const GLubyte
*GLAPIENTRY
6004 exec_GetString(GLenum name
)
6006 GET_CURRENT_CONTEXT(ctx
);
6007 FLUSH_VERTICES(ctx
, 0);
6008 return CALL_GetString(ctx
->Exec
, (name
));
6011 static void GLAPIENTRY
6012 exec_GetTexEnvfv(GLenum target
, GLenum pname
, GLfloat
*params
)
6014 GET_CURRENT_CONTEXT(ctx
);
6015 FLUSH_VERTICES(ctx
, 0);
6016 CALL_GetTexEnvfv(ctx
->Exec
, (target
, pname
, params
));
6019 static void GLAPIENTRY
6020 exec_GetTexEnviv(GLenum target
, GLenum pname
, GLint
*params
)
6022 GET_CURRENT_CONTEXT(ctx
);
6023 FLUSH_VERTICES(ctx
, 0);
6024 CALL_GetTexEnviv(ctx
->Exec
, (target
, pname
, params
));
6027 static void GLAPIENTRY
6028 exec_GetTexGendv(GLenum coord
, GLenum pname
, GLdouble
*params
)
6030 GET_CURRENT_CONTEXT(ctx
);
6031 FLUSH_VERTICES(ctx
, 0);
6032 CALL_GetTexGendv(ctx
->Exec
, (coord
, pname
, params
));
6035 static void GLAPIENTRY
6036 exec_GetTexGenfv(GLenum coord
, GLenum pname
, GLfloat
*params
)
6038 GET_CURRENT_CONTEXT(ctx
);
6039 FLUSH_VERTICES(ctx
, 0);
6040 CALL_GetTexGenfv(ctx
->Exec
, (coord
, pname
, params
));
6043 static void GLAPIENTRY
6044 exec_GetTexGeniv(GLenum coord
, GLenum pname
, GLint
*params
)
6046 GET_CURRENT_CONTEXT(ctx
);
6047 FLUSH_VERTICES(ctx
, 0);
6048 CALL_GetTexGeniv(ctx
->Exec
, (coord
, pname
, params
));
6051 static void GLAPIENTRY
6052 exec_GetTexImage(GLenum target
, GLint level
, GLenum format
,
6053 GLenum type
, GLvoid
* pixels
)
6055 GET_CURRENT_CONTEXT(ctx
);
6056 FLUSH_VERTICES(ctx
, 0);
6057 CALL_GetTexImage(ctx
->Exec
, (target
, level
, format
, type
, pixels
));
6060 static void GLAPIENTRY
6061 exec_GetTexLevelParameterfv(GLenum target
, GLint level
,
6062 GLenum pname
, GLfloat
*params
)
6064 GET_CURRENT_CONTEXT(ctx
);
6065 FLUSH_VERTICES(ctx
, 0);
6066 CALL_GetTexLevelParameterfv(ctx
->Exec
, (target
, level
, pname
, params
));
6069 static void GLAPIENTRY
6070 exec_GetTexLevelParameteriv(GLenum target
, GLint level
,
6071 GLenum pname
, GLint
*params
)
6073 GET_CURRENT_CONTEXT(ctx
);
6074 FLUSH_VERTICES(ctx
, 0);
6075 CALL_GetTexLevelParameteriv(ctx
->Exec
, (target
, level
, pname
, params
));
6078 static void GLAPIENTRY
6079 exec_GetTexParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
6081 GET_CURRENT_CONTEXT(ctx
);
6082 FLUSH_VERTICES(ctx
, 0);
6083 CALL_GetTexParameterfv(ctx
->Exec
, (target
, pname
, params
));
6086 static void GLAPIENTRY
6087 exec_GetTexParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
6089 GET_CURRENT_CONTEXT(ctx
);
6090 FLUSH_VERTICES(ctx
, 0);
6091 CALL_GetTexParameteriv(ctx
->Exec
, (target
, pname
, params
));
6094 static GLboolean GLAPIENTRY
6095 exec_IsEnabled(GLenum cap
)
6097 GET_CURRENT_CONTEXT(ctx
);
6098 FLUSH_VERTICES(ctx
, 0);
6099 return CALL_IsEnabled(ctx
->Exec
, (cap
));
6102 static void GLAPIENTRY
6103 exec_PixelStoref(GLenum pname
, GLfloat param
)
6105 GET_CURRENT_CONTEXT(ctx
);
6106 FLUSH_VERTICES(ctx
, 0);
6107 CALL_PixelStoref(ctx
->Exec
, (pname
, param
));
6110 static void GLAPIENTRY
6111 exec_PixelStorei(GLenum pname
, GLint param
)
6113 GET_CURRENT_CONTEXT(ctx
);
6114 FLUSH_VERTICES(ctx
, 0);
6115 CALL_PixelStorei(ctx
->Exec
, (pname
, param
));
6118 static void GLAPIENTRY
6119 exec_ReadPixels(GLint x
, GLint y
, GLsizei width
, GLsizei height
,
6120 GLenum format
, GLenum type
, GLvoid
* pixels
)
6122 GET_CURRENT_CONTEXT(ctx
);
6123 FLUSH_VERTICES(ctx
, 0);
6124 CALL_ReadPixels(ctx
->Exec
, (x
, y
, width
, height
, format
, type
, pixels
));
6127 static GLint GLAPIENTRY
6128 exec_RenderMode(GLenum mode
)
6130 GET_CURRENT_CONTEXT(ctx
);
6131 FLUSH_VERTICES(ctx
, 0);
6132 return CALL_RenderMode(ctx
->Exec
, (mode
));
6135 static void GLAPIENTRY
6136 exec_FeedbackBuffer(GLsizei size
, GLenum type
, GLfloat
* buffer
)
6138 GET_CURRENT_CONTEXT(ctx
);
6139 FLUSH_VERTICES(ctx
, 0);
6140 CALL_FeedbackBuffer(ctx
->Exec
, (size
, type
, buffer
));
6143 static void GLAPIENTRY
6144 exec_SelectBuffer(GLsizei size
, GLuint
* buffer
)
6146 GET_CURRENT_CONTEXT(ctx
);
6147 FLUSH_VERTICES(ctx
, 0);
6148 CALL_SelectBuffer(ctx
->Exec
, (size
, buffer
));
6151 static GLboolean GLAPIENTRY
6152 exec_AreTexturesResident(GLsizei n
, const GLuint
* texName
,
6153 GLboolean
* residences
)
6155 GET_CURRENT_CONTEXT(ctx
);
6156 FLUSH_VERTICES(ctx
, 0);
6157 return CALL_AreTexturesResident(ctx
->Exec
, (n
, texName
, residences
));
6160 static void GLAPIENTRY
6161 exec_ColorPointer(GLint size
, GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
6163 GET_CURRENT_CONTEXT(ctx
);
6164 FLUSH_VERTICES(ctx
, 0);
6165 CALL_ColorPointer(ctx
->Exec
, (size
, type
, stride
, ptr
));
6168 static void GLAPIENTRY
6169 exec_DeleteTextures(GLsizei n
, const GLuint
* texName
)
6171 GET_CURRENT_CONTEXT(ctx
);
6172 FLUSH_VERTICES(ctx
, 0);
6173 CALL_DeleteTextures(ctx
->Exec
, (n
, texName
));
6176 static void GLAPIENTRY
6177 exec_DisableClientState(GLenum cap
)
6179 GET_CURRENT_CONTEXT(ctx
);
6180 FLUSH_VERTICES(ctx
, 0);
6181 CALL_DisableClientState(ctx
->Exec
, (cap
));
6184 static void GLAPIENTRY
6185 exec_EdgeFlagPointer(GLsizei stride
, const GLvoid
* vptr
)
6187 GET_CURRENT_CONTEXT(ctx
);
6188 FLUSH_VERTICES(ctx
, 0);
6189 CALL_EdgeFlagPointer(ctx
->Exec
, (stride
, vptr
));
6192 static void GLAPIENTRY
6193 exec_EnableClientState(GLenum cap
)
6195 GET_CURRENT_CONTEXT(ctx
);
6196 FLUSH_VERTICES(ctx
, 0);
6197 CALL_EnableClientState(ctx
->Exec
, (cap
));
6200 static void GLAPIENTRY
6201 exec_GenTextures(GLsizei n
, GLuint
* texName
)
6203 GET_CURRENT_CONTEXT(ctx
);
6204 FLUSH_VERTICES(ctx
, 0);
6205 CALL_GenTextures(ctx
->Exec
, (n
, texName
));
6208 static void GLAPIENTRY
6209 exec_GetPointerv(GLenum pname
, GLvoid
**params
)
6211 GET_CURRENT_CONTEXT(ctx
);
6212 FLUSH_VERTICES(ctx
, 0);
6213 CALL_GetPointerv(ctx
->Exec
, (pname
, params
));
6216 static void GLAPIENTRY
6217 exec_IndexPointer(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
6219 GET_CURRENT_CONTEXT(ctx
);
6220 FLUSH_VERTICES(ctx
, 0);
6221 CALL_IndexPointer(ctx
->Exec
, (type
, stride
, ptr
));
6224 static void GLAPIENTRY
6225 exec_InterleavedArrays(GLenum format
, GLsizei stride
, const GLvoid
* pointer
)
6227 GET_CURRENT_CONTEXT(ctx
);
6228 FLUSH_VERTICES(ctx
, 0);
6229 CALL_InterleavedArrays(ctx
->Exec
, (format
, stride
, pointer
));
6232 static GLboolean GLAPIENTRY
6233 exec_IsTexture(GLuint texture
)
6235 GET_CURRENT_CONTEXT(ctx
);
6236 FLUSH_VERTICES(ctx
, 0);
6237 return CALL_IsTexture(ctx
->Exec
, (texture
));
6240 static void GLAPIENTRY
6241 exec_NormalPointer(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
6243 GET_CURRENT_CONTEXT(ctx
);
6244 FLUSH_VERTICES(ctx
, 0);
6245 CALL_NormalPointer(ctx
->Exec
, (type
, stride
, ptr
));
6248 static void GLAPIENTRY
6249 exec_PopClientAttrib(void)
6251 GET_CURRENT_CONTEXT(ctx
);
6252 FLUSH_VERTICES(ctx
, 0);
6253 CALL_PopClientAttrib(ctx
->Exec
, ());
6256 static void GLAPIENTRY
6257 exec_PushClientAttrib(GLbitfield mask
)
6259 GET_CURRENT_CONTEXT(ctx
);
6260 FLUSH_VERTICES(ctx
, 0);
6261 CALL_PushClientAttrib(ctx
->Exec
, (mask
));
6264 static void GLAPIENTRY
6265 exec_TexCoordPointer(GLint size
, GLenum type
, GLsizei stride
,
6268 GET_CURRENT_CONTEXT(ctx
);
6269 FLUSH_VERTICES(ctx
, 0);
6270 CALL_TexCoordPointer(ctx
->Exec
, (size
, type
, stride
, ptr
));
6273 static void GLAPIENTRY
6274 exec_VertexPointer(GLint size
, GLenum type
, GLsizei stride
,
6277 GET_CURRENT_CONTEXT(ctx
);
6278 FLUSH_VERTICES(ctx
, 0);
6279 CALL_VertexPointer(ctx
->Exec
, (size
, type
, stride
, ptr
));
6282 static void GLAPIENTRY
6283 exec_CopyConvolutionFilter1D(GLenum target
, GLenum internalFormat
,
6284 GLint x
, GLint y
, GLsizei width
)
6286 GET_CURRENT_CONTEXT(ctx
);
6287 FLUSH_VERTICES(ctx
, 0);
6288 CALL_CopyConvolutionFilter1D(ctx
->Exec
,
6289 (target
, internalFormat
, x
, y
, width
));
6292 static void GLAPIENTRY
6293 exec_CopyConvolutionFilter2D(GLenum target
, GLenum internalFormat
,
6294 GLint x
, GLint y
, GLsizei width
, GLsizei height
)
6296 GET_CURRENT_CONTEXT(ctx
);
6297 FLUSH_VERTICES(ctx
, 0);
6298 CALL_CopyConvolutionFilter2D(ctx
->Exec
,
6299 (target
, internalFormat
, x
, y
, width
,
6303 static void GLAPIENTRY
6304 exec_GetColorTable(GLenum target
, GLenum format
, GLenum type
, GLvoid
* data
)
6306 GET_CURRENT_CONTEXT(ctx
);
6307 FLUSH_VERTICES(ctx
, 0);
6308 CALL_GetColorTable(ctx
->Exec
, (target
, format
, type
, data
));
6311 static void GLAPIENTRY
6312 exec_GetColorTableParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
6314 GET_CURRENT_CONTEXT(ctx
);
6315 FLUSH_VERTICES(ctx
, 0);
6316 CALL_GetColorTableParameterfv(ctx
->Exec
, (target
, pname
, params
));
6319 static void GLAPIENTRY
6320 exec_GetColorTableParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
6322 GET_CURRENT_CONTEXT(ctx
);
6323 FLUSH_VERTICES(ctx
, 0);
6324 CALL_GetColorTableParameteriv(ctx
->Exec
, (target
, pname
, params
));
6327 static void GLAPIENTRY
6328 exec_GetConvolutionFilter(GLenum target
, GLenum format
, GLenum type
,
6331 GET_CURRENT_CONTEXT(ctx
);
6332 FLUSH_VERTICES(ctx
, 0);
6333 CALL_GetConvolutionFilter(ctx
->Exec
, (target
, format
, type
, image
));
6336 static void GLAPIENTRY
6337 exec_GetConvolutionParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
6339 GET_CURRENT_CONTEXT(ctx
);
6340 FLUSH_VERTICES(ctx
, 0);
6341 CALL_GetConvolutionParameterfv(ctx
->Exec
, (target
, pname
, params
));
6344 static void GLAPIENTRY
6345 exec_GetConvolutionParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
6347 GET_CURRENT_CONTEXT(ctx
);
6348 FLUSH_VERTICES(ctx
, 0);
6349 CALL_GetConvolutionParameteriv(ctx
->Exec
, (target
, pname
, params
));
6352 static void GLAPIENTRY
6353 exec_GetHistogram(GLenum target
, GLboolean reset
, GLenum format
,
6354 GLenum type
, GLvoid
*values
)
6356 GET_CURRENT_CONTEXT(ctx
);
6357 FLUSH_VERTICES(ctx
, 0);
6358 CALL_GetHistogram(ctx
->Exec
, (target
, reset
, format
, type
, values
));
6361 static void GLAPIENTRY
6362 exec_GetHistogramParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
6364 GET_CURRENT_CONTEXT(ctx
);
6365 FLUSH_VERTICES(ctx
, 0);
6366 CALL_GetHistogramParameterfv(ctx
->Exec
, (target
, pname
, params
));
6369 static void GLAPIENTRY
6370 exec_GetHistogramParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
6372 GET_CURRENT_CONTEXT(ctx
);
6373 FLUSH_VERTICES(ctx
, 0);
6374 CALL_GetHistogramParameteriv(ctx
->Exec
, (target
, pname
, params
));
6377 static void GLAPIENTRY
6378 exec_GetMinmax(GLenum target
, GLboolean reset
, GLenum format
,
6379 GLenum type
, GLvoid
*values
)
6381 GET_CURRENT_CONTEXT(ctx
);
6382 FLUSH_VERTICES(ctx
, 0);
6383 CALL_GetMinmax(ctx
->Exec
, (target
, reset
, format
, type
, values
));
6386 static void GLAPIENTRY
6387 exec_GetMinmaxParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
6389 GET_CURRENT_CONTEXT(ctx
);
6390 FLUSH_VERTICES(ctx
, 0);
6391 CALL_GetMinmaxParameterfv(ctx
->Exec
, (target
, pname
, params
));
6394 static void GLAPIENTRY
6395 exec_GetMinmaxParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
6397 GET_CURRENT_CONTEXT(ctx
);
6398 FLUSH_VERTICES(ctx
, 0);
6399 CALL_GetMinmaxParameteriv(ctx
->Exec
, (target
, pname
, params
));
6402 static void GLAPIENTRY
6403 exec_GetSeparableFilter(GLenum target
, GLenum format
, GLenum type
,
6404 GLvoid
*row
, GLvoid
*column
, GLvoid
*span
)
6406 GET_CURRENT_CONTEXT(ctx
);
6407 FLUSH_VERTICES(ctx
, 0);
6408 CALL_GetSeparableFilter(ctx
->Exec
,
6409 (target
, format
, type
, row
, column
, span
));
6412 static void GLAPIENTRY
6413 exec_SeparableFilter2D(GLenum target
, GLenum internalFormat
,
6414 GLsizei width
, GLsizei height
, GLenum format
,
6415 GLenum type
, const GLvoid
*row
, const GLvoid
*column
)
6417 GET_CURRENT_CONTEXT(ctx
);
6418 FLUSH_VERTICES(ctx
, 0);
6419 CALL_SeparableFilter2D(ctx
->Exec
,
6420 (target
, internalFormat
, width
, height
, format
,
6421 type
, row
, column
));
6424 static void GLAPIENTRY
6425 exec_ColorPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
6426 GLsizei count
, const GLvoid
*ptr
)
6428 GET_CURRENT_CONTEXT(ctx
);
6429 FLUSH_VERTICES(ctx
, 0);
6430 CALL_ColorPointerEXT(ctx
->Exec
, (size
, type
, stride
, count
, ptr
));
6433 static void GLAPIENTRY
6434 exec_EdgeFlagPointerEXT(GLsizei stride
, GLsizei count
, const GLboolean
*ptr
)
6436 GET_CURRENT_CONTEXT(ctx
);
6437 FLUSH_VERTICES(ctx
, 0);
6438 CALL_EdgeFlagPointerEXT(ctx
->Exec
, (stride
, count
, ptr
));
6441 static void GLAPIENTRY
6442 exec_IndexPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
,
6445 GET_CURRENT_CONTEXT(ctx
);
6446 FLUSH_VERTICES(ctx
, 0);
6447 CALL_IndexPointerEXT(ctx
->Exec
, (type
, stride
, count
, ptr
));
6450 static void GLAPIENTRY
6451 exec_NormalPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
,
6454 GET_CURRENT_CONTEXT(ctx
);
6455 FLUSH_VERTICES(ctx
, 0);
6456 CALL_NormalPointerEXT(ctx
->Exec
, (type
, stride
, count
, ptr
));
6459 static void GLAPIENTRY
6460 exec_TexCoordPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
6461 GLsizei count
, const GLvoid
*ptr
)
6463 GET_CURRENT_CONTEXT(ctx
);
6464 FLUSH_VERTICES(ctx
, 0);
6465 CALL_TexCoordPointerEXT(ctx
->Exec
, (size
, type
, stride
, count
, ptr
));
6468 static void GLAPIENTRY
6469 exec_VertexPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
6470 GLsizei count
, const GLvoid
*ptr
)
6472 GET_CURRENT_CONTEXT(ctx
);
6473 FLUSH_VERTICES(ctx
, 0);
6474 CALL_VertexPointerEXT(ctx
->Exec
, (size
, type
, stride
, count
, ptr
));
6477 static void GLAPIENTRY
6478 exec_LockArraysEXT(GLint first
, GLsizei count
)
6480 GET_CURRENT_CONTEXT(ctx
);
6481 FLUSH_VERTICES(ctx
, 0);
6482 CALL_LockArraysEXT(ctx
->Exec
, (first
, count
));
6485 static void GLAPIENTRY
6486 exec_UnlockArraysEXT(void)
6488 GET_CURRENT_CONTEXT(ctx
);
6489 FLUSH_VERTICES(ctx
, 0);
6490 CALL_UnlockArraysEXT(ctx
->Exec
, ());
6493 static void GLAPIENTRY
6494 exec_SecondaryColorPointerEXT(GLint size
, GLenum type
,
6495 GLsizei stride
, const GLvoid
*ptr
)
6497 GET_CURRENT_CONTEXT(ctx
);
6498 FLUSH_VERTICES(ctx
, 0);
6499 CALL_SecondaryColorPointerEXT(ctx
->Exec
, (size
, type
, stride
, ptr
));
6502 static void GLAPIENTRY
6503 exec_FogCoordPointerEXT(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
6505 GET_CURRENT_CONTEXT(ctx
);
6506 FLUSH_VERTICES(ctx
, 0);
6507 CALL_FogCoordPointerEXT(ctx
->Exec
, (type
, stride
, ptr
));
6510 /* GL_IBM_multimode_draw_arrays */
6511 static void GLAPIENTRY
6512 exec_MultiModeDrawArraysIBM(const GLenum
* mode
, const GLint
* first
,
6513 const GLsizei
* count
, GLsizei primcount
,
6516 GET_CURRENT_CONTEXT(ctx
);
6517 FLUSH_VERTICES(ctx
, 0);
6518 CALL_MultiModeDrawArraysIBM(ctx
->Exec
,
6519 (mode
, first
, count
, primcount
, modestride
));
6522 /* GL_IBM_multimode_draw_arrays */
6523 static void GLAPIENTRY
6524 exec_MultiModeDrawElementsIBM(const GLenum
* mode
,
6525 const GLsizei
* count
,
6527 const GLvoid
* const *indices
,
6528 GLsizei primcount
, GLint modestride
)
6530 GET_CURRENT_CONTEXT(ctx
);
6531 FLUSH_VERTICES(ctx
, 0);
6532 CALL_MultiModeDrawElementsIBM(ctx
->Exec
,
6533 (mode
, count
, type
, indices
, primcount
,
6538 * Setup the given dispatch table to point to Mesa's display list
6539 * building functions.
6541 * This does not include any of the tnl functions - they are
6542 * initialized from _mesa_init_api_defaults and from the active vtxfmt
6545 struct _glapi_table
*
6546 _mesa_create_save_table(void)
6548 struct _glapi_table
*table
;
6550 table
= _mesa_alloc_dispatch_table(_gloffset_COUNT
);
6554 _mesa_loopback_init_api_table(table
);
6557 SET_Accum(table
, save_Accum
);
6558 SET_AlphaFunc(table
, save_AlphaFunc
);
6559 SET_Bitmap(table
, save_Bitmap
);
6560 SET_BlendFunc(table
, save_BlendFunc
);
6561 SET_CallList(table
, save_CallList
);
6562 SET_CallLists(table
, save_CallLists
);
6563 SET_Clear(table
, save_Clear
);
6564 SET_ClearAccum(table
, save_ClearAccum
);
6565 SET_ClearColor(table
, save_ClearColor
);
6566 SET_ClearDepth(table
, save_ClearDepth
);
6567 SET_ClearIndex(table
, save_ClearIndex
);
6568 SET_ClearStencil(table
, save_ClearStencil
);
6569 SET_ClipPlane(table
, save_ClipPlane
);
6570 SET_ColorMask(table
, save_ColorMask
);
6571 SET_ColorMaterial(table
, save_ColorMaterial
);
6572 SET_CopyPixels(table
, save_CopyPixels
);
6573 SET_CullFace(table
, save_CullFace
);
6574 SET_DeleteLists(table
, _mesa_DeleteLists
);
6575 SET_DepthFunc(table
, save_DepthFunc
);
6576 SET_DepthMask(table
, save_DepthMask
);
6577 SET_DepthRange(table
, save_DepthRange
);
6578 SET_Disable(table
, save_Disable
);
6579 SET_DrawBuffer(table
, save_DrawBuffer
);
6580 SET_DrawPixels(table
, save_DrawPixels
);
6581 SET_Enable(table
, save_Enable
);
6582 SET_EndList(table
, _mesa_EndList
);
6583 SET_EvalMesh1(table
, save_EvalMesh1
);
6584 SET_EvalMesh2(table
, save_EvalMesh2
);
6585 SET_Finish(table
, exec_Finish
);
6586 SET_Flush(table
, exec_Flush
);
6587 SET_Fogf(table
, save_Fogf
);
6588 SET_Fogfv(table
, save_Fogfv
);
6589 SET_Fogi(table
, save_Fogi
);
6590 SET_Fogiv(table
, save_Fogiv
);
6591 SET_FrontFace(table
, save_FrontFace
);
6592 SET_Frustum(table
, save_Frustum
);
6593 SET_GenLists(table
, _mesa_GenLists
);
6594 SET_GetBooleanv(table
, exec_GetBooleanv
);
6595 SET_GetClipPlane(table
, exec_GetClipPlane
);
6596 SET_GetDoublev(table
, exec_GetDoublev
);
6597 SET_GetError(table
, exec_GetError
);
6598 SET_GetFloatv(table
, exec_GetFloatv
);
6599 SET_GetIntegerv(table
, exec_GetIntegerv
);
6600 SET_GetLightfv(table
, exec_GetLightfv
);
6601 SET_GetLightiv(table
, exec_GetLightiv
);
6602 SET_GetMapdv(table
, exec_GetMapdv
);
6603 SET_GetMapfv(table
, exec_GetMapfv
);
6604 SET_GetMapiv(table
, exec_GetMapiv
);
6605 SET_GetMaterialfv(table
, exec_GetMaterialfv
);
6606 SET_GetMaterialiv(table
, exec_GetMaterialiv
);
6607 SET_GetPixelMapfv(table
, exec_GetPixelMapfv
);
6608 SET_GetPixelMapuiv(table
, exec_GetPixelMapuiv
);
6609 SET_GetPixelMapusv(table
, exec_GetPixelMapusv
);
6610 SET_GetPolygonStipple(table
, exec_GetPolygonStipple
);
6611 SET_GetString(table
, exec_GetString
);
6612 SET_GetTexEnvfv(table
, exec_GetTexEnvfv
);
6613 SET_GetTexEnviv(table
, exec_GetTexEnviv
);
6614 SET_GetTexGendv(table
, exec_GetTexGendv
);
6615 SET_GetTexGenfv(table
, exec_GetTexGenfv
);
6616 SET_GetTexGeniv(table
, exec_GetTexGeniv
);
6617 SET_GetTexImage(table
, exec_GetTexImage
);
6618 SET_GetTexLevelParameterfv(table
, exec_GetTexLevelParameterfv
);
6619 SET_GetTexLevelParameteriv(table
, exec_GetTexLevelParameteriv
);
6620 SET_GetTexParameterfv(table
, exec_GetTexParameterfv
);
6621 SET_GetTexParameteriv(table
, exec_GetTexParameteriv
);
6622 SET_Hint(table
, save_Hint
);
6623 SET_IndexMask(table
, save_IndexMask
);
6624 SET_InitNames(table
, save_InitNames
);
6625 SET_IsEnabled(table
, exec_IsEnabled
);
6626 SET_IsList(table
, _mesa_IsList
);
6627 SET_LightModelf(table
, save_LightModelf
);
6628 SET_LightModelfv(table
, save_LightModelfv
);
6629 SET_LightModeli(table
, save_LightModeli
);
6630 SET_LightModeliv(table
, save_LightModeliv
);
6631 SET_Lightf(table
, save_Lightf
);
6632 SET_Lightfv(table
, save_Lightfv
);
6633 SET_Lighti(table
, save_Lighti
);
6634 SET_Lightiv(table
, save_Lightiv
);
6635 SET_LineStipple(table
, save_LineStipple
);
6636 SET_LineWidth(table
, save_LineWidth
);
6637 SET_ListBase(table
, save_ListBase
);
6638 SET_LoadIdentity(table
, save_LoadIdentity
);
6639 SET_LoadMatrixd(table
, save_LoadMatrixd
);
6640 SET_LoadMatrixf(table
, save_LoadMatrixf
);
6641 SET_LoadName(table
, save_LoadName
);
6642 SET_LogicOp(table
, save_LogicOp
);
6643 SET_Map1d(table
, save_Map1d
);
6644 SET_Map1f(table
, save_Map1f
);
6645 SET_Map2d(table
, save_Map2d
);
6646 SET_Map2f(table
, save_Map2f
);
6647 SET_MapGrid1d(table
, save_MapGrid1d
);
6648 SET_MapGrid1f(table
, save_MapGrid1f
);
6649 SET_MapGrid2d(table
, save_MapGrid2d
);
6650 SET_MapGrid2f(table
, save_MapGrid2f
);
6651 SET_MatrixMode(table
, save_MatrixMode
);
6652 SET_MultMatrixd(table
, save_MultMatrixd
);
6653 SET_MultMatrixf(table
, save_MultMatrixf
);
6654 SET_NewList(table
, save_NewList
);
6655 SET_Ortho(table
, save_Ortho
);
6656 SET_PassThrough(table
, save_PassThrough
);
6657 SET_PixelMapfv(table
, save_PixelMapfv
);
6658 SET_PixelMapuiv(table
, save_PixelMapuiv
);
6659 SET_PixelMapusv(table
, save_PixelMapusv
);
6660 SET_PixelStoref(table
, exec_PixelStoref
);
6661 SET_PixelStorei(table
, exec_PixelStorei
);
6662 SET_PixelTransferf(table
, save_PixelTransferf
);
6663 SET_PixelTransferi(table
, save_PixelTransferi
);
6664 SET_PixelZoom(table
, save_PixelZoom
);
6665 SET_PointSize(table
, save_PointSize
);
6666 SET_PolygonMode(table
, save_PolygonMode
);
6667 SET_PolygonOffset(table
, save_PolygonOffset
);
6668 SET_PolygonStipple(table
, save_PolygonStipple
);
6669 SET_PopAttrib(table
, save_PopAttrib
);
6670 SET_PopMatrix(table
, save_PopMatrix
);
6671 SET_PopName(table
, save_PopName
);
6672 SET_PushAttrib(table
, save_PushAttrib
);
6673 SET_PushMatrix(table
, save_PushMatrix
);
6674 SET_PushName(table
, save_PushName
);
6675 SET_RasterPos2d(table
, save_RasterPos2d
);
6676 SET_RasterPos2dv(table
, save_RasterPos2dv
);
6677 SET_RasterPos2f(table
, save_RasterPos2f
);
6678 SET_RasterPos2fv(table
, save_RasterPos2fv
);
6679 SET_RasterPos2i(table
, save_RasterPos2i
);
6680 SET_RasterPos2iv(table
, save_RasterPos2iv
);
6681 SET_RasterPos2s(table
, save_RasterPos2s
);
6682 SET_RasterPos2sv(table
, save_RasterPos2sv
);
6683 SET_RasterPos3d(table
, save_RasterPos3d
);
6684 SET_RasterPos3dv(table
, save_RasterPos3dv
);
6685 SET_RasterPos3f(table
, save_RasterPos3f
);
6686 SET_RasterPos3fv(table
, save_RasterPos3fv
);
6687 SET_RasterPos3i(table
, save_RasterPos3i
);
6688 SET_RasterPos3iv(table
, save_RasterPos3iv
);
6689 SET_RasterPos3s(table
, save_RasterPos3s
);
6690 SET_RasterPos3sv(table
, save_RasterPos3sv
);
6691 SET_RasterPos4d(table
, save_RasterPos4d
);
6692 SET_RasterPos4dv(table
, save_RasterPos4dv
);
6693 SET_RasterPos4f(table
, save_RasterPos4f
);
6694 SET_RasterPos4fv(table
, save_RasterPos4fv
);
6695 SET_RasterPos4i(table
, save_RasterPos4i
);
6696 SET_RasterPos4iv(table
, save_RasterPos4iv
);
6697 SET_RasterPos4s(table
, save_RasterPos4s
);
6698 SET_RasterPos4sv(table
, save_RasterPos4sv
);
6699 SET_ReadBuffer(table
, save_ReadBuffer
);
6700 SET_ReadPixels(table
, exec_ReadPixels
);
6701 SET_RenderMode(table
, exec_RenderMode
);
6702 SET_Rotated(table
, save_Rotated
);
6703 SET_Rotatef(table
, save_Rotatef
);
6704 SET_Scaled(table
, save_Scaled
);
6705 SET_Scalef(table
, save_Scalef
);
6706 SET_Scissor(table
, save_Scissor
);
6707 SET_FeedbackBuffer(table
, exec_FeedbackBuffer
);
6708 SET_SelectBuffer(table
, exec_SelectBuffer
);
6709 SET_ShadeModel(table
, save_ShadeModel
);
6710 SET_StencilFunc(table
, save_StencilFunc
);
6711 SET_StencilMask(table
, save_StencilMask
);
6712 SET_StencilOp(table
, save_StencilOp
);
6713 SET_TexEnvf(table
, save_TexEnvf
);
6714 SET_TexEnvfv(table
, save_TexEnvfv
);
6715 SET_TexEnvi(table
, save_TexEnvi
);
6716 SET_TexEnviv(table
, save_TexEnviv
);
6717 SET_TexGend(table
, save_TexGend
);
6718 SET_TexGendv(table
, save_TexGendv
);
6719 SET_TexGenf(table
, save_TexGenf
);
6720 SET_TexGenfv(table
, save_TexGenfv
);
6721 SET_TexGeni(table
, save_TexGeni
);
6722 SET_TexGeniv(table
, save_TexGeniv
);
6723 SET_TexImage1D(table
, save_TexImage1D
);
6724 SET_TexImage2D(table
, save_TexImage2D
);
6725 SET_TexParameterf(table
, save_TexParameterf
);
6726 SET_TexParameterfv(table
, save_TexParameterfv
);
6727 SET_TexParameteri(table
, save_TexParameteri
);
6728 SET_TexParameteriv(table
, save_TexParameteriv
);
6729 SET_Translated(table
, save_Translated
);
6730 SET_Translatef(table
, save_Translatef
);
6731 SET_Viewport(table
, save_Viewport
);
6734 SET_AreTexturesResident(table
, exec_AreTexturesResident
);
6735 SET_BindTexture(table
, save_BindTexture
);
6736 SET_ColorPointer(table
, exec_ColorPointer
);
6737 SET_CopyTexImage1D(table
, save_CopyTexImage1D
);
6738 SET_CopyTexImage2D(table
, save_CopyTexImage2D
);
6739 SET_CopyTexSubImage1D(table
, save_CopyTexSubImage1D
);
6740 SET_CopyTexSubImage2D(table
, save_CopyTexSubImage2D
);
6741 SET_DeleteTextures(table
, exec_DeleteTextures
);
6742 SET_DisableClientState(table
, exec_DisableClientState
);
6743 SET_EdgeFlagPointer(table
, exec_EdgeFlagPointer
);
6744 SET_EnableClientState(table
, exec_EnableClientState
);
6745 SET_GenTextures(table
, exec_GenTextures
);
6746 SET_GetPointerv(table
, exec_GetPointerv
);
6747 SET_IndexPointer(table
, exec_IndexPointer
);
6748 SET_InterleavedArrays(table
, exec_InterleavedArrays
);
6749 SET_IsTexture(table
, exec_IsTexture
);
6750 SET_NormalPointer(table
, exec_NormalPointer
);
6751 SET_PopClientAttrib(table
, exec_PopClientAttrib
);
6752 SET_PrioritizeTextures(table
, save_PrioritizeTextures
);
6753 SET_PushClientAttrib(table
, exec_PushClientAttrib
);
6754 SET_TexCoordPointer(table
, exec_TexCoordPointer
);
6755 SET_TexSubImage1D(table
, save_TexSubImage1D
);
6756 SET_TexSubImage2D(table
, save_TexSubImage2D
);
6757 SET_VertexPointer(table
, exec_VertexPointer
);
6760 SET_CopyTexSubImage3D(table
, save_CopyTexSubImage3D
);
6761 SET_TexImage3D(table
, save_TexImage3D
);
6762 SET_TexSubImage3D(table
, save_TexSubImage3D
);
6764 /* GL_ARB_imaging */
6765 /* Not all are supported */
6766 SET_BlendColor(table
, save_BlendColor
);
6767 SET_BlendEquation(table
, save_BlendEquation
);
6768 SET_ColorSubTable(table
, save_ColorSubTable
);
6769 SET_ColorTable(table
, save_ColorTable
);
6770 SET_ColorTableParameterfv(table
, save_ColorTableParameterfv
);
6771 SET_ColorTableParameteriv(table
, save_ColorTableParameteriv
);
6772 SET_ConvolutionFilter1D(table
, save_ConvolutionFilter1D
);
6773 SET_ConvolutionFilter2D(table
, save_ConvolutionFilter2D
);
6774 SET_ConvolutionParameterf(table
, save_ConvolutionParameterf
);
6775 SET_ConvolutionParameterfv(table
, save_ConvolutionParameterfv
);
6776 SET_ConvolutionParameteri(table
, save_ConvolutionParameteri
);
6777 SET_ConvolutionParameteriv(table
, save_ConvolutionParameteriv
);
6778 SET_CopyColorSubTable(table
, save_CopyColorSubTable
);
6779 SET_CopyColorTable(table
, save_CopyColorTable
);
6780 SET_CopyConvolutionFilter1D(table
, exec_CopyConvolutionFilter1D
);
6781 SET_CopyConvolutionFilter2D(table
, exec_CopyConvolutionFilter2D
);
6782 SET_GetColorTable(table
, exec_GetColorTable
);
6783 SET_GetColorTableParameterfv(table
, exec_GetColorTableParameterfv
);
6784 SET_GetColorTableParameteriv(table
, exec_GetColorTableParameteriv
);
6785 SET_GetConvolutionFilter(table
, exec_GetConvolutionFilter
);
6786 SET_GetConvolutionParameterfv(table
, exec_GetConvolutionParameterfv
);
6787 SET_GetConvolutionParameteriv(table
, exec_GetConvolutionParameteriv
);
6788 SET_GetHistogram(table
, exec_GetHistogram
);
6789 SET_GetHistogramParameterfv(table
, exec_GetHistogramParameterfv
);
6790 SET_GetHistogramParameteriv(table
, exec_GetHistogramParameteriv
);
6791 SET_GetMinmax(table
, exec_GetMinmax
);
6792 SET_GetMinmaxParameterfv(table
, exec_GetMinmaxParameterfv
);
6793 SET_GetMinmaxParameteriv(table
, exec_GetMinmaxParameteriv
);
6794 SET_GetSeparableFilter(table
, exec_GetSeparableFilter
);
6795 SET_Histogram(table
, save_Histogram
);
6796 SET_Minmax(table
, save_Minmax
);
6797 SET_ResetHistogram(table
, save_ResetHistogram
);
6798 SET_ResetMinmax(table
, save_ResetMinmax
);
6799 SET_SeparableFilter2D(table
, exec_SeparableFilter2D
);
6801 /* 2. GL_EXT_blend_color */
6803 SET_BlendColorEXT(table
, save_BlendColorEXT
);
6806 /* 3. GL_EXT_polygon_offset */
6807 SET_PolygonOffsetEXT(table
, save_PolygonOffsetEXT
);
6809 /* 6. GL_EXT_texture3d */
6811 SET_CopyTexSubImage3DEXT(table
, save_CopyTexSubImage3D
);
6812 SET_TexImage3DEXT(table
, save_TexImage3DEXT
);
6813 SET_TexSubImage3DEXT(table
, save_TexSubImage3D
);
6816 /* 14. GL_SGI_color_table */
6818 SET_ColorTableSGI(table
, save_ColorTable
);
6819 SET_ColorSubTableSGI(table
, save_ColorSubTable
);
6820 SET_GetColorTableSGI(table
, exec_GetColorTable
);
6821 SET_GetColorTableParameterfvSGI(table
, exec_GetColorTableParameterfv
);
6822 SET_GetColorTableParameterivSGI(table
, exec_GetColorTableParameteriv
);
6825 /* 30. GL_EXT_vertex_array */
6826 SET_ColorPointerEXT(table
, exec_ColorPointerEXT
);
6827 SET_EdgeFlagPointerEXT(table
, exec_EdgeFlagPointerEXT
);
6828 SET_IndexPointerEXT(table
, exec_IndexPointerEXT
);
6829 SET_NormalPointerEXT(table
, exec_NormalPointerEXT
);
6830 SET_TexCoordPointerEXT(table
, exec_TexCoordPointerEXT
);
6831 SET_VertexPointerEXT(table
, exec_VertexPointerEXT
);
6833 /* 37. GL_EXT_blend_minmax */
6835 SET_BlendEquationEXT(table
, save_BlendEquationEXT
);
6838 /* 54. GL_EXT_point_parameters */
6839 SET_PointParameterfEXT(table
, save_PointParameterfEXT
);
6840 SET_PointParameterfvEXT(table
, save_PointParameterfvEXT
);
6842 /* 97. GL_EXT_compiled_vertex_array */
6843 SET_LockArraysEXT(table
, exec_LockArraysEXT
);
6844 SET_UnlockArraysEXT(table
, exec_UnlockArraysEXT
);
6846 /* 145. GL_EXT_secondary_color */
6847 SET_SecondaryColorPointerEXT(table
, exec_SecondaryColorPointerEXT
);
6849 /* 149. GL_EXT_fog_coord */
6850 SET_FogCoordPointerEXT(table
, exec_FogCoordPointerEXT
);
6852 /* 173. GL_EXT_blend_func_separate */
6853 SET_BlendFuncSeparateEXT(table
, save_BlendFuncSeparateEXT
);
6855 /* 197. GL_MESA_window_pos */
6856 SET_WindowPos2dMESA(table
, save_WindowPos2dMESA
);
6857 SET_WindowPos2dvMESA(table
, save_WindowPos2dvMESA
);
6858 SET_WindowPos2fMESA(table
, save_WindowPos2fMESA
);
6859 SET_WindowPos2fvMESA(table
, save_WindowPos2fvMESA
);
6860 SET_WindowPos2iMESA(table
, save_WindowPos2iMESA
);
6861 SET_WindowPos2ivMESA(table
, save_WindowPos2ivMESA
);
6862 SET_WindowPos2sMESA(table
, save_WindowPos2sMESA
);
6863 SET_WindowPos2svMESA(table
, save_WindowPos2svMESA
);
6864 SET_WindowPos3dMESA(table
, save_WindowPos3dMESA
);
6865 SET_WindowPos3dvMESA(table
, save_WindowPos3dvMESA
);
6866 SET_WindowPos3fMESA(table
, save_WindowPos3fMESA
);
6867 SET_WindowPos3fvMESA(table
, save_WindowPos3fvMESA
);
6868 SET_WindowPos3iMESA(table
, save_WindowPos3iMESA
);
6869 SET_WindowPos3ivMESA(table
, save_WindowPos3ivMESA
);
6870 SET_WindowPos3sMESA(table
, save_WindowPos3sMESA
);
6871 SET_WindowPos3svMESA(table
, save_WindowPos3svMESA
);
6872 SET_WindowPos4dMESA(table
, save_WindowPos4dMESA
);
6873 SET_WindowPos4dvMESA(table
, save_WindowPos4dvMESA
);
6874 SET_WindowPos4fMESA(table
, save_WindowPos4fMESA
);
6875 SET_WindowPos4fvMESA(table
, save_WindowPos4fvMESA
);
6876 SET_WindowPos4iMESA(table
, save_WindowPos4iMESA
);
6877 SET_WindowPos4ivMESA(table
, save_WindowPos4ivMESA
);
6878 SET_WindowPos4sMESA(table
, save_WindowPos4sMESA
);
6879 SET_WindowPos4svMESA(table
, save_WindowPos4svMESA
);
6881 /* 200. GL_IBM_multimode_draw_arrays */
6882 SET_MultiModeDrawArraysIBM(table
, exec_MultiModeDrawArraysIBM
);
6883 SET_MultiModeDrawElementsIBM(table
, exec_MultiModeDrawElementsIBM
);
6885 #if FEATURE_NV_vertex_program
6886 /* 233. GL_NV_vertex_program */
6887 /* The following commands DO NOT go into display lists:
6888 * AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV,
6889 * VertexAttribPointerNV, GetProgram*, GetVertexAttrib*
6891 SET_ExecuteProgramNV(table
, save_ExecuteProgramNV
);
6892 SET_AreProgramsResidentNV(table
, _mesa_AreProgramsResidentNV
);
6893 SET_RequestResidentProgramsNV(table
, save_RequestResidentProgramsNV
);
6894 SET_GetProgramParameterfvNV(table
, _mesa_GetProgramParameterfvNV
);
6895 SET_GetProgramParameterdvNV(table
, _mesa_GetProgramParameterdvNV
);
6896 SET_GetTrackMatrixivNV(table
, _mesa_GetTrackMatrixivNV
);
6897 SET_LoadProgramNV(table
, save_LoadProgramNV
);
6898 SET_ProgramParameters4dvNV(table
, save_ProgramParameters4dvNV
);
6899 SET_ProgramParameters4fvNV(table
, save_ProgramParameters4fvNV
);
6900 SET_TrackMatrixNV(table
, save_TrackMatrixNV
);
6903 /* 282. GL_NV_fragment_program */
6904 #if FEATURE_NV_fragment_program
6905 SET_ProgramNamedParameter4fNV(table
, save_ProgramNamedParameter4fNV
);
6906 SET_ProgramNamedParameter4dNV(table
, save_ProgramNamedParameter4dNV
);
6907 SET_ProgramNamedParameter4fvNV(table
, save_ProgramNamedParameter4fvNV
);
6908 SET_ProgramNamedParameter4dvNV(table
, save_ProgramNamedParameter4dvNV
);
6909 SET_GetProgramNamedParameterfvNV(table
,
6910 _mesa_GetProgramNamedParameterfvNV
);
6911 SET_GetProgramNamedParameterdvNV(table
,
6912 _mesa_GetProgramNamedParameterdvNV
);
6915 /* 262. GL_NV_point_sprite */
6916 SET_PointParameteriNV(table
, save_PointParameteriNV
);
6917 SET_PointParameterivNV(table
, save_PointParameterivNV
);
6919 /* 273. GL_APPLE_vertex_array_object */
6920 SET_BindVertexArrayAPPLE(table
, _mesa_BindVertexArrayAPPLE
);
6921 SET_DeleteVertexArraysAPPLE(table
, _mesa_DeleteVertexArraysAPPLE
);
6922 SET_GenVertexArraysAPPLE(table
, _mesa_GenVertexArraysAPPLE
);
6923 SET_IsVertexArrayAPPLE(table
, _mesa_IsVertexArrayAPPLE
);
6925 /* GL_ARB_vertex_array_object */
6926 SET_BindVertexArray(table
, _mesa_BindVertexArray
);
6927 SET_GenVertexArrays(table
, _mesa_GenVertexArrays
);
6929 /* ???. GL_EXT_depth_bounds_test */
6930 SET_DepthBoundsEXT(table
, save_DepthBoundsEXT
);
6932 /* ARB 3. GL_ARB_transpose_matrix */
6933 SET_LoadTransposeMatrixdARB(table
, save_LoadTransposeMatrixdARB
);
6934 SET_LoadTransposeMatrixfARB(table
, save_LoadTransposeMatrixfARB
);
6935 SET_MultTransposeMatrixdARB(table
, save_MultTransposeMatrixdARB
);
6936 SET_MultTransposeMatrixfARB(table
, save_MultTransposeMatrixfARB
);
6938 /* ARB 5. GL_ARB_multisample */
6939 SET_SampleCoverageARB(table
, save_SampleCoverageARB
);
6941 /* ARB 28. GL_ARB_vertex_buffer_object */
6942 /* None of the extension's functions get compiled */
6943 SET_BindBufferARB(table
, _mesa_BindBufferARB
);
6944 SET_BufferDataARB(table
, _mesa_BufferDataARB
);
6945 SET_BufferSubDataARB(table
, _mesa_BufferSubDataARB
);
6946 SET_DeleteBuffersARB(table
, _mesa_DeleteBuffersARB
);
6947 SET_GenBuffersARB(table
, _mesa_GenBuffersARB
);
6948 SET_GetBufferParameterivARB(table
, _mesa_GetBufferParameterivARB
);
6949 SET_GetBufferPointervARB(table
, _mesa_GetBufferPointervARB
);
6950 SET_GetBufferSubDataARB(table
, _mesa_GetBufferSubDataARB
);
6951 SET_IsBufferARB(table
, _mesa_IsBufferARB
);
6952 SET_MapBufferARB(table
, _mesa_MapBufferARB
);
6953 SET_UnmapBufferARB(table
, _mesa_UnmapBufferARB
);
6955 /* 299. GL_EXT_blend_equation_separate */
6956 SET_BlendEquationSeparateEXT(table
, save_BlendEquationSeparateEXT
);
6958 /* ARB 50. GL_ARB_map_buffer_range */
6959 #if FEATURE_ARB_map_buffer_range
6960 SET_MapBufferRange(table
, _mesa_MapBufferRange
); /* no dlist save */
6961 SET_FlushMappedBufferRange(table
, _mesa_FlushMappedBufferRange
); /* no dl */
6964 /* 371. GL_APPLE_object_purgeable */
6965 #if FEATURE_APPLE_object_purgeable
6966 SET_ObjectPurgeableAPPLE(table
, _mesa_ObjectPurgeableAPPLE
);
6967 SET_ObjectUnpurgeableAPPLE(table
, _mesa_ObjectUnpurgeableAPPLE
);
6968 SET_GetObjectParameterivAPPLE(table
, _mesa_GetObjectParameterivAPPLE
);
6971 /* GL_EXT_texture_integer */
6972 SET_ClearColorIiEXT(table
, save_ClearColorIi
);
6973 SET_ClearColorIuiEXT(table
, save_ClearColorIui
);
6974 SET_TexParameterIivEXT(table
, save_TexParameterIiv
);
6975 SET_TexParameterIuivEXT(table
, save_TexParameterIuiv
);
6976 SET_GetTexParameterIivEXT(table
, exec_GetTexParameterIiv
);
6977 SET_GetTexParameterIuivEXT(table
, exec_GetTexParameterIuiv
);
6979 /* GL_NV_texture_barrier */
6980 SET_TextureBarrierNV(table
, save_TextureBarrierNV
);
6982 /* GL_ARB_texture_storage (no dlist support) */
6983 SET_TexStorage1D(table
, _mesa_TexStorage1D
);
6984 SET_TexStorage2D(table
, _mesa_TexStorage2D
);
6985 SET_TexStorage3D(table
, _mesa_TexStorage3D
);
6986 SET_TextureStorage1DEXT(table
, _mesa_TextureStorage1DEXT
);
6987 SET_TextureStorage2DEXT(table
, _mesa_TextureStorage2DEXT
);
6988 SET_TextureStorage3DEXT(table
, _mesa_TextureStorage3DEXT
);
6996 enum_string(GLenum k
)
6998 return _mesa_lookup_enum_by_nr(k
);
7003 * Print the commands in a display list. For debugging only.
7004 * TODO: many commands aren't handled yet.
7006 static void GLAPIENTRY
7007 print_list(struct gl_context
*ctx
, GLuint list
)
7009 struct gl_display_list
*dlist
;
7013 if (!islist(ctx
, list
)) {
7014 printf("%u is not a display list ID\n", list
);
7018 dlist
= lookup_list(ctx
, list
);
7024 printf("START-LIST %u, address %p\n", list
, (void *) n
);
7026 done
= n
? GL_FALSE
: GL_TRUE
;
7028 const OpCode opcode
= n
[0].opcode
;
7030 if (is_ext_opcode(opcode
)) {
7031 n
+= ext_opcode_print(ctx
, n
);
7036 printf("Accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
7039 printf("Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
7040 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
, (void *) n
[7].data
);
7042 case OPCODE_CALL_LIST
:
7043 printf("CallList %d\n", (int) n
[1].ui
);
7045 case OPCODE_CALL_LIST_OFFSET
:
7046 printf("CallList %d + offset %u = %u\n", (int) n
[1].ui
,
7047 ctx
->List
.ListBase
, ctx
->List
.ListBase
+ n
[1].ui
);
7049 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
7050 printf("ColorTableParameterfv %s %s %f %f %f %f\n",
7051 enum_string(n
[1].e
), enum_string(n
[2].e
),
7052 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
7054 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
7055 printf("ColorTableParameteriv %s %s %d %d %d %d\n",
7056 enum_string(n
[1].e
), enum_string(n
[2].e
),
7057 n
[3].i
, n
[4].i
, n
[5].i
, n
[6].i
);
7059 case OPCODE_DISABLE
:
7060 printf("Disable %s\n", enum_string(n
[1].e
));
7063 printf("Enable %s\n", enum_string(n
[1].e
));
7065 case OPCODE_FRUSTUM
:
7066 printf("Frustum %g %g %g %g %g %g\n",
7067 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
7069 case OPCODE_LINE_STIPPLE
:
7070 printf("LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
7072 case OPCODE_LOAD_IDENTITY
:
7073 printf("LoadIdentity\n");
7075 case OPCODE_LOAD_MATRIX
:
7076 printf("LoadMatrix\n");
7077 printf(" %8f %8f %8f %8f\n",
7078 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
7079 printf(" %8f %8f %8f %8f\n",
7080 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
7081 printf(" %8f %8f %8f %8f\n",
7082 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
7083 printf(" %8f %8f %8f %8f\n",
7084 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
7086 case OPCODE_MULT_MATRIX
:
7087 printf("MultMatrix (or Rotate)\n");
7088 printf(" %8f %8f %8f %8f\n",
7089 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
7090 printf(" %8f %8f %8f %8f\n",
7091 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
7092 printf(" %8f %8f %8f %8f\n",
7093 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
7094 printf(" %8f %8f %8f %8f\n",
7095 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
7098 printf("Ortho %g %g %g %g %g %g\n",
7099 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
7101 case OPCODE_POP_ATTRIB
:
7102 printf("PopAttrib\n");
7104 case OPCODE_POP_MATRIX
:
7105 printf("PopMatrix\n");
7107 case OPCODE_POP_NAME
:
7108 printf("PopName\n");
7110 case OPCODE_PUSH_ATTRIB
:
7111 printf("PushAttrib %x\n", n
[1].bf
);
7113 case OPCODE_PUSH_MATRIX
:
7114 printf("PushMatrix\n");
7116 case OPCODE_PUSH_NAME
:
7117 printf("PushName %d\n", (int) n
[1].ui
);
7119 case OPCODE_RASTER_POS
:
7120 printf("RasterPos %g %g %g %g\n",
7121 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
7124 printf("Rotate %g %g %g %g\n",
7125 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
7128 printf("Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
7130 case OPCODE_TRANSLATE
:
7131 printf("Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
7133 case OPCODE_BIND_TEXTURE
:
7134 printf("BindTexture %s %d\n",
7135 _mesa_lookup_enum_by_nr(n
[1].ui
), n
[2].ui
);
7137 case OPCODE_SHADE_MODEL
:
7138 printf("ShadeModel %s\n", _mesa_lookup_enum_by_nr(n
[1].ui
));
7141 printf("Map1 %s %.3f %.3f %d %d\n",
7142 _mesa_lookup_enum_by_nr(n
[1].ui
),
7143 n
[2].f
, n
[3].f
, n
[4].i
, n
[5].i
);
7146 printf("Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
7147 _mesa_lookup_enum_by_nr(n
[1].ui
),
7148 n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
,
7149 n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
7151 case OPCODE_MAPGRID1
:
7152 printf("MapGrid1 %d %.3f %.3f\n", n
[1].i
, n
[2].f
, n
[3].f
);
7154 case OPCODE_MAPGRID2
:
7155 printf("MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
7156 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
7158 case OPCODE_EVALMESH1
:
7159 printf("EvalMesh1 %d %d\n", n
[1].i
, n
[2].i
);
7161 case OPCODE_EVALMESH2
:
7162 printf("EvalMesh2 %d %d %d %d\n",
7163 n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
7166 case OPCODE_ATTR_1F_NV
:
7167 printf("ATTR_1F_NV attr %d: %f\n", n
[1].i
, n
[2].f
);
7169 case OPCODE_ATTR_2F_NV
:
7170 printf("ATTR_2F_NV attr %d: %f %f\n",
7171 n
[1].i
, n
[2].f
, n
[3].f
);
7173 case OPCODE_ATTR_3F_NV
:
7174 printf("ATTR_3F_NV attr %d: %f %f %f\n",
7175 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
7177 case OPCODE_ATTR_4F_NV
:
7178 printf("ATTR_4F_NV attr %d: %f %f %f %f\n",
7179 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
7182 case OPCODE_MATERIAL
:
7183 printf("MATERIAL %x %x: %f %f %f %f\n",
7184 n
[1].i
, n
[2].i
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
7187 printf("BEGIN %x\n", n
[1].i
);
7193 printf("RECTF %f %f %f %f\n", n
[1].f
, n
[2].f
, n
[3].f
,
7196 case OPCODE_EVAL_C1
:
7197 printf("EVAL_C1 %f\n", n
[1].f
);
7199 case OPCODE_EVAL_C2
:
7200 printf("EVAL_C2 %f %f\n", n
[1].f
, n
[2].f
);
7202 case OPCODE_EVAL_P1
:
7203 printf("EVAL_P1 %d\n", n
[1].i
);
7205 case OPCODE_EVAL_P2
:
7206 printf("EVAL_P2 %d %d\n", n
[1].i
, n
[2].i
);
7210 * meta opcodes/commands
7213 printf("Error: %s %s\n",
7214 enum_string(n
[1].e
), (const char *) n
[2].data
);
7216 case OPCODE_CONTINUE
:
7217 printf("DISPLAY-LIST-CONTINUE\n");
7218 n
= (Node
*) n
[1].next
;
7220 case OPCODE_END_OF_LIST
:
7221 printf("END-LIST %u\n", list
);
7225 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
7227 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
7228 opcode
, (void *) n
);
7232 printf("command %d, %u operands\n", opcode
,
7236 /* increment n to point to next compiled command */
7237 if (opcode
!= OPCODE_CONTINUE
) {
7238 n
+= InstSize
[opcode
];
7247 * Clients may call this function to help debug display list problems.
7248 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
7249 * changed, or break in the future without notice.
7252 mesa_print_display_list(GLuint list
)
7254 GET_CURRENT_CONTEXT(ctx
);
7255 print_list(ctx
, list
);
7259 /**********************************************************************/
7260 /***** Initialization *****/
7261 /**********************************************************************/
7264 _mesa_save_vtxfmt_init(GLvertexformat
* vfmt
)
7266 _MESA_INIT_ARRAYELT_VTXFMT(vfmt
, _ae_
);
7268 vfmt
->Begin
= save_Begin
;
7270 _MESA_INIT_DLIST_VTXFMT(vfmt
, save_
);
7272 vfmt
->Color3f
= save_Color3f
;
7273 vfmt
->Color3fv
= save_Color3fv
;
7274 vfmt
->Color4f
= save_Color4f
;
7275 vfmt
->Color4fv
= save_Color4fv
;
7276 vfmt
->EdgeFlag
= save_EdgeFlag
;
7277 vfmt
->End
= save_End
;
7279 _MESA_INIT_EVAL_VTXFMT(vfmt
, save_
);
7281 vfmt
->FogCoordfEXT
= save_FogCoordfEXT
;
7282 vfmt
->FogCoordfvEXT
= save_FogCoordfvEXT
;
7283 vfmt
->Indexf
= save_Indexf
;
7284 vfmt
->Indexfv
= save_Indexfv
;
7285 vfmt
->Materialfv
= save_Materialfv
;
7286 vfmt
->Normal3f
= save_Normal3f
;
7287 vfmt
->Normal3fv
= save_Normal3fv
;
7288 vfmt
->SecondaryColor3fEXT
= save_SecondaryColor3fEXT
;
7289 vfmt
->SecondaryColor3fvEXT
= save_SecondaryColor3fvEXT
;
7290 vfmt
->TexCoord1f
= save_TexCoord1f
;
7291 vfmt
->TexCoord1fv
= save_TexCoord1fv
;
7292 vfmt
->TexCoord2f
= save_TexCoord2f
;
7293 vfmt
->TexCoord2fv
= save_TexCoord2fv
;
7294 vfmt
->TexCoord3f
= save_TexCoord3f
;
7295 vfmt
->TexCoord3fv
= save_TexCoord3fv
;
7296 vfmt
->TexCoord4f
= save_TexCoord4f
;
7297 vfmt
->TexCoord4fv
= save_TexCoord4fv
;
7298 vfmt
->Vertex2f
= save_Vertex2f
;
7299 vfmt
->Vertex2fv
= save_Vertex2fv
;
7300 vfmt
->Vertex3f
= save_Vertex3f
;
7301 vfmt
->Vertex3fv
= save_Vertex3fv
;
7302 vfmt
->Vertex4f
= save_Vertex4f
;
7303 vfmt
->Vertex4fv
= save_Vertex4fv
;
7304 vfmt
->VertexAttrib1fNV
= save_VertexAttrib1fNV
;
7305 vfmt
->VertexAttrib1fvNV
= save_VertexAttrib1fvNV
;
7306 vfmt
->VertexAttrib2fNV
= save_VertexAttrib2fNV
;
7307 vfmt
->VertexAttrib2fvNV
= save_VertexAttrib2fvNV
;
7308 vfmt
->VertexAttrib3fNV
= save_VertexAttrib3fNV
;
7309 vfmt
->VertexAttrib3fvNV
= save_VertexAttrib3fvNV
;
7310 vfmt
->VertexAttrib4fNV
= save_VertexAttrib4fNV
;
7311 vfmt
->VertexAttrib4fvNV
= save_VertexAttrib4fvNV
;
7313 vfmt
->Rectf
= save_Rectf
;
7315 /* The driver is required to implement these as
7316 * 1) They can probably do a better job.
7317 * 2) A lot of new mechanisms would have to be added to this module
7318 * to support it. That code would probably never get used,
7322 vfmt
->DrawArrays
= 0;
7323 vfmt
->DrawElements
= 0;
7324 vfmt
->DrawRangeElements
= 0;
7330 _mesa_install_dlist_vtxfmt(struct _glapi_table
*disp
,
7331 const GLvertexformat
*vfmt
)
7333 SET_CallList(disp
, vfmt
->CallList
);
7334 SET_CallLists(disp
, vfmt
->CallLists
);
7338 void _mesa_init_dlist_dispatch(struct _glapi_table
*disp
)
7340 SET_CallList(disp
, _mesa_CallList
);
7341 SET_CallLists(disp
, _mesa_CallLists
);
7343 SET_DeleteLists(disp
, _mesa_DeleteLists
);
7344 SET_EndList(disp
, _mesa_EndList
);
7345 SET_GenLists(disp
, _mesa_GenLists
);
7346 SET_IsList(disp
, _mesa_IsList
);
7347 SET_ListBase(disp
, _mesa_ListBase
);
7348 SET_NewList(disp
, _mesa_NewList
);
7352 #endif /* FEATURE_dlist */
7356 * Initialize display list state for given context.
7359 _mesa_init_display_list(struct gl_context
*ctx
)
7361 static GLboolean tableInitialized
= GL_FALSE
;
7363 /* zero-out the instruction size table, just once */
7364 if (!tableInitialized
) {
7365 memset(InstSize
, 0, sizeof(InstSize
));
7366 tableInitialized
= GL_TRUE
;
7369 /* extension info */
7370 ctx
->ListExt
= CALLOC_STRUCT(gl_list_extensions
);
7373 ctx
->ListState
.CallDepth
= 0;
7374 ctx
->ExecuteFlag
= GL_TRUE
;
7375 ctx
->CompileFlag
= GL_FALSE
;
7376 ctx
->ListState
.CurrentBlock
= NULL
;
7377 ctx
->ListState
.CurrentPos
= 0;
7379 /* Display List group */
7380 ctx
->List
.ListBase
= 0;
7383 _mesa_save_vtxfmt_init(&ctx
->ListState
.ListVtxfmt
);
7389 _mesa_free_display_list_data(struct gl_context
*ctx
)
7392 ctx
->ListExt
= NULL
;