2 * Mesa 3-D graphics library
5 * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 * Display lists management functions.
33 #include "api_arrayelt.h"
34 #include "api_loopback.h"
39 #if FEATURE_ARB_vertex_buffer_object
40 #include "bufferobj.h"
53 #include "extensions.h"
56 #include "glapi/glapi.h"
58 #include "histogram.h"
75 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
76 #include "shader/arbprogram.h"
77 #include "shader/program.h"
79 #if FEATURE_NV_vertex_program || FEATURE_NV_fragment_program
80 #include "shader/nvprogram.h"
81 #include "shader/program.h"
83 #if FEATURE_ATI_fragment_shader
84 #include "shader/atifragshader.h"
87 #include "math/m_matrix.h"
88 #include "math/m_xform.h"
90 #include "glapi/dispatch.h"
96 * \param ctx GL context.
98 * Checks if dd_function_table::SaveNeedFlush is marked to flush
99 * stored (save) vertices, and calls
100 * dd_function_table::SaveFlushVertices if so.
102 #define SAVE_FLUSH_VERTICES(ctx) \
104 if (ctx->Driver.SaveNeedFlush) \
105 ctx->Driver.SaveFlushVertices(ctx); \
110 * Macro to assert that the API call was made outside the
111 * glBegin()/glEnd() pair, with return value.
113 * \param ctx GL context.
114 * \param retval value to return value in case the assertion fails.
116 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval) \
118 if (ctx->Driver.CurrentSavePrimitive <= GL_POLYGON || \
119 ctx->Driver.CurrentSavePrimitive == PRIM_INSIDE_UNKNOWN_PRIM) { \
120 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \
126 * Macro to assert that the API call was made outside the
127 * glBegin()/glEnd() pair.
129 * \param ctx GL context.
131 #define ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx) \
133 if (ctx->Driver.CurrentSavePrimitive <= GL_POLYGON || \
134 ctx->Driver.CurrentSavePrimitive == PRIM_INSIDE_UNKNOWN_PRIM) { \
135 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \
141 * Macro to assert that the API call was made outside the
142 * glBegin()/glEnd() pair and flush the vertices.
144 * \param ctx GL context.
146 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx) \
148 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx); \
149 SAVE_FLUSH_VERTICES(ctx); \
153 * Macro to assert that the API call was made outside the
154 * glBegin()/glEnd() pair and flush the vertices, with return value.
156 * \param ctx GL context.
157 * \param retval value to return value in case the assertion fails.
159 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval)\
161 ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval); \
162 SAVE_FLUSH_VERTICES(ctx); \
168 * Display list opcodes.
170 * The fact that these identifiers are assigned consecutive
171 * integer values starting at 0 is very important, see InstSize array usage)
175 OPCODE_INVALID
= -1, /* Force signed enum */
181 OPCODE_BLEND_EQUATION
,
182 OPCODE_BLEND_EQUATION_SEPARATE
,
183 OPCODE_BLEND_FUNC_SEPARATE
,
185 OPCODE_CALL_LIST_OFFSET
,
191 OPCODE_CLEAR_STENCIL
,
194 OPCODE_COLOR_MATERIAL
,
196 OPCODE_COLOR_TABLE_PARAMETER_FV
,
197 OPCODE_COLOR_TABLE_PARAMETER_IV
,
198 OPCODE_COLOR_SUB_TABLE
,
199 OPCODE_CONVOLUTION_FILTER_1D
,
200 OPCODE_CONVOLUTION_FILTER_2D
,
201 OPCODE_CONVOLUTION_PARAMETER_I
,
202 OPCODE_CONVOLUTION_PARAMETER_IV
,
203 OPCODE_CONVOLUTION_PARAMETER_F
,
204 OPCODE_CONVOLUTION_PARAMETER_FV
,
205 OPCODE_COPY_COLOR_SUB_TABLE
,
206 OPCODE_COPY_COLOR_TABLE
,
208 OPCODE_COPY_TEX_IMAGE1D
,
209 OPCODE_COPY_TEX_IMAGE2D
,
210 OPCODE_COPY_TEX_SUB_IMAGE1D
,
211 OPCODE_COPY_TEX_SUB_IMAGE2D
,
212 OPCODE_COPY_TEX_SUB_IMAGE3D
,
235 OPCODE_LOAD_IDENTITY
,
249 OPCODE_PIXEL_TRANSFER
,
252 OPCODE_POINT_PARAMETERS
,
254 OPCODE_POLYGON_STIPPLE
,
255 OPCODE_POLYGON_OFFSET
,
259 OPCODE_PRIORITIZE_TEXTURE
,
265 OPCODE_RESET_HISTOGRAM
,
266 OPCODE_RESET_MIN_MAX
,
270 OPCODE_SELECT_TEXTURE_SGIS
,
271 OPCODE_SELECT_TEXTURE_COORD_SET
,
282 OPCODE_TEX_SUB_IMAGE1D
,
283 OPCODE_TEX_SUB_IMAGE2D
,
284 OPCODE_TEX_SUB_IMAGE3D
,
288 /* GL_ARB_multitexture */
289 OPCODE_ACTIVE_TEXTURE
,
290 /* GL_ARB_texture_compression */
291 OPCODE_COMPRESSED_TEX_IMAGE_1D
,
292 OPCODE_COMPRESSED_TEX_IMAGE_2D
,
293 OPCODE_COMPRESSED_TEX_IMAGE_3D
,
294 OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
,
295 OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
,
296 OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
,
297 /* GL_ARB_multisample */
298 OPCODE_SAMPLE_COVERAGE
,
299 /* GL_ARB_window_pos */
300 OPCODE_WINDOW_POS_ARB
,
301 /* GL_NV_vertex_program */
302 OPCODE_BIND_PROGRAM_NV
,
303 OPCODE_EXECUTE_PROGRAM_NV
,
304 OPCODE_REQUEST_RESIDENT_PROGRAMS_NV
,
305 OPCODE_LOAD_PROGRAM_NV
,
306 OPCODE_TRACK_MATRIX_NV
,
307 /* GL_NV_fragment_program */
308 OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
,
309 OPCODE_PROGRAM_NAMED_PARAMETER_NV
,
310 /* GL_EXT_stencil_two_side */
311 OPCODE_ACTIVE_STENCIL_FACE_EXT
,
312 /* GL_EXT_depth_bounds_test */
313 OPCODE_DEPTH_BOUNDS_EXT
,
314 /* GL_ARB_vertex/fragment_program */
315 OPCODE_PROGRAM_STRING_ARB
,
316 OPCODE_PROGRAM_ENV_PARAMETER_ARB
,
317 /* GL_ARB_occlusion_query */
318 OPCODE_BEGIN_QUERY_ARB
,
319 OPCODE_END_QUERY_ARB
,
320 /* GL_ARB_draw_buffers */
321 OPCODE_DRAW_BUFFERS_ARB
,
322 /* GL_ATI_fragment_shader */
323 OPCODE_BIND_FRAGMENT_SHADER_ATI
,
324 OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
,
326 OPCODE_STENCIL_FUNC_SEPARATE
,
327 OPCODE_STENCIL_OP_SEPARATE
,
328 OPCODE_STENCIL_MASK_SEPARATE
,
330 /* GL_EXT_framebuffer_blit */
331 OPCODE_BLIT_FRAMEBUFFER
,
333 /* Vertex attributes -- fallback for when optimized display
334 * list build isn't active.
353 /* The following three are meta instructions */
354 OPCODE_ERROR
, /* raise compiled-in error */
365 * Display list instructions are stored as sequences of "nodes". Nodes
366 * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
367 * are linked together with a pointer.
369 * Each instruction in the display list is stored as a sequence of
370 * contiguous nodes in memory.
371 * Each node is the union of a variety of data types.
386 void *next
; /* If prev node's opcode==OPCODE_CONTINUE */
391 * How many nodes to allocate at a time.
393 * \note Reduced now that we hold vertices etc. elsewhere.
395 #define BLOCK_SIZE 256
400 * Number of nodes of storage needed for each instruction.
401 * Sizes for dynamically allocated opcodes are stored in the context struct.
403 static GLuint InstSize
[OPCODE_END_OF_LIST
+ 1];
405 void mesa_print_display_list(GLuint list
);
408 /**********************************************************************/
409 /***** Private *****/
410 /**********************************************************************/
414 * Make an empty display list. This is used by glGenLists() to
415 * reserve display list IDs.
417 static struct mesa_display_list
*
418 make_list(GLuint list
, GLuint count
)
420 struct mesa_display_list
*dlist
= CALLOC_STRUCT(mesa_display_list
);
422 dlist
->node
= (Node
*) _mesa_malloc(sizeof(Node
) * count
);
423 dlist
->node
[0].opcode
= OPCODE_END_OF_LIST
;
429 * Lookup function to just encapsulate casting.
431 static INLINE
struct mesa_display_list
*
432 lookup_list(GLcontext
*ctx
, GLuint list
)
434 return (struct mesa_display_list
*)
435 _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
441 * Delete the named display list, but don't remove from hash table.
442 * \param dlist - display list pointer
445 _mesa_delete_list(GLcontext
*ctx
, struct mesa_display_list
*dlist
)
450 n
= block
= dlist
->node
;
452 done
= block
? GL_FALSE
: GL_TRUE
;
455 /* check for extension opcodes first */
457 GLint i
= (GLint
) n
[0].opcode
- (GLint
) OPCODE_EXT_0
;
458 if (i
>= 0 && i
< (GLint
) ctx
->ListExt
.NumOpcodes
) {
459 ctx
->ListExt
.Opcode
[i
].Destroy(ctx
, &n
[1]);
460 n
+= ctx
->ListExt
.Opcode
[i
].Size
;
463 switch (n
[0].opcode
) {
464 /* for some commands, we need to free malloc'd memory */
466 _mesa_free(n
[6].data
);
467 n
+= InstSize
[n
[0].opcode
];
470 _mesa_free(n
[10].data
);
471 n
+= InstSize
[n
[0].opcode
];
473 case OPCODE_DRAW_PIXELS
:
474 _mesa_free(n
[5].data
);
475 n
+= InstSize
[n
[0].opcode
];
478 _mesa_free(n
[7].data
);
479 n
+= InstSize
[n
[0].opcode
];
481 case OPCODE_COLOR_TABLE
:
482 _mesa_free(n
[6].data
);
483 n
+= InstSize
[n
[0].opcode
];
485 case OPCODE_COLOR_SUB_TABLE
:
486 _mesa_free(n
[6].data
);
487 n
+= InstSize
[n
[0].opcode
];
489 case OPCODE_CONVOLUTION_FILTER_1D
:
490 _mesa_free(n
[6].data
);
491 n
+= InstSize
[n
[0].opcode
];
493 case OPCODE_CONVOLUTION_FILTER_2D
:
494 _mesa_free(n
[7].data
);
495 n
+= InstSize
[n
[0].opcode
];
497 case OPCODE_POLYGON_STIPPLE
:
498 _mesa_free(n
[1].data
);
499 n
+= InstSize
[n
[0].opcode
];
501 case OPCODE_TEX_IMAGE1D
:
502 _mesa_free(n
[8].data
);
503 n
+= InstSize
[n
[0].opcode
];
505 case OPCODE_TEX_IMAGE2D
:
506 _mesa_free(n
[9].data
);
507 n
+= InstSize
[n
[0].opcode
];
509 case OPCODE_TEX_IMAGE3D
:
510 _mesa_free(n
[10].data
);
511 n
+= InstSize
[n
[0].opcode
];
513 case OPCODE_TEX_SUB_IMAGE1D
:
514 _mesa_free(n
[7].data
);
515 n
+= InstSize
[n
[0].opcode
];
517 case OPCODE_TEX_SUB_IMAGE2D
:
518 _mesa_free(n
[9].data
);
519 n
+= InstSize
[n
[0].opcode
];
521 case OPCODE_TEX_SUB_IMAGE3D
:
522 _mesa_free(n
[11].data
);
523 n
+= InstSize
[n
[0].opcode
];
525 case OPCODE_COMPRESSED_TEX_IMAGE_1D
:
526 _mesa_free(n
[7].data
);
527 n
+= InstSize
[n
[0].opcode
];
529 case OPCODE_COMPRESSED_TEX_IMAGE_2D
:
530 _mesa_free(n
[8].data
);
531 n
+= InstSize
[n
[0].opcode
];
533 case OPCODE_COMPRESSED_TEX_IMAGE_3D
:
534 _mesa_free(n
[9].data
);
535 n
+= InstSize
[n
[0].opcode
];
537 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
:
538 _mesa_free(n
[7].data
);
539 n
+= InstSize
[n
[0].opcode
];
541 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
:
542 _mesa_free(n
[9].data
);
543 n
+= InstSize
[n
[0].opcode
];
545 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
:
546 _mesa_free(n
[11].data
);
547 n
+= InstSize
[n
[0].opcode
];
549 #if FEATURE_NV_vertex_program
550 case OPCODE_LOAD_PROGRAM_NV
:
551 _mesa_free(n
[4].data
); /* program string */
552 n
+= InstSize
[n
[0].opcode
];
554 case OPCODE_REQUEST_RESIDENT_PROGRAMS_NV
:
555 _mesa_free(n
[2].data
); /* array of program ids */
556 n
+= InstSize
[n
[0].opcode
];
559 #if FEATURE_NV_fragment_program
560 case OPCODE_PROGRAM_NAMED_PARAMETER_NV
:
561 _mesa_free(n
[3].data
); /* parameter name */
562 n
+= InstSize
[n
[0].opcode
];
565 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
566 case OPCODE_PROGRAM_STRING_ARB
:
567 _mesa_free(n
[4].data
); /* program string */
568 n
+= InstSize
[n
[0].opcode
];
571 case OPCODE_CONTINUE
:
572 n
= (Node
*) n
[1].next
;
576 case OPCODE_END_OF_LIST
:
581 /* Most frequent case */
582 n
+= InstSize
[n
[0].opcode
];
593 * Destroy a display list and remove from hash table.
594 * \param list - display list number
597 destroy_list(GLcontext
*ctx
, GLuint list
)
599 struct mesa_display_list
*dlist
;
604 dlist
= lookup_list(ctx
, list
);
608 _mesa_delete_list(ctx
, dlist
);
609 _mesa_HashRemove(ctx
->Shared
->DisplayList
, list
);
614 * Translate the nth element of list from type to GLuint.
617 translate_id(GLsizei n
, GLenum type
, const GLvoid
* list
)
629 bptr
= (GLbyte
*) list
;
630 return (GLuint
) *(bptr
+ n
);
631 case GL_UNSIGNED_BYTE
:
632 ubptr
= (GLubyte
*) list
;
633 return (GLuint
) *(ubptr
+ n
);
635 sptr
= (GLshort
*) list
;
636 return (GLuint
) *(sptr
+ n
);
637 case GL_UNSIGNED_SHORT
:
638 usptr
= (GLushort
*) list
;
639 return (GLuint
) *(usptr
+ n
);
641 iptr
= (GLint
*) list
;
642 return (GLuint
) *(iptr
+ n
);
643 case GL_UNSIGNED_INT
:
644 uiptr
= (GLuint
*) list
;
645 return (GLuint
) *(uiptr
+ n
);
647 fptr
= (GLfloat
*) list
;
648 return (GLuint
) *(fptr
+ n
);
650 ubptr
= ((GLubyte
*) list
) + 2 * n
;
651 return (GLuint
) *ubptr
* 256 + (GLuint
) * (ubptr
+ 1);
653 ubptr
= ((GLubyte
*) list
) + 3 * n
;
654 return (GLuint
) * ubptr
* 65536
655 + (GLuint
) *(ubptr
+ 1) * 256 + (GLuint
) * (ubptr
+ 2);
657 ubptr
= ((GLubyte
*) list
) + 4 * n
;
658 return (GLuint
) *ubptr
* 16777216
659 + (GLuint
) *(ubptr
+ 1) * 65536
660 + (GLuint
) *(ubptr
+ 2) * 256 + (GLuint
) * (ubptr
+ 3);
669 /**********************************************************************/
671 /**********************************************************************/
674 * Wrapper for _mesa_unpack_image() that handles pixel buffer objects.
675 * \todo This won't suffice when the PBO is really in VRAM/GPU memory.
678 unpack_image(GLuint dimensions
, GLsizei width
, GLsizei height
, GLsizei depth
,
679 GLenum format
, GLenum type
, const GLvoid
* pixels
,
680 const struct gl_pixelstore_attrib
*unpack
)
682 if (unpack
->BufferObj
->Name
== 0) {
684 return _mesa_unpack_image(dimensions
, width
, height
, depth
, format
,
685 type
, pixels
, unpack
);
688 if (_mesa_validate_pbo_access
689 (dimensions
, unpack
, width
, height
, depth
, format
, type
, pixels
)) {
690 const GLubyte
*src
= ADD_POINTERS(unpack
->BufferObj
->Data
, pixels
);
691 return _mesa_unpack_image(dimensions
, width
, height
, depth
, format
,
700 * Allocate space for a display list instruction.
701 * \param opcode the instruction opcode (OPCODE_* value)
702 * \param size instruction size in bytes, not counting opcode.
703 * \return pointer to the usable data area (not including the internal
707 _mesa_alloc_instruction(GLcontext
*ctx
, GLuint opcode
, GLuint bytes
)
709 const GLuint numNodes
= 1 + (bytes
+ sizeof(Node
) - 1) / sizeof(Node
);
712 if (opcode
< (GLuint
) OPCODE_EXT_0
) {
713 if (InstSize
[opcode
] == 0) {
714 /* save instruction size now */
715 InstSize
[opcode
] = numNodes
;
718 /* make sure instruction size agrees */
719 ASSERT(numNodes
== InstSize
[opcode
]);
723 if (ctx
->ListState
.CurrentPos
+ numNodes
+ 2 > BLOCK_SIZE
) {
724 /* This block is full. Allocate a new block and chain to it */
726 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
727 n
[0].opcode
= OPCODE_CONTINUE
;
728 newblock
= (Node
*) _mesa_malloc(sizeof(Node
) * BLOCK_SIZE
);
730 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "Building display list");
733 n
[1].next
= (Node
*) newblock
;
734 ctx
->ListState
.CurrentBlock
= newblock
;
735 ctx
->ListState
.CurrentPos
= 0;
738 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
739 ctx
->ListState
.CurrentPos
+= numNodes
;
741 n
[0].opcode
= (OpCode
) opcode
;
743 return (void *) (n
+ 1); /* return ptr to node following opcode */
748 * This function allows modules and drivers to get their own opcodes
749 * for extending display list functionality.
750 * \param ctx the rendering context
751 * \param size number of bytes for storing the new display list command
752 * \param execute function to execute the new display list command
753 * \param destroy function to destroy the new display list command
754 * \param print function to print the new display list command
755 * \return the new opcode number or -1 if error
758 _mesa_alloc_opcode(GLcontext
*ctx
,
760 void (*execute
) (GLcontext
*, void *),
761 void (*destroy
) (GLcontext
*, void *),
762 void (*print
) (GLcontext
*, void *))
764 if (ctx
->ListExt
.NumOpcodes
< MAX_DLIST_EXT_OPCODES
) {
765 const GLuint i
= ctx
->ListExt
.NumOpcodes
++;
766 ctx
->ListExt
.Opcode
[i
].Size
=
767 1 + (size
+ sizeof(Node
) - 1) / sizeof(Node
);
768 ctx
->ListExt
.Opcode
[i
].Execute
= execute
;
769 ctx
->ListExt
.Opcode
[i
].Destroy
= destroy
;
770 ctx
->ListExt
.Opcode
[i
].Print
= print
;
771 return i
+ OPCODE_EXT_0
;
779 * Allocate display list instruction. Returns Node ptr to where the opcode
781 * - nParams is the number of function parameters
782 * - return value a pointer to sizeof(Node) before the actual
785 #define ALLOC_INSTRUCTION(CTX, OPCODE, NPARAMS) \
786 ((Node *)_mesa_alloc_instruction(CTX, OPCODE, (NPARAMS)*sizeof(Node)) - 1)
791 * Display List compilation functions
793 static void GLAPIENTRY
794 save_Accum(GLenum op
, GLfloat value
)
796 GET_CURRENT_CONTEXT(ctx
);
798 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
799 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ACCUM
, 2);
804 if (ctx
->ExecuteFlag
) {
805 CALL_Accum(ctx
->Exec
, (op
, value
));
810 static void GLAPIENTRY
811 save_AlphaFunc(GLenum func
, GLclampf ref
)
813 GET_CURRENT_CONTEXT(ctx
);
815 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
816 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ALPHA_FUNC
, 2);
819 n
[2].f
= (GLfloat
) ref
;
821 if (ctx
->ExecuteFlag
) {
822 CALL_AlphaFunc(ctx
->Exec
, (func
, ref
));
827 static void GLAPIENTRY
828 save_BindTexture(GLenum target
, GLuint texture
)
830 GET_CURRENT_CONTEXT(ctx
);
832 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
833 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BIND_TEXTURE
, 2);
838 if (ctx
->ExecuteFlag
) {
839 CALL_BindTexture(ctx
->Exec
, (target
, texture
));
844 static void GLAPIENTRY
845 save_Bitmap(GLsizei width
, GLsizei height
,
846 GLfloat xorig
, GLfloat yorig
,
847 GLfloat xmove
, GLfloat ymove
, const GLubyte
* pixels
)
849 GET_CURRENT_CONTEXT(ctx
);
850 GLvoid
*image
= _mesa_unpack_bitmap(width
, height
, pixels
, &ctx
->Unpack
);
852 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
853 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BITMAP
, 7);
855 n
[1].i
= (GLint
) width
;
856 n
[2].i
= (GLint
) height
;
866 if (ctx
->ExecuteFlag
) {
867 CALL_Bitmap(ctx
->Exec
, (width
, height
,
868 xorig
, yorig
, xmove
, ymove
, pixels
));
873 static void GLAPIENTRY
874 save_BlendEquation(GLenum mode
)
876 GET_CURRENT_CONTEXT(ctx
);
878 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
879 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BLEND_EQUATION
, 1);
883 if (ctx
->ExecuteFlag
) {
884 CALL_BlendEquation(ctx
->Exec
, (mode
));
889 static void GLAPIENTRY
890 save_BlendEquationSeparateEXT(GLenum modeRGB
, GLenum modeA
)
892 GET_CURRENT_CONTEXT(ctx
);
894 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
895 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BLEND_EQUATION_SEPARATE
, 2);
900 if (ctx
->ExecuteFlag
) {
901 CALL_BlendEquationSeparateEXT(ctx
->Exec
, (modeRGB
, modeA
));
906 static void GLAPIENTRY
907 save_BlendFuncSeparateEXT(GLenum sfactorRGB
, GLenum dfactorRGB
,
908 GLenum sfactorA
, GLenum dfactorA
)
910 GET_CURRENT_CONTEXT(ctx
);
912 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
913 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BLEND_FUNC_SEPARATE
, 4);
920 if (ctx
->ExecuteFlag
) {
921 CALL_BlendFuncSeparateEXT(ctx
->Exec
,
922 (sfactorRGB
, dfactorRGB
, sfactorA
, dfactorA
));
927 static void GLAPIENTRY
928 save_BlendColor(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
930 GET_CURRENT_CONTEXT(ctx
);
932 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
933 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BLEND_COLOR
, 4);
940 if (ctx
->ExecuteFlag
) {
941 CALL_BlendColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
947 _mesa_save_CallList(GLuint list
)
949 GET_CURRENT_CONTEXT(ctx
);
951 SAVE_FLUSH_VERTICES(ctx
);
953 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CALL_LIST
, 1);
958 /* After this, we don't know what begin/end state we're in:
960 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
962 if (ctx
->ExecuteFlag
) {
963 CALL_CallList(ctx
->Exec
, (list
));
969 _mesa_save_CallLists(GLsizei n
, GLenum type
, const GLvoid
* lists
)
971 GET_CURRENT_CONTEXT(ctx
);
973 GLboolean typeErrorFlag
;
975 SAVE_FLUSH_VERTICES(ctx
);
979 case GL_UNSIGNED_BYTE
:
981 case GL_UNSIGNED_SHORT
:
983 case GL_UNSIGNED_INT
:
988 typeErrorFlag
= GL_FALSE
;
991 typeErrorFlag
= GL_TRUE
;
994 for (i
= 0; i
< n
; i
++) {
995 GLuint list
= translate_id(i
, type
, lists
);
996 Node
*n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CALL_LIST_OFFSET
, 2);
999 n
[2].b
= typeErrorFlag
;
1003 /* After this, we don't know what begin/end state we're in:
1005 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
1007 if (ctx
->ExecuteFlag
) {
1008 CALL_CallLists(ctx
->Exec
, (n
, type
, lists
));
1013 static void GLAPIENTRY
1014 save_Clear(GLbitfield mask
)
1016 GET_CURRENT_CONTEXT(ctx
);
1018 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1019 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLEAR
, 1);
1023 if (ctx
->ExecuteFlag
) {
1024 CALL_Clear(ctx
->Exec
, (mask
));
1029 static void GLAPIENTRY
1030 save_ClearAccum(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
1032 GET_CURRENT_CONTEXT(ctx
);
1034 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1035 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLEAR_ACCUM
, 4);
1042 if (ctx
->ExecuteFlag
) {
1043 CALL_ClearAccum(ctx
->Exec
, (red
, green
, blue
, alpha
));
1048 static void GLAPIENTRY
1049 save_ClearColor(GLclampf red
, GLclampf green
, GLclampf blue
, GLclampf alpha
)
1051 GET_CURRENT_CONTEXT(ctx
);
1053 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1054 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLEAR_COLOR
, 4);
1061 if (ctx
->ExecuteFlag
) {
1062 CALL_ClearColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
1067 static void GLAPIENTRY
1068 save_ClearDepth(GLclampd depth
)
1070 GET_CURRENT_CONTEXT(ctx
);
1072 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1073 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLEAR_DEPTH
, 1);
1075 n
[1].f
= (GLfloat
) depth
;
1077 if (ctx
->ExecuteFlag
) {
1078 CALL_ClearDepth(ctx
->Exec
, (depth
));
1083 static void GLAPIENTRY
1084 save_ClearIndex(GLfloat c
)
1086 GET_CURRENT_CONTEXT(ctx
);
1088 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1089 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLEAR_INDEX
, 1);
1093 if (ctx
->ExecuteFlag
) {
1094 CALL_ClearIndex(ctx
->Exec
, (c
));
1099 static void GLAPIENTRY
1100 save_ClearStencil(GLint s
)
1102 GET_CURRENT_CONTEXT(ctx
);
1104 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1105 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLEAR_STENCIL
, 1);
1109 if (ctx
->ExecuteFlag
) {
1110 CALL_ClearStencil(ctx
->Exec
, (s
));
1115 static void GLAPIENTRY
1116 save_ClipPlane(GLenum plane
, const GLdouble
* equ
)
1118 GET_CURRENT_CONTEXT(ctx
);
1120 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1121 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLIP_PLANE
, 5);
1124 n
[2].f
= (GLfloat
) equ
[0];
1125 n
[3].f
= (GLfloat
) equ
[1];
1126 n
[4].f
= (GLfloat
) equ
[2];
1127 n
[5].f
= (GLfloat
) equ
[3];
1129 if (ctx
->ExecuteFlag
) {
1130 CALL_ClipPlane(ctx
->Exec
, (plane
, equ
));
1136 static void GLAPIENTRY
1137 save_ColorMask(GLboolean red
, GLboolean green
,
1138 GLboolean blue
, GLboolean alpha
)
1140 GET_CURRENT_CONTEXT(ctx
);
1142 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1143 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COLOR_MASK
, 4);
1150 if (ctx
->ExecuteFlag
) {
1151 CALL_ColorMask(ctx
->Exec
, (red
, green
, blue
, alpha
));
1156 static void GLAPIENTRY
1157 save_ColorMaterial(GLenum face
, GLenum mode
)
1159 GET_CURRENT_CONTEXT(ctx
);
1161 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1163 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COLOR_MATERIAL
, 2);
1168 if (ctx
->ExecuteFlag
) {
1169 CALL_ColorMaterial(ctx
->Exec
, (face
, mode
));
1174 static void GLAPIENTRY
1175 save_ColorTable(GLenum target
, GLenum internalFormat
,
1176 GLsizei width
, GLenum format
, GLenum type
,
1177 const GLvoid
* table
)
1179 GET_CURRENT_CONTEXT(ctx
);
1180 if (_mesa_is_proxy_texture(target
)) {
1181 /* execute immediately */
1182 CALL_ColorTable(ctx
->Exec
, (target
, internalFormat
, width
,
1183 format
, type
, table
));
1186 GLvoid
*image
= unpack_image(1, width
, 1, 1, format
, type
, table
,
1189 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1190 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COLOR_TABLE
, 6);
1193 n
[2].e
= internalFormat
;
1202 if (ctx
->ExecuteFlag
) {
1203 CALL_ColorTable(ctx
->Exec
, (target
, internalFormat
, width
,
1204 format
, type
, table
));
1211 static void GLAPIENTRY
1212 save_ColorTableParameterfv(GLenum target
, GLenum pname
,
1213 const GLfloat
*params
)
1215 GET_CURRENT_CONTEXT(ctx
);
1218 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1220 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COLOR_TABLE_PARAMETER_FV
, 6);
1225 if (pname
== GL_COLOR_TABLE_SGI
||
1226 pname
== GL_POST_CONVOLUTION_COLOR_TABLE_SGI
||
1227 pname
== GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI
||
1228 pname
== GL_TEXTURE_COLOR_TABLE_SGI
) {
1235 if (ctx
->ExecuteFlag
) {
1236 CALL_ColorTableParameterfv(ctx
->Exec
, (target
, pname
, params
));
1241 static void GLAPIENTRY
1242 save_ColorTableParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
1244 GET_CURRENT_CONTEXT(ctx
);
1247 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1249 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COLOR_TABLE_PARAMETER_IV
, 6);
1254 if (pname
== GL_COLOR_TABLE_SGI
||
1255 pname
== GL_POST_CONVOLUTION_COLOR_TABLE_SGI
||
1256 pname
== GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI
||
1257 pname
== GL_TEXTURE_COLOR_TABLE_SGI
) {
1264 if (ctx
->ExecuteFlag
) {
1265 CALL_ColorTableParameteriv(ctx
->Exec
, (target
, pname
, params
));
1271 static void GLAPIENTRY
1272 save_ColorSubTable(GLenum target
, GLsizei start
, GLsizei count
,
1273 GLenum format
, GLenum type
, const GLvoid
* table
)
1275 GET_CURRENT_CONTEXT(ctx
);
1276 GLvoid
*image
= unpack_image(1, count
, 1, 1, format
, type
, table
,
1279 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1280 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COLOR_SUB_TABLE
, 6);
1292 if (ctx
->ExecuteFlag
) {
1293 CALL_ColorSubTable(ctx
->Exec
,
1294 (target
, start
, count
, format
, type
, table
));
1299 static void GLAPIENTRY
1300 save_CopyColorSubTable(GLenum target
, GLsizei start
,
1301 GLint x
, GLint y
, GLsizei width
)
1303 GET_CURRENT_CONTEXT(ctx
);
1306 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1307 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_COLOR_SUB_TABLE
, 5);
1315 if (ctx
->ExecuteFlag
) {
1316 CALL_CopyColorSubTable(ctx
->Exec
, (target
, start
, x
, y
, width
));
1321 static void GLAPIENTRY
1322 save_CopyColorTable(GLenum target
, GLenum internalformat
,
1323 GLint x
, GLint y
, GLsizei width
)
1325 GET_CURRENT_CONTEXT(ctx
);
1328 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1329 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_COLOR_TABLE
, 5);
1332 n
[2].e
= internalformat
;
1337 if (ctx
->ExecuteFlag
) {
1338 CALL_CopyColorTable(ctx
->Exec
, (target
, internalformat
, x
, y
, width
));
1343 static void GLAPIENTRY
1344 save_ConvolutionFilter1D(GLenum target
, GLenum internalFormat
, GLsizei width
,
1345 GLenum format
, GLenum type
, const GLvoid
* filter
)
1347 GET_CURRENT_CONTEXT(ctx
);
1348 GLvoid
*image
= unpack_image(1, width
, 1, 1, format
, type
, filter
,
1351 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1352 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CONVOLUTION_FILTER_1D
, 6);
1355 n
[2].e
= internalFormat
;
1364 if (ctx
->ExecuteFlag
) {
1365 CALL_ConvolutionFilter1D(ctx
->Exec
, (target
, internalFormat
, width
,
1366 format
, type
, filter
));
1371 static void GLAPIENTRY
1372 save_ConvolutionFilter2D(GLenum target
, GLenum internalFormat
,
1373 GLsizei width
, GLsizei height
, GLenum format
,
1374 GLenum type
, const GLvoid
* filter
)
1376 GET_CURRENT_CONTEXT(ctx
);
1377 GLvoid
*image
= unpack_image(2, width
, height
, 1, format
, type
, filter
,
1380 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1381 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CONVOLUTION_FILTER_2D
, 7);
1384 n
[2].e
= internalFormat
;
1394 if (ctx
->ExecuteFlag
) {
1395 CALL_ConvolutionFilter2D(ctx
->Exec
,
1396 (target
, internalFormat
, width
, height
, format
,
1402 static void GLAPIENTRY
1403 save_ConvolutionParameteri(GLenum target
, GLenum pname
, GLint param
)
1405 GET_CURRENT_CONTEXT(ctx
);
1407 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1408 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CONVOLUTION_PARAMETER_I
, 3);
1414 if (ctx
->ExecuteFlag
) {
1415 CALL_ConvolutionParameteri(ctx
->Exec
, (target
, pname
, param
));
1420 static void GLAPIENTRY
1421 save_ConvolutionParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
1423 GET_CURRENT_CONTEXT(ctx
);
1425 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1426 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CONVOLUTION_PARAMETER_IV
, 6);
1431 if (pname
== GL_CONVOLUTION_BORDER_COLOR
||
1432 pname
== GL_CONVOLUTION_FILTER_SCALE
||
1433 pname
== GL_CONVOLUTION_FILTER_BIAS
) {
1439 n
[4].i
= n
[5].i
= n
[6].i
= 0;
1442 if (ctx
->ExecuteFlag
) {
1443 CALL_ConvolutionParameteriv(ctx
->Exec
, (target
, pname
, params
));
1448 static void GLAPIENTRY
1449 save_ConvolutionParameterf(GLenum target
, GLenum pname
, GLfloat param
)
1451 GET_CURRENT_CONTEXT(ctx
);
1453 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1454 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CONVOLUTION_PARAMETER_F
, 3);
1460 if (ctx
->ExecuteFlag
) {
1461 CALL_ConvolutionParameterf(ctx
->Exec
, (target
, pname
, param
));
1466 static void GLAPIENTRY
1467 save_ConvolutionParameterfv(GLenum target
, GLenum pname
,
1468 const GLfloat
*params
)
1470 GET_CURRENT_CONTEXT(ctx
);
1472 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1473 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CONVOLUTION_PARAMETER_FV
, 6);
1478 if (pname
== GL_CONVOLUTION_BORDER_COLOR
||
1479 pname
== GL_CONVOLUTION_FILTER_SCALE
||
1480 pname
== GL_CONVOLUTION_FILTER_BIAS
) {
1486 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
1489 if (ctx
->ExecuteFlag
) {
1490 CALL_ConvolutionParameterfv(ctx
->Exec
, (target
, pname
, params
));
1495 static void GLAPIENTRY
1496 save_CopyPixels(GLint x
, GLint y
, GLsizei width
, GLsizei height
, GLenum type
)
1498 GET_CURRENT_CONTEXT(ctx
);
1500 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1501 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_PIXELS
, 5);
1505 n
[3].i
= (GLint
) width
;
1506 n
[4].i
= (GLint
) height
;
1509 if (ctx
->ExecuteFlag
) {
1510 CALL_CopyPixels(ctx
->Exec
, (x
, y
, width
, height
, type
));
1516 static void GLAPIENTRY
1517 save_CopyTexImage1D(GLenum target
, GLint level
, GLenum internalformat
,
1518 GLint x
, GLint y
, GLsizei width
, GLint border
)
1520 GET_CURRENT_CONTEXT(ctx
);
1522 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1523 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_TEX_IMAGE1D
, 7);
1527 n
[3].e
= internalformat
;
1533 if (ctx
->ExecuteFlag
) {
1534 CALL_CopyTexImage1D(ctx
->Exec
, (target
, level
, internalformat
,
1535 x
, y
, width
, border
));
1540 static void GLAPIENTRY
1541 save_CopyTexImage2D(GLenum target
, GLint level
,
1542 GLenum internalformat
,
1543 GLint x
, GLint y
, GLsizei width
,
1544 GLsizei height
, GLint border
)
1546 GET_CURRENT_CONTEXT(ctx
);
1548 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1549 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_TEX_IMAGE2D
, 8);
1553 n
[3].e
= internalformat
;
1560 if (ctx
->ExecuteFlag
) {
1561 CALL_CopyTexImage2D(ctx
->Exec
, (target
, level
, internalformat
,
1562 x
, y
, width
, height
, border
));
1568 static void GLAPIENTRY
1569 save_CopyTexSubImage1D(GLenum target
, GLint level
,
1570 GLint xoffset
, GLint x
, GLint y
, GLsizei width
)
1572 GET_CURRENT_CONTEXT(ctx
);
1574 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1575 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_TEX_SUB_IMAGE1D
, 6);
1584 if (ctx
->ExecuteFlag
) {
1585 CALL_CopyTexSubImage1D(ctx
->Exec
,
1586 (target
, level
, xoffset
, x
, y
, width
));
1591 static void GLAPIENTRY
1592 save_CopyTexSubImage2D(GLenum target
, GLint level
,
1593 GLint xoffset
, GLint yoffset
,
1594 GLint x
, GLint y
, GLsizei width
, GLint height
)
1596 GET_CURRENT_CONTEXT(ctx
);
1598 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1599 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_TEX_SUB_IMAGE2D
, 8);
1610 if (ctx
->ExecuteFlag
) {
1611 CALL_CopyTexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
1612 x
, y
, width
, height
));
1617 static void GLAPIENTRY
1618 save_CopyTexSubImage3D(GLenum target
, GLint level
,
1619 GLint xoffset
, GLint yoffset
, GLint zoffset
,
1620 GLint x
, GLint y
, GLsizei width
, GLint height
)
1622 GET_CURRENT_CONTEXT(ctx
);
1624 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1625 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_TEX_SUB_IMAGE3D
, 9);
1637 if (ctx
->ExecuteFlag
) {
1638 CALL_CopyTexSubImage3D(ctx
->Exec
, (target
, level
,
1639 xoffset
, yoffset
, zoffset
,
1640 x
, y
, width
, height
));
1645 static void GLAPIENTRY
1646 save_CullFace(GLenum mode
)
1648 GET_CURRENT_CONTEXT(ctx
);
1650 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1651 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CULL_FACE
, 1);
1655 if (ctx
->ExecuteFlag
) {
1656 CALL_CullFace(ctx
->Exec
, (mode
));
1661 static void GLAPIENTRY
1662 save_DepthFunc(GLenum func
)
1664 GET_CURRENT_CONTEXT(ctx
);
1666 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1667 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DEPTH_FUNC
, 1);
1671 if (ctx
->ExecuteFlag
) {
1672 CALL_DepthFunc(ctx
->Exec
, (func
));
1677 static void GLAPIENTRY
1678 save_DepthMask(GLboolean mask
)
1680 GET_CURRENT_CONTEXT(ctx
);
1682 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1683 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DEPTH_MASK
, 1);
1687 if (ctx
->ExecuteFlag
) {
1688 CALL_DepthMask(ctx
->Exec
, (mask
));
1693 static void GLAPIENTRY
1694 save_DepthRange(GLclampd nearval
, GLclampd farval
)
1696 GET_CURRENT_CONTEXT(ctx
);
1698 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1699 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DEPTH_RANGE
, 2);
1701 n
[1].f
= (GLfloat
) nearval
;
1702 n
[2].f
= (GLfloat
) farval
;
1704 if (ctx
->ExecuteFlag
) {
1705 CALL_DepthRange(ctx
->Exec
, (nearval
, farval
));
1710 static void GLAPIENTRY
1711 save_Disable(GLenum cap
)
1713 GET_CURRENT_CONTEXT(ctx
);
1715 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1716 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DISABLE
, 1);
1720 if (ctx
->ExecuteFlag
) {
1721 CALL_Disable(ctx
->Exec
, (cap
));
1726 static void GLAPIENTRY
1727 save_DrawBuffer(GLenum mode
)
1729 GET_CURRENT_CONTEXT(ctx
);
1731 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1732 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DRAW_BUFFER
, 1);
1736 if (ctx
->ExecuteFlag
) {
1737 CALL_DrawBuffer(ctx
->Exec
, (mode
));
1742 static void GLAPIENTRY
1743 save_DrawPixels(GLsizei width
, GLsizei height
,
1744 GLenum format
, GLenum type
, const GLvoid
* pixels
)
1746 GET_CURRENT_CONTEXT(ctx
);
1747 GLvoid
*image
= unpack_image(2, width
, height
, 1, format
, type
,
1748 pixels
, &ctx
->Unpack
);
1750 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1751 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DRAW_PIXELS
, 5);
1762 if (ctx
->ExecuteFlag
) {
1763 CALL_DrawPixels(ctx
->Exec
, (width
, height
, format
, type
, pixels
));
1769 static void GLAPIENTRY
1770 save_Enable(GLenum cap
)
1772 GET_CURRENT_CONTEXT(ctx
);
1774 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1775 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ENABLE
, 1);
1779 if (ctx
->ExecuteFlag
) {
1780 CALL_Enable(ctx
->Exec
, (cap
));
1786 static void GLAPIENTRY
1787 _mesa_save_EvalMesh1(GLenum mode
, GLint i1
, GLint i2
)
1789 GET_CURRENT_CONTEXT(ctx
);
1791 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1792 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVALMESH1
, 3);
1798 if (ctx
->ExecuteFlag
) {
1799 CALL_EvalMesh1(ctx
->Exec
, (mode
, i1
, i2
));
1804 static void GLAPIENTRY
1805 _mesa_save_EvalMesh2(GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
1807 GET_CURRENT_CONTEXT(ctx
);
1809 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1810 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVALMESH2
, 5);
1818 if (ctx
->ExecuteFlag
) {
1819 CALL_EvalMesh2(ctx
->Exec
, (mode
, i1
, i2
, j1
, j2
));
1826 static void GLAPIENTRY
1827 save_Fogfv(GLenum pname
, const GLfloat
*params
)
1829 GET_CURRENT_CONTEXT(ctx
);
1831 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1832 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_FOG
, 5);
1840 if (ctx
->ExecuteFlag
) {
1841 CALL_Fogfv(ctx
->Exec
, (pname
, params
));
1846 static void GLAPIENTRY
1847 save_Fogf(GLenum pname
, GLfloat param
)
1849 save_Fogfv(pname
, ¶m
);
1853 static void GLAPIENTRY
1854 save_Fogiv(GLenum pname
, const GLint
*params
)
1859 case GL_FOG_DENSITY
:
1863 p
[0] = (GLfloat
) *params
;
1866 p
[0] = INT_TO_FLOAT(params
[0]);
1867 p
[1] = INT_TO_FLOAT(params
[1]);
1868 p
[2] = INT_TO_FLOAT(params
[2]);
1869 p
[3] = INT_TO_FLOAT(params
[3]);
1872 /* Error will be caught later in gl_Fogfv */
1875 save_Fogfv(pname
, p
);
1879 static void GLAPIENTRY
1880 save_Fogi(GLenum pname
, GLint param
)
1882 save_Fogiv(pname
, ¶m
);
1886 static void GLAPIENTRY
1887 save_FrontFace(GLenum mode
)
1889 GET_CURRENT_CONTEXT(ctx
);
1891 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1892 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_FRONT_FACE
, 1);
1896 if (ctx
->ExecuteFlag
) {
1897 CALL_FrontFace(ctx
->Exec
, (mode
));
1902 static void GLAPIENTRY
1903 save_Frustum(GLdouble left
, GLdouble right
,
1904 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
1906 GET_CURRENT_CONTEXT(ctx
);
1908 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1909 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_FRUSTUM
, 6);
1911 n
[1].f
= (GLfloat
) left
;
1912 n
[2].f
= (GLfloat
) right
;
1913 n
[3].f
= (GLfloat
) bottom
;
1914 n
[4].f
= (GLfloat
) top
;
1915 n
[5].f
= (GLfloat
) nearval
;
1916 n
[6].f
= (GLfloat
) farval
;
1918 if (ctx
->ExecuteFlag
) {
1919 CALL_Frustum(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
1924 static void GLAPIENTRY
1925 save_Hint(GLenum target
, GLenum mode
)
1927 GET_CURRENT_CONTEXT(ctx
);
1929 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1930 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_HINT
, 2);
1935 if (ctx
->ExecuteFlag
) {
1936 CALL_Hint(ctx
->Exec
, (target
, mode
));
1941 static void GLAPIENTRY
1942 save_Histogram(GLenum target
, GLsizei width
, GLenum internalFormat
,
1945 GET_CURRENT_CONTEXT(ctx
);
1948 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1949 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_HISTOGRAM
, 4);
1953 n
[3].e
= internalFormat
;
1956 if (ctx
->ExecuteFlag
) {
1957 CALL_Histogram(ctx
->Exec
, (target
, width
, internalFormat
, sink
));
1962 static void GLAPIENTRY
1963 save_IndexMask(GLuint mask
)
1965 GET_CURRENT_CONTEXT(ctx
);
1967 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1968 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_INDEX_MASK
, 1);
1972 if (ctx
->ExecuteFlag
) {
1973 CALL_IndexMask(ctx
->Exec
, (mask
));
1978 static void GLAPIENTRY
1979 save_InitNames(void)
1981 GET_CURRENT_CONTEXT(ctx
);
1982 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1983 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_INIT_NAMES
, 0);
1984 if (ctx
->ExecuteFlag
) {
1985 CALL_InitNames(ctx
->Exec
, ());
1990 static void GLAPIENTRY
1991 save_Lightfv(GLenum light
, GLenum pname
, const GLfloat
*params
)
1993 GET_CURRENT_CONTEXT(ctx
);
1995 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1996 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LIGHT
, 6);
2014 case GL_SPOT_DIRECTION
:
2017 case GL_SPOT_EXPONENT
:
2020 case GL_SPOT_CUTOFF
:
2023 case GL_CONSTANT_ATTENUATION
:
2026 case GL_LINEAR_ATTENUATION
:
2029 case GL_QUADRATIC_ATTENUATION
:
2035 for (i
= 0; i
< nParams
; i
++) {
2036 n
[3 + i
].f
= params
[i
];
2039 if (ctx
->ExecuteFlag
) {
2040 CALL_Lightfv(ctx
->Exec
, (light
, pname
, params
));
2045 static void GLAPIENTRY
2046 save_Lightf(GLenum light
, GLenum pname
, GLfloat params
)
2048 save_Lightfv(light
, pname
, ¶ms
);
2052 static void GLAPIENTRY
2053 save_Lightiv(GLenum light
, GLenum pname
, const GLint
*params
)
2060 fparam
[0] = INT_TO_FLOAT(params
[0]);
2061 fparam
[1] = INT_TO_FLOAT(params
[1]);
2062 fparam
[2] = INT_TO_FLOAT(params
[2]);
2063 fparam
[3] = INT_TO_FLOAT(params
[3]);
2066 fparam
[0] = (GLfloat
) params
[0];
2067 fparam
[1] = (GLfloat
) params
[1];
2068 fparam
[2] = (GLfloat
) params
[2];
2069 fparam
[3] = (GLfloat
) params
[3];
2071 case GL_SPOT_DIRECTION
:
2072 fparam
[0] = (GLfloat
) params
[0];
2073 fparam
[1] = (GLfloat
) params
[1];
2074 fparam
[2] = (GLfloat
) params
[2];
2076 case GL_SPOT_EXPONENT
:
2077 case GL_SPOT_CUTOFF
:
2078 case GL_CONSTANT_ATTENUATION
:
2079 case GL_LINEAR_ATTENUATION
:
2080 case GL_QUADRATIC_ATTENUATION
:
2081 fparam
[0] = (GLfloat
) params
[0];
2084 /* error will be caught later in gl_Lightfv */
2087 save_Lightfv(light
, pname
, fparam
);
2091 static void GLAPIENTRY
2092 save_Lighti(GLenum light
, GLenum pname
, GLint param
)
2094 save_Lightiv(light
, pname
, ¶m
);
2098 static void GLAPIENTRY
2099 save_LightModelfv(GLenum pname
, const GLfloat
*params
)
2101 GET_CURRENT_CONTEXT(ctx
);
2103 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2104 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LIGHT_MODEL
, 5);
2112 if (ctx
->ExecuteFlag
) {
2113 CALL_LightModelfv(ctx
->Exec
, (pname
, params
));
2118 static void GLAPIENTRY
2119 save_LightModelf(GLenum pname
, GLfloat param
)
2121 save_LightModelfv(pname
, ¶m
);
2125 static void GLAPIENTRY
2126 save_LightModeliv(GLenum pname
, const GLint
*params
)
2130 case GL_LIGHT_MODEL_AMBIENT
:
2131 fparam
[0] = INT_TO_FLOAT(params
[0]);
2132 fparam
[1] = INT_TO_FLOAT(params
[1]);
2133 fparam
[2] = INT_TO_FLOAT(params
[2]);
2134 fparam
[3] = INT_TO_FLOAT(params
[3]);
2136 case GL_LIGHT_MODEL_LOCAL_VIEWER
:
2137 case GL_LIGHT_MODEL_TWO_SIDE
:
2138 case GL_LIGHT_MODEL_COLOR_CONTROL
:
2139 fparam
[0] = (GLfloat
) params
[0];
2142 /* Error will be caught later in gl_LightModelfv */
2145 save_LightModelfv(pname
, fparam
);
2149 static void GLAPIENTRY
2150 save_LightModeli(GLenum pname
, GLint param
)
2152 save_LightModeliv(pname
, ¶m
);
2156 static void GLAPIENTRY
2157 save_LineStipple(GLint factor
, GLushort pattern
)
2159 GET_CURRENT_CONTEXT(ctx
);
2161 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2162 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LINE_STIPPLE
, 2);
2167 if (ctx
->ExecuteFlag
) {
2168 CALL_LineStipple(ctx
->Exec
, (factor
, pattern
));
2173 static void GLAPIENTRY
2174 save_LineWidth(GLfloat width
)
2176 GET_CURRENT_CONTEXT(ctx
);
2178 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2179 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LINE_WIDTH
, 1);
2183 if (ctx
->ExecuteFlag
) {
2184 CALL_LineWidth(ctx
->Exec
, (width
));
2189 static void GLAPIENTRY
2190 save_ListBase(GLuint base
)
2192 GET_CURRENT_CONTEXT(ctx
);
2194 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2195 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LIST_BASE
, 1);
2199 if (ctx
->ExecuteFlag
) {
2200 CALL_ListBase(ctx
->Exec
, (base
));
2205 static void GLAPIENTRY
2206 save_LoadIdentity(void)
2208 GET_CURRENT_CONTEXT(ctx
);
2209 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2210 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_LOAD_IDENTITY
, 0);
2211 if (ctx
->ExecuteFlag
) {
2212 CALL_LoadIdentity(ctx
->Exec
, ());
2217 static void GLAPIENTRY
2218 save_LoadMatrixf(const GLfloat
* m
)
2220 GET_CURRENT_CONTEXT(ctx
);
2222 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2223 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LOAD_MATRIX
, 16);
2226 for (i
= 0; i
< 16; i
++) {
2230 if (ctx
->ExecuteFlag
) {
2231 CALL_LoadMatrixf(ctx
->Exec
, (m
));
2236 static void GLAPIENTRY
2237 save_LoadMatrixd(const GLdouble
* m
)
2241 for (i
= 0; i
< 16; i
++) {
2242 f
[i
] = (GLfloat
) m
[i
];
2244 save_LoadMatrixf(f
);
2248 static void GLAPIENTRY
2249 save_LoadName(GLuint name
)
2251 GET_CURRENT_CONTEXT(ctx
);
2253 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2254 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LOAD_NAME
, 1);
2258 if (ctx
->ExecuteFlag
) {
2259 CALL_LoadName(ctx
->Exec
, (name
));
2264 static void GLAPIENTRY
2265 save_LogicOp(GLenum opcode
)
2267 GET_CURRENT_CONTEXT(ctx
);
2269 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2270 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LOGIC_OP
, 1);
2274 if (ctx
->ExecuteFlag
) {
2275 CALL_LogicOp(ctx
->Exec
, (opcode
));
2280 static void GLAPIENTRY
2281 save_Map1d(GLenum target
, GLdouble u1
, GLdouble u2
, GLint stride
,
2282 GLint order
, const GLdouble
* points
)
2284 GET_CURRENT_CONTEXT(ctx
);
2286 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2287 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MAP1
, 6);
2289 GLfloat
*pnts
= _mesa_copy_map_points1d(target
, stride
, order
, points
);
2291 n
[2].f
= (GLfloat
) u1
;
2292 n
[3].f
= (GLfloat
) u2
;
2293 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2295 n
[6].data
= (void *) pnts
;
2297 if (ctx
->ExecuteFlag
) {
2298 CALL_Map1d(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2302 static void GLAPIENTRY
2303 save_Map1f(GLenum target
, GLfloat u1
, GLfloat u2
, GLint stride
,
2304 GLint order
, const GLfloat
* points
)
2306 GET_CURRENT_CONTEXT(ctx
);
2308 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2309 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MAP1
, 6);
2311 GLfloat
*pnts
= _mesa_copy_map_points1f(target
, stride
, order
, points
);
2315 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2317 n
[6].data
= (void *) pnts
;
2319 if (ctx
->ExecuteFlag
) {
2320 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2325 static void GLAPIENTRY
2326 save_Map2d(GLenum target
,
2327 GLdouble u1
, GLdouble u2
, GLint ustride
, GLint uorder
,
2328 GLdouble v1
, GLdouble v2
, GLint vstride
, GLint vorder
,
2329 const GLdouble
* points
)
2331 GET_CURRENT_CONTEXT(ctx
);
2333 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2334 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MAP2
, 10);
2336 GLfloat
*pnts
= _mesa_copy_map_points2d(target
, ustride
, uorder
,
2337 vstride
, vorder
, points
);
2339 n
[2].f
= (GLfloat
) u1
;
2340 n
[3].f
= (GLfloat
) u2
;
2341 n
[4].f
= (GLfloat
) v1
;
2342 n
[5].f
= (GLfloat
) v2
;
2343 /* XXX verify these strides are correct */
2344 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2345 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2348 n
[10].data
= (void *) pnts
;
2350 if (ctx
->ExecuteFlag
) {
2351 CALL_Map2d(ctx
->Exec
, (target
,
2352 u1
, u2
, ustride
, uorder
,
2353 v1
, v2
, vstride
, vorder
, points
));
2358 static void GLAPIENTRY
2359 save_Map2f(GLenum target
,
2360 GLfloat u1
, GLfloat u2
, GLint ustride
, GLint uorder
,
2361 GLfloat v1
, GLfloat v2
, GLint vstride
, GLint vorder
,
2362 const GLfloat
* points
)
2364 GET_CURRENT_CONTEXT(ctx
);
2366 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2367 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MAP2
, 10);
2369 GLfloat
*pnts
= _mesa_copy_map_points2f(target
, ustride
, uorder
,
2370 vstride
, vorder
, points
);
2376 /* XXX verify these strides are correct */
2377 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2378 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2381 n
[10].data
= (void *) pnts
;
2383 if (ctx
->ExecuteFlag
) {
2384 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
2385 v1
, v2
, vstride
, vorder
, points
));
2390 static void GLAPIENTRY
2391 save_MapGrid1f(GLint un
, GLfloat u1
, GLfloat u2
)
2393 GET_CURRENT_CONTEXT(ctx
);
2395 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2396 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MAPGRID1
, 3);
2402 if (ctx
->ExecuteFlag
) {
2403 CALL_MapGrid1f(ctx
->Exec
, (un
, u1
, u2
));
2408 static void GLAPIENTRY
2409 save_MapGrid1d(GLint un
, GLdouble u1
, GLdouble u2
)
2411 save_MapGrid1f(un
, (GLfloat
) u1
, (GLfloat
) u2
);
2415 static void GLAPIENTRY
2416 save_MapGrid2f(GLint un
, GLfloat u1
, GLfloat u2
,
2417 GLint vn
, GLfloat v1
, GLfloat v2
)
2419 GET_CURRENT_CONTEXT(ctx
);
2421 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2422 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MAPGRID2
, 6);
2431 if (ctx
->ExecuteFlag
) {
2432 CALL_MapGrid2f(ctx
->Exec
, (un
, u1
, u2
, vn
, v1
, v2
));
2438 static void GLAPIENTRY
2439 save_MapGrid2d(GLint un
, GLdouble u1
, GLdouble u2
,
2440 GLint vn
, GLdouble v1
, GLdouble v2
)
2442 save_MapGrid2f(un
, (GLfloat
) u1
, (GLfloat
) u2
,
2443 vn
, (GLfloat
) v1
, (GLfloat
) v2
);
2447 static void GLAPIENTRY
2448 save_MatrixMode(GLenum mode
)
2450 GET_CURRENT_CONTEXT(ctx
);
2452 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2453 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MATRIX_MODE
, 1);
2457 if (ctx
->ExecuteFlag
) {
2458 CALL_MatrixMode(ctx
->Exec
, (mode
));
2463 static void GLAPIENTRY
2464 save_Minmax(GLenum target
, GLenum internalFormat
, GLboolean sink
)
2466 GET_CURRENT_CONTEXT(ctx
);
2469 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2470 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MIN_MAX
, 3);
2473 n
[2].e
= internalFormat
;
2476 if (ctx
->ExecuteFlag
) {
2477 CALL_Minmax(ctx
->Exec
, (target
, internalFormat
, sink
));
2482 static void GLAPIENTRY
2483 save_MultMatrixf(const GLfloat
* m
)
2485 GET_CURRENT_CONTEXT(ctx
);
2487 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2488 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MULT_MATRIX
, 16);
2491 for (i
= 0; i
< 16; i
++) {
2495 if (ctx
->ExecuteFlag
) {
2496 CALL_MultMatrixf(ctx
->Exec
, (m
));
2501 static void GLAPIENTRY
2502 save_MultMatrixd(const GLdouble
* m
)
2506 for (i
= 0; i
< 16; i
++) {
2507 f
[i
] = (GLfloat
) m
[i
];
2509 save_MultMatrixf(f
);
2513 static void GLAPIENTRY
2514 save_NewList(GLuint list
, GLenum mode
)
2516 GET_CURRENT_CONTEXT(ctx
);
2517 /* It's an error to call this function while building a display list */
2518 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
2525 static void GLAPIENTRY
2526 save_Ortho(GLdouble left
, GLdouble right
,
2527 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
2529 GET_CURRENT_CONTEXT(ctx
);
2531 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2532 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ORTHO
, 6);
2534 n
[1].f
= (GLfloat
) left
;
2535 n
[2].f
= (GLfloat
) right
;
2536 n
[3].f
= (GLfloat
) bottom
;
2537 n
[4].f
= (GLfloat
) top
;
2538 n
[5].f
= (GLfloat
) nearval
;
2539 n
[6].f
= (GLfloat
) farval
;
2541 if (ctx
->ExecuteFlag
) {
2542 CALL_Ortho(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
2547 static void GLAPIENTRY
2548 save_PixelMapfv(GLenum map
, GLint mapsize
, const GLfloat
*values
)
2550 GET_CURRENT_CONTEXT(ctx
);
2552 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2553 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PIXEL_MAP
, 3);
2557 n
[3].data
= (void *) _mesa_malloc(mapsize
* sizeof(GLfloat
));
2558 MEMCPY(n
[3].data
, (void *) values
, mapsize
* sizeof(GLfloat
));
2560 if (ctx
->ExecuteFlag
) {
2561 CALL_PixelMapfv(ctx
->Exec
, (map
, mapsize
, values
));
2566 static void GLAPIENTRY
2567 save_PixelMapuiv(GLenum map
, GLint mapsize
, const GLuint
*values
)
2569 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2571 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
2572 for (i
= 0; i
< mapsize
; i
++) {
2573 fvalues
[i
] = (GLfloat
) values
[i
];
2577 for (i
= 0; i
< mapsize
; i
++) {
2578 fvalues
[i
] = UINT_TO_FLOAT(values
[i
]);
2581 save_PixelMapfv(map
, mapsize
, fvalues
);
2585 static void GLAPIENTRY
2586 save_PixelMapusv(GLenum map
, GLint mapsize
, const GLushort
*values
)
2588 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2590 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
2591 for (i
= 0; i
< mapsize
; i
++) {
2592 fvalues
[i
] = (GLfloat
) values
[i
];
2596 for (i
= 0; i
< mapsize
; i
++) {
2597 fvalues
[i
] = USHORT_TO_FLOAT(values
[i
]);
2600 save_PixelMapfv(map
, mapsize
, fvalues
);
2604 static void GLAPIENTRY
2605 save_PixelTransferf(GLenum pname
, GLfloat param
)
2607 GET_CURRENT_CONTEXT(ctx
);
2609 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2610 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PIXEL_TRANSFER
, 2);
2615 if (ctx
->ExecuteFlag
) {
2616 CALL_PixelTransferf(ctx
->Exec
, (pname
, param
));
2621 static void GLAPIENTRY
2622 save_PixelTransferi(GLenum pname
, GLint param
)
2624 save_PixelTransferf(pname
, (GLfloat
) param
);
2628 static void GLAPIENTRY
2629 save_PixelZoom(GLfloat xfactor
, GLfloat yfactor
)
2631 GET_CURRENT_CONTEXT(ctx
);
2633 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2634 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PIXEL_ZOOM
, 2);
2639 if (ctx
->ExecuteFlag
) {
2640 CALL_PixelZoom(ctx
->Exec
, (xfactor
, yfactor
));
2645 static void GLAPIENTRY
2646 save_PointParameterfvEXT(GLenum pname
, const GLfloat
*params
)
2648 GET_CURRENT_CONTEXT(ctx
);
2650 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2651 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_POINT_PARAMETERS
, 4);
2658 if (ctx
->ExecuteFlag
) {
2659 CALL_PointParameterfvEXT(ctx
->Exec
, (pname
, params
));
2664 static void GLAPIENTRY
2665 save_PointParameterfEXT(GLenum pname
, GLfloat param
)
2667 save_PointParameterfvEXT(pname
, ¶m
);
2670 static void GLAPIENTRY
2671 save_PointParameteriNV(GLenum pname
, GLint param
)
2673 GLfloat p
= (GLfloat
) param
;
2674 save_PointParameterfvEXT(pname
, &p
);
2677 static void GLAPIENTRY
2678 save_PointParameterivNV(GLenum pname
, const GLint
* param
)
2680 GLfloat p
= (GLfloat
) param
[0];
2681 save_PointParameterfvEXT(pname
, &p
);
2685 static void GLAPIENTRY
2686 save_PointSize(GLfloat size
)
2688 GET_CURRENT_CONTEXT(ctx
);
2690 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2691 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_POINT_SIZE
, 1);
2695 if (ctx
->ExecuteFlag
) {
2696 CALL_PointSize(ctx
->Exec
, (size
));
2701 static void GLAPIENTRY
2702 save_PolygonMode(GLenum face
, GLenum mode
)
2704 GET_CURRENT_CONTEXT(ctx
);
2706 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2707 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_POLYGON_MODE
, 2);
2712 if (ctx
->ExecuteFlag
) {
2713 CALL_PolygonMode(ctx
->Exec
, (face
, mode
));
2719 * Polygon stipple must have been upacked already!
2721 static void GLAPIENTRY
2722 save_PolygonStipple(const GLubyte
* pattern
)
2724 GET_CURRENT_CONTEXT(ctx
);
2726 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2727 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_POLYGON_STIPPLE
, 1);
2730 n
[1].data
= _mesa_malloc(32 * 4);
2731 data
= n
[1].data
; /* This needed for Acorn compiler */
2732 MEMCPY(data
, pattern
, 32 * 4);
2734 if (ctx
->ExecuteFlag
) {
2735 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) pattern
));
2740 static void GLAPIENTRY
2741 save_PolygonOffset(GLfloat factor
, GLfloat units
)
2743 GET_CURRENT_CONTEXT(ctx
);
2745 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2746 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_POLYGON_OFFSET
, 2);
2751 if (ctx
->ExecuteFlag
) {
2752 CALL_PolygonOffset(ctx
->Exec
, (factor
, units
));
2757 static void GLAPIENTRY
2758 save_PolygonOffsetEXT(GLfloat factor
, GLfloat bias
)
2760 GET_CURRENT_CONTEXT(ctx
);
2761 /* XXX mult by DepthMaxF here??? */
2762 save_PolygonOffset(factor
, ctx
->DrawBuffer
->_DepthMaxF
* bias
);
2766 static void GLAPIENTRY
2767 save_PopAttrib(void)
2769 GET_CURRENT_CONTEXT(ctx
);
2770 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2771 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_POP_ATTRIB
, 0);
2772 if (ctx
->ExecuteFlag
) {
2773 CALL_PopAttrib(ctx
->Exec
, ());
2778 static void GLAPIENTRY
2779 save_PopMatrix(void)
2781 GET_CURRENT_CONTEXT(ctx
);
2782 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2783 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_POP_MATRIX
, 0);
2784 if (ctx
->ExecuteFlag
) {
2785 CALL_PopMatrix(ctx
->Exec
, ());
2790 static void GLAPIENTRY
2793 GET_CURRENT_CONTEXT(ctx
);
2794 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2795 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_POP_NAME
, 0);
2796 if (ctx
->ExecuteFlag
) {
2797 CALL_PopName(ctx
->Exec
, ());
2802 static void GLAPIENTRY
2803 save_PrioritizeTextures(GLsizei num
, const GLuint
* textures
,
2804 const GLclampf
* priorities
)
2806 GET_CURRENT_CONTEXT(ctx
);
2808 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2810 for (i
= 0; i
< num
; i
++) {
2812 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PRIORITIZE_TEXTURE
, 2);
2814 n
[1].ui
= textures
[i
];
2815 n
[2].f
= priorities
[i
];
2818 if (ctx
->ExecuteFlag
) {
2819 CALL_PrioritizeTextures(ctx
->Exec
, (num
, textures
, priorities
));
2824 static void GLAPIENTRY
2825 save_PushAttrib(GLbitfield mask
)
2827 GET_CURRENT_CONTEXT(ctx
);
2829 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2830 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PUSH_ATTRIB
, 1);
2834 if (ctx
->ExecuteFlag
) {
2835 CALL_PushAttrib(ctx
->Exec
, (mask
));
2840 static void GLAPIENTRY
2841 save_PushMatrix(void)
2843 GET_CURRENT_CONTEXT(ctx
);
2844 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2845 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_PUSH_MATRIX
, 0);
2846 if (ctx
->ExecuteFlag
) {
2847 CALL_PushMatrix(ctx
->Exec
, ());
2852 static void GLAPIENTRY
2853 save_PushName(GLuint name
)
2855 GET_CURRENT_CONTEXT(ctx
);
2857 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2858 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PUSH_NAME
, 1);
2862 if (ctx
->ExecuteFlag
) {
2863 CALL_PushName(ctx
->Exec
, (name
));
2868 static void GLAPIENTRY
2869 save_RasterPos4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
2871 GET_CURRENT_CONTEXT(ctx
);
2873 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2874 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_RASTER_POS
, 4);
2881 if (ctx
->ExecuteFlag
) {
2882 CALL_RasterPos4f(ctx
->Exec
, (x
, y
, z
, w
));
2886 static void GLAPIENTRY
2887 save_RasterPos2d(GLdouble x
, GLdouble y
)
2889 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
2892 static void GLAPIENTRY
2893 save_RasterPos2f(GLfloat x
, GLfloat y
)
2895 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2898 static void GLAPIENTRY
2899 save_RasterPos2i(GLint x
, GLint y
)
2901 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
2904 static void GLAPIENTRY
2905 save_RasterPos2s(GLshort x
, GLshort y
)
2907 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2910 static void GLAPIENTRY
2911 save_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
2913 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
2916 static void GLAPIENTRY
2917 save_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
2919 save_RasterPos4f(x
, y
, z
, 1.0F
);
2922 static void GLAPIENTRY
2923 save_RasterPos3i(GLint x
, GLint y
, GLint z
)
2925 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
2928 static void GLAPIENTRY
2929 save_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
2931 save_RasterPos4f(x
, y
, z
, 1.0F
);
2934 static void GLAPIENTRY
2935 save_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
2937 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
2940 static void GLAPIENTRY
2941 save_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
2943 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
2946 static void GLAPIENTRY
2947 save_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
2949 save_RasterPos4f(x
, y
, z
, w
);
2952 static void GLAPIENTRY
2953 save_RasterPos2dv(const GLdouble
* v
)
2955 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
2958 static void GLAPIENTRY
2959 save_RasterPos2fv(const GLfloat
* v
)
2961 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2964 static void GLAPIENTRY
2965 save_RasterPos2iv(const GLint
* v
)
2967 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
2970 static void GLAPIENTRY
2971 save_RasterPos2sv(const GLshort
* v
)
2973 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2976 static void GLAPIENTRY
2977 save_RasterPos3dv(const GLdouble
* v
)
2979 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
2982 static void GLAPIENTRY
2983 save_RasterPos3fv(const GLfloat
* v
)
2985 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2988 static void GLAPIENTRY
2989 save_RasterPos3iv(const GLint
* v
)
2991 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
2994 static void GLAPIENTRY
2995 save_RasterPos3sv(const GLshort
* v
)
2997 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3000 static void GLAPIENTRY
3001 save_RasterPos4dv(const GLdouble
* v
)
3003 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3004 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3007 static void GLAPIENTRY
3008 save_RasterPos4fv(const GLfloat
* v
)
3010 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3013 static void GLAPIENTRY
3014 save_RasterPos4iv(const GLint
* v
)
3016 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3017 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3020 static void GLAPIENTRY
3021 save_RasterPos4sv(const GLshort
* v
)
3023 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3027 static void GLAPIENTRY
3028 save_PassThrough(GLfloat token
)
3030 GET_CURRENT_CONTEXT(ctx
);
3032 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3033 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PASSTHROUGH
, 1);
3037 if (ctx
->ExecuteFlag
) {
3038 CALL_PassThrough(ctx
->Exec
, (token
));
3043 static void GLAPIENTRY
3044 save_ReadBuffer(GLenum mode
)
3046 GET_CURRENT_CONTEXT(ctx
);
3048 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3049 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_READ_BUFFER
, 1);
3053 if (ctx
->ExecuteFlag
) {
3054 CALL_ReadBuffer(ctx
->Exec
, (mode
));
3059 static void GLAPIENTRY
3060 save_ResetHistogram(GLenum target
)
3062 GET_CURRENT_CONTEXT(ctx
);
3064 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3065 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_RESET_HISTOGRAM
, 1);
3069 if (ctx
->ExecuteFlag
) {
3070 CALL_ResetHistogram(ctx
->Exec
, (target
));
3075 static void GLAPIENTRY
3076 save_ResetMinmax(GLenum target
)
3078 GET_CURRENT_CONTEXT(ctx
);
3080 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3081 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_RESET_MIN_MAX
, 1);
3085 if (ctx
->ExecuteFlag
) {
3086 CALL_ResetMinmax(ctx
->Exec
, (target
));
3091 static void GLAPIENTRY
3092 save_Rotatef(GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
3094 GET_CURRENT_CONTEXT(ctx
);
3096 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3097 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ROTATE
, 4);
3104 if (ctx
->ExecuteFlag
) {
3105 CALL_Rotatef(ctx
->Exec
, (angle
, x
, y
, z
));
3110 static void GLAPIENTRY
3111 save_Rotated(GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
3113 save_Rotatef((GLfloat
) angle
, (GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3117 static void GLAPIENTRY
3118 save_Scalef(GLfloat x
, GLfloat y
, GLfloat z
)
3120 GET_CURRENT_CONTEXT(ctx
);
3122 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3123 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SCALE
, 3);
3129 if (ctx
->ExecuteFlag
) {
3130 CALL_Scalef(ctx
->Exec
, (x
, y
, z
));
3135 static void GLAPIENTRY
3136 save_Scaled(GLdouble x
, GLdouble y
, GLdouble z
)
3138 save_Scalef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3142 static void GLAPIENTRY
3143 save_Scissor(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3145 GET_CURRENT_CONTEXT(ctx
);
3147 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3148 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SCISSOR
, 4);
3155 if (ctx
->ExecuteFlag
) {
3156 CALL_Scissor(ctx
->Exec
, (x
, y
, width
, height
));
3161 static void GLAPIENTRY
3162 save_ShadeModel(GLenum mode
)
3164 GET_CURRENT_CONTEXT(ctx
);
3166 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3167 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SHADE_MODEL
, 1);
3171 if (ctx
->ExecuteFlag
) {
3172 CALL_ShadeModel(ctx
->Exec
, (mode
));
3177 static void GLAPIENTRY
3178 save_StencilFunc(GLenum func
, GLint ref
, GLuint mask
)
3180 GET_CURRENT_CONTEXT(ctx
);
3182 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3183 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_FUNC
, 3);
3189 if (ctx
->ExecuteFlag
) {
3190 CALL_StencilFunc(ctx
->Exec
, (func
, ref
, mask
));
3195 static void GLAPIENTRY
3196 save_StencilMask(GLuint mask
)
3198 GET_CURRENT_CONTEXT(ctx
);
3200 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3201 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_MASK
, 1);
3205 if (ctx
->ExecuteFlag
) {
3206 CALL_StencilMask(ctx
->Exec
, (mask
));
3211 static void GLAPIENTRY
3212 save_StencilOp(GLenum fail
, GLenum zfail
, GLenum zpass
)
3214 GET_CURRENT_CONTEXT(ctx
);
3216 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3217 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_OP
, 3);
3223 if (ctx
->ExecuteFlag
) {
3224 CALL_StencilOp(ctx
->Exec
, (fail
, zfail
, zpass
));
3229 static void GLAPIENTRY
3230 save_StencilFuncSeparate(GLenum face
, GLenum func
, GLint ref
, GLuint mask
)
3232 GET_CURRENT_CONTEXT(ctx
);
3234 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3235 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3242 if (ctx
->ExecuteFlag
) {
3243 CALL_StencilFuncSeparate(ctx
->Exec
, (face
, func
, ref
, mask
));
3248 static void GLAPIENTRY
3249 save_StencilMaskSeparate(GLenum face
, GLuint mask
)
3251 GET_CURRENT_CONTEXT(ctx
);
3253 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3254 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_MASK_SEPARATE
, 2);
3259 if (ctx
->ExecuteFlag
) {
3260 CALL_StencilMaskSeparate(ctx
->Exec
, (face
, mask
));
3265 static void GLAPIENTRY
3266 save_StencilOpSeparate(GLenum face
, GLenum fail
, GLenum zfail
, GLenum zpass
)
3268 GET_CURRENT_CONTEXT(ctx
);
3270 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3271 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_OP_SEPARATE
, 4);
3278 if (ctx
->ExecuteFlag
) {
3279 CALL_StencilOpSeparate(ctx
->Exec
, (face
, fail
, zfail
, zpass
));
3284 static void GLAPIENTRY
3285 save_TexEnvfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3287 GET_CURRENT_CONTEXT(ctx
);
3289 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3290 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEXENV
, 6);
3294 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3302 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
3305 if (ctx
->ExecuteFlag
) {
3306 CALL_TexEnvfv(ctx
->Exec
, (target
, pname
, params
));
3311 static void GLAPIENTRY
3312 save_TexEnvf(GLenum target
, GLenum pname
, GLfloat param
)
3314 save_TexEnvfv(target
, pname
, ¶m
);
3318 static void GLAPIENTRY
3319 save_TexEnvi(GLenum target
, GLenum pname
, GLint param
)
3322 p
[0] = (GLfloat
) param
;
3323 p
[1] = p
[2] = p
[3] = 0.0;
3324 save_TexEnvfv(target
, pname
, p
);
3328 static void GLAPIENTRY
3329 save_TexEnviv(GLenum target
, GLenum pname
, const GLint
* param
)
3332 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3333 p
[0] = INT_TO_FLOAT(param
[0]);
3334 p
[1] = INT_TO_FLOAT(param
[1]);
3335 p
[2] = INT_TO_FLOAT(param
[2]);
3336 p
[3] = INT_TO_FLOAT(param
[3]);
3339 p
[0] = (GLfloat
) param
[0];
3340 p
[1] = p
[2] = p
[3] = 0.0F
;
3342 save_TexEnvfv(target
, pname
, p
);
3346 static void GLAPIENTRY
3347 save_TexGenfv(GLenum coord
, GLenum pname
, const GLfloat
*params
)
3349 GET_CURRENT_CONTEXT(ctx
);
3351 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3352 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEXGEN
, 6);
3361 if (ctx
->ExecuteFlag
) {
3362 CALL_TexGenfv(ctx
->Exec
, (coord
, pname
, params
));
3367 static void GLAPIENTRY
3368 save_TexGeniv(GLenum coord
, GLenum pname
, const GLint
*params
)
3371 p
[0] = (GLfloat
) params
[0];
3372 p
[1] = (GLfloat
) params
[1];
3373 p
[2] = (GLfloat
) params
[2];
3374 p
[3] = (GLfloat
) params
[3];
3375 save_TexGenfv(coord
, pname
, p
);
3379 static void GLAPIENTRY
3380 save_TexGend(GLenum coord
, GLenum pname
, GLdouble param
)
3382 GLfloat p
= (GLfloat
) param
;
3383 save_TexGenfv(coord
, pname
, &p
);
3387 static void GLAPIENTRY
3388 save_TexGendv(GLenum coord
, GLenum pname
, const GLdouble
*params
)
3391 p
[0] = (GLfloat
) params
[0];
3392 p
[1] = (GLfloat
) params
[1];
3393 p
[2] = (GLfloat
) params
[2];
3394 p
[3] = (GLfloat
) params
[3];
3395 save_TexGenfv(coord
, pname
, p
);
3399 static void GLAPIENTRY
3400 save_TexGenf(GLenum coord
, GLenum pname
, GLfloat param
)
3402 save_TexGenfv(coord
, pname
, ¶m
);
3406 static void GLAPIENTRY
3407 save_TexGeni(GLenum coord
, GLenum pname
, GLint param
)
3409 save_TexGeniv(coord
, pname
, ¶m
);
3413 static void GLAPIENTRY
3414 save_TexParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3416 GET_CURRENT_CONTEXT(ctx
);
3418 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3419 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEXPARAMETER
, 6);
3428 if (ctx
->ExecuteFlag
) {
3429 CALL_TexParameterfv(ctx
->Exec
, (target
, pname
, params
));
3434 static void GLAPIENTRY
3435 save_TexParameterf(GLenum target
, GLenum pname
, GLfloat param
)
3437 save_TexParameterfv(target
, pname
, ¶m
);
3441 static void GLAPIENTRY
3442 save_TexParameteri(GLenum target
, GLenum pname
, GLint param
)
3445 fparam
[0] = (GLfloat
) param
;
3446 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
3447 save_TexParameterfv(target
, pname
, fparam
);
3451 static void GLAPIENTRY
3452 save_TexParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
3455 fparam
[0] = (GLfloat
) params
[0];
3456 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
3457 save_TexParameterfv(target
, pname
, fparam
);
3461 static void GLAPIENTRY
3462 save_TexImage1D(GLenum target
,
3463 GLint level
, GLint components
,
3464 GLsizei width
, GLint border
,
3465 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3467 GET_CURRENT_CONTEXT(ctx
);
3468 if (target
== GL_PROXY_TEXTURE_1D
) {
3469 /* don't compile, execute immediately */
3470 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
3471 border
, format
, type
, pixels
));
3474 GLvoid
*image
= unpack_image(1, width
, 1, 1, format
, type
,
3475 pixels
, &ctx
->Unpack
);
3477 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3478 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_IMAGE1D
, 8);
3482 n
[3].i
= components
;
3483 n
[4].i
= (GLint
) width
;
3492 if (ctx
->ExecuteFlag
) {
3493 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
3494 border
, format
, type
, pixels
));
3500 static void GLAPIENTRY
3501 save_TexImage2D(GLenum target
,
3502 GLint level
, GLint components
,
3503 GLsizei width
, GLsizei height
, GLint border
,
3504 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3506 GET_CURRENT_CONTEXT(ctx
);
3507 if (target
== GL_PROXY_TEXTURE_2D
) {
3508 /* don't compile, execute immediately */
3509 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
3510 height
, border
, format
, type
, pixels
));
3513 GLvoid
*image
= unpack_image(2, width
, height
, 1, format
, type
,
3514 pixels
, &ctx
->Unpack
);
3516 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3517 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_IMAGE2D
, 9);
3521 n
[3].i
= components
;
3522 n
[4].i
= (GLint
) width
;
3523 n
[5].i
= (GLint
) height
;
3532 if (ctx
->ExecuteFlag
) {
3533 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
3534 height
, border
, format
, type
, pixels
));
3540 static void GLAPIENTRY
3541 save_TexImage3D(GLenum target
,
3542 GLint level
, GLint internalFormat
,
3543 GLsizei width
, GLsizei height
, GLsizei depth
,
3545 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3547 GET_CURRENT_CONTEXT(ctx
);
3548 if (target
== GL_PROXY_TEXTURE_3D
) {
3549 /* don't compile, execute immediately */
3550 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
3551 height
, depth
, border
, format
, type
,
3556 GLvoid
*image
= unpack_image(3, width
, height
, depth
, format
, type
,
3557 pixels
, &ctx
->Unpack
);
3558 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3559 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_IMAGE3D
, 10);
3563 n
[3].i
= (GLint
) internalFormat
;
3564 n
[4].i
= (GLint
) width
;
3565 n
[5].i
= (GLint
) height
;
3566 n
[6].i
= (GLint
) depth
;
3575 if (ctx
->ExecuteFlag
) {
3576 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
3577 height
, depth
, border
, format
, type
,
3584 static void GLAPIENTRY
3585 save_TexSubImage1D(GLenum target
, GLint level
, GLint xoffset
,
3586 GLsizei width
, GLenum format
, GLenum type
,
3587 const GLvoid
* pixels
)
3589 GET_CURRENT_CONTEXT(ctx
);
3591 GLvoid
*image
= unpack_image(1, width
, 1, 1, format
, type
,
3592 pixels
, &ctx
->Unpack
);
3593 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3594 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_SUB_IMAGE1D
, 7);
3599 n
[4].i
= (GLint
) width
;
3607 if (ctx
->ExecuteFlag
) {
3608 CALL_TexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
, width
,
3609 format
, type
, pixels
));
3614 static void GLAPIENTRY
3615 save_TexSubImage2D(GLenum target
, GLint level
,
3616 GLint xoffset
, GLint yoffset
,
3617 GLsizei width
, GLsizei height
,
3618 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3620 GET_CURRENT_CONTEXT(ctx
);
3622 GLvoid
*image
= unpack_image(2, width
, height
, 1, format
, type
,
3623 pixels
, &ctx
->Unpack
);
3624 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3625 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_SUB_IMAGE2D
, 9);
3631 n
[5].i
= (GLint
) width
;
3632 n
[6].i
= (GLint
) height
;
3640 if (ctx
->ExecuteFlag
) {
3641 CALL_TexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
3642 width
, height
, format
, type
, pixels
));
3647 static void GLAPIENTRY
3648 save_TexSubImage3D(GLenum target
, GLint level
,
3649 GLint xoffset
, GLint yoffset
, GLint zoffset
,
3650 GLsizei width
, GLsizei height
, GLsizei depth
,
3651 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3653 GET_CURRENT_CONTEXT(ctx
);
3655 GLvoid
*image
= unpack_image(3, width
, height
, depth
, format
, type
,
3656 pixels
, &ctx
->Unpack
);
3657 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3658 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_SUB_IMAGE3D
, 11);
3665 n
[6].i
= (GLint
) width
;
3666 n
[7].i
= (GLint
) height
;
3667 n
[8].i
= (GLint
) depth
;
3675 if (ctx
->ExecuteFlag
) {
3676 CALL_TexSubImage3D(ctx
->Exec
, (target
, level
,
3677 xoffset
, yoffset
, zoffset
,
3678 width
, height
, depth
, format
, type
,
3684 static void GLAPIENTRY
3685 save_Translatef(GLfloat x
, GLfloat y
, GLfloat z
)
3687 GET_CURRENT_CONTEXT(ctx
);
3689 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3690 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TRANSLATE
, 3);
3696 if (ctx
->ExecuteFlag
) {
3697 CALL_Translatef(ctx
->Exec
, (x
, y
, z
));
3702 static void GLAPIENTRY
3703 save_Translated(GLdouble x
, GLdouble y
, GLdouble z
)
3705 save_Translatef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3710 static void GLAPIENTRY
3711 save_Viewport(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3713 GET_CURRENT_CONTEXT(ctx
);
3715 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3716 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_VIEWPORT
, 4);
3720 n
[3].i
= (GLint
) width
;
3721 n
[4].i
= (GLint
) height
;
3723 if (ctx
->ExecuteFlag
) {
3724 CALL_Viewport(ctx
->Exec
, (x
, y
, width
, height
));
3729 static void GLAPIENTRY
3730 save_WindowPos4fMESA(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3732 GET_CURRENT_CONTEXT(ctx
);
3734 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3735 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_WINDOW_POS
, 4);
3742 if (ctx
->ExecuteFlag
) {
3743 CALL_WindowPos4fMESA(ctx
->Exec
, (x
, y
, z
, w
));
3747 static void GLAPIENTRY
3748 save_WindowPos2dMESA(GLdouble x
, GLdouble y
)
3750 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3753 static void GLAPIENTRY
3754 save_WindowPos2fMESA(GLfloat x
, GLfloat y
)
3756 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3759 static void GLAPIENTRY
3760 save_WindowPos2iMESA(GLint x
, GLint y
)
3762 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3765 static void GLAPIENTRY
3766 save_WindowPos2sMESA(GLshort x
, GLshort y
)
3768 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3771 static void GLAPIENTRY
3772 save_WindowPos3dMESA(GLdouble x
, GLdouble y
, GLdouble z
)
3774 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3777 static void GLAPIENTRY
3778 save_WindowPos3fMESA(GLfloat x
, GLfloat y
, GLfloat z
)
3780 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3783 static void GLAPIENTRY
3784 save_WindowPos3iMESA(GLint x
, GLint y
, GLint z
)
3786 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3789 static void GLAPIENTRY
3790 save_WindowPos3sMESA(GLshort x
, GLshort y
, GLshort z
)
3792 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3795 static void GLAPIENTRY
3796 save_WindowPos4dMESA(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3798 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3801 static void GLAPIENTRY
3802 save_WindowPos4iMESA(GLint x
, GLint y
, GLint z
, GLint w
)
3804 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3807 static void GLAPIENTRY
3808 save_WindowPos4sMESA(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
3810 save_WindowPos4fMESA(x
, y
, z
, w
);
3813 static void GLAPIENTRY
3814 save_WindowPos2dvMESA(const GLdouble
* v
)
3816 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3819 static void GLAPIENTRY
3820 save_WindowPos2fvMESA(const GLfloat
* v
)
3822 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3825 static void GLAPIENTRY
3826 save_WindowPos2ivMESA(const GLint
* v
)
3828 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3831 static void GLAPIENTRY
3832 save_WindowPos2svMESA(const GLshort
* v
)
3834 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3837 static void GLAPIENTRY
3838 save_WindowPos3dvMESA(const GLdouble
* v
)
3840 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3843 static void GLAPIENTRY
3844 save_WindowPos3fvMESA(const GLfloat
* v
)
3846 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3849 static void GLAPIENTRY
3850 save_WindowPos3ivMESA(const GLint
* v
)
3852 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3855 static void GLAPIENTRY
3856 save_WindowPos3svMESA(const GLshort
* v
)
3858 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3861 static void GLAPIENTRY
3862 save_WindowPos4dvMESA(const GLdouble
* v
)
3864 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
3865 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3868 static void GLAPIENTRY
3869 save_WindowPos4fvMESA(const GLfloat
* v
)
3871 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3874 static void GLAPIENTRY
3875 save_WindowPos4ivMESA(const GLint
* v
)
3877 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
3878 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3881 static void GLAPIENTRY
3882 save_WindowPos4svMESA(const GLshort
* v
)
3884 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3889 /* GL_ARB_multitexture */
3890 static void GLAPIENTRY
3891 save_ActiveTextureARB(GLenum target
)
3893 GET_CURRENT_CONTEXT(ctx
);
3895 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3896 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ACTIVE_TEXTURE
, 1);
3900 if (ctx
->ExecuteFlag
) {
3901 CALL_ActiveTextureARB(ctx
->Exec
, (target
));
3906 /* GL_ARB_transpose_matrix */
3908 static void GLAPIENTRY
3909 save_LoadTransposeMatrixdARB(const GLdouble m
[16])
3912 _math_transposefd(tm
, m
);
3913 save_LoadMatrixf(tm
);
3917 static void GLAPIENTRY
3918 save_LoadTransposeMatrixfARB(const GLfloat m
[16])
3921 _math_transposef(tm
, m
);
3922 save_LoadMatrixf(tm
);
3926 static void GLAPIENTRY
3927 save_MultTransposeMatrixdARB(const GLdouble m
[16])
3930 _math_transposefd(tm
, m
);
3931 save_MultMatrixf(tm
);
3935 static void GLAPIENTRY
3936 save_MultTransposeMatrixfARB(const GLfloat m
[16])
3939 _math_transposef(tm
, m
);
3940 save_MultMatrixf(tm
);
3944 /* GL_ARB_texture_compression */
3945 static void GLAPIENTRY
3946 save_CompressedTexImage1DARB(GLenum target
, GLint level
,
3947 GLenum internalFormat
, GLsizei width
,
3948 GLint border
, GLsizei imageSize
,
3949 const GLvoid
* data
)
3951 GET_CURRENT_CONTEXT(ctx
);
3952 if (target
== GL_PROXY_TEXTURE_1D
) {
3953 /* don't compile, execute immediately */
3954 CALL_CompressedTexImage1DARB(ctx
->Exec
, (target
, level
, internalFormat
,
3955 width
, border
, imageSize
,
3961 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3962 /* make copy of image */
3963 image
= _mesa_malloc(imageSize
);
3965 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage1DARB");
3968 MEMCPY(image
, data
, imageSize
);
3969 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_1D
, 7);
3973 n
[3].e
= internalFormat
;
3974 n
[4].i
= (GLint
) width
;
3982 if (ctx
->ExecuteFlag
) {
3983 CALL_CompressedTexImage1DARB(ctx
->Exec
,
3984 (target
, level
, internalFormat
, width
,
3985 border
, imageSize
, data
));
3991 static void GLAPIENTRY
3992 save_CompressedTexImage2DARB(GLenum target
, GLint level
,
3993 GLenum internalFormat
, GLsizei width
,
3994 GLsizei height
, GLint border
, GLsizei imageSize
,
3995 const GLvoid
* data
)
3997 GET_CURRENT_CONTEXT(ctx
);
3998 if (target
== GL_PROXY_TEXTURE_2D
) {
3999 /* don't compile, execute immediately */
4000 CALL_CompressedTexImage2DARB(ctx
->Exec
, (target
, level
, internalFormat
,
4001 width
, height
, border
,
4007 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4008 /* make copy of image */
4009 image
= _mesa_malloc(imageSize
);
4011 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage2DARB");
4014 MEMCPY(image
, data
, imageSize
);
4015 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_2D
, 8);
4019 n
[3].e
= internalFormat
;
4020 n
[4].i
= (GLint
) width
;
4021 n
[5].i
= (GLint
) height
;
4029 if (ctx
->ExecuteFlag
) {
4030 CALL_CompressedTexImage2DARB(ctx
->Exec
,
4031 (target
, level
, internalFormat
, width
,
4032 height
, border
, imageSize
, data
));
4038 static void GLAPIENTRY
4039 save_CompressedTexImage3DARB(GLenum target
, GLint level
,
4040 GLenum internalFormat
, GLsizei width
,
4041 GLsizei height
, GLsizei depth
, GLint border
,
4042 GLsizei imageSize
, const GLvoid
* data
)
4044 GET_CURRENT_CONTEXT(ctx
);
4045 if (target
== GL_PROXY_TEXTURE_3D
) {
4046 /* don't compile, execute immediately */
4047 CALL_CompressedTexImage3DARB(ctx
->Exec
, (target
, level
, internalFormat
,
4048 width
, height
, depth
, border
,
4054 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4055 /* make copy of image */
4056 image
= _mesa_malloc(imageSize
);
4058 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage3DARB");
4061 MEMCPY(image
, data
, imageSize
);
4062 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_3D
, 9);
4066 n
[3].e
= internalFormat
;
4067 n
[4].i
= (GLint
) width
;
4068 n
[5].i
= (GLint
) height
;
4069 n
[6].i
= (GLint
) depth
;
4077 if (ctx
->ExecuteFlag
) {
4078 CALL_CompressedTexImage3DARB(ctx
->Exec
,
4079 (target
, level
, internalFormat
, width
,
4080 height
, depth
, border
, imageSize
,
4087 static void GLAPIENTRY
4088 save_CompressedTexSubImage1DARB(GLenum target
, GLint level
, GLint xoffset
,
4089 GLsizei width
, GLenum format
,
4090 GLsizei imageSize
, const GLvoid
* data
)
4095 GET_CURRENT_CONTEXT(ctx
);
4096 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4098 /* make copy of image */
4099 image
= _mesa_malloc(imageSize
);
4101 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage1DARB");
4104 MEMCPY(image
, data
, imageSize
);
4105 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
, 7);
4110 n
[4].i
= (GLint
) width
;
4118 if (ctx
->ExecuteFlag
) {
4119 CALL_CompressedTexSubImage1DARB(ctx
->Exec
, (target
, level
, xoffset
,
4120 width
, format
, imageSize
,
4126 static void GLAPIENTRY
4127 save_CompressedTexSubImage2DARB(GLenum target
, GLint level
, GLint xoffset
,
4128 GLint yoffset
, GLsizei width
, GLsizei height
,
4129 GLenum format
, GLsizei imageSize
,
4130 const GLvoid
* data
)
4135 GET_CURRENT_CONTEXT(ctx
);
4136 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4138 /* make copy of image */
4139 image
= _mesa_malloc(imageSize
);
4141 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage2DARB");
4144 MEMCPY(image
, data
, imageSize
);
4145 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
, 9);
4151 n
[5].i
= (GLint
) width
;
4152 n
[6].i
= (GLint
) height
;
4160 if (ctx
->ExecuteFlag
) {
4161 CALL_CompressedTexSubImage2DARB(ctx
->Exec
,
4162 (target
, level
, xoffset
, yoffset
, width
,
4163 height
, format
, imageSize
, data
));
4168 static void GLAPIENTRY
4169 save_CompressedTexSubImage3DARB(GLenum target
, GLint level
, GLint xoffset
,
4170 GLint yoffset
, GLint zoffset
, GLsizei width
,
4171 GLsizei height
, GLsizei depth
, GLenum format
,
4172 GLsizei imageSize
, 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
, "glCompressedTexSubImage3DARB");
4186 MEMCPY(image
, data
, imageSize
);
4187 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
, 11);
4194 n
[6].i
= (GLint
) width
;
4195 n
[7].i
= (GLint
) height
;
4196 n
[8].i
= (GLint
) depth
;
4198 n
[10].i
= imageSize
;
4204 if (ctx
->ExecuteFlag
) {
4205 CALL_CompressedTexSubImage3DARB(ctx
->Exec
,
4206 (target
, level
, xoffset
, yoffset
,
4207 zoffset
, width
, height
, depth
, format
,
4213 /* GL_ARB_multisample */
4214 static void GLAPIENTRY
4215 save_SampleCoverageARB(GLclampf value
, GLboolean invert
)
4217 GET_CURRENT_CONTEXT(ctx
);
4219 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4220 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SAMPLE_COVERAGE
, 2);
4225 if (ctx
->ExecuteFlag
) {
4226 CALL_SampleCoverageARB(ctx
->Exec
, (value
, invert
));
4232 * GL_NV_vertex_program
4234 #if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
4235 static void GLAPIENTRY
4236 save_BindProgramNV(GLenum target
, GLuint id
)
4238 GET_CURRENT_CONTEXT(ctx
);
4240 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4241 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BIND_PROGRAM_NV
, 2);
4246 if (ctx
->ExecuteFlag
) {
4247 CALL_BindProgramNV(ctx
->Exec
, (target
, id
));
4251 static void GLAPIENTRY
4252 save_ProgramEnvParameter4fARB(GLenum target
, GLuint index
,
4253 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4255 GET_CURRENT_CONTEXT(ctx
);
4257 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4258 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4267 if (ctx
->ExecuteFlag
) {
4268 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4273 static void GLAPIENTRY
4274 save_ProgramEnvParameter4fvARB(GLenum target
, GLuint index
,
4275 const GLfloat
*params
)
4277 save_ProgramEnvParameter4fARB(target
, index
, params
[0], params
[1],
4278 params
[2], params
[3]);
4282 static void GLAPIENTRY
4283 save_ProgramEnvParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4284 const GLfloat
* params
)
4286 GET_CURRENT_CONTEXT(ctx
);
4288 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4292 const GLfloat
* p
= params
;
4294 for (i
= 0 ; i
< count
; i
++) {
4295 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4308 if (ctx
->ExecuteFlag
) {
4309 CALL_ProgramEnvParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4314 static void GLAPIENTRY
4315 save_ProgramEnvParameter4dARB(GLenum target
, GLuint index
,
4316 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4318 save_ProgramEnvParameter4fARB(target
, index
,
4320 (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4324 static void GLAPIENTRY
4325 save_ProgramEnvParameter4dvARB(GLenum target
, GLuint index
,
4326 const GLdouble
*params
)
4328 save_ProgramEnvParameter4fARB(target
, index
,
4329 (GLfloat
) params
[0],
4330 (GLfloat
) params
[1],
4331 (GLfloat
) params
[2], (GLfloat
) params
[3]);
4334 #endif /* FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program || FEATURE_NV_vertex_program */
4336 #if FEATURE_NV_vertex_program
4337 static void GLAPIENTRY
4338 save_ExecuteProgramNV(GLenum target
, GLuint id
, const GLfloat
*params
)
4340 GET_CURRENT_CONTEXT(ctx
);
4342 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4343 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EXECUTE_PROGRAM_NV
, 6);
4352 if (ctx
->ExecuteFlag
) {
4353 CALL_ExecuteProgramNV(ctx
->Exec
, (target
, id
, params
));
4358 static void GLAPIENTRY
4359 save_ProgramParameters4dvNV(GLenum target
, GLuint index
,
4360 GLuint num
, const GLdouble
*params
)
4363 for (i
= 0; i
< num
; i
++) {
4364 save_ProgramEnvParameter4dvARB(target
, index
+ i
, params
+ 4 * i
);
4369 static void GLAPIENTRY
4370 save_ProgramParameters4fvNV(GLenum target
, GLuint index
,
4371 GLuint num
, const GLfloat
*params
)
4374 for (i
= 0; i
< num
; i
++) {
4375 save_ProgramEnvParameter4fvARB(target
, index
+ i
, params
+ 4 * i
);
4380 static void GLAPIENTRY
4381 save_LoadProgramNV(GLenum target
, GLuint id
, GLsizei len
,
4382 const GLubyte
* program
)
4384 GET_CURRENT_CONTEXT(ctx
);
4386 GLubyte
*programCopy
;
4388 programCopy
= (GLubyte
*) _mesa_malloc(len
);
4390 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glLoadProgramNV");
4393 _mesa_memcpy(programCopy
, program
, len
);
4395 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4396 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LOAD_PROGRAM_NV
, 4);
4401 n
[4].data
= programCopy
;
4403 if (ctx
->ExecuteFlag
) {
4404 CALL_LoadProgramNV(ctx
->Exec
, (target
, id
, len
, program
));
4409 static void GLAPIENTRY
4410 save_RequestResidentProgramsNV(GLsizei num
, const GLuint
* ids
)
4412 GET_CURRENT_CONTEXT(ctx
);
4414 GLuint
*idCopy
= (GLuint
*) _mesa_malloc(num
* sizeof(GLuint
));
4416 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glRequestResidentProgramsNV");
4419 _mesa_memcpy(idCopy
, ids
, num
* sizeof(GLuint
));
4420 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4421 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TRACK_MATRIX_NV
, 2);
4426 if (ctx
->ExecuteFlag
) {
4427 CALL_RequestResidentProgramsNV(ctx
->Exec
, (num
, ids
));
4432 static void GLAPIENTRY
4433 save_TrackMatrixNV(GLenum target
, GLuint address
,
4434 GLenum matrix
, GLenum transform
)
4436 GET_CURRENT_CONTEXT(ctx
);
4438 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4439 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TRACK_MATRIX_NV
, 4);
4446 if (ctx
->ExecuteFlag
) {
4447 CALL_TrackMatrixNV(ctx
->Exec
, (target
, address
, matrix
, transform
));
4450 #endif /* FEATURE_NV_vertex_program */
4454 * GL_NV_fragment_program
4456 #if FEATURE_NV_fragment_program
4457 static void GLAPIENTRY
4458 save_ProgramLocalParameter4fARB(GLenum target
, GLuint index
,
4459 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4461 GET_CURRENT_CONTEXT(ctx
);
4463 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4464 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4473 if (ctx
->ExecuteFlag
) {
4474 CALL_ProgramLocalParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4479 static void GLAPIENTRY
4480 save_ProgramLocalParameter4fvARB(GLenum target
, GLuint index
,
4481 const GLfloat
*params
)
4483 GET_CURRENT_CONTEXT(ctx
);
4485 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4486 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4495 if (ctx
->ExecuteFlag
) {
4496 CALL_ProgramLocalParameter4fvARB(ctx
->Exec
, (target
, index
, params
));
4501 static void GLAPIENTRY
4502 save_ProgramLocalParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4503 const GLfloat
*params
)
4505 GET_CURRENT_CONTEXT(ctx
);
4507 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4511 const GLfloat
* p
= params
;
4513 for (i
= 0 ; i
< count
; i
++) {
4514 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4527 if (ctx
->ExecuteFlag
) {
4528 CALL_ProgramLocalParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4533 static void GLAPIENTRY
4534 save_ProgramLocalParameter4dARB(GLenum target
, GLuint index
,
4535 GLdouble x
, GLdouble y
,
4536 GLdouble z
, GLdouble w
)
4538 GET_CURRENT_CONTEXT(ctx
);
4540 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4541 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4545 n
[3].f
= (GLfloat
) x
;
4546 n
[4].f
= (GLfloat
) y
;
4547 n
[5].f
= (GLfloat
) z
;
4548 n
[6].f
= (GLfloat
) w
;
4550 if (ctx
->ExecuteFlag
) {
4551 CALL_ProgramLocalParameter4dARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4556 static void GLAPIENTRY
4557 save_ProgramLocalParameter4dvARB(GLenum target
, GLuint index
,
4558 const GLdouble
*params
)
4560 GET_CURRENT_CONTEXT(ctx
);
4562 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4563 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4567 n
[3].f
= (GLfloat
) params
[0];
4568 n
[4].f
= (GLfloat
) params
[1];
4569 n
[5].f
= (GLfloat
) params
[2];
4570 n
[6].f
= (GLfloat
) params
[3];
4572 if (ctx
->ExecuteFlag
) {
4573 CALL_ProgramLocalParameter4dvARB(ctx
->Exec
, (target
, index
, params
));
4577 static void GLAPIENTRY
4578 save_ProgramNamedParameter4fNV(GLuint id
, GLsizei len
, const GLubyte
* name
,
4579 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4581 GET_CURRENT_CONTEXT(ctx
);
4583 GLubyte
*nameCopy
= (GLubyte
*) _mesa_malloc(len
);
4585 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramNamedParameter4fNV");
4588 _mesa_memcpy(nameCopy
, name
, len
);
4590 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4591 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_NAMED_PARAMETER_NV
, 6);
4595 n
[3].data
= nameCopy
;
4601 if (ctx
->ExecuteFlag
) {
4602 CALL_ProgramNamedParameter4fNV(ctx
->Exec
, (id
, len
, name
, x
, y
, z
, w
));
4607 static void GLAPIENTRY
4608 save_ProgramNamedParameter4fvNV(GLuint id
, GLsizei len
, const GLubyte
* name
,
4611 save_ProgramNamedParameter4fNV(id
, len
, name
, v
[0], v
[1], v
[2], v
[3]);
4615 static void GLAPIENTRY
4616 save_ProgramNamedParameter4dNV(GLuint id
, GLsizei len
, const GLubyte
* name
,
4617 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4619 save_ProgramNamedParameter4fNV(id
, len
, name
, (GLfloat
) x
, (GLfloat
) y
,
4620 (GLfloat
) z
, (GLfloat
) w
);
4624 static void GLAPIENTRY
4625 save_ProgramNamedParameter4dvNV(GLuint id
, GLsizei len
, const GLubyte
* name
,
4628 save_ProgramNamedParameter4fNV(id
, len
, name
, (GLfloat
) v
[0],
4629 (GLfloat
) v
[1], (GLfloat
) v
[2],
4633 #endif /* FEATURE_NV_fragment_program */
4637 /* GL_EXT_stencil_two_side */
4638 static void GLAPIENTRY
4639 save_ActiveStencilFaceEXT(GLenum face
)
4641 GET_CURRENT_CONTEXT(ctx
);
4643 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4644 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ACTIVE_STENCIL_FACE_EXT
, 1);
4648 if (ctx
->ExecuteFlag
) {
4649 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (face
));
4654 /* GL_EXT_depth_bounds_test */
4655 static void GLAPIENTRY
4656 save_DepthBoundsEXT(GLclampd zmin
, GLclampd zmax
)
4658 GET_CURRENT_CONTEXT(ctx
);
4660 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4661 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DEPTH_BOUNDS_EXT
, 2);
4663 n
[1].f
= (GLfloat
) zmin
;
4664 n
[2].f
= (GLfloat
) zmax
;
4666 if (ctx
->ExecuteFlag
) {
4667 CALL_DepthBoundsEXT(ctx
->Exec
, (zmin
, zmax
));
4673 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
4675 static void GLAPIENTRY
4676 save_ProgramStringARB(GLenum target
, GLenum format
, GLsizei len
,
4677 const GLvoid
* string
)
4679 GET_CURRENT_CONTEXT(ctx
);
4681 GLubyte
*programCopy
;
4683 programCopy
= (GLubyte
*) _mesa_malloc(len
);
4685 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramStringARB");
4688 _mesa_memcpy(programCopy
, string
, len
);
4690 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4691 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_STRING_ARB
, 4);
4696 n
[4].data
= programCopy
;
4698 if (ctx
->ExecuteFlag
) {
4699 CALL_ProgramStringARB(ctx
->Exec
, (target
, format
, len
, string
));
4703 #endif /* FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program */
4706 #if FEATURE_ARB_occlusion_query
4708 static void GLAPIENTRY
4709 save_BeginQueryARB(GLenum target
, GLuint id
)
4711 GET_CURRENT_CONTEXT(ctx
);
4713 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4714 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BEGIN_QUERY_ARB
, 2);
4719 if (ctx
->ExecuteFlag
) {
4720 CALL_BeginQueryARB(ctx
->Exec
, (target
, id
));
4725 static void GLAPIENTRY
4726 save_EndQueryARB(GLenum target
)
4728 GET_CURRENT_CONTEXT(ctx
);
4730 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4731 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_END_QUERY_ARB
, 1);
4735 if (ctx
->ExecuteFlag
) {
4736 CALL_EndQueryARB(ctx
->Exec
, (target
));
4740 #endif /* FEATURE_ARB_occlusion_query */
4743 static void GLAPIENTRY
4744 save_DrawBuffersARB(GLsizei count
, const GLenum
* buffers
)
4746 GET_CURRENT_CONTEXT(ctx
);
4748 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4749 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DRAW_BUFFERS_ARB
, 1 + MAX_DRAW_BUFFERS
);
4753 if (count
> MAX_DRAW_BUFFERS
)
4754 count
= MAX_DRAW_BUFFERS
;
4755 for (i
= 0; i
< count
; i
++) {
4756 n
[2 + i
].e
= buffers
[i
];
4759 if (ctx
->ExecuteFlag
) {
4760 CALL_DrawBuffersARB(ctx
->Exec
, (count
, buffers
));
4764 #if FEATURE_ATI_fragment_shader
4765 static void GLAPIENTRY
4766 save_BindFragmentShaderATI(GLuint id
)
4768 GET_CURRENT_CONTEXT(ctx
);
4771 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BIND_FRAGMENT_SHADER_ATI
, 1);
4775 if (ctx
->ExecuteFlag
) {
4776 CALL_BindFragmentShaderATI(ctx
->Exec
, (id
));
4780 static void GLAPIENTRY
4781 save_SetFragmentShaderConstantATI(GLuint dst
, const GLfloat
*value
)
4783 GET_CURRENT_CONTEXT(ctx
);
4786 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
, 5);
4794 if (ctx
->ExecuteFlag
) {
4795 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, value
));
4801 save_Attr1fNV(GLenum attr
, GLfloat x
)
4803 GET_CURRENT_CONTEXT(ctx
);
4805 SAVE_FLUSH_VERTICES(ctx
);
4806 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_1F_NV
, 2);
4812 ASSERT(attr
< MAX_VERTEX_PROGRAM_ATTRIBS
);
4813 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
4814 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
4816 if (ctx
->ExecuteFlag
) {
4817 CALL_VertexAttrib1fNV(ctx
->Exec
, (attr
, x
));
4822 save_Attr2fNV(GLenum attr
, GLfloat x
, GLfloat y
)
4824 GET_CURRENT_CONTEXT(ctx
);
4826 SAVE_FLUSH_VERTICES(ctx
);
4827 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_2F_NV
, 3);
4834 ASSERT(attr
< MAX_VERTEX_PROGRAM_ATTRIBS
);
4835 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
4836 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
4838 if (ctx
->ExecuteFlag
) {
4839 CALL_VertexAttrib2fNV(ctx
->Exec
, (attr
, x
, y
));
4844 save_Attr3fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
4846 GET_CURRENT_CONTEXT(ctx
);
4848 SAVE_FLUSH_VERTICES(ctx
);
4849 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_3F_NV
, 4);
4857 ASSERT(attr
< MAX_VERTEX_PROGRAM_ATTRIBS
);
4858 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
4859 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
4861 if (ctx
->ExecuteFlag
) {
4862 CALL_VertexAttrib3fNV(ctx
->Exec
, (attr
, x
, y
, z
));
4867 save_Attr4fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4869 GET_CURRENT_CONTEXT(ctx
);
4871 SAVE_FLUSH_VERTICES(ctx
);
4872 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_4F_NV
, 5);
4881 ASSERT(attr
< MAX_VERTEX_PROGRAM_ATTRIBS
);
4882 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
4883 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
4885 if (ctx
->ExecuteFlag
) {
4886 CALL_VertexAttrib4fNV(ctx
->Exec
, (attr
, x
, y
, z
, w
));
4892 save_Attr1fARB(GLenum attr
, GLfloat x
)
4894 GET_CURRENT_CONTEXT(ctx
);
4896 SAVE_FLUSH_VERTICES(ctx
);
4897 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_1F_ARB
, 2);
4903 ASSERT(attr
< MAX_VERTEX_ATTRIBS
);
4904 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
4905 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
4907 if (ctx
->ExecuteFlag
) {
4908 CALL_VertexAttrib1fARB(ctx
->Exec
, (attr
, x
));
4913 save_Attr2fARB(GLenum attr
, GLfloat x
, GLfloat y
)
4915 GET_CURRENT_CONTEXT(ctx
);
4917 SAVE_FLUSH_VERTICES(ctx
);
4918 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_2F_ARB
, 3);
4925 ASSERT(attr
< MAX_VERTEX_ATTRIBS
);
4926 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
4927 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
4929 if (ctx
->ExecuteFlag
) {
4930 CALL_VertexAttrib2fARB(ctx
->Exec
, (attr
, x
, y
));
4935 save_Attr3fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
4937 GET_CURRENT_CONTEXT(ctx
);
4939 SAVE_FLUSH_VERTICES(ctx
);
4940 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_3F_ARB
, 4);
4948 ASSERT(attr
< MAX_VERTEX_ATTRIBS
);
4949 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
4950 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
4952 if (ctx
->ExecuteFlag
) {
4953 CALL_VertexAttrib3fARB(ctx
->Exec
, (attr
, x
, y
, z
));
4958 save_Attr4fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4960 GET_CURRENT_CONTEXT(ctx
);
4962 SAVE_FLUSH_VERTICES(ctx
);
4963 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_4F_ARB
, 5);
4972 ASSERT(attr
< MAX_VERTEX_ATTRIBS
);
4973 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
4974 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
4976 if (ctx
->ExecuteFlag
) {
4977 CALL_VertexAttrib4fARB(ctx
->Exec
, (attr
, x
, y
, z
, w
));
4982 static void GLAPIENTRY
4983 save_EvalCoord1f(GLfloat x
)
4985 GET_CURRENT_CONTEXT(ctx
);
4987 SAVE_FLUSH_VERTICES(ctx
);
4988 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVAL_C1
, 1);
4992 if (ctx
->ExecuteFlag
) {
4993 CALL_EvalCoord1f(ctx
->Exec
, (x
));
4997 static void GLAPIENTRY
4998 save_EvalCoord1fv(const GLfloat
* v
)
5000 save_EvalCoord1f(v
[0]);
5003 static void GLAPIENTRY
5004 save_EvalCoord2f(GLfloat x
, GLfloat y
)
5006 GET_CURRENT_CONTEXT(ctx
);
5008 SAVE_FLUSH_VERTICES(ctx
);
5009 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVAL_C2
, 2);
5014 if (ctx
->ExecuteFlag
) {
5015 CALL_EvalCoord2f(ctx
->Exec
, (x
, y
));
5019 static void GLAPIENTRY
5020 save_EvalCoord2fv(const GLfloat
* v
)
5022 save_EvalCoord2f(v
[0], v
[1]);
5026 static void GLAPIENTRY
5027 save_EvalPoint1(GLint x
)
5029 GET_CURRENT_CONTEXT(ctx
);
5031 SAVE_FLUSH_VERTICES(ctx
);
5032 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVAL_P1
, 1);
5036 if (ctx
->ExecuteFlag
) {
5037 CALL_EvalPoint1(ctx
->Exec
, (x
));
5041 static void GLAPIENTRY
5042 save_EvalPoint2(GLint x
, GLint y
)
5044 GET_CURRENT_CONTEXT(ctx
);
5046 SAVE_FLUSH_VERTICES(ctx
);
5047 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVAL_P2
, 2);
5052 if (ctx
->ExecuteFlag
) {
5053 CALL_EvalPoint2(ctx
->Exec
, (x
, y
));
5057 static void GLAPIENTRY
5058 save_Indexf(GLfloat x
)
5060 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, x
);
5063 static void GLAPIENTRY
5064 save_Indexfv(const GLfloat
* v
)
5066 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, v
[0]);
5069 static void GLAPIENTRY
5070 save_EdgeFlag(GLboolean x
)
5072 save_Attr1fNV(VERT_ATTRIB_EDGEFLAG
, x
? (GLfloat
)1.0 : (GLfloat
)0.0);
5075 static void GLAPIENTRY
5076 save_Materialfv(GLenum face
, GLenum pname
, const GLfloat
* param
)
5078 GET_CURRENT_CONTEXT(ctx
);
5082 SAVE_FLUSH_VERTICES(ctx
);
5087 case GL_FRONT_AND_BACK
:
5090 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "material(face)");
5099 case GL_AMBIENT_AND_DIFFUSE
:
5105 case GL_COLOR_INDEXES
:
5109 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "material(pname)");
5113 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MATERIAL
, 6);
5117 for (i
= 0; i
< args
; i
++)
5118 n
[3 + i
].f
= param
[i
];
5122 GLuint bitmask
= _mesa_material_bitmask(ctx
, face
, pname
, ~0, NULL
);
5123 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++)
5124 if (bitmask
& (1 << i
)) {
5125 ctx
->ListState
.ActiveMaterialSize
[i
] = args
;
5126 COPY_SZ_4V(ctx
->ListState
.CurrentMaterial
[i
], args
, param
);
5130 if (ctx
->ExecuteFlag
) {
5131 CALL_Materialfv(ctx
->Exec
, (face
, pname
, param
));
5135 static void GLAPIENTRY
5136 save_Begin(GLenum mode
)
5138 GET_CURRENT_CONTEXT(ctx
);
5140 GLboolean error
= GL_FALSE
;
5142 if ( /*mode < GL_POINTS || */ mode
> GL_POLYGON
) {
5143 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "Begin (mode)");
5146 else if (ctx
->Driver
.CurrentSavePrimitive
== PRIM_UNKNOWN
) {
5147 /* Typically the first begin. This may raise an error on
5148 * playback, depending on whether CallList is issued from inside
5149 * a begin/end or not.
5151 ctx
->Driver
.CurrentSavePrimitive
= PRIM_INSIDE_UNKNOWN_PRIM
;
5153 else if (ctx
->Driver
.CurrentSavePrimitive
== PRIM_OUTSIDE_BEGIN_END
) {
5154 ctx
->Driver
.CurrentSavePrimitive
= mode
;
5157 _mesa_compile_error(ctx
, GL_INVALID_OPERATION
, "recursive begin");
5162 /* Give the driver an opportunity to hook in an optimized
5163 * display list compiler.
5165 if (ctx
->Driver
.NotifySaveBegin(ctx
, mode
))
5168 SAVE_FLUSH_VERTICES(ctx
);
5169 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BEGIN
, 1);
5175 if (ctx
->ExecuteFlag
) {
5176 CALL_Begin(ctx
->Exec
, (mode
));
5180 static void GLAPIENTRY
5183 GET_CURRENT_CONTEXT(ctx
);
5184 SAVE_FLUSH_VERTICES(ctx
);
5185 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_END
, 0);
5186 ctx
->Driver
.CurrentSavePrimitive
= PRIM_OUTSIDE_BEGIN_END
;
5187 if (ctx
->ExecuteFlag
) {
5188 CALL_End(ctx
->Exec
, ());
5192 static void GLAPIENTRY
5193 save_Rectf(GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
5195 GET_CURRENT_CONTEXT(ctx
);
5197 SAVE_FLUSH_VERTICES(ctx
);
5198 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_RECTF
, 4);
5205 if (ctx
->ExecuteFlag
) {
5206 CALL_Rectf(ctx
->Exec
, (a
, b
, c
, d
));
5211 static void GLAPIENTRY
5212 save_Vertex2f(GLfloat x
, GLfloat y
)
5214 save_Attr2fNV(VERT_ATTRIB_POS
, x
, y
);
5217 static void GLAPIENTRY
5218 save_Vertex2fv(const GLfloat
* v
)
5220 save_Attr2fNV(VERT_ATTRIB_POS
, v
[0], v
[1]);
5223 static void GLAPIENTRY
5224 save_Vertex3f(GLfloat x
, GLfloat y
, GLfloat z
)
5226 save_Attr3fNV(VERT_ATTRIB_POS
, x
, y
, z
);
5229 static void GLAPIENTRY
5230 save_Vertex3fv(const GLfloat
* v
)
5232 save_Attr3fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2]);
5235 static void GLAPIENTRY
5236 save_Vertex4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5238 save_Attr4fNV(VERT_ATTRIB_POS
, x
, y
, z
, w
);
5241 static void GLAPIENTRY
5242 save_Vertex4fv(const GLfloat
* v
)
5244 save_Attr4fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2], v
[3]);
5247 static void GLAPIENTRY
5248 save_TexCoord1f(GLfloat x
)
5250 save_Attr1fNV(VERT_ATTRIB_TEX0
, x
);
5253 static void GLAPIENTRY
5254 save_TexCoord1fv(const GLfloat
* v
)
5256 save_Attr1fNV(VERT_ATTRIB_TEX0
, v
[0]);
5259 static void GLAPIENTRY
5260 save_TexCoord2f(GLfloat x
, GLfloat y
)
5262 save_Attr2fNV(VERT_ATTRIB_TEX0
, x
, y
);
5265 static void GLAPIENTRY
5266 save_TexCoord2fv(const GLfloat
* v
)
5268 save_Attr2fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1]);
5271 static void GLAPIENTRY
5272 save_TexCoord3f(GLfloat x
, GLfloat y
, GLfloat z
)
5274 save_Attr3fNV(VERT_ATTRIB_TEX0
, x
, y
, z
);
5277 static void GLAPIENTRY
5278 save_TexCoord3fv(const GLfloat
* v
)
5280 save_Attr3fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2]);
5283 static void GLAPIENTRY
5284 save_TexCoord4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5286 save_Attr4fNV(VERT_ATTRIB_TEX0
, x
, y
, z
, w
);
5289 static void GLAPIENTRY
5290 save_TexCoord4fv(const GLfloat
* v
)
5292 save_Attr4fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2], v
[3]);
5295 static void GLAPIENTRY
5296 save_Normal3f(GLfloat x
, GLfloat y
, GLfloat z
)
5298 save_Attr3fNV(VERT_ATTRIB_NORMAL
, x
, y
, z
);
5301 static void GLAPIENTRY
5302 save_Normal3fv(const GLfloat
* v
)
5304 save_Attr3fNV(VERT_ATTRIB_NORMAL
, v
[0], v
[1], v
[2]);
5307 static void GLAPIENTRY
5308 save_FogCoordfEXT(GLfloat x
)
5310 save_Attr1fNV(VERT_ATTRIB_FOG
, x
);
5313 static void GLAPIENTRY
5314 save_FogCoordfvEXT(const GLfloat
* v
)
5316 save_Attr1fNV(VERT_ATTRIB_FOG
, v
[0]);
5319 static void GLAPIENTRY
5320 save_Color3f(GLfloat x
, GLfloat y
, GLfloat z
)
5322 save_Attr3fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
);
5325 static void GLAPIENTRY
5326 save_Color3fv(const GLfloat
* v
)
5328 save_Attr3fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2]);
5331 static void GLAPIENTRY
5332 save_Color4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5334 save_Attr4fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
, w
);
5337 static void GLAPIENTRY
5338 save_Color4fv(const GLfloat
* v
)
5340 save_Attr4fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2], v
[3]);
5343 static void GLAPIENTRY
5344 save_SecondaryColor3fEXT(GLfloat x
, GLfloat y
, GLfloat z
)
5346 save_Attr3fNV(VERT_ATTRIB_COLOR1
, x
, y
, z
);
5349 static void GLAPIENTRY
5350 save_SecondaryColor3fvEXT(const GLfloat
* v
)
5352 save_Attr3fNV(VERT_ATTRIB_COLOR1
, v
[0], v
[1], v
[2]);
5356 /* Just call the respective ATTR for texcoord
5358 static void GLAPIENTRY
5359 save_MultiTexCoord1f(GLenum target
, GLfloat x
)
5361 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5362 save_Attr1fNV(attr
, x
);
5365 static void GLAPIENTRY
5366 save_MultiTexCoord1fv(GLenum target
, const GLfloat
* v
)
5368 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5369 save_Attr1fNV(attr
, v
[0]);
5372 static void GLAPIENTRY
5373 save_MultiTexCoord2f(GLenum target
, GLfloat x
, GLfloat y
)
5375 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5376 save_Attr2fNV(attr
, x
, y
);
5379 static void GLAPIENTRY
5380 save_MultiTexCoord2fv(GLenum target
, const GLfloat
* v
)
5382 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5383 save_Attr2fNV(attr
, v
[0], v
[1]);
5386 static void GLAPIENTRY
5387 save_MultiTexCoord3f(GLenum target
, GLfloat x
, GLfloat y
, GLfloat z
)
5389 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5390 save_Attr3fNV(attr
, x
, y
, z
);
5393 static void GLAPIENTRY
5394 save_MultiTexCoord3fv(GLenum target
, const GLfloat
* v
)
5396 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5397 save_Attr3fNV(attr
, v
[0], v
[1], v
[2]);
5400 static void GLAPIENTRY
5401 save_MultiTexCoord4f(GLenum target
, GLfloat x
, GLfloat y
,
5402 GLfloat z
, GLfloat w
)
5404 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5405 save_Attr4fNV(attr
, x
, y
, z
, w
);
5408 static void GLAPIENTRY
5409 save_MultiTexCoord4fv(GLenum target
, const GLfloat
* v
)
5411 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5412 save_Attr4fNV(attr
, v
[0], v
[1], v
[2], v
[3]);
5417 * Record a GL_INVALID_VALUE error when a invalid vertex attribute
5423 GET_CURRENT_CONTEXT(ctx
);
5424 _mesa_error(ctx
, GL_INVALID_VALUE
, "VertexAttribf(index)");
5428 /* First level for NV_vertex_program:
5430 * Check for errors at compile time?.
5432 static void GLAPIENTRY
5433 save_VertexAttrib1fNV(GLuint index
, GLfloat x
)
5435 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5436 save_Attr1fNV(index
, x
);
5441 static void GLAPIENTRY
5442 save_VertexAttrib1fvNV(GLuint index
, const GLfloat
* v
)
5444 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5445 save_Attr1fNV(index
, v
[0]);
5450 static void GLAPIENTRY
5451 save_VertexAttrib2fNV(GLuint index
, GLfloat x
, GLfloat y
)
5453 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5454 save_Attr2fNV(index
, x
, y
);
5459 static void GLAPIENTRY
5460 save_VertexAttrib2fvNV(GLuint index
, const GLfloat
* v
)
5462 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5463 save_Attr2fNV(index
, v
[0], v
[1]);
5468 static void GLAPIENTRY
5469 save_VertexAttrib3fNV(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
5471 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5472 save_Attr3fNV(index
, x
, y
, z
);
5477 static void GLAPIENTRY
5478 save_VertexAttrib3fvNV(GLuint index
, const GLfloat
* v
)
5480 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5481 save_Attr3fNV(index
, v
[0], v
[1], v
[2]);
5486 static void GLAPIENTRY
5487 save_VertexAttrib4fNV(GLuint index
, GLfloat x
, GLfloat y
,
5488 GLfloat z
, GLfloat w
)
5490 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5491 save_Attr4fNV(index
, x
, y
, z
, w
);
5496 static void GLAPIENTRY
5497 save_VertexAttrib4fvNV(GLuint index
, const GLfloat
* v
)
5499 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5500 save_Attr4fNV(index
, v
[0], v
[1], v
[2], v
[3]);
5508 static void GLAPIENTRY
5509 save_VertexAttrib1fARB(GLuint index
, GLfloat x
)
5511 if (index
< MAX_VERTEX_ATTRIBS
)
5512 save_Attr1fARB(index
, x
);
5517 static void GLAPIENTRY
5518 save_VertexAttrib1fvARB(GLuint index
, const GLfloat
* v
)
5520 if (index
< MAX_VERTEX_ATTRIBS
)
5521 save_Attr1fARB(index
, v
[0]);
5526 static void GLAPIENTRY
5527 save_VertexAttrib2fARB(GLuint index
, GLfloat x
, GLfloat y
)
5529 if (index
< MAX_VERTEX_ATTRIBS
)
5530 save_Attr2fARB(index
, x
, y
);
5535 static void GLAPIENTRY
5536 save_VertexAttrib2fvARB(GLuint index
, const GLfloat
* v
)
5538 if (index
< MAX_VERTEX_ATTRIBS
)
5539 save_Attr2fARB(index
, v
[0], v
[1]);
5544 static void GLAPIENTRY
5545 save_VertexAttrib3fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
5547 if (index
< MAX_VERTEX_ATTRIBS
)
5548 save_Attr3fARB(index
, x
, y
, z
);
5553 static void GLAPIENTRY
5554 save_VertexAttrib3fvARB(GLuint index
, const GLfloat
* v
)
5556 if (index
< MAX_VERTEX_ATTRIBS
)
5557 save_Attr3fARB(index
, v
[0], v
[1], v
[2]);
5562 static void GLAPIENTRY
5563 save_VertexAttrib4fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
,
5566 if (index
< MAX_VERTEX_ATTRIBS
)
5567 save_Attr4fARB(index
, x
, y
, z
, w
);
5572 static void GLAPIENTRY
5573 save_VertexAttrib4fvARB(GLuint index
, const GLfloat
* v
)
5575 if (index
< MAX_VERTEX_ATTRIBS
)
5576 save_Attr4fARB(index
, v
[0], v
[1], v
[2], v
[3]);
5582 #if FEATURE_EXT_framebuffer_blit
5583 static void GLAPIENTRY
5584 save_BlitFramebufferEXT(GLint srcX0
, GLint srcY0
, GLint srcX1
, GLint srcY1
,
5585 GLint dstX0
, GLint dstY0
, GLint dstX1
, GLint dstY1
,
5586 GLbitfield mask
, GLenum filter
)
5588 GET_CURRENT_CONTEXT(ctx
);
5590 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5591 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BLIT_FRAMEBUFFER
, 10);
5604 if (ctx
->ExecuteFlag
) {
5605 CALL_BlitFramebufferEXT(ctx
->Exec
, (srcX0
, srcY0
, srcX1
, srcY1
,
5606 dstX0
, dstY0
, dstX1
, dstY1
,
5614 * Save an error-generating command into display list.
5616 * KW: Will appear in the list before the vertex buffer containing the
5617 * command that provoked the error. I don't see this as a problem.
5620 save_error(GLcontext
*ctx
, GLenum error
, const char *s
)
5623 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ERROR
, 2);
5626 n
[2].data
= (void *) s
;
5632 * Compile an error into current display list.
5635 _mesa_compile_error(GLcontext
*ctx
, GLenum error
, const char *s
)
5637 if (ctx
->CompileFlag
)
5638 save_error(ctx
, error
, s
);
5639 if (ctx
->ExecuteFlag
)
5640 _mesa_error(ctx
, error
, s
);
5645 * Test if ID names a display list.
5648 islist(GLcontext
*ctx
, GLuint list
)
5650 if (list
> 0 && lookup_list(ctx
, list
)) {
5660 /**********************************************************************/
5661 /* Display list execution */
5662 /**********************************************************************/
5666 * Execute a display list. Note that the ListBase offset must have already
5667 * been added before calling this function. I.e. the list argument is
5668 * the absolute list number, not relative to ListBase.
5669 * \param list - display list number
5672 execute_list(GLcontext
*ctx
, GLuint list
)
5674 struct mesa_display_list
*dlist
;
5678 if (list
== 0 || !islist(ctx
, list
))
5681 if (ctx
->ListState
.CallDepth
== MAX_LIST_NESTING
) {
5682 /* raise an error? */
5686 dlist
= lookup_list(ctx
, list
);
5690 ctx
->ListState
.CallStack
[ctx
->ListState
.CallDepth
++] = dlist
;
5692 if (ctx
->Driver
.BeginCallList
)
5693 ctx
->Driver
.BeginCallList(ctx
, dlist
);
5699 OpCode opcode
= n
[0].opcode
;
5700 int i
= (int) n
[0].opcode
- (int) OPCODE_EXT_0
;
5702 if (i
>= 0 && i
< (GLint
) ctx
->ListExt
.NumOpcodes
) {
5703 /* this is a driver-extended opcode */
5704 ctx
->ListExt
.Opcode
[i
].Execute(ctx
, &n
[1]);
5705 n
+= ctx
->ListExt
.Opcode
[i
].Size
;
5710 _mesa_error(ctx
, n
[1].e
, (const char *) n
[2].data
);
5713 CALL_Accum(ctx
->Exec
, (n
[1].e
, n
[2].f
));
5715 case OPCODE_ALPHA_FUNC
:
5716 CALL_AlphaFunc(ctx
->Exec
, (n
[1].e
, n
[2].f
));
5718 case OPCODE_BIND_TEXTURE
:
5719 CALL_BindTexture(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
5723 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5724 ctx
->Unpack
= ctx
->DefaultPacking
;
5725 CALL_Bitmap(ctx
->Exec
, ((GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
5726 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
5727 (const GLubyte
*) n
[7].data
));
5728 ctx
->Unpack
= save
; /* restore */
5731 case OPCODE_BLEND_COLOR
:
5732 CALL_BlendColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
5734 case OPCODE_BLEND_EQUATION
:
5735 CALL_BlendEquation(ctx
->Exec
, (n
[1].e
));
5737 case OPCODE_BLEND_EQUATION_SEPARATE
:
5738 CALL_BlendEquationSeparateEXT(ctx
->Exec
, (n
[1].e
, n
[2].e
));
5740 case OPCODE_BLEND_FUNC_SEPARATE
:
5741 CALL_BlendFuncSeparateEXT(ctx
->Exec
,
5742 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
5744 case OPCODE_CALL_LIST
:
5745 /* Generated by glCallList(), don't add ListBase */
5746 if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
5747 execute_list(ctx
, n
[1].ui
);
5750 case OPCODE_CALL_LIST_OFFSET
:
5751 /* Generated by glCallLists() so we must add ListBase */
5753 /* user specified a bad data type at compile time */
5754 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
5756 else if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
5757 execute_list(ctx
, ctx
->List
.ListBase
+ n
[1].ui
);
5761 CALL_Clear(ctx
->Exec
, (n
[1].bf
));
5763 case OPCODE_CLEAR_COLOR
:
5764 CALL_ClearColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
5766 case OPCODE_CLEAR_ACCUM
:
5767 CALL_ClearAccum(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
5769 case OPCODE_CLEAR_DEPTH
:
5770 CALL_ClearDepth(ctx
->Exec
, ((GLclampd
) n
[1].f
));
5772 case OPCODE_CLEAR_INDEX
:
5773 CALL_ClearIndex(ctx
->Exec
, ((GLfloat
) n
[1].ui
));
5775 case OPCODE_CLEAR_STENCIL
:
5776 CALL_ClearStencil(ctx
->Exec
, (n
[1].i
));
5778 case OPCODE_CLIP_PLANE
:
5785 CALL_ClipPlane(ctx
->Exec
, (n
[1].e
, eq
));
5788 case OPCODE_COLOR_MASK
:
5789 CALL_ColorMask(ctx
->Exec
, (n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
));
5791 case OPCODE_COLOR_MATERIAL
:
5792 CALL_ColorMaterial(ctx
->Exec
, (n
[1].e
, n
[2].e
));
5794 case OPCODE_COLOR_TABLE
:
5796 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5797 ctx
->Unpack
= ctx
->DefaultPacking
;
5798 CALL_ColorTable(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].e
,
5799 n
[5].e
, n
[6].data
));
5800 ctx
->Unpack
= save
; /* restore */
5803 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
5810 CALL_ColorTableParameterfv(ctx
->Exec
,
5811 (n
[1].e
, n
[2].e
, params
));
5814 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
5821 CALL_ColorTableParameteriv(ctx
->Exec
,
5822 (n
[1].e
, n
[2].e
, params
));
5825 case OPCODE_COLOR_SUB_TABLE
:
5827 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5828 ctx
->Unpack
= ctx
->DefaultPacking
;
5829 CALL_ColorSubTable(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5830 n
[4].e
, n
[5].e
, n
[6].data
));
5831 ctx
->Unpack
= save
; /* restore */
5834 case OPCODE_CONVOLUTION_FILTER_1D
:
5836 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5837 ctx
->Unpack
= ctx
->DefaultPacking
;
5838 CALL_ConvolutionFilter1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5841 ctx
->Unpack
= save
; /* restore */
5844 case OPCODE_CONVOLUTION_FILTER_2D
:
5846 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5847 ctx
->Unpack
= ctx
->DefaultPacking
;
5848 CALL_ConvolutionFilter2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5849 n
[4].i
, n
[5].e
, n
[6].e
,
5851 ctx
->Unpack
= save
; /* restore */
5854 case OPCODE_CONVOLUTION_PARAMETER_I
:
5855 CALL_ConvolutionParameteri(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].i
));
5857 case OPCODE_CONVOLUTION_PARAMETER_IV
:
5864 CALL_ConvolutionParameteriv(ctx
->Exec
,
5865 (n
[1].e
, n
[2].e
, params
));
5868 case OPCODE_CONVOLUTION_PARAMETER_F
:
5869 CALL_ConvolutionParameterf(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].f
));
5871 case OPCODE_CONVOLUTION_PARAMETER_FV
:
5878 CALL_ConvolutionParameterfv(ctx
->Exec
,
5879 (n
[1].e
, n
[2].e
, params
));
5882 case OPCODE_COPY_COLOR_SUB_TABLE
:
5883 CALL_CopyColorSubTable(ctx
->Exec
, (n
[1].e
, n
[2].i
,
5884 n
[3].i
, n
[4].i
, n
[5].i
));
5886 case OPCODE_COPY_COLOR_TABLE
:
5887 CALL_CopyColorSubTable(ctx
->Exec
, (n
[1].e
, n
[2].i
,
5888 n
[3].i
, n
[4].i
, n
[5].i
));
5890 case OPCODE_COPY_PIXELS
:
5891 CALL_CopyPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
,
5892 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
,
5895 case OPCODE_COPY_TEX_IMAGE1D
:
5896 CALL_CopyTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
5897 n
[5].i
, n
[6].i
, n
[7].i
));
5899 case OPCODE_COPY_TEX_IMAGE2D
:
5900 CALL_CopyTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
5901 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
));
5903 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
5904 CALL_CopyTexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5905 n
[4].i
, n
[5].i
, n
[6].i
));
5907 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
5908 CALL_CopyTexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5909 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
5912 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
5913 CALL_CopyTexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5914 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
5917 case OPCODE_CULL_FACE
:
5918 CALL_CullFace(ctx
->Exec
, (n
[1].e
));
5920 case OPCODE_DEPTH_FUNC
:
5921 CALL_DepthFunc(ctx
->Exec
, (n
[1].e
));
5923 case OPCODE_DEPTH_MASK
:
5924 CALL_DepthMask(ctx
->Exec
, (n
[1].b
));
5926 case OPCODE_DEPTH_RANGE
:
5927 CALL_DepthRange(ctx
->Exec
,
5928 ((GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
));
5930 case OPCODE_DISABLE
:
5931 CALL_Disable(ctx
->Exec
, (n
[1].e
));
5933 case OPCODE_DRAW_BUFFER
:
5934 CALL_DrawBuffer(ctx
->Exec
, (n
[1].e
));
5936 case OPCODE_DRAW_PIXELS
:
5938 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5939 ctx
->Unpack
= ctx
->DefaultPacking
;
5940 CALL_DrawPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
5942 ctx
->Unpack
= save
; /* restore */
5946 CALL_Enable(ctx
->Exec
, (n
[1].e
));
5948 case OPCODE_EVALMESH1
:
5949 CALL_EvalMesh1(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
));
5951 case OPCODE_EVALMESH2
:
5952 CALL_EvalMesh2(ctx
->Exec
,
5953 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
5962 CALL_Fogfv(ctx
->Exec
, (n
[1].e
, p
));
5965 case OPCODE_FRONT_FACE
:
5966 CALL_FrontFace(ctx
->Exec
, (n
[1].e
));
5968 case OPCODE_FRUSTUM
:
5969 CALL_Frustum(ctx
->Exec
,
5970 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
5973 CALL_Hint(ctx
->Exec
, (n
[1].e
, n
[2].e
));
5975 case OPCODE_HISTOGRAM
:
5976 CALL_Histogram(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].b
));
5978 case OPCODE_INDEX_MASK
:
5979 CALL_IndexMask(ctx
->Exec
, (n
[1].ui
));
5981 case OPCODE_INIT_NAMES
:
5982 CALL_InitNames(ctx
->Exec
, ());
5991 CALL_Lightfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, p
));
5994 case OPCODE_LIGHT_MODEL
:
6001 CALL_LightModelfv(ctx
->Exec
, (n
[1].e
, p
));
6004 case OPCODE_LINE_STIPPLE
:
6005 CALL_LineStipple(ctx
->Exec
, (n
[1].i
, n
[2].us
));
6007 case OPCODE_LINE_WIDTH
:
6008 CALL_LineWidth(ctx
->Exec
, (n
[1].f
));
6010 case OPCODE_LIST_BASE
:
6011 CALL_ListBase(ctx
->Exec
, (n
[1].ui
));
6013 case OPCODE_LOAD_IDENTITY
:
6014 CALL_LoadIdentity(ctx
->Exec
, ());
6016 case OPCODE_LOAD_MATRIX
:
6017 if (sizeof(Node
) == sizeof(GLfloat
)) {
6018 CALL_LoadMatrixf(ctx
->Exec
, (&n
[1].f
));
6023 for (i
= 0; i
< 16; i
++) {
6026 CALL_LoadMatrixf(ctx
->Exec
, (m
));
6029 case OPCODE_LOAD_NAME
:
6030 CALL_LoadName(ctx
->Exec
, (n
[1].ui
));
6032 case OPCODE_LOGIC_OP
:
6033 CALL_LogicOp(ctx
->Exec
, (n
[1].e
));
6037 GLenum target
= n
[1].e
;
6038 GLint ustride
= _mesa_evaluator_components(target
);
6039 GLint uorder
= n
[5].i
;
6040 GLfloat u1
= n
[2].f
;
6041 GLfloat u2
= n
[3].f
;
6042 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
6043 (GLfloat
*) n
[6].data
));
6048 GLenum target
= n
[1].e
;
6049 GLfloat u1
= n
[2].f
;
6050 GLfloat u2
= n
[3].f
;
6051 GLfloat v1
= n
[4].f
;
6052 GLfloat v2
= n
[5].f
;
6053 GLint ustride
= n
[6].i
;
6054 GLint vstride
= n
[7].i
;
6055 GLint uorder
= n
[8].i
;
6056 GLint vorder
= n
[9].i
;
6057 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
6058 v1
, v2
, vstride
, vorder
,
6059 (GLfloat
*) n
[10].data
));
6062 case OPCODE_MAPGRID1
:
6063 CALL_MapGrid1f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
6065 case OPCODE_MAPGRID2
:
6066 CALL_MapGrid2f(ctx
->Exec
,
6067 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
));
6069 case OPCODE_MATRIX_MODE
:
6070 CALL_MatrixMode(ctx
->Exec
, (n
[1].e
));
6072 case OPCODE_MIN_MAX
:
6073 CALL_Minmax(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].b
));
6075 case OPCODE_MULT_MATRIX
:
6076 if (sizeof(Node
) == sizeof(GLfloat
)) {
6077 CALL_MultMatrixf(ctx
->Exec
, (&n
[1].f
));
6082 for (i
= 0; i
< 16; i
++) {
6085 CALL_MultMatrixf(ctx
->Exec
, (m
));
6089 CALL_Ortho(ctx
->Exec
,
6090 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
6092 case OPCODE_PASSTHROUGH
:
6093 CALL_PassThrough(ctx
->Exec
, (n
[1].f
));
6095 case OPCODE_PIXEL_MAP
:
6096 CALL_PixelMapfv(ctx
->Exec
,
6097 (n
[1].e
, n
[2].i
, (GLfloat
*) n
[3].data
));
6099 case OPCODE_PIXEL_TRANSFER
:
6100 CALL_PixelTransferf(ctx
->Exec
, (n
[1].e
, n
[2].f
));
6102 case OPCODE_PIXEL_ZOOM
:
6103 CALL_PixelZoom(ctx
->Exec
, (n
[1].f
, n
[2].f
));
6105 case OPCODE_POINT_SIZE
:
6106 CALL_PointSize(ctx
->Exec
, (n
[1].f
));
6108 case OPCODE_POINT_PARAMETERS
:
6114 CALL_PointParameterfvEXT(ctx
->Exec
, (n
[1].e
, params
));
6117 case OPCODE_POLYGON_MODE
:
6118 CALL_PolygonMode(ctx
->Exec
, (n
[1].e
, n
[2].e
));
6120 case OPCODE_POLYGON_STIPPLE
:
6121 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) n
[1].data
));
6123 case OPCODE_POLYGON_OFFSET
:
6124 CALL_PolygonOffset(ctx
->Exec
, (n
[1].f
, n
[2].f
));
6126 case OPCODE_POP_ATTRIB
:
6127 CALL_PopAttrib(ctx
->Exec
, ());
6129 case OPCODE_POP_MATRIX
:
6130 CALL_PopMatrix(ctx
->Exec
, ());
6132 case OPCODE_POP_NAME
:
6133 CALL_PopName(ctx
->Exec
, ());
6135 case OPCODE_PRIORITIZE_TEXTURE
:
6136 CALL_PrioritizeTextures(ctx
->Exec
, (1, &n
[1].ui
, &n
[2].f
));
6138 case OPCODE_PUSH_ATTRIB
:
6139 CALL_PushAttrib(ctx
->Exec
, (n
[1].bf
));
6141 case OPCODE_PUSH_MATRIX
:
6142 CALL_PushMatrix(ctx
->Exec
, ());
6144 case OPCODE_PUSH_NAME
:
6145 CALL_PushName(ctx
->Exec
, (n
[1].ui
));
6147 case OPCODE_RASTER_POS
:
6148 CALL_RasterPos4f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
6150 case OPCODE_READ_BUFFER
:
6151 CALL_ReadBuffer(ctx
->Exec
, (n
[1].e
));
6153 case OPCODE_RESET_HISTOGRAM
:
6154 CALL_ResetHistogram(ctx
->Exec
, (n
[1].e
));
6156 case OPCODE_RESET_MIN_MAX
:
6157 CALL_ResetMinmax(ctx
->Exec
, (n
[1].e
));
6160 CALL_Rotatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
6163 CALL_Scalef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
6165 case OPCODE_SCISSOR
:
6166 CALL_Scissor(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
6168 case OPCODE_SHADE_MODEL
:
6169 CALL_ShadeModel(ctx
->Exec
, (n
[1].e
));
6171 case OPCODE_STENCIL_FUNC
:
6172 CALL_StencilFunc(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].ui
));
6174 case OPCODE_STENCIL_MASK
:
6175 CALL_StencilMask(ctx
->Exec
, (n
[1].ui
));
6177 case OPCODE_STENCIL_OP
:
6178 CALL_StencilOp(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].e
));
6180 case OPCODE_STENCIL_FUNC_SEPARATE
:
6181 CALL_StencilFuncSeparate(ctx
->Exec
,
6182 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].ui
));
6184 case OPCODE_STENCIL_MASK_SEPARATE
:
6185 CALL_StencilMaskSeparate(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
6187 case OPCODE_STENCIL_OP_SEPARATE
:
6188 CALL_StencilOpSeparate(ctx
->Exec
,
6189 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
6198 CALL_TexEnvfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
6208 CALL_TexGenfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
6211 case OPCODE_TEXPARAMETER
:
6218 CALL_TexParameterfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
6221 case OPCODE_TEX_IMAGE1D
:
6223 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6224 ctx
->Unpack
= ctx
->DefaultPacking
;
6225 CALL_TexImage1D(ctx
->Exec
, (n
[1].e
, /* target */
6227 n
[3].i
, /* components */
6229 n
[5].e
, /* border */
6230 n
[6].e
, /* format */
6233 ctx
->Unpack
= save
; /* restore */
6236 case OPCODE_TEX_IMAGE2D
:
6238 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6239 ctx
->Unpack
= ctx
->DefaultPacking
;
6240 CALL_TexImage2D(ctx
->Exec
, (n
[1].e
, /* target */
6242 n
[3].i
, /* components */
6244 n
[5].i
, /* height */
6245 n
[6].e
, /* border */
6246 n
[7].e
, /* format */
6249 ctx
->Unpack
= save
; /* restore */
6252 case OPCODE_TEX_IMAGE3D
:
6254 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6255 ctx
->Unpack
= ctx
->DefaultPacking
;
6256 CALL_TexImage3D(ctx
->Exec
, (n
[1].e
, /* target */
6258 n
[3].i
, /* components */
6260 n
[5].i
, /* height */
6262 n
[7].e
, /* border */
6263 n
[8].e
, /* format */
6266 ctx
->Unpack
= save
; /* restore */
6269 case OPCODE_TEX_SUB_IMAGE1D
:
6271 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6272 ctx
->Unpack
= ctx
->DefaultPacking
;
6273 CALL_TexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
6275 n
[6].e
, n
[7].data
));
6276 ctx
->Unpack
= save
; /* restore */
6279 case OPCODE_TEX_SUB_IMAGE2D
:
6281 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6282 ctx
->Unpack
= ctx
->DefaultPacking
;
6283 CALL_TexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
6285 n
[6].i
, n
[7].e
, n
[8].e
,
6287 ctx
->Unpack
= save
; /* restore */
6290 case OPCODE_TEX_SUB_IMAGE3D
:
6292 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6293 ctx
->Unpack
= ctx
->DefaultPacking
;
6294 CALL_TexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
6295 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
6296 n
[8].i
, n
[9].e
, n
[10].e
,
6298 ctx
->Unpack
= save
; /* restore */
6301 case OPCODE_TRANSLATE
:
6302 CALL_Translatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
6304 case OPCODE_VIEWPORT
:
6305 CALL_Viewport(ctx
->Exec
, (n
[1].i
, n
[2].i
,
6306 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
));
6308 case OPCODE_WINDOW_POS
:
6309 CALL_WindowPos4fMESA(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
6311 case OPCODE_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
6312 CALL_ActiveTextureARB(ctx
->Exec
, (n
[1].e
));
6314 case OPCODE_COMPRESSED_TEX_IMAGE_1D
: /* GL_ARB_texture_compression */
6315 CALL_CompressedTexImage1DARB(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
6316 n
[4].i
, n
[5].i
, n
[6].i
,
6319 case OPCODE_COMPRESSED_TEX_IMAGE_2D
: /* GL_ARB_texture_compression */
6320 CALL_CompressedTexImage2DARB(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
6321 n
[4].i
, n
[5].i
, n
[6].i
,
6322 n
[7].i
, n
[8].data
));
6324 case OPCODE_COMPRESSED_TEX_IMAGE_3D
: /* GL_ARB_texture_compression */
6325 CALL_CompressedTexImage3DARB(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
6326 n
[4].i
, n
[5].i
, n
[6].i
,
6330 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
: /* GL_ARB_texture_compress */
6331 CALL_CompressedTexSubImage1DARB(ctx
->Exec
,
6332 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
6333 n
[5].e
, n
[6].i
, n
[7].data
));
6335 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
: /* GL_ARB_texture_compress */
6336 CALL_CompressedTexSubImage2DARB(ctx
->Exec
,
6337 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
6338 n
[5].i
, n
[6].i
, n
[7].e
, n
[8].i
,
6341 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
: /* GL_ARB_texture_compress */
6342 CALL_CompressedTexSubImage3DARB(ctx
->Exec
,
6343 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
6344 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
6345 n
[9].e
, n
[10].i
, n
[11].data
));
6347 case OPCODE_SAMPLE_COVERAGE
: /* GL_ARB_multisample */
6348 CALL_SampleCoverageARB(ctx
->Exec
, (n
[1].f
, n
[2].b
));
6350 case OPCODE_WINDOW_POS_ARB
: /* GL_ARB_window_pos */
6351 CALL_WindowPos3fMESA(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
6353 #if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
6354 case OPCODE_BIND_PROGRAM_NV
: /* GL_NV_vertex_program */
6355 CALL_BindProgramNV(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
6358 #if FEATURE_NV_vertex_program
6359 case OPCODE_EXECUTE_PROGRAM_NV
:
6366 CALL_ExecuteProgramNV(ctx
->Exec
, (n
[1].e
, n
[2].ui
, v
));
6369 case OPCODE_REQUEST_RESIDENT_PROGRAMS_NV
:
6370 CALL_RequestResidentProgramsNV(ctx
->Exec
, (n
[1].ui
,
6371 (GLuint
*) n
[2].data
));
6373 case OPCODE_LOAD_PROGRAM_NV
:
6374 CALL_LoadProgramNV(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].i
,
6375 (const GLubyte
*) n
[4].data
));
6377 case OPCODE_TRACK_MATRIX_NV
:
6378 CALL_TrackMatrixNV(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].e
, n
[4].e
));
6382 #if FEATURE_NV_fragment_program
6383 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
:
6384 CALL_ProgramLocalParameter4fARB(ctx
->Exec
,
6385 (n
[1].e
, n
[2].ui
, n
[3].f
, n
[4].f
,
6388 case OPCODE_PROGRAM_NAMED_PARAMETER_NV
:
6389 CALL_ProgramNamedParameter4fNV(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
6390 (const GLubyte
*) n
[3].
6391 data
, n
[4].f
, n
[5].f
,
6396 case OPCODE_ACTIVE_STENCIL_FACE_EXT
:
6397 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (n
[1].e
));
6399 case OPCODE_DEPTH_BOUNDS_EXT
:
6400 CALL_DepthBoundsEXT(ctx
->Exec
, (n
[1].f
, n
[2].f
));
6402 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
6403 case OPCODE_PROGRAM_STRING_ARB
:
6404 CALL_ProgramStringARB(ctx
->Exec
,
6405 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].data
));
6408 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program || FEATURE_NV_vertex_program
6409 case OPCODE_PROGRAM_ENV_PARAMETER_ARB
:
6410 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].f
,
6415 #if FEATURE_ARB_occlusion_query
6416 case OPCODE_BEGIN_QUERY_ARB
:
6417 CALL_BeginQueryARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
6419 case OPCODE_END_QUERY_ARB
:
6420 CALL_EndQueryARB(ctx
->Exec
, (n
[1].e
));
6423 case OPCODE_DRAW_BUFFERS_ARB
:
6425 GLenum buffers
[MAX_DRAW_BUFFERS
];
6426 GLint i
, count
= MIN2(n
[1].i
, MAX_DRAW_BUFFERS
);
6427 for (i
= 0; i
< count
; i
++)
6428 buffers
[i
] = n
[2 + i
].e
;
6429 CALL_DrawBuffersARB(ctx
->Exec
, (n
[1].i
, buffers
));
6432 #if FEATURE_EXT_framebuffer_blit
6433 case OPCODE_BLIT_FRAMEBUFFER
:
6434 CALL_BlitFramebufferEXT(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
,
6435 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
6439 #if FEATURE_ATI_fragment_shader
6440 case OPCODE_BIND_FRAGMENT_SHADER_ATI
:
6441 CALL_BindFragmentShaderATI(ctx
->Exec
, (n
[1].i
));
6443 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
:
6446 GLuint i
, dst
= n
[1].ui
;
6448 for (i
= 0; i
< 4; i
++)
6449 values
[i
] = n
[1 + i
].f
;
6450 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, values
));
6454 case OPCODE_ATTR_1F_NV
:
6455 CALL_VertexAttrib1fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
));
6457 case OPCODE_ATTR_2F_NV
:
6458 /* Really shouldn't have to do this - the Node structure
6459 * is convenient, but it would be better to store the data
6460 * packed appropriately so that it can be sent directly
6461 * on. With x86_64 becoming common, this will start to
6464 if (sizeof(Node
) == sizeof(GLfloat
))
6465 CALL_VertexAttrib2fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6467 CALL_VertexAttrib2fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
));
6469 case OPCODE_ATTR_3F_NV
:
6470 if (sizeof(Node
) == sizeof(GLfloat
))
6471 CALL_VertexAttrib3fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6473 CALL_VertexAttrib3fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
6476 case OPCODE_ATTR_4F_NV
:
6477 if (sizeof(Node
) == sizeof(GLfloat
))
6478 CALL_VertexAttrib4fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6480 CALL_VertexAttrib4fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
6483 case OPCODE_ATTR_1F_ARB
:
6484 CALL_VertexAttrib1fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
));
6486 case OPCODE_ATTR_2F_ARB
:
6487 /* Really shouldn't have to do this - the Node structure
6488 * is convenient, but it would be better to store the data
6489 * packed appropriately so that it can be sent directly
6490 * on. With x86_64 becoming common, this will start to
6493 if (sizeof(Node
) == sizeof(GLfloat
))
6494 CALL_VertexAttrib2fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6496 CALL_VertexAttrib2fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
));
6498 case OPCODE_ATTR_3F_ARB
:
6499 if (sizeof(Node
) == sizeof(GLfloat
))
6500 CALL_VertexAttrib3fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6502 CALL_VertexAttrib3fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
6505 case OPCODE_ATTR_4F_ARB
:
6506 if (sizeof(Node
) == sizeof(GLfloat
))
6507 CALL_VertexAttrib4fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6509 CALL_VertexAttrib4fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
6512 case OPCODE_MATERIAL
:
6513 if (sizeof(Node
) == sizeof(GLfloat
))
6514 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, &n
[3].f
));
6521 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, f
));
6525 CALL_Begin(ctx
->Exec
, (n
[1].e
));
6528 CALL_End(ctx
->Exec
, ());
6531 CALL_Rectf(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
6533 case OPCODE_EVAL_C1
:
6534 CALL_EvalCoord1f(ctx
->Exec
, (n
[1].f
));
6536 case OPCODE_EVAL_C2
:
6537 CALL_EvalCoord2f(ctx
->Exec
, (n
[1].f
, n
[2].f
));
6539 case OPCODE_EVAL_P1
:
6540 CALL_EvalPoint1(ctx
->Exec
, (n
[1].i
));
6542 case OPCODE_EVAL_P2
:
6543 CALL_EvalPoint2(ctx
->Exec
, (n
[1].i
, n
[2].i
));
6546 case OPCODE_CONTINUE
:
6547 n
= (Node
*) n
[1].next
;
6549 case OPCODE_END_OF_LIST
:
6555 _mesa_sprintf(msg
, "Error in execute_list: opcode=%d",
6557 _mesa_problem(ctx
, msg
);
6562 /* increment n to point to next compiled command */
6563 if (opcode
!= OPCODE_CONTINUE
) {
6564 n
+= InstSize
[opcode
];
6569 if (ctx
->Driver
.EndCallList
)
6570 ctx
->Driver
.EndCallList(ctx
);
6572 ctx
->ListState
.CallStack
[ctx
->ListState
.CallDepth
--] = NULL
;
6577 /**********************************************************************/
6579 /**********************************************************************/
6582 * Test if a display list number is valid.
6584 GLboolean GLAPIENTRY
6585 _mesa_IsList(GLuint list
)
6587 GET_CURRENT_CONTEXT(ctx
);
6588 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
6589 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
6590 return islist(ctx
, list
);
6595 * Delete a sequence of consecutive display lists.
6598 _mesa_DeleteLists(GLuint list
, GLsizei range
)
6600 GET_CURRENT_CONTEXT(ctx
);
6602 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
6603 ASSERT_OUTSIDE_BEGIN_END(ctx
);
6606 _mesa_error(ctx
, GL_INVALID_VALUE
, "glDeleteLists");
6609 for (i
= list
; i
< list
+ range
; i
++) {
6610 destroy_list(ctx
, i
);
6616 * Return a display list number, n, such that lists n through n+range-1
6620 _mesa_GenLists(GLsizei range
)
6622 GET_CURRENT_CONTEXT(ctx
);
6624 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
6625 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, 0);
6628 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGenLists");
6636 * Make this an atomic operation
6638 _glthread_LOCK_MUTEX(ctx
->Shared
->Mutex
);
6640 base
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
6642 /* reserve the list IDs by with empty/dummy lists */
6644 for (i
= 0; i
< range
; i
++) {
6645 _mesa_HashInsert(ctx
->Shared
->DisplayList
, base
+ i
,
6646 make_list(base
+ i
, 1));
6650 _glthread_UNLOCK_MUTEX(ctx
->Shared
->Mutex
);
6657 * Begin a new display list.
6660 _mesa_NewList(GLuint list
, GLenum mode
)
6662 GET_CURRENT_CONTEXT(ctx
);
6665 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
6666 ASSERT_OUTSIDE_BEGIN_END(ctx
);
6668 if (MESA_VERBOSE
& VERBOSE_API
)
6669 _mesa_debug(ctx
, "glNewList %u %s\n", list
,
6670 _mesa_lookup_enum_by_nr(mode
));
6673 _mesa_error(ctx
, GL_INVALID_VALUE
, "glNewList");
6677 if (mode
!= GL_COMPILE
&& mode
!= GL_COMPILE_AND_EXECUTE
) {
6678 _mesa_error(ctx
, GL_INVALID_ENUM
, "glNewList");
6682 if (ctx
->ListState
.CurrentListPtr
) {
6683 /* already compiling a display list */
6684 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
6688 ctx
->CompileFlag
= GL_TRUE
;
6689 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
6691 /* Allocate new display list */
6692 ctx
->ListState
.CurrentListNum
= list
;
6693 ctx
->ListState
.CurrentList
= make_list(list
, BLOCK_SIZE
);
6694 ctx
->ListState
.CurrentBlock
= ctx
->ListState
.CurrentList
->node
;
6695 ctx
->ListState
.CurrentListPtr
= ctx
->ListState
.CurrentBlock
;
6696 ctx
->ListState
.CurrentPos
= 0;
6698 /* Reset acumulated list state:
6700 for (i
= 0; i
< VERT_ATTRIB_MAX
; i
++)
6701 ctx
->ListState
.ActiveAttribSize
[i
] = 0;
6703 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++)
6704 ctx
->ListState
.ActiveMaterialSize
[i
] = 0;
6706 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
6707 ctx
->Driver
.NewList(ctx
, list
, mode
);
6709 ctx
->CurrentDispatch
= ctx
->Save
;
6710 _glapi_set_dispatch(ctx
->CurrentDispatch
);
6715 * End definition of current display list.
6720 GET_CURRENT_CONTEXT(ctx
);
6721 SAVE_FLUSH_VERTICES(ctx
);
6722 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
6724 if (MESA_VERBOSE
& VERBOSE_API
)
6725 _mesa_debug(ctx
, "glEndList\n");
6727 /* Check that a list is under construction */
6728 if (!ctx
->ListState
.CurrentListPtr
) {
6729 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glEndList");
6733 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_END_OF_LIST
, 0);
6735 /* Destroy old list, if any */
6736 destroy_list(ctx
, ctx
->ListState
.CurrentListNum
);
6737 /* Install the list */
6738 _mesa_HashInsert(ctx
->Shared
->DisplayList
, ctx
->ListState
.CurrentListNum
,
6739 ctx
->ListState
.CurrentList
);
6742 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
6743 mesa_print_display_list(ctx
->ListState
.CurrentListNum
);
6745 ctx
->Driver
.EndList(ctx
);
6747 ctx
->ListState
.CurrentList
= NULL
;
6748 ctx
->ListState
.CurrentListNum
= 0;
6749 ctx
->ListState
.CurrentListPtr
= NULL
;
6750 ctx
->ExecuteFlag
= GL_TRUE
;
6751 ctx
->CompileFlag
= GL_FALSE
;
6753 ctx
->CurrentDispatch
= ctx
->Exec
;
6754 _glapi_set_dispatch(ctx
->CurrentDispatch
);
6759 _mesa_CallList(GLuint list
)
6761 GLboolean save_compile_flag
;
6762 GET_CURRENT_CONTEXT(ctx
);
6763 FLUSH_CURRENT(ctx
, 0);
6764 /* VERY IMPORTANT: Save the CompileFlag status, turn it off, */
6765 /* execute the display list, and restore the CompileFlag. */
6767 if (MESA_VERBOSE
& VERBOSE_API
)
6768 _mesa_debug(ctx
, "glCallList %d\n", list
);
6771 _mesa_error(ctx
, GL_INVALID_VALUE
, "glCallList(list==0)");
6775 /* mesa_print_display_list( list ); */
6777 save_compile_flag
= ctx
->CompileFlag
;
6778 if (save_compile_flag
) {
6779 ctx
->CompileFlag
= GL_FALSE
;
6782 execute_list(ctx
, list
);
6783 ctx
->CompileFlag
= save_compile_flag
;
6785 /* also restore API function pointers to point to "save" versions */
6786 if (save_compile_flag
) {
6787 ctx
->CurrentDispatch
= ctx
->Save
;
6788 _glapi_set_dispatch(ctx
->CurrentDispatch
);
6794 * Execute glCallLists: call multiple display lists.
6797 _mesa_CallLists(GLsizei n
, GLenum type
, const GLvoid
* lists
)
6799 GET_CURRENT_CONTEXT(ctx
);
6802 GLboolean save_compile_flag
;
6804 if (MESA_VERBOSE
& VERBOSE_API
)
6805 _mesa_debug(ctx
, "glCallLists %d\n", n
);
6809 case GL_UNSIGNED_BYTE
:
6811 case GL_UNSIGNED_SHORT
:
6813 case GL_UNSIGNED_INT
:
6821 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
6825 /* Save the CompileFlag status, turn it off, execute display list,
6826 * and restore the CompileFlag.
6828 save_compile_flag
= ctx
->CompileFlag
;
6829 ctx
->CompileFlag
= GL_FALSE
;
6831 for (i
= 0; i
< n
; i
++) {
6832 list
= translate_id(i
, type
, lists
);
6833 execute_list(ctx
, ctx
->List
.ListBase
+ list
);
6836 ctx
->CompileFlag
= save_compile_flag
;
6838 /* also restore API function pointers to point to "save" versions */
6839 if (save_compile_flag
) {
6840 ctx
->CurrentDispatch
= ctx
->Save
;
6841 _glapi_set_dispatch(ctx
->CurrentDispatch
);
6847 * Set the offset added to list numbers in glCallLists.
6850 _mesa_ListBase(GLuint base
)
6852 GET_CURRENT_CONTEXT(ctx
);
6853 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
6854 ASSERT_OUTSIDE_BEGIN_END(ctx
);
6855 ctx
->List
.ListBase
= base
;
6859 /* Can no longer assume ctx->Exec->Func is equal to _mesa_Func.
6861 static void GLAPIENTRY
6864 GET_CURRENT_CONTEXT(ctx
);
6865 FLUSH_VERTICES(ctx
, 0);
6866 CALL_Finish(ctx
->Exec
, ());
6869 static void GLAPIENTRY
6872 GET_CURRENT_CONTEXT(ctx
);
6873 FLUSH_VERTICES(ctx
, 0);
6874 CALL_Flush(ctx
->Exec
, ());
6877 static void GLAPIENTRY
6878 exec_GetBooleanv(GLenum pname
, GLboolean
*params
)
6880 GET_CURRENT_CONTEXT(ctx
);
6881 FLUSH_VERTICES(ctx
, 0);
6882 CALL_GetBooleanv(ctx
->Exec
, (pname
, params
));
6885 static void GLAPIENTRY
6886 exec_GetClipPlane(GLenum plane
, GLdouble
* equation
)
6888 GET_CURRENT_CONTEXT(ctx
);
6889 FLUSH_VERTICES(ctx
, 0);
6890 CALL_GetClipPlane(ctx
->Exec
, (plane
, equation
));
6893 static void GLAPIENTRY
6894 exec_GetDoublev(GLenum pname
, GLdouble
*params
)
6896 GET_CURRENT_CONTEXT(ctx
);
6897 FLUSH_VERTICES(ctx
, 0);
6898 CALL_GetDoublev(ctx
->Exec
, (pname
, params
));
6901 static GLenum GLAPIENTRY
6904 GET_CURRENT_CONTEXT(ctx
);
6905 FLUSH_VERTICES(ctx
, 0);
6906 return CALL_GetError(ctx
->Exec
, ());
6909 static void GLAPIENTRY
6910 exec_GetFloatv(GLenum pname
, GLfloat
*params
)
6912 GET_CURRENT_CONTEXT(ctx
);
6913 FLUSH_VERTICES(ctx
, 0);
6914 CALL_GetFloatv(ctx
->Exec
, (pname
, params
));
6917 static void GLAPIENTRY
6918 exec_GetIntegerv(GLenum pname
, GLint
*params
)
6920 GET_CURRENT_CONTEXT(ctx
);
6921 FLUSH_VERTICES(ctx
, 0);
6922 CALL_GetIntegerv(ctx
->Exec
, (pname
, params
));
6925 static void GLAPIENTRY
6926 exec_GetLightfv(GLenum light
, GLenum pname
, GLfloat
*params
)
6928 GET_CURRENT_CONTEXT(ctx
);
6929 FLUSH_VERTICES(ctx
, 0);
6930 CALL_GetLightfv(ctx
->Exec
, (light
, pname
, params
));
6933 static void GLAPIENTRY
6934 exec_GetLightiv(GLenum light
, GLenum pname
, GLint
*params
)
6936 GET_CURRENT_CONTEXT(ctx
);
6937 FLUSH_VERTICES(ctx
, 0);
6938 CALL_GetLightiv(ctx
->Exec
, (light
, pname
, params
));
6941 static void GLAPIENTRY
6942 exec_GetMapdv(GLenum target
, GLenum query
, GLdouble
* v
)
6944 GET_CURRENT_CONTEXT(ctx
);
6945 FLUSH_VERTICES(ctx
, 0);
6946 CALL_GetMapdv(ctx
->Exec
, (target
, query
, v
));
6949 static void GLAPIENTRY
6950 exec_GetMapfv(GLenum target
, GLenum query
, GLfloat
* v
)
6952 GET_CURRENT_CONTEXT(ctx
);
6953 FLUSH_VERTICES(ctx
, 0);
6954 CALL_GetMapfv(ctx
->Exec
, (target
, query
, v
));
6957 static void GLAPIENTRY
6958 exec_GetMapiv(GLenum target
, GLenum query
, GLint
* v
)
6960 GET_CURRENT_CONTEXT(ctx
);
6961 FLUSH_VERTICES(ctx
, 0);
6962 CALL_GetMapiv(ctx
->Exec
, (target
, query
, v
));
6965 static void GLAPIENTRY
6966 exec_GetMaterialfv(GLenum face
, GLenum pname
, GLfloat
*params
)
6968 GET_CURRENT_CONTEXT(ctx
);
6969 FLUSH_VERTICES(ctx
, 0);
6970 CALL_GetMaterialfv(ctx
->Exec
, (face
, pname
, params
));
6973 static void GLAPIENTRY
6974 exec_GetMaterialiv(GLenum face
, GLenum pname
, GLint
*params
)
6976 GET_CURRENT_CONTEXT(ctx
);
6977 FLUSH_VERTICES(ctx
, 0);
6978 CALL_GetMaterialiv(ctx
->Exec
, (face
, pname
, params
));
6981 static void GLAPIENTRY
6982 exec_GetPixelMapfv(GLenum map
, GLfloat
*values
)
6984 GET_CURRENT_CONTEXT(ctx
);
6985 FLUSH_VERTICES(ctx
, 0);
6986 CALL_GetPixelMapfv(ctx
->Exec
, (map
, values
));
6989 static void GLAPIENTRY
6990 exec_GetPixelMapuiv(GLenum map
, GLuint
*values
)
6992 GET_CURRENT_CONTEXT(ctx
);
6993 FLUSH_VERTICES(ctx
, 0);
6994 CALL_GetPixelMapuiv(ctx
->Exec
, (map
, values
));
6997 static void GLAPIENTRY
6998 exec_GetPixelMapusv(GLenum map
, GLushort
*values
)
7000 GET_CURRENT_CONTEXT(ctx
);
7001 FLUSH_VERTICES(ctx
, 0);
7002 CALL_GetPixelMapusv(ctx
->Exec
, (map
, values
));
7005 static void GLAPIENTRY
7006 exec_GetPolygonStipple(GLubyte
* dest
)
7008 GET_CURRENT_CONTEXT(ctx
);
7009 FLUSH_VERTICES(ctx
, 0);
7010 CALL_GetPolygonStipple(ctx
->Exec
, (dest
));
7013 static const GLubyte
*GLAPIENTRY
7014 exec_GetString(GLenum name
)
7016 GET_CURRENT_CONTEXT(ctx
);
7017 FLUSH_VERTICES(ctx
, 0);
7018 return CALL_GetString(ctx
->Exec
, (name
));
7021 static void GLAPIENTRY
7022 exec_GetTexEnvfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7024 GET_CURRENT_CONTEXT(ctx
);
7025 FLUSH_VERTICES(ctx
, 0);
7026 CALL_GetTexEnvfv(ctx
->Exec
, (target
, pname
, params
));
7029 static void GLAPIENTRY
7030 exec_GetTexEnviv(GLenum target
, GLenum pname
, GLint
*params
)
7032 GET_CURRENT_CONTEXT(ctx
);
7033 FLUSH_VERTICES(ctx
, 0);
7034 CALL_GetTexEnviv(ctx
->Exec
, (target
, pname
, params
));
7037 static void GLAPIENTRY
7038 exec_GetTexGendv(GLenum coord
, GLenum pname
, GLdouble
*params
)
7040 GET_CURRENT_CONTEXT(ctx
);
7041 FLUSH_VERTICES(ctx
, 0);
7042 CALL_GetTexGendv(ctx
->Exec
, (coord
, pname
, params
));
7045 static void GLAPIENTRY
7046 exec_GetTexGenfv(GLenum coord
, GLenum pname
, GLfloat
*params
)
7048 GET_CURRENT_CONTEXT(ctx
);
7049 FLUSH_VERTICES(ctx
, 0);
7050 CALL_GetTexGenfv(ctx
->Exec
, (coord
, pname
, params
));
7053 static void GLAPIENTRY
7054 exec_GetTexGeniv(GLenum coord
, GLenum pname
, GLint
*params
)
7056 GET_CURRENT_CONTEXT(ctx
);
7057 FLUSH_VERTICES(ctx
, 0);
7058 CALL_GetTexGeniv(ctx
->Exec
, (coord
, pname
, params
));
7061 static void GLAPIENTRY
7062 exec_GetTexImage(GLenum target
, GLint level
, GLenum format
,
7063 GLenum type
, GLvoid
* pixels
)
7065 GET_CURRENT_CONTEXT(ctx
);
7066 FLUSH_VERTICES(ctx
, 0);
7067 CALL_GetTexImage(ctx
->Exec
, (target
, level
, format
, type
, pixels
));
7070 static void GLAPIENTRY
7071 exec_GetTexLevelParameterfv(GLenum target
, GLint level
,
7072 GLenum pname
, GLfloat
*params
)
7074 GET_CURRENT_CONTEXT(ctx
);
7075 FLUSH_VERTICES(ctx
, 0);
7076 CALL_GetTexLevelParameterfv(ctx
->Exec
, (target
, level
, pname
, params
));
7079 static void GLAPIENTRY
7080 exec_GetTexLevelParameteriv(GLenum target
, GLint level
,
7081 GLenum pname
, GLint
*params
)
7083 GET_CURRENT_CONTEXT(ctx
);
7084 FLUSH_VERTICES(ctx
, 0);
7085 CALL_GetTexLevelParameteriv(ctx
->Exec
, (target
, level
, pname
, params
));
7088 static void GLAPIENTRY
7089 exec_GetTexParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7091 GET_CURRENT_CONTEXT(ctx
);
7092 FLUSH_VERTICES(ctx
, 0);
7093 CALL_GetTexParameterfv(ctx
->Exec
, (target
, pname
, params
));
7096 static void GLAPIENTRY
7097 exec_GetTexParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7099 GET_CURRENT_CONTEXT(ctx
);
7100 FLUSH_VERTICES(ctx
, 0);
7101 CALL_GetTexParameteriv(ctx
->Exec
, (target
, pname
, params
));
7104 static GLboolean GLAPIENTRY
7105 exec_IsEnabled(GLenum cap
)
7107 GET_CURRENT_CONTEXT(ctx
);
7108 FLUSH_VERTICES(ctx
, 0);
7109 return CALL_IsEnabled(ctx
->Exec
, (cap
));
7112 static void GLAPIENTRY
7113 exec_PixelStoref(GLenum pname
, GLfloat param
)
7115 GET_CURRENT_CONTEXT(ctx
);
7116 FLUSH_VERTICES(ctx
, 0);
7117 CALL_PixelStoref(ctx
->Exec
, (pname
, param
));
7120 static void GLAPIENTRY
7121 exec_PixelStorei(GLenum pname
, GLint param
)
7123 GET_CURRENT_CONTEXT(ctx
);
7124 FLUSH_VERTICES(ctx
, 0);
7125 CALL_PixelStorei(ctx
->Exec
, (pname
, param
));
7128 static void GLAPIENTRY
7129 exec_ReadPixels(GLint x
, GLint y
, GLsizei width
, GLsizei height
,
7130 GLenum format
, GLenum type
, GLvoid
* pixels
)
7132 GET_CURRENT_CONTEXT(ctx
);
7133 FLUSH_VERTICES(ctx
, 0);
7134 CALL_ReadPixels(ctx
->Exec
, (x
, y
, width
, height
, format
, type
, pixels
));
7137 static GLint GLAPIENTRY
7138 exec_RenderMode(GLenum mode
)
7140 GET_CURRENT_CONTEXT(ctx
);
7141 FLUSH_VERTICES(ctx
, 0);
7142 return CALL_RenderMode(ctx
->Exec
, (mode
));
7145 static void GLAPIENTRY
7146 exec_FeedbackBuffer(GLsizei size
, GLenum type
, GLfloat
* buffer
)
7148 GET_CURRENT_CONTEXT(ctx
);
7149 FLUSH_VERTICES(ctx
, 0);
7150 CALL_FeedbackBuffer(ctx
->Exec
, (size
, type
, buffer
));
7153 static void GLAPIENTRY
7154 exec_SelectBuffer(GLsizei size
, GLuint
* buffer
)
7156 GET_CURRENT_CONTEXT(ctx
);
7157 FLUSH_VERTICES(ctx
, 0);
7158 CALL_SelectBuffer(ctx
->Exec
, (size
, buffer
));
7161 static GLboolean GLAPIENTRY
7162 exec_AreTexturesResident(GLsizei n
, const GLuint
* texName
,
7163 GLboolean
* residences
)
7165 GET_CURRENT_CONTEXT(ctx
);
7166 FLUSH_VERTICES(ctx
, 0);
7167 return CALL_AreTexturesResident(ctx
->Exec
, (n
, texName
, residences
));
7170 static void GLAPIENTRY
7171 exec_ColorPointer(GLint size
, GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
7173 GET_CURRENT_CONTEXT(ctx
);
7174 FLUSH_VERTICES(ctx
, 0);
7175 CALL_ColorPointer(ctx
->Exec
, (size
, type
, stride
, ptr
));
7178 static void GLAPIENTRY
7179 exec_DeleteTextures(GLsizei n
, const GLuint
* texName
)
7181 GET_CURRENT_CONTEXT(ctx
);
7182 FLUSH_VERTICES(ctx
, 0);
7183 CALL_DeleteTextures(ctx
->Exec
, (n
, texName
));
7186 static void GLAPIENTRY
7187 exec_DisableClientState(GLenum cap
)
7189 GET_CURRENT_CONTEXT(ctx
);
7190 FLUSH_VERTICES(ctx
, 0);
7191 CALL_DisableClientState(ctx
->Exec
, (cap
));
7194 static void GLAPIENTRY
7195 exec_EdgeFlagPointer(GLsizei stride
, const GLvoid
* vptr
)
7197 GET_CURRENT_CONTEXT(ctx
);
7198 FLUSH_VERTICES(ctx
, 0);
7199 CALL_EdgeFlagPointer(ctx
->Exec
, (stride
, vptr
));
7202 static void GLAPIENTRY
7203 exec_EnableClientState(GLenum cap
)
7205 GET_CURRENT_CONTEXT(ctx
);
7206 FLUSH_VERTICES(ctx
, 0);
7207 CALL_EnableClientState(ctx
->Exec
, (cap
));
7210 static void GLAPIENTRY
7211 exec_GenTextures(GLsizei n
, GLuint
* texName
)
7213 GET_CURRENT_CONTEXT(ctx
);
7214 FLUSH_VERTICES(ctx
, 0);
7215 CALL_GenTextures(ctx
->Exec
, (n
, texName
));
7218 static void GLAPIENTRY
7219 exec_GetPointerv(GLenum pname
, GLvoid
**params
)
7221 GET_CURRENT_CONTEXT(ctx
);
7222 FLUSH_VERTICES(ctx
, 0);
7223 CALL_GetPointerv(ctx
->Exec
, (pname
, params
));
7226 static void GLAPIENTRY
7227 exec_IndexPointer(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
7229 GET_CURRENT_CONTEXT(ctx
);
7230 FLUSH_VERTICES(ctx
, 0);
7231 CALL_IndexPointer(ctx
->Exec
, (type
, stride
, ptr
));
7234 static void GLAPIENTRY
7235 exec_InterleavedArrays(GLenum format
, GLsizei stride
, const GLvoid
* pointer
)
7237 GET_CURRENT_CONTEXT(ctx
);
7238 FLUSH_VERTICES(ctx
, 0);
7239 CALL_InterleavedArrays(ctx
->Exec
, (format
, stride
, pointer
));
7242 static GLboolean GLAPIENTRY
7243 exec_IsTexture(GLuint texture
)
7245 GET_CURRENT_CONTEXT(ctx
);
7246 FLUSH_VERTICES(ctx
, 0);
7247 return CALL_IsTexture(ctx
->Exec
, (texture
));
7250 static void GLAPIENTRY
7251 exec_NormalPointer(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
7253 GET_CURRENT_CONTEXT(ctx
);
7254 FLUSH_VERTICES(ctx
, 0);
7255 CALL_NormalPointer(ctx
->Exec
, (type
, stride
, ptr
));
7258 static void GLAPIENTRY
7259 exec_PopClientAttrib(void)
7261 GET_CURRENT_CONTEXT(ctx
);
7262 FLUSH_VERTICES(ctx
, 0);
7263 CALL_PopClientAttrib(ctx
->Exec
, ());
7266 static void GLAPIENTRY
7267 exec_PushClientAttrib(GLbitfield mask
)
7269 GET_CURRENT_CONTEXT(ctx
);
7270 FLUSH_VERTICES(ctx
, 0);
7271 CALL_PushClientAttrib(ctx
->Exec
, (mask
));
7274 static void GLAPIENTRY
7275 exec_TexCoordPointer(GLint size
, GLenum type
, GLsizei stride
,
7278 GET_CURRENT_CONTEXT(ctx
);
7279 FLUSH_VERTICES(ctx
, 0);
7280 CALL_TexCoordPointer(ctx
->Exec
, (size
, type
, stride
, ptr
));
7283 static void GLAPIENTRY
7284 exec_GetCompressedTexImageARB(GLenum target
, GLint level
, GLvoid
* img
)
7286 GET_CURRENT_CONTEXT(ctx
);
7287 FLUSH_VERTICES(ctx
, 0);
7288 CALL_GetCompressedTexImageARB(ctx
->Exec
, (target
, level
, img
));
7291 static void GLAPIENTRY
7292 exec_VertexPointer(GLint size
, GLenum type
, GLsizei stride
,
7295 GET_CURRENT_CONTEXT(ctx
);
7296 FLUSH_VERTICES(ctx
, 0);
7297 CALL_VertexPointer(ctx
->Exec
, (size
, type
, stride
, ptr
));
7300 static void GLAPIENTRY
7301 exec_CopyConvolutionFilter1D(GLenum target
, GLenum internalFormat
,
7302 GLint x
, GLint y
, GLsizei width
)
7304 GET_CURRENT_CONTEXT(ctx
);
7305 FLUSH_VERTICES(ctx
, 0);
7306 CALL_CopyConvolutionFilter1D(ctx
->Exec
,
7307 (target
, internalFormat
, x
, y
, width
));
7310 static void GLAPIENTRY
7311 exec_CopyConvolutionFilter2D(GLenum target
, GLenum internalFormat
,
7312 GLint x
, GLint y
, GLsizei width
, GLsizei height
)
7314 GET_CURRENT_CONTEXT(ctx
);
7315 FLUSH_VERTICES(ctx
, 0);
7316 CALL_CopyConvolutionFilter2D(ctx
->Exec
,
7317 (target
, internalFormat
, x
, y
, width
,
7321 static void GLAPIENTRY
7322 exec_GetColorTable(GLenum target
, GLenum format
, GLenum type
, GLvoid
* data
)
7324 GET_CURRENT_CONTEXT(ctx
);
7325 FLUSH_VERTICES(ctx
, 0);
7326 CALL_GetColorTable(ctx
->Exec
, (target
, format
, type
, data
));
7329 static void GLAPIENTRY
7330 exec_GetColorTableParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7332 GET_CURRENT_CONTEXT(ctx
);
7333 FLUSH_VERTICES(ctx
, 0);
7334 CALL_GetColorTableParameterfv(ctx
->Exec
, (target
, pname
, params
));
7337 static void GLAPIENTRY
7338 exec_GetColorTableParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7340 GET_CURRENT_CONTEXT(ctx
);
7341 FLUSH_VERTICES(ctx
, 0);
7342 CALL_GetColorTableParameteriv(ctx
->Exec
, (target
, pname
, params
));
7345 static void GLAPIENTRY
7346 exec_GetConvolutionFilter(GLenum target
, GLenum format
, GLenum type
,
7349 GET_CURRENT_CONTEXT(ctx
);
7350 FLUSH_VERTICES(ctx
, 0);
7351 CALL_GetConvolutionFilter(ctx
->Exec
, (target
, format
, type
, image
));
7354 static void GLAPIENTRY
7355 exec_GetConvolutionParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7357 GET_CURRENT_CONTEXT(ctx
);
7358 FLUSH_VERTICES(ctx
, 0);
7359 CALL_GetConvolutionParameterfv(ctx
->Exec
, (target
, pname
, params
));
7362 static void GLAPIENTRY
7363 exec_GetConvolutionParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7365 GET_CURRENT_CONTEXT(ctx
);
7366 FLUSH_VERTICES(ctx
, 0);
7367 CALL_GetConvolutionParameteriv(ctx
->Exec
, (target
, pname
, params
));
7370 static void GLAPIENTRY
7371 exec_GetHistogram(GLenum target
, GLboolean reset
, GLenum format
,
7372 GLenum type
, GLvoid
*values
)
7374 GET_CURRENT_CONTEXT(ctx
);
7375 FLUSH_VERTICES(ctx
, 0);
7376 CALL_GetHistogram(ctx
->Exec
, (target
, reset
, format
, type
, values
));
7379 static void GLAPIENTRY
7380 exec_GetHistogramParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7382 GET_CURRENT_CONTEXT(ctx
);
7383 FLUSH_VERTICES(ctx
, 0);
7384 CALL_GetHistogramParameterfv(ctx
->Exec
, (target
, pname
, params
));
7387 static void GLAPIENTRY
7388 exec_GetHistogramParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7390 GET_CURRENT_CONTEXT(ctx
);
7391 FLUSH_VERTICES(ctx
, 0);
7392 CALL_GetHistogramParameteriv(ctx
->Exec
, (target
, pname
, params
));
7395 static void GLAPIENTRY
7396 exec_GetMinmax(GLenum target
, GLboolean reset
, GLenum format
,
7397 GLenum type
, GLvoid
*values
)
7399 GET_CURRENT_CONTEXT(ctx
);
7400 FLUSH_VERTICES(ctx
, 0);
7401 CALL_GetMinmax(ctx
->Exec
, (target
, reset
, format
, type
, values
));
7404 static void GLAPIENTRY
7405 exec_GetMinmaxParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7407 GET_CURRENT_CONTEXT(ctx
);
7408 FLUSH_VERTICES(ctx
, 0);
7409 CALL_GetMinmaxParameterfv(ctx
->Exec
, (target
, pname
, params
));
7412 static void GLAPIENTRY
7413 exec_GetMinmaxParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7415 GET_CURRENT_CONTEXT(ctx
);
7416 FLUSH_VERTICES(ctx
, 0);
7417 CALL_GetMinmaxParameteriv(ctx
->Exec
, (target
, pname
, params
));
7420 static void GLAPIENTRY
7421 exec_GetSeparableFilter(GLenum target
, GLenum format
, GLenum type
,
7422 GLvoid
*row
, GLvoid
*column
, GLvoid
*span
)
7424 GET_CURRENT_CONTEXT(ctx
);
7425 FLUSH_VERTICES(ctx
, 0);
7426 CALL_GetSeparableFilter(ctx
->Exec
,
7427 (target
, format
, type
, row
, column
, span
));
7430 static void GLAPIENTRY
7431 exec_SeparableFilter2D(GLenum target
, GLenum internalFormat
,
7432 GLsizei width
, GLsizei height
, GLenum format
,
7433 GLenum type
, const GLvoid
*row
, const GLvoid
*column
)
7435 GET_CURRENT_CONTEXT(ctx
);
7436 FLUSH_VERTICES(ctx
, 0);
7437 CALL_SeparableFilter2D(ctx
->Exec
,
7438 (target
, internalFormat
, width
, height
, format
,
7439 type
, row
, column
));
7442 static void GLAPIENTRY
7443 exec_ColorPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
7444 GLsizei count
, const GLvoid
*ptr
)
7446 GET_CURRENT_CONTEXT(ctx
);
7447 FLUSH_VERTICES(ctx
, 0);
7448 CALL_ColorPointerEXT(ctx
->Exec
, (size
, type
, stride
, count
, ptr
));
7451 static void GLAPIENTRY
7452 exec_EdgeFlagPointerEXT(GLsizei stride
, GLsizei count
, const GLboolean
*ptr
)
7454 GET_CURRENT_CONTEXT(ctx
);
7455 FLUSH_VERTICES(ctx
, 0);
7456 CALL_EdgeFlagPointerEXT(ctx
->Exec
, (stride
, count
, ptr
));
7459 static void GLAPIENTRY
7460 exec_IndexPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
,
7463 GET_CURRENT_CONTEXT(ctx
);
7464 FLUSH_VERTICES(ctx
, 0);
7465 CALL_IndexPointerEXT(ctx
->Exec
, (type
, stride
, count
, ptr
));
7468 static void GLAPIENTRY
7469 exec_NormalPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
,
7472 GET_CURRENT_CONTEXT(ctx
);
7473 FLUSH_VERTICES(ctx
, 0);
7474 CALL_NormalPointerEXT(ctx
->Exec
, (type
, stride
, count
, ptr
));
7477 static void GLAPIENTRY
7478 exec_TexCoordPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
7479 GLsizei count
, const GLvoid
*ptr
)
7481 GET_CURRENT_CONTEXT(ctx
);
7482 FLUSH_VERTICES(ctx
, 0);
7483 CALL_TexCoordPointerEXT(ctx
->Exec
, (size
, type
, stride
, count
, ptr
));
7486 static void GLAPIENTRY
7487 exec_VertexPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
7488 GLsizei count
, const GLvoid
*ptr
)
7490 GET_CURRENT_CONTEXT(ctx
);
7491 FLUSH_VERTICES(ctx
, 0);
7492 CALL_VertexPointerEXT(ctx
->Exec
, (size
, type
, stride
, count
, ptr
));
7495 static void GLAPIENTRY
7496 exec_LockArraysEXT(GLint first
, GLsizei count
)
7498 GET_CURRENT_CONTEXT(ctx
);
7499 FLUSH_VERTICES(ctx
, 0);
7500 CALL_LockArraysEXT(ctx
->Exec
, (first
, count
));
7503 static void GLAPIENTRY
7504 exec_UnlockArraysEXT(void)
7506 GET_CURRENT_CONTEXT(ctx
);
7507 FLUSH_VERTICES(ctx
, 0);
7508 CALL_UnlockArraysEXT(ctx
->Exec
, ());
7511 static void GLAPIENTRY
7512 exec_ClientActiveTextureARB(GLenum target
)
7514 GET_CURRENT_CONTEXT(ctx
);
7515 FLUSH_VERTICES(ctx
, 0);
7516 CALL_ClientActiveTextureARB(ctx
->Exec
, (target
));
7519 static void GLAPIENTRY
7520 exec_SecondaryColorPointerEXT(GLint size
, GLenum type
,
7521 GLsizei stride
, const GLvoid
*ptr
)
7523 GET_CURRENT_CONTEXT(ctx
);
7524 FLUSH_VERTICES(ctx
, 0);
7525 CALL_SecondaryColorPointerEXT(ctx
->Exec
, (size
, type
, stride
, ptr
));
7528 static void GLAPIENTRY
7529 exec_FogCoordPointerEXT(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
7531 GET_CURRENT_CONTEXT(ctx
);
7532 FLUSH_VERTICES(ctx
, 0);
7533 CALL_FogCoordPointerEXT(ctx
->Exec
, (type
, stride
, ptr
));
7536 /* GL_EXT_multi_draw_arrays */
7537 static void GLAPIENTRY
7538 exec_MultiDrawArraysEXT(GLenum mode
, GLint
* first
,
7539 GLsizei
* count
, GLsizei primcount
)
7541 GET_CURRENT_CONTEXT(ctx
);
7542 FLUSH_VERTICES(ctx
, 0);
7543 CALL_MultiDrawArraysEXT(ctx
->Exec
, (mode
, first
, count
, primcount
));
7546 /* GL_EXT_multi_draw_arrays */
7547 static void GLAPIENTRY
7548 exec_MultiDrawElementsEXT(GLenum mode
, const GLsizei
* count
,
7549 GLenum type
, const GLvoid
** indices
,
7552 GET_CURRENT_CONTEXT(ctx
);
7553 FLUSH_VERTICES(ctx
, 0);
7554 CALL_MultiDrawElementsEXT(ctx
->Exec
,
7555 (mode
, count
, type
, indices
, primcount
));
7558 /* GL_IBM_multimode_draw_arrays */
7559 static void GLAPIENTRY
7560 exec_MultiModeDrawArraysIBM(const GLenum
* mode
, const GLint
* first
,
7561 const GLsizei
* count
, GLsizei primcount
,
7564 GET_CURRENT_CONTEXT(ctx
);
7565 FLUSH_VERTICES(ctx
, 0);
7566 CALL_MultiModeDrawArraysIBM(ctx
->Exec
,
7567 (mode
, first
, count
, primcount
, modestride
));
7570 /* GL_IBM_multimode_draw_arrays */
7571 static void GLAPIENTRY
7572 exec_MultiModeDrawElementsIBM(const GLenum
* mode
,
7573 const GLsizei
* count
,
7575 const GLvoid
* const *indices
,
7576 GLsizei primcount
, GLint modestride
)
7578 GET_CURRENT_CONTEXT(ctx
);
7579 FLUSH_VERTICES(ctx
, 0);
7580 CALL_MultiModeDrawElementsIBM(ctx
->Exec
,
7581 (mode
, count
, type
, indices
, primcount
,
7588 * Setup the given dispatch table to point to Mesa's display list
7589 * building functions.
7591 * This does not include any of the tnl functions - they are
7592 * initialized from _mesa_init_api_defaults and from the active vtxfmt
7596 _mesa_init_dlist_table(struct _glapi_table
*table
)
7598 _mesa_loopback_init_api_table(table
);
7601 SET_Accum(table
, save_Accum
);
7602 SET_AlphaFunc(table
, save_AlphaFunc
);
7603 SET_Bitmap(table
, save_Bitmap
);
7604 SET_BlendFunc(table
, _mesa_BlendFunc
); /* loops-back to BlendFuncSeparate */
7605 SET_CallList(table
, _mesa_save_CallList
);
7606 SET_CallLists(table
, _mesa_save_CallLists
);
7607 SET_Clear(table
, save_Clear
);
7608 SET_ClearAccum(table
, save_ClearAccum
);
7609 SET_ClearColor(table
, save_ClearColor
);
7610 SET_ClearDepth(table
, save_ClearDepth
);
7611 SET_ClearIndex(table
, save_ClearIndex
);
7612 SET_ClearStencil(table
, save_ClearStencil
);
7613 SET_ClipPlane(table
, save_ClipPlane
);
7614 SET_ColorMask(table
, save_ColorMask
);
7615 SET_ColorMaterial(table
, save_ColorMaterial
);
7616 SET_CopyPixels(table
, save_CopyPixels
);
7617 SET_CullFace(table
, save_CullFace
);
7618 SET_DeleteLists(table
, _mesa_DeleteLists
);
7619 SET_DepthFunc(table
, save_DepthFunc
);
7620 SET_DepthMask(table
, save_DepthMask
);
7621 SET_DepthRange(table
, save_DepthRange
);
7622 SET_Disable(table
, save_Disable
);
7623 SET_DrawBuffer(table
, save_DrawBuffer
);
7624 SET_DrawPixels(table
, save_DrawPixels
);
7625 SET_Enable(table
, save_Enable
);
7626 SET_EndList(table
, _mesa_EndList
);
7627 SET_EvalMesh1(table
, _mesa_save_EvalMesh1
);
7628 SET_EvalMesh2(table
, _mesa_save_EvalMesh2
);
7629 SET_Finish(table
, exec_Finish
);
7630 SET_Flush(table
, exec_Flush
);
7631 SET_Fogf(table
, save_Fogf
);
7632 SET_Fogfv(table
, save_Fogfv
);
7633 SET_Fogi(table
, save_Fogi
);
7634 SET_Fogiv(table
, save_Fogiv
);
7635 SET_FrontFace(table
, save_FrontFace
);
7636 SET_Frustum(table
, save_Frustum
);
7637 SET_GenLists(table
, _mesa_GenLists
);
7638 SET_GetBooleanv(table
, exec_GetBooleanv
);
7639 SET_GetClipPlane(table
, exec_GetClipPlane
);
7640 SET_GetDoublev(table
, exec_GetDoublev
);
7641 SET_GetError(table
, exec_GetError
);
7642 SET_GetFloatv(table
, exec_GetFloatv
);
7643 SET_GetIntegerv(table
, exec_GetIntegerv
);
7644 SET_GetLightfv(table
, exec_GetLightfv
);
7645 SET_GetLightiv(table
, exec_GetLightiv
);
7646 SET_GetMapdv(table
, exec_GetMapdv
);
7647 SET_GetMapfv(table
, exec_GetMapfv
);
7648 SET_GetMapiv(table
, exec_GetMapiv
);
7649 SET_GetMaterialfv(table
, exec_GetMaterialfv
);
7650 SET_GetMaterialiv(table
, exec_GetMaterialiv
);
7651 SET_GetPixelMapfv(table
, exec_GetPixelMapfv
);
7652 SET_GetPixelMapuiv(table
, exec_GetPixelMapuiv
);
7653 SET_GetPixelMapusv(table
, exec_GetPixelMapusv
);
7654 SET_GetPolygonStipple(table
, exec_GetPolygonStipple
);
7655 SET_GetString(table
, exec_GetString
);
7656 SET_GetTexEnvfv(table
, exec_GetTexEnvfv
);
7657 SET_GetTexEnviv(table
, exec_GetTexEnviv
);
7658 SET_GetTexGendv(table
, exec_GetTexGendv
);
7659 SET_GetTexGenfv(table
, exec_GetTexGenfv
);
7660 SET_GetTexGeniv(table
, exec_GetTexGeniv
);
7661 SET_GetTexImage(table
, exec_GetTexImage
);
7662 SET_GetTexLevelParameterfv(table
, exec_GetTexLevelParameterfv
);
7663 SET_GetTexLevelParameteriv(table
, exec_GetTexLevelParameteriv
);
7664 SET_GetTexParameterfv(table
, exec_GetTexParameterfv
);
7665 SET_GetTexParameteriv(table
, exec_GetTexParameteriv
);
7666 SET_Hint(table
, save_Hint
);
7667 SET_IndexMask(table
, save_IndexMask
);
7668 SET_InitNames(table
, save_InitNames
);
7669 SET_IsEnabled(table
, exec_IsEnabled
);
7670 SET_IsList(table
, _mesa_IsList
);
7671 SET_LightModelf(table
, save_LightModelf
);
7672 SET_LightModelfv(table
, save_LightModelfv
);
7673 SET_LightModeli(table
, save_LightModeli
);
7674 SET_LightModeliv(table
, save_LightModeliv
);
7675 SET_Lightf(table
, save_Lightf
);
7676 SET_Lightfv(table
, save_Lightfv
);
7677 SET_Lighti(table
, save_Lighti
);
7678 SET_Lightiv(table
, save_Lightiv
);
7679 SET_LineStipple(table
, save_LineStipple
);
7680 SET_LineWidth(table
, save_LineWidth
);
7681 SET_ListBase(table
, save_ListBase
);
7682 SET_LoadIdentity(table
, save_LoadIdentity
);
7683 SET_LoadMatrixd(table
, save_LoadMatrixd
);
7684 SET_LoadMatrixf(table
, save_LoadMatrixf
);
7685 SET_LoadName(table
, save_LoadName
);
7686 SET_LogicOp(table
, save_LogicOp
);
7687 SET_Map1d(table
, save_Map1d
);
7688 SET_Map1f(table
, save_Map1f
);
7689 SET_Map2d(table
, save_Map2d
);
7690 SET_Map2f(table
, save_Map2f
);
7691 SET_MapGrid1d(table
, save_MapGrid1d
);
7692 SET_MapGrid1f(table
, save_MapGrid1f
);
7693 SET_MapGrid2d(table
, save_MapGrid2d
);
7694 SET_MapGrid2f(table
, save_MapGrid2f
);
7695 SET_MatrixMode(table
, save_MatrixMode
);
7696 SET_MultMatrixd(table
, save_MultMatrixd
);
7697 SET_MultMatrixf(table
, save_MultMatrixf
);
7698 SET_NewList(table
, save_NewList
);
7699 SET_Ortho(table
, save_Ortho
);
7700 SET_PassThrough(table
, save_PassThrough
);
7701 SET_PixelMapfv(table
, save_PixelMapfv
);
7702 SET_PixelMapuiv(table
, save_PixelMapuiv
);
7703 SET_PixelMapusv(table
, save_PixelMapusv
);
7704 SET_PixelStoref(table
, exec_PixelStoref
);
7705 SET_PixelStorei(table
, exec_PixelStorei
);
7706 SET_PixelTransferf(table
, save_PixelTransferf
);
7707 SET_PixelTransferi(table
, save_PixelTransferi
);
7708 SET_PixelZoom(table
, save_PixelZoom
);
7709 SET_PointSize(table
, save_PointSize
);
7710 SET_PolygonMode(table
, save_PolygonMode
);
7711 SET_PolygonOffset(table
, save_PolygonOffset
);
7712 SET_PolygonStipple(table
, save_PolygonStipple
);
7713 SET_PopAttrib(table
, save_PopAttrib
);
7714 SET_PopMatrix(table
, save_PopMatrix
);
7715 SET_PopName(table
, save_PopName
);
7716 SET_PushAttrib(table
, save_PushAttrib
);
7717 SET_PushMatrix(table
, save_PushMatrix
);
7718 SET_PushName(table
, save_PushName
);
7719 SET_RasterPos2d(table
, save_RasterPos2d
);
7720 SET_RasterPos2dv(table
, save_RasterPos2dv
);
7721 SET_RasterPos2f(table
, save_RasterPos2f
);
7722 SET_RasterPos2fv(table
, save_RasterPos2fv
);
7723 SET_RasterPos2i(table
, save_RasterPos2i
);
7724 SET_RasterPos2iv(table
, save_RasterPos2iv
);
7725 SET_RasterPos2s(table
, save_RasterPos2s
);
7726 SET_RasterPos2sv(table
, save_RasterPos2sv
);
7727 SET_RasterPos3d(table
, save_RasterPos3d
);
7728 SET_RasterPos3dv(table
, save_RasterPos3dv
);
7729 SET_RasterPos3f(table
, save_RasterPos3f
);
7730 SET_RasterPos3fv(table
, save_RasterPos3fv
);
7731 SET_RasterPos3i(table
, save_RasterPos3i
);
7732 SET_RasterPos3iv(table
, save_RasterPos3iv
);
7733 SET_RasterPos3s(table
, save_RasterPos3s
);
7734 SET_RasterPos3sv(table
, save_RasterPos3sv
);
7735 SET_RasterPos4d(table
, save_RasterPos4d
);
7736 SET_RasterPos4dv(table
, save_RasterPos4dv
);
7737 SET_RasterPos4f(table
, save_RasterPos4f
);
7738 SET_RasterPos4fv(table
, save_RasterPos4fv
);
7739 SET_RasterPos4i(table
, save_RasterPos4i
);
7740 SET_RasterPos4iv(table
, save_RasterPos4iv
);
7741 SET_RasterPos4s(table
, save_RasterPos4s
);
7742 SET_RasterPos4sv(table
, save_RasterPos4sv
);
7743 SET_ReadBuffer(table
, save_ReadBuffer
);
7744 SET_ReadPixels(table
, exec_ReadPixels
);
7745 SET_RenderMode(table
, exec_RenderMode
);
7746 SET_Rotated(table
, save_Rotated
);
7747 SET_Rotatef(table
, save_Rotatef
);
7748 SET_Scaled(table
, save_Scaled
);
7749 SET_Scalef(table
, save_Scalef
);
7750 SET_Scissor(table
, save_Scissor
);
7751 SET_FeedbackBuffer(table
, exec_FeedbackBuffer
);
7752 SET_SelectBuffer(table
, exec_SelectBuffer
);
7753 SET_ShadeModel(table
, save_ShadeModel
);
7754 SET_StencilFunc(table
, save_StencilFunc
);
7755 SET_StencilMask(table
, save_StencilMask
);
7756 SET_StencilOp(table
, save_StencilOp
);
7757 SET_TexEnvf(table
, save_TexEnvf
);
7758 SET_TexEnvfv(table
, save_TexEnvfv
);
7759 SET_TexEnvi(table
, save_TexEnvi
);
7760 SET_TexEnviv(table
, save_TexEnviv
);
7761 SET_TexGend(table
, save_TexGend
);
7762 SET_TexGendv(table
, save_TexGendv
);
7763 SET_TexGenf(table
, save_TexGenf
);
7764 SET_TexGenfv(table
, save_TexGenfv
);
7765 SET_TexGeni(table
, save_TexGeni
);
7766 SET_TexGeniv(table
, save_TexGeniv
);
7767 SET_TexImage1D(table
, save_TexImage1D
);
7768 SET_TexImage2D(table
, save_TexImage2D
);
7769 SET_TexParameterf(table
, save_TexParameterf
);
7770 SET_TexParameterfv(table
, save_TexParameterfv
);
7771 SET_TexParameteri(table
, save_TexParameteri
);
7772 SET_TexParameteriv(table
, save_TexParameteriv
);
7773 SET_Translated(table
, save_Translated
);
7774 SET_Translatef(table
, save_Translatef
);
7775 SET_Viewport(table
, save_Viewport
);
7778 SET_AreTexturesResident(table
, exec_AreTexturesResident
);
7779 SET_BindTexture(table
, save_BindTexture
);
7780 SET_ColorPointer(table
, exec_ColorPointer
);
7781 SET_CopyTexImage1D(table
, save_CopyTexImage1D
);
7782 SET_CopyTexImage2D(table
, save_CopyTexImage2D
);
7783 SET_CopyTexSubImage1D(table
, save_CopyTexSubImage1D
);
7784 SET_CopyTexSubImage2D(table
, save_CopyTexSubImage2D
);
7785 SET_DeleteTextures(table
, exec_DeleteTextures
);
7786 SET_DisableClientState(table
, exec_DisableClientState
);
7787 SET_EdgeFlagPointer(table
, exec_EdgeFlagPointer
);
7788 SET_EnableClientState(table
, exec_EnableClientState
);
7789 SET_GenTextures(table
, exec_GenTextures
);
7790 SET_GetPointerv(table
, exec_GetPointerv
);
7791 SET_IndexPointer(table
, exec_IndexPointer
);
7792 SET_InterleavedArrays(table
, exec_InterleavedArrays
);
7793 SET_IsTexture(table
, exec_IsTexture
);
7794 SET_NormalPointer(table
, exec_NormalPointer
);
7795 SET_PopClientAttrib(table
, exec_PopClientAttrib
);
7796 SET_PrioritizeTextures(table
, save_PrioritizeTextures
);
7797 SET_PushClientAttrib(table
, exec_PushClientAttrib
);
7798 SET_TexCoordPointer(table
, exec_TexCoordPointer
);
7799 SET_TexSubImage1D(table
, save_TexSubImage1D
);
7800 SET_TexSubImage2D(table
, save_TexSubImage2D
);
7801 SET_VertexPointer(table
, exec_VertexPointer
);
7804 SET_CopyTexSubImage3D(table
, save_CopyTexSubImage3D
);
7805 SET_TexImage3D(table
, save_TexImage3D
);
7806 SET_TexSubImage3D(table
, save_TexSubImage3D
);
7809 SET_StencilFuncSeparate(table
, save_StencilFuncSeparate
);
7810 SET_StencilMaskSeparate(table
, save_StencilMaskSeparate
);
7811 SET_StencilOpSeparate(table
, save_StencilOpSeparate
);
7813 /* GL_ARB_imaging */
7814 /* Not all are supported */
7815 SET_BlendColor(table
, save_BlendColor
);
7816 SET_BlendEquation(table
, save_BlendEquation
);
7817 SET_ColorSubTable(table
, save_ColorSubTable
);
7818 SET_ColorTable(table
, save_ColorTable
);
7819 SET_ColorTableParameterfv(table
, save_ColorTableParameterfv
);
7820 SET_ColorTableParameteriv(table
, save_ColorTableParameteriv
);
7821 SET_ConvolutionFilter1D(table
, save_ConvolutionFilter1D
);
7822 SET_ConvolutionFilter2D(table
, save_ConvolutionFilter2D
);
7823 SET_ConvolutionParameterf(table
, save_ConvolutionParameterf
);
7824 SET_ConvolutionParameterfv(table
, save_ConvolutionParameterfv
);
7825 SET_ConvolutionParameteri(table
, save_ConvolutionParameteri
);
7826 SET_ConvolutionParameteriv(table
, save_ConvolutionParameteriv
);
7827 SET_CopyColorSubTable(table
, save_CopyColorSubTable
);
7828 SET_CopyColorTable(table
, save_CopyColorTable
);
7829 SET_CopyConvolutionFilter1D(table
, exec_CopyConvolutionFilter1D
);
7830 SET_CopyConvolutionFilter2D(table
, exec_CopyConvolutionFilter2D
);
7831 SET_GetColorTable(table
, exec_GetColorTable
);
7832 SET_GetColorTableParameterfv(table
, exec_GetColorTableParameterfv
);
7833 SET_GetColorTableParameteriv(table
, exec_GetColorTableParameteriv
);
7834 SET_GetConvolutionFilter(table
, exec_GetConvolutionFilter
);
7835 SET_GetConvolutionParameterfv(table
, exec_GetConvolutionParameterfv
);
7836 SET_GetConvolutionParameteriv(table
, exec_GetConvolutionParameteriv
);
7837 SET_GetHistogram(table
, exec_GetHistogram
);
7838 SET_GetHistogramParameterfv(table
, exec_GetHistogramParameterfv
);
7839 SET_GetHistogramParameteriv(table
, exec_GetHistogramParameteriv
);
7840 SET_GetMinmax(table
, exec_GetMinmax
);
7841 SET_GetMinmaxParameterfv(table
, exec_GetMinmaxParameterfv
);
7842 SET_GetMinmaxParameteriv(table
, exec_GetMinmaxParameteriv
);
7843 SET_GetSeparableFilter(table
, exec_GetSeparableFilter
);
7844 SET_Histogram(table
, save_Histogram
);
7845 SET_Minmax(table
, save_Minmax
);
7846 SET_ResetHistogram(table
, save_ResetHistogram
);
7847 SET_ResetMinmax(table
, save_ResetMinmax
);
7848 SET_SeparableFilter2D(table
, exec_SeparableFilter2D
);
7850 /* 2. GL_EXT_blend_color */
7852 SET_BlendColorEXT(table
, save_BlendColorEXT
);
7855 /* 3. GL_EXT_polygon_offset */
7856 SET_PolygonOffsetEXT(table
, save_PolygonOffsetEXT
);
7858 /* 6. GL_EXT_texture3d */
7860 SET_CopyTexSubImage3DEXT(table
, save_CopyTexSubImage3D
);
7861 SET_TexImage3DEXT(table
, save_TexImage3DEXT
);
7862 SET_TexSubImage3DEXT(table
, save_TexSubImage3D
);
7865 /* 14. GL_SGI_color_table */
7867 SET_ColorTableSGI(table
, save_ColorTable
);
7868 SET_ColorSubTableSGI(table
, save_ColorSubTable
);
7869 SET_GetColorTableSGI(table
, exec_GetColorTable
);
7870 SET_GetColorTableParameterfvSGI(table
, exec_GetColorTableParameterfv
);
7871 SET_GetColorTableParameterivSGI(table
, exec_GetColorTableParameteriv
);
7874 /* 30. GL_EXT_vertex_array */
7875 SET_ColorPointerEXT(table
, exec_ColorPointerEXT
);
7876 SET_EdgeFlagPointerEXT(table
, exec_EdgeFlagPointerEXT
);
7877 SET_IndexPointerEXT(table
, exec_IndexPointerEXT
);
7878 SET_NormalPointerEXT(table
, exec_NormalPointerEXT
);
7879 SET_TexCoordPointerEXT(table
, exec_TexCoordPointerEXT
);
7880 SET_VertexPointerEXT(table
, exec_VertexPointerEXT
);
7882 /* 37. GL_EXT_blend_minmax */
7884 SET_BlendEquationEXT(table
, save_BlendEquationEXT
);
7887 /* 54. GL_EXT_point_parameters */
7888 SET_PointParameterfEXT(table
, save_PointParameterfEXT
);
7889 SET_PointParameterfvEXT(table
, save_PointParameterfvEXT
);
7891 /* 97. GL_EXT_compiled_vertex_array */
7892 SET_LockArraysEXT(table
, exec_LockArraysEXT
);
7893 SET_UnlockArraysEXT(table
, exec_UnlockArraysEXT
);
7895 /* 145. GL_EXT_secondary_color */
7896 SET_SecondaryColorPointerEXT(table
, exec_SecondaryColorPointerEXT
);
7898 /* 148. GL_EXT_multi_draw_arrays */
7899 SET_MultiDrawArraysEXT(table
, exec_MultiDrawArraysEXT
);
7900 SET_MultiDrawElementsEXT(table
, exec_MultiDrawElementsEXT
);
7902 /* 149. GL_EXT_fog_coord */
7903 SET_FogCoordPointerEXT(table
, exec_FogCoordPointerEXT
);
7905 /* 173. GL_EXT_blend_func_separate */
7906 SET_BlendFuncSeparateEXT(table
, save_BlendFuncSeparateEXT
);
7908 /* 196. GL_MESA_resize_buffers */
7909 SET_ResizeBuffersMESA(table
, _mesa_ResizeBuffersMESA
);
7911 /* 197. GL_MESA_window_pos */
7912 SET_WindowPos2dMESA(table
, save_WindowPos2dMESA
);
7913 SET_WindowPos2dvMESA(table
, save_WindowPos2dvMESA
);
7914 SET_WindowPos2fMESA(table
, save_WindowPos2fMESA
);
7915 SET_WindowPos2fvMESA(table
, save_WindowPos2fvMESA
);
7916 SET_WindowPos2iMESA(table
, save_WindowPos2iMESA
);
7917 SET_WindowPos2ivMESA(table
, save_WindowPos2ivMESA
);
7918 SET_WindowPos2sMESA(table
, save_WindowPos2sMESA
);
7919 SET_WindowPos2svMESA(table
, save_WindowPos2svMESA
);
7920 SET_WindowPos3dMESA(table
, save_WindowPos3dMESA
);
7921 SET_WindowPos3dvMESA(table
, save_WindowPos3dvMESA
);
7922 SET_WindowPos3fMESA(table
, save_WindowPos3fMESA
);
7923 SET_WindowPos3fvMESA(table
, save_WindowPos3fvMESA
);
7924 SET_WindowPos3iMESA(table
, save_WindowPos3iMESA
);
7925 SET_WindowPos3ivMESA(table
, save_WindowPos3ivMESA
);
7926 SET_WindowPos3sMESA(table
, save_WindowPos3sMESA
);
7927 SET_WindowPos3svMESA(table
, save_WindowPos3svMESA
);
7928 SET_WindowPos4dMESA(table
, save_WindowPos4dMESA
);
7929 SET_WindowPos4dvMESA(table
, save_WindowPos4dvMESA
);
7930 SET_WindowPos4fMESA(table
, save_WindowPos4fMESA
);
7931 SET_WindowPos4fvMESA(table
, save_WindowPos4fvMESA
);
7932 SET_WindowPos4iMESA(table
, save_WindowPos4iMESA
);
7933 SET_WindowPos4ivMESA(table
, save_WindowPos4ivMESA
);
7934 SET_WindowPos4sMESA(table
, save_WindowPos4sMESA
);
7935 SET_WindowPos4svMESA(table
, save_WindowPos4svMESA
);
7937 /* 200. GL_IBM_multimode_draw_arrays */
7938 SET_MultiModeDrawArraysIBM(table
, exec_MultiModeDrawArraysIBM
);
7939 SET_MultiModeDrawElementsIBM(table
, exec_MultiModeDrawElementsIBM
);
7941 #if FEATURE_NV_vertex_program
7942 /* 233. GL_NV_vertex_program */
7943 /* The following commands DO NOT go into display lists:
7944 * AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV,
7945 * VertexAttribPointerNV, GetProgram*, GetVertexAttrib*
7947 SET_BindProgramNV(table
, save_BindProgramNV
);
7948 SET_DeleteProgramsNV(table
, _mesa_DeletePrograms
);
7949 SET_ExecuteProgramNV(table
, save_ExecuteProgramNV
);
7950 SET_GenProgramsNV(table
, _mesa_GenPrograms
);
7951 SET_AreProgramsResidentNV(table
, _mesa_AreProgramsResidentNV
);
7952 SET_RequestResidentProgramsNV(table
, save_RequestResidentProgramsNV
);
7953 SET_GetProgramParameterfvNV(table
, _mesa_GetProgramParameterfvNV
);
7954 SET_GetProgramParameterdvNV(table
, _mesa_GetProgramParameterdvNV
);
7955 SET_GetProgramivNV(table
, _mesa_GetProgramivNV
);
7956 SET_GetProgramStringNV(table
, _mesa_GetProgramStringNV
);
7957 SET_GetTrackMatrixivNV(table
, _mesa_GetTrackMatrixivNV
);
7958 SET_GetVertexAttribdvNV(table
, _mesa_GetVertexAttribdvNV
);
7959 SET_GetVertexAttribfvNV(table
, _mesa_GetVertexAttribfvNV
);
7960 SET_GetVertexAttribivNV(table
, _mesa_GetVertexAttribivNV
);
7961 SET_GetVertexAttribPointervNV(table
, _mesa_GetVertexAttribPointervNV
);
7962 SET_IsProgramNV(table
, _mesa_IsProgramARB
);
7963 SET_LoadProgramNV(table
, save_LoadProgramNV
);
7964 SET_ProgramEnvParameter4dARB(table
, save_ProgramEnvParameter4dARB
);
7965 SET_ProgramEnvParameter4dvARB(table
, save_ProgramEnvParameter4dvARB
);
7966 SET_ProgramEnvParameter4fARB(table
, save_ProgramEnvParameter4fARB
);
7967 SET_ProgramEnvParameter4fvARB(table
, save_ProgramEnvParameter4fvARB
);
7968 SET_ProgramParameters4dvNV(table
, save_ProgramParameters4dvNV
);
7969 SET_ProgramParameters4fvNV(table
, save_ProgramParameters4fvNV
);
7970 SET_TrackMatrixNV(table
, save_TrackMatrixNV
);
7971 SET_VertexAttribPointerNV(table
, _mesa_VertexAttribPointerNV
);
7974 /* 245. GL_ATI_fragment_shader */
7975 #if FEATURE_ATI_fragment_shader
7976 SET_BindFragmentShaderATI(table
, save_BindFragmentShaderATI
);
7977 SET_SetFragmentShaderConstantATI(table
, save_SetFragmentShaderConstantATI
);
7980 /* 282. GL_NV_fragment_program */
7981 #if FEATURE_NV_fragment_program
7982 SET_ProgramNamedParameter4fNV(table
, save_ProgramNamedParameter4fNV
);
7983 SET_ProgramNamedParameter4dNV(table
, save_ProgramNamedParameter4dNV
);
7984 SET_ProgramNamedParameter4fvNV(table
, save_ProgramNamedParameter4fvNV
);
7985 SET_ProgramNamedParameter4dvNV(table
, save_ProgramNamedParameter4dvNV
);
7986 SET_GetProgramNamedParameterfvNV(table
,
7987 _mesa_GetProgramNamedParameterfvNV
);
7988 SET_GetProgramNamedParameterdvNV(table
,
7989 _mesa_GetProgramNamedParameterdvNV
);
7990 SET_ProgramLocalParameter4dARB(table
, save_ProgramLocalParameter4dARB
);
7991 SET_ProgramLocalParameter4dvARB(table
, save_ProgramLocalParameter4dvARB
);
7992 SET_ProgramLocalParameter4fARB(table
, save_ProgramLocalParameter4fARB
);
7993 SET_ProgramLocalParameter4fvARB(table
, save_ProgramLocalParameter4fvARB
);
7994 SET_GetProgramLocalParameterdvARB(table
,
7995 _mesa_GetProgramLocalParameterdvARB
);
7996 SET_GetProgramLocalParameterfvARB(table
,
7997 _mesa_GetProgramLocalParameterfvARB
);
8000 /* 262. GL_NV_point_sprite */
8001 SET_PointParameteriNV(table
, save_PointParameteriNV
);
8002 SET_PointParameterivNV(table
, save_PointParameterivNV
);
8004 /* 268. GL_EXT_stencil_two_side */
8005 SET_ActiveStencilFaceEXT(table
, save_ActiveStencilFaceEXT
);
8007 /* 273. GL_APPLE_vertex_array_object */
8008 SET_BindVertexArrayAPPLE(table
, _mesa_BindVertexArrayAPPLE
);
8009 SET_DeleteVertexArraysAPPLE(table
, _mesa_DeleteVertexArraysAPPLE
);
8010 SET_GenVertexArraysAPPLE(table
, _mesa_GenVertexArraysAPPLE
);
8011 SET_IsVertexArrayAPPLE(table
, _mesa_IsVertexArrayAPPLE
);
8013 /* ???. GL_EXT_depth_bounds_test */
8014 SET_DepthBoundsEXT(table
, save_DepthBoundsEXT
);
8016 /* ARB 1. GL_ARB_multitexture */
8017 SET_ActiveTextureARB(table
, save_ActiveTextureARB
);
8018 SET_ClientActiveTextureARB(table
, exec_ClientActiveTextureARB
);
8020 /* ARB 3. GL_ARB_transpose_matrix */
8021 SET_LoadTransposeMatrixdARB(table
, save_LoadTransposeMatrixdARB
);
8022 SET_LoadTransposeMatrixfARB(table
, save_LoadTransposeMatrixfARB
);
8023 SET_MultTransposeMatrixdARB(table
, save_MultTransposeMatrixdARB
);
8024 SET_MultTransposeMatrixfARB(table
, save_MultTransposeMatrixfARB
);
8026 /* ARB 5. GL_ARB_multisample */
8027 SET_SampleCoverageARB(table
, save_SampleCoverageARB
);
8029 /* ARB 12. GL_ARB_texture_compression */
8030 SET_CompressedTexImage3DARB(table
, save_CompressedTexImage3DARB
);
8031 SET_CompressedTexImage2DARB(table
, save_CompressedTexImage2DARB
);
8032 SET_CompressedTexImage1DARB(table
, save_CompressedTexImage1DARB
);
8033 SET_CompressedTexSubImage3DARB(table
, save_CompressedTexSubImage3DARB
);
8034 SET_CompressedTexSubImage2DARB(table
, save_CompressedTexSubImage2DARB
);
8035 SET_CompressedTexSubImage1DARB(table
, save_CompressedTexSubImage1DARB
);
8036 SET_GetCompressedTexImageARB(table
, exec_GetCompressedTexImageARB
);
8038 /* ARB 14. GL_ARB_point_parameters */
8039 /* aliased with EXT_point_parameters functions */
8041 /* ARB 25. GL_ARB_window_pos */
8042 /* aliased with MESA_window_pos functions */
8044 /* ARB 26. GL_ARB_vertex_program */
8045 /* ARB 27. GL_ARB_fragment_program */
8046 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
8047 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
8048 SET_VertexAttribPointerARB(table
, _mesa_VertexAttribPointerARB
);
8049 SET_EnableVertexAttribArrayARB(table
, _mesa_EnableVertexAttribArrayARB
);
8050 SET_DisableVertexAttribArrayARB(table
, _mesa_DisableVertexAttribArrayARB
);
8051 SET_ProgramStringARB(table
, save_ProgramStringARB
);
8052 SET_BindProgramNV(table
, save_BindProgramNV
);
8053 SET_DeleteProgramsNV(table
, _mesa_DeletePrograms
);
8054 SET_GenProgramsNV(table
, _mesa_GenPrograms
);
8055 SET_IsProgramNV(table
, _mesa_IsProgramARB
);
8056 SET_GetVertexAttribdvNV(table
, _mesa_GetVertexAttribdvNV
);
8057 SET_GetVertexAttribfvNV(table
, _mesa_GetVertexAttribfvNV
);
8058 SET_GetVertexAttribivNV(table
, _mesa_GetVertexAttribivNV
);
8059 SET_GetVertexAttribPointervNV(table
, _mesa_GetVertexAttribPointervNV
);
8060 SET_ProgramEnvParameter4dARB(table
, save_ProgramEnvParameter4dARB
);
8061 SET_ProgramEnvParameter4dvARB(table
, save_ProgramEnvParameter4dvARB
);
8062 SET_ProgramEnvParameter4fARB(table
, save_ProgramEnvParameter4fARB
);
8063 SET_ProgramEnvParameter4fvARB(table
, save_ProgramEnvParameter4fvARB
);
8064 SET_ProgramLocalParameter4dARB(table
, save_ProgramLocalParameter4dARB
);
8065 SET_ProgramLocalParameter4dvARB(table
, save_ProgramLocalParameter4dvARB
);
8066 SET_ProgramLocalParameter4fARB(table
, save_ProgramLocalParameter4fARB
);
8067 SET_ProgramLocalParameter4fvARB(table
, save_ProgramLocalParameter4fvARB
);
8068 SET_GetProgramEnvParameterdvARB(table
, _mesa_GetProgramEnvParameterdvARB
);
8069 SET_GetProgramEnvParameterfvARB(table
, _mesa_GetProgramEnvParameterfvARB
);
8070 SET_GetProgramLocalParameterdvARB(table
,
8071 _mesa_GetProgramLocalParameterdvARB
);
8072 SET_GetProgramLocalParameterfvARB(table
,
8073 _mesa_GetProgramLocalParameterfvARB
);
8074 SET_GetProgramivARB(table
, _mesa_GetProgramivARB
);
8075 SET_GetProgramStringARB(table
, _mesa_GetProgramStringARB
);
8078 /* ARB 28. GL_ARB_vertex_buffer_object */
8079 #if FEATURE_ARB_vertex_buffer_object
8080 /* None of the extension's functions get compiled */
8081 SET_BindBufferARB(table
, _mesa_BindBufferARB
);
8082 SET_BufferDataARB(table
, _mesa_BufferDataARB
);
8083 SET_BufferSubDataARB(table
, _mesa_BufferSubDataARB
);
8084 SET_DeleteBuffersARB(table
, _mesa_DeleteBuffersARB
);
8085 SET_GenBuffersARB(table
, _mesa_GenBuffersARB
);
8086 SET_GetBufferParameterivARB(table
, _mesa_GetBufferParameterivARB
);
8087 SET_GetBufferPointervARB(table
, _mesa_GetBufferPointervARB
);
8088 SET_GetBufferSubDataARB(table
, _mesa_GetBufferSubDataARB
);
8089 SET_IsBufferARB(table
, _mesa_IsBufferARB
);
8090 SET_MapBufferARB(table
, _mesa_MapBufferARB
);
8091 SET_UnmapBufferARB(table
, _mesa_UnmapBufferARB
);
8094 #if FEATURE_ARB_occlusion_query
8095 SET_BeginQueryARB(table
, save_BeginQueryARB
);
8096 SET_EndQueryARB(table
, save_EndQueryARB
);
8097 SET_GenQueriesARB(table
, _mesa_GenQueriesARB
);
8098 SET_DeleteQueriesARB(table
, _mesa_DeleteQueriesARB
);
8099 SET_IsQueryARB(table
, _mesa_IsQueryARB
);
8100 SET_GetQueryivARB(table
, _mesa_GetQueryivARB
);
8101 SET_GetQueryObjectivARB(table
, _mesa_GetQueryObjectivARB
);
8102 SET_GetQueryObjectuivARB(table
, _mesa_GetQueryObjectuivARB
);
8104 SET_DrawBuffersARB(table
, save_DrawBuffersARB
);
8106 #if FEATURE_EXT_framebuffer_blit
8107 SET_BlitFramebufferEXT(table
, save_BlitFramebufferEXT
);
8110 /* 299. GL_EXT_blend_equation_separate */
8111 SET_BlendEquationSeparateEXT(table
, save_BlendEquationSeparateEXT
);
8113 /* GL_EXT_gpu_program_parmaeters */
8114 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
8115 SET_ProgramEnvParameters4fvEXT(table
, save_ProgramEnvParameters4fvEXT
);
8116 SET_ProgramLocalParameters4fvEXT(table
, save_ProgramLocalParameters4fvEXT
);
8123 enum_string(GLenum k
)
8125 return _mesa_lookup_enum_by_nr(k
);
8130 * Print the commands in a display list. For debugging only.
8131 * TODO: many commands aren't handled yet.
8133 static void GLAPIENTRY
8134 print_list(GLcontext
*ctx
, GLuint list
)
8136 struct mesa_display_list
*dlist
;
8140 if (!islist(ctx
, list
)) {
8141 _mesa_printf("%u is not a display list ID\n", list
);
8145 dlist
= lookup_list(ctx
, list
);
8151 _mesa_printf("START-LIST %u, address %p\n", list
, (void *) n
);
8153 done
= n
? GL_FALSE
: GL_TRUE
;
8155 OpCode opcode
= n
[0].opcode
;
8156 GLint i
= (GLint
) n
[0].opcode
- (GLint
) OPCODE_EXT_0
;
8158 if (i
>= 0 && i
< (GLint
) ctx
->ListExt
.NumOpcodes
) {
8159 /* this is a driver-extended opcode */
8160 ctx
->ListExt
.Opcode
[i
].Print(ctx
, &n
[1]);
8161 n
+= ctx
->ListExt
.Opcode
[i
].Size
;
8166 _mesa_printf("Accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
8169 _mesa_printf("Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
8170 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
, (void *) n
[7].data
);
8172 case OPCODE_CALL_LIST
:
8173 _mesa_printf("CallList %d\n", (int) n
[1].ui
);
8175 case OPCODE_CALL_LIST_OFFSET
:
8176 _mesa_printf("CallList %d + offset %u = %u\n", (int) n
[1].ui
,
8177 ctx
->List
.ListBase
, ctx
->List
.ListBase
+ n
[1].ui
);
8179 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
8180 _mesa_printf("ColorTableParameterfv %s %s %f %f %f %f\n",
8181 enum_string(n
[1].e
), enum_string(n
[2].e
),
8182 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8184 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
8185 _mesa_printf("ColorTableParameteriv %s %s %d %d %d %d\n",
8186 enum_string(n
[1].e
), enum_string(n
[2].e
),
8187 n
[3].i
, n
[4].i
, n
[5].i
, n
[6].i
);
8189 case OPCODE_DISABLE
:
8190 _mesa_printf("Disable %s\n", enum_string(n
[1].e
));
8193 _mesa_printf("Enable %s\n", enum_string(n
[1].e
));
8195 case OPCODE_FRUSTUM
:
8196 _mesa_printf("Frustum %g %g %g %g %g %g\n",
8197 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8199 case OPCODE_LINE_STIPPLE
:
8200 _mesa_printf("LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
8202 case OPCODE_LOAD_IDENTITY
:
8203 _mesa_printf("LoadIdentity\n");
8205 case OPCODE_LOAD_MATRIX
:
8206 _mesa_printf("LoadMatrix\n");
8207 _mesa_printf(" %8f %8f %8f %8f\n",
8208 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
8209 _mesa_printf(" %8f %8f %8f %8f\n",
8210 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
8211 _mesa_printf(" %8f %8f %8f %8f\n",
8212 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
8213 _mesa_printf(" %8f %8f %8f %8f\n",
8214 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
8216 case OPCODE_MULT_MATRIX
:
8217 _mesa_printf("MultMatrix (or Rotate)\n");
8218 _mesa_printf(" %8f %8f %8f %8f\n",
8219 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
8220 _mesa_printf(" %8f %8f %8f %8f\n",
8221 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
8222 _mesa_printf(" %8f %8f %8f %8f\n",
8223 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
8224 _mesa_printf(" %8f %8f %8f %8f\n",
8225 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
8228 _mesa_printf("Ortho %g %g %g %g %g %g\n",
8229 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8231 case OPCODE_POP_ATTRIB
:
8232 _mesa_printf("PopAttrib\n");
8234 case OPCODE_POP_MATRIX
:
8235 _mesa_printf("PopMatrix\n");
8237 case OPCODE_POP_NAME
:
8238 _mesa_printf("PopName\n");
8240 case OPCODE_PUSH_ATTRIB
:
8241 _mesa_printf("PushAttrib %x\n", n
[1].bf
);
8243 case OPCODE_PUSH_MATRIX
:
8244 _mesa_printf("PushMatrix\n");
8246 case OPCODE_PUSH_NAME
:
8247 _mesa_printf("PushName %d\n", (int) n
[1].ui
);
8249 case OPCODE_RASTER_POS
:
8250 _mesa_printf("RasterPos %g %g %g %g\n",
8251 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
8254 _mesa_printf("Rotate %g %g %g %g\n",
8255 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
8258 _mesa_printf("Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
8260 case OPCODE_TRANSLATE
:
8261 _mesa_printf("Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
8263 case OPCODE_BIND_TEXTURE
:
8264 _mesa_printf("BindTexture %s %d\n",
8265 _mesa_lookup_enum_by_nr(n
[1].ui
), n
[2].ui
);
8267 case OPCODE_SHADE_MODEL
:
8268 _mesa_printf("ShadeModel %s\n", _mesa_lookup_enum_by_nr(n
[1].ui
));
8271 _mesa_printf("Map1 %s %.3f %.3f %d %d\n",
8272 _mesa_lookup_enum_by_nr(n
[1].ui
),
8273 n
[2].f
, n
[3].f
, n
[4].i
, n
[5].i
);
8276 _mesa_printf("Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
8277 _mesa_lookup_enum_by_nr(n
[1].ui
),
8278 n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
,
8279 n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
8281 case OPCODE_MAPGRID1
:
8282 _mesa_printf("MapGrid1 %d %.3f %.3f\n", n
[1].i
, n
[2].f
, n
[3].f
);
8284 case OPCODE_MAPGRID2
:
8285 _mesa_printf("MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
8286 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
8288 case OPCODE_EVALMESH1
:
8289 _mesa_printf("EvalMesh1 %d %d\n", n
[1].i
, n
[2].i
);
8291 case OPCODE_EVALMESH2
:
8292 _mesa_printf("EvalMesh2 %d %d %d %d\n",
8293 n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
8296 case OPCODE_ATTR_1F_NV
:
8297 _mesa_printf("ATTR_1F_NV attr %d: %f\n", n
[1].i
, n
[2].f
);
8299 case OPCODE_ATTR_2F_NV
:
8300 _mesa_printf("ATTR_2F_NV attr %d: %f %f\n",
8301 n
[1].i
, n
[2].f
, n
[3].f
);
8303 case OPCODE_ATTR_3F_NV
:
8304 _mesa_printf("ATTR_3F_NV attr %d: %f %f %f\n",
8305 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
8307 case OPCODE_ATTR_4F_NV
:
8308 _mesa_printf("ATTR_4F_NV attr %d: %f %f %f %f\n",
8309 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
8311 case OPCODE_ATTR_1F_ARB
:
8312 _mesa_printf("ATTR_1F_ARB attr %d: %f\n", n
[1].i
, n
[2].f
);
8314 case OPCODE_ATTR_2F_ARB
:
8315 _mesa_printf("ATTR_2F_ARB attr %d: %f %f\n",
8316 n
[1].i
, n
[2].f
, n
[3].f
);
8318 case OPCODE_ATTR_3F_ARB
:
8319 _mesa_printf("ATTR_3F_ARB attr %d: %f %f %f\n",
8320 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
8322 case OPCODE_ATTR_4F_ARB
:
8323 _mesa_printf("ATTR_4F_ARB attr %d: %f %f %f %f\n",
8324 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
8327 case OPCODE_MATERIAL
:
8328 _mesa_printf("MATERIAL %x %x: %f %f %f %f\n",
8329 n
[1].i
, n
[2].i
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8332 _mesa_printf("BEGIN %x\n", n
[1].i
);
8335 _mesa_printf("END\n");
8338 _mesa_printf("RECTF %f %f %f %f\n", n
[1].f
, n
[2].f
, n
[3].f
,
8341 case OPCODE_EVAL_C1
:
8342 _mesa_printf("EVAL_C1 %f\n", n
[1].f
);
8344 case OPCODE_EVAL_C2
:
8345 _mesa_printf("EVAL_C2 %f %f\n", n
[1].f
, n
[2].f
);
8347 case OPCODE_EVAL_P1
:
8348 _mesa_printf("EVAL_P1 %d\n", n
[1].i
);
8350 case OPCODE_EVAL_P2
:
8351 _mesa_printf("EVAL_P2 %d %d\n", n
[1].i
, n
[2].i
);
8355 * meta opcodes/commands
8358 _mesa_printf("Error: %s %s\n",
8359 enum_string(n
[1].e
), (const char *) n
[2].data
);
8361 case OPCODE_CONTINUE
:
8362 _mesa_printf("DISPLAY-LIST-CONTINUE\n");
8363 n
= (Node
*) n
[1].next
;
8365 case OPCODE_END_OF_LIST
:
8366 _mesa_printf("END-LIST %u\n", list
);
8370 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
8372 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
8373 opcode
, (void *) n
);
8377 _mesa_printf("command %d, %u operands\n", opcode
,
8381 /* increment n to point to next compiled command */
8382 if (opcode
!= OPCODE_CONTINUE
) {
8383 n
+= InstSize
[opcode
];
8392 * Clients may call this function to help debug display list problems.
8393 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
8394 * changed, or break in the future without notice.
8397 mesa_print_display_list(GLuint list
)
8399 GET_CURRENT_CONTEXT(ctx
);
8400 print_list(ctx
, list
);
8404 /**********************************************************************/
8405 /***** Initialization *****/
8406 /**********************************************************************/
8409 _mesa_save_vtxfmt_init(GLvertexformat
* vfmt
)
8411 vfmt
->ArrayElement
= _ae_loopback_array_elt
; /* generic helper */
8412 vfmt
->Begin
= save_Begin
;
8413 vfmt
->CallList
= _mesa_save_CallList
;
8414 vfmt
->CallLists
= _mesa_save_CallLists
;
8415 vfmt
->Color3f
= save_Color3f
;
8416 vfmt
->Color3fv
= save_Color3fv
;
8417 vfmt
->Color4f
= save_Color4f
;
8418 vfmt
->Color4fv
= save_Color4fv
;
8419 vfmt
->EdgeFlag
= save_EdgeFlag
;
8420 vfmt
->End
= save_End
;
8421 vfmt
->EvalCoord1f
= save_EvalCoord1f
;
8422 vfmt
->EvalCoord1fv
= save_EvalCoord1fv
;
8423 vfmt
->EvalCoord2f
= save_EvalCoord2f
;
8424 vfmt
->EvalCoord2fv
= save_EvalCoord2fv
;
8425 vfmt
->EvalPoint1
= save_EvalPoint1
;
8426 vfmt
->EvalPoint2
= save_EvalPoint2
;
8427 vfmt
->FogCoordfEXT
= save_FogCoordfEXT
;
8428 vfmt
->FogCoordfvEXT
= save_FogCoordfvEXT
;
8429 vfmt
->Indexf
= save_Indexf
;
8430 vfmt
->Indexfv
= save_Indexfv
;
8431 vfmt
->Materialfv
= save_Materialfv
;
8432 vfmt
->MultiTexCoord1fARB
= save_MultiTexCoord1f
;
8433 vfmt
->MultiTexCoord1fvARB
= save_MultiTexCoord1fv
;
8434 vfmt
->MultiTexCoord2fARB
= save_MultiTexCoord2f
;
8435 vfmt
->MultiTexCoord2fvARB
= save_MultiTexCoord2fv
;
8436 vfmt
->MultiTexCoord3fARB
= save_MultiTexCoord3f
;
8437 vfmt
->MultiTexCoord3fvARB
= save_MultiTexCoord3fv
;
8438 vfmt
->MultiTexCoord4fARB
= save_MultiTexCoord4f
;
8439 vfmt
->MultiTexCoord4fvARB
= save_MultiTexCoord4fv
;
8440 vfmt
->Normal3f
= save_Normal3f
;
8441 vfmt
->Normal3fv
= save_Normal3fv
;
8442 vfmt
->SecondaryColor3fEXT
= save_SecondaryColor3fEXT
;
8443 vfmt
->SecondaryColor3fvEXT
= save_SecondaryColor3fvEXT
;
8444 vfmt
->TexCoord1f
= save_TexCoord1f
;
8445 vfmt
->TexCoord1fv
= save_TexCoord1fv
;
8446 vfmt
->TexCoord2f
= save_TexCoord2f
;
8447 vfmt
->TexCoord2fv
= save_TexCoord2fv
;
8448 vfmt
->TexCoord3f
= save_TexCoord3f
;
8449 vfmt
->TexCoord3fv
= save_TexCoord3fv
;
8450 vfmt
->TexCoord4f
= save_TexCoord4f
;
8451 vfmt
->TexCoord4fv
= save_TexCoord4fv
;
8452 vfmt
->Vertex2f
= save_Vertex2f
;
8453 vfmt
->Vertex2fv
= save_Vertex2fv
;
8454 vfmt
->Vertex3f
= save_Vertex3f
;
8455 vfmt
->Vertex3fv
= save_Vertex3fv
;
8456 vfmt
->Vertex4f
= save_Vertex4f
;
8457 vfmt
->Vertex4fv
= save_Vertex4fv
;
8458 vfmt
->VertexAttrib1fNV
= save_VertexAttrib1fNV
;
8459 vfmt
->VertexAttrib1fvNV
= save_VertexAttrib1fvNV
;
8460 vfmt
->VertexAttrib2fNV
= save_VertexAttrib2fNV
;
8461 vfmt
->VertexAttrib2fvNV
= save_VertexAttrib2fvNV
;
8462 vfmt
->VertexAttrib3fNV
= save_VertexAttrib3fNV
;
8463 vfmt
->VertexAttrib3fvNV
= save_VertexAttrib3fvNV
;
8464 vfmt
->VertexAttrib4fNV
= save_VertexAttrib4fNV
;
8465 vfmt
->VertexAttrib4fvNV
= save_VertexAttrib4fvNV
;
8466 vfmt
->VertexAttrib1fARB
= save_VertexAttrib1fARB
;
8467 vfmt
->VertexAttrib1fvARB
= save_VertexAttrib1fvARB
;
8468 vfmt
->VertexAttrib2fARB
= save_VertexAttrib2fARB
;
8469 vfmt
->VertexAttrib2fvARB
= save_VertexAttrib2fvARB
;
8470 vfmt
->VertexAttrib3fARB
= save_VertexAttrib3fARB
;
8471 vfmt
->VertexAttrib3fvARB
= save_VertexAttrib3fvARB
;
8472 vfmt
->VertexAttrib4fARB
= save_VertexAttrib4fARB
;
8473 vfmt
->VertexAttrib4fvARB
= save_VertexAttrib4fvARB
;
8475 vfmt
->EvalMesh1
= _mesa_save_EvalMesh1
;
8476 vfmt
->EvalMesh2
= _mesa_save_EvalMesh2
;
8477 vfmt
->Rectf
= save_Rectf
;
8479 /* The driver is required to implement these as
8480 * 1) They can probably do a better job.
8481 * 2) A lot of new mechanisms would have to be added to this module
8482 * to support it. That code would probably never get used,
8486 vfmt
->DrawArrays
= 0;
8487 vfmt
->DrawElements
= 0;
8488 vfmt
->DrawRangeElements
= 0;
8494 * Initialize display list state for given context.
8497 _mesa_init_display_list(GLcontext
*ctx
)
8499 static GLboolean tableInitialized
= GL_FALSE
;
8501 /* zero-out the instruction size table, just once */
8502 if (!tableInitialized
) {
8503 _mesa_bzero(InstSize
, sizeof(InstSize
));
8504 tableInitialized
= GL_TRUE
;
8508 ctx
->ListState
.CallDepth
= 0;
8509 ctx
->ExecuteFlag
= GL_TRUE
;
8510 ctx
->CompileFlag
= GL_FALSE
;
8511 ctx
->ListState
.CurrentListPtr
= NULL
;
8512 ctx
->ListState
.CurrentBlock
= NULL
;
8513 ctx
->ListState
.CurrentListNum
= 0;
8514 ctx
->ListState
.CurrentPos
= 0;
8516 /* Display List group */
8517 ctx
->List
.ListBase
= 0;
8519 _mesa_save_vtxfmt_init(&ctx
->ListState
.ListVtxfmt
);