2 * Mesa 3-D graphics library
5 * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 * Display lists management functions.
33 #include "api_arrayelt.h"
34 #include "api_loopback.h"
36 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
37 #include "arbprogram.h"
43 #if FEATURE_ARB_vertex_buffer_object
44 #include "bufferobj.h"
56 #include "extensions.h"
61 #include "histogram.h"
78 #if FEATURE_NV_vertex_program || FEATURE_NV_fragment_program
79 #include "nvprogram.h"
82 #if FEATURE_ATI_fragment_shader
83 #include "atifragshader.h"
86 #include "math/m_matrix.h"
87 #include "math/m_xform.h"
93 * \param ctx GL context.
95 * Checks if dd_function_table::SaveNeedFlush is marked to flush
96 * stored (save) vertices, and calls
97 * dd_function_table::SaveFlushVertices if so.
99 #define SAVE_FLUSH_VERTICES(ctx) \
101 if (ctx->Driver.SaveNeedFlush) \
102 ctx->Driver.SaveFlushVertices(ctx); \
107 * Macro to assert that the API call was made outside the
108 * glBegin()/glEnd() pair, with return value.
110 * \param ctx GL context.
111 * \param retval value to return value in case the assertion fails.
113 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval) \
115 if (ctx->Driver.CurrentSavePrimitive <= GL_POLYGON || \
116 ctx->Driver.CurrentSavePrimitive == PRIM_INSIDE_UNKNOWN_PRIM) { \
117 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \
123 * Macro to assert that the API call was made outside the
124 * glBegin()/glEnd() pair.
126 * \param ctx GL context.
128 #define ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx) \
130 if (ctx->Driver.CurrentSavePrimitive <= GL_POLYGON || \
131 ctx->Driver.CurrentSavePrimitive == PRIM_INSIDE_UNKNOWN_PRIM) { \
132 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \
138 * Macro to assert that the API call was made outside the
139 * glBegin()/glEnd() pair and flush the vertices.
141 * \param ctx GL context.
143 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx) \
145 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx); \
146 SAVE_FLUSH_VERTICES(ctx); \
150 * Macro to assert that the API call was made outside the
151 * glBegin()/glEnd() pair and flush the vertices, with return value.
153 * \param ctx GL context.
154 * \param retval value to return value in case the assertion fails.
156 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval)\
158 ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval); \
159 SAVE_FLUSH_VERTICES(ctx); \
165 * Display list opcodes.
167 * The fact that these identifiers are assigned consecutive
168 * integer values starting at 0 is very important, see InstSize array usage)
171 OPCODE_INVALID
= -1, /* Force signed enum */
177 OPCODE_BLEND_EQUATION
,
178 OPCODE_BLEND_EQUATION_SEPARATE
,
179 OPCODE_BLEND_FUNC_SEPARATE
,
181 OPCODE_CALL_LIST_OFFSET
,
187 OPCODE_CLEAR_STENCIL
,
190 OPCODE_COLOR_MATERIAL
,
192 OPCODE_COLOR_TABLE_PARAMETER_FV
,
193 OPCODE_COLOR_TABLE_PARAMETER_IV
,
194 OPCODE_COLOR_SUB_TABLE
,
195 OPCODE_CONVOLUTION_FILTER_1D
,
196 OPCODE_CONVOLUTION_FILTER_2D
,
197 OPCODE_CONVOLUTION_PARAMETER_I
,
198 OPCODE_CONVOLUTION_PARAMETER_IV
,
199 OPCODE_CONVOLUTION_PARAMETER_F
,
200 OPCODE_CONVOLUTION_PARAMETER_FV
,
201 OPCODE_COPY_COLOR_SUB_TABLE
,
202 OPCODE_COPY_COLOR_TABLE
,
204 OPCODE_COPY_TEX_IMAGE1D
,
205 OPCODE_COPY_TEX_IMAGE2D
,
206 OPCODE_COPY_TEX_SUB_IMAGE1D
,
207 OPCODE_COPY_TEX_SUB_IMAGE2D
,
208 OPCODE_COPY_TEX_SUB_IMAGE3D
,
231 OPCODE_LOAD_IDENTITY
,
245 OPCODE_PIXEL_TRANSFER
,
248 OPCODE_POINT_PARAMETERS
,
250 OPCODE_POLYGON_STIPPLE
,
251 OPCODE_POLYGON_OFFSET
,
255 OPCODE_PRIORITIZE_TEXTURE
,
261 OPCODE_RESET_HISTOGRAM
,
262 OPCODE_RESET_MIN_MAX
,
266 OPCODE_SELECT_TEXTURE_SGIS
,
267 OPCODE_SELECT_TEXTURE_COORD_SET
,
278 OPCODE_TEX_SUB_IMAGE1D
,
279 OPCODE_TEX_SUB_IMAGE2D
,
280 OPCODE_TEX_SUB_IMAGE3D
,
284 /* GL_ARB_multitexture */
285 OPCODE_ACTIVE_TEXTURE
,
286 /* GL_SGIX/SGIS_pixel_texture */
287 OPCODE_PIXEL_TEXGEN_SGIX
,
288 OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS
,
289 /* GL_ARB_texture_compression */
290 OPCODE_COMPRESSED_TEX_IMAGE_1D
,
291 OPCODE_COMPRESSED_TEX_IMAGE_2D
,
292 OPCODE_COMPRESSED_TEX_IMAGE_3D
,
293 OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
,
294 OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
,
295 OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
,
296 /* GL_ARB_multisample */
297 OPCODE_SAMPLE_COVERAGE
,
298 /* GL_ARB_window_pos */
299 OPCODE_WINDOW_POS_ARB
,
300 /* GL_NV_vertex_program */
301 OPCODE_BIND_PROGRAM_NV
,
302 OPCODE_EXECUTE_PROGRAM_NV
,
303 OPCODE_REQUEST_RESIDENT_PROGRAMS_NV
,
304 OPCODE_LOAD_PROGRAM_NV
,
305 OPCODE_PROGRAM_PARAMETER4F_NV
,
306 OPCODE_TRACK_MATRIX_NV
,
307 /* GL_NV_fragment_program */
308 OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
,
309 OPCODE_PROGRAM_NAMED_PARAMETER_NV
,
310 /* GL_EXT_stencil_two_side */
311 OPCODE_ACTIVE_STENCIL_FACE_EXT
,
312 /* GL_EXT_depth_bounds_test */
313 OPCODE_DEPTH_BOUNDS_EXT
,
314 /* GL_ARB_vertex/fragment_program */
315 OPCODE_PROGRAM_STRING_ARB
,
316 OPCODE_PROGRAM_ENV_PARAMETER_ARB
,
317 /* GL_ARB_occlusion_query */
318 OPCODE_BEGIN_QUERY_ARB
,
319 OPCODE_END_QUERY_ARB
,
320 /* GL_ARB_draw_buffers */
321 OPCODE_DRAW_BUFFERS_ARB
,
322 /* GL_ATI_fragment_shader */
323 OPCODE_BIND_FRAGMENT_SHADER_ATI
,
324 OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
,
326 OPCODE_STENCIL_FUNC_SEPARATE
,
327 OPCODE_STENCIL_OP_SEPARATE
,
328 OPCODE_STENCIL_MASK_SEPARATE
,
330 /* Vertex attributes -- fallback for when optimized display
331 * list build isn't active.
353 /* The following three are meta instructions */
354 OPCODE_ERROR
, /* raise compiled-in error */
365 * Display list instructions are stored as sequences of "nodes". Nodes
366 * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
367 * are linked together with a pointer.
369 * Each instruction in the display list is stored as a sequence of
370 * contiguous nodes in memory.
371 * Each node is the union of a variety of data types.
385 void *next
; /* If prev node's opcode==OPCODE_CONTINUE */
390 * How many nodes to allocate at a time.
392 * \note Reduced now that we hold vertices etc. elsewhere.
394 #define BLOCK_SIZE 256
399 * Number of nodes of storage needed for each instruction.
400 * Sizes for dynamically allocated opcodes are stored in the context struct.
402 static GLuint InstSize
[ OPCODE_END_OF_LIST
+1 ];
404 void mesa_print_display_list( GLuint list
);
407 /**********************************************************************/
408 /***** Private *****/
409 /**********************************************************************/
412 * Make an empty display list. This is used by glGenLists() to
413 * reserver display list IDs.
415 static struct mesa_display_list
*make_list( GLuint list
, GLuint count
)
417 struct mesa_display_list
*dlist
= CALLOC_STRUCT( mesa_display_list
);
419 dlist
->node
= (Node
*) MALLOC( sizeof(Node
) * count
);
420 dlist
->node
[0].opcode
= OPCODE_END_OF_LIST
;
427 * Destroy all nodes in a display list.
428 * \param list - display list number
430 void _mesa_destroy_list( GLcontext
*ctx
, GLuint list
)
432 struct mesa_display_list
*dlist
;
439 dlist
= (struct mesa_display_list
*) _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
443 n
= block
= dlist
->node
;
445 done
= block
? GL_FALSE
: GL_TRUE
;
448 /* check for extension opcodes first */
450 GLint i
= (GLint
) n
[0].opcode
- (GLint
) OPCODE_EXT_0
;
451 if (i
>= 0 && i
< (GLint
) ctx
->ListExt
.NumOpcodes
) {
452 ctx
->ListExt
.Opcode
[i
].Destroy(ctx
, &n
[1]);
453 n
+= ctx
->ListExt
.Opcode
[i
].Size
;
456 switch (n
[0].opcode
) {
457 /* for some commands, we need to free malloc'd memory */
460 n
+= InstSize
[n
[0].opcode
];
464 n
+= InstSize
[n
[0].opcode
];
466 case OPCODE_DRAW_PIXELS
:
468 n
+= InstSize
[n
[0].opcode
];
472 n
+= InstSize
[n
[0].opcode
];
474 case OPCODE_COLOR_TABLE
:
476 n
+= InstSize
[n
[0].opcode
];
478 case OPCODE_COLOR_SUB_TABLE
:
480 n
+= InstSize
[n
[0].opcode
];
482 case OPCODE_CONVOLUTION_FILTER_1D
:
484 n
+= InstSize
[n
[0].opcode
];
486 case OPCODE_CONVOLUTION_FILTER_2D
:
488 n
+= InstSize
[n
[0].opcode
];
490 case OPCODE_POLYGON_STIPPLE
:
492 n
+= InstSize
[n
[0].opcode
];
494 case OPCODE_TEX_IMAGE1D
:
496 n
+= InstSize
[n
[0].opcode
];
498 case OPCODE_TEX_IMAGE2D
:
500 n
+= InstSize
[n
[0].opcode
];
502 case OPCODE_TEX_IMAGE3D
:
504 n
+= InstSize
[n
[0].opcode
];
506 case OPCODE_TEX_SUB_IMAGE1D
:
508 n
+= InstSize
[n
[0].opcode
];
510 case OPCODE_TEX_SUB_IMAGE2D
:
512 n
+= InstSize
[n
[0].opcode
];
514 case OPCODE_TEX_SUB_IMAGE3D
:
516 n
+= InstSize
[n
[0].opcode
];
518 case OPCODE_COMPRESSED_TEX_IMAGE_1D
:
520 n
+= InstSize
[n
[0].opcode
];
522 case OPCODE_COMPRESSED_TEX_IMAGE_2D
:
524 n
+= InstSize
[n
[0].opcode
];
526 case OPCODE_COMPRESSED_TEX_IMAGE_3D
:
528 n
+= InstSize
[n
[0].opcode
];
530 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
:
532 n
+= InstSize
[n
[0].opcode
];
534 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
:
536 n
+= InstSize
[n
[0].opcode
];
538 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
:
540 n
+= InstSize
[n
[0].opcode
];
542 #if FEATURE_NV_vertex_program
543 case OPCODE_LOAD_PROGRAM_NV
:
544 FREE(n
[4].data
); /* program string */
545 n
+= InstSize
[n
[0].opcode
];
547 case OPCODE_REQUEST_RESIDENT_PROGRAMS_NV
:
548 FREE(n
[2].data
); /* array of program ids */
549 n
+= InstSize
[n
[0].opcode
];
552 #if FEATURE_NV_fragment_program
553 case OPCODE_PROGRAM_NAMED_PARAMETER_NV
:
554 FREE(n
[3].data
); /* parameter name */
555 n
+= InstSize
[n
[0].opcode
];
558 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
559 case OPCODE_PROGRAM_STRING_ARB
:
560 FREE(n
[4].data
); /* program string */
561 n
+= InstSize
[n
[0].opcode
];
564 case OPCODE_CONTINUE
:
565 n
= (Node
*) n
[1].next
;
569 case OPCODE_END_OF_LIST
:
574 /* Most frequent case */
575 n
+= InstSize
[n
[0].opcode
];
582 _mesa_HashRemove(ctx
->Shared
->DisplayList
, list
);
588 * Translate the nth element of list from type to GLuint.
590 static GLuint
translate_id( GLsizei n
, GLenum type
, const GLvoid
*list
)
602 bptr
= (GLbyte
*) list
;
603 return (GLuint
) *(bptr
+n
);
604 case GL_UNSIGNED_BYTE
:
605 ubptr
= (GLubyte
*) list
;
606 return (GLuint
) *(ubptr
+n
);
608 sptr
= (GLshort
*) list
;
609 return (GLuint
) *(sptr
+n
);
610 case GL_UNSIGNED_SHORT
:
611 usptr
= (GLushort
*) list
;
612 return (GLuint
) *(usptr
+n
);
614 iptr
= (GLint
*) list
;
615 return (GLuint
) *(iptr
+n
);
616 case GL_UNSIGNED_INT
:
617 uiptr
= (GLuint
*) list
;
618 return (GLuint
) *(uiptr
+n
);
620 fptr
= (GLfloat
*) list
;
621 return (GLuint
) *(fptr
+n
);
623 ubptr
= ((GLubyte
*) list
) + 2*n
;
624 return (GLuint
) *ubptr
* 256 + (GLuint
) *(ubptr
+1);
626 ubptr
= ((GLubyte
*) list
) + 3*n
;
627 return (GLuint
) *ubptr
* 65536
628 + (GLuint
) *(ubptr
+1) * 256
629 + (GLuint
) *(ubptr
+2);
631 ubptr
= ((GLubyte
*) list
) + 4*n
;
632 return (GLuint
) *ubptr
* 16777216
633 + (GLuint
) *(ubptr
+1) * 65536
634 + (GLuint
) *(ubptr
+2) * 256
635 + (GLuint
) *(ubptr
+3);
644 /**********************************************************************/
646 /**********************************************************************/
649 * Do one-time initialiazations for display lists.
652 _mesa_init_lists( void )
654 static int init_flag
= 0;
657 InstSize
[OPCODE_ACCUM
] = 3;
658 InstSize
[OPCODE_ALPHA_FUNC
] = 3;
659 InstSize
[OPCODE_BIND_TEXTURE
] = 3;
660 InstSize
[OPCODE_BITMAP
] = 8;
661 InstSize
[OPCODE_BLEND_COLOR
] = 5;
662 InstSize
[OPCODE_BLEND_EQUATION
] = 2;
663 InstSize
[OPCODE_BLEND_EQUATION_SEPARATE
] = 3;
664 InstSize
[OPCODE_BLEND_FUNC_SEPARATE
] = 5;
665 InstSize
[OPCODE_CALL_LIST
] = 2;
666 InstSize
[OPCODE_CALL_LIST_OFFSET
] = 3;
667 InstSize
[OPCODE_CLEAR
] = 2;
668 InstSize
[OPCODE_CLEAR_ACCUM
] = 5;
669 InstSize
[OPCODE_CLEAR_COLOR
] = 5;
670 InstSize
[OPCODE_CLEAR_DEPTH
] = 2;
671 InstSize
[OPCODE_CLEAR_INDEX
] = 2;
672 InstSize
[OPCODE_CLEAR_STENCIL
] = 2;
673 InstSize
[OPCODE_CLIP_PLANE
] = 6;
674 InstSize
[OPCODE_COLOR_MASK
] = 5;
675 InstSize
[OPCODE_COLOR_MATERIAL
] = 3;
676 InstSize
[OPCODE_COLOR_TABLE
] = 7;
677 InstSize
[OPCODE_COLOR_TABLE_PARAMETER_FV
] = 7;
678 InstSize
[OPCODE_COLOR_TABLE_PARAMETER_IV
] = 7;
679 InstSize
[OPCODE_COLOR_SUB_TABLE
] = 7;
680 InstSize
[OPCODE_CONVOLUTION_FILTER_1D
] = 7;
681 InstSize
[OPCODE_CONVOLUTION_FILTER_2D
] = 8;
682 InstSize
[OPCODE_CONVOLUTION_PARAMETER_I
] = 4;
683 InstSize
[OPCODE_CONVOLUTION_PARAMETER_IV
] = 7;
684 InstSize
[OPCODE_CONVOLUTION_PARAMETER_F
] = 4;
685 InstSize
[OPCODE_CONVOLUTION_PARAMETER_FV
] = 7;
686 InstSize
[OPCODE_COPY_PIXELS
] = 6;
687 InstSize
[OPCODE_COPY_COLOR_SUB_TABLE
] = 6;
688 InstSize
[OPCODE_COPY_COLOR_TABLE
] = 6;
689 InstSize
[OPCODE_COPY_TEX_IMAGE1D
] = 8;
690 InstSize
[OPCODE_COPY_TEX_IMAGE2D
] = 9;
691 InstSize
[OPCODE_COPY_TEX_SUB_IMAGE1D
] = 7;
692 InstSize
[OPCODE_COPY_TEX_SUB_IMAGE2D
] = 9;
693 InstSize
[OPCODE_COPY_TEX_SUB_IMAGE3D
] = 10;
694 InstSize
[OPCODE_CULL_FACE
] = 2;
695 InstSize
[OPCODE_DEPTH_FUNC
] = 2;
696 InstSize
[OPCODE_DEPTH_MASK
] = 2;
697 InstSize
[OPCODE_DEPTH_RANGE
] = 3;
698 InstSize
[OPCODE_DISABLE
] = 2;
699 InstSize
[OPCODE_DRAW_BUFFER
] = 2;
700 InstSize
[OPCODE_DRAW_PIXELS
] = 6;
701 InstSize
[OPCODE_ENABLE
] = 2;
702 InstSize
[OPCODE_EVALMESH1
] = 4;
703 InstSize
[OPCODE_EVALMESH2
] = 6;
704 InstSize
[OPCODE_FOG
] = 6;
705 InstSize
[OPCODE_FRONT_FACE
] = 2;
706 InstSize
[OPCODE_FRUSTUM
] = 7;
707 InstSize
[OPCODE_HINT
] = 3;
708 InstSize
[OPCODE_HISTOGRAM
] = 5;
709 InstSize
[OPCODE_INDEX_MASK
] = 2;
710 InstSize
[OPCODE_INIT_NAMES
] = 1;
711 InstSize
[OPCODE_LIGHT
] = 7;
712 InstSize
[OPCODE_LIGHT_MODEL
] = 6;
713 InstSize
[OPCODE_LINE_STIPPLE
] = 3;
714 InstSize
[OPCODE_LINE_WIDTH
] = 2;
715 InstSize
[OPCODE_LIST_BASE
] = 2;
716 InstSize
[OPCODE_LOAD_IDENTITY
] = 1;
717 InstSize
[OPCODE_LOAD_MATRIX
] = 17;
718 InstSize
[OPCODE_LOAD_NAME
] = 2;
719 InstSize
[OPCODE_LOGIC_OP
] = 2;
720 InstSize
[OPCODE_MAP1
] = 7;
721 InstSize
[OPCODE_MAP2
] = 11;
722 InstSize
[OPCODE_MAPGRID1
] = 4;
723 InstSize
[OPCODE_MAPGRID2
] = 7;
724 InstSize
[OPCODE_MATRIX_MODE
] = 2;
725 InstSize
[OPCODE_MIN_MAX
] = 4;
726 InstSize
[OPCODE_MULT_MATRIX
] = 17;
727 InstSize
[OPCODE_ORTHO
] = 7;
728 InstSize
[OPCODE_PASSTHROUGH
] = 2;
729 InstSize
[OPCODE_PIXEL_MAP
] = 4;
730 InstSize
[OPCODE_PIXEL_TRANSFER
] = 3;
731 InstSize
[OPCODE_PIXEL_ZOOM
] = 3;
732 InstSize
[OPCODE_POINT_SIZE
] = 2;
733 InstSize
[OPCODE_POINT_PARAMETERS
] = 5;
734 InstSize
[OPCODE_POLYGON_MODE
] = 3;
735 InstSize
[OPCODE_POLYGON_STIPPLE
] = 2;
736 InstSize
[OPCODE_POLYGON_OFFSET
] = 3;
737 InstSize
[OPCODE_POP_ATTRIB
] = 1;
738 InstSize
[OPCODE_POP_MATRIX
] = 1;
739 InstSize
[OPCODE_POP_NAME
] = 1;
740 InstSize
[OPCODE_PRIORITIZE_TEXTURE
] = 3;
741 InstSize
[OPCODE_PUSH_ATTRIB
] = 2;
742 InstSize
[OPCODE_PUSH_MATRIX
] = 1;
743 InstSize
[OPCODE_PUSH_NAME
] = 2;
744 InstSize
[OPCODE_RASTER_POS
] = 5;
745 InstSize
[OPCODE_READ_BUFFER
] = 2;
746 InstSize
[OPCODE_RESET_HISTOGRAM
] = 2;
747 InstSize
[OPCODE_RESET_MIN_MAX
] = 2;
748 InstSize
[OPCODE_ROTATE
] = 5;
749 InstSize
[OPCODE_SCALE
] = 4;
750 InstSize
[OPCODE_SCISSOR
] = 5;
751 InstSize
[OPCODE_STENCIL_FUNC
] = 4;
752 InstSize
[OPCODE_STENCIL_MASK
] = 2;
753 InstSize
[OPCODE_STENCIL_OP
] = 4;
754 InstSize
[OPCODE_SHADE_MODEL
] = 2;
755 InstSize
[OPCODE_TEXENV
] = 7;
756 InstSize
[OPCODE_TEXGEN
] = 7;
757 InstSize
[OPCODE_TEXPARAMETER
] = 7;
758 InstSize
[OPCODE_TEX_IMAGE1D
] = 9;
759 InstSize
[OPCODE_TEX_IMAGE2D
] = 10;
760 InstSize
[OPCODE_TEX_IMAGE3D
] = 11;
761 InstSize
[OPCODE_TEX_SUB_IMAGE1D
] = 8;
762 InstSize
[OPCODE_TEX_SUB_IMAGE2D
] = 10;
763 InstSize
[OPCODE_TEX_SUB_IMAGE3D
] = 12;
764 InstSize
[OPCODE_TRANSLATE
] = 4;
765 InstSize
[OPCODE_VIEWPORT
] = 5;
766 InstSize
[OPCODE_WINDOW_POS
] = 5;
767 InstSize
[OPCODE_CONTINUE
] = 2;
768 InstSize
[OPCODE_ERROR
] = 3;
769 InstSize
[OPCODE_END_OF_LIST
] = 1;
770 /* GL_SGIX/SGIS_pixel_texture */
771 InstSize
[OPCODE_PIXEL_TEXGEN_SGIX
] = 2;
772 InstSize
[OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS
] = 3;
773 /* GL_ARB_texture_compression */
774 InstSize
[OPCODE_COMPRESSED_TEX_IMAGE_1D
] = 8;
775 InstSize
[OPCODE_COMPRESSED_TEX_IMAGE_2D
] = 9;
776 InstSize
[OPCODE_COMPRESSED_TEX_IMAGE_3D
] = 10;
777 InstSize
[OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
] = 8;
778 InstSize
[OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
] = 10;
779 InstSize
[OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
] = 12;
780 /* GL_ARB_multisample */
781 InstSize
[OPCODE_SAMPLE_COVERAGE
] = 3;
782 /* GL_ARB_multitexture */
783 InstSize
[OPCODE_ACTIVE_TEXTURE
] = 2;
784 /* GL_ARB_window_pos */
785 InstSize
[OPCODE_WINDOW_POS_ARB
] = 4;
786 /* GL_NV_vertex_program */
787 InstSize
[OPCODE_BIND_PROGRAM_NV
] = 3;
788 InstSize
[OPCODE_EXECUTE_PROGRAM_NV
] = 7;
789 InstSize
[OPCODE_REQUEST_RESIDENT_PROGRAMS_NV
] = 2;
790 InstSize
[OPCODE_LOAD_PROGRAM_NV
] = 5;
791 InstSize
[OPCODE_PROGRAM_PARAMETER4F_NV
] = 7;
792 InstSize
[OPCODE_TRACK_MATRIX_NV
] = 5;
793 /* GL_NV_fragment_program */
794 InstSize
[OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
] = 7;
795 InstSize
[OPCODE_PROGRAM_NAMED_PARAMETER_NV
] = 8;
796 /* GL_EXT_stencil_two_side */
797 InstSize
[OPCODE_ACTIVE_STENCIL_FACE_EXT
] = 2;
798 /* GL_EXT_depth_bounds_test */
799 InstSize
[OPCODE_DEPTH_BOUNDS_EXT
] = 3;
800 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
801 InstSize
[OPCODE_PROGRAM_STRING_ARB
] = 5;
802 InstSize
[OPCODE_PROGRAM_ENV_PARAMETER_ARB
] = 7;
804 #if FEATURE_ARB_occlusion_query
805 InstSize
[OPCODE_BEGIN_QUERY_ARB
] = 3;
806 InstSize
[OPCODE_END_QUERY_ARB
] = 2;
808 InstSize
[OPCODE_DRAW_BUFFERS_ARB
] = 2 + MAX_DRAW_BUFFERS
;
809 #if FEATURE_ATI_fragment_shader
810 InstSize
[OPCODE_BIND_FRAGMENT_SHADER_ATI
] = 2;
811 InstSize
[OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
] = 6;
814 InstSize
[OPCODE_STENCIL_FUNC_SEPARATE
] = 5;
815 InstSize
[OPCODE_STENCIL_MASK_SEPARATE
] = 3;
816 InstSize
[OPCODE_STENCIL_OP_SEPARATE
] = 5;
818 InstSize
[OPCODE_ATTR_1F_NV
] = 3;
819 InstSize
[OPCODE_ATTR_2F_NV
] = 4;
820 InstSize
[OPCODE_ATTR_3F_NV
] = 5;
821 InstSize
[OPCODE_ATTR_4F_NV
] = 6;
822 InstSize
[OPCODE_ATTR_1F_ARB
] = 3;
823 InstSize
[OPCODE_ATTR_2F_ARB
] = 4;
824 InstSize
[OPCODE_ATTR_3F_ARB
] = 5;
825 InstSize
[OPCODE_ATTR_4F_ARB
] = 6;
826 InstSize
[OPCODE_MATERIAL
] = 7;
827 InstSize
[OPCODE_INDEX
] = 2;
828 InstSize
[OPCODE_EDGEFLAG
] = 2;
829 InstSize
[OPCODE_BEGIN
] = 2;
830 InstSize
[OPCODE_END
] = 1;
831 InstSize
[OPCODE_RECTF
] = 5;
832 InstSize
[OPCODE_EVAL_C1
] = 2;
833 InstSize
[OPCODE_EVAL_C2
] = 3;
834 InstSize
[OPCODE_EVAL_P1
] = 2;
835 InstSize
[OPCODE_EVAL_P2
] = 3;
843 * Wrapper for _mesa_unpack_image() that handles pixel buffer objects.
844 * \todo This won't suffice when the PBO is really in VRAM/GPU memory.
847 unpack_image( GLuint dimensions
, GLsizei width
, GLsizei height
, GLsizei depth
,
848 GLenum format
, GLenum type
, const GLvoid
*pixels
,
849 const struct gl_pixelstore_attrib
*unpack
)
851 if (unpack
->BufferObj
->Name
== 0) {
853 return _mesa_unpack_image(dimensions
, width
, height
, depth
, format
, type
,
856 else if (_mesa_validate_pbo_access(dimensions
, unpack
, width
, height
, depth
,
857 format
, type
, pixels
)) {
858 const GLubyte
*src
= ADD_POINTERS(unpack
->BufferObj
->Data
, pixels
);
859 return _mesa_unpack_image(dimensions
, width
, height
, depth
, format
, type
,
868 * Allocate space for a display list instruction.
869 * \param opcode - type of instruction
870 * argcount - size in bytes of data required.
871 * \return pointer to the usable data area (not including the internal
875 _mesa_alloc_instruction( GLcontext
*ctx
, int opcode
, GLint sz
)
878 GLuint count
= 1 + (sz
+ sizeof(Node
) - 1) / sizeof(Node
);
881 if (opcode
< (int) OPCODE_EXT_0
) {
882 assert( count
== InstSize
[opcode
] );
886 if (ctx
->ListState
.CurrentPos
+ count
+ 2 > BLOCK_SIZE
) {
887 /* This block is full. Allocate a new block and chain to it */
888 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
889 n
[0].opcode
= OPCODE_CONTINUE
;
890 newblock
= (Node
*) MALLOC( sizeof(Node
) * BLOCK_SIZE
);
892 _mesa_error( ctx
, GL_OUT_OF_MEMORY
, "Building display list" );
895 n
[1].next
= (Node
*) newblock
;
896 ctx
->ListState
.CurrentBlock
= newblock
;
897 ctx
->ListState
.CurrentPos
= 0;
900 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
901 ctx
->ListState
.CurrentPos
+= count
;
903 n
[0].opcode
= (OpCode
) opcode
;
905 return (void *)&n
[1];
910 * This function allows modules and drivers to get their own opcodes
911 * for extending display list functionality.
912 * \param ctx the rendering context
913 * \param size number of bytes for storing the new display list command
914 * \param execute function to execute the new display list command
915 * \param destroy function to destroy the new display list command
916 * \param print function to print the new display list command
917 * \return the new opcode number or -1 if error
920 _mesa_alloc_opcode( GLcontext
*ctx
,
922 void (*execute
)( GLcontext
*, void * ),
923 void (*destroy
)( GLcontext
*, void * ),
924 void (*print
)( GLcontext
*, void * ) )
926 if (ctx
->ListExt
.NumOpcodes
< MAX_DLIST_EXT_OPCODES
) {
927 const GLuint i
= ctx
->ListExt
.NumOpcodes
++;
928 ctx
->ListExt
.Opcode
[i
].Size
= 1 + (size
+ sizeof(Node
) - 1)/sizeof(Node
);
929 ctx
->ListExt
.Opcode
[i
].Execute
= execute
;
930 ctx
->ListExt
.Opcode
[i
].Destroy
= destroy
;
931 ctx
->ListExt
.Opcode
[i
].Print
= print
;
932 return i
+ OPCODE_EXT_0
;
939 /* Mimic the old behaviour of alloc_instruction:
940 * - sz is in units of sizeof(Node)
941 * - return value a pointer to sizeof(Node) before the actual
944 #define ALLOC_INSTRUCTION(ctx, opcode, sz) \
945 ((Node *)_mesa_alloc_instruction(ctx, opcode, sz*sizeof(Node)) - 1)
950 * Display List compilation functions
952 static void GLAPIENTRY
save_Accum( GLenum op
, GLfloat value
)
954 GET_CURRENT_CONTEXT(ctx
);
956 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
957 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ACCUM
, 2 );
962 if (ctx
->ExecuteFlag
) {
963 (*ctx
->Exec
->Accum
)( op
, value
);
968 static void GLAPIENTRY
save_AlphaFunc( GLenum func
, GLclampf ref
)
970 GET_CURRENT_CONTEXT(ctx
);
972 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
973 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ALPHA_FUNC
, 2 );
976 n
[2].f
= (GLfloat
) ref
;
978 if (ctx
->ExecuteFlag
) {
979 (*ctx
->Exec
->AlphaFunc
)( func
, ref
);
984 static void GLAPIENTRY
save_BindTexture( GLenum target
, GLuint texture
)
986 GET_CURRENT_CONTEXT(ctx
);
988 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
989 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BIND_TEXTURE
, 2 );
994 if (ctx
->ExecuteFlag
) {
995 (*ctx
->Exec
->BindTexture
)( target
, texture
);
1000 static void GLAPIENTRY
save_Bitmap( GLsizei width
, GLsizei height
,
1001 GLfloat xorig
, GLfloat yorig
,
1002 GLfloat xmove
, GLfloat ymove
,
1003 const GLubyte
*pixels
)
1005 GET_CURRENT_CONTEXT(ctx
);
1006 GLvoid
*image
= _mesa_unpack_bitmap( width
, height
, pixels
, &ctx
->Unpack
);
1008 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1009 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BITMAP
, 7 );
1011 n
[1].i
= (GLint
) width
;
1012 n
[2].i
= (GLint
) height
;
1022 if (ctx
->ExecuteFlag
) {
1023 (*ctx
->Exec
->Bitmap
)( width
, height
,
1024 xorig
, yorig
, xmove
, ymove
, pixels
);
1029 static void GLAPIENTRY
save_BlendEquation( GLenum mode
)
1031 GET_CURRENT_CONTEXT(ctx
);
1033 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1034 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BLEND_EQUATION
, 1 );
1038 if (ctx
->ExecuteFlag
) {
1039 (*ctx
->Exec
->BlendEquation
)( mode
);
1044 static void GLAPIENTRY
save_BlendEquationSeparateEXT( GLenum modeRGB
,
1047 GET_CURRENT_CONTEXT(ctx
);
1049 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1050 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BLEND_EQUATION_SEPARATE
, 2 );
1055 if (ctx
->ExecuteFlag
) {
1056 (*ctx
->Exec
->BlendEquationSeparateEXT
)( modeRGB
, modeA
);
1061 static void GLAPIENTRY
save_BlendFuncSeparateEXT(GLenum sfactorRGB
, GLenum dfactorRGB
,
1062 GLenum sfactorA
, GLenum dfactorA
)
1064 GET_CURRENT_CONTEXT(ctx
);
1066 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1067 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BLEND_FUNC_SEPARATE
, 4 );
1069 n
[1].e
= sfactorRGB
;
1070 n
[2].e
= dfactorRGB
;
1074 if (ctx
->ExecuteFlag
) {
1075 (*ctx
->Exec
->BlendFuncSeparateEXT
)( sfactorRGB
, dfactorRGB
,
1076 sfactorA
, dfactorA
);
1081 static void GLAPIENTRY
save_BlendColor( GLfloat red
, GLfloat green
,
1082 GLfloat blue
, GLfloat alpha
)
1084 GET_CURRENT_CONTEXT(ctx
);
1086 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1087 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BLEND_COLOR
, 4 );
1094 if (ctx
->ExecuteFlag
) {
1095 (*ctx
->Exec
->BlendColor
)( red
, green
, blue
, alpha
);
1100 void GLAPIENTRY
_mesa_save_CallList( GLuint list
)
1102 GET_CURRENT_CONTEXT(ctx
);
1104 SAVE_FLUSH_VERTICES(ctx
);
1106 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CALL_LIST
, 1 );
1111 /* After this, we don't know what begin/end state we're in:
1113 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
1115 if (ctx
->ExecuteFlag
) {
1116 (*ctx
->Exec
->CallList
)( list
);
1121 void GLAPIENTRY
_mesa_save_CallLists( GLsizei n
, GLenum type
, const GLvoid
*lists
)
1123 GET_CURRENT_CONTEXT(ctx
);
1125 GLboolean typeErrorFlag
;
1127 SAVE_FLUSH_VERTICES(ctx
);
1131 case GL_UNSIGNED_BYTE
:
1133 case GL_UNSIGNED_SHORT
:
1135 case GL_UNSIGNED_INT
:
1140 typeErrorFlag
= GL_FALSE
;
1143 typeErrorFlag
= GL_TRUE
;
1147 GLuint list
= translate_id( i
, type
, lists
);
1148 Node
*n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CALL_LIST_OFFSET
, 2 );
1151 n
[2].b
= typeErrorFlag
;
1155 /* After this, we don't know what begin/end state we're in:
1157 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
1159 if (ctx
->ExecuteFlag
) {
1160 (*ctx
->Exec
->CallLists
)( n
, type
, lists
);
1165 static void GLAPIENTRY
save_Clear( GLbitfield mask
)
1167 GET_CURRENT_CONTEXT(ctx
);
1169 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1170 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CLEAR
, 1 );
1174 if (ctx
->ExecuteFlag
) {
1175 (*ctx
->Exec
->Clear
)( mask
);
1180 static void GLAPIENTRY
save_ClearAccum( GLfloat red
, GLfloat green
,
1181 GLfloat blue
, GLfloat alpha
)
1183 GET_CURRENT_CONTEXT(ctx
);
1185 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1186 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CLEAR_ACCUM
, 4 );
1193 if (ctx
->ExecuteFlag
) {
1194 (*ctx
->Exec
->ClearAccum
)( red
, green
, blue
, alpha
);
1199 static void GLAPIENTRY
save_ClearColor( GLclampf red
, GLclampf green
,
1200 GLclampf blue
, GLclampf alpha
)
1202 GET_CURRENT_CONTEXT(ctx
);
1204 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1205 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CLEAR_COLOR
, 4 );
1212 if (ctx
->ExecuteFlag
) {
1213 (*ctx
->Exec
->ClearColor
)( red
, green
, blue
, alpha
);
1218 static void GLAPIENTRY
save_ClearDepth( GLclampd depth
)
1220 GET_CURRENT_CONTEXT(ctx
);
1222 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1223 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CLEAR_DEPTH
, 1 );
1225 n
[1].f
= (GLfloat
) depth
;
1227 if (ctx
->ExecuteFlag
) {
1228 (*ctx
->Exec
->ClearDepth
)( depth
);
1233 static void GLAPIENTRY
save_ClearIndex( GLfloat c
)
1235 GET_CURRENT_CONTEXT(ctx
);
1237 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1238 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CLEAR_INDEX
, 1 );
1242 if (ctx
->ExecuteFlag
) {
1243 (*ctx
->Exec
->ClearIndex
)( c
);
1248 static void GLAPIENTRY
save_ClearStencil( GLint s
)
1250 GET_CURRENT_CONTEXT(ctx
);
1252 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1253 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CLEAR_STENCIL
, 1 );
1257 if (ctx
->ExecuteFlag
) {
1258 (*ctx
->Exec
->ClearStencil
)( s
);
1263 static void GLAPIENTRY
save_ClipPlane( GLenum plane
, const GLdouble
*equ
)
1265 GET_CURRENT_CONTEXT(ctx
);
1267 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1268 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CLIP_PLANE
, 5 );
1271 n
[2].f
= (GLfloat
) equ
[0];
1272 n
[3].f
= (GLfloat
) equ
[1];
1273 n
[4].f
= (GLfloat
) equ
[2];
1274 n
[5].f
= (GLfloat
) equ
[3];
1276 if (ctx
->ExecuteFlag
) {
1277 (*ctx
->Exec
->ClipPlane
)( plane
, equ
);
1283 static void GLAPIENTRY
save_ColorMask( GLboolean red
, GLboolean green
,
1284 GLboolean blue
, GLboolean alpha
)
1286 GET_CURRENT_CONTEXT(ctx
);
1288 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1289 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COLOR_MASK
, 4 );
1296 if (ctx
->ExecuteFlag
) {
1297 (*ctx
->Exec
->ColorMask
)( red
, green
, blue
, alpha
);
1302 static void GLAPIENTRY
save_ColorMaterial( GLenum face
, GLenum mode
)
1304 GET_CURRENT_CONTEXT(ctx
);
1306 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1308 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COLOR_MATERIAL
, 2 );
1313 if (ctx
->ExecuteFlag
) {
1314 (*ctx
->Exec
->ColorMaterial
)( face
, mode
);
1319 static void GLAPIENTRY
save_ColorTable( GLenum target
, GLenum internalFormat
,
1320 GLsizei width
, GLenum format
, GLenum type
,
1321 const GLvoid
*table
)
1323 GET_CURRENT_CONTEXT(ctx
);
1324 if (target
== GL_PROXY_TEXTURE_1D
||
1325 target
== GL_PROXY_TEXTURE_2D
||
1326 target
== GL_PROXY_TEXTURE_3D
||
1327 target
== GL_PROXY_TEXTURE_CUBE_MAP_ARB
) {
1328 /* execute immediately */
1329 (*ctx
->Exec
->ColorTable
)( target
, internalFormat
, width
,
1330 format
, type
, table
);
1333 GLvoid
*image
= unpack_image(1, width
, 1, 1, format
, type
, table
,
1336 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1337 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COLOR_TABLE
, 6 );
1340 n
[2].e
= internalFormat
;
1349 if (ctx
->ExecuteFlag
) {
1350 (*ctx
->Exec
->ColorTable
)( target
, internalFormat
, width
,
1351 format
, type
, table
);
1358 static void GLAPIENTRY
1359 save_ColorTableParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
1361 GET_CURRENT_CONTEXT(ctx
);
1364 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1366 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COLOR_TABLE_PARAMETER_FV
, 6 );
1371 if (pname
== GL_COLOR_TABLE_SGI
||
1372 pname
== GL_POST_CONVOLUTION_COLOR_TABLE_SGI
||
1373 pname
== GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI
||
1374 pname
== GL_TEXTURE_COLOR_TABLE_SGI
) {
1381 if (ctx
->ExecuteFlag
) {
1382 (*ctx
->Exec
->ColorTableParameterfv
)( target
, pname
, params
);
1387 static void GLAPIENTRY
1388 save_ColorTableParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
1390 GET_CURRENT_CONTEXT(ctx
);
1393 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1395 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COLOR_TABLE_PARAMETER_IV
, 6 );
1400 if (pname
== GL_COLOR_TABLE_SGI
||
1401 pname
== GL_POST_CONVOLUTION_COLOR_TABLE_SGI
||
1402 pname
== GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI
||
1403 pname
== GL_TEXTURE_COLOR_TABLE_SGI
) {
1410 if (ctx
->ExecuteFlag
) {
1411 (*ctx
->Exec
->ColorTableParameteriv
)( target
, pname
, params
);
1417 static void GLAPIENTRY
save_ColorSubTable( GLenum target
, GLsizei start
, GLsizei count
,
1418 GLenum format
, GLenum type
,
1419 const GLvoid
*table
)
1421 GET_CURRENT_CONTEXT(ctx
);
1422 GLvoid
*image
= unpack_image(1, count
, 1, 1, format
, type
, table
,
1425 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1426 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COLOR_SUB_TABLE
, 6 );
1438 if (ctx
->ExecuteFlag
) {
1439 (*ctx
->Exec
->ColorSubTable
)(target
, start
, count
, format
, type
, table
);
1444 static void GLAPIENTRY
1445 save_CopyColorSubTable(GLenum target
, GLsizei start
,
1446 GLint x
, GLint y
, GLsizei width
)
1448 GET_CURRENT_CONTEXT(ctx
);
1451 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1452 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_COLOR_SUB_TABLE
, 5 );
1460 if (ctx
->ExecuteFlag
) {
1461 (*ctx
->Exec
->CopyColorSubTable
)(target
, start
, x
, y
, width
);
1466 static void GLAPIENTRY
1467 save_CopyColorTable(GLenum target
, GLenum internalformat
,
1468 GLint x
, GLint y
, GLsizei width
)
1470 GET_CURRENT_CONTEXT(ctx
);
1473 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1474 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_COLOR_TABLE
, 5 );
1477 n
[2].e
= internalformat
;
1482 if (ctx
->ExecuteFlag
) {
1483 (*ctx
->Exec
->CopyColorTable
)(target
, internalformat
, x
, y
, width
);
1488 static void GLAPIENTRY
1489 save_ConvolutionFilter1D(GLenum target
, GLenum internalFormat
, GLsizei width
,
1490 GLenum format
, GLenum type
, const GLvoid
*filter
)
1492 GET_CURRENT_CONTEXT(ctx
);
1493 GLvoid
*image
= unpack_image(1, width
, 1, 1, format
, type
, filter
,
1496 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1497 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CONVOLUTION_FILTER_1D
, 6 );
1500 n
[2].e
= internalFormat
;
1509 if (ctx
->ExecuteFlag
) {
1510 (*ctx
->Exec
->ConvolutionFilter1D
)( target
, internalFormat
, width
,
1511 format
, type
, filter
);
1516 static void GLAPIENTRY
1517 save_ConvolutionFilter2D(GLenum target
, GLenum internalFormat
,
1518 GLsizei width
, GLsizei height
, GLenum format
,
1519 GLenum type
, const GLvoid
*filter
)
1521 GET_CURRENT_CONTEXT(ctx
);
1522 GLvoid
*image
= unpack_image(2, width
, height
, 1, format
, type
, filter
,
1525 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1526 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CONVOLUTION_FILTER_2D
, 7 );
1529 n
[2].e
= internalFormat
;
1539 if (ctx
->ExecuteFlag
) {
1540 (*ctx
->Exec
->ConvolutionFilter2D
)( target
, internalFormat
, width
, height
,
1541 format
, type
, filter
);
1546 static void GLAPIENTRY
1547 save_ConvolutionParameteri(GLenum target
, GLenum pname
, GLint param
)
1549 GET_CURRENT_CONTEXT(ctx
);
1551 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1552 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CONVOLUTION_PARAMETER_I
, 3 );
1558 if (ctx
->ExecuteFlag
) {
1559 (*ctx
->Exec
->ConvolutionParameteri
)( target
, pname
, param
);
1564 static void GLAPIENTRY
1565 save_ConvolutionParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
1567 GET_CURRENT_CONTEXT(ctx
);
1569 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1570 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CONVOLUTION_PARAMETER_IV
, 6 );
1575 if (pname
== GL_CONVOLUTION_BORDER_COLOR
||
1576 pname
== GL_CONVOLUTION_FILTER_SCALE
||
1577 pname
== GL_CONVOLUTION_FILTER_BIAS
) {
1583 n
[4].i
= n
[5].i
= n
[6].i
= 0;
1586 if (ctx
->ExecuteFlag
) {
1587 (*ctx
->Exec
->ConvolutionParameteriv
)( target
, pname
, params
);
1592 static void GLAPIENTRY
1593 save_ConvolutionParameterf(GLenum target
, GLenum pname
, GLfloat param
)
1595 GET_CURRENT_CONTEXT(ctx
);
1597 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1598 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CONVOLUTION_PARAMETER_F
, 3 );
1604 if (ctx
->ExecuteFlag
) {
1605 (*ctx
->Exec
->ConvolutionParameterf
)( target
, pname
, param
);
1610 static void GLAPIENTRY
1611 save_ConvolutionParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
1613 GET_CURRENT_CONTEXT(ctx
);
1615 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1616 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CONVOLUTION_PARAMETER_FV
, 6 );
1621 if (pname
== GL_CONVOLUTION_BORDER_COLOR
||
1622 pname
== GL_CONVOLUTION_FILTER_SCALE
||
1623 pname
== GL_CONVOLUTION_FILTER_BIAS
) {
1629 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
1632 if (ctx
->ExecuteFlag
) {
1633 (*ctx
->Exec
->ConvolutionParameterfv
)( target
, pname
, params
);
1638 static void GLAPIENTRY
1639 save_CopyPixels( GLint x
, GLint y
,
1640 GLsizei width
, GLsizei height
, GLenum type
)
1642 GET_CURRENT_CONTEXT(ctx
);
1644 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1645 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_PIXELS
, 5 );
1649 n
[3].i
= (GLint
) width
;
1650 n
[4].i
= (GLint
) height
;
1653 if (ctx
->ExecuteFlag
) {
1654 (*ctx
->Exec
->CopyPixels
)( x
, y
, width
, height
, type
);
1660 static void GLAPIENTRY
1661 save_CopyTexImage1D( GLenum target
, GLint level
, GLenum internalformat
,
1662 GLint x
, GLint y
, GLsizei width
, GLint border
)
1664 GET_CURRENT_CONTEXT(ctx
);
1666 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1667 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_TEX_IMAGE1D
, 7 );
1671 n
[3].e
= internalformat
;
1677 if (ctx
->ExecuteFlag
) {
1678 (*ctx
->Exec
->CopyTexImage1D
)( target
, level
, internalformat
,
1679 x
, y
, width
, border
);
1684 static void GLAPIENTRY
1685 save_CopyTexImage2D( GLenum target
, GLint level
,
1686 GLenum internalformat
,
1687 GLint x
, GLint y
, GLsizei width
,
1688 GLsizei height
, GLint border
)
1690 GET_CURRENT_CONTEXT(ctx
);
1692 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1693 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_TEX_IMAGE2D
, 8 );
1697 n
[3].e
= internalformat
;
1704 if (ctx
->ExecuteFlag
) {
1705 (*ctx
->Exec
->CopyTexImage2D
)( target
, level
, internalformat
,
1706 x
, y
, width
, height
, border
);
1712 static void GLAPIENTRY
1713 save_CopyTexSubImage1D( GLenum target
, GLint level
,
1714 GLint xoffset
, GLint x
, GLint y
,
1717 GET_CURRENT_CONTEXT(ctx
);
1719 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1720 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_TEX_SUB_IMAGE1D
, 6 );
1729 if (ctx
->ExecuteFlag
) {
1730 (*ctx
->Exec
->CopyTexSubImage1D
)( target
, level
, xoffset
, x
, y
, width
);
1735 static void GLAPIENTRY
1736 save_CopyTexSubImage2D( GLenum target
, GLint level
,
1737 GLint xoffset
, GLint yoffset
,
1739 GLsizei width
, GLint height
)
1741 GET_CURRENT_CONTEXT(ctx
);
1743 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1744 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_TEX_SUB_IMAGE2D
, 8 );
1755 if (ctx
->ExecuteFlag
) {
1756 (*ctx
->Exec
->CopyTexSubImage2D
)( target
, level
, xoffset
, yoffset
,
1757 x
, y
, width
, height
);
1762 static void GLAPIENTRY
1763 save_CopyTexSubImage3D( GLenum target
, GLint level
,
1764 GLint xoffset
, GLint yoffset
, GLint zoffset
,
1766 GLsizei width
, GLint height
)
1768 GET_CURRENT_CONTEXT(ctx
);
1770 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1771 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_TEX_SUB_IMAGE3D
, 9 );
1783 if (ctx
->ExecuteFlag
) {
1784 (*ctx
->Exec
->CopyTexSubImage3D
)( target
, level
,
1785 xoffset
, yoffset
, zoffset
,
1786 x
, y
, width
, height
);
1791 static void GLAPIENTRY
save_CullFace( GLenum mode
)
1793 GET_CURRENT_CONTEXT(ctx
);
1795 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1796 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CULL_FACE
, 1 );
1800 if (ctx
->ExecuteFlag
) {
1801 (*ctx
->Exec
->CullFace
)( mode
);
1806 static void GLAPIENTRY
save_DepthFunc( GLenum func
)
1808 GET_CURRENT_CONTEXT(ctx
);
1810 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1811 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_DEPTH_FUNC
, 1 );
1815 if (ctx
->ExecuteFlag
) {
1816 (*ctx
->Exec
->DepthFunc
)( func
);
1821 static void GLAPIENTRY
save_DepthMask( GLboolean mask
)
1823 GET_CURRENT_CONTEXT(ctx
);
1825 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1826 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_DEPTH_MASK
, 1 );
1830 if (ctx
->ExecuteFlag
) {
1831 (*ctx
->Exec
->DepthMask
)( mask
);
1836 static void GLAPIENTRY
save_DepthRange( GLclampd nearval
, GLclampd farval
)
1838 GET_CURRENT_CONTEXT(ctx
);
1840 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1841 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_DEPTH_RANGE
, 2 );
1843 n
[1].f
= (GLfloat
) nearval
;
1844 n
[2].f
= (GLfloat
) farval
;
1846 if (ctx
->ExecuteFlag
) {
1847 (*ctx
->Exec
->DepthRange
)( nearval
, farval
);
1852 static void GLAPIENTRY
save_Disable( GLenum cap
)
1854 GET_CURRENT_CONTEXT(ctx
);
1856 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1857 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_DISABLE
, 1 );
1861 if (ctx
->ExecuteFlag
) {
1862 (*ctx
->Exec
->Disable
)( cap
);
1867 static void GLAPIENTRY
save_DrawBuffer( GLenum mode
)
1869 GET_CURRENT_CONTEXT(ctx
);
1871 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1872 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_DRAW_BUFFER
, 1 );
1876 if (ctx
->ExecuteFlag
) {
1877 (*ctx
->Exec
->DrawBuffer
)( mode
);
1882 static void GLAPIENTRY
save_DrawPixels( GLsizei width
, GLsizei height
,
1883 GLenum format
, GLenum type
,
1884 const GLvoid
*pixels
)
1886 GET_CURRENT_CONTEXT(ctx
);
1887 GLvoid
*image
= unpack_image(2, width
, height
, 1, format
, type
,
1888 pixels
, &ctx
->Unpack
);
1890 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1891 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_DRAW_PIXELS
, 5 );
1902 if (ctx
->ExecuteFlag
) {
1903 (*ctx
->Exec
->DrawPixels
)( width
, height
, format
, type
, pixels
);
1909 static void GLAPIENTRY
save_Enable( GLenum cap
)
1911 GET_CURRENT_CONTEXT(ctx
);
1913 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1914 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ENABLE
, 1 );
1918 if (ctx
->ExecuteFlag
) {
1919 (*ctx
->Exec
->Enable
)( cap
);
1925 void GLAPIENTRY
_mesa_save_EvalMesh1( GLenum mode
, GLint i1
, GLint i2
)
1927 GET_CURRENT_CONTEXT(ctx
);
1929 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1930 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_EVALMESH1
, 3 );
1936 if (ctx
->ExecuteFlag
) {
1937 (*ctx
->Exec
->EvalMesh1
)( mode
, i1
, i2
);
1942 void GLAPIENTRY
_mesa_save_EvalMesh2(GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
1944 GET_CURRENT_CONTEXT(ctx
);
1946 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1947 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_EVALMESH2
, 5 );
1955 if (ctx
->ExecuteFlag
) {
1956 (*ctx
->Exec
->EvalMesh2
)( mode
, i1
, i2
, j1
, j2
);
1963 static void GLAPIENTRY
save_Fogfv( GLenum pname
, const GLfloat
*params
)
1965 GET_CURRENT_CONTEXT(ctx
);
1967 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1968 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_FOG
, 5 );
1976 if (ctx
->ExecuteFlag
) {
1977 (*ctx
->Exec
->Fogfv
)( pname
, params
);
1982 static void GLAPIENTRY
save_Fogf( GLenum pname
, GLfloat param
)
1984 save_Fogfv(pname
, ¶m
);
1988 static void GLAPIENTRY
save_Fogiv(GLenum pname
, const GLint
*params
)
1993 case GL_FOG_DENSITY
:
1997 p
[0] = (GLfloat
) *params
;
2000 p
[0] = INT_TO_FLOAT( params
[0] );
2001 p
[1] = INT_TO_FLOAT( params
[1] );
2002 p
[2] = INT_TO_FLOAT( params
[2] );
2003 p
[3] = INT_TO_FLOAT( params
[3] );
2006 /* Error will be caught later in gl_Fogfv */
2009 save_Fogfv(pname
, p
);
2013 static void GLAPIENTRY
save_Fogi(GLenum pname
, GLint param
)
2015 save_Fogiv(pname
, ¶m
);
2019 static void GLAPIENTRY
save_FrontFace( GLenum mode
)
2021 GET_CURRENT_CONTEXT(ctx
);
2023 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2024 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_FRONT_FACE
, 1 );
2028 if (ctx
->ExecuteFlag
) {
2029 (*ctx
->Exec
->FrontFace
)( mode
);
2034 static void GLAPIENTRY
save_Frustum( GLdouble left
, GLdouble right
,
2035 GLdouble bottom
, GLdouble top
,
2036 GLdouble nearval
, GLdouble farval
)
2038 GET_CURRENT_CONTEXT(ctx
);
2040 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2041 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_FRUSTUM
, 6 );
2043 n
[1].f
= (GLfloat
) left
;
2044 n
[2].f
= (GLfloat
) right
;
2045 n
[3].f
= (GLfloat
) bottom
;
2046 n
[4].f
= (GLfloat
) top
;
2047 n
[5].f
= (GLfloat
) nearval
;
2048 n
[6].f
= (GLfloat
) farval
;
2050 if (ctx
->ExecuteFlag
) {
2051 (*ctx
->Exec
->Frustum
)( left
, right
, bottom
, top
, nearval
, farval
);
2056 static void GLAPIENTRY
save_Hint( GLenum target
, GLenum mode
)
2058 GET_CURRENT_CONTEXT(ctx
);
2060 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2061 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_HINT
, 2 );
2066 if (ctx
->ExecuteFlag
) {
2067 (*ctx
->Exec
->Hint
)( target
, mode
);
2072 static void GLAPIENTRY
2073 save_Histogram(GLenum target
, GLsizei width
, GLenum internalFormat
, GLboolean sink
)
2075 GET_CURRENT_CONTEXT(ctx
);
2078 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2079 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_HISTOGRAM
, 4 );
2083 n
[3].e
= internalFormat
;
2086 if (ctx
->ExecuteFlag
) {
2087 (*ctx
->Exec
->Histogram
)( target
, width
, internalFormat
, sink
);
2092 static void GLAPIENTRY
save_IndexMask( GLuint mask
)
2094 GET_CURRENT_CONTEXT(ctx
);
2096 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2097 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_INDEX_MASK
, 1 );
2101 if (ctx
->ExecuteFlag
) {
2102 (*ctx
->Exec
->IndexMask
)( mask
);
2107 static void GLAPIENTRY
save_InitNames( void )
2109 GET_CURRENT_CONTEXT(ctx
);
2110 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2111 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_INIT_NAMES
, 0 );
2112 if (ctx
->ExecuteFlag
) {
2113 (*ctx
->Exec
->InitNames
)();
2118 static void GLAPIENTRY
save_Lightfv( GLenum light
, GLenum pname
, const GLfloat
*params
)
2120 GET_CURRENT_CONTEXT(ctx
);
2122 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2123 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LIGHT
, 6 );
2141 case GL_SPOT_DIRECTION
:
2144 case GL_SPOT_EXPONENT
:
2147 case GL_SPOT_CUTOFF
:
2150 case GL_CONSTANT_ATTENUATION
:
2153 case GL_LINEAR_ATTENUATION
:
2156 case GL_QUADRATIC_ATTENUATION
:
2162 for (i
= 0; i
< nParams
; i
++) {
2163 n
[3+i
].f
= params
[i
];
2166 if (ctx
->ExecuteFlag
) {
2167 (*ctx
->Exec
->Lightfv
)( light
, pname
, params
);
2172 static void GLAPIENTRY
save_Lightf( GLenum light
, GLenum pname
, GLfloat params
)
2174 save_Lightfv(light
, pname
, ¶ms
);
2178 static void GLAPIENTRY
save_Lightiv( GLenum light
, GLenum pname
, const GLint
*params
)
2185 fparam
[0] = INT_TO_FLOAT( params
[0] );
2186 fparam
[1] = INT_TO_FLOAT( params
[1] );
2187 fparam
[2] = INT_TO_FLOAT( params
[2] );
2188 fparam
[3] = INT_TO_FLOAT( params
[3] );
2191 fparam
[0] = (GLfloat
) params
[0];
2192 fparam
[1] = (GLfloat
) params
[1];
2193 fparam
[2] = (GLfloat
) params
[2];
2194 fparam
[3] = (GLfloat
) params
[3];
2196 case GL_SPOT_DIRECTION
:
2197 fparam
[0] = (GLfloat
) params
[0];
2198 fparam
[1] = (GLfloat
) params
[1];
2199 fparam
[2] = (GLfloat
) params
[2];
2201 case GL_SPOT_EXPONENT
:
2202 case GL_SPOT_CUTOFF
:
2203 case GL_CONSTANT_ATTENUATION
:
2204 case GL_LINEAR_ATTENUATION
:
2205 case GL_QUADRATIC_ATTENUATION
:
2206 fparam
[0] = (GLfloat
) params
[0];
2209 /* error will be caught later in gl_Lightfv */
2212 save_Lightfv( light
, pname
, fparam
);
2216 static void GLAPIENTRY
save_Lighti( GLenum light
, GLenum pname
, GLint param
)
2218 save_Lightiv( light
, pname
, ¶m
);
2222 static void GLAPIENTRY
save_LightModelfv( GLenum pname
, const GLfloat
*params
)
2224 GET_CURRENT_CONTEXT(ctx
);
2226 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2227 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LIGHT_MODEL
, 5 );
2235 if (ctx
->ExecuteFlag
) {
2236 (*ctx
->Exec
->LightModelfv
)( pname
, params
);
2241 static void GLAPIENTRY
save_LightModelf( GLenum pname
, GLfloat param
)
2243 save_LightModelfv(pname
, ¶m
);
2247 static void GLAPIENTRY
save_LightModeliv( GLenum pname
, const GLint
*params
)
2251 case GL_LIGHT_MODEL_AMBIENT
:
2252 fparam
[0] = INT_TO_FLOAT( params
[0] );
2253 fparam
[1] = INT_TO_FLOAT( params
[1] );
2254 fparam
[2] = INT_TO_FLOAT( params
[2] );
2255 fparam
[3] = INT_TO_FLOAT( params
[3] );
2257 case GL_LIGHT_MODEL_LOCAL_VIEWER
:
2258 case GL_LIGHT_MODEL_TWO_SIDE
:
2259 case GL_LIGHT_MODEL_COLOR_CONTROL
:
2260 fparam
[0] = (GLfloat
) params
[0];
2263 /* Error will be caught later in gl_LightModelfv */
2266 save_LightModelfv(pname
, fparam
);
2270 static void GLAPIENTRY
save_LightModeli( GLenum pname
, GLint param
)
2272 save_LightModeliv(pname
, ¶m
);
2276 static void GLAPIENTRY
save_LineStipple( GLint factor
, GLushort pattern
)
2278 GET_CURRENT_CONTEXT(ctx
);
2280 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2281 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LINE_STIPPLE
, 2 );
2286 if (ctx
->ExecuteFlag
) {
2287 (*ctx
->Exec
->LineStipple
)( factor
, pattern
);
2292 static void GLAPIENTRY
save_LineWidth( GLfloat width
)
2294 GET_CURRENT_CONTEXT(ctx
);
2296 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2297 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LINE_WIDTH
, 1 );
2301 if (ctx
->ExecuteFlag
) {
2302 (*ctx
->Exec
->LineWidth
)( width
);
2307 static void GLAPIENTRY
save_ListBase( GLuint base
)
2309 GET_CURRENT_CONTEXT(ctx
);
2311 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2312 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LIST_BASE
, 1 );
2316 if (ctx
->ExecuteFlag
) {
2317 (*ctx
->Exec
->ListBase
)( base
);
2322 static void GLAPIENTRY
save_LoadIdentity( void )
2324 GET_CURRENT_CONTEXT(ctx
);
2325 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2326 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_LOAD_IDENTITY
, 0 );
2327 if (ctx
->ExecuteFlag
) {
2328 (*ctx
->Exec
->LoadIdentity
)();
2333 static void GLAPIENTRY
save_LoadMatrixf( const GLfloat
*m
)
2335 GET_CURRENT_CONTEXT(ctx
);
2337 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2338 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LOAD_MATRIX
, 16 );
2341 for (i
=0;i
<16;i
++) {
2345 if (ctx
->ExecuteFlag
) {
2346 (*ctx
->Exec
->LoadMatrixf
)( m
);
2351 static void GLAPIENTRY
save_LoadMatrixd( const GLdouble
*m
)
2355 for (i
= 0; i
< 16; i
++) {
2356 f
[i
] = (GLfloat
) m
[i
];
2358 save_LoadMatrixf(f
);
2362 static void GLAPIENTRY
save_LoadName( GLuint name
)
2364 GET_CURRENT_CONTEXT(ctx
);
2366 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2367 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LOAD_NAME
, 1 );
2371 if (ctx
->ExecuteFlag
) {
2372 (*ctx
->Exec
->LoadName
)( name
);
2377 static void GLAPIENTRY
save_LogicOp( GLenum opcode
)
2379 GET_CURRENT_CONTEXT(ctx
);
2381 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2382 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LOGIC_OP
, 1 );
2386 if (ctx
->ExecuteFlag
) {
2387 (*ctx
->Exec
->LogicOp
)( opcode
);
2392 static void GLAPIENTRY
save_Map1d( GLenum target
, GLdouble u1
, GLdouble u2
, GLint stride
,
2393 GLint order
, const GLdouble
*points
)
2395 GET_CURRENT_CONTEXT(ctx
);
2397 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2398 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MAP1
, 6 );
2400 GLfloat
*pnts
= _mesa_copy_map_points1d( target
, stride
, order
, points
);
2402 n
[2].f
= (GLfloat
) u1
;
2403 n
[3].f
= (GLfloat
) u2
;
2404 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2406 n
[6].data
= (void *) pnts
;
2408 if (ctx
->ExecuteFlag
) {
2409 (*ctx
->Exec
->Map1d
)( target
, u1
, u2
, stride
, order
, points
);
2413 static void GLAPIENTRY
save_Map1f( GLenum target
, GLfloat u1
, GLfloat u2
, GLint stride
,
2414 GLint order
, const GLfloat
*points
)
2416 GET_CURRENT_CONTEXT(ctx
);
2418 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2419 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MAP1
, 6 );
2421 GLfloat
*pnts
= _mesa_copy_map_points1f( target
, stride
, order
, points
);
2425 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2427 n
[6].data
= (void *) pnts
;
2429 if (ctx
->ExecuteFlag
) {
2430 (*ctx
->Exec
->Map1f
)( target
, u1
, u2
, stride
, order
, points
);
2435 static void GLAPIENTRY
save_Map2d( GLenum target
,
2436 GLdouble u1
, GLdouble u2
, GLint ustride
, GLint uorder
,
2437 GLdouble v1
, GLdouble v2
, GLint vstride
, GLint vorder
,
2438 const GLdouble
*points
)
2440 GET_CURRENT_CONTEXT(ctx
);
2442 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2443 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MAP2
, 10 );
2445 GLfloat
*pnts
= _mesa_copy_map_points2d( target
, ustride
, uorder
,
2446 vstride
, vorder
, points
);
2448 n
[2].f
= (GLfloat
) u1
;
2449 n
[3].f
= (GLfloat
) u2
;
2450 n
[4].f
= (GLfloat
) v1
;
2451 n
[5].f
= (GLfloat
) v2
;
2452 /* XXX verify these strides are correct */
2453 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride*/
2454 n
[7].i
= _mesa_evaluator_components(target
); /*vstride*/
2457 n
[10].data
= (void *) pnts
;
2459 if (ctx
->ExecuteFlag
) {
2460 (*ctx
->Exec
->Map2d
)( target
,
2461 u1
, u2
, ustride
, uorder
,
2462 v1
, v2
, vstride
, vorder
, points
);
2467 static void GLAPIENTRY
save_Map2f( GLenum target
,
2468 GLfloat u1
, GLfloat u2
, GLint ustride
, GLint uorder
,
2469 GLfloat v1
, GLfloat v2
, GLint vstride
, GLint vorder
,
2470 const GLfloat
*points
)
2472 GET_CURRENT_CONTEXT(ctx
);
2474 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2475 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MAP2
, 10 );
2477 GLfloat
*pnts
= _mesa_copy_map_points2f( target
, ustride
, uorder
,
2478 vstride
, vorder
, points
);
2484 /* XXX verify these strides are correct */
2485 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride*/
2486 n
[7].i
= _mesa_evaluator_components(target
); /*vstride*/
2489 n
[10].data
= (void *) pnts
;
2491 if (ctx
->ExecuteFlag
) {
2492 (*ctx
->Exec
->Map2f
)( target
, u1
, u2
, ustride
, uorder
,
2493 v1
, v2
, vstride
, vorder
, points
);
2498 static void GLAPIENTRY
save_MapGrid1f( GLint un
, GLfloat u1
, GLfloat u2
)
2500 GET_CURRENT_CONTEXT(ctx
);
2502 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2503 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MAPGRID1
, 3 );
2509 if (ctx
->ExecuteFlag
) {
2510 (*ctx
->Exec
->MapGrid1f
)( un
, u1
, u2
);
2515 static void GLAPIENTRY
save_MapGrid1d( GLint un
, GLdouble u1
, GLdouble u2
)
2517 save_MapGrid1f(un
, (GLfloat
) u1
, (GLfloat
) u2
);
2521 static void GLAPIENTRY
save_MapGrid2f( GLint un
, GLfloat u1
, GLfloat u2
,
2522 GLint vn
, GLfloat v1
, GLfloat v2
)
2524 GET_CURRENT_CONTEXT(ctx
);
2526 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2527 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MAPGRID2
, 6 );
2536 if (ctx
->ExecuteFlag
) {
2537 (*ctx
->Exec
->MapGrid2f
)( un
, u1
, u2
, vn
, v1
, v2
);
2543 static void GLAPIENTRY
save_MapGrid2d( GLint un
, GLdouble u1
, GLdouble u2
,
2544 GLint vn
, GLdouble v1
, GLdouble v2
)
2546 save_MapGrid2f(un
, (GLfloat
) u1
, (GLfloat
) u2
,
2547 vn
, (GLfloat
) v1
, (GLfloat
) v2
);
2551 static void GLAPIENTRY
save_MatrixMode( GLenum mode
)
2553 GET_CURRENT_CONTEXT(ctx
);
2555 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2556 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MATRIX_MODE
, 1 );
2560 if (ctx
->ExecuteFlag
) {
2561 (*ctx
->Exec
->MatrixMode
)( mode
);
2566 static void GLAPIENTRY
2567 save_Minmax(GLenum target
, GLenum internalFormat
, GLboolean sink
)
2569 GET_CURRENT_CONTEXT(ctx
);
2572 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2573 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MIN_MAX
, 3 );
2576 n
[2].e
= internalFormat
;
2579 if (ctx
->ExecuteFlag
) {
2580 (*ctx
->Exec
->Minmax
)( target
, internalFormat
, sink
);
2585 static void GLAPIENTRY
save_MultMatrixf( const GLfloat
*m
)
2587 GET_CURRENT_CONTEXT(ctx
);
2589 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2590 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MULT_MATRIX
, 16 );
2593 for (i
=0;i
<16;i
++) {
2597 if (ctx
->ExecuteFlag
) {
2598 (*ctx
->Exec
->MultMatrixf
)( m
);
2603 static void GLAPIENTRY
save_MultMatrixd( const GLdouble
*m
)
2607 for (i
= 0; i
< 16; i
++) {
2608 f
[i
] = (GLfloat
) m
[i
];
2610 save_MultMatrixf(f
);
2614 static void GLAPIENTRY
save_NewList( GLuint list
, GLenum mode
)
2616 GET_CURRENT_CONTEXT(ctx
);
2617 /* It's an error to call this function while building a display list */
2618 _mesa_error( ctx
, GL_INVALID_OPERATION
, "glNewList" );
2625 static void GLAPIENTRY
save_Ortho( GLdouble left
, GLdouble right
,
2626 GLdouble bottom
, GLdouble top
,
2627 GLdouble nearval
, GLdouble farval
)
2629 GET_CURRENT_CONTEXT(ctx
);
2631 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2632 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ORTHO
, 6 );
2634 n
[1].f
= (GLfloat
) left
;
2635 n
[2].f
= (GLfloat
) right
;
2636 n
[3].f
= (GLfloat
) bottom
;
2637 n
[4].f
= (GLfloat
) top
;
2638 n
[5].f
= (GLfloat
) nearval
;
2639 n
[6].f
= (GLfloat
) farval
;
2641 if (ctx
->ExecuteFlag
) {
2642 (*ctx
->Exec
->Ortho
)( left
, right
, bottom
, top
, nearval
, farval
);
2647 static void GLAPIENTRY
2648 save_PixelMapfv( GLenum map
, GLint mapsize
, const GLfloat
*values
)
2650 GET_CURRENT_CONTEXT(ctx
);
2652 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2653 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PIXEL_MAP
, 3 );
2657 n
[3].data
= (void *) MALLOC( mapsize
* sizeof(GLfloat
) );
2658 MEMCPY( n
[3].data
, (void *) values
, mapsize
* sizeof(GLfloat
) );
2660 if (ctx
->ExecuteFlag
) {
2661 (*ctx
->Exec
->PixelMapfv
)( map
, mapsize
, values
);
2666 static void GLAPIENTRY
2667 save_PixelMapuiv(GLenum map
, GLint mapsize
, const GLuint
*values
)
2669 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2671 if (map
==GL_PIXEL_MAP_I_TO_I
|| map
==GL_PIXEL_MAP_S_TO_S
) {
2672 for (i
=0;i
<mapsize
;i
++) {
2673 fvalues
[i
] = (GLfloat
) values
[i
];
2677 for (i
=0;i
<mapsize
;i
++) {
2678 fvalues
[i
] = UINT_TO_FLOAT( values
[i
] );
2681 save_PixelMapfv(map
, mapsize
, fvalues
);
2685 static void GLAPIENTRY
2686 save_PixelMapusv(GLenum map
, GLint mapsize
, const GLushort
*values
)
2688 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2690 if (map
==GL_PIXEL_MAP_I_TO_I
|| map
==GL_PIXEL_MAP_S_TO_S
) {
2691 for (i
=0;i
<mapsize
;i
++) {
2692 fvalues
[i
] = (GLfloat
) values
[i
];
2696 for (i
=0;i
<mapsize
;i
++) {
2697 fvalues
[i
] = USHORT_TO_FLOAT( values
[i
] );
2700 save_PixelMapfv(map
, mapsize
, fvalues
);
2704 static void GLAPIENTRY
2705 save_PixelTransferf( GLenum pname
, GLfloat param
)
2707 GET_CURRENT_CONTEXT(ctx
);
2709 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2710 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PIXEL_TRANSFER
, 2 );
2715 if (ctx
->ExecuteFlag
) {
2716 (*ctx
->Exec
->PixelTransferf
)( pname
, param
);
2721 static void GLAPIENTRY
2722 save_PixelTransferi( GLenum pname
, GLint param
)
2724 save_PixelTransferf( pname
, (GLfloat
) param
);
2728 static void GLAPIENTRY
2729 save_PixelZoom( GLfloat xfactor
, GLfloat yfactor
)
2731 GET_CURRENT_CONTEXT(ctx
);
2733 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2734 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PIXEL_ZOOM
, 2 );
2739 if (ctx
->ExecuteFlag
) {
2740 (*ctx
->Exec
->PixelZoom
)( xfactor
, yfactor
);
2745 static void GLAPIENTRY
2746 save_PointParameterfvEXT( GLenum pname
, const GLfloat
*params
)
2748 GET_CURRENT_CONTEXT(ctx
);
2750 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2751 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_POINT_PARAMETERS
, 4 );
2758 if (ctx
->ExecuteFlag
) {
2759 (*ctx
->Exec
->PointParameterfvEXT
)( pname
, params
);
2764 static void GLAPIENTRY
save_PointParameterfEXT( GLenum pname
, GLfloat param
)
2766 save_PointParameterfvEXT(pname
, ¶m
);
2769 static void GLAPIENTRY
save_PointParameteriNV( GLenum pname
, GLint param
)
2771 GLfloat p
= (GLfloat
) param
;
2772 save_PointParameterfvEXT(pname
, &p
);
2775 static void GLAPIENTRY
save_PointParameterivNV( GLenum pname
, const GLint
*param
)
2777 GLfloat p
= (GLfloat
) param
[0];
2778 save_PointParameterfvEXT(pname
, &p
);
2782 static void GLAPIENTRY
save_PointSize( GLfloat size
)
2784 GET_CURRENT_CONTEXT(ctx
);
2786 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2787 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_POINT_SIZE
, 1 );
2791 if (ctx
->ExecuteFlag
) {
2792 (*ctx
->Exec
->PointSize
)( size
);
2797 static void GLAPIENTRY
save_PolygonMode( GLenum face
, GLenum mode
)
2799 GET_CURRENT_CONTEXT(ctx
);
2801 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2802 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_POLYGON_MODE
, 2 );
2807 if (ctx
->ExecuteFlag
) {
2808 (*ctx
->Exec
->PolygonMode
)( face
, mode
);
2814 * Polygon stipple must have been upacked already!
2816 static void GLAPIENTRY
save_PolygonStipple( const GLubyte
*pattern
)
2818 GET_CURRENT_CONTEXT(ctx
);
2820 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2821 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_POLYGON_STIPPLE
, 1 );
2824 n
[1].data
= MALLOC( 32 * 4 );
2825 data
= n
[1].data
; /* This needed for Acorn compiler */
2826 MEMCPY( data
, pattern
, 32 * 4 );
2828 if (ctx
->ExecuteFlag
) {
2829 (*ctx
->Exec
->PolygonStipple
)( (GLubyte
*) pattern
);
2834 static void GLAPIENTRY
save_PolygonOffset( GLfloat factor
, GLfloat units
)
2836 GET_CURRENT_CONTEXT(ctx
);
2838 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2839 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_POLYGON_OFFSET
, 2 );
2844 if (ctx
->ExecuteFlag
) {
2845 (*ctx
->Exec
->PolygonOffset
)( factor
, units
);
2850 static void GLAPIENTRY
save_PolygonOffsetEXT( GLfloat factor
, GLfloat bias
)
2852 GET_CURRENT_CONTEXT(ctx
);
2853 /* XXX mult by DepthMaxF here??? */
2854 save_PolygonOffset(factor
, ctx
->DrawBuffer
->_DepthMaxF
* bias
);
2858 static void GLAPIENTRY
save_PopAttrib( void )
2860 GET_CURRENT_CONTEXT(ctx
);
2861 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2862 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_POP_ATTRIB
, 0 );
2863 if (ctx
->ExecuteFlag
) {
2864 (*ctx
->Exec
->PopAttrib
)();
2869 static void GLAPIENTRY
save_PopMatrix( void )
2871 GET_CURRENT_CONTEXT(ctx
);
2872 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2873 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_POP_MATRIX
, 0 );
2874 if (ctx
->ExecuteFlag
) {
2875 (*ctx
->Exec
->PopMatrix
)();
2880 static void GLAPIENTRY
save_PopName( void )
2882 GET_CURRENT_CONTEXT(ctx
);
2883 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2884 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_POP_NAME
, 0 );
2885 if (ctx
->ExecuteFlag
) {
2886 (*ctx
->Exec
->PopName
)();
2891 static void GLAPIENTRY
save_PrioritizeTextures( GLsizei num
, const GLuint
*textures
,
2892 const GLclampf
*priorities
)
2894 GET_CURRENT_CONTEXT(ctx
);
2896 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2898 for (i
=0;i
<num
;i
++) {
2900 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PRIORITIZE_TEXTURE
, 2 );
2902 n
[1].ui
= textures
[i
];
2903 n
[2].f
= priorities
[i
];
2906 if (ctx
->ExecuteFlag
) {
2907 (*ctx
->Exec
->PrioritizeTextures
)( num
, textures
, priorities
);
2912 static void GLAPIENTRY
save_PushAttrib( GLbitfield mask
)
2914 GET_CURRENT_CONTEXT(ctx
);
2916 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2917 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PUSH_ATTRIB
, 1 );
2921 if (ctx
->ExecuteFlag
) {
2922 (*ctx
->Exec
->PushAttrib
)( mask
);
2927 static void GLAPIENTRY
save_PushMatrix( void )
2929 GET_CURRENT_CONTEXT(ctx
);
2930 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2931 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_PUSH_MATRIX
, 0 );
2932 if (ctx
->ExecuteFlag
) {
2933 (*ctx
->Exec
->PushMatrix
)();
2938 static void GLAPIENTRY
save_PushName( GLuint name
)
2940 GET_CURRENT_CONTEXT(ctx
);
2942 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2943 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PUSH_NAME
, 1 );
2947 if (ctx
->ExecuteFlag
) {
2948 (*ctx
->Exec
->PushName
)( name
);
2953 static void GLAPIENTRY
save_RasterPos4f( GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
2955 GET_CURRENT_CONTEXT(ctx
);
2957 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2958 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_RASTER_POS
, 4 );
2965 if (ctx
->ExecuteFlag
) {
2966 (*ctx
->Exec
->RasterPos4f
)( x
, y
, z
, w
);
2970 static void GLAPIENTRY
save_RasterPos2d(GLdouble x
, GLdouble y
)
2972 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
2975 static void GLAPIENTRY
save_RasterPos2f(GLfloat x
, GLfloat y
)
2977 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2980 static void GLAPIENTRY
save_RasterPos2i(GLint x
, GLint y
)
2982 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
2985 static void GLAPIENTRY
save_RasterPos2s(GLshort x
, GLshort y
)
2987 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2990 static void GLAPIENTRY
save_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
2992 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
2995 static void GLAPIENTRY
save_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
2997 save_RasterPos4f(x
, y
, z
, 1.0F
);
3000 static void GLAPIENTRY
save_RasterPos3i(GLint x
, GLint y
, GLint z
)
3002 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3005 static void GLAPIENTRY
save_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
3007 save_RasterPos4f(x
, y
, z
, 1.0F
);
3010 static void GLAPIENTRY
save_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3012 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3015 static void GLAPIENTRY
save_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
3017 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3020 static void GLAPIENTRY
save_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
3022 save_RasterPos4f(x
, y
, z
, w
);
3025 static void GLAPIENTRY
save_RasterPos2dv(const GLdouble
*v
)
3027 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3030 static void GLAPIENTRY
save_RasterPos2fv(const GLfloat
*v
)
3032 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3035 static void GLAPIENTRY
save_RasterPos2iv(const GLint
*v
)
3037 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3040 static void GLAPIENTRY
save_RasterPos2sv(const GLshort
*v
)
3042 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3045 static void GLAPIENTRY
save_RasterPos3dv(const GLdouble
*v
)
3047 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3050 static void GLAPIENTRY
save_RasterPos3fv(const GLfloat
*v
)
3052 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3055 static void GLAPIENTRY
save_RasterPos3iv(const GLint
*v
)
3057 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3060 static void GLAPIENTRY
save_RasterPos3sv(const GLshort
*v
)
3062 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3065 static void GLAPIENTRY
save_RasterPos4dv(const GLdouble
*v
)
3067 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3068 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3071 static void GLAPIENTRY
save_RasterPos4fv(const GLfloat
*v
)
3073 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3076 static void GLAPIENTRY
save_RasterPos4iv(const GLint
*v
)
3078 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3079 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3082 static void GLAPIENTRY
save_RasterPos4sv(const GLshort
*v
)
3084 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3088 static void GLAPIENTRY
save_PassThrough( GLfloat token
)
3090 GET_CURRENT_CONTEXT(ctx
);
3092 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3093 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PASSTHROUGH
, 1 );
3097 if (ctx
->ExecuteFlag
) {
3098 (*ctx
->Exec
->PassThrough
)( token
);
3103 static void GLAPIENTRY
save_ReadBuffer( GLenum mode
)
3105 GET_CURRENT_CONTEXT(ctx
);
3107 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3108 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_READ_BUFFER
, 1 );
3112 if (ctx
->ExecuteFlag
) {
3113 (*ctx
->Exec
->ReadBuffer
)( mode
);
3118 static void GLAPIENTRY
3119 save_ResetHistogram(GLenum target
)
3121 GET_CURRENT_CONTEXT(ctx
);
3123 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3124 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_RESET_HISTOGRAM
, 1 );
3128 if (ctx
->ExecuteFlag
) {
3129 (*ctx
->Exec
->ResetHistogram
)( target
);
3134 static void GLAPIENTRY
3135 save_ResetMinmax(GLenum target
)
3137 GET_CURRENT_CONTEXT(ctx
);
3139 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3140 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_RESET_MIN_MAX
, 1 );
3144 if (ctx
->ExecuteFlag
) {
3145 (*ctx
->Exec
->ResetMinmax
)( target
);
3150 static void GLAPIENTRY
save_Rotatef( GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
3152 GET_CURRENT_CONTEXT(ctx
);
3154 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3155 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ROTATE
, 4 );
3162 if (ctx
->ExecuteFlag
) {
3163 (*ctx
->Exec
->Rotatef
)( angle
, x
, y
, z
);
3168 static void GLAPIENTRY
save_Rotated( GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
3170 save_Rotatef((GLfloat
) angle
, (GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3174 static void GLAPIENTRY
save_Scalef( GLfloat x
, GLfloat y
, GLfloat z
)
3176 GET_CURRENT_CONTEXT(ctx
);
3178 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3179 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_SCALE
, 3 );
3185 if (ctx
->ExecuteFlag
) {
3186 (*ctx
->Exec
->Scalef
)( x
, y
, z
);
3191 static void GLAPIENTRY
save_Scaled( GLdouble x
, GLdouble y
, GLdouble z
)
3193 save_Scalef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3197 static void GLAPIENTRY
save_Scissor( GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3199 GET_CURRENT_CONTEXT(ctx
);
3201 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3202 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_SCISSOR
, 4 );
3209 if (ctx
->ExecuteFlag
) {
3210 (*ctx
->Exec
->Scissor
)( x
, y
, width
, height
);
3215 static void GLAPIENTRY
save_ShadeModel( GLenum mode
)
3217 GET_CURRENT_CONTEXT(ctx
);
3219 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3220 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_SHADE_MODEL
, 1 );
3224 if (ctx
->ExecuteFlag
) {
3225 (*ctx
->Exec
->ShadeModel
)( mode
);
3230 static void GLAPIENTRY
save_StencilFunc( GLenum func
, GLint ref
, GLuint mask
)
3232 GET_CURRENT_CONTEXT(ctx
);
3234 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3235 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_STENCIL_FUNC
, 3 );
3241 if (ctx
->ExecuteFlag
) {
3242 (*ctx
->Exec
->StencilFunc
)( func
, ref
, mask
);
3247 static void GLAPIENTRY
save_StencilMask( GLuint mask
)
3249 GET_CURRENT_CONTEXT(ctx
);
3251 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3252 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_STENCIL_MASK
, 1 );
3256 if (ctx
->ExecuteFlag
) {
3257 (*ctx
->Exec
->StencilMask
)( mask
);
3262 static void GLAPIENTRY
save_StencilOp( GLenum fail
, GLenum zfail
, GLenum zpass
)
3264 GET_CURRENT_CONTEXT(ctx
);
3266 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3267 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_STENCIL_OP
, 3 );
3273 if (ctx
->ExecuteFlag
) {
3274 (*ctx
->Exec
->StencilOp
)( fail
, zfail
, zpass
);
3279 static void GLAPIENTRY
3280 save_StencilFuncSeparate(GLenum face
, GLenum func
, GLint ref
, GLuint mask
)
3282 GET_CURRENT_CONTEXT(ctx
);
3284 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3285 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3292 if (ctx
->ExecuteFlag
) {
3293 ctx
->Exec
->StencilFuncSeparate(face
, func
, ref
, mask
);
3298 static void GLAPIENTRY
3299 save_StencilMaskSeparate(GLenum face
, GLuint mask
)
3301 GET_CURRENT_CONTEXT(ctx
);
3303 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3304 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_MASK_SEPARATE
, 2);
3309 if (ctx
->ExecuteFlag
) {
3310 ctx
->Exec
->StencilMaskSeparate(face
, mask
);
3315 static void GLAPIENTRY
3316 save_StencilOpSeparate(GLenum face
, GLenum fail
, GLenum zfail
, GLenum zpass
)
3318 GET_CURRENT_CONTEXT(ctx
);
3320 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3321 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_STENCIL_OP_SEPARATE
, 4 );
3328 if (ctx
->ExecuteFlag
) {
3329 ctx
->Exec
->StencilOpSeparate(face
, fail
, zfail
, zpass
);
3334 static void GLAPIENTRY
save_TexEnvfv( GLenum target
, GLenum pname
, const GLfloat
*params
)
3336 GET_CURRENT_CONTEXT(ctx
);
3338 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3339 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEXENV
, 6 );
3343 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3351 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
3354 if (ctx
->ExecuteFlag
) {
3355 (*ctx
->Exec
->TexEnvfv
)( target
, pname
, params
);
3360 static void GLAPIENTRY
save_TexEnvf( GLenum target
, GLenum pname
, GLfloat param
)
3362 save_TexEnvfv( target
, pname
, ¶m
);
3366 static void GLAPIENTRY
save_TexEnvi( GLenum target
, GLenum pname
, GLint param
)
3369 p
[0] = (GLfloat
) param
;
3370 p
[1] = p
[2] = p
[3] = 0.0;
3371 save_TexEnvfv( target
, pname
, p
);
3375 static void GLAPIENTRY
save_TexEnviv( GLenum target
, GLenum pname
, const GLint
*param
)
3378 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3379 p
[0] = INT_TO_FLOAT( param
[0] );
3380 p
[1] = INT_TO_FLOAT( param
[1] );
3381 p
[2] = INT_TO_FLOAT( param
[2] );
3382 p
[3] = INT_TO_FLOAT( param
[3] );
3385 p
[0] = (GLfloat
) param
[0];
3386 p
[1] = p
[2] = p
[3] = 0.0F
;
3388 save_TexEnvfv( target
, pname
, p
);
3392 static void GLAPIENTRY
save_TexGenfv( GLenum coord
, GLenum pname
, const GLfloat
*params
)
3394 GET_CURRENT_CONTEXT(ctx
);
3396 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3397 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEXGEN
, 6 );
3406 if (ctx
->ExecuteFlag
) {
3407 (*ctx
->Exec
->TexGenfv
)( coord
, pname
, params
);
3412 static void GLAPIENTRY
save_TexGeniv(GLenum coord
, GLenum pname
, const GLint
*params
)
3415 p
[0] = (GLfloat
) params
[0];
3416 p
[1] = (GLfloat
) params
[1];
3417 p
[2] = (GLfloat
) params
[2];
3418 p
[3] = (GLfloat
) params
[3];
3419 save_TexGenfv(coord
, pname
, p
);
3423 static void GLAPIENTRY
save_TexGend(GLenum coord
, GLenum pname
, GLdouble param
)
3425 GLfloat p
= (GLfloat
) param
;
3426 save_TexGenfv( coord
, pname
, &p
);
3430 static void GLAPIENTRY
save_TexGendv(GLenum coord
, GLenum pname
, const GLdouble
*params
)
3433 p
[0] = (GLfloat
) params
[0];
3434 p
[1] = (GLfloat
) params
[1];
3435 p
[2] = (GLfloat
) params
[2];
3436 p
[3] = (GLfloat
) params
[3];
3437 save_TexGenfv( coord
, pname
, p
);
3441 static void GLAPIENTRY
save_TexGenf( GLenum coord
, GLenum pname
, GLfloat param
)
3443 save_TexGenfv(coord
, pname
, ¶m
);
3447 static void GLAPIENTRY
save_TexGeni( GLenum coord
, GLenum pname
, GLint param
)
3449 save_TexGeniv( coord
, pname
, ¶m
);
3453 static void GLAPIENTRY
save_TexParameterfv( GLenum target
,
3454 GLenum pname
, const GLfloat
*params
)
3456 GET_CURRENT_CONTEXT(ctx
);
3458 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3459 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEXPARAMETER
, 6 );
3468 if (ctx
->ExecuteFlag
) {
3469 (*ctx
->Exec
->TexParameterfv
)( target
, pname
, params
);
3474 static void GLAPIENTRY
save_TexParameterf( GLenum target
, GLenum pname
, GLfloat param
)
3476 save_TexParameterfv(target
, pname
, ¶m
);
3480 static void GLAPIENTRY
save_TexParameteri( GLenum target
, GLenum pname
, GLint param
)
3483 fparam
[0] = (GLfloat
) param
;
3484 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
3485 save_TexParameterfv(target
, pname
, fparam
);
3489 static void GLAPIENTRY
save_TexParameteriv( GLenum target
, GLenum pname
, const GLint
*params
)
3492 fparam
[0] = (GLfloat
) params
[0];
3493 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
3494 save_TexParameterfv(target
, pname
, fparam
);
3498 static void GLAPIENTRY
save_TexImage1D( GLenum target
,
3499 GLint level
, GLint components
,
3500 GLsizei width
, GLint border
,
3501 GLenum format
, GLenum type
,
3502 const GLvoid
*pixels
)
3504 GET_CURRENT_CONTEXT(ctx
);
3505 if (target
== GL_PROXY_TEXTURE_1D
) {
3506 /* don't compile, execute immediately */
3507 (*ctx
->Exec
->TexImage1D
)( target
, level
, components
, width
,
3508 border
, format
, type
, pixels
);
3511 GLvoid
*image
= unpack_image(1, width
, 1, 1, format
, type
,
3512 pixels
, &ctx
->Unpack
);
3514 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3515 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_IMAGE1D
, 8 );
3519 n
[3].i
= components
;
3520 n
[4].i
= (GLint
) width
;
3529 if (ctx
->ExecuteFlag
) {
3530 (*ctx
->Exec
->TexImage1D
)( target
, level
, components
, width
,
3531 border
, format
, type
, pixels
);
3537 static void GLAPIENTRY
save_TexImage2D( GLenum target
,
3538 GLint level
, GLint components
,
3539 GLsizei width
, GLsizei height
, GLint border
,
3540 GLenum format
, GLenum type
,
3541 const GLvoid
*pixels
)
3543 GET_CURRENT_CONTEXT(ctx
);
3544 if (target
== GL_PROXY_TEXTURE_2D
) {
3545 /* don't compile, execute immediately */
3546 (*ctx
->Exec
->TexImage2D
)( target
, level
, components
, width
,
3547 height
, border
, format
, type
, pixels
);
3550 GLvoid
*image
= unpack_image(2, width
, height
, 1, format
, type
,
3551 pixels
, &ctx
->Unpack
);
3553 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3554 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_IMAGE2D
, 9 );
3558 n
[3].i
= components
;
3559 n
[4].i
= (GLint
) width
;
3560 n
[5].i
= (GLint
) height
;
3569 if (ctx
->ExecuteFlag
) {
3570 (*ctx
->Exec
->TexImage2D
)( target
, level
, components
, width
,
3571 height
, border
, format
, type
, pixels
);
3577 static void GLAPIENTRY
save_TexImage3D( GLenum target
,
3578 GLint level
, GLint internalFormat
,
3579 GLsizei width
, GLsizei height
, GLsizei depth
,
3581 GLenum format
, GLenum type
,
3582 const GLvoid
*pixels
)
3584 GET_CURRENT_CONTEXT(ctx
);
3585 if (target
== GL_PROXY_TEXTURE_3D
) {
3586 /* don't compile, execute immediately */
3587 (*ctx
->Exec
->TexImage3D
)( target
, level
, internalFormat
, width
,
3588 height
, depth
, border
, format
, type
, pixels
);
3592 GLvoid
*image
= unpack_image(3, width
, height
, depth
, format
, type
,
3593 pixels
, &ctx
->Unpack
);
3594 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3595 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_IMAGE3D
, 10 );
3599 n
[3].i
= (GLint
) internalFormat
;
3600 n
[4].i
= (GLint
) width
;
3601 n
[5].i
= (GLint
) height
;
3602 n
[6].i
= (GLint
) depth
;
3611 if (ctx
->ExecuteFlag
) {
3612 (*ctx
->Exec
->TexImage3D
)( target
, level
, internalFormat
, width
,
3613 height
, depth
, border
, format
, type
, pixels
);
3619 static void GLAPIENTRY
save_TexSubImage1D( GLenum target
, GLint level
, GLint xoffset
,
3620 GLsizei width
, GLenum format
, GLenum type
,
3621 const GLvoid
*pixels
)
3623 GET_CURRENT_CONTEXT(ctx
);
3625 GLvoid
*image
= unpack_image(1, width
, 1, 1, format
, type
,
3626 pixels
, &ctx
->Unpack
);
3627 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3628 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_SUB_IMAGE1D
, 7 );
3633 n
[4].i
= (GLint
) width
;
3641 if (ctx
->ExecuteFlag
) {
3642 (*ctx
->Exec
->TexSubImage1D
)( target
, level
, xoffset
, width
,
3643 format
, type
, pixels
);
3648 static void GLAPIENTRY
save_TexSubImage2D( GLenum target
, GLint level
,
3649 GLint xoffset
, GLint yoffset
,
3650 GLsizei width
, GLsizei height
,
3651 GLenum format
, GLenum type
,
3652 const GLvoid
*pixels
)
3654 GET_CURRENT_CONTEXT(ctx
);
3656 GLvoid
*image
= unpack_image(2, width
, height
, 1, format
, type
,
3657 pixels
, &ctx
->Unpack
);
3658 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3659 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_SUB_IMAGE2D
, 9 );
3665 n
[5].i
= (GLint
) width
;
3666 n
[6].i
= (GLint
) height
;
3674 if (ctx
->ExecuteFlag
) {
3675 (*ctx
->Exec
->TexSubImage2D
)( target
, level
, xoffset
, yoffset
,
3676 width
, height
, format
, type
, pixels
);
3681 static void GLAPIENTRY
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
,
3685 const GLvoid
*pixels
)
3687 GET_CURRENT_CONTEXT(ctx
);
3689 GLvoid
*image
= unpack_image(3, width
, height
, depth
, format
, type
,
3690 pixels
, &ctx
->Unpack
);
3691 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3692 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_SUB_IMAGE3D
, 11 );
3699 n
[6].i
= (GLint
) width
;
3700 n
[7].i
= (GLint
) height
;
3701 n
[8].i
= (GLint
) depth
;
3709 if (ctx
->ExecuteFlag
) {
3710 (*ctx
->Exec
->TexSubImage3D
)( target
, level
,
3711 xoffset
, yoffset
, zoffset
,
3712 width
, height
, depth
, format
, type
, pixels
);
3717 static void GLAPIENTRY
save_Translatef( GLfloat x
, GLfloat y
, GLfloat z
)
3719 GET_CURRENT_CONTEXT(ctx
);
3721 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3722 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TRANSLATE
, 3 );
3728 if (ctx
->ExecuteFlag
) {
3729 (*ctx
->Exec
->Translatef
)( x
, y
, z
);
3734 static void GLAPIENTRY
save_Translated( GLdouble x
, GLdouble y
, GLdouble z
)
3736 save_Translatef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3741 static void GLAPIENTRY
save_Viewport( GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3743 GET_CURRENT_CONTEXT(ctx
);
3745 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3746 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_VIEWPORT
, 4 );
3750 n
[3].i
= (GLint
) width
;
3751 n
[4].i
= (GLint
) height
;
3753 if (ctx
->ExecuteFlag
) {
3754 (*ctx
->Exec
->Viewport
)( x
, y
, width
, height
);
3759 static void GLAPIENTRY
save_WindowPos4fMESA( GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3761 GET_CURRENT_CONTEXT(ctx
);
3763 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3764 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_WINDOW_POS
, 4 );
3771 if (ctx
->ExecuteFlag
) {
3772 (*ctx
->Exec
->WindowPos4fMESA
)( x
, y
, z
, w
);
3776 static void GLAPIENTRY
save_WindowPos2dMESA(GLdouble x
, GLdouble y
)
3778 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3781 static void GLAPIENTRY
save_WindowPos2fMESA(GLfloat x
, GLfloat y
)
3783 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3786 static void GLAPIENTRY
save_WindowPos2iMESA(GLint x
, GLint y
)
3788 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3791 static void GLAPIENTRY
save_WindowPos2sMESA(GLshort x
, GLshort y
)
3793 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3796 static void GLAPIENTRY
save_WindowPos3dMESA(GLdouble x
, GLdouble y
, GLdouble z
)
3798 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3801 static void GLAPIENTRY
save_WindowPos3fMESA(GLfloat x
, GLfloat y
, GLfloat z
)
3803 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3806 static void GLAPIENTRY
save_WindowPos3iMESA(GLint x
, GLint y
, GLint z
)
3808 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3811 static void GLAPIENTRY
save_WindowPos3sMESA(GLshort x
, GLshort y
, GLshort z
)
3813 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3816 static void GLAPIENTRY
save_WindowPos4dMESA(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3818 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3821 static void GLAPIENTRY
save_WindowPos4iMESA(GLint x
, GLint y
, GLint z
, GLint w
)
3823 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3826 static void GLAPIENTRY
save_WindowPos4sMESA(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
3828 save_WindowPos4fMESA(x
, y
, z
, w
);
3831 static void GLAPIENTRY
save_WindowPos2dvMESA(const GLdouble
*v
)
3833 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3836 static void GLAPIENTRY
save_WindowPos2fvMESA(const GLfloat
*v
)
3838 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3841 static void GLAPIENTRY
save_WindowPos2ivMESA(const GLint
*v
)
3843 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3846 static void GLAPIENTRY
save_WindowPos2svMESA(const GLshort
*v
)
3848 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3851 static void GLAPIENTRY
save_WindowPos3dvMESA(const GLdouble
*v
)
3853 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3856 static void GLAPIENTRY
save_WindowPos3fvMESA(const GLfloat
*v
)
3858 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3861 static void GLAPIENTRY
save_WindowPos3ivMESA(const GLint
*v
)
3863 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3866 static void GLAPIENTRY
save_WindowPos3svMESA(const GLshort
*v
)
3868 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3871 static void GLAPIENTRY
save_WindowPos4dvMESA(const GLdouble
*v
)
3873 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
3874 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3877 static void GLAPIENTRY
save_WindowPos4fvMESA(const GLfloat
*v
)
3879 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3882 static void GLAPIENTRY
save_WindowPos4ivMESA(const GLint
*v
)
3884 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
3885 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3888 static void GLAPIENTRY
save_WindowPos4svMESA(const GLshort
*v
)
3890 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3895 /* GL_ARB_multitexture */
3896 static void GLAPIENTRY
save_ActiveTextureARB( GLenum target
)
3898 GET_CURRENT_CONTEXT(ctx
);
3900 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3901 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ACTIVE_TEXTURE
, 1 );
3905 if (ctx
->ExecuteFlag
) {
3906 (*ctx
->Exec
->ActiveTextureARB
)( target
);
3911 /* GL_ARB_transpose_matrix */
3913 static void GLAPIENTRY
save_LoadTransposeMatrixdARB( const GLdouble m
[16] )
3916 _math_transposefd(tm
, m
);
3917 save_LoadMatrixf(tm
);
3921 static void GLAPIENTRY
save_LoadTransposeMatrixfARB( const GLfloat m
[16] )
3924 _math_transposef(tm
, m
);
3925 save_LoadMatrixf(tm
);
3929 static void GLAPIENTRY
3930 save_MultTransposeMatrixdARB( const GLdouble m
[16] )
3933 _math_transposefd(tm
, m
);
3934 save_MultMatrixf(tm
);
3938 static void GLAPIENTRY
3939 save_MultTransposeMatrixfARB( const GLfloat m
[16] )
3942 _math_transposef(tm
, m
);
3943 save_MultMatrixf(tm
);
3947 static void GLAPIENTRY
3948 save_PixelTexGenSGIX(GLenum mode
)
3950 GET_CURRENT_CONTEXT(ctx
);
3952 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3953 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PIXEL_TEXGEN_SGIX
, 1 );
3957 if (ctx
->ExecuteFlag
) {
3958 (*ctx
->Exec
->PixelTexGenSGIX
)( mode
);
3963 /* GL_ARB_texture_compression */
3964 static void GLAPIENTRY
3965 save_CompressedTexImage1DARB(GLenum target
, GLint level
,
3966 GLenum internalFormat
, GLsizei width
,
3967 GLint border
, GLsizei imageSize
,
3970 GET_CURRENT_CONTEXT(ctx
);
3971 if (target
== GL_PROXY_TEXTURE_1D
) {
3972 /* don't compile, execute immediately */
3973 (*ctx
->Exec
->CompressedTexImage1DARB
)(target
, level
, internalFormat
,
3974 width
, border
, imageSize
, data
);
3979 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3980 /* make copy of image */
3981 image
= MALLOC(imageSize
);
3983 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage1DARB");
3986 MEMCPY(image
, data
, imageSize
);
3987 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_IMAGE_1D
, 7 );
3991 n
[3].e
= internalFormat
;
3992 n
[4].i
= (GLint
) width
;
4000 if (ctx
->ExecuteFlag
) {
4001 (*ctx
->Exec
->CompressedTexImage1DARB
)(target
, level
, internalFormat
,
4002 width
, border
, imageSize
, data
);
4008 static void GLAPIENTRY
4009 save_CompressedTexImage2DARB(GLenum target
, GLint level
,
4010 GLenum internalFormat
, GLsizei width
,
4011 GLsizei height
, GLint border
, GLsizei imageSize
,
4014 GET_CURRENT_CONTEXT(ctx
);
4015 if (target
== GL_PROXY_TEXTURE_2D
) {
4016 /* don't compile, execute immediately */
4017 (*ctx
->Exec
->CompressedTexImage2DARB
)(target
, level
, internalFormat
,
4018 width
, height
, border
, imageSize
, data
);
4023 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4024 /* make copy of image */
4025 image
= MALLOC(imageSize
);
4027 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage2DARB");
4030 MEMCPY(image
, data
, imageSize
);
4031 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_IMAGE_2D
, 8 );
4035 n
[3].e
= internalFormat
;
4036 n
[4].i
= (GLint
) width
;
4037 n
[5].i
= (GLint
) height
;
4045 if (ctx
->ExecuteFlag
) {
4046 (*ctx
->Exec
->CompressedTexImage2DARB
)(target
, level
, internalFormat
,
4047 width
, height
, border
, imageSize
, data
);
4053 static void GLAPIENTRY
4054 save_CompressedTexImage3DARB(GLenum target
, GLint level
,
4055 GLenum internalFormat
, GLsizei width
,
4056 GLsizei height
, GLsizei depth
, GLint border
,
4057 GLsizei imageSize
, const GLvoid
*data
)
4059 GET_CURRENT_CONTEXT(ctx
);
4060 if (target
== GL_PROXY_TEXTURE_3D
) {
4061 /* don't compile, execute immediately */
4062 (*ctx
->Exec
->CompressedTexImage3DARB
)(target
, level
, internalFormat
,
4063 width
, height
, depth
, border
, imageSize
, data
);
4068 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4069 /* make copy of image */
4070 image
= MALLOC(imageSize
);
4072 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage3DARB");
4075 MEMCPY(image
, data
, imageSize
);
4076 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_IMAGE_3D
, 9 );
4080 n
[3].e
= internalFormat
;
4081 n
[4].i
= (GLint
) width
;
4082 n
[5].i
= (GLint
) height
;
4083 n
[6].i
= (GLint
) depth
;
4091 if (ctx
->ExecuteFlag
) {
4092 (*ctx
->Exec
->CompressedTexImage3DARB
)(target
, level
, internalFormat
,
4093 width
, height
, depth
, border
, imageSize
, data
);
4099 static void GLAPIENTRY
4100 save_CompressedTexSubImage1DARB(GLenum target
, GLint level
, GLint xoffset
,
4101 GLsizei width
, GLenum format
,
4102 GLsizei imageSize
, const GLvoid
*data
)
4107 GET_CURRENT_CONTEXT(ctx
);
4108 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4110 /* make copy of image */
4111 image
= MALLOC(imageSize
);
4113 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage1DARB");
4116 MEMCPY(image
, data
, imageSize
);
4117 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
, 7 );
4122 n
[4].i
= (GLint
) width
;
4130 if (ctx
->ExecuteFlag
) {
4131 (*ctx
->Exec
->CompressedTexSubImage1DARB
)(target
, level
, xoffset
,
4132 width
, format
, imageSize
, data
);
4137 static void GLAPIENTRY
4138 save_CompressedTexSubImage2DARB(GLenum target
, GLint level
, GLint xoffset
,
4139 GLint yoffset
, GLsizei width
, GLsizei height
,
4140 GLenum format
, GLsizei imageSize
,
4146 GET_CURRENT_CONTEXT(ctx
);
4147 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4149 /* make copy of image */
4150 image
= MALLOC(imageSize
);
4152 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage2DARB");
4155 MEMCPY(image
, data
, imageSize
);
4156 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
, 9 );
4162 n
[5].i
= (GLint
) width
;
4163 n
[6].i
= (GLint
) height
;
4171 if (ctx
->ExecuteFlag
) {
4172 (*ctx
->Exec
->CompressedTexSubImage2DARB
)(target
, level
, xoffset
, yoffset
,
4173 width
, height
, format
, imageSize
, data
);
4178 static void GLAPIENTRY
4179 save_CompressedTexSubImage3DARB(GLenum target
, GLint level
, GLint xoffset
,
4180 GLint yoffset
, GLint zoffset
, GLsizei width
,
4181 GLsizei height
, GLsizei depth
, GLenum format
,
4182 GLsizei imageSize
, const GLvoid
*data
)
4187 GET_CURRENT_CONTEXT(ctx
);
4188 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4190 /* make copy of image */
4191 image
= MALLOC(imageSize
);
4193 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage3DARB");
4196 MEMCPY(image
, data
, imageSize
);
4197 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
, 11 );
4204 n
[6].i
= (GLint
) width
;
4205 n
[7].i
= (GLint
) height
;
4206 n
[8].i
= (GLint
) depth
;
4208 n
[10].i
= imageSize
;
4214 if (ctx
->ExecuteFlag
) {
4215 (*ctx
->Exec
->CompressedTexSubImage3DARB
)(target
, level
, xoffset
, yoffset
,
4216 zoffset
, width
, height
, depth
, format
, imageSize
, data
);
4221 /* GL_ARB_multisample */
4222 static void GLAPIENTRY
4223 save_SampleCoverageARB(GLclampf value
, GLboolean invert
)
4225 GET_CURRENT_CONTEXT(ctx
);
4227 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4228 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_SAMPLE_COVERAGE
, 2 );
4233 if (ctx
->ExecuteFlag
) {
4234 (*ctx
->Exec
->SampleCoverageARB
)( value
, invert
);
4239 /* GL_SGIS_pixel_texture */
4241 static void GLAPIENTRY
4242 save_PixelTexGenParameteriSGIS(GLenum target
, GLint value
)
4244 GET_CURRENT_CONTEXT(ctx
);
4246 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4247 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS
, 2 );
4252 if (ctx
->ExecuteFlag
) {
4253 (*ctx
->Exec
->PixelTexGenParameteriSGIS
)( target
, value
);
4258 static void GLAPIENTRY
4259 save_PixelTexGenParameterfSGIS(GLenum target
, GLfloat value
)
4261 save_PixelTexGenParameteriSGIS(target
, (GLint
) value
);
4265 static void GLAPIENTRY
4266 save_PixelTexGenParameterivSGIS(GLenum target
, const GLint
*value
)
4268 save_PixelTexGenParameteriSGIS(target
, *value
);
4272 static void GLAPIENTRY
4273 save_PixelTexGenParameterfvSGIS(GLenum target
, const GLfloat
*value
)
4275 save_PixelTexGenParameteriSGIS(target
, (GLint
) *value
);
4280 * GL_NV_vertex_program
4282 #if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
4283 static void GLAPIENTRY
4284 save_BindProgramNV(GLenum target
, GLuint id
)
4286 GET_CURRENT_CONTEXT(ctx
);
4288 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4289 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BIND_PROGRAM_NV
, 2 );
4294 if (ctx
->ExecuteFlag
) {
4295 (*ctx
->Exec
->BindProgramNV
)( target
, id
);
4298 #endif /* FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program */
4300 #if FEATURE_NV_vertex_program
4301 static void GLAPIENTRY
4302 save_ExecuteProgramNV(GLenum target
, GLuint id
, const GLfloat
*params
)
4304 GET_CURRENT_CONTEXT(ctx
);
4306 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4307 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_EXECUTE_PROGRAM_NV
, 6 );
4316 if (ctx
->ExecuteFlag
) {
4317 (*ctx
->Exec
->ExecuteProgramNV
)(target
, id
, params
);
4322 static void GLAPIENTRY
4323 save_ProgramParameter4fNV(GLenum target
, GLuint index
,
4324 GLfloat x
, GLfloat y
,
4325 GLfloat z
, GLfloat w
)
4327 GET_CURRENT_CONTEXT(ctx
);
4329 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4330 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PROGRAM_PARAMETER4F_NV
, 6 );
4339 if (ctx
->ExecuteFlag
) {
4340 (*ctx
->Exec
->ProgramParameter4fNV
)(target
, index
, x
, y
, z
, w
);
4345 static void GLAPIENTRY
4346 save_ProgramParameter4fvNV(GLenum target
, GLuint index
, const GLfloat
*params
)
4348 save_ProgramParameter4fNV(target
, index
, params
[0], params
[1],
4349 params
[2], params
[3]);
4353 static void GLAPIENTRY
4354 save_ProgramParameter4dNV(GLenum target
, GLuint index
,
4355 GLdouble x
, GLdouble y
,
4356 GLdouble z
, GLdouble w
)
4358 save_ProgramParameter4fNV(target
, index
, (GLfloat
) x
, (GLfloat
) y
,
4359 (GLfloat
) z
, (GLfloat
) w
);
4363 static void GLAPIENTRY
4364 save_ProgramParameter4dvNV(GLenum target
, GLuint index
,
4365 const GLdouble
*params
)
4367 save_ProgramParameter4fNV(target
, index
, (GLfloat
) params
[0],
4368 (GLfloat
) params
[1], (GLfloat
) params
[2],
4369 (GLfloat
) params
[3]);
4373 static void GLAPIENTRY
4374 save_ProgramParameters4dvNV(GLenum target
, GLuint index
,
4375 GLuint num
, const GLdouble
*params
)
4378 for (i
= 0; i
< num
; i
++) {
4379 save_ProgramParameter4dvNV(target
, index
+ i
, params
+ 4 * i
);
4384 static void GLAPIENTRY
4385 save_ProgramParameters4fvNV(GLenum target
, GLuint index
,
4386 GLuint num
, const GLfloat
*params
)
4389 for (i
= 0; i
< num
; i
++) {
4390 save_ProgramParameter4fvNV(target
, index
+ i
, params
+ 4 * i
);
4395 static void GLAPIENTRY
4396 save_LoadProgramNV(GLenum target
, GLuint id
, GLsizei len
,
4397 const GLubyte
*program
)
4399 GET_CURRENT_CONTEXT(ctx
);
4401 GLubyte
*programCopy
;
4403 programCopy
= (GLubyte
*) _mesa_malloc(len
);
4405 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glLoadProgramNV");
4408 _mesa_memcpy(programCopy
, program
, len
);
4410 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4411 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LOAD_PROGRAM_NV
, 4 );
4416 n
[4].data
= programCopy
;
4418 if (ctx
->ExecuteFlag
) {
4419 (*ctx
->Exec
->LoadProgramNV
)(target
, id
, len
, program
);
4424 static void GLAPIENTRY
4425 save_RequestResidentProgramsNV(GLsizei num
, const GLuint
*ids
)
4427 GET_CURRENT_CONTEXT(ctx
);
4429 GLuint
*idCopy
= (GLuint
*) _mesa_malloc(num
* sizeof(GLuint
));
4431 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glRequestResidentProgramsNV");
4434 _mesa_memcpy(idCopy
, ids
, num
* sizeof(GLuint
));
4435 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4436 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TRACK_MATRIX_NV
, 2 );
4441 if (ctx
->ExecuteFlag
) {
4442 (*ctx
->Exec
->RequestResidentProgramsNV
)(num
, ids
);
4447 static void GLAPIENTRY
4448 save_TrackMatrixNV(GLenum target
, GLuint address
,
4449 GLenum matrix
, GLenum transform
)
4451 GET_CURRENT_CONTEXT(ctx
);
4453 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4454 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TRACK_MATRIX_NV
, 4 );
4461 if (ctx
->ExecuteFlag
) {
4462 (*ctx
->Exec
->TrackMatrixNV
)(target
, address
, matrix
, transform
);
4465 #endif /* FEATURE_NV_vertex_program */
4469 * GL_NV_fragment_program
4471 #if FEATURE_NV_fragment_program
4472 static void GLAPIENTRY
4473 save_ProgramLocalParameter4fARB(GLenum target
, GLuint index
,
4474 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4476 GET_CURRENT_CONTEXT(ctx
);
4478 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4479 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6 );
4488 if (ctx
->ExecuteFlag
) {
4489 (*ctx
->Exec
->ProgramLocalParameter4fARB
)(target
, index
, x
, y
, z
, w
);
4494 static void GLAPIENTRY
4495 save_ProgramLocalParameter4fvARB(GLenum target
, GLuint index
,
4496 const GLfloat
*params
)
4498 GET_CURRENT_CONTEXT(ctx
);
4500 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4501 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6 );
4510 if (ctx
->ExecuteFlag
) {
4511 (*ctx
->Exec
->ProgramLocalParameter4fvARB
)(target
, index
, params
);
4516 static void GLAPIENTRY
4517 save_ProgramLocalParameter4dARB(GLenum target
, GLuint index
,
4518 GLdouble x
, GLdouble y
,
4519 GLdouble z
, GLdouble w
)
4521 GET_CURRENT_CONTEXT(ctx
);
4523 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4524 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6 );
4528 n
[3].f
= (GLfloat
) x
;
4529 n
[4].f
= (GLfloat
) y
;
4530 n
[5].f
= (GLfloat
) z
;
4531 n
[6].f
= (GLfloat
) w
;
4533 if (ctx
->ExecuteFlag
) {
4534 (*ctx
->Exec
->ProgramLocalParameter4dARB
)(target
, index
, x
, y
, z
, w
);
4539 static void GLAPIENTRY
4540 save_ProgramLocalParameter4dvARB(GLenum target
, GLuint index
,
4541 const GLdouble
*params
)
4543 GET_CURRENT_CONTEXT(ctx
);
4545 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4546 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6 );
4550 n
[3].f
= (GLfloat
) params
[0];
4551 n
[4].f
= (GLfloat
) params
[1];
4552 n
[5].f
= (GLfloat
) params
[2];
4553 n
[6].f
= (GLfloat
) params
[3];
4555 if (ctx
->ExecuteFlag
) {
4556 (*ctx
->Exec
->ProgramLocalParameter4dvARB
)(target
, index
, params
);
4560 static void GLAPIENTRY
4561 save_ProgramNamedParameter4fNV(GLuint id
, GLsizei len
, const GLubyte
*name
,
4562 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4564 GET_CURRENT_CONTEXT(ctx
);
4566 GLubyte
*nameCopy
= (GLubyte
*) _mesa_malloc(len
);
4568 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramNamedParameter4fNV");
4571 _mesa_memcpy(nameCopy
, name
, len
);
4573 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4574 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PROGRAM_NAMED_PARAMETER_NV
, 6 );
4578 n
[3].data
= nameCopy
;
4584 if (ctx
->ExecuteFlag
) {
4585 (*ctx
->Exec
->ProgramNamedParameter4fNV
)(id
, len
, name
, x
, y
, z
, w
);
4590 static void GLAPIENTRY
4591 save_ProgramNamedParameter4fvNV(GLuint id
, GLsizei len
, const GLubyte
*name
,
4594 save_ProgramNamedParameter4fNV(id
, len
, name
, v
[0], v
[1], v
[2], v
[3]);
4598 static void GLAPIENTRY
4599 save_ProgramNamedParameter4dNV(GLuint id
, GLsizei len
, const GLubyte
*name
,
4600 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4602 save_ProgramNamedParameter4fNV(id
, len
, name
, (GLfloat
) x
, (GLfloat
) y
,
4603 (GLfloat
) z
,(GLfloat
) w
);
4607 static void GLAPIENTRY
4608 save_ProgramNamedParameter4dvNV(GLuint id
, GLsizei len
, const GLubyte
*name
,
4611 save_ProgramNamedParameter4fNV(id
, len
, name
, (GLfloat
) v
[0],
4612 (GLfloat
) v
[1], (GLfloat
) v
[2],
4616 #endif /* FEATURE_NV_fragment_program */
4620 /* GL_EXT_stencil_two_side */
4621 static void GLAPIENTRY
save_ActiveStencilFaceEXT( GLenum face
)
4623 GET_CURRENT_CONTEXT(ctx
);
4625 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4626 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ACTIVE_STENCIL_FACE_EXT
, 1 );
4630 if (ctx
->ExecuteFlag
) {
4631 (*ctx
->Exec
->ActiveStencilFaceEXT
)( face
);
4636 /* GL_EXT_depth_bounds_test */
4637 static void GLAPIENTRY
save_DepthBoundsEXT( GLclampd zmin
, GLclampd zmax
)
4639 GET_CURRENT_CONTEXT(ctx
);
4641 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4642 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_DEPTH_BOUNDS_EXT
, 2 );
4644 n
[1].f
= (GLfloat
) zmin
;
4645 n
[2].f
= (GLfloat
) zmax
;
4647 if (ctx
->ExecuteFlag
) {
4648 (*ctx
->Exec
->DepthBoundsEXT
)( zmin
, zmax
);
4654 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
4656 static void GLAPIENTRY
4657 save_ProgramStringARB(GLenum target
, GLenum format
, GLsizei len
,
4658 const GLvoid
*string
)
4660 GET_CURRENT_CONTEXT(ctx
);
4662 GLubyte
*programCopy
;
4664 programCopy
= (GLubyte
*) _mesa_malloc(len
);
4666 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramStringARB");
4669 _mesa_memcpy(programCopy
, string
, len
);
4671 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4672 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PROGRAM_STRING_ARB
, 4 );
4677 n
[4].data
= programCopy
;
4679 if (ctx
->ExecuteFlag
) {
4680 (*ctx
->Exec
->ProgramStringARB
)(target
, format
, len
, string
);
4685 static void GLAPIENTRY
4686 save_ProgramEnvParameter4fARB(GLenum target
, GLuint index
,
4687 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4689 GET_CURRENT_CONTEXT(ctx
);
4691 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4692 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6 );
4701 if (ctx
->ExecuteFlag
) {
4702 (*ctx
->Exec
->ProgramEnvParameter4fARB
)( target
, index
, x
, y
, z
, w
);
4707 static void GLAPIENTRY
4708 save_ProgramEnvParameter4fvARB(GLenum target
, GLuint index
,
4709 const GLfloat
*params
)
4711 save_ProgramEnvParameter4fARB(target
, index
, params
[0], params
[1],
4712 params
[2], params
[3]);
4716 static void GLAPIENTRY
4717 save_ProgramEnvParameter4dARB(GLenum target
, GLuint index
,
4718 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4720 save_ProgramEnvParameter4fARB(target
, index
,
4728 static void GLAPIENTRY
4729 save_ProgramEnvParameter4dvARB(GLenum target
, GLuint index
,
4730 const GLdouble
*params
)
4732 save_ProgramEnvParameter4fARB(target
, index
,
4733 (GLfloat
) params
[0],
4734 (GLfloat
) params
[1],
4735 (GLfloat
) params
[2],
4736 (GLfloat
) params
[3]);
4739 #endif /* FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program */
4742 #ifdef FEATURE_ARB_occlusion_query
4744 static void GLAPIENTRY
4745 save_BeginQueryARB(GLenum target
, GLuint id
)
4747 GET_CURRENT_CONTEXT(ctx
);
4749 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4750 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BEGIN_QUERY_ARB
, 2 );
4755 if (ctx
->ExecuteFlag
) {
4756 (*ctx
->Exec
->BeginQueryARB
)( target
, id
);
4761 static void GLAPIENTRY
4762 save_EndQueryARB(GLenum target
)
4764 GET_CURRENT_CONTEXT(ctx
);
4766 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4767 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_END_QUERY_ARB
, 1 );
4771 if (ctx
->ExecuteFlag
) {
4772 (*ctx
->Exec
->EndQueryARB
)( target
);
4776 #endif /* FEATURE_ARB_occlusion_query */
4779 static void GLAPIENTRY
4780 save_DrawBuffersARB(GLsizei count
, const GLenum
*buffers
)
4782 GET_CURRENT_CONTEXT(ctx
);
4784 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4785 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_DRAW_BUFFERS_ARB
, 1 + MAX_DRAW_BUFFERS
);
4789 if (count
> MAX_DRAW_BUFFERS
)
4790 count
= MAX_DRAW_BUFFERS
;
4791 for (i
= 0; i
< count
; i
++) {
4792 n
[2 + i
].e
= buffers
[i
];
4795 if (ctx
->ExecuteFlag
) {
4796 (*ctx
->Exec
->DrawBuffersARB
)(count
, buffers
);
4800 #if FEATURE_ATI_fragment_shader
4801 static void GLAPIENTRY
4802 save_BindFragmentShaderATI(GLuint id
)
4804 GET_CURRENT_CONTEXT(ctx
);
4807 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BIND_FRAGMENT_SHADER_ATI
, 1);
4811 if (ctx
->ExecuteFlag
) {
4812 (*ctx
->Exec
->BindFragmentShaderATI
)(id
);
4816 static void GLAPIENTRY
4817 save_SetFragmentShaderConstantATI(GLuint dst
, const GLfloat
*value
)
4819 GET_CURRENT_CONTEXT(ctx
);
4822 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
, 5);
4830 if (ctx
->ExecuteFlag
) {
4831 (*ctx
->Exec
->SetFragmentShaderConstantATI
)(dst
, value
);
4836 static void save_Attr1fNV( GLenum attr
, GLfloat x
)
4838 GET_CURRENT_CONTEXT(ctx
);
4840 SAVE_FLUSH_VERTICES( ctx
);
4841 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ATTR_1F_NV
, 2 );
4847 ASSERT(attr
< VERT_ATTRIB_MAX
);
4848 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
4849 ASSIGN_4V( ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
4851 if (ctx
->ExecuteFlag
) {
4852 (*ctx
->Exec
->VertexAttrib1fNV
)( attr
, x
);
4856 static void save_Attr2fNV( GLenum attr
, GLfloat x
, GLfloat y
)
4858 GET_CURRENT_CONTEXT(ctx
);
4860 SAVE_FLUSH_VERTICES( ctx
);
4861 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ATTR_2F_NV
, 3 );
4868 ASSERT(attr
< VERT_ATTRIB_MAX
);
4869 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
4870 ASSIGN_4V( ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
4872 if (ctx
->ExecuteFlag
) {
4873 (*ctx
->Exec
->VertexAttrib2fNV
)( attr
, x
, y
);
4877 static void 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
< VERT_ATTRIB_MAX
);
4891 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
4892 ASSIGN_4V( ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
4894 if (ctx
->ExecuteFlag
) {
4895 (*ctx
->Exec
->VertexAttrib3fNV
)( attr
, x
, y
, z
);
4899 static void save_Attr4fNV( GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
,
4902 GET_CURRENT_CONTEXT(ctx
);
4904 SAVE_FLUSH_VERTICES( ctx
);
4905 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ATTR_4F_NV
, 5 );
4914 ASSERT(attr
< VERT_ATTRIB_MAX
);
4915 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
4916 ASSIGN_4V( ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
4918 if (ctx
->ExecuteFlag
) {
4919 (*ctx
->Exec
->VertexAttrib4fNV
)( attr
, x
, y
, z
, w
);
4924 static void save_Attr1fARB( GLenum attr
, GLfloat x
)
4926 GET_CURRENT_CONTEXT(ctx
);
4928 SAVE_FLUSH_VERTICES( ctx
);
4929 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ATTR_1F_ARB
, 2 );
4935 ASSERT(attr
< VERT_ATTRIB_MAX
);
4936 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
4937 ASSIGN_4V( ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
4939 if (ctx
->ExecuteFlag
) {
4940 (*ctx
->Exec
->VertexAttrib1fARB
)( attr
, x
);
4944 static void save_Attr2fARB( GLenum attr
, GLfloat x
, GLfloat y
)
4946 GET_CURRENT_CONTEXT(ctx
);
4948 SAVE_FLUSH_VERTICES( ctx
);
4949 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ATTR_2F_ARB
, 3 );
4956 ASSERT(attr
< VERT_ATTRIB_MAX
);
4957 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
4958 ASSIGN_4V( ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
4960 if (ctx
->ExecuteFlag
) {
4961 (*ctx
->Exec
->VertexAttrib2fARB
)( attr
, x
, y
);
4965 static void save_Attr3fARB( GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
4967 GET_CURRENT_CONTEXT(ctx
);
4969 SAVE_FLUSH_VERTICES( ctx
);
4970 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ATTR_3F_ARB
, 4 );
4978 ASSERT(attr
< VERT_ATTRIB_MAX
);
4979 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
4980 ASSIGN_4V( ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
4982 if (ctx
->ExecuteFlag
) {
4983 (*ctx
->Exec
->VertexAttrib3fARB
)( attr
, x
, y
, z
);
4987 static void save_Attr4fARB( GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
,
4990 GET_CURRENT_CONTEXT(ctx
);
4992 SAVE_FLUSH_VERTICES( ctx
);
4993 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ATTR_4F_ARB
, 5 );
5002 ASSERT(attr
< VERT_ATTRIB_MAX
);
5003 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5004 ASSIGN_4V( ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5006 if (ctx
->ExecuteFlag
) {
5007 (*ctx
->Exec
->VertexAttrib4fARB
)( attr
, x
, y
, z
, w
);
5012 static void GLAPIENTRY
save_EvalCoord1f( GLfloat x
)
5014 GET_CURRENT_CONTEXT(ctx
);
5016 SAVE_FLUSH_VERTICES( ctx
);
5017 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_EVAL_C1
, 1 );
5021 if (ctx
->ExecuteFlag
) {
5022 (*ctx
->Exec
->EvalCoord1f
)( x
);
5026 static void GLAPIENTRY
save_EvalCoord1fv( const GLfloat
*v
)
5028 save_EvalCoord1f( v
[0] );
5031 static void GLAPIENTRY
save_EvalCoord2f( GLfloat x
, GLfloat y
)
5033 GET_CURRENT_CONTEXT(ctx
);
5035 SAVE_FLUSH_VERTICES( ctx
);
5036 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_EVAL_C2
, 2 );
5041 if (ctx
->ExecuteFlag
) {
5042 (*ctx
->Exec
->EvalCoord2f
)( x
, y
);
5046 static void GLAPIENTRY
save_EvalCoord2fv( const GLfloat
*v
)
5048 save_EvalCoord2f( v
[0], v
[1] );
5052 static void GLAPIENTRY
save_EvalPoint1( GLint x
)
5054 GET_CURRENT_CONTEXT(ctx
);
5056 SAVE_FLUSH_VERTICES( ctx
);
5057 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_EVAL_P1
, 1 );
5061 if (ctx
->ExecuteFlag
) {
5062 (*ctx
->Exec
->EvalPoint1
)( x
);
5066 static void GLAPIENTRY
save_EvalPoint2( GLint x
, GLint y
)
5068 GET_CURRENT_CONTEXT(ctx
);
5070 SAVE_FLUSH_VERTICES( ctx
);
5071 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_EVAL_P2
, 2 );
5076 if (ctx
->ExecuteFlag
) {
5077 (*ctx
->Exec
->EvalPoint2
)( x
, y
);
5081 static void GLAPIENTRY
save_Indexf( GLfloat x
)
5083 GET_CURRENT_CONTEXT(ctx
);
5085 SAVE_FLUSH_VERTICES( ctx
);
5086 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_INDEX
, 1 );
5091 ctx
->ListState
.ActiveIndex
= 1;
5092 ctx
->ListState
.CurrentIndex
= x
;
5094 if (ctx
->ExecuteFlag
) {
5095 (*ctx
->Exec
->Indexi
)( (GLint
) x
);
5099 static void GLAPIENTRY
save_Indexfv( const GLfloat
*v
)
5101 save_Indexf( v
[0] );
5104 static void GLAPIENTRY
save_EdgeFlag( GLboolean x
)
5106 GET_CURRENT_CONTEXT(ctx
);
5108 SAVE_FLUSH_VERTICES( ctx
);
5109 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_EDGEFLAG
, 1 );
5114 ctx
->ListState
.ActiveEdgeFlag
= 1;
5115 ctx
->ListState
.CurrentEdgeFlag
= x
;
5117 if (ctx
->ExecuteFlag
) {
5118 (*ctx
->Exec
->EdgeFlag
)( x
);
5122 static void GLAPIENTRY
save_EdgeFlagv( const GLboolean
*v
)
5124 save_EdgeFlag( v
[0] );
5127 static void GLAPIENTRY
save_Materialfv( GLenum face
, GLenum pname
, const GLfloat
*param
)
5129 GET_CURRENT_CONTEXT(ctx
);
5133 SAVE_FLUSH_VERTICES( ctx
);
5138 case GL_FRONT_AND_BACK
:
5141 _mesa_compile_error( ctx
, GL_INVALID_ENUM
, "material(face)" );
5150 case GL_AMBIENT_AND_DIFFUSE
:
5156 case GL_COLOR_INDEXES
:
5160 _mesa_compile_error( ctx
, GL_INVALID_ENUM
, "material(pname)" );
5164 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MATERIAL
, 6 );
5168 for (i
= 0 ; i
< args
; i
++)
5169 n
[3+i
].f
= param
[i
];
5173 GLuint bitmask
= _mesa_material_bitmask( ctx
, face
, pname
, ~0, NULL
);
5174 for (i
= 0 ; i
< MAT_ATTRIB_MAX
; i
++)
5175 if (bitmask
& (1<<i
)) {
5176 ctx
->ListState
.ActiveMaterialSize
[i
] = args
;
5177 COPY_SZ_4V( ctx
->ListState
.CurrentMaterial
[i
], args
, param
);
5181 if (ctx
->ExecuteFlag
) {
5182 (*ctx
->Exec
->Materialfv
)( face
, pname
, param
);
5186 static void GLAPIENTRY
save_Begin( GLenum mode
)
5188 GET_CURRENT_CONTEXT(ctx
);
5190 GLboolean error
= GL_FALSE
;
5192 if (/*mode < GL_POINTS ||*/ mode
> GL_POLYGON
) {
5193 _mesa_compile_error( ctx
, GL_INVALID_ENUM
, "Begin (mode)");
5196 else if (ctx
->Driver
.CurrentSavePrimitive
== PRIM_UNKNOWN
) {
5197 /* Typically the first begin. This may raise an error on
5198 * playback, depending on whether CallList is issued from inside
5199 * a begin/end or not.
5201 ctx
->Driver
.CurrentSavePrimitive
= PRIM_INSIDE_UNKNOWN_PRIM
;
5203 else if (ctx
->Driver
.CurrentSavePrimitive
== PRIM_OUTSIDE_BEGIN_END
) {
5204 ctx
->Driver
.CurrentSavePrimitive
= mode
;
5207 _mesa_compile_error( ctx
, GL_INVALID_OPERATION
, "recursive begin" );
5212 /* Give the driver an opportunity to hook in an optimized
5213 * display list compiler.
5215 if (ctx
->Driver
.NotifySaveBegin( ctx
, mode
))
5218 SAVE_FLUSH_VERTICES( ctx
);
5219 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BEGIN
, 1 );
5225 if (ctx
->ExecuteFlag
) {
5226 (*ctx
->Exec
->Begin
)( mode
);
5230 static void GLAPIENTRY
save_End( void )
5232 GET_CURRENT_CONTEXT(ctx
);
5233 SAVE_FLUSH_VERTICES( ctx
);
5234 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_END
, 0 );
5235 ctx
->Driver
.CurrentSavePrimitive
= PRIM_OUTSIDE_BEGIN_END
;
5236 if (ctx
->ExecuteFlag
) {
5237 (*ctx
->Exec
->End
)( );
5241 static void GLAPIENTRY
save_Rectf( GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
5243 GET_CURRENT_CONTEXT(ctx
);
5245 SAVE_FLUSH_VERTICES( ctx
);
5246 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_RECTF
, 4 );
5253 if (ctx
->ExecuteFlag
) {
5254 (*ctx
->Exec
->Rectf
)( a
, b
, c
, d
);
5259 static void GLAPIENTRY
save_Vertex2f( GLfloat x
, GLfloat y
)
5261 save_Attr2fNV( VERT_ATTRIB_POS
, x
, y
);
5264 static void GLAPIENTRY
save_Vertex2fv( const GLfloat
*v
)
5266 save_Attr2fNV( VERT_ATTRIB_POS
, v
[0], v
[1] );
5269 static void GLAPIENTRY
save_Vertex3f( GLfloat x
, GLfloat y
, GLfloat z
)
5271 save_Attr3fNV( VERT_ATTRIB_POS
, x
, y
, z
);
5274 static void GLAPIENTRY
save_Vertex3fv( const GLfloat
*v
)
5276 save_Attr3fNV( VERT_ATTRIB_POS
, v
[0], v
[1], v
[2] );
5279 static void GLAPIENTRY
save_Vertex4f( GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5281 save_Attr4fNV( VERT_ATTRIB_POS
, x
, y
, z
, w
);
5284 static void GLAPIENTRY
save_Vertex4fv( const GLfloat
*v
)
5286 save_Attr4fNV( VERT_ATTRIB_POS
, v
[0], v
[1], v
[2], v
[3] );
5289 static void GLAPIENTRY
save_TexCoord1f( GLfloat x
)
5291 save_Attr1fNV( VERT_ATTRIB_TEX0
, x
);
5294 static void GLAPIENTRY
save_TexCoord1fv( const GLfloat
*v
)
5296 save_Attr1fNV( VERT_ATTRIB_TEX0
, v
[0] );
5299 static void GLAPIENTRY
save_TexCoord2f( GLfloat x
, GLfloat y
)
5301 save_Attr2fNV( VERT_ATTRIB_TEX0
, x
, y
);
5304 static void GLAPIENTRY
save_TexCoord2fv( const GLfloat
*v
)
5306 save_Attr2fNV( VERT_ATTRIB_TEX0
, v
[0], v
[1] );
5309 static void GLAPIENTRY
save_TexCoord3f( GLfloat x
, GLfloat y
, GLfloat z
)
5311 save_Attr3fNV( VERT_ATTRIB_TEX0
, x
, y
, z
);
5314 static void GLAPIENTRY
save_TexCoord3fv( const GLfloat
*v
)
5316 save_Attr3fNV( VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2] );
5319 static void GLAPIENTRY
save_TexCoord4f( GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5321 save_Attr4fNV( VERT_ATTRIB_TEX0
, x
, y
, z
, w
);
5324 static void GLAPIENTRY
save_TexCoord4fv( const GLfloat
*v
)
5326 save_Attr4fNV( VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2], v
[3] );
5329 static void GLAPIENTRY
save_Normal3f( GLfloat x
, GLfloat y
, GLfloat z
)
5331 save_Attr3fNV( VERT_ATTRIB_NORMAL
, x
, y
, z
);
5334 static void GLAPIENTRY
save_Normal3fv( const GLfloat
*v
)
5336 save_Attr3fNV( VERT_ATTRIB_NORMAL
, v
[0], v
[1], v
[2] );
5339 static void GLAPIENTRY
save_FogCoordfEXT( GLfloat x
)
5341 save_Attr1fNV( VERT_ATTRIB_FOG
, x
);
5344 static void GLAPIENTRY
save_FogCoordfvEXT( const GLfloat
*v
)
5346 save_Attr1fNV( VERT_ATTRIB_FOG
, v
[0] );
5349 static void GLAPIENTRY
save_Color3f( GLfloat x
, GLfloat y
, GLfloat z
)
5351 save_Attr3fNV( VERT_ATTRIB_COLOR0
, x
, y
, z
);
5354 static void GLAPIENTRY
save_Color3fv( const GLfloat
*v
)
5356 save_Attr3fNV( VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2] );
5359 static void GLAPIENTRY
save_Color4f( GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5361 save_Attr4fNV( VERT_ATTRIB_COLOR0
, x
, y
, z
, w
);
5364 static void GLAPIENTRY
save_Color4fv( const GLfloat
*v
)
5366 save_Attr4fNV( VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2], v
[3] );
5369 static void GLAPIENTRY
save_SecondaryColor3fEXT( GLfloat x
, GLfloat y
, GLfloat z
)
5371 save_Attr3fNV( VERT_ATTRIB_COLOR1
, x
, y
, z
);
5374 static void GLAPIENTRY
save_SecondaryColor3fvEXT( const GLfloat
*v
)
5376 save_Attr3fNV( VERT_ATTRIB_COLOR1
, v
[0], v
[1], v
[2] );
5380 /* Just call the respective ATTR for texcoord
5382 static void GLAPIENTRY
save_MultiTexCoord1f( GLenum target
, GLfloat x
)
5384 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5385 save_Attr1fNV( attr
, x
);
5388 static void GLAPIENTRY
save_MultiTexCoord1fv( GLenum target
, const GLfloat
*v
)
5390 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5391 save_Attr1fNV( attr
, v
[0] );
5394 static void GLAPIENTRY
save_MultiTexCoord2f( GLenum target
, GLfloat x
, GLfloat y
)
5396 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5397 save_Attr2fNV( attr
, x
, y
);
5400 static void GLAPIENTRY
save_MultiTexCoord2fv( GLenum target
, const GLfloat
*v
)
5402 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5403 save_Attr2fNV( attr
, v
[0], v
[1] );
5406 static void GLAPIENTRY
save_MultiTexCoord3f( GLenum target
, GLfloat x
, GLfloat y
,
5409 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5410 save_Attr3fNV( attr
, x
, y
, z
);
5413 static void GLAPIENTRY
save_MultiTexCoord3fv( GLenum target
, const GLfloat
*v
)
5415 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5416 save_Attr3fNV( attr
, v
[0], v
[1], v
[2] );
5419 static void GLAPIENTRY
save_MultiTexCoord4f( GLenum target
, GLfloat x
, GLfloat y
,
5420 GLfloat z
, GLfloat w
)
5422 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5423 save_Attr4fNV( attr
, x
, y
, z
, w
);
5426 static void GLAPIENTRY
save_MultiTexCoord4fv( GLenum target
, const GLfloat
*v
)
5428 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5429 save_Attr4fNV( attr
, v
[0], v
[1], v
[2], v
[3] );
5433 static void enum_error( void )
5435 GET_CURRENT_CONTEXT( ctx
);
5436 _mesa_error( ctx
, GL_INVALID_ENUM
, "VertexAttribfNV" );
5439 /* First level for NV_vertex_program:
5441 * Check for errors at compile time?.
5443 static void GLAPIENTRY
save_VertexAttrib1fNV( GLuint index
, GLfloat x
)
5445 if (index
< VERT_ATTRIB_MAX
)
5446 save_Attr1fNV( index
, x
);
5451 static void GLAPIENTRY
save_VertexAttrib1fvNV( GLuint index
, const GLfloat
*v
)
5453 if (index
< VERT_ATTRIB_MAX
)
5454 save_Attr1fNV( index
, v
[0] );
5459 static void GLAPIENTRY
save_VertexAttrib2fNV( GLuint index
, GLfloat x
, GLfloat y
)
5461 if (index
< VERT_ATTRIB_MAX
)
5462 save_Attr2fNV( index
, x
, y
);
5467 static void GLAPIENTRY
save_VertexAttrib2fvNV( GLuint index
, const GLfloat
*v
)
5469 if (index
< VERT_ATTRIB_MAX
)
5470 save_Attr2fNV( index
, v
[0], v
[1] );
5475 static void GLAPIENTRY
save_VertexAttrib3fNV( GLuint index
, GLfloat x
, GLfloat y
,
5478 if (index
< VERT_ATTRIB_MAX
)
5479 save_Attr3fNV( index
, x
, y
, z
);
5484 static void GLAPIENTRY
save_VertexAttrib3fvNV( GLuint index
, const GLfloat
*v
)
5486 if (index
< VERT_ATTRIB_MAX
)
5487 save_Attr3fNV( index
, v
[0], v
[1], v
[2] );
5492 static void GLAPIENTRY
save_VertexAttrib4fNV( GLuint index
, GLfloat x
, GLfloat y
,
5493 GLfloat z
, GLfloat w
)
5495 if (index
< VERT_ATTRIB_MAX
)
5496 save_Attr4fNV( index
, x
, y
, z
, w
);
5501 static void GLAPIENTRY
save_VertexAttrib4fvNV( GLuint index
, const GLfloat
*v
)
5503 if (index
< VERT_ATTRIB_MAX
)
5504 save_Attr4fNV( index
, v
[0], v
[1], v
[2], v
[3] );
5512 static void GLAPIENTRY
5513 save_VertexAttrib1fARB( GLuint index
, GLfloat x
)
5515 if (index
< VERT_ATTRIB_MAX
)
5516 save_Attr1fARB( index
, x
);
5521 static void GLAPIENTRY
5522 save_VertexAttrib1fvARB( GLuint index
, const GLfloat
*v
)
5524 if (index
< VERT_ATTRIB_MAX
)
5525 save_Attr1fARB( index
, v
[0] );
5530 static void GLAPIENTRY
5531 save_VertexAttrib2fARB( GLuint index
, GLfloat x
, GLfloat y
)
5533 if (index
< VERT_ATTRIB_MAX
)
5534 save_Attr2fARB( index
, x
, y
);
5539 static void GLAPIENTRY
5540 save_VertexAttrib2fvARB( GLuint index
, const GLfloat
*v
)
5542 if (index
< VERT_ATTRIB_MAX
)
5543 save_Attr2fARB( index
, v
[0], v
[1] );
5548 static void GLAPIENTRY
5549 save_VertexAttrib3fARB( GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
5551 if (index
< VERT_ATTRIB_MAX
)
5552 save_Attr3fARB( index
, x
, y
, z
);
5557 static void GLAPIENTRY
5558 save_VertexAttrib3fvARB( GLuint index
, const GLfloat
*v
)
5560 if (index
< VERT_ATTRIB_MAX
)
5561 save_Attr3fARB( index
, v
[0], v
[1], v
[2] );
5566 static void GLAPIENTRY
5567 save_VertexAttrib4fARB( GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5569 if (index
< VERT_ATTRIB_MAX
)
5570 save_Attr4fARB( index
, x
, y
, z
, w
);
5575 static void GLAPIENTRY
5576 save_VertexAttrib4fvARB( GLuint index
, const GLfloat
*v
)
5578 if (index
< VERT_ATTRIB_MAX
)
5579 save_Attr4fARB( index
, v
[0], v
[1], v
[2], v
[3] );
5588 /* KW: Compile commands
5590 * Will appear in the list before the vertex buffer containing the
5591 * command that provoked the error. I don't see this as a problem.
5594 _mesa_save_error( GLcontext
*ctx
, GLenum error
, const char *s
)
5597 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ERROR
, 2 );
5600 n
[2].data
= (void *) s
;
5602 /* execute already done */
5607 * Compile an error into current display list.
5610 _mesa_compile_error( GLcontext
*ctx
, GLenum error
, const char *s
)
5612 if (ctx
->CompileFlag
)
5613 _mesa_save_error( ctx
, error
, s
);
5615 if (ctx
->ExecuteFlag
)
5616 _mesa_error( ctx
, error
, s
);
5622 islist(GLcontext
*ctx
, GLuint list
)
5624 if (list
> 0 && _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
)) {
5634 /**********************************************************************/
5635 /* Display list execution */
5636 /**********************************************************************/
5640 * Execute a display list. Note that the ListBase offset must have already
5641 * been added before calling this function. I.e. the list argument is
5642 * the absolute list number, not relative to ListBase.
5643 * \param list - display list number
5645 static void GLAPIENTRY
5646 execute_list( GLcontext
*ctx
, GLuint list
)
5648 struct mesa_display_list
*dlist
;
5652 if (list
== 0 || !islist(ctx
,list
))
5655 if (ctx
->ListState
.CallDepth
== MAX_LIST_NESTING
) {
5656 /* raise an error? */
5661 dlist
= (struct mesa_display_list
*) _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
5665 ctx
->ListState
.CallStack
[ctx
->ListState
.CallDepth
++] = dlist
;
5667 if (ctx
->Driver
.BeginCallList
)
5668 ctx
->Driver
.BeginCallList( ctx
, dlist
);
5674 OpCode opcode
= n
[0].opcode
;
5675 int i
= (int)n
[0].opcode
- (int)OPCODE_EXT_0
;
5677 if (i
>= 0 && i
< (GLint
) ctx
->ListExt
.NumOpcodes
) {
5678 /* this is a driver-extended opcode */
5679 ctx
->ListExt
.Opcode
[i
].Execute(ctx
, &n
[1]);
5680 n
+= ctx
->ListExt
.Opcode
[i
].Size
;
5685 _mesa_error( ctx
, n
[1].e
, (const char *) n
[2].data
);
5688 (*ctx
->Exec
->Accum
)( n
[1].e
, n
[2].f
);
5690 case OPCODE_ALPHA_FUNC
:
5691 (*ctx
->Exec
->AlphaFunc
)( n
[1].e
, n
[2].f
);
5693 case OPCODE_BIND_TEXTURE
:
5694 (*ctx
->Exec
->BindTexture
)( n
[1].e
, n
[2].ui
);
5698 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5699 ctx
->Unpack
= ctx
->DefaultPacking
;
5700 (*ctx
->Exec
->Bitmap
)( (GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
5701 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
, (const GLubyte
*) n
[7].data
);
5702 ctx
->Unpack
= save
; /* restore */
5705 case OPCODE_BLEND_COLOR
:
5706 (*ctx
->Exec
->BlendColor
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
5708 case OPCODE_BLEND_EQUATION
:
5709 (*ctx
->Exec
->BlendEquation
)( n
[1].e
);
5711 case OPCODE_BLEND_EQUATION_SEPARATE
:
5712 (*ctx
->Exec
->BlendEquationSeparateEXT
)( n
[1].e
, n
[2].e
);
5714 case OPCODE_BLEND_FUNC_SEPARATE
:
5715 (*ctx
->Exec
->BlendFuncSeparateEXT
)(n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
);
5717 case OPCODE_CALL_LIST
:
5718 /* Generated by glCallList(), don't add ListBase */
5719 if (ctx
->ListState
.CallDepth
<MAX_LIST_NESTING
) {
5720 execute_list( ctx
, n
[1].ui
);
5723 case OPCODE_CALL_LIST_OFFSET
:
5724 /* Generated by glCallLists() so we must add ListBase */
5726 /* user specified a bad data type at compile time */
5727 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
5729 else if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
5730 execute_list( ctx
, ctx
->List
.ListBase
+ n
[1].ui
);
5734 (*ctx
->Exec
->Clear
)( n
[1].bf
);
5736 case OPCODE_CLEAR_COLOR
:
5737 (*ctx
->Exec
->ClearColor
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
5739 case OPCODE_CLEAR_ACCUM
:
5740 (*ctx
->Exec
->ClearAccum
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
5742 case OPCODE_CLEAR_DEPTH
:
5743 (*ctx
->Exec
->ClearDepth
)( (GLclampd
) n
[1].f
);
5745 case OPCODE_CLEAR_INDEX
:
5746 (*ctx
->Exec
->ClearIndex
)( (GLfloat
) n
[1].ui
);
5748 case OPCODE_CLEAR_STENCIL
:
5749 (*ctx
->Exec
->ClearStencil
)( n
[1].i
);
5751 case OPCODE_CLIP_PLANE
:
5758 (*ctx
->Exec
->ClipPlane
)( n
[1].e
, eq
);
5761 case OPCODE_COLOR_MASK
:
5762 (*ctx
->Exec
->ColorMask
)( n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
);
5764 case OPCODE_COLOR_MATERIAL
:
5765 (*ctx
->Exec
->ColorMaterial
)( n
[1].e
, n
[2].e
);
5767 case OPCODE_COLOR_TABLE
:
5769 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5770 ctx
->Unpack
= ctx
->DefaultPacking
;
5771 (*ctx
->Exec
->ColorTable
)( n
[1].e
, n
[2].e
, n
[3].i
, n
[4].e
,
5772 n
[5].e
, n
[6].data
);
5773 ctx
->Unpack
= save
; /* restore */
5776 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
5783 (*ctx
->Exec
->ColorTableParameterfv
)( n
[1].e
, n
[2].e
, params
);
5786 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
5793 (*ctx
->Exec
->ColorTableParameteriv
)( n
[1].e
, n
[2].e
, params
);
5796 case OPCODE_COLOR_SUB_TABLE
:
5798 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5799 ctx
->Unpack
= ctx
->DefaultPacking
;
5800 (*ctx
->Exec
->ColorSubTable
)( n
[1].e
, n
[2].i
, n
[3].i
,
5801 n
[4].e
, n
[5].e
, n
[6].data
);
5802 ctx
->Unpack
= save
; /* restore */
5805 case OPCODE_CONVOLUTION_FILTER_1D
:
5807 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5808 ctx
->Unpack
= ctx
->DefaultPacking
;
5809 (*ctx
->Exec
->ConvolutionFilter1D
)( n
[1].e
, n
[2].i
, n
[3].i
,
5810 n
[4].e
, n
[5].e
, n
[6].data
);
5811 ctx
->Unpack
= save
; /* restore */
5814 case OPCODE_CONVOLUTION_FILTER_2D
:
5816 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5817 ctx
->Unpack
= ctx
->DefaultPacking
;
5818 (*ctx
->Exec
->ConvolutionFilter2D
)( n
[1].e
, n
[2].i
, n
[3].i
,
5819 n
[4].i
, n
[5].e
, n
[6].e
, n
[7].data
);
5820 ctx
->Unpack
= save
; /* restore */
5823 case OPCODE_CONVOLUTION_PARAMETER_I
:
5824 (*ctx
->Exec
->ConvolutionParameteri
)( n
[1].e
, n
[2].e
, n
[3].i
);
5826 case OPCODE_CONVOLUTION_PARAMETER_IV
:
5833 (*ctx
->Exec
->ConvolutionParameteriv
)( n
[1].e
, n
[2].e
, params
);
5836 case OPCODE_CONVOLUTION_PARAMETER_F
:
5837 (*ctx
->Exec
->ConvolutionParameterf
)( n
[1].e
, n
[2].e
, n
[3].f
);
5839 case OPCODE_CONVOLUTION_PARAMETER_FV
:
5846 (*ctx
->Exec
->ConvolutionParameterfv
)( n
[1].e
, n
[2].e
, params
);
5849 case OPCODE_COPY_COLOR_SUB_TABLE
:
5850 (*ctx
->Exec
->CopyColorSubTable
)( n
[1].e
, n
[2].i
,
5851 n
[3].i
, n
[4].i
, n
[5].i
);
5853 case OPCODE_COPY_COLOR_TABLE
:
5854 (*ctx
->Exec
->CopyColorSubTable
)( n
[1].e
, n
[2].i
,
5855 n
[3].i
, n
[4].i
, n
[5].i
);
5857 case OPCODE_COPY_PIXELS
:
5858 (*ctx
->Exec
->CopyPixels
)( n
[1].i
, n
[2].i
,
5859 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
, n
[5].e
);
5861 case OPCODE_COPY_TEX_IMAGE1D
:
5862 (*ctx
->Exec
->CopyTexImage1D
)( n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
5863 n
[5].i
, n
[6].i
, n
[7].i
);
5865 case OPCODE_COPY_TEX_IMAGE2D
:
5866 (*ctx
->Exec
->CopyTexImage2D
)( n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
5867 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
);
5869 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
5870 (*ctx
->Exec
->CopyTexSubImage1D
)( n
[1].e
, n
[2].i
, n
[3].i
,
5871 n
[4].i
, n
[5].i
, n
[6].i
);
5873 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
5874 (*ctx
->Exec
->CopyTexSubImage2D
)( n
[1].e
, n
[2].i
, n
[3].i
,
5875 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
);
5877 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
5878 (*ctx
->Exec
->CopyTexSubImage3D
)( n
[1].e
, n
[2].i
, n
[3].i
,
5879 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
5881 case OPCODE_CULL_FACE
:
5882 (*ctx
->Exec
->CullFace
)( n
[1].e
);
5884 case OPCODE_DEPTH_FUNC
:
5885 (*ctx
->Exec
->DepthFunc
)( n
[1].e
);
5887 case OPCODE_DEPTH_MASK
:
5888 (*ctx
->Exec
->DepthMask
)( n
[1].b
);
5890 case OPCODE_DEPTH_RANGE
:
5891 (*ctx
->Exec
->DepthRange
)( (GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
);
5893 case OPCODE_DISABLE
:
5894 (*ctx
->Exec
->Disable
)( n
[1].e
);
5896 case OPCODE_DRAW_BUFFER
:
5897 (*ctx
->Exec
->DrawBuffer
)( n
[1].e
);
5899 case OPCODE_DRAW_PIXELS
:
5901 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5902 ctx
->Unpack
= ctx
->DefaultPacking
;
5903 (*ctx
->Exec
->DrawPixels
)( n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
5905 ctx
->Unpack
= save
; /* restore */
5909 (*ctx
->Exec
->Enable
)( n
[1].e
);
5911 case OPCODE_EVALMESH1
:
5912 (*ctx
->Exec
->EvalMesh1
)( n
[1].e
, n
[2].i
, n
[3].i
);
5914 case OPCODE_EVALMESH2
:
5915 (*ctx
->Exec
->EvalMesh2
)( n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
);
5924 (*ctx
->Exec
->Fogfv
)( n
[1].e
, p
);
5927 case OPCODE_FRONT_FACE
:
5928 (*ctx
->Exec
->FrontFace
)( n
[1].e
);
5930 case OPCODE_FRUSTUM
:
5931 (*ctx
->Exec
->Frustum
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
5934 (*ctx
->Exec
->Hint
)( n
[1].e
, n
[2].e
);
5936 case OPCODE_HISTOGRAM
:
5937 (*ctx
->Exec
->Histogram
)( n
[1].e
, n
[2].i
, n
[3].e
, n
[4].b
);
5939 case OPCODE_INDEX_MASK
:
5940 (*ctx
->Exec
->IndexMask
)( n
[1].ui
);
5942 case OPCODE_INIT_NAMES
:
5943 (*ctx
->Exec
->InitNames
)();
5952 (*ctx
->Exec
->Lightfv
)( n
[1].e
, n
[2].e
, p
);
5955 case OPCODE_LIGHT_MODEL
:
5962 (*ctx
->Exec
->LightModelfv
)( n
[1].e
, p
);
5965 case OPCODE_LINE_STIPPLE
:
5966 (*ctx
->Exec
->LineStipple
)( n
[1].i
, n
[2].us
);
5968 case OPCODE_LINE_WIDTH
:
5969 (*ctx
->Exec
->LineWidth
)( n
[1].f
);
5971 case OPCODE_LIST_BASE
:
5972 (*ctx
->Exec
->ListBase
)( n
[1].ui
);
5974 case OPCODE_LOAD_IDENTITY
:
5975 (*ctx
->Exec
->LoadIdentity
)();
5977 case OPCODE_LOAD_MATRIX
:
5978 if (sizeof(Node
)==sizeof(GLfloat
)) {
5979 (*ctx
->Exec
->LoadMatrixf
)( &n
[1].f
);
5984 for (i
=0;i
<16;i
++) {
5987 (*ctx
->Exec
->LoadMatrixf
)( m
);
5990 case OPCODE_LOAD_NAME
:
5991 (*ctx
->Exec
->LoadName
)( n
[1].ui
);
5993 case OPCODE_LOGIC_OP
:
5994 (*ctx
->Exec
->LogicOp
)( n
[1].e
);
5998 GLenum target
= n
[1].e
;
5999 GLint ustride
= _mesa_evaluator_components(target
);
6000 GLint uorder
= n
[5].i
;
6001 GLfloat u1
= n
[2].f
;
6002 GLfloat u2
= n
[3].f
;
6003 (*ctx
->Exec
->Map1f
)( target
, u1
, u2
, ustride
, uorder
,
6004 (GLfloat
*) n
[6].data
);
6009 GLenum target
= n
[1].e
;
6010 GLfloat u1
= n
[2].f
;
6011 GLfloat u2
= n
[3].f
;
6012 GLfloat v1
= n
[4].f
;
6013 GLfloat v2
= n
[5].f
;
6014 GLint ustride
= n
[6].i
;
6015 GLint vstride
= n
[7].i
;
6016 GLint uorder
= n
[8].i
;
6017 GLint vorder
= n
[9].i
;
6018 (*ctx
->Exec
->Map2f
)( target
, u1
, u2
, ustride
, uorder
,
6019 v1
, v2
, vstride
, vorder
,
6020 (GLfloat
*) n
[10].data
);
6023 case OPCODE_MAPGRID1
:
6024 (*ctx
->Exec
->MapGrid1f
)( n
[1].i
, n
[2].f
, n
[3].f
);
6026 case OPCODE_MAPGRID2
:
6027 (*ctx
->Exec
->MapGrid2f
)( n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
6029 case OPCODE_MATRIX_MODE
:
6030 (*ctx
->Exec
->MatrixMode
)( n
[1].e
);
6032 case OPCODE_MIN_MAX
:
6033 (*ctx
->Exec
->Minmax
)(n
[1].e
, n
[2].e
, n
[3].b
);
6035 case OPCODE_MULT_MATRIX
:
6036 if (sizeof(Node
)==sizeof(GLfloat
)) {
6037 (*ctx
->Exec
->MultMatrixf
)( &n
[1].f
);
6042 for (i
=0;i
<16;i
++) {
6045 (*ctx
->Exec
->MultMatrixf
)( m
);
6049 (*ctx
->Exec
->Ortho
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
6051 case OPCODE_PASSTHROUGH
:
6052 (*ctx
->Exec
->PassThrough
)( n
[1].f
);
6054 case OPCODE_PIXEL_MAP
:
6055 (*ctx
->Exec
->PixelMapfv
)( n
[1].e
, n
[2].i
, (GLfloat
*) n
[3].data
);
6057 case OPCODE_PIXEL_TRANSFER
:
6058 (*ctx
->Exec
->PixelTransferf
)( n
[1].e
, n
[2].f
);
6060 case OPCODE_PIXEL_ZOOM
:
6061 (*ctx
->Exec
->PixelZoom
)( n
[1].f
, n
[2].f
);
6063 case OPCODE_POINT_SIZE
:
6064 (*ctx
->Exec
->PointSize
)( n
[1].f
);
6066 case OPCODE_POINT_PARAMETERS
:
6072 (*ctx
->Exec
->PointParameterfvEXT
)( n
[1].e
, params
);
6075 case OPCODE_POLYGON_MODE
:
6076 (*ctx
->Exec
->PolygonMode
)( n
[1].e
, n
[2].e
);
6078 case OPCODE_POLYGON_STIPPLE
:
6079 (*ctx
->Exec
->PolygonStipple
)( (GLubyte
*) n
[1].data
);
6081 case OPCODE_POLYGON_OFFSET
:
6082 (*ctx
->Exec
->PolygonOffset
)( n
[1].f
, n
[2].f
);
6084 case OPCODE_POP_ATTRIB
:
6085 (*ctx
->Exec
->PopAttrib
)();
6087 case OPCODE_POP_MATRIX
:
6088 (*ctx
->Exec
->PopMatrix
)();
6090 case OPCODE_POP_NAME
:
6091 (*ctx
->Exec
->PopName
)();
6093 case OPCODE_PRIORITIZE_TEXTURE
:
6094 (*ctx
->Exec
->PrioritizeTextures
)( 1, &n
[1].ui
, &n
[2].f
);
6096 case OPCODE_PUSH_ATTRIB
:
6097 (*ctx
->Exec
->PushAttrib
)( n
[1].bf
);
6099 case OPCODE_PUSH_MATRIX
:
6100 (*ctx
->Exec
->PushMatrix
)();
6102 case OPCODE_PUSH_NAME
:
6103 (*ctx
->Exec
->PushName
)( n
[1].ui
);
6105 case OPCODE_RASTER_POS
:
6106 (*ctx
->Exec
->RasterPos4f
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
6108 case OPCODE_READ_BUFFER
:
6109 (*ctx
->Exec
->ReadBuffer
)( n
[1].e
);
6111 case OPCODE_RESET_HISTOGRAM
:
6112 (*ctx
->Exec
->ResetHistogram
)( n
[1].e
);
6114 case OPCODE_RESET_MIN_MAX
:
6115 (*ctx
->Exec
->ResetMinmax
)( n
[1].e
);
6118 (*ctx
->Exec
->Rotatef
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
6121 (*ctx
->Exec
->Scalef
)( n
[1].f
, n
[2].f
, n
[3].f
);
6123 case OPCODE_SCISSOR
:
6124 (*ctx
->Exec
->Scissor
)( n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
6126 case OPCODE_SHADE_MODEL
:
6127 (*ctx
->Exec
->ShadeModel
)( n
[1].e
);
6129 case OPCODE_STENCIL_FUNC
:
6130 (*ctx
->Exec
->StencilFunc
)( n
[1].e
, n
[2].i
, n
[3].ui
);
6132 case OPCODE_STENCIL_MASK
:
6133 (*ctx
->Exec
->StencilMask
)( n
[1].ui
);
6135 case OPCODE_STENCIL_OP
:
6136 (*ctx
->Exec
->StencilOp
)( n
[1].e
, n
[2].e
, n
[3].e
);
6138 case OPCODE_STENCIL_FUNC_SEPARATE
:
6139 ctx
->Exec
->StencilFuncSeparate( n
[1].e
, n
[2].e
, n
[3].i
, n
[4].ui
);
6141 case OPCODE_STENCIL_MASK_SEPARATE
:
6142 ctx
->Exec
->StencilMaskSeparate( n
[1].e
, n
[2].ui
);
6144 case OPCODE_STENCIL_OP_SEPARATE
:
6145 ctx
->Exec
->StencilOpSeparate( n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
);
6154 (*ctx
->Exec
->TexEnvfv
)( n
[1].e
, n
[2].e
, params
);
6164 (*ctx
->Exec
->TexGenfv
)( n
[1].e
, n
[2].e
, params
);
6167 case OPCODE_TEXPARAMETER
:
6174 (*ctx
->Exec
->TexParameterfv
)( n
[1].e
, n
[2].e
, params
);
6177 case OPCODE_TEX_IMAGE1D
:
6179 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6180 ctx
->Unpack
= ctx
->DefaultPacking
;
6181 (*ctx
->Exec
->TexImage1D
)(
6182 n
[1].e
, /* target */
6184 n
[3].i
, /* components */
6186 n
[5].e
, /* border */
6187 n
[6].e
, /* format */
6190 ctx
->Unpack
= save
; /* restore */
6193 case OPCODE_TEX_IMAGE2D
:
6195 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6196 ctx
->Unpack
= ctx
->DefaultPacking
;
6197 (*ctx
->Exec
->TexImage2D
)(
6198 n
[1].e
, /* target */
6200 n
[3].i
, /* components */
6202 n
[5].i
, /* height */
6203 n
[6].e
, /* border */
6204 n
[7].e
, /* format */
6207 ctx
->Unpack
= save
; /* restore */
6210 case OPCODE_TEX_IMAGE3D
:
6212 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6213 ctx
->Unpack
= ctx
->DefaultPacking
;
6214 (*ctx
->Exec
->TexImage3D
)(
6215 n
[1].e
, /* target */
6217 n
[3].i
, /* components */
6219 n
[5].i
, /* height */
6221 n
[7].e
, /* border */
6222 n
[8].e
, /* format */
6225 ctx
->Unpack
= save
; /* restore */
6228 case OPCODE_TEX_SUB_IMAGE1D
:
6230 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6231 ctx
->Unpack
= ctx
->DefaultPacking
;
6232 (*ctx
->Exec
->TexSubImage1D
)( n
[1].e
, n
[2].i
, n
[3].i
,
6234 n
[6].e
, n
[7].data
);
6235 ctx
->Unpack
= save
; /* restore */
6238 case OPCODE_TEX_SUB_IMAGE2D
:
6240 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6241 ctx
->Unpack
= ctx
->DefaultPacking
;
6242 (*ctx
->Exec
->TexSubImage2D
)( n
[1].e
, n
[2].i
, n
[3].i
,
6244 n
[6].i
, n
[7].e
, n
[8].e
, n
[9].data
);
6245 ctx
->Unpack
= save
; /* restore */
6248 case OPCODE_TEX_SUB_IMAGE3D
:
6250 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6251 ctx
->Unpack
= ctx
->DefaultPacking
;
6252 (*ctx
->Exec
->TexSubImage3D
)( n
[1].e
, n
[2].i
, n
[3].i
,
6253 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
6254 n
[8].i
, n
[9].e
, n
[10].e
,
6256 ctx
->Unpack
= save
; /* restore */
6259 case OPCODE_TRANSLATE
:
6260 (*ctx
->Exec
->Translatef
)( n
[1].f
, n
[2].f
, n
[3].f
);
6262 case OPCODE_VIEWPORT
:
6263 (*ctx
->Exec
->Viewport
)(n
[1].i
, n
[2].i
,
6264 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
);
6266 case OPCODE_WINDOW_POS
:
6267 (*ctx
->Exec
->WindowPos4fMESA
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
6269 case OPCODE_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
6270 (*ctx
->Exec
->ActiveTextureARB
)( n
[1].e
);
6272 case OPCODE_PIXEL_TEXGEN_SGIX
: /* GL_SGIX_pixel_texture */
6273 (*ctx
->Exec
->PixelTexGenSGIX
)( n
[1].e
);
6275 case OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS
: /* GL_SGIS_pixel_texture */
6276 (*ctx
->Exec
->PixelTexGenParameteriSGIS
)( n
[1].e
, n
[2].i
);
6278 case OPCODE_COMPRESSED_TEX_IMAGE_1D
: /* GL_ARB_texture_compression */
6279 (*ctx
->Exec
->CompressedTexImage1DARB
)(n
[1].e
, n
[2].i
, n
[3].e
,
6280 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].data
);
6282 case OPCODE_COMPRESSED_TEX_IMAGE_2D
: /* GL_ARB_texture_compression */
6283 (*ctx
->Exec
->CompressedTexImage2DARB
)(n
[1].e
, n
[2].i
, n
[3].e
,
6284 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].data
);
6286 case OPCODE_COMPRESSED_TEX_IMAGE_3D
: /* GL_ARB_texture_compression */
6287 (*ctx
->Exec
->CompressedTexImage3DARB
)(n
[1].e
, n
[2].i
, n
[3].e
,
6288 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
, n
[9].data
);
6290 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
: /* GL_ARB_texture_compress */
6291 (*ctx
->Exec
->CompressedTexSubImage1DARB
)(n
[1].e
, n
[2].i
, n
[3].i
,
6292 n
[4].i
, n
[5].e
, n
[6].i
, n
[7].data
);
6294 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
: /* GL_ARB_texture_compress */
6295 (*ctx
->Exec
->CompressedTexSubImage2DARB
)(n
[1].e
, n
[2].i
, n
[3].i
,
6296 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].e
, n
[8].i
, n
[9].data
);
6298 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
: /* GL_ARB_texture_compress */
6299 (*ctx
->Exec
->CompressedTexSubImage3DARB
)(n
[1].e
, n
[2].i
, n
[3].i
,
6300 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
6301 n
[9].e
, n
[10].i
, n
[11].data
);
6303 case OPCODE_SAMPLE_COVERAGE
: /* GL_ARB_multisample */
6304 (*ctx
->Exec
->SampleCoverageARB
)(n
[1].f
, n
[2].b
);
6306 case OPCODE_WINDOW_POS_ARB
: /* GL_ARB_window_pos */
6307 (*ctx
->Exec
->WindowPos3fMESA
)( n
[1].f
, n
[2].f
, n
[3].f
);
6309 #if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
6310 case OPCODE_BIND_PROGRAM_NV
: /* GL_NV_vertex_program */
6311 (*ctx
->Exec
->BindProgramNV
)( n
[1].e
, n
[2].ui
);
6314 #if FEATURE_NV_vertex_program
6315 case OPCODE_EXECUTE_PROGRAM_NV
:
6322 (*ctx
->Exec
->ExecuteProgramNV
)(n
[1].e
, n
[2].ui
, v
);
6325 case OPCODE_REQUEST_RESIDENT_PROGRAMS_NV
:
6326 (*ctx
->Exec
->RequestResidentProgramsNV
)(n
[1].ui
,
6327 (GLuint
*) n
[2].data
);
6329 case OPCODE_LOAD_PROGRAM_NV
:
6330 (*ctx
->Exec
->LoadProgramNV
)(n
[1].e
, n
[2].ui
, n
[3].i
,
6331 (const GLubyte
*) n
[4].data
);
6333 case OPCODE_PROGRAM_PARAMETER4F_NV
:
6334 (*ctx
->Exec
->ProgramParameter4fNV
)(n
[1].e
, n
[2].ui
, n
[3].f
,
6335 n
[4].f
, n
[5].f
, n
[6].f
);
6337 case OPCODE_TRACK_MATRIX_NV
:
6338 (*ctx
->Exec
->TrackMatrixNV
)(n
[1].e
, n
[2].ui
, n
[3].e
, n
[4].e
);
6342 #if FEATURE_NV_fragment_program
6343 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
:
6344 (*ctx
->Exec
->ProgramLocalParameter4fARB
)(n
[1].e
, n
[2].ui
, n
[3].f
,
6345 n
[4].f
, n
[5].f
, n
[6].f
);
6347 case OPCODE_PROGRAM_NAMED_PARAMETER_NV
:
6348 (*ctx
->Exec
->ProgramNamedParameter4fNV
)(n
[1].ui
, n
[2].i
,
6349 (const GLubyte
*) n
[3].data
,
6350 n
[4].f
, n
[5].f
, n
[6].f
, n
[7].f
);
6354 case OPCODE_ACTIVE_STENCIL_FACE_EXT
:
6355 (*ctx
->Exec
->ActiveStencilFaceEXT
)(n
[1].e
);
6357 case OPCODE_DEPTH_BOUNDS_EXT
:
6358 (*ctx
->Exec
->DepthBoundsEXT
)(n
[1].f
, n
[2].f
);
6360 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
6361 case OPCODE_PROGRAM_STRING_ARB
:
6362 (*ctx
->Exec
->ProgramStringARB
)(n
[1].e
, n
[2].e
, n
[3].i
, n
[4].data
);
6364 case OPCODE_PROGRAM_ENV_PARAMETER_ARB
:
6365 (*ctx
->Exec
->ProgramEnvParameter4fARB
)(n
[1].e
, n
[2].ui
, n
[3].f
,
6366 n
[4].f
, n
[5].f
, n
[6].f
);
6369 #if FEATURE_ARB_occlusion_query
6370 case OPCODE_BEGIN_QUERY_ARB
:
6371 ctx
->Exec
->BeginQueryARB(n
[1].e
, n
[2].ui
);
6373 case OPCODE_END_QUERY_ARB
:
6374 ctx
->Exec
->EndQueryARB(n
[1].e
);
6377 case OPCODE_DRAW_BUFFERS_ARB
:
6379 GLenum buffers
[MAX_DRAW_BUFFERS
];
6380 GLint i
, count
= MIN2(n
[1].i
, MAX_DRAW_BUFFERS
);
6381 for (i
= 0; i
< count
; i
++)
6382 buffers
[i
] = n
[2 + i
].e
;
6383 ctx
->Exec
->DrawBuffersARB(n
[1].i
, buffers
);
6386 #if FEATURE_ATI_fragment_shader
6387 case OPCODE_BIND_FRAGMENT_SHADER_ATI
:
6388 ctx
->Exec
->BindFragmentShaderATI(n
[1].i
);
6390 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
:
6393 GLuint i
, dst
= n
[1].ui
;
6395 for (i
= 0; i
< 4; i
++)
6396 values
[i
] = n
[1+i
].f
;
6397 ctx
->Exec
->SetFragmentShaderConstantATI(dst
, values
);
6401 case OPCODE_ATTR_1F_NV
:
6402 (*ctx
->Exec
->VertexAttrib1fNV
)(n
[1].e
, n
[2].f
);
6404 case OPCODE_ATTR_2F_NV
:
6405 /* Really shouldn't have to do this - the Node structure
6406 * is convenient, but it would be better to store the data
6407 * packed appropriately so that it can be sent directly
6408 * on. With x86_64 becoming common, this will start to
6411 if (sizeof(Node
)==sizeof(GLfloat
))
6412 (*ctx
->Exec
->VertexAttrib2fvNV
)(n
[1].e
, &n
[2].f
);
6414 (*ctx
->Exec
->VertexAttrib2fNV
)(n
[1].e
, n
[2].f
, n
[3].f
);
6416 case OPCODE_ATTR_3F_NV
:
6417 if (sizeof(Node
)==sizeof(GLfloat
))
6418 (*ctx
->Exec
->VertexAttrib3fvNV
)(n
[1].e
, &n
[2].f
);
6420 (*ctx
->Exec
->VertexAttrib3fNV
)(n
[1].e
, n
[2].f
, n
[3].f
,
6423 case OPCODE_ATTR_4F_NV
:
6424 if (sizeof(Node
)==sizeof(GLfloat
))
6425 (*ctx
->Exec
->VertexAttrib4fvNV
)(n
[1].e
, &n
[2].f
);
6427 (*ctx
->Exec
->VertexAttrib4fNV
)(n
[1].e
, n
[2].f
, n
[3].f
,
6430 case OPCODE_ATTR_1F_ARB
:
6431 (*ctx
->Exec
->VertexAttrib1fARB
)(n
[1].e
, n
[2].f
);
6433 case OPCODE_ATTR_2F_ARB
:
6434 /* Really shouldn't have to do this - the Node structure
6435 * is convenient, but it would be better to store the data
6436 * packed appropriately so that it can be sent directly
6437 * on. With x86_64 becoming common, this will start to
6440 if (sizeof(Node
)==sizeof(GLfloat
))
6441 (*ctx
->Exec
->VertexAttrib2fvARB
)(n
[1].e
, &n
[2].f
);
6443 (*ctx
->Exec
->VertexAttrib2fARB
)(n
[1].e
, n
[2].f
, n
[3].f
);
6445 case OPCODE_ATTR_3F_ARB
:
6446 if (sizeof(Node
)==sizeof(GLfloat
))
6447 (*ctx
->Exec
->VertexAttrib3fvARB
)(n
[1].e
, &n
[2].f
);
6449 (*ctx
->Exec
->VertexAttrib3fARB
)(n
[1].e
, n
[2].f
, n
[3].f
,
6452 case OPCODE_ATTR_4F_ARB
:
6453 if (sizeof(Node
)==sizeof(GLfloat
))
6454 (*ctx
->Exec
->VertexAttrib4fvARB
)(n
[1].e
, &n
[2].f
);
6456 (*ctx
->Exec
->VertexAttrib4fARB
)(n
[1].e
, n
[2].f
, n
[3].f
,
6459 case OPCODE_MATERIAL
:
6460 if (sizeof(Node
)==sizeof(GLfloat
))
6461 (*ctx
->Exec
->Materialfv
)(n
[1].e
, n
[2].e
, &n
[3].f
);
6468 (*ctx
->Exec
->Materialfv
)(n
[1].e
, n
[2].e
, f
);
6472 (*ctx
->Exec
->Indexi
)(n
[1].i
);
6474 case OPCODE_EDGEFLAG
:
6475 (*ctx
->Exec
->EdgeFlag
)(n
[1].b
);
6478 (*ctx
->Exec
->Begin
)(n
[1].e
);
6481 (*ctx
->Exec
->End
)();
6484 (*ctx
->Exec
->Rectf
)(n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
6486 case OPCODE_EVAL_C1
:
6487 (*ctx
->Exec
->EvalCoord1f
)(n
[1].f
);
6489 case OPCODE_EVAL_C2
:
6490 (*ctx
->Exec
->EvalCoord2f
)(n
[1].f
, n
[2].f
);
6492 case OPCODE_EVAL_P1
:
6493 (*ctx
->Exec
->EvalPoint1
)(n
[1].i
);
6495 case OPCODE_EVAL_P2
:
6496 (*ctx
->Exec
->EvalPoint2
)(n
[1].i
, n
[2].i
);
6502 case OPCODE_CONTINUE
:
6503 n
= (Node
*) n
[1].next
;
6505 case OPCODE_END_OF_LIST
:
6511 _mesa_sprintf(msg
, "Error in execute_list: opcode=%d", (int) opcode
);
6512 _mesa_problem(ctx
, msg
);
6517 /* increment n to point to next compiled command */
6518 if (opcode
!=OPCODE_CONTINUE
) {
6519 n
+= InstSize
[opcode
];
6524 if (ctx
->Driver
.EndCallList
)
6525 ctx
->Driver
.EndCallList( ctx
);
6527 ctx
->ListState
.CallStack
[ctx
->ListState
.CallDepth
--] = NULL
;
6534 /**********************************************************************/
6536 /**********************************************************************/
6542 * Test if a display list number is valid.
6544 GLboolean GLAPIENTRY
6545 _mesa_IsList( GLuint list
)
6547 GET_CURRENT_CONTEXT(ctx
);
6548 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
6549 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
6550 return islist(ctx
, list
);
6555 * Delete a sequence of consecutive display lists.
6558 _mesa_DeleteLists( GLuint list
, GLsizei range
)
6560 GET_CURRENT_CONTEXT(ctx
);
6562 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
6563 ASSERT_OUTSIDE_BEGIN_END(ctx
);
6566 _mesa_error( ctx
, GL_INVALID_VALUE
, "glDeleteLists" );
6569 for (i
=list
;i
<list
+range
;i
++) {
6570 _mesa_destroy_list( ctx
, i
);
6577 * Return a display list number, n, such that lists n through n+range-1
6581 _mesa_GenLists(GLsizei range
)
6583 GET_CURRENT_CONTEXT(ctx
);
6585 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
6586 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, 0);
6589 _mesa_error( ctx
, GL_INVALID_VALUE
, "glGenLists" );
6597 * Make this an atomic operation
6599 _glthread_LOCK_MUTEX(ctx
->Shared
->Mutex
);
6601 base
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
6603 /* reserve the list IDs by with empty/dummy lists */
6605 for (i
=0; i
<range
; i
++) {
6606 _mesa_HashInsert(ctx
->Shared
->DisplayList
, base
+i
, make_list(base
+i
, 1));
6610 _glthread_UNLOCK_MUTEX(ctx
->Shared
->Mutex
);
6618 * Begin a new display list.
6621 _mesa_NewList( GLuint list
, GLenum mode
)
6623 GET_CURRENT_CONTEXT(ctx
);
6626 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
6627 ASSERT_OUTSIDE_BEGIN_END(ctx
);
6629 if (MESA_VERBOSE
&VERBOSE_API
)
6630 _mesa_debug(ctx
, "glNewList %u %s\n", list
,
6631 _mesa_lookup_enum_by_nr(mode
));
6634 _mesa_error( ctx
, GL_INVALID_VALUE
, "glNewList" );
6638 if (mode
!=GL_COMPILE
&& mode
!=GL_COMPILE_AND_EXECUTE
) {
6639 _mesa_error( ctx
, GL_INVALID_ENUM
, "glNewList" );
6643 if (ctx
->ListState
.CurrentListPtr
) {
6644 /* already compiling a display list */
6645 _mesa_error( ctx
, GL_INVALID_OPERATION
, "glNewList" );
6649 ctx
->CompileFlag
= GL_TRUE
;
6650 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
6652 /* Allocate new display list */
6653 ctx
->ListState
.CurrentListNum
= list
;
6654 ctx
->ListState
.CurrentList
= make_list( list
, BLOCK_SIZE
);
6655 ctx
->ListState
.CurrentBlock
= ctx
->ListState
.CurrentList
->node
;
6656 ctx
->ListState
.CurrentListPtr
= ctx
->ListState
.CurrentBlock
;
6657 ctx
->ListState
.CurrentPos
= 0;
6659 /* Reset acumulated list state:
6661 for (i
= 0; i
< VERT_ATTRIB_MAX
; i
++)
6662 ctx
->ListState
.ActiveAttribSize
[i
] = 0;
6664 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++)
6665 ctx
->ListState
.ActiveMaterialSize
[i
] = 0;
6667 ctx
->ListState
.ActiveIndex
= 0;
6668 ctx
->ListState
.ActiveEdgeFlag
= 0;
6670 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
6671 ctx
->Driver
.NewList( ctx
, list
, mode
);
6673 ctx
->CurrentDispatch
= ctx
->Save
;
6674 _glapi_set_dispatch( ctx
->CurrentDispatch
);
6680 * End definition of current display list.
6683 _mesa_EndList( void )
6685 GET_CURRENT_CONTEXT(ctx
);
6686 SAVE_FLUSH_VERTICES(ctx
);
6687 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
6689 if (MESA_VERBOSE
&VERBOSE_API
)
6690 _mesa_debug(ctx
, "glEndList\n");
6692 /* Check that a list is under construction */
6693 if (!ctx
->ListState
.CurrentListPtr
) {
6694 _mesa_error( ctx
, GL_INVALID_OPERATION
, "glEndList" );
6698 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_END_OF_LIST
, 0 );
6700 /* Destroy old list, if any */
6701 _mesa_destroy_list(ctx
, ctx
->ListState
.CurrentListNum
);
6702 /* Install the list */
6703 _mesa_HashInsert(ctx
->Shared
->DisplayList
, ctx
->ListState
.CurrentListNum
, ctx
->ListState
.CurrentList
);
6706 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
6707 mesa_print_display_list(ctx
->ListState
.CurrentListNum
);
6709 ctx
->Driver
.EndList( ctx
);
6711 ctx
->ListState
.CurrentList
= NULL
;
6712 ctx
->ListState
.CurrentListNum
= 0;
6713 ctx
->ListState
.CurrentListPtr
= NULL
;
6714 ctx
->ExecuteFlag
= GL_TRUE
;
6715 ctx
->CompileFlag
= GL_FALSE
;
6717 ctx
->CurrentDispatch
= ctx
->Exec
;
6718 _glapi_set_dispatch( ctx
->CurrentDispatch
);
6724 _mesa_CallList( GLuint list
)
6726 GLboolean save_compile_flag
;
6727 GET_CURRENT_CONTEXT(ctx
);
6728 FLUSH_CURRENT(ctx
, 0);
6729 /* VERY IMPORTANT: Save the CompileFlag status, turn it off, */
6730 /* execute the display list, and restore the CompileFlag. */
6732 if (MESA_VERBOSE
& VERBOSE_API
)
6733 _mesa_debug(ctx
, "glCallList %d\n", list
);
6736 _mesa_error(ctx
, GL_INVALID_VALUE
, "glCallList(list==0)");
6740 /* mesa_print_display_list( list ); */
6742 save_compile_flag
= ctx
->CompileFlag
;
6743 if (save_compile_flag
) {
6744 ctx
->CompileFlag
= GL_FALSE
;
6747 execute_list( ctx
, list
);
6748 ctx
->CompileFlag
= save_compile_flag
;
6750 /* also restore API function pointers to point to "save" versions */
6751 if (save_compile_flag
) {
6752 ctx
->CurrentDispatch
= ctx
->Save
;
6753 _glapi_set_dispatch( ctx
->CurrentDispatch
);
6760 * Execute glCallLists: call multiple display lists.
6763 _mesa_CallLists( GLsizei n
, GLenum type
, const GLvoid
*lists
)
6765 GET_CURRENT_CONTEXT(ctx
);
6768 GLboolean save_compile_flag
;
6770 if (MESA_VERBOSE
& VERBOSE_API
)
6771 _mesa_debug(ctx
, "glCallLists %d\n", n
);
6775 case GL_UNSIGNED_BYTE
:
6777 case GL_UNSIGNED_SHORT
:
6779 case GL_UNSIGNED_INT
:
6787 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
6791 /* Save the CompileFlag status, turn it off, execute display list,
6792 * and restore the CompileFlag.
6794 save_compile_flag
= ctx
->CompileFlag
;
6795 ctx
->CompileFlag
= GL_FALSE
;
6798 list
= translate_id( i
, type
, lists
);
6799 execute_list( ctx
, ctx
->List
.ListBase
+ list
);
6802 ctx
->CompileFlag
= save_compile_flag
;
6804 /* also restore API function pointers to point to "save" versions */
6805 if (save_compile_flag
) {
6806 ctx
->CurrentDispatch
= ctx
->Save
;
6807 _glapi_set_dispatch( ctx
->CurrentDispatch
);
6814 * Set the offset added to list numbers in glCallLists.
6817 _mesa_ListBase( GLuint base
)
6819 GET_CURRENT_CONTEXT(ctx
);
6820 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
6821 ASSERT_OUTSIDE_BEGIN_END(ctx
);
6822 ctx
->List
.ListBase
= base
;
6826 /* Can no longer assume ctx->Exec->Func is equal to _mesa_Func.
6828 static void GLAPIENTRY
exec_Finish( void )
6830 GET_CURRENT_CONTEXT(ctx
);
6831 FLUSH_VERTICES(ctx
, 0);
6832 ctx
->Exec
->Finish();
6835 static void GLAPIENTRY
exec_Flush( void )
6837 GET_CURRENT_CONTEXT(ctx
);
6838 FLUSH_VERTICES(ctx
, 0);
6839 ctx
->Exec
->Flush( );
6842 static void GLAPIENTRY
exec_GetBooleanv( GLenum pname
, GLboolean
*params
)
6844 GET_CURRENT_CONTEXT(ctx
);
6845 FLUSH_VERTICES(ctx
, 0);
6846 ctx
->Exec
->GetBooleanv( pname
, params
);
6849 static void GLAPIENTRY
exec_GetClipPlane( GLenum plane
, GLdouble
*equation
)
6851 GET_CURRENT_CONTEXT(ctx
);
6852 FLUSH_VERTICES(ctx
, 0);
6853 ctx
->Exec
->GetClipPlane( plane
, equation
);
6856 static void GLAPIENTRY
exec_GetDoublev( GLenum pname
, GLdouble
*params
)
6858 GET_CURRENT_CONTEXT(ctx
);
6859 FLUSH_VERTICES(ctx
, 0);
6860 ctx
->Exec
->GetDoublev( pname
, params
);
6863 static GLenum GLAPIENTRY
exec_GetError( void )
6865 GET_CURRENT_CONTEXT(ctx
);
6866 FLUSH_VERTICES(ctx
, 0);
6867 return ctx
->Exec
->GetError( );
6870 static void GLAPIENTRY
exec_GetFloatv( GLenum pname
, GLfloat
*params
)
6872 GET_CURRENT_CONTEXT(ctx
);
6873 FLUSH_VERTICES(ctx
, 0);
6874 ctx
->Exec
->GetFloatv( pname
, params
);
6877 static void GLAPIENTRY
exec_GetIntegerv( GLenum pname
, GLint
*params
)
6879 GET_CURRENT_CONTEXT(ctx
);
6880 FLUSH_VERTICES(ctx
, 0);
6881 ctx
->Exec
->GetIntegerv( pname
, params
);
6884 static void GLAPIENTRY
exec_GetLightfv( GLenum light
, GLenum pname
, GLfloat
*params
)
6886 GET_CURRENT_CONTEXT(ctx
);
6887 FLUSH_VERTICES(ctx
, 0);
6888 ctx
->Exec
->GetLightfv( light
, pname
, params
);
6891 static void GLAPIENTRY
exec_GetLightiv( GLenum light
, GLenum pname
, GLint
*params
)
6893 GET_CURRENT_CONTEXT(ctx
);
6894 FLUSH_VERTICES(ctx
, 0);
6895 ctx
->Exec
->GetLightiv( light
, pname
, params
);
6898 static void GLAPIENTRY
exec_GetMapdv( GLenum target
, GLenum query
, GLdouble
*v
)
6900 GET_CURRENT_CONTEXT(ctx
);
6901 FLUSH_VERTICES(ctx
, 0);
6902 ctx
->Exec
->GetMapdv( target
, query
, v
);
6905 static void GLAPIENTRY
exec_GetMapfv( GLenum target
, GLenum query
, GLfloat
*v
)
6907 GET_CURRENT_CONTEXT(ctx
);
6908 FLUSH_VERTICES(ctx
, 0);
6909 ctx
->Exec
->GetMapfv( target
, query
, v
);
6912 static void GLAPIENTRY
exec_GetMapiv( GLenum target
, GLenum query
, GLint
*v
)
6914 GET_CURRENT_CONTEXT(ctx
);
6915 FLUSH_VERTICES(ctx
, 0);
6916 ctx
->Exec
->GetMapiv( target
, query
, v
);
6919 static void GLAPIENTRY
exec_GetMaterialfv( GLenum face
, GLenum pname
, GLfloat
*params
)
6921 GET_CURRENT_CONTEXT(ctx
);
6922 FLUSH_VERTICES(ctx
, 0);
6923 ctx
->Exec
->GetMaterialfv( face
, pname
, params
);
6926 static void GLAPIENTRY
exec_GetMaterialiv( GLenum face
, GLenum pname
, GLint
*params
)
6928 GET_CURRENT_CONTEXT(ctx
);
6929 FLUSH_VERTICES(ctx
, 0);
6930 ctx
->Exec
->GetMaterialiv( face
, pname
, params
);
6933 static void GLAPIENTRY
exec_GetPixelMapfv( GLenum map
, GLfloat
*values
)
6935 GET_CURRENT_CONTEXT(ctx
);
6936 FLUSH_VERTICES(ctx
, 0);
6937 ctx
->Exec
->GetPixelMapfv( map
, values
);
6940 static void GLAPIENTRY
exec_GetPixelMapuiv( GLenum map
, GLuint
*values
)
6942 GET_CURRENT_CONTEXT(ctx
);
6943 FLUSH_VERTICES(ctx
, 0);
6944 ctx
->Exec
->GetPixelMapuiv( map
, values
);
6947 static void GLAPIENTRY
exec_GetPixelMapusv( GLenum map
, GLushort
*values
)
6949 GET_CURRENT_CONTEXT(ctx
);
6950 FLUSH_VERTICES(ctx
, 0);
6951 ctx
->Exec
->GetPixelMapusv( map
, values
);
6954 static void GLAPIENTRY
exec_GetPolygonStipple( GLubyte
*dest
)
6956 GET_CURRENT_CONTEXT(ctx
);
6957 FLUSH_VERTICES(ctx
, 0);
6958 ctx
->Exec
->GetPolygonStipple( dest
);
6961 static const GLubyte
* GLAPIENTRY
exec_GetString( GLenum name
)
6963 GET_CURRENT_CONTEXT(ctx
);
6964 FLUSH_VERTICES(ctx
, 0);
6965 return ctx
->Exec
->GetString( name
);
6968 static void GLAPIENTRY
exec_GetTexEnvfv( GLenum target
, GLenum pname
, GLfloat
*params
)
6970 GET_CURRENT_CONTEXT(ctx
);
6971 FLUSH_VERTICES(ctx
, 0);
6972 ctx
->Exec
->GetTexEnvfv( target
, pname
, params
);
6975 static void GLAPIENTRY
exec_GetTexEnviv( GLenum target
, GLenum pname
, GLint
*params
)
6977 GET_CURRENT_CONTEXT(ctx
);
6978 FLUSH_VERTICES(ctx
, 0);
6979 ctx
->Exec
->GetTexEnviv( target
, pname
, params
);
6982 static void GLAPIENTRY
exec_GetTexGendv( GLenum coord
, GLenum pname
, GLdouble
*params
)
6984 GET_CURRENT_CONTEXT(ctx
);
6985 FLUSH_VERTICES(ctx
, 0);
6986 ctx
->Exec
->GetTexGendv( coord
, pname
, params
);
6989 static void GLAPIENTRY
exec_GetTexGenfv( GLenum coord
, GLenum pname
, GLfloat
*params
)
6991 GET_CURRENT_CONTEXT(ctx
);
6992 FLUSH_VERTICES(ctx
, 0);
6993 ctx
->Exec
->GetTexGenfv( coord
, pname
, params
);
6996 static void GLAPIENTRY
exec_GetTexGeniv( GLenum coord
, GLenum pname
, GLint
*params
)
6998 GET_CURRENT_CONTEXT(ctx
);
6999 FLUSH_VERTICES(ctx
, 0);
7000 ctx
->Exec
->GetTexGeniv( coord
, pname
, params
);
7003 static void GLAPIENTRY
exec_GetTexImage( GLenum target
, GLint level
, GLenum format
,
7004 GLenum type
, GLvoid
*pixels
)
7006 GET_CURRENT_CONTEXT(ctx
);
7007 FLUSH_VERTICES(ctx
, 0);
7008 ctx
->Exec
->GetTexImage( target
, level
, format
, type
, pixels
);
7011 static void GLAPIENTRY
exec_GetTexLevelParameterfv( GLenum target
, GLint level
,
7012 GLenum pname
, GLfloat
*params
)
7014 GET_CURRENT_CONTEXT(ctx
);
7015 FLUSH_VERTICES(ctx
, 0);
7016 ctx
->Exec
->GetTexLevelParameterfv( target
, level
, pname
, params
);
7019 static void GLAPIENTRY
exec_GetTexLevelParameteriv( GLenum target
, GLint level
,
7020 GLenum pname
, GLint
*params
)
7022 GET_CURRENT_CONTEXT(ctx
);
7023 FLUSH_VERTICES(ctx
, 0);
7024 ctx
->Exec
->GetTexLevelParameteriv( target
, level
, pname
, params
);
7027 static void GLAPIENTRY
exec_GetTexParameterfv( GLenum target
, GLenum pname
,
7030 GET_CURRENT_CONTEXT(ctx
);
7031 FLUSH_VERTICES(ctx
, 0);
7032 ctx
->Exec
->GetTexParameterfv( target
, pname
, params
);
7035 static void GLAPIENTRY
exec_GetTexParameteriv( GLenum target
, GLenum pname
, GLint
*params
)
7037 GET_CURRENT_CONTEXT(ctx
);
7038 FLUSH_VERTICES(ctx
, 0);
7039 ctx
->Exec
->GetTexParameteriv( target
, pname
, params
);
7042 static GLboolean GLAPIENTRY
exec_IsEnabled( GLenum cap
)
7044 GET_CURRENT_CONTEXT(ctx
);
7045 FLUSH_VERTICES(ctx
, 0);
7046 return ctx
->Exec
->IsEnabled( cap
);
7049 static void GLAPIENTRY
exec_PixelStoref( GLenum pname
, GLfloat param
)
7051 GET_CURRENT_CONTEXT(ctx
);
7052 FLUSH_VERTICES(ctx
, 0);
7053 ctx
->Exec
->PixelStoref( pname
, param
);
7056 static void GLAPIENTRY
exec_PixelStorei( GLenum pname
, GLint param
)
7058 GET_CURRENT_CONTEXT(ctx
);
7059 FLUSH_VERTICES(ctx
, 0);
7060 ctx
->Exec
->PixelStorei( pname
, param
);
7063 static void GLAPIENTRY
exec_ReadPixels( GLint x
, GLint y
, GLsizei width
, GLsizei height
,
7064 GLenum format
, GLenum type
, GLvoid
*pixels
)
7066 GET_CURRENT_CONTEXT(ctx
);
7067 FLUSH_VERTICES(ctx
, 0);
7068 ctx
->Exec
->ReadPixels( x
, y
, width
, height
, format
, type
, pixels
);
7071 static GLint GLAPIENTRY
exec_RenderMode( GLenum mode
)
7073 GET_CURRENT_CONTEXT(ctx
);
7074 FLUSH_VERTICES(ctx
, 0);
7075 return ctx
->Exec
->RenderMode( mode
);
7078 static void GLAPIENTRY
exec_FeedbackBuffer( GLsizei size
, GLenum type
, GLfloat
*buffer
)
7080 GET_CURRENT_CONTEXT(ctx
);
7081 FLUSH_VERTICES(ctx
, 0);
7082 ctx
->Exec
->FeedbackBuffer( size
, type
, buffer
);
7085 static void GLAPIENTRY
exec_SelectBuffer( GLsizei size
, GLuint
*buffer
)
7087 GET_CURRENT_CONTEXT(ctx
);
7088 FLUSH_VERTICES(ctx
, 0);
7089 ctx
->Exec
->SelectBuffer( size
, buffer
);
7092 static GLboolean GLAPIENTRY
exec_AreTexturesResident(GLsizei n
, const GLuint
*texName
,
7093 GLboolean
*residences
)
7095 GET_CURRENT_CONTEXT(ctx
);
7096 FLUSH_VERTICES(ctx
, 0);
7097 return ctx
->Exec
->AreTexturesResident( n
, texName
, residences
);
7100 static void GLAPIENTRY
exec_ColorPointer(GLint size
, GLenum type
, GLsizei stride
,
7103 GET_CURRENT_CONTEXT(ctx
);
7104 FLUSH_VERTICES(ctx
, 0);
7105 ctx
->Exec
->ColorPointer( size
, type
, stride
, ptr
);
7108 static void GLAPIENTRY
exec_DeleteTextures( GLsizei n
, const GLuint
*texName
)
7110 GET_CURRENT_CONTEXT(ctx
);
7111 FLUSH_VERTICES(ctx
, 0);
7112 ctx
->Exec
->DeleteTextures( n
, texName
);
7115 static void GLAPIENTRY
exec_DisableClientState( GLenum cap
)
7117 GET_CURRENT_CONTEXT(ctx
);
7118 FLUSH_VERTICES(ctx
, 0);
7119 ctx
->Exec
->DisableClientState( cap
);
7122 static void GLAPIENTRY
exec_EdgeFlagPointer(GLsizei stride
, const GLvoid
*vptr
)
7124 GET_CURRENT_CONTEXT(ctx
);
7125 FLUSH_VERTICES(ctx
, 0);
7126 ctx
->Exec
->EdgeFlagPointer( stride
, vptr
);
7129 static void GLAPIENTRY
exec_EnableClientState( GLenum cap
)
7131 GET_CURRENT_CONTEXT(ctx
);
7132 FLUSH_VERTICES(ctx
, 0);
7133 ctx
->Exec
->EnableClientState( cap
);
7136 static void GLAPIENTRY
exec_GenTextures( GLsizei n
, GLuint
*texName
)
7138 GET_CURRENT_CONTEXT(ctx
);
7139 FLUSH_VERTICES(ctx
, 0);
7140 ctx
->Exec
->GenTextures( n
, texName
);
7143 static void GLAPIENTRY
exec_GetPointerv( GLenum pname
, GLvoid
**params
)
7145 GET_CURRENT_CONTEXT(ctx
);
7146 FLUSH_VERTICES(ctx
, 0);
7147 ctx
->Exec
->GetPointerv( pname
, params
);
7150 static void GLAPIENTRY
exec_IndexPointer(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
7152 GET_CURRENT_CONTEXT(ctx
);
7153 FLUSH_VERTICES(ctx
, 0);
7154 ctx
->Exec
->IndexPointer( type
, stride
, ptr
);
7157 static void GLAPIENTRY
exec_InterleavedArrays(GLenum format
, GLsizei stride
,
7158 const GLvoid
*pointer
)
7160 GET_CURRENT_CONTEXT(ctx
);
7161 FLUSH_VERTICES(ctx
, 0);
7162 ctx
->Exec
->InterleavedArrays( format
, stride
, pointer
);
7165 static GLboolean GLAPIENTRY
exec_IsTexture( GLuint texture
)
7167 GET_CURRENT_CONTEXT(ctx
);
7168 FLUSH_VERTICES(ctx
, 0);
7169 return ctx
->Exec
->IsTexture( texture
);
7172 static void GLAPIENTRY
exec_NormalPointer(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
7174 GET_CURRENT_CONTEXT(ctx
);
7175 FLUSH_VERTICES(ctx
, 0);
7176 ctx
->Exec
->NormalPointer( type
, stride
, ptr
);
7179 static void GLAPIENTRY
exec_PopClientAttrib(void)
7181 GET_CURRENT_CONTEXT(ctx
);
7182 FLUSH_VERTICES(ctx
, 0);
7183 ctx
->Exec
->PopClientAttrib();
7186 static void GLAPIENTRY
exec_PushClientAttrib(GLbitfield mask
)
7188 GET_CURRENT_CONTEXT(ctx
);
7189 FLUSH_VERTICES(ctx
, 0);
7190 ctx
->Exec
->PushClientAttrib( mask
);
7193 static void GLAPIENTRY
exec_TexCoordPointer(GLint size
, GLenum type
, GLsizei stride
,
7196 GET_CURRENT_CONTEXT(ctx
);
7197 FLUSH_VERTICES(ctx
, 0);
7198 ctx
->Exec
->TexCoordPointer( size
, type
, stride
, ptr
);
7201 static void GLAPIENTRY
exec_GetCompressedTexImageARB(GLenum target
, GLint level
,
7204 GET_CURRENT_CONTEXT(ctx
);
7205 FLUSH_VERTICES(ctx
, 0);
7206 ctx
->Exec
->GetCompressedTexImageARB( target
, level
, img
);
7209 static void GLAPIENTRY
exec_VertexPointer(GLint size
, GLenum type
, GLsizei stride
,
7212 GET_CURRENT_CONTEXT(ctx
);
7213 FLUSH_VERTICES(ctx
, 0);
7214 ctx
->Exec
->VertexPointer( size
, type
, stride
, ptr
);
7217 static void GLAPIENTRY
exec_CopyConvolutionFilter1D(GLenum target
, GLenum internalFormat
,
7218 GLint x
, GLint y
, GLsizei width
)
7220 GET_CURRENT_CONTEXT(ctx
);
7221 FLUSH_VERTICES(ctx
, 0);
7222 ctx
->Exec
->CopyConvolutionFilter1D( target
, internalFormat
, x
, y
, width
);
7225 static void GLAPIENTRY
exec_CopyConvolutionFilter2D(GLenum target
, GLenum internalFormat
,
7226 GLint x
, GLint y
, GLsizei width
,
7229 GET_CURRENT_CONTEXT(ctx
);
7230 FLUSH_VERTICES(ctx
, 0);
7231 ctx
->Exec
->CopyConvolutionFilter2D( target
, internalFormat
, x
, y
, width
,
7235 static void GLAPIENTRY
exec_GetColorTable( GLenum target
, GLenum format
,
7236 GLenum type
, GLvoid
*data
)
7238 GET_CURRENT_CONTEXT(ctx
);
7239 FLUSH_VERTICES(ctx
, 0);
7240 ctx
->Exec
->GetColorTable( target
, format
, type
, data
);
7243 static void GLAPIENTRY
exec_GetColorTableParameterfv( GLenum target
, GLenum pname
,
7246 GET_CURRENT_CONTEXT(ctx
);
7247 FLUSH_VERTICES(ctx
, 0);
7248 ctx
->Exec
->GetColorTableParameterfv( target
, pname
, params
);
7251 static void GLAPIENTRY
exec_GetColorTableParameteriv( GLenum target
, GLenum pname
,
7254 GET_CURRENT_CONTEXT(ctx
);
7255 FLUSH_VERTICES(ctx
, 0);
7256 ctx
->Exec
->GetColorTableParameteriv( target
, pname
, params
);
7259 static void GLAPIENTRY
exec_GetConvolutionFilter(GLenum target
, GLenum format
, GLenum type
,
7262 GET_CURRENT_CONTEXT(ctx
);
7263 FLUSH_VERTICES(ctx
, 0);
7264 ctx
->Exec
->GetConvolutionFilter( target
, format
, type
, image
);
7267 static void GLAPIENTRY
exec_GetConvolutionParameterfv(GLenum target
, GLenum pname
,
7270 GET_CURRENT_CONTEXT(ctx
);
7271 FLUSH_VERTICES(ctx
, 0);
7272 ctx
->Exec
->GetConvolutionParameterfv( target
, pname
, params
);
7275 static void GLAPIENTRY
exec_GetConvolutionParameteriv(GLenum target
, GLenum pname
,
7278 GET_CURRENT_CONTEXT(ctx
);
7279 FLUSH_VERTICES(ctx
, 0);
7280 ctx
->Exec
->GetConvolutionParameteriv( target
, pname
, params
);
7283 static void GLAPIENTRY
exec_GetHistogram(GLenum target
, GLboolean reset
, GLenum format
,
7284 GLenum type
, GLvoid
*values
)
7286 GET_CURRENT_CONTEXT(ctx
);
7287 FLUSH_VERTICES(ctx
, 0);
7288 ctx
->Exec
->GetHistogram( target
, reset
, format
, type
, values
);
7291 static void GLAPIENTRY
exec_GetHistogramParameterfv(GLenum target
, GLenum pname
,
7294 GET_CURRENT_CONTEXT(ctx
);
7295 FLUSH_VERTICES(ctx
, 0);
7296 ctx
->Exec
->GetHistogramParameterfv( target
, pname
, params
);
7299 static void GLAPIENTRY
exec_GetHistogramParameteriv(GLenum target
, GLenum pname
,
7302 GET_CURRENT_CONTEXT(ctx
);
7303 FLUSH_VERTICES(ctx
, 0);
7304 ctx
->Exec
->GetHistogramParameteriv( target
, pname
, params
);
7307 static void GLAPIENTRY
exec_GetMinmax(GLenum target
, GLboolean reset
, GLenum format
,
7308 GLenum type
, GLvoid
*values
)
7310 GET_CURRENT_CONTEXT(ctx
);
7311 FLUSH_VERTICES(ctx
, 0);
7312 ctx
->Exec
->GetMinmax( target
, reset
, format
, type
, values
);
7315 static void GLAPIENTRY
exec_GetMinmaxParameterfv(GLenum target
, GLenum pname
,
7318 GET_CURRENT_CONTEXT(ctx
);
7319 FLUSH_VERTICES(ctx
, 0);
7320 ctx
->Exec
->GetMinmaxParameterfv( target
, pname
, params
);
7323 static void GLAPIENTRY
exec_GetMinmaxParameteriv(GLenum target
, GLenum pname
,
7326 GET_CURRENT_CONTEXT(ctx
);
7327 FLUSH_VERTICES(ctx
, 0);
7328 ctx
->Exec
->GetMinmaxParameteriv( target
, pname
, params
);
7331 static void GLAPIENTRY
exec_GetSeparableFilter(GLenum target
, GLenum format
, GLenum type
,
7332 GLvoid
*row
, GLvoid
*column
, GLvoid
*span
)
7334 GET_CURRENT_CONTEXT(ctx
);
7335 FLUSH_VERTICES(ctx
, 0);
7336 ctx
->Exec
->GetSeparableFilter( target
, format
, type
, row
, column
, span
);
7339 static void GLAPIENTRY
exec_SeparableFilter2D(GLenum target
, GLenum internalFormat
,
7340 GLsizei width
, GLsizei height
, GLenum format
,
7341 GLenum type
, const GLvoid
*row
,
7342 const GLvoid
*column
)
7344 GET_CURRENT_CONTEXT(ctx
);
7345 FLUSH_VERTICES(ctx
, 0);
7346 ctx
->Exec
->SeparableFilter2D( target
, internalFormat
, width
, height
, format
,
7350 static void GLAPIENTRY
exec_GetPixelTexGenParameterivSGIS(GLenum target
, GLint
*value
)
7352 GET_CURRENT_CONTEXT(ctx
);
7353 FLUSH_VERTICES(ctx
, 0);
7354 ctx
->Exec
->GetPixelTexGenParameterivSGIS( target
, value
);
7357 static void GLAPIENTRY
exec_GetPixelTexGenParameterfvSGIS(GLenum target
, GLfloat
*value
)
7359 GET_CURRENT_CONTEXT(ctx
);
7360 FLUSH_VERTICES(ctx
, 0);
7361 ctx
->Exec
->GetPixelTexGenParameterfvSGIS( target
, value
);
7364 static void GLAPIENTRY
exec_ColorPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
7365 GLsizei count
, const GLvoid
*ptr
)
7367 GET_CURRENT_CONTEXT(ctx
);
7368 FLUSH_VERTICES(ctx
, 0);
7369 ctx
->Exec
->ColorPointerEXT( size
, type
, stride
, count
, ptr
);
7372 static void GLAPIENTRY
exec_EdgeFlagPointerEXT(GLsizei stride
, GLsizei count
,
7373 const GLboolean
*ptr
)
7375 GET_CURRENT_CONTEXT(ctx
);
7376 FLUSH_VERTICES(ctx
, 0);
7377 ctx
->Exec
->EdgeFlagPointerEXT( stride
, count
, ptr
);
7380 static void GLAPIENTRY
exec_IndexPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
,
7383 GET_CURRENT_CONTEXT(ctx
);
7384 FLUSH_VERTICES(ctx
, 0);
7385 ctx
->Exec
->IndexPointerEXT( type
, stride
, count
, ptr
);
7388 static void GLAPIENTRY
exec_NormalPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
,
7391 GET_CURRENT_CONTEXT(ctx
);
7392 FLUSH_VERTICES(ctx
, 0);
7393 ctx
->Exec
->NormalPointerEXT( type
, stride
, count
, ptr
);
7396 static void GLAPIENTRY
exec_TexCoordPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
7397 GLsizei count
, const GLvoid
*ptr
)
7399 GET_CURRENT_CONTEXT(ctx
);
7400 FLUSH_VERTICES(ctx
, 0);
7401 ctx
->Exec
->TexCoordPointerEXT( size
, type
, stride
, count
, ptr
);
7404 static void GLAPIENTRY
exec_VertexPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
7405 GLsizei count
, const GLvoid
*ptr
)
7407 GET_CURRENT_CONTEXT(ctx
);
7408 FLUSH_VERTICES(ctx
, 0);
7409 ctx
->Exec
->VertexPointerEXT( size
, type
, stride
, count
, ptr
);
7412 static void GLAPIENTRY
exec_LockArraysEXT(GLint first
, GLsizei count
)
7414 GET_CURRENT_CONTEXT(ctx
);
7415 FLUSH_VERTICES(ctx
, 0);
7416 ctx
->Exec
->LockArraysEXT( first
, count
);
7419 static void GLAPIENTRY
exec_UnlockArraysEXT( void )
7421 GET_CURRENT_CONTEXT(ctx
);
7422 FLUSH_VERTICES(ctx
, 0);
7423 ctx
->Exec
->UnlockArraysEXT( );
7426 static void GLAPIENTRY
exec_ClientActiveTextureARB( GLenum target
)
7428 GET_CURRENT_CONTEXT(ctx
);
7429 FLUSH_VERTICES(ctx
, 0);
7430 ctx
->Exec
->ClientActiveTextureARB(target
);
7433 static void GLAPIENTRY
exec_SecondaryColorPointerEXT(GLint size
, GLenum type
,
7434 GLsizei stride
, const GLvoid
*ptr
)
7436 GET_CURRENT_CONTEXT(ctx
);
7437 FLUSH_VERTICES(ctx
, 0);
7438 ctx
->Exec
->SecondaryColorPointerEXT( size
, type
, stride
, ptr
);
7441 static void GLAPIENTRY
exec_FogCoordPointerEXT(GLenum type
, GLsizei stride
,
7444 GET_CURRENT_CONTEXT(ctx
);
7445 FLUSH_VERTICES(ctx
, 0);
7446 ctx
->Exec
->FogCoordPointerEXT( type
, stride
, ptr
);
7449 /* GL_EXT_multi_draw_arrays */
7450 static void GLAPIENTRY
exec_MultiDrawArraysEXT(GLenum mode
, GLint
*first
,
7451 GLsizei
*count
, GLsizei primcount
)
7453 GET_CURRENT_CONTEXT(ctx
);
7454 FLUSH_VERTICES(ctx
, 0);
7455 ctx
->Exec
->MultiDrawArraysEXT( mode
, first
, count
, primcount
);
7458 /* GL_EXT_multi_draw_arrays */
7459 static void GLAPIENTRY
exec_MultiDrawElementsEXT(GLenum mode
, const GLsizei
*count
,
7460 GLenum type
, const GLvoid
**indices
,
7463 GET_CURRENT_CONTEXT(ctx
);
7464 FLUSH_VERTICES(ctx
, 0);
7465 ctx
->Exec
->MultiDrawElementsEXT(mode
, count
, type
, indices
, primcount
);
7468 /* GL_IBM_multimode_draw_arrays */
7469 static void GLAPIENTRY
exec_MultiModeDrawArraysIBM(const GLenum
*mode
, const GLint
*first
,
7470 const GLsizei
*count
, GLsizei primcount
,
7473 GET_CURRENT_CONTEXT(ctx
);
7474 FLUSH_VERTICES(ctx
, 0);
7475 ctx
->Exec
->MultiModeDrawArraysIBM(mode
, first
, count
, primcount
, modestride
);
7478 /* GL_IBM_multimode_draw_arrays */
7479 static void GLAPIENTRY
exec_MultiModeDrawElementsIBM(const GLenum
*mode
,
7480 const GLsizei
*count
,
7482 const GLvoid
* const *indices
,
7483 GLsizei primcount
, GLint modestride
)
7485 GET_CURRENT_CONTEXT(ctx
);
7486 FLUSH_VERTICES(ctx
, 0);
7487 ctx
->Exec
->MultiModeDrawElementsIBM(mode
, count
, type
, indices
, primcount
,
7495 * Setup the given dispatch table to point to Mesa's display list
7496 * building functions.
7498 * This does not include any of the tnl functions - they are
7499 * initialized from _mesa_init_api_defaults and from the active vtxfmt
7503 _mesa_init_dlist_table( struct _glapi_table
*table
)
7505 _mesa_loopback_init_api_table( table
);
7508 table
->Accum
= save_Accum
;
7509 table
->AlphaFunc
= save_AlphaFunc
;
7510 table
->Bitmap
= save_Bitmap
;
7511 table
->BlendFunc
= _mesa_BlendFunc
; /* loops-back to BlendFuncSeparate */
7512 table
->CallList
= _mesa_save_CallList
;
7513 table
->CallLists
= _mesa_save_CallLists
;
7514 table
->Clear
= save_Clear
;
7515 table
->ClearAccum
= save_ClearAccum
;
7516 table
->ClearColor
= save_ClearColor
;
7517 table
->ClearDepth
= save_ClearDepth
;
7518 table
->ClearIndex
= save_ClearIndex
;
7519 table
->ClearStencil
= save_ClearStencil
;
7520 table
->ClipPlane
= save_ClipPlane
;
7521 table
->ColorMask
= save_ColorMask
;
7522 table
->ColorMaterial
= save_ColorMaterial
;
7523 table
->CopyPixels
= save_CopyPixels
;
7524 table
->CullFace
= save_CullFace
;
7525 table
->DeleteLists
= _mesa_DeleteLists
;
7526 table
->DepthFunc
= save_DepthFunc
;
7527 table
->DepthMask
= save_DepthMask
;
7528 table
->DepthRange
= save_DepthRange
;
7529 table
->Disable
= save_Disable
;
7530 table
->DrawBuffer
= save_DrawBuffer
;
7531 table
->DrawPixels
= save_DrawPixels
;
7532 table
->Enable
= save_Enable
;
7533 table
->EndList
= _mesa_EndList
;
7534 table
->EvalMesh1
= _mesa_save_EvalMesh1
;
7535 table
->EvalMesh2
= _mesa_save_EvalMesh2
;
7536 table
->Finish
= exec_Finish
;
7537 table
->Flush
= exec_Flush
;
7538 table
->Fogf
= save_Fogf
;
7539 table
->Fogfv
= save_Fogfv
;
7540 table
->Fogi
= save_Fogi
;
7541 table
->Fogiv
= save_Fogiv
;
7542 table
->FrontFace
= save_FrontFace
;
7543 table
->Frustum
= save_Frustum
;
7544 table
->GenLists
= _mesa_GenLists
;
7545 table
->GetBooleanv
= exec_GetBooleanv
;
7546 table
->GetClipPlane
= exec_GetClipPlane
;
7547 table
->GetDoublev
= exec_GetDoublev
;
7548 table
->GetError
= exec_GetError
;
7549 table
->GetFloatv
= exec_GetFloatv
;
7550 table
->GetIntegerv
= exec_GetIntegerv
;
7551 table
->GetLightfv
= exec_GetLightfv
;
7552 table
->GetLightiv
= exec_GetLightiv
;
7553 table
->GetMapdv
= exec_GetMapdv
;
7554 table
->GetMapfv
= exec_GetMapfv
;
7555 table
->GetMapiv
= exec_GetMapiv
;
7556 table
->GetMaterialfv
= exec_GetMaterialfv
;
7557 table
->GetMaterialiv
= exec_GetMaterialiv
;
7558 table
->GetPixelMapfv
= exec_GetPixelMapfv
;
7559 table
->GetPixelMapuiv
= exec_GetPixelMapuiv
;
7560 table
->GetPixelMapusv
= exec_GetPixelMapusv
;
7561 table
->GetPolygonStipple
= exec_GetPolygonStipple
;
7562 table
->GetString
= exec_GetString
;
7563 table
->GetTexEnvfv
= exec_GetTexEnvfv
;
7564 table
->GetTexEnviv
= exec_GetTexEnviv
;
7565 table
->GetTexGendv
= exec_GetTexGendv
;
7566 table
->GetTexGenfv
= exec_GetTexGenfv
;
7567 table
->GetTexGeniv
= exec_GetTexGeniv
;
7568 table
->GetTexImage
= exec_GetTexImage
;
7569 table
->GetTexLevelParameterfv
= exec_GetTexLevelParameterfv
;
7570 table
->GetTexLevelParameteriv
= exec_GetTexLevelParameteriv
;
7571 table
->GetTexParameterfv
= exec_GetTexParameterfv
;
7572 table
->GetTexParameteriv
= exec_GetTexParameteriv
;
7573 table
->Hint
= save_Hint
;
7574 table
->IndexMask
= save_IndexMask
;
7575 table
->InitNames
= save_InitNames
;
7576 table
->IsEnabled
= exec_IsEnabled
;
7577 table
->IsList
= _mesa_IsList
;
7578 table
->LightModelf
= save_LightModelf
;
7579 table
->LightModelfv
= save_LightModelfv
;
7580 table
->LightModeli
= save_LightModeli
;
7581 table
->LightModeliv
= save_LightModeliv
;
7582 table
->Lightf
= save_Lightf
;
7583 table
->Lightfv
= save_Lightfv
;
7584 table
->Lighti
= save_Lighti
;
7585 table
->Lightiv
= save_Lightiv
;
7586 table
->LineStipple
= save_LineStipple
;
7587 table
->LineWidth
= save_LineWidth
;
7588 table
->ListBase
= save_ListBase
;
7589 table
->LoadIdentity
= save_LoadIdentity
;
7590 table
->LoadMatrixd
= save_LoadMatrixd
;
7591 table
->LoadMatrixf
= save_LoadMatrixf
;
7592 table
->LoadName
= save_LoadName
;
7593 table
->LogicOp
= save_LogicOp
;
7594 table
->Map1d
= save_Map1d
;
7595 table
->Map1f
= save_Map1f
;
7596 table
->Map2d
= save_Map2d
;
7597 table
->Map2f
= save_Map2f
;
7598 table
->MapGrid1d
= save_MapGrid1d
;
7599 table
->MapGrid1f
= save_MapGrid1f
;
7600 table
->MapGrid2d
= save_MapGrid2d
;
7601 table
->MapGrid2f
= save_MapGrid2f
;
7602 table
->MatrixMode
= save_MatrixMode
;
7603 table
->MultMatrixd
= save_MultMatrixd
;
7604 table
->MultMatrixf
= save_MultMatrixf
;
7605 table
->NewList
= save_NewList
;
7606 table
->Ortho
= save_Ortho
;
7607 table
->PassThrough
= save_PassThrough
;
7608 table
->PixelMapfv
= save_PixelMapfv
;
7609 table
->PixelMapuiv
= save_PixelMapuiv
;
7610 table
->PixelMapusv
= save_PixelMapusv
;
7611 table
->PixelStoref
= exec_PixelStoref
;
7612 table
->PixelStorei
= exec_PixelStorei
;
7613 table
->PixelTransferf
= save_PixelTransferf
;
7614 table
->PixelTransferi
= save_PixelTransferi
;
7615 table
->PixelZoom
= save_PixelZoom
;
7616 table
->PointSize
= save_PointSize
;
7617 table
->PolygonMode
= save_PolygonMode
;
7618 table
->PolygonOffset
= save_PolygonOffset
;
7619 table
->PolygonStipple
= save_PolygonStipple
;
7620 table
->PopAttrib
= save_PopAttrib
;
7621 table
->PopMatrix
= save_PopMatrix
;
7622 table
->PopName
= save_PopName
;
7623 table
->PushAttrib
= save_PushAttrib
;
7624 table
->PushMatrix
= save_PushMatrix
;
7625 table
->PushName
= save_PushName
;
7626 table
->RasterPos2d
= save_RasterPos2d
;
7627 table
->RasterPos2dv
= save_RasterPos2dv
;
7628 table
->RasterPos2f
= save_RasterPos2f
;
7629 table
->RasterPos2fv
= save_RasterPos2fv
;
7630 table
->RasterPos2i
= save_RasterPos2i
;
7631 table
->RasterPos2iv
= save_RasterPos2iv
;
7632 table
->RasterPos2s
= save_RasterPos2s
;
7633 table
->RasterPos2sv
= save_RasterPos2sv
;
7634 table
->RasterPos3d
= save_RasterPos3d
;
7635 table
->RasterPos3dv
= save_RasterPos3dv
;
7636 table
->RasterPos3f
= save_RasterPos3f
;
7637 table
->RasterPos3fv
= save_RasterPos3fv
;
7638 table
->RasterPos3i
= save_RasterPos3i
;
7639 table
->RasterPos3iv
= save_RasterPos3iv
;
7640 table
->RasterPos3s
= save_RasterPos3s
;
7641 table
->RasterPos3sv
= save_RasterPos3sv
;
7642 table
->RasterPos4d
= save_RasterPos4d
;
7643 table
->RasterPos4dv
= save_RasterPos4dv
;
7644 table
->RasterPos4f
= save_RasterPos4f
;
7645 table
->RasterPos4fv
= save_RasterPos4fv
;
7646 table
->RasterPos4i
= save_RasterPos4i
;
7647 table
->RasterPos4iv
= save_RasterPos4iv
;
7648 table
->RasterPos4s
= save_RasterPos4s
;
7649 table
->RasterPos4sv
= save_RasterPos4sv
;
7650 table
->ReadBuffer
= save_ReadBuffer
;
7651 table
->ReadPixels
= exec_ReadPixels
;
7652 table
->RenderMode
= exec_RenderMode
;
7653 table
->Rotated
= save_Rotated
;
7654 table
->Rotatef
= save_Rotatef
;
7655 table
->Scaled
= save_Scaled
;
7656 table
->Scalef
= save_Scalef
;
7657 table
->Scissor
= save_Scissor
;
7658 table
->FeedbackBuffer
= exec_FeedbackBuffer
;
7659 table
->SelectBuffer
= exec_SelectBuffer
;
7660 table
->ShadeModel
= save_ShadeModel
;
7661 table
->StencilFunc
= save_StencilFunc
;
7662 table
->StencilMask
= save_StencilMask
;
7663 table
->StencilOp
= save_StencilOp
;
7664 table
->TexEnvf
= save_TexEnvf
;
7665 table
->TexEnvfv
= save_TexEnvfv
;
7666 table
->TexEnvi
= save_TexEnvi
;
7667 table
->TexEnviv
= save_TexEnviv
;
7668 table
->TexGend
= save_TexGend
;
7669 table
->TexGendv
= save_TexGendv
;
7670 table
->TexGenf
= save_TexGenf
;
7671 table
->TexGenfv
= save_TexGenfv
;
7672 table
->TexGeni
= save_TexGeni
;
7673 table
->TexGeniv
= save_TexGeniv
;
7674 table
->TexImage1D
= save_TexImage1D
;
7675 table
->TexImage2D
= save_TexImage2D
;
7676 table
->TexParameterf
= save_TexParameterf
;
7677 table
->TexParameterfv
= save_TexParameterfv
;
7678 table
->TexParameteri
= save_TexParameteri
;
7679 table
->TexParameteriv
= save_TexParameteriv
;
7680 table
->Translated
= save_Translated
;
7681 table
->Translatef
= save_Translatef
;
7682 table
->Viewport
= save_Viewport
;
7685 table
->AreTexturesResident
= exec_AreTexturesResident
;
7686 table
->AreTexturesResidentEXT
= exec_AreTexturesResident
;
7687 table
->BindTexture
= save_BindTexture
;
7688 table
->ColorPointer
= exec_ColorPointer
;
7689 table
->CopyTexImage1D
= save_CopyTexImage1D
;
7690 table
->CopyTexImage2D
= save_CopyTexImage2D
;
7691 table
->CopyTexSubImage1D
= save_CopyTexSubImage1D
;
7692 table
->CopyTexSubImage2D
= save_CopyTexSubImage2D
;
7693 table
->DeleteTextures
= exec_DeleteTextures
;
7694 table
->DisableClientState
= exec_DisableClientState
;
7695 table
->EdgeFlagPointer
= exec_EdgeFlagPointer
;
7696 table
->EnableClientState
= exec_EnableClientState
;
7697 table
->GenTextures
= exec_GenTextures
;
7698 table
->GenTexturesEXT
= exec_GenTextures
;
7699 table
->GetPointerv
= exec_GetPointerv
;
7700 table
->IndexPointer
= exec_IndexPointer
;
7701 table
->InterleavedArrays
= exec_InterleavedArrays
;
7702 table
->IsTexture
= exec_IsTexture
;
7703 table
->IsTextureEXT
= exec_IsTexture
;
7704 table
->NormalPointer
= exec_NormalPointer
;
7705 table
->PopClientAttrib
= exec_PopClientAttrib
;
7706 table
->PrioritizeTextures
= save_PrioritizeTextures
;
7707 table
->PushClientAttrib
= exec_PushClientAttrib
;
7708 table
->TexCoordPointer
= exec_TexCoordPointer
;
7709 table
->TexSubImage1D
= save_TexSubImage1D
;
7710 table
->TexSubImage2D
= save_TexSubImage2D
;
7711 table
->VertexPointer
= exec_VertexPointer
;
7714 table
->CopyTexSubImage3D
= save_CopyTexSubImage3D
;
7715 table
->TexImage3D
= save_TexImage3D
;
7716 table
->TexSubImage3D
= save_TexSubImage3D
;
7719 table
->StencilFuncSeparate
= save_StencilFuncSeparate
;
7720 table
->StencilMaskSeparate
= save_StencilMaskSeparate
;
7721 table
->StencilOpSeparate
= save_StencilOpSeparate
;
7723 /* GL_ARB_imaging */
7724 /* Not all are supported */
7725 table
->BlendColor
= save_BlendColor
;
7726 table
->BlendEquation
= save_BlendEquation
;
7727 table
->ColorSubTable
= save_ColorSubTable
;
7728 table
->ColorTable
= save_ColorTable
;
7729 table
->ColorTableParameterfv
= save_ColorTableParameterfv
;
7730 table
->ColorTableParameteriv
= save_ColorTableParameteriv
;
7731 table
->ConvolutionFilter1D
= save_ConvolutionFilter1D
;
7732 table
->ConvolutionFilter2D
= save_ConvolutionFilter2D
;
7733 table
->ConvolutionParameterf
= save_ConvolutionParameterf
;
7734 table
->ConvolutionParameterfv
= save_ConvolutionParameterfv
;
7735 table
->ConvolutionParameteri
= save_ConvolutionParameteri
;
7736 table
->ConvolutionParameteriv
= save_ConvolutionParameteriv
;
7737 table
->CopyColorSubTable
= save_CopyColorSubTable
;
7738 table
->CopyColorTable
= save_CopyColorTable
;
7739 table
->CopyConvolutionFilter1D
= exec_CopyConvolutionFilter1D
;
7740 table
->CopyConvolutionFilter2D
= exec_CopyConvolutionFilter2D
;
7741 table
->GetColorTable
= exec_GetColorTable
;
7742 table
->GetColorTableEXT
= exec_GetColorTable
;
7743 table
->GetColorTableParameterfv
= exec_GetColorTableParameterfv
;
7744 table
->GetColorTableParameterfvEXT
= exec_GetColorTableParameterfv
;
7745 table
->GetColorTableParameteriv
= exec_GetColorTableParameteriv
;
7746 table
->GetColorTableParameterivEXT
= exec_GetColorTableParameteriv
;
7747 table
->GetConvolutionFilter
= exec_GetConvolutionFilter
;
7748 table
->GetConvolutionFilterEXT
= exec_GetConvolutionFilter
;
7749 table
->GetConvolutionParameterfv
= exec_GetConvolutionParameterfv
;
7750 table
->GetConvolutionParameterfvEXT
= exec_GetConvolutionParameterfv
;
7751 table
->GetConvolutionParameteriv
= exec_GetConvolutionParameteriv
;
7752 table
->GetConvolutionParameterivEXT
= exec_GetConvolutionParameteriv
;
7753 table
->GetHistogram
= exec_GetHistogram
;
7754 table
->GetHistogramEXT
= exec_GetHistogram
;
7755 table
->GetHistogramParameterfv
= exec_GetHistogramParameterfv
;
7756 table
->GetHistogramParameterfvEXT
= exec_GetHistogramParameterfv
;
7757 table
->GetHistogramParameteriv
= exec_GetHistogramParameteriv
;
7758 table
->GetHistogramParameterivEXT
= exec_GetHistogramParameteriv
;
7759 table
->GetMinmax
= exec_GetMinmax
;
7760 table
->GetMinmaxEXT
= exec_GetMinmax
;
7761 table
->GetMinmaxParameterfv
= exec_GetMinmaxParameterfv
;
7762 table
->GetMinmaxParameterfvEXT
= exec_GetMinmaxParameterfv
;
7763 table
->GetMinmaxParameteriv
= exec_GetMinmaxParameteriv
;
7764 table
->GetMinmaxParameterivEXT
= exec_GetMinmaxParameteriv
;
7765 table
->GetSeparableFilter
= exec_GetSeparableFilter
;
7766 table
->GetSeparableFilterEXT
= exec_GetSeparableFilter
;
7767 table
->Histogram
= save_Histogram
;
7768 table
->Minmax
= save_Minmax
;
7769 table
->ResetHistogram
= save_ResetHistogram
;
7770 table
->ResetMinmax
= save_ResetMinmax
;
7771 table
->SeparableFilter2D
= exec_SeparableFilter2D
;
7773 /* 2. GL_EXT_blend_color */
7775 table
->BlendColorEXT
= save_BlendColorEXT
;
7778 /* 3. GL_EXT_polygon_offset */
7779 table
->PolygonOffsetEXT
= save_PolygonOffsetEXT
;
7781 /* 6. GL_EXT_texture3d */
7783 table
->CopyTexSubImage3DEXT
= save_CopyTexSubImage3D
;
7784 table
->TexImage3DEXT
= save_TexImage3DEXT
;
7785 table
->TexSubImage3DEXT
= save_TexSubImage3D
;
7788 /* 15. GL_SGIX_pixel_texture */
7789 table
->PixelTexGenSGIX
= save_PixelTexGenSGIX
;
7791 /* 15. GL_SGIS_pixel_texture */
7792 table
->PixelTexGenParameteriSGIS
= save_PixelTexGenParameteriSGIS
;
7793 table
->PixelTexGenParameterfSGIS
= save_PixelTexGenParameterfSGIS
;
7794 table
->PixelTexGenParameterivSGIS
= save_PixelTexGenParameterivSGIS
;
7795 table
->PixelTexGenParameterfvSGIS
= save_PixelTexGenParameterfvSGIS
;
7796 table
->GetPixelTexGenParameterivSGIS
= exec_GetPixelTexGenParameterivSGIS
;
7797 table
->GetPixelTexGenParameterfvSGIS
= exec_GetPixelTexGenParameterfvSGIS
;
7799 /* 30. GL_EXT_vertex_array */
7800 table
->ColorPointerEXT
= exec_ColorPointerEXT
;
7801 table
->EdgeFlagPointerEXT
= exec_EdgeFlagPointerEXT
;
7802 table
->IndexPointerEXT
= exec_IndexPointerEXT
;
7803 table
->NormalPointerEXT
= exec_NormalPointerEXT
;
7804 table
->TexCoordPointerEXT
= exec_TexCoordPointerEXT
;
7805 table
->VertexPointerEXT
= exec_VertexPointerEXT
;
7807 /* 37. GL_EXT_blend_minmax */
7809 table
->BlendEquationEXT
= save_BlendEquationEXT
;
7812 /* 54. GL_EXT_point_parameters */
7813 table
->PointParameterfEXT
= save_PointParameterfEXT
;
7814 table
->PointParameterfvEXT
= save_PointParameterfvEXT
;
7816 /* 78. GL_EXT_paletted_texture */
7818 table
->ColorTableEXT
= save_ColorTable
;
7819 table
->ColorSubTableEXT
= save_ColorSubTable
;
7821 table
->GetColorTableEXT
= exec_GetColorTable
;
7822 table
->GetColorTableParameterfvEXT
= exec_GetColorTableParameterfv
;
7823 table
->GetColorTableParameterivEXT
= exec_GetColorTableParameteriv
;
7825 /* 97. GL_EXT_compiled_vertex_array */
7826 table
->LockArraysEXT
= exec_LockArraysEXT
;
7827 table
->UnlockArraysEXT
= exec_UnlockArraysEXT
;
7829 /* 145. GL_EXT_secondary_color */
7830 table
->SecondaryColorPointerEXT
= exec_SecondaryColorPointerEXT
;
7832 /* 148. GL_EXT_multi_draw_arrays */
7833 table
->MultiDrawArraysEXT
= exec_MultiDrawArraysEXT
;
7834 table
->MultiDrawElementsEXT
= exec_MultiDrawElementsEXT
;
7836 /* 149. GL_EXT_fog_coord */
7837 table
->FogCoordPointerEXT
= exec_FogCoordPointerEXT
;
7839 /* 173. GL_EXT_blend_func_separate */
7840 table
->BlendFuncSeparateEXT
= save_BlendFuncSeparateEXT
;
7842 /* 196. GL_MESA_resize_buffers */
7843 table
->ResizeBuffersMESA
= _mesa_ResizeBuffersMESA
;
7845 /* 197. GL_MESA_window_pos */
7846 table
->WindowPos2dMESA
= save_WindowPos2dMESA
;
7847 table
->WindowPos2dvMESA
= save_WindowPos2dvMESA
;
7848 table
->WindowPos2fMESA
= save_WindowPos2fMESA
;
7849 table
->WindowPos2fvMESA
= save_WindowPos2fvMESA
;
7850 table
->WindowPos2iMESA
= save_WindowPos2iMESA
;
7851 table
->WindowPos2ivMESA
= save_WindowPos2ivMESA
;
7852 table
->WindowPos2sMESA
= save_WindowPos2sMESA
;
7853 table
->WindowPos2svMESA
= save_WindowPos2svMESA
;
7854 table
->WindowPos3dMESA
= save_WindowPos3dMESA
;
7855 table
->WindowPos3dvMESA
= save_WindowPos3dvMESA
;
7856 table
->WindowPos3fMESA
= save_WindowPos3fMESA
;
7857 table
->WindowPos3fvMESA
= save_WindowPos3fvMESA
;
7858 table
->WindowPos3iMESA
= save_WindowPos3iMESA
;
7859 table
->WindowPos3ivMESA
= save_WindowPos3ivMESA
;
7860 table
->WindowPos3sMESA
= save_WindowPos3sMESA
;
7861 table
->WindowPos3svMESA
= save_WindowPos3svMESA
;
7862 table
->WindowPos4dMESA
= save_WindowPos4dMESA
;
7863 table
->WindowPos4dvMESA
= save_WindowPos4dvMESA
;
7864 table
->WindowPos4fMESA
= save_WindowPos4fMESA
;
7865 table
->WindowPos4fvMESA
= save_WindowPos4fvMESA
;
7866 table
->WindowPos4iMESA
= save_WindowPos4iMESA
;
7867 table
->WindowPos4ivMESA
= save_WindowPos4ivMESA
;
7868 table
->WindowPos4sMESA
= save_WindowPos4sMESA
;
7869 table
->WindowPos4svMESA
= save_WindowPos4svMESA
;
7871 /* 200. GL_IBM_multimode_draw_arrays */
7872 table
->MultiModeDrawArraysIBM
= exec_MultiModeDrawArraysIBM
;
7873 table
->MultiModeDrawElementsIBM
= exec_MultiModeDrawElementsIBM
;
7875 #if FEATURE_NV_vertex_program
7876 /* 233. GL_NV_vertex_program */
7877 /* The following commands DO NOT go into display lists:
7878 * AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV,
7879 * VertexAttribPointerNV, GetProgram*, GetVertexAttrib*
7881 table
->BindProgramNV
= save_BindProgramNV
;
7882 table
->DeleteProgramsNV
= _mesa_DeletePrograms
;
7883 table
->ExecuteProgramNV
= save_ExecuteProgramNV
;
7884 table
->GenProgramsNV
= _mesa_GenPrograms
;
7885 table
->AreProgramsResidentNV
= _mesa_AreProgramsResidentNV
;
7886 table
->RequestResidentProgramsNV
= save_RequestResidentProgramsNV
;
7887 table
->GetProgramParameterfvNV
= _mesa_GetProgramParameterfvNV
;
7888 table
->GetProgramParameterdvNV
= _mesa_GetProgramParameterdvNV
;
7889 table
->GetProgramivNV
= _mesa_GetProgramivNV
;
7890 table
->GetProgramStringNV
= _mesa_GetProgramStringNV
;
7891 table
->GetTrackMatrixivNV
= _mesa_GetTrackMatrixivNV
;
7892 table
->GetVertexAttribdvNV
= _mesa_GetVertexAttribdvNV
;
7893 table
->GetVertexAttribfvNV
= _mesa_GetVertexAttribfvNV
;
7894 table
->GetVertexAttribivNV
= _mesa_GetVertexAttribivNV
;
7895 table
->GetVertexAttribPointervNV
= _mesa_GetVertexAttribPointervNV
;
7896 table
->IsProgramNV
= _mesa_IsProgram
;
7897 table
->LoadProgramNV
= save_LoadProgramNV
;
7898 table
->ProgramParameter4dNV
= save_ProgramParameter4dNV
;
7899 table
->ProgramParameter4dvNV
= save_ProgramParameter4dvNV
;
7900 table
->ProgramParameter4fNV
= save_ProgramParameter4fNV
;
7901 table
->ProgramParameter4fvNV
= save_ProgramParameter4fvNV
;
7902 table
->ProgramParameters4dvNV
= save_ProgramParameters4dvNV
;
7903 table
->ProgramParameters4fvNV
= save_ProgramParameters4fvNV
;
7904 table
->TrackMatrixNV
= save_TrackMatrixNV
;
7905 table
->VertexAttribPointerNV
= _mesa_VertexAttribPointerNV
;
7908 /* 245. GL_ATI_fragment_shader */
7909 #if FEATURE_ATI_fragment_shader
7910 table
->BindFragmentShaderATI
= save_BindFragmentShaderATI
;
7911 table
->SetFragmentShaderConstantATI
= save_SetFragmentShaderConstantATI
;
7914 /* 282. GL_NV_fragment_program */
7915 #if FEATURE_NV_fragment_program
7916 table
->ProgramNamedParameter4fNV
= save_ProgramNamedParameter4fNV
;
7917 table
->ProgramNamedParameter4dNV
= save_ProgramNamedParameter4dNV
;
7918 table
->ProgramNamedParameter4fvNV
= save_ProgramNamedParameter4fvNV
;
7919 table
->ProgramNamedParameter4dvNV
= save_ProgramNamedParameter4dvNV
;
7920 table
->GetProgramNamedParameterfvNV
= _mesa_GetProgramNamedParameterfvNV
;
7921 table
->GetProgramNamedParameterdvNV
= _mesa_GetProgramNamedParameterdvNV
;
7922 table
->ProgramLocalParameter4dARB
= save_ProgramLocalParameter4dARB
;
7923 table
->ProgramLocalParameter4dvARB
= save_ProgramLocalParameter4dvARB
;
7924 table
->ProgramLocalParameter4fARB
= save_ProgramLocalParameter4fARB
;
7925 table
->ProgramLocalParameter4fvARB
= save_ProgramLocalParameter4fvARB
;
7926 table
->GetProgramLocalParameterdvARB
= _mesa_GetProgramLocalParameterdvARB
;
7927 table
->GetProgramLocalParameterfvARB
= _mesa_GetProgramLocalParameterfvARB
;
7930 /* 262. GL_NV_point_sprite */
7931 table
->PointParameteriNV
= save_PointParameteriNV
;
7932 table
->PointParameterivNV
= save_PointParameterivNV
;
7934 /* 268. GL_EXT_stencil_two_side */
7935 table
->ActiveStencilFaceEXT
= save_ActiveStencilFaceEXT
;
7937 /* ???. GL_EXT_depth_bounds_test */
7938 table
->DepthBoundsEXT
= save_DepthBoundsEXT
;
7940 /* ARB 1. GL_ARB_multitexture */
7941 table
->ActiveTextureARB
= save_ActiveTextureARB
;
7942 table
->ClientActiveTextureARB
= exec_ClientActiveTextureARB
;
7944 /* ARB 3. GL_ARB_transpose_matrix */
7945 table
->LoadTransposeMatrixdARB
= save_LoadTransposeMatrixdARB
;
7946 table
->LoadTransposeMatrixfARB
= save_LoadTransposeMatrixfARB
;
7947 table
->MultTransposeMatrixdARB
= save_MultTransposeMatrixdARB
;
7948 table
->MultTransposeMatrixfARB
= save_MultTransposeMatrixfARB
;
7950 /* ARB 5. GL_ARB_multisample */
7951 table
->SampleCoverageARB
= save_SampleCoverageARB
;
7953 /* ARB 12. GL_ARB_texture_compression */
7954 table
->CompressedTexImage3DARB
= save_CompressedTexImage3DARB
;
7955 table
->CompressedTexImage2DARB
= save_CompressedTexImage2DARB
;
7956 table
->CompressedTexImage1DARB
= save_CompressedTexImage1DARB
;
7957 table
->CompressedTexSubImage3DARB
= save_CompressedTexSubImage3DARB
;
7958 table
->CompressedTexSubImage2DARB
= save_CompressedTexSubImage2DARB
;
7959 table
->CompressedTexSubImage1DARB
= save_CompressedTexSubImage1DARB
;
7960 table
->GetCompressedTexImageARB
= exec_GetCompressedTexImageARB
;
7962 /* ARB 14. GL_ARB_point_parameters */
7963 /* aliased with EXT_point_parameters functions */
7965 /* ARB 25. GL_ARB_window_pos */
7966 /* aliased with MESA_window_pos functions */
7968 /* ARB 26. GL_ARB_vertex_program */
7969 /* ARB 27. GL_ARB_fragment_program */
7970 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
7971 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
7972 table
->VertexAttribPointerARB
= _mesa_VertexAttribPointerARB
;
7973 table
->EnableVertexAttribArrayARB
= _mesa_EnableVertexAttribArrayARB
;
7974 table
->DisableVertexAttribArrayARB
= _mesa_DisableVertexAttribArrayARB
;
7975 table
->ProgramStringARB
= save_ProgramStringARB
;
7976 table
->BindProgramNV
= save_BindProgramNV
;
7977 table
->DeleteProgramsNV
= _mesa_DeletePrograms
;
7978 table
->GenProgramsNV
= _mesa_GenPrograms
;
7979 table
->IsProgramNV
= _mesa_IsProgram
;
7980 table
->GetVertexAttribdvNV
= _mesa_GetVertexAttribdvNV
;
7981 table
->GetVertexAttribfvNV
= _mesa_GetVertexAttribfvNV
;
7982 table
->GetVertexAttribivNV
= _mesa_GetVertexAttribivNV
;
7983 table
->GetVertexAttribPointervNV
= _mesa_GetVertexAttribPointervNV
;
7984 table
->ProgramEnvParameter4dARB
= save_ProgramEnvParameter4dARB
;
7985 table
->ProgramEnvParameter4dvARB
= save_ProgramEnvParameter4dvARB
;
7986 table
->ProgramEnvParameter4fARB
= save_ProgramEnvParameter4fARB
;
7987 table
->ProgramEnvParameter4fvARB
= save_ProgramEnvParameter4fvARB
;
7988 table
->ProgramLocalParameter4dARB
= save_ProgramLocalParameter4dARB
;
7989 table
->ProgramLocalParameter4dvARB
= save_ProgramLocalParameter4dvARB
;
7990 table
->ProgramLocalParameter4fARB
= save_ProgramLocalParameter4fARB
;
7991 table
->ProgramLocalParameter4fvARB
= save_ProgramLocalParameter4fvARB
;
7992 table
->GetProgramEnvParameterdvARB
= _mesa_GetProgramEnvParameterdvARB
;
7993 table
->GetProgramEnvParameterfvARB
= _mesa_GetProgramEnvParameterfvARB
;
7994 table
->GetProgramLocalParameterdvARB
= _mesa_GetProgramLocalParameterdvARB
;
7995 table
->GetProgramLocalParameterfvARB
= _mesa_GetProgramLocalParameterfvARB
;
7996 table
->GetProgramivARB
= _mesa_GetProgramivARB
;
7997 table
->GetProgramStringARB
= _mesa_GetProgramStringARB
;
8000 /* ARB 28. GL_ARB_vertex_buffer_object */
8001 #if FEATURE_ARB_vertex_buffer_object
8002 /* None of the extension's functions get compiled */
8003 table
->BindBufferARB
= _mesa_BindBufferARB
;
8004 table
->BufferDataARB
= _mesa_BufferDataARB
;
8005 table
->BufferSubDataARB
= _mesa_BufferSubDataARB
;
8006 table
->DeleteBuffersARB
= _mesa_DeleteBuffersARB
;
8007 table
->GenBuffersARB
= _mesa_GenBuffersARB
;
8008 table
->GetBufferParameterivARB
= _mesa_GetBufferParameterivARB
;
8009 table
->GetBufferPointervARB
= _mesa_GetBufferPointervARB
;
8010 table
->GetBufferSubDataARB
= _mesa_GetBufferSubDataARB
;
8011 table
->IsBufferARB
= _mesa_IsBufferARB
;
8012 table
->MapBufferARB
= _mesa_MapBufferARB
;
8013 table
->UnmapBufferARB
= _mesa_UnmapBufferARB
;
8016 #if FEATURE_ARB_occlusion_query
8017 table
->BeginQueryARB
= save_BeginQueryARB
;
8018 table
->EndQueryARB
= save_EndQueryARB
;
8019 table
->GenQueriesARB
= _mesa_GenQueriesARB
;
8020 table
->DeleteQueriesARB
= _mesa_DeleteQueriesARB
;
8021 table
->IsQueryARB
= _mesa_IsQueryARB
;
8022 table
->GetQueryivARB
= _mesa_GetQueryivARB
;
8023 table
->GetQueryObjectivARB
= _mesa_GetQueryObjectivARB
;
8024 table
->GetQueryObjectuivARB
= _mesa_GetQueryObjectuivARB
;
8026 table
->DrawBuffersARB
= save_DrawBuffersARB
;
8028 /* 299. GL_EXT_blend_equation_separate */
8029 table
->BlendEquationSeparateEXT
= save_BlendEquationSeparateEXT
;
8037 static const char *enum_string( GLenum k
)
8039 return _mesa_lookup_enum_by_nr( k
);
8044 * Print the commands in a display list. For debugging only.
8045 * TODO: many commands aren't handled yet.
8047 static void GLAPIENTRY
print_list( GLcontext
*ctx
, GLuint list
)
8049 struct mesa_display_list
*dlist
;
8053 if (!GL_CALL(IsList
)(list
)) {
8054 _mesa_printf("%u is not a display list ID\n", list
);
8058 dlist
= (struct mesa_display_list
*) _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
8064 _mesa_printf("START-LIST %u, address %p\n", list
, (void*)n
);
8066 done
= n
? GL_FALSE
: GL_TRUE
;
8068 OpCode opcode
= n
[0].opcode
;
8069 GLint i
= (GLint
) n
[0].opcode
- (GLint
) OPCODE_EXT_0
;
8071 if (i
>= 0 && i
< (GLint
) ctx
->ListExt
.NumOpcodes
) {
8072 /* this is a driver-extended opcode */
8073 ctx
->ListExt
.Opcode
[i
].Print(ctx
, &n
[1]);
8074 n
+= ctx
->ListExt
.Opcode
[i
].Size
;
8079 _mesa_printf("accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
8082 _mesa_printf("Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
8083 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
, (void *) n
[7].data
);
8085 case OPCODE_CALL_LIST
:
8086 _mesa_printf("CallList %d\n", (int) n
[1].ui
);
8088 case OPCODE_CALL_LIST_OFFSET
:
8089 _mesa_printf("CallList %d + offset %u = %u\n", (int) n
[1].ui
,
8090 ctx
->List
.ListBase
, ctx
->List
.ListBase
+ n
[1].ui
);
8092 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
8093 _mesa_printf("ColorTableParameterfv %s %s %f %f %f %f\n",
8094 enum_string(n
[1].e
), enum_string(n
[2].e
),
8095 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8097 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
8098 _mesa_printf("ColorTableParameteriv %s %s %d %d %d %d\n",
8099 enum_string(n
[1].e
), enum_string(n
[2].e
),
8100 n
[3].i
, n
[4].i
, n
[5].i
, n
[6].i
);
8102 case OPCODE_DISABLE
:
8103 _mesa_printf("Disable %s\n", enum_string(n
[1].e
));
8106 _mesa_printf("Enable %s\n", enum_string(n
[1].e
));
8108 case OPCODE_FRUSTUM
:
8109 _mesa_printf("Frustum %g %g %g %g %g %g\n",
8110 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8112 case OPCODE_LINE_STIPPLE
:
8113 _mesa_printf("LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
8115 case OPCODE_LOAD_IDENTITY
:
8116 _mesa_printf("LoadIdentity\n");
8118 case OPCODE_LOAD_MATRIX
:
8119 _mesa_printf("LoadMatrix\n");
8120 _mesa_printf(" %8f %8f %8f %8f\n",
8121 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
8122 _mesa_printf(" %8f %8f %8f %8f\n",
8123 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
8124 _mesa_printf(" %8f %8f %8f %8f\n",
8125 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
8126 _mesa_printf(" %8f %8f %8f %8f\n",
8127 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
8129 case OPCODE_MULT_MATRIX
:
8130 _mesa_printf("MultMatrix (or Rotate)\n");
8131 _mesa_printf(" %8f %8f %8f %8f\n",
8132 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
8133 _mesa_printf(" %8f %8f %8f %8f\n",
8134 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
8135 _mesa_printf(" %8f %8f %8f %8f\n",
8136 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
8137 _mesa_printf(" %8f %8f %8f %8f\n",
8138 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
8141 _mesa_printf("Ortho %g %g %g %g %g %g\n",
8142 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8144 case OPCODE_POP_ATTRIB
:
8145 _mesa_printf("PopAttrib\n");
8147 case OPCODE_POP_MATRIX
:
8148 _mesa_printf("PopMatrix\n");
8150 case OPCODE_POP_NAME
:
8151 _mesa_printf("PopName\n");
8153 case OPCODE_PUSH_ATTRIB
:
8154 _mesa_printf("PushAttrib %x\n", n
[1].bf
);
8156 case OPCODE_PUSH_MATRIX
:
8157 _mesa_printf("PushMatrix\n");
8159 case OPCODE_PUSH_NAME
:
8160 _mesa_printf("PushName %d\n", (int) n
[1].ui
);
8162 case OPCODE_RASTER_POS
:
8163 _mesa_printf("RasterPos %g %g %g %g\n",
8164 n
[1].f
, n
[2].f
,n
[3].f
,n
[4].f
);
8167 _mesa_printf("Rotate %g %g %g %g\n",
8168 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
8171 _mesa_printf("Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
8173 case OPCODE_TRANSLATE
:
8174 _mesa_printf("Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
8176 case OPCODE_BIND_TEXTURE
:
8177 _mesa_printf("BindTexture %s %d\n",
8178 _mesa_lookup_enum_by_nr(n
[1].ui
), n
[2].ui
);
8180 case OPCODE_SHADE_MODEL
:
8181 _mesa_printf("ShadeModel %s\n",
8182 _mesa_lookup_enum_by_nr(n
[1].ui
));
8185 _mesa_printf("Map1 %s %.3f %.3f %d %d\n",
8186 _mesa_lookup_enum_by_nr(n
[1].ui
),
8187 n
[2].f
, n
[3].f
, n
[4].i
, n
[5].i
);
8190 _mesa_printf("Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
8191 _mesa_lookup_enum_by_nr(n
[1].ui
),
8192 n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
,
8193 n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
8195 case OPCODE_MAPGRID1
:
8196 _mesa_printf("MapGrid1 %d %.3f %.3f\n",
8197 n
[1].i
, n
[2].f
, n
[3].f
);
8199 case OPCODE_MAPGRID2
:
8200 _mesa_printf("MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
8201 n
[1].i
, n
[2].f
, n
[3].f
,
8202 n
[4].i
, n
[5].f
, n
[6].f
);
8204 case OPCODE_EVALMESH1
:
8205 _mesa_printf("EvalMesh1 %d %d\n", n
[1].i
, n
[2].i
);
8207 case OPCODE_EVALMESH2
:
8208 _mesa_printf("EvalMesh2 %d %d %d %d\n",
8209 n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
8212 case OPCODE_ATTR_1F_NV
:
8213 _mesa_printf("ATTR_1F_NV attr %d: %f\n",
8216 case OPCODE_ATTR_2F_NV
:
8217 _mesa_printf("ATTR_2F_NV attr %d: %f %f\n",
8218 n
[1].i
, n
[2].f
, n
[3].f
);
8220 case OPCODE_ATTR_3F_NV
:
8221 _mesa_printf("ATTR_3F_NV attr %d: %f %f %f\n",
8222 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
8224 case OPCODE_ATTR_4F_NV
:
8225 _mesa_printf("ATTR_4F_NV attr %d: %f %f %f %f\n",
8226 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
8228 case OPCODE_ATTR_1F_ARB
:
8229 _mesa_printf("ATTR_1F_ARB attr %d: %f\n",
8232 case OPCODE_ATTR_2F_ARB
:
8233 _mesa_printf("ATTR_2F_ARB attr %d: %f %f\n",
8234 n
[1].i
, n
[2].f
, n
[3].f
);
8236 case OPCODE_ATTR_3F_ARB
:
8237 _mesa_printf("ATTR_3F_ARB attr %d: %f %f %f\n",
8238 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
8240 case OPCODE_ATTR_4F_ARB
:
8241 _mesa_printf("ATTR_4F_ARB attr %d: %f %f %f %f\n",
8242 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
8245 case OPCODE_MATERIAL
:
8246 _mesa_printf("MATERIAL %x %x: %f %f %f %f\n",
8247 n
[1].i
, n
[2].i
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8250 _mesa_printf("INDEX: %f\n", n
[1].f
);
8252 case OPCODE_EDGEFLAG
:
8253 _mesa_printf("EDGEFLAG: %d\n", n
[1].i
);
8256 _mesa_printf("BEGIN %x\n", n
[1].i
);
8259 _mesa_printf("END\n");
8262 _mesa_printf("RECTF %f %f %f %f\n", n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
8264 case OPCODE_EVAL_C1
:
8265 _mesa_printf("EVAL_C1 %f\n", n
[1].f
);
8267 case OPCODE_EVAL_C2
:
8268 _mesa_printf("EVAL_C2 %f %f\n", n
[1].f
, n
[2].f
);
8270 case OPCODE_EVAL_P1
:
8271 _mesa_printf("EVAL_P1 %d\n", n
[1].i
);
8273 case OPCODE_EVAL_P2
:
8274 _mesa_printf("EVAL_P2 %d %d\n", n
[1].i
, n
[2].i
);
8280 * meta opcodes/commands
8283 _mesa_printf("Error: %s %s\n",
8284 enum_string(n
[1].e
), (const char *)n
[2].data
);
8286 case OPCODE_CONTINUE
:
8287 _mesa_printf("DISPLAY-LIST-CONTINUE\n");
8288 n
= (Node
*) n
[1].next
;
8290 case OPCODE_END_OF_LIST
:
8291 _mesa_printf("END-LIST %u\n", list
);
8295 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
8296 _mesa_printf("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
8301 _mesa_printf("command %d, %u operands\n", opcode
, InstSize
[opcode
]);
8304 /* increment n to point to next compiled command */
8305 if (opcode
!=OPCODE_CONTINUE
) {
8306 n
+= InstSize
[opcode
];
8315 * Clients may call this function to help debug display list problems.
8316 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
8317 * changed, or break in the future without notice.
8319 void mesa_print_display_list( GLuint list
)
8321 GET_CURRENT_CONTEXT(ctx
);
8322 print_list( ctx
, list
);
8326 /**********************************************************************/
8327 /***** Initialization *****/
8328 /**********************************************************************/
8331 void _mesa_save_vtxfmt_init( GLvertexformat
*vfmt
)
8333 vfmt
->ArrayElement
= _ae_loopback_array_elt
; /* generic helper */
8334 vfmt
->Begin
= save_Begin
;
8335 vfmt
->CallList
= _mesa_save_CallList
;
8336 vfmt
->CallLists
= _mesa_save_CallLists
;
8337 vfmt
->Color3f
= save_Color3f
;
8338 vfmt
->Color3fv
= save_Color3fv
;
8339 vfmt
->Color4f
= save_Color4f
;
8340 vfmt
->Color4fv
= save_Color4fv
;
8341 vfmt
->EdgeFlag
= save_EdgeFlag
;
8342 vfmt
->EdgeFlagv
= save_EdgeFlagv
;
8343 vfmt
->End
= save_End
;
8344 vfmt
->EvalCoord1f
= save_EvalCoord1f
;
8345 vfmt
->EvalCoord1fv
= save_EvalCoord1fv
;
8346 vfmt
->EvalCoord2f
= save_EvalCoord2f
;
8347 vfmt
->EvalCoord2fv
= save_EvalCoord2fv
;
8348 vfmt
->EvalPoint1
= save_EvalPoint1
;
8349 vfmt
->EvalPoint2
= save_EvalPoint2
;
8350 vfmt
->FogCoordfEXT
= save_FogCoordfEXT
;
8351 vfmt
->FogCoordfvEXT
= save_FogCoordfvEXT
;
8352 vfmt
->Indexf
= save_Indexf
;
8353 vfmt
->Indexfv
= save_Indexfv
;
8354 vfmt
->Materialfv
= save_Materialfv
;
8355 vfmt
->MultiTexCoord1fARB
= save_MultiTexCoord1f
;
8356 vfmt
->MultiTexCoord1fvARB
= save_MultiTexCoord1fv
;
8357 vfmt
->MultiTexCoord2fARB
= save_MultiTexCoord2f
;
8358 vfmt
->MultiTexCoord2fvARB
= save_MultiTexCoord2fv
;
8359 vfmt
->MultiTexCoord3fARB
= save_MultiTexCoord3f
;
8360 vfmt
->MultiTexCoord3fvARB
= save_MultiTexCoord3fv
;
8361 vfmt
->MultiTexCoord4fARB
= save_MultiTexCoord4f
;
8362 vfmt
->MultiTexCoord4fvARB
= save_MultiTexCoord4fv
;
8363 vfmt
->Normal3f
= save_Normal3f
;
8364 vfmt
->Normal3fv
= save_Normal3fv
;
8365 vfmt
->SecondaryColor3fEXT
= save_SecondaryColor3fEXT
;
8366 vfmt
->SecondaryColor3fvEXT
= save_SecondaryColor3fvEXT
;
8367 vfmt
->TexCoord1f
= save_TexCoord1f
;
8368 vfmt
->TexCoord1fv
= save_TexCoord1fv
;
8369 vfmt
->TexCoord2f
= save_TexCoord2f
;
8370 vfmt
->TexCoord2fv
= save_TexCoord2fv
;
8371 vfmt
->TexCoord3f
= save_TexCoord3f
;
8372 vfmt
->TexCoord3fv
= save_TexCoord3fv
;
8373 vfmt
->TexCoord4f
= save_TexCoord4f
;
8374 vfmt
->TexCoord4fv
= save_TexCoord4fv
;
8375 vfmt
->Vertex2f
= save_Vertex2f
;
8376 vfmt
->Vertex2fv
= save_Vertex2fv
;
8377 vfmt
->Vertex3f
= save_Vertex3f
;
8378 vfmt
->Vertex3fv
= save_Vertex3fv
;
8379 vfmt
->Vertex4f
= save_Vertex4f
;
8380 vfmt
->Vertex4fv
= save_Vertex4fv
;
8381 vfmt
->VertexAttrib1fNV
= save_VertexAttrib1fNV
;
8382 vfmt
->VertexAttrib1fvNV
= save_VertexAttrib1fvNV
;
8383 vfmt
->VertexAttrib2fNV
= save_VertexAttrib2fNV
;
8384 vfmt
->VertexAttrib2fvNV
= save_VertexAttrib2fvNV
;
8385 vfmt
->VertexAttrib3fNV
= save_VertexAttrib3fNV
;
8386 vfmt
->VertexAttrib3fvNV
= save_VertexAttrib3fvNV
;
8387 vfmt
->VertexAttrib4fNV
= save_VertexAttrib4fNV
;
8388 vfmt
->VertexAttrib4fvNV
= save_VertexAttrib4fvNV
;
8389 vfmt
->VertexAttrib1fARB
= save_VertexAttrib1fARB
;
8390 vfmt
->VertexAttrib1fvARB
= save_VertexAttrib1fvARB
;
8391 vfmt
->VertexAttrib2fARB
= save_VertexAttrib2fARB
;
8392 vfmt
->VertexAttrib2fvARB
= save_VertexAttrib2fvARB
;
8393 vfmt
->VertexAttrib3fARB
= save_VertexAttrib3fARB
;
8394 vfmt
->VertexAttrib3fvARB
= save_VertexAttrib3fvARB
;
8395 vfmt
->VertexAttrib4fARB
= save_VertexAttrib4fARB
;
8396 vfmt
->VertexAttrib4fvARB
= save_VertexAttrib4fvARB
;
8398 vfmt
->EvalMesh1
= _mesa_save_EvalMesh1
;
8399 vfmt
->EvalMesh2
= _mesa_save_EvalMesh2
;
8400 vfmt
->Rectf
= save_Rectf
;
8402 /* The driver is required to implement these as
8403 * 1) They can probably do a better job.
8404 * 2) A lot of new mechanisms would have to be added to this module
8405 * to support it. That code would probably never get used,
8409 vfmt
->DrawArrays
= 0;
8410 vfmt
->DrawElements
= 0;
8411 vfmt
->DrawRangeElements
= 0;
8417 void _mesa_init_display_list( GLcontext
* ctx
)
8420 ctx
->ListState
.CallDepth
= 0;
8421 ctx
->ExecuteFlag
= GL_TRUE
;
8422 ctx
->CompileFlag
= GL_FALSE
;
8423 ctx
->ListState
.CurrentListPtr
= NULL
;
8424 ctx
->ListState
.CurrentBlock
= NULL
;
8425 ctx
->ListState
.CurrentListNum
= 0;
8426 ctx
->ListState
.CurrentPos
= 0;
8428 /* Display List group */
8429 ctx
->List
.ListBase
= 0;
8431 _mesa_save_vtxfmt_init( &ctx
->ListState
.ListVtxfmt
);