2 * Mesa 3-D graphics library
5 * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 * Display lists management functions.
33 #include "api_arrayelt.h"
34 #include "api_loopback.h"
39 #if FEATURE_ARB_vertex_buffer_object
40 #include "bufferobj.h"
53 #include "extensions.h"
56 #include "glapi/glapi.h"
58 #include "histogram.h"
75 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
76 #include "shader/arbprogram.h"
77 #include "shader/program.h"
79 #if FEATURE_NV_vertex_program || FEATURE_NV_fragment_program
80 #include "shader/nvprogram.h"
81 #include "shader/program.h"
83 #if FEATURE_ATI_fragment_shader
84 #include "shader/atifragshader.h"
87 #include "math/m_matrix.h"
88 #include "math/m_xform.h"
90 #include "glapi/dispatch.h"
96 * \param ctx GL context.
98 * Checks if dd_function_table::SaveNeedFlush is marked to flush
99 * stored (save) vertices, and calls
100 * dd_function_table::SaveFlushVertices if so.
102 #define SAVE_FLUSH_VERTICES(ctx) \
104 if (ctx->Driver.SaveNeedFlush) \
105 ctx->Driver.SaveFlushVertices(ctx); \
110 * Macro to assert that the API call was made outside the
111 * glBegin()/glEnd() pair, with return value.
113 * \param ctx GL context.
114 * \param retval value to return value in case the assertion fails.
116 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval) \
118 if (ctx->Driver.CurrentSavePrimitive <= GL_POLYGON || \
119 ctx->Driver.CurrentSavePrimitive == PRIM_INSIDE_UNKNOWN_PRIM) { \
120 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \
126 * Macro to assert that the API call was made outside the
127 * glBegin()/glEnd() pair.
129 * \param ctx GL context.
131 #define ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx) \
133 if (ctx->Driver.CurrentSavePrimitive <= GL_POLYGON || \
134 ctx->Driver.CurrentSavePrimitive == PRIM_INSIDE_UNKNOWN_PRIM) { \
135 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \
141 * Macro to assert that the API call was made outside the
142 * glBegin()/glEnd() pair and flush the vertices.
144 * \param ctx GL context.
146 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx) \
148 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx); \
149 SAVE_FLUSH_VERTICES(ctx); \
153 * Macro to assert that the API call was made outside the
154 * glBegin()/glEnd() pair and flush the vertices, with return value.
156 * \param ctx GL context.
157 * \param retval value to return value in case the assertion fails.
159 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval)\
161 ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval); \
162 SAVE_FLUSH_VERTICES(ctx); \
168 * Display list opcodes.
170 * The fact that these identifiers are assigned consecutive
171 * integer values starting at 0 is very important, see InstSize array usage)
175 OPCODE_INVALID
= -1, /* Force signed enum */
181 OPCODE_BLEND_EQUATION
,
182 OPCODE_BLEND_EQUATION_SEPARATE
,
183 OPCODE_BLEND_FUNC_SEPARATE
,
185 OPCODE_CALL_LIST_OFFSET
,
191 OPCODE_CLEAR_STENCIL
,
194 OPCODE_COLOR_MATERIAL
,
196 OPCODE_COLOR_TABLE_PARAMETER_FV
,
197 OPCODE_COLOR_TABLE_PARAMETER_IV
,
198 OPCODE_COLOR_SUB_TABLE
,
199 OPCODE_CONVOLUTION_FILTER_1D
,
200 OPCODE_CONVOLUTION_FILTER_2D
,
201 OPCODE_CONVOLUTION_PARAMETER_I
,
202 OPCODE_CONVOLUTION_PARAMETER_IV
,
203 OPCODE_CONVOLUTION_PARAMETER_F
,
204 OPCODE_CONVOLUTION_PARAMETER_FV
,
205 OPCODE_COPY_COLOR_SUB_TABLE
,
206 OPCODE_COPY_COLOR_TABLE
,
208 OPCODE_COPY_TEX_IMAGE1D
,
209 OPCODE_COPY_TEX_IMAGE2D
,
210 OPCODE_COPY_TEX_SUB_IMAGE1D
,
211 OPCODE_COPY_TEX_SUB_IMAGE2D
,
212 OPCODE_COPY_TEX_SUB_IMAGE3D
,
235 OPCODE_LOAD_IDENTITY
,
249 OPCODE_PIXEL_TRANSFER
,
252 OPCODE_POINT_PARAMETERS
,
254 OPCODE_POLYGON_STIPPLE
,
255 OPCODE_POLYGON_OFFSET
,
259 OPCODE_PRIORITIZE_TEXTURE
,
265 OPCODE_RESET_HISTOGRAM
,
266 OPCODE_RESET_MIN_MAX
,
270 OPCODE_SELECT_TEXTURE_SGIS
,
271 OPCODE_SELECT_TEXTURE_COORD_SET
,
282 OPCODE_TEX_SUB_IMAGE1D
,
283 OPCODE_TEX_SUB_IMAGE2D
,
284 OPCODE_TEX_SUB_IMAGE3D
,
288 /* GL_ARB_multitexture */
289 OPCODE_ACTIVE_TEXTURE
,
290 /* GL_ARB_texture_compression */
291 OPCODE_COMPRESSED_TEX_IMAGE_1D
,
292 OPCODE_COMPRESSED_TEX_IMAGE_2D
,
293 OPCODE_COMPRESSED_TEX_IMAGE_3D
,
294 OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
,
295 OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
,
296 OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
,
297 /* GL_ARB_multisample */
298 OPCODE_SAMPLE_COVERAGE
,
299 /* GL_ARB_window_pos */
300 OPCODE_WINDOW_POS_ARB
,
301 /* GL_NV_vertex_program */
302 OPCODE_BIND_PROGRAM_NV
,
303 OPCODE_EXECUTE_PROGRAM_NV
,
304 OPCODE_REQUEST_RESIDENT_PROGRAMS_NV
,
305 OPCODE_LOAD_PROGRAM_NV
,
306 OPCODE_TRACK_MATRIX_NV
,
307 /* GL_NV_fragment_program */
308 OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
,
309 OPCODE_PROGRAM_NAMED_PARAMETER_NV
,
310 /* GL_EXT_stencil_two_side */
311 OPCODE_ACTIVE_STENCIL_FACE_EXT
,
312 /* GL_EXT_depth_bounds_test */
313 OPCODE_DEPTH_BOUNDS_EXT
,
314 /* GL_ARB_vertex/fragment_program */
315 OPCODE_PROGRAM_STRING_ARB
,
316 OPCODE_PROGRAM_ENV_PARAMETER_ARB
,
317 /* GL_ARB_occlusion_query */
318 OPCODE_BEGIN_QUERY_ARB
,
319 OPCODE_END_QUERY_ARB
,
320 /* GL_ARB_draw_buffers */
321 OPCODE_DRAW_BUFFERS_ARB
,
322 /* GL_ATI_fragment_shader */
323 OPCODE_BIND_FRAGMENT_SHADER_ATI
,
324 OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
,
326 OPCODE_STENCIL_FUNC_SEPARATE
,
327 OPCODE_STENCIL_OP_SEPARATE
,
328 OPCODE_STENCIL_MASK_SEPARATE
,
330 /* GL_EXT_framebuffer_blit */
331 OPCODE_BLIT_FRAMEBUFFER
,
333 /* Vertex attributes -- fallback for when optimized display
334 * list build isn't active.
353 /* The following three are meta instructions */
354 OPCODE_ERROR
, /* raise compiled-in error */
365 * Display list instructions are stored as sequences of "nodes". Nodes
366 * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
367 * are linked together with a pointer.
369 * Each instruction in the display list is stored as a sequence of
370 * contiguous nodes in memory.
371 * Each node is the union of a variety of data types.
386 void *next
; /* If prev node's opcode==OPCODE_CONTINUE */
391 * How many nodes to allocate at a time.
393 * \note Reduced now that we hold vertices etc. elsewhere.
395 #define BLOCK_SIZE 256
400 * Number of nodes of storage needed for each instruction.
401 * Sizes for dynamically allocated opcodes are stored in the context struct.
403 static GLuint InstSize
[OPCODE_END_OF_LIST
+ 1];
405 void mesa_print_display_list(GLuint list
);
408 /**********************************************************************/
409 /***** Private *****/
410 /**********************************************************************/
414 * Make an empty display list. This is used by glGenLists() to
415 * reserve display list IDs.
417 static struct mesa_display_list
*
418 make_list(GLuint list
, GLuint count
)
420 struct mesa_display_list
*dlist
= CALLOC_STRUCT(mesa_display_list
);
422 dlist
->node
= (Node
*) _mesa_malloc(sizeof(Node
) * count
);
423 dlist
->node
[0].opcode
= OPCODE_END_OF_LIST
;
429 * Lookup function to just encapsulate casting.
431 static INLINE
struct mesa_display_list
*
432 lookup_list(GLcontext
*ctx
, GLuint list
)
434 return (struct mesa_display_list
*)
435 _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
441 * Delete the named display list, but don't remove from hash table.
442 * \param dlist - display list pointer
445 _mesa_delete_list(GLcontext
*ctx
, struct mesa_display_list
*dlist
)
450 n
= block
= dlist
->node
;
452 done
= block
? GL_FALSE
: GL_TRUE
;
455 /* check for extension opcodes first */
457 GLint i
= (GLint
) n
[0].opcode
- (GLint
) OPCODE_EXT_0
;
458 if (i
>= 0 && i
< (GLint
) ctx
->ListExt
.NumOpcodes
) {
459 ctx
->ListExt
.Opcode
[i
].Destroy(ctx
, &n
[1]);
460 n
+= ctx
->ListExt
.Opcode
[i
].Size
;
463 switch (n
[0].opcode
) {
464 /* for some commands, we need to free malloc'd memory */
466 _mesa_free(n
[6].data
);
467 n
+= InstSize
[n
[0].opcode
];
470 _mesa_free(n
[10].data
);
471 n
+= InstSize
[n
[0].opcode
];
473 case OPCODE_DRAW_PIXELS
:
474 _mesa_free(n
[5].data
);
475 n
+= InstSize
[n
[0].opcode
];
478 _mesa_free(n
[7].data
);
479 n
+= InstSize
[n
[0].opcode
];
481 case OPCODE_COLOR_TABLE
:
482 _mesa_free(n
[6].data
);
483 n
+= InstSize
[n
[0].opcode
];
485 case OPCODE_COLOR_SUB_TABLE
:
486 _mesa_free(n
[6].data
);
487 n
+= InstSize
[n
[0].opcode
];
489 case OPCODE_CONVOLUTION_FILTER_1D
:
490 _mesa_free(n
[6].data
);
491 n
+= InstSize
[n
[0].opcode
];
493 case OPCODE_CONVOLUTION_FILTER_2D
:
494 _mesa_free(n
[7].data
);
495 n
+= InstSize
[n
[0].opcode
];
497 case OPCODE_POLYGON_STIPPLE
:
498 _mesa_free(n
[1].data
);
499 n
+= InstSize
[n
[0].opcode
];
501 case OPCODE_TEX_IMAGE1D
:
502 _mesa_free(n
[8].data
);
503 n
+= InstSize
[n
[0].opcode
];
505 case OPCODE_TEX_IMAGE2D
:
506 _mesa_free(n
[9].data
);
507 n
+= InstSize
[n
[0].opcode
];
509 case OPCODE_TEX_IMAGE3D
:
510 _mesa_free(n
[10].data
);
511 n
+= InstSize
[n
[0].opcode
];
513 case OPCODE_TEX_SUB_IMAGE1D
:
514 _mesa_free(n
[7].data
);
515 n
+= InstSize
[n
[0].opcode
];
517 case OPCODE_TEX_SUB_IMAGE2D
:
518 _mesa_free(n
[9].data
);
519 n
+= InstSize
[n
[0].opcode
];
521 case OPCODE_TEX_SUB_IMAGE3D
:
522 _mesa_free(n
[11].data
);
523 n
+= InstSize
[n
[0].opcode
];
525 case OPCODE_COMPRESSED_TEX_IMAGE_1D
:
526 _mesa_free(n
[7].data
);
527 n
+= InstSize
[n
[0].opcode
];
529 case OPCODE_COMPRESSED_TEX_IMAGE_2D
:
530 _mesa_free(n
[8].data
);
531 n
+= InstSize
[n
[0].opcode
];
533 case OPCODE_COMPRESSED_TEX_IMAGE_3D
:
534 _mesa_free(n
[9].data
);
535 n
+= InstSize
[n
[0].opcode
];
537 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
:
538 _mesa_free(n
[7].data
);
539 n
+= InstSize
[n
[0].opcode
];
541 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
:
542 _mesa_free(n
[9].data
);
543 n
+= InstSize
[n
[0].opcode
];
545 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
:
546 _mesa_free(n
[11].data
);
547 n
+= InstSize
[n
[0].opcode
];
549 #if FEATURE_NV_vertex_program
550 case OPCODE_LOAD_PROGRAM_NV
:
551 _mesa_free(n
[4].data
); /* program string */
552 n
+= InstSize
[n
[0].opcode
];
554 case OPCODE_REQUEST_RESIDENT_PROGRAMS_NV
:
555 _mesa_free(n
[2].data
); /* array of program ids */
556 n
+= InstSize
[n
[0].opcode
];
559 #if FEATURE_NV_fragment_program
560 case OPCODE_PROGRAM_NAMED_PARAMETER_NV
:
561 _mesa_free(n
[3].data
); /* parameter name */
562 n
+= InstSize
[n
[0].opcode
];
565 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
566 case OPCODE_PROGRAM_STRING_ARB
:
567 _mesa_free(n
[4].data
); /* program string */
568 n
+= InstSize
[n
[0].opcode
];
571 case OPCODE_CONTINUE
:
572 n
= (Node
*) n
[1].next
;
576 case OPCODE_END_OF_LIST
:
581 /* Most frequent case */
582 n
+= InstSize
[n
[0].opcode
];
593 * Destroy a display list and remove from hash table.
594 * \param list - display list number
597 destroy_list(GLcontext
*ctx
, GLuint list
)
599 struct mesa_display_list
*dlist
;
604 dlist
= lookup_list(ctx
, list
);
608 _mesa_delete_list(ctx
, dlist
);
609 _mesa_HashRemove(ctx
->Shared
->DisplayList
, list
);
614 * Translate the nth element of list from <type> to GLint.
617 translate_id(GLsizei n
, GLenum type
, const GLvoid
* list
)
629 bptr
= (GLbyte
*) list
;
630 return (GLint
) bptr
[n
];
631 case GL_UNSIGNED_BYTE
:
632 ubptr
= (GLubyte
*) list
;
633 return (GLint
) ubptr
[n
];
635 sptr
= (GLshort
*) list
;
636 return (GLint
) sptr
[n
];
637 case GL_UNSIGNED_SHORT
:
638 usptr
= (GLushort
*) list
;
639 return (GLint
) usptr
[n
];
641 iptr
= (GLint
*) list
;
643 case GL_UNSIGNED_INT
:
644 uiptr
= (GLuint
*) list
;
645 return (GLint
) uiptr
[n
];
647 fptr
= (GLfloat
*) list
;
648 return (GLint
) FLOORF(fptr
[n
]);
650 ubptr
= ((GLubyte
*) list
) + 2 * n
;
651 return (GLint
) ubptr
[0] * 256
654 ubptr
= ((GLubyte
*) list
) + 3 * n
;
655 return (GLint
) ubptr
[0] * 65536
656 + (GLint
) ubptr
[1] * 256
659 ubptr
= ((GLubyte
*) list
) + 4 * n
;
660 return (GLint
) ubptr
[0] * 16777216
661 + (GLint
) ubptr
[1] * 65536
662 + (GLint
) ubptr
[2] * 256
672 /**********************************************************************/
674 /**********************************************************************/
677 * Wrapper for _mesa_unpack_image() that handles pixel buffer objects.
678 * \todo This won't suffice when the PBO is really in VRAM/GPU memory.
681 unpack_image(GLuint dimensions
, GLsizei width
, GLsizei height
, GLsizei depth
,
682 GLenum format
, GLenum type
, const GLvoid
* pixels
,
683 const struct gl_pixelstore_attrib
*unpack
)
685 if (unpack
->BufferObj
->Name
== 0) {
687 return _mesa_unpack_image(dimensions
, width
, height
, depth
, format
,
688 type
, pixels
, unpack
);
691 if (_mesa_validate_pbo_access
692 (dimensions
, unpack
, width
, height
, depth
, format
, type
, pixels
)) {
693 const GLubyte
*src
= ADD_POINTERS(unpack
->BufferObj
->Data
, pixels
);
694 return _mesa_unpack_image(dimensions
, width
, height
, depth
, format
,
703 * Allocate space for a display list instruction.
704 * \param opcode the instruction opcode (OPCODE_* value)
705 * \param size instruction size in bytes, not counting opcode.
706 * \return pointer to the usable data area (not including the internal
710 _mesa_alloc_instruction(GLcontext
*ctx
, GLuint opcode
, GLuint bytes
)
712 const GLuint numNodes
= 1 + (bytes
+ sizeof(Node
) - 1) / sizeof(Node
);
715 if (opcode
< (GLuint
) OPCODE_EXT_0
) {
716 if (InstSize
[opcode
] == 0) {
717 /* save instruction size now */
718 InstSize
[opcode
] = numNodes
;
721 /* make sure instruction size agrees */
722 ASSERT(numNodes
== InstSize
[opcode
]);
726 if (ctx
->ListState
.CurrentPos
+ numNodes
+ 2 > BLOCK_SIZE
) {
727 /* This block is full. Allocate a new block and chain to it */
729 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
730 n
[0].opcode
= OPCODE_CONTINUE
;
731 newblock
= (Node
*) _mesa_malloc(sizeof(Node
) * BLOCK_SIZE
);
733 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "Building display list");
736 n
[1].next
= (Node
*) newblock
;
737 ctx
->ListState
.CurrentBlock
= newblock
;
738 ctx
->ListState
.CurrentPos
= 0;
741 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
742 ctx
->ListState
.CurrentPos
+= numNodes
;
744 n
[0].opcode
= (OpCode
) opcode
;
746 return (void *) (n
+ 1); /* return ptr to node following opcode */
751 * This function allows modules and drivers to get their own opcodes
752 * for extending display list functionality.
753 * \param ctx the rendering context
754 * \param size number of bytes for storing the new display list command
755 * \param execute function to execute the new display list command
756 * \param destroy function to destroy the new display list command
757 * \param print function to print the new display list command
758 * \return the new opcode number or -1 if error
761 _mesa_alloc_opcode(GLcontext
*ctx
,
763 void (*execute
) (GLcontext
*, void *),
764 void (*destroy
) (GLcontext
*, void *),
765 void (*print
) (GLcontext
*, void *))
767 if (ctx
->ListExt
.NumOpcodes
< MAX_DLIST_EXT_OPCODES
) {
768 const GLuint i
= ctx
->ListExt
.NumOpcodes
++;
769 ctx
->ListExt
.Opcode
[i
].Size
=
770 1 + (size
+ sizeof(Node
) - 1) / sizeof(Node
);
771 ctx
->ListExt
.Opcode
[i
].Execute
= execute
;
772 ctx
->ListExt
.Opcode
[i
].Destroy
= destroy
;
773 ctx
->ListExt
.Opcode
[i
].Print
= print
;
774 return i
+ OPCODE_EXT_0
;
782 * Allocate display list instruction. Returns Node ptr to where the opcode
784 * - nParams is the number of function parameters
785 * - return value a pointer to sizeof(Node) before the actual
788 #define ALLOC_INSTRUCTION(CTX, OPCODE, NPARAMS) \
789 ((Node *)_mesa_alloc_instruction(CTX, OPCODE, (NPARAMS)*sizeof(Node)) - 1)
794 * Display List compilation functions
796 static void GLAPIENTRY
797 save_Accum(GLenum op
, GLfloat value
)
799 GET_CURRENT_CONTEXT(ctx
);
801 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
802 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ACCUM
, 2);
807 if (ctx
->ExecuteFlag
) {
808 CALL_Accum(ctx
->Exec
, (op
, value
));
813 static void GLAPIENTRY
814 save_AlphaFunc(GLenum func
, GLclampf ref
)
816 GET_CURRENT_CONTEXT(ctx
);
818 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
819 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ALPHA_FUNC
, 2);
822 n
[2].f
= (GLfloat
) ref
;
824 if (ctx
->ExecuteFlag
) {
825 CALL_AlphaFunc(ctx
->Exec
, (func
, ref
));
830 static void GLAPIENTRY
831 save_BindTexture(GLenum target
, GLuint texture
)
833 GET_CURRENT_CONTEXT(ctx
);
835 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
836 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BIND_TEXTURE
, 2);
841 if (ctx
->ExecuteFlag
) {
842 CALL_BindTexture(ctx
->Exec
, (target
, texture
));
847 static void GLAPIENTRY
848 save_Bitmap(GLsizei width
, GLsizei height
,
849 GLfloat xorig
, GLfloat yorig
,
850 GLfloat xmove
, GLfloat ymove
, const GLubyte
* pixels
)
852 GET_CURRENT_CONTEXT(ctx
);
853 GLvoid
*image
= _mesa_unpack_bitmap(width
, height
, pixels
, &ctx
->Unpack
);
855 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
856 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BITMAP
, 7);
858 n
[1].i
= (GLint
) width
;
859 n
[2].i
= (GLint
) height
;
869 if (ctx
->ExecuteFlag
) {
870 CALL_Bitmap(ctx
->Exec
, (width
, height
,
871 xorig
, yorig
, xmove
, ymove
, pixels
));
876 static void GLAPIENTRY
877 save_BlendEquation(GLenum mode
)
879 GET_CURRENT_CONTEXT(ctx
);
881 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
882 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BLEND_EQUATION
, 1);
886 if (ctx
->ExecuteFlag
) {
887 CALL_BlendEquation(ctx
->Exec
, (mode
));
892 static void GLAPIENTRY
893 save_BlendEquationSeparateEXT(GLenum modeRGB
, GLenum modeA
)
895 GET_CURRENT_CONTEXT(ctx
);
897 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
898 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BLEND_EQUATION_SEPARATE
, 2);
903 if (ctx
->ExecuteFlag
) {
904 CALL_BlendEquationSeparateEXT(ctx
->Exec
, (modeRGB
, modeA
));
909 static void GLAPIENTRY
910 save_BlendFuncSeparateEXT(GLenum sfactorRGB
, GLenum dfactorRGB
,
911 GLenum sfactorA
, GLenum dfactorA
)
913 GET_CURRENT_CONTEXT(ctx
);
915 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
916 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BLEND_FUNC_SEPARATE
, 4);
923 if (ctx
->ExecuteFlag
) {
924 CALL_BlendFuncSeparateEXT(ctx
->Exec
,
925 (sfactorRGB
, dfactorRGB
, sfactorA
, dfactorA
));
930 static void GLAPIENTRY
931 save_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 GLint 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
));
2721 static void GLAPIENTRY
2722 save_PolygonStipple(const GLubyte
* pattern
)
2724 GET_CURRENT_CONTEXT(ctx
);
2725 GLvoid
*image
= unpack_image(2, 32, 32, 1, GL_COLOR_INDEX
, GL_BITMAP
,
2726 pattern
, &ctx
->Unpack
);
2728 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2729 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_POLYGON_STIPPLE
, 1);
2736 if (ctx
->ExecuteFlag
) {
2737 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) pattern
));
2742 static void GLAPIENTRY
2743 save_PolygonOffset(GLfloat factor
, GLfloat units
)
2745 GET_CURRENT_CONTEXT(ctx
);
2747 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2748 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_POLYGON_OFFSET
, 2);
2753 if (ctx
->ExecuteFlag
) {
2754 CALL_PolygonOffset(ctx
->Exec
, (factor
, units
));
2759 static void GLAPIENTRY
2760 save_PolygonOffsetEXT(GLfloat factor
, GLfloat bias
)
2762 GET_CURRENT_CONTEXT(ctx
);
2763 /* XXX mult by DepthMaxF here??? */
2764 save_PolygonOffset(factor
, ctx
->DrawBuffer
->_DepthMaxF
* bias
);
2768 static void GLAPIENTRY
2769 save_PopAttrib(void)
2771 GET_CURRENT_CONTEXT(ctx
);
2772 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2773 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_POP_ATTRIB
, 0);
2774 if (ctx
->ExecuteFlag
) {
2775 CALL_PopAttrib(ctx
->Exec
, ());
2780 static void GLAPIENTRY
2781 save_PopMatrix(void)
2783 GET_CURRENT_CONTEXT(ctx
);
2784 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2785 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_POP_MATRIX
, 0);
2786 if (ctx
->ExecuteFlag
) {
2787 CALL_PopMatrix(ctx
->Exec
, ());
2792 static void GLAPIENTRY
2795 GET_CURRENT_CONTEXT(ctx
);
2796 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2797 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_POP_NAME
, 0);
2798 if (ctx
->ExecuteFlag
) {
2799 CALL_PopName(ctx
->Exec
, ());
2804 static void GLAPIENTRY
2805 save_PrioritizeTextures(GLsizei num
, const GLuint
* textures
,
2806 const GLclampf
* priorities
)
2808 GET_CURRENT_CONTEXT(ctx
);
2810 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2812 for (i
= 0; i
< num
; i
++) {
2814 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PRIORITIZE_TEXTURE
, 2);
2816 n
[1].ui
= textures
[i
];
2817 n
[2].f
= priorities
[i
];
2820 if (ctx
->ExecuteFlag
) {
2821 CALL_PrioritizeTextures(ctx
->Exec
, (num
, textures
, priorities
));
2826 static void GLAPIENTRY
2827 save_PushAttrib(GLbitfield mask
)
2829 GET_CURRENT_CONTEXT(ctx
);
2831 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2832 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PUSH_ATTRIB
, 1);
2836 if (ctx
->ExecuteFlag
) {
2837 CALL_PushAttrib(ctx
->Exec
, (mask
));
2842 static void GLAPIENTRY
2843 save_PushMatrix(void)
2845 GET_CURRENT_CONTEXT(ctx
);
2846 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2847 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_PUSH_MATRIX
, 0);
2848 if (ctx
->ExecuteFlag
) {
2849 CALL_PushMatrix(ctx
->Exec
, ());
2854 static void GLAPIENTRY
2855 save_PushName(GLuint name
)
2857 GET_CURRENT_CONTEXT(ctx
);
2859 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2860 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PUSH_NAME
, 1);
2864 if (ctx
->ExecuteFlag
) {
2865 CALL_PushName(ctx
->Exec
, (name
));
2870 static void GLAPIENTRY
2871 save_RasterPos4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
2873 GET_CURRENT_CONTEXT(ctx
);
2875 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2876 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_RASTER_POS
, 4);
2883 if (ctx
->ExecuteFlag
) {
2884 CALL_RasterPos4f(ctx
->Exec
, (x
, y
, z
, w
));
2888 static void GLAPIENTRY
2889 save_RasterPos2d(GLdouble x
, GLdouble y
)
2891 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
2894 static void GLAPIENTRY
2895 save_RasterPos2f(GLfloat x
, GLfloat y
)
2897 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2900 static void GLAPIENTRY
2901 save_RasterPos2i(GLint x
, GLint y
)
2903 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
2906 static void GLAPIENTRY
2907 save_RasterPos2s(GLshort x
, GLshort y
)
2909 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2912 static void GLAPIENTRY
2913 save_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
2915 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
2918 static void GLAPIENTRY
2919 save_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
2921 save_RasterPos4f(x
, y
, z
, 1.0F
);
2924 static void GLAPIENTRY
2925 save_RasterPos3i(GLint x
, GLint y
, GLint z
)
2927 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
2930 static void GLAPIENTRY
2931 save_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
2933 save_RasterPos4f(x
, y
, z
, 1.0F
);
2936 static void GLAPIENTRY
2937 save_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
2939 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
2942 static void GLAPIENTRY
2943 save_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
2945 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
2948 static void GLAPIENTRY
2949 save_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
2951 save_RasterPos4f(x
, y
, z
, w
);
2954 static void GLAPIENTRY
2955 save_RasterPos2dv(const GLdouble
* v
)
2957 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
2960 static void GLAPIENTRY
2961 save_RasterPos2fv(const GLfloat
* v
)
2963 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2966 static void GLAPIENTRY
2967 save_RasterPos2iv(const GLint
* v
)
2969 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
2972 static void GLAPIENTRY
2973 save_RasterPos2sv(const GLshort
* v
)
2975 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2978 static void GLAPIENTRY
2979 save_RasterPos3dv(const GLdouble
* v
)
2981 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
2984 static void GLAPIENTRY
2985 save_RasterPos3fv(const GLfloat
* v
)
2987 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2990 static void GLAPIENTRY
2991 save_RasterPos3iv(const GLint
* v
)
2993 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
2996 static void GLAPIENTRY
2997 save_RasterPos3sv(const GLshort
* v
)
2999 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3002 static void GLAPIENTRY
3003 save_RasterPos4dv(const GLdouble
* v
)
3005 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3006 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3009 static void GLAPIENTRY
3010 save_RasterPos4fv(const GLfloat
* v
)
3012 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3015 static void GLAPIENTRY
3016 save_RasterPos4iv(const GLint
* v
)
3018 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3019 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3022 static void GLAPIENTRY
3023 save_RasterPos4sv(const GLshort
* v
)
3025 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3029 static void GLAPIENTRY
3030 save_PassThrough(GLfloat token
)
3032 GET_CURRENT_CONTEXT(ctx
);
3034 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3035 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PASSTHROUGH
, 1);
3039 if (ctx
->ExecuteFlag
) {
3040 CALL_PassThrough(ctx
->Exec
, (token
));
3045 static void GLAPIENTRY
3046 save_ReadBuffer(GLenum mode
)
3048 GET_CURRENT_CONTEXT(ctx
);
3050 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3051 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_READ_BUFFER
, 1);
3055 if (ctx
->ExecuteFlag
) {
3056 CALL_ReadBuffer(ctx
->Exec
, (mode
));
3061 static void GLAPIENTRY
3062 save_ResetHistogram(GLenum target
)
3064 GET_CURRENT_CONTEXT(ctx
);
3066 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3067 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_RESET_HISTOGRAM
, 1);
3071 if (ctx
->ExecuteFlag
) {
3072 CALL_ResetHistogram(ctx
->Exec
, (target
));
3077 static void GLAPIENTRY
3078 save_ResetMinmax(GLenum target
)
3080 GET_CURRENT_CONTEXT(ctx
);
3082 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3083 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_RESET_MIN_MAX
, 1);
3087 if (ctx
->ExecuteFlag
) {
3088 CALL_ResetMinmax(ctx
->Exec
, (target
));
3093 static void GLAPIENTRY
3094 save_Rotatef(GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
3096 GET_CURRENT_CONTEXT(ctx
);
3098 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3099 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ROTATE
, 4);
3106 if (ctx
->ExecuteFlag
) {
3107 CALL_Rotatef(ctx
->Exec
, (angle
, x
, y
, z
));
3112 static void GLAPIENTRY
3113 save_Rotated(GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
3115 save_Rotatef((GLfloat
) angle
, (GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3119 static void GLAPIENTRY
3120 save_Scalef(GLfloat x
, GLfloat y
, GLfloat z
)
3122 GET_CURRENT_CONTEXT(ctx
);
3124 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3125 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SCALE
, 3);
3131 if (ctx
->ExecuteFlag
) {
3132 CALL_Scalef(ctx
->Exec
, (x
, y
, z
));
3137 static void GLAPIENTRY
3138 save_Scaled(GLdouble x
, GLdouble y
, GLdouble z
)
3140 save_Scalef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3144 static void GLAPIENTRY
3145 save_Scissor(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3147 GET_CURRENT_CONTEXT(ctx
);
3149 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3150 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SCISSOR
, 4);
3157 if (ctx
->ExecuteFlag
) {
3158 CALL_Scissor(ctx
->Exec
, (x
, y
, width
, height
));
3163 static void GLAPIENTRY
3164 save_ShadeModel(GLenum mode
)
3166 GET_CURRENT_CONTEXT(ctx
);
3168 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3169 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SHADE_MODEL
, 1);
3173 if (ctx
->ExecuteFlag
) {
3174 CALL_ShadeModel(ctx
->Exec
, (mode
));
3179 static void GLAPIENTRY
3180 save_StencilFunc(GLenum func
, GLint ref
, GLuint mask
)
3182 GET_CURRENT_CONTEXT(ctx
);
3184 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3185 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_FUNC
, 3);
3191 if (ctx
->ExecuteFlag
) {
3192 CALL_StencilFunc(ctx
->Exec
, (func
, ref
, mask
));
3197 static void GLAPIENTRY
3198 save_StencilMask(GLuint mask
)
3200 GET_CURRENT_CONTEXT(ctx
);
3202 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3203 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_MASK
, 1);
3207 if (ctx
->ExecuteFlag
) {
3208 CALL_StencilMask(ctx
->Exec
, (mask
));
3213 static void GLAPIENTRY
3214 save_StencilOp(GLenum fail
, GLenum zfail
, GLenum zpass
)
3216 GET_CURRENT_CONTEXT(ctx
);
3218 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3219 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_OP
, 3);
3225 if (ctx
->ExecuteFlag
) {
3226 CALL_StencilOp(ctx
->Exec
, (fail
, zfail
, zpass
));
3231 static void GLAPIENTRY
3232 save_StencilFuncSeparate(GLenum face
, GLenum func
, GLint ref
, GLuint mask
)
3234 GET_CURRENT_CONTEXT(ctx
);
3236 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3237 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3244 if (ctx
->ExecuteFlag
) {
3245 CALL_StencilFuncSeparate(ctx
->Exec
, (face
, func
, ref
, mask
));
3250 static void GLAPIENTRY
3251 save_StencilMaskSeparate(GLenum face
, GLuint mask
)
3253 GET_CURRENT_CONTEXT(ctx
);
3255 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3256 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_MASK_SEPARATE
, 2);
3261 if (ctx
->ExecuteFlag
) {
3262 CALL_StencilMaskSeparate(ctx
->Exec
, (face
, mask
));
3267 static void GLAPIENTRY
3268 save_StencilOpSeparate(GLenum face
, GLenum fail
, GLenum zfail
, GLenum zpass
)
3270 GET_CURRENT_CONTEXT(ctx
);
3272 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3273 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_OP_SEPARATE
, 4);
3280 if (ctx
->ExecuteFlag
) {
3281 CALL_StencilOpSeparate(ctx
->Exec
, (face
, fail
, zfail
, zpass
));
3286 static void GLAPIENTRY
3287 save_TexEnvfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3289 GET_CURRENT_CONTEXT(ctx
);
3291 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3292 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEXENV
, 6);
3296 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3304 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
3307 if (ctx
->ExecuteFlag
) {
3308 CALL_TexEnvfv(ctx
->Exec
, (target
, pname
, params
));
3313 static void GLAPIENTRY
3314 save_TexEnvf(GLenum target
, GLenum pname
, GLfloat param
)
3316 save_TexEnvfv(target
, pname
, ¶m
);
3320 static void GLAPIENTRY
3321 save_TexEnvi(GLenum target
, GLenum pname
, GLint param
)
3324 p
[0] = (GLfloat
) param
;
3325 p
[1] = p
[2] = p
[3] = 0.0;
3326 save_TexEnvfv(target
, pname
, p
);
3330 static void GLAPIENTRY
3331 save_TexEnviv(GLenum target
, GLenum pname
, const GLint
* param
)
3334 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3335 p
[0] = INT_TO_FLOAT(param
[0]);
3336 p
[1] = INT_TO_FLOAT(param
[1]);
3337 p
[2] = INT_TO_FLOAT(param
[2]);
3338 p
[3] = INT_TO_FLOAT(param
[3]);
3341 p
[0] = (GLfloat
) param
[0];
3342 p
[1] = p
[2] = p
[3] = 0.0F
;
3344 save_TexEnvfv(target
, pname
, p
);
3348 static void GLAPIENTRY
3349 save_TexGenfv(GLenum coord
, GLenum pname
, const GLfloat
*params
)
3351 GET_CURRENT_CONTEXT(ctx
);
3353 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3354 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEXGEN
, 6);
3363 if (ctx
->ExecuteFlag
) {
3364 CALL_TexGenfv(ctx
->Exec
, (coord
, pname
, params
));
3369 static void GLAPIENTRY
3370 save_TexGeniv(GLenum coord
, GLenum pname
, const GLint
*params
)
3373 p
[0] = (GLfloat
) params
[0];
3374 p
[1] = (GLfloat
) params
[1];
3375 p
[2] = (GLfloat
) params
[2];
3376 p
[3] = (GLfloat
) params
[3];
3377 save_TexGenfv(coord
, pname
, p
);
3381 static void GLAPIENTRY
3382 save_TexGend(GLenum coord
, GLenum pname
, GLdouble param
)
3384 GLfloat p
= (GLfloat
) param
;
3385 save_TexGenfv(coord
, pname
, &p
);
3389 static void GLAPIENTRY
3390 save_TexGendv(GLenum coord
, GLenum pname
, const GLdouble
*params
)
3393 p
[0] = (GLfloat
) params
[0];
3394 p
[1] = (GLfloat
) params
[1];
3395 p
[2] = (GLfloat
) params
[2];
3396 p
[3] = (GLfloat
) params
[3];
3397 save_TexGenfv(coord
, pname
, p
);
3401 static void GLAPIENTRY
3402 save_TexGenf(GLenum coord
, GLenum pname
, GLfloat param
)
3404 save_TexGenfv(coord
, pname
, ¶m
);
3408 static void GLAPIENTRY
3409 save_TexGeni(GLenum coord
, GLenum pname
, GLint param
)
3411 save_TexGeniv(coord
, pname
, ¶m
);
3415 static void GLAPIENTRY
3416 save_TexParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3418 GET_CURRENT_CONTEXT(ctx
);
3420 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3421 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEXPARAMETER
, 6);
3430 if (ctx
->ExecuteFlag
) {
3431 CALL_TexParameterfv(ctx
->Exec
, (target
, pname
, params
));
3436 static void GLAPIENTRY
3437 save_TexParameterf(GLenum target
, GLenum pname
, GLfloat param
)
3439 save_TexParameterfv(target
, pname
, ¶m
);
3443 static void GLAPIENTRY
3444 save_TexParameteri(GLenum target
, GLenum pname
, GLint param
)
3447 fparam
[0] = (GLfloat
) param
;
3448 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
3449 save_TexParameterfv(target
, pname
, fparam
);
3453 static void GLAPIENTRY
3454 save_TexParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
3457 fparam
[0] = (GLfloat
) params
[0];
3458 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
3459 save_TexParameterfv(target
, pname
, fparam
);
3463 static void GLAPIENTRY
3464 save_TexImage1D(GLenum target
,
3465 GLint level
, GLint components
,
3466 GLsizei width
, GLint border
,
3467 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3469 GET_CURRENT_CONTEXT(ctx
);
3470 if (target
== GL_PROXY_TEXTURE_1D
) {
3471 /* don't compile, execute immediately */
3472 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
3473 border
, format
, type
, pixels
));
3476 GLvoid
*image
= unpack_image(1, width
, 1, 1, format
, type
,
3477 pixels
, &ctx
->Unpack
);
3479 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3480 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_IMAGE1D
, 8);
3484 n
[3].i
= components
;
3485 n
[4].i
= (GLint
) width
;
3494 if (ctx
->ExecuteFlag
) {
3495 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
3496 border
, format
, type
, pixels
));
3502 static void GLAPIENTRY
3503 save_TexImage2D(GLenum target
,
3504 GLint level
, GLint components
,
3505 GLsizei width
, GLsizei height
, GLint border
,
3506 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3508 GET_CURRENT_CONTEXT(ctx
);
3509 if (target
== GL_PROXY_TEXTURE_2D
) {
3510 /* don't compile, execute immediately */
3511 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
3512 height
, border
, format
, type
, pixels
));
3515 GLvoid
*image
= unpack_image(2, width
, height
, 1, format
, type
,
3516 pixels
, &ctx
->Unpack
);
3518 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3519 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_IMAGE2D
, 9);
3523 n
[3].i
= components
;
3524 n
[4].i
= (GLint
) width
;
3525 n
[5].i
= (GLint
) height
;
3534 if (ctx
->ExecuteFlag
) {
3535 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
3536 height
, border
, format
, type
, pixels
));
3542 static void GLAPIENTRY
3543 save_TexImage3D(GLenum target
,
3544 GLint level
, GLint internalFormat
,
3545 GLsizei width
, GLsizei height
, GLsizei depth
,
3547 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3549 GET_CURRENT_CONTEXT(ctx
);
3550 if (target
== GL_PROXY_TEXTURE_3D
) {
3551 /* don't compile, execute immediately */
3552 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
3553 height
, depth
, border
, format
, type
,
3558 GLvoid
*image
= unpack_image(3, width
, height
, depth
, format
, type
,
3559 pixels
, &ctx
->Unpack
);
3560 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3561 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_IMAGE3D
, 10);
3565 n
[3].i
= (GLint
) internalFormat
;
3566 n
[4].i
= (GLint
) width
;
3567 n
[5].i
= (GLint
) height
;
3568 n
[6].i
= (GLint
) depth
;
3577 if (ctx
->ExecuteFlag
) {
3578 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
3579 height
, depth
, border
, format
, type
,
3586 static void GLAPIENTRY
3587 save_TexSubImage1D(GLenum target
, GLint level
, GLint xoffset
,
3588 GLsizei width
, GLenum format
, GLenum type
,
3589 const GLvoid
* pixels
)
3591 GET_CURRENT_CONTEXT(ctx
);
3593 GLvoid
*image
= unpack_image(1, width
, 1, 1, format
, type
,
3594 pixels
, &ctx
->Unpack
);
3595 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3596 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_SUB_IMAGE1D
, 7);
3601 n
[4].i
= (GLint
) width
;
3609 if (ctx
->ExecuteFlag
) {
3610 CALL_TexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
, width
,
3611 format
, type
, pixels
));
3616 static void GLAPIENTRY
3617 save_TexSubImage2D(GLenum target
, GLint level
,
3618 GLint xoffset
, GLint yoffset
,
3619 GLsizei width
, GLsizei height
,
3620 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3622 GET_CURRENT_CONTEXT(ctx
);
3624 GLvoid
*image
= unpack_image(2, width
, height
, 1, format
, type
,
3625 pixels
, &ctx
->Unpack
);
3626 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3627 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_SUB_IMAGE2D
, 9);
3633 n
[5].i
= (GLint
) width
;
3634 n
[6].i
= (GLint
) height
;
3642 if (ctx
->ExecuteFlag
) {
3643 CALL_TexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
3644 width
, height
, format
, type
, pixels
));
3649 static void GLAPIENTRY
3650 save_TexSubImage3D(GLenum target
, GLint level
,
3651 GLint xoffset
, GLint yoffset
, GLint zoffset
,
3652 GLsizei width
, GLsizei height
, GLsizei depth
,
3653 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3655 GET_CURRENT_CONTEXT(ctx
);
3657 GLvoid
*image
= unpack_image(3, width
, height
, depth
, format
, type
,
3658 pixels
, &ctx
->Unpack
);
3659 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3660 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_SUB_IMAGE3D
, 11);
3667 n
[6].i
= (GLint
) width
;
3668 n
[7].i
= (GLint
) height
;
3669 n
[8].i
= (GLint
) depth
;
3677 if (ctx
->ExecuteFlag
) {
3678 CALL_TexSubImage3D(ctx
->Exec
, (target
, level
,
3679 xoffset
, yoffset
, zoffset
,
3680 width
, height
, depth
, format
, type
,
3686 static void GLAPIENTRY
3687 save_Translatef(GLfloat x
, GLfloat y
, GLfloat z
)
3689 GET_CURRENT_CONTEXT(ctx
);
3691 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3692 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TRANSLATE
, 3);
3698 if (ctx
->ExecuteFlag
) {
3699 CALL_Translatef(ctx
->Exec
, (x
, y
, z
));
3704 static void GLAPIENTRY
3705 save_Translated(GLdouble x
, GLdouble y
, GLdouble z
)
3707 save_Translatef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3712 static void GLAPIENTRY
3713 save_Viewport(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3715 GET_CURRENT_CONTEXT(ctx
);
3717 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3718 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_VIEWPORT
, 4);
3722 n
[3].i
= (GLint
) width
;
3723 n
[4].i
= (GLint
) height
;
3725 if (ctx
->ExecuteFlag
) {
3726 CALL_Viewport(ctx
->Exec
, (x
, y
, width
, height
));
3731 static void GLAPIENTRY
3732 save_WindowPos4fMESA(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3734 GET_CURRENT_CONTEXT(ctx
);
3736 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3737 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_WINDOW_POS
, 4);
3744 if (ctx
->ExecuteFlag
) {
3745 CALL_WindowPos4fMESA(ctx
->Exec
, (x
, y
, z
, w
));
3749 static void GLAPIENTRY
3750 save_WindowPos2dMESA(GLdouble x
, GLdouble y
)
3752 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3755 static void GLAPIENTRY
3756 save_WindowPos2fMESA(GLfloat x
, GLfloat y
)
3758 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3761 static void GLAPIENTRY
3762 save_WindowPos2iMESA(GLint x
, GLint y
)
3764 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3767 static void GLAPIENTRY
3768 save_WindowPos2sMESA(GLshort x
, GLshort y
)
3770 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3773 static void GLAPIENTRY
3774 save_WindowPos3dMESA(GLdouble x
, GLdouble y
, GLdouble z
)
3776 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3779 static void GLAPIENTRY
3780 save_WindowPos3fMESA(GLfloat x
, GLfloat y
, GLfloat z
)
3782 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3785 static void GLAPIENTRY
3786 save_WindowPos3iMESA(GLint x
, GLint y
, GLint z
)
3788 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3791 static void GLAPIENTRY
3792 save_WindowPos3sMESA(GLshort x
, GLshort y
, GLshort z
)
3794 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3797 static void GLAPIENTRY
3798 save_WindowPos4dMESA(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3800 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3803 static void GLAPIENTRY
3804 save_WindowPos4iMESA(GLint x
, GLint y
, GLint z
, GLint w
)
3806 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3809 static void GLAPIENTRY
3810 save_WindowPos4sMESA(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
3812 save_WindowPos4fMESA(x
, y
, z
, w
);
3815 static void GLAPIENTRY
3816 save_WindowPos2dvMESA(const GLdouble
* v
)
3818 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3821 static void GLAPIENTRY
3822 save_WindowPos2fvMESA(const GLfloat
* v
)
3824 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3827 static void GLAPIENTRY
3828 save_WindowPos2ivMESA(const GLint
* v
)
3830 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3833 static void GLAPIENTRY
3834 save_WindowPos2svMESA(const GLshort
* v
)
3836 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3839 static void GLAPIENTRY
3840 save_WindowPos3dvMESA(const GLdouble
* v
)
3842 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3845 static void GLAPIENTRY
3846 save_WindowPos3fvMESA(const GLfloat
* v
)
3848 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3851 static void GLAPIENTRY
3852 save_WindowPos3ivMESA(const GLint
* v
)
3854 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3857 static void GLAPIENTRY
3858 save_WindowPos3svMESA(const GLshort
* v
)
3860 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3863 static void GLAPIENTRY
3864 save_WindowPos4dvMESA(const GLdouble
* v
)
3866 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
3867 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3870 static void GLAPIENTRY
3871 save_WindowPos4fvMESA(const GLfloat
* v
)
3873 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3876 static void GLAPIENTRY
3877 save_WindowPos4ivMESA(const GLint
* v
)
3879 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
3880 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3883 static void GLAPIENTRY
3884 save_WindowPos4svMESA(const GLshort
* v
)
3886 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3891 /* GL_ARB_multitexture */
3892 static void GLAPIENTRY
3893 save_ActiveTextureARB(GLenum target
)
3895 GET_CURRENT_CONTEXT(ctx
);
3897 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3898 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ACTIVE_TEXTURE
, 1);
3902 if (ctx
->ExecuteFlag
) {
3903 CALL_ActiveTextureARB(ctx
->Exec
, (target
));
3908 /* GL_ARB_transpose_matrix */
3910 static void GLAPIENTRY
3911 save_LoadTransposeMatrixdARB(const GLdouble m
[16])
3914 _math_transposefd(tm
, m
);
3915 save_LoadMatrixf(tm
);
3919 static void GLAPIENTRY
3920 save_LoadTransposeMatrixfARB(const GLfloat m
[16])
3923 _math_transposef(tm
, m
);
3924 save_LoadMatrixf(tm
);
3928 static void GLAPIENTRY
3929 save_MultTransposeMatrixdARB(const GLdouble m
[16])
3932 _math_transposefd(tm
, m
);
3933 save_MultMatrixf(tm
);
3937 static void GLAPIENTRY
3938 save_MultTransposeMatrixfARB(const GLfloat m
[16])
3941 _math_transposef(tm
, m
);
3942 save_MultMatrixf(tm
);
3946 /* GL_ARB_texture_compression */
3947 static void GLAPIENTRY
3948 save_CompressedTexImage1DARB(GLenum target
, GLint level
,
3949 GLenum internalFormat
, GLsizei width
,
3950 GLint border
, GLsizei imageSize
,
3951 const GLvoid
* data
)
3953 GET_CURRENT_CONTEXT(ctx
);
3954 if (target
== GL_PROXY_TEXTURE_1D
) {
3955 /* don't compile, execute immediately */
3956 CALL_CompressedTexImage1DARB(ctx
->Exec
, (target
, level
, internalFormat
,
3957 width
, border
, imageSize
,
3963 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3964 /* make copy of image */
3965 image
= _mesa_malloc(imageSize
);
3967 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage1DARB");
3970 MEMCPY(image
, data
, imageSize
);
3971 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_1D
, 7);
3975 n
[3].e
= internalFormat
;
3976 n
[4].i
= (GLint
) width
;
3984 if (ctx
->ExecuteFlag
) {
3985 CALL_CompressedTexImage1DARB(ctx
->Exec
,
3986 (target
, level
, internalFormat
, width
,
3987 border
, imageSize
, data
));
3993 static void GLAPIENTRY
3994 save_CompressedTexImage2DARB(GLenum target
, GLint level
,
3995 GLenum internalFormat
, GLsizei width
,
3996 GLsizei height
, GLint border
, GLsizei imageSize
,
3997 const GLvoid
* data
)
3999 GET_CURRENT_CONTEXT(ctx
);
4000 if (target
== GL_PROXY_TEXTURE_2D
) {
4001 /* don't compile, execute immediately */
4002 CALL_CompressedTexImage2DARB(ctx
->Exec
, (target
, level
, internalFormat
,
4003 width
, height
, border
,
4009 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4010 /* make copy of image */
4011 image
= _mesa_malloc(imageSize
);
4013 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage2DARB");
4016 MEMCPY(image
, data
, imageSize
);
4017 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_2D
, 8);
4021 n
[3].e
= internalFormat
;
4022 n
[4].i
= (GLint
) width
;
4023 n
[5].i
= (GLint
) height
;
4031 if (ctx
->ExecuteFlag
) {
4032 CALL_CompressedTexImage2DARB(ctx
->Exec
,
4033 (target
, level
, internalFormat
, width
,
4034 height
, border
, imageSize
, data
));
4040 static void GLAPIENTRY
4041 save_CompressedTexImage3DARB(GLenum target
, GLint level
,
4042 GLenum internalFormat
, GLsizei width
,
4043 GLsizei height
, GLsizei depth
, GLint border
,
4044 GLsizei imageSize
, const GLvoid
* data
)
4046 GET_CURRENT_CONTEXT(ctx
);
4047 if (target
== GL_PROXY_TEXTURE_3D
) {
4048 /* don't compile, execute immediately */
4049 CALL_CompressedTexImage3DARB(ctx
->Exec
, (target
, level
, internalFormat
,
4050 width
, height
, depth
, border
,
4056 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4057 /* make copy of image */
4058 image
= _mesa_malloc(imageSize
);
4060 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage3DARB");
4063 MEMCPY(image
, data
, imageSize
);
4064 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_3D
, 9);
4068 n
[3].e
= internalFormat
;
4069 n
[4].i
= (GLint
) width
;
4070 n
[5].i
= (GLint
) height
;
4071 n
[6].i
= (GLint
) depth
;
4079 if (ctx
->ExecuteFlag
) {
4080 CALL_CompressedTexImage3DARB(ctx
->Exec
,
4081 (target
, level
, internalFormat
, width
,
4082 height
, depth
, border
, imageSize
,
4089 static void GLAPIENTRY
4090 save_CompressedTexSubImage1DARB(GLenum target
, GLint level
, GLint xoffset
,
4091 GLsizei width
, GLenum format
,
4092 GLsizei imageSize
, const GLvoid
* data
)
4097 GET_CURRENT_CONTEXT(ctx
);
4098 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4100 /* make copy of image */
4101 image
= _mesa_malloc(imageSize
);
4103 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage1DARB");
4106 MEMCPY(image
, data
, imageSize
);
4107 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
, 7);
4112 n
[4].i
= (GLint
) width
;
4120 if (ctx
->ExecuteFlag
) {
4121 CALL_CompressedTexSubImage1DARB(ctx
->Exec
, (target
, level
, xoffset
,
4122 width
, format
, imageSize
,
4128 static void GLAPIENTRY
4129 save_CompressedTexSubImage2DARB(GLenum target
, GLint level
, GLint xoffset
,
4130 GLint yoffset
, GLsizei width
, GLsizei height
,
4131 GLenum format
, GLsizei imageSize
,
4132 const GLvoid
* data
)
4137 GET_CURRENT_CONTEXT(ctx
);
4138 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4140 /* make copy of image */
4141 image
= _mesa_malloc(imageSize
);
4143 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage2DARB");
4146 MEMCPY(image
, data
, imageSize
);
4147 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
, 9);
4153 n
[5].i
= (GLint
) width
;
4154 n
[6].i
= (GLint
) height
;
4162 if (ctx
->ExecuteFlag
) {
4163 CALL_CompressedTexSubImage2DARB(ctx
->Exec
,
4164 (target
, level
, xoffset
, yoffset
, width
,
4165 height
, format
, imageSize
, data
));
4170 static void GLAPIENTRY
4171 save_CompressedTexSubImage3DARB(GLenum target
, GLint level
, GLint xoffset
,
4172 GLint yoffset
, GLint zoffset
, GLsizei width
,
4173 GLsizei height
, GLsizei depth
, GLenum format
,
4174 GLsizei imageSize
, const GLvoid
* data
)
4179 GET_CURRENT_CONTEXT(ctx
);
4180 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4182 /* make copy of image */
4183 image
= _mesa_malloc(imageSize
);
4185 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage3DARB");
4188 MEMCPY(image
, data
, imageSize
);
4189 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
, 11);
4196 n
[6].i
= (GLint
) width
;
4197 n
[7].i
= (GLint
) height
;
4198 n
[8].i
= (GLint
) depth
;
4200 n
[10].i
= imageSize
;
4206 if (ctx
->ExecuteFlag
) {
4207 CALL_CompressedTexSubImage3DARB(ctx
->Exec
,
4208 (target
, level
, xoffset
, yoffset
,
4209 zoffset
, width
, height
, depth
, format
,
4215 /* GL_ARB_multisample */
4216 static void GLAPIENTRY
4217 save_SampleCoverageARB(GLclampf value
, GLboolean invert
)
4219 GET_CURRENT_CONTEXT(ctx
);
4221 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4222 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SAMPLE_COVERAGE
, 2);
4227 if (ctx
->ExecuteFlag
) {
4228 CALL_SampleCoverageARB(ctx
->Exec
, (value
, invert
));
4234 * GL_NV_vertex_program
4236 #if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
4237 static void GLAPIENTRY
4238 save_BindProgramNV(GLenum target
, GLuint id
)
4240 GET_CURRENT_CONTEXT(ctx
);
4242 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4243 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BIND_PROGRAM_NV
, 2);
4248 if (ctx
->ExecuteFlag
) {
4249 CALL_BindProgramNV(ctx
->Exec
, (target
, id
));
4253 static void GLAPIENTRY
4254 save_ProgramEnvParameter4fARB(GLenum target
, GLuint index
,
4255 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4257 GET_CURRENT_CONTEXT(ctx
);
4259 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4260 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4269 if (ctx
->ExecuteFlag
) {
4270 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4275 static void GLAPIENTRY
4276 save_ProgramEnvParameter4fvARB(GLenum target
, GLuint index
,
4277 const GLfloat
*params
)
4279 save_ProgramEnvParameter4fARB(target
, index
, params
[0], params
[1],
4280 params
[2], params
[3]);
4284 static void GLAPIENTRY
4285 save_ProgramEnvParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4286 const GLfloat
* params
)
4288 GET_CURRENT_CONTEXT(ctx
);
4290 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4294 const GLfloat
* p
= params
;
4296 for (i
= 0 ; i
< count
; i
++) {
4297 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4310 if (ctx
->ExecuteFlag
) {
4311 CALL_ProgramEnvParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4316 static void GLAPIENTRY
4317 save_ProgramEnvParameter4dARB(GLenum target
, GLuint index
,
4318 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4320 save_ProgramEnvParameter4fARB(target
, index
,
4322 (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4326 static void GLAPIENTRY
4327 save_ProgramEnvParameter4dvARB(GLenum target
, GLuint index
,
4328 const GLdouble
*params
)
4330 save_ProgramEnvParameter4fARB(target
, index
,
4331 (GLfloat
) params
[0],
4332 (GLfloat
) params
[1],
4333 (GLfloat
) params
[2], (GLfloat
) params
[3]);
4336 #endif /* FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program || FEATURE_NV_vertex_program */
4338 #if FEATURE_NV_vertex_program
4339 static void GLAPIENTRY
4340 save_ExecuteProgramNV(GLenum target
, GLuint id
, const GLfloat
*params
)
4342 GET_CURRENT_CONTEXT(ctx
);
4344 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4345 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EXECUTE_PROGRAM_NV
, 6);
4354 if (ctx
->ExecuteFlag
) {
4355 CALL_ExecuteProgramNV(ctx
->Exec
, (target
, id
, params
));
4360 static void GLAPIENTRY
4361 save_ProgramParameters4dvNV(GLenum target
, GLuint index
,
4362 GLuint num
, const GLdouble
*params
)
4365 for (i
= 0; i
< num
; i
++) {
4366 save_ProgramEnvParameter4dvARB(target
, index
+ i
, params
+ 4 * i
);
4371 static void GLAPIENTRY
4372 save_ProgramParameters4fvNV(GLenum target
, GLuint index
,
4373 GLuint num
, const GLfloat
*params
)
4376 for (i
= 0; i
< num
; i
++) {
4377 save_ProgramEnvParameter4fvARB(target
, index
+ i
, params
+ 4 * i
);
4382 static void GLAPIENTRY
4383 save_LoadProgramNV(GLenum target
, GLuint id
, GLsizei len
,
4384 const GLubyte
* program
)
4386 GET_CURRENT_CONTEXT(ctx
);
4388 GLubyte
*programCopy
;
4390 programCopy
= (GLubyte
*) _mesa_malloc(len
);
4392 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glLoadProgramNV");
4395 _mesa_memcpy(programCopy
, program
, len
);
4397 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4398 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LOAD_PROGRAM_NV
, 4);
4403 n
[4].data
= programCopy
;
4405 if (ctx
->ExecuteFlag
) {
4406 CALL_LoadProgramNV(ctx
->Exec
, (target
, id
, len
, program
));
4411 static void GLAPIENTRY
4412 save_RequestResidentProgramsNV(GLsizei num
, const GLuint
* ids
)
4414 GET_CURRENT_CONTEXT(ctx
);
4416 GLuint
*idCopy
= (GLuint
*) _mesa_malloc(num
* sizeof(GLuint
));
4418 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glRequestResidentProgramsNV");
4421 _mesa_memcpy(idCopy
, ids
, num
* sizeof(GLuint
));
4422 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4423 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TRACK_MATRIX_NV
, 2);
4428 if (ctx
->ExecuteFlag
) {
4429 CALL_RequestResidentProgramsNV(ctx
->Exec
, (num
, ids
));
4434 static void GLAPIENTRY
4435 save_TrackMatrixNV(GLenum target
, GLuint address
,
4436 GLenum matrix
, GLenum transform
)
4438 GET_CURRENT_CONTEXT(ctx
);
4440 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4441 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TRACK_MATRIX_NV
, 4);
4448 if (ctx
->ExecuteFlag
) {
4449 CALL_TrackMatrixNV(ctx
->Exec
, (target
, address
, matrix
, transform
));
4452 #endif /* FEATURE_NV_vertex_program */
4456 * GL_NV_fragment_program
4458 #if FEATURE_NV_fragment_program
4459 static void GLAPIENTRY
4460 save_ProgramLocalParameter4fARB(GLenum target
, GLuint index
,
4461 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4463 GET_CURRENT_CONTEXT(ctx
);
4465 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4466 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4475 if (ctx
->ExecuteFlag
) {
4476 CALL_ProgramLocalParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4481 static void GLAPIENTRY
4482 save_ProgramLocalParameter4fvARB(GLenum target
, GLuint index
,
4483 const GLfloat
*params
)
4485 GET_CURRENT_CONTEXT(ctx
);
4487 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4488 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4497 if (ctx
->ExecuteFlag
) {
4498 CALL_ProgramLocalParameter4fvARB(ctx
->Exec
, (target
, index
, params
));
4503 static void GLAPIENTRY
4504 save_ProgramLocalParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4505 const GLfloat
*params
)
4507 GET_CURRENT_CONTEXT(ctx
);
4509 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4513 const GLfloat
* p
= params
;
4515 for (i
= 0 ; i
< count
; i
++) {
4516 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4529 if (ctx
->ExecuteFlag
) {
4530 CALL_ProgramLocalParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4535 static void GLAPIENTRY
4536 save_ProgramLocalParameter4dARB(GLenum target
, GLuint index
,
4537 GLdouble x
, GLdouble y
,
4538 GLdouble z
, GLdouble w
)
4540 GET_CURRENT_CONTEXT(ctx
);
4542 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4543 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4547 n
[3].f
= (GLfloat
) x
;
4548 n
[4].f
= (GLfloat
) y
;
4549 n
[5].f
= (GLfloat
) z
;
4550 n
[6].f
= (GLfloat
) w
;
4552 if (ctx
->ExecuteFlag
) {
4553 CALL_ProgramLocalParameter4dARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4558 static void GLAPIENTRY
4559 save_ProgramLocalParameter4dvARB(GLenum target
, GLuint index
,
4560 const GLdouble
*params
)
4562 GET_CURRENT_CONTEXT(ctx
);
4564 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4565 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4569 n
[3].f
= (GLfloat
) params
[0];
4570 n
[4].f
= (GLfloat
) params
[1];
4571 n
[5].f
= (GLfloat
) params
[2];
4572 n
[6].f
= (GLfloat
) params
[3];
4574 if (ctx
->ExecuteFlag
) {
4575 CALL_ProgramLocalParameter4dvARB(ctx
->Exec
, (target
, index
, params
));
4579 static void GLAPIENTRY
4580 save_ProgramNamedParameter4fNV(GLuint id
, GLsizei len
, const GLubyte
* name
,
4581 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4583 GET_CURRENT_CONTEXT(ctx
);
4585 GLubyte
*nameCopy
= (GLubyte
*) _mesa_malloc(len
);
4587 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramNamedParameter4fNV");
4590 _mesa_memcpy(nameCopy
, name
, len
);
4592 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4593 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_NAMED_PARAMETER_NV
, 6);
4597 n
[3].data
= nameCopy
;
4603 if (ctx
->ExecuteFlag
) {
4604 CALL_ProgramNamedParameter4fNV(ctx
->Exec
, (id
, len
, name
, x
, y
, z
, w
));
4609 static void GLAPIENTRY
4610 save_ProgramNamedParameter4fvNV(GLuint id
, GLsizei len
, const GLubyte
* name
,
4613 save_ProgramNamedParameter4fNV(id
, len
, name
, v
[0], v
[1], v
[2], v
[3]);
4617 static void GLAPIENTRY
4618 save_ProgramNamedParameter4dNV(GLuint id
, GLsizei len
, const GLubyte
* name
,
4619 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4621 save_ProgramNamedParameter4fNV(id
, len
, name
, (GLfloat
) x
, (GLfloat
) y
,
4622 (GLfloat
) z
, (GLfloat
) w
);
4626 static void GLAPIENTRY
4627 save_ProgramNamedParameter4dvNV(GLuint id
, GLsizei len
, const GLubyte
* name
,
4630 save_ProgramNamedParameter4fNV(id
, len
, name
, (GLfloat
) v
[0],
4631 (GLfloat
) v
[1], (GLfloat
) v
[2],
4635 #endif /* FEATURE_NV_fragment_program */
4639 /* GL_EXT_stencil_two_side */
4640 static void GLAPIENTRY
4641 save_ActiveStencilFaceEXT(GLenum face
)
4643 GET_CURRENT_CONTEXT(ctx
);
4645 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4646 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ACTIVE_STENCIL_FACE_EXT
, 1);
4650 if (ctx
->ExecuteFlag
) {
4651 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (face
));
4656 /* GL_EXT_depth_bounds_test */
4657 static void GLAPIENTRY
4658 save_DepthBoundsEXT(GLclampd zmin
, GLclampd zmax
)
4660 GET_CURRENT_CONTEXT(ctx
);
4662 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4663 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DEPTH_BOUNDS_EXT
, 2);
4665 n
[1].f
= (GLfloat
) zmin
;
4666 n
[2].f
= (GLfloat
) zmax
;
4668 if (ctx
->ExecuteFlag
) {
4669 CALL_DepthBoundsEXT(ctx
->Exec
, (zmin
, zmax
));
4675 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
4677 static void GLAPIENTRY
4678 save_ProgramStringARB(GLenum target
, GLenum format
, GLsizei len
,
4679 const GLvoid
* string
)
4681 GET_CURRENT_CONTEXT(ctx
);
4683 GLubyte
*programCopy
;
4685 programCopy
= (GLubyte
*) _mesa_malloc(len
);
4687 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramStringARB");
4690 _mesa_memcpy(programCopy
, string
, len
);
4692 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4693 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_STRING_ARB
, 4);
4698 n
[4].data
= programCopy
;
4700 if (ctx
->ExecuteFlag
) {
4701 CALL_ProgramStringARB(ctx
->Exec
, (target
, format
, len
, string
));
4705 #endif /* FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program */
4708 #if FEATURE_ARB_occlusion_query
4710 static void GLAPIENTRY
4711 save_BeginQueryARB(GLenum target
, GLuint id
)
4713 GET_CURRENT_CONTEXT(ctx
);
4715 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4716 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BEGIN_QUERY_ARB
, 2);
4721 if (ctx
->ExecuteFlag
) {
4722 CALL_BeginQueryARB(ctx
->Exec
, (target
, id
));
4727 static void GLAPIENTRY
4728 save_EndQueryARB(GLenum target
)
4730 GET_CURRENT_CONTEXT(ctx
);
4732 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4733 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_END_QUERY_ARB
, 1);
4737 if (ctx
->ExecuteFlag
) {
4738 CALL_EndQueryARB(ctx
->Exec
, (target
));
4742 #endif /* FEATURE_ARB_occlusion_query */
4745 static void GLAPIENTRY
4746 save_DrawBuffersARB(GLsizei count
, const GLenum
* buffers
)
4748 GET_CURRENT_CONTEXT(ctx
);
4750 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4751 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DRAW_BUFFERS_ARB
, 1 + MAX_DRAW_BUFFERS
);
4755 if (count
> MAX_DRAW_BUFFERS
)
4756 count
= MAX_DRAW_BUFFERS
;
4757 for (i
= 0; i
< count
; i
++) {
4758 n
[2 + i
].e
= buffers
[i
];
4761 if (ctx
->ExecuteFlag
) {
4762 CALL_DrawBuffersARB(ctx
->Exec
, (count
, buffers
));
4766 #if FEATURE_ATI_fragment_shader
4767 static void GLAPIENTRY
4768 save_BindFragmentShaderATI(GLuint id
)
4770 GET_CURRENT_CONTEXT(ctx
);
4773 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BIND_FRAGMENT_SHADER_ATI
, 1);
4777 if (ctx
->ExecuteFlag
) {
4778 CALL_BindFragmentShaderATI(ctx
->Exec
, (id
));
4782 static void GLAPIENTRY
4783 save_SetFragmentShaderConstantATI(GLuint dst
, const GLfloat
*value
)
4785 GET_CURRENT_CONTEXT(ctx
);
4788 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
, 5);
4796 if (ctx
->ExecuteFlag
) {
4797 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, value
));
4803 save_Attr1fNV(GLenum attr
, GLfloat x
)
4805 GET_CURRENT_CONTEXT(ctx
);
4807 SAVE_FLUSH_VERTICES(ctx
);
4808 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_1F_NV
, 2);
4814 ASSERT(attr
< MAX_VERTEX_PROGRAM_ATTRIBS
);
4815 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
4816 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
4818 if (ctx
->ExecuteFlag
) {
4819 CALL_VertexAttrib1fNV(ctx
->Exec
, (attr
, x
));
4824 save_Attr2fNV(GLenum attr
, GLfloat x
, GLfloat y
)
4826 GET_CURRENT_CONTEXT(ctx
);
4828 SAVE_FLUSH_VERTICES(ctx
);
4829 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_2F_NV
, 3);
4836 ASSERT(attr
< MAX_VERTEX_PROGRAM_ATTRIBS
);
4837 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
4838 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
4840 if (ctx
->ExecuteFlag
) {
4841 CALL_VertexAttrib2fNV(ctx
->Exec
, (attr
, x
, y
));
4846 save_Attr3fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
4848 GET_CURRENT_CONTEXT(ctx
);
4850 SAVE_FLUSH_VERTICES(ctx
);
4851 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_3F_NV
, 4);
4859 ASSERT(attr
< MAX_VERTEX_PROGRAM_ATTRIBS
);
4860 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
4861 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
4863 if (ctx
->ExecuteFlag
) {
4864 CALL_VertexAttrib3fNV(ctx
->Exec
, (attr
, x
, y
, z
));
4869 save_Attr4fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4871 GET_CURRENT_CONTEXT(ctx
);
4873 SAVE_FLUSH_VERTICES(ctx
);
4874 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_4F_NV
, 5);
4883 ASSERT(attr
< MAX_VERTEX_PROGRAM_ATTRIBS
);
4884 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
4885 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
4887 if (ctx
->ExecuteFlag
) {
4888 CALL_VertexAttrib4fNV(ctx
->Exec
, (attr
, x
, y
, z
, w
));
4894 save_Attr1fARB(GLenum attr
, GLfloat x
)
4896 GET_CURRENT_CONTEXT(ctx
);
4898 SAVE_FLUSH_VERTICES(ctx
);
4899 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_1F_ARB
, 2);
4905 ASSERT(attr
< MAX_VERTEX_ATTRIBS
);
4906 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
4907 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
4909 if (ctx
->ExecuteFlag
) {
4910 CALL_VertexAttrib1fARB(ctx
->Exec
, (attr
, x
));
4915 save_Attr2fARB(GLenum attr
, GLfloat x
, GLfloat y
)
4917 GET_CURRENT_CONTEXT(ctx
);
4919 SAVE_FLUSH_VERTICES(ctx
);
4920 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_2F_ARB
, 3);
4927 ASSERT(attr
< MAX_VERTEX_ATTRIBS
);
4928 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
4929 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
4931 if (ctx
->ExecuteFlag
) {
4932 CALL_VertexAttrib2fARB(ctx
->Exec
, (attr
, x
, y
));
4937 save_Attr3fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
4939 GET_CURRENT_CONTEXT(ctx
);
4941 SAVE_FLUSH_VERTICES(ctx
);
4942 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_3F_ARB
, 4);
4950 ASSERT(attr
< MAX_VERTEX_ATTRIBS
);
4951 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
4952 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
4954 if (ctx
->ExecuteFlag
) {
4955 CALL_VertexAttrib3fARB(ctx
->Exec
, (attr
, x
, y
, z
));
4960 save_Attr4fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4962 GET_CURRENT_CONTEXT(ctx
);
4964 SAVE_FLUSH_VERTICES(ctx
);
4965 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_4F_ARB
, 5);
4974 ASSERT(attr
< MAX_VERTEX_ATTRIBS
);
4975 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
4976 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
4978 if (ctx
->ExecuteFlag
) {
4979 CALL_VertexAttrib4fARB(ctx
->Exec
, (attr
, x
, y
, z
, w
));
4984 static void GLAPIENTRY
4985 save_EvalCoord1f(GLfloat x
)
4987 GET_CURRENT_CONTEXT(ctx
);
4989 SAVE_FLUSH_VERTICES(ctx
);
4990 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVAL_C1
, 1);
4994 if (ctx
->ExecuteFlag
) {
4995 CALL_EvalCoord1f(ctx
->Exec
, (x
));
4999 static void GLAPIENTRY
5000 save_EvalCoord1fv(const GLfloat
* v
)
5002 save_EvalCoord1f(v
[0]);
5005 static void GLAPIENTRY
5006 save_EvalCoord2f(GLfloat x
, GLfloat y
)
5008 GET_CURRENT_CONTEXT(ctx
);
5010 SAVE_FLUSH_VERTICES(ctx
);
5011 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVAL_C2
, 2);
5016 if (ctx
->ExecuteFlag
) {
5017 CALL_EvalCoord2f(ctx
->Exec
, (x
, y
));
5021 static void GLAPIENTRY
5022 save_EvalCoord2fv(const GLfloat
* v
)
5024 save_EvalCoord2f(v
[0], v
[1]);
5028 static void GLAPIENTRY
5029 save_EvalPoint1(GLint x
)
5031 GET_CURRENT_CONTEXT(ctx
);
5033 SAVE_FLUSH_VERTICES(ctx
);
5034 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVAL_P1
, 1);
5038 if (ctx
->ExecuteFlag
) {
5039 CALL_EvalPoint1(ctx
->Exec
, (x
));
5043 static void GLAPIENTRY
5044 save_EvalPoint2(GLint x
, GLint y
)
5046 GET_CURRENT_CONTEXT(ctx
);
5048 SAVE_FLUSH_VERTICES(ctx
);
5049 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVAL_P2
, 2);
5054 if (ctx
->ExecuteFlag
) {
5055 CALL_EvalPoint2(ctx
->Exec
, (x
, y
));
5059 static void GLAPIENTRY
5060 save_Indexf(GLfloat x
)
5062 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, x
);
5065 static void GLAPIENTRY
5066 save_Indexfv(const GLfloat
* v
)
5068 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, v
[0]);
5071 static void GLAPIENTRY
5072 save_EdgeFlag(GLboolean x
)
5074 save_Attr1fNV(VERT_ATTRIB_EDGEFLAG
, x
? 1.0 : 0.0);
5077 static void GLAPIENTRY
5078 save_Materialfv(GLenum face
, GLenum pname
, const GLfloat
* param
)
5080 GET_CURRENT_CONTEXT(ctx
);
5084 SAVE_FLUSH_VERTICES(ctx
);
5089 case GL_FRONT_AND_BACK
:
5092 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "material(face)");
5101 case GL_AMBIENT_AND_DIFFUSE
:
5107 case GL_COLOR_INDEXES
:
5111 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "material(pname)");
5115 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MATERIAL
, 6);
5119 for (i
= 0; i
< args
; i
++)
5120 n
[3 + i
].f
= param
[i
];
5124 GLuint bitmask
= _mesa_material_bitmask(ctx
, face
, pname
, ~0, NULL
);
5125 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++)
5126 if (bitmask
& (1 << i
)) {
5127 ctx
->ListState
.ActiveMaterialSize
[i
] = args
;
5128 COPY_SZ_4V(ctx
->ListState
.CurrentMaterial
[i
], args
, param
);
5132 if (ctx
->ExecuteFlag
) {
5133 CALL_Materialfv(ctx
->Exec
, (face
, pname
, param
));
5137 static void GLAPIENTRY
5138 save_Begin(GLenum mode
)
5140 GET_CURRENT_CONTEXT(ctx
);
5142 GLboolean error
= GL_FALSE
;
5144 if ( /*mode < GL_POINTS || */ mode
> GL_POLYGON
) {
5145 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "Begin (mode)");
5148 else if (ctx
->Driver
.CurrentSavePrimitive
== PRIM_UNKNOWN
) {
5149 /* Typically the first begin. This may raise an error on
5150 * playback, depending on whether CallList is issued from inside
5151 * a begin/end or not.
5153 ctx
->Driver
.CurrentSavePrimitive
= PRIM_INSIDE_UNKNOWN_PRIM
;
5155 else if (ctx
->Driver
.CurrentSavePrimitive
== PRIM_OUTSIDE_BEGIN_END
) {
5156 ctx
->Driver
.CurrentSavePrimitive
= mode
;
5159 _mesa_compile_error(ctx
, GL_INVALID_OPERATION
, "recursive begin");
5164 /* Give the driver an opportunity to hook in an optimized
5165 * display list compiler.
5167 if (ctx
->Driver
.NotifySaveBegin(ctx
, mode
))
5170 SAVE_FLUSH_VERTICES(ctx
);
5171 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BEGIN
, 1);
5177 if (ctx
->ExecuteFlag
) {
5178 CALL_Begin(ctx
->Exec
, (mode
));
5182 static void GLAPIENTRY
5185 GET_CURRENT_CONTEXT(ctx
);
5186 SAVE_FLUSH_VERTICES(ctx
);
5187 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_END
, 0);
5188 ctx
->Driver
.CurrentSavePrimitive
= PRIM_OUTSIDE_BEGIN_END
;
5189 if (ctx
->ExecuteFlag
) {
5190 CALL_End(ctx
->Exec
, ());
5194 static void GLAPIENTRY
5195 save_Rectf(GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
5197 GET_CURRENT_CONTEXT(ctx
);
5199 SAVE_FLUSH_VERTICES(ctx
);
5200 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_RECTF
, 4);
5207 if (ctx
->ExecuteFlag
) {
5208 CALL_Rectf(ctx
->Exec
, (a
, b
, c
, d
));
5213 static void GLAPIENTRY
5214 save_Vertex2f(GLfloat x
, GLfloat y
)
5216 save_Attr2fNV(VERT_ATTRIB_POS
, x
, y
);
5219 static void GLAPIENTRY
5220 save_Vertex2fv(const GLfloat
* v
)
5222 save_Attr2fNV(VERT_ATTRIB_POS
, v
[0], v
[1]);
5225 static void GLAPIENTRY
5226 save_Vertex3f(GLfloat x
, GLfloat y
, GLfloat z
)
5228 save_Attr3fNV(VERT_ATTRIB_POS
, x
, y
, z
);
5231 static void GLAPIENTRY
5232 save_Vertex3fv(const GLfloat
* v
)
5234 save_Attr3fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2]);
5237 static void GLAPIENTRY
5238 save_Vertex4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5240 save_Attr4fNV(VERT_ATTRIB_POS
, x
, y
, z
, w
);
5243 static void GLAPIENTRY
5244 save_Vertex4fv(const GLfloat
* v
)
5246 save_Attr4fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2], v
[3]);
5249 static void GLAPIENTRY
5250 save_TexCoord1f(GLfloat x
)
5252 save_Attr1fNV(VERT_ATTRIB_TEX0
, x
);
5255 static void GLAPIENTRY
5256 save_TexCoord1fv(const GLfloat
* v
)
5258 save_Attr1fNV(VERT_ATTRIB_TEX0
, v
[0]);
5261 static void GLAPIENTRY
5262 save_TexCoord2f(GLfloat x
, GLfloat y
)
5264 save_Attr2fNV(VERT_ATTRIB_TEX0
, x
, y
);
5267 static void GLAPIENTRY
5268 save_TexCoord2fv(const GLfloat
* v
)
5270 save_Attr2fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1]);
5273 static void GLAPIENTRY
5274 save_TexCoord3f(GLfloat x
, GLfloat y
, GLfloat z
)
5276 save_Attr3fNV(VERT_ATTRIB_TEX0
, x
, y
, z
);
5279 static void GLAPIENTRY
5280 save_TexCoord3fv(const GLfloat
* v
)
5282 save_Attr3fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2]);
5285 static void GLAPIENTRY
5286 save_TexCoord4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5288 save_Attr4fNV(VERT_ATTRIB_TEX0
, x
, y
, z
, w
);
5291 static void GLAPIENTRY
5292 save_TexCoord4fv(const GLfloat
* v
)
5294 save_Attr4fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2], v
[3]);
5297 static void GLAPIENTRY
5298 save_Normal3f(GLfloat x
, GLfloat y
, GLfloat z
)
5300 save_Attr3fNV(VERT_ATTRIB_NORMAL
, x
, y
, z
);
5303 static void GLAPIENTRY
5304 save_Normal3fv(const GLfloat
* v
)
5306 save_Attr3fNV(VERT_ATTRIB_NORMAL
, v
[0], v
[1], v
[2]);
5309 static void GLAPIENTRY
5310 save_FogCoordfEXT(GLfloat x
)
5312 save_Attr1fNV(VERT_ATTRIB_FOG
, x
);
5315 static void GLAPIENTRY
5316 save_FogCoordfvEXT(const GLfloat
* v
)
5318 save_Attr1fNV(VERT_ATTRIB_FOG
, v
[0]);
5321 static void GLAPIENTRY
5322 save_Color3f(GLfloat x
, GLfloat y
, GLfloat z
)
5324 save_Attr3fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
);
5327 static void GLAPIENTRY
5328 save_Color3fv(const GLfloat
* v
)
5330 save_Attr3fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2]);
5333 static void GLAPIENTRY
5334 save_Color4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5336 save_Attr4fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
, w
);
5339 static void GLAPIENTRY
5340 save_Color4fv(const GLfloat
* v
)
5342 save_Attr4fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2], v
[3]);
5345 static void GLAPIENTRY
5346 save_SecondaryColor3fEXT(GLfloat x
, GLfloat y
, GLfloat z
)
5348 save_Attr3fNV(VERT_ATTRIB_COLOR1
, x
, y
, z
);
5351 static void GLAPIENTRY
5352 save_SecondaryColor3fvEXT(const GLfloat
* v
)
5354 save_Attr3fNV(VERT_ATTRIB_COLOR1
, v
[0], v
[1], v
[2]);
5358 /* Just call the respective ATTR for texcoord
5360 static void GLAPIENTRY
5361 save_MultiTexCoord1f(GLenum target
, GLfloat x
)
5363 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5364 save_Attr1fNV(attr
, x
);
5367 static void GLAPIENTRY
5368 save_MultiTexCoord1fv(GLenum target
, const GLfloat
* v
)
5370 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5371 save_Attr1fNV(attr
, v
[0]);
5374 static void GLAPIENTRY
5375 save_MultiTexCoord2f(GLenum target
, GLfloat x
, GLfloat y
)
5377 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5378 save_Attr2fNV(attr
, x
, y
);
5381 static void GLAPIENTRY
5382 save_MultiTexCoord2fv(GLenum target
, const GLfloat
* v
)
5384 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5385 save_Attr2fNV(attr
, v
[0], v
[1]);
5388 static void GLAPIENTRY
5389 save_MultiTexCoord3f(GLenum target
, GLfloat x
, GLfloat y
, GLfloat z
)
5391 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5392 save_Attr3fNV(attr
, x
, y
, z
);
5395 static void GLAPIENTRY
5396 save_MultiTexCoord3fv(GLenum target
, const GLfloat
* v
)
5398 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5399 save_Attr3fNV(attr
, v
[0], v
[1], v
[2]);
5402 static void GLAPIENTRY
5403 save_MultiTexCoord4f(GLenum target
, GLfloat x
, GLfloat y
,
5404 GLfloat z
, GLfloat w
)
5406 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5407 save_Attr4fNV(attr
, x
, y
, z
, w
);
5410 static void GLAPIENTRY
5411 save_MultiTexCoord4fv(GLenum target
, const GLfloat
* v
)
5413 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5414 save_Attr4fNV(attr
, v
[0], v
[1], v
[2], v
[3]);
5419 * Record a GL_INVALID_VALUE error when a invalid vertex attribute
5425 GET_CURRENT_CONTEXT(ctx
);
5426 _mesa_error(ctx
, GL_INVALID_VALUE
, "VertexAttribf(index)");
5430 /* First level for NV_vertex_program:
5432 * Check for errors at compile time?.
5434 static void GLAPIENTRY
5435 save_VertexAttrib1fNV(GLuint index
, GLfloat x
)
5437 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5438 save_Attr1fNV(index
, x
);
5443 static void GLAPIENTRY
5444 save_VertexAttrib1fvNV(GLuint index
, const GLfloat
* v
)
5446 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5447 save_Attr1fNV(index
, v
[0]);
5452 static void GLAPIENTRY
5453 save_VertexAttrib2fNV(GLuint index
, GLfloat x
, GLfloat y
)
5455 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5456 save_Attr2fNV(index
, x
, y
);
5461 static void GLAPIENTRY
5462 save_VertexAttrib2fvNV(GLuint index
, const GLfloat
* v
)
5464 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5465 save_Attr2fNV(index
, v
[0], v
[1]);
5470 static void GLAPIENTRY
5471 save_VertexAttrib3fNV(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
5473 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5474 save_Attr3fNV(index
, x
, y
, z
);
5479 static void GLAPIENTRY
5480 save_VertexAttrib3fvNV(GLuint index
, const GLfloat
* v
)
5482 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5483 save_Attr3fNV(index
, v
[0], v
[1], v
[2]);
5488 static void GLAPIENTRY
5489 save_VertexAttrib4fNV(GLuint index
, GLfloat x
, GLfloat y
,
5490 GLfloat z
, GLfloat w
)
5492 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5493 save_Attr4fNV(index
, x
, y
, z
, w
);
5498 static void GLAPIENTRY
5499 save_VertexAttrib4fvNV(GLuint index
, const GLfloat
* v
)
5501 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5502 save_Attr4fNV(index
, v
[0], v
[1], v
[2], v
[3]);
5510 static void GLAPIENTRY
5511 save_VertexAttrib1fARB(GLuint index
, GLfloat x
)
5513 if (index
< MAX_VERTEX_ATTRIBS
)
5514 save_Attr1fARB(index
, x
);
5519 static void GLAPIENTRY
5520 save_VertexAttrib1fvARB(GLuint index
, const GLfloat
* v
)
5522 if (index
< MAX_VERTEX_ATTRIBS
)
5523 save_Attr1fARB(index
, v
[0]);
5528 static void GLAPIENTRY
5529 save_VertexAttrib2fARB(GLuint index
, GLfloat x
, GLfloat y
)
5531 if (index
< MAX_VERTEX_ATTRIBS
)
5532 save_Attr2fARB(index
, x
, y
);
5537 static void GLAPIENTRY
5538 save_VertexAttrib2fvARB(GLuint index
, const GLfloat
* v
)
5540 if (index
< MAX_VERTEX_ATTRIBS
)
5541 save_Attr2fARB(index
, v
[0], v
[1]);
5546 static void GLAPIENTRY
5547 save_VertexAttrib3fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
5549 if (index
< MAX_VERTEX_ATTRIBS
)
5550 save_Attr3fARB(index
, x
, y
, z
);
5555 static void GLAPIENTRY
5556 save_VertexAttrib3fvARB(GLuint index
, const GLfloat
* v
)
5558 if (index
< MAX_VERTEX_ATTRIBS
)
5559 save_Attr3fARB(index
, v
[0], v
[1], v
[2]);
5564 static void GLAPIENTRY
5565 save_VertexAttrib4fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
,
5568 if (index
< MAX_VERTEX_ATTRIBS
)
5569 save_Attr4fARB(index
, x
, y
, z
, w
);
5574 static void GLAPIENTRY
5575 save_VertexAttrib4fvARB(GLuint index
, const GLfloat
* v
)
5577 if (index
< MAX_VERTEX_ATTRIBS
)
5578 save_Attr4fARB(index
, v
[0], v
[1], v
[2], v
[3]);
5584 /* GL_ARB_shader_objects, GL_ARB_vertex/fragment_shader */
5586 static void GLAPIENTRY
5587 exec_BindAttribLocationARB(GLuint program
, GLuint index
, const GLchar
*name
)
5589 GET_CURRENT_CONTEXT(ctx
);
5590 FLUSH_VERTICES(ctx
, 0);
5591 CALL_BindAttribLocationARB(ctx
->Exec
, (program
, index
, name
));
5594 static GLint GLAPIENTRY
5595 exec_GetAttribLocationARB(GLuint program
, const GLchar
*name
)
5597 GET_CURRENT_CONTEXT(ctx
);
5598 FLUSH_VERTICES(ctx
, 0);
5599 return CALL_GetAttribLocationARB(ctx
->Exec
, (program
, name
));
5601 /* XXX more shader functions needed here */
5605 #if FEATURE_EXT_framebuffer_blit
5606 static void GLAPIENTRY
5607 save_BlitFramebufferEXT(GLint srcX0
, GLint srcY0
, GLint srcX1
, GLint srcY1
,
5608 GLint dstX0
, GLint dstY0
, GLint dstX1
, GLint dstY1
,
5609 GLbitfield mask
, GLenum filter
)
5611 GET_CURRENT_CONTEXT(ctx
);
5613 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5614 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BLIT_FRAMEBUFFER
, 10);
5627 if (ctx
->ExecuteFlag
) {
5628 CALL_BlitFramebufferEXT(ctx
->Exec
, (srcX0
, srcY0
, srcX1
, srcY1
,
5629 dstX0
, dstY0
, dstX1
, dstY1
,
5637 * Save an error-generating command into display list.
5639 * KW: Will appear in the list before the vertex buffer containing the
5640 * command that provoked the error. I don't see this as a problem.
5643 save_error(GLcontext
*ctx
, GLenum error
, const char *s
)
5646 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ERROR
, 2);
5649 n
[2].data
= (void *) s
;
5655 * Compile an error into current display list.
5658 _mesa_compile_error(GLcontext
*ctx
, GLenum error
, const char *s
)
5660 if (ctx
->CompileFlag
)
5661 save_error(ctx
, error
, s
);
5662 if (ctx
->ExecuteFlag
)
5663 _mesa_error(ctx
, error
, s
);
5668 * Test if ID names a display list.
5671 islist(GLcontext
*ctx
, GLuint list
)
5673 if (list
> 0 && lookup_list(ctx
, list
)) {
5683 /**********************************************************************/
5684 /* Display list execution */
5685 /**********************************************************************/
5689 * Execute a display list. Note that the ListBase offset must have already
5690 * been added before calling this function. I.e. the list argument is
5691 * the absolute list number, not relative to ListBase.
5692 * \param list - display list number
5695 execute_list(GLcontext
*ctx
, GLuint list
)
5697 struct mesa_display_list
*dlist
;
5701 if (list
== 0 || !islist(ctx
, list
))
5704 if (ctx
->ListState
.CallDepth
== MAX_LIST_NESTING
) {
5705 /* raise an error? */
5709 dlist
= lookup_list(ctx
, list
);
5713 ctx
->ListState
.CallDepth
++;
5715 if (ctx
->Driver
.BeginCallList
)
5716 ctx
->Driver
.BeginCallList(ctx
, dlist
);
5722 OpCode opcode
= n
[0].opcode
;
5723 int i
= (int) n
[0].opcode
- (int) OPCODE_EXT_0
;
5725 if (i
>= 0 && i
< (GLint
) ctx
->ListExt
.NumOpcodes
) {
5726 /* this is a driver-extended opcode */
5727 ctx
->ListExt
.Opcode
[i
].Execute(ctx
, &n
[1]);
5728 n
+= ctx
->ListExt
.Opcode
[i
].Size
;
5733 _mesa_error(ctx
, n
[1].e
, (const char *) n
[2].data
);
5736 CALL_Accum(ctx
->Exec
, (n
[1].e
, n
[2].f
));
5738 case OPCODE_ALPHA_FUNC
:
5739 CALL_AlphaFunc(ctx
->Exec
, (n
[1].e
, n
[2].f
));
5741 case OPCODE_BIND_TEXTURE
:
5742 CALL_BindTexture(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
5746 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5747 ctx
->Unpack
= ctx
->DefaultPacking
;
5748 CALL_Bitmap(ctx
->Exec
, ((GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
5749 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
5750 (const GLubyte
*) n
[7].data
));
5751 ctx
->Unpack
= save
; /* restore */
5754 case OPCODE_BLEND_COLOR
:
5755 CALL_BlendColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
5757 case OPCODE_BLEND_EQUATION
:
5758 CALL_BlendEquation(ctx
->Exec
, (n
[1].e
));
5760 case OPCODE_BLEND_EQUATION_SEPARATE
:
5761 CALL_BlendEquationSeparateEXT(ctx
->Exec
, (n
[1].e
, n
[2].e
));
5763 case OPCODE_BLEND_FUNC_SEPARATE
:
5764 CALL_BlendFuncSeparateEXT(ctx
->Exec
,
5765 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
5767 case OPCODE_CALL_LIST
:
5768 /* Generated by glCallList(), don't add ListBase */
5769 if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
5770 execute_list(ctx
, n
[1].ui
);
5773 case OPCODE_CALL_LIST_OFFSET
:
5774 /* Generated by glCallLists() so we must add ListBase */
5776 /* user specified a bad data type at compile time */
5777 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
5779 else if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
5780 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ n
[1].i
);
5781 execute_list(ctx
, list
);
5785 CALL_Clear(ctx
->Exec
, (n
[1].bf
));
5787 case OPCODE_CLEAR_COLOR
:
5788 CALL_ClearColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
5790 case OPCODE_CLEAR_ACCUM
:
5791 CALL_ClearAccum(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
5793 case OPCODE_CLEAR_DEPTH
:
5794 CALL_ClearDepth(ctx
->Exec
, ((GLclampd
) n
[1].f
));
5796 case OPCODE_CLEAR_INDEX
:
5797 CALL_ClearIndex(ctx
->Exec
, ((GLfloat
) n
[1].ui
));
5799 case OPCODE_CLEAR_STENCIL
:
5800 CALL_ClearStencil(ctx
->Exec
, (n
[1].i
));
5802 case OPCODE_CLIP_PLANE
:
5809 CALL_ClipPlane(ctx
->Exec
, (n
[1].e
, eq
));
5812 case OPCODE_COLOR_MASK
:
5813 CALL_ColorMask(ctx
->Exec
, (n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
));
5815 case OPCODE_COLOR_MATERIAL
:
5816 CALL_ColorMaterial(ctx
->Exec
, (n
[1].e
, n
[2].e
));
5818 case OPCODE_COLOR_TABLE
:
5820 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5821 ctx
->Unpack
= ctx
->DefaultPacking
;
5822 CALL_ColorTable(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].e
,
5823 n
[5].e
, n
[6].data
));
5824 ctx
->Unpack
= save
; /* restore */
5827 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
5834 CALL_ColorTableParameterfv(ctx
->Exec
,
5835 (n
[1].e
, n
[2].e
, params
));
5838 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
5845 CALL_ColorTableParameteriv(ctx
->Exec
,
5846 (n
[1].e
, n
[2].e
, params
));
5849 case OPCODE_COLOR_SUB_TABLE
:
5851 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5852 ctx
->Unpack
= ctx
->DefaultPacking
;
5853 CALL_ColorSubTable(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5854 n
[4].e
, n
[5].e
, n
[6].data
));
5855 ctx
->Unpack
= save
; /* restore */
5858 case OPCODE_CONVOLUTION_FILTER_1D
:
5860 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5861 ctx
->Unpack
= ctx
->DefaultPacking
;
5862 CALL_ConvolutionFilter1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5865 ctx
->Unpack
= save
; /* restore */
5868 case OPCODE_CONVOLUTION_FILTER_2D
:
5870 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5871 ctx
->Unpack
= ctx
->DefaultPacking
;
5872 CALL_ConvolutionFilter2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5873 n
[4].i
, n
[5].e
, n
[6].e
,
5875 ctx
->Unpack
= save
; /* restore */
5878 case OPCODE_CONVOLUTION_PARAMETER_I
:
5879 CALL_ConvolutionParameteri(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].i
));
5881 case OPCODE_CONVOLUTION_PARAMETER_IV
:
5888 CALL_ConvolutionParameteriv(ctx
->Exec
,
5889 (n
[1].e
, n
[2].e
, params
));
5892 case OPCODE_CONVOLUTION_PARAMETER_F
:
5893 CALL_ConvolutionParameterf(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].f
));
5895 case OPCODE_CONVOLUTION_PARAMETER_FV
:
5902 CALL_ConvolutionParameterfv(ctx
->Exec
,
5903 (n
[1].e
, n
[2].e
, params
));
5906 case OPCODE_COPY_COLOR_SUB_TABLE
:
5907 CALL_CopyColorSubTable(ctx
->Exec
, (n
[1].e
, n
[2].i
,
5908 n
[3].i
, n
[4].i
, n
[5].i
));
5910 case OPCODE_COPY_COLOR_TABLE
:
5911 CALL_CopyColorSubTable(ctx
->Exec
, (n
[1].e
, n
[2].i
,
5912 n
[3].i
, n
[4].i
, n
[5].i
));
5914 case OPCODE_COPY_PIXELS
:
5915 CALL_CopyPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
,
5916 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
,
5919 case OPCODE_COPY_TEX_IMAGE1D
:
5920 CALL_CopyTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
5921 n
[5].i
, n
[6].i
, n
[7].i
));
5923 case OPCODE_COPY_TEX_IMAGE2D
:
5924 CALL_CopyTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
5925 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
));
5927 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
5928 CALL_CopyTexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5929 n
[4].i
, n
[5].i
, n
[6].i
));
5931 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
5932 CALL_CopyTexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5933 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
5936 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
5937 CALL_CopyTexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5938 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
5941 case OPCODE_CULL_FACE
:
5942 CALL_CullFace(ctx
->Exec
, (n
[1].e
));
5944 case OPCODE_DEPTH_FUNC
:
5945 CALL_DepthFunc(ctx
->Exec
, (n
[1].e
));
5947 case OPCODE_DEPTH_MASK
:
5948 CALL_DepthMask(ctx
->Exec
, (n
[1].b
));
5950 case OPCODE_DEPTH_RANGE
:
5951 CALL_DepthRange(ctx
->Exec
,
5952 ((GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
));
5954 case OPCODE_DISABLE
:
5955 CALL_Disable(ctx
->Exec
, (n
[1].e
));
5957 case OPCODE_DRAW_BUFFER
:
5958 CALL_DrawBuffer(ctx
->Exec
, (n
[1].e
));
5960 case OPCODE_DRAW_PIXELS
:
5962 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5963 ctx
->Unpack
= ctx
->DefaultPacking
;
5964 CALL_DrawPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
5966 ctx
->Unpack
= save
; /* restore */
5970 CALL_Enable(ctx
->Exec
, (n
[1].e
));
5972 case OPCODE_EVALMESH1
:
5973 CALL_EvalMesh1(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
));
5975 case OPCODE_EVALMESH2
:
5976 CALL_EvalMesh2(ctx
->Exec
,
5977 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
5986 CALL_Fogfv(ctx
->Exec
, (n
[1].e
, p
));
5989 case OPCODE_FRONT_FACE
:
5990 CALL_FrontFace(ctx
->Exec
, (n
[1].e
));
5992 case OPCODE_FRUSTUM
:
5993 CALL_Frustum(ctx
->Exec
,
5994 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
5997 CALL_Hint(ctx
->Exec
, (n
[1].e
, n
[2].e
));
5999 case OPCODE_HISTOGRAM
:
6000 CALL_Histogram(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].b
));
6002 case OPCODE_INDEX_MASK
:
6003 CALL_IndexMask(ctx
->Exec
, (n
[1].ui
));
6005 case OPCODE_INIT_NAMES
:
6006 CALL_InitNames(ctx
->Exec
, ());
6015 CALL_Lightfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, p
));
6018 case OPCODE_LIGHT_MODEL
:
6025 CALL_LightModelfv(ctx
->Exec
, (n
[1].e
, p
));
6028 case OPCODE_LINE_STIPPLE
:
6029 CALL_LineStipple(ctx
->Exec
, (n
[1].i
, n
[2].us
));
6031 case OPCODE_LINE_WIDTH
:
6032 CALL_LineWidth(ctx
->Exec
, (n
[1].f
));
6034 case OPCODE_LIST_BASE
:
6035 CALL_ListBase(ctx
->Exec
, (n
[1].ui
));
6037 case OPCODE_LOAD_IDENTITY
:
6038 CALL_LoadIdentity(ctx
->Exec
, ());
6040 case OPCODE_LOAD_MATRIX
:
6041 if (sizeof(Node
) == sizeof(GLfloat
)) {
6042 CALL_LoadMatrixf(ctx
->Exec
, (&n
[1].f
));
6047 for (i
= 0; i
< 16; i
++) {
6050 CALL_LoadMatrixf(ctx
->Exec
, (m
));
6053 case OPCODE_LOAD_NAME
:
6054 CALL_LoadName(ctx
->Exec
, (n
[1].ui
));
6056 case OPCODE_LOGIC_OP
:
6057 CALL_LogicOp(ctx
->Exec
, (n
[1].e
));
6061 GLenum target
= n
[1].e
;
6062 GLint ustride
= _mesa_evaluator_components(target
);
6063 GLint uorder
= n
[5].i
;
6064 GLfloat u1
= n
[2].f
;
6065 GLfloat u2
= n
[3].f
;
6066 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
6067 (GLfloat
*) n
[6].data
));
6072 GLenum target
= n
[1].e
;
6073 GLfloat u1
= n
[2].f
;
6074 GLfloat u2
= n
[3].f
;
6075 GLfloat v1
= n
[4].f
;
6076 GLfloat v2
= n
[5].f
;
6077 GLint ustride
= n
[6].i
;
6078 GLint vstride
= n
[7].i
;
6079 GLint uorder
= n
[8].i
;
6080 GLint vorder
= n
[9].i
;
6081 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
6082 v1
, v2
, vstride
, vorder
,
6083 (GLfloat
*) n
[10].data
));
6086 case OPCODE_MAPGRID1
:
6087 CALL_MapGrid1f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
6089 case OPCODE_MAPGRID2
:
6090 CALL_MapGrid2f(ctx
->Exec
,
6091 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
));
6093 case OPCODE_MATRIX_MODE
:
6094 CALL_MatrixMode(ctx
->Exec
, (n
[1].e
));
6096 case OPCODE_MIN_MAX
:
6097 CALL_Minmax(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].b
));
6099 case OPCODE_MULT_MATRIX
:
6100 if (sizeof(Node
) == sizeof(GLfloat
)) {
6101 CALL_MultMatrixf(ctx
->Exec
, (&n
[1].f
));
6106 for (i
= 0; i
< 16; i
++) {
6109 CALL_MultMatrixf(ctx
->Exec
, (m
));
6113 CALL_Ortho(ctx
->Exec
,
6114 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
6116 case OPCODE_PASSTHROUGH
:
6117 CALL_PassThrough(ctx
->Exec
, (n
[1].f
));
6119 case OPCODE_PIXEL_MAP
:
6120 CALL_PixelMapfv(ctx
->Exec
,
6121 (n
[1].e
, n
[2].i
, (GLfloat
*) n
[3].data
));
6123 case OPCODE_PIXEL_TRANSFER
:
6124 CALL_PixelTransferf(ctx
->Exec
, (n
[1].e
, n
[2].f
));
6126 case OPCODE_PIXEL_ZOOM
:
6127 CALL_PixelZoom(ctx
->Exec
, (n
[1].f
, n
[2].f
));
6129 case OPCODE_POINT_SIZE
:
6130 CALL_PointSize(ctx
->Exec
, (n
[1].f
));
6132 case OPCODE_POINT_PARAMETERS
:
6138 CALL_PointParameterfvEXT(ctx
->Exec
, (n
[1].e
, params
));
6141 case OPCODE_POLYGON_MODE
:
6142 CALL_PolygonMode(ctx
->Exec
, (n
[1].e
, n
[2].e
));
6144 case OPCODE_POLYGON_STIPPLE
:
6146 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6147 ctx
->Unpack
= ctx
->DefaultPacking
;
6148 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) n
[1].data
));
6149 ctx
->Unpack
= save
; /* restore */
6152 case OPCODE_POLYGON_OFFSET
:
6153 CALL_PolygonOffset(ctx
->Exec
, (n
[1].f
, n
[2].f
));
6155 case OPCODE_POP_ATTRIB
:
6156 CALL_PopAttrib(ctx
->Exec
, ());
6158 case OPCODE_POP_MATRIX
:
6159 CALL_PopMatrix(ctx
->Exec
, ());
6161 case OPCODE_POP_NAME
:
6162 CALL_PopName(ctx
->Exec
, ());
6164 case OPCODE_PRIORITIZE_TEXTURE
:
6165 CALL_PrioritizeTextures(ctx
->Exec
, (1, &n
[1].ui
, &n
[2].f
));
6167 case OPCODE_PUSH_ATTRIB
:
6168 CALL_PushAttrib(ctx
->Exec
, (n
[1].bf
));
6170 case OPCODE_PUSH_MATRIX
:
6171 CALL_PushMatrix(ctx
->Exec
, ());
6173 case OPCODE_PUSH_NAME
:
6174 CALL_PushName(ctx
->Exec
, (n
[1].ui
));
6176 case OPCODE_RASTER_POS
:
6177 CALL_RasterPos4f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
6179 case OPCODE_READ_BUFFER
:
6180 CALL_ReadBuffer(ctx
->Exec
, (n
[1].e
));
6182 case OPCODE_RESET_HISTOGRAM
:
6183 CALL_ResetHistogram(ctx
->Exec
, (n
[1].e
));
6185 case OPCODE_RESET_MIN_MAX
:
6186 CALL_ResetMinmax(ctx
->Exec
, (n
[1].e
));
6189 CALL_Rotatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
6192 CALL_Scalef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
6194 case OPCODE_SCISSOR
:
6195 CALL_Scissor(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
6197 case OPCODE_SHADE_MODEL
:
6198 CALL_ShadeModel(ctx
->Exec
, (n
[1].e
));
6200 case OPCODE_STENCIL_FUNC
:
6201 CALL_StencilFunc(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].ui
));
6203 case OPCODE_STENCIL_MASK
:
6204 CALL_StencilMask(ctx
->Exec
, (n
[1].ui
));
6206 case OPCODE_STENCIL_OP
:
6207 CALL_StencilOp(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].e
));
6209 case OPCODE_STENCIL_FUNC_SEPARATE
:
6210 CALL_StencilFuncSeparate(ctx
->Exec
,
6211 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].ui
));
6213 case OPCODE_STENCIL_MASK_SEPARATE
:
6214 CALL_StencilMaskSeparate(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
6216 case OPCODE_STENCIL_OP_SEPARATE
:
6217 CALL_StencilOpSeparate(ctx
->Exec
,
6218 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
6227 CALL_TexEnvfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
6237 CALL_TexGenfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
6240 case OPCODE_TEXPARAMETER
:
6247 CALL_TexParameterfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
6250 case OPCODE_TEX_IMAGE1D
:
6252 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6253 ctx
->Unpack
= ctx
->DefaultPacking
;
6254 CALL_TexImage1D(ctx
->Exec
, (n
[1].e
, /* target */
6256 n
[3].i
, /* components */
6258 n
[5].e
, /* border */
6259 n
[6].e
, /* format */
6262 ctx
->Unpack
= save
; /* restore */
6265 case OPCODE_TEX_IMAGE2D
:
6267 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6268 ctx
->Unpack
= ctx
->DefaultPacking
;
6269 CALL_TexImage2D(ctx
->Exec
, (n
[1].e
, /* target */
6271 n
[3].i
, /* components */
6273 n
[5].i
, /* height */
6274 n
[6].e
, /* border */
6275 n
[7].e
, /* format */
6278 ctx
->Unpack
= save
; /* restore */
6281 case OPCODE_TEX_IMAGE3D
:
6283 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6284 ctx
->Unpack
= ctx
->DefaultPacking
;
6285 CALL_TexImage3D(ctx
->Exec
, (n
[1].e
, /* target */
6287 n
[3].i
, /* components */
6289 n
[5].i
, /* height */
6291 n
[7].e
, /* border */
6292 n
[8].e
, /* format */
6295 ctx
->Unpack
= save
; /* restore */
6298 case OPCODE_TEX_SUB_IMAGE1D
:
6300 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6301 ctx
->Unpack
= ctx
->DefaultPacking
;
6302 CALL_TexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
6304 n
[6].e
, n
[7].data
));
6305 ctx
->Unpack
= save
; /* restore */
6308 case OPCODE_TEX_SUB_IMAGE2D
:
6310 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6311 ctx
->Unpack
= ctx
->DefaultPacking
;
6312 CALL_TexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
6314 n
[6].i
, n
[7].e
, n
[8].e
,
6316 ctx
->Unpack
= save
; /* restore */
6319 case OPCODE_TEX_SUB_IMAGE3D
:
6321 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6322 ctx
->Unpack
= ctx
->DefaultPacking
;
6323 CALL_TexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
6324 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
6325 n
[8].i
, n
[9].e
, n
[10].e
,
6327 ctx
->Unpack
= save
; /* restore */
6330 case OPCODE_TRANSLATE
:
6331 CALL_Translatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
6333 case OPCODE_VIEWPORT
:
6334 CALL_Viewport(ctx
->Exec
, (n
[1].i
, n
[2].i
,
6335 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
));
6337 case OPCODE_WINDOW_POS
:
6338 CALL_WindowPos4fMESA(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
6340 case OPCODE_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
6341 CALL_ActiveTextureARB(ctx
->Exec
, (n
[1].e
));
6343 case OPCODE_COMPRESSED_TEX_IMAGE_1D
: /* GL_ARB_texture_compression */
6344 CALL_CompressedTexImage1DARB(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
6345 n
[4].i
, n
[5].i
, n
[6].i
,
6348 case OPCODE_COMPRESSED_TEX_IMAGE_2D
: /* GL_ARB_texture_compression */
6349 CALL_CompressedTexImage2DARB(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
6350 n
[4].i
, n
[5].i
, n
[6].i
,
6351 n
[7].i
, n
[8].data
));
6353 case OPCODE_COMPRESSED_TEX_IMAGE_3D
: /* GL_ARB_texture_compression */
6354 CALL_CompressedTexImage3DARB(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
6355 n
[4].i
, n
[5].i
, n
[6].i
,
6359 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
: /* GL_ARB_texture_compress */
6360 CALL_CompressedTexSubImage1DARB(ctx
->Exec
,
6361 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
6362 n
[5].e
, n
[6].i
, n
[7].data
));
6364 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
: /* GL_ARB_texture_compress */
6365 CALL_CompressedTexSubImage2DARB(ctx
->Exec
,
6366 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
6367 n
[5].i
, n
[6].i
, n
[7].e
, n
[8].i
,
6370 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
: /* GL_ARB_texture_compress */
6371 CALL_CompressedTexSubImage3DARB(ctx
->Exec
,
6372 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
6373 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
6374 n
[9].e
, n
[10].i
, n
[11].data
));
6376 case OPCODE_SAMPLE_COVERAGE
: /* GL_ARB_multisample */
6377 CALL_SampleCoverageARB(ctx
->Exec
, (n
[1].f
, n
[2].b
));
6379 case OPCODE_WINDOW_POS_ARB
: /* GL_ARB_window_pos */
6380 CALL_WindowPos3fMESA(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
6382 #if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
6383 case OPCODE_BIND_PROGRAM_NV
: /* GL_NV_vertex_program */
6384 CALL_BindProgramNV(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
6387 #if FEATURE_NV_vertex_program
6388 case OPCODE_EXECUTE_PROGRAM_NV
:
6395 CALL_ExecuteProgramNV(ctx
->Exec
, (n
[1].e
, n
[2].ui
, v
));
6398 case OPCODE_REQUEST_RESIDENT_PROGRAMS_NV
:
6399 CALL_RequestResidentProgramsNV(ctx
->Exec
, (n
[1].ui
,
6400 (GLuint
*) n
[2].data
));
6402 case OPCODE_LOAD_PROGRAM_NV
:
6403 CALL_LoadProgramNV(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].i
,
6404 (const GLubyte
*) n
[4].data
));
6406 case OPCODE_TRACK_MATRIX_NV
:
6407 CALL_TrackMatrixNV(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].e
, n
[4].e
));
6411 #if FEATURE_NV_fragment_program
6412 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
:
6413 CALL_ProgramLocalParameter4fARB(ctx
->Exec
,
6414 (n
[1].e
, n
[2].ui
, n
[3].f
, n
[4].f
,
6417 case OPCODE_PROGRAM_NAMED_PARAMETER_NV
:
6418 CALL_ProgramNamedParameter4fNV(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
6419 (const GLubyte
*) n
[3].
6420 data
, n
[4].f
, n
[5].f
,
6425 case OPCODE_ACTIVE_STENCIL_FACE_EXT
:
6426 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (n
[1].e
));
6428 case OPCODE_DEPTH_BOUNDS_EXT
:
6429 CALL_DepthBoundsEXT(ctx
->Exec
, (n
[1].f
, n
[2].f
));
6431 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
6432 case OPCODE_PROGRAM_STRING_ARB
:
6433 CALL_ProgramStringARB(ctx
->Exec
,
6434 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].data
));
6437 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program || FEATURE_NV_vertex_program
6438 case OPCODE_PROGRAM_ENV_PARAMETER_ARB
:
6439 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].f
,
6444 #if FEATURE_ARB_occlusion_query
6445 case OPCODE_BEGIN_QUERY_ARB
:
6446 CALL_BeginQueryARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
6448 case OPCODE_END_QUERY_ARB
:
6449 CALL_EndQueryARB(ctx
->Exec
, (n
[1].e
));
6452 case OPCODE_DRAW_BUFFERS_ARB
:
6454 GLenum buffers
[MAX_DRAW_BUFFERS
];
6455 GLint i
, count
= MIN2(n
[1].i
, MAX_DRAW_BUFFERS
);
6456 for (i
= 0; i
< count
; i
++)
6457 buffers
[i
] = n
[2 + i
].e
;
6458 CALL_DrawBuffersARB(ctx
->Exec
, (n
[1].i
, buffers
));
6461 #if FEATURE_EXT_framebuffer_blit
6462 case OPCODE_BLIT_FRAMEBUFFER
:
6463 CALL_BlitFramebufferEXT(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
,
6464 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
6468 #if FEATURE_ATI_fragment_shader
6469 case OPCODE_BIND_FRAGMENT_SHADER_ATI
:
6470 CALL_BindFragmentShaderATI(ctx
->Exec
, (n
[1].i
));
6472 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
:
6475 GLuint i
, dst
= n
[1].ui
;
6477 for (i
= 0; i
< 4; i
++)
6478 values
[i
] = n
[1 + i
].f
;
6479 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, values
));
6483 case OPCODE_ATTR_1F_NV
:
6484 CALL_VertexAttrib1fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
));
6486 case OPCODE_ATTR_2F_NV
:
6487 /* Really shouldn't have to do this - the Node structure
6488 * is convenient, but it would be better to store the data
6489 * packed appropriately so that it can be sent directly
6490 * on. With x86_64 becoming common, this will start to
6493 if (sizeof(Node
) == sizeof(GLfloat
))
6494 CALL_VertexAttrib2fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6496 CALL_VertexAttrib2fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
));
6498 case OPCODE_ATTR_3F_NV
:
6499 if (sizeof(Node
) == sizeof(GLfloat
))
6500 CALL_VertexAttrib3fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6502 CALL_VertexAttrib3fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
6505 case OPCODE_ATTR_4F_NV
:
6506 if (sizeof(Node
) == sizeof(GLfloat
))
6507 CALL_VertexAttrib4fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6509 CALL_VertexAttrib4fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
6512 case OPCODE_ATTR_1F_ARB
:
6513 CALL_VertexAttrib1fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
));
6515 case OPCODE_ATTR_2F_ARB
:
6516 /* Really shouldn't have to do this - the Node structure
6517 * is convenient, but it would be better to store the data
6518 * packed appropriately so that it can be sent directly
6519 * on. With x86_64 becoming common, this will start to
6522 if (sizeof(Node
) == sizeof(GLfloat
))
6523 CALL_VertexAttrib2fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6525 CALL_VertexAttrib2fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
));
6527 case OPCODE_ATTR_3F_ARB
:
6528 if (sizeof(Node
) == sizeof(GLfloat
))
6529 CALL_VertexAttrib3fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6531 CALL_VertexAttrib3fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
6534 case OPCODE_ATTR_4F_ARB
:
6535 if (sizeof(Node
) == sizeof(GLfloat
))
6536 CALL_VertexAttrib4fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6538 CALL_VertexAttrib4fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
6541 case OPCODE_MATERIAL
:
6542 if (sizeof(Node
) == sizeof(GLfloat
))
6543 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, &n
[3].f
));
6550 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, f
));
6554 CALL_Begin(ctx
->Exec
, (n
[1].e
));
6557 CALL_End(ctx
->Exec
, ());
6560 CALL_Rectf(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
6562 case OPCODE_EVAL_C1
:
6563 CALL_EvalCoord1f(ctx
->Exec
, (n
[1].f
));
6565 case OPCODE_EVAL_C2
:
6566 CALL_EvalCoord2f(ctx
->Exec
, (n
[1].f
, n
[2].f
));
6568 case OPCODE_EVAL_P1
:
6569 CALL_EvalPoint1(ctx
->Exec
, (n
[1].i
));
6571 case OPCODE_EVAL_P2
:
6572 CALL_EvalPoint2(ctx
->Exec
, (n
[1].i
, n
[2].i
));
6575 case OPCODE_CONTINUE
:
6576 n
= (Node
*) n
[1].next
;
6578 case OPCODE_END_OF_LIST
:
6584 _mesa_sprintf(msg
, "Error in execute_list: opcode=%d",
6586 _mesa_problem(ctx
, msg
);
6591 /* increment n to point to next compiled command */
6592 if (opcode
!= OPCODE_CONTINUE
) {
6593 n
+= InstSize
[opcode
];
6598 if (ctx
->Driver
.EndCallList
)
6599 ctx
->Driver
.EndCallList(ctx
);
6601 ctx
->ListState
.CallDepth
--;
6606 /**********************************************************************/
6608 /**********************************************************************/
6611 * Test if a display list number is valid.
6613 GLboolean GLAPIENTRY
6614 _mesa_IsList(GLuint list
)
6616 GET_CURRENT_CONTEXT(ctx
);
6617 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
6618 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
6619 return islist(ctx
, list
);
6624 * Delete a sequence of consecutive display lists.
6627 _mesa_DeleteLists(GLuint list
, GLsizei range
)
6629 GET_CURRENT_CONTEXT(ctx
);
6631 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
6632 ASSERT_OUTSIDE_BEGIN_END(ctx
);
6635 _mesa_error(ctx
, GL_INVALID_VALUE
, "glDeleteLists");
6638 for (i
= list
; i
< list
+ range
; i
++) {
6639 destroy_list(ctx
, i
);
6645 * Return a display list number, n, such that lists n through n+range-1
6649 _mesa_GenLists(GLsizei range
)
6651 GET_CURRENT_CONTEXT(ctx
);
6653 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
6654 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, 0);
6657 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGenLists");
6665 * Make this an atomic operation
6667 _glthread_LOCK_MUTEX(ctx
->Shared
->Mutex
);
6669 base
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
6671 /* reserve the list IDs by with empty/dummy lists */
6673 for (i
= 0; i
< range
; i
++) {
6674 _mesa_HashInsert(ctx
->Shared
->DisplayList
, base
+ i
,
6675 make_list(base
+ i
, 1));
6679 _glthread_UNLOCK_MUTEX(ctx
->Shared
->Mutex
);
6686 * Begin a new display list.
6689 _mesa_NewList(GLuint list
, GLenum mode
)
6691 GET_CURRENT_CONTEXT(ctx
);
6694 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
6695 ASSERT_OUTSIDE_BEGIN_END(ctx
);
6697 if (MESA_VERBOSE
& VERBOSE_API
)
6698 _mesa_debug(ctx
, "glNewList %u %s\n", list
,
6699 _mesa_lookup_enum_by_nr(mode
));
6702 _mesa_error(ctx
, GL_INVALID_VALUE
, "glNewList");
6706 if (mode
!= GL_COMPILE
&& mode
!= GL_COMPILE_AND_EXECUTE
) {
6707 _mesa_error(ctx
, GL_INVALID_ENUM
, "glNewList");
6711 if (ctx
->ListState
.CurrentListPtr
) {
6712 /* already compiling a display list */
6713 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
6717 ctx
->CompileFlag
= GL_TRUE
;
6718 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
6720 /* Allocate new display list */
6721 ctx
->ListState
.CurrentListNum
= list
;
6722 ctx
->ListState
.CurrentList
= make_list(list
, BLOCK_SIZE
);
6723 ctx
->ListState
.CurrentBlock
= ctx
->ListState
.CurrentList
->node
;
6724 ctx
->ListState
.CurrentListPtr
= ctx
->ListState
.CurrentBlock
;
6725 ctx
->ListState
.CurrentPos
= 0;
6727 /* Reset acumulated list state:
6729 for (i
= 0; i
< VERT_ATTRIB_MAX
; i
++)
6730 ctx
->ListState
.ActiveAttribSize
[i
] = 0;
6732 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++)
6733 ctx
->ListState
.ActiveMaterialSize
[i
] = 0;
6735 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
6736 ctx
->Driver
.NewList(ctx
, list
, mode
);
6738 ctx
->CurrentDispatch
= ctx
->Save
;
6739 _glapi_set_dispatch(ctx
->CurrentDispatch
);
6744 * End definition of current display list.
6749 GET_CURRENT_CONTEXT(ctx
);
6750 SAVE_FLUSH_VERTICES(ctx
);
6751 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
6753 if (MESA_VERBOSE
& VERBOSE_API
)
6754 _mesa_debug(ctx
, "glEndList\n");
6756 /* Check that a list is under construction */
6757 if (!ctx
->ListState
.CurrentListPtr
) {
6758 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glEndList");
6762 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_END_OF_LIST
, 0);
6764 /* Destroy old list, if any */
6765 destroy_list(ctx
, ctx
->ListState
.CurrentListNum
);
6766 /* Install the list */
6767 _mesa_HashInsert(ctx
->Shared
->DisplayList
, ctx
->ListState
.CurrentListNum
,
6768 ctx
->ListState
.CurrentList
);
6771 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
6772 mesa_print_display_list(ctx
->ListState
.CurrentListNum
);
6774 ctx
->Driver
.EndList(ctx
);
6776 ctx
->ListState
.CurrentList
= NULL
;
6777 ctx
->ListState
.CurrentListNum
= 0;
6778 ctx
->ListState
.CurrentListPtr
= NULL
;
6779 ctx
->ExecuteFlag
= GL_TRUE
;
6780 ctx
->CompileFlag
= GL_FALSE
;
6782 ctx
->CurrentDispatch
= ctx
->Exec
;
6783 _glapi_set_dispatch(ctx
->CurrentDispatch
);
6788 _mesa_CallList(GLuint list
)
6790 GLboolean save_compile_flag
;
6791 GET_CURRENT_CONTEXT(ctx
);
6792 FLUSH_CURRENT(ctx
, 0);
6793 /* VERY IMPORTANT: Save the CompileFlag status, turn it off, */
6794 /* execute the display list, and restore the CompileFlag. */
6796 if (MESA_VERBOSE
& VERBOSE_API
)
6797 _mesa_debug(ctx
, "glCallList %d\n", list
);
6800 _mesa_error(ctx
, GL_INVALID_VALUE
, "glCallList(list==0)");
6804 /* mesa_print_display_list( list ); */
6806 save_compile_flag
= ctx
->CompileFlag
;
6807 if (save_compile_flag
) {
6808 ctx
->CompileFlag
= GL_FALSE
;
6811 execute_list(ctx
, list
);
6812 ctx
->CompileFlag
= save_compile_flag
;
6814 /* also restore API function pointers to point to "save" versions */
6815 if (save_compile_flag
) {
6816 ctx
->CurrentDispatch
= ctx
->Save
;
6817 _glapi_set_dispatch(ctx
->CurrentDispatch
);
6823 * Execute glCallLists: call multiple display lists.
6826 _mesa_CallLists(GLsizei n
, GLenum type
, const GLvoid
* lists
)
6828 GET_CURRENT_CONTEXT(ctx
);
6830 GLboolean save_compile_flag
;
6832 if (MESA_VERBOSE
& VERBOSE_API
)
6833 _mesa_debug(ctx
, "glCallLists %d\n", n
);
6837 case GL_UNSIGNED_BYTE
:
6839 case GL_UNSIGNED_SHORT
:
6841 case GL_UNSIGNED_INT
:
6849 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
6853 /* Save the CompileFlag status, turn it off, execute display list,
6854 * and restore the CompileFlag.
6856 save_compile_flag
= ctx
->CompileFlag
;
6857 ctx
->CompileFlag
= GL_FALSE
;
6859 for (i
= 0; i
< n
; i
++) {
6860 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ translate_id(i
, type
, lists
));
6861 execute_list(ctx
, list
);
6864 ctx
->CompileFlag
= save_compile_flag
;
6866 /* also restore API function pointers to point to "save" versions */
6867 if (save_compile_flag
) {
6868 ctx
->CurrentDispatch
= ctx
->Save
;
6869 _glapi_set_dispatch(ctx
->CurrentDispatch
);
6875 * Set the offset added to list numbers in glCallLists.
6878 _mesa_ListBase(GLuint base
)
6880 GET_CURRENT_CONTEXT(ctx
);
6881 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
6882 ASSERT_OUTSIDE_BEGIN_END(ctx
);
6883 ctx
->List
.ListBase
= base
;
6887 /* Can no longer assume ctx->Exec->Func is equal to _mesa_Func.
6889 static void GLAPIENTRY
6892 GET_CURRENT_CONTEXT(ctx
);
6893 FLUSH_VERTICES(ctx
, 0);
6894 CALL_Finish(ctx
->Exec
, ());
6897 static void GLAPIENTRY
6900 GET_CURRENT_CONTEXT(ctx
);
6901 FLUSH_VERTICES(ctx
, 0);
6902 CALL_Flush(ctx
->Exec
, ());
6905 static void GLAPIENTRY
6906 exec_GetBooleanv(GLenum pname
, GLboolean
*params
)
6908 GET_CURRENT_CONTEXT(ctx
);
6909 FLUSH_VERTICES(ctx
, 0);
6910 CALL_GetBooleanv(ctx
->Exec
, (pname
, params
));
6913 static void GLAPIENTRY
6914 exec_GetClipPlane(GLenum plane
, GLdouble
* equation
)
6916 GET_CURRENT_CONTEXT(ctx
);
6917 FLUSH_VERTICES(ctx
, 0);
6918 CALL_GetClipPlane(ctx
->Exec
, (plane
, equation
));
6921 static void GLAPIENTRY
6922 exec_GetDoublev(GLenum pname
, GLdouble
*params
)
6924 GET_CURRENT_CONTEXT(ctx
);
6925 FLUSH_VERTICES(ctx
, 0);
6926 CALL_GetDoublev(ctx
->Exec
, (pname
, params
));
6929 static GLenum GLAPIENTRY
6932 GET_CURRENT_CONTEXT(ctx
);
6933 FLUSH_VERTICES(ctx
, 0);
6934 return CALL_GetError(ctx
->Exec
, ());
6937 static void GLAPIENTRY
6938 exec_GetFloatv(GLenum pname
, GLfloat
*params
)
6940 GET_CURRENT_CONTEXT(ctx
);
6941 FLUSH_VERTICES(ctx
, 0);
6942 CALL_GetFloatv(ctx
->Exec
, (pname
, params
));
6945 static void GLAPIENTRY
6946 exec_GetIntegerv(GLenum pname
, GLint
*params
)
6948 GET_CURRENT_CONTEXT(ctx
);
6949 FLUSH_VERTICES(ctx
, 0);
6950 CALL_GetIntegerv(ctx
->Exec
, (pname
, params
));
6953 static void GLAPIENTRY
6954 exec_GetLightfv(GLenum light
, GLenum pname
, GLfloat
*params
)
6956 GET_CURRENT_CONTEXT(ctx
);
6957 FLUSH_VERTICES(ctx
, 0);
6958 CALL_GetLightfv(ctx
->Exec
, (light
, pname
, params
));
6961 static void GLAPIENTRY
6962 exec_GetLightiv(GLenum light
, GLenum pname
, GLint
*params
)
6964 GET_CURRENT_CONTEXT(ctx
);
6965 FLUSH_VERTICES(ctx
, 0);
6966 CALL_GetLightiv(ctx
->Exec
, (light
, pname
, params
));
6969 static void GLAPIENTRY
6970 exec_GetMapdv(GLenum target
, GLenum query
, GLdouble
* v
)
6972 GET_CURRENT_CONTEXT(ctx
);
6973 FLUSH_VERTICES(ctx
, 0);
6974 CALL_GetMapdv(ctx
->Exec
, (target
, query
, v
));
6977 static void GLAPIENTRY
6978 exec_GetMapfv(GLenum target
, GLenum query
, GLfloat
* v
)
6980 GET_CURRENT_CONTEXT(ctx
);
6981 FLUSH_VERTICES(ctx
, 0);
6982 CALL_GetMapfv(ctx
->Exec
, (target
, query
, v
));
6985 static void GLAPIENTRY
6986 exec_GetMapiv(GLenum target
, GLenum query
, GLint
* v
)
6988 GET_CURRENT_CONTEXT(ctx
);
6989 FLUSH_VERTICES(ctx
, 0);
6990 CALL_GetMapiv(ctx
->Exec
, (target
, query
, v
));
6993 static void GLAPIENTRY
6994 exec_GetMaterialfv(GLenum face
, GLenum pname
, GLfloat
*params
)
6996 GET_CURRENT_CONTEXT(ctx
);
6997 FLUSH_VERTICES(ctx
, 0);
6998 CALL_GetMaterialfv(ctx
->Exec
, (face
, pname
, params
));
7001 static void GLAPIENTRY
7002 exec_GetMaterialiv(GLenum face
, GLenum pname
, GLint
*params
)
7004 GET_CURRENT_CONTEXT(ctx
);
7005 FLUSH_VERTICES(ctx
, 0);
7006 CALL_GetMaterialiv(ctx
->Exec
, (face
, pname
, params
));
7009 static void GLAPIENTRY
7010 exec_GetPixelMapfv(GLenum map
, GLfloat
*values
)
7012 GET_CURRENT_CONTEXT(ctx
);
7013 FLUSH_VERTICES(ctx
, 0);
7014 CALL_GetPixelMapfv(ctx
->Exec
, (map
, values
));
7017 static void GLAPIENTRY
7018 exec_GetPixelMapuiv(GLenum map
, GLuint
*values
)
7020 GET_CURRENT_CONTEXT(ctx
);
7021 FLUSH_VERTICES(ctx
, 0);
7022 CALL_GetPixelMapuiv(ctx
->Exec
, (map
, values
));
7025 static void GLAPIENTRY
7026 exec_GetPixelMapusv(GLenum map
, GLushort
*values
)
7028 GET_CURRENT_CONTEXT(ctx
);
7029 FLUSH_VERTICES(ctx
, 0);
7030 CALL_GetPixelMapusv(ctx
->Exec
, (map
, values
));
7033 static void GLAPIENTRY
7034 exec_GetPolygonStipple(GLubyte
* dest
)
7036 GET_CURRENT_CONTEXT(ctx
);
7037 FLUSH_VERTICES(ctx
, 0);
7038 CALL_GetPolygonStipple(ctx
->Exec
, (dest
));
7041 static const GLubyte
*GLAPIENTRY
7042 exec_GetString(GLenum name
)
7044 GET_CURRENT_CONTEXT(ctx
);
7045 FLUSH_VERTICES(ctx
, 0);
7046 return CALL_GetString(ctx
->Exec
, (name
));
7049 static void GLAPIENTRY
7050 exec_GetTexEnvfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7052 GET_CURRENT_CONTEXT(ctx
);
7053 FLUSH_VERTICES(ctx
, 0);
7054 CALL_GetTexEnvfv(ctx
->Exec
, (target
, pname
, params
));
7057 static void GLAPIENTRY
7058 exec_GetTexEnviv(GLenum target
, GLenum pname
, GLint
*params
)
7060 GET_CURRENT_CONTEXT(ctx
);
7061 FLUSH_VERTICES(ctx
, 0);
7062 CALL_GetTexEnviv(ctx
->Exec
, (target
, pname
, params
));
7065 static void GLAPIENTRY
7066 exec_GetTexGendv(GLenum coord
, GLenum pname
, GLdouble
*params
)
7068 GET_CURRENT_CONTEXT(ctx
);
7069 FLUSH_VERTICES(ctx
, 0);
7070 CALL_GetTexGendv(ctx
->Exec
, (coord
, pname
, params
));
7073 static void GLAPIENTRY
7074 exec_GetTexGenfv(GLenum coord
, GLenum pname
, GLfloat
*params
)
7076 GET_CURRENT_CONTEXT(ctx
);
7077 FLUSH_VERTICES(ctx
, 0);
7078 CALL_GetTexGenfv(ctx
->Exec
, (coord
, pname
, params
));
7081 static void GLAPIENTRY
7082 exec_GetTexGeniv(GLenum coord
, GLenum pname
, GLint
*params
)
7084 GET_CURRENT_CONTEXT(ctx
);
7085 FLUSH_VERTICES(ctx
, 0);
7086 CALL_GetTexGeniv(ctx
->Exec
, (coord
, pname
, params
));
7089 static void GLAPIENTRY
7090 exec_GetTexImage(GLenum target
, GLint level
, GLenum format
,
7091 GLenum type
, GLvoid
* pixels
)
7093 GET_CURRENT_CONTEXT(ctx
);
7094 FLUSH_VERTICES(ctx
, 0);
7095 CALL_GetTexImage(ctx
->Exec
, (target
, level
, format
, type
, pixels
));
7098 static void GLAPIENTRY
7099 exec_GetTexLevelParameterfv(GLenum target
, GLint level
,
7100 GLenum pname
, GLfloat
*params
)
7102 GET_CURRENT_CONTEXT(ctx
);
7103 FLUSH_VERTICES(ctx
, 0);
7104 CALL_GetTexLevelParameterfv(ctx
->Exec
, (target
, level
, pname
, params
));
7107 static void GLAPIENTRY
7108 exec_GetTexLevelParameteriv(GLenum target
, GLint level
,
7109 GLenum pname
, GLint
*params
)
7111 GET_CURRENT_CONTEXT(ctx
);
7112 FLUSH_VERTICES(ctx
, 0);
7113 CALL_GetTexLevelParameteriv(ctx
->Exec
, (target
, level
, pname
, params
));
7116 static void GLAPIENTRY
7117 exec_GetTexParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7119 GET_CURRENT_CONTEXT(ctx
);
7120 FLUSH_VERTICES(ctx
, 0);
7121 CALL_GetTexParameterfv(ctx
->Exec
, (target
, pname
, params
));
7124 static void GLAPIENTRY
7125 exec_GetTexParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7127 GET_CURRENT_CONTEXT(ctx
);
7128 FLUSH_VERTICES(ctx
, 0);
7129 CALL_GetTexParameteriv(ctx
->Exec
, (target
, pname
, params
));
7132 static GLboolean GLAPIENTRY
7133 exec_IsEnabled(GLenum cap
)
7135 GET_CURRENT_CONTEXT(ctx
);
7136 FLUSH_VERTICES(ctx
, 0);
7137 return CALL_IsEnabled(ctx
->Exec
, (cap
));
7140 static void GLAPIENTRY
7141 exec_PixelStoref(GLenum pname
, GLfloat param
)
7143 GET_CURRENT_CONTEXT(ctx
);
7144 FLUSH_VERTICES(ctx
, 0);
7145 CALL_PixelStoref(ctx
->Exec
, (pname
, param
));
7148 static void GLAPIENTRY
7149 exec_PixelStorei(GLenum pname
, GLint param
)
7151 GET_CURRENT_CONTEXT(ctx
);
7152 FLUSH_VERTICES(ctx
, 0);
7153 CALL_PixelStorei(ctx
->Exec
, (pname
, param
));
7156 static void GLAPIENTRY
7157 exec_ReadPixels(GLint x
, GLint y
, GLsizei width
, GLsizei height
,
7158 GLenum format
, GLenum type
, GLvoid
* pixels
)
7160 GET_CURRENT_CONTEXT(ctx
);
7161 FLUSH_VERTICES(ctx
, 0);
7162 CALL_ReadPixels(ctx
->Exec
, (x
, y
, width
, height
, format
, type
, pixels
));
7165 static GLint GLAPIENTRY
7166 exec_RenderMode(GLenum mode
)
7168 GET_CURRENT_CONTEXT(ctx
);
7169 FLUSH_VERTICES(ctx
, 0);
7170 return CALL_RenderMode(ctx
->Exec
, (mode
));
7173 static void GLAPIENTRY
7174 exec_FeedbackBuffer(GLsizei size
, GLenum type
, GLfloat
* buffer
)
7176 GET_CURRENT_CONTEXT(ctx
);
7177 FLUSH_VERTICES(ctx
, 0);
7178 CALL_FeedbackBuffer(ctx
->Exec
, (size
, type
, buffer
));
7181 static void GLAPIENTRY
7182 exec_SelectBuffer(GLsizei size
, GLuint
* buffer
)
7184 GET_CURRENT_CONTEXT(ctx
);
7185 FLUSH_VERTICES(ctx
, 0);
7186 CALL_SelectBuffer(ctx
->Exec
, (size
, buffer
));
7189 static GLboolean GLAPIENTRY
7190 exec_AreTexturesResident(GLsizei n
, const GLuint
* texName
,
7191 GLboolean
* residences
)
7193 GET_CURRENT_CONTEXT(ctx
);
7194 FLUSH_VERTICES(ctx
, 0);
7195 return CALL_AreTexturesResident(ctx
->Exec
, (n
, texName
, residences
));
7198 static void GLAPIENTRY
7199 exec_ColorPointer(GLint size
, GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
7201 GET_CURRENT_CONTEXT(ctx
);
7202 FLUSH_VERTICES(ctx
, 0);
7203 CALL_ColorPointer(ctx
->Exec
, (size
, type
, stride
, ptr
));
7206 static void GLAPIENTRY
7207 exec_DeleteTextures(GLsizei n
, const GLuint
* texName
)
7209 GET_CURRENT_CONTEXT(ctx
);
7210 FLUSH_VERTICES(ctx
, 0);
7211 CALL_DeleteTextures(ctx
->Exec
, (n
, texName
));
7214 static void GLAPIENTRY
7215 exec_DisableClientState(GLenum cap
)
7217 GET_CURRENT_CONTEXT(ctx
);
7218 FLUSH_VERTICES(ctx
, 0);
7219 CALL_DisableClientState(ctx
->Exec
, (cap
));
7222 static void GLAPIENTRY
7223 exec_EdgeFlagPointer(GLsizei stride
, const GLvoid
* vptr
)
7225 GET_CURRENT_CONTEXT(ctx
);
7226 FLUSH_VERTICES(ctx
, 0);
7227 CALL_EdgeFlagPointer(ctx
->Exec
, (stride
, vptr
));
7230 static void GLAPIENTRY
7231 exec_EnableClientState(GLenum cap
)
7233 GET_CURRENT_CONTEXT(ctx
);
7234 FLUSH_VERTICES(ctx
, 0);
7235 CALL_EnableClientState(ctx
->Exec
, (cap
));
7238 static void GLAPIENTRY
7239 exec_GenTextures(GLsizei n
, GLuint
* texName
)
7241 GET_CURRENT_CONTEXT(ctx
);
7242 FLUSH_VERTICES(ctx
, 0);
7243 CALL_GenTextures(ctx
->Exec
, (n
, texName
));
7246 static void GLAPIENTRY
7247 exec_GetPointerv(GLenum pname
, GLvoid
**params
)
7249 GET_CURRENT_CONTEXT(ctx
);
7250 FLUSH_VERTICES(ctx
, 0);
7251 CALL_GetPointerv(ctx
->Exec
, (pname
, params
));
7254 static void GLAPIENTRY
7255 exec_IndexPointer(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
7257 GET_CURRENT_CONTEXT(ctx
);
7258 FLUSH_VERTICES(ctx
, 0);
7259 CALL_IndexPointer(ctx
->Exec
, (type
, stride
, ptr
));
7262 static void GLAPIENTRY
7263 exec_InterleavedArrays(GLenum format
, GLsizei stride
, const GLvoid
* pointer
)
7265 GET_CURRENT_CONTEXT(ctx
);
7266 FLUSH_VERTICES(ctx
, 0);
7267 CALL_InterleavedArrays(ctx
->Exec
, (format
, stride
, pointer
));
7270 static GLboolean GLAPIENTRY
7271 exec_IsTexture(GLuint texture
)
7273 GET_CURRENT_CONTEXT(ctx
);
7274 FLUSH_VERTICES(ctx
, 0);
7275 return CALL_IsTexture(ctx
->Exec
, (texture
));
7278 static void GLAPIENTRY
7279 exec_NormalPointer(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
7281 GET_CURRENT_CONTEXT(ctx
);
7282 FLUSH_VERTICES(ctx
, 0);
7283 CALL_NormalPointer(ctx
->Exec
, (type
, stride
, ptr
));
7286 static void GLAPIENTRY
7287 exec_PopClientAttrib(void)
7289 GET_CURRENT_CONTEXT(ctx
);
7290 FLUSH_VERTICES(ctx
, 0);
7291 CALL_PopClientAttrib(ctx
->Exec
, ());
7294 static void GLAPIENTRY
7295 exec_PushClientAttrib(GLbitfield mask
)
7297 GET_CURRENT_CONTEXT(ctx
);
7298 FLUSH_VERTICES(ctx
, 0);
7299 CALL_PushClientAttrib(ctx
->Exec
, (mask
));
7302 static void GLAPIENTRY
7303 exec_TexCoordPointer(GLint size
, GLenum type
, GLsizei stride
,
7306 GET_CURRENT_CONTEXT(ctx
);
7307 FLUSH_VERTICES(ctx
, 0);
7308 CALL_TexCoordPointer(ctx
->Exec
, (size
, type
, stride
, ptr
));
7311 static void GLAPIENTRY
7312 exec_GetCompressedTexImageARB(GLenum target
, GLint level
, GLvoid
* img
)
7314 GET_CURRENT_CONTEXT(ctx
);
7315 FLUSH_VERTICES(ctx
, 0);
7316 CALL_GetCompressedTexImageARB(ctx
->Exec
, (target
, level
, img
));
7319 static void GLAPIENTRY
7320 exec_VertexPointer(GLint size
, GLenum type
, GLsizei stride
,
7323 GET_CURRENT_CONTEXT(ctx
);
7324 FLUSH_VERTICES(ctx
, 0);
7325 CALL_VertexPointer(ctx
->Exec
, (size
, type
, stride
, ptr
));
7328 static void GLAPIENTRY
7329 exec_CopyConvolutionFilter1D(GLenum target
, GLenum internalFormat
,
7330 GLint x
, GLint y
, GLsizei width
)
7332 GET_CURRENT_CONTEXT(ctx
);
7333 FLUSH_VERTICES(ctx
, 0);
7334 CALL_CopyConvolutionFilter1D(ctx
->Exec
,
7335 (target
, internalFormat
, x
, y
, width
));
7338 static void GLAPIENTRY
7339 exec_CopyConvolutionFilter2D(GLenum target
, GLenum internalFormat
,
7340 GLint x
, GLint y
, GLsizei width
, GLsizei height
)
7342 GET_CURRENT_CONTEXT(ctx
);
7343 FLUSH_VERTICES(ctx
, 0);
7344 CALL_CopyConvolutionFilter2D(ctx
->Exec
,
7345 (target
, internalFormat
, x
, y
, width
,
7349 static void GLAPIENTRY
7350 exec_GetColorTable(GLenum target
, GLenum format
, GLenum type
, GLvoid
* data
)
7352 GET_CURRENT_CONTEXT(ctx
);
7353 FLUSH_VERTICES(ctx
, 0);
7354 CALL_GetColorTable(ctx
->Exec
, (target
, format
, type
, data
));
7357 static void GLAPIENTRY
7358 exec_GetColorTableParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7360 GET_CURRENT_CONTEXT(ctx
);
7361 FLUSH_VERTICES(ctx
, 0);
7362 CALL_GetColorTableParameterfv(ctx
->Exec
, (target
, pname
, params
));
7365 static void GLAPIENTRY
7366 exec_GetColorTableParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7368 GET_CURRENT_CONTEXT(ctx
);
7369 FLUSH_VERTICES(ctx
, 0);
7370 CALL_GetColorTableParameteriv(ctx
->Exec
, (target
, pname
, params
));
7373 static void GLAPIENTRY
7374 exec_GetConvolutionFilter(GLenum target
, GLenum format
, GLenum type
,
7377 GET_CURRENT_CONTEXT(ctx
);
7378 FLUSH_VERTICES(ctx
, 0);
7379 CALL_GetConvolutionFilter(ctx
->Exec
, (target
, format
, type
, image
));
7382 static void GLAPIENTRY
7383 exec_GetConvolutionParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7385 GET_CURRENT_CONTEXT(ctx
);
7386 FLUSH_VERTICES(ctx
, 0);
7387 CALL_GetConvolutionParameterfv(ctx
->Exec
, (target
, pname
, params
));
7390 static void GLAPIENTRY
7391 exec_GetConvolutionParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7393 GET_CURRENT_CONTEXT(ctx
);
7394 FLUSH_VERTICES(ctx
, 0);
7395 CALL_GetConvolutionParameteriv(ctx
->Exec
, (target
, pname
, params
));
7398 static void GLAPIENTRY
7399 exec_GetHistogram(GLenum target
, GLboolean reset
, GLenum format
,
7400 GLenum type
, GLvoid
*values
)
7402 GET_CURRENT_CONTEXT(ctx
);
7403 FLUSH_VERTICES(ctx
, 0);
7404 CALL_GetHistogram(ctx
->Exec
, (target
, reset
, format
, type
, values
));
7407 static void GLAPIENTRY
7408 exec_GetHistogramParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7410 GET_CURRENT_CONTEXT(ctx
);
7411 FLUSH_VERTICES(ctx
, 0);
7412 CALL_GetHistogramParameterfv(ctx
->Exec
, (target
, pname
, params
));
7415 static void GLAPIENTRY
7416 exec_GetHistogramParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7418 GET_CURRENT_CONTEXT(ctx
);
7419 FLUSH_VERTICES(ctx
, 0);
7420 CALL_GetHistogramParameteriv(ctx
->Exec
, (target
, pname
, params
));
7423 static void GLAPIENTRY
7424 exec_GetMinmax(GLenum target
, GLboolean reset
, GLenum format
,
7425 GLenum type
, GLvoid
*values
)
7427 GET_CURRENT_CONTEXT(ctx
);
7428 FLUSH_VERTICES(ctx
, 0);
7429 CALL_GetMinmax(ctx
->Exec
, (target
, reset
, format
, type
, values
));
7432 static void GLAPIENTRY
7433 exec_GetMinmaxParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7435 GET_CURRENT_CONTEXT(ctx
);
7436 FLUSH_VERTICES(ctx
, 0);
7437 CALL_GetMinmaxParameterfv(ctx
->Exec
, (target
, pname
, params
));
7440 static void GLAPIENTRY
7441 exec_GetMinmaxParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7443 GET_CURRENT_CONTEXT(ctx
);
7444 FLUSH_VERTICES(ctx
, 0);
7445 CALL_GetMinmaxParameteriv(ctx
->Exec
, (target
, pname
, params
));
7448 static void GLAPIENTRY
7449 exec_GetSeparableFilter(GLenum target
, GLenum format
, GLenum type
,
7450 GLvoid
*row
, GLvoid
*column
, GLvoid
*span
)
7452 GET_CURRENT_CONTEXT(ctx
);
7453 FLUSH_VERTICES(ctx
, 0);
7454 CALL_GetSeparableFilter(ctx
->Exec
,
7455 (target
, format
, type
, row
, column
, span
));
7458 static void GLAPIENTRY
7459 exec_SeparableFilter2D(GLenum target
, GLenum internalFormat
,
7460 GLsizei width
, GLsizei height
, GLenum format
,
7461 GLenum type
, const GLvoid
*row
, const GLvoid
*column
)
7463 GET_CURRENT_CONTEXT(ctx
);
7464 FLUSH_VERTICES(ctx
, 0);
7465 CALL_SeparableFilter2D(ctx
->Exec
,
7466 (target
, internalFormat
, width
, height
, format
,
7467 type
, row
, column
));
7470 static void GLAPIENTRY
7471 exec_ColorPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
7472 GLsizei count
, const GLvoid
*ptr
)
7474 GET_CURRENT_CONTEXT(ctx
);
7475 FLUSH_VERTICES(ctx
, 0);
7476 CALL_ColorPointerEXT(ctx
->Exec
, (size
, type
, stride
, count
, ptr
));
7479 static void GLAPIENTRY
7480 exec_EdgeFlagPointerEXT(GLsizei stride
, GLsizei count
, const GLboolean
*ptr
)
7482 GET_CURRENT_CONTEXT(ctx
);
7483 FLUSH_VERTICES(ctx
, 0);
7484 CALL_EdgeFlagPointerEXT(ctx
->Exec
, (stride
, count
, ptr
));
7487 static void GLAPIENTRY
7488 exec_IndexPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
,
7491 GET_CURRENT_CONTEXT(ctx
);
7492 FLUSH_VERTICES(ctx
, 0);
7493 CALL_IndexPointerEXT(ctx
->Exec
, (type
, stride
, count
, ptr
));
7496 static void GLAPIENTRY
7497 exec_NormalPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
,
7500 GET_CURRENT_CONTEXT(ctx
);
7501 FLUSH_VERTICES(ctx
, 0);
7502 CALL_NormalPointerEXT(ctx
->Exec
, (type
, stride
, count
, ptr
));
7505 static void GLAPIENTRY
7506 exec_TexCoordPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
7507 GLsizei count
, const GLvoid
*ptr
)
7509 GET_CURRENT_CONTEXT(ctx
);
7510 FLUSH_VERTICES(ctx
, 0);
7511 CALL_TexCoordPointerEXT(ctx
->Exec
, (size
, type
, stride
, count
, ptr
));
7514 static void GLAPIENTRY
7515 exec_VertexPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
7516 GLsizei count
, const GLvoid
*ptr
)
7518 GET_CURRENT_CONTEXT(ctx
);
7519 FLUSH_VERTICES(ctx
, 0);
7520 CALL_VertexPointerEXT(ctx
->Exec
, (size
, type
, stride
, count
, ptr
));
7523 static void GLAPIENTRY
7524 exec_LockArraysEXT(GLint first
, GLsizei count
)
7526 GET_CURRENT_CONTEXT(ctx
);
7527 FLUSH_VERTICES(ctx
, 0);
7528 CALL_LockArraysEXT(ctx
->Exec
, (first
, count
));
7531 static void GLAPIENTRY
7532 exec_UnlockArraysEXT(void)
7534 GET_CURRENT_CONTEXT(ctx
);
7535 FLUSH_VERTICES(ctx
, 0);
7536 CALL_UnlockArraysEXT(ctx
->Exec
, ());
7539 static void GLAPIENTRY
7540 exec_ClientActiveTextureARB(GLenum target
)
7542 GET_CURRENT_CONTEXT(ctx
);
7543 FLUSH_VERTICES(ctx
, 0);
7544 CALL_ClientActiveTextureARB(ctx
->Exec
, (target
));
7547 static void GLAPIENTRY
7548 exec_SecondaryColorPointerEXT(GLint size
, GLenum type
,
7549 GLsizei stride
, const GLvoid
*ptr
)
7551 GET_CURRENT_CONTEXT(ctx
);
7552 FLUSH_VERTICES(ctx
, 0);
7553 CALL_SecondaryColorPointerEXT(ctx
->Exec
, (size
, type
, stride
, ptr
));
7556 static void GLAPIENTRY
7557 exec_FogCoordPointerEXT(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
7559 GET_CURRENT_CONTEXT(ctx
);
7560 FLUSH_VERTICES(ctx
, 0);
7561 CALL_FogCoordPointerEXT(ctx
->Exec
, (type
, stride
, ptr
));
7564 /* GL_EXT_multi_draw_arrays */
7565 static void GLAPIENTRY
7566 exec_MultiDrawArraysEXT(GLenum mode
, GLint
* first
,
7567 GLsizei
* count
, GLsizei primcount
)
7569 GET_CURRENT_CONTEXT(ctx
);
7570 FLUSH_VERTICES(ctx
, 0);
7571 CALL_MultiDrawArraysEXT(ctx
->Exec
, (mode
, first
, count
, primcount
));
7574 /* GL_EXT_multi_draw_arrays */
7575 static void GLAPIENTRY
7576 exec_MultiDrawElementsEXT(GLenum mode
, const GLsizei
* count
,
7577 GLenum type
, const GLvoid
** indices
,
7580 GET_CURRENT_CONTEXT(ctx
);
7581 FLUSH_VERTICES(ctx
, 0);
7582 CALL_MultiDrawElementsEXT(ctx
->Exec
,
7583 (mode
, count
, type
, indices
, primcount
));
7586 /* GL_IBM_multimode_draw_arrays */
7587 static void GLAPIENTRY
7588 exec_MultiModeDrawArraysIBM(const GLenum
* mode
, const GLint
* first
,
7589 const GLsizei
* count
, GLsizei primcount
,
7592 GET_CURRENT_CONTEXT(ctx
);
7593 FLUSH_VERTICES(ctx
, 0);
7594 CALL_MultiModeDrawArraysIBM(ctx
->Exec
,
7595 (mode
, first
, count
, primcount
, modestride
));
7598 /* GL_IBM_multimode_draw_arrays */
7599 static void GLAPIENTRY
7600 exec_MultiModeDrawElementsIBM(const GLenum
* mode
,
7601 const GLsizei
* count
,
7603 const GLvoid
* const *indices
,
7604 GLsizei primcount
, GLint modestride
)
7606 GET_CURRENT_CONTEXT(ctx
);
7607 FLUSH_VERTICES(ctx
, 0);
7608 CALL_MultiModeDrawElementsIBM(ctx
->Exec
,
7609 (mode
, count
, type
, indices
, primcount
,
7616 * Setup the given dispatch table to point to Mesa's display list
7617 * building functions.
7619 * This does not include any of the tnl functions - they are
7620 * initialized from _mesa_init_api_defaults and from the active vtxfmt
7624 _mesa_init_dlist_table(struct _glapi_table
*table
)
7626 _mesa_loopback_init_api_table(table
);
7629 SET_Accum(table
, save_Accum
);
7630 SET_AlphaFunc(table
, save_AlphaFunc
);
7631 SET_Bitmap(table
, save_Bitmap
);
7632 SET_BlendFunc(table
, _mesa_BlendFunc
); /* loops-back to BlendFuncSeparate */
7633 SET_CallList(table
, _mesa_save_CallList
);
7634 SET_CallLists(table
, _mesa_save_CallLists
);
7635 SET_Clear(table
, save_Clear
);
7636 SET_ClearAccum(table
, save_ClearAccum
);
7637 SET_ClearColor(table
, save_ClearColor
);
7638 SET_ClearDepth(table
, save_ClearDepth
);
7639 SET_ClearIndex(table
, save_ClearIndex
);
7640 SET_ClearStencil(table
, save_ClearStencil
);
7641 SET_ClipPlane(table
, save_ClipPlane
);
7642 SET_ColorMask(table
, save_ColorMask
);
7643 SET_ColorMaterial(table
, save_ColorMaterial
);
7644 SET_CopyPixels(table
, save_CopyPixels
);
7645 SET_CullFace(table
, save_CullFace
);
7646 SET_DeleteLists(table
, _mesa_DeleteLists
);
7647 SET_DepthFunc(table
, save_DepthFunc
);
7648 SET_DepthMask(table
, save_DepthMask
);
7649 SET_DepthRange(table
, save_DepthRange
);
7650 SET_Disable(table
, save_Disable
);
7651 SET_DrawBuffer(table
, save_DrawBuffer
);
7652 SET_DrawPixels(table
, save_DrawPixels
);
7653 SET_Enable(table
, save_Enable
);
7654 SET_EndList(table
, _mesa_EndList
);
7655 SET_EvalMesh1(table
, _mesa_save_EvalMesh1
);
7656 SET_EvalMesh2(table
, _mesa_save_EvalMesh2
);
7657 SET_Finish(table
, exec_Finish
);
7658 SET_Flush(table
, exec_Flush
);
7659 SET_Fogf(table
, save_Fogf
);
7660 SET_Fogfv(table
, save_Fogfv
);
7661 SET_Fogi(table
, save_Fogi
);
7662 SET_Fogiv(table
, save_Fogiv
);
7663 SET_FrontFace(table
, save_FrontFace
);
7664 SET_Frustum(table
, save_Frustum
);
7665 SET_GenLists(table
, _mesa_GenLists
);
7666 SET_GetBooleanv(table
, exec_GetBooleanv
);
7667 SET_GetClipPlane(table
, exec_GetClipPlane
);
7668 SET_GetDoublev(table
, exec_GetDoublev
);
7669 SET_GetError(table
, exec_GetError
);
7670 SET_GetFloatv(table
, exec_GetFloatv
);
7671 SET_GetIntegerv(table
, exec_GetIntegerv
);
7672 SET_GetLightfv(table
, exec_GetLightfv
);
7673 SET_GetLightiv(table
, exec_GetLightiv
);
7674 SET_GetMapdv(table
, exec_GetMapdv
);
7675 SET_GetMapfv(table
, exec_GetMapfv
);
7676 SET_GetMapiv(table
, exec_GetMapiv
);
7677 SET_GetMaterialfv(table
, exec_GetMaterialfv
);
7678 SET_GetMaterialiv(table
, exec_GetMaterialiv
);
7679 SET_GetPixelMapfv(table
, exec_GetPixelMapfv
);
7680 SET_GetPixelMapuiv(table
, exec_GetPixelMapuiv
);
7681 SET_GetPixelMapusv(table
, exec_GetPixelMapusv
);
7682 SET_GetPolygonStipple(table
, exec_GetPolygonStipple
);
7683 SET_GetString(table
, exec_GetString
);
7684 SET_GetTexEnvfv(table
, exec_GetTexEnvfv
);
7685 SET_GetTexEnviv(table
, exec_GetTexEnviv
);
7686 SET_GetTexGendv(table
, exec_GetTexGendv
);
7687 SET_GetTexGenfv(table
, exec_GetTexGenfv
);
7688 SET_GetTexGeniv(table
, exec_GetTexGeniv
);
7689 SET_GetTexImage(table
, exec_GetTexImage
);
7690 SET_GetTexLevelParameterfv(table
, exec_GetTexLevelParameterfv
);
7691 SET_GetTexLevelParameteriv(table
, exec_GetTexLevelParameteriv
);
7692 SET_GetTexParameterfv(table
, exec_GetTexParameterfv
);
7693 SET_GetTexParameteriv(table
, exec_GetTexParameteriv
);
7694 SET_Hint(table
, save_Hint
);
7695 SET_IndexMask(table
, save_IndexMask
);
7696 SET_InitNames(table
, save_InitNames
);
7697 SET_IsEnabled(table
, exec_IsEnabled
);
7698 SET_IsList(table
, _mesa_IsList
);
7699 SET_LightModelf(table
, save_LightModelf
);
7700 SET_LightModelfv(table
, save_LightModelfv
);
7701 SET_LightModeli(table
, save_LightModeli
);
7702 SET_LightModeliv(table
, save_LightModeliv
);
7703 SET_Lightf(table
, save_Lightf
);
7704 SET_Lightfv(table
, save_Lightfv
);
7705 SET_Lighti(table
, save_Lighti
);
7706 SET_Lightiv(table
, save_Lightiv
);
7707 SET_LineStipple(table
, save_LineStipple
);
7708 SET_LineWidth(table
, save_LineWidth
);
7709 SET_ListBase(table
, save_ListBase
);
7710 SET_LoadIdentity(table
, save_LoadIdentity
);
7711 SET_LoadMatrixd(table
, save_LoadMatrixd
);
7712 SET_LoadMatrixf(table
, save_LoadMatrixf
);
7713 SET_LoadName(table
, save_LoadName
);
7714 SET_LogicOp(table
, save_LogicOp
);
7715 SET_Map1d(table
, save_Map1d
);
7716 SET_Map1f(table
, save_Map1f
);
7717 SET_Map2d(table
, save_Map2d
);
7718 SET_Map2f(table
, save_Map2f
);
7719 SET_MapGrid1d(table
, save_MapGrid1d
);
7720 SET_MapGrid1f(table
, save_MapGrid1f
);
7721 SET_MapGrid2d(table
, save_MapGrid2d
);
7722 SET_MapGrid2f(table
, save_MapGrid2f
);
7723 SET_MatrixMode(table
, save_MatrixMode
);
7724 SET_MultMatrixd(table
, save_MultMatrixd
);
7725 SET_MultMatrixf(table
, save_MultMatrixf
);
7726 SET_NewList(table
, save_NewList
);
7727 SET_Ortho(table
, save_Ortho
);
7728 SET_PassThrough(table
, save_PassThrough
);
7729 SET_PixelMapfv(table
, save_PixelMapfv
);
7730 SET_PixelMapuiv(table
, save_PixelMapuiv
);
7731 SET_PixelMapusv(table
, save_PixelMapusv
);
7732 SET_PixelStoref(table
, exec_PixelStoref
);
7733 SET_PixelStorei(table
, exec_PixelStorei
);
7734 SET_PixelTransferf(table
, save_PixelTransferf
);
7735 SET_PixelTransferi(table
, save_PixelTransferi
);
7736 SET_PixelZoom(table
, save_PixelZoom
);
7737 SET_PointSize(table
, save_PointSize
);
7738 SET_PolygonMode(table
, save_PolygonMode
);
7739 SET_PolygonOffset(table
, save_PolygonOffset
);
7740 SET_PolygonStipple(table
, save_PolygonStipple
);
7741 SET_PopAttrib(table
, save_PopAttrib
);
7742 SET_PopMatrix(table
, save_PopMatrix
);
7743 SET_PopName(table
, save_PopName
);
7744 SET_PushAttrib(table
, save_PushAttrib
);
7745 SET_PushMatrix(table
, save_PushMatrix
);
7746 SET_PushName(table
, save_PushName
);
7747 SET_RasterPos2d(table
, save_RasterPos2d
);
7748 SET_RasterPos2dv(table
, save_RasterPos2dv
);
7749 SET_RasterPos2f(table
, save_RasterPos2f
);
7750 SET_RasterPos2fv(table
, save_RasterPos2fv
);
7751 SET_RasterPos2i(table
, save_RasterPos2i
);
7752 SET_RasterPos2iv(table
, save_RasterPos2iv
);
7753 SET_RasterPos2s(table
, save_RasterPos2s
);
7754 SET_RasterPos2sv(table
, save_RasterPos2sv
);
7755 SET_RasterPos3d(table
, save_RasterPos3d
);
7756 SET_RasterPos3dv(table
, save_RasterPos3dv
);
7757 SET_RasterPos3f(table
, save_RasterPos3f
);
7758 SET_RasterPos3fv(table
, save_RasterPos3fv
);
7759 SET_RasterPos3i(table
, save_RasterPos3i
);
7760 SET_RasterPos3iv(table
, save_RasterPos3iv
);
7761 SET_RasterPos3s(table
, save_RasterPos3s
);
7762 SET_RasterPos3sv(table
, save_RasterPos3sv
);
7763 SET_RasterPos4d(table
, save_RasterPos4d
);
7764 SET_RasterPos4dv(table
, save_RasterPos4dv
);
7765 SET_RasterPos4f(table
, save_RasterPos4f
);
7766 SET_RasterPos4fv(table
, save_RasterPos4fv
);
7767 SET_RasterPos4i(table
, save_RasterPos4i
);
7768 SET_RasterPos4iv(table
, save_RasterPos4iv
);
7769 SET_RasterPos4s(table
, save_RasterPos4s
);
7770 SET_RasterPos4sv(table
, save_RasterPos4sv
);
7771 SET_ReadBuffer(table
, save_ReadBuffer
);
7772 SET_ReadPixels(table
, exec_ReadPixels
);
7773 SET_RenderMode(table
, exec_RenderMode
);
7774 SET_Rotated(table
, save_Rotated
);
7775 SET_Rotatef(table
, save_Rotatef
);
7776 SET_Scaled(table
, save_Scaled
);
7777 SET_Scalef(table
, save_Scalef
);
7778 SET_Scissor(table
, save_Scissor
);
7779 SET_FeedbackBuffer(table
, exec_FeedbackBuffer
);
7780 SET_SelectBuffer(table
, exec_SelectBuffer
);
7781 SET_ShadeModel(table
, save_ShadeModel
);
7782 SET_StencilFunc(table
, save_StencilFunc
);
7783 SET_StencilMask(table
, save_StencilMask
);
7784 SET_StencilOp(table
, save_StencilOp
);
7785 SET_TexEnvf(table
, save_TexEnvf
);
7786 SET_TexEnvfv(table
, save_TexEnvfv
);
7787 SET_TexEnvi(table
, save_TexEnvi
);
7788 SET_TexEnviv(table
, save_TexEnviv
);
7789 SET_TexGend(table
, save_TexGend
);
7790 SET_TexGendv(table
, save_TexGendv
);
7791 SET_TexGenf(table
, save_TexGenf
);
7792 SET_TexGenfv(table
, save_TexGenfv
);
7793 SET_TexGeni(table
, save_TexGeni
);
7794 SET_TexGeniv(table
, save_TexGeniv
);
7795 SET_TexImage1D(table
, save_TexImage1D
);
7796 SET_TexImage2D(table
, save_TexImage2D
);
7797 SET_TexParameterf(table
, save_TexParameterf
);
7798 SET_TexParameterfv(table
, save_TexParameterfv
);
7799 SET_TexParameteri(table
, save_TexParameteri
);
7800 SET_TexParameteriv(table
, save_TexParameteriv
);
7801 SET_Translated(table
, save_Translated
);
7802 SET_Translatef(table
, save_Translatef
);
7803 SET_Viewport(table
, save_Viewport
);
7806 SET_AreTexturesResident(table
, exec_AreTexturesResident
);
7807 SET_BindTexture(table
, save_BindTexture
);
7808 SET_ColorPointer(table
, exec_ColorPointer
);
7809 SET_CopyTexImage1D(table
, save_CopyTexImage1D
);
7810 SET_CopyTexImage2D(table
, save_CopyTexImage2D
);
7811 SET_CopyTexSubImage1D(table
, save_CopyTexSubImage1D
);
7812 SET_CopyTexSubImage2D(table
, save_CopyTexSubImage2D
);
7813 SET_DeleteTextures(table
, exec_DeleteTextures
);
7814 SET_DisableClientState(table
, exec_DisableClientState
);
7815 SET_EdgeFlagPointer(table
, exec_EdgeFlagPointer
);
7816 SET_EnableClientState(table
, exec_EnableClientState
);
7817 SET_GenTextures(table
, exec_GenTextures
);
7818 SET_GetPointerv(table
, exec_GetPointerv
);
7819 SET_IndexPointer(table
, exec_IndexPointer
);
7820 SET_InterleavedArrays(table
, exec_InterleavedArrays
);
7821 SET_IsTexture(table
, exec_IsTexture
);
7822 SET_NormalPointer(table
, exec_NormalPointer
);
7823 SET_PopClientAttrib(table
, exec_PopClientAttrib
);
7824 SET_PrioritizeTextures(table
, save_PrioritizeTextures
);
7825 SET_PushClientAttrib(table
, exec_PushClientAttrib
);
7826 SET_TexCoordPointer(table
, exec_TexCoordPointer
);
7827 SET_TexSubImage1D(table
, save_TexSubImage1D
);
7828 SET_TexSubImage2D(table
, save_TexSubImage2D
);
7829 SET_VertexPointer(table
, exec_VertexPointer
);
7832 SET_CopyTexSubImage3D(table
, save_CopyTexSubImage3D
);
7833 SET_TexImage3D(table
, save_TexImage3D
);
7834 SET_TexSubImage3D(table
, save_TexSubImage3D
);
7837 SET_StencilFuncSeparate(table
, save_StencilFuncSeparate
);
7838 SET_StencilMaskSeparate(table
, save_StencilMaskSeparate
);
7839 SET_StencilOpSeparate(table
, save_StencilOpSeparate
);
7841 /* GL_ARB_imaging */
7842 /* Not all are supported */
7843 SET_BlendColor(table
, save_BlendColor
);
7844 SET_BlendEquation(table
, save_BlendEquation
);
7845 SET_ColorSubTable(table
, save_ColorSubTable
);
7846 SET_ColorTable(table
, save_ColorTable
);
7847 SET_ColorTableParameterfv(table
, save_ColorTableParameterfv
);
7848 SET_ColorTableParameteriv(table
, save_ColorTableParameteriv
);
7849 SET_ConvolutionFilter1D(table
, save_ConvolutionFilter1D
);
7850 SET_ConvolutionFilter2D(table
, save_ConvolutionFilter2D
);
7851 SET_ConvolutionParameterf(table
, save_ConvolutionParameterf
);
7852 SET_ConvolutionParameterfv(table
, save_ConvolutionParameterfv
);
7853 SET_ConvolutionParameteri(table
, save_ConvolutionParameteri
);
7854 SET_ConvolutionParameteriv(table
, save_ConvolutionParameteriv
);
7855 SET_CopyColorSubTable(table
, save_CopyColorSubTable
);
7856 SET_CopyColorTable(table
, save_CopyColorTable
);
7857 SET_CopyConvolutionFilter1D(table
, exec_CopyConvolutionFilter1D
);
7858 SET_CopyConvolutionFilter2D(table
, exec_CopyConvolutionFilter2D
);
7859 SET_GetColorTable(table
, exec_GetColorTable
);
7860 SET_GetColorTableParameterfv(table
, exec_GetColorTableParameterfv
);
7861 SET_GetColorTableParameteriv(table
, exec_GetColorTableParameteriv
);
7862 SET_GetConvolutionFilter(table
, exec_GetConvolutionFilter
);
7863 SET_GetConvolutionParameterfv(table
, exec_GetConvolutionParameterfv
);
7864 SET_GetConvolutionParameteriv(table
, exec_GetConvolutionParameteriv
);
7865 SET_GetHistogram(table
, exec_GetHistogram
);
7866 SET_GetHistogramParameterfv(table
, exec_GetHistogramParameterfv
);
7867 SET_GetHistogramParameteriv(table
, exec_GetHistogramParameteriv
);
7868 SET_GetMinmax(table
, exec_GetMinmax
);
7869 SET_GetMinmaxParameterfv(table
, exec_GetMinmaxParameterfv
);
7870 SET_GetMinmaxParameteriv(table
, exec_GetMinmaxParameteriv
);
7871 SET_GetSeparableFilter(table
, exec_GetSeparableFilter
);
7872 SET_Histogram(table
, save_Histogram
);
7873 SET_Minmax(table
, save_Minmax
);
7874 SET_ResetHistogram(table
, save_ResetHistogram
);
7875 SET_ResetMinmax(table
, save_ResetMinmax
);
7876 SET_SeparableFilter2D(table
, exec_SeparableFilter2D
);
7878 /* 2. GL_EXT_blend_color */
7880 SET_BlendColorEXT(table
, save_BlendColorEXT
);
7883 /* 3. GL_EXT_polygon_offset */
7884 SET_PolygonOffsetEXT(table
, save_PolygonOffsetEXT
);
7886 /* 6. GL_EXT_texture3d */
7888 SET_CopyTexSubImage3DEXT(table
, save_CopyTexSubImage3D
);
7889 SET_TexImage3DEXT(table
, save_TexImage3DEXT
);
7890 SET_TexSubImage3DEXT(table
, save_TexSubImage3D
);
7893 /* 14. GL_SGI_color_table */
7895 SET_ColorTableSGI(table
, save_ColorTable
);
7896 SET_ColorSubTableSGI(table
, save_ColorSubTable
);
7897 SET_GetColorTableSGI(table
, exec_GetColorTable
);
7898 SET_GetColorTableParameterfvSGI(table
, exec_GetColorTableParameterfv
);
7899 SET_GetColorTableParameterivSGI(table
, exec_GetColorTableParameteriv
);
7902 /* 30. GL_EXT_vertex_array */
7903 SET_ColorPointerEXT(table
, exec_ColorPointerEXT
);
7904 SET_EdgeFlagPointerEXT(table
, exec_EdgeFlagPointerEXT
);
7905 SET_IndexPointerEXT(table
, exec_IndexPointerEXT
);
7906 SET_NormalPointerEXT(table
, exec_NormalPointerEXT
);
7907 SET_TexCoordPointerEXT(table
, exec_TexCoordPointerEXT
);
7908 SET_VertexPointerEXT(table
, exec_VertexPointerEXT
);
7910 /* 37. GL_EXT_blend_minmax */
7912 SET_BlendEquationEXT(table
, save_BlendEquationEXT
);
7915 /* 54. GL_EXT_point_parameters */
7916 SET_PointParameterfEXT(table
, save_PointParameterfEXT
);
7917 SET_PointParameterfvEXT(table
, save_PointParameterfvEXT
);
7919 /* 97. GL_EXT_compiled_vertex_array */
7920 SET_LockArraysEXT(table
, exec_LockArraysEXT
);
7921 SET_UnlockArraysEXT(table
, exec_UnlockArraysEXT
);
7923 /* 145. GL_EXT_secondary_color */
7924 SET_SecondaryColorPointerEXT(table
, exec_SecondaryColorPointerEXT
);
7926 /* 148. GL_EXT_multi_draw_arrays */
7927 SET_MultiDrawArraysEXT(table
, exec_MultiDrawArraysEXT
);
7928 SET_MultiDrawElementsEXT(table
, exec_MultiDrawElementsEXT
);
7930 /* 149. GL_EXT_fog_coord */
7931 SET_FogCoordPointerEXT(table
, exec_FogCoordPointerEXT
);
7933 /* 173. GL_EXT_blend_func_separate */
7934 SET_BlendFuncSeparateEXT(table
, save_BlendFuncSeparateEXT
);
7936 /* 196. GL_MESA_resize_buffers */
7937 SET_ResizeBuffersMESA(table
, _mesa_ResizeBuffersMESA
);
7939 /* 197. GL_MESA_window_pos */
7940 SET_WindowPos2dMESA(table
, save_WindowPos2dMESA
);
7941 SET_WindowPos2dvMESA(table
, save_WindowPos2dvMESA
);
7942 SET_WindowPos2fMESA(table
, save_WindowPos2fMESA
);
7943 SET_WindowPos2fvMESA(table
, save_WindowPos2fvMESA
);
7944 SET_WindowPos2iMESA(table
, save_WindowPos2iMESA
);
7945 SET_WindowPos2ivMESA(table
, save_WindowPos2ivMESA
);
7946 SET_WindowPos2sMESA(table
, save_WindowPos2sMESA
);
7947 SET_WindowPos2svMESA(table
, save_WindowPos2svMESA
);
7948 SET_WindowPos3dMESA(table
, save_WindowPos3dMESA
);
7949 SET_WindowPos3dvMESA(table
, save_WindowPos3dvMESA
);
7950 SET_WindowPos3fMESA(table
, save_WindowPos3fMESA
);
7951 SET_WindowPos3fvMESA(table
, save_WindowPos3fvMESA
);
7952 SET_WindowPos3iMESA(table
, save_WindowPos3iMESA
);
7953 SET_WindowPos3ivMESA(table
, save_WindowPos3ivMESA
);
7954 SET_WindowPos3sMESA(table
, save_WindowPos3sMESA
);
7955 SET_WindowPos3svMESA(table
, save_WindowPos3svMESA
);
7956 SET_WindowPos4dMESA(table
, save_WindowPos4dMESA
);
7957 SET_WindowPos4dvMESA(table
, save_WindowPos4dvMESA
);
7958 SET_WindowPos4fMESA(table
, save_WindowPos4fMESA
);
7959 SET_WindowPos4fvMESA(table
, save_WindowPos4fvMESA
);
7960 SET_WindowPos4iMESA(table
, save_WindowPos4iMESA
);
7961 SET_WindowPos4ivMESA(table
, save_WindowPos4ivMESA
);
7962 SET_WindowPos4sMESA(table
, save_WindowPos4sMESA
);
7963 SET_WindowPos4svMESA(table
, save_WindowPos4svMESA
);
7965 /* 200. GL_IBM_multimode_draw_arrays */
7966 SET_MultiModeDrawArraysIBM(table
, exec_MultiModeDrawArraysIBM
);
7967 SET_MultiModeDrawElementsIBM(table
, exec_MultiModeDrawElementsIBM
);
7969 #if FEATURE_NV_vertex_program
7970 /* 233. GL_NV_vertex_program */
7971 /* The following commands DO NOT go into display lists:
7972 * AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV,
7973 * VertexAttribPointerNV, GetProgram*, GetVertexAttrib*
7975 SET_BindProgramNV(table
, save_BindProgramNV
);
7976 SET_DeleteProgramsNV(table
, _mesa_DeletePrograms
);
7977 SET_ExecuteProgramNV(table
, save_ExecuteProgramNV
);
7978 SET_GenProgramsNV(table
, _mesa_GenPrograms
);
7979 SET_AreProgramsResidentNV(table
, _mesa_AreProgramsResidentNV
);
7980 SET_RequestResidentProgramsNV(table
, save_RequestResidentProgramsNV
);
7981 SET_GetProgramParameterfvNV(table
, _mesa_GetProgramParameterfvNV
);
7982 SET_GetProgramParameterdvNV(table
, _mesa_GetProgramParameterdvNV
);
7983 SET_GetProgramivNV(table
, _mesa_GetProgramivNV
);
7984 SET_GetProgramStringNV(table
, _mesa_GetProgramStringNV
);
7985 SET_GetTrackMatrixivNV(table
, _mesa_GetTrackMatrixivNV
);
7986 SET_GetVertexAttribdvNV(table
, _mesa_GetVertexAttribdvNV
);
7987 SET_GetVertexAttribfvNV(table
, _mesa_GetVertexAttribfvNV
);
7988 SET_GetVertexAttribivNV(table
, _mesa_GetVertexAttribivNV
);
7989 SET_GetVertexAttribPointervNV(table
, _mesa_GetVertexAttribPointervNV
);
7990 SET_IsProgramNV(table
, _mesa_IsProgramARB
);
7991 SET_LoadProgramNV(table
, save_LoadProgramNV
);
7992 SET_ProgramEnvParameter4dARB(table
, save_ProgramEnvParameter4dARB
);
7993 SET_ProgramEnvParameter4dvARB(table
, save_ProgramEnvParameter4dvARB
);
7994 SET_ProgramEnvParameter4fARB(table
, save_ProgramEnvParameter4fARB
);
7995 SET_ProgramEnvParameter4fvARB(table
, save_ProgramEnvParameter4fvARB
);
7996 SET_ProgramParameters4dvNV(table
, save_ProgramParameters4dvNV
);
7997 SET_ProgramParameters4fvNV(table
, save_ProgramParameters4fvNV
);
7998 SET_TrackMatrixNV(table
, save_TrackMatrixNV
);
7999 SET_VertexAttribPointerNV(table
, _mesa_VertexAttribPointerNV
);
8002 /* 245. GL_ATI_fragment_shader */
8003 #if FEATURE_ATI_fragment_shader
8004 SET_BindFragmentShaderATI(table
, save_BindFragmentShaderATI
);
8005 SET_SetFragmentShaderConstantATI(table
, save_SetFragmentShaderConstantATI
);
8008 /* 282. GL_NV_fragment_program */
8009 #if FEATURE_NV_fragment_program
8010 SET_ProgramNamedParameter4fNV(table
, save_ProgramNamedParameter4fNV
);
8011 SET_ProgramNamedParameter4dNV(table
, save_ProgramNamedParameter4dNV
);
8012 SET_ProgramNamedParameter4fvNV(table
, save_ProgramNamedParameter4fvNV
);
8013 SET_ProgramNamedParameter4dvNV(table
, save_ProgramNamedParameter4dvNV
);
8014 SET_GetProgramNamedParameterfvNV(table
,
8015 _mesa_GetProgramNamedParameterfvNV
);
8016 SET_GetProgramNamedParameterdvNV(table
,
8017 _mesa_GetProgramNamedParameterdvNV
);
8018 SET_ProgramLocalParameter4dARB(table
, save_ProgramLocalParameter4dARB
);
8019 SET_ProgramLocalParameter4dvARB(table
, save_ProgramLocalParameter4dvARB
);
8020 SET_ProgramLocalParameter4fARB(table
, save_ProgramLocalParameter4fARB
);
8021 SET_ProgramLocalParameter4fvARB(table
, save_ProgramLocalParameter4fvARB
);
8022 SET_GetProgramLocalParameterdvARB(table
,
8023 _mesa_GetProgramLocalParameterdvARB
);
8024 SET_GetProgramLocalParameterfvARB(table
,
8025 _mesa_GetProgramLocalParameterfvARB
);
8028 /* 262. GL_NV_point_sprite */
8029 SET_PointParameteriNV(table
, save_PointParameteriNV
);
8030 SET_PointParameterivNV(table
, save_PointParameterivNV
);
8032 /* 268. GL_EXT_stencil_two_side */
8033 SET_ActiveStencilFaceEXT(table
, save_ActiveStencilFaceEXT
);
8035 /* 273. GL_APPLE_vertex_array_object */
8036 SET_BindVertexArrayAPPLE(table
, _mesa_BindVertexArrayAPPLE
);
8037 SET_DeleteVertexArraysAPPLE(table
, _mesa_DeleteVertexArraysAPPLE
);
8038 SET_GenVertexArraysAPPLE(table
, _mesa_GenVertexArraysAPPLE
);
8039 SET_IsVertexArrayAPPLE(table
, _mesa_IsVertexArrayAPPLE
);
8041 /* ???. GL_EXT_depth_bounds_test */
8042 SET_DepthBoundsEXT(table
, save_DepthBoundsEXT
);
8044 /* ARB 1. GL_ARB_multitexture */
8045 SET_ActiveTextureARB(table
, save_ActiveTextureARB
);
8046 SET_ClientActiveTextureARB(table
, exec_ClientActiveTextureARB
);
8048 /* ARB 3. GL_ARB_transpose_matrix */
8049 SET_LoadTransposeMatrixdARB(table
, save_LoadTransposeMatrixdARB
);
8050 SET_LoadTransposeMatrixfARB(table
, save_LoadTransposeMatrixfARB
);
8051 SET_MultTransposeMatrixdARB(table
, save_MultTransposeMatrixdARB
);
8052 SET_MultTransposeMatrixfARB(table
, save_MultTransposeMatrixfARB
);
8054 /* ARB 5. GL_ARB_multisample */
8055 SET_SampleCoverageARB(table
, save_SampleCoverageARB
);
8057 /* ARB 12. GL_ARB_texture_compression */
8058 SET_CompressedTexImage3DARB(table
, save_CompressedTexImage3DARB
);
8059 SET_CompressedTexImage2DARB(table
, save_CompressedTexImage2DARB
);
8060 SET_CompressedTexImage1DARB(table
, save_CompressedTexImage1DARB
);
8061 SET_CompressedTexSubImage3DARB(table
, save_CompressedTexSubImage3DARB
);
8062 SET_CompressedTexSubImage2DARB(table
, save_CompressedTexSubImage2DARB
);
8063 SET_CompressedTexSubImage1DARB(table
, save_CompressedTexSubImage1DARB
);
8064 SET_GetCompressedTexImageARB(table
, exec_GetCompressedTexImageARB
);
8066 /* ARB 14. GL_ARB_point_parameters */
8067 /* aliased with EXT_point_parameters functions */
8069 /* ARB 25. GL_ARB_window_pos */
8070 /* aliased with MESA_window_pos functions */
8072 /* ARB 26. GL_ARB_vertex_program */
8073 /* ARB 27. GL_ARB_fragment_program */
8074 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
8075 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
8076 SET_VertexAttribPointerARB(table
, _mesa_VertexAttribPointerARB
);
8077 SET_EnableVertexAttribArrayARB(table
, _mesa_EnableVertexAttribArrayARB
);
8078 SET_DisableVertexAttribArrayARB(table
, _mesa_DisableVertexAttribArrayARB
);
8079 SET_ProgramStringARB(table
, save_ProgramStringARB
);
8080 SET_BindProgramNV(table
, save_BindProgramNV
);
8081 SET_DeleteProgramsNV(table
, _mesa_DeletePrograms
);
8082 SET_GenProgramsNV(table
, _mesa_GenPrograms
);
8083 SET_IsProgramNV(table
, _mesa_IsProgramARB
);
8084 SET_GetVertexAttribdvNV(table
, _mesa_GetVertexAttribdvNV
);
8085 SET_GetVertexAttribfvNV(table
, _mesa_GetVertexAttribfvNV
);
8086 SET_GetVertexAttribivNV(table
, _mesa_GetVertexAttribivNV
);
8087 SET_GetVertexAttribPointervNV(table
, _mesa_GetVertexAttribPointervNV
);
8088 SET_ProgramEnvParameter4dARB(table
, save_ProgramEnvParameter4dARB
);
8089 SET_ProgramEnvParameter4dvARB(table
, save_ProgramEnvParameter4dvARB
);
8090 SET_ProgramEnvParameter4fARB(table
, save_ProgramEnvParameter4fARB
);
8091 SET_ProgramEnvParameter4fvARB(table
, save_ProgramEnvParameter4fvARB
);
8092 SET_ProgramLocalParameter4dARB(table
, save_ProgramLocalParameter4dARB
);
8093 SET_ProgramLocalParameter4dvARB(table
, save_ProgramLocalParameter4dvARB
);
8094 SET_ProgramLocalParameter4fARB(table
, save_ProgramLocalParameter4fARB
);
8095 SET_ProgramLocalParameter4fvARB(table
, save_ProgramLocalParameter4fvARB
);
8096 SET_GetProgramEnvParameterdvARB(table
, _mesa_GetProgramEnvParameterdvARB
);
8097 SET_GetProgramEnvParameterfvARB(table
, _mesa_GetProgramEnvParameterfvARB
);
8098 SET_GetProgramLocalParameterdvARB(table
,
8099 _mesa_GetProgramLocalParameterdvARB
);
8100 SET_GetProgramLocalParameterfvARB(table
,
8101 _mesa_GetProgramLocalParameterfvARB
);
8102 SET_GetProgramivARB(table
, _mesa_GetProgramivARB
);
8103 SET_GetProgramStringARB(table
, _mesa_GetProgramStringARB
);
8106 /* ARB 28. GL_ARB_vertex_buffer_object */
8107 #if FEATURE_ARB_vertex_buffer_object
8108 /* None of the extension's functions get compiled */
8109 SET_BindBufferARB(table
, _mesa_BindBufferARB
);
8110 SET_BufferDataARB(table
, _mesa_BufferDataARB
);
8111 SET_BufferSubDataARB(table
, _mesa_BufferSubDataARB
);
8112 SET_DeleteBuffersARB(table
, _mesa_DeleteBuffersARB
);
8113 SET_GenBuffersARB(table
, _mesa_GenBuffersARB
);
8114 SET_GetBufferParameterivARB(table
, _mesa_GetBufferParameterivARB
);
8115 SET_GetBufferPointervARB(table
, _mesa_GetBufferPointervARB
);
8116 SET_GetBufferSubDataARB(table
, _mesa_GetBufferSubDataARB
);
8117 SET_IsBufferARB(table
, _mesa_IsBufferARB
);
8118 SET_MapBufferARB(table
, _mesa_MapBufferARB
);
8119 SET_UnmapBufferARB(table
, _mesa_UnmapBufferARB
);
8122 #if FEATURE_ARB_occlusion_query
8123 SET_BeginQueryARB(table
, save_BeginQueryARB
);
8124 SET_EndQueryARB(table
, save_EndQueryARB
);
8125 SET_GenQueriesARB(table
, _mesa_GenQueriesARB
);
8126 SET_DeleteQueriesARB(table
, _mesa_DeleteQueriesARB
);
8127 SET_IsQueryARB(table
, _mesa_IsQueryARB
);
8128 SET_GetQueryivARB(table
, _mesa_GetQueryivARB
);
8129 SET_GetQueryObjectivARB(table
, _mesa_GetQueryObjectivARB
);
8130 SET_GetQueryObjectuivARB(table
, _mesa_GetQueryObjectuivARB
);
8132 SET_DrawBuffersARB(table
, save_DrawBuffersARB
);
8134 #if FEATURE_EXT_framebuffer_blit
8135 SET_BlitFramebufferEXT(table
, save_BlitFramebufferEXT
);
8138 /* ARB 30/31/32. GL_ARB_shader_objects, GL_ARB_vertex/fragment_shader */
8139 SET_BindAttribLocationARB(table
, exec_BindAttribLocationARB
);
8140 SET_GetAttribLocationARB(table
, exec_GetAttribLocationARB
);
8141 /* XXX additional functions need to be implemented here! */
8143 /* 299. GL_EXT_blend_equation_separate */
8144 SET_BlendEquationSeparateEXT(table
, save_BlendEquationSeparateEXT
);
8146 /* GL_EXT_gpu_program_parmaeters */
8147 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
8148 SET_ProgramEnvParameters4fvEXT(table
, save_ProgramEnvParameters4fvEXT
);
8149 SET_ProgramLocalParameters4fvEXT(table
, save_ProgramLocalParameters4fvEXT
);
8156 enum_string(GLenum k
)
8158 return _mesa_lookup_enum_by_nr(k
);
8163 * Print the commands in a display list. For debugging only.
8164 * TODO: many commands aren't handled yet.
8166 static void GLAPIENTRY
8167 print_list(GLcontext
*ctx
, GLuint list
)
8169 struct mesa_display_list
*dlist
;
8173 if (!islist(ctx
, list
)) {
8174 _mesa_printf("%u is not a display list ID\n", list
);
8178 dlist
= lookup_list(ctx
, list
);
8184 _mesa_printf("START-LIST %u, address %p\n", list
, (void *) n
);
8186 done
= n
? GL_FALSE
: GL_TRUE
;
8188 OpCode opcode
= n
[0].opcode
;
8189 GLint i
= (GLint
) n
[0].opcode
- (GLint
) OPCODE_EXT_0
;
8191 if (i
>= 0 && i
< (GLint
) ctx
->ListExt
.NumOpcodes
) {
8192 /* this is a driver-extended opcode */
8193 ctx
->ListExt
.Opcode
[i
].Print(ctx
, &n
[1]);
8194 n
+= ctx
->ListExt
.Opcode
[i
].Size
;
8199 _mesa_printf("Accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
8202 _mesa_printf("Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
8203 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
, (void *) n
[7].data
);
8205 case OPCODE_CALL_LIST
:
8206 _mesa_printf("CallList %d\n", (int) n
[1].ui
);
8208 case OPCODE_CALL_LIST_OFFSET
:
8209 _mesa_printf("CallList %d + offset %u = %u\n", (int) n
[1].ui
,
8210 ctx
->List
.ListBase
, ctx
->List
.ListBase
+ n
[1].ui
);
8212 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
8213 _mesa_printf("ColorTableParameterfv %s %s %f %f %f %f\n",
8214 enum_string(n
[1].e
), enum_string(n
[2].e
),
8215 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8217 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
8218 _mesa_printf("ColorTableParameteriv %s %s %d %d %d %d\n",
8219 enum_string(n
[1].e
), enum_string(n
[2].e
),
8220 n
[3].i
, n
[4].i
, n
[5].i
, n
[6].i
);
8222 case OPCODE_DISABLE
:
8223 _mesa_printf("Disable %s\n", enum_string(n
[1].e
));
8226 _mesa_printf("Enable %s\n", enum_string(n
[1].e
));
8228 case OPCODE_FRUSTUM
:
8229 _mesa_printf("Frustum %g %g %g %g %g %g\n",
8230 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8232 case OPCODE_LINE_STIPPLE
:
8233 _mesa_printf("LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
8235 case OPCODE_LOAD_IDENTITY
:
8236 _mesa_printf("LoadIdentity\n");
8238 case OPCODE_LOAD_MATRIX
:
8239 _mesa_printf("LoadMatrix\n");
8240 _mesa_printf(" %8f %8f %8f %8f\n",
8241 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
8242 _mesa_printf(" %8f %8f %8f %8f\n",
8243 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
8244 _mesa_printf(" %8f %8f %8f %8f\n",
8245 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
8246 _mesa_printf(" %8f %8f %8f %8f\n",
8247 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
8249 case OPCODE_MULT_MATRIX
:
8250 _mesa_printf("MultMatrix (or Rotate)\n");
8251 _mesa_printf(" %8f %8f %8f %8f\n",
8252 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
8253 _mesa_printf(" %8f %8f %8f %8f\n",
8254 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
8255 _mesa_printf(" %8f %8f %8f %8f\n",
8256 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
8257 _mesa_printf(" %8f %8f %8f %8f\n",
8258 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
8261 _mesa_printf("Ortho %g %g %g %g %g %g\n",
8262 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8264 case OPCODE_POP_ATTRIB
:
8265 _mesa_printf("PopAttrib\n");
8267 case OPCODE_POP_MATRIX
:
8268 _mesa_printf("PopMatrix\n");
8270 case OPCODE_POP_NAME
:
8271 _mesa_printf("PopName\n");
8273 case OPCODE_PUSH_ATTRIB
:
8274 _mesa_printf("PushAttrib %x\n", n
[1].bf
);
8276 case OPCODE_PUSH_MATRIX
:
8277 _mesa_printf("PushMatrix\n");
8279 case OPCODE_PUSH_NAME
:
8280 _mesa_printf("PushName %d\n", (int) n
[1].ui
);
8282 case OPCODE_RASTER_POS
:
8283 _mesa_printf("RasterPos %g %g %g %g\n",
8284 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
8287 _mesa_printf("Rotate %g %g %g %g\n",
8288 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
8291 _mesa_printf("Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
8293 case OPCODE_TRANSLATE
:
8294 _mesa_printf("Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
8296 case OPCODE_BIND_TEXTURE
:
8297 _mesa_printf("BindTexture %s %d\n",
8298 _mesa_lookup_enum_by_nr(n
[1].ui
), n
[2].ui
);
8300 case OPCODE_SHADE_MODEL
:
8301 _mesa_printf("ShadeModel %s\n", _mesa_lookup_enum_by_nr(n
[1].ui
));
8304 _mesa_printf("Map1 %s %.3f %.3f %d %d\n",
8305 _mesa_lookup_enum_by_nr(n
[1].ui
),
8306 n
[2].f
, n
[3].f
, n
[4].i
, n
[5].i
);
8309 _mesa_printf("Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
8310 _mesa_lookup_enum_by_nr(n
[1].ui
),
8311 n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
,
8312 n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
8314 case OPCODE_MAPGRID1
:
8315 _mesa_printf("MapGrid1 %d %.3f %.3f\n", n
[1].i
, n
[2].f
, n
[3].f
);
8317 case OPCODE_MAPGRID2
:
8318 _mesa_printf("MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
8319 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
8321 case OPCODE_EVALMESH1
:
8322 _mesa_printf("EvalMesh1 %d %d\n", n
[1].i
, n
[2].i
);
8324 case OPCODE_EVALMESH2
:
8325 _mesa_printf("EvalMesh2 %d %d %d %d\n",
8326 n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
8329 case OPCODE_ATTR_1F_NV
:
8330 _mesa_printf("ATTR_1F_NV attr %d: %f\n", n
[1].i
, n
[2].f
);
8332 case OPCODE_ATTR_2F_NV
:
8333 _mesa_printf("ATTR_2F_NV attr %d: %f %f\n",
8334 n
[1].i
, n
[2].f
, n
[3].f
);
8336 case OPCODE_ATTR_3F_NV
:
8337 _mesa_printf("ATTR_3F_NV attr %d: %f %f %f\n",
8338 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
8340 case OPCODE_ATTR_4F_NV
:
8341 _mesa_printf("ATTR_4F_NV attr %d: %f %f %f %f\n",
8342 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
8344 case OPCODE_ATTR_1F_ARB
:
8345 _mesa_printf("ATTR_1F_ARB attr %d: %f\n", n
[1].i
, n
[2].f
);
8347 case OPCODE_ATTR_2F_ARB
:
8348 _mesa_printf("ATTR_2F_ARB attr %d: %f %f\n",
8349 n
[1].i
, n
[2].f
, n
[3].f
);
8351 case OPCODE_ATTR_3F_ARB
:
8352 _mesa_printf("ATTR_3F_ARB attr %d: %f %f %f\n",
8353 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
8355 case OPCODE_ATTR_4F_ARB
:
8356 _mesa_printf("ATTR_4F_ARB attr %d: %f %f %f %f\n",
8357 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
8360 case OPCODE_MATERIAL
:
8361 _mesa_printf("MATERIAL %x %x: %f %f %f %f\n",
8362 n
[1].i
, n
[2].i
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8365 _mesa_printf("BEGIN %x\n", n
[1].i
);
8368 _mesa_printf("END\n");
8371 _mesa_printf("RECTF %f %f %f %f\n", n
[1].f
, n
[2].f
, n
[3].f
,
8374 case OPCODE_EVAL_C1
:
8375 _mesa_printf("EVAL_C1 %f\n", n
[1].f
);
8377 case OPCODE_EVAL_C2
:
8378 _mesa_printf("EVAL_C2 %f %f\n", n
[1].f
, n
[2].f
);
8380 case OPCODE_EVAL_P1
:
8381 _mesa_printf("EVAL_P1 %d\n", n
[1].i
);
8383 case OPCODE_EVAL_P2
:
8384 _mesa_printf("EVAL_P2 %d %d\n", n
[1].i
, n
[2].i
);
8388 * meta opcodes/commands
8391 _mesa_printf("Error: %s %s\n",
8392 enum_string(n
[1].e
), (const char *) n
[2].data
);
8394 case OPCODE_CONTINUE
:
8395 _mesa_printf("DISPLAY-LIST-CONTINUE\n");
8396 n
= (Node
*) n
[1].next
;
8398 case OPCODE_END_OF_LIST
:
8399 _mesa_printf("END-LIST %u\n", list
);
8403 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
8405 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
8406 opcode
, (void *) n
);
8410 _mesa_printf("command %d, %u operands\n", opcode
,
8414 /* increment n to point to next compiled command */
8415 if (opcode
!= OPCODE_CONTINUE
) {
8416 n
+= InstSize
[opcode
];
8425 * Clients may call this function to help debug display list problems.
8426 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
8427 * changed, or break in the future without notice.
8430 mesa_print_display_list(GLuint list
)
8432 GET_CURRENT_CONTEXT(ctx
);
8433 print_list(ctx
, list
);
8437 /**********************************************************************/
8438 /***** Initialization *****/
8439 /**********************************************************************/
8442 _mesa_save_vtxfmt_init(GLvertexformat
* vfmt
)
8444 vfmt
->ArrayElement
= _ae_loopback_array_elt
; /* generic helper */
8445 vfmt
->Begin
= save_Begin
;
8446 vfmt
->CallList
= _mesa_save_CallList
;
8447 vfmt
->CallLists
= _mesa_save_CallLists
;
8448 vfmt
->Color3f
= save_Color3f
;
8449 vfmt
->Color3fv
= save_Color3fv
;
8450 vfmt
->Color4f
= save_Color4f
;
8451 vfmt
->Color4fv
= save_Color4fv
;
8452 vfmt
->EdgeFlag
= save_EdgeFlag
;
8453 vfmt
->End
= save_End
;
8454 vfmt
->EvalCoord1f
= save_EvalCoord1f
;
8455 vfmt
->EvalCoord1fv
= save_EvalCoord1fv
;
8456 vfmt
->EvalCoord2f
= save_EvalCoord2f
;
8457 vfmt
->EvalCoord2fv
= save_EvalCoord2fv
;
8458 vfmt
->EvalPoint1
= save_EvalPoint1
;
8459 vfmt
->EvalPoint2
= save_EvalPoint2
;
8460 vfmt
->FogCoordfEXT
= save_FogCoordfEXT
;
8461 vfmt
->FogCoordfvEXT
= save_FogCoordfvEXT
;
8462 vfmt
->Indexf
= save_Indexf
;
8463 vfmt
->Indexfv
= save_Indexfv
;
8464 vfmt
->Materialfv
= save_Materialfv
;
8465 vfmt
->MultiTexCoord1fARB
= save_MultiTexCoord1f
;
8466 vfmt
->MultiTexCoord1fvARB
= save_MultiTexCoord1fv
;
8467 vfmt
->MultiTexCoord2fARB
= save_MultiTexCoord2f
;
8468 vfmt
->MultiTexCoord2fvARB
= save_MultiTexCoord2fv
;
8469 vfmt
->MultiTexCoord3fARB
= save_MultiTexCoord3f
;
8470 vfmt
->MultiTexCoord3fvARB
= save_MultiTexCoord3fv
;
8471 vfmt
->MultiTexCoord4fARB
= save_MultiTexCoord4f
;
8472 vfmt
->MultiTexCoord4fvARB
= save_MultiTexCoord4fv
;
8473 vfmt
->Normal3f
= save_Normal3f
;
8474 vfmt
->Normal3fv
= save_Normal3fv
;
8475 vfmt
->SecondaryColor3fEXT
= save_SecondaryColor3fEXT
;
8476 vfmt
->SecondaryColor3fvEXT
= save_SecondaryColor3fvEXT
;
8477 vfmt
->TexCoord1f
= save_TexCoord1f
;
8478 vfmt
->TexCoord1fv
= save_TexCoord1fv
;
8479 vfmt
->TexCoord2f
= save_TexCoord2f
;
8480 vfmt
->TexCoord2fv
= save_TexCoord2fv
;
8481 vfmt
->TexCoord3f
= save_TexCoord3f
;
8482 vfmt
->TexCoord3fv
= save_TexCoord3fv
;
8483 vfmt
->TexCoord4f
= save_TexCoord4f
;
8484 vfmt
->TexCoord4fv
= save_TexCoord4fv
;
8485 vfmt
->Vertex2f
= save_Vertex2f
;
8486 vfmt
->Vertex2fv
= save_Vertex2fv
;
8487 vfmt
->Vertex3f
= save_Vertex3f
;
8488 vfmt
->Vertex3fv
= save_Vertex3fv
;
8489 vfmt
->Vertex4f
= save_Vertex4f
;
8490 vfmt
->Vertex4fv
= save_Vertex4fv
;
8491 vfmt
->VertexAttrib1fNV
= save_VertexAttrib1fNV
;
8492 vfmt
->VertexAttrib1fvNV
= save_VertexAttrib1fvNV
;
8493 vfmt
->VertexAttrib2fNV
= save_VertexAttrib2fNV
;
8494 vfmt
->VertexAttrib2fvNV
= save_VertexAttrib2fvNV
;
8495 vfmt
->VertexAttrib3fNV
= save_VertexAttrib3fNV
;
8496 vfmt
->VertexAttrib3fvNV
= save_VertexAttrib3fvNV
;
8497 vfmt
->VertexAttrib4fNV
= save_VertexAttrib4fNV
;
8498 vfmt
->VertexAttrib4fvNV
= save_VertexAttrib4fvNV
;
8499 vfmt
->VertexAttrib1fARB
= save_VertexAttrib1fARB
;
8500 vfmt
->VertexAttrib1fvARB
= save_VertexAttrib1fvARB
;
8501 vfmt
->VertexAttrib2fARB
= save_VertexAttrib2fARB
;
8502 vfmt
->VertexAttrib2fvARB
= save_VertexAttrib2fvARB
;
8503 vfmt
->VertexAttrib3fARB
= save_VertexAttrib3fARB
;
8504 vfmt
->VertexAttrib3fvARB
= save_VertexAttrib3fvARB
;
8505 vfmt
->VertexAttrib4fARB
= save_VertexAttrib4fARB
;
8506 vfmt
->VertexAttrib4fvARB
= save_VertexAttrib4fvARB
;
8508 vfmt
->EvalMesh1
= _mesa_save_EvalMesh1
;
8509 vfmt
->EvalMesh2
= _mesa_save_EvalMesh2
;
8510 vfmt
->Rectf
= save_Rectf
;
8512 /* The driver is required to implement these as
8513 * 1) They can probably do a better job.
8514 * 2) A lot of new mechanisms would have to be added to this module
8515 * to support it. That code would probably never get used,
8519 vfmt
->DrawArrays
= 0;
8520 vfmt
->DrawElements
= 0;
8521 vfmt
->DrawRangeElements
= 0;
8527 * Initialize display list state for given context.
8530 _mesa_init_display_list(GLcontext
*ctx
)
8532 static GLboolean tableInitialized
= GL_FALSE
;
8534 /* zero-out the instruction size table, just once */
8535 if (!tableInitialized
) {
8536 _mesa_bzero(InstSize
, sizeof(InstSize
));
8537 tableInitialized
= GL_TRUE
;
8541 ctx
->ListState
.CallDepth
= 0;
8542 ctx
->ExecuteFlag
= GL_TRUE
;
8543 ctx
->CompileFlag
= GL_FALSE
;
8544 ctx
->ListState
.CurrentListPtr
= NULL
;
8545 ctx
->ListState
.CurrentBlock
= NULL
;
8546 ctx
->ListState
.CurrentListNum
= 0;
8547 ctx
->ListState
.CurrentPos
= 0;
8549 /* Display List group */
8550 ctx
->List
.ListBase
= 0;
8552 _mesa_save_vtxfmt_init(&ctx
->ListState
.ListVtxfmt
);