2 * Mesa 3-D graphics library
5 * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 * Display lists management functions.
33 #include "api_arrayelt.h"
34 #include "api_loopback.h"
39 #if FEATURE_ARB_vertex_buffer_object
40 #include "bufferobj.h"
53 #include "extensions.h"
56 #include "glapi/glapi.h"
58 #include "histogram.h"
75 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
76 #include "shader/arbprogram.h"
77 #include "shader/program.h"
79 #if FEATURE_NV_vertex_program || FEATURE_NV_fragment_program
80 #include "shader/nvprogram.h"
81 #include "shader/program.h"
83 #if FEATURE_ATI_fragment_shader
84 #include "shader/atifragshader.h"
87 #include "math/m_matrix.h"
88 #include "math/m_xform.h"
90 #include "glapi/dispatch.h"
96 * \param ctx GL context.
98 * Checks if dd_function_table::SaveNeedFlush is marked to flush
99 * stored (save) vertices, and calls
100 * dd_function_table::SaveFlushVertices if so.
102 #define SAVE_FLUSH_VERTICES(ctx) \
104 if (ctx->Driver.SaveNeedFlush) \
105 ctx->Driver.SaveFlushVertices(ctx); \
110 * Macro to assert that the API call was made outside the
111 * glBegin()/glEnd() pair, with return value.
113 * \param ctx GL context.
114 * \param retval value to return value in case the assertion fails.
116 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval) \
118 if (ctx->Driver.CurrentSavePrimitive <= GL_POLYGON || \
119 ctx->Driver.CurrentSavePrimitive == PRIM_INSIDE_UNKNOWN_PRIM) { \
120 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \
126 * Macro to assert that the API call was made outside the
127 * glBegin()/glEnd() pair.
129 * \param ctx GL context.
131 #define ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx) \
133 if (ctx->Driver.CurrentSavePrimitive <= GL_POLYGON || \
134 ctx->Driver.CurrentSavePrimitive == PRIM_INSIDE_UNKNOWN_PRIM) { \
135 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \
141 * Macro to assert that the API call was made outside the
142 * glBegin()/glEnd() pair and flush the vertices.
144 * \param ctx GL context.
146 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx) \
148 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx); \
149 SAVE_FLUSH_VERTICES(ctx); \
153 * Macro to assert that the API call was made outside the
154 * glBegin()/glEnd() pair and flush the vertices, with return value.
156 * \param ctx GL context.
157 * \param retval value to return value in case the assertion fails.
159 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval)\
161 ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval); \
162 SAVE_FLUSH_VERTICES(ctx); \
168 * Display list opcodes.
170 * The fact that these identifiers are assigned consecutive
171 * integer values starting at 0 is very important, see InstSize array usage)
175 OPCODE_INVALID
= -1, /* Force signed enum */
181 OPCODE_BLEND_EQUATION
,
182 OPCODE_BLEND_EQUATION_SEPARATE
,
183 OPCODE_BLEND_FUNC_SEPARATE
,
185 OPCODE_CALL_LIST_OFFSET
,
191 OPCODE_CLEAR_STENCIL
,
194 OPCODE_COLOR_MATERIAL
,
196 OPCODE_COLOR_TABLE_PARAMETER_FV
,
197 OPCODE_COLOR_TABLE_PARAMETER_IV
,
198 OPCODE_COLOR_SUB_TABLE
,
199 OPCODE_CONVOLUTION_FILTER_1D
,
200 OPCODE_CONVOLUTION_FILTER_2D
,
201 OPCODE_CONVOLUTION_PARAMETER_I
,
202 OPCODE_CONVOLUTION_PARAMETER_IV
,
203 OPCODE_CONVOLUTION_PARAMETER_F
,
204 OPCODE_CONVOLUTION_PARAMETER_FV
,
205 OPCODE_COPY_COLOR_SUB_TABLE
,
206 OPCODE_COPY_COLOR_TABLE
,
208 OPCODE_COPY_TEX_IMAGE1D
,
209 OPCODE_COPY_TEX_IMAGE2D
,
210 OPCODE_COPY_TEX_SUB_IMAGE1D
,
211 OPCODE_COPY_TEX_SUB_IMAGE2D
,
212 OPCODE_COPY_TEX_SUB_IMAGE3D
,
235 OPCODE_LOAD_IDENTITY
,
249 OPCODE_PIXEL_TRANSFER
,
252 OPCODE_POINT_PARAMETERS
,
254 OPCODE_POLYGON_STIPPLE
,
255 OPCODE_POLYGON_OFFSET
,
259 OPCODE_PRIORITIZE_TEXTURE
,
265 OPCODE_RESET_HISTOGRAM
,
266 OPCODE_RESET_MIN_MAX
,
270 OPCODE_SELECT_TEXTURE_SGIS
,
271 OPCODE_SELECT_TEXTURE_COORD_SET
,
282 OPCODE_TEX_SUB_IMAGE1D
,
283 OPCODE_TEX_SUB_IMAGE2D
,
284 OPCODE_TEX_SUB_IMAGE3D
,
288 /* GL_ARB_multitexture */
289 OPCODE_ACTIVE_TEXTURE
,
290 /* GL_ARB_texture_compression */
291 OPCODE_COMPRESSED_TEX_IMAGE_1D
,
292 OPCODE_COMPRESSED_TEX_IMAGE_2D
,
293 OPCODE_COMPRESSED_TEX_IMAGE_3D
,
294 OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
,
295 OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
,
296 OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
,
297 /* GL_ARB_multisample */
298 OPCODE_SAMPLE_COVERAGE
,
299 /* GL_ARB_window_pos */
300 OPCODE_WINDOW_POS_ARB
,
301 /* GL_NV_vertex_program */
302 OPCODE_BIND_PROGRAM_NV
,
303 OPCODE_EXECUTE_PROGRAM_NV
,
304 OPCODE_REQUEST_RESIDENT_PROGRAMS_NV
,
305 OPCODE_LOAD_PROGRAM_NV
,
306 OPCODE_TRACK_MATRIX_NV
,
307 /* GL_NV_fragment_program */
308 OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
,
309 OPCODE_PROGRAM_NAMED_PARAMETER_NV
,
310 /* GL_EXT_stencil_two_side */
311 OPCODE_ACTIVE_STENCIL_FACE_EXT
,
312 /* GL_EXT_depth_bounds_test */
313 OPCODE_DEPTH_BOUNDS_EXT
,
314 /* GL_ARB_vertex/fragment_program */
315 OPCODE_PROGRAM_STRING_ARB
,
316 OPCODE_PROGRAM_ENV_PARAMETER_ARB
,
317 /* GL_ARB_occlusion_query */
318 OPCODE_BEGIN_QUERY_ARB
,
319 OPCODE_END_QUERY_ARB
,
320 /* GL_ARB_draw_buffers */
321 OPCODE_DRAW_BUFFERS_ARB
,
322 /* GL_ATI_fragment_shader */
323 OPCODE_BIND_FRAGMENT_SHADER_ATI
,
324 OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
,
326 OPCODE_STENCIL_FUNC_SEPARATE
,
327 OPCODE_STENCIL_OP_SEPARATE
,
328 OPCODE_STENCIL_MASK_SEPARATE
,
330 /* GL_EXT_framebuffer_blit */
331 OPCODE_BLIT_FRAMEBUFFER
,
333 /* Vertex attributes -- fallback for when optimized display
334 * list build isn't active.
353 /* The following three are meta instructions */
354 OPCODE_ERROR
, /* raise compiled-in error */
365 * Display list instructions are stored as sequences of "nodes". Nodes
366 * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
367 * are linked together with a pointer.
369 * Each instruction in the display list is stored as a sequence of
370 * contiguous nodes in memory.
371 * Each node is the union of a variety of data types.
386 void *next
; /* If prev node's opcode==OPCODE_CONTINUE */
391 * How many nodes to allocate at a time.
393 * \note Reduced now that we hold vertices etc. elsewhere.
395 #define BLOCK_SIZE 256
400 * Number of nodes of storage needed for each instruction.
401 * Sizes for dynamically allocated opcodes are stored in the context struct.
403 static GLuint InstSize
[OPCODE_END_OF_LIST
+ 1];
405 void mesa_print_display_list(GLuint list
);
408 /**********************************************************************/
409 /***** Private *****/
410 /**********************************************************************/
414 * Make an empty display list. This is used by glGenLists() to
415 * reserve display list IDs.
417 static struct mesa_display_list
*
418 make_list(GLuint list
, GLuint count
)
420 struct mesa_display_list
*dlist
= CALLOC_STRUCT(mesa_display_list
);
422 dlist
->node
= (Node
*) _mesa_malloc(sizeof(Node
) * count
);
423 dlist
->node
[0].opcode
= OPCODE_END_OF_LIST
;
429 * Lookup function to just encapsulate casting.
431 static INLINE
struct mesa_display_list
*
432 lookup_list(GLcontext
*ctx
, GLuint list
)
434 return (struct mesa_display_list
*)
435 _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
441 * Delete the named display list, but don't remove from hash table.
442 * \param dlist - display list pointer
445 _mesa_delete_list(GLcontext
*ctx
, struct mesa_display_list
*dlist
)
450 n
= block
= dlist
->node
;
452 done
= block
? GL_FALSE
: GL_TRUE
;
455 /* check for extension opcodes first */
457 GLint i
= (GLint
) n
[0].opcode
- (GLint
) OPCODE_EXT_0
;
458 if (i
>= 0 && i
< (GLint
) ctx
->ListExt
.NumOpcodes
) {
459 ctx
->ListExt
.Opcode
[i
].Destroy(ctx
, &n
[1]);
460 n
+= ctx
->ListExt
.Opcode
[i
].Size
;
463 switch (n
[0].opcode
) {
464 /* for some commands, we need to free malloc'd memory */
466 _mesa_free(n
[6].data
);
467 n
+= InstSize
[n
[0].opcode
];
470 _mesa_free(n
[10].data
);
471 n
+= InstSize
[n
[0].opcode
];
473 case OPCODE_DRAW_PIXELS
:
474 _mesa_free(n
[5].data
);
475 n
+= InstSize
[n
[0].opcode
];
478 _mesa_free(n
[7].data
);
479 n
+= InstSize
[n
[0].opcode
];
481 case OPCODE_COLOR_TABLE
:
482 _mesa_free(n
[6].data
);
483 n
+= InstSize
[n
[0].opcode
];
485 case OPCODE_COLOR_SUB_TABLE
:
486 _mesa_free(n
[6].data
);
487 n
+= InstSize
[n
[0].opcode
];
489 case OPCODE_CONVOLUTION_FILTER_1D
:
490 _mesa_free(n
[6].data
);
491 n
+= InstSize
[n
[0].opcode
];
493 case OPCODE_CONVOLUTION_FILTER_2D
:
494 _mesa_free(n
[7].data
);
495 n
+= InstSize
[n
[0].opcode
];
497 case OPCODE_POLYGON_STIPPLE
:
498 _mesa_free(n
[1].data
);
499 n
+= InstSize
[n
[0].opcode
];
501 case OPCODE_TEX_IMAGE1D
:
502 _mesa_free(n
[8].data
);
503 n
+= InstSize
[n
[0].opcode
];
505 case OPCODE_TEX_IMAGE2D
:
506 _mesa_free(n
[9].data
);
507 n
+= InstSize
[n
[0].opcode
];
509 case OPCODE_TEX_IMAGE3D
:
510 _mesa_free(n
[10].data
);
511 n
+= InstSize
[n
[0].opcode
];
513 case OPCODE_TEX_SUB_IMAGE1D
:
514 _mesa_free(n
[7].data
);
515 n
+= InstSize
[n
[0].opcode
];
517 case OPCODE_TEX_SUB_IMAGE2D
:
518 _mesa_free(n
[9].data
);
519 n
+= InstSize
[n
[0].opcode
];
521 case OPCODE_TEX_SUB_IMAGE3D
:
522 _mesa_free(n
[11].data
);
523 n
+= InstSize
[n
[0].opcode
];
525 case OPCODE_COMPRESSED_TEX_IMAGE_1D
:
526 _mesa_free(n
[7].data
);
527 n
+= InstSize
[n
[0].opcode
];
529 case OPCODE_COMPRESSED_TEX_IMAGE_2D
:
530 _mesa_free(n
[8].data
);
531 n
+= InstSize
[n
[0].opcode
];
533 case OPCODE_COMPRESSED_TEX_IMAGE_3D
:
534 _mesa_free(n
[9].data
);
535 n
+= InstSize
[n
[0].opcode
];
537 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
:
538 _mesa_free(n
[7].data
);
539 n
+= InstSize
[n
[0].opcode
];
541 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
:
542 _mesa_free(n
[9].data
);
543 n
+= InstSize
[n
[0].opcode
];
545 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
:
546 _mesa_free(n
[11].data
);
547 n
+= InstSize
[n
[0].opcode
];
549 #if FEATURE_NV_vertex_program
550 case OPCODE_LOAD_PROGRAM_NV
:
551 _mesa_free(n
[4].data
); /* program string */
552 n
+= InstSize
[n
[0].opcode
];
554 case OPCODE_REQUEST_RESIDENT_PROGRAMS_NV
:
555 _mesa_free(n
[2].data
); /* array of program ids */
556 n
+= InstSize
[n
[0].opcode
];
559 #if FEATURE_NV_fragment_program
560 case OPCODE_PROGRAM_NAMED_PARAMETER_NV
:
561 _mesa_free(n
[3].data
); /* parameter name */
562 n
+= InstSize
[n
[0].opcode
];
565 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
566 case OPCODE_PROGRAM_STRING_ARB
:
567 _mesa_free(n
[4].data
); /* program string */
568 n
+= InstSize
[n
[0].opcode
];
571 case OPCODE_CONTINUE
:
572 n
= (Node
*) n
[1].next
;
576 case OPCODE_END_OF_LIST
:
581 /* Most frequent case */
582 n
+= InstSize
[n
[0].opcode
];
593 * Destroy a display list and remove from hash table.
594 * \param list - display list number
597 destroy_list(GLcontext
*ctx
, GLuint list
)
599 struct mesa_display_list
*dlist
;
604 dlist
= lookup_list(ctx
, list
);
608 _mesa_delete_list(ctx
, dlist
);
609 _mesa_HashRemove(ctx
->Shared
->DisplayList
, list
);
614 * Translate the nth element of list from type to 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
));
2718 static void GLAPIENTRY
2719 save_PolygonStipple(const GLubyte
* pattern
)
2721 GET_CURRENT_CONTEXT(ctx
);
2722 GLvoid
*image
= unpack_image(2, 32, 32, 1, GL_COLOR_INDEX
, GL_BITMAP
,
2723 pattern
, &ctx
->Unpack
);
2725 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2726 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_POLYGON_STIPPLE
, 1);
2733 if (ctx
->ExecuteFlag
) {
2734 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) pattern
));
2739 static void GLAPIENTRY
2740 save_PolygonOffset(GLfloat factor
, GLfloat units
)
2742 GET_CURRENT_CONTEXT(ctx
);
2744 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2745 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_POLYGON_OFFSET
, 2);
2750 if (ctx
->ExecuteFlag
) {
2751 CALL_PolygonOffset(ctx
->Exec
, (factor
, units
));
2756 static void GLAPIENTRY
2757 save_PolygonOffsetEXT(GLfloat factor
, GLfloat bias
)
2759 GET_CURRENT_CONTEXT(ctx
);
2760 /* XXX mult by DepthMaxF here??? */
2761 save_PolygonOffset(factor
, ctx
->DrawBuffer
->_DepthMaxF
* bias
);
2765 static void GLAPIENTRY
2766 save_PopAttrib(void)
2768 GET_CURRENT_CONTEXT(ctx
);
2769 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2770 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_POP_ATTRIB
, 0);
2771 if (ctx
->ExecuteFlag
) {
2772 CALL_PopAttrib(ctx
->Exec
, ());
2777 static void GLAPIENTRY
2778 save_PopMatrix(void)
2780 GET_CURRENT_CONTEXT(ctx
);
2781 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2782 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_POP_MATRIX
, 0);
2783 if (ctx
->ExecuteFlag
) {
2784 CALL_PopMatrix(ctx
->Exec
, ());
2789 static void GLAPIENTRY
2792 GET_CURRENT_CONTEXT(ctx
);
2793 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2794 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_POP_NAME
, 0);
2795 if (ctx
->ExecuteFlag
) {
2796 CALL_PopName(ctx
->Exec
, ());
2801 static void GLAPIENTRY
2802 save_PrioritizeTextures(GLsizei num
, const GLuint
* textures
,
2803 const GLclampf
* priorities
)
2805 GET_CURRENT_CONTEXT(ctx
);
2807 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2809 for (i
= 0; i
< num
; i
++) {
2811 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PRIORITIZE_TEXTURE
, 2);
2813 n
[1].ui
= textures
[i
];
2814 n
[2].f
= priorities
[i
];
2817 if (ctx
->ExecuteFlag
) {
2818 CALL_PrioritizeTextures(ctx
->Exec
, (num
, textures
, priorities
));
2823 static void GLAPIENTRY
2824 save_PushAttrib(GLbitfield mask
)
2826 GET_CURRENT_CONTEXT(ctx
);
2828 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2829 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PUSH_ATTRIB
, 1);
2833 if (ctx
->ExecuteFlag
) {
2834 CALL_PushAttrib(ctx
->Exec
, (mask
));
2839 static void GLAPIENTRY
2840 save_PushMatrix(void)
2842 GET_CURRENT_CONTEXT(ctx
);
2843 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2844 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_PUSH_MATRIX
, 0);
2845 if (ctx
->ExecuteFlag
) {
2846 CALL_PushMatrix(ctx
->Exec
, ());
2851 static void GLAPIENTRY
2852 save_PushName(GLuint name
)
2854 GET_CURRENT_CONTEXT(ctx
);
2856 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2857 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PUSH_NAME
, 1);
2861 if (ctx
->ExecuteFlag
) {
2862 CALL_PushName(ctx
->Exec
, (name
));
2867 static void GLAPIENTRY
2868 save_RasterPos4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
2870 GET_CURRENT_CONTEXT(ctx
);
2872 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2873 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_RASTER_POS
, 4);
2880 if (ctx
->ExecuteFlag
) {
2881 CALL_RasterPos4f(ctx
->Exec
, (x
, y
, z
, w
));
2885 static void GLAPIENTRY
2886 save_RasterPos2d(GLdouble x
, GLdouble y
)
2888 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
2891 static void GLAPIENTRY
2892 save_RasterPos2f(GLfloat x
, GLfloat y
)
2894 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2897 static void GLAPIENTRY
2898 save_RasterPos2i(GLint x
, GLint y
)
2900 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
2903 static void GLAPIENTRY
2904 save_RasterPos2s(GLshort x
, GLshort y
)
2906 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2909 static void GLAPIENTRY
2910 save_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
2912 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
2915 static void GLAPIENTRY
2916 save_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
2918 save_RasterPos4f(x
, y
, z
, 1.0F
);
2921 static void GLAPIENTRY
2922 save_RasterPos3i(GLint x
, GLint y
, GLint z
)
2924 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
2927 static void GLAPIENTRY
2928 save_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
2930 save_RasterPos4f(x
, y
, z
, 1.0F
);
2933 static void GLAPIENTRY
2934 save_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
2936 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
2939 static void GLAPIENTRY
2940 save_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
2942 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
2945 static void GLAPIENTRY
2946 save_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
2948 save_RasterPos4f(x
, y
, z
, w
);
2951 static void GLAPIENTRY
2952 save_RasterPos2dv(const GLdouble
* v
)
2954 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
2957 static void GLAPIENTRY
2958 save_RasterPos2fv(const GLfloat
* v
)
2960 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2963 static void GLAPIENTRY
2964 save_RasterPos2iv(const GLint
* v
)
2966 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
2969 static void GLAPIENTRY
2970 save_RasterPos2sv(const GLshort
* v
)
2972 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2975 static void GLAPIENTRY
2976 save_RasterPos3dv(const GLdouble
* v
)
2978 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
2981 static void GLAPIENTRY
2982 save_RasterPos3fv(const GLfloat
* v
)
2984 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2987 static void GLAPIENTRY
2988 save_RasterPos3iv(const GLint
* v
)
2990 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
2993 static void GLAPIENTRY
2994 save_RasterPos3sv(const GLshort
* v
)
2996 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2999 static void GLAPIENTRY
3000 save_RasterPos4dv(const GLdouble
* v
)
3002 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3003 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3006 static void GLAPIENTRY
3007 save_RasterPos4fv(const GLfloat
* v
)
3009 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3012 static void GLAPIENTRY
3013 save_RasterPos4iv(const GLint
* v
)
3015 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3016 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3019 static void GLAPIENTRY
3020 save_RasterPos4sv(const GLshort
* v
)
3022 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3026 static void GLAPIENTRY
3027 save_PassThrough(GLfloat token
)
3029 GET_CURRENT_CONTEXT(ctx
);
3031 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3032 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PASSTHROUGH
, 1);
3036 if (ctx
->ExecuteFlag
) {
3037 CALL_PassThrough(ctx
->Exec
, (token
));
3042 static void GLAPIENTRY
3043 save_ReadBuffer(GLenum mode
)
3045 GET_CURRENT_CONTEXT(ctx
);
3047 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3048 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_READ_BUFFER
, 1);
3052 if (ctx
->ExecuteFlag
) {
3053 CALL_ReadBuffer(ctx
->Exec
, (mode
));
3058 static void GLAPIENTRY
3059 save_ResetHistogram(GLenum target
)
3061 GET_CURRENT_CONTEXT(ctx
);
3063 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3064 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_RESET_HISTOGRAM
, 1);
3068 if (ctx
->ExecuteFlag
) {
3069 CALL_ResetHistogram(ctx
->Exec
, (target
));
3074 static void GLAPIENTRY
3075 save_ResetMinmax(GLenum target
)
3077 GET_CURRENT_CONTEXT(ctx
);
3079 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3080 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_RESET_MIN_MAX
, 1);
3084 if (ctx
->ExecuteFlag
) {
3085 CALL_ResetMinmax(ctx
->Exec
, (target
));
3090 static void GLAPIENTRY
3091 save_Rotatef(GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
3093 GET_CURRENT_CONTEXT(ctx
);
3095 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3096 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ROTATE
, 4);
3103 if (ctx
->ExecuteFlag
) {
3104 CALL_Rotatef(ctx
->Exec
, (angle
, x
, y
, z
));
3109 static void GLAPIENTRY
3110 save_Rotated(GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
3112 save_Rotatef((GLfloat
) angle
, (GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3116 static void GLAPIENTRY
3117 save_Scalef(GLfloat x
, GLfloat y
, GLfloat z
)
3119 GET_CURRENT_CONTEXT(ctx
);
3121 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3122 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SCALE
, 3);
3128 if (ctx
->ExecuteFlag
) {
3129 CALL_Scalef(ctx
->Exec
, (x
, y
, z
));
3134 static void GLAPIENTRY
3135 save_Scaled(GLdouble x
, GLdouble y
, GLdouble z
)
3137 save_Scalef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3141 static void GLAPIENTRY
3142 save_Scissor(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3144 GET_CURRENT_CONTEXT(ctx
);
3146 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3147 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SCISSOR
, 4);
3154 if (ctx
->ExecuteFlag
) {
3155 CALL_Scissor(ctx
->Exec
, (x
, y
, width
, height
));
3160 static void GLAPIENTRY
3161 save_ShadeModel(GLenum mode
)
3163 GET_CURRENT_CONTEXT(ctx
);
3165 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3166 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SHADE_MODEL
, 1);
3170 if (ctx
->ExecuteFlag
) {
3171 CALL_ShadeModel(ctx
->Exec
, (mode
));
3176 static void GLAPIENTRY
3177 save_StencilFunc(GLenum func
, GLint ref
, GLuint mask
)
3179 GET_CURRENT_CONTEXT(ctx
);
3181 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3182 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_FUNC
, 3);
3188 if (ctx
->ExecuteFlag
) {
3189 CALL_StencilFunc(ctx
->Exec
, (func
, ref
, mask
));
3194 static void GLAPIENTRY
3195 save_StencilMask(GLuint mask
)
3197 GET_CURRENT_CONTEXT(ctx
);
3199 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3200 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_MASK
, 1);
3204 if (ctx
->ExecuteFlag
) {
3205 CALL_StencilMask(ctx
->Exec
, (mask
));
3210 static void GLAPIENTRY
3211 save_StencilOp(GLenum fail
, GLenum zfail
, GLenum zpass
)
3213 GET_CURRENT_CONTEXT(ctx
);
3215 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3216 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_OP
, 3);
3222 if (ctx
->ExecuteFlag
) {
3223 CALL_StencilOp(ctx
->Exec
, (fail
, zfail
, zpass
));
3228 static void GLAPIENTRY
3229 save_StencilFuncSeparate(GLenum face
, GLenum func
, GLint ref
, GLuint mask
)
3231 GET_CURRENT_CONTEXT(ctx
);
3233 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3234 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3241 if (ctx
->ExecuteFlag
) {
3242 CALL_StencilFuncSeparate(ctx
->Exec
, (face
, func
, ref
, mask
));
3247 static void GLAPIENTRY
3248 save_StencilMaskSeparate(GLenum face
, GLuint mask
)
3250 GET_CURRENT_CONTEXT(ctx
);
3252 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3253 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_MASK_SEPARATE
, 2);
3258 if (ctx
->ExecuteFlag
) {
3259 CALL_StencilMaskSeparate(ctx
->Exec
, (face
, mask
));
3264 static void GLAPIENTRY
3265 save_StencilOpSeparate(GLenum face
, GLenum fail
, GLenum zfail
, GLenum zpass
)
3267 GET_CURRENT_CONTEXT(ctx
);
3269 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3270 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_OP_SEPARATE
, 4);
3277 if (ctx
->ExecuteFlag
) {
3278 CALL_StencilOpSeparate(ctx
->Exec
, (face
, fail
, zfail
, zpass
));
3283 static void GLAPIENTRY
3284 save_TexEnvfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3286 GET_CURRENT_CONTEXT(ctx
);
3288 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3289 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEXENV
, 6);
3293 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3301 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
3304 if (ctx
->ExecuteFlag
) {
3305 CALL_TexEnvfv(ctx
->Exec
, (target
, pname
, params
));
3310 static void GLAPIENTRY
3311 save_TexEnvf(GLenum target
, GLenum pname
, GLfloat param
)
3313 save_TexEnvfv(target
, pname
, ¶m
);
3317 static void GLAPIENTRY
3318 save_TexEnvi(GLenum target
, GLenum pname
, GLint param
)
3321 p
[0] = (GLfloat
) param
;
3322 p
[1] = p
[2] = p
[3] = 0.0;
3323 save_TexEnvfv(target
, pname
, p
);
3327 static void GLAPIENTRY
3328 save_TexEnviv(GLenum target
, GLenum pname
, const GLint
* param
)
3331 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3332 p
[0] = INT_TO_FLOAT(param
[0]);
3333 p
[1] = INT_TO_FLOAT(param
[1]);
3334 p
[2] = INT_TO_FLOAT(param
[2]);
3335 p
[3] = INT_TO_FLOAT(param
[3]);
3338 p
[0] = (GLfloat
) param
[0];
3339 p
[1] = p
[2] = p
[3] = 0.0F
;
3341 save_TexEnvfv(target
, pname
, p
);
3345 static void GLAPIENTRY
3346 save_TexGenfv(GLenum coord
, GLenum pname
, const GLfloat
*params
)
3348 GET_CURRENT_CONTEXT(ctx
);
3350 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3351 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEXGEN
, 6);
3360 if (ctx
->ExecuteFlag
) {
3361 CALL_TexGenfv(ctx
->Exec
, (coord
, pname
, params
));
3366 static void GLAPIENTRY
3367 save_TexGeniv(GLenum coord
, GLenum pname
, const GLint
*params
)
3370 p
[0] = (GLfloat
) params
[0];
3371 p
[1] = (GLfloat
) params
[1];
3372 p
[2] = (GLfloat
) params
[2];
3373 p
[3] = (GLfloat
) params
[3];
3374 save_TexGenfv(coord
, pname
, p
);
3378 static void GLAPIENTRY
3379 save_TexGend(GLenum coord
, GLenum pname
, GLdouble param
)
3381 GLfloat p
= (GLfloat
) param
;
3382 save_TexGenfv(coord
, pname
, &p
);
3386 static void GLAPIENTRY
3387 save_TexGendv(GLenum coord
, GLenum pname
, const GLdouble
*params
)
3390 p
[0] = (GLfloat
) params
[0];
3391 p
[1] = (GLfloat
) params
[1];
3392 p
[2] = (GLfloat
) params
[2];
3393 p
[3] = (GLfloat
) params
[3];
3394 save_TexGenfv(coord
, pname
, p
);
3398 static void GLAPIENTRY
3399 save_TexGenf(GLenum coord
, GLenum pname
, GLfloat param
)
3401 save_TexGenfv(coord
, pname
, ¶m
);
3405 static void GLAPIENTRY
3406 save_TexGeni(GLenum coord
, GLenum pname
, GLint param
)
3408 save_TexGeniv(coord
, pname
, ¶m
);
3412 static void GLAPIENTRY
3413 save_TexParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3415 GET_CURRENT_CONTEXT(ctx
);
3417 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3418 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEXPARAMETER
, 6);
3427 if (ctx
->ExecuteFlag
) {
3428 CALL_TexParameterfv(ctx
->Exec
, (target
, pname
, params
));
3433 static void GLAPIENTRY
3434 save_TexParameterf(GLenum target
, GLenum pname
, GLfloat param
)
3436 save_TexParameterfv(target
, pname
, ¶m
);
3440 static void GLAPIENTRY
3441 save_TexParameteri(GLenum target
, GLenum pname
, GLint param
)
3444 fparam
[0] = (GLfloat
) param
;
3445 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
3446 save_TexParameterfv(target
, pname
, fparam
);
3450 static void GLAPIENTRY
3451 save_TexParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
3454 fparam
[0] = (GLfloat
) params
[0];
3455 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
3456 save_TexParameterfv(target
, pname
, fparam
);
3460 static void GLAPIENTRY
3461 save_TexImage1D(GLenum target
,
3462 GLint level
, GLint components
,
3463 GLsizei width
, GLint border
,
3464 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3466 GET_CURRENT_CONTEXT(ctx
);
3467 if (target
== GL_PROXY_TEXTURE_1D
) {
3468 /* don't compile, execute immediately */
3469 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
3470 border
, format
, type
, pixels
));
3473 GLvoid
*image
= unpack_image(1, width
, 1, 1, format
, type
,
3474 pixels
, &ctx
->Unpack
);
3476 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3477 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_IMAGE1D
, 8);
3481 n
[3].i
= components
;
3482 n
[4].i
= (GLint
) width
;
3491 if (ctx
->ExecuteFlag
) {
3492 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
3493 border
, format
, type
, pixels
));
3499 static void GLAPIENTRY
3500 save_TexImage2D(GLenum target
,
3501 GLint level
, GLint components
,
3502 GLsizei width
, GLsizei height
, GLint border
,
3503 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3505 GET_CURRENT_CONTEXT(ctx
);
3506 if (target
== GL_PROXY_TEXTURE_2D
) {
3507 /* don't compile, execute immediately */
3508 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
3509 height
, border
, format
, type
, pixels
));
3512 GLvoid
*image
= unpack_image(2, width
, height
, 1, format
, type
,
3513 pixels
, &ctx
->Unpack
);
3515 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3516 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_IMAGE2D
, 9);
3520 n
[3].i
= components
;
3521 n
[4].i
= (GLint
) width
;
3522 n
[5].i
= (GLint
) height
;
3531 if (ctx
->ExecuteFlag
) {
3532 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
3533 height
, border
, format
, type
, pixels
));
3539 static void GLAPIENTRY
3540 save_TexImage3D(GLenum target
,
3541 GLint level
, GLint internalFormat
,
3542 GLsizei width
, GLsizei height
, GLsizei depth
,
3544 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3546 GET_CURRENT_CONTEXT(ctx
);
3547 if (target
== GL_PROXY_TEXTURE_3D
) {
3548 /* don't compile, execute immediately */
3549 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
3550 height
, depth
, border
, format
, type
,
3555 GLvoid
*image
= unpack_image(3, width
, height
, depth
, format
, type
,
3556 pixels
, &ctx
->Unpack
);
3557 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3558 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_IMAGE3D
, 10);
3562 n
[3].i
= (GLint
) internalFormat
;
3563 n
[4].i
= (GLint
) width
;
3564 n
[5].i
= (GLint
) height
;
3565 n
[6].i
= (GLint
) depth
;
3574 if (ctx
->ExecuteFlag
) {
3575 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
3576 height
, depth
, border
, format
, type
,
3583 static void GLAPIENTRY
3584 save_TexSubImage1D(GLenum target
, GLint level
, GLint xoffset
,
3585 GLsizei width
, GLenum format
, GLenum type
,
3586 const GLvoid
* pixels
)
3588 GET_CURRENT_CONTEXT(ctx
);
3590 GLvoid
*image
= unpack_image(1, width
, 1, 1, format
, type
,
3591 pixels
, &ctx
->Unpack
);
3592 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3593 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_SUB_IMAGE1D
, 7);
3598 n
[4].i
= (GLint
) width
;
3606 if (ctx
->ExecuteFlag
) {
3607 CALL_TexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
, width
,
3608 format
, type
, pixels
));
3613 static void GLAPIENTRY
3614 save_TexSubImage2D(GLenum target
, GLint level
,
3615 GLint xoffset
, GLint yoffset
,
3616 GLsizei width
, GLsizei height
,
3617 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3619 GET_CURRENT_CONTEXT(ctx
);
3621 GLvoid
*image
= unpack_image(2, width
, height
, 1, format
, type
,
3622 pixels
, &ctx
->Unpack
);
3623 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3624 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_SUB_IMAGE2D
, 9);
3630 n
[5].i
= (GLint
) width
;
3631 n
[6].i
= (GLint
) height
;
3639 if (ctx
->ExecuteFlag
) {
3640 CALL_TexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
3641 width
, height
, format
, type
, pixels
));
3646 static void GLAPIENTRY
3647 save_TexSubImage3D(GLenum target
, GLint level
,
3648 GLint xoffset
, GLint yoffset
, GLint zoffset
,
3649 GLsizei width
, GLsizei height
, GLsizei depth
,
3650 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3652 GET_CURRENT_CONTEXT(ctx
);
3654 GLvoid
*image
= unpack_image(3, width
, height
, depth
, format
, type
,
3655 pixels
, &ctx
->Unpack
);
3656 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3657 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_SUB_IMAGE3D
, 11);
3664 n
[6].i
= (GLint
) width
;
3665 n
[7].i
= (GLint
) height
;
3666 n
[8].i
= (GLint
) depth
;
3674 if (ctx
->ExecuteFlag
) {
3675 CALL_TexSubImage3D(ctx
->Exec
, (target
, level
,
3676 xoffset
, yoffset
, zoffset
,
3677 width
, height
, depth
, format
, type
,
3683 static void GLAPIENTRY
3684 save_Translatef(GLfloat x
, GLfloat y
, GLfloat z
)
3686 GET_CURRENT_CONTEXT(ctx
);
3688 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3689 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TRANSLATE
, 3);
3695 if (ctx
->ExecuteFlag
) {
3696 CALL_Translatef(ctx
->Exec
, (x
, y
, z
));
3701 static void GLAPIENTRY
3702 save_Translated(GLdouble x
, GLdouble y
, GLdouble z
)
3704 save_Translatef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3709 static void GLAPIENTRY
3710 save_Viewport(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3712 GET_CURRENT_CONTEXT(ctx
);
3714 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3715 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_VIEWPORT
, 4);
3719 n
[3].i
= (GLint
) width
;
3720 n
[4].i
= (GLint
) height
;
3722 if (ctx
->ExecuteFlag
) {
3723 CALL_Viewport(ctx
->Exec
, (x
, y
, width
, height
));
3728 static void GLAPIENTRY
3729 save_WindowPos4fMESA(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3731 GET_CURRENT_CONTEXT(ctx
);
3733 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3734 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_WINDOW_POS
, 4);
3741 if (ctx
->ExecuteFlag
) {
3742 CALL_WindowPos4fMESA(ctx
->Exec
, (x
, y
, z
, w
));
3746 static void GLAPIENTRY
3747 save_WindowPos2dMESA(GLdouble x
, GLdouble y
)
3749 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3752 static void GLAPIENTRY
3753 save_WindowPos2fMESA(GLfloat x
, GLfloat y
)
3755 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3758 static void GLAPIENTRY
3759 save_WindowPos2iMESA(GLint x
, GLint y
)
3761 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3764 static void GLAPIENTRY
3765 save_WindowPos2sMESA(GLshort x
, GLshort y
)
3767 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3770 static void GLAPIENTRY
3771 save_WindowPos3dMESA(GLdouble x
, GLdouble y
, GLdouble z
)
3773 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3776 static void GLAPIENTRY
3777 save_WindowPos3fMESA(GLfloat x
, GLfloat y
, GLfloat z
)
3779 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3782 static void GLAPIENTRY
3783 save_WindowPos3iMESA(GLint x
, GLint y
, GLint z
)
3785 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3788 static void GLAPIENTRY
3789 save_WindowPos3sMESA(GLshort x
, GLshort y
, GLshort z
)
3791 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3794 static void GLAPIENTRY
3795 save_WindowPos4dMESA(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3797 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3800 static void GLAPIENTRY
3801 save_WindowPos4iMESA(GLint x
, GLint y
, GLint z
, GLint w
)
3803 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3806 static void GLAPIENTRY
3807 save_WindowPos4sMESA(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
3809 save_WindowPos4fMESA(x
, y
, z
, w
);
3812 static void GLAPIENTRY
3813 save_WindowPos2dvMESA(const GLdouble
* v
)
3815 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3818 static void GLAPIENTRY
3819 save_WindowPos2fvMESA(const GLfloat
* v
)
3821 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3824 static void GLAPIENTRY
3825 save_WindowPos2ivMESA(const GLint
* v
)
3827 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3830 static void GLAPIENTRY
3831 save_WindowPos2svMESA(const GLshort
* v
)
3833 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3836 static void GLAPIENTRY
3837 save_WindowPos3dvMESA(const GLdouble
* v
)
3839 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3842 static void GLAPIENTRY
3843 save_WindowPos3fvMESA(const GLfloat
* v
)
3845 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3848 static void GLAPIENTRY
3849 save_WindowPos3ivMESA(const GLint
* v
)
3851 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3854 static void GLAPIENTRY
3855 save_WindowPos3svMESA(const GLshort
* v
)
3857 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3860 static void GLAPIENTRY
3861 save_WindowPos4dvMESA(const GLdouble
* v
)
3863 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
3864 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3867 static void GLAPIENTRY
3868 save_WindowPos4fvMESA(const GLfloat
* v
)
3870 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3873 static void GLAPIENTRY
3874 save_WindowPos4ivMESA(const GLint
* v
)
3876 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
3877 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3880 static void GLAPIENTRY
3881 save_WindowPos4svMESA(const GLshort
* v
)
3883 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3888 /* GL_ARB_multitexture */
3889 static void GLAPIENTRY
3890 save_ActiveTextureARB(GLenum target
)
3892 GET_CURRENT_CONTEXT(ctx
);
3894 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3895 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ACTIVE_TEXTURE
, 1);
3899 if (ctx
->ExecuteFlag
) {
3900 CALL_ActiveTextureARB(ctx
->Exec
, (target
));
3905 /* GL_ARB_transpose_matrix */
3907 static void GLAPIENTRY
3908 save_LoadTransposeMatrixdARB(const GLdouble m
[16])
3911 _math_transposefd(tm
, m
);
3912 save_LoadMatrixf(tm
);
3916 static void GLAPIENTRY
3917 save_LoadTransposeMatrixfARB(const GLfloat m
[16])
3920 _math_transposef(tm
, m
);
3921 save_LoadMatrixf(tm
);
3925 static void GLAPIENTRY
3926 save_MultTransposeMatrixdARB(const GLdouble m
[16])
3929 _math_transposefd(tm
, m
);
3930 save_MultMatrixf(tm
);
3934 static void GLAPIENTRY
3935 save_MultTransposeMatrixfARB(const GLfloat m
[16])
3938 _math_transposef(tm
, m
);
3939 save_MultMatrixf(tm
);
3943 /* GL_ARB_texture_compression */
3944 static void GLAPIENTRY
3945 save_CompressedTexImage1DARB(GLenum target
, GLint level
,
3946 GLenum internalFormat
, GLsizei width
,
3947 GLint border
, GLsizei imageSize
,
3948 const GLvoid
* data
)
3950 GET_CURRENT_CONTEXT(ctx
);
3951 if (target
== GL_PROXY_TEXTURE_1D
) {
3952 /* don't compile, execute immediately */
3953 CALL_CompressedTexImage1DARB(ctx
->Exec
, (target
, level
, internalFormat
,
3954 width
, border
, imageSize
,
3960 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3961 /* make copy of image */
3962 image
= _mesa_malloc(imageSize
);
3964 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage1DARB");
3967 MEMCPY(image
, data
, imageSize
);
3968 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_1D
, 7);
3972 n
[3].e
= internalFormat
;
3973 n
[4].i
= (GLint
) width
;
3981 if (ctx
->ExecuteFlag
) {
3982 CALL_CompressedTexImage1DARB(ctx
->Exec
,
3983 (target
, level
, internalFormat
, width
,
3984 border
, imageSize
, data
));
3990 static void GLAPIENTRY
3991 save_CompressedTexImage2DARB(GLenum target
, GLint level
,
3992 GLenum internalFormat
, GLsizei width
,
3993 GLsizei height
, GLint border
, GLsizei imageSize
,
3994 const GLvoid
* data
)
3996 GET_CURRENT_CONTEXT(ctx
);
3997 if (target
== GL_PROXY_TEXTURE_2D
) {
3998 /* don't compile, execute immediately */
3999 CALL_CompressedTexImage2DARB(ctx
->Exec
, (target
, level
, internalFormat
,
4000 width
, height
, border
,
4006 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4007 /* make copy of image */
4008 image
= _mesa_malloc(imageSize
);
4010 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage2DARB");
4013 MEMCPY(image
, data
, imageSize
);
4014 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_2D
, 8);
4018 n
[3].e
= internalFormat
;
4019 n
[4].i
= (GLint
) width
;
4020 n
[5].i
= (GLint
) height
;
4028 if (ctx
->ExecuteFlag
) {
4029 CALL_CompressedTexImage2DARB(ctx
->Exec
,
4030 (target
, level
, internalFormat
, width
,
4031 height
, border
, imageSize
, data
));
4037 static void GLAPIENTRY
4038 save_CompressedTexImage3DARB(GLenum target
, GLint level
,
4039 GLenum internalFormat
, GLsizei width
,
4040 GLsizei height
, GLsizei depth
, GLint border
,
4041 GLsizei imageSize
, const GLvoid
* data
)
4043 GET_CURRENT_CONTEXT(ctx
);
4044 if (target
== GL_PROXY_TEXTURE_3D
) {
4045 /* don't compile, execute immediately */
4046 CALL_CompressedTexImage3DARB(ctx
->Exec
, (target
, level
, internalFormat
,
4047 width
, height
, depth
, border
,
4053 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4054 /* make copy of image */
4055 image
= _mesa_malloc(imageSize
);
4057 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage3DARB");
4060 MEMCPY(image
, data
, imageSize
);
4061 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_3D
, 9);
4065 n
[3].e
= internalFormat
;
4066 n
[4].i
= (GLint
) width
;
4067 n
[5].i
= (GLint
) height
;
4068 n
[6].i
= (GLint
) depth
;
4076 if (ctx
->ExecuteFlag
) {
4077 CALL_CompressedTexImage3DARB(ctx
->Exec
,
4078 (target
, level
, internalFormat
, width
,
4079 height
, depth
, border
, imageSize
,
4086 static void GLAPIENTRY
4087 save_CompressedTexSubImage1DARB(GLenum target
, GLint level
, GLint xoffset
,
4088 GLsizei width
, GLenum format
,
4089 GLsizei imageSize
, const GLvoid
* data
)
4094 GET_CURRENT_CONTEXT(ctx
);
4095 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4097 /* make copy of image */
4098 image
= _mesa_malloc(imageSize
);
4100 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage1DARB");
4103 MEMCPY(image
, data
, imageSize
);
4104 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
, 7);
4109 n
[4].i
= (GLint
) width
;
4117 if (ctx
->ExecuteFlag
) {
4118 CALL_CompressedTexSubImage1DARB(ctx
->Exec
, (target
, level
, xoffset
,
4119 width
, format
, imageSize
,
4125 static void GLAPIENTRY
4126 save_CompressedTexSubImage2DARB(GLenum target
, GLint level
, GLint xoffset
,
4127 GLint yoffset
, GLsizei width
, GLsizei height
,
4128 GLenum format
, GLsizei imageSize
,
4129 const GLvoid
* data
)
4134 GET_CURRENT_CONTEXT(ctx
);
4135 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4137 /* make copy of image */
4138 image
= _mesa_malloc(imageSize
);
4140 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage2DARB");
4143 MEMCPY(image
, data
, imageSize
);
4144 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
, 9);
4150 n
[5].i
= (GLint
) width
;
4151 n
[6].i
= (GLint
) height
;
4159 if (ctx
->ExecuteFlag
) {
4160 CALL_CompressedTexSubImage2DARB(ctx
->Exec
,
4161 (target
, level
, xoffset
, yoffset
, width
,
4162 height
, format
, imageSize
, data
));
4167 static void GLAPIENTRY
4168 save_CompressedTexSubImage3DARB(GLenum target
, GLint level
, GLint xoffset
,
4169 GLint yoffset
, GLint zoffset
, GLsizei width
,
4170 GLsizei height
, GLsizei depth
, GLenum format
,
4171 GLsizei imageSize
, const GLvoid
* data
)
4176 GET_CURRENT_CONTEXT(ctx
);
4177 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4179 /* make copy of image */
4180 image
= _mesa_malloc(imageSize
);
4182 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage3DARB");
4185 MEMCPY(image
, data
, imageSize
);
4186 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
, 11);
4193 n
[6].i
= (GLint
) width
;
4194 n
[7].i
= (GLint
) height
;
4195 n
[8].i
= (GLint
) depth
;
4197 n
[10].i
= imageSize
;
4203 if (ctx
->ExecuteFlag
) {
4204 CALL_CompressedTexSubImage3DARB(ctx
->Exec
,
4205 (target
, level
, xoffset
, yoffset
,
4206 zoffset
, width
, height
, depth
, format
,
4212 /* GL_ARB_multisample */
4213 static void GLAPIENTRY
4214 save_SampleCoverageARB(GLclampf value
, GLboolean invert
)
4216 GET_CURRENT_CONTEXT(ctx
);
4218 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4219 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SAMPLE_COVERAGE
, 2);
4224 if (ctx
->ExecuteFlag
) {
4225 CALL_SampleCoverageARB(ctx
->Exec
, (value
, invert
));
4231 * GL_NV_vertex_program
4233 #if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
4234 static void GLAPIENTRY
4235 save_BindProgramNV(GLenum target
, GLuint id
)
4237 GET_CURRENT_CONTEXT(ctx
);
4239 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4240 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BIND_PROGRAM_NV
, 2);
4245 if (ctx
->ExecuteFlag
) {
4246 CALL_BindProgramNV(ctx
->Exec
, (target
, id
));
4250 static void GLAPIENTRY
4251 save_ProgramEnvParameter4fARB(GLenum target
, GLuint index
,
4252 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4254 GET_CURRENT_CONTEXT(ctx
);
4256 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4257 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4266 if (ctx
->ExecuteFlag
) {
4267 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4272 static void GLAPIENTRY
4273 save_ProgramEnvParameter4fvARB(GLenum target
, GLuint index
,
4274 const GLfloat
*params
)
4276 save_ProgramEnvParameter4fARB(target
, index
, params
[0], params
[1],
4277 params
[2], params
[3]);
4281 static void GLAPIENTRY
4282 save_ProgramEnvParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4283 const GLfloat
* params
)
4285 GET_CURRENT_CONTEXT(ctx
);
4287 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4291 const GLfloat
* p
= params
;
4293 for (i
= 0 ; i
< count
; i
++) {
4294 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4307 if (ctx
->ExecuteFlag
) {
4308 CALL_ProgramEnvParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4313 static void GLAPIENTRY
4314 save_ProgramEnvParameter4dARB(GLenum target
, GLuint index
,
4315 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4317 save_ProgramEnvParameter4fARB(target
, index
,
4319 (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4323 static void GLAPIENTRY
4324 save_ProgramEnvParameter4dvARB(GLenum target
, GLuint index
,
4325 const GLdouble
*params
)
4327 save_ProgramEnvParameter4fARB(target
, index
,
4328 (GLfloat
) params
[0],
4329 (GLfloat
) params
[1],
4330 (GLfloat
) params
[2], (GLfloat
) params
[3]);
4333 #endif /* FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program || FEATURE_NV_vertex_program */
4335 #if FEATURE_NV_vertex_program
4336 static void GLAPIENTRY
4337 save_ExecuteProgramNV(GLenum target
, GLuint id
, const GLfloat
*params
)
4339 GET_CURRENT_CONTEXT(ctx
);
4341 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4342 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EXECUTE_PROGRAM_NV
, 6);
4351 if (ctx
->ExecuteFlag
) {
4352 CALL_ExecuteProgramNV(ctx
->Exec
, (target
, id
, params
));
4357 static void GLAPIENTRY
4358 save_ProgramParameters4dvNV(GLenum target
, GLuint index
,
4359 GLuint num
, const GLdouble
*params
)
4362 for (i
= 0; i
< num
; i
++) {
4363 save_ProgramEnvParameter4dvARB(target
, index
+ i
, params
+ 4 * i
);
4368 static void GLAPIENTRY
4369 save_ProgramParameters4fvNV(GLenum target
, GLuint index
,
4370 GLuint num
, const GLfloat
*params
)
4373 for (i
= 0; i
< num
; i
++) {
4374 save_ProgramEnvParameter4fvARB(target
, index
+ i
, params
+ 4 * i
);
4379 static void GLAPIENTRY
4380 save_LoadProgramNV(GLenum target
, GLuint id
, GLsizei len
,
4381 const GLubyte
* program
)
4383 GET_CURRENT_CONTEXT(ctx
);
4385 GLubyte
*programCopy
;
4387 programCopy
= (GLubyte
*) _mesa_malloc(len
);
4389 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glLoadProgramNV");
4392 _mesa_memcpy(programCopy
, program
, len
);
4394 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4395 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LOAD_PROGRAM_NV
, 4);
4400 n
[4].data
= programCopy
;
4402 if (ctx
->ExecuteFlag
) {
4403 CALL_LoadProgramNV(ctx
->Exec
, (target
, id
, len
, program
));
4408 static void GLAPIENTRY
4409 save_RequestResidentProgramsNV(GLsizei num
, const GLuint
* ids
)
4411 GET_CURRENT_CONTEXT(ctx
);
4413 GLuint
*idCopy
= (GLuint
*) _mesa_malloc(num
* sizeof(GLuint
));
4415 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glRequestResidentProgramsNV");
4418 _mesa_memcpy(idCopy
, ids
, num
* sizeof(GLuint
));
4419 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4420 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TRACK_MATRIX_NV
, 2);
4425 if (ctx
->ExecuteFlag
) {
4426 CALL_RequestResidentProgramsNV(ctx
->Exec
, (num
, ids
));
4431 static void GLAPIENTRY
4432 save_TrackMatrixNV(GLenum target
, GLuint address
,
4433 GLenum matrix
, GLenum transform
)
4435 GET_CURRENT_CONTEXT(ctx
);
4437 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4438 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TRACK_MATRIX_NV
, 4);
4445 if (ctx
->ExecuteFlag
) {
4446 CALL_TrackMatrixNV(ctx
->Exec
, (target
, address
, matrix
, transform
));
4449 #endif /* FEATURE_NV_vertex_program */
4453 * GL_NV_fragment_program
4455 #if FEATURE_NV_fragment_program
4456 static void GLAPIENTRY
4457 save_ProgramLocalParameter4fARB(GLenum target
, GLuint index
,
4458 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4460 GET_CURRENT_CONTEXT(ctx
);
4462 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4463 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4472 if (ctx
->ExecuteFlag
) {
4473 CALL_ProgramLocalParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4478 static void GLAPIENTRY
4479 save_ProgramLocalParameter4fvARB(GLenum target
, GLuint index
,
4480 const GLfloat
*params
)
4482 GET_CURRENT_CONTEXT(ctx
);
4484 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4485 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4494 if (ctx
->ExecuteFlag
) {
4495 CALL_ProgramLocalParameter4fvARB(ctx
->Exec
, (target
, index
, params
));
4500 static void GLAPIENTRY
4501 save_ProgramLocalParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4502 const GLfloat
*params
)
4504 GET_CURRENT_CONTEXT(ctx
);
4506 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4510 const GLfloat
* p
= params
;
4512 for (i
= 0 ; i
< count
; i
++) {
4513 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4526 if (ctx
->ExecuteFlag
) {
4527 CALL_ProgramLocalParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4532 static void GLAPIENTRY
4533 save_ProgramLocalParameter4dARB(GLenum target
, GLuint index
,
4534 GLdouble x
, GLdouble y
,
4535 GLdouble z
, GLdouble w
)
4537 GET_CURRENT_CONTEXT(ctx
);
4539 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4540 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4544 n
[3].f
= (GLfloat
) x
;
4545 n
[4].f
= (GLfloat
) y
;
4546 n
[5].f
= (GLfloat
) z
;
4547 n
[6].f
= (GLfloat
) w
;
4549 if (ctx
->ExecuteFlag
) {
4550 CALL_ProgramLocalParameter4dARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4555 static void GLAPIENTRY
4556 save_ProgramLocalParameter4dvARB(GLenum target
, GLuint index
,
4557 const GLdouble
*params
)
4559 GET_CURRENT_CONTEXT(ctx
);
4561 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4562 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4566 n
[3].f
= (GLfloat
) params
[0];
4567 n
[4].f
= (GLfloat
) params
[1];
4568 n
[5].f
= (GLfloat
) params
[2];
4569 n
[6].f
= (GLfloat
) params
[3];
4571 if (ctx
->ExecuteFlag
) {
4572 CALL_ProgramLocalParameter4dvARB(ctx
->Exec
, (target
, index
, params
));
4576 static void GLAPIENTRY
4577 save_ProgramNamedParameter4fNV(GLuint id
, GLsizei len
, const GLubyte
* name
,
4578 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4580 GET_CURRENT_CONTEXT(ctx
);
4582 GLubyte
*nameCopy
= (GLubyte
*) _mesa_malloc(len
);
4584 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramNamedParameter4fNV");
4587 _mesa_memcpy(nameCopy
, name
, len
);
4589 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4590 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_NAMED_PARAMETER_NV
, 6);
4594 n
[3].data
= nameCopy
;
4600 if (ctx
->ExecuteFlag
) {
4601 CALL_ProgramNamedParameter4fNV(ctx
->Exec
, (id
, len
, name
, x
, y
, z
, w
));
4606 static void GLAPIENTRY
4607 save_ProgramNamedParameter4fvNV(GLuint id
, GLsizei len
, const GLubyte
* name
,
4610 save_ProgramNamedParameter4fNV(id
, len
, name
, v
[0], v
[1], v
[2], v
[3]);
4614 static void GLAPIENTRY
4615 save_ProgramNamedParameter4dNV(GLuint id
, GLsizei len
, const GLubyte
* name
,
4616 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4618 save_ProgramNamedParameter4fNV(id
, len
, name
, (GLfloat
) x
, (GLfloat
) y
,
4619 (GLfloat
) z
, (GLfloat
) w
);
4623 static void GLAPIENTRY
4624 save_ProgramNamedParameter4dvNV(GLuint id
, GLsizei len
, const GLubyte
* name
,
4627 save_ProgramNamedParameter4fNV(id
, len
, name
, (GLfloat
) v
[0],
4628 (GLfloat
) v
[1], (GLfloat
) v
[2],
4632 #endif /* FEATURE_NV_fragment_program */
4636 /* GL_EXT_stencil_two_side */
4637 static void GLAPIENTRY
4638 save_ActiveStencilFaceEXT(GLenum face
)
4640 GET_CURRENT_CONTEXT(ctx
);
4642 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4643 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ACTIVE_STENCIL_FACE_EXT
, 1);
4647 if (ctx
->ExecuteFlag
) {
4648 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (face
));
4653 /* GL_EXT_depth_bounds_test */
4654 static void GLAPIENTRY
4655 save_DepthBoundsEXT(GLclampd zmin
, GLclampd zmax
)
4657 GET_CURRENT_CONTEXT(ctx
);
4659 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4660 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DEPTH_BOUNDS_EXT
, 2);
4662 n
[1].f
= (GLfloat
) zmin
;
4663 n
[2].f
= (GLfloat
) zmax
;
4665 if (ctx
->ExecuteFlag
) {
4666 CALL_DepthBoundsEXT(ctx
->Exec
, (zmin
, zmax
));
4672 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
4674 static void GLAPIENTRY
4675 save_ProgramStringARB(GLenum target
, GLenum format
, GLsizei len
,
4676 const GLvoid
* string
)
4678 GET_CURRENT_CONTEXT(ctx
);
4680 GLubyte
*programCopy
;
4682 programCopy
= (GLubyte
*) _mesa_malloc(len
);
4684 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramStringARB");
4687 _mesa_memcpy(programCopy
, string
, len
);
4689 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4690 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_STRING_ARB
, 4);
4695 n
[4].data
= programCopy
;
4697 if (ctx
->ExecuteFlag
) {
4698 CALL_ProgramStringARB(ctx
->Exec
, (target
, format
, len
, string
));
4702 #endif /* FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program */
4705 #if FEATURE_ARB_occlusion_query
4707 static void GLAPIENTRY
4708 save_BeginQueryARB(GLenum target
, GLuint id
)
4710 GET_CURRENT_CONTEXT(ctx
);
4712 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4713 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BEGIN_QUERY_ARB
, 2);
4718 if (ctx
->ExecuteFlag
) {
4719 CALL_BeginQueryARB(ctx
->Exec
, (target
, id
));
4724 static void GLAPIENTRY
4725 save_EndQueryARB(GLenum target
)
4727 GET_CURRENT_CONTEXT(ctx
);
4729 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4730 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_END_QUERY_ARB
, 1);
4734 if (ctx
->ExecuteFlag
) {
4735 CALL_EndQueryARB(ctx
->Exec
, (target
));
4739 #endif /* FEATURE_ARB_occlusion_query */
4742 static void GLAPIENTRY
4743 save_DrawBuffersARB(GLsizei count
, const GLenum
* buffers
)
4745 GET_CURRENT_CONTEXT(ctx
);
4747 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4748 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DRAW_BUFFERS_ARB
, 1 + MAX_DRAW_BUFFERS
);
4752 if (count
> MAX_DRAW_BUFFERS
)
4753 count
= MAX_DRAW_BUFFERS
;
4754 for (i
= 0; i
< count
; i
++) {
4755 n
[2 + i
].e
= buffers
[i
];
4758 if (ctx
->ExecuteFlag
) {
4759 CALL_DrawBuffersARB(ctx
->Exec
, (count
, buffers
));
4763 #if FEATURE_ATI_fragment_shader
4764 static void GLAPIENTRY
4765 save_BindFragmentShaderATI(GLuint id
)
4767 GET_CURRENT_CONTEXT(ctx
);
4770 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BIND_FRAGMENT_SHADER_ATI
, 1);
4774 if (ctx
->ExecuteFlag
) {
4775 CALL_BindFragmentShaderATI(ctx
->Exec
, (id
));
4779 static void GLAPIENTRY
4780 save_SetFragmentShaderConstantATI(GLuint dst
, const GLfloat
*value
)
4782 GET_CURRENT_CONTEXT(ctx
);
4785 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
, 5);
4793 if (ctx
->ExecuteFlag
) {
4794 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, value
));
4800 save_Attr1fNV(GLenum attr
, GLfloat x
)
4802 GET_CURRENT_CONTEXT(ctx
);
4804 SAVE_FLUSH_VERTICES(ctx
);
4805 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_1F_NV
, 2);
4811 ASSERT(attr
< MAX_VERTEX_PROGRAM_ATTRIBS
);
4812 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
4813 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
4815 if (ctx
->ExecuteFlag
) {
4816 CALL_VertexAttrib1fNV(ctx
->Exec
, (attr
, x
));
4821 save_Attr2fNV(GLenum attr
, GLfloat x
, GLfloat y
)
4823 GET_CURRENT_CONTEXT(ctx
);
4825 SAVE_FLUSH_VERTICES(ctx
);
4826 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_2F_NV
, 3);
4833 ASSERT(attr
< MAX_VERTEX_PROGRAM_ATTRIBS
);
4834 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
4835 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
4837 if (ctx
->ExecuteFlag
) {
4838 CALL_VertexAttrib2fNV(ctx
->Exec
, (attr
, x
, y
));
4843 save_Attr3fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
4845 GET_CURRENT_CONTEXT(ctx
);
4847 SAVE_FLUSH_VERTICES(ctx
);
4848 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_3F_NV
, 4);
4856 ASSERT(attr
< MAX_VERTEX_PROGRAM_ATTRIBS
);
4857 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
4858 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
4860 if (ctx
->ExecuteFlag
) {
4861 CALL_VertexAttrib3fNV(ctx
->Exec
, (attr
, x
, y
, z
));
4866 save_Attr4fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4868 GET_CURRENT_CONTEXT(ctx
);
4870 SAVE_FLUSH_VERTICES(ctx
);
4871 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_4F_NV
, 5);
4880 ASSERT(attr
< MAX_VERTEX_PROGRAM_ATTRIBS
);
4881 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
4882 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
4884 if (ctx
->ExecuteFlag
) {
4885 CALL_VertexAttrib4fNV(ctx
->Exec
, (attr
, x
, y
, z
, w
));
4891 save_Attr1fARB(GLenum attr
, GLfloat x
)
4893 GET_CURRENT_CONTEXT(ctx
);
4895 SAVE_FLUSH_VERTICES(ctx
);
4896 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_1F_ARB
, 2);
4902 ASSERT(attr
< MAX_VERTEX_ATTRIBS
);
4903 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
4904 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
4906 if (ctx
->ExecuteFlag
) {
4907 CALL_VertexAttrib1fARB(ctx
->Exec
, (attr
, x
));
4912 save_Attr2fARB(GLenum attr
, GLfloat x
, GLfloat y
)
4914 GET_CURRENT_CONTEXT(ctx
);
4916 SAVE_FLUSH_VERTICES(ctx
);
4917 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_2F_ARB
, 3);
4924 ASSERT(attr
< MAX_VERTEX_ATTRIBS
);
4925 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
4926 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
4928 if (ctx
->ExecuteFlag
) {
4929 CALL_VertexAttrib2fARB(ctx
->Exec
, (attr
, x
, y
));
4934 save_Attr3fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
4936 GET_CURRENT_CONTEXT(ctx
);
4938 SAVE_FLUSH_VERTICES(ctx
);
4939 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_3F_ARB
, 4);
4947 ASSERT(attr
< MAX_VERTEX_ATTRIBS
);
4948 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
4949 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
4951 if (ctx
->ExecuteFlag
) {
4952 CALL_VertexAttrib3fARB(ctx
->Exec
, (attr
, x
, y
, z
));
4957 save_Attr4fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4959 GET_CURRENT_CONTEXT(ctx
);
4961 SAVE_FLUSH_VERTICES(ctx
);
4962 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_4F_ARB
, 5);
4971 ASSERT(attr
< MAX_VERTEX_ATTRIBS
);
4972 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
4973 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
4975 if (ctx
->ExecuteFlag
) {
4976 CALL_VertexAttrib4fARB(ctx
->Exec
, (attr
, x
, y
, z
, w
));
4981 static void GLAPIENTRY
4982 save_EvalCoord1f(GLfloat x
)
4984 GET_CURRENT_CONTEXT(ctx
);
4986 SAVE_FLUSH_VERTICES(ctx
);
4987 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVAL_C1
, 1);
4991 if (ctx
->ExecuteFlag
) {
4992 CALL_EvalCoord1f(ctx
->Exec
, (x
));
4996 static void GLAPIENTRY
4997 save_EvalCoord1fv(const GLfloat
* v
)
4999 save_EvalCoord1f(v
[0]);
5002 static void GLAPIENTRY
5003 save_EvalCoord2f(GLfloat x
, GLfloat y
)
5005 GET_CURRENT_CONTEXT(ctx
);
5007 SAVE_FLUSH_VERTICES(ctx
);
5008 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVAL_C2
, 2);
5013 if (ctx
->ExecuteFlag
) {
5014 CALL_EvalCoord2f(ctx
->Exec
, (x
, y
));
5018 static void GLAPIENTRY
5019 save_EvalCoord2fv(const GLfloat
* v
)
5021 save_EvalCoord2f(v
[0], v
[1]);
5025 static void GLAPIENTRY
5026 save_EvalPoint1(GLint x
)
5028 GET_CURRENT_CONTEXT(ctx
);
5030 SAVE_FLUSH_VERTICES(ctx
);
5031 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVAL_P1
, 1);
5035 if (ctx
->ExecuteFlag
) {
5036 CALL_EvalPoint1(ctx
->Exec
, (x
));
5040 static void GLAPIENTRY
5041 save_EvalPoint2(GLint x
, GLint y
)
5043 GET_CURRENT_CONTEXT(ctx
);
5045 SAVE_FLUSH_VERTICES(ctx
);
5046 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVAL_P2
, 2);
5051 if (ctx
->ExecuteFlag
) {
5052 CALL_EvalPoint2(ctx
->Exec
, (x
, y
));
5056 static void GLAPIENTRY
5057 save_Indexf(GLfloat x
)
5059 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, x
);
5062 static void GLAPIENTRY
5063 save_Indexfv(const GLfloat
* v
)
5065 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, v
[0]);
5068 static void GLAPIENTRY
5069 save_EdgeFlag(GLboolean x
)
5071 save_Attr1fNV(VERT_ATTRIB_EDGEFLAG
, x
? 1.0 : 0.0);
5074 static void GLAPIENTRY
5075 save_Materialfv(GLenum face
, GLenum pname
, const GLfloat
* param
)
5077 GET_CURRENT_CONTEXT(ctx
);
5081 SAVE_FLUSH_VERTICES(ctx
);
5086 case GL_FRONT_AND_BACK
:
5089 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "material(face)");
5098 case GL_AMBIENT_AND_DIFFUSE
:
5104 case GL_COLOR_INDEXES
:
5108 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "material(pname)");
5112 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MATERIAL
, 6);
5116 for (i
= 0; i
< args
; i
++)
5117 n
[3 + i
].f
= param
[i
];
5121 GLuint bitmask
= _mesa_material_bitmask(ctx
, face
, pname
, ~0, NULL
);
5122 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++)
5123 if (bitmask
& (1 << i
)) {
5124 ctx
->ListState
.ActiveMaterialSize
[i
] = args
;
5125 COPY_SZ_4V(ctx
->ListState
.CurrentMaterial
[i
], args
, param
);
5129 if (ctx
->ExecuteFlag
) {
5130 CALL_Materialfv(ctx
->Exec
, (face
, pname
, param
));
5134 static void GLAPIENTRY
5135 save_Begin(GLenum mode
)
5137 GET_CURRENT_CONTEXT(ctx
);
5139 GLboolean error
= GL_FALSE
;
5141 if ( /*mode < GL_POINTS || */ mode
> GL_POLYGON
) {
5142 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "Begin (mode)");
5145 else if (ctx
->Driver
.CurrentSavePrimitive
== PRIM_UNKNOWN
) {
5146 /* Typically the first begin. This may raise an error on
5147 * playback, depending on whether CallList is issued from inside
5148 * a begin/end or not.
5150 ctx
->Driver
.CurrentSavePrimitive
= PRIM_INSIDE_UNKNOWN_PRIM
;
5152 else if (ctx
->Driver
.CurrentSavePrimitive
== PRIM_OUTSIDE_BEGIN_END
) {
5153 ctx
->Driver
.CurrentSavePrimitive
= mode
;
5156 _mesa_compile_error(ctx
, GL_INVALID_OPERATION
, "recursive begin");
5161 /* Give the driver an opportunity to hook in an optimized
5162 * display list compiler.
5164 if (ctx
->Driver
.NotifySaveBegin(ctx
, mode
))
5167 SAVE_FLUSH_VERTICES(ctx
);
5168 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BEGIN
, 1);
5174 if (ctx
->ExecuteFlag
) {
5175 CALL_Begin(ctx
->Exec
, (mode
));
5179 static void GLAPIENTRY
5182 GET_CURRENT_CONTEXT(ctx
);
5183 SAVE_FLUSH_VERTICES(ctx
);
5184 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_END
, 0);
5185 ctx
->Driver
.CurrentSavePrimitive
= PRIM_OUTSIDE_BEGIN_END
;
5186 if (ctx
->ExecuteFlag
) {
5187 CALL_End(ctx
->Exec
, ());
5191 static void GLAPIENTRY
5192 save_Rectf(GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
5194 GET_CURRENT_CONTEXT(ctx
);
5196 SAVE_FLUSH_VERTICES(ctx
);
5197 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_RECTF
, 4);
5204 if (ctx
->ExecuteFlag
) {
5205 CALL_Rectf(ctx
->Exec
, (a
, b
, c
, d
));
5210 static void GLAPIENTRY
5211 save_Vertex2f(GLfloat x
, GLfloat y
)
5213 save_Attr2fNV(VERT_ATTRIB_POS
, x
, y
);
5216 static void GLAPIENTRY
5217 save_Vertex2fv(const GLfloat
* v
)
5219 save_Attr2fNV(VERT_ATTRIB_POS
, v
[0], v
[1]);
5222 static void GLAPIENTRY
5223 save_Vertex3f(GLfloat x
, GLfloat y
, GLfloat z
)
5225 save_Attr3fNV(VERT_ATTRIB_POS
, x
, y
, z
);
5228 static void GLAPIENTRY
5229 save_Vertex3fv(const GLfloat
* v
)
5231 save_Attr3fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2]);
5234 static void GLAPIENTRY
5235 save_Vertex4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5237 save_Attr4fNV(VERT_ATTRIB_POS
, x
, y
, z
, w
);
5240 static void GLAPIENTRY
5241 save_Vertex4fv(const GLfloat
* v
)
5243 save_Attr4fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2], v
[3]);
5246 static void GLAPIENTRY
5247 save_TexCoord1f(GLfloat x
)
5249 save_Attr1fNV(VERT_ATTRIB_TEX0
, x
);
5252 static void GLAPIENTRY
5253 save_TexCoord1fv(const GLfloat
* v
)
5255 save_Attr1fNV(VERT_ATTRIB_TEX0
, v
[0]);
5258 static void GLAPIENTRY
5259 save_TexCoord2f(GLfloat x
, GLfloat y
)
5261 save_Attr2fNV(VERT_ATTRIB_TEX0
, x
, y
);
5264 static void GLAPIENTRY
5265 save_TexCoord2fv(const GLfloat
* v
)
5267 save_Attr2fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1]);
5270 static void GLAPIENTRY
5271 save_TexCoord3f(GLfloat x
, GLfloat y
, GLfloat z
)
5273 save_Attr3fNV(VERT_ATTRIB_TEX0
, x
, y
, z
);
5276 static void GLAPIENTRY
5277 save_TexCoord3fv(const GLfloat
* v
)
5279 save_Attr3fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2]);
5282 static void GLAPIENTRY
5283 save_TexCoord4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5285 save_Attr4fNV(VERT_ATTRIB_TEX0
, x
, y
, z
, w
);
5288 static void GLAPIENTRY
5289 save_TexCoord4fv(const GLfloat
* v
)
5291 save_Attr4fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2], v
[3]);
5294 static void GLAPIENTRY
5295 save_Normal3f(GLfloat x
, GLfloat y
, GLfloat z
)
5297 save_Attr3fNV(VERT_ATTRIB_NORMAL
, x
, y
, z
);
5300 static void GLAPIENTRY
5301 save_Normal3fv(const GLfloat
* v
)
5303 save_Attr3fNV(VERT_ATTRIB_NORMAL
, v
[0], v
[1], v
[2]);
5306 static void GLAPIENTRY
5307 save_FogCoordfEXT(GLfloat x
)
5309 save_Attr1fNV(VERT_ATTRIB_FOG
, x
);
5312 static void GLAPIENTRY
5313 save_FogCoordfvEXT(const GLfloat
* v
)
5315 save_Attr1fNV(VERT_ATTRIB_FOG
, v
[0]);
5318 static void GLAPIENTRY
5319 save_Color3f(GLfloat x
, GLfloat y
, GLfloat z
)
5321 save_Attr3fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
);
5324 static void GLAPIENTRY
5325 save_Color3fv(const GLfloat
* v
)
5327 save_Attr3fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2]);
5330 static void GLAPIENTRY
5331 save_Color4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5333 save_Attr4fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
, w
);
5336 static void GLAPIENTRY
5337 save_Color4fv(const GLfloat
* v
)
5339 save_Attr4fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2], v
[3]);
5342 static void GLAPIENTRY
5343 save_SecondaryColor3fEXT(GLfloat x
, GLfloat y
, GLfloat z
)
5345 save_Attr3fNV(VERT_ATTRIB_COLOR1
, x
, y
, z
);
5348 static void GLAPIENTRY
5349 save_SecondaryColor3fvEXT(const GLfloat
* v
)
5351 save_Attr3fNV(VERT_ATTRIB_COLOR1
, v
[0], v
[1], v
[2]);
5355 /* Just call the respective ATTR for texcoord
5357 static void GLAPIENTRY
5358 save_MultiTexCoord1f(GLenum target
, GLfloat x
)
5360 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5361 save_Attr1fNV(attr
, x
);
5364 static void GLAPIENTRY
5365 save_MultiTexCoord1fv(GLenum target
, const GLfloat
* v
)
5367 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5368 save_Attr1fNV(attr
, v
[0]);
5371 static void GLAPIENTRY
5372 save_MultiTexCoord2f(GLenum target
, GLfloat x
, GLfloat y
)
5374 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5375 save_Attr2fNV(attr
, x
, y
);
5378 static void GLAPIENTRY
5379 save_MultiTexCoord2fv(GLenum target
, const GLfloat
* v
)
5381 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5382 save_Attr2fNV(attr
, v
[0], v
[1]);
5385 static void GLAPIENTRY
5386 save_MultiTexCoord3f(GLenum target
, GLfloat x
, GLfloat y
, GLfloat z
)
5388 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5389 save_Attr3fNV(attr
, x
, y
, z
);
5392 static void GLAPIENTRY
5393 save_MultiTexCoord3fv(GLenum target
, const GLfloat
* v
)
5395 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5396 save_Attr3fNV(attr
, v
[0], v
[1], v
[2]);
5399 static void GLAPIENTRY
5400 save_MultiTexCoord4f(GLenum target
, GLfloat x
, GLfloat y
,
5401 GLfloat z
, GLfloat w
)
5403 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5404 save_Attr4fNV(attr
, x
, y
, z
, w
);
5407 static void GLAPIENTRY
5408 save_MultiTexCoord4fv(GLenum target
, const GLfloat
* v
)
5410 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5411 save_Attr4fNV(attr
, v
[0], v
[1], v
[2], v
[3]);
5416 * Record a GL_INVALID_VALUE error when a invalid vertex attribute
5422 GET_CURRENT_CONTEXT(ctx
);
5423 _mesa_error(ctx
, GL_INVALID_VALUE
, "VertexAttribf(index)");
5427 /* First level for NV_vertex_program:
5429 * Check for errors at compile time?.
5431 static void GLAPIENTRY
5432 save_VertexAttrib1fNV(GLuint index
, GLfloat x
)
5434 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5435 save_Attr1fNV(index
, x
);
5440 static void GLAPIENTRY
5441 save_VertexAttrib1fvNV(GLuint index
, const GLfloat
* v
)
5443 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5444 save_Attr1fNV(index
, v
[0]);
5449 static void GLAPIENTRY
5450 save_VertexAttrib2fNV(GLuint index
, GLfloat x
, GLfloat y
)
5452 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5453 save_Attr2fNV(index
, x
, y
);
5458 static void GLAPIENTRY
5459 save_VertexAttrib2fvNV(GLuint index
, const GLfloat
* v
)
5461 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5462 save_Attr2fNV(index
, v
[0], v
[1]);
5467 static void GLAPIENTRY
5468 save_VertexAttrib3fNV(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
5470 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5471 save_Attr3fNV(index
, x
, y
, z
);
5476 static void GLAPIENTRY
5477 save_VertexAttrib3fvNV(GLuint index
, const GLfloat
* v
)
5479 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5480 save_Attr3fNV(index
, v
[0], v
[1], v
[2]);
5485 static void GLAPIENTRY
5486 save_VertexAttrib4fNV(GLuint index
, GLfloat x
, GLfloat y
,
5487 GLfloat z
, GLfloat w
)
5489 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5490 save_Attr4fNV(index
, x
, y
, z
, w
);
5495 static void GLAPIENTRY
5496 save_VertexAttrib4fvNV(GLuint index
, const GLfloat
* v
)
5498 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5499 save_Attr4fNV(index
, v
[0], v
[1], v
[2], v
[3]);
5507 static void GLAPIENTRY
5508 save_VertexAttrib1fARB(GLuint index
, GLfloat x
)
5510 if (index
< MAX_VERTEX_ATTRIBS
)
5511 save_Attr1fARB(index
, x
);
5516 static void GLAPIENTRY
5517 save_VertexAttrib1fvARB(GLuint index
, const GLfloat
* v
)
5519 if (index
< MAX_VERTEX_ATTRIBS
)
5520 save_Attr1fARB(index
, v
[0]);
5525 static void GLAPIENTRY
5526 save_VertexAttrib2fARB(GLuint index
, GLfloat x
, GLfloat y
)
5528 if (index
< MAX_VERTEX_ATTRIBS
)
5529 save_Attr2fARB(index
, x
, y
);
5534 static void GLAPIENTRY
5535 save_VertexAttrib2fvARB(GLuint index
, const GLfloat
* v
)
5537 if (index
< MAX_VERTEX_ATTRIBS
)
5538 save_Attr2fARB(index
, v
[0], v
[1]);
5543 static void GLAPIENTRY
5544 save_VertexAttrib3fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
5546 if (index
< MAX_VERTEX_ATTRIBS
)
5547 save_Attr3fARB(index
, x
, y
, z
);
5552 static void GLAPIENTRY
5553 save_VertexAttrib3fvARB(GLuint index
, const GLfloat
* v
)
5555 if (index
< MAX_VERTEX_ATTRIBS
)
5556 save_Attr3fARB(index
, v
[0], v
[1], v
[2]);
5561 static void GLAPIENTRY
5562 save_VertexAttrib4fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
,
5565 if (index
< MAX_VERTEX_ATTRIBS
)
5566 save_Attr4fARB(index
, x
, y
, z
, w
);
5571 static void GLAPIENTRY
5572 save_VertexAttrib4fvARB(GLuint index
, const GLfloat
* v
)
5574 if (index
< MAX_VERTEX_ATTRIBS
)
5575 save_Attr4fARB(index
, v
[0], v
[1], v
[2], v
[3]);
5581 /* GL_ARB_shader_objects, GL_ARB_vertex/fragment_shader */
5583 static void GLAPIENTRY
5584 exec_BindAttribLocationARB(GLuint program
, GLuint index
, const GLchar
*name
)
5586 GET_CURRENT_CONTEXT(ctx
);
5587 FLUSH_VERTICES(ctx
, 0);
5588 CALL_BindAttribLocationARB(ctx
->Exec
, (program
, index
, name
));
5591 static GLint GLAPIENTRY
5592 exec_GetAttribLocationARB(GLuint program
, const GLchar
*name
)
5594 GET_CURRENT_CONTEXT(ctx
);
5595 FLUSH_VERTICES(ctx
, 0);
5596 return CALL_GetAttribLocationARB(ctx
->Exec
, (program
, name
));
5598 /* XXX more shader functions needed here */
5602 #if FEATURE_EXT_framebuffer_blit
5603 static void GLAPIENTRY
5604 save_BlitFramebufferEXT(GLint srcX0
, GLint srcY0
, GLint srcX1
, GLint srcY1
,
5605 GLint dstX0
, GLint dstY0
, GLint dstX1
, GLint dstY1
,
5606 GLbitfield mask
, GLenum filter
)
5608 GET_CURRENT_CONTEXT(ctx
);
5610 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5611 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BLIT_FRAMEBUFFER
, 10);
5624 if (ctx
->ExecuteFlag
) {
5625 CALL_BlitFramebufferEXT(ctx
->Exec
, (srcX0
, srcY0
, srcX1
, srcY1
,
5626 dstX0
, dstY0
, dstX1
, dstY1
,
5634 * Save an error-generating command into display list.
5636 * KW: Will appear in the list before the vertex buffer containing the
5637 * command that provoked the error. I don't see this as a problem.
5640 save_error(GLcontext
*ctx
, GLenum error
, const char *s
)
5643 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ERROR
, 2);
5646 n
[2].data
= (void *) s
;
5652 * Compile an error into current display list.
5655 _mesa_compile_error(GLcontext
*ctx
, GLenum error
, const char *s
)
5657 if (ctx
->CompileFlag
)
5658 save_error(ctx
, error
, s
);
5659 if (ctx
->ExecuteFlag
)
5660 _mesa_error(ctx
, error
, s
);
5665 * Test if ID names a display list.
5668 islist(GLcontext
*ctx
, GLuint list
)
5670 if (list
> 0 && lookup_list(ctx
, list
)) {
5680 /**********************************************************************/
5681 /* Display list execution */
5682 /**********************************************************************/
5686 * Execute a display list. Note that the ListBase offset must have already
5687 * been added before calling this function. I.e. the list argument is
5688 * the absolute list number, not relative to ListBase.
5689 * \param list - display list number
5692 execute_list(GLcontext
*ctx
, GLuint list
)
5694 struct mesa_display_list
*dlist
;
5698 if (list
== 0 || !islist(ctx
, list
))
5701 if (ctx
->ListState
.CallDepth
== MAX_LIST_NESTING
) {
5702 /* raise an error? */
5706 dlist
= lookup_list(ctx
, list
);
5710 ctx
->ListState
.CallDepth
++;
5712 if (ctx
->Driver
.BeginCallList
)
5713 ctx
->Driver
.BeginCallList(ctx
, dlist
);
5719 OpCode opcode
= n
[0].opcode
;
5720 int i
= (int) n
[0].opcode
- (int) OPCODE_EXT_0
;
5722 if (i
>= 0 && i
< (GLint
) ctx
->ListExt
.NumOpcodes
) {
5723 /* this is a driver-extended opcode */
5724 ctx
->ListExt
.Opcode
[i
].Execute(ctx
, &n
[1]);
5725 n
+= ctx
->ListExt
.Opcode
[i
].Size
;
5730 _mesa_error(ctx
, n
[1].e
, (const char *) n
[2].data
);
5733 CALL_Accum(ctx
->Exec
, (n
[1].e
, n
[2].f
));
5735 case OPCODE_ALPHA_FUNC
:
5736 CALL_AlphaFunc(ctx
->Exec
, (n
[1].e
, n
[2].f
));
5738 case OPCODE_BIND_TEXTURE
:
5739 CALL_BindTexture(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
5743 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5744 ctx
->Unpack
= ctx
->DefaultPacking
;
5745 CALL_Bitmap(ctx
->Exec
, ((GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
5746 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
5747 (const GLubyte
*) n
[7].data
));
5748 ctx
->Unpack
= save
; /* restore */
5751 case OPCODE_BLEND_COLOR
:
5752 CALL_BlendColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
5754 case OPCODE_BLEND_EQUATION
:
5755 CALL_BlendEquation(ctx
->Exec
, (n
[1].e
));
5757 case OPCODE_BLEND_EQUATION_SEPARATE
:
5758 CALL_BlendEquationSeparateEXT(ctx
->Exec
, (n
[1].e
, n
[2].e
));
5760 case OPCODE_BLEND_FUNC_SEPARATE
:
5761 CALL_BlendFuncSeparateEXT(ctx
->Exec
,
5762 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
5764 case OPCODE_CALL_LIST
:
5765 /* Generated by glCallList(), don't add ListBase */
5766 if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
5767 execute_list(ctx
, n
[1].ui
);
5770 case OPCODE_CALL_LIST_OFFSET
:
5771 /* Generated by glCallLists() so we must add ListBase */
5773 /* user specified a bad data type at compile time */
5774 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
5776 else if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
5777 execute_list(ctx
, ctx
->List
.ListBase
+ n
[1].ui
);
5781 CALL_Clear(ctx
->Exec
, (n
[1].bf
));
5783 case OPCODE_CLEAR_COLOR
:
5784 CALL_ClearColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
5786 case OPCODE_CLEAR_ACCUM
:
5787 CALL_ClearAccum(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
5789 case OPCODE_CLEAR_DEPTH
:
5790 CALL_ClearDepth(ctx
->Exec
, ((GLclampd
) n
[1].f
));
5792 case OPCODE_CLEAR_INDEX
:
5793 CALL_ClearIndex(ctx
->Exec
, ((GLfloat
) n
[1].ui
));
5795 case OPCODE_CLEAR_STENCIL
:
5796 CALL_ClearStencil(ctx
->Exec
, (n
[1].i
));
5798 case OPCODE_CLIP_PLANE
:
5805 CALL_ClipPlane(ctx
->Exec
, (n
[1].e
, eq
));
5808 case OPCODE_COLOR_MASK
:
5809 CALL_ColorMask(ctx
->Exec
, (n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
));
5811 case OPCODE_COLOR_MATERIAL
:
5812 CALL_ColorMaterial(ctx
->Exec
, (n
[1].e
, n
[2].e
));
5814 case OPCODE_COLOR_TABLE
:
5816 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5817 ctx
->Unpack
= ctx
->DefaultPacking
;
5818 CALL_ColorTable(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].e
,
5819 n
[5].e
, n
[6].data
));
5820 ctx
->Unpack
= save
; /* restore */
5823 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
5830 CALL_ColorTableParameterfv(ctx
->Exec
,
5831 (n
[1].e
, n
[2].e
, params
));
5834 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
5841 CALL_ColorTableParameteriv(ctx
->Exec
,
5842 (n
[1].e
, n
[2].e
, params
));
5845 case OPCODE_COLOR_SUB_TABLE
:
5847 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5848 ctx
->Unpack
= ctx
->DefaultPacking
;
5849 CALL_ColorSubTable(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5850 n
[4].e
, n
[5].e
, n
[6].data
));
5851 ctx
->Unpack
= save
; /* restore */
5854 case OPCODE_CONVOLUTION_FILTER_1D
:
5856 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5857 ctx
->Unpack
= ctx
->DefaultPacking
;
5858 CALL_ConvolutionFilter1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5861 ctx
->Unpack
= save
; /* restore */
5864 case OPCODE_CONVOLUTION_FILTER_2D
:
5866 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5867 ctx
->Unpack
= ctx
->DefaultPacking
;
5868 CALL_ConvolutionFilter2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5869 n
[4].i
, n
[5].e
, n
[6].e
,
5871 ctx
->Unpack
= save
; /* restore */
5874 case OPCODE_CONVOLUTION_PARAMETER_I
:
5875 CALL_ConvolutionParameteri(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].i
));
5877 case OPCODE_CONVOLUTION_PARAMETER_IV
:
5884 CALL_ConvolutionParameteriv(ctx
->Exec
,
5885 (n
[1].e
, n
[2].e
, params
));
5888 case OPCODE_CONVOLUTION_PARAMETER_F
:
5889 CALL_ConvolutionParameterf(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].f
));
5891 case OPCODE_CONVOLUTION_PARAMETER_FV
:
5898 CALL_ConvolutionParameterfv(ctx
->Exec
,
5899 (n
[1].e
, n
[2].e
, params
));
5902 case OPCODE_COPY_COLOR_SUB_TABLE
:
5903 CALL_CopyColorSubTable(ctx
->Exec
, (n
[1].e
, n
[2].i
,
5904 n
[3].i
, n
[4].i
, n
[5].i
));
5906 case OPCODE_COPY_COLOR_TABLE
:
5907 CALL_CopyColorSubTable(ctx
->Exec
, (n
[1].e
, n
[2].i
,
5908 n
[3].i
, n
[4].i
, n
[5].i
));
5910 case OPCODE_COPY_PIXELS
:
5911 CALL_CopyPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
,
5912 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
,
5915 case OPCODE_COPY_TEX_IMAGE1D
:
5916 CALL_CopyTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
5917 n
[5].i
, n
[6].i
, n
[7].i
));
5919 case OPCODE_COPY_TEX_IMAGE2D
:
5920 CALL_CopyTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
5921 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
));
5923 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
5924 CALL_CopyTexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5925 n
[4].i
, n
[5].i
, n
[6].i
));
5927 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
5928 CALL_CopyTexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5929 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
5932 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
5933 CALL_CopyTexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5934 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
5937 case OPCODE_CULL_FACE
:
5938 CALL_CullFace(ctx
->Exec
, (n
[1].e
));
5940 case OPCODE_DEPTH_FUNC
:
5941 CALL_DepthFunc(ctx
->Exec
, (n
[1].e
));
5943 case OPCODE_DEPTH_MASK
:
5944 CALL_DepthMask(ctx
->Exec
, (n
[1].b
));
5946 case OPCODE_DEPTH_RANGE
:
5947 CALL_DepthRange(ctx
->Exec
,
5948 ((GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
));
5950 case OPCODE_DISABLE
:
5951 CALL_Disable(ctx
->Exec
, (n
[1].e
));
5953 case OPCODE_DRAW_BUFFER
:
5954 CALL_DrawBuffer(ctx
->Exec
, (n
[1].e
));
5956 case OPCODE_DRAW_PIXELS
:
5958 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5959 ctx
->Unpack
= ctx
->DefaultPacking
;
5960 CALL_DrawPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
5962 ctx
->Unpack
= save
; /* restore */
5966 CALL_Enable(ctx
->Exec
, (n
[1].e
));
5968 case OPCODE_EVALMESH1
:
5969 CALL_EvalMesh1(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
));
5971 case OPCODE_EVALMESH2
:
5972 CALL_EvalMesh2(ctx
->Exec
,
5973 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
5982 CALL_Fogfv(ctx
->Exec
, (n
[1].e
, p
));
5985 case OPCODE_FRONT_FACE
:
5986 CALL_FrontFace(ctx
->Exec
, (n
[1].e
));
5988 case OPCODE_FRUSTUM
:
5989 CALL_Frustum(ctx
->Exec
,
5990 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
5993 CALL_Hint(ctx
->Exec
, (n
[1].e
, n
[2].e
));
5995 case OPCODE_HISTOGRAM
:
5996 CALL_Histogram(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].b
));
5998 case OPCODE_INDEX_MASK
:
5999 CALL_IndexMask(ctx
->Exec
, (n
[1].ui
));
6001 case OPCODE_INIT_NAMES
:
6002 CALL_InitNames(ctx
->Exec
, ());
6011 CALL_Lightfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, p
));
6014 case OPCODE_LIGHT_MODEL
:
6021 CALL_LightModelfv(ctx
->Exec
, (n
[1].e
, p
));
6024 case OPCODE_LINE_STIPPLE
:
6025 CALL_LineStipple(ctx
->Exec
, (n
[1].i
, n
[2].us
));
6027 case OPCODE_LINE_WIDTH
:
6028 CALL_LineWidth(ctx
->Exec
, (n
[1].f
));
6030 case OPCODE_LIST_BASE
:
6031 CALL_ListBase(ctx
->Exec
, (n
[1].ui
));
6033 case OPCODE_LOAD_IDENTITY
:
6034 CALL_LoadIdentity(ctx
->Exec
, ());
6036 case OPCODE_LOAD_MATRIX
:
6037 if (sizeof(Node
) == sizeof(GLfloat
)) {
6038 CALL_LoadMatrixf(ctx
->Exec
, (&n
[1].f
));
6043 for (i
= 0; i
< 16; i
++) {
6046 CALL_LoadMatrixf(ctx
->Exec
, (m
));
6049 case OPCODE_LOAD_NAME
:
6050 CALL_LoadName(ctx
->Exec
, (n
[1].ui
));
6052 case OPCODE_LOGIC_OP
:
6053 CALL_LogicOp(ctx
->Exec
, (n
[1].e
));
6057 GLenum target
= n
[1].e
;
6058 GLint ustride
= _mesa_evaluator_components(target
);
6059 GLint uorder
= n
[5].i
;
6060 GLfloat u1
= n
[2].f
;
6061 GLfloat u2
= n
[3].f
;
6062 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
6063 (GLfloat
*) n
[6].data
));
6068 GLenum target
= n
[1].e
;
6069 GLfloat u1
= n
[2].f
;
6070 GLfloat u2
= n
[3].f
;
6071 GLfloat v1
= n
[4].f
;
6072 GLfloat v2
= n
[5].f
;
6073 GLint ustride
= n
[6].i
;
6074 GLint vstride
= n
[7].i
;
6075 GLint uorder
= n
[8].i
;
6076 GLint vorder
= n
[9].i
;
6077 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
6078 v1
, v2
, vstride
, vorder
,
6079 (GLfloat
*) n
[10].data
));
6082 case OPCODE_MAPGRID1
:
6083 CALL_MapGrid1f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
6085 case OPCODE_MAPGRID2
:
6086 CALL_MapGrid2f(ctx
->Exec
,
6087 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
));
6089 case OPCODE_MATRIX_MODE
:
6090 CALL_MatrixMode(ctx
->Exec
, (n
[1].e
));
6092 case OPCODE_MIN_MAX
:
6093 CALL_Minmax(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].b
));
6095 case OPCODE_MULT_MATRIX
:
6096 if (sizeof(Node
) == sizeof(GLfloat
)) {
6097 CALL_MultMatrixf(ctx
->Exec
, (&n
[1].f
));
6102 for (i
= 0; i
< 16; i
++) {
6105 CALL_MultMatrixf(ctx
->Exec
, (m
));
6109 CALL_Ortho(ctx
->Exec
,
6110 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
6112 case OPCODE_PASSTHROUGH
:
6113 CALL_PassThrough(ctx
->Exec
, (n
[1].f
));
6115 case OPCODE_PIXEL_MAP
:
6116 CALL_PixelMapfv(ctx
->Exec
,
6117 (n
[1].e
, n
[2].i
, (GLfloat
*) n
[3].data
));
6119 case OPCODE_PIXEL_TRANSFER
:
6120 CALL_PixelTransferf(ctx
->Exec
, (n
[1].e
, n
[2].f
));
6122 case OPCODE_PIXEL_ZOOM
:
6123 CALL_PixelZoom(ctx
->Exec
, (n
[1].f
, n
[2].f
));
6125 case OPCODE_POINT_SIZE
:
6126 CALL_PointSize(ctx
->Exec
, (n
[1].f
));
6128 case OPCODE_POINT_PARAMETERS
:
6134 CALL_PointParameterfvEXT(ctx
->Exec
, (n
[1].e
, params
));
6137 case OPCODE_POLYGON_MODE
:
6138 CALL_PolygonMode(ctx
->Exec
, (n
[1].e
, n
[2].e
));
6140 case OPCODE_POLYGON_STIPPLE
:
6142 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6143 ctx
->Unpack
= ctx
->DefaultPacking
;
6144 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) n
[1].data
));
6145 ctx
->Unpack
= save
; /* restore */
6148 case OPCODE_POLYGON_OFFSET
:
6149 CALL_PolygonOffset(ctx
->Exec
, (n
[1].f
, n
[2].f
));
6151 case OPCODE_POP_ATTRIB
:
6152 CALL_PopAttrib(ctx
->Exec
, ());
6154 case OPCODE_POP_MATRIX
:
6155 CALL_PopMatrix(ctx
->Exec
, ());
6157 case OPCODE_POP_NAME
:
6158 CALL_PopName(ctx
->Exec
, ());
6160 case OPCODE_PRIORITIZE_TEXTURE
:
6161 CALL_PrioritizeTextures(ctx
->Exec
, (1, &n
[1].ui
, &n
[2].f
));
6163 case OPCODE_PUSH_ATTRIB
:
6164 CALL_PushAttrib(ctx
->Exec
, (n
[1].bf
));
6166 case OPCODE_PUSH_MATRIX
:
6167 CALL_PushMatrix(ctx
->Exec
, ());
6169 case OPCODE_PUSH_NAME
:
6170 CALL_PushName(ctx
->Exec
, (n
[1].ui
));
6172 case OPCODE_RASTER_POS
:
6173 CALL_RasterPos4f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
6175 case OPCODE_READ_BUFFER
:
6176 CALL_ReadBuffer(ctx
->Exec
, (n
[1].e
));
6178 case OPCODE_RESET_HISTOGRAM
:
6179 CALL_ResetHistogram(ctx
->Exec
, (n
[1].e
));
6181 case OPCODE_RESET_MIN_MAX
:
6182 CALL_ResetMinmax(ctx
->Exec
, (n
[1].e
));
6185 CALL_Rotatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
6188 CALL_Scalef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
6190 case OPCODE_SCISSOR
:
6191 CALL_Scissor(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
6193 case OPCODE_SHADE_MODEL
:
6194 CALL_ShadeModel(ctx
->Exec
, (n
[1].e
));
6196 case OPCODE_STENCIL_FUNC
:
6197 CALL_StencilFunc(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].ui
));
6199 case OPCODE_STENCIL_MASK
:
6200 CALL_StencilMask(ctx
->Exec
, (n
[1].ui
));
6202 case OPCODE_STENCIL_OP
:
6203 CALL_StencilOp(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].e
));
6205 case OPCODE_STENCIL_FUNC_SEPARATE
:
6206 CALL_StencilFuncSeparate(ctx
->Exec
,
6207 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].ui
));
6209 case OPCODE_STENCIL_MASK_SEPARATE
:
6210 CALL_StencilMaskSeparate(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
6212 case OPCODE_STENCIL_OP_SEPARATE
:
6213 CALL_StencilOpSeparate(ctx
->Exec
,
6214 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
6223 CALL_TexEnvfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
6233 CALL_TexGenfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
6236 case OPCODE_TEXPARAMETER
:
6243 CALL_TexParameterfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
6246 case OPCODE_TEX_IMAGE1D
:
6248 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6249 ctx
->Unpack
= ctx
->DefaultPacking
;
6250 CALL_TexImage1D(ctx
->Exec
, (n
[1].e
, /* target */
6252 n
[3].i
, /* components */
6254 n
[5].e
, /* border */
6255 n
[6].e
, /* format */
6258 ctx
->Unpack
= save
; /* restore */
6261 case OPCODE_TEX_IMAGE2D
:
6263 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6264 ctx
->Unpack
= ctx
->DefaultPacking
;
6265 CALL_TexImage2D(ctx
->Exec
, (n
[1].e
, /* target */
6267 n
[3].i
, /* components */
6269 n
[5].i
, /* height */
6270 n
[6].e
, /* border */
6271 n
[7].e
, /* format */
6274 ctx
->Unpack
= save
; /* restore */
6277 case OPCODE_TEX_IMAGE3D
:
6279 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6280 ctx
->Unpack
= ctx
->DefaultPacking
;
6281 CALL_TexImage3D(ctx
->Exec
, (n
[1].e
, /* target */
6283 n
[3].i
, /* components */
6285 n
[5].i
, /* height */
6287 n
[7].e
, /* border */
6288 n
[8].e
, /* format */
6291 ctx
->Unpack
= save
; /* restore */
6294 case OPCODE_TEX_SUB_IMAGE1D
:
6296 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6297 ctx
->Unpack
= ctx
->DefaultPacking
;
6298 CALL_TexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
6300 n
[6].e
, n
[7].data
));
6301 ctx
->Unpack
= save
; /* restore */
6304 case OPCODE_TEX_SUB_IMAGE2D
:
6306 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6307 ctx
->Unpack
= ctx
->DefaultPacking
;
6308 CALL_TexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
6310 n
[6].i
, n
[7].e
, n
[8].e
,
6312 ctx
->Unpack
= save
; /* restore */
6315 case OPCODE_TEX_SUB_IMAGE3D
:
6317 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6318 ctx
->Unpack
= ctx
->DefaultPacking
;
6319 CALL_TexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
6320 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
6321 n
[8].i
, n
[9].e
, n
[10].e
,
6323 ctx
->Unpack
= save
; /* restore */
6326 case OPCODE_TRANSLATE
:
6327 CALL_Translatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
6329 case OPCODE_VIEWPORT
:
6330 CALL_Viewport(ctx
->Exec
, (n
[1].i
, n
[2].i
,
6331 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
));
6333 case OPCODE_WINDOW_POS
:
6334 CALL_WindowPos4fMESA(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
6336 case OPCODE_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
6337 CALL_ActiveTextureARB(ctx
->Exec
, (n
[1].e
));
6339 case OPCODE_COMPRESSED_TEX_IMAGE_1D
: /* GL_ARB_texture_compression */
6340 CALL_CompressedTexImage1DARB(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
6341 n
[4].i
, n
[5].i
, n
[6].i
,
6344 case OPCODE_COMPRESSED_TEX_IMAGE_2D
: /* GL_ARB_texture_compression */
6345 CALL_CompressedTexImage2DARB(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
6346 n
[4].i
, n
[5].i
, n
[6].i
,
6347 n
[7].i
, n
[8].data
));
6349 case OPCODE_COMPRESSED_TEX_IMAGE_3D
: /* GL_ARB_texture_compression */
6350 CALL_CompressedTexImage3DARB(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
6351 n
[4].i
, n
[5].i
, n
[6].i
,
6355 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
: /* GL_ARB_texture_compress */
6356 CALL_CompressedTexSubImage1DARB(ctx
->Exec
,
6357 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
6358 n
[5].e
, n
[6].i
, n
[7].data
));
6360 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
: /* GL_ARB_texture_compress */
6361 CALL_CompressedTexSubImage2DARB(ctx
->Exec
,
6362 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
6363 n
[5].i
, n
[6].i
, n
[7].e
, n
[8].i
,
6366 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
: /* GL_ARB_texture_compress */
6367 CALL_CompressedTexSubImage3DARB(ctx
->Exec
,
6368 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
6369 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
6370 n
[9].e
, n
[10].i
, n
[11].data
));
6372 case OPCODE_SAMPLE_COVERAGE
: /* GL_ARB_multisample */
6373 CALL_SampleCoverageARB(ctx
->Exec
, (n
[1].f
, n
[2].b
));
6375 case OPCODE_WINDOW_POS_ARB
: /* GL_ARB_window_pos */
6376 CALL_WindowPos3fMESA(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
6378 #if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
6379 case OPCODE_BIND_PROGRAM_NV
: /* GL_NV_vertex_program */
6380 CALL_BindProgramNV(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
6383 #if FEATURE_NV_vertex_program
6384 case OPCODE_EXECUTE_PROGRAM_NV
:
6391 CALL_ExecuteProgramNV(ctx
->Exec
, (n
[1].e
, n
[2].ui
, v
));
6394 case OPCODE_REQUEST_RESIDENT_PROGRAMS_NV
:
6395 CALL_RequestResidentProgramsNV(ctx
->Exec
, (n
[1].ui
,
6396 (GLuint
*) n
[2].data
));
6398 case OPCODE_LOAD_PROGRAM_NV
:
6399 CALL_LoadProgramNV(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].i
,
6400 (const GLubyte
*) n
[4].data
));
6402 case OPCODE_TRACK_MATRIX_NV
:
6403 CALL_TrackMatrixNV(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].e
, n
[4].e
));
6407 #if FEATURE_NV_fragment_program
6408 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
:
6409 CALL_ProgramLocalParameter4fARB(ctx
->Exec
,
6410 (n
[1].e
, n
[2].ui
, n
[3].f
, n
[4].f
,
6413 case OPCODE_PROGRAM_NAMED_PARAMETER_NV
:
6414 CALL_ProgramNamedParameter4fNV(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
6415 (const GLubyte
*) n
[3].
6416 data
, n
[4].f
, n
[5].f
,
6421 case OPCODE_ACTIVE_STENCIL_FACE_EXT
:
6422 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (n
[1].e
));
6424 case OPCODE_DEPTH_BOUNDS_EXT
:
6425 CALL_DepthBoundsEXT(ctx
->Exec
, (n
[1].f
, n
[2].f
));
6427 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
6428 case OPCODE_PROGRAM_STRING_ARB
:
6429 CALL_ProgramStringARB(ctx
->Exec
,
6430 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].data
));
6433 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program || FEATURE_NV_vertex_program
6434 case OPCODE_PROGRAM_ENV_PARAMETER_ARB
:
6435 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].f
,
6440 #if FEATURE_ARB_occlusion_query
6441 case OPCODE_BEGIN_QUERY_ARB
:
6442 CALL_BeginQueryARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
6444 case OPCODE_END_QUERY_ARB
:
6445 CALL_EndQueryARB(ctx
->Exec
, (n
[1].e
));
6448 case OPCODE_DRAW_BUFFERS_ARB
:
6450 GLenum buffers
[MAX_DRAW_BUFFERS
];
6451 GLint i
, count
= MIN2(n
[1].i
, MAX_DRAW_BUFFERS
);
6452 for (i
= 0; i
< count
; i
++)
6453 buffers
[i
] = n
[2 + i
].e
;
6454 CALL_DrawBuffersARB(ctx
->Exec
, (n
[1].i
, buffers
));
6457 #if FEATURE_EXT_framebuffer_blit
6458 case OPCODE_BLIT_FRAMEBUFFER
:
6459 CALL_BlitFramebufferEXT(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
,
6460 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
6464 #if FEATURE_ATI_fragment_shader
6465 case OPCODE_BIND_FRAGMENT_SHADER_ATI
:
6466 CALL_BindFragmentShaderATI(ctx
->Exec
, (n
[1].i
));
6468 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
:
6471 GLuint i
, dst
= n
[1].ui
;
6473 for (i
= 0; i
< 4; i
++)
6474 values
[i
] = n
[1 + i
].f
;
6475 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, values
));
6479 case OPCODE_ATTR_1F_NV
:
6480 CALL_VertexAttrib1fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
));
6482 case OPCODE_ATTR_2F_NV
:
6483 /* Really shouldn't have to do this - the Node structure
6484 * is convenient, but it would be better to store the data
6485 * packed appropriately so that it can be sent directly
6486 * on. With x86_64 becoming common, this will start to
6489 if (sizeof(Node
) == sizeof(GLfloat
))
6490 CALL_VertexAttrib2fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6492 CALL_VertexAttrib2fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
));
6494 case OPCODE_ATTR_3F_NV
:
6495 if (sizeof(Node
) == sizeof(GLfloat
))
6496 CALL_VertexAttrib3fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6498 CALL_VertexAttrib3fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
6501 case OPCODE_ATTR_4F_NV
:
6502 if (sizeof(Node
) == sizeof(GLfloat
))
6503 CALL_VertexAttrib4fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6505 CALL_VertexAttrib4fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
6508 case OPCODE_ATTR_1F_ARB
:
6509 CALL_VertexAttrib1fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
));
6511 case OPCODE_ATTR_2F_ARB
:
6512 /* Really shouldn't have to do this - the Node structure
6513 * is convenient, but it would be better to store the data
6514 * packed appropriately so that it can be sent directly
6515 * on. With x86_64 becoming common, this will start to
6518 if (sizeof(Node
) == sizeof(GLfloat
))
6519 CALL_VertexAttrib2fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6521 CALL_VertexAttrib2fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
));
6523 case OPCODE_ATTR_3F_ARB
:
6524 if (sizeof(Node
) == sizeof(GLfloat
))
6525 CALL_VertexAttrib3fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6527 CALL_VertexAttrib3fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
6530 case OPCODE_ATTR_4F_ARB
:
6531 if (sizeof(Node
) == sizeof(GLfloat
))
6532 CALL_VertexAttrib4fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6534 CALL_VertexAttrib4fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
6537 case OPCODE_MATERIAL
:
6538 if (sizeof(Node
) == sizeof(GLfloat
))
6539 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, &n
[3].f
));
6546 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, f
));
6550 CALL_Begin(ctx
->Exec
, (n
[1].e
));
6553 CALL_End(ctx
->Exec
, ());
6556 CALL_Rectf(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
6558 case OPCODE_EVAL_C1
:
6559 CALL_EvalCoord1f(ctx
->Exec
, (n
[1].f
));
6561 case OPCODE_EVAL_C2
:
6562 CALL_EvalCoord2f(ctx
->Exec
, (n
[1].f
, n
[2].f
));
6564 case OPCODE_EVAL_P1
:
6565 CALL_EvalPoint1(ctx
->Exec
, (n
[1].i
));
6567 case OPCODE_EVAL_P2
:
6568 CALL_EvalPoint2(ctx
->Exec
, (n
[1].i
, n
[2].i
));
6571 case OPCODE_CONTINUE
:
6572 n
= (Node
*) n
[1].next
;
6574 case OPCODE_END_OF_LIST
:
6580 _mesa_sprintf(msg
, "Error in execute_list: opcode=%d",
6582 _mesa_problem(ctx
, msg
);
6587 /* increment n to point to next compiled command */
6588 if (opcode
!= OPCODE_CONTINUE
) {
6589 n
+= InstSize
[opcode
];
6594 if (ctx
->Driver
.EndCallList
)
6595 ctx
->Driver
.EndCallList(ctx
);
6597 ctx
->ListState
.CallDepth
--;
6602 /**********************************************************************/
6604 /**********************************************************************/
6607 * Test if a display list number is valid.
6609 GLboolean GLAPIENTRY
6610 _mesa_IsList(GLuint list
)
6612 GET_CURRENT_CONTEXT(ctx
);
6613 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
6614 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
6615 return islist(ctx
, list
);
6620 * Delete a sequence of consecutive display lists.
6623 _mesa_DeleteLists(GLuint list
, GLsizei range
)
6625 GET_CURRENT_CONTEXT(ctx
);
6627 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
6628 ASSERT_OUTSIDE_BEGIN_END(ctx
);
6631 _mesa_error(ctx
, GL_INVALID_VALUE
, "glDeleteLists");
6634 for (i
= list
; i
< list
+ range
; i
++) {
6635 destroy_list(ctx
, i
);
6641 * Return a display list number, n, such that lists n through n+range-1
6645 _mesa_GenLists(GLsizei range
)
6647 GET_CURRENT_CONTEXT(ctx
);
6649 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
6650 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, 0);
6653 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGenLists");
6661 * Make this an atomic operation
6663 _glthread_LOCK_MUTEX(ctx
->Shared
->Mutex
);
6665 base
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
6667 /* reserve the list IDs by with empty/dummy lists */
6669 for (i
= 0; i
< range
; i
++) {
6670 _mesa_HashInsert(ctx
->Shared
->DisplayList
, base
+ i
,
6671 make_list(base
+ i
, 1));
6675 _glthread_UNLOCK_MUTEX(ctx
->Shared
->Mutex
);
6682 * Begin a new display list.
6685 _mesa_NewList(GLuint list
, GLenum mode
)
6687 GET_CURRENT_CONTEXT(ctx
);
6690 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
6691 ASSERT_OUTSIDE_BEGIN_END(ctx
);
6693 if (MESA_VERBOSE
& VERBOSE_API
)
6694 _mesa_debug(ctx
, "glNewList %u %s\n", list
,
6695 _mesa_lookup_enum_by_nr(mode
));
6698 _mesa_error(ctx
, GL_INVALID_VALUE
, "glNewList");
6702 if (mode
!= GL_COMPILE
&& mode
!= GL_COMPILE_AND_EXECUTE
) {
6703 _mesa_error(ctx
, GL_INVALID_ENUM
, "glNewList");
6707 if (ctx
->ListState
.CurrentListPtr
) {
6708 /* already compiling a display list */
6709 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
6713 ctx
->CompileFlag
= GL_TRUE
;
6714 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
6716 /* Allocate new display list */
6717 ctx
->ListState
.CurrentListNum
= list
;
6718 ctx
->ListState
.CurrentList
= make_list(list
, BLOCK_SIZE
);
6719 ctx
->ListState
.CurrentBlock
= ctx
->ListState
.CurrentList
->node
;
6720 ctx
->ListState
.CurrentListPtr
= ctx
->ListState
.CurrentBlock
;
6721 ctx
->ListState
.CurrentPos
= 0;
6723 /* Reset acumulated list state:
6725 for (i
= 0; i
< VERT_ATTRIB_MAX
; i
++)
6726 ctx
->ListState
.ActiveAttribSize
[i
] = 0;
6728 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++)
6729 ctx
->ListState
.ActiveMaterialSize
[i
] = 0;
6731 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
6732 ctx
->Driver
.NewList(ctx
, list
, mode
);
6734 ctx
->CurrentDispatch
= ctx
->Save
;
6735 _glapi_set_dispatch(ctx
->CurrentDispatch
);
6740 * End definition of current display list.
6745 GET_CURRENT_CONTEXT(ctx
);
6746 SAVE_FLUSH_VERTICES(ctx
);
6747 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
6749 if (MESA_VERBOSE
& VERBOSE_API
)
6750 _mesa_debug(ctx
, "glEndList\n");
6752 /* Check that a list is under construction */
6753 if (!ctx
->ListState
.CurrentListPtr
) {
6754 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glEndList");
6758 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_END_OF_LIST
, 0);
6760 /* Destroy old list, if any */
6761 destroy_list(ctx
, ctx
->ListState
.CurrentListNum
);
6762 /* Install the list */
6763 _mesa_HashInsert(ctx
->Shared
->DisplayList
, ctx
->ListState
.CurrentListNum
,
6764 ctx
->ListState
.CurrentList
);
6767 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
6768 mesa_print_display_list(ctx
->ListState
.CurrentListNum
);
6770 ctx
->Driver
.EndList(ctx
);
6772 ctx
->ListState
.CurrentList
= NULL
;
6773 ctx
->ListState
.CurrentListNum
= 0;
6774 ctx
->ListState
.CurrentListPtr
= NULL
;
6775 ctx
->ExecuteFlag
= GL_TRUE
;
6776 ctx
->CompileFlag
= GL_FALSE
;
6778 ctx
->CurrentDispatch
= ctx
->Exec
;
6779 _glapi_set_dispatch(ctx
->CurrentDispatch
);
6784 _mesa_CallList(GLuint list
)
6786 GLboolean save_compile_flag
;
6787 GET_CURRENT_CONTEXT(ctx
);
6788 FLUSH_CURRENT(ctx
, 0);
6789 /* VERY IMPORTANT: Save the CompileFlag status, turn it off, */
6790 /* execute the display list, and restore the CompileFlag. */
6792 if (MESA_VERBOSE
& VERBOSE_API
)
6793 _mesa_debug(ctx
, "glCallList %d\n", list
);
6796 _mesa_error(ctx
, GL_INVALID_VALUE
, "glCallList(list==0)");
6800 /* mesa_print_display_list( list ); */
6802 save_compile_flag
= ctx
->CompileFlag
;
6803 if (save_compile_flag
) {
6804 ctx
->CompileFlag
= GL_FALSE
;
6807 execute_list(ctx
, list
);
6808 ctx
->CompileFlag
= save_compile_flag
;
6810 /* also restore API function pointers to point to "save" versions */
6811 if (save_compile_flag
) {
6812 ctx
->CurrentDispatch
= ctx
->Save
;
6813 _glapi_set_dispatch(ctx
->CurrentDispatch
);
6819 * Execute glCallLists: call multiple display lists.
6822 _mesa_CallLists(GLsizei n
, GLenum type
, const GLvoid
* lists
)
6824 GET_CURRENT_CONTEXT(ctx
);
6827 GLboolean save_compile_flag
;
6829 if (MESA_VERBOSE
& VERBOSE_API
)
6830 _mesa_debug(ctx
, "glCallLists %d\n", n
);
6834 case GL_UNSIGNED_BYTE
:
6836 case GL_UNSIGNED_SHORT
:
6838 case GL_UNSIGNED_INT
:
6846 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
6850 /* Save the CompileFlag status, turn it off, execute display list,
6851 * and restore the CompileFlag.
6853 save_compile_flag
= ctx
->CompileFlag
;
6854 ctx
->CompileFlag
= GL_FALSE
;
6856 for (i
= 0; i
< n
; i
++) {
6857 list
= translate_id(i
, type
, lists
);
6858 execute_list(ctx
, ctx
->List
.ListBase
+ list
);
6861 ctx
->CompileFlag
= save_compile_flag
;
6863 /* also restore API function pointers to point to "save" versions */
6864 if (save_compile_flag
) {
6865 ctx
->CurrentDispatch
= ctx
->Save
;
6866 _glapi_set_dispatch(ctx
->CurrentDispatch
);
6872 * Set the offset added to list numbers in glCallLists.
6875 _mesa_ListBase(GLuint base
)
6877 GET_CURRENT_CONTEXT(ctx
);
6878 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
6879 ASSERT_OUTSIDE_BEGIN_END(ctx
);
6880 ctx
->List
.ListBase
= base
;
6884 /* Can no longer assume ctx->Exec->Func is equal to _mesa_Func.
6886 static void GLAPIENTRY
6889 GET_CURRENT_CONTEXT(ctx
);
6890 FLUSH_VERTICES(ctx
, 0);
6891 CALL_Finish(ctx
->Exec
, ());
6894 static void GLAPIENTRY
6897 GET_CURRENT_CONTEXT(ctx
);
6898 FLUSH_VERTICES(ctx
, 0);
6899 CALL_Flush(ctx
->Exec
, ());
6902 static void GLAPIENTRY
6903 exec_GetBooleanv(GLenum pname
, GLboolean
*params
)
6905 GET_CURRENT_CONTEXT(ctx
);
6906 FLUSH_VERTICES(ctx
, 0);
6907 CALL_GetBooleanv(ctx
->Exec
, (pname
, params
));
6910 static void GLAPIENTRY
6911 exec_GetClipPlane(GLenum plane
, GLdouble
* equation
)
6913 GET_CURRENT_CONTEXT(ctx
);
6914 FLUSH_VERTICES(ctx
, 0);
6915 CALL_GetClipPlane(ctx
->Exec
, (plane
, equation
));
6918 static void GLAPIENTRY
6919 exec_GetDoublev(GLenum pname
, GLdouble
*params
)
6921 GET_CURRENT_CONTEXT(ctx
);
6922 FLUSH_VERTICES(ctx
, 0);
6923 CALL_GetDoublev(ctx
->Exec
, (pname
, params
));
6926 static GLenum GLAPIENTRY
6929 GET_CURRENT_CONTEXT(ctx
);
6930 FLUSH_VERTICES(ctx
, 0);
6931 return CALL_GetError(ctx
->Exec
, ());
6934 static void GLAPIENTRY
6935 exec_GetFloatv(GLenum pname
, GLfloat
*params
)
6937 GET_CURRENT_CONTEXT(ctx
);
6938 FLUSH_VERTICES(ctx
, 0);
6939 CALL_GetFloatv(ctx
->Exec
, (pname
, params
));
6942 static void GLAPIENTRY
6943 exec_GetIntegerv(GLenum pname
, GLint
*params
)
6945 GET_CURRENT_CONTEXT(ctx
);
6946 FLUSH_VERTICES(ctx
, 0);
6947 CALL_GetIntegerv(ctx
->Exec
, (pname
, params
));
6950 static void GLAPIENTRY
6951 exec_GetLightfv(GLenum light
, GLenum pname
, GLfloat
*params
)
6953 GET_CURRENT_CONTEXT(ctx
);
6954 FLUSH_VERTICES(ctx
, 0);
6955 CALL_GetLightfv(ctx
->Exec
, (light
, pname
, params
));
6958 static void GLAPIENTRY
6959 exec_GetLightiv(GLenum light
, GLenum pname
, GLint
*params
)
6961 GET_CURRENT_CONTEXT(ctx
);
6962 FLUSH_VERTICES(ctx
, 0);
6963 CALL_GetLightiv(ctx
->Exec
, (light
, pname
, params
));
6966 static void GLAPIENTRY
6967 exec_GetMapdv(GLenum target
, GLenum query
, GLdouble
* v
)
6969 GET_CURRENT_CONTEXT(ctx
);
6970 FLUSH_VERTICES(ctx
, 0);
6971 CALL_GetMapdv(ctx
->Exec
, (target
, query
, v
));
6974 static void GLAPIENTRY
6975 exec_GetMapfv(GLenum target
, GLenum query
, GLfloat
* v
)
6977 GET_CURRENT_CONTEXT(ctx
);
6978 FLUSH_VERTICES(ctx
, 0);
6979 CALL_GetMapfv(ctx
->Exec
, (target
, query
, v
));
6982 static void GLAPIENTRY
6983 exec_GetMapiv(GLenum target
, GLenum query
, GLint
* v
)
6985 GET_CURRENT_CONTEXT(ctx
);
6986 FLUSH_VERTICES(ctx
, 0);
6987 CALL_GetMapiv(ctx
->Exec
, (target
, query
, v
));
6990 static void GLAPIENTRY
6991 exec_GetMaterialfv(GLenum face
, GLenum pname
, GLfloat
*params
)
6993 GET_CURRENT_CONTEXT(ctx
);
6994 FLUSH_VERTICES(ctx
, 0);
6995 CALL_GetMaterialfv(ctx
->Exec
, (face
, pname
, params
));
6998 static void GLAPIENTRY
6999 exec_GetMaterialiv(GLenum face
, GLenum pname
, GLint
*params
)
7001 GET_CURRENT_CONTEXT(ctx
);
7002 FLUSH_VERTICES(ctx
, 0);
7003 CALL_GetMaterialiv(ctx
->Exec
, (face
, pname
, params
));
7006 static void GLAPIENTRY
7007 exec_GetPixelMapfv(GLenum map
, GLfloat
*values
)
7009 GET_CURRENT_CONTEXT(ctx
);
7010 FLUSH_VERTICES(ctx
, 0);
7011 CALL_GetPixelMapfv(ctx
->Exec
, (map
, values
));
7014 static void GLAPIENTRY
7015 exec_GetPixelMapuiv(GLenum map
, GLuint
*values
)
7017 GET_CURRENT_CONTEXT(ctx
);
7018 FLUSH_VERTICES(ctx
, 0);
7019 CALL_GetPixelMapuiv(ctx
->Exec
, (map
, values
));
7022 static void GLAPIENTRY
7023 exec_GetPixelMapusv(GLenum map
, GLushort
*values
)
7025 GET_CURRENT_CONTEXT(ctx
);
7026 FLUSH_VERTICES(ctx
, 0);
7027 CALL_GetPixelMapusv(ctx
->Exec
, (map
, values
));
7030 static void GLAPIENTRY
7031 exec_GetPolygonStipple(GLubyte
* dest
)
7033 GET_CURRENT_CONTEXT(ctx
);
7034 FLUSH_VERTICES(ctx
, 0);
7035 CALL_GetPolygonStipple(ctx
->Exec
, (dest
));
7038 static const GLubyte
*GLAPIENTRY
7039 exec_GetString(GLenum name
)
7041 GET_CURRENT_CONTEXT(ctx
);
7042 FLUSH_VERTICES(ctx
, 0);
7043 return CALL_GetString(ctx
->Exec
, (name
));
7046 static void GLAPIENTRY
7047 exec_GetTexEnvfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7049 GET_CURRENT_CONTEXT(ctx
);
7050 FLUSH_VERTICES(ctx
, 0);
7051 CALL_GetTexEnvfv(ctx
->Exec
, (target
, pname
, params
));
7054 static void GLAPIENTRY
7055 exec_GetTexEnviv(GLenum target
, GLenum pname
, GLint
*params
)
7057 GET_CURRENT_CONTEXT(ctx
);
7058 FLUSH_VERTICES(ctx
, 0);
7059 CALL_GetTexEnviv(ctx
->Exec
, (target
, pname
, params
));
7062 static void GLAPIENTRY
7063 exec_GetTexGendv(GLenum coord
, GLenum pname
, GLdouble
*params
)
7065 GET_CURRENT_CONTEXT(ctx
);
7066 FLUSH_VERTICES(ctx
, 0);
7067 CALL_GetTexGendv(ctx
->Exec
, (coord
, pname
, params
));
7070 static void GLAPIENTRY
7071 exec_GetTexGenfv(GLenum coord
, GLenum pname
, GLfloat
*params
)
7073 GET_CURRENT_CONTEXT(ctx
);
7074 FLUSH_VERTICES(ctx
, 0);
7075 CALL_GetTexGenfv(ctx
->Exec
, (coord
, pname
, params
));
7078 static void GLAPIENTRY
7079 exec_GetTexGeniv(GLenum coord
, GLenum pname
, GLint
*params
)
7081 GET_CURRENT_CONTEXT(ctx
);
7082 FLUSH_VERTICES(ctx
, 0);
7083 CALL_GetTexGeniv(ctx
->Exec
, (coord
, pname
, params
));
7086 static void GLAPIENTRY
7087 exec_GetTexImage(GLenum target
, GLint level
, GLenum format
,
7088 GLenum type
, GLvoid
* pixels
)
7090 GET_CURRENT_CONTEXT(ctx
);
7091 FLUSH_VERTICES(ctx
, 0);
7092 CALL_GetTexImage(ctx
->Exec
, (target
, level
, format
, type
, pixels
));
7095 static void GLAPIENTRY
7096 exec_GetTexLevelParameterfv(GLenum target
, GLint level
,
7097 GLenum pname
, GLfloat
*params
)
7099 GET_CURRENT_CONTEXT(ctx
);
7100 FLUSH_VERTICES(ctx
, 0);
7101 CALL_GetTexLevelParameterfv(ctx
->Exec
, (target
, level
, pname
, params
));
7104 static void GLAPIENTRY
7105 exec_GetTexLevelParameteriv(GLenum target
, GLint level
,
7106 GLenum pname
, GLint
*params
)
7108 GET_CURRENT_CONTEXT(ctx
);
7109 FLUSH_VERTICES(ctx
, 0);
7110 CALL_GetTexLevelParameteriv(ctx
->Exec
, (target
, level
, pname
, params
));
7113 static void GLAPIENTRY
7114 exec_GetTexParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7116 GET_CURRENT_CONTEXT(ctx
);
7117 FLUSH_VERTICES(ctx
, 0);
7118 CALL_GetTexParameterfv(ctx
->Exec
, (target
, pname
, params
));
7121 static void GLAPIENTRY
7122 exec_GetTexParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7124 GET_CURRENT_CONTEXT(ctx
);
7125 FLUSH_VERTICES(ctx
, 0);
7126 CALL_GetTexParameteriv(ctx
->Exec
, (target
, pname
, params
));
7129 static GLboolean GLAPIENTRY
7130 exec_IsEnabled(GLenum cap
)
7132 GET_CURRENT_CONTEXT(ctx
);
7133 FLUSH_VERTICES(ctx
, 0);
7134 return CALL_IsEnabled(ctx
->Exec
, (cap
));
7137 static void GLAPIENTRY
7138 exec_PixelStoref(GLenum pname
, GLfloat param
)
7140 GET_CURRENT_CONTEXT(ctx
);
7141 FLUSH_VERTICES(ctx
, 0);
7142 CALL_PixelStoref(ctx
->Exec
, (pname
, param
));
7145 static void GLAPIENTRY
7146 exec_PixelStorei(GLenum pname
, GLint param
)
7148 GET_CURRENT_CONTEXT(ctx
);
7149 FLUSH_VERTICES(ctx
, 0);
7150 CALL_PixelStorei(ctx
->Exec
, (pname
, param
));
7153 static void GLAPIENTRY
7154 exec_ReadPixels(GLint x
, GLint y
, GLsizei width
, GLsizei height
,
7155 GLenum format
, GLenum type
, GLvoid
* pixels
)
7157 GET_CURRENT_CONTEXT(ctx
);
7158 FLUSH_VERTICES(ctx
, 0);
7159 CALL_ReadPixels(ctx
->Exec
, (x
, y
, width
, height
, format
, type
, pixels
));
7162 static GLint GLAPIENTRY
7163 exec_RenderMode(GLenum mode
)
7165 GET_CURRENT_CONTEXT(ctx
);
7166 FLUSH_VERTICES(ctx
, 0);
7167 return CALL_RenderMode(ctx
->Exec
, (mode
));
7170 static void GLAPIENTRY
7171 exec_FeedbackBuffer(GLsizei size
, GLenum type
, GLfloat
* buffer
)
7173 GET_CURRENT_CONTEXT(ctx
);
7174 FLUSH_VERTICES(ctx
, 0);
7175 CALL_FeedbackBuffer(ctx
->Exec
, (size
, type
, buffer
));
7178 static void GLAPIENTRY
7179 exec_SelectBuffer(GLsizei size
, GLuint
* buffer
)
7181 GET_CURRENT_CONTEXT(ctx
);
7182 FLUSH_VERTICES(ctx
, 0);
7183 CALL_SelectBuffer(ctx
->Exec
, (size
, buffer
));
7186 static GLboolean GLAPIENTRY
7187 exec_AreTexturesResident(GLsizei n
, const GLuint
* texName
,
7188 GLboolean
* residences
)
7190 GET_CURRENT_CONTEXT(ctx
);
7191 FLUSH_VERTICES(ctx
, 0);
7192 return CALL_AreTexturesResident(ctx
->Exec
, (n
, texName
, residences
));
7195 static void GLAPIENTRY
7196 exec_ColorPointer(GLint size
, GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
7198 GET_CURRENT_CONTEXT(ctx
);
7199 FLUSH_VERTICES(ctx
, 0);
7200 CALL_ColorPointer(ctx
->Exec
, (size
, type
, stride
, ptr
));
7203 static void GLAPIENTRY
7204 exec_DeleteTextures(GLsizei n
, const GLuint
* texName
)
7206 GET_CURRENT_CONTEXT(ctx
);
7207 FLUSH_VERTICES(ctx
, 0);
7208 CALL_DeleteTextures(ctx
->Exec
, (n
, texName
));
7211 static void GLAPIENTRY
7212 exec_DisableClientState(GLenum cap
)
7214 GET_CURRENT_CONTEXT(ctx
);
7215 FLUSH_VERTICES(ctx
, 0);
7216 CALL_DisableClientState(ctx
->Exec
, (cap
));
7219 static void GLAPIENTRY
7220 exec_EdgeFlagPointer(GLsizei stride
, const GLvoid
* vptr
)
7222 GET_CURRENT_CONTEXT(ctx
);
7223 FLUSH_VERTICES(ctx
, 0);
7224 CALL_EdgeFlagPointer(ctx
->Exec
, (stride
, vptr
));
7227 static void GLAPIENTRY
7228 exec_EnableClientState(GLenum cap
)
7230 GET_CURRENT_CONTEXT(ctx
);
7231 FLUSH_VERTICES(ctx
, 0);
7232 CALL_EnableClientState(ctx
->Exec
, (cap
));
7235 static void GLAPIENTRY
7236 exec_GenTextures(GLsizei n
, GLuint
* texName
)
7238 GET_CURRENT_CONTEXT(ctx
);
7239 FLUSH_VERTICES(ctx
, 0);
7240 CALL_GenTextures(ctx
->Exec
, (n
, texName
));
7243 static void GLAPIENTRY
7244 exec_GetPointerv(GLenum pname
, GLvoid
**params
)
7246 GET_CURRENT_CONTEXT(ctx
);
7247 FLUSH_VERTICES(ctx
, 0);
7248 CALL_GetPointerv(ctx
->Exec
, (pname
, params
));
7251 static void GLAPIENTRY
7252 exec_IndexPointer(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
7254 GET_CURRENT_CONTEXT(ctx
);
7255 FLUSH_VERTICES(ctx
, 0);
7256 CALL_IndexPointer(ctx
->Exec
, (type
, stride
, ptr
));
7259 static void GLAPIENTRY
7260 exec_InterleavedArrays(GLenum format
, GLsizei stride
, const GLvoid
* pointer
)
7262 GET_CURRENT_CONTEXT(ctx
);
7263 FLUSH_VERTICES(ctx
, 0);
7264 CALL_InterleavedArrays(ctx
->Exec
, (format
, stride
, pointer
));
7267 static GLboolean GLAPIENTRY
7268 exec_IsTexture(GLuint texture
)
7270 GET_CURRENT_CONTEXT(ctx
);
7271 FLUSH_VERTICES(ctx
, 0);
7272 return CALL_IsTexture(ctx
->Exec
, (texture
));
7275 static void GLAPIENTRY
7276 exec_NormalPointer(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
7278 GET_CURRENT_CONTEXT(ctx
);
7279 FLUSH_VERTICES(ctx
, 0);
7280 CALL_NormalPointer(ctx
->Exec
, (type
, stride
, ptr
));
7283 static void GLAPIENTRY
7284 exec_PopClientAttrib(void)
7286 GET_CURRENT_CONTEXT(ctx
);
7287 FLUSH_VERTICES(ctx
, 0);
7288 CALL_PopClientAttrib(ctx
->Exec
, ());
7291 static void GLAPIENTRY
7292 exec_PushClientAttrib(GLbitfield mask
)
7294 GET_CURRENT_CONTEXT(ctx
);
7295 FLUSH_VERTICES(ctx
, 0);
7296 CALL_PushClientAttrib(ctx
->Exec
, (mask
));
7299 static void GLAPIENTRY
7300 exec_TexCoordPointer(GLint size
, GLenum type
, GLsizei stride
,
7303 GET_CURRENT_CONTEXT(ctx
);
7304 FLUSH_VERTICES(ctx
, 0);
7305 CALL_TexCoordPointer(ctx
->Exec
, (size
, type
, stride
, ptr
));
7308 static void GLAPIENTRY
7309 exec_GetCompressedTexImageARB(GLenum target
, GLint level
, GLvoid
* img
)
7311 GET_CURRENT_CONTEXT(ctx
);
7312 FLUSH_VERTICES(ctx
, 0);
7313 CALL_GetCompressedTexImageARB(ctx
->Exec
, (target
, level
, img
));
7316 static void GLAPIENTRY
7317 exec_VertexPointer(GLint size
, GLenum type
, GLsizei stride
,
7320 GET_CURRENT_CONTEXT(ctx
);
7321 FLUSH_VERTICES(ctx
, 0);
7322 CALL_VertexPointer(ctx
->Exec
, (size
, type
, stride
, ptr
));
7325 static void GLAPIENTRY
7326 exec_CopyConvolutionFilter1D(GLenum target
, GLenum internalFormat
,
7327 GLint x
, GLint y
, GLsizei width
)
7329 GET_CURRENT_CONTEXT(ctx
);
7330 FLUSH_VERTICES(ctx
, 0);
7331 CALL_CopyConvolutionFilter1D(ctx
->Exec
,
7332 (target
, internalFormat
, x
, y
, width
));
7335 static void GLAPIENTRY
7336 exec_CopyConvolutionFilter2D(GLenum target
, GLenum internalFormat
,
7337 GLint x
, GLint y
, GLsizei width
, GLsizei height
)
7339 GET_CURRENT_CONTEXT(ctx
);
7340 FLUSH_VERTICES(ctx
, 0);
7341 CALL_CopyConvolutionFilter2D(ctx
->Exec
,
7342 (target
, internalFormat
, x
, y
, width
,
7346 static void GLAPIENTRY
7347 exec_GetColorTable(GLenum target
, GLenum format
, GLenum type
, GLvoid
* data
)
7349 GET_CURRENT_CONTEXT(ctx
);
7350 FLUSH_VERTICES(ctx
, 0);
7351 CALL_GetColorTable(ctx
->Exec
, (target
, format
, type
, data
));
7354 static void GLAPIENTRY
7355 exec_GetColorTableParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7357 GET_CURRENT_CONTEXT(ctx
);
7358 FLUSH_VERTICES(ctx
, 0);
7359 CALL_GetColorTableParameterfv(ctx
->Exec
, (target
, pname
, params
));
7362 static void GLAPIENTRY
7363 exec_GetColorTableParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7365 GET_CURRENT_CONTEXT(ctx
);
7366 FLUSH_VERTICES(ctx
, 0);
7367 CALL_GetColorTableParameteriv(ctx
->Exec
, (target
, pname
, params
));
7370 static void GLAPIENTRY
7371 exec_GetConvolutionFilter(GLenum target
, GLenum format
, GLenum type
,
7374 GET_CURRENT_CONTEXT(ctx
);
7375 FLUSH_VERTICES(ctx
, 0);
7376 CALL_GetConvolutionFilter(ctx
->Exec
, (target
, format
, type
, image
));
7379 static void GLAPIENTRY
7380 exec_GetConvolutionParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7382 GET_CURRENT_CONTEXT(ctx
);
7383 FLUSH_VERTICES(ctx
, 0);
7384 CALL_GetConvolutionParameterfv(ctx
->Exec
, (target
, pname
, params
));
7387 static void GLAPIENTRY
7388 exec_GetConvolutionParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7390 GET_CURRENT_CONTEXT(ctx
);
7391 FLUSH_VERTICES(ctx
, 0);
7392 CALL_GetConvolutionParameteriv(ctx
->Exec
, (target
, pname
, params
));
7395 static void GLAPIENTRY
7396 exec_GetHistogram(GLenum target
, GLboolean reset
, GLenum format
,
7397 GLenum type
, GLvoid
*values
)
7399 GET_CURRENT_CONTEXT(ctx
);
7400 FLUSH_VERTICES(ctx
, 0);
7401 CALL_GetHistogram(ctx
->Exec
, (target
, reset
, format
, type
, values
));
7404 static void GLAPIENTRY
7405 exec_GetHistogramParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7407 GET_CURRENT_CONTEXT(ctx
);
7408 FLUSH_VERTICES(ctx
, 0);
7409 CALL_GetHistogramParameterfv(ctx
->Exec
, (target
, pname
, params
));
7412 static void GLAPIENTRY
7413 exec_GetHistogramParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7415 GET_CURRENT_CONTEXT(ctx
);
7416 FLUSH_VERTICES(ctx
, 0);
7417 CALL_GetHistogramParameteriv(ctx
->Exec
, (target
, pname
, params
));
7420 static void GLAPIENTRY
7421 exec_GetMinmax(GLenum target
, GLboolean reset
, GLenum format
,
7422 GLenum type
, GLvoid
*values
)
7424 GET_CURRENT_CONTEXT(ctx
);
7425 FLUSH_VERTICES(ctx
, 0);
7426 CALL_GetMinmax(ctx
->Exec
, (target
, reset
, format
, type
, values
));
7429 static void GLAPIENTRY
7430 exec_GetMinmaxParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7432 GET_CURRENT_CONTEXT(ctx
);
7433 FLUSH_VERTICES(ctx
, 0);
7434 CALL_GetMinmaxParameterfv(ctx
->Exec
, (target
, pname
, params
));
7437 static void GLAPIENTRY
7438 exec_GetMinmaxParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7440 GET_CURRENT_CONTEXT(ctx
);
7441 FLUSH_VERTICES(ctx
, 0);
7442 CALL_GetMinmaxParameteriv(ctx
->Exec
, (target
, pname
, params
));
7445 static void GLAPIENTRY
7446 exec_GetSeparableFilter(GLenum target
, GLenum format
, GLenum type
,
7447 GLvoid
*row
, GLvoid
*column
, GLvoid
*span
)
7449 GET_CURRENT_CONTEXT(ctx
);
7450 FLUSH_VERTICES(ctx
, 0);
7451 CALL_GetSeparableFilter(ctx
->Exec
,
7452 (target
, format
, type
, row
, column
, span
));
7455 static void GLAPIENTRY
7456 exec_SeparableFilter2D(GLenum target
, GLenum internalFormat
,
7457 GLsizei width
, GLsizei height
, GLenum format
,
7458 GLenum type
, const GLvoid
*row
, const GLvoid
*column
)
7460 GET_CURRENT_CONTEXT(ctx
);
7461 FLUSH_VERTICES(ctx
, 0);
7462 CALL_SeparableFilter2D(ctx
->Exec
,
7463 (target
, internalFormat
, width
, height
, format
,
7464 type
, row
, column
));
7467 static void GLAPIENTRY
7468 exec_ColorPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
7469 GLsizei count
, const GLvoid
*ptr
)
7471 GET_CURRENT_CONTEXT(ctx
);
7472 FLUSH_VERTICES(ctx
, 0);
7473 CALL_ColorPointerEXT(ctx
->Exec
, (size
, type
, stride
, count
, ptr
));
7476 static void GLAPIENTRY
7477 exec_EdgeFlagPointerEXT(GLsizei stride
, GLsizei count
, const GLboolean
*ptr
)
7479 GET_CURRENT_CONTEXT(ctx
);
7480 FLUSH_VERTICES(ctx
, 0);
7481 CALL_EdgeFlagPointerEXT(ctx
->Exec
, (stride
, count
, ptr
));
7484 static void GLAPIENTRY
7485 exec_IndexPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
,
7488 GET_CURRENT_CONTEXT(ctx
);
7489 FLUSH_VERTICES(ctx
, 0);
7490 CALL_IndexPointerEXT(ctx
->Exec
, (type
, stride
, count
, ptr
));
7493 static void GLAPIENTRY
7494 exec_NormalPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
,
7497 GET_CURRENT_CONTEXT(ctx
);
7498 FLUSH_VERTICES(ctx
, 0);
7499 CALL_NormalPointerEXT(ctx
->Exec
, (type
, stride
, count
, ptr
));
7502 static void GLAPIENTRY
7503 exec_TexCoordPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
7504 GLsizei count
, const GLvoid
*ptr
)
7506 GET_CURRENT_CONTEXT(ctx
);
7507 FLUSH_VERTICES(ctx
, 0);
7508 CALL_TexCoordPointerEXT(ctx
->Exec
, (size
, type
, stride
, count
, ptr
));
7511 static void GLAPIENTRY
7512 exec_VertexPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
7513 GLsizei count
, const GLvoid
*ptr
)
7515 GET_CURRENT_CONTEXT(ctx
);
7516 FLUSH_VERTICES(ctx
, 0);
7517 CALL_VertexPointerEXT(ctx
->Exec
, (size
, type
, stride
, count
, ptr
));
7520 static void GLAPIENTRY
7521 exec_LockArraysEXT(GLint first
, GLsizei count
)
7523 GET_CURRENT_CONTEXT(ctx
);
7524 FLUSH_VERTICES(ctx
, 0);
7525 CALL_LockArraysEXT(ctx
->Exec
, (first
, count
));
7528 static void GLAPIENTRY
7529 exec_UnlockArraysEXT(void)
7531 GET_CURRENT_CONTEXT(ctx
);
7532 FLUSH_VERTICES(ctx
, 0);
7533 CALL_UnlockArraysEXT(ctx
->Exec
, ());
7536 static void GLAPIENTRY
7537 exec_ClientActiveTextureARB(GLenum target
)
7539 GET_CURRENT_CONTEXT(ctx
);
7540 FLUSH_VERTICES(ctx
, 0);
7541 CALL_ClientActiveTextureARB(ctx
->Exec
, (target
));
7544 static void GLAPIENTRY
7545 exec_SecondaryColorPointerEXT(GLint size
, GLenum type
,
7546 GLsizei stride
, const GLvoid
*ptr
)
7548 GET_CURRENT_CONTEXT(ctx
);
7549 FLUSH_VERTICES(ctx
, 0);
7550 CALL_SecondaryColorPointerEXT(ctx
->Exec
, (size
, type
, stride
, ptr
));
7553 static void GLAPIENTRY
7554 exec_FogCoordPointerEXT(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
7556 GET_CURRENT_CONTEXT(ctx
);
7557 FLUSH_VERTICES(ctx
, 0);
7558 CALL_FogCoordPointerEXT(ctx
->Exec
, (type
, stride
, ptr
));
7561 /* GL_EXT_multi_draw_arrays */
7562 static void GLAPIENTRY
7563 exec_MultiDrawArraysEXT(GLenum mode
, GLint
* first
,
7564 GLsizei
* count
, GLsizei primcount
)
7566 GET_CURRENT_CONTEXT(ctx
);
7567 FLUSH_VERTICES(ctx
, 0);
7568 CALL_MultiDrawArraysEXT(ctx
->Exec
, (mode
, first
, count
, primcount
));
7571 /* GL_EXT_multi_draw_arrays */
7572 static void GLAPIENTRY
7573 exec_MultiDrawElementsEXT(GLenum mode
, const GLsizei
* count
,
7574 GLenum type
, const GLvoid
** indices
,
7577 GET_CURRENT_CONTEXT(ctx
);
7578 FLUSH_VERTICES(ctx
, 0);
7579 CALL_MultiDrawElementsEXT(ctx
->Exec
,
7580 (mode
, count
, type
, indices
, primcount
));
7583 /* GL_IBM_multimode_draw_arrays */
7584 static void GLAPIENTRY
7585 exec_MultiModeDrawArraysIBM(const GLenum
* mode
, const GLint
* first
,
7586 const GLsizei
* count
, GLsizei primcount
,
7589 GET_CURRENT_CONTEXT(ctx
);
7590 FLUSH_VERTICES(ctx
, 0);
7591 CALL_MultiModeDrawArraysIBM(ctx
->Exec
,
7592 (mode
, first
, count
, primcount
, modestride
));
7595 /* GL_IBM_multimode_draw_arrays */
7596 static void GLAPIENTRY
7597 exec_MultiModeDrawElementsIBM(const GLenum
* mode
,
7598 const GLsizei
* count
,
7600 const GLvoid
* const *indices
,
7601 GLsizei primcount
, GLint modestride
)
7603 GET_CURRENT_CONTEXT(ctx
);
7604 FLUSH_VERTICES(ctx
, 0);
7605 CALL_MultiModeDrawElementsIBM(ctx
->Exec
,
7606 (mode
, count
, type
, indices
, primcount
,
7613 * Setup the given dispatch table to point to Mesa's display list
7614 * building functions.
7616 * This does not include any of the tnl functions - they are
7617 * initialized from _mesa_init_api_defaults and from the active vtxfmt
7621 _mesa_init_dlist_table(struct _glapi_table
*table
)
7623 _mesa_loopback_init_api_table(table
);
7626 SET_Accum(table
, save_Accum
);
7627 SET_AlphaFunc(table
, save_AlphaFunc
);
7628 SET_Bitmap(table
, save_Bitmap
);
7629 SET_BlendFunc(table
, _mesa_BlendFunc
); /* loops-back to BlendFuncSeparate */
7630 SET_CallList(table
, _mesa_save_CallList
);
7631 SET_CallLists(table
, _mesa_save_CallLists
);
7632 SET_Clear(table
, save_Clear
);
7633 SET_ClearAccum(table
, save_ClearAccum
);
7634 SET_ClearColor(table
, save_ClearColor
);
7635 SET_ClearDepth(table
, save_ClearDepth
);
7636 SET_ClearIndex(table
, save_ClearIndex
);
7637 SET_ClearStencil(table
, save_ClearStencil
);
7638 SET_ClipPlane(table
, save_ClipPlane
);
7639 SET_ColorMask(table
, save_ColorMask
);
7640 SET_ColorMaterial(table
, save_ColorMaterial
);
7641 SET_CopyPixels(table
, save_CopyPixels
);
7642 SET_CullFace(table
, save_CullFace
);
7643 SET_DeleteLists(table
, _mesa_DeleteLists
);
7644 SET_DepthFunc(table
, save_DepthFunc
);
7645 SET_DepthMask(table
, save_DepthMask
);
7646 SET_DepthRange(table
, save_DepthRange
);
7647 SET_Disable(table
, save_Disable
);
7648 SET_DrawBuffer(table
, save_DrawBuffer
);
7649 SET_DrawPixels(table
, save_DrawPixels
);
7650 SET_Enable(table
, save_Enable
);
7651 SET_EndList(table
, _mesa_EndList
);
7652 SET_EvalMesh1(table
, _mesa_save_EvalMesh1
);
7653 SET_EvalMesh2(table
, _mesa_save_EvalMesh2
);
7654 SET_Finish(table
, exec_Finish
);
7655 SET_Flush(table
, exec_Flush
);
7656 SET_Fogf(table
, save_Fogf
);
7657 SET_Fogfv(table
, save_Fogfv
);
7658 SET_Fogi(table
, save_Fogi
);
7659 SET_Fogiv(table
, save_Fogiv
);
7660 SET_FrontFace(table
, save_FrontFace
);
7661 SET_Frustum(table
, save_Frustum
);
7662 SET_GenLists(table
, _mesa_GenLists
);
7663 SET_GetBooleanv(table
, exec_GetBooleanv
);
7664 SET_GetClipPlane(table
, exec_GetClipPlane
);
7665 SET_GetDoublev(table
, exec_GetDoublev
);
7666 SET_GetError(table
, exec_GetError
);
7667 SET_GetFloatv(table
, exec_GetFloatv
);
7668 SET_GetIntegerv(table
, exec_GetIntegerv
);
7669 SET_GetLightfv(table
, exec_GetLightfv
);
7670 SET_GetLightiv(table
, exec_GetLightiv
);
7671 SET_GetMapdv(table
, exec_GetMapdv
);
7672 SET_GetMapfv(table
, exec_GetMapfv
);
7673 SET_GetMapiv(table
, exec_GetMapiv
);
7674 SET_GetMaterialfv(table
, exec_GetMaterialfv
);
7675 SET_GetMaterialiv(table
, exec_GetMaterialiv
);
7676 SET_GetPixelMapfv(table
, exec_GetPixelMapfv
);
7677 SET_GetPixelMapuiv(table
, exec_GetPixelMapuiv
);
7678 SET_GetPixelMapusv(table
, exec_GetPixelMapusv
);
7679 SET_GetPolygonStipple(table
, exec_GetPolygonStipple
);
7680 SET_GetString(table
, exec_GetString
);
7681 SET_GetTexEnvfv(table
, exec_GetTexEnvfv
);
7682 SET_GetTexEnviv(table
, exec_GetTexEnviv
);
7683 SET_GetTexGendv(table
, exec_GetTexGendv
);
7684 SET_GetTexGenfv(table
, exec_GetTexGenfv
);
7685 SET_GetTexGeniv(table
, exec_GetTexGeniv
);
7686 SET_GetTexImage(table
, exec_GetTexImage
);
7687 SET_GetTexLevelParameterfv(table
, exec_GetTexLevelParameterfv
);
7688 SET_GetTexLevelParameteriv(table
, exec_GetTexLevelParameteriv
);
7689 SET_GetTexParameterfv(table
, exec_GetTexParameterfv
);
7690 SET_GetTexParameteriv(table
, exec_GetTexParameteriv
);
7691 SET_Hint(table
, save_Hint
);
7692 SET_IndexMask(table
, save_IndexMask
);
7693 SET_InitNames(table
, save_InitNames
);
7694 SET_IsEnabled(table
, exec_IsEnabled
);
7695 SET_IsList(table
, _mesa_IsList
);
7696 SET_LightModelf(table
, save_LightModelf
);
7697 SET_LightModelfv(table
, save_LightModelfv
);
7698 SET_LightModeli(table
, save_LightModeli
);
7699 SET_LightModeliv(table
, save_LightModeliv
);
7700 SET_Lightf(table
, save_Lightf
);
7701 SET_Lightfv(table
, save_Lightfv
);
7702 SET_Lighti(table
, save_Lighti
);
7703 SET_Lightiv(table
, save_Lightiv
);
7704 SET_LineStipple(table
, save_LineStipple
);
7705 SET_LineWidth(table
, save_LineWidth
);
7706 SET_ListBase(table
, save_ListBase
);
7707 SET_LoadIdentity(table
, save_LoadIdentity
);
7708 SET_LoadMatrixd(table
, save_LoadMatrixd
);
7709 SET_LoadMatrixf(table
, save_LoadMatrixf
);
7710 SET_LoadName(table
, save_LoadName
);
7711 SET_LogicOp(table
, save_LogicOp
);
7712 SET_Map1d(table
, save_Map1d
);
7713 SET_Map1f(table
, save_Map1f
);
7714 SET_Map2d(table
, save_Map2d
);
7715 SET_Map2f(table
, save_Map2f
);
7716 SET_MapGrid1d(table
, save_MapGrid1d
);
7717 SET_MapGrid1f(table
, save_MapGrid1f
);
7718 SET_MapGrid2d(table
, save_MapGrid2d
);
7719 SET_MapGrid2f(table
, save_MapGrid2f
);
7720 SET_MatrixMode(table
, save_MatrixMode
);
7721 SET_MultMatrixd(table
, save_MultMatrixd
);
7722 SET_MultMatrixf(table
, save_MultMatrixf
);
7723 SET_NewList(table
, save_NewList
);
7724 SET_Ortho(table
, save_Ortho
);
7725 SET_PassThrough(table
, save_PassThrough
);
7726 SET_PixelMapfv(table
, save_PixelMapfv
);
7727 SET_PixelMapuiv(table
, save_PixelMapuiv
);
7728 SET_PixelMapusv(table
, save_PixelMapusv
);
7729 SET_PixelStoref(table
, exec_PixelStoref
);
7730 SET_PixelStorei(table
, exec_PixelStorei
);
7731 SET_PixelTransferf(table
, save_PixelTransferf
);
7732 SET_PixelTransferi(table
, save_PixelTransferi
);
7733 SET_PixelZoom(table
, save_PixelZoom
);
7734 SET_PointSize(table
, save_PointSize
);
7735 SET_PolygonMode(table
, save_PolygonMode
);
7736 SET_PolygonOffset(table
, save_PolygonOffset
);
7737 SET_PolygonStipple(table
, save_PolygonStipple
);
7738 SET_PopAttrib(table
, save_PopAttrib
);
7739 SET_PopMatrix(table
, save_PopMatrix
);
7740 SET_PopName(table
, save_PopName
);
7741 SET_PushAttrib(table
, save_PushAttrib
);
7742 SET_PushMatrix(table
, save_PushMatrix
);
7743 SET_PushName(table
, save_PushName
);
7744 SET_RasterPos2d(table
, save_RasterPos2d
);
7745 SET_RasterPos2dv(table
, save_RasterPos2dv
);
7746 SET_RasterPos2f(table
, save_RasterPos2f
);
7747 SET_RasterPos2fv(table
, save_RasterPos2fv
);
7748 SET_RasterPos2i(table
, save_RasterPos2i
);
7749 SET_RasterPos2iv(table
, save_RasterPos2iv
);
7750 SET_RasterPos2s(table
, save_RasterPos2s
);
7751 SET_RasterPos2sv(table
, save_RasterPos2sv
);
7752 SET_RasterPos3d(table
, save_RasterPos3d
);
7753 SET_RasterPos3dv(table
, save_RasterPos3dv
);
7754 SET_RasterPos3f(table
, save_RasterPos3f
);
7755 SET_RasterPos3fv(table
, save_RasterPos3fv
);
7756 SET_RasterPos3i(table
, save_RasterPos3i
);
7757 SET_RasterPos3iv(table
, save_RasterPos3iv
);
7758 SET_RasterPos3s(table
, save_RasterPos3s
);
7759 SET_RasterPos3sv(table
, save_RasterPos3sv
);
7760 SET_RasterPos4d(table
, save_RasterPos4d
);
7761 SET_RasterPos4dv(table
, save_RasterPos4dv
);
7762 SET_RasterPos4f(table
, save_RasterPos4f
);
7763 SET_RasterPos4fv(table
, save_RasterPos4fv
);
7764 SET_RasterPos4i(table
, save_RasterPos4i
);
7765 SET_RasterPos4iv(table
, save_RasterPos4iv
);
7766 SET_RasterPos4s(table
, save_RasterPos4s
);
7767 SET_RasterPos4sv(table
, save_RasterPos4sv
);
7768 SET_ReadBuffer(table
, save_ReadBuffer
);
7769 SET_ReadPixels(table
, exec_ReadPixels
);
7770 SET_RenderMode(table
, exec_RenderMode
);
7771 SET_Rotated(table
, save_Rotated
);
7772 SET_Rotatef(table
, save_Rotatef
);
7773 SET_Scaled(table
, save_Scaled
);
7774 SET_Scalef(table
, save_Scalef
);
7775 SET_Scissor(table
, save_Scissor
);
7776 SET_FeedbackBuffer(table
, exec_FeedbackBuffer
);
7777 SET_SelectBuffer(table
, exec_SelectBuffer
);
7778 SET_ShadeModel(table
, save_ShadeModel
);
7779 SET_StencilFunc(table
, save_StencilFunc
);
7780 SET_StencilMask(table
, save_StencilMask
);
7781 SET_StencilOp(table
, save_StencilOp
);
7782 SET_TexEnvf(table
, save_TexEnvf
);
7783 SET_TexEnvfv(table
, save_TexEnvfv
);
7784 SET_TexEnvi(table
, save_TexEnvi
);
7785 SET_TexEnviv(table
, save_TexEnviv
);
7786 SET_TexGend(table
, save_TexGend
);
7787 SET_TexGendv(table
, save_TexGendv
);
7788 SET_TexGenf(table
, save_TexGenf
);
7789 SET_TexGenfv(table
, save_TexGenfv
);
7790 SET_TexGeni(table
, save_TexGeni
);
7791 SET_TexGeniv(table
, save_TexGeniv
);
7792 SET_TexImage1D(table
, save_TexImage1D
);
7793 SET_TexImage2D(table
, save_TexImage2D
);
7794 SET_TexParameterf(table
, save_TexParameterf
);
7795 SET_TexParameterfv(table
, save_TexParameterfv
);
7796 SET_TexParameteri(table
, save_TexParameteri
);
7797 SET_TexParameteriv(table
, save_TexParameteriv
);
7798 SET_Translated(table
, save_Translated
);
7799 SET_Translatef(table
, save_Translatef
);
7800 SET_Viewport(table
, save_Viewport
);
7803 SET_AreTexturesResident(table
, exec_AreTexturesResident
);
7804 SET_BindTexture(table
, save_BindTexture
);
7805 SET_ColorPointer(table
, exec_ColorPointer
);
7806 SET_CopyTexImage1D(table
, save_CopyTexImage1D
);
7807 SET_CopyTexImage2D(table
, save_CopyTexImage2D
);
7808 SET_CopyTexSubImage1D(table
, save_CopyTexSubImage1D
);
7809 SET_CopyTexSubImage2D(table
, save_CopyTexSubImage2D
);
7810 SET_DeleteTextures(table
, exec_DeleteTextures
);
7811 SET_DisableClientState(table
, exec_DisableClientState
);
7812 SET_EdgeFlagPointer(table
, exec_EdgeFlagPointer
);
7813 SET_EnableClientState(table
, exec_EnableClientState
);
7814 SET_GenTextures(table
, exec_GenTextures
);
7815 SET_GetPointerv(table
, exec_GetPointerv
);
7816 SET_IndexPointer(table
, exec_IndexPointer
);
7817 SET_InterleavedArrays(table
, exec_InterleavedArrays
);
7818 SET_IsTexture(table
, exec_IsTexture
);
7819 SET_NormalPointer(table
, exec_NormalPointer
);
7820 SET_PopClientAttrib(table
, exec_PopClientAttrib
);
7821 SET_PrioritizeTextures(table
, save_PrioritizeTextures
);
7822 SET_PushClientAttrib(table
, exec_PushClientAttrib
);
7823 SET_TexCoordPointer(table
, exec_TexCoordPointer
);
7824 SET_TexSubImage1D(table
, save_TexSubImage1D
);
7825 SET_TexSubImage2D(table
, save_TexSubImage2D
);
7826 SET_VertexPointer(table
, exec_VertexPointer
);
7829 SET_CopyTexSubImage3D(table
, save_CopyTexSubImage3D
);
7830 SET_TexImage3D(table
, save_TexImage3D
);
7831 SET_TexSubImage3D(table
, save_TexSubImage3D
);
7834 SET_StencilFuncSeparate(table
, save_StencilFuncSeparate
);
7835 SET_StencilMaskSeparate(table
, save_StencilMaskSeparate
);
7836 SET_StencilOpSeparate(table
, save_StencilOpSeparate
);
7838 /* GL_ARB_imaging */
7839 /* Not all are supported */
7840 SET_BlendColor(table
, save_BlendColor
);
7841 SET_BlendEquation(table
, save_BlendEquation
);
7842 SET_ColorSubTable(table
, save_ColorSubTable
);
7843 SET_ColorTable(table
, save_ColorTable
);
7844 SET_ColorTableParameterfv(table
, save_ColorTableParameterfv
);
7845 SET_ColorTableParameteriv(table
, save_ColorTableParameteriv
);
7846 SET_ConvolutionFilter1D(table
, save_ConvolutionFilter1D
);
7847 SET_ConvolutionFilter2D(table
, save_ConvolutionFilter2D
);
7848 SET_ConvolutionParameterf(table
, save_ConvolutionParameterf
);
7849 SET_ConvolutionParameterfv(table
, save_ConvolutionParameterfv
);
7850 SET_ConvolutionParameteri(table
, save_ConvolutionParameteri
);
7851 SET_ConvolutionParameteriv(table
, save_ConvolutionParameteriv
);
7852 SET_CopyColorSubTable(table
, save_CopyColorSubTable
);
7853 SET_CopyColorTable(table
, save_CopyColorTable
);
7854 SET_CopyConvolutionFilter1D(table
, exec_CopyConvolutionFilter1D
);
7855 SET_CopyConvolutionFilter2D(table
, exec_CopyConvolutionFilter2D
);
7856 SET_GetColorTable(table
, exec_GetColorTable
);
7857 SET_GetColorTableParameterfv(table
, exec_GetColorTableParameterfv
);
7858 SET_GetColorTableParameteriv(table
, exec_GetColorTableParameteriv
);
7859 SET_GetConvolutionFilter(table
, exec_GetConvolutionFilter
);
7860 SET_GetConvolutionParameterfv(table
, exec_GetConvolutionParameterfv
);
7861 SET_GetConvolutionParameteriv(table
, exec_GetConvolutionParameteriv
);
7862 SET_GetHistogram(table
, exec_GetHistogram
);
7863 SET_GetHistogramParameterfv(table
, exec_GetHistogramParameterfv
);
7864 SET_GetHistogramParameteriv(table
, exec_GetHistogramParameteriv
);
7865 SET_GetMinmax(table
, exec_GetMinmax
);
7866 SET_GetMinmaxParameterfv(table
, exec_GetMinmaxParameterfv
);
7867 SET_GetMinmaxParameteriv(table
, exec_GetMinmaxParameteriv
);
7868 SET_GetSeparableFilter(table
, exec_GetSeparableFilter
);
7869 SET_Histogram(table
, save_Histogram
);
7870 SET_Minmax(table
, save_Minmax
);
7871 SET_ResetHistogram(table
, save_ResetHistogram
);
7872 SET_ResetMinmax(table
, save_ResetMinmax
);
7873 SET_SeparableFilter2D(table
, exec_SeparableFilter2D
);
7875 /* 2. GL_EXT_blend_color */
7877 SET_BlendColorEXT(table
, save_BlendColorEXT
);
7880 /* 3. GL_EXT_polygon_offset */
7881 SET_PolygonOffsetEXT(table
, save_PolygonOffsetEXT
);
7883 /* 6. GL_EXT_texture3d */
7885 SET_CopyTexSubImage3DEXT(table
, save_CopyTexSubImage3D
);
7886 SET_TexImage3DEXT(table
, save_TexImage3DEXT
);
7887 SET_TexSubImage3DEXT(table
, save_TexSubImage3D
);
7890 /* 14. GL_SGI_color_table */
7892 SET_ColorTableSGI(table
, save_ColorTable
);
7893 SET_ColorSubTableSGI(table
, save_ColorSubTable
);
7894 SET_GetColorTableSGI(table
, exec_GetColorTable
);
7895 SET_GetColorTableParameterfvSGI(table
, exec_GetColorTableParameterfv
);
7896 SET_GetColorTableParameterivSGI(table
, exec_GetColorTableParameteriv
);
7899 /* 30. GL_EXT_vertex_array */
7900 SET_ColorPointerEXT(table
, exec_ColorPointerEXT
);
7901 SET_EdgeFlagPointerEXT(table
, exec_EdgeFlagPointerEXT
);
7902 SET_IndexPointerEXT(table
, exec_IndexPointerEXT
);
7903 SET_NormalPointerEXT(table
, exec_NormalPointerEXT
);
7904 SET_TexCoordPointerEXT(table
, exec_TexCoordPointerEXT
);
7905 SET_VertexPointerEXT(table
, exec_VertexPointerEXT
);
7907 /* 37. GL_EXT_blend_minmax */
7909 SET_BlendEquationEXT(table
, save_BlendEquationEXT
);
7912 /* 54. GL_EXT_point_parameters */
7913 SET_PointParameterfEXT(table
, save_PointParameterfEXT
);
7914 SET_PointParameterfvEXT(table
, save_PointParameterfvEXT
);
7916 /* 97. GL_EXT_compiled_vertex_array */
7917 SET_LockArraysEXT(table
, exec_LockArraysEXT
);
7918 SET_UnlockArraysEXT(table
, exec_UnlockArraysEXT
);
7920 /* 145. GL_EXT_secondary_color */
7921 SET_SecondaryColorPointerEXT(table
, exec_SecondaryColorPointerEXT
);
7923 /* 148. GL_EXT_multi_draw_arrays */
7924 SET_MultiDrawArraysEXT(table
, exec_MultiDrawArraysEXT
);
7925 SET_MultiDrawElementsEXT(table
, exec_MultiDrawElementsEXT
);
7927 /* 149. GL_EXT_fog_coord */
7928 SET_FogCoordPointerEXT(table
, exec_FogCoordPointerEXT
);
7930 /* 173. GL_EXT_blend_func_separate */
7931 SET_BlendFuncSeparateEXT(table
, save_BlendFuncSeparateEXT
);
7933 /* 196. GL_MESA_resize_buffers */
7934 SET_ResizeBuffersMESA(table
, _mesa_ResizeBuffersMESA
);
7936 /* 197. GL_MESA_window_pos */
7937 SET_WindowPos2dMESA(table
, save_WindowPos2dMESA
);
7938 SET_WindowPos2dvMESA(table
, save_WindowPos2dvMESA
);
7939 SET_WindowPos2fMESA(table
, save_WindowPos2fMESA
);
7940 SET_WindowPos2fvMESA(table
, save_WindowPos2fvMESA
);
7941 SET_WindowPos2iMESA(table
, save_WindowPos2iMESA
);
7942 SET_WindowPos2ivMESA(table
, save_WindowPos2ivMESA
);
7943 SET_WindowPos2sMESA(table
, save_WindowPos2sMESA
);
7944 SET_WindowPos2svMESA(table
, save_WindowPos2svMESA
);
7945 SET_WindowPos3dMESA(table
, save_WindowPos3dMESA
);
7946 SET_WindowPos3dvMESA(table
, save_WindowPos3dvMESA
);
7947 SET_WindowPos3fMESA(table
, save_WindowPos3fMESA
);
7948 SET_WindowPos3fvMESA(table
, save_WindowPos3fvMESA
);
7949 SET_WindowPos3iMESA(table
, save_WindowPos3iMESA
);
7950 SET_WindowPos3ivMESA(table
, save_WindowPos3ivMESA
);
7951 SET_WindowPos3sMESA(table
, save_WindowPos3sMESA
);
7952 SET_WindowPos3svMESA(table
, save_WindowPos3svMESA
);
7953 SET_WindowPos4dMESA(table
, save_WindowPos4dMESA
);
7954 SET_WindowPos4dvMESA(table
, save_WindowPos4dvMESA
);
7955 SET_WindowPos4fMESA(table
, save_WindowPos4fMESA
);
7956 SET_WindowPos4fvMESA(table
, save_WindowPos4fvMESA
);
7957 SET_WindowPos4iMESA(table
, save_WindowPos4iMESA
);
7958 SET_WindowPos4ivMESA(table
, save_WindowPos4ivMESA
);
7959 SET_WindowPos4sMESA(table
, save_WindowPos4sMESA
);
7960 SET_WindowPos4svMESA(table
, save_WindowPos4svMESA
);
7962 /* 200. GL_IBM_multimode_draw_arrays */
7963 SET_MultiModeDrawArraysIBM(table
, exec_MultiModeDrawArraysIBM
);
7964 SET_MultiModeDrawElementsIBM(table
, exec_MultiModeDrawElementsIBM
);
7966 #if FEATURE_NV_vertex_program
7967 /* 233. GL_NV_vertex_program */
7968 /* The following commands DO NOT go into display lists:
7969 * AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV,
7970 * VertexAttribPointerNV, GetProgram*, GetVertexAttrib*
7972 SET_BindProgramNV(table
, save_BindProgramNV
);
7973 SET_DeleteProgramsNV(table
, _mesa_DeletePrograms
);
7974 SET_ExecuteProgramNV(table
, save_ExecuteProgramNV
);
7975 SET_GenProgramsNV(table
, _mesa_GenPrograms
);
7976 SET_AreProgramsResidentNV(table
, _mesa_AreProgramsResidentNV
);
7977 SET_RequestResidentProgramsNV(table
, save_RequestResidentProgramsNV
);
7978 SET_GetProgramParameterfvNV(table
, _mesa_GetProgramParameterfvNV
);
7979 SET_GetProgramParameterdvNV(table
, _mesa_GetProgramParameterdvNV
);
7980 SET_GetProgramivNV(table
, _mesa_GetProgramivNV
);
7981 SET_GetProgramStringNV(table
, _mesa_GetProgramStringNV
);
7982 SET_GetTrackMatrixivNV(table
, _mesa_GetTrackMatrixivNV
);
7983 SET_GetVertexAttribdvNV(table
, _mesa_GetVertexAttribdvNV
);
7984 SET_GetVertexAttribfvNV(table
, _mesa_GetVertexAttribfvNV
);
7985 SET_GetVertexAttribivNV(table
, _mesa_GetVertexAttribivNV
);
7986 SET_GetVertexAttribPointervNV(table
, _mesa_GetVertexAttribPointervNV
);
7987 SET_IsProgramNV(table
, _mesa_IsProgramARB
);
7988 SET_LoadProgramNV(table
, save_LoadProgramNV
);
7989 SET_ProgramEnvParameter4dARB(table
, save_ProgramEnvParameter4dARB
);
7990 SET_ProgramEnvParameter4dvARB(table
, save_ProgramEnvParameter4dvARB
);
7991 SET_ProgramEnvParameter4fARB(table
, save_ProgramEnvParameter4fARB
);
7992 SET_ProgramEnvParameter4fvARB(table
, save_ProgramEnvParameter4fvARB
);
7993 SET_ProgramParameters4dvNV(table
, save_ProgramParameters4dvNV
);
7994 SET_ProgramParameters4fvNV(table
, save_ProgramParameters4fvNV
);
7995 SET_TrackMatrixNV(table
, save_TrackMatrixNV
);
7996 SET_VertexAttribPointerNV(table
, _mesa_VertexAttribPointerNV
);
7999 /* 245. GL_ATI_fragment_shader */
8000 #if FEATURE_ATI_fragment_shader
8001 SET_BindFragmentShaderATI(table
, save_BindFragmentShaderATI
);
8002 SET_SetFragmentShaderConstantATI(table
, save_SetFragmentShaderConstantATI
);
8005 /* 282. GL_NV_fragment_program */
8006 #if FEATURE_NV_fragment_program
8007 SET_ProgramNamedParameter4fNV(table
, save_ProgramNamedParameter4fNV
);
8008 SET_ProgramNamedParameter4dNV(table
, save_ProgramNamedParameter4dNV
);
8009 SET_ProgramNamedParameter4fvNV(table
, save_ProgramNamedParameter4fvNV
);
8010 SET_ProgramNamedParameter4dvNV(table
, save_ProgramNamedParameter4dvNV
);
8011 SET_GetProgramNamedParameterfvNV(table
,
8012 _mesa_GetProgramNamedParameterfvNV
);
8013 SET_GetProgramNamedParameterdvNV(table
,
8014 _mesa_GetProgramNamedParameterdvNV
);
8015 SET_ProgramLocalParameter4dARB(table
, save_ProgramLocalParameter4dARB
);
8016 SET_ProgramLocalParameter4dvARB(table
, save_ProgramLocalParameter4dvARB
);
8017 SET_ProgramLocalParameter4fARB(table
, save_ProgramLocalParameter4fARB
);
8018 SET_ProgramLocalParameter4fvARB(table
, save_ProgramLocalParameter4fvARB
);
8019 SET_GetProgramLocalParameterdvARB(table
,
8020 _mesa_GetProgramLocalParameterdvARB
);
8021 SET_GetProgramLocalParameterfvARB(table
,
8022 _mesa_GetProgramLocalParameterfvARB
);
8025 /* 262. GL_NV_point_sprite */
8026 SET_PointParameteriNV(table
, save_PointParameteriNV
);
8027 SET_PointParameterivNV(table
, save_PointParameterivNV
);
8029 /* 268. GL_EXT_stencil_two_side */
8030 SET_ActiveStencilFaceEXT(table
, save_ActiveStencilFaceEXT
);
8032 /* 273. GL_APPLE_vertex_array_object */
8033 SET_BindVertexArrayAPPLE(table
, _mesa_BindVertexArrayAPPLE
);
8034 SET_DeleteVertexArraysAPPLE(table
, _mesa_DeleteVertexArraysAPPLE
);
8035 SET_GenVertexArraysAPPLE(table
, _mesa_GenVertexArraysAPPLE
);
8036 SET_IsVertexArrayAPPLE(table
, _mesa_IsVertexArrayAPPLE
);
8038 /* ???. GL_EXT_depth_bounds_test */
8039 SET_DepthBoundsEXT(table
, save_DepthBoundsEXT
);
8041 /* ARB 1. GL_ARB_multitexture */
8042 SET_ActiveTextureARB(table
, save_ActiveTextureARB
);
8043 SET_ClientActiveTextureARB(table
, exec_ClientActiveTextureARB
);
8045 /* ARB 3. GL_ARB_transpose_matrix */
8046 SET_LoadTransposeMatrixdARB(table
, save_LoadTransposeMatrixdARB
);
8047 SET_LoadTransposeMatrixfARB(table
, save_LoadTransposeMatrixfARB
);
8048 SET_MultTransposeMatrixdARB(table
, save_MultTransposeMatrixdARB
);
8049 SET_MultTransposeMatrixfARB(table
, save_MultTransposeMatrixfARB
);
8051 /* ARB 5. GL_ARB_multisample */
8052 SET_SampleCoverageARB(table
, save_SampleCoverageARB
);
8054 /* ARB 12. GL_ARB_texture_compression */
8055 SET_CompressedTexImage3DARB(table
, save_CompressedTexImage3DARB
);
8056 SET_CompressedTexImage2DARB(table
, save_CompressedTexImage2DARB
);
8057 SET_CompressedTexImage1DARB(table
, save_CompressedTexImage1DARB
);
8058 SET_CompressedTexSubImage3DARB(table
, save_CompressedTexSubImage3DARB
);
8059 SET_CompressedTexSubImage2DARB(table
, save_CompressedTexSubImage2DARB
);
8060 SET_CompressedTexSubImage1DARB(table
, save_CompressedTexSubImage1DARB
);
8061 SET_GetCompressedTexImageARB(table
, exec_GetCompressedTexImageARB
);
8063 /* ARB 14. GL_ARB_point_parameters */
8064 /* aliased with EXT_point_parameters functions */
8066 /* ARB 25. GL_ARB_window_pos */
8067 /* aliased with MESA_window_pos functions */
8069 /* ARB 26. GL_ARB_vertex_program */
8070 /* ARB 27. GL_ARB_fragment_program */
8071 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
8072 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
8073 SET_VertexAttribPointerARB(table
, _mesa_VertexAttribPointerARB
);
8074 SET_EnableVertexAttribArrayARB(table
, _mesa_EnableVertexAttribArrayARB
);
8075 SET_DisableVertexAttribArrayARB(table
, _mesa_DisableVertexAttribArrayARB
);
8076 SET_ProgramStringARB(table
, save_ProgramStringARB
);
8077 SET_BindProgramNV(table
, save_BindProgramNV
);
8078 SET_DeleteProgramsNV(table
, _mesa_DeletePrograms
);
8079 SET_GenProgramsNV(table
, _mesa_GenPrograms
);
8080 SET_IsProgramNV(table
, _mesa_IsProgramARB
);
8081 SET_GetVertexAttribdvNV(table
, _mesa_GetVertexAttribdvNV
);
8082 SET_GetVertexAttribfvNV(table
, _mesa_GetVertexAttribfvNV
);
8083 SET_GetVertexAttribivNV(table
, _mesa_GetVertexAttribivNV
);
8084 SET_GetVertexAttribPointervNV(table
, _mesa_GetVertexAttribPointervNV
);
8085 SET_ProgramEnvParameter4dARB(table
, save_ProgramEnvParameter4dARB
);
8086 SET_ProgramEnvParameter4dvARB(table
, save_ProgramEnvParameter4dvARB
);
8087 SET_ProgramEnvParameter4fARB(table
, save_ProgramEnvParameter4fARB
);
8088 SET_ProgramEnvParameter4fvARB(table
, save_ProgramEnvParameter4fvARB
);
8089 SET_ProgramLocalParameter4dARB(table
, save_ProgramLocalParameter4dARB
);
8090 SET_ProgramLocalParameter4dvARB(table
, save_ProgramLocalParameter4dvARB
);
8091 SET_ProgramLocalParameter4fARB(table
, save_ProgramLocalParameter4fARB
);
8092 SET_ProgramLocalParameter4fvARB(table
, save_ProgramLocalParameter4fvARB
);
8093 SET_GetProgramEnvParameterdvARB(table
, _mesa_GetProgramEnvParameterdvARB
);
8094 SET_GetProgramEnvParameterfvARB(table
, _mesa_GetProgramEnvParameterfvARB
);
8095 SET_GetProgramLocalParameterdvARB(table
,
8096 _mesa_GetProgramLocalParameterdvARB
);
8097 SET_GetProgramLocalParameterfvARB(table
,
8098 _mesa_GetProgramLocalParameterfvARB
);
8099 SET_GetProgramivARB(table
, _mesa_GetProgramivARB
);
8100 SET_GetProgramStringARB(table
, _mesa_GetProgramStringARB
);
8103 /* ARB 28. GL_ARB_vertex_buffer_object */
8104 #if FEATURE_ARB_vertex_buffer_object
8105 /* None of the extension's functions get compiled */
8106 SET_BindBufferARB(table
, _mesa_BindBufferARB
);
8107 SET_BufferDataARB(table
, _mesa_BufferDataARB
);
8108 SET_BufferSubDataARB(table
, _mesa_BufferSubDataARB
);
8109 SET_DeleteBuffersARB(table
, _mesa_DeleteBuffersARB
);
8110 SET_GenBuffersARB(table
, _mesa_GenBuffersARB
);
8111 SET_GetBufferParameterivARB(table
, _mesa_GetBufferParameterivARB
);
8112 SET_GetBufferPointervARB(table
, _mesa_GetBufferPointervARB
);
8113 SET_GetBufferSubDataARB(table
, _mesa_GetBufferSubDataARB
);
8114 SET_IsBufferARB(table
, _mesa_IsBufferARB
);
8115 SET_MapBufferARB(table
, _mesa_MapBufferARB
);
8116 SET_UnmapBufferARB(table
, _mesa_UnmapBufferARB
);
8119 #if FEATURE_ARB_occlusion_query
8120 SET_BeginQueryARB(table
, save_BeginQueryARB
);
8121 SET_EndQueryARB(table
, save_EndQueryARB
);
8122 SET_GenQueriesARB(table
, _mesa_GenQueriesARB
);
8123 SET_DeleteQueriesARB(table
, _mesa_DeleteQueriesARB
);
8124 SET_IsQueryARB(table
, _mesa_IsQueryARB
);
8125 SET_GetQueryivARB(table
, _mesa_GetQueryivARB
);
8126 SET_GetQueryObjectivARB(table
, _mesa_GetQueryObjectivARB
);
8127 SET_GetQueryObjectuivARB(table
, _mesa_GetQueryObjectuivARB
);
8129 SET_DrawBuffersARB(table
, save_DrawBuffersARB
);
8131 #if FEATURE_EXT_framebuffer_blit
8132 SET_BlitFramebufferEXT(table
, save_BlitFramebufferEXT
);
8135 /* ARB 30/31/32. GL_ARB_shader_objects, GL_ARB_vertex/fragment_shader */
8136 SET_BindAttribLocationARB(table
, exec_BindAttribLocationARB
);
8137 SET_GetAttribLocationARB(table
, exec_GetAttribLocationARB
);
8138 /* XXX additional functions need to be implemented here! */
8140 /* 299. GL_EXT_blend_equation_separate */
8141 SET_BlendEquationSeparateEXT(table
, save_BlendEquationSeparateEXT
);
8143 /* GL_EXT_gpu_program_parmaeters */
8144 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
8145 SET_ProgramEnvParameters4fvEXT(table
, save_ProgramEnvParameters4fvEXT
);
8146 SET_ProgramLocalParameters4fvEXT(table
, save_ProgramLocalParameters4fvEXT
);
8153 enum_string(GLenum k
)
8155 return _mesa_lookup_enum_by_nr(k
);
8160 * Print the commands in a display list. For debugging only.
8161 * TODO: many commands aren't handled yet.
8163 static void GLAPIENTRY
8164 print_list(GLcontext
*ctx
, GLuint list
)
8166 struct mesa_display_list
*dlist
;
8170 if (!islist(ctx
, list
)) {
8171 _mesa_printf("%u is not a display list ID\n", list
);
8175 dlist
= lookup_list(ctx
, list
);
8181 _mesa_printf("START-LIST %u, address %p\n", list
, (void *) n
);
8183 done
= n
? GL_FALSE
: GL_TRUE
;
8185 OpCode opcode
= n
[0].opcode
;
8186 GLint i
= (GLint
) n
[0].opcode
- (GLint
) OPCODE_EXT_0
;
8188 if (i
>= 0 && i
< (GLint
) ctx
->ListExt
.NumOpcodes
) {
8189 /* this is a driver-extended opcode */
8190 ctx
->ListExt
.Opcode
[i
].Print(ctx
, &n
[1]);
8191 n
+= ctx
->ListExt
.Opcode
[i
].Size
;
8196 _mesa_printf("Accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
8199 _mesa_printf("Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
8200 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
, (void *) n
[7].data
);
8202 case OPCODE_CALL_LIST
:
8203 _mesa_printf("CallList %d\n", (int) n
[1].ui
);
8205 case OPCODE_CALL_LIST_OFFSET
:
8206 _mesa_printf("CallList %d + offset %u = %u\n", (int) n
[1].ui
,
8207 ctx
->List
.ListBase
, ctx
->List
.ListBase
+ n
[1].ui
);
8209 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
8210 _mesa_printf("ColorTableParameterfv %s %s %f %f %f %f\n",
8211 enum_string(n
[1].e
), enum_string(n
[2].e
),
8212 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8214 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
8215 _mesa_printf("ColorTableParameteriv %s %s %d %d %d %d\n",
8216 enum_string(n
[1].e
), enum_string(n
[2].e
),
8217 n
[3].i
, n
[4].i
, n
[5].i
, n
[6].i
);
8219 case OPCODE_DISABLE
:
8220 _mesa_printf("Disable %s\n", enum_string(n
[1].e
));
8223 _mesa_printf("Enable %s\n", enum_string(n
[1].e
));
8225 case OPCODE_FRUSTUM
:
8226 _mesa_printf("Frustum %g %g %g %g %g %g\n",
8227 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8229 case OPCODE_LINE_STIPPLE
:
8230 _mesa_printf("LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
8232 case OPCODE_LOAD_IDENTITY
:
8233 _mesa_printf("LoadIdentity\n");
8235 case OPCODE_LOAD_MATRIX
:
8236 _mesa_printf("LoadMatrix\n");
8237 _mesa_printf(" %8f %8f %8f %8f\n",
8238 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
8239 _mesa_printf(" %8f %8f %8f %8f\n",
8240 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
8241 _mesa_printf(" %8f %8f %8f %8f\n",
8242 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
8243 _mesa_printf(" %8f %8f %8f %8f\n",
8244 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
8246 case OPCODE_MULT_MATRIX
:
8247 _mesa_printf("MultMatrix (or Rotate)\n");
8248 _mesa_printf(" %8f %8f %8f %8f\n",
8249 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
8250 _mesa_printf(" %8f %8f %8f %8f\n",
8251 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
8252 _mesa_printf(" %8f %8f %8f %8f\n",
8253 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
8254 _mesa_printf(" %8f %8f %8f %8f\n",
8255 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
8258 _mesa_printf("Ortho %g %g %g %g %g %g\n",
8259 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8261 case OPCODE_POP_ATTRIB
:
8262 _mesa_printf("PopAttrib\n");
8264 case OPCODE_POP_MATRIX
:
8265 _mesa_printf("PopMatrix\n");
8267 case OPCODE_POP_NAME
:
8268 _mesa_printf("PopName\n");
8270 case OPCODE_PUSH_ATTRIB
:
8271 _mesa_printf("PushAttrib %x\n", n
[1].bf
);
8273 case OPCODE_PUSH_MATRIX
:
8274 _mesa_printf("PushMatrix\n");
8276 case OPCODE_PUSH_NAME
:
8277 _mesa_printf("PushName %d\n", (int) n
[1].ui
);
8279 case OPCODE_RASTER_POS
:
8280 _mesa_printf("RasterPos %g %g %g %g\n",
8281 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
8284 _mesa_printf("Rotate %g %g %g %g\n",
8285 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
8288 _mesa_printf("Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
8290 case OPCODE_TRANSLATE
:
8291 _mesa_printf("Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
8293 case OPCODE_BIND_TEXTURE
:
8294 _mesa_printf("BindTexture %s %d\n",
8295 _mesa_lookup_enum_by_nr(n
[1].ui
), n
[2].ui
);
8297 case OPCODE_SHADE_MODEL
:
8298 _mesa_printf("ShadeModel %s\n", _mesa_lookup_enum_by_nr(n
[1].ui
));
8301 _mesa_printf("Map1 %s %.3f %.3f %d %d\n",
8302 _mesa_lookup_enum_by_nr(n
[1].ui
),
8303 n
[2].f
, n
[3].f
, n
[4].i
, n
[5].i
);
8306 _mesa_printf("Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
8307 _mesa_lookup_enum_by_nr(n
[1].ui
),
8308 n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
,
8309 n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
8311 case OPCODE_MAPGRID1
:
8312 _mesa_printf("MapGrid1 %d %.3f %.3f\n", n
[1].i
, n
[2].f
, n
[3].f
);
8314 case OPCODE_MAPGRID2
:
8315 _mesa_printf("MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
8316 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
8318 case OPCODE_EVALMESH1
:
8319 _mesa_printf("EvalMesh1 %d %d\n", n
[1].i
, n
[2].i
);
8321 case OPCODE_EVALMESH2
:
8322 _mesa_printf("EvalMesh2 %d %d %d %d\n",
8323 n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
8326 case OPCODE_ATTR_1F_NV
:
8327 _mesa_printf("ATTR_1F_NV attr %d: %f\n", n
[1].i
, n
[2].f
);
8329 case OPCODE_ATTR_2F_NV
:
8330 _mesa_printf("ATTR_2F_NV attr %d: %f %f\n",
8331 n
[1].i
, n
[2].f
, n
[3].f
);
8333 case OPCODE_ATTR_3F_NV
:
8334 _mesa_printf("ATTR_3F_NV attr %d: %f %f %f\n",
8335 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
8337 case OPCODE_ATTR_4F_NV
:
8338 _mesa_printf("ATTR_4F_NV attr %d: %f %f %f %f\n",
8339 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
8341 case OPCODE_ATTR_1F_ARB
:
8342 _mesa_printf("ATTR_1F_ARB attr %d: %f\n", n
[1].i
, n
[2].f
);
8344 case OPCODE_ATTR_2F_ARB
:
8345 _mesa_printf("ATTR_2F_ARB attr %d: %f %f\n",
8346 n
[1].i
, n
[2].f
, n
[3].f
);
8348 case OPCODE_ATTR_3F_ARB
:
8349 _mesa_printf("ATTR_3F_ARB attr %d: %f %f %f\n",
8350 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
8352 case OPCODE_ATTR_4F_ARB
:
8353 _mesa_printf("ATTR_4F_ARB attr %d: %f %f %f %f\n",
8354 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
8357 case OPCODE_MATERIAL
:
8358 _mesa_printf("MATERIAL %x %x: %f %f %f %f\n",
8359 n
[1].i
, n
[2].i
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8362 _mesa_printf("BEGIN %x\n", n
[1].i
);
8365 _mesa_printf("END\n");
8368 _mesa_printf("RECTF %f %f %f %f\n", n
[1].f
, n
[2].f
, n
[3].f
,
8371 case OPCODE_EVAL_C1
:
8372 _mesa_printf("EVAL_C1 %f\n", n
[1].f
);
8374 case OPCODE_EVAL_C2
:
8375 _mesa_printf("EVAL_C2 %f %f\n", n
[1].f
, n
[2].f
);
8377 case OPCODE_EVAL_P1
:
8378 _mesa_printf("EVAL_P1 %d\n", n
[1].i
);
8380 case OPCODE_EVAL_P2
:
8381 _mesa_printf("EVAL_P2 %d %d\n", n
[1].i
, n
[2].i
);
8385 * meta opcodes/commands
8388 _mesa_printf("Error: %s %s\n",
8389 enum_string(n
[1].e
), (const char *) n
[2].data
);
8391 case OPCODE_CONTINUE
:
8392 _mesa_printf("DISPLAY-LIST-CONTINUE\n");
8393 n
= (Node
*) n
[1].next
;
8395 case OPCODE_END_OF_LIST
:
8396 _mesa_printf("END-LIST %u\n", list
);
8400 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
8402 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
8403 opcode
, (void *) n
);
8407 _mesa_printf("command %d, %u operands\n", opcode
,
8411 /* increment n to point to next compiled command */
8412 if (opcode
!= OPCODE_CONTINUE
) {
8413 n
+= InstSize
[opcode
];
8422 * Clients may call this function to help debug display list problems.
8423 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
8424 * changed, or break in the future without notice.
8427 mesa_print_display_list(GLuint list
)
8429 GET_CURRENT_CONTEXT(ctx
);
8430 print_list(ctx
, list
);
8434 /**********************************************************************/
8435 /***** Initialization *****/
8436 /**********************************************************************/
8439 _mesa_save_vtxfmt_init(GLvertexformat
* vfmt
)
8441 vfmt
->ArrayElement
= _ae_loopback_array_elt
; /* generic helper */
8442 vfmt
->Begin
= save_Begin
;
8443 vfmt
->CallList
= _mesa_save_CallList
;
8444 vfmt
->CallLists
= _mesa_save_CallLists
;
8445 vfmt
->Color3f
= save_Color3f
;
8446 vfmt
->Color3fv
= save_Color3fv
;
8447 vfmt
->Color4f
= save_Color4f
;
8448 vfmt
->Color4fv
= save_Color4fv
;
8449 vfmt
->EdgeFlag
= save_EdgeFlag
;
8450 vfmt
->End
= save_End
;
8451 vfmt
->EvalCoord1f
= save_EvalCoord1f
;
8452 vfmt
->EvalCoord1fv
= save_EvalCoord1fv
;
8453 vfmt
->EvalCoord2f
= save_EvalCoord2f
;
8454 vfmt
->EvalCoord2fv
= save_EvalCoord2fv
;
8455 vfmt
->EvalPoint1
= save_EvalPoint1
;
8456 vfmt
->EvalPoint2
= save_EvalPoint2
;
8457 vfmt
->FogCoordfEXT
= save_FogCoordfEXT
;
8458 vfmt
->FogCoordfvEXT
= save_FogCoordfvEXT
;
8459 vfmt
->Indexf
= save_Indexf
;
8460 vfmt
->Indexfv
= save_Indexfv
;
8461 vfmt
->Materialfv
= save_Materialfv
;
8462 vfmt
->MultiTexCoord1fARB
= save_MultiTexCoord1f
;
8463 vfmt
->MultiTexCoord1fvARB
= save_MultiTexCoord1fv
;
8464 vfmt
->MultiTexCoord2fARB
= save_MultiTexCoord2f
;
8465 vfmt
->MultiTexCoord2fvARB
= save_MultiTexCoord2fv
;
8466 vfmt
->MultiTexCoord3fARB
= save_MultiTexCoord3f
;
8467 vfmt
->MultiTexCoord3fvARB
= save_MultiTexCoord3fv
;
8468 vfmt
->MultiTexCoord4fARB
= save_MultiTexCoord4f
;
8469 vfmt
->MultiTexCoord4fvARB
= save_MultiTexCoord4fv
;
8470 vfmt
->Normal3f
= save_Normal3f
;
8471 vfmt
->Normal3fv
= save_Normal3fv
;
8472 vfmt
->SecondaryColor3fEXT
= save_SecondaryColor3fEXT
;
8473 vfmt
->SecondaryColor3fvEXT
= save_SecondaryColor3fvEXT
;
8474 vfmt
->TexCoord1f
= save_TexCoord1f
;
8475 vfmt
->TexCoord1fv
= save_TexCoord1fv
;
8476 vfmt
->TexCoord2f
= save_TexCoord2f
;
8477 vfmt
->TexCoord2fv
= save_TexCoord2fv
;
8478 vfmt
->TexCoord3f
= save_TexCoord3f
;
8479 vfmt
->TexCoord3fv
= save_TexCoord3fv
;
8480 vfmt
->TexCoord4f
= save_TexCoord4f
;
8481 vfmt
->TexCoord4fv
= save_TexCoord4fv
;
8482 vfmt
->Vertex2f
= save_Vertex2f
;
8483 vfmt
->Vertex2fv
= save_Vertex2fv
;
8484 vfmt
->Vertex3f
= save_Vertex3f
;
8485 vfmt
->Vertex3fv
= save_Vertex3fv
;
8486 vfmt
->Vertex4f
= save_Vertex4f
;
8487 vfmt
->Vertex4fv
= save_Vertex4fv
;
8488 vfmt
->VertexAttrib1fNV
= save_VertexAttrib1fNV
;
8489 vfmt
->VertexAttrib1fvNV
= save_VertexAttrib1fvNV
;
8490 vfmt
->VertexAttrib2fNV
= save_VertexAttrib2fNV
;
8491 vfmt
->VertexAttrib2fvNV
= save_VertexAttrib2fvNV
;
8492 vfmt
->VertexAttrib3fNV
= save_VertexAttrib3fNV
;
8493 vfmt
->VertexAttrib3fvNV
= save_VertexAttrib3fvNV
;
8494 vfmt
->VertexAttrib4fNV
= save_VertexAttrib4fNV
;
8495 vfmt
->VertexAttrib4fvNV
= save_VertexAttrib4fvNV
;
8496 vfmt
->VertexAttrib1fARB
= save_VertexAttrib1fARB
;
8497 vfmt
->VertexAttrib1fvARB
= save_VertexAttrib1fvARB
;
8498 vfmt
->VertexAttrib2fARB
= save_VertexAttrib2fARB
;
8499 vfmt
->VertexAttrib2fvARB
= save_VertexAttrib2fvARB
;
8500 vfmt
->VertexAttrib3fARB
= save_VertexAttrib3fARB
;
8501 vfmt
->VertexAttrib3fvARB
= save_VertexAttrib3fvARB
;
8502 vfmt
->VertexAttrib4fARB
= save_VertexAttrib4fARB
;
8503 vfmt
->VertexAttrib4fvARB
= save_VertexAttrib4fvARB
;
8505 vfmt
->EvalMesh1
= _mesa_save_EvalMesh1
;
8506 vfmt
->EvalMesh2
= _mesa_save_EvalMesh2
;
8507 vfmt
->Rectf
= save_Rectf
;
8509 /* The driver is required to implement these as
8510 * 1) They can probably do a better job.
8511 * 2) A lot of new mechanisms would have to be added to this module
8512 * to support it. That code would probably never get used,
8516 vfmt
->DrawArrays
= 0;
8517 vfmt
->DrawElements
= 0;
8518 vfmt
->DrawRangeElements
= 0;
8524 * Initialize display list state for given context.
8527 _mesa_init_display_list(GLcontext
*ctx
)
8529 static GLboolean tableInitialized
= GL_FALSE
;
8531 /* zero-out the instruction size table, just once */
8532 if (!tableInitialized
) {
8533 _mesa_bzero(InstSize
, sizeof(InstSize
));
8534 tableInitialized
= GL_TRUE
;
8538 ctx
->ListState
.CallDepth
= 0;
8539 ctx
->ExecuteFlag
= GL_TRUE
;
8540 ctx
->CompileFlag
= GL_FALSE
;
8541 ctx
->ListState
.CurrentListPtr
= NULL
;
8542 ctx
->ListState
.CurrentBlock
= NULL
;
8543 ctx
->ListState
.CurrentListNum
= 0;
8544 ctx
->ListState
.CurrentPos
= 0;
8546 /* Display List group */
8547 ctx
->List
.ListBase
= 0;
8549 _mesa_save_vtxfmt_init(&ctx
->ListState
.ListVtxfmt
);