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_BlendColor(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
934 GET_CURRENT_CONTEXT(ctx
);
936 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
937 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BLEND_COLOR
, 4);
944 if (ctx
->ExecuteFlag
) {
945 CALL_BlendColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
951 _mesa_save_CallList(GLuint list
)
953 GET_CURRENT_CONTEXT(ctx
);
955 SAVE_FLUSH_VERTICES(ctx
);
957 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CALL_LIST
, 1);
962 /* After this, we don't know what begin/end state we're in:
964 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
966 if (ctx
->ExecuteFlag
) {
967 CALL_CallList(ctx
->Exec
, (list
));
973 _mesa_save_CallLists(GLsizei n
, GLenum type
, const GLvoid
* lists
)
975 GET_CURRENT_CONTEXT(ctx
);
977 GLboolean typeErrorFlag
;
979 SAVE_FLUSH_VERTICES(ctx
);
983 case GL_UNSIGNED_BYTE
:
985 case GL_UNSIGNED_SHORT
:
987 case GL_UNSIGNED_INT
:
992 typeErrorFlag
= GL_FALSE
;
995 typeErrorFlag
= GL_TRUE
;
998 for (i
= 0; i
< n
; i
++) {
999 GLint list
= translate_id(i
, type
, lists
);
1000 Node
*n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CALL_LIST_OFFSET
, 2);
1003 n
[2].b
= typeErrorFlag
;
1007 /* After this, we don't know what begin/end state we're in:
1009 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
1011 if (ctx
->ExecuteFlag
) {
1012 CALL_CallLists(ctx
->Exec
, (n
, type
, lists
));
1017 static void GLAPIENTRY
1018 save_Clear(GLbitfield mask
)
1020 GET_CURRENT_CONTEXT(ctx
);
1022 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1023 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLEAR
, 1);
1027 if (ctx
->ExecuteFlag
) {
1028 CALL_Clear(ctx
->Exec
, (mask
));
1033 static void GLAPIENTRY
1034 save_ClearAccum(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
1036 GET_CURRENT_CONTEXT(ctx
);
1038 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1039 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLEAR_ACCUM
, 4);
1046 if (ctx
->ExecuteFlag
) {
1047 CALL_ClearAccum(ctx
->Exec
, (red
, green
, blue
, alpha
));
1052 static void GLAPIENTRY
1053 save_ClearColor(GLclampf red
, GLclampf green
, GLclampf blue
, GLclampf alpha
)
1055 GET_CURRENT_CONTEXT(ctx
);
1057 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1058 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLEAR_COLOR
, 4);
1065 if (ctx
->ExecuteFlag
) {
1066 CALL_ClearColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
1071 static void GLAPIENTRY
1072 save_ClearDepth(GLclampd depth
)
1074 GET_CURRENT_CONTEXT(ctx
);
1076 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1077 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLEAR_DEPTH
, 1);
1079 n
[1].f
= (GLfloat
) depth
;
1081 if (ctx
->ExecuteFlag
) {
1082 CALL_ClearDepth(ctx
->Exec
, (depth
));
1087 static void GLAPIENTRY
1088 save_ClearIndex(GLfloat c
)
1090 GET_CURRENT_CONTEXT(ctx
);
1092 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1093 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLEAR_INDEX
, 1);
1097 if (ctx
->ExecuteFlag
) {
1098 CALL_ClearIndex(ctx
->Exec
, (c
));
1103 static void GLAPIENTRY
1104 save_ClearStencil(GLint s
)
1106 GET_CURRENT_CONTEXT(ctx
);
1108 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1109 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLEAR_STENCIL
, 1);
1113 if (ctx
->ExecuteFlag
) {
1114 CALL_ClearStencil(ctx
->Exec
, (s
));
1119 static void GLAPIENTRY
1120 save_ClipPlane(GLenum plane
, const GLdouble
* equ
)
1122 GET_CURRENT_CONTEXT(ctx
);
1124 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1125 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CLIP_PLANE
, 5);
1128 n
[2].f
= (GLfloat
) equ
[0];
1129 n
[3].f
= (GLfloat
) equ
[1];
1130 n
[4].f
= (GLfloat
) equ
[2];
1131 n
[5].f
= (GLfloat
) equ
[3];
1133 if (ctx
->ExecuteFlag
) {
1134 CALL_ClipPlane(ctx
->Exec
, (plane
, equ
));
1140 static void GLAPIENTRY
1141 save_ColorMask(GLboolean red
, GLboolean green
,
1142 GLboolean blue
, GLboolean alpha
)
1144 GET_CURRENT_CONTEXT(ctx
);
1146 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1147 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COLOR_MASK
, 4);
1154 if (ctx
->ExecuteFlag
) {
1155 CALL_ColorMask(ctx
->Exec
, (red
, green
, blue
, alpha
));
1160 static void GLAPIENTRY
1161 save_ColorMaterial(GLenum face
, GLenum mode
)
1163 GET_CURRENT_CONTEXT(ctx
);
1165 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1167 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COLOR_MATERIAL
, 2);
1172 if (ctx
->ExecuteFlag
) {
1173 CALL_ColorMaterial(ctx
->Exec
, (face
, mode
));
1178 static void GLAPIENTRY
1179 save_ColorTable(GLenum target
, GLenum internalFormat
,
1180 GLsizei width
, GLenum format
, GLenum type
,
1181 const GLvoid
* table
)
1183 GET_CURRENT_CONTEXT(ctx
);
1184 if (_mesa_is_proxy_texture(target
)) {
1185 /* execute immediately */
1186 CALL_ColorTable(ctx
->Exec
, (target
, internalFormat
, width
,
1187 format
, type
, table
));
1190 GLvoid
*image
= unpack_image(1, width
, 1, 1, format
, type
, table
,
1193 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1194 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COLOR_TABLE
, 6);
1197 n
[2].e
= internalFormat
;
1206 if (ctx
->ExecuteFlag
) {
1207 CALL_ColorTable(ctx
->Exec
, (target
, internalFormat
, width
,
1208 format
, type
, table
));
1215 static void GLAPIENTRY
1216 save_ColorTableParameterfv(GLenum target
, GLenum pname
,
1217 const GLfloat
*params
)
1219 GET_CURRENT_CONTEXT(ctx
);
1222 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1224 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COLOR_TABLE_PARAMETER_FV
, 6);
1229 if (pname
== GL_COLOR_TABLE_SGI
||
1230 pname
== GL_POST_CONVOLUTION_COLOR_TABLE_SGI
||
1231 pname
== GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI
||
1232 pname
== GL_TEXTURE_COLOR_TABLE_SGI
) {
1239 if (ctx
->ExecuteFlag
) {
1240 CALL_ColorTableParameterfv(ctx
->Exec
, (target
, pname
, params
));
1245 static void GLAPIENTRY
1246 save_ColorTableParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
1248 GET_CURRENT_CONTEXT(ctx
);
1251 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1253 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COLOR_TABLE_PARAMETER_IV
, 6);
1258 if (pname
== GL_COLOR_TABLE_SGI
||
1259 pname
== GL_POST_CONVOLUTION_COLOR_TABLE_SGI
||
1260 pname
== GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI
||
1261 pname
== GL_TEXTURE_COLOR_TABLE_SGI
) {
1268 if (ctx
->ExecuteFlag
) {
1269 CALL_ColorTableParameteriv(ctx
->Exec
, (target
, pname
, params
));
1275 static void GLAPIENTRY
1276 save_ColorSubTable(GLenum target
, GLsizei start
, GLsizei count
,
1277 GLenum format
, GLenum type
, const GLvoid
* table
)
1279 GET_CURRENT_CONTEXT(ctx
);
1280 GLvoid
*image
= unpack_image(1, count
, 1, 1, format
, type
, table
,
1283 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1284 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COLOR_SUB_TABLE
, 6);
1296 if (ctx
->ExecuteFlag
) {
1297 CALL_ColorSubTable(ctx
->Exec
,
1298 (target
, start
, count
, format
, type
, table
));
1303 static void GLAPIENTRY
1304 save_CopyColorSubTable(GLenum target
, GLsizei start
,
1305 GLint x
, GLint y
, GLsizei width
)
1307 GET_CURRENT_CONTEXT(ctx
);
1310 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1311 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_COLOR_SUB_TABLE
, 5);
1319 if (ctx
->ExecuteFlag
) {
1320 CALL_CopyColorSubTable(ctx
->Exec
, (target
, start
, x
, y
, width
));
1325 static void GLAPIENTRY
1326 save_CopyColorTable(GLenum target
, GLenum internalformat
,
1327 GLint x
, GLint y
, GLsizei width
)
1329 GET_CURRENT_CONTEXT(ctx
);
1332 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1333 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_COLOR_TABLE
, 5);
1336 n
[2].e
= internalformat
;
1341 if (ctx
->ExecuteFlag
) {
1342 CALL_CopyColorTable(ctx
->Exec
, (target
, internalformat
, x
, y
, width
));
1347 static void GLAPIENTRY
1348 save_ConvolutionFilter1D(GLenum target
, GLenum internalFormat
, GLsizei width
,
1349 GLenum format
, GLenum type
, const GLvoid
* filter
)
1351 GET_CURRENT_CONTEXT(ctx
);
1352 GLvoid
*image
= unpack_image(1, width
, 1, 1, format
, type
, filter
,
1355 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1356 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CONVOLUTION_FILTER_1D
, 6);
1359 n
[2].e
= internalFormat
;
1368 if (ctx
->ExecuteFlag
) {
1369 CALL_ConvolutionFilter1D(ctx
->Exec
, (target
, internalFormat
, width
,
1370 format
, type
, filter
));
1375 static void GLAPIENTRY
1376 save_ConvolutionFilter2D(GLenum target
, GLenum internalFormat
,
1377 GLsizei width
, GLsizei height
, GLenum format
,
1378 GLenum type
, const GLvoid
* filter
)
1380 GET_CURRENT_CONTEXT(ctx
);
1381 GLvoid
*image
= unpack_image(2, width
, height
, 1, format
, type
, filter
,
1384 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1385 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CONVOLUTION_FILTER_2D
, 7);
1388 n
[2].e
= internalFormat
;
1398 if (ctx
->ExecuteFlag
) {
1399 CALL_ConvolutionFilter2D(ctx
->Exec
,
1400 (target
, internalFormat
, width
, height
, format
,
1406 static void GLAPIENTRY
1407 save_ConvolutionParameteri(GLenum target
, GLenum pname
, GLint param
)
1409 GET_CURRENT_CONTEXT(ctx
);
1411 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1412 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CONVOLUTION_PARAMETER_I
, 3);
1418 if (ctx
->ExecuteFlag
) {
1419 CALL_ConvolutionParameteri(ctx
->Exec
, (target
, pname
, param
));
1424 static void GLAPIENTRY
1425 save_ConvolutionParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
1427 GET_CURRENT_CONTEXT(ctx
);
1429 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1430 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CONVOLUTION_PARAMETER_IV
, 6);
1435 if (pname
== GL_CONVOLUTION_BORDER_COLOR
||
1436 pname
== GL_CONVOLUTION_FILTER_SCALE
||
1437 pname
== GL_CONVOLUTION_FILTER_BIAS
) {
1443 n
[4].i
= n
[5].i
= n
[6].i
= 0;
1446 if (ctx
->ExecuteFlag
) {
1447 CALL_ConvolutionParameteriv(ctx
->Exec
, (target
, pname
, params
));
1452 static void GLAPIENTRY
1453 save_ConvolutionParameterf(GLenum target
, GLenum pname
, GLfloat param
)
1455 GET_CURRENT_CONTEXT(ctx
);
1457 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1458 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CONVOLUTION_PARAMETER_F
, 3);
1464 if (ctx
->ExecuteFlag
) {
1465 CALL_ConvolutionParameterf(ctx
->Exec
, (target
, pname
, param
));
1470 static void GLAPIENTRY
1471 save_ConvolutionParameterfv(GLenum target
, GLenum pname
,
1472 const GLfloat
*params
)
1474 GET_CURRENT_CONTEXT(ctx
);
1476 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1477 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CONVOLUTION_PARAMETER_FV
, 6);
1482 if (pname
== GL_CONVOLUTION_BORDER_COLOR
||
1483 pname
== GL_CONVOLUTION_FILTER_SCALE
||
1484 pname
== GL_CONVOLUTION_FILTER_BIAS
) {
1490 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
1493 if (ctx
->ExecuteFlag
) {
1494 CALL_ConvolutionParameterfv(ctx
->Exec
, (target
, pname
, params
));
1499 static void GLAPIENTRY
1500 save_CopyPixels(GLint x
, GLint y
, GLsizei width
, GLsizei height
, GLenum type
)
1502 GET_CURRENT_CONTEXT(ctx
);
1504 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1505 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_PIXELS
, 5);
1509 n
[3].i
= (GLint
) width
;
1510 n
[4].i
= (GLint
) height
;
1513 if (ctx
->ExecuteFlag
) {
1514 CALL_CopyPixels(ctx
->Exec
, (x
, y
, width
, height
, type
));
1520 static void GLAPIENTRY
1521 save_CopyTexImage1D(GLenum target
, GLint level
, GLenum internalformat
,
1522 GLint x
, GLint y
, GLsizei width
, GLint border
)
1524 GET_CURRENT_CONTEXT(ctx
);
1526 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1527 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_TEX_IMAGE1D
, 7);
1531 n
[3].e
= internalformat
;
1537 if (ctx
->ExecuteFlag
) {
1538 CALL_CopyTexImage1D(ctx
->Exec
, (target
, level
, internalformat
,
1539 x
, y
, width
, border
));
1544 static void GLAPIENTRY
1545 save_CopyTexImage2D(GLenum target
, GLint level
,
1546 GLenum internalformat
,
1547 GLint x
, GLint y
, GLsizei width
,
1548 GLsizei height
, GLint border
)
1550 GET_CURRENT_CONTEXT(ctx
);
1552 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1553 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_TEX_IMAGE2D
, 8);
1557 n
[3].e
= internalformat
;
1564 if (ctx
->ExecuteFlag
) {
1565 CALL_CopyTexImage2D(ctx
->Exec
, (target
, level
, internalformat
,
1566 x
, y
, width
, height
, border
));
1572 static void GLAPIENTRY
1573 save_CopyTexSubImage1D(GLenum target
, GLint level
,
1574 GLint xoffset
, GLint x
, GLint y
, GLsizei width
)
1576 GET_CURRENT_CONTEXT(ctx
);
1578 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1579 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_TEX_SUB_IMAGE1D
, 6);
1588 if (ctx
->ExecuteFlag
) {
1589 CALL_CopyTexSubImage1D(ctx
->Exec
,
1590 (target
, level
, xoffset
, x
, y
, width
));
1595 static void GLAPIENTRY
1596 save_CopyTexSubImage2D(GLenum target
, GLint level
,
1597 GLint xoffset
, GLint yoffset
,
1598 GLint x
, GLint y
, GLsizei width
, GLint height
)
1600 GET_CURRENT_CONTEXT(ctx
);
1602 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1603 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_TEX_SUB_IMAGE2D
, 8);
1614 if (ctx
->ExecuteFlag
) {
1615 CALL_CopyTexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
1616 x
, y
, width
, height
));
1621 static void GLAPIENTRY
1622 save_CopyTexSubImage3D(GLenum target
, GLint level
,
1623 GLint xoffset
, GLint yoffset
, GLint zoffset
,
1624 GLint x
, GLint y
, GLsizei width
, GLint height
)
1626 GET_CURRENT_CONTEXT(ctx
);
1628 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1629 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COPY_TEX_SUB_IMAGE3D
, 9);
1641 if (ctx
->ExecuteFlag
) {
1642 CALL_CopyTexSubImage3D(ctx
->Exec
, (target
, level
,
1643 xoffset
, yoffset
, zoffset
,
1644 x
, y
, width
, height
));
1649 static void GLAPIENTRY
1650 save_CullFace(GLenum mode
)
1652 GET_CURRENT_CONTEXT(ctx
);
1654 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1655 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_CULL_FACE
, 1);
1659 if (ctx
->ExecuteFlag
) {
1660 CALL_CullFace(ctx
->Exec
, (mode
));
1665 static void GLAPIENTRY
1666 save_DepthFunc(GLenum func
)
1668 GET_CURRENT_CONTEXT(ctx
);
1670 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1671 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DEPTH_FUNC
, 1);
1675 if (ctx
->ExecuteFlag
) {
1676 CALL_DepthFunc(ctx
->Exec
, (func
));
1681 static void GLAPIENTRY
1682 save_DepthMask(GLboolean mask
)
1684 GET_CURRENT_CONTEXT(ctx
);
1686 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1687 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DEPTH_MASK
, 1);
1691 if (ctx
->ExecuteFlag
) {
1692 CALL_DepthMask(ctx
->Exec
, (mask
));
1697 static void GLAPIENTRY
1698 save_DepthRange(GLclampd nearval
, GLclampd farval
)
1700 GET_CURRENT_CONTEXT(ctx
);
1702 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1703 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DEPTH_RANGE
, 2);
1705 n
[1].f
= (GLfloat
) nearval
;
1706 n
[2].f
= (GLfloat
) farval
;
1708 if (ctx
->ExecuteFlag
) {
1709 CALL_DepthRange(ctx
->Exec
, (nearval
, farval
));
1714 static void GLAPIENTRY
1715 save_Disable(GLenum cap
)
1717 GET_CURRENT_CONTEXT(ctx
);
1719 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1720 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DISABLE
, 1);
1724 if (ctx
->ExecuteFlag
) {
1725 CALL_Disable(ctx
->Exec
, (cap
));
1730 static void GLAPIENTRY
1731 save_DrawBuffer(GLenum mode
)
1733 GET_CURRENT_CONTEXT(ctx
);
1735 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1736 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DRAW_BUFFER
, 1);
1740 if (ctx
->ExecuteFlag
) {
1741 CALL_DrawBuffer(ctx
->Exec
, (mode
));
1746 static void GLAPIENTRY
1747 save_DrawPixels(GLsizei width
, GLsizei height
,
1748 GLenum format
, GLenum type
, const GLvoid
* pixels
)
1750 GET_CURRENT_CONTEXT(ctx
);
1751 GLvoid
*image
= unpack_image(2, width
, height
, 1, format
, type
,
1752 pixels
, &ctx
->Unpack
);
1754 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1755 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DRAW_PIXELS
, 5);
1766 if (ctx
->ExecuteFlag
) {
1767 CALL_DrawPixels(ctx
->Exec
, (width
, height
, format
, type
, pixels
));
1773 static void GLAPIENTRY
1774 save_Enable(GLenum cap
)
1776 GET_CURRENT_CONTEXT(ctx
);
1778 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1779 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ENABLE
, 1);
1783 if (ctx
->ExecuteFlag
) {
1784 CALL_Enable(ctx
->Exec
, (cap
));
1790 static void GLAPIENTRY
1791 _mesa_save_EvalMesh1(GLenum mode
, GLint i1
, GLint i2
)
1793 GET_CURRENT_CONTEXT(ctx
);
1795 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1796 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVALMESH1
, 3);
1802 if (ctx
->ExecuteFlag
) {
1803 CALL_EvalMesh1(ctx
->Exec
, (mode
, i1
, i2
));
1808 static void GLAPIENTRY
1809 _mesa_save_EvalMesh2(GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
1811 GET_CURRENT_CONTEXT(ctx
);
1813 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1814 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVALMESH2
, 5);
1822 if (ctx
->ExecuteFlag
) {
1823 CALL_EvalMesh2(ctx
->Exec
, (mode
, i1
, i2
, j1
, j2
));
1830 static void GLAPIENTRY
1831 save_Fogfv(GLenum pname
, const GLfloat
*params
)
1833 GET_CURRENT_CONTEXT(ctx
);
1835 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1836 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_FOG
, 5);
1844 if (ctx
->ExecuteFlag
) {
1845 CALL_Fogfv(ctx
->Exec
, (pname
, params
));
1850 static void GLAPIENTRY
1851 save_Fogf(GLenum pname
, GLfloat param
)
1853 save_Fogfv(pname
, ¶m
);
1857 static void GLAPIENTRY
1858 save_Fogiv(GLenum pname
, const GLint
*params
)
1863 case GL_FOG_DENSITY
:
1867 p
[0] = (GLfloat
) *params
;
1870 p
[0] = INT_TO_FLOAT(params
[0]);
1871 p
[1] = INT_TO_FLOAT(params
[1]);
1872 p
[2] = INT_TO_FLOAT(params
[2]);
1873 p
[3] = INT_TO_FLOAT(params
[3]);
1876 /* Error will be caught later in gl_Fogfv */
1879 save_Fogfv(pname
, p
);
1883 static void GLAPIENTRY
1884 save_Fogi(GLenum pname
, GLint param
)
1886 save_Fogiv(pname
, ¶m
);
1890 static void GLAPIENTRY
1891 save_FrontFace(GLenum mode
)
1893 GET_CURRENT_CONTEXT(ctx
);
1895 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1896 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_FRONT_FACE
, 1);
1900 if (ctx
->ExecuteFlag
) {
1901 CALL_FrontFace(ctx
->Exec
, (mode
));
1906 static void GLAPIENTRY
1907 save_Frustum(GLdouble left
, GLdouble right
,
1908 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
1910 GET_CURRENT_CONTEXT(ctx
);
1912 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1913 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_FRUSTUM
, 6);
1915 n
[1].f
= (GLfloat
) left
;
1916 n
[2].f
= (GLfloat
) right
;
1917 n
[3].f
= (GLfloat
) bottom
;
1918 n
[4].f
= (GLfloat
) top
;
1919 n
[5].f
= (GLfloat
) nearval
;
1920 n
[6].f
= (GLfloat
) farval
;
1922 if (ctx
->ExecuteFlag
) {
1923 CALL_Frustum(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
1928 static void GLAPIENTRY
1929 save_Hint(GLenum target
, GLenum mode
)
1931 GET_CURRENT_CONTEXT(ctx
);
1933 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1934 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_HINT
, 2);
1939 if (ctx
->ExecuteFlag
) {
1940 CALL_Hint(ctx
->Exec
, (target
, mode
));
1945 static void GLAPIENTRY
1946 save_Histogram(GLenum target
, GLsizei width
, GLenum internalFormat
,
1949 GET_CURRENT_CONTEXT(ctx
);
1952 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1953 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_HISTOGRAM
, 4);
1957 n
[3].e
= internalFormat
;
1960 if (ctx
->ExecuteFlag
) {
1961 CALL_Histogram(ctx
->Exec
, (target
, width
, internalFormat
, sink
));
1966 static void GLAPIENTRY
1967 save_IndexMask(GLuint mask
)
1969 GET_CURRENT_CONTEXT(ctx
);
1971 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1972 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_INDEX_MASK
, 1);
1976 if (ctx
->ExecuteFlag
) {
1977 CALL_IndexMask(ctx
->Exec
, (mask
));
1982 static void GLAPIENTRY
1983 save_InitNames(void)
1985 GET_CURRENT_CONTEXT(ctx
);
1986 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1987 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_INIT_NAMES
, 0);
1988 if (ctx
->ExecuteFlag
) {
1989 CALL_InitNames(ctx
->Exec
, ());
1994 static void GLAPIENTRY
1995 save_Lightfv(GLenum light
, GLenum pname
, const GLfloat
*params
)
1997 GET_CURRENT_CONTEXT(ctx
);
1999 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2000 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LIGHT
, 6);
2018 case GL_SPOT_DIRECTION
:
2021 case GL_SPOT_EXPONENT
:
2024 case GL_SPOT_CUTOFF
:
2027 case GL_CONSTANT_ATTENUATION
:
2030 case GL_LINEAR_ATTENUATION
:
2033 case GL_QUADRATIC_ATTENUATION
:
2039 for (i
= 0; i
< nParams
; i
++) {
2040 n
[3 + i
].f
= params
[i
];
2043 if (ctx
->ExecuteFlag
) {
2044 CALL_Lightfv(ctx
->Exec
, (light
, pname
, params
));
2049 static void GLAPIENTRY
2050 save_Lightf(GLenum light
, GLenum pname
, GLfloat params
)
2052 save_Lightfv(light
, pname
, ¶ms
);
2056 static void GLAPIENTRY
2057 save_Lightiv(GLenum light
, GLenum pname
, const GLint
*params
)
2064 fparam
[0] = INT_TO_FLOAT(params
[0]);
2065 fparam
[1] = INT_TO_FLOAT(params
[1]);
2066 fparam
[2] = INT_TO_FLOAT(params
[2]);
2067 fparam
[3] = INT_TO_FLOAT(params
[3]);
2070 fparam
[0] = (GLfloat
) params
[0];
2071 fparam
[1] = (GLfloat
) params
[1];
2072 fparam
[2] = (GLfloat
) params
[2];
2073 fparam
[3] = (GLfloat
) params
[3];
2075 case GL_SPOT_DIRECTION
:
2076 fparam
[0] = (GLfloat
) params
[0];
2077 fparam
[1] = (GLfloat
) params
[1];
2078 fparam
[2] = (GLfloat
) params
[2];
2080 case GL_SPOT_EXPONENT
:
2081 case GL_SPOT_CUTOFF
:
2082 case GL_CONSTANT_ATTENUATION
:
2083 case GL_LINEAR_ATTENUATION
:
2084 case GL_QUADRATIC_ATTENUATION
:
2085 fparam
[0] = (GLfloat
) params
[0];
2088 /* error will be caught later in gl_Lightfv */
2091 save_Lightfv(light
, pname
, fparam
);
2095 static void GLAPIENTRY
2096 save_Lighti(GLenum light
, GLenum pname
, GLint param
)
2098 save_Lightiv(light
, pname
, ¶m
);
2102 static void GLAPIENTRY
2103 save_LightModelfv(GLenum pname
, const GLfloat
*params
)
2105 GET_CURRENT_CONTEXT(ctx
);
2107 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2108 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LIGHT_MODEL
, 5);
2116 if (ctx
->ExecuteFlag
) {
2117 CALL_LightModelfv(ctx
->Exec
, (pname
, params
));
2122 static void GLAPIENTRY
2123 save_LightModelf(GLenum pname
, GLfloat param
)
2125 save_LightModelfv(pname
, ¶m
);
2129 static void GLAPIENTRY
2130 save_LightModeliv(GLenum pname
, const GLint
*params
)
2134 case GL_LIGHT_MODEL_AMBIENT
:
2135 fparam
[0] = INT_TO_FLOAT(params
[0]);
2136 fparam
[1] = INT_TO_FLOAT(params
[1]);
2137 fparam
[2] = INT_TO_FLOAT(params
[2]);
2138 fparam
[3] = INT_TO_FLOAT(params
[3]);
2140 case GL_LIGHT_MODEL_LOCAL_VIEWER
:
2141 case GL_LIGHT_MODEL_TWO_SIDE
:
2142 case GL_LIGHT_MODEL_COLOR_CONTROL
:
2143 fparam
[0] = (GLfloat
) params
[0];
2146 /* Error will be caught later in gl_LightModelfv */
2149 save_LightModelfv(pname
, fparam
);
2153 static void GLAPIENTRY
2154 save_LightModeli(GLenum pname
, GLint param
)
2156 save_LightModeliv(pname
, ¶m
);
2160 static void GLAPIENTRY
2161 save_LineStipple(GLint factor
, GLushort pattern
)
2163 GET_CURRENT_CONTEXT(ctx
);
2165 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2166 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LINE_STIPPLE
, 2);
2171 if (ctx
->ExecuteFlag
) {
2172 CALL_LineStipple(ctx
->Exec
, (factor
, pattern
));
2177 static void GLAPIENTRY
2178 save_LineWidth(GLfloat width
)
2180 GET_CURRENT_CONTEXT(ctx
);
2182 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2183 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LINE_WIDTH
, 1);
2187 if (ctx
->ExecuteFlag
) {
2188 CALL_LineWidth(ctx
->Exec
, (width
));
2193 static void GLAPIENTRY
2194 save_ListBase(GLuint base
)
2196 GET_CURRENT_CONTEXT(ctx
);
2198 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2199 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LIST_BASE
, 1);
2203 if (ctx
->ExecuteFlag
) {
2204 CALL_ListBase(ctx
->Exec
, (base
));
2209 static void GLAPIENTRY
2210 save_LoadIdentity(void)
2212 GET_CURRENT_CONTEXT(ctx
);
2213 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2214 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_LOAD_IDENTITY
, 0);
2215 if (ctx
->ExecuteFlag
) {
2216 CALL_LoadIdentity(ctx
->Exec
, ());
2221 static void GLAPIENTRY
2222 save_LoadMatrixf(const GLfloat
* m
)
2224 GET_CURRENT_CONTEXT(ctx
);
2226 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2227 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LOAD_MATRIX
, 16);
2230 for (i
= 0; i
< 16; i
++) {
2234 if (ctx
->ExecuteFlag
) {
2235 CALL_LoadMatrixf(ctx
->Exec
, (m
));
2240 static void GLAPIENTRY
2241 save_LoadMatrixd(const GLdouble
* m
)
2245 for (i
= 0; i
< 16; i
++) {
2246 f
[i
] = (GLfloat
) m
[i
];
2248 save_LoadMatrixf(f
);
2252 static void GLAPIENTRY
2253 save_LoadName(GLuint name
)
2255 GET_CURRENT_CONTEXT(ctx
);
2257 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2258 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LOAD_NAME
, 1);
2262 if (ctx
->ExecuteFlag
) {
2263 CALL_LoadName(ctx
->Exec
, (name
));
2268 static void GLAPIENTRY
2269 save_LogicOp(GLenum opcode
)
2271 GET_CURRENT_CONTEXT(ctx
);
2273 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2274 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LOGIC_OP
, 1);
2278 if (ctx
->ExecuteFlag
) {
2279 CALL_LogicOp(ctx
->Exec
, (opcode
));
2284 static void GLAPIENTRY
2285 save_Map1d(GLenum target
, GLdouble u1
, GLdouble u2
, GLint stride
,
2286 GLint order
, const GLdouble
* points
)
2288 GET_CURRENT_CONTEXT(ctx
);
2290 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2291 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MAP1
, 6);
2293 GLfloat
*pnts
= _mesa_copy_map_points1d(target
, stride
, order
, points
);
2295 n
[2].f
= (GLfloat
) u1
;
2296 n
[3].f
= (GLfloat
) u2
;
2297 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2299 n
[6].data
= (void *) pnts
;
2301 if (ctx
->ExecuteFlag
) {
2302 CALL_Map1d(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2306 static void GLAPIENTRY
2307 save_Map1f(GLenum target
, GLfloat u1
, GLfloat u2
, GLint stride
,
2308 GLint order
, const GLfloat
* points
)
2310 GET_CURRENT_CONTEXT(ctx
);
2312 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2313 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MAP1
, 6);
2315 GLfloat
*pnts
= _mesa_copy_map_points1f(target
, stride
, order
, points
);
2319 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2321 n
[6].data
= (void *) pnts
;
2323 if (ctx
->ExecuteFlag
) {
2324 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2329 static void GLAPIENTRY
2330 save_Map2d(GLenum target
,
2331 GLdouble u1
, GLdouble u2
, GLint ustride
, GLint uorder
,
2332 GLdouble v1
, GLdouble v2
, GLint vstride
, GLint vorder
,
2333 const GLdouble
* points
)
2335 GET_CURRENT_CONTEXT(ctx
);
2337 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2338 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MAP2
, 10);
2340 GLfloat
*pnts
= _mesa_copy_map_points2d(target
, ustride
, uorder
,
2341 vstride
, vorder
, points
);
2343 n
[2].f
= (GLfloat
) u1
;
2344 n
[3].f
= (GLfloat
) u2
;
2345 n
[4].f
= (GLfloat
) v1
;
2346 n
[5].f
= (GLfloat
) v2
;
2347 /* XXX verify these strides are correct */
2348 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2349 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2352 n
[10].data
= (void *) pnts
;
2354 if (ctx
->ExecuteFlag
) {
2355 CALL_Map2d(ctx
->Exec
, (target
,
2356 u1
, u2
, ustride
, uorder
,
2357 v1
, v2
, vstride
, vorder
, points
));
2362 static void GLAPIENTRY
2363 save_Map2f(GLenum target
,
2364 GLfloat u1
, GLfloat u2
, GLint ustride
, GLint uorder
,
2365 GLfloat v1
, GLfloat v2
, GLint vstride
, GLint vorder
,
2366 const GLfloat
* points
)
2368 GET_CURRENT_CONTEXT(ctx
);
2370 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2371 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MAP2
, 10);
2373 GLfloat
*pnts
= _mesa_copy_map_points2f(target
, ustride
, uorder
,
2374 vstride
, vorder
, points
);
2380 /* XXX verify these strides are correct */
2381 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2382 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2385 n
[10].data
= (void *) pnts
;
2387 if (ctx
->ExecuteFlag
) {
2388 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
2389 v1
, v2
, vstride
, vorder
, points
));
2394 static void GLAPIENTRY
2395 save_MapGrid1f(GLint un
, GLfloat u1
, GLfloat u2
)
2397 GET_CURRENT_CONTEXT(ctx
);
2399 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2400 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MAPGRID1
, 3);
2406 if (ctx
->ExecuteFlag
) {
2407 CALL_MapGrid1f(ctx
->Exec
, (un
, u1
, u2
));
2412 static void GLAPIENTRY
2413 save_MapGrid1d(GLint un
, GLdouble u1
, GLdouble u2
)
2415 save_MapGrid1f(un
, (GLfloat
) u1
, (GLfloat
) u2
);
2419 static void GLAPIENTRY
2420 save_MapGrid2f(GLint un
, GLfloat u1
, GLfloat u2
,
2421 GLint vn
, GLfloat v1
, GLfloat v2
)
2423 GET_CURRENT_CONTEXT(ctx
);
2425 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2426 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MAPGRID2
, 6);
2435 if (ctx
->ExecuteFlag
) {
2436 CALL_MapGrid2f(ctx
->Exec
, (un
, u1
, u2
, vn
, v1
, v2
));
2442 static void GLAPIENTRY
2443 save_MapGrid2d(GLint un
, GLdouble u1
, GLdouble u2
,
2444 GLint vn
, GLdouble v1
, GLdouble v2
)
2446 save_MapGrid2f(un
, (GLfloat
) u1
, (GLfloat
) u2
,
2447 vn
, (GLfloat
) v1
, (GLfloat
) v2
);
2451 static void GLAPIENTRY
2452 save_MatrixMode(GLenum mode
)
2454 GET_CURRENT_CONTEXT(ctx
);
2456 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2457 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MATRIX_MODE
, 1);
2461 if (ctx
->ExecuteFlag
) {
2462 CALL_MatrixMode(ctx
->Exec
, (mode
));
2467 static void GLAPIENTRY
2468 save_Minmax(GLenum target
, GLenum internalFormat
, GLboolean sink
)
2470 GET_CURRENT_CONTEXT(ctx
);
2473 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2474 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MIN_MAX
, 3);
2477 n
[2].e
= internalFormat
;
2480 if (ctx
->ExecuteFlag
) {
2481 CALL_Minmax(ctx
->Exec
, (target
, internalFormat
, sink
));
2486 static void GLAPIENTRY
2487 save_MultMatrixf(const GLfloat
* m
)
2489 GET_CURRENT_CONTEXT(ctx
);
2491 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2492 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MULT_MATRIX
, 16);
2495 for (i
= 0; i
< 16; i
++) {
2499 if (ctx
->ExecuteFlag
) {
2500 CALL_MultMatrixf(ctx
->Exec
, (m
));
2505 static void GLAPIENTRY
2506 save_MultMatrixd(const GLdouble
* m
)
2510 for (i
= 0; i
< 16; i
++) {
2511 f
[i
] = (GLfloat
) m
[i
];
2513 save_MultMatrixf(f
);
2517 static void GLAPIENTRY
2518 save_NewList(GLuint list
, GLenum mode
)
2520 GET_CURRENT_CONTEXT(ctx
);
2521 /* It's an error to call this function while building a display list */
2522 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
2529 static void GLAPIENTRY
2530 save_Ortho(GLdouble left
, GLdouble right
,
2531 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
2533 GET_CURRENT_CONTEXT(ctx
);
2535 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2536 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ORTHO
, 6);
2538 n
[1].f
= (GLfloat
) left
;
2539 n
[2].f
= (GLfloat
) right
;
2540 n
[3].f
= (GLfloat
) bottom
;
2541 n
[4].f
= (GLfloat
) top
;
2542 n
[5].f
= (GLfloat
) nearval
;
2543 n
[6].f
= (GLfloat
) farval
;
2545 if (ctx
->ExecuteFlag
) {
2546 CALL_Ortho(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
2551 static void GLAPIENTRY
2552 save_PixelMapfv(GLenum map
, GLint mapsize
, const GLfloat
*values
)
2554 GET_CURRENT_CONTEXT(ctx
);
2556 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2557 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PIXEL_MAP
, 3);
2561 n
[3].data
= (void *) _mesa_malloc(mapsize
* sizeof(GLfloat
));
2562 MEMCPY(n
[3].data
, (void *) values
, mapsize
* sizeof(GLfloat
));
2564 if (ctx
->ExecuteFlag
) {
2565 CALL_PixelMapfv(ctx
->Exec
, (map
, mapsize
, values
));
2570 static void GLAPIENTRY
2571 save_PixelMapuiv(GLenum map
, GLint mapsize
, const GLuint
*values
)
2573 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2575 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
2576 for (i
= 0; i
< mapsize
; i
++) {
2577 fvalues
[i
] = (GLfloat
) values
[i
];
2581 for (i
= 0; i
< mapsize
; i
++) {
2582 fvalues
[i
] = UINT_TO_FLOAT(values
[i
]);
2585 save_PixelMapfv(map
, mapsize
, fvalues
);
2589 static void GLAPIENTRY
2590 save_PixelMapusv(GLenum map
, GLint mapsize
, const GLushort
*values
)
2592 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2594 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
2595 for (i
= 0; i
< mapsize
; i
++) {
2596 fvalues
[i
] = (GLfloat
) values
[i
];
2600 for (i
= 0; i
< mapsize
; i
++) {
2601 fvalues
[i
] = USHORT_TO_FLOAT(values
[i
]);
2604 save_PixelMapfv(map
, mapsize
, fvalues
);
2608 static void GLAPIENTRY
2609 save_PixelTransferf(GLenum pname
, GLfloat param
)
2611 GET_CURRENT_CONTEXT(ctx
);
2613 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2614 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PIXEL_TRANSFER
, 2);
2619 if (ctx
->ExecuteFlag
) {
2620 CALL_PixelTransferf(ctx
->Exec
, (pname
, param
));
2625 static void GLAPIENTRY
2626 save_PixelTransferi(GLenum pname
, GLint param
)
2628 save_PixelTransferf(pname
, (GLfloat
) param
);
2632 static void GLAPIENTRY
2633 save_PixelZoom(GLfloat xfactor
, GLfloat yfactor
)
2635 GET_CURRENT_CONTEXT(ctx
);
2637 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2638 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PIXEL_ZOOM
, 2);
2643 if (ctx
->ExecuteFlag
) {
2644 CALL_PixelZoom(ctx
->Exec
, (xfactor
, yfactor
));
2649 static void GLAPIENTRY
2650 save_PointParameterfvEXT(GLenum pname
, const GLfloat
*params
)
2652 GET_CURRENT_CONTEXT(ctx
);
2654 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2655 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_POINT_PARAMETERS
, 4);
2662 if (ctx
->ExecuteFlag
) {
2663 CALL_PointParameterfvEXT(ctx
->Exec
, (pname
, params
));
2668 static void GLAPIENTRY
2669 save_PointParameterfEXT(GLenum pname
, GLfloat param
)
2671 save_PointParameterfvEXT(pname
, ¶m
);
2674 static void GLAPIENTRY
2675 save_PointParameteriNV(GLenum pname
, GLint param
)
2677 GLfloat p
= (GLfloat
) param
;
2678 save_PointParameterfvEXT(pname
, &p
);
2681 static void GLAPIENTRY
2682 save_PointParameterivNV(GLenum pname
, const GLint
* param
)
2684 GLfloat p
= (GLfloat
) param
[0];
2685 save_PointParameterfvEXT(pname
, &p
);
2689 static void GLAPIENTRY
2690 save_PointSize(GLfloat size
)
2692 GET_CURRENT_CONTEXT(ctx
);
2694 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2695 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_POINT_SIZE
, 1);
2699 if (ctx
->ExecuteFlag
) {
2700 CALL_PointSize(ctx
->Exec
, (size
));
2705 static void GLAPIENTRY
2706 save_PolygonMode(GLenum face
, GLenum mode
)
2708 GET_CURRENT_CONTEXT(ctx
);
2710 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2711 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_POLYGON_MODE
, 2);
2716 if (ctx
->ExecuteFlag
) {
2717 CALL_PolygonMode(ctx
->Exec
, (face
, mode
));
2722 static void GLAPIENTRY
2723 save_PolygonStipple(const GLubyte
* pattern
)
2725 GET_CURRENT_CONTEXT(ctx
);
2726 GLvoid
*image
= unpack_image(2, 32, 32, 1, GL_COLOR_INDEX
, GL_BITMAP
,
2727 pattern
, &ctx
->Unpack
);
2729 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2730 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_POLYGON_STIPPLE
, 1);
2737 if (ctx
->ExecuteFlag
) {
2738 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) pattern
));
2743 static void GLAPIENTRY
2744 save_PolygonOffset(GLfloat factor
, GLfloat units
)
2746 GET_CURRENT_CONTEXT(ctx
);
2748 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2749 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_POLYGON_OFFSET
, 2);
2754 if (ctx
->ExecuteFlag
) {
2755 CALL_PolygonOffset(ctx
->Exec
, (factor
, units
));
2760 static void GLAPIENTRY
2761 save_PolygonOffsetEXT(GLfloat factor
, GLfloat bias
)
2763 GET_CURRENT_CONTEXT(ctx
);
2764 /* XXX mult by DepthMaxF here??? */
2765 save_PolygonOffset(factor
, ctx
->DrawBuffer
->_DepthMaxF
* bias
);
2769 static void GLAPIENTRY
2770 save_PopAttrib(void)
2772 GET_CURRENT_CONTEXT(ctx
);
2773 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2774 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_POP_ATTRIB
, 0);
2775 if (ctx
->ExecuteFlag
) {
2776 CALL_PopAttrib(ctx
->Exec
, ());
2781 static void GLAPIENTRY
2782 save_PopMatrix(void)
2784 GET_CURRENT_CONTEXT(ctx
);
2785 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2786 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_POP_MATRIX
, 0);
2787 if (ctx
->ExecuteFlag
) {
2788 CALL_PopMatrix(ctx
->Exec
, ());
2793 static void GLAPIENTRY
2796 GET_CURRENT_CONTEXT(ctx
);
2797 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2798 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_POP_NAME
, 0);
2799 if (ctx
->ExecuteFlag
) {
2800 CALL_PopName(ctx
->Exec
, ());
2805 static void GLAPIENTRY
2806 save_PrioritizeTextures(GLsizei num
, const GLuint
* textures
,
2807 const GLclampf
* priorities
)
2809 GET_CURRENT_CONTEXT(ctx
);
2811 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2813 for (i
= 0; i
< num
; i
++) {
2815 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PRIORITIZE_TEXTURE
, 2);
2817 n
[1].ui
= textures
[i
];
2818 n
[2].f
= priorities
[i
];
2821 if (ctx
->ExecuteFlag
) {
2822 CALL_PrioritizeTextures(ctx
->Exec
, (num
, textures
, priorities
));
2827 static void GLAPIENTRY
2828 save_PushAttrib(GLbitfield mask
)
2830 GET_CURRENT_CONTEXT(ctx
);
2832 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2833 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PUSH_ATTRIB
, 1);
2837 if (ctx
->ExecuteFlag
) {
2838 CALL_PushAttrib(ctx
->Exec
, (mask
));
2843 static void GLAPIENTRY
2844 save_PushMatrix(void)
2846 GET_CURRENT_CONTEXT(ctx
);
2847 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2848 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_PUSH_MATRIX
, 0);
2849 if (ctx
->ExecuteFlag
) {
2850 CALL_PushMatrix(ctx
->Exec
, ());
2855 static void GLAPIENTRY
2856 save_PushName(GLuint name
)
2858 GET_CURRENT_CONTEXT(ctx
);
2860 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2861 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PUSH_NAME
, 1);
2865 if (ctx
->ExecuteFlag
) {
2866 CALL_PushName(ctx
->Exec
, (name
));
2871 static void GLAPIENTRY
2872 save_RasterPos4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
2874 GET_CURRENT_CONTEXT(ctx
);
2876 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2877 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_RASTER_POS
, 4);
2884 if (ctx
->ExecuteFlag
) {
2885 CALL_RasterPos4f(ctx
->Exec
, (x
, y
, z
, w
));
2889 static void GLAPIENTRY
2890 save_RasterPos2d(GLdouble x
, GLdouble y
)
2892 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
2895 static void GLAPIENTRY
2896 save_RasterPos2f(GLfloat x
, GLfloat y
)
2898 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2901 static void GLAPIENTRY
2902 save_RasterPos2i(GLint x
, GLint y
)
2904 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
2907 static void GLAPIENTRY
2908 save_RasterPos2s(GLshort x
, GLshort y
)
2910 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2913 static void GLAPIENTRY
2914 save_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
2916 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
2919 static void GLAPIENTRY
2920 save_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
2922 save_RasterPos4f(x
, y
, z
, 1.0F
);
2925 static void GLAPIENTRY
2926 save_RasterPos3i(GLint x
, GLint y
, GLint z
)
2928 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
2931 static void GLAPIENTRY
2932 save_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
2934 save_RasterPos4f(x
, y
, z
, 1.0F
);
2937 static void GLAPIENTRY
2938 save_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
2940 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
2943 static void GLAPIENTRY
2944 save_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
2946 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
2949 static void GLAPIENTRY
2950 save_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
2952 save_RasterPos4f(x
, y
, z
, w
);
2955 static void GLAPIENTRY
2956 save_RasterPos2dv(const GLdouble
* v
)
2958 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
2961 static void GLAPIENTRY
2962 save_RasterPos2fv(const GLfloat
* v
)
2964 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2967 static void GLAPIENTRY
2968 save_RasterPos2iv(const GLint
* v
)
2970 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
2973 static void GLAPIENTRY
2974 save_RasterPos2sv(const GLshort
* v
)
2976 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2979 static void GLAPIENTRY
2980 save_RasterPos3dv(const GLdouble
* v
)
2982 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
2985 static void GLAPIENTRY
2986 save_RasterPos3fv(const GLfloat
* v
)
2988 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2991 static void GLAPIENTRY
2992 save_RasterPos3iv(const GLint
* v
)
2994 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
2997 static void GLAPIENTRY
2998 save_RasterPos3sv(const GLshort
* v
)
3000 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3003 static void GLAPIENTRY
3004 save_RasterPos4dv(const GLdouble
* v
)
3006 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3007 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3010 static void GLAPIENTRY
3011 save_RasterPos4fv(const GLfloat
* v
)
3013 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3016 static void GLAPIENTRY
3017 save_RasterPos4iv(const GLint
* v
)
3019 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3020 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3023 static void GLAPIENTRY
3024 save_RasterPos4sv(const GLshort
* v
)
3026 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3030 static void GLAPIENTRY
3031 save_PassThrough(GLfloat token
)
3033 GET_CURRENT_CONTEXT(ctx
);
3035 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3036 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PASSTHROUGH
, 1);
3040 if (ctx
->ExecuteFlag
) {
3041 CALL_PassThrough(ctx
->Exec
, (token
));
3046 static void GLAPIENTRY
3047 save_ReadBuffer(GLenum mode
)
3049 GET_CURRENT_CONTEXT(ctx
);
3051 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3052 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_READ_BUFFER
, 1);
3056 if (ctx
->ExecuteFlag
) {
3057 CALL_ReadBuffer(ctx
->Exec
, (mode
));
3062 static void GLAPIENTRY
3063 save_ResetHistogram(GLenum target
)
3065 GET_CURRENT_CONTEXT(ctx
);
3067 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3068 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_RESET_HISTOGRAM
, 1);
3072 if (ctx
->ExecuteFlag
) {
3073 CALL_ResetHistogram(ctx
->Exec
, (target
));
3078 static void GLAPIENTRY
3079 save_ResetMinmax(GLenum target
)
3081 GET_CURRENT_CONTEXT(ctx
);
3083 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3084 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_RESET_MIN_MAX
, 1);
3088 if (ctx
->ExecuteFlag
) {
3089 CALL_ResetMinmax(ctx
->Exec
, (target
));
3094 static void GLAPIENTRY
3095 save_Rotatef(GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
3097 GET_CURRENT_CONTEXT(ctx
);
3099 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3100 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ROTATE
, 4);
3107 if (ctx
->ExecuteFlag
) {
3108 CALL_Rotatef(ctx
->Exec
, (angle
, x
, y
, z
));
3113 static void GLAPIENTRY
3114 save_Rotated(GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
3116 save_Rotatef((GLfloat
) angle
, (GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3120 static void GLAPIENTRY
3121 save_Scalef(GLfloat x
, GLfloat y
, GLfloat z
)
3123 GET_CURRENT_CONTEXT(ctx
);
3125 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3126 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SCALE
, 3);
3132 if (ctx
->ExecuteFlag
) {
3133 CALL_Scalef(ctx
->Exec
, (x
, y
, z
));
3138 static void GLAPIENTRY
3139 save_Scaled(GLdouble x
, GLdouble y
, GLdouble z
)
3141 save_Scalef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3145 static void GLAPIENTRY
3146 save_Scissor(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3148 GET_CURRENT_CONTEXT(ctx
);
3150 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3151 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SCISSOR
, 4);
3158 if (ctx
->ExecuteFlag
) {
3159 CALL_Scissor(ctx
->Exec
, (x
, y
, width
, height
));
3164 static void GLAPIENTRY
3165 save_ShadeModel(GLenum mode
)
3167 GET_CURRENT_CONTEXT(ctx
);
3169 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3170 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SHADE_MODEL
, 1);
3174 if (ctx
->ExecuteFlag
) {
3175 CALL_ShadeModel(ctx
->Exec
, (mode
));
3180 static void GLAPIENTRY
3181 save_StencilFunc(GLenum func
, GLint ref
, GLuint mask
)
3183 GET_CURRENT_CONTEXT(ctx
);
3185 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3186 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_FUNC
, 3);
3192 if (ctx
->ExecuteFlag
) {
3193 CALL_StencilFunc(ctx
->Exec
, (func
, ref
, mask
));
3198 static void GLAPIENTRY
3199 save_StencilMask(GLuint mask
)
3201 GET_CURRENT_CONTEXT(ctx
);
3203 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3204 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_MASK
, 1);
3208 if (ctx
->ExecuteFlag
) {
3209 CALL_StencilMask(ctx
->Exec
, (mask
));
3214 static void GLAPIENTRY
3215 save_StencilOp(GLenum fail
, GLenum zfail
, GLenum zpass
)
3217 GET_CURRENT_CONTEXT(ctx
);
3219 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3220 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_OP
, 3);
3226 if (ctx
->ExecuteFlag
) {
3227 CALL_StencilOp(ctx
->Exec
, (fail
, zfail
, zpass
));
3232 static void GLAPIENTRY
3233 save_StencilFuncSeparate(GLenum face
, GLenum func
, GLint ref
, GLuint mask
)
3235 GET_CURRENT_CONTEXT(ctx
);
3237 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3238 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3245 if (ctx
->ExecuteFlag
) {
3246 CALL_StencilFuncSeparate(ctx
->Exec
, (face
, func
, ref
, mask
));
3251 static void GLAPIENTRY
3252 save_StencilFuncSeparateATI(GLenum frontfunc
, GLenum backfunc
, GLint ref
,
3255 GET_CURRENT_CONTEXT(ctx
);
3257 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3259 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3267 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3274 if (ctx
->ExecuteFlag
) {
3275 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_FRONT
, frontfunc
, ref
, mask
));
3276 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_BACK
, backfunc
, ref
, mask
));
3281 static void GLAPIENTRY
3282 save_StencilMaskSeparate(GLenum face
, GLuint mask
)
3284 GET_CURRENT_CONTEXT(ctx
);
3286 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3287 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_MASK_SEPARATE
, 2);
3292 if (ctx
->ExecuteFlag
) {
3293 CALL_StencilMaskSeparate(ctx
->Exec
, (face
, mask
));
3298 static void GLAPIENTRY
3299 save_StencilOpSeparate(GLenum face
, GLenum fail
, GLenum zfail
, GLenum zpass
)
3301 GET_CURRENT_CONTEXT(ctx
);
3303 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3304 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_OP_SEPARATE
, 4);
3311 if (ctx
->ExecuteFlag
) {
3312 CALL_StencilOpSeparate(ctx
->Exec
, (face
, fail
, zfail
, zpass
));
3317 static void GLAPIENTRY
3318 save_TexEnvfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3320 GET_CURRENT_CONTEXT(ctx
);
3322 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3323 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEXENV
, 6);
3327 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3335 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
3338 if (ctx
->ExecuteFlag
) {
3339 CALL_TexEnvfv(ctx
->Exec
, (target
, pname
, params
));
3344 static void GLAPIENTRY
3345 save_TexEnvf(GLenum target
, GLenum pname
, GLfloat param
)
3347 save_TexEnvfv(target
, pname
, ¶m
);
3351 static void GLAPIENTRY
3352 save_TexEnvi(GLenum target
, GLenum pname
, GLint param
)
3355 p
[0] = (GLfloat
) param
;
3356 p
[1] = p
[2] = p
[3] = 0.0;
3357 save_TexEnvfv(target
, pname
, p
);
3361 static void GLAPIENTRY
3362 save_TexEnviv(GLenum target
, GLenum pname
, const GLint
* param
)
3365 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3366 p
[0] = INT_TO_FLOAT(param
[0]);
3367 p
[1] = INT_TO_FLOAT(param
[1]);
3368 p
[2] = INT_TO_FLOAT(param
[2]);
3369 p
[3] = INT_TO_FLOAT(param
[3]);
3372 p
[0] = (GLfloat
) param
[0];
3373 p
[1] = p
[2] = p
[3] = 0.0F
;
3375 save_TexEnvfv(target
, pname
, p
);
3379 static void GLAPIENTRY
3380 save_TexGenfv(GLenum coord
, GLenum pname
, const GLfloat
*params
)
3382 GET_CURRENT_CONTEXT(ctx
);
3384 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3385 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEXGEN
, 6);
3394 if (ctx
->ExecuteFlag
) {
3395 CALL_TexGenfv(ctx
->Exec
, (coord
, pname
, params
));
3400 static void GLAPIENTRY
3401 save_TexGeniv(GLenum coord
, GLenum pname
, const GLint
*params
)
3404 p
[0] = (GLfloat
) params
[0];
3405 p
[1] = (GLfloat
) params
[1];
3406 p
[2] = (GLfloat
) params
[2];
3407 p
[3] = (GLfloat
) params
[3];
3408 save_TexGenfv(coord
, pname
, p
);
3412 static void GLAPIENTRY
3413 save_TexGend(GLenum coord
, GLenum pname
, GLdouble param
)
3415 GLfloat p
= (GLfloat
) param
;
3416 save_TexGenfv(coord
, pname
, &p
);
3420 static void GLAPIENTRY
3421 save_TexGendv(GLenum coord
, GLenum pname
, const GLdouble
*params
)
3424 p
[0] = (GLfloat
) params
[0];
3425 p
[1] = (GLfloat
) params
[1];
3426 p
[2] = (GLfloat
) params
[2];
3427 p
[3] = (GLfloat
) params
[3];
3428 save_TexGenfv(coord
, pname
, p
);
3432 static void GLAPIENTRY
3433 save_TexGenf(GLenum coord
, GLenum pname
, GLfloat param
)
3435 save_TexGenfv(coord
, pname
, ¶m
);
3439 static void GLAPIENTRY
3440 save_TexGeni(GLenum coord
, GLenum pname
, GLint param
)
3442 save_TexGeniv(coord
, pname
, ¶m
);
3446 static void GLAPIENTRY
3447 save_TexParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3449 GET_CURRENT_CONTEXT(ctx
);
3451 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3452 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEXPARAMETER
, 6);
3461 if (ctx
->ExecuteFlag
) {
3462 CALL_TexParameterfv(ctx
->Exec
, (target
, pname
, params
));
3467 static void GLAPIENTRY
3468 save_TexParameterf(GLenum target
, GLenum pname
, GLfloat param
)
3470 save_TexParameterfv(target
, pname
, ¶m
);
3474 static void GLAPIENTRY
3475 save_TexParameteri(GLenum target
, GLenum pname
, GLint param
)
3478 fparam
[0] = (GLfloat
) param
;
3479 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
3480 save_TexParameterfv(target
, pname
, fparam
);
3484 static void GLAPIENTRY
3485 save_TexParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
3488 fparam
[0] = (GLfloat
) params
[0];
3489 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
3490 save_TexParameterfv(target
, pname
, fparam
);
3494 static void GLAPIENTRY
3495 save_TexImage1D(GLenum target
,
3496 GLint level
, GLint components
,
3497 GLsizei width
, GLint border
,
3498 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3500 GET_CURRENT_CONTEXT(ctx
);
3501 if (target
== GL_PROXY_TEXTURE_1D
) {
3502 /* don't compile, execute immediately */
3503 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
3504 border
, format
, type
, pixels
));
3507 GLvoid
*image
= unpack_image(1, width
, 1, 1, format
, type
,
3508 pixels
, &ctx
->Unpack
);
3510 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3511 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_IMAGE1D
, 8);
3515 n
[3].i
= components
;
3516 n
[4].i
= (GLint
) width
;
3525 if (ctx
->ExecuteFlag
) {
3526 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
3527 border
, format
, type
, pixels
));
3533 static void GLAPIENTRY
3534 save_TexImage2D(GLenum target
,
3535 GLint level
, GLint components
,
3536 GLsizei width
, GLsizei height
, GLint border
,
3537 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3539 GET_CURRENT_CONTEXT(ctx
);
3540 if (target
== GL_PROXY_TEXTURE_2D
) {
3541 /* don't compile, execute immediately */
3542 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
3543 height
, border
, format
, type
, pixels
));
3546 GLvoid
*image
= unpack_image(2, width
, height
, 1, format
, type
,
3547 pixels
, &ctx
->Unpack
);
3549 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3550 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_IMAGE2D
, 9);
3554 n
[3].i
= components
;
3555 n
[4].i
= (GLint
) width
;
3556 n
[5].i
= (GLint
) height
;
3565 if (ctx
->ExecuteFlag
) {
3566 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
3567 height
, border
, format
, type
, pixels
));
3573 static void GLAPIENTRY
3574 save_TexImage3D(GLenum target
,
3575 GLint level
, GLint internalFormat
,
3576 GLsizei width
, GLsizei height
, GLsizei depth
,
3578 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3580 GET_CURRENT_CONTEXT(ctx
);
3581 if (target
== GL_PROXY_TEXTURE_3D
) {
3582 /* don't compile, execute immediately */
3583 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
3584 height
, depth
, border
, format
, type
,
3589 GLvoid
*image
= unpack_image(3, width
, height
, depth
, format
, type
,
3590 pixels
, &ctx
->Unpack
);
3591 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3592 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_IMAGE3D
, 10);
3596 n
[3].i
= (GLint
) internalFormat
;
3597 n
[4].i
= (GLint
) width
;
3598 n
[5].i
= (GLint
) height
;
3599 n
[6].i
= (GLint
) depth
;
3608 if (ctx
->ExecuteFlag
) {
3609 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
3610 height
, depth
, border
, format
, type
,
3617 static void GLAPIENTRY
3618 save_TexSubImage1D(GLenum target
, GLint level
, GLint xoffset
,
3619 GLsizei width
, GLenum format
, GLenum type
,
3620 const GLvoid
* pixels
)
3622 GET_CURRENT_CONTEXT(ctx
);
3624 GLvoid
*image
= unpack_image(1, width
, 1, 1, format
, type
,
3625 pixels
, &ctx
->Unpack
);
3626 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3627 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_SUB_IMAGE1D
, 7);
3632 n
[4].i
= (GLint
) width
;
3640 if (ctx
->ExecuteFlag
) {
3641 CALL_TexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
, width
,
3642 format
, type
, pixels
));
3647 static void GLAPIENTRY
3648 save_TexSubImage2D(GLenum target
, GLint level
,
3649 GLint xoffset
, GLint yoffset
,
3650 GLsizei width
, GLsizei height
,
3651 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3653 GET_CURRENT_CONTEXT(ctx
);
3655 GLvoid
*image
= unpack_image(2, width
, height
, 1, format
, type
,
3656 pixels
, &ctx
->Unpack
);
3657 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3658 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_SUB_IMAGE2D
, 9);
3664 n
[5].i
= (GLint
) width
;
3665 n
[6].i
= (GLint
) height
;
3673 if (ctx
->ExecuteFlag
) {
3674 CALL_TexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
3675 width
, height
, format
, type
, pixels
));
3680 static void GLAPIENTRY
3681 save_TexSubImage3D(GLenum target
, GLint level
,
3682 GLint xoffset
, GLint yoffset
, GLint zoffset
,
3683 GLsizei width
, GLsizei height
, GLsizei depth
,
3684 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3686 GET_CURRENT_CONTEXT(ctx
);
3688 GLvoid
*image
= unpack_image(3, width
, height
, depth
, format
, type
,
3689 pixels
, &ctx
->Unpack
);
3690 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3691 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TEX_SUB_IMAGE3D
, 11);
3698 n
[6].i
= (GLint
) width
;
3699 n
[7].i
= (GLint
) height
;
3700 n
[8].i
= (GLint
) depth
;
3708 if (ctx
->ExecuteFlag
) {
3709 CALL_TexSubImage3D(ctx
->Exec
, (target
, level
,
3710 xoffset
, yoffset
, zoffset
,
3711 width
, height
, depth
, format
, type
,
3717 static void GLAPIENTRY
3718 save_Translatef(GLfloat x
, GLfloat y
, GLfloat z
)
3720 GET_CURRENT_CONTEXT(ctx
);
3722 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3723 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TRANSLATE
, 3);
3729 if (ctx
->ExecuteFlag
) {
3730 CALL_Translatef(ctx
->Exec
, (x
, y
, z
));
3735 static void GLAPIENTRY
3736 save_Translated(GLdouble x
, GLdouble y
, GLdouble z
)
3738 save_Translatef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3743 static void GLAPIENTRY
3744 save_Viewport(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3746 GET_CURRENT_CONTEXT(ctx
);
3748 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3749 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_VIEWPORT
, 4);
3753 n
[3].i
= (GLint
) width
;
3754 n
[4].i
= (GLint
) height
;
3756 if (ctx
->ExecuteFlag
) {
3757 CALL_Viewport(ctx
->Exec
, (x
, y
, width
, height
));
3762 static void GLAPIENTRY
3763 save_WindowPos4fMESA(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3765 GET_CURRENT_CONTEXT(ctx
);
3767 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3768 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_WINDOW_POS
, 4);
3775 if (ctx
->ExecuteFlag
) {
3776 CALL_WindowPos4fMESA(ctx
->Exec
, (x
, y
, z
, w
));
3780 static void GLAPIENTRY
3781 save_WindowPos2dMESA(GLdouble x
, GLdouble y
)
3783 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3786 static void GLAPIENTRY
3787 save_WindowPos2fMESA(GLfloat x
, GLfloat y
)
3789 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3792 static void GLAPIENTRY
3793 save_WindowPos2iMESA(GLint x
, GLint y
)
3795 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3798 static void GLAPIENTRY
3799 save_WindowPos2sMESA(GLshort x
, GLshort y
)
3801 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3804 static void GLAPIENTRY
3805 save_WindowPos3dMESA(GLdouble x
, GLdouble y
, GLdouble z
)
3807 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3810 static void GLAPIENTRY
3811 save_WindowPos3fMESA(GLfloat x
, GLfloat y
, GLfloat z
)
3813 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3816 static void GLAPIENTRY
3817 save_WindowPos3iMESA(GLint x
, GLint y
, GLint z
)
3819 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3822 static void GLAPIENTRY
3823 save_WindowPos3sMESA(GLshort x
, GLshort y
, GLshort z
)
3825 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3828 static void GLAPIENTRY
3829 save_WindowPos4dMESA(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3831 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3834 static void GLAPIENTRY
3835 save_WindowPos4iMESA(GLint x
, GLint y
, GLint z
, GLint w
)
3837 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3840 static void GLAPIENTRY
3841 save_WindowPos4sMESA(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
3843 save_WindowPos4fMESA(x
, y
, z
, w
);
3846 static void GLAPIENTRY
3847 save_WindowPos2dvMESA(const GLdouble
* v
)
3849 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3852 static void GLAPIENTRY
3853 save_WindowPos2fvMESA(const GLfloat
* v
)
3855 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3858 static void GLAPIENTRY
3859 save_WindowPos2ivMESA(const GLint
* v
)
3861 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3864 static void GLAPIENTRY
3865 save_WindowPos2svMESA(const GLshort
* v
)
3867 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3870 static void GLAPIENTRY
3871 save_WindowPos3dvMESA(const GLdouble
* v
)
3873 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3876 static void GLAPIENTRY
3877 save_WindowPos3fvMESA(const GLfloat
* v
)
3879 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3882 static void GLAPIENTRY
3883 save_WindowPos3ivMESA(const GLint
* v
)
3885 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3888 static void GLAPIENTRY
3889 save_WindowPos3svMESA(const GLshort
* v
)
3891 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3894 static void GLAPIENTRY
3895 save_WindowPos4dvMESA(const GLdouble
* v
)
3897 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
3898 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3901 static void GLAPIENTRY
3902 save_WindowPos4fvMESA(const GLfloat
* v
)
3904 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3907 static void GLAPIENTRY
3908 save_WindowPos4ivMESA(const GLint
* v
)
3910 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
3911 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3914 static void GLAPIENTRY
3915 save_WindowPos4svMESA(const GLshort
* v
)
3917 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3922 /* GL_ARB_multitexture */
3923 static void GLAPIENTRY
3924 save_ActiveTextureARB(GLenum target
)
3926 GET_CURRENT_CONTEXT(ctx
);
3928 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3929 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ACTIVE_TEXTURE
, 1);
3933 if (ctx
->ExecuteFlag
) {
3934 CALL_ActiveTextureARB(ctx
->Exec
, (target
));
3939 /* GL_ARB_transpose_matrix */
3941 static void GLAPIENTRY
3942 save_LoadTransposeMatrixdARB(const GLdouble m
[16])
3945 _math_transposefd(tm
, m
);
3946 save_LoadMatrixf(tm
);
3950 static void GLAPIENTRY
3951 save_LoadTransposeMatrixfARB(const GLfloat m
[16])
3954 _math_transposef(tm
, m
);
3955 save_LoadMatrixf(tm
);
3959 static void GLAPIENTRY
3960 save_MultTransposeMatrixdARB(const GLdouble m
[16])
3963 _math_transposefd(tm
, m
);
3964 save_MultMatrixf(tm
);
3968 static void GLAPIENTRY
3969 save_MultTransposeMatrixfARB(const GLfloat m
[16])
3972 _math_transposef(tm
, m
);
3973 save_MultMatrixf(tm
);
3977 /* GL_ARB_texture_compression */
3978 static void GLAPIENTRY
3979 save_CompressedTexImage1DARB(GLenum target
, GLint level
,
3980 GLenum internalFormat
, GLsizei width
,
3981 GLint border
, GLsizei imageSize
,
3982 const GLvoid
* data
)
3984 GET_CURRENT_CONTEXT(ctx
);
3985 if (target
== GL_PROXY_TEXTURE_1D
) {
3986 /* don't compile, execute immediately */
3987 CALL_CompressedTexImage1DARB(ctx
->Exec
, (target
, level
, internalFormat
,
3988 width
, border
, imageSize
,
3994 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3995 /* make copy of image */
3996 image
= _mesa_malloc(imageSize
);
3998 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage1DARB");
4001 MEMCPY(image
, data
, imageSize
);
4002 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_1D
, 7);
4006 n
[3].e
= internalFormat
;
4007 n
[4].i
= (GLint
) width
;
4015 if (ctx
->ExecuteFlag
) {
4016 CALL_CompressedTexImage1DARB(ctx
->Exec
,
4017 (target
, level
, internalFormat
, width
,
4018 border
, imageSize
, data
));
4024 static void GLAPIENTRY
4025 save_CompressedTexImage2DARB(GLenum target
, GLint level
,
4026 GLenum internalFormat
, GLsizei width
,
4027 GLsizei height
, GLint border
, GLsizei imageSize
,
4028 const GLvoid
* data
)
4030 GET_CURRENT_CONTEXT(ctx
);
4031 if (target
== GL_PROXY_TEXTURE_2D
) {
4032 /* don't compile, execute immediately */
4033 CALL_CompressedTexImage2DARB(ctx
->Exec
, (target
, level
, internalFormat
,
4034 width
, height
, border
,
4040 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4041 /* make copy of image */
4042 image
= _mesa_malloc(imageSize
);
4044 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage2DARB");
4047 MEMCPY(image
, data
, imageSize
);
4048 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_2D
, 8);
4052 n
[3].e
= internalFormat
;
4053 n
[4].i
= (GLint
) width
;
4054 n
[5].i
= (GLint
) height
;
4062 if (ctx
->ExecuteFlag
) {
4063 CALL_CompressedTexImage2DARB(ctx
->Exec
,
4064 (target
, level
, internalFormat
, width
,
4065 height
, border
, imageSize
, data
));
4071 static void GLAPIENTRY
4072 save_CompressedTexImage3DARB(GLenum target
, GLint level
,
4073 GLenum internalFormat
, GLsizei width
,
4074 GLsizei height
, GLsizei depth
, GLint border
,
4075 GLsizei imageSize
, const GLvoid
* data
)
4077 GET_CURRENT_CONTEXT(ctx
);
4078 if (target
== GL_PROXY_TEXTURE_3D
) {
4079 /* don't compile, execute immediately */
4080 CALL_CompressedTexImage3DARB(ctx
->Exec
, (target
, level
, internalFormat
,
4081 width
, height
, depth
, border
,
4087 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4088 /* make copy of image */
4089 image
= _mesa_malloc(imageSize
);
4091 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage3DARB");
4094 MEMCPY(image
, data
, imageSize
);
4095 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_3D
, 9);
4099 n
[3].e
= internalFormat
;
4100 n
[4].i
= (GLint
) width
;
4101 n
[5].i
= (GLint
) height
;
4102 n
[6].i
= (GLint
) depth
;
4110 if (ctx
->ExecuteFlag
) {
4111 CALL_CompressedTexImage3DARB(ctx
->Exec
,
4112 (target
, level
, internalFormat
, width
,
4113 height
, depth
, border
, imageSize
,
4120 static void GLAPIENTRY
4121 save_CompressedTexSubImage1DARB(GLenum target
, GLint level
, GLint xoffset
,
4122 GLsizei width
, GLenum format
,
4123 GLsizei imageSize
, const GLvoid
* data
)
4128 GET_CURRENT_CONTEXT(ctx
);
4129 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4131 /* make copy of image */
4132 image
= _mesa_malloc(imageSize
);
4134 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage1DARB");
4137 MEMCPY(image
, data
, imageSize
);
4138 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
, 7);
4143 n
[4].i
= (GLint
) width
;
4151 if (ctx
->ExecuteFlag
) {
4152 CALL_CompressedTexSubImage1DARB(ctx
->Exec
, (target
, level
, xoffset
,
4153 width
, format
, imageSize
,
4159 static void GLAPIENTRY
4160 save_CompressedTexSubImage2DARB(GLenum target
, GLint level
, GLint xoffset
,
4161 GLint yoffset
, GLsizei width
, GLsizei height
,
4162 GLenum format
, GLsizei imageSize
,
4163 const GLvoid
* data
)
4168 GET_CURRENT_CONTEXT(ctx
);
4169 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4171 /* make copy of image */
4172 image
= _mesa_malloc(imageSize
);
4174 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage2DARB");
4177 MEMCPY(image
, data
, imageSize
);
4178 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
, 9);
4184 n
[5].i
= (GLint
) width
;
4185 n
[6].i
= (GLint
) height
;
4193 if (ctx
->ExecuteFlag
) {
4194 CALL_CompressedTexSubImage2DARB(ctx
->Exec
,
4195 (target
, level
, xoffset
, yoffset
, width
,
4196 height
, format
, imageSize
, data
));
4201 static void GLAPIENTRY
4202 save_CompressedTexSubImage3DARB(GLenum target
, GLint level
, GLint xoffset
,
4203 GLint yoffset
, GLint zoffset
, GLsizei width
,
4204 GLsizei height
, GLsizei depth
, GLenum format
,
4205 GLsizei imageSize
, const GLvoid
* data
)
4210 GET_CURRENT_CONTEXT(ctx
);
4211 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4213 /* make copy of image */
4214 image
= _mesa_malloc(imageSize
);
4216 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage3DARB");
4219 MEMCPY(image
, data
, imageSize
);
4220 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
, 11);
4227 n
[6].i
= (GLint
) width
;
4228 n
[7].i
= (GLint
) height
;
4229 n
[8].i
= (GLint
) depth
;
4231 n
[10].i
= imageSize
;
4237 if (ctx
->ExecuteFlag
) {
4238 CALL_CompressedTexSubImage3DARB(ctx
->Exec
,
4239 (target
, level
, xoffset
, yoffset
,
4240 zoffset
, width
, height
, depth
, format
,
4246 /* GL_ARB_multisample */
4247 static void GLAPIENTRY
4248 save_SampleCoverageARB(GLclampf value
, GLboolean invert
)
4250 GET_CURRENT_CONTEXT(ctx
);
4252 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4253 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SAMPLE_COVERAGE
, 2);
4258 if (ctx
->ExecuteFlag
) {
4259 CALL_SampleCoverageARB(ctx
->Exec
, (value
, invert
));
4265 * GL_NV_vertex_program
4267 #if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
4268 static void GLAPIENTRY
4269 save_BindProgramNV(GLenum target
, GLuint id
)
4271 GET_CURRENT_CONTEXT(ctx
);
4273 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4274 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BIND_PROGRAM_NV
, 2);
4279 if (ctx
->ExecuteFlag
) {
4280 CALL_BindProgramNV(ctx
->Exec
, (target
, id
));
4284 static void GLAPIENTRY
4285 save_ProgramEnvParameter4fARB(GLenum target
, GLuint index
,
4286 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4288 GET_CURRENT_CONTEXT(ctx
);
4290 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4291 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4300 if (ctx
->ExecuteFlag
) {
4301 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4306 static void GLAPIENTRY
4307 save_ProgramEnvParameter4fvARB(GLenum target
, GLuint index
,
4308 const GLfloat
*params
)
4310 save_ProgramEnvParameter4fARB(target
, index
, params
[0], params
[1],
4311 params
[2], params
[3]);
4315 static void GLAPIENTRY
4316 save_ProgramEnvParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4317 const GLfloat
* params
)
4319 GET_CURRENT_CONTEXT(ctx
);
4321 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4325 const GLfloat
* p
= params
;
4327 for (i
= 0 ; i
< count
; i
++) {
4328 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4341 if (ctx
->ExecuteFlag
) {
4342 CALL_ProgramEnvParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4347 static void GLAPIENTRY
4348 save_ProgramEnvParameter4dARB(GLenum target
, GLuint index
,
4349 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4351 save_ProgramEnvParameter4fARB(target
, index
,
4353 (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4357 static void GLAPIENTRY
4358 save_ProgramEnvParameter4dvARB(GLenum target
, GLuint index
,
4359 const GLdouble
*params
)
4361 save_ProgramEnvParameter4fARB(target
, index
,
4362 (GLfloat
) params
[0],
4363 (GLfloat
) params
[1],
4364 (GLfloat
) params
[2], (GLfloat
) params
[3]);
4367 #endif /* FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program || FEATURE_NV_vertex_program */
4369 #if FEATURE_NV_vertex_program
4370 static void GLAPIENTRY
4371 save_ExecuteProgramNV(GLenum target
, GLuint id
, const GLfloat
*params
)
4373 GET_CURRENT_CONTEXT(ctx
);
4375 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4376 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EXECUTE_PROGRAM_NV
, 6);
4385 if (ctx
->ExecuteFlag
) {
4386 CALL_ExecuteProgramNV(ctx
->Exec
, (target
, id
, params
));
4391 static void GLAPIENTRY
4392 save_ProgramParameters4dvNV(GLenum target
, GLuint index
,
4393 GLuint num
, const GLdouble
*params
)
4396 for (i
= 0; i
< num
; i
++) {
4397 save_ProgramEnvParameter4dvARB(target
, index
+ i
, params
+ 4 * i
);
4402 static void GLAPIENTRY
4403 save_ProgramParameters4fvNV(GLenum target
, GLuint index
,
4404 GLuint num
, const GLfloat
*params
)
4407 for (i
= 0; i
< num
; i
++) {
4408 save_ProgramEnvParameter4fvARB(target
, index
+ i
, params
+ 4 * i
);
4413 static void GLAPIENTRY
4414 save_LoadProgramNV(GLenum target
, GLuint id
, GLsizei len
,
4415 const GLubyte
* program
)
4417 GET_CURRENT_CONTEXT(ctx
);
4419 GLubyte
*programCopy
;
4421 programCopy
= (GLubyte
*) _mesa_malloc(len
);
4423 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glLoadProgramNV");
4426 _mesa_memcpy(programCopy
, program
, len
);
4428 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4429 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_LOAD_PROGRAM_NV
, 4);
4434 n
[4].data
= programCopy
;
4436 if (ctx
->ExecuteFlag
) {
4437 CALL_LoadProgramNV(ctx
->Exec
, (target
, id
, len
, program
));
4442 static void GLAPIENTRY
4443 save_RequestResidentProgramsNV(GLsizei num
, const GLuint
* ids
)
4445 GET_CURRENT_CONTEXT(ctx
);
4447 GLuint
*idCopy
= (GLuint
*) _mesa_malloc(num
* sizeof(GLuint
));
4449 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glRequestResidentProgramsNV");
4452 _mesa_memcpy(idCopy
, ids
, num
* sizeof(GLuint
));
4453 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4454 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TRACK_MATRIX_NV
, 2);
4459 if (ctx
->ExecuteFlag
) {
4460 CALL_RequestResidentProgramsNV(ctx
->Exec
, (num
, ids
));
4465 static void GLAPIENTRY
4466 save_TrackMatrixNV(GLenum target
, GLuint address
,
4467 GLenum matrix
, GLenum transform
)
4469 GET_CURRENT_CONTEXT(ctx
);
4471 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4472 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_TRACK_MATRIX_NV
, 4);
4479 if (ctx
->ExecuteFlag
) {
4480 CALL_TrackMatrixNV(ctx
->Exec
, (target
, address
, matrix
, transform
));
4483 #endif /* FEATURE_NV_vertex_program */
4487 * GL_NV_fragment_program
4489 #if FEATURE_NV_fragment_program
4490 static void GLAPIENTRY
4491 save_ProgramLocalParameter4fARB(GLenum target
, GLuint index
,
4492 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4494 GET_CURRENT_CONTEXT(ctx
);
4496 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4497 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4506 if (ctx
->ExecuteFlag
) {
4507 CALL_ProgramLocalParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4512 static void GLAPIENTRY
4513 save_ProgramLocalParameter4fvARB(GLenum target
, GLuint index
,
4514 const GLfloat
*params
)
4516 GET_CURRENT_CONTEXT(ctx
);
4518 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4519 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4528 if (ctx
->ExecuteFlag
) {
4529 CALL_ProgramLocalParameter4fvARB(ctx
->Exec
, (target
, index
, params
));
4534 static void GLAPIENTRY
4535 save_ProgramLocalParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4536 const GLfloat
*params
)
4538 GET_CURRENT_CONTEXT(ctx
);
4540 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4544 const GLfloat
* p
= params
;
4546 for (i
= 0 ; i
< count
; i
++) {
4547 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4560 if (ctx
->ExecuteFlag
) {
4561 CALL_ProgramLocalParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4566 static void GLAPIENTRY
4567 save_ProgramLocalParameter4dARB(GLenum target
, GLuint index
,
4568 GLdouble x
, GLdouble y
,
4569 GLdouble z
, GLdouble w
)
4571 GET_CURRENT_CONTEXT(ctx
);
4573 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4574 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4578 n
[3].f
= (GLfloat
) x
;
4579 n
[4].f
= (GLfloat
) y
;
4580 n
[5].f
= (GLfloat
) z
;
4581 n
[6].f
= (GLfloat
) w
;
4583 if (ctx
->ExecuteFlag
) {
4584 CALL_ProgramLocalParameter4dARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4589 static void GLAPIENTRY
4590 save_ProgramLocalParameter4dvARB(GLenum target
, GLuint index
,
4591 const GLdouble
*params
)
4593 GET_CURRENT_CONTEXT(ctx
);
4595 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4596 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4600 n
[3].f
= (GLfloat
) params
[0];
4601 n
[4].f
= (GLfloat
) params
[1];
4602 n
[5].f
= (GLfloat
) params
[2];
4603 n
[6].f
= (GLfloat
) params
[3];
4605 if (ctx
->ExecuteFlag
) {
4606 CALL_ProgramLocalParameter4dvARB(ctx
->Exec
, (target
, index
, params
));
4610 static void GLAPIENTRY
4611 save_ProgramNamedParameter4fNV(GLuint id
, GLsizei len
, const GLubyte
* name
,
4612 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4614 GET_CURRENT_CONTEXT(ctx
);
4616 GLubyte
*nameCopy
= (GLubyte
*) _mesa_malloc(len
);
4618 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramNamedParameter4fNV");
4621 _mesa_memcpy(nameCopy
, name
, len
);
4623 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4624 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_NAMED_PARAMETER_NV
, 6);
4628 n
[3].data
= nameCopy
;
4634 if (ctx
->ExecuteFlag
) {
4635 CALL_ProgramNamedParameter4fNV(ctx
->Exec
, (id
, len
, name
, x
, y
, z
, w
));
4640 static void GLAPIENTRY
4641 save_ProgramNamedParameter4fvNV(GLuint id
, GLsizei len
, const GLubyte
* name
,
4644 save_ProgramNamedParameter4fNV(id
, len
, name
, v
[0], v
[1], v
[2], v
[3]);
4648 static void GLAPIENTRY
4649 save_ProgramNamedParameter4dNV(GLuint id
, GLsizei len
, const GLubyte
* name
,
4650 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4652 save_ProgramNamedParameter4fNV(id
, len
, name
, (GLfloat
) x
, (GLfloat
) y
,
4653 (GLfloat
) z
, (GLfloat
) w
);
4657 static void GLAPIENTRY
4658 save_ProgramNamedParameter4dvNV(GLuint id
, GLsizei len
, const GLubyte
* name
,
4661 save_ProgramNamedParameter4fNV(id
, len
, name
, (GLfloat
) v
[0],
4662 (GLfloat
) v
[1], (GLfloat
) v
[2],
4666 #endif /* FEATURE_NV_fragment_program */
4670 /* GL_EXT_stencil_two_side */
4671 static void GLAPIENTRY
4672 save_ActiveStencilFaceEXT(GLenum face
)
4674 GET_CURRENT_CONTEXT(ctx
);
4676 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4677 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ACTIVE_STENCIL_FACE_EXT
, 1);
4681 if (ctx
->ExecuteFlag
) {
4682 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (face
));
4687 /* GL_EXT_depth_bounds_test */
4688 static void GLAPIENTRY
4689 save_DepthBoundsEXT(GLclampd zmin
, GLclampd zmax
)
4691 GET_CURRENT_CONTEXT(ctx
);
4693 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4694 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DEPTH_BOUNDS_EXT
, 2);
4696 n
[1].f
= (GLfloat
) zmin
;
4697 n
[2].f
= (GLfloat
) zmax
;
4699 if (ctx
->ExecuteFlag
) {
4700 CALL_DepthBoundsEXT(ctx
->Exec
, (zmin
, zmax
));
4706 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
4708 static void GLAPIENTRY
4709 save_ProgramStringARB(GLenum target
, GLenum format
, GLsizei len
,
4710 const GLvoid
* string
)
4712 GET_CURRENT_CONTEXT(ctx
);
4714 GLubyte
*programCopy
;
4716 programCopy
= (GLubyte
*) _mesa_malloc(len
);
4718 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramStringARB");
4721 _mesa_memcpy(programCopy
, string
, len
);
4723 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4724 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_PROGRAM_STRING_ARB
, 4);
4729 n
[4].data
= programCopy
;
4731 if (ctx
->ExecuteFlag
) {
4732 CALL_ProgramStringARB(ctx
->Exec
, (target
, format
, len
, string
));
4736 #endif /* FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program */
4739 #if FEATURE_ARB_occlusion_query
4741 static void GLAPIENTRY
4742 save_BeginQueryARB(GLenum target
, GLuint id
)
4744 GET_CURRENT_CONTEXT(ctx
);
4746 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4747 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BEGIN_QUERY_ARB
, 2);
4752 if (ctx
->ExecuteFlag
) {
4753 CALL_BeginQueryARB(ctx
->Exec
, (target
, id
));
4758 static void GLAPIENTRY
4759 save_EndQueryARB(GLenum target
)
4761 GET_CURRENT_CONTEXT(ctx
);
4763 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4764 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_END_QUERY_ARB
, 1);
4768 if (ctx
->ExecuteFlag
) {
4769 CALL_EndQueryARB(ctx
->Exec
, (target
));
4773 #endif /* FEATURE_ARB_occlusion_query */
4776 static void GLAPIENTRY
4777 save_DrawBuffersARB(GLsizei count
, const GLenum
* buffers
)
4779 GET_CURRENT_CONTEXT(ctx
);
4781 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4782 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_DRAW_BUFFERS_ARB
, 1 + MAX_DRAW_BUFFERS
);
4786 if (count
> MAX_DRAW_BUFFERS
)
4787 count
= MAX_DRAW_BUFFERS
;
4788 for (i
= 0; i
< count
; i
++) {
4789 n
[2 + i
].e
= buffers
[i
];
4792 if (ctx
->ExecuteFlag
) {
4793 CALL_DrawBuffersARB(ctx
->Exec
, (count
, buffers
));
4797 #if FEATURE_ATI_fragment_shader
4798 static void GLAPIENTRY
4799 save_BindFragmentShaderATI(GLuint id
)
4801 GET_CURRENT_CONTEXT(ctx
);
4804 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BIND_FRAGMENT_SHADER_ATI
, 1);
4808 if (ctx
->ExecuteFlag
) {
4809 CALL_BindFragmentShaderATI(ctx
->Exec
, (id
));
4813 static void GLAPIENTRY
4814 save_SetFragmentShaderConstantATI(GLuint dst
, const GLfloat
*value
)
4816 GET_CURRENT_CONTEXT(ctx
);
4819 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
, 5);
4827 if (ctx
->ExecuteFlag
) {
4828 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, value
));
4834 save_Attr1fNV(GLenum attr
, GLfloat x
)
4836 GET_CURRENT_CONTEXT(ctx
);
4838 SAVE_FLUSH_VERTICES(ctx
);
4839 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_1F_NV
, 2);
4845 ASSERT(attr
< MAX_VERTEX_PROGRAM_ATTRIBS
);
4846 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
4847 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
4849 if (ctx
->ExecuteFlag
) {
4850 CALL_VertexAttrib1fNV(ctx
->Exec
, (attr
, x
));
4855 save_Attr2fNV(GLenum attr
, GLfloat x
, GLfloat y
)
4857 GET_CURRENT_CONTEXT(ctx
);
4859 SAVE_FLUSH_VERTICES(ctx
);
4860 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_2F_NV
, 3);
4867 ASSERT(attr
< MAX_VERTEX_PROGRAM_ATTRIBS
);
4868 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
4869 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
4871 if (ctx
->ExecuteFlag
) {
4872 CALL_VertexAttrib2fNV(ctx
->Exec
, (attr
, x
, y
));
4877 save_Attr3fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
4879 GET_CURRENT_CONTEXT(ctx
);
4881 SAVE_FLUSH_VERTICES(ctx
);
4882 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_3F_NV
, 4);
4890 ASSERT(attr
< MAX_VERTEX_PROGRAM_ATTRIBS
);
4891 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
4892 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
4894 if (ctx
->ExecuteFlag
) {
4895 CALL_VertexAttrib3fNV(ctx
->Exec
, (attr
, x
, y
, z
));
4900 save_Attr4fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4902 GET_CURRENT_CONTEXT(ctx
);
4904 SAVE_FLUSH_VERTICES(ctx
);
4905 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_4F_NV
, 5);
4914 ASSERT(attr
< MAX_VERTEX_PROGRAM_ATTRIBS
);
4915 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
4916 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
4918 if (ctx
->ExecuteFlag
) {
4919 CALL_VertexAttrib4fNV(ctx
->Exec
, (attr
, x
, y
, z
, w
));
4925 save_Attr1fARB(GLenum attr
, GLfloat x
)
4927 GET_CURRENT_CONTEXT(ctx
);
4929 SAVE_FLUSH_VERTICES(ctx
);
4930 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_1F_ARB
, 2);
4936 ASSERT(attr
< MAX_VERTEX_ATTRIBS
);
4937 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
4938 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
4940 if (ctx
->ExecuteFlag
) {
4941 CALL_VertexAttrib1fARB(ctx
->Exec
, (attr
, x
));
4946 save_Attr2fARB(GLenum attr
, GLfloat x
, GLfloat y
)
4948 GET_CURRENT_CONTEXT(ctx
);
4950 SAVE_FLUSH_VERTICES(ctx
);
4951 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_2F_ARB
, 3);
4958 ASSERT(attr
< MAX_VERTEX_ATTRIBS
);
4959 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
4960 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
4962 if (ctx
->ExecuteFlag
) {
4963 CALL_VertexAttrib2fARB(ctx
->Exec
, (attr
, x
, y
));
4968 save_Attr3fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
4970 GET_CURRENT_CONTEXT(ctx
);
4972 SAVE_FLUSH_VERTICES(ctx
);
4973 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_3F_ARB
, 4);
4981 ASSERT(attr
< MAX_VERTEX_ATTRIBS
);
4982 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
4983 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
4985 if (ctx
->ExecuteFlag
) {
4986 CALL_VertexAttrib3fARB(ctx
->Exec
, (attr
, x
, y
, z
));
4991 save_Attr4fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4993 GET_CURRENT_CONTEXT(ctx
);
4995 SAVE_FLUSH_VERTICES(ctx
);
4996 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ATTR_4F_ARB
, 5);
5005 ASSERT(attr
< MAX_VERTEX_ATTRIBS
);
5006 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5007 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5009 if (ctx
->ExecuteFlag
) {
5010 CALL_VertexAttrib4fARB(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5015 static void GLAPIENTRY
5016 save_EvalCoord1f(GLfloat x
)
5018 GET_CURRENT_CONTEXT(ctx
);
5020 SAVE_FLUSH_VERTICES(ctx
);
5021 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVAL_C1
, 1);
5025 if (ctx
->ExecuteFlag
) {
5026 CALL_EvalCoord1f(ctx
->Exec
, (x
));
5030 static void GLAPIENTRY
5031 save_EvalCoord1fv(const GLfloat
* v
)
5033 save_EvalCoord1f(v
[0]);
5036 static void GLAPIENTRY
5037 save_EvalCoord2f(GLfloat x
, GLfloat y
)
5039 GET_CURRENT_CONTEXT(ctx
);
5041 SAVE_FLUSH_VERTICES(ctx
);
5042 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVAL_C2
, 2);
5047 if (ctx
->ExecuteFlag
) {
5048 CALL_EvalCoord2f(ctx
->Exec
, (x
, y
));
5052 static void GLAPIENTRY
5053 save_EvalCoord2fv(const GLfloat
* v
)
5055 save_EvalCoord2f(v
[0], v
[1]);
5059 static void GLAPIENTRY
5060 save_EvalPoint1(GLint x
)
5062 GET_CURRENT_CONTEXT(ctx
);
5064 SAVE_FLUSH_VERTICES(ctx
);
5065 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVAL_P1
, 1);
5069 if (ctx
->ExecuteFlag
) {
5070 CALL_EvalPoint1(ctx
->Exec
, (x
));
5074 static void GLAPIENTRY
5075 save_EvalPoint2(GLint x
, GLint y
)
5077 GET_CURRENT_CONTEXT(ctx
);
5079 SAVE_FLUSH_VERTICES(ctx
);
5080 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_EVAL_P2
, 2);
5085 if (ctx
->ExecuteFlag
) {
5086 CALL_EvalPoint2(ctx
->Exec
, (x
, y
));
5090 static void GLAPIENTRY
5091 save_Indexf(GLfloat x
)
5093 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, x
);
5096 static void GLAPIENTRY
5097 save_Indexfv(const GLfloat
* v
)
5099 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, v
[0]);
5102 static void GLAPIENTRY
5103 save_EdgeFlag(GLboolean x
)
5105 save_Attr1fNV(VERT_ATTRIB_EDGEFLAG
, x
? 1.0 : 0.0);
5108 static void GLAPIENTRY
5109 save_Materialfv(GLenum face
, GLenum pname
, const GLfloat
* param
)
5111 GET_CURRENT_CONTEXT(ctx
);
5115 SAVE_FLUSH_VERTICES(ctx
);
5120 case GL_FRONT_AND_BACK
:
5123 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "material(face)");
5132 case GL_AMBIENT_AND_DIFFUSE
:
5138 case GL_COLOR_INDEXES
:
5142 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "material(pname)");
5146 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_MATERIAL
, 6);
5150 for (i
= 0; i
< args
; i
++)
5151 n
[3 + i
].f
= param
[i
];
5155 GLuint bitmask
= _mesa_material_bitmask(ctx
, face
, pname
, ~0, NULL
);
5156 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++)
5157 if (bitmask
& (1 << i
)) {
5158 ctx
->ListState
.ActiveMaterialSize
[i
] = args
;
5159 COPY_SZ_4V(ctx
->ListState
.CurrentMaterial
[i
], args
, param
);
5163 if (ctx
->ExecuteFlag
) {
5164 CALL_Materialfv(ctx
->Exec
, (face
, pname
, param
));
5168 static void GLAPIENTRY
5169 save_Begin(GLenum mode
)
5171 GET_CURRENT_CONTEXT(ctx
);
5173 GLboolean error
= GL_FALSE
;
5175 if ( /*mode < GL_POINTS || */ mode
> GL_POLYGON
) {
5176 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "Begin (mode)");
5179 else if (ctx
->Driver
.CurrentSavePrimitive
== PRIM_UNKNOWN
) {
5180 /* Typically the first begin. This may raise an error on
5181 * playback, depending on whether CallList is issued from inside
5182 * a begin/end or not.
5184 ctx
->Driver
.CurrentSavePrimitive
= PRIM_INSIDE_UNKNOWN_PRIM
;
5186 else if (ctx
->Driver
.CurrentSavePrimitive
== PRIM_OUTSIDE_BEGIN_END
) {
5187 ctx
->Driver
.CurrentSavePrimitive
= mode
;
5190 _mesa_compile_error(ctx
, GL_INVALID_OPERATION
, "recursive begin");
5195 /* Give the driver an opportunity to hook in an optimized
5196 * display list compiler.
5198 if (ctx
->Driver
.NotifySaveBegin(ctx
, mode
))
5201 SAVE_FLUSH_VERTICES(ctx
);
5202 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BEGIN
, 1);
5208 if (ctx
->ExecuteFlag
) {
5209 CALL_Begin(ctx
->Exec
, (mode
));
5213 static void GLAPIENTRY
5216 GET_CURRENT_CONTEXT(ctx
);
5217 SAVE_FLUSH_VERTICES(ctx
);
5218 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_END
, 0);
5219 ctx
->Driver
.CurrentSavePrimitive
= PRIM_OUTSIDE_BEGIN_END
;
5220 if (ctx
->ExecuteFlag
) {
5221 CALL_End(ctx
->Exec
, ());
5225 static void GLAPIENTRY
5226 save_Rectf(GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
5228 GET_CURRENT_CONTEXT(ctx
);
5230 SAVE_FLUSH_VERTICES(ctx
);
5231 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_RECTF
, 4);
5238 if (ctx
->ExecuteFlag
) {
5239 CALL_Rectf(ctx
->Exec
, (a
, b
, c
, d
));
5244 static void GLAPIENTRY
5245 save_Vertex2f(GLfloat x
, GLfloat y
)
5247 save_Attr2fNV(VERT_ATTRIB_POS
, x
, y
);
5250 static void GLAPIENTRY
5251 save_Vertex2fv(const GLfloat
* v
)
5253 save_Attr2fNV(VERT_ATTRIB_POS
, v
[0], v
[1]);
5256 static void GLAPIENTRY
5257 save_Vertex3f(GLfloat x
, GLfloat y
, GLfloat z
)
5259 save_Attr3fNV(VERT_ATTRIB_POS
, x
, y
, z
);
5262 static void GLAPIENTRY
5263 save_Vertex3fv(const GLfloat
* v
)
5265 save_Attr3fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2]);
5268 static void GLAPIENTRY
5269 save_Vertex4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5271 save_Attr4fNV(VERT_ATTRIB_POS
, x
, y
, z
, w
);
5274 static void GLAPIENTRY
5275 save_Vertex4fv(const GLfloat
* v
)
5277 save_Attr4fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2], v
[3]);
5280 static void GLAPIENTRY
5281 save_TexCoord1f(GLfloat x
)
5283 save_Attr1fNV(VERT_ATTRIB_TEX0
, x
);
5286 static void GLAPIENTRY
5287 save_TexCoord1fv(const GLfloat
* v
)
5289 save_Attr1fNV(VERT_ATTRIB_TEX0
, v
[0]);
5292 static void GLAPIENTRY
5293 save_TexCoord2f(GLfloat x
, GLfloat y
)
5295 save_Attr2fNV(VERT_ATTRIB_TEX0
, x
, y
);
5298 static void GLAPIENTRY
5299 save_TexCoord2fv(const GLfloat
* v
)
5301 save_Attr2fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1]);
5304 static void GLAPIENTRY
5305 save_TexCoord3f(GLfloat x
, GLfloat y
, GLfloat z
)
5307 save_Attr3fNV(VERT_ATTRIB_TEX0
, x
, y
, z
);
5310 static void GLAPIENTRY
5311 save_TexCoord3fv(const GLfloat
* v
)
5313 save_Attr3fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2]);
5316 static void GLAPIENTRY
5317 save_TexCoord4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5319 save_Attr4fNV(VERT_ATTRIB_TEX0
, x
, y
, z
, w
);
5322 static void GLAPIENTRY
5323 save_TexCoord4fv(const GLfloat
* v
)
5325 save_Attr4fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2], v
[3]);
5328 static void GLAPIENTRY
5329 save_Normal3f(GLfloat x
, GLfloat y
, GLfloat z
)
5331 save_Attr3fNV(VERT_ATTRIB_NORMAL
, x
, y
, z
);
5334 static void GLAPIENTRY
5335 save_Normal3fv(const GLfloat
* v
)
5337 save_Attr3fNV(VERT_ATTRIB_NORMAL
, v
[0], v
[1], v
[2]);
5340 static void GLAPIENTRY
5341 save_FogCoordfEXT(GLfloat x
)
5343 save_Attr1fNV(VERT_ATTRIB_FOG
, x
);
5346 static void GLAPIENTRY
5347 save_FogCoordfvEXT(const GLfloat
* v
)
5349 save_Attr1fNV(VERT_ATTRIB_FOG
, v
[0]);
5352 static void GLAPIENTRY
5353 save_Color3f(GLfloat x
, GLfloat y
, GLfloat z
)
5355 save_Attr3fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
);
5358 static void GLAPIENTRY
5359 save_Color3fv(const GLfloat
* v
)
5361 save_Attr3fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2]);
5364 static void GLAPIENTRY
5365 save_Color4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5367 save_Attr4fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
, w
);
5370 static void GLAPIENTRY
5371 save_Color4fv(const GLfloat
* v
)
5373 save_Attr4fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2], v
[3]);
5376 static void GLAPIENTRY
5377 save_SecondaryColor3fEXT(GLfloat x
, GLfloat y
, GLfloat z
)
5379 save_Attr3fNV(VERT_ATTRIB_COLOR1
, x
, y
, z
);
5382 static void GLAPIENTRY
5383 save_SecondaryColor3fvEXT(const GLfloat
* v
)
5385 save_Attr3fNV(VERT_ATTRIB_COLOR1
, v
[0], v
[1], v
[2]);
5389 /* Just call the respective ATTR for texcoord
5391 static void GLAPIENTRY
5392 save_MultiTexCoord1f(GLenum target
, GLfloat x
)
5394 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5395 save_Attr1fNV(attr
, x
);
5398 static void GLAPIENTRY
5399 save_MultiTexCoord1fv(GLenum target
, const GLfloat
* v
)
5401 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5402 save_Attr1fNV(attr
, v
[0]);
5405 static void GLAPIENTRY
5406 save_MultiTexCoord2f(GLenum target
, GLfloat x
, GLfloat y
)
5408 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5409 save_Attr2fNV(attr
, x
, y
);
5412 static void GLAPIENTRY
5413 save_MultiTexCoord2fv(GLenum target
, const GLfloat
* v
)
5415 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5416 save_Attr2fNV(attr
, v
[0], v
[1]);
5419 static void GLAPIENTRY
5420 save_MultiTexCoord3f(GLenum target
, GLfloat x
, GLfloat y
, GLfloat z
)
5422 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5423 save_Attr3fNV(attr
, x
, y
, z
);
5426 static void GLAPIENTRY
5427 save_MultiTexCoord3fv(GLenum target
, const GLfloat
* v
)
5429 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5430 save_Attr3fNV(attr
, v
[0], v
[1], v
[2]);
5433 static void GLAPIENTRY
5434 save_MultiTexCoord4f(GLenum target
, GLfloat x
, GLfloat y
,
5435 GLfloat z
, GLfloat w
)
5437 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5438 save_Attr4fNV(attr
, x
, y
, z
, w
);
5441 static void GLAPIENTRY
5442 save_MultiTexCoord4fv(GLenum target
, const GLfloat
* v
)
5444 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5445 save_Attr4fNV(attr
, v
[0], v
[1], v
[2], v
[3]);
5450 * Record a GL_INVALID_VALUE error when a invalid vertex attribute
5456 GET_CURRENT_CONTEXT(ctx
);
5457 _mesa_error(ctx
, GL_INVALID_VALUE
, "VertexAttribf(index)");
5461 /* First level for NV_vertex_program:
5463 * Check for errors at compile time?.
5465 static void GLAPIENTRY
5466 save_VertexAttrib1fNV(GLuint index
, GLfloat x
)
5468 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5469 save_Attr1fNV(index
, x
);
5474 static void GLAPIENTRY
5475 save_VertexAttrib1fvNV(GLuint index
, const GLfloat
* v
)
5477 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5478 save_Attr1fNV(index
, v
[0]);
5483 static void GLAPIENTRY
5484 save_VertexAttrib2fNV(GLuint index
, GLfloat x
, GLfloat y
)
5486 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5487 save_Attr2fNV(index
, x
, y
);
5492 static void GLAPIENTRY
5493 save_VertexAttrib2fvNV(GLuint index
, const GLfloat
* v
)
5495 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5496 save_Attr2fNV(index
, v
[0], v
[1]);
5501 static void GLAPIENTRY
5502 save_VertexAttrib3fNV(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
5504 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5505 save_Attr3fNV(index
, x
, y
, z
);
5510 static void GLAPIENTRY
5511 save_VertexAttrib3fvNV(GLuint index
, const GLfloat
* v
)
5513 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5514 save_Attr3fNV(index
, v
[0], v
[1], v
[2]);
5519 static void GLAPIENTRY
5520 save_VertexAttrib4fNV(GLuint index
, GLfloat x
, GLfloat y
,
5521 GLfloat z
, GLfloat w
)
5523 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5524 save_Attr4fNV(index
, x
, y
, z
, w
);
5529 static void GLAPIENTRY
5530 save_VertexAttrib4fvNV(GLuint index
, const GLfloat
* v
)
5532 if (index
< MAX_VERTEX_PROGRAM_ATTRIBS
)
5533 save_Attr4fNV(index
, v
[0], v
[1], v
[2], v
[3]);
5541 static void GLAPIENTRY
5542 save_VertexAttrib1fARB(GLuint index
, GLfloat x
)
5544 if (index
< MAX_VERTEX_ATTRIBS
)
5545 save_Attr1fARB(index
, x
);
5550 static void GLAPIENTRY
5551 save_VertexAttrib1fvARB(GLuint index
, const GLfloat
* v
)
5553 if (index
< MAX_VERTEX_ATTRIBS
)
5554 save_Attr1fARB(index
, v
[0]);
5559 static void GLAPIENTRY
5560 save_VertexAttrib2fARB(GLuint index
, GLfloat x
, GLfloat y
)
5562 if (index
< MAX_VERTEX_ATTRIBS
)
5563 save_Attr2fARB(index
, x
, y
);
5568 static void GLAPIENTRY
5569 save_VertexAttrib2fvARB(GLuint index
, const GLfloat
* v
)
5571 if (index
< MAX_VERTEX_ATTRIBS
)
5572 save_Attr2fARB(index
, v
[0], v
[1]);
5577 static void GLAPIENTRY
5578 save_VertexAttrib3fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
5580 if (index
< MAX_VERTEX_ATTRIBS
)
5581 save_Attr3fARB(index
, x
, y
, z
);
5586 static void GLAPIENTRY
5587 save_VertexAttrib3fvARB(GLuint index
, const GLfloat
* v
)
5589 if (index
< MAX_VERTEX_ATTRIBS
)
5590 save_Attr3fARB(index
, v
[0], v
[1], v
[2]);
5595 static void GLAPIENTRY
5596 save_VertexAttrib4fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
,
5599 if (index
< MAX_VERTEX_ATTRIBS
)
5600 save_Attr4fARB(index
, x
, y
, z
, w
);
5605 static void GLAPIENTRY
5606 save_VertexAttrib4fvARB(GLuint index
, const GLfloat
* v
)
5608 if (index
< MAX_VERTEX_ATTRIBS
)
5609 save_Attr4fARB(index
, v
[0], v
[1], v
[2], v
[3]);
5615 /* GL_ARB_shader_objects, GL_ARB_vertex/fragment_shader */
5617 static void GLAPIENTRY
5618 exec_BindAttribLocationARB(GLuint program
, GLuint index
, const GLchar
*name
)
5620 GET_CURRENT_CONTEXT(ctx
);
5621 FLUSH_VERTICES(ctx
, 0);
5622 CALL_BindAttribLocationARB(ctx
->Exec
, (program
, index
, name
));
5625 static GLint GLAPIENTRY
5626 exec_GetAttribLocationARB(GLuint program
, const GLchar
*name
)
5628 GET_CURRENT_CONTEXT(ctx
);
5629 FLUSH_VERTICES(ctx
, 0);
5630 return CALL_GetAttribLocationARB(ctx
->Exec
, (program
, name
));
5632 /* XXX more shader functions needed here */
5636 #if FEATURE_EXT_framebuffer_blit
5637 static void GLAPIENTRY
5638 save_BlitFramebufferEXT(GLint srcX0
, GLint srcY0
, GLint srcX1
, GLint srcY1
,
5639 GLint dstX0
, GLint dstY0
, GLint dstX1
, GLint dstY1
,
5640 GLbitfield mask
, GLenum filter
)
5642 GET_CURRENT_CONTEXT(ctx
);
5644 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5645 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_BLIT_FRAMEBUFFER
, 10);
5658 if (ctx
->ExecuteFlag
) {
5659 CALL_BlitFramebufferEXT(ctx
->Exec
, (srcX0
, srcY0
, srcX1
, srcY1
,
5660 dstX0
, dstY0
, dstX1
, dstY1
,
5668 * Save an error-generating command into display list.
5670 * KW: Will appear in the list before the vertex buffer containing the
5671 * command that provoked the error. I don't see this as a problem.
5674 save_error(GLcontext
*ctx
, GLenum error
, const char *s
)
5677 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_ERROR
, 2);
5680 n
[2].data
= (void *) s
;
5686 * Compile an error into current display list.
5689 _mesa_compile_error(GLcontext
*ctx
, GLenum error
, const char *s
)
5691 if (ctx
->CompileFlag
)
5692 save_error(ctx
, error
, s
);
5693 if (ctx
->ExecuteFlag
)
5694 _mesa_error(ctx
, error
, s
);
5699 * Test if ID names a display list.
5702 islist(GLcontext
*ctx
, GLuint list
)
5704 if (list
> 0 && lookup_list(ctx
, list
)) {
5714 /**********************************************************************/
5715 /* Display list execution */
5716 /**********************************************************************/
5720 * Execute a display list. Note that the ListBase offset must have already
5721 * been added before calling this function. I.e. the list argument is
5722 * the absolute list number, not relative to ListBase.
5723 * \param list - display list number
5726 execute_list(GLcontext
*ctx
, GLuint list
)
5728 struct mesa_display_list
*dlist
;
5732 if (list
== 0 || !islist(ctx
, list
))
5735 if (ctx
->ListState
.CallDepth
== MAX_LIST_NESTING
) {
5736 /* raise an error? */
5740 dlist
= lookup_list(ctx
, list
);
5744 ctx
->ListState
.CallDepth
++;
5746 if (ctx
->Driver
.BeginCallList
)
5747 ctx
->Driver
.BeginCallList(ctx
, dlist
);
5753 OpCode opcode
= n
[0].opcode
;
5754 int i
= (int) n
[0].opcode
- (int) OPCODE_EXT_0
;
5756 if (i
>= 0 && i
< (GLint
) ctx
->ListExt
.NumOpcodes
) {
5757 /* this is a driver-extended opcode */
5758 ctx
->ListExt
.Opcode
[i
].Execute(ctx
, &n
[1]);
5759 n
+= ctx
->ListExt
.Opcode
[i
].Size
;
5764 _mesa_error(ctx
, n
[1].e
, (const char *) n
[2].data
);
5767 CALL_Accum(ctx
->Exec
, (n
[1].e
, n
[2].f
));
5769 case OPCODE_ALPHA_FUNC
:
5770 CALL_AlphaFunc(ctx
->Exec
, (n
[1].e
, n
[2].f
));
5772 case OPCODE_BIND_TEXTURE
:
5773 CALL_BindTexture(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
5777 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5778 ctx
->Unpack
= ctx
->DefaultPacking
;
5779 CALL_Bitmap(ctx
->Exec
, ((GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
5780 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
5781 (const GLubyte
*) n
[7].data
));
5782 ctx
->Unpack
= save
; /* restore */
5785 case OPCODE_BLEND_COLOR
:
5786 CALL_BlendColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
5788 case OPCODE_BLEND_EQUATION
:
5789 CALL_BlendEquation(ctx
->Exec
, (n
[1].e
));
5791 case OPCODE_BLEND_EQUATION_SEPARATE
:
5792 CALL_BlendEquationSeparateEXT(ctx
->Exec
, (n
[1].e
, n
[2].e
));
5794 case OPCODE_BLEND_FUNC_SEPARATE
:
5795 CALL_BlendFuncSeparateEXT(ctx
->Exec
,
5796 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
5798 case OPCODE_CALL_LIST
:
5799 /* Generated by glCallList(), don't add ListBase */
5800 if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
5801 execute_list(ctx
, n
[1].ui
);
5804 case OPCODE_CALL_LIST_OFFSET
:
5805 /* Generated by glCallLists() so we must add ListBase */
5807 /* user specified a bad data type at compile time */
5808 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
5810 else if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
5811 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ n
[1].i
);
5812 execute_list(ctx
, list
);
5816 CALL_Clear(ctx
->Exec
, (n
[1].bf
));
5818 case OPCODE_CLEAR_COLOR
:
5819 CALL_ClearColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
5821 case OPCODE_CLEAR_ACCUM
:
5822 CALL_ClearAccum(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
5824 case OPCODE_CLEAR_DEPTH
:
5825 CALL_ClearDepth(ctx
->Exec
, ((GLclampd
) n
[1].f
));
5827 case OPCODE_CLEAR_INDEX
:
5828 CALL_ClearIndex(ctx
->Exec
, ((GLfloat
) n
[1].ui
));
5830 case OPCODE_CLEAR_STENCIL
:
5831 CALL_ClearStencil(ctx
->Exec
, (n
[1].i
));
5833 case OPCODE_CLIP_PLANE
:
5840 CALL_ClipPlane(ctx
->Exec
, (n
[1].e
, eq
));
5843 case OPCODE_COLOR_MASK
:
5844 CALL_ColorMask(ctx
->Exec
, (n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
));
5846 case OPCODE_COLOR_MATERIAL
:
5847 CALL_ColorMaterial(ctx
->Exec
, (n
[1].e
, n
[2].e
));
5849 case OPCODE_COLOR_TABLE
:
5851 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5852 ctx
->Unpack
= ctx
->DefaultPacking
;
5853 CALL_ColorTable(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].e
,
5854 n
[5].e
, n
[6].data
));
5855 ctx
->Unpack
= save
; /* restore */
5858 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
5865 CALL_ColorTableParameterfv(ctx
->Exec
,
5866 (n
[1].e
, n
[2].e
, params
));
5869 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
5876 CALL_ColorTableParameteriv(ctx
->Exec
,
5877 (n
[1].e
, n
[2].e
, params
));
5880 case OPCODE_COLOR_SUB_TABLE
:
5882 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5883 ctx
->Unpack
= ctx
->DefaultPacking
;
5884 CALL_ColorSubTable(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5885 n
[4].e
, n
[5].e
, n
[6].data
));
5886 ctx
->Unpack
= save
; /* restore */
5889 case OPCODE_CONVOLUTION_FILTER_1D
:
5891 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5892 ctx
->Unpack
= ctx
->DefaultPacking
;
5893 CALL_ConvolutionFilter1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5896 ctx
->Unpack
= save
; /* restore */
5899 case OPCODE_CONVOLUTION_FILTER_2D
:
5901 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5902 ctx
->Unpack
= ctx
->DefaultPacking
;
5903 CALL_ConvolutionFilter2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5904 n
[4].i
, n
[5].e
, n
[6].e
,
5906 ctx
->Unpack
= save
; /* restore */
5909 case OPCODE_CONVOLUTION_PARAMETER_I
:
5910 CALL_ConvolutionParameteri(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].i
));
5912 case OPCODE_CONVOLUTION_PARAMETER_IV
:
5919 CALL_ConvolutionParameteriv(ctx
->Exec
,
5920 (n
[1].e
, n
[2].e
, params
));
5923 case OPCODE_CONVOLUTION_PARAMETER_F
:
5924 CALL_ConvolutionParameterf(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].f
));
5926 case OPCODE_CONVOLUTION_PARAMETER_FV
:
5933 CALL_ConvolutionParameterfv(ctx
->Exec
,
5934 (n
[1].e
, n
[2].e
, params
));
5937 case OPCODE_COPY_COLOR_SUB_TABLE
:
5938 CALL_CopyColorSubTable(ctx
->Exec
, (n
[1].e
, n
[2].i
,
5939 n
[3].i
, n
[4].i
, n
[5].i
));
5941 case OPCODE_COPY_COLOR_TABLE
:
5942 CALL_CopyColorSubTable(ctx
->Exec
, (n
[1].e
, n
[2].i
,
5943 n
[3].i
, n
[4].i
, n
[5].i
));
5945 case OPCODE_COPY_PIXELS
:
5946 CALL_CopyPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
,
5947 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
,
5950 case OPCODE_COPY_TEX_IMAGE1D
:
5951 CALL_CopyTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
5952 n
[5].i
, n
[6].i
, n
[7].i
));
5954 case OPCODE_COPY_TEX_IMAGE2D
:
5955 CALL_CopyTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
5956 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
));
5958 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
5959 CALL_CopyTexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5960 n
[4].i
, n
[5].i
, n
[6].i
));
5962 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
5963 CALL_CopyTexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5964 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
5967 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
5968 CALL_CopyTexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
5969 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
5972 case OPCODE_CULL_FACE
:
5973 CALL_CullFace(ctx
->Exec
, (n
[1].e
));
5975 case OPCODE_DEPTH_FUNC
:
5976 CALL_DepthFunc(ctx
->Exec
, (n
[1].e
));
5978 case OPCODE_DEPTH_MASK
:
5979 CALL_DepthMask(ctx
->Exec
, (n
[1].b
));
5981 case OPCODE_DEPTH_RANGE
:
5982 CALL_DepthRange(ctx
->Exec
,
5983 ((GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
));
5985 case OPCODE_DISABLE
:
5986 CALL_Disable(ctx
->Exec
, (n
[1].e
));
5988 case OPCODE_DRAW_BUFFER
:
5989 CALL_DrawBuffer(ctx
->Exec
, (n
[1].e
));
5991 case OPCODE_DRAW_PIXELS
:
5993 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5994 ctx
->Unpack
= ctx
->DefaultPacking
;
5995 CALL_DrawPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
5997 ctx
->Unpack
= save
; /* restore */
6001 CALL_Enable(ctx
->Exec
, (n
[1].e
));
6003 case OPCODE_EVALMESH1
:
6004 CALL_EvalMesh1(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
));
6006 case OPCODE_EVALMESH2
:
6007 CALL_EvalMesh2(ctx
->Exec
,
6008 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
6017 CALL_Fogfv(ctx
->Exec
, (n
[1].e
, p
));
6020 case OPCODE_FRONT_FACE
:
6021 CALL_FrontFace(ctx
->Exec
, (n
[1].e
));
6023 case OPCODE_FRUSTUM
:
6024 CALL_Frustum(ctx
->Exec
,
6025 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
6028 CALL_Hint(ctx
->Exec
, (n
[1].e
, n
[2].e
));
6030 case OPCODE_HISTOGRAM
:
6031 CALL_Histogram(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].b
));
6033 case OPCODE_INDEX_MASK
:
6034 CALL_IndexMask(ctx
->Exec
, (n
[1].ui
));
6036 case OPCODE_INIT_NAMES
:
6037 CALL_InitNames(ctx
->Exec
, ());
6046 CALL_Lightfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, p
));
6049 case OPCODE_LIGHT_MODEL
:
6056 CALL_LightModelfv(ctx
->Exec
, (n
[1].e
, p
));
6059 case OPCODE_LINE_STIPPLE
:
6060 CALL_LineStipple(ctx
->Exec
, (n
[1].i
, n
[2].us
));
6062 case OPCODE_LINE_WIDTH
:
6063 CALL_LineWidth(ctx
->Exec
, (n
[1].f
));
6065 case OPCODE_LIST_BASE
:
6066 CALL_ListBase(ctx
->Exec
, (n
[1].ui
));
6068 case OPCODE_LOAD_IDENTITY
:
6069 CALL_LoadIdentity(ctx
->Exec
, ());
6071 case OPCODE_LOAD_MATRIX
:
6072 if (sizeof(Node
) == sizeof(GLfloat
)) {
6073 CALL_LoadMatrixf(ctx
->Exec
, (&n
[1].f
));
6078 for (i
= 0; i
< 16; i
++) {
6081 CALL_LoadMatrixf(ctx
->Exec
, (m
));
6084 case OPCODE_LOAD_NAME
:
6085 CALL_LoadName(ctx
->Exec
, (n
[1].ui
));
6087 case OPCODE_LOGIC_OP
:
6088 CALL_LogicOp(ctx
->Exec
, (n
[1].e
));
6092 GLenum target
= n
[1].e
;
6093 GLint ustride
= _mesa_evaluator_components(target
);
6094 GLint uorder
= n
[5].i
;
6095 GLfloat u1
= n
[2].f
;
6096 GLfloat u2
= n
[3].f
;
6097 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
6098 (GLfloat
*) n
[6].data
));
6103 GLenum target
= n
[1].e
;
6104 GLfloat u1
= n
[2].f
;
6105 GLfloat u2
= n
[3].f
;
6106 GLfloat v1
= n
[4].f
;
6107 GLfloat v2
= n
[5].f
;
6108 GLint ustride
= n
[6].i
;
6109 GLint vstride
= n
[7].i
;
6110 GLint uorder
= n
[8].i
;
6111 GLint vorder
= n
[9].i
;
6112 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
6113 v1
, v2
, vstride
, vorder
,
6114 (GLfloat
*) n
[10].data
));
6117 case OPCODE_MAPGRID1
:
6118 CALL_MapGrid1f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
6120 case OPCODE_MAPGRID2
:
6121 CALL_MapGrid2f(ctx
->Exec
,
6122 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
));
6124 case OPCODE_MATRIX_MODE
:
6125 CALL_MatrixMode(ctx
->Exec
, (n
[1].e
));
6127 case OPCODE_MIN_MAX
:
6128 CALL_Minmax(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].b
));
6130 case OPCODE_MULT_MATRIX
:
6131 if (sizeof(Node
) == sizeof(GLfloat
)) {
6132 CALL_MultMatrixf(ctx
->Exec
, (&n
[1].f
));
6137 for (i
= 0; i
< 16; i
++) {
6140 CALL_MultMatrixf(ctx
->Exec
, (m
));
6144 CALL_Ortho(ctx
->Exec
,
6145 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
6147 case OPCODE_PASSTHROUGH
:
6148 CALL_PassThrough(ctx
->Exec
, (n
[1].f
));
6150 case OPCODE_PIXEL_MAP
:
6151 CALL_PixelMapfv(ctx
->Exec
,
6152 (n
[1].e
, n
[2].i
, (GLfloat
*) n
[3].data
));
6154 case OPCODE_PIXEL_TRANSFER
:
6155 CALL_PixelTransferf(ctx
->Exec
, (n
[1].e
, n
[2].f
));
6157 case OPCODE_PIXEL_ZOOM
:
6158 CALL_PixelZoom(ctx
->Exec
, (n
[1].f
, n
[2].f
));
6160 case OPCODE_POINT_SIZE
:
6161 CALL_PointSize(ctx
->Exec
, (n
[1].f
));
6163 case OPCODE_POINT_PARAMETERS
:
6169 CALL_PointParameterfvEXT(ctx
->Exec
, (n
[1].e
, params
));
6172 case OPCODE_POLYGON_MODE
:
6173 CALL_PolygonMode(ctx
->Exec
, (n
[1].e
, n
[2].e
));
6175 case OPCODE_POLYGON_STIPPLE
:
6177 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6178 ctx
->Unpack
= ctx
->DefaultPacking
;
6179 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) n
[1].data
));
6180 ctx
->Unpack
= save
; /* restore */
6183 case OPCODE_POLYGON_OFFSET
:
6184 CALL_PolygonOffset(ctx
->Exec
, (n
[1].f
, n
[2].f
));
6186 case OPCODE_POP_ATTRIB
:
6187 CALL_PopAttrib(ctx
->Exec
, ());
6189 case OPCODE_POP_MATRIX
:
6190 CALL_PopMatrix(ctx
->Exec
, ());
6192 case OPCODE_POP_NAME
:
6193 CALL_PopName(ctx
->Exec
, ());
6195 case OPCODE_PRIORITIZE_TEXTURE
:
6196 CALL_PrioritizeTextures(ctx
->Exec
, (1, &n
[1].ui
, &n
[2].f
));
6198 case OPCODE_PUSH_ATTRIB
:
6199 CALL_PushAttrib(ctx
->Exec
, (n
[1].bf
));
6201 case OPCODE_PUSH_MATRIX
:
6202 CALL_PushMatrix(ctx
->Exec
, ());
6204 case OPCODE_PUSH_NAME
:
6205 CALL_PushName(ctx
->Exec
, (n
[1].ui
));
6207 case OPCODE_RASTER_POS
:
6208 CALL_RasterPos4f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
6210 case OPCODE_READ_BUFFER
:
6211 CALL_ReadBuffer(ctx
->Exec
, (n
[1].e
));
6213 case OPCODE_RESET_HISTOGRAM
:
6214 CALL_ResetHistogram(ctx
->Exec
, (n
[1].e
));
6216 case OPCODE_RESET_MIN_MAX
:
6217 CALL_ResetMinmax(ctx
->Exec
, (n
[1].e
));
6220 CALL_Rotatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
6223 CALL_Scalef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
6225 case OPCODE_SCISSOR
:
6226 CALL_Scissor(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
6228 case OPCODE_SHADE_MODEL
:
6229 CALL_ShadeModel(ctx
->Exec
, (n
[1].e
));
6231 case OPCODE_STENCIL_FUNC
:
6232 CALL_StencilFunc(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].ui
));
6234 case OPCODE_STENCIL_MASK
:
6235 CALL_StencilMask(ctx
->Exec
, (n
[1].ui
));
6237 case OPCODE_STENCIL_OP
:
6238 CALL_StencilOp(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].e
));
6240 case OPCODE_STENCIL_FUNC_SEPARATE
:
6241 CALL_StencilFuncSeparate(ctx
->Exec
,
6242 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].ui
));
6244 case OPCODE_STENCIL_MASK_SEPARATE
:
6245 CALL_StencilMaskSeparate(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
6247 case OPCODE_STENCIL_OP_SEPARATE
:
6248 CALL_StencilOpSeparate(ctx
->Exec
,
6249 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
6258 CALL_TexEnvfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
6268 CALL_TexGenfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
6271 case OPCODE_TEXPARAMETER
:
6278 CALL_TexParameterfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
6281 case OPCODE_TEX_IMAGE1D
:
6283 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6284 ctx
->Unpack
= ctx
->DefaultPacking
;
6285 CALL_TexImage1D(ctx
->Exec
, (n
[1].e
, /* target */
6287 n
[3].i
, /* components */
6289 n
[5].e
, /* border */
6290 n
[6].e
, /* format */
6293 ctx
->Unpack
= save
; /* restore */
6296 case OPCODE_TEX_IMAGE2D
:
6298 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6299 ctx
->Unpack
= ctx
->DefaultPacking
;
6300 CALL_TexImage2D(ctx
->Exec
, (n
[1].e
, /* target */
6302 n
[3].i
, /* components */
6304 n
[5].i
, /* height */
6305 n
[6].e
, /* border */
6306 n
[7].e
, /* format */
6309 ctx
->Unpack
= save
; /* restore */
6312 case OPCODE_TEX_IMAGE3D
:
6314 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6315 ctx
->Unpack
= ctx
->DefaultPacking
;
6316 CALL_TexImage3D(ctx
->Exec
, (n
[1].e
, /* target */
6318 n
[3].i
, /* components */
6320 n
[5].i
, /* height */
6322 n
[7].e
, /* border */
6323 n
[8].e
, /* format */
6326 ctx
->Unpack
= save
; /* restore */
6329 case OPCODE_TEX_SUB_IMAGE1D
:
6331 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6332 ctx
->Unpack
= ctx
->DefaultPacking
;
6333 CALL_TexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
6335 n
[6].e
, n
[7].data
));
6336 ctx
->Unpack
= save
; /* restore */
6339 case OPCODE_TEX_SUB_IMAGE2D
:
6341 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6342 ctx
->Unpack
= ctx
->DefaultPacking
;
6343 CALL_TexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
6345 n
[6].i
, n
[7].e
, n
[8].e
,
6347 ctx
->Unpack
= save
; /* restore */
6350 case OPCODE_TEX_SUB_IMAGE3D
:
6352 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6353 ctx
->Unpack
= ctx
->DefaultPacking
;
6354 CALL_TexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
6355 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
6356 n
[8].i
, n
[9].e
, n
[10].e
,
6358 ctx
->Unpack
= save
; /* restore */
6361 case OPCODE_TRANSLATE
:
6362 CALL_Translatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
6364 case OPCODE_VIEWPORT
:
6365 CALL_Viewport(ctx
->Exec
, (n
[1].i
, n
[2].i
,
6366 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
));
6368 case OPCODE_WINDOW_POS
:
6369 CALL_WindowPos4fMESA(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
6371 case OPCODE_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
6372 CALL_ActiveTextureARB(ctx
->Exec
, (n
[1].e
));
6374 case OPCODE_COMPRESSED_TEX_IMAGE_1D
: /* GL_ARB_texture_compression */
6375 CALL_CompressedTexImage1DARB(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
6376 n
[4].i
, n
[5].i
, n
[6].i
,
6379 case OPCODE_COMPRESSED_TEX_IMAGE_2D
: /* GL_ARB_texture_compression */
6380 CALL_CompressedTexImage2DARB(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
6381 n
[4].i
, n
[5].i
, n
[6].i
,
6382 n
[7].i
, n
[8].data
));
6384 case OPCODE_COMPRESSED_TEX_IMAGE_3D
: /* GL_ARB_texture_compression */
6385 CALL_CompressedTexImage3DARB(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
6386 n
[4].i
, n
[5].i
, n
[6].i
,
6390 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
: /* GL_ARB_texture_compress */
6391 CALL_CompressedTexSubImage1DARB(ctx
->Exec
,
6392 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
6393 n
[5].e
, n
[6].i
, n
[7].data
));
6395 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
: /* GL_ARB_texture_compress */
6396 CALL_CompressedTexSubImage2DARB(ctx
->Exec
,
6397 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
6398 n
[5].i
, n
[6].i
, n
[7].e
, n
[8].i
,
6401 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
: /* GL_ARB_texture_compress */
6402 CALL_CompressedTexSubImage3DARB(ctx
->Exec
,
6403 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
6404 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
6405 n
[9].e
, n
[10].i
, n
[11].data
));
6407 case OPCODE_SAMPLE_COVERAGE
: /* GL_ARB_multisample */
6408 CALL_SampleCoverageARB(ctx
->Exec
, (n
[1].f
, n
[2].b
));
6410 case OPCODE_WINDOW_POS_ARB
: /* GL_ARB_window_pos */
6411 CALL_WindowPos3fMESA(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
6413 #if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
6414 case OPCODE_BIND_PROGRAM_NV
: /* GL_NV_vertex_program */
6415 CALL_BindProgramNV(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
6418 #if FEATURE_NV_vertex_program
6419 case OPCODE_EXECUTE_PROGRAM_NV
:
6426 CALL_ExecuteProgramNV(ctx
->Exec
, (n
[1].e
, n
[2].ui
, v
));
6429 case OPCODE_REQUEST_RESIDENT_PROGRAMS_NV
:
6430 CALL_RequestResidentProgramsNV(ctx
->Exec
, (n
[1].ui
,
6431 (GLuint
*) n
[2].data
));
6433 case OPCODE_LOAD_PROGRAM_NV
:
6434 CALL_LoadProgramNV(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].i
,
6435 (const GLubyte
*) n
[4].data
));
6437 case OPCODE_TRACK_MATRIX_NV
:
6438 CALL_TrackMatrixNV(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].e
, n
[4].e
));
6442 #if FEATURE_NV_fragment_program
6443 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
:
6444 CALL_ProgramLocalParameter4fARB(ctx
->Exec
,
6445 (n
[1].e
, n
[2].ui
, n
[3].f
, n
[4].f
,
6448 case OPCODE_PROGRAM_NAMED_PARAMETER_NV
:
6449 CALL_ProgramNamedParameter4fNV(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
6450 (const GLubyte
*) n
[3].
6451 data
, n
[4].f
, n
[5].f
,
6456 case OPCODE_ACTIVE_STENCIL_FACE_EXT
:
6457 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (n
[1].e
));
6459 case OPCODE_DEPTH_BOUNDS_EXT
:
6460 CALL_DepthBoundsEXT(ctx
->Exec
, (n
[1].f
, n
[2].f
));
6462 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
6463 case OPCODE_PROGRAM_STRING_ARB
:
6464 CALL_ProgramStringARB(ctx
->Exec
,
6465 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].data
));
6468 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program || FEATURE_NV_vertex_program
6469 case OPCODE_PROGRAM_ENV_PARAMETER_ARB
:
6470 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].f
,
6475 #if FEATURE_ARB_occlusion_query
6476 case OPCODE_BEGIN_QUERY_ARB
:
6477 CALL_BeginQueryARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
6479 case OPCODE_END_QUERY_ARB
:
6480 CALL_EndQueryARB(ctx
->Exec
, (n
[1].e
));
6483 case OPCODE_DRAW_BUFFERS_ARB
:
6485 GLenum buffers
[MAX_DRAW_BUFFERS
];
6486 GLint i
, count
= MIN2(n
[1].i
, MAX_DRAW_BUFFERS
);
6487 for (i
= 0; i
< count
; i
++)
6488 buffers
[i
] = n
[2 + i
].e
;
6489 CALL_DrawBuffersARB(ctx
->Exec
, (n
[1].i
, buffers
));
6492 #if FEATURE_EXT_framebuffer_blit
6493 case OPCODE_BLIT_FRAMEBUFFER
:
6494 CALL_BlitFramebufferEXT(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
,
6495 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
6499 #if FEATURE_ATI_fragment_shader
6500 case OPCODE_BIND_FRAGMENT_SHADER_ATI
:
6501 CALL_BindFragmentShaderATI(ctx
->Exec
, (n
[1].i
));
6503 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
:
6506 GLuint i
, dst
= n
[1].ui
;
6508 for (i
= 0; i
< 4; i
++)
6509 values
[i
] = n
[1 + i
].f
;
6510 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, values
));
6514 case OPCODE_ATTR_1F_NV
:
6515 CALL_VertexAttrib1fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
));
6517 case OPCODE_ATTR_2F_NV
:
6518 /* Really shouldn't have to do this - the Node structure
6519 * is convenient, but it would be better to store the data
6520 * packed appropriately so that it can be sent directly
6521 * on. With x86_64 becoming common, this will start to
6524 if (sizeof(Node
) == sizeof(GLfloat
))
6525 CALL_VertexAttrib2fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6527 CALL_VertexAttrib2fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
));
6529 case OPCODE_ATTR_3F_NV
:
6530 if (sizeof(Node
) == sizeof(GLfloat
))
6531 CALL_VertexAttrib3fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6533 CALL_VertexAttrib3fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
6536 case OPCODE_ATTR_4F_NV
:
6537 if (sizeof(Node
) == sizeof(GLfloat
))
6538 CALL_VertexAttrib4fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6540 CALL_VertexAttrib4fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
6543 case OPCODE_ATTR_1F_ARB
:
6544 CALL_VertexAttrib1fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
));
6546 case OPCODE_ATTR_2F_ARB
:
6547 /* Really shouldn't have to do this - the Node structure
6548 * is convenient, but it would be better to store the data
6549 * packed appropriately so that it can be sent directly
6550 * on. With x86_64 becoming common, this will start to
6553 if (sizeof(Node
) == sizeof(GLfloat
))
6554 CALL_VertexAttrib2fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6556 CALL_VertexAttrib2fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
));
6558 case OPCODE_ATTR_3F_ARB
:
6559 if (sizeof(Node
) == sizeof(GLfloat
))
6560 CALL_VertexAttrib3fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6562 CALL_VertexAttrib3fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
6565 case OPCODE_ATTR_4F_ARB
:
6566 if (sizeof(Node
) == sizeof(GLfloat
))
6567 CALL_VertexAttrib4fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
6569 CALL_VertexAttrib4fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
6572 case OPCODE_MATERIAL
:
6573 if (sizeof(Node
) == sizeof(GLfloat
))
6574 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, &n
[3].f
));
6581 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, f
));
6585 CALL_Begin(ctx
->Exec
, (n
[1].e
));
6588 CALL_End(ctx
->Exec
, ());
6591 CALL_Rectf(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
6593 case OPCODE_EVAL_C1
:
6594 CALL_EvalCoord1f(ctx
->Exec
, (n
[1].f
));
6596 case OPCODE_EVAL_C2
:
6597 CALL_EvalCoord2f(ctx
->Exec
, (n
[1].f
, n
[2].f
));
6599 case OPCODE_EVAL_P1
:
6600 CALL_EvalPoint1(ctx
->Exec
, (n
[1].i
));
6602 case OPCODE_EVAL_P2
:
6603 CALL_EvalPoint2(ctx
->Exec
, (n
[1].i
, n
[2].i
));
6606 case OPCODE_CONTINUE
:
6607 n
= (Node
*) n
[1].next
;
6609 case OPCODE_END_OF_LIST
:
6615 _mesa_sprintf(msg
, "Error in execute_list: opcode=%d",
6617 _mesa_problem(ctx
, msg
);
6622 /* increment n to point to next compiled command */
6623 if (opcode
!= OPCODE_CONTINUE
) {
6624 n
+= InstSize
[opcode
];
6629 if (ctx
->Driver
.EndCallList
)
6630 ctx
->Driver
.EndCallList(ctx
);
6632 ctx
->ListState
.CallDepth
--;
6637 /**********************************************************************/
6639 /**********************************************************************/
6642 * Test if a display list number is valid.
6644 GLboolean GLAPIENTRY
6645 _mesa_IsList(GLuint list
)
6647 GET_CURRENT_CONTEXT(ctx
);
6648 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
6649 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
6650 return islist(ctx
, list
);
6655 * Delete a sequence of consecutive display lists.
6658 _mesa_DeleteLists(GLuint list
, GLsizei range
)
6660 GET_CURRENT_CONTEXT(ctx
);
6662 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
6663 ASSERT_OUTSIDE_BEGIN_END(ctx
);
6666 _mesa_error(ctx
, GL_INVALID_VALUE
, "glDeleteLists");
6669 for (i
= list
; i
< list
+ range
; i
++) {
6670 destroy_list(ctx
, i
);
6676 * Return a display list number, n, such that lists n through n+range-1
6680 _mesa_GenLists(GLsizei range
)
6682 GET_CURRENT_CONTEXT(ctx
);
6684 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
6685 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, 0);
6688 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGenLists");
6696 * Make this an atomic operation
6698 _glthread_LOCK_MUTEX(ctx
->Shared
->Mutex
);
6700 base
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
6702 /* reserve the list IDs by with empty/dummy lists */
6704 for (i
= 0; i
< range
; i
++) {
6705 _mesa_HashInsert(ctx
->Shared
->DisplayList
, base
+ i
,
6706 make_list(base
+ i
, 1));
6710 _glthread_UNLOCK_MUTEX(ctx
->Shared
->Mutex
);
6717 * Begin a new display list.
6720 _mesa_NewList(GLuint list
, GLenum mode
)
6722 GET_CURRENT_CONTEXT(ctx
);
6725 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
6726 ASSERT_OUTSIDE_BEGIN_END(ctx
);
6728 if (MESA_VERBOSE
& VERBOSE_API
)
6729 _mesa_debug(ctx
, "glNewList %u %s\n", list
,
6730 _mesa_lookup_enum_by_nr(mode
));
6733 _mesa_error(ctx
, GL_INVALID_VALUE
, "glNewList");
6737 if (mode
!= GL_COMPILE
&& mode
!= GL_COMPILE_AND_EXECUTE
) {
6738 _mesa_error(ctx
, GL_INVALID_ENUM
, "glNewList");
6742 if (ctx
->ListState
.CurrentListPtr
) {
6743 /* already compiling a display list */
6744 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
6748 ctx
->CompileFlag
= GL_TRUE
;
6749 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
6751 /* Allocate new display list */
6752 ctx
->ListState
.CurrentListNum
= list
;
6753 ctx
->ListState
.CurrentList
= make_list(list
, BLOCK_SIZE
);
6754 ctx
->ListState
.CurrentBlock
= ctx
->ListState
.CurrentList
->node
;
6755 ctx
->ListState
.CurrentListPtr
= ctx
->ListState
.CurrentBlock
;
6756 ctx
->ListState
.CurrentPos
= 0;
6758 /* Reset acumulated list state:
6760 for (i
= 0; i
< VERT_ATTRIB_MAX
; i
++)
6761 ctx
->ListState
.ActiveAttribSize
[i
] = 0;
6763 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++)
6764 ctx
->ListState
.ActiveMaterialSize
[i
] = 0;
6766 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
6767 ctx
->Driver
.NewList(ctx
, list
, mode
);
6769 ctx
->CurrentDispatch
= ctx
->Save
;
6770 _glapi_set_dispatch(ctx
->CurrentDispatch
);
6775 * End definition of current display list.
6780 GET_CURRENT_CONTEXT(ctx
);
6781 SAVE_FLUSH_VERTICES(ctx
);
6782 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
6784 if (MESA_VERBOSE
& VERBOSE_API
)
6785 _mesa_debug(ctx
, "glEndList\n");
6787 /* Check that a list is under construction */
6788 if (!ctx
->ListState
.CurrentListPtr
) {
6789 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glEndList");
6793 /* Call before emitting END_OF_LIST, in case the driver wants to
6794 * emit opcodes itself.
6796 ctx
->Driver
.EndList(ctx
);
6798 (void) ALLOC_INSTRUCTION(ctx
, OPCODE_END_OF_LIST
, 0);
6800 /* Destroy old list, if any */
6801 destroy_list(ctx
, ctx
->ListState
.CurrentListNum
);
6802 /* Install the list */
6803 _mesa_HashInsert(ctx
->Shared
->DisplayList
, ctx
->ListState
.CurrentListNum
,
6804 ctx
->ListState
.CurrentList
);
6807 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
6808 mesa_print_display_list(ctx
->ListState
.CurrentListNum
);
6810 ctx
->ListState
.CurrentList
= NULL
;
6811 ctx
->ListState
.CurrentListNum
= 0;
6812 ctx
->ListState
.CurrentListPtr
= NULL
;
6813 ctx
->ExecuteFlag
= GL_TRUE
;
6814 ctx
->CompileFlag
= GL_FALSE
;
6816 ctx
->CurrentDispatch
= ctx
->Exec
;
6817 _glapi_set_dispatch(ctx
->CurrentDispatch
);
6822 _mesa_CallList(GLuint list
)
6824 GLboolean save_compile_flag
;
6825 GET_CURRENT_CONTEXT(ctx
);
6826 FLUSH_CURRENT(ctx
, 0);
6827 /* VERY IMPORTANT: Save the CompileFlag status, turn it off, */
6828 /* execute the display list, and restore the CompileFlag. */
6830 if (MESA_VERBOSE
& VERBOSE_API
)
6831 _mesa_debug(ctx
, "glCallList %d\n", list
);
6834 _mesa_error(ctx
, GL_INVALID_VALUE
, "glCallList(list==0)");
6838 /* mesa_print_display_list( list ); */
6840 save_compile_flag
= ctx
->CompileFlag
;
6841 if (save_compile_flag
) {
6842 ctx
->CompileFlag
= GL_FALSE
;
6845 execute_list(ctx
, list
);
6846 ctx
->CompileFlag
= save_compile_flag
;
6848 /* also restore API function pointers to point to "save" versions */
6849 if (save_compile_flag
) {
6850 ctx
->CurrentDispatch
= ctx
->Save
;
6851 _glapi_set_dispatch(ctx
->CurrentDispatch
);
6857 * Execute glCallLists: call multiple display lists.
6860 _mesa_CallLists(GLsizei n
, GLenum type
, const GLvoid
* lists
)
6862 GET_CURRENT_CONTEXT(ctx
);
6864 GLboolean save_compile_flag
;
6866 if (MESA_VERBOSE
& VERBOSE_API
)
6867 _mesa_debug(ctx
, "glCallLists %d\n", n
);
6871 case GL_UNSIGNED_BYTE
:
6873 case GL_UNSIGNED_SHORT
:
6875 case GL_UNSIGNED_INT
:
6883 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
6887 /* Save the CompileFlag status, turn it off, execute display list,
6888 * and restore the CompileFlag.
6890 save_compile_flag
= ctx
->CompileFlag
;
6891 ctx
->CompileFlag
= GL_FALSE
;
6893 for (i
= 0; i
< n
; i
++) {
6894 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ translate_id(i
, type
, lists
));
6895 execute_list(ctx
, list
);
6898 ctx
->CompileFlag
= save_compile_flag
;
6900 /* also restore API function pointers to point to "save" versions */
6901 if (save_compile_flag
) {
6902 ctx
->CurrentDispatch
= ctx
->Save
;
6903 _glapi_set_dispatch(ctx
->CurrentDispatch
);
6909 * Set the offset added to list numbers in glCallLists.
6912 _mesa_ListBase(GLuint base
)
6914 GET_CURRENT_CONTEXT(ctx
);
6915 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
6916 ASSERT_OUTSIDE_BEGIN_END(ctx
);
6917 ctx
->List
.ListBase
= base
;
6921 /* Can no longer assume ctx->Exec->Func is equal to _mesa_Func.
6923 static void GLAPIENTRY
6926 GET_CURRENT_CONTEXT(ctx
);
6927 FLUSH_VERTICES(ctx
, 0);
6928 CALL_Finish(ctx
->Exec
, ());
6931 static void GLAPIENTRY
6934 GET_CURRENT_CONTEXT(ctx
);
6935 FLUSH_VERTICES(ctx
, 0);
6936 CALL_Flush(ctx
->Exec
, ());
6939 static void GLAPIENTRY
6940 exec_GetBooleanv(GLenum pname
, GLboolean
*params
)
6942 GET_CURRENT_CONTEXT(ctx
);
6943 FLUSH_VERTICES(ctx
, 0);
6944 CALL_GetBooleanv(ctx
->Exec
, (pname
, params
));
6947 static void GLAPIENTRY
6948 exec_GetClipPlane(GLenum plane
, GLdouble
* equation
)
6950 GET_CURRENT_CONTEXT(ctx
);
6951 FLUSH_VERTICES(ctx
, 0);
6952 CALL_GetClipPlane(ctx
->Exec
, (plane
, equation
));
6955 static void GLAPIENTRY
6956 exec_GetDoublev(GLenum pname
, GLdouble
*params
)
6958 GET_CURRENT_CONTEXT(ctx
);
6959 FLUSH_VERTICES(ctx
, 0);
6960 CALL_GetDoublev(ctx
->Exec
, (pname
, params
));
6963 static GLenum GLAPIENTRY
6966 GET_CURRENT_CONTEXT(ctx
);
6967 FLUSH_VERTICES(ctx
, 0);
6968 return CALL_GetError(ctx
->Exec
, ());
6971 static void GLAPIENTRY
6972 exec_GetFloatv(GLenum pname
, GLfloat
*params
)
6974 GET_CURRENT_CONTEXT(ctx
);
6975 FLUSH_VERTICES(ctx
, 0);
6976 CALL_GetFloatv(ctx
->Exec
, (pname
, params
));
6979 static void GLAPIENTRY
6980 exec_GetIntegerv(GLenum pname
, GLint
*params
)
6982 GET_CURRENT_CONTEXT(ctx
);
6983 FLUSH_VERTICES(ctx
, 0);
6984 CALL_GetIntegerv(ctx
->Exec
, (pname
, params
));
6987 static void GLAPIENTRY
6988 exec_GetLightfv(GLenum light
, GLenum pname
, GLfloat
*params
)
6990 GET_CURRENT_CONTEXT(ctx
);
6991 FLUSH_VERTICES(ctx
, 0);
6992 CALL_GetLightfv(ctx
->Exec
, (light
, pname
, params
));
6995 static void GLAPIENTRY
6996 exec_GetLightiv(GLenum light
, GLenum pname
, GLint
*params
)
6998 GET_CURRENT_CONTEXT(ctx
);
6999 FLUSH_VERTICES(ctx
, 0);
7000 CALL_GetLightiv(ctx
->Exec
, (light
, pname
, params
));
7003 static void GLAPIENTRY
7004 exec_GetMapdv(GLenum target
, GLenum query
, GLdouble
* v
)
7006 GET_CURRENT_CONTEXT(ctx
);
7007 FLUSH_VERTICES(ctx
, 0);
7008 CALL_GetMapdv(ctx
->Exec
, (target
, query
, v
));
7011 static void GLAPIENTRY
7012 exec_GetMapfv(GLenum target
, GLenum query
, GLfloat
* v
)
7014 GET_CURRENT_CONTEXT(ctx
);
7015 FLUSH_VERTICES(ctx
, 0);
7016 CALL_GetMapfv(ctx
->Exec
, (target
, query
, v
));
7019 static void GLAPIENTRY
7020 exec_GetMapiv(GLenum target
, GLenum query
, GLint
* v
)
7022 GET_CURRENT_CONTEXT(ctx
);
7023 FLUSH_VERTICES(ctx
, 0);
7024 CALL_GetMapiv(ctx
->Exec
, (target
, query
, v
));
7027 static void GLAPIENTRY
7028 exec_GetMaterialfv(GLenum face
, GLenum pname
, GLfloat
*params
)
7030 GET_CURRENT_CONTEXT(ctx
);
7031 FLUSH_VERTICES(ctx
, 0);
7032 CALL_GetMaterialfv(ctx
->Exec
, (face
, pname
, params
));
7035 static void GLAPIENTRY
7036 exec_GetMaterialiv(GLenum face
, GLenum pname
, GLint
*params
)
7038 GET_CURRENT_CONTEXT(ctx
);
7039 FLUSH_VERTICES(ctx
, 0);
7040 CALL_GetMaterialiv(ctx
->Exec
, (face
, pname
, params
));
7043 static void GLAPIENTRY
7044 exec_GetPixelMapfv(GLenum map
, GLfloat
*values
)
7046 GET_CURRENT_CONTEXT(ctx
);
7047 FLUSH_VERTICES(ctx
, 0);
7048 CALL_GetPixelMapfv(ctx
->Exec
, (map
, values
));
7051 static void GLAPIENTRY
7052 exec_GetPixelMapuiv(GLenum map
, GLuint
*values
)
7054 GET_CURRENT_CONTEXT(ctx
);
7055 FLUSH_VERTICES(ctx
, 0);
7056 CALL_GetPixelMapuiv(ctx
->Exec
, (map
, values
));
7059 static void GLAPIENTRY
7060 exec_GetPixelMapusv(GLenum map
, GLushort
*values
)
7062 GET_CURRENT_CONTEXT(ctx
);
7063 FLUSH_VERTICES(ctx
, 0);
7064 CALL_GetPixelMapusv(ctx
->Exec
, (map
, values
));
7067 static void GLAPIENTRY
7068 exec_GetPolygonStipple(GLubyte
* dest
)
7070 GET_CURRENT_CONTEXT(ctx
);
7071 FLUSH_VERTICES(ctx
, 0);
7072 CALL_GetPolygonStipple(ctx
->Exec
, (dest
));
7075 static const GLubyte
*GLAPIENTRY
7076 exec_GetString(GLenum name
)
7078 GET_CURRENT_CONTEXT(ctx
);
7079 FLUSH_VERTICES(ctx
, 0);
7080 return CALL_GetString(ctx
->Exec
, (name
));
7083 static void GLAPIENTRY
7084 exec_GetTexEnvfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7086 GET_CURRENT_CONTEXT(ctx
);
7087 FLUSH_VERTICES(ctx
, 0);
7088 CALL_GetTexEnvfv(ctx
->Exec
, (target
, pname
, params
));
7091 static void GLAPIENTRY
7092 exec_GetTexEnviv(GLenum target
, GLenum pname
, GLint
*params
)
7094 GET_CURRENT_CONTEXT(ctx
);
7095 FLUSH_VERTICES(ctx
, 0);
7096 CALL_GetTexEnviv(ctx
->Exec
, (target
, pname
, params
));
7099 static void GLAPIENTRY
7100 exec_GetTexGendv(GLenum coord
, GLenum pname
, GLdouble
*params
)
7102 GET_CURRENT_CONTEXT(ctx
);
7103 FLUSH_VERTICES(ctx
, 0);
7104 CALL_GetTexGendv(ctx
->Exec
, (coord
, pname
, params
));
7107 static void GLAPIENTRY
7108 exec_GetTexGenfv(GLenum coord
, GLenum pname
, GLfloat
*params
)
7110 GET_CURRENT_CONTEXT(ctx
);
7111 FLUSH_VERTICES(ctx
, 0);
7112 CALL_GetTexGenfv(ctx
->Exec
, (coord
, pname
, params
));
7115 static void GLAPIENTRY
7116 exec_GetTexGeniv(GLenum coord
, GLenum pname
, GLint
*params
)
7118 GET_CURRENT_CONTEXT(ctx
);
7119 FLUSH_VERTICES(ctx
, 0);
7120 CALL_GetTexGeniv(ctx
->Exec
, (coord
, pname
, params
));
7123 static void GLAPIENTRY
7124 exec_GetTexImage(GLenum target
, GLint level
, GLenum format
,
7125 GLenum type
, GLvoid
* pixels
)
7127 GET_CURRENT_CONTEXT(ctx
);
7128 FLUSH_VERTICES(ctx
, 0);
7129 CALL_GetTexImage(ctx
->Exec
, (target
, level
, format
, type
, pixels
));
7132 static void GLAPIENTRY
7133 exec_GetTexLevelParameterfv(GLenum target
, GLint level
,
7134 GLenum pname
, GLfloat
*params
)
7136 GET_CURRENT_CONTEXT(ctx
);
7137 FLUSH_VERTICES(ctx
, 0);
7138 CALL_GetTexLevelParameterfv(ctx
->Exec
, (target
, level
, pname
, params
));
7141 static void GLAPIENTRY
7142 exec_GetTexLevelParameteriv(GLenum target
, GLint level
,
7143 GLenum pname
, GLint
*params
)
7145 GET_CURRENT_CONTEXT(ctx
);
7146 FLUSH_VERTICES(ctx
, 0);
7147 CALL_GetTexLevelParameteriv(ctx
->Exec
, (target
, level
, pname
, params
));
7150 static void GLAPIENTRY
7151 exec_GetTexParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7153 GET_CURRENT_CONTEXT(ctx
);
7154 FLUSH_VERTICES(ctx
, 0);
7155 CALL_GetTexParameterfv(ctx
->Exec
, (target
, pname
, params
));
7158 static void GLAPIENTRY
7159 exec_GetTexParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7161 GET_CURRENT_CONTEXT(ctx
);
7162 FLUSH_VERTICES(ctx
, 0);
7163 CALL_GetTexParameteriv(ctx
->Exec
, (target
, pname
, params
));
7166 static GLboolean GLAPIENTRY
7167 exec_IsEnabled(GLenum cap
)
7169 GET_CURRENT_CONTEXT(ctx
);
7170 FLUSH_VERTICES(ctx
, 0);
7171 return CALL_IsEnabled(ctx
->Exec
, (cap
));
7174 static void GLAPIENTRY
7175 exec_PixelStoref(GLenum pname
, GLfloat param
)
7177 GET_CURRENT_CONTEXT(ctx
);
7178 FLUSH_VERTICES(ctx
, 0);
7179 CALL_PixelStoref(ctx
->Exec
, (pname
, param
));
7182 static void GLAPIENTRY
7183 exec_PixelStorei(GLenum pname
, GLint param
)
7185 GET_CURRENT_CONTEXT(ctx
);
7186 FLUSH_VERTICES(ctx
, 0);
7187 CALL_PixelStorei(ctx
->Exec
, (pname
, param
));
7190 static void GLAPIENTRY
7191 exec_ReadPixels(GLint x
, GLint y
, GLsizei width
, GLsizei height
,
7192 GLenum format
, GLenum type
, GLvoid
* pixels
)
7194 GET_CURRENT_CONTEXT(ctx
);
7195 FLUSH_VERTICES(ctx
, 0);
7196 CALL_ReadPixels(ctx
->Exec
, (x
, y
, width
, height
, format
, type
, pixels
));
7199 static GLint GLAPIENTRY
7200 exec_RenderMode(GLenum mode
)
7202 GET_CURRENT_CONTEXT(ctx
);
7203 FLUSH_VERTICES(ctx
, 0);
7204 return CALL_RenderMode(ctx
->Exec
, (mode
));
7207 static void GLAPIENTRY
7208 exec_FeedbackBuffer(GLsizei size
, GLenum type
, GLfloat
* buffer
)
7210 GET_CURRENT_CONTEXT(ctx
);
7211 FLUSH_VERTICES(ctx
, 0);
7212 CALL_FeedbackBuffer(ctx
->Exec
, (size
, type
, buffer
));
7215 static void GLAPIENTRY
7216 exec_SelectBuffer(GLsizei size
, GLuint
* buffer
)
7218 GET_CURRENT_CONTEXT(ctx
);
7219 FLUSH_VERTICES(ctx
, 0);
7220 CALL_SelectBuffer(ctx
->Exec
, (size
, buffer
));
7223 static GLboolean GLAPIENTRY
7224 exec_AreTexturesResident(GLsizei n
, const GLuint
* texName
,
7225 GLboolean
* residences
)
7227 GET_CURRENT_CONTEXT(ctx
);
7228 FLUSH_VERTICES(ctx
, 0);
7229 return CALL_AreTexturesResident(ctx
->Exec
, (n
, texName
, residences
));
7232 static void GLAPIENTRY
7233 exec_ColorPointer(GLint size
, GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
7235 GET_CURRENT_CONTEXT(ctx
);
7236 FLUSH_VERTICES(ctx
, 0);
7237 CALL_ColorPointer(ctx
->Exec
, (size
, type
, stride
, ptr
));
7240 static void GLAPIENTRY
7241 exec_DeleteTextures(GLsizei n
, const GLuint
* texName
)
7243 GET_CURRENT_CONTEXT(ctx
);
7244 FLUSH_VERTICES(ctx
, 0);
7245 CALL_DeleteTextures(ctx
->Exec
, (n
, texName
));
7248 static void GLAPIENTRY
7249 exec_DisableClientState(GLenum cap
)
7251 GET_CURRENT_CONTEXT(ctx
);
7252 FLUSH_VERTICES(ctx
, 0);
7253 CALL_DisableClientState(ctx
->Exec
, (cap
));
7256 static void GLAPIENTRY
7257 exec_EdgeFlagPointer(GLsizei stride
, const GLvoid
* vptr
)
7259 GET_CURRENT_CONTEXT(ctx
);
7260 FLUSH_VERTICES(ctx
, 0);
7261 CALL_EdgeFlagPointer(ctx
->Exec
, (stride
, vptr
));
7264 static void GLAPIENTRY
7265 exec_EnableClientState(GLenum cap
)
7267 GET_CURRENT_CONTEXT(ctx
);
7268 FLUSH_VERTICES(ctx
, 0);
7269 CALL_EnableClientState(ctx
->Exec
, (cap
));
7272 static void GLAPIENTRY
7273 exec_GenTextures(GLsizei n
, GLuint
* texName
)
7275 GET_CURRENT_CONTEXT(ctx
);
7276 FLUSH_VERTICES(ctx
, 0);
7277 CALL_GenTextures(ctx
->Exec
, (n
, texName
));
7280 static void GLAPIENTRY
7281 exec_GetPointerv(GLenum pname
, GLvoid
**params
)
7283 GET_CURRENT_CONTEXT(ctx
);
7284 FLUSH_VERTICES(ctx
, 0);
7285 CALL_GetPointerv(ctx
->Exec
, (pname
, params
));
7288 static void GLAPIENTRY
7289 exec_IndexPointer(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
7291 GET_CURRENT_CONTEXT(ctx
);
7292 FLUSH_VERTICES(ctx
, 0);
7293 CALL_IndexPointer(ctx
->Exec
, (type
, stride
, ptr
));
7296 static void GLAPIENTRY
7297 exec_InterleavedArrays(GLenum format
, GLsizei stride
, const GLvoid
* pointer
)
7299 GET_CURRENT_CONTEXT(ctx
);
7300 FLUSH_VERTICES(ctx
, 0);
7301 CALL_InterleavedArrays(ctx
->Exec
, (format
, stride
, pointer
));
7304 static GLboolean GLAPIENTRY
7305 exec_IsTexture(GLuint texture
)
7307 GET_CURRENT_CONTEXT(ctx
);
7308 FLUSH_VERTICES(ctx
, 0);
7309 return CALL_IsTexture(ctx
->Exec
, (texture
));
7312 static void GLAPIENTRY
7313 exec_NormalPointer(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
7315 GET_CURRENT_CONTEXT(ctx
);
7316 FLUSH_VERTICES(ctx
, 0);
7317 CALL_NormalPointer(ctx
->Exec
, (type
, stride
, ptr
));
7320 static void GLAPIENTRY
7321 exec_PopClientAttrib(void)
7323 GET_CURRENT_CONTEXT(ctx
);
7324 FLUSH_VERTICES(ctx
, 0);
7325 CALL_PopClientAttrib(ctx
->Exec
, ());
7328 static void GLAPIENTRY
7329 exec_PushClientAttrib(GLbitfield mask
)
7331 GET_CURRENT_CONTEXT(ctx
);
7332 FLUSH_VERTICES(ctx
, 0);
7333 CALL_PushClientAttrib(ctx
->Exec
, (mask
));
7336 static void GLAPIENTRY
7337 exec_TexCoordPointer(GLint size
, GLenum type
, GLsizei stride
,
7340 GET_CURRENT_CONTEXT(ctx
);
7341 FLUSH_VERTICES(ctx
, 0);
7342 CALL_TexCoordPointer(ctx
->Exec
, (size
, type
, stride
, ptr
));
7345 static void GLAPIENTRY
7346 exec_GetCompressedTexImageARB(GLenum target
, GLint level
, GLvoid
* img
)
7348 GET_CURRENT_CONTEXT(ctx
);
7349 FLUSH_VERTICES(ctx
, 0);
7350 CALL_GetCompressedTexImageARB(ctx
->Exec
, (target
, level
, img
));
7353 static void GLAPIENTRY
7354 exec_VertexPointer(GLint size
, GLenum type
, GLsizei stride
,
7357 GET_CURRENT_CONTEXT(ctx
);
7358 FLUSH_VERTICES(ctx
, 0);
7359 CALL_VertexPointer(ctx
->Exec
, (size
, type
, stride
, ptr
));
7362 static void GLAPIENTRY
7363 exec_CopyConvolutionFilter1D(GLenum target
, GLenum internalFormat
,
7364 GLint x
, GLint y
, GLsizei width
)
7366 GET_CURRENT_CONTEXT(ctx
);
7367 FLUSH_VERTICES(ctx
, 0);
7368 CALL_CopyConvolutionFilter1D(ctx
->Exec
,
7369 (target
, internalFormat
, x
, y
, width
));
7372 static void GLAPIENTRY
7373 exec_CopyConvolutionFilter2D(GLenum target
, GLenum internalFormat
,
7374 GLint x
, GLint y
, GLsizei width
, GLsizei height
)
7376 GET_CURRENT_CONTEXT(ctx
);
7377 FLUSH_VERTICES(ctx
, 0);
7378 CALL_CopyConvolutionFilter2D(ctx
->Exec
,
7379 (target
, internalFormat
, x
, y
, width
,
7383 static void GLAPIENTRY
7384 exec_GetColorTable(GLenum target
, GLenum format
, GLenum type
, GLvoid
* data
)
7386 GET_CURRENT_CONTEXT(ctx
);
7387 FLUSH_VERTICES(ctx
, 0);
7388 CALL_GetColorTable(ctx
->Exec
, (target
, format
, type
, data
));
7391 static void GLAPIENTRY
7392 exec_GetColorTableParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7394 GET_CURRENT_CONTEXT(ctx
);
7395 FLUSH_VERTICES(ctx
, 0);
7396 CALL_GetColorTableParameterfv(ctx
->Exec
, (target
, pname
, params
));
7399 static void GLAPIENTRY
7400 exec_GetColorTableParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7402 GET_CURRENT_CONTEXT(ctx
);
7403 FLUSH_VERTICES(ctx
, 0);
7404 CALL_GetColorTableParameteriv(ctx
->Exec
, (target
, pname
, params
));
7407 static void GLAPIENTRY
7408 exec_GetConvolutionFilter(GLenum target
, GLenum format
, GLenum type
,
7411 GET_CURRENT_CONTEXT(ctx
);
7412 FLUSH_VERTICES(ctx
, 0);
7413 CALL_GetConvolutionFilter(ctx
->Exec
, (target
, format
, type
, image
));
7416 static void GLAPIENTRY
7417 exec_GetConvolutionParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7419 GET_CURRENT_CONTEXT(ctx
);
7420 FLUSH_VERTICES(ctx
, 0);
7421 CALL_GetConvolutionParameterfv(ctx
->Exec
, (target
, pname
, params
));
7424 static void GLAPIENTRY
7425 exec_GetConvolutionParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7427 GET_CURRENT_CONTEXT(ctx
);
7428 FLUSH_VERTICES(ctx
, 0);
7429 CALL_GetConvolutionParameteriv(ctx
->Exec
, (target
, pname
, params
));
7432 static void GLAPIENTRY
7433 exec_GetHistogram(GLenum target
, GLboolean reset
, GLenum format
,
7434 GLenum type
, GLvoid
*values
)
7436 GET_CURRENT_CONTEXT(ctx
);
7437 FLUSH_VERTICES(ctx
, 0);
7438 CALL_GetHistogram(ctx
->Exec
, (target
, reset
, format
, type
, values
));
7441 static void GLAPIENTRY
7442 exec_GetHistogramParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7444 GET_CURRENT_CONTEXT(ctx
);
7445 FLUSH_VERTICES(ctx
, 0);
7446 CALL_GetHistogramParameterfv(ctx
->Exec
, (target
, pname
, params
));
7449 static void GLAPIENTRY
7450 exec_GetHistogramParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7452 GET_CURRENT_CONTEXT(ctx
);
7453 FLUSH_VERTICES(ctx
, 0);
7454 CALL_GetHistogramParameteriv(ctx
->Exec
, (target
, pname
, params
));
7457 static void GLAPIENTRY
7458 exec_GetMinmax(GLenum target
, GLboolean reset
, GLenum format
,
7459 GLenum type
, GLvoid
*values
)
7461 GET_CURRENT_CONTEXT(ctx
);
7462 FLUSH_VERTICES(ctx
, 0);
7463 CALL_GetMinmax(ctx
->Exec
, (target
, reset
, format
, type
, values
));
7466 static void GLAPIENTRY
7467 exec_GetMinmaxParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
7469 GET_CURRENT_CONTEXT(ctx
);
7470 FLUSH_VERTICES(ctx
, 0);
7471 CALL_GetMinmaxParameterfv(ctx
->Exec
, (target
, pname
, params
));
7474 static void GLAPIENTRY
7475 exec_GetMinmaxParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
7477 GET_CURRENT_CONTEXT(ctx
);
7478 FLUSH_VERTICES(ctx
, 0);
7479 CALL_GetMinmaxParameteriv(ctx
->Exec
, (target
, pname
, params
));
7482 static void GLAPIENTRY
7483 exec_GetSeparableFilter(GLenum target
, GLenum format
, GLenum type
,
7484 GLvoid
*row
, GLvoid
*column
, GLvoid
*span
)
7486 GET_CURRENT_CONTEXT(ctx
);
7487 FLUSH_VERTICES(ctx
, 0);
7488 CALL_GetSeparableFilter(ctx
->Exec
,
7489 (target
, format
, type
, row
, column
, span
));
7492 static void GLAPIENTRY
7493 exec_SeparableFilter2D(GLenum target
, GLenum internalFormat
,
7494 GLsizei width
, GLsizei height
, GLenum format
,
7495 GLenum type
, const GLvoid
*row
, const GLvoid
*column
)
7497 GET_CURRENT_CONTEXT(ctx
);
7498 FLUSH_VERTICES(ctx
, 0);
7499 CALL_SeparableFilter2D(ctx
->Exec
,
7500 (target
, internalFormat
, width
, height
, format
,
7501 type
, row
, column
));
7504 static void GLAPIENTRY
7505 exec_ColorPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
7506 GLsizei count
, const GLvoid
*ptr
)
7508 GET_CURRENT_CONTEXT(ctx
);
7509 FLUSH_VERTICES(ctx
, 0);
7510 CALL_ColorPointerEXT(ctx
->Exec
, (size
, type
, stride
, count
, ptr
));
7513 static void GLAPIENTRY
7514 exec_EdgeFlagPointerEXT(GLsizei stride
, GLsizei count
, const GLboolean
*ptr
)
7516 GET_CURRENT_CONTEXT(ctx
);
7517 FLUSH_VERTICES(ctx
, 0);
7518 CALL_EdgeFlagPointerEXT(ctx
->Exec
, (stride
, count
, ptr
));
7521 static void GLAPIENTRY
7522 exec_IndexPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
,
7525 GET_CURRENT_CONTEXT(ctx
);
7526 FLUSH_VERTICES(ctx
, 0);
7527 CALL_IndexPointerEXT(ctx
->Exec
, (type
, stride
, count
, ptr
));
7530 static void GLAPIENTRY
7531 exec_NormalPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
,
7534 GET_CURRENT_CONTEXT(ctx
);
7535 FLUSH_VERTICES(ctx
, 0);
7536 CALL_NormalPointerEXT(ctx
->Exec
, (type
, stride
, count
, ptr
));
7539 static void GLAPIENTRY
7540 exec_TexCoordPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
7541 GLsizei count
, const GLvoid
*ptr
)
7543 GET_CURRENT_CONTEXT(ctx
);
7544 FLUSH_VERTICES(ctx
, 0);
7545 CALL_TexCoordPointerEXT(ctx
->Exec
, (size
, type
, stride
, count
, ptr
));
7548 static void GLAPIENTRY
7549 exec_VertexPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
7550 GLsizei count
, const GLvoid
*ptr
)
7552 GET_CURRENT_CONTEXT(ctx
);
7553 FLUSH_VERTICES(ctx
, 0);
7554 CALL_VertexPointerEXT(ctx
->Exec
, (size
, type
, stride
, count
, ptr
));
7557 static void GLAPIENTRY
7558 exec_LockArraysEXT(GLint first
, GLsizei count
)
7560 GET_CURRENT_CONTEXT(ctx
);
7561 FLUSH_VERTICES(ctx
, 0);
7562 CALL_LockArraysEXT(ctx
->Exec
, (first
, count
));
7565 static void GLAPIENTRY
7566 exec_UnlockArraysEXT(void)
7568 GET_CURRENT_CONTEXT(ctx
);
7569 FLUSH_VERTICES(ctx
, 0);
7570 CALL_UnlockArraysEXT(ctx
->Exec
, ());
7573 static void GLAPIENTRY
7574 exec_ClientActiveTextureARB(GLenum target
)
7576 GET_CURRENT_CONTEXT(ctx
);
7577 FLUSH_VERTICES(ctx
, 0);
7578 CALL_ClientActiveTextureARB(ctx
->Exec
, (target
));
7581 static void GLAPIENTRY
7582 exec_SecondaryColorPointerEXT(GLint size
, GLenum type
,
7583 GLsizei stride
, const GLvoid
*ptr
)
7585 GET_CURRENT_CONTEXT(ctx
);
7586 FLUSH_VERTICES(ctx
, 0);
7587 CALL_SecondaryColorPointerEXT(ctx
->Exec
, (size
, type
, stride
, ptr
));
7590 static void GLAPIENTRY
7591 exec_FogCoordPointerEXT(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
7593 GET_CURRENT_CONTEXT(ctx
);
7594 FLUSH_VERTICES(ctx
, 0);
7595 CALL_FogCoordPointerEXT(ctx
->Exec
, (type
, stride
, ptr
));
7598 /* GL_EXT_multi_draw_arrays */
7599 static void GLAPIENTRY
7600 exec_MultiDrawArraysEXT(GLenum mode
, GLint
* first
,
7601 GLsizei
* count
, GLsizei primcount
)
7603 GET_CURRENT_CONTEXT(ctx
);
7604 FLUSH_VERTICES(ctx
, 0);
7605 CALL_MultiDrawArraysEXT(ctx
->Exec
, (mode
, first
, count
, primcount
));
7608 /* GL_EXT_multi_draw_arrays */
7609 static void GLAPIENTRY
7610 exec_MultiDrawElementsEXT(GLenum mode
, const GLsizei
* count
,
7611 GLenum type
, const GLvoid
** indices
,
7614 GET_CURRENT_CONTEXT(ctx
);
7615 FLUSH_VERTICES(ctx
, 0);
7616 CALL_MultiDrawElementsEXT(ctx
->Exec
,
7617 (mode
, count
, type
, indices
, primcount
));
7620 /* GL_IBM_multimode_draw_arrays */
7621 static void GLAPIENTRY
7622 exec_MultiModeDrawArraysIBM(const GLenum
* mode
, const GLint
* first
,
7623 const GLsizei
* count
, GLsizei primcount
,
7626 GET_CURRENT_CONTEXT(ctx
);
7627 FLUSH_VERTICES(ctx
, 0);
7628 CALL_MultiModeDrawArraysIBM(ctx
->Exec
,
7629 (mode
, first
, count
, primcount
, modestride
));
7632 /* GL_IBM_multimode_draw_arrays */
7633 static void GLAPIENTRY
7634 exec_MultiModeDrawElementsIBM(const GLenum
* mode
,
7635 const GLsizei
* count
,
7637 const GLvoid
* const *indices
,
7638 GLsizei primcount
, GLint modestride
)
7640 GET_CURRENT_CONTEXT(ctx
);
7641 FLUSH_VERTICES(ctx
, 0);
7642 CALL_MultiModeDrawElementsIBM(ctx
->Exec
,
7643 (mode
, count
, type
, indices
, primcount
,
7650 * Setup the given dispatch table to point to Mesa's display list
7651 * building functions.
7653 * This does not include any of the tnl functions - they are
7654 * initialized from _mesa_init_api_defaults and from the active vtxfmt
7658 _mesa_init_dlist_table(struct _glapi_table
*table
)
7660 _mesa_loopback_init_api_table(table
);
7663 SET_Accum(table
, save_Accum
);
7664 SET_AlphaFunc(table
, save_AlphaFunc
);
7665 SET_Bitmap(table
, save_Bitmap
);
7666 SET_BlendFunc(table
, _mesa_BlendFunc
); /* loops-back to BlendFuncSeparate */
7667 SET_CallList(table
, _mesa_save_CallList
);
7668 SET_CallLists(table
, _mesa_save_CallLists
);
7669 SET_Clear(table
, save_Clear
);
7670 SET_ClearAccum(table
, save_ClearAccum
);
7671 SET_ClearColor(table
, save_ClearColor
);
7672 SET_ClearDepth(table
, save_ClearDepth
);
7673 SET_ClearIndex(table
, save_ClearIndex
);
7674 SET_ClearStencil(table
, save_ClearStencil
);
7675 SET_ClipPlane(table
, save_ClipPlane
);
7676 SET_ColorMask(table
, save_ColorMask
);
7677 SET_ColorMaterial(table
, save_ColorMaterial
);
7678 SET_CopyPixels(table
, save_CopyPixels
);
7679 SET_CullFace(table
, save_CullFace
);
7680 SET_DeleteLists(table
, _mesa_DeleteLists
);
7681 SET_DepthFunc(table
, save_DepthFunc
);
7682 SET_DepthMask(table
, save_DepthMask
);
7683 SET_DepthRange(table
, save_DepthRange
);
7684 SET_Disable(table
, save_Disable
);
7685 SET_DrawBuffer(table
, save_DrawBuffer
);
7686 SET_DrawPixels(table
, save_DrawPixels
);
7687 SET_Enable(table
, save_Enable
);
7688 SET_EndList(table
, _mesa_EndList
);
7689 SET_EvalMesh1(table
, _mesa_save_EvalMesh1
);
7690 SET_EvalMesh2(table
, _mesa_save_EvalMesh2
);
7691 SET_Finish(table
, exec_Finish
);
7692 SET_Flush(table
, exec_Flush
);
7693 SET_Fogf(table
, save_Fogf
);
7694 SET_Fogfv(table
, save_Fogfv
);
7695 SET_Fogi(table
, save_Fogi
);
7696 SET_Fogiv(table
, save_Fogiv
);
7697 SET_FrontFace(table
, save_FrontFace
);
7698 SET_Frustum(table
, save_Frustum
);
7699 SET_GenLists(table
, _mesa_GenLists
);
7700 SET_GetBooleanv(table
, exec_GetBooleanv
);
7701 SET_GetClipPlane(table
, exec_GetClipPlane
);
7702 SET_GetDoublev(table
, exec_GetDoublev
);
7703 SET_GetError(table
, exec_GetError
);
7704 SET_GetFloatv(table
, exec_GetFloatv
);
7705 SET_GetIntegerv(table
, exec_GetIntegerv
);
7706 SET_GetLightfv(table
, exec_GetLightfv
);
7707 SET_GetLightiv(table
, exec_GetLightiv
);
7708 SET_GetMapdv(table
, exec_GetMapdv
);
7709 SET_GetMapfv(table
, exec_GetMapfv
);
7710 SET_GetMapiv(table
, exec_GetMapiv
);
7711 SET_GetMaterialfv(table
, exec_GetMaterialfv
);
7712 SET_GetMaterialiv(table
, exec_GetMaterialiv
);
7713 SET_GetPixelMapfv(table
, exec_GetPixelMapfv
);
7714 SET_GetPixelMapuiv(table
, exec_GetPixelMapuiv
);
7715 SET_GetPixelMapusv(table
, exec_GetPixelMapusv
);
7716 SET_GetPolygonStipple(table
, exec_GetPolygonStipple
);
7717 SET_GetString(table
, exec_GetString
);
7718 SET_GetTexEnvfv(table
, exec_GetTexEnvfv
);
7719 SET_GetTexEnviv(table
, exec_GetTexEnviv
);
7720 SET_GetTexGendv(table
, exec_GetTexGendv
);
7721 SET_GetTexGenfv(table
, exec_GetTexGenfv
);
7722 SET_GetTexGeniv(table
, exec_GetTexGeniv
);
7723 SET_GetTexImage(table
, exec_GetTexImage
);
7724 SET_GetTexLevelParameterfv(table
, exec_GetTexLevelParameterfv
);
7725 SET_GetTexLevelParameteriv(table
, exec_GetTexLevelParameteriv
);
7726 SET_GetTexParameterfv(table
, exec_GetTexParameterfv
);
7727 SET_GetTexParameteriv(table
, exec_GetTexParameteriv
);
7728 SET_Hint(table
, save_Hint
);
7729 SET_IndexMask(table
, save_IndexMask
);
7730 SET_InitNames(table
, save_InitNames
);
7731 SET_IsEnabled(table
, exec_IsEnabled
);
7732 SET_IsList(table
, _mesa_IsList
);
7733 SET_LightModelf(table
, save_LightModelf
);
7734 SET_LightModelfv(table
, save_LightModelfv
);
7735 SET_LightModeli(table
, save_LightModeli
);
7736 SET_LightModeliv(table
, save_LightModeliv
);
7737 SET_Lightf(table
, save_Lightf
);
7738 SET_Lightfv(table
, save_Lightfv
);
7739 SET_Lighti(table
, save_Lighti
);
7740 SET_Lightiv(table
, save_Lightiv
);
7741 SET_LineStipple(table
, save_LineStipple
);
7742 SET_LineWidth(table
, save_LineWidth
);
7743 SET_ListBase(table
, save_ListBase
);
7744 SET_LoadIdentity(table
, save_LoadIdentity
);
7745 SET_LoadMatrixd(table
, save_LoadMatrixd
);
7746 SET_LoadMatrixf(table
, save_LoadMatrixf
);
7747 SET_LoadName(table
, save_LoadName
);
7748 SET_LogicOp(table
, save_LogicOp
);
7749 SET_Map1d(table
, save_Map1d
);
7750 SET_Map1f(table
, save_Map1f
);
7751 SET_Map2d(table
, save_Map2d
);
7752 SET_Map2f(table
, save_Map2f
);
7753 SET_MapGrid1d(table
, save_MapGrid1d
);
7754 SET_MapGrid1f(table
, save_MapGrid1f
);
7755 SET_MapGrid2d(table
, save_MapGrid2d
);
7756 SET_MapGrid2f(table
, save_MapGrid2f
);
7757 SET_MatrixMode(table
, save_MatrixMode
);
7758 SET_MultMatrixd(table
, save_MultMatrixd
);
7759 SET_MultMatrixf(table
, save_MultMatrixf
);
7760 SET_NewList(table
, save_NewList
);
7761 SET_Ortho(table
, save_Ortho
);
7762 SET_PassThrough(table
, save_PassThrough
);
7763 SET_PixelMapfv(table
, save_PixelMapfv
);
7764 SET_PixelMapuiv(table
, save_PixelMapuiv
);
7765 SET_PixelMapusv(table
, save_PixelMapusv
);
7766 SET_PixelStoref(table
, exec_PixelStoref
);
7767 SET_PixelStorei(table
, exec_PixelStorei
);
7768 SET_PixelTransferf(table
, save_PixelTransferf
);
7769 SET_PixelTransferi(table
, save_PixelTransferi
);
7770 SET_PixelZoom(table
, save_PixelZoom
);
7771 SET_PointSize(table
, save_PointSize
);
7772 SET_PolygonMode(table
, save_PolygonMode
);
7773 SET_PolygonOffset(table
, save_PolygonOffset
);
7774 SET_PolygonStipple(table
, save_PolygonStipple
);
7775 SET_PopAttrib(table
, save_PopAttrib
);
7776 SET_PopMatrix(table
, save_PopMatrix
);
7777 SET_PopName(table
, save_PopName
);
7778 SET_PushAttrib(table
, save_PushAttrib
);
7779 SET_PushMatrix(table
, save_PushMatrix
);
7780 SET_PushName(table
, save_PushName
);
7781 SET_RasterPos2d(table
, save_RasterPos2d
);
7782 SET_RasterPos2dv(table
, save_RasterPos2dv
);
7783 SET_RasterPos2f(table
, save_RasterPos2f
);
7784 SET_RasterPos2fv(table
, save_RasterPos2fv
);
7785 SET_RasterPos2i(table
, save_RasterPos2i
);
7786 SET_RasterPos2iv(table
, save_RasterPos2iv
);
7787 SET_RasterPos2s(table
, save_RasterPos2s
);
7788 SET_RasterPos2sv(table
, save_RasterPos2sv
);
7789 SET_RasterPos3d(table
, save_RasterPos3d
);
7790 SET_RasterPos3dv(table
, save_RasterPos3dv
);
7791 SET_RasterPos3f(table
, save_RasterPos3f
);
7792 SET_RasterPos3fv(table
, save_RasterPos3fv
);
7793 SET_RasterPos3i(table
, save_RasterPos3i
);
7794 SET_RasterPos3iv(table
, save_RasterPos3iv
);
7795 SET_RasterPos3s(table
, save_RasterPos3s
);
7796 SET_RasterPos3sv(table
, save_RasterPos3sv
);
7797 SET_RasterPos4d(table
, save_RasterPos4d
);
7798 SET_RasterPos4dv(table
, save_RasterPos4dv
);
7799 SET_RasterPos4f(table
, save_RasterPos4f
);
7800 SET_RasterPos4fv(table
, save_RasterPos4fv
);
7801 SET_RasterPos4i(table
, save_RasterPos4i
);
7802 SET_RasterPos4iv(table
, save_RasterPos4iv
);
7803 SET_RasterPos4s(table
, save_RasterPos4s
);
7804 SET_RasterPos4sv(table
, save_RasterPos4sv
);
7805 SET_ReadBuffer(table
, save_ReadBuffer
);
7806 SET_ReadPixels(table
, exec_ReadPixels
);
7807 SET_RenderMode(table
, exec_RenderMode
);
7808 SET_Rotated(table
, save_Rotated
);
7809 SET_Rotatef(table
, save_Rotatef
);
7810 SET_Scaled(table
, save_Scaled
);
7811 SET_Scalef(table
, save_Scalef
);
7812 SET_Scissor(table
, save_Scissor
);
7813 SET_FeedbackBuffer(table
, exec_FeedbackBuffer
);
7814 SET_SelectBuffer(table
, exec_SelectBuffer
);
7815 SET_ShadeModel(table
, save_ShadeModel
);
7816 SET_StencilFunc(table
, save_StencilFunc
);
7817 SET_StencilMask(table
, save_StencilMask
);
7818 SET_StencilOp(table
, save_StencilOp
);
7819 SET_TexEnvf(table
, save_TexEnvf
);
7820 SET_TexEnvfv(table
, save_TexEnvfv
);
7821 SET_TexEnvi(table
, save_TexEnvi
);
7822 SET_TexEnviv(table
, save_TexEnviv
);
7823 SET_TexGend(table
, save_TexGend
);
7824 SET_TexGendv(table
, save_TexGendv
);
7825 SET_TexGenf(table
, save_TexGenf
);
7826 SET_TexGenfv(table
, save_TexGenfv
);
7827 SET_TexGeni(table
, save_TexGeni
);
7828 SET_TexGeniv(table
, save_TexGeniv
);
7829 SET_TexImage1D(table
, save_TexImage1D
);
7830 SET_TexImage2D(table
, save_TexImage2D
);
7831 SET_TexParameterf(table
, save_TexParameterf
);
7832 SET_TexParameterfv(table
, save_TexParameterfv
);
7833 SET_TexParameteri(table
, save_TexParameteri
);
7834 SET_TexParameteriv(table
, save_TexParameteriv
);
7835 SET_Translated(table
, save_Translated
);
7836 SET_Translatef(table
, save_Translatef
);
7837 SET_Viewport(table
, save_Viewport
);
7840 SET_AreTexturesResident(table
, exec_AreTexturesResident
);
7841 SET_BindTexture(table
, save_BindTexture
);
7842 SET_ColorPointer(table
, exec_ColorPointer
);
7843 SET_CopyTexImage1D(table
, save_CopyTexImage1D
);
7844 SET_CopyTexImage2D(table
, save_CopyTexImage2D
);
7845 SET_CopyTexSubImage1D(table
, save_CopyTexSubImage1D
);
7846 SET_CopyTexSubImage2D(table
, save_CopyTexSubImage2D
);
7847 SET_DeleteTextures(table
, exec_DeleteTextures
);
7848 SET_DisableClientState(table
, exec_DisableClientState
);
7849 SET_EdgeFlagPointer(table
, exec_EdgeFlagPointer
);
7850 SET_EnableClientState(table
, exec_EnableClientState
);
7851 SET_GenTextures(table
, exec_GenTextures
);
7852 SET_GetPointerv(table
, exec_GetPointerv
);
7853 SET_IndexPointer(table
, exec_IndexPointer
);
7854 SET_InterleavedArrays(table
, exec_InterleavedArrays
);
7855 SET_IsTexture(table
, exec_IsTexture
);
7856 SET_NormalPointer(table
, exec_NormalPointer
);
7857 SET_PopClientAttrib(table
, exec_PopClientAttrib
);
7858 SET_PrioritizeTextures(table
, save_PrioritizeTextures
);
7859 SET_PushClientAttrib(table
, exec_PushClientAttrib
);
7860 SET_TexCoordPointer(table
, exec_TexCoordPointer
);
7861 SET_TexSubImage1D(table
, save_TexSubImage1D
);
7862 SET_TexSubImage2D(table
, save_TexSubImage2D
);
7863 SET_VertexPointer(table
, exec_VertexPointer
);
7866 SET_CopyTexSubImage3D(table
, save_CopyTexSubImage3D
);
7867 SET_TexImage3D(table
, save_TexImage3D
);
7868 SET_TexSubImage3D(table
, save_TexSubImage3D
);
7871 SET_StencilFuncSeparate(table
, save_StencilFuncSeparate
);
7872 SET_StencilMaskSeparate(table
, save_StencilMaskSeparate
);
7873 SET_StencilOpSeparate(table
, save_StencilOpSeparate
);
7875 /* ATI_separate_stencil */
7876 SET_StencilFuncSeparateATI(table
, save_StencilFuncSeparateATI
);
7878 /* GL_ARB_imaging */
7879 /* Not all are supported */
7880 SET_BlendColor(table
, save_BlendColor
);
7881 SET_BlendEquation(table
, save_BlendEquation
);
7882 SET_ColorSubTable(table
, save_ColorSubTable
);
7883 SET_ColorTable(table
, save_ColorTable
);
7884 SET_ColorTableParameterfv(table
, save_ColorTableParameterfv
);
7885 SET_ColorTableParameteriv(table
, save_ColorTableParameteriv
);
7886 SET_ConvolutionFilter1D(table
, save_ConvolutionFilter1D
);
7887 SET_ConvolutionFilter2D(table
, save_ConvolutionFilter2D
);
7888 SET_ConvolutionParameterf(table
, save_ConvolutionParameterf
);
7889 SET_ConvolutionParameterfv(table
, save_ConvolutionParameterfv
);
7890 SET_ConvolutionParameteri(table
, save_ConvolutionParameteri
);
7891 SET_ConvolutionParameteriv(table
, save_ConvolutionParameteriv
);
7892 SET_CopyColorSubTable(table
, save_CopyColorSubTable
);
7893 SET_CopyColorTable(table
, save_CopyColorTable
);
7894 SET_CopyConvolutionFilter1D(table
, exec_CopyConvolutionFilter1D
);
7895 SET_CopyConvolutionFilter2D(table
, exec_CopyConvolutionFilter2D
);
7896 SET_GetColorTable(table
, exec_GetColorTable
);
7897 SET_GetColorTableParameterfv(table
, exec_GetColorTableParameterfv
);
7898 SET_GetColorTableParameteriv(table
, exec_GetColorTableParameteriv
);
7899 SET_GetConvolutionFilter(table
, exec_GetConvolutionFilter
);
7900 SET_GetConvolutionParameterfv(table
, exec_GetConvolutionParameterfv
);
7901 SET_GetConvolutionParameteriv(table
, exec_GetConvolutionParameteriv
);
7902 SET_GetHistogram(table
, exec_GetHistogram
);
7903 SET_GetHistogramParameterfv(table
, exec_GetHistogramParameterfv
);
7904 SET_GetHistogramParameteriv(table
, exec_GetHistogramParameteriv
);
7905 SET_GetMinmax(table
, exec_GetMinmax
);
7906 SET_GetMinmaxParameterfv(table
, exec_GetMinmaxParameterfv
);
7907 SET_GetMinmaxParameteriv(table
, exec_GetMinmaxParameteriv
);
7908 SET_GetSeparableFilter(table
, exec_GetSeparableFilter
);
7909 SET_Histogram(table
, save_Histogram
);
7910 SET_Minmax(table
, save_Minmax
);
7911 SET_ResetHistogram(table
, save_ResetHistogram
);
7912 SET_ResetMinmax(table
, save_ResetMinmax
);
7913 SET_SeparableFilter2D(table
, exec_SeparableFilter2D
);
7915 /* 2. GL_EXT_blend_color */
7917 SET_BlendColorEXT(table
, save_BlendColorEXT
);
7920 /* 3. GL_EXT_polygon_offset */
7921 SET_PolygonOffsetEXT(table
, save_PolygonOffsetEXT
);
7923 /* 6. GL_EXT_texture3d */
7925 SET_CopyTexSubImage3DEXT(table
, save_CopyTexSubImage3D
);
7926 SET_TexImage3DEXT(table
, save_TexImage3DEXT
);
7927 SET_TexSubImage3DEXT(table
, save_TexSubImage3D
);
7930 /* 14. GL_SGI_color_table */
7932 SET_ColorTableSGI(table
, save_ColorTable
);
7933 SET_ColorSubTableSGI(table
, save_ColorSubTable
);
7934 SET_GetColorTableSGI(table
, exec_GetColorTable
);
7935 SET_GetColorTableParameterfvSGI(table
, exec_GetColorTableParameterfv
);
7936 SET_GetColorTableParameterivSGI(table
, exec_GetColorTableParameteriv
);
7939 /* 30. GL_EXT_vertex_array */
7940 SET_ColorPointerEXT(table
, exec_ColorPointerEXT
);
7941 SET_EdgeFlagPointerEXT(table
, exec_EdgeFlagPointerEXT
);
7942 SET_IndexPointerEXT(table
, exec_IndexPointerEXT
);
7943 SET_NormalPointerEXT(table
, exec_NormalPointerEXT
);
7944 SET_TexCoordPointerEXT(table
, exec_TexCoordPointerEXT
);
7945 SET_VertexPointerEXT(table
, exec_VertexPointerEXT
);
7947 /* 37. GL_EXT_blend_minmax */
7949 SET_BlendEquationEXT(table
, save_BlendEquationEXT
);
7952 /* 54. GL_EXT_point_parameters */
7953 SET_PointParameterfEXT(table
, save_PointParameterfEXT
);
7954 SET_PointParameterfvEXT(table
, save_PointParameterfvEXT
);
7956 /* 97. GL_EXT_compiled_vertex_array */
7957 SET_LockArraysEXT(table
, exec_LockArraysEXT
);
7958 SET_UnlockArraysEXT(table
, exec_UnlockArraysEXT
);
7960 /* 145. GL_EXT_secondary_color */
7961 SET_SecondaryColorPointerEXT(table
, exec_SecondaryColorPointerEXT
);
7963 /* 148. GL_EXT_multi_draw_arrays */
7964 SET_MultiDrawArraysEXT(table
, exec_MultiDrawArraysEXT
);
7965 SET_MultiDrawElementsEXT(table
, exec_MultiDrawElementsEXT
);
7967 /* 149. GL_EXT_fog_coord */
7968 SET_FogCoordPointerEXT(table
, exec_FogCoordPointerEXT
);
7970 /* 173. GL_EXT_blend_func_separate */
7971 SET_BlendFuncSeparateEXT(table
, save_BlendFuncSeparateEXT
);
7973 /* 196. GL_MESA_resize_buffers */
7974 SET_ResizeBuffersMESA(table
, _mesa_ResizeBuffersMESA
);
7976 /* 197. GL_MESA_window_pos */
7977 SET_WindowPos2dMESA(table
, save_WindowPos2dMESA
);
7978 SET_WindowPos2dvMESA(table
, save_WindowPos2dvMESA
);
7979 SET_WindowPos2fMESA(table
, save_WindowPos2fMESA
);
7980 SET_WindowPos2fvMESA(table
, save_WindowPos2fvMESA
);
7981 SET_WindowPos2iMESA(table
, save_WindowPos2iMESA
);
7982 SET_WindowPos2ivMESA(table
, save_WindowPos2ivMESA
);
7983 SET_WindowPos2sMESA(table
, save_WindowPos2sMESA
);
7984 SET_WindowPos2svMESA(table
, save_WindowPos2svMESA
);
7985 SET_WindowPos3dMESA(table
, save_WindowPos3dMESA
);
7986 SET_WindowPos3dvMESA(table
, save_WindowPos3dvMESA
);
7987 SET_WindowPos3fMESA(table
, save_WindowPos3fMESA
);
7988 SET_WindowPos3fvMESA(table
, save_WindowPos3fvMESA
);
7989 SET_WindowPos3iMESA(table
, save_WindowPos3iMESA
);
7990 SET_WindowPos3ivMESA(table
, save_WindowPos3ivMESA
);
7991 SET_WindowPos3sMESA(table
, save_WindowPos3sMESA
);
7992 SET_WindowPos3svMESA(table
, save_WindowPos3svMESA
);
7993 SET_WindowPos4dMESA(table
, save_WindowPos4dMESA
);
7994 SET_WindowPos4dvMESA(table
, save_WindowPos4dvMESA
);
7995 SET_WindowPos4fMESA(table
, save_WindowPos4fMESA
);
7996 SET_WindowPos4fvMESA(table
, save_WindowPos4fvMESA
);
7997 SET_WindowPos4iMESA(table
, save_WindowPos4iMESA
);
7998 SET_WindowPos4ivMESA(table
, save_WindowPos4ivMESA
);
7999 SET_WindowPos4sMESA(table
, save_WindowPos4sMESA
);
8000 SET_WindowPos4svMESA(table
, save_WindowPos4svMESA
);
8002 /* 200. GL_IBM_multimode_draw_arrays */
8003 SET_MultiModeDrawArraysIBM(table
, exec_MultiModeDrawArraysIBM
);
8004 SET_MultiModeDrawElementsIBM(table
, exec_MultiModeDrawElementsIBM
);
8006 #if FEATURE_NV_vertex_program
8007 /* 233. GL_NV_vertex_program */
8008 /* The following commands DO NOT go into display lists:
8009 * AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV,
8010 * VertexAttribPointerNV, GetProgram*, GetVertexAttrib*
8012 SET_BindProgramNV(table
, save_BindProgramNV
);
8013 SET_DeleteProgramsNV(table
, _mesa_DeletePrograms
);
8014 SET_ExecuteProgramNV(table
, save_ExecuteProgramNV
);
8015 SET_GenProgramsNV(table
, _mesa_GenPrograms
);
8016 SET_AreProgramsResidentNV(table
, _mesa_AreProgramsResidentNV
);
8017 SET_RequestResidentProgramsNV(table
, save_RequestResidentProgramsNV
);
8018 SET_GetProgramParameterfvNV(table
, _mesa_GetProgramParameterfvNV
);
8019 SET_GetProgramParameterdvNV(table
, _mesa_GetProgramParameterdvNV
);
8020 SET_GetProgramivNV(table
, _mesa_GetProgramivNV
);
8021 SET_GetProgramStringNV(table
, _mesa_GetProgramStringNV
);
8022 SET_GetTrackMatrixivNV(table
, _mesa_GetTrackMatrixivNV
);
8023 SET_GetVertexAttribdvNV(table
, _mesa_GetVertexAttribdvNV
);
8024 SET_GetVertexAttribfvNV(table
, _mesa_GetVertexAttribfvNV
);
8025 SET_GetVertexAttribivNV(table
, _mesa_GetVertexAttribivNV
);
8026 SET_GetVertexAttribPointervNV(table
, _mesa_GetVertexAttribPointervNV
);
8027 SET_IsProgramNV(table
, _mesa_IsProgramARB
);
8028 SET_LoadProgramNV(table
, save_LoadProgramNV
);
8029 SET_ProgramEnvParameter4dARB(table
, save_ProgramEnvParameter4dARB
);
8030 SET_ProgramEnvParameter4dvARB(table
, save_ProgramEnvParameter4dvARB
);
8031 SET_ProgramEnvParameter4fARB(table
, save_ProgramEnvParameter4fARB
);
8032 SET_ProgramEnvParameter4fvARB(table
, save_ProgramEnvParameter4fvARB
);
8033 SET_ProgramParameters4dvNV(table
, save_ProgramParameters4dvNV
);
8034 SET_ProgramParameters4fvNV(table
, save_ProgramParameters4fvNV
);
8035 SET_TrackMatrixNV(table
, save_TrackMatrixNV
);
8036 SET_VertexAttribPointerNV(table
, _mesa_VertexAttribPointerNV
);
8039 /* 245. GL_ATI_fragment_shader */
8040 #if FEATURE_ATI_fragment_shader
8041 SET_BindFragmentShaderATI(table
, save_BindFragmentShaderATI
);
8042 SET_SetFragmentShaderConstantATI(table
, save_SetFragmentShaderConstantATI
);
8045 /* 282. GL_NV_fragment_program */
8046 #if FEATURE_NV_fragment_program
8047 SET_ProgramNamedParameter4fNV(table
, save_ProgramNamedParameter4fNV
);
8048 SET_ProgramNamedParameter4dNV(table
, save_ProgramNamedParameter4dNV
);
8049 SET_ProgramNamedParameter4fvNV(table
, save_ProgramNamedParameter4fvNV
);
8050 SET_ProgramNamedParameter4dvNV(table
, save_ProgramNamedParameter4dvNV
);
8051 SET_GetProgramNamedParameterfvNV(table
,
8052 _mesa_GetProgramNamedParameterfvNV
);
8053 SET_GetProgramNamedParameterdvNV(table
,
8054 _mesa_GetProgramNamedParameterdvNV
);
8055 SET_ProgramLocalParameter4dARB(table
, save_ProgramLocalParameter4dARB
);
8056 SET_ProgramLocalParameter4dvARB(table
, save_ProgramLocalParameter4dvARB
);
8057 SET_ProgramLocalParameter4fARB(table
, save_ProgramLocalParameter4fARB
);
8058 SET_ProgramLocalParameter4fvARB(table
, save_ProgramLocalParameter4fvARB
);
8059 SET_GetProgramLocalParameterdvARB(table
,
8060 _mesa_GetProgramLocalParameterdvARB
);
8061 SET_GetProgramLocalParameterfvARB(table
,
8062 _mesa_GetProgramLocalParameterfvARB
);
8065 /* 262. GL_NV_point_sprite */
8066 SET_PointParameteriNV(table
, save_PointParameteriNV
);
8067 SET_PointParameterivNV(table
, save_PointParameterivNV
);
8069 /* 268. GL_EXT_stencil_two_side */
8070 SET_ActiveStencilFaceEXT(table
, save_ActiveStencilFaceEXT
);
8072 /* 273. GL_APPLE_vertex_array_object */
8073 SET_BindVertexArrayAPPLE(table
, _mesa_BindVertexArrayAPPLE
);
8074 SET_DeleteVertexArraysAPPLE(table
, _mesa_DeleteVertexArraysAPPLE
);
8075 SET_GenVertexArraysAPPLE(table
, _mesa_GenVertexArraysAPPLE
);
8076 SET_IsVertexArrayAPPLE(table
, _mesa_IsVertexArrayAPPLE
);
8078 /* ???. GL_EXT_depth_bounds_test */
8079 SET_DepthBoundsEXT(table
, save_DepthBoundsEXT
);
8081 /* ARB 1. GL_ARB_multitexture */
8082 SET_ActiveTextureARB(table
, save_ActiveTextureARB
);
8083 SET_ClientActiveTextureARB(table
, exec_ClientActiveTextureARB
);
8085 /* ARB 3. GL_ARB_transpose_matrix */
8086 SET_LoadTransposeMatrixdARB(table
, save_LoadTransposeMatrixdARB
);
8087 SET_LoadTransposeMatrixfARB(table
, save_LoadTransposeMatrixfARB
);
8088 SET_MultTransposeMatrixdARB(table
, save_MultTransposeMatrixdARB
);
8089 SET_MultTransposeMatrixfARB(table
, save_MultTransposeMatrixfARB
);
8091 /* ARB 5. GL_ARB_multisample */
8092 SET_SampleCoverageARB(table
, save_SampleCoverageARB
);
8094 /* ARB 12. GL_ARB_texture_compression */
8095 SET_CompressedTexImage3DARB(table
, save_CompressedTexImage3DARB
);
8096 SET_CompressedTexImage2DARB(table
, save_CompressedTexImage2DARB
);
8097 SET_CompressedTexImage1DARB(table
, save_CompressedTexImage1DARB
);
8098 SET_CompressedTexSubImage3DARB(table
, save_CompressedTexSubImage3DARB
);
8099 SET_CompressedTexSubImage2DARB(table
, save_CompressedTexSubImage2DARB
);
8100 SET_CompressedTexSubImage1DARB(table
, save_CompressedTexSubImage1DARB
);
8101 SET_GetCompressedTexImageARB(table
, exec_GetCompressedTexImageARB
);
8103 /* ARB 14. GL_ARB_point_parameters */
8104 /* aliased with EXT_point_parameters functions */
8106 /* ARB 25. GL_ARB_window_pos */
8107 /* aliased with MESA_window_pos functions */
8109 /* ARB 26. GL_ARB_vertex_program */
8110 /* ARB 27. GL_ARB_fragment_program */
8111 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
8112 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
8113 SET_VertexAttribPointerARB(table
, _mesa_VertexAttribPointerARB
);
8114 SET_EnableVertexAttribArrayARB(table
, _mesa_EnableVertexAttribArrayARB
);
8115 SET_DisableVertexAttribArrayARB(table
, _mesa_DisableVertexAttribArrayARB
);
8116 SET_ProgramStringARB(table
, save_ProgramStringARB
);
8117 SET_BindProgramNV(table
, save_BindProgramNV
);
8118 SET_DeleteProgramsNV(table
, _mesa_DeletePrograms
);
8119 SET_GenProgramsNV(table
, _mesa_GenPrograms
);
8120 SET_IsProgramNV(table
, _mesa_IsProgramARB
);
8121 SET_GetVertexAttribdvNV(table
, _mesa_GetVertexAttribdvNV
);
8122 SET_GetVertexAttribfvNV(table
, _mesa_GetVertexAttribfvNV
);
8123 SET_GetVertexAttribivNV(table
, _mesa_GetVertexAttribivNV
);
8124 SET_GetVertexAttribPointervNV(table
, _mesa_GetVertexAttribPointervNV
);
8125 SET_ProgramEnvParameter4dARB(table
, save_ProgramEnvParameter4dARB
);
8126 SET_ProgramEnvParameter4dvARB(table
, save_ProgramEnvParameter4dvARB
);
8127 SET_ProgramEnvParameter4fARB(table
, save_ProgramEnvParameter4fARB
);
8128 SET_ProgramEnvParameter4fvARB(table
, save_ProgramEnvParameter4fvARB
);
8129 SET_ProgramLocalParameter4dARB(table
, save_ProgramLocalParameter4dARB
);
8130 SET_ProgramLocalParameter4dvARB(table
, save_ProgramLocalParameter4dvARB
);
8131 SET_ProgramLocalParameter4fARB(table
, save_ProgramLocalParameter4fARB
);
8132 SET_ProgramLocalParameter4fvARB(table
, save_ProgramLocalParameter4fvARB
);
8133 SET_GetProgramEnvParameterdvARB(table
, _mesa_GetProgramEnvParameterdvARB
);
8134 SET_GetProgramEnvParameterfvARB(table
, _mesa_GetProgramEnvParameterfvARB
);
8135 SET_GetProgramLocalParameterdvARB(table
,
8136 _mesa_GetProgramLocalParameterdvARB
);
8137 SET_GetProgramLocalParameterfvARB(table
,
8138 _mesa_GetProgramLocalParameterfvARB
);
8139 SET_GetProgramivARB(table
, _mesa_GetProgramivARB
);
8140 SET_GetProgramStringARB(table
, _mesa_GetProgramStringARB
);
8143 /* ARB 28. GL_ARB_vertex_buffer_object */
8144 #if FEATURE_ARB_vertex_buffer_object
8145 /* None of the extension's functions get compiled */
8146 SET_BindBufferARB(table
, _mesa_BindBufferARB
);
8147 SET_BufferDataARB(table
, _mesa_BufferDataARB
);
8148 SET_BufferSubDataARB(table
, _mesa_BufferSubDataARB
);
8149 SET_DeleteBuffersARB(table
, _mesa_DeleteBuffersARB
);
8150 SET_GenBuffersARB(table
, _mesa_GenBuffersARB
);
8151 SET_GetBufferParameterivARB(table
, _mesa_GetBufferParameterivARB
);
8152 SET_GetBufferPointervARB(table
, _mesa_GetBufferPointervARB
);
8153 SET_GetBufferSubDataARB(table
, _mesa_GetBufferSubDataARB
);
8154 SET_IsBufferARB(table
, _mesa_IsBufferARB
);
8155 SET_MapBufferARB(table
, _mesa_MapBufferARB
);
8156 SET_UnmapBufferARB(table
, _mesa_UnmapBufferARB
);
8159 #if FEATURE_ARB_occlusion_query
8160 SET_BeginQueryARB(table
, save_BeginQueryARB
);
8161 SET_EndQueryARB(table
, save_EndQueryARB
);
8162 SET_GenQueriesARB(table
, _mesa_GenQueriesARB
);
8163 SET_DeleteQueriesARB(table
, _mesa_DeleteQueriesARB
);
8164 SET_IsQueryARB(table
, _mesa_IsQueryARB
);
8165 SET_GetQueryivARB(table
, _mesa_GetQueryivARB
);
8166 SET_GetQueryObjectivARB(table
, _mesa_GetQueryObjectivARB
);
8167 SET_GetQueryObjectuivARB(table
, _mesa_GetQueryObjectuivARB
);
8169 SET_DrawBuffersARB(table
, save_DrawBuffersARB
);
8171 #if FEATURE_EXT_framebuffer_blit
8172 SET_BlitFramebufferEXT(table
, save_BlitFramebufferEXT
);
8175 /* ARB 30/31/32. GL_ARB_shader_objects, GL_ARB_vertex/fragment_shader */
8176 SET_BindAttribLocationARB(table
, exec_BindAttribLocationARB
);
8177 SET_GetAttribLocationARB(table
, exec_GetAttribLocationARB
);
8178 /* XXX additional functions need to be implemented here! */
8180 /* 299. GL_EXT_blend_equation_separate */
8181 SET_BlendEquationSeparateEXT(table
, save_BlendEquationSeparateEXT
);
8183 /* GL_EXT_gpu_program_parmaeters */
8184 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
8185 SET_ProgramEnvParameters4fvEXT(table
, save_ProgramEnvParameters4fvEXT
);
8186 SET_ProgramLocalParameters4fvEXT(table
, save_ProgramLocalParameters4fvEXT
);
8193 enum_string(GLenum k
)
8195 return _mesa_lookup_enum_by_nr(k
);
8200 * Print the commands in a display list. For debugging only.
8201 * TODO: many commands aren't handled yet.
8203 static void GLAPIENTRY
8204 print_list(GLcontext
*ctx
, GLuint list
)
8206 struct mesa_display_list
*dlist
;
8210 if (!islist(ctx
, list
)) {
8211 _mesa_printf("%u is not a display list ID\n", list
);
8215 dlist
= lookup_list(ctx
, list
);
8221 _mesa_printf("START-LIST %u, address %p\n", list
, (void *) n
);
8223 done
= n
? GL_FALSE
: GL_TRUE
;
8225 OpCode opcode
= n
[0].opcode
;
8226 GLint i
= (GLint
) n
[0].opcode
- (GLint
) OPCODE_EXT_0
;
8228 if (i
>= 0 && i
< (GLint
) ctx
->ListExt
.NumOpcodes
) {
8229 /* this is a driver-extended opcode */
8230 ctx
->ListExt
.Opcode
[i
].Print(ctx
, &n
[1]);
8231 n
+= ctx
->ListExt
.Opcode
[i
].Size
;
8236 _mesa_printf("Accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
8239 _mesa_printf("Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
8240 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
, (void *) n
[7].data
);
8242 case OPCODE_CALL_LIST
:
8243 _mesa_printf("CallList %d\n", (int) n
[1].ui
);
8245 case OPCODE_CALL_LIST_OFFSET
:
8246 _mesa_printf("CallList %d + offset %u = %u\n", (int) n
[1].ui
,
8247 ctx
->List
.ListBase
, ctx
->List
.ListBase
+ n
[1].ui
);
8249 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
8250 _mesa_printf("ColorTableParameterfv %s %s %f %f %f %f\n",
8251 enum_string(n
[1].e
), enum_string(n
[2].e
),
8252 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8254 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
8255 _mesa_printf("ColorTableParameteriv %s %s %d %d %d %d\n",
8256 enum_string(n
[1].e
), enum_string(n
[2].e
),
8257 n
[3].i
, n
[4].i
, n
[5].i
, n
[6].i
);
8259 case OPCODE_DISABLE
:
8260 _mesa_printf("Disable %s\n", enum_string(n
[1].e
));
8263 _mesa_printf("Enable %s\n", enum_string(n
[1].e
));
8265 case OPCODE_FRUSTUM
:
8266 _mesa_printf("Frustum %g %g %g %g %g %g\n",
8267 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8269 case OPCODE_LINE_STIPPLE
:
8270 _mesa_printf("LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
8272 case OPCODE_LOAD_IDENTITY
:
8273 _mesa_printf("LoadIdentity\n");
8275 case OPCODE_LOAD_MATRIX
:
8276 _mesa_printf("LoadMatrix\n");
8277 _mesa_printf(" %8f %8f %8f %8f\n",
8278 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
8279 _mesa_printf(" %8f %8f %8f %8f\n",
8280 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
8281 _mesa_printf(" %8f %8f %8f %8f\n",
8282 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
8283 _mesa_printf(" %8f %8f %8f %8f\n",
8284 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
8286 case OPCODE_MULT_MATRIX
:
8287 _mesa_printf("MultMatrix (or Rotate)\n");
8288 _mesa_printf(" %8f %8f %8f %8f\n",
8289 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
8290 _mesa_printf(" %8f %8f %8f %8f\n",
8291 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
8292 _mesa_printf(" %8f %8f %8f %8f\n",
8293 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
8294 _mesa_printf(" %8f %8f %8f %8f\n",
8295 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
8298 _mesa_printf("Ortho %g %g %g %g %g %g\n",
8299 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8301 case OPCODE_POP_ATTRIB
:
8302 _mesa_printf("PopAttrib\n");
8304 case OPCODE_POP_MATRIX
:
8305 _mesa_printf("PopMatrix\n");
8307 case OPCODE_POP_NAME
:
8308 _mesa_printf("PopName\n");
8310 case OPCODE_PUSH_ATTRIB
:
8311 _mesa_printf("PushAttrib %x\n", n
[1].bf
);
8313 case OPCODE_PUSH_MATRIX
:
8314 _mesa_printf("PushMatrix\n");
8316 case OPCODE_PUSH_NAME
:
8317 _mesa_printf("PushName %d\n", (int) n
[1].ui
);
8319 case OPCODE_RASTER_POS
:
8320 _mesa_printf("RasterPos %g %g %g %g\n",
8321 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
8324 _mesa_printf("Rotate %g %g %g %g\n",
8325 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
8328 _mesa_printf("Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
8330 case OPCODE_TRANSLATE
:
8331 _mesa_printf("Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
8333 case OPCODE_BIND_TEXTURE
:
8334 _mesa_printf("BindTexture %s %d\n",
8335 _mesa_lookup_enum_by_nr(n
[1].ui
), n
[2].ui
);
8337 case OPCODE_SHADE_MODEL
:
8338 _mesa_printf("ShadeModel %s\n", _mesa_lookup_enum_by_nr(n
[1].ui
));
8341 _mesa_printf("Map1 %s %.3f %.3f %d %d\n",
8342 _mesa_lookup_enum_by_nr(n
[1].ui
),
8343 n
[2].f
, n
[3].f
, n
[4].i
, n
[5].i
);
8346 _mesa_printf("Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
8347 _mesa_lookup_enum_by_nr(n
[1].ui
),
8348 n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
,
8349 n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
8351 case OPCODE_MAPGRID1
:
8352 _mesa_printf("MapGrid1 %d %.3f %.3f\n", n
[1].i
, n
[2].f
, n
[3].f
);
8354 case OPCODE_MAPGRID2
:
8355 _mesa_printf("MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
8356 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
8358 case OPCODE_EVALMESH1
:
8359 _mesa_printf("EvalMesh1 %d %d\n", n
[1].i
, n
[2].i
);
8361 case OPCODE_EVALMESH2
:
8362 _mesa_printf("EvalMesh2 %d %d %d %d\n",
8363 n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
8366 case OPCODE_ATTR_1F_NV
:
8367 _mesa_printf("ATTR_1F_NV attr %d: %f\n", n
[1].i
, n
[2].f
);
8369 case OPCODE_ATTR_2F_NV
:
8370 _mesa_printf("ATTR_2F_NV attr %d: %f %f\n",
8371 n
[1].i
, n
[2].f
, n
[3].f
);
8373 case OPCODE_ATTR_3F_NV
:
8374 _mesa_printf("ATTR_3F_NV attr %d: %f %f %f\n",
8375 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
8377 case OPCODE_ATTR_4F_NV
:
8378 _mesa_printf("ATTR_4F_NV attr %d: %f %f %f %f\n",
8379 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
8381 case OPCODE_ATTR_1F_ARB
:
8382 _mesa_printf("ATTR_1F_ARB attr %d: %f\n", n
[1].i
, n
[2].f
);
8384 case OPCODE_ATTR_2F_ARB
:
8385 _mesa_printf("ATTR_2F_ARB attr %d: %f %f\n",
8386 n
[1].i
, n
[2].f
, n
[3].f
);
8388 case OPCODE_ATTR_3F_ARB
:
8389 _mesa_printf("ATTR_3F_ARB attr %d: %f %f %f\n",
8390 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
8392 case OPCODE_ATTR_4F_ARB
:
8393 _mesa_printf("ATTR_4F_ARB attr %d: %f %f %f %f\n",
8394 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
8397 case OPCODE_MATERIAL
:
8398 _mesa_printf("MATERIAL %x %x: %f %f %f %f\n",
8399 n
[1].i
, n
[2].i
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8402 _mesa_printf("BEGIN %x\n", n
[1].i
);
8405 _mesa_printf("END\n");
8408 _mesa_printf("RECTF %f %f %f %f\n", n
[1].f
, n
[2].f
, n
[3].f
,
8411 case OPCODE_EVAL_C1
:
8412 _mesa_printf("EVAL_C1 %f\n", n
[1].f
);
8414 case OPCODE_EVAL_C2
:
8415 _mesa_printf("EVAL_C2 %f %f\n", n
[1].f
, n
[2].f
);
8417 case OPCODE_EVAL_P1
:
8418 _mesa_printf("EVAL_P1 %d\n", n
[1].i
);
8420 case OPCODE_EVAL_P2
:
8421 _mesa_printf("EVAL_P2 %d %d\n", n
[1].i
, n
[2].i
);
8425 * meta opcodes/commands
8428 _mesa_printf("Error: %s %s\n",
8429 enum_string(n
[1].e
), (const char *) n
[2].data
);
8431 case OPCODE_CONTINUE
:
8432 _mesa_printf("DISPLAY-LIST-CONTINUE\n");
8433 n
= (Node
*) n
[1].next
;
8435 case OPCODE_END_OF_LIST
:
8436 _mesa_printf("END-LIST %u\n", list
);
8440 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
8442 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
8443 opcode
, (void *) n
);
8447 _mesa_printf("command %d, %u operands\n", opcode
,
8451 /* increment n to point to next compiled command */
8452 if (opcode
!= OPCODE_CONTINUE
) {
8453 n
+= InstSize
[opcode
];
8462 * Clients may call this function to help debug display list problems.
8463 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
8464 * changed, or break in the future without notice.
8467 mesa_print_display_list(GLuint list
)
8469 GET_CURRENT_CONTEXT(ctx
);
8470 print_list(ctx
, list
);
8474 /**********************************************************************/
8475 /***** Initialization *****/
8476 /**********************************************************************/
8479 _mesa_save_vtxfmt_init(GLvertexformat
* vfmt
)
8481 vfmt
->ArrayElement
= _ae_loopback_array_elt
; /* generic helper */
8482 vfmt
->Begin
= save_Begin
;
8483 vfmt
->CallList
= _mesa_save_CallList
;
8484 vfmt
->CallLists
= _mesa_save_CallLists
;
8485 vfmt
->Color3f
= save_Color3f
;
8486 vfmt
->Color3fv
= save_Color3fv
;
8487 vfmt
->Color4f
= save_Color4f
;
8488 vfmt
->Color4fv
= save_Color4fv
;
8489 vfmt
->EdgeFlag
= save_EdgeFlag
;
8490 vfmt
->End
= save_End
;
8491 vfmt
->EvalCoord1f
= save_EvalCoord1f
;
8492 vfmt
->EvalCoord1fv
= save_EvalCoord1fv
;
8493 vfmt
->EvalCoord2f
= save_EvalCoord2f
;
8494 vfmt
->EvalCoord2fv
= save_EvalCoord2fv
;
8495 vfmt
->EvalPoint1
= save_EvalPoint1
;
8496 vfmt
->EvalPoint2
= save_EvalPoint2
;
8497 vfmt
->FogCoordfEXT
= save_FogCoordfEXT
;
8498 vfmt
->FogCoordfvEXT
= save_FogCoordfvEXT
;
8499 vfmt
->Indexf
= save_Indexf
;
8500 vfmt
->Indexfv
= save_Indexfv
;
8501 vfmt
->Materialfv
= save_Materialfv
;
8502 vfmt
->MultiTexCoord1fARB
= save_MultiTexCoord1f
;
8503 vfmt
->MultiTexCoord1fvARB
= save_MultiTexCoord1fv
;
8504 vfmt
->MultiTexCoord2fARB
= save_MultiTexCoord2f
;
8505 vfmt
->MultiTexCoord2fvARB
= save_MultiTexCoord2fv
;
8506 vfmt
->MultiTexCoord3fARB
= save_MultiTexCoord3f
;
8507 vfmt
->MultiTexCoord3fvARB
= save_MultiTexCoord3fv
;
8508 vfmt
->MultiTexCoord4fARB
= save_MultiTexCoord4f
;
8509 vfmt
->MultiTexCoord4fvARB
= save_MultiTexCoord4fv
;
8510 vfmt
->Normal3f
= save_Normal3f
;
8511 vfmt
->Normal3fv
= save_Normal3fv
;
8512 vfmt
->SecondaryColor3fEXT
= save_SecondaryColor3fEXT
;
8513 vfmt
->SecondaryColor3fvEXT
= save_SecondaryColor3fvEXT
;
8514 vfmt
->TexCoord1f
= save_TexCoord1f
;
8515 vfmt
->TexCoord1fv
= save_TexCoord1fv
;
8516 vfmt
->TexCoord2f
= save_TexCoord2f
;
8517 vfmt
->TexCoord2fv
= save_TexCoord2fv
;
8518 vfmt
->TexCoord3f
= save_TexCoord3f
;
8519 vfmt
->TexCoord3fv
= save_TexCoord3fv
;
8520 vfmt
->TexCoord4f
= save_TexCoord4f
;
8521 vfmt
->TexCoord4fv
= save_TexCoord4fv
;
8522 vfmt
->Vertex2f
= save_Vertex2f
;
8523 vfmt
->Vertex2fv
= save_Vertex2fv
;
8524 vfmt
->Vertex3f
= save_Vertex3f
;
8525 vfmt
->Vertex3fv
= save_Vertex3fv
;
8526 vfmt
->Vertex4f
= save_Vertex4f
;
8527 vfmt
->Vertex4fv
= save_Vertex4fv
;
8528 vfmt
->VertexAttrib1fNV
= save_VertexAttrib1fNV
;
8529 vfmt
->VertexAttrib1fvNV
= save_VertexAttrib1fvNV
;
8530 vfmt
->VertexAttrib2fNV
= save_VertexAttrib2fNV
;
8531 vfmt
->VertexAttrib2fvNV
= save_VertexAttrib2fvNV
;
8532 vfmt
->VertexAttrib3fNV
= save_VertexAttrib3fNV
;
8533 vfmt
->VertexAttrib3fvNV
= save_VertexAttrib3fvNV
;
8534 vfmt
->VertexAttrib4fNV
= save_VertexAttrib4fNV
;
8535 vfmt
->VertexAttrib4fvNV
= save_VertexAttrib4fvNV
;
8536 vfmt
->VertexAttrib1fARB
= save_VertexAttrib1fARB
;
8537 vfmt
->VertexAttrib1fvARB
= save_VertexAttrib1fvARB
;
8538 vfmt
->VertexAttrib2fARB
= save_VertexAttrib2fARB
;
8539 vfmt
->VertexAttrib2fvARB
= save_VertexAttrib2fvARB
;
8540 vfmt
->VertexAttrib3fARB
= save_VertexAttrib3fARB
;
8541 vfmt
->VertexAttrib3fvARB
= save_VertexAttrib3fvARB
;
8542 vfmt
->VertexAttrib4fARB
= save_VertexAttrib4fARB
;
8543 vfmt
->VertexAttrib4fvARB
= save_VertexAttrib4fvARB
;
8545 vfmt
->EvalMesh1
= _mesa_save_EvalMesh1
;
8546 vfmt
->EvalMesh2
= _mesa_save_EvalMesh2
;
8547 vfmt
->Rectf
= save_Rectf
;
8549 /* The driver is required to implement these as
8550 * 1) They can probably do a better job.
8551 * 2) A lot of new mechanisms would have to be added to this module
8552 * to support it. That code would probably never get used,
8556 vfmt
->DrawArrays
= 0;
8557 vfmt
->DrawElements
= 0;
8558 vfmt
->DrawRangeElements
= 0;
8564 * Initialize display list state for given context.
8567 _mesa_init_display_list(GLcontext
*ctx
)
8569 static GLboolean tableInitialized
= GL_FALSE
;
8571 /* zero-out the instruction size table, just once */
8572 if (!tableInitialized
) {
8573 _mesa_bzero(InstSize
, sizeof(InstSize
));
8574 tableInitialized
= GL_TRUE
;
8578 ctx
->ListState
.CallDepth
= 0;
8579 ctx
->ExecuteFlag
= GL_TRUE
;
8580 ctx
->CompileFlag
= GL_FALSE
;
8581 ctx
->ListState
.CurrentListPtr
= NULL
;
8582 ctx
->ListState
.CurrentBlock
= NULL
;
8583 ctx
->ListState
.CurrentListNum
= 0;
8584 ctx
->ListState
.CurrentPos
= 0;
8586 /* Display List group */
8587 ctx
->List
.ListBase
= 0;
8589 _mesa_save_vtxfmt_init(&ctx
->ListState
.ListVtxfmt
);