2 * Mesa 3-D graphics library
5 * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 * Display lists management functions.
33 #include "api_arrayelt.h"
34 #include "api_loopback.h"
39 #if FEATURE_ARB_vertex_buffer_object
40 #include "bufferobj.h"
53 #include "extensions.h"
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"
89 #include "math/m_xform.h"
91 #include "glapi/dispatch.h"
97 * \param ctx GL context.
99 * Checks if dd_function_table::SaveNeedFlush is marked to flush
100 * stored (save) vertices, and calls
101 * dd_function_table::SaveFlushVertices if so.
103 #define SAVE_FLUSH_VERTICES(ctx) \
105 if (ctx->Driver.SaveNeedFlush) \
106 ctx->Driver.SaveFlushVertices(ctx); \
111 * Macro to assert that the API call was made outside the
112 * glBegin()/glEnd() pair, with return value.
114 * \param ctx GL context.
115 * \param retval value to return value in case the assertion fails.
117 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval) \
119 if (ctx->Driver.CurrentSavePrimitive <= GL_POLYGON || \
120 ctx->Driver.CurrentSavePrimitive == PRIM_INSIDE_UNKNOWN_PRIM) { \
121 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \
127 * Macro to assert that the API call was made outside the
128 * glBegin()/glEnd() pair.
130 * \param ctx GL context.
132 #define ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx) \
134 if (ctx->Driver.CurrentSavePrimitive <= GL_POLYGON || \
135 ctx->Driver.CurrentSavePrimitive == PRIM_INSIDE_UNKNOWN_PRIM) { \
136 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \
142 * Macro to assert that the API call was made outside the
143 * glBegin()/glEnd() pair and flush the vertices.
145 * \param ctx GL context.
147 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx) \
149 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx); \
150 SAVE_FLUSH_VERTICES(ctx); \
154 * Macro to assert that the API call was made outside the
155 * glBegin()/glEnd() pair and flush the vertices, with return value.
157 * \param ctx GL context.
158 * \param retval value to return value in case the assertion fails.
160 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval)\
162 ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval); \
163 SAVE_FLUSH_VERTICES(ctx); \
169 * Display list opcodes.
171 * The fact that these identifiers are assigned consecutive
172 * integer values starting at 0 is very important, see InstSize array usage)
176 OPCODE_INVALID
= -1, /* Force signed enum */
182 OPCODE_BLEND_EQUATION
,
183 OPCODE_BLEND_EQUATION_SEPARATE
,
184 OPCODE_BLEND_FUNC_SEPARATE
,
186 OPCODE_CALL_LIST_OFFSET
,
192 OPCODE_CLEAR_STENCIL
,
195 OPCODE_COLOR_MATERIAL
,
197 OPCODE_COLOR_TABLE_PARAMETER_FV
,
198 OPCODE_COLOR_TABLE_PARAMETER_IV
,
199 OPCODE_COLOR_SUB_TABLE
,
200 OPCODE_CONVOLUTION_FILTER_1D
,
201 OPCODE_CONVOLUTION_FILTER_2D
,
202 OPCODE_CONVOLUTION_PARAMETER_I
,
203 OPCODE_CONVOLUTION_PARAMETER_IV
,
204 OPCODE_CONVOLUTION_PARAMETER_F
,
205 OPCODE_CONVOLUTION_PARAMETER_FV
,
206 OPCODE_COPY_COLOR_SUB_TABLE
,
207 OPCODE_COPY_COLOR_TABLE
,
209 OPCODE_COPY_TEX_IMAGE1D
,
210 OPCODE_COPY_TEX_IMAGE2D
,
211 OPCODE_COPY_TEX_SUB_IMAGE1D
,
212 OPCODE_COPY_TEX_SUB_IMAGE2D
,
213 OPCODE_COPY_TEX_SUB_IMAGE3D
,
236 OPCODE_LOAD_IDENTITY
,
250 OPCODE_PIXEL_TRANSFER
,
253 OPCODE_POINT_PARAMETERS
,
255 OPCODE_POLYGON_STIPPLE
,
256 OPCODE_POLYGON_OFFSET
,
260 OPCODE_PRIORITIZE_TEXTURE
,
266 OPCODE_RESET_HISTOGRAM
,
267 OPCODE_RESET_MIN_MAX
,
271 OPCODE_SELECT_TEXTURE_SGIS
,
272 OPCODE_SELECT_TEXTURE_COORD_SET
,
283 OPCODE_TEX_SUB_IMAGE1D
,
284 OPCODE_TEX_SUB_IMAGE2D
,
285 OPCODE_TEX_SUB_IMAGE3D
,
289 /* GL_ARB_multitexture */
290 OPCODE_ACTIVE_TEXTURE
,
291 /* GL_ARB_texture_compression */
292 OPCODE_COMPRESSED_TEX_IMAGE_1D
,
293 OPCODE_COMPRESSED_TEX_IMAGE_2D
,
294 OPCODE_COMPRESSED_TEX_IMAGE_3D
,
295 OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
,
296 OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
,
297 OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
,
298 /* GL_ARB_multisample */
299 OPCODE_SAMPLE_COVERAGE
,
300 /* GL_ARB_window_pos */
301 OPCODE_WINDOW_POS_ARB
,
302 /* GL_NV_vertex_program */
303 OPCODE_BIND_PROGRAM_NV
,
304 OPCODE_EXECUTE_PROGRAM_NV
,
305 OPCODE_REQUEST_RESIDENT_PROGRAMS_NV
,
306 OPCODE_LOAD_PROGRAM_NV
,
307 OPCODE_TRACK_MATRIX_NV
,
308 /* GL_NV_fragment_program */
309 OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
,
310 OPCODE_PROGRAM_NAMED_PARAMETER_NV
,
311 /* GL_EXT_stencil_two_side */
312 OPCODE_ACTIVE_STENCIL_FACE_EXT
,
313 /* GL_EXT_depth_bounds_test */
314 OPCODE_DEPTH_BOUNDS_EXT
,
315 /* GL_ARB_vertex/fragment_program */
316 OPCODE_PROGRAM_STRING_ARB
,
317 OPCODE_PROGRAM_ENV_PARAMETER_ARB
,
318 /* GL_ARB_occlusion_query */
319 OPCODE_BEGIN_QUERY_ARB
,
320 OPCODE_END_QUERY_ARB
,
321 /* GL_ARB_draw_buffers */
322 OPCODE_DRAW_BUFFERS_ARB
,
323 /* GL_ATI_fragment_shader */
324 OPCODE_BIND_FRAGMENT_SHADER_ATI
,
325 OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
,
327 OPCODE_STENCIL_FUNC_SEPARATE
,
328 OPCODE_STENCIL_OP_SEPARATE
,
329 OPCODE_STENCIL_MASK_SEPARATE
,
331 /* GL_EXT_framebuffer_blit */
332 OPCODE_BLIT_FRAMEBUFFER
,
334 /* Vertex attributes -- fallback for when optimized display
335 * list build isn't active.
354 /* The following three are meta instructions */
355 OPCODE_ERROR
, /* raise compiled-in error */
366 * Display list instructions are stored as sequences of "nodes". Nodes
367 * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
368 * are linked together with a pointer.
370 * Each instruction in the display list is stored as a sequence of
371 * contiguous nodes in memory.
372 * Each node is the union of a variety of data types.
387 void *next
; /* If prev node's opcode==OPCODE_CONTINUE */
392 * How many nodes to allocate at a time.
394 * \note Reduced now that we hold vertices etc. elsewhere.
396 #define BLOCK_SIZE 256
401 * Number of nodes of storage needed for each instruction.
402 * Sizes for dynamically allocated opcodes are stored in the context struct.
404 static GLuint InstSize
[OPCODE_END_OF_LIST
+ 1];
406 void mesa_print_display_list(GLuint list
);
409 /**********************************************************************/
410 /***** Private *****/
411 /**********************************************************************/
415 * Make an empty display list. This is used by glGenLists() to
416 * reserve display list IDs.
418 static struct mesa_display_list
*
419 make_list(GLuint list
, GLuint count
)
421 struct mesa_display_list
*dlist
= CALLOC_STRUCT(mesa_display_list
);
423 dlist
->node
= (Node
*) _mesa_malloc(sizeof(Node
) * count
);
424 dlist
->node
[0].opcode
= OPCODE_END_OF_LIST
;
430 * Lookup function to just encapsulate casting.
432 static INLINE
struct mesa_display_list
*
433 lookup_list(GLcontext
*ctx
, GLuint list
)
435 return (struct mesa_display_list
*)
436 _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
442 * Delete the named display list, but don't remove from hash table.
443 * \param dlist - display list pointer
446 _mesa_delete_list(GLcontext
*ctx
, struct mesa_display_list
*dlist
)
451 n
= block
= dlist
->node
;
453 done
= block
? GL_FALSE
: GL_TRUE
;
456 /* check for extension opcodes first */
458 GLint i
= (GLint
) n
[0].opcode
- (GLint
) OPCODE_EXT_0
;
459 if (i
>= 0 && i
< (GLint
) ctx
->ListExt
.NumOpcodes
) {
460 ctx
->ListExt
.Opcode
[i
].Destroy(ctx
, &n
[1]);
461 n
+= ctx
->ListExt
.Opcode
[i
].Size
;
464 switch (n
[0].opcode
) {
465 /* for some commands, we need to free malloc'd memory */
467 _mesa_free(n
[6].data
);
468 n
+= InstSize
[n
[0].opcode
];
471 _mesa_free(n
[10].data
);
472 n
+= InstSize
[n
[0].opcode
];
474 case OPCODE_DRAW_PIXELS
:
475 _mesa_free(n
[5].data
);
476 n
+= InstSize
[n
[0].opcode
];
479 _mesa_free(n
[7].data
);
480 n
+= InstSize
[n
[0].opcode
];
482 case OPCODE_COLOR_TABLE
:
483 _mesa_free(n
[6].data
);
484 n
+= InstSize
[n
[0].opcode
];
486 case OPCODE_COLOR_SUB_TABLE
:
487 _mesa_free(n
[6].data
);
488 n
+= InstSize
[n
[0].opcode
];
490 case OPCODE_CONVOLUTION_FILTER_1D
:
491 _mesa_free(n
[6].data
);
492 n
+= InstSize
[n
[0].opcode
];
494 case OPCODE_CONVOLUTION_FILTER_2D
:
495 _mesa_free(n
[7].data
);
496 n
+= InstSize
[n
[0].opcode
];
498 case OPCODE_POLYGON_STIPPLE
:
499 _mesa_free(n
[1].data
);
500 n
+= InstSize
[n
[0].opcode
];
502 case OPCODE_TEX_IMAGE1D
:
503 _mesa_free(n
[8].data
);
504 n
+= InstSize
[n
[0].opcode
];
506 case OPCODE_TEX_IMAGE2D
:
507 _mesa_free(n
[9].data
);
508 n
+= InstSize
[n
[0].opcode
];
510 case OPCODE_TEX_IMAGE3D
:
511 _mesa_free(n
[10].data
);
512 n
+= InstSize
[n
[0].opcode
];
514 case OPCODE_TEX_SUB_IMAGE1D
:
515 _mesa_free(n
[7].data
);
516 n
+= InstSize
[n
[0].opcode
];
518 case OPCODE_TEX_SUB_IMAGE2D
:
519 _mesa_free(n
[9].data
);
520 n
+= InstSize
[n
[0].opcode
];
522 case OPCODE_TEX_SUB_IMAGE3D
:
523 _mesa_free(n
[11].data
);
524 n
+= InstSize
[n
[0].opcode
];
526 case OPCODE_COMPRESSED_TEX_IMAGE_1D
:
527 _mesa_free(n
[7].data
);
528 n
+= InstSize
[n
[0].opcode
];
530 case OPCODE_COMPRESSED_TEX_IMAGE_2D
:
531 _mesa_free(n
[8].data
);
532 n
+= InstSize
[n
[0].opcode
];
534 case OPCODE_COMPRESSED_TEX_IMAGE_3D
:
535 _mesa_free(n
[9].data
);
536 n
+= InstSize
[n
[0].opcode
];
538 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
:
539 _mesa_free(n
[7].data
);
540 n
+= InstSize
[n
[0].opcode
];
542 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
:
543 _mesa_free(n
[9].data
);
544 n
+= InstSize
[n
[0].opcode
];
546 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
:
547 _mesa_free(n
[11].data
);
548 n
+= InstSize
[n
[0].opcode
];
550 #if FEATURE_NV_vertex_program
551 case OPCODE_LOAD_PROGRAM_NV
:
552 _mesa_free(n
[4].data
); /* program string */
553 n
+= InstSize
[n
[0].opcode
];
555 case OPCODE_REQUEST_RESIDENT_PROGRAMS_NV
:
556 _mesa_free(n
[2].data
); /* array of program ids */
557 n
+= InstSize
[n
[0].opcode
];
560 #if FEATURE_NV_fragment_program
561 case OPCODE_PROGRAM_NAMED_PARAMETER_NV
:
562 _mesa_free(n
[3].data
); /* parameter name */
563 n
+= InstSize
[n
[0].opcode
];
566 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
567 case OPCODE_PROGRAM_STRING_ARB
:
568 _mesa_free(n
[4].data
); /* program string */
569 n
+= InstSize
[n
[0].opcode
];
572 case OPCODE_CONTINUE
:
573 n
= (Node
*) n
[1].next
;
577 case OPCODE_END_OF_LIST
:
582 /* Most frequent case */
583 n
+= InstSize
[n
[0].opcode
];
594 * Destroy a display list and remove from hash table.
595 * \param list - display list number
598 destroy_list(GLcontext
*ctx
, GLuint list
)
600 struct mesa_display_list
*dlist
;
605 dlist
= lookup_list(ctx
, list
);
609 _mesa_delete_list(ctx
, dlist
);
610 _mesa_HashRemove(ctx
->Shared
->DisplayList
, list
);
615 * Translate the nth element of list from <type> to GLint.
618 translate_id(GLsizei n
, GLenum type
, const GLvoid
* list
)
630 bptr
= (GLbyte
*) list
;
631 return (GLint
) bptr
[n
];
632 case GL_UNSIGNED_BYTE
:
633 ubptr
= (GLubyte
*) list
;
634 return (GLint
) ubptr
[n
];
636 sptr
= (GLshort
*) list
;
637 return (GLint
) sptr
[n
];
638 case GL_UNSIGNED_SHORT
:
639 usptr
= (GLushort
*) list
;
640 return (GLint
) usptr
[n
];
642 iptr
= (GLint
*) list
;
644 case GL_UNSIGNED_INT
:
645 uiptr
= (GLuint
*) list
;
646 return (GLint
) uiptr
[n
];
648 fptr
= (GLfloat
*) list
;
649 return (GLint
) FLOORF(fptr
[n
]);
651 ubptr
= ((GLubyte
*) list
) + 2 * n
;
652 return (GLint
) ubptr
[0] * 256
655 ubptr
= ((GLubyte
*) list
) + 3 * n
;
656 return (GLint
) ubptr
[0] * 65536
657 + (GLint
) ubptr
[1] * 256
660 ubptr
= ((GLubyte
*) list
) + 4 * n
;
661 return (GLint
) ubptr
[0] * 16777216
662 + (GLint
) ubptr
[1] * 65536
663 + (GLint
) ubptr
[2] * 256
673 /**********************************************************************/
675 /**********************************************************************/
678 * Wrapper for _mesa_unpack_image() that handles pixel buffer objects.
679 * \todo This won't suffice when the PBO is really in VRAM/GPU memory.
682 unpack_image(GLuint dimensions
, GLsizei width
, GLsizei height
, GLsizei depth
,
683 GLenum format
, GLenum type
, const GLvoid
* pixels
,
684 const struct gl_pixelstore_attrib
*unpack
)
686 if (unpack
->BufferObj
->Name
== 0) {
688 return _mesa_unpack_image(dimensions
, width
, height
, depth
, format
,
689 type
, pixels
, unpack
);
692 if (_mesa_validate_pbo_access
693 (dimensions
, unpack
, width
, height
, depth
, format
, type
, pixels
)) {
694 const GLubyte
*src
= ADD_POINTERS(unpack
->BufferObj
->Data
, pixels
);
695 return _mesa_unpack_image(dimensions
, width
, height
, depth
, format
,
704 * Allocate space for a display list instruction.
705 * \param opcode the instruction opcode (OPCODE_* value)
706 * \param size instruction size in bytes, not counting opcode.
707 * \return pointer to the usable data area (not including the internal
711 _mesa_alloc_instruction(GLcontext
*ctx
, GLuint opcode
, GLuint bytes
)
713 const GLuint numNodes
= 1 + (bytes
+ sizeof(Node
) - 1) / sizeof(Node
);
716 if (opcode
< (GLuint
) OPCODE_EXT_0
) {
717 if (InstSize
[opcode
] == 0) {
718 /* save instruction size now */
719 InstSize
[opcode
] = numNodes
;
722 /* make sure instruction size agrees */
723 ASSERT(numNodes
== InstSize
[opcode
]);
727 if (ctx
->ListState
.CurrentPos
+ numNodes
+ 2 > BLOCK_SIZE
) {
728 /* This block is full. Allocate a new block and chain to it */
730 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
731 n
[0].opcode
= OPCODE_CONTINUE
;
732 newblock
= (Node
*) _mesa_malloc(sizeof(Node
) * BLOCK_SIZE
);
734 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "Building display list");
737 n
[1].next
= (Node
*) newblock
;
738 ctx
->ListState
.CurrentBlock
= newblock
;
739 ctx
->ListState
.CurrentPos
= 0;
742 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
743 ctx
->ListState
.CurrentPos
+= numNodes
;
745 n
[0].opcode
= (OpCode
) opcode
;
747 return (void *) (n
+ 1); /* return ptr to node following opcode */
752 * This function allows modules and drivers to get their own opcodes
753 * for extending display list functionality.
754 * \param ctx the rendering context
755 * \param size number of bytes for storing the new display list command
756 * \param execute function to execute the new display list command
757 * \param destroy function to destroy the new display list command
758 * \param print function to print the new display list command
759 * \return the new opcode number or -1 if error
762 _mesa_alloc_opcode(GLcontext
*ctx
,
764 void (*execute
) (GLcontext
*, void *),
765 void (*destroy
) (GLcontext
*, void *),
766 void (*print
) (GLcontext
*, void *))
768 if (ctx
->ListExt
.NumOpcodes
< MAX_DLIST_EXT_OPCODES
) {
769 const GLuint i
= ctx
->ListExt
.NumOpcodes
++;
770 ctx
->ListExt
.Opcode
[i
].Size
=
771 1 + (size
+ sizeof(Node
) - 1) / sizeof(Node
);
772 ctx
->ListExt
.Opcode
[i
].Execute
= execute
;
773 ctx
->ListExt
.Opcode
[i
].Destroy
= destroy
;
774 ctx
->ListExt
.Opcode
[i
].Print
= print
;
775 return i
+ OPCODE_EXT_0
;
783 * Allocate display list instruction. Returns Node ptr to where the opcode
785 * - nParams is the number of function parameters
786 * - return value a pointer to sizeof(Node) before the actual
789 #define ALLOC_INSTRUCTION(CTX, OPCODE, NPARAMS) \
790 ((Node *)_mesa_alloc_instruction(CTX, OPCODE, (NPARAMS)*sizeof(Node)) - 1)
795 * Display List compilation functions
797 static void GLAPIENTRY
798 save_Accum(GLenum op
, GLfloat value
)
800 GET_CURRENT_CONTEXT(ctx
);
802 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
803 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ACCUM
, 2);
808 if (ctx
->ExecuteFlag
) {
809 CALL_Accum(ctx
->Exec
, (op
, value
));
814 static void GLAPIENTRY
815 save_AlphaFunc(GLenum func
, GLclampf ref
)
817 GET_CURRENT_CONTEXT(ctx
);
819 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
820 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ALPHA_FUNC
, 2);
823 n
[2].f
= (GLfloat
) ref
;
825 if (ctx
->ExecuteFlag
) {
826 CALL_AlphaFunc(ctx
->Exec
, (func
, ref
));
831 static void GLAPIENTRY
832 save_BindTexture(GLenum target
, GLuint texture
)
834 GET_CURRENT_CONTEXT(ctx
);
836 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
837 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BIND_TEXTURE
, 2);
842 if (ctx
->ExecuteFlag
) {
843 CALL_BindTexture(ctx
->Exec
, (target
, texture
));
848 static void GLAPIENTRY
849 save_Bitmap(GLsizei width
, GLsizei height
,
850 GLfloat xorig
, GLfloat yorig
,
851 GLfloat xmove
, GLfloat ymove
, const GLubyte
* pixels
)
853 GET_CURRENT_CONTEXT(ctx
);
854 GLvoid
*image
= _mesa_unpack_bitmap(width
, height
, pixels
, &ctx
->Unpack
);
856 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
857 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BITMAP
, 7);
859 n
[1].i
= (GLint
) width
;
860 n
[2].i
= (GLint
) height
;
870 if (ctx
->ExecuteFlag
) {
871 CALL_Bitmap(ctx
->Exec
, (width
, height
,
872 xorig
, yorig
, xmove
, ymove
, pixels
));
877 static void GLAPIENTRY
878 save_BlendEquation(GLenum mode
)
880 GET_CURRENT_CONTEXT(ctx
);
882 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
883 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BLEND_EQUATION
, 1);
887 if (ctx
->ExecuteFlag
) {
888 CALL_BlendEquation(ctx
->Exec
, (mode
));
893 static void GLAPIENTRY
894 save_BlendEquationSeparateEXT(GLenum modeRGB
, GLenum modeA
)
896 GET_CURRENT_CONTEXT(ctx
);
898 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
899 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BLEND_EQUATION_SEPARATE
, 2);
904 if (ctx
->ExecuteFlag
) {
905 CALL_BlendEquationSeparateEXT(ctx
->Exec
, (modeRGB
, modeA
));
910 static void GLAPIENTRY
911 save_BlendFuncSeparateEXT(GLenum sfactorRGB
, GLenum dfactorRGB
,
912 GLenum sfactorA
, GLenum dfactorA
)
914 GET_CURRENT_CONTEXT(ctx
);
916 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
917 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BLEND_FUNC_SEPARATE
, 4);
924 if (ctx
->ExecuteFlag
) {
925 CALL_BlendFuncSeparateEXT(ctx
->Exec
,
926 (sfactorRGB
, dfactorRGB
, sfactorA
, dfactorA
));
931 static void GLAPIENTRY
932 save_BlendFunc(GLenum srcfactor
, GLenum dstfactor
)
934 save_BlendFuncSeparateEXT(srcfactor
, dstfactor
, srcfactor
, dstfactor
);
938 static void GLAPIENTRY
939 save_BlendColor(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
941 GET_CURRENT_CONTEXT(ctx
);
943 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
944 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BLEND_COLOR
, 4);
951 if (ctx
->ExecuteFlag
) {
952 CALL_BlendColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
958 _mesa_save_CallList(GLuint list
)
960 GET_CURRENT_CONTEXT(ctx
);
962 SAVE_FLUSH_VERTICES(ctx
);
964 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CALL_LIST
, 1);
969 /* After this, we don't know what begin/end state we're in:
971 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
973 if (ctx
->ExecuteFlag
) {
974 CALL_CallList(ctx
->Exec
, (list
));
980 _mesa_save_CallLists(GLsizei n
, GLenum type
, const GLvoid
* lists
)
982 GET_CURRENT_CONTEXT(ctx
);
984 GLboolean typeErrorFlag
;
986 SAVE_FLUSH_VERTICES(ctx
);
990 case GL_UNSIGNED_BYTE
:
992 case GL_UNSIGNED_SHORT
:
994 case GL_UNSIGNED_INT
:
999 typeErrorFlag
= GL_FALSE
;
1002 typeErrorFlag
= GL_TRUE
;
1005 for (i
= 0; i
< n
; i
++) {
1006 GLint list
= translate_id(i
, type
, lists
);
1007 Node
*n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CALL_LIST_OFFSET
, 2);
1010 n
[2].b
= typeErrorFlag
;
1014 /* After this, we don't know what begin/end state we're in:
1016 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
1018 if (ctx
->ExecuteFlag
) {
1019 CALL_CallLists(ctx
->Exec
, (n
, type
, lists
));
1024 static void GLAPIENTRY
1025 save_Clear(GLbitfield mask
)
1027 GET_CURRENT_CONTEXT(ctx
);
1029 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1030 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLEAR
, 1);
1034 if (ctx
->ExecuteFlag
) {
1035 CALL_Clear(ctx
->Exec
, (mask
));
1040 static void GLAPIENTRY
1041 save_ClearAccum(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
1043 GET_CURRENT_CONTEXT(ctx
);
1045 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1046 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLEAR_ACCUM
, 4);
1053 if (ctx
->ExecuteFlag
) {
1054 CALL_ClearAccum(ctx
->Exec
, (red
, green
, blue
, alpha
));
1059 static void GLAPIENTRY
1060 save_ClearColor(GLclampf red
, GLclampf green
, GLclampf blue
, GLclampf alpha
)
1062 GET_CURRENT_CONTEXT(ctx
);
1064 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1065 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLEAR_COLOR
, 4);
1072 if (ctx
->ExecuteFlag
) {
1073 CALL_ClearColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
1078 static void GLAPIENTRY
1079 save_ClearDepth(GLclampd depth
)
1081 GET_CURRENT_CONTEXT(ctx
);
1083 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1084 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLEAR_DEPTH
, 1);
1086 n
[1].f
= (GLfloat
) depth
;
1088 if (ctx
->ExecuteFlag
) {
1089 CALL_ClearDepth(ctx
->Exec
, (depth
));
1094 static void GLAPIENTRY
1095 save_ClearIndex(GLfloat c
)
1097 GET_CURRENT_CONTEXT(ctx
);
1099 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1100 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLEAR_INDEX
, 1);
1104 if (ctx
->ExecuteFlag
) {
1105 CALL_ClearIndex(ctx
->Exec
, (c
));
1110 static void GLAPIENTRY
1111 save_ClearStencil(GLint s
)
1113 GET_CURRENT_CONTEXT(ctx
);
1115 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1116 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLEAR_STENCIL
, 1);
1120 if (ctx
->ExecuteFlag
) {
1121 CALL_ClearStencil(ctx
->Exec
, (s
));
1126 static void GLAPIENTRY
1127 save_ClipPlane(GLenum plane
, const GLdouble
* equ
)
1129 GET_CURRENT_CONTEXT(ctx
);
1131 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1132 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLIP_PLANE
, 5);
1135 n
[2].f
= (GLfloat
) equ
[0];
1136 n
[3].f
= (GLfloat
) equ
[1];
1137 n
[4].f
= (GLfloat
) equ
[2];
1138 n
[5].f
= (GLfloat
) equ
[3];
1140 if (ctx
->ExecuteFlag
) {
1141 CALL_ClipPlane(ctx
->Exec
, (plane
, equ
));
1147 static void GLAPIENTRY
1148 save_ColorMask(GLboolean red
, GLboolean green
,
1149 GLboolean blue
, GLboolean alpha
)
1151 GET_CURRENT_CONTEXT(ctx
);
1153 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1154 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COLOR_MASK
, 4);
1161 if (ctx
->ExecuteFlag
) {
1162 CALL_ColorMask(ctx
->Exec
, (red
, green
, blue
, alpha
));
1167 static void GLAPIENTRY
1168 save_ColorMaterial(GLenum face
, GLenum mode
)
1170 GET_CURRENT_CONTEXT(ctx
);
1172 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1174 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COLOR_MATERIAL
, 2);
1179 if (ctx
->ExecuteFlag
) {
1180 CALL_ColorMaterial(ctx
->Exec
, (face
, mode
));
1185 static void GLAPIENTRY
1186 save_ColorTable(GLenum target
, GLenum internalFormat
,
1187 GLsizei width
, GLenum format
, GLenum type
,
1188 const GLvoid
* table
)
1190 GET_CURRENT_CONTEXT(ctx
);
1191 if (_mesa_is_proxy_texture(target
)) {
1192 /* execute immediately */
1193 CALL_ColorTable(ctx
->Exec
, (target
, internalFormat
, width
,
1194 format
, type
, table
));
1197 GLvoid
*image
= unpack_image(1, width
, 1, 1, format
, type
, table
,
1200 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1201 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COLOR_TABLE
, 6);
1204 n
[2].e
= internalFormat
;
1213 if (ctx
->ExecuteFlag
) {
1214 CALL_ColorTable(ctx
->Exec
, (target
, internalFormat
, width
,
1215 format
, type
, table
));
1222 static void GLAPIENTRY
1223 save_ColorTableParameterfv(GLenum target
, GLenum pname
,
1224 const GLfloat
*params
)
1226 GET_CURRENT_CONTEXT(ctx
);
1229 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1231 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COLOR_TABLE_PARAMETER_FV
, 6);
1236 if (pname
== GL_COLOR_TABLE_SGI
||
1237 pname
== GL_POST_CONVOLUTION_COLOR_TABLE_SGI
||
1238 pname
== GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI
||
1239 pname
== GL_TEXTURE_COLOR_TABLE_SGI
) {
1246 if (ctx
->ExecuteFlag
) {
1247 CALL_ColorTableParameterfv(ctx
->Exec
, (target
, pname
, params
));
1252 static void GLAPIENTRY
1253 save_ColorTableParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
1255 GET_CURRENT_CONTEXT(ctx
);
1258 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1260 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COLOR_TABLE_PARAMETER_IV
, 6);
1265 if (pname
== GL_COLOR_TABLE_SGI
||
1266 pname
== GL_POST_CONVOLUTION_COLOR_TABLE_SGI
||
1267 pname
== GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI
||
1268 pname
== GL_TEXTURE_COLOR_TABLE_SGI
) {
1275 if (ctx
->ExecuteFlag
) {
1276 CALL_ColorTableParameteriv(ctx
->Exec
, (target
, pname
, params
));
1282 static void GLAPIENTRY
1283 save_ColorSubTable(GLenum target
, GLsizei start
, GLsizei count
,
1284 GLenum format
, GLenum type
, const GLvoid
* table
)
1286 GET_CURRENT_CONTEXT(ctx
);
1287 GLvoid
*image
= unpack_image(1, count
, 1, 1, format
, type
, table
,
1290 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1291 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COLOR_SUB_TABLE
, 6);
1303 if (ctx
->ExecuteFlag
) {
1304 CALL_ColorSubTable(ctx
->Exec
,
1305 (target
, start
, count
, format
, type
, table
));
1310 static void GLAPIENTRY
1311 save_CopyColorSubTable(GLenum target
, GLsizei start
,
1312 GLint x
, GLint y
, GLsizei width
)
1314 GET_CURRENT_CONTEXT(ctx
);
1317 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1318 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_COLOR_SUB_TABLE
, 5);
1326 if (ctx
->ExecuteFlag
) {
1327 CALL_CopyColorSubTable(ctx
->Exec
, (target
, start
, x
, y
, width
));
1332 static void GLAPIENTRY
1333 save_CopyColorTable(GLenum target
, GLenum internalformat
,
1334 GLint x
, GLint y
, GLsizei width
)
1336 GET_CURRENT_CONTEXT(ctx
);
1339 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1340 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_COLOR_TABLE
, 5);
1343 n
[2].e
= internalformat
;
1348 if (ctx
->ExecuteFlag
) {
1349 CALL_CopyColorTable(ctx
->Exec
, (target
, internalformat
, x
, y
, width
));
1354 static void GLAPIENTRY
1355 save_ConvolutionFilter1D(GLenum target
, GLenum internalFormat
, GLsizei width
,
1356 GLenum format
, GLenum type
, const GLvoid
* filter
)
1358 GET_CURRENT_CONTEXT(ctx
);
1359 GLvoid
*image
= unpack_image(1, width
, 1, 1, format
, type
, filter
,
1362 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1363 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CONVOLUTION_FILTER_1D
, 6);
1366 n
[2].e
= internalFormat
;
1375 if (ctx
->ExecuteFlag
) {
1376 CALL_ConvolutionFilter1D(ctx
->Exec
, (target
, internalFormat
, width
,
1377 format
, type
, filter
));
1382 static void GLAPIENTRY
1383 save_ConvolutionFilter2D(GLenum target
, GLenum internalFormat
,
1384 GLsizei width
, GLsizei height
, GLenum format
,
1385 GLenum type
, const GLvoid
* filter
)
1387 GET_CURRENT_CONTEXT(ctx
);
1388 GLvoid
*image
= unpack_image(2, width
, height
, 1, format
, type
, filter
,
1391 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1392 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CONVOLUTION_FILTER_2D
, 7);
1395 n
[2].e
= internalFormat
;
1405 if (ctx
->ExecuteFlag
) {
1406 CALL_ConvolutionFilter2D(ctx
->Exec
,
1407 (target
, internalFormat
, width
, height
, format
,
1413 static void GLAPIENTRY
1414 save_ConvolutionParameteri(GLenum target
, GLenum pname
, GLint param
)
1416 GET_CURRENT_CONTEXT(ctx
);
1418 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1419 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CONVOLUTION_PARAMETER_I
, 3);
1425 if (ctx
->ExecuteFlag
) {
1426 CALL_ConvolutionParameteri(ctx
->Exec
, (target
, pname
, param
));
1431 static void GLAPIENTRY
1432 save_ConvolutionParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
1434 GET_CURRENT_CONTEXT(ctx
);
1436 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1437 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CONVOLUTION_PARAMETER_IV
, 6);
1442 if (pname
== GL_CONVOLUTION_BORDER_COLOR
||
1443 pname
== GL_CONVOLUTION_FILTER_SCALE
||
1444 pname
== GL_CONVOLUTION_FILTER_BIAS
) {
1450 n
[4].i
= n
[5].i
= n
[6].i
= 0;
1453 if (ctx
->ExecuteFlag
) {
1454 CALL_ConvolutionParameteriv(ctx
->Exec
, (target
, pname
, params
));
1459 static void GLAPIENTRY
1460 save_ConvolutionParameterf(GLenum target
, GLenum pname
, GLfloat param
)
1462 GET_CURRENT_CONTEXT(ctx
);
1464 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1465 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CONVOLUTION_PARAMETER_F
, 3);
1471 if (ctx
->ExecuteFlag
) {
1472 CALL_ConvolutionParameterf(ctx
->Exec
, (target
, pname
, param
));
1477 static void GLAPIENTRY
1478 save_ConvolutionParameterfv(GLenum target
, GLenum pname
,
1479 const GLfloat
*params
)
1481 GET_CURRENT_CONTEXT(ctx
);
1483 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1484 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CONVOLUTION_PARAMETER_FV
, 6);
1489 if (pname
== GL_CONVOLUTION_BORDER_COLOR
||
1490 pname
== GL_CONVOLUTION_FILTER_SCALE
||
1491 pname
== GL_CONVOLUTION_FILTER_BIAS
) {
1497 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
1500 if (ctx
->ExecuteFlag
) {
1501 CALL_ConvolutionParameterfv(ctx
->Exec
, (target
, pname
, params
));
1506 static void GLAPIENTRY
1507 save_CopyPixels(GLint x
, GLint y
, GLsizei width
, GLsizei height
, GLenum type
)
1509 GET_CURRENT_CONTEXT(ctx
);
1511 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1512 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_PIXELS
, 5);
1516 n
[3].i
= (GLint
) width
;
1517 n
[4].i
= (GLint
) height
;
1520 if (ctx
->ExecuteFlag
) {
1521 CALL_CopyPixels(ctx
->Exec
, (x
, y
, width
, height
, type
));
1527 static void GLAPIENTRY
1528 save_CopyTexImage1D(GLenum target
, GLint level
, GLenum internalformat
,
1529 GLint x
, GLint y
, GLsizei width
, GLint border
)
1531 GET_CURRENT_CONTEXT(ctx
);
1533 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1534 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_TEX_IMAGE1D
, 7);
1538 n
[3].e
= internalformat
;
1544 if (ctx
->ExecuteFlag
) {
1545 CALL_CopyTexImage1D(ctx
->Exec
, (target
, level
, internalformat
,
1546 x
, y
, width
, border
));
1551 static void GLAPIENTRY
1552 save_CopyTexImage2D(GLenum target
, GLint level
,
1553 GLenum internalformat
,
1554 GLint x
, GLint y
, GLsizei width
,
1555 GLsizei height
, GLint border
)
1557 GET_CURRENT_CONTEXT(ctx
);
1559 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1560 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_TEX_IMAGE2D
, 8);
1564 n
[3].e
= internalformat
;
1571 if (ctx
->ExecuteFlag
) {
1572 CALL_CopyTexImage2D(ctx
->Exec
, (target
, level
, internalformat
,
1573 x
, y
, width
, height
, border
));
1579 static void GLAPIENTRY
1580 save_CopyTexSubImage1D(GLenum target
, GLint level
,
1581 GLint xoffset
, GLint x
, GLint y
, GLsizei width
)
1583 GET_CURRENT_CONTEXT(ctx
);
1585 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1586 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_TEX_SUB_IMAGE1D
, 6);
1595 if (ctx
->ExecuteFlag
) {
1596 CALL_CopyTexSubImage1D(ctx
->Exec
,
1597 (target
, level
, xoffset
, x
, y
, width
));
1602 static void GLAPIENTRY
1603 save_CopyTexSubImage2D(GLenum target
, GLint level
,
1604 GLint xoffset
, GLint yoffset
,
1605 GLint x
, GLint y
, GLsizei width
, GLint height
)
1607 GET_CURRENT_CONTEXT(ctx
);
1609 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1610 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_TEX_SUB_IMAGE2D
, 8);
1621 if (ctx
->ExecuteFlag
) {
1622 CALL_CopyTexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
1623 x
, y
, width
, height
));
1628 static void GLAPIENTRY
1629 save_CopyTexSubImage3D(GLenum target
, GLint level
,
1630 GLint xoffset
, GLint yoffset
, GLint zoffset
,
1631 GLint x
, GLint y
, GLsizei width
, GLint height
)
1633 GET_CURRENT_CONTEXT(ctx
);
1635 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1636 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_TEX_SUB_IMAGE3D
, 9);
1648 if (ctx
->ExecuteFlag
) {
1649 CALL_CopyTexSubImage3D(ctx
->Exec
, (target
, level
,
1650 xoffset
, yoffset
, zoffset
,
1651 x
, y
, width
, height
));
1656 static void GLAPIENTRY
1657 save_CullFace(GLenum mode
)
1659 GET_CURRENT_CONTEXT(ctx
);
1661 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1662 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CULL_FACE
, 1);
1666 if (ctx
->ExecuteFlag
) {
1667 CALL_CullFace(ctx
->Exec
, (mode
));
1672 static void GLAPIENTRY
1673 save_DepthFunc(GLenum func
)
1675 GET_CURRENT_CONTEXT(ctx
);
1677 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1678 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DEPTH_FUNC
, 1);
1682 if (ctx
->ExecuteFlag
) {
1683 CALL_DepthFunc(ctx
->Exec
, (func
));
1688 static void GLAPIENTRY
1689 save_DepthMask(GLboolean mask
)
1691 GET_CURRENT_CONTEXT(ctx
);
1693 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1694 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DEPTH_MASK
, 1);
1698 if (ctx
->ExecuteFlag
) {
1699 CALL_DepthMask(ctx
->Exec
, (mask
));
1704 static void GLAPIENTRY
1705 save_DepthRange(GLclampd nearval
, GLclampd farval
)
1707 GET_CURRENT_CONTEXT(ctx
);
1709 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1710 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DEPTH_RANGE
, 2);
1712 n
[1].f
= (GLfloat
) nearval
;
1713 n
[2].f
= (GLfloat
) farval
;
1715 if (ctx
->ExecuteFlag
) {
1716 CALL_DepthRange(ctx
->Exec
, (nearval
, farval
));
1721 static void GLAPIENTRY
1722 save_Disable(GLenum cap
)
1724 GET_CURRENT_CONTEXT(ctx
);
1726 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1727 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DISABLE
, 1);
1731 if (ctx
->ExecuteFlag
) {
1732 CALL_Disable(ctx
->Exec
, (cap
));
1737 static void GLAPIENTRY
1738 save_DrawBuffer(GLenum mode
)
1740 GET_CURRENT_CONTEXT(ctx
);
1742 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1743 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DRAW_BUFFER
, 1);
1747 if (ctx
->ExecuteFlag
) {
1748 CALL_DrawBuffer(ctx
->Exec
, (mode
));
1753 static void GLAPIENTRY
1754 save_DrawPixels(GLsizei width
, GLsizei height
,
1755 GLenum format
, GLenum type
, const GLvoid
* pixels
)
1757 GET_CURRENT_CONTEXT(ctx
);
1758 GLvoid
*image
= unpack_image(2, width
, height
, 1, format
, type
,
1759 pixels
, &ctx
->Unpack
);
1761 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1762 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DRAW_PIXELS
, 5);
1773 if (ctx
->ExecuteFlag
) {
1774 CALL_DrawPixels(ctx
->Exec
, (width
, height
, format
, type
, pixels
));
1780 static void GLAPIENTRY
1781 save_Enable(GLenum cap
)
1783 GET_CURRENT_CONTEXT(ctx
);
1785 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1786 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ENABLE
, 1);
1790 if (ctx
->ExecuteFlag
) {
1791 CALL_Enable(ctx
->Exec
, (cap
));
1797 static void GLAPIENTRY
1798 _mesa_save_EvalMesh1(GLenum mode
, GLint i1
, GLint i2
)
1800 GET_CURRENT_CONTEXT(ctx
);
1802 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1803 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVALMESH1
, 3);
1809 if (ctx
->ExecuteFlag
) {
1810 CALL_EvalMesh1(ctx
->Exec
, (mode
, i1
, i2
));
1815 static void GLAPIENTRY
1816 _mesa_save_EvalMesh2(GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
1818 GET_CURRENT_CONTEXT(ctx
);
1820 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1821 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVALMESH2
, 5);
1829 if (ctx
->ExecuteFlag
) {
1830 CALL_EvalMesh2(ctx
->Exec
, (mode
, i1
, i2
, j1
, j2
));
1837 static void GLAPIENTRY
1838 save_Fogfv(GLenum pname
, const GLfloat
*params
)
1840 GET_CURRENT_CONTEXT(ctx
);
1842 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1843 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_FOG
, 5);
1851 if (ctx
->ExecuteFlag
) {
1852 CALL_Fogfv(ctx
->Exec
, (pname
, params
));
1857 static void GLAPIENTRY
1858 save_Fogf(GLenum pname
, GLfloat param
)
1860 save_Fogfv(pname
, ¶m
);
1864 static void GLAPIENTRY
1865 save_Fogiv(GLenum pname
, const GLint
*params
)
1870 case GL_FOG_DENSITY
:
1874 p
[0] = (GLfloat
) *params
;
1877 p
[0] = INT_TO_FLOAT(params
[0]);
1878 p
[1] = INT_TO_FLOAT(params
[1]);
1879 p
[2] = INT_TO_FLOAT(params
[2]);
1880 p
[3] = INT_TO_FLOAT(params
[3]);
1883 /* Error will be caught later in gl_Fogfv */
1886 save_Fogfv(pname
, p
);
1890 static void GLAPIENTRY
1891 save_Fogi(GLenum pname
, GLint param
)
1893 save_Fogiv(pname
, ¶m
);
1897 static void GLAPIENTRY
1898 save_FrontFace(GLenum mode
)
1900 GET_CURRENT_CONTEXT(ctx
);
1902 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1903 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_FRONT_FACE
, 1);
1907 if (ctx
->ExecuteFlag
) {
1908 CALL_FrontFace(ctx
->Exec
, (mode
));
1913 static void GLAPIENTRY
1914 save_Frustum(GLdouble left
, GLdouble right
,
1915 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
1917 GET_CURRENT_CONTEXT(ctx
);
1919 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1920 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_FRUSTUM
, 6);
1922 n
[1].f
= (GLfloat
) left
;
1923 n
[2].f
= (GLfloat
) right
;
1924 n
[3].f
= (GLfloat
) bottom
;
1925 n
[4].f
= (GLfloat
) top
;
1926 n
[5].f
= (GLfloat
) nearval
;
1927 n
[6].f
= (GLfloat
) farval
;
1929 if (ctx
->ExecuteFlag
) {
1930 CALL_Frustum(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
1935 static void GLAPIENTRY
1936 save_Hint(GLenum target
, GLenum mode
)
1938 GET_CURRENT_CONTEXT(ctx
);
1940 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1941 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_HINT
, 2);
1946 if (ctx
->ExecuteFlag
) {
1947 CALL_Hint(ctx
->Exec
, (target
, mode
));
1952 static void GLAPIENTRY
1953 save_Histogram(GLenum target
, GLsizei width
, GLenum internalFormat
,
1956 GET_CURRENT_CONTEXT(ctx
);
1959 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1960 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_HISTOGRAM
, 4);
1964 n
[3].e
= internalFormat
;
1967 if (ctx
->ExecuteFlag
) {
1968 CALL_Histogram(ctx
->Exec
, (target
, width
, internalFormat
, sink
));
1973 static void GLAPIENTRY
1974 save_IndexMask(GLuint mask
)
1976 GET_CURRENT_CONTEXT(ctx
);
1978 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1979 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_INDEX_MASK
, 1);
1983 if (ctx
->ExecuteFlag
) {
1984 CALL_IndexMask(ctx
->Exec
, (mask
));
1989 static void GLAPIENTRY
1990 save_InitNames(void)
1992 GET_CURRENT_CONTEXT(ctx
);
1993 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1994 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_INIT_NAMES
, 0);
1995 if (ctx
->ExecuteFlag
) {
1996 CALL_InitNames(ctx
->Exec
, ());
2001 static void GLAPIENTRY
2002 save_Lightfv(GLenum light
, GLenum pname
, const GLfloat
*params
)
2004 GET_CURRENT_CONTEXT(ctx
);
2006 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2007 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LIGHT
, 6);
2025 case GL_SPOT_DIRECTION
:
2028 case GL_SPOT_EXPONENT
:
2031 case GL_SPOT_CUTOFF
:
2034 case GL_CONSTANT_ATTENUATION
:
2037 case GL_LINEAR_ATTENUATION
:
2040 case GL_QUADRATIC_ATTENUATION
:
2046 for (i
= 0; i
< nParams
; i
++) {
2047 n
[3 + i
].f
= params
[i
];
2050 if (ctx
->ExecuteFlag
) {
2051 CALL_Lightfv(ctx
->Exec
, (light
, pname
, params
));
2056 static void GLAPIENTRY
2057 save_Lightf(GLenum light
, GLenum pname
, GLfloat params
)
2059 save_Lightfv(light
, pname
, ¶ms
);
2063 static void GLAPIENTRY
2064 save_Lightiv(GLenum light
, GLenum pname
, const GLint
*params
)
2071 fparam
[0] = INT_TO_FLOAT(params
[0]);
2072 fparam
[1] = INT_TO_FLOAT(params
[1]);
2073 fparam
[2] = INT_TO_FLOAT(params
[2]);
2074 fparam
[3] = INT_TO_FLOAT(params
[3]);
2077 fparam
[0] = (GLfloat
) params
[0];
2078 fparam
[1] = (GLfloat
) params
[1];
2079 fparam
[2] = (GLfloat
) params
[2];
2080 fparam
[3] = (GLfloat
) params
[3];
2082 case GL_SPOT_DIRECTION
:
2083 fparam
[0] = (GLfloat
) params
[0];
2084 fparam
[1] = (GLfloat
) params
[1];
2085 fparam
[2] = (GLfloat
) params
[2];
2087 case GL_SPOT_EXPONENT
:
2088 case GL_SPOT_CUTOFF
:
2089 case GL_CONSTANT_ATTENUATION
:
2090 case GL_LINEAR_ATTENUATION
:
2091 case GL_QUADRATIC_ATTENUATION
:
2092 fparam
[0] = (GLfloat
) params
[0];
2095 /* error will be caught later in gl_Lightfv */
2098 save_Lightfv(light
, pname
, fparam
);
2102 static void GLAPIENTRY
2103 save_Lighti(GLenum light
, GLenum pname
, GLint param
)
2105 save_Lightiv(light
, pname
, ¶m
);
2109 static void GLAPIENTRY
2110 save_LightModelfv(GLenum pname
, const GLfloat
*params
)
2112 GET_CURRENT_CONTEXT(ctx
);
2114 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2115 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LIGHT_MODEL
, 5);
2123 if (ctx
->ExecuteFlag
) {
2124 CALL_LightModelfv(ctx
->Exec
, (pname
, params
));
2129 static void GLAPIENTRY
2130 save_LightModelf(GLenum pname
, GLfloat param
)
2132 save_LightModelfv(pname
, ¶m
);
2136 static void GLAPIENTRY
2137 save_LightModeliv(GLenum pname
, const GLint
*params
)
2141 case GL_LIGHT_MODEL_AMBIENT
:
2142 fparam
[0] = INT_TO_FLOAT(params
[0]);
2143 fparam
[1] = INT_TO_FLOAT(params
[1]);
2144 fparam
[2] = INT_TO_FLOAT(params
[2]);
2145 fparam
[3] = INT_TO_FLOAT(params
[3]);
2147 case GL_LIGHT_MODEL_LOCAL_VIEWER
:
2148 case GL_LIGHT_MODEL_TWO_SIDE
:
2149 case GL_LIGHT_MODEL_COLOR_CONTROL
:
2150 fparam
[0] = (GLfloat
) params
[0];
2153 /* Error will be caught later in gl_LightModelfv */
2156 save_LightModelfv(pname
, fparam
);
2160 static void GLAPIENTRY
2161 save_LightModeli(GLenum pname
, GLint param
)
2163 save_LightModeliv(pname
, ¶m
);
2167 static void GLAPIENTRY
2168 save_LineStipple(GLint factor
, GLushort pattern
)
2170 GET_CURRENT_CONTEXT(ctx
);
2172 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2173 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LINE_STIPPLE
, 2);
2178 if (ctx
->ExecuteFlag
) {
2179 CALL_LineStipple(ctx
->Exec
, (factor
, pattern
));
2184 static void GLAPIENTRY
2185 save_LineWidth(GLfloat width
)
2187 GET_CURRENT_CONTEXT(ctx
);
2189 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2190 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LINE_WIDTH
, 1);
2194 if (ctx
->ExecuteFlag
) {
2195 CALL_LineWidth(ctx
->Exec
, (width
));
2200 static void GLAPIENTRY
2201 save_ListBase(GLuint base
)
2203 GET_CURRENT_CONTEXT(ctx
);
2205 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2206 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LIST_BASE
, 1);
2210 if (ctx
->ExecuteFlag
) {
2211 CALL_ListBase(ctx
->Exec
, (base
));
2216 static void GLAPIENTRY
2217 save_LoadIdentity(void)
2219 GET_CURRENT_CONTEXT(ctx
);
2220 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2221 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_LOAD_IDENTITY
, 0);
2222 if (ctx
->ExecuteFlag
) {
2223 CALL_LoadIdentity(ctx
->Exec
, ());
2228 static void GLAPIENTRY
2229 save_LoadMatrixf(const GLfloat
* m
)
2231 GET_CURRENT_CONTEXT(ctx
);
2233 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2234 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LOAD_MATRIX
, 16);
2237 for (i
= 0; i
< 16; i
++) {
2241 if (ctx
->ExecuteFlag
) {
2242 CALL_LoadMatrixf(ctx
->Exec
, (m
));
2247 static void GLAPIENTRY
2248 save_LoadMatrixd(const GLdouble
* m
)
2252 for (i
= 0; i
< 16; i
++) {
2253 f
[i
] = (GLfloat
) m
[i
];
2255 save_LoadMatrixf(f
);
2259 static void GLAPIENTRY
2260 save_LoadName(GLuint name
)
2262 GET_CURRENT_CONTEXT(ctx
);
2264 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2265 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LOAD_NAME
, 1);
2269 if (ctx
->ExecuteFlag
) {
2270 CALL_LoadName(ctx
->Exec
, (name
));
2275 static void GLAPIENTRY
2276 save_LogicOp(GLenum opcode
)
2278 GET_CURRENT_CONTEXT(ctx
);
2280 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2281 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LOGIC_OP
, 1);
2285 if (ctx
->ExecuteFlag
) {
2286 CALL_LogicOp(ctx
->Exec
, (opcode
));
2291 static void GLAPIENTRY
2292 save_Map1d(GLenum target
, GLdouble u1
, GLdouble u2
, GLint stride
,
2293 GLint order
, const GLdouble
* points
)
2295 GET_CURRENT_CONTEXT(ctx
);
2297 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2298 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MAP1
, 6);
2300 GLfloat
*pnts
= _mesa_copy_map_points1d(target
, stride
, order
, points
);
2302 n
[2].f
= (GLfloat
) u1
;
2303 n
[3].f
= (GLfloat
) u2
;
2304 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2306 n
[6].data
= (void *) pnts
;
2308 if (ctx
->ExecuteFlag
) {
2309 CALL_Map1d(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2313 static void GLAPIENTRY
2314 save_Map1f(GLenum target
, GLfloat u1
, GLfloat u2
, GLint stride
,
2315 GLint order
, const GLfloat
* points
)
2317 GET_CURRENT_CONTEXT(ctx
);
2319 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2320 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MAP1
, 6);
2322 GLfloat
*pnts
= _mesa_copy_map_points1f(target
, stride
, order
, points
);
2326 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2328 n
[6].data
= (void *) pnts
;
2330 if (ctx
->ExecuteFlag
) {
2331 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2336 static void GLAPIENTRY
2337 save_Map2d(GLenum target
,
2338 GLdouble u1
, GLdouble u2
, GLint ustride
, GLint uorder
,
2339 GLdouble v1
, GLdouble v2
, GLint vstride
, GLint vorder
,
2340 const GLdouble
* points
)
2342 GET_CURRENT_CONTEXT(ctx
);
2344 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2345 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MAP2
, 10);
2347 GLfloat
*pnts
= _mesa_copy_map_points2d(target
, ustride
, uorder
,
2348 vstride
, vorder
, points
);
2350 n
[2].f
= (GLfloat
) u1
;
2351 n
[3].f
= (GLfloat
) u2
;
2352 n
[4].f
= (GLfloat
) v1
;
2353 n
[5].f
= (GLfloat
) v2
;
2354 /* XXX verify these strides are correct */
2355 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2356 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2359 n
[10].data
= (void *) pnts
;
2361 if (ctx
->ExecuteFlag
) {
2362 CALL_Map2d(ctx
->Exec
, (target
,
2363 u1
, u2
, ustride
, uorder
,
2364 v1
, v2
, vstride
, vorder
, points
));
2369 static void GLAPIENTRY
2370 save_Map2f(GLenum target
,
2371 GLfloat u1
, GLfloat u2
, GLint ustride
, GLint uorder
,
2372 GLfloat v1
, GLfloat v2
, GLint vstride
, GLint vorder
,
2373 const GLfloat
* points
)
2375 GET_CURRENT_CONTEXT(ctx
);
2377 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2378 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MAP2
, 10);
2380 GLfloat
*pnts
= _mesa_copy_map_points2f(target
, ustride
, uorder
,
2381 vstride
, vorder
, points
);
2387 /* XXX verify these strides are correct */
2388 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2389 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2392 n
[10].data
= (void *) pnts
;
2394 if (ctx
->ExecuteFlag
) {
2395 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
2396 v1
, v2
, vstride
, vorder
, points
));
2401 static void GLAPIENTRY
2402 save_MapGrid1f(GLint un
, GLfloat u1
, GLfloat u2
)
2404 GET_CURRENT_CONTEXT(ctx
);
2406 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2407 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MAPGRID1
, 3);
2413 if (ctx
->ExecuteFlag
) {
2414 CALL_MapGrid1f(ctx
->Exec
, (un
, u1
, u2
));
2419 static void GLAPIENTRY
2420 save_MapGrid1d(GLint un
, GLdouble u1
, GLdouble u2
)
2422 save_MapGrid1f(un
, (GLfloat
) u1
, (GLfloat
) u2
);
2426 static void GLAPIENTRY
2427 save_MapGrid2f(GLint un
, GLfloat u1
, GLfloat u2
,
2428 GLint vn
, GLfloat v1
, GLfloat v2
)
2430 GET_CURRENT_CONTEXT(ctx
);
2432 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2433 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MAPGRID2
, 6);
2442 if (ctx
->ExecuteFlag
) {
2443 CALL_MapGrid2f(ctx
->Exec
, (un
, u1
, u2
, vn
, v1
, v2
));
2449 static void GLAPIENTRY
2450 save_MapGrid2d(GLint un
, GLdouble u1
, GLdouble u2
,
2451 GLint vn
, GLdouble v1
, GLdouble v2
)
2453 save_MapGrid2f(un
, (GLfloat
) u1
, (GLfloat
) u2
,
2454 vn
, (GLfloat
) v1
, (GLfloat
) v2
);
2458 static void GLAPIENTRY
2459 save_MatrixMode(GLenum mode
)
2461 GET_CURRENT_CONTEXT(ctx
);
2463 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2464 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MATRIX_MODE
, 1);
2468 if (ctx
->ExecuteFlag
) {
2469 CALL_MatrixMode(ctx
->Exec
, (mode
));
2474 static void GLAPIENTRY
2475 save_Minmax(GLenum target
, GLenum internalFormat
, GLboolean sink
)
2477 GET_CURRENT_CONTEXT(ctx
);
2480 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2481 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MIN_MAX
, 3);
2484 n
[2].e
= internalFormat
;
2487 if (ctx
->ExecuteFlag
) {
2488 CALL_Minmax(ctx
->Exec
, (target
, internalFormat
, sink
));
2493 static void GLAPIENTRY
2494 save_MultMatrixf(const GLfloat
* m
)
2496 GET_CURRENT_CONTEXT(ctx
);
2498 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2499 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MULT_MATRIX
, 16);
2502 for (i
= 0; i
< 16; i
++) {
2506 if (ctx
->ExecuteFlag
) {
2507 CALL_MultMatrixf(ctx
->Exec
, (m
));
2512 static void GLAPIENTRY
2513 save_MultMatrixd(const GLdouble
* m
)
2517 for (i
= 0; i
< 16; i
++) {
2518 f
[i
] = (GLfloat
) m
[i
];
2520 save_MultMatrixf(f
);
2524 static void GLAPIENTRY
2525 save_NewList(GLuint list
, GLenum mode
)
2527 GET_CURRENT_CONTEXT(ctx
);
2528 /* It's an error to call this function while building a display list */
2529 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
2536 static void GLAPIENTRY
2537 save_Ortho(GLdouble left
, GLdouble right
,
2538 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
2540 GET_CURRENT_CONTEXT(ctx
);
2542 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2543 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ORTHO
, 6);
2545 n
[1].f
= (GLfloat
) left
;
2546 n
[2].f
= (GLfloat
) right
;
2547 n
[3].f
= (GLfloat
) bottom
;
2548 n
[4].f
= (GLfloat
) top
;
2549 n
[5].f
= (GLfloat
) nearval
;
2550 n
[6].f
= (GLfloat
) farval
;
2552 if (ctx
->ExecuteFlag
) {
2553 CALL_Ortho(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
2558 static void GLAPIENTRY
2559 save_PixelMapfv(GLenum map
, GLint mapsize
, const GLfloat
*values
)
2561 GET_CURRENT_CONTEXT(ctx
);
2563 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2564 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PIXEL_MAP
, 3);
2568 n
[3].data
= (void *) _mesa_malloc(mapsize
* sizeof(GLfloat
));
2569 MEMCPY(n
[3].data
, (void *) values
, mapsize
* sizeof(GLfloat
));
2571 if (ctx
->ExecuteFlag
) {
2572 CALL_PixelMapfv(ctx
->Exec
, (map
, mapsize
, values
));
2577 static void GLAPIENTRY
2578 save_PixelMapuiv(GLenum map
, GLint mapsize
, const GLuint
*values
)
2580 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2582 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
2583 for (i
= 0; i
< mapsize
; i
++) {
2584 fvalues
[i
] = (GLfloat
) values
[i
];
2588 for (i
= 0; i
< mapsize
; i
++) {
2589 fvalues
[i
] = UINT_TO_FLOAT(values
[i
]);
2592 save_PixelMapfv(map
, mapsize
, fvalues
);
2596 static void GLAPIENTRY
2597 save_PixelMapusv(GLenum map
, GLint mapsize
, const GLushort
*values
)
2599 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2601 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
2602 for (i
= 0; i
< mapsize
; i
++) {
2603 fvalues
[i
] = (GLfloat
) values
[i
];
2607 for (i
= 0; i
< mapsize
; i
++) {
2608 fvalues
[i
] = USHORT_TO_FLOAT(values
[i
]);
2611 save_PixelMapfv(map
, mapsize
, fvalues
);
2615 static void GLAPIENTRY
2616 save_PixelTransferf(GLenum pname
, GLfloat param
)
2618 GET_CURRENT_CONTEXT(ctx
);
2620 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2621 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PIXEL_TRANSFER
, 2);
2626 if (ctx
->ExecuteFlag
) {
2627 CALL_PixelTransferf(ctx
->Exec
, (pname
, param
));
2632 static void GLAPIENTRY
2633 save_PixelTransferi(GLenum pname
, GLint param
)
2635 save_PixelTransferf(pname
, (GLfloat
) param
);
2639 static void GLAPIENTRY
2640 save_PixelZoom(GLfloat xfactor
, GLfloat yfactor
)
2642 GET_CURRENT_CONTEXT(ctx
);
2644 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2645 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PIXEL_ZOOM
, 2);
2650 if (ctx
->ExecuteFlag
) {
2651 CALL_PixelZoom(ctx
->Exec
, (xfactor
, yfactor
));
2656 static void GLAPIENTRY
2657 save_PointParameterfvEXT(GLenum pname
, const GLfloat
*params
)
2659 GET_CURRENT_CONTEXT(ctx
);
2661 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2662 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_POINT_PARAMETERS
, 4);
2669 if (ctx
->ExecuteFlag
) {
2670 CALL_PointParameterfvEXT(ctx
->Exec
, (pname
, params
));
2675 static void GLAPIENTRY
2676 save_PointParameterfEXT(GLenum pname
, GLfloat param
)
2678 save_PointParameterfvEXT(pname
, ¶m
);
2681 static void GLAPIENTRY
2682 save_PointParameteriNV(GLenum pname
, GLint param
)
2684 GLfloat p
= (GLfloat
) param
;
2685 save_PointParameterfvEXT(pname
, &p
);
2688 static void GLAPIENTRY
2689 save_PointParameterivNV(GLenum pname
, const GLint
* param
)
2691 GLfloat p
= (GLfloat
) param
[0];
2692 save_PointParameterfvEXT(pname
, &p
);
2696 static void GLAPIENTRY
2697 save_PointSize(GLfloat size
)
2699 GET_CURRENT_CONTEXT(ctx
);
2701 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2702 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_POINT_SIZE
, 1);
2706 if (ctx
->ExecuteFlag
) {
2707 CALL_PointSize(ctx
->Exec
, (size
));
2712 static void GLAPIENTRY
2713 save_PolygonMode(GLenum face
, GLenum mode
)
2715 GET_CURRENT_CONTEXT(ctx
);
2717 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2718 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_POLYGON_MODE
, 2);
2723 if (ctx
->ExecuteFlag
) {
2724 CALL_PolygonMode(ctx
->Exec
, (face
, mode
));
2729 static void GLAPIENTRY
2730 save_PolygonStipple(const GLubyte
* pattern
)
2732 GET_CURRENT_CONTEXT(ctx
);
2733 GLvoid
*image
= unpack_image(2, 32, 32, 1, GL_COLOR_INDEX
, GL_BITMAP
,
2734 pattern
, &ctx
->Unpack
);
2736 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2737 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_POLYGON_STIPPLE
, 1);
2744 if (ctx
->ExecuteFlag
) {
2745 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) pattern
));
2750 static void GLAPIENTRY
2751 save_PolygonOffset(GLfloat factor
, GLfloat units
)
2753 GET_CURRENT_CONTEXT(ctx
);
2755 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2756 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_POLYGON_OFFSET
, 2);
2761 if (ctx
->ExecuteFlag
) {
2762 CALL_PolygonOffset(ctx
->Exec
, (factor
, units
));
2767 static void GLAPIENTRY
2768 save_PolygonOffsetEXT(GLfloat factor
, GLfloat bias
)
2770 GET_CURRENT_CONTEXT(ctx
);
2771 /* XXX mult by DepthMaxF here??? */
2772 save_PolygonOffset(factor
, ctx
->DrawBuffer
->_DepthMaxF
* bias
);
2776 static void GLAPIENTRY
2777 save_PopAttrib(void)
2779 GET_CURRENT_CONTEXT(ctx
);
2780 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2781 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_POP_ATTRIB
, 0);
2782 if (ctx
->ExecuteFlag
) {
2783 CALL_PopAttrib(ctx
->Exec
, ());
2788 static void GLAPIENTRY
2789 save_PopMatrix(void)
2791 GET_CURRENT_CONTEXT(ctx
);
2792 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2793 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_POP_MATRIX
, 0);
2794 if (ctx
->ExecuteFlag
) {
2795 CALL_PopMatrix(ctx
->Exec
, ());
2800 static void GLAPIENTRY
2803 GET_CURRENT_CONTEXT(ctx
);
2804 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2805 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_POP_NAME
, 0);
2806 if (ctx
->ExecuteFlag
) {
2807 CALL_PopName(ctx
->Exec
, ());
2812 static void GLAPIENTRY
2813 save_PrioritizeTextures(GLsizei num
, const GLuint
* textures
,
2814 const GLclampf
* priorities
)
2816 GET_CURRENT_CONTEXT(ctx
);
2818 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2820 for (i
= 0; i
< num
; i
++) {
2822 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PRIORITIZE_TEXTURE
, 2);
2824 n
[1].ui
= textures
[i
];
2825 n
[2].f
= priorities
[i
];
2828 if (ctx
->ExecuteFlag
) {
2829 CALL_PrioritizeTextures(ctx
->Exec
, (num
, textures
, priorities
));
2834 static void GLAPIENTRY
2835 save_PushAttrib(GLbitfield mask
)
2837 GET_CURRENT_CONTEXT(ctx
);
2839 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2840 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PUSH_ATTRIB
, 1);
2844 if (ctx
->ExecuteFlag
) {
2845 CALL_PushAttrib(ctx
->Exec
, (mask
));
2850 static void GLAPIENTRY
2851 save_PushMatrix(void)
2853 GET_CURRENT_CONTEXT(ctx
);
2854 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2855 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_PUSH_MATRIX
, 0);
2856 if (ctx
->ExecuteFlag
) {
2857 CALL_PushMatrix(ctx
->Exec
, ());
2862 static void GLAPIENTRY
2863 save_PushName(GLuint name
)
2865 GET_CURRENT_CONTEXT(ctx
);
2867 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2868 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PUSH_NAME
, 1);
2872 if (ctx
->ExecuteFlag
) {
2873 CALL_PushName(ctx
->Exec
, (name
));
2878 static void GLAPIENTRY
2879 save_RasterPos4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
2881 GET_CURRENT_CONTEXT(ctx
);
2883 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2884 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_RASTER_POS
, 4);
2891 if (ctx
->ExecuteFlag
) {
2892 CALL_RasterPos4f(ctx
->Exec
, (x
, y
, z
, w
));
2896 static void GLAPIENTRY
2897 save_RasterPos2d(GLdouble x
, GLdouble y
)
2899 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
2902 static void GLAPIENTRY
2903 save_RasterPos2f(GLfloat x
, GLfloat y
)
2905 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2908 static void GLAPIENTRY
2909 save_RasterPos2i(GLint x
, GLint y
)
2911 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
2914 static void GLAPIENTRY
2915 save_RasterPos2s(GLshort x
, GLshort y
)
2917 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2920 static void GLAPIENTRY
2921 save_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
2923 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
2926 static void GLAPIENTRY
2927 save_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
2929 save_RasterPos4f(x
, y
, z
, 1.0F
);
2932 static void GLAPIENTRY
2933 save_RasterPos3i(GLint x
, GLint y
, GLint z
)
2935 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
2938 static void GLAPIENTRY
2939 save_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
2941 save_RasterPos4f(x
, y
, z
, 1.0F
);
2944 static void GLAPIENTRY
2945 save_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
2947 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
2950 static void GLAPIENTRY
2951 save_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
2953 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
2956 static void GLAPIENTRY
2957 save_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
2959 save_RasterPos4f(x
, y
, z
, w
);
2962 static void GLAPIENTRY
2963 save_RasterPos2dv(const GLdouble
* v
)
2965 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
2968 static void GLAPIENTRY
2969 save_RasterPos2fv(const GLfloat
* v
)
2971 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2974 static void GLAPIENTRY
2975 save_RasterPos2iv(const GLint
* v
)
2977 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
2980 static void GLAPIENTRY
2981 save_RasterPos2sv(const GLshort
* v
)
2983 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2986 static void GLAPIENTRY
2987 save_RasterPos3dv(const GLdouble
* v
)
2989 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
2992 static void GLAPIENTRY
2993 save_RasterPos3fv(const GLfloat
* v
)
2995 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2998 static void GLAPIENTRY
2999 save_RasterPos3iv(const GLint
* v
)
3001 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3004 static void GLAPIENTRY
3005 save_RasterPos3sv(const GLshort
* v
)
3007 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3010 static void GLAPIENTRY
3011 save_RasterPos4dv(const GLdouble
* v
)
3013 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3014 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3017 static void GLAPIENTRY
3018 save_RasterPos4fv(const GLfloat
* v
)
3020 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3023 static void GLAPIENTRY
3024 save_RasterPos4iv(const GLint
* v
)
3026 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3027 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3030 static void GLAPIENTRY
3031 save_RasterPos4sv(const GLshort
* v
)
3033 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3037 static void GLAPIENTRY
3038 save_PassThrough(GLfloat token
)
3040 GET_CURRENT_CONTEXT(ctx
);
3042 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3043 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PASSTHROUGH
, 1);
3047 if (ctx
->ExecuteFlag
) {
3048 CALL_PassThrough(ctx
->Exec
, (token
));
3053 static void GLAPIENTRY
3054 save_ReadBuffer(GLenum mode
)
3056 GET_CURRENT_CONTEXT(ctx
);
3058 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3059 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_READ_BUFFER
, 1);
3063 if (ctx
->ExecuteFlag
) {
3064 CALL_ReadBuffer(ctx
->Exec
, (mode
));
3069 static void GLAPIENTRY
3070 save_ResetHistogram(GLenum target
)
3072 GET_CURRENT_CONTEXT(ctx
);
3074 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3075 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_RESET_HISTOGRAM
, 1);
3079 if (ctx
->ExecuteFlag
) {
3080 CALL_ResetHistogram(ctx
->Exec
, (target
));
3085 static void GLAPIENTRY
3086 save_ResetMinmax(GLenum target
)
3088 GET_CURRENT_CONTEXT(ctx
);
3090 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3091 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_RESET_MIN_MAX
, 1);
3095 if (ctx
->ExecuteFlag
) {
3096 CALL_ResetMinmax(ctx
->Exec
, (target
));
3101 static void GLAPIENTRY
3102 save_Rotatef(GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
3104 GET_CURRENT_CONTEXT(ctx
);
3106 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3107 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ROTATE
, 4);
3114 if (ctx
->ExecuteFlag
) {
3115 CALL_Rotatef(ctx
->Exec
, (angle
, x
, y
, z
));
3120 static void GLAPIENTRY
3121 save_Rotated(GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
3123 save_Rotatef((GLfloat
) angle
, (GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3127 static void GLAPIENTRY
3128 save_Scalef(GLfloat x
, GLfloat y
, GLfloat z
)
3130 GET_CURRENT_CONTEXT(ctx
);
3132 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3133 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SCALE
, 3);
3139 if (ctx
->ExecuteFlag
) {
3140 CALL_Scalef(ctx
->Exec
, (x
, y
, z
));
3145 static void GLAPIENTRY
3146 save_Scaled(GLdouble x
, GLdouble y
, GLdouble z
)
3148 save_Scalef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3152 static void GLAPIENTRY
3153 save_Scissor(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3155 GET_CURRENT_CONTEXT(ctx
);
3157 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3158 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SCISSOR
, 4);
3165 if (ctx
->ExecuteFlag
) {
3166 CALL_Scissor(ctx
->Exec
, (x
, y
, width
, height
));
3171 static void GLAPIENTRY
3172 save_ShadeModel(GLenum mode
)
3174 GET_CURRENT_CONTEXT(ctx
);
3176 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3177 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SHADE_MODEL
, 1);
3181 if (ctx
->ExecuteFlag
) {
3182 CALL_ShadeModel(ctx
->Exec
, (mode
));
3187 static void GLAPIENTRY
3188 save_StencilFunc(GLenum func
, GLint ref
, GLuint mask
)
3190 GET_CURRENT_CONTEXT(ctx
);
3192 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3193 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_FUNC
, 3);
3199 if (ctx
->ExecuteFlag
) {
3200 CALL_StencilFunc(ctx
->Exec
, (func
, ref
, mask
));
3205 static void GLAPIENTRY
3206 save_StencilMask(GLuint mask
)
3208 GET_CURRENT_CONTEXT(ctx
);
3210 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3211 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_MASK
, 1);
3215 if (ctx
->ExecuteFlag
) {
3216 CALL_StencilMask(ctx
->Exec
, (mask
));
3221 static void GLAPIENTRY
3222 save_StencilOp(GLenum fail
, GLenum zfail
, GLenum zpass
)
3224 GET_CURRENT_CONTEXT(ctx
);
3226 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3227 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_OP
, 3);
3233 if (ctx
->ExecuteFlag
) {
3234 CALL_StencilOp(ctx
->Exec
, (fail
, zfail
, zpass
));
3239 static void GLAPIENTRY
3240 save_StencilFuncSeparate(GLenum face
, GLenum func
, GLint ref
, GLuint mask
)
3242 GET_CURRENT_CONTEXT(ctx
);
3244 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3245 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3252 if (ctx
->ExecuteFlag
) {
3253 CALL_StencilFuncSeparate(ctx
->Exec
, (face
, func
, ref
, mask
));
3258 static void GLAPIENTRY
3259 save_StencilFuncSeparateATI(GLenum frontfunc
, GLenum backfunc
, GLint ref
,
3262 GET_CURRENT_CONTEXT(ctx
);
3264 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3266 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3274 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3281 if (ctx
->ExecuteFlag
) {
3282 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_FRONT
, frontfunc
, ref
, mask
));
3283 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_BACK
, backfunc
, ref
, mask
));
3288 static void GLAPIENTRY
3289 save_StencilMaskSeparate(GLenum face
, GLuint mask
)
3291 GET_CURRENT_CONTEXT(ctx
);
3293 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3294 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_MASK_SEPARATE
, 2);
3299 if (ctx
->ExecuteFlag
) {
3300 CALL_StencilMaskSeparate(ctx
->Exec
, (face
, mask
));
3305 static void GLAPIENTRY
3306 save_StencilOpSeparate(GLenum face
, GLenum fail
, GLenum zfail
, GLenum zpass
)
3308 GET_CURRENT_CONTEXT(ctx
);
3310 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3311 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_OP_SEPARATE
, 4);
3318 if (ctx
->ExecuteFlag
) {
3319 CALL_StencilOpSeparate(ctx
->Exec
, (face
, fail
, zfail
, zpass
));
3324 static void GLAPIENTRY
3325 save_TexEnvfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3327 GET_CURRENT_CONTEXT(ctx
);
3329 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3330 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEXENV
, 6);
3334 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3342 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
3345 if (ctx
->ExecuteFlag
) {
3346 CALL_TexEnvfv(ctx
->Exec
, (target
, pname
, params
));
3351 static void GLAPIENTRY
3352 save_TexEnvf(GLenum target
, GLenum pname
, GLfloat param
)
3354 save_TexEnvfv(target
, pname
, ¶m
);
3358 static void GLAPIENTRY
3359 save_TexEnvi(GLenum target
, GLenum pname
, GLint param
)
3362 p
[0] = (GLfloat
) param
;
3363 p
[1] = p
[2] = p
[3] = 0.0;
3364 save_TexEnvfv(target
, pname
, p
);
3368 static void GLAPIENTRY
3369 save_TexEnviv(GLenum target
, GLenum pname
, const GLint
* param
)
3372 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3373 p
[0] = INT_TO_FLOAT(param
[0]);
3374 p
[1] = INT_TO_FLOAT(param
[1]);
3375 p
[2] = INT_TO_FLOAT(param
[2]);
3376 p
[3] = INT_TO_FLOAT(param
[3]);
3379 p
[0] = (GLfloat
) param
[0];
3380 p
[1] = p
[2] = p
[3] = 0.0F
;
3382 save_TexEnvfv(target
, pname
, p
);
3386 static void GLAPIENTRY
3387 save_TexGenfv(GLenum coord
, GLenum pname
, const GLfloat
*params
)
3389 GET_CURRENT_CONTEXT(ctx
);
3391 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3392 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEXGEN
, 6);
3401 if (ctx
->ExecuteFlag
) {
3402 CALL_TexGenfv(ctx
->Exec
, (coord
, pname
, params
));
3407 static void GLAPIENTRY
3408 save_TexGeniv(GLenum coord
, GLenum pname
, const GLint
*params
)
3411 p
[0] = (GLfloat
) params
[0];
3412 p
[1] = (GLfloat
) params
[1];
3413 p
[2] = (GLfloat
) params
[2];
3414 p
[3] = (GLfloat
) params
[3];
3415 save_TexGenfv(coord
, pname
, p
);
3419 static void GLAPIENTRY
3420 save_TexGend(GLenum coord
, GLenum pname
, GLdouble param
)
3422 GLfloat p
= (GLfloat
) param
;
3423 save_TexGenfv(coord
, pname
, &p
);
3427 static void GLAPIENTRY
3428 save_TexGendv(GLenum coord
, GLenum pname
, const GLdouble
*params
)
3431 p
[0] = (GLfloat
) params
[0];
3432 p
[1] = (GLfloat
) params
[1];
3433 p
[2] = (GLfloat
) params
[2];
3434 p
[3] = (GLfloat
) params
[3];
3435 save_TexGenfv(coord
, pname
, p
);
3439 static void GLAPIENTRY
3440 save_TexGenf(GLenum coord
, GLenum pname
, GLfloat param
)
3442 save_TexGenfv(coord
, pname
, ¶m
);
3446 static void GLAPIENTRY
3447 save_TexGeni(GLenum coord
, GLenum pname
, GLint param
)
3449 save_TexGeniv(coord
, pname
, ¶m
);
3453 static void GLAPIENTRY
3454 save_TexParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3456 GET_CURRENT_CONTEXT(ctx
);
3458 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3459 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEXPARAMETER
, 6);
3468 if (ctx
->ExecuteFlag
) {
3469 CALL_TexParameterfv(ctx
->Exec
, (target
, pname
, params
));
3474 static void GLAPIENTRY
3475 save_TexParameterf(GLenum target
, GLenum pname
, GLfloat param
)
3477 save_TexParameterfv(target
, pname
, ¶m
);
3481 static void GLAPIENTRY
3482 save_TexParameteri(GLenum target
, GLenum pname
, GLint param
)
3485 fparam
[0] = (GLfloat
) param
;
3486 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
3487 save_TexParameterfv(target
, pname
, fparam
);
3491 static void GLAPIENTRY
3492 save_TexParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
3495 fparam
[0] = (GLfloat
) params
[0];
3496 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
3497 save_TexParameterfv(target
, pname
, fparam
);
3501 static void GLAPIENTRY
3502 save_TexImage1D(GLenum target
,
3503 GLint level
, GLint components
,
3504 GLsizei width
, GLint border
,
3505 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3507 GET_CURRENT_CONTEXT(ctx
);
3508 if (target
== GL_PROXY_TEXTURE_1D
) {
3509 /* don't compile, execute immediately */
3510 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
3511 border
, format
, type
, pixels
));
3514 GLvoid
*image
= unpack_image(1, width
, 1, 1, format
, type
,
3515 pixels
, &ctx
->Unpack
);
3517 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3518 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_IMAGE1D
, 8);
3522 n
[3].i
= components
;
3523 n
[4].i
= (GLint
) width
;
3532 if (ctx
->ExecuteFlag
) {
3533 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
3534 border
, format
, type
, pixels
));
3540 static void GLAPIENTRY
3541 save_TexImage2D(GLenum target
,
3542 GLint level
, GLint components
,
3543 GLsizei width
, GLsizei height
, GLint border
,
3544 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3546 GET_CURRENT_CONTEXT(ctx
);
3547 if (target
== GL_PROXY_TEXTURE_2D
) {
3548 /* don't compile, execute immediately */
3549 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
3550 height
, border
, format
, type
, pixels
));
3553 GLvoid
*image
= unpack_image(2, width
, height
, 1, format
, type
,
3554 pixels
, &ctx
->Unpack
);
3556 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3557 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_IMAGE2D
, 9);
3561 n
[3].i
= components
;
3562 n
[4].i
= (GLint
) width
;
3563 n
[5].i
= (GLint
) height
;
3572 if (ctx
->ExecuteFlag
) {
3573 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
3574 height
, border
, format
, type
, pixels
));
3580 static void GLAPIENTRY
3581 save_TexImage3D(GLenum target
,
3582 GLint level
, GLint internalFormat
,
3583 GLsizei width
, GLsizei height
, GLsizei depth
,
3585 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3587 GET_CURRENT_CONTEXT(ctx
);
3588 if (target
== GL_PROXY_TEXTURE_3D
) {
3589 /* don't compile, execute immediately */
3590 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
3591 height
, depth
, border
, format
, type
,
3596 GLvoid
*image
= unpack_image(3, width
, height
, depth
, format
, type
,
3597 pixels
, &ctx
->Unpack
);
3598 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3599 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_IMAGE3D
, 10);
3603 n
[3].i
= (GLint
) internalFormat
;
3604 n
[4].i
= (GLint
) width
;
3605 n
[5].i
= (GLint
) height
;
3606 n
[6].i
= (GLint
) depth
;
3615 if (ctx
->ExecuteFlag
) {
3616 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
3617 height
, depth
, border
, format
, type
,
3624 static void GLAPIENTRY
3625 save_TexSubImage1D(GLenum target
, GLint level
, GLint xoffset
,
3626 GLsizei width
, GLenum format
, GLenum type
,
3627 const GLvoid
* pixels
)
3629 GET_CURRENT_CONTEXT(ctx
);
3631 GLvoid
*image
= unpack_image(1, width
, 1, 1, format
, type
,
3632 pixels
, &ctx
->Unpack
);
3633 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3634 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_SUB_IMAGE1D
, 7);
3639 n
[4].i
= (GLint
) width
;
3647 if (ctx
->ExecuteFlag
) {
3648 CALL_TexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
, width
,
3649 format
, type
, pixels
));
3654 static void GLAPIENTRY
3655 save_TexSubImage2D(GLenum target
, GLint level
,
3656 GLint xoffset
, GLint yoffset
,
3657 GLsizei width
, GLsizei height
,
3658 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3660 GET_CURRENT_CONTEXT(ctx
);
3662 GLvoid
*image
= unpack_image(2, width
, height
, 1, format
, type
,
3663 pixels
, &ctx
->Unpack
);
3664 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3665 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_SUB_IMAGE2D
, 9);
3671 n
[5].i
= (GLint
) width
;
3672 n
[6].i
= (GLint
) height
;
3680 if (ctx
->ExecuteFlag
) {
3681 CALL_TexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
3682 width
, height
, format
, type
, pixels
));
3687 static void GLAPIENTRY
3688 save_TexSubImage3D(GLenum target
, GLint level
,
3689 GLint xoffset
, GLint yoffset
, GLint zoffset
,
3690 GLsizei width
, GLsizei height
, GLsizei depth
,
3691 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3693 GET_CURRENT_CONTEXT(ctx
);
3695 GLvoid
*image
= unpack_image(3, width
, height
, depth
, format
, type
,
3696 pixels
, &ctx
->Unpack
);
3697 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3698 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_SUB_IMAGE3D
, 11);
3705 n
[6].i
= (GLint
) width
;
3706 n
[7].i
= (GLint
) height
;
3707 n
[8].i
= (GLint
) depth
;
3715 if (ctx
->ExecuteFlag
) {
3716 CALL_TexSubImage3D(ctx
->Exec
, (target
, level
,
3717 xoffset
, yoffset
, zoffset
,
3718 width
, height
, depth
, format
, type
,
3724 static void GLAPIENTRY
3725 save_Translatef(GLfloat x
, GLfloat y
, GLfloat z
)
3727 GET_CURRENT_CONTEXT(ctx
);
3729 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3730 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TRANSLATE
, 3);
3736 if (ctx
->ExecuteFlag
) {
3737 CALL_Translatef(ctx
->Exec
, (x
, y
, z
));
3742 static void GLAPIENTRY
3743 save_Translated(GLdouble x
, GLdouble y
, GLdouble z
)
3745 save_Translatef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3750 static void GLAPIENTRY
3751 save_Viewport(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3753 GET_CURRENT_CONTEXT(ctx
);
3755 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3756 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_VIEWPORT
, 4);
3760 n
[3].i
= (GLint
) width
;
3761 n
[4].i
= (GLint
) height
;
3763 if (ctx
->ExecuteFlag
) {
3764 CALL_Viewport(ctx
->Exec
, (x
, y
, width
, height
));
3769 static void GLAPIENTRY
3770 save_WindowPos4fMESA(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3772 GET_CURRENT_CONTEXT(ctx
);
3774 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3775 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_WINDOW_POS
, 4);
3782 if (ctx
->ExecuteFlag
) {
3783 CALL_WindowPos4fMESA(ctx
->Exec
, (x
, y
, z
, w
));
3787 static void GLAPIENTRY
3788 save_WindowPos2dMESA(GLdouble x
, GLdouble y
)
3790 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3793 static void GLAPIENTRY
3794 save_WindowPos2fMESA(GLfloat x
, GLfloat y
)
3796 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3799 static void GLAPIENTRY
3800 save_WindowPos2iMESA(GLint x
, GLint y
)
3802 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3805 static void GLAPIENTRY
3806 save_WindowPos2sMESA(GLshort x
, GLshort y
)
3808 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3811 static void GLAPIENTRY
3812 save_WindowPos3dMESA(GLdouble x
, GLdouble y
, GLdouble z
)
3814 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3817 static void GLAPIENTRY
3818 save_WindowPos3fMESA(GLfloat x
, GLfloat y
, GLfloat z
)
3820 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3823 static void GLAPIENTRY
3824 save_WindowPos3iMESA(GLint x
, GLint y
, GLint z
)
3826 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3829 static void GLAPIENTRY
3830 save_WindowPos3sMESA(GLshort x
, GLshort y
, GLshort z
)
3832 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3835 static void GLAPIENTRY
3836 save_WindowPos4dMESA(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3838 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3841 static void GLAPIENTRY
3842 save_WindowPos4iMESA(GLint x
, GLint y
, GLint z
, GLint w
)
3844 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3847 static void GLAPIENTRY
3848 save_WindowPos4sMESA(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
3850 save_WindowPos4fMESA(x
, y
, z
, w
);
3853 static void GLAPIENTRY
3854 save_WindowPos2dvMESA(const GLdouble
* v
)
3856 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3859 static void GLAPIENTRY
3860 save_WindowPos2fvMESA(const GLfloat
* v
)
3862 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3865 static void GLAPIENTRY
3866 save_WindowPos2ivMESA(const GLint
* v
)
3868 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3871 static void GLAPIENTRY
3872 save_WindowPos2svMESA(const GLshort
* v
)
3874 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3877 static void GLAPIENTRY
3878 save_WindowPos3dvMESA(const GLdouble
* v
)
3880 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3883 static void GLAPIENTRY
3884 save_WindowPos3fvMESA(const GLfloat
* v
)
3886 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3889 static void GLAPIENTRY
3890 save_WindowPos3ivMESA(const GLint
* v
)
3892 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3895 static void GLAPIENTRY
3896 save_WindowPos3svMESA(const GLshort
* v
)
3898 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3901 static void GLAPIENTRY
3902 save_WindowPos4dvMESA(const GLdouble
* v
)
3904 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
3905 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3908 static void GLAPIENTRY
3909 save_WindowPos4fvMESA(const GLfloat
* v
)
3911 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3914 static void GLAPIENTRY
3915 save_WindowPos4ivMESA(const GLint
* v
)
3917 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
3918 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3921 static void GLAPIENTRY
3922 save_WindowPos4svMESA(const GLshort
* v
)
3924 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3929 /* GL_ARB_multitexture */
3930 static void GLAPIENTRY
3931 save_ActiveTextureARB(GLenum target
)
3933 GET_CURRENT_CONTEXT(ctx
);
3935 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3936 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ACTIVE_TEXTURE
, 1);
3940 if (ctx
->ExecuteFlag
) {
3941 CALL_ActiveTextureARB(ctx
->Exec
, (target
));
3946 /* GL_ARB_transpose_matrix */
3948 static void GLAPIENTRY
3949 save_LoadTransposeMatrixdARB(const GLdouble m
[16])
3952 _math_transposefd(tm
, m
);
3953 save_LoadMatrixf(tm
);
3957 static void GLAPIENTRY
3958 save_LoadTransposeMatrixfARB(const GLfloat m
[16])
3961 _math_transposef(tm
, m
);
3962 save_LoadMatrixf(tm
);
3966 static void GLAPIENTRY
3967 save_MultTransposeMatrixdARB(const GLdouble m
[16])
3970 _math_transposefd(tm
, m
);
3971 save_MultMatrixf(tm
);
3975 static void GLAPIENTRY
3976 save_MultTransposeMatrixfARB(const GLfloat m
[16])
3979 _math_transposef(tm
, m
);
3980 save_MultMatrixf(tm
);
3984 /* GL_ARB_texture_compression */
3985 static void GLAPIENTRY
3986 save_CompressedTexImage1DARB(GLenum target
, GLint level
,
3987 GLenum internalFormat
, GLsizei width
,
3988 GLint border
, GLsizei imageSize
,
3989 const GLvoid
* data
)
3991 GET_CURRENT_CONTEXT(ctx
);
3992 if (target
== GL_PROXY_TEXTURE_1D
) {
3993 /* don't compile, execute immediately */
3994 CALL_CompressedTexImage1DARB(ctx
->Exec
, (target
, level
, internalFormat
,
3995 width
, border
, imageSize
,
4001 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4002 /* make copy of image */
4003 image
= _mesa_malloc(imageSize
);
4005 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage1DARB");
4008 MEMCPY(image
, data
, imageSize
);
4009 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_1D
, 7);
4013 n
[3].e
= internalFormat
;
4014 n
[4].i
= (GLint
) width
;
4022 if (ctx
->ExecuteFlag
) {
4023 CALL_CompressedTexImage1DARB(ctx
->Exec
,
4024 (target
, level
, internalFormat
, width
,
4025 border
, imageSize
, data
));
4031 static void GLAPIENTRY
4032 save_CompressedTexImage2DARB(GLenum target
, GLint level
,
4033 GLenum internalFormat
, GLsizei width
,
4034 GLsizei height
, GLint border
, GLsizei imageSize
,
4035 const GLvoid
* data
)
4037 GET_CURRENT_CONTEXT(ctx
);
4038 if (target
== GL_PROXY_TEXTURE_2D
) {
4039 /* don't compile, execute immediately */
4040 CALL_CompressedTexImage2DARB(ctx
->Exec
, (target
, level
, internalFormat
,
4041 width
, height
, border
,
4047 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4048 /* make copy of image */
4049 image
= _mesa_malloc(imageSize
);
4051 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage2DARB");
4054 MEMCPY(image
, data
, imageSize
);
4055 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_2D
, 8);
4059 n
[3].e
= internalFormat
;
4060 n
[4].i
= (GLint
) width
;
4061 n
[5].i
= (GLint
) height
;
4069 if (ctx
->ExecuteFlag
) {
4070 CALL_CompressedTexImage2DARB(ctx
->Exec
,
4071 (target
, level
, internalFormat
, width
,
4072 height
, border
, imageSize
, data
));
4078 static void GLAPIENTRY
4079 save_CompressedTexImage3DARB(GLenum target
, GLint level
,
4080 GLenum internalFormat
, GLsizei width
,
4081 GLsizei height
, GLsizei depth
, GLint border
,
4082 GLsizei imageSize
, const GLvoid
* data
)
4084 GET_CURRENT_CONTEXT(ctx
);
4085 if (target
== GL_PROXY_TEXTURE_3D
) {
4086 /* don't compile, execute immediately */
4087 CALL_CompressedTexImage3DARB(ctx
->Exec
, (target
, level
, internalFormat
,
4088 width
, height
, depth
, border
,
4094 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4095 /* make copy of image */
4096 image
= _mesa_malloc(imageSize
);
4098 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage3DARB");
4101 MEMCPY(image
, data
, imageSize
);
4102 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_3D
, 9);
4106 n
[3].e
= internalFormat
;
4107 n
[4].i
= (GLint
) width
;
4108 n
[5].i
= (GLint
) height
;
4109 n
[6].i
= (GLint
) depth
;
4117 if (ctx
->ExecuteFlag
) {
4118 CALL_CompressedTexImage3DARB(ctx
->Exec
,
4119 (target
, level
, internalFormat
, width
,
4120 height
, depth
, border
, imageSize
,
4127 static void GLAPIENTRY
4128 save_CompressedTexSubImage1DARB(GLenum target
, GLint level
, GLint xoffset
,
4129 GLsizei width
, GLenum format
,
4130 GLsizei imageSize
, const GLvoid
* data
)
4135 GET_CURRENT_CONTEXT(ctx
);
4136 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4138 /* make copy of image */
4139 image
= _mesa_malloc(imageSize
);
4141 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage1DARB");
4144 MEMCPY(image
, data
, imageSize
);
4145 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
, 7);
4150 n
[4].i
= (GLint
) width
;
4158 if (ctx
->ExecuteFlag
) {
4159 CALL_CompressedTexSubImage1DARB(ctx
->Exec
, (target
, level
, xoffset
,
4160 width
, format
, imageSize
,
4166 static void GLAPIENTRY
4167 save_CompressedTexSubImage2DARB(GLenum target
, GLint level
, GLint xoffset
,
4168 GLint yoffset
, GLsizei width
, GLsizei height
,
4169 GLenum format
, GLsizei imageSize
,
4170 const GLvoid
* data
)
4175 GET_CURRENT_CONTEXT(ctx
);
4176 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4178 /* make copy of image */
4179 image
= _mesa_malloc(imageSize
);
4181 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage2DARB");
4184 MEMCPY(image
, data
, imageSize
);
4185 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
, 9);
4191 n
[5].i
= (GLint
) width
;
4192 n
[6].i
= (GLint
) height
;
4200 if (ctx
->ExecuteFlag
) {
4201 CALL_CompressedTexSubImage2DARB(ctx
->Exec
,
4202 (target
, level
, xoffset
, yoffset
, width
,
4203 height
, format
, imageSize
, data
));
4208 static void GLAPIENTRY
4209 save_CompressedTexSubImage3DARB(GLenum target
, GLint level
, GLint xoffset
,
4210 GLint yoffset
, GLint zoffset
, GLsizei width
,
4211 GLsizei height
, GLsizei depth
, GLenum format
,
4212 GLsizei imageSize
, const GLvoid
* data
)
4217 GET_CURRENT_CONTEXT(ctx
);
4218 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4220 /* make copy of image */
4221 image
= _mesa_malloc(imageSize
);
4223 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage3DARB");
4226 MEMCPY(image
, data
, imageSize
);
4227 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
, 11);
4234 n
[6].i
= (GLint
) width
;
4235 n
[7].i
= (GLint
) height
;
4236 n
[8].i
= (GLint
) depth
;
4238 n
[10].i
= imageSize
;
4244 if (ctx
->ExecuteFlag
) {
4245 CALL_CompressedTexSubImage3DARB(ctx
->Exec
,
4246 (target
, level
, xoffset
, yoffset
,
4247 zoffset
, width
, height
, depth
, format
,
4253 /* GL_ARB_multisample */
4254 static void GLAPIENTRY
4255 save_SampleCoverageARB(GLclampf value
, GLboolean invert
)
4257 GET_CURRENT_CONTEXT(ctx
);
4259 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4260 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SAMPLE_COVERAGE
, 2);
4265 if (ctx
->ExecuteFlag
) {
4266 CALL_SampleCoverageARB(ctx
->Exec
, (value
, invert
));
4272 * GL_NV_vertex_program
4274 #if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
4275 static void GLAPIENTRY
4276 save_BindProgramNV(GLenum target
, GLuint id
)
4278 GET_CURRENT_CONTEXT(ctx
);
4280 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4281 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BIND_PROGRAM_NV
, 2);
4286 if (ctx
->ExecuteFlag
) {
4287 CALL_BindProgramNV(ctx
->Exec
, (target
, id
));
4291 static void GLAPIENTRY
4292 save_ProgramEnvParameter4fARB(GLenum target
, GLuint index
,
4293 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4295 GET_CURRENT_CONTEXT(ctx
);
4297 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4298 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4307 if (ctx
->ExecuteFlag
) {
4308 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4313 static void GLAPIENTRY
4314 save_ProgramEnvParameter4fvARB(GLenum target
, GLuint index
,
4315 const GLfloat
*params
)
4317 save_ProgramEnvParameter4fARB(target
, index
, params
[0], params
[1],
4318 params
[2], params
[3]);
4322 static void GLAPIENTRY
4323 save_ProgramEnvParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4324 const GLfloat
* params
)
4326 GET_CURRENT_CONTEXT(ctx
);
4328 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4332 const GLfloat
* p
= params
;
4334 for (i
= 0 ; i
< count
; i
++) {
4335 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4348 if (ctx
->ExecuteFlag
) {
4349 CALL_ProgramEnvParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4354 static void GLAPIENTRY
4355 save_ProgramEnvParameter4dARB(GLenum target
, GLuint index
,
4356 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4358 save_ProgramEnvParameter4fARB(target
, index
,
4360 (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4364 static void GLAPIENTRY
4365 save_ProgramEnvParameter4dvARB(GLenum target
, GLuint index
,
4366 const GLdouble
*params
)
4368 save_ProgramEnvParameter4fARB(target
, index
,
4369 (GLfloat
) params
[0],
4370 (GLfloat
) params
[1],
4371 (GLfloat
) params
[2], (GLfloat
) params
[3]);
4374 #endif /* FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program || FEATURE_NV_vertex_program */
4376 #if FEATURE_NV_vertex_program
4377 static void GLAPIENTRY
4378 save_ExecuteProgramNV(GLenum target
, GLuint id
, const GLfloat
*params
)
4380 GET_CURRENT_CONTEXT(ctx
);
4382 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4383 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EXECUTE_PROGRAM_NV
, 6);
4392 if (ctx
->ExecuteFlag
) {
4393 CALL_ExecuteProgramNV(ctx
->Exec
, (target
, id
, params
));
4398 static void GLAPIENTRY
4399 save_ProgramParameters4dvNV(GLenum target
, GLuint index
,
4400 GLuint num
, const GLdouble
*params
)
4403 for (i
= 0; i
< num
; i
++) {
4404 save_ProgramEnvParameter4dvARB(target
, index
+ i
, params
+ 4 * i
);
4409 static void GLAPIENTRY
4410 save_ProgramParameters4fvNV(GLenum target
, GLuint index
,
4411 GLuint num
, const GLfloat
*params
)
4414 for (i
= 0; i
< num
; i
++) {
4415 save_ProgramEnvParameter4fvARB(target
, index
+ i
, params
+ 4 * i
);
4420 static void GLAPIENTRY
4421 save_LoadProgramNV(GLenum target
, GLuint id
, GLsizei len
,
4422 const GLubyte
* program
)
4424 GET_CURRENT_CONTEXT(ctx
);
4426 GLubyte
*programCopy
;
4428 programCopy
= (GLubyte
*) _mesa_malloc(len
);
4430 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glLoadProgramNV");
4433 _mesa_memcpy(programCopy
, program
, len
);
4435 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4436 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LOAD_PROGRAM_NV
, 4);
4441 n
[4].data
= programCopy
;
4443 if (ctx
->ExecuteFlag
) {
4444 CALL_LoadProgramNV(ctx
->Exec
, (target
, id
, len
, program
));
4449 static void GLAPIENTRY
4450 save_RequestResidentProgramsNV(GLsizei num
, const GLuint
* ids
)
4452 GET_CURRENT_CONTEXT(ctx
);
4454 GLuint
*idCopy
= (GLuint
*) _mesa_malloc(num
* sizeof(GLuint
));
4456 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glRequestResidentProgramsNV");
4459 _mesa_memcpy(idCopy
, ids
, num
* sizeof(GLuint
));
4460 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4461 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TRACK_MATRIX_NV
, 2);
4466 if (ctx
->ExecuteFlag
) {
4467 CALL_RequestResidentProgramsNV(ctx
->Exec
, (num
, ids
));
4472 static void GLAPIENTRY
4473 save_TrackMatrixNV(GLenum target
, GLuint address
,
4474 GLenum matrix
, GLenum transform
)
4476 GET_CURRENT_CONTEXT(ctx
);
4478 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4479 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TRACK_MATRIX_NV
, 4);
4486 if (ctx
->ExecuteFlag
) {
4487 CALL_TrackMatrixNV(ctx
->Exec
, (target
, address
, matrix
, transform
));
4490 #endif /* FEATURE_NV_vertex_program */
4494 * GL_NV_fragment_program
4496 #if FEATURE_NV_fragment_program
4497 static void GLAPIENTRY
4498 save_ProgramLocalParameter4fARB(GLenum target
, GLuint index
,
4499 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4501 GET_CURRENT_CONTEXT(ctx
);
4503 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4504 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4513 if (ctx
->ExecuteFlag
) {
4514 CALL_ProgramLocalParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4519 static void GLAPIENTRY
4520 save_ProgramLocalParameter4fvARB(GLenum target
, GLuint index
,
4521 const GLfloat
*params
)
4523 GET_CURRENT_CONTEXT(ctx
);
4525 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4526 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4535 if (ctx
->ExecuteFlag
) {
4536 CALL_ProgramLocalParameter4fvARB(ctx
->Exec
, (target
, index
, params
));
4541 static void GLAPIENTRY
4542 save_ProgramLocalParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4543 const GLfloat
*params
)
4545 GET_CURRENT_CONTEXT(ctx
);
4547 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4551 const GLfloat
* p
= params
;
4553 for (i
= 0 ; i
< count
; i
++) {
4554 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4567 if (ctx
->ExecuteFlag
) {
4568 CALL_ProgramLocalParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4573 static void GLAPIENTRY
4574 save_ProgramLocalParameter4dARB(GLenum target
, GLuint index
,
4575 GLdouble x
, GLdouble y
,
4576 GLdouble z
, GLdouble w
)
4578 GET_CURRENT_CONTEXT(ctx
);
4580 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4581 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4585 n
[3].f
= (GLfloat
) x
;
4586 n
[4].f
= (GLfloat
) y
;
4587 n
[5].f
= (GLfloat
) z
;
4588 n
[6].f
= (GLfloat
) w
;
4590 if (ctx
->ExecuteFlag
) {
4591 CALL_ProgramLocalParameter4dARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4596 static void GLAPIENTRY
4597 save_ProgramLocalParameter4dvARB(GLenum target
, GLuint index
,
4598 const GLdouble
*params
)
4600 GET_CURRENT_CONTEXT(ctx
);
4602 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4603 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4607 n
[3].f
= (GLfloat
) params
[0];
4608 n
[4].f
= (GLfloat
) params
[1];
4609 n
[5].f
= (GLfloat
) params
[2];
4610 n
[6].f
= (GLfloat
) params
[3];
4612 if (ctx
->ExecuteFlag
) {
4613 CALL_ProgramLocalParameter4dvARB(ctx
->Exec
, (target
, index
, params
));
4617 static void GLAPIENTRY
4618 save_ProgramNamedParameter4fNV(GLuint id
, GLsizei len
, const GLubyte
* name
,
4619 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4621 GET_CURRENT_CONTEXT(ctx
);
4623 GLubyte
*nameCopy
= (GLubyte
*) _mesa_malloc(len
);
4625 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramNamedParameter4fNV");
4628 _mesa_memcpy(nameCopy
, name
, len
);
4630 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4631 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_NAMED_PARAMETER_NV
, 6);
4635 n
[3].data
= nameCopy
;
4641 if (ctx
->ExecuteFlag
) {
4642 CALL_ProgramNamedParameter4fNV(ctx
->Exec
, (id
, len
, name
, x
, y
, z
, w
));
4647 static void GLAPIENTRY
4648 save_ProgramNamedParameter4fvNV(GLuint id
, GLsizei len
, const GLubyte
* name
,
4651 save_ProgramNamedParameter4fNV(id
, len
, name
, v
[0], v
[1], v
[2], v
[3]);
4655 static void GLAPIENTRY
4656 save_ProgramNamedParameter4dNV(GLuint id
, GLsizei len
, const GLubyte
* name
,
4657 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4659 save_ProgramNamedParameter4fNV(id
, len
, name
, (GLfloat
) x
, (GLfloat
) y
,
4660 (GLfloat
) z
, (GLfloat
) w
);
4664 static void GLAPIENTRY
4665 save_ProgramNamedParameter4dvNV(GLuint id
, GLsizei len
, const GLubyte
* name
,
4668 save_ProgramNamedParameter4fNV(id
, len
, name
, (GLfloat
) v
[0],
4669 (GLfloat
) v
[1], (GLfloat
) v
[2],
4673 #endif /* FEATURE_NV_fragment_program */
4677 /* GL_EXT_stencil_two_side */
4678 static void GLAPIENTRY
4679 save_ActiveStencilFaceEXT(GLenum face
)
4681 GET_CURRENT_CONTEXT(ctx
);
4683 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4684 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ACTIVE_STENCIL_FACE_EXT
, 1);
4688 if (ctx
->ExecuteFlag
) {
4689 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (face
));
4694 /* GL_EXT_depth_bounds_test */
4695 static void GLAPIENTRY
4696 save_DepthBoundsEXT(GLclampd zmin
, GLclampd zmax
)
4698 GET_CURRENT_CONTEXT(ctx
);
4700 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4701 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DEPTH_BOUNDS_EXT
, 2);
4703 n
[1].f
= (GLfloat
) zmin
;
4704 n
[2].f
= (GLfloat
) zmax
;
4706 if (ctx
->ExecuteFlag
) {
4707 CALL_DepthBoundsEXT(ctx
->Exec
, (zmin
, zmax
));
4713 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
4715 static void GLAPIENTRY
4716 save_ProgramStringARB(GLenum target
, GLenum format
, GLsizei len
,
4717 const GLvoid
* string
)
4719 GET_CURRENT_CONTEXT(ctx
);
4721 GLubyte
*programCopy
;
4723 programCopy
= (GLubyte
*) _mesa_malloc(len
);
4725 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramStringARB");
4728 _mesa_memcpy(programCopy
, string
, len
);
4730 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4731 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_STRING_ARB
, 4);
4736 n
[4].data
= programCopy
;
4738 if (ctx
->ExecuteFlag
) {
4739 CALL_ProgramStringARB(ctx
->Exec
, (target
, format
, len
, string
));
4743 #endif /* FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program */
4746 #if FEATURE_ARB_occlusion_query
4748 static void GLAPIENTRY
4749 save_BeginQueryARB(GLenum target
, GLuint id
)
4751 GET_CURRENT_CONTEXT(ctx
);
4753 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4754 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BEGIN_QUERY_ARB
, 2);
4759 if (ctx
->ExecuteFlag
) {
4760 CALL_BeginQueryARB(ctx
->Exec
, (target
, id
));
4765 static void GLAPIENTRY
4766 save_EndQueryARB(GLenum target
)
4768 GET_CURRENT_CONTEXT(ctx
);
4770 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4771 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_END_QUERY_ARB
, 1);
4775 if (ctx
->ExecuteFlag
) {
4776 CALL_EndQueryARB(ctx
->Exec
, (target
));
4780 #endif /* FEATURE_ARB_occlusion_query */
4783 static void GLAPIENTRY
4784 save_DrawBuffersARB(GLsizei count
, const GLenum
* buffers
)
4786 GET_CURRENT_CONTEXT(ctx
);
4788 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4789 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DRAW_BUFFERS_ARB
, 1 + MAX_DRAW_BUFFERS
);
4793 if (count
> MAX_DRAW_BUFFERS
)
4794 count
= MAX_DRAW_BUFFERS
;
4795 for (i
= 0; i
< count
; i
++) {
4796 n
[2 + i
].e
= buffers
[i
];
4799 if (ctx
->ExecuteFlag
) {
4800 CALL_DrawBuffersARB(ctx
->Exec
, (count
, buffers
));
4804 #if FEATURE_ATI_fragment_shader
4805 static void GLAPIENTRY
4806 save_BindFragmentShaderATI(GLuint id
)
4808 GET_CURRENT_CONTEXT(ctx
);
4811 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BIND_FRAGMENT_SHADER_ATI
, 1);
4815 if (ctx
->ExecuteFlag
) {
4816 CALL_BindFragmentShaderATI(ctx
->Exec
, (id
));
4820 static void GLAPIENTRY
4821 save_SetFragmentShaderConstantATI(GLuint dst
, const GLfloat
*value
)
4823 GET_CURRENT_CONTEXT(ctx
);
4826 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
, 5);
4834 if (ctx
->ExecuteFlag
) {
4835 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, value
));
4841 save_Attr1fNV(GLenum attr
, GLfloat x
)
4843 GET_CURRENT_CONTEXT(ctx
);
4845 SAVE_FLUSH_VERTICES(ctx
);
4846 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_1F_NV
, 2);
4852 ASSERT(attr
< MAX_VERTEX_PROGRAM_ATTRIBS
);
4853 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
4854 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
4856 if (ctx
->ExecuteFlag
) {
4857 CALL_VertexAttrib1fNV(ctx
->Exec
, (attr
, x
));
4862 save_Attr2fNV(GLenum attr
, GLfloat x
, GLfloat y
)
4864 GET_CURRENT_CONTEXT(ctx
);
4866 SAVE_FLUSH_VERTICES(ctx
);
4867 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_2F_NV
, 3);
4874 ASSERT(attr
< MAX_VERTEX_PROGRAM_ATTRIBS
);
4875 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
4876 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
4878 if (ctx
->ExecuteFlag
) {
4879 CALL_VertexAttrib2fNV(ctx
->Exec
, (attr
, x
, y
));
4884 save_Attr3fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
4886 GET_CURRENT_CONTEXT(ctx
);
4888 SAVE_FLUSH_VERTICES(ctx
);
4889 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_3F_NV
, 4);
4897 ASSERT(attr
< MAX_VERTEX_PROGRAM_ATTRIBS
);
4898 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
4899 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
4901 if (ctx
->ExecuteFlag
) {
4902 CALL_VertexAttrib3fNV(ctx
->Exec
, (attr
, x
, y
, z
));
4907 save_Attr4fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4909 GET_CURRENT_CONTEXT(ctx
);
4911 SAVE_FLUSH_VERTICES(ctx
);
4912 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_4F_NV
, 5);
4921 ASSERT(attr
< MAX_VERTEX_PROGRAM_ATTRIBS
);
4922 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
4923 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
4925 if (ctx
->ExecuteFlag
) {
4926 CALL_VertexAttrib4fNV(ctx
->Exec
, (attr
, x
, y
, z
, w
));
4932 save_Attr1fARB(GLenum attr
, GLfloat x
)
4934 GET_CURRENT_CONTEXT(ctx
);
4936 SAVE_FLUSH_VERTICES(ctx
);
4937 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_1F_ARB
, 2);
4943 ASSERT(attr
< MAX_VERTEX_ATTRIBS
);
4944 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
4945 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
4947 if (ctx
->ExecuteFlag
) {
4948 CALL_VertexAttrib1fARB(ctx
->Exec
, (attr
, x
));
4953 save_Attr2fARB(GLenum attr
, GLfloat x
, GLfloat y
)
4955 GET_CURRENT_CONTEXT(ctx
);
4957 SAVE_FLUSH_VERTICES(ctx
);
4958 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_2F_ARB
, 3);
4965 ASSERT(attr
< MAX_VERTEX_ATTRIBS
);
4966 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
4967 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
4969 if (ctx
->ExecuteFlag
) {
4970 CALL_VertexAttrib2fARB(ctx
->Exec
, (attr
, x
, y
));
4975 save_Attr3fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
4977 GET_CURRENT_CONTEXT(ctx
);
4979 SAVE_FLUSH_VERTICES(ctx
);
4980 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_3F_ARB
, 4);
4988 ASSERT(attr
< MAX_VERTEX_ATTRIBS
);
4989 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
4990 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
4992 if (ctx
->ExecuteFlag
) {
4993 CALL_VertexAttrib3fARB(ctx
->Exec
, (attr
, x
, y
, z
));
4998 save_Attr4fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5000 GET_CURRENT_CONTEXT(ctx
);
5002 SAVE_FLUSH_VERTICES(ctx
);
5003 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_4F_ARB
, 5);
5012 ASSERT(attr
< MAX_VERTEX_ATTRIBS
);
5013 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5014 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5016 if (ctx
->ExecuteFlag
) {
5017 CALL_VertexAttrib4fARB(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5022 static void GLAPIENTRY
5023 save_EvalCoord1f(GLfloat x
)
5025 GET_CURRENT_CONTEXT(ctx
);
5027 SAVE_FLUSH_VERTICES(ctx
);
5028 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVAL_C1
, 1);
5032 if (ctx
->ExecuteFlag
) {
5033 CALL_EvalCoord1f(ctx
->Exec
, (x
));
5037 static void GLAPIENTRY
5038 save_EvalCoord1fv(const GLfloat
* v
)
5040 save_EvalCoord1f(v
[0]);
5043 static void GLAPIENTRY
5044 save_EvalCoord2f(GLfloat x
, GLfloat y
)
5046 GET_CURRENT_CONTEXT(ctx
);
5048 SAVE_FLUSH_VERTICES(ctx
);
5049 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVAL_C2
, 2);
5054 if (ctx
->ExecuteFlag
) {
5055 CALL_EvalCoord2f(ctx
->Exec
, (x
, y
));
5059 static void GLAPIENTRY
5060 save_EvalCoord2fv(const GLfloat
* v
)
5062 save_EvalCoord2f(v
[0], v
[1]);
5066 static void GLAPIENTRY
5067 save_EvalPoint1(GLint x
)
5069 GET_CURRENT_CONTEXT(ctx
);
5071 SAVE_FLUSH_VERTICES(ctx
);
5072 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVAL_P1
, 1);
5076 if (ctx
->ExecuteFlag
) {
5077 CALL_EvalPoint1(ctx
->Exec
, (x
));
5081 static void GLAPIENTRY
5082 save_EvalPoint2(GLint x
, GLint y
)
5084 GET_CURRENT_CONTEXT(ctx
);
5086 SAVE_FLUSH_VERTICES(ctx
);
5087 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVAL_P2
, 2);
5092 if (ctx
->ExecuteFlag
) {
5093 CALL_EvalPoint2(ctx
->Exec
, (x
, y
));
5097 static void GLAPIENTRY
5098 save_Indexf(GLfloat x
)
5100 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, x
);
5103 static void GLAPIENTRY
5104 save_Indexfv(const GLfloat
* v
)
5106 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, v
[0]);
5109 static void GLAPIENTRY
5110 save_EdgeFlag(GLboolean x
)
5112 save_Attr1fNV(VERT_ATTRIB_EDGEFLAG
, x
? (GLfloat
)1.0 : (GLfloat
)0.0);
5115 static void GLAPIENTRY
5116 save_Materialfv(GLenum face
, GLenum pname
, const GLfloat
* param
)
5118 GET_CURRENT_CONTEXT(ctx
);
5122 SAVE_FLUSH_VERTICES(ctx
);
5127 case GL_FRONT_AND_BACK
:
5130 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "material(face)");
5139 case GL_AMBIENT_AND_DIFFUSE
:
5145 case GL_COLOR_INDEXES
:
5149 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "material(pname)");
5153 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MATERIAL
, 6);
5157 for (i
= 0; i
< args
; i
++)
5158 n
[3 + i
].f
= param
[i
];
5162 GLuint bitmask
= _mesa_material_bitmask(ctx
, face
, pname
, ~0, NULL
);
5163 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++)
5164 if (bitmask
& (1 << i
)) {
5165 ctx
->ListState
.ActiveMaterialSize
[i
] = args
;
5166 COPY_SZ_4V(ctx
->ListState
.CurrentMaterial
[i
], args
, param
);
5170 if (ctx
->ExecuteFlag
) {
5171 CALL_Materialfv(ctx
->Exec
, (face
, pname
, param
));
5175 static void GLAPIENTRY
5176 save_Begin(GLenum mode
)
5178 GET_CURRENT_CONTEXT(ctx
);
5180 GLboolean error
= GL_FALSE
;
5182 if ( /*mode < GL_POINTS || */ mode
> GL_POLYGON
) {
5183 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "Begin (mode)");
5186 else if (ctx
->Driver
.CurrentSavePrimitive
== PRIM_UNKNOWN
) {
5187 /* Typically the first begin. This may raise an error on
5188 * playback, depending on whether CallList is issued from inside
5189 * a begin/end or not.
5191 ctx
->Driver
.CurrentSavePrimitive
= PRIM_INSIDE_UNKNOWN_PRIM
;
5193 else if (ctx
->Driver
.CurrentSavePrimitive
== PRIM_OUTSIDE_BEGIN_END
) {
5194 ctx
->Driver
.CurrentSavePrimitive
= mode
;
5197 _mesa_compile_error(ctx
, GL_INVALID_OPERATION
, "recursive begin");
5202 /* Give the driver an opportunity to hook in an optimized
5203 * display list compiler.
5205 if (ctx
->Driver
.NotifySaveBegin(ctx
, mode
))
5208 SAVE_FLUSH_VERTICES(ctx
);
5209 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BEGIN
, 1);
5215 if (ctx
->ExecuteFlag
) {
5216 CALL_Begin(ctx
->Exec
, (mode
));
5220 static void GLAPIENTRY
5223 GET_CURRENT_CONTEXT(ctx
);
5224 SAVE_FLUSH_VERTICES(ctx
);
5225 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_END
, 0);
5226 ctx
->Driver
.CurrentSavePrimitive
= PRIM_OUTSIDE_BEGIN_END
;
5227 if (ctx
->ExecuteFlag
) {
5228 CALL_End(ctx
->Exec
, ());
5232 static void GLAPIENTRY
5233 save_Rectf(GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
5235 GET_CURRENT_CONTEXT(ctx
);
5237 SAVE_FLUSH_VERTICES(ctx
);
5238 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_RECTF
, 4);
5245 if (ctx
->ExecuteFlag
) {
5246 CALL_Rectf(ctx
->Exec
, (a
, b
, c
, d
));
5251 static void GLAPIENTRY
5252 save_Vertex2f(GLfloat x
, GLfloat y
)
5254 save_Attr2fNV(VERT_ATTRIB_POS
, x
, y
);
5257 static void GLAPIENTRY
5258 save_Vertex2fv(const GLfloat
* v
)
5260 save_Attr2fNV(VERT_ATTRIB_POS
, v
[0], v
[1]);
5263 static void GLAPIENTRY
5264 save_Vertex3f(GLfloat x
, GLfloat y
, GLfloat z
)
5266 save_Attr3fNV(VERT_ATTRIB_POS
, x
, y
, z
);
5269 static void GLAPIENTRY
5270 save_Vertex3fv(const GLfloat
* v
)
5272 save_Attr3fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2]);
5275 static void GLAPIENTRY
5276 save_Vertex4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5278 save_Attr4fNV(VERT_ATTRIB_POS
, x
, y
, z
, w
);
5281 static void GLAPIENTRY
5282 save_Vertex4fv(const GLfloat
* v
)
5284 save_Attr4fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2], v
[3]);
5287 static void GLAPIENTRY
5288 save_TexCoord1f(GLfloat x
)
5290 save_Attr1fNV(VERT_ATTRIB_TEX0
, x
);
5293 static void GLAPIENTRY
5294 save_TexCoord1fv(const GLfloat
* v
)
5296 save_Attr1fNV(VERT_ATTRIB_TEX0
, v
[0]);
5299 static void GLAPIENTRY
5300 save_TexCoord2f(GLfloat x
, GLfloat y
)
5302 save_Attr2fNV(VERT_ATTRIB_TEX0
, x
, y
);
5305 static void GLAPIENTRY
5306 save_TexCoord2fv(const GLfloat
* v
)
5308 save_Attr2fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1]);
5311 static void GLAPIENTRY
5312 save_TexCoord3f(GLfloat x
, GLfloat y
, GLfloat z
)
5314 save_Attr3fNV(VERT_ATTRIB_TEX0
, x
, y
, z
);
5317 static void GLAPIENTRY
5318 save_TexCoord3fv(const GLfloat
* v
)
5320 save_Attr3fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2]);
5323 static void GLAPIENTRY
5324 save_TexCoord4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5326 save_Attr4fNV(VERT_ATTRIB_TEX0
, x
, y
, z
, w
);
5329 static void GLAPIENTRY
5330 save_TexCoord4fv(const GLfloat
* v
)
5332 save_Attr4fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2], v
[3]);
5335 static void GLAPIENTRY
5336 save_Normal3f(GLfloat x
, GLfloat y
, GLfloat z
)
5338 save_Attr3fNV(VERT_ATTRIB_NORMAL
, x
, y
, z
);
5341 static void GLAPIENTRY
5342 save_Normal3fv(const GLfloat
* v
)
5344 save_Attr3fNV(VERT_ATTRIB_NORMAL
, v
[0], v
[1], v
[2]);
5347 static void GLAPIENTRY
5348 save_FogCoordfEXT(GLfloat x
)
5350 save_Attr1fNV(VERT_ATTRIB_FOG
, x
);
5353 static void GLAPIENTRY
5354 save_FogCoordfvEXT(const GLfloat
* v
)
5356 save_Attr1fNV(VERT_ATTRIB_FOG
, v
[0]);
5359 static void GLAPIENTRY
5360 save_Color3f(GLfloat x
, GLfloat y
, GLfloat z
)
5362 save_Attr3fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
);
5365 static void GLAPIENTRY
5366 save_Color3fv(const GLfloat
* v
)
5368 save_Attr3fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2]);
5371 static void GLAPIENTRY
5372 save_Color4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5374 save_Attr4fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
, w
);
5377 static void GLAPIENTRY
5378 save_Color4fv(const GLfloat
* v
)
5380 save_Attr4fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2], v
[3]);
5383 static void GLAPIENTRY
5384 save_SecondaryColor3fEXT(GLfloat x
, GLfloat y
, GLfloat z
)
5386 save_Attr3fNV(VERT_ATTRIB_COLOR1
, x
, y
, z
);
5389 static void GLAPIENTRY
5390 save_SecondaryColor3fvEXT(const GLfloat
* v
)
5392 save_Attr3fNV(VERT_ATTRIB_COLOR1
, v
[0], v
[1], v
[2]);
5396 /* Just call the respective ATTR for texcoord
5398 static void GLAPIENTRY
5399 save_MultiTexCoord1f(GLenum target
, GLfloat x
)
5401 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5402 save_Attr1fNV(attr
, x
);
5405 static void GLAPIENTRY
5406 save_MultiTexCoord1fv(GLenum target
, const GLfloat
* v
)
5408 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5409 save_Attr1fNV(attr
, v
[0]);
5412 static void GLAPIENTRY
5413 save_MultiTexCoord2f(GLenum target
, GLfloat x
, GLfloat y
)
5415 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5416 save_Attr2fNV(attr
, x
, y
);
5419 static void GLAPIENTRY
5420 save_MultiTexCoord2fv(GLenum target
, const GLfloat
* v
)
5422 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5423 save_Attr2fNV(attr
, v
[0], v
[1]);
5426 static void GLAPIENTRY
5427 save_MultiTexCoord3f(GLenum target
, GLfloat x
, GLfloat y
, GLfloat z
)
5429 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5430 save_Attr3fNV(attr
, x
, y
, z
);
5433 static void GLAPIENTRY
5434 save_MultiTexCoord3fv(GLenum target
, const GLfloat
* v
)
5436 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5437 save_Attr3fNV(attr
, v
[0], v
[1], v
[2]);
5440 static void GLAPIENTRY
5441 save_MultiTexCoord4f(GLenum target
, GLfloat x
, GLfloat y
,
5442 GLfloat z
, GLfloat w
)
5444 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5445 save_Attr4fNV(attr
, x
, y
, z
, w
);
5448 static void GLAPIENTRY
5449 save_MultiTexCoord4fv(GLenum target
, const GLfloat
* v
)
5451 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5452 save_Attr4fNV(attr
, v
[0], v
[1], v
[2], v
[3]);
5457 * Record a GL_INVALID_VALUE error when a invalid vertex attribute
5463 GET_CURRENT_CONTEXT(ctx
);
5464 _mesa_error(ctx
, GL_INVALID_VALUE
, "VertexAttribf(index)");
5468 /* First level for NV_vertex_program:
5470 * Check for errors at compile time?.
5472 static void GLAPIENTRY
5473 save_VertexAttrib1fNV(GLuint index
, GLfloat x
)
5475 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5476 save_Attr1fNV(index
, x
);
5481 static void GLAPIENTRY
5482 save_VertexAttrib1fvNV(GLuint index
, const GLfloat
* v
)
5484 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5485 save_Attr1fNV(index
, v
[0]);
5490 static void GLAPIENTRY
5491 save_VertexAttrib2fNV(GLuint index
, GLfloat x
, GLfloat y
)
5493 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5494 save_Attr2fNV(index
, x
, y
);
5499 static void GLAPIENTRY
5500 save_VertexAttrib2fvNV(GLuint index
, const GLfloat
* v
)
5502 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5503 save_Attr2fNV(index
, v
[0], v
[1]);
5508 static void GLAPIENTRY
5509 save_VertexAttrib3fNV(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
5511 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5512 save_Attr3fNV(index
, x
, y
, z
);
5517 static void GLAPIENTRY
5518 save_VertexAttrib3fvNV(GLuint index
, const GLfloat
* v
)
5520 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5521 save_Attr3fNV(index
, v
[0], v
[1], v
[2]);
5526 static void GLAPIENTRY
5527 save_VertexAttrib4fNV(GLuint index
, GLfloat x
, GLfloat y
,
5528 GLfloat z
, GLfloat w
)
5530 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5531 save_Attr4fNV(index
, x
, y
, z
, w
);
5536 static void GLAPIENTRY
5537 save_VertexAttrib4fvNV(GLuint index
, const GLfloat
* v
)
5539 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5540 save_Attr4fNV(index
, v
[0], v
[1], v
[2], v
[3]);
5548 static void GLAPIENTRY
5549 save_VertexAttrib1fARB(GLuint index
, GLfloat x
)
5551 if (index
< MAX_VERTEX_ATTRIBS
)
5552 save_Attr1fARB(index
, x
);
5557 static void GLAPIENTRY
5558 save_VertexAttrib1fvARB(GLuint index
, const GLfloat
* v
)
5560 if (index
< MAX_VERTEX_ATTRIBS
)
5561 save_Attr1fARB(index
, v
[0]);
5566 static void GLAPIENTRY
5567 save_VertexAttrib2fARB(GLuint index
, GLfloat x
, GLfloat y
)
5569 if (index
< MAX_VERTEX_ATTRIBS
)
5570 save_Attr2fARB(index
, x
, y
);
5575 static void GLAPIENTRY
5576 save_VertexAttrib2fvARB(GLuint index
, const GLfloat
* v
)
5578 if (index
< MAX_VERTEX_ATTRIBS
)
5579 save_Attr2fARB(index
, v
[0], v
[1]);
5584 static void GLAPIENTRY
5585 save_VertexAttrib3fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
5587 if (index
< MAX_VERTEX_ATTRIBS
)
5588 save_Attr3fARB(index
, x
, y
, z
);
5593 static void GLAPIENTRY
5594 save_VertexAttrib3fvARB(GLuint index
, const GLfloat
* v
)
5596 if (index
< MAX_VERTEX_ATTRIBS
)
5597 save_Attr3fARB(index
, v
[0], v
[1], v
[2]);
5602 static void GLAPIENTRY
5603 save_VertexAttrib4fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
,
5606 if (index
< MAX_VERTEX_ATTRIBS
)
5607 save_Attr4fARB(index
, x
, y
, z
, w
);
5612 static void GLAPIENTRY
5613 save_VertexAttrib4fvARB(GLuint index
, const GLfloat
* v
)
5615 if (index
< MAX_VERTEX_ATTRIBS
)
5616 save_Attr4fARB(index
, v
[0], v
[1], v
[2], v
[3]);
5622 /* GL_ARB_shader_objects, GL_ARB_vertex/fragment_shader */
5624 static void GLAPIENTRY
5625 exec_BindAttribLocationARB(GLuint program
, GLuint index
, const GLchar
*name
)
5627 GET_CURRENT_CONTEXT(ctx
);
5628 FLUSH_VERTICES(ctx
, 0);
5629 CALL_BindAttribLocationARB(ctx
->Exec
, (program
, index
, name
));
5632 static GLint GLAPIENTRY
5633 exec_GetAttribLocationARB(GLuint program
, const GLchar
*name
)
5635 GET_CURRENT_CONTEXT(ctx
);
5636 FLUSH_VERTICES(ctx
, 0);
5637 return CALL_GetAttribLocationARB(ctx
->Exec
, (program
, name
));
5639 /* XXX more shader functions needed here */
5643 #if FEATURE_EXT_framebuffer_blit
5644 static void GLAPIENTRY
5645 save_BlitFramebufferEXT(GLint srcX0
, GLint srcY0
, GLint srcX1
, GLint srcY1
,
5646 GLint dstX0
, GLint dstY0
, GLint dstX1
, GLint dstY1
,
5647 GLbitfield mask
, GLenum filter
)
5649 GET_CURRENT_CONTEXT(ctx
);
5651 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5652 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BLIT_FRAMEBUFFER
, 10);
5665 if (ctx
->ExecuteFlag
) {
5666 CALL_BlitFramebufferEXT(ctx
->Exec
, (srcX0
, srcY0
, srcX1
, srcY1
,
5667 dstX0
, dstY0
, dstX1
, dstY1
,
5675 * Save an error-generating command into display list.
5677 * KW: Will appear in the list before the vertex buffer containing the
5678 * command that provoked the error. I don't see this as a problem.
5681 save_error(GLcontext
*ctx
, GLenum error
, const char *s
)
5684 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ERROR
, 2);
5687 n
[2].data
= (void *) s
;
5693 * Compile an error into current display list.
5696 _mesa_compile_error(GLcontext
*ctx
, GLenum error
, const char *s
)
5698 if (ctx
->CompileFlag
)
5699 save_error(ctx
, error
, s
);
5700 if (ctx
->ExecuteFlag
)
5701 _mesa_error(ctx
, error
, s
);
5706 * Test if ID names a display list.
5709 islist(GLcontext
*ctx
, GLuint list
)
5711 if (list
> 0 && lookup_list(ctx
, list
)) {
5721 /**********************************************************************/
5722 /* Display list execution */
5723 /**********************************************************************/
5727 * Execute a display list. Note that the ListBase offset must have already
5728 * been added before calling this function. I.e. the list argument is
5729 * the absolute list number, not relative to ListBase.
5730 * \param list - display list number
5733 execute_list(GLcontext
*ctx
, GLuint list
)
5735 struct mesa_display_list
*dlist
;
5739 if (list
== 0 || !islist(ctx
, list
))
5742 if (ctx
->ListState
.CallDepth
== MAX_LIST_NESTING
) {
5743 /* raise an error? */
5747 dlist
= lookup_list(ctx
, list
);
5751 ctx
->ListState
.CallDepth
++;
5753 if (ctx
->Driver
.BeginCallList
)
5754 ctx
->Driver
.BeginCallList(ctx
, dlist
);
5760 OpCode opcode
= n
[0].opcode
;
5761 int i
= (int) n
[0].opcode
- (int) OPCODE_EXT_0
;
5763 if (i
>= 0 && i
< (GLint
) ctx
->ListExt
.NumOpcodes
) {
5764 /* this is a driver-extended opcode */
5765 ctx
->ListExt
.Opcode
[i
].Execute(ctx
, &n
[1]);
5766 n
+= ctx
->ListExt
.Opcode
[i
].Size
;
5771 _mesa_error(ctx
, n
[1].e
, (const char *) n
[2].data
);
5774 CALL_Accum(ctx
->Exec
, (n
[1].e
, n
[2].f
));
5776 case OPCODE_ALPHA_FUNC
:
5777 CALL_AlphaFunc(ctx
->Exec
, (n
[1].e
, n
[2].f
));
5779 case OPCODE_BIND_TEXTURE
:
5780 CALL_BindTexture(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
5784 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5785 ctx
->Unpack
= ctx
->DefaultPacking
;
5786 CALL_Bitmap(ctx
->Exec
, ((GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
5787 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
5788 (const GLubyte
*) n
[7].data
));
5789 ctx
->Unpack
= save
; /* restore */
5792 case OPCODE_BLEND_COLOR
:
5793 CALL_BlendColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
5795 case OPCODE_BLEND_EQUATION
:
5796 CALL_BlendEquation(ctx
->Exec
, (n
[1].e
));
5798 case OPCODE_BLEND_EQUATION_SEPARATE
:
5799 CALL_BlendEquationSeparateEXT(ctx
->Exec
, (n
[1].e
, n
[2].e
));
5801 case OPCODE_BLEND_FUNC_SEPARATE
:
5802 CALL_BlendFuncSeparateEXT(ctx
->Exec
,
5803 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
5805 case OPCODE_CALL_LIST
:
5806 /* Generated by glCallList(), don't add ListBase */
5807 if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
5808 execute_list(ctx
, n
[1].ui
);
5811 case OPCODE_CALL_LIST_OFFSET
:
5812 /* Generated by glCallLists() so we must add ListBase */
5814 /* user specified a bad data type at compile time */
5815 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
5817 else if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
5818 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ n
[1].i
);
5819 execute_list(ctx
, list
);
5823 CALL_Clear(ctx
->Exec
, (n
[1].bf
));
5825 case OPCODE_CLEAR_COLOR
:
5826 CALL_ClearColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
5828 case OPCODE_CLEAR_ACCUM
:
5829 CALL_ClearAccum(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
5831 case OPCODE_CLEAR_DEPTH
:
5832 CALL_ClearDepth(ctx
->Exec
, ((GLclampd
) n
[1].f
));
5834 case OPCODE_CLEAR_INDEX
:
5835 CALL_ClearIndex(ctx
->Exec
, ((GLfloat
) n
[1].ui
));
5837 case OPCODE_CLEAR_STENCIL
:
5838 CALL_ClearStencil(ctx
->Exec
, (n
[1].i
));
5840 case OPCODE_CLIP_PLANE
:
5847 CALL_ClipPlane(ctx
->Exec
, (n
[1].e
, eq
));
5850 case OPCODE_COLOR_MASK
:
5851 CALL_ColorMask(ctx
->Exec
, (n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
));
5853 case OPCODE_COLOR_MATERIAL
:
5854 CALL_ColorMaterial(ctx
->Exec
, (n
[1].e
, n
[2].e
));
5856 case OPCODE_COLOR_TABLE
:
5858 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5859 ctx
->Unpack
= ctx
->DefaultPacking
;
5860 CALL_ColorTable(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].e
,
5861 n
[5].e
, n
[6].data
));
5862 ctx
->Unpack
= save
; /* restore */
5865 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
5872 CALL_ColorTableParameterfv(ctx
->Exec
,
5873 (n
[1].e
, n
[2].e
, params
));
5876 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
5883 CALL_ColorTableParameteriv(ctx
->Exec
,
5884 (n
[1].e
, n
[2].e
, params
));
5887 case OPCODE_COLOR_SUB_TABLE
:
5889 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5890 ctx
->Unpack
= ctx
->DefaultPacking
;
5891 CALL_ColorSubTable(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5892 n
[4].e
, n
[5].e
, n
[6].data
));
5893 ctx
->Unpack
= save
; /* restore */
5896 case OPCODE_CONVOLUTION_FILTER_1D
:
5898 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5899 ctx
->Unpack
= ctx
->DefaultPacking
;
5900 CALL_ConvolutionFilter1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5903 ctx
->Unpack
= save
; /* restore */
5906 case OPCODE_CONVOLUTION_FILTER_2D
:
5908 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5909 ctx
->Unpack
= ctx
->DefaultPacking
;
5910 CALL_ConvolutionFilter2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5911 n
[4].i
, n
[5].e
, n
[6].e
,
5913 ctx
->Unpack
= save
; /* restore */
5916 case OPCODE_CONVOLUTION_PARAMETER_I
:
5917 CALL_ConvolutionParameteri(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].i
));
5919 case OPCODE_CONVOLUTION_PARAMETER_IV
:
5926 CALL_ConvolutionParameteriv(ctx
->Exec
,
5927 (n
[1].e
, n
[2].e
, params
));
5930 case OPCODE_CONVOLUTION_PARAMETER_F
:
5931 CALL_ConvolutionParameterf(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].f
));
5933 case OPCODE_CONVOLUTION_PARAMETER_FV
:
5940 CALL_ConvolutionParameterfv(ctx
->Exec
,
5941 (n
[1].e
, n
[2].e
, params
));
5944 case OPCODE_COPY_COLOR_SUB_TABLE
:
5945 CALL_CopyColorSubTable(ctx
->Exec
, (n
[1].e
, n
[2].i
,
5946 n
[3].i
, n
[4].i
, n
[5].i
));
5948 case OPCODE_COPY_COLOR_TABLE
:
5949 CALL_CopyColorSubTable(ctx
->Exec
, (n
[1].e
, n
[2].i
,
5950 n
[3].i
, n
[4].i
, n
[5].i
));
5952 case OPCODE_COPY_PIXELS
:
5953 CALL_CopyPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
,
5954 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
,
5957 case OPCODE_COPY_TEX_IMAGE1D
:
5958 CALL_CopyTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
5959 n
[5].i
, n
[6].i
, n
[7].i
));
5961 case OPCODE_COPY_TEX_IMAGE2D
:
5962 CALL_CopyTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
5963 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
));
5965 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
5966 CALL_CopyTexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5967 n
[4].i
, n
[5].i
, n
[6].i
));
5969 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
5970 CALL_CopyTexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5971 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
5974 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
5975 CALL_CopyTexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5976 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
5979 case OPCODE_CULL_FACE
:
5980 CALL_CullFace(ctx
->Exec
, (n
[1].e
));
5982 case OPCODE_DEPTH_FUNC
:
5983 CALL_DepthFunc(ctx
->Exec
, (n
[1].e
));
5985 case OPCODE_DEPTH_MASK
:
5986 CALL_DepthMask(ctx
->Exec
, (n
[1].b
));
5988 case OPCODE_DEPTH_RANGE
:
5989 CALL_DepthRange(ctx
->Exec
,
5990 ((GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
));
5992 case OPCODE_DISABLE
:
5993 CALL_Disable(ctx
->Exec
, (n
[1].e
));
5995 case OPCODE_DRAW_BUFFER
:
5996 CALL_DrawBuffer(ctx
->Exec
, (n
[1].e
));
5998 case OPCODE_DRAW_PIXELS
:
6000 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6001 ctx
->Unpack
= ctx
->DefaultPacking
;
6002 CALL_DrawPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
6004 ctx
->Unpack
= save
; /* restore */
6008 CALL_Enable(ctx
->Exec
, (n
[1].e
));
6010 case OPCODE_EVALMESH1
:
6011 CALL_EvalMesh1(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
));
6013 case OPCODE_EVALMESH2
:
6014 CALL_EvalMesh2(ctx
->Exec
,
6015 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
6024 CALL_Fogfv(ctx
->Exec
, (n
[1].e
, p
));
6027 case OPCODE_FRONT_FACE
:
6028 CALL_FrontFace(ctx
->Exec
, (n
[1].e
));
6030 case OPCODE_FRUSTUM
:
6031 CALL_Frustum(ctx
->Exec
,
6032 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
6035 CALL_Hint(ctx
->Exec
, (n
[1].e
, n
[2].e
));
6037 case OPCODE_HISTOGRAM
:
6038 CALL_Histogram(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].b
));
6040 case OPCODE_INDEX_MASK
:
6041 CALL_IndexMask(ctx
->Exec
, (n
[1].ui
));
6043 case OPCODE_INIT_NAMES
:
6044 CALL_InitNames(ctx
->Exec
, ());
6053 CALL_Lightfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, p
));
6056 case OPCODE_LIGHT_MODEL
:
6063 CALL_LightModelfv(ctx
->Exec
, (n
[1].e
, p
));
6066 case OPCODE_LINE_STIPPLE
:
6067 CALL_LineStipple(ctx
->Exec
, (n
[1].i
, n
[2].us
));
6069 case OPCODE_LINE_WIDTH
:
6070 CALL_LineWidth(ctx
->Exec
, (n
[1].f
));
6072 case OPCODE_LIST_BASE
:
6073 CALL_ListBase(ctx
->Exec
, (n
[1].ui
));
6075 case OPCODE_LOAD_IDENTITY
:
6076 CALL_LoadIdentity(ctx
->Exec
, ());
6078 case OPCODE_LOAD_MATRIX
:
6079 if (sizeof(Node
) == sizeof(GLfloat
)) {
6080 CALL_LoadMatrixf(ctx
->Exec
, (&n
[1].f
));
6085 for (i
= 0; i
< 16; i
++) {
6088 CALL_LoadMatrixf(ctx
->Exec
, (m
));
6091 case OPCODE_LOAD_NAME
:
6092 CALL_LoadName(ctx
->Exec
, (n
[1].ui
));
6094 case OPCODE_LOGIC_OP
:
6095 CALL_LogicOp(ctx
->Exec
, (n
[1].e
));
6099 GLenum target
= n
[1].e
;
6100 GLint ustride
= _mesa_evaluator_components(target
);
6101 GLint uorder
= n
[5].i
;
6102 GLfloat u1
= n
[2].f
;
6103 GLfloat u2
= n
[3].f
;
6104 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
6105 (GLfloat
*) n
[6].data
));
6110 GLenum target
= n
[1].e
;
6111 GLfloat u1
= n
[2].f
;
6112 GLfloat u2
= n
[3].f
;
6113 GLfloat v1
= n
[4].f
;
6114 GLfloat v2
= n
[5].f
;
6115 GLint ustride
= n
[6].i
;
6116 GLint vstride
= n
[7].i
;
6117 GLint uorder
= n
[8].i
;
6118 GLint vorder
= n
[9].i
;
6119 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
6120 v1
, v2
, vstride
, vorder
,
6121 (GLfloat
*) n
[10].data
));
6124 case OPCODE_MAPGRID1
:
6125 CALL_MapGrid1f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
6127 case OPCODE_MAPGRID2
:
6128 CALL_MapGrid2f(ctx
->Exec
,
6129 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
));
6131 case OPCODE_MATRIX_MODE
:
6132 CALL_MatrixMode(ctx
->Exec
, (n
[1].e
));
6134 case OPCODE_MIN_MAX
:
6135 CALL_Minmax(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].b
));
6137 case OPCODE_MULT_MATRIX
:
6138 if (sizeof(Node
) == sizeof(GLfloat
)) {
6139 CALL_MultMatrixf(ctx
->Exec
, (&n
[1].f
));
6144 for (i
= 0; i
< 16; i
++) {
6147 CALL_MultMatrixf(ctx
->Exec
, (m
));
6151 CALL_Ortho(ctx
->Exec
,
6152 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
6154 case OPCODE_PASSTHROUGH
:
6155 CALL_PassThrough(ctx
->Exec
, (n
[1].f
));
6157 case OPCODE_PIXEL_MAP
:
6158 CALL_PixelMapfv(ctx
->Exec
,
6159 (n
[1].e
, n
[2].i
, (GLfloat
*) n
[3].data
));
6161 case OPCODE_PIXEL_TRANSFER
:
6162 CALL_PixelTransferf(ctx
->Exec
, (n
[1].e
, n
[2].f
));
6164 case OPCODE_PIXEL_ZOOM
:
6165 CALL_PixelZoom(ctx
->Exec
, (n
[1].f
, n
[2].f
));
6167 case OPCODE_POINT_SIZE
:
6168 CALL_PointSize(ctx
->Exec
, (n
[1].f
));
6170 case OPCODE_POINT_PARAMETERS
:
6176 CALL_PointParameterfvEXT(ctx
->Exec
, (n
[1].e
, params
));
6179 case OPCODE_POLYGON_MODE
:
6180 CALL_PolygonMode(ctx
->Exec
, (n
[1].e
, n
[2].e
));
6182 case OPCODE_POLYGON_STIPPLE
:
6184 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6185 ctx
->Unpack
= ctx
->DefaultPacking
;
6186 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) n
[1].data
));
6187 ctx
->Unpack
= save
; /* restore */
6190 case OPCODE_POLYGON_OFFSET
:
6191 CALL_PolygonOffset(ctx
->Exec
, (n
[1].f
, n
[2].f
));
6193 case OPCODE_POP_ATTRIB
:
6194 CALL_PopAttrib(ctx
->Exec
, ());
6196 case OPCODE_POP_MATRIX
:
6197 CALL_PopMatrix(ctx
->Exec
, ());
6199 case OPCODE_POP_NAME
:
6200 CALL_PopName(ctx
->Exec
, ());
6202 case OPCODE_PRIORITIZE_TEXTURE
:
6203 CALL_PrioritizeTextures(ctx
->Exec
, (1, &n
[1].ui
, &n
[2].f
));
6205 case OPCODE_PUSH_ATTRIB
:
6206 CALL_PushAttrib(ctx
->Exec
, (n
[1].bf
));
6208 case OPCODE_PUSH_MATRIX
:
6209 CALL_PushMatrix(ctx
->Exec
, ());
6211 case OPCODE_PUSH_NAME
:
6212 CALL_PushName(ctx
->Exec
, (n
[1].ui
));
6214 case OPCODE_RASTER_POS
:
6215 CALL_RasterPos4f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
6217 case OPCODE_READ_BUFFER
:
6218 CALL_ReadBuffer(ctx
->Exec
, (n
[1].e
));
6220 case OPCODE_RESET_HISTOGRAM
:
6221 CALL_ResetHistogram(ctx
->Exec
, (n
[1].e
));
6223 case OPCODE_RESET_MIN_MAX
:
6224 CALL_ResetMinmax(ctx
->Exec
, (n
[1].e
));
6227 CALL_Rotatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
6230 CALL_Scalef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
6232 case OPCODE_SCISSOR
:
6233 CALL_Scissor(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
6235 case OPCODE_SHADE_MODEL
:
6236 CALL_ShadeModel(ctx
->Exec
, (n
[1].e
));
6238 case OPCODE_STENCIL_FUNC
:
6239 CALL_StencilFunc(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].ui
));
6241 case OPCODE_STENCIL_MASK
:
6242 CALL_StencilMask(ctx
->Exec
, (n
[1].ui
));
6244 case OPCODE_STENCIL_OP
:
6245 CALL_StencilOp(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].e
));
6247 case OPCODE_STENCIL_FUNC_SEPARATE
:
6248 CALL_StencilFuncSeparate(ctx
->Exec
,
6249 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].ui
));
6251 case OPCODE_STENCIL_MASK_SEPARATE
:
6252 CALL_StencilMaskSeparate(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
6254 case OPCODE_STENCIL_OP_SEPARATE
:
6255 CALL_StencilOpSeparate(ctx
->Exec
,
6256 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
6265 CALL_TexEnvfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
6275 CALL_TexGenfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
6278 case OPCODE_TEXPARAMETER
:
6285 CALL_TexParameterfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
6288 case OPCODE_TEX_IMAGE1D
:
6290 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6291 ctx
->Unpack
= ctx
->DefaultPacking
;
6292 CALL_TexImage1D(ctx
->Exec
, (n
[1].e
, /* target */
6294 n
[3].i
, /* components */
6296 n
[5].e
, /* border */
6297 n
[6].e
, /* format */
6300 ctx
->Unpack
= save
; /* restore */
6303 case OPCODE_TEX_IMAGE2D
:
6305 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6306 ctx
->Unpack
= ctx
->DefaultPacking
;
6307 CALL_TexImage2D(ctx
->Exec
, (n
[1].e
, /* target */
6309 n
[3].i
, /* components */
6311 n
[5].i
, /* height */
6312 n
[6].e
, /* border */
6313 n
[7].e
, /* format */
6316 ctx
->Unpack
= save
; /* restore */
6319 case OPCODE_TEX_IMAGE3D
:
6321 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6322 ctx
->Unpack
= ctx
->DefaultPacking
;
6323 CALL_TexImage3D(ctx
->Exec
, (n
[1].e
, /* target */
6325 n
[3].i
, /* components */
6327 n
[5].i
, /* height */
6329 n
[7].e
, /* border */
6330 n
[8].e
, /* format */
6333 ctx
->Unpack
= save
; /* restore */
6336 case OPCODE_TEX_SUB_IMAGE1D
:
6338 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6339 ctx
->Unpack
= ctx
->DefaultPacking
;
6340 CALL_TexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
6342 n
[6].e
, n
[7].data
));
6343 ctx
->Unpack
= save
; /* restore */
6346 case OPCODE_TEX_SUB_IMAGE2D
:
6348 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6349 ctx
->Unpack
= ctx
->DefaultPacking
;
6350 CALL_TexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
6352 n
[6].i
, n
[7].e
, n
[8].e
,
6354 ctx
->Unpack
= save
; /* restore */
6357 case OPCODE_TEX_SUB_IMAGE3D
:
6359 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6360 ctx
->Unpack
= ctx
->DefaultPacking
;
6361 CALL_TexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
6362 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
6363 n
[8].i
, n
[9].e
, n
[10].e
,
6365 ctx
->Unpack
= save
; /* restore */
6368 case OPCODE_TRANSLATE
:
6369 CALL_Translatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
6371 case OPCODE_VIEWPORT
:
6372 CALL_Viewport(ctx
->Exec
, (n
[1].i
, n
[2].i
,
6373 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
));
6375 case OPCODE_WINDOW_POS
:
6376 CALL_WindowPos4fMESA(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
6378 case OPCODE_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
6379 CALL_ActiveTextureARB(ctx
->Exec
, (n
[1].e
));
6381 case OPCODE_COMPRESSED_TEX_IMAGE_1D
: /* GL_ARB_texture_compression */
6382 CALL_CompressedTexImage1DARB(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
6383 n
[4].i
, n
[5].i
, n
[6].i
,
6386 case OPCODE_COMPRESSED_TEX_IMAGE_2D
: /* GL_ARB_texture_compression */
6387 CALL_CompressedTexImage2DARB(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
6388 n
[4].i
, n
[5].i
, n
[6].i
,
6389 n
[7].i
, n
[8].data
));
6391 case OPCODE_COMPRESSED_TEX_IMAGE_3D
: /* GL_ARB_texture_compression */
6392 CALL_CompressedTexImage3DARB(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
6393 n
[4].i
, n
[5].i
, n
[6].i
,
6397 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
: /* GL_ARB_texture_compress */
6398 CALL_CompressedTexSubImage1DARB(ctx
->Exec
,
6399 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
6400 n
[5].e
, n
[6].i
, n
[7].data
));
6402 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
: /* GL_ARB_texture_compress */
6403 CALL_CompressedTexSubImage2DARB(ctx
->Exec
,
6404 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
6405 n
[5].i
, n
[6].i
, n
[7].e
, n
[8].i
,
6408 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
: /* GL_ARB_texture_compress */
6409 CALL_CompressedTexSubImage3DARB(ctx
->Exec
,
6410 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
6411 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
6412 n
[9].e
, n
[10].i
, n
[11].data
));
6414 case OPCODE_SAMPLE_COVERAGE
: /* GL_ARB_multisample */
6415 CALL_SampleCoverageARB(ctx
->Exec
, (n
[1].f
, n
[2].b
));
6417 case OPCODE_WINDOW_POS_ARB
: /* GL_ARB_window_pos */
6418 CALL_WindowPos3fMESA(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
6420 #if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
6421 case OPCODE_BIND_PROGRAM_NV
: /* GL_NV_vertex_program */
6422 CALL_BindProgramNV(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
6425 #if FEATURE_NV_vertex_program
6426 case OPCODE_EXECUTE_PROGRAM_NV
:
6433 CALL_ExecuteProgramNV(ctx
->Exec
, (n
[1].e
, n
[2].ui
, v
));
6436 case OPCODE_REQUEST_RESIDENT_PROGRAMS_NV
:
6437 CALL_RequestResidentProgramsNV(ctx
->Exec
, (n
[1].ui
,
6438 (GLuint
*) n
[2].data
));
6440 case OPCODE_LOAD_PROGRAM_NV
:
6441 CALL_LoadProgramNV(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].i
,
6442 (const GLubyte
*) n
[4].data
));
6444 case OPCODE_TRACK_MATRIX_NV
:
6445 CALL_TrackMatrixNV(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].e
, n
[4].e
));
6449 #if FEATURE_NV_fragment_program
6450 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
:
6451 CALL_ProgramLocalParameter4fARB(ctx
->Exec
,
6452 (n
[1].e
, n
[2].ui
, n
[3].f
, n
[4].f
,
6455 case OPCODE_PROGRAM_NAMED_PARAMETER_NV
:
6456 CALL_ProgramNamedParameter4fNV(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
6457 (const GLubyte
*) n
[3].
6458 data
, n
[4].f
, n
[5].f
,
6463 case OPCODE_ACTIVE_STENCIL_FACE_EXT
:
6464 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (n
[1].e
));
6466 case OPCODE_DEPTH_BOUNDS_EXT
:
6467 CALL_DepthBoundsEXT(ctx
->Exec
, (n
[1].f
, n
[2].f
));
6469 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
6470 case OPCODE_PROGRAM_STRING_ARB
:
6471 CALL_ProgramStringARB(ctx
->Exec
,
6472 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].data
));
6475 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program || FEATURE_NV_vertex_program
6476 case OPCODE_PROGRAM_ENV_PARAMETER_ARB
:
6477 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].f
,
6482 #if FEATURE_ARB_occlusion_query
6483 case OPCODE_BEGIN_QUERY_ARB
:
6484 CALL_BeginQueryARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
6486 case OPCODE_END_QUERY_ARB
:
6487 CALL_EndQueryARB(ctx
->Exec
, (n
[1].e
));
6490 case OPCODE_DRAW_BUFFERS_ARB
:
6492 GLenum buffers
[MAX_DRAW_BUFFERS
];
6493 GLint i
, count
= MIN2(n
[1].i
, MAX_DRAW_BUFFERS
);
6494 for (i
= 0; i
< count
; i
++)
6495 buffers
[i
] = n
[2 + i
].e
;
6496 CALL_DrawBuffersARB(ctx
->Exec
, (n
[1].i
, buffers
));
6499 #if FEATURE_EXT_framebuffer_blit
6500 case OPCODE_BLIT_FRAMEBUFFER
:
6501 CALL_BlitFramebufferEXT(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
,
6502 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
6506 #if FEATURE_ATI_fragment_shader
6507 case OPCODE_BIND_FRAGMENT_SHADER_ATI
:
6508 CALL_BindFragmentShaderATI(ctx
->Exec
, (n
[1].i
));
6510 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
:
6513 GLuint i
, dst
= n
[1].ui
;
6515 for (i
= 0; i
< 4; i
++)
6516 values
[i
] = n
[1 + i
].f
;
6517 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, values
));
6521 case OPCODE_ATTR_1F_NV
:
6522 CALL_VertexAttrib1fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
));
6524 case OPCODE_ATTR_2F_NV
:
6525 /* Really shouldn't have to do this - the Node structure
6526 * is convenient, but it would be better to store the data
6527 * packed appropriately so that it can be sent directly
6528 * on. With x86_64 becoming common, this will start to
6531 if (sizeof(Node
) == sizeof(GLfloat
))
6532 CALL_VertexAttrib2fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6534 CALL_VertexAttrib2fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
));
6536 case OPCODE_ATTR_3F_NV
:
6537 if (sizeof(Node
) == sizeof(GLfloat
))
6538 CALL_VertexAttrib3fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6540 CALL_VertexAttrib3fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
6543 case OPCODE_ATTR_4F_NV
:
6544 if (sizeof(Node
) == sizeof(GLfloat
))
6545 CALL_VertexAttrib4fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6547 CALL_VertexAttrib4fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
6550 case OPCODE_ATTR_1F_ARB
:
6551 CALL_VertexAttrib1fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
));
6553 case OPCODE_ATTR_2F_ARB
:
6554 /* Really shouldn't have to do this - the Node structure
6555 * is convenient, but it would be better to store the data
6556 * packed appropriately so that it can be sent directly
6557 * on. With x86_64 becoming common, this will start to
6560 if (sizeof(Node
) == sizeof(GLfloat
))
6561 CALL_VertexAttrib2fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6563 CALL_VertexAttrib2fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
));
6565 case OPCODE_ATTR_3F_ARB
:
6566 if (sizeof(Node
) == sizeof(GLfloat
))
6567 CALL_VertexAttrib3fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6569 CALL_VertexAttrib3fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
6572 case OPCODE_ATTR_4F_ARB
:
6573 if (sizeof(Node
) == sizeof(GLfloat
))
6574 CALL_VertexAttrib4fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6576 CALL_VertexAttrib4fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
6579 case OPCODE_MATERIAL
:
6580 if (sizeof(Node
) == sizeof(GLfloat
))
6581 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, &n
[3].f
));
6588 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, f
));
6592 CALL_Begin(ctx
->Exec
, (n
[1].e
));
6595 CALL_End(ctx
->Exec
, ());
6598 CALL_Rectf(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
6600 case OPCODE_EVAL_C1
:
6601 CALL_EvalCoord1f(ctx
->Exec
, (n
[1].f
));
6603 case OPCODE_EVAL_C2
:
6604 CALL_EvalCoord2f(ctx
->Exec
, (n
[1].f
, n
[2].f
));
6606 case OPCODE_EVAL_P1
:
6607 CALL_EvalPoint1(ctx
->Exec
, (n
[1].i
));
6609 case OPCODE_EVAL_P2
:
6610 CALL_EvalPoint2(ctx
->Exec
, (n
[1].i
, n
[2].i
));
6613 case OPCODE_CONTINUE
:
6614 n
= (Node
*) n
[1].next
;
6616 case OPCODE_END_OF_LIST
:
6622 _mesa_sprintf(msg
, "Error in execute_list: opcode=%d",
6624 _mesa_problem(ctx
, msg
);
6629 /* increment n to point to next compiled command */
6630 if (opcode
!= OPCODE_CONTINUE
) {
6631 n
+= InstSize
[opcode
];
6636 if (ctx
->Driver
.EndCallList
)
6637 ctx
->Driver
.EndCallList(ctx
);
6639 ctx
->ListState
.CallDepth
--;
6644 /**********************************************************************/
6646 /**********************************************************************/
6649 * Test if a display list number is valid.
6651 GLboolean GLAPIENTRY
6652 _mesa_IsList(GLuint list
)
6654 GET_CURRENT_CONTEXT(ctx
);
6655 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
6656 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
6657 return islist(ctx
, list
);
6662 * Delete a sequence of consecutive display lists.
6665 _mesa_DeleteLists(GLuint list
, GLsizei range
)
6667 GET_CURRENT_CONTEXT(ctx
);
6669 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
6670 ASSERT_OUTSIDE_BEGIN_END(ctx
);
6673 _mesa_error(ctx
, GL_INVALID_VALUE
, "glDeleteLists");
6676 for (i
= list
; i
< list
+ range
; i
++) {
6677 destroy_list(ctx
, i
);
6683 * Return a display list number, n, such that lists n through n+range-1
6687 _mesa_GenLists(GLsizei range
)
6689 GET_CURRENT_CONTEXT(ctx
);
6691 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
6692 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, 0);
6695 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGenLists");
6703 * Make this an atomic operation
6705 _glthread_LOCK_MUTEX(ctx
->Shared
->Mutex
);
6707 base
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
6709 /* reserve the list IDs by with empty/dummy lists */
6711 for (i
= 0; i
< range
; i
++) {
6712 _mesa_HashInsert(ctx
->Shared
->DisplayList
, base
+ i
,
6713 make_list(base
+ i
, 1));
6717 _glthread_UNLOCK_MUTEX(ctx
->Shared
->Mutex
);
6724 * Begin a new display list.
6727 _mesa_NewList(GLuint list
, GLenum mode
)
6729 GET_CURRENT_CONTEXT(ctx
);
6732 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
6733 ASSERT_OUTSIDE_BEGIN_END(ctx
);
6735 if (MESA_VERBOSE
& VERBOSE_API
)
6736 _mesa_debug(ctx
, "glNewList %u %s\n", list
,
6737 _mesa_lookup_enum_by_nr(mode
));
6740 _mesa_error(ctx
, GL_INVALID_VALUE
, "glNewList");
6744 if (mode
!= GL_COMPILE
&& mode
!= GL_COMPILE_AND_EXECUTE
) {
6745 _mesa_error(ctx
, GL_INVALID_ENUM
, "glNewList");
6749 if (ctx
->ListState
.CurrentListPtr
) {
6750 /* already compiling a display list */
6751 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
6755 ctx
->CompileFlag
= GL_TRUE
;
6756 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
6758 /* Allocate new display list */
6759 ctx
->ListState
.CurrentListNum
= list
;
6760 ctx
->ListState
.CurrentList
= make_list(list
, BLOCK_SIZE
);
6761 ctx
->ListState
.CurrentBlock
= ctx
->ListState
.CurrentList
->node
;
6762 ctx
->ListState
.CurrentListPtr
= ctx
->ListState
.CurrentBlock
;
6763 ctx
->ListState
.CurrentPos
= 0;
6765 /* Reset acumulated list state:
6767 for (i
= 0; i
< VERT_ATTRIB_MAX
; i
++)
6768 ctx
->ListState
.ActiveAttribSize
[i
] = 0;
6770 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++)
6771 ctx
->ListState
.ActiveMaterialSize
[i
] = 0;
6773 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
6774 ctx
->Driver
.NewList(ctx
, list
, mode
);
6776 ctx
->CurrentDispatch
= ctx
->Save
;
6777 _glapi_set_dispatch(ctx
->CurrentDispatch
);
6782 * End definition of current display list.
6787 GET_CURRENT_CONTEXT(ctx
);
6788 SAVE_FLUSH_VERTICES(ctx
);
6789 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
6791 if (MESA_VERBOSE
& VERBOSE_API
)
6792 _mesa_debug(ctx
, "glEndList\n");
6794 /* Check that a list is under construction */
6795 if (!ctx
->ListState
.CurrentListPtr
) {
6796 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glEndList");
6800 /* Call before emitting END_OF_LIST, in case the driver wants to
6801 * emit opcodes itself.
6803 ctx
->Driver
.EndList(ctx
);
6805 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_END_OF_LIST
, 0);
6807 /* Destroy old list, if any */
6808 destroy_list(ctx
, ctx
->ListState
.CurrentListNum
);
6809 /* Install the list */
6810 _mesa_HashInsert(ctx
->Shared
->DisplayList
, ctx
->ListState
.CurrentListNum
,
6811 ctx
->ListState
.CurrentList
);
6814 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
6815 mesa_print_display_list(ctx
->ListState
.CurrentListNum
);
6817 ctx
->ListState
.CurrentList
= NULL
;
6818 ctx
->ListState
.CurrentListNum
= 0;
6819 ctx
->ListState
.CurrentListPtr
= NULL
;
6820 ctx
->ExecuteFlag
= GL_TRUE
;
6821 ctx
->CompileFlag
= GL_FALSE
;
6823 ctx
->CurrentDispatch
= ctx
->Exec
;
6824 _glapi_set_dispatch(ctx
->CurrentDispatch
);
6829 _mesa_CallList(GLuint list
)
6831 GLboolean save_compile_flag
;
6832 GET_CURRENT_CONTEXT(ctx
);
6833 FLUSH_CURRENT(ctx
, 0);
6834 /* VERY IMPORTANT: Save the CompileFlag status, turn it off, */
6835 /* execute the display list, and restore the CompileFlag. */
6837 if (MESA_VERBOSE
& VERBOSE_API
)
6838 _mesa_debug(ctx
, "glCallList %d\n", list
);
6841 _mesa_error(ctx
, GL_INVALID_VALUE
, "glCallList(list==0)");
6845 /* mesa_print_display_list( list ); */
6847 save_compile_flag
= ctx
->CompileFlag
;
6848 if (save_compile_flag
) {
6849 ctx
->CompileFlag
= GL_FALSE
;
6852 execute_list(ctx
, list
);
6853 ctx
->CompileFlag
= save_compile_flag
;
6855 /* also restore API function pointers to point to "save" versions */
6856 if (save_compile_flag
) {
6857 ctx
->CurrentDispatch
= ctx
->Save
;
6858 _glapi_set_dispatch(ctx
->CurrentDispatch
);
6864 * Execute glCallLists: call multiple display lists.
6867 _mesa_CallLists(GLsizei n
, GLenum type
, const GLvoid
* lists
)
6869 GET_CURRENT_CONTEXT(ctx
);
6871 GLboolean save_compile_flag
;
6873 if (MESA_VERBOSE
& VERBOSE_API
)
6874 _mesa_debug(ctx
, "glCallLists %d\n", n
);
6878 case GL_UNSIGNED_BYTE
:
6880 case GL_UNSIGNED_SHORT
:
6882 case GL_UNSIGNED_INT
:
6890 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
6894 /* Save the CompileFlag status, turn it off, execute display list,
6895 * and restore the CompileFlag.
6897 save_compile_flag
= ctx
->CompileFlag
;
6898 ctx
->CompileFlag
= GL_FALSE
;
6900 for (i
= 0; i
< n
; i
++) {
6901 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ translate_id(i
, type
, lists
));
6902 execute_list(ctx
, list
);
6905 ctx
->CompileFlag
= save_compile_flag
;
6907 /* also restore API function pointers to point to "save" versions */
6908 if (save_compile_flag
) {
6909 ctx
->CurrentDispatch
= ctx
->Save
;
6910 _glapi_set_dispatch(ctx
->CurrentDispatch
);
6916 * Set the offset added to list numbers in glCallLists.
6919 _mesa_ListBase(GLuint base
)
6921 GET_CURRENT_CONTEXT(ctx
);
6922 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
6923 ASSERT_OUTSIDE_BEGIN_END(ctx
);
6924 ctx
->List
.ListBase
= base
;
6928 /* Can no longer assume ctx->Exec->Func is equal to _mesa_Func.
6930 static void GLAPIENTRY
6933 GET_CURRENT_CONTEXT(ctx
);
6934 FLUSH_VERTICES(ctx
, 0);
6935 CALL_Finish(ctx
->Exec
, ());
6938 static void GLAPIENTRY
6941 GET_CURRENT_CONTEXT(ctx
);
6942 FLUSH_VERTICES(ctx
, 0);
6943 CALL_Flush(ctx
->Exec
, ());
6946 static void GLAPIENTRY
6947 exec_GetBooleanv(GLenum pname
, GLboolean
*params
)
6949 GET_CURRENT_CONTEXT(ctx
);
6950 FLUSH_VERTICES(ctx
, 0);
6951 CALL_GetBooleanv(ctx
->Exec
, (pname
, params
));
6954 static void GLAPIENTRY
6955 exec_GetClipPlane(GLenum plane
, GLdouble
* equation
)
6957 GET_CURRENT_CONTEXT(ctx
);
6958 FLUSH_VERTICES(ctx
, 0);
6959 CALL_GetClipPlane(ctx
->Exec
, (plane
, equation
));
6962 static void GLAPIENTRY
6963 exec_GetDoublev(GLenum pname
, GLdouble
*params
)
6965 GET_CURRENT_CONTEXT(ctx
);
6966 FLUSH_VERTICES(ctx
, 0);
6967 CALL_GetDoublev(ctx
->Exec
, (pname
, params
));
6970 static GLenum GLAPIENTRY
6973 GET_CURRENT_CONTEXT(ctx
);
6974 FLUSH_VERTICES(ctx
, 0);
6975 return CALL_GetError(ctx
->Exec
, ());
6978 static void GLAPIENTRY
6979 exec_GetFloatv(GLenum pname
, GLfloat
*params
)
6981 GET_CURRENT_CONTEXT(ctx
);
6982 FLUSH_VERTICES(ctx
, 0);
6983 CALL_GetFloatv(ctx
->Exec
, (pname
, params
));
6986 static void GLAPIENTRY
6987 exec_GetIntegerv(GLenum pname
, GLint
*params
)
6989 GET_CURRENT_CONTEXT(ctx
);
6990 FLUSH_VERTICES(ctx
, 0);
6991 CALL_GetIntegerv(ctx
->Exec
, (pname
, params
));
6994 static void GLAPIENTRY
6995 exec_GetLightfv(GLenum light
, GLenum pname
, GLfloat
*params
)
6997 GET_CURRENT_CONTEXT(ctx
);
6998 FLUSH_VERTICES(ctx
, 0);
6999 CALL_GetLightfv(ctx
->Exec
, (light
, pname
, params
));
7002 static void GLAPIENTRY
7003 exec_GetLightiv(GLenum light
, GLenum pname
, GLint
*params
)
7005 GET_CURRENT_CONTEXT(ctx
);
7006 FLUSH_VERTICES(ctx
, 0);
7007 CALL_GetLightiv(ctx
->Exec
, (light
, pname
, params
));
7010 static void GLAPIENTRY
7011 exec_GetMapdv(GLenum target
, GLenum query
, GLdouble
* v
)
7013 GET_CURRENT_CONTEXT(ctx
);
7014 FLUSH_VERTICES(ctx
, 0);
7015 CALL_GetMapdv(ctx
->Exec
, (target
, query
, v
));
7018 static void GLAPIENTRY
7019 exec_GetMapfv(GLenum target
, GLenum query
, GLfloat
* v
)
7021 GET_CURRENT_CONTEXT(ctx
);
7022 FLUSH_VERTICES(ctx
, 0);
7023 CALL_GetMapfv(ctx
->Exec
, (target
, query
, v
));
7026 static void GLAPIENTRY
7027 exec_GetMapiv(GLenum target
, GLenum query
, GLint
* v
)
7029 GET_CURRENT_CONTEXT(ctx
);
7030 FLUSH_VERTICES(ctx
, 0);
7031 CALL_GetMapiv(ctx
->Exec
, (target
, query
, v
));
7034 static void GLAPIENTRY
7035 exec_GetMaterialfv(GLenum face
, GLenum pname
, GLfloat
*params
)
7037 GET_CURRENT_CONTEXT(ctx
);
7038 FLUSH_VERTICES(ctx
, 0);
7039 CALL_GetMaterialfv(ctx
->Exec
, (face
, pname
, params
));
7042 static void GLAPIENTRY
7043 exec_GetMaterialiv(GLenum face
, GLenum pname
, GLint
*params
)
7045 GET_CURRENT_CONTEXT(ctx
);
7046 FLUSH_VERTICES(ctx
, 0);
7047 CALL_GetMaterialiv(ctx
->Exec
, (face
, pname
, params
));
7050 static void GLAPIENTRY
7051 exec_GetPixelMapfv(GLenum map
, GLfloat
*values
)
7053 GET_CURRENT_CONTEXT(ctx
);
7054 FLUSH_VERTICES(ctx
, 0);
7055 CALL_GetPixelMapfv(ctx
->Exec
, (map
, values
));
7058 static void GLAPIENTRY
7059 exec_GetPixelMapuiv(GLenum map
, GLuint
*values
)
7061 GET_CURRENT_CONTEXT(ctx
);
7062 FLUSH_VERTICES(ctx
, 0);
7063 CALL_GetPixelMapuiv(ctx
->Exec
, (map
, values
));
7066 static void GLAPIENTRY
7067 exec_GetPixelMapusv(GLenum map
, GLushort
*values
)
7069 GET_CURRENT_CONTEXT(ctx
);
7070 FLUSH_VERTICES(ctx
, 0);
7071 CALL_GetPixelMapusv(ctx
->Exec
, (map
, values
));
7074 static void GLAPIENTRY
7075 exec_GetPolygonStipple(GLubyte
* dest
)
7077 GET_CURRENT_CONTEXT(ctx
);
7078 FLUSH_VERTICES(ctx
, 0);
7079 CALL_GetPolygonStipple(ctx
->Exec
, (dest
));
7082 static const GLubyte
*GLAPIENTRY
7083 exec_GetString(GLenum name
)
7085 GET_CURRENT_CONTEXT(ctx
);
7086 FLUSH_VERTICES(ctx
, 0);
7087 return CALL_GetString(ctx
->Exec
, (name
));
7090 static void GLAPIENTRY
7091 exec_GetTexEnvfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7093 GET_CURRENT_CONTEXT(ctx
);
7094 FLUSH_VERTICES(ctx
, 0);
7095 CALL_GetTexEnvfv(ctx
->Exec
, (target
, pname
, params
));
7098 static void GLAPIENTRY
7099 exec_GetTexEnviv(GLenum target
, GLenum pname
, GLint
*params
)
7101 GET_CURRENT_CONTEXT(ctx
);
7102 FLUSH_VERTICES(ctx
, 0);
7103 CALL_GetTexEnviv(ctx
->Exec
, (target
, pname
, params
));
7106 static void GLAPIENTRY
7107 exec_GetTexGendv(GLenum coord
, GLenum pname
, GLdouble
*params
)
7109 GET_CURRENT_CONTEXT(ctx
);
7110 FLUSH_VERTICES(ctx
, 0);
7111 CALL_GetTexGendv(ctx
->Exec
, (coord
, pname
, params
));
7114 static void GLAPIENTRY
7115 exec_GetTexGenfv(GLenum coord
, GLenum pname
, GLfloat
*params
)
7117 GET_CURRENT_CONTEXT(ctx
);
7118 FLUSH_VERTICES(ctx
, 0);
7119 CALL_GetTexGenfv(ctx
->Exec
, (coord
, pname
, params
));
7122 static void GLAPIENTRY
7123 exec_GetTexGeniv(GLenum coord
, GLenum pname
, GLint
*params
)
7125 GET_CURRENT_CONTEXT(ctx
);
7126 FLUSH_VERTICES(ctx
, 0);
7127 CALL_GetTexGeniv(ctx
->Exec
, (coord
, pname
, params
));
7130 static void GLAPIENTRY
7131 exec_GetTexImage(GLenum target
, GLint level
, GLenum format
,
7132 GLenum type
, GLvoid
* pixels
)
7134 GET_CURRENT_CONTEXT(ctx
);
7135 FLUSH_VERTICES(ctx
, 0);
7136 CALL_GetTexImage(ctx
->Exec
, (target
, level
, format
, type
, pixels
));
7139 static void GLAPIENTRY
7140 exec_GetTexLevelParameterfv(GLenum target
, GLint level
,
7141 GLenum pname
, GLfloat
*params
)
7143 GET_CURRENT_CONTEXT(ctx
);
7144 FLUSH_VERTICES(ctx
, 0);
7145 CALL_GetTexLevelParameterfv(ctx
->Exec
, (target
, level
, pname
, params
));
7148 static void GLAPIENTRY
7149 exec_GetTexLevelParameteriv(GLenum target
, GLint level
,
7150 GLenum pname
, GLint
*params
)
7152 GET_CURRENT_CONTEXT(ctx
);
7153 FLUSH_VERTICES(ctx
, 0);
7154 CALL_GetTexLevelParameteriv(ctx
->Exec
, (target
, level
, pname
, params
));
7157 static void GLAPIENTRY
7158 exec_GetTexParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7160 GET_CURRENT_CONTEXT(ctx
);
7161 FLUSH_VERTICES(ctx
, 0);
7162 CALL_GetTexParameterfv(ctx
->Exec
, (target
, pname
, params
));
7165 static void GLAPIENTRY
7166 exec_GetTexParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7168 GET_CURRENT_CONTEXT(ctx
);
7169 FLUSH_VERTICES(ctx
, 0);
7170 CALL_GetTexParameteriv(ctx
->Exec
, (target
, pname
, params
));
7173 static GLboolean GLAPIENTRY
7174 exec_IsEnabled(GLenum cap
)
7176 GET_CURRENT_CONTEXT(ctx
);
7177 FLUSH_VERTICES(ctx
, 0);
7178 return CALL_IsEnabled(ctx
->Exec
, (cap
));
7181 static void GLAPIENTRY
7182 exec_PixelStoref(GLenum pname
, GLfloat param
)
7184 GET_CURRENT_CONTEXT(ctx
);
7185 FLUSH_VERTICES(ctx
, 0);
7186 CALL_PixelStoref(ctx
->Exec
, (pname
, param
));
7189 static void GLAPIENTRY
7190 exec_PixelStorei(GLenum pname
, GLint param
)
7192 GET_CURRENT_CONTEXT(ctx
);
7193 FLUSH_VERTICES(ctx
, 0);
7194 CALL_PixelStorei(ctx
->Exec
, (pname
, param
));
7197 static void GLAPIENTRY
7198 exec_ReadPixels(GLint x
, GLint y
, GLsizei width
, GLsizei height
,
7199 GLenum format
, GLenum type
, GLvoid
* pixels
)
7201 GET_CURRENT_CONTEXT(ctx
);
7202 FLUSH_VERTICES(ctx
, 0);
7203 CALL_ReadPixels(ctx
->Exec
, (x
, y
, width
, height
, format
, type
, pixels
));
7206 static GLint GLAPIENTRY
7207 exec_RenderMode(GLenum mode
)
7209 GET_CURRENT_CONTEXT(ctx
);
7210 FLUSH_VERTICES(ctx
, 0);
7211 return CALL_RenderMode(ctx
->Exec
, (mode
));
7214 static void GLAPIENTRY
7215 exec_FeedbackBuffer(GLsizei size
, GLenum type
, GLfloat
* buffer
)
7217 GET_CURRENT_CONTEXT(ctx
);
7218 FLUSH_VERTICES(ctx
, 0);
7219 CALL_FeedbackBuffer(ctx
->Exec
, (size
, type
, buffer
));
7222 static void GLAPIENTRY
7223 exec_SelectBuffer(GLsizei size
, GLuint
* buffer
)
7225 GET_CURRENT_CONTEXT(ctx
);
7226 FLUSH_VERTICES(ctx
, 0);
7227 CALL_SelectBuffer(ctx
->Exec
, (size
, buffer
));
7230 static GLboolean GLAPIENTRY
7231 exec_AreTexturesResident(GLsizei n
, const GLuint
* texName
,
7232 GLboolean
* residences
)
7234 GET_CURRENT_CONTEXT(ctx
);
7235 FLUSH_VERTICES(ctx
, 0);
7236 return CALL_AreTexturesResident(ctx
->Exec
, (n
, texName
, residences
));
7239 static void GLAPIENTRY
7240 exec_ColorPointer(GLint size
, GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
7242 GET_CURRENT_CONTEXT(ctx
);
7243 FLUSH_VERTICES(ctx
, 0);
7244 CALL_ColorPointer(ctx
->Exec
, (size
, type
, stride
, ptr
));
7247 static void GLAPIENTRY
7248 exec_DeleteTextures(GLsizei n
, const GLuint
* texName
)
7250 GET_CURRENT_CONTEXT(ctx
);
7251 FLUSH_VERTICES(ctx
, 0);
7252 CALL_DeleteTextures(ctx
->Exec
, (n
, texName
));
7255 static void GLAPIENTRY
7256 exec_DisableClientState(GLenum cap
)
7258 GET_CURRENT_CONTEXT(ctx
);
7259 FLUSH_VERTICES(ctx
, 0);
7260 CALL_DisableClientState(ctx
->Exec
, (cap
));
7263 static void GLAPIENTRY
7264 exec_EdgeFlagPointer(GLsizei stride
, const GLvoid
* vptr
)
7266 GET_CURRENT_CONTEXT(ctx
);
7267 FLUSH_VERTICES(ctx
, 0);
7268 CALL_EdgeFlagPointer(ctx
->Exec
, (stride
, vptr
));
7271 static void GLAPIENTRY
7272 exec_EnableClientState(GLenum cap
)
7274 GET_CURRENT_CONTEXT(ctx
);
7275 FLUSH_VERTICES(ctx
, 0);
7276 CALL_EnableClientState(ctx
->Exec
, (cap
));
7279 static void GLAPIENTRY
7280 exec_GenTextures(GLsizei n
, GLuint
* texName
)
7282 GET_CURRENT_CONTEXT(ctx
);
7283 FLUSH_VERTICES(ctx
, 0);
7284 CALL_GenTextures(ctx
->Exec
, (n
, texName
));
7287 static void GLAPIENTRY
7288 exec_GetPointerv(GLenum pname
, GLvoid
**params
)
7290 GET_CURRENT_CONTEXT(ctx
);
7291 FLUSH_VERTICES(ctx
, 0);
7292 CALL_GetPointerv(ctx
->Exec
, (pname
, params
));
7295 static void GLAPIENTRY
7296 exec_IndexPointer(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
7298 GET_CURRENT_CONTEXT(ctx
);
7299 FLUSH_VERTICES(ctx
, 0);
7300 CALL_IndexPointer(ctx
->Exec
, (type
, stride
, ptr
));
7303 static void GLAPIENTRY
7304 exec_InterleavedArrays(GLenum format
, GLsizei stride
, const GLvoid
* pointer
)
7306 GET_CURRENT_CONTEXT(ctx
);
7307 FLUSH_VERTICES(ctx
, 0);
7308 CALL_InterleavedArrays(ctx
->Exec
, (format
, stride
, pointer
));
7311 static GLboolean GLAPIENTRY
7312 exec_IsTexture(GLuint texture
)
7314 GET_CURRENT_CONTEXT(ctx
);
7315 FLUSH_VERTICES(ctx
, 0);
7316 return CALL_IsTexture(ctx
->Exec
, (texture
));
7319 static void GLAPIENTRY
7320 exec_NormalPointer(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
7322 GET_CURRENT_CONTEXT(ctx
);
7323 FLUSH_VERTICES(ctx
, 0);
7324 CALL_NormalPointer(ctx
->Exec
, (type
, stride
, ptr
));
7327 static void GLAPIENTRY
7328 exec_PopClientAttrib(void)
7330 GET_CURRENT_CONTEXT(ctx
);
7331 FLUSH_VERTICES(ctx
, 0);
7332 CALL_PopClientAttrib(ctx
->Exec
, ());
7335 static void GLAPIENTRY
7336 exec_PushClientAttrib(GLbitfield mask
)
7338 GET_CURRENT_CONTEXT(ctx
);
7339 FLUSH_VERTICES(ctx
, 0);
7340 CALL_PushClientAttrib(ctx
->Exec
, (mask
));
7343 static void GLAPIENTRY
7344 exec_TexCoordPointer(GLint size
, GLenum type
, GLsizei stride
,
7347 GET_CURRENT_CONTEXT(ctx
);
7348 FLUSH_VERTICES(ctx
, 0);
7349 CALL_TexCoordPointer(ctx
->Exec
, (size
, type
, stride
, ptr
));
7352 static void GLAPIENTRY
7353 exec_GetCompressedTexImageARB(GLenum target
, GLint level
, GLvoid
* img
)
7355 GET_CURRENT_CONTEXT(ctx
);
7356 FLUSH_VERTICES(ctx
, 0);
7357 CALL_GetCompressedTexImageARB(ctx
->Exec
, (target
, level
, img
));
7360 static void GLAPIENTRY
7361 exec_VertexPointer(GLint size
, GLenum type
, GLsizei stride
,
7364 GET_CURRENT_CONTEXT(ctx
);
7365 FLUSH_VERTICES(ctx
, 0);
7366 CALL_VertexPointer(ctx
->Exec
, (size
, type
, stride
, ptr
));
7369 static void GLAPIENTRY
7370 exec_CopyConvolutionFilter1D(GLenum target
, GLenum internalFormat
,
7371 GLint x
, GLint y
, GLsizei width
)
7373 GET_CURRENT_CONTEXT(ctx
);
7374 FLUSH_VERTICES(ctx
, 0);
7375 CALL_CopyConvolutionFilter1D(ctx
->Exec
,
7376 (target
, internalFormat
, x
, y
, width
));
7379 static void GLAPIENTRY
7380 exec_CopyConvolutionFilter2D(GLenum target
, GLenum internalFormat
,
7381 GLint x
, GLint y
, GLsizei width
, GLsizei height
)
7383 GET_CURRENT_CONTEXT(ctx
);
7384 FLUSH_VERTICES(ctx
, 0);
7385 CALL_CopyConvolutionFilter2D(ctx
->Exec
,
7386 (target
, internalFormat
, x
, y
, width
,
7390 static void GLAPIENTRY
7391 exec_GetColorTable(GLenum target
, GLenum format
, GLenum type
, GLvoid
* data
)
7393 GET_CURRENT_CONTEXT(ctx
);
7394 FLUSH_VERTICES(ctx
, 0);
7395 CALL_GetColorTable(ctx
->Exec
, (target
, format
, type
, data
));
7398 static void GLAPIENTRY
7399 exec_GetColorTableParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7401 GET_CURRENT_CONTEXT(ctx
);
7402 FLUSH_VERTICES(ctx
, 0);
7403 CALL_GetColorTableParameterfv(ctx
->Exec
, (target
, pname
, params
));
7406 static void GLAPIENTRY
7407 exec_GetColorTableParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7409 GET_CURRENT_CONTEXT(ctx
);
7410 FLUSH_VERTICES(ctx
, 0);
7411 CALL_GetColorTableParameteriv(ctx
->Exec
, (target
, pname
, params
));
7414 static void GLAPIENTRY
7415 exec_GetConvolutionFilter(GLenum target
, GLenum format
, GLenum type
,
7418 GET_CURRENT_CONTEXT(ctx
);
7419 FLUSH_VERTICES(ctx
, 0);
7420 CALL_GetConvolutionFilter(ctx
->Exec
, (target
, format
, type
, image
));
7423 static void GLAPIENTRY
7424 exec_GetConvolutionParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7426 GET_CURRENT_CONTEXT(ctx
);
7427 FLUSH_VERTICES(ctx
, 0);
7428 CALL_GetConvolutionParameterfv(ctx
->Exec
, (target
, pname
, params
));
7431 static void GLAPIENTRY
7432 exec_GetConvolutionParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7434 GET_CURRENT_CONTEXT(ctx
);
7435 FLUSH_VERTICES(ctx
, 0);
7436 CALL_GetConvolutionParameteriv(ctx
->Exec
, (target
, pname
, params
));
7439 static void GLAPIENTRY
7440 exec_GetHistogram(GLenum target
, GLboolean reset
, GLenum format
,
7441 GLenum type
, GLvoid
*values
)
7443 GET_CURRENT_CONTEXT(ctx
);
7444 FLUSH_VERTICES(ctx
, 0);
7445 CALL_GetHistogram(ctx
->Exec
, (target
, reset
, format
, type
, values
));
7448 static void GLAPIENTRY
7449 exec_GetHistogramParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7451 GET_CURRENT_CONTEXT(ctx
);
7452 FLUSH_VERTICES(ctx
, 0);
7453 CALL_GetHistogramParameterfv(ctx
->Exec
, (target
, pname
, params
));
7456 static void GLAPIENTRY
7457 exec_GetHistogramParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7459 GET_CURRENT_CONTEXT(ctx
);
7460 FLUSH_VERTICES(ctx
, 0);
7461 CALL_GetHistogramParameteriv(ctx
->Exec
, (target
, pname
, params
));
7464 static void GLAPIENTRY
7465 exec_GetMinmax(GLenum target
, GLboolean reset
, GLenum format
,
7466 GLenum type
, GLvoid
*values
)
7468 GET_CURRENT_CONTEXT(ctx
);
7469 FLUSH_VERTICES(ctx
, 0);
7470 CALL_GetMinmax(ctx
->Exec
, (target
, reset
, format
, type
, values
));
7473 static void GLAPIENTRY
7474 exec_GetMinmaxParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7476 GET_CURRENT_CONTEXT(ctx
);
7477 FLUSH_VERTICES(ctx
, 0);
7478 CALL_GetMinmaxParameterfv(ctx
->Exec
, (target
, pname
, params
));
7481 static void GLAPIENTRY
7482 exec_GetMinmaxParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7484 GET_CURRENT_CONTEXT(ctx
);
7485 FLUSH_VERTICES(ctx
, 0);
7486 CALL_GetMinmaxParameteriv(ctx
->Exec
, (target
, pname
, params
));
7489 static void GLAPIENTRY
7490 exec_GetSeparableFilter(GLenum target
, GLenum format
, GLenum type
,
7491 GLvoid
*row
, GLvoid
*column
, GLvoid
*span
)
7493 GET_CURRENT_CONTEXT(ctx
);
7494 FLUSH_VERTICES(ctx
, 0);
7495 CALL_GetSeparableFilter(ctx
->Exec
,
7496 (target
, format
, type
, row
, column
, span
));
7499 static void GLAPIENTRY
7500 exec_SeparableFilter2D(GLenum target
, GLenum internalFormat
,
7501 GLsizei width
, GLsizei height
, GLenum format
,
7502 GLenum type
, const GLvoid
*row
, const GLvoid
*column
)
7504 GET_CURRENT_CONTEXT(ctx
);
7505 FLUSH_VERTICES(ctx
, 0);
7506 CALL_SeparableFilter2D(ctx
->Exec
,
7507 (target
, internalFormat
, width
, height
, format
,
7508 type
, row
, column
));
7511 static void GLAPIENTRY
7512 exec_ColorPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
7513 GLsizei count
, const GLvoid
*ptr
)
7515 GET_CURRENT_CONTEXT(ctx
);
7516 FLUSH_VERTICES(ctx
, 0);
7517 CALL_ColorPointerEXT(ctx
->Exec
, (size
, type
, stride
, count
, ptr
));
7520 static void GLAPIENTRY
7521 exec_EdgeFlagPointerEXT(GLsizei stride
, GLsizei count
, const GLboolean
*ptr
)
7523 GET_CURRENT_CONTEXT(ctx
);
7524 FLUSH_VERTICES(ctx
, 0);
7525 CALL_EdgeFlagPointerEXT(ctx
->Exec
, (stride
, count
, ptr
));
7528 static void GLAPIENTRY
7529 exec_IndexPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
,
7532 GET_CURRENT_CONTEXT(ctx
);
7533 FLUSH_VERTICES(ctx
, 0);
7534 CALL_IndexPointerEXT(ctx
->Exec
, (type
, stride
, count
, ptr
));
7537 static void GLAPIENTRY
7538 exec_NormalPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
,
7541 GET_CURRENT_CONTEXT(ctx
);
7542 FLUSH_VERTICES(ctx
, 0);
7543 CALL_NormalPointerEXT(ctx
->Exec
, (type
, stride
, count
, ptr
));
7546 static void GLAPIENTRY
7547 exec_TexCoordPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
7548 GLsizei count
, const GLvoid
*ptr
)
7550 GET_CURRENT_CONTEXT(ctx
);
7551 FLUSH_VERTICES(ctx
, 0);
7552 CALL_TexCoordPointerEXT(ctx
->Exec
, (size
, type
, stride
, count
, ptr
));
7555 static void GLAPIENTRY
7556 exec_VertexPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
7557 GLsizei count
, const GLvoid
*ptr
)
7559 GET_CURRENT_CONTEXT(ctx
);
7560 FLUSH_VERTICES(ctx
, 0);
7561 CALL_VertexPointerEXT(ctx
->Exec
, (size
, type
, stride
, count
, ptr
));
7564 static void GLAPIENTRY
7565 exec_LockArraysEXT(GLint first
, GLsizei count
)
7567 GET_CURRENT_CONTEXT(ctx
);
7568 FLUSH_VERTICES(ctx
, 0);
7569 CALL_LockArraysEXT(ctx
->Exec
, (first
, count
));
7572 static void GLAPIENTRY
7573 exec_UnlockArraysEXT(void)
7575 GET_CURRENT_CONTEXT(ctx
);
7576 FLUSH_VERTICES(ctx
, 0);
7577 CALL_UnlockArraysEXT(ctx
->Exec
, ());
7580 static void GLAPIENTRY
7581 exec_ClientActiveTextureARB(GLenum target
)
7583 GET_CURRENT_CONTEXT(ctx
);
7584 FLUSH_VERTICES(ctx
, 0);
7585 CALL_ClientActiveTextureARB(ctx
->Exec
, (target
));
7588 static void GLAPIENTRY
7589 exec_SecondaryColorPointerEXT(GLint size
, GLenum type
,
7590 GLsizei stride
, const GLvoid
*ptr
)
7592 GET_CURRENT_CONTEXT(ctx
);
7593 FLUSH_VERTICES(ctx
, 0);
7594 CALL_SecondaryColorPointerEXT(ctx
->Exec
, (size
, type
, stride
, ptr
));
7597 static void GLAPIENTRY
7598 exec_FogCoordPointerEXT(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
7600 GET_CURRENT_CONTEXT(ctx
);
7601 FLUSH_VERTICES(ctx
, 0);
7602 CALL_FogCoordPointerEXT(ctx
->Exec
, (type
, stride
, ptr
));
7605 /* GL_EXT_multi_draw_arrays */
7606 static void GLAPIENTRY
7607 exec_MultiDrawArraysEXT(GLenum mode
, GLint
* first
,
7608 GLsizei
* count
, GLsizei primcount
)
7610 GET_CURRENT_CONTEXT(ctx
);
7611 FLUSH_VERTICES(ctx
, 0);
7612 CALL_MultiDrawArraysEXT(ctx
->Exec
, (mode
, first
, count
, primcount
));
7615 /* GL_EXT_multi_draw_arrays */
7616 static void GLAPIENTRY
7617 exec_MultiDrawElementsEXT(GLenum mode
, const GLsizei
* count
,
7618 GLenum type
, const GLvoid
** indices
,
7621 GET_CURRENT_CONTEXT(ctx
);
7622 FLUSH_VERTICES(ctx
, 0);
7623 CALL_MultiDrawElementsEXT(ctx
->Exec
,
7624 (mode
, count
, type
, indices
, primcount
));
7627 /* GL_IBM_multimode_draw_arrays */
7628 static void GLAPIENTRY
7629 exec_MultiModeDrawArraysIBM(const GLenum
* mode
, const GLint
* first
,
7630 const GLsizei
* count
, GLsizei primcount
,
7633 GET_CURRENT_CONTEXT(ctx
);
7634 FLUSH_VERTICES(ctx
, 0);
7635 CALL_MultiModeDrawArraysIBM(ctx
->Exec
,
7636 (mode
, first
, count
, primcount
, modestride
));
7639 /* GL_IBM_multimode_draw_arrays */
7640 static void GLAPIENTRY
7641 exec_MultiModeDrawElementsIBM(const GLenum
* mode
,
7642 const GLsizei
* count
,
7644 const GLvoid
* const *indices
,
7645 GLsizei primcount
, GLint modestride
)
7647 GET_CURRENT_CONTEXT(ctx
);
7648 FLUSH_VERTICES(ctx
, 0);
7649 CALL_MultiModeDrawElementsIBM(ctx
->Exec
,
7650 (mode
, count
, type
, indices
, primcount
,
7657 * Setup the given dispatch table to point to Mesa's display list
7658 * building functions.
7660 * This does not include any of the tnl functions - they are
7661 * initialized from _mesa_init_api_defaults and from the active vtxfmt
7665 _mesa_init_dlist_table(struct _glapi_table
*table
)
7667 _mesa_loopback_init_api_table(table
);
7670 SET_Accum(table
, save_Accum
);
7671 SET_AlphaFunc(table
, save_AlphaFunc
);
7672 SET_Bitmap(table
, save_Bitmap
);
7673 SET_BlendFunc(table
, save_BlendFunc
);
7674 SET_CallList(table
, _mesa_save_CallList
);
7675 SET_CallLists(table
, _mesa_save_CallLists
);
7676 SET_Clear(table
, save_Clear
);
7677 SET_ClearAccum(table
, save_ClearAccum
);
7678 SET_ClearColor(table
, save_ClearColor
);
7679 SET_ClearDepth(table
, save_ClearDepth
);
7680 SET_ClearIndex(table
, save_ClearIndex
);
7681 SET_ClearStencil(table
, save_ClearStencil
);
7682 SET_ClipPlane(table
, save_ClipPlane
);
7683 SET_ColorMask(table
, save_ColorMask
);
7684 SET_ColorMaterial(table
, save_ColorMaterial
);
7685 SET_CopyPixels(table
, save_CopyPixels
);
7686 SET_CullFace(table
, save_CullFace
);
7687 SET_DeleteLists(table
, _mesa_DeleteLists
);
7688 SET_DepthFunc(table
, save_DepthFunc
);
7689 SET_DepthMask(table
, save_DepthMask
);
7690 SET_DepthRange(table
, save_DepthRange
);
7691 SET_Disable(table
, save_Disable
);
7692 SET_DrawBuffer(table
, save_DrawBuffer
);
7693 SET_DrawPixels(table
, save_DrawPixels
);
7694 SET_Enable(table
, save_Enable
);
7695 SET_EndList(table
, _mesa_EndList
);
7696 SET_EvalMesh1(table
, _mesa_save_EvalMesh1
);
7697 SET_EvalMesh2(table
, _mesa_save_EvalMesh2
);
7698 SET_Finish(table
, exec_Finish
);
7699 SET_Flush(table
, exec_Flush
);
7700 SET_Fogf(table
, save_Fogf
);
7701 SET_Fogfv(table
, save_Fogfv
);
7702 SET_Fogi(table
, save_Fogi
);
7703 SET_Fogiv(table
, save_Fogiv
);
7704 SET_FrontFace(table
, save_FrontFace
);
7705 SET_Frustum(table
, save_Frustum
);
7706 SET_GenLists(table
, _mesa_GenLists
);
7707 SET_GetBooleanv(table
, exec_GetBooleanv
);
7708 SET_GetClipPlane(table
, exec_GetClipPlane
);
7709 SET_GetDoublev(table
, exec_GetDoublev
);
7710 SET_GetError(table
, exec_GetError
);
7711 SET_GetFloatv(table
, exec_GetFloatv
);
7712 SET_GetIntegerv(table
, exec_GetIntegerv
);
7713 SET_GetLightfv(table
, exec_GetLightfv
);
7714 SET_GetLightiv(table
, exec_GetLightiv
);
7715 SET_GetMapdv(table
, exec_GetMapdv
);
7716 SET_GetMapfv(table
, exec_GetMapfv
);
7717 SET_GetMapiv(table
, exec_GetMapiv
);
7718 SET_GetMaterialfv(table
, exec_GetMaterialfv
);
7719 SET_GetMaterialiv(table
, exec_GetMaterialiv
);
7720 SET_GetPixelMapfv(table
, exec_GetPixelMapfv
);
7721 SET_GetPixelMapuiv(table
, exec_GetPixelMapuiv
);
7722 SET_GetPixelMapusv(table
, exec_GetPixelMapusv
);
7723 SET_GetPolygonStipple(table
, exec_GetPolygonStipple
);
7724 SET_GetString(table
, exec_GetString
);
7725 SET_GetTexEnvfv(table
, exec_GetTexEnvfv
);
7726 SET_GetTexEnviv(table
, exec_GetTexEnviv
);
7727 SET_GetTexGendv(table
, exec_GetTexGendv
);
7728 SET_GetTexGenfv(table
, exec_GetTexGenfv
);
7729 SET_GetTexGeniv(table
, exec_GetTexGeniv
);
7730 SET_GetTexImage(table
, exec_GetTexImage
);
7731 SET_GetTexLevelParameterfv(table
, exec_GetTexLevelParameterfv
);
7732 SET_GetTexLevelParameteriv(table
, exec_GetTexLevelParameteriv
);
7733 SET_GetTexParameterfv(table
, exec_GetTexParameterfv
);
7734 SET_GetTexParameteriv(table
, exec_GetTexParameteriv
);
7735 SET_Hint(table
, save_Hint
);
7736 SET_IndexMask(table
, save_IndexMask
);
7737 SET_InitNames(table
, save_InitNames
);
7738 SET_IsEnabled(table
, exec_IsEnabled
);
7739 SET_IsList(table
, _mesa_IsList
);
7740 SET_LightModelf(table
, save_LightModelf
);
7741 SET_LightModelfv(table
, save_LightModelfv
);
7742 SET_LightModeli(table
, save_LightModeli
);
7743 SET_LightModeliv(table
, save_LightModeliv
);
7744 SET_Lightf(table
, save_Lightf
);
7745 SET_Lightfv(table
, save_Lightfv
);
7746 SET_Lighti(table
, save_Lighti
);
7747 SET_Lightiv(table
, save_Lightiv
);
7748 SET_LineStipple(table
, save_LineStipple
);
7749 SET_LineWidth(table
, save_LineWidth
);
7750 SET_ListBase(table
, save_ListBase
);
7751 SET_LoadIdentity(table
, save_LoadIdentity
);
7752 SET_LoadMatrixd(table
, save_LoadMatrixd
);
7753 SET_LoadMatrixf(table
, save_LoadMatrixf
);
7754 SET_LoadName(table
, save_LoadName
);
7755 SET_LogicOp(table
, save_LogicOp
);
7756 SET_Map1d(table
, save_Map1d
);
7757 SET_Map1f(table
, save_Map1f
);
7758 SET_Map2d(table
, save_Map2d
);
7759 SET_Map2f(table
, save_Map2f
);
7760 SET_MapGrid1d(table
, save_MapGrid1d
);
7761 SET_MapGrid1f(table
, save_MapGrid1f
);
7762 SET_MapGrid2d(table
, save_MapGrid2d
);
7763 SET_MapGrid2f(table
, save_MapGrid2f
);
7764 SET_MatrixMode(table
, save_MatrixMode
);
7765 SET_MultMatrixd(table
, save_MultMatrixd
);
7766 SET_MultMatrixf(table
, save_MultMatrixf
);
7767 SET_NewList(table
, save_NewList
);
7768 SET_Ortho(table
, save_Ortho
);
7769 SET_PassThrough(table
, save_PassThrough
);
7770 SET_PixelMapfv(table
, save_PixelMapfv
);
7771 SET_PixelMapuiv(table
, save_PixelMapuiv
);
7772 SET_PixelMapusv(table
, save_PixelMapusv
);
7773 SET_PixelStoref(table
, exec_PixelStoref
);
7774 SET_PixelStorei(table
, exec_PixelStorei
);
7775 SET_PixelTransferf(table
, save_PixelTransferf
);
7776 SET_PixelTransferi(table
, save_PixelTransferi
);
7777 SET_PixelZoom(table
, save_PixelZoom
);
7778 SET_PointSize(table
, save_PointSize
);
7779 SET_PolygonMode(table
, save_PolygonMode
);
7780 SET_PolygonOffset(table
, save_PolygonOffset
);
7781 SET_PolygonStipple(table
, save_PolygonStipple
);
7782 SET_PopAttrib(table
, save_PopAttrib
);
7783 SET_PopMatrix(table
, save_PopMatrix
);
7784 SET_PopName(table
, save_PopName
);
7785 SET_PushAttrib(table
, save_PushAttrib
);
7786 SET_PushMatrix(table
, save_PushMatrix
);
7787 SET_PushName(table
, save_PushName
);
7788 SET_RasterPos2d(table
, save_RasterPos2d
);
7789 SET_RasterPos2dv(table
, save_RasterPos2dv
);
7790 SET_RasterPos2f(table
, save_RasterPos2f
);
7791 SET_RasterPos2fv(table
, save_RasterPos2fv
);
7792 SET_RasterPos2i(table
, save_RasterPos2i
);
7793 SET_RasterPos2iv(table
, save_RasterPos2iv
);
7794 SET_RasterPos2s(table
, save_RasterPos2s
);
7795 SET_RasterPos2sv(table
, save_RasterPos2sv
);
7796 SET_RasterPos3d(table
, save_RasterPos3d
);
7797 SET_RasterPos3dv(table
, save_RasterPos3dv
);
7798 SET_RasterPos3f(table
, save_RasterPos3f
);
7799 SET_RasterPos3fv(table
, save_RasterPos3fv
);
7800 SET_RasterPos3i(table
, save_RasterPos3i
);
7801 SET_RasterPos3iv(table
, save_RasterPos3iv
);
7802 SET_RasterPos3s(table
, save_RasterPos3s
);
7803 SET_RasterPos3sv(table
, save_RasterPos3sv
);
7804 SET_RasterPos4d(table
, save_RasterPos4d
);
7805 SET_RasterPos4dv(table
, save_RasterPos4dv
);
7806 SET_RasterPos4f(table
, save_RasterPos4f
);
7807 SET_RasterPos4fv(table
, save_RasterPos4fv
);
7808 SET_RasterPos4i(table
, save_RasterPos4i
);
7809 SET_RasterPos4iv(table
, save_RasterPos4iv
);
7810 SET_RasterPos4s(table
, save_RasterPos4s
);
7811 SET_RasterPos4sv(table
, save_RasterPos4sv
);
7812 SET_ReadBuffer(table
, save_ReadBuffer
);
7813 SET_ReadPixels(table
, exec_ReadPixels
);
7814 SET_RenderMode(table
, exec_RenderMode
);
7815 SET_Rotated(table
, save_Rotated
);
7816 SET_Rotatef(table
, save_Rotatef
);
7817 SET_Scaled(table
, save_Scaled
);
7818 SET_Scalef(table
, save_Scalef
);
7819 SET_Scissor(table
, save_Scissor
);
7820 SET_FeedbackBuffer(table
, exec_FeedbackBuffer
);
7821 SET_SelectBuffer(table
, exec_SelectBuffer
);
7822 SET_ShadeModel(table
, save_ShadeModel
);
7823 SET_StencilFunc(table
, save_StencilFunc
);
7824 SET_StencilMask(table
, save_StencilMask
);
7825 SET_StencilOp(table
, save_StencilOp
);
7826 SET_TexEnvf(table
, save_TexEnvf
);
7827 SET_TexEnvfv(table
, save_TexEnvfv
);
7828 SET_TexEnvi(table
, save_TexEnvi
);
7829 SET_TexEnviv(table
, save_TexEnviv
);
7830 SET_TexGend(table
, save_TexGend
);
7831 SET_TexGendv(table
, save_TexGendv
);
7832 SET_TexGenf(table
, save_TexGenf
);
7833 SET_TexGenfv(table
, save_TexGenfv
);
7834 SET_TexGeni(table
, save_TexGeni
);
7835 SET_TexGeniv(table
, save_TexGeniv
);
7836 SET_TexImage1D(table
, save_TexImage1D
);
7837 SET_TexImage2D(table
, save_TexImage2D
);
7838 SET_TexParameterf(table
, save_TexParameterf
);
7839 SET_TexParameterfv(table
, save_TexParameterfv
);
7840 SET_TexParameteri(table
, save_TexParameteri
);
7841 SET_TexParameteriv(table
, save_TexParameteriv
);
7842 SET_Translated(table
, save_Translated
);
7843 SET_Translatef(table
, save_Translatef
);
7844 SET_Viewport(table
, save_Viewport
);
7847 SET_AreTexturesResident(table
, exec_AreTexturesResident
);
7848 SET_BindTexture(table
, save_BindTexture
);
7849 SET_ColorPointer(table
, exec_ColorPointer
);
7850 SET_CopyTexImage1D(table
, save_CopyTexImage1D
);
7851 SET_CopyTexImage2D(table
, save_CopyTexImage2D
);
7852 SET_CopyTexSubImage1D(table
, save_CopyTexSubImage1D
);
7853 SET_CopyTexSubImage2D(table
, save_CopyTexSubImage2D
);
7854 SET_DeleteTextures(table
, exec_DeleteTextures
);
7855 SET_DisableClientState(table
, exec_DisableClientState
);
7856 SET_EdgeFlagPointer(table
, exec_EdgeFlagPointer
);
7857 SET_EnableClientState(table
, exec_EnableClientState
);
7858 SET_GenTextures(table
, exec_GenTextures
);
7859 SET_GetPointerv(table
, exec_GetPointerv
);
7860 SET_IndexPointer(table
, exec_IndexPointer
);
7861 SET_InterleavedArrays(table
, exec_InterleavedArrays
);
7862 SET_IsTexture(table
, exec_IsTexture
);
7863 SET_NormalPointer(table
, exec_NormalPointer
);
7864 SET_PopClientAttrib(table
, exec_PopClientAttrib
);
7865 SET_PrioritizeTextures(table
, save_PrioritizeTextures
);
7866 SET_PushClientAttrib(table
, exec_PushClientAttrib
);
7867 SET_TexCoordPointer(table
, exec_TexCoordPointer
);
7868 SET_TexSubImage1D(table
, save_TexSubImage1D
);
7869 SET_TexSubImage2D(table
, save_TexSubImage2D
);
7870 SET_VertexPointer(table
, exec_VertexPointer
);
7873 SET_CopyTexSubImage3D(table
, save_CopyTexSubImage3D
);
7874 SET_TexImage3D(table
, save_TexImage3D
);
7875 SET_TexSubImage3D(table
, save_TexSubImage3D
);
7878 SET_StencilFuncSeparate(table
, save_StencilFuncSeparate
);
7879 SET_StencilMaskSeparate(table
, save_StencilMaskSeparate
);
7880 SET_StencilOpSeparate(table
, save_StencilOpSeparate
);
7882 /* ATI_separate_stencil */
7883 SET_StencilFuncSeparateATI(table
, save_StencilFuncSeparateATI
);
7885 /* GL_ARB_imaging */
7886 /* Not all are supported */
7887 SET_BlendColor(table
, save_BlendColor
);
7888 SET_BlendEquation(table
, save_BlendEquation
);
7889 SET_ColorSubTable(table
, save_ColorSubTable
);
7890 SET_ColorTable(table
, save_ColorTable
);
7891 SET_ColorTableParameterfv(table
, save_ColorTableParameterfv
);
7892 SET_ColorTableParameteriv(table
, save_ColorTableParameteriv
);
7893 SET_ConvolutionFilter1D(table
, save_ConvolutionFilter1D
);
7894 SET_ConvolutionFilter2D(table
, save_ConvolutionFilter2D
);
7895 SET_ConvolutionParameterf(table
, save_ConvolutionParameterf
);
7896 SET_ConvolutionParameterfv(table
, save_ConvolutionParameterfv
);
7897 SET_ConvolutionParameteri(table
, save_ConvolutionParameteri
);
7898 SET_ConvolutionParameteriv(table
, save_ConvolutionParameteriv
);
7899 SET_CopyColorSubTable(table
, save_CopyColorSubTable
);
7900 SET_CopyColorTable(table
, save_CopyColorTable
);
7901 SET_CopyConvolutionFilter1D(table
, exec_CopyConvolutionFilter1D
);
7902 SET_CopyConvolutionFilter2D(table
, exec_CopyConvolutionFilter2D
);
7903 SET_GetColorTable(table
, exec_GetColorTable
);
7904 SET_GetColorTableParameterfv(table
, exec_GetColorTableParameterfv
);
7905 SET_GetColorTableParameteriv(table
, exec_GetColorTableParameteriv
);
7906 SET_GetConvolutionFilter(table
, exec_GetConvolutionFilter
);
7907 SET_GetConvolutionParameterfv(table
, exec_GetConvolutionParameterfv
);
7908 SET_GetConvolutionParameteriv(table
, exec_GetConvolutionParameteriv
);
7909 SET_GetHistogram(table
, exec_GetHistogram
);
7910 SET_GetHistogramParameterfv(table
, exec_GetHistogramParameterfv
);
7911 SET_GetHistogramParameteriv(table
, exec_GetHistogramParameteriv
);
7912 SET_GetMinmax(table
, exec_GetMinmax
);
7913 SET_GetMinmaxParameterfv(table
, exec_GetMinmaxParameterfv
);
7914 SET_GetMinmaxParameteriv(table
, exec_GetMinmaxParameteriv
);
7915 SET_GetSeparableFilter(table
, exec_GetSeparableFilter
);
7916 SET_Histogram(table
, save_Histogram
);
7917 SET_Minmax(table
, save_Minmax
);
7918 SET_ResetHistogram(table
, save_ResetHistogram
);
7919 SET_ResetMinmax(table
, save_ResetMinmax
);
7920 SET_SeparableFilter2D(table
, exec_SeparableFilter2D
);
7922 /* 2. GL_EXT_blend_color */
7924 SET_BlendColorEXT(table
, save_BlendColorEXT
);
7927 /* 3. GL_EXT_polygon_offset */
7928 SET_PolygonOffsetEXT(table
, save_PolygonOffsetEXT
);
7930 /* 6. GL_EXT_texture3d */
7932 SET_CopyTexSubImage3DEXT(table
, save_CopyTexSubImage3D
);
7933 SET_TexImage3DEXT(table
, save_TexImage3DEXT
);
7934 SET_TexSubImage3DEXT(table
, save_TexSubImage3D
);
7937 /* 14. GL_SGI_color_table */
7939 SET_ColorTableSGI(table
, save_ColorTable
);
7940 SET_ColorSubTableSGI(table
, save_ColorSubTable
);
7941 SET_GetColorTableSGI(table
, exec_GetColorTable
);
7942 SET_GetColorTableParameterfvSGI(table
, exec_GetColorTableParameterfv
);
7943 SET_GetColorTableParameterivSGI(table
, exec_GetColorTableParameteriv
);
7946 /* 30. GL_EXT_vertex_array */
7947 SET_ColorPointerEXT(table
, exec_ColorPointerEXT
);
7948 SET_EdgeFlagPointerEXT(table
, exec_EdgeFlagPointerEXT
);
7949 SET_IndexPointerEXT(table
, exec_IndexPointerEXT
);
7950 SET_NormalPointerEXT(table
, exec_NormalPointerEXT
);
7951 SET_TexCoordPointerEXT(table
, exec_TexCoordPointerEXT
);
7952 SET_VertexPointerEXT(table
, exec_VertexPointerEXT
);
7954 /* 37. GL_EXT_blend_minmax */
7956 SET_BlendEquationEXT(table
, save_BlendEquationEXT
);
7959 /* 54. GL_EXT_point_parameters */
7960 SET_PointParameterfEXT(table
, save_PointParameterfEXT
);
7961 SET_PointParameterfvEXT(table
, save_PointParameterfvEXT
);
7963 /* 97. GL_EXT_compiled_vertex_array */
7964 SET_LockArraysEXT(table
, exec_LockArraysEXT
);
7965 SET_UnlockArraysEXT(table
, exec_UnlockArraysEXT
);
7967 /* 145. GL_EXT_secondary_color */
7968 SET_SecondaryColorPointerEXT(table
, exec_SecondaryColorPointerEXT
);
7970 /* 148. GL_EXT_multi_draw_arrays */
7971 SET_MultiDrawArraysEXT(table
, exec_MultiDrawArraysEXT
);
7972 SET_MultiDrawElementsEXT(table
, exec_MultiDrawElementsEXT
);
7974 /* 149. GL_EXT_fog_coord */
7975 SET_FogCoordPointerEXT(table
, exec_FogCoordPointerEXT
);
7977 /* 173. GL_EXT_blend_func_separate */
7978 SET_BlendFuncSeparateEXT(table
, save_BlendFuncSeparateEXT
);
7980 /* 196. GL_MESA_resize_buffers */
7981 SET_ResizeBuffersMESA(table
, _mesa_ResizeBuffersMESA
);
7983 /* 197. GL_MESA_window_pos */
7984 SET_WindowPos2dMESA(table
, save_WindowPos2dMESA
);
7985 SET_WindowPos2dvMESA(table
, save_WindowPos2dvMESA
);
7986 SET_WindowPos2fMESA(table
, save_WindowPos2fMESA
);
7987 SET_WindowPos2fvMESA(table
, save_WindowPos2fvMESA
);
7988 SET_WindowPos2iMESA(table
, save_WindowPos2iMESA
);
7989 SET_WindowPos2ivMESA(table
, save_WindowPos2ivMESA
);
7990 SET_WindowPos2sMESA(table
, save_WindowPos2sMESA
);
7991 SET_WindowPos2svMESA(table
, save_WindowPos2svMESA
);
7992 SET_WindowPos3dMESA(table
, save_WindowPos3dMESA
);
7993 SET_WindowPos3dvMESA(table
, save_WindowPos3dvMESA
);
7994 SET_WindowPos3fMESA(table
, save_WindowPos3fMESA
);
7995 SET_WindowPos3fvMESA(table
, save_WindowPos3fvMESA
);
7996 SET_WindowPos3iMESA(table
, save_WindowPos3iMESA
);
7997 SET_WindowPos3ivMESA(table
, save_WindowPos3ivMESA
);
7998 SET_WindowPos3sMESA(table
, save_WindowPos3sMESA
);
7999 SET_WindowPos3svMESA(table
, save_WindowPos3svMESA
);
8000 SET_WindowPos4dMESA(table
, save_WindowPos4dMESA
);
8001 SET_WindowPos4dvMESA(table
, save_WindowPos4dvMESA
);
8002 SET_WindowPos4fMESA(table
, save_WindowPos4fMESA
);
8003 SET_WindowPos4fvMESA(table
, save_WindowPos4fvMESA
);
8004 SET_WindowPos4iMESA(table
, save_WindowPos4iMESA
);
8005 SET_WindowPos4ivMESA(table
, save_WindowPos4ivMESA
);
8006 SET_WindowPos4sMESA(table
, save_WindowPos4sMESA
);
8007 SET_WindowPos4svMESA(table
, save_WindowPos4svMESA
);
8009 /* 200. GL_IBM_multimode_draw_arrays */
8010 SET_MultiModeDrawArraysIBM(table
, exec_MultiModeDrawArraysIBM
);
8011 SET_MultiModeDrawElementsIBM(table
, exec_MultiModeDrawElementsIBM
);
8013 #if FEATURE_NV_vertex_program
8014 /* 233. GL_NV_vertex_program */
8015 /* The following commands DO NOT go into display lists:
8016 * AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV,
8017 * VertexAttribPointerNV, GetProgram*, GetVertexAttrib*
8019 SET_BindProgramNV(table
, save_BindProgramNV
);
8020 SET_DeleteProgramsNV(table
, _mesa_DeletePrograms
);
8021 SET_ExecuteProgramNV(table
, save_ExecuteProgramNV
);
8022 SET_GenProgramsNV(table
, _mesa_GenPrograms
);
8023 SET_AreProgramsResidentNV(table
, _mesa_AreProgramsResidentNV
);
8024 SET_RequestResidentProgramsNV(table
, save_RequestResidentProgramsNV
);
8025 SET_GetProgramParameterfvNV(table
, _mesa_GetProgramParameterfvNV
);
8026 SET_GetProgramParameterdvNV(table
, _mesa_GetProgramParameterdvNV
);
8027 SET_GetProgramivNV(table
, _mesa_GetProgramivNV
);
8028 SET_GetProgramStringNV(table
, _mesa_GetProgramStringNV
);
8029 SET_GetTrackMatrixivNV(table
, _mesa_GetTrackMatrixivNV
);
8030 SET_GetVertexAttribdvNV(table
, _mesa_GetVertexAttribdvNV
);
8031 SET_GetVertexAttribfvNV(table
, _mesa_GetVertexAttribfvNV
);
8032 SET_GetVertexAttribivNV(table
, _mesa_GetVertexAttribivNV
);
8033 SET_GetVertexAttribPointervNV(table
, _mesa_GetVertexAttribPointervNV
);
8034 SET_IsProgramNV(table
, _mesa_IsProgramARB
);
8035 SET_LoadProgramNV(table
, save_LoadProgramNV
);
8036 SET_ProgramEnvParameter4dARB(table
, save_ProgramEnvParameter4dARB
);
8037 SET_ProgramEnvParameter4dvARB(table
, save_ProgramEnvParameter4dvARB
);
8038 SET_ProgramEnvParameter4fARB(table
, save_ProgramEnvParameter4fARB
);
8039 SET_ProgramEnvParameter4fvARB(table
, save_ProgramEnvParameter4fvARB
);
8040 SET_ProgramParameters4dvNV(table
, save_ProgramParameters4dvNV
);
8041 SET_ProgramParameters4fvNV(table
, save_ProgramParameters4fvNV
);
8042 SET_TrackMatrixNV(table
, save_TrackMatrixNV
);
8043 SET_VertexAttribPointerNV(table
, _mesa_VertexAttribPointerNV
);
8046 /* 245. GL_ATI_fragment_shader */
8047 #if FEATURE_ATI_fragment_shader
8048 SET_BindFragmentShaderATI(table
, save_BindFragmentShaderATI
);
8049 SET_SetFragmentShaderConstantATI(table
, save_SetFragmentShaderConstantATI
);
8052 /* 282. GL_NV_fragment_program */
8053 #if FEATURE_NV_fragment_program
8054 SET_ProgramNamedParameter4fNV(table
, save_ProgramNamedParameter4fNV
);
8055 SET_ProgramNamedParameter4dNV(table
, save_ProgramNamedParameter4dNV
);
8056 SET_ProgramNamedParameter4fvNV(table
, save_ProgramNamedParameter4fvNV
);
8057 SET_ProgramNamedParameter4dvNV(table
, save_ProgramNamedParameter4dvNV
);
8058 SET_GetProgramNamedParameterfvNV(table
,
8059 _mesa_GetProgramNamedParameterfvNV
);
8060 SET_GetProgramNamedParameterdvNV(table
,
8061 _mesa_GetProgramNamedParameterdvNV
);
8062 SET_ProgramLocalParameter4dARB(table
, save_ProgramLocalParameter4dARB
);
8063 SET_ProgramLocalParameter4dvARB(table
, save_ProgramLocalParameter4dvARB
);
8064 SET_ProgramLocalParameter4fARB(table
, save_ProgramLocalParameter4fARB
);
8065 SET_ProgramLocalParameter4fvARB(table
, save_ProgramLocalParameter4fvARB
);
8066 SET_GetProgramLocalParameterdvARB(table
,
8067 _mesa_GetProgramLocalParameterdvARB
);
8068 SET_GetProgramLocalParameterfvARB(table
,
8069 _mesa_GetProgramLocalParameterfvARB
);
8072 /* 262. GL_NV_point_sprite */
8073 SET_PointParameteriNV(table
, save_PointParameteriNV
);
8074 SET_PointParameterivNV(table
, save_PointParameterivNV
);
8076 /* 268. GL_EXT_stencil_two_side */
8077 SET_ActiveStencilFaceEXT(table
, save_ActiveStencilFaceEXT
);
8079 /* 273. GL_APPLE_vertex_array_object */
8080 SET_BindVertexArrayAPPLE(table
, _mesa_BindVertexArrayAPPLE
);
8081 SET_DeleteVertexArraysAPPLE(table
, _mesa_DeleteVertexArraysAPPLE
);
8082 SET_GenVertexArraysAPPLE(table
, _mesa_GenVertexArraysAPPLE
);
8083 SET_IsVertexArrayAPPLE(table
, _mesa_IsVertexArrayAPPLE
);
8085 /* ???. GL_EXT_depth_bounds_test */
8086 SET_DepthBoundsEXT(table
, save_DepthBoundsEXT
);
8088 /* ARB 1. GL_ARB_multitexture */
8089 SET_ActiveTextureARB(table
, save_ActiveTextureARB
);
8090 SET_ClientActiveTextureARB(table
, exec_ClientActiveTextureARB
);
8092 /* ARB 3. GL_ARB_transpose_matrix */
8093 SET_LoadTransposeMatrixdARB(table
, save_LoadTransposeMatrixdARB
);
8094 SET_LoadTransposeMatrixfARB(table
, save_LoadTransposeMatrixfARB
);
8095 SET_MultTransposeMatrixdARB(table
, save_MultTransposeMatrixdARB
);
8096 SET_MultTransposeMatrixfARB(table
, save_MultTransposeMatrixfARB
);
8098 /* ARB 5. GL_ARB_multisample */
8099 SET_SampleCoverageARB(table
, save_SampleCoverageARB
);
8101 /* ARB 12. GL_ARB_texture_compression */
8102 SET_CompressedTexImage3DARB(table
, save_CompressedTexImage3DARB
);
8103 SET_CompressedTexImage2DARB(table
, save_CompressedTexImage2DARB
);
8104 SET_CompressedTexImage1DARB(table
, save_CompressedTexImage1DARB
);
8105 SET_CompressedTexSubImage3DARB(table
, save_CompressedTexSubImage3DARB
);
8106 SET_CompressedTexSubImage2DARB(table
, save_CompressedTexSubImage2DARB
);
8107 SET_CompressedTexSubImage1DARB(table
, save_CompressedTexSubImage1DARB
);
8108 SET_GetCompressedTexImageARB(table
, exec_GetCompressedTexImageARB
);
8110 /* ARB 14. GL_ARB_point_parameters */
8111 /* aliased with EXT_point_parameters functions */
8113 /* ARB 25. GL_ARB_window_pos */
8114 /* aliased with MESA_window_pos functions */
8116 /* ARB 26. GL_ARB_vertex_program */
8117 /* ARB 27. GL_ARB_fragment_program */
8118 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
8119 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
8120 SET_VertexAttribPointerARB(table
, _mesa_VertexAttribPointerARB
);
8121 SET_EnableVertexAttribArrayARB(table
, _mesa_EnableVertexAttribArrayARB
);
8122 SET_DisableVertexAttribArrayARB(table
, _mesa_DisableVertexAttribArrayARB
);
8123 SET_ProgramStringARB(table
, save_ProgramStringARB
);
8124 SET_BindProgramNV(table
, save_BindProgramNV
);
8125 SET_DeleteProgramsNV(table
, _mesa_DeletePrograms
);
8126 SET_GenProgramsNV(table
, _mesa_GenPrograms
);
8127 SET_IsProgramNV(table
, _mesa_IsProgramARB
);
8128 SET_GetVertexAttribdvNV(table
, _mesa_GetVertexAttribdvNV
);
8129 SET_GetVertexAttribfvNV(table
, _mesa_GetVertexAttribfvNV
);
8130 SET_GetVertexAttribivNV(table
, _mesa_GetVertexAttribivNV
);
8131 SET_GetVertexAttribPointervNV(table
, _mesa_GetVertexAttribPointervNV
);
8132 SET_ProgramEnvParameter4dARB(table
, save_ProgramEnvParameter4dARB
);
8133 SET_ProgramEnvParameter4dvARB(table
, save_ProgramEnvParameter4dvARB
);
8134 SET_ProgramEnvParameter4fARB(table
, save_ProgramEnvParameter4fARB
);
8135 SET_ProgramEnvParameter4fvARB(table
, save_ProgramEnvParameter4fvARB
);
8136 SET_ProgramLocalParameter4dARB(table
, save_ProgramLocalParameter4dARB
);
8137 SET_ProgramLocalParameter4dvARB(table
, save_ProgramLocalParameter4dvARB
);
8138 SET_ProgramLocalParameter4fARB(table
, save_ProgramLocalParameter4fARB
);
8139 SET_ProgramLocalParameter4fvARB(table
, save_ProgramLocalParameter4fvARB
);
8140 SET_GetProgramEnvParameterdvARB(table
, _mesa_GetProgramEnvParameterdvARB
);
8141 SET_GetProgramEnvParameterfvARB(table
, _mesa_GetProgramEnvParameterfvARB
);
8142 SET_GetProgramLocalParameterdvARB(table
,
8143 _mesa_GetProgramLocalParameterdvARB
);
8144 SET_GetProgramLocalParameterfvARB(table
,
8145 _mesa_GetProgramLocalParameterfvARB
);
8146 SET_GetProgramivARB(table
, _mesa_GetProgramivARB
);
8147 SET_GetProgramStringARB(table
, _mesa_GetProgramStringARB
);
8150 /* ARB 28. GL_ARB_vertex_buffer_object */
8151 #if FEATURE_ARB_vertex_buffer_object
8152 /* None of the extension's functions get compiled */
8153 SET_BindBufferARB(table
, _mesa_BindBufferARB
);
8154 SET_BufferDataARB(table
, _mesa_BufferDataARB
);
8155 SET_BufferSubDataARB(table
, _mesa_BufferSubDataARB
);
8156 SET_DeleteBuffersARB(table
, _mesa_DeleteBuffersARB
);
8157 SET_GenBuffersARB(table
, _mesa_GenBuffersARB
);
8158 SET_GetBufferParameterivARB(table
, _mesa_GetBufferParameterivARB
);
8159 SET_GetBufferPointervARB(table
, _mesa_GetBufferPointervARB
);
8160 SET_GetBufferSubDataARB(table
, _mesa_GetBufferSubDataARB
);
8161 SET_IsBufferARB(table
, _mesa_IsBufferARB
);
8162 SET_MapBufferARB(table
, _mesa_MapBufferARB
);
8163 SET_UnmapBufferARB(table
, _mesa_UnmapBufferARB
);
8166 #if FEATURE_ARB_occlusion_query
8167 SET_BeginQueryARB(table
, save_BeginQueryARB
);
8168 SET_EndQueryARB(table
, save_EndQueryARB
);
8169 SET_GenQueriesARB(table
, _mesa_GenQueriesARB
);
8170 SET_DeleteQueriesARB(table
, _mesa_DeleteQueriesARB
);
8171 SET_IsQueryARB(table
, _mesa_IsQueryARB
);
8172 SET_GetQueryivARB(table
, _mesa_GetQueryivARB
);
8173 SET_GetQueryObjectivARB(table
, _mesa_GetQueryObjectivARB
);
8174 SET_GetQueryObjectuivARB(table
, _mesa_GetQueryObjectuivARB
);
8176 SET_DrawBuffersARB(table
, save_DrawBuffersARB
);
8178 #if FEATURE_EXT_framebuffer_blit
8179 SET_BlitFramebufferEXT(table
, save_BlitFramebufferEXT
);
8182 /* ARB 30/31/32. GL_ARB_shader_objects, GL_ARB_vertex/fragment_shader */
8183 SET_BindAttribLocationARB(table
, exec_BindAttribLocationARB
);
8184 SET_GetAttribLocationARB(table
, exec_GetAttribLocationARB
);
8185 /* XXX additional functions need to be implemented here! */
8187 /* 299. GL_EXT_blend_equation_separate */
8188 SET_BlendEquationSeparateEXT(table
, save_BlendEquationSeparateEXT
);
8190 /* GL_EXT_gpu_program_parmaeters */
8191 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
8192 SET_ProgramEnvParameters4fvEXT(table
, save_ProgramEnvParameters4fvEXT
);
8193 SET_ProgramLocalParameters4fvEXT(table
, save_ProgramLocalParameters4fvEXT
);
8200 enum_string(GLenum k
)
8202 return _mesa_lookup_enum_by_nr(k
);
8207 * Print the commands in a display list. For debugging only.
8208 * TODO: many commands aren't handled yet.
8210 static void GLAPIENTRY
8211 print_list(GLcontext
*ctx
, GLuint list
)
8213 struct mesa_display_list
*dlist
;
8217 if (!islist(ctx
, list
)) {
8218 _mesa_printf("%u is not a display list ID\n", list
);
8222 dlist
= lookup_list(ctx
, list
);
8228 _mesa_printf("START-LIST %u, address %p\n", list
, (void *) n
);
8230 done
= n
? GL_FALSE
: GL_TRUE
;
8232 OpCode opcode
= n
[0].opcode
;
8233 GLint i
= (GLint
) n
[0].opcode
- (GLint
) OPCODE_EXT_0
;
8235 if (i
>= 0 && i
< (GLint
) ctx
->ListExt
.NumOpcodes
) {
8236 /* this is a driver-extended opcode */
8237 ctx
->ListExt
.Opcode
[i
].Print(ctx
, &n
[1]);
8238 n
+= ctx
->ListExt
.Opcode
[i
].Size
;
8243 _mesa_printf("Accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
8246 _mesa_printf("Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
8247 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
, (void *) n
[7].data
);
8249 case OPCODE_CALL_LIST
:
8250 _mesa_printf("CallList %d\n", (int) n
[1].ui
);
8252 case OPCODE_CALL_LIST_OFFSET
:
8253 _mesa_printf("CallList %d + offset %u = %u\n", (int) n
[1].ui
,
8254 ctx
->List
.ListBase
, ctx
->List
.ListBase
+ n
[1].ui
);
8256 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
8257 _mesa_printf("ColorTableParameterfv %s %s %f %f %f %f\n",
8258 enum_string(n
[1].e
), enum_string(n
[2].e
),
8259 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8261 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
8262 _mesa_printf("ColorTableParameteriv %s %s %d %d %d %d\n",
8263 enum_string(n
[1].e
), enum_string(n
[2].e
),
8264 n
[3].i
, n
[4].i
, n
[5].i
, n
[6].i
);
8266 case OPCODE_DISABLE
:
8267 _mesa_printf("Disable %s\n", enum_string(n
[1].e
));
8270 _mesa_printf("Enable %s\n", enum_string(n
[1].e
));
8272 case OPCODE_FRUSTUM
:
8273 _mesa_printf("Frustum %g %g %g %g %g %g\n",
8274 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8276 case OPCODE_LINE_STIPPLE
:
8277 _mesa_printf("LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
8279 case OPCODE_LOAD_IDENTITY
:
8280 _mesa_printf("LoadIdentity\n");
8282 case OPCODE_LOAD_MATRIX
:
8283 _mesa_printf("LoadMatrix\n");
8284 _mesa_printf(" %8f %8f %8f %8f\n",
8285 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
8286 _mesa_printf(" %8f %8f %8f %8f\n",
8287 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
8288 _mesa_printf(" %8f %8f %8f %8f\n",
8289 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
8290 _mesa_printf(" %8f %8f %8f %8f\n",
8291 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
8293 case OPCODE_MULT_MATRIX
:
8294 _mesa_printf("MultMatrix (or Rotate)\n");
8295 _mesa_printf(" %8f %8f %8f %8f\n",
8296 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
8297 _mesa_printf(" %8f %8f %8f %8f\n",
8298 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
8299 _mesa_printf(" %8f %8f %8f %8f\n",
8300 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
8301 _mesa_printf(" %8f %8f %8f %8f\n",
8302 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
8305 _mesa_printf("Ortho %g %g %g %g %g %g\n",
8306 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8308 case OPCODE_POP_ATTRIB
:
8309 _mesa_printf("PopAttrib\n");
8311 case OPCODE_POP_MATRIX
:
8312 _mesa_printf("PopMatrix\n");
8314 case OPCODE_POP_NAME
:
8315 _mesa_printf("PopName\n");
8317 case OPCODE_PUSH_ATTRIB
:
8318 _mesa_printf("PushAttrib %x\n", n
[1].bf
);
8320 case OPCODE_PUSH_MATRIX
:
8321 _mesa_printf("PushMatrix\n");
8323 case OPCODE_PUSH_NAME
:
8324 _mesa_printf("PushName %d\n", (int) n
[1].ui
);
8326 case OPCODE_RASTER_POS
:
8327 _mesa_printf("RasterPos %g %g %g %g\n",
8328 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
8331 _mesa_printf("Rotate %g %g %g %g\n",
8332 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
8335 _mesa_printf("Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
8337 case OPCODE_TRANSLATE
:
8338 _mesa_printf("Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
8340 case OPCODE_BIND_TEXTURE
:
8341 _mesa_printf("BindTexture %s %d\n",
8342 _mesa_lookup_enum_by_nr(n
[1].ui
), n
[2].ui
);
8344 case OPCODE_SHADE_MODEL
:
8345 _mesa_printf("ShadeModel %s\n", _mesa_lookup_enum_by_nr(n
[1].ui
));
8348 _mesa_printf("Map1 %s %.3f %.3f %d %d\n",
8349 _mesa_lookup_enum_by_nr(n
[1].ui
),
8350 n
[2].f
, n
[3].f
, n
[4].i
, n
[5].i
);
8353 _mesa_printf("Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
8354 _mesa_lookup_enum_by_nr(n
[1].ui
),
8355 n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
,
8356 n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
8358 case OPCODE_MAPGRID1
:
8359 _mesa_printf("MapGrid1 %d %.3f %.3f\n", n
[1].i
, n
[2].f
, n
[3].f
);
8361 case OPCODE_MAPGRID2
:
8362 _mesa_printf("MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
8363 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
8365 case OPCODE_EVALMESH1
:
8366 _mesa_printf("EvalMesh1 %d %d\n", n
[1].i
, n
[2].i
);
8368 case OPCODE_EVALMESH2
:
8369 _mesa_printf("EvalMesh2 %d %d %d %d\n",
8370 n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
8373 case OPCODE_ATTR_1F_NV
:
8374 _mesa_printf("ATTR_1F_NV attr %d: %f\n", n
[1].i
, n
[2].f
);
8376 case OPCODE_ATTR_2F_NV
:
8377 _mesa_printf("ATTR_2F_NV attr %d: %f %f\n",
8378 n
[1].i
, n
[2].f
, n
[3].f
);
8380 case OPCODE_ATTR_3F_NV
:
8381 _mesa_printf("ATTR_3F_NV attr %d: %f %f %f\n",
8382 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
8384 case OPCODE_ATTR_4F_NV
:
8385 _mesa_printf("ATTR_4F_NV attr %d: %f %f %f %f\n",
8386 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
8388 case OPCODE_ATTR_1F_ARB
:
8389 _mesa_printf("ATTR_1F_ARB attr %d: %f\n", n
[1].i
, n
[2].f
);
8391 case OPCODE_ATTR_2F_ARB
:
8392 _mesa_printf("ATTR_2F_ARB attr %d: %f %f\n",
8393 n
[1].i
, n
[2].f
, n
[3].f
);
8395 case OPCODE_ATTR_3F_ARB
:
8396 _mesa_printf("ATTR_3F_ARB attr %d: %f %f %f\n",
8397 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
8399 case OPCODE_ATTR_4F_ARB
:
8400 _mesa_printf("ATTR_4F_ARB attr %d: %f %f %f %f\n",
8401 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
8404 case OPCODE_MATERIAL
:
8405 _mesa_printf("MATERIAL %x %x: %f %f %f %f\n",
8406 n
[1].i
, n
[2].i
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8409 _mesa_printf("BEGIN %x\n", n
[1].i
);
8412 _mesa_printf("END\n");
8415 _mesa_printf("RECTF %f %f %f %f\n", n
[1].f
, n
[2].f
, n
[3].f
,
8418 case OPCODE_EVAL_C1
:
8419 _mesa_printf("EVAL_C1 %f\n", n
[1].f
);
8421 case OPCODE_EVAL_C2
:
8422 _mesa_printf("EVAL_C2 %f %f\n", n
[1].f
, n
[2].f
);
8424 case OPCODE_EVAL_P1
:
8425 _mesa_printf("EVAL_P1 %d\n", n
[1].i
);
8427 case OPCODE_EVAL_P2
:
8428 _mesa_printf("EVAL_P2 %d %d\n", n
[1].i
, n
[2].i
);
8432 * meta opcodes/commands
8435 _mesa_printf("Error: %s %s\n",
8436 enum_string(n
[1].e
), (const char *) n
[2].data
);
8438 case OPCODE_CONTINUE
:
8439 _mesa_printf("DISPLAY-LIST-CONTINUE\n");
8440 n
= (Node
*) n
[1].next
;
8442 case OPCODE_END_OF_LIST
:
8443 _mesa_printf("END-LIST %u\n", list
);
8447 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
8449 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
8450 opcode
, (void *) n
);
8454 _mesa_printf("command %d, %u operands\n", opcode
,
8458 /* increment n to point to next compiled command */
8459 if (opcode
!= OPCODE_CONTINUE
) {
8460 n
+= InstSize
[opcode
];
8469 * Clients may call this function to help debug display list problems.
8470 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
8471 * changed, or break in the future without notice.
8474 mesa_print_display_list(GLuint list
)
8476 GET_CURRENT_CONTEXT(ctx
);
8477 print_list(ctx
, list
);
8481 /**********************************************************************/
8482 /***** Initialization *****/
8483 /**********************************************************************/
8486 _mesa_save_vtxfmt_init(GLvertexformat
* vfmt
)
8488 vfmt
->ArrayElement
= _ae_loopback_array_elt
; /* generic helper */
8489 vfmt
->Begin
= save_Begin
;
8490 vfmt
->CallList
= _mesa_save_CallList
;
8491 vfmt
->CallLists
= _mesa_save_CallLists
;
8492 vfmt
->Color3f
= save_Color3f
;
8493 vfmt
->Color3fv
= save_Color3fv
;
8494 vfmt
->Color4f
= save_Color4f
;
8495 vfmt
->Color4fv
= save_Color4fv
;
8496 vfmt
->EdgeFlag
= save_EdgeFlag
;
8497 vfmt
->End
= save_End
;
8498 vfmt
->EvalCoord1f
= save_EvalCoord1f
;
8499 vfmt
->EvalCoord1fv
= save_EvalCoord1fv
;
8500 vfmt
->EvalCoord2f
= save_EvalCoord2f
;
8501 vfmt
->EvalCoord2fv
= save_EvalCoord2fv
;
8502 vfmt
->EvalPoint1
= save_EvalPoint1
;
8503 vfmt
->EvalPoint2
= save_EvalPoint2
;
8504 vfmt
->FogCoordfEXT
= save_FogCoordfEXT
;
8505 vfmt
->FogCoordfvEXT
= save_FogCoordfvEXT
;
8506 vfmt
->Indexf
= save_Indexf
;
8507 vfmt
->Indexfv
= save_Indexfv
;
8508 vfmt
->Materialfv
= save_Materialfv
;
8509 vfmt
->MultiTexCoord1fARB
= save_MultiTexCoord1f
;
8510 vfmt
->MultiTexCoord1fvARB
= save_MultiTexCoord1fv
;
8511 vfmt
->MultiTexCoord2fARB
= save_MultiTexCoord2f
;
8512 vfmt
->MultiTexCoord2fvARB
= save_MultiTexCoord2fv
;
8513 vfmt
->MultiTexCoord3fARB
= save_MultiTexCoord3f
;
8514 vfmt
->MultiTexCoord3fvARB
= save_MultiTexCoord3fv
;
8515 vfmt
->MultiTexCoord4fARB
= save_MultiTexCoord4f
;
8516 vfmt
->MultiTexCoord4fvARB
= save_MultiTexCoord4fv
;
8517 vfmt
->Normal3f
= save_Normal3f
;
8518 vfmt
->Normal3fv
= save_Normal3fv
;
8519 vfmt
->SecondaryColor3fEXT
= save_SecondaryColor3fEXT
;
8520 vfmt
->SecondaryColor3fvEXT
= save_SecondaryColor3fvEXT
;
8521 vfmt
->TexCoord1f
= save_TexCoord1f
;
8522 vfmt
->TexCoord1fv
= save_TexCoord1fv
;
8523 vfmt
->TexCoord2f
= save_TexCoord2f
;
8524 vfmt
->TexCoord2fv
= save_TexCoord2fv
;
8525 vfmt
->TexCoord3f
= save_TexCoord3f
;
8526 vfmt
->TexCoord3fv
= save_TexCoord3fv
;
8527 vfmt
->TexCoord4f
= save_TexCoord4f
;
8528 vfmt
->TexCoord4fv
= save_TexCoord4fv
;
8529 vfmt
->Vertex2f
= save_Vertex2f
;
8530 vfmt
->Vertex2fv
= save_Vertex2fv
;
8531 vfmt
->Vertex3f
= save_Vertex3f
;
8532 vfmt
->Vertex3fv
= save_Vertex3fv
;
8533 vfmt
->Vertex4f
= save_Vertex4f
;
8534 vfmt
->Vertex4fv
= save_Vertex4fv
;
8535 vfmt
->VertexAttrib1fNV
= save_VertexAttrib1fNV
;
8536 vfmt
->VertexAttrib1fvNV
= save_VertexAttrib1fvNV
;
8537 vfmt
->VertexAttrib2fNV
= save_VertexAttrib2fNV
;
8538 vfmt
->VertexAttrib2fvNV
= save_VertexAttrib2fvNV
;
8539 vfmt
->VertexAttrib3fNV
= save_VertexAttrib3fNV
;
8540 vfmt
->VertexAttrib3fvNV
= save_VertexAttrib3fvNV
;
8541 vfmt
->VertexAttrib4fNV
= save_VertexAttrib4fNV
;
8542 vfmt
->VertexAttrib4fvNV
= save_VertexAttrib4fvNV
;
8543 vfmt
->VertexAttrib1fARB
= save_VertexAttrib1fARB
;
8544 vfmt
->VertexAttrib1fvARB
= save_VertexAttrib1fvARB
;
8545 vfmt
->VertexAttrib2fARB
= save_VertexAttrib2fARB
;
8546 vfmt
->VertexAttrib2fvARB
= save_VertexAttrib2fvARB
;
8547 vfmt
->VertexAttrib3fARB
= save_VertexAttrib3fARB
;
8548 vfmt
->VertexAttrib3fvARB
= save_VertexAttrib3fvARB
;
8549 vfmt
->VertexAttrib4fARB
= save_VertexAttrib4fARB
;
8550 vfmt
->VertexAttrib4fvARB
= save_VertexAttrib4fvARB
;
8552 vfmt
->EvalMesh1
= _mesa_save_EvalMesh1
;
8553 vfmt
->EvalMesh2
= _mesa_save_EvalMesh2
;
8554 vfmt
->Rectf
= save_Rectf
;
8556 /* The driver is required to implement these as
8557 * 1) They can probably do a better job.
8558 * 2) A lot of new mechanisms would have to be added to this module
8559 * to support it. That code would probably never get used,
8563 vfmt
->DrawArrays
= 0;
8564 vfmt
->DrawElements
= 0;
8565 vfmt
->DrawRangeElements
= 0;
8571 * Initialize display list state for given context.
8574 _mesa_init_display_list(GLcontext
*ctx
)
8576 static GLboolean tableInitialized
= GL_FALSE
;
8578 /* zero-out the instruction size table, just once */
8579 if (!tableInitialized
) {
8580 _mesa_bzero(InstSize
, sizeof(InstSize
));
8581 tableInitialized
= GL_TRUE
;
8585 ctx
->ListState
.CallDepth
= 0;
8586 ctx
->ExecuteFlag
= GL_TRUE
;
8587 ctx
->CompileFlag
= GL_FALSE
;
8588 ctx
->ListState
.CurrentListPtr
= NULL
;
8589 ctx
->ListState
.CurrentBlock
= NULL
;
8590 ctx
->ListState
.CurrentListNum
= 0;
8591 ctx
->ListState
.CurrentPos
= 0;
8593 /* Display List group */
8594 ctx
->List
.ListBase
= 0;
8596 _mesa_save_vtxfmt_init(&ctx
->ListState
.ListVtxfmt
);