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"
36 #include "mfeatures.h"
40 #if FEATURE_ARB_vertex_buffer_object
41 #include "bufferobj.h"
53 #include "extensions.h"
55 #include "framebuffer.h"
57 #include "glapi/glapi.h"
59 #include "histogram.h"
76 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
77 #include "shader/arbprogram.h"
78 #include "shader/program.h"
80 #if FEATURE_NV_vertex_program || FEATURE_NV_fragment_program
81 #include "shader/nvprogram.h"
82 #include "shader/program.h"
84 #if FEATURE_ATI_fragment_shader
85 #include "shader/atifragshader.h"
88 #include "math/m_matrix.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_TEX_BUMP_PARAMETER_ATI
,
324 /* GL_ATI_fragment_shader */
325 OPCODE_BIND_FRAGMENT_SHADER_ATI
,
326 OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
,
328 OPCODE_STENCIL_FUNC_SEPARATE
,
329 OPCODE_STENCIL_OP_SEPARATE
,
330 OPCODE_STENCIL_MASK_SEPARATE
,
332 /* GL_EXT_framebuffer_blit */
333 OPCODE_BLIT_FRAMEBUFFER
,
335 /* Vertex attributes -- fallback for when optimized display
336 * list build isn't active.
355 /* The following three are meta instructions */
356 OPCODE_ERROR
, /* raise compiled-in error */
367 * Display list instructions are stored as sequences of "nodes". Nodes
368 * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
369 * are linked together with a pointer.
371 * Each instruction in the display list is stored as a sequence of
372 * contiguous nodes in memory.
373 * Each node is the union of a variety of data types.
388 void *next
; /* If prev node's opcode==OPCODE_CONTINUE */
392 typedef union gl_dlist_node Node
;
396 * How many nodes to allocate at a time.
398 * \note Reduced now that we hold vertices etc. elsewhere.
400 #define BLOCK_SIZE 256
405 * Number of nodes of storage needed for each instruction.
406 * Sizes for dynamically allocated opcodes are stored in the context struct.
408 static GLuint InstSize
[OPCODE_END_OF_LIST
+ 1];
410 void mesa_print_display_list(GLuint list
);
413 /**********************************************************************/
414 /***** Private *****/
415 /**********************************************************************/
419 * Make an empty display list. This is used by glGenLists() to
420 * reserve display list IDs.
422 static struct gl_display_list
*
423 make_list(GLuint name
, GLuint count
)
425 struct gl_display_list
*dlist
= CALLOC_STRUCT(gl_display_list
);
427 dlist
->Head
= (Node
*) _mesa_malloc(sizeof(Node
) * count
);
428 dlist
->Head
[0].opcode
= OPCODE_END_OF_LIST
;
434 * Lookup function to just encapsulate casting.
436 static INLINE
struct gl_display_list
*
437 lookup_list(GLcontext
*ctx
, GLuint list
)
439 return (struct gl_display_list
*)
440 _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
446 * Delete the named display list, but don't remove from hash table.
447 * \param dlist - display list pointer
450 _mesa_delete_list(GLcontext
*ctx
, struct gl_display_list
*dlist
)
455 n
= block
= dlist
->Head
;
457 done
= block
? GL_FALSE
: GL_TRUE
;
460 /* check for extension opcodes first */
462 GLint i
= (GLint
) n
[0].opcode
- (GLint
) OPCODE_EXT_0
;
463 if (i
>= 0 && i
< (GLint
) ctx
->ListExt
.NumOpcodes
) {
464 ctx
->ListExt
.Opcode
[i
].Destroy(ctx
, &n
[1]);
465 n
+= ctx
->ListExt
.Opcode
[i
].Size
;
468 switch (n
[0].opcode
) {
469 /* for some commands, we need to free malloc'd memory */
471 _mesa_free(n
[6].data
);
472 n
+= InstSize
[n
[0].opcode
];
475 _mesa_free(n
[10].data
);
476 n
+= InstSize
[n
[0].opcode
];
478 case OPCODE_DRAW_PIXELS
:
479 _mesa_free(n
[5].data
);
480 n
+= InstSize
[n
[0].opcode
];
483 _mesa_free(n
[7].data
);
484 n
+= InstSize
[n
[0].opcode
];
486 case OPCODE_COLOR_TABLE
:
487 _mesa_free(n
[6].data
);
488 n
+= InstSize
[n
[0].opcode
];
490 case OPCODE_COLOR_SUB_TABLE
:
491 _mesa_free(n
[6].data
);
492 n
+= InstSize
[n
[0].opcode
];
494 case OPCODE_CONVOLUTION_FILTER_1D
:
495 _mesa_free(n
[6].data
);
496 n
+= InstSize
[n
[0].opcode
];
498 case OPCODE_CONVOLUTION_FILTER_2D
:
499 _mesa_free(n
[7].data
);
500 n
+= InstSize
[n
[0].opcode
];
502 case OPCODE_POLYGON_STIPPLE
:
503 _mesa_free(n
[1].data
);
504 n
+= InstSize
[n
[0].opcode
];
506 case OPCODE_TEX_IMAGE1D
:
507 _mesa_free(n
[8].data
);
508 n
+= InstSize
[n
[0].opcode
];
510 case OPCODE_TEX_IMAGE2D
:
511 _mesa_free(n
[9].data
);
512 n
+= InstSize
[n
[0].opcode
];
514 case OPCODE_TEX_IMAGE3D
:
515 _mesa_free(n
[10].data
);
516 n
+= InstSize
[n
[0].opcode
];
518 case OPCODE_TEX_SUB_IMAGE1D
:
519 _mesa_free(n
[7].data
);
520 n
+= InstSize
[n
[0].opcode
];
522 case OPCODE_TEX_SUB_IMAGE2D
:
523 _mesa_free(n
[9].data
);
524 n
+= InstSize
[n
[0].opcode
];
526 case OPCODE_TEX_SUB_IMAGE3D
:
527 _mesa_free(n
[11].data
);
528 n
+= InstSize
[n
[0].opcode
];
530 case OPCODE_COMPRESSED_TEX_IMAGE_1D
:
531 _mesa_free(n
[7].data
);
532 n
+= InstSize
[n
[0].opcode
];
534 case OPCODE_COMPRESSED_TEX_IMAGE_2D
:
535 _mesa_free(n
[8].data
);
536 n
+= InstSize
[n
[0].opcode
];
538 case OPCODE_COMPRESSED_TEX_IMAGE_3D
:
539 _mesa_free(n
[9].data
);
540 n
+= InstSize
[n
[0].opcode
];
542 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
:
543 _mesa_free(n
[7].data
);
544 n
+= InstSize
[n
[0].opcode
];
546 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
:
547 _mesa_free(n
[9].data
);
548 n
+= InstSize
[n
[0].opcode
];
550 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
:
551 _mesa_free(n
[11].data
);
552 n
+= InstSize
[n
[0].opcode
];
554 #if FEATURE_NV_vertex_program
555 case OPCODE_LOAD_PROGRAM_NV
:
556 _mesa_free(n
[4].data
); /* program string */
557 n
+= InstSize
[n
[0].opcode
];
559 case OPCODE_REQUEST_RESIDENT_PROGRAMS_NV
:
560 _mesa_free(n
[2].data
); /* array of program ids */
561 n
+= InstSize
[n
[0].opcode
];
564 #if FEATURE_NV_fragment_program
565 case OPCODE_PROGRAM_NAMED_PARAMETER_NV
:
566 _mesa_free(n
[3].data
); /* parameter name */
567 n
+= InstSize
[n
[0].opcode
];
570 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
571 case OPCODE_PROGRAM_STRING_ARB
:
572 _mesa_free(n
[4].data
); /* program string */
573 n
+= InstSize
[n
[0].opcode
];
576 case OPCODE_CONTINUE
:
577 n
= (Node
*) n
[1].next
;
581 case OPCODE_END_OF_LIST
:
586 /* Most frequent case */
587 n
+= InstSize
[n
[0].opcode
];
598 * Destroy a display list and remove from hash table.
599 * \param list - display list number
602 destroy_list(GLcontext
*ctx
, GLuint list
)
604 struct gl_display_list
*dlist
;
609 dlist
= lookup_list(ctx
, list
);
613 _mesa_delete_list(ctx
, dlist
);
614 _mesa_HashRemove(ctx
->Shared
->DisplayList
, list
);
619 * Translate the nth element of list from <type> to GLint.
622 translate_id(GLsizei n
, GLenum type
, const GLvoid
* list
)
634 bptr
= (GLbyte
*) list
;
635 return (GLint
) bptr
[n
];
636 case GL_UNSIGNED_BYTE
:
637 ubptr
= (GLubyte
*) list
;
638 return (GLint
) ubptr
[n
];
640 sptr
= (GLshort
*) list
;
641 return (GLint
) sptr
[n
];
642 case GL_UNSIGNED_SHORT
:
643 usptr
= (GLushort
*) list
;
644 return (GLint
) usptr
[n
];
646 iptr
= (GLint
*) list
;
648 case GL_UNSIGNED_INT
:
649 uiptr
= (GLuint
*) list
;
650 return (GLint
) uiptr
[n
];
652 fptr
= (GLfloat
*) list
;
653 return (GLint
) FLOORF(fptr
[n
]);
655 ubptr
= ((GLubyte
*) list
) + 2 * n
;
656 return (GLint
) ubptr
[0] * 256
659 ubptr
= ((GLubyte
*) list
) + 3 * n
;
660 return (GLint
) ubptr
[0] * 65536
661 + (GLint
) ubptr
[1] * 256
664 ubptr
= ((GLubyte
*) list
) + 4 * n
;
665 return (GLint
) ubptr
[0] * 16777216
666 + (GLint
) ubptr
[1] * 65536
667 + (GLint
) ubptr
[2] * 256
677 /**********************************************************************/
679 /**********************************************************************/
682 * Wrapper for _mesa_unpack_image() that handles pixel buffer objects.
683 * If we run out of memory, GL_OUT_OF_MEMORY will be recorded.
686 unpack_image(GLcontext
*ctx
, GLuint dimensions
,
687 GLsizei width
, GLsizei height
, GLsizei depth
,
688 GLenum format
, GLenum type
, const GLvoid
* pixels
,
689 const struct gl_pixelstore_attrib
*unpack
)
691 if (unpack
->BufferObj
->Name
== 0) {
693 GLvoid
*image
= _mesa_unpack_image(dimensions
, width
, height
, depth
,
694 format
, type
, pixels
, unpack
);
695 if (pixels
&& !image
) {
696 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "display list construction");
700 else if (_mesa_validate_pbo_access(dimensions
, unpack
, width
, height
, depth
,
701 format
, type
, pixels
)) {
702 const GLubyte
*map
, *src
;
706 ctx
->Driver
.MapBuffer(ctx
, GL_PIXEL_UNPACK_BUFFER_EXT
,
707 GL_READ_ONLY_ARB
, unpack
->BufferObj
);
709 /* unable to map src buffer! */
710 _mesa_error(ctx
, GL_INVALID_OPERATION
, "unable to map PBO");
714 src
= ADD_POINTERS(map
, pixels
);
715 image
= _mesa_unpack_image(dimensions
, width
, height
, depth
,
716 format
, type
, src
, unpack
);
718 ctx
->Driver
.UnmapBuffer(ctx
, GL_PIXEL_UNPACK_BUFFER_EXT
,
722 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "display list construction");
732 * Allocate space for a display list instruction.
733 * \param opcode the instruction opcode (OPCODE_* value)
734 * \param bytes instruction size in bytes, not counting opcode.
735 * \return pointer to the usable data area (not including the internal
739 _mesa_alloc_instruction(GLcontext
*ctx
, GLuint opcode
, GLuint bytes
)
741 const GLuint numNodes
= 1 + (bytes
+ sizeof(Node
) - 1) / sizeof(Node
);
744 if (opcode
< (GLuint
) OPCODE_EXT_0
) {
745 if (InstSize
[opcode
] == 0) {
746 /* save instruction size now */
747 InstSize
[opcode
] = numNodes
;
750 /* make sure instruction size agrees */
751 ASSERT(numNodes
== InstSize
[opcode
]);
755 if (ctx
->ListState
.CurrentPos
+ numNodes
+ 2 > BLOCK_SIZE
) {
756 /* This block is full. Allocate a new block and chain to it */
758 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
759 n
[0].opcode
= OPCODE_CONTINUE
;
760 newblock
= (Node
*) _mesa_malloc(sizeof(Node
) * BLOCK_SIZE
);
762 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "Building display list");
765 n
[1].next
= (Node
*) newblock
;
766 ctx
->ListState
.CurrentBlock
= newblock
;
767 ctx
->ListState
.CurrentPos
= 0;
770 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
771 ctx
->ListState
.CurrentPos
+= numNodes
;
773 n
[0].opcode
= (OpCode
) opcode
;
775 return (void *) (n
+ 1); /* return ptr to node following opcode */
780 * This function allows modules and drivers to get their own opcodes
781 * for extending display list functionality.
782 * \param ctx the rendering context
783 * \param size number of bytes for storing the new display list command
784 * \param execute function to execute the new display list command
785 * \param destroy function to destroy the new display list command
786 * \param print function to print the new display list command
787 * \return the new opcode number or -1 if error
790 _mesa_alloc_opcode(GLcontext
*ctx
,
792 void (*execute
) (GLcontext
*, void *),
793 void (*destroy
) (GLcontext
*, void *),
794 void (*print
) (GLcontext
*, void *))
796 if (ctx
->ListExt
.NumOpcodes
< MAX_DLIST_EXT_OPCODES
) {
797 const GLuint i
= ctx
->ListExt
.NumOpcodes
++;
798 ctx
->ListExt
.Opcode
[i
].Size
=
799 1 + (size
+ sizeof(Node
) - 1) / sizeof(Node
);
800 ctx
->ListExt
.Opcode
[i
].Execute
= execute
;
801 ctx
->ListExt
.Opcode
[i
].Destroy
= destroy
;
802 ctx
->ListExt
.Opcode
[i
].Print
= print
;
803 return i
+ OPCODE_EXT_0
;
811 * Allocate display list instruction. Returns Node ptr to where the opcode
813 * - nParams is the number of function parameters
814 * - return value a pointer to sizeof(Node) before the actual
817 #define ALLOC_INSTRUCTION(CTX, OPCODE, NPARAMS) \
818 ((Node *)_mesa_alloc_instruction(CTX, OPCODE, (NPARAMS)*sizeof(Node)) - 1)
823 * Display List compilation functions
825 static void GLAPIENTRY
826 save_Accum(GLenum op
, GLfloat value
)
828 GET_CURRENT_CONTEXT(ctx
);
830 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
831 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ACCUM
, 2);
836 if (ctx
->ExecuteFlag
) {
837 CALL_Accum(ctx
->Exec
, (op
, value
));
842 static void GLAPIENTRY
843 save_AlphaFunc(GLenum func
, GLclampf ref
)
845 GET_CURRENT_CONTEXT(ctx
);
847 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
848 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ALPHA_FUNC
, 2);
851 n
[2].f
= (GLfloat
) ref
;
853 if (ctx
->ExecuteFlag
) {
854 CALL_AlphaFunc(ctx
->Exec
, (func
, ref
));
859 static void GLAPIENTRY
860 save_BindTexture(GLenum target
, GLuint texture
)
862 GET_CURRENT_CONTEXT(ctx
);
864 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
865 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BIND_TEXTURE
, 2);
870 if (ctx
->ExecuteFlag
) {
871 CALL_BindTexture(ctx
->Exec
, (target
, texture
));
876 static void GLAPIENTRY
877 save_Bitmap(GLsizei width
, GLsizei height
,
878 GLfloat xorig
, GLfloat yorig
,
879 GLfloat xmove
, GLfloat ymove
, const GLubyte
* pixels
)
881 GET_CURRENT_CONTEXT(ctx
);
883 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
884 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BITMAP
, 7);
886 n
[1].i
= (GLint
) width
;
887 n
[2].i
= (GLint
) height
;
892 n
[7].data
= _mesa_unpack_bitmap(width
, height
, pixels
, &ctx
->Unpack
);
894 if (ctx
->ExecuteFlag
) {
895 CALL_Bitmap(ctx
->Exec
, (width
, height
,
896 xorig
, yorig
, xmove
, ymove
, pixels
));
901 static void GLAPIENTRY
902 save_BlendEquation(GLenum mode
)
904 GET_CURRENT_CONTEXT(ctx
);
906 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
907 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BLEND_EQUATION
, 1);
911 if (ctx
->ExecuteFlag
) {
912 CALL_BlendEquation(ctx
->Exec
, (mode
));
917 static void GLAPIENTRY
918 save_BlendEquationSeparateEXT(GLenum modeRGB
, GLenum modeA
)
920 GET_CURRENT_CONTEXT(ctx
);
922 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
923 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BLEND_EQUATION_SEPARATE
, 2);
928 if (ctx
->ExecuteFlag
) {
929 CALL_BlendEquationSeparateEXT(ctx
->Exec
, (modeRGB
, modeA
));
934 static void GLAPIENTRY
935 save_BlendFuncSeparateEXT(GLenum sfactorRGB
, GLenum dfactorRGB
,
936 GLenum sfactorA
, GLenum dfactorA
)
938 GET_CURRENT_CONTEXT(ctx
);
940 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
941 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BLEND_FUNC_SEPARATE
, 4);
948 if (ctx
->ExecuteFlag
) {
949 CALL_BlendFuncSeparateEXT(ctx
->Exec
,
950 (sfactorRGB
, dfactorRGB
, sfactorA
, dfactorA
));
955 static void GLAPIENTRY
956 save_BlendFunc(GLenum srcfactor
, GLenum dstfactor
)
958 save_BlendFuncSeparateEXT(srcfactor
, dstfactor
, srcfactor
, dstfactor
);
962 static void GLAPIENTRY
963 save_BlendColor(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
965 GET_CURRENT_CONTEXT(ctx
);
967 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
968 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BLEND_COLOR
, 4);
975 if (ctx
->ExecuteFlag
) {
976 CALL_BlendColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
980 static void invalidate_saved_current_state( GLcontext
*ctx
)
984 for (i
= 0; i
< VERT_ATTRIB_MAX
; i
++)
985 ctx
->ListState
.ActiveAttribSize
[i
] = 0;
987 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++)
988 ctx
->ListState
.ActiveMaterialSize
[i
] = 0;
990 memset(&ctx
->ListState
.Current
, 0, sizeof ctx
->ListState
.Current
);
992 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
996 _mesa_save_CallList(GLuint list
)
998 GET_CURRENT_CONTEXT(ctx
);
1000 SAVE_FLUSH_VERTICES(ctx
);
1002 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CALL_LIST
, 1);
1007 /* After this, we don't know what state we're in. Invalidate all
1008 * cached information previously gathered:
1010 invalidate_saved_current_state( ctx
);
1012 if (ctx
->ExecuteFlag
) {
1013 _mesa_CallList(list
);
1019 _mesa_save_CallLists(GLsizei n
, GLenum type
, const GLvoid
* lists
)
1021 GET_CURRENT_CONTEXT(ctx
);
1023 GLboolean typeErrorFlag
;
1025 SAVE_FLUSH_VERTICES(ctx
);
1029 case GL_UNSIGNED_BYTE
:
1031 case GL_UNSIGNED_SHORT
:
1033 case GL_UNSIGNED_INT
:
1038 typeErrorFlag
= GL_FALSE
;
1041 typeErrorFlag
= GL_TRUE
;
1044 for (i
= 0; i
< n
; i
++) {
1045 GLint list
= translate_id(i
, type
, lists
);
1046 Node
*n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CALL_LIST_OFFSET
, 2);
1049 n
[2].b
= typeErrorFlag
;
1053 /* After this, we don't know what state we're in. Invalidate all
1054 * cached information previously gathered:
1056 invalidate_saved_current_state( ctx
);
1058 if (ctx
->ExecuteFlag
) {
1059 CALL_CallLists(ctx
->Exec
, (n
, type
, lists
));
1064 static void GLAPIENTRY
1065 save_Clear(GLbitfield mask
)
1067 GET_CURRENT_CONTEXT(ctx
);
1069 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1070 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLEAR
, 1);
1074 if (ctx
->ExecuteFlag
) {
1075 CALL_Clear(ctx
->Exec
, (mask
));
1080 static void GLAPIENTRY
1081 save_ClearAccum(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
1083 GET_CURRENT_CONTEXT(ctx
);
1085 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1086 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLEAR_ACCUM
, 4);
1093 if (ctx
->ExecuteFlag
) {
1094 CALL_ClearAccum(ctx
->Exec
, (red
, green
, blue
, alpha
));
1099 static void GLAPIENTRY
1100 save_ClearColor(GLclampf red
, GLclampf green
, GLclampf blue
, GLclampf alpha
)
1102 GET_CURRENT_CONTEXT(ctx
);
1104 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1105 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLEAR_COLOR
, 4);
1112 if (ctx
->ExecuteFlag
) {
1113 CALL_ClearColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
1118 static void GLAPIENTRY
1119 save_ClearDepth(GLclampd depth
)
1121 GET_CURRENT_CONTEXT(ctx
);
1123 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1124 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLEAR_DEPTH
, 1);
1126 n
[1].f
= (GLfloat
) depth
;
1128 if (ctx
->ExecuteFlag
) {
1129 CALL_ClearDepth(ctx
->Exec
, (depth
));
1134 static void GLAPIENTRY
1135 save_ClearIndex(GLfloat c
)
1137 GET_CURRENT_CONTEXT(ctx
);
1139 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1140 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLEAR_INDEX
, 1);
1144 if (ctx
->ExecuteFlag
) {
1145 CALL_ClearIndex(ctx
->Exec
, (c
));
1150 static void GLAPIENTRY
1151 save_ClearStencil(GLint s
)
1153 GET_CURRENT_CONTEXT(ctx
);
1155 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1156 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLEAR_STENCIL
, 1);
1160 if (ctx
->ExecuteFlag
) {
1161 CALL_ClearStencil(ctx
->Exec
, (s
));
1166 static void GLAPIENTRY
1167 save_ClipPlane(GLenum plane
, const GLdouble
* equ
)
1169 GET_CURRENT_CONTEXT(ctx
);
1171 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1172 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLIP_PLANE
, 5);
1175 n
[2].f
= (GLfloat
) equ
[0];
1176 n
[3].f
= (GLfloat
) equ
[1];
1177 n
[4].f
= (GLfloat
) equ
[2];
1178 n
[5].f
= (GLfloat
) equ
[3];
1180 if (ctx
->ExecuteFlag
) {
1181 CALL_ClipPlane(ctx
->Exec
, (plane
, equ
));
1187 static void GLAPIENTRY
1188 save_ColorMask(GLboolean red
, GLboolean green
,
1189 GLboolean blue
, GLboolean alpha
)
1191 GET_CURRENT_CONTEXT(ctx
);
1193 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1194 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COLOR_MASK
, 4);
1201 if (ctx
->ExecuteFlag
) {
1202 CALL_ColorMask(ctx
->Exec
, (red
, green
, blue
, alpha
));
1207 static void GLAPIENTRY
1208 save_ColorMaterial(GLenum face
, GLenum mode
)
1210 GET_CURRENT_CONTEXT(ctx
);
1212 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1214 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COLOR_MATERIAL
, 2);
1219 if (ctx
->ExecuteFlag
) {
1220 CALL_ColorMaterial(ctx
->Exec
, (face
, mode
));
1225 static void GLAPIENTRY
1226 save_ColorTable(GLenum target
, GLenum internalFormat
,
1227 GLsizei width
, GLenum format
, GLenum type
,
1228 const GLvoid
* table
)
1230 GET_CURRENT_CONTEXT(ctx
);
1231 if (_mesa_is_proxy_texture(target
)) {
1232 /* execute immediately */
1233 CALL_ColorTable(ctx
->Exec
, (target
, internalFormat
, width
,
1234 format
, type
, table
));
1238 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1239 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COLOR_TABLE
, 6);
1242 n
[2].e
= internalFormat
;
1246 n
[6].data
= unpack_image(ctx
, 1, width
, 1, 1, format
, type
, table
,
1249 if (ctx
->ExecuteFlag
) {
1250 CALL_ColorTable(ctx
->Exec
, (target
, internalFormat
, width
,
1251 format
, type
, table
));
1258 static void GLAPIENTRY
1259 save_ColorTableParameterfv(GLenum target
, GLenum pname
,
1260 const GLfloat
*params
)
1262 GET_CURRENT_CONTEXT(ctx
);
1265 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1267 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COLOR_TABLE_PARAMETER_FV
, 6);
1272 if (pname
== GL_COLOR_TABLE_SGI
||
1273 pname
== GL_POST_CONVOLUTION_COLOR_TABLE_SGI
||
1274 pname
== GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI
||
1275 pname
== GL_TEXTURE_COLOR_TABLE_SGI
) {
1282 if (ctx
->ExecuteFlag
) {
1283 CALL_ColorTableParameterfv(ctx
->Exec
, (target
, pname
, params
));
1288 static void GLAPIENTRY
1289 save_ColorTableParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
1291 GET_CURRENT_CONTEXT(ctx
);
1294 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1296 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COLOR_TABLE_PARAMETER_IV
, 6);
1301 if (pname
== GL_COLOR_TABLE_SGI
||
1302 pname
== GL_POST_CONVOLUTION_COLOR_TABLE_SGI
||
1303 pname
== GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI
||
1304 pname
== GL_TEXTURE_COLOR_TABLE_SGI
) {
1311 if (ctx
->ExecuteFlag
) {
1312 CALL_ColorTableParameteriv(ctx
->Exec
, (target
, pname
, params
));
1318 static void GLAPIENTRY
1319 save_ColorSubTable(GLenum target
, GLsizei start
, GLsizei count
,
1320 GLenum format
, GLenum type
, const GLvoid
* table
)
1322 GET_CURRENT_CONTEXT(ctx
);
1324 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1325 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COLOR_SUB_TABLE
, 6);
1332 n
[6].data
= unpack_image(ctx
, 1, count
, 1, 1, format
, type
, table
,
1335 if (ctx
->ExecuteFlag
) {
1336 CALL_ColorSubTable(ctx
->Exec
,
1337 (target
, start
, count
, format
, type
, table
));
1342 static void GLAPIENTRY
1343 save_CopyColorSubTable(GLenum target
, GLsizei start
,
1344 GLint x
, GLint y
, GLsizei width
)
1346 GET_CURRENT_CONTEXT(ctx
);
1349 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1350 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_COLOR_SUB_TABLE
, 5);
1358 if (ctx
->ExecuteFlag
) {
1359 CALL_CopyColorSubTable(ctx
->Exec
, (target
, start
, x
, y
, width
));
1364 static void GLAPIENTRY
1365 save_CopyColorTable(GLenum target
, GLenum internalformat
,
1366 GLint x
, GLint y
, GLsizei width
)
1368 GET_CURRENT_CONTEXT(ctx
);
1371 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1372 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_COLOR_TABLE
, 5);
1375 n
[2].e
= internalformat
;
1380 if (ctx
->ExecuteFlag
) {
1381 CALL_CopyColorTable(ctx
->Exec
, (target
, internalformat
, x
, y
, width
));
1386 static void GLAPIENTRY
1387 save_ConvolutionFilter1D(GLenum target
, GLenum internalFormat
, GLsizei width
,
1388 GLenum format
, GLenum type
, const GLvoid
* filter
)
1390 GET_CURRENT_CONTEXT(ctx
);
1393 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1395 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CONVOLUTION_FILTER_1D
, 6);
1398 n
[2].e
= internalFormat
;
1402 n
[6].data
= unpack_image(ctx
, 1, width
, 1, 1, format
, type
, filter
,
1405 if (ctx
->ExecuteFlag
) {
1406 CALL_ConvolutionFilter1D(ctx
->Exec
, (target
, internalFormat
, width
,
1407 format
, type
, filter
));
1412 static void GLAPIENTRY
1413 save_ConvolutionFilter2D(GLenum target
, GLenum internalFormat
,
1414 GLsizei width
, GLsizei height
, GLenum format
,
1415 GLenum type
, const GLvoid
* filter
)
1417 GET_CURRENT_CONTEXT(ctx
);
1420 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1422 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CONVOLUTION_FILTER_2D
, 7);
1425 n
[2].e
= internalFormat
;
1430 n
[7].data
= unpack_image(ctx
, 2, width
, height
, 1, format
, type
, filter
,
1433 if (ctx
->ExecuteFlag
) {
1434 CALL_ConvolutionFilter2D(ctx
->Exec
,
1435 (target
, internalFormat
, width
, height
, format
,
1441 static void GLAPIENTRY
1442 save_ConvolutionParameteri(GLenum target
, GLenum pname
, GLint param
)
1444 GET_CURRENT_CONTEXT(ctx
);
1446 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1447 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CONVOLUTION_PARAMETER_I
, 3);
1453 if (ctx
->ExecuteFlag
) {
1454 CALL_ConvolutionParameteri(ctx
->Exec
, (target
, pname
, param
));
1459 static void GLAPIENTRY
1460 save_ConvolutionParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
1462 GET_CURRENT_CONTEXT(ctx
);
1464 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1465 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CONVOLUTION_PARAMETER_IV
, 6);
1470 if (pname
== GL_CONVOLUTION_BORDER_COLOR
||
1471 pname
== GL_CONVOLUTION_FILTER_SCALE
||
1472 pname
== GL_CONVOLUTION_FILTER_BIAS
) {
1478 n
[4].i
= n
[5].i
= n
[6].i
= 0;
1481 if (ctx
->ExecuteFlag
) {
1482 CALL_ConvolutionParameteriv(ctx
->Exec
, (target
, pname
, params
));
1487 static void GLAPIENTRY
1488 save_ConvolutionParameterf(GLenum target
, GLenum pname
, GLfloat param
)
1490 GET_CURRENT_CONTEXT(ctx
);
1492 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1493 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CONVOLUTION_PARAMETER_F
, 3);
1499 if (ctx
->ExecuteFlag
) {
1500 CALL_ConvolutionParameterf(ctx
->Exec
, (target
, pname
, param
));
1505 static void GLAPIENTRY
1506 save_ConvolutionParameterfv(GLenum target
, GLenum pname
,
1507 const GLfloat
*params
)
1509 GET_CURRENT_CONTEXT(ctx
);
1511 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1512 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CONVOLUTION_PARAMETER_FV
, 6);
1517 if (pname
== GL_CONVOLUTION_BORDER_COLOR
||
1518 pname
== GL_CONVOLUTION_FILTER_SCALE
||
1519 pname
== GL_CONVOLUTION_FILTER_BIAS
) {
1525 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
1528 if (ctx
->ExecuteFlag
) {
1529 CALL_ConvolutionParameterfv(ctx
->Exec
, (target
, pname
, params
));
1534 static void GLAPIENTRY
1535 save_CopyPixels(GLint x
, GLint y
, GLsizei width
, GLsizei height
, GLenum type
)
1537 GET_CURRENT_CONTEXT(ctx
);
1539 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1540 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_PIXELS
, 5);
1544 n
[3].i
= (GLint
) width
;
1545 n
[4].i
= (GLint
) height
;
1548 if (ctx
->ExecuteFlag
) {
1549 CALL_CopyPixels(ctx
->Exec
, (x
, y
, width
, height
, type
));
1555 static void GLAPIENTRY
1556 save_CopyTexImage1D(GLenum target
, GLint level
, GLenum internalformat
,
1557 GLint x
, GLint y
, GLsizei width
, GLint border
)
1559 GET_CURRENT_CONTEXT(ctx
);
1561 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1562 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_TEX_IMAGE1D
, 7);
1566 n
[3].e
= internalformat
;
1572 if (ctx
->ExecuteFlag
) {
1573 CALL_CopyTexImage1D(ctx
->Exec
, (target
, level
, internalformat
,
1574 x
, y
, width
, border
));
1579 static void GLAPIENTRY
1580 save_CopyTexImage2D(GLenum target
, GLint level
,
1581 GLenum internalformat
,
1582 GLint x
, GLint y
, GLsizei width
,
1583 GLsizei height
, GLint border
)
1585 GET_CURRENT_CONTEXT(ctx
);
1587 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1588 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_TEX_IMAGE2D
, 8);
1592 n
[3].e
= internalformat
;
1599 if (ctx
->ExecuteFlag
) {
1600 CALL_CopyTexImage2D(ctx
->Exec
, (target
, level
, internalformat
,
1601 x
, y
, width
, height
, border
));
1607 static void GLAPIENTRY
1608 save_CopyTexSubImage1D(GLenum target
, GLint level
,
1609 GLint xoffset
, GLint x
, GLint y
, GLsizei width
)
1611 GET_CURRENT_CONTEXT(ctx
);
1613 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1614 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_TEX_SUB_IMAGE1D
, 6);
1623 if (ctx
->ExecuteFlag
) {
1624 CALL_CopyTexSubImage1D(ctx
->Exec
,
1625 (target
, level
, xoffset
, x
, y
, width
));
1630 static void GLAPIENTRY
1631 save_CopyTexSubImage2D(GLenum target
, GLint level
,
1632 GLint xoffset
, GLint yoffset
,
1633 GLint x
, GLint y
, GLsizei width
, GLint height
)
1635 GET_CURRENT_CONTEXT(ctx
);
1637 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1638 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_TEX_SUB_IMAGE2D
, 8);
1649 if (ctx
->ExecuteFlag
) {
1650 CALL_CopyTexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
1651 x
, y
, width
, height
));
1656 static void GLAPIENTRY
1657 save_CopyTexSubImage3D(GLenum target
, GLint level
,
1658 GLint xoffset
, GLint yoffset
, GLint zoffset
,
1659 GLint x
, GLint y
, GLsizei width
, GLint height
)
1661 GET_CURRENT_CONTEXT(ctx
);
1663 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1664 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_TEX_SUB_IMAGE3D
, 9);
1676 if (ctx
->ExecuteFlag
) {
1677 CALL_CopyTexSubImage3D(ctx
->Exec
, (target
, level
,
1678 xoffset
, yoffset
, zoffset
,
1679 x
, y
, width
, height
));
1684 static void GLAPIENTRY
1685 save_CullFace(GLenum mode
)
1687 GET_CURRENT_CONTEXT(ctx
);
1689 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1690 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CULL_FACE
, 1);
1694 if (ctx
->ExecuteFlag
) {
1695 CALL_CullFace(ctx
->Exec
, (mode
));
1700 static void GLAPIENTRY
1701 save_DepthFunc(GLenum func
)
1703 GET_CURRENT_CONTEXT(ctx
);
1705 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1706 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DEPTH_FUNC
, 1);
1710 if (ctx
->ExecuteFlag
) {
1711 CALL_DepthFunc(ctx
->Exec
, (func
));
1716 static void GLAPIENTRY
1717 save_DepthMask(GLboolean mask
)
1719 GET_CURRENT_CONTEXT(ctx
);
1721 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1722 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DEPTH_MASK
, 1);
1726 if (ctx
->ExecuteFlag
) {
1727 CALL_DepthMask(ctx
->Exec
, (mask
));
1732 static void GLAPIENTRY
1733 save_DepthRange(GLclampd nearval
, GLclampd farval
)
1735 GET_CURRENT_CONTEXT(ctx
);
1737 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1738 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DEPTH_RANGE
, 2);
1740 n
[1].f
= (GLfloat
) nearval
;
1741 n
[2].f
= (GLfloat
) farval
;
1743 if (ctx
->ExecuteFlag
) {
1744 CALL_DepthRange(ctx
->Exec
, (nearval
, farval
));
1749 static void GLAPIENTRY
1750 save_Disable(GLenum cap
)
1752 GET_CURRENT_CONTEXT(ctx
);
1754 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1755 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DISABLE
, 1);
1759 if (ctx
->ExecuteFlag
) {
1760 CALL_Disable(ctx
->Exec
, (cap
));
1765 static void GLAPIENTRY
1766 save_DrawBuffer(GLenum mode
)
1768 GET_CURRENT_CONTEXT(ctx
);
1770 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1771 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DRAW_BUFFER
, 1);
1775 if (ctx
->ExecuteFlag
) {
1776 CALL_DrawBuffer(ctx
->Exec
, (mode
));
1781 static void GLAPIENTRY
1782 save_DrawPixels(GLsizei width
, GLsizei height
,
1783 GLenum format
, GLenum type
, const GLvoid
* pixels
)
1785 GET_CURRENT_CONTEXT(ctx
);
1788 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1790 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DRAW_PIXELS
, 5);
1796 n
[5].data
= unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
1797 pixels
, &ctx
->Unpack
);
1799 if (ctx
->ExecuteFlag
) {
1800 CALL_DrawPixels(ctx
->Exec
, (width
, height
, format
, type
, pixels
));
1806 static void GLAPIENTRY
1807 save_Enable(GLenum cap
)
1809 GET_CURRENT_CONTEXT(ctx
);
1811 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1812 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ENABLE
, 1);
1816 if (ctx
->ExecuteFlag
) {
1817 CALL_Enable(ctx
->Exec
, (cap
));
1823 static void GLAPIENTRY
1824 _mesa_save_EvalMesh1(GLenum mode
, GLint i1
, GLint i2
)
1826 GET_CURRENT_CONTEXT(ctx
);
1828 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1829 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVALMESH1
, 3);
1835 if (ctx
->ExecuteFlag
) {
1836 CALL_EvalMesh1(ctx
->Exec
, (mode
, i1
, i2
));
1841 static void GLAPIENTRY
1842 _mesa_save_EvalMesh2(GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
1844 GET_CURRENT_CONTEXT(ctx
);
1846 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1847 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVALMESH2
, 5);
1855 if (ctx
->ExecuteFlag
) {
1856 CALL_EvalMesh2(ctx
->Exec
, (mode
, i1
, i2
, j1
, j2
));
1863 static void GLAPIENTRY
1864 save_Fogfv(GLenum pname
, const GLfloat
*params
)
1866 GET_CURRENT_CONTEXT(ctx
);
1868 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1869 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_FOG
, 5);
1877 if (ctx
->ExecuteFlag
) {
1878 CALL_Fogfv(ctx
->Exec
, (pname
, params
));
1883 static void GLAPIENTRY
1884 save_Fogf(GLenum pname
, GLfloat param
)
1886 save_Fogfv(pname
, ¶m
);
1890 static void GLAPIENTRY
1891 save_Fogiv(GLenum pname
, const GLint
*params
)
1896 case GL_FOG_DENSITY
:
1900 p
[0] = (GLfloat
) *params
;
1903 p
[0] = INT_TO_FLOAT(params
[0]);
1904 p
[1] = INT_TO_FLOAT(params
[1]);
1905 p
[2] = INT_TO_FLOAT(params
[2]);
1906 p
[3] = INT_TO_FLOAT(params
[3]);
1909 /* Error will be caught later in gl_Fogfv */
1910 ASSIGN_4V(p
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
1912 save_Fogfv(pname
, p
);
1916 static void GLAPIENTRY
1917 save_Fogi(GLenum pname
, GLint param
)
1919 save_Fogiv(pname
, ¶m
);
1923 static void GLAPIENTRY
1924 save_FrontFace(GLenum mode
)
1926 GET_CURRENT_CONTEXT(ctx
);
1928 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1929 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_FRONT_FACE
, 1);
1933 if (ctx
->ExecuteFlag
) {
1934 CALL_FrontFace(ctx
->Exec
, (mode
));
1939 static void GLAPIENTRY
1940 save_Frustum(GLdouble left
, GLdouble right
,
1941 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
1943 GET_CURRENT_CONTEXT(ctx
);
1945 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1946 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_FRUSTUM
, 6);
1948 n
[1].f
= (GLfloat
) left
;
1949 n
[2].f
= (GLfloat
) right
;
1950 n
[3].f
= (GLfloat
) bottom
;
1951 n
[4].f
= (GLfloat
) top
;
1952 n
[5].f
= (GLfloat
) nearval
;
1953 n
[6].f
= (GLfloat
) farval
;
1955 if (ctx
->ExecuteFlag
) {
1956 CALL_Frustum(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
1961 static void GLAPIENTRY
1962 save_Hint(GLenum target
, GLenum mode
)
1964 GET_CURRENT_CONTEXT(ctx
);
1966 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1967 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_HINT
, 2);
1972 if (ctx
->ExecuteFlag
) {
1973 CALL_Hint(ctx
->Exec
, (target
, mode
));
1978 static void GLAPIENTRY
1979 save_Histogram(GLenum target
, GLsizei width
, GLenum internalFormat
,
1982 GET_CURRENT_CONTEXT(ctx
);
1985 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1986 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_HISTOGRAM
, 4);
1990 n
[3].e
= internalFormat
;
1993 if (ctx
->ExecuteFlag
) {
1994 CALL_Histogram(ctx
->Exec
, (target
, width
, internalFormat
, sink
));
1999 static void GLAPIENTRY
2000 save_IndexMask(GLuint mask
)
2002 GET_CURRENT_CONTEXT(ctx
);
2004 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2005 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_INDEX_MASK
, 1);
2009 if (ctx
->ExecuteFlag
) {
2010 CALL_IndexMask(ctx
->Exec
, (mask
));
2015 static void GLAPIENTRY
2016 save_InitNames(void)
2018 GET_CURRENT_CONTEXT(ctx
);
2019 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2020 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_INIT_NAMES
, 0);
2021 if (ctx
->ExecuteFlag
) {
2022 CALL_InitNames(ctx
->Exec
, ());
2027 static void GLAPIENTRY
2028 save_Lightfv(GLenum light
, GLenum pname
, const GLfloat
*params
)
2030 GET_CURRENT_CONTEXT(ctx
);
2032 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2033 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LIGHT
, 6);
2051 case GL_SPOT_DIRECTION
:
2054 case GL_SPOT_EXPONENT
:
2057 case GL_SPOT_CUTOFF
:
2060 case GL_CONSTANT_ATTENUATION
:
2063 case GL_LINEAR_ATTENUATION
:
2066 case GL_QUADRATIC_ATTENUATION
:
2072 for (i
= 0; i
< nParams
; i
++) {
2073 n
[3 + i
].f
= params
[i
];
2076 if (ctx
->ExecuteFlag
) {
2077 CALL_Lightfv(ctx
->Exec
, (light
, pname
, params
));
2082 static void GLAPIENTRY
2083 save_Lightf(GLenum light
, GLenum pname
, GLfloat params
)
2085 save_Lightfv(light
, pname
, ¶ms
);
2089 static void GLAPIENTRY
2090 save_Lightiv(GLenum light
, GLenum pname
, const GLint
*params
)
2097 fparam
[0] = INT_TO_FLOAT(params
[0]);
2098 fparam
[1] = INT_TO_FLOAT(params
[1]);
2099 fparam
[2] = INT_TO_FLOAT(params
[2]);
2100 fparam
[3] = INT_TO_FLOAT(params
[3]);
2103 fparam
[0] = (GLfloat
) params
[0];
2104 fparam
[1] = (GLfloat
) params
[1];
2105 fparam
[2] = (GLfloat
) params
[2];
2106 fparam
[3] = (GLfloat
) params
[3];
2108 case GL_SPOT_DIRECTION
:
2109 fparam
[0] = (GLfloat
) params
[0];
2110 fparam
[1] = (GLfloat
) params
[1];
2111 fparam
[2] = (GLfloat
) params
[2];
2113 case GL_SPOT_EXPONENT
:
2114 case GL_SPOT_CUTOFF
:
2115 case GL_CONSTANT_ATTENUATION
:
2116 case GL_LINEAR_ATTENUATION
:
2117 case GL_QUADRATIC_ATTENUATION
:
2118 fparam
[0] = (GLfloat
) params
[0];
2121 /* error will be caught later in gl_Lightfv */
2124 save_Lightfv(light
, pname
, fparam
);
2128 static void GLAPIENTRY
2129 save_Lighti(GLenum light
, GLenum pname
, GLint param
)
2131 save_Lightiv(light
, pname
, ¶m
);
2135 static void GLAPIENTRY
2136 save_LightModelfv(GLenum pname
, const GLfloat
*params
)
2138 GET_CURRENT_CONTEXT(ctx
);
2140 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2141 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LIGHT_MODEL
, 5);
2149 if (ctx
->ExecuteFlag
) {
2150 CALL_LightModelfv(ctx
->Exec
, (pname
, params
));
2155 static void GLAPIENTRY
2156 save_LightModelf(GLenum pname
, GLfloat param
)
2158 save_LightModelfv(pname
, ¶m
);
2162 static void GLAPIENTRY
2163 save_LightModeliv(GLenum pname
, const GLint
*params
)
2167 case GL_LIGHT_MODEL_AMBIENT
:
2168 fparam
[0] = INT_TO_FLOAT(params
[0]);
2169 fparam
[1] = INT_TO_FLOAT(params
[1]);
2170 fparam
[2] = INT_TO_FLOAT(params
[2]);
2171 fparam
[3] = INT_TO_FLOAT(params
[3]);
2173 case GL_LIGHT_MODEL_LOCAL_VIEWER
:
2174 case GL_LIGHT_MODEL_TWO_SIDE
:
2175 case GL_LIGHT_MODEL_COLOR_CONTROL
:
2176 fparam
[0] = (GLfloat
) params
[0];
2179 /* Error will be caught later in gl_LightModelfv */
2180 ASSIGN_4V(fparam
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
2182 save_LightModelfv(pname
, fparam
);
2186 static void GLAPIENTRY
2187 save_LightModeli(GLenum pname
, GLint param
)
2189 save_LightModeliv(pname
, ¶m
);
2193 static void GLAPIENTRY
2194 save_LineStipple(GLint factor
, GLushort pattern
)
2196 GET_CURRENT_CONTEXT(ctx
);
2198 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2199 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LINE_STIPPLE
, 2);
2204 if (ctx
->ExecuteFlag
) {
2205 CALL_LineStipple(ctx
->Exec
, (factor
, pattern
));
2210 static void GLAPIENTRY
2211 save_LineWidth(GLfloat width
)
2213 GET_CURRENT_CONTEXT(ctx
);
2215 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2216 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LINE_WIDTH
, 1);
2220 if (ctx
->ExecuteFlag
) {
2221 CALL_LineWidth(ctx
->Exec
, (width
));
2226 static void GLAPIENTRY
2227 save_ListBase(GLuint base
)
2229 GET_CURRENT_CONTEXT(ctx
);
2231 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2232 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LIST_BASE
, 1);
2236 if (ctx
->ExecuteFlag
) {
2237 CALL_ListBase(ctx
->Exec
, (base
));
2242 static void GLAPIENTRY
2243 save_LoadIdentity(void)
2245 GET_CURRENT_CONTEXT(ctx
);
2246 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2247 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_LOAD_IDENTITY
, 0);
2248 if (ctx
->ExecuteFlag
) {
2249 CALL_LoadIdentity(ctx
->Exec
, ());
2254 static void GLAPIENTRY
2255 save_LoadMatrixf(const GLfloat
* m
)
2257 GET_CURRENT_CONTEXT(ctx
);
2259 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2260 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LOAD_MATRIX
, 16);
2263 for (i
= 0; i
< 16; i
++) {
2267 if (ctx
->ExecuteFlag
) {
2268 CALL_LoadMatrixf(ctx
->Exec
, (m
));
2273 static void GLAPIENTRY
2274 save_LoadMatrixd(const GLdouble
* m
)
2278 for (i
= 0; i
< 16; i
++) {
2279 f
[i
] = (GLfloat
) m
[i
];
2281 save_LoadMatrixf(f
);
2285 static void GLAPIENTRY
2286 save_LoadName(GLuint name
)
2288 GET_CURRENT_CONTEXT(ctx
);
2290 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2291 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LOAD_NAME
, 1);
2295 if (ctx
->ExecuteFlag
) {
2296 CALL_LoadName(ctx
->Exec
, (name
));
2301 static void GLAPIENTRY
2302 save_LogicOp(GLenum opcode
)
2304 GET_CURRENT_CONTEXT(ctx
);
2306 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2307 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LOGIC_OP
, 1);
2311 if (ctx
->ExecuteFlag
) {
2312 CALL_LogicOp(ctx
->Exec
, (opcode
));
2317 static void GLAPIENTRY
2318 save_Map1d(GLenum target
, GLdouble u1
, GLdouble u2
, GLint stride
,
2319 GLint order
, const GLdouble
* points
)
2321 GET_CURRENT_CONTEXT(ctx
);
2323 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2324 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MAP1
, 6);
2326 GLfloat
*pnts
= _mesa_copy_map_points1d(target
, stride
, order
, points
);
2328 n
[2].f
= (GLfloat
) u1
;
2329 n
[3].f
= (GLfloat
) u2
;
2330 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2332 n
[6].data
= (void *) pnts
;
2334 if (ctx
->ExecuteFlag
) {
2335 CALL_Map1d(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2339 static void GLAPIENTRY
2340 save_Map1f(GLenum target
, GLfloat u1
, GLfloat u2
, GLint stride
,
2341 GLint order
, const GLfloat
* points
)
2343 GET_CURRENT_CONTEXT(ctx
);
2345 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2346 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MAP1
, 6);
2348 GLfloat
*pnts
= _mesa_copy_map_points1f(target
, stride
, order
, points
);
2352 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2354 n
[6].data
= (void *) pnts
;
2356 if (ctx
->ExecuteFlag
) {
2357 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2362 static void GLAPIENTRY
2363 save_Map2d(GLenum target
,
2364 GLdouble u1
, GLdouble u2
, GLint ustride
, GLint uorder
,
2365 GLdouble v1
, GLdouble v2
, GLint vstride
, GLint vorder
,
2366 const GLdouble
* points
)
2368 GET_CURRENT_CONTEXT(ctx
);
2370 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2371 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MAP2
, 10);
2373 GLfloat
*pnts
= _mesa_copy_map_points2d(target
, ustride
, uorder
,
2374 vstride
, vorder
, points
);
2376 n
[2].f
= (GLfloat
) u1
;
2377 n
[3].f
= (GLfloat
) u2
;
2378 n
[4].f
= (GLfloat
) v1
;
2379 n
[5].f
= (GLfloat
) v2
;
2380 /* XXX verify these strides are correct */
2381 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2382 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2385 n
[10].data
= (void *) pnts
;
2387 if (ctx
->ExecuteFlag
) {
2388 CALL_Map2d(ctx
->Exec
, (target
,
2389 u1
, u2
, ustride
, uorder
,
2390 v1
, v2
, vstride
, vorder
, points
));
2395 static void GLAPIENTRY
2396 save_Map2f(GLenum target
,
2397 GLfloat u1
, GLfloat u2
, GLint ustride
, GLint uorder
,
2398 GLfloat v1
, GLfloat v2
, GLint vstride
, GLint vorder
,
2399 const GLfloat
* points
)
2401 GET_CURRENT_CONTEXT(ctx
);
2403 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2404 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MAP2
, 10);
2406 GLfloat
*pnts
= _mesa_copy_map_points2f(target
, ustride
, uorder
,
2407 vstride
, vorder
, points
);
2413 /* XXX verify these strides are correct */
2414 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2415 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2418 n
[10].data
= (void *) pnts
;
2420 if (ctx
->ExecuteFlag
) {
2421 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
2422 v1
, v2
, vstride
, vorder
, points
));
2427 static void GLAPIENTRY
2428 save_MapGrid1f(GLint un
, GLfloat u1
, GLfloat u2
)
2430 GET_CURRENT_CONTEXT(ctx
);
2432 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2433 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MAPGRID1
, 3);
2439 if (ctx
->ExecuteFlag
) {
2440 CALL_MapGrid1f(ctx
->Exec
, (un
, u1
, u2
));
2445 static void GLAPIENTRY
2446 save_MapGrid1d(GLint un
, GLdouble u1
, GLdouble u2
)
2448 save_MapGrid1f(un
, (GLfloat
) u1
, (GLfloat
) u2
);
2452 static void GLAPIENTRY
2453 save_MapGrid2f(GLint un
, GLfloat u1
, GLfloat u2
,
2454 GLint vn
, GLfloat v1
, GLfloat v2
)
2456 GET_CURRENT_CONTEXT(ctx
);
2458 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2459 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MAPGRID2
, 6);
2468 if (ctx
->ExecuteFlag
) {
2469 CALL_MapGrid2f(ctx
->Exec
, (un
, u1
, u2
, vn
, v1
, v2
));
2475 static void GLAPIENTRY
2476 save_MapGrid2d(GLint un
, GLdouble u1
, GLdouble u2
,
2477 GLint vn
, GLdouble v1
, GLdouble v2
)
2479 save_MapGrid2f(un
, (GLfloat
) u1
, (GLfloat
) u2
,
2480 vn
, (GLfloat
) v1
, (GLfloat
) v2
);
2484 static void GLAPIENTRY
2485 save_MatrixMode(GLenum mode
)
2487 GET_CURRENT_CONTEXT(ctx
);
2489 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2490 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MATRIX_MODE
, 1);
2494 if (ctx
->ExecuteFlag
) {
2495 CALL_MatrixMode(ctx
->Exec
, (mode
));
2500 static void GLAPIENTRY
2501 save_Minmax(GLenum target
, GLenum internalFormat
, GLboolean sink
)
2503 GET_CURRENT_CONTEXT(ctx
);
2506 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2507 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MIN_MAX
, 3);
2510 n
[2].e
= internalFormat
;
2513 if (ctx
->ExecuteFlag
) {
2514 CALL_Minmax(ctx
->Exec
, (target
, internalFormat
, sink
));
2519 static void GLAPIENTRY
2520 save_MultMatrixf(const GLfloat
* m
)
2522 GET_CURRENT_CONTEXT(ctx
);
2524 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2525 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MULT_MATRIX
, 16);
2528 for (i
= 0; i
< 16; i
++) {
2532 if (ctx
->ExecuteFlag
) {
2533 CALL_MultMatrixf(ctx
->Exec
, (m
));
2538 static void GLAPIENTRY
2539 save_MultMatrixd(const GLdouble
* m
)
2543 for (i
= 0; i
< 16; i
++) {
2544 f
[i
] = (GLfloat
) m
[i
];
2546 save_MultMatrixf(f
);
2550 static void GLAPIENTRY
2551 save_NewList(GLuint name
, GLenum mode
)
2553 GET_CURRENT_CONTEXT(ctx
);
2554 /* It's an error to call this function while building a display list */
2555 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
2562 static void GLAPIENTRY
2563 save_Ortho(GLdouble left
, GLdouble right
,
2564 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
2566 GET_CURRENT_CONTEXT(ctx
);
2568 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2569 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ORTHO
, 6);
2571 n
[1].f
= (GLfloat
) left
;
2572 n
[2].f
= (GLfloat
) right
;
2573 n
[3].f
= (GLfloat
) bottom
;
2574 n
[4].f
= (GLfloat
) top
;
2575 n
[5].f
= (GLfloat
) nearval
;
2576 n
[6].f
= (GLfloat
) farval
;
2578 if (ctx
->ExecuteFlag
) {
2579 CALL_Ortho(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
2584 static void GLAPIENTRY
2585 save_PixelMapfv(GLenum map
, GLint mapsize
, const GLfloat
*values
)
2587 GET_CURRENT_CONTEXT(ctx
);
2589 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2590 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PIXEL_MAP
, 3);
2594 n
[3].data
= (void *) _mesa_malloc(mapsize
* sizeof(GLfloat
));
2595 MEMCPY(n
[3].data
, (void *) values
, mapsize
* sizeof(GLfloat
));
2597 if (ctx
->ExecuteFlag
) {
2598 CALL_PixelMapfv(ctx
->Exec
, (map
, mapsize
, values
));
2603 static void GLAPIENTRY
2604 save_PixelMapuiv(GLenum map
, GLint mapsize
, const GLuint
*values
)
2606 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2608 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
2609 for (i
= 0; i
< mapsize
; i
++) {
2610 fvalues
[i
] = (GLfloat
) values
[i
];
2614 for (i
= 0; i
< mapsize
; i
++) {
2615 fvalues
[i
] = UINT_TO_FLOAT(values
[i
]);
2618 save_PixelMapfv(map
, mapsize
, fvalues
);
2622 static void GLAPIENTRY
2623 save_PixelMapusv(GLenum map
, GLint mapsize
, const GLushort
*values
)
2625 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2627 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
2628 for (i
= 0; i
< mapsize
; i
++) {
2629 fvalues
[i
] = (GLfloat
) values
[i
];
2633 for (i
= 0; i
< mapsize
; i
++) {
2634 fvalues
[i
] = USHORT_TO_FLOAT(values
[i
]);
2637 save_PixelMapfv(map
, mapsize
, fvalues
);
2641 static void GLAPIENTRY
2642 save_PixelTransferf(GLenum pname
, GLfloat param
)
2644 GET_CURRENT_CONTEXT(ctx
);
2646 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2647 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PIXEL_TRANSFER
, 2);
2652 if (ctx
->ExecuteFlag
) {
2653 CALL_PixelTransferf(ctx
->Exec
, (pname
, param
));
2658 static void GLAPIENTRY
2659 save_PixelTransferi(GLenum pname
, GLint param
)
2661 save_PixelTransferf(pname
, (GLfloat
) param
);
2665 static void GLAPIENTRY
2666 save_PixelZoom(GLfloat xfactor
, GLfloat yfactor
)
2668 GET_CURRENT_CONTEXT(ctx
);
2670 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2671 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PIXEL_ZOOM
, 2);
2676 if (ctx
->ExecuteFlag
) {
2677 CALL_PixelZoom(ctx
->Exec
, (xfactor
, yfactor
));
2682 static void GLAPIENTRY
2683 save_PointParameterfvEXT(GLenum pname
, const GLfloat
*params
)
2685 GET_CURRENT_CONTEXT(ctx
);
2687 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2688 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_POINT_PARAMETERS
, 4);
2695 if (ctx
->ExecuteFlag
) {
2696 CALL_PointParameterfvEXT(ctx
->Exec
, (pname
, params
));
2701 static void GLAPIENTRY
2702 save_PointParameterfEXT(GLenum pname
, GLfloat param
)
2704 save_PointParameterfvEXT(pname
, ¶m
);
2707 static void GLAPIENTRY
2708 save_PointParameteriNV(GLenum pname
, GLint param
)
2710 GLfloat p
= (GLfloat
) param
;
2711 save_PointParameterfvEXT(pname
, &p
);
2714 static void GLAPIENTRY
2715 save_PointParameterivNV(GLenum pname
, const GLint
* param
)
2717 GLfloat p
= (GLfloat
) param
[0];
2718 save_PointParameterfvEXT(pname
, &p
);
2722 static void GLAPIENTRY
2723 save_PointSize(GLfloat size
)
2725 GET_CURRENT_CONTEXT(ctx
);
2727 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2728 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_POINT_SIZE
, 1);
2732 if (ctx
->ExecuteFlag
) {
2733 CALL_PointSize(ctx
->Exec
, (size
));
2738 static void GLAPIENTRY
2739 save_PolygonMode(GLenum face
, GLenum mode
)
2741 GET_CURRENT_CONTEXT(ctx
);
2743 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2744 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_POLYGON_MODE
, 2);
2749 if (ctx
->ExecuteFlag
) {
2750 CALL_PolygonMode(ctx
->Exec
, (face
, mode
));
2755 static void GLAPIENTRY
2756 save_PolygonStipple(const GLubyte
* pattern
)
2758 GET_CURRENT_CONTEXT(ctx
);
2761 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2763 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_POLYGON_STIPPLE
, 1);
2765 n
[1].data
= unpack_image(ctx
, 2, 32, 32, 1, GL_COLOR_INDEX
, GL_BITMAP
,
2766 pattern
, &ctx
->Unpack
);
2768 if (ctx
->ExecuteFlag
) {
2769 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) pattern
));
2774 static void GLAPIENTRY
2775 save_PolygonOffset(GLfloat factor
, GLfloat units
)
2777 GET_CURRENT_CONTEXT(ctx
);
2779 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2780 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_POLYGON_OFFSET
, 2);
2785 if (ctx
->ExecuteFlag
) {
2786 CALL_PolygonOffset(ctx
->Exec
, (factor
, units
));
2791 static void GLAPIENTRY
2792 save_PolygonOffsetEXT(GLfloat factor
, GLfloat bias
)
2794 GET_CURRENT_CONTEXT(ctx
);
2795 /* XXX mult by DepthMaxF here??? */
2796 save_PolygonOffset(factor
, ctx
->DrawBuffer
->_DepthMaxF
* bias
);
2800 static void GLAPIENTRY
2801 save_PopAttrib(void)
2803 GET_CURRENT_CONTEXT(ctx
);
2804 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2805 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_POP_ATTRIB
, 0);
2806 if (ctx
->ExecuteFlag
) {
2807 CALL_PopAttrib(ctx
->Exec
, ());
2812 static void GLAPIENTRY
2813 save_PopMatrix(void)
2815 GET_CURRENT_CONTEXT(ctx
);
2816 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2817 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_POP_MATRIX
, 0);
2818 if (ctx
->ExecuteFlag
) {
2819 CALL_PopMatrix(ctx
->Exec
, ());
2824 static void GLAPIENTRY
2827 GET_CURRENT_CONTEXT(ctx
);
2828 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2829 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_POP_NAME
, 0);
2830 if (ctx
->ExecuteFlag
) {
2831 CALL_PopName(ctx
->Exec
, ());
2836 static void GLAPIENTRY
2837 save_PrioritizeTextures(GLsizei num
, const GLuint
* textures
,
2838 const GLclampf
* priorities
)
2840 GET_CURRENT_CONTEXT(ctx
);
2842 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2844 for (i
= 0; i
< num
; i
++) {
2846 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PRIORITIZE_TEXTURE
, 2);
2848 n
[1].ui
= textures
[i
];
2849 n
[2].f
= priorities
[i
];
2852 if (ctx
->ExecuteFlag
) {
2853 CALL_PrioritizeTextures(ctx
->Exec
, (num
, textures
, priorities
));
2858 static void GLAPIENTRY
2859 save_PushAttrib(GLbitfield mask
)
2861 GET_CURRENT_CONTEXT(ctx
);
2863 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2864 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PUSH_ATTRIB
, 1);
2868 if (ctx
->ExecuteFlag
) {
2869 CALL_PushAttrib(ctx
->Exec
, (mask
));
2874 static void GLAPIENTRY
2875 save_PushMatrix(void)
2877 GET_CURRENT_CONTEXT(ctx
);
2878 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2879 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_PUSH_MATRIX
, 0);
2880 if (ctx
->ExecuteFlag
) {
2881 CALL_PushMatrix(ctx
->Exec
, ());
2886 static void GLAPIENTRY
2887 save_PushName(GLuint name
)
2889 GET_CURRENT_CONTEXT(ctx
);
2891 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2892 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PUSH_NAME
, 1);
2896 if (ctx
->ExecuteFlag
) {
2897 CALL_PushName(ctx
->Exec
, (name
));
2902 static void GLAPIENTRY
2903 save_RasterPos4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
2905 GET_CURRENT_CONTEXT(ctx
);
2907 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2908 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_RASTER_POS
, 4);
2915 if (ctx
->ExecuteFlag
) {
2916 CALL_RasterPos4f(ctx
->Exec
, (x
, y
, z
, w
));
2920 static void GLAPIENTRY
2921 save_RasterPos2d(GLdouble x
, GLdouble y
)
2923 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
2926 static void GLAPIENTRY
2927 save_RasterPos2f(GLfloat x
, GLfloat y
)
2929 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2932 static void GLAPIENTRY
2933 save_RasterPos2i(GLint x
, GLint y
)
2935 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
2938 static void GLAPIENTRY
2939 save_RasterPos2s(GLshort x
, GLshort y
)
2941 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2944 static void GLAPIENTRY
2945 save_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
2947 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
2950 static void GLAPIENTRY
2951 save_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
2953 save_RasterPos4f(x
, y
, z
, 1.0F
);
2956 static void GLAPIENTRY
2957 save_RasterPos3i(GLint x
, GLint y
, GLint z
)
2959 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
2962 static void GLAPIENTRY
2963 save_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
2965 save_RasterPos4f(x
, y
, z
, 1.0F
);
2968 static void GLAPIENTRY
2969 save_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
2971 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
2974 static void GLAPIENTRY
2975 save_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
2977 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
2980 static void GLAPIENTRY
2981 save_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
2983 save_RasterPos4f(x
, y
, z
, w
);
2986 static void GLAPIENTRY
2987 save_RasterPos2dv(const GLdouble
* v
)
2989 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
2992 static void GLAPIENTRY
2993 save_RasterPos2fv(const GLfloat
* v
)
2995 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2998 static void GLAPIENTRY
2999 save_RasterPos2iv(const GLint
* v
)
3001 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3004 static void GLAPIENTRY
3005 save_RasterPos2sv(const GLshort
* v
)
3007 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3010 static void GLAPIENTRY
3011 save_RasterPos3dv(const GLdouble
* v
)
3013 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3016 static void GLAPIENTRY
3017 save_RasterPos3fv(const GLfloat
* v
)
3019 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3022 static void GLAPIENTRY
3023 save_RasterPos3iv(const GLint
* v
)
3025 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3028 static void GLAPIENTRY
3029 save_RasterPos3sv(const GLshort
* v
)
3031 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3034 static void GLAPIENTRY
3035 save_RasterPos4dv(const GLdouble
* v
)
3037 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3038 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3041 static void GLAPIENTRY
3042 save_RasterPos4fv(const GLfloat
* v
)
3044 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3047 static void GLAPIENTRY
3048 save_RasterPos4iv(const GLint
* v
)
3050 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3051 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3054 static void GLAPIENTRY
3055 save_RasterPos4sv(const GLshort
* v
)
3057 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3061 static void GLAPIENTRY
3062 save_PassThrough(GLfloat token
)
3064 GET_CURRENT_CONTEXT(ctx
);
3066 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3067 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PASSTHROUGH
, 1);
3071 if (ctx
->ExecuteFlag
) {
3072 CALL_PassThrough(ctx
->Exec
, (token
));
3077 static void GLAPIENTRY
3078 save_ReadBuffer(GLenum mode
)
3080 GET_CURRENT_CONTEXT(ctx
);
3082 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3083 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_READ_BUFFER
, 1);
3087 if (ctx
->ExecuteFlag
) {
3088 CALL_ReadBuffer(ctx
->Exec
, (mode
));
3093 static void GLAPIENTRY
3094 save_ResetHistogram(GLenum target
)
3096 GET_CURRENT_CONTEXT(ctx
);
3098 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3099 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_RESET_HISTOGRAM
, 1);
3103 if (ctx
->ExecuteFlag
) {
3104 CALL_ResetHistogram(ctx
->Exec
, (target
));
3109 static void GLAPIENTRY
3110 save_ResetMinmax(GLenum target
)
3112 GET_CURRENT_CONTEXT(ctx
);
3114 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3115 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_RESET_MIN_MAX
, 1);
3119 if (ctx
->ExecuteFlag
) {
3120 CALL_ResetMinmax(ctx
->Exec
, (target
));
3125 static void GLAPIENTRY
3126 save_Rotatef(GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
3128 GET_CURRENT_CONTEXT(ctx
);
3130 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3131 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ROTATE
, 4);
3138 if (ctx
->ExecuteFlag
) {
3139 CALL_Rotatef(ctx
->Exec
, (angle
, x
, y
, z
));
3144 static void GLAPIENTRY
3145 save_Rotated(GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
3147 save_Rotatef((GLfloat
) angle
, (GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3151 static void GLAPIENTRY
3152 save_Scalef(GLfloat x
, GLfloat y
, GLfloat z
)
3154 GET_CURRENT_CONTEXT(ctx
);
3156 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3157 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SCALE
, 3);
3163 if (ctx
->ExecuteFlag
) {
3164 CALL_Scalef(ctx
->Exec
, (x
, y
, z
));
3169 static void GLAPIENTRY
3170 save_Scaled(GLdouble x
, GLdouble y
, GLdouble z
)
3172 save_Scalef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3176 static void GLAPIENTRY
3177 save_Scissor(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3179 GET_CURRENT_CONTEXT(ctx
);
3181 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3182 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SCISSOR
, 4);
3189 if (ctx
->ExecuteFlag
) {
3190 CALL_Scissor(ctx
->Exec
, (x
, y
, width
, height
));
3195 static void GLAPIENTRY
3196 save_ShadeModel(GLenum mode
)
3198 GET_CURRENT_CONTEXT(ctx
);
3200 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx
);
3202 if (ctx
->ExecuteFlag
) {
3203 CALL_ShadeModel(ctx
->Exec
, (mode
));
3206 if (ctx
->ListState
.Current
.ShadeModel
== mode
)
3209 SAVE_FLUSH_VERTICES(ctx
);
3211 /* Only save the value if we know the statechange will take effect:
3213 if (ctx
->Driver
.CurrentSavePrimitive
== PRIM_OUTSIDE_BEGIN_END
)
3214 ctx
->ListState
.Current
.ShadeModel
= mode
;
3216 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SHADE_MODEL
, 1);
3223 static void GLAPIENTRY
3224 save_StencilFunc(GLenum func
, GLint ref
, GLuint mask
)
3226 GET_CURRENT_CONTEXT(ctx
);
3228 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3229 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_FUNC
, 3);
3235 if (ctx
->ExecuteFlag
) {
3236 CALL_StencilFunc(ctx
->Exec
, (func
, ref
, mask
));
3241 static void GLAPIENTRY
3242 save_StencilMask(GLuint mask
)
3244 GET_CURRENT_CONTEXT(ctx
);
3246 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3247 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_MASK
, 1);
3251 if (ctx
->ExecuteFlag
) {
3252 CALL_StencilMask(ctx
->Exec
, (mask
));
3257 static void GLAPIENTRY
3258 save_StencilOp(GLenum fail
, GLenum zfail
, GLenum zpass
)
3260 GET_CURRENT_CONTEXT(ctx
);
3262 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3263 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_OP
, 3);
3269 if (ctx
->ExecuteFlag
) {
3270 CALL_StencilOp(ctx
->Exec
, (fail
, zfail
, zpass
));
3275 static void GLAPIENTRY
3276 save_StencilFuncSeparate(GLenum face
, GLenum func
, GLint ref
, GLuint mask
)
3278 GET_CURRENT_CONTEXT(ctx
);
3280 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3281 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3288 if (ctx
->ExecuteFlag
) {
3289 CALL_StencilFuncSeparate(ctx
->Exec
, (face
, func
, ref
, mask
));
3294 static void GLAPIENTRY
3295 save_StencilFuncSeparateATI(GLenum frontfunc
, GLenum backfunc
, GLint ref
,
3298 GET_CURRENT_CONTEXT(ctx
);
3300 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3302 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3310 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3317 if (ctx
->ExecuteFlag
) {
3318 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_FRONT
, frontfunc
, ref
, mask
));
3319 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_BACK
, backfunc
, ref
, mask
));
3324 static void GLAPIENTRY
3325 save_StencilMaskSeparate(GLenum face
, GLuint mask
)
3327 GET_CURRENT_CONTEXT(ctx
);
3329 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3330 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_MASK_SEPARATE
, 2);
3335 if (ctx
->ExecuteFlag
) {
3336 CALL_StencilMaskSeparate(ctx
->Exec
, (face
, mask
));
3341 static void GLAPIENTRY
3342 save_StencilOpSeparate(GLenum face
, GLenum fail
, GLenum zfail
, GLenum zpass
)
3344 GET_CURRENT_CONTEXT(ctx
);
3346 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3347 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_OP_SEPARATE
, 4);
3354 if (ctx
->ExecuteFlag
) {
3355 CALL_StencilOpSeparate(ctx
->Exec
, (face
, fail
, zfail
, zpass
));
3360 static void GLAPIENTRY
3361 save_TexEnvfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3363 GET_CURRENT_CONTEXT(ctx
);
3365 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3366 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEXENV
, 6);
3370 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3378 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
3381 if (ctx
->ExecuteFlag
) {
3382 CALL_TexEnvfv(ctx
->Exec
, (target
, pname
, params
));
3387 static void GLAPIENTRY
3388 save_TexEnvf(GLenum target
, GLenum pname
, GLfloat param
)
3390 save_TexEnvfv(target
, pname
, ¶m
);
3394 static void GLAPIENTRY
3395 save_TexEnvi(GLenum target
, GLenum pname
, GLint param
)
3398 p
[0] = (GLfloat
) param
;
3399 p
[1] = p
[2] = p
[3] = 0.0;
3400 save_TexEnvfv(target
, pname
, p
);
3404 static void GLAPIENTRY
3405 save_TexEnviv(GLenum target
, GLenum pname
, const GLint
* param
)
3408 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3409 p
[0] = INT_TO_FLOAT(param
[0]);
3410 p
[1] = INT_TO_FLOAT(param
[1]);
3411 p
[2] = INT_TO_FLOAT(param
[2]);
3412 p
[3] = INT_TO_FLOAT(param
[3]);
3415 p
[0] = (GLfloat
) param
[0];
3416 p
[1] = p
[2] = p
[3] = 0.0F
;
3418 save_TexEnvfv(target
, pname
, p
);
3422 static void GLAPIENTRY
3423 save_TexGenfv(GLenum coord
, GLenum pname
, const GLfloat
*params
)
3425 GET_CURRENT_CONTEXT(ctx
);
3427 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3428 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEXGEN
, 6);
3437 if (ctx
->ExecuteFlag
) {
3438 CALL_TexGenfv(ctx
->Exec
, (coord
, pname
, params
));
3443 static void GLAPIENTRY
3444 save_TexGeniv(GLenum coord
, GLenum pname
, const GLint
*params
)
3447 p
[0] = (GLfloat
) params
[0];
3448 p
[1] = (GLfloat
) params
[1];
3449 p
[2] = (GLfloat
) params
[2];
3450 p
[3] = (GLfloat
) params
[3];
3451 save_TexGenfv(coord
, pname
, p
);
3455 static void GLAPIENTRY
3456 save_TexGend(GLenum coord
, GLenum pname
, GLdouble param
)
3458 GLfloat p
= (GLfloat
) param
;
3459 save_TexGenfv(coord
, pname
, &p
);
3463 static void GLAPIENTRY
3464 save_TexGendv(GLenum coord
, GLenum pname
, const GLdouble
*params
)
3467 p
[0] = (GLfloat
) params
[0];
3468 p
[1] = (GLfloat
) params
[1];
3469 p
[2] = (GLfloat
) params
[2];
3470 p
[3] = (GLfloat
) params
[3];
3471 save_TexGenfv(coord
, pname
, p
);
3475 static void GLAPIENTRY
3476 save_TexGenf(GLenum coord
, GLenum pname
, GLfloat param
)
3478 save_TexGenfv(coord
, pname
, ¶m
);
3482 static void GLAPIENTRY
3483 save_TexGeni(GLenum coord
, GLenum pname
, GLint param
)
3485 save_TexGeniv(coord
, pname
, ¶m
);
3489 static void GLAPIENTRY
3490 save_TexParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3492 GET_CURRENT_CONTEXT(ctx
);
3494 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3495 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEXPARAMETER
, 6);
3504 if (ctx
->ExecuteFlag
) {
3505 CALL_TexParameterfv(ctx
->Exec
, (target
, pname
, params
));
3510 static void GLAPIENTRY
3511 save_TexParameterf(GLenum target
, GLenum pname
, GLfloat param
)
3513 save_TexParameterfv(target
, pname
, ¶m
);
3517 static void GLAPIENTRY
3518 save_TexParameteri(GLenum target
, GLenum pname
, GLint param
)
3521 fparam
[0] = (GLfloat
) param
;
3522 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
3523 save_TexParameterfv(target
, pname
, fparam
);
3527 static void GLAPIENTRY
3528 save_TexParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
3531 fparam
[0] = (GLfloat
) params
[0];
3532 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
3533 save_TexParameterfv(target
, pname
, fparam
);
3537 static void GLAPIENTRY
3538 save_TexImage1D(GLenum target
,
3539 GLint level
, GLint components
,
3540 GLsizei width
, GLint border
,
3541 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3543 GET_CURRENT_CONTEXT(ctx
);
3544 if (target
== GL_PROXY_TEXTURE_1D
) {
3545 /* don't compile, execute immediately */
3546 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
3547 border
, format
, type
, pixels
));
3551 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3552 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_IMAGE1D
, 8);
3556 n
[3].i
= components
;
3557 n
[4].i
= (GLint
) width
;
3561 n
[8].data
= unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
3562 pixels
, &ctx
->Unpack
);
3564 if (ctx
->ExecuteFlag
) {
3565 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
3566 border
, format
, type
, pixels
));
3572 static void GLAPIENTRY
3573 save_TexImage2D(GLenum target
,
3574 GLint level
, GLint components
,
3575 GLsizei width
, GLsizei height
, GLint border
,
3576 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3578 GET_CURRENT_CONTEXT(ctx
);
3579 if (target
== GL_PROXY_TEXTURE_2D
) {
3580 /* don't compile, execute immediately */
3581 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
3582 height
, border
, format
, type
, pixels
));
3586 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3587 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_IMAGE2D
, 9);
3591 n
[3].i
= components
;
3592 n
[4].i
= (GLint
) width
;
3593 n
[5].i
= (GLint
) height
;
3597 n
[9].data
= unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
3598 pixels
, &ctx
->Unpack
);
3600 if (ctx
->ExecuteFlag
) {
3601 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
3602 height
, border
, format
, type
, pixels
));
3608 static void GLAPIENTRY
3609 save_TexImage3D(GLenum target
,
3610 GLint level
, GLint internalFormat
,
3611 GLsizei width
, GLsizei height
, GLsizei depth
,
3613 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3615 GET_CURRENT_CONTEXT(ctx
);
3616 if (target
== GL_PROXY_TEXTURE_3D
) {
3617 /* don't compile, execute immediately */
3618 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
3619 height
, depth
, border
, format
, type
,
3624 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3625 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_IMAGE3D
, 10);
3629 n
[3].i
= (GLint
) internalFormat
;
3630 n
[4].i
= (GLint
) width
;
3631 n
[5].i
= (GLint
) height
;
3632 n
[6].i
= (GLint
) depth
;
3636 n
[10].data
= unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
3637 pixels
, &ctx
->Unpack
);
3639 if (ctx
->ExecuteFlag
) {
3640 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
3641 height
, depth
, border
, format
, type
,
3648 static void GLAPIENTRY
3649 save_TexSubImage1D(GLenum target
, GLint level
, GLint xoffset
,
3650 GLsizei width
, GLenum format
, GLenum type
,
3651 const GLvoid
* pixels
)
3653 GET_CURRENT_CONTEXT(ctx
);
3656 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3658 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_SUB_IMAGE1D
, 7);
3663 n
[4].i
= (GLint
) width
;
3666 n
[7].data
= unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
3667 pixels
, &ctx
->Unpack
);
3669 if (ctx
->ExecuteFlag
) {
3670 CALL_TexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
, width
,
3671 format
, type
, pixels
));
3676 static void GLAPIENTRY
3677 save_TexSubImage2D(GLenum target
, GLint level
,
3678 GLint xoffset
, GLint yoffset
,
3679 GLsizei width
, GLsizei height
,
3680 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3682 GET_CURRENT_CONTEXT(ctx
);
3685 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3687 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_SUB_IMAGE2D
, 9);
3693 n
[5].i
= (GLint
) width
;
3694 n
[6].i
= (GLint
) height
;
3697 n
[9].data
= unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
3698 pixels
, &ctx
->Unpack
);
3700 if (ctx
->ExecuteFlag
) {
3701 CALL_TexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
3702 width
, height
, format
, type
, pixels
));
3707 static void GLAPIENTRY
3708 save_TexSubImage3D(GLenum target
, GLint level
,
3709 GLint xoffset
, GLint yoffset
, GLint zoffset
,
3710 GLsizei width
, GLsizei height
, GLsizei depth
,
3711 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3713 GET_CURRENT_CONTEXT(ctx
);
3716 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3718 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_SUB_IMAGE3D
, 11);
3725 n
[6].i
= (GLint
) width
;
3726 n
[7].i
= (GLint
) height
;
3727 n
[8].i
= (GLint
) depth
;
3730 n
[11].data
= unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
3731 pixels
, &ctx
->Unpack
);
3733 if (ctx
->ExecuteFlag
) {
3734 CALL_TexSubImage3D(ctx
->Exec
, (target
, level
,
3735 xoffset
, yoffset
, zoffset
,
3736 width
, height
, depth
, format
, type
,
3742 static void GLAPIENTRY
3743 save_Translatef(GLfloat x
, GLfloat y
, GLfloat z
)
3745 GET_CURRENT_CONTEXT(ctx
);
3747 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3748 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TRANSLATE
, 3);
3754 if (ctx
->ExecuteFlag
) {
3755 CALL_Translatef(ctx
->Exec
, (x
, y
, z
));
3760 static void GLAPIENTRY
3761 save_Translated(GLdouble x
, GLdouble y
, GLdouble z
)
3763 save_Translatef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3768 static void GLAPIENTRY
3769 save_Viewport(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3771 GET_CURRENT_CONTEXT(ctx
);
3773 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3774 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_VIEWPORT
, 4);
3778 n
[3].i
= (GLint
) width
;
3779 n
[4].i
= (GLint
) height
;
3781 if (ctx
->ExecuteFlag
) {
3782 CALL_Viewport(ctx
->Exec
, (x
, y
, width
, height
));
3787 static void GLAPIENTRY
3788 save_WindowPos4fMESA(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3790 GET_CURRENT_CONTEXT(ctx
);
3792 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3793 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_WINDOW_POS
, 4);
3800 if (ctx
->ExecuteFlag
) {
3801 CALL_WindowPos4fMESA(ctx
->Exec
, (x
, y
, z
, w
));
3805 static void GLAPIENTRY
3806 save_WindowPos2dMESA(GLdouble x
, GLdouble y
)
3808 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3811 static void GLAPIENTRY
3812 save_WindowPos2fMESA(GLfloat x
, GLfloat y
)
3814 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3817 static void GLAPIENTRY
3818 save_WindowPos2iMESA(GLint x
, GLint y
)
3820 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3823 static void GLAPIENTRY
3824 save_WindowPos2sMESA(GLshort x
, GLshort y
)
3826 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3829 static void GLAPIENTRY
3830 save_WindowPos3dMESA(GLdouble x
, GLdouble y
, GLdouble z
)
3832 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3835 static void GLAPIENTRY
3836 save_WindowPos3fMESA(GLfloat x
, GLfloat y
, GLfloat z
)
3838 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3841 static void GLAPIENTRY
3842 save_WindowPos3iMESA(GLint x
, GLint y
, GLint z
)
3844 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3847 static void GLAPIENTRY
3848 save_WindowPos3sMESA(GLshort x
, GLshort y
, GLshort z
)
3850 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3853 static void GLAPIENTRY
3854 save_WindowPos4dMESA(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3856 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3859 static void GLAPIENTRY
3860 save_WindowPos4iMESA(GLint x
, GLint y
, GLint z
, GLint w
)
3862 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3865 static void GLAPIENTRY
3866 save_WindowPos4sMESA(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
3868 save_WindowPos4fMESA(x
, y
, z
, w
);
3871 static void GLAPIENTRY
3872 save_WindowPos2dvMESA(const GLdouble
* v
)
3874 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3877 static void GLAPIENTRY
3878 save_WindowPos2fvMESA(const GLfloat
* v
)
3880 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3883 static void GLAPIENTRY
3884 save_WindowPos2ivMESA(const GLint
* v
)
3886 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3889 static void GLAPIENTRY
3890 save_WindowPos2svMESA(const GLshort
* v
)
3892 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3895 static void GLAPIENTRY
3896 save_WindowPos3dvMESA(const GLdouble
* v
)
3898 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3901 static void GLAPIENTRY
3902 save_WindowPos3fvMESA(const GLfloat
* v
)
3904 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3907 static void GLAPIENTRY
3908 save_WindowPos3ivMESA(const GLint
* v
)
3910 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3913 static void GLAPIENTRY
3914 save_WindowPos3svMESA(const GLshort
* v
)
3916 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3919 static void GLAPIENTRY
3920 save_WindowPos4dvMESA(const GLdouble
* v
)
3922 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
3923 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3926 static void GLAPIENTRY
3927 save_WindowPos4fvMESA(const GLfloat
* v
)
3929 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3932 static void GLAPIENTRY
3933 save_WindowPos4ivMESA(const GLint
* v
)
3935 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
3936 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3939 static void GLAPIENTRY
3940 save_WindowPos4svMESA(const GLshort
* v
)
3942 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3947 /* GL_ARB_multitexture */
3948 static void GLAPIENTRY
3949 save_ActiveTextureARB(GLenum target
)
3951 GET_CURRENT_CONTEXT(ctx
);
3953 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3954 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ACTIVE_TEXTURE
, 1);
3958 if (ctx
->ExecuteFlag
) {
3959 CALL_ActiveTextureARB(ctx
->Exec
, (target
));
3964 /* GL_ARB_transpose_matrix */
3966 static void GLAPIENTRY
3967 save_LoadTransposeMatrixdARB(const GLdouble m
[16])
3970 _math_transposefd(tm
, m
);
3971 save_LoadMatrixf(tm
);
3975 static void GLAPIENTRY
3976 save_LoadTransposeMatrixfARB(const GLfloat m
[16])
3979 _math_transposef(tm
, m
);
3980 save_LoadMatrixf(tm
);
3984 static void GLAPIENTRY
3985 save_MultTransposeMatrixdARB(const GLdouble m
[16])
3988 _math_transposefd(tm
, m
);
3989 save_MultMatrixf(tm
);
3993 static void GLAPIENTRY
3994 save_MultTransposeMatrixfARB(const GLfloat m
[16])
3997 _math_transposef(tm
, m
);
3998 save_MultMatrixf(tm
);
4002 /* GL_ARB_texture_compression */
4003 static void GLAPIENTRY
4004 save_CompressedTexImage1DARB(GLenum target
, GLint level
,
4005 GLenum internalFormat
, GLsizei width
,
4006 GLint border
, GLsizei imageSize
,
4007 const GLvoid
* data
)
4009 GET_CURRENT_CONTEXT(ctx
);
4010 if (target
== GL_PROXY_TEXTURE_1D
) {
4011 /* don't compile, execute immediately */
4012 CALL_CompressedTexImage1DARB(ctx
->Exec
, (target
, level
, internalFormat
,
4013 width
, border
, imageSize
,
4019 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4020 /* make copy of image */
4021 image
= _mesa_malloc(imageSize
);
4023 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage1DARB");
4026 MEMCPY(image
, data
, imageSize
);
4027 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_1D
, 7);
4031 n
[3].e
= internalFormat
;
4032 n
[4].i
= (GLint
) width
;
4040 if (ctx
->ExecuteFlag
) {
4041 CALL_CompressedTexImage1DARB(ctx
->Exec
,
4042 (target
, level
, internalFormat
, width
,
4043 border
, imageSize
, data
));
4049 static void GLAPIENTRY
4050 save_CompressedTexImage2DARB(GLenum target
, GLint level
,
4051 GLenum internalFormat
, GLsizei width
,
4052 GLsizei height
, GLint border
, GLsizei imageSize
,
4053 const GLvoid
* data
)
4055 GET_CURRENT_CONTEXT(ctx
);
4056 if (target
== GL_PROXY_TEXTURE_2D
) {
4057 /* don't compile, execute immediately */
4058 CALL_CompressedTexImage2DARB(ctx
->Exec
, (target
, level
, internalFormat
,
4059 width
, height
, border
,
4065 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4066 /* make copy of image */
4067 image
= _mesa_malloc(imageSize
);
4069 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage2DARB");
4072 MEMCPY(image
, data
, imageSize
);
4073 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_2D
, 8);
4077 n
[3].e
= internalFormat
;
4078 n
[4].i
= (GLint
) width
;
4079 n
[5].i
= (GLint
) height
;
4087 if (ctx
->ExecuteFlag
) {
4088 CALL_CompressedTexImage2DARB(ctx
->Exec
,
4089 (target
, level
, internalFormat
, width
,
4090 height
, border
, imageSize
, data
));
4096 static void GLAPIENTRY
4097 save_CompressedTexImage3DARB(GLenum target
, GLint level
,
4098 GLenum internalFormat
, GLsizei width
,
4099 GLsizei height
, GLsizei depth
, GLint border
,
4100 GLsizei imageSize
, const GLvoid
* data
)
4102 GET_CURRENT_CONTEXT(ctx
);
4103 if (target
== GL_PROXY_TEXTURE_3D
) {
4104 /* don't compile, execute immediately */
4105 CALL_CompressedTexImage3DARB(ctx
->Exec
, (target
, level
, internalFormat
,
4106 width
, height
, depth
, border
,
4112 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4113 /* make copy of image */
4114 image
= _mesa_malloc(imageSize
);
4116 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage3DARB");
4119 MEMCPY(image
, data
, imageSize
);
4120 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_3D
, 9);
4124 n
[3].e
= internalFormat
;
4125 n
[4].i
= (GLint
) width
;
4126 n
[5].i
= (GLint
) height
;
4127 n
[6].i
= (GLint
) depth
;
4135 if (ctx
->ExecuteFlag
) {
4136 CALL_CompressedTexImage3DARB(ctx
->Exec
,
4137 (target
, level
, internalFormat
, width
,
4138 height
, depth
, border
, imageSize
,
4145 static void GLAPIENTRY
4146 save_CompressedTexSubImage1DARB(GLenum target
, GLint level
, GLint xoffset
,
4147 GLsizei width
, GLenum format
,
4148 GLsizei imageSize
, const GLvoid
* data
)
4153 GET_CURRENT_CONTEXT(ctx
);
4154 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4156 /* make copy of image */
4157 image
= _mesa_malloc(imageSize
);
4159 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage1DARB");
4162 MEMCPY(image
, data
, imageSize
);
4163 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
, 7);
4168 n
[4].i
= (GLint
) width
;
4176 if (ctx
->ExecuteFlag
) {
4177 CALL_CompressedTexSubImage1DARB(ctx
->Exec
, (target
, level
, xoffset
,
4178 width
, format
, imageSize
,
4184 static void GLAPIENTRY
4185 save_CompressedTexSubImage2DARB(GLenum target
, GLint level
, GLint xoffset
,
4186 GLint yoffset
, GLsizei width
, GLsizei height
,
4187 GLenum format
, GLsizei imageSize
,
4188 const GLvoid
* data
)
4193 GET_CURRENT_CONTEXT(ctx
);
4194 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4196 /* make copy of image */
4197 image
= _mesa_malloc(imageSize
);
4199 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage2DARB");
4202 MEMCPY(image
, data
, imageSize
);
4203 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
, 9);
4209 n
[5].i
= (GLint
) width
;
4210 n
[6].i
= (GLint
) height
;
4218 if (ctx
->ExecuteFlag
) {
4219 CALL_CompressedTexSubImage2DARB(ctx
->Exec
,
4220 (target
, level
, xoffset
, yoffset
, width
,
4221 height
, format
, imageSize
, data
));
4226 static void GLAPIENTRY
4227 save_CompressedTexSubImage3DARB(GLenum target
, GLint level
, GLint xoffset
,
4228 GLint yoffset
, GLint zoffset
, GLsizei width
,
4229 GLsizei height
, GLsizei depth
, GLenum format
,
4230 GLsizei imageSize
, const GLvoid
* data
)
4235 GET_CURRENT_CONTEXT(ctx
);
4236 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4238 /* make copy of image */
4239 image
= _mesa_malloc(imageSize
);
4241 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage3DARB");
4244 MEMCPY(image
, data
, imageSize
);
4245 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
, 11);
4252 n
[6].i
= (GLint
) width
;
4253 n
[7].i
= (GLint
) height
;
4254 n
[8].i
= (GLint
) depth
;
4256 n
[10].i
= imageSize
;
4262 if (ctx
->ExecuteFlag
) {
4263 CALL_CompressedTexSubImage3DARB(ctx
->Exec
,
4264 (target
, level
, xoffset
, yoffset
,
4265 zoffset
, width
, height
, depth
, format
,
4271 /* GL_ARB_multisample */
4272 static void GLAPIENTRY
4273 save_SampleCoverageARB(GLclampf value
, GLboolean invert
)
4275 GET_CURRENT_CONTEXT(ctx
);
4277 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4278 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SAMPLE_COVERAGE
, 2);
4283 if (ctx
->ExecuteFlag
) {
4284 CALL_SampleCoverageARB(ctx
->Exec
, (value
, invert
));
4290 * GL_NV_vertex_program
4292 #if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
4293 static void GLAPIENTRY
4294 save_BindProgramNV(GLenum target
, GLuint id
)
4296 GET_CURRENT_CONTEXT(ctx
);
4298 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4299 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BIND_PROGRAM_NV
, 2);
4304 if (ctx
->ExecuteFlag
) {
4305 CALL_BindProgramNV(ctx
->Exec
, (target
, id
));
4309 static void GLAPIENTRY
4310 save_ProgramEnvParameter4fARB(GLenum target
, GLuint index
,
4311 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4313 GET_CURRENT_CONTEXT(ctx
);
4315 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4316 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4325 if (ctx
->ExecuteFlag
) {
4326 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4331 static void GLAPIENTRY
4332 save_ProgramEnvParameter4fvARB(GLenum target
, GLuint index
,
4333 const GLfloat
*params
)
4335 save_ProgramEnvParameter4fARB(target
, index
, params
[0], params
[1],
4336 params
[2], params
[3]);
4340 static void GLAPIENTRY
4341 save_ProgramEnvParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4342 const GLfloat
* params
)
4344 GET_CURRENT_CONTEXT(ctx
);
4346 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4350 const GLfloat
* p
= params
;
4352 for (i
= 0 ; i
< count
; i
++) {
4353 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4366 if (ctx
->ExecuteFlag
) {
4367 CALL_ProgramEnvParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4372 static void GLAPIENTRY
4373 save_ProgramEnvParameter4dARB(GLenum target
, GLuint index
,
4374 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4376 save_ProgramEnvParameter4fARB(target
, index
,
4378 (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4382 static void GLAPIENTRY
4383 save_ProgramEnvParameter4dvARB(GLenum target
, GLuint index
,
4384 const GLdouble
*params
)
4386 save_ProgramEnvParameter4fARB(target
, index
,
4387 (GLfloat
) params
[0],
4388 (GLfloat
) params
[1],
4389 (GLfloat
) params
[2], (GLfloat
) params
[3]);
4392 #endif /* FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program || FEATURE_NV_vertex_program */
4394 #if FEATURE_NV_vertex_program
4395 static void GLAPIENTRY
4396 save_ExecuteProgramNV(GLenum target
, GLuint id
, const GLfloat
*params
)
4398 GET_CURRENT_CONTEXT(ctx
);
4400 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4401 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EXECUTE_PROGRAM_NV
, 6);
4410 if (ctx
->ExecuteFlag
) {
4411 CALL_ExecuteProgramNV(ctx
->Exec
, (target
, id
, params
));
4416 static void GLAPIENTRY
4417 save_ProgramParameters4dvNV(GLenum target
, GLuint index
,
4418 GLuint num
, const GLdouble
*params
)
4421 for (i
= 0; i
< num
; i
++) {
4422 save_ProgramEnvParameter4dvARB(target
, index
+ i
, params
+ 4 * i
);
4427 static void GLAPIENTRY
4428 save_ProgramParameters4fvNV(GLenum target
, GLuint index
,
4429 GLuint num
, const GLfloat
*params
)
4432 for (i
= 0; i
< num
; i
++) {
4433 save_ProgramEnvParameter4fvARB(target
, index
+ i
, params
+ 4 * i
);
4438 static void GLAPIENTRY
4439 save_LoadProgramNV(GLenum target
, GLuint id
, GLsizei len
,
4440 const GLubyte
* program
)
4442 GET_CURRENT_CONTEXT(ctx
);
4445 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4447 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LOAD_PROGRAM_NV
, 4);
4449 GLubyte
*programCopy
= (GLubyte
*) _mesa_malloc(len
);
4451 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glLoadProgramNV");
4454 _mesa_memcpy(programCopy
, program
, len
);
4458 n
[4].data
= programCopy
;
4460 if (ctx
->ExecuteFlag
) {
4461 CALL_LoadProgramNV(ctx
->Exec
, (target
, id
, len
, program
));
4466 static void GLAPIENTRY
4467 save_RequestResidentProgramsNV(GLsizei num
, const GLuint
* ids
)
4469 GET_CURRENT_CONTEXT(ctx
);
4472 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4474 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TRACK_MATRIX_NV
, 2);
4476 GLuint
*idCopy
= (GLuint
*) _mesa_malloc(num
* sizeof(GLuint
));
4478 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glRequestResidentProgramsNV");
4481 _mesa_memcpy(idCopy
, ids
, num
* sizeof(GLuint
));
4485 if (ctx
->ExecuteFlag
) {
4486 CALL_RequestResidentProgramsNV(ctx
->Exec
, (num
, ids
));
4491 static void GLAPIENTRY
4492 save_TrackMatrixNV(GLenum target
, GLuint address
,
4493 GLenum matrix
, GLenum transform
)
4495 GET_CURRENT_CONTEXT(ctx
);
4497 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4498 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TRACK_MATRIX_NV
, 4);
4505 if (ctx
->ExecuteFlag
) {
4506 CALL_TrackMatrixNV(ctx
->Exec
, (target
, address
, matrix
, transform
));
4509 #endif /* FEATURE_NV_vertex_program */
4513 * GL_NV_fragment_program
4515 #if FEATURE_NV_fragment_program
4516 static void GLAPIENTRY
4517 save_ProgramLocalParameter4fARB(GLenum target
, GLuint index
,
4518 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4520 GET_CURRENT_CONTEXT(ctx
);
4522 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4523 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4532 if (ctx
->ExecuteFlag
) {
4533 CALL_ProgramLocalParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4538 static void GLAPIENTRY
4539 save_ProgramLocalParameter4fvARB(GLenum target
, GLuint index
,
4540 const GLfloat
*params
)
4542 GET_CURRENT_CONTEXT(ctx
);
4544 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4545 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4554 if (ctx
->ExecuteFlag
) {
4555 CALL_ProgramLocalParameter4fvARB(ctx
->Exec
, (target
, index
, params
));
4560 static void GLAPIENTRY
4561 save_ProgramLocalParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4562 const GLfloat
*params
)
4564 GET_CURRENT_CONTEXT(ctx
);
4566 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4570 const GLfloat
* p
= params
;
4572 for (i
= 0 ; i
< count
; i
++) {
4573 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4586 if (ctx
->ExecuteFlag
) {
4587 CALL_ProgramLocalParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4592 static void GLAPIENTRY
4593 save_ProgramLocalParameter4dARB(GLenum target
, GLuint index
,
4594 GLdouble x
, GLdouble y
,
4595 GLdouble z
, GLdouble w
)
4597 GET_CURRENT_CONTEXT(ctx
);
4599 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4600 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4604 n
[3].f
= (GLfloat
) x
;
4605 n
[4].f
= (GLfloat
) y
;
4606 n
[5].f
= (GLfloat
) z
;
4607 n
[6].f
= (GLfloat
) w
;
4609 if (ctx
->ExecuteFlag
) {
4610 CALL_ProgramLocalParameter4dARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4615 static void GLAPIENTRY
4616 save_ProgramLocalParameter4dvARB(GLenum target
, GLuint index
,
4617 const GLdouble
*params
)
4619 GET_CURRENT_CONTEXT(ctx
);
4621 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4622 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4626 n
[3].f
= (GLfloat
) params
[0];
4627 n
[4].f
= (GLfloat
) params
[1];
4628 n
[5].f
= (GLfloat
) params
[2];
4629 n
[6].f
= (GLfloat
) params
[3];
4631 if (ctx
->ExecuteFlag
) {
4632 CALL_ProgramLocalParameter4dvARB(ctx
->Exec
, (target
, index
, params
));
4636 static void GLAPIENTRY
4637 save_ProgramNamedParameter4fNV(GLuint id
, GLsizei len
, const GLubyte
* name
,
4638 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4640 GET_CURRENT_CONTEXT(ctx
);
4643 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4645 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_NAMED_PARAMETER_NV
, 6);
4647 GLubyte
*nameCopy
= (GLubyte
*) _mesa_malloc(len
);
4649 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramNamedParameter4fNV");
4652 _mesa_memcpy(nameCopy
, name
, len
);
4655 n
[3].data
= nameCopy
;
4661 if (ctx
->ExecuteFlag
) {
4662 CALL_ProgramNamedParameter4fNV(ctx
->Exec
, (id
, len
, name
, x
, y
, z
, w
));
4667 static void GLAPIENTRY
4668 save_ProgramNamedParameter4fvNV(GLuint id
, GLsizei len
, const GLubyte
* name
,
4671 save_ProgramNamedParameter4fNV(id
, len
, name
, v
[0], v
[1], v
[2], v
[3]);
4675 static void GLAPIENTRY
4676 save_ProgramNamedParameter4dNV(GLuint id
, GLsizei len
, const GLubyte
* name
,
4677 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4679 save_ProgramNamedParameter4fNV(id
, len
, name
, (GLfloat
) x
, (GLfloat
) y
,
4680 (GLfloat
) z
, (GLfloat
) w
);
4684 static void GLAPIENTRY
4685 save_ProgramNamedParameter4dvNV(GLuint id
, GLsizei len
, const GLubyte
* name
,
4688 save_ProgramNamedParameter4fNV(id
, len
, name
, (GLfloat
) v
[0],
4689 (GLfloat
) v
[1], (GLfloat
) v
[2],
4693 #endif /* FEATURE_NV_fragment_program */
4697 /* GL_EXT_stencil_two_side */
4698 static void GLAPIENTRY
4699 save_ActiveStencilFaceEXT(GLenum face
)
4701 GET_CURRENT_CONTEXT(ctx
);
4703 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4704 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ACTIVE_STENCIL_FACE_EXT
, 1);
4708 if (ctx
->ExecuteFlag
) {
4709 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (face
));
4714 /* GL_EXT_depth_bounds_test */
4715 static void GLAPIENTRY
4716 save_DepthBoundsEXT(GLclampd zmin
, GLclampd zmax
)
4718 GET_CURRENT_CONTEXT(ctx
);
4720 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4721 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DEPTH_BOUNDS_EXT
, 2);
4723 n
[1].f
= (GLfloat
) zmin
;
4724 n
[2].f
= (GLfloat
) zmax
;
4726 if (ctx
->ExecuteFlag
) {
4727 CALL_DepthBoundsEXT(ctx
->Exec
, (zmin
, zmax
));
4733 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
4735 static void GLAPIENTRY
4736 save_ProgramStringARB(GLenum target
, GLenum format
, GLsizei len
,
4737 const GLvoid
* string
)
4739 GET_CURRENT_CONTEXT(ctx
);
4742 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4744 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_STRING_ARB
, 4);
4746 GLubyte
*programCopy
= (GLubyte
*) _mesa_malloc(len
);
4748 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramStringARB");
4751 _mesa_memcpy(programCopy
, string
, len
);
4755 n
[4].data
= programCopy
;
4757 if (ctx
->ExecuteFlag
) {
4758 CALL_ProgramStringARB(ctx
->Exec
, (target
, format
, len
, string
));
4762 #endif /* FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program */
4765 #if FEATURE_ARB_occlusion_query
4767 static void GLAPIENTRY
4768 save_BeginQueryARB(GLenum target
, GLuint id
)
4770 GET_CURRENT_CONTEXT(ctx
);
4772 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4773 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BEGIN_QUERY_ARB
, 2);
4778 if (ctx
->ExecuteFlag
) {
4779 CALL_BeginQueryARB(ctx
->Exec
, (target
, id
));
4784 static void GLAPIENTRY
4785 save_EndQueryARB(GLenum target
)
4787 GET_CURRENT_CONTEXT(ctx
);
4789 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4790 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_END_QUERY_ARB
, 1);
4794 if (ctx
->ExecuteFlag
) {
4795 CALL_EndQueryARB(ctx
->Exec
, (target
));
4799 #endif /* FEATURE_ARB_occlusion_query */
4802 static void GLAPIENTRY
4803 save_DrawBuffersARB(GLsizei count
, const GLenum
* buffers
)
4805 GET_CURRENT_CONTEXT(ctx
);
4807 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4808 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DRAW_BUFFERS_ARB
, 1 + MAX_DRAW_BUFFERS
);
4812 if (count
> MAX_DRAW_BUFFERS
)
4813 count
= MAX_DRAW_BUFFERS
;
4814 for (i
= 0; i
< count
; i
++) {
4815 n
[2 + i
].e
= buffers
[i
];
4818 if (ctx
->ExecuteFlag
) {
4819 CALL_DrawBuffersARB(ctx
->Exec
, (count
, buffers
));
4823 static void GLAPIENTRY
4824 save_TexBumpParameterfvATI(GLenum pname
, const GLfloat
*param
)
4826 GET_CURRENT_CONTEXT(ctx
);
4829 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_BUMP_PARAMETER_ATI
, 5);
4837 if (ctx
->ExecuteFlag
) {
4838 CALL_TexBumpParameterfvATI(ctx
->Exec
, (pname
, param
));
4842 static void GLAPIENTRY
4843 save_TexBumpParameterivATI(GLenum pname
, const GLint
*param
)
4846 p
[0] = INT_TO_FLOAT(param
[0]);
4847 p
[1] = INT_TO_FLOAT(param
[1]);
4848 p
[2] = INT_TO_FLOAT(param
[2]);
4849 p
[3] = INT_TO_FLOAT(param
[3]);
4850 save_TexBumpParameterfvATI(pname
, p
);
4853 #if FEATURE_ATI_fragment_shader
4854 static void GLAPIENTRY
4855 save_BindFragmentShaderATI(GLuint id
)
4857 GET_CURRENT_CONTEXT(ctx
);
4860 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BIND_FRAGMENT_SHADER_ATI
, 1);
4864 if (ctx
->ExecuteFlag
) {
4865 CALL_BindFragmentShaderATI(ctx
->Exec
, (id
));
4869 static void GLAPIENTRY
4870 save_SetFragmentShaderConstantATI(GLuint dst
, const GLfloat
*value
)
4872 GET_CURRENT_CONTEXT(ctx
);
4875 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
, 5);
4883 if (ctx
->ExecuteFlag
) {
4884 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, value
));
4890 save_Attr1fNV(GLenum attr
, GLfloat x
)
4892 GET_CURRENT_CONTEXT(ctx
);
4894 SAVE_FLUSH_VERTICES(ctx
);
4895 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_1F_NV
, 2);
4901 ASSERT(attr
< MAX_VERTEX_PROGRAM_ATTRIBS
);
4902 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
4903 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
4905 if (ctx
->ExecuteFlag
) {
4906 CALL_VertexAttrib1fNV(ctx
->Exec
, (attr
, x
));
4911 save_Attr2fNV(GLenum attr
, GLfloat x
, GLfloat y
)
4913 GET_CURRENT_CONTEXT(ctx
);
4915 SAVE_FLUSH_VERTICES(ctx
);
4916 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_2F_NV
, 3);
4923 ASSERT(attr
< MAX_VERTEX_PROGRAM_ATTRIBS
);
4924 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
4925 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
4927 if (ctx
->ExecuteFlag
) {
4928 CALL_VertexAttrib2fNV(ctx
->Exec
, (attr
, x
, y
));
4933 save_Attr3fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
4935 GET_CURRENT_CONTEXT(ctx
);
4937 SAVE_FLUSH_VERTICES(ctx
);
4938 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_3F_NV
, 4);
4946 ASSERT(attr
< MAX_VERTEX_PROGRAM_ATTRIBS
);
4947 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
4948 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
4950 if (ctx
->ExecuteFlag
) {
4951 CALL_VertexAttrib3fNV(ctx
->Exec
, (attr
, x
, y
, z
));
4956 save_Attr4fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4958 GET_CURRENT_CONTEXT(ctx
);
4960 SAVE_FLUSH_VERTICES(ctx
);
4961 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_4F_NV
, 5);
4970 ASSERT(attr
< MAX_VERTEX_PROGRAM_ATTRIBS
);
4971 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
4972 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
4974 if (ctx
->ExecuteFlag
) {
4975 CALL_VertexAttrib4fNV(ctx
->Exec
, (attr
, x
, y
, z
, w
));
4981 save_Attr1fARB(GLenum attr
, GLfloat x
)
4983 GET_CURRENT_CONTEXT(ctx
);
4985 SAVE_FLUSH_VERTICES(ctx
);
4986 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_1F_ARB
, 2);
4992 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
4993 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
4994 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
4996 if (ctx
->ExecuteFlag
) {
4997 CALL_VertexAttrib1fARB(ctx
->Exec
, (attr
, x
));
5002 save_Attr2fARB(GLenum attr
, GLfloat x
, GLfloat y
)
5004 GET_CURRENT_CONTEXT(ctx
);
5006 SAVE_FLUSH_VERTICES(ctx
);
5007 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_2F_ARB
, 3);
5014 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5015 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
5016 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
5018 if (ctx
->ExecuteFlag
) {
5019 CALL_VertexAttrib2fARB(ctx
->Exec
, (attr
, x
, y
));
5024 save_Attr3fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
5026 GET_CURRENT_CONTEXT(ctx
);
5028 SAVE_FLUSH_VERTICES(ctx
);
5029 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_3F_ARB
, 4);
5037 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5038 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
5039 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
5041 if (ctx
->ExecuteFlag
) {
5042 CALL_VertexAttrib3fARB(ctx
->Exec
, (attr
, x
, y
, z
));
5047 save_Attr4fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5049 GET_CURRENT_CONTEXT(ctx
);
5051 SAVE_FLUSH_VERTICES(ctx
);
5052 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_4F_ARB
, 5);
5061 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5062 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5063 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5065 if (ctx
->ExecuteFlag
) {
5066 CALL_VertexAttrib4fARB(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5071 static void GLAPIENTRY
5072 save_EvalCoord1f(GLfloat x
)
5074 GET_CURRENT_CONTEXT(ctx
);
5076 SAVE_FLUSH_VERTICES(ctx
);
5077 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVAL_C1
, 1);
5081 if (ctx
->ExecuteFlag
) {
5082 CALL_EvalCoord1f(ctx
->Exec
, (x
));
5086 static void GLAPIENTRY
5087 save_EvalCoord1fv(const GLfloat
* v
)
5089 save_EvalCoord1f(v
[0]);
5092 static void GLAPIENTRY
5093 save_EvalCoord2f(GLfloat x
, GLfloat y
)
5095 GET_CURRENT_CONTEXT(ctx
);
5097 SAVE_FLUSH_VERTICES(ctx
);
5098 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVAL_C2
, 2);
5103 if (ctx
->ExecuteFlag
) {
5104 CALL_EvalCoord2f(ctx
->Exec
, (x
, y
));
5108 static void GLAPIENTRY
5109 save_EvalCoord2fv(const GLfloat
* v
)
5111 save_EvalCoord2f(v
[0], v
[1]);
5115 static void GLAPIENTRY
5116 save_EvalPoint1(GLint x
)
5118 GET_CURRENT_CONTEXT(ctx
);
5120 SAVE_FLUSH_VERTICES(ctx
);
5121 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVAL_P1
, 1);
5125 if (ctx
->ExecuteFlag
) {
5126 CALL_EvalPoint1(ctx
->Exec
, (x
));
5130 static void GLAPIENTRY
5131 save_EvalPoint2(GLint x
, GLint y
)
5133 GET_CURRENT_CONTEXT(ctx
);
5135 SAVE_FLUSH_VERTICES(ctx
);
5136 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVAL_P2
, 2);
5141 if (ctx
->ExecuteFlag
) {
5142 CALL_EvalPoint2(ctx
->Exec
, (x
, y
));
5146 static void GLAPIENTRY
5147 save_Indexf(GLfloat x
)
5149 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, x
);
5152 static void GLAPIENTRY
5153 save_Indexfv(const GLfloat
* v
)
5155 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, v
[0]);
5158 static void GLAPIENTRY
5159 save_EdgeFlag(GLboolean x
)
5161 save_Attr1fNV(VERT_ATTRIB_EDGEFLAG
, x
? (GLfloat
)1.0 : (GLfloat
)0.0);
5164 static INLINE GLboolean
compare4fv( const GLfloat
*a
,
5168 return memcmp( a
, b
, count
* sizeof(GLfloat
) ) == 0;
5172 static void GLAPIENTRY
5173 save_Materialfv(GLenum face
, GLenum pname
, const GLfloat
* param
)
5175 GET_CURRENT_CONTEXT(ctx
);
5183 case GL_FRONT_AND_BACK
:
5186 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "material(face)");
5195 case GL_AMBIENT_AND_DIFFUSE
:
5201 case GL_COLOR_INDEXES
:
5205 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "material(pname)");
5209 if (ctx
->ExecuteFlag
) {
5210 CALL_Materialfv(ctx
->Exec
, (face
, pname
, param
));
5213 bitmask
= _mesa_material_bitmask(ctx
, face
, pname
, ~0, NULL
);
5215 /* Try to eliminate redundant statechanges. Because it is legal to
5216 * call glMaterial even inside begin/end calls, don't need to worry
5217 * about ctx->Driver.CurrentSavePrimitive here.
5219 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++) {
5220 if (bitmask
& (1 << i
)) {
5221 if (ctx
->ListState
.ActiveMaterialSize
[i
] == args
&&
5222 compare4fv(ctx
->ListState
.CurrentMaterial
[i
], param
, args
)) {
5223 bitmask
&= ~(1 << i
);
5226 ctx
->ListState
.ActiveMaterialSize
[i
] = args
;
5227 COPY_SZ_4V(ctx
->ListState
.CurrentMaterial
[i
], args
, param
);
5232 /* If this call has effect, return early:
5237 SAVE_FLUSH_VERTICES(ctx
);
5239 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MATERIAL
, 6);
5243 for (i
= 0; i
< args
; i
++)
5244 n
[3 + i
].f
= param
[i
];
5248 static void GLAPIENTRY
5249 save_Begin(GLenum mode
)
5251 GET_CURRENT_CONTEXT(ctx
);
5253 GLboolean error
= GL_FALSE
;
5255 if ( /*mode < GL_POINTS || */ mode
> GL_POLYGON
) {
5256 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "Begin (mode)");
5259 else if (ctx
->Driver
.CurrentSavePrimitive
== PRIM_UNKNOWN
) {
5260 /* Typically the first begin. This may raise an error on
5261 * playback, depending on whether CallList is issued from inside
5262 * a begin/end or not.
5264 ctx
->Driver
.CurrentSavePrimitive
= PRIM_INSIDE_UNKNOWN_PRIM
;
5266 else if (ctx
->Driver
.CurrentSavePrimitive
== PRIM_OUTSIDE_BEGIN_END
) {
5267 ctx
->Driver
.CurrentSavePrimitive
= mode
;
5270 _mesa_compile_error(ctx
, GL_INVALID_OPERATION
, "recursive begin");
5275 /* Give the driver an opportunity to hook in an optimized
5276 * display list compiler.
5278 if (ctx
->Driver
.NotifySaveBegin(ctx
, mode
))
5281 SAVE_FLUSH_VERTICES(ctx
);
5282 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BEGIN
, 1);
5288 if (ctx
->ExecuteFlag
) {
5289 CALL_Begin(ctx
->Exec
, (mode
));
5293 static void GLAPIENTRY
5296 GET_CURRENT_CONTEXT(ctx
);
5297 SAVE_FLUSH_VERTICES(ctx
);
5298 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_END
, 0);
5299 ctx
->Driver
.CurrentSavePrimitive
= PRIM_OUTSIDE_BEGIN_END
;
5300 if (ctx
->ExecuteFlag
) {
5301 CALL_End(ctx
->Exec
, ());
5305 static void GLAPIENTRY
5306 save_Rectf(GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
5308 GET_CURRENT_CONTEXT(ctx
);
5310 SAVE_FLUSH_VERTICES(ctx
);
5311 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_RECTF
, 4);
5318 if (ctx
->ExecuteFlag
) {
5319 CALL_Rectf(ctx
->Exec
, (a
, b
, c
, d
));
5324 static void GLAPIENTRY
5325 save_Vertex2f(GLfloat x
, GLfloat y
)
5327 save_Attr2fNV(VERT_ATTRIB_POS
, x
, y
);
5330 static void GLAPIENTRY
5331 save_Vertex2fv(const GLfloat
* v
)
5333 save_Attr2fNV(VERT_ATTRIB_POS
, v
[0], v
[1]);
5336 static void GLAPIENTRY
5337 save_Vertex3f(GLfloat x
, GLfloat y
, GLfloat z
)
5339 save_Attr3fNV(VERT_ATTRIB_POS
, x
, y
, z
);
5342 static void GLAPIENTRY
5343 save_Vertex3fv(const GLfloat
* v
)
5345 save_Attr3fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2]);
5348 static void GLAPIENTRY
5349 save_Vertex4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5351 save_Attr4fNV(VERT_ATTRIB_POS
, x
, y
, z
, w
);
5354 static void GLAPIENTRY
5355 save_Vertex4fv(const GLfloat
* v
)
5357 save_Attr4fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2], v
[3]);
5360 static void GLAPIENTRY
5361 save_TexCoord1f(GLfloat x
)
5363 save_Attr1fNV(VERT_ATTRIB_TEX0
, x
);
5366 static void GLAPIENTRY
5367 save_TexCoord1fv(const GLfloat
* v
)
5369 save_Attr1fNV(VERT_ATTRIB_TEX0
, v
[0]);
5372 static void GLAPIENTRY
5373 save_TexCoord2f(GLfloat x
, GLfloat y
)
5375 save_Attr2fNV(VERT_ATTRIB_TEX0
, x
, y
);
5378 static void GLAPIENTRY
5379 save_TexCoord2fv(const GLfloat
* v
)
5381 save_Attr2fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1]);
5384 static void GLAPIENTRY
5385 save_TexCoord3f(GLfloat x
, GLfloat y
, GLfloat z
)
5387 save_Attr3fNV(VERT_ATTRIB_TEX0
, x
, y
, z
);
5390 static void GLAPIENTRY
5391 save_TexCoord3fv(const GLfloat
* v
)
5393 save_Attr3fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2]);
5396 static void GLAPIENTRY
5397 save_TexCoord4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5399 save_Attr4fNV(VERT_ATTRIB_TEX0
, x
, y
, z
, w
);
5402 static void GLAPIENTRY
5403 save_TexCoord4fv(const GLfloat
* v
)
5405 save_Attr4fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2], v
[3]);
5408 static void GLAPIENTRY
5409 save_Normal3f(GLfloat x
, GLfloat y
, GLfloat z
)
5411 save_Attr3fNV(VERT_ATTRIB_NORMAL
, x
, y
, z
);
5414 static void GLAPIENTRY
5415 save_Normal3fv(const GLfloat
* v
)
5417 save_Attr3fNV(VERT_ATTRIB_NORMAL
, v
[0], v
[1], v
[2]);
5420 static void GLAPIENTRY
5421 save_FogCoordfEXT(GLfloat x
)
5423 save_Attr1fNV(VERT_ATTRIB_FOG
, x
);
5426 static void GLAPIENTRY
5427 save_FogCoordfvEXT(const GLfloat
* v
)
5429 save_Attr1fNV(VERT_ATTRIB_FOG
, v
[0]);
5432 static void GLAPIENTRY
5433 save_Color3f(GLfloat x
, GLfloat y
, GLfloat z
)
5435 save_Attr3fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
);
5438 static void GLAPIENTRY
5439 save_Color3fv(const GLfloat
* v
)
5441 save_Attr3fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2]);
5444 static void GLAPIENTRY
5445 save_Color4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5447 save_Attr4fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
, w
);
5450 static void GLAPIENTRY
5451 save_Color4fv(const GLfloat
* v
)
5453 save_Attr4fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2], v
[3]);
5456 static void GLAPIENTRY
5457 save_SecondaryColor3fEXT(GLfloat x
, GLfloat y
, GLfloat z
)
5459 save_Attr3fNV(VERT_ATTRIB_COLOR1
, x
, y
, z
);
5462 static void GLAPIENTRY
5463 save_SecondaryColor3fvEXT(const GLfloat
* v
)
5465 save_Attr3fNV(VERT_ATTRIB_COLOR1
, v
[0], v
[1], v
[2]);
5469 /* Just call the respective ATTR for texcoord
5471 static void GLAPIENTRY
5472 save_MultiTexCoord1f(GLenum target
, GLfloat x
)
5474 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5475 save_Attr1fNV(attr
, x
);
5478 static void GLAPIENTRY
5479 save_MultiTexCoord1fv(GLenum target
, const GLfloat
* v
)
5481 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5482 save_Attr1fNV(attr
, v
[0]);
5485 static void GLAPIENTRY
5486 save_MultiTexCoord2f(GLenum target
, GLfloat x
, GLfloat y
)
5488 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5489 save_Attr2fNV(attr
, x
, y
);
5492 static void GLAPIENTRY
5493 save_MultiTexCoord2fv(GLenum target
, const GLfloat
* v
)
5495 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5496 save_Attr2fNV(attr
, v
[0], v
[1]);
5499 static void GLAPIENTRY
5500 save_MultiTexCoord3f(GLenum target
, GLfloat x
, GLfloat y
, GLfloat z
)
5502 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5503 save_Attr3fNV(attr
, x
, y
, z
);
5506 static void GLAPIENTRY
5507 save_MultiTexCoord3fv(GLenum target
, const GLfloat
* v
)
5509 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5510 save_Attr3fNV(attr
, v
[0], v
[1], v
[2]);
5513 static void GLAPIENTRY
5514 save_MultiTexCoord4f(GLenum target
, GLfloat x
, GLfloat y
,
5515 GLfloat z
, GLfloat w
)
5517 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5518 save_Attr4fNV(attr
, x
, y
, z
, w
);
5521 static void GLAPIENTRY
5522 save_MultiTexCoord4fv(GLenum target
, const GLfloat
* v
)
5524 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5525 save_Attr4fNV(attr
, v
[0], v
[1], v
[2], v
[3]);
5530 * Record a GL_INVALID_VALUE error when a invalid vertex attribute
5536 GET_CURRENT_CONTEXT(ctx
);
5537 _mesa_error(ctx
, GL_INVALID_VALUE
, "VertexAttribf(index)");
5541 /* First level for NV_vertex_program:
5543 * Check for errors at compile time?.
5545 static void GLAPIENTRY
5546 save_VertexAttrib1fNV(GLuint index
, GLfloat x
)
5548 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
)
5549 save_Attr1fNV(index
, x
);
5554 static void GLAPIENTRY
5555 save_VertexAttrib1fvNV(GLuint index
, const GLfloat
* v
)
5557 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
)
5558 save_Attr1fNV(index
, v
[0]);
5563 static void GLAPIENTRY
5564 save_VertexAttrib2fNV(GLuint index
, GLfloat x
, GLfloat y
)
5566 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
)
5567 save_Attr2fNV(index
, x
, y
);
5572 static void GLAPIENTRY
5573 save_VertexAttrib2fvNV(GLuint index
, const GLfloat
* v
)
5575 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
)
5576 save_Attr2fNV(index
, v
[0], v
[1]);
5581 static void GLAPIENTRY
5582 save_VertexAttrib3fNV(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
5584 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
)
5585 save_Attr3fNV(index
, x
, y
, z
);
5590 static void GLAPIENTRY
5591 save_VertexAttrib3fvNV(GLuint index
, const GLfloat
* v
)
5593 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
)
5594 save_Attr3fNV(index
, v
[0], v
[1], v
[2]);
5599 static void GLAPIENTRY
5600 save_VertexAttrib4fNV(GLuint index
, GLfloat x
, GLfloat y
,
5601 GLfloat z
, GLfloat w
)
5603 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
)
5604 save_Attr4fNV(index
, x
, y
, z
, w
);
5609 static void GLAPIENTRY
5610 save_VertexAttrib4fvNV(GLuint index
, const GLfloat
* v
)
5612 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
)
5613 save_Attr4fNV(index
, v
[0], v
[1], v
[2], v
[3]);
5621 static void GLAPIENTRY
5622 save_VertexAttrib1fARB(GLuint index
, GLfloat x
)
5624 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5625 save_Attr1fARB(index
, x
);
5630 static void GLAPIENTRY
5631 save_VertexAttrib1fvARB(GLuint index
, const GLfloat
* v
)
5633 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5634 save_Attr1fARB(index
, v
[0]);
5639 static void GLAPIENTRY
5640 save_VertexAttrib2fARB(GLuint index
, GLfloat x
, GLfloat y
)
5642 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5643 save_Attr2fARB(index
, x
, y
);
5648 static void GLAPIENTRY
5649 save_VertexAttrib2fvARB(GLuint index
, const GLfloat
* v
)
5651 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5652 save_Attr2fARB(index
, v
[0], v
[1]);
5657 static void GLAPIENTRY
5658 save_VertexAttrib3fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
5660 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5661 save_Attr3fARB(index
, x
, y
, z
);
5666 static void GLAPIENTRY
5667 save_VertexAttrib3fvARB(GLuint index
, const GLfloat
* v
)
5669 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5670 save_Attr3fARB(index
, v
[0], v
[1], v
[2]);
5675 static void GLAPIENTRY
5676 save_VertexAttrib4fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
,
5679 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5680 save_Attr4fARB(index
, x
, y
, z
, w
);
5685 static void GLAPIENTRY
5686 save_VertexAttrib4fvARB(GLuint index
, const GLfloat
* v
)
5688 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5689 save_Attr4fARB(index
, v
[0], v
[1], v
[2], v
[3]);
5695 /* GL_ARB_shader_objects, GL_ARB_vertex/fragment_shader */
5697 static void GLAPIENTRY
5698 exec_BindAttribLocationARB(GLuint program
, GLuint index
, const GLchar
*name
)
5700 GET_CURRENT_CONTEXT(ctx
);
5701 FLUSH_VERTICES(ctx
, 0);
5702 CALL_BindAttribLocationARB(ctx
->Exec
, (program
, index
, name
));
5705 static GLint GLAPIENTRY
5706 exec_GetAttribLocationARB(GLuint program
, const GLchar
*name
)
5708 GET_CURRENT_CONTEXT(ctx
);
5709 FLUSH_VERTICES(ctx
, 0);
5710 return CALL_GetAttribLocationARB(ctx
->Exec
, (program
, name
));
5712 /* XXX more shader functions needed here */
5716 #if FEATURE_EXT_framebuffer_blit
5717 static void GLAPIENTRY
5718 save_BlitFramebufferEXT(GLint srcX0
, GLint srcY0
, GLint srcX1
, GLint srcY1
,
5719 GLint dstX0
, GLint dstY0
, GLint dstX1
, GLint dstY1
,
5720 GLbitfield mask
, GLenum filter
)
5722 GET_CURRENT_CONTEXT(ctx
);
5724 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5725 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BLIT_FRAMEBUFFER
, 10);
5738 if (ctx
->ExecuteFlag
) {
5739 CALL_BlitFramebufferEXT(ctx
->Exec
, (srcX0
, srcY0
, srcX1
, srcY1
,
5740 dstX0
, dstY0
, dstX1
, dstY1
,
5748 * Save an error-generating command into display list.
5750 * KW: Will appear in the list before the vertex buffer containing the
5751 * command that provoked the error. I don't see this as a problem.
5754 save_error(GLcontext
*ctx
, GLenum error
, const char *s
)
5757 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ERROR
, 2);
5760 n
[2].data
= (void *) s
;
5766 * Compile an error into current display list.
5769 _mesa_compile_error(GLcontext
*ctx
, GLenum error
, const char *s
)
5771 if (ctx
->CompileFlag
)
5772 save_error(ctx
, error
, s
);
5773 if (ctx
->ExecuteFlag
)
5774 _mesa_error(ctx
, error
, s
);
5779 * Test if ID names a display list.
5782 islist(GLcontext
*ctx
, GLuint list
)
5784 if (list
> 0 && lookup_list(ctx
, list
)) {
5794 /**********************************************************************/
5795 /* Display list execution */
5796 /**********************************************************************/
5800 * Execute a display list. Note that the ListBase offset must have already
5801 * been added before calling this function. I.e. the list argument is
5802 * the absolute list number, not relative to ListBase.
5803 * \param list - display list number
5806 execute_list(GLcontext
*ctx
, GLuint list
)
5808 struct gl_display_list
*dlist
;
5812 if (list
== 0 || !islist(ctx
, list
))
5815 if (ctx
->ListState
.CallDepth
== MAX_LIST_NESTING
) {
5816 /* raise an error? */
5820 dlist
= lookup_list(ctx
, list
);
5824 ctx
->ListState
.CallDepth
++;
5826 if (ctx
->Driver
.BeginCallList
)
5827 ctx
->Driver
.BeginCallList(ctx
, dlist
);
5833 OpCode opcode
= n
[0].opcode
;
5834 int i
= (int) n
[0].opcode
- (int) OPCODE_EXT_0
;
5836 if (i
>= 0 && i
< (GLint
) ctx
->ListExt
.NumOpcodes
) {
5837 /* this is a driver-extended opcode */
5838 ctx
->ListExt
.Opcode
[i
].Execute(ctx
, &n
[1]);
5839 n
+= ctx
->ListExt
.Opcode
[i
].Size
;
5844 _mesa_error(ctx
, n
[1].e
, (const char *) n
[2].data
);
5847 CALL_Accum(ctx
->Exec
, (n
[1].e
, n
[2].f
));
5849 case OPCODE_ALPHA_FUNC
:
5850 CALL_AlphaFunc(ctx
->Exec
, (n
[1].e
, n
[2].f
));
5852 case OPCODE_BIND_TEXTURE
:
5853 CALL_BindTexture(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
5857 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5858 ctx
->Unpack
= ctx
->DefaultPacking
;
5859 CALL_Bitmap(ctx
->Exec
, ((GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
5860 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
5861 (const GLubyte
*) n
[7].data
));
5862 ctx
->Unpack
= save
; /* restore */
5865 case OPCODE_BLEND_COLOR
:
5866 CALL_BlendColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
5868 case OPCODE_BLEND_EQUATION
:
5869 CALL_BlendEquation(ctx
->Exec
, (n
[1].e
));
5871 case OPCODE_BLEND_EQUATION_SEPARATE
:
5872 CALL_BlendEquationSeparateEXT(ctx
->Exec
, (n
[1].e
, n
[2].e
));
5874 case OPCODE_BLEND_FUNC_SEPARATE
:
5875 CALL_BlendFuncSeparateEXT(ctx
->Exec
,
5876 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
5878 case OPCODE_CALL_LIST
:
5879 /* Generated by glCallList(), don't add ListBase */
5880 if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
5881 execute_list(ctx
, n
[1].ui
);
5884 case OPCODE_CALL_LIST_OFFSET
:
5885 /* Generated by glCallLists() so we must add ListBase */
5887 /* user specified a bad data type at compile time */
5888 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
5890 else if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
5891 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ n
[1].i
);
5892 execute_list(ctx
, list
);
5896 CALL_Clear(ctx
->Exec
, (n
[1].bf
));
5898 case OPCODE_CLEAR_COLOR
:
5899 CALL_ClearColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
5901 case OPCODE_CLEAR_ACCUM
:
5902 CALL_ClearAccum(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
5904 case OPCODE_CLEAR_DEPTH
:
5905 CALL_ClearDepth(ctx
->Exec
, ((GLclampd
) n
[1].f
));
5907 case OPCODE_CLEAR_INDEX
:
5908 CALL_ClearIndex(ctx
->Exec
, ((GLfloat
) n
[1].ui
));
5910 case OPCODE_CLEAR_STENCIL
:
5911 CALL_ClearStencil(ctx
->Exec
, (n
[1].i
));
5913 case OPCODE_CLIP_PLANE
:
5920 CALL_ClipPlane(ctx
->Exec
, (n
[1].e
, eq
));
5923 case OPCODE_COLOR_MASK
:
5924 CALL_ColorMask(ctx
->Exec
, (n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
));
5926 case OPCODE_COLOR_MATERIAL
:
5927 CALL_ColorMaterial(ctx
->Exec
, (n
[1].e
, n
[2].e
));
5929 case OPCODE_COLOR_TABLE
:
5931 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5932 ctx
->Unpack
= ctx
->DefaultPacking
;
5933 CALL_ColorTable(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].e
,
5934 n
[5].e
, n
[6].data
));
5935 ctx
->Unpack
= save
; /* restore */
5938 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
5945 CALL_ColorTableParameterfv(ctx
->Exec
,
5946 (n
[1].e
, n
[2].e
, params
));
5949 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
5956 CALL_ColorTableParameteriv(ctx
->Exec
,
5957 (n
[1].e
, n
[2].e
, params
));
5960 case OPCODE_COLOR_SUB_TABLE
:
5962 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5963 ctx
->Unpack
= ctx
->DefaultPacking
;
5964 CALL_ColorSubTable(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5965 n
[4].e
, n
[5].e
, n
[6].data
));
5966 ctx
->Unpack
= save
; /* restore */
5969 case OPCODE_CONVOLUTION_FILTER_1D
:
5971 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5972 ctx
->Unpack
= ctx
->DefaultPacking
;
5973 CALL_ConvolutionFilter1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5976 ctx
->Unpack
= save
; /* restore */
5979 case OPCODE_CONVOLUTION_FILTER_2D
:
5981 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5982 ctx
->Unpack
= ctx
->DefaultPacking
;
5983 CALL_ConvolutionFilter2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5984 n
[4].i
, n
[5].e
, n
[6].e
,
5986 ctx
->Unpack
= save
; /* restore */
5989 case OPCODE_CONVOLUTION_PARAMETER_I
:
5990 CALL_ConvolutionParameteri(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].i
));
5992 case OPCODE_CONVOLUTION_PARAMETER_IV
:
5999 CALL_ConvolutionParameteriv(ctx
->Exec
,
6000 (n
[1].e
, n
[2].e
, params
));
6003 case OPCODE_CONVOLUTION_PARAMETER_F
:
6004 CALL_ConvolutionParameterf(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].f
));
6006 case OPCODE_CONVOLUTION_PARAMETER_FV
:
6013 CALL_ConvolutionParameterfv(ctx
->Exec
,
6014 (n
[1].e
, n
[2].e
, params
));
6017 case OPCODE_COPY_COLOR_SUB_TABLE
:
6018 CALL_CopyColorSubTable(ctx
->Exec
, (n
[1].e
, n
[2].i
,
6019 n
[3].i
, n
[4].i
, n
[5].i
));
6021 case OPCODE_COPY_COLOR_TABLE
:
6022 CALL_CopyColorSubTable(ctx
->Exec
, (n
[1].e
, n
[2].i
,
6023 n
[3].i
, n
[4].i
, n
[5].i
));
6025 case OPCODE_COPY_PIXELS
:
6026 CALL_CopyPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
,
6027 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
,
6030 case OPCODE_COPY_TEX_IMAGE1D
:
6031 CALL_CopyTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
6032 n
[5].i
, n
[6].i
, n
[7].i
));
6034 case OPCODE_COPY_TEX_IMAGE2D
:
6035 CALL_CopyTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
6036 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
));
6038 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
6039 CALL_CopyTexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
6040 n
[4].i
, n
[5].i
, n
[6].i
));
6042 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
6043 CALL_CopyTexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
6044 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
6047 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
6048 CALL_CopyTexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
6049 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
6052 case OPCODE_CULL_FACE
:
6053 CALL_CullFace(ctx
->Exec
, (n
[1].e
));
6055 case OPCODE_DEPTH_FUNC
:
6056 CALL_DepthFunc(ctx
->Exec
, (n
[1].e
));
6058 case OPCODE_DEPTH_MASK
:
6059 CALL_DepthMask(ctx
->Exec
, (n
[1].b
));
6061 case OPCODE_DEPTH_RANGE
:
6062 CALL_DepthRange(ctx
->Exec
,
6063 ((GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
));
6065 case OPCODE_DISABLE
:
6066 CALL_Disable(ctx
->Exec
, (n
[1].e
));
6068 case OPCODE_DRAW_BUFFER
:
6069 CALL_DrawBuffer(ctx
->Exec
, (n
[1].e
));
6071 case OPCODE_DRAW_PIXELS
:
6073 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6074 ctx
->Unpack
= ctx
->DefaultPacking
;
6075 CALL_DrawPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
6077 ctx
->Unpack
= save
; /* restore */
6081 CALL_Enable(ctx
->Exec
, (n
[1].e
));
6083 case OPCODE_EVALMESH1
:
6084 CALL_EvalMesh1(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
));
6086 case OPCODE_EVALMESH2
:
6087 CALL_EvalMesh2(ctx
->Exec
,
6088 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
6097 CALL_Fogfv(ctx
->Exec
, (n
[1].e
, p
));
6100 case OPCODE_FRONT_FACE
:
6101 CALL_FrontFace(ctx
->Exec
, (n
[1].e
));
6103 case OPCODE_FRUSTUM
:
6104 CALL_Frustum(ctx
->Exec
,
6105 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
6108 CALL_Hint(ctx
->Exec
, (n
[1].e
, n
[2].e
));
6110 case OPCODE_HISTOGRAM
:
6111 CALL_Histogram(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].b
));
6113 case OPCODE_INDEX_MASK
:
6114 CALL_IndexMask(ctx
->Exec
, (n
[1].ui
));
6116 case OPCODE_INIT_NAMES
:
6117 CALL_InitNames(ctx
->Exec
, ());
6126 CALL_Lightfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, p
));
6129 case OPCODE_LIGHT_MODEL
:
6136 CALL_LightModelfv(ctx
->Exec
, (n
[1].e
, p
));
6139 case OPCODE_LINE_STIPPLE
:
6140 CALL_LineStipple(ctx
->Exec
, (n
[1].i
, n
[2].us
));
6142 case OPCODE_LINE_WIDTH
:
6143 CALL_LineWidth(ctx
->Exec
, (n
[1].f
));
6145 case OPCODE_LIST_BASE
:
6146 CALL_ListBase(ctx
->Exec
, (n
[1].ui
));
6148 case OPCODE_LOAD_IDENTITY
:
6149 CALL_LoadIdentity(ctx
->Exec
, ());
6151 case OPCODE_LOAD_MATRIX
:
6152 if (sizeof(Node
) == sizeof(GLfloat
)) {
6153 CALL_LoadMatrixf(ctx
->Exec
, (&n
[1].f
));
6158 for (i
= 0; i
< 16; i
++) {
6161 CALL_LoadMatrixf(ctx
->Exec
, (m
));
6164 case OPCODE_LOAD_NAME
:
6165 CALL_LoadName(ctx
->Exec
, (n
[1].ui
));
6167 case OPCODE_LOGIC_OP
:
6168 CALL_LogicOp(ctx
->Exec
, (n
[1].e
));
6172 GLenum target
= n
[1].e
;
6173 GLint ustride
= _mesa_evaluator_components(target
);
6174 GLint uorder
= n
[5].i
;
6175 GLfloat u1
= n
[2].f
;
6176 GLfloat u2
= n
[3].f
;
6177 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
6178 (GLfloat
*) n
[6].data
));
6183 GLenum target
= n
[1].e
;
6184 GLfloat u1
= n
[2].f
;
6185 GLfloat u2
= n
[3].f
;
6186 GLfloat v1
= n
[4].f
;
6187 GLfloat v2
= n
[5].f
;
6188 GLint ustride
= n
[6].i
;
6189 GLint vstride
= n
[7].i
;
6190 GLint uorder
= n
[8].i
;
6191 GLint vorder
= n
[9].i
;
6192 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
6193 v1
, v2
, vstride
, vorder
,
6194 (GLfloat
*) n
[10].data
));
6197 case OPCODE_MAPGRID1
:
6198 CALL_MapGrid1f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
6200 case OPCODE_MAPGRID2
:
6201 CALL_MapGrid2f(ctx
->Exec
,
6202 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
));
6204 case OPCODE_MATRIX_MODE
:
6205 CALL_MatrixMode(ctx
->Exec
, (n
[1].e
));
6207 case OPCODE_MIN_MAX
:
6208 CALL_Minmax(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].b
));
6210 case OPCODE_MULT_MATRIX
:
6211 if (sizeof(Node
) == sizeof(GLfloat
)) {
6212 CALL_MultMatrixf(ctx
->Exec
, (&n
[1].f
));
6217 for (i
= 0; i
< 16; i
++) {
6220 CALL_MultMatrixf(ctx
->Exec
, (m
));
6224 CALL_Ortho(ctx
->Exec
,
6225 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
6227 case OPCODE_PASSTHROUGH
:
6228 CALL_PassThrough(ctx
->Exec
, (n
[1].f
));
6230 case OPCODE_PIXEL_MAP
:
6231 CALL_PixelMapfv(ctx
->Exec
,
6232 (n
[1].e
, n
[2].i
, (GLfloat
*) n
[3].data
));
6234 case OPCODE_PIXEL_TRANSFER
:
6235 CALL_PixelTransferf(ctx
->Exec
, (n
[1].e
, n
[2].f
));
6237 case OPCODE_PIXEL_ZOOM
:
6238 CALL_PixelZoom(ctx
->Exec
, (n
[1].f
, n
[2].f
));
6240 case OPCODE_POINT_SIZE
:
6241 CALL_PointSize(ctx
->Exec
, (n
[1].f
));
6243 case OPCODE_POINT_PARAMETERS
:
6249 CALL_PointParameterfvEXT(ctx
->Exec
, (n
[1].e
, params
));
6252 case OPCODE_POLYGON_MODE
:
6253 CALL_PolygonMode(ctx
->Exec
, (n
[1].e
, n
[2].e
));
6255 case OPCODE_POLYGON_STIPPLE
:
6257 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6258 ctx
->Unpack
= ctx
->DefaultPacking
;
6259 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) n
[1].data
));
6260 ctx
->Unpack
= save
; /* restore */
6263 case OPCODE_POLYGON_OFFSET
:
6264 CALL_PolygonOffset(ctx
->Exec
, (n
[1].f
, n
[2].f
));
6266 case OPCODE_POP_ATTRIB
:
6267 CALL_PopAttrib(ctx
->Exec
, ());
6269 case OPCODE_POP_MATRIX
:
6270 CALL_PopMatrix(ctx
->Exec
, ());
6272 case OPCODE_POP_NAME
:
6273 CALL_PopName(ctx
->Exec
, ());
6275 case OPCODE_PRIORITIZE_TEXTURE
:
6276 CALL_PrioritizeTextures(ctx
->Exec
, (1, &n
[1].ui
, &n
[2].f
));
6278 case OPCODE_PUSH_ATTRIB
:
6279 CALL_PushAttrib(ctx
->Exec
, (n
[1].bf
));
6281 case OPCODE_PUSH_MATRIX
:
6282 CALL_PushMatrix(ctx
->Exec
, ());
6284 case OPCODE_PUSH_NAME
:
6285 CALL_PushName(ctx
->Exec
, (n
[1].ui
));
6287 case OPCODE_RASTER_POS
:
6288 CALL_RasterPos4f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
6290 case OPCODE_READ_BUFFER
:
6291 CALL_ReadBuffer(ctx
->Exec
, (n
[1].e
));
6293 case OPCODE_RESET_HISTOGRAM
:
6294 CALL_ResetHistogram(ctx
->Exec
, (n
[1].e
));
6296 case OPCODE_RESET_MIN_MAX
:
6297 CALL_ResetMinmax(ctx
->Exec
, (n
[1].e
));
6300 CALL_Rotatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
6303 CALL_Scalef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
6305 case OPCODE_SCISSOR
:
6306 CALL_Scissor(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
6308 case OPCODE_SHADE_MODEL
:
6309 CALL_ShadeModel(ctx
->Exec
, (n
[1].e
));
6311 case OPCODE_STENCIL_FUNC
:
6312 CALL_StencilFunc(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].ui
));
6314 case OPCODE_STENCIL_MASK
:
6315 CALL_StencilMask(ctx
->Exec
, (n
[1].ui
));
6317 case OPCODE_STENCIL_OP
:
6318 CALL_StencilOp(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].e
));
6320 case OPCODE_STENCIL_FUNC_SEPARATE
:
6321 CALL_StencilFuncSeparate(ctx
->Exec
,
6322 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].ui
));
6324 case OPCODE_STENCIL_MASK_SEPARATE
:
6325 CALL_StencilMaskSeparate(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
6327 case OPCODE_STENCIL_OP_SEPARATE
:
6328 CALL_StencilOpSeparate(ctx
->Exec
,
6329 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
6338 CALL_TexEnvfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
6348 CALL_TexGenfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
6351 case OPCODE_TEXPARAMETER
:
6358 CALL_TexParameterfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
6361 case OPCODE_TEX_IMAGE1D
:
6363 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6364 ctx
->Unpack
= ctx
->DefaultPacking
;
6365 CALL_TexImage1D(ctx
->Exec
, (n
[1].e
, /* target */
6367 n
[3].i
, /* components */
6369 n
[5].e
, /* border */
6370 n
[6].e
, /* format */
6373 ctx
->Unpack
= save
; /* restore */
6376 case OPCODE_TEX_IMAGE2D
:
6378 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6379 ctx
->Unpack
= ctx
->DefaultPacking
;
6380 CALL_TexImage2D(ctx
->Exec
, (n
[1].e
, /* target */
6382 n
[3].i
, /* components */
6384 n
[5].i
, /* height */
6385 n
[6].e
, /* border */
6386 n
[7].e
, /* format */
6389 ctx
->Unpack
= save
; /* restore */
6392 case OPCODE_TEX_IMAGE3D
:
6394 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6395 ctx
->Unpack
= ctx
->DefaultPacking
;
6396 CALL_TexImage3D(ctx
->Exec
, (n
[1].e
, /* target */
6398 n
[3].i
, /* components */
6400 n
[5].i
, /* height */
6402 n
[7].e
, /* border */
6403 n
[8].e
, /* format */
6406 ctx
->Unpack
= save
; /* restore */
6409 case OPCODE_TEX_SUB_IMAGE1D
:
6411 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6412 ctx
->Unpack
= ctx
->DefaultPacking
;
6413 CALL_TexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
6415 n
[6].e
, n
[7].data
));
6416 ctx
->Unpack
= save
; /* restore */
6419 case OPCODE_TEX_SUB_IMAGE2D
:
6421 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6422 ctx
->Unpack
= ctx
->DefaultPacking
;
6423 CALL_TexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
6425 n
[6].i
, n
[7].e
, n
[8].e
,
6427 ctx
->Unpack
= save
; /* restore */
6430 case OPCODE_TEX_SUB_IMAGE3D
:
6432 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6433 ctx
->Unpack
= ctx
->DefaultPacking
;
6434 CALL_TexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
6435 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
6436 n
[8].i
, n
[9].e
, n
[10].e
,
6438 ctx
->Unpack
= save
; /* restore */
6441 case OPCODE_TRANSLATE
:
6442 CALL_Translatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
6444 case OPCODE_VIEWPORT
:
6445 CALL_Viewport(ctx
->Exec
, (n
[1].i
, n
[2].i
,
6446 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
));
6448 case OPCODE_WINDOW_POS
:
6449 CALL_WindowPos4fMESA(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
6451 case OPCODE_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
6452 CALL_ActiveTextureARB(ctx
->Exec
, (n
[1].e
));
6454 case OPCODE_COMPRESSED_TEX_IMAGE_1D
: /* GL_ARB_texture_compression */
6455 CALL_CompressedTexImage1DARB(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
6456 n
[4].i
, n
[5].i
, n
[6].i
,
6459 case OPCODE_COMPRESSED_TEX_IMAGE_2D
: /* GL_ARB_texture_compression */
6460 CALL_CompressedTexImage2DARB(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
6461 n
[4].i
, n
[5].i
, n
[6].i
,
6462 n
[7].i
, n
[8].data
));
6464 case OPCODE_COMPRESSED_TEX_IMAGE_3D
: /* GL_ARB_texture_compression */
6465 CALL_CompressedTexImage3DARB(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
6466 n
[4].i
, n
[5].i
, n
[6].i
,
6470 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
: /* GL_ARB_texture_compress */
6471 CALL_CompressedTexSubImage1DARB(ctx
->Exec
,
6472 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
6473 n
[5].e
, n
[6].i
, n
[7].data
));
6475 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
: /* GL_ARB_texture_compress */
6476 CALL_CompressedTexSubImage2DARB(ctx
->Exec
,
6477 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
6478 n
[5].i
, n
[6].i
, n
[7].e
, n
[8].i
,
6481 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
: /* GL_ARB_texture_compress */
6482 CALL_CompressedTexSubImage3DARB(ctx
->Exec
,
6483 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
6484 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
6485 n
[9].e
, n
[10].i
, n
[11].data
));
6487 case OPCODE_SAMPLE_COVERAGE
: /* GL_ARB_multisample */
6488 CALL_SampleCoverageARB(ctx
->Exec
, (n
[1].f
, n
[2].b
));
6490 case OPCODE_WINDOW_POS_ARB
: /* GL_ARB_window_pos */
6491 CALL_WindowPos3fMESA(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
6493 #if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
6494 case OPCODE_BIND_PROGRAM_NV
: /* GL_NV_vertex_program */
6495 CALL_BindProgramNV(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
6498 #if FEATURE_NV_vertex_program
6499 case OPCODE_EXECUTE_PROGRAM_NV
:
6506 CALL_ExecuteProgramNV(ctx
->Exec
, (n
[1].e
, n
[2].ui
, v
));
6509 case OPCODE_REQUEST_RESIDENT_PROGRAMS_NV
:
6510 CALL_RequestResidentProgramsNV(ctx
->Exec
, (n
[1].ui
,
6511 (GLuint
*) n
[2].data
));
6513 case OPCODE_LOAD_PROGRAM_NV
:
6514 CALL_LoadProgramNV(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].i
,
6515 (const GLubyte
*) n
[4].data
));
6517 case OPCODE_TRACK_MATRIX_NV
:
6518 CALL_TrackMatrixNV(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].e
, n
[4].e
));
6522 #if FEATURE_NV_fragment_program
6523 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
:
6524 CALL_ProgramLocalParameter4fARB(ctx
->Exec
,
6525 (n
[1].e
, n
[2].ui
, n
[3].f
, n
[4].f
,
6528 case OPCODE_PROGRAM_NAMED_PARAMETER_NV
:
6529 CALL_ProgramNamedParameter4fNV(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
6530 (const GLubyte
*) n
[3].
6531 data
, n
[4].f
, n
[5].f
,
6536 case OPCODE_ACTIVE_STENCIL_FACE_EXT
:
6537 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (n
[1].e
));
6539 case OPCODE_DEPTH_BOUNDS_EXT
:
6540 CALL_DepthBoundsEXT(ctx
->Exec
, (n
[1].f
, n
[2].f
));
6542 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
6543 case OPCODE_PROGRAM_STRING_ARB
:
6544 CALL_ProgramStringARB(ctx
->Exec
,
6545 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].data
));
6548 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program || FEATURE_NV_vertex_program
6549 case OPCODE_PROGRAM_ENV_PARAMETER_ARB
:
6550 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].f
,
6555 #if FEATURE_ARB_occlusion_query
6556 case OPCODE_BEGIN_QUERY_ARB
:
6557 CALL_BeginQueryARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
6559 case OPCODE_END_QUERY_ARB
:
6560 CALL_EndQueryARB(ctx
->Exec
, (n
[1].e
));
6563 case OPCODE_DRAW_BUFFERS_ARB
:
6565 GLenum buffers
[MAX_DRAW_BUFFERS
];
6566 GLint i
, count
= MIN2(n
[1].i
, MAX_DRAW_BUFFERS
);
6567 for (i
= 0; i
< count
; i
++)
6568 buffers
[i
] = n
[2 + i
].e
;
6569 CALL_DrawBuffersARB(ctx
->Exec
, (n
[1].i
, buffers
));
6572 #if FEATURE_EXT_framebuffer_blit
6573 case OPCODE_BLIT_FRAMEBUFFER
:
6574 CALL_BlitFramebufferEXT(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
,
6575 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
6579 case OPCODE_TEX_BUMP_PARAMETER_ATI
:
6582 GLuint i
, pname
= n
[1].ui
;
6584 for (i
= 0; i
< 4; i
++)
6585 values
[i
] = n
[1 + i
].f
;
6586 CALL_TexBumpParameterfvATI(ctx
->Exec
, (pname
, values
));
6589 #if FEATURE_ATI_fragment_shader
6590 case OPCODE_BIND_FRAGMENT_SHADER_ATI
:
6591 CALL_BindFragmentShaderATI(ctx
->Exec
, (n
[1].i
));
6593 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
:
6596 GLuint i
, dst
= n
[1].ui
;
6598 for (i
= 0; i
< 4; i
++)
6599 values
[i
] = n
[1 + i
].f
;
6600 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, values
));
6604 case OPCODE_ATTR_1F_NV
:
6605 CALL_VertexAttrib1fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
));
6607 case OPCODE_ATTR_2F_NV
:
6608 /* Really shouldn't have to do this - the Node structure
6609 * is convenient, but it would be better to store the data
6610 * packed appropriately so that it can be sent directly
6611 * on. With x86_64 becoming common, this will start to
6614 if (sizeof(Node
) == sizeof(GLfloat
))
6615 CALL_VertexAttrib2fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6617 CALL_VertexAttrib2fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
));
6619 case OPCODE_ATTR_3F_NV
:
6620 if (sizeof(Node
) == sizeof(GLfloat
))
6621 CALL_VertexAttrib3fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6623 CALL_VertexAttrib3fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
6626 case OPCODE_ATTR_4F_NV
:
6627 if (sizeof(Node
) == sizeof(GLfloat
))
6628 CALL_VertexAttrib4fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6630 CALL_VertexAttrib4fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
6633 case OPCODE_ATTR_1F_ARB
:
6634 CALL_VertexAttrib1fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
));
6636 case OPCODE_ATTR_2F_ARB
:
6637 /* Really shouldn't have to do this - the Node structure
6638 * is convenient, but it would be better to store the data
6639 * packed appropriately so that it can be sent directly
6640 * on. With x86_64 becoming common, this will start to
6643 if (sizeof(Node
) == sizeof(GLfloat
))
6644 CALL_VertexAttrib2fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6646 CALL_VertexAttrib2fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
));
6648 case OPCODE_ATTR_3F_ARB
:
6649 if (sizeof(Node
) == sizeof(GLfloat
))
6650 CALL_VertexAttrib3fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6652 CALL_VertexAttrib3fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
6655 case OPCODE_ATTR_4F_ARB
:
6656 if (sizeof(Node
) == sizeof(GLfloat
))
6657 CALL_VertexAttrib4fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6659 CALL_VertexAttrib4fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
6662 case OPCODE_MATERIAL
:
6663 if (sizeof(Node
) == sizeof(GLfloat
))
6664 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, &n
[3].f
));
6671 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, f
));
6675 CALL_Begin(ctx
->Exec
, (n
[1].e
));
6678 CALL_End(ctx
->Exec
, ());
6681 CALL_Rectf(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
6683 case OPCODE_EVAL_C1
:
6684 CALL_EvalCoord1f(ctx
->Exec
, (n
[1].f
));
6686 case OPCODE_EVAL_C2
:
6687 CALL_EvalCoord2f(ctx
->Exec
, (n
[1].f
, n
[2].f
));
6689 case OPCODE_EVAL_P1
:
6690 CALL_EvalPoint1(ctx
->Exec
, (n
[1].i
));
6692 case OPCODE_EVAL_P2
:
6693 CALL_EvalPoint2(ctx
->Exec
, (n
[1].i
, n
[2].i
));
6696 case OPCODE_CONTINUE
:
6697 n
= (Node
*) n
[1].next
;
6699 case OPCODE_END_OF_LIST
:
6705 _mesa_sprintf(msg
, "Error in execute_list: opcode=%d",
6707 _mesa_problem(ctx
, msg
);
6712 /* increment n to point to next compiled command */
6713 if (opcode
!= OPCODE_CONTINUE
) {
6714 n
+= InstSize
[opcode
];
6719 if (ctx
->Driver
.EndCallList
)
6720 ctx
->Driver
.EndCallList(ctx
);
6722 ctx
->ListState
.CallDepth
--;
6727 /**********************************************************************/
6729 /**********************************************************************/
6732 * Test if a display list number is valid.
6734 GLboolean GLAPIENTRY
6735 _mesa_IsList(GLuint list
)
6737 GET_CURRENT_CONTEXT(ctx
);
6738 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
6739 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
6740 return islist(ctx
, list
);
6745 * Delete a sequence of consecutive display lists.
6748 _mesa_DeleteLists(GLuint list
, GLsizei range
)
6750 GET_CURRENT_CONTEXT(ctx
);
6752 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
6753 ASSERT_OUTSIDE_BEGIN_END(ctx
);
6756 _mesa_error(ctx
, GL_INVALID_VALUE
, "glDeleteLists");
6759 for (i
= list
; i
< list
+ range
; i
++) {
6760 destroy_list(ctx
, i
);
6766 * Return a display list number, n, such that lists n through n+range-1
6770 _mesa_GenLists(GLsizei range
)
6772 GET_CURRENT_CONTEXT(ctx
);
6774 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
6775 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, 0);
6778 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGenLists");
6786 * Make this an atomic operation
6788 _glthread_LOCK_MUTEX(ctx
->Shared
->Mutex
);
6790 base
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
6792 /* reserve the list IDs by with empty/dummy lists */
6794 for (i
= 0; i
< range
; i
++) {
6795 _mesa_HashInsert(ctx
->Shared
->DisplayList
, base
+ i
,
6796 make_list(base
+ i
, 1));
6800 _glthread_UNLOCK_MUTEX(ctx
->Shared
->Mutex
);
6807 * Begin a new display list.
6810 _mesa_NewList(GLuint name
, GLenum mode
)
6812 GET_CURRENT_CONTEXT(ctx
);
6814 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
6815 ASSERT_OUTSIDE_BEGIN_END(ctx
);
6817 if (MESA_VERBOSE
& VERBOSE_API
)
6818 _mesa_debug(ctx
, "glNewList %u %s\n", name
,
6819 _mesa_lookup_enum_by_nr(mode
));
6822 _mesa_error(ctx
, GL_INVALID_VALUE
, "glNewList");
6826 if (mode
!= GL_COMPILE
&& mode
!= GL_COMPILE_AND_EXECUTE
) {
6827 _mesa_error(ctx
, GL_INVALID_ENUM
, "glNewList");
6831 if (ctx
->ListState
.CurrentList
) {
6832 /* already compiling a display list */
6833 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
6837 ctx
->CompileFlag
= GL_TRUE
;
6838 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
6840 /* Reset acumulated list state:
6842 invalidate_saved_current_state( ctx
);
6844 /* Allocate new display list */
6845 ctx
->ListState
.CurrentList
= make_list(name
, BLOCK_SIZE
);
6846 ctx
->ListState
.CurrentBlock
= ctx
->ListState
.CurrentList
->Head
;
6847 ctx
->ListState
.CurrentPos
= 0;
6849 ctx
->Driver
.NewList(ctx
, name
, mode
);
6851 ctx
->CurrentDispatch
= ctx
->Save
;
6852 _glapi_set_dispatch(ctx
->CurrentDispatch
);
6857 * End definition of current display list.
6862 GET_CURRENT_CONTEXT(ctx
);
6863 SAVE_FLUSH_VERTICES(ctx
);
6864 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
6866 if (MESA_VERBOSE
& VERBOSE_API
)
6867 _mesa_debug(ctx
, "glEndList\n");
6869 /* Check that a list is under construction */
6870 if (!ctx
->ListState
.CurrentList
) {
6871 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glEndList");
6875 /* Call before emitting END_OF_LIST, in case the driver wants to
6876 * emit opcodes itself.
6878 ctx
->Driver
.EndList(ctx
);
6880 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_END_OF_LIST
, 0);
6882 /* Destroy old list, if any */
6883 destroy_list(ctx
, ctx
->ListState
.CurrentList
->Name
);
6885 /* Install the new list */
6886 _mesa_HashInsert(ctx
->Shared
->DisplayList
,
6887 ctx
->ListState
.CurrentList
->Name
,
6888 ctx
->ListState
.CurrentList
);
6891 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
6892 mesa_print_display_list(ctx
->ListState
.CurrentList
->Name
);
6894 ctx
->ListState
.CurrentList
= NULL
;
6895 ctx
->ExecuteFlag
= GL_TRUE
;
6896 ctx
->CompileFlag
= GL_FALSE
;
6898 ctx
->CurrentDispatch
= ctx
->Exec
;
6899 _glapi_set_dispatch(ctx
->CurrentDispatch
);
6904 _mesa_CallList(GLuint list
)
6906 GLboolean save_compile_flag
;
6907 GET_CURRENT_CONTEXT(ctx
);
6908 FLUSH_CURRENT(ctx
, 0);
6909 /* VERY IMPORTANT: Save the CompileFlag status, turn it off, */
6910 /* execute the display list, and restore the CompileFlag. */
6912 if (MESA_VERBOSE
& VERBOSE_API
)
6913 _mesa_debug(ctx
, "glCallList %d\n", list
);
6916 _mesa_error(ctx
, GL_INVALID_VALUE
, "glCallList(list==0)");
6920 /* mesa_print_display_list( list ); */
6922 save_compile_flag
= ctx
->CompileFlag
;
6923 if (save_compile_flag
) {
6924 ctx
->CompileFlag
= GL_FALSE
;
6927 execute_list(ctx
, list
);
6928 ctx
->CompileFlag
= save_compile_flag
;
6930 /* also restore API function pointers to point to "save" versions */
6931 if (save_compile_flag
) {
6932 ctx
->CurrentDispatch
= ctx
->Save
;
6933 _glapi_set_dispatch(ctx
->CurrentDispatch
);
6939 * Execute glCallLists: call multiple display lists.
6942 _mesa_CallLists(GLsizei n
, GLenum type
, const GLvoid
* lists
)
6944 GET_CURRENT_CONTEXT(ctx
);
6946 GLboolean save_compile_flag
;
6948 if (MESA_VERBOSE
& VERBOSE_API
)
6949 _mesa_debug(ctx
, "glCallLists %d\n", n
);
6953 case GL_UNSIGNED_BYTE
:
6955 case GL_UNSIGNED_SHORT
:
6957 case GL_UNSIGNED_INT
:
6965 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
6969 /* Save the CompileFlag status, turn it off, execute display list,
6970 * and restore the CompileFlag.
6972 save_compile_flag
= ctx
->CompileFlag
;
6973 ctx
->CompileFlag
= GL_FALSE
;
6975 for (i
= 0; i
< n
; i
++) {
6976 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ translate_id(i
, type
, lists
));
6977 execute_list(ctx
, list
);
6980 ctx
->CompileFlag
= save_compile_flag
;
6982 /* also restore API function pointers to point to "save" versions */
6983 if (save_compile_flag
) {
6984 ctx
->CurrentDispatch
= ctx
->Save
;
6985 _glapi_set_dispatch(ctx
->CurrentDispatch
);
6991 * Set the offset added to list numbers in glCallLists.
6994 _mesa_ListBase(GLuint base
)
6996 GET_CURRENT_CONTEXT(ctx
);
6997 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
6998 ASSERT_OUTSIDE_BEGIN_END(ctx
);
6999 ctx
->List
.ListBase
= base
;
7003 /* Can no longer assume ctx->Exec->Func is equal to _mesa_Func.
7005 static void GLAPIENTRY
7008 GET_CURRENT_CONTEXT(ctx
);
7009 FLUSH_VERTICES(ctx
, 0);
7010 CALL_Finish(ctx
->Exec
, ());
7013 static void GLAPIENTRY
7016 GET_CURRENT_CONTEXT(ctx
);
7017 FLUSH_VERTICES(ctx
, 0);
7018 CALL_Flush(ctx
->Exec
, ());
7021 static void GLAPIENTRY
7022 exec_GetBooleanv(GLenum pname
, GLboolean
*params
)
7024 GET_CURRENT_CONTEXT(ctx
);
7025 FLUSH_VERTICES(ctx
, 0);
7026 CALL_GetBooleanv(ctx
->Exec
, (pname
, params
));
7029 static void GLAPIENTRY
7030 exec_GetClipPlane(GLenum plane
, GLdouble
* equation
)
7032 GET_CURRENT_CONTEXT(ctx
);
7033 FLUSH_VERTICES(ctx
, 0);
7034 CALL_GetClipPlane(ctx
->Exec
, (plane
, equation
));
7037 static void GLAPIENTRY
7038 exec_GetDoublev(GLenum pname
, GLdouble
*params
)
7040 GET_CURRENT_CONTEXT(ctx
);
7041 FLUSH_VERTICES(ctx
, 0);
7042 CALL_GetDoublev(ctx
->Exec
, (pname
, params
));
7045 static GLenum GLAPIENTRY
7048 GET_CURRENT_CONTEXT(ctx
);
7049 FLUSH_VERTICES(ctx
, 0);
7050 return CALL_GetError(ctx
->Exec
, ());
7053 static void GLAPIENTRY
7054 exec_GetFloatv(GLenum pname
, GLfloat
*params
)
7056 GET_CURRENT_CONTEXT(ctx
);
7057 FLUSH_VERTICES(ctx
, 0);
7058 CALL_GetFloatv(ctx
->Exec
, (pname
, params
));
7061 static void GLAPIENTRY
7062 exec_GetIntegerv(GLenum pname
, GLint
*params
)
7064 GET_CURRENT_CONTEXT(ctx
);
7065 FLUSH_VERTICES(ctx
, 0);
7066 CALL_GetIntegerv(ctx
->Exec
, (pname
, params
));
7069 static void GLAPIENTRY
7070 exec_GetLightfv(GLenum light
, GLenum pname
, GLfloat
*params
)
7072 GET_CURRENT_CONTEXT(ctx
);
7073 FLUSH_VERTICES(ctx
, 0);
7074 CALL_GetLightfv(ctx
->Exec
, (light
, pname
, params
));
7077 static void GLAPIENTRY
7078 exec_GetLightiv(GLenum light
, GLenum pname
, GLint
*params
)
7080 GET_CURRENT_CONTEXT(ctx
);
7081 FLUSH_VERTICES(ctx
, 0);
7082 CALL_GetLightiv(ctx
->Exec
, (light
, pname
, params
));
7085 static void GLAPIENTRY
7086 exec_GetMapdv(GLenum target
, GLenum query
, GLdouble
* v
)
7088 GET_CURRENT_CONTEXT(ctx
);
7089 FLUSH_VERTICES(ctx
, 0);
7090 CALL_GetMapdv(ctx
->Exec
, (target
, query
, v
));
7093 static void GLAPIENTRY
7094 exec_GetMapfv(GLenum target
, GLenum query
, GLfloat
* v
)
7096 GET_CURRENT_CONTEXT(ctx
);
7097 FLUSH_VERTICES(ctx
, 0);
7098 CALL_GetMapfv(ctx
->Exec
, (target
, query
, v
));
7101 static void GLAPIENTRY
7102 exec_GetMapiv(GLenum target
, GLenum query
, GLint
* v
)
7104 GET_CURRENT_CONTEXT(ctx
);
7105 FLUSH_VERTICES(ctx
, 0);
7106 CALL_GetMapiv(ctx
->Exec
, (target
, query
, v
));
7109 static void GLAPIENTRY
7110 exec_GetMaterialfv(GLenum face
, GLenum pname
, GLfloat
*params
)
7112 GET_CURRENT_CONTEXT(ctx
);
7113 FLUSH_VERTICES(ctx
, 0);
7114 CALL_GetMaterialfv(ctx
->Exec
, (face
, pname
, params
));
7117 static void GLAPIENTRY
7118 exec_GetMaterialiv(GLenum face
, GLenum pname
, GLint
*params
)
7120 GET_CURRENT_CONTEXT(ctx
);
7121 FLUSH_VERTICES(ctx
, 0);
7122 CALL_GetMaterialiv(ctx
->Exec
, (face
, pname
, params
));
7125 static void GLAPIENTRY
7126 exec_GetPixelMapfv(GLenum map
, GLfloat
*values
)
7128 GET_CURRENT_CONTEXT(ctx
);
7129 FLUSH_VERTICES(ctx
, 0);
7130 CALL_GetPixelMapfv(ctx
->Exec
, (map
, values
));
7133 static void GLAPIENTRY
7134 exec_GetPixelMapuiv(GLenum map
, GLuint
*values
)
7136 GET_CURRENT_CONTEXT(ctx
);
7137 FLUSH_VERTICES(ctx
, 0);
7138 CALL_GetPixelMapuiv(ctx
->Exec
, (map
, values
));
7141 static void GLAPIENTRY
7142 exec_GetPixelMapusv(GLenum map
, GLushort
*values
)
7144 GET_CURRENT_CONTEXT(ctx
);
7145 FLUSH_VERTICES(ctx
, 0);
7146 CALL_GetPixelMapusv(ctx
->Exec
, (map
, values
));
7149 static void GLAPIENTRY
7150 exec_GetPolygonStipple(GLubyte
* dest
)
7152 GET_CURRENT_CONTEXT(ctx
);
7153 FLUSH_VERTICES(ctx
, 0);
7154 CALL_GetPolygonStipple(ctx
->Exec
, (dest
));
7157 static const GLubyte
*GLAPIENTRY
7158 exec_GetString(GLenum name
)
7160 GET_CURRENT_CONTEXT(ctx
);
7161 FLUSH_VERTICES(ctx
, 0);
7162 return CALL_GetString(ctx
->Exec
, (name
));
7165 static void GLAPIENTRY
7166 exec_GetTexEnvfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7168 GET_CURRENT_CONTEXT(ctx
);
7169 FLUSH_VERTICES(ctx
, 0);
7170 CALL_GetTexEnvfv(ctx
->Exec
, (target
, pname
, params
));
7173 static void GLAPIENTRY
7174 exec_GetTexEnviv(GLenum target
, GLenum pname
, GLint
*params
)
7176 GET_CURRENT_CONTEXT(ctx
);
7177 FLUSH_VERTICES(ctx
, 0);
7178 CALL_GetTexEnviv(ctx
->Exec
, (target
, pname
, params
));
7181 static void GLAPIENTRY
7182 exec_GetTexGendv(GLenum coord
, GLenum pname
, GLdouble
*params
)
7184 GET_CURRENT_CONTEXT(ctx
);
7185 FLUSH_VERTICES(ctx
, 0);
7186 CALL_GetTexGendv(ctx
->Exec
, (coord
, pname
, params
));
7189 static void GLAPIENTRY
7190 exec_GetTexGenfv(GLenum coord
, GLenum pname
, GLfloat
*params
)
7192 GET_CURRENT_CONTEXT(ctx
);
7193 FLUSH_VERTICES(ctx
, 0);
7194 CALL_GetTexGenfv(ctx
->Exec
, (coord
, pname
, params
));
7197 static void GLAPIENTRY
7198 exec_GetTexGeniv(GLenum coord
, GLenum pname
, GLint
*params
)
7200 GET_CURRENT_CONTEXT(ctx
);
7201 FLUSH_VERTICES(ctx
, 0);
7202 CALL_GetTexGeniv(ctx
->Exec
, (coord
, pname
, params
));
7205 static void GLAPIENTRY
7206 exec_GetTexImage(GLenum target
, GLint level
, GLenum format
,
7207 GLenum type
, GLvoid
* pixels
)
7209 GET_CURRENT_CONTEXT(ctx
);
7210 FLUSH_VERTICES(ctx
, 0);
7211 CALL_GetTexImage(ctx
->Exec
, (target
, level
, format
, type
, pixels
));
7214 static void GLAPIENTRY
7215 exec_GetTexLevelParameterfv(GLenum target
, GLint level
,
7216 GLenum pname
, GLfloat
*params
)
7218 GET_CURRENT_CONTEXT(ctx
);
7219 FLUSH_VERTICES(ctx
, 0);
7220 CALL_GetTexLevelParameterfv(ctx
->Exec
, (target
, level
, pname
, params
));
7223 static void GLAPIENTRY
7224 exec_GetTexLevelParameteriv(GLenum target
, GLint level
,
7225 GLenum pname
, GLint
*params
)
7227 GET_CURRENT_CONTEXT(ctx
);
7228 FLUSH_VERTICES(ctx
, 0);
7229 CALL_GetTexLevelParameteriv(ctx
->Exec
, (target
, level
, pname
, params
));
7232 static void GLAPIENTRY
7233 exec_GetTexParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7235 GET_CURRENT_CONTEXT(ctx
);
7236 FLUSH_VERTICES(ctx
, 0);
7237 CALL_GetTexParameterfv(ctx
->Exec
, (target
, pname
, params
));
7240 static void GLAPIENTRY
7241 exec_GetTexParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7243 GET_CURRENT_CONTEXT(ctx
);
7244 FLUSH_VERTICES(ctx
, 0);
7245 CALL_GetTexParameteriv(ctx
->Exec
, (target
, pname
, params
));
7248 static GLboolean GLAPIENTRY
7249 exec_IsEnabled(GLenum cap
)
7251 GET_CURRENT_CONTEXT(ctx
);
7252 FLUSH_VERTICES(ctx
, 0);
7253 return CALL_IsEnabled(ctx
->Exec
, (cap
));
7256 static void GLAPIENTRY
7257 exec_PixelStoref(GLenum pname
, GLfloat param
)
7259 GET_CURRENT_CONTEXT(ctx
);
7260 FLUSH_VERTICES(ctx
, 0);
7261 CALL_PixelStoref(ctx
->Exec
, (pname
, param
));
7264 static void GLAPIENTRY
7265 exec_PixelStorei(GLenum pname
, GLint param
)
7267 GET_CURRENT_CONTEXT(ctx
);
7268 FLUSH_VERTICES(ctx
, 0);
7269 CALL_PixelStorei(ctx
->Exec
, (pname
, param
));
7272 static void GLAPIENTRY
7273 exec_ReadPixels(GLint x
, GLint y
, GLsizei width
, GLsizei height
,
7274 GLenum format
, GLenum type
, GLvoid
* pixels
)
7276 GET_CURRENT_CONTEXT(ctx
);
7277 FLUSH_VERTICES(ctx
, 0);
7278 CALL_ReadPixels(ctx
->Exec
, (x
, y
, width
, height
, format
, type
, pixels
));
7281 static GLint GLAPIENTRY
7282 exec_RenderMode(GLenum mode
)
7284 GET_CURRENT_CONTEXT(ctx
);
7285 FLUSH_VERTICES(ctx
, 0);
7286 return CALL_RenderMode(ctx
->Exec
, (mode
));
7289 static void GLAPIENTRY
7290 exec_FeedbackBuffer(GLsizei size
, GLenum type
, GLfloat
* buffer
)
7292 GET_CURRENT_CONTEXT(ctx
);
7293 FLUSH_VERTICES(ctx
, 0);
7294 CALL_FeedbackBuffer(ctx
->Exec
, (size
, type
, buffer
));
7297 static void GLAPIENTRY
7298 exec_SelectBuffer(GLsizei size
, GLuint
* buffer
)
7300 GET_CURRENT_CONTEXT(ctx
);
7301 FLUSH_VERTICES(ctx
, 0);
7302 CALL_SelectBuffer(ctx
->Exec
, (size
, buffer
));
7305 static GLboolean GLAPIENTRY
7306 exec_AreTexturesResident(GLsizei n
, const GLuint
* texName
,
7307 GLboolean
* residences
)
7309 GET_CURRENT_CONTEXT(ctx
);
7310 FLUSH_VERTICES(ctx
, 0);
7311 return CALL_AreTexturesResident(ctx
->Exec
, (n
, texName
, residences
));
7314 static void GLAPIENTRY
7315 exec_ColorPointer(GLint size
, GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
7317 GET_CURRENT_CONTEXT(ctx
);
7318 FLUSH_VERTICES(ctx
, 0);
7319 CALL_ColorPointer(ctx
->Exec
, (size
, type
, stride
, ptr
));
7322 static void GLAPIENTRY
7323 exec_DeleteTextures(GLsizei n
, const GLuint
* texName
)
7325 GET_CURRENT_CONTEXT(ctx
);
7326 FLUSH_VERTICES(ctx
, 0);
7327 CALL_DeleteTextures(ctx
->Exec
, (n
, texName
));
7330 static void GLAPIENTRY
7331 exec_DisableClientState(GLenum cap
)
7333 GET_CURRENT_CONTEXT(ctx
);
7334 FLUSH_VERTICES(ctx
, 0);
7335 CALL_DisableClientState(ctx
->Exec
, (cap
));
7338 static void GLAPIENTRY
7339 exec_EdgeFlagPointer(GLsizei stride
, const GLvoid
* vptr
)
7341 GET_CURRENT_CONTEXT(ctx
);
7342 FLUSH_VERTICES(ctx
, 0);
7343 CALL_EdgeFlagPointer(ctx
->Exec
, (stride
, vptr
));
7346 static void GLAPIENTRY
7347 exec_EnableClientState(GLenum cap
)
7349 GET_CURRENT_CONTEXT(ctx
);
7350 FLUSH_VERTICES(ctx
, 0);
7351 CALL_EnableClientState(ctx
->Exec
, (cap
));
7354 static void GLAPIENTRY
7355 exec_GenTextures(GLsizei n
, GLuint
* texName
)
7357 GET_CURRENT_CONTEXT(ctx
);
7358 FLUSH_VERTICES(ctx
, 0);
7359 CALL_GenTextures(ctx
->Exec
, (n
, texName
));
7362 static void GLAPIENTRY
7363 exec_GetPointerv(GLenum pname
, GLvoid
**params
)
7365 GET_CURRENT_CONTEXT(ctx
);
7366 FLUSH_VERTICES(ctx
, 0);
7367 CALL_GetPointerv(ctx
->Exec
, (pname
, params
));
7370 static void GLAPIENTRY
7371 exec_IndexPointer(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
7373 GET_CURRENT_CONTEXT(ctx
);
7374 FLUSH_VERTICES(ctx
, 0);
7375 CALL_IndexPointer(ctx
->Exec
, (type
, stride
, ptr
));
7378 static void GLAPIENTRY
7379 exec_InterleavedArrays(GLenum format
, GLsizei stride
, const GLvoid
* pointer
)
7381 GET_CURRENT_CONTEXT(ctx
);
7382 FLUSH_VERTICES(ctx
, 0);
7383 CALL_InterleavedArrays(ctx
->Exec
, (format
, stride
, pointer
));
7386 static GLboolean GLAPIENTRY
7387 exec_IsTexture(GLuint texture
)
7389 GET_CURRENT_CONTEXT(ctx
);
7390 FLUSH_VERTICES(ctx
, 0);
7391 return CALL_IsTexture(ctx
->Exec
, (texture
));
7394 static void GLAPIENTRY
7395 exec_NormalPointer(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
7397 GET_CURRENT_CONTEXT(ctx
);
7398 FLUSH_VERTICES(ctx
, 0);
7399 CALL_NormalPointer(ctx
->Exec
, (type
, stride
, ptr
));
7402 static void GLAPIENTRY
7403 exec_PopClientAttrib(void)
7405 GET_CURRENT_CONTEXT(ctx
);
7406 FLUSH_VERTICES(ctx
, 0);
7407 CALL_PopClientAttrib(ctx
->Exec
, ());
7410 static void GLAPIENTRY
7411 exec_PushClientAttrib(GLbitfield mask
)
7413 GET_CURRENT_CONTEXT(ctx
);
7414 FLUSH_VERTICES(ctx
, 0);
7415 CALL_PushClientAttrib(ctx
->Exec
, (mask
));
7418 static void GLAPIENTRY
7419 exec_TexCoordPointer(GLint size
, GLenum type
, GLsizei stride
,
7422 GET_CURRENT_CONTEXT(ctx
);
7423 FLUSH_VERTICES(ctx
, 0);
7424 CALL_TexCoordPointer(ctx
->Exec
, (size
, type
, stride
, ptr
));
7427 static void GLAPIENTRY
7428 exec_GetCompressedTexImageARB(GLenum target
, GLint level
, GLvoid
* img
)
7430 GET_CURRENT_CONTEXT(ctx
);
7431 FLUSH_VERTICES(ctx
, 0);
7432 CALL_GetCompressedTexImageARB(ctx
->Exec
, (target
, level
, img
));
7435 static void GLAPIENTRY
7436 exec_VertexPointer(GLint size
, GLenum type
, GLsizei stride
,
7439 GET_CURRENT_CONTEXT(ctx
);
7440 FLUSH_VERTICES(ctx
, 0);
7441 CALL_VertexPointer(ctx
->Exec
, (size
, type
, stride
, ptr
));
7444 static void GLAPIENTRY
7445 exec_CopyConvolutionFilter1D(GLenum target
, GLenum internalFormat
,
7446 GLint x
, GLint y
, GLsizei width
)
7448 GET_CURRENT_CONTEXT(ctx
);
7449 FLUSH_VERTICES(ctx
, 0);
7450 CALL_CopyConvolutionFilter1D(ctx
->Exec
,
7451 (target
, internalFormat
, x
, y
, width
));
7454 static void GLAPIENTRY
7455 exec_CopyConvolutionFilter2D(GLenum target
, GLenum internalFormat
,
7456 GLint x
, GLint y
, GLsizei width
, GLsizei height
)
7458 GET_CURRENT_CONTEXT(ctx
);
7459 FLUSH_VERTICES(ctx
, 0);
7460 CALL_CopyConvolutionFilter2D(ctx
->Exec
,
7461 (target
, internalFormat
, x
, y
, width
,
7465 static void GLAPIENTRY
7466 exec_GetColorTable(GLenum target
, GLenum format
, GLenum type
, GLvoid
* data
)
7468 GET_CURRENT_CONTEXT(ctx
);
7469 FLUSH_VERTICES(ctx
, 0);
7470 CALL_GetColorTable(ctx
->Exec
, (target
, format
, type
, data
));
7473 static void GLAPIENTRY
7474 exec_GetColorTableParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7476 GET_CURRENT_CONTEXT(ctx
);
7477 FLUSH_VERTICES(ctx
, 0);
7478 CALL_GetColorTableParameterfv(ctx
->Exec
, (target
, pname
, params
));
7481 static void GLAPIENTRY
7482 exec_GetColorTableParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7484 GET_CURRENT_CONTEXT(ctx
);
7485 FLUSH_VERTICES(ctx
, 0);
7486 CALL_GetColorTableParameteriv(ctx
->Exec
, (target
, pname
, params
));
7489 static void GLAPIENTRY
7490 exec_GetConvolutionFilter(GLenum target
, GLenum format
, GLenum type
,
7493 GET_CURRENT_CONTEXT(ctx
);
7494 FLUSH_VERTICES(ctx
, 0);
7495 CALL_GetConvolutionFilter(ctx
->Exec
, (target
, format
, type
, image
));
7498 static void GLAPIENTRY
7499 exec_GetConvolutionParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7501 GET_CURRENT_CONTEXT(ctx
);
7502 FLUSH_VERTICES(ctx
, 0);
7503 CALL_GetConvolutionParameterfv(ctx
->Exec
, (target
, pname
, params
));
7506 static void GLAPIENTRY
7507 exec_GetConvolutionParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7509 GET_CURRENT_CONTEXT(ctx
);
7510 FLUSH_VERTICES(ctx
, 0);
7511 CALL_GetConvolutionParameteriv(ctx
->Exec
, (target
, pname
, params
));
7514 static void GLAPIENTRY
7515 exec_GetHistogram(GLenum target
, GLboolean reset
, GLenum format
,
7516 GLenum type
, GLvoid
*values
)
7518 GET_CURRENT_CONTEXT(ctx
);
7519 FLUSH_VERTICES(ctx
, 0);
7520 CALL_GetHistogram(ctx
->Exec
, (target
, reset
, format
, type
, values
));
7523 static void GLAPIENTRY
7524 exec_GetHistogramParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7526 GET_CURRENT_CONTEXT(ctx
);
7527 FLUSH_VERTICES(ctx
, 0);
7528 CALL_GetHistogramParameterfv(ctx
->Exec
, (target
, pname
, params
));
7531 static void GLAPIENTRY
7532 exec_GetHistogramParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7534 GET_CURRENT_CONTEXT(ctx
);
7535 FLUSH_VERTICES(ctx
, 0);
7536 CALL_GetHistogramParameteriv(ctx
->Exec
, (target
, pname
, params
));
7539 static void GLAPIENTRY
7540 exec_GetMinmax(GLenum target
, GLboolean reset
, GLenum format
,
7541 GLenum type
, GLvoid
*values
)
7543 GET_CURRENT_CONTEXT(ctx
);
7544 FLUSH_VERTICES(ctx
, 0);
7545 CALL_GetMinmax(ctx
->Exec
, (target
, reset
, format
, type
, values
));
7548 static void GLAPIENTRY
7549 exec_GetMinmaxParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7551 GET_CURRENT_CONTEXT(ctx
);
7552 FLUSH_VERTICES(ctx
, 0);
7553 CALL_GetMinmaxParameterfv(ctx
->Exec
, (target
, pname
, params
));
7556 static void GLAPIENTRY
7557 exec_GetMinmaxParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7559 GET_CURRENT_CONTEXT(ctx
);
7560 FLUSH_VERTICES(ctx
, 0);
7561 CALL_GetMinmaxParameteriv(ctx
->Exec
, (target
, pname
, params
));
7564 static void GLAPIENTRY
7565 exec_GetSeparableFilter(GLenum target
, GLenum format
, GLenum type
,
7566 GLvoid
*row
, GLvoid
*column
, GLvoid
*span
)
7568 GET_CURRENT_CONTEXT(ctx
);
7569 FLUSH_VERTICES(ctx
, 0);
7570 CALL_GetSeparableFilter(ctx
->Exec
,
7571 (target
, format
, type
, row
, column
, span
));
7574 static void GLAPIENTRY
7575 exec_SeparableFilter2D(GLenum target
, GLenum internalFormat
,
7576 GLsizei width
, GLsizei height
, GLenum format
,
7577 GLenum type
, const GLvoid
*row
, const GLvoid
*column
)
7579 GET_CURRENT_CONTEXT(ctx
);
7580 FLUSH_VERTICES(ctx
, 0);
7581 CALL_SeparableFilter2D(ctx
->Exec
,
7582 (target
, internalFormat
, width
, height
, format
,
7583 type
, row
, column
));
7586 static void GLAPIENTRY
7587 exec_ColorPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
7588 GLsizei count
, const GLvoid
*ptr
)
7590 GET_CURRENT_CONTEXT(ctx
);
7591 FLUSH_VERTICES(ctx
, 0);
7592 CALL_ColorPointerEXT(ctx
->Exec
, (size
, type
, stride
, count
, ptr
));
7595 static void GLAPIENTRY
7596 exec_EdgeFlagPointerEXT(GLsizei stride
, GLsizei count
, const GLboolean
*ptr
)
7598 GET_CURRENT_CONTEXT(ctx
);
7599 FLUSH_VERTICES(ctx
, 0);
7600 CALL_EdgeFlagPointerEXT(ctx
->Exec
, (stride
, count
, ptr
));
7603 static void GLAPIENTRY
7604 exec_IndexPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
,
7607 GET_CURRENT_CONTEXT(ctx
);
7608 FLUSH_VERTICES(ctx
, 0);
7609 CALL_IndexPointerEXT(ctx
->Exec
, (type
, stride
, count
, ptr
));
7612 static void GLAPIENTRY
7613 exec_NormalPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
,
7616 GET_CURRENT_CONTEXT(ctx
);
7617 FLUSH_VERTICES(ctx
, 0);
7618 CALL_NormalPointerEXT(ctx
->Exec
, (type
, stride
, count
, ptr
));
7621 static void GLAPIENTRY
7622 exec_TexCoordPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
7623 GLsizei count
, const GLvoid
*ptr
)
7625 GET_CURRENT_CONTEXT(ctx
);
7626 FLUSH_VERTICES(ctx
, 0);
7627 CALL_TexCoordPointerEXT(ctx
->Exec
, (size
, type
, stride
, count
, ptr
));
7630 static void GLAPIENTRY
7631 exec_VertexPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
7632 GLsizei count
, const GLvoid
*ptr
)
7634 GET_CURRENT_CONTEXT(ctx
);
7635 FLUSH_VERTICES(ctx
, 0);
7636 CALL_VertexPointerEXT(ctx
->Exec
, (size
, type
, stride
, count
, ptr
));
7639 static void GLAPIENTRY
7640 exec_LockArraysEXT(GLint first
, GLsizei count
)
7642 GET_CURRENT_CONTEXT(ctx
);
7643 FLUSH_VERTICES(ctx
, 0);
7644 CALL_LockArraysEXT(ctx
->Exec
, (first
, count
));
7647 static void GLAPIENTRY
7648 exec_UnlockArraysEXT(void)
7650 GET_CURRENT_CONTEXT(ctx
);
7651 FLUSH_VERTICES(ctx
, 0);
7652 CALL_UnlockArraysEXT(ctx
->Exec
, ());
7655 static void GLAPIENTRY
7656 exec_ClientActiveTextureARB(GLenum target
)
7658 GET_CURRENT_CONTEXT(ctx
);
7659 FLUSH_VERTICES(ctx
, 0);
7660 CALL_ClientActiveTextureARB(ctx
->Exec
, (target
));
7663 static void GLAPIENTRY
7664 exec_SecondaryColorPointerEXT(GLint size
, GLenum type
,
7665 GLsizei stride
, const GLvoid
*ptr
)
7667 GET_CURRENT_CONTEXT(ctx
);
7668 FLUSH_VERTICES(ctx
, 0);
7669 CALL_SecondaryColorPointerEXT(ctx
->Exec
, (size
, type
, stride
, ptr
));
7672 static void GLAPIENTRY
7673 exec_FogCoordPointerEXT(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
7675 GET_CURRENT_CONTEXT(ctx
);
7676 FLUSH_VERTICES(ctx
, 0);
7677 CALL_FogCoordPointerEXT(ctx
->Exec
, (type
, stride
, ptr
));
7680 /* GL_EXT_multi_draw_arrays */
7681 static void GLAPIENTRY
7682 exec_MultiDrawArraysEXT(GLenum mode
, GLint
* first
,
7683 GLsizei
* count
, GLsizei primcount
)
7685 GET_CURRENT_CONTEXT(ctx
);
7686 FLUSH_VERTICES(ctx
, 0);
7687 CALL_MultiDrawArraysEXT(ctx
->Exec
, (mode
, first
, count
, primcount
));
7690 /* GL_EXT_multi_draw_arrays */
7691 static void GLAPIENTRY
7692 exec_MultiDrawElementsEXT(GLenum mode
, const GLsizei
* count
,
7693 GLenum type
, const GLvoid
** indices
,
7696 GET_CURRENT_CONTEXT(ctx
);
7697 FLUSH_VERTICES(ctx
, 0);
7698 CALL_MultiDrawElementsEXT(ctx
->Exec
,
7699 (mode
, count
, type
, indices
, primcount
));
7702 /* GL_IBM_multimode_draw_arrays */
7703 static void GLAPIENTRY
7704 exec_MultiModeDrawArraysIBM(const GLenum
* mode
, const GLint
* first
,
7705 const GLsizei
* count
, GLsizei primcount
,
7708 GET_CURRENT_CONTEXT(ctx
);
7709 FLUSH_VERTICES(ctx
, 0);
7710 CALL_MultiModeDrawArraysIBM(ctx
->Exec
,
7711 (mode
, first
, count
, primcount
, modestride
));
7714 /* GL_IBM_multimode_draw_arrays */
7715 static void GLAPIENTRY
7716 exec_MultiModeDrawElementsIBM(const GLenum
* mode
,
7717 const GLsizei
* count
,
7719 const GLvoid
* const *indices
,
7720 GLsizei primcount
, GLint modestride
)
7722 GET_CURRENT_CONTEXT(ctx
);
7723 FLUSH_VERTICES(ctx
, 0);
7724 CALL_MultiModeDrawElementsIBM(ctx
->Exec
,
7725 (mode
, count
, type
, indices
, primcount
,
7732 * Setup the given dispatch table to point to Mesa's display list
7733 * building functions.
7735 * This does not include any of the tnl functions - they are
7736 * initialized from _mesa_init_api_defaults and from the active vtxfmt
7740 _mesa_init_dlist_table(struct _glapi_table
*table
)
7742 _mesa_loopback_init_api_table(table
);
7745 SET_Accum(table
, save_Accum
);
7746 SET_AlphaFunc(table
, save_AlphaFunc
);
7747 SET_Bitmap(table
, save_Bitmap
);
7748 SET_BlendFunc(table
, save_BlendFunc
);
7749 SET_CallList(table
, _mesa_save_CallList
);
7750 SET_CallLists(table
, _mesa_save_CallLists
);
7751 SET_Clear(table
, save_Clear
);
7752 SET_ClearAccum(table
, save_ClearAccum
);
7753 SET_ClearColor(table
, save_ClearColor
);
7754 SET_ClearDepth(table
, save_ClearDepth
);
7755 SET_ClearIndex(table
, save_ClearIndex
);
7756 SET_ClearStencil(table
, save_ClearStencil
);
7757 SET_ClipPlane(table
, save_ClipPlane
);
7758 SET_ColorMask(table
, save_ColorMask
);
7759 SET_ColorMaterial(table
, save_ColorMaterial
);
7760 SET_CopyPixels(table
, save_CopyPixels
);
7761 SET_CullFace(table
, save_CullFace
);
7762 SET_DeleteLists(table
, _mesa_DeleteLists
);
7763 SET_DepthFunc(table
, save_DepthFunc
);
7764 SET_DepthMask(table
, save_DepthMask
);
7765 SET_DepthRange(table
, save_DepthRange
);
7766 SET_Disable(table
, save_Disable
);
7767 SET_DrawBuffer(table
, save_DrawBuffer
);
7768 SET_DrawPixels(table
, save_DrawPixels
);
7769 SET_Enable(table
, save_Enable
);
7770 SET_EndList(table
, _mesa_EndList
);
7771 SET_EvalMesh1(table
, _mesa_save_EvalMesh1
);
7772 SET_EvalMesh2(table
, _mesa_save_EvalMesh2
);
7773 SET_Finish(table
, exec_Finish
);
7774 SET_Flush(table
, exec_Flush
);
7775 SET_Fogf(table
, save_Fogf
);
7776 SET_Fogfv(table
, save_Fogfv
);
7777 SET_Fogi(table
, save_Fogi
);
7778 SET_Fogiv(table
, save_Fogiv
);
7779 SET_FrontFace(table
, save_FrontFace
);
7780 SET_Frustum(table
, save_Frustum
);
7781 SET_GenLists(table
, _mesa_GenLists
);
7782 SET_GetBooleanv(table
, exec_GetBooleanv
);
7783 SET_GetClipPlane(table
, exec_GetClipPlane
);
7784 SET_GetDoublev(table
, exec_GetDoublev
);
7785 SET_GetError(table
, exec_GetError
);
7786 SET_GetFloatv(table
, exec_GetFloatv
);
7787 SET_GetIntegerv(table
, exec_GetIntegerv
);
7788 SET_GetLightfv(table
, exec_GetLightfv
);
7789 SET_GetLightiv(table
, exec_GetLightiv
);
7790 SET_GetMapdv(table
, exec_GetMapdv
);
7791 SET_GetMapfv(table
, exec_GetMapfv
);
7792 SET_GetMapiv(table
, exec_GetMapiv
);
7793 SET_GetMaterialfv(table
, exec_GetMaterialfv
);
7794 SET_GetMaterialiv(table
, exec_GetMaterialiv
);
7795 SET_GetPixelMapfv(table
, exec_GetPixelMapfv
);
7796 SET_GetPixelMapuiv(table
, exec_GetPixelMapuiv
);
7797 SET_GetPixelMapusv(table
, exec_GetPixelMapusv
);
7798 SET_GetPolygonStipple(table
, exec_GetPolygonStipple
);
7799 SET_GetString(table
, exec_GetString
);
7800 SET_GetTexEnvfv(table
, exec_GetTexEnvfv
);
7801 SET_GetTexEnviv(table
, exec_GetTexEnviv
);
7802 SET_GetTexGendv(table
, exec_GetTexGendv
);
7803 SET_GetTexGenfv(table
, exec_GetTexGenfv
);
7804 SET_GetTexGeniv(table
, exec_GetTexGeniv
);
7805 SET_GetTexImage(table
, exec_GetTexImage
);
7806 SET_GetTexLevelParameterfv(table
, exec_GetTexLevelParameterfv
);
7807 SET_GetTexLevelParameteriv(table
, exec_GetTexLevelParameteriv
);
7808 SET_GetTexParameterfv(table
, exec_GetTexParameterfv
);
7809 SET_GetTexParameteriv(table
, exec_GetTexParameteriv
);
7810 SET_Hint(table
, save_Hint
);
7811 SET_IndexMask(table
, save_IndexMask
);
7812 SET_InitNames(table
, save_InitNames
);
7813 SET_IsEnabled(table
, exec_IsEnabled
);
7814 SET_IsList(table
, _mesa_IsList
);
7815 SET_LightModelf(table
, save_LightModelf
);
7816 SET_LightModelfv(table
, save_LightModelfv
);
7817 SET_LightModeli(table
, save_LightModeli
);
7818 SET_LightModeliv(table
, save_LightModeliv
);
7819 SET_Lightf(table
, save_Lightf
);
7820 SET_Lightfv(table
, save_Lightfv
);
7821 SET_Lighti(table
, save_Lighti
);
7822 SET_Lightiv(table
, save_Lightiv
);
7823 SET_LineStipple(table
, save_LineStipple
);
7824 SET_LineWidth(table
, save_LineWidth
);
7825 SET_ListBase(table
, save_ListBase
);
7826 SET_LoadIdentity(table
, save_LoadIdentity
);
7827 SET_LoadMatrixd(table
, save_LoadMatrixd
);
7828 SET_LoadMatrixf(table
, save_LoadMatrixf
);
7829 SET_LoadName(table
, save_LoadName
);
7830 SET_LogicOp(table
, save_LogicOp
);
7831 SET_Map1d(table
, save_Map1d
);
7832 SET_Map1f(table
, save_Map1f
);
7833 SET_Map2d(table
, save_Map2d
);
7834 SET_Map2f(table
, save_Map2f
);
7835 SET_MapGrid1d(table
, save_MapGrid1d
);
7836 SET_MapGrid1f(table
, save_MapGrid1f
);
7837 SET_MapGrid2d(table
, save_MapGrid2d
);
7838 SET_MapGrid2f(table
, save_MapGrid2f
);
7839 SET_MatrixMode(table
, save_MatrixMode
);
7840 SET_MultMatrixd(table
, save_MultMatrixd
);
7841 SET_MultMatrixf(table
, save_MultMatrixf
);
7842 SET_NewList(table
, save_NewList
);
7843 SET_Ortho(table
, save_Ortho
);
7844 SET_PassThrough(table
, save_PassThrough
);
7845 SET_PixelMapfv(table
, save_PixelMapfv
);
7846 SET_PixelMapuiv(table
, save_PixelMapuiv
);
7847 SET_PixelMapusv(table
, save_PixelMapusv
);
7848 SET_PixelStoref(table
, exec_PixelStoref
);
7849 SET_PixelStorei(table
, exec_PixelStorei
);
7850 SET_PixelTransferf(table
, save_PixelTransferf
);
7851 SET_PixelTransferi(table
, save_PixelTransferi
);
7852 SET_PixelZoom(table
, save_PixelZoom
);
7853 SET_PointSize(table
, save_PointSize
);
7854 SET_PolygonMode(table
, save_PolygonMode
);
7855 SET_PolygonOffset(table
, save_PolygonOffset
);
7856 SET_PolygonStipple(table
, save_PolygonStipple
);
7857 SET_PopAttrib(table
, save_PopAttrib
);
7858 SET_PopMatrix(table
, save_PopMatrix
);
7859 SET_PopName(table
, save_PopName
);
7860 SET_PushAttrib(table
, save_PushAttrib
);
7861 SET_PushMatrix(table
, save_PushMatrix
);
7862 SET_PushName(table
, save_PushName
);
7863 SET_RasterPos2d(table
, save_RasterPos2d
);
7864 SET_RasterPos2dv(table
, save_RasterPos2dv
);
7865 SET_RasterPos2f(table
, save_RasterPos2f
);
7866 SET_RasterPos2fv(table
, save_RasterPos2fv
);
7867 SET_RasterPos2i(table
, save_RasterPos2i
);
7868 SET_RasterPos2iv(table
, save_RasterPos2iv
);
7869 SET_RasterPos2s(table
, save_RasterPos2s
);
7870 SET_RasterPos2sv(table
, save_RasterPos2sv
);
7871 SET_RasterPos3d(table
, save_RasterPos3d
);
7872 SET_RasterPos3dv(table
, save_RasterPos3dv
);
7873 SET_RasterPos3f(table
, save_RasterPos3f
);
7874 SET_RasterPos3fv(table
, save_RasterPos3fv
);
7875 SET_RasterPos3i(table
, save_RasterPos3i
);
7876 SET_RasterPos3iv(table
, save_RasterPos3iv
);
7877 SET_RasterPos3s(table
, save_RasterPos3s
);
7878 SET_RasterPos3sv(table
, save_RasterPos3sv
);
7879 SET_RasterPos4d(table
, save_RasterPos4d
);
7880 SET_RasterPos4dv(table
, save_RasterPos4dv
);
7881 SET_RasterPos4f(table
, save_RasterPos4f
);
7882 SET_RasterPos4fv(table
, save_RasterPos4fv
);
7883 SET_RasterPos4i(table
, save_RasterPos4i
);
7884 SET_RasterPos4iv(table
, save_RasterPos4iv
);
7885 SET_RasterPos4s(table
, save_RasterPos4s
);
7886 SET_RasterPos4sv(table
, save_RasterPos4sv
);
7887 SET_ReadBuffer(table
, save_ReadBuffer
);
7888 SET_ReadPixels(table
, exec_ReadPixels
);
7889 SET_RenderMode(table
, exec_RenderMode
);
7890 SET_Rotated(table
, save_Rotated
);
7891 SET_Rotatef(table
, save_Rotatef
);
7892 SET_Scaled(table
, save_Scaled
);
7893 SET_Scalef(table
, save_Scalef
);
7894 SET_Scissor(table
, save_Scissor
);
7895 SET_FeedbackBuffer(table
, exec_FeedbackBuffer
);
7896 SET_SelectBuffer(table
, exec_SelectBuffer
);
7897 SET_ShadeModel(table
, save_ShadeModel
);
7898 SET_StencilFunc(table
, save_StencilFunc
);
7899 SET_StencilMask(table
, save_StencilMask
);
7900 SET_StencilOp(table
, save_StencilOp
);
7901 SET_TexEnvf(table
, save_TexEnvf
);
7902 SET_TexEnvfv(table
, save_TexEnvfv
);
7903 SET_TexEnvi(table
, save_TexEnvi
);
7904 SET_TexEnviv(table
, save_TexEnviv
);
7905 SET_TexGend(table
, save_TexGend
);
7906 SET_TexGendv(table
, save_TexGendv
);
7907 SET_TexGenf(table
, save_TexGenf
);
7908 SET_TexGenfv(table
, save_TexGenfv
);
7909 SET_TexGeni(table
, save_TexGeni
);
7910 SET_TexGeniv(table
, save_TexGeniv
);
7911 SET_TexImage1D(table
, save_TexImage1D
);
7912 SET_TexImage2D(table
, save_TexImage2D
);
7913 SET_TexParameterf(table
, save_TexParameterf
);
7914 SET_TexParameterfv(table
, save_TexParameterfv
);
7915 SET_TexParameteri(table
, save_TexParameteri
);
7916 SET_TexParameteriv(table
, save_TexParameteriv
);
7917 SET_Translated(table
, save_Translated
);
7918 SET_Translatef(table
, save_Translatef
);
7919 SET_Viewport(table
, save_Viewport
);
7922 SET_AreTexturesResident(table
, exec_AreTexturesResident
);
7923 SET_BindTexture(table
, save_BindTexture
);
7924 SET_ColorPointer(table
, exec_ColorPointer
);
7925 SET_CopyTexImage1D(table
, save_CopyTexImage1D
);
7926 SET_CopyTexImage2D(table
, save_CopyTexImage2D
);
7927 SET_CopyTexSubImage1D(table
, save_CopyTexSubImage1D
);
7928 SET_CopyTexSubImage2D(table
, save_CopyTexSubImage2D
);
7929 SET_DeleteTextures(table
, exec_DeleteTextures
);
7930 SET_DisableClientState(table
, exec_DisableClientState
);
7931 SET_EdgeFlagPointer(table
, exec_EdgeFlagPointer
);
7932 SET_EnableClientState(table
, exec_EnableClientState
);
7933 SET_GenTextures(table
, exec_GenTextures
);
7934 SET_GetPointerv(table
, exec_GetPointerv
);
7935 SET_IndexPointer(table
, exec_IndexPointer
);
7936 SET_InterleavedArrays(table
, exec_InterleavedArrays
);
7937 SET_IsTexture(table
, exec_IsTexture
);
7938 SET_NormalPointer(table
, exec_NormalPointer
);
7939 SET_PopClientAttrib(table
, exec_PopClientAttrib
);
7940 SET_PrioritizeTextures(table
, save_PrioritizeTextures
);
7941 SET_PushClientAttrib(table
, exec_PushClientAttrib
);
7942 SET_TexCoordPointer(table
, exec_TexCoordPointer
);
7943 SET_TexSubImage1D(table
, save_TexSubImage1D
);
7944 SET_TexSubImage2D(table
, save_TexSubImage2D
);
7945 SET_VertexPointer(table
, exec_VertexPointer
);
7948 SET_CopyTexSubImage3D(table
, save_CopyTexSubImage3D
);
7949 SET_TexImage3D(table
, save_TexImage3D
);
7950 SET_TexSubImage3D(table
, save_TexSubImage3D
);
7953 SET_StencilFuncSeparate(table
, save_StencilFuncSeparate
);
7954 SET_StencilMaskSeparate(table
, save_StencilMaskSeparate
);
7955 SET_StencilOpSeparate(table
, save_StencilOpSeparate
);
7957 /* ATI_separate_stencil */
7958 SET_StencilFuncSeparateATI(table
, save_StencilFuncSeparateATI
);
7960 /* GL_ARB_imaging */
7961 /* Not all are supported */
7962 SET_BlendColor(table
, save_BlendColor
);
7963 SET_BlendEquation(table
, save_BlendEquation
);
7964 SET_ColorSubTable(table
, save_ColorSubTable
);
7965 SET_ColorTable(table
, save_ColorTable
);
7966 SET_ColorTableParameterfv(table
, save_ColorTableParameterfv
);
7967 SET_ColorTableParameteriv(table
, save_ColorTableParameteriv
);
7968 SET_ConvolutionFilter1D(table
, save_ConvolutionFilter1D
);
7969 SET_ConvolutionFilter2D(table
, save_ConvolutionFilter2D
);
7970 SET_ConvolutionParameterf(table
, save_ConvolutionParameterf
);
7971 SET_ConvolutionParameterfv(table
, save_ConvolutionParameterfv
);
7972 SET_ConvolutionParameteri(table
, save_ConvolutionParameteri
);
7973 SET_ConvolutionParameteriv(table
, save_ConvolutionParameteriv
);
7974 SET_CopyColorSubTable(table
, save_CopyColorSubTable
);
7975 SET_CopyColorTable(table
, save_CopyColorTable
);
7976 SET_CopyConvolutionFilter1D(table
, exec_CopyConvolutionFilter1D
);
7977 SET_CopyConvolutionFilter2D(table
, exec_CopyConvolutionFilter2D
);
7978 SET_GetColorTable(table
, exec_GetColorTable
);
7979 SET_GetColorTableParameterfv(table
, exec_GetColorTableParameterfv
);
7980 SET_GetColorTableParameteriv(table
, exec_GetColorTableParameteriv
);
7981 SET_GetConvolutionFilter(table
, exec_GetConvolutionFilter
);
7982 SET_GetConvolutionParameterfv(table
, exec_GetConvolutionParameterfv
);
7983 SET_GetConvolutionParameteriv(table
, exec_GetConvolutionParameteriv
);
7984 SET_GetHistogram(table
, exec_GetHistogram
);
7985 SET_GetHistogramParameterfv(table
, exec_GetHistogramParameterfv
);
7986 SET_GetHistogramParameteriv(table
, exec_GetHistogramParameteriv
);
7987 SET_GetMinmax(table
, exec_GetMinmax
);
7988 SET_GetMinmaxParameterfv(table
, exec_GetMinmaxParameterfv
);
7989 SET_GetMinmaxParameteriv(table
, exec_GetMinmaxParameteriv
);
7990 SET_GetSeparableFilter(table
, exec_GetSeparableFilter
);
7991 SET_Histogram(table
, save_Histogram
);
7992 SET_Minmax(table
, save_Minmax
);
7993 SET_ResetHistogram(table
, save_ResetHistogram
);
7994 SET_ResetMinmax(table
, save_ResetMinmax
);
7995 SET_SeparableFilter2D(table
, exec_SeparableFilter2D
);
7997 /* 2. GL_EXT_blend_color */
7999 SET_BlendColorEXT(table
, save_BlendColorEXT
);
8002 /* 3. GL_EXT_polygon_offset */
8003 SET_PolygonOffsetEXT(table
, save_PolygonOffsetEXT
);
8005 /* 6. GL_EXT_texture3d */
8007 SET_CopyTexSubImage3DEXT(table
, save_CopyTexSubImage3D
);
8008 SET_TexImage3DEXT(table
, save_TexImage3DEXT
);
8009 SET_TexSubImage3DEXT(table
, save_TexSubImage3D
);
8012 /* 14. GL_SGI_color_table */
8014 SET_ColorTableSGI(table
, save_ColorTable
);
8015 SET_ColorSubTableSGI(table
, save_ColorSubTable
);
8016 SET_GetColorTableSGI(table
, exec_GetColorTable
);
8017 SET_GetColorTableParameterfvSGI(table
, exec_GetColorTableParameterfv
);
8018 SET_GetColorTableParameterivSGI(table
, exec_GetColorTableParameteriv
);
8021 /* 30. GL_EXT_vertex_array */
8022 SET_ColorPointerEXT(table
, exec_ColorPointerEXT
);
8023 SET_EdgeFlagPointerEXT(table
, exec_EdgeFlagPointerEXT
);
8024 SET_IndexPointerEXT(table
, exec_IndexPointerEXT
);
8025 SET_NormalPointerEXT(table
, exec_NormalPointerEXT
);
8026 SET_TexCoordPointerEXT(table
, exec_TexCoordPointerEXT
);
8027 SET_VertexPointerEXT(table
, exec_VertexPointerEXT
);
8029 /* 37. GL_EXT_blend_minmax */
8031 SET_BlendEquationEXT(table
, save_BlendEquationEXT
);
8034 /* 54. GL_EXT_point_parameters */
8035 SET_PointParameterfEXT(table
, save_PointParameterfEXT
);
8036 SET_PointParameterfvEXT(table
, save_PointParameterfvEXT
);
8038 /* 97. GL_EXT_compiled_vertex_array */
8039 SET_LockArraysEXT(table
, exec_LockArraysEXT
);
8040 SET_UnlockArraysEXT(table
, exec_UnlockArraysEXT
);
8042 /* 145. GL_EXT_secondary_color */
8043 SET_SecondaryColorPointerEXT(table
, exec_SecondaryColorPointerEXT
);
8045 /* 148. GL_EXT_multi_draw_arrays */
8046 SET_MultiDrawArraysEXT(table
, exec_MultiDrawArraysEXT
);
8047 SET_MultiDrawElementsEXT(table
, exec_MultiDrawElementsEXT
);
8049 /* 149. GL_EXT_fog_coord */
8050 SET_FogCoordPointerEXT(table
, exec_FogCoordPointerEXT
);
8052 /* 173. GL_EXT_blend_func_separate */
8053 SET_BlendFuncSeparateEXT(table
, save_BlendFuncSeparateEXT
);
8055 /* 196. GL_MESA_resize_buffers */
8056 SET_ResizeBuffersMESA(table
, _mesa_ResizeBuffersMESA
);
8058 /* 197. GL_MESA_window_pos */
8059 SET_WindowPos2dMESA(table
, save_WindowPos2dMESA
);
8060 SET_WindowPos2dvMESA(table
, save_WindowPos2dvMESA
);
8061 SET_WindowPos2fMESA(table
, save_WindowPos2fMESA
);
8062 SET_WindowPos2fvMESA(table
, save_WindowPos2fvMESA
);
8063 SET_WindowPos2iMESA(table
, save_WindowPos2iMESA
);
8064 SET_WindowPos2ivMESA(table
, save_WindowPos2ivMESA
);
8065 SET_WindowPos2sMESA(table
, save_WindowPos2sMESA
);
8066 SET_WindowPos2svMESA(table
, save_WindowPos2svMESA
);
8067 SET_WindowPos3dMESA(table
, save_WindowPos3dMESA
);
8068 SET_WindowPos3dvMESA(table
, save_WindowPos3dvMESA
);
8069 SET_WindowPos3fMESA(table
, save_WindowPos3fMESA
);
8070 SET_WindowPos3fvMESA(table
, save_WindowPos3fvMESA
);
8071 SET_WindowPos3iMESA(table
, save_WindowPos3iMESA
);
8072 SET_WindowPos3ivMESA(table
, save_WindowPos3ivMESA
);
8073 SET_WindowPos3sMESA(table
, save_WindowPos3sMESA
);
8074 SET_WindowPos3svMESA(table
, save_WindowPos3svMESA
);
8075 SET_WindowPos4dMESA(table
, save_WindowPos4dMESA
);
8076 SET_WindowPos4dvMESA(table
, save_WindowPos4dvMESA
);
8077 SET_WindowPos4fMESA(table
, save_WindowPos4fMESA
);
8078 SET_WindowPos4fvMESA(table
, save_WindowPos4fvMESA
);
8079 SET_WindowPos4iMESA(table
, save_WindowPos4iMESA
);
8080 SET_WindowPos4ivMESA(table
, save_WindowPos4ivMESA
);
8081 SET_WindowPos4sMESA(table
, save_WindowPos4sMESA
);
8082 SET_WindowPos4svMESA(table
, save_WindowPos4svMESA
);
8084 /* 200. GL_IBM_multimode_draw_arrays */
8085 SET_MultiModeDrawArraysIBM(table
, exec_MultiModeDrawArraysIBM
);
8086 SET_MultiModeDrawElementsIBM(table
, exec_MultiModeDrawElementsIBM
);
8088 #if FEATURE_NV_vertex_program
8089 /* 233. GL_NV_vertex_program */
8090 /* The following commands DO NOT go into display lists:
8091 * AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV,
8092 * VertexAttribPointerNV, GetProgram*, GetVertexAttrib*
8094 SET_BindProgramNV(table
, save_BindProgramNV
);
8095 SET_DeleteProgramsNV(table
, _mesa_DeletePrograms
);
8096 SET_ExecuteProgramNV(table
, save_ExecuteProgramNV
);
8097 SET_GenProgramsNV(table
, _mesa_GenPrograms
);
8098 SET_AreProgramsResidentNV(table
, _mesa_AreProgramsResidentNV
);
8099 SET_RequestResidentProgramsNV(table
, save_RequestResidentProgramsNV
);
8100 SET_GetProgramParameterfvNV(table
, _mesa_GetProgramParameterfvNV
);
8101 SET_GetProgramParameterdvNV(table
, _mesa_GetProgramParameterdvNV
);
8102 SET_GetProgramivNV(table
, _mesa_GetProgramivNV
);
8103 SET_GetProgramStringNV(table
, _mesa_GetProgramStringNV
);
8104 SET_GetTrackMatrixivNV(table
, _mesa_GetTrackMatrixivNV
);
8105 SET_GetVertexAttribdvNV(table
, _mesa_GetVertexAttribdvNV
);
8106 SET_GetVertexAttribfvNV(table
, _mesa_GetVertexAttribfvNV
);
8107 SET_GetVertexAttribivNV(table
, _mesa_GetVertexAttribivNV
);
8108 SET_GetVertexAttribPointervNV(table
, _mesa_GetVertexAttribPointervNV
);
8109 SET_IsProgramNV(table
, _mesa_IsProgramARB
);
8110 SET_LoadProgramNV(table
, save_LoadProgramNV
);
8111 SET_ProgramEnvParameter4dARB(table
, save_ProgramEnvParameter4dARB
);
8112 SET_ProgramEnvParameter4dvARB(table
, save_ProgramEnvParameter4dvARB
);
8113 SET_ProgramEnvParameter4fARB(table
, save_ProgramEnvParameter4fARB
);
8114 SET_ProgramEnvParameter4fvARB(table
, save_ProgramEnvParameter4fvARB
);
8115 SET_ProgramParameters4dvNV(table
, save_ProgramParameters4dvNV
);
8116 SET_ProgramParameters4fvNV(table
, save_ProgramParameters4fvNV
);
8117 SET_TrackMatrixNV(table
, save_TrackMatrixNV
);
8118 SET_VertexAttribPointerNV(table
, _mesa_VertexAttribPointerNV
);
8121 /* 244. GL_ATI_envmap_bumpmap */
8122 SET_TexBumpParameterivATI(table
, save_TexBumpParameterivATI
);
8123 SET_TexBumpParameterfvATI(table
, save_TexBumpParameterfvATI
);
8125 /* 245. GL_ATI_fragment_shader */
8126 #if FEATURE_ATI_fragment_shader
8127 SET_BindFragmentShaderATI(table
, save_BindFragmentShaderATI
);
8128 SET_SetFragmentShaderConstantATI(table
, save_SetFragmentShaderConstantATI
);
8131 /* 282. GL_NV_fragment_program */
8132 #if FEATURE_NV_fragment_program
8133 SET_ProgramNamedParameter4fNV(table
, save_ProgramNamedParameter4fNV
);
8134 SET_ProgramNamedParameter4dNV(table
, save_ProgramNamedParameter4dNV
);
8135 SET_ProgramNamedParameter4fvNV(table
, save_ProgramNamedParameter4fvNV
);
8136 SET_ProgramNamedParameter4dvNV(table
, save_ProgramNamedParameter4dvNV
);
8137 SET_GetProgramNamedParameterfvNV(table
,
8138 _mesa_GetProgramNamedParameterfvNV
);
8139 SET_GetProgramNamedParameterdvNV(table
,
8140 _mesa_GetProgramNamedParameterdvNV
);
8141 SET_ProgramLocalParameter4dARB(table
, save_ProgramLocalParameter4dARB
);
8142 SET_ProgramLocalParameter4dvARB(table
, save_ProgramLocalParameter4dvARB
);
8143 SET_ProgramLocalParameter4fARB(table
, save_ProgramLocalParameter4fARB
);
8144 SET_ProgramLocalParameter4fvARB(table
, save_ProgramLocalParameter4fvARB
);
8145 SET_GetProgramLocalParameterdvARB(table
,
8146 _mesa_GetProgramLocalParameterdvARB
);
8147 SET_GetProgramLocalParameterfvARB(table
,
8148 _mesa_GetProgramLocalParameterfvARB
);
8151 /* 262. GL_NV_point_sprite */
8152 SET_PointParameteriNV(table
, save_PointParameteriNV
);
8153 SET_PointParameterivNV(table
, save_PointParameterivNV
);
8155 /* 268. GL_EXT_stencil_two_side */
8156 SET_ActiveStencilFaceEXT(table
, save_ActiveStencilFaceEXT
);
8158 /* 273. GL_APPLE_vertex_array_object */
8159 SET_BindVertexArrayAPPLE(table
, _mesa_BindVertexArrayAPPLE
);
8160 SET_DeleteVertexArraysAPPLE(table
, _mesa_DeleteVertexArraysAPPLE
);
8161 SET_GenVertexArraysAPPLE(table
, _mesa_GenVertexArraysAPPLE
);
8162 SET_IsVertexArrayAPPLE(table
, _mesa_IsVertexArrayAPPLE
);
8164 /* ???. GL_EXT_depth_bounds_test */
8165 SET_DepthBoundsEXT(table
, save_DepthBoundsEXT
);
8167 /* ARB 1. GL_ARB_multitexture */
8168 SET_ActiveTextureARB(table
, save_ActiveTextureARB
);
8169 SET_ClientActiveTextureARB(table
, exec_ClientActiveTextureARB
);
8171 /* ARB 3. GL_ARB_transpose_matrix */
8172 SET_LoadTransposeMatrixdARB(table
, save_LoadTransposeMatrixdARB
);
8173 SET_LoadTransposeMatrixfARB(table
, save_LoadTransposeMatrixfARB
);
8174 SET_MultTransposeMatrixdARB(table
, save_MultTransposeMatrixdARB
);
8175 SET_MultTransposeMatrixfARB(table
, save_MultTransposeMatrixfARB
);
8177 /* ARB 5. GL_ARB_multisample */
8178 SET_SampleCoverageARB(table
, save_SampleCoverageARB
);
8180 /* ARB 12. GL_ARB_texture_compression */
8181 SET_CompressedTexImage3DARB(table
, save_CompressedTexImage3DARB
);
8182 SET_CompressedTexImage2DARB(table
, save_CompressedTexImage2DARB
);
8183 SET_CompressedTexImage1DARB(table
, save_CompressedTexImage1DARB
);
8184 SET_CompressedTexSubImage3DARB(table
, save_CompressedTexSubImage3DARB
);
8185 SET_CompressedTexSubImage2DARB(table
, save_CompressedTexSubImage2DARB
);
8186 SET_CompressedTexSubImage1DARB(table
, save_CompressedTexSubImage1DARB
);
8187 SET_GetCompressedTexImageARB(table
, exec_GetCompressedTexImageARB
);
8189 /* ARB 14. GL_ARB_point_parameters */
8190 /* aliased with EXT_point_parameters functions */
8192 /* ARB 25. GL_ARB_window_pos */
8193 /* aliased with MESA_window_pos functions */
8195 /* ARB 26. GL_ARB_vertex_program */
8196 /* ARB 27. GL_ARB_fragment_program */
8197 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
8198 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
8199 SET_VertexAttribPointerARB(table
, _mesa_VertexAttribPointerARB
);
8200 SET_EnableVertexAttribArrayARB(table
, _mesa_EnableVertexAttribArrayARB
);
8201 SET_DisableVertexAttribArrayARB(table
, _mesa_DisableVertexAttribArrayARB
);
8202 SET_ProgramStringARB(table
, save_ProgramStringARB
);
8203 SET_BindProgramNV(table
, save_BindProgramNV
);
8204 SET_DeleteProgramsNV(table
, _mesa_DeletePrograms
);
8205 SET_GenProgramsNV(table
, _mesa_GenPrograms
);
8206 SET_IsProgramNV(table
, _mesa_IsProgramARB
);
8207 SET_GetVertexAttribdvNV(table
, _mesa_GetVertexAttribdvNV
);
8208 SET_GetVertexAttribfvNV(table
, _mesa_GetVertexAttribfvNV
);
8209 SET_GetVertexAttribivNV(table
, _mesa_GetVertexAttribivNV
);
8210 SET_GetVertexAttribPointervNV(table
, _mesa_GetVertexAttribPointervNV
);
8211 SET_ProgramEnvParameter4dARB(table
, save_ProgramEnvParameter4dARB
);
8212 SET_ProgramEnvParameter4dvARB(table
, save_ProgramEnvParameter4dvARB
);
8213 SET_ProgramEnvParameter4fARB(table
, save_ProgramEnvParameter4fARB
);
8214 SET_ProgramEnvParameter4fvARB(table
, save_ProgramEnvParameter4fvARB
);
8215 SET_ProgramLocalParameter4dARB(table
, save_ProgramLocalParameter4dARB
);
8216 SET_ProgramLocalParameter4dvARB(table
, save_ProgramLocalParameter4dvARB
);
8217 SET_ProgramLocalParameter4fARB(table
, save_ProgramLocalParameter4fARB
);
8218 SET_ProgramLocalParameter4fvARB(table
, save_ProgramLocalParameter4fvARB
);
8219 SET_GetProgramEnvParameterdvARB(table
, _mesa_GetProgramEnvParameterdvARB
);
8220 SET_GetProgramEnvParameterfvARB(table
, _mesa_GetProgramEnvParameterfvARB
);
8221 SET_GetProgramLocalParameterdvARB(table
,
8222 _mesa_GetProgramLocalParameterdvARB
);
8223 SET_GetProgramLocalParameterfvARB(table
,
8224 _mesa_GetProgramLocalParameterfvARB
);
8225 SET_GetProgramivARB(table
, _mesa_GetProgramivARB
);
8226 SET_GetProgramStringARB(table
, _mesa_GetProgramStringARB
);
8229 /* ARB 28. GL_ARB_vertex_buffer_object */
8230 #if FEATURE_ARB_vertex_buffer_object
8231 /* None of the extension's functions get compiled */
8232 SET_BindBufferARB(table
, _mesa_BindBufferARB
);
8233 SET_BufferDataARB(table
, _mesa_BufferDataARB
);
8234 SET_BufferSubDataARB(table
, _mesa_BufferSubDataARB
);
8235 SET_DeleteBuffersARB(table
, _mesa_DeleteBuffersARB
);
8236 SET_GenBuffersARB(table
, _mesa_GenBuffersARB
);
8237 SET_GetBufferParameterivARB(table
, _mesa_GetBufferParameterivARB
);
8238 SET_GetBufferPointervARB(table
, _mesa_GetBufferPointervARB
);
8239 SET_GetBufferSubDataARB(table
, _mesa_GetBufferSubDataARB
);
8240 SET_IsBufferARB(table
, _mesa_IsBufferARB
);
8241 SET_MapBufferARB(table
, _mesa_MapBufferARB
);
8242 SET_UnmapBufferARB(table
, _mesa_UnmapBufferARB
);
8245 #if FEATURE_ARB_occlusion_query
8246 SET_BeginQueryARB(table
, save_BeginQueryARB
);
8247 SET_EndQueryARB(table
, save_EndQueryARB
);
8248 SET_GenQueriesARB(table
, _mesa_GenQueriesARB
);
8249 SET_DeleteQueriesARB(table
, _mesa_DeleteQueriesARB
);
8250 SET_IsQueryARB(table
, _mesa_IsQueryARB
);
8251 SET_GetQueryivARB(table
, _mesa_GetQueryivARB
);
8252 SET_GetQueryObjectivARB(table
, _mesa_GetQueryObjectivARB
);
8253 SET_GetQueryObjectuivARB(table
, _mesa_GetQueryObjectuivARB
);
8255 SET_DrawBuffersARB(table
, save_DrawBuffersARB
);
8257 #if FEATURE_EXT_framebuffer_blit
8258 SET_BlitFramebufferEXT(table
, save_BlitFramebufferEXT
);
8261 /* ARB 30/31/32. GL_ARB_shader_objects, GL_ARB_vertex/fragment_shader */
8262 SET_BindAttribLocationARB(table
, exec_BindAttribLocationARB
);
8263 SET_GetAttribLocationARB(table
, exec_GetAttribLocationARB
);
8264 /* XXX additional functions need to be implemented here! */
8266 /* 299. GL_EXT_blend_equation_separate */
8267 SET_BlendEquationSeparateEXT(table
, save_BlendEquationSeparateEXT
);
8269 /* GL_EXT_gpu_program_parmaeters */
8270 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
8271 SET_ProgramEnvParameters4fvEXT(table
, save_ProgramEnvParameters4fvEXT
);
8272 SET_ProgramLocalParameters4fvEXT(table
, save_ProgramLocalParameters4fvEXT
);
8279 enum_string(GLenum k
)
8281 return _mesa_lookup_enum_by_nr(k
);
8286 * Print the commands in a display list. For debugging only.
8287 * TODO: many commands aren't handled yet.
8289 static void GLAPIENTRY
8290 print_list(GLcontext
*ctx
, GLuint list
)
8292 struct gl_display_list
*dlist
;
8296 if (!islist(ctx
, list
)) {
8297 _mesa_printf("%u is not a display list ID\n", list
);
8301 dlist
= lookup_list(ctx
, list
);
8307 _mesa_printf("START-LIST %u, address %p\n", list
, (void *) n
);
8309 done
= n
? GL_FALSE
: GL_TRUE
;
8311 OpCode opcode
= n
[0].opcode
;
8312 GLint i
= (GLint
) n
[0].opcode
- (GLint
) OPCODE_EXT_0
;
8314 if (i
>= 0 && i
< (GLint
) ctx
->ListExt
.NumOpcodes
) {
8315 /* this is a driver-extended opcode */
8316 ctx
->ListExt
.Opcode
[i
].Print(ctx
, &n
[1]);
8317 n
+= ctx
->ListExt
.Opcode
[i
].Size
;
8322 _mesa_printf("Accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
8325 _mesa_printf("Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
8326 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
, (void *) n
[7].data
);
8328 case OPCODE_CALL_LIST
:
8329 _mesa_printf("CallList %d\n", (int) n
[1].ui
);
8331 case OPCODE_CALL_LIST_OFFSET
:
8332 _mesa_printf("CallList %d + offset %u = %u\n", (int) n
[1].ui
,
8333 ctx
->List
.ListBase
, ctx
->List
.ListBase
+ n
[1].ui
);
8335 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
8336 _mesa_printf("ColorTableParameterfv %s %s %f %f %f %f\n",
8337 enum_string(n
[1].e
), enum_string(n
[2].e
),
8338 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8340 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
8341 _mesa_printf("ColorTableParameteriv %s %s %d %d %d %d\n",
8342 enum_string(n
[1].e
), enum_string(n
[2].e
),
8343 n
[3].i
, n
[4].i
, n
[5].i
, n
[6].i
);
8345 case OPCODE_DISABLE
:
8346 _mesa_printf("Disable %s\n", enum_string(n
[1].e
));
8349 _mesa_printf("Enable %s\n", enum_string(n
[1].e
));
8351 case OPCODE_FRUSTUM
:
8352 _mesa_printf("Frustum %g %g %g %g %g %g\n",
8353 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8355 case OPCODE_LINE_STIPPLE
:
8356 _mesa_printf("LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
8358 case OPCODE_LOAD_IDENTITY
:
8359 _mesa_printf("LoadIdentity\n");
8361 case OPCODE_LOAD_MATRIX
:
8362 _mesa_printf("LoadMatrix\n");
8363 _mesa_printf(" %8f %8f %8f %8f\n",
8364 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
8365 _mesa_printf(" %8f %8f %8f %8f\n",
8366 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
8367 _mesa_printf(" %8f %8f %8f %8f\n",
8368 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
8369 _mesa_printf(" %8f %8f %8f %8f\n",
8370 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
8372 case OPCODE_MULT_MATRIX
:
8373 _mesa_printf("MultMatrix (or Rotate)\n");
8374 _mesa_printf(" %8f %8f %8f %8f\n",
8375 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
8376 _mesa_printf(" %8f %8f %8f %8f\n",
8377 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
8378 _mesa_printf(" %8f %8f %8f %8f\n",
8379 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
8380 _mesa_printf(" %8f %8f %8f %8f\n",
8381 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
8384 _mesa_printf("Ortho %g %g %g %g %g %g\n",
8385 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8387 case OPCODE_POP_ATTRIB
:
8388 _mesa_printf("PopAttrib\n");
8390 case OPCODE_POP_MATRIX
:
8391 _mesa_printf("PopMatrix\n");
8393 case OPCODE_POP_NAME
:
8394 _mesa_printf("PopName\n");
8396 case OPCODE_PUSH_ATTRIB
:
8397 _mesa_printf("PushAttrib %x\n", n
[1].bf
);
8399 case OPCODE_PUSH_MATRIX
:
8400 _mesa_printf("PushMatrix\n");
8402 case OPCODE_PUSH_NAME
:
8403 _mesa_printf("PushName %d\n", (int) n
[1].ui
);
8405 case OPCODE_RASTER_POS
:
8406 _mesa_printf("RasterPos %g %g %g %g\n",
8407 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
8410 _mesa_printf("Rotate %g %g %g %g\n",
8411 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
8414 _mesa_printf("Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
8416 case OPCODE_TRANSLATE
:
8417 _mesa_printf("Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
8419 case OPCODE_BIND_TEXTURE
:
8420 _mesa_printf("BindTexture %s %d\n",
8421 _mesa_lookup_enum_by_nr(n
[1].ui
), n
[2].ui
);
8423 case OPCODE_SHADE_MODEL
:
8424 _mesa_printf("ShadeModel %s\n", _mesa_lookup_enum_by_nr(n
[1].ui
));
8427 _mesa_printf("Map1 %s %.3f %.3f %d %d\n",
8428 _mesa_lookup_enum_by_nr(n
[1].ui
),
8429 n
[2].f
, n
[3].f
, n
[4].i
, n
[5].i
);
8432 _mesa_printf("Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
8433 _mesa_lookup_enum_by_nr(n
[1].ui
),
8434 n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
,
8435 n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
8437 case OPCODE_MAPGRID1
:
8438 _mesa_printf("MapGrid1 %d %.3f %.3f\n", n
[1].i
, n
[2].f
, n
[3].f
);
8440 case OPCODE_MAPGRID2
:
8441 _mesa_printf("MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
8442 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
8444 case OPCODE_EVALMESH1
:
8445 _mesa_printf("EvalMesh1 %d %d\n", n
[1].i
, n
[2].i
);
8447 case OPCODE_EVALMESH2
:
8448 _mesa_printf("EvalMesh2 %d %d %d %d\n",
8449 n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
8452 case OPCODE_ATTR_1F_NV
:
8453 _mesa_printf("ATTR_1F_NV attr %d: %f\n", n
[1].i
, n
[2].f
);
8455 case OPCODE_ATTR_2F_NV
:
8456 _mesa_printf("ATTR_2F_NV attr %d: %f %f\n",
8457 n
[1].i
, n
[2].f
, n
[3].f
);
8459 case OPCODE_ATTR_3F_NV
:
8460 _mesa_printf("ATTR_3F_NV attr %d: %f %f %f\n",
8461 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
8463 case OPCODE_ATTR_4F_NV
:
8464 _mesa_printf("ATTR_4F_NV attr %d: %f %f %f %f\n",
8465 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
8467 case OPCODE_ATTR_1F_ARB
:
8468 _mesa_printf("ATTR_1F_ARB attr %d: %f\n", n
[1].i
, n
[2].f
);
8470 case OPCODE_ATTR_2F_ARB
:
8471 _mesa_printf("ATTR_2F_ARB attr %d: %f %f\n",
8472 n
[1].i
, n
[2].f
, n
[3].f
);
8474 case OPCODE_ATTR_3F_ARB
:
8475 _mesa_printf("ATTR_3F_ARB attr %d: %f %f %f\n",
8476 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
8478 case OPCODE_ATTR_4F_ARB
:
8479 _mesa_printf("ATTR_4F_ARB attr %d: %f %f %f %f\n",
8480 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
8483 case OPCODE_MATERIAL
:
8484 _mesa_printf("MATERIAL %x %x: %f %f %f %f\n",
8485 n
[1].i
, n
[2].i
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8488 _mesa_printf("BEGIN %x\n", n
[1].i
);
8491 _mesa_printf("END\n");
8494 _mesa_printf("RECTF %f %f %f %f\n", n
[1].f
, n
[2].f
, n
[3].f
,
8497 case OPCODE_EVAL_C1
:
8498 _mesa_printf("EVAL_C1 %f\n", n
[1].f
);
8500 case OPCODE_EVAL_C2
:
8501 _mesa_printf("EVAL_C2 %f %f\n", n
[1].f
, n
[2].f
);
8503 case OPCODE_EVAL_P1
:
8504 _mesa_printf("EVAL_P1 %d\n", n
[1].i
);
8506 case OPCODE_EVAL_P2
:
8507 _mesa_printf("EVAL_P2 %d %d\n", n
[1].i
, n
[2].i
);
8511 * meta opcodes/commands
8514 _mesa_printf("Error: %s %s\n",
8515 enum_string(n
[1].e
), (const char *) n
[2].data
);
8517 case OPCODE_CONTINUE
:
8518 _mesa_printf("DISPLAY-LIST-CONTINUE\n");
8519 n
= (Node
*) n
[1].next
;
8521 case OPCODE_END_OF_LIST
:
8522 _mesa_printf("END-LIST %u\n", list
);
8526 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
8528 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
8529 opcode
, (void *) n
);
8533 _mesa_printf("command %d, %u operands\n", opcode
,
8537 /* increment n to point to next compiled command */
8538 if (opcode
!= OPCODE_CONTINUE
) {
8539 n
+= InstSize
[opcode
];
8548 * Clients may call this function to help debug display list problems.
8549 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
8550 * changed, or break in the future without notice.
8553 mesa_print_display_list(GLuint list
)
8555 GET_CURRENT_CONTEXT(ctx
);
8556 print_list(ctx
, list
);
8560 /**********************************************************************/
8561 /***** Initialization *****/
8562 /**********************************************************************/
8565 _mesa_save_vtxfmt_init(GLvertexformat
* vfmt
)
8567 vfmt
->ArrayElement
= _ae_loopback_array_elt
; /* generic helper */
8568 vfmt
->Begin
= save_Begin
;
8569 vfmt
->CallList
= _mesa_save_CallList
;
8570 vfmt
->CallLists
= _mesa_save_CallLists
;
8571 vfmt
->Color3f
= save_Color3f
;
8572 vfmt
->Color3fv
= save_Color3fv
;
8573 vfmt
->Color4f
= save_Color4f
;
8574 vfmt
->Color4fv
= save_Color4fv
;
8575 vfmt
->EdgeFlag
= save_EdgeFlag
;
8576 vfmt
->End
= save_End
;
8577 vfmt
->EvalCoord1f
= save_EvalCoord1f
;
8578 vfmt
->EvalCoord1fv
= save_EvalCoord1fv
;
8579 vfmt
->EvalCoord2f
= save_EvalCoord2f
;
8580 vfmt
->EvalCoord2fv
= save_EvalCoord2fv
;
8581 vfmt
->EvalPoint1
= save_EvalPoint1
;
8582 vfmt
->EvalPoint2
= save_EvalPoint2
;
8583 vfmt
->FogCoordfEXT
= save_FogCoordfEXT
;
8584 vfmt
->FogCoordfvEXT
= save_FogCoordfvEXT
;
8585 vfmt
->Indexf
= save_Indexf
;
8586 vfmt
->Indexfv
= save_Indexfv
;
8587 vfmt
->Materialfv
= save_Materialfv
;
8588 vfmt
->MultiTexCoord1fARB
= save_MultiTexCoord1f
;
8589 vfmt
->MultiTexCoord1fvARB
= save_MultiTexCoord1fv
;
8590 vfmt
->MultiTexCoord2fARB
= save_MultiTexCoord2f
;
8591 vfmt
->MultiTexCoord2fvARB
= save_MultiTexCoord2fv
;
8592 vfmt
->MultiTexCoord3fARB
= save_MultiTexCoord3f
;
8593 vfmt
->MultiTexCoord3fvARB
= save_MultiTexCoord3fv
;
8594 vfmt
->MultiTexCoord4fARB
= save_MultiTexCoord4f
;
8595 vfmt
->MultiTexCoord4fvARB
= save_MultiTexCoord4fv
;
8596 vfmt
->Normal3f
= save_Normal3f
;
8597 vfmt
->Normal3fv
= save_Normal3fv
;
8598 vfmt
->SecondaryColor3fEXT
= save_SecondaryColor3fEXT
;
8599 vfmt
->SecondaryColor3fvEXT
= save_SecondaryColor3fvEXT
;
8600 vfmt
->TexCoord1f
= save_TexCoord1f
;
8601 vfmt
->TexCoord1fv
= save_TexCoord1fv
;
8602 vfmt
->TexCoord2f
= save_TexCoord2f
;
8603 vfmt
->TexCoord2fv
= save_TexCoord2fv
;
8604 vfmt
->TexCoord3f
= save_TexCoord3f
;
8605 vfmt
->TexCoord3fv
= save_TexCoord3fv
;
8606 vfmt
->TexCoord4f
= save_TexCoord4f
;
8607 vfmt
->TexCoord4fv
= save_TexCoord4fv
;
8608 vfmt
->Vertex2f
= save_Vertex2f
;
8609 vfmt
->Vertex2fv
= save_Vertex2fv
;
8610 vfmt
->Vertex3f
= save_Vertex3f
;
8611 vfmt
->Vertex3fv
= save_Vertex3fv
;
8612 vfmt
->Vertex4f
= save_Vertex4f
;
8613 vfmt
->Vertex4fv
= save_Vertex4fv
;
8614 vfmt
->VertexAttrib1fNV
= save_VertexAttrib1fNV
;
8615 vfmt
->VertexAttrib1fvNV
= save_VertexAttrib1fvNV
;
8616 vfmt
->VertexAttrib2fNV
= save_VertexAttrib2fNV
;
8617 vfmt
->VertexAttrib2fvNV
= save_VertexAttrib2fvNV
;
8618 vfmt
->VertexAttrib3fNV
= save_VertexAttrib3fNV
;
8619 vfmt
->VertexAttrib3fvNV
= save_VertexAttrib3fvNV
;
8620 vfmt
->VertexAttrib4fNV
= save_VertexAttrib4fNV
;
8621 vfmt
->VertexAttrib4fvNV
= save_VertexAttrib4fvNV
;
8622 vfmt
->VertexAttrib1fARB
= save_VertexAttrib1fARB
;
8623 vfmt
->VertexAttrib1fvARB
= save_VertexAttrib1fvARB
;
8624 vfmt
->VertexAttrib2fARB
= save_VertexAttrib2fARB
;
8625 vfmt
->VertexAttrib2fvARB
= save_VertexAttrib2fvARB
;
8626 vfmt
->VertexAttrib3fARB
= save_VertexAttrib3fARB
;
8627 vfmt
->VertexAttrib3fvARB
= save_VertexAttrib3fvARB
;
8628 vfmt
->VertexAttrib4fARB
= save_VertexAttrib4fARB
;
8629 vfmt
->VertexAttrib4fvARB
= save_VertexAttrib4fvARB
;
8631 vfmt
->EvalMesh1
= _mesa_save_EvalMesh1
;
8632 vfmt
->EvalMesh2
= _mesa_save_EvalMesh2
;
8633 vfmt
->Rectf
= save_Rectf
;
8635 /* The driver is required to implement these as
8636 * 1) They can probably do a better job.
8637 * 2) A lot of new mechanisms would have to be added to this module
8638 * to support it. That code would probably never get used,
8642 vfmt
->DrawArrays
= 0;
8643 vfmt
->DrawElements
= 0;
8644 vfmt
->DrawRangeElements
= 0;
8650 * Initialize display list state for given context.
8653 _mesa_init_display_list(GLcontext
*ctx
)
8655 static GLboolean tableInitialized
= GL_FALSE
;
8657 /* zero-out the instruction size table, just once */
8658 if (!tableInitialized
) {
8659 _mesa_bzero(InstSize
, sizeof(InstSize
));
8660 tableInitialized
= GL_TRUE
;
8664 ctx
->ListState
.CallDepth
= 0;
8665 ctx
->ExecuteFlag
= GL_TRUE
;
8666 ctx
->CompileFlag
= GL_FALSE
;
8667 ctx
->ListState
.CurrentBlock
= NULL
;
8668 ctx
->ListState
.CurrentPos
= 0;
8670 /* Display List group */
8671 ctx
->List
.ListBase
= 0;
8673 _mesa_save_vtxfmt_init(&ctx
->ListState
.ListVtxfmt
);