2 * Mesa 3-D graphics library
5 * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 * Display lists management functions.
33 #include "api_arrayelt.h"
34 #include "api_loopback.h"
39 #if FEATURE_ARB_vertex_buffer_object
40 #include "bufferobj.h"
52 #include "extensions.h"
54 #include "framebuffer.h"
56 #include "glapi/glapi.h"
58 #include "histogram.h"
75 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
76 #include "shader/arbprogram.h"
77 #include "shader/program.h"
79 #if FEATURE_NV_vertex_program || FEATURE_NV_fragment_program
80 #include "shader/nvprogram.h"
81 #include "shader/program.h"
83 #if FEATURE_ATI_fragment_shader
84 #include "shader/atifragshader.h"
87 #include "math/m_matrix.h"
88 #include "math/m_xform.h"
90 #include "glapi/dispatch.h"
96 * \param ctx GL context.
98 * Checks if dd_function_table::SaveNeedFlush is marked to flush
99 * stored (save) vertices, and calls
100 * dd_function_table::SaveFlushVertices if so.
102 #define SAVE_FLUSH_VERTICES(ctx) \
104 if (ctx->Driver.SaveNeedFlush) \
105 ctx->Driver.SaveFlushVertices(ctx); \
110 * Macro to assert that the API call was made outside the
111 * glBegin()/glEnd() pair, with return value.
113 * \param ctx GL context.
114 * \param retval value to return value in case the assertion fails.
116 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval) \
118 if (ctx->Driver.CurrentSavePrimitive <= GL_POLYGON || \
119 ctx->Driver.CurrentSavePrimitive == PRIM_INSIDE_UNKNOWN_PRIM) { \
120 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \
126 * Macro to assert that the API call was made outside the
127 * glBegin()/glEnd() pair.
129 * \param ctx GL context.
131 #define ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx) \
133 if (ctx->Driver.CurrentSavePrimitive <= GL_POLYGON || \
134 ctx->Driver.CurrentSavePrimitive == PRIM_INSIDE_UNKNOWN_PRIM) { \
135 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \
141 * Macro to assert that the API call was made outside the
142 * glBegin()/glEnd() pair and flush the vertices.
144 * \param ctx GL context.
146 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx) \
148 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx); \
149 SAVE_FLUSH_VERTICES(ctx); \
153 * Macro to assert that the API call was made outside the
154 * glBegin()/glEnd() pair and flush the vertices, with return value.
156 * \param ctx GL context.
157 * \param retval value to return value in case the assertion fails.
159 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval)\
161 ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval); \
162 SAVE_FLUSH_VERTICES(ctx); \
168 * Display list opcodes.
170 * The fact that these identifiers are assigned consecutive
171 * integer values starting at 0 is very important, see InstSize array usage)
175 OPCODE_INVALID
= -1, /* Force signed enum */
181 OPCODE_BLEND_EQUATION
,
182 OPCODE_BLEND_EQUATION_SEPARATE
,
183 OPCODE_BLEND_FUNC_SEPARATE
,
185 OPCODE_CALL_LIST_OFFSET
,
191 OPCODE_CLEAR_STENCIL
,
194 OPCODE_COLOR_MATERIAL
,
196 OPCODE_COLOR_TABLE_PARAMETER_FV
,
197 OPCODE_COLOR_TABLE_PARAMETER_IV
,
198 OPCODE_COLOR_SUB_TABLE
,
199 OPCODE_CONVOLUTION_FILTER_1D
,
200 OPCODE_CONVOLUTION_FILTER_2D
,
201 OPCODE_CONVOLUTION_PARAMETER_I
,
202 OPCODE_CONVOLUTION_PARAMETER_IV
,
203 OPCODE_CONVOLUTION_PARAMETER_F
,
204 OPCODE_CONVOLUTION_PARAMETER_FV
,
205 OPCODE_COPY_COLOR_SUB_TABLE
,
206 OPCODE_COPY_COLOR_TABLE
,
208 OPCODE_COPY_TEX_IMAGE1D
,
209 OPCODE_COPY_TEX_IMAGE2D
,
210 OPCODE_COPY_TEX_SUB_IMAGE1D
,
211 OPCODE_COPY_TEX_SUB_IMAGE2D
,
212 OPCODE_COPY_TEX_SUB_IMAGE3D
,
235 OPCODE_LOAD_IDENTITY
,
249 OPCODE_PIXEL_TRANSFER
,
252 OPCODE_POINT_PARAMETERS
,
254 OPCODE_POLYGON_STIPPLE
,
255 OPCODE_POLYGON_OFFSET
,
259 OPCODE_PRIORITIZE_TEXTURE
,
265 OPCODE_RESET_HISTOGRAM
,
266 OPCODE_RESET_MIN_MAX
,
270 OPCODE_SELECT_TEXTURE_SGIS
,
271 OPCODE_SELECT_TEXTURE_COORD_SET
,
282 OPCODE_TEX_SUB_IMAGE1D
,
283 OPCODE_TEX_SUB_IMAGE2D
,
284 OPCODE_TEX_SUB_IMAGE3D
,
288 /* GL_ARB_multitexture */
289 OPCODE_ACTIVE_TEXTURE
,
290 /* GL_ARB_texture_compression */
291 OPCODE_COMPRESSED_TEX_IMAGE_1D
,
292 OPCODE_COMPRESSED_TEX_IMAGE_2D
,
293 OPCODE_COMPRESSED_TEX_IMAGE_3D
,
294 OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
,
295 OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
,
296 OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
,
297 /* GL_ARB_multisample */
298 OPCODE_SAMPLE_COVERAGE
,
299 /* GL_ARB_window_pos */
300 OPCODE_WINDOW_POS_ARB
,
301 /* GL_NV_vertex_program */
302 OPCODE_BIND_PROGRAM_NV
,
303 OPCODE_EXECUTE_PROGRAM_NV
,
304 OPCODE_REQUEST_RESIDENT_PROGRAMS_NV
,
305 OPCODE_LOAD_PROGRAM_NV
,
306 OPCODE_TRACK_MATRIX_NV
,
307 /* GL_NV_fragment_program */
308 OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
,
309 OPCODE_PROGRAM_NAMED_PARAMETER_NV
,
310 /* GL_EXT_stencil_two_side */
311 OPCODE_ACTIVE_STENCIL_FACE_EXT
,
312 /* GL_EXT_depth_bounds_test */
313 OPCODE_DEPTH_BOUNDS_EXT
,
314 /* GL_ARB_vertex/fragment_program */
315 OPCODE_PROGRAM_STRING_ARB
,
316 OPCODE_PROGRAM_ENV_PARAMETER_ARB
,
317 /* GL_ARB_occlusion_query */
318 OPCODE_BEGIN_QUERY_ARB
,
319 OPCODE_END_QUERY_ARB
,
320 /* GL_ARB_draw_buffers */
321 OPCODE_DRAW_BUFFERS_ARB
,
322 /* GL_ATI_fragment_shader */
323 OPCODE_BIND_FRAGMENT_SHADER_ATI
,
324 OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
,
326 OPCODE_STENCIL_FUNC_SEPARATE
,
327 OPCODE_STENCIL_OP_SEPARATE
,
328 OPCODE_STENCIL_MASK_SEPARATE
,
330 /* GL_EXT_framebuffer_blit */
331 OPCODE_BLIT_FRAMEBUFFER
,
333 /* Vertex attributes -- fallback for when optimized display
334 * list build isn't active.
353 /* The following three are meta instructions */
354 OPCODE_ERROR
, /* raise compiled-in error */
365 * Display list instructions are stored as sequences of "nodes". Nodes
366 * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
367 * are linked together with a pointer.
369 * Each instruction in the display list is stored as a sequence of
370 * contiguous nodes in memory.
371 * Each node is the union of a variety of data types.
386 void *next
; /* If prev node's opcode==OPCODE_CONTINUE */
391 * How many nodes to allocate at a time.
393 * \note Reduced now that we hold vertices etc. elsewhere.
395 #define BLOCK_SIZE 256
400 * Number of nodes of storage needed for each instruction.
401 * Sizes for dynamically allocated opcodes are stored in the context struct.
403 static GLuint InstSize
[OPCODE_END_OF_LIST
+ 1];
405 void mesa_print_display_list(GLuint list
);
408 /**********************************************************************/
409 /***** Private *****/
410 /**********************************************************************/
414 * Make an empty display list. This is used by glGenLists() to
415 * reserve display list IDs.
417 static struct mesa_display_list
*
418 make_list(GLuint list
, GLuint count
)
420 struct mesa_display_list
*dlist
= CALLOC_STRUCT(mesa_display_list
);
422 dlist
->node
= (Node
*) _mesa_malloc(sizeof(Node
) * count
);
423 dlist
->node
[0].opcode
= OPCODE_END_OF_LIST
;
429 * Lookup function to just encapsulate casting.
431 static INLINE
struct mesa_display_list
*
432 lookup_list(GLcontext
*ctx
, GLuint list
)
434 return (struct mesa_display_list
*)
435 _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
441 * Delete the named display list, but don't remove from hash table.
442 * \param dlist - display list pointer
445 _mesa_delete_list(GLcontext
*ctx
, struct mesa_display_list
*dlist
)
450 n
= block
= dlist
->node
;
452 done
= block
? GL_FALSE
: GL_TRUE
;
455 /* check for extension opcodes first */
457 GLint i
= (GLint
) n
[0].opcode
- (GLint
) OPCODE_EXT_0
;
458 if (i
>= 0 && i
< (GLint
) ctx
->ListExt
.NumOpcodes
) {
459 ctx
->ListExt
.Opcode
[i
].Destroy(ctx
, &n
[1]);
460 n
+= ctx
->ListExt
.Opcode
[i
].Size
;
463 switch (n
[0].opcode
) {
464 /* for some commands, we need to free malloc'd memory */
466 _mesa_free(n
[6].data
);
467 n
+= InstSize
[n
[0].opcode
];
470 _mesa_free(n
[10].data
);
471 n
+= InstSize
[n
[0].opcode
];
473 case OPCODE_DRAW_PIXELS
:
474 _mesa_free(n
[5].data
);
475 n
+= InstSize
[n
[0].opcode
];
478 _mesa_free(n
[7].data
);
479 n
+= InstSize
[n
[0].opcode
];
481 case OPCODE_COLOR_TABLE
:
482 _mesa_free(n
[6].data
);
483 n
+= InstSize
[n
[0].opcode
];
485 case OPCODE_COLOR_SUB_TABLE
:
486 _mesa_free(n
[6].data
);
487 n
+= InstSize
[n
[0].opcode
];
489 case OPCODE_CONVOLUTION_FILTER_1D
:
490 _mesa_free(n
[6].data
);
491 n
+= InstSize
[n
[0].opcode
];
493 case OPCODE_CONVOLUTION_FILTER_2D
:
494 _mesa_free(n
[7].data
);
495 n
+= InstSize
[n
[0].opcode
];
497 case OPCODE_POLYGON_STIPPLE
:
498 _mesa_free(n
[1].data
);
499 n
+= InstSize
[n
[0].opcode
];
501 case OPCODE_TEX_IMAGE1D
:
502 _mesa_free(n
[8].data
);
503 n
+= InstSize
[n
[0].opcode
];
505 case OPCODE_TEX_IMAGE2D
:
506 _mesa_free(n
[9].data
);
507 n
+= InstSize
[n
[0].opcode
];
509 case OPCODE_TEX_IMAGE3D
:
510 _mesa_free(n
[10].data
);
511 n
+= InstSize
[n
[0].opcode
];
513 case OPCODE_TEX_SUB_IMAGE1D
:
514 _mesa_free(n
[7].data
);
515 n
+= InstSize
[n
[0].opcode
];
517 case OPCODE_TEX_SUB_IMAGE2D
:
518 _mesa_free(n
[9].data
);
519 n
+= InstSize
[n
[0].opcode
];
521 case OPCODE_TEX_SUB_IMAGE3D
:
522 _mesa_free(n
[11].data
);
523 n
+= InstSize
[n
[0].opcode
];
525 case OPCODE_COMPRESSED_TEX_IMAGE_1D
:
526 _mesa_free(n
[7].data
);
527 n
+= InstSize
[n
[0].opcode
];
529 case OPCODE_COMPRESSED_TEX_IMAGE_2D
:
530 _mesa_free(n
[8].data
);
531 n
+= InstSize
[n
[0].opcode
];
533 case OPCODE_COMPRESSED_TEX_IMAGE_3D
:
534 _mesa_free(n
[9].data
);
535 n
+= InstSize
[n
[0].opcode
];
537 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
:
538 _mesa_free(n
[7].data
);
539 n
+= InstSize
[n
[0].opcode
];
541 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
:
542 _mesa_free(n
[9].data
);
543 n
+= InstSize
[n
[0].opcode
];
545 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
:
546 _mesa_free(n
[11].data
);
547 n
+= InstSize
[n
[0].opcode
];
549 #if FEATURE_NV_vertex_program
550 case OPCODE_LOAD_PROGRAM_NV
:
551 _mesa_free(n
[4].data
); /* program string */
552 n
+= InstSize
[n
[0].opcode
];
554 case OPCODE_REQUEST_RESIDENT_PROGRAMS_NV
:
555 _mesa_free(n
[2].data
); /* array of program ids */
556 n
+= InstSize
[n
[0].opcode
];
559 #if FEATURE_NV_fragment_program
560 case OPCODE_PROGRAM_NAMED_PARAMETER_NV
:
561 _mesa_free(n
[3].data
); /* parameter name */
562 n
+= InstSize
[n
[0].opcode
];
565 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
566 case OPCODE_PROGRAM_STRING_ARB
:
567 _mesa_free(n
[4].data
); /* program string */
568 n
+= InstSize
[n
[0].opcode
];
571 case OPCODE_CONTINUE
:
572 n
= (Node
*) n
[1].next
;
576 case OPCODE_END_OF_LIST
:
581 /* Most frequent case */
582 n
+= InstSize
[n
[0].opcode
];
593 * Destroy a display list and remove from hash table.
594 * \param list - display list number
597 destroy_list(GLcontext
*ctx
, GLuint list
)
599 struct mesa_display_list
*dlist
;
604 dlist
= lookup_list(ctx
, list
);
608 _mesa_delete_list(ctx
, dlist
);
609 _mesa_HashRemove(ctx
->Shared
->DisplayList
, list
);
614 * Translate the nth element of list from <type> to GLint.
617 translate_id(GLsizei n
, GLenum type
, const GLvoid
* list
)
629 bptr
= (GLbyte
*) list
;
630 return (GLint
) bptr
[n
];
631 case GL_UNSIGNED_BYTE
:
632 ubptr
= (GLubyte
*) list
;
633 return (GLint
) ubptr
[n
];
635 sptr
= (GLshort
*) list
;
636 return (GLint
) sptr
[n
];
637 case GL_UNSIGNED_SHORT
:
638 usptr
= (GLushort
*) list
;
639 return (GLint
) usptr
[n
];
641 iptr
= (GLint
*) list
;
643 case GL_UNSIGNED_INT
:
644 uiptr
= (GLuint
*) list
;
645 return (GLint
) uiptr
[n
];
647 fptr
= (GLfloat
*) list
;
648 return (GLint
) FLOORF(fptr
[n
]);
650 ubptr
= ((GLubyte
*) list
) + 2 * n
;
651 return (GLint
) ubptr
[0] * 256
654 ubptr
= ((GLubyte
*) list
) + 3 * n
;
655 return (GLint
) ubptr
[0] * 65536
656 + (GLint
) ubptr
[1] * 256
659 ubptr
= ((GLubyte
*) list
) + 4 * n
;
660 return (GLint
) ubptr
[0] * 16777216
661 + (GLint
) ubptr
[1] * 65536
662 + (GLint
) ubptr
[2] * 256
672 /**********************************************************************/
674 /**********************************************************************/
677 * Wrapper for _mesa_unpack_image() that handles pixel buffer objects.
678 * \todo This won't suffice when the PBO is really in VRAM/GPU memory.
681 unpack_image(GLuint dimensions
, GLsizei width
, GLsizei height
, GLsizei depth
,
682 GLenum format
, GLenum type
, const GLvoid
* pixels
,
683 const struct gl_pixelstore_attrib
*unpack
)
685 if (unpack
->BufferObj
->Name
== 0) {
687 return _mesa_unpack_image(dimensions
, width
, height
, depth
, format
,
688 type
, pixels
, unpack
);
691 if (_mesa_validate_pbo_access
692 (dimensions
, unpack
, width
, height
, depth
, format
, type
, pixels
)) {
693 const GLubyte
*src
= ADD_POINTERS(unpack
->BufferObj
->Data
, pixels
);
694 return _mesa_unpack_image(dimensions
, width
, height
, depth
, format
,
703 * Allocate space for a display list instruction.
704 * \param opcode the instruction opcode (OPCODE_* value)
705 * \param size instruction size in bytes, not counting opcode.
706 * \return pointer to the usable data area (not including the internal
710 _mesa_alloc_instruction(GLcontext
*ctx
, GLuint opcode
, GLuint bytes
)
712 const GLuint numNodes
= 1 + (bytes
+ sizeof(Node
) - 1) / sizeof(Node
);
715 if (opcode
< (GLuint
) OPCODE_EXT_0
) {
716 if (InstSize
[opcode
] == 0) {
717 /* save instruction size now */
718 InstSize
[opcode
] = numNodes
;
721 /* make sure instruction size agrees */
722 ASSERT(numNodes
== InstSize
[opcode
]);
726 if (ctx
->ListState
.CurrentPos
+ numNodes
+ 2 > BLOCK_SIZE
) {
727 /* This block is full. Allocate a new block and chain to it */
729 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
730 n
[0].opcode
= OPCODE_CONTINUE
;
731 newblock
= (Node
*) _mesa_malloc(sizeof(Node
) * BLOCK_SIZE
);
733 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "Building display list");
736 n
[1].next
= (Node
*) newblock
;
737 ctx
->ListState
.CurrentBlock
= newblock
;
738 ctx
->ListState
.CurrentPos
= 0;
741 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
742 ctx
->ListState
.CurrentPos
+= numNodes
;
744 n
[0].opcode
= (OpCode
) opcode
;
746 return (void *) (n
+ 1); /* return ptr to node following opcode */
751 * This function allows modules and drivers to get their own opcodes
752 * for extending display list functionality.
753 * \param ctx the rendering context
754 * \param size number of bytes for storing the new display list command
755 * \param execute function to execute the new display list command
756 * \param destroy function to destroy the new display list command
757 * \param print function to print the new display list command
758 * \return the new opcode number or -1 if error
761 _mesa_alloc_opcode(GLcontext
*ctx
,
763 void (*execute
) (GLcontext
*, void *),
764 void (*destroy
) (GLcontext
*, void *),
765 void (*print
) (GLcontext
*, void *))
767 if (ctx
->ListExt
.NumOpcodes
< MAX_DLIST_EXT_OPCODES
) {
768 const GLuint i
= ctx
->ListExt
.NumOpcodes
++;
769 ctx
->ListExt
.Opcode
[i
].Size
=
770 1 + (size
+ sizeof(Node
) - 1) / sizeof(Node
);
771 ctx
->ListExt
.Opcode
[i
].Execute
= execute
;
772 ctx
->ListExt
.Opcode
[i
].Destroy
= destroy
;
773 ctx
->ListExt
.Opcode
[i
].Print
= print
;
774 return i
+ OPCODE_EXT_0
;
782 * Allocate display list instruction. Returns Node ptr to where the opcode
784 * - nParams is the number of function parameters
785 * - return value a pointer to sizeof(Node) before the actual
788 #define ALLOC_INSTRUCTION(CTX, OPCODE, NPARAMS) \
789 ((Node *)_mesa_alloc_instruction(CTX, OPCODE, (NPARAMS)*sizeof(Node)) - 1)
794 * Display List compilation functions
796 static void GLAPIENTRY
797 save_Accum(GLenum op
, GLfloat value
)
799 GET_CURRENT_CONTEXT(ctx
);
801 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
802 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ACCUM
, 2);
807 if (ctx
->ExecuteFlag
) {
808 CALL_Accum(ctx
->Exec
, (op
, value
));
813 static void GLAPIENTRY
814 save_AlphaFunc(GLenum func
, GLclampf ref
)
816 GET_CURRENT_CONTEXT(ctx
);
818 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
819 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ALPHA_FUNC
, 2);
822 n
[2].f
= (GLfloat
) ref
;
824 if (ctx
->ExecuteFlag
) {
825 CALL_AlphaFunc(ctx
->Exec
, (func
, ref
));
830 static void GLAPIENTRY
831 save_BindTexture(GLenum target
, GLuint texture
)
833 GET_CURRENT_CONTEXT(ctx
);
835 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
836 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BIND_TEXTURE
, 2);
841 if (ctx
->ExecuteFlag
) {
842 CALL_BindTexture(ctx
->Exec
, (target
, texture
));
847 static void GLAPIENTRY
848 save_Bitmap(GLsizei width
, GLsizei height
,
849 GLfloat xorig
, GLfloat yorig
,
850 GLfloat xmove
, GLfloat ymove
, const GLubyte
* pixels
)
852 GET_CURRENT_CONTEXT(ctx
);
853 GLvoid
*image
= _mesa_unpack_bitmap(width
, height
, pixels
, &ctx
->Unpack
);
855 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
856 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BITMAP
, 7);
858 n
[1].i
= (GLint
) width
;
859 n
[2].i
= (GLint
) height
;
869 if (ctx
->ExecuteFlag
) {
870 CALL_Bitmap(ctx
->Exec
, (width
, height
,
871 xorig
, yorig
, xmove
, ymove
, pixels
));
876 static void GLAPIENTRY
877 save_BlendEquation(GLenum mode
)
879 GET_CURRENT_CONTEXT(ctx
);
881 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
882 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BLEND_EQUATION
, 1);
886 if (ctx
->ExecuteFlag
) {
887 CALL_BlendEquation(ctx
->Exec
, (mode
));
892 static void GLAPIENTRY
893 save_BlendEquationSeparateEXT(GLenum modeRGB
, GLenum modeA
)
895 GET_CURRENT_CONTEXT(ctx
);
897 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
898 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BLEND_EQUATION_SEPARATE
, 2);
903 if (ctx
->ExecuteFlag
) {
904 CALL_BlendEquationSeparateEXT(ctx
->Exec
, (modeRGB
, modeA
));
909 static void GLAPIENTRY
910 save_BlendFuncSeparateEXT(GLenum sfactorRGB
, GLenum dfactorRGB
,
911 GLenum sfactorA
, GLenum dfactorA
)
913 GET_CURRENT_CONTEXT(ctx
);
915 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
916 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BLEND_FUNC_SEPARATE
, 4);
923 if (ctx
->ExecuteFlag
) {
924 CALL_BlendFuncSeparateEXT(ctx
->Exec
,
925 (sfactorRGB
, dfactorRGB
, sfactorA
, dfactorA
));
930 static void GLAPIENTRY
931 save_BlendFunc(GLenum srcfactor
, GLenum dstfactor
)
933 save_BlendFuncSeparateEXT(srcfactor
, dstfactor
, srcfactor
, dstfactor
);
937 static void GLAPIENTRY
938 save_BlendColor(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
940 GET_CURRENT_CONTEXT(ctx
);
942 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
943 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BLEND_COLOR
, 4);
950 if (ctx
->ExecuteFlag
) {
951 CALL_BlendColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
957 _mesa_save_CallList(GLuint list
)
959 GET_CURRENT_CONTEXT(ctx
);
961 SAVE_FLUSH_VERTICES(ctx
);
963 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CALL_LIST
, 1);
968 /* After this, we don't know what begin/end state we're in:
970 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
972 if (ctx
->ExecuteFlag
) {
973 CALL_CallList(ctx
->Exec
, (list
));
979 _mesa_save_CallLists(GLsizei n
, GLenum type
, const GLvoid
* lists
)
981 GET_CURRENT_CONTEXT(ctx
);
983 GLboolean typeErrorFlag
;
985 SAVE_FLUSH_VERTICES(ctx
);
989 case GL_UNSIGNED_BYTE
:
991 case GL_UNSIGNED_SHORT
:
993 case GL_UNSIGNED_INT
:
998 typeErrorFlag
= GL_FALSE
;
1001 typeErrorFlag
= GL_TRUE
;
1004 for (i
= 0; i
< n
; i
++) {
1005 GLint list
= translate_id(i
, type
, lists
);
1006 Node
*n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CALL_LIST_OFFSET
, 2);
1009 n
[2].b
= typeErrorFlag
;
1013 /* After this, we don't know what begin/end state we're in:
1015 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
1017 if (ctx
->ExecuteFlag
) {
1018 CALL_CallLists(ctx
->Exec
, (n
, type
, lists
));
1023 static void GLAPIENTRY
1024 save_Clear(GLbitfield mask
)
1026 GET_CURRENT_CONTEXT(ctx
);
1028 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1029 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLEAR
, 1);
1033 if (ctx
->ExecuteFlag
) {
1034 CALL_Clear(ctx
->Exec
, (mask
));
1039 static void GLAPIENTRY
1040 save_ClearAccum(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
1042 GET_CURRENT_CONTEXT(ctx
);
1044 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1045 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLEAR_ACCUM
, 4);
1052 if (ctx
->ExecuteFlag
) {
1053 CALL_ClearAccum(ctx
->Exec
, (red
, green
, blue
, alpha
));
1058 static void GLAPIENTRY
1059 save_ClearColor(GLclampf red
, GLclampf green
, GLclampf blue
, GLclampf alpha
)
1061 GET_CURRENT_CONTEXT(ctx
);
1063 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1064 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLEAR_COLOR
, 4);
1071 if (ctx
->ExecuteFlag
) {
1072 CALL_ClearColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
1077 static void GLAPIENTRY
1078 save_ClearDepth(GLclampd depth
)
1080 GET_CURRENT_CONTEXT(ctx
);
1082 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1083 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLEAR_DEPTH
, 1);
1085 n
[1].f
= (GLfloat
) depth
;
1087 if (ctx
->ExecuteFlag
) {
1088 CALL_ClearDepth(ctx
->Exec
, (depth
));
1093 static void GLAPIENTRY
1094 save_ClearIndex(GLfloat c
)
1096 GET_CURRENT_CONTEXT(ctx
);
1098 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1099 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLEAR_INDEX
, 1);
1103 if (ctx
->ExecuteFlag
) {
1104 CALL_ClearIndex(ctx
->Exec
, (c
));
1109 static void GLAPIENTRY
1110 save_ClearStencil(GLint s
)
1112 GET_CURRENT_CONTEXT(ctx
);
1114 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1115 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLEAR_STENCIL
, 1);
1119 if (ctx
->ExecuteFlag
) {
1120 CALL_ClearStencil(ctx
->Exec
, (s
));
1125 static void GLAPIENTRY
1126 save_ClipPlane(GLenum plane
, const GLdouble
* equ
)
1128 GET_CURRENT_CONTEXT(ctx
);
1130 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1131 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLIP_PLANE
, 5);
1134 n
[2].f
= (GLfloat
) equ
[0];
1135 n
[3].f
= (GLfloat
) equ
[1];
1136 n
[4].f
= (GLfloat
) equ
[2];
1137 n
[5].f
= (GLfloat
) equ
[3];
1139 if (ctx
->ExecuteFlag
) {
1140 CALL_ClipPlane(ctx
->Exec
, (plane
, equ
));
1146 static void GLAPIENTRY
1147 save_ColorMask(GLboolean red
, GLboolean green
,
1148 GLboolean blue
, GLboolean alpha
)
1150 GET_CURRENT_CONTEXT(ctx
);
1152 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1153 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COLOR_MASK
, 4);
1160 if (ctx
->ExecuteFlag
) {
1161 CALL_ColorMask(ctx
->Exec
, (red
, green
, blue
, alpha
));
1166 static void GLAPIENTRY
1167 save_ColorMaterial(GLenum face
, GLenum mode
)
1169 GET_CURRENT_CONTEXT(ctx
);
1171 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1173 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COLOR_MATERIAL
, 2);
1178 if (ctx
->ExecuteFlag
) {
1179 CALL_ColorMaterial(ctx
->Exec
, (face
, mode
));
1184 static void GLAPIENTRY
1185 save_ColorTable(GLenum target
, GLenum internalFormat
,
1186 GLsizei width
, GLenum format
, GLenum type
,
1187 const GLvoid
* table
)
1189 GET_CURRENT_CONTEXT(ctx
);
1190 if (_mesa_is_proxy_texture(target
)) {
1191 /* execute immediately */
1192 CALL_ColorTable(ctx
->Exec
, (target
, internalFormat
, width
,
1193 format
, type
, table
));
1196 GLvoid
*image
= unpack_image(1, width
, 1, 1, format
, type
, table
,
1199 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1200 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COLOR_TABLE
, 6);
1203 n
[2].e
= internalFormat
;
1212 if (ctx
->ExecuteFlag
) {
1213 CALL_ColorTable(ctx
->Exec
, (target
, internalFormat
, width
,
1214 format
, type
, table
));
1221 static void GLAPIENTRY
1222 save_ColorTableParameterfv(GLenum target
, GLenum pname
,
1223 const GLfloat
*params
)
1225 GET_CURRENT_CONTEXT(ctx
);
1228 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1230 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COLOR_TABLE_PARAMETER_FV
, 6);
1235 if (pname
== GL_COLOR_TABLE_SGI
||
1236 pname
== GL_POST_CONVOLUTION_COLOR_TABLE_SGI
||
1237 pname
== GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI
||
1238 pname
== GL_TEXTURE_COLOR_TABLE_SGI
) {
1245 if (ctx
->ExecuteFlag
) {
1246 CALL_ColorTableParameterfv(ctx
->Exec
, (target
, pname
, params
));
1251 static void GLAPIENTRY
1252 save_ColorTableParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
1254 GET_CURRENT_CONTEXT(ctx
);
1257 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1259 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COLOR_TABLE_PARAMETER_IV
, 6);
1264 if (pname
== GL_COLOR_TABLE_SGI
||
1265 pname
== GL_POST_CONVOLUTION_COLOR_TABLE_SGI
||
1266 pname
== GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI
||
1267 pname
== GL_TEXTURE_COLOR_TABLE_SGI
) {
1274 if (ctx
->ExecuteFlag
) {
1275 CALL_ColorTableParameteriv(ctx
->Exec
, (target
, pname
, params
));
1281 static void GLAPIENTRY
1282 save_ColorSubTable(GLenum target
, GLsizei start
, GLsizei count
,
1283 GLenum format
, GLenum type
, const GLvoid
* table
)
1285 GET_CURRENT_CONTEXT(ctx
);
1286 GLvoid
*image
= unpack_image(1, count
, 1, 1, format
, type
, table
,
1289 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1290 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COLOR_SUB_TABLE
, 6);
1302 if (ctx
->ExecuteFlag
) {
1303 CALL_ColorSubTable(ctx
->Exec
,
1304 (target
, start
, count
, format
, type
, table
));
1309 static void GLAPIENTRY
1310 save_CopyColorSubTable(GLenum target
, GLsizei start
,
1311 GLint x
, GLint y
, GLsizei width
)
1313 GET_CURRENT_CONTEXT(ctx
);
1316 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1317 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_COLOR_SUB_TABLE
, 5);
1325 if (ctx
->ExecuteFlag
) {
1326 CALL_CopyColorSubTable(ctx
->Exec
, (target
, start
, x
, y
, width
));
1331 static void GLAPIENTRY
1332 save_CopyColorTable(GLenum target
, GLenum internalformat
,
1333 GLint x
, GLint y
, GLsizei width
)
1335 GET_CURRENT_CONTEXT(ctx
);
1338 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1339 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_COLOR_TABLE
, 5);
1342 n
[2].e
= internalformat
;
1347 if (ctx
->ExecuteFlag
) {
1348 CALL_CopyColorTable(ctx
->Exec
, (target
, internalformat
, x
, y
, width
));
1353 static void GLAPIENTRY
1354 save_ConvolutionFilter1D(GLenum target
, GLenum internalFormat
, GLsizei width
,
1355 GLenum format
, GLenum type
, const GLvoid
* filter
)
1357 GET_CURRENT_CONTEXT(ctx
);
1358 GLvoid
*image
= unpack_image(1, width
, 1, 1, format
, type
, filter
,
1361 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1362 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CONVOLUTION_FILTER_1D
, 6);
1365 n
[2].e
= internalFormat
;
1374 if (ctx
->ExecuteFlag
) {
1375 CALL_ConvolutionFilter1D(ctx
->Exec
, (target
, internalFormat
, width
,
1376 format
, type
, filter
));
1381 static void GLAPIENTRY
1382 save_ConvolutionFilter2D(GLenum target
, GLenum internalFormat
,
1383 GLsizei width
, GLsizei height
, GLenum format
,
1384 GLenum type
, const GLvoid
* filter
)
1386 GET_CURRENT_CONTEXT(ctx
);
1387 GLvoid
*image
= unpack_image(2, width
, height
, 1, format
, type
, filter
,
1390 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1391 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CONVOLUTION_FILTER_2D
, 7);
1394 n
[2].e
= internalFormat
;
1404 if (ctx
->ExecuteFlag
) {
1405 CALL_ConvolutionFilter2D(ctx
->Exec
,
1406 (target
, internalFormat
, width
, height
, format
,
1412 static void GLAPIENTRY
1413 save_ConvolutionParameteri(GLenum target
, GLenum pname
, GLint param
)
1415 GET_CURRENT_CONTEXT(ctx
);
1417 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1418 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CONVOLUTION_PARAMETER_I
, 3);
1424 if (ctx
->ExecuteFlag
) {
1425 CALL_ConvolutionParameteri(ctx
->Exec
, (target
, pname
, param
));
1430 static void GLAPIENTRY
1431 save_ConvolutionParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
1433 GET_CURRENT_CONTEXT(ctx
);
1435 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1436 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CONVOLUTION_PARAMETER_IV
, 6);
1441 if (pname
== GL_CONVOLUTION_BORDER_COLOR
||
1442 pname
== GL_CONVOLUTION_FILTER_SCALE
||
1443 pname
== GL_CONVOLUTION_FILTER_BIAS
) {
1449 n
[4].i
= n
[5].i
= n
[6].i
= 0;
1452 if (ctx
->ExecuteFlag
) {
1453 CALL_ConvolutionParameteriv(ctx
->Exec
, (target
, pname
, params
));
1458 static void GLAPIENTRY
1459 save_ConvolutionParameterf(GLenum target
, GLenum pname
, GLfloat param
)
1461 GET_CURRENT_CONTEXT(ctx
);
1463 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1464 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CONVOLUTION_PARAMETER_F
, 3);
1470 if (ctx
->ExecuteFlag
) {
1471 CALL_ConvolutionParameterf(ctx
->Exec
, (target
, pname
, param
));
1476 static void GLAPIENTRY
1477 save_ConvolutionParameterfv(GLenum target
, GLenum pname
,
1478 const GLfloat
*params
)
1480 GET_CURRENT_CONTEXT(ctx
);
1482 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1483 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CONVOLUTION_PARAMETER_FV
, 6);
1488 if (pname
== GL_CONVOLUTION_BORDER_COLOR
||
1489 pname
== GL_CONVOLUTION_FILTER_SCALE
||
1490 pname
== GL_CONVOLUTION_FILTER_BIAS
) {
1496 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
1499 if (ctx
->ExecuteFlag
) {
1500 CALL_ConvolutionParameterfv(ctx
->Exec
, (target
, pname
, params
));
1505 static void GLAPIENTRY
1506 save_CopyPixels(GLint x
, GLint y
, GLsizei width
, GLsizei height
, GLenum type
)
1508 GET_CURRENT_CONTEXT(ctx
);
1510 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1511 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_PIXELS
, 5);
1515 n
[3].i
= (GLint
) width
;
1516 n
[4].i
= (GLint
) height
;
1519 if (ctx
->ExecuteFlag
) {
1520 CALL_CopyPixels(ctx
->Exec
, (x
, y
, width
, height
, type
));
1526 static void GLAPIENTRY
1527 save_CopyTexImage1D(GLenum target
, GLint level
, GLenum internalformat
,
1528 GLint x
, GLint y
, GLsizei width
, GLint border
)
1530 GET_CURRENT_CONTEXT(ctx
);
1532 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1533 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_TEX_IMAGE1D
, 7);
1537 n
[3].e
= internalformat
;
1543 if (ctx
->ExecuteFlag
) {
1544 CALL_CopyTexImage1D(ctx
->Exec
, (target
, level
, internalformat
,
1545 x
, y
, width
, border
));
1550 static void GLAPIENTRY
1551 save_CopyTexImage2D(GLenum target
, GLint level
,
1552 GLenum internalformat
,
1553 GLint x
, GLint y
, GLsizei width
,
1554 GLsizei height
, GLint border
)
1556 GET_CURRENT_CONTEXT(ctx
);
1558 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1559 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_TEX_IMAGE2D
, 8);
1563 n
[3].e
= internalformat
;
1570 if (ctx
->ExecuteFlag
) {
1571 CALL_CopyTexImage2D(ctx
->Exec
, (target
, level
, internalformat
,
1572 x
, y
, width
, height
, border
));
1578 static void GLAPIENTRY
1579 save_CopyTexSubImage1D(GLenum target
, GLint level
,
1580 GLint xoffset
, GLint x
, GLint y
, GLsizei width
)
1582 GET_CURRENT_CONTEXT(ctx
);
1584 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1585 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_TEX_SUB_IMAGE1D
, 6);
1594 if (ctx
->ExecuteFlag
) {
1595 CALL_CopyTexSubImage1D(ctx
->Exec
,
1596 (target
, level
, xoffset
, x
, y
, width
));
1601 static void GLAPIENTRY
1602 save_CopyTexSubImage2D(GLenum target
, GLint level
,
1603 GLint xoffset
, GLint yoffset
,
1604 GLint x
, GLint y
, GLsizei width
, GLint height
)
1606 GET_CURRENT_CONTEXT(ctx
);
1608 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1609 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_TEX_SUB_IMAGE2D
, 8);
1620 if (ctx
->ExecuteFlag
) {
1621 CALL_CopyTexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
1622 x
, y
, width
, height
));
1627 static void GLAPIENTRY
1628 save_CopyTexSubImage3D(GLenum target
, GLint level
,
1629 GLint xoffset
, GLint yoffset
, GLint zoffset
,
1630 GLint x
, GLint y
, GLsizei width
, GLint height
)
1632 GET_CURRENT_CONTEXT(ctx
);
1634 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1635 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_TEX_SUB_IMAGE3D
, 9);
1647 if (ctx
->ExecuteFlag
) {
1648 CALL_CopyTexSubImage3D(ctx
->Exec
, (target
, level
,
1649 xoffset
, yoffset
, zoffset
,
1650 x
, y
, width
, height
));
1655 static void GLAPIENTRY
1656 save_CullFace(GLenum mode
)
1658 GET_CURRENT_CONTEXT(ctx
);
1660 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1661 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CULL_FACE
, 1);
1665 if (ctx
->ExecuteFlag
) {
1666 CALL_CullFace(ctx
->Exec
, (mode
));
1671 static void GLAPIENTRY
1672 save_DepthFunc(GLenum func
)
1674 GET_CURRENT_CONTEXT(ctx
);
1676 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1677 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DEPTH_FUNC
, 1);
1681 if (ctx
->ExecuteFlag
) {
1682 CALL_DepthFunc(ctx
->Exec
, (func
));
1687 static void GLAPIENTRY
1688 save_DepthMask(GLboolean mask
)
1690 GET_CURRENT_CONTEXT(ctx
);
1692 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1693 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DEPTH_MASK
, 1);
1697 if (ctx
->ExecuteFlag
) {
1698 CALL_DepthMask(ctx
->Exec
, (mask
));
1703 static void GLAPIENTRY
1704 save_DepthRange(GLclampd nearval
, GLclampd farval
)
1706 GET_CURRENT_CONTEXT(ctx
);
1708 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1709 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DEPTH_RANGE
, 2);
1711 n
[1].f
= (GLfloat
) nearval
;
1712 n
[2].f
= (GLfloat
) farval
;
1714 if (ctx
->ExecuteFlag
) {
1715 CALL_DepthRange(ctx
->Exec
, (nearval
, farval
));
1720 static void GLAPIENTRY
1721 save_Disable(GLenum cap
)
1723 GET_CURRENT_CONTEXT(ctx
);
1725 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1726 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DISABLE
, 1);
1730 if (ctx
->ExecuteFlag
) {
1731 CALL_Disable(ctx
->Exec
, (cap
));
1736 static void GLAPIENTRY
1737 save_DrawBuffer(GLenum mode
)
1739 GET_CURRENT_CONTEXT(ctx
);
1741 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1742 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DRAW_BUFFER
, 1);
1746 if (ctx
->ExecuteFlag
) {
1747 CALL_DrawBuffer(ctx
->Exec
, (mode
));
1752 static void GLAPIENTRY
1753 save_DrawPixels(GLsizei width
, GLsizei height
,
1754 GLenum format
, GLenum type
, const GLvoid
* pixels
)
1756 GET_CURRENT_CONTEXT(ctx
);
1757 GLvoid
*image
= unpack_image(2, width
, height
, 1, format
, type
,
1758 pixels
, &ctx
->Unpack
);
1760 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1761 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DRAW_PIXELS
, 5);
1772 if (ctx
->ExecuteFlag
) {
1773 CALL_DrawPixels(ctx
->Exec
, (width
, height
, format
, type
, pixels
));
1779 static void GLAPIENTRY
1780 save_Enable(GLenum cap
)
1782 GET_CURRENT_CONTEXT(ctx
);
1784 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1785 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ENABLE
, 1);
1789 if (ctx
->ExecuteFlag
) {
1790 CALL_Enable(ctx
->Exec
, (cap
));
1796 static void GLAPIENTRY
1797 _mesa_save_EvalMesh1(GLenum mode
, GLint i1
, GLint i2
)
1799 GET_CURRENT_CONTEXT(ctx
);
1801 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1802 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVALMESH1
, 3);
1808 if (ctx
->ExecuteFlag
) {
1809 CALL_EvalMesh1(ctx
->Exec
, (mode
, i1
, i2
));
1814 static void GLAPIENTRY
1815 _mesa_save_EvalMesh2(GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
1817 GET_CURRENT_CONTEXT(ctx
);
1819 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1820 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVALMESH2
, 5);
1828 if (ctx
->ExecuteFlag
) {
1829 CALL_EvalMesh2(ctx
->Exec
, (mode
, i1
, i2
, j1
, j2
));
1836 static void GLAPIENTRY
1837 save_Fogfv(GLenum pname
, const GLfloat
*params
)
1839 GET_CURRENT_CONTEXT(ctx
);
1841 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1842 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_FOG
, 5);
1850 if (ctx
->ExecuteFlag
) {
1851 CALL_Fogfv(ctx
->Exec
, (pname
, params
));
1856 static void GLAPIENTRY
1857 save_Fogf(GLenum pname
, GLfloat param
)
1859 save_Fogfv(pname
, ¶m
);
1863 static void GLAPIENTRY
1864 save_Fogiv(GLenum pname
, const GLint
*params
)
1869 case GL_FOG_DENSITY
:
1873 p
[0] = (GLfloat
) *params
;
1876 p
[0] = INT_TO_FLOAT(params
[0]);
1877 p
[1] = INT_TO_FLOAT(params
[1]);
1878 p
[2] = INT_TO_FLOAT(params
[2]);
1879 p
[3] = INT_TO_FLOAT(params
[3]);
1882 /* Error will be caught later in gl_Fogfv */
1885 save_Fogfv(pname
, p
);
1889 static void GLAPIENTRY
1890 save_Fogi(GLenum pname
, GLint param
)
1892 save_Fogiv(pname
, ¶m
);
1896 static void GLAPIENTRY
1897 save_FrontFace(GLenum mode
)
1899 GET_CURRENT_CONTEXT(ctx
);
1901 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1902 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_FRONT_FACE
, 1);
1906 if (ctx
->ExecuteFlag
) {
1907 CALL_FrontFace(ctx
->Exec
, (mode
));
1912 static void GLAPIENTRY
1913 save_Frustum(GLdouble left
, GLdouble right
,
1914 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
1916 GET_CURRENT_CONTEXT(ctx
);
1918 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1919 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_FRUSTUM
, 6);
1921 n
[1].f
= (GLfloat
) left
;
1922 n
[2].f
= (GLfloat
) right
;
1923 n
[3].f
= (GLfloat
) bottom
;
1924 n
[4].f
= (GLfloat
) top
;
1925 n
[5].f
= (GLfloat
) nearval
;
1926 n
[6].f
= (GLfloat
) farval
;
1928 if (ctx
->ExecuteFlag
) {
1929 CALL_Frustum(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
1934 static void GLAPIENTRY
1935 save_Hint(GLenum target
, GLenum mode
)
1937 GET_CURRENT_CONTEXT(ctx
);
1939 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1940 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_HINT
, 2);
1945 if (ctx
->ExecuteFlag
) {
1946 CALL_Hint(ctx
->Exec
, (target
, mode
));
1951 static void GLAPIENTRY
1952 save_Histogram(GLenum target
, GLsizei width
, GLenum internalFormat
,
1955 GET_CURRENT_CONTEXT(ctx
);
1958 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1959 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_HISTOGRAM
, 4);
1963 n
[3].e
= internalFormat
;
1966 if (ctx
->ExecuteFlag
) {
1967 CALL_Histogram(ctx
->Exec
, (target
, width
, internalFormat
, sink
));
1972 static void GLAPIENTRY
1973 save_IndexMask(GLuint mask
)
1975 GET_CURRENT_CONTEXT(ctx
);
1977 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1978 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_INDEX_MASK
, 1);
1982 if (ctx
->ExecuteFlag
) {
1983 CALL_IndexMask(ctx
->Exec
, (mask
));
1988 static void GLAPIENTRY
1989 save_InitNames(void)
1991 GET_CURRENT_CONTEXT(ctx
);
1992 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1993 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_INIT_NAMES
, 0);
1994 if (ctx
->ExecuteFlag
) {
1995 CALL_InitNames(ctx
->Exec
, ());
2000 static void GLAPIENTRY
2001 save_Lightfv(GLenum light
, GLenum pname
, const GLfloat
*params
)
2003 GET_CURRENT_CONTEXT(ctx
);
2005 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2006 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LIGHT
, 6);
2024 case GL_SPOT_DIRECTION
:
2027 case GL_SPOT_EXPONENT
:
2030 case GL_SPOT_CUTOFF
:
2033 case GL_CONSTANT_ATTENUATION
:
2036 case GL_LINEAR_ATTENUATION
:
2039 case GL_QUADRATIC_ATTENUATION
:
2045 for (i
= 0; i
< nParams
; i
++) {
2046 n
[3 + i
].f
= params
[i
];
2049 if (ctx
->ExecuteFlag
) {
2050 CALL_Lightfv(ctx
->Exec
, (light
, pname
, params
));
2055 static void GLAPIENTRY
2056 save_Lightf(GLenum light
, GLenum pname
, GLfloat params
)
2058 save_Lightfv(light
, pname
, ¶ms
);
2062 static void GLAPIENTRY
2063 save_Lightiv(GLenum light
, GLenum pname
, const GLint
*params
)
2070 fparam
[0] = INT_TO_FLOAT(params
[0]);
2071 fparam
[1] = INT_TO_FLOAT(params
[1]);
2072 fparam
[2] = INT_TO_FLOAT(params
[2]);
2073 fparam
[3] = INT_TO_FLOAT(params
[3]);
2076 fparam
[0] = (GLfloat
) params
[0];
2077 fparam
[1] = (GLfloat
) params
[1];
2078 fparam
[2] = (GLfloat
) params
[2];
2079 fparam
[3] = (GLfloat
) params
[3];
2081 case GL_SPOT_DIRECTION
:
2082 fparam
[0] = (GLfloat
) params
[0];
2083 fparam
[1] = (GLfloat
) params
[1];
2084 fparam
[2] = (GLfloat
) params
[2];
2086 case GL_SPOT_EXPONENT
:
2087 case GL_SPOT_CUTOFF
:
2088 case GL_CONSTANT_ATTENUATION
:
2089 case GL_LINEAR_ATTENUATION
:
2090 case GL_QUADRATIC_ATTENUATION
:
2091 fparam
[0] = (GLfloat
) params
[0];
2094 /* error will be caught later in gl_Lightfv */
2097 save_Lightfv(light
, pname
, fparam
);
2101 static void GLAPIENTRY
2102 save_Lighti(GLenum light
, GLenum pname
, GLint param
)
2104 save_Lightiv(light
, pname
, ¶m
);
2108 static void GLAPIENTRY
2109 save_LightModelfv(GLenum pname
, const GLfloat
*params
)
2111 GET_CURRENT_CONTEXT(ctx
);
2113 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2114 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LIGHT_MODEL
, 5);
2122 if (ctx
->ExecuteFlag
) {
2123 CALL_LightModelfv(ctx
->Exec
, (pname
, params
));
2128 static void GLAPIENTRY
2129 save_LightModelf(GLenum pname
, GLfloat param
)
2131 save_LightModelfv(pname
, ¶m
);
2135 static void GLAPIENTRY
2136 save_LightModeliv(GLenum pname
, const GLint
*params
)
2140 case GL_LIGHT_MODEL_AMBIENT
:
2141 fparam
[0] = INT_TO_FLOAT(params
[0]);
2142 fparam
[1] = INT_TO_FLOAT(params
[1]);
2143 fparam
[2] = INT_TO_FLOAT(params
[2]);
2144 fparam
[3] = INT_TO_FLOAT(params
[3]);
2146 case GL_LIGHT_MODEL_LOCAL_VIEWER
:
2147 case GL_LIGHT_MODEL_TWO_SIDE
:
2148 case GL_LIGHT_MODEL_COLOR_CONTROL
:
2149 fparam
[0] = (GLfloat
) params
[0];
2152 /* Error will be caught later in gl_LightModelfv */
2155 save_LightModelfv(pname
, fparam
);
2159 static void GLAPIENTRY
2160 save_LightModeli(GLenum pname
, GLint param
)
2162 save_LightModeliv(pname
, ¶m
);
2166 static void GLAPIENTRY
2167 save_LineStipple(GLint factor
, GLushort pattern
)
2169 GET_CURRENT_CONTEXT(ctx
);
2171 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2172 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LINE_STIPPLE
, 2);
2177 if (ctx
->ExecuteFlag
) {
2178 CALL_LineStipple(ctx
->Exec
, (factor
, pattern
));
2183 static void GLAPIENTRY
2184 save_LineWidth(GLfloat width
)
2186 GET_CURRENT_CONTEXT(ctx
);
2188 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2189 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LINE_WIDTH
, 1);
2193 if (ctx
->ExecuteFlag
) {
2194 CALL_LineWidth(ctx
->Exec
, (width
));
2199 static void GLAPIENTRY
2200 save_ListBase(GLuint base
)
2202 GET_CURRENT_CONTEXT(ctx
);
2204 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2205 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LIST_BASE
, 1);
2209 if (ctx
->ExecuteFlag
) {
2210 CALL_ListBase(ctx
->Exec
, (base
));
2215 static void GLAPIENTRY
2216 save_LoadIdentity(void)
2218 GET_CURRENT_CONTEXT(ctx
);
2219 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2220 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_LOAD_IDENTITY
, 0);
2221 if (ctx
->ExecuteFlag
) {
2222 CALL_LoadIdentity(ctx
->Exec
, ());
2227 static void GLAPIENTRY
2228 save_LoadMatrixf(const GLfloat
* m
)
2230 GET_CURRENT_CONTEXT(ctx
);
2232 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2233 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LOAD_MATRIX
, 16);
2236 for (i
= 0; i
< 16; i
++) {
2240 if (ctx
->ExecuteFlag
) {
2241 CALL_LoadMatrixf(ctx
->Exec
, (m
));
2246 static void GLAPIENTRY
2247 save_LoadMatrixd(const GLdouble
* m
)
2251 for (i
= 0; i
< 16; i
++) {
2252 f
[i
] = (GLfloat
) m
[i
];
2254 save_LoadMatrixf(f
);
2258 static void GLAPIENTRY
2259 save_LoadName(GLuint name
)
2261 GET_CURRENT_CONTEXT(ctx
);
2263 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2264 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LOAD_NAME
, 1);
2268 if (ctx
->ExecuteFlag
) {
2269 CALL_LoadName(ctx
->Exec
, (name
));
2274 static void GLAPIENTRY
2275 save_LogicOp(GLenum opcode
)
2277 GET_CURRENT_CONTEXT(ctx
);
2279 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2280 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LOGIC_OP
, 1);
2284 if (ctx
->ExecuteFlag
) {
2285 CALL_LogicOp(ctx
->Exec
, (opcode
));
2290 static void GLAPIENTRY
2291 save_Map1d(GLenum target
, GLdouble u1
, GLdouble u2
, GLint stride
,
2292 GLint order
, const GLdouble
* points
)
2294 GET_CURRENT_CONTEXT(ctx
);
2296 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2297 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MAP1
, 6);
2299 GLfloat
*pnts
= _mesa_copy_map_points1d(target
, stride
, order
, points
);
2301 n
[2].f
= (GLfloat
) u1
;
2302 n
[3].f
= (GLfloat
) u2
;
2303 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2305 n
[6].data
= (void *) pnts
;
2307 if (ctx
->ExecuteFlag
) {
2308 CALL_Map1d(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2312 static void GLAPIENTRY
2313 save_Map1f(GLenum target
, GLfloat u1
, GLfloat u2
, GLint stride
,
2314 GLint order
, const GLfloat
* points
)
2316 GET_CURRENT_CONTEXT(ctx
);
2318 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2319 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MAP1
, 6);
2321 GLfloat
*pnts
= _mesa_copy_map_points1f(target
, stride
, order
, points
);
2325 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2327 n
[6].data
= (void *) pnts
;
2329 if (ctx
->ExecuteFlag
) {
2330 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2335 static void GLAPIENTRY
2336 save_Map2d(GLenum target
,
2337 GLdouble u1
, GLdouble u2
, GLint ustride
, GLint uorder
,
2338 GLdouble v1
, GLdouble v2
, GLint vstride
, GLint vorder
,
2339 const GLdouble
* points
)
2341 GET_CURRENT_CONTEXT(ctx
);
2343 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2344 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MAP2
, 10);
2346 GLfloat
*pnts
= _mesa_copy_map_points2d(target
, ustride
, uorder
,
2347 vstride
, vorder
, points
);
2349 n
[2].f
= (GLfloat
) u1
;
2350 n
[3].f
= (GLfloat
) u2
;
2351 n
[4].f
= (GLfloat
) v1
;
2352 n
[5].f
= (GLfloat
) v2
;
2353 /* XXX verify these strides are correct */
2354 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2355 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2358 n
[10].data
= (void *) pnts
;
2360 if (ctx
->ExecuteFlag
) {
2361 CALL_Map2d(ctx
->Exec
, (target
,
2362 u1
, u2
, ustride
, uorder
,
2363 v1
, v2
, vstride
, vorder
, points
));
2368 static void GLAPIENTRY
2369 save_Map2f(GLenum target
,
2370 GLfloat u1
, GLfloat u2
, GLint ustride
, GLint uorder
,
2371 GLfloat v1
, GLfloat v2
, GLint vstride
, GLint vorder
,
2372 const GLfloat
* points
)
2374 GET_CURRENT_CONTEXT(ctx
);
2376 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2377 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MAP2
, 10);
2379 GLfloat
*pnts
= _mesa_copy_map_points2f(target
, ustride
, uorder
,
2380 vstride
, vorder
, points
);
2386 /* XXX verify these strides are correct */
2387 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2388 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2391 n
[10].data
= (void *) pnts
;
2393 if (ctx
->ExecuteFlag
) {
2394 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
2395 v1
, v2
, vstride
, vorder
, points
));
2400 static void GLAPIENTRY
2401 save_MapGrid1f(GLint un
, GLfloat u1
, GLfloat u2
)
2403 GET_CURRENT_CONTEXT(ctx
);
2405 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2406 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MAPGRID1
, 3);
2412 if (ctx
->ExecuteFlag
) {
2413 CALL_MapGrid1f(ctx
->Exec
, (un
, u1
, u2
));
2418 static void GLAPIENTRY
2419 save_MapGrid1d(GLint un
, GLdouble u1
, GLdouble u2
)
2421 save_MapGrid1f(un
, (GLfloat
) u1
, (GLfloat
) u2
);
2425 static void GLAPIENTRY
2426 save_MapGrid2f(GLint un
, GLfloat u1
, GLfloat u2
,
2427 GLint vn
, GLfloat v1
, GLfloat v2
)
2429 GET_CURRENT_CONTEXT(ctx
);
2431 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2432 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MAPGRID2
, 6);
2441 if (ctx
->ExecuteFlag
) {
2442 CALL_MapGrid2f(ctx
->Exec
, (un
, u1
, u2
, vn
, v1
, v2
));
2448 static void GLAPIENTRY
2449 save_MapGrid2d(GLint un
, GLdouble u1
, GLdouble u2
,
2450 GLint vn
, GLdouble v1
, GLdouble v2
)
2452 save_MapGrid2f(un
, (GLfloat
) u1
, (GLfloat
) u2
,
2453 vn
, (GLfloat
) v1
, (GLfloat
) v2
);
2457 static void GLAPIENTRY
2458 save_MatrixMode(GLenum mode
)
2460 GET_CURRENT_CONTEXT(ctx
);
2462 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2463 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MATRIX_MODE
, 1);
2467 if (ctx
->ExecuteFlag
) {
2468 CALL_MatrixMode(ctx
->Exec
, (mode
));
2473 static void GLAPIENTRY
2474 save_Minmax(GLenum target
, GLenum internalFormat
, GLboolean sink
)
2476 GET_CURRENT_CONTEXT(ctx
);
2479 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2480 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MIN_MAX
, 3);
2483 n
[2].e
= internalFormat
;
2486 if (ctx
->ExecuteFlag
) {
2487 CALL_Minmax(ctx
->Exec
, (target
, internalFormat
, sink
));
2492 static void GLAPIENTRY
2493 save_MultMatrixf(const GLfloat
* m
)
2495 GET_CURRENT_CONTEXT(ctx
);
2497 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2498 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MULT_MATRIX
, 16);
2501 for (i
= 0; i
< 16; i
++) {
2505 if (ctx
->ExecuteFlag
) {
2506 CALL_MultMatrixf(ctx
->Exec
, (m
));
2511 static void GLAPIENTRY
2512 save_MultMatrixd(const GLdouble
* m
)
2516 for (i
= 0; i
< 16; i
++) {
2517 f
[i
] = (GLfloat
) m
[i
];
2519 save_MultMatrixf(f
);
2523 static void GLAPIENTRY
2524 save_NewList(GLuint list
, GLenum mode
)
2526 GET_CURRENT_CONTEXT(ctx
);
2527 /* It's an error to call this function while building a display list */
2528 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
2535 static void GLAPIENTRY
2536 save_Ortho(GLdouble left
, GLdouble right
,
2537 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
2539 GET_CURRENT_CONTEXT(ctx
);
2541 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2542 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ORTHO
, 6);
2544 n
[1].f
= (GLfloat
) left
;
2545 n
[2].f
= (GLfloat
) right
;
2546 n
[3].f
= (GLfloat
) bottom
;
2547 n
[4].f
= (GLfloat
) top
;
2548 n
[5].f
= (GLfloat
) nearval
;
2549 n
[6].f
= (GLfloat
) farval
;
2551 if (ctx
->ExecuteFlag
) {
2552 CALL_Ortho(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
2557 static void GLAPIENTRY
2558 save_PixelMapfv(GLenum map
, GLint mapsize
, const GLfloat
*values
)
2560 GET_CURRENT_CONTEXT(ctx
);
2562 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2563 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PIXEL_MAP
, 3);
2567 n
[3].data
= (void *) _mesa_malloc(mapsize
* sizeof(GLfloat
));
2568 MEMCPY(n
[3].data
, (void *) values
, mapsize
* sizeof(GLfloat
));
2570 if (ctx
->ExecuteFlag
) {
2571 CALL_PixelMapfv(ctx
->Exec
, (map
, mapsize
, values
));
2576 static void GLAPIENTRY
2577 save_PixelMapuiv(GLenum map
, GLint mapsize
, const GLuint
*values
)
2579 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2581 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
2582 for (i
= 0; i
< mapsize
; i
++) {
2583 fvalues
[i
] = (GLfloat
) values
[i
];
2587 for (i
= 0; i
< mapsize
; i
++) {
2588 fvalues
[i
] = UINT_TO_FLOAT(values
[i
]);
2591 save_PixelMapfv(map
, mapsize
, fvalues
);
2595 static void GLAPIENTRY
2596 save_PixelMapusv(GLenum map
, GLint mapsize
, const GLushort
*values
)
2598 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2600 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
2601 for (i
= 0; i
< mapsize
; i
++) {
2602 fvalues
[i
] = (GLfloat
) values
[i
];
2606 for (i
= 0; i
< mapsize
; i
++) {
2607 fvalues
[i
] = USHORT_TO_FLOAT(values
[i
]);
2610 save_PixelMapfv(map
, mapsize
, fvalues
);
2614 static void GLAPIENTRY
2615 save_PixelTransferf(GLenum pname
, GLfloat param
)
2617 GET_CURRENT_CONTEXT(ctx
);
2619 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2620 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PIXEL_TRANSFER
, 2);
2625 if (ctx
->ExecuteFlag
) {
2626 CALL_PixelTransferf(ctx
->Exec
, (pname
, param
));
2631 static void GLAPIENTRY
2632 save_PixelTransferi(GLenum pname
, GLint param
)
2634 save_PixelTransferf(pname
, (GLfloat
) param
);
2638 static void GLAPIENTRY
2639 save_PixelZoom(GLfloat xfactor
, GLfloat yfactor
)
2641 GET_CURRENT_CONTEXT(ctx
);
2643 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2644 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PIXEL_ZOOM
, 2);
2649 if (ctx
->ExecuteFlag
) {
2650 CALL_PixelZoom(ctx
->Exec
, (xfactor
, yfactor
));
2655 static void GLAPIENTRY
2656 save_PointParameterfvEXT(GLenum pname
, const GLfloat
*params
)
2658 GET_CURRENT_CONTEXT(ctx
);
2660 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2661 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_POINT_PARAMETERS
, 4);
2668 if (ctx
->ExecuteFlag
) {
2669 CALL_PointParameterfvEXT(ctx
->Exec
, (pname
, params
));
2674 static void GLAPIENTRY
2675 save_PointParameterfEXT(GLenum pname
, GLfloat param
)
2677 save_PointParameterfvEXT(pname
, ¶m
);
2680 static void GLAPIENTRY
2681 save_PointParameteriNV(GLenum pname
, GLint param
)
2683 GLfloat p
= (GLfloat
) param
;
2684 save_PointParameterfvEXT(pname
, &p
);
2687 static void GLAPIENTRY
2688 save_PointParameterivNV(GLenum pname
, const GLint
* param
)
2690 GLfloat p
= (GLfloat
) param
[0];
2691 save_PointParameterfvEXT(pname
, &p
);
2695 static void GLAPIENTRY
2696 save_PointSize(GLfloat size
)
2698 GET_CURRENT_CONTEXT(ctx
);
2700 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2701 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_POINT_SIZE
, 1);
2705 if (ctx
->ExecuteFlag
) {
2706 CALL_PointSize(ctx
->Exec
, (size
));
2711 static void GLAPIENTRY
2712 save_PolygonMode(GLenum face
, GLenum mode
)
2714 GET_CURRENT_CONTEXT(ctx
);
2716 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2717 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_POLYGON_MODE
, 2);
2722 if (ctx
->ExecuteFlag
) {
2723 CALL_PolygonMode(ctx
->Exec
, (face
, mode
));
2728 static void GLAPIENTRY
2729 save_PolygonStipple(const GLubyte
* pattern
)
2731 GET_CURRENT_CONTEXT(ctx
);
2732 GLvoid
*image
= unpack_image(2, 32, 32, 1, GL_COLOR_INDEX
, GL_BITMAP
,
2733 pattern
, &ctx
->Unpack
);
2735 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2736 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_POLYGON_STIPPLE
, 1);
2743 if (ctx
->ExecuteFlag
) {
2744 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) pattern
));
2749 static void GLAPIENTRY
2750 save_PolygonOffset(GLfloat factor
, GLfloat units
)
2752 GET_CURRENT_CONTEXT(ctx
);
2754 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2755 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_POLYGON_OFFSET
, 2);
2760 if (ctx
->ExecuteFlag
) {
2761 CALL_PolygonOffset(ctx
->Exec
, (factor
, units
));
2766 static void GLAPIENTRY
2767 save_PolygonOffsetEXT(GLfloat factor
, GLfloat bias
)
2769 GET_CURRENT_CONTEXT(ctx
);
2770 /* XXX mult by DepthMaxF here??? */
2771 save_PolygonOffset(factor
, ctx
->DrawBuffer
->_DepthMaxF
* bias
);
2775 static void GLAPIENTRY
2776 save_PopAttrib(void)
2778 GET_CURRENT_CONTEXT(ctx
);
2779 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2780 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_POP_ATTRIB
, 0);
2781 if (ctx
->ExecuteFlag
) {
2782 CALL_PopAttrib(ctx
->Exec
, ());
2787 static void GLAPIENTRY
2788 save_PopMatrix(void)
2790 GET_CURRENT_CONTEXT(ctx
);
2791 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2792 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_POP_MATRIX
, 0);
2793 if (ctx
->ExecuteFlag
) {
2794 CALL_PopMatrix(ctx
->Exec
, ());
2799 static void GLAPIENTRY
2802 GET_CURRENT_CONTEXT(ctx
);
2803 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2804 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_POP_NAME
, 0);
2805 if (ctx
->ExecuteFlag
) {
2806 CALL_PopName(ctx
->Exec
, ());
2811 static void GLAPIENTRY
2812 save_PrioritizeTextures(GLsizei num
, const GLuint
* textures
,
2813 const GLclampf
* priorities
)
2815 GET_CURRENT_CONTEXT(ctx
);
2817 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2819 for (i
= 0; i
< num
; i
++) {
2821 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PRIORITIZE_TEXTURE
, 2);
2823 n
[1].ui
= textures
[i
];
2824 n
[2].f
= priorities
[i
];
2827 if (ctx
->ExecuteFlag
) {
2828 CALL_PrioritizeTextures(ctx
->Exec
, (num
, textures
, priorities
));
2833 static void GLAPIENTRY
2834 save_PushAttrib(GLbitfield mask
)
2836 GET_CURRENT_CONTEXT(ctx
);
2838 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2839 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PUSH_ATTRIB
, 1);
2843 if (ctx
->ExecuteFlag
) {
2844 CALL_PushAttrib(ctx
->Exec
, (mask
));
2849 static void GLAPIENTRY
2850 save_PushMatrix(void)
2852 GET_CURRENT_CONTEXT(ctx
);
2853 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2854 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_PUSH_MATRIX
, 0);
2855 if (ctx
->ExecuteFlag
) {
2856 CALL_PushMatrix(ctx
->Exec
, ());
2861 static void GLAPIENTRY
2862 save_PushName(GLuint name
)
2864 GET_CURRENT_CONTEXT(ctx
);
2866 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2867 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PUSH_NAME
, 1);
2871 if (ctx
->ExecuteFlag
) {
2872 CALL_PushName(ctx
->Exec
, (name
));
2877 static void GLAPIENTRY
2878 save_RasterPos4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
2880 GET_CURRENT_CONTEXT(ctx
);
2882 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2883 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_RASTER_POS
, 4);
2890 if (ctx
->ExecuteFlag
) {
2891 CALL_RasterPos4f(ctx
->Exec
, (x
, y
, z
, w
));
2895 static void GLAPIENTRY
2896 save_RasterPos2d(GLdouble x
, GLdouble y
)
2898 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
2901 static void GLAPIENTRY
2902 save_RasterPos2f(GLfloat x
, GLfloat y
)
2904 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2907 static void GLAPIENTRY
2908 save_RasterPos2i(GLint x
, GLint y
)
2910 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
2913 static void GLAPIENTRY
2914 save_RasterPos2s(GLshort x
, GLshort y
)
2916 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2919 static void GLAPIENTRY
2920 save_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
2922 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
2925 static void GLAPIENTRY
2926 save_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
2928 save_RasterPos4f(x
, y
, z
, 1.0F
);
2931 static void GLAPIENTRY
2932 save_RasterPos3i(GLint x
, GLint y
, GLint z
)
2934 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
2937 static void GLAPIENTRY
2938 save_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
2940 save_RasterPos4f(x
, y
, z
, 1.0F
);
2943 static void GLAPIENTRY
2944 save_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
2946 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
2949 static void GLAPIENTRY
2950 save_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
2952 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
2955 static void GLAPIENTRY
2956 save_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
2958 save_RasterPos4f(x
, y
, z
, w
);
2961 static void GLAPIENTRY
2962 save_RasterPos2dv(const GLdouble
* v
)
2964 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
2967 static void GLAPIENTRY
2968 save_RasterPos2fv(const GLfloat
* v
)
2970 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2973 static void GLAPIENTRY
2974 save_RasterPos2iv(const GLint
* v
)
2976 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
2979 static void GLAPIENTRY
2980 save_RasterPos2sv(const GLshort
* v
)
2982 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2985 static void GLAPIENTRY
2986 save_RasterPos3dv(const GLdouble
* v
)
2988 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
2991 static void GLAPIENTRY
2992 save_RasterPos3fv(const GLfloat
* v
)
2994 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2997 static void GLAPIENTRY
2998 save_RasterPos3iv(const GLint
* v
)
3000 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3003 static void GLAPIENTRY
3004 save_RasterPos3sv(const GLshort
* v
)
3006 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3009 static void GLAPIENTRY
3010 save_RasterPos4dv(const GLdouble
* v
)
3012 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3013 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3016 static void GLAPIENTRY
3017 save_RasterPos4fv(const GLfloat
* v
)
3019 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3022 static void GLAPIENTRY
3023 save_RasterPos4iv(const GLint
* v
)
3025 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3026 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3029 static void GLAPIENTRY
3030 save_RasterPos4sv(const GLshort
* v
)
3032 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3036 static void GLAPIENTRY
3037 save_PassThrough(GLfloat token
)
3039 GET_CURRENT_CONTEXT(ctx
);
3041 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3042 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PASSTHROUGH
, 1);
3046 if (ctx
->ExecuteFlag
) {
3047 CALL_PassThrough(ctx
->Exec
, (token
));
3052 static void GLAPIENTRY
3053 save_ReadBuffer(GLenum mode
)
3055 GET_CURRENT_CONTEXT(ctx
);
3057 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3058 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_READ_BUFFER
, 1);
3062 if (ctx
->ExecuteFlag
) {
3063 CALL_ReadBuffer(ctx
->Exec
, (mode
));
3068 static void GLAPIENTRY
3069 save_ResetHistogram(GLenum target
)
3071 GET_CURRENT_CONTEXT(ctx
);
3073 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3074 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_RESET_HISTOGRAM
, 1);
3078 if (ctx
->ExecuteFlag
) {
3079 CALL_ResetHistogram(ctx
->Exec
, (target
));
3084 static void GLAPIENTRY
3085 save_ResetMinmax(GLenum target
)
3087 GET_CURRENT_CONTEXT(ctx
);
3089 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3090 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_RESET_MIN_MAX
, 1);
3094 if (ctx
->ExecuteFlag
) {
3095 CALL_ResetMinmax(ctx
->Exec
, (target
));
3100 static void GLAPIENTRY
3101 save_Rotatef(GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
3103 GET_CURRENT_CONTEXT(ctx
);
3105 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3106 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ROTATE
, 4);
3113 if (ctx
->ExecuteFlag
) {
3114 CALL_Rotatef(ctx
->Exec
, (angle
, x
, y
, z
));
3119 static void GLAPIENTRY
3120 save_Rotated(GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
3122 save_Rotatef((GLfloat
) angle
, (GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3126 static void GLAPIENTRY
3127 save_Scalef(GLfloat x
, GLfloat y
, GLfloat z
)
3129 GET_CURRENT_CONTEXT(ctx
);
3131 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3132 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SCALE
, 3);
3138 if (ctx
->ExecuteFlag
) {
3139 CALL_Scalef(ctx
->Exec
, (x
, y
, z
));
3144 static void GLAPIENTRY
3145 save_Scaled(GLdouble x
, GLdouble y
, GLdouble z
)
3147 save_Scalef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3151 static void GLAPIENTRY
3152 save_Scissor(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3154 GET_CURRENT_CONTEXT(ctx
);
3156 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3157 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SCISSOR
, 4);
3164 if (ctx
->ExecuteFlag
) {
3165 CALL_Scissor(ctx
->Exec
, (x
, y
, width
, height
));
3170 static void GLAPIENTRY
3171 save_ShadeModel(GLenum mode
)
3173 GET_CURRENT_CONTEXT(ctx
);
3175 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3176 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SHADE_MODEL
, 1);
3180 if (ctx
->ExecuteFlag
) {
3181 CALL_ShadeModel(ctx
->Exec
, (mode
));
3186 static void GLAPIENTRY
3187 save_StencilFunc(GLenum func
, GLint ref
, GLuint mask
)
3189 GET_CURRENT_CONTEXT(ctx
);
3191 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3192 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_FUNC
, 3);
3198 if (ctx
->ExecuteFlag
) {
3199 CALL_StencilFunc(ctx
->Exec
, (func
, ref
, mask
));
3204 static void GLAPIENTRY
3205 save_StencilMask(GLuint mask
)
3207 GET_CURRENT_CONTEXT(ctx
);
3209 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3210 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_MASK
, 1);
3214 if (ctx
->ExecuteFlag
) {
3215 CALL_StencilMask(ctx
->Exec
, (mask
));
3220 static void GLAPIENTRY
3221 save_StencilOp(GLenum fail
, GLenum zfail
, GLenum zpass
)
3223 GET_CURRENT_CONTEXT(ctx
);
3225 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3226 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_OP
, 3);
3232 if (ctx
->ExecuteFlag
) {
3233 CALL_StencilOp(ctx
->Exec
, (fail
, zfail
, zpass
));
3238 static void GLAPIENTRY
3239 save_StencilFuncSeparate(GLenum face
, GLenum func
, GLint ref
, GLuint mask
)
3241 GET_CURRENT_CONTEXT(ctx
);
3243 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3244 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3251 if (ctx
->ExecuteFlag
) {
3252 CALL_StencilFuncSeparate(ctx
->Exec
, (face
, func
, ref
, mask
));
3257 static void GLAPIENTRY
3258 save_StencilFuncSeparateATI(GLenum frontfunc
, GLenum backfunc
, GLint ref
,
3261 GET_CURRENT_CONTEXT(ctx
);
3263 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3265 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3273 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3280 if (ctx
->ExecuteFlag
) {
3281 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_FRONT
, frontfunc
, ref
, mask
));
3282 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_BACK
, backfunc
, ref
, mask
));
3287 static void GLAPIENTRY
3288 save_StencilMaskSeparate(GLenum face
, GLuint mask
)
3290 GET_CURRENT_CONTEXT(ctx
);
3292 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3293 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_MASK_SEPARATE
, 2);
3298 if (ctx
->ExecuteFlag
) {
3299 CALL_StencilMaskSeparate(ctx
->Exec
, (face
, mask
));
3304 static void GLAPIENTRY
3305 save_StencilOpSeparate(GLenum face
, GLenum fail
, GLenum zfail
, GLenum zpass
)
3307 GET_CURRENT_CONTEXT(ctx
);
3309 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3310 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_OP_SEPARATE
, 4);
3317 if (ctx
->ExecuteFlag
) {
3318 CALL_StencilOpSeparate(ctx
->Exec
, (face
, fail
, zfail
, zpass
));
3323 static void GLAPIENTRY
3324 save_TexEnvfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3326 GET_CURRENT_CONTEXT(ctx
);
3328 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3329 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEXENV
, 6);
3333 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3341 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
3344 if (ctx
->ExecuteFlag
) {
3345 CALL_TexEnvfv(ctx
->Exec
, (target
, pname
, params
));
3350 static void GLAPIENTRY
3351 save_TexEnvf(GLenum target
, GLenum pname
, GLfloat param
)
3353 save_TexEnvfv(target
, pname
, ¶m
);
3357 static void GLAPIENTRY
3358 save_TexEnvi(GLenum target
, GLenum pname
, GLint param
)
3361 p
[0] = (GLfloat
) param
;
3362 p
[1] = p
[2] = p
[3] = 0.0;
3363 save_TexEnvfv(target
, pname
, p
);
3367 static void GLAPIENTRY
3368 save_TexEnviv(GLenum target
, GLenum pname
, const GLint
* param
)
3371 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3372 p
[0] = INT_TO_FLOAT(param
[0]);
3373 p
[1] = INT_TO_FLOAT(param
[1]);
3374 p
[2] = INT_TO_FLOAT(param
[2]);
3375 p
[3] = INT_TO_FLOAT(param
[3]);
3378 p
[0] = (GLfloat
) param
[0];
3379 p
[1] = p
[2] = p
[3] = 0.0F
;
3381 save_TexEnvfv(target
, pname
, p
);
3385 static void GLAPIENTRY
3386 save_TexGenfv(GLenum coord
, GLenum pname
, const GLfloat
*params
)
3388 GET_CURRENT_CONTEXT(ctx
);
3390 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3391 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEXGEN
, 6);
3400 if (ctx
->ExecuteFlag
) {
3401 CALL_TexGenfv(ctx
->Exec
, (coord
, pname
, params
));
3406 static void GLAPIENTRY
3407 save_TexGeniv(GLenum coord
, GLenum pname
, const GLint
*params
)
3410 p
[0] = (GLfloat
) params
[0];
3411 p
[1] = (GLfloat
) params
[1];
3412 p
[2] = (GLfloat
) params
[2];
3413 p
[3] = (GLfloat
) params
[3];
3414 save_TexGenfv(coord
, pname
, p
);
3418 static void GLAPIENTRY
3419 save_TexGend(GLenum coord
, GLenum pname
, GLdouble param
)
3421 GLfloat p
= (GLfloat
) param
;
3422 save_TexGenfv(coord
, pname
, &p
);
3426 static void GLAPIENTRY
3427 save_TexGendv(GLenum coord
, GLenum pname
, const GLdouble
*params
)
3430 p
[0] = (GLfloat
) params
[0];
3431 p
[1] = (GLfloat
) params
[1];
3432 p
[2] = (GLfloat
) params
[2];
3433 p
[3] = (GLfloat
) params
[3];
3434 save_TexGenfv(coord
, pname
, p
);
3438 static void GLAPIENTRY
3439 save_TexGenf(GLenum coord
, GLenum pname
, GLfloat param
)
3441 save_TexGenfv(coord
, pname
, ¶m
);
3445 static void GLAPIENTRY
3446 save_TexGeni(GLenum coord
, GLenum pname
, GLint param
)
3448 save_TexGeniv(coord
, pname
, ¶m
);
3452 static void GLAPIENTRY
3453 save_TexParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3455 GET_CURRENT_CONTEXT(ctx
);
3457 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3458 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEXPARAMETER
, 6);
3467 if (ctx
->ExecuteFlag
) {
3468 CALL_TexParameterfv(ctx
->Exec
, (target
, pname
, params
));
3473 static void GLAPIENTRY
3474 save_TexParameterf(GLenum target
, GLenum pname
, GLfloat param
)
3476 save_TexParameterfv(target
, pname
, ¶m
);
3480 static void GLAPIENTRY
3481 save_TexParameteri(GLenum target
, GLenum pname
, GLint param
)
3484 fparam
[0] = (GLfloat
) param
;
3485 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
3486 save_TexParameterfv(target
, pname
, fparam
);
3490 static void GLAPIENTRY
3491 save_TexParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
3494 fparam
[0] = (GLfloat
) params
[0];
3495 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
3496 save_TexParameterfv(target
, pname
, fparam
);
3500 static void GLAPIENTRY
3501 save_TexImage1D(GLenum target
,
3502 GLint level
, GLint components
,
3503 GLsizei width
, GLint border
,
3504 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3506 GET_CURRENT_CONTEXT(ctx
);
3507 if (target
== GL_PROXY_TEXTURE_1D
) {
3508 /* don't compile, execute immediately */
3509 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
3510 border
, format
, type
, pixels
));
3513 GLvoid
*image
= unpack_image(1, width
, 1, 1, format
, type
,
3514 pixels
, &ctx
->Unpack
);
3516 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3517 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_IMAGE1D
, 8);
3521 n
[3].i
= components
;
3522 n
[4].i
= (GLint
) width
;
3531 if (ctx
->ExecuteFlag
) {
3532 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
3533 border
, format
, type
, pixels
));
3539 static void GLAPIENTRY
3540 save_TexImage2D(GLenum target
,
3541 GLint level
, GLint components
,
3542 GLsizei width
, GLsizei height
, GLint border
,
3543 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3545 GET_CURRENT_CONTEXT(ctx
);
3546 if (target
== GL_PROXY_TEXTURE_2D
) {
3547 /* don't compile, execute immediately */
3548 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
3549 height
, border
, format
, type
, pixels
));
3552 GLvoid
*image
= unpack_image(2, width
, height
, 1, format
, type
,
3553 pixels
, &ctx
->Unpack
);
3555 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3556 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_IMAGE2D
, 9);
3560 n
[3].i
= components
;
3561 n
[4].i
= (GLint
) width
;
3562 n
[5].i
= (GLint
) height
;
3571 if (ctx
->ExecuteFlag
) {
3572 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
3573 height
, border
, format
, type
, pixels
));
3579 static void GLAPIENTRY
3580 save_TexImage3D(GLenum target
,
3581 GLint level
, GLint internalFormat
,
3582 GLsizei width
, GLsizei height
, GLsizei depth
,
3584 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3586 GET_CURRENT_CONTEXT(ctx
);
3587 if (target
== GL_PROXY_TEXTURE_3D
) {
3588 /* don't compile, execute immediately */
3589 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
3590 height
, depth
, border
, format
, type
,
3595 GLvoid
*image
= unpack_image(3, width
, height
, depth
, format
, type
,
3596 pixels
, &ctx
->Unpack
);
3597 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3598 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_IMAGE3D
, 10);
3602 n
[3].i
= (GLint
) internalFormat
;
3603 n
[4].i
= (GLint
) width
;
3604 n
[5].i
= (GLint
) height
;
3605 n
[6].i
= (GLint
) depth
;
3614 if (ctx
->ExecuteFlag
) {
3615 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
3616 height
, depth
, border
, format
, type
,
3623 static void GLAPIENTRY
3624 save_TexSubImage1D(GLenum target
, GLint level
, GLint xoffset
,
3625 GLsizei width
, GLenum format
, GLenum type
,
3626 const GLvoid
* pixels
)
3628 GET_CURRENT_CONTEXT(ctx
);
3630 GLvoid
*image
= unpack_image(1, width
, 1, 1, format
, type
,
3631 pixels
, &ctx
->Unpack
);
3632 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3633 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_SUB_IMAGE1D
, 7);
3638 n
[4].i
= (GLint
) width
;
3646 if (ctx
->ExecuteFlag
) {
3647 CALL_TexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
, width
,
3648 format
, type
, pixels
));
3653 static void GLAPIENTRY
3654 save_TexSubImage2D(GLenum target
, GLint level
,
3655 GLint xoffset
, GLint yoffset
,
3656 GLsizei width
, GLsizei height
,
3657 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3659 GET_CURRENT_CONTEXT(ctx
);
3661 GLvoid
*image
= unpack_image(2, width
, height
, 1, format
, type
,
3662 pixels
, &ctx
->Unpack
);
3663 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3664 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_SUB_IMAGE2D
, 9);
3670 n
[5].i
= (GLint
) width
;
3671 n
[6].i
= (GLint
) height
;
3679 if (ctx
->ExecuteFlag
) {
3680 CALL_TexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
3681 width
, height
, format
, type
, pixels
));
3686 static void GLAPIENTRY
3687 save_TexSubImage3D(GLenum target
, GLint level
,
3688 GLint xoffset
, GLint yoffset
, GLint zoffset
,
3689 GLsizei width
, GLsizei height
, GLsizei depth
,
3690 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3692 GET_CURRENT_CONTEXT(ctx
);
3694 GLvoid
*image
= unpack_image(3, width
, height
, depth
, format
, type
,
3695 pixels
, &ctx
->Unpack
);
3696 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3697 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_SUB_IMAGE3D
, 11);
3704 n
[6].i
= (GLint
) width
;
3705 n
[7].i
= (GLint
) height
;
3706 n
[8].i
= (GLint
) depth
;
3714 if (ctx
->ExecuteFlag
) {
3715 CALL_TexSubImage3D(ctx
->Exec
, (target
, level
,
3716 xoffset
, yoffset
, zoffset
,
3717 width
, height
, depth
, format
, type
,
3723 static void GLAPIENTRY
3724 save_Translatef(GLfloat x
, GLfloat y
, GLfloat z
)
3726 GET_CURRENT_CONTEXT(ctx
);
3728 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3729 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TRANSLATE
, 3);
3735 if (ctx
->ExecuteFlag
) {
3736 CALL_Translatef(ctx
->Exec
, (x
, y
, z
));
3741 static void GLAPIENTRY
3742 save_Translated(GLdouble x
, GLdouble y
, GLdouble z
)
3744 save_Translatef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3749 static void GLAPIENTRY
3750 save_Viewport(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3752 GET_CURRENT_CONTEXT(ctx
);
3754 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3755 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_VIEWPORT
, 4);
3759 n
[3].i
= (GLint
) width
;
3760 n
[4].i
= (GLint
) height
;
3762 if (ctx
->ExecuteFlag
) {
3763 CALL_Viewport(ctx
->Exec
, (x
, y
, width
, height
));
3768 static void GLAPIENTRY
3769 save_WindowPos4fMESA(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3771 GET_CURRENT_CONTEXT(ctx
);
3773 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3774 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_WINDOW_POS
, 4);
3781 if (ctx
->ExecuteFlag
) {
3782 CALL_WindowPos4fMESA(ctx
->Exec
, (x
, y
, z
, w
));
3786 static void GLAPIENTRY
3787 save_WindowPos2dMESA(GLdouble x
, GLdouble y
)
3789 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3792 static void GLAPIENTRY
3793 save_WindowPos2fMESA(GLfloat x
, GLfloat y
)
3795 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3798 static void GLAPIENTRY
3799 save_WindowPos2iMESA(GLint x
, GLint y
)
3801 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3804 static void GLAPIENTRY
3805 save_WindowPos2sMESA(GLshort x
, GLshort y
)
3807 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3810 static void GLAPIENTRY
3811 save_WindowPos3dMESA(GLdouble x
, GLdouble y
, GLdouble z
)
3813 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3816 static void GLAPIENTRY
3817 save_WindowPos3fMESA(GLfloat x
, GLfloat y
, GLfloat z
)
3819 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3822 static void GLAPIENTRY
3823 save_WindowPos3iMESA(GLint x
, GLint y
, GLint z
)
3825 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3828 static void GLAPIENTRY
3829 save_WindowPos3sMESA(GLshort x
, GLshort y
, GLshort z
)
3831 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3834 static void GLAPIENTRY
3835 save_WindowPos4dMESA(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3837 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3840 static void GLAPIENTRY
3841 save_WindowPos4iMESA(GLint x
, GLint y
, GLint z
, GLint w
)
3843 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3846 static void GLAPIENTRY
3847 save_WindowPos4sMESA(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
3849 save_WindowPos4fMESA(x
, y
, z
, w
);
3852 static void GLAPIENTRY
3853 save_WindowPos2dvMESA(const GLdouble
* v
)
3855 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3858 static void GLAPIENTRY
3859 save_WindowPos2fvMESA(const GLfloat
* v
)
3861 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3864 static void GLAPIENTRY
3865 save_WindowPos2ivMESA(const GLint
* v
)
3867 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3870 static void GLAPIENTRY
3871 save_WindowPos2svMESA(const GLshort
* v
)
3873 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3876 static void GLAPIENTRY
3877 save_WindowPos3dvMESA(const GLdouble
* v
)
3879 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3882 static void GLAPIENTRY
3883 save_WindowPos3fvMESA(const GLfloat
* v
)
3885 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3888 static void GLAPIENTRY
3889 save_WindowPos3ivMESA(const GLint
* v
)
3891 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3894 static void GLAPIENTRY
3895 save_WindowPos3svMESA(const GLshort
* v
)
3897 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3900 static void GLAPIENTRY
3901 save_WindowPos4dvMESA(const GLdouble
* v
)
3903 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
3904 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3907 static void GLAPIENTRY
3908 save_WindowPos4fvMESA(const GLfloat
* v
)
3910 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3913 static void GLAPIENTRY
3914 save_WindowPos4ivMESA(const GLint
* v
)
3916 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
3917 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3920 static void GLAPIENTRY
3921 save_WindowPos4svMESA(const GLshort
* v
)
3923 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3928 /* GL_ARB_multitexture */
3929 static void GLAPIENTRY
3930 save_ActiveTextureARB(GLenum target
)
3932 GET_CURRENT_CONTEXT(ctx
);
3934 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3935 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ACTIVE_TEXTURE
, 1);
3939 if (ctx
->ExecuteFlag
) {
3940 CALL_ActiveTextureARB(ctx
->Exec
, (target
));
3945 /* GL_ARB_transpose_matrix */
3947 static void GLAPIENTRY
3948 save_LoadTransposeMatrixdARB(const GLdouble m
[16])
3951 _math_transposefd(tm
, m
);
3952 save_LoadMatrixf(tm
);
3956 static void GLAPIENTRY
3957 save_LoadTransposeMatrixfARB(const GLfloat m
[16])
3960 _math_transposef(tm
, m
);
3961 save_LoadMatrixf(tm
);
3965 static void GLAPIENTRY
3966 save_MultTransposeMatrixdARB(const GLdouble m
[16])
3969 _math_transposefd(tm
, m
);
3970 save_MultMatrixf(tm
);
3974 static void GLAPIENTRY
3975 save_MultTransposeMatrixfARB(const GLfloat m
[16])
3978 _math_transposef(tm
, m
);
3979 save_MultMatrixf(tm
);
3983 /* GL_ARB_texture_compression */
3984 static void GLAPIENTRY
3985 save_CompressedTexImage1DARB(GLenum target
, GLint level
,
3986 GLenum internalFormat
, GLsizei width
,
3987 GLint border
, GLsizei imageSize
,
3988 const GLvoid
* data
)
3990 GET_CURRENT_CONTEXT(ctx
);
3991 if (target
== GL_PROXY_TEXTURE_1D
) {
3992 /* don't compile, execute immediately */
3993 CALL_CompressedTexImage1DARB(ctx
->Exec
, (target
, level
, internalFormat
,
3994 width
, border
, imageSize
,
4000 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4001 /* make copy of image */
4002 image
= _mesa_malloc(imageSize
);
4004 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage1DARB");
4007 MEMCPY(image
, data
, imageSize
);
4008 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_1D
, 7);
4012 n
[3].e
= internalFormat
;
4013 n
[4].i
= (GLint
) width
;
4021 if (ctx
->ExecuteFlag
) {
4022 CALL_CompressedTexImage1DARB(ctx
->Exec
,
4023 (target
, level
, internalFormat
, width
,
4024 border
, imageSize
, data
));
4030 static void GLAPIENTRY
4031 save_CompressedTexImage2DARB(GLenum target
, GLint level
,
4032 GLenum internalFormat
, GLsizei width
,
4033 GLsizei height
, GLint border
, GLsizei imageSize
,
4034 const GLvoid
* data
)
4036 GET_CURRENT_CONTEXT(ctx
);
4037 if (target
== GL_PROXY_TEXTURE_2D
) {
4038 /* don't compile, execute immediately */
4039 CALL_CompressedTexImage2DARB(ctx
->Exec
, (target
, level
, internalFormat
,
4040 width
, height
, border
,
4046 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4047 /* make copy of image */
4048 image
= _mesa_malloc(imageSize
);
4050 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage2DARB");
4053 MEMCPY(image
, data
, imageSize
);
4054 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_2D
, 8);
4058 n
[3].e
= internalFormat
;
4059 n
[4].i
= (GLint
) width
;
4060 n
[5].i
= (GLint
) height
;
4068 if (ctx
->ExecuteFlag
) {
4069 CALL_CompressedTexImage2DARB(ctx
->Exec
,
4070 (target
, level
, internalFormat
, width
,
4071 height
, border
, imageSize
, data
));
4077 static void GLAPIENTRY
4078 save_CompressedTexImage3DARB(GLenum target
, GLint level
,
4079 GLenum internalFormat
, GLsizei width
,
4080 GLsizei height
, GLsizei depth
, GLint border
,
4081 GLsizei imageSize
, const GLvoid
* data
)
4083 GET_CURRENT_CONTEXT(ctx
);
4084 if (target
== GL_PROXY_TEXTURE_3D
) {
4085 /* don't compile, execute immediately */
4086 CALL_CompressedTexImage3DARB(ctx
->Exec
, (target
, level
, internalFormat
,
4087 width
, height
, depth
, border
,
4093 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4094 /* make copy of image */
4095 image
= _mesa_malloc(imageSize
);
4097 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage3DARB");
4100 MEMCPY(image
, data
, imageSize
);
4101 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_3D
, 9);
4105 n
[3].e
= internalFormat
;
4106 n
[4].i
= (GLint
) width
;
4107 n
[5].i
= (GLint
) height
;
4108 n
[6].i
= (GLint
) depth
;
4116 if (ctx
->ExecuteFlag
) {
4117 CALL_CompressedTexImage3DARB(ctx
->Exec
,
4118 (target
, level
, internalFormat
, width
,
4119 height
, depth
, border
, imageSize
,
4126 static void GLAPIENTRY
4127 save_CompressedTexSubImage1DARB(GLenum target
, GLint level
, GLint xoffset
,
4128 GLsizei width
, GLenum format
,
4129 GLsizei imageSize
, const GLvoid
* data
)
4134 GET_CURRENT_CONTEXT(ctx
);
4135 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4137 /* make copy of image */
4138 image
= _mesa_malloc(imageSize
);
4140 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage1DARB");
4143 MEMCPY(image
, data
, imageSize
);
4144 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
, 7);
4149 n
[4].i
= (GLint
) width
;
4157 if (ctx
->ExecuteFlag
) {
4158 CALL_CompressedTexSubImage1DARB(ctx
->Exec
, (target
, level
, xoffset
,
4159 width
, format
, imageSize
,
4165 static void GLAPIENTRY
4166 save_CompressedTexSubImage2DARB(GLenum target
, GLint level
, GLint xoffset
,
4167 GLint yoffset
, GLsizei width
, GLsizei height
,
4168 GLenum format
, GLsizei imageSize
,
4169 const GLvoid
* data
)
4174 GET_CURRENT_CONTEXT(ctx
);
4175 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4177 /* make copy of image */
4178 image
= _mesa_malloc(imageSize
);
4180 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage2DARB");
4183 MEMCPY(image
, data
, imageSize
);
4184 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
, 9);
4190 n
[5].i
= (GLint
) width
;
4191 n
[6].i
= (GLint
) height
;
4199 if (ctx
->ExecuteFlag
) {
4200 CALL_CompressedTexSubImage2DARB(ctx
->Exec
,
4201 (target
, level
, xoffset
, yoffset
, width
,
4202 height
, format
, imageSize
, data
));
4207 static void GLAPIENTRY
4208 save_CompressedTexSubImage3DARB(GLenum target
, GLint level
, GLint xoffset
,
4209 GLint yoffset
, GLint zoffset
, GLsizei width
,
4210 GLsizei height
, GLsizei depth
, GLenum format
,
4211 GLsizei imageSize
, const GLvoid
* data
)
4216 GET_CURRENT_CONTEXT(ctx
);
4217 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4219 /* make copy of image */
4220 image
= _mesa_malloc(imageSize
);
4222 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage3DARB");
4225 MEMCPY(image
, data
, imageSize
);
4226 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
, 11);
4233 n
[6].i
= (GLint
) width
;
4234 n
[7].i
= (GLint
) height
;
4235 n
[8].i
= (GLint
) depth
;
4237 n
[10].i
= imageSize
;
4243 if (ctx
->ExecuteFlag
) {
4244 CALL_CompressedTexSubImage3DARB(ctx
->Exec
,
4245 (target
, level
, xoffset
, yoffset
,
4246 zoffset
, width
, height
, depth
, format
,
4252 /* GL_ARB_multisample */
4253 static void GLAPIENTRY
4254 save_SampleCoverageARB(GLclampf value
, GLboolean invert
)
4256 GET_CURRENT_CONTEXT(ctx
);
4258 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4259 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SAMPLE_COVERAGE
, 2);
4264 if (ctx
->ExecuteFlag
) {
4265 CALL_SampleCoverageARB(ctx
->Exec
, (value
, invert
));
4271 * GL_NV_vertex_program
4273 #if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
4274 static void GLAPIENTRY
4275 save_BindProgramNV(GLenum target
, GLuint id
)
4277 GET_CURRENT_CONTEXT(ctx
);
4279 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4280 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BIND_PROGRAM_NV
, 2);
4285 if (ctx
->ExecuteFlag
) {
4286 CALL_BindProgramNV(ctx
->Exec
, (target
, id
));
4290 static void GLAPIENTRY
4291 save_ProgramEnvParameter4fARB(GLenum target
, GLuint index
,
4292 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4294 GET_CURRENT_CONTEXT(ctx
);
4296 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4297 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4306 if (ctx
->ExecuteFlag
) {
4307 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4312 static void GLAPIENTRY
4313 save_ProgramEnvParameter4fvARB(GLenum target
, GLuint index
,
4314 const GLfloat
*params
)
4316 save_ProgramEnvParameter4fARB(target
, index
, params
[0], params
[1],
4317 params
[2], params
[3]);
4321 static void GLAPIENTRY
4322 save_ProgramEnvParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4323 const GLfloat
* params
)
4325 GET_CURRENT_CONTEXT(ctx
);
4327 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4331 const GLfloat
* p
= params
;
4333 for (i
= 0 ; i
< count
; i
++) {
4334 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4347 if (ctx
->ExecuteFlag
) {
4348 CALL_ProgramEnvParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4353 static void GLAPIENTRY
4354 save_ProgramEnvParameter4dARB(GLenum target
, GLuint index
,
4355 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4357 save_ProgramEnvParameter4fARB(target
, index
,
4359 (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4363 static void GLAPIENTRY
4364 save_ProgramEnvParameter4dvARB(GLenum target
, GLuint index
,
4365 const GLdouble
*params
)
4367 save_ProgramEnvParameter4fARB(target
, index
,
4368 (GLfloat
) params
[0],
4369 (GLfloat
) params
[1],
4370 (GLfloat
) params
[2], (GLfloat
) params
[3]);
4373 #endif /* FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program || FEATURE_NV_vertex_program */
4375 #if FEATURE_NV_vertex_program
4376 static void GLAPIENTRY
4377 save_ExecuteProgramNV(GLenum target
, GLuint id
, const GLfloat
*params
)
4379 GET_CURRENT_CONTEXT(ctx
);
4381 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4382 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EXECUTE_PROGRAM_NV
, 6);
4391 if (ctx
->ExecuteFlag
) {
4392 CALL_ExecuteProgramNV(ctx
->Exec
, (target
, id
, params
));
4397 static void GLAPIENTRY
4398 save_ProgramParameters4dvNV(GLenum target
, GLuint index
,
4399 GLuint num
, const GLdouble
*params
)
4402 for (i
= 0; i
< num
; i
++) {
4403 save_ProgramEnvParameter4dvARB(target
, index
+ i
, params
+ 4 * i
);
4408 static void GLAPIENTRY
4409 save_ProgramParameters4fvNV(GLenum target
, GLuint index
,
4410 GLuint num
, const GLfloat
*params
)
4413 for (i
= 0; i
< num
; i
++) {
4414 save_ProgramEnvParameter4fvARB(target
, index
+ i
, params
+ 4 * i
);
4419 static void GLAPIENTRY
4420 save_LoadProgramNV(GLenum target
, GLuint id
, GLsizei len
,
4421 const GLubyte
* program
)
4423 GET_CURRENT_CONTEXT(ctx
);
4425 GLubyte
*programCopy
;
4427 programCopy
= (GLubyte
*) _mesa_malloc(len
);
4429 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glLoadProgramNV");
4432 _mesa_memcpy(programCopy
, program
, len
);
4434 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4435 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LOAD_PROGRAM_NV
, 4);
4440 n
[4].data
= programCopy
;
4442 if (ctx
->ExecuteFlag
) {
4443 CALL_LoadProgramNV(ctx
->Exec
, (target
, id
, len
, program
));
4448 static void GLAPIENTRY
4449 save_RequestResidentProgramsNV(GLsizei num
, const GLuint
* ids
)
4451 GET_CURRENT_CONTEXT(ctx
);
4453 GLuint
*idCopy
= (GLuint
*) _mesa_malloc(num
* sizeof(GLuint
));
4455 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glRequestResidentProgramsNV");
4458 _mesa_memcpy(idCopy
, ids
, num
* sizeof(GLuint
));
4459 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4460 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TRACK_MATRIX_NV
, 2);
4465 if (ctx
->ExecuteFlag
) {
4466 CALL_RequestResidentProgramsNV(ctx
->Exec
, (num
, ids
));
4471 static void GLAPIENTRY
4472 save_TrackMatrixNV(GLenum target
, GLuint address
,
4473 GLenum matrix
, GLenum transform
)
4475 GET_CURRENT_CONTEXT(ctx
);
4477 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4478 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TRACK_MATRIX_NV
, 4);
4485 if (ctx
->ExecuteFlag
) {
4486 CALL_TrackMatrixNV(ctx
->Exec
, (target
, address
, matrix
, transform
));
4489 #endif /* FEATURE_NV_vertex_program */
4493 * GL_NV_fragment_program
4495 #if FEATURE_NV_fragment_program
4496 static void GLAPIENTRY
4497 save_ProgramLocalParameter4fARB(GLenum target
, GLuint index
,
4498 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4500 GET_CURRENT_CONTEXT(ctx
);
4502 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4503 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4512 if (ctx
->ExecuteFlag
) {
4513 CALL_ProgramLocalParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4518 static void GLAPIENTRY
4519 save_ProgramLocalParameter4fvARB(GLenum target
, GLuint index
,
4520 const GLfloat
*params
)
4522 GET_CURRENT_CONTEXT(ctx
);
4524 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4525 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4534 if (ctx
->ExecuteFlag
) {
4535 CALL_ProgramLocalParameter4fvARB(ctx
->Exec
, (target
, index
, params
));
4540 static void GLAPIENTRY
4541 save_ProgramLocalParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4542 const GLfloat
*params
)
4544 GET_CURRENT_CONTEXT(ctx
);
4546 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4550 const GLfloat
* p
= params
;
4552 for (i
= 0 ; i
< count
; i
++) {
4553 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4566 if (ctx
->ExecuteFlag
) {
4567 CALL_ProgramLocalParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4572 static void GLAPIENTRY
4573 save_ProgramLocalParameter4dARB(GLenum target
, GLuint index
,
4574 GLdouble x
, GLdouble y
,
4575 GLdouble z
, GLdouble w
)
4577 GET_CURRENT_CONTEXT(ctx
);
4579 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4580 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4584 n
[3].f
= (GLfloat
) x
;
4585 n
[4].f
= (GLfloat
) y
;
4586 n
[5].f
= (GLfloat
) z
;
4587 n
[6].f
= (GLfloat
) w
;
4589 if (ctx
->ExecuteFlag
) {
4590 CALL_ProgramLocalParameter4dARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4595 static void GLAPIENTRY
4596 save_ProgramLocalParameter4dvARB(GLenum target
, GLuint index
,
4597 const GLdouble
*params
)
4599 GET_CURRENT_CONTEXT(ctx
);
4601 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4602 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4606 n
[3].f
= (GLfloat
) params
[0];
4607 n
[4].f
= (GLfloat
) params
[1];
4608 n
[5].f
= (GLfloat
) params
[2];
4609 n
[6].f
= (GLfloat
) params
[3];
4611 if (ctx
->ExecuteFlag
) {
4612 CALL_ProgramLocalParameter4dvARB(ctx
->Exec
, (target
, index
, params
));
4616 static void GLAPIENTRY
4617 save_ProgramNamedParameter4fNV(GLuint id
, GLsizei len
, const GLubyte
* name
,
4618 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4620 GET_CURRENT_CONTEXT(ctx
);
4622 GLubyte
*nameCopy
= (GLubyte
*) _mesa_malloc(len
);
4624 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramNamedParameter4fNV");
4627 _mesa_memcpy(nameCopy
, name
, len
);
4629 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4630 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_NAMED_PARAMETER_NV
, 6);
4634 n
[3].data
= nameCopy
;
4640 if (ctx
->ExecuteFlag
) {
4641 CALL_ProgramNamedParameter4fNV(ctx
->Exec
, (id
, len
, name
, x
, y
, z
, w
));
4646 static void GLAPIENTRY
4647 save_ProgramNamedParameter4fvNV(GLuint id
, GLsizei len
, const GLubyte
* name
,
4650 save_ProgramNamedParameter4fNV(id
, len
, name
, v
[0], v
[1], v
[2], v
[3]);
4654 static void GLAPIENTRY
4655 save_ProgramNamedParameter4dNV(GLuint id
, GLsizei len
, const GLubyte
* name
,
4656 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4658 save_ProgramNamedParameter4fNV(id
, len
, name
, (GLfloat
) x
, (GLfloat
) y
,
4659 (GLfloat
) z
, (GLfloat
) w
);
4663 static void GLAPIENTRY
4664 save_ProgramNamedParameter4dvNV(GLuint id
, GLsizei len
, const GLubyte
* name
,
4667 save_ProgramNamedParameter4fNV(id
, len
, name
, (GLfloat
) v
[0],
4668 (GLfloat
) v
[1], (GLfloat
) v
[2],
4672 #endif /* FEATURE_NV_fragment_program */
4676 /* GL_EXT_stencil_two_side */
4677 static void GLAPIENTRY
4678 save_ActiveStencilFaceEXT(GLenum face
)
4680 GET_CURRENT_CONTEXT(ctx
);
4682 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4683 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ACTIVE_STENCIL_FACE_EXT
, 1);
4687 if (ctx
->ExecuteFlag
) {
4688 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (face
));
4693 /* GL_EXT_depth_bounds_test */
4694 static void GLAPIENTRY
4695 save_DepthBoundsEXT(GLclampd zmin
, GLclampd zmax
)
4697 GET_CURRENT_CONTEXT(ctx
);
4699 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4700 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DEPTH_BOUNDS_EXT
, 2);
4702 n
[1].f
= (GLfloat
) zmin
;
4703 n
[2].f
= (GLfloat
) zmax
;
4705 if (ctx
->ExecuteFlag
) {
4706 CALL_DepthBoundsEXT(ctx
->Exec
, (zmin
, zmax
));
4712 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
4714 static void GLAPIENTRY
4715 save_ProgramStringARB(GLenum target
, GLenum format
, GLsizei len
,
4716 const GLvoid
* string
)
4718 GET_CURRENT_CONTEXT(ctx
);
4720 GLubyte
*programCopy
;
4722 programCopy
= (GLubyte
*) _mesa_malloc(len
);
4724 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramStringARB");
4727 _mesa_memcpy(programCopy
, string
, len
);
4729 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4730 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_STRING_ARB
, 4);
4735 n
[4].data
= programCopy
;
4737 if (ctx
->ExecuteFlag
) {
4738 CALL_ProgramStringARB(ctx
->Exec
, (target
, format
, len
, string
));
4742 #endif /* FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program */
4745 #if FEATURE_ARB_occlusion_query
4747 static void GLAPIENTRY
4748 save_BeginQueryARB(GLenum target
, GLuint id
)
4750 GET_CURRENT_CONTEXT(ctx
);
4752 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4753 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BEGIN_QUERY_ARB
, 2);
4758 if (ctx
->ExecuteFlag
) {
4759 CALL_BeginQueryARB(ctx
->Exec
, (target
, id
));
4764 static void GLAPIENTRY
4765 save_EndQueryARB(GLenum target
)
4767 GET_CURRENT_CONTEXT(ctx
);
4769 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4770 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_END_QUERY_ARB
, 1);
4774 if (ctx
->ExecuteFlag
) {
4775 CALL_EndQueryARB(ctx
->Exec
, (target
));
4779 #endif /* FEATURE_ARB_occlusion_query */
4782 static void GLAPIENTRY
4783 save_DrawBuffersARB(GLsizei count
, const GLenum
* buffers
)
4785 GET_CURRENT_CONTEXT(ctx
);
4787 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4788 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DRAW_BUFFERS_ARB
, 1 + MAX_DRAW_BUFFERS
);
4792 if (count
> MAX_DRAW_BUFFERS
)
4793 count
= MAX_DRAW_BUFFERS
;
4794 for (i
= 0; i
< count
; i
++) {
4795 n
[2 + i
].e
= buffers
[i
];
4798 if (ctx
->ExecuteFlag
) {
4799 CALL_DrawBuffersARB(ctx
->Exec
, (count
, buffers
));
4803 #if FEATURE_ATI_fragment_shader
4804 static void GLAPIENTRY
4805 save_BindFragmentShaderATI(GLuint id
)
4807 GET_CURRENT_CONTEXT(ctx
);
4810 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BIND_FRAGMENT_SHADER_ATI
, 1);
4814 if (ctx
->ExecuteFlag
) {
4815 CALL_BindFragmentShaderATI(ctx
->Exec
, (id
));
4819 static void GLAPIENTRY
4820 save_SetFragmentShaderConstantATI(GLuint dst
, const GLfloat
*value
)
4822 GET_CURRENT_CONTEXT(ctx
);
4825 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
, 5);
4833 if (ctx
->ExecuteFlag
) {
4834 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, value
));
4840 save_Attr1fNV(GLenum attr
, GLfloat x
)
4842 GET_CURRENT_CONTEXT(ctx
);
4844 SAVE_FLUSH_VERTICES(ctx
);
4845 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_1F_NV
, 2);
4851 ASSERT(attr
< MAX_VERTEX_PROGRAM_ATTRIBS
);
4852 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
4853 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
4855 if (ctx
->ExecuteFlag
) {
4856 CALL_VertexAttrib1fNV(ctx
->Exec
, (attr
, x
));
4861 save_Attr2fNV(GLenum attr
, GLfloat x
, GLfloat y
)
4863 GET_CURRENT_CONTEXT(ctx
);
4865 SAVE_FLUSH_VERTICES(ctx
);
4866 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_2F_NV
, 3);
4873 ASSERT(attr
< MAX_VERTEX_PROGRAM_ATTRIBS
);
4874 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
4875 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
4877 if (ctx
->ExecuteFlag
) {
4878 CALL_VertexAttrib2fNV(ctx
->Exec
, (attr
, x
, y
));
4883 save_Attr3fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
4885 GET_CURRENT_CONTEXT(ctx
);
4887 SAVE_FLUSH_VERTICES(ctx
);
4888 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_3F_NV
, 4);
4896 ASSERT(attr
< MAX_VERTEX_PROGRAM_ATTRIBS
);
4897 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
4898 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
4900 if (ctx
->ExecuteFlag
) {
4901 CALL_VertexAttrib3fNV(ctx
->Exec
, (attr
, x
, y
, z
));
4906 save_Attr4fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4908 GET_CURRENT_CONTEXT(ctx
);
4910 SAVE_FLUSH_VERTICES(ctx
);
4911 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_4F_NV
, 5);
4920 ASSERT(attr
< MAX_VERTEX_PROGRAM_ATTRIBS
);
4921 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
4922 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
4924 if (ctx
->ExecuteFlag
) {
4925 CALL_VertexAttrib4fNV(ctx
->Exec
, (attr
, x
, y
, z
, w
));
4931 save_Attr1fARB(GLenum attr
, GLfloat x
)
4933 GET_CURRENT_CONTEXT(ctx
);
4935 SAVE_FLUSH_VERTICES(ctx
);
4936 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_1F_ARB
, 2);
4942 ASSERT(attr
< MAX_VERTEX_ATTRIBS
);
4943 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
4944 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
4946 if (ctx
->ExecuteFlag
) {
4947 CALL_VertexAttrib1fARB(ctx
->Exec
, (attr
, x
));
4952 save_Attr2fARB(GLenum attr
, GLfloat x
, GLfloat y
)
4954 GET_CURRENT_CONTEXT(ctx
);
4956 SAVE_FLUSH_VERTICES(ctx
);
4957 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_2F_ARB
, 3);
4964 ASSERT(attr
< MAX_VERTEX_ATTRIBS
);
4965 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
4966 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
4968 if (ctx
->ExecuteFlag
) {
4969 CALL_VertexAttrib2fARB(ctx
->Exec
, (attr
, x
, y
));
4974 save_Attr3fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
4976 GET_CURRENT_CONTEXT(ctx
);
4978 SAVE_FLUSH_VERTICES(ctx
);
4979 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_3F_ARB
, 4);
4987 ASSERT(attr
< MAX_VERTEX_ATTRIBS
);
4988 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
4989 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
4991 if (ctx
->ExecuteFlag
) {
4992 CALL_VertexAttrib3fARB(ctx
->Exec
, (attr
, x
, y
, z
));
4997 save_Attr4fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4999 GET_CURRENT_CONTEXT(ctx
);
5001 SAVE_FLUSH_VERTICES(ctx
);
5002 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_4F_ARB
, 5);
5011 ASSERT(attr
< MAX_VERTEX_ATTRIBS
);
5012 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5013 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5015 if (ctx
->ExecuteFlag
) {
5016 CALL_VertexAttrib4fARB(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5021 static void GLAPIENTRY
5022 save_EvalCoord1f(GLfloat x
)
5024 GET_CURRENT_CONTEXT(ctx
);
5026 SAVE_FLUSH_VERTICES(ctx
);
5027 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVAL_C1
, 1);
5031 if (ctx
->ExecuteFlag
) {
5032 CALL_EvalCoord1f(ctx
->Exec
, (x
));
5036 static void GLAPIENTRY
5037 save_EvalCoord1fv(const GLfloat
* v
)
5039 save_EvalCoord1f(v
[0]);
5042 static void GLAPIENTRY
5043 save_EvalCoord2f(GLfloat x
, GLfloat y
)
5045 GET_CURRENT_CONTEXT(ctx
);
5047 SAVE_FLUSH_VERTICES(ctx
);
5048 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVAL_C2
, 2);
5053 if (ctx
->ExecuteFlag
) {
5054 CALL_EvalCoord2f(ctx
->Exec
, (x
, y
));
5058 static void GLAPIENTRY
5059 save_EvalCoord2fv(const GLfloat
* v
)
5061 save_EvalCoord2f(v
[0], v
[1]);
5065 static void GLAPIENTRY
5066 save_EvalPoint1(GLint x
)
5068 GET_CURRENT_CONTEXT(ctx
);
5070 SAVE_FLUSH_VERTICES(ctx
);
5071 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVAL_P1
, 1);
5075 if (ctx
->ExecuteFlag
) {
5076 CALL_EvalPoint1(ctx
->Exec
, (x
));
5080 static void GLAPIENTRY
5081 save_EvalPoint2(GLint x
, GLint y
)
5083 GET_CURRENT_CONTEXT(ctx
);
5085 SAVE_FLUSH_VERTICES(ctx
);
5086 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVAL_P2
, 2);
5091 if (ctx
->ExecuteFlag
) {
5092 CALL_EvalPoint2(ctx
->Exec
, (x
, y
));
5096 static void GLAPIENTRY
5097 save_Indexf(GLfloat x
)
5099 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, x
);
5102 static void GLAPIENTRY
5103 save_Indexfv(const GLfloat
* v
)
5105 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, v
[0]);
5108 static void GLAPIENTRY
5109 save_EdgeFlag(GLboolean x
)
5111 save_Attr1fNV(VERT_ATTRIB_EDGEFLAG
, x
? (GLfloat
)1.0 : (GLfloat
)0.0);
5114 static void GLAPIENTRY
5115 save_Materialfv(GLenum face
, GLenum pname
, const GLfloat
* param
)
5117 GET_CURRENT_CONTEXT(ctx
);
5121 SAVE_FLUSH_VERTICES(ctx
);
5126 case GL_FRONT_AND_BACK
:
5129 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "material(face)");
5138 case GL_AMBIENT_AND_DIFFUSE
:
5144 case GL_COLOR_INDEXES
:
5148 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "material(pname)");
5152 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MATERIAL
, 6);
5156 for (i
= 0; i
< args
; i
++)
5157 n
[3 + i
].f
= param
[i
];
5161 GLuint bitmask
= _mesa_material_bitmask(ctx
, face
, pname
, ~0, NULL
);
5162 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++)
5163 if (bitmask
& (1 << i
)) {
5164 ctx
->ListState
.ActiveMaterialSize
[i
] = args
;
5165 COPY_SZ_4V(ctx
->ListState
.CurrentMaterial
[i
], args
, param
);
5169 if (ctx
->ExecuteFlag
) {
5170 CALL_Materialfv(ctx
->Exec
, (face
, pname
, param
));
5174 static void GLAPIENTRY
5175 save_Begin(GLenum mode
)
5177 GET_CURRENT_CONTEXT(ctx
);
5179 GLboolean error
= GL_FALSE
;
5181 if ( /*mode < GL_POINTS || */ mode
> GL_POLYGON
) {
5182 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "Begin (mode)");
5185 else if (ctx
->Driver
.CurrentSavePrimitive
== PRIM_UNKNOWN
) {
5186 /* Typically the first begin. This may raise an error on
5187 * playback, depending on whether CallList is issued from inside
5188 * a begin/end or not.
5190 ctx
->Driver
.CurrentSavePrimitive
= PRIM_INSIDE_UNKNOWN_PRIM
;
5192 else if (ctx
->Driver
.CurrentSavePrimitive
== PRIM_OUTSIDE_BEGIN_END
) {
5193 ctx
->Driver
.CurrentSavePrimitive
= mode
;
5196 _mesa_compile_error(ctx
, GL_INVALID_OPERATION
, "recursive begin");
5201 /* Give the driver an opportunity to hook in an optimized
5202 * display list compiler.
5204 if (ctx
->Driver
.NotifySaveBegin(ctx
, mode
))
5207 SAVE_FLUSH_VERTICES(ctx
);
5208 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BEGIN
, 1);
5214 if (ctx
->ExecuteFlag
) {
5215 CALL_Begin(ctx
->Exec
, (mode
));
5219 static void GLAPIENTRY
5222 GET_CURRENT_CONTEXT(ctx
);
5223 SAVE_FLUSH_VERTICES(ctx
);
5224 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_END
, 0);
5225 ctx
->Driver
.CurrentSavePrimitive
= PRIM_OUTSIDE_BEGIN_END
;
5226 if (ctx
->ExecuteFlag
) {
5227 CALL_End(ctx
->Exec
, ());
5231 static void GLAPIENTRY
5232 save_Rectf(GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
5234 GET_CURRENT_CONTEXT(ctx
);
5236 SAVE_FLUSH_VERTICES(ctx
);
5237 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_RECTF
, 4);
5244 if (ctx
->ExecuteFlag
) {
5245 CALL_Rectf(ctx
->Exec
, (a
, b
, c
, d
));
5250 static void GLAPIENTRY
5251 save_Vertex2f(GLfloat x
, GLfloat y
)
5253 save_Attr2fNV(VERT_ATTRIB_POS
, x
, y
);
5256 static void GLAPIENTRY
5257 save_Vertex2fv(const GLfloat
* v
)
5259 save_Attr2fNV(VERT_ATTRIB_POS
, v
[0], v
[1]);
5262 static void GLAPIENTRY
5263 save_Vertex3f(GLfloat x
, GLfloat y
, GLfloat z
)
5265 save_Attr3fNV(VERT_ATTRIB_POS
, x
, y
, z
);
5268 static void GLAPIENTRY
5269 save_Vertex3fv(const GLfloat
* v
)
5271 save_Attr3fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2]);
5274 static void GLAPIENTRY
5275 save_Vertex4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5277 save_Attr4fNV(VERT_ATTRIB_POS
, x
, y
, z
, w
);
5280 static void GLAPIENTRY
5281 save_Vertex4fv(const GLfloat
* v
)
5283 save_Attr4fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2], v
[3]);
5286 static void GLAPIENTRY
5287 save_TexCoord1f(GLfloat x
)
5289 save_Attr1fNV(VERT_ATTRIB_TEX0
, x
);
5292 static void GLAPIENTRY
5293 save_TexCoord1fv(const GLfloat
* v
)
5295 save_Attr1fNV(VERT_ATTRIB_TEX0
, v
[0]);
5298 static void GLAPIENTRY
5299 save_TexCoord2f(GLfloat x
, GLfloat y
)
5301 save_Attr2fNV(VERT_ATTRIB_TEX0
, x
, y
);
5304 static void GLAPIENTRY
5305 save_TexCoord2fv(const GLfloat
* v
)
5307 save_Attr2fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1]);
5310 static void GLAPIENTRY
5311 save_TexCoord3f(GLfloat x
, GLfloat y
, GLfloat z
)
5313 save_Attr3fNV(VERT_ATTRIB_TEX0
, x
, y
, z
);
5316 static void GLAPIENTRY
5317 save_TexCoord3fv(const GLfloat
* v
)
5319 save_Attr3fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2]);
5322 static void GLAPIENTRY
5323 save_TexCoord4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5325 save_Attr4fNV(VERT_ATTRIB_TEX0
, x
, y
, z
, w
);
5328 static void GLAPIENTRY
5329 save_TexCoord4fv(const GLfloat
* v
)
5331 save_Attr4fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2], v
[3]);
5334 static void GLAPIENTRY
5335 save_Normal3f(GLfloat x
, GLfloat y
, GLfloat z
)
5337 save_Attr3fNV(VERT_ATTRIB_NORMAL
, x
, y
, z
);
5340 static void GLAPIENTRY
5341 save_Normal3fv(const GLfloat
* v
)
5343 save_Attr3fNV(VERT_ATTRIB_NORMAL
, v
[0], v
[1], v
[2]);
5346 static void GLAPIENTRY
5347 save_FogCoordfEXT(GLfloat x
)
5349 save_Attr1fNV(VERT_ATTRIB_FOG
, x
);
5352 static void GLAPIENTRY
5353 save_FogCoordfvEXT(const GLfloat
* v
)
5355 save_Attr1fNV(VERT_ATTRIB_FOG
, v
[0]);
5358 static void GLAPIENTRY
5359 save_Color3f(GLfloat x
, GLfloat y
, GLfloat z
)
5361 save_Attr3fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
);
5364 static void GLAPIENTRY
5365 save_Color3fv(const GLfloat
* v
)
5367 save_Attr3fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2]);
5370 static void GLAPIENTRY
5371 save_Color4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5373 save_Attr4fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
, w
);
5376 static void GLAPIENTRY
5377 save_Color4fv(const GLfloat
* v
)
5379 save_Attr4fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2], v
[3]);
5382 static void GLAPIENTRY
5383 save_SecondaryColor3fEXT(GLfloat x
, GLfloat y
, GLfloat z
)
5385 save_Attr3fNV(VERT_ATTRIB_COLOR1
, x
, y
, z
);
5388 static void GLAPIENTRY
5389 save_SecondaryColor3fvEXT(const GLfloat
* v
)
5391 save_Attr3fNV(VERT_ATTRIB_COLOR1
, v
[0], v
[1], v
[2]);
5395 /* Just call the respective ATTR for texcoord
5397 static void GLAPIENTRY
5398 save_MultiTexCoord1f(GLenum target
, GLfloat x
)
5400 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5401 save_Attr1fNV(attr
, x
);
5404 static void GLAPIENTRY
5405 save_MultiTexCoord1fv(GLenum target
, const GLfloat
* v
)
5407 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5408 save_Attr1fNV(attr
, v
[0]);
5411 static void GLAPIENTRY
5412 save_MultiTexCoord2f(GLenum target
, GLfloat x
, GLfloat y
)
5414 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5415 save_Attr2fNV(attr
, x
, y
);
5418 static void GLAPIENTRY
5419 save_MultiTexCoord2fv(GLenum target
, const GLfloat
* v
)
5421 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5422 save_Attr2fNV(attr
, v
[0], v
[1]);
5425 static void GLAPIENTRY
5426 save_MultiTexCoord3f(GLenum target
, GLfloat x
, GLfloat y
, GLfloat z
)
5428 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5429 save_Attr3fNV(attr
, x
, y
, z
);
5432 static void GLAPIENTRY
5433 save_MultiTexCoord3fv(GLenum target
, const GLfloat
* v
)
5435 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5436 save_Attr3fNV(attr
, v
[0], v
[1], v
[2]);
5439 static void GLAPIENTRY
5440 save_MultiTexCoord4f(GLenum target
, GLfloat x
, GLfloat y
,
5441 GLfloat z
, GLfloat w
)
5443 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5444 save_Attr4fNV(attr
, x
, y
, z
, w
);
5447 static void GLAPIENTRY
5448 save_MultiTexCoord4fv(GLenum target
, const GLfloat
* v
)
5450 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5451 save_Attr4fNV(attr
, v
[0], v
[1], v
[2], v
[3]);
5456 * Record a GL_INVALID_VALUE error when a invalid vertex attribute
5462 GET_CURRENT_CONTEXT(ctx
);
5463 _mesa_error(ctx
, GL_INVALID_VALUE
, "VertexAttribf(index)");
5467 /* First level for NV_vertex_program:
5469 * Check for errors at compile time?.
5471 static void GLAPIENTRY
5472 save_VertexAttrib1fNV(GLuint index
, GLfloat x
)
5474 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5475 save_Attr1fNV(index
, x
);
5480 static void GLAPIENTRY
5481 save_VertexAttrib1fvNV(GLuint index
, const GLfloat
* v
)
5483 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5484 save_Attr1fNV(index
, v
[0]);
5489 static void GLAPIENTRY
5490 save_VertexAttrib2fNV(GLuint index
, GLfloat x
, GLfloat y
)
5492 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5493 save_Attr2fNV(index
, x
, y
);
5498 static void GLAPIENTRY
5499 save_VertexAttrib2fvNV(GLuint index
, const GLfloat
* v
)
5501 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5502 save_Attr2fNV(index
, v
[0], v
[1]);
5507 static void GLAPIENTRY
5508 save_VertexAttrib3fNV(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
5510 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5511 save_Attr3fNV(index
, x
, y
, z
);
5516 static void GLAPIENTRY
5517 save_VertexAttrib3fvNV(GLuint index
, const GLfloat
* v
)
5519 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5520 save_Attr3fNV(index
, v
[0], v
[1], v
[2]);
5525 static void GLAPIENTRY
5526 save_VertexAttrib4fNV(GLuint index
, GLfloat x
, GLfloat y
,
5527 GLfloat z
, GLfloat w
)
5529 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5530 save_Attr4fNV(index
, x
, y
, z
, w
);
5535 static void GLAPIENTRY
5536 save_VertexAttrib4fvNV(GLuint index
, const GLfloat
* v
)
5538 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5539 save_Attr4fNV(index
, v
[0], v
[1], v
[2], v
[3]);
5547 static void GLAPIENTRY
5548 save_VertexAttrib1fARB(GLuint index
, GLfloat x
)
5550 if (index
< MAX_VERTEX_ATTRIBS
)
5551 save_Attr1fARB(index
, x
);
5556 static void GLAPIENTRY
5557 save_VertexAttrib1fvARB(GLuint index
, const GLfloat
* v
)
5559 if (index
< MAX_VERTEX_ATTRIBS
)
5560 save_Attr1fARB(index
, v
[0]);
5565 static void GLAPIENTRY
5566 save_VertexAttrib2fARB(GLuint index
, GLfloat x
, GLfloat y
)
5568 if (index
< MAX_VERTEX_ATTRIBS
)
5569 save_Attr2fARB(index
, x
, y
);
5574 static void GLAPIENTRY
5575 save_VertexAttrib2fvARB(GLuint index
, const GLfloat
* v
)
5577 if (index
< MAX_VERTEX_ATTRIBS
)
5578 save_Attr2fARB(index
, v
[0], v
[1]);
5583 static void GLAPIENTRY
5584 save_VertexAttrib3fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
5586 if (index
< MAX_VERTEX_ATTRIBS
)
5587 save_Attr3fARB(index
, x
, y
, z
);
5592 static void GLAPIENTRY
5593 save_VertexAttrib3fvARB(GLuint index
, const GLfloat
* v
)
5595 if (index
< MAX_VERTEX_ATTRIBS
)
5596 save_Attr3fARB(index
, v
[0], v
[1], v
[2]);
5601 static void GLAPIENTRY
5602 save_VertexAttrib4fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
,
5605 if (index
< MAX_VERTEX_ATTRIBS
)
5606 save_Attr4fARB(index
, x
, y
, z
, w
);
5611 static void GLAPIENTRY
5612 save_VertexAttrib4fvARB(GLuint index
, const GLfloat
* v
)
5614 if (index
< MAX_VERTEX_ATTRIBS
)
5615 save_Attr4fARB(index
, v
[0], v
[1], v
[2], v
[3]);
5621 /* GL_ARB_shader_objects, GL_ARB_vertex/fragment_shader */
5623 static void GLAPIENTRY
5624 exec_BindAttribLocationARB(GLuint program
, GLuint index
, const GLchar
*name
)
5626 GET_CURRENT_CONTEXT(ctx
);
5627 FLUSH_VERTICES(ctx
, 0);
5628 CALL_BindAttribLocationARB(ctx
->Exec
, (program
, index
, name
));
5631 static GLint GLAPIENTRY
5632 exec_GetAttribLocationARB(GLuint program
, const GLchar
*name
)
5634 GET_CURRENT_CONTEXT(ctx
);
5635 FLUSH_VERTICES(ctx
, 0);
5636 return CALL_GetAttribLocationARB(ctx
->Exec
, (program
, name
));
5638 /* XXX more shader functions needed here */
5642 #if FEATURE_EXT_framebuffer_blit
5643 static void GLAPIENTRY
5644 save_BlitFramebufferEXT(GLint srcX0
, GLint srcY0
, GLint srcX1
, GLint srcY1
,
5645 GLint dstX0
, GLint dstY0
, GLint dstX1
, GLint dstY1
,
5646 GLbitfield mask
, GLenum filter
)
5648 GET_CURRENT_CONTEXT(ctx
);
5650 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5651 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BLIT_FRAMEBUFFER
, 10);
5664 if (ctx
->ExecuteFlag
) {
5665 CALL_BlitFramebufferEXT(ctx
->Exec
, (srcX0
, srcY0
, srcX1
, srcY1
,
5666 dstX0
, dstY0
, dstX1
, dstY1
,
5674 * Save an error-generating command into display list.
5676 * KW: Will appear in the list before the vertex buffer containing the
5677 * command that provoked the error. I don't see this as a problem.
5680 save_error(GLcontext
*ctx
, GLenum error
, const char *s
)
5683 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ERROR
, 2);
5686 n
[2].data
= (void *) s
;
5692 * Compile an error into current display list.
5695 _mesa_compile_error(GLcontext
*ctx
, GLenum error
, const char *s
)
5697 if (ctx
->CompileFlag
)
5698 save_error(ctx
, error
, s
);
5699 if (ctx
->ExecuteFlag
)
5700 _mesa_error(ctx
, error
, s
);
5705 * Test if ID names a display list.
5708 islist(GLcontext
*ctx
, GLuint list
)
5710 if (list
> 0 && lookup_list(ctx
, list
)) {
5720 /**********************************************************************/
5721 /* Display list execution */
5722 /**********************************************************************/
5726 * Execute a display list. Note that the ListBase offset must have already
5727 * been added before calling this function. I.e. the list argument is
5728 * the absolute list number, not relative to ListBase.
5729 * \param list - display list number
5732 execute_list(GLcontext
*ctx
, GLuint list
)
5734 struct mesa_display_list
*dlist
;
5738 if (list
== 0 || !islist(ctx
, list
))
5741 if (ctx
->ListState
.CallDepth
== MAX_LIST_NESTING
) {
5742 /* raise an error? */
5746 dlist
= lookup_list(ctx
, list
);
5750 ctx
->ListState
.CallDepth
++;
5752 if (ctx
->Driver
.BeginCallList
)
5753 ctx
->Driver
.BeginCallList(ctx
, dlist
);
5759 OpCode opcode
= n
[0].opcode
;
5760 int i
= (int) n
[0].opcode
- (int) OPCODE_EXT_0
;
5762 if (i
>= 0 && i
< (GLint
) ctx
->ListExt
.NumOpcodes
) {
5763 /* this is a driver-extended opcode */
5764 ctx
->ListExt
.Opcode
[i
].Execute(ctx
, &n
[1]);
5765 n
+= ctx
->ListExt
.Opcode
[i
].Size
;
5770 _mesa_error(ctx
, n
[1].e
, (const char *) n
[2].data
);
5773 CALL_Accum(ctx
->Exec
, (n
[1].e
, n
[2].f
));
5775 case OPCODE_ALPHA_FUNC
:
5776 CALL_AlphaFunc(ctx
->Exec
, (n
[1].e
, n
[2].f
));
5778 case OPCODE_BIND_TEXTURE
:
5779 CALL_BindTexture(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
5783 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5784 ctx
->Unpack
= ctx
->DefaultPacking
;
5785 CALL_Bitmap(ctx
->Exec
, ((GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
5786 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
5787 (const GLubyte
*) n
[7].data
));
5788 ctx
->Unpack
= save
; /* restore */
5791 case OPCODE_BLEND_COLOR
:
5792 CALL_BlendColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
5794 case OPCODE_BLEND_EQUATION
:
5795 CALL_BlendEquation(ctx
->Exec
, (n
[1].e
));
5797 case OPCODE_BLEND_EQUATION_SEPARATE
:
5798 CALL_BlendEquationSeparateEXT(ctx
->Exec
, (n
[1].e
, n
[2].e
));
5800 case OPCODE_BLEND_FUNC_SEPARATE
:
5801 CALL_BlendFuncSeparateEXT(ctx
->Exec
,
5802 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
5804 case OPCODE_CALL_LIST
:
5805 /* Generated by glCallList(), don't add ListBase */
5806 if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
5807 execute_list(ctx
, n
[1].ui
);
5810 case OPCODE_CALL_LIST_OFFSET
:
5811 /* Generated by glCallLists() so we must add ListBase */
5813 /* user specified a bad data type at compile time */
5814 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
5816 else if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
5817 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ n
[1].i
);
5818 execute_list(ctx
, list
);
5822 CALL_Clear(ctx
->Exec
, (n
[1].bf
));
5824 case OPCODE_CLEAR_COLOR
:
5825 CALL_ClearColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
5827 case OPCODE_CLEAR_ACCUM
:
5828 CALL_ClearAccum(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
5830 case OPCODE_CLEAR_DEPTH
:
5831 CALL_ClearDepth(ctx
->Exec
, ((GLclampd
) n
[1].f
));
5833 case OPCODE_CLEAR_INDEX
:
5834 CALL_ClearIndex(ctx
->Exec
, ((GLfloat
) n
[1].ui
));
5836 case OPCODE_CLEAR_STENCIL
:
5837 CALL_ClearStencil(ctx
->Exec
, (n
[1].i
));
5839 case OPCODE_CLIP_PLANE
:
5846 CALL_ClipPlane(ctx
->Exec
, (n
[1].e
, eq
));
5849 case OPCODE_COLOR_MASK
:
5850 CALL_ColorMask(ctx
->Exec
, (n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
));
5852 case OPCODE_COLOR_MATERIAL
:
5853 CALL_ColorMaterial(ctx
->Exec
, (n
[1].e
, n
[2].e
));
5855 case OPCODE_COLOR_TABLE
:
5857 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5858 ctx
->Unpack
= ctx
->DefaultPacking
;
5859 CALL_ColorTable(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].e
,
5860 n
[5].e
, n
[6].data
));
5861 ctx
->Unpack
= save
; /* restore */
5864 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
5871 CALL_ColorTableParameterfv(ctx
->Exec
,
5872 (n
[1].e
, n
[2].e
, params
));
5875 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
5882 CALL_ColorTableParameteriv(ctx
->Exec
,
5883 (n
[1].e
, n
[2].e
, params
));
5886 case OPCODE_COLOR_SUB_TABLE
:
5888 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5889 ctx
->Unpack
= ctx
->DefaultPacking
;
5890 CALL_ColorSubTable(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5891 n
[4].e
, n
[5].e
, n
[6].data
));
5892 ctx
->Unpack
= save
; /* restore */
5895 case OPCODE_CONVOLUTION_FILTER_1D
:
5897 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5898 ctx
->Unpack
= ctx
->DefaultPacking
;
5899 CALL_ConvolutionFilter1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5902 ctx
->Unpack
= save
; /* restore */
5905 case OPCODE_CONVOLUTION_FILTER_2D
:
5907 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5908 ctx
->Unpack
= ctx
->DefaultPacking
;
5909 CALL_ConvolutionFilter2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5910 n
[4].i
, n
[5].e
, n
[6].e
,
5912 ctx
->Unpack
= save
; /* restore */
5915 case OPCODE_CONVOLUTION_PARAMETER_I
:
5916 CALL_ConvolutionParameteri(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].i
));
5918 case OPCODE_CONVOLUTION_PARAMETER_IV
:
5925 CALL_ConvolutionParameteriv(ctx
->Exec
,
5926 (n
[1].e
, n
[2].e
, params
));
5929 case OPCODE_CONVOLUTION_PARAMETER_F
:
5930 CALL_ConvolutionParameterf(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].f
));
5932 case OPCODE_CONVOLUTION_PARAMETER_FV
:
5939 CALL_ConvolutionParameterfv(ctx
->Exec
,
5940 (n
[1].e
, n
[2].e
, params
));
5943 case OPCODE_COPY_COLOR_SUB_TABLE
:
5944 CALL_CopyColorSubTable(ctx
->Exec
, (n
[1].e
, n
[2].i
,
5945 n
[3].i
, n
[4].i
, n
[5].i
));
5947 case OPCODE_COPY_COLOR_TABLE
:
5948 CALL_CopyColorSubTable(ctx
->Exec
, (n
[1].e
, n
[2].i
,
5949 n
[3].i
, n
[4].i
, n
[5].i
));
5951 case OPCODE_COPY_PIXELS
:
5952 CALL_CopyPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
,
5953 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
,
5956 case OPCODE_COPY_TEX_IMAGE1D
:
5957 CALL_CopyTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
5958 n
[5].i
, n
[6].i
, n
[7].i
));
5960 case OPCODE_COPY_TEX_IMAGE2D
:
5961 CALL_CopyTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
5962 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
));
5964 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
5965 CALL_CopyTexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5966 n
[4].i
, n
[5].i
, n
[6].i
));
5968 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
5969 CALL_CopyTexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5970 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
5973 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
5974 CALL_CopyTexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5975 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
5978 case OPCODE_CULL_FACE
:
5979 CALL_CullFace(ctx
->Exec
, (n
[1].e
));
5981 case OPCODE_DEPTH_FUNC
:
5982 CALL_DepthFunc(ctx
->Exec
, (n
[1].e
));
5984 case OPCODE_DEPTH_MASK
:
5985 CALL_DepthMask(ctx
->Exec
, (n
[1].b
));
5987 case OPCODE_DEPTH_RANGE
:
5988 CALL_DepthRange(ctx
->Exec
,
5989 ((GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
));
5991 case OPCODE_DISABLE
:
5992 CALL_Disable(ctx
->Exec
, (n
[1].e
));
5994 case OPCODE_DRAW_BUFFER
:
5995 CALL_DrawBuffer(ctx
->Exec
, (n
[1].e
));
5997 case OPCODE_DRAW_PIXELS
:
5999 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6000 ctx
->Unpack
= ctx
->DefaultPacking
;
6001 CALL_DrawPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
6003 ctx
->Unpack
= save
; /* restore */
6007 CALL_Enable(ctx
->Exec
, (n
[1].e
));
6009 case OPCODE_EVALMESH1
:
6010 CALL_EvalMesh1(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
));
6012 case OPCODE_EVALMESH2
:
6013 CALL_EvalMesh2(ctx
->Exec
,
6014 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
6023 CALL_Fogfv(ctx
->Exec
, (n
[1].e
, p
));
6026 case OPCODE_FRONT_FACE
:
6027 CALL_FrontFace(ctx
->Exec
, (n
[1].e
));
6029 case OPCODE_FRUSTUM
:
6030 CALL_Frustum(ctx
->Exec
,
6031 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
6034 CALL_Hint(ctx
->Exec
, (n
[1].e
, n
[2].e
));
6036 case OPCODE_HISTOGRAM
:
6037 CALL_Histogram(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].b
));
6039 case OPCODE_INDEX_MASK
:
6040 CALL_IndexMask(ctx
->Exec
, (n
[1].ui
));
6042 case OPCODE_INIT_NAMES
:
6043 CALL_InitNames(ctx
->Exec
, ());
6052 CALL_Lightfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, p
));
6055 case OPCODE_LIGHT_MODEL
:
6062 CALL_LightModelfv(ctx
->Exec
, (n
[1].e
, p
));
6065 case OPCODE_LINE_STIPPLE
:
6066 CALL_LineStipple(ctx
->Exec
, (n
[1].i
, n
[2].us
));
6068 case OPCODE_LINE_WIDTH
:
6069 CALL_LineWidth(ctx
->Exec
, (n
[1].f
));
6071 case OPCODE_LIST_BASE
:
6072 CALL_ListBase(ctx
->Exec
, (n
[1].ui
));
6074 case OPCODE_LOAD_IDENTITY
:
6075 CALL_LoadIdentity(ctx
->Exec
, ());
6077 case OPCODE_LOAD_MATRIX
:
6078 if (sizeof(Node
) == sizeof(GLfloat
)) {
6079 CALL_LoadMatrixf(ctx
->Exec
, (&n
[1].f
));
6084 for (i
= 0; i
< 16; i
++) {
6087 CALL_LoadMatrixf(ctx
->Exec
, (m
));
6090 case OPCODE_LOAD_NAME
:
6091 CALL_LoadName(ctx
->Exec
, (n
[1].ui
));
6093 case OPCODE_LOGIC_OP
:
6094 CALL_LogicOp(ctx
->Exec
, (n
[1].e
));
6098 GLenum target
= n
[1].e
;
6099 GLint ustride
= _mesa_evaluator_components(target
);
6100 GLint uorder
= n
[5].i
;
6101 GLfloat u1
= n
[2].f
;
6102 GLfloat u2
= n
[3].f
;
6103 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
6104 (GLfloat
*) n
[6].data
));
6109 GLenum target
= n
[1].e
;
6110 GLfloat u1
= n
[2].f
;
6111 GLfloat u2
= n
[3].f
;
6112 GLfloat v1
= n
[4].f
;
6113 GLfloat v2
= n
[5].f
;
6114 GLint ustride
= n
[6].i
;
6115 GLint vstride
= n
[7].i
;
6116 GLint uorder
= n
[8].i
;
6117 GLint vorder
= n
[9].i
;
6118 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
6119 v1
, v2
, vstride
, vorder
,
6120 (GLfloat
*) n
[10].data
));
6123 case OPCODE_MAPGRID1
:
6124 CALL_MapGrid1f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
6126 case OPCODE_MAPGRID2
:
6127 CALL_MapGrid2f(ctx
->Exec
,
6128 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
));
6130 case OPCODE_MATRIX_MODE
:
6131 CALL_MatrixMode(ctx
->Exec
, (n
[1].e
));
6133 case OPCODE_MIN_MAX
:
6134 CALL_Minmax(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].b
));
6136 case OPCODE_MULT_MATRIX
:
6137 if (sizeof(Node
) == sizeof(GLfloat
)) {
6138 CALL_MultMatrixf(ctx
->Exec
, (&n
[1].f
));
6143 for (i
= 0; i
< 16; i
++) {
6146 CALL_MultMatrixf(ctx
->Exec
, (m
));
6150 CALL_Ortho(ctx
->Exec
,
6151 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
6153 case OPCODE_PASSTHROUGH
:
6154 CALL_PassThrough(ctx
->Exec
, (n
[1].f
));
6156 case OPCODE_PIXEL_MAP
:
6157 CALL_PixelMapfv(ctx
->Exec
,
6158 (n
[1].e
, n
[2].i
, (GLfloat
*) n
[3].data
));
6160 case OPCODE_PIXEL_TRANSFER
:
6161 CALL_PixelTransferf(ctx
->Exec
, (n
[1].e
, n
[2].f
));
6163 case OPCODE_PIXEL_ZOOM
:
6164 CALL_PixelZoom(ctx
->Exec
, (n
[1].f
, n
[2].f
));
6166 case OPCODE_POINT_SIZE
:
6167 CALL_PointSize(ctx
->Exec
, (n
[1].f
));
6169 case OPCODE_POINT_PARAMETERS
:
6175 CALL_PointParameterfvEXT(ctx
->Exec
, (n
[1].e
, params
));
6178 case OPCODE_POLYGON_MODE
:
6179 CALL_PolygonMode(ctx
->Exec
, (n
[1].e
, n
[2].e
));
6181 case OPCODE_POLYGON_STIPPLE
:
6183 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6184 ctx
->Unpack
= ctx
->DefaultPacking
;
6185 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) n
[1].data
));
6186 ctx
->Unpack
= save
; /* restore */
6189 case OPCODE_POLYGON_OFFSET
:
6190 CALL_PolygonOffset(ctx
->Exec
, (n
[1].f
, n
[2].f
));
6192 case OPCODE_POP_ATTRIB
:
6193 CALL_PopAttrib(ctx
->Exec
, ());
6195 case OPCODE_POP_MATRIX
:
6196 CALL_PopMatrix(ctx
->Exec
, ());
6198 case OPCODE_POP_NAME
:
6199 CALL_PopName(ctx
->Exec
, ());
6201 case OPCODE_PRIORITIZE_TEXTURE
:
6202 CALL_PrioritizeTextures(ctx
->Exec
, (1, &n
[1].ui
, &n
[2].f
));
6204 case OPCODE_PUSH_ATTRIB
:
6205 CALL_PushAttrib(ctx
->Exec
, (n
[1].bf
));
6207 case OPCODE_PUSH_MATRIX
:
6208 CALL_PushMatrix(ctx
->Exec
, ());
6210 case OPCODE_PUSH_NAME
:
6211 CALL_PushName(ctx
->Exec
, (n
[1].ui
));
6213 case OPCODE_RASTER_POS
:
6214 CALL_RasterPos4f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
6216 case OPCODE_READ_BUFFER
:
6217 CALL_ReadBuffer(ctx
->Exec
, (n
[1].e
));
6219 case OPCODE_RESET_HISTOGRAM
:
6220 CALL_ResetHistogram(ctx
->Exec
, (n
[1].e
));
6222 case OPCODE_RESET_MIN_MAX
:
6223 CALL_ResetMinmax(ctx
->Exec
, (n
[1].e
));
6226 CALL_Rotatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
6229 CALL_Scalef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
6231 case OPCODE_SCISSOR
:
6232 CALL_Scissor(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
6234 case OPCODE_SHADE_MODEL
:
6235 CALL_ShadeModel(ctx
->Exec
, (n
[1].e
));
6237 case OPCODE_STENCIL_FUNC
:
6238 CALL_StencilFunc(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].ui
));
6240 case OPCODE_STENCIL_MASK
:
6241 CALL_StencilMask(ctx
->Exec
, (n
[1].ui
));
6243 case OPCODE_STENCIL_OP
:
6244 CALL_StencilOp(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].e
));
6246 case OPCODE_STENCIL_FUNC_SEPARATE
:
6247 CALL_StencilFuncSeparate(ctx
->Exec
,
6248 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].ui
));
6250 case OPCODE_STENCIL_MASK_SEPARATE
:
6251 CALL_StencilMaskSeparate(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
6253 case OPCODE_STENCIL_OP_SEPARATE
:
6254 CALL_StencilOpSeparate(ctx
->Exec
,
6255 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
6264 CALL_TexEnvfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
6274 CALL_TexGenfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
6277 case OPCODE_TEXPARAMETER
:
6284 CALL_TexParameterfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
6287 case OPCODE_TEX_IMAGE1D
:
6289 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6290 ctx
->Unpack
= ctx
->DefaultPacking
;
6291 CALL_TexImage1D(ctx
->Exec
, (n
[1].e
, /* target */
6293 n
[3].i
, /* components */
6295 n
[5].e
, /* border */
6296 n
[6].e
, /* format */
6299 ctx
->Unpack
= save
; /* restore */
6302 case OPCODE_TEX_IMAGE2D
:
6304 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6305 ctx
->Unpack
= ctx
->DefaultPacking
;
6306 CALL_TexImage2D(ctx
->Exec
, (n
[1].e
, /* target */
6308 n
[3].i
, /* components */
6310 n
[5].i
, /* height */
6311 n
[6].e
, /* border */
6312 n
[7].e
, /* format */
6315 ctx
->Unpack
= save
; /* restore */
6318 case OPCODE_TEX_IMAGE3D
:
6320 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6321 ctx
->Unpack
= ctx
->DefaultPacking
;
6322 CALL_TexImage3D(ctx
->Exec
, (n
[1].e
, /* target */
6324 n
[3].i
, /* components */
6326 n
[5].i
, /* height */
6328 n
[7].e
, /* border */
6329 n
[8].e
, /* format */
6332 ctx
->Unpack
= save
; /* restore */
6335 case OPCODE_TEX_SUB_IMAGE1D
:
6337 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6338 ctx
->Unpack
= ctx
->DefaultPacking
;
6339 CALL_TexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
6341 n
[6].e
, n
[7].data
));
6342 ctx
->Unpack
= save
; /* restore */
6345 case OPCODE_TEX_SUB_IMAGE2D
:
6347 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6348 ctx
->Unpack
= ctx
->DefaultPacking
;
6349 CALL_TexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
6351 n
[6].i
, n
[7].e
, n
[8].e
,
6353 ctx
->Unpack
= save
; /* restore */
6356 case OPCODE_TEX_SUB_IMAGE3D
:
6358 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6359 ctx
->Unpack
= ctx
->DefaultPacking
;
6360 CALL_TexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
6361 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
6362 n
[8].i
, n
[9].e
, n
[10].e
,
6364 ctx
->Unpack
= save
; /* restore */
6367 case OPCODE_TRANSLATE
:
6368 CALL_Translatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
6370 case OPCODE_VIEWPORT
:
6371 CALL_Viewport(ctx
->Exec
, (n
[1].i
, n
[2].i
,
6372 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
));
6374 case OPCODE_WINDOW_POS
:
6375 CALL_WindowPos4fMESA(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
6377 case OPCODE_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
6378 CALL_ActiveTextureARB(ctx
->Exec
, (n
[1].e
));
6380 case OPCODE_COMPRESSED_TEX_IMAGE_1D
: /* GL_ARB_texture_compression */
6381 CALL_CompressedTexImage1DARB(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
6382 n
[4].i
, n
[5].i
, n
[6].i
,
6385 case OPCODE_COMPRESSED_TEX_IMAGE_2D
: /* GL_ARB_texture_compression */
6386 CALL_CompressedTexImage2DARB(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
6387 n
[4].i
, n
[5].i
, n
[6].i
,
6388 n
[7].i
, n
[8].data
));
6390 case OPCODE_COMPRESSED_TEX_IMAGE_3D
: /* GL_ARB_texture_compression */
6391 CALL_CompressedTexImage3DARB(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
6392 n
[4].i
, n
[5].i
, n
[6].i
,
6396 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
: /* GL_ARB_texture_compress */
6397 CALL_CompressedTexSubImage1DARB(ctx
->Exec
,
6398 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
6399 n
[5].e
, n
[6].i
, n
[7].data
));
6401 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
: /* GL_ARB_texture_compress */
6402 CALL_CompressedTexSubImage2DARB(ctx
->Exec
,
6403 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
6404 n
[5].i
, n
[6].i
, n
[7].e
, n
[8].i
,
6407 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
: /* GL_ARB_texture_compress */
6408 CALL_CompressedTexSubImage3DARB(ctx
->Exec
,
6409 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
6410 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
6411 n
[9].e
, n
[10].i
, n
[11].data
));
6413 case OPCODE_SAMPLE_COVERAGE
: /* GL_ARB_multisample */
6414 CALL_SampleCoverageARB(ctx
->Exec
, (n
[1].f
, n
[2].b
));
6416 case OPCODE_WINDOW_POS_ARB
: /* GL_ARB_window_pos */
6417 CALL_WindowPos3fMESA(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
6419 #if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
6420 case OPCODE_BIND_PROGRAM_NV
: /* GL_NV_vertex_program */
6421 CALL_BindProgramNV(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
6424 #if FEATURE_NV_vertex_program
6425 case OPCODE_EXECUTE_PROGRAM_NV
:
6432 CALL_ExecuteProgramNV(ctx
->Exec
, (n
[1].e
, n
[2].ui
, v
));
6435 case OPCODE_REQUEST_RESIDENT_PROGRAMS_NV
:
6436 CALL_RequestResidentProgramsNV(ctx
->Exec
, (n
[1].ui
,
6437 (GLuint
*) n
[2].data
));
6439 case OPCODE_LOAD_PROGRAM_NV
:
6440 CALL_LoadProgramNV(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].i
,
6441 (const GLubyte
*) n
[4].data
));
6443 case OPCODE_TRACK_MATRIX_NV
:
6444 CALL_TrackMatrixNV(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].e
, n
[4].e
));
6448 #if FEATURE_NV_fragment_program
6449 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
:
6450 CALL_ProgramLocalParameter4fARB(ctx
->Exec
,
6451 (n
[1].e
, n
[2].ui
, n
[3].f
, n
[4].f
,
6454 case OPCODE_PROGRAM_NAMED_PARAMETER_NV
:
6455 CALL_ProgramNamedParameter4fNV(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
6456 (const GLubyte
*) n
[3].
6457 data
, n
[4].f
, n
[5].f
,
6462 case OPCODE_ACTIVE_STENCIL_FACE_EXT
:
6463 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (n
[1].e
));
6465 case OPCODE_DEPTH_BOUNDS_EXT
:
6466 CALL_DepthBoundsEXT(ctx
->Exec
, (n
[1].f
, n
[2].f
));
6468 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
6469 case OPCODE_PROGRAM_STRING_ARB
:
6470 CALL_ProgramStringARB(ctx
->Exec
,
6471 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].data
));
6474 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program || FEATURE_NV_vertex_program
6475 case OPCODE_PROGRAM_ENV_PARAMETER_ARB
:
6476 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].f
,
6481 #if FEATURE_ARB_occlusion_query
6482 case OPCODE_BEGIN_QUERY_ARB
:
6483 CALL_BeginQueryARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
6485 case OPCODE_END_QUERY_ARB
:
6486 CALL_EndQueryARB(ctx
->Exec
, (n
[1].e
));
6489 case OPCODE_DRAW_BUFFERS_ARB
:
6491 GLenum buffers
[MAX_DRAW_BUFFERS
];
6492 GLint i
, count
= MIN2(n
[1].i
, MAX_DRAW_BUFFERS
);
6493 for (i
= 0; i
< count
; i
++)
6494 buffers
[i
] = n
[2 + i
].e
;
6495 CALL_DrawBuffersARB(ctx
->Exec
, (n
[1].i
, buffers
));
6498 #if FEATURE_EXT_framebuffer_blit
6499 case OPCODE_BLIT_FRAMEBUFFER
:
6500 CALL_BlitFramebufferEXT(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
,
6501 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
6505 #if FEATURE_ATI_fragment_shader
6506 case OPCODE_BIND_FRAGMENT_SHADER_ATI
:
6507 CALL_BindFragmentShaderATI(ctx
->Exec
, (n
[1].i
));
6509 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
:
6512 GLuint i
, dst
= n
[1].ui
;
6514 for (i
= 0; i
< 4; i
++)
6515 values
[i
] = n
[1 + i
].f
;
6516 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, values
));
6520 case OPCODE_ATTR_1F_NV
:
6521 CALL_VertexAttrib1fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
));
6523 case OPCODE_ATTR_2F_NV
:
6524 /* Really shouldn't have to do this - the Node structure
6525 * is convenient, but it would be better to store the data
6526 * packed appropriately so that it can be sent directly
6527 * on. With x86_64 becoming common, this will start to
6530 if (sizeof(Node
) == sizeof(GLfloat
))
6531 CALL_VertexAttrib2fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6533 CALL_VertexAttrib2fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
));
6535 case OPCODE_ATTR_3F_NV
:
6536 if (sizeof(Node
) == sizeof(GLfloat
))
6537 CALL_VertexAttrib3fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6539 CALL_VertexAttrib3fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
6542 case OPCODE_ATTR_4F_NV
:
6543 if (sizeof(Node
) == sizeof(GLfloat
))
6544 CALL_VertexAttrib4fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6546 CALL_VertexAttrib4fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
6549 case OPCODE_ATTR_1F_ARB
:
6550 CALL_VertexAttrib1fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
));
6552 case OPCODE_ATTR_2F_ARB
:
6553 /* Really shouldn't have to do this - the Node structure
6554 * is convenient, but it would be better to store the data
6555 * packed appropriately so that it can be sent directly
6556 * on. With x86_64 becoming common, this will start to
6559 if (sizeof(Node
) == sizeof(GLfloat
))
6560 CALL_VertexAttrib2fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6562 CALL_VertexAttrib2fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
));
6564 case OPCODE_ATTR_3F_ARB
:
6565 if (sizeof(Node
) == sizeof(GLfloat
))
6566 CALL_VertexAttrib3fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6568 CALL_VertexAttrib3fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
6571 case OPCODE_ATTR_4F_ARB
:
6572 if (sizeof(Node
) == sizeof(GLfloat
))
6573 CALL_VertexAttrib4fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6575 CALL_VertexAttrib4fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
6578 case OPCODE_MATERIAL
:
6579 if (sizeof(Node
) == sizeof(GLfloat
))
6580 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, &n
[3].f
));
6587 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, f
));
6591 CALL_Begin(ctx
->Exec
, (n
[1].e
));
6594 CALL_End(ctx
->Exec
, ());
6597 CALL_Rectf(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
6599 case OPCODE_EVAL_C1
:
6600 CALL_EvalCoord1f(ctx
->Exec
, (n
[1].f
));
6602 case OPCODE_EVAL_C2
:
6603 CALL_EvalCoord2f(ctx
->Exec
, (n
[1].f
, n
[2].f
));
6605 case OPCODE_EVAL_P1
:
6606 CALL_EvalPoint1(ctx
->Exec
, (n
[1].i
));
6608 case OPCODE_EVAL_P2
:
6609 CALL_EvalPoint2(ctx
->Exec
, (n
[1].i
, n
[2].i
));
6612 case OPCODE_CONTINUE
:
6613 n
= (Node
*) n
[1].next
;
6615 case OPCODE_END_OF_LIST
:
6621 _mesa_sprintf(msg
, "Error in execute_list: opcode=%d",
6623 _mesa_problem(ctx
, msg
);
6628 /* increment n to point to next compiled command */
6629 if (opcode
!= OPCODE_CONTINUE
) {
6630 n
+= InstSize
[opcode
];
6635 if (ctx
->Driver
.EndCallList
)
6636 ctx
->Driver
.EndCallList(ctx
);
6638 ctx
->ListState
.CallDepth
--;
6643 /**********************************************************************/
6645 /**********************************************************************/
6648 * Test if a display list number is valid.
6650 GLboolean GLAPIENTRY
6651 _mesa_IsList(GLuint list
)
6653 GET_CURRENT_CONTEXT(ctx
);
6654 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
6655 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
6656 return islist(ctx
, list
);
6661 * Delete a sequence of consecutive display lists.
6664 _mesa_DeleteLists(GLuint list
, GLsizei range
)
6666 GET_CURRENT_CONTEXT(ctx
);
6668 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
6669 ASSERT_OUTSIDE_BEGIN_END(ctx
);
6672 _mesa_error(ctx
, GL_INVALID_VALUE
, "glDeleteLists");
6675 for (i
= list
; i
< list
+ range
; i
++) {
6676 destroy_list(ctx
, i
);
6682 * Return a display list number, n, such that lists n through n+range-1
6686 _mesa_GenLists(GLsizei range
)
6688 GET_CURRENT_CONTEXT(ctx
);
6690 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
6691 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, 0);
6694 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGenLists");
6702 * Make this an atomic operation
6704 _glthread_LOCK_MUTEX(ctx
->Shared
->Mutex
);
6706 base
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
6708 /* reserve the list IDs by with empty/dummy lists */
6710 for (i
= 0; i
< range
; i
++) {
6711 _mesa_HashInsert(ctx
->Shared
->DisplayList
, base
+ i
,
6712 make_list(base
+ i
, 1));
6716 _glthread_UNLOCK_MUTEX(ctx
->Shared
->Mutex
);
6723 * Begin a new display list.
6726 _mesa_NewList(GLuint list
, GLenum mode
)
6728 GET_CURRENT_CONTEXT(ctx
);
6731 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
6732 ASSERT_OUTSIDE_BEGIN_END(ctx
);
6734 if (MESA_VERBOSE
& VERBOSE_API
)
6735 _mesa_debug(ctx
, "glNewList %u %s\n", list
,
6736 _mesa_lookup_enum_by_nr(mode
));
6739 _mesa_error(ctx
, GL_INVALID_VALUE
, "glNewList");
6743 if (mode
!= GL_COMPILE
&& mode
!= GL_COMPILE_AND_EXECUTE
) {
6744 _mesa_error(ctx
, GL_INVALID_ENUM
, "glNewList");
6748 if (ctx
->ListState
.CurrentListPtr
) {
6749 /* already compiling a display list */
6750 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
6754 ctx
->CompileFlag
= GL_TRUE
;
6755 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
6757 /* Allocate new display list */
6758 ctx
->ListState
.CurrentListNum
= list
;
6759 ctx
->ListState
.CurrentList
= make_list(list
, BLOCK_SIZE
);
6760 ctx
->ListState
.CurrentBlock
= ctx
->ListState
.CurrentList
->node
;
6761 ctx
->ListState
.CurrentListPtr
= ctx
->ListState
.CurrentBlock
;
6762 ctx
->ListState
.CurrentPos
= 0;
6764 /* Reset acumulated list state:
6766 for (i
= 0; i
< VERT_ATTRIB_MAX
; i
++)
6767 ctx
->ListState
.ActiveAttribSize
[i
] = 0;
6769 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++)
6770 ctx
->ListState
.ActiveMaterialSize
[i
] = 0;
6772 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
6773 ctx
->Driver
.NewList(ctx
, list
, mode
);
6775 ctx
->CurrentDispatch
= ctx
->Save
;
6776 _glapi_set_dispatch(ctx
->CurrentDispatch
);
6781 * End definition of current display list.
6786 GET_CURRENT_CONTEXT(ctx
);
6787 SAVE_FLUSH_VERTICES(ctx
);
6788 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
6790 if (MESA_VERBOSE
& VERBOSE_API
)
6791 _mesa_debug(ctx
, "glEndList\n");
6793 /* Check that a list is under construction */
6794 if (!ctx
->ListState
.CurrentListPtr
) {
6795 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glEndList");
6799 /* Call before emitting END_OF_LIST, in case the driver wants to
6800 * emit opcodes itself.
6802 ctx
->Driver
.EndList(ctx
);
6804 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_END_OF_LIST
, 0);
6806 /* Destroy old list, if any */
6807 destroy_list(ctx
, ctx
->ListState
.CurrentListNum
);
6808 /* Install the list */
6809 _mesa_HashInsert(ctx
->Shared
->DisplayList
, ctx
->ListState
.CurrentListNum
,
6810 ctx
->ListState
.CurrentList
);
6813 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
6814 mesa_print_display_list(ctx
->ListState
.CurrentListNum
);
6816 ctx
->ListState
.CurrentList
= NULL
;
6817 ctx
->ListState
.CurrentListNum
= 0;
6818 ctx
->ListState
.CurrentListPtr
= NULL
;
6819 ctx
->ExecuteFlag
= GL_TRUE
;
6820 ctx
->CompileFlag
= GL_FALSE
;
6822 ctx
->CurrentDispatch
= ctx
->Exec
;
6823 _glapi_set_dispatch(ctx
->CurrentDispatch
);
6828 _mesa_CallList(GLuint list
)
6830 GLboolean save_compile_flag
;
6831 GET_CURRENT_CONTEXT(ctx
);
6832 FLUSH_CURRENT(ctx
, 0);
6833 /* VERY IMPORTANT: Save the CompileFlag status, turn it off, */
6834 /* execute the display list, and restore the CompileFlag. */
6836 if (MESA_VERBOSE
& VERBOSE_API
)
6837 _mesa_debug(ctx
, "glCallList %d\n", list
);
6840 _mesa_error(ctx
, GL_INVALID_VALUE
, "glCallList(list==0)");
6844 /* mesa_print_display_list( list ); */
6846 save_compile_flag
= ctx
->CompileFlag
;
6847 if (save_compile_flag
) {
6848 ctx
->CompileFlag
= GL_FALSE
;
6851 execute_list(ctx
, list
);
6852 ctx
->CompileFlag
= save_compile_flag
;
6854 /* also restore API function pointers to point to "save" versions */
6855 if (save_compile_flag
) {
6856 ctx
->CurrentDispatch
= ctx
->Save
;
6857 _glapi_set_dispatch(ctx
->CurrentDispatch
);
6863 * Execute glCallLists: call multiple display lists.
6866 _mesa_CallLists(GLsizei n
, GLenum type
, const GLvoid
* lists
)
6868 GET_CURRENT_CONTEXT(ctx
);
6870 GLboolean save_compile_flag
;
6872 if (MESA_VERBOSE
& VERBOSE_API
)
6873 _mesa_debug(ctx
, "glCallLists %d\n", n
);
6877 case GL_UNSIGNED_BYTE
:
6879 case GL_UNSIGNED_SHORT
:
6881 case GL_UNSIGNED_INT
:
6889 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
6893 /* Save the CompileFlag status, turn it off, execute display list,
6894 * and restore the CompileFlag.
6896 save_compile_flag
= ctx
->CompileFlag
;
6897 ctx
->CompileFlag
= GL_FALSE
;
6899 for (i
= 0; i
< n
; i
++) {
6900 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ translate_id(i
, type
, lists
));
6901 execute_list(ctx
, list
);
6904 ctx
->CompileFlag
= save_compile_flag
;
6906 /* also restore API function pointers to point to "save" versions */
6907 if (save_compile_flag
) {
6908 ctx
->CurrentDispatch
= ctx
->Save
;
6909 _glapi_set_dispatch(ctx
->CurrentDispatch
);
6915 * Set the offset added to list numbers in glCallLists.
6918 _mesa_ListBase(GLuint base
)
6920 GET_CURRENT_CONTEXT(ctx
);
6921 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
6922 ASSERT_OUTSIDE_BEGIN_END(ctx
);
6923 ctx
->List
.ListBase
= base
;
6927 /* Can no longer assume ctx->Exec->Func is equal to _mesa_Func.
6929 static void GLAPIENTRY
6932 GET_CURRENT_CONTEXT(ctx
);
6933 FLUSH_VERTICES(ctx
, 0);
6934 CALL_Finish(ctx
->Exec
, ());
6937 static void GLAPIENTRY
6940 GET_CURRENT_CONTEXT(ctx
);
6941 FLUSH_VERTICES(ctx
, 0);
6942 CALL_Flush(ctx
->Exec
, ());
6945 static void GLAPIENTRY
6946 exec_GetBooleanv(GLenum pname
, GLboolean
*params
)
6948 GET_CURRENT_CONTEXT(ctx
);
6949 FLUSH_VERTICES(ctx
, 0);
6950 CALL_GetBooleanv(ctx
->Exec
, (pname
, params
));
6953 static void GLAPIENTRY
6954 exec_GetClipPlane(GLenum plane
, GLdouble
* equation
)
6956 GET_CURRENT_CONTEXT(ctx
);
6957 FLUSH_VERTICES(ctx
, 0);
6958 CALL_GetClipPlane(ctx
->Exec
, (plane
, equation
));
6961 static void GLAPIENTRY
6962 exec_GetDoublev(GLenum pname
, GLdouble
*params
)
6964 GET_CURRENT_CONTEXT(ctx
);
6965 FLUSH_VERTICES(ctx
, 0);
6966 CALL_GetDoublev(ctx
->Exec
, (pname
, params
));
6969 static GLenum GLAPIENTRY
6972 GET_CURRENT_CONTEXT(ctx
);
6973 FLUSH_VERTICES(ctx
, 0);
6974 return CALL_GetError(ctx
->Exec
, ());
6977 static void GLAPIENTRY
6978 exec_GetFloatv(GLenum pname
, GLfloat
*params
)
6980 GET_CURRENT_CONTEXT(ctx
);
6981 FLUSH_VERTICES(ctx
, 0);
6982 CALL_GetFloatv(ctx
->Exec
, (pname
, params
));
6985 static void GLAPIENTRY
6986 exec_GetIntegerv(GLenum pname
, GLint
*params
)
6988 GET_CURRENT_CONTEXT(ctx
);
6989 FLUSH_VERTICES(ctx
, 0);
6990 CALL_GetIntegerv(ctx
->Exec
, (pname
, params
));
6993 static void GLAPIENTRY
6994 exec_GetLightfv(GLenum light
, GLenum pname
, GLfloat
*params
)
6996 GET_CURRENT_CONTEXT(ctx
);
6997 FLUSH_VERTICES(ctx
, 0);
6998 CALL_GetLightfv(ctx
->Exec
, (light
, pname
, params
));
7001 static void GLAPIENTRY
7002 exec_GetLightiv(GLenum light
, GLenum pname
, GLint
*params
)
7004 GET_CURRENT_CONTEXT(ctx
);
7005 FLUSH_VERTICES(ctx
, 0);
7006 CALL_GetLightiv(ctx
->Exec
, (light
, pname
, params
));
7009 static void GLAPIENTRY
7010 exec_GetMapdv(GLenum target
, GLenum query
, GLdouble
* v
)
7012 GET_CURRENT_CONTEXT(ctx
);
7013 FLUSH_VERTICES(ctx
, 0);
7014 CALL_GetMapdv(ctx
->Exec
, (target
, query
, v
));
7017 static void GLAPIENTRY
7018 exec_GetMapfv(GLenum target
, GLenum query
, GLfloat
* v
)
7020 GET_CURRENT_CONTEXT(ctx
);
7021 FLUSH_VERTICES(ctx
, 0);
7022 CALL_GetMapfv(ctx
->Exec
, (target
, query
, v
));
7025 static void GLAPIENTRY
7026 exec_GetMapiv(GLenum target
, GLenum query
, GLint
* v
)
7028 GET_CURRENT_CONTEXT(ctx
);
7029 FLUSH_VERTICES(ctx
, 0);
7030 CALL_GetMapiv(ctx
->Exec
, (target
, query
, v
));
7033 static void GLAPIENTRY
7034 exec_GetMaterialfv(GLenum face
, GLenum pname
, GLfloat
*params
)
7036 GET_CURRENT_CONTEXT(ctx
);
7037 FLUSH_VERTICES(ctx
, 0);
7038 CALL_GetMaterialfv(ctx
->Exec
, (face
, pname
, params
));
7041 static void GLAPIENTRY
7042 exec_GetMaterialiv(GLenum face
, GLenum pname
, GLint
*params
)
7044 GET_CURRENT_CONTEXT(ctx
);
7045 FLUSH_VERTICES(ctx
, 0);
7046 CALL_GetMaterialiv(ctx
->Exec
, (face
, pname
, params
));
7049 static void GLAPIENTRY
7050 exec_GetPixelMapfv(GLenum map
, GLfloat
*values
)
7052 GET_CURRENT_CONTEXT(ctx
);
7053 FLUSH_VERTICES(ctx
, 0);
7054 CALL_GetPixelMapfv(ctx
->Exec
, (map
, values
));
7057 static void GLAPIENTRY
7058 exec_GetPixelMapuiv(GLenum map
, GLuint
*values
)
7060 GET_CURRENT_CONTEXT(ctx
);
7061 FLUSH_VERTICES(ctx
, 0);
7062 CALL_GetPixelMapuiv(ctx
->Exec
, (map
, values
));
7065 static void GLAPIENTRY
7066 exec_GetPixelMapusv(GLenum map
, GLushort
*values
)
7068 GET_CURRENT_CONTEXT(ctx
);
7069 FLUSH_VERTICES(ctx
, 0);
7070 CALL_GetPixelMapusv(ctx
->Exec
, (map
, values
));
7073 static void GLAPIENTRY
7074 exec_GetPolygonStipple(GLubyte
* dest
)
7076 GET_CURRENT_CONTEXT(ctx
);
7077 FLUSH_VERTICES(ctx
, 0);
7078 CALL_GetPolygonStipple(ctx
->Exec
, (dest
));
7081 static const GLubyte
*GLAPIENTRY
7082 exec_GetString(GLenum name
)
7084 GET_CURRENT_CONTEXT(ctx
);
7085 FLUSH_VERTICES(ctx
, 0);
7086 return CALL_GetString(ctx
->Exec
, (name
));
7089 static void GLAPIENTRY
7090 exec_GetTexEnvfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7092 GET_CURRENT_CONTEXT(ctx
);
7093 FLUSH_VERTICES(ctx
, 0);
7094 CALL_GetTexEnvfv(ctx
->Exec
, (target
, pname
, params
));
7097 static void GLAPIENTRY
7098 exec_GetTexEnviv(GLenum target
, GLenum pname
, GLint
*params
)
7100 GET_CURRENT_CONTEXT(ctx
);
7101 FLUSH_VERTICES(ctx
, 0);
7102 CALL_GetTexEnviv(ctx
->Exec
, (target
, pname
, params
));
7105 static void GLAPIENTRY
7106 exec_GetTexGendv(GLenum coord
, GLenum pname
, GLdouble
*params
)
7108 GET_CURRENT_CONTEXT(ctx
);
7109 FLUSH_VERTICES(ctx
, 0);
7110 CALL_GetTexGendv(ctx
->Exec
, (coord
, pname
, params
));
7113 static void GLAPIENTRY
7114 exec_GetTexGenfv(GLenum coord
, GLenum pname
, GLfloat
*params
)
7116 GET_CURRENT_CONTEXT(ctx
);
7117 FLUSH_VERTICES(ctx
, 0);
7118 CALL_GetTexGenfv(ctx
->Exec
, (coord
, pname
, params
));
7121 static void GLAPIENTRY
7122 exec_GetTexGeniv(GLenum coord
, GLenum pname
, GLint
*params
)
7124 GET_CURRENT_CONTEXT(ctx
);
7125 FLUSH_VERTICES(ctx
, 0);
7126 CALL_GetTexGeniv(ctx
->Exec
, (coord
, pname
, params
));
7129 static void GLAPIENTRY
7130 exec_GetTexImage(GLenum target
, GLint level
, GLenum format
,
7131 GLenum type
, GLvoid
* pixels
)
7133 GET_CURRENT_CONTEXT(ctx
);
7134 FLUSH_VERTICES(ctx
, 0);
7135 CALL_GetTexImage(ctx
->Exec
, (target
, level
, format
, type
, pixels
));
7138 static void GLAPIENTRY
7139 exec_GetTexLevelParameterfv(GLenum target
, GLint level
,
7140 GLenum pname
, GLfloat
*params
)
7142 GET_CURRENT_CONTEXT(ctx
);
7143 FLUSH_VERTICES(ctx
, 0);
7144 CALL_GetTexLevelParameterfv(ctx
->Exec
, (target
, level
, pname
, params
));
7147 static void GLAPIENTRY
7148 exec_GetTexLevelParameteriv(GLenum target
, GLint level
,
7149 GLenum pname
, GLint
*params
)
7151 GET_CURRENT_CONTEXT(ctx
);
7152 FLUSH_VERTICES(ctx
, 0);
7153 CALL_GetTexLevelParameteriv(ctx
->Exec
, (target
, level
, pname
, params
));
7156 static void GLAPIENTRY
7157 exec_GetTexParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7159 GET_CURRENT_CONTEXT(ctx
);
7160 FLUSH_VERTICES(ctx
, 0);
7161 CALL_GetTexParameterfv(ctx
->Exec
, (target
, pname
, params
));
7164 static void GLAPIENTRY
7165 exec_GetTexParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7167 GET_CURRENT_CONTEXT(ctx
);
7168 FLUSH_VERTICES(ctx
, 0);
7169 CALL_GetTexParameteriv(ctx
->Exec
, (target
, pname
, params
));
7172 static GLboolean GLAPIENTRY
7173 exec_IsEnabled(GLenum cap
)
7175 GET_CURRENT_CONTEXT(ctx
);
7176 FLUSH_VERTICES(ctx
, 0);
7177 return CALL_IsEnabled(ctx
->Exec
, (cap
));
7180 static void GLAPIENTRY
7181 exec_PixelStoref(GLenum pname
, GLfloat param
)
7183 GET_CURRENT_CONTEXT(ctx
);
7184 FLUSH_VERTICES(ctx
, 0);
7185 CALL_PixelStoref(ctx
->Exec
, (pname
, param
));
7188 static void GLAPIENTRY
7189 exec_PixelStorei(GLenum pname
, GLint param
)
7191 GET_CURRENT_CONTEXT(ctx
);
7192 FLUSH_VERTICES(ctx
, 0);
7193 CALL_PixelStorei(ctx
->Exec
, (pname
, param
));
7196 static void GLAPIENTRY
7197 exec_ReadPixels(GLint x
, GLint y
, GLsizei width
, GLsizei height
,
7198 GLenum format
, GLenum type
, GLvoid
* pixels
)
7200 GET_CURRENT_CONTEXT(ctx
);
7201 FLUSH_VERTICES(ctx
, 0);
7202 CALL_ReadPixels(ctx
->Exec
, (x
, y
, width
, height
, format
, type
, pixels
));
7205 static GLint GLAPIENTRY
7206 exec_RenderMode(GLenum mode
)
7208 GET_CURRENT_CONTEXT(ctx
);
7209 FLUSH_VERTICES(ctx
, 0);
7210 return CALL_RenderMode(ctx
->Exec
, (mode
));
7213 static void GLAPIENTRY
7214 exec_FeedbackBuffer(GLsizei size
, GLenum type
, GLfloat
* buffer
)
7216 GET_CURRENT_CONTEXT(ctx
);
7217 FLUSH_VERTICES(ctx
, 0);
7218 CALL_FeedbackBuffer(ctx
->Exec
, (size
, type
, buffer
));
7221 static void GLAPIENTRY
7222 exec_SelectBuffer(GLsizei size
, GLuint
* buffer
)
7224 GET_CURRENT_CONTEXT(ctx
);
7225 FLUSH_VERTICES(ctx
, 0);
7226 CALL_SelectBuffer(ctx
->Exec
, (size
, buffer
));
7229 static GLboolean GLAPIENTRY
7230 exec_AreTexturesResident(GLsizei n
, const GLuint
* texName
,
7231 GLboolean
* residences
)
7233 GET_CURRENT_CONTEXT(ctx
);
7234 FLUSH_VERTICES(ctx
, 0);
7235 return CALL_AreTexturesResident(ctx
->Exec
, (n
, texName
, residences
));
7238 static void GLAPIENTRY
7239 exec_ColorPointer(GLint size
, GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
7241 GET_CURRENT_CONTEXT(ctx
);
7242 FLUSH_VERTICES(ctx
, 0);
7243 CALL_ColorPointer(ctx
->Exec
, (size
, type
, stride
, ptr
));
7246 static void GLAPIENTRY
7247 exec_DeleteTextures(GLsizei n
, const GLuint
* texName
)
7249 GET_CURRENT_CONTEXT(ctx
);
7250 FLUSH_VERTICES(ctx
, 0);
7251 CALL_DeleteTextures(ctx
->Exec
, (n
, texName
));
7254 static void GLAPIENTRY
7255 exec_DisableClientState(GLenum cap
)
7257 GET_CURRENT_CONTEXT(ctx
);
7258 FLUSH_VERTICES(ctx
, 0);
7259 CALL_DisableClientState(ctx
->Exec
, (cap
));
7262 static void GLAPIENTRY
7263 exec_EdgeFlagPointer(GLsizei stride
, const GLvoid
* vptr
)
7265 GET_CURRENT_CONTEXT(ctx
);
7266 FLUSH_VERTICES(ctx
, 0);
7267 CALL_EdgeFlagPointer(ctx
->Exec
, (stride
, vptr
));
7270 static void GLAPIENTRY
7271 exec_EnableClientState(GLenum cap
)
7273 GET_CURRENT_CONTEXT(ctx
);
7274 FLUSH_VERTICES(ctx
, 0);
7275 CALL_EnableClientState(ctx
->Exec
, (cap
));
7278 static void GLAPIENTRY
7279 exec_GenTextures(GLsizei n
, GLuint
* texName
)
7281 GET_CURRENT_CONTEXT(ctx
);
7282 FLUSH_VERTICES(ctx
, 0);
7283 CALL_GenTextures(ctx
->Exec
, (n
, texName
));
7286 static void GLAPIENTRY
7287 exec_GetPointerv(GLenum pname
, GLvoid
**params
)
7289 GET_CURRENT_CONTEXT(ctx
);
7290 FLUSH_VERTICES(ctx
, 0);
7291 CALL_GetPointerv(ctx
->Exec
, (pname
, params
));
7294 static void GLAPIENTRY
7295 exec_IndexPointer(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
7297 GET_CURRENT_CONTEXT(ctx
);
7298 FLUSH_VERTICES(ctx
, 0);
7299 CALL_IndexPointer(ctx
->Exec
, (type
, stride
, ptr
));
7302 static void GLAPIENTRY
7303 exec_InterleavedArrays(GLenum format
, GLsizei stride
, const GLvoid
* pointer
)
7305 GET_CURRENT_CONTEXT(ctx
);
7306 FLUSH_VERTICES(ctx
, 0);
7307 CALL_InterleavedArrays(ctx
->Exec
, (format
, stride
, pointer
));
7310 static GLboolean GLAPIENTRY
7311 exec_IsTexture(GLuint texture
)
7313 GET_CURRENT_CONTEXT(ctx
);
7314 FLUSH_VERTICES(ctx
, 0);
7315 return CALL_IsTexture(ctx
->Exec
, (texture
));
7318 static void GLAPIENTRY
7319 exec_NormalPointer(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
7321 GET_CURRENT_CONTEXT(ctx
);
7322 FLUSH_VERTICES(ctx
, 0);
7323 CALL_NormalPointer(ctx
->Exec
, (type
, stride
, ptr
));
7326 static void GLAPIENTRY
7327 exec_PopClientAttrib(void)
7329 GET_CURRENT_CONTEXT(ctx
);
7330 FLUSH_VERTICES(ctx
, 0);
7331 CALL_PopClientAttrib(ctx
->Exec
, ());
7334 static void GLAPIENTRY
7335 exec_PushClientAttrib(GLbitfield mask
)
7337 GET_CURRENT_CONTEXT(ctx
);
7338 FLUSH_VERTICES(ctx
, 0);
7339 CALL_PushClientAttrib(ctx
->Exec
, (mask
));
7342 static void GLAPIENTRY
7343 exec_TexCoordPointer(GLint size
, GLenum type
, GLsizei stride
,
7346 GET_CURRENT_CONTEXT(ctx
);
7347 FLUSH_VERTICES(ctx
, 0);
7348 CALL_TexCoordPointer(ctx
->Exec
, (size
, type
, stride
, ptr
));
7351 static void GLAPIENTRY
7352 exec_GetCompressedTexImageARB(GLenum target
, GLint level
, GLvoid
* img
)
7354 GET_CURRENT_CONTEXT(ctx
);
7355 FLUSH_VERTICES(ctx
, 0);
7356 CALL_GetCompressedTexImageARB(ctx
->Exec
, (target
, level
, img
));
7359 static void GLAPIENTRY
7360 exec_VertexPointer(GLint size
, GLenum type
, GLsizei stride
,
7363 GET_CURRENT_CONTEXT(ctx
);
7364 FLUSH_VERTICES(ctx
, 0);
7365 CALL_VertexPointer(ctx
->Exec
, (size
, type
, stride
, ptr
));
7368 static void GLAPIENTRY
7369 exec_CopyConvolutionFilter1D(GLenum target
, GLenum internalFormat
,
7370 GLint x
, GLint y
, GLsizei width
)
7372 GET_CURRENT_CONTEXT(ctx
);
7373 FLUSH_VERTICES(ctx
, 0);
7374 CALL_CopyConvolutionFilter1D(ctx
->Exec
,
7375 (target
, internalFormat
, x
, y
, width
));
7378 static void GLAPIENTRY
7379 exec_CopyConvolutionFilter2D(GLenum target
, GLenum internalFormat
,
7380 GLint x
, GLint y
, GLsizei width
, GLsizei height
)
7382 GET_CURRENT_CONTEXT(ctx
);
7383 FLUSH_VERTICES(ctx
, 0);
7384 CALL_CopyConvolutionFilter2D(ctx
->Exec
,
7385 (target
, internalFormat
, x
, y
, width
,
7389 static void GLAPIENTRY
7390 exec_GetColorTable(GLenum target
, GLenum format
, GLenum type
, GLvoid
* data
)
7392 GET_CURRENT_CONTEXT(ctx
);
7393 FLUSH_VERTICES(ctx
, 0);
7394 CALL_GetColorTable(ctx
->Exec
, (target
, format
, type
, data
));
7397 static void GLAPIENTRY
7398 exec_GetColorTableParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7400 GET_CURRENT_CONTEXT(ctx
);
7401 FLUSH_VERTICES(ctx
, 0);
7402 CALL_GetColorTableParameterfv(ctx
->Exec
, (target
, pname
, params
));
7405 static void GLAPIENTRY
7406 exec_GetColorTableParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7408 GET_CURRENT_CONTEXT(ctx
);
7409 FLUSH_VERTICES(ctx
, 0);
7410 CALL_GetColorTableParameteriv(ctx
->Exec
, (target
, pname
, params
));
7413 static void GLAPIENTRY
7414 exec_GetConvolutionFilter(GLenum target
, GLenum format
, GLenum type
,
7417 GET_CURRENT_CONTEXT(ctx
);
7418 FLUSH_VERTICES(ctx
, 0);
7419 CALL_GetConvolutionFilter(ctx
->Exec
, (target
, format
, type
, image
));
7422 static void GLAPIENTRY
7423 exec_GetConvolutionParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7425 GET_CURRENT_CONTEXT(ctx
);
7426 FLUSH_VERTICES(ctx
, 0);
7427 CALL_GetConvolutionParameterfv(ctx
->Exec
, (target
, pname
, params
));
7430 static void GLAPIENTRY
7431 exec_GetConvolutionParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7433 GET_CURRENT_CONTEXT(ctx
);
7434 FLUSH_VERTICES(ctx
, 0);
7435 CALL_GetConvolutionParameteriv(ctx
->Exec
, (target
, pname
, params
));
7438 static void GLAPIENTRY
7439 exec_GetHistogram(GLenum target
, GLboolean reset
, GLenum format
,
7440 GLenum type
, GLvoid
*values
)
7442 GET_CURRENT_CONTEXT(ctx
);
7443 FLUSH_VERTICES(ctx
, 0);
7444 CALL_GetHistogram(ctx
->Exec
, (target
, reset
, format
, type
, values
));
7447 static void GLAPIENTRY
7448 exec_GetHistogramParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7450 GET_CURRENT_CONTEXT(ctx
);
7451 FLUSH_VERTICES(ctx
, 0);
7452 CALL_GetHistogramParameterfv(ctx
->Exec
, (target
, pname
, params
));
7455 static void GLAPIENTRY
7456 exec_GetHistogramParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7458 GET_CURRENT_CONTEXT(ctx
);
7459 FLUSH_VERTICES(ctx
, 0);
7460 CALL_GetHistogramParameteriv(ctx
->Exec
, (target
, pname
, params
));
7463 static void GLAPIENTRY
7464 exec_GetMinmax(GLenum target
, GLboolean reset
, GLenum format
,
7465 GLenum type
, GLvoid
*values
)
7467 GET_CURRENT_CONTEXT(ctx
);
7468 FLUSH_VERTICES(ctx
, 0);
7469 CALL_GetMinmax(ctx
->Exec
, (target
, reset
, format
, type
, values
));
7472 static void GLAPIENTRY
7473 exec_GetMinmaxParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7475 GET_CURRENT_CONTEXT(ctx
);
7476 FLUSH_VERTICES(ctx
, 0);
7477 CALL_GetMinmaxParameterfv(ctx
->Exec
, (target
, pname
, params
));
7480 static void GLAPIENTRY
7481 exec_GetMinmaxParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7483 GET_CURRENT_CONTEXT(ctx
);
7484 FLUSH_VERTICES(ctx
, 0);
7485 CALL_GetMinmaxParameteriv(ctx
->Exec
, (target
, pname
, params
));
7488 static void GLAPIENTRY
7489 exec_GetSeparableFilter(GLenum target
, GLenum format
, GLenum type
,
7490 GLvoid
*row
, GLvoid
*column
, GLvoid
*span
)
7492 GET_CURRENT_CONTEXT(ctx
);
7493 FLUSH_VERTICES(ctx
, 0);
7494 CALL_GetSeparableFilter(ctx
->Exec
,
7495 (target
, format
, type
, row
, column
, span
));
7498 static void GLAPIENTRY
7499 exec_SeparableFilter2D(GLenum target
, GLenum internalFormat
,
7500 GLsizei width
, GLsizei height
, GLenum format
,
7501 GLenum type
, const GLvoid
*row
, const GLvoid
*column
)
7503 GET_CURRENT_CONTEXT(ctx
);
7504 FLUSH_VERTICES(ctx
, 0);
7505 CALL_SeparableFilter2D(ctx
->Exec
,
7506 (target
, internalFormat
, width
, height
, format
,
7507 type
, row
, column
));
7510 static void GLAPIENTRY
7511 exec_ColorPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
7512 GLsizei count
, const GLvoid
*ptr
)
7514 GET_CURRENT_CONTEXT(ctx
);
7515 FLUSH_VERTICES(ctx
, 0);
7516 CALL_ColorPointerEXT(ctx
->Exec
, (size
, type
, stride
, count
, ptr
));
7519 static void GLAPIENTRY
7520 exec_EdgeFlagPointerEXT(GLsizei stride
, GLsizei count
, const GLboolean
*ptr
)
7522 GET_CURRENT_CONTEXT(ctx
);
7523 FLUSH_VERTICES(ctx
, 0);
7524 CALL_EdgeFlagPointerEXT(ctx
->Exec
, (stride
, count
, ptr
));
7527 static void GLAPIENTRY
7528 exec_IndexPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
,
7531 GET_CURRENT_CONTEXT(ctx
);
7532 FLUSH_VERTICES(ctx
, 0);
7533 CALL_IndexPointerEXT(ctx
->Exec
, (type
, stride
, count
, ptr
));
7536 static void GLAPIENTRY
7537 exec_NormalPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
,
7540 GET_CURRENT_CONTEXT(ctx
);
7541 FLUSH_VERTICES(ctx
, 0);
7542 CALL_NormalPointerEXT(ctx
->Exec
, (type
, stride
, count
, ptr
));
7545 static void GLAPIENTRY
7546 exec_TexCoordPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
7547 GLsizei count
, const GLvoid
*ptr
)
7549 GET_CURRENT_CONTEXT(ctx
);
7550 FLUSH_VERTICES(ctx
, 0);
7551 CALL_TexCoordPointerEXT(ctx
->Exec
, (size
, type
, stride
, count
, ptr
));
7554 static void GLAPIENTRY
7555 exec_VertexPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
7556 GLsizei count
, const GLvoid
*ptr
)
7558 GET_CURRENT_CONTEXT(ctx
);
7559 FLUSH_VERTICES(ctx
, 0);
7560 CALL_VertexPointerEXT(ctx
->Exec
, (size
, type
, stride
, count
, ptr
));
7563 static void GLAPIENTRY
7564 exec_LockArraysEXT(GLint first
, GLsizei count
)
7566 GET_CURRENT_CONTEXT(ctx
);
7567 FLUSH_VERTICES(ctx
, 0);
7568 CALL_LockArraysEXT(ctx
->Exec
, (first
, count
));
7571 static void GLAPIENTRY
7572 exec_UnlockArraysEXT(void)
7574 GET_CURRENT_CONTEXT(ctx
);
7575 FLUSH_VERTICES(ctx
, 0);
7576 CALL_UnlockArraysEXT(ctx
->Exec
, ());
7579 static void GLAPIENTRY
7580 exec_ClientActiveTextureARB(GLenum target
)
7582 GET_CURRENT_CONTEXT(ctx
);
7583 FLUSH_VERTICES(ctx
, 0);
7584 CALL_ClientActiveTextureARB(ctx
->Exec
, (target
));
7587 static void GLAPIENTRY
7588 exec_SecondaryColorPointerEXT(GLint size
, GLenum type
,
7589 GLsizei stride
, const GLvoid
*ptr
)
7591 GET_CURRENT_CONTEXT(ctx
);
7592 FLUSH_VERTICES(ctx
, 0);
7593 CALL_SecondaryColorPointerEXT(ctx
->Exec
, (size
, type
, stride
, ptr
));
7596 static void GLAPIENTRY
7597 exec_FogCoordPointerEXT(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
7599 GET_CURRENT_CONTEXT(ctx
);
7600 FLUSH_VERTICES(ctx
, 0);
7601 CALL_FogCoordPointerEXT(ctx
->Exec
, (type
, stride
, ptr
));
7604 /* GL_EXT_multi_draw_arrays */
7605 static void GLAPIENTRY
7606 exec_MultiDrawArraysEXT(GLenum mode
, GLint
* first
,
7607 GLsizei
* count
, GLsizei primcount
)
7609 GET_CURRENT_CONTEXT(ctx
);
7610 FLUSH_VERTICES(ctx
, 0);
7611 CALL_MultiDrawArraysEXT(ctx
->Exec
, (mode
, first
, count
, primcount
));
7614 /* GL_EXT_multi_draw_arrays */
7615 static void GLAPIENTRY
7616 exec_MultiDrawElementsEXT(GLenum mode
, const GLsizei
* count
,
7617 GLenum type
, const GLvoid
** indices
,
7620 GET_CURRENT_CONTEXT(ctx
);
7621 FLUSH_VERTICES(ctx
, 0);
7622 CALL_MultiDrawElementsEXT(ctx
->Exec
,
7623 (mode
, count
, type
, indices
, primcount
));
7626 /* GL_IBM_multimode_draw_arrays */
7627 static void GLAPIENTRY
7628 exec_MultiModeDrawArraysIBM(const GLenum
* mode
, const GLint
* first
,
7629 const GLsizei
* count
, GLsizei primcount
,
7632 GET_CURRENT_CONTEXT(ctx
);
7633 FLUSH_VERTICES(ctx
, 0);
7634 CALL_MultiModeDrawArraysIBM(ctx
->Exec
,
7635 (mode
, first
, count
, primcount
, modestride
));
7638 /* GL_IBM_multimode_draw_arrays */
7639 static void GLAPIENTRY
7640 exec_MultiModeDrawElementsIBM(const GLenum
* mode
,
7641 const GLsizei
* count
,
7643 const GLvoid
* const *indices
,
7644 GLsizei primcount
, GLint modestride
)
7646 GET_CURRENT_CONTEXT(ctx
);
7647 FLUSH_VERTICES(ctx
, 0);
7648 CALL_MultiModeDrawElementsIBM(ctx
->Exec
,
7649 (mode
, count
, type
, indices
, primcount
,
7656 * Setup the given dispatch table to point to Mesa's display list
7657 * building functions.
7659 * This does not include any of the tnl functions - they are
7660 * initialized from _mesa_init_api_defaults and from the active vtxfmt
7664 _mesa_init_dlist_table(struct _glapi_table
*table
)
7666 _mesa_loopback_init_api_table(table
);
7669 SET_Accum(table
, save_Accum
);
7670 SET_AlphaFunc(table
, save_AlphaFunc
);
7671 SET_Bitmap(table
, save_Bitmap
);
7672 SET_BlendFunc(table
, save_BlendFunc
);
7673 SET_CallList(table
, _mesa_save_CallList
);
7674 SET_CallLists(table
, _mesa_save_CallLists
);
7675 SET_Clear(table
, save_Clear
);
7676 SET_ClearAccum(table
, save_ClearAccum
);
7677 SET_ClearColor(table
, save_ClearColor
);
7678 SET_ClearDepth(table
, save_ClearDepth
);
7679 SET_ClearIndex(table
, save_ClearIndex
);
7680 SET_ClearStencil(table
, save_ClearStencil
);
7681 SET_ClipPlane(table
, save_ClipPlane
);
7682 SET_ColorMask(table
, save_ColorMask
);
7683 SET_ColorMaterial(table
, save_ColorMaterial
);
7684 SET_CopyPixels(table
, save_CopyPixels
);
7685 SET_CullFace(table
, save_CullFace
);
7686 SET_DeleteLists(table
, _mesa_DeleteLists
);
7687 SET_DepthFunc(table
, save_DepthFunc
);
7688 SET_DepthMask(table
, save_DepthMask
);
7689 SET_DepthRange(table
, save_DepthRange
);
7690 SET_Disable(table
, save_Disable
);
7691 SET_DrawBuffer(table
, save_DrawBuffer
);
7692 SET_DrawPixels(table
, save_DrawPixels
);
7693 SET_Enable(table
, save_Enable
);
7694 SET_EndList(table
, _mesa_EndList
);
7695 SET_EvalMesh1(table
, _mesa_save_EvalMesh1
);
7696 SET_EvalMesh2(table
, _mesa_save_EvalMesh2
);
7697 SET_Finish(table
, exec_Finish
);
7698 SET_Flush(table
, exec_Flush
);
7699 SET_Fogf(table
, save_Fogf
);
7700 SET_Fogfv(table
, save_Fogfv
);
7701 SET_Fogi(table
, save_Fogi
);
7702 SET_Fogiv(table
, save_Fogiv
);
7703 SET_FrontFace(table
, save_FrontFace
);
7704 SET_Frustum(table
, save_Frustum
);
7705 SET_GenLists(table
, _mesa_GenLists
);
7706 SET_GetBooleanv(table
, exec_GetBooleanv
);
7707 SET_GetClipPlane(table
, exec_GetClipPlane
);
7708 SET_GetDoublev(table
, exec_GetDoublev
);
7709 SET_GetError(table
, exec_GetError
);
7710 SET_GetFloatv(table
, exec_GetFloatv
);
7711 SET_GetIntegerv(table
, exec_GetIntegerv
);
7712 SET_GetLightfv(table
, exec_GetLightfv
);
7713 SET_GetLightiv(table
, exec_GetLightiv
);
7714 SET_GetMapdv(table
, exec_GetMapdv
);
7715 SET_GetMapfv(table
, exec_GetMapfv
);
7716 SET_GetMapiv(table
, exec_GetMapiv
);
7717 SET_GetMaterialfv(table
, exec_GetMaterialfv
);
7718 SET_GetMaterialiv(table
, exec_GetMaterialiv
);
7719 SET_GetPixelMapfv(table
, exec_GetPixelMapfv
);
7720 SET_GetPixelMapuiv(table
, exec_GetPixelMapuiv
);
7721 SET_GetPixelMapusv(table
, exec_GetPixelMapusv
);
7722 SET_GetPolygonStipple(table
, exec_GetPolygonStipple
);
7723 SET_GetString(table
, exec_GetString
);
7724 SET_GetTexEnvfv(table
, exec_GetTexEnvfv
);
7725 SET_GetTexEnviv(table
, exec_GetTexEnviv
);
7726 SET_GetTexGendv(table
, exec_GetTexGendv
);
7727 SET_GetTexGenfv(table
, exec_GetTexGenfv
);
7728 SET_GetTexGeniv(table
, exec_GetTexGeniv
);
7729 SET_GetTexImage(table
, exec_GetTexImage
);
7730 SET_GetTexLevelParameterfv(table
, exec_GetTexLevelParameterfv
);
7731 SET_GetTexLevelParameteriv(table
, exec_GetTexLevelParameteriv
);
7732 SET_GetTexParameterfv(table
, exec_GetTexParameterfv
);
7733 SET_GetTexParameteriv(table
, exec_GetTexParameteriv
);
7734 SET_Hint(table
, save_Hint
);
7735 SET_IndexMask(table
, save_IndexMask
);
7736 SET_InitNames(table
, save_InitNames
);
7737 SET_IsEnabled(table
, exec_IsEnabled
);
7738 SET_IsList(table
, _mesa_IsList
);
7739 SET_LightModelf(table
, save_LightModelf
);
7740 SET_LightModelfv(table
, save_LightModelfv
);
7741 SET_LightModeli(table
, save_LightModeli
);
7742 SET_LightModeliv(table
, save_LightModeliv
);
7743 SET_Lightf(table
, save_Lightf
);
7744 SET_Lightfv(table
, save_Lightfv
);
7745 SET_Lighti(table
, save_Lighti
);
7746 SET_Lightiv(table
, save_Lightiv
);
7747 SET_LineStipple(table
, save_LineStipple
);
7748 SET_LineWidth(table
, save_LineWidth
);
7749 SET_ListBase(table
, save_ListBase
);
7750 SET_LoadIdentity(table
, save_LoadIdentity
);
7751 SET_LoadMatrixd(table
, save_LoadMatrixd
);
7752 SET_LoadMatrixf(table
, save_LoadMatrixf
);
7753 SET_LoadName(table
, save_LoadName
);
7754 SET_LogicOp(table
, save_LogicOp
);
7755 SET_Map1d(table
, save_Map1d
);
7756 SET_Map1f(table
, save_Map1f
);
7757 SET_Map2d(table
, save_Map2d
);
7758 SET_Map2f(table
, save_Map2f
);
7759 SET_MapGrid1d(table
, save_MapGrid1d
);
7760 SET_MapGrid1f(table
, save_MapGrid1f
);
7761 SET_MapGrid2d(table
, save_MapGrid2d
);
7762 SET_MapGrid2f(table
, save_MapGrid2f
);
7763 SET_MatrixMode(table
, save_MatrixMode
);
7764 SET_MultMatrixd(table
, save_MultMatrixd
);
7765 SET_MultMatrixf(table
, save_MultMatrixf
);
7766 SET_NewList(table
, save_NewList
);
7767 SET_Ortho(table
, save_Ortho
);
7768 SET_PassThrough(table
, save_PassThrough
);
7769 SET_PixelMapfv(table
, save_PixelMapfv
);
7770 SET_PixelMapuiv(table
, save_PixelMapuiv
);
7771 SET_PixelMapusv(table
, save_PixelMapusv
);
7772 SET_PixelStoref(table
, exec_PixelStoref
);
7773 SET_PixelStorei(table
, exec_PixelStorei
);
7774 SET_PixelTransferf(table
, save_PixelTransferf
);
7775 SET_PixelTransferi(table
, save_PixelTransferi
);
7776 SET_PixelZoom(table
, save_PixelZoom
);
7777 SET_PointSize(table
, save_PointSize
);
7778 SET_PolygonMode(table
, save_PolygonMode
);
7779 SET_PolygonOffset(table
, save_PolygonOffset
);
7780 SET_PolygonStipple(table
, save_PolygonStipple
);
7781 SET_PopAttrib(table
, save_PopAttrib
);
7782 SET_PopMatrix(table
, save_PopMatrix
);
7783 SET_PopName(table
, save_PopName
);
7784 SET_PushAttrib(table
, save_PushAttrib
);
7785 SET_PushMatrix(table
, save_PushMatrix
);
7786 SET_PushName(table
, save_PushName
);
7787 SET_RasterPos2d(table
, save_RasterPos2d
);
7788 SET_RasterPos2dv(table
, save_RasterPos2dv
);
7789 SET_RasterPos2f(table
, save_RasterPos2f
);
7790 SET_RasterPos2fv(table
, save_RasterPos2fv
);
7791 SET_RasterPos2i(table
, save_RasterPos2i
);
7792 SET_RasterPos2iv(table
, save_RasterPos2iv
);
7793 SET_RasterPos2s(table
, save_RasterPos2s
);
7794 SET_RasterPos2sv(table
, save_RasterPos2sv
);
7795 SET_RasterPos3d(table
, save_RasterPos3d
);
7796 SET_RasterPos3dv(table
, save_RasterPos3dv
);
7797 SET_RasterPos3f(table
, save_RasterPos3f
);
7798 SET_RasterPos3fv(table
, save_RasterPos3fv
);
7799 SET_RasterPos3i(table
, save_RasterPos3i
);
7800 SET_RasterPos3iv(table
, save_RasterPos3iv
);
7801 SET_RasterPos3s(table
, save_RasterPos3s
);
7802 SET_RasterPos3sv(table
, save_RasterPos3sv
);
7803 SET_RasterPos4d(table
, save_RasterPos4d
);
7804 SET_RasterPos4dv(table
, save_RasterPos4dv
);
7805 SET_RasterPos4f(table
, save_RasterPos4f
);
7806 SET_RasterPos4fv(table
, save_RasterPos4fv
);
7807 SET_RasterPos4i(table
, save_RasterPos4i
);
7808 SET_RasterPos4iv(table
, save_RasterPos4iv
);
7809 SET_RasterPos4s(table
, save_RasterPos4s
);
7810 SET_RasterPos4sv(table
, save_RasterPos4sv
);
7811 SET_ReadBuffer(table
, save_ReadBuffer
);
7812 SET_ReadPixels(table
, exec_ReadPixels
);
7813 SET_RenderMode(table
, exec_RenderMode
);
7814 SET_Rotated(table
, save_Rotated
);
7815 SET_Rotatef(table
, save_Rotatef
);
7816 SET_Scaled(table
, save_Scaled
);
7817 SET_Scalef(table
, save_Scalef
);
7818 SET_Scissor(table
, save_Scissor
);
7819 SET_FeedbackBuffer(table
, exec_FeedbackBuffer
);
7820 SET_SelectBuffer(table
, exec_SelectBuffer
);
7821 SET_ShadeModel(table
, save_ShadeModel
);
7822 SET_StencilFunc(table
, save_StencilFunc
);
7823 SET_StencilMask(table
, save_StencilMask
);
7824 SET_StencilOp(table
, save_StencilOp
);
7825 SET_TexEnvf(table
, save_TexEnvf
);
7826 SET_TexEnvfv(table
, save_TexEnvfv
);
7827 SET_TexEnvi(table
, save_TexEnvi
);
7828 SET_TexEnviv(table
, save_TexEnviv
);
7829 SET_TexGend(table
, save_TexGend
);
7830 SET_TexGendv(table
, save_TexGendv
);
7831 SET_TexGenf(table
, save_TexGenf
);
7832 SET_TexGenfv(table
, save_TexGenfv
);
7833 SET_TexGeni(table
, save_TexGeni
);
7834 SET_TexGeniv(table
, save_TexGeniv
);
7835 SET_TexImage1D(table
, save_TexImage1D
);
7836 SET_TexImage2D(table
, save_TexImage2D
);
7837 SET_TexParameterf(table
, save_TexParameterf
);
7838 SET_TexParameterfv(table
, save_TexParameterfv
);
7839 SET_TexParameteri(table
, save_TexParameteri
);
7840 SET_TexParameteriv(table
, save_TexParameteriv
);
7841 SET_Translated(table
, save_Translated
);
7842 SET_Translatef(table
, save_Translatef
);
7843 SET_Viewport(table
, save_Viewport
);
7846 SET_AreTexturesResident(table
, exec_AreTexturesResident
);
7847 SET_BindTexture(table
, save_BindTexture
);
7848 SET_ColorPointer(table
, exec_ColorPointer
);
7849 SET_CopyTexImage1D(table
, save_CopyTexImage1D
);
7850 SET_CopyTexImage2D(table
, save_CopyTexImage2D
);
7851 SET_CopyTexSubImage1D(table
, save_CopyTexSubImage1D
);
7852 SET_CopyTexSubImage2D(table
, save_CopyTexSubImage2D
);
7853 SET_DeleteTextures(table
, exec_DeleteTextures
);
7854 SET_DisableClientState(table
, exec_DisableClientState
);
7855 SET_EdgeFlagPointer(table
, exec_EdgeFlagPointer
);
7856 SET_EnableClientState(table
, exec_EnableClientState
);
7857 SET_GenTextures(table
, exec_GenTextures
);
7858 SET_GetPointerv(table
, exec_GetPointerv
);
7859 SET_IndexPointer(table
, exec_IndexPointer
);
7860 SET_InterleavedArrays(table
, exec_InterleavedArrays
);
7861 SET_IsTexture(table
, exec_IsTexture
);
7862 SET_NormalPointer(table
, exec_NormalPointer
);
7863 SET_PopClientAttrib(table
, exec_PopClientAttrib
);
7864 SET_PrioritizeTextures(table
, save_PrioritizeTextures
);
7865 SET_PushClientAttrib(table
, exec_PushClientAttrib
);
7866 SET_TexCoordPointer(table
, exec_TexCoordPointer
);
7867 SET_TexSubImage1D(table
, save_TexSubImage1D
);
7868 SET_TexSubImage2D(table
, save_TexSubImage2D
);
7869 SET_VertexPointer(table
, exec_VertexPointer
);
7872 SET_CopyTexSubImage3D(table
, save_CopyTexSubImage3D
);
7873 SET_TexImage3D(table
, save_TexImage3D
);
7874 SET_TexSubImage3D(table
, save_TexSubImage3D
);
7877 SET_StencilFuncSeparate(table
, save_StencilFuncSeparate
);
7878 SET_StencilMaskSeparate(table
, save_StencilMaskSeparate
);
7879 SET_StencilOpSeparate(table
, save_StencilOpSeparate
);
7881 /* ATI_separate_stencil */
7882 SET_StencilFuncSeparateATI(table
, save_StencilFuncSeparateATI
);
7884 /* GL_ARB_imaging */
7885 /* Not all are supported */
7886 SET_BlendColor(table
, save_BlendColor
);
7887 SET_BlendEquation(table
, save_BlendEquation
);
7888 SET_ColorSubTable(table
, save_ColorSubTable
);
7889 SET_ColorTable(table
, save_ColorTable
);
7890 SET_ColorTableParameterfv(table
, save_ColorTableParameterfv
);
7891 SET_ColorTableParameteriv(table
, save_ColorTableParameteriv
);
7892 SET_ConvolutionFilter1D(table
, save_ConvolutionFilter1D
);
7893 SET_ConvolutionFilter2D(table
, save_ConvolutionFilter2D
);
7894 SET_ConvolutionParameterf(table
, save_ConvolutionParameterf
);
7895 SET_ConvolutionParameterfv(table
, save_ConvolutionParameterfv
);
7896 SET_ConvolutionParameteri(table
, save_ConvolutionParameteri
);
7897 SET_ConvolutionParameteriv(table
, save_ConvolutionParameteriv
);
7898 SET_CopyColorSubTable(table
, save_CopyColorSubTable
);
7899 SET_CopyColorTable(table
, save_CopyColorTable
);
7900 SET_CopyConvolutionFilter1D(table
, exec_CopyConvolutionFilter1D
);
7901 SET_CopyConvolutionFilter2D(table
, exec_CopyConvolutionFilter2D
);
7902 SET_GetColorTable(table
, exec_GetColorTable
);
7903 SET_GetColorTableParameterfv(table
, exec_GetColorTableParameterfv
);
7904 SET_GetColorTableParameteriv(table
, exec_GetColorTableParameteriv
);
7905 SET_GetConvolutionFilter(table
, exec_GetConvolutionFilter
);
7906 SET_GetConvolutionParameterfv(table
, exec_GetConvolutionParameterfv
);
7907 SET_GetConvolutionParameteriv(table
, exec_GetConvolutionParameteriv
);
7908 SET_GetHistogram(table
, exec_GetHistogram
);
7909 SET_GetHistogramParameterfv(table
, exec_GetHistogramParameterfv
);
7910 SET_GetHistogramParameteriv(table
, exec_GetHistogramParameteriv
);
7911 SET_GetMinmax(table
, exec_GetMinmax
);
7912 SET_GetMinmaxParameterfv(table
, exec_GetMinmaxParameterfv
);
7913 SET_GetMinmaxParameteriv(table
, exec_GetMinmaxParameteriv
);
7914 SET_GetSeparableFilter(table
, exec_GetSeparableFilter
);
7915 SET_Histogram(table
, save_Histogram
);
7916 SET_Minmax(table
, save_Minmax
);
7917 SET_ResetHistogram(table
, save_ResetHistogram
);
7918 SET_ResetMinmax(table
, save_ResetMinmax
);
7919 SET_SeparableFilter2D(table
, exec_SeparableFilter2D
);
7921 /* 2. GL_EXT_blend_color */
7923 SET_BlendColorEXT(table
, save_BlendColorEXT
);
7926 /* 3. GL_EXT_polygon_offset */
7927 SET_PolygonOffsetEXT(table
, save_PolygonOffsetEXT
);
7929 /* 6. GL_EXT_texture3d */
7931 SET_CopyTexSubImage3DEXT(table
, save_CopyTexSubImage3D
);
7932 SET_TexImage3DEXT(table
, save_TexImage3DEXT
);
7933 SET_TexSubImage3DEXT(table
, save_TexSubImage3D
);
7936 /* 14. GL_SGI_color_table */
7938 SET_ColorTableSGI(table
, save_ColorTable
);
7939 SET_ColorSubTableSGI(table
, save_ColorSubTable
);
7940 SET_GetColorTableSGI(table
, exec_GetColorTable
);
7941 SET_GetColorTableParameterfvSGI(table
, exec_GetColorTableParameterfv
);
7942 SET_GetColorTableParameterivSGI(table
, exec_GetColorTableParameteriv
);
7945 /* 30. GL_EXT_vertex_array */
7946 SET_ColorPointerEXT(table
, exec_ColorPointerEXT
);
7947 SET_EdgeFlagPointerEXT(table
, exec_EdgeFlagPointerEXT
);
7948 SET_IndexPointerEXT(table
, exec_IndexPointerEXT
);
7949 SET_NormalPointerEXT(table
, exec_NormalPointerEXT
);
7950 SET_TexCoordPointerEXT(table
, exec_TexCoordPointerEXT
);
7951 SET_VertexPointerEXT(table
, exec_VertexPointerEXT
);
7953 /* 37. GL_EXT_blend_minmax */
7955 SET_BlendEquationEXT(table
, save_BlendEquationEXT
);
7958 /* 54. GL_EXT_point_parameters */
7959 SET_PointParameterfEXT(table
, save_PointParameterfEXT
);
7960 SET_PointParameterfvEXT(table
, save_PointParameterfvEXT
);
7962 /* 97. GL_EXT_compiled_vertex_array */
7963 SET_LockArraysEXT(table
, exec_LockArraysEXT
);
7964 SET_UnlockArraysEXT(table
, exec_UnlockArraysEXT
);
7966 /* 145. GL_EXT_secondary_color */
7967 SET_SecondaryColorPointerEXT(table
, exec_SecondaryColorPointerEXT
);
7969 /* 148. GL_EXT_multi_draw_arrays */
7970 SET_MultiDrawArraysEXT(table
, exec_MultiDrawArraysEXT
);
7971 SET_MultiDrawElementsEXT(table
, exec_MultiDrawElementsEXT
);
7973 /* 149. GL_EXT_fog_coord */
7974 SET_FogCoordPointerEXT(table
, exec_FogCoordPointerEXT
);
7976 /* 173. GL_EXT_blend_func_separate */
7977 SET_BlendFuncSeparateEXT(table
, save_BlendFuncSeparateEXT
);
7979 /* 196. GL_MESA_resize_buffers */
7980 SET_ResizeBuffersMESA(table
, _mesa_ResizeBuffersMESA
);
7982 /* 197. GL_MESA_window_pos */
7983 SET_WindowPos2dMESA(table
, save_WindowPos2dMESA
);
7984 SET_WindowPos2dvMESA(table
, save_WindowPos2dvMESA
);
7985 SET_WindowPos2fMESA(table
, save_WindowPos2fMESA
);
7986 SET_WindowPos2fvMESA(table
, save_WindowPos2fvMESA
);
7987 SET_WindowPos2iMESA(table
, save_WindowPos2iMESA
);
7988 SET_WindowPos2ivMESA(table
, save_WindowPos2ivMESA
);
7989 SET_WindowPos2sMESA(table
, save_WindowPos2sMESA
);
7990 SET_WindowPos2svMESA(table
, save_WindowPos2svMESA
);
7991 SET_WindowPos3dMESA(table
, save_WindowPos3dMESA
);
7992 SET_WindowPos3dvMESA(table
, save_WindowPos3dvMESA
);
7993 SET_WindowPos3fMESA(table
, save_WindowPos3fMESA
);
7994 SET_WindowPos3fvMESA(table
, save_WindowPos3fvMESA
);
7995 SET_WindowPos3iMESA(table
, save_WindowPos3iMESA
);
7996 SET_WindowPos3ivMESA(table
, save_WindowPos3ivMESA
);
7997 SET_WindowPos3sMESA(table
, save_WindowPos3sMESA
);
7998 SET_WindowPos3svMESA(table
, save_WindowPos3svMESA
);
7999 SET_WindowPos4dMESA(table
, save_WindowPos4dMESA
);
8000 SET_WindowPos4dvMESA(table
, save_WindowPos4dvMESA
);
8001 SET_WindowPos4fMESA(table
, save_WindowPos4fMESA
);
8002 SET_WindowPos4fvMESA(table
, save_WindowPos4fvMESA
);
8003 SET_WindowPos4iMESA(table
, save_WindowPos4iMESA
);
8004 SET_WindowPos4ivMESA(table
, save_WindowPos4ivMESA
);
8005 SET_WindowPos4sMESA(table
, save_WindowPos4sMESA
);
8006 SET_WindowPos4svMESA(table
, save_WindowPos4svMESA
);
8008 /* 200. GL_IBM_multimode_draw_arrays */
8009 SET_MultiModeDrawArraysIBM(table
, exec_MultiModeDrawArraysIBM
);
8010 SET_MultiModeDrawElementsIBM(table
, exec_MultiModeDrawElementsIBM
);
8012 #if FEATURE_NV_vertex_program
8013 /* 233. GL_NV_vertex_program */
8014 /* The following commands DO NOT go into display lists:
8015 * AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV,
8016 * VertexAttribPointerNV, GetProgram*, GetVertexAttrib*
8018 SET_BindProgramNV(table
, save_BindProgramNV
);
8019 SET_DeleteProgramsNV(table
, _mesa_DeletePrograms
);
8020 SET_ExecuteProgramNV(table
, save_ExecuteProgramNV
);
8021 SET_GenProgramsNV(table
, _mesa_GenPrograms
);
8022 SET_AreProgramsResidentNV(table
, _mesa_AreProgramsResidentNV
);
8023 SET_RequestResidentProgramsNV(table
, save_RequestResidentProgramsNV
);
8024 SET_GetProgramParameterfvNV(table
, _mesa_GetProgramParameterfvNV
);
8025 SET_GetProgramParameterdvNV(table
, _mesa_GetProgramParameterdvNV
);
8026 SET_GetProgramivNV(table
, _mesa_GetProgramivNV
);
8027 SET_GetProgramStringNV(table
, _mesa_GetProgramStringNV
);
8028 SET_GetTrackMatrixivNV(table
, _mesa_GetTrackMatrixivNV
);
8029 SET_GetVertexAttribdvNV(table
, _mesa_GetVertexAttribdvNV
);
8030 SET_GetVertexAttribfvNV(table
, _mesa_GetVertexAttribfvNV
);
8031 SET_GetVertexAttribivNV(table
, _mesa_GetVertexAttribivNV
);
8032 SET_GetVertexAttribPointervNV(table
, _mesa_GetVertexAttribPointervNV
);
8033 SET_IsProgramNV(table
, _mesa_IsProgramARB
);
8034 SET_LoadProgramNV(table
, save_LoadProgramNV
);
8035 SET_ProgramEnvParameter4dARB(table
, save_ProgramEnvParameter4dARB
);
8036 SET_ProgramEnvParameter4dvARB(table
, save_ProgramEnvParameter4dvARB
);
8037 SET_ProgramEnvParameter4fARB(table
, save_ProgramEnvParameter4fARB
);
8038 SET_ProgramEnvParameter4fvARB(table
, save_ProgramEnvParameter4fvARB
);
8039 SET_ProgramParameters4dvNV(table
, save_ProgramParameters4dvNV
);
8040 SET_ProgramParameters4fvNV(table
, save_ProgramParameters4fvNV
);
8041 SET_TrackMatrixNV(table
, save_TrackMatrixNV
);
8042 SET_VertexAttribPointerNV(table
, _mesa_VertexAttribPointerNV
);
8045 /* 245. GL_ATI_fragment_shader */
8046 #if FEATURE_ATI_fragment_shader
8047 SET_BindFragmentShaderATI(table
, save_BindFragmentShaderATI
);
8048 SET_SetFragmentShaderConstantATI(table
, save_SetFragmentShaderConstantATI
);
8051 /* 282. GL_NV_fragment_program */
8052 #if FEATURE_NV_fragment_program
8053 SET_ProgramNamedParameter4fNV(table
, save_ProgramNamedParameter4fNV
);
8054 SET_ProgramNamedParameter4dNV(table
, save_ProgramNamedParameter4dNV
);
8055 SET_ProgramNamedParameter4fvNV(table
, save_ProgramNamedParameter4fvNV
);
8056 SET_ProgramNamedParameter4dvNV(table
, save_ProgramNamedParameter4dvNV
);
8057 SET_GetProgramNamedParameterfvNV(table
,
8058 _mesa_GetProgramNamedParameterfvNV
);
8059 SET_GetProgramNamedParameterdvNV(table
,
8060 _mesa_GetProgramNamedParameterdvNV
);
8061 SET_ProgramLocalParameter4dARB(table
, save_ProgramLocalParameter4dARB
);
8062 SET_ProgramLocalParameter4dvARB(table
, save_ProgramLocalParameter4dvARB
);
8063 SET_ProgramLocalParameter4fARB(table
, save_ProgramLocalParameter4fARB
);
8064 SET_ProgramLocalParameter4fvARB(table
, save_ProgramLocalParameter4fvARB
);
8065 SET_GetProgramLocalParameterdvARB(table
,
8066 _mesa_GetProgramLocalParameterdvARB
);
8067 SET_GetProgramLocalParameterfvARB(table
,
8068 _mesa_GetProgramLocalParameterfvARB
);
8071 /* 262. GL_NV_point_sprite */
8072 SET_PointParameteriNV(table
, save_PointParameteriNV
);
8073 SET_PointParameterivNV(table
, save_PointParameterivNV
);
8075 /* 268. GL_EXT_stencil_two_side */
8076 SET_ActiveStencilFaceEXT(table
, save_ActiveStencilFaceEXT
);
8078 /* 273. GL_APPLE_vertex_array_object */
8079 SET_BindVertexArrayAPPLE(table
, _mesa_BindVertexArrayAPPLE
);
8080 SET_DeleteVertexArraysAPPLE(table
, _mesa_DeleteVertexArraysAPPLE
);
8081 SET_GenVertexArraysAPPLE(table
, _mesa_GenVertexArraysAPPLE
);
8082 SET_IsVertexArrayAPPLE(table
, _mesa_IsVertexArrayAPPLE
);
8084 /* ???. GL_EXT_depth_bounds_test */
8085 SET_DepthBoundsEXT(table
, save_DepthBoundsEXT
);
8087 /* ARB 1. GL_ARB_multitexture */
8088 SET_ActiveTextureARB(table
, save_ActiveTextureARB
);
8089 SET_ClientActiveTextureARB(table
, exec_ClientActiveTextureARB
);
8091 /* ARB 3. GL_ARB_transpose_matrix */
8092 SET_LoadTransposeMatrixdARB(table
, save_LoadTransposeMatrixdARB
);
8093 SET_LoadTransposeMatrixfARB(table
, save_LoadTransposeMatrixfARB
);
8094 SET_MultTransposeMatrixdARB(table
, save_MultTransposeMatrixdARB
);
8095 SET_MultTransposeMatrixfARB(table
, save_MultTransposeMatrixfARB
);
8097 /* ARB 5. GL_ARB_multisample */
8098 SET_SampleCoverageARB(table
, save_SampleCoverageARB
);
8100 /* ARB 12. GL_ARB_texture_compression */
8101 SET_CompressedTexImage3DARB(table
, save_CompressedTexImage3DARB
);
8102 SET_CompressedTexImage2DARB(table
, save_CompressedTexImage2DARB
);
8103 SET_CompressedTexImage1DARB(table
, save_CompressedTexImage1DARB
);
8104 SET_CompressedTexSubImage3DARB(table
, save_CompressedTexSubImage3DARB
);
8105 SET_CompressedTexSubImage2DARB(table
, save_CompressedTexSubImage2DARB
);
8106 SET_CompressedTexSubImage1DARB(table
, save_CompressedTexSubImage1DARB
);
8107 SET_GetCompressedTexImageARB(table
, exec_GetCompressedTexImageARB
);
8109 /* ARB 14. GL_ARB_point_parameters */
8110 /* aliased with EXT_point_parameters functions */
8112 /* ARB 25. GL_ARB_window_pos */
8113 /* aliased with MESA_window_pos functions */
8115 /* ARB 26. GL_ARB_vertex_program */
8116 /* ARB 27. GL_ARB_fragment_program */
8117 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
8118 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
8119 SET_VertexAttribPointerARB(table
, _mesa_VertexAttribPointerARB
);
8120 SET_EnableVertexAttribArrayARB(table
, _mesa_EnableVertexAttribArrayARB
);
8121 SET_DisableVertexAttribArrayARB(table
, _mesa_DisableVertexAttribArrayARB
);
8122 SET_ProgramStringARB(table
, save_ProgramStringARB
);
8123 SET_BindProgramNV(table
, save_BindProgramNV
);
8124 SET_DeleteProgramsNV(table
, _mesa_DeletePrograms
);
8125 SET_GenProgramsNV(table
, _mesa_GenPrograms
);
8126 SET_IsProgramNV(table
, _mesa_IsProgramARB
);
8127 SET_GetVertexAttribdvNV(table
, _mesa_GetVertexAttribdvNV
);
8128 SET_GetVertexAttribfvNV(table
, _mesa_GetVertexAttribfvNV
);
8129 SET_GetVertexAttribivNV(table
, _mesa_GetVertexAttribivNV
);
8130 SET_GetVertexAttribPointervNV(table
, _mesa_GetVertexAttribPointervNV
);
8131 SET_ProgramEnvParameter4dARB(table
, save_ProgramEnvParameter4dARB
);
8132 SET_ProgramEnvParameter4dvARB(table
, save_ProgramEnvParameter4dvARB
);
8133 SET_ProgramEnvParameter4fARB(table
, save_ProgramEnvParameter4fARB
);
8134 SET_ProgramEnvParameter4fvARB(table
, save_ProgramEnvParameter4fvARB
);
8135 SET_ProgramLocalParameter4dARB(table
, save_ProgramLocalParameter4dARB
);
8136 SET_ProgramLocalParameter4dvARB(table
, save_ProgramLocalParameter4dvARB
);
8137 SET_ProgramLocalParameter4fARB(table
, save_ProgramLocalParameter4fARB
);
8138 SET_ProgramLocalParameter4fvARB(table
, save_ProgramLocalParameter4fvARB
);
8139 SET_GetProgramEnvParameterdvARB(table
, _mesa_GetProgramEnvParameterdvARB
);
8140 SET_GetProgramEnvParameterfvARB(table
, _mesa_GetProgramEnvParameterfvARB
);
8141 SET_GetProgramLocalParameterdvARB(table
,
8142 _mesa_GetProgramLocalParameterdvARB
);
8143 SET_GetProgramLocalParameterfvARB(table
,
8144 _mesa_GetProgramLocalParameterfvARB
);
8145 SET_GetProgramivARB(table
, _mesa_GetProgramivARB
);
8146 SET_GetProgramStringARB(table
, _mesa_GetProgramStringARB
);
8149 /* ARB 28. GL_ARB_vertex_buffer_object */
8150 #if FEATURE_ARB_vertex_buffer_object
8151 /* None of the extension's functions get compiled */
8152 SET_BindBufferARB(table
, _mesa_BindBufferARB
);
8153 SET_BufferDataARB(table
, _mesa_BufferDataARB
);
8154 SET_BufferSubDataARB(table
, _mesa_BufferSubDataARB
);
8155 SET_DeleteBuffersARB(table
, _mesa_DeleteBuffersARB
);
8156 SET_GenBuffersARB(table
, _mesa_GenBuffersARB
);
8157 SET_GetBufferParameterivARB(table
, _mesa_GetBufferParameterivARB
);
8158 SET_GetBufferPointervARB(table
, _mesa_GetBufferPointervARB
);
8159 SET_GetBufferSubDataARB(table
, _mesa_GetBufferSubDataARB
);
8160 SET_IsBufferARB(table
, _mesa_IsBufferARB
);
8161 SET_MapBufferARB(table
, _mesa_MapBufferARB
);
8162 SET_UnmapBufferARB(table
, _mesa_UnmapBufferARB
);
8165 #if FEATURE_ARB_occlusion_query
8166 SET_BeginQueryARB(table
, save_BeginQueryARB
);
8167 SET_EndQueryARB(table
, save_EndQueryARB
);
8168 SET_GenQueriesARB(table
, _mesa_GenQueriesARB
);
8169 SET_DeleteQueriesARB(table
, _mesa_DeleteQueriesARB
);
8170 SET_IsQueryARB(table
, _mesa_IsQueryARB
);
8171 SET_GetQueryivARB(table
, _mesa_GetQueryivARB
);
8172 SET_GetQueryObjectivARB(table
, _mesa_GetQueryObjectivARB
);
8173 SET_GetQueryObjectuivARB(table
, _mesa_GetQueryObjectuivARB
);
8175 SET_DrawBuffersARB(table
, save_DrawBuffersARB
);
8177 #if FEATURE_EXT_framebuffer_blit
8178 SET_BlitFramebufferEXT(table
, save_BlitFramebufferEXT
);
8181 /* ARB 30/31/32. GL_ARB_shader_objects, GL_ARB_vertex/fragment_shader */
8182 SET_BindAttribLocationARB(table
, exec_BindAttribLocationARB
);
8183 SET_GetAttribLocationARB(table
, exec_GetAttribLocationARB
);
8184 /* XXX additional functions need to be implemented here! */
8186 /* 299. GL_EXT_blend_equation_separate */
8187 SET_BlendEquationSeparateEXT(table
, save_BlendEquationSeparateEXT
);
8189 /* GL_EXT_gpu_program_parmaeters */
8190 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
8191 SET_ProgramEnvParameters4fvEXT(table
, save_ProgramEnvParameters4fvEXT
);
8192 SET_ProgramLocalParameters4fvEXT(table
, save_ProgramLocalParameters4fvEXT
);
8199 enum_string(GLenum k
)
8201 return _mesa_lookup_enum_by_nr(k
);
8206 * Print the commands in a display list. For debugging only.
8207 * TODO: many commands aren't handled yet.
8209 static void GLAPIENTRY
8210 print_list(GLcontext
*ctx
, GLuint list
)
8212 struct mesa_display_list
*dlist
;
8216 if (!islist(ctx
, list
)) {
8217 _mesa_printf("%u is not a display list ID\n", list
);
8221 dlist
= lookup_list(ctx
, list
);
8227 _mesa_printf("START-LIST %u, address %p\n", list
, (void *) n
);
8229 done
= n
? GL_FALSE
: GL_TRUE
;
8231 OpCode opcode
= n
[0].opcode
;
8232 GLint i
= (GLint
) n
[0].opcode
- (GLint
) OPCODE_EXT_0
;
8234 if (i
>= 0 && i
< (GLint
) ctx
->ListExt
.NumOpcodes
) {
8235 /* this is a driver-extended opcode */
8236 ctx
->ListExt
.Opcode
[i
].Print(ctx
, &n
[1]);
8237 n
+= ctx
->ListExt
.Opcode
[i
].Size
;
8242 _mesa_printf("Accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
8245 _mesa_printf("Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
8246 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
, (void *) n
[7].data
);
8248 case OPCODE_CALL_LIST
:
8249 _mesa_printf("CallList %d\n", (int) n
[1].ui
);
8251 case OPCODE_CALL_LIST_OFFSET
:
8252 _mesa_printf("CallList %d + offset %u = %u\n", (int) n
[1].ui
,
8253 ctx
->List
.ListBase
, ctx
->List
.ListBase
+ n
[1].ui
);
8255 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
8256 _mesa_printf("ColorTableParameterfv %s %s %f %f %f %f\n",
8257 enum_string(n
[1].e
), enum_string(n
[2].e
),
8258 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8260 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
8261 _mesa_printf("ColorTableParameteriv %s %s %d %d %d %d\n",
8262 enum_string(n
[1].e
), enum_string(n
[2].e
),
8263 n
[3].i
, n
[4].i
, n
[5].i
, n
[6].i
);
8265 case OPCODE_DISABLE
:
8266 _mesa_printf("Disable %s\n", enum_string(n
[1].e
));
8269 _mesa_printf("Enable %s\n", enum_string(n
[1].e
));
8271 case OPCODE_FRUSTUM
:
8272 _mesa_printf("Frustum %g %g %g %g %g %g\n",
8273 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8275 case OPCODE_LINE_STIPPLE
:
8276 _mesa_printf("LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
8278 case OPCODE_LOAD_IDENTITY
:
8279 _mesa_printf("LoadIdentity\n");
8281 case OPCODE_LOAD_MATRIX
:
8282 _mesa_printf("LoadMatrix\n");
8283 _mesa_printf(" %8f %8f %8f %8f\n",
8284 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
8285 _mesa_printf(" %8f %8f %8f %8f\n",
8286 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
8287 _mesa_printf(" %8f %8f %8f %8f\n",
8288 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
8289 _mesa_printf(" %8f %8f %8f %8f\n",
8290 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
8292 case OPCODE_MULT_MATRIX
:
8293 _mesa_printf("MultMatrix (or Rotate)\n");
8294 _mesa_printf(" %8f %8f %8f %8f\n",
8295 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
8296 _mesa_printf(" %8f %8f %8f %8f\n",
8297 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
8298 _mesa_printf(" %8f %8f %8f %8f\n",
8299 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
8300 _mesa_printf(" %8f %8f %8f %8f\n",
8301 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
8304 _mesa_printf("Ortho %g %g %g %g %g %g\n",
8305 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8307 case OPCODE_POP_ATTRIB
:
8308 _mesa_printf("PopAttrib\n");
8310 case OPCODE_POP_MATRIX
:
8311 _mesa_printf("PopMatrix\n");
8313 case OPCODE_POP_NAME
:
8314 _mesa_printf("PopName\n");
8316 case OPCODE_PUSH_ATTRIB
:
8317 _mesa_printf("PushAttrib %x\n", n
[1].bf
);
8319 case OPCODE_PUSH_MATRIX
:
8320 _mesa_printf("PushMatrix\n");
8322 case OPCODE_PUSH_NAME
:
8323 _mesa_printf("PushName %d\n", (int) n
[1].ui
);
8325 case OPCODE_RASTER_POS
:
8326 _mesa_printf("RasterPos %g %g %g %g\n",
8327 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
8330 _mesa_printf("Rotate %g %g %g %g\n",
8331 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
8334 _mesa_printf("Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
8336 case OPCODE_TRANSLATE
:
8337 _mesa_printf("Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
8339 case OPCODE_BIND_TEXTURE
:
8340 _mesa_printf("BindTexture %s %d\n",
8341 _mesa_lookup_enum_by_nr(n
[1].ui
), n
[2].ui
);
8343 case OPCODE_SHADE_MODEL
:
8344 _mesa_printf("ShadeModel %s\n", _mesa_lookup_enum_by_nr(n
[1].ui
));
8347 _mesa_printf("Map1 %s %.3f %.3f %d %d\n",
8348 _mesa_lookup_enum_by_nr(n
[1].ui
),
8349 n
[2].f
, n
[3].f
, n
[4].i
, n
[5].i
);
8352 _mesa_printf("Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
8353 _mesa_lookup_enum_by_nr(n
[1].ui
),
8354 n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
,
8355 n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
8357 case OPCODE_MAPGRID1
:
8358 _mesa_printf("MapGrid1 %d %.3f %.3f\n", n
[1].i
, n
[2].f
, n
[3].f
);
8360 case OPCODE_MAPGRID2
:
8361 _mesa_printf("MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
8362 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
8364 case OPCODE_EVALMESH1
:
8365 _mesa_printf("EvalMesh1 %d %d\n", n
[1].i
, n
[2].i
);
8367 case OPCODE_EVALMESH2
:
8368 _mesa_printf("EvalMesh2 %d %d %d %d\n",
8369 n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
8372 case OPCODE_ATTR_1F_NV
:
8373 _mesa_printf("ATTR_1F_NV attr %d: %f\n", n
[1].i
, n
[2].f
);
8375 case OPCODE_ATTR_2F_NV
:
8376 _mesa_printf("ATTR_2F_NV attr %d: %f %f\n",
8377 n
[1].i
, n
[2].f
, n
[3].f
);
8379 case OPCODE_ATTR_3F_NV
:
8380 _mesa_printf("ATTR_3F_NV attr %d: %f %f %f\n",
8381 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
8383 case OPCODE_ATTR_4F_NV
:
8384 _mesa_printf("ATTR_4F_NV attr %d: %f %f %f %f\n",
8385 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
8387 case OPCODE_ATTR_1F_ARB
:
8388 _mesa_printf("ATTR_1F_ARB attr %d: %f\n", n
[1].i
, n
[2].f
);
8390 case OPCODE_ATTR_2F_ARB
:
8391 _mesa_printf("ATTR_2F_ARB attr %d: %f %f\n",
8392 n
[1].i
, n
[2].f
, n
[3].f
);
8394 case OPCODE_ATTR_3F_ARB
:
8395 _mesa_printf("ATTR_3F_ARB attr %d: %f %f %f\n",
8396 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
8398 case OPCODE_ATTR_4F_ARB
:
8399 _mesa_printf("ATTR_4F_ARB attr %d: %f %f %f %f\n",
8400 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
8403 case OPCODE_MATERIAL
:
8404 _mesa_printf("MATERIAL %x %x: %f %f %f %f\n",
8405 n
[1].i
, n
[2].i
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8408 _mesa_printf("BEGIN %x\n", n
[1].i
);
8411 _mesa_printf("END\n");
8414 _mesa_printf("RECTF %f %f %f %f\n", n
[1].f
, n
[2].f
, n
[3].f
,
8417 case OPCODE_EVAL_C1
:
8418 _mesa_printf("EVAL_C1 %f\n", n
[1].f
);
8420 case OPCODE_EVAL_C2
:
8421 _mesa_printf("EVAL_C2 %f %f\n", n
[1].f
, n
[2].f
);
8423 case OPCODE_EVAL_P1
:
8424 _mesa_printf("EVAL_P1 %d\n", n
[1].i
);
8426 case OPCODE_EVAL_P2
:
8427 _mesa_printf("EVAL_P2 %d %d\n", n
[1].i
, n
[2].i
);
8431 * meta opcodes/commands
8434 _mesa_printf("Error: %s %s\n",
8435 enum_string(n
[1].e
), (const char *) n
[2].data
);
8437 case OPCODE_CONTINUE
:
8438 _mesa_printf("DISPLAY-LIST-CONTINUE\n");
8439 n
= (Node
*) n
[1].next
;
8441 case OPCODE_END_OF_LIST
:
8442 _mesa_printf("END-LIST %u\n", list
);
8446 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
8448 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
8449 opcode
, (void *) n
);
8453 _mesa_printf("command %d, %u operands\n", opcode
,
8457 /* increment n to point to next compiled command */
8458 if (opcode
!= OPCODE_CONTINUE
) {
8459 n
+= InstSize
[opcode
];
8468 * Clients may call this function to help debug display list problems.
8469 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
8470 * changed, or break in the future without notice.
8473 mesa_print_display_list(GLuint list
)
8475 GET_CURRENT_CONTEXT(ctx
);
8476 print_list(ctx
, list
);
8480 /**********************************************************************/
8481 /***** Initialization *****/
8482 /**********************************************************************/
8485 _mesa_save_vtxfmt_init(GLvertexformat
* vfmt
)
8487 vfmt
->ArrayElement
= _ae_loopback_array_elt
; /* generic helper */
8488 vfmt
->Begin
= save_Begin
;
8489 vfmt
->CallList
= _mesa_save_CallList
;
8490 vfmt
->CallLists
= _mesa_save_CallLists
;
8491 vfmt
->Color3f
= save_Color3f
;
8492 vfmt
->Color3fv
= save_Color3fv
;
8493 vfmt
->Color4f
= save_Color4f
;
8494 vfmt
->Color4fv
= save_Color4fv
;
8495 vfmt
->EdgeFlag
= save_EdgeFlag
;
8496 vfmt
->End
= save_End
;
8497 vfmt
->EvalCoord1f
= save_EvalCoord1f
;
8498 vfmt
->EvalCoord1fv
= save_EvalCoord1fv
;
8499 vfmt
->EvalCoord2f
= save_EvalCoord2f
;
8500 vfmt
->EvalCoord2fv
= save_EvalCoord2fv
;
8501 vfmt
->EvalPoint1
= save_EvalPoint1
;
8502 vfmt
->EvalPoint2
= save_EvalPoint2
;
8503 vfmt
->FogCoordfEXT
= save_FogCoordfEXT
;
8504 vfmt
->FogCoordfvEXT
= save_FogCoordfvEXT
;
8505 vfmt
->Indexf
= save_Indexf
;
8506 vfmt
->Indexfv
= save_Indexfv
;
8507 vfmt
->Materialfv
= save_Materialfv
;
8508 vfmt
->MultiTexCoord1fARB
= save_MultiTexCoord1f
;
8509 vfmt
->MultiTexCoord1fvARB
= save_MultiTexCoord1fv
;
8510 vfmt
->MultiTexCoord2fARB
= save_MultiTexCoord2f
;
8511 vfmt
->MultiTexCoord2fvARB
= save_MultiTexCoord2fv
;
8512 vfmt
->MultiTexCoord3fARB
= save_MultiTexCoord3f
;
8513 vfmt
->MultiTexCoord3fvARB
= save_MultiTexCoord3fv
;
8514 vfmt
->MultiTexCoord4fARB
= save_MultiTexCoord4f
;
8515 vfmt
->MultiTexCoord4fvARB
= save_MultiTexCoord4fv
;
8516 vfmt
->Normal3f
= save_Normal3f
;
8517 vfmt
->Normal3fv
= save_Normal3fv
;
8518 vfmt
->SecondaryColor3fEXT
= save_SecondaryColor3fEXT
;
8519 vfmt
->SecondaryColor3fvEXT
= save_SecondaryColor3fvEXT
;
8520 vfmt
->TexCoord1f
= save_TexCoord1f
;
8521 vfmt
->TexCoord1fv
= save_TexCoord1fv
;
8522 vfmt
->TexCoord2f
= save_TexCoord2f
;
8523 vfmt
->TexCoord2fv
= save_TexCoord2fv
;
8524 vfmt
->TexCoord3f
= save_TexCoord3f
;
8525 vfmt
->TexCoord3fv
= save_TexCoord3fv
;
8526 vfmt
->TexCoord4f
= save_TexCoord4f
;
8527 vfmt
->TexCoord4fv
= save_TexCoord4fv
;
8528 vfmt
->Vertex2f
= save_Vertex2f
;
8529 vfmt
->Vertex2fv
= save_Vertex2fv
;
8530 vfmt
->Vertex3f
= save_Vertex3f
;
8531 vfmt
->Vertex3fv
= save_Vertex3fv
;
8532 vfmt
->Vertex4f
= save_Vertex4f
;
8533 vfmt
->Vertex4fv
= save_Vertex4fv
;
8534 vfmt
->VertexAttrib1fNV
= save_VertexAttrib1fNV
;
8535 vfmt
->VertexAttrib1fvNV
= save_VertexAttrib1fvNV
;
8536 vfmt
->VertexAttrib2fNV
= save_VertexAttrib2fNV
;
8537 vfmt
->VertexAttrib2fvNV
= save_VertexAttrib2fvNV
;
8538 vfmt
->VertexAttrib3fNV
= save_VertexAttrib3fNV
;
8539 vfmt
->VertexAttrib3fvNV
= save_VertexAttrib3fvNV
;
8540 vfmt
->VertexAttrib4fNV
= save_VertexAttrib4fNV
;
8541 vfmt
->VertexAttrib4fvNV
= save_VertexAttrib4fvNV
;
8542 vfmt
->VertexAttrib1fARB
= save_VertexAttrib1fARB
;
8543 vfmt
->VertexAttrib1fvARB
= save_VertexAttrib1fvARB
;
8544 vfmt
->VertexAttrib2fARB
= save_VertexAttrib2fARB
;
8545 vfmt
->VertexAttrib2fvARB
= save_VertexAttrib2fvARB
;
8546 vfmt
->VertexAttrib3fARB
= save_VertexAttrib3fARB
;
8547 vfmt
->VertexAttrib3fvARB
= save_VertexAttrib3fvARB
;
8548 vfmt
->VertexAttrib4fARB
= save_VertexAttrib4fARB
;
8549 vfmt
->VertexAttrib4fvARB
= save_VertexAttrib4fvARB
;
8551 vfmt
->EvalMesh1
= _mesa_save_EvalMesh1
;
8552 vfmt
->EvalMesh2
= _mesa_save_EvalMesh2
;
8553 vfmt
->Rectf
= save_Rectf
;
8555 /* The driver is required to implement these as
8556 * 1) They can probably do a better job.
8557 * 2) A lot of new mechanisms would have to be added to this module
8558 * to support it. That code would probably never get used,
8562 vfmt
->DrawArrays
= 0;
8563 vfmt
->DrawElements
= 0;
8564 vfmt
->DrawRangeElements
= 0;
8570 * Initialize display list state for given context.
8573 _mesa_init_display_list(GLcontext
*ctx
)
8575 static GLboolean tableInitialized
= GL_FALSE
;
8577 /* zero-out the instruction size table, just once */
8578 if (!tableInitialized
) {
8579 _mesa_bzero(InstSize
, sizeof(InstSize
));
8580 tableInitialized
= GL_TRUE
;
8584 ctx
->ListState
.CallDepth
= 0;
8585 ctx
->ExecuteFlag
= GL_TRUE
;
8586 ctx
->CompileFlag
= GL_FALSE
;
8587 ctx
->ListState
.CurrentListPtr
= NULL
;
8588 ctx
->ListState
.CurrentBlock
= NULL
;
8589 ctx
->ListState
.CurrentListNum
= 0;
8590 ctx
->ListState
.CurrentPos
= 0;
8592 /* Display List group */
8593 ctx
->List
.ListBase
= 0;
8595 _mesa_save_vtxfmt_init(&ctx
->ListState
.ListVtxfmt
);