2 * Mesa 3-D graphics library
5 * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 * Display lists management functions.
33 #include "api_arrayelt.h"
34 #include "api_loopback.h"
36 #include "mfeatures.h"
40 #if FEATURE_ARB_vertex_buffer_object
41 #include "bufferobj.h"
53 #include "extensions.h"
55 #include "framebuffer.h"
57 #include "glapi/glapi.h"
59 #include "histogram.h"
76 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
77 #include "shader/arbprogram.h"
78 #include "shader/program.h"
80 #if FEATURE_NV_vertex_program || FEATURE_NV_fragment_program
81 #include "shader/nvprogram.h"
82 #include "shader/program.h"
84 #if FEATURE_ATI_fragment_shader
85 #include "shader/atifragshader.h"
88 #include "math/m_matrix.h"
90 #include "glapi/dispatch.h"
96 * \param ctx GL context.
98 * Checks if dd_function_table::SaveNeedFlush is marked to flush
99 * stored (save) vertices, and calls
100 * dd_function_table::SaveFlushVertices if so.
102 #define SAVE_FLUSH_VERTICES(ctx) \
104 if (ctx->Driver.SaveNeedFlush) \
105 ctx->Driver.SaveFlushVertices(ctx); \
110 * Macro to assert that the API call was made outside the
111 * glBegin()/glEnd() pair, with return value.
113 * \param ctx GL context.
114 * \param retval value to return value in case the assertion fails.
116 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval) \
118 if (ctx->Driver.CurrentSavePrimitive <= GL_POLYGON || \
119 ctx->Driver.CurrentSavePrimitive == PRIM_INSIDE_UNKNOWN_PRIM) { \
120 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \
126 * Macro to assert that the API call was made outside the
127 * glBegin()/glEnd() pair.
129 * \param ctx GL context.
131 #define ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx) \
133 if (ctx->Driver.CurrentSavePrimitive <= GL_POLYGON || \
134 ctx->Driver.CurrentSavePrimitive == PRIM_INSIDE_UNKNOWN_PRIM) { \
135 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \
141 * Macro to assert that the API call was made outside the
142 * glBegin()/glEnd() pair and flush the vertices.
144 * \param ctx GL context.
146 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx) \
148 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx); \
149 SAVE_FLUSH_VERTICES(ctx); \
153 * Macro to assert that the API call was made outside the
154 * glBegin()/glEnd() pair and flush the vertices, with return value.
156 * \param ctx GL context.
157 * \param retval value to return value in case the assertion fails.
159 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval)\
161 ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval); \
162 SAVE_FLUSH_VERTICES(ctx); \
168 * Display list opcodes.
170 * The fact that these identifiers are assigned consecutive
171 * integer values starting at 0 is very important, see InstSize array usage)
175 OPCODE_INVALID
= -1, /* Force signed enum */
181 OPCODE_BLEND_EQUATION
,
182 OPCODE_BLEND_EQUATION_SEPARATE
,
183 OPCODE_BLEND_FUNC_SEPARATE
,
185 OPCODE_CALL_LIST_OFFSET
,
191 OPCODE_CLEAR_STENCIL
,
194 OPCODE_COLOR_MATERIAL
,
196 OPCODE_COLOR_TABLE_PARAMETER_FV
,
197 OPCODE_COLOR_TABLE_PARAMETER_IV
,
198 OPCODE_COLOR_SUB_TABLE
,
199 OPCODE_CONVOLUTION_FILTER_1D
,
200 OPCODE_CONVOLUTION_FILTER_2D
,
201 OPCODE_CONVOLUTION_PARAMETER_I
,
202 OPCODE_CONVOLUTION_PARAMETER_IV
,
203 OPCODE_CONVOLUTION_PARAMETER_F
,
204 OPCODE_CONVOLUTION_PARAMETER_FV
,
205 OPCODE_COPY_COLOR_SUB_TABLE
,
206 OPCODE_COPY_COLOR_TABLE
,
208 OPCODE_COPY_TEX_IMAGE1D
,
209 OPCODE_COPY_TEX_IMAGE2D
,
210 OPCODE_COPY_TEX_SUB_IMAGE1D
,
211 OPCODE_COPY_TEX_SUB_IMAGE2D
,
212 OPCODE_COPY_TEX_SUB_IMAGE3D
,
235 OPCODE_LOAD_IDENTITY
,
249 OPCODE_PIXEL_TRANSFER
,
252 OPCODE_POINT_PARAMETERS
,
254 OPCODE_POLYGON_STIPPLE
,
255 OPCODE_POLYGON_OFFSET
,
259 OPCODE_PRIORITIZE_TEXTURE
,
265 OPCODE_RESET_HISTOGRAM
,
266 OPCODE_RESET_MIN_MAX
,
270 OPCODE_SELECT_TEXTURE_SGIS
,
271 OPCODE_SELECT_TEXTURE_COORD_SET
,
282 OPCODE_TEX_SUB_IMAGE1D
,
283 OPCODE_TEX_SUB_IMAGE2D
,
284 OPCODE_TEX_SUB_IMAGE3D
,
288 /* GL_ARB_multitexture */
289 OPCODE_ACTIVE_TEXTURE
,
290 /* GL_ARB_texture_compression */
291 OPCODE_COMPRESSED_TEX_IMAGE_1D
,
292 OPCODE_COMPRESSED_TEX_IMAGE_2D
,
293 OPCODE_COMPRESSED_TEX_IMAGE_3D
,
294 OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
,
295 OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
,
296 OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
,
297 /* GL_ARB_multisample */
298 OPCODE_SAMPLE_COVERAGE
,
299 /* GL_ARB_window_pos */
300 OPCODE_WINDOW_POS_ARB
,
301 /* GL_NV_vertex_program */
302 OPCODE_BIND_PROGRAM_NV
,
303 OPCODE_EXECUTE_PROGRAM_NV
,
304 OPCODE_REQUEST_RESIDENT_PROGRAMS_NV
,
305 OPCODE_LOAD_PROGRAM_NV
,
306 OPCODE_TRACK_MATRIX_NV
,
307 /* GL_NV_fragment_program */
308 OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
,
309 OPCODE_PROGRAM_NAMED_PARAMETER_NV
,
310 /* GL_EXT_stencil_two_side */
311 OPCODE_ACTIVE_STENCIL_FACE_EXT
,
312 /* GL_EXT_depth_bounds_test */
313 OPCODE_DEPTH_BOUNDS_EXT
,
314 /* GL_ARB_vertex/fragment_program */
315 OPCODE_PROGRAM_STRING_ARB
,
316 OPCODE_PROGRAM_ENV_PARAMETER_ARB
,
317 /* GL_ARB_occlusion_query */
318 OPCODE_BEGIN_QUERY_ARB
,
319 OPCODE_END_QUERY_ARB
,
320 /* GL_ARB_draw_buffers */
321 OPCODE_DRAW_BUFFERS_ARB
,
322 /* GL_ATI_fragment_shader */
323 OPCODE_TEX_BUMP_PARAMETER_ATI
,
324 /* GL_ATI_fragment_shader */
325 OPCODE_BIND_FRAGMENT_SHADER_ATI
,
326 OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
,
328 OPCODE_STENCIL_FUNC_SEPARATE
,
329 OPCODE_STENCIL_OP_SEPARATE
,
330 OPCODE_STENCIL_MASK_SEPARATE
,
332 /* GL_EXT_framebuffer_blit */
333 OPCODE_BLIT_FRAMEBUFFER
,
335 /* Vertex attributes -- fallback for when optimized display
336 * list build isn't active.
355 /* The following three are meta instructions */
356 OPCODE_ERROR
, /* raise compiled-in error */
367 * Display list instructions are stored as sequences of "nodes". Nodes
368 * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
369 * are linked together with a pointer.
371 * Each instruction in the display list is stored as a sequence of
372 * contiguous nodes in memory.
373 * Each node is the union of a variety of data types.
388 void *next
; /* If prev node's opcode==OPCODE_CONTINUE */
392 typedef union gl_dlist_node Node
;
396 * How many nodes to allocate at a time.
398 * \note Reduced now that we hold vertices etc. elsewhere.
400 #define BLOCK_SIZE 256
405 * Number of nodes of storage needed for each instruction.
406 * Sizes for dynamically allocated opcodes are stored in the context struct.
408 static GLuint InstSize
[OPCODE_END_OF_LIST
+ 1];
410 void mesa_print_display_list(GLuint list
);
413 /**********************************************************************/
414 /***** Private *****/
415 /**********************************************************************/
419 * Make an empty display list. This is used by glGenLists() to
420 * reserve display list IDs.
422 static struct gl_display_list
*
423 make_list(GLuint name
, GLuint count
)
425 struct gl_display_list
*dlist
= CALLOC_STRUCT(gl_display_list
);
427 dlist
->Head
= (Node
*) _mesa_malloc(sizeof(Node
) * count
);
428 dlist
->Head
[0].opcode
= OPCODE_END_OF_LIST
;
434 * Lookup function to just encapsulate casting.
436 static INLINE
struct gl_display_list
*
437 lookup_list(GLcontext
*ctx
, GLuint list
)
439 return (struct gl_display_list
*)
440 _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
446 * Delete the named display list, but don't remove from hash table.
447 * \param dlist - display list pointer
450 _mesa_delete_list(GLcontext
*ctx
, struct gl_display_list
*dlist
)
455 n
= block
= dlist
->Head
;
457 done
= block
? GL_FALSE
: GL_TRUE
;
460 /* check for extension opcodes first */
462 GLint i
= (GLint
) n
[0].opcode
- (GLint
) OPCODE_EXT_0
;
463 if (i
>= 0 && i
< (GLint
) ctx
->ListExt
.NumOpcodes
) {
464 ctx
->ListExt
.Opcode
[i
].Destroy(ctx
, &n
[1]);
465 n
+= ctx
->ListExt
.Opcode
[i
].Size
;
468 switch (n
[0].opcode
) {
469 /* for some commands, we need to free malloc'd memory */
471 _mesa_free(n
[6].data
);
472 n
+= InstSize
[n
[0].opcode
];
475 _mesa_free(n
[10].data
);
476 n
+= InstSize
[n
[0].opcode
];
478 case OPCODE_DRAW_PIXELS
:
479 _mesa_free(n
[5].data
);
480 n
+= InstSize
[n
[0].opcode
];
483 _mesa_free(n
[7].data
);
484 n
+= InstSize
[n
[0].opcode
];
486 case OPCODE_COLOR_TABLE
:
487 _mesa_free(n
[6].data
);
488 n
+= InstSize
[n
[0].opcode
];
490 case OPCODE_COLOR_SUB_TABLE
:
491 _mesa_free(n
[6].data
);
492 n
+= InstSize
[n
[0].opcode
];
494 case OPCODE_CONVOLUTION_FILTER_1D
:
495 _mesa_free(n
[6].data
);
496 n
+= InstSize
[n
[0].opcode
];
498 case OPCODE_CONVOLUTION_FILTER_2D
:
499 _mesa_free(n
[7].data
);
500 n
+= InstSize
[n
[0].opcode
];
502 case OPCODE_POLYGON_STIPPLE
:
503 _mesa_free(n
[1].data
);
504 n
+= InstSize
[n
[0].opcode
];
506 case OPCODE_TEX_IMAGE1D
:
507 _mesa_free(n
[8].data
);
508 n
+= InstSize
[n
[0].opcode
];
510 case OPCODE_TEX_IMAGE2D
:
511 _mesa_free(n
[9].data
);
512 n
+= InstSize
[n
[0].opcode
];
514 case OPCODE_TEX_IMAGE3D
:
515 _mesa_free(n
[10].data
);
516 n
+= InstSize
[n
[0].opcode
];
518 case OPCODE_TEX_SUB_IMAGE1D
:
519 _mesa_free(n
[7].data
);
520 n
+= InstSize
[n
[0].opcode
];
522 case OPCODE_TEX_SUB_IMAGE2D
:
523 _mesa_free(n
[9].data
);
524 n
+= InstSize
[n
[0].opcode
];
526 case OPCODE_TEX_SUB_IMAGE3D
:
527 _mesa_free(n
[11].data
);
528 n
+= InstSize
[n
[0].opcode
];
530 case OPCODE_COMPRESSED_TEX_IMAGE_1D
:
531 _mesa_free(n
[7].data
);
532 n
+= InstSize
[n
[0].opcode
];
534 case OPCODE_COMPRESSED_TEX_IMAGE_2D
:
535 _mesa_free(n
[8].data
);
536 n
+= InstSize
[n
[0].opcode
];
538 case OPCODE_COMPRESSED_TEX_IMAGE_3D
:
539 _mesa_free(n
[9].data
);
540 n
+= InstSize
[n
[0].opcode
];
542 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
:
543 _mesa_free(n
[7].data
);
544 n
+= InstSize
[n
[0].opcode
];
546 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
:
547 _mesa_free(n
[9].data
);
548 n
+= InstSize
[n
[0].opcode
];
550 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
:
551 _mesa_free(n
[11].data
);
552 n
+= InstSize
[n
[0].opcode
];
554 #if FEATURE_NV_vertex_program
555 case OPCODE_LOAD_PROGRAM_NV
:
556 _mesa_free(n
[4].data
); /* program string */
557 n
+= InstSize
[n
[0].opcode
];
559 case OPCODE_REQUEST_RESIDENT_PROGRAMS_NV
:
560 _mesa_free(n
[2].data
); /* array of program ids */
561 n
+= InstSize
[n
[0].opcode
];
564 #if FEATURE_NV_fragment_program
565 case OPCODE_PROGRAM_NAMED_PARAMETER_NV
:
566 _mesa_free(n
[3].data
); /* parameter name */
567 n
+= InstSize
[n
[0].opcode
];
570 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
571 case OPCODE_PROGRAM_STRING_ARB
:
572 _mesa_free(n
[4].data
); /* program string */
573 n
+= InstSize
[n
[0].opcode
];
576 case OPCODE_CONTINUE
:
577 n
= (Node
*) n
[1].next
;
581 case OPCODE_END_OF_LIST
:
586 /* Most frequent case */
587 n
+= InstSize
[n
[0].opcode
];
598 * Destroy a display list and remove from hash table.
599 * \param list - display list number
602 destroy_list(GLcontext
*ctx
, GLuint list
)
604 struct gl_display_list
*dlist
;
609 dlist
= lookup_list(ctx
, list
);
613 _mesa_delete_list(ctx
, dlist
);
614 _mesa_HashRemove(ctx
->Shared
->DisplayList
, list
);
619 * Translate the nth element of list from <type> to GLint.
622 translate_id(GLsizei n
, GLenum type
, const GLvoid
* list
)
634 bptr
= (GLbyte
*) list
;
635 return (GLint
) bptr
[n
];
636 case GL_UNSIGNED_BYTE
:
637 ubptr
= (GLubyte
*) list
;
638 return (GLint
) ubptr
[n
];
640 sptr
= (GLshort
*) list
;
641 return (GLint
) sptr
[n
];
642 case GL_UNSIGNED_SHORT
:
643 usptr
= (GLushort
*) list
;
644 return (GLint
) usptr
[n
];
646 iptr
= (GLint
*) list
;
648 case GL_UNSIGNED_INT
:
649 uiptr
= (GLuint
*) list
;
650 return (GLint
) uiptr
[n
];
652 fptr
= (GLfloat
*) list
;
653 return (GLint
) FLOORF(fptr
[n
]);
655 ubptr
= ((GLubyte
*) list
) + 2 * n
;
656 return (GLint
) ubptr
[0] * 256
659 ubptr
= ((GLubyte
*) list
) + 3 * n
;
660 return (GLint
) ubptr
[0] * 65536
661 + (GLint
) ubptr
[1] * 256
664 ubptr
= ((GLubyte
*) list
) + 4 * n
;
665 return (GLint
) ubptr
[0] * 16777216
666 + (GLint
) ubptr
[1] * 65536
667 + (GLint
) ubptr
[2] * 256
677 /**********************************************************************/
679 /**********************************************************************/
682 * Wrapper for _mesa_unpack_image() that handles pixel buffer objects.
683 * If we run out of memory, GL_OUT_OF_MEMORY will be recorded.
684 * \todo This won't suffice when the PBO is really in VRAM/GPU memory.
687 unpack_image(GLcontext
*ctx
, GLuint dimensions
,
688 GLsizei width
, GLsizei height
, GLsizei depth
,
689 GLenum format
, GLenum type
, const GLvoid
* pixels
,
690 const struct gl_pixelstore_attrib
*unpack
)
692 if (unpack
->BufferObj
->Name
== 0) {
694 GLvoid
*image
= _mesa_unpack_image(dimensions
, width
, height
, depth
,
695 format
, type
, pixels
, unpack
);
696 if (pixels
&& !image
) {
697 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "display list construction");
702 if (_mesa_validate_pbo_access
703 (dimensions
, unpack
, width
, height
, depth
, format
, type
, pixels
)) {
704 const GLubyte
*src
= ADD_POINTERS(unpack
->BufferObj
->Data
, pixels
);
705 GLvoid
*image
= _mesa_unpack_image(dimensions
, width
, height
, depth
,
706 format
, type
, src
, unpack
);
708 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "display list construction");
718 * Allocate space for a display list instruction.
719 * \param opcode the instruction opcode (OPCODE_* value)
720 * \param bytes instruction size in bytes, not counting opcode.
721 * \return pointer to the usable data area (not including the internal
725 _mesa_alloc_instruction(GLcontext
*ctx
, GLuint opcode
, GLuint bytes
)
727 const GLuint numNodes
= 1 + (bytes
+ sizeof(Node
) - 1) / sizeof(Node
);
730 if (opcode
< (GLuint
) OPCODE_EXT_0
) {
731 if (InstSize
[opcode
] == 0) {
732 /* save instruction size now */
733 InstSize
[opcode
] = numNodes
;
736 /* make sure instruction size agrees */
737 ASSERT(numNodes
== InstSize
[opcode
]);
741 if (ctx
->ListState
.CurrentPos
+ numNodes
+ 2 > BLOCK_SIZE
) {
742 /* This block is full. Allocate a new block and chain to it */
744 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
745 n
[0].opcode
= OPCODE_CONTINUE
;
746 newblock
= (Node
*) _mesa_malloc(sizeof(Node
) * BLOCK_SIZE
);
748 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "Building display list");
751 n
[1].next
= (Node
*) newblock
;
752 ctx
->ListState
.CurrentBlock
= newblock
;
753 ctx
->ListState
.CurrentPos
= 0;
756 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
757 ctx
->ListState
.CurrentPos
+= numNodes
;
759 n
[0].opcode
= (OpCode
) opcode
;
761 return (void *) (n
+ 1); /* return ptr to node following opcode */
766 * This function allows modules and drivers to get their own opcodes
767 * for extending display list functionality.
768 * \param ctx the rendering context
769 * \param size number of bytes for storing the new display list command
770 * \param execute function to execute the new display list command
771 * \param destroy function to destroy the new display list command
772 * \param print function to print the new display list command
773 * \return the new opcode number or -1 if error
776 _mesa_alloc_opcode(GLcontext
*ctx
,
778 void (*execute
) (GLcontext
*, void *),
779 void (*destroy
) (GLcontext
*, void *),
780 void (*print
) (GLcontext
*, void *))
782 if (ctx
->ListExt
.NumOpcodes
< MAX_DLIST_EXT_OPCODES
) {
783 const GLuint i
= ctx
->ListExt
.NumOpcodes
++;
784 ctx
->ListExt
.Opcode
[i
].Size
=
785 1 + (size
+ sizeof(Node
) - 1) / sizeof(Node
);
786 ctx
->ListExt
.Opcode
[i
].Execute
= execute
;
787 ctx
->ListExt
.Opcode
[i
].Destroy
= destroy
;
788 ctx
->ListExt
.Opcode
[i
].Print
= print
;
789 return i
+ OPCODE_EXT_0
;
797 * Allocate display list instruction. Returns Node ptr to where the opcode
799 * - nParams is the number of function parameters
800 * - return value a pointer to sizeof(Node) before the actual
803 #define ALLOC_INSTRUCTION(CTX, OPCODE, NPARAMS) \
804 ((Node *)_mesa_alloc_instruction(CTX, OPCODE, (NPARAMS)*sizeof(Node)) - 1)
809 * Display List compilation functions
811 static void GLAPIENTRY
812 save_Accum(GLenum op
, GLfloat value
)
814 GET_CURRENT_CONTEXT(ctx
);
816 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
817 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ACCUM
, 2);
822 if (ctx
->ExecuteFlag
) {
823 CALL_Accum(ctx
->Exec
, (op
, value
));
828 static void GLAPIENTRY
829 save_AlphaFunc(GLenum func
, GLclampf ref
)
831 GET_CURRENT_CONTEXT(ctx
);
833 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
834 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ALPHA_FUNC
, 2);
837 n
[2].f
= (GLfloat
) ref
;
839 if (ctx
->ExecuteFlag
) {
840 CALL_AlphaFunc(ctx
->Exec
, (func
, ref
));
845 static void GLAPIENTRY
846 save_BindTexture(GLenum target
, GLuint texture
)
848 GET_CURRENT_CONTEXT(ctx
);
850 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
851 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BIND_TEXTURE
, 2);
856 if (ctx
->ExecuteFlag
) {
857 CALL_BindTexture(ctx
->Exec
, (target
, texture
));
862 static void GLAPIENTRY
863 save_Bitmap(GLsizei width
, GLsizei height
,
864 GLfloat xorig
, GLfloat yorig
,
865 GLfloat xmove
, GLfloat ymove
, const GLubyte
* pixels
)
867 GET_CURRENT_CONTEXT(ctx
);
869 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
870 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BITMAP
, 7);
872 n
[1].i
= (GLint
) width
;
873 n
[2].i
= (GLint
) height
;
878 n
[7].data
= _mesa_unpack_bitmap(width
, height
, pixels
, &ctx
->Unpack
);
880 if (ctx
->ExecuteFlag
) {
881 CALL_Bitmap(ctx
->Exec
, (width
, height
,
882 xorig
, yorig
, xmove
, ymove
, pixels
));
887 static void GLAPIENTRY
888 save_BlendEquation(GLenum mode
)
890 GET_CURRENT_CONTEXT(ctx
);
892 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
893 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BLEND_EQUATION
, 1);
897 if (ctx
->ExecuteFlag
) {
898 CALL_BlendEquation(ctx
->Exec
, (mode
));
903 static void GLAPIENTRY
904 save_BlendEquationSeparateEXT(GLenum modeRGB
, GLenum modeA
)
906 GET_CURRENT_CONTEXT(ctx
);
908 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
909 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BLEND_EQUATION_SEPARATE
, 2);
914 if (ctx
->ExecuteFlag
) {
915 CALL_BlendEquationSeparateEXT(ctx
->Exec
, (modeRGB
, modeA
));
920 static void GLAPIENTRY
921 save_BlendFuncSeparateEXT(GLenum sfactorRGB
, GLenum dfactorRGB
,
922 GLenum sfactorA
, GLenum dfactorA
)
924 GET_CURRENT_CONTEXT(ctx
);
926 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
927 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BLEND_FUNC_SEPARATE
, 4);
934 if (ctx
->ExecuteFlag
) {
935 CALL_BlendFuncSeparateEXT(ctx
->Exec
,
936 (sfactorRGB
, dfactorRGB
, sfactorA
, dfactorA
));
941 static void GLAPIENTRY
942 save_BlendFunc(GLenum srcfactor
, GLenum dstfactor
)
944 save_BlendFuncSeparateEXT(srcfactor
, dstfactor
, srcfactor
, dstfactor
);
948 static void GLAPIENTRY
949 save_BlendColor(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
951 GET_CURRENT_CONTEXT(ctx
);
953 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
954 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BLEND_COLOR
, 4);
961 if (ctx
->ExecuteFlag
) {
962 CALL_BlendColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
966 static void invalidate_saved_current_state( GLcontext
*ctx
)
970 for (i
= 0; i
< VERT_ATTRIB_MAX
; i
++)
971 ctx
->ListState
.ActiveAttribSize
[i
] = 0;
973 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++)
974 ctx
->ListState
.ActiveMaterialSize
[i
] = 0;
976 memset(&ctx
->ListState
.Current
, 0, sizeof ctx
->ListState
.Current
);
978 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
982 _mesa_save_CallList(GLuint list
)
984 GET_CURRENT_CONTEXT(ctx
);
986 SAVE_FLUSH_VERTICES(ctx
);
988 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CALL_LIST
, 1);
993 /* After this, we don't know what state we're in. Invalidate all
994 * cached information previously gathered:
996 invalidate_saved_current_state( ctx
);
998 if (ctx
->ExecuteFlag
) {
999 _mesa_CallList(list
);
1005 _mesa_save_CallLists(GLsizei n
, GLenum type
, const GLvoid
* lists
)
1007 GET_CURRENT_CONTEXT(ctx
);
1009 GLboolean typeErrorFlag
;
1011 SAVE_FLUSH_VERTICES(ctx
);
1015 case GL_UNSIGNED_BYTE
:
1017 case GL_UNSIGNED_SHORT
:
1019 case GL_UNSIGNED_INT
:
1024 typeErrorFlag
= GL_FALSE
;
1027 typeErrorFlag
= GL_TRUE
;
1030 for (i
= 0; i
< n
; i
++) {
1031 GLint list
= translate_id(i
, type
, lists
);
1032 Node
*n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CALL_LIST_OFFSET
, 2);
1035 n
[2].b
= typeErrorFlag
;
1039 /* After this, we don't know what state we're in. Invalidate all
1040 * cached information previously gathered:
1042 invalidate_saved_current_state( ctx
);
1044 if (ctx
->ExecuteFlag
) {
1045 CALL_CallLists(ctx
->Exec
, (n
, type
, lists
));
1050 static void GLAPIENTRY
1051 save_Clear(GLbitfield mask
)
1053 GET_CURRENT_CONTEXT(ctx
);
1055 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1056 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLEAR
, 1);
1060 if (ctx
->ExecuteFlag
) {
1061 CALL_Clear(ctx
->Exec
, (mask
));
1066 static void GLAPIENTRY
1067 save_ClearAccum(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
1069 GET_CURRENT_CONTEXT(ctx
);
1071 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1072 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLEAR_ACCUM
, 4);
1079 if (ctx
->ExecuteFlag
) {
1080 CALL_ClearAccum(ctx
->Exec
, (red
, green
, blue
, alpha
));
1085 static void GLAPIENTRY
1086 save_ClearColor(GLclampf red
, GLclampf green
, GLclampf blue
, GLclampf alpha
)
1088 GET_CURRENT_CONTEXT(ctx
);
1090 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1091 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLEAR_COLOR
, 4);
1098 if (ctx
->ExecuteFlag
) {
1099 CALL_ClearColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
1104 static void GLAPIENTRY
1105 save_ClearDepth(GLclampd depth
)
1107 GET_CURRENT_CONTEXT(ctx
);
1109 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1110 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLEAR_DEPTH
, 1);
1112 n
[1].f
= (GLfloat
) depth
;
1114 if (ctx
->ExecuteFlag
) {
1115 CALL_ClearDepth(ctx
->Exec
, (depth
));
1120 static void GLAPIENTRY
1121 save_ClearIndex(GLfloat c
)
1123 GET_CURRENT_CONTEXT(ctx
);
1125 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1126 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLEAR_INDEX
, 1);
1130 if (ctx
->ExecuteFlag
) {
1131 CALL_ClearIndex(ctx
->Exec
, (c
));
1136 static void GLAPIENTRY
1137 save_ClearStencil(GLint s
)
1139 GET_CURRENT_CONTEXT(ctx
);
1141 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1142 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLEAR_STENCIL
, 1);
1146 if (ctx
->ExecuteFlag
) {
1147 CALL_ClearStencil(ctx
->Exec
, (s
));
1152 static void GLAPIENTRY
1153 save_ClipPlane(GLenum plane
, const GLdouble
* equ
)
1155 GET_CURRENT_CONTEXT(ctx
);
1157 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1158 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLIP_PLANE
, 5);
1161 n
[2].f
= (GLfloat
) equ
[0];
1162 n
[3].f
= (GLfloat
) equ
[1];
1163 n
[4].f
= (GLfloat
) equ
[2];
1164 n
[5].f
= (GLfloat
) equ
[3];
1166 if (ctx
->ExecuteFlag
) {
1167 CALL_ClipPlane(ctx
->Exec
, (plane
, equ
));
1173 static void GLAPIENTRY
1174 save_ColorMask(GLboolean red
, GLboolean green
,
1175 GLboolean blue
, GLboolean alpha
)
1177 GET_CURRENT_CONTEXT(ctx
);
1179 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1180 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COLOR_MASK
, 4);
1187 if (ctx
->ExecuteFlag
) {
1188 CALL_ColorMask(ctx
->Exec
, (red
, green
, blue
, alpha
));
1193 static void GLAPIENTRY
1194 save_ColorMaterial(GLenum face
, GLenum mode
)
1196 GET_CURRENT_CONTEXT(ctx
);
1198 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1200 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COLOR_MATERIAL
, 2);
1205 if (ctx
->ExecuteFlag
) {
1206 CALL_ColorMaterial(ctx
->Exec
, (face
, mode
));
1211 static void GLAPIENTRY
1212 save_ColorTable(GLenum target
, GLenum internalFormat
,
1213 GLsizei width
, GLenum format
, GLenum type
,
1214 const GLvoid
* table
)
1216 GET_CURRENT_CONTEXT(ctx
);
1217 if (_mesa_is_proxy_texture(target
)) {
1218 /* execute immediately */
1219 CALL_ColorTable(ctx
->Exec
, (target
, internalFormat
, width
,
1220 format
, type
, table
));
1224 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1225 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COLOR_TABLE
, 6);
1228 n
[2].e
= internalFormat
;
1232 n
[6].data
= unpack_image(ctx
, 1, width
, 1, 1, format
, type
, table
,
1235 if (ctx
->ExecuteFlag
) {
1236 CALL_ColorTable(ctx
->Exec
, (target
, internalFormat
, width
,
1237 format
, type
, table
));
1244 static void GLAPIENTRY
1245 save_ColorTableParameterfv(GLenum target
, GLenum pname
,
1246 const GLfloat
*params
)
1248 GET_CURRENT_CONTEXT(ctx
);
1251 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1253 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COLOR_TABLE_PARAMETER_FV
, 6);
1258 if (pname
== GL_COLOR_TABLE_SGI
||
1259 pname
== GL_POST_CONVOLUTION_COLOR_TABLE_SGI
||
1260 pname
== GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI
||
1261 pname
== GL_TEXTURE_COLOR_TABLE_SGI
) {
1268 if (ctx
->ExecuteFlag
) {
1269 CALL_ColorTableParameterfv(ctx
->Exec
, (target
, pname
, params
));
1274 static void GLAPIENTRY
1275 save_ColorTableParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
1277 GET_CURRENT_CONTEXT(ctx
);
1280 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1282 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COLOR_TABLE_PARAMETER_IV
, 6);
1287 if (pname
== GL_COLOR_TABLE_SGI
||
1288 pname
== GL_POST_CONVOLUTION_COLOR_TABLE_SGI
||
1289 pname
== GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI
||
1290 pname
== GL_TEXTURE_COLOR_TABLE_SGI
) {
1297 if (ctx
->ExecuteFlag
) {
1298 CALL_ColorTableParameteriv(ctx
->Exec
, (target
, pname
, params
));
1304 static void GLAPIENTRY
1305 save_ColorSubTable(GLenum target
, GLsizei start
, GLsizei count
,
1306 GLenum format
, GLenum type
, const GLvoid
* table
)
1308 GET_CURRENT_CONTEXT(ctx
);
1310 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1311 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COLOR_SUB_TABLE
, 6);
1318 n
[6].data
= unpack_image(ctx
, 1, count
, 1, 1, format
, type
, table
,
1321 if (ctx
->ExecuteFlag
) {
1322 CALL_ColorSubTable(ctx
->Exec
,
1323 (target
, start
, count
, format
, type
, table
));
1328 static void GLAPIENTRY
1329 save_CopyColorSubTable(GLenum target
, GLsizei start
,
1330 GLint x
, GLint y
, GLsizei width
)
1332 GET_CURRENT_CONTEXT(ctx
);
1335 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1336 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_COLOR_SUB_TABLE
, 5);
1344 if (ctx
->ExecuteFlag
) {
1345 CALL_CopyColorSubTable(ctx
->Exec
, (target
, start
, x
, y
, width
));
1350 static void GLAPIENTRY
1351 save_CopyColorTable(GLenum target
, GLenum internalformat
,
1352 GLint x
, GLint y
, GLsizei width
)
1354 GET_CURRENT_CONTEXT(ctx
);
1357 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1358 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_COLOR_TABLE
, 5);
1361 n
[2].e
= internalformat
;
1366 if (ctx
->ExecuteFlag
) {
1367 CALL_CopyColorTable(ctx
->Exec
, (target
, internalformat
, x
, y
, width
));
1372 static void GLAPIENTRY
1373 save_ConvolutionFilter1D(GLenum target
, GLenum internalFormat
, GLsizei width
,
1374 GLenum format
, GLenum type
, const GLvoid
* filter
)
1376 GET_CURRENT_CONTEXT(ctx
);
1379 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1381 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CONVOLUTION_FILTER_1D
, 6);
1384 n
[2].e
= internalFormat
;
1388 n
[6].data
= unpack_image(ctx
, 1, width
, 1, 1, format
, type
, filter
,
1391 if (ctx
->ExecuteFlag
) {
1392 CALL_ConvolutionFilter1D(ctx
->Exec
, (target
, internalFormat
, width
,
1393 format
, type
, filter
));
1398 static void GLAPIENTRY
1399 save_ConvolutionFilter2D(GLenum target
, GLenum internalFormat
,
1400 GLsizei width
, GLsizei height
, GLenum format
,
1401 GLenum type
, const GLvoid
* filter
)
1403 GET_CURRENT_CONTEXT(ctx
);
1406 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1408 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CONVOLUTION_FILTER_2D
, 7);
1411 n
[2].e
= internalFormat
;
1416 n
[7].data
= unpack_image(ctx
, 2, width
, height
, 1, format
, type
, filter
,
1419 if (ctx
->ExecuteFlag
) {
1420 CALL_ConvolutionFilter2D(ctx
->Exec
,
1421 (target
, internalFormat
, width
, height
, format
,
1427 static void GLAPIENTRY
1428 save_ConvolutionParameteri(GLenum target
, GLenum pname
, GLint param
)
1430 GET_CURRENT_CONTEXT(ctx
);
1432 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1433 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CONVOLUTION_PARAMETER_I
, 3);
1439 if (ctx
->ExecuteFlag
) {
1440 CALL_ConvolutionParameteri(ctx
->Exec
, (target
, pname
, param
));
1445 static void GLAPIENTRY
1446 save_ConvolutionParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
1448 GET_CURRENT_CONTEXT(ctx
);
1450 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1451 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CONVOLUTION_PARAMETER_IV
, 6);
1456 if (pname
== GL_CONVOLUTION_BORDER_COLOR
||
1457 pname
== GL_CONVOLUTION_FILTER_SCALE
||
1458 pname
== GL_CONVOLUTION_FILTER_BIAS
) {
1464 n
[4].i
= n
[5].i
= n
[6].i
= 0;
1467 if (ctx
->ExecuteFlag
) {
1468 CALL_ConvolutionParameteriv(ctx
->Exec
, (target
, pname
, params
));
1473 static void GLAPIENTRY
1474 save_ConvolutionParameterf(GLenum target
, GLenum pname
, GLfloat param
)
1476 GET_CURRENT_CONTEXT(ctx
);
1478 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1479 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CONVOLUTION_PARAMETER_F
, 3);
1485 if (ctx
->ExecuteFlag
) {
1486 CALL_ConvolutionParameterf(ctx
->Exec
, (target
, pname
, param
));
1491 static void GLAPIENTRY
1492 save_ConvolutionParameterfv(GLenum target
, GLenum pname
,
1493 const GLfloat
*params
)
1495 GET_CURRENT_CONTEXT(ctx
);
1497 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1498 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CONVOLUTION_PARAMETER_FV
, 6);
1503 if (pname
== GL_CONVOLUTION_BORDER_COLOR
||
1504 pname
== GL_CONVOLUTION_FILTER_SCALE
||
1505 pname
== GL_CONVOLUTION_FILTER_BIAS
) {
1511 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
1514 if (ctx
->ExecuteFlag
) {
1515 CALL_ConvolutionParameterfv(ctx
->Exec
, (target
, pname
, params
));
1520 static void GLAPIENTRY
1521 save_CopyPixels(GLint x
, GLint y
, GLsizei width
, GLsizei height
, GLenum type
)
1523 GET_CURRENT_CONTEXT(ctx
);
1525 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1526 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_PIXELS
, 5);
1530 n
[3].i
= (GLint
) width
;
1531 n
[4].i
= (GLint
) height
;
1534 if (ctx
->ExecuteFlag
) {
1535 CALL_CopyPixels(ctx
->Exec
, (x
, y
, width
, height
, type
));
1541 static void GLAPIENTRY
1542 save_CopyTexImage1D(GLenum target
, GLint level
, GLenum internalformat
,
1543 GLint x
, GLint y
, GLsizei width
, GLint border
)
1545 GET_CURRENT_CONTEXT(ctx
);
1547 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1548 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_TEX_IMAGE1D
, 7);
1552 n
[3].e
= internalformat
;
1558 if (ctx
->ExecuteFlag
) {
1559 CALL_CopyTexImage1D(ctx
->Exec
, (target
, level
, internalformat
,
1560 x
, y
, width
, border
));
1565 static void GLAPIENTRY
1566 save_CopyTexImage2D(GLenum target
, GLint level
,
1567 GLenum internalformat
,
1568 GLint x
, GLint y
, GLsizei width
,
1569 GLsizei height
, GLint border
)
1571 GET_CURRENT_CONTEXT(ctx
);
1573 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1574 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_TEX_IMAGE2D
, 8);
1578 n
[3].e
= internalformat
;
1585 if (ctx
->ExecuteFlag
) {
1586 CALL_CopyTexImage2D(ctx
->Exec
, (target
, level
, internalformat
,
1587 x
, y
, width
, height
, border
));
1593 static void GLAPIENTRY
1594 save_CopyTexSubImage1D(GLenum target
, GLint level
,
1595 GLint xoffset
, GLint x
, GLint y
, GLsizei width
)
1597 GET_CURRENT_CONTEXT(ctx
);
1599 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1600 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_TEX_SUB_IMAGE1D
, 6);
1609 if (ctx
->ExecuteFlag
) {
1610 CALL_CopyTexSubImage1D(ctx
->Exec
,
1611 (target
, level
, xoffset
, x
, y
, width
));
1616 static void GLAPIENTRY
1617 save_CopyTexSubImage2D(GLenum target
, GLint level
,
1618 GLint xoffset
, GLint yoffset
,
1619 GLint x
, GLint y
, GLsizei width
, GLint height
)
1621 GET_CURRENT_CONTEXT(ctx
);
1623 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1624 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_TEX_SUB_IMAGE2D
, 8);
1635 if (ctx
->ExecuteFlag
) {
1636 CALL_CopyTexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
1637 x
, y
, width
, height
));
1642 static void GLAPIENTRY
1643 save_CopyTexSubImage3D(GLenum target
, GLint level
,
1644 GLint xoffset
, GLint yoffset
, GLint zoffset
,
1645 GLint x
, GLint y
, GLsizei width
, GLint height
)
1647 GET_CURRENT_CONTEXT(ctx
);
1649 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1650 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_TEX_SUB_IMAGE3D
, 9);
1662 if (ctx
->ExecuteFlag
) {
1663 CALL_CopyTexSubImage3D(ctx
->Exec
, (target
, level
,
1664 xoffset
, yoffset
, zoffset
,
1665 x
, y
, width
, height
));
1670 static void GLAPIENTRY
1671 save_CullFace(GLenum mode
)
1673 GET_CURRENT_CONTEXT(ctx
);
1675 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1676 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CULL_FACE
, 1);
1680 if (ctx
->ExecuteFlag
) {
1681 CALL_CullFace(ctx
->Exec
, (mode
));
1686 static void GLAPIENTRY
1687 save_DepthFunc(GLenum func
)
1689 GET_CURRENT_CONTEXT(ctx
);
1691 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1692 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DEPTH_FUNC
, 1);
1696 if (ctx
->ExecuteFlag
) {
1697 CALL_DepthFunc(ctx
->Exec
, (func
));
1702 static void GLAPIENTRY
1703 save_DepthMask(GLboolean mask
)
1705 GET_CURRENT_CONTEXT(ctx
);
1707 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1708 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DEPTH_MASK
, 1);
1712 if (ctx
->ExecuteFlag
) {
1713 CALL_DepthMask(ctx
->Exec
, (mask
));
1718 static void GLAPIENTRY
1719 save_DepthRange(GLclampd nearval
, GLclampd farval
)
1721 GET_CURRENT_CONTEXT(ctx
);
1723 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1724 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DEPTH_RANGE
, 2);
1726 n
[1].f
= (GLfloat
) nearval
;
1727 n
[2].f
= (GLfloat
) farval
;
1729 if (ctx
->ExecuteFlag
) {
1730 CALL_DepthRange(ctx
->Exec
, (nearval
, farval
));
1735 static void GLAPIENTRY
1736 save_Disable(GLenum cap
)
1738 GET_CURRENT_CONTEXT(ctx
);
1740 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1741 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DISABLE
, 1);
1745 if (ctx
->ExecuteFlag
) {
1746 CALL_Disable(ctx
->Exec
, (cap
));
1751 static void GLAPIENTRY
1752 save_DrawBuffer(GLenum mode
)
1754 GET_CURRENT_CONTEXT(ctx
);
1756 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1757 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DRAW_BUFFER
, 1);
1761 if (ctx
->ExecuteFlag
) {
1762 CALL_DrawBuffer(ctx
->Exec
, (mode
));
1767 static void GLAPIENTRY
1768 save_DrawPixels(GLsizei width
, GLsizei height
,
1769 GLenum format
, GLenum type
, const GLvoid
* pixels
)
1771 GET_CURRENT_CONTEXT(ctx
);
1774 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1776 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DRAW_PIXELS
, 5);
1782 n
[5].data
= unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
1783 pixels
, &ctx
->Unpack
);
1785 if (ctx
->ExecuteFlag
) {
1786 CALL_DrawPixels(ctx
->Exec
, (width
, height
, format
, type
, pixels
));
1792 static void GLAPIENTRY
1793 save_Enable(GLenum cap
)
1795 GET_CURRENT_CONTEXT(ctx
);
1797 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1798 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ENABLE
, 1);
1802 if (ctx
->ExecuteFlag
) {
1803 CALL_Enable(ctx
->Exec
, (cap
));
1809 static void GLAPIENTRY
1810 _mesa_save_EvalMesh1(GLenum mode
, GLint i1
, GLint i2
)
1812 GET_CURRENT_CONTEXT(ctx
);
1814 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1815 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVALMESH1
, 3);
1821 if (ctx
->ExecuteFlag
) {
1822 CALL_EvalMesh1(ctx
->Exec
, (mode
, i1
, i2
));
1827 static void GLAPIENTRY
1828 _mesa_save_EvalMesh2(GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
1830 GET_CURRENT_CONTEXT(ctx
);
1832 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1833 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVALMESH2
, 5);
1841 if (ctx
->ExecuteFlag
) {
1842 CALL_EvalMesh2(ctx
->Exec
, (mode
, i1
, i2
, j1
, j2
));
1849 static void GLAPIENTRY
1850 save_Fogfv(GLenum pname
, const GLfloat
*params
)
1852 GET_CURRENT_CONTEXT(ctx
);
1854 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1855 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_FOG
, 5);
1863 if (ctx
->ExecuteFlag
) {
1864 CALL_Fogfv(ctx
->Exec
, (pname
, params
));
1869 static void GLAPIENTRY
1870 save_Fogf(GLenum pname
, GLfloat param
)
1872 save_Fogfv(pname
, ¶m
);
1876 static void GLAPIENTRY
1877 save_Fogiv(GLenum pname
, const GLint
*params
)
1882 case GL_FOG_DENSITY
:
1886 p
[0] = (GLfloat
) *params
;
1889 p
[0] = INT_TO_FLOAT(params
[0]);
1890 p
[1] = INT_TO_FLOAT(params
[1]);
1891 p
[2] = INT_TO_FLOAT(params
[2]);
1892 p
[3] = INT_TO_FLOAT(params
[3]);
1895 /* Error will be caught later in gl_Fogfv */
1896 ASSIGN_4V(p
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
1898 save_Fogfv(pname
, p
);
1902 static void GLAPIENTRY
1903 save_Fogi(GLenum pname
, GLint param
)
1905 save_Fogiv(pname
, ¶m
);
1909 static void GLAPIENTRY
1910 save_FrontFace(GLenum mode
)
1912 GET_CURRENT_CONTEXT(ctx
);
1914 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1915 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_FRONT_FACE
, 1);
1919 if (ctx
->ExecuteFlag
) {
1920 CALL_FrontFace(ctx
->Exec
, (mode
));
1925 static void GLAPIENTRY
1926 save_Frustum(GLdouble left
, GLdouble right
,
1927 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
1929 GET_CURRENT_CONTEXT(ctx
);
1931 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1932 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_FRUSTUM
, 6);
1934 n
[1].f
= (GLfloat
) left
;
1935 n
[2].f
= (GLfloat
) right
;
1936 n
[3].f
= (GLfloat
) bottom
;
1937 n
[4].f
= (GLfloat
) top
;
1938 n
[5].f
= (GLfloat
) nearval
;
1939 n
[6].f
= (GLfloat
) farval
;
1941 if (ctx
->ExecuteFlag
) {
1942 CALL_Frustum(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
1947 static void GLAPIENTRY
1948 save_Hint(GLenum target
, GLenum mode
)
1950 GET_CURRENT_CONTEXT(ctx
);
1952 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1953 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_HINT
, 2);
1958 if (ctx
->ExecuteFlag
) {
1959 CALL_Hint(ctx
->Exec
, (target
, mode
));
1964 static void GLAPIENTRY
1965 save_Histogram(GLenum target
, GLsizei width
, GLenum internalFormat
,
1968 GET_CURRENT_CONTEXT(ctx
);
1971 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1972 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_HISTOGRAM
, 4);
1976 n
[3].e
= internalFormat
;
1979 if (ctx
->ExecuteFlag
) {
1980 CALL_Histogram(ctx
->Exec
, (target
, width
, internalFormat
, sink
));
1985 static void GLAPIENTRY
1986 save_IndexMask(GLuint mask
)
1988 GET_CURRENT_CONTEXT(ctx
);
1990 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1991 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_INDEX_MASK
, 1);
1995 if (ctx
->ExecuteFlag
) {
1996 CALL_IndexMask(ctx
->Exec
, (mask
));
2001 static void GLAPIENTRY
2002 save_InitNames(void)
2004 GET_CURRENT_CONTEXT(ctx
);
2005 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2006 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_INIT_NAMES
, 0);
2007 if (ctx
->ExecuteFlag
) {
2008 CALL_InitNames(ctx
->Exec
, ());
2013 static void GLAPIENTRY
2014 save_Lightfv(GLenum light
, GLenum pname
, const GLfloat
*params
)
2016 GET_CURRENT_CONTEXT(ctx
);
2018 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2019 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LIGHT
, 6);
2037 case GL_SPOT_DIRECTION
:
2040 case GL_SPOT_EXPONENT
:
2043 case GL_SPOT_CUTOFF
:
2046 case GL_CONSTANT_ATTENUATION
:
2049 case GL_LINEAR_ATTENUATION
:
2052 case GL_QUADRATIC_ATTENUATION
:
2058 for (i
= 0; i
< nParams
; i
++) {
2059 n
[3 + i
].f
= params
[i
];
2062 if (ctx
->ExecuteFlag
) {
2063 CALL_Lightfv(ctx
->Exec
, (light
, pname
, params
));
2068 static void GLAPIENTRY
2069 save_Lightf(GLenum light
, GLenum pname
, GLfloat params
)
2071 save_Lightfv(light
, pname
, ¶ms
);
2075 static void GLAPIENTRY
2076 save_Lightiv(GLenum light
, GLenum pname
, const GLint
*params
)
2083 fparam
[0] = INT_TO_FLOAT(params
[0]);
2084 fparam
[1] = INT_TO_FLOAT(params
[1]);
2085 fparam
[2] = INT_TO_FLOAT(params
[2]);
2086 fparam
[3] = INT_TO_FLOAT(params
[3]);
2089 fparam
[0] = (GLfloat
) params
[0];
2090 fparam
[1] = (GLfloat
) params
[1];
2091 fparam
[2] = (GLfloat
) params
[2];
2092 fparam
[3] = (GLfloat
) params
[3];
2094 case GL_SPOT_DIRECTION
:
2095 fparam
[0] = (GLfloat
) params
[0];
2096 fparam
[1] = (GLfloat
) params
[1];
2097 fparam
[2] = (GLfloat
) params
[2];
2099 case GL_SPOT_EXPONENT
:
2100 case GL_SPOT_CUTOFF
:
2101 case GL_CONSTANT_ATTENUATION
:
2102 case GL_LINEAR_ATTENUATION
:
2103 case GL_QUADRATIC_ATTENUATION
:
2104 fparam
[0] = (GLfloat
) params
[0];
2107 /* error will be caught later in gl_Lightfv */
2110 save_Lightfv(light
, pname
, fparam
);
2114 static void GLAPIENTRY
2115 save_Lighti(GLenum light
, GLenum pname
, GLint param
)
2117 save_Lightiv(light
, pname
, ¶m
);
2121 static void GLAPIENTRY
2122 save_LightModelfv(GLenum pname
, const GLfloat
*params
)
2124 GET_CURRENT_CONTEXT(ctx
);
2126 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2127 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LIGHT_MODEL
, 5);
2135 if (ctx
->ExecuteFlag
) {
2136 CALL_LightModelfv(ctx
->Exec
, (pname
, params
));
2141 static void GLAPIENTRY
2142 save_LightModelf(GLenum pname
, GLfloat param
)
2144 save_LightModelfv(pname
, ¶m
);
2148 static void GLAPIENTRY
2149 save_LightModeliv(GLenum pname
, const GLint
*params
)
2153 case GL_LIGHT_MODEL_AMBIENT
:
2154 fparam
[0] = INT_TO_FLOAT(params
[0]);
2155 fparam
[1] = INT_TO_FLOAT(params
[1]);
2156 fparam
[2] = INT_TO_FLOAT(params
[2]);
2157 fparam
[3] = INT_TO_FLOAT(params
[3]);
2159 case GL_LIGHT_MODEL_LOCAL_VIEWER
:
2160 case GL_LIGHT_MODEL_TWO_SIDE
:
2161 case GL_LIGHT_MODEL_COLOR_CONTROL
:
2162 fparam
[0] = (GLfloat
) params
[0];
2165 /* Error will be caught later in gl_LightModelfv */
2166 ASSIGN_4V(fparam
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
2168 save_LightModelfv(pname
, fparam
);
2172 static void GLAPIENTRY
2173 save_LightModeli(GLenum pname
, GLint param
)
2175 save_LightModeliv(pname
, ¶m
);
2179 static void GLAPIENTRY
2180 save_LineStipple(GLint factor
, GLushort pattern
)
2182 GET_CURRENT_CONTEXT(ctx
);
2184 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2185 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LINE_STIPPLE
, 2);
2190 if (ctx
->ExecuteFlag
) {
2191 CALL_LineStipple(ctx
->Exec
, (factor
, pattern
));
2196 static void GLAPIENTRY
2197 save_LineWidth(GLfloat width
)
2199 GET_CURRENT_CONTEXT(ctx
);
2201 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2202 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LINE_WIDTH
, 1);
2206 if (ctx
->ExecuteFlag
) {
2207 CALL_LineWidth(ctx
->Exec
, (width
));
2212 static void GLAPIENTRY
2213 save_ListBase(GLuint base
)
2215 GET_CURRENT_CONTEXT(ctx
);
2217 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2218 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LIST_BASE
, 1);
2222 if (ctx
->ExecuteFlag
) {
2223 CALL_ListBase(ctx
->Exec
, (base
));
2228 static void GLAPIENTRY
2229 save_LoadIdentity(void)
2231 GET_CURRENT_CONTEXT(ctx
);
2232 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2233 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_LOAD_IDENTITY
, 0);
2234 if (ctx
->ExecuteFlag
) {
2235 CALL_LoadIdentity(ctx
->Exec
, ());
2240 static void GLAPIENTRY
2241 save_LoadMatrixf(const GLfloat
* m
)
2243 GET_CURRENT_CONTEXT(ctx
);
2245 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2246 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LOAD_MATRIX
, 16);
2249 for (i
= 0; i
< 16; i
++) {
2253 if (ctx
->ExecuteFlag
) {
2254 CALL_LoadMatrixf(ctx
->Exec
, (m
));
2259 static void GLAPIENTRY
2260 save_LoadMatrixd(const GLdouble
* m
)
2264 for (i
= 0; i
< 16; i
++) {
2265 f
[i
] = (GLfloat
) m
[i
];
2267 save_LoadMatrixf(f
);
2271 static void GLAPIENTRY
2272 save_LoadName(GLuint name
)
2274 GET_CURRENT_CONTEXT(ctx
);
2276 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2277 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LOAD_NAME
, 1);
2281 if (ctx
->ExecuteFlag
) {
2282 CALL_LoadName(ctx
->Exec
, (name
));
2287 static void GLAPIENTRY
2288 save_LogicOp(GLenum opcode
)
2290 GET_CURRENT_CONTEXT(ctx
);
2292 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2293 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LOGIC_OP
, 1);
2297 if (ctx
->ExecuteFlag
) {
2298 CALL_LogicOp(ctx
->Exec
, (opcode
));
2303 static void GLAPIENTRY
2304 save_Map1d(GLenum target
, GLdouble u1
, GLdouble u2
, GLint stride
,
2305 GLint order
, const GLdouble
* points
)
2307 GET_CURRENT_CONTEXT(ctx
);
2309 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2310 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MAP1
, 6);
2312 GLfloat
*pnts
= _mesa_copy_map_points1d(target
, stride
, order
, points
);
2314 n
[2].f
= (GLfloat
) u1
;
2315 n
[3].f
= (GLfloat
) u2
;
2316 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2318 n
[6].data
= (void *) pnts
;
2320 if (ctx
->ExecuteFlag
) {
2321 CALL_Map1d(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2325 static void GLAPIENTRY
2326 save_Map1f(GLenum target
, GLfloat u1
, GLfloat u2
, GLint stride
,
2327 GLint order
, const GLfloat
* points
)
2329 GET_CURRENT_CONTEXT(ctx
);
2331 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2332 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MAP1
, 6);
2334 GLfloat
*pnts
= _mesa_copy_map_points1f(target
, stride
, order
, points
);
2338 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2340 n
[6].data
= (void *) pnts
;
2342 if (ctx
->ExecuteFlag
) {
2343 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2348 static void GLAPIENTRY
2349 save_Map2d(GLenum target
,
2350 GLdouble u1
, GLdouble u2
, GLint ustride
, GLint uorder
,
2351 GLdouble v1
, GLdouble v2
, GLint vstride
, GLint vorder
,
2352 const GLdouble
* points
)
2354 GET_CURRENT_CONTEXT(ctx
);
2356 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2357 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MAP2
, 10);
2359 GLfloat
*pnts
= _mesa_copy_map_points2d(target
, ustride
, uorder
,
2360 vstride
, vorder
, points
);
2362 n
[2].f
= (GLfloat
) u1
;
2363 n
[3].f
= (GLfloat
) u2
;
2364 n
[4].f
= (GLfloat
) v1
;
2365 n
[5].f
= (GLfloat
) v2
;
2366 /* XXX verify these strides are correct */
2367 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2368 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2371 n
[10].data
= (void *) pnts
;
2373 if (ctx
->ExecuteFlag
) {
2374 CALL_Map2d(ctx
->Exec
, (target
,
2375 u1
, u2
, ustride
, uorder
,
2376 v1
, v2
, vstride
, vorder
, points
));
2381 static void GLAPIENTRY
2382 save_Map2f(GLenum target
,
2383 GLfloat u1
, GLfloat u2
, GLint ustride
, GLint uorder
,
2384 GLfloat v1
, GLfloat v2
, GLint vstride
, GLint vorder
,
2385 const GLfloat
* points
)
2387 GET_CURRENT_CONTEXT(ctx
);
2389 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2390 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MAP2
, 10);
2392 GLfloat
*pnts
= _mesa_copy_map_points2f(target
, ustride
, uorder
,
2393 vstride
, vorder
, points
);
2399 /* XXX verify these strides are correct */
2400 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2401 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2404 n
[10].data
= (void *) pnts
;
2406 if (ctx
->ExecuteFlag
) {
2407 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
2408 v1
, v2
, vstride
, vorder
, points
));
2413 static void GLAPIENTRY
2414 save_MapGrid1f(GLint un
, GLfloat u1
, GLfloat u2
)
2416 GET_CURRENT_CONTEXT(ctx
);
2418 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2419 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MAPGRID1
, 3);
2425 if (ctx
->ExecuteFlag
) {
2426 CALL_MapGrid1f(ctx
->Exec
, (un
, u1
, u2
));
2431 static void GLAPIENTRY
2432 save_MapGrid1d(GLint un
, GLdouble u1
, GLdouble u2
)
2434 save_MapGrid1f(un
, (GLfloat
) u1
, (GLfloat
) u2
);
2438 static void GLAPIENTRY
2439 save_MapGrid2f(GLint un
, GLfloat u1
, GLfloat u2
,
2440 GLint vn
, GLfloat v1
, GLfloat v2
)
2442 GET_CURRENT_CONTEXT(ctx
);
2444 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2445 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MAPGRID2
, 6);
2454 if (ctx
->ExecuteFlag
) {
2455 CALL_MapGrid2f(ctx
->Exec
, (un
, u1
, u2
, vn
, v1
, v2
));
2461 static void GLAPIENTRY
2462 save_MapGrid2d(GLint un
, GLdouble u1
, GLdouble u2
,
2463 GLint vn
, GLdouble v1
, GLdouble v2
)
2465 save_MapGrid2f(un
, (GLfloat
) u1
, (GLfloat
) u2
,
2466 vn
, (GLfloat
) v1
, (GLfloat
) v2
);
2470 static void GLAPIENTRY
2471 save_MatrixMode(GLenum mode
)
2473 GET_CURRENT_CONTEXT(ctx
);
2475 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2476 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MATRIX_MODE
, 1);
2480 if (ctx
->ExecuteFlag
) {
2481 CALL_MatrixMode(ctx
->Exec
, (mode
));
2486 static void GLAPIENTRY
2487 save_Minmax(GLenum target
, GLenum internalFormat
, GLboolean sink
)
2489 GET_CURRENT_CONTEXT(ctx
);
2492 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2493 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MIN_MAX
, 3);
2496 n
[2].e
= internalFormat
;
2499 if (ctx
->ExecuteFlag
) {
2500 CALL_Minmax(ctx
->Exec
, (target
, internalFormat
, sink
));
2505 static void GLAPIENTRY
2506 save_MultMatrixf(const GLfloat
* m
)
2508 GET_CURRENT_CONTEXT(ctx
);
2510 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2511 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MULT_MATRIX
, 16);
2514 for (i
= 0; i
< 16; i
++) {
2518 if (ctx
->ExecuteFlag
) {
2519 CALL_MultMatrixf(ctx
->Exec
, (m
));
2524 static void GLAPIENTRY
2525 save_MultMatrixd(const GLdouble
* m
)
2529 for (i
= 0; i
< 16; i
++) {
2530 f
[i
] = (GLfloat
) m
[i
];
2532 save_MultMatrixf(f
);
2536 static void GLAPIENTRY
2537 save_NewList(GLuint name
, GLenum mode
)
2539 GET_CURRENT_CONTEXT(ctx
);
2540 /* It's an error to call this function while building a display list */
2541 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
2548 static void GLAPIENTRY
2549 save_Ortho(GLdouble left
, GLdouble right
,
2550 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
2552 GET_CURRENT_CONTEXT(ctx
);
2554 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2555 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ORTHO
, 6);
2557 n
[1].f
= (GLfloat
) left
;
2558 n
[2].f
= (GLfloat
) right
;
2559 n
[3].f
= (GLfloat
) bottom
;
2560 n
[4].f
= (GLfloat
) top
;
2561 n
[5].f
= (GLfloat
) nearval
;
2562 n
[6].f
= (GLfloat
) farval
;
2564 if (ctx
->ExecuteFlag
) {
2565 CALL_Ortho(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
2570 static void GLAPIENTRY
2571 save_PixelMapfv(GLenum map
, GLint mapsize
, const GLfloat
*values
)
2573 GET_CURRENT_CONTEXT(ctx
);
2575 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2576 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PIXEL_MAP
, 3);
2580 n
[3].data
= (void *) _mesa_malloc(mapsize
* sizeof(GLfloat
));
2581 MEMCPY(n
[3].data
, (void *) values
, mapsize
* sizeof(GLfloat
));
2583 if (ctx
->ExecuteFlag
) {
2584 CALL_PixelMapfv(ctx
->Exec
, (map
, mapsize
, values
));
2589 static void GLAPIENTRY
2590 save_PixelMapuiv(GLenum map
, GLint mapsize
, const GLuint
*values
)
2592 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2594 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
2595 for (i
= 0; i
< mapsize
; i
++) {
2596 fvalues
[i
] = (GLfloat
) values
[i
];
2600 for (i
= 0; i
< mapsize
; i
++) {
2601 fvalues
[i
] = UINT_TO_FLOAT(values
[i
]);
2604 save_PixelMapfv(map
, mapsize
, fvalues
);
2608 static void GLAPIENTRY
2609 save_PixelMapusv(GLenum map
, GLint mapsize
, const GLushort
*values
)
2611 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2613 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
2614 for (i
= 0; i
< mapsize
; i
++) {
2615 fvalues
[i
] = (GLfloat
) values
[i
];
2619 for (i
= 0; i
< mapsize
; i
++) {
2620 fvalues
[i
] = USHORT_TO_FLOAT(values
[i
]);
2623 save_PixelMapfv(map
, mapsize
, fvalues
);
2627 static void GLAPIENTRY
2628 save_PixelTransferf(GLenum pname
, GLfloat param
)
2630 GET_CURRENT_CONTEXT(ctx
);
2632 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2633 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PIXEL_TRANSFER
, 2);
2638 if (ctx
->ExecuteFlag
) {
2639 CALL_PixelTransferf(ctx
->Exec
, (pname
, param
));
2644 static void GLAPIENTRY
2645 save_PixelTransferi(GLenum pname
, GLint param
)
2647 save_PixelTransferf(pname
, (GLfloat
) param
);
2651 static void GLAPIENTRY
2652 save_PixelZoom(GLfloat xfactor
, GLfloat yfactor
)
2654 GET_CURRENT_CONTEXT(ctx
);
2656 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2657 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PIXEL_ZOOM
, 2);
2662 if (ctx
->ExecuteFlag
) {
2663 CALL_PixelZoom(ctx
->Exec
, (xfactor
, yfactor
));
2668 static void GLAPIENTRY
2669 save_PointParameterfvEXT(GLenum pname
, const GLfloat
*params
)
2671 GET_CURRENT_CONTEXT(ctx
);
2673 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2674 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_POINT_PARAMETERS
, 4);
2681 if (ctx
->ExecuteFlag
) {
2682 CALL_PointParameterfvEXT(ctx
->Exec
, (pname
, params
));
2687 static void GLAPIENTRY
2688 save_PointParameterfEXT(GLenum pname
, GLfloat param
)
2690 save_PointParameterfvEXT(pname
, ¶m
);
2693 static void GLAPIENTRY
2694 save_PointParameteriNV(GLenum pname
, GLint param
)
2696 GLfloat p
= (GLfloat
) param
;
2697 save_PointParameterfvEXT(pname
, &p
);
2700 static void GLAPIENTRY
2701 save_PointParameterivNV(GLenum pname
, const GLint
* param
)
2703 GLfloat p
= (GLfloat
) param
[0];
2704 save_PointParameterfvEXT(pname
, &p
);
2708 static void GLAPIENTRY
2709 save_PointSize(GLfloat size
)
2711 GET_CURRENT_CONTEXT(ctx
);
2713 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2714 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_POINT_SIZE
, 1);
2718 if (ctx
->ExecuteFlag
) {
2719 CALL_PointSize(ctx
->Exec
, (size
));
2724 static void GLAPIENTRY
2725 save_PolygonMode(GLenum face
, GLenum mode
)
2727 GET_CURRENT_CONTEXT(ctx
);
2729 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2730 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_POLYGON_MODE
, 2);
2735 if (ctx
->ExecuteFlag
) {
2736 CALL_PolygonMode(ctx
->Exec
, (face
, mode
));
2741 static void GLAPIENTRY
2742 save_PolygonStipple(const GLubyte
* pattern
)
2744 GET_CURRENT_CONTEXT(ctx
);
2747 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2749 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_POLYGON_STIPPLE
, 1);
2751 n
[1].data
= unpack_image(ctx
, 2, 32, 32, 1, GL_COLOR_INDEX
, GL_BITMAP
,
2752 pattern
, &ctx
->Unpack
);
2754 if (ctx
->ExecuteFlag
) {
2755 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) pattern
));
2760 static void GLAPIENTRY
2761 save_PolygonOffset(GLfloat factor
, GLfloat units
)
2763 GET_CURRENT_CONTEXT(ctx
);
2765 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2766 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_POLYGON_OFFSET
, 2);
2771 if (ctx
->ExecuteFlag
) {
2772 CALL_PolygonOffset(ctx
->Exec
, (factor
, units
));
2777 static void GLAPIENTRY
2778 save_PolygonOffsetEXT(GLfloat factor
, GLfloat bias
)
2780 GET_CURRENT_CONTEXT(ctx
);
2781 /* XXX mult by DepthMaxF here??? */
2782 save_PolygonOffset(factor
, ctx
->DrawBuffer
->_DepthMaxF
* bias
);
2786 static void GLAPIENTRY
2787 save_PopAttrib(void)
2789 GET_CURRENT_CONTEXT(ctx
);
2790 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2791 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_POP_ATTRIB
, 0);
2792 if (ctx
->ExecuteFlag
) {
2793 CALL_PopAttrib(ctx
->Exec
, ());
2798 static void GLAPIENTRY
2799 save_PopMatrix(void)
2801 GET_CURRENT_CONTEXT(ctx
);
2802 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2803 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_POP_MATRIX
, 0);
2804 if (ctx
->ExecuteFlag
) {
2805 CALL_PopMatrix(ctx
->Exec
, ());
2810 static void GLAPIENTRY
2813 GET_CURRENT_CONTEXT(ctx
);
2814 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2815 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_POP_NAME
, 0);
2816 if (ctx
->ExecuteFlag
) {
2817 CALL_PopName(ctx
->Exec
, ());
2822 static void GLAPIENTRY
2823 save_PrioritizeTextures(GLsizei num
, const GLuint
* textures
,
2824 const GLclampf
* priorities
)
2826 GET_CURRENT_CONTEXT(ctx
);
2828 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2830 for (i
= 0; i
< num
; i
++) {
2832 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PRIORITIZE_TEXTURE
, 2);
2834 n
[1].ui
= textures
[i
];
2835 n
[2].f
= priorities
[i
];
2838 if (ctx
->ExecuteFlag
) {
2839 CALL_PrioritizeTextures(ctx
->Exec
, (num
, textures
, priorities
));
2844 static void GLAPIENTRY
2845 save_PushAttrib(GLbitfield mask
)
2847 GET_CURRENT_CONTEXT(ctx
);
2849 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2850 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PUSH_ATTRIB
, 1);
2854 if (ctx
->ExecuteFlag
) {
2855 CALL_PushAttrib(ctx
->Exec
, (mask
));
2860 static void GLAPIENTRY
2861 save_PushMatrix(void)
2863 GET_CURRENT_CONTEXT(ctx
);
2864 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2865 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_PUSH_MATRIX
, 0);
2866 if (ctx
->ExecuteFlag
) {
2867 CALL_PushMatrix(ctx
->Exec
, ());
2872 static void GLAPIENTRY
2873 save_PushName(GLuint name
)
2875 GET_CURRENT_CONTEXT(ctx
);
2877 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2878 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PUSH_NAME
, 1);
2882 if (ctx
->ExecuteFlag
) {
2883 CALL_PushName(ctx
->Exec
, (name
));
2888 static void GLAPIENTRY
2889 save_RasterPos4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
2891 GET_CURRENT_CONTEXT(ctx
);
2893 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2894 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_RASTER_POS
, 4);
2901 if (ctx
->ExecuteFlag
) {
2902 CALL_RasterPos4f(ctx
->Exec
, (x
, y
, z
, w
));
2906 static void GLAPIENTRY
2907 save_RasterPos2d(GLdouble x
, GLdouble y
)
2909 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
2912 static void GLAPIENTRY
2913 save_RasterPos2f(GLfloat x
, GLfloat y
)
2915 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2918 static void GLAPIENTRY
2919 save_RasterPos2i(GLint x
, GLint y
)
2921 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
2924 static void GLAPIENTRY
2925 save_RasterPos2s(GLshort x
, GLshort y
)
2927 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2930 static void GLAPIENTRY
2931 save_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
2933 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
2936 static void GLAPIENTRY
2937 save_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
2939 save_RasterPos4f(x
, y
, z
, 1.0F
);
2942 static void GLAPIENTRY
2943 save_RasterPos3i(GLint x
, GLint y
, GLint z
)
2945 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
2948 static void GLAPIENTRY
2949 save_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
2951 save_RasterPos4f(x
, y
, z
, 1.0F
);
2954 static void GLAPIENTRY
2955 save_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
2957 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
2960 static void GLAPIENTRY
2961 save_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
2963 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
2966 static void GLAPIENTRY
2967 save_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
2969 save_RasterPos4f(x
, y
, z
, w
);
2972 static void GLAPIENTRY
2973 save_RasterPos2dv(const GLdouble
* v
)
2975 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
2978 static void GLAPIENTRY
2979 save_RasterPos2fv(const GLfloat
* v
)
2981 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2984 static void GLAPIENTRY
2985 save_RasterPos2iv(const GLint
* v
)
2987 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
2990 static void GLAPIENTRY
2991 save_RasterPos2sv(const GLshort
* v
)
2993 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2996 static void GLAPIENTRY
2997 save_RasterPos3dv(const GLdouble
* v
)
2999 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3002 static void GLAPIENTRY
3003 save_RasterPos3fv(const GLfloat
* v
)
3005 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3008 static void GLAPIENTRY
3009 save_RasterPos3iv(const GLint
* v
)
3011 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3014 static void GLAPIENTRY
3015 save_RasterPos3sv(const GLshort
* v
)
3017 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3020 static void GLAPIENTRY
3021 save_RasterPos4dv(const GLdouble
* v
)
3023 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3024 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3027 static void GLAPIENTRY
3028 save_RasterPos4fv(const GLfloat
* v
)
3030 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3033 static void GLAPIENTRY
3034 save_RasterPos4iv(const GLint
* v
)
3036 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3037 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3040 static void GLAPIENTRY
3041 save_RasterPos4sv(const GLshort
* v
)
3043 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3047 static void GLAPIENTRY
3048 save_PassThrough(GLfloat token
)
3050 GET_CURRENT_CONTEXT(ctx
);
3052 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3053 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PASSTHROUGH
, 1);
3057 if (ctx
->ExecuteFlag
) {
3058 CALL_PassThrough(ctx
->Exec
, (token
));
3063 static void GLAPIENTRY
3064 save_ReadBuffer(GLenum mode
)
3066 GET_CURRENT_CONTEXT(ctx
);
3068 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3069 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_READ_BUFFER
, 1);
3073 if (ctx
->ExecuteFlag
) {
3074 CALL_ReadBuffer(ctx
->Exec
, (mode
));
3079 static void GLAPIENTRY
3080 save_ResetHistogram(GLenum target
)
3082 GET_CURRENT_CONTEXT(ctx
);
3084 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3085 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_RESET_HISTOGRAM
, 1);
3089 if (ctx
->ExecuteFlag
) {
3090 CALL_ResetHistogram(ctx
->Exec
, (target
));
3095 static void GLAPIENTRY
3096 save_ResetMinmax(GLenum target
)
3098 GET_CURRENT_CONTEXT(ctx
);
3100 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3101 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_RESET_MIN_MAX
, 1);
3105 if (ctx
->ExecuteFlag
) {
3106 CALL_ResetMinmax(ctx
->Exec
, (target
));
3111 static void GLAPIENTRY
3112 save_Rotatef(GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
3114 GET_CURRENT_CONTEXT(ctx
);
3116 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3117 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ROTATE
, 4);
3124 if (ctx
->ExecuteFlag
) {
3125 CALL_Rotatef(ctx
->Exec
, (angle
, x
, y
, z
));
3130 static void GLAPIENTRY
3131 save_Rotated(GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
3133 save_Rotatef((GLfloat
) angle
, (GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3137 static void GLAPIENTRY
3138 save_Scalef(GLfloat x
, GLfloat y
, GLfloat z
)
3140 GET_CURRENT_CONTEXT(ctx
);
3142 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3143 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SCALE
, 3);
3149 if (ctx
->ExecuteFlag
) {
3150 CALL_Scalef(ctx
->Exec
, (x
, y
, z
));
3155 static void GLAPIENTRY
3156 save_Scaled(GLdouble x
, GLdouble y
, GLdouble z
)
3158 save_Scalef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3162 static void GLAPIENTRY
3163 save_Scissor(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3165 GET_CURRENT_CONTEXT(ctx
);
3167 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3168 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SCISSOR
, 4);
3175 if (ctx
->ExecuteFlag
) {
3176 CALL_Scissor(ctx
->Exec
, (x
, y
, width
, height
));
3181 static void GLAPIENTRY
3182 save_ShadeModel(GLenum mode
)
3184 GET_CURRENT_CONTEXT(ctx
);
3186 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx
);
3188 if (ctx
->ExecuteFlag
) {
3189 CALL_ShadeModel(ctx
->Exec
, (mode
));
3192 if (ctx
->ListState
.Current
.ShadeModel
== mode
)
3195 SAVE_FLUSH_VERTICES(ctx
);
3197 /* Only save the value if we know the statechange will take effect:
3199 if (ctx
->Driver
.CurrentSavePrimitive
== PRIM_OUTSIDE_BEGIN_END
)
3200 ctx
->ListState
.Current
.ShadeModel
= mode
;
3202 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SHADE_MODEL
, 1);
3209 static void GLAPIENTRY
3210 save_StencilFunc(GLenum func
, GLint ref
, GLuint mask
)
3212 GET_CURRENT_CONTEXT(ctx
);
3214 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3215 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_FUNC
, 3);
3221 if (ctx
->ExecuteFlag
) {
3222 CALL_StencilFunc(ctx
->Exec
, (func
, ref
, mask
));
3227 static void GLAPIENTRY
3228 save_StencilMask(GLuint mask
)
3230 GET_CURRENT_CONTEXT(ctx
);
3232 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3233 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_MASK
, 1);
3237 if (ctx
->ExecuteFlag
) {
3238 CALL_StencilMask(ctx
->Exec
, (mask
));
3243 static void GLAPIENTRY
3244 save_StencilOp(GLenum fail
, GLenum zfail
, GLenum zpass
)
3246 GET_CURRENT_CONTEXT(ctx
);
3248 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3249 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_OP
, 3);
3255 if (ctx
->ExecuteFlag
) {
3256 CALL_StencilOp(ctx
->Exec
, (fail
, zfail
, zpass
));
3261 static void GLAPIENTRY
3262 save_StencilFuncSeparate(GLenum face
, GLenum func
, GLint ref
, GLuint mask
)
3264 GET_CURRENT_CONTEXT(ctx
);
3266 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3267 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3274 if (ctx
->ExecuteFlag
) {
3275 CALL_StencilFuncSeparate(ctx
->Exec
, (face
, func
, ref
, mask
));
3280 static void GLAPIENTRY
3281 save_StencilFuncSeparateATI(GLenum frontfunc
, GLenum backfunc
, GLint ref
,
3284 GET_CURRENT_CONTEXT(ctx
);
3286 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3288 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3296 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3303 if (ctx
->ExecuteFlag
) {
3304 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_FRONT
, frontfunc
, ref
, mask
));
3305 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_BACK
, backfunc
, ref
, mask
));
3310 static void GLAPIENTRY
3311 save_StencilMaskSeparate(GLenum face
, GLuint mask
)
3313 GET_CURRENT_CONTEXT(ctx
);
3315 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3316 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_MASK_SEPARATE
, 2);
3321 if (ctx
->ExecuteFlag
) {
3322 CALL_StencilMaskSeparate(ctx
->Exec
, (face
, mask
));
3327 static void GLAPIENTRY
3328 save_StencilOpSeparate(GLenum face
, GLenum fail
, GLenum zfail
, GLenum zpass
)
3330 GET_CURRENT_CONTEXT(ctx
);
3332 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3333 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_OP_SEPARATE
, 4);
3340 if (ctx
->ExecuteFlag
) {
3341 CALL_StencilOpSeparate(ctx
->Exec
, (face
, fail
, zfail
, zpass
));
3346 static void GLAPIENTRY
3347 save_TexEnvfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3349 GET_CURRENT_CONTEXT(ctx
);
3351 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3352 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEXENV
, 6);
3356 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3364 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
3367 if (ctx
->ExecuteFlag
) {
3368 CALL_TexEnvfv(ctx
->Exec
, (target
, pname
, params
));
3373 static void GLAPIENTRY
3374 save_TexEnvf(GLenum target
, GLenum pname
, GLfloat param
)
3376 save_TexEnvfv(target
, pname
, ¶m
);
3380 static void GLAPIENTRY
3381 save_TexEnvi(GLenum target
, GLenum pname
, GLint param
)
3384 p
[0] = (GLfloat
) param
;
3385 p
[1] = p
[2] = p
[3] = 0.0;
3386 save_TexEnvfv(target
, pname
, p
);
3390 static void GLAPIENTRY
3391 save_TexEnviv(GLenum target
, GLenum pname
, const GLint
* param
)
3394 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3395 p
[0] = INT_TO_FLOAT(param
[0]);
3396 p
[1] = INT_TO_FLOAT(param
[1]);
3397 p
[2] = INT_TO_FLOAT(param
[2]);
3398 p
[3] = INT_TO_FLOAT(param
[3]);
3401 p
[0] = (GLfloat
) param
[0];
3402 p
[1] = p
[2] = p
[3] = 0.0F
;
3404 save_TexEnvfv(target
, pname
, p
);
3408 static void GLAPIENTRY
3409 save_TexGenfv(GLenum coord
, GLenum pname
, const GLfloat
*params
)
3411 GET_CURRENT_CONTEXT(ctx
);
3413 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3414 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEXGEN
, 6);
3423 if (ctx
->ExecuteFlag
) {
3424 CALL_TexGenfv(ctx
->Exec
, (coord
, pname
, params
));
3429 static void GLAPIENTRY
3430 save_TexGeniv(GLenum coord
, GLenum pname
, const GLint
*params
)
3433 p
[0] = (GLfloat
) params
[0];
3434 p
[1] = (GLfloat
) params
[1];
3435 p
[2] = (GLfloat
) params
[2];
3436 p
[3] = (GLfloat
) params
[3];
3437 save_TexGenfv(coord
, pname
, p
);
3441 static void GLAPIENTRY
3442 save_TexGend(GLenum coord
, GLenum pname
, GLdouble param
)
3444 GLfloat p
= (GLfloat
) param
;
3445 save_TexGenfv(coord
, pname
, &p
);
3449 static void GLAPIENTRY
3450 save_TexGendv(GLenum coord
, GLenum pname
, const GLdouble
*params
)
3453 p
[0] = (GLfloat
) params
[0];
3454 p
[1] = (GLfloat
) params
[1];
3455 p
[2] = (GLfloat
) params
[2];
3456 p
[3] = (GLfloat
) params
[3];
3457 save_TexGenfv(coord
, pname
, p
);
3461 static void GLAPIENTRY
3462 save_TexGenf(GLenum coord
, GLenum pname
, GLfloat param
)
3464 save_TexGenfv(coord
, pname
, ¶m
);
3468 static void GLAPIENTRY
3469 save_TexGeni(GLenum coord
, GLenum pname
, GLint param
)
3471 save_TexGeniv(coord
, pname
, ¶m
);
3475 static void GLAPIENTRY
3476 save_TexParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3478 GET_CURRENT_CONTEXT(ctx
);
3480 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3481 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEXPARAMETER
, 6);
3490 if (ctx
->ExecuteFlag
) {
3491 CALL_TexParameterfv(ctx
->Exec
, (target
, pname
, params
));
3496 static void GLAPIENTRY
3497 save_TexParameterf(GLenum target
, GLenum pname
, GLfloat param
)
3499 save_TexParameterfv(target
, pname
, ¶m
);
3503 static void GLAPIENTRY
3504 save_TexParameteri(GLenum target
, GLenum pname
, GLint param
)
3507 fparam
[0] = (GLfloat
) param
;
3508 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
3509 save_TexParameterfv(target
, pname
, fparam
);
3513 static void GLAPIENTRY
3514 save_TexParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
3517 fparam
[0] = (GLfloat
) params
[0];
3518 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
3519 save_TexParameterfv(target
, pname
, fparam
);
3523 static void GLAPIENTRY
3524 save_TexImage1D(GLenum target
,
3525 GLint level
, GLint components
,
3526 GLsizei width
, GLint border
,
3527 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3529 GET_CURRENT_CONTEXT(ctx
);
3530 if (target
== GL_PROXY_TEXTURE_1D
) {
3531 /* don't compile, execute immediately */
3532 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
3533 border
, format
, type
, pixels
));
3537 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3538 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_IMAGE1D
, 8);
3542 n
[3].i
= components
;
3543 n
[4].i
= (GLint
) width
;
3547 n
[8].data
= unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
3548 pixels
, &ctx
->Unpack
);
3550 if (ctx
->ExecuteFlag
) {
3551 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
3552 border
, format
, type
, pixels
));
3558 static void GLAPIENTRY
3559 save_TexImage2D(GLenum target
,
3560 GLint level
, GLint components
,
3561 GLsizei width
, GLsizei height
, GLint border
,
3562 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3564 GET_CURRENT_CONTEXT(ctx
);
3565 if (target
== GL_PROXY_TEXTURE_2D
) {
3566 /* don't compile, execute immediately */
3567 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
3568 height
, border
, format
, type
, pixels
));
3572 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3573 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_IMAGE2D
, 9);
3577 n
[3].i
= components
;
3578 n
[4].i
= (GLint
) width
;
3579 n
[5].i
= (GLint
) height
;
3583 n
[9].data
= unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
3584 pixels
, &ctx
->Unpack
);
3586 if (ctx
->ExecuteFlag
) {
3587 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
3588 height
, border
, format
, type
, pixels
));
3594 static void GLAPIENTRY
3595 save_TexImage3D(GLenum target
,
3596 GLint level
, GLint internalFormat
,
3597 GLsizei width
, GLsizei height
, GLsizei depth
,
3599 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3601 GET_CURRENT_CONTEXT(ctx
);
3602 if (target
== GL_PROXY_TEXTURE_3D
) {
3603 /* don't compile, execute immediately */
3604 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
3605 height
, depth
, border
, format
, type
,
3610 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3611 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_IMAGE3D
, 10);
3615 n
[3].i
= (GLint
) internalFormat
;
3616 n
[4].i
= (GLint
) width
;
3617 n
[5].i
= (GLint
) height
;
3618 n
[6].i
= (GLint
) depth
;
3622 n
[10].data
= unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
3623 pixels
, &ctx
->Unpack
);
3625 if (ctx
->ExecuteFlag
) {
3626 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
3627 height
, depth
, border
, format
, type
,
3634 static void GLAPIENTRY
3635 save_TexSubImage1D(GLenum target
, GLint level
, GLint xoffset
,
3636 GLsizei width
, GLenum format
, GLenum type
,
3637 const GLvoid
* pixels
)
3639 GET_CURRENT_CONTEXT(ctx
);
3642 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3644 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_SUB_IMAGE1D
, 7);
3649 n
[4].i
= (GLint
) width
;
3652 n
[7].data
= unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
3653 pixels
, &ctx
->Unpack
);
3655 if (ctx
->ExecuteFlag
) {
3656 CALL_TexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
, width
,
3657 format
, type
, pixels
));
3662 static void GLAPIENTRY
3663 save_TexSubImage2D(GLenum target
, GLint level
,
3664 GLint xoffset
, GLint yoffset
,
3665 GLsizei width
, GLsizei height
,
3666 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3668 GET_CURRENT_CONTEXT(ctx
);
3671 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3673 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_SUB_IMAGE2D
, 9);
3679 n
[5].i
= (GLint
) width
;
3680 n
[6].i
= (GLint
) height
;
3683 n
[9].data
= unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
3684 pixels
, &ctx
->Unpack
);
3686 if (ctx
->ExecuteFlag
) {
3687 CALL_TexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
3688 width
, height
, format
, type
, pixels
));
3693 static void GLAPIENTRY
3694 save_TexSubImage3D(GLenum target
, GLint level
,
3695 GLint xoffset
, GLint yoffset
, GLint zoffset
,
3696 GLsizei width
, GLsizei height
, GLsizei depth
,
3697 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3699 GET_CURRENT_CONTEXT(ctx
);
3702 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3704 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_SUB_IMAGE3D
, 11);
3711 n
[6].i
= (GLint
) width
;
3712 n
[7].i
= (GLint
) height
;
3713 n
[8].i
= (GLint
) depth
;
3716 n
[11].data
= unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
3717 pixels
, &ctx
->Unpack
);
3719 if (ctx
->ExecuteFlag
) {
3720 CALL_TexSubImage3D(ctx
->Exec
, (target
, level
,
3721 xoffset
, yoffset
, zoffset
,
3722 width
, height
, depth
, format
, type
,
3728 static void GLAPIENTRY
3729 save_Translatef(GLfloat x
, GLfloat y
, GLfloat z
)
3731 GET_CURRENT_CONTEXT(ctx
);
3733 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3734 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TRANSLATE
, 3);
3740 if (ctx
->ExecuteFlag
) {
3741 CALL_Translatef(ctx
->Exec
, (x
, y
, z
));
3746 static void GLAPIENTRY
3747 save_Translated(GLdouble x
, GLdouble y
, GLdouble z
)
3749 save_Translatef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3754 static void GLAPIENTRY
3755 save_Viewport(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3757 GET_CURRENT_CONTEXT(ctx
);
3759 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3760 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_VIEWPORT
, 4);
3764 n
[3].i
= (GLint
) width
;
3765 n
[4].i
= (GLint
) height
;
3767 if (ctx
->ExecuteFlag
) {
3768 CALL_Viewport(ctx
->Exec
, (x
, y
, width
, height
));
3773 static void GLAPIENTRY
3774 save_WindowPos4fMESA(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3776 GET_CURRENT_CONTEXT(ctx
);
3778 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3779 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_WINDOW_POS
, 4);
3786 if (ctx
->ExecuteFlag
) {
3787 CALL_WindowPos4fMESA(ctx
->Exec
, (x
, y
, z
, w
));
3791 static void GLAPIENTRY
3792 save_WindowPos2dMESA(GLdouble x
, GLdouble y
)
3794 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3797 static void GLAPIENTRY
3798 save_WindowPos2fMESA(GLfloat x
, GLfloat y
)
3800 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3803 static void GLAPIENTRY
3804 save_WindowPos2iMESA(GLint x
, GLint y
)
3806 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3809 static void GLAPIENTRY
3810 save_WindowPos2sMESA(GLshort x
, GLshort y
)
3812 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3815 static void GLAPIENTRY
3816 save_WindowPos3dMESA(GLdouble x
, GLdouble y
, GLdouble z
)
3818 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3821 static void GLAPIENTRY
3822 save_WindowPos3fMESA(GLfloat x
, GLfloat y
, GLfloat z
)
3824 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3827 static void GLAPIENTRY
3828 save_WindowPos3iMESA(GLint x
, GLint y
, GLint z
)
3830 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3833 static void GLAPIENTRY
3834 save_WindowPos3sMESA(GLshort x
, GLshort y
, GLshort z
)
3836 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3839 static void GLAPIENTRY
3840 save_WindowPos4dMESA(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3842 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3845 static void GLAPIENTRY
3846 save_WindowPos4iMESA(GLint x
, GLint y
, GLint z
, GLint w
)
3848 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3851 static void GLAPIENTRY
3852 save_WindowPos4sMESA(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
3854 save_WindowPos4fMESA(x
, y
, z
, w
);
3857 static void GLAPIENTRY
3858 save_WindowPos2dvMESA(const GLdouble
* v
)
3860 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3863 static void GLAPIENTRY
3864 save_WindowPos2fvMESA(const GLfloat
* v
)
3866 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3869 static void GLAPIENTRY
3870 save_WindowPos2ivMESA(const GLint
* v
)
3872 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3875 static void GLAPIENTRY
3876 save_WindowPos2svMESA(const GLshort
* v
)
3878 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3881 static void GLAPIENTRY
3882 save_WindowPos3dvMESA(const GLdouble
* v
)
3884 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3887 static void GLAPIENTRY
3888 save_WindowPos3fvMESA(const GLfloat
* v
)
3890 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3893 static void GLAPIENTRY
3894 save_WindowPos3ivMESA(const GLint
* v
)
3896 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3899 static void GLAPIENTRY
3900 save_WindowPos3svMESA(const GLshort
* v
)
3902 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3905 static void GLAPIENTRY
3906 save_WindowPos4dvMESA(const GLdouble
* v
)
3908 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
3909 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3912 static void GLAPIENTRY
3913 save_WindowPos4fvMESA(const GLfloat
* v
)
3915 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3918 static void GLAPIENTRY
3919 save_WindowPos4ivMESA(const GLint
* v
)
3921 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
3922 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3925 static void GLAPIENTRY
3926 save_WindowPos4svMESA(const GLshort
* v
)
3928 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3933 /* GL_ARB_multitexture */
3934 static void GLAPIENTRY
3935 save_ActiveTextureARB(GLenum target
)
3937 GET_CURRENT_CONTEXT(ctx
);
3939 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3940 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ACTIVE_TEXTURE
, 1);
3944 if (ctx
->ExecuteFlag
) {
3945 CALL_ActiveTextureARB(ctx
->Exec
, (target
));
3950 /* GL_ARB_transpose_matrix */
3952 static void GLAPIENTRY
3953 save_LoadTransposeMatrixdARB(const GLdouble m
[16])
3956 _math_transposefd(tm
, m
);
3957 save_LoadMatrixf(tm
);
3961 static void GLAPIENTRY
3962 save_LoadTransposeMatrixfARB(const GLfloat m
[16])
3965 _math_transposef(tm
, m
);
3966 save_LoadMatrixf(tm
);
3970 static void GLAPIENTRY
3971 save_MultTransposeMatrixdARB(const GLdouble m
[16])
3974 _math_transposefd(tm
, m
);
3975 save_MultMatrixf(tm
);
3979 static void GLAPIENTRY
3980 save_MultTransposeMatrixfARB(const GLfloat m
[16])
3983 _math_transposef(tm
, m
);
3984 save_MultMatrixf(tm
);
3988 /* GL_ARB_texture_compression */
3989 static void GLAPIENTRY
3990 save_CompressedTexImage1DARB(GLenum target
, GLint level
,
3991 GLenum internalFormat
, GLsizei width
,
3992 GLint border
, GLsizei imageSize
,
3993 const GLvoid
* data
)
3995 GET_CURRENT_CONTEXT(ctx
);
3996 if (target
== GL_PROXY_TEXTURE_1D
) {
3997 /* don't compile, execute immediately */
3998 CALL_CompressedTexImage1DARB(ctx
->Exec
, (target
, level
, internalFormat
,
3999 width
, border
, imageSize
,
4005 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4006 /* make copy of image */
4007 image
= _mesa_malloc(imageSize
);
4009 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage1DARB");
4012 MEMCPY(image
, data
, imageSize
);
4013 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_1D
, 7);
4017 n
[3].e
= internalFormat
;
4018 n
[4].i
= (GLint
) width
;
4026 if (ctx
->ExecuteFlag
) {
4027 CALL_CompressedTexImage1DARB(ctx
->Exec
,
4028 (target
, level
, internalFormat
, width
,
4029 border
, imageSize
, data
));
4035 static void GLAPIENTRY
4036 save_CompressedTexImage2DARB(GLenum target
, GLint level
,
4037 GLenum internalFormat
, GLsizei width
,
4038 GLsizei height
, GLint border
, GLsizei imageSize
,
4039 const GLvoid
* data
)
4041 GET_CURRENT_CONTEXT(ctx
);
4042 if (target
== GL_PROXY_TEXTURE_2D
) {
4043 /* don't compile, execute immediately */
4044 CALL_CompressedTexImage2DARB(ctx
->Exec
, (target
, level
, internalFormat
,
4045 width
, height
, border
,
4051 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4052 /* make copy of image */
4053 image
= _mesa_malloc(imageSize
);
4055 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage2DARB");
4058 MEMCPY(image
, data
, imageSize
);
4059 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_2D
, 8);
4063 n
[3].e
= internalFormat
;
4064 n
[4].i
= (GLint
) width
;
4065 n
[5].i
= (GLint
) height
;
4073 if (ctx
->ExecuteFlag
) {
4074 CALL_CompressedTexImage2DARB(ctx
->Exec
,
4075 (target
, level
, internalFormat
, width
,
4076 height
, border
, imageSize
, data
));
4082 static void GLAPIENTRY
4083 save_CompressedTexImage3DARB(GLenum target
, GLint level
,
4084 GLenum internalFormat
, GLsizei width
,
4085 GLsizei height
, GLsizei depth
, GLint border
,
4086 GLsizei imageSize
, const GLvoid
* data
)
4088 GET_CURRENT_CONTEXT(ctx
);
4089 if (target
== GL_PROXY_TEXTURE_3D
) {
4090 /* don't compile, execute immediately */
4091 CALL_CompressedTexImage3DARB(ctx
->Exec
, (target
, level
, internalFormat
,
4092 width
, height
, depth
, border
,
4098 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4099 /* make copy of image */
4100 image
= _mesa_malloc(imageSize
);
4102 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage3DARB");
4105 MEMCPY(image
, data
, imageSize
);
4106 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_3D
, 9);
4110 n
[3].e
= internalFormat
;
4111 n
[4].i
= (GLint
) width
;
4112 n
[5].i
= (GLint
) height
;
4113 n
[6].i
= (GLint
) depth
;
4121 if (ctx
->ExecuteFlag
) {
4122 CALL_CompressedTexImage3DARB(ctx
->Exec
,
4123 (target
, level
, internalFormat
, width
,
4124 height
, depth
, border
, imageSize
,
4131 static void GLAPIENTRY
4132 save_CompressedTexSubImage1DARB(GLenum target
, GLint level
, GLint xoffset
,
4133 GLsizei width
, GLenum format
,
4134 GLsizei imageSize
, const GLvoid
* data
)
4139 GET_CURRENT_CONTEXT(ctx
);
4140 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4142 /* make copy of image */
4143 image
= _mesa_malloc(imageSize
);
4145 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage1DARB");
4148 MEMCPY(image
, data
, imageSize
);
4149 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
, 7);
4154 n
[4].i
= (GLint
) width
;
4162 if (ctx
->ExecuteFlag
) {
4163 CALL_CompressedTexSubImage1DARB(ctx
->Exec
, (target
, level
, xoffset
,
4164 width
, format
, imageSize
,
4170 static void GLAPIENTRY
4171 save_CompressedTexSubImage2DARB(GLenum target
, GLint level
, GLint xoffset
,
4172 GLint yoffset
, GLsizei width
, GLsizei height
,
4173 GLenum format
, GLsizei imageSize
,
4174 const GLvoid
* data
)
4179 GET_CURRENT_CONTEXT(ctx
);
4180 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4182 /* make copy of image */
4183 image
= _mesa_malloc(imageSize
);
4185 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage2DARB");
4188 MEMCPY(image
, data
, imageSize
);
4189 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
, 9);
4195 n
[5].i
= (GLint
) width
;
4196 n
[6].i
= (GLint
) height
;
4204 if (ctx
->ExecuteFlag
) {
4205 CALL_CompressedTexSubImage2DARB(ctx
->Exec
,
4206 (target
, level
, xoffset
, yoffset
, width
,
4207 height
, format
, imageSize
, data
));
4212 static void GLAPIENTRY
4213 save_CompressedTexSubImage3DARB(GLenum target
, GLint level
, GLint xoffset
,
4214 GLint yoffset
, GLint zoffset
, GLsizei width
,
4215 GLsizei height
, GLsizei depth
, GLenum format
,
4216 GLsizei imageSize
, const GLvoid
* data
)
4221 GET_CURRENT_CONTEXT(ctx
);
4222 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4224 /* make copy of image */
4225 image
= _mesa_malloc(imageSize
);
4227 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage3DARB");
4230 MEMCPY(image
, data
, imageSize
);
4231 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
, 11);
4238 n
[6].i
= (GLint
) width
;
4239 n
[7].i
= (GLint
) height
;
4240 n
[8].i
= (GLint
) depth
;
4242 n
[10].i
= imageSize
;
4248 if (ctx
->ExecuteFlag
) {
4249 CALL_CompressedTexSubImage3DARB(ctx
->Exec
,
4250 (target
, level
, xoffset
, yoffset
,
4251 zoffset
, width
, height
, depth
, format
,
4257 /* GL_ARB_multisample */
4258 static void GLAPIENTRY
4259 save_SampleCoverageARB(GLclampf value
, GLboolean invert
)
4261 GET_CURRENT_CONTEXT(ctx
);
4263 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4264 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SAMPLE_COVERAGE
, 2);
4269 if (ctx
->ExecuteFlag
) {
4270 CALL_SampleCoverageARB(ctx
->Exec
, (value
, invert
));
4276 * GL_NV_vertex_program
4278 #if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
4279 static void GLAPIENTRY
4280 save_BindProgramNV(GLenum target
, GLuint id
)
4282 GET_CURRENT_CONTEXT(ctx
);
4284 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4285 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BIND_PROGRAM_NV
, 2);
4290 if (ctx
->ExecuteFlag
) {
4291 CALL_BindProgramNV(ctx
->Exec
, (target
, id
));
4295 static void GLAPIENTRY
4296 save_ProgramEnvParameter4fARB(GLenum target
, GLuint index
,
4297 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4299 GET_CURRENT_CONTEXT(ctx
);
4301 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4302 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4311 if (ctx
->ExecuteFlag
) {
4312 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4317 static void GLAPIENTRY
4318 save_ProgramEnvParameter4fvARB(GLenum target
, GLuint index
,
4319 const GLfloat
*params
)
4321 save_ProgramEnvParameter4fARB(target
, index
, params
[0], params
[1],
4322 params
[2], params
[3]);
4326 static void GLAPIENTRY
4327 save_ProgramEnvParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4328 const GLfloat
* params
)
4330 GET_CURRENT_CONTEXT(ctx
);
4332 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4336 const GLfloat
* p
= params
;
4338 for (i
= 0 ; i
< count
; i
++) {
4339 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4352 if (ctx
->ExecuteFlag
) {
4353 CALL_ProgramEnvParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4358 static void GLAPIENTRY
4359 save_ProgramEnvParameter4dARB(GLenum target
, GLuint index
,
4360 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4362 save_ProgramEnvParameter4fARB(target
, index
,
4364 (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4368 static void GLAPIENTRY
4369 save_ProgramEnvParameter4dvARB(GLenum target
, GLuint index
,
4370 const GLdouble
*params
)
4372 save_ProgramEnvParameter4fARB(target
, index
,
4373 (GLfloat
) params
[0],
4374 (GLfloat
) params
[1],
4375 (GLfloat
) params
[2], (GLfloat
) params
[3]);
4378 #endif /* FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program || FEATURE_NV_vertex_program */
4380 #if FEATURE_NV_vertex_program
4381 static void GLAPIENTRY
4382 save_ExecuteProgramNV(GLenum target
, GLuint id
, const GLfloat
*params
)
4384 GET_CURRENT_CONTEXT(ctx
);
4386 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4387 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EXECUTE_PROGRAM_NV
, 6);
4396 if (ctx
->ExecuteFlag
) {
4397 CALL_ExecuteProgramNV(ctx
->Exec
, (target
, id
, params
));
4402 static void GLAPIENTRY
4403 save_ProgramParameters4dvNV(GLenum target
, GLuint index
,
4404 GLuint num
, const GLdouble
*params
)
4407 for (i
= 0; i
< num
; i
++) {
4408 save_ProgramEnvParameter4dvARB(target
, index
+ i
, params
+ 4 * i
);
4413 static void GLAPIENTRY
4414 save_ProgramParameters4fvNV(GLenum target
, GLuint index
,
4415 GLuint num
, const GLfloat
*params
)
4418 for (i
= 0; i
< num
; i
++) {
4419 save_ProgramEnvParameter4fvARB(target
, index
+ i
, params
+ 4 * i
);
4424 static void GLAPIENTRY
4425 save_LoadProgramNV(GLenum target
, GLuint id
, GLsizei len
,
4426 const GLubyte
* program
)
4428 GET_CURRENT_CONTEXT(ctx
);
4431 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4433 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LOAD_PROGRAM_NV
, 4);
4435 GLubyte
*programCopy
= (GLubyte
*) _mesa_malloc(len
);
4437 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glLoadProgramNV");
4440 _mesa_memcpy(programCopy
, program
, len
);
4444 n
[4].data
= programCopy
;
4446 if (ctx
->ExecuteFlag
) {
4447 CALL_LoadProgramNV(ctx
->Exec
, (target
, id
, len
, program
));
4452 static void GLAPIENTRY
4453 save_RequestResidentProgramsNV(GLsizei num
, const GLuint
* ids
)
4455 GET_CURRENT_CONTEXT(ctx
);
4458 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4460 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TRACK_MATRIX_NV
, 2);
4462 GLuint
*idCopy
= (GLuint
*) _mesa_malloc(num
* sizeof(GLuint
));
4464 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glRequestResidentProgramsNV");
4467 _mesa_memcpy(idCopy
, ids
, num
* sizeof(GLuint
));
4471 if (ctx
->ExecuteFlag
) {
4472 CALL_RequestResidentProgramsNV(ctx
->Exec
, (num
, ids
));
4477 static void GLAPIENTRY
4478 save_TrackMatrixNV(GLenum target
, GLuint address
,
4479 GLenum matrix
, GLenum transform
)
4481 GET_CURRENT_CONTEXT(ctx
);
4483 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4484 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TRACK_MATRIX_NV
, 4);
4491 if (ctx
->ExecuteFlag
) {
4492 CALL_TrackMatrixNV(ctx
->Exec
, (target
, address
, matrix
, transform
));
4495 #endif /* FEATURE_NV_vertex_program */
4499 * GL_NV_fragment_program
4501 #if FEATURE_NV_fragment_program
4502 static void GLAPIENTRY
4503 save_ProgramLocalParameter4fARB(GLenum target
, GLuint index
,
4504 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4506 GET_CURRENT_CONTEXT(ctx
);
4508 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4509 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4518 if (ctx
->ExecuteFlag
) {
4519 CALL_ProgramLocalParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4524 static void GLAPIENTRY
4525 save_ProgramLocalParameter4fvARB(GLenum target
, GLuint index
,
4526 const GLfloat
*params
)
4528 GET_CURRENT_CONTEXT(ctx
);
4530 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4531 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4540 if (ctx
->ExecuteFlag
) {
4541 CALL_ProgramLocalParameter4fvARB(ctx
->Exec
, (target
, index
, params
));
4546 static void GLAPIENTRY
4547 save_ProgramLocalParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4548 const GLfloat
*params
)
4550 GET_CURRENT_CONTEXT(ctx
);
4552 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4556 const GLfloat
* p
= params
;
4558 for (i
= 0 ; i
< count
; i
++) {
4559 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4572 if (ctx
->ExecuteFlag
) {
4573 CALL_ProgramLocalParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4578 static void GLAPIENTRY
4579 save_ProgramLocalParameter4dARB(GLenum target
, GLuint index
,
4580 GLdouble x
, GLdouble y
,
4581 GLdouble z
, GLdouble w
)
4583 GET_CURRENT_CONTEXT(ctx
);
4585 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4586 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4590 n
[3].f
= (GLfloat
) x
;
4591 n
[4].f
= (GLfloat
) y
;
4592 n
[5].f
= (GLfloat
) z
;
4593 n
[6].f
= (GLfloat
) w
;
4595 if (ctx
->ExecuteFlag
) {
4596 CALL_ProgramLocalParameter4dARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4601 static void GLAPIENTRY
4602 save_ProgramLocalParameter4dvARB(GLenum target
, GLuint index
,
4603 const GLdouble
*params
)
4605 GET_CURRENT_CONTEXT(ctx
);
4607 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4608 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4612 n
[3].f
= (GLfloat
) params
[0];
4613 n
[4].f
= (GLfloat
) params
[1];
4614 n
[5].f
= (GLfloat
) params
[2];
4615 n
[6].f
= (GLfloat
) params
[3];
4617 if (ctx
->ExecuteFlag
) {
4618 CALL_ProgramLocalParameter4dvARB(ctx
->Exec
, (target
, index
, params
));
4622 static void GLAPIENTRY
4623 save_ProgramNamedParameter4fNV(GLuint id
, GLsizei len
, const GLubyte
* name
,
4624 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4626 GET_CURRENT_CONTEXT(ctx
);
4629 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4631 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_NAMED_PARAMETER_NV
, 6);
4633 GLubyte
*nameCopy
= (GLubyte
*) _mesa_malloc(len
);
4635 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramNamedParameter4fNV");
4638 _mesa_memcpy(nameCopy
, name
, len
);
4641 n
[3].data
= nameCopy
;
4647 if (ctx
->ExecuteFlag
) {
4648 CALL_ProgramNamedParameter4fNV(ctx
->Exec
, (id
, len
, name
, x
, y
, z
, w
));
4653 static void GLAPIENTRY
4654 save_ProgramNamedParameter4fvNV(GLuint id
, GLsizei len
, const GLubyte
* name
,
4657 save_ProgramNamedParameter4fNV(id
, len
, name
, v
[0], v
[1], v
[2], v
[3]);
4661 static void GLAPIENTRY
4662 save_ProgramNamedParameter4dNV(GLuint id
, GLsizei len
, const GLubyte
* name
,
4663 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4665 save_ProgramNamedParameter4fNV(id
, len
, name
, (GLfloat
) x
, (GLfloat
) y
,
4666 (GLfloat
) z
, (GLfloat
) w
);
4670 static void GLAPIENTRY
4671 save_ProgramNamedParameter4dvNV(GLuint id
, GLsizei len
, const GLubyte
* name
,
4674 save_ProgramNamedParameter4fNV(id
, len
, name
, (GLfloat
) v
[0],
4675 (GLfloat
) v
[1], (GLfloat
) v
[2],
4679 #endif /* FEATURE_NV_fragment_program */
4683 /* GL_EXT_stencil_two_side */
4684 static void GLAPIENTRY
4685 save_ActiveStencilFaceEXT(GLenum face
)
4687 GET_CURRENT_CONTEXT(ctx
);
4689 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4690 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ACTIVE_STENCIL_FACE_EXT
, 1);
4694 if (ctx
->ExecuteFlag
) {
4695 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (face
));
4700 /* GL_EXT_depth_bounds_test */
4701 static void GLAPIENTRY
4702 save_DepthBoundsEXT(GLclampd zmin
, GLclampd zmax
)
4704 GET_CURRENT_CONTEXT(ctx
);
4706 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4707 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DEPTH_BOUNDS_EXT
, 2);
4709 n
[1].f
= (GLfloat
) zmin
;
4710 n
[2].f
= (GLfloat
) zmax
;
4712 if (ctx
->ExecuteFlag
) {
4713 CALL_DepthBoundsEXT(ctx
->Exec
, (zmin
, zmax
));
4719 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
4721 static void GLAPIENTRY
4722 save_ProgramStringARB(GLenum target
, GLenum format
, GLsizei len
,
4723 const GLvoid
* string
)
4725 GET_CURRENT_CONTEXT(ctx
);
4728 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4730 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_STRING_ARB
, 4);
4732 GLubyte
*programCopy
= (GLubyte
*) _mesa_malloc(len
);
4734 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramStringARB");
4737 _mesa_memcpy(programCopy
, string
, len
);
4741 n
[4].data
= programCopy
;
4743 if (ctx
->ExecuteFlag
) {
4744 CALL_ProgramStringARB(ctx
->Exec
, (target
, format
, len
, string
));
4748 #endif /* FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program */
4751 #if FEATURE_ARB_occlusion_query
4753 static void GLAPIENTRY
4754 save_BeginQueryARB(GLenum target
, GLuint id
)
4756 GET_CURRENT_CONTEXT(ctx
);
4758 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4759 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BEGIN_QUERY_ARB
, 2);
4764 if (ctx
->ExecuteFlag
) {
4765 CALL_BeginQueryARB(ctx
->Exec
, (target
, id
));
4770 static void GLAPIENTRY
4771 save_EndQueryARB(GLenum target
)
4773 GET_CURRENT_CONTEXT(ctx
);
4775 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4776 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_END_QUERY_ARB
, 1);
4780 if (ctx
->ExecuteFlag
) {
4781 CALL_EndQueryARB(ctx
->Exec
, (target
));
4785 #endif /* FEATURE_ARB_occlusion_query */
4788 static void GLAPIENTRY
4789 save_DrawBuffersARB(GLsizei count
, const GLenum
* buffers
)
4791 GET_CURRENT_CONTEXT(ctx
);
4793 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4794 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DRAW_BUFFERS_ARB
, 1 + MAX_DRAW_BUFFERS
);
4798 if (count
> MAX_DRAW_BUFFERS
)
4799 count
= MAX_DRAW_BUFFERS
;
4800 for (i
= 0; i
< count
; i
++) {
4801 n
[2 + i
].e
= buffers
[i
];
4804 if (ctx
->ExecuteFlag
) {
4805 CALL_DrawBuffersARB(ctx
->Exec
, (count
, buffers
));
4809 static void GLAPIENTRY
4810 save_TexBumpParameterfvATI(GLenum pname
, const GLfloat
*param
)
4812 GET_CURRENT_CONTEXT(ctx
);
4815 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_BUMP_PARAMETER_ATI
, 5);
4823 if (ctx
->ExecuteFlag
) {
4824 CALL_TexBumpParameterfvATI(ctx
->Exec
, (pname
, param
));
4828 static void GLAPIENTRY
4829 save_TexBumpParameterivATI(GLenum pname
, const GLint
*param
)
4832 p
[0] = INT_TO_FLOAT(param
[0]);
4833 p
[1] = INT_TO_FLOAT(param
[1]);
4834 p
[2] = INT_TO_FLOAT(param
[2]);
4835 p
[3] = INT_TO_FLOAT(param
[3]);
4836 save_TexBumpParameterfvATI(pname
, p
);
4839 #if FEATURE_ATI_fragment_shader
4840 static void GLAPIENTRY
4841 save_BindFragmentShaderATI(GLuint id
)
4843 GET_CURRENT_CONTEXT(ctx
);
4846 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BIND_FRAGMENT_SHADER_ATI
, 1);
4850 if (ctx
->ExecuteFlag
) {
4851 CALL_BindFragmentShaderATI(ctx
->Exec
, (id
));
4855 static void GLAPIENTRY
4856 save_SetFragmentShaderConstantATI(GLuint dst
, const GLfloat
*value
)
4858 GET_CURRENT_CONTEXT(ctx
);
4861 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
, 5);
4869 if (ctx
->ExecuteFlag
) {
4870 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, value
));
4876 save_Attr1fNV(GLenum attr
, GLfloat x
)
4878 GET_CURRENT_CONTEXT(ctx
);
4880 SAVE_FLUSH_VERTICES(ctx
);
4881 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_1F_NV
, 2);
4887 ASSERT(attr
< MAX_VERTEX_PROGRAM_ATTRIBS
);
4888 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
4889 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
4891 if (ctx
->ExecuteFlag
) {
4892 CALL_VertexAttrib1fNV(ctx
->Exec
, (attr
, x
));
4897 save_Attr2fNV(GLenum attr
, GLfloat x
, GLfloat y
)
4899 GET_CURRENT_CONTEXT(ctx
);
4901 SAVE_FLUSH_VERTICES(ctx
);
4902 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_2F_NV
, 3);
4909 ASSERT(attr
< MAX_VERTEX_PROGRAM_ATTRIBS
);
4910 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
4911 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
4913 if (ctx
->ExecuteFlag
) {
4914 CALL_VertexAttrib2fNV(ctx
->Exec
, (attr
, x
, y
));
4919 save_Attr3fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
4921 GET_CURRENT_CONTEXT(ctx
);
4923 SAVE_FLUSH_VERTICES(ctx
);
4924 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_3F_NV
, 4);
4932 ASSERT(attr
< MAX_VERTEX_PROGRAM_ATTRIBS
);
4933 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
4934 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
4936 if (ctx
->ExecuteFlag
) {
4937 CALL_VertexAttrib3fNV(ctx
->Exec
, (attr
, x
, y
, z
));
4942 save_Attr4fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4944 GET_CURRENT_CONTEXT(ctx
);
4946 SAVE_FLUSH_VERTICES(ctx
);
4947 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_4F_NV
, 5);
4956 ASSERT(attr
< MAX_VERTEX_PROGRAM_ATTRIBS
);
4957 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
4958 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
4960 if (ctx
->ExecuteFlag
) {
4961 CALL_VertexAttrib4fNV(ctx
->Exec
, (attr
, x
, y
, z
, w
));
4967 save_Attr1fARB(GLenum attr
, GLfloat x
)
4969 GET_CURRENT_CONTEXT(ctx
);
4971 SAVE_FLUSH_VERTICES(ctx
);
4972 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_1F_ARB
, 2);
4978 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
4979 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
4980 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
4982 if (ctx
->ExecuteFlag
) {
4983 CALL_VertexAttrib1fARB(ctx
->Exec
, (attr
, x
));
4988 save_Attr2fARB(GLenum attr
, GLfloat x
, GLfloat y
)
4990 GET_CURRENT_CONTEXT(ctx
);
4992 SAVE_FLUSH_VERTICES(ctx
);
4993 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_2F_ARB
, 3);
5000 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5001 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
5002 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
5004 if (ctx
->ExecuteFlag
) {
5005 CALL_VertexAttrib2fARB(ctx
->Exec
, (attr
, x
, y
));
5010 save_Attr3fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
5012 GET_CURRENT_CONTEXT(ctx
);
5014 SAVE_FLUSH_VERTICES(ctx
);
5015 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_3F_ARB
, 4);
5023 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5024 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
5025 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
5027 if (ctx
->ExecuteFlag
) {
5028 CALL_VertexAttrib3fARB(ctx
->Exec
, (attr
, x
, y
, z
));
5033 save_Attr4fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5035 GET_CURRENT_CONTEXT(ctx
);
5037 SAVE_FLUSH_VERTICES(ctx
);
5038 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_4F_ARB
, 5);
5047 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5048 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5049 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5051 if (ctx
->ExecuteFlag
) {
5052 CALL_VertexAttrib4fARB(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5057 static void GLAPIENTRY
5058 save_EvalCoord1f(GLfloat x
)
5060 GET_CURRENT_CONTEXT(ctx
);
5062 SAVE_FLUSH_VERTICES(ctx
);
5063 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVAL_C1
, 1);
5067 if (ctx
->ExecuteFlag
) {
5068 CALL_EvalCoord1f(ctx
->Exec
, (x
));
5072 static void GLAPIENTRY
5073 save_EvalCoord1fv(const GLfloat
* v
)
5075 save_EvalCoord1f(v
[0]);
5078 static void GLAPIENTRY
5079 save_EvalCoord2f(GLfloat x
, GLfloat y
)
5081 GET_CURRENT_CONTEXT(ctx
);
5083 SAVE_FLUSH_VERTICES(ctx
);
5084 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVAL_C2
, 2);
5089 if (ctx
->ExecuteFlag
) {
5090 CALL_EvalCoord2f(ctx
->Exec
, (x
, y
));
5094 static void GLAPIENTRY
5095 save_EvalCoord2fv(const GLfloat
* v
)
5097 save_EvalCoord2f(v
[0], v
[1]);
5101 static void GLAPIENTRY
5102 save_EvalPoint1(GLint x
)
5104 GET_CURRENT_CONTEXT(ctx
);
5106 SAVE_FLUSH_VERTICES(ctx
);
5107 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVAL_P1
, 1);
5111 if (ctx
->ExecuteFlag
) {
5112 CALL_EvalPoint1(ctx
->Exec
, (x
));
5116 static void GLAPIENTRY
5117 save_EvalPoint2(GLint x
, GLint y
)
5119 GET_CURRENT_CONTEXT(ctx
);
5121 SAVE_FLUSH_VERTICES(ctx
);
5122 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVAL_P2
, 2);
5127 if (ctx
->ExecuteFlag
) {
5128 CALL_EvalPoint2(ctx
->Exec
, (x
, y
));
5132 static void GLAPIENTRY
5133 save_Indexf(GLfloat x
)
5135 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, x
);
5138 static void GLAPIENTRY
5139 save_Indexfv(const GLfloat
* v
)
5141 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, v
[0]);
5144 static void GLAPIENTRY
5145 save_EdgeFlag(GLboolean x
)
5147 save_Attr1fNV(VERT_ATTRIB_EDGEFLAG
, x
? (GLfloat
)1.0 : (GLfloat
)0.0);
5150 static INLINE GLboolean
compare4fv( const GLfloat
*a
,
5154 return memcmp( a
, b
, count
* sizeof(GLfloat
) ) == 0;
5158 static void GLAPIENTRY
5159 save_Materialfv(GLenum face
, GLenum pname
, const GLfloat
* param
)
5161 GET_CURRENT_CONTEXT(ctx
);
5169 case GL_FRONT_AND_BACK
:
5172 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "material(face)");
5181 case GL_AMBIENT_AND_DIFFUSE
:
5187 case GL_COLOR_INDEXES
:
5191 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "material(pname)");
5195 if (ctx
->ExecuteFlag
) {
5196 CALL_Materialfv(ctx
->Exec
, (face
, pname
, param
));
5199 bitmask
= _mesa_material_bitmask(ctx
, face
, pname
, ~0, NULL
);
5201 /* Try to eliminate redundant statechanges. Because it is legal to
5202 * call glMaterial even inside begin/end calls, don't need to worry
5203 * about ctx->Driver.CurrentSavePrimitive here.
5205 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++) {
5206 if (bitmask
& (1 << i
)) {
5207 if (ctx
->ListState
.ActiveMaterialSize
[i
] == args
&&
5208 compare4fv(ctx
->ListState
.CurrentMaterial
[i
], param
, args
)) {
5209 bitmask
&= ~(1 << i
);
5212 ctx
->ListState
.ActiveMaterialSize
[i
] = args
;
5213 COPY_SZ_4V(ctx
->ListState
.CurrentMaterial
[i
], args
, param
);
5218 /* If this call has effect, return early:
5223 SAVE_FLUSH_VERTICES(ctx
);
5225 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MATERIAL
, 6);
5229 for (i
= 0; i
< args
; i
++)
5230 n
[3 + i
].f
= param
[i
];
5234 static void GLAPIENTRY
5235 save_Begin(GLenum mode
)
5237 GET_CURRENT_CONTEXT(ctx
);
5239 GLboolean error
= GL_FALSE
;
5241 if ( /*mode < GL_POINTS || */ mode
> GL_POLYGON
) {
5242 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "Begin (mode)");
5245 else if (ctx
->Driver
.CurrentSavePrimitive
== PRIM_UNKNOWN
) {
5246 /* Typically the first begin. This may raise an error on
5247 * playback, depending on whether CallList is issued from inside
5248 * a begin/end or not.
5250 ctx
->Driver
.CurrentSavePrimitive
= PRIM_INSIDE_UNKNOWN_PRIM
;
5252 else if (ctx
->Driver
.CurrentSavePrimitive
== PRIM_OUTSIDE_BEGIN_END
) {
5253 ctx
->Driver
.CurrentSavePrimitive
= mode
;
5256 _mesa_compile_error(ctx
, GL_INVALID_OPERATION
, "recursive begin");
5261 /* Give the driver an opportunity to hook in an optimized
5262 * display list compiler.
5264 if (ctx
->Driver
.NotifySaveBegin(ctx
, mode
))
5267 SAVE_FLUSH_VERTICES(ctx
);
5268 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BEGIN
, 1);
5274 if (ctx
->ExecuteFlag
) {
5275 CALL_Begin(ctx
->Exec
, (mode
));
5279 static void GLAPIENTRY
5282 GET_CURRENT_CONTEXT(ctx
);
5283 SAVE_FLUSH_VERTICES(ctx
);
5284 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_END
, 0);
5285 ctx
->Driver
.CurrentSavePrimitive
= PRIM_OUTSIDE_BEGIN_END
;
5286 if (ctx
->ExecuteFlag
) {
5287 CALL_End(ctx
->Exec
, ());
5291 static void GLAPIENTRY
5292 save_Rectf(GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
5294 GET_CURRENT_CONTEXT(ctx
);
5296 SAVE_FLUSH_VERTICES(ctx
);
5297 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_RECTF
, 4);
5304 if (ctx
->ExecuteFlag
) {
5305 CALL_Rectf(ctx
->Exec
, (a
, b
, c
, d
));
5310 static void GLAPIENTRY
5311 save_Vertex2f(GLfloat x
, GLfloat y
)
5313 save_Attr2fNV(VERT_ATTRIB_POS
, x
, y
);
5316 static void GLAPIENTRY
5317 save_Vertex2fv(const GLfloat
* v
)
5319 save_Attr2fNV(VERT_ATTRIB_POS
, v
[0], v
[1]);
5322 static void GLAPIENTRY
5323 save_Vertex3f(GLfloat x
, GLfloat y
, GLfloat z
)
5325 save_Attr3fNV(VERT_ATTRIB_POS
, x
, y
, z
);
5328 static void GLAPIENTRY
5329 save_Vertex3fv(const GLfloat
* v
)
5331 save_Attr3fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2]);
5334 static void GLAPIENTRY
5335 save_Vertex4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5337 save_Attr4fNV(VERT_ATTRIB_POS
, x
, y
, z
, w
);
5340 static void GLAPIENTRY
5341 save_Vertex4fv(const GLfloat
* v
)
5343 save_Attr4fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2], v
[3]);
5346 static void GLAPIENTRY
5347 save_TexCoord1f(GLfloat x
)
5349 save_Attr1fNV(VERT_ATTRIB_TEX0
, x
);
5352 static void GLAPIENTRY
5353 save_TexCoord1fv(const GLfloat
* v
)
5355 save_Attr1fNV(VERT_ATTRIB_TEX0
, v
[0]);
5358 static void GLAPIENTRY
5359 save_TexCoord2f(GLfloat x
, GLfloat y
)
5361 save_Attr2fNV(VERT_ATTRIB_TEX0
, x
, y
);
5364 static void GLAPIENTRY
5365 save_TexCoord2fv(const GLfloat
* v
)
5367 save_Attr2fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1]);
5370 static void GLAPIENTRY
5371 save_TexCoord3f(GLfloat x
, GLfloat y
, GLfloat z
)
5373 save_Attr3fNV(VERT_ATTRIB_TEX0
, x
, y
, z
);
5376 static void GLAPIENTRY
5377 save_TexCoord3fv(const GLfloat
* v
)
5379 save_Attr3fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2]);
5382 static void GLAPIENTRY
5383 save_TexCoord4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5385 save_Attr4fNV(VERT_ATTRIB_TEX0
, x
, y
, z
, w
);
5388 static void GLAPIENTRY
5389 save_TexCoord4fv(const GLfloat
* v
)
5391 save_Attr4fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2], v
[3]);
5394 static void GLAPIENTRY
5395 save_Normal3f(GLfloat x
, GLfloat y
, GLfloat z
)
5397 save_Attr3fNV(VERT_ATTRIB_NORMAL
, x
, y
, z
);
5400 static void GLAPIENTRY
5401 save_Normal3fv(const GLfloat
* v
)
5403 save_Attr3fNV(VERT_ATTRIB_NORMAL
, v
[0], v
[1], v
[2]);
5406 static void GLAPIENTRY
5407 save_FogCoordfEXT(GLfloat x
)
5409 save_Attr1fNV(VERT_ATTRIB_FOG
, x
);
5412 static void GLAPIENTRY
5413 save_FogCoordfvEXT(const GLfloat
* v
)
5415 save_Attr1fNV(VERT_ATTRIB_FOG
, v
[0]);
5418 static void GLAPIENTRY
5419 save_Color3f(GLfloat x
, GLfloat y
, GLfloat z
)
5421 save_Attr3fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
);
5424 static void GLAPIENTRY
5425 save_Color3fv(const GLfloat
* v
)
5427 save_Attr3fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2]);
5430 static void GLAPIENTRY
5431 save_Color4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5433 save_Attr4fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
, w
);
5436 static void GLAPIENTRY
5437 save_Color4fv(const GLfloat
* v
)
5439 save_Attr4fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2], v
[3]);
5442 static void GLAPIENTRY
5443 save_SecondaryColor3fEXT(GLfloat x
, GLfloat y
, GLfloat z
)
5445 save_Attr3fNV(VERT_ATTRIB_COLOR1
, x
, y
, z
);
5448 static void GLAPIENTRY
5449 save_SecondaryColor3fvEXT(const GLfloat
* v
)
5451 save_Attr3fNV(VERT_ATTRIB_COLOR1
, v
[0], v
[1], v
[2]);
5455 /* Just call the respective ATTR for texcoord
5457 static void GLAPIENTRY
5458 save_MultiTexCoord1f(GLenum target
, GLfloat x
)
5460 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5461 save_Attr1fNV(attr
, x
);
5464 static void GLAPIENTRY
5465 save_MultiTexCoord1fv(GLenum target
, const GLfloat
* v
)
5467 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5468 save_Attr1fNV(attr
, v
[0]);
5471 static void GLAPIENTRY
5472 save_MultiTexCoord2f(GLenum target
, GLfloat x
, GLfloat y
)
5474 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5475 save_Attr2fNV(attr
, x
, y
);
5478 static void GLAPIENTRY
5479 save_MultiTexCoord2fv(GLenum target
, const GLfloat
* v
)
5481 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5482 save_Attr2fNV(attr
, v
[0], v
[1]);
5485 static void GLAPIENTRY
5486 save_MultiTexCoord3f(GLenum target
, GLfloat x
, GLfloat y
, GLfloat z
)
5488 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5489 save_Attr3fNV(attr
, x
, y
, z
);
5492 static void GLAPIENTRY
5493 save_MultiTexCoord3fv(GLenum target
, const GLfloat
* v
)
5495 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5496 save_Attr3fNV(attr
, v
[0], v
[1], v
[2]);
5499 static void GLAPIENTRY
5500 save_MultiTexCoord4f(GLenum target
, GLfloat x
, GLfloat y
,
5501 GLfloat z
, GLfloat w
)
5503 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5504 save_Attr4fNV(attr
, x
, y
, z
, w
);
5507 static void GLAPIENTRY
5508 save_MultiTexCoord4fv(GLenum target
, const GLfloat
* v
)
5510 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5511 save_Attr4fNV(attr
, v
[0], v
[1], v
[2], v
[3]);
5516 * Record a GL_INVALID_VALUE error when a invalid vertex attribute
5522 GET_CURRENT_CONTEXT(ctx
);
5523 _mesa_error(ctx
, GL_INVALID_VALUE
, "VertexAttribf(index)");
5527 /* First level for NV_vertex_program:
5529 * Check for errors at compile time?.
5531 static void GLAPIENTRY
5532 save_VertexAttrib1fNV(GLuint index
, GLfloat x
)
5534 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
)
5535 save_Attr1fNV(index
, x
);
5540 static void GLAPIENTRY
5541 save_VertexAttrib1fvNV(GLuint index
, const GLfloat
* v
)
5543 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
)
5544 save_Attr1fNV(index
, v
[0]);
5549 static void GLAPIENTRY
5550 save_VertexAttrib2fNV(GLuint index
, GLfloat x
, GLfloat y
)
5552 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
)
5553 save_Attr2fNV(index
, x
, y
);
5558 static void GLAPIENTRY
5559 save_VertexAttrib2fvNV(GLuint index
, const GLfloat
* v
)
5561 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
)
5562 save_Attr2fNV(index
, v
[0], v
[1]);
5567 static void GLAPIENTRY
5568 save_VertexAttrib3fNV(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
5570 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
)
5571 save_Attr3fNV(index
, x
, y
, z
);
5576 static void GLAPIENTRY
5577 save_VertexAttrib3fvNV(GLuint index
, const GLfloat
* v
)
5579 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
)
5580 save_Attr3fNV(index
, v
[0], v
[1], v
[2]);
5585 static void GLAPIENTRY
5586 save_VertexAttrib4fNV(GLuint index
, GLfloat x
, GLfloat y
,
5587 GLfloat z
, GLfloat w
)
5589 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
)
5590 save_Attr4fNV(index
, x
, y
, z
, w
);
5595 static void GLAPIENTRY
5596 save_VertexAttrib4fvNV(GLuint index
, const GLfloat
* v
)
5598 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
)
5599 save_Attr4fNV(index
, v
[0], v
[1], v
[2], v
[3]);
5607 static void GLAPIENTRY
5608 save_VertexAttrib1fARB(GLuint index
, GLfloat x
)
5610 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5611 save_Attr1fARB(index
, x
);
5616 static void GLAPIENTRY
5617 save_VertexAttrib1fvARB(GLuint index
, const GLfloat
* v
)
5619 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5620 save_Attr1fARB(index
, v
[0]);
5625 static void GLAPIENTRY
5626 save_VertexAttrib2fARB(GLuint index
, GLfloat x
, GLfloat y
)
5628 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5629 save_Attr2fARB(index
, x
, y
);
5634 static void GLAPIENTRY
5635 save_VertexAttrib2fvARB(GLuint index
, const GLfloat
* v
)
5637 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5638 save_Attr2fARB(index
, v
[0], v
[1]);
5643 static void GLAPIENTRY
5644 save_VertexAttrib3fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
5646 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5647 save_Attr3fARB(index
, x
, y
, z
);
5652 static void GLAPIENTRY
5653 save_VertexAttrib3fvARB(GLuint index
, const GLfloat
* v
)
5655 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5656 save_Attr3fARB(index
, v
[0], v
[1], v
[2]);
5661 static void GLAPIENTRY
5662 save_VertexAttrib4fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
,
5665 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5666 save_Attr4fARB(index
, x
, y
, z
, w
);
5671 static void GLAPIENTRY
5672 save_VertexAttrib4fvARB(GLuint index
, const GLfloat
* v
)
5674 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5675 save_Attr4fARB(index
, v
[0], v
[1], v
[2], v
[3]);
5681 /* GL_ARB_shader_objects, GL_ARB_vertex/fragment_shader */
5683 static void GLAPIENTRY
5684 exec_BindAttribLocationARB(GLuint program
, GLuint index
, const GLchar
*name
)
5686 GET_CURRENT_CONTEXT(ctx
);
5687 FLUSH_VERTICES(ctx
, 0);
5688 CALL_BindAttribLocationARB(ctx
->Exec
, (program
, index
, name
));
5691 static GLint GLAPIENTRY
5692 exec_GetAttribLocationARB(GLuint program
, const GLchar
*name
)
5694 GET_CURRENT_CONTEXT(ctx
);
5695 FLUSH_VERTICES(ctx
, 0);
5696 return CALL_GetAttribLocationARB(ctx
->Exec
, (program
, name
));
5698 /* XXX more shader functions needed here */
5702 #if FEATURE_EXT_framebuffer_blit
5703 static void GLAPIENTRY
5704 save_BlitFramebufferEXT(GLint srcX0
, GLint srcY0
, GLint srcX1
, GLint srcY1
,
5705 GLint dstX0
, GLint dstY0
, GLint dstX1
, GLint dstY1
,
5706 GLbitfield mask
, GLenum filter
)
5708 GET_CURRENT_CONTEXT(ctx
);
5710 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5711 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BLIT_FRAMEBUFFER
, 10);
5724 if (ctx
->ExecuteFlag
) {
5725 CALL_BlitFramebufferEXT(ctx
->Exec
, (srcX0
, srcY0
, srcX1
, srcY1
,
5726 dstX0
, dstY0
, dstX1
, dstY1
,
5734 * Save an error-generating command into display list.
5736 * KW: Will appear in the list before the vertex buffer containing the
5737 * command that provoked the error. I don't see this as a problem.
5740 save_error(GLcontext
*ctx
, GLenum error
, const char *s
)
5743 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ERROR
, 2);
5746 n
[2].data
= (void *) s
;
5752 * Compile an error into current display list.
5755 _mesa_compile_error(GLcontext
*ctx
, GLenum error
, const char *s
)
5757 if (ctx
->CompileFlag
)
5758 save_error(ctx
, error
, s
);
5759 if (ctx
->ExecuteFlag
)
5760 _mesa_error(ctx
, error
, s
);
5765 * Test if ID names a display list.
5768 islist(GLcontext
*ctx
, GLuint list
)
5770 if (list
> 0 && lookup_list(ctx
, list
)) {
5780 /**********************************************************************/
5781 /* Display list execution */
5782 /**********************************************************************/
5786 * Execute a display list. Note that the ListBase offset must have already
5787 * been added before calling this function. I.e. the list argument is
5788 * the absolute list number, not relative to ListBase.
5789 * \param list - display list number
5792 execute_list(GLcontext
*ctx
, GLuint list
)
5794 struct gl_display_list
*dlist
;
5798 if (list
== 0 || !islist(ctx
, list
))
5801 if (ctx
->ListState
.CallDepth
== MAX_LIST_NESTING
) {
5802 /* raise an error? */
5806 dlist
= lookup_list(ctx
, list
);
5810 ctx
->ListState
.CallDepth
++;
5812 if (ctx
->Driver
.BeginCallList
)
5813 ctx
->Driver
.BeginCallList(ctx
, dlist
);
5819 OpCode opcode
= n
[0].opcode
;
5820 int i
= (int) n
[0].opcode
- (int) OPCODE_EXT_0
;
5822 if (i
>= 0 && i
< (GLint
) ctx
->ListExt
.NumOpcodes
) {
5823 /* this is a driver-extended opcode */
5824 ctx
->ListExt
.Opcode
[i
].Execute(ctx
, &n
[1]);
5825 n
+= ctx
->ListExt
.Opcode
[i
].Size
;
5830 _mesa_error(ctx
, n
[1].e
, (const char *) n
[2].data
);
5833 CALL_Accum(ctx
->Exec
, (n
[1].e
, n
[2].f
));
5835 case OPCODE_ALPHA_FUNC
:
5836 CALL_AlphaFunc(ctx
->Exec
, (n
[1].e
, n
[2].f
));
5838 case OPCODE_BIND_TEXTURE
:
5839 CALL_BindTexture(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
5843 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5844 ctx
->Unpack
= ctx
->DefaultPacking
;
5845 CALL_Bitmap(ctx
->Exec
, ((GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
5846 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
5847 (const GLubyte
*) n
[7].data
));
5848 ctx
->Unpack
= save
; /* restore */
5851 case OPCODE_BLEND_COLOR
:
5852 CALL_BlendColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
5854 case OPCODE_BLEND_EQUATION
:
5855 CALL_BlendEquation(ctx
->Exec
, (n
[1].e
));
5857 case OPCODE_BLEND_EQUATION_SEPARATE
:
5858 CALL_BlendEquationSeparateEXT(ctx
->Exec
, (n
[1].e
, n
[2].e
));
5860 case OPCODE_BLEND_FUNC_SEPARATE
:
5861 CALL_BlendFuncSeparateEXT(ctx
->Exec
,
5862 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
5864 case OPCODE_CALL_LIST
:
5865 /* Generated by glCallList(), don't add ListBase */
5866 if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
5867 execute_list(ctx
, n
[1].ui
);
5870 case OPCODE_CALL_LIST_OFFSET
:
5871 /* Generated by glCallLists() so we must add ListBase */
5873 /* user specified a bad data type at compile time */
5874 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
5876 else if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
5877 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ n
[1].i
);
5878 execute_list(ctx
, list
);
5882 CALL_Clear(ctx
->Exec
, (n
[1].bf
));
5884 case OPCODE_CLEAR_COLOR
:
5885 CALL_ClearColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
5887 case OPCODE_CLEAR_ACCUM
:
5888 CALL_ClearAccum(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
5890 case OPCODE_CLEAR_DEPTH
:
5891 CALL_ClearDepth(ctx
->Exec
, ((GLclampd
) n
[1].f
));
5893 case OPCODE_CLEAR_INDEX
:
5894 CALL_ClearIndex(ctx
->Exec
, ((GLfloat
) n
[1].ui
));
5896 case OPCODE_CLEAR_STENCIL
:
5897 CALL_ClearStencil(ctx
->Exec
, (n
[1].i
));
5899 case OPCODE_CLIP_PLANE
:
5906 CALL_ClipPlane(ctx
->Exec
, (n
[1].e
, eq
));
5909 case OPCODE_COLOR_MASK
:
5910 CALL_ColorMask(ctx
->Exec
, (n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
));
5912 case OPCODE_COLOR_MATERIAL
:
5913 CALL_ColorMaterial(ctx
->Exec
, (n
[1].e
, n
[2].e
));
5915 case OPCODE_COLOR_TABLE
:
5917 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5918 ctx
->Unpack
= ctx
->DefaultPacking
;
5919 CALL_ColorTable(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].e
,
5920 n
[5].e
, n
[6].data
));
5921 ctx
->Unpack
= save
; /* restore */
5924 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
5931 CALL_ColorTableParameterfv(ctx
->Exec
,
5932 (n
[1].e
, n
[2].e
, params
));
5935 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
5942 CALL_ColorTableParameteriv(ctx
->Exec
,
5943 (n
[1].e
, n
[2].e
, params
));
5946 case OPCODE_COLOR_SUB_TABLE
:
5948 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5949 ctx
->Unpack
= ctx
->DefaultPacking
;
5950 CALL_ColorSubTable(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5951 n
[4].e
, n
[5].e
, n
[6].data
));
5952 ctx
->Unpack
= save
; /* restore */
5955 case OPCODE_CONVOLUTION_FILTER_1D
:
5957 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5958 ctx
->Unpack
= ctx
->DefaultPacking
;
5959 CALL_ConvolutionFilter1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5962 ctx
->Unpack
= save
; /* restore */
5965 case OPCODE_CONVOLUTION_FILTER_2D
:
5967 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5968 ctx
->Unpack
= ctx
->DefaultPacking
;
5969 CALL_ConvolutionFilter2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5970 n
[4].i
, n
[5].e
, n
[6].e
,
5972 ctx
->Unpack
= save
; /* restore */
5975 case OPCODE_CONVOLUTION_PARAMETER_I
:
5976 CALL_ConvolutionParameteri(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].i
));
5978 case OPCODE_CONVOLUTION_PARAMETER_IV
:
5985 CALL_ConvolutionParameteriv(ctx
->Exec
,
5986 (n
[1].e
, n
[2].e
, params
));
5989 case OPCODE_CONVOLUTION_PARAMETER_F
:
5990 CALL_ConvolutionParameterf(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].f
));
5992 case OPCODE_CONVOLUTION_PARAMETER_FV
:
5999 CALL_ConvolutionParameterfv(ctx
->Exec
,
6000 (n
[1].e
, n
[2].e
, params
));
6003 case OPCODE_COPY_COLOR_SUB_TABLE
:
6004 CALL_CopyColorSubTable(ctx
->Exec
, (n
[1].e
, n
[2].i
,
6005 n
[3].i
, n
[4].i
, n
[5].i
));
6007 case OPCODE_COPY_COLOR_TABLE
:
6008 CALL_CopyColorSubTable(ctx
->Exec
, (n
[1].e
, n
[2].i
,
6009 n
[3].i
, n
[4].i
, n
[5].i
));
6011 case OPCODE_COPY_PIXELS
:
6012 CALL_CopyPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
,
6013 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
,
6016 case OPCODE_COPY_TEX_IMAGE1D
:
6017 CALL_CopyTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
6018 n
[5].i
, n
[6].i
, n
[7].i
));
6020 case OPCODE_COPY_TEX_IMAGE2D
:
6021 CALL_CopyTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
6022 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
));
6024 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
6025 CALL_CopyTexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
6026 n
[4].i
, n
[5].i
, n
[6].i
));
6028 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
6029 CALL_CopyTexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
6030 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
6033 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
6034 CALL_CopyTexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
6035 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
6038 case OPCODE_CULL_FACE
:
6039 CALL_CullFace(ctx
->Exec
, (n
[1].e
));
6041 case OPCODE_DEPTH_FUNC
:
6042 CALL_DepthFunc(ctx
->Exec
, (n
[1].e
));
6044 case OPCODE_DEPTH_MASK
:
6045 CALL_DepthMask(ctx
->Exec
, (n
[1].b
));
6047 case OPCODE_DEPTH_RANGE
:
6048 CALL_DepthRange(ctx
->Exec
,
6049 ((GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
));
6051 case OPCODE_DISABLE
:
6052 CALL_Disable(ctx
->Exec
, (n
[1].e
));
6054 case OPCODE_DRAW_BUFFER
:
6055 CALL_DrawBuffer(ctx
->Exec
, (n
[1].e
));
6057 case OPCODE_DRAW_PIXELS
:
6059 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6060 ctx
->Unpack
= ctx
->DefaultPacking
;
6061 CALL_DrawPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
6063 ctx
->Unpack
= save
; /* restore */
6067 CALL_Enable(ctx
->Exec
, (n
[1].e
));
6069 case OPCODE_EVALMESH1
:
6070 CALL_EvalMesh1(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
));
6072 case OPCODE_EVALMESH2
:
6073 CALL_EvalMesh2(ctx
->Exec
,
6074 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
6083 CALL_Fogfv(ctx
->Exec
, (n
[1].e
, p
));
6086 case OPCODE_FRONT_FACE
:
6087 CALL_FrontFace(ctx
->Exec
, (n
[1].e
));
6089 case OPCODE_FRUSTUM
:
6090 CALL_Frustum(ctx
->Exec
,
6091 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
6094 CALL_Hint(ctx
->Exec
, (n
[1].e
, n
[2].e
));
6096 case OPCODE_HISTOGRAM
:
6097 CALL_Histogram(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].b
));
6099 case OPCODE_INDEX_MASK
:
6100 CALL_IndexMask(ctx
->Exec
, (n
[1].ui
));
6102 case OPCODE_INIT_NAMES
:
6103 CALL_InitNames(ctx
->Exec
, ());
6112 CALL_Lightfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, p
));
6115 case OPCODE_LIGHT_MODEL
:
6122 CALL_LightModelfv(ctx
->Exec
, (n
[1].e
, p
));
6125 case OPCODE_LINE_STIPPLE
:
6126 CALL_LineStipple(ctx
->Exec
, (n
[1].i
, n
[2].us
));
6128 case OPCODE_LINE_WIDTH
:
6129 CALL_LineWidth(ctx
->Exec
, (n
[1].f
));
6131 case OPCODE_LIST_BASE
:
6132 CALL_ListBase(ctx
->Exec
, (n
[1].ui
));
6134 case OPCODE_LOAD_IDENTITY
:
6135 CALL_LoadIdentity(ctx
->Exec
, ());
6137 case OPCODE_LOAD_MATRIX
:
6138 if (sizeof(Node
) == sizeof(GLfloat
)) {
6139 CALL_LoadMatrixf(ctx
->Exec
, (&n
[1].f
));
6144 for (i
= 0; i
< 16; i
++) {
6147 CALL_LoadMatrixf(ctx
->Exec
, (m
));
6150 case OPCODE_LOAD_NAME
:
6151 CALL_LoadName(ctx
->Exec
, (n
[1].ui
));
6153 case OPCODE_LOGIC_OP
:
6154 CALL_LogicOp(ctx
->Exec
, (n
[1].e
));
6158 GLenum target
= n
[1].e
;
6159 GLint ustride
= _mesa_evaluator_components(target
);
6160 GLint uorder
= n
[5].i
;
6161 GLfloat u1
= n
[2].f
;
6162 GLfloat u2
= n
[3].f
;
6163 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
6164 (GLfloat
*) n
[6].data
));
6169 GLenum target
= n
[1].e
;
6170 GLfloat u1
= n
[2].f
;
6171 GLfloat u2
= n
[3].f
;
6172 GLfloat v1
= n
[4].f
;
6173 GLfloat v2
= n
[5].f
;
6174 GLint ustride
= n
[6].i
;
6175 GLint vstride
= n
[7].i
;
6176 GLint uorder
= n
[8].i
;
6177 GLint vorder
= n
[9].i
;
6178 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
6179 v1
, v2
, vstride
, vorder
,
6180 (GLfloat
*) n
[10].data
));
6183 case OPCODE_MAPGRID1
:
6184 CALL_MapGrid1f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
6186 case OPCODE_MAPGRID2
:
6187 CALL_MapGrid2f(ctx
->Exec
,
6188 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
));
6190 case OPCODE_MATRIX_MODE
:
6191 CALL_MatrixMode(ctx
->Exec
, (n
[1].e
));
6193 case OPCODE_MIN_MAX
:
6194 CALL_Minmax(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].b
));
6196 case OPCODE_MULT_MATRIX
:
6197 if (sizeof(Node
) == sizeof(GLfloat
)) {
6198 CALL_MultMatrixf(ctx
->Exec
, (&n
[1].f
));
6203 for (i
= 0; i
< 16; i
++) {
6206 CALL_MultMatrixf(ctx
->Exec
, (m
));
6210 CALL_Ortho(ctx
->Exec
,
6211 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
6213 case OPCODE_PASSTHROUGH
:
6214 CALL_PassThrough(ctx
->Exec
, (n
[1].f
));
6216 case OPCODE_PIXEL_MAP
:
6217 CALL_PixelMapfv(ctx
->Exec
,
6218 (n
[1].e
, n
[2].i
, (GLfloat
*) n
[3].data
));
6220 case OPCODE_PIXEL_TRANSFER
:
6221 CALL_PixelTransferf(ctx
->Exec
, (n
[1].e
, n
[2].f
));
6223 case OPCODE_PIXEL_ZOOM
:
6224 CALL_PixelZoom(ctx
->Exec
, (n
[1].f
, n
[2].f
));
6226 case OPCODE_POINT_SIZE
:
6227 CALL_PointSize(ctx
->Exec
, (n
[1].f
));
6229 case OPCODE_POINT_PARAMETERS
:
6235 CALL_PointParameterfvEXT(ctx
->Exec
, (n
[1].e
, params
));
6238 case OPCODE_POLYGON_MODE
:
6239 CALL_PolygonMode(ctx
->Exec
, (n
[1].e
, n
[2].e
));
6241 case OPCODE_POLYGON_STIPPLE
:
6243 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6244 ctx
->Unpack
= ctx
->DefaultPacking
;
6245 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) n
[1].data
));
6246 ctx
->Unpack
= save
; /* restore */
6249 case OPCODE_POLYGON_OFFSET
:
6250 CALL_PolygonOffset(ctx
->Exec
, (n
[1].f
, n
[2].f
));
6252 case OPCODE_POP_ATTRIB
:
6253 CALL_PopAttrib(ctx
->Exec
, ());
6255 case OPCODE_POP_MATRIX
:
6256 CALL_PopMatrix(ctx
->Exec
, ());
6258 case OPCODE_POP_NAME
:
6259 CALL_PopName(ctx
->Exec
, ());
6261 case OPCODE_PRIORITIZE_TEXTURE
:
6262 CALL_PrioritizeTextures(ctx
->Exec
, (1, &n
[1].ui
, &n
[2].f
));
6264 case OPCODE_PUSH_ATTRIB
:
6265 CALL_PushAttrib(ctx
->Exec
, (n
[1].bf
));
6267 case OPCODE_PUSH_MATRIX
:
6268 CALL_PushMatrix(ctx
->Exec
, ());
6270 case OPCODE_PUSH_NAME
:
6271 CALL_PushName(ctx
->Exec
, (n
[1].ui
));
6273 case OPCODE_RASTER_POS
:
6274 CALL_RasterPos4f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
6276 case OPCODE_READ_BUFFER
:
6277 CALL_ReadBuffer(ctx
->Exec
, (n
[1].e
));
6279 case OPCODE_RESET_HISTOGRAM
:
6280 CALL_ResetHistogram(ctx
->Exec
, (n
[1].e
));
6282 case OPCODE_RESET_MIN_MAX
:
6283 CALL_ResetMinmax(ctx
->Exec
, (n
[1].e
));
6286 CALL_Rotatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
6289 CALL_Scalef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
6291 case OPCODE_SCISSOR
:
6292 CALL_Scissor(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
6294 case OPCODE_SHADE_MODEL
:
6295 CALL_ShadeModel(ctx
->Exec
, (n
[1].e
));
6297 case OPCODE_STENCIL_FUNC
:
6298 CALL_StencilFunc(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].ui
));
6300 case OPCODE_STENCIL_MASK
:
6301 CALL_StencilMask(ctx
->Exec
, (n
[1].ui
));
6303 case OPCODE_STENCIL_OP
:
6304 CALL_StencilOp(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].e
));
6306 case OPCODE_STENCIL_FUNC_SEPARATE
:
6307 CALL_StencilFuncSeparate(ctx
->Exec
,
6308 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].ui
));
6310 case OPCODE_STENCIL_MASK_SEPARATE
:
6311 CALL_StencilMaskSeparate(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
6313 case OPCODE_STENCIL_OP_SEPARATE
:
6314 CALL_StencilOpSeparate(ctx
->Exec
,
6315 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
6324 CALL_TexEnvfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
6334 CALL_TexGenfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
6337 case OPCODE_TEXPARAMETER
:
6344 CALL_TexParameterfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
6347 case OPCODE_TEX_IMAGE1D
:
6349 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6350 ctx
->Unpack
= ctx
->DefaultPacking
;
6351 CALL_TexImage1D(ctx
->Exec
, (n
[1].e
, /* target */
6353 n
[3].i
, /* components */
6355 n
[5].e
, /* border */
6356 n
[6].e
, /* format */
6359 ctx
->Unpack
= save
; /* restore */
6362 case OPCODE_TEX_IMAGE2D
:
6364 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6365 ctx
->Unpack
= ctx
->DefaultPacking
;
6366 CALL_TexImage2D(ctx
->Exec
, (n
[1].e
, /* target */
6368 n
[3].i
, /* components */
6370 n
[5].i
, /* height */
6371 n
[6].e
, /* border */
6372 n
[7].e
, /* format */
6375 ctx
->Unpack
= save
; /* restore */
6378 case OPCODE_TEX_IMAGE3D
:
6380 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6381 ctx
->Unpack
= ctx
->DefaultPacking
;
6382 CALL_TexImage3D(ctx
->Exec
, (n
[1].e
, /* target */
6384 n
[3].i
, /* components */
6386 n
[5].i
, /* height */
6388 n
[7].e
, /* border */
6389 n
[8].e
, /* format */
6392 ctx
->Unpack
= save
; /* restore */
6395 case OPCODE_TEX_SUB_IMAGE1D
:
6397 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6398 ctx
->Unpack
= ctx
->DefaultPacking
;
6399 CALL_TexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
6401 n
[6].e
, n
[7].data
));
6402 ctx
->Unpack
= save
; /* restore */
6405 case OPCODE_TEX_SUB_IMAGE2D
:
6407 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6408 ctx
->Unpack
= ctx
->DefaultPacking
;
6409 CALL_TexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
6411 n
[6].i
, n
[7].e
, n
[8].e
,
6413 ctx
->Unpack
= save
; /* restore */
6416 case OPCODE_TEX_SUB_IMAGE3D
:
6418 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6419 ctx
->Unpack
= ctx
->DefaultPacking
;
6420 CALL_TexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
6421 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
6422 n
[8].i
, n
[9].e
, n
[10].e
,
6424 ctx
->Unpack
= save
; /* restore */
6427 case OPCODE_TRANSLATE
:
6428 CALL_Translatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
6430 case OPCODE_VIEWPORT
:
6431 CALL_Viewport(ctx
->Exec
, (n
[1].i
, n
[2].i
,
6432 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
));
6434 case OPCODE_WINDOW_POS
:
6435 CALL_WindowPos4fMESA(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
6437 case OPCODE_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
6438 CALL_ActiveTextureARB(ctx
->Exec
, (n
[1].e
));
6440 case OPCODE_COMPRESSED_TEX_IMAGE_1D
: /* GL_ARB_texture_compression */
6441 CALL_CompressedTexImage1DARB(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
6442 n
[4].i
, n
[5].i
, n
[6].i
,
6445 case OPCODE_COMPRESSED_TEX_IMAGE_2D
: /* GL_ARB_texture_compression */
6446 CALL_CompressedTexImage2DARB(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
6447 n
[4].i
, n
[5].i
, n
[6].i
,
6448 n
[7].i
, n
[8].data
));
6450 case OPCODE_COMPRESSED_TEX_IMAGE_3D
: /* GL_ARB_texture_compression */
6451 CALL_CompressedTexImage3DARB(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
6452 n
[4].i
, n
[5].i
, n
[6].i
,
6456 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
: /* GL_ARB_texture_compress */
6457 CALL_CompressedTexSubImage1DARB(ctx
->Exec
,
6458 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
6459 n
[5].e
, n
[6].i
, n
[7].data
));
6461 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
: /* GL_ARB_texture_compress */
6462 CALL_CompressedTexSubImage2DARB(ctx
->Exec
,
6463 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
6464 n
[5].i
, n
[6].i
, n
[7].e
, n
[8].i
,
6467 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
: /* GL_ARB_texture_compress */
6468 CALL_CompressedTexSubImage3DARB(ctx
->Exec
,
6469 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
6470 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
6471 n
[9].e
, n
[10].i
, n
[11].data
));
6473 case OPCODE_SAMPLE_COVERAGE
: /* GL_ARB_multisample */
6474 CALL_SampleCoverageARB(ctx
->Exec
, (n
[1].f
, n
[2].b
));
6476 case OPCODE_WINDOW_POS_ARB
: /* GL_ARB_window_pos */
6477 CALL_WindowPos3fMESA(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
6479 #if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
6480 case OPCODE_BIND_PROGRAM_NV
: /* GL_NV_vertex_program */
6481 CALL_BindProgramNV(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
6484 #if FEATURE_NV_vertex_program
6485 case OPCODE_EXECUTE_PROGRAM_NV
:
6492 CALL_ExecuteProgramNV(ctx
->Exec
, (n
[1].e
, n
[2].ui
, v
));
6495 case OPCODE_REQUEST_RESIDENT_PROGRAMS_NV
:
6496 CALL_RequestResidentProgramsNV(ctx
->Exec
, (n
[1].ui
,
6497 (GLuint
*) n
[2].data
));
6499 case OPCODE_LOAD_PROGRAM_NV
:
6500 CALL_LoadProgramNV(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].i
,
6501 (const GLubyte
*) n
[4].data
));
6503 case OPCODE_TRACK_MATRIX_NV
:
6504 CALL_TrackMatrixNV(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].e
, n
[4].e
));
6508 #if FEATURE_NV_fragment_program
6509 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
:
6510 CALL_ProgramLocalParameter4fARB(ctx
->Exec
,
6511 (n
[1].e
, n
[2].ui
, n
[3].f
, n
[4].f
,
6514 case OPCODE_PROGRAM_NAMED_PARAMETER_NV
:
6515 CALL_ProgramNamedParameter4fNV(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
6516 (const GLubyte
*) n
[3].
6517 data
, n
[4].f
, n
[5].f
,
6522 case OPCODE_ACTIVE_STENCIL_FACE_EXT
:
6523 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (n
[1].e
));
6525 case OPCODE_DEPTH_BOUNDS_EXT
:
6526 CALL_DepthBoundsEXT(ctx
->Exec
, (n
[1].f
, n
[2].f
));
6528 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
6529 case OPCODE_PROGRAM_STRING_ARB
:
6530 CALL_ProgramStringARB(ctx
->Exec
,
6531 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].data
));
6534 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program || FEATURE_NV_vertex_program
6535 case OPCODE_PROGRAM_ENV_PARAMETER_ARB
:
6536 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].f
,
6541 #if FEATURE_ARB_occlusion_query
6542 case OPCODE_BEGIN_QUERY_ARB
:
6543 CALL_BeginQueryARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
6545 case OPCODE_END_QUERY_ARB
:
6546 CALL_EndQueryARB(ctx
->Exec
, (n
[1].e
));
6549 case OPCODE_DRAW_BUFFERS_ARB
:
6551 GLenum buffers
[MAX_DRAW_BUFFERS
];
6552 GLint i
, count
= MIN2(n
[1].i
, MAX_DRAW_BUFFERS
);
6553 for (i
= 0; i
< count
; i
++)
6554 buffers
[i
] = n
[2 + i
].e
;
6555 CALL_DrawBuffersARB(ctx
->Exec
, (n
[1].i
, buffers
));
6558 #if FEATURE_EXT_framebuffer_blit
6559 case OPCODE_BLIT_FRAMEBUFFER
:
6560 CALL_BlitFramebufferEXT(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
,
6561 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
6565 case OPCODE_TEX_BUMP_PARAMETER_ATI
:
6568 GLuint i
, pname
= n
[1].ui
;
6570 for (i
= 0; i
< 4; i
++)
6571 values
[i
] = n
[1 + i
].f
;
6572 CALL_TexBumpParameterfvATI(ctx
->Exec
, (pname
, values
));
6575 #if FEATURE_ATI_fragment_shader
6576 case OPCODE_BIND_FRAGMENT_SHADER_ATI
:
6577 CALL_BindFragmentShaderATI(ctx
->Exec
, (n
[1].i
));
6579 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
:
6582 GLuint i
, dst
= n
[1].ui
;
6584 for (i
= 0; i
< 4; i
++)
6585 values
[i
] = n
[1 + i
].f
;
6586 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, values
));
6590 case OPCODE_ATTR_1F_NV
:
6591 CALL_VertexAttrib1fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
));
6593 case OPCODE_ATTR_2F_NV
:
6594 /* Really shouldn't have to do this - the Node structure
6595 * is convenient, but it would be better to store the data
6596 * packed appropriately so that it can be sent directly
6597 * on. With x86_64 becoming common, this will start to
6600 if (sizeof(Node
) == sizeof(GLfloat
))
6601 CALL_VertexAttrib2fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6603 CALL_VertexAttrib2fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
));
6605 case OPCODE_ATTR_3F_NV
:
6606 if (sizeof(Node
) == sizeof(GLfloat
))
6607 CALL_VertexAttrib3fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6609 CALL_VertexAttrib3fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
6612 case OPCODE_ATTR_4F_NV
:
6613 if (sizeof(Node
) == sizeof(GLfloat
))
6614 CALL_VertexAttrib4fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6616 CALL_VertexAttrib4fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
6619 case OPCODE_ATTR_1F_ARB
:
6620 CALL_VertexAttrib1fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
));
6622 case OPCODE_ATTR_2F_ARB
:
6623 /* Really shouldn't have to do this - the Node structure
6624 * is convenient, but it would be better to store the data
6625 * packed appropriately so that it can be sent directly
6626 * on. With x86_64 becoming common, this will start to
6629 if (sizeof(Node
) == sizeof(GLfloat
))
6630 CALL_VertexAttrib2fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6632 CALL_VertexAttrib2fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
));
6634 case OPCODE_ATTR_3F_ARB
:
6635 if (sizeof(Node
) == sizeof(GLfloat
))
6636 CALL_VertexAttrib3fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6638 CALL_VertexAttrib3fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
6641 case OPCODE_ATTR_4F_ARB
:
6642 if (sizeof(Node
) == sizeof(GLfloat
))
6643 CALL_VertexAttrib4fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6645 CALL_VertexAttrib4fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
6648 case OPCODE_MATERIAL
:
6649 if (sizeof(Node
) == sizeof(GLfloat
))
6650 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, &n
[3].f
));
6657 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, f
));
6661 CALL_Begin(ctx
->Exec
, (n
[1].e
));
6664 CALL_End(ctx
->Exec
, ());
6667 CALL_Rectf(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
6669 case OPCODE_EVAL_C1
:
6670 CALL_EvalCoord1f(ctx
->Exec
, (n
[1].f
));
6672 case OPCODE_EVAL_C2
:
6673 CALL_EvalCoord2f(ctx
->Exec
, (n
[1].f
, n
[2].f
));
6675 case OPCODE_EVAL_P1
:
6676 CALL_EvalPoint1(ctx
->Exec
, (n
[1].i
));
6678 case OPCODE_EVAL_P2
:
6679 CALL_EvalPoint2(ctx
->Exec
, (n
[1].i
, n
[2].i
));
6682 case OPCODE_CONTINUE
:
6683 n
= (Node
*) n
[1].next
;
6685 case OPCODE_END_OF_LIST
:
6691 _mesa_sprintf(msg
, "Error in execute_list: opcode=%d",
6693 _mesa_problem(ctx
, msg
);
6698 /* increment n to point to next compiled command */
6699 if (opcode
!= OPCODE_CONTINUE
) {
6700 n
+= InstSize
[opcode
];
6705 if (ctx
->Driver
.EndCallList
)
6706 ctx
->Driver
.EndCallList(ctx
);
6708 ctx
->ListState
.CallDepth
--;
6713 /**********************************************************************/
6715 /**********************************************************************/
6718 * Test if a display list number is valid.
6720 GLboolean GLAPIENTRY
6721 _mesa_IsList(GLuint list
)
6723 GET_CURRENT_CONTEXT(ctx
);
6724 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
6725 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
6726 return islist(ctx
, list
);
6731 * Delete a sequence of consecutive display lists.
6734 _mesa_DeleteLists(GLuint list
, GLsizei range
)
6736 GET_CURRENT_CONTEXT(ctx
);
6738 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
6739 ASSERT_OUTSIDE_BEGIN_END(ctx
);
6742 _mesa_error(ctx
, GL_INVALID_VALUE
, "glDeleteLists");
6745 for (i
= list
; i
< list
+ range
; i
++) {
6746 destroy_list(ctx
, i
);
6752 * Return a display list number, n, such that lists n through n+range-1
6756 _mesa_GenLists(GLsizei range
)
6758 GET_CURRENT_CONTEXT(ctx
);
6760 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
6761 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, 0);
6764 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGenLists");
6772 * Make this an atomic operation
6774 _glthread_LOCK_MUTEX(ctx
->Shared
->Mutex
);
6776 base
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
6778 /* reserve the list IDs by with empty/dummy lists */
6780 for (i
= 0; i
< range
; i
++) {
6781 _mesa_HashInsert(ctx
->Shared
->DisplayList
, base
+ i
,
6782 make_list(base
+ i
, 1));
6786 _glthread_UNLOCK_MUTEX(ctx
->Shared
->Mutex
);
6793 * Begin a new display list.
6796 _mesa_NewList(GLuint name
, GLenum mode
)
6798 GET_CURRENT_CONTEXT(ctx
);
6800 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
6801 ASSERT_OUTSIDE_BEGIN_END(ctx
);
6803 if (MESA_VERBOSE
& VERBOSE_API
)
6804 _mesa_debug(ctx
, "glNewList %u %s\n", name
,
6805 _mesa_lookup_enum_by_nr(mode
));
6808 _mesa_error(ctx
, GL_INVALID_VALUE
, "glNewList");
6812 if (mode
!= GL_COMPILE
&& mode
!= GL_COMPILE_AND_EXECUTE
) {
6813 _mesa_error(ctx
, GL_INVALID_ENUM
, "glNewList");
6817 if (ctx
->ListState
.CurrentList
) {
6818 /* already compiling a display list */
6819 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
6823 ctx
->CompileFlag
= GL_TRUE
;
6824 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
6826 /* Reset acumulated list state:
6828 invalidate_saved_current_state( ctx
);
6830 /* Allocate new display list */
6831 ctx
->ListState
.CurrentList
= make_list(name
, BLOCK_SIZE
);
6832 ctx
->ListState
.CurrentBlock
= ctx
->ListState
.CurrentList
->Head
;
6833 ctx
->ListState
.CurrentPos
= 0;
6835 ctx
->Driver
.NewList(ctx
, name
, mode
);
6837 ctx
->CurrentDispatch
= ctx
->Save
;
6838 _glapi_set_dispatch(ctx
->CurrentDispatch
);
6843 * End definition of current display list.
6848 GET_CURRENT_CONTEXT(ctx
);
6849 SAVE_FLUSH_VERTICES(ctx
);
6850 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
6852 if (MESA_VERBOSE
& VERBOSE_API
)
6853 _mesa_debug(ctx
, "glEndList\n");
6855 /* Check that a list is under construction */
6856 if (!ctx
->ListState
.CurrentList
) {
6857 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glEndList");
6861 /* Call before emitting END_OF_LIST, in case the driver wants to
6862 * emit opcodes itself.
6864 ctx
->Driver
.EndList(ctx
);
6866 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_END_OF_LIST
, 0);
6868 /* Destroy old list, if any */
6869 destroy_list(ctx
, ctx
->ListState
.CurrentList
->Name
);
6871 /* Install the new list */
6872 _mesa_HashInsert(ctx
->Shared
->DisplayList
,
6873 ctx
->ListState
.CurrentList
->Name
,
6874 ctx
->ListState
.CurrentList
);
6877 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
6878 mesa_print_display_list(ctx
->ListState
.CurrentList
->Name
);
6880 ctx
->ListState
.CurrentList
= NULL
;
6881 ctx
->ExecuteFlag
= GL_TRUE
;
6882 ctx
->CompileFlag
= GL_FALSE
;
6884 ctx
->CurrentDispatch
= ctx
->Exec
;
6885 _glapi_set_dispatch(ctx
->CurrentDispatch
);
6890 _mesa_CallList(GLuint list
)
6892 GLboolean save_compile_flag
;
6893 GET_CURRENT_CONTEXT(ctx
);
6894 FLUSH_CURRENT(ctx
, 0);
6895 /* VERY IMPORTANT: Save the CompileFlag status, turn it off, */
6896 /* execute the display list, and restore the CompileFlag. */
6898 if (MESA_VERBOSE
& VERBOSE_API
)
6899 _mesa_debug(ctx
, "glCallList %d\n", list
);
6902 _mesa_error(ctx
, GL_INVALID_VALUE
, "glCallList(list==0)");
6906 /* mesa_print_display_list( list ); */
6908 save_compile_flag
= ctx
->CompileFlag
;
6909 if (save_compile_flag
) {
6910 ctx
->CompileFlag
= GL_FALSE
;
6913 execute_list(ctx
, list
);
6914 ctx
->CompileFlag
= save_compile_flag
;
6916 /* also restore API function pointers to point to "save" versions */
6917 if (save_compile_flag
) {
6918 ctx
->CurrentDispatch
= ctx
->Save
;
6919 _glapi_set_dispatch(ctx
->CurrentDispatch
);
6925 * Execute glCallLists: call multiple display lists.
6928 _mesa_CallLists(GLsizei n
, GLenum type
, const GLvoid
* lists
)
6930 GET_CURRENT_CONTEXT(ctx
);
6932 GLboolean save_compile_flag
;
6934 if (MESA_VERBOSE
& VERBOSE_API
)
6935 _mesa_debug(ctx
, "glCallLists %d\n", n
);
6939 case GL_UNSIGNED_BYTE
:
6941 case GL_UNSIGNED_SHORT
:
6943 case GL_UNSIGNED_INT
:
6951 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
6955 /* Save the CompileFlag status, turn it off, execute display list,
6956 * and restore the CompileFlag.
6958 save_compile_flag
= ctx
->CompileFlag
;
6959 ctx
->CompileFlag
= GL_FALSE
;
6961 for (i
= 0; i
< n
; i
++) {
6962 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ translate_id(i
, type
, lists
));
6963 execute_list(ctx
, list
);
6966 ctx
->CompileFlag
= save_compile_flag
;
6968 /* also restore API function pointers to point to "save" versions */
6969 if (save_compile_flag
) {
6970 ctx
->CurrentDispatch
= ctx
->Save
;
6971 _glapi_set_dispatch(ctx
->CurrentDispatch
);
6977 * Set the offset added to list numbers in glCallLists.
6980 _mesa_ListBase(GLuint base
)
6982 GET_CURRENT_CONTEXT(ctx
);
6983 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
6984 ASSERT_OUTSIDE_BEGIN_END(ctx
);
6985 ctx
->List
.ListBase
= base
;
6989 /* Can no longer assume ctx->Exec->Func is equal to _mesa_Func.
6991 static void GLAPIENTRY
6994 GET_CURRENT_CONTEXT(ctx
);
6995 FLUSH_VERTICES(ctx
, 0);
6996 CALL_Finish(ctx
->Exec
, ());
6999 static void GLAPIENTRY
7002 GET_CURRENT_CONTEXT(ctx
);
7003 FLUSH_VERTICES(ctx
, 0);
7004 CALL_Flush(ctx
->Exec
, ());
7007 static void GLAPIENTRY
7008 exec_GetBooleanv(GLenum pname
, GLboolean
*params
)
7010 GET_CURRENT_CONTEXT(ctx
);
7011 FLUSH_VERTICES(ctx
, 0);
7012 CALL_GetBooleanv(ctx
->Exec
, (pname
, params
));
7015 static void GLAPIENTRY
7016 exec_GetClipPlane(GLenum plane
, GLdouble
* equation
)
7018 GET_CURRENT_CONTEXT(ctx
);
7019 FLUSH_VERTICES(ctx
, 0);
7020 CALL_GetClipPlane(ctx
->Exec
, (plane
, equation
));
7023 static void GLAPIENTRY
7024 exec_GetDoublev(GLenum pname
, GLdouble
*params
)
7026 GET_CURRENT_CONTEXT(ctx
);
7027 FLUSH_VERTICES(ctx
, 0);
7028 CALL_GetDoublev(ctx
->Exec
, (pname
, params
));
7031 static GLenum GLAPIENTRY
7034 GET_CURRENT_CONTEXT(ctx
);
7035 FLUSH_VERTICES(ctx
, 0);
7036 return CALL_GetError(ctx
->Exec
, ());
7039 static void GLAPIENTRY
7040 exec_GetFloatv(GLenum pname
, GLfloat
*params
)
7042 GET_CURRENT_CONTEXT(ctx
);
7043 FLUSH_VERTICES(ctx
, 0);
7044 CALL_GetFloatv(ctx
->Exec
, (pname
, params
));
7047 static void GLAPIENTRY
7048 exec_GetIntegerv(GLenum pname
, GLint
*params
)
7050 GET_CURRENT_CONTEXT(ctx
);
7051 FLUSH_VERTICES(ctx
, 0);
7052 CALL_GetIntegerv(ctx
->Exec
, (pname
, params
));
7055 static void GLAPIENTRY
7056 exec_GetLightfv(GLenum light
, GLenum pname
, GLfloat
*params
)
7058 GET_CURRENT_CONTEXT(ctx
);
7059 FLUSH_VERTICES(ctx
, 0);
7060 CALL_GetLightfv(ctx
->Exec
, (light
, pname
, params
));
7063 static void GLAPIENTRY
7064 exec_GetLightiv(GLenum light
, GLenum pname
, GLint
*params
)
7066 GET_CURRENT_CONTEXT(ctx
);
7067 FLUSH_VERTICES(ctx
, 0);
7068 CALL_GetLightiv(ctx
->Exec
, (light
, pname
, params
));
7071 static void GLAPIENTRY
7072 exec_GetMapdv(GLenum target
, GLenum query
, GLdouble
* v
)
7074 GET_CURRENT_CONTEXT(ctx
);
7075 FLUSH_VERTICES(ctx
, 0);
7076 CALL_GetMapdv(ctx
->Exec
, (target
, query
, v
));
7079 static void GLAPIENTRY
7080 exec_GetMapfv(GLenum target
, GLenum query
, GLfloat
* v
)
7082 GET_CURRENT_CONTEXT(ctx
);
7083 FLUSH_VERTICES(ctx
, 0);
7084 CALL_GetMapfv(ctx
->Exec
, (target
, query
, v
));
7087 static void GLAPIENTRY
7088 exec_GetMapiv(GLenum target
, GLenum query
, GLint
* v
)
7090 GET_CURRENT_CONTEXT(ctx
);
7091 FLUSH_VERTICES(ctx
, 0);
7092 CALL_GetMapiv(ctx
->Exec
, (target
, query
, v
));
7095 static void GLAPIENTRY
7096 exec_GetMaterialfv(GLenum face
, GLenum pname
, GLfloat
*params
)
7098 GET_CURRENT_CONTEXT(ctx
);
7099 FLUSH_VERTICES(ctx
, 0);
7100 CALL_GetMaterialfv(ctx
->Exec
, (face
, pname
, params
));
7103 static void GLAPIENTRY
7104 exec_GetMaterialiv(GLenum face
, GLenum pname
, GLint
*params
)
7106 GET_CURRENT_CONTEXT(ctx
);
7107 FLUSH_VERTICES(ctx
, 0);
7108 CALL_GetMaterialiv(ctx
->Exec
, (face
, pname
, params
));
7111 static void GLAPIENTRY
7112 exec_GetPixelMapfv(GLenum map
, GLfloat
*values
)
7114 GET_CURRENT_CONTEXT(ctx
);
7115 FLUSH_VERTICES(ctx
, 0);
7116 CALL_GetPixelMapfv(ctx
->Exec
, (map
, values
));
7119 static void GLAPIENTRY
7120 exec_GetPixelMapuiv(GLenum map
, GLuint
*values
)
7122 GET_CURRENT_CONTEXT(ctx
);
7123 FLUSH_VERTICES(ctx
, 0);
7124 CALL_GetPixelMapuiv(ctx
->Exec
, (map
, values
));
7127 static void GLAPIENTRY
7128 exec_GetPixelMapusv(GLenum map
, GLushort
*values
)
7130 GET_CURRENT_CONTEXT(ctx
);
7131 FLUSH_VERTICES(ctx
, 0);
7132 CALL_GetPixelMapusv(ctx
->Exec
, (map
, values
));
7135 static void GLAPIENTRY
7136 exec_GetPolygonStipple(GLubyte
* dest
)
7138 GET_CURRENT_CONTEXT(ctx
);
7139 FLUSH_VERTICES(ctx
, 0);
7140 CALL_GetPolygonStipple(ctx
->Exec
, (dest
));
7143 static const GLubyte
*GLAPIENTRY
7144 exec_GetString(GLenum name
)
7146 GET_CURRENT_CONTEXT(ctx
);
7147 FLUSH_VERTICES(ctx
, 0);
7148 return CALL_GetString(ctx
->Exec
, (name
));
7151 static void GLAPIENTRY
7152 exec_GetTexEnvfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7154 GET_CURRENT_CONTEXT(ctx
);
7155 FLUSH_VERTICES(ctx
, 0);
7156 CALL_GetTexEnvfv(ctx
->Exec
, (target
, pname
, params
));
7159 static void GLAPIENTRY
7160 exec_GetTexEnviv(GLenum target
, GLenum pname
, GLint
*params
)
7162 GET_CURRENT_CONTEXT(ctx
);
7163 FLUSH_VERTICES(ctx
, 0);
7164 CALL_GetTexEnviv(ctx
->Exec
, (target
, pname
, params
));
7167 static void GLAPIENTRY
7168 exec_GetTexGendv(GLenum coord
, GLenum pname
, GLdouble
*params
)
7170 GET_CURRENT_CONTEXT(ctx
);
7171 FLUSH_VERTICES(ctx
, 0);
7172 CALL_GetTexGendv(ctx
->Exec
, (coord
, pname
, params
));
7175 static void GLAPIENTRY
7176 exec_GetTexGenfv(GLenum coord
, GLenum pname
, GLfloat
*params
)
7178 GET_CURRENT_CONTEXT(ctx
);
7179 FLUSH_VERTICES(ctx
, 0);
7180 CALL_GetTexGenfv(ctx
->Exec
, (coord
, pname
, params
));
7183 static void GLAPIENTRY
7184 exec_GetTexGeniv(GLenum coord
, GLenum pname
, GLint
*params
)
7186 GET_CURRENT_CONTEXT(ctx
);
7187 FLUSH_VERTICES(ctx
, 0);
7188 CALL_GetTexGeniv(ctx
->Exec
, (coord
, pname
, params
));
7191 static void GLAPIENTRY
7192 exec_GetTexImage(GLenum target
, GLint level
, GLenum format
,
7193 GLenum type
, GLvoid
* pixels
)
7195 GET_CURRENT_CONTEXT(ctx
);
7196 FLUSH_VERTICES(ctx
, 0);
7197 CALL_GetTexImage(ctx
->Exec
, (target
, level
, format
, type
, pixels
));
7200 static void GLAPIENTRY
7201 exec_GetTexLevelParameterfv(GLenum target
, GLint level
,
7202 GLenum pname
, GLfloat
*params
)
7204 GET_CURRENT_CONTEXT(ctx
);
7205 FLUSH_VERTICES(ctx
, 0);
7206 CALL_GetTexLevelParameterfv(ctx
->Exec
, (target
, level
, pname
, params
));
7209 static void GLAPIENTRY
7210 exec_GetTexLevelParameteriv(GLenum target
, GLint level
,
7211 GLenum pname
, GLint
*params
)
7213 GET_CURRENT_CONTEXT(ctx
);
7214 FLUSH_VERTICES(ctx
, 0);
7215 CALL_GetTexLevelParameteriv(ctx
->Exec
, (target
, level
, pname
, params
));
7218 static void GLAPIENTRY
7219 exec_GetTexParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7221 GET_CURRENT_CONTEXT(ctx
);
7222 FLUSH_VERTICES(ctx
, 0);
7223 CALL_GetTexParameterfv(ctx
->Exec
, (target
, pname
, params
));
7226 static void GLAPIENTRY
7227 exec_GetTexParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7229 GET_CURRENT_CONTEXT(ctx
);
7230 FLUSH_VERTICES(ctx
, 0);
7231 CALL_GetTexParameteriv(ctx
->Exec
, (target
, pname
, params
));
7234 static GLboolean GLAPIENTRY
7235 exec_IsEnabled(GLenum cap
)
7237 GET_CURRENT_CONTEXT(ctx
);
7238 FLUSH_VERTICES(ctx
, 0);
7239 return CALL_IsEnabled(ctx
->Exec
, (cap
));
7242 static void GLAPIENTRY
7243 exec_PixelStoref(GLenum pname
, GLfloat param
)
7245 GET_CURRENT_CONTEXT(ctx
);
7246 FLUSH_VERTICES(ctx
, 0);
7247 CALL_PixelStoref(ctx
->Exec
, (pname
, param
));
7250 static void GLAPIENTRY
7251 exec_PixelStorei(GLenum pname
, GLint param
)
7253 GET_CURRENT_CONTEXT(ctx
);
7254 FLUSH_VERTICES(ctx
, 0);
7255 CALL_PixelStorei(ctx
->Exec
, (pname
, param
));
7258 static void GLAPIENTRY
7259 exec_ReadPixels(GLint x
, GLint y
, GLsizei width
, GLsizei height
,
7260 GLenum format
, GLenum type
, GLvoid
* pixels
)
7262 GET_CURRENT_CONTEXT(ctx
);
7263 FLUSH_VERTICES(ctx
, 0);
7264 CALL_ReadPixels(ctx
->Exec
, (x
, y
, width
, height
, format
, type
, pixels
));
7267 static GLint GLAPIENTRY
7268 exec_RenderMode(GLenum mode
)
7270 GET_CURRENT_CONTEXT(ctx
);
7271 FLUSH_VERTICES(ctx
, 0);
7272 return CALL_RenderMode(ctx
->Exec
, (mode
));
7275 static void GLAPIENTRY
7276 exec_FeedbackBuffer(GLsizei size
, GLenum type
, GLfloat
* buffer
)
7278 GET_CURRENT_CONTEXT(ctx
);
7279 FLUSH_VERTICES(ctx
, 0);
7280 CALL_FeedbackBuffer(ctx
->Exec
, (size
, type
, buffer
));
7283 static void GLAPIENTRY
7284 exec_SelectBuffer(GLsizei size
, GLuint
* buffer
)
7286 GET_CURRENT_CONTEXT(ctx
);
7287 FLUSH_VERTICES(ctx
, 0);
7288 CALL_SelectBuffer(ctx
->Exec
, (size
, buffer
));
7291 static GLboolean GLAPIENTRY
7292 exec_AreTexturesResident(GLsizei n
, const GLuint
* texName
,
7293 GLboolean
* residences
)
7295 GET_CURRENT_CONTEXT(ctx
);
7296 FLUSH_VERTICES(ctx
, 0);
7297 return CALL_AreTexturesResident(ctx
->Exec
, (n
, texName
, residences
));
7300 static void GLAPIENTRY
7301 exec_ColorPointer(GLint size
, GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
7303 GET_CURRENT_CONTEXT(ctx
);
7304 FLUSH_VERTICES(ctx
, 0);
7305 CALL_ColorPointer(ctx
->Exec
, (size
, type
, stride
, ptr
));
7308 static void GLAPIENTRY
7309 exec_DeleteTextures(GLsizei n
, const GLuint
* texName
)
7311 GET_CURRENT_CONTEXT(ctx
);
7312 FLUSH_VERTICES(ctx
, 0);
7313 CALL_DeleteTextures(ctx
->Exec
, (n
, texName
));
7316 static void GLAPIENTRY
7317 exec_DisableClientState(GLenum cap
)
7319 GET_CURRENT_CONTEXT(ctx
);
7320 FLUSH_VERTICES(ctx
, 0);
7321 CALL_DisableClientState(ctx
->Exec
, (cap
));
7324 static void GLAPIENTRY
7325 exec_EdgeFlagPointer(GLsizei stride
, const GLvoid
* vptr
)
7327 GET_CURRENT_CONTEXT(ctx
);
7328 FLUSH_VERTICES(ctx
, 0);
7329 CALL_EdgeFlagPointer(ctx
->Exec
, (stride
, vptr
));
7332 static void GLAPIENTRY
7333 exec_EnableClientState(GLenum cap
)
7335 GET_CURRENT_CONTEXT(ctx
);
7336 FLUSH_VERTICES(ctx
, 0);
7337 CALL_EnableClientState(ctx
->Exec
, (cap
));
7340 static void GLAPIENTRY
7341 exec_GenTextures(GLsizei n
, GLuint
* texName
)
7343 GET_CURRENT_CONTEXT(ctx
);
7344 FLUSH_VERTICES(ctx
, 0);
7345 CALL_GenTextures(ctx
->Exec
, (n
, texName
));
7348 static void GLAPIENTRY
7349 exec_GetPointerv(GLenum pname
, GLvoid
**params
)
7351 GET_CURRENT_CONTEXT(ctx
);
7352 FLUSH_VERTICES(ctx
, 0);
7353 CALL_GetPointerv(ctx
->Exec
, (pname
, params
));
7356 static void GLAPIENTRY
7357 exec_IndexPointer(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
7359 GET_CURRENT_CONTEXT(ctx
);
7360 FLUSH_VERTICES(ctx
, 0);
7361 CALL_IndexPointer(ctx
->Exec
, (type
, stride
, ptr
));
7364 static void GLAPIENTRY
7365 exec_InterleavedArrays(GLenum format
, GLsizei stride
, const GLvoid
* pointer
)
7367 GET_CURRENT_CONTEXT(ctx
);
7368 FLUSH_VERTICES(ctx
, 0);
7369 CALL_InterleavedArrays(ctx
->Exec
, (format
, stride
, pointer
));
7372 static GLboolean GLAPIENTRY
7373 exec_IsTexture(GLuint texture
)
7375 GET_CURRENT_CONTEXT(ctx
);
7376 FLUSH_VERTICES(ctx
, 0);
7377 return CALL_IsTexture(ctx
->Exec
, (texture
));
7380 static void GLAPIENTRY
7381 exec_NormalPointer(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
7383 GET_CURRENT_CONTEXT(ctx
);
7384 FLUSH_VERTICES(ctx
, 0);
7385 CALL_NormalPointer(ctx
->Exec
, (type
, stride
, ptr
));
7388 static void GLAPIENTRY
7389 exec_PopClientAttrib(void)
7391 GET_CURRENT_CONTEXT(ctx
);
7392 FLUSH_VERTICES(ctx
, 0);
7393 CALL_PopClientAttrib(ctx
->Exec
, ());
7396 static void GLAPIENTRY
7397 exec_PushClientAttrib(GLbitfield mask
)
7399 GET_CURRENT_CONTEXT(ctx
);
7400 FLUSH_VERTICES(ctx
, 0);
7401 CALL_PushClientAttrib(ctx
->Exec
, (mask
));
7404 static void GLAPIENTRY
7405 exec_TexCoordPointer(GLint size
, GLenum type
, GLsizei stride
,
7408 GET_CURRENT_CONTEXT(ctx
);
7409 FLUSH_VERTICES(ctx
, 0);
7410 CALL_TexCoordPointer(ctx
->Exec
, (size
, type
, stride
, ptr
));
7413 static void GLAPIENTRY
7414 exec_GetCompressedTexImageARB(GLenum target
, GLint level
, GLvoid
* img
)
7416 GET_CURRENT_CONTEXT(ctx
);
7417 FLUSH_VERTICES(ctx
, 0);
7418 CALL_GetCompressedTexImageARB(ctx
->Exec
, (target
, level
, img
));
7421 static void GLAPIENTRY
7422 exec_VertexPointer(GLint size
, GLenum type
, GLsizei stride
,
7425 GET_CURRENT_CONTEXT(ctx
);
7426 FLUSH_VERTICES(ctx
, 0);
7427 CALL_VertexPointer(ctx
->Exec
, (size
, type
, stride
, ptr
));
7430 static void GLAPIENTRY
7431 exec_CopyConvolutionFilter1D(GLenum target
, GLenum internalFormat
,
7432 GLint x
, GLint y
, GLsizei width
)
7434 GET_CURRENT_CONTEXT(ctx
);
7435 FLUSH_VERTICES(ctx
, 0);
7436 CALL_CopyConvolutionFilter1D(ctx
->Exec
,
7437 (target
, internalFormat
, x
, y
, width
));
7440 static void GLAPIENTRY
7441 exec_CopyConvolutionFilter2D(GLenum target
, GLenum internalFormat
,
7442 GLint x
, GLint y
, GLsizei width
, GLsizei height
)
7444 GET_CURRENT_CONTEXT(ctx
);
7445 FLUSH_VERTICES(ctx
, 0);
7446 CALL_CopyConvolutionFilter2D(ctx
->Exec
,
7447 (target
, internalFormat
, x
, y
, width
,
7451 static void GLAPIENTRY
7452 exec_GetColorTable(GLenum target
, GLenum format
, GLenum type
, GLvoid
* data
)
7454 GET_CURRENT_CONTEXT(ctx
);
7455 FLUSH_VERTICES(ctx
, 0);
7456 CALL_GetColorTable(ctx
->Exec
, (target
, format
, type
, data
));
7459 static void GLAPIENTRY
7460 exec_GetColorTableParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7462 GET_CURRENT_CONTEXT(ctx
);
7463 FLUSH_VERTICES(ctx
, 0);
7464 CALL_GetColorTableParameterfv(ctx
->Exec
, (target
, pname
, params
));
7467 static void GLAPIENTRY
7468 exec_GetColorTableParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7470 GET_CURRENT_CONTEXT(ctx
);
7471 FLUSH_VERTICES(ctx
, 0);
7472 CALL_GetColorTableParameteriv(ctx
->Exec
, (target
, pname
, params
));
7475 static void GLAPIENTRY
7476 exec_GetConvolutionFilter(GLenum target
, GLenum format
, GLenum type
,
7479 GET_CURRENT_CONTEXT(ctx
);
7480 FLUSH_VERTICES(ctx
, 0);
7481 CALL_GetConvolutionFilter(ctx
->Exec
, (target
, format
, type
, image
));
7484 static void GLAPIENTRY
7485 exec_GetConvolutionParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7487 GET_CURRENT_CONTEXT(ctx
);
7488 FLUSH_VERTICES(ctx
, 0);
7489 CALL_GetConvolutionParameterfv(ctx
->Exec
, (target
, pname
, params
));
7492 static void GLAPIENTRY
7493 exec_GetConvolutionParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7495 GET_CURRENT_CONTEXT(ctx
);
7496 FLUSH_VERTICES(ctx
, 0);
7497 CALL_GetConvolutionParameteriv(ctx
->Exec
, (target
, pname
, params
));
7500 static void GLAPIENTRY
7501 exec_GetHistogram(GLenum target
, GLboolean reset
, GLenum format
,
7502 GLenum type
, GLvoid
*values
)
7504 GET_CURRENT_CONTEXT(ctx
);
7505 FLUSH_VERTICES(ctx
, 0);
7506 CALL_GetHistogram(ctx
->Exec
, (target
, reset
, format
, type
, values
));
7509 static void GLAPIENTRY
7510 exec_GetHistogramParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7512 GET_CURRENT_CONTEXT(ctx
);
7513 FLUSH_VERTICES(ctx
, 0);
7514 CALL_GetHistogramParameterfv(ctx
->Exec
, (target
, pname
, params
));
7517 static void GLAPIENTRY
7518 exec_GetHistogramParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7520 GET_CURRENT_CONTEXT(ctx
);
7521 FLUSH_VERTICES(ctx
, 0);
7522 CALL_GetHistogramParameteriv(ctx
->Exec
, (target
, pname
, params
));
7525 static void GLAPIENTRY
7526 exec_GetMinmax(GLenum target
, GLboolean reset
, GLenum format
,
7527 GLenum type
, GLvoid
*values
)
7529 GET_CURRENT_CONTEXT(ctx
);
7530 FLUSH_VERTICES(ctx
, 0);
7531 CALL_GetMinmax(ctx
->Exec
, (target
, reset
, format
, type
, values
));
7534 static void GLAPIENTRY
7535 exec_GetMinmaxParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7537 GET_CURRENT_CONTEXT(ctx
);
7538 FLUSH_VERTICES(ctx
, 0);
7539 CALL_GetMinmaxParameterfv(ctx
->Exec
, (target
, pname
, params
));
7542 static void GLAPIENTRY
7543 exec_GetMinmaxParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7545 GET_CURRENT_CONTEXT(ctx
);
7546 FLUSH_VERTICES(ctx
, 0);
7547 CALL_GetMinmaxParameteriv(ctx
->Exec
, (target
, pname
, params
));
7550 static void GLAPIENTRY
7551 exec_GetSeparableFilter(GLenum target
, GLenum format
, GLenum type
,
7552 GLvoid
*row
, GLvoid
*column
, GLvoid
*span
)
7554 GET_CURRENT_CONTEXT(ctx
);
7555 FLUSH_VERTICES(ctx
, 0);
7556 CALL_GetSeparableFilter(ctx
->Exec
,
7557 (target
, format
, type
, row
, column
, span
));
7560 static void GLAPIENTRY
7561 exec_SeparableFilter2D(GLenum target
, GLenum internalFormat
,
7562 GLsizei width
, GLsizei height
, GLenum format
,
7563 GLenum type
, const GLvoid
*row
, const GLvoid
*column
)
7565 GET_CURRENT_CONTEXT(ctx
);
7566 FLUSH_VERTICES(ctx
, 0);
7567 CALL_SeparableFilter2D(ctx
->Exec
,
7568 (target
, internalFormat
, width
, height
, format
,
7569 type
, row
, column
));
7572 static void GLAPIENTRY
7573 exec_ColorPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
7574 GLsizei count
, const GLvoid
*ptr
)
7576 GET_CURRENT_CONTEXT(ctx
);
7577 FLUSH_VERTICES(ctx
, 0);
7578 CALL_ColorPointerEXT(ctx
->Exec
, (size
, type
, stride
, count
, ptr
));
7581 static void GLAPIENTRY
7582 exec_EdgeFlagPointerEXT(GLsizei stride
, GLsizei count
, const GLboolean
*ptr
)
7584 GET_CURRENT_CONTEXT(ctx
);
7585 FLUSH_VERTICES(ctx
, 0);
7586 CALL_EdgeFlagPointerEXT(ctx
->Exec
, (stride
, count
, ptr
));
7589 static void GLAPIENTRY
7590 exec_IndexPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
,
7593 GET_CURRENT_CONTEXT(ctx
);
7594 FLUSH_VERTICES(ctx
, 0);
7595 CALL_IndexPointerEXT(ctx
->Exec
, (type
, stride
, count
, ptr
));
7598 static void GLAPIENTRY
7599 exec_NormalPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
,
7602 GET_CURRENT_CONTEXT(ctx
);
7603 FLUSH_VERTICES(ctx
, 0);
7604 CALL_NormalPointerEXT(ctx
->Exec
, (type
, stride
, count
, ptr
));
7607 static void GLAPIENTRY
7608 exec_TexCoordPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
7609 GLsizei count
, const GLvoid
*ptr
)
7611 GET_CURRENT_CONTEXT(ctx
);
7612 FLUSH_VERTICES(ctx
, 0);
7613 CALL_TexCoordPointerEXT(ctx
->Exec
, (size
, type
, stride
, count
, ptr
));
7616 static void GLAPIENTRY
7617 exec_VertexPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
7618 GLsizei count
, const GLvoid
*ptr
)
7620 GET_CURRENT_CONTEXT(ctx
);
7621 FLUSH_VERTICES(ctx
, 0);
7622 CALL_VertexPointerEXT(ctx
->Exec
, (size
, type
, stride
, count
, ptr
));
7625 static void GLAPIENTRY
7626 exec_LockArraysEXT(GLint first
, GLsizei count
)
7628 GET_CURRENT_CONTEXT(ctx
);
7629 FLUSH_VERTICES(ctx
, 0);
7630 CALL_LockArraysEXT(ctx
->Exec
, (first
, count
));
7633 static void GLAPIENTRY
7634 exec_UnlockArraysEXT(void)
7636 GET_CURRENT_CONTEXT(ctx
);
7637 FLUSH_VERTICES(ctx
, 0);
7638 CALL_UnlockArraysEXT(ctx
->Exec
, ());
7641 static void GLAPIENTRY
7642 exec_ClientActiveTextureARB(GLenum target
)
7644 GET_CURRENT_CONTEXT(ctx
);
7645 FLUSH_VERTICES(ctx
, 0);
7646 CALL_ClientActiveTextureARB(ctx
->Exec
, (target
));
7649 static void GLAPIENTRY
7650 exec_SecondaryColorPointerEXT(GLint size
, GLenum type
,
7651 GLsizei stride
, const GLvoid
*ptr
)
7653 GET_CURRENT_CONTEXT(ctx
);
7654 FLUSH_VERTICES(ctx
, 0);
7655 CALL_SecondaryColorPointerEXT(ctx
->Exec
, (size
, type
, stride
, ptr
));
7658 static void GLAPIENTRY
7659 exec_FogCoordPointerEXT(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
7661 GET_CURRENT_CONTEXT(ctx
);
7662 FLUSH_VERTICES(ctx
, 0);
7663 CALL_FogCoordPointerEXT(ctx
->Exec
, (type
, stride
, ptr
));
7666 /* GL_EXT_multi_draw_arrays */
7667 static void GLAPIENTRY
7668 exec_MultiDrawArraysEXT(GLenum mode
, GLint
* first
,
7669 GLsizei
* count
, GLsizei primcount
)
7671 GET_CURRENT_CONTEXT(ctx
);
7672 FLUSH_VERTICES(ctx
, 0);
7673 CALL_MultiDrawArraysEXT(ctx
->Exec
, (mode
, first
, count
, primcount
));
7676 /* GL_EXT_multi_draw_arrays */
7677 static void GLAPIENTRY
7678 exec_MultiDrawElementsEXT(GLenum mode
, const GLsizei
* count
,
7679 GLenum type
, const GLvoid
** indices
,
7682 GET_CURRENT_CONTEXT(ctx
);
7683 FLUSH_VERTICES(ctx
, 0);
7684 CALL_MultiDrawElementsEXT(ctx
->Exec
,
7685 (mode
, count
, type
, indices
, primcount
));
7688 /* GL_IBM_multimode_draw_arrays */
7689 static void GLAPIENTRY
7690 exec_MultiModeDrawArraysIBM(const GLenum
* mode
, const GLint
* first
,
7691 const GLsizei
* count
, GLsizei primcount
,
7694 GET_CURRENT_CONTEXT(ctx
);
7695 FLUSH_VERTICES(ctx
, 0);
7696 CALL_MultiModeDrawArraysIBM(ctx
->Exec
,
7697 (mode
, first
, count
, primcount
, modestride
));
7700 /* GL_IBM_multimode_draw_arrays */
7701 static void GLAPIENTRY
7702 exec_MultiModeDrawElementsIBM(const GLenum
* mode
,
7703 const GLsizei
* count
,
7705 const GLvoid
* const *indices
,
7706 GLsizei primcount
, GLint modestride
)
7708 GET_CURRENT_CONTEXT(ctx
);
7709 FLUSH_VERTICES(ctx
, 0);
7710 CALL_MultiModeDrawElementsIBM(ctx
->Exec
,
7711 (mode
, count
, type
, indices
, primcount
,
7718 * Setup the given dispatch table to point to Mesa's display list
7719 * building functions.
7721 * This does not include any of the tnl functions - they are
7722 * initialized from _mesa_init_api_defaults and from the active vtxfmt
7726 _mesa_init_dlist_table(struct _glapi_table
*table
)
7728 _mesa_loopback_init_api_table(table
);
7731 SET_Accum(table
, save_Accum
);
7732 SET_AlphaFunc(table
, save_AlphaFunc
);
7733 SET_Bitmap(table
, save_Bitmap
);
7734 SET_BlendFunc(table
, save_BlendFunc
);
7735 SET_CallList(table
, _mesa_save_CallList
);
7736 SET_CallLists(table
, _mesa_save_CallLists
);
7737 SET_Clear(table
, save_Clear
);
7738 SET_ClearAccum(table
, save_ClearAccum
);
7739 SET_ClearColor(table
, save_ClearColor
);
7740 SET_ClearDepth(table
, save_ClearDepth
);
7741 SET_ClearIndex(table
, save_ClearIndex
);
7742 SET_ClearStencil(table
, save_ClearStencil
);
7743 SET_ClipPlane(table
, save_ClipPlane
);
7744 SET_ColorMask(table
, save_ColorMask
);
7745 SET_ColorMaterial(table
, save_ColorMaterial
);
7746 SET_CopyPixels(table
, save_CopyPixels
);
7747 SET_CullFace(table
, save_CullFace
);
7748 SET_DeleteLists(table
, _mesa_DeleteLists
);
7749 SET_DepthFunc(table
, save_DepthFunc
);
7750 SET_DepthMask(table
, save_DepthMask
);
7751 SET_DepthRange(table
, save_DepthRange
);
7752 SET_Disable(table
, save_Disable
);
7753 SET_DrawBuffer(table
, save_DrawBuffer
);
7754 SET_DrawPixels(table
, save_DrawPixels
);
7755 SET_Enable(table
, save_Enable
);
7756 SET_EndList(table
, _mesa_EndList
);
7757 SET_EvalMesh1(table
, _mesa_save_EvalMesh1
);
7758 SET_EvalMesh2(table
, _mesa_save_EvalMesh2
);
7759 SET_Finish(table
, exec_Finish
);
7760 SET_Flush(table
, exec_Flush
);
7761 SET_Fogf(table
, save_Fogf
);
7762 SET_Fogfv(table
, save_Fogfv
);
7763 SET_Fogi(table
, save_Fogi
);
7764 SET_Fogiv(table
, save_Fogiv
);
7765 SET_FrontFace(table
, save_FrontFace
);
7766 SET_Frustum(table
, save_Frustum
);
7767 SET_GenLists(table
, _mesa_GenLists
);
7768 SET_GetBooleanv(table
, exec_GetBooleanv
);
7769 SET_GetClipPlane(table
, exec_GetClipPlane
);
7770 SET_GetDoublev(table
, exec_GetDoublev
);
7771 SET_GetError(table
, exec_GetError
);
7772 SET_GetFloatv(table
, exec_GetFloatv
);
7773 SET_GetIntegerv(table
, exec_GetIntegerv
);
7774 SET_GetLightfv(table
, exec_GetLightfv
);
7775 SET_GetLightiv(table
, exec_GetLightiv
);
7776 SET_GetMapdv(table
, exec_GetMapdv
);
7777 SET_GetMapfv(table
, exec_GetMapfv
);
7778 SET_GetMapiv(table
, exec_GetMapiv
);
7779 SET_GetMaterialfv(table
, exec_GetMaterialfv
);
7780 SET_GetMaterialiv(table
, exec_GetMaterialiv
);
7781 SET_GetPixelMapfv(table
, exec_GetPixelMapfv
);
7782 SET_GetPixelMapuiv(table
, exec_GetPixelMapuiv
);
7783 SET_GetPixelMapusv(table
, exec_GetPixelMapusv
);
7784 SET_GetPolygonStipple(table
, exec_GetPolygonStipple
);
7785 SET_GetString(table
, exec_GetString
);
7786 SET_GetTexEnvfv(table
, exec_GetTexEnvfv
);
7787 SET_GetTexEnviv(table
, exec_GetTexEnviv
);
7788 SET_GetTexGendv(table
, exec_GetTexGendv
);
7789 SET_GetTexGenfv(table
, exec_GetTexGenfv
);
7790 SET_GetTexGeniv(table
, exec_GetTexGeniv
);
7791 SET_GetTexImage(table
, exec_GetTexImage
);
7792 SET_GetTexLevelParameterfv(table
, exec_GetTexLevelParameterfv
);
7793 SET_GetTexLevelParameteriv(table
, exec_GetTexLevelParameteriv
);
7794 SET_GetTexParameterfv(table
, exec_GetTexParameterfv
);
7795 SET_GetTexParameteriv(table
, exec_GetTexParameteriv
);
7796 SET_Hint(table
, save_Hint
);
7797 SET_IndexMask(table
, save_IndexMask
);
7798 SET_InitNames(table
, save_InitNames
);
7799 SET_IsEnabled(table
, exec_IsEnabled
);
7800 SET_IsList(table
, _mesa_IsList
);
7801 SET_LightModelf(table
, save_LightModelf
);
7802 SET_LightModelfv(table
, save_LightModelfv
);
7803 SET_LightModeli(table
, save_LightModeli
);
7804 SET_LightModeliv(table
, save_LightModeliv
);
7805 SET_Lightf(table
, save_Lightf
);
7806 SET_Lightfv(table
, save_Lightfv
);
7807 SET_Lighti(table
, save_Lighti
);
7808 SET_Lightiv(table
, save_Lightiv
);
7809 SET_LineStipple(table
, save_LineStipple
);
7810 SET_LineWidth(table
, save_LineWidth
);
7811 SET_ListBase(table
, save_ListBase
);
7812 SET_LoadIdentity(table
, save_LoadIdentity
);
7813 SET_LoadMatrixd(table
, save_LoadMatrixd
);
7814 SET_LoadMatrixf(table
, save_LoadMatrixf
);
7815 SET_LoadName(table
, save_LoadName
);
7816 SET_LogicOp(table
, save_LogicOp
);
7817 SET_Map1d(table
, save_Map1d
);
7818 SET_Map1f(table
, save_Map1f
);
7819 SET_Map2d(table
, save_Map2d
);
7820 SET_Map2f(table
, save_Map2f
);
7821 SET_MapGrid1d(table
, save_MapGrid1d
);
7822 SET_MapGrid1f(table
, save_MapGrid1f
);
7823 SET_MapGrid2d(table
, save_MapGrid2d
);
7824 SET_MapGrid2f(table
, save_MapGrid2f
);
7825 SET_MatrixMode(table
, save_MatrixMode
);
7826 SET_MultMatrixd(table
, save_MultMatrixd
);
7827 SET_MultMatrixf(table
, save_MultMatrixf
);
7828 SET_NewList(table
, save_NewList
);
7829 SET_Ortho(table
, save_Ortho
);
7830 SET_PassThrough(table
, save_PassThrough
);
7831 SET_PixelMapfv(table
, save_PixelMapfv
);
7832 SET_PixelMapuiv(table
, save_PixelMapuiv
);
7833 SET_PixelMapusv(table
, save_PixelMapusv
);
7834 SET_PixelStoref(table
, exec_PixelStoref
);
7835 SET_PixelStorei(table
, exec_PixelStorei
);
7836 SET_PixelTransferf(table
, save_PixelTransferf
);
7837 SET_PixelTransferi(table
, save_PixelTransferi
);
7838 SET_PixelZoom(table
, save_PixelZoom
);
7839 SET_PointSize(table
, save_PointSize
);
7840 SET_PolygonMode(table
, save_PolygonMode
);
7841 SET_PolygonOffset(table
, save_PolygonOffset
);
7842 SET_PolygonStipple(table
, save_PolygonStipple
);
7843 SET_PopAttrib(table
, save_PopAttrib
);
7844 SET_PopMatrix(table
, save_PopMatrix
);
7845 SET_PopName(table
, save_PopName
);
7846 SET_PushAttrib(table
, save_PushAttrib
);
7847 SET_PushMatrix(table
, save_PushMatrix
);
7848 SET_PushName(table
, save_PushName
);
7849 SET_RasterPos2d(table
, save_RasterPos2d
);
7850 SET_RasterPos2dv(table
, save_RasterPos2dv
);
7851 SET_RasterPos2f(table
, save_RasterPos2f
);
7852 SET_RasterPos2fv(table
, save_RasterPos2fv
);
7853 SET_RasterPos2i(table
, save_RasterPos2i
);
7854 SET_RasterPos2iv(table
, save_RasterPos2iv
);
7855 SET_RasterPos2s(table
, save_RasterPos2s
);
7856 SET_RasterPos2sv(table
, save_RasterPos2sv
);
7857 SET_RasterPos3d(table
, save_RasterPos3d
);
7858 SET_RasterPos3dv(table
, save_RasterPos3dv
);
7859 SET_RasterPos3f(table
, save_RasterPos3f
);
7860 SET_RasterPos3fv(table
, save_RasterPos3fv
);
7861 SET_RasterPos3i(table
, save_RasterPos3i
);
7862 SET_RasterPos3iv(table
, save_RasterPos3iv
);
7863 SET_RasterPos3s(table
, save_RasterPos3s
);
7864 SET_RasterPos3sv(table
, save_RasterPos3sv
);
7865 SET_RasterPos4d(table
, save_RasterPos4d
);
7866 SET_RasterPos4dv(table
, save_RasterPos4dv
);
7867 SET_RasterPos4f(table
, save_RasterPos4f
);
7868 SET_RasterPos4fv(table
, save_RasterPos4fv
);
7869 SET_RasterPos4i(table
, save_RasterPos4i
);
7870 SET_RasterPos4iv(table
, save_RasterPos4iv
);
7871 SET_RasterPos4s(table
, save_RasterPos4s
);
7872 SET_RasterPos4sv(table
, save_RasterPos4sv
);
7873 SET_ReadBuffer(table
, save_ReadBuffer
);
7874 SET_ReadPixels(table
, exec_ReadPixels
);
7875 SET_RenderMode(table
, exec_RenderMode
);
7876 SET_Rotated(table
, save_Rotated
);
7877 SET_Rotatef(table
, save_Rotatef
);
7878 SET_Scaled(table
, save_Scaled
);
7879 SET_Scalef(table
, save_Scalef
);
7880 SET_Scissor(table
, save_Scissor
);
7881 SET_FeedbackBuffer(table
, exec_FeedbackBuffer
);
7882 SET_SelectBuffer(table
, exec_SelectBuffer
);
7883 SET_ShadeModel(table
, save_ShadeModel
);
7884 SET_StencilFunc(table
, save_StencilFunc
);
7885 SET_StencilMask(table
, save_StencilMask
);
7886 SET_StencilOp(table
, save_StencilOp
);
7887 SET_TexEnvf(table
, save_TexEnvf
);
7888 SET_TexEnvfv(table
, save_TexEnvfv
);
7889 SET_TexEnvi(table
, save_TexEnvi
);
7890 SET_TexEnviv(table
, save_TexEnviv
);
7891 SET_TexGend(table
, save_TexGend
);
7892 SET_TexGendv(table
, save_TexGendv
);
7893 SET_TexGenf(table
, save_TexGenf
);
7894 SET_TexGenfv(table
, save_TexGenfv
);
7895 SET_TexGeni(table
, save_TexGeni
);
7896 SET_TexGeniv(table
, save_TexGeniv
);
7897 SET_TexImage1D(table
, save_TexImage1D
);
7898 SET_TexImage2D(table
, save_TexImage2D
);
7899 SET_TexParameterf(table
, save_TexParameterf
);
7900 SET_TexParameterfv(table
, save_TexParameterfv
);
7901 SET_TexParameteri(table
, save_TexParameteri
);
7902 SET_TexParameteriv(table
, save_TexParameteriv
);
7903 SET_Translated(table
, save_Translated
);
7904 SET_Translatef(table
, save_Translatef
);
7905 SET_Viewport(table
, save_Viewport
);
7908 SET_AreTexturesResident(table
, exec_AreTexturesResident
);
7909 SET_BindTexture(table
, save_BindTexture
);
7910 SET_ColorPointer(table
, exec_ColorPointer
);
7911 SET_CopyTexImage1D(table
, save_CopyTexImage1D
);
7912 SET_CopyTexImage2D(table
, save_CopyTexImage2D
);
7913 SET_CopyTexSubImage1D(table
, save_CopyTexSubImage1D
);
7914 SET_CopyTexSubImage2D(table
, save_CopyTexSubImage2D
);
7915 SET_DeleteTextures(table
, exec_DeleteTextures
);
7916 SET_DisableClientState(table
, exec_DisableClientState
);
7917 SET_EdgeFlagPointer(table
, exec_EdgeFlagPointer
);
7918 SET_EnableClientState(table
, exec_EnableClientState
);
7919 SET_GenTextures(table
, exec_GenTextures
);
7920 SET_GetPointerv(table
, exec_GetPointerv
);
7921 SET_IndexPointer(table
, exec_IndexPointer
);
7922 SET_InterleavedArrays(table
, exec_InterleavedArrays
);
7923 SET_IsTexture(table
, exec_IsTexture
);
7924 SET_NormalPointer(table
, exec_NormalPointer
);
7925 SET_PopClientAttrib(table
, exec_PopClientAttrib
);
7926 SET_PrioritizeTextures(table
, save_PrioritizeTextures
);
7927 SET_PushClientAttrib(table
, exec_PushClientAttrib
);
7928 SET_TexCoordPointer(table
, exec_TexCoordPointer
);
7929 SET_TexSubImage1D(table
, save_TexSubImage1D
);
7930 SET_TexSubImage2D(table
, save_TexSubImage2D
);
7931 SET_VertexPointer(table
, exec_VertexPointer
);
7934 SET_CopyTexSubImage3D(table
, save_CopyTexSubImage3D
);
7935 SET_TexImage3D(table
, save_TexImage3D
);
7936 SET_TexSubImage3D(table
, save_TexSubImage3D
);
7939 SET_StencilFuncSeparate(table
, save_StencilFuncSeparate
);
7940 SET_StencilMaskSeparate(table
, save_StencilMaskSeparate
);
7941 SET_StencilOpSeparate(table
, save_StencilOpSeparate
);
7943 /* ATI_separate_stencil */
7944 SET_StencilFuncSeparateATI(table
, save_StencilFuncSeparateATI
);
7946 /* GL_ARB_imaging */
7947 /* Not all are supported */
7948 SET_BlendColor(table
, save_BlendColor
);
7949 SET_BlendEquation(table
, save_BlendEquation
);
7950 SET_ColorSubTable(table
, save_ColorSubTable
);
7951 SET_ColorTable(table
, save_ColorTable
);
7952 SET_ColorTableParameterfv(table
, save_ColorTableParameterfv
);
7953 SET_ColorTableParameteriv(table
, save_ColorTableParameteriv
);
7954 SET_ConvolutionFilter1D(table
, save_ConvolutionFilter1D
);
7955 SET_ConvolutionFilter2D(table
, save_ConvolutionFilter2D
);
7956 SET_ConvolutionParameterf(table
, save_ConvolutionParameterf
);
7957 SET_ConvolutionParameterfv(table
, save_ConvolutionParameterfv
);
7958 SET_ConvolutionParameteri(table
, save_ConvolutionParameteri
);
7959 SET_ConvolutionParameteriv(table
, save_ConvolutionParameteriv
);
7960 SET_CopyColorSubTable(table
, save_CopyColorSubTable
);
7961 SET_CopyColorTable(table
, save_CopyColorTable
);
7962 SET_CopyConvolutionFilter1D(table
, exec_CopyConvolutionFilter1D
);
7963 SET_CopyConvolutionFilter2D(table
, exec_CopyConvolutionFilter2D
);
7964 SET_GetColorTable(table
, exec_GetColorTable
);
7965 SET_GetColorTableParameterfv(table
, exec_GetColorTableParameterfv
);
7966 SET_GetColorTableParameteriv(table
, exec_GetColorTableParameteriv
);
7967 SET_GetConvolutionFilter(table
, exec_GetConvolutionFilter
);
7968 SET_GetConvolutionParameterfv(table
, exec_GetConvolutionParameterfv
);
7969 SET_GetConvolutionParameteriv(table
, exec_GetConvolutionParameteriv
);
7970 SET_GetHistogram(table
, exec_GetHistogram
);
7971 SET_GetHistogramParameterfv(table
, exec_GetHistogramParameterfv
);
7972 SET_GetHistogramParameteriv(table
, exec_GetHistogramParameteriv
);
7973 SET_GetMinmax(table
, exec_GetMinmax
);
7974 SET_GetMinmaxParameterfv(table
, exec_GetMinmaxParameterfv
);
7975 SET_GetMinmaxParameteriv(table
, exec_GetMinmaxParameteriv
);
7976 SET_GetSeparableFilter(table
, exec_GetSeparableFilter
);
7977 SET_Histogram(table
, save_Histogram
);
7978 SET_Minmax(table
, save_Minmax
);
7979 SET_ResetHistogram(table
, save_ResetHistogram
);
7980 SET_ResetMinmax(table
, save_ResetMinmax
);
7981 SET_SeparableFilter2D(table
, exec_SeparableFilter2D
);
7983 /* 2. GL_EXT_blend_color */
7985 SET_BlendColorEXT(table
, save_BlendColorEXT
);
7988 /* 3. GL_EXT_polygon_offset */
7989 SET_PolygonOffsetEXT(table
, save_PolygonOffsetEXT
);
7991 /* 6. GL_EXT_texture3d */
7993 SET_CopyTexSubImage3DEXT(table
, save_CopyTexSubImage3D
);
7994 SET_TexImage3DEXT(table
, save_TexImage3DEXT
);
7995 SET_TexSubImage3DEXT(table
, save_TexSubImage3D
);
7998 /* 14. GL_SGI_color_table */
8000 SET_ColorTableSGI(table
, save_ColorTable
);
8001 SET_ColorSubTableSGI(table
, save_ColorSubTable
);
8002 SET_GetColorTableSGI(table
, exec_GetColorTable
);
8003 SET_GetColorTableParameterfvSGI(table
, exec_GetColorTableParameterfv
);
8004 SET_GetColorTableParameterivSGI(table
, exec_GetColorTableParameteriv
);
8007 /* 30. GL_EXT_vertex_array */
8008 SET_ColorPointerEXT(table
, exec_ColorPointerEXT
);
8009 SET_EdgeFlagPointerEXT(table
, exec_EdgeFlagPointerEXT
);
8010 SET_IndexPointerEXT(table
, exec_IndexPointerEXT
);
8011 SET_NormalPointerEXT(table
, exec_NormalPointerEXT
);
8012 SET_TexCoordPointerEXT(table
, exec_TexCoordPointerEXT
);
8013 SET_VertexPointerEXT(table
, exec_VertexPointerEXT
);
8015 /* 37. GL_EXT_blend_minmax */
8017 SET_BlendEquationEXT(table
, save_BlendEquationEXT
);
8020 /* 54. GL_EXT_point_parameters */
8021 SET_PointParameterfEXT(table
, save_PointParameterfEXT
);
8022 SET_PointParameterfvEXT(table
, save_PointParameterfvEXT
);
8024 /* 97. GL_EXT_compiled_vertex_array */
8025 SET_LockArraysEXT(table
, exec_LockArraysEXT
);
8026 SET_UnlockArraysEXT(table
, exec_UnlockArraysEXT
);
8028 /* 145. GL_EXT_secondary_color */
8029 SET_SecondaryColorPointerEXT(table
, exec_SecondaryColorPointerEXT
);
8031 /* 148. GL_EXT_multi_draw_arrays */
8032 SET_MultiDrawArraysEXT(table
, exec_MultiDrawArraysEXT
);
8033 SET_MultiDrawElementsEXT(table
, exec_MultiDrawElementsEXT
);
8035 /* 149. GL_EXT_fog_coord */
8036 SET_FogCoordPointerEXT(table
, exec_FogCoordPointerEXT
);
8038 /* 173. GL_EXT_blend_func_separate */
8039 SET_BlendFuncSeparateEXT(table
, save_BlendFuncSeparateEXT
);
8041 /* 196. GL_MESA_resize_buffers */
8042 SET_ResizeBuffersMESA(table
, _mesa_ResizeBuffersMESA
);
8044 /* 197. GL_MESA_window_pos */
8045 SET_WindowPos2dMESA(table
, save_WindowPos2dMESA
);
8046 SET_WindowPos2dvMESA(table
, save_WindowPos2dvMESA
);
8047 SET_WindowPos2fMESA(table
, save_WindowPos2fMESA
);
8048 SET_WindowPos2fvMESA(table
, save_WindowPos2fvMESA
);
8049 SET_WindowPos2iMESA(table
, save_WindowPos2iMESA
);
8050 SET_WindowPos2ivMESA(table
, save_WindowPos2ivMESA
);
8051 SET_WindowPos2sMESA(table
, save_WindowPos2sMESA
);
8052 SET_WindowPos2svMESA(table
, save_WindowPos2svMESA
);
8053 SET_WindowPos3dMESA(table
, save_WindowPos3dMESA
);
8054 SET_WindowPos3dvMESA(table
, save_WindowPos3dvMESA
);
8055 SET_WindowPos3fMESA(table
, save_WindowPos3fMESA
);
8056 SET_WindowPos3fvMESA(table
, save_WindowPos3fvMESA
);
8057 SET_WindowPos3iMESA(table
, save_WindowPos3iMESA
);
8058 SET_WindowPos3ivMESA(table
, save_WindowPos3ivMESA
);
8059 SET_WindowPos3sMESA(table
, save_WindowPos3sMESA
);
8060 SET_WindowPos3svMESA(table
, save_WindowPos3svMESA
);
8061 SET_WindowPos4dMESA(table
, save_WindowPos4dMESA
);
8062 SET_WindowPos4dvMESA(table
, save_WindowPos4dvMESA
);
8063 SET_WindowPos4fMESA(table
, save_WindowPos4fMESA
);
8064 SET_WindowPos4fvMESA(table
, save_WindowPos4fvMESA
);
8065 SET_WindowPos4iMESA(table
, save_WindowPos4iMESA
);
8066 SET_WindowPos4ivMESA(table
, save_WindowPos4ivMESA
);
8067 SET_WindowPos4sMESA(table
, save_WindowPos4sMESA
);
8068 SET_WindowPos4svMESA(table
, save_WindowPos4svMESA
);
8070 /* 200. GL_IBM_multimode_draw_arrays */
8071 SET_MultiModeDrawArraysIBM(table
, exec_MultiModeDrawArraysIBM
);
8072 SET_MultiModeDrawElementsIBM(table
, exec_MultiModeDrawElementsIBM
);
8074 #if FEATURE_NV_vertex_program
8075 /* 233. GL_NV_vertex_program */
8076 /* The following commands DO NOT go into display lists:
8077 * AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV,
8078 * VertexAttribPointerNV, GetProgram*, GetVertexAttrib*
8080 SET_BindProgramNV(table
, save_BindProgramNV
);
8081 SET_DeleteProgramsNV(table
, _mesa_DeletePrograms
);
8082 SET_ExecuteProgramNV(table
, save_ExecuteProgramNV
);
8083 SET_GenProgramsNV(table
, _mesa_GenPrograms
);
8084 SET_AreProgramsResidentNV(table
, _mesa_AreProgramsResidentNV
);
8085 SET_RequestResidentProgramsNV(table
, save_RequestResidentProgramsNV
);
8086 SET_GetProgramParameterfvNV(table
, _mesa_GetProgramParameterfvNV
);
8087 SET_GetProgramParameterdvNV(table
, _mesa_GetProgramParameterdvNV
);
8088 SET_GetProgramivNV(table
, _mesa_GetProgramivNV
);
8089 SET_GetProgramStringNV(table
, _mesa_GetProgramStringNV
);
8090 SET_GetTrackMatrixivNV(table
, _mesa_GetTrackMatrixivNV
);
8091 SET_GetVertexAttribdvNV(table
, _mesa_GetVertexAttribdvNV
);
8092 SET_GetVertexAttribfvNV(table
, _mesa_GetVertexAttribfvNV
);
8093 SET_GetVertexAttribivNV(table
, _mesa_GetVertexAttribivNV
);
8094 SET_GetVertexAttribPointervNV(table
, _mesa_GetVertexAttribPointervNV
);
8095 SET_IsProgramNV(table
, _mesa_IsProgramARB
);
8096 SET_LoadProgramNV(table
, save_LoadProgramNV
);
8097 SET_ProgramEnvParameter4dARB(table
, save_ProgramEnvParameter4dARB
);
8098 SET_ProgramEnvParameter4dvARB(table
, save_ProgramEnvParameter4dvARB
);
8099 SET_ProgramEnvParameter4fARB(table
, save_ProgramEnvParameter4fARB
);
8100 SET_ProgramEnvParameter4fvARB(table
, save_ProgramEnvParameter4fvARB
);
8101 SET_ProgramParameters4dvNV(table
, save_ProgramParameters4dvNV
);
8102 SET_ProgramParameters4fvNV(table
, save_ProgramParameters4fvNV
);
8103 SET_TrackMatrixNV(table
, save_TrackMatrixNV
);
8104 SET_VertexAttribPointerNV(table
, _mesa_VertexAttribPointerNV
);
8107 /* 244. GL_ATI_envmap_bumpmap */
8108 SET_TexBumpParameterivATI(table
, save_TexBumpParameterivATI
);
8109 SET_TexBumpParameterfvATI(table
, save_TexBumpParameterfvATI
);
8111 /* 245. GL_ATI_fragment_shader */
8112 #if FEATURE_ATI_fragment_shader
8113 SET_BindFragmentShaderATI(table
, save_BindFragmentShaderATI
);
8114 SET_SetFragmentShaderConstantATI(table
, save_SetFragmentShaderConstantATI
);
8117 /* 282. GL_NV_fragment_program */
8118 #if FEATURE_NV_fragment_program
8119 SET_ProgramNamedParameter4fNV(table
, save_ProgramNamedParameter4fNV
);
8120 SET_ProgramNamedParameter4dNV(table
, save_ProgramNamedParameter4dNV
);
8121 SET_ProgramNamedParameter4fvNV(table
, save_ProgramNamedParameter4fvNV
);
8122 SET_ProgramNamedParameter4dvNV(table
, save_ProgramNamedParameter4dvNV
);
8123 SET_GetProgramNamedParameterfvNV(table
,
8124 _mesa_GetProgramNamedParameterfvNV
);
8125 SET_GetProgramNamedParameterdvNV(table
,
8126 _mesa_GetProgramNamedParameterdvNV
);
8127 SET_ProgramLocalParameter4dARB(table
, save_ProgramLocalParameter4dARB
);
8128 SET_ProgramLocalParameter4dvARB(table
, save_ProgramLocalParameter4dvARB
);
8129 SET_ProgramLocalParameter4fARB(table
, save_ProgramLocalParameter4fARB
);
8130 SET_ProgramLocalParameter4fvARB(table
, save_ProgramLocalParameter4fvARB
);
8131 SET_GetProgramLocalParameterdvARB(table
,
8132 _mesa_GetProgramLocalParameterdvARB
);
8133 SET_GetProgramLocalParameterfvARB(table
,
8134 _mesa_GetProgramLocalParameterfvARB
);
8137 /* 262. GL_NV_point_sprite */
8138 SET_PointParameteriNV(table
, save_PointParameteriNV
);
8139 SET_PointParameterivNV(table
, save_PointParameterivNV
);
8141 /* 268. GL_EXT_stencil_two_side */
8142 SET_ActiveStencilFaceEXT(table
, save_ActiveStencilFaceEXT
);
8144 /* 273. GL_APPLE_vertex_array_object */
8145 SET_BindVertexArrayAPPLE(table
, _mesa_BindVertexArrayAPPLE
);
8146 SET_DeleteVertexArraysAPPLE(table
, _mesa_DeleteVertexArraysAPPLE
);
8147 SET_GenVertexArraysAPPLE(table
, _mesa_GenVertexArraysAPPLE
);
8148 SET_IsVertexArrayAPPLE(table
, _mesa_IsVertexArrayAPPLE
);
8150 /* ???. GL_EXT_depth_bounds_test */
8151 SET_DepthBoundsEXT(table
, save_DepthBoundsEXT
);
8153 /* ARB 1. GL_ARB_multitexture */
8154 SET_ActiveTextureARB(table
, save_ActiveTextureARB
);
8155 SET_ClientActiveTextureARB(table
, exec_ClientActiveTextureARB
);
8157 /* ARB 3. GL_ARB_transpose_matrix */
8158 SET_LoadTransposeMatrixdARB(table
, save_LoadTransposeMatrixdARB
);
8159 SET_LoadTransposeMatrixfARB(table
, save_LoadTransposeMatrixfARB
);
8160 SET_MultTransposeMatrixdARB(table
, save_MultTransposeMatrixdARB
);
8161 SET_MultTransposeMatrixfARB(table
, save_MultTransposeMatrixfARB
);
8163 /* ARB 5. GL_ARB_multisample */
8164 SET_SampleCoverageARB(table
, save_SampleCoverageARB
);
8166 /* ARB 12. GL_ARB_texture_compression */
8167 SET_CompressedTexImage3DARB(table
, save_CompressedTexImage3DARB
);
8168 SET_CompressedTexImage2DARB(table
, save_CompressedTexImage2DARB
);
8169 SET_CompressedTexImage1DARB(table
, save_CompressedTexImage1DARB
);
8170 SET_CompressedTexSubImage3DARB(table
, save_CompressedTexSubImage3DARB
);
8171 SET_CompressedTexSubImage2DARB(table
, save_CompressedTexSubImage2DARB
);
8172 SET_CompressedTexSubImage1DARB(table
, save_CompressedTexSubImage1DARB
);
8173 SET_GetCompressedTexImageARB(table
, exec_GetCompressedTexImageARB
);
8175 /* ARB 14. GL_ARB_point_parameters */
8176 /* aliased with EXT_point_parameters functions */
8178 /* ARB 25. GL_ARB_window_pos */
8179 /* aliased with MESA_window_pos functions */
8181 /* ARB 26. GL_ARB_vertex_program */
8182 /* ARB 27. GL_ARB_fragment_program */
8183 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
8184 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
8185 SET_VertexAttribPointerARB(table
, _mesa_VertexAttribPointerARB
);
8186 SET_EnableVertexAttribArrayARB(table
, _mesa_EnableVertexAttribArrayARB
);
8187 SET_DisableVertexAttribArrayARB(table
, _mesa_DisableVertexAttribArrayARB
);
8188 SET_ProgramStringARB(table
, save_ProgramStringARB
);
8189 SET_BindProgramNV(table
, save_BindProgramNV
);
8190 SET_DeleteProgramsNV(table
, _mesa_DeletePrograms
);
8191 SET_GenProgramsNV(table
, _mesa_GenPrograms
);
8192 SET_IsProgramNV(table
, _mesa_IsProgramARB
);
8193 SET_GetVertexAttribdvNV(table
, _mesa_GetVertexAttribdvNV
);
8194 SET_GetVertexAttribfvNV(table
, _mesa_GetVertexAttribfvNV
);
8195 SET_GetVertexAttribivNV(table
, _mesa_GetVertexAttribivNV
);
8196 SET_GetVertexAttribPointervNV(table
, _mesa_GetVertexAttribPointervNV
);
8197 SET_ProgramEnvParameter4dARB(table
, save_ProgramEnvParameter4dARB
);
8198 SET_ProgramEnvParameter4dvARB(table
, save_ProgramEnvParameter4dvARB
);
8199 SET_ProgramEnvParameter4fARB(table
, save_ProgramEnvParameter4fARB
);
8200 SET_ProgramEnvParameter4fvARB(table
, save_ProgramEnvParameter4fvARB
);
8201 SET_ProgramLocalParameter4dARB(table
, save_ProgramLocalParameter4dARB
);
8202 SET_ProgramLocalParameter4dvARB(table
, save_ProgramLocalParameter4dvARB
);
8203 SET_ProgramLocalParameter4fARB(table
, save_ProgramLocalParameter4fARB
);
8204 SET_ProgramLocalParameter4fvARB(table
, save_ProgramLocalParameter4fvARB
);
8205 SET_GetProgramEnvParameterdvARB(table
, _mesa_GetProgramEnvParameterdvARB
);
8206 SET_GetProgramEnvParameterfvARB(table
, _mesa_GetProgramEnvParameterfvARB
);
8207 SET_GetProgramLocalParameterdvARB(table
,
8208 _mesa_GetProgramLocalParameterdvARB
);
8209 SET_GetProgramLocalParameterfvARB(table
,
8210 _mesa_GetProgramLocalParameterfvARB
);
8211 SET_GetProgramivARB(table
, _mesa_GetProgramivARB
);
8212 SET_GetProgramStringARB(table
, _mesa_GetProgramStringARB
);
8215 /* ARB 28. GL_ARB_vertex_buffer_object */
8216 #if FEATURE_ARB_vertex_buffer_object
8217 /* None of the extension's functions get compiled */
8218 SET_BindBufferARB(table
, _mesa_BindBufferARB
);
8219 SET_BufferDataARB(table
, _mesa_BufferDataARB
);
8220 SET_BufferSubDataARB(table
, _mesa_BufferSubDataARB
);
8221 SET_DeleteBuffersARB(table
, _mesa_DeleteBuffersARB
);
8222 SET_GenBuffersARB(table
, _mesa_GenBuffersARB
);
8223 SET_GetBufferParameterivARB(table
, _mesa_GetBufferParameterivARB
);
8224 SET_GetBufferPointervARB(table
, _mesa_GetBufferPointervARB
);
8225 SET_GetBufferSubDataARB(table
, _mesa_GetBufferSubDataARB
);
8226 SET_IsBufferARB(table
, _mesa_IsBufferARB
);
8227 SET_MapBufferARB(table
, _mesa_MapBufferARB
);
8228 SET_UnmapBufferARB(table
, _mesa_UnmapBufferARB
);
8231 #if FEATURE_ARB_occlusion_query
8232 SET_BeginQueryARB(table
, save_BeginQueryARB
);
8233 SET_EndQueryARB(table
, save_EndQueryARB
);
8234 SET_GenQueriesARB(table
, _mesa_GenQueriesARB
);
8235 SET_DeleteQueriesARB(table
, _mesa_DeleteQueriesARB
);
8236 SET_IsQueryARB(table
, _mesa_IsQueryARB
);
8237 SET_GetQueryivARB(table
, _mesa_GetQueryivARB
);
8238 SET_GetQueryObjectivARB(table
, _mesa_GetQueryObjectivARB
);
8239 SET_GetQueryObjectuivARB(table
, _mesa_GetQueryObjectuivARB
);
8241 SET_DrawBuffersARB(table
, save_DrawBuffersARB
);
8243 #if FEATURE_EXT_framebuffer_blit
8244 SET_BlitFramebufferEXT(table
, save_BlitFramebufferEXT
);
8247 /* ARB 30/31/32. GL_ARB_shader_objects, GL_ARB_vertex/fragment_shader */
8248 SET_BindAttribLocationARB(table
, exec_BindAttribLocationARB
);
8249 SET_GetAttribLocationARB(table
, exec_GetAttribLocationARB
);
8250 /* XXX additional functions need to be implemented here! */
8252 /* 299. GL_EXT_blend_equation_separate */
8253 SET_BlendEquationSeparateEXT(table
, save_BlendEquationSeparateEXT
);
8255 /* GL_EXT_gpu_program_parmaeters */
8256 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
8257 SET_ProgramEnvParameters4fvEXT(table
, save_ProgramEnvParameters4fvEXT
);
8258 SET_ProgramLocalParameters4fvEXT(table
, save_ProgramLocalParameters4fvEXT
);
8265 enum_string(GLenum k
)
8267 return _mesa_lookup_enum_by_nr(k
);
8272 * Print the commands in a display list. For debugging only.
8273 * TODO: many commands aren't handled yet.
8275 static void GLAPIENTRY
8276 print_list(GLcontext
*ctx
, GLuint list
)
8278 struct gl_display_list
*dlist
;
8282 if (!islist(ctx
, list
)) {
8283 _mesa_printf("%u is not a display list ID\n", list
);
8287 dlist
= lookup_list(ctx
, list
);
8293 _mesa_printf("START-LIST %u, address %p\n", list
, (void *) n
);
8295 done
= n
? GL_FALSE
: GL_TRUE
;
8297 OpCode opcode
= n
[0].opcode
;
8298 GLint i
= (GLint
) n
[0].opcode
- (GLint
) OPCODE_EXT_0
;
8300 if (i
>= 0 && i
< (GLint
) ctx
->ListExt
.NumOpcodes
) {
8301 /* this is a driver-extended opcode */
8302 ctx
->ListExt
.Opcode
[i
].Print(ctx
, &n
[1]);
8303 n
+= ctx
->ListExt
.Opcode
[i
].Size
;
8308 _mesa_printf("Accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
8311 _mesa_printf("Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
8312 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
, (void *) n
[7].data
);
8314 case OPCODE_CALL_LIST
:
8315 _mesa_printf("CallList %d\n", (int) n
[1].ui
);
8317 case OPCODE_CALL_LIST_OFFSET
:
8318 _mesa_printf("CallList %d + offset %u = %u\n", (int) n
[1].ui
,
8319 ctx
->List
.ListBase
, ctx
->List
.ListBase
+ n
[1].ui
);
8321 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
8322 _mesa_printf("ColorTableParameterfv %s %s %f %f %f %f\n",
8323 enum_string(n
[1].e
), enum_string(n
[2].e
),
8324 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8326 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
8327 _mesa_printf("ColorTableParameteriv %s %s %d %d %d %d\n",
8328 enum_string(n
[1].e
), enum_string(n
[2].e
),
8329 n
[3].i
, n
[4].i
, n
[5].i
, n
[6].i
);
8331 case OPCODE_DISABLE
:
8332 _mesa_printf("Disable %s\n", enum_string(n
[1].e
));
8335 _mesa_printf("Enable %s\n", enum_string(n
[1].e
));
8337 case OPCODE_FRUSTUM
:
8338 _mesa_printf("Frustum %g %g %g %g %g %g\n",
8339 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8341 case OPCODE_LINE_STIPPLE
:
8342 _mesa_printf("LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
8344 case OPCODE_LOAD_IDENTITY
:
8345 _mesa_printf("LoadIdentity\n");
8347 case OPCODE_LOAD_MATRIX
:
8348 _mesa_printf("LoadMatrix\n");
8349 _mesa_printf(" %8f %8f %8f %8f\n",
8350 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
8351 _mesa_printf(" %8f %8f %8f %8f\n",
8352 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
8353 _mesa_printf(" %8f %8f %8f %8f\n",
8354 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
8355 _mesa_printf(" %8f %8f %8f %8f\n",
8356 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
8358 case OPCODE_MULT_MATRIX
:
8359 _mesa_printf("MultMatrix (or Rotate)\n");
8360 _mesa_printf(" %8f %8f %8f %8f\n",
8361 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
8362 _mesa_printf(" %8f %8f %8f %8f\n",
8363 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
8364 _mesa_printf(" %8f %8f %8f %8f\n",
8365 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
8366 _mesa_printf(" %8f %8f %8f %8f\n",
8367 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
8370 _mesa_printf("Ortho %g %g %g %g %g %g\n",
8371 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8373 case OPCODE_POP_ATTRIB
:
8374 _mesa_printf("PopAttrib\n");
8376 case OPCODE_POP_MATRIX
:
8377 _mesa_printf("PopMatrix\n");
8379 case OPCODE_POP_NAME
:
8380 _mesa_printf("PopName\n");
8382 case OPCODE_PUSH_ATTRIB
:
8383 _mesa_printf("PushAttrib %x\n", n
[1].bf
);
8385 case OPCODE_PUSH_MATRIX
:
8386 _mesa_printf("PushMatrix\n");
8388 case OPCODE_PUSH_NAME
:
8389 _mesa_printf("PushName %d\n", (int) n
[1].ui
);
8391 case OPCODE_RASTER_POS
:
8392 _mesa_printf("RasterPos %g %g %g %g\n",
8393 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
8396 _mesa_printf("Rotate %g %g %g %g\n",
8397 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
8400 _mesa_printf("Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
8402 case OPCODE_TRANSLATE
:
8403 _mesa_printf("Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
8405 case OPCODE_BIND_TEXTURE
:
8406 _mesa_printf("BindTexture %s %d\n",
8407 _mesa_lookup_enum_by_nr(n
[1].ui
), n
[2].ui
);
8409 case OPCODE_SHADE_MODEL
:
8410 _mesa_printf("ShadeModel %s\n", _mesa_lookup_enum_by_nr(n
[1].ui
));
8413 _mesa_printf("Map1 %s %.3f %.3f %d %d\n",
8414 _mesa_lookup_enum_by_nr(n
[1].ui
),
8415 n
[2].f
, n
[3].f
, n
[4].i
, n
[5].i
);
8418 _mesa_printf("Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
8419 _mesa_lookup_enum_by_nr(n
[1].ui
),
8420 n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
,
8421 n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
8423 case OPCODE_MAPGRID1
:
8424 _mesa_printf("MapGrid1 %d %.3f %.3f\n", n
[1].i
, n
[2].f
, n
[3].f
);
8426 case OPCODE_MAPGRID2
:
8427 _mesa_printf("MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
8428 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
8430 case OPCODE_EVALMESH1
:
8431 _mesa_printf("EvalMesh1 %d %d\n", n
[1].i
, n
[2].i
);
8433 case OPCODE_EVALMESH2
:
8434 _mesa_printf("EvalMesh2 %d %d %d %d\n",
8435 n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
8438 case OPCODE_ATTR_1F_NV
:
8439 _mesa_printf("ATTR_1F_NV attr %d: %f\n", n
[1].i
, n
[2].f
);
8441 case OPCODE_ATTR_2F_NV
:
8442 _mesa_printf("ATTR_2F_NV attr %d: %f %f\n",
8443 n
[1].i
, n
[2].f
, n
[3].f
);
8445 case OPCODE_ATTR_3F_NV
:
8446 _mesa_printf("ATTR_3F_NV attr %d: %f %f %f\n",
8447 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
8449 case OPCODE_ATTR_4F_NV
:
8450 _mesa_printf("ATTR_4F_NV attr %d: %f %f %f %f\n",
8451 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
8453 case OPCODE_ATTR_1F_ARB
:
8454 _mesa_printf("ATTR_1F_ARB attr %d: %f\n", n
[1].i
, n
[2].f
);
8456 case OPCODE_ATTR_2F_ARB
:
8457 _mesa_printf("ATTR_2F_ARB attr %d: %f %f\n",
8458 n
[1].i
, n
[2].f
, n
[3].f
);
8460 case OPCODE_ATTR_3F_ARB
:
8461 _mesa_printf("ATTR_3F_ARB attr %d: %f %f %f\n",
8462 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
8464 case OPCODE_ATTR_4F_ARB
:
8465 _mesa_printf("ATTR_4F_ARB attr %d: %f %f %f %f\n",
8466 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
8469 case OPCODE_MATERIAL
:
8470 _mesa_printf("MATERIAL %x %x: %f %f %f %f\n",
8471 n
[1].i
, n
[2].i
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8474 _mesa_printf("BEGIN %x\n", n
[1].i
);
8477 _mesa_printf("END\n");
8480 _mesa_printf("RECTF %f %f %f %f\n", n
[1].f
, n
[2].f
, n
[3].f
,
8483 case OPCODE_EVAL_C1
:
8484 _mesa_printf("EVAL_C1 %f\n", n
[1].f
);
8486 case OPCODE_EVAL_C2
:
8487 _mesa_printf("EVAL_C2 %f %f\n", n
[1].f
, n
[2].f
);
8489 case OPCODE_EVAL_P1
:
8490 _mesa_printf("EVAL_P1 %d\n", n
[1].i
);
8492 case OPCODE_EVAL_P2
:
8493 _mesa_printf("EVAL_P2 %d %d\n", n
[1].i
, n
[2].i
);
8497 * meta opcodes/commands
8500 _mesa_printf("Error: %s %s\n",
8501 enum_string(n
[1].e
), (const char *) n
[2].data
);
8503 case OPCODE_CONTINUE
:
8504 _mesa_printf("DISPLAY-LIST-CONTINUE\n");
8505 n
= (Node
*) n
[1].next
;
8507 case OPCODE_END_OF_LIST
:
8508 _mesa_printf("END-LIST %u\n", list
);
8512 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
8514 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
8515 opcode
, (void *) n
);
8519 _mesa_printf("command %d, %u operands\n", opcode
,
8523 /* increment n to point to next compiled command */
8524 if (opcode
!= OPCODE_CONTINUE
) {
8525 n
+= InstSize
[opcode
];
8534 * Clients may call this function to help debug display list problems.
8535 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
8536 * changed, or break in the future without notice.
8539 mesa_print_display_list(GLuint list
)
8541 GET_CURRENT_CONTEXT(ctx
);
8542 print_list(ctx
, list
);
8546 /**********************************************************************/
8547 /***** Initialization *****/
8548 /**********************************************************************/
8551 _mesa_save_vtxfmt_init(GLvertexformat
* vfmt
)
8553 vfmt
->ArrayElement
= _ae_loopback_array_elt
; /* generic helper */
8554 vfmt
->Begin
= save_Begin
;
8555 vfmt
->CallList
= _mesa_save_CallList
;
8556 vfmt
->CallLists
= _mesa_save_CallLists
;
8557 vfmt
->Color3f
= save_Color3f
;
8558 vfmt
->Color3fv
= save_Color3fv
;
8559 vfmt
->Color4f
= save_Color4f
;
8560 vfmt
->Color4fv
= save_Color4fv
;
8561 vfmt
->EdgeFlag
= save_EdgeFlag
;
8562 vfmt
->End
= save_End
;
8563 vfmt
->EvalCoord1f
= save_EvalCoord1f
;
8564 vfmt
->EvalCoord1fv
= save_EvalCoord1fv
;
8565 vfmt
->EvalCoord2f
= save_EvalCoord2f
;
8566 vfmt
->EvalCoord2fv
= save_EvalCoord2fv
;
8567 vfmt
->EvalPoint1
= save_EvalPoint1
;
8568 vfmt
->EvalPoint2
= save_EvalPoint2
;
8569 vfmt
->FogCoordfEXT
= save_FogCoordfEXT
;
8570 vfmt
->FogCoordfvEXT
= save_FogCoordfvEXT
;
8571 vfmt
->Indexf
= save_Indexf
;
8572 vfmt
->Indexfv
= save_Indexfv
;
8573 vfmt
->Materialfv
= save_Materialfv
;
8574 vfmt
->MultiTexCoord1fARB
= save_MultiTexCoord1f
;
8575 vfmt
->MultiTexCoord1fvARB
= save_MultiTexCoord1fv
;
8576 vfmt
->MultiTexCoord2fARB
= save_MultiTexCoord2f
;
8577 vfmt
->MultiTexCoord2fvARB
= save_MultiTexCoord2fv
;
8578 vfmt
->MultiTexCoord3fARB
= save_MultiTexCoord3f
;
8579 vfmt
->MultiTexCoord3fvARB
= save_MultiTexCoord3fv
;
8580 vfmt
->MultiTexCoord4fARB
= save_MultiTexCoord4f
;
8581 vfmt
->MultiTexCoord4fvARB
= save_MultiTexCoord4fv
;
8582 vfmt
->Normal3f
= save_Normal3f
;
8583 vfmt
->Normal3fv
= save_Normal3fv
;
8584 vfmt
->SecondaryColor3fEXT
= save_SecondaryColor3fEXT
;
8585 vfmt
->SecondaryColor3fvEXT
= save_SecondaryColor3fvEXT
;
8586 vfmt
->TexCoord1f
= save_TexCoord1f
;
8587 vfmt
->TexCoord1fv
= save_TexCoord1fv
;
8588 vfmt
->TexCoord2f
= save_TexCoord2f
;
8589 vfmt
->TexCoord2fv
= save_TexCoord2fv
;
8590 vfmt
->TexCoord3f
= save_TexCoord3f
;
8591 vfmt
->TexCoord3fv
= save_TexCoord3fv
;
8592 vfmt
->TexCoord4f
= save_TexCoord4f
;
8593 vfmt
->TexCoord4fv
= save_TexCoord4fv
;
8594 vfmt
->Vertex2f
= save_Vertex2f
;
8595 vfmt
->Vertex2fv
= save_Vertex2fv
;
8596 vfmt
->Vertex3f
= save_Vertex3f
;
8597 vfmt
->Vertex3fv
= save_Vertex3fv
;
8598 vfmt
->Vertex4f
= save_Vertex4f
;
8599 vfmt
->Vertex4fv
= save_Vertex4fv
;
8600 vfmt
->VertexAttrib1fNV
= save_VertexAttrib1fNV
;
8601 vfmt
->VertexAttrib1fvNV
= save_VertexAttrib1fvNV
;
8602 vfmt
->VertexAttrib2fNV
= save_VertexAttrib2fNV
;
8603 vfmt
->VertexAttrib2fvNV
= save_VertexAttrib2fvNV
;
8604 vfmt
->VertexAttrib3fNV
= save_VertexAttrib3fNV
;
8605 vfmt
->VertexAttrib3fvNV
= save_VertexAttrib3fvNV
;
8606 vfmt
->VertexAttrib4fNV
= save_VertexAttrib4fNV
;
8607 vfmt
->VertexAttrib4fvNV
= save_VertexAttrib4fvNV
;
8608 vfmt
->VertexAttrib1fARB
= save_VertexAttrib1fARB
;
8609 vfmt
->VertexAttrib1fvARB
= save_VertexAttrib1fvARB
;
8610 vfmt
->VertexAttrib2fARB
= save_VertexAttrib2fARB
;
8611 vfmt
->VertexAttrib2fvARB
= save_VertexAttrib2fvARB
;
8612 vfmt
->VertexAttrib3fARB
= save_VertexAttrib3fARB
;
8613 vfmt
->VertexAttrib3fvARB
= save_VertexAttrib3fvARB
;
8614 vfmt
->VertexAttrib4fARB
= save_VertexAttrib4fARB
;
8615 vfmt
->VertexAttrib4fvARB
= save_VertexAttrib4fvARB
;
8617 vfmt
->EvalMesh1
= _mesa_save_EvalMesh1
;
8618 vfmt
->EvalMesh2
= _mesa_save_EvalMesh2
;
8619 vfmt
->Rectf
= save_Rectf
;
8621 /* The driver is required to implement these as
8622 * 1) They can probably do a better job.
8623 * 2) A lot of new mechanisms would have to be added to this module
8624 * to support it. That code would probably never get used,
8628 vfmt
->DrawArrays
= 0;
8629 vfmt
->DrawElements
= 0;
8630 vfmt
->DrawRangeElements
= 0;
8636 * Initialize display list state for given context.
8639 _mesa_init_display_list(GLcontext
*ctx
)
8641 static GLboolean tableInitialized
= GL_FALSE
;
8643 /* zero-out the instruction size table, just once */
8644 if (!tableInitialized
) {
8645 _mesa_bzero(InstSize
, sizeof(InstSize
));
8646 tableInitialized
= GL_TRUE
;
8650 ctx
->ListState
.CallDepth
= 0;
8651 ctx
->ExecuteFlag
= GL_TRUE
;
8652 ctx
->CompileFlag
= GL_FALSE
;
8653 ctx
->ListState
.CurrentBlock
= NULL
;
8654 ctx
->ListState
.CurrentPos
= 0;
8656 /* Display List group */
8657 ctx
->List
.ListBase
= 0;
8659 _mesa_save_vtxfmt_init(&ctx
->ListState
.ListVtxfmt
);