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 * \todo This won't suffice when the PBO is really in VRAM/GPU memory.
686 unpack_image(GLuint dimensions
, GLsizei width
, GLsizei height
, GLsizei depth
,
687 GLenum format
, GLenum type
, const GLvoid
* pixels
,
688 const struct gl_pixelstore_attrib
*unpack
)
690 if (unpack
->BufferObj
->Name
== 0) {
692 return _mesa_unpack_image(dimensions
, width
, height
, depth
, format
,
693 type
, pixels
, unpack
);
696 if (_mesa_validate_pbo_access
697 (dimensions
, unpack
, width
, height
, depth
, format
, type
, pixels
)) {
698 const GLubyte
*src
= ADD_POINTERS(unpack
->BufferObj
->Data
, pixels
);
699 return _mesa_unpack_image(dimensions
, width
, height
, depth
, format
,
708 * Allocate space for a display list instruction.
709 * \param opcode the instruction opcode (OPCODE_* value)
710 * \param bytes instruction size in bytes, not counting opcode.
711 * \return pointer to the usable data area (not including the internal
715 _mesa_alloc_instruction(GLcontext
*ctx
, GLuint opcode
, GLuint bytes
)
717 const GLuint numNodes
= 1 + (bytes
+ sizeof(Node
) - 1) / sizeof(Node
);
720 if (opcode
< (GLuint
) OPCODE_EXT_0
) {
721 if (InstSize
[opcode
] == 0) {
722 /* save instruction size now */
723 InstSize
[opcode
] = numNodes
;
726 /* make sure instruction size agrees */
727 ASSERT(numNodes
== InstSize
[opcode
]);
731 if (ctx
->ListState
.CurrentPos
+ numNodes
+ 2 > BLOCK_SIZE
) {
732 /* This block is full. Allocate a new block and chain to it */
734 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
735 n
[0].opcode
= OPCODE_CONTINUE
;
736 newblock
= (Node
*) _mesa_malloc(sizeof(Node
) * BLOCK_SIZE
);
738 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "Building display list");
741 n
[1].next
= (Node
*) newblock
;
742 ctx
->ListState
.CurrentBlock
= newblock
;
743 ctx
->ListState
.CurrentPos
= 0;
746 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
747 ctx
->ListState
.CurrentPos
+= numNodes
;
749 n
[0].opcode
= (OpCode
) opcode
;
751 return (void *) (n
+ 1); /* return ptr to node following opcode */
756 * This function allows modules and drivers to get their own opcodes
757 * for extending display list functionality.
758 * \param ctx the rendering context
759 * \param size number of bytes for storing the new display list command
760 * \param execute function to execute the new display list command
761 * \param destroy function to destroy the new display list command
762 * \param print function to print the new display list command
763 * \return the new opcode number or -1 if error
766 _mesa_alloc_opcode(GLcontext
*ctx
,
768 void (*execute
) (GLcontext
*, void *),
769 void (*destroy
) (GLcontext
*, void *),
770 void (*print
) (GLcontext
*, void *))
772 if (ctx
->ListExt
.NumOpcodes
< MAX_DLIST_EXT_OPCODES
) {
773 const GLuint i
= ctx
->ListExt
.NumOpcodes
++;
774 ctx
->ListExt
.Opcode
[i
].Size
=
775 1 + (size
+ sizeof(Node
) - 1) / sizeof(Node
);
776 ctx
->ListExt
.Opcode
[i
].Execute
= execute
;
777 ctx
->ListExt
.Opcode
[i
].Destroy
= destroy
;
778 ctx
->ListExt
.Opcode
[i
].Print
= print
;
779 return i
+ OPCODE_EXT_0
;
787 * Allocate display list instruction. Returns Node ptr to where the opcode
789 * - nParams is the number of function parameters
790 * - return value a pointer to sizeof(Node) before the actual
793 #define ALLOC_INSTRUCTION(CTX, OPCODE, NPARAMS) \
794 ((Node *)_mesa_alloc_instruction(CTX, OPCODE, (NPARAMS)*sizeof(Node)) - 1)
799 * Display List compilation functions
801 static void GLAPIENTRY
802 save_Accum(GLenum op
, GLfloat value
)
804 GET_CURRENT_CONTEXT(ctx
);
806 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
807 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ACCUM
, 2);
812 if (ctx
->ExecuteFlag
) {
813 CALL_Accum(ctx
->Exec
, (op
, value
));
818 static void GLAPIENTRY
819 save_AlphaFunc(GLenum func
, GLclampf ref
)
821 GET_CURRENT_CONTEXT(ctx
);
823 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
824 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ALPHA_FUNC
, 2);
827 n
[2].f
= (GLfloat
) ref
;
829 if (ctx
->ExecuteFlag
) {
830 CALL_AlphaFunc(ctx
->Exec
, (func
, ref
));
835 static void GLAPIENTRY
836 save_BindTexture(GLenum target
, GLuint texture
)
838 GET_CURRENT_CONTEXT(ctx
);
840 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
841 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BIND_TEXTURE
, 2);
846 if (ctx
->ExecuteFlag
) {
847 CALL_BindTexture(ctx
->Exec
, (target
, texture
));
852 static void GLAPIENTRY
853 save_Bitmap(GLsizei width
, GLsizei height
,
854 GLfloat xorig
, GLfloat yorig
,
855 GLfloat xmove
, GLfloat ymove
, const GLubyte
* pixels
)
857 GET_CURRENT_CONTEXT(ctx
);
858 GLvoid
*image
= _mesa_unpack_bitmap(width
, height
, pixels
, &ctx
->Unpack
);
860 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
861 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BITMAP
, 7);
863 n
[1].i
= (GLint
) width
;
864 n
[2].i
= (GLint
) height
;
874 if (ctx
->ExecuteFlag
) {
875 CALL_Bitmap(ctx
->Exec
, (width
, height
,
876 xorig
, yorig
, xmove
, ymove
, pixels
));
881 static void GLAPIENTRY
882 save_BlendEquation(GLenum mode
)
884 GET_CURRENT_CONTEXT(ctx
);
886 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
887 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BLEND_EQUATION
, 1);
891 if (ctx
->ExecuteFlag
) {
892 CALL_BlendEquation(ctx
->Exec
, (mode
));
897 static void GLAPIENTRY
898 save_BlendEquationSeparateEXT(GLenum modeRGB
, GLenum modeA
)
900 GET_CURRENT_CONTEXT(ctx
);
902 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
903 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BLEND_EQUATION_SEPARATE
, 2);
908 if (ctx
->ExecuteFlag
) {
909 CALL_BlendEquationSeparateEXT(ctx
->Exec
, (modeRGB
, modeA
));
914 static void GLAPIENTRY
915 save_BlendFuncSeparateEXT(GLenum sfactorRGB
, GLenum dfactorRGB
,
916 GLenum sfactorA
, GLenum dfactorA
)
918 GET_CURRENT_CONTEXT(ctx
);
920 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
921 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BLEND_FUNC_SEPARATE
, 4);
928 if (ctx
->ExecuteFlag
) {
929 CALL_BlendFuncSeparateEXT(ctx
->Exec
,
930 (sfactorRGB
, dfactorRGB
, sfactorA
, dfactorA
));
935 static void GLAPIENTRY
936 save_BlendFunc(GLenum srcfactor
, GLenum dstfactor
)
938 save_BlendFuncSeparateEXT(srcfactor
, dstfactor
, srcfactor
, dstfactor
);
942 static void GLAPIENTRY
943 save_BlendColor(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
945 GET_CURRENT_CONTEXT(ctx
);
947 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
948 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BLEND_COLOR
, 4);
955 if (ctx
->ExecuteFlag
) {
956 CALL_BlendColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
962 _mesa_save_CallList(GLuint list
)
964 GET_CURRENT_CONTEXT(ctx
);
966 SAVE_FLUSH_VERTICES(ctx
);
968 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CALL_LIST
, 1);
973 /* After this, we don't know what begin/end state we're in:
975 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
977 if (ctx
->ExecuteFlag
) {
978 _mesa_CallList(list
);
984 _mesa_save_CallLists(GLsizei n
, GLenum type
, const GLvoid
* lists
)
986 GET_CURRENT_CONTEXT(ctx
);
988 GLboolean typeErrorFlag
;
990 SAVE_FLUSH_VERTICES(ctx
);
994 case GL_UNSIGNED_BYTE
:
996 case GL_UNSIGNED_SHORT
:
998 case GL_UNSIGNED_INT
:
1003 typeErrorFlag
= GL_FALSE
;
1006 typeErrorFlag
= GL_TRUE
;
1009 for (i
= 0; i
< n
; i
++) {
1010 GLint list
= translate_id(i
, type
, lists
);
1011 Node
*n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CALL_LIST_OFFSET
, 2);
1014 n
[2].b
= typeErrorFlag
;
1018 /* After this, we don't know what begin/end state we're in:
1020 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
1022 if (ctx
->ExecuteFlag
) {
1023 CALL_CallLists(ctx
->Exec
, (n
, type
, lists
));
1028 static void GLAPIENTRY
1029 save_Clear(GLbitfield mask
)
1031 GET_CURRENT_CONTEXT(ctx
);
1033 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1034 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLEAR
, 1);
1038 if (ctx
->ExecuteFlag
) {
1039 CALL_Clear(ctx
->Exec
, (mask
));
1044 static void GLAPIENTRY
1045 save_ClearAccum(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
1047 GET_CURRENT_CONTEXT(ctx
);
1049 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1050 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLEAR_ACCUM
, 4);
1057 if (ctx
->ExecuteFlag
) {
1058 CALL_ClearAccum(ctx
->Exec
, (red
, green
, blue
, alpha
));
1063 static void GLAPIENTRY
1064 save_ClearColor(GLclampf red
, GLclampf green
, GLclampf blue
, GLclampf alpha
)
1066 GET_CURRENT_CONTEXT(ctx
);
1068 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1069 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLEAR_COLOR
, 4);
1076 if (ctx
->ExecuteFlag
) {
1077 CALL_ClearColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
1082 static void GLAPIENTRY
1083 save_ClearDepth(GLclampd depth
)
1085 GET_CURRENT_CONTEXT(ctx
);
1087 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1088 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLEAR_DEPTH
, 1);
1090 n
[1].f
= (GLfloat
) depth
;
1092 if (ctx
->ExecuteFlag
) {
1093 CALL_ClearDepth(ctx
->Exec
, (depth
));
1098 static void GLAPIENTRY
1099 save_ClearIndex(GLfloat c
)
1101 GET_CURRENT_CONTEXT(ctx
);
1103 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1104 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLEAR_INDEX
, 1);
1108 if (ctx
->ExecuteFlag
) {
1109 CALL_ClearIndex(ctx
->Exec
, (c
));
1114 static void GLAPIENTRY
1115 save_ClearStencil(GLint s
)
1117 GET_CURRENT_CONTEXT(ctx
);
1119 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1120 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLEAR_STENCIL
, 1);
1124 if (ctx
->ExecuteFlag
) {
1125 CALL_ClearStencil(ctx
->Exec
, (s
));
1130 static void GLAPIENTRY
1131 save_ClipPlane(GLenum plane
, const GLdouble
* equ
)
1133 GET_CURRENT_CONTEXT(ctx
);
1135 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1136 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLIP_PLANE
, 5);
1139 n
[2].f
= (GLfloat
) equ
[0];
1140 n
[3].f
= (GLfloat
) equ
[1];
1141 n
[4].f
= (GLfloat
) equ
[2];
1142 n
[5].f
= (GLfloat
) equ
[3];
1144 if (ctx
->ExecuteFlag
) {
1145 CALL_ClipPlane(ctx
->Exec
, (plane
, equ
));
1151 static void GLAPIENTRY
1152 save_ColorMask(GLboolean red
, GLboolean green
,
1153 GLboolean blue
, GLboolean alpha
)
1155 GET_CURRENT_CONTEXT(ctx
);
1157 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1158 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COLOR_MASK
, 4);
1165 if (ctx
->ExecuteFlag
) {
1166 CALL_ColorMask(ctx
->Exec
, (red
, green
, blue
, alpha
));
1171 static void GLAPIENTRY
1172 save_ColorMaterial(GLenum face
, GLenum mode
)
1174 GET_CURRENT_CONTEXT(ctx
);
1176 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1178 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COLOR_MATERIAL
, 2);
1183 if (ctx
->ExecuteFlag
) {
1184 CALL_ColorMaterial(ctx
->Exec
, (face
, mode
));
1189 static void GLAPIENTRY
1190 save_ColorTable(GLenum target
, GLenum internalFormat
,
1191 GLsizei width
, GLenum format
, GLenum type
,
1192 const GLvoid
* table
)
1194 GET_CURRENT_CONTEXT(ctx
);
1195 if (_mesa_is_proxy_texture(target
)) {
1196 /* execute immediately */
1197 CALL_ColorTable(ctx
->Exec
, (target
, internalFormat
, width
,
1198 format
, type
, table
));
1201 GLvoid
*image
= unpack_image(1, width
, 1, 1, format
, type
, table
,
1204 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1205 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COLOR_TABLE
, 6);
1208 n
[2].e
= internalFormat
;
1217 if (ctx
->ExecuteFlag
) {
1218 CALL_ColorTable(ctx
->Exec
, (target
, internalFormat
, width
,
1219 format
, type
, table
));
1226 static void GLAPIENTRY
1227 save_ColorTableParameterfv(GLenum target
, GLenum pname
,
1228 const GLfloat
*params
)
1230 GET_CURRENT_CONTEXT(ctx
);
1233 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1235 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COLOR_TABLE_PARAMETER_FV
, 6);
1240 if (pname
== GL_COLOR_TABLE_SGI
||
1241 pname
== GL_POST_CONVOLUTION_COLOR_TABLE_SGI
||
1242 pname
== GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI
||
1243 pname
== GL_TEXTURE_COLOR_TABLE_SGI
) {
1250 if (ctx
->ExecuteFlag
) {
1251 CALL_ColorTableParameterfv(ctx
->Exec
, (target
, pname
, params
));
1256 static void GLAPIENTRY
1257 save_ColorTableParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
1259 GET_CURRENT_CONTEXT(ctx
);
1262 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1264 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COLOR_TABLE_PARAMETER_IV
, 6);
1269 if (pname
== GL_COLOR_TABLE_SGI
||
1270 pname
== GL_POST_CONVOLUTION_COLOR_TABLE_SGI
||
1271 pname
== GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI
||
1272 pname
== GL_TEXTURE_COLOR_TABLE_SGI
) {
1279 if (ctx
->ExecuteFlag
) {
1280 CALL_ColorTableParameteriv(ctx
->Exec
, (target
, pname
, params
));
1286 static void GLAPIENTRY
1287 save_ColorSubTable(GLenum target
, GLsizei start
, GLsizei count
,
1288 GLenum format
, GLenum type
, const GLvoid
* table
)
1290 GET_CURRENT_CONTEXT(ctx
);
1291 GLvoid
*image
= unpack_image(1, count
, 1, 1, format
, type
, table
,
1294 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1295 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COLOR_SUB_TABLE
, 6);
1307 if (ctx
->ExecuteFlag
) {
1308 CALL_ColorSubTable(ctx
->Exec
,
1309 (target
, start
, count
, format
, type
, table
));
1314 static void GLAPIENTRY
1315 save_CopyColorSubTable(GLenum target
, GLsizei start
,
1316 GLint x
, GLint y
, GLsizei width
)
1318 GET_CURRENT_CONTEXT(ctx
);
1321 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1322 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_COLOR_SUB_TABLE
, 5);
1330 if (ctx
->ExecuteFlag
) {
1331 CALL_CopyColorSubTable(ctx
->Exec
, (target
, start
, x
, y
, width
));
1336 static void GLAPIENTRY
1337 save_CopyColorTable(GLenum target
, GLenum internalformat
,
1338 GLint x
, GLint y
, GLsizei width
)
1340 GET_CURRENT_CONTEXT(ctx
);
1343 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1344 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_COLOR_TABLE
, 5);
1347 n
[2].e
= internalformat
;
1352 if (ctx
->ExecuteFlag
) {
1353 CALL_CopyColorTable(ctx
->Exec
, (target
, internalformat
, x
, y
, width
));
1358 static void GLAPIENTRY
1359 save_ConvolutionFilter1D(GLenum target
, GLenum internalFormat
, GLsizei width
,
1360 GLenum format
, GLenum type
, const GLvoid
* filter
)
1362 GET_CURRENT_CONTEXT(ctx
);
1363 GLvoid
*image
= unpack_image(1, width
, 1, 1, format
, type
, filter
,
1366 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1367 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CONVOLUTION_FILTER_1D
, 6);
1370 n
[2].e
= internalFormat
;
1379 if (ctx
->ExecuteFlag
) {
1380 CALL_ConvolutionFilter1D(ctx
->Exec
, (target
, internalFormat
, width
,
1381 format
, type
, filter
));
1386 static void GLAPIENTRY
1387 save_ConvolutionFilter2D(GLenum target
, GLenum internalFormat
,
1388 GLsizei width
, GLsizei height
, GLenum format
,
1389 GLenum type
, const GLvoid
* filter
)
1391 GET_CURRENT_CONTEXT(ctx
);
1392 GLvoid
*image
= unpack_image(2, width
, height
, 1, format
, type
, filter
,
1395 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1396 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CONVOLUTION_FILTER_2D
, 7);
1399 n
[2].e
= internalFormat
;
1409 if (ctx
->ExecuteFlag
) {
1410 CALL_ConvolutionFilter2D(ctx
->Exec
,
1411 (target
, internalFormat
, width
, height
, format
,
1417 static void GLAPIENTRY
1418 save_ConvolutionParameteri(GLenum target
, GLenum pname
, GLint param
)
1420 GET_CURRENT_CONTEXT(ctx
);
1422 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1423 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CONVOLUTION_PARAMETER_I
, 3);
1429 if (ctx
->ExecuteFlag
) {
1430 CALL_ConvolutionParameteri(ctx
->Exec
, (target
, pname
, param
));
1435 static void GLAPIENTRY
1436 save_ConvolutionParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
1438 GET_CURRENT_CONTEXT(ctx
);
1440 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1441 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CONVOLUTION_PARAMETER_IV
, 6);
1446 if (pname
== GL_CONVOLUTION_BORDER_COLOR
||
1447 pname
== GL_CONVOLUTION_FILTER_SCALE
||
1448 pname
== GL_CONVOLUTION_FILTER_BIAS
) {
1454 n
[4].i
= n
[5].i
= n
[6].i
= 0;
1457 if (ctx
->ExecuteFlag
) {
1458 CALL_ConvolutionParameteriv(ctx
->Exec
, (target
, pname
, params
));
1463 static void GLAPIENTRY
1464 save_ConvolutionParameterf(GLenum target
, GLenum pname
, GLfloat param
)
1466 GET_CURRENT_CONTEXT(ctx
);
1468 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1469 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CONVOLUTION_PARAMETER_F
, 3);
1475 if (ctx
->ExecuteFlag
) {
1476 CALL_ConvolutionParameterf(ctx
->Exec
, (target
, pname
, param
));
1481 static void GLAPIENTRY
1482 save_ConvolutionParameterfv(GLenum target
, GLenum pname
,
1483 const GLfloat
*params
)
1485 GET_CURRENT_CONTEXT(ctx
);
1487 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1488 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CONVOLUTION_PARAMETER_FV
, 6);
1493 if (pname
== GL_CONVOLUTION_BORDER_COLOR
||
1494 pname
== GL_CONVOLUTION_FILTER_SCALE
||
1495 pname
== GL_CONVOLUTION_FILTER_BIAS
) {
1501 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
1504 if (ctx
->ExecuteFlag
) {
1505 CALL_ConvolutionParameterfv(ctx
->Exec
, (target
, pname
, params
));
1510 static void GLAPIENTRY
1511 save_CopyPixels(GLint x
, GLint y
, GLsizei width
, GLsizei height
, GLenum type
)
1513 GET_CURRENT_CONTEXT(ctx
);
1515 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1516 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_PIXELS
, 5);
1520 n
[3].i
= (GLint
) width
;
1521 n
[4].i
= (GLint
) height
;
1524 if (ctx
->ExecuteFlag
) {
1525 CALL_CopyPixels(ctx
->Exec
, (x
, y
, width
, height
, type
));
1531 static void GLAPIENTRY
1532 save_CopyTexImage1D(GLenum target
, GLint level
, GLenum internalformat
,
1533 GLint x
, GLint y
, GLsizei width
, GLint border
)
1535 GET_CURRENT_CONTEXT(ctx
);
1537 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1538 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_TEX_IMAGE1D
, 7);
1542 n
[3].e
= internalformat
;
1548 if (ctx
->ExecuteFlag
) {
1549 CALL_CopyTexImage1D(ctx
->Exec
, (target
, level
, internalformat
,
1550 x
, y
, width
, border
));
1555 static void GLAPIENTRY
1556 save_CopyTexImage2D(GLenum target
, GLint level
,
1557 GLenum internalformat
,
1558 GLint x
, GLint y
, GLsizei width
,
1559 GLsizei height
, GLint border
)
1561 GET_CURRENT_CONTEXT(ctx
);
1563 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1564 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_TEX_IMAGE2D
, 8);
1568 n
[3].e
= internalformat
;
1575 if (ctx
->ExecuteFlag
) {
1576 CALL_CopyTexImage2D(ctx
->Exec
, (target
, level
, internalformat
,
1577 x
, y
, width
, height
, border
));
1583 static void GLAPIENTRY
1584 save_CopyTexSubImage1D(GLenum target
, GLint level
,
1585 GLint xoffset
, GLint x
, GLint y
, GLsizei width
)
1587 GET_CURRENT_CONTEXT(ctx
);
1589 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1590 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_TEX_SUB_IMAGE1D
, 6);
1599 if (ctx
->ExecuteFlag
) {
1600 CALL_CopyTexSubImage1D(ctx
->Exec
,
1601 (target
, level
, xoffset
, x
, y
, width
));
1606 static void GLAPIENTRY
1607 save_CopyTexSubImage2D(GLenum target
, GLint level
,
1608 GLint xoffset
, GLint yoffset
,
1609 GLint x
, GLint y
, GLsizei width
, GLint height
)
1611 GET_CURRENT_CONTEXT(ctx
);
1613 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1614 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_TEX_SUB_IMAGE2D
, 8);
1625 if (ctx
->ExecuteFlag
) {
1626 CALL_CopyTexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
1627 x
, y
, width
, height
));
1632 static void GLAPIENTRY
1633 save_CopyTexSubImage3D(GLenum target
, GLint level
,
1634 GLint xoffset
, GLint yoffset
, GLint zoffset
,
1635 GLint x
, GLint y
, GLsizei width
, GLint height
)
1637 GET_CURRENT_CONTEXT(ctx
);
1639 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1640 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_TEX_SUB_IMAGE3D
, 9);
1652 if (ctx
->ExecuteFlag
) {
1653 CALL_CopyTexSubImage3D(ctx
->Exec
, (target
, level
,
1654 xoffset
, yoffset
, zoffset
,
1655 x
, y
, width
, height
));
1660 static void GLAPIENTRY
1661 save_CullFace(GLenum mode
)
1663 GET_CURRENT_CONTEXT(ctx
);
1665 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1666 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CULL_FACE
, 1);
1670 if (ctx
->ExecuteFlag
) {
1671 CALL_CullFace(ctx
->Exec
, (mode
));
1676 static void GLAPIENTRY
1677 save_DepthFunc(GLenum func
)
1679 GET_CURRENT_CONTEXT(ctx
);
1681 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1682 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DEPTH_FUNC
, 1);
1686 if (ctx
->ExecuteFlag
) {
1687 CALL_DepthFunc(ctx
->Exec
, (func
));
1692 static void GLAPIENTRY
1693 save_DepthMask(GLboolean mask
)
1695 GET_CURRENT_CONTEXT(ctx
);
1697 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1698 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DEPTH_MASK
, 1);
1702 if (ctx
->ExecuteFlag
) {
1703 CALL_DepthMask(ctx
->Exec
, (mask
));
1708 static void GLAPIENTRY
1709 save_DepthRange(GLclampd nearval
, GLclampd farval
)
1711 GET_CURRENT_CONTEXT(ctx
);
1713 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1714 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DEPTH_RANGE
, 2);
1716 n
[1].f
= (GLfloat
) nearval
;
1717 n
[2].f
= (GLfloat
) farval
;
1719 if (ctx
->ExecuteFlag
) {
1720 CALL_DepthRange(ctx
->Exec
, (nearval
, farval
));
1725 static void GLAPIENTRY
1726 save_Disable(GLenum cap
)
1728 GET_CURRENT_CONTEXT(ctx
);
1730 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1731 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DISABLE
, 1);
1735 if (ctx
->ExecuteFlag
) {
1736 CALL_Disable(ctx
->Exec
, (cap
));
1741 static void GLAPIENTRY
1742 save_DrawBuffer(GLenum mode
)
1744 GET_CURRENT_CONTEXT(ctx
);
1746 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1747 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DRAW_BUFFER
, 1);
1751 if (ctx
->ExecuteFlag
) {
1752 CALL_DrawBuffer(ctx
->Exec
, (mode
));
1757 static void GLAPIENTRY
1758 save_DrawPixels(GLsizei width
, GLsizei height
,
1759 GLenum format
, GLenum type
, const GLvoid
* pixels
)
1761 GET_CURRENT_CONTEXT(ctx
);
1762 GLvoid
*image
= unpack_image(2, width
, height
, 1, format
, type
,
1763 pixels
, &ctx
->Unpack
);
1765 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1766 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DRAW_PIXELS
, 5);
1777 if (ctx
->ExecuteFlag
) {
1778 CALL_DrawPixels(ctx
->Exec
, (width
, height
, format
, type
, pixels
));
1784 static void GLAPIENTRY
1785 save_Enable(GLenum cap
)
1787 GET_CURRENT_CONTEXT(ctx
);
1789 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1790 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ENABLE
, 1);
1794 if (ctx
->ExecuteFlag
) {
1795 CALL_Enable(ctx
->Exec
, (cap
));
1801 static void GLAPIENTRY
1802 _mesa_save_EvalMesh1(GLenum mode
, GLint i1
, GLint i2
)
1804 GET_CURRENT_CONTEXT(ctx
);
1806 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1807 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVALMESH1
, 3);
1813 if (ctx
->ExecuteFlag
) {
1814 CALL_EvalMesh1(ctx
->Exec
, (mode
, i1
, i2
));
1819 static void GLAPIENTRY
1820 _mesa_save_EvalMesh2(GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
1822 GET_CURRENT_CONTEXT(ctx
);
1824 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1825 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVALMESH2
, 5);
1833 if (ctx
->ExecuteFlag
) {
1834 CALL_EvalMesh2(ctx
->Exec
, (mode
, i1
, i2
, j1
, j2
));
1841 static void GLAPIENTRY
1842 save_Fogfv(GLenum pname
, const GLfloat
*params
)
1844 GET_CURRENT_CONTEXT(ctx
);
1846 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1847 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_FOG
, 5);
1855 if (ctx
->ExecuteFlag
) {
1856 CALL_Fogfv(ctx
->Exec
, (pname
, params
));
1861 static void GLAPIENTRY
1862 save_Fogf(GLenum pname
, GLfloat param
)
1864 save_Fogfv(pname
, ¶m
);
1868 static void GLAPIENTRY
1869 save_Fogiv(GLenum pname
, const GLint
*params
)
1874 case GL_FOG_DENSITY
:
1878 p
[0] = (GLfloat
) *params
;
1881 p
[0] = INT_TO_FLOAT(params
[0]);
1882 p
[1] = INT_TO_FLOAT(params
[1]);
1883 p
[2] = INT_TO_FLOAT(params
[2]);
1884 p
[3] = INT_TO_FLOAT(params
[3]);
1887 /* Error will be caught later in gl_Fogfv */
1890 save_Fogfv(pname
, p
);
1894 static void GLAPIENTRY
1895 save_Fogi(GLenum pname
, GLint param
)
1897 save_Fogiv(pname
, ¶m
);
1901 static void GLAPIENTRY
1902 save_FrontFace(GLenum mode
)
1904 GET_CURRENT_CONTEXT(ctx
);
1906 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1907 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_FRONT_FACE
, 1);
1911 if (ctx
->ExecuteFlag
) {
1912 CALL_FrontFace(ctx
->Exec
, (mode
));
1917 static void GLAPIENTRY
1918 save_Frustum(GLdouble left
, GLdouble right
,
1919 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
1921 GET_CURRENT_CONTEXT(ctx
);
1923 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1924 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_FRUSTUM
, 6);
1926 n
[1].f
= (GLfloat
) left
;
1927 n
[2].f
= (GLfloat
) right
;
1928 n
[3].f
= (GLfloat
) bottom
;
1929 n
[4].f
= (GLfloat
) top
;
1930 n
[5].f
= (GLfloat
) nearval
;
1931 n
[6].f
= (GLfloat
) farval
;
1933 if (ctx
->ExecuteFlag
) {
1934 CALL_Frustum(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
1939 static void GLAPIENTRY
1940 save_Hint(GLenum target
, GLenum mode
)
1942 GET_CURRENT_CONTEXT(ctx
);
1944 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1945 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_HINT
, 2);
1950 if (ctx
->ExecuteFlag
) {
1951 CALL_Hint(ctx
->Exec
, (target
, mode
));
1956 static void GLAPIENTRY
1957 save_Histogram(GLenum target
, GLsizei width
, GLenum internalFormat
,
1960 GET_CURRENT_CONTEXT(ctx
);
1963 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1964 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_HISTOGRAM
, 4);
1968 n
[3].e
= internalFormat
;
1971 if (ctx
->ExecuteFlag
) {
1972 CALL_Histogram(ctx
->Exec
, (target
, width
, internalFormat
, sink
));
1977 static void GLAPIENTRY
1978 save_IndexMask(GLuint mask
)
1980 GET_CURRENT_CONTEXT(ctx
);
1982 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1983 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_INDEX_MASK
, 1);
1987 if (ctx
->ExecuteFlag
) {
1988 CALL_IndexMask(ctx
->Exec
, (mask
));
1993 static void GLAPIENTRY
1994 save_InitNames(void)
1996 GET_CURRENT_CONTEXT(ctx
);
1997 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1998 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_INIT_NAMES
, 0);
1999 if (ctx
->ExecuteFlag
) {
2000 CALL_InitNames(ctx
->Exec
, ());
2005 static void GLAPIENTRY
2006 save_Lightfv(GLenum light
, GLenum pname
, const GLfloat
*params
)
2008 GET_CURRENT_CONTEXT(ctx
);
2010 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2011 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LIGHT
, 6);
2029 case GL_SPOT_DIRECTION
:
2032 case GL_SPOT_EXPONENT
:
2035 case GL_SPOT_CUTOFF
:
2038 case GL_CONSTANT_ATTENUATION
:
2041 case GL_LINEAR_ATTENUATION
:
2044 case GL_QUADRATIC_ATTENUATION
:
2050 for (i
= 0; i
< nParams
; i
++) {
2051 n
[3 + i
].f
= params
[i
];
2054 if (ctx
->ExecuteFlag
) {
2055 CALL_Lightfv(ctx
->Exec
, (light
, pname
, params
));
2060 static void GLAPIENTRY
2061 save_Lightf(GLenum light
, GLenum pname
, GLfloat params
)
2063 save_Lightfv(light
, pname
, ¶ms
);
2067 static void GLAPIENTRY
2068 save_Lightiv(GLenum light
, GLenum pname
, const GLint
*params
)
2075 fparam
[0] = INT_TO_FLOAT(params
[0]);
2076 fparam
[1] = INT_TO_FLOAT(params
[1]);
2077 fparam
[2] = INT_TO_FLOAT(params
[2]);
2078 fparam
[3] = INT_TO_FLOAT(params
[3]);
2081 fparam
[0] = (GLfloat
) params
[0];
2082 fparam
[1] = (GLfloat
) params
[1];
2083 fparam
[2] = (GLfloat
) params
[2];
2084 fparam
[3] = (GLfloat
) params
[3];
2086 case GL_SPOT_DIRECTION
:
2087 fparam
[0] = (GLfloat
) params
[0];
2088 fparam
[1] = (GLfloat
) params
[1];
2089 fparam
[2] = (GLfloat
) params
[2];
2091 case GL_SPOT_EXPONENT
:
2092 case GL_SPOT_CUTOFF
:
2093 case GL_CONSTANT_ATTENUATION
:
2094 case GL_LINEAR_ATTENUATION
:
2095 case GL_QUADRATIC_ATTENUATION
:
2096 fparam
[0] = (GLfloat
) params
[0];
2099 /* error will be caught later in gl_Lightfv */
2102 save_Lightfv(light
, pname
, fparam
);
2106 static void GLAPIENTRY
2107 save_Lighti(GLenum light
, GLenum pname
, GLint param
)
2109 save_Lightiv(light
, pname
, ¶m
);
2113 static void GLAPIENTRY
2114 save_LightModelfv(GLenum pname
, const GLfloat
*params
)
2116 GET_CURRENT_CONTEXT(ctx
);
2118 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2119 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LIGHT_MODEL
, 5);
2127 if (ctx
->ExecuteFlag
) {
2128 CALL_LightModelfv(ctx
->Exec
, (pname
, params
));
2133 static void GLAPIENTRY
2134 save_LightModelf(GLenum pname
, GLfloat param
)
2136 save_LightModelfv(pname
, ¶m
);
2140 static void GLAPIENTRY
2141 save_LightModeliv(GLenum pname
, const GLint
*params
)
2145 case GL_LIGHT_MODEL_AMBIENT
:
2146 fparam
[0] = INT_TO_FLOAT(params
[0]);
2147 fparam
[1] = INT_TO_FLOAT(params
[1]);
2148 fparam
[2] = INT_TO_FLOAT(params
[2]);
2149 fparam
[3] = INT_TO_FLOAT(params
[3]);
2151 case GL_LIGHT_MODEL_LOCAL_VIEWER
:
2152 case GL_LIGHT_MODEL_TWO_SIDE
:
2153 case GL_LIGHT_MODEL_COLOR_CONTROL
:
2154 fparam
[0] = (GLfloat
) params
[0];
2157 /* Error will be caught later in gl_LightModelfv */
2160 save_LightModelfv(pname
, fparam
);
2164 static void GLAPIENTRY
2165 save_LightModeli(GLenum pname
, GLint param
)
2167 save_LightModeliv(pname
, ¶m
);
2171 static void GLAPIENTRY
2172 save_LineStipple(GLint factor
, GLushort pattern
)
2174 GET_CURRENT_CONTEXT(ctx
);
2176 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2177 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LINE_STIPPLE
, 2);
2182 if (ctx
->ExecuteFlag
) {
2183 CALL_LineStipple(ctx
->Exec
, (factor
, pattern
));
2188 static void GLAPIENTRY
2189 save_LineWidth(GLfloat width
)
2191 GET_CURRENT_CONTEXT(ctx
);
2193 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2194 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LINE_WIDTH
, 1);
2198 if (ctx
->ExecuteFlag
) {
2199 CALL_LineWidth(ctx
->Exec
, (width
));
2204 static void GLAPIENTRY
2205 save_ListBase(GLuint base
)
2207 GET_CURRENT_CONTEXT(ctx
);
2209 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2210 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LIST_BASE
, 1);
2214 if (ctx
->ExecuteFlag
) {
2215 CALL_ListBase(ctx
->Exec
, (base
));
2220 static void GLAPIENTRY
2221 save_LoadIdentity(void)
2223 GET_CURRENT_CONTEXT(ctx
);
2224 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2225 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_LOAD_IDENTITY
, 0);
2226 if (ctx
->ExecuteFlag
) {
2227 CALL_LoadIdentity(ctx
->Exec
, ());
2232 static void GLAPIENTRY
2233 save_LoadMatrixf(const GLfloat
* m
)
2235 GET_CURRENT_CONTEXT(ctx
);
2237 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2238 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LOAD_MATRIX
, 16);
2241 for (i
= 0; i
< 16; i
++) {
2245 if (ctx
->ExecuteFlag
) {
2246 CALL_LoadMatrixf(ctx
->Exec
, (m
));
2251 static void GLAPIENTRY
2252 save_LoadMatrixd(const GLdouble
* m
)
2256 for (i
= 0; i
< 16; i
++) {
2257 f
[i
] = (GLfloat
) m
[i
];
2259 save_LoadMatrixf(f
);
2263 static void GLAPIENTRY
2264 save_LoadName(GLuint name
)
2266 GET_CURRENT_CONTEXT(ctx
);
2268 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2269 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LOAD_NAME
, 1);
2273 if (ctx
->ExecuteFlag
) {
2274 CALL_LoadName(ctx
->Exec
, (name
));
2279 static void GLAPIENTRY
2280 save_LogicOp(GLenum opcode
)
2282 GET_CURRENT_CONTEXT(ctx
);
2284 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2285 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LOGIC_OP
, 1);
2289 if (ctx
->ExecuteFlag
) {
2290 CALL_LogicOp(ctx
->Exec
, (opcode
));
2295 static void GLAPIENTRY
2296 save_Map1d(GLenum target
, GLdouble u1
, GLdouble u2
, GLint stride
,
2297 GLint order
, const GLdouble
* points
)
2299 GET_CURRENT_CONTEXT(ctx
);
2301 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2302 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MAP1
, 6);
2304 GLfloat
*pnts
= _mesa_copy_map_points1d(target
, stride
, order
, points
);
2306 n
[2].f
= (GLfloat
) u1
;
2307 n
[3].f
= (GLfloat
) u2
;
2308 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2310 n
[6].data
= (void *) pnts
;
2312 if (ctx
->ExecuteFlag
) {
2313 CALL_Map1d(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2317 static void GLAPIENTRY
2318 save_Map1f(GLenum target
, GLfloat u1
, GLfloat u2
, GLint stride
,
2319 GLint order
, const GLfloat
* 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_points1f(target
, stride
, order
, points
);
2330 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2332 n
[6].data
= (void *) pnts
;
2334 if (ctx
->ExecuteFlag
) {
2335 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2340 static void GLAPIENTRY
2341 save_Map2d(GLenum target
,
2342 GLdouble u1
, GLdouble u2
, GLint ustride
, GLint uorder
,
2343 GLdouble v1
, GLdouble v2
, GLint vstride
, GLint vorder
,
2344 const GLdouble
* points
)
2346 GET_CURRENT_CONTEXT(ctx
);
2348 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2349 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MAP2
, 10);
2351 GLfloat
*pnts
= _mesa_copy_map_points2d(target
, ustride
, uorder
,
2352 vstride
, vorder
, points
);
2354 n
[2].f
= (GLfloat
) u1
;
2355 n
[3].f
= (GLfloat
) u2
;
2356 n
[4].f
= (GLfloat
) v1
;
2357 n
[5].f
= (GLfloat
) v2
;
2358 /* XXX verify these strides are correct */
2359 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2360 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2363 n
[10].data
= (void *) pnts
;
2365 if (ctx
->ExecuteFlag
) {
2366 CALL_Map2d(ctx
->Exec
, (target
,
2367 u1
, u2
, ustride
, uorder
,
2368 v1
, v2
, vstride
, vorder
, points
));
2373 static void GLAPIENTRY
2374 save_Map2f(GLenum target
,
2375 GLfloat u1
, GLfloat u2
, GLint ustride
, GLint uorder
,
2376 GLfloat v1
, GLfloat v2
, GLint vstride
, GLint vorder
,
2377 const GLfloat
* points
)
2379 GET_CURRENT_CONTEXT(ctx
);
2381 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2382 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MAP2
, 10);
2384 GLfloat
*pnts
= _mesa_copy_map_points2f(target
, ustride
, uorder
,
2385 vstride
, vorder
, points
);
2391 /* XXX verify these strides are correct */
2392 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2393 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2396 n
[10].data
= (void *) pnts
;
2398 if (ctx
->ExecuteFlag
) {
2399 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
2400 v1
, v2
, vstride
, vorder
, points
));
2405 static void GLAPIENTRY
2406 save_MapGrid1f(GLint un
, GLfloat u1
, GLfloat u2
)
2408 GET_CURRENT_CONTEXT(ctx
);
2410 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2411 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MAPGRID1
, 3);
2417 if (ctx
->ExecuteFlag
) {
2418 CALL_MapGrid1f(ctx
->Exec
, (un
, u1
, u2
));
2423 static void GLAPIENTRY
2424 save_MapGrid1d(GLint un
, GLdouble u1
, GLdouble u2
)
2426 save_MapGrid1f(un
, (GLfloat
) u1
, (GLfloat
) u2
);
2430 static void GLAPIENTRY
2431 save_MapGrid2f(GLint un
, GLfloat u1
, GLfloat u2
,
2432 GLint vn
, GLfloat v1
, GLfloat v2
)
2434 GET_CURRENT_CONTEXT(ctx
);
2436 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2437 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MAPGRID2
, 6);
2446 if (ctx
->ExecuteFlag
) {
2447 CALL_MapGrid2f(ctx
->Exec
, (un
, u1
, u2
, vn
, v1
, v2
));
2453 static void GLAPIENTRY
2454 save_MapGrid2d(GLint un
, GLdouble u1
, GLdouble u2
,
2455 GLint vn
, GLdouble v1
, GLdouble v2
)
2457 save_MapGrid2f(un
, (GLfloat
) u1
, (GLfloat
) u2
,
2458 vn
, (GLfloat
) v1
, (GLfloat
) v2
);
2462 static void GLAPIENTRY
2463 save_MatrixMode(GLenum mode
)
2465 GET_CURRENT_CONTEXT(ctx
);
2467 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2468 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MATRIX_MODE
, 1);
2472 if (ctx
->ExecuteFlag
) {
2473 CALL_MatrixMode(ctx
->Exec
, (mode
));
2478 static void GLAPIENTRY
2479 save_Minmax(GLenum target
, GLenum internalFormat
, GLboolean sink
)
2481 GET_CURRENT_CONTEXT(ctx
);
2484 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2485 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MIN_MAX
, 3);
2488 n
[2].e
= internalFormat
;
2491 if (ctx
->ExecuteFlag
) {
2492 CALL_Minmax(ctx
->Exec
, (target
, internalFormat
, sink
));
2497 static void GLAPIENTRY
2498 save_MultMatrixf(const GLfloat
* m
)
2500 GET_CURRENT_CONTEXT(ctx
);
2502 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2503 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MULT_MATRIX
, 16);
2506 for (i
= 0; i
< 16; i
++) {
2510 if (ctx
->ExecuteFlag
) {
2511 CALL_MultMatrixf(ctx
->Exec
, (m
));
2516 static void GLAPIENTRY
2517 save_MultMatrixd(const GLdouble
* m
)
2521 for (i
= 0; i
< 16; i
++) {
2522 f
[i
] = (GLfloat
) m
[i
];
2524 save_MultMatrixf(f
);
2528 static void GLAPIENTRY
2529 save_NewList(GLuint name
, GLenum mode
)
2531 GET_CURRENT_CONTEXT(ctx
);
2532 /* It's an error to call this function while building a display list */
2533 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
2540 static void GLAPIENTRY
2541 save_Ortho(GLdouble left
, GLdouble right
,
2542 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
2544 GET_CURRENT_CONTEXT(ctx
);
2546 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2547 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ORTHO
, 6);
2549 n
[1].f
= (GLfloat
) left
;
2550 n
[2].f
= (GLfloat
) right
;
2551 n
[3].f
= (GLfloat
) bottom
;
2552 n
[4].f
= (GLfloat
) top
;
2553 n
[5].f
= (GLfloat
) nearval
;
2554 n
[6].f
= (GLfloat
) farval
;
2556 if (ctx
->ExecuteFlag
) {
2557 CALL_Ortho(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
2562 static void GLAPIENTRY
2563 save_PixelMapfv(GLenum map
, GLint mapsize
, const GLfloat
*values
)
2565 GET_CURRENT_CONTEXT(ctx
);
2567 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2568 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PIXEL_MAP
, 3);
2572 n
[3].data
= (void *) _mesa_malloc(mapsize
* sizeof(GLfloat
));
2573 MEMCPY(n
[3].data
, (void *) values
, mapsize
* sizeof(GLfloat
));
2575 if (ctx
->ExecuteFlag
) {
2576 CALL_PixelMapfv(ctx
->Exec
, (map
, mapsize
, values
));
2581 static void GLAPIENTRY
2582 save_PixelMapuiv(GLenum map
, GLint mapsize
, const GLuint
*values
)
2584 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2586 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
2587 for (i
= 0; i
< mapsize
; i
++) {
2588 fvalues
[i
] = (GLfloat
) values
[i
];
2592 for (i
= 0; i
< mapsize
; i
++) {
2593 fvalues
[i
] = UINT_TO_FLOAT(values
[i
]);
2596 save_PixelMapfv(map
, mapsize
, fvalues
);
2600 static void GLAPIENTRY
2601 save_PixelMapusv(GLenum map
, GLint mapsize
, const GLushort
*values
)
2603 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2605 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
2606 for (i
= 0; i
< mapsize
; i
++) {
2607 fvalues
[i
] = (GLfloat
) values
[i
];
2611 for (i
= 0; i
< mapsize
; i
++) {
2612 fvalues
[i
] = USHORT_TO_FLOAT(values
[i
]);
2615 save_PixelMapfv(map
, mapsize
, fvalues
);
2619 static void GLAPIENTRY
2620 save_PixelTransferf(GLenum pname
, GLfloat param
)
2622 GET_CURRENT_CONTEXT(ctx
);
2624 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2625 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PIXEL_TRANSFER
, 2);
2630 if (ctx
->ExecuteFlag
) {
2631 CALL_PixelTransferf(ctx
->Exec
, (pname
, param
));
2636 static void GLAPIENTRY
2637 save_PixelTransferi(GLenum pname
, GLint param
)
2639 save_PixelTransferf(pname
, (GLfloat
) param
);
2643 static void GLAPIENTRY
2644 save_PixelZoom(GLfloat xfactor
, GLfloat yfactor
)
2646 GET_CURRENT_CONTEXT(ctx
);
2648 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2649 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PIXEL_ZOOM
, 2);
2654 if (ctx
->ExecuteFlag
) {
2655 CALL_PixelZoom(ctx
->Exec
, (xfactor
, yfactor
));
2660 static void GLAPIENTRY
2661 save_PointParameterfvEXT(GLenum pname
, const GLfloat
*params
)
2663 GET_CURRENT_CONTEXT(ctx
);
2665 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2666 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_POINT_PARAMETERS
, 4);
2673 if (ctx
->ExecuteFlag
) {
2674 CALL_PointParameterfvEXT(ctx
->Exec
, (pname
, params
));
2679 static void GLAPIENTRY
2680 save_PointParameterfEXT(GLenum pname
, GLfloat param
)
2682 save_PointParameterfvEXT(pname
, ¶m
);
2685 static void GLAPIENTRY
2686 save_PointParameteriNV(GLenum pname
, GLint param
)
2688 GLfloat p
= (GLfloat
) param
;
2689 save_PointParameterfvEXT(pname
, &p
);
2692 static void GLAPIENTRY
2693 save_PointParameterivNV(GLenum pname
, const GLint
* param
)
2695 GLfloat p
= (GLfloat
) param
[0];
2696 save_PointParameterfvEXT(pname
, &p
);
2700 static void GLAPIENTRY
2701 save_PointSize(GLfloat size
)
2703 GET_CURRENT_CONTEXT(ctx
);
2705 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2706 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_POINT_SIZE
, 1);
2710 if (ctx
->ExecuteFlag
) {
2711 CALL_PointSize(ctx
->Exec
, (size
));
2716 static void GLAPIENTRY
2717 save_PolygonMode(GLenum face
, GLenum mode
)
2719 GET_CURRENT_CONTEXT(ctx
);
2721 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2722 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_POLYGON_MODE
, 2);
2727 if (ctx
->ExecuteFlag
) {
2728 CALL_PolygonMode(ctx
->Exec
, (face
, mode
));
2733 static void GLAPIENTRY
2734 save_PolygonStipple(const GLubyte
* pattern
)
2736 GET_CURRENT_CONTEXT(ctx
);
2737 GLvoid
*image
= unpack_image(2, 32, 32, 1, GL_COLOR_INDEX
, GL_BITMAP
,
2738 pattern
, &ctx
->Unpack
);
2740 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2741 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_POLYGON_STIPPLE
, 1);
2748 if (ctx
->ExecuteFlag
) {
2749 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) pattern
));
2754 static void GLAPIENTRY
2755 save_PolygonOffset(GLfloat factor
, GLfloat units
)
2757 GET_CURRENT_CONTEXT(ctx
);
2759 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2760 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_POLYGON_OFFSET
, 2);
2765 if (ctx
->ExecuteFlag
) {
2766 CALL_PolygonOffset(ctx
->Exec
, (factor
, units
));
2771 static void GLAPIENTRY
2772 save_PolygonOffsetEXT(GLfloat factor
, GLfloat bias
)
2774 GET_CURRENT_CONTEXT(ctx
);
2775 /* XXX mult by DepthMaxF here??? */
2776 save_PolygonOffset(factor
, ctx
->DrawBuffer
->_DepthMaxF
* bias
);
2780 static void GLAPIENTRY
2781 save_PopAttrib(void)
2783 GET_CURRENT_CONTEXT(ctx
);
2784 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2785 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_POP_ATTRIB
, 0);
2786 if (ctx
->ExecuteFlag
) {
2787 CALL_PopAttrib(ctx
->Exec
, ());
2792 static void GLAPIENTRY
2793 save_PopMatrix(void)
2795 GET_CURRENT_CONTEXT(ctx
);
2796 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2797 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_POP_MATRIX
, 0);
2798 if (ctx
->ExecuteFlag
) {
2799 CALL_PopMatrix(ctx
->Exec
, ());
2804 static void GLAPIENTRY
2807 GET_CURRENT_CONTEXT(ctx
);
2808 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2809 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_POP_NAME
, 0);
2810 if (ctx
->ExecuteFlag
) {
2811 CALL_PopName(ctx
->Exec
, ());
2816 static void GLAPIENTRY
2817 save_PrioritizeTextures(GLsizei num
, const GLuint
* textures
,
2818 const GLclampf
* priorities
)
2820 GET_CURRENT_CONTEXT(ctx
);
2822 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2824 for (i
= 0; i
< num
; i
++) {
2826 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PRIORITIZE_TEXTURE
, 2);
2828 n
[1].ui
= textures
[i
];
2829 n
[2].f
= priorities
[i
];
2832 if (ctx
->ExecuteFlag
) {
2833 CALL_PrioritizeTextures(ctx
->Exec
, (num
, textures
, priorities
));
2838 static void GLAPIENTRY
2839 save_PushAttrib(GLbitfield mask
)
2841 GET_CURRENT_CONTEXT(ctx
);
2843 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2844 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PUSH_ATTRIB
, 1);
2848 if (ctx
->ExecuteFlag
) {
2849 CALL_PushAttrib(ctx
->Exec
, (mask
));
2854 static void GLAPIENTRY
2855 save_PushMatrix(void)
2857 GET_CURRENT_CONTEXT(ctx
);
2858 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2859 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_PUSH_MATRIX
, 0);
2860 if (ctx
->ExecuteFlag
) {
2861 CALL_PushMatrix(ctx
->Exec
, ());
2866 static void GLAPIENTRY
2867 save_PushName(GLuint name
)
2869 GET_CURRENT_CONTEXT(ctx
);
2871 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2872 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PUSH_NAME
, 1);
2876 if (ctx
->ExecuteFlag
) {
2877 CALL_PushName(ctx
->Exec
, (name
));
2882 static void GLAPIENTRY
2883 save_RasterPos4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
2885 GET_CURRENT_CONTEXT(ctx
);
2887 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2888 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_RASTER_POS
, 4);
2895 if (ctx
->ExecuteFlag
) {
2896 CALL_RasterPos4f(ctx
->Exec
, (x
, y
, z
, w
));
2900 static void GLAPIENTRY
2901 save_RasterPos2d(GLdouble x
, GLdouble y
)
2903 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
2906 static void GLAPIENTRY
2907 save_RasterPos2f(GLfloat x
, GLfloat y
)
2909 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2912 static void GLAPIENTRY
2913 save_RasterPos2i(GLint x
, GLint y
)
2915 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
2918 static void GLAPIENTRY
2919 save_RasterPos2s(GLshort x
, GLshort y
)
2921 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2924 static void GLAPIENTRY
2925 save_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
2927 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
2930 static void GLAPIENTRY
2931 save_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
2933 save_RasterPos4f(x
, y
, z
, 1.0F
);
2936 static void GLAPIENTRY
2937 save_RasterPos3i(GLint x
, GLint y
, GLint z
)
2939 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
2942 static void GLAPIENTRY
2943 save_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
2945 save_RasterPos4f(x
, y
, z
, 1.0F
);
2948 static void GLAPIENTRY
2949 save_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
2951 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
2954 static void GLAPIENTRY
2955 save_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
2957 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
2960 static void GLAPIENTRY
2961 save_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
2963 save_RasterPos4f(x
, y
, z
, w
);
2966 static void GLAPIENTRY
2967 save_RasterPos2dv(const GLdouble
* v
)
2969 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
2972 static void GLAPIENTRY
2973 save_RasterPos2fv(const GLfloat
* v
)
2975 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2978 static void GLAPIENTRY
2979 save_RasterPos2iv(const GLint
* v
)
2981 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
2984 static void GLAPIENTRY
2985 save_RasterPos2sv(const GLshort
* v
)
2987 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2990 static void GLAPIENTRY
2991 save_RasterPos3dv(const GLdouble
* v
)
2993 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
2996 static void GLAPIENTRY
2997 save_RasterPos3fv(const GLfloat
* v
)
2999 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3002 static void GLAPIENTRY
3003 save_RasterPos3iv(const GLint
* v
)
3005 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3008 static void GLAPIENTRY
3009 save_RasterPos3sv(const GLshort
* v
)
3011 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3014 static void GLAPIENTRY
3015 save_RasterPos4dv(const GLdouble
* v
)
3017 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3018 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3021 static void GLAPIENTRY
3022 save_RasterPos4fv(const GLfloat
* v
)
3024 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3027 static void GLAPIENTRY
3028 save_RasterPos4iv(const GLint
* v
)
3030 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3031 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3034 static void GLAPIENTRY
3035 save_RasterPos4sv(const GLshort
* v
)
3037 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3041 static void GLAPIENTRY
3042 save_PassThrough(GLfloat token
)
3044 GET_CURRENT_CONTEXT(ctx
);
3046 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3047 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PASSTHROUGH
, 1);
3051 if (ctx
->ExecuteFlag
) {
3052 CALL_PassThrough(ctx
->Exec
, (token
));
3057 static void GLAPIENTRY
3058 save_ReadBuffer(GLenum mode
)
3060 GET_CURRENT_CONTEXT(ctx
);
3062 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3063 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_READ_BUFFER
, 1);
3067 if (ctx
->ExecuteFlag
) {
3068 CALL_ReadBuffer(ctx
->Exec
, (mode
));
3073 static void GLAPIENTRY
3074 save_ResetHistogram(GLenum target
)
3076 GET_CURRENT_CONTEXT(ctx
);
3078 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3079 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_RESET_HISTOGRAM
, 1);
3083 if (ctx
->ExecuteFlag
) {
3084 CALL_ResetHistogram(ctx
->Exec
, (target
));
3089 static void GLAPIENTRY
3090 save_ResetMinmax(GLenum target
)
3092 GET_CURRENT_CONTEXT(ctx
);
3094 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3095 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_RESET_MIN_MAX
, 1);
3099 if (ctx
->ExecuteFlag
) {
3100 CALL_ResetMinmax(ctx
->Exec
, (target
));
3105 static void GLAPIENTRY
3106 save_Rotatef(GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
3108 GET_CURRENT_CONTEXT(ctx
);
3110 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3111 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ROTATE
, 4);
3118 if (ctx
->ExecuteFlag
) {
3119 CALL_Rotatef(ctx
->Exec
, (angle
, x
, y
, z
));
3124 static void GLAPIENTRY
3125 save_Rotated(GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
3127 save_Rotatef((GLfloat
) angle
, (GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3131 static void GLAPIENTRY
3132 save_Scalef(GLfloat x
, GLfloat y
, GLfloat z
)
3134 GET_CURRENT_CONTEXT(ctx
);
3136 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3137 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SCALE
, 3);
3143 if (ctx
->ExecuteFlag
) {
3144 CALL_Scalef(ctx
->Exec
, (x
, y
, z
));
3149 static void GLAPIENTRY
3150 save_Scaled(GLdouble x
, GLdouble y
, GLdouble z
)
3152 save_Scalef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3156 static void GLAPIENTRY
3157 save_Scissor(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3159 GET_CURRENT_CONTEXT(ctx
);
3161 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3162 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SCISSOR
, 4);
3169 if (ctx
->ExecuteFlag
) {
3170 CALL_Scissor(ctx
->Exec
, (x
, y
, width
, height
));
3175 static void GLAPIENTRY
3176 save_ShadeModel(GLenum mode
)
3178 GET_CURRENT_CONTEXT(ctx
);
3180 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3181 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SHADE_MODEL
, 1);
3185 if (ctx
->ExecuteFlag
) {
3186 CALL_ShadeModel(ctx
->Exec
, (mode
));
3191 static void GLAPIENTRY
3192 save_StencilFunc(GLenum func
, GLint ref
, GLuint mask
)
3194 GET_CURRENT_CONTEXT(ctx
);
3196 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3197 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_FUNC
, 3);
3203 if (ctx
->ExecuteFlag
) {
3204 CALL_StencilFunc(ctx
->Exec
, (func
, ref
, mask
));
3209 static void GLAPIENTRY
3210 save_StencilMask(GLuint mask
)
3212 GET_CURRENT_CONTEXT(ctx
);
3214 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3215 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_MASK
, 1);
3219 if (ctx
->ExecuteFlag
) {
3220 CALL_StencilMask(ctx
->Exec
, (mask
));
3225 static void GLAPIENTRY
3226 save_StencilOp(GLenum fail
, GLenum zfail
, GLenum zpass
)
3228 GET_CURRENT_CONTEXT(ctx
);
3230 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3231 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_OP
, 3);
3237 if (ctx
->ExecuteFlag
) {
3238 CALL_StencilOp(ctx
->Exec
, (fail
, zfail
, zpass
));
3243 static void GLAPIENTRY
3244 save_StencilFuncSeparate(GLenum face
, GLenum func
, GLint ref
, GLuint mask
)
3246 GET_CURRENT_CONTEXT(ctx
);
3248 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3249 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3256 if (ctx
->ExecuteFlag
) {
3257 CALL_StencilFuncSeparate(ctx
->Exec
, (face
, func
, ref
, mask
));
3262 static void GLAPIENTRY
3263 save_StencilFuncSeparateATI(GLenum frontfunc
, GLenum backfunc
, GLint ref
,
3266 GET_CURRENT_CONTEXT(ctx
);
3268 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3270 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3278 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3285 if (ctx
->ExecuteFlag
) {
3286 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_FRONT
, frontfunc
, ref
, mask
));
3287 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_BACK
, backfunc
, ref
, mask
));
3292 static void GLAPIENTRY
3293 save_StencilMaskSeparate(GLenum face
, GLuint mask
)
3295 GET_CURRENT_CONTEXT(ctx
);
3297 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3298 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_MASK_SEPARATE
, 2);
3303 if (ctx
->ExecuteFlag
) {
3304 CALL_StencilMaskSeparate(ctx
->Exec
, (face
, mask
));
3309 static void GLAPIENTRY
3310 save_StencilOpSeparate(GLenum face
, GLenum fail
, GLenum zfail
, GLenum zpass
)
3312 GET_CURRENT_CONTEXT(ctx
);
3314 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3315 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_OP_SEPARATE
, 4);
3322 if (ctx
->ExecuteFlag
) {
3323 CALL_StencilOpSeparate(ctx
->Exec
, (face
, fail
, zfail
, zpass
));
3328 static void GLAPIENTRY
3329 save_TexEnvfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3331 GET_CURRENT_CONTEXT(ctx
);
3333 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3334 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEXENV
, 6);
3338 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3346 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
3349 if (ctx
->ExecuteFlag
) {
3350 CALL_TexEnvfv(ctx
->Exec
, (target
, pname
, params
));
3355 static void GLAPIENTRY
3356 save_TexEnvf(GLenum target
, GLenum pname
, GLfloat param
)
3358 save_TexEnvfv(target
, pname
, ¶m
);
3362 static void GLAPIENTRY
3363 save_TexEnvi(GLenum target
, GLenum pname
, GLint param
)
3366 p
[0] = (GLfloat
) param
;
3367 p
[1] = p
[2] = p
[3] = 0.0;
3368 save_TexEnvfv(target
, pname
, p
);
3372 static void GLAPIENTRY
3373 save_TexEnviv(GLenum target
, GLenum pname
, const GLint
* param
)
3376 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3377 p
[0] = INT_TO_FLOAT(param
[0]);
3378 p
[1] = INT_TO_FLOAT(param
[1]);
3379 p
[2] = INT_TO_FLOAT(param
[2]);
3380 p
[3] = INT_TO_FLOAT(param
[3]);
3383 p
[0] = (GLfloat
) param
[0];
3384 p
[1] = p
[2] = p
[3] = 0.0F
;
3386 save_TexEnvfv(target
, pname
, p
);
3390 static void GLAPIENTRY
3391 save_TexGenfv(GLenum coord
, GLenum pname
, const GLfloat
*params
)
3393 GET_CURRENT_CONTEXT(ctx
);
3395 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3396 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEXGEN
, 6);
3405 if (ctx
->ExecuteFlag
) {
3406 CALL_TexGenfv(ctx
->Exec
, (coord
, pname
, params
));
3411 static void GLAPIENTRY
3412 save_TexGeniv(GLenum coord
, GLenum pname
, const GLint
*params
)
3415 p
[0] = (GLfloat
) params
[0];
3416 p
[1] = (GLfloat
) params
[1];
3417 p
[2] = (GLfloat
) params
[2];
3418 p
[3] = (GLfloat
) params
[3];
3419 save_TexGenfv(coord
, pname
, p
);
3423 static void GLAPIENTRY
3424 save_TexGend(GLenum coord
, GLenum pname
, GLdouble param
)
3426 GLfloat p
= (GLfloat
) param
;
3427 save_TexGenfv(coord
, pname
, &p
);
3431 static void GLAPIENTRY
3432 save_TexGendv(GLenum coord
, GLenum pname
, const GLdouble
*params
)
3435 p
[0] = (GLfloat
) params
[0];
3436 p
[1] = (GLfloat
) params
[1];
3437 p
[2] = (GLfloat
) params
[2];
3438 p
[3] = (GLfloat
) params
[3];
3439 save_TexGenfv(coord
, pname
, p
);
3443 static void GLAPIENTRY
3444 save_TexGenf(GLenum coord
, GLenum pname
, GLfloat param
)
3446 save_TexGenfv(coord
, pname
, ¶m
);
3450 static void GLAPIENTRY
3451 save_TexGeni(GLenum coord
, GLenum pname
, GLint param
)
3453 save_TexGeniv(coord
, pname
, ¶m
);
3457 static void GLAPIENTRY
3458 save_TexParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3460 GET_CURRENT_CONTEXT(ctx
);
3462 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3463 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEXPARAMETER
, 6);
3472 if (ctx
->ExecuteFlag
) {
3473 CALL_TexParameterfv(ctx
->Exec
, (target
, pname
, params
));
3478 static void GLAPIENTRY
3479 save_TexParameterf(GLenum target
, GLenum pname
, GLfloat param
)
3481 save_TexParameterfv(target
, pname
, ¶m
);
3485 static void GLAPIENTRY
3486 save_TexParameteri(GLenum target
, GLenum pname
, GLint param
)
3489 fparam
[0] = (GLfloat
) param
;
3490 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
3491 save_TexParameterfv(target
, pname
, fparam
);
3495 static void GLAPIENTRY
3496 save_TexParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
3499 fparam
[0] = (GLfloat
) params
[0];
3500 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
3501 save_TexParameterfv(target
, pname
, fparam
);
3505 static void GLAPIENTRY
3506 save_TexImage1D(GLenum target
,
3507 GLint level
, GLint components
,
3508 GLsizei width
, GLint border
,
3509 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3511 GET_CURRENT_CONTEXT(ctx
);
3512 if (target
== GL_PROXY_TEXTURE_1D
) {
3513 /* don't compile, execute immediately */
3514 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
3515 border
, format
, type
, pixels
));
3518 GLvoid
*image
= unpack_image(1, width
, 1, 1, format
, type
,
3519 pixels
, &ctx
->Unpack
);
3521 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3522 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_IMAGE1D
, 8);
3526 n
[3].i
= components
;
3527 n
[4].i
= (GLint
) width
;
3536 if (ctx
->ExecuteFlag
) {
3537 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
3538 border
, format
, type
, pixels
));
3544 static void GLAPIENTRY
3545 save_TexImage2D(GLenum target
,
3546 GLint level
, GLint components
,
3547 GLsizei width
, GLsizei height
, GLint border
,
3548 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3550 GET_CURRENT_CONTEXT(ctx
);
3551 if (target
== GL_PROXY_TEXTURE_2D
) {
3552 /* don't compile, execute immediately */
3553 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
3554 height
, border
, format
, type
, pixels
));
3557 GLvoid
*image
= unpack_image(2, width
, height
, 1, format
, type
,
3558 pixels
, &ctx
->Unpack
);
3560 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3561 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_IMAGE2D
, 9);
3565 n
[3].i
= components
;
3566 n
[4].i
= (GLint
) width
;
3567 n
[5].i
= (GLint
) height
;
3576 if (ctx
->ExecuteFlag
) {
3577 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
3578 height
, border
, format
, type
, pixels
));
3584 static void GLAPIENTRY
3585 save_TexImage3D(GLenum target
,
3586 GLint level
, GLint internalFormat
,
3587 GLsizei width
, GLsizei height
, GLsizei depth
,
3589 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3591 GET_CURRENT_CONTEXT(ctx
);
3592 if (target
== GL_PROXY_TEXTURE_3D
) {
3593 /* don't compile, execute immediately */
3594 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
3595 height
, depth
, border
, format
, type
,
3600 GLvoid
*image
= unpack_image(3, width
, height
, depth
, format
, type
,
3601 pixels
, &ctx
->Unpack
);
3602 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3603 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_IMAGE3D
, 10);
3607 n
[3].i
= (GLint
) internalFormat
;
3608 n
[4].i
= (GLint
) width
;
3609 n
[5].i
= (GLint
) height
;
3610 n
[6].i
= (GLint
) depth
;
3619 if (ctx
->ExecuteFlag
) {
3620 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
3621 height
, depth
, border
, format
, type
,
3628 static void GLAPIENTRY
3629 save_TexSubImage1D(GLenum target
, GLint level
, GLint xoffset
,
3630 GLsizei width
, GLenum format
, GLenum type
,
3631 const GLvoid
* pixels
)
3633 GET_CURRENT_CONTEXT(ctx
);
3635 GLvoid
*image
= unpack_image(1, width
, 1, 1, format
, type
,
3636 pixels
, &ctx
->Unpack
);
3637 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3638 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_SUB_IMAGE1D
, 7);
3643 n
[4].i
= (GLint
) width
;
3651 if (ctx
->ExecuteFlag
) {
3652 CALL_TexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
, width
,
3653 format
, type
, pixels
));
3658 static void GLAPIENTRY
3659 save_TexSubImage2D(GLenum target
, GLint level
,
3660 GLint xoffset
, GLint yoffset
,
3661 GLsizei width
, GLsizei height
,
3662 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3664 GET_CURRENT_CONTEXT(ctx
);
3666 GLvoid
*image
= unpack_image(2, width
, height
, 1, format
, type
,
3667 pixels
, &ctx
->Unpack
);
3668 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3669 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_SUB_IMAGE2D
, 9);
3675 n
[5].i
= (GLint
) width
;
3676 n
[6].i
= (GLint
) height
;
3684 if (ctx
->ExecuteFlag
) {
3685 CALL_TexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
3686 width
, height
, format
, type
, pixels
));
3691 static void GLAPIENTRY
3692 save_TexSubImage3D(GLenum target
, GLint level
,
3693 GLint xoffset
, GLint yoffset
, GLint zoffset
,
3694 GLsizei width
, GLsizei height
, GLsizei depth
,
3695 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3697 GET_CURRENT_CONTEXT(ctx
);
3699 GLvoid
*image
= unpack_image(3, width
, height
, depth
, format
, type
,
3700 pixels
, &ctx
->Unpack
);
3701 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3702 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_SUB_IMAGE3D
, 11);
3709 n
[6].i
= (GLint
) width
;
3710 n
[7].i
= (GLint
) height
;
3711 n
[8].i
= (GLint
) depth
;
3719 if (ctx
->ExecuteFlag
) {
3720 CALL_TexSubImage3D(ctx
->Exec
, (target
, level
,
3721 xoffset
, yoffset
, zoffset
,
3722 width
, height
, depth
, format
, type
,
3728 static void GLAPIENTRY
3729 save_Translatef(GLfloat x
, GLfloat y
, GLfloat z
)
3731 GET_CURRENT_CONTEXT(ctx
);
3733 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3734 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TRANSLATE
, 3);
3740 if (ctx
->ExecuteFlag
) {
3741 CALL_Translatef(ctx
->Exec
, (x
, y
, z
));
3746 static void GLAPIENTRY
3747 save_Translated(GLdouble x
, GLdouble y
, GLdouble z
)
3749 save_Translatef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3754 static void GLAPIENTRY
3755 save_Viewport(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3757 GET_CURRENT_CONTEXT(ctx
);
3759 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3760 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_VIEWPORT
, 4);
3764 n
[3].i
= (GLint
) width
;
3765 n
[4].i
= (GLint
) height
;
3767 if (ctx
->ExecuteFlag
) {
3768 CALL_Viewport(ctx
->Exec
, (x
, y
, width
, height
));
3773 static void GLAPIENTRY
3774 save_WindowPos4fMESA(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3776 GET_CURRENT_CONTEXT(ctx
);
3778 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3779 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_WINDOW_POS
, 4);
3786 if (ctx
->ExecuteFlag
) {
3787 CALL_WindowPos4fMESA(ctx
->Exec
, (x
, y
, z
, w
));
3791 static void GLAPIENTRY
3792 save_WindowPos2dMESA(GLdouble x
, GLdouble y
)
3794 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3797 static void GLAPIENTRY
3798 save_WindowPos2fMESA(GLfloat x
, GLfloat y
)
3800 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3803 static void GLAPIENTRY
3804 save_WindowPos2iMESA(GLint x
, GLint y
)
3806 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3809 static void GLAPIENTRY
3810 save_WindowPos2sMESA(GLshort x
, GLshort y
)
3812 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3815 static void GLAPIENTRY
3816 save_WindowPos3dMESA(GLdouble x
, GLdouble y
, GLdouble z
)
3818 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3821 static void GLAPIENTRY
3822 save_WindowPos3fMESA(GLfloat x
, GLfloat y
, GLfloat z
)
3824 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3827 static void GLAPIENTRY
3828 save_WindowPos3iMESA(GLint x
, GLint y
, GLint z
)
3830 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3833 static void GLAPIENTRY
3834 save_WindowPos3sMESA(GLshort x
, GLshort y
, GLshort z
)
3836 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3839 static void GLAPIENTRY
3840 save_WindowPos4dMESA(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3842 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3845 static void GLAPIENTRY
3846 save_WindowPos4iMESA(GLint x
, GLint y
, GLint z
, GLint w
)
3848 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3851 static void GLAPIENTRY
3852 save_WindowPos4sMESA(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
3854 save_WindowPos4fMESA(x
, y
, z
, w
);
3857 static void GLAPIENTRY
3858 save_WindowPos2dvMESA(const GLdouble
* v
)
3860 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3863 static void GLAPIENTRY
3864 save_WindowPos2fvMESA(const GLfloat
* v
)
3866 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3869 static void GLAPIENTRY
3870 save_WindowPos2ivMESA(const GLint
* v
)
3872 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3875 static void GLAPIENTRY
3876 save_WindowPos2svMESA(const GLshort
* v
)
3878 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3881 static void GLAPIENTRY
3882 save_WindowPos3dvMESA(const GLdouble
* v
)
3884 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3887 static void GLAPIENTRY
3888 save_WindowPos3fvMESA(const GLfloat
* v
)
3890 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3893 static void GLAPIENTRY
3894 save_WindowPos3ivMESA(const GLint
* v
)
3896 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3899 static void GLAPIENTRY
3900 save_WindowPos3svMESA(const GLshort
* v
)
3902 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3905 static void GLAPIENTRY
3906 save_WindowPos4dvMESA(const GLdouble
* v
)
3908 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
3909 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3912 static void GLAPIENTRY
3913 save_WindowPos4fvMESA(const GLfloat
* v
)
3915 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3918 static void GLAPIENTRY
3919 save_WindowPos4ivMESA(const GLint
* v
)
3921 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
3922 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3925 static void GLAPIENTRY
3926 save_WindowPos4svMESA(const GLshort
* v
)
3928 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3933 /* GL_ARB_multitexture */
3934 static void GLAPIENTRY
3935 save_ActiveTextureARB(GLenum target
)
3937 GET_CURRENT_CONTEXT(ctx
);
3939 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3940 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ACTIVE_TEXTURE
, 1);
3944 if (ctx
->ExecuteFlag
) {
3945 CALL_ActiveTextureARB(ctx
->Exec
, (target
));
3950 /* GL_ARB_transpose_matrix */
3952 static void GLAPIENTRY
3953 save_LoadTransposeMatrixdARB(const GLdouble m
[16])
3956 _math_transposefd(tm
, m
);
3957 save_LoadMatrixf(tm
);
3961 static void GLAPIENTRY
3962 save_LoadTransposeMatrixfARB(const GLfloat m
[16])
3965 _math_transposef(tm
, m
);
3966 save_LoadMatrixf(tm
);
3970 static void GLAPIENTRY
3971 save_MultTransposeMatrixdARB(const GLdouble m
[16])
3974 _math_transposefd(tm
, m
);
3975 save_MultMatrixf(tm
);
3979 static void GLAPIENTRY
3980 save_MultTransposeMatrixfARB(const GLfloat m
[16])
3983 _math_transposef(tm
, m
);
3984 save_MultMatrixf(tm
);
3988 /* GL_ARB_texture_compression */
3989 static void GLAPIENTRY
3990 save_CompressedTexImage1DARB(GLenum target
, GLint level
,
3991 GLenum internalFormat
, GLsizei width
,
3992 GLint border
, GLsizei imageSize
,
3993 const GLvoid
* data
)
3995 GET_CURRENT_CONTEXT(ctx
);
3996 if (target
== GL_PROXY_TEXTURE_1D
) {
3997 /* don't compile, execute immediately */
3998 CALL_CompressedTexImage1DARB(ctx
->Exec
, (target
, level
, internalFormat
,
3999 width
, border
, imageSize
,
4005 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4006 /* make copy of image */
4007 image
= _mesa_malloc(imageSize
);
4009 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage1DARB");
4012 MEMCPY(image
, data
, imageSize
);
4013 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_1D
, 7);
4017 n
[3].e
= internalFormat
;
4018 n
[4].i
= (GLint
) width
;
4026 if (ctx
->ExecuteFlag
) {
4027 CALL_CompressedTexImage1DARB(ctx
->Exec
,
4028 (target
, level
, internalFormat
, width
,
4029 border
, imageSize
, data
));
4035 static void GLAPIENTRY
4036 save_CompressedTexImage2DARB(GLenum target
, GLint level
,
4037 GLenum internalFormat
, GLsizei width
,
4038 GLsizei height
, GLint border
, GLsizei imageSize
,
4039 const GLvoid
* data
)
4041 GET_CURRENT_CONTEXT(ctx
);
4042 if (target
== GL_PROXY_TEXTURE_2D
) {
4043 /* don't compile, execute immediately */
4044 CALL_CompressedTexImage2DARB(ctx
->Exec
, (target
, level
, internalFormat
,
4045 width
, height
, border
,
4051 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4052 /* make copy of image */
4053 image
= _mesa_malloc(imageSize
);
4055 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage2DARB");
4058 MEMCPY(image
, data
, imageSize
);
4059 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_2D
, 8);
4063 n
[3].e
= internalFormat
;
4064 n
[4].i
= (GLint
) width
;
4065 n
[5].i
= (GLint
) height
;
4073 if (ctx
->ExecuteFlag
) {
4074 CALL_CompressedTexImage2DARB(ctx
->Exec
,
4075 (target
, level
, internalFormat
, width
,
4076 height
, border
, imageSize
, data
));
4082 static void GLAPIENTRY
4083 save_CompressedTexImage3DARB(GLenum target
, GLint level
,
4084 GLenum internalFormat
, GLsizei width
,
4085 GLsizei height
, GLsizei depth
, GLint border
,
4086 GLsizei imageSize
, const GLvoid
* data
)
4088 GET_CURRENT_CONTEXT(ctx
);
4089 if (target
== GL_PROXY_TEXTURE_3D
) {
4090 /* don't compile, execute immediately */
4091 CALL_CompressedTexImage3DARB(ctx
->Exec
, (target
, level
, internalFormat
,
4092 width
, height
, depth
, border
,
4098 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4099 /* make copy of image */
4100 image
= _mesa_malloc(imageSize
);
4102 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage3DARB");
4105 MEMCPY(image
, data
, imageSize
);
4106 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_3D
, 9);
4110 n
[3].e
= internalFormat
;
4111 n
[4].i
= (GLint
) width
;
4112 n
[5].i
= (GLint
) height
;
4113 n
[6].i
= (GLint
) depth
;
4121 if (ctx
->ExecuteFlag
) {
4122 CALL_CompressedTexImage3DARB(ctx
->Exec
,
4123 (target
, level
, internalFormat
, width
,
4124 height
, depth
, border
, imageSize
,
4131 static void GLAPIENTRY
4132 save_CompressedTexSubImage1DARB(GLenum target
, GLint level
, GLint xoffset
,
4133 GLsizei width
, GLenum format
,
4134 GLsizei imageSize
, const GLvoid
* data
)
4139 GET_CURRENT_CONTEXT(ctx
);
4140 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4142 /* make copy of image */
4143 image
= _mesa_malloc(imageSize
);
4145 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage1DARB");
4148 MEMCPY(image
, data
, imageSize
);
4149 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
, 7);
4154 n
[4].i
= (GLint
) width
;
4162 if (ctx
->ExecuteFlag
) {
4163 CALL_CompressedTexSubImage1DARB(ctx
->Exec
, (target
, level
, xoffset
,
4164 width
, format
, imageSize
,
4170 static void GLAPIENTRY
4171 save_CompressedTexSubImage2DARB(GLenum target
, GLint level
, GLint xoffset
,
4172 GLint yoffset
, GLsizei width
, GLsizei height
,
4173 GLenum format
, GLsizei imageSize
,
4174 const GLvoid
* data
)
4179 GET_CURRENT_CONTEXT(ctx
);
4180 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4182 /* make copy of image */
4183 image
= _mesa_malloc(imageSize
);
4185 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage2DARB");
4188 MEMCPY(image
, data
, imageSize
);
4189 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
, 9);
4195 n
[5].i
= (GLint
) width
;
4196 n
[6].i
= (GLint
) height
;
4204 if (ctx
->ExecuteFlag
) {
4205 CALL_CompressedTexSubImage2DARB(ctx
->Exec
,
4206 (target
, level
, xoffset
, yoffset
, width
,
4207 height
, format
, imageSize
, data
));
4212 static void GLAPIENTRY
4213 save_CompressedTexSubImage3DARB(GLenum target
, GLint level
, GLint xoffset
,
4214 GLint yoffset
, GLint zoffset
, GLsizei width
,
4215 GLsizei height
, GLsizei depth
, GLenum format
,
4216 GLsizei imageSize
, const GLvoid
* data
)
4221 GET_CURRENT_CONTEXT(ctx
);
4222 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4224 /* make copy of image */
4225 image
= _mesa_malloc(imageSize
);
4227 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage3DARB");
4230 MEMCPY(image
, data
, imageSize
);
4231 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
, 11);
4238 n
[6].i
= (GLint
) width
;
4239 n
[7].i
= (GLint
) height
;
4240 n
[8].i
= (GLint
) depth
;
4242 n
[10].i
= imageSize
;
4248 if (ctx
->ExecuteFlag
) {
4249 CALL_CompressedTexSubImage3DARB(ctx
->Exec
,
4250 (target
, level
, xoffset
, yoffset
,
4251 zoffset
, width
, height
, depth
, format
,
4257 /* GL_ARB_multisample */
4258 static void GLAPIENTRY
4259 save_SampleCoverageARB(GLclampf value
, GLboolean invert
)
4261 GET_CURRENT_CONTEXT(ctx
);
4263 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4264 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SAMPLE_COVERAGE
, 2);
4269 if (ctx
->ExecuteFlag
) {
4270 CALL_SampleCoverageARB(ctx
->Exec
, (value
, invert
));
4276 * GL_NV_vertex_program
4278 #if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
4279 static void GLAPIENTRY
4280 save_BindProgramNV(GLenum target
, GLuint id
)
4282 GET_CURRENT_CONTEXT(ctx
);
4284 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4285 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BIND_PROGRAM_NV
, 2);
4290 if (ctx
->ExecuteFlag
) {
4291 CALL_BindProgramNV(ctx
->Exec
, (target
, id
));
4295 static void GLAPIENTRY
4296 save_ProgramEnvParameter4fARB(GLenum target
, GLuint index
,
4297 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4299 GET_CURRENT_CONTEXT(ctx
);
4301 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4302 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4311 if (ctx
->ExecuteFlag
) {
4312 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4317 static void GLAPIENTRY
4318 save_ProgramEnvParameter4fvARB(GLenum target
, GLuint index
,
4319 const GLfloat
*params
)
4321 save_ProgramEnvParameter4fARB(target
, index
, params
[0], params
[1],
4322 params
[2], params
[3]);
4326 static void GLAPIENTRY
4327 save_ProgramEnvParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4328 const GLfloat
* params
)
4330 GET_CURRENT_CONTEXT(ctx
);
4332 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4336 const GLfloat
* p
= params
;
4338 for (i
= 0 ; i
< count
; i
++) {
4339 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4352 if (ctx
->ExecuteFlag
) {
4353 CALL_ProgramEnvParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4358 static void GLAPIENTRY
4359 save_ProgramEnvParameter4dARB(GLenum target
, GLuint index
,
4360 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4362 save_ProgramEnvParameter4fARB(target
, index
,
4364 (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4368 static void GLAPIENTRY
4369 save_ProgramEnvParameter4dvARB(GLenum target
, GLuint index
,
4370 const GLdouble
*params
)
4372 save_ProgramEnvParameter4fARB(target
, index
,
4373 (GLfloat
) params
[0],
4374 (GLfloat
) params
[1],
4375 (GLfloat
) params
[2], (GLfloat
) params
[3]);
4378 #endif /* FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program || FEATURE_NV_vertex_program */
4380 #if FEATURE_NV_vertex_program
4381 static void GLAPIENTRY
4382 save_ExecuteProgramNV(GLenum target
, GLuint id
, const GLfloat
*params
)
4384 GET_CURRENT_CONTEXT(ctx
);
4386 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4387 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EXECUTE_PROGRAM_NV
, 6);
4396 if (ctx
->ExecuteFlag
) {
4397 CALL_ExecuteProgramNV(ctx
->Exec
, (target
, id
, params
));
4402 static void GLAPIENTRY
4403 save_ProgramParameters4dvNV(GLenum target
, GLuint index
,
4404 GLuint num
, const GLdouble
*params
)
4407 for (i
= 0; i
< num
; i
++) {
4408 save_ProgramEnvParameter4dvARB(target
, index
+ i
, params
+ 4 * i
);
4413 static void GLAPIENTRY
4414 save_ProgramParameters4fvNV(GLenum target
, GLuint index
,
4415 GLuint num
, const GLfloat
*params
)
4418 for (i
= 0; i
< num
; i
++) {
4419 save_ProgramEnvParameter4fvARB(target
, index
+ i
, params
+ 4 * i
);
4424 static void GLAPIENTRY
4425 save_LoadProgramNV(GLenum target
, GLuint id
, GLsizei len
,
4426 const GLubyte
* program
)
4428 GET_CURRENT_CONTEXT(ctx
);
4430 GLubyte
*programCopy
;
4432 programCopy
= (GLubyte
*) _mesa_malloc(len
);
4434 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glLoadProgramNV");
4437 _mesa_memcpy(programCopy
, program
, len
);
4439 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4440 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LOAD_PROGRAM_NV
, 4);
4445 n
[4].data
= programCopy
;
4447 if (ctx
->ExecuteFlag
) {
4448 CALL_LoadProgramNV(ctx
->Exec
, (target
, id
, len
, program
));
4453 static void GLAPIENTRY
4454 save_RequestResidentProgramsNV(GLsizei num
, const GLuint
* ids
)
4456 GET_CURRENT_CONTEXT(ctx
);
4458 GLuint
*idCopy
= (GLuint
*) _mesa_malloc(num
* sizeof(GLuint
));
4460 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glRequestResidentProgramsNV");
4463 _mesa_memcpy(idCopy
, ids
, num
* sizeof(GLuint
));
4464 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4465 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TRACK_MATRIX_NV
, 2);
4470 if (ctx
->ExecuteFlag
) {
4471 CALL_RequestResidentProgramsNV(ctx
->Exec
, (num
, ids
));
4476 static void GLAPIENTRY
4477 save_TrackMatrixNV(GLenum target
, GLuint address
,
4478 GLenum matrix
, GLenum transform
)
4480 GET_CURRENT_CONTEXT(ctx
);
4482 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4483 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TRACK_MATRIX_NV
, 4);
4490 if (ctx
->ExecuteFlag
) {
4491 CALL_TrackMatrixNV(ctx
->Exec
, (target
, address
, matrix
, transform
));
4494 #endif /* FEATURE_NV_vertex_program */
4498 * GL_NV_fragment_program
4500 #if FEATURE_NV_fragment_program
4501 static void GLAPIENTRY
4502 save_ProgramLocalParameter4fARB(GLenum target
, GLuint index
,
4503 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4505 GET_CURRENT_CONTEXT(ctx
);
4507 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4508 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4517 if (ctx
->ExecuteFlag
) {
4518 CALL_ProgramLocalParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4523 static void GLAPIENTRY
4524 save_ProgramLocalParameter4fvARB(GLenum target
, GLuint index
,
4525 const GLfloat
*params
)
4527 GET_CURRENT_CONTEXT(ctx
);
4529 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4530 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4539 if (ctx
->ExecuteFlag
) {
4540 CALL_ProgramLocalParameter4fvARB(ctx
->Exec
, (target
, index
, params
));
4545 static void GLAPIENTRY
4546 save_ProgramLocalParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4547 const GLfloat
*params
)
4549 GET_CURRENT_CONTEXT(ctx
);
4551 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4555 const GLfloat
* p
= params
;
4557 for (i
= 0 ; i
< count
; i
++) {
4558 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4571 if (ctx
->ExecuteFlag
) {
4572 CALL_ProgramLocalParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4577 static void GLAPIENTRY
4578 save_ProgramLocalParameter4dARB(GLenum target
, GLuint index
,
4579 GLdouble x
, GLdouble y
,
4580 GLdouble z
, GLdouble w
)
4582 GET_CURRENT_CONTEXT(ctx
);
4584 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4585 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4589 n
[3].f
= (GLfloat
) x
;
4590 n
[4].f
= (GLfloat
) y
;
4591 n
[5].f
= (GLfloat
) z
;
4592 n
[6].f
= (GLfloat
) w
;
4594 if (ctx
->ExecuteFlag
) {
4595 CALL_ProgramLocalParameter4dARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4600 static void GLAPIENTRY
4601 save_ProgramLocalParameter4dvARB(GLenum target
, GLuint index
,
4602 const GLdouble
*params
)
4604 GET_CURRENT_CONTEXT(ctx
);
4606 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4607 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4611 n
[3].f
= (GLfloat
) params
[0];
4612 n
[4].f
= (GLfloat
) params
[1];
4613 n
[5].f
= (GLfloat
) params
[2];
4614 n
[6].f
= (GLfloat
) params
[3];
4616 if (ctx
->ExecuteFlag
) {
4617 CALL_ProgramLocalParameter4dvARB(ctx
->Exec
, (target
, index
, params
));
4621 static void GLAPIENTRY
4622 save_ProgramNamedParameter4fNV(GLuint id
, GLsizei len
, const GLubyte
* name
,
4623 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4625 GET_CURRENT_CONTEXT(ctx
);
4627 GLubyte
*nameCopy
= (GLubyte
*) _mesa_malloc(len
);
4629 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramNamedParameter4fNV");
4632 _mesa_memcpy(nameCopy
, name
, len
);
4634 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4635 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_NAMED_PARAMETER_NV
, 6);
4639 n
[3].data
= nameCopy
;
4645 if (ctx
->ExecuteFlag
) {
4646 CALL_ProgramNamedParameter4fNV(ctx
->Exec
, (id
, len
, name
, x
, y
, z
, w
));
4651 static void GLAPIENTRY
4652 save_ProgramNamedParameter4fvNV(GLuint id
, GLsizei len
, const GLubyte
* name
,
4655 save_ProgramNamedParameter4fNV(id
, len
, name
, v
[0], v
[1], v
[2], v
[3]);
4659 static void GLAPIENTRY
4660 save_ProgramNamedParameter4dNV(GLuint id
, GLsizei len
, const GLubyte
* name
,
4661 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4663 save_ProgramNamedParameter4fNV(id
, len
, name
, (GLfloat
) x
, (GLfloat
) y
,
4664 (GLfloat
) z
, (GLfloat
) w
);
4668 static void GLAPIENTRY
4669 save_ProgramNamedParameter4dvNV(GLuint id
, GLsizei len
, const GLubyte
* name
,
4672 save_ProgramNamedParameter4fNV(id
, len
, name
, (GLfloat
) v
[0],
4673 (GLfloat
) v
[1], (GLfloat
) v
[2],
4677 #endif /* FEATURE_NV_fragment_program */
4681 /* GL_EXT_stencil_two_side */
4682 static void GLAPIENTRY
4683 save_ActiveStencilFaceEXT(GLenum face
)
4685 GET_CURRENT_CONTEXT(ctx
);
4687 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4688 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ACTIVE_STENCIL_FACE_EXT
, 1);
4692 if (ctx
->ExecuteFlag
) {
4693 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (face
));
4698 /* GL_EXT_depth_bounds_test */
4699 static void GLAPIENTRY
4700 save_DepthBoundsEXT(GLclampd zmin
, GLclampd zmax
)
4702 GET_CURRENT_CONTEXT(ctx
);
4704 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4705 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DEPTH_BOUNDS_EXT
, 2);
4707 n
[1].f
= (GLfloat
) zmin
;
4708 n
[2].f
= (GLfloat
) zmax
;
4710 if (ctx
->ExecuteFlag
) {
4711 CALL_DepthBoundsEXT(ctx
->Exec
, (zmin
, zmax
));
4717 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
4719 static void GLAPIENTRY
4720 save_ProgramStringARB(GLenum target
, GLenum format
, GLsizei len
,
4721 const GLvoid
* string
)
4723 GET_CURRENT_CONTEXT(ctx
);
4725 GLubyte
*programCopy
;
4727 programCopy
= (GLubyte
*) _mesa_malloc(len
);
4729 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramStringARB");
4732 _mesa_memcpy(programCopy
, string
, len
);
4734 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4735 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_STRING_ARB
, 4);
4740 n
[4].data
= programCopy
;
4742 if (ctx
->ExecuteFlag
) {
4743 CALL_ProgramStringARB(ctx
->Exec
, (target
, format
, len
, string
));
4747 #endif /* FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program */
4750 #if FEATURE_ARB_occlusion_query
4752 static void GLAPIENTRY
4753 save_BeginQueryARB(GLenum target
, GLuint id
)
4755 GET_CURRENT_CONTEXT(ctx
);
4757 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4758 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BEGIN_QUERY_ARB
, 2);
4763 if (ctx
->ExecuteFlag
) {
4764 CALL_BeginQueryARB(ctx
->Exec
, (target
, id
));
4769 static void GLAPIENTRY
4770 save_EndQueryARB(GLenum target
)
4772 GET_CURRENT_CONTEXT(ctx
);
4774 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4775 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_END_QUERY_ARB
, 1);
4779 if (ctx
->ExecuteFlag
) {
4780 CALL_EndQueryARB(ctx
->Exec
, (target
));
4784 #endif /* FEATURE_ARB_occlusion_query */
4787 static void GLAPIENTRY
4788 save_DrawBuffersARB(GLsizei count
, const GLenum
* buffers
)
4790 GET_CURRENT_CONTEXT(ctx
);
4792 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4793 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DRAW_BUFFERS_ARB
, 1 + MAX_DRAW_BUFFERS
);
4797 if (count
> MAX_DRAW_BUFFERS
)
4798 count
= MAX_DRAW_BUFFERS
;
4799 for (i
= 0; i
< count
; i
++) {
4800 n
[2 + i
].e
= buffers
[i
];
4803 if (ctx
->ExecuteFlag
) {
4804 CALL_DrawBuffersARB(ctx
->Exec
, (count
, buffers
));
4808 static void GLAPIENTRY
4809 save_TexBumpParameterfvATI(GLenum pname
, const GLfloat
*param
)
4811 GET_CURRENT_CONTEXT(ctx
);
4814 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_BUMP_PARAMETER_ATI
, 5);
4822 if (ctx
->ExecuteFlag
) {
4823 CALL_TexBumpParameterfvATI(ctx
->Exec
, (pname
, param
));
4827 static void GLAPIENTRY
4828 save_TexBumpParameterivATI(GLenum pname
, const GLint
*param
)
4831 p
[0] = INT_TO_FLOAT(param
[0]);
4832 p
[1] = INT_TO_FLOAT(param
[1]);
4833 p
[2] = INT_TO_FLOAT(param
[2]);
4834 p
[3] = INT_TO_FLOAT(param
[3]);
4835 save_TexBumpParameterfvATI(pname
, p
);
4838 #if FEATURE_ATI_fragment_shader
4839 static void GLAPIENTRY
4840 save_BindFragmentShaderATI(GLuint id
)
4842 GET_CURRENT_CONTEXT(ctx
);
4845 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BIND_FRAGMENT_SHADER_ATI
, 1);
4849 if (ctx
->ExecuteFlag
) {
4850 CALL_BindFragmentShaderATI(ctx
->Exec
, (id
));
4854 static void GLAPIENTRY
4855 save_SetFragmentShaderConstantATI(GLuint dst
, const GLfloat
*value
)
4857 GET_CURRENT_CONTEXT(ctx
);
4860 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
, 5);
4868 if (ctx
->ExecuteFlag
) {
4869 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, value
));
4875 save_Attr1fNV(GLenum attr
, GLfloat x
)
4877 GET_CURRENT_CONTEXT(ctx
);
4879 SAVE_FLUSH_VERTICES(ctx
);
4880 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_1F_NV
, 2);
4886 ASSERT(attr
< MAX_VERTEX_PROGRAM_ATTRIBS
);
4887 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
4888 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
4890 if (ctx
->ExecuteFlag
) {
4891 CALL_VertexAttrib1fNV(ctx
->Exec
, (attr
, x
));
4896 save_Attr2fNV(GLenum attr
, GLfloat x
, GLfloat y
)
4898 GET_CURRENT_CONTEXT(ctx
);
4900 SAVE_FLUSH_VERTICES(ctx
);
4901 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_2F_NV
, 3);
4908 ASSERT(attr
< MAX_VERTEX_PROGRAM_ATTRIBS
);
4909 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
4910 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
4912 if (ctx
->ExecuteFlag
) {
4913 CALL_VertexAttrib2fNV(ctx
->Exec
, (attr
, x
, y
));
4918 save_Attr3fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
4920 GET_CURRENT_CONTEXT(ctx
);
4922 SAVE_FLUSH_VERTICES(ctx
);
4923 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_3F_NV
, 4);
4931 ASSERT(attr
< MAX_VERTEX_PROGRAM_ATTRIBS
);
4932 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
4933 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
4935 if (ctx
->ExecuteFlag
) {
4936 CALL_VertexAttrib3fNV(ctx
->Exec
, (attr
, x
, y
, z
));
4941 save_Attr4fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4943 GET_CURRENT_CONTEXT(ctx
);
4945 SAVE_FLUSH_VERTICES(ctx
);
4946 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_4F_NV
, 5);
4955 ASSERT(attr
< MAX_VERTEX_PROGRAM_ATTRIBS
);
4956 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
4957 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
4959 if (ctx
->ExecuteFlag
) {
4960 CALL_VertexAttrib4fNV(ctx
->Exec
, (attr
, x
, y
, z
, w
));
4966 save_Attr1fARB(GLenum attr
, GLfloat x
)
4968 GET_CURRENT_CONTEXT(ctx
);
4970 SAVE_FLUSH_VERTICES(ctx
);
4971 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_1F_ARB
, 2);
4977 ASSERT(attr
< MAX_VERTEX_ATTRIBS
);
4978 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
4979 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
4981 if (ctx
->ExecuteFlag
) {
4982 CALL_VertexAttrib1fARB(ctx
->Exec
, (attr
, x
));
4987 save_Attr2fARB(GLenum attr
, GLfloat x
, GLfloat y
)
4989 GET_CURRENT_CONTEXT(ctx
);
4991 SAVE_FLUSH_VERTICES(ctx
);
4992 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_2F_ARB
, 3);
4999 ASSERT(attr
< MAX_VERTEX_ATTRIBS
);
5000 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
5001 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
5003 if (ctx
->ExecuteFlag
) {
5004 CALL_VertexAttrib2fARB(ctx
->Exec
, (attr
, x
, y
));
5009 save_Attr3fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
5011 GET_CURRENT_CONTEXT(ctx
);
5013 SAVE_FLUSH_VERTICES(ctx
);
5014 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_3F_ARB
, 4);
5022 ASSERT(attr
< MAX_VERTEX_ATTRIBS
);
5023 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
5024 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
5026 if (ctx
->ExecuteFlag
) {
5027 CALL_VertexAttrib3fARB(ctx
->Exec
, (attr
, x
, y
, z
));
5032 save_Attr4fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5034 GET_CURRENT_CONTEXT(ctx
);
5036 SAVE_FLUSH_VERTICES(ctx
);
5037 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_4F_ARB
, 5);
5046 ASSERT(attr
< MAX_VERTEX_ATTRIBS
);
5047 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5048 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5050 if (ctx
->ExecuteFlag
) {
5051 CALL_VertexAttrib4fARB(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5056 static void GLAPIENTRY
5057 save_EvalCoord1f(GLfloat x
)
5059 GET_CURRENT_CONTEXT(ctx
);
5061 SAVE_FLUSH_VERTICES(ctx
);
5062 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVAL_C1
, 1);
5066 if (ctx
->ExecuteFlag
) {
5067 CALL_EvalCoord1f(ctx
->Exec
, (x
));
5071 static void GLAPIENTRY
5072 save_EvalCoord1fv(const GLfloat
* v
)
5074 save_EvalCoord1f(v
[0]);
5077 static void GLAPIENTRY
5078 save_EvalCoord2f(GLfloat x
, GLfloat y
)
5080 GET_CURRENT_CONTEXT(ctx
);
5082 SAVE_FLUSH_VERTICES(ctx
);
5083 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVAL_C2
, 2);
5088 if (ctx
->ExecuteFlag
) {
5089 CALL_EvalCoord2f(ctx
->Exec
, (x
, y
));
5093 static void GLAPIENTRY
5094 save_EvalCoord2fv(const GLfloat
* v
)
5096 save_EvalCoord2f(v
[0], v
[1]);
5100 static void GLAPIENTRY
5101 save_EvalPoint1(GLint x
)
5103 GET_CURRENT_CONTEXT(ctx
);
5105 SAVE_FLUSH_VERTICES(ctx
);
5106 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVAL_P1
, 1);
5110 if (ctx
->ExecuteFlag
) {
5111 CALL_EvalPoint1(ctx
->Exec
, (x
));
5115 static void GLAPIENTRY
5116 save_EvalPoint2(GLint x
, GLint y
)
5118 GET_CURRENT_CONTEXT(ctx
);
5120 SAVE_FLUSH_VERTICES(ctx
);
5121 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVAL_P2
, 2);
5126 if (ctx
->ExecuteFlag
) {
5127 CALL_EvalPoint2(ctx
->Exec
, (x
, y
));
5131 static void GLAPIENTRY
5132 save_Indexf(GLfloat x
)
5134 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, x
);
5137 static void GLAPIENTRY
5138 save_Indexfv(const GLfloat
* v
)
5140 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, v
[0]);
5143 static void GLAPIENTRY
5144 save_EdgeFlag(GLboolean x
)
5146 save_Attr1fNV(VERT_ATTRIB_EDGEFLAG
, x
? (GLfloat
)1.0 : (GLfloat
)0.0);
5149 static void GLAPIENTRY
5150 save_Materialfv(GLenum face
, GLenum pname
, const GLfloat
* param
)
5152 GET_CURRENT_CONTEXT(ctx
);
5156 SAVE_FLUSH_VERTICES(ctx
);
5161 case GL_FRONT_AND_BACK
:
5164 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "material(face)");
5173 case GL_AMBIENT_AND_DIFFUSE
:
5179 case GL_COLOR_INDEXES
:
5183 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "material(pname)");
5187 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MATERIAL
, 6);
5191 for (i
= 0; i
< args
; i
++)
5192 n
[3 + i
].f
= param
[i
];
5196 GLuint bitmask
= _mesa_material_bitmask(ctx
, face
, pname
, ~0, NULL
);
5197 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++)
5198 if (bitmask
& (1 << i
)) {
5199 ctx
->ListState
.ActiveMaterialSize
[i
] = args
;
5200 COPY_SZ_4V(ctx
->ListState
.CurrentMaterial
[i
], args
, param
);
5204 if (ctx
->ExecuteFlag
) {
5205 CALL_Materialfv(ctx
->Exec
, (face
, pname
, param
));
5209 static void GLAPIENTRY
5210 save_Begin(GLenum mode
)
5212 GET_CURRENT_CONTEXT(ctx
);
5214 GLboolean error
= GL_FALSE
;
5216 if ( /*mode < GL_POINTS || */ mode
> GL_POLYGON
) {
5217 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "Begin (mode)");
5220 else if (ctx
->Driver
.CurrentSavePrimitive
== PRIM_UNKNOWN
) {
5221 /* Typically the first begin. This may raise an error on
5222 * playback, depending on whether CallList is issued from inside
5223 * a begin/end or not.
5225 ctx
->Driver
.CurrentSavePrimitive
= PRIM_INSIDE_UNKNOWN_PRIM
;
5227 else if (ctx
->Driver
.CurrentSavePrimitive
== PRIM_OUTSIDE_BEGIN_END
) {
5228 ctx
->Driver
.CurrentSavePrimitive
= mode
;
5231 _mesa_compile_error(ctx
, GL_INVALID_OPERATION
, "recursive begin");
5236 /* Give the driver an opportunity to hook in an optimized
5237 * display list compiler.
5239 if (ctx
->Driver
.NotifySaveBegin(ctx
, mode
))
5242 SAVE_FLUSH_VERTICES(ctx
);
5243 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BEGIN
, 1);
5249 if (ctx
->ExecuteFlag
) {
5250 CALL_Begin(ctx
->Exec
, (mode
));
5254 static void GLAPIENTRY
5257 GET_CURRENT_CONTEXT(ctx
);
5258 SAVE_FLUSH_VERTICES(ctx
);
5259 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_END
, 0);
5260 ctx
->Driver
.CurrentSavePrimitive
= PRIM_OUTSIDE_BEGIN_END
;
5261 if (ctx
->ExecuteFlag
) {
5262 CALL_End(ctx
->Exec
, ());
5266 static void GLAPIENTRY
5267 save_Rectf(GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
5269 GET_CURRENT_CONTEXT(ctx
);
5271 SAVE_FLUSH_VERTICES(ctx
);
5272 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_RECTF
, 4);
5279 if (ctx
->ExecuteFlag
) {
5280 CALL_Rectf(ctx
->Exec
, (a
, b
, c
, d
));
5285 static void GLAPIENTRY
5286 save_Vertex2f(GLfloat x
, GLfloat y
)
5288 save_Attr2fNV(VERT_ATTRIB_POS
, x
, y
);
5291 static void GLAPIENTRY
5292 save_Vertex2fv(const GLfloat
* v
)
5294 save_Attr2fNV(VERT_ATTRIB_POS
, v
[0], v
[1]);
5297 static void GLAPIENTRY
5298 save_Vertex3f(GLfloat x
, GLfloat y
, GLfloat z
)
5300 save_Attr3fNV(VERT_ATTRIB_POS
, x
, y
, z
);
5303 static void GLAPIENTRY
5304 save_Vertex3fv(const GLfloat
* v
)
5306 save_Attr3fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2]);
5309 static void GLAPIENTRY
5310 save_Vertex4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5312 save_Attr4fNV(VERT_ATTRIB_POS
, x
, y
, z
, w
);
5315 static void GLAPIENTRY
5316 save_Vertex4fv(const GLfloat
* v
)
5318 save_Attr4fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2], v
[3]);
5321 static void GLAPIENTRY
5322 save_TexCoord1f(GLfloat x
)
5324 save_Attr1fNV(VERT_ATTRIB_TEX0
, x
);
5327 static void GLAPIENTRY
5328 save_TexCoord1fv(const GLfloat
* v
)
5330 save_Attr1fNV(VERT_ATTRIB_TEX0
, v
[0]);
5333 static void GLAPIENTRY
5334 save_TexCoord2f(GLfloat x
, GLfloat y
)
5336 save_Attr2fNV(VERT_ATTRIB_TEX0
, x
, y
);
5339 static void GLAPIENTRY
5340 save_TexCoord2fv(const GLfloat
* v
)
5342 save_Attr2fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1]);
5345 static void GLAPIENTRY
5346 save_TexCoord3f(GLfloat x
, GLfloat y
, GLfloat z
)
5348 save_Attr3fNV(VERT_ATTRIB_TEX0
, x
, y
, z
);
5351 static void GLAPIENTRY
5352 save_TexCoord3fv(const GLfloat
* v
)
5354 save_Attr3fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2]);
5357 static void GLAPIENTRY
5358 save_TexCoord4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5360 save_Attr4fNV(VERT_ATTRIB_TEX0
, x
, y
, z
, w
);
5363 static void GLAPIENTRY
5364 save_TexCoord4fv(const GLfloat
* v
)
5366 save_Attr4fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2], v
[3]);
5369 static void GLAPIENTRY
5370 save_Normal3f(GLfloat x
, GLfloat y
, GLfloat z
)
5372 save_Attr3fNV(VERT_ATTRIB_NORMAL
, x
, y
, z
);
5375 static void GLAPIENTRY
5376 save_Normal3fv(const GLfloat
* v
)
5378 save_Attr3fNV(VERT_ATTRIB_NORMAL
, v
[0], v
[1], v
[2]);
5381 static void GLAPIENTRY
5382 save_FogCoordfEXT(GLfloat x
)
5384 save_Attr1fNV(VERT_ATTRIB_FOG
, x
);
5387 static void GLAPIENTRY
5388 save_FogCoordfvEXT(const GLfloat
* v
)
5390 save_Attr1fNV(VERT_ATTRIB_FOG
, v
[0]);
5393 static void GLAPIENTRY
5394 save_Color3f(GLfloat x
, GLfloat y
, GLfloat z
)
5396 save_Attr3fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
);
5399 static void GLAPIENTRY
5400 save_Color3fv(const GLfloat
* v
)
5402 save_Attr3fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2]);
5405 static void GLAPIENTRY
5406 save_Color4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5408 save_Attr4fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
, w
);
5411 static void GLAPIENTRY
5412 save_Color4fv(const GLfloat
* v
)
5414 save_Attr4fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2], v
[3]);
5417 static void GLAPIENTRY
5418 save_SecondaryColor3fEXT(GLfloat x
, GLfloat y
, GLfloat z
)
5420 save_Attr3fNV(VERT_ATTRIB_COLOR1
, x
, y
, z
);
5423 static void GLAPIENTRY
5424 save_SecondaryColor3fvEXT(const GLfloat
* v
)
5426 save_Attr3fNV(VERT_ATTRIB_COLOR1
, v
[0], v
[1], v
[2]);
5430 /* Just call the respective ATTR for texcoord
5432 static void GLAPIENTRY
5433 save_MultiTexCoord1f(GLenum target
, GLfloat x
)
5435 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5436 save_Attr1fNV(attr
, x
);
5439 static void GLAPIENTRY
5440 save_MultiTexCoord1fv(GLenum target
, const GLfloat
* v
)
5442 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5443 save_Attr1fNV(attr
, v
[0]);
5446 static void GLAPIENTRY
5447 save_MultiTexCoord2f(GLenum target
, GLfloat x
, GLfloat y
)
5449 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5450 save_Attr2fNV(attr
, x
, y
);
5453 static void GLAPIENTRY
5454 save_MultiTexCoord2fv(GLenum target
, const GLfloat
* v
)
5456 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5457 save_Attr2fNV(attr
, v
[0], v
[1]);
5460 static void GLAPIENTRY
5461 save_MultiTexCoord3f(GLenum target
, GLfloat x
, GLfloat y
, GLfloat z
)
5463 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5464 save_Attr3fNV(attr
, x
, y
, z
);
5467 static void GLAPIENTRY
5468 save_MultiTexCoord3fv(GLenum target
, const GLfloat
* v
)
5470 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5471 save_Attr3fNV(attr
, v
[0], v
[1], v
[2]);
5474 static void GLAPIENTRY
5475 save_MultiTexCoord4f(GLenum target
, GLfloat x
, GLfloat y
,
5476 GLfloat z
, GLfloat w
)
5478 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5479 save_Attr4fNV(attr
, x
, y
, z
, w
);
5482 static void GLAPIENTRY
5483 save_MultiTexCoord4fv(GLenum target
, const GLfloat
* v
)
5485 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5486 save_Attr4fNV(attr
, v
[0], v
[1], v
[2], v
[3]);
5491 * Record a GL_INVALID_VALUE error when a invalid vertex attribute
5497 GET_CURRENT_CONTEXT(ctx
);
5498 _mesa_error(ctx
, GL_INVALID_VALUE
, "VertexAttribf(index)");
5502 /* First level for NV_vertex_program:
5504 * Check for errors at compile time?.
5506 static void GLAPIENTRY
5507 save_VertexAttrib1fNV(GLuint index
, GLfloat x
)
5509 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5510 save_Attr1fNV(index
, x
);
5515 static void GLAPIENTRY
5516 save_VertexAttrib1fvNV(GLuint index
, const GLfloat
* v
)
5518 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5519 save_Attr1fNV(index
, v
[0]);
5524 static void GLAPIENTRY
5525 save_VertexAttrib2fNV(GLuint index
, GLfloat x
, GLfloat y
)
5527 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5528 save_Attr2fNV(index
, x
, y
);
5533 static void GLAPIENTRY
5534 save_VertexAttrib2fvNV(GLuint index
, const GLfloat
* v
)
5536 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5537 save_Attr2fNV(index
, v
[0], v
[1]);
5542 static void GLAPIENTRY
5543 save_VertexAttrib3fNV(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
5545 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5546 save_Attr3fNV(index
, x
, y
, z
);
5551 static void GLAPIENTRY
5552 save_VertexAttrib3fvNV(GLuint index
, const GLfloat
* v
)
5554 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5555 save_Attr3fNV(index
, v
[0], v
[1], v
[2]);
5560 static void GLAPIENTRY
5561 save_VertexAttrib4fNV(GLuint index
, GLfloat x
, GLfloat y
,
5562 GLfloat z
, GLfloat w
)
5564 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5565 save_Attr4fNV(index
, x
, y
, z
, w
);
5570 static void GLAPIENTRY
5571 save_VertexAttrib4fvNV(GLuint index
, const GLfloat
* v
)
5573 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5574 save_Attr4fNV(index
, v
[0], v
[1], v
[2], v
[3]);
5582 static void GLAPIENTRY
5583 save_VertexAttrib1fARB(GLuint index
, GLfloat x
)
5585 if (index
< MAX_VERTEX_ATTRIBS
)
5586 save_Attr1fARB(index
, x
);
5591 static void GLAPIENTRY
5592 save_VertexAttrib1fvARB(GLuint index
, const GLfloat
* v
)
5594 if (index
< MAX_VERTEX_ATTRIBS
)
5595 save_Attr1fARB(index
, v
[0]);
5600 static void GLAPIENTRY
5601 save_VertexAttrib2fARB(GLuint index
, GLfloat x
, GLfloat y
)
5603 if (index
< MAX_VERTEX_ATTRIBS
)
5604 save_Attr2fARB(index
, x
, y
);
5609 static void GLAPIENTRY
5610 save_VertexAttrib2fvARB(GLuint index
, const GLfloat
* v
)
5612 if (index
< MAX_VERTEX_ATTRIBS
)
5613 save_Attr2fARB(index
, v
[0], v
[1]);
5618 static void GLAPIENTRY
5619 save_VertexAttrib3fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
5621 if (index
< MAX_VERTEX_ATTRIBS
)
5622 save_Attr3fARB(index
, x
, y
, z
);
5627 static void GLAPIENTRY
5628 save_VertexAttrib3fvARB(GLuint index
, const GLfloat
* v
)
5630 if (index
< MAX_VERTEX_ATTRIBS
)
5631 save_Attr3fARB(index
, v
[0], v
[1], v
[2]);
5636 static void GLAPIENTRY
5637 save_VertexAttrib4fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
,
5640 if (index
< MAX_VERTEX_ATTRIBS
)
5641 save_Attr4fARB(index
, x
, y
, z
, w
);
5646 static void GLAPIENTRY
5647 save_VertexAttrib4fvARB(GLuint index
, const GLfloat
* v
)
5649 if (index
< MAX_VERTEX_ATTRIBS
)
5650 save_Attr4fARB(index
, v
[0], v
[1], v
[2], v
[3]);
5656 /* GL_ARB_shader_objects, GL_ARB_vertex/fragment_shader */
5658 static void GLAPIENTRY
5659 exec_BindAttribLocationARB(GLuint program
, GLuint index
, const GLchar
*name
)
5661 GET_CURRENT_CONTEXT(ctx
);
5662 FLUSH_VERTICES(ctx
, 0);
5663 CALL_BindAttribLocationARB(ctx
->Exec
, (program
, index
, name
));
5666 static GLint GLAPIENTRY
5667 exec_GetAttribLocationARB(GLuint program
, const GLchar
*name
)
5669 GET_CURRENT_CONTEXT(ctx
);
5670 FLUSH_VERTICES(ctx
, 0);
5671 return CALL_GetAttribLocationARB(ctx
->Exec
, (program
, name
));
5673 /* XXX more shader functions needed here */
5677 #if FEATURE_EXT_framebuffer_blit
5678 static void GLAPIENTRY
5679 save_BlitFramebufferEXT(GLint srcX0
, GLint srcY0
, GLint srcX1
, GLint srcY1
,
5680 GLint dstX0
, GLint dstY0
, GLint dstX1
, GLint dstY1
,
5681 GLbitfield mask
, GLenum filter
)
5683 GET_CURRENT_CONTEXT(ctx
);
5685 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5686 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BLIT_FRAMEBUFFER
, 10);
5699 if (ctx
->ExecuteFlag
) {
5700 CALL_BlitFramebufferEXT(ctx
->Exec
, (srcX0
, srcY0
, srcX1
, srcY1
,
5701 dstX0
, dstY0
, dstX1
, dstY1
,
5709 * Save an error-generating command into display list.
5711 * KW: Will appear in the list before the vertex buffer containing the
5712 * command that provoked the error. I don't see this as a problem.
5715 save_error(GLcontext
*ctx
, GLenum error
, const char *s
)
5718 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ERROR
, 2);
5721 n
[2].data
= (void *) s
;
5727 * Compile an error into current display list.
5730 _mesa_compile_error(GLcontext
*ctx
, GLenum error
, const char *s
)
5732 if (ctx
->CompileFlag
)
5733 save_error(ctx
, error
, s
);
5734 if (ctx
->ExecuteFlag
)
5735 _mesa_error(ctx
, error
, s
);
5740 * Test if ID names a display list.
5743 islist(GLcontext
*ctx
, GLuint list
)
5745 if (list
> 0 && lookup_list(ctx
, list
)) {
5755 /**********************************************************************/
5756 /* Display list execution */
5757 /**********************************************************************/
5761 * Execute a display list. Note that the ListBase offset must have already
5762 * been added before calling this function. I.e. the list argument is
5763 * the absolute list number, not relative to ListBase.
5764 * \param list - display list number
5767 execute_list(GLcontext
*ctx
, GLuint list
)
5769 struct gl_display_list
*dlist
;
5773 if (list
== 0 || !islist(ctx
, list
))
5776 if (ctx
->ListState
.CallDepth
== MAX_LIST_NESTING
) {
5777 /* raise an error? */
5781 dlist
= lookup_list(ctx
, list
);
5785 ctx
->ListState
.CallDepth
++;
5787 if (ctx
->Driver
.BeginCallList
)
5788 ctx
->Driver
.BeginCallList(ctx
, dlist
);
5794 OpCode opcode
= n
[0].opcode
;
5795 int i
= (int) n
[0].opcode
- (int) OPCODE_EXT_0
;
5797 if (i
>= 0 && i
< (GLint
) ctx
->ListExt
.NumOpcodes
) {
5798 /* this is a driver-extended opcode */
5799 ctx
->ListExt
.Opcode
[i
].Execute(ctx
, &n
[1]);
5800 n
+= ctx
->ListExt
.Opcode
[i
].Size
;
5805 _mesa_error(ctx
, n
[1].e
, (const char *) n
[2].data
);
5808 CALL_Accum(ctx
->Exec
, (n
[1].e
, n
[2].f
));
5810 case OPCODE_ALPHA_FUNC
:
5811 CALL_AlphaFunc(ctx
->Exec
, (n
[1].e
, n
[2].f
));
5813 case OPCODE_BIND_TEXTURE
:
5814 CALL_BindTexture(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
5818 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5819 ctx
->Unpack
= ctx
->DefaultPacking
;
5820 CALL_Bitmap(ctx
->Exec
, ((GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
5821 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
5822 (const GLubyte
*) n
[7].data
));
5823 ctx
->Unpack
= save
; /* restore */
5826 case OPCODE_BLEND_COLOR
:
5827 CALL_BlendColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
5829 case OPCODE_BLEND_EQUATION
:
5830 CALL_BlendEquation(ctx
->Exec
, (n
[1].e
));
5832 case OPCODE_BLEND_EQUATION_SEPARATE
:
5833 CALL_BlendEquationSeparateEXT(ctx
->Exec
, (n
[1].e
, n
[2].e
));
5835 case OPCODE_BLEND_FUNC_SEPARATE
:
5836 CALL_BlendFuncSeparateEXT(ctx
->Exec
,
5837 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
5839 case OPCODE_CALL_LIST
:
5840 /* Generated by glCallList(), don't add ListBase */
5841 if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
5842 execute_list(ctx
, n
[1].ui
);
5845 case OPCODE_CALL_LIST_OFFSET
:
5846 /* Generated by glCallLists() so we must add ListBase */
5848 /* user specified a bad data type at compile time */
5849 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
5851 else if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
5852 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ n
[1].i
);
5853 execute_list(ctx
, list
);
5857 CALL_Clear(ctx
->Exec
, (n
[1].bf
));
5859 case OPCODE_CLEAR_COLOR
:
5860 CALL_ClearColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
5862 case OPCODE_CLEAR_ACCUM
:
5863 CALL_ClearAccum(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
5865 case OPCODE_CLEAR_DEPTH
:
5866 CALL_ClearDepth(ctx
->Exec
, ((GLclampd
) n
[1].f
));
5868 case OPCODE_CLEAR_INDEX
:
5869 CALL_ClearIndex(ctx
->Exec
, ((GLfloat
) n
[1].ui
));
5871 case OPCODE_CLEAR_STENCIL
:
5872 CALL_ClearStencil(ctx
->Exec
, (n
[1].i
));
5874 case OPCODE_CLIP_PLANE
:
5881 CALL_ClipPlane(ctx
->Exec
, (n
[1].e
, eq
));
5884 case OPCODE_COLOR_MASK
:
5885 CALL_ColorMask(ctx
->Exec
, (n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
));
5887 case OPCODE_COLOR_MATERIAL
:
5888 CALL_ColorMaterial(ctx
->Exec
, (n
[1].e
, n
[2].e
));
5890 case OPCODE_COLOR_TABLE
:
5892 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5893 ctx
->Unpack
= ctx
->DefaultPacking
;
5894 CALL_ColorTable(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].e
,
5895 n
[5].e
, n
[6].data
));
5896 ctx
->Unpack
= save
; /* restore */
5899 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
5906 CALL_ColorTableParameterfv(ctx
->Exec
,
5907 (n
[1].e
, n
[2].e
, params
));
5910 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
5917 CALL_ColorTableParameteriv(ctx
->Exec
,
5918 (n
[1].e
, n
[2].e
, params
));
5921 case OPCODE_COLOR_SUB_TABLE
:
5923 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5924 ctx
->Unpack
= ctx
->DefaultPacking
;
5925 CALL_ColorSubTable(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5926 n
[4].e
, n
[5].e
, n
[6].data
));
5927 ctx
->Unpack
= save
; /* restore */
5930 case OPCODE_CONVOLUTION_FILTER_1D
:
5932 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5933 ctx
->Unpack
= ctx
->DefaultPacking
;
5934 CALL_ConvolutionFilter1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5937 ctx
->Unpack
= save
; /* restore */
5940 case OPCODE_CONVOLUTION_FILTER_2D
:
5942 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5943 ctx
->Unpack
= ctx
->DefaultPacking
;
5944 CALL_ConvolutionFilter2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5945 n
[4].i
, n
[5].e
, n
[6].e
,
5947 ctx
->Unpack
= save
; /* restore */
5950 case OPCODE_CONVOLUTION_PARAMETER_I
:
5951 CALL_ConvolutionParameteri(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].i
));
5953 case OPCODE_CONVOLUTION_PARAMETER_IV
:
5960 CALL_ConvolutionParameteriv(ctx
->Exec
,
5961 (n
[1].e
, n
[2].e
, params
));
5964 case OPCODE_CONVOLUTION_PARAMETER_F
:
5965 CALL_ConvolutionParameterf(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].f
));
5967 case OPCODE_CONVOLUTION_PARAMETER_FV
:
5974 CALL_ConvolutionParameterfv(ctx
->Exec
,
5975 (n
[1].e
, n
[2].e
, params
));
5978 case OPCODE_COPY_COLOR_SUB_TABLE
:
5979 CALL_CopyColorSubTable(ctx
->Exec
, (n
[1].e
, n
[2].i
,
5980 n
[3].i
, n
[4].i
, n
[5].i
));
5982 case OPCODE_COPY_COLOR_TABLE
:
5983 CALL_CopyColorSubTable(ctx
->Exec
, (n
[1].e
, n
[2].i
,
5984 n
[3].i
, n
[4].i
, n
[5].i
));
5986 case OPCODE_COPY_PIXELS
:
5987 CALL_CopyPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
,
5988 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
,
5991 case OPCODE_COPY_TEX_IMAGE1D
:
5992 CALL_CopyTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
5993 n
[5].i
, n
[6].i
, n
[7].i
));
5995 case OPCODE_COPY_TEX_IMAGE2D
:
5996 CALL_CopyTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
5997 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
));
5999 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
6000 CALL_CopyTexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
6001 n
[4].i
, n
[5].i
, n
[6].i
));
6003 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
6004 CALL_CopyTexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
6005 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
6008 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
6009 CALL_CopyTexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
6010 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
6013 case OPCODE_CULL_FACE
:
6014 CALL_CullFace(ctx
->Exec
, (n
[1].e
));
6016 case OPCODE_DEPTH_FUNC
:
6017 CALL_DepthFunc(ctx
->Exec
, (n
[1].e
));
6019 case OPCODE_DEPTH_MASK
:
6020 CALL_DepthMask(ctx
->Exec
, (n
[1].b
));
6022 case OPCODE_DEPTH_RANGE
:
6023 CALL_DepthRange(ctx
->Exec
,
6024 ((GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
));
6026 case OPCODE_DISABLE
:
6027 CALL_Disable(ctx
->Exec
, (n
[1].e
));
6029 case OPCODE_DRAW_BUFFER
:
6030 CALL_DrawBuffer(ctx
->Exec
, (n
[1].e
));
6032 case OPCODE_DRAW_PIXELS
:
6034 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6035 ctx
->Unpack
= ctx
->DefaultPacking
;
6036 CALL_DrawPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
6038 ctx
->Unpack
= save
; /* restore */
6042 CALL_Enable(ctx
->Exec
, (n
[1].e
));
6044 case OPCODE_EVALMESH1
:
6045 CALL_EvalMesh1(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
));
6047 case OPCODE_EVALMESH2
:
6048 CALL_EvalMesh2(ctx
->Exec
,
6049 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
6058 CALL_Fogfv(ctx
->Exec
, (n
[1].e
, p
));
6061 case OPCODE_FRONT_FACE
:
6062 CALL_FrontFace(ctx
->Exec
, (n
[1].e
));
6064 case OPCODE_FRUSTUM
:
6065 CALL_Frustum(ctx
->Exec
,
6066 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
6069 CALL_Hint(ctx
->Exec
, (n
[1].e
, n
[2].e
));
6071 case OPCODE_HISTOGRAM
:
6072 CALL_Histogram(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].b
));
6074 case OPCODE_INDEX_MASK
:
6075 CALL_IndexMask(ctx
->Exec
, (n
[1].ui
));
6077 case OPCODE_INIT_NAMES
:
6078 CALL_InitNames(ctx
->Exec
, ());
6087 CALL_Lightfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, p
));
6090 case OPCODE_LIGHT_MODEL
:
6097 CALL_LightModelfv(ctx
->Exec
, (n
[1].e
, p
));
6100 case OPCODE_LINE_STIPPLE
:
6101 CALL_LineStipple(ctx
->Exec
, (n
[1].i
, n
[2].us
));
6103 case OPCODE_LINE_WIDTH
:
6104 CALL_LineWidth(ctx
->Exec
, (n
[1].f
));
6106 case OPCODE_LIST_BASE
:
6107 CALL_ListBase(ctx
->Exec
, (n
[1].ui
));
6109 case OPCODE_LOAD_IDENTITY
:
6110 CALL_LoadIdentity(ctx
->Exec
, ());
6112 case OPCODE_LOAD_MATRIX
:
6113 if (sizeof(Node
) == sizeof(GLfloat
)) {
6114 CALL_LoadMatrixf(ctx
->Exec
, (&n
[1].f
));
6119 for (i
= 0; i
< 16; i
++) {
6122 CALL_LoadMatrixf(ctx
->Exec
, (m
));
6125 case OPCODE_LOAD_NAME
:
6126 CALL_LoadName(ctx
->Exec
, (n
[1].ui
));
6128 case OPCODE_LOGIC_OP
:
6129 CALL_LogicOp(ctx
->Exec
, (n
[1].e
));
6133 GLenum target
= n
[1].e
;
6134 GLint ustride
= _mesa_evaluator_components(target
);
6135 GLint uorder
= n
[5].i
;
6136 GLfloat u1
= n
[2].f
;
6137 GLfloat u2
= n
[3].f
;
6138 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
6139 (GLfloat
*) n
[6].data
));
6144 GLenum target
= n
[1].e
;
6145 GLfloat u1
= n
[2].f
;
6146 GLfloat u2
= n
[3].f
;
6147 GLfloat v1
= n
[4].f
;
6148 GLfloat v2
= n
[5].f
;
6149 GLint ustride
= n
[6].i
;
6150 GLint vstride
= n
[7].i
;
6151 GLint uorder
= n
[8].i
;
6152 GLint vorder
= n
[9].i
;
6153 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
6154 v1
, v2
, vstride
, vorder
,
6155 (GLfloat
*) n
[10].data
));
6158 case OPCODE_MAPGRID1
:
6159 CALL_MapGrid1f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
6161 case OPCODE_MAPGRID2
:
6162 CALL_MapGrid2f(ctx
->Exec
,
6163 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
));
6165 case OPCODE_MATRIX_MODE
:
6166 CALL_MatrixMode(ctx
->Exec
, (n
[1].e
));
6168 case OPCODE_MIN_MAX
:
6169 CALL_Minmax(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].b
));
6171 case OPCODE_MULT_MATRIX
:
6172 if (sizeof(Node
) == sizeof(GLfloat
)) {
6173 CALL_MultMatrixf(ctx
->Exec
, (&n
[1].f
));
6178 for (i
= 0; i
< 16; i
++) {
6181 CALL_MultMatrixf(ctx
->Exec
, (m
));
6185 CALL_Ortho(ctx
->Exec
,
6186 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
6188 case OPCODE_PASSTHROUGH
:
6189 CALL_PassThrough(ctx
->Exec
, (n
[1].f
));
6191 case OPCODE_PIXEL_MAP
:
6192 CALL_PixelMapfv(ctx
->Exec
,
6193 (n
[1].e
, n
[2].i
, (GLfloat
*) n
[3].data
));
6195 case OPCODE_PIXEL_TRANSFER
:
6196 CALL_PixelTransferf(ctx
->Exec
, (n
[1].e
, n
[2].f
));
6198 case OPCODE_PIXEL_ZOOM
:
6199 CALL_PixelZoom(ctx
->Exec
, (n
[1].f
, n
[2].f
));
6201 case OPCODE_POINT_SIZE
:
6202 CALL_PointSize(ctx
->Exec
, (n
[1].f
));
6204 case OPCODE_POINT_PARAMETERS
:
6210 CALL_PointParameterfvEXT(ctx
->Exec
, (n
[1].e
, params
));
6213 case OPCODE_POLYGON_MODE
:
6214 CALL_PolygonMode(ctx
->Exec
, (n
[1].e
, n
[2].e
));
6216 case OPCODE_POLYGON_STIPPLE
:
6218 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6219 ctx
->Unpack
= ctx
->DefaultPacking
;
6220 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) n
[1].data
));
6221 ctx
->Unpack
= save
; /* restore */
6224 case OPCODE_POLYGON_OFFSET
:
6225 CALL_PolygonOffset(ctx
->Exec
, (n
[1].f
, n
[2].f
));
6227 case OPCODE_POP_ATTRIB
:
6228 CALL_PopAttrib(ctx
->Exec
, ());
6230 case OPCODE_POP_MATRIX
:
6231 CALL_PopMatrix(ctx
->Exec
, ());
6233 case OPCODE_POP_NAME
:
6234 CALL_PopName(ctx
->Exec
, ());
6236 case OPCODE_PRIORITIZE_TEXTURE
:
6237 CALL_PrioritizeTextures(ctx
->Exec
, (1, &n
[1].ui
, &n
[2].f
));
6239 case OPCODE_PUSH_ATTRIB
:
6240 CALL_PushAttrib(ctx
->Exec
, (n
[1].bf
));
6242 case OPCODE_PUSH_MATRIX
:
6243 CALL_PushMatrix(ctx
->Exec
, ());
6245 case OPCODE_PUSH_NAME
:
6246 CALL_PushName(ctx
->Exec
, (n
[1].ui
));
6248 case OPCODE_RASTER_POS
:
6249 CALL_RasterPos4f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
6251 case OPCODE_READ_BUFFER
:
6252 CALL_ReadBuffer(ctx
->Exec
, (n
[1].e
));
6254 case OPCODE_RESET_HISTOGRAM
:
6255 CALL_ResetHistogram(ctx
->Exec
, (n
[1].e
));
6257 case OPCODE_RESET_MIN_MAX
:
6258 CALL_ResetMinmax(ctx
->Exec
, (n
[1].e
));
6261 CALL_Rotatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
6264 CALL_Scalef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
6266 case OPCODE_SCISSOR
:
6267 CALL_Scissor(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
6269 case OPCODE_SHADE_MODEL
:
6270 CALL_ShadeModel(ctx
->Exec
, (n
[1].e
));
6272 case OPCODE_STENCIL_FUNC
:
6273 CALL_StencilFunc(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].ui
));
6275 case OPCODE_STENCIL_MASK
:
6276 CALL_StencilMask(ctx
->Exec
, (n
[1].ui
));
6278 case OPCODE_STENCIL_OP
:
6279 CALL_StencilOp(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].e
));
6281 case OPCODE_STENCIL_FUNC_SEPARATE
:
6282 CALL_StencilFuncSeparate(ctx
->Exec
,
6283 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].ui
));
6285 case OPCODE_STENCIL_MASK_SEPARATE
:
6286 CALL_StencilMaskSeparate(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
6288 case OPCODE_STENCIL_OP_SEPARATE
:
6289 CALL_StencilOpSeparate(ctx
->Exec
,
6290 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
6299 CALL_TexEnvfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
6309 CALL_TexGenfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
6312 case OPCODE_TEXPARAMETER
:
6319 CALL_TexParameterfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
6322 case OPCODE_TEX_IMAGE1D
:
6324 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6325 ctx
->Unpack
= ctx
->DefaultPacking
;
6326 CALL_TexImage1D(ctx
->Exec
, (n
[1].e
, /* target */
6328 n
[3].i
, /* components */
6330 n
[5].e
, /* border */
6331 n
[6].e
, /* format */
6334 ctx
->Unpack
= save
; /* restore */
6337 case OPCODE_TEX_IMAGE2D
:
6339 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6340 ctx
->Unpack
= ctx
->DefaultPacking
;
6341 CALL_TexImage2D(ctx
->Exec
, (n
[1].e
, /* target */
6343 n
[3].i
, /* components */
6345 n
[5].i
, /* height */
6346 n
[6].e
, /* border */
6347 n
[7].e
, /* format */
6350 ctx
->Unpack
= save
; /* restore */
6353 case OPCODE_TEX_IMAGE3D
:
6355 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6356 ctx
->Unpack
= ctx
->DefaultPacking
;
6357 CALL_TexImage3D(ctx
->Exec
, (n
[1].e
, /* target */
6359 n
[3].i
, /* components */
6361 n
[5].i
, /* height */
6363 n
[7].e
, /* border */
6364 n
[8].e
, /* format */
6367 ctx
->Unpack
= save
; /* restore */
6370 case OPCODE_TEX_SUB_IMAGE1D
:
6372 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6373 ctx
->Unpack
= ctx
->DefaultPacking
;
6374 CALL_TexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
6376 n
[6].e
, n
[7].data
));
6377 ctx
->Unpack
= save
; /* restore */
6380 case OPCODE_TEX_SUB_IMAGE2D
:
6382 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6383 ctx
->Unpack
= ctx
->DefaultPacking
;
6384 CALL_TexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
6386 n
[6].i
, n
[7].e
, n
[8].e
,
6388 ctx
->Unpack
= save
; /* restore */
6391 case OPCODE_TEX_SUB_IMAGE3D
:
6393 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6394 ctx
->Unpack
= ctx
->DefaultPacking
;
6395 CALL_TexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
6396 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
6397 n
[8].i
, n
[9].e
, n
[10].e
,
6399 ctx
->Unpack
= save
; /* restore */
6402 case OPCODE_TRANSLATE
:
6403 CALL_Translatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
6405 case OPCODE_VIEWPORT
:
6406 CALL_Viewport(ctx
->Exec
, (n
[1].i
, n
[2].i
,
6407 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
));
6409 case OPCODE_WINDOW_POS
:
6410 CALL_WindowPos4fMESA(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
6412 case OPCODE_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
6413 CALL_ActiveTextureARB(ctx
->Exec
, (n
[1].e
));
6415 case OPCODE_COMPRESSED_TEX_IMAGE_1D
: /* GL_ARB_texture_compression */
6416 CALL_CompressedTexImage1DARB(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
6417 n
[4].i
, n
[5].i
, n
[6].i
,
6420 case OPCODE_COMPRESSED_TEX_IMAGE_2D
: /* GL_ARB_texture_compression */
6421 CALL_CompressedTexImage2DARB(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
6422 n
[4].i
, n
[5].i
, n
[6].i
,
6423 n
[7].i
, n
[8].data
));
6425 case OPCODE_COMPRESSED_TEX_IMAGE_3D
: /* GL_ARB_texture_compression */
6426 CALL_CompressedTexImage3DARB(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
6427 n
[4].i
, n
[5].i
, n
[6].i
,
6431 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
: /* GL_ARB_texture_compress */
6432 CALL_CompressedTexSubImage1DARB(ctx
->Exec
,
6433 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
6434 n
[5].e
, n
[6].i
, n
[7].data
));
6436 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
: /* GL_ARB_texture_compress */
6437 CALL_CompressedTexSubImage2DARB(ctx
->Exec
,
6438 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
6439 n
[5].i
, n
[6].i
, n
[7].e
, n
[8].i
,
6442 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
: /* GL_ARB_texture_compress */
6443 CALL_CompressedTexSubImage3DARB(ctx
->Exec
,
6444 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
6445 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
6446 n
[9].e
, n
[10].i
, n
[11].data
));
6448 case OPCODE_SAMPLE_COVERAGE
: /* GL_ARB_multisample */
6449 CALL_SampleCoverageARB(ctx
->Exec
, (n
[1].f
, n
[2].b
));
6451 case OPCODE_WINDOW_POS_ARB
: /* GL_ARB_window_pos */
6452 CALL_WindowPos3fMESA(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
6454 #if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
6455 case OPCODE_BIND_PROGRAM_NV
: /* GL_NV_vertex_program */
6456 CALL_BindProgramNV(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
6459 #if FEATURE_NV_vertex_program
6460 case OPCODE_EXECUTE_PROGRAM_NV
:
6467 CALL_ExecuteProgramNV(ctx
->Exec
, (n
[1].e
, n
[2].ui
, v
));
6470 case OPCODE_REQUEST_RESIDENT_PROGRAMS_NV
:
6471 CALL_RequestResidentProgramsNV(ctx
->Exec
, (n
[1].ui
,
6472 (GLuint
*) n
[2].data
));
6474 case OPCODE_LOAD_PROGRAM_NV
:
6475 CALL_LoadProgramNV(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].i
,
6476 (const GLubyte
*) n
[4].data
));
6478 case OPCODE_TRACK_MATRIX_NV
:
6479 CALL_TrackMatrixNV(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].e
, n
[4].e
));
6483 #if FEATURE_NV_fragment_program
6484 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
:
6485 CALL_ProgramLocalParameter4fARB(ctx
->Exec
,
6486 (n
[1].e
, n
[2].ui
, n
[3].f
, n
[4].f
,
6489 case OPCODE_PROGRAM_NAMED_PARAMETER_NV
:
6490 CALL_ProgramNamedParameter4fNV(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
6491 (const GLubyte
*) n
[3].
6492 data
, n
[4].f
, n
[5].f
,
6497 case OPCODE_ACTIVE_STENCIL_FACE_EXT
:
6498 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (n
[1].e
));
6500 case OPCODE_DEPTH_BOUNDS_EXT
:
6501 CALL_DepthBoundsEXT(ctx
->Exec
, (n
[1].f
, n
[2].f
));
6503 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
6504 case OPCODE_PROGRAM_STRING_ARB
:
6505 CALL_ProgramStringARB(ctx
->Exec
,
6506 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].data
));
6509 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program || FEATURE_NV_vertex_program
6510 case OPCODE_PROGRAM_ENV_PARAMETER_ARB
:
6511 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].f
,
6516 #if FEATURE_ARB_occlusion_query
6517 case OPCODE_BEGIN_QUERY_ARB
:
6518 CALL_BeginQueryARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
6520 case OPCODE_END_QUERY_ARB
:
6521 CALL_EndQueryARB(ctx
->Exec
, (n
[1].e
));
6524 case OPCODE_DRAW_BUFFERS_ARB
:
6526 GLenum buffers
[MAX_DRAW_BUFFERS
];
6527 GLint i
, count
= MIN2(n
[1].i
, MAX_DRAW_BUFFERS
);
6528 for (i
= 0; i
< count
; i
++)
6529 buffers
[i
] = n
[2 + i
].e
;
6530 CALL_DrawBuffersARB(ctx
->Exec
, (n
[1].i
, buffers
));
6533 #if FEATURE_EXT_framebuffer_blit
6534 case OPCODE_BLIT_FRAMEBUFFER
:
6535 CALL_BlitFramebufferEXT(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
,
6536 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
6540 case OPCODE_TEX_BUMP_PARAMETER_ATI
:
6543 GLuint i
, pname
= n
[1].ui
;
6545 for (i
= 0; i
< 4; i
++)
6546 values
[i
] = n
[1 + i
].f
;
6547 CALL_TexBumpParameterfvATI(ctx
->Exec
, (pname
, values
));
6550 #if FEATURE_ATI_fragment_shader
6551 case OPCODE_BIND_FRAGMENT_SHADER_ATI
:
6552 CALL_BindFragmentShaderATI(ctx
->Exec
, (n
[1].i
));
6554 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
:
6557 GLuint i
, dst
= n
[1].ui
;
6559 for (i
= 0; i
< 4; i
++)
6560 values
[i
] = n
[1 + i
].f
;
6561 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, values
));
6565 case OPCODE_ATTR_1F_NV
:
6566 CALL_VertexAttrib1fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
));
6568 case OPCODE_ATTR_2F_NV
:
6569 /* Really shouldn't have to do this - the Node structure
6570 * is convenient, but it would be better to store the data
6571 * packed appropriately so that it can be sent directly
6572 * on. With x86_64 becoming common, this will start to
6575 if (sizeof(Node
) == sizeof(GLfloat
))
6576 CALL_VertexAttrib2fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6578 CALL_VertexAttrib2fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
));
6580 case OPCODE_ATTR_3F_NV
:
6581 if (sizeof(Node
) == sizeof(GLfloat
))
6582 CALL_VertexAttrib3fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6584 CALL_VertexAttrib3fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
6587 case OPCODE_ATTR_4F_NV
:
6588 if (sizeof(Node
) == sizeof(GLfloat
))
6589 CALL_VertexAttrib4fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6591 CALL_VertexAttrib4fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
6594 case OPCODE_ATTR_1F_ARB
:
6595 CALL_VertexAttrib1fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
));
6597 case OPCODE_ATTR_2F_ARB
:
6598 /* Really shouldn't have to do this - the Node structure
6599 * is convenient, but it would be better to store the data
6600 * packed appropriately so that it can be sent directly
6601 * on. With x86_64 becoming common, this will start to
6604 if (sizeof(Node
) == sizeof(GLfloat
))
6605 CALL_VertexAttrib2fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6607 CALL_VertexAttrib2fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
));
6609 case OPCODE_ATTR_3F_ARB
:
6610 if (sizeof(Node
) == sizeof(GLfloat
))
6611 CALL_VertexAttrib3fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6613 CALL_VertexAttrib3fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
6616 case OPCODE_ATTR_4F_ARB
:
6617 if (sizeof(Node
) == sizeof(GLfloat
))
6618 CALL_VertexAttrib4fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6620 CALL_VertexAttrib4fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
6623 case OPCODE_MATERIAL
:
6624 if (sizeof(Node
) == sizeof(GLfloat
))
6625 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, &n
[3].f
));
6632 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, f
));
6636 CALL_Begin(ctx
->Exec
, (n
[1].e
));
6639 CALL_End(ctx
->Exec
, ());
6642 CALL_Rectf(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
6644 case OPCODE_EVAL_C1
:
6645 CALL_EvalCoord1f(ctx
->Exec
, (n
[1].f
));
6647 case OPCODE_EVAL_C2
:
6648 CALL_EvalCoord2f(ctx
->Exec
, (n
[1].f
, n
[2].f
));
6650 case OPCODE_EVAL_P1
:
6651 CALL_EvalPoint1(ctx
->Exec
, (n
[1].i
));
6653 case OPCODE_EVAL_P2
:
6654 CALL_EvalPoint2(ctx
->Exec
, (n
[1].i
, n
[2].i
));
6657 case OPCODE_CONTINUE
:
6658 n
= (Node
*) n
[1].next
;
6660 case OPCODE_END_OF_LIST
:
6666 _mesa_sprintf(msg
, "Error in execute_list: opcode=%d",
6668 _mesa_problem(ctx
, msg
);
6673 /* increment n to point to next compiled command */
6674 if (opcode
!= OPCODE_CONTINUE
) {
6675 n
+= InstSize
[opcode
];
6680 if (ctx
->Driver
.EndCallList
)
6681 ctx
->Driver
.EndCallList(ctx
);
6683 ctx
->ListState
.CallDepth
--;
6688 /**********************************************************************/
6690 /**********************************************************************/
6693 * Test if a display list number is valid.
6695 GLboolean GLAPIENTRY
6696 _mesa_IsList(GLuint list
)
6698 GET_CURRENT_CONTEXT(ctx
);
6699 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
6700 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
6701 return islist(ctx
, list
);
6706 * Delete a sequence of consecutive display lists.
6709 _mesa_DeleteLists(GLuint list
, GLsizei range
)
6711 GET_CURRENT_CONTEXT(ctx
);
6713 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
6714 ASSERT_OUTSIDE_BEGIN_END(ctx
);
6717 _mesa_error(ctx
, GL_INVALID_VALUE
, "glDeleteLists");
6720 for (i
= list
; i
< list
+ range
; i
++) {
6721 destroy_list(ctx
, i
);
6727 * Return a display list number, n, such that lists n through n+range-1
6731 _mesa_GenLists(GLsizei range
)
6733 GET_CURRENT_CONTEXT(ctx
);
6735 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
6736 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, 0);
6739 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGenLists");
6747 * Make this an atomic operation
6749 _glthread_LOCK_MUTEX(ctx
->Shared
->Mutex
);
6751 base
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
6753 /* reserve the list IDs by with empty/dummy lists */
6755 for (i
= 0; i
< range
; i
++) {
6756 _mesa_HashInsert(ctx
->Shared
->DisplayList
, base
+ i
,
6757 make_list(base
+ i
, 1));
6761 _glthread_UNLOCK_MUTEX(ctx
->Shared
->Mutex
);
6768 * Begin a new display list.
6771 _mesa_NewList(GLuint name
, GLenum mode
)
6773 GET_CURRENT_CONTEXT(ctx
);
6776 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
6777 ASSERT_OUTSIDE_BEGIN_END(ctx
);
6779 if (MESA_VERBOSE
& VERBOSE_API
)
6780 _mesa_debug(ctx
, "glNewList %u %s\n", name
,
6781 _mesa_lookup_enum_by_nr(mode
));
6784 _mesa_error(ctx
, GL_INVALID_VALUE
, "glNewList");
6788 if (mode
!= GL_COMPILE
&& mode
!= GL_COMPILE_AND_EXECUTE
) {
6789 _mesa_error(ctx
, GL_INVALID_ENUM
, "glNewList");
6793 if (ctx
->ListState
.CurrentList
) {
6794 /* already compiling a display list */
6795 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
6799 ctx
->CompileFlag
= GL_TRUE
;
6800 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
6802 /* Allocate new display list */
6803 ctx
->ListState
.CurrentList
= make_list(name
, BLOCK_SIZE
);
6804 ctx
->ListState
.CurrentBlock
= ctx
->ListState
.CurrentList
->Head
;
6805 ctx
->ListState
.CurrentPos
= 0;
6807 /* Reset acumulated list state:
6809 for (i
= 0; i
< VERT_ATTRIB_MAX
; i
++)
6810 ctx
->ListState
.ActiveAttribSize
[i
] = 0;
6812 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++)
6813 ctx
->ListState
.ActiveMaterialSize
[i
] = 0;
6815 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
6816 ctx
->Driver
.NewList(ctx
, name
, mode
);
6818 ctx
->CurrentDispatch
= ctx
->Save
;
6819 _glapi_set_dispatch(ctx
->CurrentDispatch
);
6824 * End definition of current display list.
6829 GET_CURRENT_CONTEXT(ctx
);
6830 SAVE_FLUSH_VERTICES(ctx
);
6831 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
6833 if (MESA_VERBOSE
& VERBOSE_API
)
6834 _mesa_debug(ctx
, "glEndList\n");
6836 /* Check that a list is under construction */
6837 if (!ctx
->ListState
.CurrentList
) {
6838 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glEndList");
6842 /* Call before emitting END_OF_LIST, in case the driver wants to
6843 * emit opcodes itself.
6845 ctx
->Driver
.EndList(ctx
);
6847 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_END_OF_LIST
, 0);
6849 /* Destroy old list, if any */
6850 destroy_list(ctx
, ctx
->ListState
.CurrentList
->Name
);
6852 /* Install the new list */
6853 _mesa_HashInsert(ctx
->Shared
->DisplayList
,
6854 ctx
->ListState
.CurrentList
->Name
,
6855 ctx
->ListState
.CurrentList
);
6858 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
6859 mesa_print_display_list(ctx
->ListState
.CurrentList
->Name
);
6861 ctx
->ListState
.CurrentList
= NULL
;
6862 ctx
->ExecuteFlag
= GL_TRUE
;
6863 ctx
->CompileFlag
= GL_FALSE
;
6865 ctx
->CurrentDispatch
= ctx
->Exec
;
6866 _glapi_set_dispatch(ctx
->CurrentDispatch
);
6871 _mesa_CallList(GLuint list
)
6873 GLboolean save_compile_flag
;
6874 GET_CURRENT_CONTEXT(ctx
);
6875 FLUSH_CURRENT(ctx
, 0);
6876 /* VERY IMPORTANT: Save the CompileFlag status, turn it off, */
6877 /* execute the display list, and restore the CompileFlag. */
6879 if (MESA_VERBOSE
& VERBOSE_API
)
6880 _mesa_debug(ctx
, "glCallList %d\n", list
);
6883 _mesa_error(ctx
, GL_INVALID_VALUE
, "glCallList(list==0)");
6887 /* mesa_print_display_list( list ); */
6889 save_compile_flag
= ctx
->CompileFlag
;
6890 if (save_compile_flag
) {
6891 ctx
->CompileFlag
= GL_FALSE
;
6894 execute_list(ctx
, list
);
6895 ctx
->CompileFlag
= save_compile_flag
;
6897 /* also restore API function pointers to point to "save" versions */
6898 if (save_compile_flag
) {
6899 ctx
->CurrentDispatch
= ctx
->Save
;
6900 _glapi_set_dispatch(ctx
->CurrentDispatch
);
6906 * Execute glCallLists: call multiple display lists.
6909 _mesa_CallLists(GLsizei n
, GLenum type
, const GLvoid
* lists
)
6911 GET_CURRENT_CONTEXT(ctx
);
6913 GLboolean save_compile_flag
;
6915 if (MESA_VERBOSE
& VERBOSE_API
)
6916 _mesa_debug(ctx
, "glCallLists %d\n", n
);
6920 case GL_UNSIGNED_BYTE
:
6922 case GL_UNSIGNED_SHORT
:
6924 case GL_UNSIGNED_INT
:
6932 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
6936 /* Save the CompileFlag status, turn it off, execute display list,
6937 * and restore the CompileFlag.
6939 save_compile_flag
= ctx
->CompileFlag
;
6940 ctx
->CompileFlag
= GL_FALSE
;
6942 for (i
= 0; i
< n
; i
++) {
6943 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ translate_id(i
, type
, lists
));
6944 execute_list(ctx
, list
);
6947 ctx
->CompileFlag
= save_compile_flag
;
6949 /* also restore API function pointers to point to "save" versions */
6950 if (save_compile_flag
) {
6951 ctx
->CurrentDispatch
= ctx
->Save
;
6952 _glapi_set_dispatch(ctx
->CurrentDispatch
);
6958 * Set the offset added to list numbers in glCallLists.
6961 _mesa_ListBase(GLuint base
)
6963 GET_CURRENT_CONTEXT(ctx
);
6964 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
6965 ASSERT_OUTSIDE_BEGIN_END(ctx
);
6966 ctx
->List
.ListBase
= base
;
6970 /* Can no longer assume ctx->Exec->Func is equal to _mesa_Func.
6972 static void GLAPIENTRY
6975 GET_CURRENT_CONTEXT(ctx
);
6976 FLUSH_VERTICES(ctx
, 0);
6977 CALL_Finish(ctx
->Exec
, ());
6980 static void GLAPIENTRY
6983 GET_CURRENT_CONTEXT(ctx
);
6984 FLUSH_VERTICES(ctx
, 0);
6985 CALL_Flush(ctx
->Exec
, ());
6988 static void GLAPIENTRY
6989 exec_GetBooleanv(GLenum pname
, GLboolean
*params
)
6991 GET_CURRENT_CONTEXT(ctx
);
6992 FLUSH_VERTICES(ctx
, 0);
6993 CALL_GetBooleanv(ctx
->Exec
, (pname
, params
));
6996 static void GLAPIENTRY
6997 exec_GetClipPlane(GLenum plane
, GLdouble
* equation
)
6999 GET_CURRENT_CONTEXT(ctx
);
7000 FLUSH_VERTICES(ctx
, 0);
7001 CALL_GetClipPlane(ctx
->Exec
, (plane
, equation
));
7004 static void GLAPIENTRY
7005 exec_GetDoublev(GLenum pname
, GLdouble
*params
)
7007 GET_CURRENT_CONTEXT(ctx
);
7008 FLUSH_VERTICES(ctx
, 0);
7009 CALL_GetDoublev(ctx
->Exec
, (pname
, params
));
7012 static GLenum GLAPIENTRY
7015 GET_CURRENT_CONTEXT(ctx
);
7016 FLUSH_VERTICES(ctx
, 0);
7017 return CALL_GetError(ctx
->Exec
, ());
7020 static void GLAPIENTRY
7021 exec_GetFloatv(GLenum pname
, GLfloat
*params
)
7023 GET_CURRENT_CONTEXT(ctx
);
7024 FLUSH_VERTICES(ctx
, 0);
7025 CALL_GetFloatv(ctx
->Exec
, (pname
, params
));
7028 static void GLAPIENTRY
7029 exec_GetIntegerv(GLenum pname
, GLint
*params
)
7031 GET_CURRENT_CONTEXT(ctx
);
7032 FLUSH_VERTICES(ctx
, 0);
7033 CALL_GetIntegerv(ctx
->Exec
, (pname
, params
));
7036 static void GLAPIENTRY
7037 exec_GetLightfv(GLenum light
, GLenum pname
, GLfloat
*params
)
7039 GET_CURRENT_CONTEXT(ctx
);
7040 FLUSH_VERTICES(ctx
, 0);
7041 CALL_GetLightfv(ctx
->Exec
, (light
, pname
, params
));
7044 static void GLAPIENTRY
7045 exec_GetLightiv(GLenum light
, GLenum pname
, GLint
*params
)
7047 GET_CURRENT_CONTEXT(ctx
);
7048 FLUSH_VERTICES(ctx
, 0);
7049 CALL_GetLightiv(ctx
->Exec
, (light
, pname
, params
));
7052 static void GLAPIENTRY
7053 exec_GetMapdv(GLenum target
, GLenum query
, GLdouble
* v
)
7055 GET_CURRENT_CONTEXT(ctx
);
7056 FLUSH_VERTICES(ctx
, 0);
7057 CALL_GetMapdv(ctx
->Exec
, (target
, query
, v
));
7060 static void GLAPIENTRY
7061 exec_GetMapfv(GLenum target
, GLenum query
, GLfloat
* v
)
7063 GET_CURRENT_CONTEXT(ctx
);
7064 FLUSH_VERTICES(ctx
, 0);
7065 CALL_GetMapfv(ctx
->Exec
, (target
, query
, v
));
7068 static void GLAPIENTRY
7069 exec_GetMapiv(GLenum target
, GLenum query
, GLint
* v
)
7071 GET_CURRENT_CONTEXT(ctx
);
7072 FLUSH_VERTICES(ctx
, 0);
7073 CALL_GetMapiv(ctx
->Exec
, (target
, query
, v
));
7076 static void GLAPIENTRY
7077 exec_GetMaterialfv(GLenum face
, GLenum pname
, GLfloat
*params
)
7079 GET_CURRENT_CONTEXT(ctx
);
7080 FLUSH_VERTICES(ctx
, 0);
7081 CALL_GetMaterialfv(ctx
->Exec
, (face
, pname
, params
));
7084 static void GLAPIENTRY
7085 exec_GetMaterialiv(GLenum face
, GLenum pname
, GLint
*params
)
7087 GET_CURRENT_CONTEXT(ctx
);
7088 FLUSH_VERTICES(ctx
, 0);
7089 CALL_GetMaterialiv(ctx
->Exec
, (face
, pname
, params
));
7092 static void GLAPIENTRY
7093 exec_GetPixelMapfv(GLenum map
, GLfloat
*values
)
7095 GET_CURRENT_CONTEXT(ctx
);
7096 FLUSH_VERTICES(ctx
, 0);
7097 CALL_GetPixelMapfv(ctx
->Exec
, (map
, values
));
7100 static void GLAPIENTRY
7101 exec_GetPixelMapuiv(GLenum map
, GLuint
*values
)
7103 GET_CURRENT_CONTEXT(ctx
);
7104 FLUSH_VERTICES(ctx
, 0);
7105 CALL_GetPixelMapuiv(ctx
->Exec
, (map
, values
));
7108 static void GLAPIENTRY
7109 exec_GetPixelMapusv(GLenum map
, GLushort
*values
)
7111 GET_CURRENT_CONTEXT(ctx
);
7112 FLUSH_VERTICES(ctx
, 0);
7113 CALL_GetPixelMapusv(ctx
->Exec
, (map
, values
));
7116 static void GLAPIENTRY
7117 exec_GetPolygonStipple(GLubyte
* dest
)
7119 GET_CURRENT_CONTEXT(ctx
);
7120 FLUSH_VERTICES(ctx
, 0);
7121 CALL_GetPolygonStipple(ctx
->Exec
, (dest
));
7124 static const GLubyte
*GLAPIENTRY
7125 exec_GetString(GLenum name
)
7127 GET_CURRENT_CONTEXT(ctx
);
7128 FLUSH_VERTICES(ctx
, 0);
7129 return CALL_GetString(ctx
->Exec
, (name
));
7132 static void GLAPIENTRY
7133 exec_GetTexEnvfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7135 GET_CURRENT_CONTEXT(ctx
);
7136 FLUSH_VERTICES(ctx
, 0);
7137 CALL_GetTexEnvfv(ctx
->Exec
, (target
, pname
, params
));
7140 static void GLAPIENTRY
7141 exec_GetTexEnviv(GLenum target
, GLenum pname
, GLint
*params
)
7143 GET_CURRENT_CONTEXT(ctx
);
7144 FLUSH_VERTICES(ctx
, 0);
7145 CALL_GetTexEnviv(ctx
->Exec
, (target
, pname
, params
));
7148 static void GLAPIENTRY
7149 exec_GetTexGendv(GLenum coord
, GLenum pname
, GLdouble
*params
)
7151 GET_CURRENT_CONTEXT(ctx
);
7152 FLUSH_VERTICES(ctx
, 0);
7153 CALL_GetTexGendv(ctx
->Exec
, (coord
, pname
, params
));
7156 static void GLAPIENTRY
7157 exec_GetTexGenfv(GLenum coord
, GLenum pname
, GLfloat
*params
)
7159 GET_CURRENT_CONTEXT(ctx
);
7160 FLUSH_VERTICES(ctx
, 0);
7161 CALL_GetTexGenfv(ctx
->Exec
, (coord
, pname
, params
));
7164 static void GLAPIENTRY
7165 exec_GetTexGeniv(GLenum coord
, GLenum pname
, GLint
*params
)
7167 GET_CURRENT_CONTEXT(ctx
);
7168 FLUSH_VERTICES(ctx
, 0);
7169 CALL_GetTexGeniv(ctx
->Exec
, (coord
, pname
, params
));
7172 static void GLAPIENTRY
7173 exec_GetTexImage(GLenum target
, GLint level
, GLenum format
,
7174 GLenum type
, GLvoid
* pixels
)
7176 GET_CURRENT_CONTEXT(ctx
);
7177 FLUSH_VERTICES(ctx
, 0);
7178 CALL_GetTexImage(ctx
->Exec
, (target
, level
, format
, type
, pixels
));
7181 static void GLAPIENTRY
7182 exec_GetTexLevelParameterfv(GLenum target
, GLint level
,
7183 GLenum pname
, GLfloat
*params
)
7185 GET_CURRENT_CONTEXT(ctx
);
7186 FLUSH_VERTICES(ctx
, 0);
7187 CALL_GetTexLevelParameterfv(ctx
->Exec
, (target
, level
, pname
, params
));
7190 static void GLAPIENTRY
7191 exec_GetTexLevelParameteriv(GLenum target
, GLint level
,
7192 GLenum pname
, GLint
*params
)
7194 GET_CURRENT_CONTEXT(ctx
);
7195 FLUSH_VERTICES(ctx
, 0);
7196 CALL_GetTexLevelParameteriv(ctx
->Exec
, (target
, level
, pname
, params
));
7199 static void GLAPIENTRY
7200 exec_GetTexParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7202 GET_CURRENT_CONTEXT(ctx
);
7203 FLUSH_VERTICES(ctx
, 0);
7204 CALL_GetTexParameterfv(ctx
->Exec
, (target
, pname
, params
));
7207 static void GLAPIENTRY
7208 exec_GetTexParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7210 GET_CURRENT_CONTEXT(ctx
);
7211 FLUSH_VERTICES(ctx
, 0);
7212 CALL_GetTexParameteriv(ctx
->Exec
, (target
, pname
, params
));
7215 static GLboolean GLAPIENTRY
7216 exec_IsEnabled(GLenum cap
)
7218 GET_CURRENT_CONTEXT(ctx
);
7219 FLUSH_VERTICES(ctx
, 0);
7220 return CALL_IsEnabled(ctx
->Exec
, (cap
));
7223 static void GLAPIENTRY
7224 exec_PixelStoref(GLenum pname
, GLfloat param
)
7226 GET_CURRENT_CONTEXT(ctx
);
7227 FLUSH_VERTICES(ctx
, 0);
7228 CALL_PixelStoref(ctx
->Exec
, (pname
, param
));
7231 static void GLAPIENTRY
7232 exec_PixelStorei(GLenum pname
, GLint param
)
7234 GET_CURRENT_CONTEXT(ctx
);
7235 FLUSH_VERTICES(ctx
, 0);
7236 CALL_PixelStorei(ctx
->Exec
, (pname
, param
));
7239 static void GLAPIENTRY
7240 exec_ReadPixels(GLint x
, GLint y
, GLsizei width
, GLsizei height
,
7241 GLenum format
, GLenum type
, GLvoid
* pixels
)
7243 GET_CURRENT_CONTEXT(ctx
);
7244 FLUSH_VERTICES(ctx
, 0);
7245 CALL_ReadPixels(ctx
->Exec
, (x
, y
, width
, height
, format
, type
, pixels
));
7248 static GLint GLAPIENTRY
7249 exec_RenderMode(GLenum mode
)
7251 GET_CURRENT_CONTEXT(ctx
);
7252 FLUSH_VERTICES(ctx
, 0);
7253 return CALL_RenderMode(ctx
->Exec
, (mode
));
7256 static void GLAPIENTRY
7257 exec_FeedbackBuffer(GLsizei size
, GLenum type
, GLfloat
* buffer
)
7259 GET_CURRENT_CONTEXT(ctx
);
7260 FLUSH_VERTICES(ctx
, 0);
7261 CALL_FeedbackBuffer(ctx
->Exec
, (size
, type
, buffer
));
7264 static void GLAPIENTRY
7265 exec_SelectBuffer(GLsizei size
, GLuint
* buffer
)
7267 GET_CURRENT_CONTEXT(ctx
);
7268 FLUSH_VERTICES(ctx
, 0);
7269 CALL_SelectBuffer(ctx
->Exec
, (size
, buffer
));
7272 static GLboolean GLAPIENTRY
7273 exec_AreTexturesResident(GLsizei n
, const GLuint
* texName
,
7274 GLboolean
* residences
)
7276 GET_CURRENT_CONTEXT(ctx
);
7277 FLUSH_VERTICES(ctx
, 0);
7278 return CALL_AreTexturesResident(ctx
->Exec
, (n
, texName
, residences
));
7281 static void GLAPIENTRY
7282 exec_ColorPointer(GLint size
, GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
7284 GET_CURRENT_CONTEXT(ctx
);
7285 FLUSH_VERTICES(ctx
, 0);
7286 CALL_ColorPointer(ctx
->Exec
, (size
, type
, stride
, ptr
));
7289 static void GLAPIENTRY
7290 exec_DeleteTextures(GLsizei n
, const GLuint
* texName
)
7292 GET_CURRENT_CONTEXT(ctx
);
7293 FLUSH_VERTICES(ctx
, 0);
7294 CALL_DeleteTextures(ctx
->Exec
, (n
, texName
));
7297 static void GLAPIENTRY
7298 exec_DisableClientState(GLenum cap
)
7300 GET_CURRENT_CONTEXT(ctx
);
7301 FLUSH_VERTICES(ctx
, 0);
7302 CALL_DisableClientState(ctx
->Exec
, (cap
));
7305 static void GLAPIENTRY
7306 exec_EdgeFlagPointer(GLsizei stride
, const GLvoid
* vptr
)
7308 GET_CURRENT_CONTEXT(ctx
);
7309 FLUSH_VERTICES(ctx
, 0);
7310 CALL_EdgeFlagPointer(ctx
->Exec
, (stride
, vptr
));
7313 static void GLAPIENTRY
7314 exec_EnableClientState(GLenum cap
)
7316 GET_CURRENT_CONTEXT(ctx
);
7317 FLUSH_VERTICES(ctx
, 0);
7318 CALL_EnableClientState(ctx
->Exec
, (cap
));
7321 static void GLAPIENTRY
7322 exec_GenTextures(GLsizei n
, GLuint
* texName
)
7324 GET_CURRENT_CONTEXT(ctx
);
7325 FLUSH_VERTICES(ctx
, 0);
7326 CALL_GenTextures(ctx
->Exec
, (n
, texName
));
7329 static void GLAPIENTRY
7330 exec_GetPointerv(GLenum pname
, GLvoid
**params
)
7332 GET_CURRENT_CONTEXT(ctx
);
7333 FLUSH_VERTICES(ctx
, 0);
7334 CALL_GetPointerv(ctx
->Exec
, (pname
, params
));
7337 static void GLAPIENTRY
7338 exec_IndexPointer(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
7340 GET_CURRENT_CONTEXT(ctx
);
7341 FLUSH_VERTICES(ctx
, 0);
7342 CALL_IndexPointer(ctx
->Exec
, (type
, stride
, ptr
));
7345 static void GLAPIENTRY
7346 exec_InterleavedArrays(GLenum format
, GLsizei stride
, const GLvoid
* pointer
)
7348 GET_CURRENT_CONTEXT(ctx
);
7349 FLUSH_VERTICES(ctx
, 0);
7350 CALL_InterleavedArrays(ctx
->Exec
, (format
, stride
, pointer
));
7353 static GLboolean GLAPIENTRY
7354 exec_IsTexture(GLuint texture
)
7356 GET_CURRENT_CONTEXT(ctx
);
7357 FLUSH_VERTICES(ctx
, 0);
7358 return CALL_IsTexture(ctx
->Exec
, (texture
));
7361 static void GLAPIENTRY
7362 exec_NormalPointer(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
7364 GET_CURRENT_CONTEXT(ctx
);
7365 FLUSH_VERTICES(ctx
, 0);
7366 CALL_NormalPointer(ctx
->Exec
, (type
, stride
, ptr
));
7369 static void GLAPIENTRY
7370 exec_PopClientAttrib(void)
7372 GET_CURRENT_CONTEXT(ctx
);
7373 FLUSH_VERTICES(ctx
, 0);
7374 CALL_PopClientAttrib(ctx
->Exec
, ());
7377 static void GLAPIENTRY
7378 exec_PushClientAttrib(GLbitfield mask
)
7380 GET_CURRENT_CONTEXT(ctx
);
7381 FLUSH_VERTICES(ctx
, 0);
7382 CALL_PushClientAttrib(ctx
->Exec
, (mask
));
7385 static void GLAPIENTRY
7386 exec_TexCoordPointer(GLint size
, GLenum type
, GLsizei stride
,
7389 GET_CURRENT_CONTEXT(ctx
);
7390 FLUSH_VERTICES(ctx
, 0);
7391 CALL_TexCoordPointer(ctx
->Exec
, (size
, type
, stride
, ptr
));
7394 static void GLAPIENTRY
7395 exec_GetCompressedTexImageARB(GLenum target
, GLint level
, GLvoid
* img
)
7397 GET_CURRENT_CONTEXT(ctx
);
7398 FLUSH_VERTICES(ctx
, 0);
7399 CALL_GetCompressedTexImageARB(ctx
->Exec
, (target
, level
, img
));
7402 static void GLAPIENTRY
7403 exec_VertexPointer(GLint size
, GLenum type
, GLsizei stride
,
7406 GET_CURRENT_CONTEXT(ctx
);
7407 FLUSH_VERTICES(ctx
, 0);
7408 CALL_VertexPointer(ctx
->Exec
, (size
, type
, stride
, ptr
));
7411 static void GLAPIENTRY
7412 exec_CopyConvolutionFilter1D(GLenum target
, GLenum internalFormat
,
7413 GLint x
, GLint y
, GLsizei width
)
7415 GET_CURRENT_CONTEXT(ctx
);
7416 FLUSH_VERTICES(ctx
, 0);
7417 CALL_CopyConvolutionFilter1D(ctx
->Exec
,
7418 (target
, internalFormat
, x
, y
, width
));
7421 static void GLAPIENTRY
7422 exec_CopyConvolutionFilter2D(GLenum target
, GLenum internalFormat
,
7423 GLint x
, GLint y
, GLsizei width
, GLsizei height
)
7425 GET_CURRENT_CONTEXT(ctx
);
7426 FLUSH_VERTICES(ctx
, 0);
7427 CALL_CopyConvolutionFilter2D(ctx
->Exec
,
7428 (target
, internalFormat
, x
, y
, width
,
7432 static void GLAPIENTRY
7433 exec_GetColorTable(GLenum target
, GLenum format
, GLenum type
, GLvoid
* data
)
7435 GET_CURRENT_CONTEXT(ctx
);
7436 FLUSH_VERTICES(ctx
, 0);
7437 CALL_GetColorTable(ctx
->Exec
, (target
, format
, type
, data
));
7440 static void GLAPIENTRY
7441 exec_GetColorTableParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7443 GET_CURRENT_CONTEXT(ctx
);
7444 FLUSH_VERTICES(ctx
, 0);
7445 CALL_GetColorTableParameterfv(ctx
->Exec
, (target
, pname
, params
));
7448 static void GLAPIENTRY
7449 exec_GetColorTableParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7451 GET_CURRENT_CONTEXT(ctx
);
7452 FLUSH_VERTICES(ctx
, 0);
7453 CALL_GetColorTableParameteriv(ctx
->Exec
, (target
, pname
, params
));
7456 static void GLAPIENTRY
7457 exec_GetConvolutionFilter(GLenum target
, GLenum format
, GLenum type
,
7460 GET_CURRENT_CONTEXT(ctx
);
7461 FLUSH_VERTICES(ctx
, 0);
7462 CALL_GetConvolutionFilter(ctx
->Exec
, (target
, format
, type
, image
));
7465 static void GLAPIENTRY
7466 exec_GetConvolutionParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7468 GET_CURRENT_CONTEXT(ctx
);
7469 FLUSH_VERTICES(ctx
, 0);
7470 CALL_GetConvolutionParameterfv(ctx
->Exec
, (target
, pname
, params
));
7473 static void GLAPIENTRY
7474 exec_GetConvolutionParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7476 GET_CURRENT_CONTEXT(ctx
);
7477 FLUSH_VERTICES(ctx
, 0);
7478 CALL_GetConvolutionParameteriv(ctx
->Exec
, (target
, pname
, params
));
7481 static void GLAPIENTRY
7482 exec_GetHistogram(GLenum target
, GLboolean reset
, GLenum format
,
7483 GLenum type
, GLvoid
*values
)
7485 GET_CURRENT_CONTEXT(ctx
);
7486 FLUSH_VERTICES(ctx
, 0);
7487 CALL_GetHistogram(ctx
->Exec
, (target
, reset
, format
, type
, values
));
7490 static void GLAPIENTRY
7491 exec_GetHistogramParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7493 GET_CURRENT_CONTEXT(ctx
);
7494 FLUSH_VERTICES(ctx
, 0);
7495 CALL_GetHistogramParameterfv(ctx
->Exec
, (target
, pname
, params
));
7498 static void GLAPIENTRY
7499 exec_GetHistogramParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7501 GET_CURRENT_CONTEXT(ctx
);
7502 FLUSH_VERTICES(ctx
, 0);
7503 CALL_GetHistogramParameteriv(ctx
->Exec
, (target
, pname
, params
));
7506 static void GLAPIENTRY
7507 exec_GetMinmax(GLenum target
, GLboolean reset
, GLenum format
,
7508 GLenum type
, GLvoid
*values
)
7510 GET_CURRENT_CONTEXT(ctx
);
7511 FLUSH_VERTICES(ctx
, 0);
7512 CALL_GetMinmax(ctx
->Exec
, (target
, reset
, format
, type
, values
));
7515 static void GLAPIENTRY
7516 exec_GetMinmaxParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7518 GET_CURRENT_CONTEXT(ctx
);
7519 FLUSH_VERTICES(ctx
, 0);
7520 CALL_GetMinmaxParameterfv(ctx
->Exec
, (target
, pname
, params
));
7523 static void GLAPIENTRY
7524 exec_GetMinmaxParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7526 GET_CURRENT_CONTEXT(ctx
);
7527 FLUSH_VERTICES(ctx
, 0);
7528 CALL_GetMinmaxParameteriv(ctx
->Exec
, (target
, pname
, params
));
7531 static void GLAPIENTRY
7532 exec_GetSeparableFilter(GLenum target
, GLenum format
, GLenum type
,
7533 GLvoid
*row
, GLvoid
*column
, GLvoid
*span
)
7535 GET_CURRENT_CONTEXT(ctx
);
7536 FLUSH_VERTICES(ctx
, 0);
7537 CALL_GetSeparableFilter(ctx
->Exec
,
7538 (target
, format
, type
, row
, column
, span
));
7541 static void GLAPIENTRY
7542 exec_SeparableFilter2D(GLenum target
, GLenum internalFormat
,
7543 GLsizei width
, GLsizei height
, GLenum format
,
7544 GLenum type
, const GLvoid
*row
, const GLvoid
*column
)
7546 GET_CURRENT_CONTEXT(ctx
);
7547 FLUSH_VERTICES(ctx
, 0);
7548 CALL_SeparableFilter2D(ctx
->Exec
,
7549 (target
, internalFormat
, width
, height
, format
,
7550 type
, row
, column
));
7553 static void GLAPIENTRY
7554 exec_ColorPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
7555 GLsizei count
, const GLvoid
*ptr
)
7557 GET_CURRENT_CONTEXT(ctx
);
7558 FLUSH_VERTICES(ctx
, 0);
7559 CALL_ColorPointerEXT(ctx
->Exec
, (size
, type
, stride
, count
, ptr
));
7562 static void GLAPIENTRY
7563 exec_EdgeFlagPointerEXT(GLsizei stride
, GLsizei count
, const GLboolean
*ptr
)
7565 GET_CURRENT_CONTEXT(ctx
);
7566 FLUSH_VERTICES(ctx
, 0);
7567 CALL_EdgeFlagPointerEXT(ctx
->Exec
, (stride
, count
, ptr
));
7570 static void GLAPIENTRY
7571 exec_IndexPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
,
7574 GET_CURRENT_CONTEXT(ctx
);
7575 FLUSH_VERTICES(ctx
, 0);
7576 CALL_IndexPointerEXT(ctx
->Exec
, (type
, stride
, count
, ptr
));
7579 static void GLAPIENTRY
7580 exec_NormalPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
,
7583 GET_CURRENT_CONTEXT(ctx
);
7584 FLUSH_VERTICES(ctx
, 0);
7585 CALL_NormalPointerEXT(ctx
->Exec
, (type
, stride
, count
, ptr
));
7588 static void GLAPIENTRY
7589 exec_TexCoordPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
7590 GLsizei count
, const GLvoid
*ptr
)
7592 GET_CURRENT_CONTEXT(ctx
);
7593 FLUSH_VERTICES(ctx
, 0);
7594 CALL_TexCoordPointerEXT(ctx
->Exec
, (size
, type
, stride
, count
, ptr
));
7597 static void GLAPIENTRY
7598 exec_VertexPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
7599 GLsizei count
, const GLvoid
*ptr
)
7601 GET_CURRENT_CONTEXT(ctx
);
7602 FLUSH_VERTICES(ctx
, 0);
7603 CALL_VertexPointerEXT(ctx
->Exec
, (size
, type
, stride
, count
, ptr
));
7606 static void GLAPIENTRY
7607 exec_LockArraysEXT(GLint first
, GLsizei count
)
7609 GET_CURRENT_CONTEXT(ctx
);
7610 FLUSH_VERTICES(ctx
, 0);
7611 CALL_LockArraysEXT(ctx
->Exec
, (first
, count
));
7614 static void GLAPIENTRY
7615 exec_UnlockArraysEXT(void)
7617 GET_CURRENT_CONTEXT(ctx
);
7618 FLUSH_VERTICES(ctx
, 0);
7619 CALL_UnlockArraysEXT(ctx
->Exec
, ());
7622 static void GLAPIENTRY
7623 exec_ClientActiveTextureARB(GLenum target
)
7625 GET_CURRENT_CONTEXT(ctx
);
7626 FLUSH_VERTICES(ctx
, 0);
7627 CALL_ClientActiveTextureARB(ctx
->Exec
, (target
));
7630 static void GLAPIENTRY
7631 exec_SecondaryColorPointerEXT(GLint size
, GLenum type
,
7632 GLsizei stride
, const GLvoid
*ptr
)
7634 GET_CURRENT_CONTEXT(ctx
);
7635 FLUSH_VERTICES(ctx
, 0);
7636 CALL_SecondaryColorPointerEXT(ctx
->Exec
, (size
, type
, stride
, ptr
));
7639 static void GLAPIENTRY
7640 exec_FogCoordPointerEXT(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
7642 GET_CURRENT_CONTEXT(ctx
);
7643 FLUSH_VERTICES(ctx
, 0);
7644 CALL_FogCoordPointerEXT(ctx
->Exec
, (type
, stride
, ptr
));
7647 /* GL_EXT_multi_draw_arrays */
7648 static void GLAPIENTRY
7649 exec_MultiDrawArraysEXT(GLenum mode
, GLint
* first
,
7650 GLsizei
* count
, GLsizei primcount
)
7652 GET_CURRENT_CONTEXT(ctx
);
7653 FLUSH_VERTICES(ctx
, 0);
7654 CALL_MultiDrawArraysEXT(ctx
->Exec
, (mode
, first
, count
, primcount
));
7657 /* GL_EXT_multi_draw_arrays */
7658 static void GLAPIENTRY
7659 exec_MultiDrawElementsEXT(GLenum mode
, const GLsizei
* count
,
7660 GLenum type
, const GLvoid
** indices
,
7663 GET_CURRENT_CONTEXT(ctx
);
7664 FLUSH_VERTICES(ctx
, 0);
7665 CALL_MultiDrawElementsEXT(ctx
->Exec
,
7666 (mode
, count
, type
, indices
, primcount
));
7669 /* GL_IBM_multimode_draw_arrays */
7670 static void GLAPIENTRY
7671 exec_MultiModeDrawArraysIBM(const GLenum
* mode
, const GLint
* first
,
7672 const GLsizei
* count
, GLsizei primcount
,
7675 GET_CURRENT_CONTEXT(ctx
);
7676 FLUSH_VERTICES(ctx
, 0);
7677 CALL_MultiModeDrawArraysIBM(ctx
->Exec
,
7678 (mode
, first
, count
, primcount
, modestride
));
7681 /* GL_IBM_multimode_draw_arrays */
7682 static void GLAPIENTRY
7683 exec_MultiModeDrawElementsIBM(const GLenum
* mode
,
7684 const GLsizei
* count
,
7686 const GLvoid
* const *indices
,
7687 GLsizei primcount
, GLint modestride
)
7689 GET_CURRENT_CONTEXT(ctx
);
7690 FLUSH_VERTICES(ctx
, 0);
7691 CALL_MultiModeDrawElementsIBM(ctx
->Exec
,
7692 (mode
, count
, type
, indices
, primcount
,
7699 * Setup the given dispatch table to point to Mesa's display list
7700 * building functions.
7702 * This does not include any of the tnl functions - they are
7703 * initialized from _mesa_init_api_defaults and from the active vtxfmt
7707 _mesa_init_dlist_table(struct _glapi_table
*table
)
7709 _mesa_loopback_init_api_table(table
);
7712 SET_Accum(table
, save_Accum
);
7713 SET_AlphaFunc(table
, save_AlphaFunc
);
7714 SET_Bitmap(table
, save_Bitmap
);
7715 SET_BlendFunc(table
, save_BlendFunc
);
7716 SET_CallList(table
, _mesa_save_CallList
);
7717 SET_CallLists(table
, _mesa_save_CallLists
);
7718 SET_Clear(table
, save_Clear
);
7719 SET_ClearAccum(table
, save_ClearAccum
);
7720 SET_ClearColor(table
, save_ClearColor
);
7721 SET_ClearDepth(table
, save_ClearDepth
);
7722 SET_ClearIndex(table
, save_ClearIndex
);
7723 SET_ClearStencil(table
, save_ClearStencil
);
7724 SET_ClipPlane(table
, save_ClipPlane
);
7725 SET_ColorMask(table
, save_ColorMask
);
7726 SET_ColorMaterial(table
, save_ColorMaterial
);
7727 SET_CopyPixels(table
, save_CopyPixels
);
7728 SET_CullFace(table
, save_CullFace
);
7729 SET_DeleteLists(table
, _mesa_DeleteLists
);
7730 SET_DepthFunc(table
, save_DepthFunc
);
7731 SET_DepthMask(table
, save_DepthMask
);
7732 SET_DepthRange(table
, save_DepthRange
);
7733 SET_Disable(table
, save_Disable
);
7734 SET_DrawBuffer(table
, save_DrawBuffer
);
7735 SET_DrawPixels(table
, save_DrawPixels
);
7736 SET_Enable(table
, save_Enable
);
7737 SET_EndList(table
, _mesa_EndList
);
7738 SET_EvalMesh1(table
, _mesa_save_EvalMesh1
);
7739 SET_EvalMesh2(table
, _mesa_save_EvalMesh2
);
7740 SET_Finish(table
, exec_Finish
);
7741 SET_Flush(table
, exec_Flush
);
7742 SET_Fogf(table
, save_Fogf
);
7743 SET_Fogfv(table
, save_Fogfv
);
7744 SET_Fogi(table
, save_Fogi
);
7745 SET_Fogiv(table
, save_Fogiv
);
7746 SET_FrontFace(table
, save_FrontFace
);
7747 SET_Frustum(table
, save_Frustum
);
7748 SET_GenLists(table
, _mesa_GenLists
);
7749 SET_GetBooleanv(table
, exec_GetBooleanv
);
7750 SET_GetClipPlane(table
, exec_GetClipPlane
);
7751 SET_GetDoublev(table
, exec_GetDoublev
);
7752 SET_GetError(table
, exec_GetError
);
7753 SET_GetFloatv(table
, exec_GetFloatv
);
7754 SET_GetIntegerv(table
, exec_GetIntegerv
);
7755 SET_GetLightfv(table
, exec_GetLightfv
);
7756 SET_GetLightiv(table
, exec_GetLightiv
);
7757 SET_GetMapdv(table
, exec_GetMapdv
);
7758 SET_GetMapfv(table
, exec_GetMapfv
);
7759 SET_GetMapiv(table
, exec_GetMapiv
);
7760 SET_GetMaterialfv(table
, exec_GetMaterialfv
);
7761 SET_GetMaterialiv(table
, exec_GetMaterialiv
);
7762 SET_GetPixelMapfv(table
, exec_GetPixelMapfv
);
7763 SET_GetPixelMapuiv(table
, exec_GetPixelMapuiv
);
7764 SET_GetPixelMapusv(table
, exec_GetPixelMapusv
);
7765 SET_GetPolygonStipple(table
, exec_GetPolygonStipple
);
7766 SET_GetString(table
, exec_GetString
);
7767 SET_GetTexEnvfv(table
, exec_GetTexEnvfv
);
7768 SET_GetTexEnviv(table
, exec_GetTexEnviv
);
7769 SET_GetTexGendv(table
, exec_GetTexGendv
);
7770 SET_GetTexGenfv(table
, exec_GetTexGenfv
);
7771 SET_GetTexGeniv(table
, exec_GetTexGeniv
);
7772 SET_GetTexImage(table
, exec_GetTexImage
);
7773 SET_GetTexLevelParameterfv(table
, exec_GetTexLevelParameterfv
);
7774 SET_GetTexLevelParameteriv(table
, exec_GetTexLevelParameteriv
);
7775 SET_GetTexParameterfv(table
, exec_GetTexParameterfv
);
7776 SET_GetTexParameteriv(table
, exec_GetTexParameteriv
);
7777 SET_Hint(table
, save_Hint
);
7778 SET_IndexMask(table
, save_IndexMask
);
7779 SET_InitNames(table
, save_InitNames
);
7780 SET_IsEnabled(table
, exec_IsEnabled
);
7781 SET_IsList(table
, _mesa_IsList
);
7782 SET_LightModelf(table
, save_LightModelf
);
7783 SET_LightModelfv(table
, save_LightModelfv
);
7784 SET_LightModeli(table
, save_LightModeli
);
7785 SET_LightModeliv(table
, save_LightModeliv
);
7786 SET_Lightf(table
, save_Lightf
);
7787 SET_Lightfv(table
, save_Lightfv
);
7788 SET_Lighti(table
, save_Lighti
);
7789 SET_Lightiv(table
, save_Lightiv
);
7790 SET_LineStipple(table
, save_LineStipple
);
7791 SET_LineWidth(table
, save_LineWidth
);
7792 SET_ListBase(table
, save_ListBase
);
7793 SET_LoadIdentity(table
, save_LoadIdentity
);
7794 SET_LoadMatrixd(table
, save_LoadMatrixd
);
7795 SET_LoadMatrixf(table
, save_LoadMatrixf
);
7796 SET_LoadName(table
, save_LoadName
);
7797 SET_LogicOp(table
, save_LogicOp
);
7798 SET_Map1d(table
, save_Map1d
);
7799 SET_Map1f(table
, save_Map1f
);
7800 SET_Map2d(table
, save_Map2d
);
7801 SET_Map2f(table
, save_Map2f
);
7802 SET_MapGrid1d(table
, save_MapGrid1d
);
7803 SET_MapGrid1f(table
, save_MapGrid1f
);
7804 SET_MapGrid2d(table
, save_MapGrid2d
);
7805 SET_MapGrid2f(table
, save_MapGrid2f
);
7806 SET_MatrixMode(table
, save_MatrixMode
);
7807 SET_MultMatrixd(table
, save_MultMatrixd
);
7808 SET_MultMatrixf(table
, save_MultMatrixf
);
7809 SET_NewList(table
, save_NewList
);
7810 SET_Ortho(table
, save_Ortho
);
7811 SET_PassThrough(table
, save_PassThrough
);
7812 SET_PixelMapfv(table
, save_PixelMapfv
);
7813 SET_PixelMapuiv(table
, save_PixelMapuiv
);
7814 SET_PixelMapusv(table
, save_PixelMapusv
);
7815 SET_PixelStoref(table
, exec_PixelStoref
);
7816 SET_PixelStorei(table
, exec_PixelStorei
);
7817 SET_PixelTransferf(table
, save_PixelTransferf
);
7818 SET_PixelTransferi(table
, save_PixelTransferi
);
7819 SET_PixelZoom(table
, save_PixelZoom
);
7820 SET_PointSize(table
, save_PointSize
);
7821 SET_PolygonMode(table
, save_PolygonMode
);
7822 SET_PolygonOffset(table
, save_PolygonOffset
);
7823 SET_PolygonStipple(table
, save_PolygonStipple
);
7824 SET_PopAttrib(table
, save_PopAttrib
);
7825 SET_PopMatrix(table
, save_PopMatrix
);
7826 SET_PopName(table
, save_PopName
);
7827 SET_PushAttrib(table
, save_PushAttrib
);
7828 SET_PushMatrix(table
, save_PushMatrix
);
7829 SET_PushName(table
, save_PushName
);
7830 SET_RasterPos2d(table
, save_RasterPos2d
);
7831 SET_RasterPos2dv(table
, save_RasterPos2dv
);
7832 SET_RasterPos2f(table
, save_RasterPos2f
);
7833 SET_RasterPos2fv(table
, save_RasterPos2fv
);
7834 SET_RasterPos2i(table
, save_RasterPos2i
);
7835 SET_RasterPos2iv(table
, save_RasterPos2iv
);
7836 SET_RasterPos2s(table
, save_RasterPos2s
);
7837 SET_RasterPos2sv(table
, save_RasterPos2sv
);
7838 SET_RasterPos3d(table
, save_RasterPos3d
);
7839 SET_RasterPos3dv(table
, save_RasterPos3dv
);
7840 SET_RasterPos3f(table
, save_RasterPos3f
);
7841 SET_RasterPos3fv(table
, save_RasterPos3fv
);
7842 SET_RasterPos3i(table
, save_RasterPos3i
);
7843 SET_RasterPos3iv(table
, save_RasterPos3iv
);
7844 SET_RasterPos3s(table
, save_RasterPos3s
);
7845 SET_RasterPos3sv(table
, save_RasterPos3sv
);
7846 SET_RasterPos4d(table
, save_RasterPos4d
);
7847 SET_RasterPos4dv(table
, save_RasterPos4dv
);
7848 SET_RasterPos4f(table
, save_RasterPos4f
);
7849 SET_RasterPos4fv(table
, save_RasterPos4fv
);
7850 SET_RasterPos4i(table
, save_RasterPos4i
);
7851 SET_RasterPos4iv(table
, save_RasterPos4iv
);
7852 SET_RasterPos4s(table
, save_RasterPos4s
);
7853 SET_RasterPos4sv(table
, save_RasterPos4sv
);
7854 SET_ReadBuffer(table
, save_ReadBuffer
);
7855 SET_ReadPixels(table
, exec_ReadPixels
);
7856 SET_RenderMode(table
, exec_RenderMode
);
7857 SET_Rotated(table
, save_Rotated
);
7858 SET_Rotatef(table
, save_Rotatef
);
7859 SET_Scaled(table
, save_Scaled
);
7860 SET_Scalef(table
, save_Scalef
);
7861 SET_Scissor(table
, save_Scissor
);
7862 SET_FeedbackBuffer(table
, exec_FeedbackBuffer
);
7863 SET_SelectBuffer(table
, exec_SelectBuffer
);
7864 SET_ShadeModel(table
, save_ShadeModel
);
7865 SET_StencilFunc(table
, save_StencilFunc
);
7866 SET_StencilMask(table
, save_StencilMask
);
7867 SET_StencilOp(table
, save_StencilOp
);
7868 SET_TexEnvf(table
, save_TexEnvf
);
7869 SET_TexEnvfv(table
, save_TexEnvfv
);
7870 SET_TexEnvi(table
, save_TexEnvi
);
7871 SET_TexEnviv(table
, save_TexEnviv
);
7872 SET_TexGend(table
, save_TexGend
);
7873 SET_TexGendv(table
, save_TexGendv
);
7874 SET_TexGenf(table
, save_TexGenf
);
7875 SET_TexGenfv(table
, save_TexGenfv
);
7876 SET_TexGeni(table
, save_TexGeni
);
7877 SET_TexGeniv(table
, save_TexGeniv
);
7878 SET_TexImage1D(table
, save_TexImage1D
);
7879 SET_TexImage2D(table
, save_TexImage2D
);
7880 SET_TexParameterf(table
, save_TexParameterf
);
7881 SET_TexParameterfv(table
, save_TexParameterfv
);
7882 SET_TexParameteri(table
, save_TexParameteri
);
7883 SET_TexParameteriv(table
, save_TexParameteriv
);
7884 SET_Translated(table
, save_Translated
);
7885 SET_Translatef(table
, save_Translatef
);
7886 SET_Viewport(table
, save_Viewport
);
7889 SET_AreTexturesResident(table
, exec_AreTexturesResident
);
7890 SET_BindTexture(table
, save_BindTexture
);
7891 SET_ColorPointer(table
, exec_ColorPointer
);
7892 SET_CopyTexImage1D(table
, save_CopyTexImage1D
);
7893 SET_CopyTexImage2D(table
, save_CopyTexImage2D
);
7894 SET_CopyTexSubImage1D(table
, save_CopyTexSubImage1D
);
7895 SET_CopyTexSubImage2D(table
, save_CopyTexSubImage2D
);
7896 SET_DeleteTextures(table
, exec_DeleteTextures
);
7897 SET_DisableClientState(table
, exec_DisableClientState
);
7898 SET_EdgeFlagPointer(table
, exec_EdgeFlagPointer
);
7899 SET_EnableClientState(table
, exec_EnableClientState
);
7900 SET_GenTextures(table
, exec_GenTextures
);
7901 SET_GetPointerv(table
, exec_GetPointerv
);
7902 SET_IndexPointer(table
, exec_IndexPointer
);
7903 SET_InterleavedArrays(table
, exec_InterleavedArrays
);
7904 SET_IsTexture(table
, exec_IsTexture
);
7905 SET_NormalPointer(table
, exec_NormalPointer
);
7906 SET_PopClientAttrib(table
, exec_PopClientAttrib
);
7907 SET_PrioritizeTextures(table
, save_PrioritizeTextures
);
7908 SET_PushClientAttrib(table
, exec_PushClientAttrib
);
7909 SET_TexCoordPointer(table
, exec_TexCoordPointer
);
7910 SET_TexSubImage1D(table
, save_TexSubImage1D
);
7911 SET_TexSubImage2D(table
, save_TexSubImage2D
);
7912 SET_VertexPointer(table
, exec_VertexPointer
);
7915 SET_CopyTexSubImage3D(table
, save_CopyTexSubImage3D
);
7916 SET_TexImage3D(table
, save_TexImage3D
);
7917 SET_TexSubImage3D(table
, save_TexSubImage3D
);
7920 SET_StencilFuncSeparate(table
, save_StencilFuncSeparate
);
7921 SET_StencilMaskSeparate(table
, save_StencilMaskSeparate
);
7922 SET_StencilOpSeparate(table
, save_StencilOpSeparate
);
7924 /* ATI_separate_stencil */
7925 SET_StencilFuncSeparateATI(table
, save_StencilFuncSeparateATI
);
7927 /* GL_ARB_imaging */
7928 /* Not all are supported */
7929 SET_BlendColor(table
, save_BlendColor
);
7930 SET_BlendEquation(table
, save_BlendEquation
);
7931 SET_ColorSubTable(table
, save_ColorSubTable
);
7932 SET_ColorTable(table
, save_ColorTable
);
7933 SET_ColorTableParameterfv(table
, save_ColorTableParameterfv
);
7934 SET_ColorTableParameteriv(table
, save_ColorTableParameteriv
);
7935 SET_ConvolutionFilter1D(table
, save_ConvolutionFilter1D
);
7936 SET_ConvolutionFilter2D(table
, save_ConvolutionFilter2D
);
7937 SET_ConvolutionParameterf(table
, save_ConvolutionParameterf
);
7938 SET_ConvolutionParameterfv(table
, save_ConvolutionParameterfv
);
7939 SET_ConvolutionParameteri(table
, save_ConvolutionParameteri
);
7940 SET_ConvolutionParameteriv(table
, save_ConvolutionParameteriv
);
7941 SET_CopyColorSubTable(table
, save_CopyColorSubTable
);
7942 SET_CopyColorTable(table
, save_CopyColorTable
);
7943 SET_CopyConvolutionFilter1D(table
, exec_CopyConvolutionFilter1D
);
7944 SET_CopyConvolutionFilter2D(table
, exec_CopyConvolutionFilter2D
);
7945 SET_GetColorTable(table
, exec_GetColorTable
);
7946 SET_GetColorTableParameterfv(table
, exec_GetColorTableParameterfv
);
7947 SET_GetColorTableParameteriv(table
, exec_GetColorTableParameteriv
);
7948 SET_GetConvolutionFilter(table
, exec_GetConvolutionFilter
);
7949 SET_GetConvolutionParameterfv(table
, exec_GetConvolutionParameterfv
);
7950 SET_GetConvolutionParameteriv(table
, exec_GetConvolutionParameteriv
);
7951 SET_GetHistogram(table
, exec_GetHistogram
);
7952 SET_GetHistogramParameterfv(table
, exec_GetHistogramParameterfv
);
7953 SET_GetHistogramParameteriv(table
, exec_GetHistogramParameteriv
);
7954 SET_GetMinmax(table
, exec_GetMinmax
);
7955 SET_GetMinmaxParameterfv(table
, exec_GetMinmaxParameterfv
);
7956 SET_GetMinmaxParameteriv(table
, exec_GetMinmaxParameteriv
);
7957 SET_GetSeparableFilter(table
, exec_GetSeparableFilter
);
7958 SET_Histogram(table
, save_Histogram
);
7959 SET_Minmax(table
, save_Minmax
);
7960 SET_ResetHistogram(table
, save_ResetHistogram
);
7961 SET_ResetMinmax(table
, save_ResetMinmax
);
7962 SET_SeparableFilter2D(table
, exec_SeparableFilter2D
);
7964 /* 2. GL_EXT_blend_color */
7966 SET_BlendColorEXT(table
, save_BlendColorEXT
);
7969 /* 3. GL_EXT_polygon_offset */
7970 SET_PolygonOffsetEXT(table
, save_PolygonOffsetEXT
);
7972 /* 6. GL_EXT_texture3d */
7974 SET_CopyTexSubImage3DEXT(table
, save_CopyTexSubImage3D
);
7975 SET_TexImage3DEXT(table
, save_TexImage3DEXT
);
7976 SET_TexSubImage3DEXT(table
, save_TexSubImage3D
);
7979 /* 14. GL_SGI_color_table */
7981 SET_ColorTableSGI(table
, save_ColorTable
);
7982 SET_ColorSubTableSGI(table
, save_ColorSubTable
);
7983 SET_GetColorTableSGI(table
, exec_GetColorTable
);
7984 SET_GetColorTableParameterfvSGI(table
, exec_GetColorTableParameterfv
);
7985 SET_GetColorTableParameterivSGI(table
, exec_GetColorTableParameteriv
);
7988 /* 30. GL_EXT_vertex_array */
7989 SET_ColorPointerEXT(table
, exec_ColorPointerEXT
);
7990 SET_EdgeFlagPointerEXT(table
, exec_EdgeFlagPointerEXT
);
7991 SET_IndexPointerEXT(table
, exec_IndexPointerEXT
);
7992 SET_NormalPointerEXT(table
, exec_NormalPointerEXT
);
7993 SET_TexCoordPointerEXT(table
, exec_TexCoordPointerEXT
);
7994 SET_VertexPointerEXT(table
, exec_VertexPointerEXT
);
7996 /* 37. GL_EXT_blend_minmax */
7998 SET_BlendEquationEXT(table
, save_BlendEquationEXT
);
8001 /* 54. GL_EXT_point_parameters */
8002 SET_PointParameterfEXT(table
, save_PointParameterfEXT
);
8003 SET_PointParameterfvEXT(table
, save_PointParameterfvEXT
);
8005 /* 97. GL_EXT_compiled_vertex_array */
8006 SET_LockArraysEXT(table
, exec_LockArraysEXT
);
8007 SET_UnlockArraysEXT(table
, exec_UnlockArraysEXT
);
8009 /* 145. GL_EXT_secondary_color */
8010 SET_SecondaryColorPointerEXT(table
, exec_SecondaryColorPointerEXT
);
8012 /* 148. GL_EXT_multi_draw_arrays */
8013 SET_MultiDrawArraysEXT(table
, exec_MultiDrawArraysEXT
);
8014 SET_MultiDrawElementsEXT(table
, exec_MultiDrawElementsEXT
);
8016 /* 149. GL_EXT_fog_coord */
8017 SET_FogCoordPointerEXT(table
, exec_FogCoordPointerEXT
);
8019 /* 173. GL_EXT_blend_func_separate */
8020 SET_BlendFuncSeparateEXT(table
, save_BlendFuncSeparateEXT
);
8022 /* 196. GL_MESA_resize_buffers */
8023 SET_ResizeBuffersMESA(table
, _mesa_ResizeBuffersMESA
);
8025 /* 197. GL_MESA_window_pos */
8026 SET_WindowPos2dMESA(table
, save_WindowPos2dMESA
);
8027 SET_WindowPos2dvMESA(table
, save_WindowPos2dvMESA
);
8028 SET_WindowPos2fMESA(table
, save_WindowPos2fMESA
);
8029 SET_WindowPos2fvMESA(table
, save_WindowPos2fvMESA
);
8030 SET_WindowPos2iMESA(table
, save_WindowPos2iMESA
);
8031 SET_WindowPos2ivMESA(table
, save_WindowPos2ivMESA
);
8032 SET_WindowPos2sMESA(table
, save_WindowPos2sMESA
);
8033 SET_WindowPos2svMESA(table
, save_WindowPos2svMESA
);
8034 SET_WindowPos3dMESA(table
, save_WindowPos3dMESA
);
8035 SET_WindowPos3dvMESA(table
, save_WindowPos3dvMESA
);
8036 SET_WindowPos3fMESA(table
, save_WindowPos3fMESA
);
8037 SET_WindowPos3fvMESA(table
, save_WindowPos3fvMESA
);
8038 SET_WindowPos3iMESA(table
, save_WindowPos3iMESA
);
8039 SET_WindowPos3ivMESA(table
, save_WindowPos3ivMESA
);
8040 SET_WindowPos3sMESA(table
, save_WindowPos3sMESA
);
8041 SET_WindowPos3svMESA(table
, save_WindowPos3svMESA
);
8042 SET_WindowPos4dMESA(table
, save_WindowPos4dMESA
);
8043 SET_WindowPos4dvMESA(table
, save_WindowPos4dvMESA
);
8044 SET_WindowPos4fMESA(table
, save_WindowPos4fMESA
);
8045 SET_WindowPos4fvMESA(table
, save_WindowPos4fvMESA
);
8046 SET_WindowPos4iMESA(table
, save_WindowPos4iMESA
);
8047 SET_WindowPos4ivMESA(table
, save_WindowPos4ivMESA
);
8048 SET_WindowPos4sMESA(table
, save_WindowPos4sMESA
);
8049 SET_WindowPos4svMESA(table
, save_WindowPos4svMESA
);
8051 /* 200. GL_IBM_multimode_draw_arrays */
8052 SET_MultiModeDrawArraysIBM(table
, exec_MultiModeDrawArraysIBM
);
8053 SET_MultiModeDrawElementsIBM(table
, exec_MultiModeDrawElementsIBM
);
8055 #if FEATURE_NV_vertex_program
8056 /* 233. GL_NV_vertex_program */
8057 /* The following commands DO NOT go into display lists:
8058 * AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV,
8059 * VertexAttribPointerNV, GetProgram*, GetVertexAttrib*
8061 SET_BindProgramNV(table
, save_BindProgramNV
);
8062 SET_DeleteProgramsNV(table
, _mesa_DeletePrograms
);
8063 SET_ExecuteProgramNV(table
, save_ExecuteProgramNV
);
8064 SET_GenProgramsNV(table
, _mesa_GenPrograms
);
8065 SET_AreProgramsResidentNV(table
, _mesa_AreProgramsResidentNV
);
8066 SET_RequestResidentProgramsNV(table
, save_RequestResidentProgramsNV
);
8067 SET_GetProgramParameterfvNV(table
, _mesa_GetProgramParameterfvNV
);
8068 SET_GetProgramParameterdvNV(table
, _mesa_GetProgramParameterdvNV
);
8069 SET_GetProgramivNV(table
, _mesa_GetProgramivNV
);
8070 SET_GetProgramStringNV(table
, _mesa_GetProgramStringNV
);
8071 SET_GetTrackMatrixivNV(table
, _mesa_GetTrackMatrixivNV
);
8072 SET_GetVertexAttribdvNV(table
, _mesa_GetVertexAttribdvNV
);
8073 SET_GetVertexAttribfvNV(table
, _mesa_GetVertexAttribfvNV
);
8074 SET_GetVertexAttribivNV(table
, _mesa_GetVertexAttribivNV
);
8075 SET_GetVertexAttribPointervNV(table
, _mesa_GetVertexAttribPointervNV
);
8076 SET_IsProgramNV(table
, _mesa_IsProgramARB
);
8077 SET_LoadProgramNV(table
, save_LoadProgramNV
);
8078 SET_ProgramEnvParameter4dARB(table
, save_ProgramEnvParameter4dARB
);
8079 SET_ProgramEnvParameter4dvARB(table
, save_ProgramEnvParameter4dvARB
);
8080 SET_ProgramEnvParameter4fARB(table
, save_ProgramEnvParameter4fARB
);
8081 SET_ProgramEnvParameter4fvARB(table
, save_ProgramEnvParameter4fvARB
);
8082 SET_ProgramParameters4dvNV(table
, save_ProgramParameters4dvNV
);
8083 SET_ProgramParameters4fvNV(table
, save_ProgramParameters4fvNV
);
8084 SET_TrackMatrixNV(table
, save_TrackMatrixNV
);
8085 SET_VertexAttribPointerNV(table
, _mesa_VertexAttribPointerNV
);
8088 /* 244. GL_ATI_envmap_bumpmap */
8089 SET_TexBumpParameterivATI(table
, save_TexBumpParameterivATI
);
8090 SET_TexBumpParameterfvATI(table
, save_TexBumpParameterfvATI
);
8092 /* 245. GL_ATI_fragment_shader */
8093 #if FEATURE_ATI_fragment_shader
8094 SET_BindFragmentShaderATI(table
, save_BindFragmentShaderATI
);
8095 SET_SetFragmentShaderConstantATI(table
, save_SetFragmentShaderConstantATI
);
8098 /* 282. GL_NV_fragment_program */
8099 #if FEATURE_NV_fragment_program
8100 SET_ProgramNamedParameter4fNV(table
, save_ProgramNamedParameter4fNV
);
8101 SET_ProgramNamedParameter4dNV(table
, save_ProgramNamedParameter4dNV
);
8102 SET_ProgramNamedParameter4fvNV(table
, save_ProgramNamedParameter4fvNV
);
8103 SET_ProgramNamedParameter4dvNV(table
, save_ProgramNamedParameter4dvNV
);
8104 SET_GetProgramNamedParameterfvNV(table
,
8105 _mesa_GetProgramNamedParameterfvNV
);
8106 SET_GetProgramNamedParameterdvNV(table
,
8107 _mesa_GetProgramNamedParameterdvNV
);
8108 SET_ProgramLocalParameter4dARB(table
, save_ProgramLocalParameter4dARB
);
8109 SET_ProgramLocalParameter4dvARB(table
, save_ProgramLocalParameter4dvARB
);
8110 SET_ProgramLocalParameter4fARB(table
, save_ProgramLocalParameter4fARB
);
8111 SET_ProgramLocalParameter4fvARB(table
, save_ProgramLocalParameter4fvARB
);
8112 SET_GetProgramLocalParameterdvARB(table
,
8113 _mesa_GetProgramLocalParameterdvARB
);
8114 SET_GetProgramLocalParameterfvARB(table
,
8115 _mesa_GetProgramLocalParameterfvARB
);
8118 /* 262. GL_NV_point_sprite */
8119 SET_PointParameteriNV(table
, save_PointParameteriNV
);
8120 SET_PointParameterivNV(table
, save_PointParameterivNV
);
8122 /* 268. GL_EXT_stencil_two_side */
8123 SET_ActiveStencilFaceEXT(table
, save_ActiveStencilFaceEXT
);
8125 /* 273. GL_APPLE_vertex_array_object */
8126 SET_BindVertexArrayAPPLE(table
, _mesa_BindVertexArrayAPPLE
);
8127 SET_DeleteVertexArraysAPPLE(table
, _mesa_DeleteVertexArraysAPPLE
);
8128 SET_GenVertexArraysAPPLE(table
, _mesa_GenVertexArraysAPPLE
);
8129 SET_IsVertexArrayAPPLE(table
, _mesa_IsVertexArrayAPPLE
);
8131 /* ???. GL_EXT_depth_bounds_test */
8132 SET_DepthBoundsEXT(table
, save_DepthBoundsEXT
);
8134 /* ARB 1. GL_ARB_multitexture */
8135 SET_ActiveTextureARB(table
, save_ActiveTextureARB
);
8136 SET_ClientActiveTextureARB(table
, exec_ClientActiveTextureARB
);
8138 /* ARB 3. GL_ARB_transpose_matrix */
8139 SET_LoadTransposeMatrixdARB(table
, save_LoadTransposeMatrixdARB
);
8140 SET_LoadTransposeMatrixfARB(table
, save_LoadTransposeMatrixfARB
);
8141 SET_MultTransposeMatrixdARB(table
, save_MultTransposeMatrixdARB
);
8142 SET_MultTransposeMatrixfARB(table
, save_MultTransposeMatrixfARB
);
8144 /* ARB 5. GL_ARB_multisample */
8145 SET_SampleCoverageARB(table
, save_SampleCoverageARB
);
8147 /* ARB 12. GL_ARB_texture_compression */
8148 SET_CompressedTexImage3DARB(table
, save_CompressedTexImage3DARB
);
8149 SET_CompressedTexImage2DARB(table
, save_CompressedTexImage2DARB
);
8150 SET_CompressedTexImage1DARB(table
, save_CompressedTexImage1DARB
);
8151 SET_CompressedTexSubImage3DARB(table
, save_CompressedTexSubImage3DARB
);
8152 SET_CompressedTexSubImage2DARB(table
, save_CompressedTexSubImage2DARB
);
8153 SET_CompressedTexSubImage1DARB(table
, save_CompressedTexSubImage1DARB
);
8154 SET_GetCompressedTexImageARB(table
, exec_GetCompressedTexImageARB
);
8156 /* ARB 14. GL_ARB_point_parameters */
8157 /* aliased with EXT_point_parameters functions */
8159 /* ARB 25. GL_ARB_window_pos */
8160 /* aliased with MESA_window_pos functions */
8162 /* ARB 26. GL_ARB_vertex_program */
8163 /* ARB 27. GL_ARB_fragment_program */
8164 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
8165 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
8166 SET_VertexAttribPointerARB(table
, _mesa_VertexAttribPointerARB
);
8167 SET_EnableVertexAttribArrayARB(table
, _mesa_EnableVertexAttribArrayARB
);
8168 SET_DisableVertexAttribArrayARB(table
, _mesa_DisableVertexAttribArrayARB
);
8169 SET_ProgramStringARB(table
, save_ProgramStringARB
);
8170 SET_BindProgramNV(table
, save_BindProgramNV
);
8171 SET_DeleteProgramsNV(table
, _mesa_DeletePrograms
);
8172 SET_GenProgramsNV(table
, _mesa_GenPrograms
);
8173 SET_IsProgramNV(table
, _mesa_IsProgramARB
);
8174 SET_GetVertexAttribdvNV(table
, _mesa_GetVertexAttribdvNV
);
8175 SET_GetVertexAttribfvNV(table
, _mesa_GetVertexAttribfvNV
);
8176 SET_GetVertexAttribivNV(table
, _mesa_GetVertexAttribivNV
);
8177 SET_GetVertexAttribPointervNV(table
, _mesa_GetVertexAttribPointervNV
);
8178 SET_ProgramEnvParameter4dARB(table
, save_ProgramEnvParameter4dARB
);
8179 SET_ProgramEnvParameter4dvARB(table
, save_ProgramEnvParameter4dvARB
);
8180 SET_ProgramEnvParameter4fARB(table
, save_ProgramEnvParameter4fARB
);
8181 SET_ProgramEnvParameter4fvARB(table
, save_ProgramEnvParameter4fvARB
);
8182 SET_ProgramLocalParameter4dARB(table
, save_ProgramLocalParameter4dARB
);
8183 SET_ProgramLocalParameter4dvARB(table
, save_ProgramLocalParameter4dvARB
);
8184 SET_ProgramLocalParameter4fARB(table
, save_ProgramLocalParameter4fARB
);
8185 SET_ProgramLocalParameter4fvARB(table
, save_ProgramLocalParameter4fvARB
);
8186 SET_GetProgramEnvParameterdvARB(table
, _mesa_GetProgramEnvParameterdvARB
);
8187 SET_GetProgramEnvParameterfvARB(table
, _mesa_GetProgramEnvParameterfvARB
);
8188 SET_GetProgramLocalParameterdvARB(table
,
8189 _mesa_GetProgramLocalParameterdvARB
);
8190 SET_GetProgramLocalParameterfvARB(table
,
8191 _mesa_GetProgramLocalParameterfvARB
);
8192 SET_GetProgramivARB(table
, _mesa_GetProgramivARB
);
8193 SET_GetProgramStringARB(table
, _mesa_GetProgramStringARB
);
8196 /* ARB 28. GL_ARB_vertex_buffer_object */
8197 #if FEATURE_ARB_vertex_buffer_object
8198 /* None of the extension's functions get compiled */
8199 SET_BindBufferARB(table
, _mesa_BindBufferARB
);
8200 SET_BufferDataARB(table
, _mesa_BufferDataARB
);
8201 SET_BufferSubDataARB(table
, _mesa_BufferSubDataARB
);
8202 SET_DeleteBuffersARB(table
, _mesa_DeleteBuffersARB
);
8203 SET_GenBuffersARB(table
, _mesa_GenBuffersARB
);
8204 SET_GetBufferParameterivARB(table
, _mesa_GetBufferParameterivARB
);
8205 SET_GetBufferPointervARB(table
, _mesa_GetBufferPointervARB
);
8206 SET_GetBufferSubDataARB(table
, _mesa_GetBufferSubDataARB
);
8207 SET_IsBufferARB(table
, _mesa_IsBufferARB
);
8208 SET_MapBufferARB(table
, _mesa_MapBufferARB
);
8209 SET_UnmapBufferARB(table
, _mesa_UnmapBufferARB
);
8212 #if FEATURE_ARB_occlusion_query
8213 SET_BeginQueryARB(table
, save_BeginQueryARB
);
8214 SET_EndQueryARB(table
, save_EndQueryARB
);
8215 SET_GenQueriesARB(table
, _mesa_GenQueriesARB
);
8216 SET_DeleteQueriesARB(table
, _mesa_DeleteQueriesARB
);
8217 SET_IsQueryARB(table
, _mesa_IsQueryARB
);
8218 SET_GetQueryivARB(table
, _mesa_GetQueryivARB
);
8219 SET_GetQueryObjectivARB(table
, _mesa_GetQueryObjectivARB
);
8220 SET_GetQueryObjectuivARB(table
, _mesa_GetQueryObjectuivARB
);
8222 SET_DrawBuffersARB(table
, save_DrawBuffersARB
);
8224 #if FEATURE_EXT_framebuffer_blit
8225 SET_BlitFramebufferEXT(table
, save_BlitFramebufferEXT
);
8228 /* ARB 30/31/32. GL_ARB_shader_objects, GL_ARB_vertex/fragment_shader */
8229 SET_BindAttribLocationARB(table
, exec_BindAttribLocationARB
);
8230 SET_GetAttribLocationARB(table
, exec_GetAttribLocationARB
);
8231 /* XXX additional functions need to be implemented here! */
8233 /* 299. GL_EXT_blend_equation_separate */
8234 SET_BlendEquationSeparateEXT(table
, save_BlendEquationSeparateEXT
);
8236 /* GL_EXT_gpu_program_parmaeters */
8237 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
8238 SET_ProgramEnvParameters4fvEXT(table
, save_ProgramEnvParameters4fvEXT
);
8239 SET_ProgramLocalParameters4fvEXT(table
, save_ProgramLocalParameters4fvEXT
);
8246 enum_string(GLenum k
)
8248 return _mesa_lookup_enum_by_nr(k
);
8253 * Print the commands in a display list. For debugging only.
8254 * TODO: many commands aren't handled yet.
8256 static void GLAPIENTRY
8257 print_list(GLcontext
*ctx
, GLuint list
)
8259 struct gl_display_list
*dlist
;
8263 if (!islist(ctx
, list
)) {
8264 _mesa_printf("%u is not a display list ID\n", list
);
8268 dlist
= lookup_list(ctx
, list
);
8274 _mesa_printf("START-LIST %u, address %p\n", list
, (void *) n
);
8276 done
= n
? GL_FALSE
: GL_TRUE
;
8278 OpCode opcode
= n
[0].opcode
;
8279 GLint i
= (GLint
) n
[0].opcode
- (GLint
) OPCODE_EXT_0
;
8281 if (i
>= 0 && i
< (GLint
) ctx
->ListExt
.NumOpcodes
) {
8282 /* this is a driver-extended opcode */
8283 ctx
->ListExt
.Opcode
[i
].Print(ctx
, &n
[1]);
8284 n
+= ctx
->ListExt
.Opcode
[i
].Size
;
8289 _mesa_printf("Accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
8292 _mesa_printf("Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
8293 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
, (void *) n
[7].data
);
8295 case OPCODE_CALL_LIST
:
8296 _mesa_printf("CallList %d\n", (int) n
[1].ui
);
8298 case OPCODE_CALL_LIST_OFFSET
:
8299 _mesa_printf("CallList %d + offset %u = %u\n", (int) n
[1].ui
,
8300 ctx
->List
.ListBase
, ctx
->List
.ListBase
+ n
[1].ui
);
8302 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
8303 _mesa_printf("ColorTableParameterfv %s %s %f %f %f %f\n",
8304 enum_string(n
[1].e
), enum_string(n
[2].e
),
8305 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8307 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
8308 _mesa_printf("ColorTableParameteriv %s %s %d %d %d %d\n",
8309 enum_string(n
[1].e
), enum_string(n
[2].e
),
8310 n
[3].i
, n
[4].i
, n
[5].i
, n
[6].i
);
8312 case OPCODE_DISABLE
:
8313 _mesa_printf("Disable %s\n", enum_string(n
[1].e
));
8316 _mesa_printf("Enable %s\n", enum_string(n
[1].e
));
8318 case OPCODE_FRUSTUM
:
8319 _mesa_printf("Frustum %g %g %g %g %g %g\n",
8320 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8322 case OPCODE_LINE_STIPPLE
:
8323 _mesa_printf("LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
8325 case OPCODE_LOAD_IDENTITY
:
8326 _mesa_printf("LoadIdentity\n");
8328 case OPCODE_LOAD_MATRIX
:
8329 _mesa_printf("LoadMatrix\n");
8330 _mesa_printf(" %8f %8f %8f %8f\n",
8331 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
8332 _mesa_printf(" %8f %8f %8f %8f\n",
8333 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
8334 _mesa_printf(" %8f %8f %8f %8f\n",
8335 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
8336 _mesa_printf(" %8f %8f %8f %8f\n",
8337 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
8339 case OPCODE_MULT_MATRIX
:
8340 _mesa_printf("MultMatrix (or Rotate)\n");
8341 _mesa_printf(" %8f %8f %8f %8f\n",
8342 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
8343 _mesa_printf(" %8f %8f %8f %8f\n",
8344 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
8345 _mesa_printf(" %8f %8f %8f %8f\n",
8346 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
8347 _mesa_printf(" %8f %8f %8f %8f\n",
8348 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
8351 _mesa_printf("Ortho %g %g %g %g %g %g\n",
8352 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8354 case OPCODE_POP_ATTRIB
:
8355 _mesa_printf("PopAttrib\n");
8357 case OPCODE_POP_MATRIX
:
8358 _mesa_printf("PopMatrix\n");
8360 case OPCODE_POP_NAME
:
8361 _mesa_printf("PopName\n");
8363 case OPCODE_PUSH_ATTRIB
:
8364 _mesa_printf("PushAttrib %x\n", n
[1].bf
);
8366 case OPCODE_PUSH_MATRIX
:
8367 _mesa_printf("PushMatrix\n");
8369 case OPCODE_PUSH_NAME
:
8370 _mesa_printf("PushName %d\n", (int) n
[1].ui
);
8372 case OPCODE_RASTER_POS
:
8373 _mesa_printf("RasterPos %g %g %g %g\n",
8374 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
8377 _mesa_printf("Rotate %g %g %g %g\n",
8378 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
8381 _mesa_printf("Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
8383 case OPCODE_TRANSLATE
:
8384 _mesa_printf("Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
8386 case OPCODE_BIND_TEXTURE
:
8387 _mesa_printf("BindTexture %s %d\n",
8388 _mesa_lookup_enum_by_nr(n
[1].ui
), n
[2].ui
);
8390 case OPCODE_SHADE_MODEL
:
8391 _mesa_printf("ShadeModel %s\n", _mesa_lookup_enum_by_nr(n
[1].ui
));
8394 _mesa_printf("Map1 %s %.3f %.3f %d %d\n",
8395 _mesa_lookup_enum_by_nr(n
[1].ui
),
8396 n
[2].f
, n
[3].f
, n
[4].i
, n
[5].i
);
8399 _mesa_printf("Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
8400 _mesa_lookup_enum_by_nr(n
[1].ui
),
8401 n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
,
8402 n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
8404 case OPCODE_MAPGRID1
:
8405 _mesa_printf("MapGrid1 %d %.3f %.3f\n", n
[1].i
, n
[2].f
, n
[3].f
);
8407 case OPCODE_MAPGRID2
:
8408 _mesa_printf("MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
8409 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
8411 case OPCODE_EVALMESH1
:
8412 _mesa_printf("EvalMesh1 %d %d\n", n
[1].i
, n
[2].i
);
8414 case OPCODE_EVALMESH2
:
8415 _mesa_printf("EvalMesh2 %d %d %d %d\n",
8416 n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
8419 case OPCODE_ATTR_1F_NV
:
8420 _mesa_printf("ATTR_1F_NV attr %d: %f\n", n
[1].i
, n
[2].f
);
8422 case OPCODE_ATTR_2F_NV
:
8423 _mesa_printf("ATTR_2F_NV attr %d: %f %f\n",
8424 n
[1].i
, n
[2].f
, n
[3].f
);
8426 case OPCODE_ATTR_3F_NV
:
8427 _mesa_printf("ATTR_3F_NV attr %d: %f %f %f\n",
8428 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
8430 case OPCODE_ATTR_4F_NV
:
8431 _mesa_printf("ATTR_4F_NV attr %d: %f %f %f %f\n",
8432 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
8434 case OPCODE_ATTR_1F_ARB
:
8435 _mesa_printf("ATTR_1F_ARB attr %d: %f\n", n
[1].i
, n
[2].f
);
8437 case OPCODE_ATTR_2F_ARB
:
8438 _mesa_printf("ATTR_2F_ARB attr %d: %f %f\n",
8439 n
[1].i
, n
[2].f
, n
[3].f
);
8441 case OPCODE_ATTR_3F_ARB
:
8442 _mesa_printf("ATTR_3F_ARB attr %d: %f %f %f\n",
8443 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
8445 case OPCODE_ATTR_4F_ARB
:
8446 _mesa_printf("ATTR_4F_ARB attr %d: %f %f %f %f\n",
8447 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
8450 case OPCODE_MATERIAL
:
8451 _mesa_printf("MATERIAL %x %x: %f %f %f %f\n",
8452 n
[1].i
, n
[2].i
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8455 _mesa_printf("BEGIN %x\n", n
[1].i
);
8458 _mesa_printf("END\n");
8461 _mesa_printf("RECTF %f %f %f %f\n", n
[1].f
, n
[2].f
, n
[3].f
,
8464 case OPCODE_EVAL_C1
:
8465 _mesa_printf("EVAL_C1 %f\n", n
[1].f
);
8467 case OPCODE_EVAL_C2
:
8468 _mesa_printf("EVAL_C2 %f %f\n", n
[1].f
, n
[2].f
);
8470 case OPCODE_EVAL_P1
:
8471 _mesa_printf("EVAL_P1 %d\n", n
[1].i
);
8473 case OPCODE_EVAL_P2
:
8474 _mesa_printf("EVAL_P2 %d %d\n", n
[1].i
, n
[2].i
);
8478 * meta opcodes/commands
8481 _mesa_printf("Error: %s %s\n",
8482 enum_string(n
[1].e
), (const char *) n
[2].data
);
8484 case OPCODE_CONTINUE
:
8485 _mesa_printf("DISPLAY-LIST-CONTINUE\n");
8486 n
= (Node
*) n
[1].next
;
8488 case OPCODE_END_OF_LIST
:
8489 _mesa_printf("END-LIST %u\n", list
);
8493 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
8495 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
8496 opcode
, (void *) n
);
8500 _mesa_printf("command %d, %u operands\n", opcode
,
8504 /* increment n to point to next compiled command */
8505 if (opcode
!= OPCODE_CONTINUE
) {
8506 n
+= InstSize
[opcode
];
8515 * Clients may call this function to help debug display list problems.
8516 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
8517 * changed, or break in the future without notice.
8520 mesa_print_display_list(GLuint list
)
8522 GET_CURRENT_CONTEXT(ctx
);
8523 print_list(ctx
, list
);
8527 /**********************************************************************/
8528 /***** Initialization *****/
8529 /**********************************************************************/
8532 _mesa_save_vtxfmt_init(GLvertexformat
* vfmt
)
8534 vfmt
->ArrayElement
= _ae_loopback_array_elt
; /* generic helper */
8535 vfmt
->Begin
= save_Begin
;
8536 vfmt
->CallList
= _mesa_save_CallList
;
8537 vfmt
->CallLists
= _mesa_save_CallLists
;
8538 vfmt
->Color3f
= save_Color3f
;
8539 vfmt
->Color3fv
= save_Color3fv
;
8540 vfmt
->Color4f
= save_Color4f
;
8541 vfmt
->Color4fv
= save_Color4fv
;
8542 vfmt
->EdgeFlag
= save_EdgeFlag
;
8543 vfmt
->End
= save_End
;
8544 vfmt
->EvalCoord1f
= save_EvalCoord1f
;
8545 vfmt
->EvalCoord1fv
= save_EvalCoord1fv
;
8546 vfmt
->EvalCoord2f
= save_EvalCoord2f
;
8547 vfmt
->EvalCoord2fv
= save_EvalCoord2fv
;
8548 vfmt
->EvalPoint1
= save_EvalPoint1
;
8549 vfmt
->EvalPoint2
= save_EvalPoint2
;
8550 vfmt
->FogCoordfEXT
= save_FogCoordfEXT
;
8551 vfmt
->FogCoordfvEXT
= save_FogCoordfvEXT
;
8552 vfmt
->Indexf
= save_Indexf
;
8553 vfmt
->Indexfv
= save_Indexfv
;
8554 vfmt
->Materialfv
= save_Materialfv
;
8555 vfmt
->MultiTexCoord1fARB
= save_MultiTexCoord1f
;
8556 vfmt
->MultiTexCoord1fvARB
= save_MultiTexCoord1fv
;
8557 vfmt
->MultiTexCoord2fARB
= save_MultiTexCoord2f
;
8558 vfmt
->MultiTexCoord2fvARB
= save_MultiTexCoord2fv
;
8559 vfmt
->MultiTexCoord3fARB
= save_MultiTexCoord3f
;
8560 vfmt
->MultiTexCoord3fvARB
= save_MultiTexCoord3fv
;
8561 vfmt
->MultiTexCoord4fARB
= save_MultiTexCoord4f
;
8562 vfmt
->MultiTexCoord4fvARB
= save_MultiTexCoord4fv
;
8563 vfmt
->Normal3f
= save_Normal3f
;
8564 vfmt
->Normal3fv
= save_Normal3fv
;
8565 vfmt
->SecondaryColor3fEXT
= save_SecondaryColor3fEXT
;
8566 vfmt
->SecondaryColor3fvEXT
= save_SecondaryColor3fvEXT
;
8567 vfmt
->TexCoord1f
= save_TexCoord1f
;
8568 vfmt
->TexCoord1fv
= save_TexCoord1fv
;
8569 vfmt
->TexCoord2f
= save_TexCoord2f
;
8570 vfmt
->TexCoord2fv
= save_TexCoord2fv
;
8571 vfmt
->TexCoord3f
= save_TexCoord3f
;
8572 vfmt
->TexCoord3fv
= save_TexCoord3fv
;
8573 vfmt
->TexCoord4f
= save_TexCoord4f
;
8574 vfmt
->TexCoord4fv
= save_TexCoord4fv
;
8575 vfmt
->Vertex2f
= save_Vertex2f
;
8576 vfmt
->Vertex2fv
= save_Vertex2fv
;
8577 vfmt
->Vertex3f
= save_Vertex3f
;
8578 vfmt
->Vertex3fv
= save_Vertex3fv
;
8579 vfmt
->Vertex4f
= save_Vertex4f
;
8580 vfmt
->Vertex4fv
= save_Vertex4fv
;
8581 vfmt
->VertexAttrib1fNV
= save_VertexAttrib1fNV
;
8582 vfmt
->VertexAttrib1fvNV
= save_VertexAttrib1fvNV
;
8583 vfmt
->VertexAttrib2fNV
= save_VertexAttrib2fNV
;
8584 vfmt
->VertexAttrib2fvNV
= save_VertexAttrib2fvNV
;
8585 vfmt
->VertexAttrib3fNV
= save_VertexAttrib3fNV
;
8586 vfmt
->VertexAttrib3fvNV
= save_VertexAttrib3fvNV
;
8587 vfmt
->VertexAttrib4fNV
= save_VertexAttrib4fNV
;
8588 vfmt
->VertexAttrib4fvNV
= save_VertexAttrib4fvNV
;
8589 vfmt
->VertexAttrib1fARB
= save_VertexAttrib1fARB
;
8590 vfmt
->VertexAttrib1fvARB
= save_VertexAttrib1fvARB
;
8591 vfmt
->VertexAttrib2fARB
= save_VertexAttrib2fARB
;
8592 vfmt
->VertexAttrib2fvARB
= save_VertexAttrib2fvARB
;
8593 vfmt
->VertexAttrib3fARB
= save_VertexAttrib3fARB
;
8594 vfmt
->VertexAttrib3fvARB
= save_VertexAttrib3fvARB
;
8595 vfmt
->VertexAttrib4fARB
= save_VertexAttrib4fARB
;
8596 vfmt
->VertexAttrib4fvARB
= save_VertexAttrib4fvARB
;
8598 vfmt
->EvalMesh1
= _mesa_save_EvalMesh1
;
8599 vfmt
->EvalMesh2
= _mesa_save_EvalMesh2
;
8600 vfmt
->Rectf
= save_Rectf
;
8602 /* The driver is required to implement these as
8603 * 1) They can probably do a better job.
8604 * 2) A lot of new mechanisms would have to be added to this module
8605 * to support it. That code would probably never get used,
8609 vfmt
->DrawArrays
= 0;
8610 vfmt
->DrawElements
= 0;
8611 vfmt
->DrawRangeElements
= 0;
8617 * Initialize display list state for given context.
8620 _mesa_init_display_list(GLcontext
*ctx
)
8622 static GLboolean tableInitialized
= GL_FALSE
;
8624 /* zero-out the instruction size table, just once */
8625 if (!tableInitialized
) {
8626 _mesa_bzero(InstSize
, sizeof(InstSize
));
8627 tableInitialized
= GL_TRUE
;
8631 ctx
->ListState
.CallDepth
= 0;
8632 ctx
->ExecuteFlag
= GL_TRUE
;
8633 ctx
->CompileFlag
= GL_FALSE
;
8634 ctx
->ListState
.CurrentBlock
= NULL
;
8635 ctx
->ListState
.CurrentPos
= 0;
8637 /* Display List group */
8638 ctx
->List
.ListBase
= 0;
8640 _mesa_save_vtxfmt_init(&ctx
->ListState
.ListVtxfmt
);