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_BIND_FRAGMENT_SHADER_ATI
,
324 OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
,
326 OPCODE_STENCIL_FUNC_SEPARATE
,
327 OPCODE_STENCIL_OP_SEPARATE
,
328 OPCODE_STENCIL_MASK_SEPARATE
,
330 /* GL_EXT_framebuffer_blit */
331 OPCODE_BLIT_FRAMEBUFFER
,
333 /* Vertex attributes -- fallback for when optimized display
334 * list build isn't active.
353 /* The following three are meta instructions */
354 OPCODE_ERROR
, /* raise compiled-in error */
365 * Display list instructions are stored as sequences of "nodes". Nodes
366 * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
367 * are linked together with a pointer.
369 * Each instruction in the display list is stored as a sequence of
370 * contiguous nodes in memory.
371 * Each node is the union of a variety of data types.
386 void *next
; /* If prev node's opcode==OPCODE_CONTINUE */
390 typedef union gl_dlist_node Node
;
394 * How many nodes to allocate at a time.
396 * \note Reduced now that we hold vertices etc. elsewhere.
398 #define BLOCK_SIZE 256
403 * Number of nodes of storage needed for each instruction.
404 * Sizes for dynamically allocated opcodes are stored in the context struct.
406 static GLuint InstSize
[OPCODE_END_OF_LIST
+ 1];
408 void mesa_print_display_list(GLuint list
);
411 /**********************************************************************/
412 /***** Private *****/
413 /**********************************************************************/
417 * Make an empty display list. This is used by glGenLists() to
418 * reserve display list IDs.
420 static struct gl_display_list
*
421 make_list(GLuint name
, GLuint count
)
423 struct gl_display_list
*dlist
= CALLOC_STRUCT(gl_display_list
);
425 dlist
->Head
= (Node
*) _mesa_malloc(sizeof(Node
) * count
);
426 dlist
->Head
[0].opcode
= OPCODE_END_OF_LIST
;
432 * Lookup function to just encapsulate casting.
434 static INLINE
struct gl_display_list
*
435 lookup_list(GLcontext
*ctx
, GLuint list
)
437 return (struct gl_display_list
*)
438 _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
444 * Delete the named display list, but don't remove from hash table.
445 * \param dlist - display list pointer
448 _mesa_delete_list(GLcontext
*ctx
, struct gl_display_list
*dlist
)
453 n
= block
= dlist
->Head
;
455 done
= block
? GL_FALSE
: GL_TRUE
;
458 /* check for extension opcodes first */
460 GLint i
= (GLint
) n
[0].opcode
- (GLint
) OPCODE_EXT_0
;
461 if (i
>= 0 && i
< (GLint
) ctx
->ListExt
.NumOpcodes
) {
462 ctx
->ListExt
.Opcode
[i
].Destroy(ctx
, &n
[1]);
463 n
+= ctx
->ListExt
.Opcode
[i
].Size
;
466 switch (n
[0].opcode
) {
467 /* for some commands, we need to free malloc'd memory */
469 _mesa_free(n
[6].data
);
470 n
+= InstSize
[n
[0].opcode
];
473 _mesa_free(n
[10].data
);
474 n
+= InstSize
[n
[0].opcode
];
476 case OPCODE_DRAW_PIXELS
:
477 _mesa_free(n
[5].data
);
478 n
+= InstSize
[n
[0].opcode
];
481 _mesa_free(n
[7].data
);
482 n
+= InstSize
[n
[0].opcode
];
484 case OPCODE_COLOR_TABLE
:
485 _mesa_free(n
[6].data
);
486 n
+= InstSize
[n
[0].opcode
];
488 case OPCODE_COLOR_SUB_TABLE
:
489 _mesa_free(n
[6].data
);
490 n
+= InstSize
[n
[0].opcode
];
492 case OPCODE_CONVOLUTION_FILTER_1D
:
493 _mesa_free(n
[6].data
);
494 n
+= InstSize
[n
[0].opcode
];
496 case OPCODE_CONVOLUTION_FILTER_2D
:
497 _mesa_free(n
[7].data
);
498 n
+= InstSize
[n
[0].opcode
];
500 case OPCODE_POLYGON_STIPPLE
:
501 _mesa_free(n
[1].data
);
502 n
+= InstSize
[n
[0].opcode
];
504 case OPCODE_TEX_IMAGE1D
:
505 _mesa_free(n
[8].data
);
506 n
+= InstSize
[n
[0].opcode
];
508 case OPCODE_TEX_IMAGE2D
:
509 _mesa_free(n
[9].data
);
510 n
+= InstSize
[n
[0].opcode
];
512 case OPCODE_TEX_IMAGE3D
:
513 _mesa_free(n
[10].data
);
514 n
+= InstSize
[n
[0].opcode
];
516 case OPCODE_TEX_SUB_IMAGE1D
:
517 _mesa_free(n
[7].data
);
518 n
+= InstSize
[n
[0].opcode
];
520 case OPCODE_TEX_SUB_IMAGE2D
:
521 _mesa_free(n
[9].data
);
522 n
+= InstSize
[n
[0].opcode
];
524 case OPCODE_TEX_SUB_IMAGE3D
:
525 _mesa_free(n
[11].data
);
526 n
+= InstSize
[n
[0].opcode
];
528 case OPCODE_COMPRESSED_TEX_IMAGE_1D
:
529 _mesa_free(n
[7].data
);
530 n
+= InstSize
[n
[0].opcode
];
532 case OPCODE_COMPRESSED_TEX_IMAGE_2D
:
533 _mesa_free(n
[8].data
);
534 n
+= InstSize
[n
[0].opcode
];
536 case OPCODE_COMPRESSED_TEX_IMAGE_3D
:
537 _mesa_free(n
[9].data
);
538 n
+= InstSize
[n
[0].opcode
];
540 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
:
541 _mesa_free(n
[7].data
);
542 n
+= InstSize
[n
[0].opcode
];
544 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
:
545 _mesa_free(n
[9].data
);
546 n
+= InstSize
[n
[0].opcode
];
548 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
:
549 _mesa_free(n
[11].data
);
550 n
+= InstSize
[n
[0].opcode
];
552 #if FEATURE_NV_vertex_program
553 case OPCODE_LOAD_PROGRAM_NV
:
554 _mesa_free(n
[4].data
); /* program string */
555 n
+= InstSize
[n
[0].opcode
];
557 case OPCODE_REQUEST_RESIDENT_PROGRAMS_NV
:
558 _mesa_free(n
[2].data
); /* array of program ids */
559 n
+= InstSize
[n
[0].opcode
];
562 #if FEATURE_NV_fragment_program
563 case OPCODE_PROGRAM_NAMED_PARAMETER_NV
:
564 _mesa_free(n
[3].data
); /* parameter name */
565 n
+= InstSize
[n
[0].opcode
];
568 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
569 case OPCODE_PROGRAM_STRING_ARB
:
570 _mesa_free(n
[4].data
); /* program string */
571 n
+= InstSize
[n
[0].opcode
];
574 case OPCODE_CONTINUE
:
575 n
= (Node
*) n
[1].next
;
579 case OPCODE_END_OF_LIST
:
584 /* Most frequent case */
585 n
+= InstSize
[n
[0].opcode
];
596 * Destroy a display list and remove from hash table.
597 * \param list - display list number
600 destroy_list(GLcontext
*ctx
, GLuint list
)
602 struct gl_display_list
*dlist
;
607 dlist
= lookup_list(ctx
, list
);
611 _mesa_delete_list(ctx
, dlist
);
612 _mesa_HashRemove(ctx
->Shared
->DisplayList
, list
);
617 * Translate the nth element of list from <type> to GLint.
620 translate_id(GLsizei n
, GLenum type
, const GLvoid
* list
)
632 bptr
= (GLbyte
*) list
;
633 return (GLint
) bptr
[n
];
634 case GL_UNSIGNED_BYTE
:
635 ubptr
= (GLubyte
*) list
;
636 return (GLint
) ubptr
[n
];
638 sptr
= (GLshort
*) list
;
639 return (GLint
) sptr
[n
];
640 case GL_UNSIGNED_SHORT
:
641 usptr
= (GLushort
*) list
;
642 return (GLint
) usptr
[n
];
644 iptr
= (GLint
*) list
;
646 case GL_UNSIGNED_INT
:
647 uiptr
= (GLuint
*) list
;
648 return (GLint
) uiptr
[n
];
650 fptr
= (GLfloat
*) list
;
651 return (GLint
) FLOORF(fptr
[n
]);
653 ubptr
= ((GLubyte
*) list
) + 2 * n
;
654 return (GLint
) ubptr
[0] * 256
657 ubptr
= ((GLubyte
*) list
) + 3 * n
;
658 return (GLint
) ubptr
[0] * 65536
659 + (GLint
) ubptr
[1] * 256
662 ubptr
= ((GLubyte
*) list
) + 4 * n
;
663 return (GLint
) ubptr
[0] * 16777216
664 + (GLint
) ubptr
[1] * 65536
665 + (GLint
) ubptr
[2] * 256
675 /**********************************************************************/
677 /**********************************************************************/
680 * Wrapper for _mesa_unpack_image() that handles pixel buffer objects.
681 * \todo This won't suffice when the PBO is really in VRAM/GPU memory.
684 unpack_image(GLuint dimensions
, GLsizei width
, GLsizei height
, GLsizei depth
,
685 GLenum format
, GLenum type
, const GLvoid
* pixels
,
686 const struct gl_pixelstore_attrib
*unpack
)
688 if (unpack
->BufferObj
->Name
== 0) {
690 return _mesa_unpack_image(dimensions
, width
, height
, depth
, format
,
691 type
, pixels
, unpack
);
694 if (_mesa_validate_pbo_access
695 (dimensions
, unpack
, width
, height
, depth
, format
, type
, pixels
)) {
696 const GLubyte
*src
= ADD_POINTERS(unpack
->BufferObj
->Data
, pixels
);
697 return _mesa_unpack_image(dimensions
, width
, height
, depth
, format
,
706 * Allocate space for a display list instruction.
707 * \param opcode the instruction opcode (OPCODE_* value)
708 * \param size instruction size in bytes, not counting opcode.
709 * \return pointer to the usable data area (not including the internal
713 _mesa_alloc_instruction(GLcontext
*ctx
, GLuint opcode
, GLuint bytes
)
715 const GLuint numNodes
= 1 + (bytes
+ sizeof(Node
) - 1) / sizeof(Node
);
718 if (opcode
< (GLuint
) OPCODE_EXT_0
) {
719 if (InstSize
[opcode
] == 0) {
720 /* save instruction size now */
721 InstSize
[opcode
] = numNodes
;
724 /* make sure instruction size agrees */
725 ASSERT(numNodes
== InstSize
[opcode
]);
729 if (ctx
->ListState
.CurrentPos
+ numNodes
+ 2 > BLOCK_SIZE
) {
730 /* This block is full. Allocate a new block and chain to it */
732 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
733 n
[0].opcode
= OPCODE_CONTINUE
;
734 newblock
= (Node
*) _mesa_malloc(sizeof(Node
) * BLOCK_SIZE
);
736 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "Building display list");
739 n
[1].next
= (Node
*) newblock
;
740 ctx
->ListState
.CurrentBlock
= newblock
;
741 ctx
->ListState
.CurrentPos
= 0;
744 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
745 ctx
->ListState
.CurrentPos
+= numNodes
;
747 n
[0].opcode
= (OpCode
) opcode
;
749 return (void *) (n
+ 1); /* return ptr to node following opcode */
754 * This function allows modules and drivers to get their own opcodes
755 * for extending display list functionality.
756 * \param ctx the rendering context
757 * \param size number of bytes for storing the new display list command
758 * \param execute function to execute the new display list command
759 * \param destroy function to destroy the new display list command
760 * \param print function to print the new display list command
761 * \return the new opcode number or -1 if error
764 _mesa_alloc_opcode(GLcontext
*ctx
,
766 void (*execute
) (GLcontext
*, void *),
767 void (*destroy
) (GLcontext
*, void *),
768 void (*print
) (GLcontext
*, void *))
770 if (ctx
->ListExt
.NumOpcodes
< MAX_DLIST_EXT_OPCODES
) {
771 const GLuint i
= ctx
->ListExt
.NumOpcodes
++;
772 ctx
->ListExt
.Opcode
[i
].Size
=
773 1 + (size
+ sizeof(Node
) - 1) / sizeof(Node
);
774 ctx
->ListExt
.Opcode
[i
].Execute
= execute
;
775 ctx
->ListExt
.Opcode
[i
].Destroy
= destroy
;
776 ctx
->ListExt
.Opcode
[i
].Print
= print
;
777 return i
+ OPCODE_EXT_0
;
785 * Allocate display list instruction. Returns Node ptr to where the opcode
787 * - nParams is the number of function parameters
788 * - return value a pointer to sizeof(Node) before the actual
791 #define ALLOC_INSTRUCTION(CTX, OPCODE, NPARAMS) \
792 ((Node *)_mesa_alloc_instruction(CTX, OPCODE, (NPARAMS)*sizeof(Node)) - 1)
797 * Display List compilation functions
799 static void GLAPIENTRY
800 save_Accum(GLenum op
, GLfloat value
)
802 GET_CURRENT_CONTEXT(ctx
);
804 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
805 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ACCUM
, 2);
810 if (ctx
->ExecuteFlag
) {
811 CALL_Accum(ctx
->Exec
, (op
, value
));
816 static void GLAPIENTRY
817 save_AlphaFunc(GLenum func
, GLclampf ref
)
819 GET_CURRENT_CONTEXT(ctx
);
821 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
822 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ALPHA_FUNC
, 2);
825 n
[2].f
= (GLfloat
) ref
;
827 if (ctx
->ExecuteFlag
) {
828 CALL_AlphaFunc(ctx
->Exec
, (func
, ref
));
833 static void GLAPIENTRY
834 save_BindTexture(GLenum target
, GLuint texture
)
836 GET_CURRENT_CONTEXT(ctx
);
838 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
839 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BIND_TEXTURE
, 2);
844 if (ctx
->ExecuteFlag
) {
845 CALL_BindTexture(ctx
->Exec
, (target
, texture
));
850 static void GLAPIENTRY
851 save_Bitmap(GLsizei width
, GLsizei height
,
852 GLfloat xorig
, GLfloat yorig
,
853 GLfloat xmove
, GLfloat ymove
, const GLubyte
* pixels
)
855 GET_CURRENT_CONTEXT(ctx
);
856 GLvoid
*image
= _mesa_unpack_bitmap(width
, height
, pixels
, &ctx
->Unpack
);
858 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
859 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BITMAP
, 7);
861 n
[1].i
= (GLint
) width
;
862 n
[2].i
= (GLint
) height
;
872 if (ctx
->ExecuteFlag
) {
873 CALL_Bitmap(ctx
->Exec
, (width
, height
,
874 xorig
, yorig
, xmove
, ymove
, pixels
));
879 static void GLAPIENTRY
880 save_BlendEquation(GLenum mode
)
882 GET_CURRENT_CONTEXT(ctx
);
884 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
885 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BLEND_EQUATION
, 1);
889 if (ctx
->ExecuteFlag
) {
890 CALL_BlendEquation(ctx
->Exec
, (mode
));
895 static void GLAPIENTRY
896 save_BlendEquationSeparateEXT(GLenum modeRGB
, GLenum modeA
)
898 GET_CURRENT_CONTEXT(ctx
);
900 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
901 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BLEND_EQUATION_SEPARATE
, 2);
906 if (ctx
->ExecuteFlag
) {
907 CALL_BlendEquationSeparateEXT(ctx
->Exec
, (modeRGB
, modeA
));
912 static void GLAPIENTRY
913 save_BlendFuncSeparateEXT(GLenum sfactorRGB
, GLenum dfactorRGB
,
914 GLenum sfactorA
, GLenum dfactorA
)
916 GET_CURRENT_CONTEXT(ctx
);
918 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
919 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BLEND_FUNC_SEPARATE
, 4);
926 if (ctx
->ExecuteFlag
) {
927 CALL_BlendFuncSeparateEXT(ctx
->Exec
,
928 (sfactorRGB
, dfactorRGB
, sfactorA
, dfactorA
));
933 static void GLAPIENTRY
934 save_BlendFunc(GLenum srcfactor
, GLenum dstfactor
)
936 save_BlendFuncSeparateEXT(srcfactor
, dstfactor
, srcfactor
, dstfactor
);
940 static void GLAPIENTRY
941 save_BlendColor(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
943 GET_CURRENT_CONTEXT(ctx
);
945 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
946 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BLEND_COLOR
, 4);
953 if (ctx
->ExecuteFlag
) {
954 CALL_BlendColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
960 _mesa_save_CallList(GLuint list
)
962 GET_CURRENT_CONTEXT(ctx
);
964 SAVE_FLUSH_VERTICES(ctx
);
966 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CALL_LIST
, 1);
971 /* After this, we don't know what begin/end state we're in:
973 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
975 if (ctx
->ExecuteFlag
) {
976 CALL_CallList(ctx
->Exec
, (list
));
982 _mesa_save_CallLists(GLsizei n
, GLenum type
, const GLvoid
* lists
)
984 GET_CURRENT_CONTEXT(ctx
);
986 GLboolean typeErrorFlag
;
988 SAVE_FLUSH_VERTICES(ctx
);
992 case GL_UNSIGNED_BYTE
:
994 case GL_UNSIGNED_SHORT
:
996 case GL_UNSIGNED_INT
:
1001 typeErrorFlag
= GL_FALSE
;
1004 typeErrorFlag
= GL_TRUE
;
1007 for (i
= 0; i
< n
; i
++) {
1008 GLint list
= translate_id(i
, type
, lists
);
1009 Node
*n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CALL_LIST_OFFSET
, 2);
1012 n
[2].b
= typeErrorFlag
;
1016 /* After this, we don't know what begin/end state we're in:
1018 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
1020 if (ctx
->ExecuteFlag
) {
1021 CALL_CallLists(ctx
->Exec
, (n
, type
, lists
));
1026 static void GLAPIENTRY
1027 save_Clear(GLbitfield mask
)
1029 GET_CURRENT_CONTEXT(ctx
);
1031 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1032 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLEAR
, 1);
1036 if (ctx
->ExecuteFlag
) {
1037 CALL_Clear(ctx
->Exec
, (mask
));
1042 static void GLAPIENTRY
1043 save_ClearAccum(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
1045 GET_CURRENT_CONTEXT(ctx
);
1047 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1048 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLEAR_ACCUM
, 4);
1055 if (ctx
->ExecuteFlag
) {
1056 CALL_ClearAccum(ctx
->Exec
, (red
, green
, blue
, alpha
));
1061 static void GLAPIENTRY
1062 save_ClearColor(GLclampf red
, GLclampf green
, GLclampf blue
, GLclampf alpha
)
1064 GET_CURRENT_CONTEXT(ctx
);
1066 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1067 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLEAR_COLOR
, 4);
1074 if (ctx
->ExecuteFlag
) {
1075 CALL_ClearColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
1080 static void GLAPIENTRY
1081 save_ClearDepth(GLclampd depth
)
1083 GET_CURRENT_CONTEXT(ctx
);
1085 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1086 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLEAR_DEPTH
, 1);
1088 n
[1].f
= (GLfloat
) depth
;
1090 if (ctx
->ExecuteFlag
) {
1091 CALL_ClearDepth(ctx
->Exec
, (depth
));
1096 static void GLAPIENTRY
1097 save_ClearIndex(GLfloat c
)
1099 GET_CURRENT_CONTEXT(ctx
);
1101 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1102 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLEAR_INDEX
, 1);
1106 if (ctx
->ExecuteFlag
) {
1107 CALL_ClearIndex(ctx
->Exec
, (c
));
1112 static void GLAPIENTRY
1113 save_ClearStencil(GLint s
)
1115 GET_CURRENT_CONTEXT(ctx
);
1117 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1118 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLEAR_STENCIL
, 1);
1122 if (ctx
->ExecuteFlag
) {
1123 CALL_ClearStencil(ctx
->Exec
, (s
));
1128 static void GLAPIENTRY
1129 save_ClipPlane(GLenum plane
, const GLdouble
* equ
)
1131 GET_CURRENT_CONTEXT(ctx
);
1133 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1134 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLIP_PLANE
, 5);
1137 n
[2].f
= (GLfloat
) equ
[0];
1138 n
[3].f
= (GLfloat
) equ
[1];
1139 n
[4].f
= (GLfloat
) equ
[2];
1140 n
[5].f
= (GLfloat
) equ
[3];
1142 if (ctx
->ExecuteFlag
) {
1143 CALL_ClipPlane(ctx
->Exec
, (plane
, equ
));
1149 static void GLAPIENTRY
1150 save_ColorMask(GLboolean red
, GLboolean green
,
1151 GLboolean blue
, GLboolean alpha
)
1153 GET_CURRENT_CONTEXT(ctx
);
1155 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1156 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COLOR_MASK
, 4);
1163 if (ctx
->ExecuteFlag
) {
1164 CALL_ColorMask(ctx
->Exec
, (red
, green
, blue
, alpha
));
1169 static void GLAPIENTRY
1170 save_ColorMaterial(GLenum face
, GLenum mode
)
1172 GET_CURRENT_CONTEXT(ctx
);
1174 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1176 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COLOR_MATERIAL
, 2);
1181 if (ctx
->ExecuteFlag
) {
1182 CALL_ColorMaterial(ctx
->Exec
, (face
, mode
));
1187 static void GLAPIENTRY
1188 save_ColorTable(GLenum target
, GLenum internalFormat
,
1189 GLsizei width
, GLenum format
, GLenum type
,
1190 const GLvoid
* table
)
1192 GET_CURRENT_CONTEXT(ctx
);
1193 if (_mesa_is_proxy_texture(target
)) {
1194 /* execute immediately */
1195 CALL_ColorTable(ctx
->Exec
, (target
, internalFormat
, width
,
1196 format
, type
, table
));
1199 GLvoid
*image
= unpack_image(1, width
, 1, 1, format
, type
, table
,
1202 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1203 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COLOR_TABLE
, 6);
1206 n
[2].e
= internalFormat
;
1215 if (ctx
->ExecuteFlag
) {
1216 CALL_ColorTable(ctx
->Exec
, (target
, internalFormat
, width
,
1217 format
, type
, table
));
1224 static void GLAPIENTRY
1225 save_ColorTableParameterfv(GLenum target
, GLenum pname
,
1226 const GLfloat
*params
)
1228 GET_CURRENT_CONTEXT(ctx
);
1231 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1233 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COLOR_TABLE_PARAMETER_FV
, 6);
1238 if (pname
== GL_COLOR_TABLE_SGI
||
1239 pname
== GL_POST_CONVOLUTION_COLOR_TABLE_SGI
||
1240 pname
== GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI
||
1241 pname
== GL_TEXTURE_COLOR_TABLE_SGI
) {
1248 if (ctx
->ExecuteFlag
) {
1249 CALL_ColorTableParameterfv(ctx
->Exec
, (target
, pname
, params
));
1254 static void GLAPIENTRY
1255 save_ColorTableParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
1257 GET_CURRENT_CONTEXT(ctx
);
1260 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1262 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COLOR_TABLE_PARAMETER_IV
, 6);
1267 if (pname
== GL_COLOR_TABLE_SGI
||
1268 pname
== GL_POST_CONVOLUTION_COLOR_TABLE_SGI
||
1269 pname
== GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI
||
1270 pname
== GL_TEXTURE_COLOR_TABLE_SGI
) {
1277 if (ctx
->ExecuteFlag
) {
1278 CALL_ColorTableParameteriv(ctx
->Exec
, (target
, pname
, params
));
1284 static void GLAPIENTRY
1285 save_ColorSubTable(GLenum target
, GLsizei start
, GLsizei count
,
1286 GLenum format
, GLenum type
, const GLvoid
* table
)
1288 GET_CURRENT_CONTEXT(ctx
);
1289 GLvoid
*image
= unpack_image(1, count
, 1, 1, format
, type
, table
,
1292 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1293 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COLOR_SUB_TABLE
, 6);
1305 if (ctx
->ExecuteFlag
) {
1306 CALL_ColorSubTable(ctx
->Exec
,
1307 (target
, start
, count
, format
, type
, table
));
1312 static void GLAPIENTRY
1313 save_CopyColorSubTable(GLenum target
, GLsizei start
,
1314 GLint x
, GLint y
, GLsizei width
)
1316 GET_CURRENT_CONTEXT(ctx
);
1319 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1320 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_COLOR_SUB_TABLE
, 5);
1328 if (ctx
->ExecuteFlag
) {
1329 CALL_CopyColorSubTable(ctx
->Exec
, (target
, start
, x
, y
, width
));
1334 static void GLAPIENTRY
1335 save_CopyColorTable(GLenum target
, GLenum internalformat
,
1336 GLint x
, GLint y
, GLsizei width
)
1338 GET_CURRENT_CONTEXT(ctx
);
1341 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1342 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_COLOR_TABLE
, 5);
1345 n
[2].e
= internalformat
;
1350 if (ctx
->ExecuteFlag
) {
1351 CALL_CopyColorTable(ctx
->Exec
, (target
, internalformat
, x
, y
, width
));
1356 static void GLAPIENTRY
1357 save_ConvolutionFilter1D(GLenum target
, GLenum internalFormat
, GLsizei width
,
1358 GLenum format
, GLenum type
, const GLvoid
* filter
)
1360 GET_CURRENT_CONTEXT(ctx
);
1361 GLvoid
*image
= unpack_image(1, width
, 1, 1, format
, type
, filter
,
1364 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1365 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CONVOLUTION_FILTER_1D
, 6);
1368 n
[2].e
= internalFormat
;
1377 if (ctx
->ExecuteFlag
) {
1378 CALL_ConvolutionFilter1D(ctx
->Exec
, (target
, internalFormat
, width
,
1379 format
, type
, filter
));
1384 static void GLAPIENTRY
1385 save_ConvolutionFilter2D(GLenum target
, GLenum internalFormat
,
1386 GLsizei width
, GLsizei height
, GLenum format
,
1387 GLenum type
, const GLvoid
* filter
)
1389 GET_CURRENT_CONTEXT(ctx
);
1390 GLvoid
*image
= unpack_image(2, width
, height
, 1, format
, type
, filter
,
1393 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1394 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CONVOLUTION_FILTER_2D
, 7);
1397 n
[2].e
= internalFormat
;
1407 if (ctx
->ExecuteFlag
) {
1408 CALL_ConvolutionFilter2D(ctx
->Exec
,
1409 (target
, internalFormat
, width
, height
, format
,
1415 static void GLAPIENTRY
1416 save_ConvolutionParameteri(GLenum target
, GLenum pname
, GLint param
)
1418 GET_CURRENT_CONTEXT(ctx
);
1420 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1421 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CONVOLUTION_PARAMETER_I
, 3);
1427 if (ctx
->ExecuteFlag
) {
1428 CALL_ConvolutionParameteri(ctx
->Exec
, (target
, pname
, param
));
1433 static void GLAPIENTRY
1434 save_ConvolutionParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
1436 GET_CURRENT_CONTEXT(ctx
);
1438 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1439 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CONVOLUTION_PARAMETER_IV
, 6);
1444 if (pname
== GL_CONVOLUTION_BORDER_COLOR
||
1445 pname
== GL_CONVOLUTION_FILTER_SCALE
||
1446 pname
== GL_CONVOLUTION_FILTER_BIAS
) {
1452 n
[4].i
= n
[5].i
= n
[6].i
= 0;
1455 if (ctx
->ExecuteFlag
) {
1456 CALL_ConvolutionParameteriv(ctx
->Exec
, (target
, pname
, params
));
1461 static void GLAPIENTRY
1462 save_ConvolutionParameterf(GLenum target
, GLenum pname
, GLfloat param
)
1464 GET_CURRENT_CONTEXT(ctx
);
1466 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1467 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CONVOLUTION_PARAMETER_F
, 3);
1473 if (ctx
->ExecuteFlag
) {
1474 CALL_ConvolutionParameterf(ctx
->Exec
, (target
, pname
, param
));
1479 static void GLAPIENTRY
1480 save_ConvolutionParameterfv(GLenum target
, GLenum pname
,
1481 const GLfloat
*params
)
1483 GET_CURRENT_CONTEXT(ctx
);
1485 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1486 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CONVOLUTION_PARAMETER_FV
, 6);
1491 if (pname
== GL_CONVOLUTION_BORDER_COLOR
||
1492 pname
== GL_CONVOLUTION_FILTER_SCALE
||
1493 pname
== GL_CONVOLUTION_FILTER_BIAS
) {
1499 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
1502 if (ctx
->ExecuteFlag
) {
1503 CALL_ConvolutionParameterfv(ctx
->Exec
, (target
, pname
, params
));
1508 static void GLAPIENTRY
1509 save_CopyPixels(GLint x
, GLint y
, GLsizei width
, GLsizei height
, GLenum type
)
1511 GET_CURRENT_CONTEXT(ctx
);
1513 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1514 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_PIXELS
, 5);
1518 n
[3].i
= (GLint
) width
;
1519 n
[4].i
= (GLint
) height
;
1522 if (ctx
->ExecuteFlag
) {
1523 CALL_CopyPixels(ctx
->Exec
, (x
, y
, width
, height
, type
));
1529 static void GLAPIENTRY
1530 save_CopyTexImage1D(GLenum target
, GLint level
, GLenum internalformat
,
1531 GLint x
, GLint y
, GLsizei width
, GLint border
)
1533 GET_CURRENT_CONTEXT(ctx
);
1535 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1536 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_TEX_IMAGE1D
, 7);
1540 n
[3].e
= internalformat
;
1546 if (ctx
->ExecuteFlag
) {
1547 CALL_CopyTexImage1D(ctx
->Exec
, (target
, level
, internalformat
,
1548 x
, y
, width
, border
));
1553 static void GLAPIENTRY
1554 save_CopyTexImage2D(GLenum target
, GLint level
,
1555 GLenum internalformat
,
1556 GLint x
, GLint y
, GLsizei width
,
1557 GLsizei height
, GLint border
)
1559 GET_CURRENT_CONTEXT(ctx
);
1561 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1562 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_TEX_IMAGE2D
, 8);
1566 n
[3].e
= internalformat
;
1573 if (ctx
->ExecuteFlag
) {
1574 CALL_CopyTexImage2D(ctx
->Exec
, (target
, level
, internalformat
,
1575 x
, y
, width
, height
, border
));
1581 static void GLAPIENTRY
1582 save_CopyTexSubImage1D(GLenum target
, GLint level
,
1583 GLint xoffset
, GLint x
, GLint y
, GLsizei width
)
1585 GET_CURRENT_CONTEXT(ctx
);
1587 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1588 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_TEX_SUB_IMAGE1D
, 6);
1597 if (ctx
->ExecuteFlag
) {
1598 CALL_CopyTexSubImage1D(ctx
->Exec
,
1599 (target
, level
, xoffset
, x
, y
, width
));
1604 static void GLAPIENTRY
1605 save_CopyTexSubImage2D(GLenum target
, GLint level
,
1606 GLint xoffset
, GLint yoffset
,
1607 GLint x
, GLint y
, GLsizei width
, GLint height
)
1609 GET_CURRENT_CONTEXT(ctx
);
1611 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1612 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_TEX_SUB_IMAGE2D
, 8);
1623 if (ctx
->ExecuteFlag
) {
1624 CALL_CopyTexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
1625 x
, y
, width
, height
));
1630 static void GLAPIENTRY
1631 save_CopyTexSubImage3D(GLenum target
, GLint level
,
1632 GLint xoffset
, GLint yoffset
, GLint zoffset
,
1633 GLint x
, GLint y
, GLsizei width
, GLint height
)
1635 GET_CURRENT_CONTEXT(ctx
);
1637 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1638 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_TEX_SUB_IMAGE3D
, 9);
1650 if (ctx
->ExecuteFlag
) {
1651 CALL_CopyTexSubImage3D(ctx
->Exec
, (target
, level
,
1652 xoffset
, yoffset
, zoffset
,
1653 x
, y
, width
, height
));
1658 static void GLAPIENTRY
1659 save_CullFace(GLenum mode
)
1661 GET_CURRENT_CONTEXT(ctx
);
1663 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1664 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CULL_FACE
, 1);
1668 if (ctx
->ExecuteFlag
) {
1669 CALL_CullFace(ctx
->Exec
, (mode
));
1674 static void GLAPIENTRY
1675 save_DepthFunc(GLenum func
)
1677 GET_CURRENT_CONTEXT(ctx
);
1679 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1680 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DEPTH_FUNC
, 1);
1684 if (ctx
->ExecuteFlag
) {
1685 CALL_DepthFunc(ctx
->Exec
, (func
));
1690 static void GLAPIENTRY
1691 save_DepthMask(GLboolean mask
)
1693 GET_CURRENT_CONTEXT(ctx
);
1695 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1696 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DEPTH_MASK
, 1);
1700 if (ctx
->ExecuteFlag
) {
1701 CALL_DepthMask(ctx
->Exec
, (mask
));
1706 static void GLAPIENTRY
1707 save_DepthRange(GLclampd nearval
, GLclampd farval
)
1709 GET_CURRENT_CONTEXT(ctx
);
1711 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1712 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DEPTH_RANGE
, 2);
1714 n
[1].f
= (GLfloat
) nearval
;
1715 n
[2].f
= (GLfloat
) farval
;
1717 if (ctx
->ExecuteFlag
) {
1718 CALL_DepthRange(ctx
->Exec
, (nearval
, farval
));
1723 static void GLAPIENTRY
1724 save_Disable(GLenum cap
)
1726 GET_CURRENT_CONTEXT(ctx
);
1728 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1729 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DISABLE
, 1);
1733 if (ctx
->ExecuteFlag
) {
1734 CALL_Disable(ctx
->Exec
, (cap
));
1739 static void GLAPIENTRY
1740 save_DrawBuffer(GLenum mode
)
1742 GET_CURRENT_CONTEXT(ctx
);
1744 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1745 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DRAW_BUFFER
, 1);
1749 if (ctx
->ExecuteFlag
) {
1750 CALL_DrawBuffer(ctx
->Exec
, (mode
));
1755 static void GLAPIENTRY
1756 save_DrawPixels(GLsizei width
, GLsizei height
,
1757 GLenum format
, GLenum type
, const GLvoid
* pixels
)
1759 GET_CURRENT_CONTEXT(ctx
);
1760 GLvoid
*image
= unpack_image(2, width
, height
, 1, format
, type
,
1761 pixels
, &ctx
->Unpack
);
1763 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1764 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DRAW_PIXELS
, 5);
1775 if (ctx
->ExecuteFlag
) {
1776 CALL_DrawPixels(ctx
->Exec
, (width
, height
, format
, type
, pixels
));
1782 static void GLAPIENTRY
1783 save_Enable(GLenum cap
)
1785 GET_CURRENT_CONTEXT(ctx
);
1787 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1788 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ENABLE
, 1);
1792 if (ctx
->ExecuteFlag
) {
1793 CALL_Enable(ctx
->Exec
, (cap
));
1799 static void GLAPIENTRY
1800 _mesa_save_EvalMesh1(GLenum mode
, GLint i1
, GLint i2
)
1802 GET_CURRENT_CONTEXT(ctx
);
1804 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1805 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVALMESH1
, 3);
1811 if (ctx
->ExecuteFlag
) {
1812 CALL_EvalMesh1(ctx
->Exec
, (mode
, i1
, i2
));
1817 static void GLAPIENTRY
1818 _mesa_save_EvalMesh2(GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
1820 GET_CURRENT_CONTEXT(ctx
);
1822 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1823 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVALMESH2
, 5);
1831 if (ctx
->ExecuteFlag
) {
1832 CALL_EvalMesh2(ctx
->Exec
, (mode
, i1
, i2
, j1
, j2
));
1839 static void GLAPIENTRY
1840 save_Fogfv(GLenum pname
, const GLfloat
*params
)
1842 GET_CURRENT_CONTEXT(ctx
);
1844 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1845 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_FOG
, 5);
1853 if (ctx
->ExecuteFlag
) {
1854 CALL_Fogfv(ctx
->Exec
, (pname
, params
));
1859 static void GLAPIENTRY
1860 save_Fogf(GLenum pname
, GLfloat param
)
1862 save_Fogfv(pname
, ¶m
);
1866 static void GLAPIENTRY
1867 save_Fogiv(GLenum pname
, const GLint
*params
)
1872 case GL_FOG_DENSITY
:
1876 p
[0] = (GLfloat
) *params
;
1879 p
[0] = INT_TO_FLOAT(params
[0]);
1880 p
[1] = INT_TO_FLOAT(params
[1]);
1881 p
[2] = INT_TO_FLOAT(params
[2]);
1882 p
[3] = INT_TO_FLOAT(params
[3]);
1885 /* Error will be caught later in gl_Fogfv */
1888 save_Fogfv(pname
, p
);
1892 static void GLAPIENTRY
1893 save_Fogi(GLenum pname
, GLint param
)
1895 save_Fogiv(pname
, ¶m
);
1899 static void GLAPIENTRY
1900 save_FrontFace(GLenum mode
)
1902 GET_CURRENT_CONTEXT(ctx
);
1904 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1905 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_FRONT_FACE
, 1);
1909 if (ctx
->ExecuteFlag
) {
1910 CALL_FrontFace(ctx
->Exec
, (mode
));
1915 static void GLAPIENTRY
1916 save_Frustum(GLdouble left
, GLdouble right
,
1917 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
1919 GET_CURRENT_CONTEXT(ctx
);
1921 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1922 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_FRUSTUM
, 6);
1924 n
[1].f
= (GLfloat
) left
;
1925 n
[2].f
= (GLfloat
) right
;
1926 n
[3].f
= (GLfloat
) bottom
;
1927 n
[4].f
= (GLfloat
) top
;
1928 n
[5].f
= (GLfloat
) nearval
;
1929 n
[6].f
= (GLfloat
) farval
;
1931 if (ctx
->ExecuteFlag
) {
1932 CALL_Frustum(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
1937 static void GLAPIENTRY
1938 save_Hint(GLenum target
, GLenum mode
)
1940 GET_CURRENT_CONTEXT(ctx
);
1942 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1943 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_HINT
, 2);
1948 if (ctx
->ExecuteFlag
) {
1949 CALL_Hint(ctx
->Exec
, (target
, mode
));
1954 static void GLAPIENTRY
1955 save_Histogram(GLenum target
, GLsizei width
, GLenum internalFormat
,
1958 GET_CURRENT_CONTEXT(ctx
);
1961 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1962 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_HISTOGRAM
, 4);
1966 n
[3].e
= internalFormat
;
1969 if (ctx
->ExecuteFlag
) {
1970 CALL_Histogram(ctx
->Exec
, (target
, width
, internalFormat
, sink
));
1975 static void GLAPIENTRY
1976 save_IndexMask(GLuint mask
)
1978 GET_CURRENT_CONTEXT(ctx
);
1980 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1981 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_INDEX_MASK
, 1);
1985 if (ctx
->ExecuteFlag
) {
1986 CALL_IndexMask(ctx
->Exec
, (mask
));
1991 static void GLAPIENTRY
1992 save_InitNames(void)
1994 GET_CURRENT_CONTEXT(ctx
);
1995 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1996 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_INIT_NAMES
, 0);
1997 if (ctx
->ExecuteFlag
) {
1998 CALL_InitNames(ctx
->Exec
, ());
2003 static void GLAPIENTRY
2004 save_Lightfv(GLenum light
, GLenum pname
, const GLfloat
*params
)
2006 GET_CURRENT_CONTEXT(ctx
);
2008 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2009 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LIGHT
, 6);
2027 case GL_SPOT_DIRECTION
:
2030 case GL_SPOT_EXPONENT
:
2033 case GL_SPOT_CUTOFF
:
2036 case GL_CONSTANT_ATTENUATION
:
2039 case GL_LINEAR_ATTENUATION
:
2042 case GL_QUADRATIC_ATTENUATION
:
2048 for (i
= 0; i
< nParams
; i
++) {
2049 n
[3 + i
].f
= params
[i
];
2052 if (ctx
->ExecuteFlag
) {
2053 CALL_Lightfv(ctx
->Exec
, (light
, pname
, params
));
2058 static void GLAPIENTRY
2059 save_Lightf(GLenum light
, GLenum pname
, GLfloat params
)
2061 save_Lightfv(light
, pname
, ¶ms
);
2065 static void GLAPIENTRY
2066 save_Lightiv(GLenum light
, GLenum pname
, const GLint
*params
)
2073 fparam
[0] = INT_TO_FLOAT(params
[0]);
2074 fparam
[1] = INT_TO_FLOAT(params
[1]);
2075 fparam
[2] = INT_TO_FLOAT(params
[2]);
2076 fparam
[3] = INT_TO_FLOAT(params
[3]);
2079 fparam
[0] = (GLfloat
) params
[0];
2080 fparam
[1] = (GLfloat
) params
[1];
2081 fparam
[2] = (GLfloat
) params
[2];
2082 fparam
[3] = (GLfloat
) params
[3];
2084 case GL_SPOT_DIRECTION
:
2085 fparam
[0] = (GLfloat
) params
[0];
2086 fparam
[1] = (GLfloat
) params
[1];
2087 fparam
[2] = (GLfloat
) params
[2];
2089 case GL_SPOT_EXPONENT
:
2090 case GL_SPOT_CUTOFF
:
2091 case GL_CONSTANT_ATTENUATION
:
2092 case GL_LINEAR_ATTENUATION
:
2093 case GL_QUADRATIC_ATTENUATION
:
2094 fparam
[0] = (GLfloat
) params
[0];
2097 /* error will be caught later in gl_Lightfv */
2100 save_Lightfv(light
, pname
, fparam
);
2104 static void GLAPIENTRY
2105 save_Lighti(GLenum light
, GLenum pname
, GLint param
)
2107 save_Lightiv(light
, pname
, ¶m
);
2111 static void GLAPIENTRY
2112 save_LightModelfv(GLenum pname
, const GLfloat
*params
)
2114 GET_CURRENT_CONTEXT(ctx
);
2116 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2117 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LIGHT_MODEL
, 5);
2125 if (ctx
->ExecuteFlag
) {
2126 CALL_LightModelfv(ctx
->Exec
, (pname
, params
));
2131 static void GLAPIENTRY
2132 save_LightModelf(GLenum pname
, GLfloat param
)
2134 save_LightModelfv(pname
, ¶m
);
2138 static void GLAPIENTRY
2139 save_LightModeliv(GLenum pname
, const GLint
*params
)
2143 case GL_LIGHT_MODEL_AMBIENT
:
2144 fparam
[0] = INT_TO_FLOAT(params
[0]);
2145 fparam
[1] = INT_TO_FLOAT(params
[1]);
2146 fparam
[2] = INT_TO_FLOAT(params
[2]);
2147 fparam
[3] = INT_TO_FLOAT(params
[3]);
2149 case GL_LIGHT_MODEL_LOCAL_VIEWER
:
2150 case GL_LIGHT_MODEL_TWO_SIDE
:
2151 case GL_LIGHT_MODEL_COLOR_CONTROL
:
2152 fparam
[0] = (GLfloat
) params
[0];
2155 /* Error will be caught later in gl_LightModelfv */
2158 save_LightModelfv(pname
, fparam
);
2162 static void GLAPIENTRY
2163 save_LightModeli(GLenum pname
, GLint param
)
2165 save_LightModeliv(pname
, ¶m
);
2169 static void GLAPIENTRY
2170 save_LineStipple(GLint factor
, GLushort pattern
)
2172 GET_CURRENT_CONTEXT(ctx
);
2174 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2175 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LINE_STIPPLE
, 2);
2180 if (ctx
->ExecuteFlag
) {
2181 CALL_LineStipple(ctx
->Exec
, (factor
, pattern
));
2186 static void GLAPIENTRY
2187 save_LineWidth(GLfloat width
)
2189 GET_CURRENT_CONTEXT(ctx
);
2191 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2192 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LINE_WIDTH
, 1);
2196 if (ctx
->ExecuteFlag
) {
2197 CALL_LineWidth(ctx
->Exec
, (width
));
2202 static void GLAPIENTRY
2203 save_ListBase(GLuint base
)
2205 GET_CURRENT_CONTEXT(ctx
);
2207 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2208 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LIST_BASE
, 1);
2212 if (ctx
->ExecuteFlag
) {
2213 CALL_ListBase(ctx
->Exec
, (base
));
2218 static void GLAPIENTRY
2219 save_LoadIdentity(void)
2221 GET_CURRENT_CONTEXT(ctx
);
2222 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2223 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_LOAD_IDENTITY
, 0);
2224 if (ctx
->ExecuteFlag
) {
2225 CALL_LoadIdentity(ctx
->Exec
, ());
2230 static void GLAPIENTRY
2231 save_LoadMatrixf(const GLfloat
* m
)
2233 GET_CURRENT_CONTEXT(ctx
);
2235 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2236 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LOAD_MATRIX
, 16);
2239 for (i
= 0; i
< 16; i
++) {
2243 if (ctx
->ExecuteFlag
) {
2244 CALL_LoadMatrixf(ctx
->Exec
, (m
));
2249 static void GLAPIENTRY
2250 save_LoadMatrixd(const GLdouble
* m
)
2254 for (i
= 0; i
< 16; i
++) {
2255 f
[i
] = (GLfloat
) m
[i
];
2257 save_LoadMatrixf(f
);
2261 static void GLAPIENTRY
2262 save_LoadName(GLuint name
)
2264 GET_CURRENT_CONTEXT(ctx
);
2266 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2267 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LOAD_NAME
, 1);
2271 if (ctx
->ExecuteFlag
) {
2272 CALL_LoadName(ctx
->Exec
, (name
));
2277 static void GLAPIENTRY
2278 save_LogicOp(GLenum opcode
)
2280 GET_CURRENT_CONTEXT(ctx
);
2282 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2283 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LOGIC_OP
, 1);
2287 if (ctx
->ExecuteFlag
) {
2288 CALL_LogicOp(ctx
->Exec
, (opcode
));
2293 static void GLAPIENTRY
2294 save_Map1d(GLenum target
, GLdouble u1
, GLdouble u2
, GLint stride
,
2295 GLint order
, const GLdouble
* points
)
2297 GET_CURRENT_CONTEXT(ctx
);
2299 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2300 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MAP1
, 6);
2302 GLfloat
*pnts
= _mesa_copy_map_points1d(target
, stride
, order
, points
);
2304 n
[2].f
= (GLfloat
) u1
;
2305 n
[3].f
= (GLfloat
) u2
;
2306 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2308 n
[6].data
= (void *) pnts
;
2310 if (ctx
->ExecuteFlag
) {
2311 CALL_Map1d(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2315 static void GLAPIENTRY
2316 save_Map1f(GLenum target
, GLfloat u1
, GLfloat u2
, GLint stride
,
2317 GLint order
, const GLfloat
* points
)
2319 GET_CURRENT_CONTEXT(ctx
);
2321 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2322 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MAP1
, 6);
2324 GLfloat
*pnts
= _mesa_copy_map_points1f(target
, stride
, order
, points
);
2328 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2330 n
[6].data
= (void *) pnts
;
2332 if (ctx
->ExecuteFlag
) {
2333 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2338 static void GLAPIENTRY
2339 save_Map2d(GLenum target
,
2340 GLdouble u1
, GLdouble u2
, GLint ustride
, GLint uorder
,
2341 GLdouble v1
, GLdouble v2
, GLint vstride
, GLint vorder
,
2342 const GLdouble
* points
)
2344 GET_CURRENT_CONTEXT(ctx
);
2346 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2347 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MAP2
, 10);
2349 GLfloat
*pnts
= _mesa_copy_map_points2d(target
, ustride
, uorder
,
2350 vstride
, vorder
, points
);
2352 n
[2].f
= (GLfloat
) u1
;
2353 n
[3].f
= (GLfloat
) u2
;
2354 n
[4].f
= (GLfloat
) v1
;
2355 n
[5].f
= (GLfloat
) v2
;
2356 /* XXX verify these strides are correct */
2357 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2358 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2361 n
[10].data
= (void *) pnts
;
2363 if (ctx
->ExecuteFlag
) {
2364 CALL_Map2d(ctx
->Exec
, (target
,
2365 u1
, u2
, ustride
, uorder
,
2366 v1
, v2
, vstride
, vorder
, points
));
2371 static void GLAPIENTRY
2372 save_Map2f(GLenum target
,
2373 GLfloat u1
, GLfloat u2
, GLint ustride
, GLint uorder
,
2374 GLfloat v1
, GLfloat v2
, GLint vstride
, GLint vorder
,
2375 const GLfloat
* points
)
2377 GET_CURRENT_CONTEXT(ctx
);
2379 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2380 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MAP2
, 10);
2382 GLfloat
*pnts
= _mesa_copy_map_points2f(target
, ustride
, uorder
,
2383 vstride
, vorder
, points
);
2389 /* XXX verify these strides are correct */
2390 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2391 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2394 n
[10].data
= (void *) pnts
;
2396 if (ctx
->ExecuteFlag
) {
2397 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
2398 v1
, v2
, vstride
, vorder
, points
));
2403 static void GLAPIENTRY
2404 save_MapGrid1f(GLint un
, GLfloat u1
, GLfloat u2
)
2406 GET_CURRENT_CONTEXT(ctx
);
2408 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2409 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MAPGRID1
, 3);
2415 if (ctx
->ExecuteFlag
) {
2416 CALL_MapGrid1f(ctx
->Exec
, (un
, u1
, u2
));
2421 static void GLAPIENTRY
2422 save_MapGrid1d(GLint un
, GLdouble u1
, GLdouble u2
)
2424 save_MapGrid1f(un
, (GLfloat
) u1
, (GLfloat
) u2
);
2428 static void GLAPIENTRY
2429 save_MapGrid2f(GLint un
, GLfloat u1
, GLfloat u2
,
2430 GLint vn
, GLfloat v1
, GLfloat v2
)
2432 GET_CURRENT_CONTEXT(ctx
);
2434 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2435 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MAPGRID2
, 6);
2444 if (ctx
->ExecuteFlag
) {
2445 CALL_MapGrid2f(ctx
->Exec
, (un
, u1
, u2
, vn
, v1
, v2
));
2451 static void GLAPIENTRY
2452 save_MapGrid2d(GLint un
, GLdouble u1
, GLdouble u2
,
2453 GLint vn
, GLdouble v1
, GLdouble v2
)
2455 save_MapGrid2f(un
, (GLfloat
) u1
, (GLfloat
) u2
,
2456 vn
, (GLfloat
) v1
, (GLfloat
) v2
);
2460 static void GLAPIENTRY
2461 save_MatrixMode(GLenum mode
)
2463 GET_CURRENT_CONTEXT(ctx
);
2465 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2466 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MATRIX_MODE
, 1);
2470 if (ctx
->ExecuteFlag
) {
2471 CALL_MatrixMode(ctx
->Exec
, (mode
));
2476 static void GLAPIENTRY
2477 save_Minmax(GLenum target
, GLenum internalFormat
, GLboolean sink
)
2479 GET_CURRENT_CONTEXT(ctx
);
2482 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2483 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MIN_MAX
, 3);
2486 n
[2].e
= internalFormat
;
2489 if (ctx
->ExecuteFlag
) {
2490 CALL_Minmax(ctx
->Exec
, (target
, internalFormat
, sink
));
2495 static void GLAPIENTRY
2496 save_MultMatrixf(const GLfloat
* m
)
2498 GET_CURRENT_CONTEXT(ctx
);
2500 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2501 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MULT_MATRIX
, 16);
2504 for (i
= 0; i
< 16; i
++) {
2508 if (ctx
->ExecuteFlag
) {
2509 CALL_MultMatrixf(ctx
->Exec
, (m
));
2514 static void GLAPIENTRY
2515 save_MultMatrixd(const GLdouble
* m
)
2519 for (i
= 0; i
< 16; i
++) {
2520 f
[i
] = (GLfloat
) m
[i
];
2522 save_MultMatrixf(f
);
2526 static void GLAPIENTRY
2527 save_NewList(GLuint name
, GLenum mode
)
2529 GET_CURRENT_CONTEXT(ctx
);
2530 /* It's an error to call this function while building a display list */
2531 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
2538 static void GLAPIENTRY
2539 save_Ortho(GLdouble left
, GLdouble right
,
2540 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
2542 GET_CURRENT_CONTEXT(ctx
);
2544 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2545 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ORTHO
, 6);
2547 n
[1].f
= (GLfloat
) left
;
2548 n
[2].f
= (GLfloat
) right
;
2549 n
[3].f
= (GLfloat
) bottom
;
2550 n
[4].f
= (GLfloat
) top
;
2551 n
[5].f
= (GLfloat
) nearval
;
2552 n
[6].f
= (GLfloat
) farval
;
2554 if (ctx
->ExecuteFlag
) {
2555 CALL_Ortho(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
2560 static void GLAPIENTRY
2561 save_PixelMapfv(GLenum map
, GLint mapsize
, const GLfloat
*values
)
2563 GET_CURRENT_CONTEXT(ctx
);
2565 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2566 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PIXEL_MAP
, 3);
2570 n
[3].data
= (void *) _mesa_malloc(mapsize
* sizeof(GLfloat
));
2571 MEMCPY(n
[3].data
, (void *) values
, mapsize
* sizeof(GLfloat
));
2573 if (ctx
->ExecuteFlag
) {
2574 CALL_PixelMapfv(ctx
->Exec
, (map
, mapsize
, values
));
2579 static void GLAPIENTRY
2580 save_PixelMapuiv(GLenum map
, GLint mapsize
, const GLuint
*values
)
2582 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2584 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
2585 for (i
= 0; i
< mapsize
; i
++) {
2586 fvalues
[i
] = (GLfloat
) values
[i
];
2590 for (i
= 0; i
< mapsize
; i
++) {
2591 fvalues
[i
] = UINT_TO_FLOAT(values
[i
]);
2594 save_PixelMapfv(map
, mapsize
, fvalues
);
2598 static void GLAPIENTRY
2599 save_PixelMapusv(GLenum map
, GLint mapsize
, const GLushort
*values
)
2601 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2603 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
2604 for (i
= 0; i
< mapsize
; i
++) {
2605 fvalues
[i
] = (GLfloat
) values
[i
];
2609 for (i
= 0; i
< mapsize
; i
++) {
2610 fvalues
[i
] = USHORT_TO_FLOAT(values
[i
]);
2613 save_PixelMapfv(map
, mapsize
, fvalues
);
2617 static void GLAPIENTRY
2618 save_PixelTransferf(GLenum pname
, GLfloat param
)
2620 GET_CURRENT_CONTEXT(ctx
);
2622 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2623 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PIXEL_TRANSFER
, 2);
2628 if (ctx
->ExecuteFlag
) {
2629 CALL_PixelTransferf(ctx
->Exec
, (pname
, param
));
2634 static void GLAPIENTRY
2635 save_PixelTransferi(GLenum pname
, GLint param
)
2637 save_PixelTransferf(pname
, (GLfloat
) param
);
2641 static void GLAPIENTRY
2642 save_PixelZoom(GLfloat xfactor
, GLfloat yfactor
)
2644 GET_CURRENT_CONTEXT(ctx
);
2646 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2647 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PIXEL_ZOOM
, 2);
2652 if (ctx
->ExecuteFlag
) {
2653 CALL_PixelZoom(ctx
->Exec
, (xfactor
, yfactor
));
2658 static void GLAPIENTRY
2659 save_PointParameterfvEXT(GLenum pname
, const GLfloat
*params
)
2661 GET_CURRENT_CONTEXT(ctx
);
2663 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2664 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_POINT_PARAMETERS
, 4);
2671 if (ctx
->ExecuteFlag
) {
2672 CALL_PointParameterfvEXT(ctx
->Exec
, (pname
, params
));
2677 static void GLAPIENTRY
2678 save_PointParameterfEXT(GLenum pname
, GLfloat param
)
2680 save_PointParameterfvEXT(pname
, ¶m
);
2683 static void GLAPIENTRY
2684 save_PointParameteriNV(GLenum pname
, GLint param
)
2686 GLfloat p
= (GLfloat
) param
;
2687 save_PointParameterfvEXT(pname
, &p
);
2690 static void GLAPIENTRY
2691 save_PointParameterivNV(GLenum pname
, const GLint
* param
)
2693 GLfloat p
= (GLfloat
) param
[0];
2694 save_PointParameterfvEXT(pname
, &p
);
2698 static void GLAPIENTRY
2699 save_PointSize(GLfloat size
)
2701 GET_CURRENT_CONTEXT(ctx
);
2703 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2704 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_POINT_SIZE
, 1);
2708 if (ctx
->ExecuteFlag
) {
2709 CALL_PointSize(ctx
->Exec
, (size
));
2714 static void GLAPIENTRY
2715 save_PolygonMode(GLenum face
, GLenum mode
)
2717 GET_CURRENT_CONTEXT(ctx
);
2719 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2720 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_POLYGON_MODE
, 2);
2725 if (ctx
->ExecuteFlag
) {
2726 CALL_PolygonMode(ctx
->Exec
, (face
, mode
));
2731 static void GLAPIENTRY
2732 save_PolygonStipple(const GLubyte
* pattern
)
2734 GET_CURRENT_CONTEXT(ctx
);
2735 GLvoid
*image
= unpack_image(2, 32, 32, 1, GL_COLOR_INDEX
, GL_BITMAP
,
2736 pattern
, &ctx
->Unpack
);
2738 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2739 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_POLYGON_STIPPLE
, 1);
2746 if (ctx
->ExecuteFlag
) {
2747 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) pattern
));
2752 static void GLAPIENTRY
2753 save_PolygonOffset(GLfloat factor
, GLfloat units
)
2755 GET_CURRENT_CONTEXT(ctx
);
2757 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2758 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_POLYGON_OFFSET
, 2);
2763 if (ctx
->ExecuteFlag
) {
2764 CALL_PolygonOffset(ctx
->Exec
, (factor
, units
));
2769 static void GLAPIENTRY
2770 save_PolygonOffsetEXT(GLfloat factor
, GLfloat bias
)
2772 GET_CURRENT_CONTEXT(ctx
);
2773 /* XXX mult by DepthMaxF here??? */
2774 save_PolygonOffset(factor
, ctx
->DrawBuffer
->_DepthMaxF
* bias
);
2778 static void GLAPIENTRY
2779 save_PopAttrib(void)
2781 GET_CURRENT_CONTEXT(ctx
);
2782 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2783 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_POP_ATTRIB
, 0);
2784 if (ctx
->ExecuteFlag
) {
2785 CALL_PopAttrib(ctx
->Exec
, ());
2790 static void GLAPIENTRY
2791 save_PopMatrix(void)
2793 GET_CURRENT_CONTEXT(ctx
);
2794 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2795 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_POP_MATRIX
, 0);
2796 if (ctx
->ExecuteFlag
) {
2797 CALL_PopMatrix(ctx
->Exec
, ());
2802 static void GLAPIENTRY
2805 GET_CURRENT_CONTEXT(ctx
);
2806 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2807 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_POP_NAME
, 0);
2808 if (ctx
->ExecuteFlag
) {
2809 CALL_PopName(ctx
->Exec
, ());
2814 static void GLAPIENTRY
2815 save_PrioritizeTextures(GLsizei num
, const GLuint
* textures
,
2816 const GLclampf
* priorities
)
2818 GET_CURRENT_CONTEXT(ctx
);
2820 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2822 for (i
= 0; i
< num
; i
++) {
2824 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PRIORITIZE_TEXTURE
, 2);
2826 n
[1].ui
= textures
[i
];
2827 n
[2].f
= priorities
[i
];
2830 if (ctx
->ExecuteFlag
) {
2831 CALL_PrioritizeTextures(ctx
->Exec
, (num
, textures
, priorities
));
2836 static void GLAPIENTRY
2837 save_PushAttrib(GLbitfield mask
)
2839 GET_CURRENT_CONTEXT(ctx
);
2841 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2842 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PUSH_ATTRIB
, 1);
2846 if (ctx
->ExecuteFlag
) {
2847 CALL_PushAttrib(ctx
->Exec
, (mask
));
2852 static void GLAPIENTRY
2853 save_PushMatrix(void)
2855 GET_CURRENT_CONTEXT(ctx
);
2856 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2857 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_PUSH_MATRIX
, 0);
2858 if (ctx
->ExecuteFlag
) {
2859 CALL_PushMatrix(ctx
->Exec
, ());
2864 static void GLAPIENTRY
2865 save_PushName(GLuint name
)
2867 GET_CURRENT_CONTEXT(ctx
);
2869 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2870 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PUSH_NAME
, 1);
2874 if (ctx
->ExecuteFlag
) {
2875 CALL_PushName(ctx
->Exec
, (name
));
2880 static void GLAPIENTRY
2881 save_RasterPos4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
2883 GET_CURRENT_CONTEXT(ctx
);
2885 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2886 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_RASTER_POS
, 4);
2893 if (ctx
->ExecuteFlag
) {
2894 CALL_RasterPos4f(ctx
->Exec
, (x
, y
, z
, w
));
2898 static void GLAPIENTRY
2899 save_RasterPos2d(GLdouble x
, GLdouble y
)
2901 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
2904 static void GLAPIENTRY
2905 save_RasterPos2f(GLfloat x
, GLfloat y
)
2907 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2910 static void GLAPIENTRY
2911 save_RasterPos2i(GLint x
, GLint y
)
2913 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
2916 static void GLAPIENTRY
2917 save_RasterPos2s(GLshort x
, GLshort y
)
2919 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2922 static void GLAPIENTRY
2923 save_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
2925 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
2928 static void GLAPIENTRY
2929 save_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
2931 save_RasterPos4f(x
, y
, z
, 1.0F
);
2934 static void GLAPIENTRY
2935 save_RasterPos3i(GLint x
, GLint y
, GLint z
)
2937 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
2940 static void GLAPIENTRY
2941 save_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
2943 save_RasterPos4f(x
, y
, z
, 1.0F
);
2946 static void GLAPIENTRY
2947 save_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
2949 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
2952 static void GLAPIENTRY
2953 save_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
2955 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
2958 static void GLAPIENTRY
2959 save_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
2961 save_RasterPos4f(x
, y
, z
, w
);
2964 static void GLAPIENTRY
2965 save_RasterPos2dv(const GLdouble
* v
)
2967 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
2970 static void GLAPIENTRY
2971 save_RasterPos2fv(const GLfloat
* v
)
2973 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2976 static void GLAPIENTRY
2977 save_RasterPos2iv(const GLint
* v
)
2979 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
2982 static void GLAPIENTRY
2983 save_RasterPos2sv(const GLshort
* v
)
2985 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2988 static void GLAPIENTRY
2989 save_RasterPos3dv(const GLdouble
* v
)
2991 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
2994 static void GLAPIENTRY
2995 save_RasterPos3fv(const GLfloat
* v
)
2997 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3000 static void GLAPIENTRY
3001 save_RasterPos3iv(const GLint
* v
)
3003 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3006 static void GLAPIENTRY
3007 save_RasterPos3sv(const GLshort
* v
)
3009 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3012 static void GLAPIENTRY
3013 save_RasterPos4dv(const GLdouble
* v
)
3015 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3016 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3019 static void GLAPIENTRY
3020 save_RasterPos4fv(const GLfloat
* v
)
3022 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3025 static void GLAPIENTRY
3026 save_RasterPos4iv(const GLint
* v
)
3028 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3029 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3032 static void GLAPIENTRY
3033 save_RasterPos4sv(const GLshort
* v
)
3035 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3039 static void GLAPIENTRY
3040 save_PassThrough(GLfloat token
)
3042 GET_CURRENT_CONTEXT(ctx
);
3044 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3045 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PASSTHROUGH
, 1);
3049 if (ctx
->ExecuteFlag
) {
3050 CALL_PassThrough(ctx
->Exec
, (token
));
3055 static void GLAPIENTRY
3056 save_ReadBuffer(GLenum mode
)
3058 GET_CURRENT_CONTEXT(ctx
);
3060 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3061 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_READ_BUFFER
, 1);
3065 if (ctx
->ExecuteFlag
) {
3066 CALL_ReadBuffer(ctx
->Exec
, (mode
));
3071 static void GLAPIENTRY
3072 save_ResetHistogram(GLenum target
)
3074 GET_CURRENT_CONTEXT(ctx
);
3076 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3077 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_RESET_HISTOGRAM
, 1);
3081 if (ctx
->ExecuteFlag
) {
3082 CALL_ResetHistogram(ctx
->Exec
, (target
));
3087 static void GLAPIENTRY
3088 save_ResetMinmax(GLenum target
)
3090 GET_CURRENT_CONTEXT(ctx
);
3092 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3093 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_RESET_MIN_MAX
, 1);
3097 if (ctx
->ExecuteFlag
) {
3098 CALL_ResetMinmax(ctx
->Exec
, (target
));
3103 static void GLAPIENTRY
3104 save_Rotatef(GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
3106 GET_CURRENT_CONTEXT(ctx
);
3108 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3109 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ROTATE
, 4);
3116 if (ctx
->ExecuteFlag
) {
3117 CALL_Rotatef(ctx
->Exec
, (angle
, x
, y
, z
));
3122 static void GLAPIENTRY
3123 save_Rotated(GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
3125 save_Rotatef((GLfloat
) angle
, (GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3129 static void GLAPIENTRY
3130 save_Scalef(GLfloat x
, GLfloat y
, GLfloat z
)
3132 GET_CURRENT_CONTEXT(ctx
);
3134 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3135 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SCALE
, 3);
3141 if (ctx
->ExecuteFlag
) {
3142 CALL_Scalef(ctx
->Exec
, (x
, y
, z
));
3147 static void GLAPIENTRY
3148 save_Scaled(GLdouble x
, GLdouble y
, GLdouble z
)
3150 save_Scalef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3154 static void GLAPIENTRY
3155 save_Scissor(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3157 GET_CURRENT_CONTEXT(ctx
);
3159 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3160 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SCISSOR
, 4);
3167 if (ctx
->ExecuteFlag
) {
3168 CALL_Scissor(ctx
->Exec
, (x
, y
, width
, height
));
3173 static void GLAPIENTRY
3174 save_ShadeModel(GLenum mode
)
3176 GET_CURRENT_CONTEXT(ctx
);
3178 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3179 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SHADE_MODEL
, 1);
3183 if (ctx
->ExecuteFlag
) {
3184 CALL_ShadeModel(ctx
->Exec
, (mode
));
3189 static void GLAPIENTRY
3190 save_StencilFunc(GLenum func
, GLint ref
, GLuint mask
)
3192 GET_CURRENT_CONTEXT(ctx
);
3194 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3195 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_FUNC
, 3);
3201 if (ctx
->ExecuteFlag
) {
3202 CALL_StencilFunc(ctx
->Exec
, (func
, ref
, mask
));
3207 static void GLAPIENTRY
3208 save_StencilMask(GLuint mask
)
3210 GET_CURRENT_CONTEXT(ctx
);
3212 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3213 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_MASK
, 1);
3217 if (ctx
->ExecuteFlag
) {
3218 CALL_StencilMask(ctx
->Exec
, (mask
));
3223 static void GLAPIENTRY
3224 save_StencilOp(GLenum fail
, GLenum zfail
, GLenum zpass
)
3226 GET_CURRENT_CONTEXT(ctx
);
3228 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3229 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_OP
, 3);
3235 if (ctx
->ExecuteFlag
) {
3236 CALL_StencilOp(ctx
->Exec
, (fail
, zfail
, zpass
));
3241 static void GLAPIENTRY
3242 save_StencilFuncSeparate(GLenum face
, GLenum func
, GLint ref
, GLuint mask
)
3244 GET_CURRENT_CONTEXT(ctx
);
3246 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3247 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3254 if (ctx
->ExecuteFlag
) {
3255 CALL_StencilFuncSeparate(ctx
->Exec
, (face
, func
, ref
, mask
));
3260 static void GLAPIENTRY
3261 save_StencilFuncSeparateATI(GLenum frontfunc
, GLenum backfunc
, GLint ref
,
3264 GET_CURRENT_CONTEXT(ctx
);
3266 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3268 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3276 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3283 if (ctx
->ExecuteFlag
) {
3284 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_FRONT
, frontfunc
, ref
, mask
));
3285 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_BACK
, backfunc
, ref
, mask
));
3290 static void GLAPIENTRY
3291 save_StencilMaskSeparate(GLenum face
, GLuint mask
)
3293 GET_CURRENT_CONTEXT(ctx
);
3295 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3296 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_MASK_SEPARATE
, 2);
3301 if (ctx
->ExecuteFlag
) {
3302 CALL_StencilMaskSeparate(ctx
->Exec
, (face
, mask
));
3307 static void GLAPIENTRY
3308 save_StencilOpSeparate(GLenum face
, GLenum fail
, GLenum zfail
, GLenum zpass
)
3310 GET_CURRENT_CONTEXT(ctx
);
3312 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3313 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_OP_SEPARATE
, 4);
3320 if (ctx
->ExecuteFlag
) {
3321 CALL_StencilOpSeparate(ctx
->Exec
, (face
, fail
, zfail
, zpass
));
3326 static void GLAPIENTRY
3327 save_TexEnvfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3329 GET_CURRENT_CONTEXT(ctx
);
3331 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3332 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEXENV
, 6);
3336 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3344 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
3347 if (ctx
->ExecuteFlag
) {
3348 CALL_TexEnvfv(ctx
->Exec
, (target
, pname
, params
));
3353 static void GLAPIENTRY
3354 save_TexEnvf(GLenum target
, GLenum pname
, GLfloat param
)
3356 save_TexEnvfv(target
, pname
, ¶m
);
3360 static void GLAPIENTRY
3361 save_TexEnvi(GLenum target
, GLenum pname
, GLint param
)
3364 p
[0] = (GLfloat
) param
;
3365 p
[1] = p
[2] = p
[3] = 0.0;
3366 save_TexEnvfv(target
, pname
, p
);
3370 static void GLAPIENTRY
3371 save_TexEnviv(GLenum target
, GLenum pname
, const GLint
* param
)
3374 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3375 p
[0] = INT_TO_FLOAT(param
[0]);
3376 p
[1] = INT_TO_FLOAT(param
[1]);
3377 p
[2] = INT_TO_FLOAT(param
[2]);
3378 p
[3] = INT_TO_FLOAT(param
[3]);
3381 p
[0] = (GLfloat
) param
[0];
3382 p
[1] = p
[2] = p
[3] = 0.0F
;
3384 save_TexEnvfv(target
, pname
, p
);
3388 static void GLAPIENTRY
3389 save_TexGenfv(GLenum coord
, GLenum pname
, const GLfloat
*params
)
3391 GET_CURRENT_CONTEXT(ctx
);
3393 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3394 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEXGEN
, 6);
3403 if (ctx
->ExecuteFlag
) {
3404 CALL_TexGenfv(ctx
->Exec
, (coord
, pname
, params
));
3409 static void GLAPIENTRY
3410 save_TexGeniv(GLenum coord
, GLenum pname
, const GLint
*params
)
3413 p
[0] = (GLfloat
) params
[0];
3414 p
[1] = (GLfloat
) params
[1];
3415 p
[2] = (GLfloat
) params
[2];
3416 p
[3] = (GLfloat
) params
[3];
3417 save_TexGenfv(coord
, pname
, p
);
3421 static void GLAPIENTRY
3422 save_TexGend(GLenum coord
, GLenum pname
, GLdouble param
)
3424 GLfloat p
= (GLfloat
) param
;
3425 save_TexGenfv(coord
, pname
, &p
);
3429 static void GLAPIENTRY
3430 save_TexGendv(GLenum coord
, GLenum pname
, const GLdouble
*params
)
3433 p
[0] = (GLfloat
) params
[0];
3434 p
[1] = (GLfloat
) params
[1];
3435 p
[2] = (GLfloat
) params
[2];
3436 p
[3] = (GLfloat
) params
[3];
3437 save_TexGenfv(coord
, pname
, p
);
3441 static void GLAPIENTRY
3442 save_TexGenf(GLenum coord
, GLenum pname
, GLfloat param
)
3444 save_TexGenfv(coord
, pname
, ¶m
);
3448 static void GLAPIENTRY
3449 save_TexGeni(GLenum coord
, GLenum pname
, GLint param
)
3451 save_TexGeniv(coord
, pname
, ¶m
);
3455 static void GLAPIENTRY
3456 save_TexParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3458 GET_CURRENT_CONTEXT(ctx
);
3460 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3461 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEXPARAMETER
, 6);
3470 if (ctx
->ExecuteFlag
) {
3471 CALL_TexParameterfv(ctx
->Exec
, (target
, pname
, params
));
3476 static void GLAPIENTRY
3477 save_TexParameterf(GLenum target
, GLenum pname
, GLfloat param
)
3479 save_TexParameterfv(target
, pname
, ¶m
);
3483 static void GLAPIENTRY
3484 save_TexParameteri(GLenum target
, GLenum pname
, GLint param
)
3487 fparam
[0] = (GLfloat
) param
;
3488 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
3489 save_TexParameterfv(target
, pname
, fparam
);
3493 static void GLAPIENTRY
3494 save_TexParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
3497 fparam
[0] = (GLfloat
) params
[0];
3498 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
3499 save_TexParameterfv(target
, pname
, fparam
);
3503 static void GLAPIENTRY
3504 save_TexImage1D(GLenum target
,
3505 GLint level
, GLint components
,
3506 GLsizei width
, GLint border
,
3507 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3509 GET_CURRENT_CONTEXT(ctx
);
3510 if (target
== GL_PROXY_TEXTURE_1D
) {
3511 /* don't compile, execute immediately */
3512 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
3513 border
, format
, type
, pixels
));
3516 GLvoid
*image
= unpack_image(1, width
, 1, 1, format
, type
,
3517 pixels
, &ctx
->Unpack
);
3519 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3520 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_IMAGE1D
, 8);
3524 n
[3].i
= components
;
3525 n
[4].i
= (GLint
) width
;
3534 if (ctx
->ExecuteFlag
) {
3535 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
3536 border
, format
, type
, pixels
));
3542 static void GLAPIENTRY
3543 save_TexImage2D(GLenum target
,
3544 GLint level
, GLint components
,
3545 GLsizei width
, GLsizei height
, GLint border
,
3546 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3548 GET_CURRENT_CONTEXT(ctx
);
3549 if (target
== GL_PROXY_TEXTURE_2D
) {
3550 /* don't compile, execute immediately */
3551 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
3552 height
, border
, format
, type
, pixels
));
3555 GLvoid
*image
= unpack_image(2, width
, height
, 1, format
, type
,
3556 pixels
, &ctx
->Unpack
);
3558 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3559 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_IMAGE2D
, 9);
3563 n
[3].i
= components
;
3564 n
[4].i
= (GLint
) width
;
3565 n
[5].i
= (GLint
) height
;
3574 if (ctx
->ExecuteFlag
) {
3575 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
3576 height
, border
, format
, type
, pixels
));
3582 static void GLAPIENTRY
3583 save_TexImage3D(GLenum target
,
3584 GLint level
, GLint internalFormat
,
3585 GLsizei width
, GLsizei height
, GLsizei depth
,
3587 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3589 GET_CURRENT_CONTEXT(ctx
);
3590 if (target
== GL_PROXY_TEXTURE_3D
) {
3591 /* don't compile, execute immediately */
3592 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
3593 height
, depth
, border
, format
, type
,
3598 GLvoid
*image
= unpack_image(3, width
, height
, depth
, format
, type
,
3599 pixels
, &ctx
->Unpack
);
3600 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3601 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_IMAGE3D
, 10);
3605 n
[3].i
= (GLint
) internalFormat
;
3606 n
[4].i
= (GLint
) width
;
3607 n
[5].i
= (GLint
) height
;
3608 n
[6].i
= (GLint
) depth
;
3617 if (ctx
->ExecuteFlag
) {
3618 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
3619 height
, depth
, border
, format
, type
,
3626 static void GLAPIENTRY
3627 save_TexSubImage1D(GLenum target
, GLint level
, GLint xoffset
,
3628 GLsizei width
, GLenum format
, GLenum type
,
3629 const GLvoid
* pixels
)
3631 GET_CURRENT_CONTEXT(ctx
);
3633 GLvoid
*image
= unpack_image(1, width
, 1, 1, format
, type
,
3634 pixels
, &ctx
->Unpack
);
3635 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3636 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_SUB_IMAGE1D
, 7);
3641 n
[4].i
= (GLint
) width
;
3649 if (ctx
->ExecuteFlag
) {
3650 CALL_TexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
, width
,
3651 format
, type
, pixels
));
3656 static void GLAPIENTRY
3657 save_TexSubImage2D(GLenum target
, GLint level
,
3658 GLint xoffset
, GLint yoffset
,
3659 GLsizei width
, GLsizei height
,
3660 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3662 GET_CURRENT_CONTEXT(ctx
);
3664 GLvoid
*image
= unpack_image(2, width
, height
, 1, format
, type
,
3665 pixels
, &ctx
->Unpack
);
3666 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3667 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_SUB_IMAGE2D
, 9);
3673 n
[5].i
= (GLint
) width
;
3674 n
[6].i
= (GLint
) height
;
3682 if (ctx
->ExecuteFlag
) {
3683 CALL_TexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
3684 width
, height
, format
, type
, pixels
));
3689 static void GLAPIENTRY
3690 save_TexSubImage3D(GLenum target
, GLint level
,
3691 GLint xoffset
, GLint yoffset
, GLint zoffset
,
3692 GLsizei width
, GLsizei height
, GLsizei depth
,
3693 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3695 GET_CURRENT_CONTEXT(ctx
);
3697 GLvoid
*image
= unpack_image(3, width
, height
, depth
, format
, type
,
3698 pixels
, &ctx
->Unpack
);
3699 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3700 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_SUB_IMAGE3D
, 11);
3707 n
[6].i
= (GLint
) width
;
3708 n
[7].i
= (GLint
) height
;
3709 n
[8].i
= (GLint
) depth
;
3717 if (ctx
->ExecuteFlag
) {
3718 CALL_TexSubImage3D(ctx
->Exec
, (target
, level
,
3719 xoffset
, yoffset
, zoffset
,
3720 width
, height
, depth
, format
, type
,
3726 static void GLAPIENTRY
3727 save_Translatef(GLfloat x
, GLfloat y
, GLfloat z
)
3729 GET_CURRENT_CONTEXT(ctx
);
3731 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3732 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TRANSLATE
, 3);
3738 if (ctx
->ExecuteFlag
) {
3739 CALL_Translatef(ctx
->Exec
, (x
, y
, z
));
3744 static void GLAPIENTRY
3745 save_Translated(GLdouble x
, GLdouble y
, GLdouble z
)
3747 save_Translatef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3752 static void GLAPIENTRY
3753 save_Viewport(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3755 GET_CURRENT_CONTEXT(ctx
);
3757 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3758 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_VIEWPORT
, 4);
3762 n
[3].i
= (GLint
) width
;
3763 n
[4].i
= (GLint
) height
;
3765 if (ctx
->ExecuteFlag
) {
3766 CALL_Viewport(ctx
->Exec
, (x
, y
, width
, height
));
3771 static void GLAPIENTRY
3772 save_WindowPos4fMESA(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3774 GET_CURRENT_CONTEXT(ctx
);
3776 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3777 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_WINDOW_POS
, 4);
3784 if (ctx
->ExecuteFlag
) {
3785 CALL_WindowPos4fMESA(ctx
->Exec
, (x
, y
, z
, w
));
3789 static void GLAPIENTRY
3790 save_WindowPos2dMESA(GLdouble x
, GLdouble y
)
3792 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3795 static void GLAPIENTRY
3796 save_WindowPos2fMESA(GLfloat x
, GLfloat y
)
3798 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3801 static void GLAPIENTRY
3802 save_WindowPos2iMESA(GLint x
, GLint y
)
3804 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3807 static void GLAPIENTRY
3808 save_WindowPos2sMESA(GLshort x
, GLshort y
)
3810 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3813 static void GLAPIENTRY
3814 save_WindowPos3dMESA(GLdouble x
, GLdouble y
, GLdouble z
)
3816 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3819 static void GLAPIENTRY
3820 save_WindowPos3fMESA(GLfloat x
, GLfloat y
, GLfloat z
)
3822 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3825 static void GLAPIENTRY
3826 save_WindowPos3iMESA(GLint x
, GLint y
, GLint z
)
3828 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3831 static void GLAPIENTRY
3832 save_WindowPos3sMESA(GLshort x
, GLshort y
, GLshort z
)
3834 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3837 static void GLAPIENTRY
3838 save_WindowPos4dMESA(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3840 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3843 static void GLAPIENTRY
3844 save_WindowPos4iMESA(GLint x
, GLint y
, GLint z
, GLint w
)
3846 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3849 static void GLAPIENTRY
3850 save_WindowPos4sMESA(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
3852 save_WindowPos4fMESA(x
, y
, z
, w
);
3855 static void GLAPIENTRY
3856 save_WindowPos2dvMESA(const GLdouble
* v
)
3858 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3861 static void GLAPIENTRY
3862 save_WindowPos2fvMESA(const GLfloat
* v
)
3864 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3867 static void GLAPIENTRY
3868 save_WindowPos2ivMESA(const GLint
* v
)
3870 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3873 static void GLAPIENTRY
3874 save_WindowPos2svMESA(const GLshort
* v
)
3876 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3879 static void GLAPIENTRY
3880 save_WindowPos3dvMESA(const GLdouble
* v
)
3882 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3885 static void GLAPIENTRY
3886 save_WindowPos3fvMESA(const GLfloat
* v
)
3888 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3891 static void GLAPIENTRY
3892 save_WindowPos3ivMESA(const GLint
* v
)
3894 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3897 static void GLAPIENTRY
3898 save_WindowPos3svMESA(const GLshort
* v
)
3900 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3903 static void GLAPIENTRY
3904 save_WindowPos4dvMESA(const GLdouble
* v
)
3906 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
3907 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3910 static void GLAPIENTRY
3911 save_WindowPos4fvMESA(const GLfloat
* v
)
3913 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3916 static void GLAPIENTRY
3917 save_WindowPos4ivMESA(const GLint
* v
)
3919 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
3920 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3923 static void GLAPIENTRY
3924 save_WindowPos4svMESA(const GLshort
* v
)
3926 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3931 /* GL_ARB_multitexture */
3932 static void GLAPIENTRY
3933 save_ActiveTextureARB(GLenum target
)
3935 GET_CURRENT_CONTEXT(ctx
);
3937 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3938 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ACTIVE_TEXTURE
, 1);
3942 if (ctx
->ExecuteFlag
) {
3943 CALL_ActiveTextureARB(ctx
->Exec
, (target
));
3948 /* GL_ARB_transpose_matrix */
3950 static void GLAPIENTRY
3951 save_LoadTransposeMatrixdARB(const GLdouble m
[16])
3954 _math_transposefd(tm
, m
);
3955 save_LoadMatrixf(tm
);
3959 static void GLAPIENTRY
3960 save_LoadTransposeMatrixfARB(const GLfloat m
[16])
3963 _math_transposef(tm
, m
);
3964 save_LoadMatrixf(tm
);
3968 static void GLAPIENTRY
3969 save_MultTransposeMatrixdARB(const GLdouble m
[16])
3972 _math_transposefd(tm
, m
);
3973 save_MultMatrixf(tm
);
3977 static void GLAPIENTRY
3978 save_MultTransposeMatrixfARB(const GLfloat m
[16])
3981 _math_transposef(tm
, m
);
3982 save_MultMatrixf(tm
);
3986 /* GL_ARB_texture_compression */
3987 static void GLAPIENTRY
3988 save_CompressedTexImage1DARB(GLenum target
, GLint level
,
3989 GLenum internalFormat
, GLsizei width
,
3990 GLint border
, GLsizei imageSize
,
3991 const GLvoid
* data
)
3993 GET_CURRENT_CONTEXT(ctx
);
3994 if (target
== GL_PROXY_TEXTURE_1D
) {
3995 /* don't compile, execute immediately */
3996 CALL_CompressedTexImage1DARB(ctx
->Exec
, (target
, level
, internalFormat
,
3997 width
, border
, imageSize
,
4003 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4004 /* make copy of image */
4005 image
= _mesa_malloc(imageSize
);
4007 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage1DARB");
4010 MEMCPY(image
, data
, imageSize
);
4011 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_1D
, 7);
4015 n
[3].e
= internalFormat
;
4016 n
[4].i
= (GLint
) width
;
4024 if (ctx
->ExecuteFlag
) {
4025 CALL_CompressedTexImage1DARB(ctx
->Exec
,
4026 (target
, level
, internalFormat
, width
,
4027 border
, imageSize
, data
));
4033 static void GLAPIENTRY
4034 save_CompressedTexImage2DARB(GLenum target
, GLint level
,
4035 GLenum internalFormat
, GLsizei width
,
4036 GLsizei height
, GLint border
, GLsizei imageSize
,
4037 const GLvoid
* data
)
4039 GET_CURRENT_CONTEXT(ctx
);
4040 if (target
== GL_PROXY_TEXTURE_2D
) {
4041 /* don't compile, execute immediately */
4042 CALL_CompressedTexImage2DARB(ctx
->Exec
, (target
, level
, internalFormat
,
4043 width
, height
, border
,
4049 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4050 /* make copy of image */
4051 image
= _mesa_malloc(imageSize
);
4053 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage2DARB");
4056 MEMCPY(image
, data
, imageSize
);
4057 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_2D
, 8);
4061 n
[3].e
= internalFormat
;
4062 n
[4].i
= (GLint
) width
;
4063 n
[5].i
= (GLint
) height
;
4071 if (ctx
->ExecuteFlag
) {
4072 CALL_CompressedTexImage2DARB(ctx
->Exec
,
4073 (target
, level
, internalFormat
, width
,
4074 height
, border
, imageSize
, data
));
4080 static void GLAPIENTRY
4081 save_CompressedTexImage3DARB(GLenum target
, GLint level
,
4082 GLenum internalFormat
, GLsizei width
,
4083 GLsizei height
, GLsizei depth
, GLint border
,
4084 GLsizei imageSize
, const GLvoid
* data
)
4086 GET_CURRENT_CONTEXT(ctx
);
4087 if (target
== GL_PROXY_TEXTURE_3D
) {
4088 /* don't compile, execute immediately */
4089 CALL_CompressedTexImage3DARB(ctx
->Exec
, (target
, level
, internalFormat
,
4090 width
, height
, depth
, border
,
4096 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4097 /* make copy of image */
4098 image
= _mesa_malloc(imageSize
);
4100 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage3DARB");
4103 MEMCPY(image
, data
, imageSize
);
4104 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_3D
, 9);
4108 n
[3].e
= internalFormat
;
4109 n
[4].i
= (GLint
) width
;
4110 n
[5].i
= (GLint
) height
;
4111 n
[6].i
= (GLint
) depth
;
4119 if (ctx
->ExecuteFlag
) {
4120 CALL_CompressedTexImage3DARB(ctx
->Exec
,
4121 (target
, level
, internalFormat
, width
,
4122 height
, depth
, border
, imageSize
,
4129 static void GLAPIENTRY
4130 save_CompressedTexSubImage1DARB(GLenum target
, GLint level
, GLint xoffset
,
4131 GLsizei width
, GLenum format
,
4132 GLsizei imageSize
, const GLvoid
* data
)
4137 GET_CURRENT_CONTEXT(ctx
);
4138 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4140 /* make copy of image */
4141 image
= _mesa_malloc(imageSize
);
4143 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage1DARB");
4146 MEMCPY(image
, data
, imageSize
);
4147 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
, 7);
4152 n
[4].i
= (GLint
) width
;
4160 if (ctx
->ExecuteFlag
) {
4161 CALL_CompressedTexSubImage1DARB(ctx
->Exec
, (target
, level
, xoffset
,
4162 width
, format
, imageSize
,
4168 static void GLAPIENTRY
4169 save_CompressedTexSubImage2DARB(GLenum target
, GLint level
, GLint xoffset
,
4170 GLint yoffset
, GLsizei width
, GLsizei height
,
4171 GLenum format
, GLsizei imageSize
,
4172 const GLvoid
* data
)
4177 GET_CURRENT_CONTEXT(ctx
);
4178 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4180 /* make copy of image */
4181 image
= _mesa_malloc(imageSize
);
4183 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage2DARB");
4186 MEMCPY(image
, data
, imageSize
);
4187 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
, 9);
4193 n
[5].i
= (GLint
) width
;
4194 n
[6].i
= (GLint
) height
;
4202 if (ctx
->ExecuteFlag
) {
4203 CALL_CompressedTexSubImage2DARB(ctx
->Exec
,
4204 (target
, level
, xoffset
, yoffset
, width
,
4205 height
, format
, imageSize
, data
));
4210 static void GLAPIENTRY
4211 save_CompressedTexSubImage3DARB(GLenum target
, GLint level
, GLint xoffset
,
4212 GLint yoffset
, GLint zoffset
, GLsizei width
,
4213 GLsizei height
, GLsizei depth
, GLenum format
,
4214 GLsizei imageSize
, const GLvoid
* data
)
4219 GET_CURRENT_CONTEXT(ctx
);
4220 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4222 /* make copy of image */
4223 image
= _mesa_malloc(imageSize
);
4225 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage3DARB");
4228 MEMCPY(image
, data
, imageSize
);
4229 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
, 11);
4236 n
[6].i
= (GLint
) width
;
4237 n
[7].i
= (GLint
) height
;
4238 n
[8].i
= (GLint
) depth
;
4240 n
[10].i
= imageSize
;
4246 if (ctx
->ExecuteFlag
) {
4247 CALL_CompressedTexSubImage3DARB(ctx
->Exec
,
4248 (target
, level
, xoffset
, yoffset
,
4249 zoffset
, width
, height
, depth
, format
,
4255 /* GL_ARB_multisample */
4256 static void GLAPIENTRY
4257 save_SampleCoverageARB(GLclampf value
, GLboolean invert
)
4259 GET_CURRENT_CONTEXT(ctx
);
4261 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4262 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SAMPLE_COVERAGE
, 2);
4267 if (ctx
->ExecuteFlag
) {
4268 CALL_SampleCoverageARB(ctx
->Exec
, (value
, invert
));
4274 * GL_NV_vertex_program
4276 #if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
4277 static void GLAPIENTRY
4278 save_BindProgramNV(GLenum target
, GLuint id
)
4280 GET_CURRENT_CONTEXT(ctx
);
4282 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4283 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BIND_PROGRAM_NV
, 2);
4288 if (ctx
->ExecuteFlag
) {
4289 CALL_BindProgramNV(ctx
->Exec
, (target
, id
));
4293 static void GLAPIENTRY
4294 save_ProgramEnvParameter4fARB(GLenum target
, GLuint index
,
4295 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4297 GET_CURRENT_CONTEXT(ctx
);
4299 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4300 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4309 if (ctx
->ExecuteFlag
) {
4310 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4315 static void GLAPIENTRY
4316 save_ProgramEnvParameter4fvARB(GLenum target
, GLuint index
,
4317 const GLfloat
*params
)
4319 save_ProgramEnvParameter4fARB(target
, index
, params
[0], params
[1],
4320 params
[2], params
[3]);
4324 static void GLAPIENTRY
4325 save_ProgramEnvParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4326 const GLfloat
* params
)
4328 GET_CURRENT_CONTEXT(ctx
);
4330 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4334 const GLfloat
* p
= params
;
4336 for (i
= 0 ; i
< count
; i
++) {
4337 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4350 if (ctx
->ExecuteFlag
) {
4351 CALL_ProgramEnvParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4356 static void GLAPIENTRY
4357 save_ProgramEnvParameter4dARB(GLenum target
, GLuint index
,
4358 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4360 save_ProgramEnvParameter4fARB(target
, index
,
4362 (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4366 static void GLAPIENTRY
4367 save_ProgramEnvParameter4dvARB(GLenum target
, GLuint index
,
4368 const GLdouble
*params
)
4370 save_ProgramEnvParameter4fARB(target
, index
,
4371 (GLfloat
) params
[0],
4372 (GLfloat
) params
[1],
4373 (GLfloat
) params
[2], (GLfloat
) params
[3]);
4376 #endif /* FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program || FEATURE_NV_vertex_program */
4378 #if FEATURE_NV_vertex_program
4379 static void GLAPIENTRY
4380 save_ExecuteProgramNV(GLenum target
, GLuint id
, const GLfloat
*params
)
4382 GET_CURRENT_CONTEXT(ctx
);
4384 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4385 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EXECUTE_PROGRAM_NV
, 6);
4394 if (ctx
->ExecuteFlag
) {
4395 CALL_ExecuteProgramNV(ctx
->Exec
, (target
, id
, params
));
4400 static void GLAPIENTRY
4401 save_ProgramParameters4dvNV(GLenum target
, GLuint index
,
4402 GLuint num
, const GLdouble
*params
)
4405 for (i
= 0; i
< num
; i
++) {
4406 save_ProgramEnvParameter4dvARB(target
, index
+ i
, params
+ 4 * i
);
4411 static void GLAPIENTRY
4412 save_ProgramParameters4fvNV(GLenum target
, GLuint index
,
4413 GLuint num
, const GLfloat
*params
)
4416 for (i
= 0; i
< num
; i
++) {
4417 save_ProgramEnvParameter4fvARB(target
, index
+ i
, params
+ 4 * i
);
4422 static void GLAPIENTRY
4423 save_LoadProgramNV(GLenum target
, GLuint id
, GLsizei len
,
4424 const GLubyte
* program
)
4426 GET_CURRENT_CONTEXT(ctx
);
4428 GLubyte
*programCopy
;
4430 programCopy
= (GLubyte
*) _mesa_malloc(len
);
4432 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glLoadProgramNV");
4435 _mesa_memcpy(programCopy
, program
, len
);
4437 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4438 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LOAD_PROGRAM_NV
, 4);
4443 n
[4].data
= programCopy
;
4445 if (ctx
->ExecuteFlag
) {
4446 CALL_LoadProgramNV(ctx
->Exec
, (target
, id
, len
, program
));
4451 static void GLAPIENTRY
4452 save_RequestResidentProgramsNV(GLsizei num
, const GLuint
* ids
)
4454 GET_CURRENT_CONTEXT(ctx
);
4456 GLuint
*idCopy
= (GLuint
*) _mesa_malloc(num
* sizeof(GLuint
));
4458 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glRequestResidentProgramsNV");
4461 _mesa_memcpy(idCopy
, ids
, num
* sizeof(GLuint
));
4462 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4463 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TRACK_MATRIX_NV
, 2);
4468 if (ctx
->ExecuteFlag
) {
4469 CALL_RequestResidentProgramsNV(ctx
->Exec
, (num
, ids
));
4474 static void GLAPIENTRY
4475 save_TrackMatrixNV(GLenum target
, GLuint address
,
4476 GLenum matrix
, GLenum transform
)
4478 GET_CURRENT_CONTEXT(ctx
);
4480 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4481 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TRACK_MATRIX_NV
, 4);
4488 if (ctx
->ExecuteFlag
) {
4489 CALL_TrackMatrixNV(ctx
->Exec
, (target
, address
, matrix
, transform
));
4492 #endif /* FEATURE_NV_vertex_program */
4496 * GL_NV_fragment_program
4498 #if FEATURE_NV_fragment_program
4499 static void GLAPIENTRY
4500 save_ProgramLocalParameter4fARB(GLenum target
, GLuint index
,
4501 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4503 GET_CURRENT_CONTEXT(ctx
);
4505 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4506 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4515 if (ctx
->ExecuteFlag
) {
4516 CALL_ProgramLocalParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4521 static void GLAPIENTRY
4522 save_ProgramLocalParameter4fvARB(GLenum target
, GLuint index
,
4523 const GLfloat
*params
)
4525 GET_CURRENT_CONTEXT(ctx
);
4527 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4528 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4537 if (ctx
->ExecuteFlag
) {
4538 CALL_ProgramLocalParameter4fvARB(ctx
->Exec
, (target
, index
, params
));
4543 static void GLAPIENTRY
4544 save_ProgramLocalParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4545 const GLfloat
*params
)
4547 GET_CURRENT_CONTEXT(ctx
);
4549 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4553 const GLfloat
* p
= params
;
4555 for (i
= 0 ; i
< count
; i
++) {
4556 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4569 if (ctx
->ExecuteFlag
) {
4570 CALL_ProgramLocalParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4575 static void GLAPIENTRY
4576 save_ProgramLocalParameter4dARB(GLenum target
, GLuint index
,
4577 GLdouble x
, GLdouble y
,
4578 GLdouble z
, GLdouble w
)
4580 GET_CURRENT_CONTEXT(ctx
);
4582 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4583 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4587 n
[3].f
= (GLfloat
) x
;
4588 n
[4].f
= (GLfloat
) y
;
4589 n
[5].f
= (GLfloat
) z
;
4590 n
[6].f
= (GLfloat
) w
;
4592 if (ctx
->ExecuteFlag
) {
4593 CALL_ProgramLocalParameter4dARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4598 static void GLAPIENTRY
4599 save_ProgramLocalParameter4dvARB(GLenum target
, GLuint index
,
4600 const GLdouble
*params
)
4602 GET_CURRENT_CONTEXT(ctx
);
4604 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4605 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4609 n
[3].f
= (GLfloat
) params
[0];
4610 n
[4].f
= (GLfloat
) params
[1];
4611 n
[5].f
= (GLfloat
) params
[2];
4612 n
[6].f
= (GLfloat
) params
[3];
4614 if (ctx
->ExecuteFlag
) {
4615 CALL_ProgramLocalParameter4dvARB(ctx
->Exec
, (target
, index
, params
));
4619 static void GLAPIENTRY
4620 save_ProgramNamedParameter4fNV(GLuint id
, GLsizei len
, const GLubyte
* name
,
4621 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4623 GET_CURRENT_CONTEXT(ctx
);
4625 GLubyte
*nameCopy
= (GLubyte
*) _mesa_malloc(len
);
4627 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramNamedParameter4fNV");
4630 _mesa_memcpy(nameCopy
, name
, len
);
4632 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4633 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_NAMED_PARAMETER_NV
, 6);
4637 n
[3].data
= nameCopy
;
4643 if (ctx
->ExecuteFlag
) {
4644 CALL_ProgramNamedParameter4fNV(ctx
->Exec
, (id
, len
, name
, x
, y
, z
, w
));
4649 static void GLAPIENTRY
4650 save_ProgramNamedParameter4fvNV(GLuint id
, GLsizei len
, const GLubyte
* name
,
4653 save_ProgramNamedParameter4fNV(id
, len
, name
, v
[0], v
[1], v
[2], v
[3]);
4657 static void GLAPIENTRY
4658 save_ProgramNamedParameter4dNV(GLuint id
, GLsizei len
, const GLubyte
* name
,
4659 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4661 save_ProgramNamedParameter4fNV(id
, len
, name
, (GLfloat
) x
, (GLfloat
) y
,
4662 (GLfloat
) z
, (GLfloat
) w
);
4666 static void GLAPIENTRY
4667 save_ProgramNamedParameter4dvNV(GLuint id
, GLsizei len
, const GLubyte
* name
,
4670 save_ProgramNamedParameter4fNV(id
, len
, name
, (GLfloat
) v
[0],
4671 (GLfloat
) v
[1], (GLfloat
) v
[2],
4675 #endif /* FEATURE_NV_fragment_program */
4679 /* GL_EXT_stencil_two_side */
4680 static void GLAPIENTRY
4681 save_ActiveStencilFaceEXT(GLenum face
)
4683 GET_CURRENT_CONTEXT(ctx
);
4685 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4686 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ACTIVE_STENCIL_FACE_EXT
, 1);
4690 if (ctx
->ExecuteFlag
) {
4691 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (face
));
4696 /* GL_EXT_depth_bounds_test */
4697 static void GLAPIENTRY
4698 save_DepthBoundsEXT(GLclampd zmin
, GLclampd zmax
)
4700 GET_CURRENT_CONTEXT(ctx
);
4702 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4703 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DEPTH_BOUNDS_EXT
, 2);
4705 n
[1].f
= (GLfloat
) zmin
;
4706 n
[2].f
= (GLfloat
) zmax
;
4708 if (ctx
->ExecuteFlag
) {
4709 CALL_DepthBoundsEXT(ctx
->Exec
, (zmin
, zmax
));
4715 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
4717 static void GLAPIENTRY
4718 save_ProgramStringARB(GLenum target
, GLenum format
, GLsizei len
,
4719 const GLvoid
* string
)
4721 GET_CURRENT_CONTEXT(ctx
);
4723 GLubyte
*programCopy
;
4725 programCopy
= (GLubyte
*) _mesa_malloc(len
);
4727 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramStringARB");
4730 _mesa_memcpy(programCopy
, string
, len
);
4732 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4733 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_STRING_ARB
, 4);
4738 n
[4].data
= programCopy
;
4740 if (ctx
->ExecuteFlag
) {
4741 CALL_ProgramStringARB(ctx
->Exec
, (target
, format
, len
, string
));
4745 #endif /* FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program */
4748 #if FEATURE_ARB_occlusion_query
4750 static void GLAPIENTRY
4751 save_BeginQueryARB(GLenum target
, GLuint id
)
4753 GET_CURRENT_CONTEXT(ctx
);
4755 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4756 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BEGIN_QUERY_ARB
, 2);
4761 if (ctx
->ExecuteFlag
) {
4762 CALL_BeginQueryARB(ctx
->Exec
, (target
, id
));
4767 static void GLAPIENTRY
4768 save_EndQueryARB(GLenum target
)
4770 GET_CURRENT_CONTEXT(ctx
);
4772 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4773 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_END_QUERY_ARB
, 1);
4777 if (ctx
->ExecuteFlag
) {
4778 CALL_EndQueryARB(ctx
->Exec
, (target
));
4782 #endif /* FEATURE_ARB_occlusion_query */
4785 static void GLAPIENTRY
4786 save_DrawBuffersARB(GLsizei count
, const GLenum
* buffers
)
4788 GET_CURRENT_CONTEXT(ctx
);
4790 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4791 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DRAW_BUFFERS_ARB
, 1 + MAX_DRAW_BUFFERS
);
4795 if (count
> MAX_DRAW_BUFFERS
)
4796 count
= MAX_DRAW_BUFFERS
;
4797 for (i
= 0; i
< count
; i
++) {
4798 n
[2 + i
].e
= buffers
[i
];
4801 if (ctx
->ExecuteFlag
) {
4802 CALL_DrawBuffersARB(ctx
->Exec
, (count
, buffers
));
4806 #if FEATURE_ATI_fragment_shader
4807 static void GLAPIENTRY
4808 save_BindFragmentShaderATI(GLuint id
)
4810 GET_CURRENT_CONTEXT(ctx
);
4813 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BIND_FRAGMENT_SHADER_ATI
, 1);
4817 if (ctx
->ExecuteFlag
) {
4818 CALL_BindFragmentShaderATI(ctx
->Exec
, (id
));
4822 static void GLAPIENTRY
4823 save_SetFragmentShaderConstantATI(GLuint dst
, const GLfloat
*value
)
4825 GET_CURRENT_CONTEXT(ctx
);
4828 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
, 5);
4836 if (ctx
->ExecuteFlag
) {
4837 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, value
));
4843 save_Attr1fNV(GLenum attr
, GLfloat x
)
4845 GET_CURRENT_CONTEXT(ctx
);
4847 SAVE_FLUSH_VERTICES(ctx
);
4848 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_1F_NV
, 2);
4854 ASSERT(attr
< MAX_VERTEX_PROGRAM_ATTRIBS
);
4855 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
4856 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
4858 if (ctx
->ExecuteFlag
) {
4859 CALL_VertexAttrib1fNV(ctx
->Exec
, (attr
, x
));
4864 save_Attr2fNV(GLenum attr
, GLfloat x
, GLfloat y
)
4866 GET_CURRENT_CONTEXT(ctx
);
4868 SAVE_FLUSH_VERTICES(ctx
);
4869 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_2F_NV
, 3);
4876 ASSERT(attr
< MAX_VERTEX_PROGRAM_ATTRIBS
);
4877 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
4878 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
4880 if (ctx
->ExecuteFlag
) {
4881 CALL_VertexAttrib2fNV(ctx
->Exec
, (attr
, x
, y
));
4886 save_Attr3fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
4888 GET_CURRENT_CONTEXT(ctx
);
4890 SAVE_FLUSH_VERTICES(ctx
);
4891 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_3F_NV
, 4);
4899 ASSERT(attr
< MAX_VERTEX_PROGRAM_ATTRIBS
);
4900 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
4901 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
4903 if (ctx
->ExecuteFlag
) {
4904 CALL_VertexAttrib3fNV(ctx
->Exec
, (attr
, x
, y
, z
));
4909 save_Attr4fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4911 GET_CURRENT_CONTEXT(ctx
);
4913 SAVE_FLUSH_VERTICES(ctx
);
4914 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_4F_NV
, 5);
4923 ASSERT(attr
< MAX_VERTEX_PROGRAM_ATTRIBS
);
4924 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
4925 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
4927 if (ctx
->ExecuteFlag
) {
4928 CALL_VertexAttrib4fNV(ctx
->Exec
, (attr
, x
, y
, z
, w
));
4934 save_Attr1fARB(GLenum attr
, GLfloat x
)
4936 GET_CURRENT_CONTEXT(ctx
);
4938 SAVE_FLUSH_VERTICES(ctx
);
4939 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_1F_ARB
, 2);
4945 ASSERT(attr
< MAX_VERTEX_ATTRIBS
);
4946 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
4947 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
4949 if (ctx
->ExecuteFlag
) {
4950 CALL_VertexAttrib1fARB(ctx
->Exec
, (attr
, x
));
4955 save_Attr2fARB(GLenum attr
, GLfloat x
, GLfloat y
)
4957 GET_CURRENT_CONTEXT(ctx
);
4959 SAVE_FLUSH_VERTICES(ctx
);
4960 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_2F_ARB
, 3);
4967 ASSERT(attr
< MAX_VERTEX_ATTRIBS
);
4968 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
4969 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
4971 if (ctx
->ExecuteFlag
) {
4972 CALL_VertexAttrib2fARB(ctx
->Exec
, (attr
, x
, y
));
4977 save_Attr3fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
4979 GET_CURRENT_CONTEXT(ctx
);
4981 SAVE_FLUSH_VERTICES(ctx
);
4982 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_3F_ARB
, 4);
4990 ASSERT(attr
< MAX_VERTEX_ATTRIBS
);
4991 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
4992 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
4994 if (ctx
->ExecuteFlag
) {
4995 CALL_VertexAttrib3fARB(ctx
->Exec
, (attr
, x
, y
, z
));
5000 save_Attr4fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5002 GET_CURRENT_CONTEXT(ctx
);
5004 SAVE_FLUSH_VERTICES(ctx
);
5005 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_4F_ARB
, 5);
5014 ASSERT(attr
< MAX_VERTEX_ATTRIBS
);
5015 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5016 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5018 if (ctx
->ExecuteFlag
) {
5019 CALL_VertexAttrib4fARB(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5024 static void GLAPIENTRY
5025 save_EvalCoord1f(GLfloat x
)
5027 GET_CURRENT_CONTEXT(ctx
);
5029 SAVE_FLUSH_VERTICES(ctx
);
5030 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVAL_C1
, 1);
5034 if (ctx
->ExecuteFlag
) {
5035 CALL_EvalCoord1f(ctx
->Exec
, (x
));
5039 static void GLAPIENTRY
5040 save_EvalCoord1fv(const GLfloat
* v
)
5042 save_EvalCoord1f(v
[0]);
5045 static void GLAPIENTRY
5046 save_EvalCoord2f(GLfloat x
, GLfloat y
)
5048 GET_CURRENT_CONTEXT(ctx
);
5050 SAVE_FLUSH_VERTICES(ctx
);
5051 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVAL_C2
, 2);
5056 if (ctx
->ExecuteFlag
) {
5057 CALL_EvalCoord2f(ctx
->Exec
, (x
, y
));
5061 static void GLAPIENTRY
5062 save_EvalCoord2fv(const GLfloat
* v
)
5064 save_EvalCoord2f(v
[0], v
[1]);
5068 static void GLAPIENTRY
5069 save_EvalPoint1(GLint x
)
5071 GET_CURRENT_CONTEXT(ctx
);
5073 SAVE_FLUSH_VERTICES(ctx
);
5074 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVAL_P1
, 1);
5078 if (ctx
->ExecuteFlag
) {
5079 CALL_EvalPoint1(ctx
->Exec
, (x
));
5083 static void GLAPIENTRY
5084 save_EvalPoint2(GLint x
, GLint y
)
5086 GET_CURRENT_CONTEXT(ctx
);
5088 SAVE_FLUSH_VERTICES(ctx
);
5089 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVAL_P2
, 2);
5094 if (ctx
->ExecuteFlag
) {
5095 CALL_EvalPoint2(ctx
->Exec
, (x
, y
));
5099 static void GLAPIENTRY
5100 save_Indexf(GLfloat x
)
5102 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, x
);
5105 static void GLAPIENTRY
5106 save_Indexfv(const GLfloat
* v
)
5108 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, v
[0]);
5111 static void GLAPIENTRY
5112 save_EdgeFlag(GLboolean x
)
5114 save_Attr1fNV(VERT_ATTRIB_EDGEFLAG
, x
? (GLfloat
)1.0 : (GLfloat
)0.0);
5117 static void GLAPIENTRY
5118 save_Materialfv(GLenum face
, GLenum pname
, const GLfloat
* param
)
5120 GET_CURRENT_CONTEXT(ctx
);
5124 SAVE_FLUSH_VERTICES(ctx
);
5129 case GL_FRONT_AND_BACK
:
5132 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "material(face)");
5141 case GL_AMBIENT_AND_DIFFUSE
:
5147 case GL_COLOR_INDEXES
:
5151 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "material(pname)");
5155 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MATERIAL
, 6);
5159 for (i
= 0; i
< args
; i
++)
5160 n
[3 + i
].f
= param
[i
];
5164 GLuint bitmask
= _mesa_material_bitmask(ctx
, face
, pname
, ~0, NULL
);
5165 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++)
5166 if (bitmask
& (1 << i
)) {
5167 ctx
->ListState
.ActiveMaterialSize
[i
] = args
;
5168 COPY_SZ_4V(ctx
->ListState
.CurrentMaterial
[i
], args
, param
);
5172 if (ctx
->ExecuteFlag
) {
5173 CALL_Materialfv(ctx
->Exec
, (face
, pname
, param
));
5177 static void GLAPIENTRY
5178 save_Begin(GLenum mode
)
5180 GET_CURRENT_CONTEXT(ctx
);
5182 GLboolean error
= GL_FALSE
;
5184 if ( /*mode < GL_POINTS || */ mode
> GL_POLYGON
) {
5185 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "Begin (mode)");
5188 else if (ctx
->Driver
.CurrentSavePrimitive
== PRIM_UNKNOWN
) {
5189 /* Typically the first begin. This may raise an error on
5190 * playback, depending on whether CallList is issued from inside
5191 * a begin/end or not.
5193 ctx
->Driver
.CurrentSavePrimitive
= PRIM_INSIDE_UNKNOWN_PRIM
;
5195 else if (ctx
->Driver
.CurrentSavePrimitive
== PRIM_OUTSIDE_BEGIN_END
) {
5196 ctx
->Driver
.CurrentSavePrimitive
= mode
;
5199 _mesa_compile_error(ctx
, GL_INVALID_OPERATION
, "recursive begin");
5204 /* Give the driver an opportunity to hook in an optimized
5205 * display list compiler.
5207 if (ctx
->Driver
.NotifySaveBegin(ctx
, mode
))
5210 SAVE_FLUSH_VERTICES(ctx
);
5211 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BEGIN
, 1);
5217 if (ctx
->ExecuteFlag
) {
5218 CALL_Begin(ctx
->Exec
, (mode
));
5222 static void GLAPIENTRY
5225 GET_CURRENT_CONTEXT(ctx
);
5226 SAVE_FLUSH_VERTICES(ctx
);
5227 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_END
, 0);
5228 ctx
->Driver
.CurrentSavePrimitive
= PRIM_OUTSIDE_BEGIN_END
;
5229 if (ctx
->ExecuteFlag
) {
5230 CALL_End(ctx
->Exec
, ());
5234 static void GLAPIENTRY
5235 save_Rectf(GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
5237 GET_CURRENT_CONTEXT(ctx
);
5239 SAVE_FLUSH_VERTICES(ctx
);
5240 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_RECTF
, 4);
5247 if (ctx
->ExecuteFlag
) {
5248 CALL_Rectf(ctx
->Exec
, (a
, b
, c
, d
));
5253 static void GLAPIENTRY
5254 save_Vertex2f(GLfloat x
, GLfloat y
)
5256 save_Attr2fNV(VERT_ATTRIB_POS
, x
, y
);
5259 static void GLAPIENTRY
5260 save_Vertex2fv(const GLfloat
* v
)
5262 save_Attr2fNV(VERT_ATTRIB_POS
, v
[0], v
[1]);
5265 static void GLAPIENTRY
5266 save_Vertex3f(GLfloat x
, GLfloat y
, GLfloat z
)
5268 save_Attr3fNV(VERT_ATTRIB_POS
, x
, y
, z
);
5271 static void GLAPIENTRY
5272 save_Vertex3fv(const GLfloat
* v
)
5274 save_Attr3fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2]);
5277 static void GLAPIENTRY
5278 save_Vertex4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5280 save_Attr4fNV(VERT_ATTRIB_POS
, x
, y
, z
, w
);
5283 static void GLAPIENTRY
5284 save_Vertex4fv(const GLfloat
* v
)
5286 save_Attr4fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2], v
[3]);
5289 static void GLAPIENTRY
5290 save_TexCoord1f(GLfloat x
)
5292 save_Attr1fNV(VERT_ATTRIB_TEX0
, x
);
5295 static void GLAPIENTRY
5296 save_TexCoord1fv(const GLfloat
* v
)
5298 save_Attr1fNV(VERT_ATTRIB_TEX0
, v
[0]);
5301 static void GLAPIENTRY
5302 save_TexCoord2f(GLfloat x
, GLfloat y
)
5304 save_Attr2fNV(VERT_ATTRIB_TEX0
, x
, y
);
5307 static void GLAPIENTRY
5308 save_TexCoord2fv(const GLfloat
* v
)
5310 save_Attr2fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1]);
5313 static void GLAPIENTRY
5314 save_TexCoord3f(GLfloat x
, GLfloat y
, GLfloat z
)
5316 save_Attr3fNV(VERT_ATTRIB_TEX0
, x
, y
, z
);
5319 static void GLAPIENTRY
5320 save_TexCoord3fv(const GLfloat
* v
)
5322 save_Attr3fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2]);
5325 static void GLAPIENTRY
5326 save_TexCoord4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5328 save_Attr4fNV(VERT_ATTRIB_TEX0
, x
, y
, z
, w
);
5331 static void GLAPIENTRY
5332 save_TexCoord4fv(const GLfloat
* v
)
5334 save_Attr4fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2], v
[3]);
5337 static void GLAPIENTRY
5338 save_Normal3f(GLfloat x
, GLfloat y
, GLfloat z
)
5340 save_Attr3fNV(VERT_ATTRIB_NORMAL
, x
, y
, z
);
5343 static void GLAPIENTRY
5344 save_Normal3fv(const GLfloat
* v
)
5346 save_Attr3fNV(VERT_ATTRIB_NORMAL
, v
[0], v
[1], v
[2]);
5349 static void GLAPIENTRY
5350 save_FogCoordfEXT(GLfloat x
)
5352 save_Attr1fNV(VERT_ATTRIB_FOG
, x
);
5355 static void GLAPIENTRY
5356 save_FogCoordfvEXT(const GLfloat
* v
)
5358 save_Attr1fNV(VERT_ATTRIB_FOG
, v
[0]);
5361 static void GLAPIENTRY
5362 save_Color3f(GLfloat x
, GLfloat y
, GLfloat z
)
5364 save_Attr3fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
);
5367 static void GLAPIENTRY
5368 save_Color3fv(const GLfloat
* v
)
5370 save_Attr3fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2]);
5373 static void GLAPIENTRY
5374 save_Color4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5376 save_Attr4fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
, w
);
5379 static void GLAPIENTRY
5380 save_Color4fv(const GLfloat
* v
)
5382 save_Attr4fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2], v
[3]);
5385 static void GLAPIENTRY
5386 save_SecondaryColor3fEXT(GLfloat x
, GLfloat y
, GLfloat z
)
5388 save_Attr3fNV(VERT_ATTRIB_COLOR1
, x
, y
, z
);
5391 static void GLAPIENTRY
5392 save_SecondaryColor3fvEXT(const GLfloat
* v
)
5394 save_Attr3fNV(VERT_ATTRIB_COLOR1
, v
[0], v
[1], v
[2]);
5398 /* Just call the respective ATTR for texcoord
5400 static void GLAPIENTRY
5401 save_MultiTexCoord1f(GLenum target
, GLfloat x
)
5403 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5404 save_Attr1fNV(attr
, x
);
5407 static void GLAPIENTRY
5408 save_MultiTexCoord1fv(GLenum target
, const GLfloat
* v
)
5410 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5411 save_Attr1fNV(attr
, v
[0]);
5414 static void GLAPIENTRY
5415 save_MultiTexCoord2f(GLenum target
, GLfloat x
, GLfloat y
)
5417 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5418 save_Attr2fNV(attr
, x
, y
);
5421 static void GLAPIENTRY
5422 save_MultiTexCoord2fv(GLenum target
, const GLfloat
* v
)
5424 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5425 save_Attr2fNV(attr
, v
[0], v
[1]);
5428 static void GLAPIENTRY
5429 save_MultiTexCoord3f(GLenum target
, GLfloat x
, GLfloat y
, GLfloat z
)
5431 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5432 save_Attr3fNV(attr
, x
, y
, z
);
5435 static void GLAPIENTRY
5436 save_MultiTexCoord3fv(GLenum target
, const GLfloat
* v
)
5438 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5439 save_Attr3fNV(attr
, v
[0], v
[1], v
[2]);
5442 static void GLAPIENTRY
5443 save_MultiTexCoord4f(GLenum target
, GLfloat x
, GLfloat y
,
5444 GLfloat z
, GLfloat w
)
5446 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5447 save_Attr4fNV(attr
, x
, y
, z
, w
);
5450 static void GLAPIENTRY
5451 save_MultiTexCoord4fv(GLenum target
, const GLfloat
* v
)
5453 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5454 save_Attr4fNV(attr
, v
[0], v
[1], v
[2], v
[3]);
5459 * Record a GL_INVALID_VALUE error when a invalid vertex attribute
5465 GET_CURRENT_CONTEXT(ctx
);
5466 _mesa_error(ctx
, GL_INVALID_VALUE
, "VertexAttribf(index)");
5470 /* First level for NV_vertex_program:
5472 * Check for errors at compile time?.
5474 static void GLAPIENTRY
5475 save_VertexAttrib1fNV(GLuint index
, GLfloat x
)
5477 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5478 save_Attr1fNV(index
, x
);
5483 static void GLAPIENTRY
5484 save_VertexAttrib1fvNV(GLuint index
, const GLfloat
* v
)
5486 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5487 save_Attr1fNV(index
, v
[0]);
5492 static void GLAPIENTRY
5493 save_VertexAttrib2fNV(GLuint index
, GLfloat x
, GLfloat y
)
5495 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5496 save_Attr2fNV(index
, x
, y
);
5501 static void GLAPIENTRY
5502 save_VertexAttrib2fvNV(GLuint index
, const GLfloat
* v
)
5504 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5505 save_Attr2fNV(index
, v
[0], v
[1]);
5510 static void GLAPIENTRY
5511 save_VertexAttrib3fNV(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
5513 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5514 save_Attr3fNV(index
, x
, y
, z
);
5519 static void GLAPIENTRY
5520 save_VertexAttrib3fvNV(GLuint index
, const GLfloat
* v
)
5522 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5523 save_Attr3fNV(index
, v
[0], v
[1], v
[2]);
5528 static void GLAPIENTRY
5529 save_VertexAttrib4fNV(GLuint index
, GLfloat x
, GLfloat y
,
5530 GLfloat z
, GLfloat w
)
5532 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5533 save_Attr4fNV(index
, x
, y
, z
, w
);
5538 static void GLAPIENTRY
5539 save_VertexAttrib4fvNV(GLuint index
, const GLfloat
* v
)
5541 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5542 save_Attr4fNV(index
, v
[0], v
[1], v
[2], v
[3]);
5550 static void GLAPIENTRY
5551 save_VertexAttrib1fARB(GLuint index
, GLfloat x
)
5553 if (index
< MAX_VERTEX_ATTRIBS
)
5554 save_Attr1fARB(index
, x
);
5559 static void GLAPIENTRY
5560 save_VertexAttrib1fvARB(GLuint index
, const GLfloat
* v
)
5562 if (index
< MAX_VERTEX_ATTRIBS
)
5563 save_Attr1fARB(index
, v
[0]);
5568 static void GLAPIENTRY
5569 save_VertexAttrib2fARB(GLuint index
, GLfloat x
, GLfloat y
)
5571 if (index
< MAX_VERTEX_ATTRIBS
)
5572 save_Attr2fARB(index
, x
, y
);
5577 static void GLAPIENTRY
5578 save_VertexAttrib2fvARB(GLuint index
, const GLfloat
* v
)
5580 if (index
< MAX_VERTEX_ATTRIBS
)
5581 save_Attr2fARB(index
, v
[0], v
[1]);
5586 static void GLAPIENTRY
5587 save_VertexAttrib3fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
5589 if (index
< MAX_VERTEX_ATTRIBS
)
5590 save_Attr3fARB(index
, x
, y
, z
);
5595 static void GLAPIENTRY
5596 save_VertexAttrib3fvARB(GLuint index
, const GLfloat
* v
)
5598 if (index
< MAX_VERTEX_ATTRIBS
)
5599 save_Attr3fARB(index
, v
[0], v
[1], v
[2]);
5604 static void GLAPIENTRY
5605 save_VertexAttrib4fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
,
5608 if (index
< MAX_VERTEX_ATTRIBS
)
5609 save_Attr4fARB(index
, x
, y
, z
, w
);
5614 static void GLAPIENTRY
5615 save_VertexAttrib4fvARB(GLuint index
, const GLfloat
* v
)
5617 if (index
< MAX_VERTEX_ATTRIBS
)
5618 save_Attr4fARB(index
, v
[0], v
[1], v
[2], v
[3]);
5624 /* GL_ARB_shader_objects, GL_ARB_vertex/fragment_shader */
5626 static void GLAPIENTRY
5627 exec_BindAttribLocationARB(GLuint program
, GLuint index
, const GLchar
*name
)
5629 GET_CURRENT_CONTEXT(ctx
);
5630 FLUSH_VERTICES(ctx
, 0);
5631 CALL_BindAttribLocationARB(ctx
->Exec
, (program
, index
, name
));
5634 static GLint GLAPIENTRY
5635 exec_GetAttribLocationARB(GLuint program
, const GLchar
*name
)
5637 GET_CURRENT_CONTEXT(ctx
);
5638 FLUSH_VERTICES(ctx
, 0);
5639 return CALL_GetAttribLocationARB(ctx
->Exec
, (program
, name
));
5641 /* XXX more shader functions needed here */
5645 #if FEATURE_EXT_framebuffer_blit
5646 static void GLAPIENTRY
5647 save_BlitFramebufferEXT(GLint srcX0
, GLint srcY0
, GLint srcX1
, GLint srcY1
,
5648 GLint dstX0
, GLint dstY0
, GLint dstX1
, GLint dstY1
,
5649 GLbitfield mask
, GLenum filter
)
5651 GET_CURRENT_CONTEXT(ctx
);
5653 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5654 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BLIT_FRAMEBUFFER
, 10);
5667 if (ctx
->ExecuteFlag
) {
5668 CALL_BlitFramebufferEXT(ctx
->Exec
, (srcX0
, srcY0
, srcX1
, srcY1
,
5669 dstX0
, dstY0
, dstX1
, dstY1
,
5677 * Save an error-generating command into display list.
5679 * KW: Will appear in the list before the vertex buffer containing the
5680 * command that provoked the error. I don't see this as a problem.
5683 save_error(GLcontext
*ctx
, GLenum error
, const char *s
)
5686 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ERROR
, 2);
5689 n
[2].data
= (void *) s
;
5695 * Compile an error into current display list.
5698 _mesa_compile_error(GLcontext
*ctx
, GLenum error
, const char *s
)
5700 if (ctx
->CompileFlag
)
5701 save_error(ctx
, error
, s
);
5702 if (ctx
->ExecuteFlag
)
5703 _mesa_error(ctx
, error
, s
);
5708 * Test if ID names a display list.
5711 islist(GLcontext
*ctx
, GLuint list
)
5713 if (list
> 0 && lookup_list(ctx
, list
)) {
5723 /**********************************************************************/
5724 /* Display list execution */
5725 /**********************************************************************/
5729 * Execute a display list. Note that the ListBase offset must have already
5730 * been added before calling this function. I.e. the list argument is
5731 * the absolute list number, not relative to ListBase.
5732 * \param list - display list number
5735 execute_list(GLcontext
*ctx
, GLuint list
)
5737 struct gl_display_list
*dlist
;
5741 if (list
== 0 || !islist(ctx
, list
))
5744 if (ctx
->ListState
.CallDepth
== MAX_LIST_NESTING
) {
5745 /* raise an error? */
5749 dlist
= lookup_list(ctx
, list
);
5753 ctx
->ListState
.CallDepth
++;
5755 if (ctx
->Driver
.BeginCallList
)
5756 ctx
->Driver
.BeginCallList(ctx
, dlist
);
5762 OpCode opcode
= n
[0].opcode
;
5763 int i
= (int) n
[0].opcode
- (int) OPCODE_EXT_0
;
5765 if (i
>= 0 && i
< (GLint
) ctx
->ListExt
.NumOpcodes
) {
5766 /* this is a driver-extended opcode */
5767 ctx
->ListExt
.Opcode
[i
].Execute(ctx
, &n
[1]);
5768 n
+= ctx
->ListExt
.Opcode
[i
].Size
;
5773 _mesa_error(ctx
, n
[1].e
, (const char *) n
[2].data
);
5776 CALL_Accum(ctx
->Exec
, (n
[1].e
, n
[2].f
));
5778 case OPCODE_ALPHA_FUNC
:
5779 CALL_AlphaFunc(ctx
->Exec
, (n
[1].e
, n
[2].f
));
5781 case OPCODE_BIND_TEXTURE
:
5782 CALL_BindTexture(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
5786 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5787 ctx
->Unpack
= ctx
->DefaultPacking
;
5788 CALL_Bitmap(ctx
->Exec
, ((GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
5789 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
5790 (const GLubyte
*) n
[7].data
));
5791 ctx
->Unpack
= save
; /* restore */
5794 case OPCODE_BLEND_COLOR
:
5795 CALL_BlendColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
5797 case OPCODE_BLEND_EQUATION
:
5798 CALL_BlendEquation(ctx
->Exec
, (n
[1].e
));
5800 case OPCODE_BLEND_EQUATION_SEPARATE
:
5801 CALL_BlendEquationSeparateEXT(ctx
->Exec
, (n
[1].e
, n
[2].e
));
5803 case OPCODE_BLEND_FUNC_SEPARATE
:
5804 CALL_BlendFuncSeparateEXT(ctx
->Exec
,
5805 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
5807 case OPCODE_CALL_LIST
:
5808 /* Generated by glCallList(), don't add ListBase */
5809 if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
5810 execute_list(ctx
, n
[1].ui
);
5813 case OPCODE_CALL_LIST_OFFSET
:
5814 /* Generated by glCallLists() so we must add ListBase */
5816 /* user specified a bad data type at compile time */
5817 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
5819 else if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
5820 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ n
[1].i
);
5821 execute_list(ctx
, list
);
5825 CALL_Clear(ctx
->Exec
, (n
[1].bf
));
5827 case OPCODE_CLEAR_COLOR
:
5828 CALL_ClearColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
5830 case OPCODE_CLEAR_ACCUM
:
5831 CALL_ClearAccum(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
5833 case OPCODE_CLEAR_DEPTH
:
5834 CALL_ClearDepth(ctx
->Exec
, ((GLclampd
) n
[1].f
));
5836 case OPCODE_CLEAR_INDEX
:
5837 CALL_ClearIndex(ctx
->Exec
, ((GLfloat
) n
[1].ui
));
5839 case OPCODE_CLEAR_STENCIL
:
5840 CALL_ClearStencil(ctx
->Exec
, (n
[1].i
));
5842 case OPCODE_CLIP_PLANE
:
5849 CALL_ClipPlane(ctx
->Exec
, (n
[1].e
, eq
));
5852 case OPCODE_COLOR_MASK
:
5853 CALL_ColorMask(ctx
->Exec
, (n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
));
5855 case OPCODE_COLOR_MATERIAL
:
5856 CALL_ColorMaterial(ctx
->Exec
, (n
[1].e
, n
[2].e
));
5858 case OPCODE_COLOR_TABLE
:
5860 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5861 ctx
->Unpack
= ctx
->DefaultPacking
;
5862 CALL_ColorTable(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].e
,
5863 n
[5].e
, n
[6].data
));
5864 ctx
->Unpack
= save
; /* restore */
5867 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
5874 CALL_ColorTableParameterfv(ctx
->Exec
,
5875 (n
[1].e
, n
[2].e
, params
));
5878 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
5885 CALL_ColorTableParameteriv(ctx
->Exec
,
5886 (n
[1].e
, n
[2].e
, params
));
5889 case OPCODE_COLOR_SUB_TABLE
:
5891 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5892 ctx
->Unpack
= ctx
->DefaultPacking
;
5893 CALL_ColorSubTable(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5894 n
[4].e
, n
[5].e
, n
[6].data
));
5895 ctx
->Unpack
= save
; /* restore */
5898 case OPCODE_CONVOLUTION_FILTER_1D
:
5900 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5901 ctx
->Unpack
= ctx
->DefaultPacking
;
5902 CALL_ConvolutionFilter1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5905 ctx
->Unpack
= save
; /* restore */
5908 case OPCODE_CONVOLUTION_FILTER_2D
:
5910 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5911 ctx
->Unpack
= ctx
->DefaultPacking
;
5912 CALL_ConvolutionFilter2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5913 n
[4].i
, n
[5].e
, n
[6].e
,
5915 ctx
->Unpack
= save
; /* restore */
5918 case OPCODE_CONVOLUTION_PARAMETER_I
:
5919 CALL_ConvolutionParameteri(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].i
));
5921 case OPCODE_CONVOLUTION_PARAMETER_IV
:
5928 CALL_ConvolutionParameteriv(ctx
->Exec
,
5929 (n
[1].e
, n
[2].e
, params
));
5932 case OPCODE_CONVOLUTION_PARAMETER_F
:
5933 CALL_ConvolutionParameterf(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].f
));
5935 case OPCODE_CONVOLUTION_PARAMETER_FV
:
5942 CALL_ConvolutionParameterfv(ctx
->Exec
,
5943 (n
[1].e
, n
[2].e
, params
));
5946 case OPCODE_COPY_COLOR_SUB_TABLE
:
5947 CALL_CopyColorSubTable(ctx
->Exec
, (n
[1].e
, n
[2].i
,
5948 n
[3].i
, n
[4].i
, n
[5].i
));
5950 case OPCODE_COPY_COLOR_TABLE
:
5951 CALL_CopyColorSubTable(ctx
->Exec
, (n
[1].e
, n
[2].i
,
5952 n
[3].i
, n
[4].i
, n
[5].i
));
5954 case OPCODE_COPY_PIXELS
:
5955 CALL_CopyPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
,
5956 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
,
5959 case OPCODE_COPY_TEX_IMAGE1D
:
5960 CALL_CopyTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
5961 n
[5].i
, n
[6].i
, n
[7].i
));
5963 case OPCODE_COPY_TEX_IMAGE2D
:
5964 CALL_CopyTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
5965 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
));
5967 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
5968 CALL_CopyTexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5969 n
[4].i
, n
[5].i
, n
[6].i
));
5971 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
5972 CALL_CopyTexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5973 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
5976 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
5977 CALL_CopyTexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5978 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
5981 case OPCODE_CULL_FACE
:
5982 CALL_CullFace(ctx
->Exec
, (n
[1].e
));
5984 case OPCODE_DEPTH_FUNC
:
5985 CALL_DepthFunc(ctx
->Exec
, (n
[1].e
));
5987 case OPCODE_DEPTH_MASK
:
5988 CALL_DepthMask(ctx
->Exec
, (n
[1].b
));
5990 case OPCODE_DEPTH_RANGE
:
5991 CALL_DepthRange(ctx
->Exec
,
5992 ((GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
));
5994 case OPCODE_DISABLE
:
5995 CALL_Disable(ctx
->Exec
, (n
[1].e
));
5997 case OPCODE_DRAW_BUFFER
:
5998 CALL_DrawBuffer(ctx
->Exec
, (n
[1].e
));
6000 case OPCODE_DRAW_PIXELS
:
6002 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6003 ctx
->Unpack
= ctx
->DefaultPacking
;
6004 CALL_DrawPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
6006 ctx
->Unpack
= save
; /* restore */
6010 CALL_Enable(ctx
->Exec
, (n
[1].e
));
6012 case OPCODE_EVALMESH1
:
6013 CALL_EvalMesh1(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
));
6015 case OPCODE_EVALMESH2
:
6016 CALL_EvalMesh2(ctx
->Exec
,
6017 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
6026 CALL_Fogfv(ctx
->Exec
, (n
[1].e
, p
));
6029 case OPCODE_FRONT_FACE
:
6030 CALL_FrontFace(ctx
->Exec
, (n
[1].e
));
6032 case OPCODE_FRUSTUM
:
6033 CALL_Frustum(ctx
->Exec
,
6034 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
6037 CALL_Hint(ctx
->Exec
, (n
[1].e
, n
[2].e
));
6039 case OPCODE_HISTOGRAM
:
6040 CALL_Histogram(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].b
));
6042 case OPCODE_INDEX_MASK
:
6043 CALL_IndexMask(ctx
->Exec
, (n
[1].ui
));
6045 case OPCODE_INIT_NAMES
:
6046 CALL_InitNames(ctx
->Exec
, ());
6055 CALL_Lightfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, p
));
6058 case OPCODE_LIGHT_MODEL
:
6065 CALL_LightModelfv(ctx
->Exec
, (n
[1].e
, p
));
6068 case OPCODE_LINE_STIPPLE
:
6069 CALL_LineStipple(ctx
->Exec
, (n
[1].i
, n
[2].us
));
6071 case OPCODE_LINE_WIDTH
:
6072 CALL_LineWidth(ctx
->Exec
, (n
[1].f
));
6074 case OPCODE_LIST_BASE
:
6075 CALL_ListBase(ctx
->Exec
, (n
[1].ui
));
6077 case OPCODE_LOAD_IDENTITY
:
6078 CALL_LoadIdentity(ctx
->Exec
, ());
6080 case OPCODE_LOAD_MATRIX
:
6081 if (sizeof(Node
) == sizeof(GLfloat
)) {
6082 CALL_LoadMatrixf(ctx
->Exec
, (&n
[1].f
));
6087 for (i
= 0; i
< 16; i
++) {
6090 CALL_LoadMatrixf(ctx
->Exec
, (m
));
6093 case OPCODE_LOAD_NAME
:
6094 CALL_LoadName(ctx
->Exec
, (n
[1].ui
));
6096 case OPCODE_LOGIC_OP
:
6097 CALL_LogicOp(ctx
->Exec
, (n
[1].e
));
6101 GLenum target
= n
[1].e
;
6102 GLint ustride
= _mesa_evaluator_components(target
);
6103 GLint uorder
= n
[5].i
;
6104 GLfloat u1
= n
[2].f
;
6105 GLfloat u2
= n
[3].f
;
6106 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
6107 (GLfloat
*) n
[6].data
));
6112 GLenum target
= n
[1].e
;
6113 GLfloat u1
= n
[2].f
;
6114 GLfloat u2
= n
[3].f
;
6115 GLfloat v1
= n
[4].f
;
6116 GLfloat v2
= n
[5].f
;
6117 GLint ustride
= n
[6].i
;
6118 GLint vstride
= n
[7].i
;
6119 GLint uorder
= n
[8].i
;
6120 GLint vorder
= n
[9].i
;
6121 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
6122 v1
, v2
, vstride
, vorder
,
6123 (GLfloat
*) n
[10].data
));
6126 case OPCODE_MAPGRID1
:
6127 CALL_MapGrid1f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
6129 case OPCODE_MAPGRID2
:
6130 CALL_MapGrid2f(ctx
->Exec
,
6131 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
));
6133 case OPCODE_MATRIX_MODE
:
6134 CALL_MatrixMode(ctx
->Exec
, (n
[1].e
));
6136 case OPCODE_MIN_MAX
:
6137 CALL_Minmax(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].b
));
6139 case OPCODE_MULT_MATRIX
:
6140 if (sizeof(Node
) == sizeof(GLfloat
)) {
6141 CALL_MultMatrixf(ctx
->Exec
, (&n
[1].f
));
6146 for (i
= 0; i
< 16; i
++) {
6149 CALL_MultMatrixf(ctx
->Exec
, (m
));
6153 CALL_Ortho(ctx
->Exec
,
6154 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
6156 case OPCODE_PASSTHROUGH
:
6157 CALL_PassThrough(ctx
->Exec
, (n
[1].f
));
6159 case OPCODE_PIXEL_MAP
:
6160 CALL_PixelMapfv(ctx
->Exec
,
6161 (n
[1].e
, n
[2].i
, (GLfloat
*) n
[3].data
));
6163 case OPCODE_PIXEL_TRANSFER
:
6164 CALL_PixelTransferf(ctx
->Exec
, (n
[1].e
, n
[2].f
));
6166 case OPCODE_PIXEL_ZOOM
:
6167 CALL_PixelZoom(ctx
->Exec
, (n
[1].f
, n
[2].f
));
6169 case OPCODE_POINT_SIZE
:
6170 CALL_PointSize(ctx
->Exec
, (n
[1].f
));
6172 case OPCODE_POINT_PARAMETERS
:
6178 CALL_PointParameterfvEXT(ctx
->Exec
, (n
[1].e
, params
));
6181 case OPCODE_POLYGON_MODE
:
6182 CALL_PolygonMode(ctx
->Exec
, (n
[1].e
, n
[2].e
));
6184 case OPCODE_POLYGON_STIPPLE
:
6186 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6187 ctx
->Unpack
= ctx
->DefaultPacking
;
6188 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) n
[1].data
));
6189 ctx
->Unpack
= save
; /* restore */
6192 case OPCODE_POLYGON_OFFSET
:
6193 CALL_PolygonOffset(ctx
->Exec
, (n
[1].f
, n
[2].f
));
6195 case OPCODE_POP_ATTRIB
:
6196 CALL_PopAttrib(ctx
->Exec
, ());
6198 case OPCODE_POP_MATRIX
:
6199 CALL_PopMatrix(ctx
->Exec
, ());
6201 case OPCODE_POP_NAME
:
6202 CALL_PopName(ctx
->Exec
, ());
6204 case OPCODE_PRIORITIZE_TEXTURE
:
6205 CALL_PrioritizeTextures(ctx
->Exec
, (1, &n
[1].ui
, &n
[2].f
));
6207 case OPCODE_PUSH_ATTRIB
:
6208 CALL_PushAttrib(ctx
->Exec
, (n
[1].bf
));
6210 case OPCODE_PUSH_MATRIX
:
6211 CALL_PushMatrix(ctx
->Exec
, ());
6213 case OPCODE_PUSH_NAME
:
6214 CALL_PushName(ctx
->Exec
, (n
[1].ui
));
6216 case OPCODE_RASTER_POS
:
6217 CALL_RasterPos4f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
6219 case OPCODE_READ_BUFFER
:
6220 CALL_ReadBuffer(ctx
->Exec
, (n
[1].e
));
6222 case OPCODE_RESET_HISTOGRAM
:
6223 CALL_ResetHistogram(ctx
->Exec
, (n
[1].e
));
6225 case OPCODE_RESET_MIN_MAX
:
6226 CALL_ResetMinmax(ctx
->Exec
, (n
[1].e
));
6229 CALL_Rotatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
6232 CALL_Scalef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
6234 case OPCODE_SCISSOR
:
6235 CALL_Scissor(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
6237 case OPCODE_SHADE_MODEL
:
6238 CALL_ShadeModel(ctx
->Exec
, (n
[1].e
));
6240 case OPCODE_STENCIL_FUNC
:
6241 CALL_StencilFunc(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].ui
));
6243 case OPCODE_STENCIL_MASK
:
6244 CALL_StencilMask(ctx
->Exec
, (n
[1].ui
));
6246 case OPCODE_STENCIL_OP
:
6247 CALL_StencilOp(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].e
));
6249 case OPCODE_STENCIL_FUNC_SEPARATE
:
6250 CALL_StencilFuncSeparate(ctx
->Exec
,
6251 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].ui
));
6253 case OPCODE_STENCIL_MASK_SEPARATE
:
6254 CALL_StencilMaskSeparate(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
6256 case OPCODE_STENCIL_OP_SEPARATE
:
6257 CALL_StencilOpSeparate(ctx
->Exec
,
6258 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
6267 CALL_TexEnvfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
6277 CALL_TexGenfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
6280 case OPCODE_TEXPARAMETER
:
6287 CALL_TexParameterfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
6290 case OPCODE_TEX_IMAGE1D
:
6292 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6293 ctx
->Unpack
= ctx
->DefaultPacking
;
6294 CALL_TexImage1D(ctx
->Exec
, (n
[1].e
, /* target */
6296 n
[3].i
, /* components */
6298 n
[5].e
, /* border */
6299 n
[6].e
, /* format */
6302 ctx
->Unpack
= save
; /* restore */
6305 case OPCODE_TEX_IMAGE2D
:
6307 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6308 ctx
->Unpack
= ctx
->DefaultPacking
;
6309 CALL_TexImage2D(ctx
->Exec
, (n
[1].e
, /* target */
6311 n
[3].i
, /* components */
6313 n
[5].i
, /* height */
6314 n
[6].e
, /* border */
6315 n
[7].e
, /* format */
6318 ctx
->Unpack
= save
; /* restore */
6321 case OPCODE_TEX_IMAGE3D
:
6323 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6324 ctx
->Unpack
= ctx
->DefaultPacking
;
6325 CALL_TexImage3D(ctx
->Exec
, (n
[1].e
, /* target */
6327 n
[3].i
, /* components */
6329 n
[5].i
, /* height */
6331 n
[7].e
, /* border */
6332 n
[8].e
, /* format */
6335 ctx
->Unpack
= save
; /* restore */
6338 case OPCODE_TEX_SUB_IMAGE1D
:
6340 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6341 ctx
->Unpack
= ctx
->DefaultPacking
;
6342 CALL_TexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
6344 n
[6].e
, n
[7].data
));
6345 ctx
->Unpack
= save
; /* restore */
6348 case OPCODE_TEX_SUB_IMAGE2D
:
6350 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6351 ctx
->Unpack
= ctx
->DefaultPacking
;
6352 CALL_TexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
6354 n
[6].i
, n
[7].e
, n
[8].e
,
6356 ctx
->Unpack
= save
; /* restore */
6359 case OPCODE_TEX_SUB_IMAGE3D
:
6361 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6362 ctx
->Unpack
= ctx
->DefaultPacking
;
6363 CALL_TexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
6364 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
6365 n
[8].i
, n
[9].e
, n
[10].e
,
6367 ctx
->Unpack
= save
; /* restore */
6370 case OPCODE_TRANSLATE
:
6371 CALL_Translatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
6373 case OPCODE_VIEWPORT
:
6374 CALL_Viewport(ctx
->Exec
, (n
[1].i
, n
[2].i
,
6375 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
));
6377 case OPCODE_WINDOW_POS
:
6378 CALL_WindowPos4fMESA(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
6380 case OPCODE_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
6381 CALL_ActiveTextureARB(ctx
->Exec
, (n
[1].e
));
6383 case OPCODE_COMPRESSED_TEX_IMAGE_1D
: /* GL_ARB_texture_compression */
6384 CALL_CompressedTexImage1DARB(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
6385 n
[4].i
, n
[5].i
, n
[6].i
,
6388 case OPCODE_COMPRESSED_TEX_IMAGE_2D
: /* GL_ARB_texture_compression */
6389 CALL_CompressedTexImage2DARB(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
6390 n
[4].i
, n
[5].i
, n
[6].i
,
6391 n
[7].i
, n
[8].data
));
6393 case OPCODE_COMPRESSED_TEX_IMAGE_3D
: /* GL_ARB_texture_compression */
6394 CALL_CompressedTexImage3DARB(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
6395 n
[4].i
, n
[5].i
, n
[6].i
,
6399 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
: /* GL_ARB_texture_compress */
6400 CALL_CompressedTexSubImage1DARB(ctx
->Exec
,
6401 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
6402 n
[5].e
, n
[6].i
, n
[7].data
));
6404 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
: /* GL_ARB_texture_compress */
6405 CALL_CompressedTexSubImage2DARB(ctx
->Exec
,
6406 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
6407 n
[5].i
, n
[6].i
, n
[7].e
, n
[8].i
,
6410 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
: /* GL_ARB_texture_compress */
6411 CALL_CompressedTexSubImage3DARB(ctx
->Exec
,
6412 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
6413 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
6414 n
[9].e
, n
[10].i
, n
[11].data
));
6416 case OPCODE_SAMPLE_COVERAGE
: /* GL_ARB_multisample */
6417 CALL_SampleCoverageARB(ctx
->Exec
, (n
[1].f
, n
[2].b
));
6419 case OPCODE_WINDOW_POS_ARB
: /* GL_ARB_window_pos */
6420 CALL_WindowPos3fMESA(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
6422 #if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
6423 case OPCODE_BIND_PROGRAM_NV
: /* GL_NV_vertex_program */
6424 CALL_BindProgramNV(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
6427 #if FEATURE_NV_vertex_program
6428 case OPCODE_EXECUTE_PROGRAM_NV
:
6435 CALL_ExecuteProgramNV(ctx
->Exec
, (n
[1].e
, n
[2].ui
, v
));
6438 case OPCODE_REQUEST_RESIDENT_PROGRAMS_NV
:
6439 CALL_RequestResidentProgramsNV(ctx
->Exec
, (n
[1].ui
,
6440 (GLuint
*) n
[2].data
));
6442 case OPCODE_LOAD_PROGRAM_NV
:
6443 CALL_LoadProgramNV(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].i
,
6444 (const GLubyte
*) n
[4].data
));
6446 case OPCODE_TRACK_MATRIX_NV
:
6447 CALL_TrackMatrixNV(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].e
, n
[4].e
));
6451 #if FEATURE_NV_fragment_program
6452 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
:
6453 CALL_ProgramLocalParameter4fARB(ctx
->Exec
,
6454 (n
[1].e
, n
[2].ui
, n
[3].f
, n
[4].f
,
6457 case OPCODE_PROGRAM_NAMED_PARAMETER_NV
:
6458 CALL_ProgramNamedParameter4fNV(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
6459 (const GLubyte
*) n
[3].
6460 data
, n
[4].f
, n
[5].f
,
6465 case OPCODE_ACTIVE_STENCIL_FACE_EXT
:
6466 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (n
[1].e
));
6468 case OPCODE_DEPTH_BOUNDS_EXT
:
6469 CALL_DepthBoundsEXT(ctx
->Exec
, (n
[1].f
, n
[2].f
));
6471 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
6472 case OPCODE_PROGRAM_STRING_ARB
:
6473 CALL_ProgramStringARB(ctx
->Exec
,
6474 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].data
));
6477 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program || FEATURE_NV_vertex_program
6478 case OPCODE_PROGRAM_ENV_PARAMETER_ARB
:
6479 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].f
,
6484 #if FEATURE_ARB_occlusion_query
6485 case OPCODE_BEGIN_QUERY_ARB
:
6486 CALL_BeginQueryARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
6488 case OPCODE_END_QUERY_ARB
:
6489 CALL_EndQueryARB(ctx
->Exec
, (n
[1].e
));
6492 case OPCODE_DRAW_BUFFERS_ARB
:
6494 GLenum buffers
[MAX_DRAW_BUFFERS
];
6495 GLint i
, count
= MIN2(n
[1].i
, MAX_DRAW_BUFFERS
);
6496 for (i
= 0; i
< count
; i
++)
6497 buffers
[i
] = n
[2 + i
].e
;
6498 CALL_DrawBuffersARB(ctx
->Exec
, (n
[1].i
, buffers
));
6501 #if FEATURE_EXT_framebuffer_blit
6502 case OPCODE_BLIT_FRAMEBUFFER
:
6503 CALL_BlitFramebufferEXT(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
,
6504 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
6508 #if FEATURE_ATI_fragment_shader
6509 case OPCODE_BIND_FRAGMENT_SHADER_ATI
:
6510 CALL_BindFragmentShaderATI(ctx
->Exec
, (n
[1].i
));
6512 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
:
6515 GLuint i
, dst
= n
[1].ui
;
6517 for (i
= 0; i
< 4; i
++)
6518 values
[i
] = n
[1 + i
].f
;
6519 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, values
));
6523 case OPCODE_ATTR_1F_NV
:
6524 CALL_VertexAttrib1fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
));
6526 case OPCODE_ATTR_2F_NV
:
6527 /* Really shouldn't have to do this - the Node structure
6528 * is convenient, but it would be better to store the data
6529 * packed appropriately so that it can be sent directly
6530 * on. With x86_64 becoming common, this will start to
6533 if (sizeof(Node
) == sizeof(GLfloat
))
6534 CALL_VertexAttrib2fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6536 CALL_VertexAttrib2fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
));
6538 case OPCODE_ATTR_3F_NV
:
6539 if (sizeof(Node
) == sizeof(GLfloat
))
6540 CALL_VertexAttrib3fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6542 CALL_VertexAttrib3fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
6545 case OPCODE_ATTR_4F_NV
:
6546 if (sizeof(Node
) == sizeof(GLfloat
))
6547 CALL_VertexAttrib4fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6549 CALL_VertexAttrib4fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
6552 case OPCODE_ATTR_1F_ARB
:
6553 CALL_VertexAttrib1fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
));
6555 case OPCODE_ATTR_2F_ARB
:
6556 /* Really shouldn't have to do this - the Node structure
6557 * is convenient, but it would be better to store the data
6558 * packed appropriately so that it can be sent directly
6559 * on. With x86_64 becoming common, this will start to
6562 if (sizeof(Node
) == sizeof(GLfloat
))
6563 CALL_VertexAttrib2fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6565 CALL_VertexAttrib2fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
));
6567 case OPCODE_ATTR_3F_ARB
:
6568 if (sizeof(Node
) == sizeof(GLfloat
))
6569 CALL_VertexAttrib3fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6571 CALL_VertexAttrib3fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
6574 case OPCODE_ATTR_4F_ARB
:
6575 if (sizeof(Node
) == sizeof(GLfloat
))
6576 CALL_VertexAttrib4fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6578 CALL_VertexAttrib4fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
6581 case OPCODE_MATERIAL
:
6582 if (sizeof(Node
) == sizeof(GLfloat
))
6583 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, &n
[3].f
));
6590 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, f
));
6594 CALL_Begin(ctx
->Exec
, (n
[1].e
));
6597 CALL_End(ctx
->Exec
, ());
6600 CALL_Rectf(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
6602 case OPCODE_EVAL_C1
:
6603 CALL_EvalCoord1f(ctx
->Exec
, (n
[1].f
));
6605 case OPCODE_EVAL_C2
:
6606 CALL_EvalCoord2f(ctx
->Exec
, (n
[1].f
, n
[2].f
));
6608 case OPCODE_EVAL_P1
:
6609 CALL_EvalPoint1(ctx
->Exec
, (n
[1].i
));
6611 case OPCODE_EVAL_P2
:
6612 CALL_EvalPoint2(ctx
->Exec
, (n
[1].i
, n
[2].i
));
6615 case OPCODE_CONTINUE
:
6616 n
= (Node
*) n
[1].next
;
6618 case OPCODE_END_OF_LIST
:
6624 _mesa_sprintf(msg
, "Error in execute_list: opcode=%d",
6626 _mesa_problem(ctx
, msg
);
6631 /* increment n to point to next compiled command */
6632 if (opcode
!= OPCODE_CONTINUE
) {
6633 n
+= InstSize
[opcode
];
6638 if (ctx
->Driver
.EndCallList
)
6639 ctx
->Driver
.EndCallList(ctx
);
6641 ctx
->ListState
.CallDepth
--;
6646 /**********************************************************************/
6648 /**********************************************************************/
6651 * Test if a display list number is valid.
6653 GLboolean GLAPIENTRY
6654 _mesa_IsList(GLuint list
)
6656 GET_CURRENT_CONTEXT(ctx
);
6657 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
6658 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
6659 return islist(ctx
, list
);
6664 * Delete a sequence of consecutive display lists.
6667 _mesa_DeleteLists(GLuint list
, GLsizei range
)
6669 GET_CURRENT_CONTEXT(ctx
);
6671 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
6672 ASSERT_OUTSIDE_BEGIN_END(ctx
);
6675 _mesa_error(ctx
, GL_INVALID_VALUE
, "glDeleteLists");
6678 for (i
= list
; i
< list
+ range
; i
++) {
6679 destroy_list(ctx
, i
);
6685 * Return a display list number, n, such that lists n through n+range-1
6689 _mesa_GenLists(GLsizei range
)
6691 GET_CURRENT_CONTEXT(ctx
);
6693 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
6694 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, 0);
6697 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGenLists");
6705 * Make this an atomic operation
6707 _glthread_LOCK_MUTEX(ctx
->Shared
->Mutex
);
6709 base
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
6711 /* reserve the list IDs by with empty/dummy lists */
6713 for (i
= 0; i
< range
; i
++) {
6714 _mesa_HashInsert(ctx
->Shared
->DisplayList
, base
+ i
,
6715 make_list(base
+ i
, 1));
6719 _glthread_UNLOCK_MUTEX(ctx
->Shared
->Mutex
);
6726 * Begin a new display list.
6729 _mesa_NewList(GLuint name
, GLenum mode
)
6731 GET_CURRENT_CONTEXT(ctx
);
6734 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
6735 ASSERT_OUTSIDE_BEGIN_END(ctx
);
6737 if (MESA_VERBOSE
& VERBOSE_API
)
6738 _mesa_debug(ctx
, "glNewList %u %s\n", name
,
6739 _mesa_lookup_enum_by_nr(mode
));
6742 _mesa_error(ctx
, GL_INVALID_VALUE
, "glNewList");
6746 if (mode
!= GL_COMPILE
&& mode
!= GL_COMPILE_AND_EXECUTE
) {
6747 _mesa_error(ctx
, GL_INVALID_ENUM
, "glNewList");
6751 if (ctx
->ListState
.CurrentList
) {
6752 /* already compiling a display list */
6753 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
6757 ctx
->CompileFlag
= GL_TRUE
;
6758 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
6760 /* Allocate new display list */
6761 ctx
->ListState
.CurrentList
= make_list(name
, BLOCK_SIZE
);
6762 ctx
->ListState
.CurrentBlock
= ctx
->ListState
.CurrentList
->Head
;
6763 ctx
->ListState
.CurrentPos
= 0;
6765 /* Reset acumulated list state:
6767 for (i
= 0; i
< VERT_ATTRIB_MAX
; i
++)
6768 ctx
->ListState
.ActiveAttribSize
[i
] = 0;
6770 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++)
6771 ctx
->ListState
.ActiveMaterialSize
[i
] = 0;
6773 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
6774 ctx
->Driver
.NewList(ctx
, name
, mode
);
6776 ctx
->CurrentDispatch
= ctx
->Save
;
6777 _glapi_set_dispatch(ctx
->CurrentDispatch
);
6782 * End definition of current display list.
6787 GET_CURRENT_CONTEXT(ctx
);
6788 SAVE_FLUSH_VERTICES(ctx
);
6789 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
6791 if (MESA_VERBOSE
& VERBOSE_API
)
6792 _mesa_debug(ctx
, "glEndList\n");
6794 /* Check that a list is under construction */
6795 if (!ctx
->ListState
.CurrentList
) {
6796 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glEndList");
6800 /* Call before emitting END_OF_LIST, in case the driver wants to
6801 * emit opcodes itself.
6803 ctx
->Driver
.EndList(ctx
);
6805 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_END_OF_LIST
, 0);
6807 /* Destroy old list, if any */
6808 destroy_list(ctx
, ctx
->ListState
.CurrentList
->Name
);
6810 /* Install the new list */
6811 _mesa_HashInsert(ctx
->Shared
->DisplayList
,
6812 ctx
->ListState
.CurrentList
->Name
,
6813 ctx
->ListState
.CurrentList
);
6816 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
6817 mesa_print_display_list(ctx
->ListState
.CurrentList
->Name
);
6819 ctx
->ListState
.CurrentList
= NULL
;
6820 ctx
->ExecuteFlag
= GL_TRUE
;
6821 ctx
->CompileFlag
= GL_FALSE
;
6823 ctx
->CurrentDispatch
= ctx
->Exec
;
6824 _glapi_set_dispatch(ctx
->CurrentDispatch
);
6829 _mesa_CallList(GLuint list
)
6831 GLboolean save_compile_flag
;
6832 GET_CURRENT_CONTEXT(ctx
);
6833 FLUSH_CURRENT(ctx
, 0);
6834 /* VERY IMPORTANT: Save the CompileFlag status, turn it off, */
6835 /* execute the display list, and restore the CompileFlag. */
6837 if (MESA_VERBOSE
& VERBOSE_API
)
6838 _mesa_debug(ctx
, "glCallList %d\n", list
);
6841 _mesa_error(ctx
, GL_INVALID_VALUE
, "glCallList(list==0)");
6845 /* mesa_print_display_list( list ); */
6847 save_compile_flag
= ctx
->CompileFlag
;
6848 if (save_compile_flag
) {
6849 ctx
->CompileFlag
= GL_FALSE
;
6852 execute_list(ctx
, list
);
6853 ctx
->CompileFlag
= save_compile_flag
;
6855 /* also restore API function pointers to point to "save" versions */
6856 if (save_compile_flag
) {
6857 ctx
->CurrentDispatch
= ctx
->Save
;
6858 _glapi_set_dispatch(ctx
->CurrentDispatch
);
6864 * Execute glCallLists: call multiple display lists.
6867 _mesa_CallLists(GLsizei n
, GLenum type
, const GLvoid
* lists
)
6869 GET_CURRENT_CONTEXT(ctx
);
6871 GLboolean save_compile_flag
;
6873 if (MESA_VERBOSE
& VERBOSE_API
)
6874 _mesa_debug(ctx
, "glCallLists %d\n", n
);
6878 case GL_UNSIGNED_BYTE
:
6880 case GL_UNSIGNED_SHORT
:
6882 case GL_UNSIGNED_INT
:
6890 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
6894 /* Save the CompileFlag status, turn it off, execute display list,
6895 * and restore the CompileFlag.
6897 save_compile_flag
= ctx
->CompileFlag
;
6898 ctx
->CompileFlag
= GL_FALSE
;
6900 for (i
= 0; i
< n
; i
++) {
6901 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ translate_id(i
, type
, lists
));
6902 execute_list(ctx
, list
);
6905 ctx
->CompileFlag
= save_compile_flag
;
6907 /* also restore API function pointers to point to "save" versions */
6908 if (save_compile_flag
) {
6909 ctx
->CurrentDispatch
= ctx
->Save
;
6910 _glapi_set_dispatch(ctx
->CurrentDispatch
);
6916 * Set the offset added to list numbers in glCallLists.
6919 _mesa_ListBase(GLuint base
)
6921 GET_CURRENT_CONTEXT(ctx
);
6922 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
6923 ASSERT_OUTSIDE_BEGIN_END(ctx
);
6924 ctx
->List
.ListBase
= base
;
6928 /* Can no longer assume ctx->Exec->Func is equal to _mesa_Func.
6930 static void GLAPIENTRY
6933 GET_CURRENT_CONTEXT(ctx
);
6934 FLUSH_VERTICES(ctx
, 0);
6935 CALL_Finish(ctx
->Exec
, ());
6938 static void GLAPIENTRY
6941 GET_CURRENT_CONTEXT(ctx
);
6942 FLUSH_VERTICES(ctx
, 0);
6943 CALL_Flush(ctx
->Exec
, ());
6946 static void GLAPIENTRY
6947 exec_GetBooleanv(GLenum pname
, GLboolean
*params
)
6949 GET_CURRENT_CONTEXT(ctx
);
6950 FLUSH_VERTICES(ctx
, 0);
6951 CALL_GetBooleanv(ctx
->Exec
, (pname
, params
));
6954 static void GLAPIENTRY
6955 exec_GetClipPlane(GLenum plane
, GLdouble
* equation
)
6957 GET_CURRENT_CONTEXT(ctx
);
6958 FLUSH_VERTICES(ctx
, 0);
6959 CALL_GetClipPlane(ctx
->Exec
, (plane
, equation
));
6962 static void GLAPIENTRY
6963 exec_GetDoublev(GLenum pname
, GLdouble
*params
)
6965 GET_CURRENT_CONTEXT(ctx
);
6966 FLUSH_VERTICES(ctx
, 0);
6967 CALL_GetDoublev(ctx
->Exec
, (pname
, params
));
6970 static GLenum GLAPIENTRY
6973 GET_CURRENT_CONTEXT(ctx
);
6974 FLUSH_VERTICES(ctx
, 0);
6975 return CALL_GetError(ctx
->Exec
, ());
6978 static void GLAPIENTRY
6979 exec_GetFloatv(GLenum pname
, GLfloat
*params
)
6981 GET_CURRENT_CONTEXT(ctx
);
6982 FLUSH_VERTICES(ctx
, 0);
6983 CALL_GetFloatv(ctx
->Exec
, (pname
, params
));
6986 static void GLAPIENTRY
6987 exec_GetIntegerv(GLenum pname
, GLint
*params
)
6989 GET_CURRENT_CONTEXT(ctx
);
6990 FLUSH_VERTICES(ctx
, 0);
6991 CALL_GetIntegerv(ctx
->Exec
, (pname
, params
));
6994 static void GLAPIENTRY
6995 exec_GetLightfv(GLenum light
, GLenum pname
, GLfloat
*params
)
6997 GET_CURRENT_CONTEXT(ctx
);
6998 FLUSH_VERTICES(ctx
, 0);
6999 CALL_GetLightfv(ctx
->Exec
, (light
, pname
, params
));
7002 static void GLAPIENTRY
7003 exec_GetLightiv(GLenum light
, GLenum pname
, GLint
*params
)
7005 GET_CURRENT_CONTEXT(ctx
);
7006 FLUSH_VERTICES(ctx
, 0);
7007 CALL_GetLightiv(ctx
->Exec
, (light
, pname
, params
));
7010 static void GLAPIENTRY
7011 exec_GetMapdv(GLenum target
, GLenum query
, GLdouble
* v
)
7013 GET_CURRENT_CONTEXT(ctx
);
7014 FLUSH_VERTICES(ctx
, 0);
7015 CALL_GetMapdv(ctx
->Exec
, (target
, query
, v
));
7018 static void GLAPIENTRY
7019 exec_GetMapfv(GLenum target
, GLenum query
, GLfloat
* v
)
7021 GET_CURRENT_CONTEXT(ctx
);
7022 FLUSH_VERTICES(ctx
, 0);
7023 CALL_GetMapfv(ctx
->Exec
, (target
, query
, v
));
7026 static void GLAPIENTRY
7027 exec_GetMapiv(GLenum target
, GLenum query
, GLint
* v
)
7029 GET_CURRENT_CONTEXT(ctx
);
7030 FLUSH_VERTICES(ctx
, 0);
7031 CALL_GetMapiv(ctx
->Exec
, (target
, query
, v
));
7034 static void GLAPIENTRY
7035 exec_GetMaterialfv(GLenum face
, GLenum pname
, GLfloat
*params
)
7037 GET_CURRENT_CONTEXT(ctx
);
7038 FLUSH_VERTICES(ctx
, 0);
7039 CALL_GetMaterialfv(ctx
->Exec
, (face
, pname
, params
));
7042 static void GLAPIENTRY
7043 exec_GetMaterialiv(GLenum face
, GLenum pname
, GLint
*params
)
7045 GET_CURRENT_CONTEXT(ctx
);
7046 FLUSH_VERTICES(ctx
, 0);
7047 CALL_GetMaterialiv(ctx
->Exec
, (face
, pname
, params
));
7050 static void GLAPIENTRY
7051 exec_GetPixelMapfv(GLenum map
, GLfloat
*values
)
7053 GET_CURRENT_CONTEXT(ctx
);
7054 FLUSH_VERTICES(ctx
, 0);
7055 CALL_GetPixelMapfv(ctx
->Exec
, (map
, values
));
7058 static void GLAPIENTRY
7059 exec_GetPixelMapuiv(GLenum map
, GLuint
*values
)
7061 GET_CURRENT_CONTEXT(ctx
);
7062 FLUSH_VERTICES(ctx
, 0);
7063 CALL_GetPixelMapuiv(ctx
->Exec
, (map
, values
));
7066 static void GLAPIENTRY
7067 exec_GetPixelMapusv(GLenum map
, GLushort
*values
)
7069 GET_CURRENT_CONTEXT(ctx
);
7070 FLUSH_VERTICES(ctx
, 0);
7071 CALL_GetPixelMapusv(ctx
->Exec
, (map
, values
));
7074 static void GLAPIENTRY
7075 exec_GetPolygonStipple(GLubyte
* dest
)
7077 GET_CURRENT_CONTEXT(ctx
);
7078 FLUSH_VERTICES(ctx
, 0);
7079 CALL_GetPolygonStipple(ctx
->Exec
, (dest
));
7082 static const GLubyte
*GLAPIENTRY
7083 exec_GetString(GLenum name
)
7085 GET_CURRENT_CONTEXT(ctx
);
7086 FLUSH_VERTICES(ctx
, 0);
7087 return CALL_GetString(ctx
->Exec
, (name
));
7090 static void GLAPIENTRY
7091 exec_GetTexEnvfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7093 GET_CURRENT_CONTEXT(ctx
);
7094 FLUSH_VERTICES(ctx
, 0);
7095 CALL_GetTexEnvfv(ctx
->Exec
, (target
, pname
, params
));
7098 static void GLAPIENTRY
7099 exec_GetTexEnviv(GLenum target
, GLenum pname
, GLint
*params
)
7101 GET_CURRENT_CONTEXT(ctx
);
7102 FLUSH_VERTICES(ctx
, 0);
7103 CALL_GetTexEnviv(ctx
->Exec
, (target
, pname
, params
));
7106 static void GLAPIENTRY
7107 exec_GetTexGendv(GLenum coord
, GLenum pname
, GLdouble
*params
)
7109 GET_CURRENT_CONTEXT(ctx
);
7110 FLUSH_VERTICES(ctx
, 0);
7111 CALL_GetTexGendv(ctx
->Exec
, (coord
, pname
, params
));
7114 static void GLAPIENTRY
7115 exec_GetTexGenfv(GLenum coord
, GLenum pname
, GLfloat
*params
)
7117 GET_CURRENT_CONTEXT(ctx
);
7118 FLUSH_VERTICES(ctx
, 0);
7119 CALL_GetTexGenfv(ctx
->Exec
, (coord
, pname
, params
));
7122 static void GLAPIENTRY
7123 exec_GetTexGeniv(GLenum coord
, GLenum pname
, GLint
*params
)
7125 GET_CURRENT_CONTEXT(ctx
);
7126 FLUSH_VERTICES(ctx
, 0);
7127 CALL_GetTexGeniv(ctx
->Exec
, (coord
, pname
, params
));
7130 static void GLAPIENTRY
7131 exec_GetTexImage(GLenum target
, GLint level
, GLenum format
,
7132 GLenum type
, GLvoid
* pixels
)
7134 GET_CURRENT_CONTEXT(ctx
);
7135 FLUSH_VERTICES(ctx
, 0);
7136 CALL_GetTexImage(ctx
->Exec
, (target
, level
, format
, type
, pixels
));
7139 static void GLAPIENTRY
7140 exec_GetTexLevelParameterfv(GLenum target
, GLint level
,
7141 GLenum pname
, GLfloat
*params
)
7143 GET_CURRENT_CONTEXT(ctx
);
7144 FLUSH_VERTICES(ctx
, 0);
7145 CALL_GetTexLevelParameterfv(ctx
->Exec
, (target
, level
, pname
, params
));
7148 static void GLAPIENTRY
7149 exec_GetTexLevelParameteriv(GLenum target
, GLint level
,
7150 GLenum pname
, GLint
*params
)
7152 GET_CURRENT_CONTEXT(ctx
);
7153 FLUSH_VERTICES(ctx
, 0);
7154 CALL_GetTexLevelParameteriv(ctx
->Exec
, (target
, level
, pname
, params
));
7157 static void GLAPIENTRY
7158 exec_GetTexParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7160 GET_CURRENT_CONTEXT(ctx
);
7161 FLUSH_VERTICES(ctx
, 0);
7162 CALL_GetTexParameterfv(ctx
->Exec
, (target
, pname
, params
));
7165 static void GLAPIENTRY
7166 exec_GetTexParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7168 GET_CURRENT_CONTEXT(ctx
);
7169 FLUSH_VERTICES(ctx
, 0);
7170 CALL_GetTexParameteriv(ctx
->Exec
, (target
, pname
, params
));
7173 static GLboolean GLAPIENTRY
7174 exec_IsEnabled(GLenum cap
)
7176 GET_CURRENT_CONTEXT(ctx
);
7177 FLUSH_VERTICES(ctx
, 0);
7178 return CALL_IsEnabled(ctx
->Exec
, (cap
));
7181 static void GLAPIENTRY
7182 exec_PixelStoref(GLenum pname
, GLfloat param
)
7184 GET_CURRENT_CONTEXT(ctx
);
7185 FLUSH_VERTICES(ctx
, 0);
7186 CALL_PixelStoref(ctx
->Exec
, (pname
, param
));
7189 static void GLAPIENTRY
7190 exec_PixelStorei(GLenum pname
, GLint param
)
7192 GET_CURRENT_CONTEXT(ctx
);
7193 FLUSH_VERTICES(ctx
, 0);
7194 CALL_PixelStorei(ctx
->Exec
, (pname
, param
));
7197 static void GLAPIENTRY
7198 exec_ReadPixels(GLint x
, GLint y
, GLsizei width
, GLsizei height
,
7199 GLenum format
, GLenum type
, GLvoid
* pixels
)
7201 GET_CURRENT_CONTEXT(ctx
);
7202 FLUSH_VERTICES(ctx
, 0);
7203 CALL_ReadPixels(ctx
->Exec
, (x
, y
, width
, height
, format
, type
, pixels
));
7206 static GLint GLAPIENTRY
7207 exec_RenderMode(GLenum mode
)
7209 GET_CURRENT_CONTEXT(ctx
);
7210 FLUSH_VERTICES(ctx
, 0);
7211 return CALL_RenderMode(ctx
->Exec
, (mode
));
7214 static void GLAPIENTRY
7215 exec_FeedbackBuffer(GLsizei size
, GLenum type
, GLfloat
* buffer
)
7217 GET_CURRENT_CONTEXT(ctx
);
7218 FLUSH_VERTICES(ctx
, 0);
7219 CALL_FeedbackBuffer(ctx
->Exec
, (size
, type
, buffer
));
7222 static void GLAPIENTRY
7223 exec_SelectBuffer(GLsizei size
, GLuint
* buffer
)
7225 GET_CURRENT_CONTEXT(ctx
);
7226 FLUSH_VERTICES(ctx
, 0);
7227 CALL_SelectBuffer(ctx
->Exec
, (size
, buffer
));
7230 static GLboolean GLAPIENTRY
7231 exec_AreTexturesResident(GLsizei n
, const GLuint
* texName
,
7232 GLboolean
* residences
)
7234 GET_CURRENT_CONTEXT(ctx
);
7235 FLUSH_VERTICES(ctx
, 0);
7236 return CALL_AreTexturesResident(ctx
->Exec
, (n
, texName
, residences
));
7239 static void GLAPIENTRY
7240 exec_ColorPointer(GLint size
, GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
7242 GET_CURRENT_CONTEXT(ctx
);
7243 FLUSH_VERTICES(ctx
, 0);
7244 CALL_ColorPointer(ctx
->Exec
, (size
, type
, stride
, ptr
));
7247 static void GLAPIENTRY
7248 exec_DeleteTextures(GLsizei n
, const GLuint
* texName
)
7250 GET_CURRENT_CONTEXT(ctx
);
7251 FLUSH_VERTICES(ctx
, 0);
7252 CALL_DeleteTextures(ctx
->Exec
, (n
, texName
));
7255 static void GLAPIENTRY
7256 exec_DisableClientState(GLenum cap
)
7258 GET_CURRENT_CONTEXT(ctx
);
7259 FLUSH_VERTICES(ctx
, 0);
7260 CALL_DisableClientState(ctx
->Exec
, (cap
));
7263 static void GLAPIENTRY
7264 exec_EdgeFlagPointer(GLsizei stride
, const GLvoid
* vptr
)
7266 GET_CURRENT_CONTEXT(ctx
);
7267 FLUSH_VERTICES(ctx
, 0);
7268 CALL_EdgeFlagPointer(ctx
->Exec
, (stride
, vptr
));
7271 static void GLAPIENTRY
7272 exec_EnableClientState(GLenum cap
)
7274 GET_CURRENT_CONTEXT(ctx
);
7275 FLUSH_VERTICES(ctx
, 0);
7276 CALL_EnableClientState(ctx
->Exec
, (cap
));
7279 static void GLAPIENTRY
7280 exec_GenTextures(GLsizei n
, GLuint
* texName
)
7282 GET_CURRENT_CONTEXT(ctx
);
7283 FLUSH_VERTICES(ctx
, 0);
7284 CALL_GenTextures(ctx
->Exec
, (n
, texName
));
7287 static void GLAPIENTRY
7288 exec_GetPointerv(GLenum pname
, GLvoid
**params
)
7290 GET_CURRENT_CONTEXT(ctx
);
7291 FLUSH_VERTICES(ctx
, 0);
7292 CALL_GetPointerv(ctx
->Exec
, (pname
, params
));
7295 static void GLAPIENTRY
7296 exec_IndexPointer(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
7298 GET_CURRENT_CONTEXT(ctx
);
7299 FLUSH_VERTICES(ctx
, 0);
7300 CALL_IndexPointer(ctx
->Exec
, (type
, stride
, ptr
));
7303 static void GLAPIENTRY
7304 exec_InterleavedArrays(GLenum format
, GLsizei stride
, const GLvoid
* pointer
)
7306 GET_CURRENT_CONTEXT(ctx
);
7307 FLUSH_VERTICES(ctx
, 0);
7308 CALL_InterleavedArrays(ctx
->Exec
, (format
, stride
, pointer
));
7311 static GLboolean GLAPIENTRY
7312 exec_IsTexture(GLuint texture
)
7314 GET_CURRENT_CONTEXT(ctx
);
7315 FLUSH_VERTICES(ctx
, 0);
7316 return CALL_IsTexture(ctx
->Exec
, (texture
));
7319 static void GLAPIENTRY
7320 exec_NormalPointer(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
7322 GET_CURRENT_CONTEXT(ctx
);
7323 FLUSH_VERTICES(ctx
, 0);
7324 CALL_NormalPointer(ctx
->Exec
, (type
, stride
, ptr
));
7327 static void GLAPIENTRY
7328 exec_PopClientAttrib(void)
7330 GET_CURRENT_CONTEXT(ctx
);
7331 FLUSH_VERTICES(ctx
, 0);
7332 CALL_PopClientAttrib(ctx
->Exec
, ());
7335 static void GLAPIENTRY
7336 exec_PushClientAttrib(GLbitfield mask
)
7338 GET_CURRENT_CONTEXT(ctx
);
7339 FLUSH_VERTICES(ctx
, 0);
7340 CALL_PushClientAttrib(ctx
->Exec
, (mask
));
7343 static void GLAPIENTRY
7344 exec_TexCoordPointer(GLint size
, GLenum type
, GLsizei stride
,
7347 GET_CURRENT_CONTEXT(ctx
);
7348 FLUSH_VERTICES(ctx
, 0);
7349 CALL_TexCoordPointer(ctx
->Exec
, (size
, type
, stride
, ptr
));
7352 static void GLAPIENTRY
7353 exec_GetCompressedTexImageARB(GLenum target
, GLint level
, GLvoid
* img
)
7355 GET_CURRENT_CONTEXT(ctx
);
7356 FLUSH_VERTICES(ctx
, 0);
7357 CALL_GetCompressedTexImageARB(ctx
->Exec
, (target
, level
, img
));
7360 static void GLAPIENTRY
7361 exec_VertexPointer(GLint size
, GLenum type
, GLsizei stride
,
7364 GET_CURRENT_CONTEXT(ctx
);
7365 FLUSH_VERTICES(ctx
, 0);
7366 CALL_VertexPointer(ctx
->Exec
, (size
, type
, stride
, ptr
));
7369 static void GLAPIENTRY
7370 exec_CopyConvolutionFilter1D(GLenum target
, GLenum internalFormat
,
7371 GLint x
, GLint y
, GLsizei width
)
7373 GET_CURRENT_CONTEXT(ctx
);
7374 FLUSH_VERTICES(ctx
, 0);
7375 CALL_CopyConvolutionFilter1D(ctx
->Exec
,
7376 (target
, internalFormat
, x
, y
, width
));
7379 static void GLAPIENTRY
7380 exec_CopyConvolutionFilter2D(GLenum target
, GLenum internalFormat
,
7381 GLint x
, GLint y
, GLsizei width
, GLsizei height
)
7383 GET_CURRENT_CONTEXT(ctx
);
7384 FLUSH_VERTICES(ctx
, 0);
7385 CALL_CopyConvolutionFilter2D(ctx
->Exec
,
7386 (target
, internalFormat
, x
, y
, width
,
7390 static void GLAPIENTRY
7391 exec_GetColorTable(GLenum target
, GLenum format
, GLenum type
, GLvoid
* data
)
7393 GET_CURRENT_CONTEXT(ctx
);
7394 FLUSH_VERTICES(ctx
, 0);
7395 CALL_GetColorTable(ctx
->Exec
, (target
, format
, type
, data
));
7398 static void GLAPIENTRY
7399 exec_GetColorTableParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7401 GET_CURRENT_CONTEXT(ctx
);
7402 FLUSH_VERTICES(ctx
, 0);
7403 CALL_GetColorTableParameterfv(ctx
->Exec
, (target
, pname
, params
));
7406 static void GLAPIENTRY
7407 exec_GetColorTableParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7409 GET_CURRENT_CONTEXT(ctx
);
7410 FLUSH_VERTICES(ctx
, 0);
7411 CALL_GetColorTableParameteriv(ctx
->Exec
, (target
, pname
, params
));
7414 static void GLAPIENTRY
7415 exec_GetConvolutionFilter(GLenum target
, GLenum format
, GLenum type
,
7418 GET_CURRENT_CONTEXT(ctx
);
7419 FLUSH_VERTICES(ctx
, 0);
7420 CALL_GetConvolutionFilter(ctx
->Exec
, (target
, format
, type
, image
));
7423 static void GLAPIENTRY
7424 exec_GetConvolutionParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7426 GET_CURRENT_CONTEXT(ctx
);
7427 FLUSH_VERTICES(ctx
, 0);
7428 CALL_GetConvolutionParameterfv(ctx
->Exec
, (target
, pname
, params
));
7431 static void GLAPIENTRY
7432 exec_GetConvolutionParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7434 GET_CURRENT_CONTEXT(ctx
);
7435 FLUSH_VERTICES(ctx
, 0);
7436 CALL_GetConvolutionParameteriv(ctx
->Exec
, (target
, pname
, params
));
7439 static void GLAPIENTRY
7440 exec_GetHistogram(GLenum target
, GLboolean reset
, GLenum format
,
7441 GLenum type
, GLvoid
*values
)
7443 GET_CURRENT_CONTEXT(ctx
);
7444 FLUSH_VERTICES(ctx
, 0);
7445 CALL_GetHistogram(ctx
->Exec
, (target
, reset
, format
, type
, values
));
7448 static void GLAPIENTRY
7449 exec_GetHistogramParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7451 GET_CURRENT_CONTEXT(ctx
);
7452 FLUSH_VERTICES(ctx
, 0);
7453 CALL_GetHistogramParameterfv(ctx
->Exec
, (target
, pname
, params
));
7456 static void GLAPIENTRY
7457 exec_GetHistogramParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7459 GET_CURRENT_CONTEXT(ctx
);
7460 FLUSH_VERTICES(ctx
, 0);
7461 CALL_GetHistogramParameteriv(ctx
->Exec
, (target
, pname
, params
));
7464 static void GLAPIENTRY
7465 exec_GetMinmax(GLenum target
, GLboolean reset
, GLenum format
,
7466 GLenum type
, GLvoid
*values
)
7468 GET_CURRENT_CONTEXT(ctx
);
7469 FLUSH_VERTICES(ctx
, 0);
7470 CALL_GetMinmax(ctx
->Exec
, (target
, reset
, format
, type
, values
));
7473 static void GLAPIENTRY
7474 exec_GetMinmaxParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7476 GET_CURRENT_CONTEXT(ctx
);
7477 FLUSH_VERTICES(ctx
, 0);
7478 CALL_GetMinmaxParameterfv(ctx
->Exec
, (target
, pname
, params
));
7481 static void GLAPIENTRY
7482 exec_GetMinmaxParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7484 GET_CURRENT_CONTEXT(ctx
);
7485 FLUSH_VERTICES(ctx
, 0);
7486 CALL_GetMinmaxParameteriv(ctx
->Exec
, (target
, pname
, params
));
7489 static void GLAPIENTRY
7490 exec_GetSeparableFilter(GLenum target
, GLenum format
, GLenum type
,
7491 GLvoid
*row
, GLvoid
*column
, GLvoid
*span
)
7493 GET_CURRENT_CONTEXT(ctx
);
7494 FLUSH_VERTICES(ctx
, 0);
7495 CALL_GetSeparableFilter(ctx
->Exec
,
7496 (target
, format
, type
, row
, column
, span
));
7499 static void GLAPIENTRY
7500 exec_SeparableFilter2D(GLenum target
, GLenum internalFormat
,
7501 GLsizei width
, GLsizei height
, GLenum format
,
7502 GLenum type
, const GLvoid
*row
, const GLvoid
*column
)
7504 GET_CURRENT_CONTEXT(ctx
);
7505 FLUSH_VERTICES(ctx
, 0);
7506 CALL_SeparableFilter2D(ctx
->Exec
,
7507 (target
, internalFormat
, width
, height
, format
,
7508 type
, row
, column
));
7511 static void GLAPIENTRY
7512 exec_ColorPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
7513 GLsizei count
, const GLvoid
*ptr
)
7515 GET_CURRENT_CONTEXT(ctx
);
7516 FLUSH_VERTICES(ctx
, 0);
7517 CALL_ColorPointerEXT(ctx
->Exec
, (size
, type
, stride
, count
, ptr
));
7520 static void GLAPIENTRY
7521 exec_EdgeFlagPointerEXT(GLsizei stride
, GLsizei count
, const GLboolean
*ptr
)
7523 GET_CURRENT_CONTEXT(ctx
);
7524 FLUSH_VERTICES(ctx
, 0);
7525 CALL_EdgeFlagPointerEXT(ctx
->Exec
, (stride
, count
, ptr
));
7528 static void GLAPIENTRY
7529 exec_IndexPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
,
7532 GET_CURRENT_CONTEXT(ctx
);
7533 FLUSH_VERTICES(ctx
, 0);
7534 CALL_IndexPointerEXT(ctx
->Exec
, (type
, stride
, count
, ptr
));
7537 static void GLAPIENTRY
7538 exec_NormalPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
,
7541 GET_CURRENT_CONTEXT(ctx
);
7542 FLUSH_VERTICES(ctx
, 0);
7543 CALL_NormalPointerEXT(ctx
->Exec
, (type
, stride
, count
, ptr
));
7546 static void GLAPIENTRY
7547 exec_TexCoordPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
7548 GLsizei count
, const GLvoid
*ptr
)
7550 GET_CURRENT_CONTEXT(ctx
);
7551 FLUSH_VERTICES(ctx
, 0);
7552 CALL_TexCoordPointerEXT(ctx
->Exec
, (size
, type
, stride
, count
, ptr
));
7555 static void GLAPIENTRY
7556 exec_VertexPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
7557 GLsizei count
, const GLvoid
*ptr
)
7559 GET_CURRENT_CONTEXT(ctx
);
7560 FLUSH_VERTICES(ctx
, 0);
7561 CALL_VertexPointerEXT(ctx
->Exec
, (size
, type
, stride
, count
, ptr
));
7564 static void GLAPIENTRY
7565 exec_LockArraysEXT(GLint first
, GLsizei count
)
7567 GET_CURRENT_CONTEXT(ctx
);
7568 FLUSH_VERTICES(ctx
, 0);
7569 CALL_LockArraysEXT(ctx
->Exec
, (first
, count
));
7572 static void GLAPIENTRY
7573 exec_UnlockArraysEXT(void)
7575 GET_CURRENT_CONTEXT(ctx
);
7576 FLUSH_VERTICES(ctx
, 0);
7577 CALL_UnlockArraysEXT(ctx
->Exec
, ());
7580 static void GLAPIENTRY
7581 exec_ClientActiveTextureARB(GLenum target
)
7583 GET_CURRENT_CONTEXT(ctx
);
7584 FLUSH_VERTICES(ctx
, 0);
7585 CALL_ClientActiveTextureARB(ctx
->Exec
, (target
));
7588 static void GLAPIENTRY
7589 exec_SecondaryColorPointerEXT(GLint size
, GLenum type
,
7590 GLsizei stride
, const GLvoid
*ptr
)
7592 GET_CURRENT_CONTEXT(ctx
);
7593 FLUSH_VERTICES(ctx
, 0);
7594 CALL_SecondaryColorPointerEXT(ctx
->Exec
, (size
, type
, stride
, ptr
));
7597 static void GLAPIENTRY
7598 exec_FogCoordPointerEXT(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
7600 GET_CURRENT_CONTEXT(ctx
);
7601 FLUSH_VERTICES(ctx
, 0);
7602 CALL_FogCoordPointerEXT(ctx
->Exec
, (type
, stride
, ptr
));
7605 /* GL_EXT_multi_draw_arrays */
7606 static void GLAPIENTRY
7607 exec_MultiDrawArraysEXT(GLenum mode
, GLint
* first
,
7608 GLsizei
* count
, GLsizei primcount
)
7610 GET_CURRENT_CONTEXT(ctx
);
7611 FLUSH_VERTICES(ctx
, 0);
7612 CALL_MultiDrawArraysEXT(ctx
->Exec
, (mode
, first
, count
, primcount
));
7615 /* GL_EXT_multi_draw_arrays */
7616 static void GLAPIENTRY
7617 exec_MultiDrawElementsEXT(GLenum mode
, const GLsizei
* count
,
7618 GLenum type
, const GLvoid
** indices
,
7621 GET_CURRENT_CONTEXT(ctx
);
7622 FLUSH_VERTICES(ctx
, 0);
7623 CALL_MultiDrawElementsEXT(ctx
->Exec
,
7624 (mode
, count
, type
, indices
, primcount
));
7627 /* GL_IBM_multimode_draw_arrays */
7628 static void GLAPIENTRY
7629 exec_MultiModeDrawArraysIBM(const GLenum
* mode
, const GLint
* first
,
7630 const GLsizei
* count
, GLsizei primcount
,
7633 GET_CURRENT_CONTEXT(ctx
);
7634 FLUSH_VERTICES(ctx
, 0);
7635 CALL_MultiModeDrawArraysIBM(ctx
->Exec
,
7636 (mode
, first
, count
, primcount
, modestride
));
7639 /* GL_IBM_multimode_draw_arrays */
7640 static void GLAPIENTRY
7641 exec_MultiModeDrawElementsIBM(const GLenum
* mode
,
7642 const GLsizei
* count
,
7644 const GLvoid
* const *indices
,
7645 GLsizei primcount
, GLint modestride
)
7647 GET_CURRENT_CONTEXT(ctx
);
7648 FLUSH_VERTICES(ctx
, 0);
7649 CALL_MultiModeDrawElementsIBM(ctx
->Exec
,
7650 (mode
, count
, type
, indices
, primcount
,
7657 * Setup the given dispatch table to point to Mesa's display list
7658 * building functions.
7660 * This does not include any of the tnl functions - they are
7661 * initialized from _mesa_init_api_defaults and from the active vtxfmt
7665 _mesa_init_dlist_table(struct _glapi_table
*table
)
7667 _mesa_loopback_init_api_table(table
);
7670 SET_Accum(table
, save_Accum
);
7671 SET_AlphaFunc(table
, save_AlphaFunc
);
7672 SET_Bitmap(table
, save_Bitmap
);
7673 SET_BlendFunc(table
, save_BlendFunc
);
7674 SET_CallList(table
, _mesa_save_CallList
);
7675 SET_CallLists(table
, _mesa_save_CallLists
);
7676 SET_Clear(table
, save_Clear
);
7677 SET_ClearAccum(table
, save_ClearAccum
);
7678 SET_ClearColor(table
, save_ClearColor
);
7679 SET_ClearDepth(table
, save_ClearDepth
);
7680 SET_ClearIndex(table
, save_ClearIndex
);
7681 SET_ClearStencil(table
, save_ClearStencil
);
7682 SET_ClipPlane(table
, save_ClipPlane
);
7683 SET_ColorMask(table
, save_ColorMask
);
7684 SET_ColorMaterial(table
, save_ColorMaterial
);
7685 SET_CopyPixels(table
, save_CopyPixels
);
7686 SET_CullFace(table
, save_CullFace
);
7687 SET_DeleteLists(table
, _mesa_DeleteLists
);
7688 SET_DepthFunc(table
, save_DepthFunc
);
7689 SET_DepthMask(table
, save_DepthMask
);
7690 SET_DepthRange(table
, save_DepthRange
);
7691 SET_Disable(table
, save_Disable
);
7692 SET_DrawBuffer(table
, save_DrawBuffer
);
7693 SET_DrawPixels(table
, save_DrawPixels
);
7694 SET_Enable(table
, save_Enable
);
7695 SET_EndList(table
, _mesa_EndList
);
7696 SET_EvalMesh1(table
, _mesa_save_EvalMesh1
);
7697 SET_EvalMesh2(table
, _mesa_save_EvalMesh2
);
7698 SET_Finish(table
, exec_Finish
);
7699 SET_Flush(table
, exec_Flush
);
7700 SET_Fogf(table
, save_Fogf
);
7701 SET_Fogfv(table
, save_Fogfv
);
7702 SET_Fogi(table
, save_Fogi
);
7703 SET_Fogiv(table
, save_Fogiv
);
7704 SET_FrontFace(table
, save_FrontFace
);
7705 SET_Frustum(table
, save_Frustum
);
7706 SET_GenLists(table
, _mesa_GenLists
);
7707 SET_GetBooleanv(table
, exec_GetBooleanv
);
7708 SET_GetClipPlane(table
, exec_GetClipPlane
);
7709 SET_GetDoublev(table
, exec_GetDoublev
);
7710 SET_GetError(table
, exec_GetError
);
7711 SET_GetFloatv(table
, exec_GetFloatv
);
7712 SET_GetIntegerv(table
, exec_GetIntegerv
);
7713 SET_GetLightfv(table
, exec_GetLightfv
);
7714 SET_GetLightiv(table
, exec_GetLightiv
);
7715 SET_GetMapdv(table
, exec_GetMapdv
);
7716 SET_GetMapfv(table
, exec_GetMapfv
);
7717 SET_GetMapiv(table
, exec_GetMapiv
);
7718 SET_GetMaterialfv(table
, exec_GetMaterialfv
);
7719 SET_GetMaterialiv(table
, exec_GetMaterialiv
);
7720 SET_GetPixelMapfv(table
, exec_GetPixelMapfv
);
7721 SET_GetPixelMapuiv(table
, exec_GetPixelMapuiv
);
7722 SET_GetPixelMapusv(table
, exec_GetPixelMapusv
);
7723 SET_GetPolygonStipple(table
, exec_GetPolygonStipple
);
7724 SET_GetString(table
, exec_GetString
);
7725 SET_GetTexEnvfv(table
, exec_GetTexEnvfv
);
7726 SET_GetTexEnviv(table
, exec_GetTexEnviv
);
7727 SET_GetTexGendv(table
, exec_GetTexGendv
);
7728 SET_GetTexGenfv(table
, exec_GetTexGenfv
);
7729 SET_GetTexGeniv(table
, exec_GetTexGeniv
);
7730 SET_GetTexImage(table
, exec_GetTexImage
);
7731 SET_GetTexLevelParameterfv(table
, exec_GetTexLevelParameterfv
);
7732 SET_GetTexLevelParameteriv(table
, exec_GetTexLevelParameteriv
);
7733 SET_GetTexParameterfv(table
, exec_GetTexParameterfv
);
7734 SET_GetTexParameteriv(table
, exec_GetTexParameteriv
);
7735 SET_Hint(table
, save_Hint
);
7736 SET_IndexMask(table
, save_IndexMask
);
7737 SET_InitNames(table
, save_InitNames
);
7738 SET_IsEnabled(table
, exec_IsEnabled
);
7739 SET_IsList(table
, _mesa_IsList
);
7740 SET_LightModelf(table
, save_LightModelf
);
7741 SET_LightModelfv(table
, save_LightModelfv
);
7742 SET_LightModeli(table
, save_LightModeli
);
7743 SET_LightModeliv(table
, save_LightModeliv
);
7744 SET_Lightf(table
, save_Lightf
);
7745 SET_Lightfv(table
, save_Lightfv
);
7746 SET_Lighti(table
, save_Lighti
);
7747 SET_Lightiv(table
, save_Lightiv
);
7748 SET_LineStipple(table
, save_LineStipple
);
7749 SET_LineWidth(table
, save_LineWidth
);
7750 SET_ListBase(table
, save_ListBase
);
7751 SET_LoadIdentity(table
, save_LoadIdentity
);
7752 SET_LoadMatrixd(table
, save_LoadMatrixd
);
7753 SET_LoadMatrixf(table
, save_LoadMatrixf
);
7754 SET_LoadName(table
, save_LoadName
);
7755 SET_LogicOp(table
, save_LogicOp
);
7756 SET_Map1d(table
, save_Map1d
);
7757 SET_Map1f(table
, save_Map1f
);
7758 SET_Map2d(table
, save_Map2d
);
7759 SET_Map2f(table
, save_Map2f
);
7760 SET_MapGrid1d(table
, save_MapGrid1d
);
7761 SET_MapGrid1f(table
, save_MapGrid1f
);
7762 SET_MapGrid2d(table
, save_MapGrid2d
);
7763 SET_MapGrid2f(table
, save_MapGrid2f
);
7764 SET_MatrixMode(table
, save_MatrixMode
);
7765 SET_MultMatrixd(table
, save_MultMatrixd
);
7766 SET_MultMatrixf(table
, save_MultMatrixf
);
7767 SET_NewList(table
, save_NewList
);
7768 SET_Ortho(table
, save_Ortho
);
7769 SET_PassThrough(table
, save_PassThrough
);
7770 SET_PixelMapfv(table
, save_PixelMapfv
);
7771 SET_PixelMapuiv(table
, save_PixelMapuiv
);
7772 SET_PixelMapusv(table
, save_PixelMapusv
);
7773 SET_PixelStoref(table
, exec_PixelStoref
);
7774 SET_PixelStorei(table
, exec_PixelStorei
);
7775 SET_PixelTransferf(table
, save_PixelTransferf
);
7776 SET_PixelTransferi(table
, save_PixelTransferi
);
7777 SET_PixelZoom(table
, save_PixelZoom
);
7778 SET_PointSize(table
, save_PointSize
);
7779 SET_PolygonMode(table
, save_PolygonMode
);
7780 SET_PolygonOffset(table
, save_PolygonOffset
);
7781 SET_PolygonStipple(table
, save_PolygonStipple
);
7782 SET_PopAttrib(table
, save_PopAttrib
);
7783 SET_PopMatrix(table
, save_PopMatrix
);
7784 SET_PopName(table
, save_PopName
);
7785 SET_PushAttrib(table
, save_PushAttrib
);
7786 SET_PushMatrix(table
, save_PushMatrix
);
7787 SET_PushName(table
, save_PushName
);
7788 SET_RasterPos2d(table
, save_RasterPos2d
);
7789 SET_RasterPos2dv(table
, save_RasterPos2dv
);
7790 SET_RasterPos2f(table
, save_RasterPos2f
);
7791 SET_RasterPos2fv(table
, save_RasterPos2fv
);
7792 SET_RasterPos2i(table
, save_RasterPos2i
);
7793 SET_RasterPos2iv(table
, save_RasterPos2iv
);
7794 SET_RasterPos2s(table
, save_RasterPos2s
);
7795 SET_RasterPos2sv(table
, save_RasterPos2sv
);
7796 SET_RasterPos3d(table
, save_RasterPos3d
);
7797 SET_RasterPos3dv(table
, save_RasterPos3dv
);
7798 SET_RasterPos3f(table
, save_RasterPos3f
);
7799 SET_RasterPos3fv(table
, save_RasterPos3fv
);
7800 SET_RasterPos3i(table
, save_RasterPos3i
);
7801 SET_RasterPos3iv(table
, save_RasterPos3iv
);
7802 SET_RasterPos3s(table
, save_RasterPos3s
);
7803 SET_RasterPos3sv(table
, save_RasterPos3sv
);
7804 SET_RasterPos4d(table
, save_RasterPos4d
);
7805 SET_RasterPos4dv(table
, save_RasterPos4dv
);
7806 SET_RasterPos4f(table
, save_RasterPos4f
);
7807 SET_RasterPos4fv(table
, save_RasterPos4fv
);
7808 SET_RasterPos4i(table
, save_RasterPos4i
);
7809 SET_RasterPos4iv(table
, save_RasterPos4iv
);
7810 SET_RasterPos4s(table
, save_RasterPos4s
);
7811 SET_RasterPos4sv(table
, save_RasterPos4sv
);
7812 SET_ReadBuffer(table
, save_ReadBuffer
);
7813 SET_ReadPixels(table
, exec_ReadPixels
);
7814 SET_RenderMode(table
, exec_RenderMode
);
7815 SET_Rotated(table
, save_Rotated
);
7816 SET_Rotatef(table
, save_Rotatef
);
7817 SET_Scaled(table
, save_Scaled
);
7818 SET_Scalef(table
, save_Scalef
);
7819 SET_Scissor(table
, save_Scissor
);
7820 SET_FeedbackBuffer(table
, exec_FeedbackBuffer
);
7821 SET_SelectBuffer(table
, exec_SelectBuffer
);
7822 SET_ShadeModel(table
, save_ShadeModel
);
7823 SET_StencilFunc(table
, save_StencilFunc
);
7824 SET_StencilMask(table
, save_StencilMask
);
7825 SET_StencilOp(table
, save_StencilOp
);
7826 SET_TexEnvf(table
, save_TexEnvf
);
7827 SET_TexEnvfv(table
, save_TexEnvfv
);
7828 SET_TexEnvi(table
, save_TexEnvi
);
7829 SET_TexEnviv(table
, save_TexEnviv
);
7830 SET_TexGend(table
, save_TexGend
);
7831 SET_TexGendv(table
, save_TexGendv
);
7832 SET_TexGenf(table
, save_TexGenf
);
7833 SET_TexGenfv(table
, save_TexGenfv
);
7834 SET_TexGeni(table
, save_TexGeni
);
7835 SET_TexGeniv(table
, save_TexGeniv
);
7836 SET_TexImage1D(table
, save_TexImage1D
);
7837 SET_TexImage2D(table
, save_TexImage2D
);
7838 SET_TexParameterf(table
, save_TexParameterf
);
7839 SET_TexParameterfv(table
, save_TexParameterfv
);
7840 SET_TexParameteri(table
, save_TexParameteri
);
7841 SET_TexParameteriv(table
, save_TexParameteriv
);
7842 SET_Translated(table
, save_Translated
);
7843 SET_Translatef(table
, save_Translatef
);
7844 SET_Viewport(table
, save_Viewport
);
7847 SET_AreTexturesResident(table
, exec_AreTexturesResident
);
7848 SET_BindTexture(table
, save_BindTexture
);
7849 SET_ColorPointer(table
, exec_ColorPointer
);
7850 SET_CopyTexImage1D(table
, save_CopyTexImage1D
);
7851 SET_CopyTexImage2D(table
, save_CopyTexImage2D
);
7852 SET_CopyTexSubImage1D(table
, save_CopyTexSubImage1D
);
7853 SET_CopyTexSubImage2D(table
, save_CopyTexSubImage2D
);
7854 SET_DeleteTextures(table
, exec_DeleteTextures
);
7855 SET_DisableClientState(table
, exec_DisableClientState
);
7856 SET_EdgeFlagPointer(table
, exec_EdgeFlagPointer
);
7857 SET_EnableClientState(table
, exec_EnableClientState
);
7858 SET_GenTextures(table
, exec_GenTextures
);
7859 SET_GetPointerv(table
, exec_GetPointerv
);
7860 SET_IndexPointer(table
, exec_IndexPointer
);
7861 SET_InterleavedArrays(table
, exec_InterleavedArrays
);
7862 SET_IsTexture(table
, exec_IsTexture
);
7863 SET_NormalPointer(table
, exec_NormalPointer
);
7864 SET_PopClientAttrib(table
, exec_PopClientAttrib
);
7865 SET_PrioritizeTextures(table
, save_PrioritizeTextures
);
7866 SET_PushClientAttrib(table
, exec_PushClientAttrib
);
7867 SET_TexCoordPointer(table
, exec_TexCoordPointer
);
7868 SET_TexSubImage1D(table
, save_TexSubImage1D
);
7869 SET_TexSubImage2D(table
, save_TexSubImage2D
);
7870 SET_VertexPointer(table
, exec_VertexPointer
);
7873 SET_CopyTexSubImage3D(table
, save_CopyTexSubImage3D
);
7874 SET_TexImage3D(table
, save_TexImage3D
);
7875 SET_TexSubImage3D(table
, save_TexSubImage3D
);
7878 SET_StencilFuncSeparate(table
, save_StencilFuncSeparate
);
7879 SET_StencilMaskSeparate(table
, save_StencilMaskSeparate
);
7880 SET_StencilOpSeparate(table
, save_StencilOpSeparate
);
7882 /* ATI_separate_stencil */
7883 SET_StencilFuncSeparateATI(table
, save_StencilFuncSeparateATI
);
7885 /* GL_ARB_imaging */
7886 /* Not all are supported */
7887 SET_BlendColor(table
, save_BlendColor
);
7888 SET_BlendEquation(table
, save_BlendEquation
);
7889 SET_ColorSubTable(table
, save_ColorSubTable
);
7890 SET_ColorTable(table
, save_ColorTable
);
7891 SET_ColorTableParameterfv(table
, save_ColorTableParameterfv
);
7892 SET_ColorTableParameteriv(table
, save_ColorTableParameteriv
);
7893 SET_ConvolutionFilter1D(table
, save_ConvolutionFilter1D
);
7894 SET_ConvolutionFilter2D(table
, save_ConvolutionFilter2D
);
7895 SET_ConvolutionParameterf(table
, save_ConvolutionParameterf
);
7896 SET_ConvolutionParameterfv(table
, save_ConvolutionParameterfv
);
7897 SET_ConvolutionParameteri(table
, save_ConvolutionParameteri
);
7898 SET_ConvolutionParameteriv(table
, save_ConvolutionParameteriv
);
7899 SET_CopyColorSubTable(table
, save_CopyColorSubTable
);
7900 SET_CopyColorTable(table
, save_CopyColorTable
);
7901 SET_CopyConvolutionFilter1D(table
, exec_CopyConvolutionFilter1D
);
7902 SET_CopyConvolutionFilter2D(table
, exec_CopyConvolutionFilter2D
);
7903 SET_GetColorTable(table
, exec_GetColorTable
);
7904 SET_GetColorTableParameterfv(table
, exec_GetColorTableParameterfv
);
7905 SET_GetColorTableParameteriv(table
, exec_GetColorTableParameteriv
);
7906 SET_GetConvolutionFilter(table
, exec_GetConvolutionFilter
);
7907 SET_GetConvolutionParameterfv(table
, exec_GetConvolutionParameterfv
);
7908 SET_GetConvolutionParameteriv(table
, exec_GetConvolutionParameteriv
);
7909 SET_GetHistogram(table
, exec_GetHistogram
);
7910 SET_GetHistogramParameterfv(table
, exec_GetHistogramParameterfv
);
7911 SET_GetHistogramParameteriv(table
, exec_GetHistogramParameteriv
);
7912 SET_GetMinmax(table
, exec_GetMinmax
);
7913 SET_GetMinmaxParameterfv(table
, exec_GetMinmaxParameterfv
);
7914 SET_GetMinmaxParameteriv(table
, exec_GetMinmaxParameteriv
);
7915 SET_GetSeparableFilter(table
, exec_GetSeparableFilter
);
7916 SET_Histogram(table
, save_Histogram
);
7917 SET_Minmax(table
, save_Minmax
);
7918 SET_ResetHistogram(table
, save_ResetHistogram
);
7919 SET_ResetMinmax(table
, save_ResetMinmax
);
7920 SET_SeparableFilter2D(table
, exec_SeparableFilter2D
);
7922 /* 2. GL_EXT_blend_color */
7924 SET_BlendColorEXT(table
, save_BlendColorEXT
);
7927 /* 3. GL_EXT_polygon_offset */
7928 SET_PolygonOffsetEXT(table
, save_PolygonOffsetEXT
);
7930 /* 6. GL_EXT_texture3d */
7932 SET_CopyTexSubImage3DEXT(table
, save_CopyTexSubImage3D
);
7933 SET_TexImage3DEXT(table
, save_TexImage3DEXT
);
7934 SET_TexSubImage3DEXT(table
, save_TexSubImage3D
);
7937 /* 14. GL_SGI_color_table */
7939 SET_ColorTableSGI(table
, save_ColorTable
);
7940 SET_ColorSubTableSGI(table
, save_ColorSubTable
);
7941 SET_GetColorTableSGI(table
, exec_GetColorTable
);
7942 SET_GetColorTableParameterfvSGI(table
, exec_GetColorTableParameterfv
);
7943 SET_GetColorTableParameterivSGI(table
, exec_GetColorTableParameteriv
);
7946 /* 30. GL_EXT_vertex_array */
7947 SET_ColorPointerEXT(table
, exec_ColorPointerEXT
);
7948 SET_EdgeFlagPointerEXT(table
, exec_EdgeFlagPointerEXT
);
7949 SET_IndexPointerEXT(table
, exec_IndexPointerEXT
);
7950 SET_NormalPointerEXT(table
, exec_NormalPointerEXT
);
7951 SET_TexCoordPointerEXT(table
, exec_TexCoordPointerEXT
);
7952 SET_VertexPointerEXT(table
, exec_VertexPointerEXT
);
7954 /* 37. GL_EXT_blend_minmax */
7956 SET_BlendEquationEXT(table
, save_BlendEquationEXT
);
7959 /* 54. GL_EXT_point_parameters */
7960 SET_PointParameterfEXT(table
, save_PointParameterfEXT
);
7961 SET_PointParameterfvEXT(table
, save_PointParameterfvEXT
);
7963 /* 97. GL_EXT_compiled_vertex_array */
7964 SET_LockArraysEXT(table
, exec_LockArraysEXT
);
7965 SET_UnlockArraysEXT(table
, exec_UnlockArraysEXT
);
7967 /* 145. GL_EXT_secondary_color */
7968 SET_SecondaryColorPointerEXT(table
, exec_SecondaryColorPointerEXT
);
7970 /* 148. GL_EXT_multi_draw_arrays */
7971 SET_MultiDrawArraysEXT(table
, exec_MultiDrawArraysEXT
);
7972 SET_MultiDrawElementsEXT(table
, exec_MultiDrawElementsEXT
);
7974 /* 149. GL_EXT_fog_coord */
7975 SET_FogCoordPointerEXT(table
, exec_FogCoordPointerEXT
);
7977 /* 173. GL_EXT_blend_func_separate */
7978 SET_BlendFuncSeparateEXT(table
, save_BlendFuncSeparateEXT
);
7980 /* 196. GL_MESA_resize_buffers */
7981 SET_ResizeBuffersMESA(table
, _mesa_ResizeBuffersMESA
);
7983 /* 197. GL_MESA_window_pos */
7984 SET_WindowPos2dMESA(table
, save_WindowPos2dMESA
);
7985 SET_WindowPos2dvMESA(table
, save_WindowPos2dvMESA
);
7986 SET_WindowPos2fMESA(table
, save_WindowPos2fMESA
);
7987 SET_WindowPos2fvMESA(table
, save_WindowPos2fvMESA
);
7988 SET_WindowPos2iMESA(table
, save_WindowPos2iMESA
);
7989 SET_WindowPos2ivMESA(table
, save_WindowPos2ivMESA
);
7990 SET_WindowPos2sMESA(table
, save_WindowPos2sMESA
);
7991 SET_WindowPos2svMESA(table
, save_WindowPos2svMESA
);
7992 SET_WindowPos3dMESA(table
, save_WindowPos3dMESA
);
7993 SET_WindowPos3dvMESA(table
, save_WindowPos3dvMESA
);
7994 SET_WindowPos3fMESA(table
, save_WindowPos3fMESA
);
7995 SET_WindowPos3fvMESA(table
, save_WindowPos3fvMESA
);
7996 SET_WindowPos3iMESA(table
, save_WindowPos3iMESA
);
7997 SET_WindowPos3ivMESA(table
, save_WindowPos3ivMESA
);
7998 SET_WindowPos3sMESA(table
, save_WindowPos3sMESA
);
7999 SET_WindowPos3svMESA(table
, save_WindowPos3svMESA
);
8000 SET_WindowPos4dMESA(table
, save_WindowPos4dMESA
);
8001 SET_WindowPos4dvMESA(table
, save_WindowPos4dvMESA
);
8002 SET_WindowPos4fMESA(table
, save_WindowPos4fMESA
);
8003 SET_WindowPos4fvMESA(table
, save_WindowPos4fvMESA
);
8004 SET_WindowPos4iMESA(table
, save_WindowPos4iMESA
);
8005 SET_WindowPos4ivMESA(table
, save_WindowPos4ivMESA
);
8006 SET_WindowPos4sMESA(table
, save_WindowPos4sMESA
);
8007 SET_WindowPos4svMESA(table
, save_WindowPos4svMESA
);
8009 /* 200. GL_IBM_multimode_draw_arrays */
8010 SET_MultiModeDrawArraysIBM(table
, exec_MultiModeDrawArraysIBM
);
8011 SET_MultiModeDrawElementsIBM(table
, exec_MultiModeDrawElementsIBM
);
8013 #if FEATURE_NV_vertex_program
8014 /* 233. GL_NV_vertex_program */
8015 /* The following commands DO NOT go into display lists:
8016 * AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV,
8017 * VertexAttribPointerNV, GetProgram*, GetVertexAttrib*
8019 SET_BindProgramNV(table
, save_BindProgramNV
);
8020 SET_DeleteProgramsNV(table
, _mesa_DeletePrograms
);
8021 SET_ExecuteProgramNV(table
, save_ExecuteProgramNV
);
8022 SET_GenProgramsNV(table
, _mesa_GenPrograms
);
8023 SET_AreProgramsResidentNV(table
, _mesa_AreProgramsResidentNV
);
8024 SET_RequestResidentProgramsNV(table
, save_RequestResidentProgramsNV
);
8025 SET_GetProgramParameterfvNV(table
, _mesa_GetProgramParameterfvNV
);
8026 SET_GetProgramParameterdvNV(table
, _mesa_GetProgramParameterdvNV
);
8027 SET_GetProgramivNV(table
, _mesa_GetProgramivNV
);
8028 SET_GetProgramStringNV(table
, _mesa_GetProgramStringNV
);
8029 SET_GetTrackMatrixivNV(table
, _mesa_GetTrackMatrixivNV
);
8030 SET_GetVertexAttribdvNV(table
, _mesa_GetVertexAttribdvNV
);
8031 SET_GetVertexAttribfvNV(table
, _mesa_GetVertexAttribfvNV
);
8032 SET_GetVertexAttribivNV(table
, _mesa_GetVertexAttribivNV
);
8033 SET_GetVertexAttribPointervNV(table
, _mesa_GetVertexAttribPointervNV
);
8034 SET_IsProgramNV(table
, _mesa_IsProgramARB
);
8035 SET_LoadProgramNV(table
, save_LoadProgramNV
);
8036 SET_ProgramEnvParameter4dARB(table
, save_ProgramEnvParameter4dARB
);
8037 SET_ProgramEnvParameter4dvARB(table
, save_ProgramEnvParameter4dvARB
);
8038 SET_ProgramEnvParameter4fARB(table
, save_ProgramEnvParameter4fARB
);
8039 SET_ProgramEnvParameter4fvARB(table
, save_ProgramEnvParameter4fvARB
);
8040 SET_ProgramParameters4dvNV(table
, save_ProgramParameters4dvNV
);
8041 SET_ProgramParameters4fvNV(table
, save_ProgramParameters4fvNV
);
8042 SET_TrackMatrixNV(table
, save_TrackMatrixNV
);
8043 SET_VertexAttribPointerNV(table
, _mesa_VertexAttribPointerNV
);
8046 /* 245. GL_ATI_fragment_shader */
8047 #if FEATURE_ATI_fragment_shader
8048 SET_BindFragmentShaderATI(table
, save_BindFragmentShaderATI
);
8049 SET_SetFragmentShaderConstantATI(table
, save_SetFragmentShaderConstantATI
);
8052 /* 282. GL_NV_fragment_program */
8053 #if FEATURE_NV_fragment_program
8054 SET_ProgramNamedParameter4fNV(table
, save_ProgramNamedParameter4fNV
);
8055 SET_ProgramNamedParameter4dNV(table
, save_ProgramNamedParameter4dNV
);
8056 SET_ProgramNamedParameter4fvNV(table
, save_ProgramNamedParameter4fvNV
);
8057 SET_ProgramNamedParameter4dvNV(table
, save_ProgramNamedParameter4dvNV
);
8058 SET_GetProgramNamedParameterfvNV(table
,
8059 _mesa_GetProgramNamedParameterfvNV
);
8060 SET_GetProgramNamedParameterdvNV(table
,
8061 _mesa_GetProgramNamedParameterdvNV
);
8062 SET_ProgramLocalParameter4dARB(table
, save_ProgramLocalParameter4dARB
);
8063 SET_ProgramLocalParameter4dvARB(table
, save_ProgramLocalParameter4dvARB
);
8064 SET_ProgramLocalParameter4fARB(table
, save_ProgramLocalParameter4fARB
);
8065 SET_ProgramLocalParameter4fvARB(table
, save_ProgramLocalParameter4fvARB
);
8066 SET_GetProgramLocalParameterdvARB(table
,
8067 _mesa_GetProgramLocalParameterdvARB
);
8068 SET_GetProgramLocalParameterfvARB(table
,
8069 _mesa_GetProgramLocalParameterfvARB
);
8072 /* 262. GL_NV_point_sprite */
8073 SET_PointParameteriNV(table
, save_PointParameteriNV
);
8074 SET_PointParameterivNV(table
, save_PointParameterivNV
);
8076 /* 268. GL_EXT_stencil_two_side */
8077 SET_ActiveStencilFaceEXT(table
, save_ActiveStencilFaceEXT
);
8079 /* 273. GL_APPLE_vertex_array_object */
8080 SET_BindVertexArrayAPPLE(table
, _mesa_BindVertexArrayAPPLE
);
8081 SET_DeleteVertexArraysAPPLE(table
, _mesa_DeleteVertexArraysAPPLE
);
8082 SET_GenVertexArraysAPPLE(table
, _mesa_GenVertexArraysAPPLE
);
8083 SET_IsVertexArrayAPPLE(table
, _mesa_IsVertexArrayAPPLE
);
8085 /* ???. GL_EXT_depth_bounds_test */
8086 SET_DepthBoundsEXT(table
, save_DepthBoundsEXT
);
8088 /* ARB 1. GL_ARB_multitexture */
8089 SET_ActiveTextureARB(table
, save_ActiveTextureARB
);
8090 SET_ClientActiveTextureARB(table
, exec_ClientActiveTextureARB
);
8092 /* ARB 3. GL_ARB_transpose_matrix */
8093 SET_LoadTransposeMatrixdARB(table
, save_LoadTransposeMatrixdARB
);
8094 SET_LoadTransposeMatrixfARB(table
, save_LoadTransposeMatrixfARB
);
8095 SET_MultTransposeMatrixdARB(table
, save_MultTransposeMatrixdARB
);
8096 SET_MultTransposeMatrixfARB(table
, save_MultTransposeMatrixfARB
);
8098 /* ARB 5. GL_ARB_multisample */
8099 SET_SampleCoverageARB(table
, save_SampleCoverageARB
);
8101 /* ARB 12. GL_ARB_texture_compression */
8102 SET_CompressedTexImage3DARB(table
, save_CompressedTexImage3DARB
);
8103 SET_CompressedTexImage2DARB(table
, save_CompressedTexImage2DARB
);
8104 SET_CompressedTexImage1DARB(table
, save_CompressedTexImage1DARB
);
8105 SET_CompressedTexSubImage3DARB(table
, save_CompressedTexSubImage3DARB
);
8106 SET_CompressedTexSubImage2DARB(table
, save_CompressedTexSubImage2DARB
);
8107 SET_CompressedTexSubImage1DARB(table
, save_CompressedTexSubImage1DARB
);
8108 SET_GetCompressedTexImageARB(table
, exec_GetCompressedTexImageARB
);
8110 /* ARB 14. GL_ARB_point_parameters */
8111 /* aliased with EXT_point_parameters functions */
8113 /* ARB 25. GL_ARB_window_pos */
8114 /* aliased with MESA_window_pos functions */
8116 /* ARB 26. GL_ARB_vertex_program */
8117 /* ARB 27. GL_ARB_fragment_program */
8118 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
8119 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
8120 SET_VertexAttribPointerARB(table
, _mesa_VertexAttribPointerARB
);
8121 SET_EnableVertexAttribArrayARB(table
, _mesa_EnableVertexAttribArrayARB
);
8122 SET_DisableVertexAttribArrayARB(table
, _mesa_DisableVertexAttribArrayARB
);
8123 SET_ProgramStringARB(table
, save_ProgramStringARB
);
8124 SET_BindProgramNV(table
, save_BindProgramNV
);
8125 SET_DeleteProgramsNV(table
, _mesa_DeletePrograms
);
8126 SET_GenProgramsNV(table
, _mesa_GenPrograms
);
8127 SET_IsProgramNV(table
, _mesa_IsProgramARB
);
8128 SET_GetVertexAttribdvNV(table
, _mesa_GetVertexAttribdvNV
);
8129 SET_GetVertexAttribfvNV(table
, _mesa_GetVertexAttribfvNV
);
8130 SET_GetVertexAttribivNV(table
, _mesa_GetVertexAttribivNV
);
8131 SET_GetVertexAttribPointervNV(table
, _mesa_GetVertexAttribPointervNV
);
8132 SET_ProgramEnvParameter4dARB(table
, save_ProgramEnvParameter4dARB
);
8133 SET_ProgramEnvParameter4dvARB(table
, save_ProgramEnvParameter4dvARB
);
8134 SET_ProgramEnvParameter4fARB(table
, save_ProgramEnvParameter4fARB
);
8135 SET_ProgramEnvParameter4fvARB(table
, save_ProgramEnvParameter4fvARB
);
8136 SET_ProgramLocalParameter4dARB(table
, save_ProgramLocalParameter4dARB
);
8137 SET_ProgramLocalParameter4dvARB(table
, save_ProgramLocalParameter4dvARB
);
8138 SET_ProgramLocalParameter4fARB(table
, save_ProgramLocalParameter4fARB
);
8139 SET_ProgramLocalParameter4fvARB(table
, save_ProgramLocalParameter4fvARB
);
8140 SET_GetProgramEnvParameterdvARB(table
, _mesa_GetProgramEnvParameterdvARB
);
8141 SET_GetProgramEnvParameterfvARB(table
, _mesa_GetProgramEnvParameterfvARB
);
8142 SET_GetProgramLocalParameterdvARB(table
,
8143 _mesa_GetProgramLocalParameterdvARB
);
8144 SET_GetProgramLocalParameterfvARB(table
,
8145 _mesa_GetProgramLocalParameterfvARB
);
8146 SET_GetProgramivARB(table
, _mesa_GetProgramivARB
);
8147 SET_GetProgramStringARB(table
, _mesa_GetProgramStringARB
);
8150 /* ARB 28. GL_ARB_vertex_buffer_object */
8151 #if FEATURE_ARB_vertex_buffer_object
8152 /* None of the extension's functions get compiled */
8153 SET_BindBufferARB(table
, _mesa_BindBufferARB
);
8154 SET_BufferDataARB(table
, _mesa_BufferDataARB
);
8155 SET_BufferSubDataARB(table
, _mesa_BufferSubDataARB
);
8156 SET_DeleteBuffersARB(table
, _mesa_DeleteBuffersARB
);
8157 SET_GenBuffersARB(table
, _mesa_GenBuffersARB
);
8158 SET_GetBufferParameterivARB(table
, _mesa_GetBufferParameterivARB
);
8159 SET_GetBufferPointervARB(table
, _mesa_GetBufferPointervARB
);
8160 SET_GetBufferSubDataARB(table
, _mesa_GetBufferSubDataARB
);
8161 SET_IsBufferARB(table
, _mesa_IsBufferARB
);
8162 SET_MapBufferARB(table
, _mesa_MapBufferARB
);
8163 SET_UnmapBufferARB(table
, _mesa_UnmapBufferARB
);
8166 #if FEATURE_ARB_occlusion_query
8167 SET_BeginQueryARB(table
, save_BeginQueryARB
);
8168 SET_EndQueryARB(table
, save_EndQueryARB
);
8169 SET_GenQueriesARB(table
, _mesa_GenQueriesARB
);
8170 SET_DeleteQueriesARB(table
, _mesa_DeleteQueriesARB
);
8171 SET_IsQueryARB(table
, _mesa_IsQueryARB
);
8172 SET_GetQueryivARB(table
, _mesa_GetQueryivARB
);
8173 SET_GetQueryObjectivARB(table
, _mesa_GetQueryObjectivARB
);
8174 SET_GetQueryObjectuivARB(table
, _mesa_GetQueryObjectuivARB
);
8176 SET_DrawBuffersARB(table
, save_DrawBuffersARB
);
8178 #if FEATURE_EXT_framebuffer_blit
8179 SET_BlitFramebufferEXT(table
, save_BlitFramebufferEXT
);
8182 /* ARB 30/31/32. GL_ARB_shader_objects, GL_ARB_vertex/fragment_shader */
8183 SET_BindAttribLocationARB(table
, exec_BindAttribLocationARB
);
8184 SET_GetAttribLocationARB(table
, exec_GetAttribLocationARB
);
8185 /* XXX additional functions need to be implemented here! */
8187 /* 299. GL_EXT_blend_equation_separate */
8188 SET_BlendEquationSeparateEXT(table
, save_BlendEquationSeparateEXT
);
8190 /* GL_EXT_gpu_program_parmaeters */
8191 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
8192 SET_ProgramEnvParameters4fvEXT(table
, save_ProgramEnvParameters4fvEXT
);
8193 SET_ProgramLocalParameters4fvEXT(table
, save_ProgramLocalParameters4fvEXT
);
8200 enum_string(GLenum k
)
8202 return _mesa_lookup_enum_by_nr(k
);
8207 * Print the commands in a display list. For debugging only.
8208 * TODO: many commands aren't handled yet.
8210 static void GLAPIENTRY
8211 print_list(GLcontext
*ctx
, GLuint list
)
8213 struct gl_display_list
*dlist
;
8217 if (!islist(ctx
, list
)) {
8218 _mesa_printf("%u is not a display list ID\n", list
);
8222 dlist
= lookup_list(ctx
, list
);
8228 _mesa_printf("START-LIST %u, address %p\n", list
, (void *) n
);
8230 done
= n
? GL_FALSE
: GL_TRUE
;
8232 OpCode opcode
= n
[0].opcode
;
8233 GLint i
= (GLint
) n
[0].opcode
- (GLint
) OPCODE_EXT_0
;
8235 if (i
>= 0 && i
< (GLint
) ctx
->ListExt
.NumOpcodes
) {
8236 /* this is a driver-extended opcode */
8237 ctx
->ListExt
.Opcode
[i
].Print(ctx
, &n
[1]);
8238 n
+= ctx
->ListExt
.Opcode
[i
].Size
;
8243 _mesa_printf("Accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
8246 _mesa_printf("Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
8247 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
, (void *) n
[7].data
);
8249 case OPCODE_CALL_LIST
:
8250 _mesa_printf("CallList %d\n", (int) n
[1].ui
);
8252 case OPCODE_CALL_LIST_OFFSET
:
8253 _mesa_printf("CallList %d + offset %u = %u\n", (int) n
[1].ui
,
8254 ctx
->List
.ListBase
, ctx
->List
.ListBase
+ n
[1].ui
);
8256 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
8257 _mesa_printf("ColorTableParameterfv %s %s %f %f %f %f\n",
8258 enum_string(n
[1].e
), enum_string(n
[2].e
),
8259 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8261 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
8262 _mesa_printf("ColorTableParameteriv %s %s %d %d %d %d\n",
8263 enum_string(n
[1].e
), enum_string(n
[2].e
),
8264 n
[3].i
, n
[4].i
, n
[5].i
, n
[6].i
);
8266 case OPCODE_DISABLE
:
8267 _mesa_printf("Disable %s\n", enum_string(n
[1].e
));
8270 _mesa_printf("Enable %s\n", enum_string(n
[1].e
));
8272 case OPCODE_FRUSTUM
:
8273 _mesa_printf("Frustum %g %g %g %g %g %g\n",
8274 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8276 case OPCODE_LINE_STIPPLE
:
8277 _mesa_printf("LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
8279 case OPCODE_LOAD_IDENTITY
:
8280 _mesa_printf("LoadIdentity\n");
8282 case OPCODE_LOAD_MATRIX
:
8283 _mesa_printf("LoadMatrix\n");
8284 _mesa_printf(" %8f %8f %8f %8f\n",
8285 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
8286 _mesa_printf(" %8f %8f %8f %8f\n",
8287 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
8288 _mesa_printf(" %8f %8f %8f %8f\n",
8289 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
8290 _mesa_printf(" %8f %8f %8f %8f\n",
8291 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
8293 case OPCODE_MULT_MATRIX
:
8294 _mesa_printf("MultMatrix (or Rotate)\n");
8295 _mesa_printf(" %8f %8f %8f %8f\n",
8296 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
8297 _mesa_printf(" %8f %8f %8f %8f\n",
8298 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
8299 _mesa_printf(" %8f %8f %8f %8f\n",
8300 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
8301 _mesa_printf(" %8f %8f %8f %8f\n",
8302 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
8305 _mesa_printf("Ortho %g %g %g %g %g %g\n",
8306 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8308 case OPCODE_POP_ATTRIB
:
8309 _mesa_printf("PopAttrib\n");
8311 case OPCODE_POP_MATRIX
:
8312 _mesa_printf("PopMatrix\n");
8314 case OPCODE_POP_NAME
:
8315 _mesa_printf("PopName\n");
8317 case OPCODE_PUSH_ATTRIB
:
8318 _mesa_printf("PushAttrib %x\n", n
[1].bf
);
8320 case OPCODE_PUSH_MATRIX
:
8321 _mesa_printf("PushMatrix\n");
8323 case OPCODE_PUSH_NAME
:
8324 _mesa_printf("PushName %d\n", (int) n
[1].ui
);
8326 case OPCODE_RASTER_POS
:
8327 _mesa_printf("RasterPos %g %g %g %g\n",
8328 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
8331 _mesa_printf("Rotate %g %g %g %g\n",
8332 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
8335 _mesa_printf("Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
8337 case OPCODE_TRANSLATE
:
8338 _mesa_printf("Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
8340 case OPCODE_BIND_TEXTURE
:
8341 _mesa_printf("BindTexture %s %d\n",
8342 _mesa_lookup_enum_by_nr(n
[1].ui
), n
[2].ui
);
8344 case OPCODE_SHADE_MODEL
:
8345 _mesa_printf("ShadeModel %s\n", _mesa_lookup_enum_by_nr(n
[1].ui
));
8348 _mesa_printf("Map1 %s %.3f %.3f %d %d\n",
8349 _mesa_lookup_enum_by_nr(n
[1].ui
),
8350 n
[2].f
, n
[3].f
, n
[4].i
, n
[5].i
);
8353 _mesa_printf("Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
8354 _mesa_lookup_enum_by_nr(n
[1].ui
),
8355 n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
,
8356 n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
8358 case OPCODE_MAPGRID1
:
8359 _mesa_printf("MapGrid1 %d %.3f %.3f\n", n
[1].i
, n
[2].f
, n
[3].f
);
8361 case OPCODE_MAPGRID2
:
8362 _mesa_printf("MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
8363 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
8365 case OPCODE_EVALMESH1
:
8366 _mesa_printf("EvalMesh1 %d %d\n", n
[1].i
, n
[2].i
);
8368 case OPCODE_EVALMESH2
:
8369 _mesa_printf("EvalMesh2 %d %d %d %d\n",
8370 n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
8373 case OPCODE_ATTR_1F_NV
:
8374 _mesa_printf("ATTR_1F_NV attr %d: %f\n", n
[1].i
, n
[2].f
);
8376 case OPCODE_ATTR_2F_NV
:
8377 _mesa_printf("ATTR_2F_NV attr %d: %f %f\n",
8378 n
[1].i
, n
[2].f
, n
[3].f
);
8380 case OPCODE_ATTR_3F_NV
:
8381 _mesa_printf("ATTR_3F_NV attr %d: %f %f %f\n",
8382 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
8384 case OPCODE_ATTR_4F_NV
:
8385 _mesa_printf("ATTR_4F_NV attr %d: %f %f %f %f\n",
8386 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
8388 case OPCODE_ATTR_1F_ARB
:
8389 _mesa_printf("ATTR_1F_ARB attr %d: %f\n", n
[1].i
, n
[2].f
);
8391 case OPCODE_ATTR_2F_ARB
:
8392 _mesa_printf("ATTR_2F_ARB attr %d: %f %f\n",
8393 n
[1].i
, n
[2].f
, n
[3].f
);
8395 case OPCODE_ATTR_3F_ARB
:
8396 _mesa_printf("ATTR_3F_ARB attr %d: %f %f %f\n",
8397 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
8399 case OPCODE_ATTR_4F_ARB
:
8400 _mesa_printf("ATTR_4F_ARB attr %d: %f %f %f %f\n",
8401 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
8404 case OPCODE_MATERIAL
:
8405 _mesa_printf("MATERIAL %x %x: %f %f %f %f\n",
8406 n
[1].i
, n
[2].i
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8409 _mesa_printf("BEGIN %x\n", n
[1].i
);
8412 _mesa_printf("END\n");
8415 _mesa_printf("RECTF %f %f %f %f\n", n
[1].f
, n
[2].f
, n
[3].f
,
8418 case OPCODE_EVAL_C1
:
8419 _mesa_printf("EVAL_C1 %f\n", n
[1].f
);
8421 case OPCODE_EVAL_C2
:
8422 _mesa_printf("EVAL_C2 %f %f\n", n
[1].f
, n
[2].f
);
8424 case OPCODE_EVAL_P1
:
8425 _mesa_printf("EVAL_P1 %d\n", n
[1].i
);
8427 case OPCODE_EVAL_P2
:
8428 _mesa_printf("EVAL_P2 %d %d\n", n
[1].i
, n
[2].i
);
8432 * meta opcodes/commands
8435 _mesa_printf("Error: %s %s\n",
8436 enum_string(n
[1].e
), (const char *) n
[2].data
);
8438 case OPCODE_CONTINUE
:
8439 _mesa_printf("DISPLAY-LIST-CONTINUE\n");
8440 n
= (Node
*) n
[1].next
;
8442 case OPCODE_END_OF_LIST
:
8443 _mesa_printf("END-LIST %u\n", list
);
8447 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
8449 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
8450 opcode
, (void *) n
);
8454 _mesa_printf("command %d, %u operands\n", opcode
,
8458 /* increment n to point to next compiled command */
8459 if (opcode
!= OPCODE_CONTINUE
) {
8460 n
+= InstSize
[opcode
];
8469 * Clients may call this function to help debug display list problems.
8470 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
8471 * changed, or break in the future without notice.
8474 mesa_print_display_list(GLuint list
)
8476 GET_CURRENT_CONTEXT(ctx
);
8477 print_list(ctx
, list
);
8481 /**********************************************************************/
8482 /***** Initialization *****/
8483 /**********************************************************************/
8486 _mesa_save_vtxfmt_init(GLvertexformat
* vfmt
)
8488 vfmt
->ArrayElement
= _ae_loopback_array_elt
; /* generic helper */
8489 vfmt
->Begin
= save_Begin
;
8490 vfmt
->CallList
= _mesa_save_CallList
;
8491 vfmt
->CallLists
= _mesa_save_CallLists
;
8492 vfmt
->Color3f
= save_Color3f
;
8493 vfmt
->Color3fv
= save_Color3fv
;
8494 vfmt
->Color4f
= save_Color4f
;
8495 vfmt
->Color4fv
= save_Color4fv
;
8496 vfmt
->EdgeFlag
= save_EdgeFlag
;
8497 vfmt
->End
= save_End
;
8498 vfmt
->EvalCoord1f
= save_EvalCoord1f
;
8499 vfmt
->EvalCoord1fv
= save_EvalCoord1fv
;
8500 vfmt
->EvalCoord2f
= save_EvalCoord2f
;
8501 vfmt
->EvalCoord2fv
= save_EvalCoord2fv
;
8502 vfmt
->EvalPoint1
= save_EvalPoint1
;
8503 vfmt
->EvalPoint2
= save_EvalPoint2
;
8504 vfmt
->FogCoordfEXT
= save_FogCoordfEXT
;
8505 vfmt
->FogCoordfvEXT
= save_FogCoordfvEXT
;
8506 vfmt
->Indexf
= save_Indexf
;
8507 vfmt
->Indexfv
= save_Indexfv
;
8508 vfmt
->Materialfv
= save_Materialfv
;
8509 vfmt
->MultiTexCoord1fARB
= save_MultiTexCoord1f
;
8510 vfmt
->MultiTexCoord1fvARB
= save_MultiTexCoord1fv
;
8511 vfmt
->MultiTexCoord2fARB
= save_MultiTexCoord2f
;
8512 vfmt
->MultiTexCoord2fvARB
= save_MultiTexCoord2fv
;
8513 vfmt
->MultiTexCoord3fARB
= save_MultiTexCoord3f
;
8514 vfmt
->MultiTexCoord3fvARB
= save_MultiTexCoord3fv
;
8515 vfmt
->MultiTexCoord4fARB
= save_MultiTexCoord4f
;
8516 vfmt
->MultiTexCoord4fvARB
= save_MultiTexCoord4fv
;
8517 vfmt
->Normal3f
= save_Normal3f
;
8518 vfmt
->Normal3fv
= save_Normal3fv
;
8519 vfmt
->SecondaryColor3fEXT
= save_SecondaryColor3fEXT
;
8520 vfmt
->SecondaryColor3fvEXT
= save_SecondaryColor3fvEXT
;
8521 vfmt
->TexCoord1f
= save_TexCoord1f
;
8522 vfmt
->TexCoord1fv
= save_TexCoord1fv
;
8523 vfmt
->TexCoord2f
= save_TexCoord2f
;
8524 vfmt
->TexCoord2fv
= save_TexCoord2fv
;
8525 vfmt
->TexCoord3f
= save_TexCoord3f
;
8526 vfmt
->TexCoord3fv
= save_TexCoord3fv
;
8527 vfmt
->TexCoord4f
= save_TexCoord4f
;
8528 vfmt
->TexCoord4fv
= save_TexCoord4fv
;
8529 vfmt
->Vertex2f
= save_Vertex2f
;
8530 vfmt
->Vertex2fv
= save_Vertex2fv
;
8531 vfmt
->Vertex3f
= save_Vertex3f
;
8532 vfmt
->Vertex3fv
= save_Vertex3fv
;
8533 vfmt
->Vertex4f
= save_Vertex4f
;
8534 vfmt
->Vertex4fv
= save_Vertex4fv
;
8535 vfmt
->VertexAttrib1fNV
= save_VertexAttrib1fNV
;
8536 vfmt
->VertexAttrib1fvNV
= save_VertexAttrib1fvNV
;
8537 vfmt
->VertexAttrib2fNV
= save_VertexAttrib2fNV
;
8538 vfmt
->VertexAttrib2fvNV
= save_VertexAttrib2fvNV
;
8539 vfmt
->VertexAttrib3fNV
= save_VertexAttrib3fNV
;
8540 vfmt
->VertexAttrib3fvNV
= save_VertexAttrib3fvNV
;
8541 vfmt
->VertexAttrib4fNV
= save_VertexAttrib4fNV
;
8542 vfmt
->VertexAttrib4fvNV
= save_VertexAttrib4fvNV
;
8543 vfmt
->VertexAttrib1fARB
= save_VertexAttrib1fARB
;
8544 vfmt
->VertexAttrib1fvARB
= save_VertexAttrib1fvARB
;
8545 vfmt
->VertexAttrib2fARB
= save_VertexAttrib2fARB
;
8546 vfmt
->VertexAttrib2fvARB
= save_VertexAttrib2fvARB
;
8547 vfmt
->VertexAttrib3fARB
= save_VertexAttrib3fARB
;
8548 vfmt
->VertexAttrib3fvARB
= save_VertexAttrib3fvARB
;
8549 vfmt
->VertexAttrib4fARB
= save_VertexAttrib4fARB
;
8550 vfmt
->VertexAttrib4fvARB
= save_VertexAttrib4fvARB
;
8552 vfmt
->EvalMesh1
= _mesa_save_EvalMesh1
;
8553 vfmt
->EvalMesh2
= _mesa_save_EvalMesh2
;
8554 vfmt
->Rectf
= save_Rectf
;
8556 /* The driver is required to implement these as
8557 * 1) They can probably do a better job.
8558 * 2) A lot of new mechanisms would have to be added to this module
8559 * to support it. That code would probably never get used,
8563 vfmt
->DrawArrays
= 0;
8564 vfmt
->DrawElements
= 0;
8565 vfmt
->DrawRangeElements
= 0;
8571 * Initialize display list state for given context.
8574 _mesa_init_display_list(GLcontext
*ctx
)
8576 static GLboolean tableInitialized
= GL_FALSE
;
8578 /* zero-out the instruction size table, just once */
8579 if (!tableInitialized
) {
8580 _mesa_bzero(InstSize
, sizeof(InstSize
));
8581 tableInitialized
= GL_TRUE
;
8585 ctx
->ListState
.CallDepth
= 0;
8586 ctx
->ExecuteFlag
= GL_TRUE
;
8587 ctx
->CompileFlag
= GL_FALSE
;
8588 ctx
->ListState
.CurrentBlock
= NULL
;
8589 ctx
->ListState
.CurrentPos
= 0;
8591 /* Display List group */
8592 ctx
->List
.ListBase
= 0;
8594 _mesa_save_vtxfmt_init(&ctx
->ListState
.ListVtxfmt
);