2 * Mesa 3-D graphics library
5 * Copyright (C) 1999-2006 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"
36 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
37 #include "arbprogram.h"
43 #if FEATURE_ARB_vertex_buffer_object
44 #include "bufferobj.h"
57 #include "extensions.h"
62 #include "histogram.h"
79 #if FEATURE_NV_vertex_program || FEATURE_NV_fragment_program
80 #include "nvprogram.h"
83 #if FEATURE_ATI_fragment_shader
84 #include "atifragshader.h"
87 #include "math/m_matrix.h"
88 #include "math/m_xform.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_PROGRAM_PARAMETER4F_NV
,
307 OPCODE_TRACK_MATRIX_NV
,
308 /* GL_NV_fragment_program */
309 OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
,
310 OPCODE_PROGRAM_NAMED_PARAMETER_NV
,
311 /* GL_EXT_stencil_two_side */
312 OPCODE_ACTIVE_STENCIL_FACE_EXT
,
313 /* GL_EXT_depth_bounds_test */
314 OPCODE_DEPTH_BOUNDS_EXT
,
315 /* GL_ARB_vertex/fragment_program */
316 OPCODE_PROGRAM_STRING_ARB
,
317 OPCODE_PROGRAM_ENV_PARAMETER_ARB
,
318 /* GL_ARB_occlusion_query */
319 OPCODE_BEGIN_QUERY_ARB
,
320 OPCODE_END_QUERY_ARB
,
321 /* GL_ARB_draw_buffers */
322 OPCODE_DRAW_BUFFERS_ARB
,
323 /* GL_ATI_fragment_shader */
324 OPCODE_BIND_FRAGMENT_SHADER_ATI
,
325 OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
,
327 OPCODE_STENCIL_FUNC_SEPARATE
,
328 OPCODE_STENCIL_OP_SEPARATE
,
329 OPCODE_STENCIL_MASK_SEPARATE
,
331 /* GL_EXT_framebuffer_blit */
332 OPCODE_BLIT_FRAMEBUFFER
,
334 /* Vertex attributes -- fallback for when optimized display
335 * list build isn't active.
356 /* The following three are meta instructions */
357 OPCODE_ERROR
, /* raise compiled-in error */
368 * Display list instructions are stored as sequences of "nodes". Nodes
369 * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
370 * are linked together with a pointer.
372 * Each instruction in the display list is stored as a sequence of
373 * contiguous nodes in memory.
374 * Each node is the union of a variety of data types.
389 void *next
; /* If prev node's opcode==OPCODE_CONTINUE */
394 * How many nodes to allocate at a time.
396 * \note Reduced now that we hold vertices etc. elsewhere.
398 #define BLOCK_SIZE 256
403 * Number of nodes of storage needed for each instruction.
404 * Sizes for dynamically allocated opcodes are stored in the context struct.
406 static GLuint InstSize
[OPCODE_END_OF_LIST
+ 1];
408 void mesa_print_display_list(GLuint list
);
411 /**********************************************************************/
412 /***** Private *****/
413 /**********************************************************************/
417 * Make an empty display list. This is used by glGenLists() to
418 * reserve display list IDs.
420 static struct mesa_display_list
*
421 make_list(GLuint list
, GLuint count
)
423 struct mesa_display_list
*dlist
= CALLOC_STRUCT(mesa_display_list
);
425 dlist
->node
= (Node
*) _mesa_malloc(sizeof(Node
) * count
);
426 dlist
->node
[0].opcode
= OPCODE_END_OF_LIST
;
432 * Lookup function to just encapsulate casting.
434 static INLINE
struct mesa_display_list
*
435 lookup_list(GLcontext
*ctx
, GLuint list
)
437 return (struct mesa_display_list
*)
438 _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
444 * Delete the named display list, but don't remove from hash table.
445 * \param dlist - display list pointer
448 _mesa_delete_list(GLcontext
*ctx
, struct mesa_display_list
*dlist
)
453 n
= block
= dlist
->node
;
455 done
= block
? GL_FALSE
: GL_TRUE
;
458 /* check for extension opcodes first */
460 GLint i
= (GLint
) n
[0].opcode
- (GLint
) OPCODE_EXT_0
;
461 if (i
>= 0 && i
< (GLint
) ctx
->ListExt
.NumOpcodes
) {
462 ctx
->ListExt
.Opcode
[i
].Destroy(ctx
, &n
[1]);
463 n
+= ctx
->ListExt
.Opcode
[i
].Size
;
466 switch (n
[0].opcode
) {
467 /* for some commands, we need to free malloc'd memory */
469 _mesa_free(n
[6].data
);
470 n
+= InstSize
[n
[0].opcode
];
473 _mesa_free(n
[10].data
);
474 n
+= InstSize
[n
[0].opcode
];
476 case OPCODE_DRAW_PIXELS
:
477 _mesa_free(n
[5].data
);
478 n
+= InstSize
[n
[0].opcode
];
481 _mesa_free(n
[7].data
);
482 n
+= InstSize
[n
[0].opcode
];
484 case OPCODE_COLOR_TABLE
:
485 _mesa_free(n
[6].data
);
486 n
+= InstSize
[n
[0].opcode
];
488 case OPCODE_COLOR_SUB_TABLE
:
489 _mesa_free(n
[6].data
);
490 n
+= InstSize
[n
[0].opcode
];
492 case OPCODE_CONVOLUTION_FILTER_1D
:
493 _mesa_free(n
[6].data
);
494 n
+= InstSize
[n
[0].opcode
];
496 case OPCODE_CONVOLUTION_FILTER_2D
:
497 _mesa_free(n
[7].data
);
498 n
+= InstSize
[n
[0].opcode
];
500 case OPCODE_POLYGON_STIPPLE
:
501 _mesa_free(n
[1].data
);
502 n
+= InstSize
[n
[0].opcode
];
504 case OPCODE_TEX_IMAGE1D
:
505 _mesa_free(n
[8].data
);
506 n
+= InstSize
[n
[0].opcode
];
508 case OPCODE_TEX_IMAGE2D
:
509 _mesa_free(n
[9].data
);
510 n
+= InstSize
[n
[0].opcode
];
512 case OPCODE_TEX_IMAGE3D
:
513 _mesa_free(n
[10].data
);
514 n
+= InstSize
[n
[0].opcode
];
516 case OPCODE_TEX_SUB_IMAGE1D
:
517 _mesa_free(n
[7].data
);
518 n
+= InstSize
[n
[0].opcode
];
520 case OPCODE_TEX_SUB_IMAGE2D
:
521 _mesa_free(n
[9].data
);
522 n
+= InstSize
[n
[0].opcode
];
524 case OPCODE_TEX_SUB_IMAGE3D
:
525 _mesa_free(n
[11].data
);
526 n
+= InstSize
[n
[0].opcode
];
528 case OPCODE_COMPRESSED_TEX_IMAGE_1D
:
529 _mesa_free(n
[7].data
);
530 n
+= InstSize
[n
[0].opcode
];
532 case OPCODE_COMPRESSED_TEX_IMAGE_2D
:
533 _mesa_free(n
[8].data
);
534 n
+= InstSize
[n
[0].opcode
];
536 case OPCODE_COMPRESSED_TEX_IMAGE_3D
:
537 _mesa_free(n
[9].data
);
538 n
+= InstSize
[n
[0].opcode
];
540 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
:
541 _mesa_free(n
[7].data
);
542 n
+= InstSize
[n
[0].opcode
];
544 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
:
545 _mesa_free(n
[9].data
);
546 n
+= InstSize
[n
[0].opcode
];
548 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
:
549 _mesa_free(n
[11].data
);
550 n
+= InstSize
[n
[0].opcode
];
552 #if FEATURE_NV_vertex_program
553 case OPCODE_LOAD_PROGRAM_NV
:
554 _mesa_free(n
[4].data
); /* program string */
555 n
+= InstSize
[n
[0].opcode
];
557 case OPCODE_REQUEST_RESIDENT_PROGRAMS_NV
:
558 _mesa_free(n
[2].data
); /* array of program ids */
559 n
+= InstSize
[n
[0].opcode
];
562 #if FEATURE_NV_fragment_program
563 case OPCODE_PROGRAM_NAMED_PARAMETER_NV
:
564 _mesa_free(n
[3].data
); /* parameter name */
565 n
+= InstSize
[n
[0].opcode
];
568 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
569 case OPCODE_PROGRAM_STRING_ARB
:
570 _mesa_free(n
[4].data
); /* program string */
571 n
+= InstSize
[n
[0].opcode
];
574 case OPCODE_CONTINUE
:
575 n
= (Node
*) n
[1].next
;
579 case OPCODE_END_OF_LIST
:
584 /* Most frequent case */
585 n
+= InstSize
[n
[0].opcode
];
596 * Destroy a display list and remove from hash table.
597 * \param list - display list number
600 destroy_list(GLcontext
*ctx
, GLuint list
)
602 struct mesa_display_list
*dlist
;
607 dlist
= lookup_list(ctx
, list
);
611 _mesa_delete_list(ctx
, dlist
);
612 _mesa_HashRemove(ctx
->Shared
->DisplayList
, list
);
617 * Translate the nth element of list from type to GLuint.
620 translate_id(GLsizei n
, GLenum type
, const GLvoid
* list
)
632 bptr
= (GLbyte
*) list
;
633 return (GLuint
) *(bptr
+ n
);
634 case GL_UNSIGNED_BYTE
:
635 ubptr
= (GLubyte
*) list
;
636 return (GLuint
) *(ubptr
+ n
);
638 sptr
= (GLshort
*) list
;
639 return (GLuint
) *(sptr
+ n
);
640 case GL_UNSIGNED_SHORT
:
641 usptr
= (GLushort
*) list
;
642 return (GLuint
) *(usptr
+ n
);
644 iptr
= (GLint
*) list
;
645 return (GLuint
) *(iptr
+ n
);
646 case GL_UNSIGNED_INT
:
647 uiptr
= (GLuint
*) list
;
648 return (GLuint
) *(uiptr
+ n
);
650 fptr
= (GLfloat
*) list
;
651 return (GLuint
) *(fptr
+ n
);
653 ubptr
= ((GLubyte
*) list
) + 2 * n
;
654 return (GLuint
) *ubptr
* 256 + (GLuint
) * (ubptr
+ 1);
656 ubptr
= ((GLubyte
*) list
) + 3 * n
;
657 return (GLuint
) * ubptr
* 65536
658 + (GLuint
) *(ubptr
+ 1) * 256 + (GLuint
) * (ubptr
+ 2);
660 ubptr
= ((GLubyte
*) list
) + 4 * n
;
661 return (GLuint
) *ubptr
* 16777216
662 + (GLuint
) *(ubptr
+ 1) * 65536
663 + (GLuint
) *(ubptr
+ 2) * 256 + (GLuint
) * (ubptr
+ 3);
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_BlendColor(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
933 GET_CURRENT_CONTEXT(ctx
);
935 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
936 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BLEND_COLOR
, 4);
943 if (ctx
->ExecuteFlag
) {
944 CALL_BlendColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
950 _mesa_save_CallList(GLuint list
)
952 GET_CURRENT_CONTEXT(ctx
);
954 SAVE_FLUSH_VERTICES(ctx
);
956 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CALL_LIST
, 1);
961 /* After this, we don't know what begin/end state we're in:
963 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
965 if (ctx
->ExecuteFlag
) {
966 CALL_CallList(ctx
->Exec
, (list
));
972 _mesa_save_CallLists(GLsizei n
, GLenum type
, const GLvoid
* lists
)
974 GET_CURRENT_CONTEXT(ctx
);
976 GLboolean typeErrorFlag
;
978 SAVE_FLUSH_VERTICES(ctx
);
982 case GL_UNSIGNED_BYTE
:
984 case GL_UNSIGNED_SHORT
:
986 case GL_UNSIGNED_INT
:
991 typeErrorFlag
= GL_FALSE
;
994 typeErrorFlag
= GL_TRUE
;
997 for (i
= 0; i
< n
; i
++) {
998 GLuint list
= translate_id(i
, type
, lists
);
999 Node
*n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CALL_LIST_OFFSET
, 2);
1002 n
[2].b
= typeErrorFlag
;
1006 /* After this, we don't know what begin/end state we're in:
1008 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
1010 if (ctx
->ExecuteFlag
) {
1011 CALL_CallLists(ctx
->Exec
, (n
, type
, lists
));
1016 static void GLAPIENTRY
1017 save_Clear(GLbitfield mask
)
1019 GET_CURRENT_CONTEXT(ctx
);
1021 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1022 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLEAR
, 1);
1026 if (ctx
->ExecuteFlag
) {
1027 CALL_Clear(ctx
->Exec
, (mask
));
1032 static void GLAPIENTRY
1033 save_ClearAccum(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
1035 GET_CURRENT_CONTEXT(ctx
);
1037 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1038 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLEAR_ACCUM
, 4);
1045 if (ctx
->ExecuteFlag
) {
1046 CALL_ClearAccum(ctx
->Exec
, (red
, green
, blue
, alpha
));
1051 static void GLAPIENTRY
1052 save_ClearColor(GLclampf red
, GLclampf green
, GLclampf blue
, GLclampf alpha
)
1054 GET_CURRENT_CONTEXT(ctx
);
1056 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1057 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLEAR_COLOR
, 4);
1064 if (ctx
->ExecuteFlag
) {
1065 CALL_ClearColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
1070 static void GLAPIENTRY
1071 save_ClearDepth(GLclampd depth
)
1073 GET_CURRENT_CONTEXT(ctx
);
1075 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1076 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLEAR_DEPTH
, 1);
1078 n
[1].f
= (GLfloat
) depth
;
1080 if (ctx
->ExecuteFlag
) {
1081 CALL_ClearDepth(ctx
->Exec
, (depth
));
1086 static void GLAPIENTRY
1087 save_ClearIndex(GLfloat c
)
1089 GET_CURRENT_CONTEXT(ctx
);
1091 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1092 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLEAR_INDEX
, 1);
1096 if (ctx
->ExecuteFlag
) {
1097 CALL_ClearIndex(ctx
->Exec
, (c
));
1102 static void GLAPIENTRY
1103 save_ClearStencil(GLint s
)
1105 GET_CURRENT_CONTEXT(ctx
);
1107 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1108 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLEAR_STENCIL
, 1);
1112 if (ctx
->ExecuteFlag
) {
1113 CALL_ClearStencil(ctx
->Exec
, (s
));
1118 static void GLAPIENTRY
1119 save_ClipPlane(GLenum plane
, const GLdouble
* equ
)
1121 GET_CURRENT_CONTEXT(ctx
);
1123 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1124 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLIP_PLANE
, 5);
1127 n
[2].f
= (GLfloat
) equ
[0];
1128 n
[3].f
= (GLfloat
) equ
[1];
1129 n
[4].f
= (GLfloat
) equ
[2];
1130 n
[5].f
= (GLfloat
) equ
[3];
1132 if (ctx
->ExecuteFlag
) {
1133 CALL_ClipPlane(ctx
->Exec
, (plane
, equ
));
1139 static void GLAPIENTRY
1140 save_ColorMask(GLboolean red
, GLboolean green
,
1141 GLboolean blue
, GLboolean alpha
)
1143 GET_CURRENT_CONTEXT(ctx
);
1145 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1146 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COLOR_MASK
, 4);
1153 if (ctx
->ExecuteFlag
) {
1154 CALL_ColorMask(ctx
->Exec
, (red
, green
, blue
, alpha
));
1159 static void GLAPIENTRY
1160 save_ColorMaterial(GLenum face
, GLenum mode
)
1162 GET_CURRENT_CONTEXT(ctx
);
1164 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1166 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COLOR_MATERIAL
, 2);
1171 if (ctx
->ExecuteFlag
) {
1172 CALL_ColorMaterial(ctx
->Exec
, (face
, mode
));
1177 static void GLAPIENTRY
1178 save_ColorTable(GLenum target
, GLenum internalFormat
,
1179 GLsizei width
, GLenum format
, GLenum type
,
1180 const GLvoid
* table
)
1182 GET_CURRENT_CONTEXT(ctx
);
1183 if (_mesa_is_proxy_texture(target
)) {
1184 /* execute immediately */
1185 CALL_ColorTable(ctx
->Exec
, (target
, internalFormat
, width
,
1186 format
, type
, table
));
1189 GLvoid
*image
= unpack_image(1, width
, 1, 1, format
, type
, table
,
1192 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1193 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COLOR_TABLE
, 6);
1196 n
[2].e
= internalFormat
;
1205 if (ctx
->ExecuteFlag
) {
1206 CALL_ColorTable(ctx
->Exec
, (target
, internalFormat
, width
,
1207 format
, type
, table
));
1214 static void GLAPIENTRY
1215 save_ColorTableParameterfv(GLenum target
, GLenum pname
,
1216 const GLfloat
*params
)
1218 GET_CURRENT_CONTEXT(ctx
);
1221 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1223 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COLOR_TABLE_PARAMETER_FV
, 6);
1228 if (pname
== GL_COLOR_TABLE_SGI
||
1229 pname
== GL_POST_CONVOLUTION_COLOR_TABLE_SGI
||
1230 pname
== GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI
||
1231 pname
== GL_TEXTURE_COLOR_TABLE_SGI
) {
1238 if (ctx
->ExecuteFlag
) {
1239 CALL_ColorTableParameterfv(ctx
->Exec
, (target
, pname
, params
));
1244 static void GLAPIENTRY
1245 save_ColorTableParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
1247 GET_CURRENT_CONTEXT(ctx
);
1250 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1252 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COLOR_TABLE_PARAMETER_IV
, 6);
1257 if (pname
== GL_COLOR_TABLE_SGI
||
1258 pname
== GL_POST_CONVOLUTION_COLOR_TABLE_SGI
||
1259 pname
== GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI
||
1260 pname
== GL_TEXTURE_COLOR_TABLE_SGI
) {
1267 if (ctx
->ExecuteFlag
) {
1268 CALL_ColorTableParameteriv(ctx
->Exec
, (target
, pname
, params
));
1274 static void GLAPIENTRY
1275 save_ColorSubTable(GLenum target
, GLsizei start
, GLsizei count
,
1276 GLenum format
, GLenum type
, const GLvoid
* table
)
1278 GET_CURRENT_CONTEXT(ctx
);
1279 GLvoid
*image
= unpack_image(1, count
, 1, 1, format
, type
, table
,
1282 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1283 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COLOR_SUB_TABLE
, 6);
1295 if (ctx
->ExecuteFlag
) {
1296 CALL_ColorSubTable(ctx
->Exec
,
1297 (target
, start
, count
, format
, type
, table
));
1302 static void GLAPIENTRY
1303 save_CopyColorSubTable(GLenum target
, GLsizei start
,
1304 GLint x
, GLint y
, GLsizei width
)
1306 GET_CURRENT_CONTEXT(ctx
);
1309 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1310 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_COLOR_SUB_TABLE
, 5);
1318 if (ctx
->ExecuteFlag
) {
1319 CALL_CopyColorSubTable(ctx
->Exec
, (target
, start
, x
, y
, width
));
1324 static void GLAPIENTRY
1325 save_CopyColorTable(GLenum target
, GLenum internalformat
,
1326 GLint x
, GLint y
, GLsizei width
)
1328 GET_CURRENT_CONTEXT(ctx
);
1331 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1332 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_COLOR_TABLE
, 5);
1335 n
[2].e
= internalformat
;
1340 if (ctx
->ExecuteFlag
) {
1341 CALL_CopyColorTable(ctx
->Exec
, (target
, internalformat
, x
, y
, width
));
1346 static void GLAPIENTRY
1347 save_ConvolutionFilter1D(GLenum target
, GLenum internalFormat
, GLsizei width
,
1348 GLenum format
, GLenum type
, const GLvoid
* filter
)
1350 GET_CURRENT_CONTEXT(ctx
);
1351 GLvoid
*image
= unpack_image(1, width
, 1, 1, format
, type
, filter
,
1354 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1355 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CONVOLUTION_FILTER_1D
, 6);
1358 n
[2].e
= internalFormat
;
1367 if (ctx
->ExecuteFlag
) {
1368 CALL_ConvolutionFilter1D(ctx
->Exec
, (target
, internalFormat
, width
,
1369 format
, type
, filter
));
1374 static void GLAPIENTRY
1375 save_ConvolutionFilter2D(GLenum target
, GLenum internalFormat
,
1376 GLsizei width
, GLsizei height
, GLenum format
,
1377 GLenum type
, const GLvoid
* filter
)
1379 GET_CURRENT_CONTEXT(ctx
);
1380 GLvoid
*image
= unpack_image(2, width
, height
, 1, format
, type
, filter
,
1383 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1384 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CONVOLUTION_FILTER_2D
, 7);
1387 n
[2].e
= internalFormat
;
1397 if (ctx
->ExecuteFlag
) {
1398 CALL_ConvolutionFilter2D(ctx
->Exec
,
1399 (target
, internalFormat
, width
, height
, format
,
1405 static void GLAPIENTRY
1406 save_ConvolutionParameteri(GLenum target
, GLenum pname
, GLint param
)
1408 GET_CURRENT_CONTEXT(ctx
);
1410 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1411 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CONVOLUTION_PARAMETER_I
, 3);
1417 if (ctx
->ExecuteFlag
) {
1418 CALL_ConvolutionParameteri(ctx
->Exec
, (target
, pname
, param
));
1423 static void GLAPIENTRY
1424 save_ConvolutionParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
1426 GET_CURRENT_CONTEXT(ctx
);
1428 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1429 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CONVOLUTION_PARAMETER_IV
, 6);
1434 if (pname
== GL_CONVOLUTION_BORDER_COLOR
||
1435 pname
== GL_CONVOLUTION_FILTER_SCALE
||
1436 pname
== GL_CONVOLUTION_FILTER_BIAS
) {
1442 n
[4].i
= n
[5].i
= n
[6].i
= 0;
1445 if (ctx
->ExecuteFlag
) {
1446 CALL_ConvolutionParameteriv(ctx
->Exec
, (target
, pname
, params
));
1451 static void GLAPIENTRY
1452 save_ConvolutionParameterf(GLenum target
, GLenum pname
, GLfloat param
)
1454 GET_CURRENT_CONTEXT(ctx
);
1456 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1457 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CONVOLUTION_PARAMETER_F
, 3);
1463 if (ctx
->ExecuteFlag
) {
1464 CALL_ConvolutionParameterf(ctx
->Exec
, (target
, pname
, param
));
1469 static void GLAPIENTRY
1470 save_ConvolutionParameterfv(GLenum target
, GLenum pname
,
1471 const GLfloat
*params
)
1473 GET_CURRENT_CONTEXT(ctx
);
1475 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1476 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CONVOLUTION_PARAMETER_FV
, 6);
1481 if (pname
== GL_CONVOLUTION_BORDER_COLOR
||
1482 pname
== GL_CONVOLUTION_FILTER_SCALE
||
1483 pname
== GL_CONVOLUTION_FILTER_BIAS
) {
1489 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
1492 if (ctx
->ExecuteFlag
) {
1493 CALL_ConvolutionParameterfv(ctx
->Exec
, (target
, pname
, params
));
1498 static void GLAPIENTRY
1499 save_CopyPixels(GLint x
, GLint y
, GLsizei width
, GLsizei height
, GLenum type
)
1501 GET_CURRENT_CONTEXT(ctx
);
1503 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1504 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_PIXELS
, 5);
1508 n
[3].i
= (GLint
) width
;
1509 n
[4].i
= (GLint
) height
;
1512 if (ctx
->ExecuteFlag
) {
1513 CALL_CopyPixels(ctx
->Exec
, (x
, y
, width
, height
, type
));
1519 static void GLAPIENTRY
1520 save_CopyTexImage1D(GLenum target
, GLint level
, GLenum internalformat
,
1521 GLint x
, GLint y
, GLsizei width
, GLint border
)
1523 GET_CURRENT_CONTEXT(ctx
);
1525 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1526 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_TEX_IMAGE1D
, 7);
1530 n
[3].e
= internalformat
;
1536 if (ctx
->ExecuteFlag
) {
1537 CALL_CopyTexImage1D(ctx
->Exec
, (target
, level
, internalformat
,
1538 x
, y
, width
, border
));
1543 static void GLAPIENTRY
1544 save_CopyTexImage2D(GLenum target
, GLint level
,
1545 GLenum internalformat
,
1546 GLint x
, GLint y
, GLsizei width
,
1547 GLsizei height
, GLint border
)
1549 GET_CURRENT_CONTEXT(ctx
);
1551 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1552 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_TEX_IMAGE2D
, 8);
1556 n
[3].e
= internalformat
;
1563 if (ctx
->ExecuteFlag
) {
1564 CALL_CopyTexImage2D(ctx
->Exec
, (target
, level
, internalformat
,
1565 x
, y
, width
, height
, border
));
1571 static void GLAPIENTRY
1572 save_CopyTexSubImage1D(GLenum target
, GLint level
,
1573 GLint xoffset
, GLint x
, GLint y
, GLsizei width
)
1575 GET_CURRENT_CONTEXT(ctx
);
1577 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1578 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_TEX_SUB_IMAGE1D
, 6);
1587 if (ctx
->ExecuteFlag
) {
1588 CALL_CopyTexSubImage1D(ctx
->Exec
,
1589 (target
, level
, xoffset
, x
, y
, width
));
1594 static void GLAPIENTRY
1595 save_CopyTexSubImage2D(GLenum target
, GLint level
,
1596 GLint xoffset
, GLint yoffset
,
1597 GLint x
, GLint y
, GLsizei width
, GLint height
)
1599 GET_CURRENT_CONTEXT(ctx
);
1601 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1602 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_TEX_SUB_IMAGE2D
, 8);
1613 if (ctx
->ExecuteFlag
) {
1614 CALL_CopyTexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
1615 x
, y
, width
, height
));
1620 static void GLAPIENTRY
1621 save_CopyTexSubImage3D(GLenum target
, GLint level
,
1622 GLint xoffset
, GLint yoffset
, GLint zoffset
,
1623 GLint x
, GLint y
, GLsizei width
, GLint height
)
1625 GET_CURRENT_CONTEXT(ctx
);
1627 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1628 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_TEX_SUB_IMAGE3D
, 9);
1640 if (ctx
->ExecuteFlag
) {
1641 CALL_CopyTexSubImage3D(ctx
->Exec
, (target
, level
,
1642 xoffset
, yoffset
, zoffset
,
1643 x
, y
, width
, height
));
1648 static void GLAPIENTRY
1649 save_CullFace(GLenum mode
)
1651 GET_CURRENT_CONTEXT(ctx
);
1653 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1654 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CULL_FACE
, 1);
1658 if (ctx
->ExecuteFlag
) {
1659 CALL_CullFace(ctx
->Exec
, (mode
));
1664 static void GLAPIENTRY
1665 save_DepthFunc(GLenum func
)
1667 GET_CURRENT_CONTEXT(ctx
);
1669 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1670 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DEPTH_FUNC
, 1);
1674 if (ctx
->ExecuteFlag
) {
1675 CALL_DepthFunc(ctx
->Exec
, (func
));
1680 static void GLAPIENTRY
1681 save_DepthMask(GLboolean mask
)
1683 GET_CURRENT_CONTEXT(ctx
);
1685 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1686 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DEPTH_MASK
, 1);
1690 if (ctx
->ExecuteFlag
) {
1691 CALL_DepthMask(ctx
->Exec
, (mask
));
1696 static void GLAPIENTRY
1697 save_DepthRange(GLclampd nearval
, GLclampd farval
)
1699 GET_CURRENT_CONTEXT(ctx
);
1701 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1702 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DEPTH_RANGE
, 2);
1704 n
[1].f
= (GLfloat
) nearval
;
1705 n
[2].f
= (GLfloat
) farval
;
1707 if (ctx
->ExecuteFlag
) {
1708 CALL_DepthRange(ctx
->Exec
, (nearval
, farval
));
1713 static void GLAPIENTRY
1714 save_Disable(GLenum cap
)
1716 GET_CURRENT_CONTEXT(ctx
);
1718 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1719 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DISABLE
, 1);
1723 if (ctx
->ExecuteFlag
) {
1724 CALL_Disable(ctx
->Exec
, (cap
));
1729 static void GLAPIENTRY
1730 save_DrawBuffer(GLenum mode
)
1732 GET_CURRENT_CONTEXT(ctx
);
1734 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1735 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DRAW_BUFFER
, 1);
1739 if (ctx
->ExecuteFlag
) {
1740 CALL_DrawBuffer(ctx
->Exec
, (mode
));
1745 static void GLAPIENTRY
1746 save_DrawPixels(GLsizei width
, GLsizei height
,
1747 GLenum format
, GLenum type
, const GLvoid
* pixels
)
1749 GET_CURRENT_CONTEXT(ctx
);
1750 GLvoid
*image
= unpack_image(2, width
, height
, 1, format
, type
,
1751 pixels
, &ctx
->Unpack
);
1753 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1754 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DRAW_PIXELS
, 5);
1765 if (ctx
->ExecuteFlag
) {
1766 CALL_DrawPixels(ctx
->Exec
, (width
, height
, format
, type
, pixels
));
1772 static void GLAPIENTRY
1773 save_Enable(GLenum cap
)
1775 GET_CURRENT_CONTEXT(ctx
);
1777 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1778 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ENABLE
, 1);
1782 if (ctx
->ExecuteFlag
) {
1783 CALL_Enable(ctx
->Exec
, (cap
));
1789 static void GLAPIENTRY
1790 _mesa_save_EvalMesh1(GLenum mode
, GLint i1
, GLint i2
)
1792 GET_CURRENT_CONTEXT(ctx
);
1794 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1795 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVALMESH1
, 3);
1801 if (ctx
->ExecuteFlag
) {
1802 CALL_EvalMesh1(ctx
->Exec
, (mode
, i1
, i2
));
1807 static void GLAPIENTRY
1808 _mesa_save_EvalMesh2(GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
1810 GET_CURRENT_CONTEXT(ctx
);
1812 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1813 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVALMESH2
, 5);
1821 if (ctx
->ExecuteFlag
) {
1822 CALL_EvalMesh2(ctx
->Exec
, (mode
, i1
, i2
, j1
, j2
));
1829 static void GLAPIENTRY
1830 save_Fogfv(GLenum pname
, const GLfloat
*params
)
1832 GET_CURRENT_CONTEXT(ctx
);
1834 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1835 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_FOG
, 5);
1843 if (ctx
->ExecuteFlag
) {
1844 CALL_Fogfv(ctx
->Exec
, (pname
, params
));
1849 static void GLAPIENTRY
1850 save_Fogf(GLenum pname
, GLfloat param
)
1852 save_Fogfv(pname
, ¶m
);
1856 static void GLAPIENTRY
1857 save_Fogiv(GLenum pname
, const GLint
*params
)
1862 case GL_FOG_DENSITY
:
1866 p
[0] = (GLfloat
) *params
;
1869 p
[0] = INT_TO_FLOAT(params
[0]);
1870 p
[1] = INT_TO_FLOAT(params
[1]);
1871 p
[2] = INT_TO_FLOAT(params
[2]);
1872 p
[3] = INT_TO_FLOAT(params
[3]);
1875 /* Error will be caught later in gl_Fogfv */
1878 save_Fogfv(pname
, p
);
1882 static void GLAPIENTRY
1883 save_Fogi(GLenum pname
, GLint param
)
1885 save_Fogiv(pname
, ¶m
);
1889 static void GLAPIENTRY
1890 save_FrontFace(GLenum mode
)
1892 GET_CURRENT_CONTEXT(ctx
);
1894 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1895 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_FRONT_FACE
, 1);
1899 if (ctx
->ExecuteFlag
) {
1900 CALL_FrontFace(ctx
->Exec
, (mode
));
1905 static void GLAPIENTRY
1906 save_Frustum(GLdouble left
, GLdouble right
,
1907 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
1909 GET_CURRENT_CONTEXT(ctx
);
1911 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1912 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_FRUSTUM
, 6);
1914 n
[1].f
= (GLfloat
) left
;
1915 n
[2].f
= (GLfloat
) right
;
1916 n
[3].f
= (GLfloat
) bottom
;
1917 n
[4].f
= (GLfloat
) top
;
1918 n
[5].f
= (GLfloat
) nearval
;
1919 n
[6].f
= (GLfloat
) farval
;
1921 if (ctx
->ExecuteFlag
) {
1922 CALL_Frustum(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
1927 static void GLAPIENTRY
1928 save_Hint(GLenum target
, GLenum mode
)
1930 GET_CURRENT_CONTEXT(ctx
);
1932 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1933 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_HINT
, 2);
1938 if (ctx
->ExecuteFlag
) {
1939 CALL_Hint(ctx
->Exec
, (target
, mode
));
1944 static void GLAPIENTRY
1945 save_Histogram(GLenum target
, GLsizei width
, GLenum internalFormat
,
1948 GET_CURRENT_CONTEXT(ctx
);
1951 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1952 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_HISTOGRAM
, 4);
1956 n
[3].e
= internalFormat
;
1959 if (ctx
->ExecuteFlag
) {
1960 CALL_Histogram(ctx
->Exec
, (target
, width
, internalFormat
, sink
));
1965 static void GLAPIENTRY
1966 save_IndexMask(GLuint mask
)
1968 GET_CURRENT_CONTEXT(ctx
);
1970 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1971 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_INDEX_MASK
, 1);
1975 if (ctx
->ExecuteFlag
) {
1976 CALL_IndexMask(ctx
->Exec
, (mask
));
1981 static void GLAPIENTRY
1982 save_InitNames(void)
1984 GET_CURRENT_CONTEXT(ctx
);
1985 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1986 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_INIT_NAMES
, 0);
1987 if (ctx
->ExecuteFlag
) {
1988 CALL_InitNames(ctx
->Exec
, ());
1993 static void GLAPIENTRY
1994 save_Lightfv(GLenum light
, GLenum pname
, const GLfloat
*params
)
1996 GET_CURRENT_CONTEXT(ctx
);
1998 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1999 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LIGHT
, 6);
2017 case GL_SPOT_DIRECTION
:
2020 case GL_SPOT_EXPONENT
:
2023 case GL_SPOT_CUTOFF
:
2026 case GL_CONSTANT_ATTENUATION
:
2029 case GL_LINEAR_ATTENUATION
:
2032 case GL_QUADRATIC_ATTENUATION
:
2038 for (i
= 0; i
< nParams
; i
++) {
2039 n
[3 + i
].f
= params
[i
];
2042 if (ctx
->ExecuteFlag
) {
2043 CALL_Lightfv(ctx
->Exec
, (light
, pname
, params
));
2048 static void GLAPIENTRY
2049 save_Lightf(GLenum light
, GLenum pname
, GLfloat params
)
2051 save_Lightfv(light
, pname
, ¶ms
);
2055 static void GLAPIENTRY
2056 save_Lightiv(GLenum light
, GLenum pname
, const GLint
*params
)
2063 fparam
[0] = INT_TO_FLOAT(params
[0]);
2064 fparam
[1] = INT_TO_FLOAT(params
[1]);
2065 fparam
[2] = INT_TO_FLOAT(params
[2]);
2066 fparam
[3] = INT_TO_FLOAT(params
[3]);
2069 fparam
[0] = (GLfloat
) params
[0];
2070 fparam
[1] = (GLfloat
) params
[1];
2071 fparam
[2] = (GLfloat
) params
[2];
2072 fparam
[3] = (GLfloat
) params
[3];
2074 case GL_SPOT_DIRECTION
:
2075 fparam
[0] = (GLfloat
) params
[0];
2076 fparam
[1] = (GLfloat
) params
[1];
2077 fparam
[2] = (GLfloat
) params
[2];
2079 case GL_SPOT_EXPONENT
:
2080 case GL_SPOT_CUTOFF
:
2081 case GL_CONSTANT_ATTENUATION
:
2082 case GL_LINEAR_ATTENUATION
:
2083 case GL_QUADRATIC_ATTENUATION
:
2084 fparam
[0] = (GLfloat
) params
[0];
2087 /* error will be caught later in gl_Lightfv */
2090 save_Lightfv(light
, pname
, fparam
);
2094 static void GLAPIENTRY
2095 save_Lighti(GLenum light
, GLenum pname
, GLint param
)
2097 save_Lightiv(light
, pname
, ¶m
);
2101 static void GLAPIENTRY
2102 save_LightModelfv(GLenum pname
, const GLfloat
*params
)
2104 GET_CURRENT_CONTEXT(ctx
);
2106 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2107 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LIGHT_MODEL
, 5);
2115 if (ctx
->ExecuteFlag
) {
2116 CALL_LightModelfv(ctx
->Exec
, (pname
, params
));
2121 static void GLAPIENTRY
2122 save_LightModelf(GLenum pname
, GLfloat param
)
2124 save_LightModelfv(pname
, ¶m
);
2128 static void GLAPIENTRY
2129 save_LightModeliv(GLenum pname
, const GLint
*params
)
2133 case GL_LIGHT_MODEL_AMBIENT
:
2134 fparam
[0] = INT_TO_FLOAT(params
[0]);
2135 fparam
[1] = INT_TO_FLOAT(params
[1]);
2136 fparam
[2] = INT_TO_FLOAT(params
[2]);
2137 fparam
[3] = INT_TO_FLOAT(params
[3]);
2139 case GL_LIGHT_MODEL_LOCAL_VIEWER
:
2140 case GL_LIGHT_MODEL_TWO_SIDE
:
2141 case GL_LIGHT_MODEL_COLOR_CONTROL
:
2142 fparam
[0] = (GLfloat
) params
[0];
2145 /* Error will be caught later in gl_LightModelfv */
2148 save_LightModelfv(pname
, fparam
);
2152 static void GLAPIENTRY
2153 save_LightModeli(GLenum pname
, GLint param
)
2155 save_LightModeliv(pname
, ¶m
);
2159 static void GLAPIENTRY
2160 save_LineStipple(GLint factor
, GLushort pattern
)
2162 GET_CURRENT_CONTEXT(ctx
);
2164 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2165 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LINE_STIPPLE
, 2);
2170 if (ctx
->ExecuteFlag
) {
2171 CALL_LineStipple(ctx
->Exec
, (factor
, pattern
));
2176 static void GLAPIENTRY
2177 save_LineWidth(GLfloat width
)
2179 GET_CURRENT_CONTEXT(ctx
);
2181 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2182 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LINE_WIDTH
, 1);
2186 if (ctx
->ExecuteFlag
) {
2187 CALL_LineWidth(ctx
->Exec
, (width
));
2192 static void GLAPIENTRY
2193 save_ListBase(GLuint base
)
2195 GET_CURRENT_CONTEXT(ctx
);
2197 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2198 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LIST_BASE
, 1);
2202 if (ctx
->ExecuteFlag
) {
2203 CALL_ListBase(ctx
->Exec
, (base
));
2208 static void GLAPIENTRY
2209 save_LoadIdentity(void)
2211 GET_CURRENT_CONTEXT(ctx
);
2212 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2213 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_LOAD_IDENTITY
, 0);
2214 if (ctx
->ExecuteFlag
) {
2215 CALL_LoadIdentity(ctx
->Exec
, ());
2220 static void GLAPIENTRY
2221 save_LoadMatrixf(const GLfloat
* m
)
2223 GET_CURRENT_CONTEXT(ctx
);
2225 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2226 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LOAD_MATRIX
, 16);
2229 for (i
= 0; i
< 16; i
++) {
2233 if (ctx
->ExecuteFlag
) {
2234 CALL_LoadMatrixf(ctx
->Exec
, (m
));
2239 static void GLAPIENTRY
2240 save_LoadMatrixd(const GLdouble
* m
)
2244 for (i
= 0; i
< 16; i
++) {
2245 f
[i
] = (GLfloat
) m
[i
];
2247 save_LoadMatrixf(f
);
2251 static void GLAPIENTRY
2252 save_LoadName(GLuint name
)
2254 GET_CURRENT_CONTEXT(ctx
);
2256 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2257 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LOAD_NAME
, 1);
2261 if (ctx
->ExecuteFlag
) {
2262 CALL_LoadName(ctx
->Exec
, (name
));
2267 static void GLAPIENTRY
2268 save_LogicOp(GLenum opcode
)
2270 GET_CURRENT_CONTEXT(ctx
);
2272 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2273 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LOGIC_OP
, 1);
2277 if (ctx
->ExecuteFlag
) {
2278 CALL_LogicOp(ctx
->Exec
, (opcode
));
2283 static void GLAPIENTRY
2284 save_Map1d(GLenum target
, GLdouble u1
, GLdouble u2
, GLint stride
,
2285 GLint order
, const GLdouble
* points
)
2287 GET_CURRENT_CONTEXT(ctx
);
2289 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2290 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MAP1
, 6);
2292 GLfloat
*pnts
= _mesa_copy_map_points1d(target
, stride
, order
, points
);
2294 n
[2].f
= (GLfloat
) u1
;
2295 n
[3].f
= (GLfloat
) u2
;
2296 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2298 n
[6].data
= (void *) pnts
;
2300 if (ctx
->ExecuteFlag
) {
2301 CALL_Map1d(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2305 static void GLAPIENTRY
2306 save_Map1f(GLenum target
, GLfloat u1
, GLfloat u2
, GLint stride
,
2307 GLint order
, const GLfloat
* points
)
2309 GET_CURRENT_CONTEXT(ctx
);
2311 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2312 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MAP1
, 6);
2314 GLfloat
*pnts
= _mesa_copy_map_points1f(target
, stride
, order
, points
);
2318 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2320 n
[6].data
= (void *) pnts
;
2322 if (ctx
->ExecuteFlag
) {
2323 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2328 static void GLAPIENTRY
2329 save_Map2d(GLenum target
,
2330 GLdouble u1
, GLdouble u2
, GLint ustride
, GLint uorder
,
2331 GLdouble v1
, GLdouble v2
, GLint vstride
, GLint vorder
,
2332 const GLdouble
* points
)
2334 GET_CURRENT_CONTEXT(ctx
);
2336 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2337 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MAP2
, 10);
2339 GLfloat
*pnts
= _mesa_copy_map_points2d(target
, ustride
, uorder
,
2340 vstride
, vorder
, points
);
2342 n
[2].f
= (GLfloat
) u1
;
2343 n
[3].f
= (GLfloat
) u2
;
2344 n
[4].f
= (GLfloat
) v1
;
2345 n
[5].f
= (GLfloat
) v2
;
2346 /* XXX verify these strides are correct */
2347 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2348 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2351 n
[10].data
= (void *) pnts
;
2353 if (ctx
->ExecuteFlag
) {
2354 CALL_Map2d(ctx
->Exec
, (target
,
2355 u1
, u2
, ustride
, uorder
,
2356 v1
, v2
, vstride
, vorder
, points
));
2361 static void GLAPIENTRY
2362 save_Map2f(GLenum target
,
2363 GLfloat u1
, GLfloat u2
, GLint ustride
, GLint uorder
,
2364 GLfloat v1
, GLfloat v2
, GLint vstride
, GLint vorder
,
2365 const GLfloat
* points
)
2367 GET_CURRENT_CONTEXT(ctx
);
2369 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2370 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MAP2
, 10);
2372 GLfloat
*pnts
= _mesa_copy_map_points2f(target
, ustride
, uorder
,
2373 vstride
, vorder
, points
);
2379 /* XXX verify these strides are correct */
2380 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2381 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2384 n
[10].data
= (void *) pnts
;
2386 if (ctx
->ExecuteFlag
) {
2387 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
2388 v1
, v2
, vstride
, vorder
, points
));
2393 static void GLAPIENTRY
2394 save_MapGrid1f(GLint un
, GLfloat u1
, GLfloat u2
)
2396 GET_CURRENT_CONTEXT(ctx
);
2398 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2399 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MAPGRID1
, 3);
2405 if (ctx
->ExecuteFlag
) {
2406 CALL_MapGrid1f(ctx
->Exec
, (un
, u1
, u2
));
2411 static void GLAPIENTRY
2412 save_MapGrid1d(GLint un
, GLdouble u1
, GLdouble u2
)
2414 save_MapGrid1f(un
, (GLfloat
) u1
, (GLfloat
) u2
);
2418 static void GLAPIENTRY
2419 save_MapGrid2f(GLint un
, GLfloat u1
, GLfloat u2
,
2420 GLint vn
, GLfloat v1
, GLfloat v2
)
2422 GET_CURRENT_CONTEXT(ctx
);
2424 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2425 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MAPGRID2
, 6);
2434 if (ctx
->ExecuteFlag
) {
2435 CALL_MapGrid2f(ctx
->Exec
, (un
, u1
, u2
, vn
, v1
, v2
));
2441 static void GLAPIENTRY
2442 save_MapGrid2d(GLint un
, GLdouble u1
, GLdouble u2
,
2443 GLint vn
, GLdouble v1
, GLdouble v2
)
2445 save_MapGrid2f(un
, (GLfloat
) u1
, (GLfloat
) u2
,
2446 vn
, (GLfloat
) v1
, (GLfloat
) v2
);
2450 static void GLAPIENTRY
2451 save_MatrixMode(GLenum mode
)
2453 GET_CURRENT_CONTEXT(ctx
);
2455 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2456 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MATRIX_MODE
, 1);
2460 if (ctx
->ExecuteFlag
) {
2461 CALL_MatrixMode(ctx
->Exec
, (mode
));
2466 static void GLAPIENTRY
2467 save_Minmax(GLenum target
, GLenum internalFormat
, GLboolean sink
)
2469 GET_CURRENT_CONTEXT(ctx
);
2472 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2473 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MIN_MAX
, 3);
2476 n
[2].e
= internalFormat
;
2479 if (ctx
->ExecuteFlag
) {
2480 CALL_Minmax(ctx
->Exec
, (target
, internalFormat
, sink
));
2485 static void GLAPIENTRY
2486 save_MultMatrixf(const GLfloat
* m
)
2488 GET_CURRENT_CONTEXT(ctx
);
2490 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2491 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MULT_MATRIX
, 16);
2494 for (i
= 0; i
< 16; i
++) {
2498 if (ctx
->ExecuteFlag
) {
2499 CALL_MultMatrixf(ctx
->Exec
, (m
));
2504 static void GLAPIENTRY
2505 save_MultMatrixd(const GLdouble
* m
)
2509 for (i
= 0; i
< 16; i
++) {
2510 f
[i
] = (GLfloat
) m
[i
];
2512 save_MultMatrixf(f
);
2516 static void GLAPIENTRY
2517 save_NewList(GLuint list
, GLenum mode
)
2519 GET_CURRENT_CONTEXT(ctx
);
2520 /* It's an error to call this function while building a display list */
2521 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
2528 static void GLAPIENTRY
2529 save_Ortho(GLdouble left
, GLdouble right
,
2530 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
2532 GET_CURRENT_CONTEXT(ctx
);
2534 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2535 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ORTHO
, 6);
2537 n
[1].f
= (GLfloat
) left
;
2538 n
[2].f
= (GLfloat
) right
;
2539 n
[3].f
= (GLfloat
) bottom
;
2540 n
[4].f
= (GLfloat
) top
;
2541 n
[5].f
= (GLfloat
) nearval
;
2542 n
[6].f
= (GLfloat
) farval
;
2544 if (ctx
->ExecuteFlag
) {
2545 CALL_Ortho(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
2550 static void GLAPIENTRY
2551 save_PixelMapfv(GLenum map
, GLint mapsize
, const GLfloat
*values
)
2553 GET_CURRENT_CONTEXT(ctx
);
2555 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2556 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PIXEL_MAP
, 3);
2560 n
[3].data
= (void *) _mesa_malloc(mapsize
* sizeof(GLfloat
));
2561 MEMCPY(n
[3].data
, (void *) values
, mapsize
* sizeof(GLfloat
));
2563 if (ctx
->ExecuteFlag
) {
2564 CALL_PixelMapfv(ctx
->Exec
, (map
, mapsize
, values
));
2569 static void GLAPIENTRY
2570 save_PixelMapuiv(GLenum map
, GLint mapsize
, const GLuint
*values
)
2572 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2574 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
2575 for (i
= 0; i
< mapsize
; i
++) {
2576 fvalues
[i
] = (GLfloat
) values
[i
];
2580 for (i
= 0; i
< mapsize
; i
++) {
2581 fvalues
[i
] = UINT_TO_FLOAT(values
[i
]);
2584 save_PixelMapfv(map
, mapsize
, fvalues
);
2588 static void GLAPIENTRY
2589 save_PixelMapusv(GLenum map
, GLint mapsize
, const GLushort
*values
)
2591 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2593 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
2594 for (i
= 0; i
< mapsize
; i
++) {
2595 fvalues
[i
] = (GLfloat
) values
[i
];
2599 for (i
= 0; i
< mapsize
; i
++) {
2600 fvalues
[i
] = USHORT_TO_FLOAT(values
[i
]);
2603 save_PixelMapfv(map
, mapsize
, fvalues
);
2607 static void GLAPIENTRY
2608 save_PixelTransferf(GLenum pname
, GLfloat param
)
2610 GET_CURRENT_CONTEXT(ctx
);
2612 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2613 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PIXEL_TRANSFER
, 2);
2618 if (ctx
->ExecuteFlag
) {
2619 CALL_PixelTransferf(ctx
->Exec
, (pname
, param
));
2624 static void GLAPIENTRY
2625 save_PixelTransferi(GLenum pname
, GLint param
)
2627 save_PixelTransferf(pname
, (GLfloat
) param
);
2631 static void GLAPIENTRY
2632 save_PixelZoom(GLfloat xfactor
, GLfloat yfactor
)
2634 GET_CURRENT_CONTEXT(ctx
);
2636 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2637 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PIXEL_ZOOM
, 2);
2642 if (ctx
->ExecuteFlag
) {
2643 CALL_PixelZoom(ctx
->Exec
, (xfactor
, yfactor
));
2648 static void GLAPIENTRY
2649 save_PointParameterfvEXT(GLenum pname
, const GLfloat
*params
)
2651 GET_CURRENT_CONTEXT(ctx
);
2653 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2654 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_POINT_PARAMETERS
, 4);
2661 if (ctx
->ExecuteFlag
) {
2662 CALL_PointParameterfvEXT(ctx
->Exec
, (pname
, params
));
2667 static void GLAPIENTRY
2668 save_PointParameterfEXT(GLenum pname
, GLfloat param
)
2670 save_PointParameterfvEXT(pname
, ¶m
);
2673 static void GLAPIENTRY
2674 save_PointParameteriNV(GLenum pname
, GLint param
)
2676 GLfloat p
= (GLfloat
) param
;
2677 save_PointParameterfvEXT(pname
, &p
);
2680 static void GLAPIENTRY
2681 save_PointParameterivNV(GLenum pname
, const GLint
* param
)
2683 GLfloat p
= (GLfloat
) param
[0];
2684 save_PointParameterfvEXT(pname
, &p
);
2688 static void GLAPIENTRY
2689 save_PointSize(GLfloat size
)
2691 GET_CURRENT_CONTEXT(ctx
);
2693 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2694 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_POINT_SIZE
, 1);
2698 if (ctx
->ExecuteFlag
) {
2699 CALL_PointSize(ctx
->Exec
, (size
));
2704 static void GLAPIENTRY
2705 save_PolygonMode(GLenum face
, GLenum mode
)
2707 GET_CURRENT_CONTEXT(ctx
);
2709 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2710 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_POLYGON_MODE
, 2);
2715 if (ctx
->ExecuteFlag
) {
2716 CALL_PolygonMode(ctx
->Exec
, (face
, mode
));
2722 * Polygon stipple must have been upacked already!
2724 static void GLAPIENTRY
2725 save_PolygonStipple(const GLubyte
* pattern
)
2727 GET_CURRENT_CONTEXT(ctx
);
2729 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2730 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_POLYGON_STIPPLE
, 1);
2733 n
[1].data
= _mesa_malloc(32 * 4);
2734 data
= n
[1].data
; /* This needed for Acorn compiler */
2735 MEMCPY(data
, pattern
, 32 * 4);
2737 if (ctx
->ExecuteFlag
) {
2738 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) pattern
));
2743 static void GLAPIENTRY
2744 save_PolygonOffset(GLfloat factor
, GLfloat units
)
2746 GET_CURRENT_CONTEXT(ctx
);
2748 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2749 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_POLYGON_OFFSET
, 2);
2754 if (ctx
->ExecuteFlag
) {
2755 CALL_PolygonOffset(ctx
->Exec
, (factor
, units
));
2760 static void GLAPIENTRY
2761 save_PolygonOffsetEXT(GLfloat factor
, GLfloat bias
)
2763 GET_CURRENT_CONTEXT(ctx
);
2764 /* XXX mult by DepthMaxF here??? */
2765 save_PolygonOffset(factor
, ctx
->DrawBuffer
->_DepthMaxF
* bias
);
2769 static void GLAPIENTRY
2770 save_PopAttrib(void)
2772 GET_CURRENT_CONTEXT(ctx
);
2773 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2774 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_POP_ATTRIB
, 0);
2775 if (ctx
->ExecuteFlag
) {
2776 CALL_PopAttrib(ctx
->Exec
, ());
2781 static void GLAPIENTRY
2782 save_PopMatrix(void)
2784 GET_CURRENT_CONTEXT(ctx
);
2785 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2786 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_POP_MATRIX
, 0);
2787 if (ctx
->ExecuteFlag
) {
2788 CALL_PopMatrix(ctx
->Exec
, ());
2793 static void GLAPIENTRY
2796 GET_CURRENT_CONTEXT(ctx
);
2797 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2798 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_POP_NAME
, 0);
2799 if (ctx
->ExecuteFlag
) {
2800 CALL_PopName(ctx
->Exec
, ());
2805 static void GLAPIENTRY
2806 save_PrioritizeTextures(GLsizei num
, const GLuint
* textures
,
2807 const GLclampf
* priorities
)
2809 GET_CURRENT_CONTEXT(ctx
);
2811 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2813 for (i
= 0; i
< num
; i
++) {
2815 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PRIORITIZE_TEXTURE
, 2);
2817 n
[1].ui
= textures
[i
];
2818 n
[2].f
= priorities
[i
];
2821 if (ctx
->ExecuteFlag
) {
2822 CALL_PrioritizeTextures(ctx
->Exec
, (num
, textures
, priorities
));
2827 static void GLAPIENTRY
2828 save_PushAttrib(GLbitfield mask
)
2830 GET_CURRENT_CONTEXT(ctx
);
2832 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2833 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PUSH_ATTRIB
, 1);
2837 if (ctx
->ExecuteFlag
) {
2838 CALL_PushAttrib(ctx
->Exec
, (mask
));
2843 static void GLAPIENTRY
2844 save_PushMatrix(void)
2846 GET_CURRENT_CONTEXT(ctx
);
2847 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2848 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_PUSH_MATRIX
, 0);
2849 if (ctx
->ExecuteFlag
) {
2850 CALL_PushMatrix(ctx
->Exec
, ());
2855 static void GLAPIENTRY
2856 save_PushName(GLuint name
)
2858 GET_CURRENT_CONTEXT(ctx
);
2860 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2861 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PUSH_NAME
, 1);
2865 if (ctx
->ExecuteFlag
) {
2866 CALL_PushName(ctx
->Exec
, (name
));
2871 static void GLAPIENTRY
2872 save_RasterPos4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
2874 GET_CURRENT_CONTEXT(ctx
);
2876 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2877 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_RASTER_POS
, 4);
2884 if (ctx
->ExecuteFlag
) {
2885 CALL_RasterPos4f(ctx
->Exec
, (x
, y
, z
, w
));
2889 static void GLAPIENTRY
2890 save_RasterPos2d(GLdouble x
, GLdouble y
)
2892 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
2895 static void GLAPIENTRY
2896 save_RasterPos2f(GLfloat x
, GLfloat y
)
2898 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2901 static void GLAPIENTRY
2902 save_RasterPos2i(GLint x
, GLint y
)
2904 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
2907 static void GLAPIENTRY
2908 save_RasterPos2s(GLshort x
, GLshort y
)
2910 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2913 static void GLAPIENTRY
2914 save_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
2916 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
2919 static void GLAPIENTRY
2920 save_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
2922 save_RasterPos4f(x
, y
, z
, 1.0F
);
2925 static void GLAPIENTRY
2926 save_RasterPos3i(GLint x
, GLint y
, GLint z
)
2928 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
2931 static void GLAPIENTRY
2932 save_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
2934 save_RasterPos4f(x
, y
, z
, 1.0F
);
2937 static void GLAPIENTRY
2938 save_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
2940 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
2943 static void GLAPIENTRY
2944 save_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
2946 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
2949 static void GLAPIENTRY
2950 save_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
2952 save_RasterPos4f(x
, y
, z
, w
);
2955 static void GLAPIENTRY
2956 save_RasterPos2dv(const GLdouble
* v
)
2958 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
2961 static void GLAPIENTRY
2962 save_RasterPos2fv(const GLfloat
* v
)
2964 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2967 static void GLAPIENTRY
2968 save_RasterPos2iv(const GLint
* v
)
2970 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
2973 static void GLAPIENTRY
2974 save_RasterPos2sv(const GLshort
* v
)
2976 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2979 static void GLAPIENTRY
2980 save_RasterPos3dv(const GLdouble
* v
)
2982 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
2985 static void GLAPIENTRY
2986 save_RasterPos3fv(const GLfloat
* v
)
2988 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2991 static void GLAPIENTRY
2992 save_RasterPos3iv(const GLint
* v
)
2994 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
2997 static void GLAPIENTRY
2998 save_RasterPos3sv(const GLshort
* v
)
3000 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3003 static void GLAPIENTRY
3004 save_RasterPos4dv(const GLdouble
* v
)
3006 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3007 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3010 static void GLAPIENTRY
3011 save_RasterPos4fv(const GLfloat
* v
)
3013 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3016 static void GLAPIENTRY
3017 save_RasterPos4iv(const GLint
* v
)
3019 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3020 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3023 static void GLAPIENTRY
3024 save_RasterPos4sv(const GLshort
* v
)
3026 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3030 static void GLAPIENTRY
3031 save_PassThrough(GLfloat token
)
3033 GET_CURRENT_CONTEXT(ctx
);
3035 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3036 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PASSTHROUGH
, 1);
3040 if (ctx
->ExecuteFlag
) {
3041 CALL_PassThrough(ctx
->Exec
, (token
));
3046 static void GLAPIENTRY
3047 save_ReadBuffer(GLenum mode
)
3049 GET_CURRENT_CONTEXT(ctx
);
3051 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3052 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_READ_BUFFER
, 1);
3056 if (ctx
->ExecuteFlag
) {
3057 CALL_ReadBuffer(ctx
->Exec
, (mode
));
3062 static void GLAPIENTRY
3063 save_ResetHistogram(GLenum target
)
3065 GET_CURRENT_CONTEXT(ctx
);
3067 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3068 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_RESET_HISTOGRAM
, 1);
3072 if (ctx
->ExecuteFlag
) {
3073 CALL_ResetHistogram(ctx
->Exec
, (target
));
3078 static void GLAPIENTRY
3079 save_ResetMinmax(GLenum target
)
3081 GET_CURRENT_CONTEXT(ctx
);
3083 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3084 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_RESET_MIN_MAX
, 1);
3088 if (ctx
->ExecuteFlag
) {
3089 CALL_ResetMinmax(ctx
->Exec
, (target
));
3094 static void GLAPIENTRY
3095 save_Rotatef(GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
3097 GET_CURRENT_CONTEXT(ctx
);
3099 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3100 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ROTATE
, 4);
3107 if (ctx
->ExecuteFlag
) {
3108 CALL_Rotatef(ctx
->Exec
, (angle
, x
, y
, z
));
3113 static void GLAPIENTRY
3114 save_Rotated(GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
3116 save_Rotatef((GLfloat
) angle
, (GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3120 static void GLAPIENTRY
3121 save_Scalef(GLfloat x
, GLfloat y
, GLfloat z
)
3123 GET_CURRENT_CONTEXT(ctx
);
3125 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3126 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SCALE
, 3);
3132 if (ctx
->ExecuteFlag
) {
3133 CALL_Scalef(ctx
->Exec
, (x
, y
, z
));
3138 static void GLAPIENTRY
3139 save_Scaled(GLdouble x
, GLdouble y
, GLdouble z
)
3141 save_Scalef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3145 static void GLAPIENTRY
3146 save_Scissor(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3148 GET_CURRENT_CONTEXT(ctx
);
3150 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3151 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SCISSOR
, 4);
3158 if (ctx
->ExecuteFlag
) {
3159 CALL_Scissor(ctx
->Exec
, (x
, y
, width
, height
));
3164 static void GLAPIENTRY
3165 save_ShadeModel(GLenum mode
)
3167 GET_CURRENT_CONTEXT(ctx
);
3169 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3170 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SHADE_MODEL
, 1);
3174 if (ctx
->ExecuteFlag
) {
3175 CALL_ShadeModel(ctx
->Exec
, (mode
));
3180 static void GLAPIENTRY
3181 save_StencilFunc(GLenum func
, GLint ref
, GLuint mask
)
3183 GET_CURRENT_CONTEXT(ctx
);
3185 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3186 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_FUNC
, 3);
3192 if (ctx
->ExecuteFlag
) {
3193 CALL_StencilFunc(ctx
->Exec
, (func
, ref
, mask
));
3198 static void GLAPIENTRY
3199 save_StencilMask(GLuint mask
)
3201 GET_CURRENT_CONTEXT(ctx
);
3203 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3204 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_MASK
, 1);
3208 if (ctx
->ExecuteFlag
) {
3209 CALL_StencilMask(ctx
->Exec
, (mask
));
3214 static void GLAPIENTRY
3215 save_StencilOp(GLenum fail
, GLenum zfail
, GLenum zpass
)
3217 GET_CURRENT_CONTEXT(ctx
);
3219 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3220 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_OP
, 3);
3226 if (ctx
->ExecuteFlag
) {
3227 CALL_StencilOp(ctx
->Exec
, (fail
, zfail
, zpass
));
3232 static void GLAPIENTRY
3233 save_StencilFuncSeparate(GLenum face
, GLenum func
, GLint ref
, GLuint mask
)
3235 GET_CURRENT_CONTEXT(ctx
);
3237 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3238 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3245 if (ctx
->ExecuteFlag
) {
3246 CALL_StencilFuncSeparate(ctx
->Exec
, (face
, func
, ref
, mask
));
3251 static void GLAPIENTRY
3252 save_StencilMaskSeparate(GLenum face
, GLuint mask
)
3254 GET_CURRENT_CONTEXT(ctx
);
3256 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3257 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_MASK_SEPARATE
, 2);
3262 if (ctx
->ExecuteFlag
) {
3263 CALL_StencilMaskSeparate(ctx
->Exec
, (face
, mask
));
3268 static void GLAPIENTRY
3269 save_StencilOpSeparate(GLenum face
, GLenum fail
, GLenum zfail
, GLenum zpass
)
3271 GET_CURRENT_CONTEXT(ctx
);
3273 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3274 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_OP_SEPARATE
, 4);
3281 if (ctx
->ExecuteFlag
) {
3282 CALL_StencilOpSeparate(ctx
->Exec
, (face
, fail
, zfail
, zpass
));
3287 static void GLAPIENTRY
3288 save_TexEnvfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3290 GET_CURRENT_CONTEXT(ctx
);
3292 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3293 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEXENV
, 6);
3297 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3305 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
3308 if (ctx
->ExecuteFlag
) {
3309 CALL_TexEnvfv(ctx
->Exec
, (target
, pname
, params
));
3314 static void GLAPIENTRY
3315 save_TexEnvf(GLenum target
, GLenum pname
, GLfloat param
)
3317 save_TexEnvfv(target
, pname
, ¶m
);
3321 static void GLAPIENTRY
3322 save_TexEnvi(GLenum target
, GLenum pname
, GLint param
)
3325 p
[0] = (GLfloat
) param
;
3326 p
[1] = p
[2] = p
[3] = 0.0;
3327 save_TexEnvfv(target
, pname
, p
);
3331 static void GLAPIENTRY
3332 save_TexEnviv(GLenum target
, GLenum pname
, const GLint
* param
)
3335 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3336 p
[0] = INT_TO_FLOAT(param
[0]);
3337 p
[1] = INT_TO_FLOAT(param
[1]);
3338 p
[2] = INT_TO_FLOAT(param
[2]);
3339 p
[3] = INT_TO_FLOAT(param
[3]);
3342 p
[0] = (GLfloat
) param
[0];
3343 p
[1] = p
[2] = p
[3] = 0.0F
;
3345 save_TexEnvfv(target
, pname
, p
);
3349 static void GLAPIENTRY
3350 save_TexGenfv(GLenum coord
, GLenum pname
, const GLfloat
*params
)
3352 GET_CURRENT_CONTEXT(ctx
);
3354 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3355 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEXGEN
, 6);
3364 if (ctx
->ExecuteFlag
) {
3365 CALL_TexGenfv(ctx
->Exec
, (coord
, pname
, params
));
3370 static void GLAPIENTRY
3371 save_TexGeniv(GLenum coord
, GLenum pname
, const GLint
*params
)
3374 p
[0] = (GLfloat
) params
[0];
3375 p
[1] = (GLfloat
) params
[1];
3376 p
[2] = (GLfloat
) params
[2];
3377 p
[3] = (GLfloat
) params
[3];
3378 save_TexGenfv(coord
, pname
, p
);
3382 static void GLAPIENTRY
3383 save_TexGend(GLenum coord
, GLenum pname
, GLdouble param
)
3385 GLfloat p
= (GLfloat
) param
;
3386 save_TexGenfv(coord
, pname
, &p
);
3390 static void GLAPIENTRY
3391 save_TexGendv(GLenum coord
, GLenum pname
, const GLdouble
*params
)
3394 p
[0] = (GLfloat
) params
[0];
3395 p
[1] = (GLfloat
) params
[1];
3396 p
[2] = (GLfloat
) params
[2];
3397 p
[3] = (GLfloat
) params
[3];
3398 save_TexGenfv(coord
, pname
, p
);
3402 static void GLAPIENTRY
3403 save_TexGenf(GLenum coord
, GLenum pname
, GLfloat param
)
3405 save_TexGenfv(coord
, pname
, ¶m
);
3409 static void GLAPIENTRY
3410 save_TexGeni(GLenum coord
, GLenum pname
, GLint param
)
3412 save_TexGeniv(coord
, pname
, ¶m
);
3416 static void GLAPIENTRY
3417 save_TexParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3419 GET_CURRENT_CONTEXT(ctx
);
3421 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3422 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEXPARAMETER
, 6);
3431 if (ctx
->ExecuteFlag
) {
3432 CALL_TexParameterfv(ctx
->Exec
, (target
, pname
, params
));
3437 static void GLAPIENTRY
3438 save_TexParameterf(GLenum target
, GLenum pname
, GLfloat param
)
3440 save_TexParameterfv(target
, pname
, ¶m
);
3444 static void GLAPIENTRY
3445 save_TexParameteri(GLenum target
, GLenum pname
, GLint param
)
3448 fparam
[0] = (GLfloat
) param
;
3449 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
3450 save_TexParameterfv(target
, pname
, fparam
);
3454 static void GLAPIENTRY
3455 save_TexParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
3458 fparam
[0] = (GLfloat
) params
[0];
3459 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
3460 save_TexParameterfv(target
, pname
, fparam
);
3464 static void GLAPIENTRY
3465 save_TexImage1D(GLenum target
,
3466 GLint level
, GLint components
,
3467 GLsizei width
, GLint border
,
3468 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3470 GET_CURRENT_CONTEXT(ctx
);
3471 if (target
== GL_PROXY_TEXTURE_1D
) {
3472 /* don't compile, execute immediately */
3473 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
3474 border
, format
, type
, pixels
));
3477 GLvoid
*image
= unpack_image(1, width
, 1, 1, format
, type
,
3478 pixels
, &ctx
->Unpack
);
3480 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3481 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_IMAGE1D
, 8);
3485 n
[3].i
= components
;
3486 n
[4].i
= (GLint
) width
;
3495 if (ctx
->ExecuteFlag
) {
3496 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
3497 border
, format
, type
, pixels
));
3503 static void GLAPIENTRY
3504 save_TexImage2D(GLenum target
,
3505 GLint level
, GLint components
,
3506 GLsizei width
, GLsizei height
, GLint border
,
3507 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3509 GET_CURRENT_CONTEXT(ctx
);
3510 if (target
== GL_PROXY_TEXTURE_2D
) {
3511 /* don't compile, execute immediately */
3512 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
3513 height
, border
, format
, type
, pixels
));
3516 GLvoid
*image
= unpack_image(2, width
, height
, 1, format
, type
,
3517 pixels
, &ctx
->Unpack
);
3519 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3520 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_IMAGE2D
, 9);
3524 n
[3].i
= components
;
3525 n
[4].i
= (GLint
) width
;
3526 n
[5].i
= (GLint
) height
;
3535 if (ctx
->ExecuteFlag
) {
3536 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
3537 height
, border
, format
, type
, pixels
));
3543 static void GLAPIENTRY
3544 save_TexImage3D(GLenum target
,
3545 GLint level
, GLint internalFormat
,
3546 GLsizei width
, GLsizei height
, GLsizei depth
,
3548 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3550 GET_CURRENT_CONTEXT(ctx
);
3551 if (target
== GL_PROXY_TEXTURE_3D
) {
3552 /* don't compile, execute immediately */
3553 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
3554 height
, depth
, border
, format
, type
,
3559 GLvoid
*image
= unpack_image(3, width
, height
, depth
, format
, type
,
3560 pixels
, &ctx
->Unpack
);
3561 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3562 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_IMAGE3D
, 10);
3566 n
[3].i
= (GLint
) internalFormat
;
3567 n
[4].i
= (GLint
) width
;
3568 n
[5].i
= (GLint
) height
;
3569 n
[6].i
= (GLint
) depth
;
3578 if (ctx
->ExecuteFlag
) {
3579 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
3580 height
, depth
, border
, format
, type
,
3587 static void GLAPIENTRY
3588 save_TexSubImage1D(GLenum target
, GLint level
, GLint xoffset
,
3589 GLsizei width
, GLenum format
, GLenum type
,
3590 const GLvoid
* pixels
)
3592 GET_CURRENT_CONTEXT(ctx
);
3594 GLvoid
*image
= unpack_image(1, width
, 1, 1, format
, type
,
3595 pixels
, &ctx
->Unpack
);
3596 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3597 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_SUB_IMAGE1D
, 7);
3602 n
[4].i
= (GLint
) width
;
3610 if (ctx
->ExecuteFlag
) {
3611 CALL_TexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
, width
,
3612 format
, type
, pixels
));
3617 static void GLAPIENTRY
3618 save_TexSubImage2D(GLenum target
, GLint level
,
3619 GLint xoffset
, GLint yoffset
,
3620 GLsizei width
, GLsizei height
,
3621 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3623 GET_CURRENT_CONTEXT(ctx
);
3625 GLvoid
*image
= unpack_image(2, width
, height
, 1, format
, type
,
3626 pixels
, &ctx
->Unpack
);
3627 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3628 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_SUB_IMAGE2D
, 9);
3634 n
[5].i
= (GLint
) width
;
3635 n
[6].i
= (GLint
) height
;
3643 if (ctx
->ExecuteFlag
) {
3644 CALL_TexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
3645 width
, height
, format
, type
, pixels
));
3650 static void GLAPIENTRY
3651 save_TexSubImage3D(GLenum target
, GLint level
,
3652 GLint xoffset
, GLint yoffset
, GLint zoffset
,
3653 GLsizei width
, GLsizei height
, GLsizei depth
,
3654 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3656 GET_CURRENT_CONTEXT(ctx
);
3658 GLvoid
*image
= unpack_image(3, width
, height
, depth
, format
, type
,
3659 pixels
, &ctx
->Unpack
);
3660 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3661 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_SUB_IMAGE3D
, 11);
3668 n
[6].i
= (GLint
) width
;
3669 n
[7].i
= (GLint
) height
;
3670 n
[8].i
= (GLint
) depth
;
3678 if (ctx
->ExecuteFlag
) {
3679 CALL_TexSubImage3D(ctx
->Exec
, (target
, level
,
3680 xoffset
, yoffset
, zoffset
,
3681 width
, height
, depth
, format
, type
,
3687 static void GLAPIENTRY
3688 save_Translatef(GLfloat x
, GLfloat y
, GLfloat z
)
3690 GET_CURRENT_CONTEXT(ctx
);
3692 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3693 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TRANSLATE
, 3);
3699 if (ctx
->ExecuteFlag
) {
3700 CALL_Translatef(ctx
->Exec
, (x
, y
, z
));
3705 static void GLAPIENTRY
3706 save_Translated(GLdouble x
, GLdouble y
, GLdouble z
)
3708 save_Translatef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3713 static void GLAPIENTRY
3714 save_Viewport(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3716 GET_CURRENT_CONTEXT(ctx
);
3718 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3719 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_VIEWPORT
, 4);
3723 n
[3].i
= (GLint
) width
;
3724 n
[4].i
= (GLint
) height
;
3726 if (ctx
->ExecuteFlag
) {
3727 CALL_Viewport(ctx
->Exec
, (x
, y
, width
, height
));
3732 static void GLAPIENTRY
3733 save_WindowPos4fMESA(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3735 GET_CURRENT_CONTEXT(ctx
);
3737 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3738 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_WINDOW_POS
, 4);
3745 if (ctx
->ExecuteFlag
) {
3746 CALL_WindowPos4fMESA(ctx
->Exec
, (x
, y
, z
, w
));
3750 static void GLAPIENTRY
3751 save_WindowPos2dMESA(GLdouble x
, GLdouble y
)
3753 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3756 static void GLAPIENTRY
3757 save_WindowPos2fMESA(GLfloat x
, GLfloat y
)
3759 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3762 static void GLAPIENTRY
3763 save_WindowPos2iMESA(GLint x
, GLint y
)
3765 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3768 static void GLAPIENTRY
3769 save_WindowPos2sMESA(GLshort x
, GLshort y
)
3771 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3774 static void GLAPIENTRY
3775 save_WindowPos3dMESA(GLdouble x
, GLdouble y
, GLdouble z
)
3777 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3780 static void GLAPIENTRY
3781 save_WindowPos3fMESA(GLfloat x
, GLfloat y
, GLfloat z
)
3783 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3786 static void GLAPIENTRY
3787 save_WindowPos3iMESA(GLint x
, GLint y
, GLint z
)
3789 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3792 static void GLAPIENTRY
3793 save_WindowPos3sMESA(GLshort x
, GLshort y
, GLshort z
)
3795 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3798 static void GLAPIENTRY
3799 save_WindowPos4dMESA(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3801 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3804 static void GLAPIENTRY
3805 save_WindowPos4iMESA(GLint x
, GLint y
, GLint z
, GLint w
)
3807 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3810 static void GLAPIENTRY
3811 save_WindowPos4sMESA(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
3813 save_WindowPos4fMESA(x
, y
, z
, w
);
3816 static void GLAPIENTRY
3817 save_WindowPos2dvMESA(const GLdouble
* v
)
3819 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3822 static void GLAPIENTRY
3823 save_WindowPos2fvMESA(const GLfloat
* v
)
3825 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3828 static void GLAPIENTRY
3829 save_WindowPos2ivMESA(const GLint
* v
)
3831 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3834 static void GLAPIENTRY
3835 save_WindowPos2svMESA(const GLshort
* v
)
3837 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3840 static void GLAPIENTRY
3841 save_WindowPos3dvMESA(const GLdouble
* v
)
3843 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3846 static void GLAPIENTRY
3847 save_WindowPos3fvMESA(const GLfloat
* v
)
3849 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3852 static void GLAPIENTRY
3853 save_WindowPos3ivMESA(const GLint
* v
)
3855 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3858 static void GLAPIENTRY
3859 save_WindowPos3svMESA(const GLshort
* v
)
3861 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3864 static void GLAPIENTRY
3865 save_WindowPos4dvMESA(const GLdouble
* v
)
3867 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
3868 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3871 static void GLAPIENTRY
3872 save_WindowPos4fvMESA(const GLfloat
* v
)
3874 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3877 static void GLAPIENTRY
3878 save_WindowPos4ivMESA(const GLint
* v
)
3880 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
3881 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3884 static void GLAPIENTRY
3885 save_WindowPos4svMESA(const GLshort
* v
)
3887 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3892 /* GL_ARB_multitexture */
3893 static void GLAPIENTRY
3894 save_ActiveTextureARB(GLenum target
)
3896 GET_CURRENT_CONTEXT(ctx
);
3898 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3899 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ACTIVE_TEXTURE
, 1);
3903 if (ctx
->ExecuteFlag
) {
3904 CALL_ActiveTextureARB(ctx
->Exec
, (target
));
3909 /* GL_ARB_transpose_matrix */
3911 static void GLAPIENTRY
3912 save_LoadTransposeMatrixdARB(const GLdouble m
[16])
3915 _math_transposefd(tm
, m
);
3916 save_LoadMatrixf(tm
);
3920 static void GLAPIENTRY
3921 save_LoadTransposeMatrixfARB(const GLfloat m
[16])
3924 _math_transposef(tm
, m
);
3925 save_LoadMatrixf(tm
);
3929 static void GLAPIENTRY
3930 save_MultTransposeMatrixdARB(const GLdouble m
[16])
3933 _math_transposefd(tm
, m
);
3934 save_MultMatrixf(tm
);
3938 static void GLAPIENTRY
3939 save_MultTransposeMatrixfARB(const GLfloat m
[16])
3942 _math_transposef(tm
, m
);
3943 save_MultMatrixf(tm
);
3947 /* GL_ARB_texture_compression */
3948 static void GLAPIENTRY
3949 save_CompressedTexImage1DARB(GLenum target
, GLint level
,
3950 GLenum internalFormat
, GLsizei width
,
3951 GLint border
, GLsizei imageSize
,
3952 const GLvoid
* data
)
3954 GET_CURRENT_CONTEXT(ctx
);
3955 if (target
== GL_PROXY_TEXTURE_1D
) {
3956 /* don't compile, execute immediately */
3957 CALL_CompressedTexImage1DARB(ctx
->Exec
, (target
, level
, internalFormat
,
3958 width
, border
, imageSize
,
3964 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3965 /* make copy of image */
3966 image
= _mesa_malloc(imageSize
);
3968 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage1DARB");
3971 MEMCPY(image
, data
, imageSize
);
3972 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_1D
, 7);
3976 n
[3].e
= internalFormat
;
3977 n
[4].i
= (GLint
) width
;
3985 if (ctx
->ExecuteFlag
) {
3986 CALL_CompressedTexImage1DARB(ctx
->Exec
,
3987 (target
, level
, internalFormat
, width
,
3988 border
, imageSize
, data
));
3994 static void GLAPIENTRY
3995 save_CompressedTexImage2DARB(GLenum target
, GLint level
,
3996 GLenum internalFormat
, GLsizei width
,
3997 GLsizei height
, GLint border
, GLsizei imageSize
,
3998 const GLvoid
* data
)
4000 GET_CURRENT_CONTEXT(ctx
);
4001 if (target
== GL_PROXY_TEXTURE_2D
) {
4002 /* don't compile, execute immediately */
4003 CALL_CompressedTexImage2DARB(ctx
->Exec
, (target
, level
, internalFormat
,
4004 width
, height
, border
,
4010 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4011 /* make copy of image */
4012 image
= _mesa_malloc(imageSize
);
4014 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage2DARB");
4017 MEMCPY(image
, data
, imageSize
);
4018 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_2D
, 8);
4022 n
[3].e
= internalFormat
;
4023 n
[4].i
= (GLint
) width
;
4024 n
[5].i
= (GLint
) height
;
4032 if (ctx
->ExecuteFlag
) {
4033 CALL_CompressedTexImage2DARB(ctx
->Exec
,
4034 (target
, level
, internalFormat
, width
,
4035 height
, border
, imageSize
, data
));
4041 static void GLAPIENTRY
4042 save_CompressedTexImage3DARB(GLenum target
, GLint level
,
4043 GLenum internalFormat
, GLsizei width
,
4044 GLsizei height
, GLsizei depth
, GLint border
,
4045 GLsizei imageSize
, const GLvoid
* data
)
4047 GET_CURRENT_CONTEXT(ctx
);
4048 if (target
== GL_PROXY_TEXTURE_3D
) {
4049 /* don't compile, execute immediately */
4050 CALL_CompressedTexImage3DARB(ctx
->Exec
, (target
, level
, internalFormat
,
4051 width
, height
, depth
, border
,
4057 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4058 /* make copy of image */
4059 image
= _mesa_malloc(imageSize
);
4061 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage3DARB");
4064 MEMCPY(image
, data
, imageSize
);
4065 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_3D
, 9);
4069 n
[3].e
= internalFormat
;
4070 n
[4].i
= (GLint
) width
;
4071 n
[5].i
= (GLint
) height
;
4072 n
[6].i
= (GLint
) depth
;
4080 if (ctx
->ExecuteFlag
) {
4081 CALL_CompressedTexImage3DARB(ctx
->Exec
,
4082 (target
, level
, internalFormat
, width
,
4083 height
, depth
, border
, imageSize
,
4090 static void GLAPIENTRY
4091 save_CompressedTexSubImage1DARB(GLenum target
, GLint level
, GLint xoffset
,
4092 GLsizei width
, GLenum format
,
4093 GLsizei imageSize
, const GLvoid
* data
)
4098 GET_CURRENT_CONTEXT(ctx
);
4099 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4101 /* make copy of image */
4102 image
= _mesa_malloc(imageSize
);
4104 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage1DARB");
4107 MEMCPY(image
, data
, imageSize
);
4108 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
, 7);
4113 n
[4].i
= (GLint
) width
;
4121 if (ctx
->ExecuteFlag
) {
4122 CALL_CompressedTexSubImage1DARB(ctx
->Exec
, (target
, level
, xoffset
,
4123 width
, format
, imageSize
,
4129 static void GLAPIENTRY
4130 save_CompressedTexSubImage2DARB(GLenum target
, GLint level
, GLint xoffset
,
4131 GLint yoffset
, GLsizei width
, GLsizei height
,
4132 GLenum format
, GLsizei imageSize
,
4133 const GLvoid
* data
)
4138 GET_CURRENT_CONTEXT(ctx
);
4139 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4141 /* make copy of image */
4142 image
= _mesa_malloc(imageSize
);
4144 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage2DARB");
4147 MEMCPY(image
, data
, imageSize
);
4148 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
, 9);
4154 n
[5].i
= (GLint
) width
;
4155 n
[6].i
= (GLint
) height
;
4163 if (ctx
->ExecuteFlag
) {
4164 CALL_CompressedTexSubImage2DARB(ctx
->Exec
,
4165 (target
, level
, xoffset
, yoffset
, width
,
4166 height
, format
, imageSize
, data
));
4171 static void GLAPIENTRY
4172 save_CompressedTexSubImage3DARB(GLenum target
, GLint level
, GLint xoffset
,
4173 GLint yoffset
, GLint zoffset
, GLsizei width
,
4174 GLsizei height
, GLsizei depth
, GLenum format
,
4175 GLsizei imageSize
, const GLvoid
* data
)
4180 GET_CURRENT_CONTEXT(ctx
);
4181 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4183 /* make copy of image */
4184 image
= _mesa_malloc(imageSize
);
4186 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage3DARB");
4189 MEMCPY(image
, data
, imageSize
);
4190 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
, 11);
4197 n
[6].i
= (GLint
) width
;
4198 n
[7].i
= (GLint
) height
;
4199 n
[8].i
= (GLint
) depth
;
4201 n
[10].i
= imageSize
;
4207 if (ctx
->ExecuteFlag
) {
4208 CALL_CompressedTexSubImage3DARB(ctx
->Exec
,
4209 (target
, level
, xoffset
, yoffset
,
4210 zoffset
, width
, height
, depth
, format
,
4216 /* GL_ARB_multisample */
4217 static void GLAPIENTRY
4218 save_SampleCoverageARB(GLclampf value
, GLboolean invert
)
4220 GET_CURRENT_CONTEXT(ctx
);
4222 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4223 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SAMPLE_COVERAGE
, 2);
4228 if (ctx
->ExecuteFlag
) {
4229 CALL_SampleCoverageARB(ctx
->Exec
, (value
, invert
));
4235 * GL_NV_vertex_program
4237 #if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
4238 static void GLAPIENTRY
4239 save_BindProgramNV(GLenum target
, GLuint id
)
4241 GET_CURRENT_CONTEXT(ctx
);
4243 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4244 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BIND_PROGRAM_NV
, 2);
4249 if (ctx
->ExecuteFlag
) {
4250 CALL_BindProgramNV(ctx
->Exec
, (target
, id
));
4253 #endif /* FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program */
4255 #if FEATURE_NV_vertex_program
4256 static void GLAPIENTRY
4257 save_ExecuteProgramNV(GLenum target
, GLuint id
, const GLfloat
*params
)
4259 GET_CURRENT_CONTEXT(ctx
);
4261 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4262 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EXECUTE_PROGRAM_NV
, 6);
4271 if (ctx
->ExecuteFlag
) {
4272 CALL_ExecuteProgramNV(ctx
->Exec
, (target
, id
, params
));
4277 static void GLAPIENTRY
4278 save_ProgramParameter4fNV(GLenum target
, GLuint index
,
4279 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4281 GET_CURRENT_CONTEXT(ctx
);
4283 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4284 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_PARAMETER4F_NV
, 6);
4293 if (ctx
->ExecuteFlag
) {
4294 CALL_ProgramParameter4fNV(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4299 static void GLAPIENTRY
4300 save_ProgramParameter4fvNV(GLenum target
, GLuint index
,
4301 const GLfloat
*params
)
4303 save_ProgramParameter4fNV(target
, index
, params
[0], params
[1],
4304 params
[2], params
[3]);
4308 static void GLAPIENTRY
4309 save_ProgramParameter4dNV(GLenum target
, GLuint index
,
4310 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4312 save_ProgramParameter4fNV(target
, index
, (GLfloat
) x
, (GLfloat
) y
,
4313 (GLfloat
) z
, (GLfloat
) w
);
4317 static void GLAPIENTRY
4318 save_ProgramParameter4dvNV(GLenum target
, GLuint index
,
4319 const GLdouble
*params
)
4321 save_ProgramParameter4fNV(target
, index
, (GLfloat
) params
[0],
4322 (GLfloat
) params
[1], (GLfloat
) params
[2],
4323 (GLfloat
) params
[3]);
4327 static void GLAPIENTRY
4328 save_ProgramParameters4dvNV(GLenum target
, GLuint index
,
4329 GLuint num
, const GLdouble
*params
)
4332 for (i
= 0; i
< num
; i
++) {
4333 save_ProgramParameter4dvNV(target
, index
+ i
, params
+ 4 * i
);
4338 static void GLAPIENTRY
4339 save_ProgramParameters4fvNV(GLenum target
, GLuint index
,
4340 GLuint num
, const GLfloat
*params
)
4343 for (i
= 0; i
< num
; i
++) {
4344 save_ProgramParameter4fvNV(target
, index
+ i
, params
+ 4 * i
);
4349 static void GLAPIENTRY
4350 save_LoadProgramNV(GLenum target
, GLuint id
, GLsizei len
,
4351 const GLubyte
* program
)
4353 GET_CURRENT_CONTEXT(ctx
);
4355 GLubyte
*programCopy
;
4357 programCopy
= (GLubyte
*) _mesa_malloc(len
);
4359 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glLoadProgramNV");
4362 _mesa_memcpy(programCopy
, program
, len
);
4364 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4365 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LOAD_PROGRAM_NV
, 4);
4370 n
[4].data
= programCopy
;
4372 if (ctx
->ExecuteFlag
) {
4373 CALL_LoadProgramNV(ctx
->Exec
, (target
, id
, len
, program
));
4378 static void GLAPIENTRY
4379 save_RequestResidentProgramsNV(GLsizei num
, const GLuint
* ids
)
4381 GET_CURRENT_CONTEXT(ctx
);
4383 GLuint
*idCopy
= (GLuint
*) _mesa_malloc(num
* sizeof(GLuint
));
4385 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glRequestResidentProgramsNV");
4388 _mesa_memcpy(idCopy
, ids
, num
* sizeof(GLuint
));
4389 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4390 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TRACK_MATRIX_NV
, 2);
4395 if (ctx
->ExecuteFlag
) {
4396 CALL_RequestResidentProgramsNV(ctx
->Exec
, (num
, ids
));
4401 static void GLAPIENTRY
4402 save_TrackMatrixNV(GLenum target
, GLuint address
,
4403 GLenum matrix
, GLenum transform
)
4405 GET_CURRENT_CONTEXT(ctx
);
4407 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4408 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TRACK_MATRIX_NV
, 4);
4415 if (ctx
->ExecuteFlag
) {
4416 CALL_TrackMatrixNV(ctx
->Exec
, (target
, address
, matrix
, transform
));
4419 #endif /* FEATURE_NV_vertex_program */
4423 * GL_NV_fragment_program
4425 #if FEATURE_NV_fragment_program
4426 static void GLAPIENTRY
4427 save_ProgramLocalParameter4fARB(GLenum target
, GLuint index
,
4428 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4430 GET_CURRENT_CONTEXT(ctx
);
4432 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4433 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4442 if (ctx
->ExecuteFlag
) {
4443 CALL_ProgramLocalParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4448 static void GLAPIENTRY
4449 save_ProgramLocalParameter4fvARB(GLenum target
, GLuint index
,
4450 const GLfloat
*params
)
4452 GET_CURRENT_CONTEXT(ctx
);
4454 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4455 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4464 if (ctx
->ExecuteFlag
) {
4465 CALL_ProgramLocalParameter4fvARB(ctx
->Exec
, (target
, index
, params
));
4470 static void GLAPIENTRY
4471 save_ProgramLocalParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4472 const GLfloat
*params
)
4474 GET_CURRENT_CONTEXT(ctx
);
4476 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4480 const GLfloat
* p
= params
;
4482 for (i
= 0 ; i
< count
; i
++) {
4483 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4496 if (ctx
->ExecuteFlag
) {
4497 CALL_ProgramLocalParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4502 static void GLAPIENTRY
4503 save_ProgramLocalParameter4dARB(GLenum target
, GLuint index
,
4504 GLdouble x
, GLdouble y
,
4505 GLdouble z
, GLdouble w
)
4507 GET_CURRENT_CONTEXT(ctx
);
4509 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4510 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4514 n
[3].f
= (GLfloat
) x
;
4515 n
[4].f
= (GLfloat
) y
;
4516 n
[5].f
= (GLfloat
) z
;
4517 n
[6].f
= (GLfloat
) w
;
4519 if (ctx
->ExecuteFlag
) {
4520 CALL_ProgramLocalParameter4dARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4525 static void GLAPIENTRY
4526 save_ProgramLocalParameter4dvARB(GLenum target
, GLuint index
,
4527 const GLdouble
*params
)
4529 GET_CURRENT_CONTEXT(ctx
);
4531 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4532 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4536 n
[3].f
= (GLfloat
) params
[0];
4537 n
[4].f
= (GLfloat
) params
[1];
4538 n
[5].f
= (GLfloat
) params
[2];
4539 n
[6].f
= (GLfloat
) params
[3];
4541 if (ctx
->ExecuteFlag
) {
4542 CALL_ProgramLocalParameter4dvARB(ctx
->Exec
, (target
, index
, params
));
4546 static void GLAPIENTRY
4547 save_ProgramNamedParameter4fNV(GLuint id
, GLsizei len
, const GLubyte
* name
,
4548 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4550 GET_CURRENT_CONTEXT(ctx
);
4552 GLubyte
*nameCopy
= (GLubyte
*) _mesa_malloc(len
);
4554 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramNamedParameter4fNV");
4557 _mesa_memcpy(nameCopy
, name
, len
);
4559 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4560 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_NAMED_PARAMETER_NV
, 6);
4564 n
[3].data
= nameCopy
;
4570 if (ctx
->ExecuteFlag
) {
4571 CALL_ProgramNamedParameter4fNV(ctx
->Exec
, (id
, len
, name
, x
, y
, z
, w
));
4576 static void GLAPIENTRY
4577 save_ProgramNamedParameter4fvNV(GLuint id
, GLsizei len
, const GLubyte
* name
,
4580 save_ProgramNamedParameter4fNV(id
, len
, name
, v
[0], v
[1], v
[2], v
[3]);
4584 static void GLAPIENTRY
4585 save_ProgramNamedParameter4dNV(GLuint id
, GLsizei len
, const GLubyte
* name
,
4586 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4588 save_ProgramNamedParameter4fNV(id
, len
, name
, (GLfloat
) x
, (GLfloat
) y
,
4589 (GLfloat
) z
, (GLfloat
) w
);
4593 static void GLAPIENTRY
4594 save_ProgramNamedParameter4dvNV(GLuint id
, GLsizei len
, const GLubyte
* name
,
4597 save_ProgramNamedParameter4fNV(id
, len
, name
, (GLfloat
) v
[0],
4598 (GLfloat
) v
[1], (GLfloat
) v
[2],
4602 #endif /* FEATURE_NV_fragment_program */
4606 /* GL_EXT_stencil_two_side */
4607 static void GLAPIENTRY
4608 save_ActiveStencilFaceEXT(GLenum face
)
4610 GET_CURRENT_CONTEXT(ctx
);
4612 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4613 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ACTIVE_STENCIL_FACE_EXT
, 1);
4617 if (ctx
->ExecuteFlag
) {
4618 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (face
));
4623 /* GL_EXT_depth_bounds_test */
4624 static void GLAPIENTRY
4625 save_DepthBoundsEXT(GLclampd zmin
, GLclampd zmax
)
4627 GET_CURRENT_CONTEXT(ctx
);
4629 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4630 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DEPTH_BOUNDS_EXT
, 2);
4632 n
[1].f
= (GLfloat
) zmin
;
4633 n
[2].f
= (GLfloat
) zmax
;
4635 if (ctx
->ExecuteFlag
) {
4636 CALL_DepthBoundsEXT(ctx
->Exec
, (zmin
, zmax
));
4642 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
4644 static void GLAPIENTRY
4645 save_ProgramStringARB(GLenum target
, GLenum format
, GLsizei len
,
4646 const GLvoid
* string
)
4648 GET_CURRENT_CONTEXT(ctx
);
4650 GLubyte
*programCopy
;
4652 programCopy
= (GLubyte
*) _mesa_malloc(len
);
4654 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramStringARB");
4657 _mesa_memcpy(programCopy
, string
, len
);
4659 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4660 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_STRING_ARB
, 4);
4665 n
[4].data
= programCopy
;
4667 if (ctx
->ExecuteFlag
) {
4668 CALL_ProgramStringARB(ctx
->Exec
, (target
, format
, len
, string
));
4673 static void GLAPIENTRY
4674 save_ProgramEnvParameter4fARB(GLenum target
, GLuint index
,
4675 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4677 GET_CURRENT_CONTEXT(ctx
);
4679 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4680 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4689 if (ctx
->ExecuteFlag
) {
4690 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4695 static void GLAPIENTRY
4696 save_ProgramEnvParameter4fvARB(GLenum target
, GLuint index
,
4697 const GLfloat
*params
)
4699 save_ProgramEnvParameter4fARB(target
, index
, params
[0], params
[1],
4700 params
[2], params
[3]);
4704 static void GLAPIENTRY
4705 save_ProgramEnvParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4706 const GLfloat
* params
)
4708 GET_CURRENT_CONTEXT(ctx
);
4710 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4714 const GLfloat
* p
= params
;
4716 for (i
= 0 ; i
< count
; i
++) {
4717 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4730 if (ctx
->ExecuteFlag
) {
4731 CALL_ProgramEnvParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4736 static void GLAPIENTRY
4737 save_ProgramEnvParameter4dARB(GLenum target
, GLuint index
,
4738 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4740 save_ProgramEnvParameter4fARB(target
, index
,
4742 (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4746 static void GLAPIENTRY
4747 save_ProgramEnvParameter4dvARB(GLenum target
, GLuint index
,
4748 const GLdouble
*params
)
4750 save_ProgramEnvParameter4fARB(target
, index
,
4751 (GLfloat
) params
[0],
4752 (GLfloat
) params
[1],
4753 (GLfloat
) params
[2], (GLfloat
) params
[3]);
4756 #endif /* FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program */
4759 #if FEATURE_ARB_occlusion_query
4761 static void GLAPIENTRY
4762 save_BeginQueryARB(GLenum target
, GLuint id
)
4764 GET_CURRENT_CONTEXT(ctx
);
4766 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4767 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BEGIN_QUERY_ARB
, 2);
4772 if (ctx
->ExecuteFlag
) {
4773 CALL_BeginQueryARB(ctx
->Exec
, (target
, id
));
4778 static void GLAPIENTRY
4779 save_EndQueryARB(GLenum target
)
4781 GET_CURRENT_CONTEXT(ctx
);
4783 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4784 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_END_QUERY_ARB
, 1);
4788 if (ctx
->ExecuteFlag
) {
4789 CALL_EndQueryARB(ctx
->Exec
, (target
));
4793 #endif /* FEATURE_ARB_occlusion_query */
4796 static void GLAPIENTRY
4797 save_DrawBuffersARB(GLsizei count
, const GLenum
* buffers
)
4799 GET_CURRENT_CONTEXT(ctx
);
4801 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4802 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DRAW_BUFFERS_ARB
, 1 + MAX_DRAW_BUFFERS
);
4806 if (count
> MAX_DRAW_BUFFERS
)
4807 count
= MAX_DRAW_BUFFERS
;
4808 for (i
= 0; i
< count
; i
++) {
4809 n
[2 + i
].e
= buffers
[i
];
4812 if (ctx
->ExecuteFlag
) {
4813 CALL_DrawBuffersARB(ctx
->Exec
, (count
, buffers
));
4817 #if FEATURE_ATI_fragment_shader
4818 static void GLAPIENTRY
4819 save_BindFragmentShaderATI(GLuint id
)
4821 GET_CURRENT_CONTEXT(ctx
);
4824 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BIND_FRAGMENT_SHADER_ATI
, 1);
4828 if (ctx
->ExecuteFlag
) {
4829 CALL_BindFragmentShaderATI(ctx
->Exec
, (id
));
4833 static void GLAPIENTRY
4834 save_SetFragmentShaderConstantATI(GLuint dst
, const GLfloat
*value
)
4836 GET_CURRENT_CONTEXT(ctx
);
4839 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
, 5);
4847 if (ctx
->ExecuteFlag
) {
4848 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, value
));
4854 save_Attr1fNV(GLenum attr
, GLfloat x
)
4856 GET_CURRENT_CONTEXT(ctx
);
4858 SAVE_FLUSH_VERTICES(ctx
);
4859 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_1F_NV
, 2);
4865 ASSERT(attr
< MAX_VERTEX_PROGRAM_ATTRIBS
);
4866 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
4867 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
4869 if (ctx
->ExecuteFlag
) {
4870 CALL_VertexAttrib1fNV(ctx
->Exec
, (attr
, x
));
4875 save_Attr2fNV(GLenum attr
, GLfloat x
, GLfloat y
)
4877 GET_CURRENT_CONTEXT(ctx
);
4879 SAVE_FLUSH_VERTICES(ctx
);
4880 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_2F_NV
, 3);
4887 ASSERT(attr
< MAX_VERTEX_PROGRAM_ATTRIBS
);
4888 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
4889 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
4891 if (ctx
->ExecuteFlag
) {
4892 CALL_VertexAttrib2fNV(ctx
->Exec
, (attr
, x
, y
));
4897 save_Attr3fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
4899 GET_CURRENT_CONTEXT(ctx
);
4901 SAVE_FLUSH_VERTICES(ctx
);
4902 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_3F_NV
, 4);
4910 ASSERT(attr
< MAX_VERTEX_PROGRAM_ATTRIBS
);
4911 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
4912 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
4914 if (ctx
->ExecuteFlag
) {
4915 CALL_VertexAttrib3fNV(ctx
->Exec
, (attr
, x
, y
, z
));
4920 save_Attr4fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4922 GET_CURRENT_CONTEXT(ctx
);
4924 SAVE_FLUSH_VERTICES(ctx
);
4925 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_4F_NV
, 5);
4934 ASSERT(attr
< MAX_VERTEX_PROGRAM_ATTRIBS
);
4935 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
4936 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
4938 if (ctx
->ExecuteFlag
) {
4939 CALL_VertexAttrib4fNV(ctx
->Exec
, (attr
, x
, y
, z
, w
));
4945 save_Attr1fARB(GLenum attr
, GLfloat x
)
4947 GET_CURRENT_CONTEXT(ctx
);
4949 SAVE_FLUSH_VERTICES(ctx
);
4950 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_1F_ARB
, 2);
4956 ASSERT(attr
< MAX_VERTEX_ATTRIBS
);
4957 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
4958 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
4960 if (ctx
->ExecuteFlag
) {
4961 CALL_VertexAttrib1fARB(ctx
->Exec
, (attr
, x
));
4966 save_Attr2fARB(GLenum attr
, GLfloat x
, GLfloat y
)
4968 GET_CURRENT_CONTEXT(ctx
);
4970 SAVE_FLUSH_VERTICES(ctx
);
4971 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_2F_ARB
, 3);
4978 ASSERT(attr
< MAX_VERTEX_ATTRIBS
);
4979 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
4980 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
4982 if (ctx
->ExecuteFlag
) {
4983 CALL_VertexAttrib2fARB(ctx
->Exec
, (attr
, x
, y
));
4988 save_Attr3fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
4990 GET_CURRENT_CONTEXT(ctx
);
4992 SAVE_FLUSH_VERTICES(ctx
);
4993 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_3F_ARB
, 4);
5001 ASSERT(attr
< MAX_VERTEX_ATTRIBS
);
5002 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
5003 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
5005 if (ctx
->ExecuteFlag
) {
5006 CALL_VertexAttrib3fARB(ctx
->Exec
, (attr
, x
, y
, z
));
5011 save_Attr4fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5013 GET_CURRENT_CONTEXT(ctx
);
5015 SAVE_FLUSH_VERTICES(ctx
);
5016 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_4F_ARB
, 5);
5025 ASSERT(attr
< MAX_VERTEX_ATTRIBS
);
5026 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5027 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5029 if (ctx
->ExecuteFlag
) {
5030 CALL_VertexAttrib4fARB(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5035 static void GLAPIENTRY
5036 save_EvalCoord1f(GLfloat x
)
5038 GET_CURRENT_CONTEXT(ctx
);
5040 SAVE_FLUSH_VERTICES(ctx
);
5041 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVAL_C1
, 1);
5045 if (ctx
->ExecuteFlag
) {
5046 CALL_EvalCoord1f(ctx
->Exec
, (x
));
5050 static void GLAPIENTRY
5051 save_EvalCoord1fv(const GLfloat
* v
)
5053 save_EvalCoord1f(v
[0]);
5056 static void GLAPIENTRY
5057 save_EvalCoord2f(GLfloat x
, GLfloat y
)
5059 GET_CURRENT_CONTEXT(ctx
);
5061 SAVE_FLUSH_VERTICES(ctx
);
5062 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVAL_C2
, 2);
5067 if (ctx
->ExecuteFlag
) {
5068 CALL_EvalCoord2f(ctx
->Exec
, (x
, y
));
5072 static void GLAPIENTRY
5073 save_EvalCoord2fv(const GLfloat
* v
)
5075 save_EvalCoord2f(v
[0], v
[1]);
5079 static void GLAPIENTRY
5080 save_EvalPoint1(GLint x
)
5082 GET_CURRENT_CONTEXT(ctx
);
5084 SAVE_FLUSH_VERTICES(ctx
);
5085 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVAL_P1
, 1);
5089 if (ctx
->ExecuteFlag
) {
5090 CALL_EvalPoint1(ctx
->Exec
, (x
));
5094 static void GLAPIENTRY
5095 save_EvalPoint2(GLint x
, GLint y
)
5097 GET_CURRENT_CONTEXT(ctx
);
5099 SAVE_FLUSH_VERTICES(ctx
);
5100 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVAL_P2
, 2);
5105 if (ctx
->ExecuteFlag
) {
5106 CALL_EvalPoint2(ctx
->Exec
, (x
, y
));
5110 static void GLAPIENTRY
5111 save_Indexf(GLfloat x
)
5113 GET_CURRENT_CONTEXT(ctx
);
5115 SAVE_FLUSH_VERTICES(ctx
);
5116 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_INDEX
, 1);
5121 ctx
->ListState
.ActiveIndex
= 1;
5122 ctx
->ListState
.CurrentIndex
= x
;
5124 if (ctx
->ExecuteFlag
) {
5125 CALL_Indexf(ctx
->Exec
, (x
));
5129 static void GLAPIENTRY
5130 save_Indexfv(const GLfloat
* v
)
5135 static void GLAPIENTRY
5136 save_EdgeFlag(GLboolean x
)
5138 GET_CURRENT_CONTEXT(ctx
);
5140 SAVE_FLUSH_VERTICES(ctx
);
5141 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EDGEFLAG
, 1);
5146 ctx
->ListState
.ActiveEdgeFlag
= 1;
5147 ctx
->ListState
.CurrentEdgeFlag
= x
;
5149 if (ctx
->ExecuteFlag
) {
5150 CALL_EdgeFlag(ctx
->Exec
, (x
));
5154 static void GLAPIENTRY
5155 save_Materialfv(GLenum face
, GLenum pname
, const GLfloat
* param
)
5157 GET_CURRENT_CONTEXT(ctx
);
5161 SAVE_FLUSH_VERTICES(ctx
);
5166 case GL_FRONT_AND_BACK
:
5169 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "material(face)");
5178 case GL_AMBIENT_AND_DIFFUSE
:
5184 case GL_COLOR_INDEXES
:
5188 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "material(pname)");
5192 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MATERIAL
, 6);
5196 for (i
= 0; i
< args
; i
++)
5197 n
[3 + i
].f
= param
[i
];
5201 GLuint bitmask
= _mesa_material_bitmask(ctx
, face
, pname
, ~0, NULL
);
5202 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++)
5203 if (bitmask
& (1 << i
)) {
5204 ctx
->ListState
.ActiveMaterialSize
[i
] = args
;
5205 COPY_SZ_4V(ctx
->ListState
.CurrentMaterial
[i
], args
, param
);
5209 if (ctx
->ExecuteFlag
) {
5210 CALL_Materialfv(ctx
->Exec
, (face
, pname
, param
));
5214 static void GLAPIENTRY
5215 save_Begin(GLenum mode
)
5217 GET_CURRENT_CONTEXT(ctx
);
5219 GLboolean error
= GL_FALSE
;
5221 if ( /*mode < GL_POINTS || */ mode
> GL_POLYGON
) {
5222 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "Begin (mode)");
5225 else if (ctx
->Driver
.CurrentSavePrimitive
== PRIM_UNKNOWN
) {
5226 /* Typically the first begin. This may raise an error on
5227 * playback, depending on whether CallList is issued from inside
5228 * a begin/end or not.
5230 ctx
->Driver
.CurrentSavePrimitive
= PRIM_INSIDE_UNKNOWN_PRIM
;
5232 else if (ctx
->Driver
.CurrentSavePrimitive
== PRIM_OUTSIDE_BEGIN_END
) {
5233 ctx
->Driver
.CurrentSavePrimitive
= mode
;
5236 _mesa_compile_error(ctx
, GL_INVALID_OPERATION
, "recursive begin");
5241 /* Give the driver an opportunity to hook in an optimized
5242 * display list compiler.
5244 if (ctx
->Driver
.NotifySaveBegin(ctx
, mode
))
5247 SAVE_FLUSH_VERTICES(ctx
);
5248 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BEGIN
, 1);
5254 if (ctx
->ExecuteFlag
) {
5255 CALL_Begin(ctx
->Exec
, (mode
));
5259 static void GLAPIENTRY
5262 GET_CURRENT_CONTEXT(ctx
);
5263 SAVE_FLUSH_VERTICES(ctx
);
5264 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_END
, 0);
5265 ctx
->Driver
.CurrentSavePrimitive
= PRIM_OUTSIDE_BEGIN_END
;
5266 if (ctx
->ExecuteFlag
) {
5267 CALL_End(ctx
->Exec
, ());
5271 static void GLAPIENTRY
5272 save_Rectf(GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
5274 GET_CURRENT_CONTEXT(ctx
);
5276 SAVE_FLUSH_VERTICES(ctx
);
5277 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_RECTF
, 4);
5284 if (ctx
->ExecuteFlag
) {
5285 CALL_Rectf(ctx
->Exec
, (a
, b
, c
, d
));
5290 static void GLAPIENTRY
5291 save_Vertex2f(GLfloat x
, GLfloat y
)
5293 save_Attr2fNV(VERT_ATTRIB_POS
, x
, y
);
5296 static void GLAPIENTRY
5297 save_Vertex2fv(const GLfloat
* v
)
5299 save_Attr2fNV(VERT_ATTRIB_POS
, v
[0], v
[1]);
5302 static void GLAPIENTRY
5303 save_Vertex3f(GLfloat x
, GLfloat y
, GLfloat z
)
5305 save_Attr3fNV(VERT_ATTRIB_POS
, x
, y
, z
);
5308 static void GLAPIENTRY
5309 save_Vertex3fv(const GLfloat
* v
)
5311 save_Attr3fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2]);
5314 static void GLAPIENTRY
5315 save_Vertex4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5317 save_Attr4fNV(VERT_ATTRIB_POS
, x
, y
, z
, w
);
5320 static void GLAPIENTRY
5321 save_Vertex4fv(const GLfloat
* v
)
5323 save_Attr4fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2], v
[3]);
5326 static void GLAPIENTRY
5327 save_TexCoord1f(GLfloat x
)
5329 save_Attr1fNV(VERT_ATTRIB_TEX0
, x
);
5332 static void GLAPIENTRY
5333 save_TexCoord1fv(const GLfloat
* v
)
5335 save_Attr1fNV(VERT_ATTRIB_TEX0
, v
[0]);
5338 static void GLAPIENTRY
5339 save_TexCoord2f(GLfloat x
, GLfloat y
)
5341 save_Attr2fNV(VERT_ATTRIB_TEX0
, x
, y
);
5344 static void GLAPIENTRY
5345 save_TexCoord2fv(const GLfloat
* v
)
5347 save_Attr2fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1]);
5350 static void GLAPIENTRY
5351 save_TexCoord3f(GLfloat x
, GLfloat y
, GLfloat z
)
5353 save_Attr3fNV(VERT_ATTRIB_TEX0
, x
, y
, z
);
5356 static void GLAPIENTRY
5357 save_TexCoord3fv(const GLfloat
* v
)
5359 save_Attr3fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2]);
5362 static void GLAPIENTRY
5363 save_TexCoord4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5365 save_Attr4fNV(VERT_ATTRIB_TEX0
, x
, y
, z
, w
);
5368 static void GLAPIENTRY
5369 save_TexCoord4fv(const GLfloat
* v
)
5371 save_Attr4fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2], v
[3]);
5374 static void GLAPIENTRY
5375 save_Normal3f(GLfloat x
, GLfloat y
, GLfloat z
)
5377 save_Attr3fNV(VERT_ATTRIB_NORMAL
, x
, y
, z
);
5380 static void GLAPIENTRY
5381 save_Normal3fv(const GLfloat
* v
)
5383 save_Attr3fNV(VERT_ATTRIB_NORMAL
, v
[0], v
[1], v
[2]);
5386 static void GLAPIENTRY
5387 save_FogCoordfEXT(GLfloat x
)
5389 save_Attr1fNV(VERT_ATTRIB_FOG
, x
);
5392 static void GLAPIENTRY
5393 save_FogCoordfvEXT(const GLfloat
* v
)
5395 save_Attr1fNV(VERT_ATTRIB_FOG
, v
[0]);
5398 static void GLAPIENTRY
5399 save_Color3f(GLfloat x
, GLfloat y
, GLfloat z
)
5401 save_Attr3fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
);
5404 static void GLAPIENTRY
5405 save_Color3fv(const GLfloat
* v
)
5407 save_Attr3fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2]);
5410 static void GLAPIENTRY
5411 save_Color4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5413 save_Attr4fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
, w
);
5416 static void GLAPIENTRY
5417 save_Color4fv(const GLfloat
* v
)
5419 save_Attr4fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2], v
[3]);
5422 static void GLAPIENTRY
5423 save_SecondaryColor3fEXT(GLfloat x
, GLfloat y
, GLfloat z
)
5425 save_Attr3fNV(VERT_ATTRIB_COLOR1
, x
, y
, z
);
5428 static void GLAPIENTRY
5429 save_SecondaryColor3fvEXT(const GLfloat
* v
)
5431 save_Attr3fNV(VERT_ATTRIB_COLOR1
, v
[0], v
[1], v
[2]);
5435 /* Just call the respective ATTR for texcoord
5437 static void GLAPIENTRY
5438 save_MultiTexCoord1f(GLenum target
, GLfloat x
)
5440 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5441 save_Attr1fNV(attr
, x
);
5444 static void GLAPIENTRY
5445 save_MultiTexCoord1fv(GLenum target
, const GLfloat
* v
)
5447 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5448 save_Attr1fNV(attr
, v
[0]);
5451 static void GLAPIENTRY
5452 save_MultiTexCoord2f(GLenum target
, GLfloat x
, GLfloat y
)
5454 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5455 save_Attr2fNV(attr
, x
, y
);
5458 static void GLAPIENTRY
5459 save_MultiTexCoord2fv(GLenum target
, const GLfloat
* v
)
5461 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5462 save_Attr2fNV(attr
, v
[0], v
[1]);
5465 static void GLAPIENTRY
5466 save_MultiTexCoord3f(GLenum target
, GLfloat x
, GLfloat y
, GLfloat z
)
5468 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5469 save_Attr3fNV(attr
, x
, y
, z
);
5472 static void GLAPIENTRY
5473 save_MultiTexCoord3fv(GLenum target
, const GLfloat
* v
)
5475 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5476 save_Attr3fNV(attr
, v
[0], v
[1], v
[2]);
5479 static void GLAPIENTRY
5480 save_MultiTexCoord4f(GLenum target
, GLfloat x
, GLfloat y
,
5481 GLfloat z
, GLfloat w
)
5483 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5484 save_Attr4fNV(attr
, x
, y
, z
, w
);
5487 static void GLAPIENTRY
5488 save_MultiTexCoord4fv(GLenum target
, const GLfloat
* v
)
5490 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5491 save_Attr4fNV(attr
, v
[0], v
[1], v
[2], v
[3]);
5496 * Record a GL_INVALID_VALUE error when a invalid vertex attribute
5502 GET_CURRENT_CONTEXT(ctx
);
5503 _mesa_error(ctx
, GL_INVALID_VALUE
, "VertexAttribf(index)");
5507 /* First level for NV_vertex_program:
5509 * Check for errors at compile time?.
5511 static void GLAPIENTRY
5512 save_VertexAttrib1fNV(GLuint index
, GLfloat x
)
5514 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5515 save_Attr1fNV(index
, x
);
5520 static void GLAPIENTRY
5521 save_VertexAttrib1fvNV(GLuint index
, const GLfloat
* v
)
5523 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5524 save_Attr1fNV(index
, v
[0]);
5529 static void GLAPIENTRY
5530 save_VertexAttrib2fNV(GLuint index
, GLfloat x
, GLfloat y
)
5532 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5533 save_Attr2fNV(index
, x
, y
);
5538 static void GLAPIENTRY
5539 save_VertexAttrib2fvNV(GLuint index
, const GLfloat
* v
)
5541 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5542 save_Attr2fNV(index
, v
[0], v
[1]);
5547 static void GLAPIENTRY
5548 save_VertexAttrib3fNV(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
5550 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5551 save_Attr3fNV(index
, x
, y
, z
);
5556 static void GLAPIENTRY
5557 save_VertexAttrib3fvNV(GLuint index
, const GLfloat
* v
)
5559 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5560 save_Attr3fNV(index
, v
[0], v
[1], v
[2]);
5565 static void GLAPIENTRY
5566 save_VertexAttrib4fNV(GLuint index
, GLfloat x
, GLfloat y
,
5567 GLfloat z
, GLfloat w
)
5569 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5570 save_Attr4fNV(index
, x
, y
, z
, w
);
5575 static void GLAPIENTRY
5576 save_VertexAttrib4fvNV(GLuint index
, const GLfloat
* v
)
5578 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5579 save_Attr4fNV(index
, v
[0], v
[1], v
[2], v
[3]);
5587 static void GLAPIENTRY
5588 save_VertexAttrib1fARB(GLuint index
, GLfloat x
)
5590 if (index
< MAX_VERTEX_ATTRIBS
)
5591 save_Attr1fARB(index
, x
);
5596 static void GLAPIENTRY
5597 save_VertexAttrib1fvARB(GLuint index
, const GLfloat
* v
)
5599 if (index
< MAX_VERTEX_ATTRIBS
)
5600 save_Attr1fARB(index
, v
[0]);
5605 static void GLAPIENTRY
5606 save_VertexAttrib2fARB(GLuint index
, GLfloat x
, GLfloat y
)
5608 if (index
< MAX_VERTEX_ATTRIBS
)
5609 save_Attr2fARB(index
, x
, y
);
5614 static void GLAPIENTRY
5615 save_VertexAttrib2fvARB(GLuint index
, const GLfloat
* v
)
5617 if (index
< MAX_VERTEX_ATTRIBS
)
5618 save_Attr2fARB(index
, v
[0], v
[1]);
5623 static void GLAPIENTRY
5624 save_VertexAttrib3fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
5626 if (index
< MAX_VERTEX_ATTRIBS
)
5627 save_Attr3fARB(index
, x
, y
, z
);
5632 static void GLAPIENTRY
5633 save_VertexAttrib3fvARB(GLuint index
, const GLfloat
* v
)
5635 if (index
< MAX_VERTEX_ATTRIBS
)
5636 save_Attr3fARB(index
, v
[0], v
[1], v
[2]);
5641 static void GLAPIENTRY
5642 save_VertexAttrib4fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
,
5645 if (index
< MAX_VERTEX_ATTRIBS
)
5646 save_Attr4fARB(index
, x
, y
, z
, w
);
5651 static void GLAPIENTRY
5652 save_VertexAttrib4fvARB(GLuint index
, const GLfloat
* v
)
5654 if (index
< MAX_VERTEX_ATTRIBS
)
5655 save_Attr4fARB(index
, v
[0], v
[1], v
[2], v
[3]);
5661 #if FEATURE_EXT_framebuffer_blit
5662 static void GLAPIENTRY
5663 save_BlitFramebufferEXT(GLint srcX0
, GLint srcY0
, GLint srcX1
, GLint srcY1
,
5664 GLint dstX0
, GLint dstY0
, GLint dstX1
, GLint dstY1
,
5665 GLbitfield mask
, GLenum filter
)
5667 GET_CURRENT_CONTEXT(ctx
);
5669 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5670 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BLIT_FRAMEBUFFER
, 10);
5683 if (ctx
->ExecuteFlag
) {
5684 CALL_BlitFramebufferEXT(ctx
->Exec
, (srcX0
, srcY0
, srcX1
, srcY1
,
5685 dstX0
, dstY0
, dstX1
, dstY1
,
5693 * Save an error-generating command into display list.
5695 * KW: Will appear in the list before the vertex buffer containing the
5696 * command that provoked the error. I don't see this as a problem.
5699 save_error(GLcontext
*ctx
, GLenum error
, const char *s
)
5702 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ERROR
, 2);
5705 n
[2].data
= (void *) s
;
5711 * Compile an error into current display list.
5714 _mesa_compile_error(GLcontext
*ctx
, GLenum error
, const char *s
)
5716 if (ctx
->CompileFlag
)
5717 save_error(ctx
, error
, s
);
5718 if (ctx
->ExecuteFlag
)
5719 _mesa_error(ctx
, error
, s
);
5724 * Test if ID names a display list.
5727 islist(GLcontext
*ctx
, GLuint list
)
5729 if (list
> 0 && lookup_list(ctx
, list
)) {
5739 /**********************************************************************/
5740 /* Display list execution */
5741 /**********************************************************************/
5745 * Execute a display list. Note that the ListBase offset must have already
5746 * been added before calling this function. I.e. the list argument is
5747 * the absolute list number, not relative to ListBase.
5748 * \param list - display list number
5751 execute_list(GLcontext
*ctx
, GLuint list
)
5753 struct mesa_display_list
*dlist
;
5757 if (list
== 0 || !islist(ctx
, list
))
5760 if (ctx
->ListState
.CallDepth
== MAX_LIST_NESTING
) {
5761 /* raise an error? */
5765 dlist
= lookup_list(ctx
, list
);
5769 ctx
->ListState
.CallStack
[ctx
->ListState
.CallDepth
++] = dlist
;
5771 if (ctx
->Driver
.BeginCallList
)
5772 ctx
->Driver
.BeginCallList(ctx
, dlist
);
5778 OpCode opcode
= n
[0].opcode
;
5779 int i
= (int) n
[0].opcode
- (int) OPCODE_EXT_0
;
5781 if (i
>= 0 && i
< (GLint
) ctx
->ListExt
.NumOpcodes
) {
5782 /* this is a driver-extended opcode */
5783 ctx
->ListExt
.Opcode
[i
].Execute(ctx
, &n
[1]);
5784 n
+= ctx
->ListExt
.Opcode
[i
].Size
;
5789 _mesa_error(ctx
, n
[1].e
, (const char *) n
[2].data
);
5792 CALL_Accum(ctx
->Exec
, (n
[1].e
, n
[2].f
));
5794 case OPCODE_ALPHA_FUNC
:
5795 CALL_AlphaFunc(ctx
->Exec
, (n
[1].e
, n
[2].f
));
5797 case OPCODE_BIND_TEXTURE
:
5798 CALL_BindTexture(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
5802 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5803 ctx
->Unpack
= ctx
->DefaultPacking
;
5804 CALL_Bitmap(ctx
->Exec
, ((GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
5805 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
5806 (const GLubyte
*) n
[7].data
));
5807 ctx
->Unpack
= save
; /* restore */
5810 case OPCODE_BLEND_COLOR
:
5811 CALL_BlendColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
5813 case OPCODE_BLEND_EQUATION
:
5814 CALL_BlendEquation(ctx
->Exec
, (n
[1].e
));
5816 case OPCODE_BLEND_EQUATION_SEPARATE
:
5817 CALL_BlendEquationSeparateEXT(ctx
->Exec
, (n
[1].e
, n
[2].e
));
5819 case OPCODE_BLEND_FUNC_SEPARATE
:
5820 CALL_BlendFuncSeparateEXT(ctx
->Exec
,
5821 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
5823 case OPCODE_CALL_LIST
:
5824 /* Generated by glCallList(), don't add ListBase */
5825 if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
5826 execute_list(ctx
, n
[1].ui
);
5829 case OPCODE_CALL_LIST_OFFSET
:
5830 /* Generated by glCallLists() so we must add ListBase */
5832 /* user specified a bad data type at compile time */
5833 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
5835 else if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
5836 execute_list(ctx
, ctx
->List
.ListBase
+ n
[1].ui
);
5840 CALL_Clear(ctx
->Exec
, (n
[1].bf
));
5842 case OPCODE_CLEAR_COLOR
:
5843 CALL_ClearColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
5845 case OPCODE_CLEAR_ACCUM
:
5846 CALL_ClearAccum(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
5848 case OPCODE_CLEAR_DEPTH
:
5849 CALL_ClearDepth(ctx
->Exec
, ((GLclampd
) n
[1].f
));
5851 case OPCODE_CLEAR_INDEX
:
5852 CALL_ClearIndex(ctx
->Exec
, ((GLfloat
) n
[1].ui
));
5854 case OPCODE_CLEAR_STENCIL
:
5855 CALL_ClearStencil(ctx
->Exec
, (n
[1].i
));
5857 case OPCODE_CLIP_PLANE
:
5864 CALL_ClipPlane(ctx
->Exec
, (n
[1].e
, eq
));
5867 case OPCODE_COLOR_MASK
:
5868 CALL_ColorMask(ctx
->Exec
, (n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
));
5870 case OPCODE_COLOR_MATERIAL
:
5871 CALL_ColorMaterial(ctx
->Exec
, (n
[1].e
, n
[2].e
));
5873 case OPCODE_COLOR_TABLE
:
5875 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5876 ctx
->Unpack
= ctx
->DefaultPacking
;
5877 CALL_ColorTable(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].e
,
5878 n
[5].e
, n
[6].data
));
5879 ctx
->Unpack
= save
; /* restore */
5882 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
5889 CALL_ColorTableParameterfv(ctx
->Exec
,
5890 (n
[1].e
, n
[2].e
, params
));
5893 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
5900 CALL_ColorTableParameteriv(ctx
->Exec
,
5901 (n
[1].e
, n
[2].e
, params
));
5904 case OPCODE_COLOR_SUB_TABLE
:
5906 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5907 ctx
->Unpack
= ctx
->DefaultPacking
;
5908 CALL_ColorSubTable(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5909 n
[4].e
, n
[5].e
, n
[6].data
));
5910 ctx
->Unpack
= save
; /* restore */
5913 case OPCODE_CONVOLUTION_FILTER_1D
:
5915 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5916 ctx
->Unpack
= ctx
->DefaultPacking
;
5917 CALL_ConvolutionFilter1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5920 ctx
->Unpack
= save
; /* restore */
5923 case OPCODE_CONVOLUTION_FILTER_2D
:
5925 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5926 ctx
->Unpack
= ctx
->DefaultPacking
;
5927 CALL_ConvolutionFilter2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5928 n
[4].i
, n
[5].e
, n
[6].e
,
5930 ctx
->Unpack
= save
; /* restore */
5933 case OPCODE_CONVOLUTION_PARAMETER_I
:
5934 CALL_ConvolutionParameteri(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].i
));
5936 case OPCODE_CONVOLUTION_PARAMETER_IV
:
5943 CALL_ConvolutionParameteriv(ctx
->Exec
,
5944 (n
[1].e
, n
[2].e
, params
));
5947 case OPCODE_CONVOLUTION_PARAMETER_F
:
5948 CALL_ConvolutionParameterf(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].f
));
5950 case OPCODE_CONVOLUTION_PARAMETER_FV
:
5957 CALL_ConvolutionParameterfv(ctx
->Exec
,
5958 (n
[1].e
, n
[2].e
, params
));
5961 case OPCODE_COPY_COLOR_SUB_TABLE
:
5962 CALL_CopyColorSubTable(ctx
->Exec
, (n
[1].e
, n
[2].i
,
5963 n
[3].i
, n
[4].i
, n
[5].i
));
5965 case OPCODE_COPY_COLOR_TABLE
:
5966 CALL_CopyColorSubTable(ctx
->Exec
, (n
[1].e
, n
[2].i
,
5967 n
[3].i
, n
[4].i
, n
[5].i
));
5969 case OPCODE_COPY_PIXELS
:
5970 CALL_CopyPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
,
5971 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
,
5974 case OPCODE_COPY_TEX_IMAGE1D
:
5975 CALL_CopyTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
5976 n
[5].i
, n
[6].i
, n
[7].i
));
5978 case OPCODE_COPY_TEX_IMAGE2D
:
5979 CALL_CopyTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
5980 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
));
5982 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
5983 CALL_CopyTexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5984 n
[4].i
, n
[5].i
, n
[6].i
));
5986 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
5987 CALL_CopyTexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5988 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
5991 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
5992 CALL_CopyTexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5993 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
5996 case OPCODE_CULL_FACE
:
5997 CALL_CullFace(ctx
->Exec
, (n
[1].e
));
5999 case OPCODE_DEPTH_FUNC
:
6000 CALL_DepthFunc(ctx
->Exec
, (n
[1].e
));
6002 case OPCODE_DEPTH_MASK
:
6003 CALL_DepthMask(ctx
->Exec
, (n
[1].b
));
6005 case OPCODE_DEPTH_RANGE
:
6006 CALL_DepthRange(ctx
->Exec
,
6007 ((GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
));
6009 case OPCODE_DISABLE
:
6010 CALL_Disable(ctx
->Exec
, (n
[1].e
));
6012 case OPCODE_DRAW_BUFFER
:
6013 CALL_DrawBuffer(ctx
->Exec
, (n
[1].e
));
6015 case OPCODE_DRAW_PIXELS
:
6017 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6018 ctx
->Unpack
= ctx
->DefaultPacking
;
6019 CALL_DrawPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
6021 ctx
->Unpack
= save
; /* restore */
6025 CALL_Enable(ctx
->Exec
, (n
[1].e
));
6027 case OPCODE_EVALMESH1
:
6028 CALL_EvalMesh1(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
));
6030 case OPCODE_EVALMESH2
:
6031 CALL_EvalMesh2(ctx
->Exec
,
6032 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
6041 CALL_Fogfv(ctx
->Exec
, (n
[1].e
, p
));
6044 case OPCODE_FRONT_FACE
:
6045 CALL_FrontFace(ctx
->Exec
, (n
[1].e
));
6047 case OPCODE_FRUSTUM
:
6048 CALL_Frustum(ctx
->Exec
,
6049 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
6052 CALL_Hint(ctx
->Exec
, (n
[1].e
, n
[2].e
));
6054 case OPCODE_HISTOGRAM
:
6055 CALL_Histogram(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].b
));
6057 case OPCODE_INDEX_MASK
:
6058 CALL_IndexMask(ctx
->Exec
, (n
[1].ui
));
6060 case OPCODE_INIT_NAMES
:
6061 CALL_InitNames(ctx
->Exec
, ());
6070 CALL_Lightfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, p
));
6073 case OPCODE_LIGHT_MODEL
:
6080 CALL_LightModelfv(ctx
->Exec
, (n
[1].e
, p
));
6083 case OPCODE_LINE_STIPPLE
:
6084 CALL_LineStipple(ctx
->Exec
, (n
[1].i
, n
[2].us
));
6086 case OPCODE_LINE_WIDTH
:
6087 CALL_LineWidth(ctx
->Exec
, (n
[1].f
));
6089 case OPCODE_LIST_BASE
:
6090 CALL_ListBase(ctx
->Exec
, (n
[1].ui
));
6092 case OPCODE_LOAD_IDENTITY
:
6093 CALL_LoadIdentity(ctx
->Exec
, ());
6095 case OPCODE_LOAD_MATRIX
:
6096 if (sizeof(Node
) == sizeof(GLfloat
)) {
6097 CALL_LoadMatrixf(ctx
->Exec
, (&n
[1].f
));
6102 for (i
= 0; i
< 16; i
++) {
6105 CALL_LoadMatrixf(ctx
->Exec
, (m
));
6108 case OPCODE_LOAD_NAME
:
6109 CALL_LoadName(ctx
->Exec
, (n
[1].ui
));
6111 case OPCODE_LOGIC_OP
:
6112 CALL_LogicOp(ctx
->Exec
, (n
[1].e
));
6116 GLenum target
= n
[1].e
;
6117 GLint ustride
= _mesa_evaluator_components(target
);
6118 GLint uorder
= n
[5].i
;
6119 GLfloat u1
= n
[2].f
;
6120 GLfloat u2
= n
[3].f
;
6121 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
6122 (GLfloat
*) n
[6].data
));
6127 GLenum target
= n
[1].e
;
6128 GLfloat u1
= n
[2].f
;
6129 GLfloat u2
= n
[3].f
;
6130 GLfloat v1
= n
[4].f
;
6131 GLfloat v2
= n
[5].f
;
6132 GLint ustride
= n
[6].i
;
6133 GLint vstride
= n
[7].i
;
6134 GLint uorder
= n
[8].i
;
6135 GLint vorder
= n
[9].i
;
6136 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
6137 v1
, v2
, vstride
, vorder
,
6138 (GLfloat
*) n
[10].data
));
6141 case OPCODE_MAPGRID1
:
6142 CALL_MapGrid1f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
6144 case OPCODE_MAPGRID2
:
6145 CALL_MapGrid2f(ctx
->Exec
,
6146 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
));
6148 case OPCODE_MATRIX_MODE
:
6149 CALL_MatrixMode(ctx
->Exec
, (n
[1].e
));
6151 case OPCODE_MIN_MAX
:
6152 CALL_Minmax(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].b
));
6154 case OPCODE_MULT_MATRIX
:
6155 if (sizeof(Node
) == sizeof(GLfloat
)) {
6156 CALL_MultMatrixf(ctx
->Exec
, (&n
[1].f
));
6161 for (i
= 0; i
< 16; i
++) {
6164 CALL_MultMatrixf(ctx
->Exec
, (m
));
6168 CALL_Ortho(ctx
->Exec
,
6169 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
6171 case OPCODE_PASSTHROUGH
:
6172 CALL_PassThrough(ctx
->Exec
, (n
[1].f
));
6174 case OPCODE_PIXEL_MAP
:
6175 CALL_PixelMapfv(ctx
->Exec
,
6176 (n
[1].e
, n
[2].i
, (GLfloat
*) n
[3].data
));
6178 case OPCODE_PIXEL_TRANSFER
:
6179 CALL_PixelTransferf(ctx
->Exec
, (n
[1].e
, n
[2].f
));
6181 case OPCODE_PIXEL_ZOOM
:
6182 CALL_PixelZoom(ctx
->Exec
, (n
[1].f
, n
[2].f
));
6184 case OPCODE_POINT_SIZE
:
6185 CALL_PointSize(ctx
->Exec
, (n
[1].f
));
6187 case OPCODE_POINT_PARAMETERS
:
6193 CALL_PointParameterfvEXT(ctx
->Exec
, (n
[1].e
, params
));
6196 case OPCODE_POLYGON_MODE
:
6197 CALL_PolygonMode(ctx
->Exec
, (n
[1].e
, n
[2].e
));
6199 case OPCODE_POLYGON_STIPPLE
:
6200 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) n
[1].data
));
6202 case OPCODE_POLYGON_OFFSET
:
6203 CALL_PolygonOffset(ctx
->Exec
, (n
[1].f
, n
[2].f
));
6205 case OPCODE_POP_ATTRIB
:
6206 CALL_PopAttrib(ctx
->Exec
, ());
6208 case OPCODE_POP_MATRIX
:
6209 CALL_PopMatrix(ctx
->Exec
, ());
6211 case OPCODE_POP_NAME
:
6212 CALL_PopName(ctx
->Exec
, ());
6214 case OPCODE_PRIORITIZE_TEXTURE
:
6215 CALL_PrioritizeTextures(ctx
->Exec
, (1, &n
[1].ui
, &n
[2].f
));
6217 case OPCODE_PUSH_ATTRIB
:
6218 CALL_PushAttrib(ctx
->Exec
, (n
[1].bf
));
6220 case OPCODE_PUSH_MATRIX
:
6221 CALL_PushMatrix(ctx
->Exec
, ());
6223 case OPCODE_PUSH_NAME
:
6224 CALL_PushName(ctx
->Exec
, (n
[1].ui
));
6226 case OPCODE_RASTER_POS
:
6227 CALL_RasterPos4f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
6229 case OPCODE_READ_BUFFER
:
6230 CALL_ReadBuffer(ctx
->Exec
, (n
[1].e
));
6232 case OPCODE_RESET_HISTOGRAM
:
6233 CALL_ResetHistogram(ctx
->Exec
, (n
[1].e
));
6235 case OPCODE_RESET_MIN_MAX
:
6236 CALL_ResetMinmax(ctx
->Exec
, (n
[1].e
));
6239 CALL_Rotatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
6242 CALL_Scalef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
6244 case OPCODE_SCISSOR
:
6245 CALL_Scissor(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
6247 case OPCODE_SHADE_MODEL
:
6248 CALL_ShadeModel(ctx
->Exec
, (n
[1].e
));
6250 case OPCODE_STENCIL_FUNC
:
6251 CALL_StencilFunc(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].ui
));
6253 case OPCODE_STENCIL_MASK
:
6254 CALL_StencilMask(ctx
->Exec
, (n
[1].ui
));
6256 case OPCODE_STENCIL_OP
:
6257 CALL_StencilOp(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].e
));
6259 case OPCODE_STENCIL_FUNC_SEPARATE
:
6260 CALL_StencilFuncSeparate(ctx
->Exec
,
6261 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].ui
));
6263 case OPCODE_STENCIL_MASK_SEPARATE
:
6264 CALL_StencilMaskSeparate(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
6266 case OPCODE_STENCIL_OP_SEPARATE
:
6267 CALL_StencilOpSeparate(ctx
->Exec
,
6268 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
6277 CALL_TexEnvfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
6287 CALL_TexGenfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
6290 case OPCODE_TEXPARAMETER
:
6297 CALL_TexParameterfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
6300 case OPCODE_TEX_IMAGE1D
:
6302 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6303 ctx
->Unpack
= ctx
->DefaultPacking
;
6304 CALL_TexImage1D(ctx
->Exec
, (n
[1].e
, /* target */
6306 n
[3].i
, /* components */
6308 n
[5].e
, /* border */
6309 n
[6].e
, /* format */
6312 ctx
->Unpack
= save
; /* restore */
6315 case OPCODE_TEX_IMAGE2D
:
6317 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6318 ctx
->Unpack
= ctx
->DefaultPacking
;
6319 CALL_TexImage2D(ctx
->Exec
, (n
[1].e
, /* target */
6321 n
[3].i
, /* components */
6323 n
[5].i
, /* height */
6324 n
[6].e
, /* border */
6325 n
[7].e
, /* format */
6328 ctx
->Unpack
= save
; /* restore */
6331 case OPCODE_TEX_IMAGE3D
:
6333 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6334 ctx
->Unpack
= ctx
->DefaultPacking
;
6335 CALL_TexImage3D(ctx
->Exec
, (n
[1].e
, /* target */
6337 n
[3].i
, /* components */
6339 n
[5].i
, /* height */
6341 n
[7].e
, /* border */
6342 n
[8].e
, /* format */
6345 ctx
->Unpack
= save
; /* restore */
6348 case OPCODE_TEX_SUB_IMAGE1D
:
6350 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6351 ctx
->Unpack
= ctx
->DefaultPacking
;
6352 CALL_TexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
6354 n
[6].e
, n
[7].data
));
6355 ctx
->Unpack
= save
; /* restore */
6358 case OPCODE_TEX_SUB_IMAGE2D
:
6360 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6361 ctx
->Unpack
= ctx
->DefaultPacking
;
6362 CALL_TexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
6364 n
[6].i
, n
[7].e
, n
[8].e
,
6366 ctx
->Unpack
= save
; /* restore */
6369 case OPCODE_TEX_SUB_IMAGE3D
:
6371 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6372 ctx
->Unpack
= ctx
->DefaultPacking
;
6373 CALL_TexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
6374 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
6375 n
[8].i
, n
[9].e
, n
[10].e
,
6377 ctx
->Unpack
= save
; /* restore */
6380 case OPCODE_TRANSLATE
:
6381 CALL_Translatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
6383 case OPCODE_VIEWPORT
:
6384 CALL_Viewport(ctx
->Exec
, (n
[1].i
, n
[2].i
,
6385 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
));
6387 case OPCODE_WINDOW_POS
:
6388 CALL_WindowPos4fMESA(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
6390 case OPCODE_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
6391 CALL_ActiveTextureARB(ctx
->Exec
, (n
[1].e
));
6393 case OPCODE_COMPRESSED_TEX_IMAGE_1D
: /* GL_ARB_texture_compression */
6394 CALL_CompressedTexImage1DARB(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
6395 n
[4].i
, n
[5].i
, n
[6].i
,
6398 case OPCODE_COMPRESSED_TEX_IMAGE_2D
: /* GL_ARB_texture_compression */
6399 CALL_CompressedTexImage2DARB(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
6400 n
[4].i
, n
[5].i
, n
[6].i
,
6401 n
[7].i
, n
[8].data
));
6403 case OPCODE_COMPRESSED_TEX_IMAGE_3D
: /* GL_ARB_texture_compression */
6404 CALL_CompressedTexImage3DARB(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
6405 n
[4].i
, n
[5].i
, n
[6].i
,
6409 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
: /* GL_ARB_texture_compress */
6410 CALL_CompressedTexSubImage1DARB(ctx
->Exec
,
6411 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
6412 n
[5].e
, n
[6].i
, n
[7].data
));
6414 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
: /* GL_ARB_texture_compress */
6415 CALL_CompressedTexSubImage2DARB(ctx
->Exec
,
6416 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
6417 n
[5].i
, n
[6].i
, n
[7].e
, n
[8].i
,
6420 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
: /* GL_ARB_texture_compress */
6421 CALL_CompressedTexSubImage3DARB(ctx
->Exec
,
6422 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
6423 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
6424 n
[9].e
, n
[10].i
, n
[11].data
));
6426 case OPCODE_SAMPLE_COVERAGE
: /* GL_ARB_multisample */
6427 CALL_SampleCoverageARB(ctx
->Exec
, (n
[1].f
, n
[2].b
));
6429 case OPCODE_WINDOW_POS_ARB
: /* GL_ARB_window_pos */
6430 CALL_WindowPos3fMESA(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
6432 #if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
6433 case OPCODE_BIND_PROGRAM_NV
: /* GL_NV_vertex_program */
6434 CALL_BindProgramNV(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
6437 #if FEATURE_NV_vertex_program
6438 case OPCODE_EXECUTE_PROGRAM_NV
:
6445 CALL_ExecuteProgramNV(ctx
->Exec
, (n
[1].e
, n
[2].ui
, v
));
6448 case OPCODE_REQUEST_RESIDENT_PROGRAMS_NV
:
6449 CALL_RequestResidentProgramsNV(ctx
->Exec
, (n
[1].ui
,
6450 (GLuint
*) n
[2].data
));
6452 case OPCODE_LOAD_PROGRAM_NV
:
6453 CALL_LoadProgramNV(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].i
,
6454 (const GLubyte
*) n
[4].data
));
6456 case OPCODE_PROGRAM_PARAMETER4F_NV
:
6457 CALL_ProgramParameter4fNV(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].f
,
6458 n
[4].f
, n
[5].f
, n
[6].f
));
6460 case OPCODE_TRACK_MATRIX_NV
:
6461 CALL_TrackMatrixNV(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].e
, n
[4].e
));
6465 #if FEATURE_NV_fragment_program
6466 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
:
6467 CALL_ProgramLocalParameter4fARB(ctx
->Exec
,
6468 (n
[1].e
, n
[2].ui
, n
[3].f
, n
[4].f
,
6471 case OPCODE_PROGRAM_NAMED_PARAMETER_NV
:
6472 CALL_ProgramNamedParameter4fNV(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
6473 (const GLubyte
*) n
[3].
6474 data
, n
[4].f
, n
[5].f
,
6479 case OPCODE_ACTIVE_STENCIL_FACE_EXT
:
6480 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (n
[1].e
));
6482 case OPCODE_DEPTH_BOUNDS_EXT
:
6483 CALL_DepthBoundsEXT(ctx
->Exec
, (n
[1].f
, n
[2].f
));
6485 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
6486 case OPCODE_PROGRAM_STRING_ARB
:
6487 CALL_ProgramStringARB(ctx
->Exec
,
6488 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].data
));
6490 case OPCODE_PROGRAM_ENV_PARAMETER_ARB
:
6491 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].f
,
6496 #if FEATURE_ARB_occlusion_query
6497 case OPCODE_BEGIN_QUERY_ARB
:
6498 CALL_BeginQueryARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
6500 case OPCODE_END_QUERY_ARB
:
6501 CALL_EndQueryARB(ctx
->Exec
, (n
[1].e
));
6504 case OPCODE_DRAW_BUFFERS_ARB
:
6506 GLenum buffers
[MAX_DRAW_BUFFERS
];
6507 GLint i
, count
= MIN2(n
[1].i
, MAX_DRAW_BUFFERS
);
6508 for (i
= 0; i
< count
; i
++)
6509 buffers
[i
] = n
[2 + i
].e
;
6510 CALL_DrawBuffersARB(ctx
->Exec
, (n
[1].i
, buffers
));
6513 #if FEATURE_EXT_framebuffer_blit
6514 case OPCODE_BLIT_FRAMEBUFFER
:
6515 CALL_BlitFramebufferEXT(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
,
6516 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
6520 #if FEATURE_ATI_fragment_shader
6521 case OPCODE_BIND_FRAGMENT_SHADER_ATI
:
6522 CALL_BindFragmentShaderATI(ctx
->Exec
, (n
[1].i
));
6524 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
:
6527 GLuint i
, dst
= n
[1].ui
;
6529 for (i
= 0; i
< 4; i
++)
6530 values
[i
] = n
[1 + i
].f
;
6531 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, values
));
6535 case OPCODE_ATTR_1F_NV
:
6536 CALL_VertexAttrib1fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
));
6538 case OPCODE_ATTR_2F_NV
:
6539 /* Really shouldn't have to do this - the Node structure
6540 * is convenient, but it would be better to store the data
6541 * packed appropriately so that it can be sent directly
6542 * on. With x86_64 becoming common, this will start to
6545 if (sizeof(Node
) == sizeof(GLfloat
))
6546 CALL_VertexAttrib2fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6548 CALL_VertexAttrib2fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
));
6550 case OPCODE_ATTR_3F_NV
:
6551 if (sizeof(Node
) == sizeof(GLfloat
))
6552 CALL_VertexAttrib3fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6554 CALL_VertexAttrib3fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
6557 case OPCODE_ATTR_4F_NV
:
6558 if (sizeof(Node
) == sizeof(GLfloat
))
6559 CALL_VertexAttrib4fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6561 CALL_VertexAttrib4fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
6564 case OPCODE_ATTR_1F_ARB
:
6565 CALL_VertexAttrib1fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
));
6567 case OPCODE_ATTR_2F_ARB
:
6568 /* Really shouldn't have to do this - the Node structure
6569 * is convenient, but it would be better to store the data
6570 * packed appropriately so that it can be sent directly
6571 * on. With x86_64 becoming common, this will start to
6574 if (sizeof(Node
) == sizeof(GLfloat
))
6575 CALL_VertexAttrib2fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6577 CALL_VertexAttrib2fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
));
6579 case OPCODE_ATTR_3F_ARB
:
6580 if (sizeof(Node
) == sizeof(GLfloat
))
6581 CALL_VertexAttrib3fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6583 CALL_VertexAttrib3fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
6586 case OPCODE_ATTR_4F_ARB
:
6587 if (sizeof(Node
) == sizeof(GLfloat
))
6588 CALL_VertexAttrib4fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6590 CALL_VertexAttrib4fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
6593 case OPCODE_MATERIAL
:
6594 if (sizeof(Node
) == sizeof(GLfloat
))
6595 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, &n
[3].f
));
6602 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, f
));
6606 CALL_Indexf(ctx
->Exec
, (n
[1].f
));
6608 case OPCODE_EDGEFLAG
:
6609 CALL_EdgeFlag(ctx
->Exec
, (n
[1].b
));
6612 CALL_Begin(ctx
->Exec
, (n
[1].e
));
6615 CALL_End(ctx
->Exec
, ());
6618 CALL_Rectf(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
6620 case OPCODE_EVAL_C1
:
6621 CALL_EvalCoord1f(ctx
->Exec
, (n
[1].f
));
6623 case OPCODE_EVAL_C2
:
6624 CALL_EvalCoord2f(ctx
->Exec
, (n
[1].f
, n
[2].f
));
6626 case OPCODE_EVAL_P1
:
6627 CALL_EvalPoint1(ctx
->Exec
, (n
[1].i
));
6629 case OPCODE_EVAL_P2
:
6630 CALL_EvalPoint2(ctx
->Exec
, (n
[1].i
, n
[2].i
));
6636 case OPCODE_CONTINUE
:
6637 n
= (Node
*) n
[1].next
;
6639 case OPCODE_END_OF_LIST
:
6645 _mesa_sprintf(msg
, "Error in execute_list: opcode=%d",
6647 _mesa_problem(ctx
, msg
);
6652 /* increment n to point to next compiled command */
6653 if (opcode
!= OPCODE_CONTINUE
) {
6654 n
+= InstSize
[opcode
];
6659 if (ctx
->Driver
.EndCallList
)
6660 ctx
->Driver
.EndCallList(ctx
);
6662 ctx
->ListState
.CallStack
[ctx
->ListState
.CallDepth
--] = NULL
;
6667 /**********************************************************************/
6669 /**********************************************************************/
6672 * Test if a display list number is valid.
6674 GLboolean GLAPIENTRY
6675 _mesa_IsList(GLuint list
)
6677 GET_CURRENT_CONTEXT(ctx
);
6678 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
6679 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
6680 return islist(ctx
, list
);
6685 * Delete a sequence of consecutive display lists.
6688 _mesa_DeleteLists(GLuint list
, GLsizei range
)
6690 GET_CURRENT_CONTEXT(ctx
);
6692 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
6693 ASSERT_OUTSIDE_BEGIN_END(ctx
);
6696 _mesa_error(ctx
, GL_INVALID_VALUE
, "glDeleteLists");
6699 for (i
= list
; i
< list
+ range
; i
++) {
6700 destroy_list(ctx
, i
);
6706 * Return a display list number, n, such that lists n through n+range-1
6710 _mesa_GenLists(GLsizei range
)
6712 GET_CURRENT_CONTEXT(ctx
);
6714 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
6715 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, 0);
6718 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGenLists");
6726 * Make this an atomic operation
6728 _glthread_LOCK_MUTEX(ctx
->Shared
->Mutex
);
6730 base
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
6732 /* reserve the list IDs by with empty/dummy lists */
6734 for (i
= 0; i
< range
; i
++) {
6735 _mesa_HashInsert(ctx
->Shared
->DisplayList
, base
+ i
,
6736 make_list(base
+ i
, 1));
6740 _glthread_UNLOCK_MUTEX(ctx
->Shared
->Mutex
);
6747 * Begin a new display list.
6750 _mesa_NewList(GLuint list
, GLenum mode
)
6752 GET_CURRENT_CONTEXT(ctx
);
6755 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
6756 ASSERT_OUTSIDE_BEGIN_END(ctx
);
6758 if (MESA_VERBOSE
& VERBOSE_API
)
6759 _mesa_debug(ctx
, "glNewList %u %s\n", list
,
6760 _mesa_lookup_enum_by_nr(mode
));
6763 _mesa_error(ctx
, GL_INVALID_VALUE
, "glNewList");
6767 if (mode
!= GL_COMPILE
&& mode
!= GL_COMPILE_AND_EXECUTE
) {
6768 _mesa_error(ctx
, GL_INVALID_ENUM
, "glNewList");
6772 if (ctx
->ListState
.CurrentListPtr
) {
6773 /* already compiling a display list */
6774 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
6778 ctx
->CompileFlag
= GL_TRUE
;
6779 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
6781 /* Allocate new display list */
6782 ctx
->ListState
.CurrentListNum
= list
;
6783 ctx
->ListState
.CurrentList
= make_list(list
, BLOCK_SIZE
);
6784 ctx
->ListState
.CurrentBlock
= ctx
->ListState
.CurrentList
->node
;
6785 ctx
->ListState
.CurrentListPtr
= ctx
->ListState
.CurrentBlock
;
6786 ctx
->ListState
.CurrentPos
= 0;
6788 /* Reset acumulated list state:
6790 for (i
= 0; i
< VERT_ATTRIB_MAX
; i
++)
6791 ctx
->ListState
.ActiveAttribSize
[i
] = 0;
6793 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++)
6794 ctx
->ListState
.ActiveMaterialSize
[i
] = 0;
6796 ctx
->ListState
.ActiveIndex
= 0;
6797 ctx
->ListState
.ActiveEdgeFlag
= 0;
6799 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
6800 ctx
->Driver
.NewList(ctx
, list
, mode
);
6802 ctx
->CurrentDispatch
= ctx
->Save
;
6803 _glapi_set_dispatch(ctx
->CurrentDispatch
);
6808 * End definition of current display list.
6813 GET_CURRENT_CONTEXT(ctx
);
6814 SAVE_FLUSH_VERTICES(ctx
);
6815 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
6817 if (MESA_VERBOSE
& VERBOSE_API
)
6818 _mesa_debug(ctx
, "glEndList\n");
6820 /* Check that a list is under construction */
6821 if (!ctx
->ListState
.CurrentListPtr
) {
6822 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glEndList");
6826 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_END_OF_LIST
, 0);
6828 /* Destroy old list, if any */
6829 destroy_list(ctx
, ctx
->ListState
.CurrentListNum
);
6830 /* Install the list */
6831 _mesa_HashInsert(ctx
->Shared
->DisplayList
, ctx
->ListState
.CurrentListNum
,
6832 ctx
->ListState
.CurrentList
);
6835 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
6836 mesa_print_display_list(ctx
->ListState
.CurrentListNum
);
6838 ctx
->Driver
.EndList(ctx
);
6840 ctx
->ListState
.CurrentList
= NULL
;
6841 ctx
->ListState
.CurrentListNum
= 0;
6842 ctx
->ListState
.CurrentListPtr
= NULL
;
6843 ctx
->ExecuteFlag
= GL_TRUE
;
6844 ctx
->CompileFlag
= GL_FALSE
;
6846 ctx
->CurrentDispatch
= ctx
->Exec
;
6847 _glapi_set_dispatch(ctx
->CurrentDispatch
);
6852 _mesa_CallList(GLuint list
)
6854 GLboolean save_compile_flag
;
6855 GET_CURRENT_CONTEXT(ctx
);
6856 FLUSH_CURRENT(ctx
, 0);
6857 /* VERY IMPORTANT: Save the CompileFlag status, turn it off, */
6858 /* execute the display list, and restore the CompileFlag. */
6860 if (MESA_VERBOSE
& VERBOSE_API
)
6861 _mesa_debug(ctx
, "glCallList %d\n", list
);
6864 _mesa_error(ctx
, GL_INVALID_VALUE
, "glCallList(list==0)");
6868 /* mesa_print_display_list( list ); */
6870 save_compile_flag
= ctx
->CompileFlag
;
6871 if (save_compile_flag
) {
6872 ctx
->CompileFlag
= GL_FALSE
;
6875 execute_list(ctx
, list
);
6876 ctx
->CompileFlag
= save_compile_flag
;
6878 /* also restore API function pointers to point to "save" versions */
6879 if (save_compile_flag
) {
6880 ctx
->CurrentDispatch
= ctx
->Save
;
6881 _glapi_set_dispatch(ctx
->CurrentDispatch
);
6887 * Execute glCallLists: call multiple display lists.
6890 _mesa_CallLists(GLsizei n
, GLenum type
, const GLvoid
* lists
)
6892 GET_CURRENT_CONTEXT(ctx
);
6895 GLboolean save_compile_flag
;
6897 if (MESA_VERBOSE
& VERBOSE_API
)
6898 _mesa_debug(ctx
, "glCallLists %d\n", n
);
6902 case GL_UNSIGNED_BYTE
:
6904 case GL_UNSIGNED_SHORT
:
6906 case GL_UNSIGNED_INT
:
6914 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
6918 /* Save the CompileFlag status, turn it off, execute display list,
6919 * and restore the CompileFlag.
6921 save_compile_flag
= ctx
->CompileFlag
;
6922 ctx
->CompileFlag
= GL_FALSE
;
6924 for (i
= 0; i
< n
; i
++) {
6925 list
= translate_id(i
, type
, lists
);
6926 execute_list(ctx
, ctx
->List
.ListBase
+ list
);
6929 ctx
->CompileFlag
= save_compile_flag
;
6931 /* also restore API function pointers to point to "save" versions */
6932 if (save_compile_flag
) {
6933 ctx
->CurrentDispatch
= ctx
->Save
;
6934 _glapi_set_dispatch(ctx
->CurrentDispatch
);
6940 * Set the offset added to list numbers in glCallLists.
6943 _mesa_ListBase(GLuint base
)
6945 GET_CURRENT_CONTEXT(ctx
);
6946 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
6947 ASSERT_OUTSIDE_BEGIN_END(ctx
);
6948 ctx
->List
.ListBase
= base
;
6952 /* Can no longer assume ctx->Exec->Func is equal to _mesa_Func.
6954 static void GLAPIENTRY
6957 GET_CURRENT_CONTEXT(ctx
);
6958 FLUSH_VERTICES(ctx
, 0);
6959 CALL_Finish(ctx
->Exec
, ());
6962 static void GLAPIENTRY
6965 GET_CURRENT_CONTEXT(ctx
);
6966 FLUSH_VERTICES(ctx
, 0);
6967 CALL_Flush(ctx
->Exec
, ());
6970 static void GLAPIENTRY
6971 exec_GetBooleanv(GLenum pname
, GLboolean
*params
)
6973 GET_CURRENT_CONTEXT(ctx
);
6974 FLUSH_VERTICES(ctx
, 0);
6975 CALL_GetBooleanv(ctx
->Exec
, (pname
, params
));
6978 static void GLAPIENTRY
6979 exec_GetClipPlane(GLenum plane
, GLdouble
* equation
)
6981 GET_CURRENT_CONTEXT(ctx
);
6982 FLUSH_VERTICES(ctx
, 0);
6983 CALL_GetClipPlane(ctx
->Exec
, (plane
, equation
));
6986 static void GLAPIENTRY
6987 exec_GetDoublev(GLenum pname
, GLdouble
*params
)
6989 GET_CURRENT_CONTEXT(ctx
);
6990 FLUSH_VERTICES(ctx
, 0);
6991 CALL_GetDoublev(ctx
->Exec
, (pname
, params
));
6994 static GLenum GLAPIENTRY
6997 GET_CURRENT_CONTEXT(ctx
);
6998 FLUSH_VERTICES(ctx
, 0);
6999 return CALL_GetError(ctx
->Exec
, ());
7002 static void GLAPIENTRY
7003 exec_GetFloatv(GLenum pname
, GLfloat
*params
)
7005 GET_CURRENT_CONTEXT(ctx
);
7006 FLUSH_VERTICES(ctx
, 0);
7007 CALL_GetFloatv(ctx
->Exec
, (pname
, params
));
7010 static void GLAPIENTRY
7011 exec_GetIntegerv(GLenum pname
, GLint
*params
)
7013 GET_CURRENT_CONTEXT(ctx
);
7014 FLUSH_VERTICES(ctx
, 0);
7015 CALL_GetIntegerv(ctx
->Exec
, (pname
, params
));
7018 static void GLAPIENTRY
7019 exec_GetLightfv(GLenum light
, GLenum pname
, GLfloat
*params
)
7021 GET_CURRENT_CONTEXT(ctx
);
7022 FLUSH_VERTICES(ctx
, 0);
7023 CALL_GetLightfv(ctx
->Exec
, (light
, pname
, params
));
7026 static void GLAPIENTRY
7027 exec_GetLightiv(GLenum light
, GLenum pname
, GLint
*params
)
7029 GET_CURRENT_CONTEXT(ctx
);
7030 FLUSH_VERTICES(ctx
, 0);
7031 CALL_GetLightiv(ctx
->Exec
, (light
, pname
, params
));
7034 static void GLAPIENTRY
7035 exec_GetMapdv(GLenum target
, GLenum query
, GLdouble
* v
)
7037 GET_CURRENT_CONTEXT(ctx
);
7038 FLUSH_VERTICES(ctx
, 0);
7039 CALL_GetMapdv(ctx
->Exec
, (target
, query
, v
));
7042 static void GLAPIENTRY
7043 exec_GetMapfv(GLenum target
, GLenum query
, GLfloat
* v
)
7045 GET_CURRENT_CONTEXT(ctx
);
7046 FLUSH_VERTICES(ctx
, 0);
7047 CALL_GetMapfv(ctx
->Exec
, (target
, query
, v
));
7050 static void GLAPIENTRY
7051 exec_GetMapiv(GLenum target
, GLenum query
, GLint
* v
)
7053 GET_CURRENT_CONTEXT(ctx
);
7054 FLUSH_VERTICES(ctx
, 0);
7055 CALL_GetMapiv(ctx
->Exec
, (target
, query
, v
));
7058 static void GLAPIENTRY
7059 exec_GetMaterialfv(GLenum face
, GLenum pname
, GLfloat
*params
)
7061 GET_CURRENT_CONTEXT(ctx
);
7062 FLUSH_VERTICES(ctx
, 0);
7063 CALL_GetMaterialfv(ctx
->Exec
, (face
, pname
, params
));
7066 static void GLAPIENTRY
7067 exec_GetMaterialiv(GLenum face
, GLenum pname
, GLint
*params
)
7069 GET_CURRENT_CONTEXT(ctx
);
7070 FLUSH_VERTICES(ctx
, 0);
7071 CALL_GetMaterialiv(ctx
->Exec
, (face
, pname
, params
));
7074 static void GLAPIENTRY
7075 exec_GetPixelMapfv(GLenum map
, GLfloat
*values
)
7077 GET_CURRENT_CONTEXT(ctx
);
7078 FLUSH_VERTICES(ctx
, 0);
7079 CALL_GetPixelMapfv(ctx
->Exec
, (map
, values
));
7082 static void GLAPIENTRY
7083 exec_GetPixelMapuiv(GLenum map
, GLuint
*values
)
7085 GET_CURRENT_CONTEXT(ctx
);
7086 FLUSH_VERTICES(ctx
, 0);
7087 CALL_GetPixelMapuiv(ctx
->Exec
, (map
, values
));
7090 static void GLAPIENTRY
7091 exec_GetPixelMapusv(GLenum map
, GLushort
*values
)
7093 GET_CURRENT_CONTEXT(ctx
);
7094 FLUSH_VERTICES(ctx
, 0);
7095 CALL_GetPixelMapusv(ctx
->Exec
, (map
, values
));
7098 static void GLAPIENTRY
7099 exec_GetPolygonStipple(GLubyte
* dest
)
7101 GET_CURRENT_CONTEXT(ctx
);
7102 FLUSH_VERTICES(ctx
, 0);
7103 CALL_GetPolygonStipple(ctx
->Exec
, (dest
));
7106 static const GLubyte
*GLAPIENTRY
7107 exec_GetString(GLenum name
)
7109 GET_CURRENT_CONTEXT(ctx
);
7110 FLUSH_VERTICES(ctx
, 0);
7111 return CALL_GetString(ctx
->Exec
, (name
));
7114 static void GLAPIENTRY
7115 exec_GetTexEnvfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7117 GET_CURRENT_CONTEXT(ctx
);
7118 FLUSH_VERTICES(ctx
, 0);
7119 CALL_GetTexEnvfv(ctx
->Exec
, (target
, pname
, params
));
7122 static void GLAPIENTRY
7123 exec_GetTexEnviv(GLenum target
, GLenum pname
, GLint
*params
)
7125 GET_CURRENT_CONTEXT(ctx
);
7126 FLUSH_VERTICES(ctx
, 0);
7127 CALL_GetTexEnviv(ctx
->Exec
, (target
, pname
, params
));
7130 static void GLAPIENTRY
7131 exec_GetTexGendv(GLenum coord
, GLenum pname
, GLdouble
*params
)
7133 GET_CURRENT_CONTEXT(ctx
);
7134 FLUSH_VERTICES(ctx
, 0);
7135 CALL_GetTexGendv(ctx
->Exec
, (coord
, pname
, params
));
7138 static void GLAPIENTRY
7139 exec_GetTexGenfv(GLenum coord
, GLenum pname
, GLfloat
*params
)
7141 GET_CURRENT_CONTEXT(ctx
);
7142 FLUSH_VERTICES(ctx
, 0);
7143 CALL_GetTexGenfv(ctx
->Exec
, (coord
, pname
, params
));
7146 static void GLAPIENTRY
7147 exec_GetTexGeniv(GLenum coord
, GLenum pname
, GLint
*params
)
7149 GET_CURRENT_CONTEXT(ctx
);
7150 FLUSH_VERTICES(ctx
, 0);
7151 CALL_GetTexGeniv(ctx
->Exec
, (coord
, pname
, params
));
7154 static void GLAPIENTRY
7155 exec_GetTexImage(GLenum target
, GLint level
, GLenum format
,
7156 GLenum type
, GLvoid
* pixels
)
7158 GET_CURRENT_CONTEXT(ctx
);
7159 FLUSH_VERTICES(ctx
, 0);
7160 CALL_GetTexImage(ctx
->Exec
, (target
, level
, format
, type
, pixels
));
7163 static void GLAPIENTRY
7164 exec_GetTexLevelParameterfv(GLenum target
, GLint level
,
7165 GLenum pname
, GLfloat
*params
)
7167 GET_CURRENT_CONTEXT(ctx
);
7168 FLUSH_VERTICES(ctx
, 0);
7169 CALL_GetTexLevelParameterfv(ctx
->Exec
, (target
, level
, pname
, params
));
7172 static void GLAPIENTRY
7173 exec_GetTexLevelParameteriv(GLenum target
, GLint level
,
7174 GLenum pname
, GLint
*params
)
7176 GET_CURRENT_CONTEXT(ctx
);
7177 FLUSH_VERTICES(ctx
, 0);
7178 CALL_GetTexLevelParameteriv(ctx
->Exec
, (target
, level
, pname
, params
));
7181 static void GLAPIENTRY
7182 exec_GetTexParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7184 GET_CURRENT_CONTEXT(ctx
);
7185 FLUSH_VERTICES(ctx
, 0);
7186 CALL_GetTexParameterfv(ctx
->Exec
, (target
, pname
, params
));
7189 static void GLAPIENTRY
7190 exec_GetTexParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7192 GET_CURRENT_CONTEXT(ctx
);
7193 FLUSH_VERTICES(ctx
, 0);
7194 CALL_GetTexParameteriv(ctx
->Exec
, (target
, pname
, params
));
7197 static GLboolean GLAPIENTRY
7198 exec_IsEnabled(GLenum cap
)
7200 GET_CURRENT_CONTEXT(ctx
);
7201 FLUSH_VERTICES(ctx
, 0);
7202 return CALL_IsEnabled(ctx
->Exec
, (cap
));
7205 static void GLAPIENTRY
7206 exec_PixelStoref(GLenum pname
, GLfloat param
)
7208 GET_CURRENT_CONTEXT(ctx
);
7209 FLUSH_VERTICES(ctx
, 0);
7210 CALL_PixelStoref(ctx
->Exec
, (pname
, param
));
7213 static void GLAPIENTRY
7214 exec_PixelStorei(GLenum pname
, GLint param
)
7216 GET_CURRENT_CONTEXT(ctx
);
7217 FLUSH_VERTICES(ctx
, 0);
7218 CALL_PixelStorei(ctx
->Exec
, (pname
, param
));
7221 static void GLAPIENTRY
7222 exec_ReadPixels(GLint x
, GLint y
, GLsizei width
, GLsizei height
,
7223 GLenum format
, GLenum type
, GLvoid
* pixels
)
7225 GET_CURRENT_CONTEXT(ctx
);
7226 FLUSH_VERTICES(ctx
, 0);
7227 CALL_ReadPixels(ctx
->Exec
, (x
, y
, width
, height
, format
, type
, pixels
));
7230 static GLint GLAPIENTRY
7231 exec_RenderMode(GLenum mode
)
7233 GET_CURRENT_CONTEXT(ctx
);
7234 FLUSH_VERTICES(ctx
, 0);
7235 return CALL_RenderMode(ctx
->Exec
, (mode
));
7238 static void GLAPIENTRY
7239 exec_FeedbackBuffer(GLsizei size
, GLenum type
, GLfloat
* buffer
)
7241 GET_CURRENT_CONTEXT(ctx
);
7242 FLUSH_VERTICES(ctx
, 0);
7243 CALL_FeedbackBuffer(ctx
->Exec
, (size
, type
, buffer
));
7246 static void GLAPIENTRY
7247 exec_SelectBuffer(GLsizei size
, GLuint
* buffer
)
7249 GET_CURRENT_CONTEXT(ctx
);
7250 FLUSH_VERTICES(ctx
, 0);
7251 CALL_SelectBuffer(ctx
->Exec
, (size
, buffer
));
7254 static GLboolean GLAPIENTRY
7255 exec_AreTexturesResident(GLsizei n
, const GLuint
* texName
,
7256 GLboolean
* residences
)
7258 GET_CURRENT_CONTEXT(ctx
);
7259 FLUSH_VERTICES(ctx
, 0);
7260 return CALL_AreTexturesResident(ctx
->Exec
, (n
, texName
, residences
));
7263 static void GLAPIENTRY
7264 exec_ColorPointer(GLint size
, GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
7266 GET_CURRENT_CONTEXT(ctx
);
7267 FLUSH_VERTICES(ctx
, 0);
7268 CALL_ColorPointer(ctx
->Exec
, (size
, type
, stride
, ptr
));
7271 static void GLAPIENTRY
7272 exec_DeleteTextures(GLsizei n
, const GLuint
* texName
)
7274 GET_CURRENT_CONTEXT(ctx
);
7275 FLUSH_VERTICES(ctx
, 0);
7276 CALL_DeleteTextures(ctx
->Exec
, (n
, texName
));
7279 static void GLAPIENTRY
7280 exec_DisableClientState(GLenum cap
)
7282 GET_CURRENT_CONTEXT(ctx
);
7283 FLUSH_VERTICES(ctx
, 0);
7284 CALL_DisableClientState(ctx
->Exec
, (cap
));
7287 static void GLAPIENTRY
7288 exec_EdgeFlagPointer(GLsizei stride
, const GLvoid
* vptr
)
7290 GET_CURRENT_CONTEXT(ctx
);
7291 FLUSH_VERTICES(ctx
, 0);
7292 CALL_EdgeFlagPointer(ctx
->Exec
, (stride
, vptr
));
7295 static void GLAPIENTRY
7296 exec_EnableClientState(GLenum cap
)
7298 GET_CURRENT_CONTEXT(ctx
);
7299 FLUSH_VERTICES(ctx
, 0);
7300 CALL_EnableClientState(ctx
->Exec
, (cap
));
7303 static void GLAPIENTRY
7304 exec_GenTextures(GLsizei n
, GLuint
* texName
)
7306 GET_CURRENT_CONTEXT(ctx
);
7307 FLUSH_VERTICES(ctx
, 0);
7308 CALL_GenTextures(ctx
->Exec
, (n
, texName
));
7311 static void GLAPIENTRY
7312 exec_GetPointerv(GLenum pname
, GLvoid
**params
)
7314 GET_CURRENT_CONTEXT(ctx
);
7315 FLUSH_VERTICES(ctx
, 0);
7316 CALL_GetPointerv(ctx
->Exec
, (pname
, params
));
7319 static void GLAPIENTRY
7320 exec_IndexPointer(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
7322 GET_CURRENT_CONTEXT(ctx
);
7323 FLUSH_VERTICES(ctx
, 0);
7324 CALL_IndexPointer(ctx
->Exec
, (type
, stride
, ptr
));
7327 static void GLAPIENTRY
7328 exec_InterleavedArrays(GLenum format
, GLsizei stride
, const GLvoid
* pointer
)
7330 GET_CURRENT_CONTEXT(ctx
);
7331 FLUSH_VERTICES(ctx
, 0);
7332 CALL_InterleavedArrays(ctx
->Exec
, (format
, stride
, pointer
));
7335 static GLboolean GLAPIENTRY
7336 exec_IsTexture(GLuint texture
)
7338 GET_CURRENT_CONTEXT(ctx
);
7339 FLUSH_VERTICES(ctx
, 0);
7340 return CALL_IsTexture(ctx
->Exec
, (texture
));
7343 static void GLAPIENTRY
7344 exec_NormalPointer(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
7346 GET_CURRENT_CONTEXT(ctx
);
7347 FLUSH_VERTICES(ctx
, 0);
7348 CALL_NormalPointer(ctx
->Exec
, (type
, stride
, ptr
));
7351 static void GLAPIENTRY
7352 exec_PopClientAttrib(void)
7354 GET_CURRENT_CONTEXT(ctx
);
7355 FLUSH_VERTICES(ctx
, 0);
7356 CALL_PopClientAttrib(ctx
->Exec
, ());
7359 static void GLAPIENTRY
7360 exec_PushClientAttrib(GLbitfield mask
)
7362 GET_CURRENT_CONTEXT(ctx
);
7363 FLUSH_VERTICES(ctx
, 0);
7364 CALL_PushClientAttrib(ctx
->Exec
, (mask
));
7367 static void GLAPIENTRY
7368 exec_TexCoordPointer(GLint size
, GLenum type
, GLsizei stride
,
7371 GET_CURRENT_CONTEXT(ctx
);
7372 FLUSH_VERTICES(ctx
, 0);
7373 CALL_TexCoordPointer(ctx
->Exec
, (size
, type
, stride
, ptr
));
7376 static void GLAPIENTRY
7377 exec_GetCompressedTexImageARB(GLenum target
, GLint level
, GLvoid
* img
)
7379 GET_CURRENT_CONTEXT(ctx
);
7380 FLUSH_VERTICES(ctx
, 0);
7381 CALL_GetCompressedTexImageARB(ctx
->Exec
, (target
, level
, img
));
7384 static void GLAPIENTRY
7385 exec_VertexPointer(GLint size
, GLenum type
, GLsizei stride
,
7388 GET_CURRENT_CONTEXT(ctx
);
7389 FLUSH_VERTICES(ctx
, 0);
7390 CALL_VertexPointer(ctx
->Exec
, (size
, type
, stride
, ptr
));
7393 static void GLAPIENTRY
7394 exec_CopyConvolutionFilter1D(GLenum target
, GLenum internalFormat
,
7395 GLint x
, GLint y
, GLsizei width
)
7397 GET_CURRENT_CONTEXT(ctx
);
7398 FLUSH_VERTICES(ctx
, 0);
7399 CALL_CopyConvolutionFilter1D(ctx
->Exec
,
7400 (target
, internalFormat
, x
, y
, width
));
7403 static void GLAPIENTRY
7404 exec_CopyConvolutionFilter2D(GLenum target
, GLenum internalFormat
,
7405 GLint x
, GLint y
, GLsizei width
, GLsizei height
)
7407 GET_CURRENT_CONTEXT(ctx
);
7408 FLUSH_VERTICES(ctx
, 0);
7409 CALL_CopyConvolutionFilter2D(ctx
->Exec
,
7410 (target
, internalFormat
, x
, y
, width
,
7414 static void GLAPIENTRY
7415 exec_GetColorTable(GLenum target
, GLenum format
, GLenum type
, GLvoid
* data
)
7417 GET_CURRENT_CONTEXT(ctx
);
7418 FLUSH_VERTICES(ctx
, 0);
7419 CALL_GetColorTable(ctx
->Exec
, (target
, format
, type
, data
));
7422 static void GLAPIENTRY
7423 exec_GetColorTableParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7425 GET_CURRENT_CONTEXT(ctx
);
7426 FLUSH_VERTICES(ctx
, 0);
7427 CALL_GetColorTableParameterfv(ctx
->Exec
, (target
, pname
, params
));
7430 static void GLAPIENTRY
7431 exec_GetColorTableParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7433 GET_CURRENT_CONTEXT(ctx
);
7434 FLUSH_VERTICES(ctx
, 0);
7435 CALL_GetColorTableParameteriv(ctx
->Exec
, (target
, pname
, params
));
7438 static void GLAPIENTRY
7439 exec_GetConvolutionFilter(GLenum target
, GLenum format
, GLenum type
,
7442 GET_CURRENT_CONTEXT(ctx
);
7443 FLUSH_VERTICES(ctx
, 0);
7444 CALL_GetConvolutionFilter(ctx
->Exec
, (target
, format
, type
, image
));
7447 static void GLAPIENTRY
7448 exec_GetConvolutionParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7450 GET_CURRENT_CONTEXT(ctx
);
7451 FLUSH_VERTICES(ctx
, 0);
7452 CALL_GetConvolutionParameterfv(ctx
->Exec
, (target
, pname
, params
));
7455 static void GLAPIENTRY
7456 exec_GetConvolutionParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7458 GET_CURRENT_CONTEXT(ctx
);
7459 FLUSH_VERTICES(ctx
, 0);
7460 CALL_GetConvolutionParameteriv(ctx
->Exec
, (target
, pname
, params
));
7463 static void GLAPIENTRY
7464 exec_GetHistogram(GLenum target
, GLboolean reset
, GLenum format
,
7465 GLenum type
, GLvoid
*values
)
7467 GET_CURRENT_CONTEXT(ctx
);
7468 FLUSH_VERTICES(ctx
, 0);
7469 CALL_GetHistogram(ctx
->Exec
, (target
, reset
, format
, type
, values
));
7472 static void GLAPIENTRY
7473 exec_GetHistogramParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7475 GET_CURRENT_CONTEXT(ctx
);
7476 FLUSH_VERTICES(ctx
, 0);
7477 CALL_GetHistogramParameterfv(ctx
->Exec
, (target
, pname
, params
));
7480 static void GLAPIENTRY
7481 exec_GetHistogramParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7483 GET_CURRENT_CONTEXT(ctx
);
7484 FLUSH_VERTICES(ctx
, 0);
7485 CALL_GetHistogramParameteriv(ctx
->Exec
, (target
, pname
, params
));
7488 static void GLAPIENTRY
7489 exec_GetMinmax(GLenum target
, GLboolean reset
, GLenum format
,
7490 GLenum type
, GLvoid
*values
)
7492 GET_CURRENT_CONTEXT(ctx
);
7493 FLUSH_VERTICES(ctx
, 0);
7494 CALL_GetMinmax(ctx
->Exec
, (target
, reset
, format
, type
, values
));
7497 static void GLAPIENTRY
7498 exec_GetMinmaxParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7500 GET_CURRENT_CONTEXT(ctx
);
7501 FLUSH_VERTICES(ctx
, 0);
7502 CALL_GetMinmaxParameterfv(ctx
->Exec
, (target
, pname
, params
));
7505 static void GLAPIENTRY
7506 exec_GetMinmaxParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7508 GET_CURRENT_CONTEXT(ctx
);
7509 FLUSH_VERTICES(ctx
, 0);
7510 CALL_GetMinmaxParameteriv(ctx
->Exec
, (target
, pname
, params
));
7513 static void GLAPIENTRY
7514 exec_GetSeparableFilter(GLenum target
, GLenum format
, GLenum type
,
7515 GLvoid
*row
, GLvoid
*column
, GLvoid
*span
)
7517 GET_CURRENT_CONTEXT(ctx
);
7518 FLUSH_VERTICES(ctx
, 0);
7519 CALL_GetSeparableFilter(ctx
->Exec
,
7520 (target
, format
, type
, row
, column
, span
));
7523 static void GLAPIENTRY
7524 exec_SeparableFilter2D(GLenum target
, GLenum internalFormat
,
7525 GLsizei width
, GLsizei height
, GLenum format
,
7526 GLenum type
, const GLvoid
*row
, const GLvoid
*column
)
7528 GET_CURRENT_CONTEXT(ctx
);
7529 FLUSH_VERTICES(ctx
, 0);
7530 CALL_SeparableFilter2D(ctx
->Exec
,
7531 (target
, internalFormat
, width
, height
, format
,
7532 type
, row
, column
));
7535 static void GLAPIENTRY
7536 exec_ColorPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
7537 GLsizei count
, const GLvoid
*ptr
)
7539 GET_CURRENT_CONTEXT(ctx
);
7540 FLUSH_VERTICES(ctx
, 0);
7541 CALL_ColorPointerEXT(ctx
->Exec
, (size
, type
, stride
, count
, ptr
));
7544 static void GLAPIENTRY
7545 exec_EdgeFlagPointerEXT(GLsizei stride
, GLsizei count
, const GLboolean
*ptr
)
7547 GET_CURRENT_CONTEXT(ctx
);
7548 FLUSH_VERTICES(ctx
, 0);
7549 CALL_EdgeFlagPointerEXT(ctx
->Exec
, (stride
, count
, ptr
));
7552 static void GLAPIENTRY
7553 exec_IndexPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
,
7556 GET_CURRENT_CONTEXT(ctx
);
7557 FLUSH_VERTICES(ctx
, 0);
7558 CALL_IndexPointerEXT(ctx
->Exec
, (type
, stride
, count
, ptr
));
7561 static void GLAPIENTRY
7562 exec_NormalPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
,
7565 GET_CURRENT_CONTEXT(ctx
);
7566 FLUSH_VERTICES(ctx
, 0);
7567 CALL_NormalPointerEXT(ctx
->Exec
, (type
, stride
, count
, ptr
));
7570 static void GLAPIENTRY
7571 exec_TexCoordPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
7572 GLsizei count
, const GLvoid
*ptr
)
7574 GET_CURRENT_CONTEXT(ctx
);
7575 FLUSH_VERTICES(ctx
, 0);
7576 CALL_TexCoordPointerEXT(ctx
->Exec
, (size
, type
, stride
, count
, ptr
));
7579 static void GLAPIENTRY
7580 exec_VertexPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
7581 GLsizei count
, const GLvoid
*ptr
)
7583 GET_CURRENT_CONTEXT(ctx
);
7584 FLUSH_VERTICES(ctx
, 0);
7585 CALL_VertexPointerEXT(ctx
->Exec
, (size
, type
, stride
, count
, ptr
));
7588 static void GLAPIENTRY
7589 exec_LockArraysEXT(GLint first
, GLsizei count
)
7591 GET_CURRENT_CONTEXT(ctx
);
7592 FLUSH_VERTICES(ctx
, 0);
7593 CALL_LockArraysEXT(ctx
->Exec
, (first
, count
));
7596 static void GLAPIENTRY
7597 exec_UnlockArraysEXT(void)
7599 GET_CURRENT_CONTEXT(ctx
);
7600 FLUSH_VERTICES(ctx
, 0);
7601 CALL_UnlockArraysEXT(ctx
->Exec
, ());
7604 static void GLAPIENTRY
7605 exec_ClientActiveTextureARB(GLenum target
)
7607 GET_CURRENT_CONTEXT(ctx
);
7608 FLUSH_VERTICES(ctx
, 0);
7609 CALL_ClientActiveTextureARB(ctx
->Exec
, (target
));
7612 static void GLAPIENTRY
7613 exec_SecondaryColorPointerEXT(GLint size
, GLenum type
,
7614 GLsizei stride
, const GLvoid
*ptr
)
7616 GET_CURRENT_CONTEXT(ctx
);
7617 FLUSH_VERTICES(ctx
, 0);
7618 CALL_SecondaryColorPointerEXT(ctx
->Exec
, (size
, type
, stride
, ptr
));
7621 static void GLAPIENTRY
7622 exec_FogCoordPointerEXT(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
7624 GET_CURRENT_CONTEXT(ctx
);
7625 FLUSH_VERTICES(ctx
, 0);
7626 CALL_FogCoordPointerEXT(ctx
->Exec
, (type
, stride
, ptr
));
7629 /* GL_EXT_multi_draw_arrays */
7630 static void GLAPIENTRY
7631 exec_MultiDrawArraysEXT(GLenum mode
, GLint
* first
,
7632 GLsizei
* count
, GLsizei primcount
)
7634 GET_CURRENT_CONTEXT(ctx
);
7635 FLUSH_VERTICES(ctx
, 0);
7636 CALL_MultiDrawArraysEXT(ctx
->Exec
, (mode
, first
, count
, primcount
));
7639 /* GL_EXT_multi_draw_arrays */
7640 static void GLAPIENTRY
7641 exec_MultiDrawElementsEXT(GLenum mode
, const GLsizei
* count
,
7642 GLenum type
, const GLvoid
** indices
,
7645 GET_CURRENT_CONTEXT(ctx
);
7646 FLUSH_VERTICES(ctx
, 0);
7647 CALL_MultiDrawElementsEXT(ctx
->Exec
,
7648 (mode
, count
, type
, indices
, primcount
));
7651 /* GL_IBM_multimode_draw_arrays */
7652 static void GLAPIENTRY
7653 exec_MultiModeDrawArraysIBM(const GLenum
* mode
, const GLint
* first
,
7654 const GLsizei
* count
, GLsizei primcount
,
7657 GET_CURRENT_CONTEXT(ctx
);
7658 FLUSH_VERTICES(ctx
, 0);
7659 CALL_MultiModeDrawArraysIBM(ctx
->Exec
,
7660 (mode
, first
, count
, primcount
, modestride
));
7663 /* GL_IBM_multimode_draw_arrays */
7664 static void GLAPIENTRY
7665 exec_MultiModeDrawElementsIBM(const GLenum
* mode
,
7666 const GLsizei
* count
,
7668 const GLvoid
* const *indices
,
7669 GLsizei primcount
, GLint modestride
)
7671 GET_CURRENT_CONTEXT(ctx
);
7672 FLUSH_VERTICES(ctx
, 0);
7673 CALL_MultiModeDrawElementsIBM(ctx
->Exec
,
7674 (mode
, count
, type
, indices
, primcount
,
7681 * Setup the given dispatch table to point to Mesa's display list
7682 * building functions.
7684 * This does not include any of the tnl functions - they are
7685 * initialized from _mesa_init_api_defaults and from the active vtxfmt
7689 _mesa_init_dlist_table(struct _glapi_table
*table
)
7691 _mesa_loopback_init_api_table(table
);
7694 SET_Accum(table
, save_Accum
);
7695 SET_AlphaFunc(table
, save_AlphaFunc
);
7696 SET_Bitmap(table
, save_Bitmap
);
7697 SET_BlendFunc(table
, _mesa_BlendFunc
); /* loops-back to BlendFuncSeparate */
7698 SET_CallList(table
, _mesa_save_CallList
);
7699 SET_CallLists(table
, _mesa_save_CallLists
);
7700 SET_Clear(table
, save_Clear
);
7701 SET_ClearAccum(table
, save_ClearAccum
);
7702 SET_ClearColor(table
, save_ClearColor
);
7703 SET_ClearDepth(table
, save_ClearDepth
);
7704 SET_ClearIndex(table
, save_ClearIndex
);
7705 SET_ClearStencil(table
, save_ClearStencil
);
7706 SET_ClipPlane(table
, save_ClipPlane
);
7707 SET_ColorMask(table
, save_ColorMask
);
7708 SET_ColorMaterial(table
, save_ColorMaterial
);
7709 SET_CopyPixels(table
, save_CopyPixels
);
7710 SET_CullFace(table
, save_CullFace
);
7711 SET_DeleteLists(table
, _mesa_DeleteLists
);
7712 SET_DepthFunc(table
, save_DepthFunc
);
7713 SET_DepthMask(table
, save_DepthMask
);
7714 SET_DepthRange(table
, save_DepthRange
);
7715 SET_Disable(table
, save_Disable
);
7716 SET_DrawBuffer(table
, save_DrawBuffer
);
7717 SET_DrawPixels(table
, save_DrawPixels
);
7718 SET_Enable(table
, save_Enable
);
7719 SET_EndList(table
, _mesa_EndList
);
7720 SET_EvalMesh1(table
, _mesa_save_EvalMesh1
);
7721 SET_EvalMesh2(table
, _mesa_save_EvalMesh2
);
7722 SET_Finish(table
, exec_Finish
);
7723 SET_Flush(table
, exec_Flush
);
7724 SET_Fogf(table
, save_Fogf
);
7725 SET_Fogfv(table
, save_Fogfv
);
7726 SET_Fogi(table
, save_Fogi
);
7727 SET_Fogiv(table
, save_Fogiv
);
7728 SET_FrontFace(table
, save_FrontFace
);
7729 SET_Frustum(table
, save_Frustum
);
7730 SET_GenLists(table
, _mesa_GenLists
);
7731 SET_GetBooleanv(table
, exec_GetBooleanv
);
7732 SET_GetClipPlane(table
, exec_GetClipPlane
);
7733 SET_GetDoublev(table
, exec_GetDoublev
);
7734 SET_GetError(table
, exec_GetError
);
7735 SET_GetFloatv(table
, exec_GetFloatv
);
7736 SET_GetIntegerv(table
, exec_GetIntegerv
);
7737 SET_GetLightfv(table
, exec_GetLightfv
);
7738 SET_GetLightiv(table
, exec_GetLightiv
);
7739 SET_GetMapdv(table
, exec_GetMapdv
);
7740 SET_GetMapfv(table
, exec_GetMapfv
);
7741 SET_GetMapiv(table
, exec_GetMapiv
);
7742 SET_GetMaterialfv(table
, exec_GetMaterialfv
);
7743 SET_GetMaterialiv(table
, exec_GetMaterialiv
);
7744 SET_GetPixelMapfv(table
, exec_GetPixelMapfv
);
7745 SET_GetPixelMapuiv(table
, exec_GetPixelMapuiv
);
7746 SET_GetPixelMapusv(table
, exec_GetPixelMapusv
);
7747 SET_GetPolygonStipple(table
, exec_GetPolygonStipple
);
7748 SET_GetString(table
, exec_GetString
);
7749 SET_GetTexEnvfv(table
, exec_GetTexEnvfv
);
7750 SET_GetTexEnviv(table
, exec_GetTexEnviv
);
7751 SET_GetTexGendv(table
, exec_GetTexGendv
);
7752 SET_GetTexGenfv(table
, exec_GetTexGenfv
);
7753 SET_GetTexGeniv(table
, exec_GetTexGeniv
);
7754 SET_GetTexImage(table
, exec_GetTexImage
);
7755 SET_GetTexLevelParameterfv(table
, exec_GetTexLevelParameterfv
);
7756 SET_GetTexLevelParameteriv(table
, exec_GetTexLevelParameteriv
);
7757 SET_GetTexParameterfv(table
, exec_GetTexParameterfv
);
7758 SET_GetTexParameteriv(table
, exec_GetTexParameteriv
);
7759 SET_Hint(table
, save_Hint
);
7760 SET_IndexMask(table
, save_IndexMask
);
7761 SET_InitNames(table
, save_InitNames
);
7762 SET_IsEnabled(table
, exec_IsEnabled
);
7763 SET_IsList(table
, _mesa_IsList
);
7764 SET_LightModelf(table
, save_LightModelf
);
7765 SET_LightModelfv(table
, save_LightModelfv
);
7766 SET_LightModeli(table
, save_LightModeli
);
7767 SET_LightModeliv(table
, save_LightModeliv
);
7768 SET_Lightf(table
, save_Lightf
);
7769 SET_Lightfv(table
, save_Lightfv
);
7770 SET_Lighti(table
, save_Lighti
);
7771 SET_Lightiv(table
, save_Lightiv
);
7772 SET_LineStipple(table
, save_LineStipple
);
7773 SET_LineWidth(table
, save_LineWidth
);
7774 SET_ListBase(table
, save_ListBase
);
7775 SET_LoadIdentity(table
, save_LoadIdentity
);
7776 SET_LoadMatrixd(table
, save_LoadMatrixd
);
7777 SET_LoadMatrixf(table
, save_LoadMatrixf
);
7778 SET_LoadName(table
, save_LoadName
);
7779 SET_LogicOp(table
, save_LogicOp
);
7780 SET_Map1d(table
, save_Map1d
);
7781 SET_Map1f(table
, save_Map1f
);
7782 SET_Map2d(table
, save_Map2d
);
7783 SET_Map2f(table
, save_Map2f
);
7784 SET_MapGrid1d(table
, save_MapGrid1d
);
7785 SET_MapGrid1f(table
, save_MapGrid1f
);
7786 SET_MapGrid2d(table
, save_MapGrid2d
);
7787 SET_MapGrid2f(table
, save_MapGrid2f
);
7788 SET_MatrixMode(table
, save_MatrixMode
);
7789 SET_MultMatrixd(table
, save_MultMatrixd
);
7790 SET_MultMatrixf(table
, save_MultMatrixf
);
7791 SET_NewList(table
, save_NewList
);
7792 SET_Ortho(table
, save_Ortho
);
7793 SET_PassThrough(table
, save_PassThrough
);
7794 SET_PixelMapfv(table
, save_PixelMapfv
);
7795 SET_PixelMapuiv(table
, save_PixelMapuiv
);
7796 SET_PixelMapusv(table
, save_PixelMapusv
);
7797 SET_PixelStoref(table
, exec_PixelStoref
);
7798 SET_PixelStorei(table
, exec_PixelStorei
);
7799 SET_PixelTransferf(table
, save_PixelTransferf
);
7800 SET_PixelTransferi(table
, save_PixelTransferi
);
7801 SET_PixelZoom(table
, save_PixelZoom
);
7802 SET_PointSize(table
, save_PointSize
);
7803 SET_PolygonMode(table
, save_PolygonMode
);
7804 SET_PolygonOffset(table
, save_PolygonOffset
);
7805 SET_PolygonStipple(table
, save_PolygonStipple
);
7806 SET_PopAttrib(table
, save_PopAttrib
);
7807 SET_PopMatrix(table
, save_PopMatrix
);
7808 SET_PopName(table
, save_PopName
);
7809 SET_PushAttrib(table
, save_PushAttrib
);
7810 SET_PushMatrix(table
, save_PushMatrix
);
7811 SET_PushName(table
, save_PushName
);
7812 SET_RasterPos2d(table
, save_RasterPos2d
);
7813 SET_RasterPos2dv(table
, save_RasterPos2dv
);
7814 SET_RasterPos2f(table
, save_RasterPos2f
);
7815 SET_RasterPos2fv(table
, save_RasterPos2fv
);
7816 SET_RasterPos2i(table
, save_RasterPos2i
);
7817 SET_RasterPos2iv(table
, save_RasterPos2iv
);
7818 SET_RasterPos2s(table
, save_RasterPos2s
);
7819 SET_RasterPos2sv(table
, save_RasterPos2sv
);
7820 SET_RasterPos3d(table
, save_RasterPos3d
);
7821 SET_RasterPos3dv(table
, save_RasterPos3dv
);
7822 SET_RasterPos3f(table
, save_RasterPos3f
);
7823 SET_RasterPos3fv(table
, save_RasterPos3fv
);
7824 SET_RasterPos3i(table
, save_RasterPos3i
);
7825 SET_RasterPos3iv(table
, save_RasterPos3iv
);
7826 SET_RasterPos3s(table
, save_RasterPos3s
);
7827 SET_RasterPos3sv(table
, save_RasterPos3sv
);
7828 SET_RasterPos4d(table
, save_RasterPos4d
);
7829 SET_RasterPos4dv(table
, save_RasterPos4dv
);
7830 SET_RasterPos4f(table
, save_RasterPos4f
);
7831 SET_RasterPos4fv(table
, save_RasterPos4fv
);
7832 SET_RasterPos4i(table
, save_RasterPos4i
);
7833 SET_RasterPos4iv(table
, save_RasterPos4iv
);
7834 SET_RasterPos4s(table
, save_RasterPos4s
);
7835 SET_RasterPos4sv(table
, save_RasterPos4sv
);
7836 SET_ReadBuffer(table
, save_ReadBuffer
);
7837 SET_ReadPixels(table
, exec_ReadPixels
);
7838 SET_RenderMode(table
, exec_RenderMode
);
7839 SET_Rotated(table
, save_Rotated
);
7840 SET_Rotatef(table
, save_Rotatef
);
7841 SET_Scaled(table
, save_Scaled
);
7842 SET_Scalef(table
, save_Scalef
);
7843 SET_Scissor(table
, save_Scissor
);
7844 SET_FeedbackBuffer(table
, exec_FeedbackBuffer
);
7845 SET_SelectBuffer(table
, exec_SelectBuffer
);
7846 SET_ShadeModel(table
, save_ShadeModel
);
7847 SET_StencilFunc(table
, save_StencilFunc
);
7848 SET_StencilMask(table
, save_StencilMask
);
7849 SET_StencilOp(table
, save_StencilOp
);
7850 SET_TexEnvf(table
, save_TexEnvf
);
7851 SET_TexEnvfv(table
, save_TexEnvfv
);
7852 SET_TexEnvi(table
, save_TexEnvi
);
7853 SET_TexEnviv(table
, save_TexEnviv
);
7854 SET_TexGend(table
, save_TexGend
);
7855 SET_TexGendv(table
, save_TexGendv
);
7856 SET_TexGenf(table
, save_TexGenf
);
7857 SET_TexGenfv(table
, save_TexGenfv
);
7858 SET_TexGeni(table
, save_TexGeni
);
7859 SET_TexGeniv(table
, save_TexGeniv
);
7860 SET_TexImage1D(table
, save_TexImage1D
);
7861 SET_TexImage2D(table
, save_TexImage2D
);
7862 SET_TexParameterf(table
, save_TexParameterf
);
7863 SET_TexParameterfv(table
, save_TexParameterfv
);
7864 SET_TexParameteri(table
, save_TexParameteri
);
7865 SET_TexParameteriv(table
, save_TexParameteriv
);
7866 SET_Translated(table
, save_Translated
);
7867 SET_Translatef(table
, save_Translatef
);
7868 SET_Viewport(table
, save_Viewport
);
7871 SET_AreTexturesResident(table
, exec_AreTexturesResident
);
7872 SET_BindTexture(table
, save_BindTexture
);
7873 SET_ColorPointer(table
, exec_ColorPointer
);
7874 SET_CopyTexImage1D(table
, save_CopyTexImage1D
);
7875 SET_CopyTexImage2D(table
, save_CopyTexImage2D
);
7876 SET_CopyTexSubImage1D(table
, save_CopyTexSubImage1D
);
7877 SET_CopyTexSubImage2D(table
, save_CopyTexSubImage2D
);
7878 SET_DeleteTextures(table
, exec_DeleteTextures
);
7879 SET_DisableClientState(table
, exec_DisableClientState
);
7880 SET_EdgeFlagPointer(table
, exec_EdgeFlagPointer
);
7881 SET_EnableClientState(table
, exec_EnableClientState
);
7882 SET_GenTextures(table
, exec_GenTextures
);
7883 SET_GetPointerv(table
, exec_GetPointerv
);
7884 SET_IndexPointer(table
, exec_IndexPointer
);
7885 SET_InterleavedArrays(table
, exec_InterleavedArrays
);
7886 SET_IsTexture(table
, exec_IsTexture
);
7887 SET_NormalPointer(table
, exec_NormalPointer
);
7888 SET_PopClientAttrib(table
, exec_PopClientAttrib
);
7889 SET_PrioritizeTextures(table
, save_PrioritizeTextures
);
7890 SET_PushClientAttrib(table
, exec_PushClientAttrib
);
7891 SET_TexCoordPointer(table
, exec_TexCoordPointer
);
7892 SET_TexSubImage1D(table
, save_TexSubImage1D
);
7893 SET_TexSubImage2D(table
, save_TexSubImage2D
);
7894 SET_VertexPointer(table
, exec_VertexPointer
);
7897 SET_CopyTexSubImage3D(table
, save_CopyTexSubImage3D
);
7898 SET_TexImage3D(table
, save_TexImage3D
);
7899 SET_TexSubImage3D(table
, save_TexSubImage3D
);
7902 SET_StencilFuncSeparate(table
, save_StencilFuncSeparate
);
7903 SET_StencilMaskSeparate(table
, save_StencilMaskSeparate
);
7904 SET_StencilOpSeparate(table
, save_StencilOpSeparate
);
7906 /* GL_ARB_imaging */
7907 /* Not all are supported */
7908 SET_BlendColor(table
, save_BlendColor
);
7909 SET_BlendEquation(table
, save_BlendEquation
);
7910 SET_ColorSubTable(table
, save_ColorSubTable
);
7911 SET_ColorTable(table
, save_ColorTable
);
7912 SET_ColorTableParameterfv(table
, save_ColorTableParameterfv
);
7913 SET_ColorTableParameteriv(table
, save_ColorTableParameteriv
);
7914 SET_ConvolutionFilter1D(table
, save_ConvolutionFilter1D
);
7915 SET_ConvolutionFilter2D(table
, save_ConvolutionFilter2D
);
7916 SET_ConvolutionParameterf(table
, save_ConvolutionParameterf
);
7917 SET_ConvolutionParameterfv(table
, save_ConvolutionParameterfv
);
7918 SET_ConvolutionParameteri(table
, save_ConvolutionParameteri
);
7919 SET_ConvolutionParameteriv(table
, save_ConvolutionParameteriv
);
7920 SET_CopyColorSubTable(table
, save_CopyColorSubTable
);
7921 SET_CopyColorTable(table
, save_CopyColorTable
);
7922 SET_CopyConvolutionFilter1D(table
, exec_CopyConvolutionFilter1D
);
7923 SET_CopyConvolutionFilter2D(table
, exec_CopyConvolutionFilter2D
);
7924 SET_GetColorTable(table
, exec_GetColorTable
);
7925 SET_GetColorTableParameterfv(table
, exec_GetColorTableParameterfv
);
7926 SET_GetColorTableParameteriv(table
, exec_GetColorTableParameteriv
);
7927 SET_GetConvolutionFilter(table
, exec_GetConvolutionFilter
);
7928 SET_GetConvolutionParameterfv(table
, exec_GetConvolutionParameterfv
);
7929 SET_GetConvolutionParameteriv(table
, exec_GetConvolutionParameteriv
);
7930 SET_GetHistogram(table
, exec_GetHistogram
);
7931 SET_GetHistogramParameterfv(table
, exec_GetHistogramParameterfv
);
7932 SET_GetHistogramParameteriv(table
, exec_GetHistogramParameteriv
);
7933 SET_GetMinmax(table
, exec_GetMinmax
);
7934 SET_GetMinmaxParameterfv(table
, exec_GetMinmaxParameterfv
);
7935 SET_GetMinmaxParameteriv(table
, exec_GetMinmaxParameteriv
);
7936 SET_GetSeparableFilter(table
, exec_GetSeparableFilter
);
7937 SET_Histogram(table
, save_Histogram
);
7938 SET_Minmax(table
, save_Minmax
);
7939 SET_ResetHistogram(table
, save_ResetHistogram
);
7940 SET_ResetMinmax(table
, save_ResetMinmax
);
7941 SET_SeparableFilter2D(table
, exec_SeparableFilter2D
);
7943 /* 2. GL_EXT_blend_color */
7945 SET_BlendColorEXT(table
, save_BlendColorEXT
);
7948 /* 3. GL_EXT_polygon_offset */
7949 SET_PolygonOffsetEXT(table
, save_PolygonOffsetEXT
);
7951 /* 6. GL_EXT_texture3d */
7953 SET_CopyTexSubImage3DEXT(table
, save_CopyTexSubImage3D
);
7954 SET_TexImage3DEXT(table
, save_TexImage3DEXT
);
7955 SET_TexSubImage3DEXT(table
, save_TexSubImage3D
);
7958 /* 14. GL_SGI_color_table */
7960 SET_ColorTableSGI(table
, save_ColorTable
);
7961 SET_ColorSubTableSGI(table
, save_ColorSubTable
);
7962 SET_GetColorTableSGI(table
, exec_GetColorTable
);
7963 SET_GetColorTableParameterfvSGI(table
, exec_GetColorTableParameterfv
);
7964 SET_GetColorTableParameterivSGI(table
, exec_GetColorTableParameteriv
);
7967 /* 30. GL_EXT_vertex_array */
7968 SET_ColorPointerEXT(table
, exec_ColorPointerEXT
);
7969 SET_EdgeFlagPointerEXT(table
, exec_EdgeFlagPointerEXT
);
7970 SET_IndexPointerEXT(table
, exec_IndexPointerEXT
);
7971 SET_NormalPointerEXT(table
, exec_NormalPointerEXT
);
7972 SET_TexCoordPointerEXT(table
, exec_TexCoordPointerEXT
);
7973 SET_VertexPointerEXT(table
, exec_VertexPointerEXT
);
7975 /* 37. GL_EXT_blend_minmax */
7977 SET_BlendEquationEXT(table
, save_BlendEquationEXT
);
7980 /* 54. GL_EXT_point_parameters */
7981 SET_PointParameterfEXT(table
, save_PointParameterfEXT
);
7982 SET_PointParameterfvEXT(table
, save_PointParameterfvEXT
);
7984 /* 97. GL_EXT_compiled_vertex_array */
7985 SET_LockArraysEXT(table
, exec_LockArraysEXT
);
7986 SET_UnlockArraysEXT(table
, exec_UnlockArraysEXT
);
7988 /* 145. GL_EXT_secondary_color */
7989 SET_SecondaryColorPointerEXT(table
, exec_SecondaryColorPointerEXT
);
7991 /* 148. GL_EXT_multi_draw_arrays */
7992 SET_MultiDrawArraysEXT(table
, exec_MultiDrawArraysEXT
);
7993 SET_MultiDrawElementsEXT(table
, exec_MultiDrawElementsEXT
);
7995 /* 149. GL_EXT_fog_coord */
7996 SET_FogCoordPointerEXT(table
, exec_FogCoordPointerEXT
);
7998 /* 173. GL_EXT_blend_func_separate */
7999 SET_BlendFuncSeparateEXT(table
, save_BlendFuncSeparateEXT
);
8001 /* 196. GL_MESA_resize_buffers */
8002 SET_ResizeBuffersMESA(table
, _mesa_ResizeBuffersMESA
);
8004 /* 197. GL_MESA_window_pos */
8005 SET_WindowPos2dMESA(table
, save_WindowPos2dMESA
);
8006 SET_WindowPos2dvMESA(table
, save_WindowPos2dvMESA
);
8007 SET_WindowPos2fMESA(table
, save_WindowPos2fMESA
);
8008 SET_WindowPos2fvMESA(table
, save_WindowPos2fvMESA
);
8009 SET_WindowPos2iMESA(table
, save_WindowPos2iMESA
);
8010 SET_WindowPos2ivMESA(table
, save_WindowPos2ivMESA
);
8011 SET_WindowPos2sMESA(table
, save_WindowPos2sMESA
);
8012 SET_WindowPos2svMESA(table
, save_WindowPos2svMESA
);
8013 SET_WindowPos3dMESA(table
, save_WindowPos3dMESA
);
8014 SET_WindowPos3dvMESA(table
, save_WindowPos3dvMESA
);
8015 SET_WindowPos3fMESA(table
, save_WindowPos3fMESA
);
8016 SET_WindowPos3fvMESA(table
, save_WindowPos3fvMESA
);
8017 SET_WindowPos3iMESA(table
, save_WindowPos3iMESA
);
8018 SET_WindowPos3ivMESA(table
, save_WindowPos3ivMESA
);
8019 SET_WindowPos3sMESA(table
, save_WindowPos3sMESA
);
8020 SET_WindowPos3svMESA(table
, save_WindowPos3svMESA
);
8021 SET_WindowPos4dMESA(table
, save_WindowPos4dMESA
);
8022 SET_WindowPos4dvMESA(table
, save_WindowPos4dvMESA
);
8023 SET_WindowPos4fMESA(table
, save_WindowPos4fMESA
);
8024 SET_WindowPos4fvMESA(table
, save_WindowPos4fvMESA
);
8025 SET_WindowPos4iMESA(table
, save_WindowPos4iMESA
);
8026 SET_WindowPos4ivMESA(table
, save_WindowPos4ivMESA
);
8027 SET_WindowPos4sMESA(table
, save_WindowPos4sMESA
);
8028 SET_WindowPos4svMESA(table
, save_WindowPos4svMESA
);
8030 /* 200. GL_IBM_multimode_draw_arrays */
8031 SET_MultiModeDrawArraysIBM(table
, exec_MultiModeDrawArraysIBM
);
8032 SET_MultiModeDrawElementsIBM(table
, exec_MultiModeDrawElementsIBM
);
8034 #if FEATURE_NV_vertex_program
8035 /* 233. GL_NV_vertex_program */
8036 /* The following commands DO NOT go into display lists:
8037 * AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV,
8038 * VertexAttribPointerNV, GetProgram*, GetVertexAttrib*
8040 SET_BindProgramNV(table
, save_BindProgramNV
);
8041 SET_DeleteProgramsNV(table
, _mesa_DeletePrograms
);
8042 SET_ExecuteProgramNV(table
, save_ExecuteProgramNV
);
8043 SET_GenProgramsNV(table
, _mesa_GenPrograms
);
8044 SET_AreProgramsResidentNV(table
, _mesa_AreProgramsResidentNV
);
8045 SET_RequestResidentProgramsNV(table
, save_RequestResidentProgramsNV
);
8046 SET_GetProgramParameterfvNV(table
, _mesa_GetProgramParameterfvNV
);
8047 SET_GetProgramParameterdvNV(table
, _mesa_GetProgramParameterdvNV
);
8048 SET_GetProgramivNV(table
, _mesa_GetProgramivNV
);
8049 SET_GetProgramStringNV(table
, _mesa_GetProgramStringNV
);
8050 SET_GetTrackMatrixivNV(table
, _mesa_GetTrackMatrixivNV
);
8051 SET_GetVertexAttribdvNV(table
, _mesa_GetVertexAttribdvNV
);
8052 SET_GetVertexAttribfvNV(table
, _mesa_GetVertexAttribfvNV
);
8053 SET_GetVertexAttribivNV(table
, _mesa_GetVertexAttribivNV
);
8054 SET_GetVertexAttribPointervNV(table
, _mesa_GetVertexAttribPointervNV
);
8055 SET_IsProgramNV(table
, _mesa_IsProgramARB
);
8056 SET_LoadProgramNV(table
, save_LoadProgramNV
);
8057 SET_ProgramParameter4dNV(table
, save_ProgramParameter4dNV
);
8058 SET_ProgramParameter4dvNV(table
, save_ProgramParameter4dvNV
);
8059 SET_ProgramParameter4fNV(table
, save_ProgramParameter4fNV
);
8060 SET_ProgramParameter4fvNV(table
, save_ProgramParameter4fvNV
);
8061 SET_ProgramParameters4dvNV(table
, save_ProgramParameters4dvNV
);
8062 SET_ProgramParameters4fvNV(table
, save_ProgramParameters4fvNV
);
8063 SET_TrackMatrixNV(table
, save_TrackMatrixNV
);
8064 SET_VertexAttribPointerNV(table
, _mesa_VertexAttribPointerNV
);
8067 /* 245. GL_ATI_fragment_shader */
8068 #if FEATURE_ATI_fragment_shader
8069 SET_BindFragmentShaderATI(table
, save_BindFragmentShaderATI
);
8070 SET_SetFragmentShaderConstantATI(table
, save_SetFragmentShaderConstantATI
);
8073 /* 282. GL_NV_fragment_program */
8074 #if FEATURE_NV_fragment_program
8075 SET_ProgramNamedParameter4fNV(table
, save_ProgramNamedParameter4fNV
);
8076 SET_ProgramNamedParameter4dNV(table
, save_ProgramNamedParameter4dNV
);
8077 SET_ProgramNamedParameter4fvNV(table
, save_ProgramNamedParameter4fvNV
);
8078 SET_ProgramNamedParameter4dvNV(table
, save_ProgramNamedParameter4dvNV
);
8079 SET_GetProgramNamedParameterfvNV(table
,
8080 _mesa_GetProgramNamedParameterfvNV
);
8081 SET_GetProgramNamedParameterdvNV(table
,
8082 _mesa_GetProgramNamedParameterdvNV
);
8083 SET_ProgramLocalParameter4dARB(table
, save_ProgramLocalParameter4dARB
);
8084 SET_ProgramLocalParameter4dvARB(table
, save_ProgramLocalParameter4dvARB
);
8085 SET_ProgramLocalParameter4fARB(table
, save_ProgramLocalParameter4fARB
);
8086 SET_ProgramLocalParameter4fvARB(table
, save_ProgramLocalParameter4fvARB
);
8087 SET_GetProgramLocalParameterdvARB(table
,
8088 _mesa_GetProgramLocalParameterdvARB
);
8089 SET_GetProgramLocalParameterfvARB(table
,
8090 _mesa_GetProgramLocalParameterfvARB
);
8093 /* 262. GL_NV_point_sprite */
8094 SET_PointParameteriNV(table
, save_PointParameteriNV
);
8095 SET_PointParameterivNV(table
, save_PointParameterivNV
);
8097 /* 268. GL_EXT_stencil_two_side */
8098 SET_ActiveStencilFaceEXT(table
, save_ActiveStencilFaceEXT
);
8100 /* 273. GL_APPLE_vertex_array_object */
8101 SET_BindVertexArrayAPPLE(table
, _mesa_BindVertexArrayAPPLE
);
8102 SET_DeleteVertexArraysAPPLE(table
, _mesa_DeleteVertexArraysAPPLE
);
8103 SET_GenVertexArraysAPPLE(table
, _mesa_GenVertexArraysAPPLE
);
8104 SET_IsVertexArrayAPPLE(table
, _mesa_IsVertexArrayAPPLE
);
8106 /* ???. GL_EXT_depth_bounds_test */
8107 SET_DepthBoundsEXT(table
, save_DepthBoundsEXT
);
8109 /* ARB 1. GL_ARB_multitexture */
8110 SET_ActiveTextureARB(table
, save_ActiveTextureARB
);
8111 SET_ClientActiveTextureARB(table
, exec_ClientActiveTextureARB
);
8113 /* ARB 3. GL_ARB_transpose_matrix */
8114 SET_LoadTransposeMatrixdARB(table
, save_LoadTransposeMatrixdARB
);
8115 SET_LoadTransposeMatrixfARB(table
, save_LoadTransposeMatrixfARB
);
8116 SET_MultTransposeMatrixdARB(table
, save_MultTransposeMatrixdARB
);
8117 SET_MultTransposeMatrixfARB(table
, save_MultTransposeMatrixfARB
);
8119 /* ARB 5. GL_ARB_multisample */
8120 SET_SampleCoverageARB(table
, save_SampleCoverageARB
);
8122 /* ARB 12. GL_ARB_texture_compression */
8123 SET_CompressedTexImage3DARB(table
, save_CompressedTexImage3DARB
);
8124 SET_CompressedTexImage2DARB(table
, save_CompressedTexImage2DARB
);
8125 SET_CompressedTexImage1DARB(table
, save_CompressedTexImage1DARB
);
8126 SET_CompressedTexSubImage3DARB(table
, save_CompressedTexSubImage3DARB
);
8127 SET_CompressedTexSubImage2DARB(table
, save_CompressedTexSubImage2DARB
);
8128 SET_CompressedTexSubImage1DARB(table
, save_CompressedTexSubImage1DARB
);
8129 SET_GetCompressedTexImageARB(table
, exec_GetCompressedTexImageARB
);
8131 /* ARB 14. GL_ARB_point_parameters */
8132 /* aliased with EXT_point_parameters functions */
8134 /* ARB 25. GL_ARB_window_pos */
8135 /* aliased with MESA_window_pos functions */
8137 /* ARB 26. GL_ARB_vertex_program */
8138 /* ARB 27. GL_ARB_fragment_program */
8139 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
8140 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
8141 SET_VertexAttribPointerARB(table
, _mesa_VertexAttribPointerARB
);
8142 SET_EnableVertexAttribArrayARB(table
, _mesa_EnableVertexAttribArrayARB
);
8143 SET_DisableVertexAttribArrayARB(table
, _mesa_DisableVertexAttribArrayARB
);
8144 SET_ProgramStringARB(table
, save_ProgramStringARB
);
8145 SET_BindProgramNV(table
, save_BindProgramNV
);
8146 SET_DeleteProgramsNV(table
, _mesa_DeletePrograms
);
8147 SET_GenProgramsNV(table
, _mesa_GenPrograms
);
8148 SET_IsProgramNV(table
, _mesa_IsProgramARB
);
8149 SET_GetVertexAttribdvNV(table
, _mesa_GetVertexAttribdvNV
);
8150 SET_GetVertexAttribfvNV(table
, _mesa_GetVertexAttribfvNV
);
8151 SET_GetVertexAttribivNV(table
, _mesa_GetVertexAttribivNV
);
8152 SET_GetVertexAttribPointervNV(table
, _mesa_GetVertexAttribPointervNV
);
8153 SET_ProgramEnvParameter4dARB(table
, save_ProgramEnvParameter4dARB
);
8154 SET_ProgramEnvParameter4dvARB(table
, save_ProgramEnvParameter4dvARB
);
8155 SET_ProgramEnvParameter4fARB(table
, save_ProgramEnvParameter4fARB
);
8156 SET_ProgramEnvParameter4fvARB(table
, save_ProgramEnvParameter4fvARB
);
8157 SET_ProgramLocalParameter4dARB(table
, save_ProgramLocalParameter4dARB
);
8158 SET_ProgramLocalParameter4dvARB(table
, save_ProgramLocalParameter4dvARB
);
8159 SET_ProgramLocalParameter4fARB(table
, save_ProgramLocalParameter4fARB
);
8160 SET_ProgramLocalParameter4fvARB(table
, save_ProgramLocalParameter4fvARB
);
8161 SET_GetProgramEnvParameterdvARB(table
, _mesa_GetProgramEnvParameterdvARB
);
8162 SET_GetProgramEnvParameterfvARB(table
, _mesa_GetProgramEnvParameterfvARB
);
8163 SET_GetProgramLocalParameterdvARB(table
,
8164 _mesa_GetProgramLocalParameterdvARB
);
8165 SET_GetProgramLocalParameterfvARB(table
,
8166 _mesa_GetProgramLocalParameterfvARB
);
8167 SET_GetProgramivARB(table
, _mesa_GetProgramivARB
);
8168 SET_GetProgramStringARB(table
, _mesa_GetProgramStringARB
);
8171 /* ARB 28. GL_ARB_vertex_buffer_object */
8172 #if FEATURE_ARB_vertex_buffer_object
8173 /* None of the extension's functions get compiled */
8174 SET_BindBufferARB(table
, _mesa_BindBufferARB
);
8175 SET_BufferDataARB(table
, _mesa_BufferDataARB
);
8176 SET_BufferSubDataARB(table
, _mesa_BufferSubDataARB
);
8177 SET_DeleteBuffersARB(table
, _mesa_DeleteBuffersARB
);
8178 SET_GenBuffersARB(table
, _mesa_GenBuffersARB
);
8179 SET_GetBufferParameterivARB(table
, _mesa_GetBufferParameterivARB
);
8180 SET_GetBufferPointervARB(table
, _mesa_GetBufferPointervARB
);
8181 SET_GetBufferSubDataARB(table
, _mesa_GetBufferSubDataARB
);
8182 SET_IsBufferARB(table
, _mesa_IsBufferARB
);
8183 SET_MapBufferARB(table
, _mesa_MapBufferARB
);
8184 SET_UnmapBufferARB(table
, _mesa_UnmapBufferARB
);
8187 #if FEATURE_ARB_occlusion_query
8188 SET_BeginQueryARB(table
, save_BeginQueryARB
);
8189 SET_EndQueryARB(table
, save_EndQueryARB
);
8190 SET_GenQueriesARB(table
, _mesa_GenQueriesARB
);
8191 SET_DeleteQueriesARB(table
, _mesa_DeleteQueriesARB
);
8192 SET_IsQueryARB(table
, _mesa_IsQueryARB
);
8193 SET_GetQueryivARB(table
, _mesa_GetQueryivARB
);
8194 SET_GetQueryObjectivARB(table
, _mesa_GetQueryObjectivARB
);
8195 SET_GetQueryObjectuivARB(table
, _mesa_GetQueryObjectuivARB
);
8197 SET_DrawBuffersARB(table
, save_DrawBuffersARB
);
8199 #if FEATURE_EXT_framebuffer_blit
8200 SET_BlitFramebufferEXT(table
, save_BlitFramebufferEXT
);
8203 /* 299. GL_EXT_blend_equation_separate */
8204 SET_BlendEquationSeparateEXT(table
, save_BlendEquationSeparateEXT
);
8206 /* GL_EXT_gpu_program_parmaeters */
8207 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
8208 SET_ProgramEnvParameters4fvEXT(table
, save_ProgramEnvParameters4fvEXT
);
8209 SET_ProgramLocalParameters4fvEXT(table
, save_ProgramLocalParameters4fvEXT
);
8216 enum_string(GLenum k
)
8218 return _mesa_lookup_enum_by_nr(k
);
8223 * Print the commands in a display list. For debugging only.
8224 * TODO: many commands aren't handled yet.
8226 static void GLAPIENTRY
8227 print_list(GLcontext
*ctx
, GLuint list
)
8229 struct mesa_display_list
*dlist
;
8233 if (!islist(ctx
, list
)) {
8234 _mesa_printf("%u is not a display list ID\n", list
);
8238 dlist
= lookup_list(ctx
, list
);
8244 _mesa_printf("START-LIST %u, address %p\n", list
, (void *) n
);
8246 done
= n
? GL_FALSE
: GL_TRUE
;
8248 OpCode opcode
= n
[0].opcode
;
8249 GLint i
= (GLint
) n
[0].opcode
- (GLint
) OPCODE_EXT_0
;
8251 if (i
>= 0 && i
< (GLint
) ctx
->ListExt
.NumOpcodes
) {
8252 /* this is a driver-extended opcode */
8253 ctx
->ListExt
.Opcode
[i
].Print(ctx
, &n
[1]);
8254 n
+= ctx
->ListExt
.Opcode
[i
].Size
;
8259 _mesa_printf("Accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
8262 _mesa_printf("Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
8263 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
, (void *) n
[7].data
);
8265 case OPCODE_CALL_LIST
:
8266 _mesa_printf("CallList %d\n", (int) n
[1].ui
);
8268 case OPCODE_CALL_LIST_OFFSET
:
8269 _mesa_printf("CallList %d + offset %u = %u\n", (int) n
[1].ui
,
8270 ctx
->List
.ListBase
, ctx
->List
.ListBase
+ n
[1].ui
);
8272 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
8273 _mesa_printf("ColorTableParameterfv %s %s %f %f %f %f\n",
8274 enum_string(n
[1].e
), enum_string(n
[2].e
),
8275 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8277 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
8278 _mesa_printf("ColorTableParameteriv %s %s %d %d %d %d\n",
8279 enum_string(n
[1].e
), enum_string(n
[2].e
),
8280 n
[3].i
, n
[4].i
, n
[5].i
, n
[6].i
);
8282 case OPCODE_DISABLE
:
8283 _mesa_printf("Disable %s\n", enum_string(n
[1].e
));
8286 _mesa_printf("Enable %s\n", enum_string(n
[1].e
));
8288 case OPCODE_FRUSTUM
:
8289 _mesa_printf("Frustum %g %g %g %g %g %g\n",
8290 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8292 case OPCODE_LINE_STIPPLE
:
8293 _mesa_printf("LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
8295 case OPCODE_LOAD_IDENTITY
:
8296 _mesa_printf("LoadIdentity\n");
8298 case OPCODE_LOAD_MATRIX
:
8299 _mesa_printf("LoadMatrix\n");
8300 _mesa_printf(" %8f %8f %8f %8f\n",
8301 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
8302 _mesa_printf(" %8f %8f %8f %8f\n",
8303 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
8304 _mesa_printf(" %8f %8f %8f %8f\n",
8305 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
8306 _mesa_printf(" %8f %8f %8f %8f\n",
8307 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
8309 case OPCODE_MULT_MATRIX
:
8310 _mesa_printf("MultMatrix (or Rotate)\n");
8311 _mesa_printf(" %8f %8f %8f %8f\n",
8312 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
8313 _mesa_printf(" %8f %8f %8f %8f\n",
8314 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
8315 _mesa_printf(" %8f %8f %8f %8f\n",
8316 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
8317 _mesa_printf(" %8f %8f %8f %8f\n",
8318 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
8321 _mesa_printf("Ortho %g %g %g %g %g %g\n",
8322 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8324 case OPCODE_POP_ATTRIB
:
8325 _mesa_printf("PopAttrib\n");
8327 case OPCODE_POP_MATRIX
:
8328 _mesa_printf("PopMatrix\n");
8330 case OPCODE_POP_NAME
:
8331 _mesa_printf("PopName\n");
8333 case OPCODE_PUSH_ATTRIB
:
8334 _mesa_printf("PushAttrib %x\n", n
[1].bf
);
8336 case OPCODE_PUSH_MATRIX
:
8337 _mesa_printf("PushMatrix\n");
8339 case OPCODE_PUSH_NAME
:
8340 _mesa_printf("PushName %d\n", (int) n
[1].ui
);
8342 case OPCODE_RASTER_POS
:
8343 _mesa_printf("RasterPos %g %g %g %g\n",
8344 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
8347 _mesa_printf("Rotate %g %g %g %g\n",
8348 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
8351 _mesa_printf("Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
8353 case OPCODE_TRANSLATE
:
8354 _mesa_printf("Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
8356 case OPCODE_BIND_TEXTURE
:
8357 _mesa_printf("BindTexture %s %d\n",
8358 _mesa_lookup_enum_by_nr(n
[1].ui
), n
[2].ui
);
8360 case OPCODE_SHADE_MODEL
:
8361 _mesa_printf("ShadeModel %s\n", _mesa_lookup_enum_by_nr(n
[1].ui
));
8364 _mesa_printf("Map1 %s %.3f %.3f %d %d\n",
8365 _mesa_lookup_enum_by_nr(n
[1].ui
),
8366 n
[2].f
, n
[3].f
, n
[4].i
, n
[5].i
);
8369 _mesa_printf("Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
8370 _mesa_lookup_enum_by_nr(n
[1].ui
),
8371 n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
,
8372 n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
8374 case OPCODE_MAPGRID1
:
8375 _mesa_printf("MapGrid1 %d %.3f %.3f\n", n
[1].i
, n
[2].f
, n
[3].f
);
8377 case OPCODE_MAPGRID2
:
8378 _mesa_printf("MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
8379 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
8381 case OPCODE_EVALMESH1
:
8382 _mesa_printf("EvalMesh1 %d %d\n", n
[1].i
, n
[2].i
);
8384 case OPCODE_EVALMESH2
:
8385 _mesa_printf("EvalMesh2 %d %d %d %d\n",
8386 n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
8389 case OPCODE_ATTR_1F_NV
:
8390 _mesa_printf("ATTR_1F_NV attr %d: %f\n", n
[1].i
, n
[2].f
);
8392 case OPCODE_ATTR_2F_NV
:
8393 _mesa_printf("ATTR_2F_NV attr %d: %f %f\n",
8394 n
[1].i
, n
[2].f
, n
[3].f
);
8396 case OPCODE_ATTR_3F_NV
:
8397 _mesa_printf("ATTR_3F_NV attr %d: %f %f %f\n",
8398 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
8400 case OPCODE_ATTR_4F_NV
:
8401 _mesa_printf("ATTR_4F_NV attr %d: %f %f %f %f\n",
8402 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
8404 case OPCODE_ATTR_1F_ARB
:
8405 _mesa_printf("ATTR_1F_ARB attr %d: %f\n", n
[1].i
, n
[2].f
);
8407 case OPCODE_ATTR_2F_ARB
:
8408 _mesa_printf("ATTR_2F_ARB attr %d: %f %f\n",
8409 n
[1].i
, n
[2].f
, n
[3].f
);
8411 case OPCODE_ATTR_3F_ARB
:
8412 _mesa_printf("ATTR_3F_ARB attr %d: %f %f %f\n",
8413 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
8415 case OPCODE_ATTR_4F_ARB
:
8416 _mesa_printf("ATTR_4F_ARB attr %d: %f %f %f %f\n",
8417 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
8420 case OPCODE_MATERIAL
:
8421 _mesa_printf("MATERIAL %x %x: %f %f %f %f\n",
8422 n
[1].i
, n
[2].i
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8425 _mesa_printf("INDEX: %f\n", n
[1].f
);
8427 case OPCODE_EDGEFLAG
:
8428 _mesa_printf("EDGEFLAG: %d\n", n
[1].i
);
8431 _mesa_printf("BEGIN %x\n", n
[1].i
);
8434 _mesa_printf("END\n");
8437 _mesa_printf("RECTF %f %f %f %f\n", n
[1].f
, n
[2].f
, n
[3].f
,
8440 case OPCODE_EVAL_C1
:
8441 _mesa_printf("EVAL_C1 %f\n", n
[1].f
);
8443 case OPCODE_EVAL_C2
:
8444 _mesa_printf("EVAL_C2 %f %f\n", n
[1].f
, n
[2].f
);
8446 case OPCODE_EVAL_P1
:
8447 _mesa_printf("EVAL_P1 %d\n", n
[1].i
);
8449 case OPCODE_EVAL_P2
:
8450 _mesa_printf("EVAL_P2 %d %d\n", n
[1].i
, n
[2].i
);
8456 * meta opcodes/commands
8459 _mesa_printf("Error: %s %s\n",
8460 enum_string(n
[1].e
), (const char *) n
[2].data
);
8462 case OPCODE_CONTINUE
:
8463 _mesa_printf("DISPLAY-LIST-CONTINUE\n");
8464 n
= (Node
*) n
[1].next
;
8466 case OPCODE_END_OF_LIST
:
8467 _mesa_printf("END-LIST %u\n", list
);
8471 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
8473 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
8474 opcode
, (void *) n
);
8478 _mesa_printf("command %d, %u operands\n", opcode
,
8482 /* increment n to point to next compiled command */
8483 if (opcode
!= OPCODE_CONTINUE
) {
8484 n
+= InstSize
[opcode
];
8493 * Clients may call this function to help debug display list problems.
8494 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
8495 * changed, or break in the future without notice.
8498 mesa_print_display_list(GLuint list
)
8500 GET_CURRENT_CONTEXT(ctx
);
8501 print_list(ctx
, list
);
8505 /**********************************************************************/
8506 /***** Initialization *****/
8507 /**********************************************************************/
8510 _mesa_save_vtxfmt_init(GLvertexformat
* vfmt
)
8512 vfmt
->ArrayElement
= _ae_loopback_array_elt
; /* generic helper */
8513 vfmt
->Begin
= save_Begin
;
8514 vfmt
->CallList
= _mesa_save_CallList
;
8515 vfmt
->CallLists
= _mesa_save_CallLists
;
8516 vfmt
->Color3f
= save_Color3f
;
8517 vfmt
->Color3fv
= save_Color3fv
;
8518 vfmt
->Color4f
= save_Color4f
;
8519 vfmt
->Color4fv
= save_Color4fv
;
8520 vfmt
->EdgeFlag
= save_EdgeFlag
;
8521 vfmt
->End
= save_End
;
8522 vfmt
->EvalCoord1f
= save_EvalCoord1f
;
8523 vfmt
->EvalCoord1fv
= save_EvalCoord1fv
;
8524 vfmt
->EvalCoord2f
= save_EvalCoord2f
;
8525 vfmt
->EvalCoord2fv
= save_EvalCoord2fv
;
8526 vfmt
->EvalPoint1
= save_EvalPoint1
;
8527 vfmt
->EvalPoint2
= save_EvalPoint2
;
8528 vfmt
->FogCoordfEXT
= save_FogCoordfEXT
;
8529 vfmt
->FogCoordfvEXT
= save_FogCoordfvEXT
;
8530 vfmt
->Indexf
= save_Indexf
;
8531 vfmt
->Indexfv
= save_Indexfv
;
8532 vfmt
->Materialfv
= save_Materialfv
;
8533 vfmt
->MultiTexCoord1fARB
= save_MultiTexCoord1f
;
8534 vfmt
->MultiTexCoord1fvARB
= save_MultiTexCoord1fv
;
8535 vfmt
->MultiTexCoord2fARB
= save_MultiTexCoord2f
;
8536 vfmt
->MultiTexCoord2fvARB
= save_MultiTexCoord2fv
;
8537 vfmt
->MultiTexCoord3fARB
= save_MultiTexCoord3f
;
8538 vfmt
->MultiTexCoord3fvARB
= save_MultiTexCoord3fv
;
8539 vfmt
->MultiTexCoord4fARB
= save_MultiTexCoord4f
;
8540 vfmt
->MultiTexCoord4fvARB
= save_MultiTexCoord4fv
;
8541 vfmt
->Normal3f
= save_Normal3f
;
8542 vfmt
->Normal3fv
= save_Normal3fv
;
8543 vfmt
->SecondaryColor3fEXT
= save_SecondaryColor3fEXT
;
8544 vfmt
->SecondaryColor3fvEXT
= save_SecondaryColor3fvEXT
;
8545 vfmt
->TexCoord1f
= save_TexCoord1f
;
8546 vfmt
->TexCoord1fv
= save_TexCoord1fv
;
8547 vfmt
->TexCoord2f
= save_TexCoord2f
;
8548 vfmt
->TexCoord2fv
= save_TexCoord2fv
;
8549 vfmt
->TexCoord3f
= save_TexCoord3f
;
8550 vfmt
->TexCoord3fv
= save_TexCoord3fv
;
8551 vfmt
->TexCoord4f
= save_TexCoord4f
;
8552 vfmt
->TexCoord4fv
= save_TexCoord4fv
;
8553 vfmt
->Vertex2f
= save_Vertex2f
;
8554 vfmt
->Vertex2fv
= save_Vertex2fv
;
8555 vfmt
->Vertex3f
= save_Vertex3f
;
8556 vfmt
->Vertex3fv
= save_Vertex3fv
;
8557 vfmt
->Vertex4f
= save_Vertex4f
;
8558 vfmt
->Vertex4fv
= save_Vertex4fv
;
8559 vfmt
->VertexAttrib1fNV
= save_VertexAttrib1fNV
;
8560 vfmt
->VertexAttrib1fvNV
= save_VertexAttrib1fvNV
;
8561 vfmt
->VertexAttrib2fNV
= save_VertexAttrib2fNV
;
8562 vfmt
->VertexAttrib2fvNV
= save_VertexAttrib2fvNV
;
8563 vfmt
->VertexAttrib3fNV
= save_VertexAttrib3fNV
;
8564 vfmt
->VertexAttrib3fvNV
= save_VertexAttrib3fvNV
;
8565 vfmt
->VertexAttrib4fNV
= save_VertexAttrib4fNV
;
8566 vfmt
->VertexAttrib4fvNV
= save_VertexAttrib4fvNV
;
8567 vfmt
->VertexAttrib1fARB
= save_VertexAttrib1fARB
;
8568 vfmt
->VertexAttrib1fvARB
= save_VertexAttrib1fvARB
;
8569 vfmt
->VertexAttrib2fARB
= save_VertexAttrib2fARB
;
8570 vfmt
->VertexAttrib2fvARB
= save_VertexAttrib2fvARB
;
8571 vfmt
->VertexAttrib3fARB
= save_VertexAttrib3fARB
;
8572 vfmt
->VertexAttrib3fvARB
= save_VertexAttrib3fvARB
;
8573 vfmt
->VertexAttrib4fARB
= save_VertexAttrib4fARB
;
8574 vfmt
->VertexAttrib4fvARB
= save_VertexAttrib4fvARB
;
8576 vfmt
->EvalMesh1
= _mesa_save_EvalMesh1
;
8577 vfmt
->EvalMesh2
= _mesa_save_EvalMesh2
;
8578 vfmt
->Rectf
= save_Rectf
;
8580 /* The driver is required to implement these as
8581 * 1) They can probably do a better job.
8582 * 2) A lot of new mechanisms would have to be added to this module
8583 * to support it. That code would probably never get used,
8587 vfmt
->DrawArrays
= 0;
8588 vfmt
->DrawElements
= 0;
8589 vfmt
->DrawRangeElements
= 0;
8595 * Initialize display list state for given context.
8598 _mesa_init_display_list(GLcontext
*ctx
)
8600 static GLboolean tableInitialized
= GL_FALSE
;
8602 /* zero-out the instruction size table, just once */
8603 if (!tableInitialized
) {
8604 _mesa_bzero(InstSize
, sizeof(InstSize
));
8605 tableInitialized
= GL_TRUE
;
8609 ctx
->ListState
.CallDepth
= 0;
8610 ctx
->ExecuteFlag
= GL_TRUE
;
8611 ctx
->CompileFlag
= GL_FALSE
;
8612 ctx
->ListState
.CurrentListPtr
= NULL
;
8613 ctx
->ListState
.CurrentBlock
= NULL
;
8614 ctx
->ListState
.CurrentListNum
= 0;
8615 ctx
->ListState
.CurrentPos
= 0;
8617 /* Display List group */
8618 ctx
->List
.ListBase
= 0;
8620 _mesa_save_vtxfmt_init(&ctx
->ListState
.ListVtxfmt
);